From: Andrea Bianco Date: Thu, 7 Feb 2019 13:02:53 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.0.75 X-Git-Tag: 2.0.76~1 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=d6c9865938ecf309106bf91b040382b182eb0bf3;p=motion2.git Built motion from commit (unavailable).|2.0.75 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index a8fff90..2c5b776 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.0.75", "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-07T12:34:30.721Z", "url": "http://apidocjs.com", "version": "0.17.7" } }); +define({ "name": "xCALLY Motion API", "version": "2.0.75", "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-07T12:56:46.318Z", "url": "http://apidocjs.com", "version": "0.17.7" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 327f856..b9d8f6a 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1 +1 @@ -{ "name": "xCALLY Motion API", "version": "2.0.75", "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-07T12:34:30.721Z", "url": "http://apidocjs.com", "version": "0.17.7" } } +{ "name": "xCALLY Motion API", "version": "2.0.75", "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-07T12:56:46.318Z", "url": "http://apidocjs.com", "version": "0.17.7" } } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index dbfdbd6..77ef5b6 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 _0x2ecc=['VIRTUAL','getDataValue','jscripty','browser','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'];(function(_0xf0d4e8,_0x2685dc){var _0x51c410=function(_0xcae505){while(--_0xcae505){_0xf0d4e8['push'](_0xf0d4e8['shift']());}};_0x51c410(++_0x2685dc);}(_0x2ecc,0x19a));var _0xc2ec=function(_0x4e1c59,_0x487423){_0x4e1c59=_0x4e1c59-0x0;var _0x3b5278=_0x2ecc[_0x4e1c59];return _0x3b5278;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc2ec('0x0')],'get':function(_0x1f2140){return this[_0xc2ec('0x1')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration','motionbar',_0xc2ec('0x2'),'urlForward',_0xc2ec('0x3')]],'msg':_0xc2ec('0x4')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser'},'data1':{'type':Sequelize[_0xc2ec('0x5')](0x1000),'comment':_0xc2ec('0x6')},'data2':{'type':Sequelize[_0xc2ec('0x5')](0x1000),'comment':_0xc2ec('0x7')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xc2ec('0x8')},'data4':{'type':Sequelize[_0xc2ec('0x5')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0xc2ec('0x9')]}}; \ No newline at end of file +var _0x79ac=['integration','motionbar','jscripty','urlForward','browser','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','contactManager'];(function(_0x1641ca,_0x290a2e){var _0xd3a8d2=function(_0x1e3119){while(--_0x1e3119){_0x1641ca['push'](_0x1641ca['shift']());}};_0xd3a8d2(++_0x290a2e);}(_0x79ac,0xb5));var _0xc79a=function(_0x120e58,_0x56b355){_0x120e58=_0x120e58-0x0;var _0x571863=_0x79ac[_0x120e58];return _0x571863;};'use strict';var Sequelize=require(_0xc79a('0x0'));module[_0xc79a('0x1')]={'name':{'type':Sequelize[_0xc79a('0x2')],'get':function(_0x4473f7){return this[_0xc79a('0x3')](_0xc79a('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xc79a('0x5'),_0xc79a('0x6'),_0xc79a('0x7'),_0xc79a('0x8'),_0xc79a('0x9'),_0xc79a('0xa')]],'msg':_0xc79a('0xb')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser'},'data1':{'type':Sequelize[_0xc79a('0xc')](0x1000),'comment':_0xc79a('0xd')},'data2':{'type':Sequelize[_0xc79a('0xc')](0x1000),'comment':_0xc79a('0xe')},'data3':{'type':Sequelize[_0xc79a('0xc')](0x1000),'comment':_0xc79a('0xf')},'data4':{'type':Sequelize[_0xc79a('0xc')](0x1000)},'data5':{'type':Sequelize[_0xc79a('0xc')](0x1000)},'data6':{'type':Sequelize[_0xc79a('0xc')]},'data7':{'type':Sequelize[_0xc79a('0x10')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 08e99c9..e7ed626 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 _0xedff=['mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','body','Action','params','find','fast-json-patch','request-promise','moment','bluebird'];(function(_0x280cb6,_0x553e27){var _0x484498=function(_0x11f643){while(--_0x11f643){_0x280cb6['push'](_0x280cb6['shift']());}};_0x484498(++_0x553e27);}(_0xedff,0x18c));var _0xfedf=function(_0x517a90,_0x46b102){_0x517a90=_0x517a90-0x0;var _0x13cb98=_0xedff[_0x517a90];return _0x13cb98;};'use strict';var jsonpatch=require(_0xfedf('0x0'));var rp=require(_0xfedf('0x1'));var moment=require(_0xfedf('0x2'));var BPromise=require(_0xfedf('0x3'));var Mustache=require(_0xfedf('0x4'));var util=require(_0xfedf('0x5'));var path=require('path');var sox=require(_0xfedf('0x6'));var csv=require(_0xfedf('0x7'));var ejs=require(_0xfedf('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfedf('0x9'));var crypto=require(_0xfedf('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfedf('0xb'));var toCsv=require(_0xfedf('0x7'));var querystring=require(_0xfedf('0xc'));var Papa=require(_0xfedf('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0xfedf('0xe'))(_0xfedf('0xf'));var utils=require(_0xfedf('0x10'));var config=require(_0xfedf('0x11'));var db=require(_0xfedf('0x12'))['db'];function respondWithStatusCode(_0x5d30c2,_0x3486e6){_0x3486e6=_0x3486e6||0xcc;return function(_0x474240){if(_0x474240){return _0x5d30c2['sendStatus'](_0x3486e6);}return _0x5d30c2[_0xfedf('0x13')](_0x3486e6)[_0xfedf('0x14')]();};}function respondWithResult(_0x661a32,_0x4874f1){_0x4874f1=_0x4874f1||0xc8;return function(_0x2ce3ee){if(_0x2ce3ee){return _0x661a32[_0xfedf('0x13')](_0x4874f1)['json'](_0x2ce3ee);}};}function respondWithFilteredResult(_0x1c30c2,_0x3c56cd){return function(_0x5ced43){if(_0x5ced43){var _0x23107a=_0x5ced43[_0xfedf('0x15')],_0x44485a=_0x3c56cd['offset'],_0x37350c=_0x3c56cd[_0xfedf('0x16')]+_0x3c56cd['limit'],_0x4fd16f;if(_0x37350c>=_0x23107a){_0x37350c=_0x23107a;_0x4fd16f=0xc8;}else{_0x4fd16f=0xce;}_0x1c30c2[_0xfedf('0x13')](_0x4fd16f);return _0x1c30c2[_0xfedf('0x17')](_0xfedf('0x18'),_0x44485a+'-'+_0x37350c+'/'+_0x23107a)[_0xfedf('0x19')](_0x5ced43);}return null;};}function patchUpdates(_0x39e520){return function(_0x5529cd){try{jsonpatch[_0xfedf('0x1a')](_0x5529cd,_0x39e520,!![]);}catch(_0x3af087){return BPromise[_0xfedf('0x1b')](_0x3af087);}return _0x5529cd[_0xfedf('0x1c')]();};}function saveUpdates(_0x314cce,_0x560c39){return function(_0x376228){if(_0x376228){return _0x376228[_0xfedf('0x1d')](_0x314cce)[_0xfedf('0x1e')](function(_0xbac607){return _0xbac607;});}return null;};}function removeEntity(_0x38b2a9,_0x4b2326){return function(_0x25c499){if(_0x25c499){return _0x25c499[_0xfedf('0x1f')]()[_0xfedf('0x1e')](function(){_0x38b2a9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52abb1,_0xd29180){return function(_0x353414){if(!_0x353414){_0x52abb1['sendStatus'](0x194);}return _0x353414;};}function handleError(_0x40dad9,_0x36f2a7){_0x36f2a7=_0x36f2a7||0x1f4;return function(_0x584dee){logger[_0xfedf('0x20')](_0x584dee[_0xfedf('0x21')]);if(_0x584dee[_0xfedf('0x22')]){delete _0x584dee[_0xfedf('0x22')];}_0x40dad9[_0xfedf('0x13')](_0x36f2a7)[_0xfedf('0x23')](_0x584dee);};}exports[_0xfedf('0x1d')]=function(_0x49a14a,_0x24212f){if(_0x49a14a[_0xfedf('0x24')]['id']){delete _0x49a14a[_0xfedf('0x24')]['id'];}return db[_0xfedf('0x25')]['find']({'where':{'id':_0x49a14a[_0xfedf('0x26')]['id']}})[_0xfedf('0x1e')](handleEntityNotFound(_0x24212f,null))[_0xfedf('0x1e')](saveUpdates(_0x49a14a['body'],null))[_0xfedf('0x1e')](respondWithResult(_0x24212f,null))['catch'](handleError(_0x24212f,null));};exports[_0xfedf('0x1f')]=function(_0x3cabb5,_0x5ed123){return db[_0xfedf('0x25')][_0xfedf('0x27')]({'where':{'id':_0x3cabb5[_0xfedf('0x26')]['id']}})[_0xfedf('0x1e')](handleEntityNotFound(_0x5ed123,null))[_0xfedf('0x1e')](removeEntity(_0x5ed123,null))['catch'](handleError(_0x5ed123,null));}; \ No newline at end of file +var _0x4eff=['desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','error','name','send','body','find','then','catch','Action','params','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x4eff,0x1f1));var _0xf4ef=function(_0x2f6062,_0x1ffb61){_0x2f6062=_0x2f6062-0x0;var _0x363576=_0x4eff[_0x2f6062];return _0x363576;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xf4ef('0x0'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf4ef('0x1'));var util=require(_0xf4ef('0x2'));var path=require('path');var sox=require(_0xf4ef('0x3'));var csv=require(_0xf4ef('0x4'));var ejs=require(_0xf4ef('0x5'));var fs=require('fs');var _=require(_0xf4ef('0x6'));var squel=require(_0xf4ef('0x7'));var crypto=require(_0xf4ef('0x8'));var jsforce=require(_0xf4ef('0x9'));var deskjs=require(_0xf4ef('0xa'));var toCsv=require(_0xf4ef('0x4'));var querystring=require(_0xf4ef('0xb'));var Papa=require('papaparse');var qs=require(_0xf4ef('0xc'));var logger=require(_0xf4ef('0xd'))(_0xf4ef('0xe'));var utils=require(_0xf4ef('0xf'));var config=require(_0xf4ef('0x10'));var db=require(_0xf4ef('0x11'))['db'];function respondWithStatusCode(_0x233d6c,_0x4f4197){_0x4f4197=_0x4f4197||0xcc;return function(_0xced483){if(_0xced483){return _0x233d6c['sendStatus'](_0x4f4197);}return _0x233d6c[_0xf4ef('0x12')](_0x4f4197)[_0xf4ef('0x13')]();};}function respondWithResult(_0x22a069,_0x1e1a9d){_0x1e1a9d=_0x1e1a9d||0xc8;return function(_0x560636){if(_0x560636){return _0x22a069[_0xf4ef('0x12')](_0x1e1a9d)['json'](_0x560636);}};}function respondWithFilteredResult(_0x59cf65,_0x1ec676){return function(_0xcaa1b8){if(_0xcaa1b8){var _0x36f8d3=_0xcaa1b8[_0xf4ef('0x14')],_0x513f6d=_0x1ec676[_0xf4ef('0x15')],_0xf8ba47=_0x1ec676[_0xf4ef('0x15')]+_0x1ec676['limit'],_0x30bb40;if(_0xf8ba47>=_0x36f8d3){_0xf8ba47=_0x36f8d3;_0x30bb40=0xc8;}else{_0x30bb40=0xce;}_0x59cf65[_0xf4ef('0x12')](_0x30bb40);return _0x59cf65[_0xf4ef('0x16')](_0xf4ef('0x17'),_0x513f6d+'-'+_0xf8ba47+'/'+_0x36f8d3)[_0xf4ef('0x18')](_0xcaa1b8);}return null;};}function patchUpdates(_0x13d8a6){return function(_0x3f7515){try{jsonpatch[_0xf4ef('0x19')](_0x3f7515,_0x13d8a6,!![]);}catch(_0x341415){return BPromise[_0xf4ef('0x1a')](_0x341415);}return _0x3f7515[_0xf4ef('0x1b')]();};}function saveUpdates(_0x5b37b7,_0x180529){return function(_0xeff0b6){if(_0xeff0b6){return _0xeff0b6[_0xf4ef('0x1c')](_0x5b37b7)['then'](function(_0x1d6c1c){return _0x1d6c1c;});}return null;};}function removeEntity(_0x4e17d7,_0x11c052){return function(_0x3375da){if(_0x3375da){return _0x3375da[_0xf4ef('0x1d')]()['then'](function(){_0x4e17d7[_0xf4ef('0x12')](0xcc)[_0xf4ef('0x13')]();});}};}function handleEntityNotFound(_0x7c31a0,_0xefb119){return function(_0x3059be){if(!_0x3059be){_0x7c31a0['sendStatus'](0x194);}return _0x3059be;};}function handleError(_0x19ad01,_0x3b7236){_0x3b7236=_0x3b7236||0x1f4;return function(_0x23826a){logger[_0xf4ef('0x1e')](_0x23826a['stack']);if(_0x23826a['name']){delete _0x23826a[_0xf4ef('0x1f')];}_0x19ad01[_0xf4ef('0x12')](_0x3b7236)[_0xf4ef('0x20')](_0x23826a);};}exports[_0xf4ef('0x1c')]=function(_0x3b2e30,_0xa69a8f){if(_0x3b2e30['body']['id']){delete _0x3b2e30[_0xf4ef('0x21')]['id'];}return db['Action'][_0xf4ef('0x22')]({'where':{'id':_0x3b2e30['params']['id']}})[_0xf4ef('0x23')](handleEntityNotFound(_0xa69a8f,null))['then'](saveUpdates(_0x3b2e30[_0xf4ef('0x21')],null))[_0xf4ef('0x23')](respondWithResult(_0xa69a8f,null))[_0xf4ef('0x24')](handleError(_0xa69a8f,null));};exports[_0xf4ef('0x1d')]=function(_0x3b1f25,_0x39ef6d){return db[_0xf4ef('0x25')][_0xf4ef('0x22')]({'where':{'id':_0x3b1f25[_0xf4ef('0x26')]['id']}})['then'](handleEntityNotFound(_0x39ef6d,null))[_0xf4ef('0x23')](removeEntity(_0x39ef6d,null))[_0xf4ef('0x24')](handleError(_0x39ef6d,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index c6c10c1..bb3f241 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 _0x68a8=['bluebird','request-promise','./action.attributes','exports','define','Action','tools_actions','util','api','moment'];(function(_0x5834e5,_0x171e7f){var _0x1bfcf9=function(_0x1ed8fa){while(--_0x1ed8fa){_0x5834e5['push'](_0x5834e5['shift']());}};_0x1bfcf9(++_0x171e7f);}(_0x68a8,0x1c9));var _0x868a=function(_0x52e13b,_0x5223cf){_0x52e13b=_0x52e13b-0x0;var _0x3e8eea=_0x68a8[_0x52e13b];return _0x3e8eea;};'use strict';var _=require('lodash');var util=require(_0x868a('0x0'));var logger=require('../../config/logger')(_0x868a('0x1'));var moment=require(_0x868a('0x2'));var BPromise=require(_0x868a('0x3'));var rp=require(_0x868a('0x4'));var attributes=require(_0x868a('0x5'));module[_0x868a('0x6')]=function(_0x21633b,_0x4e9b05){return _0x21633b[_0x868a('0x7')](_0x868a('0x8'),attributes,{'tableName':_0x868a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd67=['tools_actions','lodash','../../config/logger','api','moment','request-promise','./action.attributes','exports'];(function(_0x1d83db,_0x89d115){var _0x2dc1d1=function(_0x13fdc3){while(--_0x13fdc3){_0x1d83db['push'](_0x1d83db['shift']());}};_0x2dc1d1(++_0x89d115);}(_0xcd67,0x1a9));var _0x7cd6=function(_0x1bf930,_0x3f0f3c){_0x1bf930=_0x1bf930-0x0;var _0x1dc6ad=_0xcd67[_0x1bf930];return _0x1dc6ad;};'use strict';var _=require(_0x7cd6('0x0'));var util=require('util');var logger=require(_0x7cd6('0x1'))(_0x7cd6('0x2'));var moment=require(_0x7cd6('0x3'));var BPromise=require('bluebird');var rp=require(_0x7cd6('0x4'));var attributes=require(_0x7cd6('0x5'));module[_0x7cd6('0x6')]=function(_0x48ec62,_0x450d81){return _0x48ec62['define']('Action',attributes,{'tableName':_0x7cd6('0x7'),'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 8916af9..0543435 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 _0xe41d=['result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s'];(function(_0xc252ef,_0x32b872){var _0x13a192=function(_0x4b7ec7){while(--_0x4b7ec7){_0xc252ef['push'](_0xc252ef['shift']());}};_0x13a192(++_0x32b872);}(_0xe41d,0x13d));var _0xde41=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe41d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xde41('0x0'));var util=require(_0xde41('0x1'));var moment=require('moment');var BPromise=require(_0xde41('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xde41('0x3'))['db'];var utils=require(_0xde41('0x4'));var logger=require('../../config/logger')(_0xde41('0x5'));var config=require(_0xde41('0x6'));var jayson=require(_0xde41('0x7'));var client=jayson[_0xde41('0x8')][_0xde41('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x144835,_0x34c7b4,_0x85e62){return new BPromise(function(_0x5d1e46,_0x54c631){return client[_0xde41('0xa')](_0x144835,_0x85e62)[_0xde41('0xb')](function(_0x4317dc){logger['info']('Action,\x20%s,\x20%s',_0x34c7b4,_0xde41('0xc'));logger[_0xde41('0xd')]('Action,\x20%s,\x20%s,\x20%s',_0x34c7b4,_0xde41('0xc'),JSON[_0xde41('0xe')](_0x4317dc));if(_0x4317dc[_0xde41('0xf')]){if(_0x4317dc[_0xde41('0xf')][_0xde41('0x10')]===0x1f4){logger[_0xde41('0xf')]('Action,\x20%s,\x20%s',_0x34c7b4,_0x4317dc['error'][_0xde41('0x11')]);return _0x54c631(_0x4317dc[_0xde41('0xf')][_0xde41('0x11')]);}logger[_0xde41('0xf')](_0xde41('0x12'),_0x34c7b4,_0x4317dc[_0xde41('0xf')][_0xde41('0x11')]);return _0x5d1e46(_0x4317dc[_0xde41('0xf')][_0xde41('0x11')]);}else{logger['info'](_0xde41('0x12'),_0x34c7b4,_0xde41('0xc'));_0x5d1e46(_0x4317dc[_0xde41('0x13')][_0xde41('0x11')]);}})[_0xde41('0x14')](function(_0x4a95ec){logger[_0xde41('0xf')](_0xde41('0x12'),_0x34c7b4,_0x4a95ec);_0x54c631(_0x4a95ec);});});} \ No newline at end of file +var _0xc17c=['Action,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3c26fc,_0x5f0bb2){var _0x3079e4=function(_0x5535fd){while(--_0x5535fd){_0x3c26fc['push'](_0x3c26fc['shift']());}};_0x3079e4(++_0x5f0bb2);}(_0xc17c,0x16d));var _0xcc17=function(_0x1363c0,_0x15ee1c){_0x1363c0=_0x1363c0-0x0;var _0x510d75=_0xc17c[_0x1363c0];return _0x510d75;};'use strict';var _=require('lodash');var util=require(_0xcc17('0x0'));var moment=require(_0xcc17('0x1'));var BPromise=require('bluebird');var rs=require(_0xcc17('0x2'));var fs=require('fs');var db=require(_0xcc17('0x3'))['db'];var utils=require(_0xcc17('0x4'));var logger=require('../../config/logger')(_0xcc17('0x5'));var config=require(_0xcc17('0x6'));var jayson=require(_0xcc17('0x7'));var client=jayson[_0xcc17('0x8')][_0xcc17('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15628c,_0x82a28d,_0x3740e1){return new BPromise(function(_0x5b562a,_0x4fb498){return client[_0xcc17('0xa')](_0x15628c,_0x3740e1)[_0xcc17('0xb')](function(_0x383097){logger[_0xcc17('0xc')](_0xcc17('0xd'),_0x82a28d,_0xcc17('0xe'));logger[_0xcc17('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x82a28d,_0xcc17('0xe'),JSON[_0xcc17('0x10')](_0x383097));if(_0x383097['error']){if(_0x383097[_0xcc17('0x11')]['code']===0x1f4){logger['error'](_0xcc17('0xd'),_0x82a28d,_0x383097['error'][_0xcc17('0x12')]);return _0x4fb498(_0x383097[_0xcc17('0x11')][_0xcc17('0x12')]);}logger[_0xcc17('0x11')](_0xcc17('0xd'),_0x82a28d,_0x383097[_0xcc17('0x11')][_0xcc17('0x12')]);return _0x5b562a(_0x383097['error'][_0xcc17('0x12')]);}else{logger[_0xcc17('0xc')](_0xcc17('0xd'),_0x82a28d,_0xcc17('0xe'));_0x5b562a(_0x383097[_0xcc17('0x13')][_0xcc17('0x12')]);}})[_0xcc17('0x14')](function(_0x4a2893){logger['error'](_0xcc17('0xd'),_0x82a28d,_0x4a2893);_0x4fb498(_0x4a2893);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 0140978..55245c0 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 _0x79ba=['/:id','update','delete','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put'];(function(_0xb6c185,_0x1fba89){var _0x18717b=function(_0x1ac33d){while(--_0x1ac33d){_0xb6c185['push'](_0xb6c185['shift']());}};_0x18717b(++_0x1fba89);}(_0x79ba,0x147));var _0xa79b=function(_0x1cfda3,_0x32e81){_0x1cfda3=_0x1cfda3-0x0;var _0x45a82f=_0x79ba[_0x1cfda3];return _0x45a82f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa79b('0x0'));var express=require('express');var router=express[_0xa79b('0x1')]();var auth=require(_0xa79b('0x2'));var interaction=require(_0xa79b('0x3'));var config=require(_0xa79b('0x4'));var controller=require('./action.controller');router[_0xa79b('0x5')](_0xa79b('0x6'),auth['isAuthenticated'](),controller[_0xa79b('0x7')]);router[_0xa79b('0x8')](_0xa79b('0x6'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd031=['../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','destroy','exports','multer','path','express','Router','../../components/auth/service'];(function(_0x3ccc5f,_0x17ba72){var _0x15de37=function(_0x255971){while(--_0x255971){_0x3ccc5f['push'](_0x3ccc5f['shift']());}};_0x15de37(++_0x17ba72);}(_0xd031,0xdf));var _0x1d03=function(_0x18ed6e,_0x189e9f){_0x18ed6e=_0x18ed6e-0x0;var _0x47262b=_0xd031[_0x18ed6e];return _0x47262b;};'use strict';var multer=require(_0x1d03('0x0'));var util=require('util');var path=require(_0x1d03('0x1'));var express=require(_0x1d03('0x2'));var router=express[_0x1d03('0x3')]();var auth=require(_0x1d03('0x4'));var interaction=require(_0x1d03('0x5'));var config=require(_0x1d03('0x6'));var controller=require('./action.controller');router[_0x1d03('0x7')](_0x1d03('0x8'),auth[_0x1d03('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1d03('0xa')]);module[_0x1d03('0xb')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index e52cc78..06b40c7 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 _0x194c=['sequelize','exports','STRING','TEXT'];(function(_0xbd5eaa,_0x5a81c1){var _0x3990cf=function(_0x341093){while(--_0x341093){_0xbd5eaa['push'](_0xbd5eaa['shift']());}};_0x3990cf(++_0x5a81c1);}(_0x194c,0x84));var _0xc194=function(_0x33f959,_0x37a84d){_0x33f959=_0x33f959-0x0;var _0x1db2fd=_0x194c[_0x33f959];return _0x1db2fd;};'use strict';var Sequelize=require(_0xc194('0x0'));module[_0xc194('0x1')]={'name':{'type':Sequelize[_0xc194('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc194('0x2')]},'parent':{'type':Sequelize[_0xc194('0x2')]},'table':{'type':Sequelize[_0xc194('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xc194('0x3')]}}; \ No newline at end of file +var _0x1fbf=['STRING','TEXT','exports'];(function(_0x55c3ff,_0x1d877b){var _0x4f5f31=function(_0x2fb75e){while(--_0x2fb75e){_0x55c3ff['push'](_0x55c3ff['shift']());}};_0x4f5f31(++_0x1d877b);}(_0x1fbf,0x1c1));var _0xf1fb=function(_0xd964bd,_0x4c343a){_0xd964bd=_0xd964bd-0x0;var _0x361ab2=_0x1fbf[_0xd964bd];return _0x361ab2;};'use strict';var Sequelize=require('sequelize');module[_0xf1fb('0x0')]={'name':{'type':Sequelize[_0xf1fb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf1fb('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xf1fb('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xf1fb('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 362605b..3d24ffd 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 _0xd17b=['limit','offset','order','sort','where','filters','pick','add','day','merge','filter','map','then','include','findAll','rows','catch','show','params','AnalyticCustomReport','rawAttributes','includeAll','options','create','body','find','join','right_join','outer_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationError','Please\x20insert\x20at\x20least\x20one\x20field!','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','orderBy','DESC','field','joins','type','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','parse','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','cross_join','MIN(%s)','UNIX_TIMESTAMP(%s)','Sequelize','metric','groupBy','alias','clone','output','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','request-promise','moment','mustache','util','path','to-csv','squel','jsforce','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','set','apply','reject','update','destroy','error','stack','name','send','index','dateStart','query','dateEnd','keys','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x15a34f,_0x1378ba){var _0x2e7b6b=function(_0x1fbfa2){while(--_0x1fbfa2){_0x15a34f['push'](_0x15a34f['shift']());}};_0x2e7b6b(++_0x1378ba);}(_0xd17b,0x6a));var _0xbd17=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0xd17b[_0xa990b7];return _0x52c99c;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xbd17('0x0'));var moment=require(_0xbd17('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xbd17('0x2'));var util=require(_0xbd17('0x3'));var path=require(_0xbd17('0x4'));var sox=require('sox');var csv=require(_0xbd17('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xbd17('0x6'));var crypto=require('crypto');var jsforce=require(_0xbd17('0x7'));var deskjs=require('desk.js');var toCsv=require(_0xbd17('0x5'));var querystring=require(_0xbd17('0x8'));var Papa=require(_0xbd17('0x9'));var qs=require(_0xbd17('0xa'));var logger=require('../../config/logger')(_0xbd17('0xb'));var utils=require(_0xbd17('0xc'));var config=require(_0xbd17('0xd'));var db=require(_0xbd17('0xe'))['db'];function respondWithStatusCode(_0x4b5360,_0x105aeb){_0x105aeb=_0x105aeb||0xcc;return function(_0x3d776c){if(_0x3d776c){return _0x4b5360[_0xbd17('0xf')](_0x105aeb);}return _0x4b5360[_0xbd17('0x10')](_0x105aeb)[_0xbd17('0x11')]();};}function respondWithResult(_0x15e012,_0x3a9c5f){_0x3a9c5f=_0x3a9c5f||0xc8;return function(_0x4015f4){if(_0x4015f4){return _0x15e012[_0xbd17('0x10')](_0x3a9c5f)[_0xbd17('0x12')](_0x4015f4);}};}function respondWithFilteredResult(_0x2e5f2a,_0xd6ea73){return function(_0x589499){if(_0x589499){var _0x227be5=_0x589499[_0xbd17('0x13')],_0x21649e=_0xd6ea73['offset'],_0x452096=_0xd6ea73['offset']+_0xd6ea73['limit'],_0x53f01c;if(_0x452096>=_0x227be5){_0x452096=_0x227be5;_0x53f01c=0xc8;}else{_0x53f01c=0xce;}_0x2e5f2a['status'](_0x53f01c);return _0x2e5f2a[_0xbd17('0x14')]('Content-Range',_0x21649e+'-'+_0x452096+'/'+_0x227be5)[_0xbd17('0x12')](_0x589499);}return null;};}function patchUpdates(_0x1ee345){return function(_0x4b0017){try{jsonpatch[_0xbd17('0x15')](_0x4b0017,_0x1ee345,!![]);}catch(_0x13a3c1){return BPromise[_0xbd17('0x16')](_0x13a3c1);}return _0x4b0017['save']();};}function saveUpdates(_0x5c53de,_0x2d6b38){return function(_0x32f1a1){if(_0x32f1a1){return _0x32f1a1[_0xbd17('0x17')](_0x5c53de)['then'](function(_0x371713){return _0x371713;});}return null;};}function removeEntity(_0x16b805,_0x20a0d2){return function(_0x5c3971){if(_0x5c3971){return _0x5c3971[_0xbd17('0x18')]()['then'](function(){_0x16b805[_0xbd17('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b3a7f,_0x2fc50b){return function(_0x3c85f1){if(!_0x3c85f1){_0x3b3a7f[_0xbd17('0xf')](0x194);}return _0x3c85f1;};}function handleError(_0x1cbb86,_0x502c2e){_0x502c2e=_0x502c2e||0x1f4;return function(_0x492151){logger[_0xbd17('0x19')](_0x492151[_0xbd17('0x1a')]);if(_0x492151[_0xbd17('0x1b')]){delete _0x492151['name'];}_0x1cbb86[_0xbd17('0x10')](_0x502c2e)[_0xbd17('0x1c')](_0x492151);};}exports[_0xbd17('0x1d')]=function(_0x2bd5bf,_0x547cad){var _0x5d6c03={},_0x19a35e={},_0x325a69={'count':0x0,'rows':[]};var _0x473c49=db['AnalyticCustomReport']['rawAttributes'];_0x19a35e['model']=_['keys'](_0x473c49);var _0xf4d902={'dateStart':_0x2bd5bf['query'][_0xbd17('0x1e')],'dateEnd':_0x2bd5bf[_0xbd17('0x1f')][_0xbd17('0x20')]};delete _0x2bd5bf[_0xbd17('0x1f')][_0xbd17('0x1e')];delete _0x2bd5bf[_0xbd17('0x1f')][_0xbd17('0x20')];_0x19a35e[_0xbd17('0x1f')]=_[_0xbd17('0x21')](_0x2bd5bf[_0xbd17('0x1f')]);_0x19a35e['filters']=_[_0xbd17('0x22')](_0x19a35e[_0xbd17('0x23')],_0x19a35e[_0xbd17('0x1f')]);_0x5d6c03[_0xbd17('0x24')]=_['intersection'](_0x19a35e[_0xbd17('0x23')],qs[_0xbd17('0x25')](_0x2bd5bf[_0xbd17('0x1f')][_0xbd17('0x25')]));_0x5d6c03['attributes']=_0x5d6c03[_0xbd17('0x24')][_0xbd17('0x26')]?_0x5d6c03[_0xbd17('0x24')]:_0x19a35e['model'];if(!_0x2bd5bf[_0xbd17('0x1f')][_0xbd17('0x27')]('nolimit')){_0x5d6c03[_0xbd17('0x28')]=qs[_0xbd17('0x28')](_0x2bd5bf[_0xbd17('0x1f')][_0xbd17('0x28')]);_0x5d6c03[_0xbd17('0x29')]=qs[_0xbd17('0x29')](_0x2bd5bf[_0xbd17('0x1f')]['offset']);}_0x5d6c03[_0xbd17('0x2a')]=qs[_0xbd17('0x2b')](_0x2bd5bf[_0xbd17('0x1f')][_0xbd17('0x2b')]);_0x5d6c03[_0xbd17('0x2c')]=qs[_0xbd17('0x2d')](_[_0xbd17('0x2e')](_0x2bd5bf['query'],_0x19a35e[_0xbd17('0x2d')]));if(_0xf4d902['dateStart']){if(_0xf4d902[_0xbd17('0x20')]){_0xf4d902['dateEnd']=moment(_0xf4d902['dateEnd'])[_0xbd17('0x2f')](0x1,_0xbd17('0x30'));}else{_0xf4d902['dateEnd']=moment(_0xf4d902[_0xbd17('0x1e')])[_0xbd17('0x2f')](0x1,'day');}_[_0xbd17('0x31')](_0x5d6c03[_0xbd17('0x2c')],{'createdAt':{'$gte':_0xf4d902[_0xbd17('0x1e')],'$lte':_0xf4d902[_0xbd17('0x20')]}});}if(_0x2bd5bf[_0xbd17('0x1f')][_0xbd17('0x32')]){_0x5d6c03[_0xbd17('0x2c')]=_[_0xbd17('0x31')](_0x5d6c03['where'],{'$or':_[_0xbd17('0x33')](_0x5d6c03[_0xbd17('0x24')],function(_0x2e8e7f){var _0x454861={};_0x454861[_0x2e8e7f]={'$like':'%'+_0x2bd5bf[_0xbd17('0x1f')][_0xbd17('0x32')]+'%'};return _0x454861;})});}_0x5d6c03=_['merge']({},_0x5d6c03,_0x2bd5bf['options']);var _0x204710={'where':_0x5d6c03['where']};return db['AnalyticCustomReport'][_0xbd17('0x13')](_0x204710)[_0xbd17('0x34')](function(_0xe57e3f){_0x325a69[_0xbd17('0x13')]=_0xe57e3f;if(_0x2bd5bf[_0xbd17('0x1f')]['includeAll']){_0x5d6c03[_0xbd17('0x35')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xbd17('0x36')](_0x5d6c03);})[_0xbd17('0x34')](function(_0x21e359){_0x325a69[_0xbd17('0x37')]=_0x21e359;return _0x325a69;})[_0xbd17('0x34')](respondWithFilteredResult(_0x547cad,_0x5d6c03))[_0xbd17('0x38')](handleError(_0x547cad,null));};exports[_0xbd17('0x39')]=function(_0x432011,_0x4873a1){var _0x35d3ae={'raw':![],'where':{'id':_0x432011[_0xbd17('0x3a')]['id']}},_0x510bf2={};_0x510bf2[_0xbd17('0x23')]=_[_0xbd17('0x21')](db[_0xbd17('0x3b')][_0xbd17('0x3c')]);_0x510bf2[_0xbd17('0x1f')]=_[_0xbd17('0x21')](_0x432011[_0xbd17('0x1f')]);_0x510bf2[_0xbd17('0x2d')]=_[_0xbd17('0x22')](_0x510bf2['model'],_0x510bf2[_0xbd17('0x1f')]);_0x35d3ae[_0xbd17('0x24')]=_['intersection'](_0x510bf2[_0xbd17('0x23')],qs[_0xbd17('0x25')](_0x432011['query'][_0xbd17('0x25')]));_0x35d3ae[_0xbd17('0x24')]=_0x35d3ae[_0xbd17('0x24')]['length']?_0x35d3ae[_0xbd17('0x24')]:_0x510bf2[_0xbd17('0x23')];if(_0x432011[_0xbd17('0x1f')][_0xbd17('0x3d')]){_0x35d3ae['include']=[{'all':!![]}];}_0x35d3ae=_[_0xbd17('0x31')]({},_0x35d3ae,_0x432011[_0xbd17('0x3e')]);return db[_0xbd17('0x3b')]['find'](_0x35d3ae)[_0xbd17('0x34')](handleEntityNotFound(_0x4873a1,null))['then'](respondWithResult(_0x4873a1,null))[_0xbd17('0x38')](handleError(_0x4873a1,null));};exports['create']=function(_0x347958,_0x2cbae4){return db['AnalyticCustomReport'][_0xbd17('0x3f')](_0x347958['body'],{})[_0xbd17('0x34')](respondWithResult(_0x2cbae4,0xc9))[_0xbd17('0x38')](handleError(_0x2cbae4,null));};exports[_0xbd17('0x17')]=function(_0x5f2954,_0x1d7e28){if(_0x5f2954[_0xbd17('0x40')]['id']){delete _0x5f2954['body']['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x5f2954[_0xbd17('0x3a')]['id']}})[_0xbd17('0x34')](handleEntityNotFound(_0x1d7e28,null))[_0xbd17('0x34')](saveUpdates(_0x5f2954[_0xbd17('0x40')],null))['then'](respondWithResult(_0x1d7e28,null))[_0xbd17('0x38')](handleError(_0x1d7e28,null));};exports[_0xbd17('0x18')]=function(_0x4ad8bb,_0x5ab8f4){return db[_0xbd17('0x3b')][_0xbd17('0x41')]({'where':{'id':_0x4ad8bb['params']['id']}})[_0xbd17('0x34')](handleEntityNotFound(_0x5ab8f4,null))[_0xbd17('0x34')](removeEntity(_0x5ab8f4,null))['catch'](handleError(_0x5ab8f4,null));};exports['preview']=function(_0x543696,_0xfb286e){var _0x11c9a4=0xa;var _0x156e3e=[_0xbd17('0x42'),'left_join',_0xbd17('0x43'),_0xbd17('0x44'),'cross_join'];var _0x47ef4b={'SUM':_0xbd17('0x45'),'COUNT':_0xbd17('0x46'),'COUNT DISTINCT':_0xbd17('0x47'),'MAX':_0xbd17('0x48'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xbd17('0x49'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xbd17('0x4a')};var _0x2fdfad={'SEC_TO_TIME':_0xbd17('0x4b'),'DATE':_0xbd17('0x4c'),'HOUR':_0xbd17('0x4d'),'ROUND':_0xbd17('0x4e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x6465cd=function(_0x80ae1){return!_[_0xbd17('0x4f')]([_0xbd17('0x50'),_0xbd17('0x51'),_0xbd17('0x52'),_0xbd17('0x53')],_0x80ae1);};var _0x5302b=function(_0x280862){if(!_0x280862||!_0x280862[_0xbd17('0x54')]['length']){return'';}for(var _0x3092e4='(',_0x2aa853=0x0;_0x2aa853<_0x280862[_0xbd17('0x54')]['length'];_0x2aa853+=0x1){_0x2aa853>0x0&&(_0x3092e4+='\x20'+_0x280862[_0xbd17('0x55')]+'\x20');_0x3092e4+=_0x280862[_0xbd17('0x54')][_0x2aa853][_0xbd17('0x56')]?_0x5302b(_0x280862[_0xbd17('0x54')][_0x2aa853][_0xbd17('0x56')]):_0x280862[_0xbd17('0x54')][_0x2aa853]['field']+'\x20'+_0x280862[_0xbd17('0x54')][_0x2aa853][_0xbd17('0x57')]+(_0x6465cd(_0x280862[_0xbd17('0x54')][_0x2aa853][_0xbd17('0x57')])?'\x20'+_0x280862[_0xbd17('0x54')][_0x2aa853][_0xbd17('0x58')]:'');}return _0x3092e4+')';};var _0x504d3a={'where':{'id':_0x543696[_0xbd17('0x3a')]['id']}},_0x625107,_0x1caec3,_0x118171,_0x30bbe6,_0x244fe3;_0x504d3a=_[_0xbd17('0x31')]({},_0x504d3a,_0x543696['options']);return db[_0xbd17('0x3b')][_0xbd17('0x41')](_0x504d3a)[_0xbd17('0x34')](function(_0x38cf2a){if(_0x38cf2a){_0x625107=_0x38cf2a;return _0x38cf2a[_0xbd17('0x59')]();}return null;})[_0xbd17('0x34')](function(_0xbdeb1d){if(_0xbdeb1d){if(!_0xbdeb1d['length']){throw new db['Sequelize'][(_0xbd17('0x5a'))](_0xbd17('0x5b'));}_0x1caec3=_0xbdeb1d;return db[_0xbd17('0x5c')][_0xbd17('0x36')]({'raw':!![]});}return null;})['then'](function(_0xa5ff10){if(_0xa5ff10){_0x118171=_[_0xbd17('0x5d')](_0xa5ff10,'id');var _0x5e0aff;var _0x54bec4=squel[_0xbd17('0x5e')]();_0x54bec4[_0xbd17('0x5f')](_0x625107[_0xbd17('0x60')]);for(var _0x436295=0x0;_0x436295<_0x1caec3[_0xbd17('0x26')];_0x436295+=0x1){_0x5e0aff=_0x1caec3[_0x436295][_0xbd17('0x61')]?_0x118171[_0x1caec3[_0x436295]['MetricId']]['metric']:_0x1caec3[_0x436295]['field'];_0x5e0aff=_0x1caec3[_0x436295][_0xbd17('0x62')]?_[_0xbd17('0x63')](_0x47ef4b[_0x1caec3[_0x436295][_0xbd17('0x62')]],'%s',_0x5e0aff):_0x5e0aff;_0x5e0aff=_0x1caec3[_0x436295][_0xbd17('0x64')]?_[_0xbd17('0x63')](_0x2fdfad[_0x1caec3[_0x436295]['format']],'%s',_0x5e0aff):_0x5e0aff;if(_0x1caec3[_0x436295]['groupBy']){_0x54bec4[_0xbd17('0x56')](_0x5e0aff);}_0x1caec3[_0x436295][_0xbd17('0x65')]&&_0x54bec4[_0xbd17('0x2a')](_0x5e0aff,_0x1caec3[_0x436295][_0xbd17('0x65')]===_0xbd17('0x66')?![]:!![]);_0x54bec4[_0xbd17('0x67')](_0x5e0aff,_0x1caec3[_0x436295]['alias']||_0x5e0aff);}if(_0x625107[_0xbd17('0x68')]){_0x625107['joins']=JSON['parse'](_0x625107[_0xbd17('0x68')]);for(var _0x2e70d0=0x0;_0x2e70d0<_0x625107[_0xbd17('0x68')][_0xbd17('0x26')];_0x2e70d0+=0x1){if(_0x625107[_0xbd17('0x68')][_0x2e70d0][_0xbd17('0x69')]&&_[_0xbd17('0x4f')](_0x156e3e,_0x625107[_0xbd17('0x68')][_0x2e70d0][_0xbd17('0x69')])&&_0x625107[_0xbd17('0x68')][_0x2e70d0][_0xbd17('0x6a')]&&_0x625107[_0xbd17('0x68')][_0x2e70d0][_0xbd17('0x6b')]&&_0x625107[_0xbd17('0x68')][_0x2e70d0]['foreignKey']){_0x54bec4[_0x625107[_0xbd17('0x68')][_0x2e70d0][_0xbd17('0x69')]](_0x625107[_0xbd17('0x68')][_0x2e70d0][_0xbd17('0x6b')],null,util[_0xbd17('0x64')](_0xbd17('0x6c'),_0x625107[_0xbd17('0x60')],_0x625107[_0xbd17('0x68')][_0x2e70d0][_0xbd17('0x6a')],_0x625107['joins'][_0x2e70d0][_0xbd17('0x6b')],_0x625107['joins'][_0x2e70d0][_0xbd17('0x6d')]));}}}if(_0x625107[_0xbd17('0x6e')]){_0x625107['conditions']=JSON[_0xbd17('0x6f')](_0x625107[_0xbd17('0x6e')]);_0x54bec4[_0xbd17('0x2c')](_0x5302b(_0x625107['conditions'][_0xbd17('0x56')]));}_0x244fe3=_0x54bec4['clone']();_0x54bec4[_0xbd17('0x28')](_0x11c9a4);_0x54bec4[_0xbd17('0x29')](0x0);logger[_0xbd17('0x70')](_0xbd17('0x71'),_0x54bec4[_0xbd17('0x72')]());return db[_0xbd17('0x73')][_0xbd17('0x1f')](_0x54bec4['toString'](),{'type':db[_0xbd17('0x73')][_0xbd17('0x74')][_0xbd17('0x75')]});}})['then'](respondWithResult(_0xfb286e,null))[_0xbd17('0x38')](handleError(_0xfb286e,null));};function runReport(_0x2b51d6,_0x2f94f7,_0x59cee8){var _0x50b4fe=_0x2f94f7[_0xbd17('0x1b')];var _0x1cb6f8=0xa;var _0x1c6c00=['join',_0xbd17('0x76'),_0xbd17('0x43'),_0xbd17('0x44'),_0xbd17('0x77')];var _0x116f17={'SUM':_0xbd17('0x45'),'COUNT':_0xbd17('0x46'),'COUNT DISTINCT':_0xbd17('0x47'),'MAX':_0xbd17('0x48'),'MIN':_0xbd17('0x78'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xbd17('0x49'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x30253d={'SEC_TO_TIME':_0xbd17('0x4b'),'DATE':_0xbd17('0x4c'),'HOUR':_0xbd17('0x4d'),'ROUND':_0xbd17('0x4e'),'UNIX_TIMESTAMP':_0xbd17('0x79')};var _0x31c045=function(_0x265267){return!_['includes']([_0xbd17('0x50'),_0xbd17('0x51'),_0xbd17('0x52'),_0xbd17('0x53')],_0x265267);};var _0xc9365f=function(_0xa1eeec){if(!_0xa1eeec||!_0xa1eeec[_0xbd17('0x54')][_0xbd17('0x26')]){return'';}for(var _0x16f43b='(',_0x3d5412=0x0;_0x3d5412<_0xa1eeec[_0xbd17('0x54')]['length'];_0x3d5412+=0x1){_0x3d5412>0x0&&(_0x16f43b+='\x20'+_0xa1eeec[_0xbd17('0x55')]+'\x20');_0x16f43b+=_0xa1eeec[_0xbd17('0x54')][_0x3d5412]['group']?_0xc9365f(_0xa1eeec[_0xbd17('0x54')][_0x3d5412]['group']):_0xa1eeec[_0xbd17('0x54')][_0x3d5412][_0xbd17('0x67')]+'\x20'+_0xa1eeec[_0xbd17('0x54')][_0x3d5412]['condition']+(_0x31c045(_0xa1eeec[_0xbd17('0x54')][_0x3d5412]['condition'])?'\x20'+_0xa1eeec[_0xbd17('0x54')][_0x3d5412]['value']:'');}return _0x16f43b+')';};var _0x551b91={'where':{'id':_0x2b51d6['id']}},_0x3806c4,_0x8f5e1b,_0x382e88,_0x53a099,_0x17dedd;_0x551b91=_[_0xbd17('0x31')]({},_0x551b91,_0x59cee8);return db[_0xbd17('0x3b')][_0xbd17('0x41')](_0x551b91)[_0xbd17('0x34')](function(_0x3d845a){if(_0x3d845a){_0x3806c4=_0x3d845a;return _0x3d845a[_0xbd17('0x59')]();}return null;})[_0xbd17('0x34')](function(_0x4db8ef){if(_0x4db8ef){if(!_0x4db8ef['length']){throw new db[(_0xbd17('0x7a'))][(_0xbd17('0x5a'))](_0xbd17('0x5b'));}_0x8f5e1b=_0x4db8ef;return db[_0xbd17('0x5c')][_0xbd17('0x36')]({'raw':!![]});}return null;})[_0xbd17('0x34')](function(_0x518dc5){if(_0x518dc5){_0x382e88=_[_0xbd17('0x5d')](_0x518dc5,'id');var _0x412846;var _0x1b759c=squel[_0xbd17('0x5e')]();_0x1b759c['from'](_0x3806c4[_0xbd17('0x60')]);for(var _0x5f3760=0x0;_0x5f3760<_0x8f5e1b['length'];_0x5f3760+=0x1){_0x412846=_0x8f5e1b[_0x5f3760][_0xbd17('0x61')]?_0x382e88[_0x8f5e1b[_0x5f3760][_0xbd17('0x61')]][_0xbd17('0x7b')]:_0x8f5e1b[_0x5f3760]['field'];_0x412846=_0x8f5e1b[_0x5f3760]['function']?_['replace'](_0x116f17[_0x8f5e1b[_0x5f3760]['function']],'%s',_0x412846):_0x412846;_0x412846=_0x8f5e1b[_0x5f3760][_0xbd17('0x64')]?_[_0xbd17('0x63')](_0x30253d[_0x8f5e1b[_0x5f3760]['format']],'%s',_0x412846):_0x412846;if(_0x8f5e1b[_0x5f3760][_0xbd17('0x7c')]){_0x1b759c[_0xbd17('0x56')](_0x412846);}_0x8f5e1b[_0x5f3760][_0xbd17('0x65')]&&_0x1b759c[_0xbd17('0x2a')](_0x412846,_0x8f5e1b[_0x5f3760][_0xbd17('0x65')]===_0xbd17('0x66')?![]:!![]);_0x1b759c[_0xbd17('0x67')](_0x412846,_0x8f5e1b[_0x5f3760][_0xbd17('0x7d')]||_0x412846);}if(_0x3806c4['joins']){_0x3806c4[_0xbd17('0x68')]=JSON[_0xbd17('0x6f')](_0x3806c4[_0xbd17('0x68')]);for(var _0x50796e=0x0;_0x50796e<_0x3806c4[_0xbd17('0x68')][_0xbd17('0x26')];_0x50796e+=0x1){if(_0x3806c4['joins'][_0x50796e][_0xbd17('0x69')]&&_['includes'](_0x1c6c00,_0x3806c4['joins'][_0x50796e][_0xbd17('0x69')])&&_0x3806c4[_0xbd17('0x68')][_0x50796e][_0xbd17('0x6a')]&&_0x3806c4[_0xbd17('0x68')][_0x50796e][_0xbd17('0x6b')]&&_0x3806c4['joins'][_0x50796e]['foreignKey']){_0x1b759c[_0x3806c4[_0xbd17('0x68')][_0x50796e][_0xbd17('0x69')]](_0x3806c4[_0xbd17('0x68')][_0x50796e][_0xbd17('0x6b')],null,util[_0xbd17('0x64')](_0xbd17('0x6c'),_0x3806c4[_0xbd17('0x60')],_0x3806c4['joins'][_0x50796e][_0xbd17('0x6a')],_0x3806c4[_0xbd17('0x68')][_0x50796e][_0xbd17('0x6b')],_0x3806c4['joins'][_0x50796e]['foreignKey']));}}}if(_0x3806c4[_0xbd17('0x6e')]){_0x3806c4['conditions']=JSON[_0xbd17('0x6f')](_0x3806c4['conditions']);_0x1b759c[_0xbd17('0x2c')](_0xc9365f(_0x3806c4[_0xbd17('0x6e')][_0xbd17('0x56')]));}_0x17dedd=_0x1b759c[_0xbd17('0x7e')]();_0x1b759c[_0xbd17('0x28')](_0x1cb6f8);_0x1b759c[_0xbd17('0x29')](0x0);logger[_0xbd17('0x70')](_0xbd17('0x71'),_0x1b759c[_0xbd17('0x72')]());return db[_0xbd17('0x73')]['query'](_0x1b759c['toString'](),{'type':db[_0xbd17('0x73')][_0xbd17('0x74')][_0xbd17('0x75')]});}})[_0xbd17('0x34')](function(_0xf5c143){if(!_0xf5c143['length']){throw new db[(_0xbd17('0x7a'))][(_0xbd17('0x5a'))]('No\x20Data!');}if(_0x2f94f7[_0xbd17('0x7f')]==='web'){return null;}var _0x562ffd=_[_0xbd17('0x31')](_0x2f94f7,{'name':_0x2f94f7[_0xbd17('0x80')]||_0x2f94f7[_0xbd17('0x1b')]||_0x3806c4[_0xbd17('0x1b')],'basename':_0x50b4fe,'savename':util['format'](_0xbd17('0x81'),_0x2f94f7[_0xbd17('0x1b')]||_0x3806c4[_0xbd17('0x1b')],require(_0xbd17('0x82'))[_0xbd17('0x83')](0x4),_0x2f94f7[_0xbd17('0x7f')]||_0xbd17('0x84'))});return db[_0xbd17('0x85')][_0xbd17('0x3f')](_0x562ffd,{'raw':!![]});})[_0xbd17('0x34')](function(_0x321294){_0x17dedd['where'](_0x3806c4[_0xbd17('0x60')]+_0xbd17('0x86'),_0x2f94f7['startDate'],_0x2f94f7['endDate']);if(_0x321294){logger[_0xbd17('0x87')]('Run\x20Query:',_0x17dedd[_0xbd17('0x72')]());require(_0xbd17('0x88'))[_0xbd17('0x89')](path['join'](__dirname,_0xbd17('0x8a'),_0x321294[_0xbd17('0x7f')]),[_0x321294['id'],_0x17dedd[_0xbd17('0x72')](),path[_0xbd17('0x42')](__dirname,_0xbd17('0x8b'),_0x321294[_0xbd17('0x8c')]),_0x50b4fe]);return _0x321294;}else{var _0x551796=squel['select']();_0x551796[_0xbd17('0x5f')]('('+_0x17dedd[_0xbd17('0x72')]()+')',_0xbd17('0x8d'));_0x551796[_0xbd17('0x67')](_0xbd17('0x8e'),_0xbd17('0x13'));_0x17dedd[_0xbd17('0x28')](_0x2f94f7[_0xbd17('0x28')]||_0x1cb6f8);_0x17dedd['offset'](_0x2f94f7['offset']||0x0);return db['sequelize']['query'](_0x551796[_0xbd17('0x72')](),{'type':db[_0xbd17('0x73')][_0xbd17('0x74')]['SELECT']})[_0xbd17('0x34')](function(_0x41878d){if(!_0x41878d[_0xbd17('0x26')]){_0x53a099=0x0;}else{_0x53a099=_0x41878d[0x0]['count']||0x0;}return db['sequelize']['query'](_0x17dedd['toString'](),{'type':db['sequelize'][_0xbd17('0x74')][_0xbd17('0x75')]});})[_0xbd17('0x34')](function(_0x46f69a){return{'rows':_0x46f69a||[],'count':_0x53a099};});}});}exports['run']=function(_0x5775a2,_0x47d90f){return runReport(_0x5775a2[_0xbd17('0x3a')],_0x5775a2[_0xbd17('0x1f')],_0x5775a2[_0xbd17('0x3e')])['then'](respondWithResult(_0x47d90f,null))[_0xbd17('0x38')](handleError(_0x47d90f,null));};exports[_0xbd17('0x8f')]=runReport;exports[_0xbd17('0x1f')]=function(_0x466545,_0x4656bf){var _0x2a71c4=0xa;var _0x48edc1=[_0xbd17('0x42'),'left_join',_0xbd17('0x43'),_0xbd17('0x44'),'cross_join'];var _0x3a2fc9={'SUM':_0xbd17('0x45'),'COUNT':_0xbd17('0x46'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xbd17('0x78'),'AVG':_0xbd17('0x90'),'GROUP_CONCAT':_0xbd17('0x49'),'GROUP_CONCAT ASC':_0xbd17('0x91'),'GROUP_CONCAT DESC':_0xbd17('0x4a')};var _0x3f4dc0={'SEC_TO_TIME':_0xbd17('0x4b'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xbd17('0x79')};var _0x4bae15=function(_0x353293){return!_[_0xbd17('0x4f')]([_0xbd17('0x50'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xbd17('0x53')],_0x353293);};var _0x419f54=function(_0x231a3e){if(!_0x231a3e||!_0x231a3e[_0xbd17('0x54')][_0xbd17('0x26')]){return'';}for(var _0x20d936='(',_0x106d13=0x0;_0x106d13<_0x231a3e[_0xbd17('0x54')][_0xbd17('0x26')];_0x106d13+=0x1){_0x106d13>0x0&&(_0x20d936+='\x20'+_0x231a3e[_0xbd17('0x55')]+'\x20');_0x20d936+=_0x231a3e[_0xbd17('0x54')][_0x106d13][_0xbd17('0x56')]?_0x419f54(_0x231a3e[_0xbd17('0x54')][_0x106d13][_0xbd17('0x56')]):_0x231a3e['rules'][_0x106d13][_0xbd17('0x67')]+'\x20'+_0x231a3e[_0xbd17('0x54')][_0x106d13][_0xbd17('0x57')]+(_0x4bae15(_0x231a3e[_0xbd17('0x54')][_0x106d13][_0xbd17('0x57')])?'\x20'+_0x231a3e['rules'][_0x106d13]['value']:'');}return _0x20d936+')';};var _0x55f5d9={'where':{'id':_0x466545[_0xbd17('0x3a')]['id']}},_0x31f600,_0x529e41,_0xbb7c7a,_0x2e538d,_0x562d4d;_0x55f5d9=_[_0xbd17('0x31')]({},_0x55f5d9,_0x466545[_0xbd17('0x3e')]);return db[_0xbd17('0x3b')][_0xbd17('0x41')](_0x55f5d9)[_0xbd17('0x34')](function(_0x8bedf9){if(_0x8bedf9){_0x31f600=_0x8bedf9;return _0x8bedf9[_0xbd17('0x59')]();}return null;})['then'](function(_0x4fe05d){if(_0x4fe05d){if(!_0x4fe05d['length']){throw new db[(_0xbd17('0x7a'))][(_0xbd17('0x5a'))](_0xbd17('0x5b'));}_0x529e41=_0x4fe05d;return db[_0xbd17('0x5c')][_0xbd17('0x36')]({'raw':!![]});}return null;})[_0xbd17('0x34')](function(_0x285bb0){if(_0x285bb0){_0xbb7c7a=_[_0xbd17('0x5d')](_0x285bb0,'id');var _0x4fc401;var _0x59bf86=squel[_0xbd17('0x5e')]();_0x59bf86[_0xbd17('0x5f')](_0x31f600['table']);for(var _0x1a5dfa=0x0;_0x1a5dfa<_0x529e41['length'];_0x1a5dfa+=0x1){_0x4fc401=_0x529e41[_0x1a5dfa][_0xbd17('0x61')]?_0xbb7c7a[_0x529e41[_0x1a5dfa][_0xbd17('0x61')]]['metric']:_0x529e41[_0x1a5dfa][_0xbd17('0x67')];_0x4fc401=_0x529e41[_0x1a5dfa][_0xbd17('0x62')]?_[_0xbd17('0x63')](_0x3a2fc9[_0x529e41[_0x1a5dfa][_0xbd17('0x62')]],'%s',_0x4fc401):_0x4fc401;_0x4fc401=_0x529e41[_0x1a5dfa][_0xbd17('0x64')]?_[_0xbd17('0x63')](_0x3f4dc0[_0x529e41[_0x1a5dfa][_0xbd17('0x64')]],'%s',_0x4fc401):_0x4fc401;if(_0x529e41[_0x1a5dfa][_0xbd17('0x7c')]){_0x59bf86[_0xbd17('0x56')](_0x4fc401);}_0x529e41[_0x1a5dfa][_0xbd17('0x65')]&&_0x59bf86[_0xbd17('0x2a')](_0x4fc401,_0x529e41[_0x1a5dfa]['orderBy']===_0xbd17('0x66')?![]:!![]);_0x59bf86['field'](_0x4fc401,_0x529e41[_0x1a5dfa]['alias']||_0x4fc401);}if(_0x31f600[_0xbd17('0x68')]){_0x31f600['joins']=JSON['parse'](_0x31f600[_0xbd17('0x68')]);for(var _0x25bf52=0x0;_0x25bf52<_0x31f600[_0xbd17('0x68')][_0xbd17('0x26')];_0x25bf52+=0x1){if(_0x31f600[_0xbd17('0x68')][_0x25bf52][_0xbd17('0x69')]&&_[_0xbd17('0x4f')](_0x48edc1,_0x31f600['joins'][_0x25bf52][_0xbd17('0x69')])&&_0x31f600[_0xbd17('0x68')][_0x25bf52][_0xbd17('0x6a')]&&_0x31f600[_0xbd17('0x68')][_0x25bf52][_0xbd17('0x6b')]&&_0x31f600[_0xbd17('0x68')][_0x25bf52][_0xbd17('0x6d')]){_0x59bf86[_0x31f600[_0xbd17('0x68')][_0x25bf52][_0xbd17('0x69')]](_0x31f600[_0xbd17('0x68')][_0x25bf52][_0xbd17('0x6b')],null,util['format'](_0xbd17('0x6c'),_0x31f600[_0xbd17('0x60')],_0x31f600[_0xbd17('0x68')][_0x25bf52][_0xbd17('0x6a')],_0x31f600[_0xbd17('0x68')][_0x25bf52][_0xbd17('0x6b')],_0x31f600['joins'][_0x25bf52][_0xbd17('0x6d')]));}}}if(_0x31f600['conditions']){_0x31f600[_0xbd17('0x6e')]=JSON[_0xbd17('0x6f')](_0x31f600[_0xbd17('0x6e')]);_0x59bf86[_0xbd17('0x2c')](_0x419f54(_0x31f600[_0xbd17('0x6e')][_0xbd17('0x56')]));}_0x562d4d=_0x59bf86[_0xbd17('0x7e')]();_0x59bf86[_0xbd17('0x28')](_0x2a71c4);_0x59bf86[_0xbd17('0x29')](0x0);logger[_0xbd17('0x70')](_0xbd17('0x71'),_0x59bf86[_0xbd17('0x72')]());return db[_0xbd17('0x73')][_0xbd17('0x1f')](_0x59bf86[_0xbd17('0x72')](),{'type':db[_0xbd17('0x73')][_0xbd17('0x74')][_0xbd17('0x75')]});}})['then'](function(){return{'sql':_0x562d4d[_0xbd17('0x72')]()};})[_0xbd17('0x34')](respondWithResult(_0x4656bf,null))[_0xbd17('0x38')](handleError(_0x4656bf,null));}; \ No newline at end of file +var _0xf0fd=['left_join','outer_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationError','Please\x20insert\x20at\x20least\x20one\x20field!','findAll','keyBy','select','from','table','MetricId','metric','replace','function','format','groupBy','orderBy','order','joins','parse','type','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','right_join','SUM(%s)','COUNT(%s)','AVG(%s)','IS\x20EMPTY','Sequelize','AnalyticMetric','DESC','alias','No\x20Data!','output','web','fullPath','randomstring','generate','AnalyticExtractedReport','startDate','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','QueryTypes','run','runReport','request-promise','moment','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','end','status','json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','index','AnalyticCustomReport','model','keys','dateStart','query','dateEnd','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','add','day','merge','where','filter','map','options','includeAll','include','rows','params','rawAttributes','length','find','catch','create','body','preview','join'];(function(_0x2107a6,_0xe8360d){var _0x2f09ef=function(_0x46a86a){while(--_0x46a86a){_0x2107a6['push'](_0x2107a6['shift']());}};_0x2f09ef(++_0xe8360d);}(_0xf0fd,0xe6));var _0xdf0f=function(_0x5dc52c,_0x5a5a30){_0x5dc52c=_0x5dc52c-0x0;var _0x2df29b=_0xf0fd[_0x5dc52c];return _0x2df29b;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xdf0f('0x0'));var moment=require(_0xdf0f('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdf0f('0x2'));var path=require(_0xdf0f('0x3'));var sox=require(_0xdf0f('0x4'));var csv=require(_0xdf0f('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdf0f('0x6'));var squel=require(_0xdf0f('0x7'));var crypto=require(_0xdf0f('0x8'));var jsforce=require(_0xdf0f('0x9'));var deskjs=require(_0xdf0f('0xa'));var toCsv=require(_0xdf0f('0x5'));var querystring=require('querystring');var Papa=require(_0xdf0f('0xb'));var qs=require(_0xdf0f('0xc'));var logger=require(_0xdf0f('0xd'))(_0xdf0f('0xe'));var utils=require(_0xdf0f('0xf'));var config=require('../../config/environment');var db=require(_0xdf0f('0x10'))['db'];function respondWithStatusCode(_0x28d088,_0x188375){_0x188375=_0x188375||0xcc;return function(_0x36a0ef){if(_0x36a0ef){return _0x28d088['sendStatus'](_0x188375);}return _0x28d088['status'](_0x188375)[_0xdf0f('0x11')]();};}function respondWithResult(_0x4d0c0b,_0xaa365e){_0xaa365e=_0xaa365e||0xc8;return function(_0x28452a){if(_0x28452a){return _0x4d0c0b[_0xdf0f('0x12')](_0xaa365e)[_0xdf0f('0x13')](_0x28452a);}};}function respondWithFilteredResult(_0x2921e5,_0x1d3f1b){return function(_0x4ac1ac){if(_0x4ac1ac){var _0x52d328=_0x4ac1ac[_0xdf0f('0x14')],_0x3f91ca=_0x1d3f1b[_0xdf0f('0x15')],_0x457960=_0x1d3f1b['offset']+_0x1d3f1b[_0xdf0f('0x16')],_0x5c7164;if(_0x457960>=_0x52d328){_0x457960=_0x52d328;_0x5c7164=0xc8;}else{_0x5c7164=0xce;}_0x2921e5['status'](_0x5c7164);return _0x2921e5[_0xdf0f('0x17')]('Content-Range',_0x3f91ca+'-'+_0x457960+'/'+_0x52d328)[_0xdf0f('0x13')](_0x4ac1ac);}return null;};}function patchUpdates(_0x18624a){return function(_0x11d628){try{jsonpatch[_0xdf0f('0x18')](_0x11d628,_0x18624a,!![]);}catch(_0xae94ee){return BPromise[_0xdf0f('0x19')](_0xae94ee);}return _0x11d628[_0xdf0f('0x1a')]();};}function saveUpdates(_0x517e76,_0x22c072){return function(_0x5ebff6){if(_0x5ebff6){return _0x5ebff6[_0xdf0f('0x1b')](_0x517e76)[_0xdf0f('0x1c')](function(_0x5efd2c){return _0x5efd2c;});}return null;};}function removeEntity(_0x110dc4,_0x5946e2){return function(_0x39aafd){if(_0x39aafd){return _0x39aafd['destroy']()[_0xdf0f('0x1c')](function(){_0x110dc4[_0xdf0f('0x12')](0xcc)[_0xdf0f('0x11')]();});}};}function handleEntityNotFound(_0x5bad86,_0x158a08){return function(_0x49e25f){if(!_0x49e25f){_0x5bad86['sendStatus'](0x194);}return _0x49e25f;};}function handleError(_0x3502d9,_0x36e5ce){_0x36e5ce=_0x36e5ce||0x1f4;return function(_0xce1f2){logger[_0xdf0f('0x1d')](_0xce1f2[_0xdf0f('0x1e')]);if(_0xce1f2[_0xdf0f('0x1f')]){delete _0xce1f2[_0xdf0f('0x1f')];}_0x3502d9[_0xdf0f('0x12')](_0x36e5ce)[_0xdf0f('0x20')](_0xce1f2);};}exports[_0xdf0f('0x21')]=function(_0x219580,_0x3b651c){var _0x136d46={},_0x8b78af={},_0x57bade={'count':0x0,'rows':[]};var _0x349593=db[_0xdf0f('0x22')]['rawAttributes'];_0x8b78af[_0xdf0f('0x23')]=_[_0xdf0f('0x24')](_0x349593);var _0x11b52a={'dateStart':_0x219580['query'][_0xdf0f('0x25')],'dateEnd':_0x219580[_0xdf0f('0x26')][_0xdf0f('0x27')]};delete _0x219580[_0xdf0f('0x26')][_0xdf0f('0x25')];delete _0x219580[_0xdf0f('0x26')][_0xdf0f('0x27')];_0x8b78af[_0xdf0f('0x26')]=_[_0xdf0f('0x24')](_0x219580[_0xdf0f('0x26')]);_0x8b78af[_0xdf0f('0x28')]=_['intersection'](_0x8b78af[_0xdf0f('0x23')],_0x8b78af[_0xdf0f('0x26')]);_0x136d46[_0xdf0f('0x29')]=_[_0xdf0f('0x2a')](_0x8b78af[_0xdf0f('0x23')],qs['fields'](_0x219580[_0xdf0f('0x26')][_0xdf0f('0x2b')]));_0x136d46[_0xdf0f('0x29')]=_0x136d46['attributes']['length']?_0x136d46[_0xdf0f('0x29')]:_0x8b78af[_0xdf0f('0x23')];if(!_0x219580['query'][_0xdf0f('0x2c')](_0xdf0f('0x2d'))){_0x136d46[_0xdf0f('0x16')]=qs['limit'](_0x219580[_0xdf0f('0x26')][_0xdf0f('0x16')]);_0x136d46[_0xdf0f('0x15')]=qs[_0xdf0f('0x15')](_0x219580[_0xdf0f('0x26')][_0xdf0f('0x15')]);}_0x136d46['order']=qs[_0xdf0f('0x2e')](_0x219580[_0xdf0f('0x26')][_0xdf0f('0x2e')]);_0x136d46['where']=qs[_0xdf0f('0x28')](_['pick'](_0x219580['query'],_0x8b78af[_0xdf0f('0x28')]));if(_0x11b52a[_0xdf0f('0x25')]){if(_0x11b52a[_0xdf0f('0x27')]){_0x11b52a[_0xdf0f('0x27')]=moment(_0x11b52a['dateEnd'])[_0xdf0f('0x2f')](0x1,_0xdf0f('0x30'));}else{_0x11b52a[_0xdf0f('0x27')]=moment(_0x11b52a['dateStart'])[_0xdf0f('0x2f')](0x1,_0xdf0f('0x30'));}_[_0xdf0f('0x31')](_0x136d46[_0xdf0f('0x32')],{'createdAt':{'$gte':_0x11b52a['dateStart'],'$lte':_0x11b52a['dateEnd']}});}if(_0x219580['query'][_0xdf0f('0x33')]){_0x136d46[_0xdf0f('0x32')]=_['merge'](_0x136d46[_0xdf0f('0x32')],{'$or':_[_0xdf0f('0x34')](_0x136d46[_0xdf0f('0x29')],function(_0xc569ed){var _0x3f71d2={};_0x3f71d2[_0xc569ed]={'$like':'%'+_0x219580[_0xdf0f('0x26')][_0xdf0f('0x33')]+'%'};return _0x3f71d2;})});}_0x136d46=_[_0xdf0f('0x31')]({},_0x136d46,_0x219580[_0xdf0f('0x35')]);var _0x4ede87={'where':_0x136d46[_0xdf0f('0x32')]};return db[_0xdf0f('0x22')]['count'](_0x4ede87)[_0xdf0f('0x1c')](function(_0x5ce261){_0x57bade[_0xdf0f('0x14')]=_0x5ce261;if(_0x219580[_0xdf0f('0x26')][_0xdf0f('0x36')]){_0x136d46[_0xdf0f('0x37')]=[{'all':!![]}];}return db[_0xdf0f('0x22')]['findAll'](_0x136d46);})['then'](function(_0x41af20){_0x57bade[_0xdf0f('0x38')]=_0x41af20;return _0x57bade;})[_0xdf0f('0x1c')](respondWithFilteredResult(_0x3b651c,_0x136d46))['catch'](handleError(_0x3b651c,null));};exports['show']=function(_0x3733e7,_0x19f8d6){var _0x32745f={'raw':![],'where':{'id':_0x3733e7[_0xdf0f('0x39')]['id']}},_0x4692ab={};_0x4692ab[_0xdf0f('0x23')]=_[_0xdf0f('0x24')](db[_0xdf0f('0x22')][_0xdf0f('0x3a')]);_0x4692ab[_0xdf0f('0x26')]=_[_0xdf0f('0x24')](_0x3733e7['query']);_0x4692ab[_0xdf0f('0x28')]=_[_0xdf0f('0x2a')](_0x4692ab[_0xdf0f('0x23')],_0x4692ab[_0xdf0f('0x26')]);_0x32745f[_0xdf0f('0x29')]=_[_0xdf0f('0x2a')](_0x4692ab[_0xdf0f('0x23')],qs[_0xdf0f('0x2b')](_0x3733e7['query'][_0xdf0f('0x2b')]));_0x32745f[_0xdf0f('0x29')]=_0x32745f['attributes'][_0xdf0f('0x3b')]?_0x32745f[_0xdf0f('0x29')]:_0x4692ab[_0xdf0f('0x23')];if(_0x3733e7['query']['includeAll']){_0x32745f[_0xdf0f('0x37')]=[{'all':!![]}];}_0x32745f=_[_0xdf0f('0x31')]({},_0x32745f,_0x3733e7['options']);return db[_0xdf0f('0x22')][_0xdf0f('0x3c')](_0x32745f)['then'](handleEntityNotFound(_0x19f8d6,null))[_0xdf0f('0x1c')](respondWithResult(_0x19f8d6,null))[_0xdf0f('0x3d')](handleError(_0x19f8d6,null));};exports[_0xdf0f('0x3e')]=function(_0x14d43e,_0x698a60){return db[_0xdf0f('0x22')][_0xdf0f('0x3e')](_0x14d43e[_0xdf0f('0x3f')],{})[_0xdf0f('0x1c')](respondWithResult(_0x698a60,0xc9))[_0xdf0f('0x3d')](handleError(_0x698a60,null));};exports[_0xdf0f('0x1b')]=function(_0x2b1752,_0x9f0d7e){if(_0x2b1752[_0xdf0f('0x3f')]['id']){delete _0x2b1752[_0xdf0f('0x3f')]['id'];}return db[_0xdf0f('0x22')][_0xdf0f('0x3c')]({'where':{'id':_0x2b1752[_0xdf0f('0x39')]['id']}})[_0xdf0f('0x1c')](handleEntityNotFound(_0x9f0d7e,null))[_0xdf0f('0x1c')](saveUpdates(_0x2b1752[_0xdf0f('0x3f')],null))[_0xdf0f('0x1c')](respondWithResult(_0x9f0d7e,null))[_0xdf0f('0x3d')](handleError(_0x9f0d7e,null));};exports['destroy']=function(_0xdf3cf,_0x75ac5c){return db['AnalyticCustomReport'][_0xdf0f('0x3c')]({'where':{'id':_0xdf3cf[_0xdf0f('0x39')]['id']}})['then'](handleEntityNotFound(_0x75ac5c,null))[_0xdf0f('0x1c')](removeEntity(_0x75ac5c,null))['catch'](handleError(_0x75ac5c,null));};exports[_0xdf0f('0x40')]=function(_0x5946f4,_0x1c26b9){var _0x51aa54=0xa;var _0x1e92cb=[_0xdf0f('0x41'),_0xdf0f('0x42'),'right_join',_0xdf0f('0x43'),_0xdf0f('0x44')];var _0x5e84d6={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xdf0f('0x45'),'MAX':_0xdf0f('0x46'),'MIN':_0xdf0f('0x47'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xdf0f('0x48'),'GROUP_CONCAT ASC':_0xdf0f('0x49'),'GROUP_CONCAT DESC':_0xdf0f('0x4a')};var _0x1cf4f0={'SEC_TO_TIME':_0xdf0f('0x4b'),'DATE':_0xdf0f('0x4c'),'HOUR':_0xdf0f('0x4d'),'ROUND':_0xdf0f('0x4e'),'UNIX_TIMESTAMP':_0xdf0f('0x4f')};var _0xda518e=function(_0x44978a){return!_[_0xdf0f('0x50')]([_0xdf0f('0x51'),_0xdf0f('0x52'),'IS\x20EMPTY',_0xdf0f('0x53')],_0x44978a);};var _0x1c94ba=function(_0x32204c){if(!_0x32204c||!_0x32204c[_0xdf0f('0x54')][_0xdf0f('0x3b')]){return'';}for(var _0x5de894='(',_0x182ef3=0x0;_0x182ef3<_0x32204c[_0xdf0f('0x54')][_0xdf0f('0x3b')];_0x182ef3+=0x1){_0x182ef3>0x0&&(_0x5de894+='\x20'+_0x32204c[_0xdf0f('0x55')]+'\x20');_0x5de894+=_0x32204c[_0xdf0f('0x54')][_0x182ef3]['group']?_0x1c94ba(_0x32204c[_0xdf0f('0x54')][_0x182ef3][_0xdf0f('0x56')]):_0x32204c[_0xdf0f('0x54')][_0x182ef3][_0xdf0f('0x57')]+'\x20'+_0x32204c['rules'][_0x182ef3][_0xdf0f('0x58')]+(_0xda518e(_0x32204c['rules'][_0x182ef3][_0xdf0f('0x58')])?'\x20'+_0x32204c[_0xdf0f('0x54')][_0x182ef3][_0xdf0f('0x59')]:'');}return _0x5de894+')';};var _0x4f2af3={'where':{'id':_0x5946f4['params']['id']}},_0x3b1ed1,_0x44970a,_0x324963,_0x1a8530,_0x3c36c9;_0x4f2af3=_[_0xdf0f('0x31')]({},_0x4f2af3,_0x5946f4[_0xdf0f('0x35')]);return db['AnalyticCustomReport']['find'](_0x4f2af3)[_0xdf0f('0x1c')](function(_0xe313eb){if(_0xe313eb){_0x3b1ed1=_0xe313eb;return _0xe313eb[_0xdf0f('0x5a')]();}return null;})[_0xdf0f('0x1c')](function(_0x17517b){if(_0x17517b){if(!_0x17517b[_0xdf0f('0x3b')]){throw new db['Sequelize'][(_0xdf0f('0x5b'))](_0xdf0f('0x5c'));}_0x44970a=_0x17517b;return db['AnalyticMetric'][_0xdf0f('0x5d')]({'raw':!![]});}return null;})['then'](function(_0x47d0c4){if(_0x47d0c4){_0x324963=_[_0xdf0f('0x5e')](_0x47d0c4,'id');var _0x3d318e;var _0xf76639=squel[_0xdf0f('0x5f')]();_0xf76639[_0xdf0f('0x60')](_0x3b1ed1[_0xdf0f('0x61')]);for(var _0x570ae8=0x0;_0x570ae8<_0x44970a['length'];_0x570ae8+=0x1){_0x3d318e=_0x44970a[_0x570ae8][_0xdf0f('0x62')]?_0x324963[_0x44970a[_0x570ae8][_0xdf0f('0x62')]][_0xdf0f('0x63')]:_0x44970a[_0x570ae8]['field'];_0x3d318e=_0x44970a[_0x570ae8]['function']?_[_0xdf0f('0x64')](_0x5e84d6[_0x44970a[_0x570ae8][_0xdf0f('0x65')]],'%s',_0x3d318e):_0x3d318e;_0x3d318e=_0x44970a[_0x570ae8][_0xdf0f('0x66')]?_[_0xdf0f('0x64')](_0x1cf4f0[_0x44970a[_0x570ae8][_0xdf0f('0x66')]],'%s',_0x3d318e):_0x3d318e;if(_0x44970a[_0x570ae8][_0xdf0f('0x67')]){_0xf76639[_0xdf0f('0x56')](_0x3d318e);}_0x44970a[_0x570ae8][_0xdf0f('0x68')]&&_0xf76639[_0xdf0f('0x69')](_0x3d318e,_0x44970a[_0x570ae8][_0xdf0f('0x68')]==='DESC'?![]:!![]);_0xf76639[_0xdf0f('0x57')](_0x3d318e,_0x44970a[_0x570ae8]['alias']||_0x3d318e);}if(_0x3b1ed1[_0xdf0f('0x6a')]){_0x3b1ed1[_0xdf0f('0x6a')]=JSON[_0xdf0f('0x6b')](_0x3b1ed1[_0xdf0f('0x6a')]);for(var _0x1a0517=0x0;_0x1a0517<_0x3b1ed1['joins'][_0xdf0f('0x3b')];_0x1a0517+=0x1){if(_0x3b1ed1[_0xdf0f('0x6a')][_0x1a0517][_0xdf0f('0x6c')]&&_[_0xdf0f('0x50')](_0x1e92cb,_0x3b1ed1[_0xdf0f('0x6a')][_0x1a0517]['type'])&&_0x3b1ed1[_0xdf0f('0x6a')][_0x1a0517][_0xdf0f('0x6d')]&&_0x3b1ed1[_0xdf0f('0x6a')][_0x1a0517][_0xdf0f('0x6e')]&&_0x3b1ed1[_0xdf0f('0x6a')][_0x1a0517]['foreignKey']){_0xf76639[_0x3b1ed1[_0xdf0f('0x6a')][_0x1a0517][_0xdf0f('0x6c')]](_0x3b1ed1[_0xdf0f('0x6a')][_0x1a0517][_0xdf0f('0x6e')],null,util[_0xdf0f('0x66')](_0xdf0f('0x6f'),_0x3b1ed1['table'],_0x3b1ed1[_0xdf0f('0x6a')][_0x1a0517]['parentKey'],_0x3b1ed1[_0xdf0f('0x6a')][_0x1a0517][_0xdf0f('0x6e')],_0x3b1ed1['joins'][_0x1a0517][_0xdf0f('0x70')]));}}}if(_0x3b1ed1[_0xdf0f('0x71')]){_0x3b1ed1[_0xdf0f('0x71')]=JSON['parse'](_0x3b1ed1[_0xdf0f('0x71')]);_0xf76639[_0xdf0f('0x32')](_0x1c94ba(_0x3b1ed1['conditions'][_0xdf0f('0x56')]));}_0x3c36c9=_0xf76639[_0xdf0f('0x72')]();_0xf76639[_0xdf0f('0x16')](_0x51aa54);_0xf76639[_0xdf0f('0x15')](0x0);logger[_0xdf0f('0x73')](_0xdf0f('0x74'),_0xf76639[_0xdf0f('0x75')]());return db[_0xdf0f('0x76')][_0xdf0f('0x26')](_0xf76639[_0xdf0f('0x75')](),{'type':db[_0xdf0f('0x76')]['QueryTypes'][_0xdf0f('0x77')]});}})[_0xdf0f('0x1c')](respondWithResult(_0x1c26b9,null))[_0xdf0f('0x3d')](handleError(_0x1c26b9,null));};function runReport(_0x3f29cd,_0x2a145c,_0x206cce){var _0x2cdba7=_0x2a145c['name'];var _0x3beaf6=0xa;var _0x1e632d=['join',_0xdf0f('0x42'),_0xdf0f('0x78'),_0xdf0f('0x43'),'cross_join'];var _0x3c9216={'SUM':_0xdf0f('0x79'),'COUNT':_0xdf0f('0x7a'),'COUNT DISTINCT':_0xdf0f('0x45'),'MAX':_0xdf0f('0x46'),'MIN':'MIN(%s)','AVG':_0xdf0f('0x7b'),'GROUP_CONCAT':_0xdf0f('0x48'),'GROUP_CONCAT ASC':_0xdf0f('0x49'),'GROUP_CONCAT DESC':_0xdf0f('0x4a')};var _0x4a2cef={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xdf0f('0x4c'),'HOUR':_0xdf0f('0x4d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x41a6c8=function(_0x36ba5c){return!_[_0xdf0f('0x50')]([_0xdf0f('0x51'),'IS\x20NOT\x20NULL',_0xdf0f('0x7c'),_0xdf0f('0x53')],_0x36ba5c);};var _0x2b4f9d=function(_0x420334){if(!_0x420334||!_0x420334[_0xdf0f('0x54')]['length']){return'';}for(var _0x25522e='(',_0x3982cc=0x0;_0x3982cc<_0x420334[_0xdf0f('0x54')][_0xdf0f('0x3b')];_0x3982cc+=0x1){_0x3982cc>0x0&&(_0x25522e+='\x20'+_0x420334['operator']+'\x20');_0x25522e+=_0x420334[_0xdf0f('0x54')][_0x3982cc]['group']?_0x2b4f9d(_0x420334['rules'][_0x3982cc][_0xdf0f('0x56')]):_0x420334[_0xdf0f('0x54')][_0x3982cc]['field']+'\x20'+_0x420334[_0xdf0f('0x54')][_0x3982cc][_0xdf0f('0x58')]+(_0x41a6c8(_0x420334[_0xdf0f('0x54')][_0x3982cc][_0xdf0f('0x58')])?'\x20'+_0x420334[_0xdf0f('0x54')][_0x3982cc]['value']:'');}return _0x25522e+')';};var _0x1fcf36={'where':{'id':_0x3f29cd['id']}},_0x2935b9,_0x189938,_0x1238fe,_0x477dbc,_0x2452dc;_0x1fcf36=_['merge']({},_0x1fcf36,_0x206cce);return db[_0xdf0f('0x22')][_0xdf0f('0x3c')](_0x1fcf36)[_0xdf0f('0x1c')](function(_0x2c867d){if(_0x2c867d){_0x2935b9=_0x2c867d;return _0x2c867d[_0xdf0f('0x5a')]();}return null;})[_0xdf0f('0x1c')](function(_0x3e4b43){if(_0x3e4b43){if(!_0x3e4b43['length']){throw new db[(_0xdf0f('0x7d'))][(_0xdf0f('0x5b'))]('Please\x20insert\x20at\x20least\x20one\x20field!');}_0x189938=_0x3e4b43;return db[_0xdf0f('0x7e')][_0xdf0f('0x5d')]({'raw':!![]});}return null;})[_0xdf0f('0x1c')](function(_0x25ab06){if(_0x25ab06){_0x1238fe=_['keyBy'](_0x25ab06,'id');var _0x23a7c6;var _0x397e06=squel[_0xdf0f('0x5f')]();_0x397e06[_0xdf0f('0x60')](_0x2935b9[_0xdf0f('0x61')]);for(var _0x5ce640=0x0;_0x5ce640<_0x189938[_0xdf0f('0x3b')];_0x5ce640+=0x1){_0x23a7c6=_0x189938[_0x5ce640][_0xdf0f('0x62')]?_0x1238fe[_0x189938[_0x5ce640][_0xdf0f('0x62')]][_0xdf0f('0x63')]:_0x189938[_0x5ce640][_0xdf0f('0x57')];_0x23a7c6=_0x189938[_0x5ce640][_0xdf0f('0x65')]?_[_0xdf0f('0x64')](_0x3c9216[_0x189938[_0x5ce640]['function']],'%s',_0x23a7c6):_0x23a7c6;_0x23a7c6=_0x189938[_0x5ce640][_0xdf0f('0x66')]?_[_0xdf0f('0x64')](_0x4a2cef[_0x189938[_0x5ce640]['format']],'%s',_0x23a7c6):_0x23a7c6;if(_0x189938[_0x5ce640][_0xdf0f('0x67')]){_0x397e06['group'](_0x23a7c6);}_0x189938[_0x5ce640]['orderBy']&&_0x397e06[_0xdf0f('0x69')](_0x23a7c6,_0x189938[_0x5ce640][_0xdf0f('0x68')]===_0xdf0f('0x7f')?![]:!![]);_0x397e06[_0xdf0f('0x57')](_0x23a7c6,_0x189938[_0x5ce640][_0xdf0f('0x80')]||_0x23a7c6);}if(_0x2935b9[_0xdf0f('0x6a')]){_0x2935b9['joins']=JSON[_0xdf0f('0x6b')](_0x2935b9[_0xdf0f('0x6a')]);for(var _0x54393d=0x0;_0x54393d<_0x2935b9[_0xdf0f('0x6a')][_0xdf0f('0x3b')];_0x54393d+=0x1){if(_0x2935b9[_0xdf0f('0x6a')][_0x54393d]['type']&&_[_0xdf0f('0x50')](_0x1e632d,_0x2935b9[_0xdf0f('0x6a')][_0x54393d]['type'])&&_0x2935b9[_0xdf0f('0x6a')][_0x54393d][_0xdf0f('0x6d')]&&_0x2935b9[_0xdf0f('0x6a')][_0x54393d][_0xdf0f('0x6e')]&&_0x2935b9[_0xdf0f('0x6a')][_0x54393d][_0xdf0f('0x70')]){_0x397e06[_0x2935b9[_0xdf0f('0x6a')][_0x54393d][_0xdf0f('0x6c')]](_0x2935b9[_0xdf0f('0x6a')][_0x54393d][_0xdf0f('0x6e')],null,util[_0xdf0f('0x66')]('%s.%s\x20=\x20%s.%s',_0x2935b9[_0xdf0f('0x61')],_0x2935b9[_0xdf0f('0x6a')][_0x54393d]['parentKey'],_0x2935b9[_0xdf0f('0x6a')][_0x54393d][_0xdf0f('0x6e')],_0x2935b9[_0xdf0f('0x6a')][_0x54393d][_0xdf0f('0x70')]));}}}if(_0x2935b9['conditions']){_0x2935b9[_0xdf0f('0x71')]=JSON['parse'](_0x2935b9[_0xdf0f('0x71')]);_0x397e06['where'](_0x2b4f9d(_0x2935b9[_0xdf0f('0x71')][_0xdf0f('0x56')]));}_0x2452dc=_0x397e06[_0xdf0f('0x72')]();_0x397e06['limit'](_0x3beaf6);_0x397e06['offset'](0x0);logger[_0xdf0f('0x73')]('Limited\x20Query:',_0x397e06[_0xdf0f('0x75')]());return db['sequelize']['query'](_0x397e06[_0xdf0f('0x75')](),{'type':db[_0xdf0f('0x76')]['QueryTypes'][_0xdf0f('0x77')]});}})[_0xdf0f('0x1c')](function(_0x5d751e){if(!_0x5d751e[_0xdf0f('0x3b')]){throw new db[(_0xdf0f('0x7d'))][(_0xdf0f('0x5b'))](_0xdf0f('0x81'));}if(_0x2a145c[_0xdf0f('0x82')]===_0xdf0f('0x83')){return null;}var _0x57ee10=_[_0xdf0f('0x31')](_0x2a145c,{'name':_0x2a145c[_0xdf0f('0x84')]||_0x2a145c[_0xdf0f('0x1f')]||_0x2935b9[_0xdf0f('0x1f')],'basename':_0x2cdba7,'savename':util['format']('%s-%s.%s',_0x2a145c[_0xdf0f('0x1f')]||_0x2935b9[_0xdf0f('0x1f')],require(_0xdf0f('0x85'))[_0xdf0f('0x86')](0x4),_0x2a145c[_0xdf0f('0x82')]||'csv')});return db[_0xdf0f('0x87')][_0xdf0f('0x3e')](_0x57ee10,{'raw':!![]});})['then'](function(_0x290a25){_0x2452dc['where'](_0x2935b9[_0xdf0f('0x61')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2a145c[_0xdf0f('0x88')],_0x2a145c[_0xdf0f('0x89')]);if(_0x290a25){logger['info'](_0xdf0f('0x8a'),_0x2452dc[_0xdf0f('0x75')]());require(_0xdf0f('0x8b'))[_0xdf0f('0x8c')](path[_0xdf0f('0x41')](__dirname,_0xdf0f('0x8d'),_0x290a25['output']),[_0x290a25['id'],_0x2452dc[_0xdf0f('0x75')](),path[_0xdf0f('0x41')](__dirname,_0xdf0f('0x8e'),_0x290a25['savename']),_0x2cdba7]);return _0x290a25;}else{var _0xb15f25=squel[_0xdf0f('0x5f')]();_0xb15f25[_0xdf0f('0x60')]('('+_0x2452dc[_0xdf0f('0x75')]()+')',_0xdf0f('0x8f'));_0xb15f25[_0xdf0f('0x57')](_0xdf0f('0x90'),_0xdf0f('0x14'));_0x2452dc[_0xdf0f('0x16')](_0x2a145c['limit']||_0x3beaf6);_0x2452dc[_0xdf0f('0x15')](_0x2a145c['offset']||0x0);return db[_0xdf0f('0x76')]['query'](_0xb15f25[_0xdf0f('0x75')](),{'type':db[_0xdf0f('0x76')]['QueryTypes'][_0xdf0f('0x77')]})[_0xdf0f('0x1c')](function(_0x558ada){if(!_0x558ada[_0xdf0f('0x3b')]){_0x477dbc=0x0;}else{_0x477dbc=_0x558ada[0x0][_0xdf0f('0x14')]||0x0;}return db[_0xdf0f('0x76')][_0xdf0f('0x26')](_0x2452dc[_0xdf0f('0x75')](),{'type':db[_0xdf0f('0x76')][_0xdf0f('0x91')][_0xdf0f('0x77')]});})[_0xdf0f('0x1c')](function(_0x44cf77){return{'rows':_0x44cf77||[],'count':_0x477dbc};});}});}exports[_0xdf0f('0x92')]=function(_0x6a293d,_0x2997c0){return runReport(_0x6a293d[_0xdf0f('0x39')],_0x6a293d[_0xdf0f('0x26')],_0x6a293d[_0xdf0f('0x35')])[_0xdf0f('0x1c')](respondWithResult(_0x2997c0,null))[_0xdf0f('0x3d')](handleError(_0x2997c0,null));};exports[_0xdf0f('0x93')]=runReport;exports[_0xdf0f('0x26')]=function(_0xa0f512,_0x3c35e9){var _0x4c2b02=0xa;var _0x3d3772=[_0xdf0f('0x41'),'left_join',_0xdf0f('0x78'),_0xdf0f('0x43'),'cross_join'];var _0x578379={'SUM':'SUM(%s)','COUNT':_0xdf0f('0x7a'),'COUNT DISTINCT':_0xdf0f('0x45'),'MAX':_0xdf0f('0x46'),'MIN':_0xdf0f('0x47'),'AVG':_0xdf0f('0x7b'),'GROUP_CONCAT':_0xdf0f('0x48'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x497feb={'SEC_TO_TIME':_0xdf0f('0x4b'),'DATE':_0xdf0f('0x4c'),'HOUR':_0xdf0f('0x4d'),'ROUND':_0xdf0f('0x4e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3d8144=function(_0x16b8a8){return!_[_0xdf0f('0x50')]([_0xdf0f('0x51'),_0xdf0f('0x52'),_0xdf0f('0x7c'),_0xdf0f('0x53')],_0x16b8a8);};var _0x342da7=function(_0x12940c){if(!_0x12940c||!_0x12940c[_0xdf0f('0x54')]['length']){return'';}for(var _0x2d0300='(',_0x28d76a=0x0;_0x28d76a<_0x12940c[_0xdf0f('0x54')][_0xdf0f('0x3b')];_0x28d76a+=0x1){_0x28d76a>0x0&&(_0x2d0300+='\x20'+_0x12940c['operator']+'\x20');_0x2d0300+=_0x12940c[_0xdf0f('0x54')][_0x28d76a][_0xdf0f('0x56')]?_0x342da7(_0x12940c[_0xdf0f('0x54')][_0x28d76a][_0xdf0f('0x56')]):_0x12940c[_0xdf0f('0x54')][_0x28d76a][_0xdf0f('0x57')]+'\x20'+_0x12940c[_0xdf0f('0x54')][_0x28d76a][_0xdf0f('0x58')]+(_0x3d8144(_0x12940c['rules'][_0x28d76a]['condition'])?'\x20'+_0x12940c[_0xdf0f('0x54')][_0x28d76a][_0xdf0f('0x59')]:'');}return _0x2d0300+')';};var _0x5f134e={'where':{'id':_0xa0f512['params']['id']}},_0x1f1179,_0x356e22,_0x625315,_0xf9292e,_0x370bf9;_0x5f134e=_['merge']({},_0x5f134e,_0xa0f512[_0xdf0f('0x35')]);return db['AnalyticCustomReport']['find'](_0x5f134e)[_0xdf0f('0x1c')](function(_0x5ef2b7){if(_0x5ef2b7){_0x1f1179=_0x5ef2b7;return _0x5ef2b7['getFields']();}return null;})[_0xdf0f('0x1c')](function(_0x4a6f63){if(_0x4a6f63){if(!_0x4a6f63['length']){throw new db[(_0xdf0f('0x7d'))][(_0xdf0f('0x5b'))](_0xdf0f('0x5c'));}_0x356e22=_0x4a6f63;return db[_0xdf0f('0x7e')][_0xdf0f('0x5d')]({'raw':!![]});}return null;})[_0xdf0f('0x1c')](function(_0x1c55e8){if(_0x1c55e8){_0x625315=_[_0xdf0f('0x5e')](_0x1c55e8,'id');var _0x1673b6;var _0x201197=squel['select']();_0x201197[_0xdf0f('0x60')](_0x1f1179[_0xdf0f('0x61')]);for(var _0x36e2bc=0x0;_0x36e2bc<_0x356e22['length'];_0x36e2bc+=0x1){_0x1673b6=_0x356e22[_0x36e2bc][_0xdf0f('0x62')]?_0x625315[_0x356e22[_0x36e2bc][_0xdf0f('0x62')]][_0xdf0f('0x63')]:_0x356e22[_0x36e2bc][_0xdf0f('0x57')];_0x1673b6=_0x356e22[_0x36e2bc][_0xdf0f('0x65')]?_[_0xdf0f('0x64')](_0x578379[_0x356e22[_0x36e2bc][_0xdf0f('0x65')]],'%s',_0x1673b6):_0x1673b6;_0x1673b6=_0x356e22[_0x36e2bc][_0xdf0f('0x66')]?_[_0xdf0f('0x64')](_0x497feb[_0x356e22[_0x36e2bc][_0xdf0f('0x66')]],'%s',_0x1673b6):_0x1673b6;if(_0x356e22[_0x36e2bc][_0xdf0f('0x67')]){_0x201197[_0xdf0f('0x56')](_0x1673b6);}_0x356e22[_0x36e2bc][_0xdf0f('0x68')]&&_0x201197[_0xdf0f('0x69')](_0x1673b6,_0x356e22[_0x36e2bc][_0xdf0f('0x68')]==='DESC'?![]:!![]);_0x201197[_0xdf0f('0x57')](_0x1673b6,_0x356e22[_0x36e2bc]['alias']||_0x1673b6);}if(_0x1f1179[_0xdf0f('0x6a')]){_0x1f1179['joins']=JSON[_0xdf0f('0x6b')](_0x1f1179[_0xdf0f('0x6a')]);for(var _0x1f8477=0x0;_0x1f8477<_0x1f1179[_0xdf0f('0x6a')]['length'];_0x1f8477+=0x1){if(_0x1f1179[_0xdf0f('0x6a')][_0x1f8477]['type']&&_[_0xdf0f('0x50')](_0x3d3772,_0x1f1179[_0xdf0f('0x6a')][_0x1f8477][_0xdf0f('0x6c')])&&_0x1f1179[_0xdf0f('0x6a')][_0x1f8477]['parentKey']&&_0x1f1179[_0xdf0f('0x6a')][_0x1f8477][_0xdf0f('0x6e')]&&_0x1f1179[_0xdf0f('0x6a')][_0x1f8477][_0xdf0f('0x70')]){_0x201197[_0x1f1179[_0xdf0f('0x6a')][_0x1f8477][_0xdf0f('0x6c')]](_0x1f1179['joins'][_0x1f8477]['foreignTable'],null,util['format'](_0xdf0f('0x6f'),_0x1f1179['table'],_0x1f1179[_0xdf0f('0x6a')][_0x1f8477][_0xdf0f('0x6d')],_0x1f1179['joins'][_0x1f8477][_0xdf0f('0x6e')],_0x1f1179[_0xdf0f('0x6a')][_0x1f8477][_0xdf0f('0x70')]));}}}if(_0x1f1179['conditions']){_0x1f1179[_0xdf0f('0x71')]=JSON[_0xdf0f('0x6b')](_0x1f1179[_0xdf0f('0x71')]);_0x201197[_0xdf0f('0x32')](_0x342da7(_0x1f1179[_0xdf0f('0x71')][_0xdf0f('0x56')]));}_0x370bf9=_0x201197[_0xdf0f('0x72')]();_0x201197[_0xdf0f('0x16')](_0x4c2b02);_0x201197['offset'](0x0);logger[_0xdf0f('0x73')](_0xdf0f('0x74'),_0x201197['toString']());return db['sequelize'][_0xdf0f('0x26')](_0x201197['toString'](),{'type':db[_0xdf0f('0x76')][_0xdf0f('0x91')]['SELECT']});}})[_0xdf0f('0x1c')](function(){return{'sql':_0x370bf9[_0xdf0f('0x75')]()};})[_0xdf0f('0x1c')](respondWithResult(_0x3c35e9,null))[_0xdf0f('0x3d')](handleError(_0x3c35e9,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 343d920..f1db858 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 _0x35d7=['lodash','../../config/logger','api','bluebird','request-promise','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports'];(function(_0x18d8da,_0x42f2e5){var _0x389119=function(_0x3f561b){while(--_0x3f561b){_0x18d8da['push'](_0x18d8da['shift']());}};_0x389119(++_0x42f2e5);}(_0x35d7,0x19a));var _0x735d=function(_0x3fbe3f,_0x3be178){_0x3fbe3f=_0x3fbe3f-0x0;var _0x33bed3=_0x35d7[_0x3fbe3f];return _0x33bed3;};'use strict';var _=require(_0x735d('0x0'));var util=require('util');var logger=require(_0x735d('0x1'))(_0x735d('0x2'));var moment=require('moment');var BPromise=require(_0x735d('0x3'));var rp=require(_0x735d('0x4'));var attributes=require(_0x735d('0x5'));module[_0x735d('0x6')]=function(_0x1c217c,_0x5e1837){return _0x1c217c[_0x735d('0x7')](_0x735d('0x8'),attributes,{'tableName':_0x735d('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4ba=['AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./analyticCustomReport.attributes','exports'];(function(_0x2a7b50,_0x545d55){var _0x4224c9=function(_0x2b96f6){while(--_0x2b96f6){_0x2a7b50['push'](_0x2a7b50['shift']());}};_0x4224c9(++_0x545d55);}(_0xf4ba,0x18e));var _0xaf4b=function(_0x559f22,_0x33e750){_0x559f22=_0x559f22-0x0;var _0x541c82=_0xf4ba[_0x559f22];return _0x541c82;};'use strict';var _=require(_0xaf4b('0x0'));var util=require(_0xaf4b('0x1'));var logger=require(_0xaf4b('0x2'))(_0xaf4b('0x3'));var moment=require(_0xaf4b('0x4'));var BPromise=require(_0xaf4b('0x5'));var rp=require(_0xaf4b('0x6'));var attributes=require(_0xaf4b('0x7'));module[_0xaf4b('0x8')]=function(_0x5b670e,_0x9e0fc0){return _0x5b670e['define'](_0xaf4b('0x9'),attributes,{'tableName':_0xaf4b('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 17b8dc3..703d228 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 _0xeca4=['../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x17e843,_0xd71e6f){var _0xcacb76=function(_0x1602ac){while(--_0x1602ac){_0x17e843['push'](_0x17e843['shift']());}};_0xcacb76(++_0xd71e6f);}(_0xeca4,0x82));var _0x4eca=function(_0x583269,_0x1a63ea){_0x583269=_0x583269-0x0;var _0x22a497=_0xeca4[_0x583269];return _0x22a497;};'use strict';var _=require(_0x4eca('0x0'));var util=require(_0x4eca('0x1'));var moment=require('moment');var BPromise=require(_0x4eca('0x2'));var rs=require(_0x4eca('0x3'));var fs=require('fs');var db=require(_0x4eca('0x4'))['db'];var utils=require(_0x4eca('0x5'));var logger=require(_0x4eca('0x6'))(_0x4eca('0x7'));var config=require(_0x4eca('0x8'));var jayson=require(_0x4eca('0x9'));var client=jayson[_0x4eca('0xa')][_0x4eca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x590cc2,_0x317b2c,_0x544ba4){return new BPromise(function(_0x1ed3ce,_0xd9507d){return client[_0x4eca('0xc')](_0x590cc2,_0x544ba4)[_0x4eca('0xd')](function(_0x107270){logger[_0x4eca('0xe')](_0x4eca('0xf'),_0x317b2c,_0x4eca('0x10'));logger[_0x4eca('0x11')](_0x4eca('0x12'),_0x317b2c,_0x4eca('0x10'),JSON[_0x4eca('0x13')](_0x107270));if(_0x107270[_0x4eca('0x14')]){if(_0x107270[_0x4eca('0x14')]['code']===0x1f4){logger[_0x4eca('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0x317b2c,_0x107270[_0x4eca('0x14')][_0x4eca('0x15')]);return _0xd9507d(_0x107270[_0x4eca('0x14')][_0x4eca('0x15')]);}logger[_0x4eca('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0x317b2c,_0x107270[_0x4eca('0x14')][_0x4eca('0x15')]);return _0x1ed3ce(_0x107270[_0x4eca('0x14')]['message']);}else{logger[_0x4eca('0xe')](_0x4eca('0xf'),_0x317b2c,_0x4eca('0x10'));_0x1ed3ce(_0x107270['result'][_0x4eca('0x15')]);}})[_0x4eca('0x16')](function(_0x4ad91e){logger['error'](_0x4eca('0xf'),_0x317b2c,_0x4ad91e);_0xd9507d(_0x4ad91e);});});} \ No newline at end of file +var _0xc097=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','randomstring'];(function(_0x5ca678,_0x261a72){var _0x44ab60=function(_0xe17de5){while(--_0xe17de5){_0x5ca678['push'](_0x5ca678['shift']());}};_0x44ab60(++_0x261a72);}(_0xc097,0x13c));var _0x7c09=function(_0x12e066,_0x1fac2b){_0x12e066=_0x12e066-0x0;var _0x495324=_0xc097[_0x12e066];return _0x495324;};'use strict';var _=require(_0x7c09('0x0'));var util=require(_0x7c09('0x1'));var moment=require(_0x7c09('0x2'));var BPromise=require('bluebird');var rs=require(_0x7c09('0x3'));var fs=require('fs');var db=require(_0x7c09('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c09('0x5'))(_0x7c09('0x6'));var config=require(_0x7c09('0x7'));var jayson=require(_0x7c09('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38c72d,_0x122dd2,_0x38bc75){return new BPromise(function(_0x1dcf0d,_0x1d11f2){return client[_0x7c09('0x9')](_0x38c72d,_0x38bc75)[_0x7c09('0xa')](function(_0x35ce06){logger[_0x7c09('0xb')](_0x7c09('0xc'),_0x122dd2,'request\x20sent');logger[_0x7c09('0xd')](_0x7c09('0xe'),_0x122dd2,_0x7c09('0xf'),JSON[_0x7c09('0x10')](_0x35ce06));if(_0x35ce06[_0x7c09('0x11')]){if(_0x35ce06[_0x7c09('0x11')][_0x7c09('0x12')]===0x1f4){logger['error'](_0x7c09('0xc'),_0x122dd2,_0x35ce06['error'][_0x7c09('0x13')]);return _0x1d11f2(_0x35ce06[_0x7c09('0x11')][_0x7c09('0x13')]);}logger[_0x7c09('0x11')](_0x7c09('0xc'),_0x122dd2,_0x35ce06[_0x7c09('0x11')][_0x7c09('0x13')]);return _0x1dcf0d(_0x35ce06[_0x7c09('0x11')]['message']);}else{logger[_0x7c09('0xb')](_0x7c09('0xc'),_0x122dd2,_0x7c09('0xf'));_0x1dcf0d(_0x35ce06['result'][_0x7c09('0x13')]);}})['catch'](function(_0x541db4){logger[_0x7c09('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x122dd2,_0x541db4);_0x1d11f2(_0x541db4);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 997f923..49239a2 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 _0x5758=['post','put','/:id','update','delete','destroy','exports','multer','path','Router','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','run','query'];(function(_0x2cc594,_0x4d727b){var _0x4abff7=function(_0x22b01d){while(--_0x22b01d){_0x2cc594['push'](_0x2cc594['shift']());}};_0x4abff7(++_0x4d727b);}(_0x5758,0xcd));var _0x8575=function(_0x11535d,_0x7df4ba){_0x11535d=_0x11535d-0x0;var _0x542367=_0x5758[_0x11535d];return _0x542367;};'use strict';var multer=require(_0x8575('0x0'));var util=require('util');var path=require(_0x8575('0x1'));var express=require('express');var router=express[_0x8575('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x8575('0x3'));var config=require(_0x8575('0x4'));var controller=require(_0x8575('0x5'));router[_0x8575('0x6')]('/',auth[_0x8575('0x7')](),controller[_0x8575('0x8')]);router[_0x8575('0x6')]('/:id',auth[_0x8575('0x7')](),controller[_0x8575('0x9')]);router['get'](_0x8575('0xa'),auth['isAuthenticated'](),controller[_0x8575('0xb')]);router[_0x8575('0x6')](_0x8575('0xc'),auth[_0x8575('0x7')](),controller[_0x8575('0xd')]);router[_0x8575('0x6')]('/:id/query',auth[_0x8575('0x7')](),controller[_0x8575('0xe')]);router[_0x8575('0xf')]('/',auth[_0x8575('0x7')](),controller['create']);router[_0x8575('0x10')](_0x8575('0x11'),auth[_0x8575('0x7')](),controller[_0x8575('0x12')]);router[_0x8575('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x8575('0x14')]);module[_0x8575('0x15')]=router; \ No newline at end of file +var _0x2d1f=['./analyticCustomReport.controller','get','isAuthenticated','index','show','preview','run','query','put','/:id','update','delete','exports','multer','util','path','express','Router'];(function(_0x584df7,_0x4a1286){var _0x1214e4=function(_0x5083c1){while(--_0x5083c1){_0x584df7['push'](_0x584df7['shift']());}};_0x1214e4(++_0x4a1286);}(_0x2d1f,0xf7));var _0xf2d1=function(_0x145c9b,_0x4be858){_0x145c9b=_0x145c9b-0x0;var _0x5efb94=_0x2d1f[_0x145c9b];return _0x5efb94;};'use strict';var multer=require(_0xf2d1('0x0'));var util=require(_0xf2d1('0x1'));var path=require(_0xf2d1('0x2'));var express=require(_0xf2d1('0x3'));var router=express[_0xf2d1('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf2d1('0x5'));router[_0xf2d1('0x6')]('/',auth[_0xf2d1('0x7')](),controller[_0xf2d1('0x8')]);router[_0xf2d1('0x6')]('/:id',auth[_0xf2d1('0x7')](),controller[_0xf2d1('0x9')]);router[_0xf2d1('0x6')]('/:id/preview',auth[_0xf2d1('0x7')](),controller[_0xf2d1('0xa')]);router[_0xf2d1('0x6')]('/:id/run',auth['isAuthenticated'](),controller[_0xf2d1('0xb')]);router['get']('/:id/query',auth[_0xf2d1('0x7')](),controller[_0xf2d1('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xf2d1('0xd')](_0xf2d1('0xe'),auth[_0xf2d1('0x7')](),controller[_0xf2d1('0xf')]);router[_0xf2d1('0x10')]('/:id',auth[_0xf2d1('0x7')](),controller['destroy']);module[_0xf2d1('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 60e4b20..e7322f7 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 _0x76bb=['STRING','TEXT','sequelize','exports'];(function(_0x3e9e1d,_0x22c726){var _0x41eab5=function(_0x31c65d){while(--_0x31c65d){_0x3e9e1d['push'](_0x3e9e1d['shift']());}};_0x41eab5(++_0x22c726);}(_0x76bb,0xe6));var _0xb76b=function(_0x87506e,_0x5680ec){_0x87506e=_0x87506e-0x0;var _0x5496a4=_0x76bb[_0x87506e];return _0x5496a4;};'use strict';var Sequelize=require(_0xb76b('0x0'));module[_0xb76b('0x1')]={'name':{'type':Sequelize[_0xb76b('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xb76b('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xb76b('0x3')]},'joins':{'type':Sequelize[_0xb76b('0x3')]}}; \ No newline at end of file +var _0x0f1b=['exports','STRING','TEXT','sequelize'];(function(_0x51a182,_0x5639a7){var _0x46aa3e=function(_0x287abb){while(--_0x287abb){_0x51a182['push'](_0x51a182['shift']());}};_0x46aa3e(++_0x5639a7);}(_0x0f1b,0xc7));var _0xb0f1=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x0f1b[_0x341e0f];return _0x59555a;};'use strict';var Sequelize=require(_0xb0f1('0x0'));module[_0xb0f1('0x1')]={'name':{'type':Sequelize[_0xb0f1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb0f1('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb0f1('0x2')]},'conditions':{'type':Sequelize[_0xb0f1('0x3')]},'joins':{'type':Sequelize[_0xb0f1('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 0ef2f37..a8e03cf 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 _0x00ca=['alias','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','left_join','outer_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','IS\x20EMPTY','IS\x20NOT\x20EMPTY','value','getFields','keyBy','table','metric','SELECT','No\x20Data!','output','web','fullPath','name','generate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','fork','../../components/export/','savename','countTable','COUNT(*)','runReport','DESC','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/parsers/qs','../../config/utils','sendStatus','status','end','json','count','offset','apply','reject','destroy','then','error','stack','send','index','AnalyticDefaultReport','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','add','merge','where','filter','map','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','preview','join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','Sequelize','ValidationError','Please\x20insert\x20at\x20least\x20one\x20field!','AnalyticMetric','select','from','MetricId','function','replace','format','groupBy','orderBy'];(function(_0x3043dd,_0x570cd5){var _0x4b4032=function(_0x71001e){while(--_0x71001e){_0x3043dd['push'](_0x3043dd['shift']());}};_0x4b4032(++_0x570cd5);}(_0x00ca,0x1df));var _0xa00c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x00ca[_0x3947c9];return _0x2e7871;};'use strict';var jsonpatch=require(_0xa00c('0x0'));var rp=require('request-promise');var moment=require(_0xa00c('0x1'));var BPromise=require(_0xa00c('0x2'));var Mustache=require(_0xa00c('0x3'));var util=require(_0xa00c('0x4'));var path=require(_0xa00c('0x5'));var sox=require(_0xa00c('0x6'));var csv=require(_0xa00c('0x7'));var ejs=require(_0xa00c('0x8'));var fs=require('fs');var _=require(_0xa00c('0x9'));var squel=require(_0xa00c('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa00c('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa00c('0xc'));var Papa=require('papaparse');var qs=require(_0xa00c('0xd'));var logger=require('../../config/logger')('api');var utils=require(_0xa00c('0xe'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c9748,_0x262da3){_0x262da3=_0x262da3||0xcc;return function(_0x2117a6){if(_0x2117a6){return _0x1c9748[_0xa00c('0xf')](_0x262da3);}return _0x1c9748[_0xa00c('0x10')](_0x262da3)[_0xa00c('0x11')]();};}function respondWithResult(_0x2ec017,_0x17414f){_0x17414f=_0x17414f||0xc8;return function(_0x4614a1){if(_0x4614a1){return _0x2ec017[_0xa00c('0x10')](_0x17414f)[_0xa00c('0x12')](_0x4614a1);}};}function respondWithFilteredResult(_0x5356ff,_0x1b698e){return function(_0x4baeaf){if(_0x4baeaf){var _0x34b9c8=_0x4baeaf[_0xa00c('0x13')],_0x1f48a8=_0x1b698e[_0xa00c('0x14')],_0x23e0f8=_0x1b698e[_0xa00c('0x14')]+_0x1b698e['limit'],_0xfe7845;if(_0x23e0f8>=_0x34b9c8){_0x23e0f8=_0x34b9c8;_0xfe7845=0xc8;}else{_0xfe7845=0xce;}_0x5356ff['status'](_0xfe7845);return _0x5356ff['set']('Content-Range',_0x1f48a8+'-'+_0x23e0f8+'/'+_0x34b9c8)[_0xa00c('0x12')](_0x4baeaf);}return null;};}function patchUpdates(_0x223005){return function(_0x3bd175){try{jsonpatch[_0xa00c('0x15')](_0x3bd175,_0x223005,!![]);}catch(_0x5740d1){return BPromise[_0xa00c('0x16')](_0x5740d1);}return _0x3bd175['save']();};}function saveUpdates(_0x9d39e4,_0x5dfa65){return function(_0x52ed74){if(_0x52ed74){return _0x52ed74['update'](_0x9d39e4)['then'](function(_0x371924){return _0x371924;});}return null;};}function removeEntity(_0x3187e8,_0x31cf34){return function(_0x42c8bf){if(_0x42c8bf){return _0x42c8bf[_0xa00c('0x17')]()[_0xa00c('0x18')](function(){_0x3187e8[_0xa00c('0x10')](0xcc)[_0xa00c('0x11')]();});}};}function handleEntityNotFound(_0x176d43,_0x500750){return function(_0x4125ad){if(!_0x4125ad){_0x176d43[_0xa00c('0xf')](0x194);}return _0x4125ad;};}function handleError(_0x356abb,_0x1e8de4){_0x1e8de4=_0x1e8de4||0x1f4;return function(_0x4c1b9a){logger[_0xa00c('0x19')](_0x4c1b9a[_0xa00c('0x1a')]);if(_0x4c1b9a['name']){delete _0x4c1b9a['name'];}_0x356abb[_0xa00c('0x10')](_0x1e8de4)[_0xa00c('0x1b')](_0x4c1b9a);};}exports[_0xa00c('0x1c')]=function(_0x1d23bd,_0x235c86){var _0x5401b2={},_0x24018c={},_0x57f306={'count':0x0,'rows':[]};var _0x113190=db[_0xa00c('0x1d')][_0xa00c('0x1e')];_0x24018c['model']=_[_0xa00c('0x1f')](_0x113190);var _0x5375a8={'dateStart':_0x1d23bd[_0xa00c('0x20')][_0xa00c('0x21')],'dateEnd':_0x1d23bd[_0xa00c('0x20')][_0xa00c('0x22')]};delete _0x1d23bd[_0xa00c('0x20')][_0xa00c('0x21')];delete _0x1d23bd[_0xa00c('0x20')][_0xa00c('0x22')];_0x24018c[_0xa00c('0x20')]=_['keys'](_0x1d23bd[_0xa00c('0x20')]);_0x24018c[_0xa00c('0x23')]=_[_0xa00c('0x24')](_0x24018c['model'],_0x24018c[_0xa00c('0x20')]);_0x5401b2[_0xa00c('0x25')]=_['intersection'](_0x24018c[_0xa00c('0x26')],qs[_0xa00c('0x27')](_0x1d23bd[_0xa00c('0x20')][_0xa00c('0x27')]));_0x5401b2['attributes']=_0x5401b2[_0xa00c('0x25')][_0xa00c('0x28')]?_0x5401b2[_0xa00c('0x25')]:_0x24018c[_0xa00c('0x26')];if(!_0x1d23bd[_0xa00c('0x20')][_0xa00c('0x29')](_0xa00c('0x2a'))){_0x5401b2[_0xa00c('0x2b')]=qs[_0xa00c('0x2b')](_0x1d23bd[_0xa00c('0x20')][_0xa00c('0x2b')]);_0x5401b2['offset']=qs[_0xa00c('0x14')](_0x1d23bd[_0xa00c('0x20')][_0xa00c('0x14')]);}_0x5401b2[_0xa00c('0x2c')]=qs[_0xa00c('0x2d')](_0x1d23bd['query'][_0xa00c('0x2d')]);_0x5401b2['where']=qs[_0xa00c('0x23')](_['pick'](_0x1d23bd[_0xa00c('0x20')],_0x24018c['filters']));if(_0x5375a8[_0xa00c('0x21')]){if(_0x5375a8[_0xa00c('0x22')]){_0x5375a8['dateEnd']=moment(_0x5375a8['dateEnd'])[_0xa00c('0x2e')](0x1,'day');}else{_0x5375a8[_0xa00c('0x22')]=moment(_0x5375a8['dateStart'])[_0xa00c('0x2e')](0x1,'day');}_[_0xa00c('0x2f')](_0x5401b2[_0xa00c('0x30')],{'createdAt':{'$gte':_0x5375a8[_0xa00c('0x21')],'$lte':_0x5375a8[_0xa00c('0x22')]}});}if(_0x1d23bd[_0xa00c('0x20')][_0xa00c('0x31')]){_0x5401b2['where']=_['merge'](_0x5401b2[_0xa00c('0x30')],{'$or':_[_0xa00c('0x32')](_0x5401b2[_0xa00c('0x25')],function(_0x28f648){var _0x50dced={};_0x50dced[_0x28f648]={'$like':'%'+_0x1d23bd[_0xa00c('0x20')][_0xa00c('0x31')]+'%'};return _0x50dced;})});}_0x5401b2=_[_0xa00c('0x2f')]({},_0x5401b2,_0x1d23bd[_0xa00c('0x33')]);var _0x1516d5={'where':_0x5401b2[_0xa00c('0x30')]};return db['AnalyticDefaultReport'][_0xa00c('0x13')](_0x1516d5)[_0xa00c('0x18')](function(_0x5dacca){_0x57f306[_0xa00c('0x13')]=_0x5dacca;if(_0x1d23bd[_0xa00c('0x20')][_0xa00c('0x34')]){_0x5401b2[_0xa00c('0x35')]=[{'all':!![]}];}return db[_0xa00c('0x1d')][_0xa00c('0x36')](_0x5401b2);})[_0xa00c('0x18')](function(_0x3cdc6b){_0x57f306[_0xa00c('0x37')]=_0x3cdc6b;return _0x57f306;})[_0xa00c('0x18')](respondWithFilteredResult(_0x235c86,_0x5401b2))[_0xa00c('0x38')](handleError(_0x235c86,null));};exports[_0xa00c('0x39')]=function(_0x1690b0,_0xed534){var _0x39358c={'raw':!![],'where':{'id':_0x1690b0[_0xa00c('0x3a')]['id']}},_0xc351d2={};_0xc351d2[_0xa00c('0x26')]=_[_0xa00c('0x1f')](db['AnalyticDefaultReport'][_0xa00c('0x1e')]);_0xc351d2[_0xa00c('0x20')]=_[_0xa00c('0x1f')](_0x1690b0[_0xa00c('0x20')]);_0xc351d2[_0xa00c('0x23')]=_[_0xa00c('0x24')](_0xc351d2[_0xa00c('0x26')],_0xc351d2[_0xa00c('0x20')]);_0x39358c[_0xa00c('0x25')]=_[_0xa00c('0x24')](_0xc351d2[_0xa00c('0x26')],qs[_0xa00c('0x27')](_0x1690b0[_0xa00c('0x20')][_0xa00c('0x27')]));_0x39358c[_0xa00c('0x25')]=_0x39358c[_0xa00c('0x25')][_0xa00c('0x28')]?_0x39358c['attributes']:_0xc351d2[_0xa00c('0x26')];if(_0x1690b0[_0xa00c('0x20')]['includeAll']){_0x39358c['include']=[{'all':!![]}];}_0x39358c=_[_0xa00c('0x2f')]({},_0x39358c,_0x1690b0['options']);return db[_0xa00c('0x1d')][_0xa00c('0x3b')](_0x39358c)[_0xa00c('0x18')](handleEntityNotFound(_0xed534,null))[_0xa00c('0x18')](respondWithResult(_0xed534,null))[_0xa00c('0x38')](handleError(_0xed534,null));};exports[_0xa00c('0x3c')]=function(_0x45a0b1,_0x38929f){return db['AnalyticDefaultReport'][_0xa00c('0x3c')](_0x45a0b1[_0xa00c('0x3d')],{})[_0xa00c('0x18')](respondWithResult(_0x38929f,0xc9))[_0xa00c('0x38')](handleError(_0x38929f,null));};exports[_0xa00c('0x3e')]=function(_0x1a0fab,_0x51c1b0){if(_0x1a0fab[_0xa00c('0x3d')]['id']){delete _0x1a0fab[_0xa00c('0x3d')]['id'];}return db['AnalyticDefaultReport'][_0xa00c('0x3b')]({'where':{'id':_0x1a0fab[_0xa00c('0x3a')]['id']}})[_0xa00c('0x18')](handleEntityNotFound(_0x51c1b0,null))[_0xa00c('0x18')](saveUpdates(_0x1a0fab[_0xa00c('0x3d')],null))[_0xa00c('0x18')](respondWithResult(_0x51c1b0,null))[_0xa00c('0x38')](handleError(_0x51c1b0,null));};exports['destroy']=function(_0x18ef43,_0x117010){return db[_0xa00c('0x1d')]['find']({'where':{'id':_0x18ef43[_0xa00c('0x3a')]['id']}})[_0xa00c('0x18')](handleEntityNotFound(_0x117010,null))[_0xa00c('0x18')](removeEntity(_0x117010,null))[_0xa00c('0x38')](handleError(_0x117010,null));};exports[_0xa00c('0x3f')]=function(_0x592acc,_0x1b3828){var _0x3f8c8b=0xa;var _0x4aa061=[_0xa00c('0x40'),'left_join',_0xa00c('0x41'),'outer_join','cross_join'];var _0x2b6a7b={'SUM':'SUM(%s)','COUNT':_0xa00c('0x42'),'COUNT DISTINCT':_0xa00c('0x43'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xa00c('0x44'),'GROUP_CONCAT':_0xa00c('0x45'),'GROUP_CONCAT ASC':_0xa00c('0x46'),'GROUP_CONCAT DESC':_0xa00c('0x47')};var _0x3a07fa={'SEC_TO_TIME':_0xa00c('0x48'),'DATE':_0xa00c('0x49'),'HOUR':_0xa00c('0x4a'),'ROUND':_0xa00c('0x4b'),'UNIX_TIMESTAMP':_0xa00c('0x4c')};var _0x20fb93=function(_0x4c23b5){return!_[_0xa00c('0x4d')]([_0xa00c('0x4e'),_0xa00c('0x4f'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x4c23b5);};var _0x50bb13=function(_0x55e902){if(!_0x55e902||!_0x55e902[_0xa00c('0x50')][_0xa00c('0x28')]){return'';}for(var _0x5997fe='(',_0x518588=0x0;_0x518588<_0x55e902[_0xa00c('0x50')]['length'];_0x518588+=0x1){_0x518588>0x0&&(_0x5997fe+='\x20'+_0x55e902[_0xa00c('0x51')]+'\x20');_0x5997fe+=_0x55e902['rules'][_0x518588][_0xa00c('0x52')]?_0x50bb13(_0x55e902[_0xa00c('0x50')][_0x518588][_0xa00c('0x52')]):_0x55e902[_0xa00c('0x50')][_0x518588][_0xa00c('0x53')]+'\x20'+_0x55e902['rules'][_0x518588][_0xa00c('0x54')]+(_0x20fb93(_0x55e902['rules'][_0x518588][_0xa00c('0x54')])?'\x20'+_0x55e902[_0xa00c('0x50')][_0x518588]['value']:'');}return _0x5997fe+')';};var _0x4d4220={'where':{'id':_0x592acc[_0xa00c('0x3a')]['id']}},_0x2ebef6,_0x569a2b,_0x49555b,_0x1df11b,_0x52849d;_0x4d4220=_[_0xa00c('0x2f')]({},_0x4d4220,_0x592acc['options']);return db['AnalyticDefaultReport'][_0xa00c('0x3b')](_0x4d4220)[_0xa00c('0x18')](function(_0x3287d3){if(_0x3287d3){_0x2ebef6=_0x3287d3;return _0x3287d3['getFields']();}return null;})[_0xa00c('0x18')](function(_0x3b17b8){if(_0x3b17b8){if(!_0x3b17b8[_0xa00c('0x28')]){throw new db[(_0xa00c('0x55'))][(_0xa00c('0x56'))](_0xa00c('0x57'));}_0x569a2b=_0x3b17b8;return db[_0xa00c('0x58')][_0xa00c('0x36')]({'raw':!![]});}return null;})['then'](function(_0xef9bf1){if(_0xef9bf1){_0x49555b=_['keyBy'](_0xef9bf1,'id');var _0x4d6c96;var _0x240f2c=squel[_0xa00c('0x59')]();_0x240f2c[_0xa00c('0x5a')](_0x2ebef6['table']);for(var _0x3136a7=0x0;_0x3136a7<_0x569a2b[_0xa00c('0x28')];_0x3136a7+=0x1){_0x4d6c96=_0x569a2b[_0x3136a7][_0xa00c('0x5b')]?_0x49555b[_0x569a2b[_0x3136a7][_0xa00c('0x5b')]]['metric']:_0x569a2b[_0x3136a7]['field'];_0x4d6c96=_0x569a2b[_0x3136a7][_0xa00c('0x5c')]?_[_0xa00c('0x5d')](_0x2b6a7b[_0x569a2b[_0x3136a7][_0xa00c('0x5c')]],'%s',_0x4d6c96):_0x4d6c96;_0x4d6c96=_0x569a2b[_0x3136a7][_0xa00c('0x5e')]?_[_0xa00c('0x5d')](_0x3a07fa[_0x569a2b[_0x3136a7]['format']],'%s',_0x4d6c96):_0x4d6c96;if(_0x569a2b[_0x3136a7][_0xa00c('0x5f')]){_0x240f2c[_0xa00c('0x52')](_0x4d6c96);}_0x569a2b[_0x3136a7]['orderBy']&&_0x240f2c[_0xa00c('0x2c')](_0x4d6c96,_0x569a2b[_0x3136a7][_0xa00c('0x60')]==='DESC'?![]:!![]);_0x240f2c[_0xa00c('0x53')](_0x4d6c96,_0x569a2b[_0x3136a7][_0xa00c('0x61')]||_0x4d6c96);}if(_0x2ebef6[_0xa00c('0x62')]){_0x2ebef6[_0xa00c('0x62')]=JSON[_0xa00c('0x63')](_0x2ebef6['joins']);for(var _0x252986=0x0;_0x252986<_0x2ebef6[_0xa00c('0x62')][_0xa00c('0x28')];_0x252986+=0x1){if(_0x2ebef6[_0xa00c('0x62')][_0x252986]['type']&&_[_0xa00c('0x4d')](_0x4aa061,_0x2ebef6[_0xa00c('0x62')][_0x252986][_0xa00c('0x64')])&&_0x2ebef6[_0xa00c('0x62')][_0x252986][_0xa00c('0x65')]&&_0x2ebef6[_0xa00c('0x62')][_0x252986][_0xa00c('0x66')]&&_0x2ebef6[_0xa00c('0x62')][_0x252986][_0xa00c('0x67')]){_0x240f2c[_0x2ebef6[_0xa00c('0x62')][_0x252986][_0xa00c('0x64')]](_0x2ebef6[_0xa00c('0x62')][_0x252986][_0xa00c('0x66')],null,util['format'](_0xa00c('0x68'),_0x2ebef6['table'],_0x2ebef6[_0xa00c('0x62')][_0x252986][_0xa00c('0x65')],_0x2ebef6[_0xa00c('0x62')][_0x252986][_0xa00c('0x66')],_0x2ebef6[_0xa00c('0x62')][_0x252986][_0xa00c('0x67')]));}}}if(_0x2ebef6[_0xa00c('0x69')]){_0x2ebef6[_0xa00c('0x69')]=JSON['parse'](_0x2ebef6[_0xa00c('0x69')]);_0x240f2c[_0xa00c('0x30')](_0x50bb13(_0x2ebef6[_0xa00c('0x69')][_0xa00c('0x52')]));}_0x52849d=_0x240f2c[_0xa00c('0x6a')]();_0x240f2c[_0xa00c('0x2b')](_0x3f8c8b);_0x240f2c[_0xa00c('0x14')](0x0);logger[_0xa00c('0x6b')](_0xa00c('0x6c'),_0x240f2c['toString']());return db[_0xa00c('0x6d')][_0xa00c('0x20')](_0x240f2c[_0xa00c('0x6e')](),{'type':db[_0xa00c('0x6d')][_0xa00c('0x6f')]['SELECT']});}})[_0xa00c('0x18')](respondWithResult(_0x1b3828,null))[_0xa00c('0x38')](handleError(_0x1b3828,null));};function runReport(_0x44f7b8,_0x3b8d39,_0x3cba49){var _0x318f11=_0x3b8d39['name'];var _0x5889d3=0xa;var _0x4352e9=[_0xa00c('0x40'),_0xa00c('0x70'),_0xa00c('0x41'),_0xa00c('0x71'),_0xa00c('0x72')];var _0x4cb123={'SUM':_0xa00c('0x73'),'COUNT':_0xa00c('0x42'),'COUNT DISTINCT':_0xa00c('0x43'),'MAX':_0xa00c('0x74'),'MIN':_0xa00c('0x75'),'AVG':_0xa00c('0x44'),'GROUP_CONCAT':_0xa00c('0x45'),'GROUP_CONCAT ASC':_0xa00c('0x46'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3ba6e2={'SEC_TO_TIME':_0xa00c('0x48'),'DATE':_0xa00c('0x49'),'HOUR':_0xa00c('0x4a'),'ROUND':_0xa00c('0x4b'),'UNIX_TIMESTAMP':_0xa00c('0x4c')};var _0x2dba6e=function(_0x283c0b){return!_[_0xa00c('0x4d')](['IS\x20NULL',_0xa00c('0x4f'),_0xa00c('0x76'),_0xa00c('0x77')],_0x283c0b);};var _0x375530=function(_0x2875c4){if(!_0x2875c4||!_0x2875c4[_0xa00c('0x50')][_0xa00c('0x28')]){return'';}for(var _0x1f672c='(',_0x33d4cf=0x0;_0x33d4cf<_0x2875c4[_0xa00c('0x50')][_0xa00c('0x28')];_0x33d4cf+=0x1){_0x33d4cf>0x0&&(_0x1f672c+='\x20'+_0x2875c4[_0xa00c('0x51')]+'\x20');_0x1f672c+=_0x2875c4[_0xa00c('0x50')][_0x33d4cf][_0xa00c('0x52')]?_0x375530(_0x2875c4['rules'][_0x33d4cf][_0xa00c('0x52')]):_0x2875c4[_0xa00c('0x50')][_0x33d4cf]['field']+'\x20'+_0x2875c4['rules'][_0x33d4cf]['condition']+(_0x2dba6e(_0x2875c4[_0xa00c('0x50')][_0x33d4cf]['condition'])?'\x20'+_0x2875c4[_0xa00c('0x50')][_0x33d4cf][_0xa00c('0x78')]:'');}return _0x1f672c+')';};var _0x375771={'where':{'id':_0x44f7b8['id']}},_0x585f02,_0x3dc94e,_0x1a4b38,_0x25c495,_0x3e5862;_0x375771=_['merge']({},_0x375771,_0x3cba49);return db[_0xa00c('0x1d')][_0xa00c('0x3b')](_0x375771)[_0xa00c('0x18')](function(_0x33276f){if(_0x33276f){_0x585f02=_0x33276f;return _0x33276f[_0xa00c('0x79')]();}return null;})[_0xa00c('0x18')](function(_0x288a5f){if(_0x288a5f){if(!_0x288a5f[_0xa00c('0x28')]){throw new db[(_0xa00c('0x55'))][(_0xa00c('0x56'))]('Please\x20insert\x20at\x20least\x20one\x20field!');}_0x3dc94e=_0x288a5f;return db[_0xa00c('0x58')][_0xa00c('0x36')]({'raw':!![]});}return null;})[_0xa00c('0x18')](function(_0x7ae992){if(_0x7ae992){_0x1a4b38=_[_0xa00c('0x7a')](_0x7ae992,'id');var _0x45bef8;var _0x4729da=squel[_0xa00c('0x59')]();_0x4729da[_0xa00c('0x5a')](_0x585f02[_0xa00c('0x7b')]);for(var _0x271c95=0x0;_0x271c95<_0x3dc94e['length'];_0x271c95+=0x1){_0x45bef8=_0x3dc94e[_0x271c95][_0xa00c('0x5b')]?_0x1a4b38[_0x3dc94e[_0x271c95][_0xa00c('0x5b')]][_0xa00c('0x7c')]:_0x3dc94e[_0x271c95][_0xa00c('0x53')];_0x45bef8=_0x3dc94e[_0x271c95][_0xa00c('0x5c')]?_[_0xa00c('0x5d')](_0x4cb123[_0x3dc94e[_0x271c95][_0xa00c('0x5c')]],'%s',_0x45bef8):_0x45bef8;_0x45bef8=_0x3dc94e[_0x271c95][_0xa00c('0x5e')]?_[_0xa00c('0x5d')](_0x3ba6e2[_0x3dc94e[_0x271c95][_0xa00c('0x5e')]],'%s',_0x45bef8):_0x45bef8;if(_0x3dc94e[_0x271c95][_0xa00c('0x5f')]){_0x4729da['group'](_0x45bef8);}_0x3dc94e[_0x271c95]['orderBy']&&_0x4729da['order'](_0x45bef8,_0x3dc94e[_0x271c95][_0xa00c('0x60')]==='DESC'?![]:!![]);_0x4729da[_0xa00c('0x53')](_0x45bef8,_0x3dc94e[_0x271c95][_0xa00c('0x61')]||_0x45bef8);}if(_0x585f02[_0xa00c('0x62')]){_0x585f02['joins']=JSON['parse'](_0x585f02['joins']);for(var _0x119b74=0x0;_0x119b74<_0x585f02[_0xa00c('0x62')][_0xa00c('0x28')];_0x119b74+=0x1){if(_0x585f02['joins'][_0x119b74][_0xa00c('0x64')]&&_[_0xa00c('0x4d')](_0x4352e9,_0x585f02[_0xa00c('0x62')][_0x119b74][_0xa00c('0x64')])&&_0x585f02[_0xa00c('0x62')][_0x119b74][_0xa00c('0x65')]&&_0x585f02[_0xa00c('0x62')][_0x119b74]['foreignTable']&&_0x585f02[_0xa00c('0x62')][_0x119b74]['foreignKey']){_0x4729da[_0x585f02[_0xa00c('0x62')][_0x119b74][_0xa00c('0x64')]](_0x585f02[_0xa00c('0x62')][_0x119b74][_0xa00c('0x66')],null,util[_0xa00c('0x5e')](_0xa00c('0x68'),_0x585f02[_0xa00c('0x7b')],_0x585f02[_0xa00c('0x62')][_0x119b74][_0xa00c('0x65')],_0x585f02[_0xa00c('0x62')][_0x119b74][_0xa00c('0x66')],_0x585f02[_0xa00c('0x62')][_0x119b74]['foreignKey']));}}}if(_0x585f02[_0xa00c('0x69')]){_0x585f02[_0xa00c('0x69')]=JSON[_0xa00c('0x63')](_0x585f02['conditions']);_0x4729da[_0xa00c('0x30')](_0x375530(_0x585f02[_0xa00c('0x69')][_0xa00c('0x52')]));}_0x3e5862=_0x4729da['clone']();_0x4729da['limit'](_0x5889d3);_0x4729da[_0xa00c('0x14')](0x0);logger[_0xa00c('0x6b')](_0xa00c('0x6c'),_0x4729da[_0xa00c('0x6e')]());return db['sequelize'][_0xa00c('0x20')](_0x4729da[_0xa00c('0x6e')](),{'type':db['sequelize']['QueryTypes'][_0xa00c('0x7d')]});}})['then'](function(_0x203340){if(!_0x203340[_0xa00c('0x28')]){throw new db[(_0xa00c('0x55'))][(_0xa00c('0x56'))](_0xa00c('0x7e'));}if(_0x3b8d39[_0xa00c('0x7f')]===_0xa00c('0x80')){return null;}var _0x1ed659=_[_0xa00c('0x2f')](_0x3b8d39,{'name':_0x3b8d39[_0xa00c('0x81')]||_0x3b8d39[_0xa00c('0x82')]||_0x585f02[_0xa00c('0x82')],'basename':_0x318f11,'savename':util[_0xa00c('0x5e')]('%s-%s.%s',_0x3b8d39[_0xa00c('0x82')]||_0x585f02[_0xa00c('0x82')],require('randomstring')[_0xa00c('0x83')](0x4),_0x3b8d39[_0xa00c('0x7f')]||'csv')});return db['AnalyticExtractedReport']['create'](_0x1ed659,{'raw':!![]});})[_0xa00c('0x18')](function(_0x4e8ffc){_0x3e5862[_0xa00c('0x30')](_0x585f02['table']+_0xa00c('0x84'),_0x3b8d39[_0xa00c('0x85')],_0x3b8d39[_0xa00c('0x86')]);if(_0x4e8ffc){logger[_0xa00c('0x87')](_0xa00c('0x88'),_0x3e5862[_0xa00c('0x6e')]());require('child_process')[_0xa00c('0x89')](path[_0xa00c('0x40')](__dirname,_0xa00c('0x8a'),_0x4e8ffc['output']),[_0x4e8ffc['id'],_0x3e5862[_0xa00c('0x6e')](),path[_0xa00c('0x40')](__dirname,'../../files/reports',_0x4e8ffc[_0xa00c('0x8b')]),_0x318f11]);return _0x4e8ffc;}else{var _0x10617a=squel['select']();_0x10617a[_0xa00c('0x5a')]('('+_0x3e5862['toString']()+')',_0xa00c('0x8c'));_0x10617a['field'](_0xa00c('0x8d'),_0xa00c('0x13'));_0x3e5862[_0xa00c('0x2b')](_0x3b8d39['limit']||_0x5889d3);_0x3e5862[_0xa00c('0x14')](_0x3b8d39[_0xa00c('0x14')]||0x0);return db['sequelize'][_0xa00c('0x20')](_0x10617a[_0xa00c('0x6e')](),{'type':db[_0xa00c('0x6d')]['QueryTypes']['SELECT']})[_0xa00c('0x18')](function(_0xbb47c2){if(!_0xbb47c2['length']){_0x25c495=0x0;}else{_0x25c495=_0xbb47c2[0x0]['count']||0x0;}return db['sequelize'][_0xa00c('0x20')](_0x3e5862['toString'](),{'type':db[_0xa00c('0x6d')][_0xa00c('0x6f')][_0xa00c('0x7d')]});})[_0xa00c('0x18')](function(_0x2a749){return{'rows':_0x2a749||[],'count':_0x25c495};});}});}exports['run']=function(_0x4c4ce5,_0xb672c2){return runReport(_0x4c4ce5[_0xa00c('0x3a')],_0x4c4ce5['query'],_0x4c4ce5['options'])[_0xa00c('0x18')](respondWithResult(_0xb672c2,null))[_0xa00c('0x38')](handleError(_0xb672c2,null));};exports[_0xa00c('0x8e')]=runReport;exports[_0xa00c('0x20')]=function(_0x59ba8f,_0x2ffa2f){var _0xbbfdb7=0xa;var _0x53b53c=[_0xa00c('0x40'),_0xa00c('0x70'),'right_join','outer_join',_0xa00c('0x72')];var _0x1ed7d6={'SUM':'SUM(%s)','COUNT':_0xa00c('0x42'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xa00c('0x75'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xa00c('0x45'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xa00c('0x47')};var _0x253f9a={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xa00c('0x49'),'HOUR':_0xa00c('0x4a'),'ROUND':_0xa00c('0x4b'),'UNIX_TIMESTAMP':_0xa00c('0x4c')};var _0x36b1f1=function(_0x593bd3){return!_[_0xa00c('0x4d')](['IS\x20NULL',_0xa00c('0x4f'),'IS\x20EMPTY',_0xa00c('0x77')],_0x593bd3);};var _0x32d607=function(_0x1ada8f){if(!_0x1ada8f||!_0x1ada8f['rules'][_0xa00c('0x28')]){return'';}for(var _0x512503='(',_0x1e64e0=0x0;_0x1e64e0<_0x1ada8f[_0xa00c('0x50')][_0xa00c('0x28')];_0x1e64e0+=0x1){_0x1e64e0>0x0&&(_0x512503+='\x20'+_0x1ada8f[_0xa00c('0x51')]+'\x20');_0x512503+=_0x1ada8f['rules'][_0x1e64e0][_0xa00c('0x52')]?_0x32d607(_0x1ada8f[_0xa00c('0x50')][_0x1e64e0]['group']):_0x1ada8f[_0xa00c('0x50')][_0x1e64e0][_0xa00c('0x53')]+'\x20'+_0x1ada8f[_0xa00c('0x50')][_0x1e64e0][_0xa00c('0x54')]+(_0x36b1f1(_0x1ada8f['rules'][_0x1e64e0]['condition'])?'\x20'+_0x1ada8f[_0xa00c('0x50')][_0x1e64e0][_0xa00c('0x78')]:'');}return _0x512503+')';};var _0x1d6b31={'where':{'id':_0x59ba8f[_0xa00c('0x3a')]['id']}},_0x5e7b33,_0x1b782c,_0x50525c,_0x26fd9b,_0x58fd5d;_0x1d6b31=_[_0xa00c('0x2f')]({},_0x1d6b31,_0x59ba8f['options']);return db[_0xa00c('0x1d')]['find'](_0x1d6b31)[_0xa00c('0x18')](function(_0x1fe42d){if(_0x1fe42d){_0x5e7b33=_0x1fe42d;return _0x1fe42d[_0xa00c('0x79')]();}return null;})[_0xa00c('0x18')](function(_0xc6dc67){if(_0xc6dc67){if(!_0xc6dc67[_0xa00c('0x28')]){throw new db[(_0xa00c('0x55'))][(_0xa00c('0x56'))](_0xa00c('0x57'));}_0x1b782c=_0xc6dc67;return db[_0xa00c('0x58')][_0xa00c('0x36')]({'raw':!![]});}return null;})['then'](function(_0x4f3cad){if(_0x4f3cad){_0x50525c=_[_0xa00c('0x7a')](_0x4f3cad,'id');var _0x3d9def;var _0x4368b1=squel['select']();_0x4368b1[_0xa00c('0x5a')](_0x5e7b33[_0xa00c('0x7b')]);for(var _0x487d16=0x0;_0x487d16<_0x1b782c[_0xa00c('0x28')];_0x487d16+=0x1){_0x3d9def=_0x1b782c[_0x487d16][_0xa00c('0x5b')]?_0x50525c[_0x1b782c[_0x487d16][_0xa00c('0x5b')]]['metric']:_0x1b782c[_0x487d16][_0xa00c('0x53')];_0x3d9def=_0x1b782c[_0x487d16][_0xa00c('0x5c')]?_[_0xa00c('0x5d')](_0x1ed7d6[_0x1b782c[_0x487d16][_0xa00c('0x5c')]],'%s',_0x3d9def):_0x3d9def;_0x3d9def=_0x1b782c[_0x487d16]['format']?_[_0xa00c('0x5d')](_0x253f9a[_0x1b782c[_0x487d16][_0xa00c('0x5e')]],'%s',_0x3d9def):_0x3d9def;if(_0x1b782c[_0x487d16]['groupBy']){_0x4368b1[_0xa00c('0x52')](_0x3d9def);}_0x1b782c[_0x487d16]['orderBy']&&_0x4368b1['order'](_0x3d9def,_0x1b782c[_0x487d16][_0xa00c('0x60')]===_0xa00c('0x8f')?![]:!![]);_0x4368b1[_0xa00c('0x53')](_0x3d9def,_0x1b782c[_0x487d16]['alias']||_0x3d9def);}if(_0x5e7b33['joins']){_0x5e7b33[_0xa00c('0x62')]=JSON[_0xa00c('0x63')](_0x5e7b33[_0xa00c('0x62')]);for(var _0x312f8b=0x0;_0x312f8b<_0x5e7b33[_0xa00c('0x62')]['length'];_0x312f8b+=0x1){if(_0x5e7b33['joins'][_0x312f8b]['type']&&_['includes'](_0x53b53c,_0x5e7b33[_0xa00c('0x62')][_0x312f8b][_0xa00c('0x64')])&&_0x5e7b33[_0xa00c('0x62')][_0x312f8b][_0xa00c('0x65')]&&_0x5e7b33[_0xa00c('0x62')][_0x312f8b][_0xa00c('0x66')]&&_0x5e7b33[_0xa00c('0x62')][_0x312f8b][_0xa00c('0x67')]){_0x4368b1[_0x5e7b33[_0xa00c('0x62')][_0x312f8b][_0xa00c('0x64')]](_0x5e7b33[_0xa00c('0x62')][_0x312f8b][_0xa00c('0x66')],null,util[_0xa00c('0x5e')](_0xa00c('0x68'),_0x5e7b33[_0xa00c('0x7b')],_0x5e7b33[_0xa00c('0x62')][_0x312f8b][_0xa00c('0x65')],_0x5e7b33[_0xa00c('0x62')][_0x312f8b][_0xa00c('0x66')],_0x5e7b33['joins'][_0x312f8b]['foreignKey']));}}}if(_0x5e7b33[_0xa00c('0x69')]){_0x5e7b33[_0xa00c('0x69')]=JSON[_0xa00c('0x63')](_0x5e7b33['conditions']);_0x4368b1[_0xa00c('0x30')](_0x32d607(_0x5e7b33[_0xa00c('0x69')][_0xa00c('0x52')]));}_0x58fd5d=_0x4368b1[_0xa00c('0x6a')]();_0x4368b1[_0xa00c('0x2b')](_0xbbfdb7);_0x4368b1[_0xa00c('0x14')](0x0);logger[_0xa00c('0x6b')](_0xa00c('0x6c'),_0x4368b1['toString']());return db['sequelize']['query'](_0x4368b1[_0xa00c('0x6e')](),{'type':db['sequelize'][_0xa00c('0x6f')]['SELECT']});}})[_0xa00c('0x18')](function(){return{'sql':_0x58fd5d['toString']()};})[_0xa00c('0x18')](respondWithResult(_0x2ffa2f,null))[_0xa00c('0x38')](handleError(_0x2ffa2f,null));}; \ No newline at end of file +var _0x4f01=['fields','length','hasOwnProperty','limit','sort','pick','add','day','merge','where','filter','options','includeAll','include','rows','catch','show','params','find','create','body','update','join','left_join','right_join','outer_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field!','AnalyticMetric','table','MetricId','replace','function','format','groupBy','orderBy','order','DESC','joins','parse','type','parentKey','foreignTable','foreignKey','conditions','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','MIN(%s)','IS\x20NOT\x20EMPTY','ValidationError','findAll','keyBy','from','%s.%s\x20=\x20%s.%s','clone','debug','No\x20Data!','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','info','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','runReport','HOUR(%s)','ROUND(%s)','select','metric','alias','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','end','error','name','send','index','AnalyticDefaultReport','rawAttributes','model','dateStart','query','dateEnd','keys','filters','intersection','attributes'];(function(_0x229072,_0xc26c4){var _0x1b094f=function(_0x3ffe45){while(--_0x3ffe45){_0x229072['push'](_0x229072['shift']());}};_0x1b094f(++_0xc26c4);}(_0x4f01,0x18e));var _0x14f0=function(_0x3b2f93,_0x225c85){_0x3b2f93=_0x3b2f93-0x0;var _0x104423=_0x4f01[_0x3b2f93];return _0x104423;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x14f0('0x0'));var moment=require(_0x14f0('0x1'));var BPromise=require(_0x14f0('0x2'));var Mustache=require(_0x14f0('0x3'));var util=require('util');var path=require(_0x14f0('0x4'));var sox=require(_0x14f0('0x5'));var csv=require(_0x14f0('0x6'));var ejs=require(_0x14f0('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x14f0('0x8'));var jsforce=require(_0x14f0('0x9'));var deskjs=require(_0x14f0('0xa'));var toCsv=require(_0x14f0('0x6'));var querystring=require(_0x14f0('0xb'));var Papa=require('papaparse');var qs=require(_0x14f0('0xc'));var logger=require(_0x14f0('0xd'))(_0x14f0('0xe'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x14f0('0xf'))['db'];function respondWithStatusCode(_0x7b76b,_0x5291d8){_0x5291d8=_0x5291d8||0xcc;return function(_0x35b213){if(_0x35b213){return _0x7b76b[_0x14f0('0x10')](_0x5291d8);}return _0x7b76b['status'](_0x5291d8)['end']();};}function respondWithResult(_0x221fc2,_0x3e840c){_0x3e840c=_0x3e840c||0xc8;return function(_0x61e854){if(_0x61e854){return _0x221fc2[_0x14f0('0x11')](_0x3e840c)['json'](_0x61e854);}};}function respondWithFilteredResult(_0x5b55a3,_0x682e25){return function(_0x239249){if(_0x239249){var _0xf8f75=_0x239249[_0x14f0('0x12')],_0x5bd6ba=_0x682e25[_0x14f0('0x13')],_0x4f2bb3=_0x682e25[_0x14f0('0x13')]+_0x682e25['limit'],_0x1a1eec;if(_0x4f2bb3>=_0xf8f75){_0x4f2bb3=_0xf8f75;_0x1a1eec=0xc8;}else{_0x1a1eec=0xce;}_0x5b55a3[_0x14f0('0x11')](_0x1a1eec);return _0x5b55a3[_0x14f0('0x14')](_0x14f0('0x15'),_0x5bd6ba+'-'+_0x4f2bb3+'/'+_0xf8f75)[_0x14f0('0x16')](_0x239249);}return null;};}function patchUpdates(_0x303d76){return function(_0x402a43){try{jsonpatch[_0x14f0('0x17')](_0x402a43,_0x303d76,!![]);}catch(_0x32ebc7){return BPromise[_0x14f0('0x18')](_0x32ebc7);}return _0x402a43[_0x14f0('0x19')]();};}function saveUpdates(_0x580405,_0x390d63){return function(_0x2f8de2){if(_0x2f8de2){return _0x2f8de2['update'](_0x580405)[_0x14f0('0x1a')](function(_0x714a84){return _0x714a84;});}return null;};}function removeEntity(_0x26f593,_0x4b2229){return function(_0xc8736d){if(_0xc8736d){return _0xc8736d[_0x14f0('0x1b')]()[_0x14f0('0x1a')](function(){_0x26f593['status'](0xcc)[_0x14f0('0x1c')]();});}};}function handleEntityNotFound(_0x469836,_0x37557d){return function(_0x5c3548){if(!_0x5c3548){_0x469836[_0x14f0('0x10')](0x194);}return _0x5c3548;};}function handleError(_0x3c130,_0x11ec5b){_0x11ec5b=_0x11ec5b||0x1f4;return function(_0x367119){logger[_0x14f0('0x1d')](_0x367119['stack']);if(_0x367119[_0x14f0('0x1e')]){delete _0x367119['name'];}_0x3c130['status'](_0x11ec5b)[_0x14f0('0x1f')](_0x367119);};}exports[_0x14f0('0x20')]=function(_0x16cfbc,_0x477773){var _0x1d8a93={},_0xd5a71={},_0x5d6a2a={'count':0x0,'rows':[]};var _0x5226a4=db[_0x14f0('0x21')][_0x14f0('0x22')];_0xd5a71[_0x14f0('0x23')]=_['keys'](_0x5226a4);var _0x1acec4={'dateStart':_0x16cfbc['query'][_0x14f0('0x24')],'dateEnd':_0x16cfbc[_0x14f0('0x25')]['dateEnd']};delete _0x16cfbc[_0x14f0('0x25')]['dateStart'];delete _0x16cfbc['query'][_0x14f0('0x26')];_0xd5a71[_0x14f0('0x25')]=_[_0x14f0('0x27')](_0x16cfbc[_0x14f0('0x25')]);_0xd5a71[_0x14f0('0x28')]=_[_0x14f0('0x29')](_0xd5a71[_0x14f0('0x23')],_0xd5a71[_0x14f0('0x25')]);_0x1d8a93[_0x14f0('0x2a')]=_['intersection'](_0xd5a71[_0x14f0('0x23')],qs[_0x14f0('0x2b')](_0x16cfbc['query']['fields']));_0x1d8a93[_0x14f0('0x2a')]=_0x1d8a93[_0x14f0('0x2a')][_0x14f0('0x2c')]?_0x1d8a93[_0x14f0('0x2a')]:_0xd5a71[_0x14f0('0x23')];if(!_0x16cfbc[_0x14f0('0x25')][_0x14f0('0x2d')]('nolimit')){_0x1d8a93[_0x14f0('0x2e')]=qs['limit'](_0x16cfbc[_0x14f0('0x25')][_0x14f0('0x2e')]);_0x1d8a93[_0x14f0('0x13')]=qs[_0x14f0('0x13')](_0x16cfbc[_0x14f0('0x25')][_0x14f0('0x13')]);}_0x1d8a93['order']=qs[_0x14f0('0x2f')](_0x16cfbc[_0x14f0('0x25')][_0x14f0('0x2f')]);_0x1d8a93['where']=qs[_0x14f0('0x28')](_[_0x14f0('0x30')](_0x16cfbc[_0x14f0('0x25')],_0xd5a71['filters']));if(_0x1acec4['dateStart']){if(_0x1acec4[_0x14f0('0x26')]){_0x1acec4['dateEnd']=moment(_0x1acec4[_0x14f0('0x26')])[_0x14f0('0x31')](0x1,_0x14f0('0x32'));}else{_0x1acec4['dateEnd']=moment(_0x1acec4[_0x14f0('0x24')])[_0x14f0('0x31')](0x1,'day');}_[_0x14f0('0x33')](_0x1d8a93[_0x14f0('0x34')],{'createdAt':{'$gte':_0x1acec4['dateStart'],'$lte':_0x1acec4['dateEnd']}});}if(_0x16cfbc[_0x14f0('0x25')]['filter']){_0x1d8a93['where']=_[_0x14f0('0x33')](_0x1d8a93[_0x14f0('0x34')],{'$or':_['map'](_0x1d8a93[_0x14f0('0x2a')],function(_0x45f0cb){var _0xd05023={};_0xd05023[_0x45f0cb]={'$like':'%'+_0x16cfbc['query'][_0x14f0('0x35')]+'%'};return _0xd05023;})});}_0x1d8a93=_[_0x14f0('0x33')]({},_0x1d8a93,_0x16cfbc[_0x14f0('0x36')]);var _0x47457a={'where':_0x1d8a93['where']};return db[_0x14f0('0x21')]['count'](_0x47457a)[_0x14f0('0x1a')](function(_0x52635b){_0x5d6a2a[_0x14f0('0x12')]=_0x52635b;if(_0x16cfbc[_0x14f0('0x25')][_0x14f0('0x37')]){_0x1d8a93[_0x14f0('0x38')]=[{'all':!![]}];}return db[_0x14f0('0x21')]['findAll'](_0x1d8a93);})[_0x14f0('0x1a')](function(_0x2863ff){_0x5d6a2a[_0x14f0('0x39')]=_0x2863ff;return _0x5d6a2a;})[_0x14f0('0x1a')](respondWithFilteredResult(_0x477773,_0x1d8a93))[_0x14f0('0x3a')](handleError(_0x477773,null));};exports[_0x14f0('0x3b')]=function(_0x40b02f,_0x701b6f){var _0x188212={'raw':!![],'where':{'id':_0x40b02f[_0x14f0('0x3c')]['id']}},_0x7954ee={};_0x7954ee[_0x14f0('0x23')]=_['keys'](db[_0x14f0('0x21')]['rawAttributes']);_0x7954ee['query']=_[_0x14f0('0x27')](_0x40b02f[_0x14f0('0x25')]);_0x7954ee['filters']=_[_0x14f0('0x29')](_0x7954ee[_0x14f0('0x23')],_0x7954ee[_0x14f0('0x25')]);_0x188212[_0x14f0('0x2a')]=_[_0x14f0('0x29')](_0x7954ee['model'],qs['fields'](_0x40b02f['query'][_0x14f0('0x2b')]));_0x188212[_0x14f0('0x2a')]=_0x188212['attributes'][_0x14f0('0x2c')]?_0x188212[_0x14f0('0x2a')]:_0x7954ee[_0x14f0('0x23')];if(_0x40b02f[_0x14f0('0x25')][_0x14f0('0x37')]){_0x188212[_0x14f0('0x38')]=[{'all':!![]}];}_0x188212=_[_0x14f0('0x33')]({},_0x188212,_0x40b02f[_0x14f0('0x36')]);return db[_0x14f0('0x21')][_0x14f0('0x3d')](_0x188212)[_0x14f0('0x1a')](handleEntityNotFound(_0x701b6f,null))[_0x14f0('0x1a')](respondWithResult(_0x701b6f,null))[_0x14f0('0x3a')](handleError(_0x701b6f,null));};exports[_0x14f0('0x3e')]=function(_0x47a3ff,_0x5153a1){return db[_0x14f0('0x21')][_0x14f0('0x3e')](_0x47a3ff[_0x14f0('0x3f')],{})[_0x14f0('0x1a')](respondWithResult(_0x5153a1,0xc9))[_0x14f0('0x3a')](handleError(_0x5153a1,null));};exports[_0x14f0('0x40')]=function(_0x1267c5,_0x322d81){if(_0x1267c5[_0x14f0('0x3f')]['id']){delete _0x1267c5['body']['id'];}return db[_0x14f0('0x21')][_0x14f0('0x3d')]({'where':{'id':_0x1267c5[_0x14f0('0x3c')]['id']}})[_0x14f0('0x1a')](handleEntityNotFound(_0x322d81,null))[_0x14f0('0x1a')](saveUpdates(_0x1267c5[_0x14f0('0x3f')],null))[_0x14f0('0x1a')](respondWithResult(_0x322d81,null))[_0x14f0('0x3a')](handleError(_0x322d81,null));};exports[_0x14f0('0x1b')]=function(_0x19d62d,_0x55e304){return db[_0x14f0('0x21')]['find']({'where':{'id':_0x19d62d[_0x14f0('0x3c')]['id']}})[_0x14f0('0x1a')](handleEntityNotFound(_0x55e304,null))[_0x14f0('0x1a')](removeEntity(_0x55e304,null))[_0x14f0('0x3a')](handleError(_0x55e304,null));};exports['preview']=function(_0x2c0db7,_0x3885fb){var _0x399773=0xa;var _0x87eabb=[_0x14f0('0x41'),_0x14f0('0x42'),_0x14f0('0x43'),_0x14f0('0x44'),_0x14f0('0x45')];var _0xb07580={'SUM':_0x14f0('0x46'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x14f0('0x47'),'MAX':_0x14f0('0x48'),'MIN':'MIN(%s)','AVG':_0x14f0('0x49'),'GROUP_CONCAT':_0x14f0('0x4a'),'GROUP_CONCAT ASC':_0x14f0('0x4b'),'GROUP_CONCAT DESC':_0x14f0('0x4c')};var _0x42220b={'SEC_TO_TIME':_0x14f0('0x4d'),'DATE':_0x14f0('0x4e'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x14f0('0x4f')};var _0x74833d=function(_0x2a00a3){return!_[_0x14f0('0x50')]([_0x14f0('0x51'),_0x14f0('0x52'),_0x14f0('0x53'),'IS\x20NOT\x20EMPTY'],_0x2a00a3);};var _0x2ceffc=function(_0x32ec6b){if(!_0x32ec6b||!_0x32ec6b['rules'][_0x14f0('0x2c')]){return'';}for(var _0xd4686='(',_0x14c918=0x0;_0x14c918<_0x32ec6b[_0x14f0('0x54')]['length'];_0x14c918+=0x1){_0x14c918>0x0&&(_0xd4686+='\x20'+_0x32ec6b[_0x14f0('0x55')]+'\x20');_0xd4686+=_0x32ec6b[_0x14f0('0x54')][_0x14c918]['group']?_0x2ceffc(_0x32ec6b[_0x14f0('0x54')][_0x14c918][_0x14f0('0x56')]):_0x32ec6b[_0x14f0('0x54')][_0x14c918][_0x14f0('0x57')]+'\x20'+_0x32ec6b[_0x14f0('0x54')][_0x14c918][_0x14f0('0x58')]+(_0x74833d(_0x32ec6b['rules'][_0x14c918]['condition'])?'\x20'+_0x32ec6b[_0x14f0('0x54')][_0x14c918][_0x14f0('0x59')]:'');}return _0xd4686+')';};var _0xcdb448={'where':{'id':_0x2c0db7['params']['id']}},_0x2bfb2a,_0x22a9f1,_0x4856c8,_0x58017b,_0x2a1f42;_0xcdb448=_[_0x14f0('0x33')]({},_0xcdb448,_0x2c0db7['options']);return db[_0x14f0('0x21')][_0x14f0('0x3d')](_0xcdb448)[_0x14f0('0x1a')](function(_0x540cc8){if(_0x540cc8){_0x2bfb2a=_0x540cc8;return _0x540cc8[_0x14f0('0x5a')]();}return null;})[_0x14f0('0x1a')](function(_0x5a12a3){if(_0x5a12a3){if(!_0x5a12a3[_0x14f0('0x2c')]){throw new db[(_0x14f0('0x5b'))]['ValidationError'](_0x14f0('0x5c'));}_0x22a9f1=_0x5a12a3;return db[_0x14f0('0x5d')]['findAll']({'raw':!![]});}return null;})[_0x14f0('0x1a')](function(_0x2e6162){if(_0x2e6162){_0x4856c8=_['keyBy'](_0x2e6162,'id');var _0x5ecfb6;var _0x412abc=squel['select']();_0x412abc['from'](_0x2bfb2a[_0x14f0('0x5e')]);for(var _0x2cfc90=0x0;_0x2cfc90<_0x22a9f1['length'];_0x2cfc90+=0x1){_0x5ecfb6=_0x22a9f1[_0x2cfc90][_0x14f0('0x5f')]?_0x4856c8[_0x22a9f1[_0x2cfc90][_0x14f0('0x5f')]]['metric']:_0x22a9f1[_0x2cfc90]['field'];_0x5ecfb6=_0x22a9f1[_0x2cfc90]['function']?_[_0x14f0('0x60')](_0xb07580[_0x22a9f1[_0x2cfc90][_0x14f0('0x61')]],'%s',_0x5ecfb6):_0x5ecfb6;_0x5ecfb6=_0x22a9f1[_0x2cfc90]['format']?_[_0x14f0('0x60')](_0x42220b[_0x22a9f1[_0x2cfc90][_0x14f0('0x62')]],'%s',_0x5ecfb6):_0x5ecfb6;if(_0x22a9f1[_0x2cfc90][_0x14f0('0x63')]){_0x412abc[_0x14f0('0x56')](_0x5ecfb6);}_0x22a9f1[_0x2cfc90][_0x14f0('0x64')]&&_0x412abc[_0x14f0('0x65')](_0x5ecfb6,_0x22a9f1[_0x2cfc90]['orderBy']===_0x14f0('0x66')?![]:!![]);_0x412abc[_0x14f0('0x57')](_0x5ecfb6,_0x22a9f1[_0x2cfc90]['alias']||_0x5ecfb6);}if(_0x2bfb2a['joins']){_0x2bfb2a[_0x14f0('0x67')]=JSON[_0x14f0('0x68')](_0x2bfb2a[_0x14f0('0x67')]);for(var _0x5ce656=0x0;_0x5ce656<_0x2bfb2a['joins'][_0x14f0('0x2c')];_0x5ce656+=0x1){if(_0x2bfb2a[_0x14f0('0x67')][_0x5ce656][_0x14f0('0x69')]&&_[_0x14f0('0x50')](_0x87eabb,_0x2bfb2a[_0x14f0('0x67')][_0x5ce656][_0x14f0('0x69')])&&_0x2bfb2a[_0x14f0('0x67')][_0x5ce656][_0x14f0('0x6a')]&&_0x2bfb2a[_0x14f0('0x67')][_0x5ce656][_0x14f0('0x6b')]&&_0x2bfb2a[_0x14f0('0x67')][_0x5ce656][_0x14f0('0x6c')]){_0x412abc[_0x2bfb2a[_0x14f0('0x67')][_0x5ce656][_0x14f0('0x69')]](_0x2bfb2a['joins'][_0x5ce656][_0x14f0('0x6b')],null,util[_0x14f0('0x62')]('%s.%s\x20=\x20%s.%s',_0x2bfb2a[_0x14f0('0x5e')],_0x2bfb2a[_0x14f0('0x67')][_0x5ce656][_0x14f0('0x6a')],_0x2bfb2a[_0x14f0('0x67')][_0x5ce656][_0x14f0('0x6b')],_0x2bfb2a['joins'][_0x5ce656][_0x14f0('0x6c')]));}}}if(_0x2bfb2a[_0x14f0('0x6d')]){_0x2bfb2a[_0x14f0('0x6d')]=JSON['parse'](_0x2bfb2a[_0x14f0('0x6d')]);_0x412abc[_0x14f0('0x34')](_0x2ceffc(_0x2bfb2a[_0x14f0('0x6d')][_0x14f0('0x56')]));}_0x2a1f42=_0x412abc['clone']();_0x412abc[_0x14f0('0x2e')](_0x399773);_0x412abc[_0x14f0('0x13')](0x0);logger['debug'](_0x14f0('0x6e'),_0x412abc[_0x14f0('0x6f')]());return db[_0x14f0('0x70')]['query'](_0x412abc[_0x14f0('0x6f')](),{'type':db[_0x14f0('0x70')][_0x14f0('0x71')][_0x14f0('0x72')]});}})[_0x14f0('0x1a')](respondWithResult(_0x3885fb,null))[_0x14f0('0x3a')](handleError(_0x3885fb,null));};function runReport(_0x2bbfb2,_0x1df1b6,_0x3f7fa8){var _0x1815e4=_0x1df1b6[_0x14f0('0x1e')];var _0x1d7f0c=0xa;var _0x3f8beb=[_0x14f0('0x41'),_0x14f0('0x42'),'right_join',_0x14f0('0x44'),_0x14f0('0x45')];var _0x414dc1={'SUM':_0x14f0('0x46'),'COUNT':_0x14f0('0x73'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x14f0('0x48'),'MIN':_0x14f0('0x74'),'AVG':_0x14f0('0x49'),'GROUP_CONCAT':_0x14f0('0x4a'),'GROUP_CONCAT ASC':_0x14f0('0x4b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x16a407={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x14f0('0x4e'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x14f0('0x4f')};var _0x16c482=function(_0x4adedf){return!_[_0x14f0('0x50')]([_0x14f0('0x51'),_0x14f0('0x52'),_0x14f0('0x53'),_0x14f0('0x75')],_0x4adedf);};var _0x54f5cc=function(_0x55bcb3){if(!_0x55bcb3||!_0x55bcb3['rules']['length']){return'';}for(var _0x3c8009='(',_0x3a6586=0x0;_0x3a6586<_0x55bcb3[_0x14f0('0x54')][_0x14f0('0x2c')];_0x3a6586+=0x1){_0x3a6586>0x0&&(_0x3c8009+='\x20'+_0x55bcb3['operator']+'\x20');_0x3c8009+=_0x55bcb3[_0x14f0('0x54')][_0x3a6586][_0x14f0('0x56')]?_0x54f5cc(_0x55bcb3[_0x14f0('0x54')][_0x3a6586][_0x14f0('0x56')]):_0x55bcb3[_0x14f0('0x54')][_0x3a6586]['field']+'\x20'+_0x55bcb3[_0x14f0('0x54')][_0x3a6586][_0x14f0('0x58')]+(_0x16c482(_0x55bcb3[_0x14f0('0x54')][_0x3a6586][_0x14f0('0x58')])?'\x20'+_0x55bcb3[_0x14f0('0x54')][_0x3a6586][_0x14f0('0x59')]:'');}return _0x3c8009+')';};var _0x3621c4={'where':{'id':_0x2bbfb2['id']}},_0xfd1c46,_0x11ae9c,_0x23893f,_0x3ff2cc,_0x41230d;_0x3621c4=_[_0x14f0('0x33')]({},_0x3621c4,_0x3f7fa8);return db['AnalyticDefaultReport'][_0x14f0('0x3d')](_0x3621c4)[_0x14f0('0x1a')](function(_0x29836e){if(_0x29836e){_0xfd1c46=_0x29836e;return _0x29836e[_0x14f0('0x5a')]();}return null;})[_0x14f0('0x1a')](function(_0x4c719c){if(_0x4c719c){if(!_0x4c719c[_0x14f0('0x2c')]){throw new db[(_0x14f0('0x5b'))][(_0x14f0('0x76'))](_0x14f0('0x5c'));}_0x11ae9c=_0x4c719c;return db[_0x14f0('0x5d')][_0x14f0('0x77')]({'raw':!![]});}return null;})[_0x14f0('0x1a')](function(_0x3ddc96){if(_0x3ddc96){_0x23893f=_[_0x14f0('0x78')](_0x3ddc96,'id');var _0x3287d3;var _0x42329f=squel['select']();_0x42329f[_0x14f0('0x79')](_0xfd1c46['table']);for(var _0xe4be1c=0x0;_0xe4be1c<_0x11ae9c[_0x14f0('0x2c')];_0xe4be1c+=0x1){_0x3287d3=_0x11ae9c[_0xe4be1c][_0x14f0('0x5f')]?_0x23893f[_0x11ae9c[_0xe4be1c]['MetricId']]['metric']:_0x11ae9c[_0xe4be1c]['field'];_0x3287d3=_0x11ae9c[_0xe4be1c][_0x14f0('0x61')]?_[_0x14f0('0x60')](_0x414dc1[_0x11ae9c[_0xe4be1c][_0x14f0('0x61')]],'%s',_0x3287d3):_0x3287d3;_0x3287d3=_0x11ae9c[_0xe4be1c]['format']?_['replace'](_0x16a407[_0x11ae9c[_0xe4be1c][_0x14f0('0x62')]],'%s',_0x3287d3):_0x3287d3;if(_0x11ae9c[_0xe4be1c][_0x14f0('0x63')]){_0x42329f[_0x14f0('0x56')](_0x3287d3);}_0x11ae9c[_0xe4be1c][_0x14f0('0x64')]&&_0x42329f[_0x14f0('0x65')](_0x3287d3,_0x11ae9c[_0xe4be1c]['orderBy']==='DESC'?![]:!![]);_0x42329f[_0x14f0('0x57')](_0x3287d3,_0x11ae9c[_0xe4be1c]['alias']||_0x3287d3);}if(_0xfd1c46[_0x14f0('0x67')]){_0xfd1c46['joins']=JSON[_0x14f0('0x68')](_0xfd1c46[_0x14f0('0x67')]);for(var _0x296784=0x0;_0x296784<_0xfd1c46[_0x14f0('0x67')]['length'];_0x296784+=0x1){if(_0xfd1c46[_0x14f0('0x67')][_0x296784][_0x14f0('0x69')]&&_[_0x14f0('0x50')](_0x3f8beb,_0xfd1c46[_0x14f0('0x67')][_0x296784]['type'])&&_0xfd1c46[_0x14f0('0x67')][_0x296784][_0x14f0('0x6a')]&&_0xfd1c46[_0x14f0('0x67')][_0x296784]['foreignTable']&&_0xfd1c46['joins'][_0x296784][_0x14f0('0x6c')]){_0x42329f[_0xfd1c46['joins'][_0x296784]['type']](_0xfd1c46[_0x14f0('0x67')][_0x296784][_0x14f0('0x6b')],null,util[_0x14f0('0x62')](_0x14f0('0x7a'),_0xfd1c46[_0x14f0('0x5e')],_0xfd1c46[_0x14f0('0x67')][_0x296784][_0x14f0('0x6a')],_0xfd1c46['joins'][_0x296784]['foreignTable'],_0xfd1c46[_0x14f0('0x67')][_0x296784]['foreignKey']));}}}if(_0xfd1c46[_0x14f0('0x6d')]){_0xfd1c46[_0x14f0('0x6d')]=JSON['parse'](_0xfd1c46[_0x14f0('0x6d')]);_0x42329f[_0x14f0('0x34')](_0x54f5cc(_0xfd1c46[_0x14f0('0x6d')][_0x14f0('0x56')]));}_0x41230d=_0x42329f[_0x14f0('0x7b')]();_0x42329f['limit'](_0x1d7f0c);_0x42329f[_0x14f0('0x13')](0x0);logger[_0x14f0('0x7c')]('Limited\x20Query:',_0x42329f[_0x14f0('0x6f')]());return db[_0x14f0('0x70')][_0x14f0('0x25')](_0x42329f[_0x14f0('0x6f')](),{'type':db[_0x14f0('0x70')][_0x14f0('0x71')][_0x14f0('0x72')]});}})[_0x14f0('0x1a')](function(_0x5cc6b8){if(!_0x5cc6b8[_0x14f0('0x2c')]){throw new db[(_0x14f0('0x5b'))][(_0x14f0('0x76'))](_0x14f0('0x7d'));}if(_0x1df1b6[_0x14f0('0x7e')]===_0x14f0('0x7f')){return null;}var _0x2c78a7=_[_0x14f0('0x33')](_0x1df1b6,{'name':_0x1df1b6[_0x14f0('0x80')]||_0x1df1b6[_0x14f0('0x1e')]||_0xfd1c46[_0x14f0('0x1e')],'basename':_0x1815e4,'savename':util[_0x14f0('0x62')](_0x14f0('0x81'),_0x1df1b6['name']||_0xfd1c46[_0x14f0('0x1e')],require(_0x14f0('0x82'))[_0x14f0('0x83')](0x4),_0x1df1b6[_0x14f0('0x7e')]||_0x14f0('0x84'))});return db[_0x14f0('0x85')]['create'](_0x2c78a7,{'raw':!![]});})[_0x14f0('0x1a')](function(_0x403e68){_0x41230d['where'](_0xfd1c46[_0x14f0('0x5e')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1df1b6['startDate'],_0x1df1b6['endDate']);if(_0x403e68){logger[_0x14f0('0x86')](_0x14f0('0x87'),_0x41230d[_0x14f0('0x6f')]());require(_0x14f0('0x88'))[_0x14f0('0x89')](path[_0x14f0('0x41')](__dirname,_0x14f0('0x8a'),_0x403e68['output']),[_0x403e68['id'],_0x41230d['toString'](),path[_0x14f0('0x41')](__dirname,'../../files/reports',_0x403e68[_0x14f0('0x8b')]),_0x1815e4]);return _0x403e68;}else{var _0x547248=squel['select']();_0x547248[_0x14f0('0x79')]('('+_0x41230d[_0x14f0('0x6f')]()+')',_0x14f0('0x8c'));_0x547248[_0x14f0('0x57')]('COUNT(*)',_0x14f0('0x12'));_0x41230d['limit'](_0x1df1b6[_0x14f0('0x2e')]||_0x1d7f0c);_0x41230d['offset'](_0x1df1b6[_0x14f0('0x13')]||0x0);return db['sequelize'][_0x14f0('0x25')](_0x547248[_0x14f0('0x6f')](),{'type':db[_0x14f0('0x70')]['QueryTypes']['SELECT']})[_0x14f0('0x1a')](function(_0x2f6ede){if(!_0x2f6ede['length']){_0x3ff2cc=0x0;}else{_0x3ff2cc=_0x2f6ede[0x0][_0x14f0('0x12')]||0x0;}return db[_0x14f0('0x70')][_0x14f0('0x25')](_0x41230d['toString'](),{'type':db[_0x14f0('0x70')][_0x14f0('0x71')][_0x14f0('0x72')]});})[_0x14f0('0x1a')](function(_0x5f0003){return{'rows':_0x5f0003||[],'count':_0x3ff2cc};});}});}exports['run']=function(_0x30d3e1,_0x16cf9b){return runReport(_0x30d3e1[_0x14f0('0x3c')],_0x30d3e1[_0x14f0('0x25')],_0x30d3e1[_0x14f0('0x36')])['then'](respondWithResult(_0x16cf9b,null))[_0x14f0('0x3a')](handleError(_0x16cf9b,null));};exports[_0x14f0('0x8d')]=runReport;exports[_0x14f0('0x25')]=function(_0x592d1e,_0x3a5c08){var _0xeeae60=0xa;var _0x1e934e=['join','left_join',_0x14f0('0x43'),_0x14f0('0x44'),'cross_join'];var _0x1a05e3={'SUM':_0x14f0('0x46'),'COUNT':_0x14f0('0x73'),'COUNT DISTINCT':_0x14f0('0x47'),'MAX':_0x14f0('0x48'),'MIN':'MIN(%s)','AVG':_0x14f0('0x49'),'GROUP_CONCAT':_0x14f0('0x4a'),'GROUP_CONCAT ASC':_0x14f0('0x4b'),'GROUP_CONCAT DESC':_0x14f0('0x4c')};var _0x561a05={'SEC_TO_TIME':_0x14f0('0x4d'),'DATE':_0x14f0('0x4e'),'HOUR':_0x14f0('0x8e'),'ROUND':_0x14f0('0x8f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2bd40a=function(_0x736569){return!_[_0x14f0('0x50')]([_0x14f0('0x51'),_0x14f0('0x52'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x736569);};var _0x45e460=function(_0x205abf){if(!_0x205abf||!_0x205abf[_0x14f0('0x54')][_0x14f0('0x2c')]){return'';}for(var _0x51498a='(',_0x52940d=0x0;_0x52940d<_0x205abf['rules']['length'];_0x52940d+=0x1){_0x52940d>0x0&&(_0x51498a+='\x20'+_0x205abf[_0x14f0('0x55')]+'\x20');_0x51498a+=_0x205abf['rules'][_0x52940d][_0x14f0('0x56')]?_0x45e460(_0x205abf[_0x14f0('0x54')][_0x52940d]['group']):_0x205abf[_0x14f0('0x54')][_0x52940d][_0x14f0('0x57')]+'\x20'+_0x205abf[_0x14f0('0x54')][_0x52940d]['condition']+(_0x2bd40a(_0x205abf[_0x14f0('0x54')][_0x52940d][_0x14f0('0x58')])?'\x20'+_0x205abf[_0x14f0('0x54')][_0x52940d][_0x14f0('0x59')]:'');}return _0x51498a+')';};var _0x3c0aba={'where':{'id':_0x592d1e[_0x14f0('0x3c')]['id']}},_0x39dba6,_0x2bc9d3,_0x5d14d7,_0x497959,_0x344105;_0x3c0aba=_[_0x14f0('0x33')]({},_0x3c0aba,_0x592d1e[_0x14f0('0x36')]);return db['AnalyticDefaultReport'][_0x14f0('0x3d')](_0x3c0aba)[_0x14f0('0x1a')](function(_0x4a614d){if(_0x4a614d){_0x39dba6=_0x4a614d;return _0x4a614d['getFields']();}return null;})[_0x14f0('0x1a')](function(_0x521cbd){if(_0x521cbd){if(!_0x521cbd[_0x14f0('0x2c')]){throw new db['Sequelize']['ValidationError'](_0x14f0('0x5c'));}_0x2bc9d3=_0x521cbd;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x227c78){if(_0x227c78){_0x5d14d7=_[_0x14f0('0x78')](_0x227c78,'id');var _0x2fe5b8;var _0xc73f32=squel[_0x14f0('0x90')]();_0xc73f32['from'](_0x39dba6[_0x14f0('0x5e')]);for(var _0x2b4e7c=0x0;_0x2b4e7c<_0x2bc9d3['length'];_0x2b4e7c+=0x1){_0x2fe5b8=_0x2bc9d3[_0x2b4e7c][_0x14f0('0x5f')]?_0x5d14d7[_0x2bc9d3[_0x2b4e7c][_0x14f0('0x5f')]][_0x14f0('0x91')]:_0x2bc9d3[_0x2b4e7c]['field'];_0x2fe5b8=_0x2bc9d3[_0x2b4e7c]['function']?_[_0x14f0('0x60')](_0x1a05e3[_0x2bc9d3[_0x2b4e7c][_0x14f0('0x61')]],'%s',_0x2fe5b8):_0x2fe5b8;_0x2fe5b8=_0x2bc9d3[_0x2b4e7c][_0x14f0('0x62')]?_[_0x14f0('0x60')](_0x561a05[_0x2bc9d3[_0x2b4e7c][_0x14f0('0x62')]],'%s',_0x2fe5b8):_0x2fe5b8;if(_0x2bc9d3[_0x2b4e7c][_0x14f0('0x63')]){_0xc73f32['group'](_0x2fe5b8);}_0x2bc9d3[_0x2b4e7c][_0x14f0('0x64')]&&_0xc73f32[_0x14f0('0x65')](_0x2fe5b8,_0x2bc9d3[_0x2b4e7c][_0x14f0('0x64')]===_0x14f0('0x66')?![]:!![]);_0xc73f32[_0x14f0('0x57')](_0x2fe5b8,_0x2bc9d3[_0x2b4e7c][_0x14f0('0x92')]||_0x2fe5b8);}if(_0x39dba6[_0x14f0('0x67')]){_0x39dba6['joins']=JSON[_0x14f0('0x68')](_0x39dba6[_0x14f0('0x67')]);for(var _0x83662=0x0;_0x83662<_0x39dba6[_0x14f0('0x67')][_0x14f0('0x2c')];_0x83662+=0x1){if(_0x39dba6['joins'][_0x83662][_0x14f0('0x69')]&&_['includes'](_0x1e934e,_0x39dba6[_0x14f0('0x67')][_0x83662][_0x14f0('0x69')])&&_0x39dba6['joins'][_0x83662][_0x14f0('0x6a')]&&_0x39dba6[_0x14f0('0x67')][_0x83662][_0x14f0('0x6b')]&&_0x39dba6[_0x14f0('0x67')][_0x83662][_0x14f0('0x6c')]){_0xc73f32[_0x39dba6[_0x14f0('0x67')][_0x83662][_0x14f0('0x69')]](_0x39dba6[_0x14f0('0x67')][_0x83662][_0x14f0('0x6b')],null,util[_0x14f0('0x62')](_0x14f0('0x7a'),_0x39dba6[_0x14f0('0x5e')],_0x39dba6['joins'][_0x83662][_0x14f0('0x6a')],_0x39dba6[_0x14f0('0x67')][_0x83662][_0x14f0('0x6b')],_0x39dba6[_0x14f0('0x67')][_0x83662][_0x14f0('0x6c')]));}}}if(_0x39dba6[_0x14f0('0x6d')]){_0x39dba6['conditions']=JSON['parse'](_0x39dba6[_0x14f0('0x6d')]);_0xc73f32[_0x14f0('0x34')](_0x45e460(_0x39dba6[_0x14f0('0x6d')]['group']));}_0x344105=_0xc73f32[_0x14f0('0x7b')]();_0xc73f32[_0x14f0('0x2e')](_0xeeae60);_0xc73f32['offset'](0x0);logger['debug'](_0x14f0('0x6e'),_0xc73f32['toString']());return db['sequelize']['query'](_0xc73f32[_0x14f0('0x6f')](),{'type':db[_0x14f0('0x70')]['QueryTypes'][_0x14f0('0x72')]});}})['then'](function(){return{'sql':_0x344105[_0x14f0('0x6f')]()};})['then'](respondWithResult(_0x3a5c08,null))[_0x14f0('0x3a')](handleError(_0x3a5c08,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 34b0794..8fef944 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 _0x5896=['api','moment','bluebird','request-promise','./analyticDefaultReport.attributes','AnalyticDefaultReport','lodash','util','../../config/logger'];(function(_0x14a686,_0x396664){var _0xde9f05=function(_0x2004e9){while(--_0x2004e9){_0x14a686['push'](_0x14a686['shift']());}};_0xde9f05(++_0x396664);}(_0x5896,0x19b));var _0x6589=function(_0x5e3326,_0x15430d){_0x5e3326=_0x5e3326-0x0;var _0x247dd3=_0x5896[_0x5e3326];return _0x247dd3;};'use strict';var _=require(_0x6589('0x0'));var util=require(_0x6589('0x1'));var logger=require(_0x6589('0x2'))(_0x6589('0x3'));var moment=require(_0x6589('0x4'));var BPromise=require(_0x6589('0x5'));var rp=require(_0x6589('0x6'));var attributes=require(_0x6589('0x7'));module['exports']=function(_0x223832,_0x532130){return _0x223832['define'](_0x6589('0x8'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5012=['lodash','../../config/logger','api','moment','bluebird','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport'];(function(_0x4b4b21,_0x2dc712){var _0x217f50=function(_0x1859a6){while(--_0x1859a6){_0x4b4b21['push'](_0x4b4b21['shift']());}};_0x217f50(++_0x2dc712);}(_0x5012,0x19e));var _0x2501=function(_0x31f433,_0x3026f4){_0x31f433=_0x31f433-0x0;var _0x185f84=_0x5012[_0x31f433];return _0x185f84;};'use strict';var _=require(_0x2501('0x0'));var util=require('util');var logger=require(_0x2501('0x1'))(_0x2501('0x2'));var moment=require(_0x2501('0x3'));var BPromise=require(_0x2501('0x4'));var rp=require('request-promise');var attributes=require(_0x2501('0x5'));module[_0x2501('0x6')]=function(_0x2f1bf8,_0xba418d){return _0x2f1bf8[_0x2501('0x7')](_0x2501('0x8'),attributes,{'tableName':'analytics_default_reports','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 1debbc0..1a91ceb 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 _0x7ec5=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird'];(function(_0x17327e,_0x4f6991){var _0x5a9f39=function(_0x360ab3){while(--_0x360ab3){_0x17327e['push'](_0x17327e['shift']());}};_0x5a9f39(++_0x4f6991);}(_0x7ec5,0x128));var _0x57ec=function(_0x2fe5a8,_0x36dfc3){_0x2fe5a8=_0x2fe5a8-0x0;var _0x5cf27c=_0x7ec5[_0x2fe5a8];return _0x5cf27c;};'use strict';var _=require(_0x57ec('0x0'));var util=require('util');var moment=require(_0x57ec('0x1'));var BPromise=require(_0x57ec('0x2'));var rs=require(_0x57ec('0x3'));var fs=require('fs');var db=require(_0x57ec('0x4'))['db'];var utils=require(_0x57ec('0x5'));var logger=require(_0x57ec('0x6'))(_0x57ec('0x7'));var config=require('../../config/environment');var jayson=require(_0x57ec('0x8'));var client=jayson[_0x57ec('0x9')][_0x57ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x177187,_0x3a7222,_0x5d1060){return new BPromise(function(_0x10111e,_0x33e7bd){return client[_0x57ec('0xb')](_0x177187,_0x5d1060)[_0x57ec('0xc')](function(_0x425670){logger[_0x57ec('0xd')](_0x57ec('0xe'),_0x3a7222,_0x57ec('0xf'));logger[_0x57ec('0x10')](_0x57ec('0x11'),_0x3a7222,_0x57ec('0xf'),JSON[_0x57ec('0x12')](_0x425670));if(_0x425670[_0x57ec('0x13')]){if(_0x425670[_0x57ec('0x13')][_0x57ec('0x14')]===0x1f4){logger[_0x57ec('0x13')](_0x57ec('0xe'),_0x3a7222,_0x425670['error'][_0x57ec('0x15')]);return _0x33e7bd(_0x425670[_0x57ec('0x13')][_0x57ec('0x15')]);}logger[_0x57ec('0x13')](_0x57ec('0xe'),_0x3a7222,_0x425670[_0x57ec('0x13')][_0x57ec('0x15')]);return _0x10111e(_0x425670[_0x57ec('0x13')]['message']);}else{logger[_0x57ec('0xd')](_0x57ec('0xe'),_0x3a7222,_0x57ec('0xf'));_0x10111e(_0x425670[_0x57ec('0x16')]['message']);}})['catch'](function(_0x377882){logger[_0x57ec('0x13')](_0x57ec('0xe'),_0x3a7222,_0x377882);_0x33e7bd(_0x377882);});});} \ No newline at end of file +var _0x9a41=['../../config/environment','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x39b5bd,_0x398098){var _0x3791cb=function(_0x2e2feb){while(--_0x2e2feb){_0x39b5bd['push'](_0x39b5bd['shift']());}};_0x3791cb(++_0x398098);}(_0x9a41,0x104));var _0x19a4=function(_0x216da1,_0x5103c2){_0x216da1=_0x216da1-0x0;var _0x21697d=_0x9a41[_0x216da1];return _0x21697d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x19a4('0x0'));var BPromise=require(_0x19a4('0x1'));var rs=require(_0x19a4('0x2'));var fs=require('fs');var db=require(_0x19a4('0x3'))['db'];var utils=require(_0x19a4('0x4'));var logger=require(_0x19a4('0x5'))('rpc');var config=require(_0x19a4('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x19a4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x859119,_0x4ecb95,_0x41d2f0){return new BPromise(function(_0x357b6f,_0xaa768a){return client[_0x19a4('0x8')](_0x859119,_0x41d2f0)[_0x19a4('0x9')](function(_0x5b52c6){logger[_0x19a4('0xa')](_0x19a4('0xb'),_0x4ecb95,_0x19a4('0xc'));logger['debug'](_0x19a4('0xd'),_0x4ecb95,_0x19a4('0xc'),JSON[_0x19a4('0xe')](_0x5b52c6));if(_0x5b52c6['error']){if(_0x5b52c6['error'][_0x19a4('0xf')]===0x1f4){logger[_0x19a4('0x10')](_0x19a4('0xb'),_0x4ecb95,_0x5b52c6['error'][_0x19a4('0x11')]);return _0xaa768a(_0x5b52c6['error'][_0x19a4('0x11')]);}logger[_0x19a4('0x10')](_0x19a4('0xb'),_0x4ecb95,_0x5b52c6[_0x19a4('0x10')][_0x19a4('0x11')]);return _0x357b6f(_0x5b52c6['error'][_0x19a4('0x11')]);}else{logger[_0x19a4('0xa')](_0x19a4('0xb'),_0x4ecb95,_0x19a4('0xc'));_0x357b6f(_0x5b52c6[_0x19a4('0x12')][_0x19a4('0x11')]);}})['catch'](function(_0x3d949c){logger[_0x19a4('0x10')](_0x19a4('0xb'),_0x4ecb95,_0x3d949c);_0xaa768a(_0x3d949c);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index dc7e01f..907048d 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 _0x0f54=['query','post','create','/:id','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','show','/:id/preview','preview','/:id/run'];(function(_0x2496da,_0x3fe1fc){var _0x4caae0=function(_0x378012){while(--_0x378012){_0x2496da['push'](_0x2496da['shift']());}};_0x4caae0(++_0x3fe1fc);}(_0x0f54,0x13b));var _0x40f5=function(_0x2345be,_0x5e949d){_0x2345be=_0x2345be-0x0;var _0x2ff231=_0x0f54[_0x2345be];return _0x2ff231;};'use strict';var multer=require(_0x40f5('0x0'));var util=require(_0x40f5('0x1'));var path=require('path');var express=require(_0x40f5('0x2'));var router=express[_0x40f5('0x3')]();var auth=require(_0x40f5('0x4'));var interaction=require(_0x40f5('0x5'));var config=require(_0x40f5('0x6'));var controller=require(_0x40f5('0x7'));router[_0x40f5('0x8')]('/',auth[_0x40f5('0x9')](),controller[_0x40f5('0xa')]);router['get']('/:id',auth[_0x40f5('0x9')](),controller[_0x40f5('0xb')]);router['get'](_0x40f5('0xc'),auth['isAuthenticated'](),controller[_0x40f5('0xd')]);router['get'](_0x40f5('0xe'),auth[_0x40f5('0x9')](),controller['run']);router['get']('/:id/query',auth[_0x40f5('0x9')](),controller[_0x40f5('0xf')]);router[_0x40f5('0x10')]('/',auth[_0x40f5('0x9')](),controller[_0x40f5('0x11')]);router['put'](_0x40f5('0x12'),auth[_0x40f5('0x9')](),controller['update']);router[_0x40f5('0x13')](_0x40f5('0x12'),auth[_0x40f5('0x9')](),controller[_0x40f5('0x14')]);module[_0x40f5('0x15')]=router; \ No newline at end of file +var _0x9102=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','index','show','isAuthenticated','preview','/:id/run','run','/:id/query','query','post','create','delete','/:id','destroy','exports','util'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x9102,0x133));var _0x2910=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x9102[_0x39d544];return _0x5a5ff2;};'use strict';var multer=require('multer');var util=require(_0x2910('0x0'));var path=require('path');var express=require(_0x2910('0x1'));var router=express[_0x2910('0x2')]();var auth=require(_0x2910('0x3'));var interaction=require(_0x2910('0x4'));var config=require(_0x2910('0x5'));var controller=require(_0x2910('0x6'));router[_0x2910('0x7')]('/',auth['isAuthenticated'](),controller[_0x2910('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x2910('0x9')]);router[_0x2910('0x7')]('/:id/preview',auth[_0x2910('0xa')](),controller[_0x2910('0xb')]);router[_0x2910('0x7')](_0x2910('0xc'),auth[_0x2910('0xa')](),controller[_0x2910('0xd')]);router[_0x2910('0x7')](_0x2910('0xe'),auth['isAuthenticated'](),controller[_0x2910('0xf')]);router[_0x2910('0x10')]('/',auth[_0x2910('0xa')](),controller[_0x2910('0x11')]);router['put']('/:id',auth[_0x2910('0xa')](),controller['update']);router[_0x2910('0x12')](_0x2910('0x13'),auth[_0x2910('0xa')](),controller[_0x2910('0x14')]);module[_0x2910('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 2e41515..84d759c 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 _0x3b3d=['ENUM','manual','scheduled','sequelize','moment','xlsx','STRING','DATE','Loading'];(function(_0x592c24,_0x5d508b){var _0x5aa052=function(_0x1a5dd2){while(--_0x1a5dd2){_0x592c24['push'](_0x592c24['shift']());}};_0x5aa052(++_0x5d508b);}(_0x3b3d,0xa5));var _0xd3b3=function(_0x54c9ba,_0x3cea45){_0x54c9ba=_0x54c9ba-0x0;var _0xfd2aa1=_0x3b3d[_0x54c9ba];return _0xfd2aa1;};'use strict';var Sequelize=require(_0xd3b3('0x0'));var moment=require(_0xd3b3('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv','pdf',_0xd3b3('0x2')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xd3b3('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xd3b3('0x4')]},'endDate':{'type':Sequelize[_0xd3b3('0x4')]},'status':{'type':Sequelize[_0xd3b3('0x3')],'defaultValue':_0xd3b3('0x5')},'type':{'type':Sequelize[_0xd3b3('0x6')](_0xd3b3('0x7'),_0xd3b3('0x8')),'allowNull':![],'defaultValue':_0xd3b3('0x7')}}; \ No newline at end of file +var _0xe7c6=['scheduled','sequelize','moment','STRING','ENUM','csv','pdf','xlsx','manual'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe7c6,0xe2));var _0x6e7c=function(_0x20c2a8,_0x452b20){_0x20c2a8=_0x20c2a8-0x0;var _0x14fa74=_0xe7c6[_0x20c2a8];return _0x14fa74;};'use strict';var Sequelize=require(_0x6e7c('0x0'));var moment=require(_0x6e7c('0x1'));module['exports']={'name':{'type':Sequelize[_0x6e7c('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x6e7c('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x6e7c('0x3')](_0x6e7c('0x4'),_0x6e7c('0x5'),_0x6e7c('0x6')),'allowNull':![],'defaultValue':_0x6e7c('0x4')},'savename':{'type':Sequelize[_0x6e7c('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x6e7c('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x6e7c('0x3')](_0x6e7c('0x7'),_0x6e7c('0x8')),'allowNull':![],'defaultValue':_0x6e7c('0x7')}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index e9c007f..c884cac 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 _0x9e48=['download','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','toLowerCase','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','add','day','merge','filter','options','AnalyticExtractedReport','count','includeAll','include','rows','catch','show','params','find','create','body'];(function(_0x608e20,_0x2c546d){var _0x5f498a=function(_0x7ee427){while(--_0x7ee427){_0x608e20['push'](_0x608e20['shift']());}};_0x5f498a(++_0x2c546d);}(_0x9e48,0xf5));var _0x89e4=function(_0xdfd552,_0x5f39a0){_0xdfd552=_0xdfd552-0x0;var _0x598335=_0x9e48[_0xdfd552];return _0x598335;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x89e4('0x0'));var moment=require(_0x89e4('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x89e4('0x2'));var util=require(_0x89e4('0x3'));var path=require(_0x89e4('0x4'));var sox=require(_0x89e4('0x5'));var csv=require('to-csv');var ejs=require(_0x89e4('0x6'));var fs=require('fs');var _=require(_0x89e4('0x7'));var squel=require(_0x89e4('0x8'));var crypto=require(_0x89e4('0x9'));var jsforce=require(_0x89e4('0xa'));var deskjs=require(_0x89e4('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x89e4('0xc'));var qs=require(_0x89e4('0xd'));var logger=require(_0x89e4('0xe'))(_0x89e4('0xf'));var utils=require(_0x89e4('0x10'));var config=require(_0x89e4('0x11'));var db=require(_0x89e4('0x12'))['db'];function respondWithStatusCode(_0x41f8ea,_0x634fae){_0x634fae=_0x634fae||0xcc;return function(_0x24414d){if(_0x24414d){return _0x41f8ea[_0x89e4('0x13')](_0x634fae);}return _0x41f8ea[_0x89e4('0x14')](_0x634fae)['end']();};}function respondWithResult(_0x1a9a80,_0x24c8b0){_0x24c8b0=_0x24c8b0||0xc8;return function(_0x4eb069){if(_0x4eb069){return _0x1a9a80['status'](_0x24c8b0)[_0x89e4('0x15')](_0x4eb069);}};}function respondWithFilteredResult(_0x344f60,_0x12c334){return function(_0x1add97){if(_0x1add97){var _0x7a1002=_0x1add97['count'],_0x270dde=_0x12c334[_0x89e4('0x16')],_0x541623=_0x12c334['offset']+_0x12c334[_0x89e4('0x17')],_0x27900f;if(_0x541623>=_0x7a1002){_0x541623=_0x7a1002;_0x27900f=0xc8;}else{_0x27900f=0xce;}_0x344f60[_0x89e4('0x14')](_0x27900f);return _0x344f60['set'](_0x89e4('0x18'),_0x270dde+'-'+_0x541623+'/'+_0x7a1002)[_0x89e4('0x15')](_0x1add97);}return null;};}function patchUpdates(_0x1feb50){return function(_0x34ba46){try{jsonpatch[_0x89e4('0x19')](_0x34ba46,_0x1feb50,!![]);}catch(_0x228aab){return BPromise[_0x89e4('0x1a')](_0x228aab);}return _0x34ba46[_0x89e4('0x1b')]();};}function saveUpdates(_0x5228ca,_0x292bb1){return function(_0x33c339){if(_0x33c339){return _0x33c339[_0x89e4('0x1c')](_0x5228ca)[_0x89e4('0x1d')](function(_0x3c6845){return _0x3c6845;});}return null;};}function removeEntity(_0x38a545,_0x3df709){return function(_0x315fc2){if(_0x315fc2){return _0x315fc2[_0x89e4('0x1e')]()[_0x89e4('0x1d')](function(){_0x38a545[_0x89e4('0x14')](0xcc)[_0x89e4('0x1f')]();});}};}function handleEntityNotFound(_0x5ba2fc,_0x1e323e){return function(_0x40f294){if(!_0x40f294){_0x5ba2fc['sendStatus'](0x194);}return _0x40f294;};}function handleError(_0x417062,_0x53c929){_0x53c929=_0x53c929||0x1f4;return function(_0x5cb864){logger[_0x89e4('0x20')](_0x5cb864[_0x89e4('0x21')]);if(_0x5cb864['name']){delete _0x5cb864[_0x89e4('0x22')];}_0x417062[_0x89e4('0x14')](_0x53c929)['send'](_0x5cb864);};}exports[_0x89e4('0x23')]=function(_0x1bc693,_0x2c2c43){var _0x1f841d={},_0x4c23a2={},_0x2cb28a={'count':0x0,'rows':[]};var _0x4ad5e=db['AnalyticExtractedReport'][_0x89e4('0x24')];_0x4c23a2[_0x89e4('0x25')]=_[_0x89e4('0x26')](_0x4ad5e);var _0x32a274={'dateStart':_0x1bc693[_0x89e4('0x27')][_0x89e4('0x28')],'dateEnd':_0x1bc693[_0x89e4('0x27')][_0x89e4('0x29')]};delete _0x1bc693[_0x89e4('0x27')]['dateStart'];delete _0x1bc693[_0x89e4('0x27')][_0x89e4('0x29')];_0x4c23a2[_0x89e4('0x27')]=_['keys'](_0x1bc693['query']);_0x4c23a2[_0x89e4('0x2a')]=_['intersection'](_0x4c23a2[_0x89e4('0x25')],_0x4c23a2[_0x89e4('0x27')]);_0x1f841d[_0x89e4('0x2b')]=_[_0x89e4('0x2c')](_0x4c23a2[_0x89e4('0x25')],qs['fields'](_0x1bc693[_0x89e4('0x27')][_0x89e4('0x2d')]));_0x1f841d[_0x89e4('0x2b')]=_0x1f841d[_0x89e4('0x2b')][_0x89e4('0x2e')]?_0x1f841d[_0x89e4('0x2b')]:_0x4c23a2[_0x89e4('0x25')];if(!_0x1bc693[_0x89e4('0x27')]['hasOwnProperty'](_0x89e4('0x2f'))){_0x1f841d[_0x89e4('0x17')]=qs[_0x89e4('0x17')](_0x1bc693[_0x89e4('0x27')][_0x89e4('0x17')]);_0x1f841d[_0x89e4('0x16')]=qs[_0x89e4('0x16')](_0x1bc693[_0x89e4('0x27')][_0x89e4('0x16')]);}_0x1f841d['order']=qs[_0x89e4('0x30')](_0x1bc693[_0x89e4('0x27')][_0x89e4('0x30')]);_0x1f841d[_0x89e4('0x31')]=qs['filters'](_[_0x89e4('0x32')](_0x1bc693['query'],_0x4c23a2[_0x89e4('0x2a')]));if(_0x32a274[_0x89e4('0x28')]){if(_0x32a274[_0x89e4('0x29')]){_0x32a274[_0x89e4('0x29')]=moment(_0x32a274['dateEnd'])[_0x89e4('0x33')](0x1,_0x89e4('0x34'));}else{_0x32a274[_0x89e4('0x29')]=moment(_0x32a274['dateStart'])[_0x89e4('0x33')](0x1,_0x89e4('0x34'));}_[_0x89e4('0x35')](_0x1f841d[_0x89e4('0x31')],{'createdAt':{'$gte':_0x32a274['dateStart'],'$lte':_0x32a274[_0x89e4('0x29')]}});}if(_0x1bc693['query'][_0x89e4('0x36')]){_0x1f841d['where']=_[_0x89e4('0x35')](_0x1f841d[_0x89e4('0x31')],{'$or':_['map'](_0x1f841d[_0x89e4('0x2b')],function(_0x804254){var _0x4e3afe={};_0x4e3afe[_0x804254]={'$like':'%'+_0x1bc693['query']['filter']+'%'};return _0x4e3afe;})});}_0x1f841d=_[_0x89e4('0x35')]({},_0x1f841d,_0x1bc693[_0x89e4('0x37')]);var _0x1fd4af={'where':_0x1f841d['where']};return db[_0x89e4('0x38')][_0x89e4('0x39')](_0x1fd4af)['then'](function(_0x2770ca){_0x2cb28a[_0x89e4('0x39')]=_0x2770ca;if(_0x1bc693['query'][_0x89e4('0x3a')]){_0x1f841d[_0x89e4('0x3b')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x1f841d);})['then'](function(_0x9a84b7){_0x2cb28a[_0x89e4('0x3c')]=_0x9a84b7;return _0x2cb28a;})[_0x89e4('0x1d')](respondWithFilteredResult(_0x2c2c43,_0x1f841d))[_0x89e4('0x3d')](handleError(_0x2c2c43,null));};exports[_0x89e4('0x3e')]=function(_0x5e496f,_0x400154){var _0x501489={'raw':!![],'where':{'id':_0x5e496f[_0x89e4('0x3f')]['id']}},_0x5afc84={};_0x5afc84['model']=_[_0x89e4('0x26')](db[_0x89e4('0x38')]['rawAttributes']);_0x5afc84[_0x89e4('0x27')]=_[_0x89e4('0x26')](_0x5e496f['query']);_0x5afc84[_0x89e4('0x2a')]=_[_0x89e4('0x2c')](_0x5afc84[_0x89e4('0x25')],_0x5afc84[_0x89e4('0x27')]);_0x501489['attributes']=_['intersection'](_0x5afc84[_0x89e4('0x25')],qs[_0x89e4('0x2d')](_0x5e496f[_0x89e4('0x27')][_0x89e4('0x2d')]));_0x501489['attributes']=_0x501489['attributes'][_0x89e4('0x2e')]?_0x501489['attributes']:_0x5afc84[_0x89e4('0x25')];if(_0x5e496f['query'][_0x89e4('0x3a')]){_0x501489[_0x89e4('0x3b')]=[{'all':!![]}];}_0x501489=_['merge']({},_0x501489,_0x5e496f[_0x89e4('0x37')]);return db['AnalyticExtractedReport'][_0x89e4('0x40')](_0x501489)[_0x89e4('0x1d')](handleEntityNotFound(_0x400154,null))['then'](respondWithResult(_0x400154,null))[_0x89e4('0x3d')](handleError(_0x400154,null));};exports['create']=function(_0x5e9faf,_0x1da0f5){return db[_0x89e4('0x38')][_0x89e4('0x41')](_0x5e9faf[_0x89e4('0x42')],{})['then'](respondWithResult(_0x1da0f5,0xc9))[_0x89e4('0x3d')](handleError(_0x1da0f5,null));};exports[_0x89e4('0x1c')]=function(_0x2b4994,_0x3b63b7){if(_0x2b4994[_0x89e4('0x42')]['id']){delete _0x2b4994[_0x89e4('0x42')]['id'];}return db['AnalyticExtractedReport'][_0x89e4('0x40')]({'where':{'id':_0x2b4994[_0x89e4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3b63b7,null))[_0x89e4('0x1d')](saveUpdates(_0x2b4994[_0x89e4('0x42')],null))[_0x89e4('0x1d')](respondWithResult(_0x3b63b7,null))['catch'](handleError(_0x3b63b7,null));};exports[_0x89e4('0x1e')]=function(_0x4f25a6,_0x3ff107){return db['AnalyticExtractedReport'][_0x89e4('0x40')]({'where':{'id':_0x4f25a6['params']['id']}})[_0x89e4('0x1d')](handleEntityNotFound(_0x3ff107,null))['then'](removeEntity(_0x3ff107,null))[_0x89e4('0x3d')](handleError(_0x3ff107,null));};exports[_0x89e4('0x43')]=function(_0x5edd76,_0x584ff4,_0x22fff2){return db[_0x89e4('0x38')]['find']({'where':{'id':_0x5edd76[_0x89e4('0x3f')]['id']},'attributes':[_0x89e4('0x22'),'basename',_0x89e4('0x44'),_0x89e4('0x45')],'raw':!![]})[_0x89e4('0x1d')](handleEntityNotFound(_0x584ff4,null))[_0x89e4('0x1d')](function(_0x233dcb){if(_0x233dcb){if(!fs[_0x89e4('0x46')](path[_0x89e4('0x47')](config[_0x89e4('0x48')],_0x89e4('0x49'),_0x233dcb['savename']))){throw new db[(_0x89e4('0x4a'))][(_0x89e4('0x4b'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x5edd76[_0x89e4('0x27')][_0x89e4('0x4c')]){return _0x584ff4[_0x89e4('0x13')](0xc8);}return _0x584ff4[_0x89e4('0x43')](path[_0x89e4('0x47')](config[_0x89e4('0x48')],'server/files/reports',_0x233dcb['savename']),util['format']('%s.%s',_0x233dcb['basename']||_0x233dcb[_0x89e4('0x22')],_0x233dcb[_0x89e4('0x45')][_0x89e4('0x4d')]()));}})[_0x89e4('0x3d')](handleError(_0x584ff4,null));}; \ No newline at end of file +var _0xffba=['options','find','create','body','download','savename','join','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','basename','output','toLowerCase','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','reject','save','update','then','destroy','error','name','send','AnalyticExtractedReport','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','add','day','merge','filter','map','includeAll','include','rows','catch','show','params'];(function(_0x1637b9,_0x2b81c8){var _0x36d72e=function(_0x515c0c){while(--_0x515c0c){_0x1637b9['push'](_0x1637b9['shift']());}};_0x36d72e(++_0x2b81c8);}(_0xffba,0x1d9));var _0xaffb=function(_0x53781f,_0x521ffe){_0x53781f=_0x53781f-0x0;var _0x5db2c0=_0xffba[_0x53781f];return _0x5db2c0;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaffb('0x0'));var BPromise=require(_0xaffb('0x1'));var Mustache=require('mustache');var util=require(_0xaffb('0x2'));var path=require(_0xaffb('0x3'));var sox=require(_0xaffb('0x4'));var csv=require(_0xaffb('0x5'));var ejs=require(_0xaffb('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xaffb('0x7'));var crypto=require(_0xaffb('0x8'));var jsforce=require(_0xaffb('0x9'));var deskjs=require(_0xaffb('0xa'));var toCsv=require('to-csv');var querystring=require(_0xaffb('0xb'));var Papa=require(_0xaffb('0xc'));var qs=require(_0xaffb('0xd'));var logger=require(_0xaffb('0xe'))(_0xaffb('0xf'));var utils=require(_0xaffb('0x10'));var config=require(_0xaffb('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x287066,_0x4fdad4){_0x4fdad4=_0x4fdad4||0xcc;return function(_0x5b0a91){if(_0x5b0a91){return _0x287066[_0xaffb('0x12')](_0x4fdad4);}return _0x287066[_0xaffb('0x13')](_0x4fdad4)['end']();};}function respondWithResult(_0x18fb4d,_0x53d350){_0x53d350=_0x53d350||0xc8;return function(_0x4ed5d7){if(_0x4ed5d7){return _0x18fb4d[_0xaffb('0x13')](_0x53d350)[_0xaffb('0x14')](_0x4ed5d7);}};}function respondWithFilteredResult(_0x475c37,_0x556fd0){return function(_0x4c6667){if(_0x4c6667){var _0x137baf=_0x4c6667[_0xaffb('0x15')],_0x4fba35=_0x556fd0['offset'],_0x4b02f1=_0x556fd0[_0xaffb('0x16')]+_0x556fd0[_0xaffb('0x17')],_0x2319d0;if(_0x4b02f1>=_0x137baf){_0x4b02f1=_0x137baf;_0x2319d0=0xc8;}else{_0x2319d0=0xce;}_0x475c37[_0xaffb('0x13')](_0x2319d0);return _0x475c37['set']('Content-Range',_0x4fba35+'-'+_0x4b02f1+'/'+_0x137baf)['json'](_0x4c6667);}return null;};}function patchUpdates(_0x1f3c0b){return function(_0x2bc8c2){try{jsonpatch['apply'](_0x2bc8c2,_0x1f3c0b,!![]);}catch(_0x15139b){return BPromise[_0xaffb('0x18')](_0x15139b);}return _0x2bc8c2[_0xaffb('0x19')]();};}function saveUpdates(_0x1467ed,_0x12a6b7){return function(_0x4584ee){if(_0x4584ee){return _0x4584ee[_0xaffb('0x1a')](_0x1467ed)[_0xaffb('0x1b')](function(_0x442120){return _0x442120;});}return null;};}function removeEntity(_0x584b37,_0x476a5f){return function(_0x35c304){if(_0x35c304){return _0x35c304[_0xaffb('0x1c')]()[_0xaffb('0x1b')](function(){_0x584b37[_0xaffb('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17bbf9,_0x2f51f1){return function(_0xd8989e){if(!_0xd8989e){_0x17bbf9[_0xaffb('0x12')](0x194);}return _0xd8989e;};}function handleError(_0x73bbac,_0x19af48){_0x19af48=_0x19af48||0x1f4;return function(_0x3b3abf){logger[_0xaffb('0x1d')](_0x3b3abf['stack']);if(_0x3b3abf[_0xaffb('0x1e')]){delete _0x3b3abf[_0xaffb('0x1e')];}_0x73bbac['status'](_0x19af48)[_0xaffb('0x1f')](_0x3b3abf);};}exports['index']=function(_0x5a22e5,_0x50068b){var _0x308491={},_0xe8c06e={},_0x59dc7e={'count':0x0,'rows':[]};var _0x1ba75b=db[_0xaffb('0x20')][_0xaffb('0x21')];_0xe8c06e['model']=_[_0xaffb('0x22')](_0x1ba75b);var _0xbce073={'dateStart':_0x5a22e5[_0xaffb('0x23')][_0xaffb('0x24')],'dateEnd':_0x5a22e5[_0xaffb('0x23')][_0xaffb('0x25')]};delete _0x5a22e5[_0xaffb('0x23')]['dateStart'];delete _0x5a22e5[_0xaffb('0x23')][_0xaffb('0x25')];_0xe8c06e[_0xaffb('0x23')]=_['keys'](_0x5a22e5[_0xaffb('0x23')]);_0xe8c06e[_0xaffb('0x26')]=_[_0xaffb('0x27')](_0xe8c06e[_0xaffb('0x28')],_0xe8c06e[_0xaffb('0x23')]);_0x308491[_0xaffb('0x29')]=_[_0xaffb('0x27')](_0xe8c06e[_0xaffb('0x28')],qs[_0xaffb('0x2a')](_0x5a22e5['query']['fields']));_0x308491[_0xaffb('0x29')]=_0x308491[_0xaffb('0x29')][_0xaffb('0x2b')]?_0x308491[_0xaffb('0x29')]:_0xe8c06e[_0xaffb('0x28')];if(!_0x5a22e5[_0xaffb('0x23')][_0xaffb('0x2c')]('nolimit')){_0x308491[_0xaffb('0x17')]=qs[_0xaffb('0x17')](_0x5a22e5['query']['limit']);_0x308491[_0xaffb('0x16')]=qs[_0xaffb('0x16')](_0x5a22e5[_0xaffb('0x23')][_0xaffb('0x16')]);}_0x308491[_0xaffb('0x2d')]=qs[_0xaffb('0x2e')](_0x5a22e5['query'][_0xaffb('0x2e')]);_0x308491[_0xaffb('0x2f')]=qs['filters'](_['pick'](_0x5a22e5[_0xaffb('0x23')],_0xe8c06e[_0xaffb('0x26')]));if(_0xbce073[_0xaffb('0x24')]){if(_0xbce073[_0xaffb('0x25')]){_0xbce073[_0xaffb('0x25')]=moment(_0xbce073[_0xaffb('0x25')])[_0xaffb('0x30')](0x1,'day');}else{_0xbce073[_0xaffb('0x25')]=moment(_0xbce073[_0xaffb('0x24')])[_0xaffb('0x30')](0x1,_0xaffb('0x31'));}_[_0xaffb('0x32')](_0x308491['where'],{'createdAt':{'$gte':_0xbce073[_0xaffb('0x24')],'$lte':_0xbce073[_0xaffb('0x25')]}});}if(_0x5a22e5[_0xaffb('0x23')][_0xaffb('0x33')]){_0x308491[_0xaffb('0x2f')]=_[_0xaffb('0x32')](_0x308491['where'],{'$or':_[_0xaffb('0x34')](_0x308491[_0xaffb('0x29')],function(_0x30180a){var _0x51bd4d={};_0x51bd4d[_0x30180a]={'$like':'%'+_0x5a22e5[_0xaffb('0x23')][_0xaffb('0x33')]+'%'};return _0x51bd4d;})});}_0x308491=_['merge']({},_0x308491,_0x5a22e5['options']);var _0x48fa40={'where':_0x308491['where']};return db[_0xaffb('0x20')][_0xaffb('0x15')](_0x48fa40)[_0xaffb('0x1b')](function(_0x1d8b35){_0x59dc7e['count']=_0x1d8b35;if(_0x5a22e5[_0xaffb('0x23')][_0xaffb('0x35')]){_0x308491[_0xaffb('0x36')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x308491);})[_0xaffb('0x1b')](function(_0x17fa5a){_0x59dc7e[_0xaffb('0x37')]=_0x17fa5a;return _0x59dc7e;})[_0xaffb('0x1b')](respondWithFilteredResult(_0x50068b,_0x308491))[_0xaffb('0x38')](handleError(_0x50068b,null));};exports[_0xaffb('0x39')]=function(_0x83de01,_0x4d3006){var _0x8b6ea4={'raw':!![],'where':{'id':_0x83de01[_0xaffb('0x3a')]['id']}},_0x264643={};_0x264643[_0xaffb('0x28')]=_[_0xaffb('0x22')](db[_0xaffb('0x20')]['rawAttributes']);_0x264643['query']=_['keys'](_0x83de01[_0xaffb('0x23')]);_0x264643['filters']=_['intersection'](_0x264643[_0xaffb('0x28')],_0x264643[_0xaffb('0x23')]);_0x8b6ea4[_0xaffb('0x29')]=_[_0xaffb('0x27')](_0x264643['model'],qs['fields'](_0x83de01['query']['fields']));_0x8b6ea4['attributes']=_0x8b6ea4[_0xaffb('0x29')]['length']?_0x8b6ea4['attributes']:_0x264643[_0xaffb('0x28')];if(_0x83de01[_0xaffb('0x23')][_0xaffb('0x35')]){_0x8b6ea4[_0xaffb('0x36')]=[{'all':!![]}];}_0x8b6ea4=_['merge']({},_0x8b6ea4,_0x83de01[_0xaffb('0x3b')]);return db['AnalyticExtractedReport'][_0xaffb('0x3c')](_0x8b6ea4)[_0xaffb('0x1b')](handleEntityNotFound(_0x4d3006,null))['then'](respondWithResult(_0x4d3006,null))[_0xaffb('0x38')](handleError(_0x4d3006,null));};exports[_0xaffb('0x3d')]=function(_0x1576b8,_0x2e2499){return db['AnalyticExtractedReport'][_0xaffb('0x3d')](_0x1576b8['body'],{})[_0xaffb('0x1b')](respondWithResult(_0x2e2499,0xc9))[_0xaffb('0x38')](handleError(_0x2e2499,null));};exports[_0xaffb('0x1a')]=function(_0x4f236d,_0x24c826){if(_0x4f236d[_0xaffb('0x3e')]['id']){delete _0x4f236d['body']['id'];}return db[_0xaffb('0x20')]['find']({'where':{'id':_0x4f236d[_0xaffb('0x3a')]['id']}})['then'](handleEntityNotFound(_0x24c826,null))[_0xaffb('0x1b')](saveUpdates(_0x4f236d[_0xaffb('0x3e')],null))[_0xaffb('0x1b')](respondWithResult(_0x24c826,null))[_0xaffb('0x38')](handleError(_0x24c826,null));};exports[_0xaffb('0x1c')]=function(_0xf1dc9,_0x5a3e5a){return db[_0xaffb('0x20')][_0xaffb('0x3c')]({'where':{'id':_0xf1dc9['params']['id']}})[_0xaffb('0x1b')](handleEntityNotFound(_0x5a3e5a,null))['then'](removeEntity(_0x5a3e5a,null))[_0xaffb('0x38')](handleError(_0x5a3e5a,null));};exports[_0xaffb('0x3f')]=function(_0x137c88,_0x387c83,_0x5aee1d){return db[_0xaffb('0x20')][_0xaffb('0x3c')]({'where':{'id':_0x137c88[_0xaffb('0x3a')]['id']},'attributes':[_0xaffb('0x1e'),'basename',_0xaffb('0x40'),'output'],'raw':!![]})[_0xaffb('0x1b')](handleEntityNotFound(_0x387c83,null))[_0xaffb('0x1b')](function(_0x255362){if(_0x255362){if(!fs['existsSync'](path[_0xaffb('0x41')](config[_0xaffb('0x42')],_0xaffb('0x43'),_0x255362[_0xaffb('0x40')]))){throw new db['Sequelize'][(_0xaffb('0x44'))](_0xaffb('0x45'));}if(_0x137c88['query'][_0xaffb('0x46')]){return _0x387c83[_0xaffb('0x12')](0xc8);}return _0x387c83[_0xaffb('0x3f')](path['join'](config[_0xaffb('0x42')],_0xaffb('0x43'),_0x255362[_0xaffb('0x40')]),util[_0xaffb('0x47')](_0xaffb('0x48'),_0x255362[_0xaffb('0x49')]||_0x255362[_0xaffb('0x1e')],_0x255362[_0xaffb('0x4a')][_0xaffb('0x4b')]()));}})['catch'](handleError(_0x387c83,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 9558fac..d30f7ff 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 _0x9265=['lodash','api','moment','bluebird','request-promise','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports'];(function(_0x2b58ec,_0x463407){var _0x348182=function(_0x52fbd8){while(--_0x52fbd8){_0x2b58ec['push'](_0x2b58ec['shift']());}};_0x348182(++_0x463407);}(_0x9265,0x1dd));var _0x5926=function(_0xd90b19,_0x340c84){_0xd90b19=_0xd90b19-0x0;var _0x16bae2=_0x9265[_0xd90b19];return _0x16bae2;};'use strict';var _=require(_0x5926('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5926('0x1'));var moment=require(_0x5926('0x2'));var BPromise=require(_0x5926('0x3'));var rp=require(_0x5926('0x4'));var attributes=require(_0x5926('0x5'));module[_0x5926('0x6')]=function(_0x31d820,_0x2ce376){return _0x31d820['define'](_0x5926('0x7'),attributes,{'tableName':_0x5926('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdcf9=['./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x515f61,_0x4a4cce){var _0x517c77=function(_0x131cb0){while(--_0x131cb0){_0x515f61['push'](_0x515f61['shift']());}};_0x517c77(++_0x4a4cce);}(_0xdcf9,0x101));var _0x9dcf=function(_0x3e511f,_0x42a271){_0x3e511f=_0x3e511f-0x0;var _0x3ead35=_0xdcf9[_0x3e511f];return _0x3ead35;};'use strict';var _=require(_0x9dcf('0x0'));var util=require(_0x9dcf('0x1'));var logger=require(_0x9dcf('0x2'))(_0x9dcf('0x3'));var moment=require(_0x9dcf('0x4'));var BPromise=require(_0x9dcf('0x5'));var rp=require(_0x9dcf('0x6'));var attributes=require(_0x9dcf('0x7'));module[_0x9dcf('0x8')]=function(_0x3a1aaa,_0x3d89b0){return _0x3a1aaa[_0x9dcf('0x9')](_0x9dcf('0xa'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 1ff69fd..d107f72 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 _0x98f0=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x98f0,0xd0));var _0x098f=function(_0x1035d2,_0x48714c){_0x1035d2=_0x1035d2-0x0;var _0x2fddcc=_0x98f0[_0x1035d2];return _0x2fddcc;};'use strict';var _=require(_0x098f('0x0'));var util=require(_0x098f('0x1'));var moment=require(_0x098f('0x2'));var BPromise=require(_0x098f('0x3'));var rs=require(_0x098f('0x4'));var fs=require('fs');var db=require(_0x098f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x098f('0x6'))('rpc');var config=require(_0x098f('0x7'));var jayson=require(_0x098f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b20a0,_0xfd75c3,_0x5d65ed){return new BPromise(function(_0x6f8775,_0x47c6f){return client[_0x098f('0x9')](_0x2b20a0,_0x5d65ed)[_0x098f('0xa')](function(_0x8b2b25){logger[_0x098f('0xb')](_0x098f('0xc'),_0xfd75c3,_0x098f('0xd'));logger[_0x098f('0xe')](_0x098f('0xf'),_0xfd75c3,_0x098f('0xd'),JSON[_0x098f('0x10')](_0x8b2b25));if(_0x8b2b25['error']){if(_0x8b2b25[_0x098f('0x11')][_0x098f('0x12')]===0x1f4){logger['error'](_0x098f('0xc'),_0xfd75c3,_0x8b2b25[_0x098f('0x11')]['message']);return _0x47c6f(_0x8b2b25['error']['message']);}logger['error'](_0x098f('0xc'),_0xfd75c3,_0x8b2b25[_0x098f('0x11')][_0x098f('0x13')]);return _0x6f8775(_0x8b2b25[_0x098f('0x11')][_0x098f('0x13')]);}else{logger[_0x098f('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xfd75c3,'request\x20sent');_0x6f8775(_0x8b2b25['result']['message']);}})[_0x098f('0x14')](function(_0x2fd5a5){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0xfd75c3,_0x2fd5a5);_0x47c6f(_0x2fd5a5);});});} \ No newline at end of file +var _0x85a3=['catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x149566,_0x2c59ab){var _0x5e1a9d=function(_0xa6fa2){while(--_0xa6fa2){_0x149566['push'](_0x149566['shift']());}};_0x5e1a9d(++_0x2c59ab);}(_0x85a3,0x15a));var _0x385a=function(_0x57bcd6,_0x3008b8){_0x57bcd6=_0x57bcd6-0x0;var _0x30ba24=_0x85a3[_0x57bcd6];return _0x30ba24;};'use strict';var _=require(_0x385a('0x0'));var util=require(_0x385a('0x1'));var moment=require(_0x385a('0x2'));var BPromise=require(_0x385a('0x3'));var rs=require(_0x385a('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x385a('0x5'));var logger=require(_0x385a('0x6'))(_0x385a('0x7'));var config=require(_0x385a('0x8'));var jayson=require(_0x385a('0x9'));var client=jayson[_0x385a('0xa')][_0x385a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x523cde,_0x27e826,_0x5e1beb){return new BPromise(function(_0xe10cc5,_0x4cefbf){return client[_0x385a('0xc')](_0x523cde,_0x5e1beb)[_0x385a('0xd')](function(_0x380574){logger[_0x385a('0xe')](_0x385a('0xf'),_0x27e826,_0x385a('0x10'));logger[_0x385a('0x11')](_0x385a('0x12'),_0x27e826,_0x385a('0x10'),JSON['stringify'](_0x380574));if(_0x380574[_0x385a('0x13')]){if(_0x380574[_0x385a('0x13')]['code']===0x1f4){logger[_0x385a('0x13')](_0x385a('0xf'),_0x27e826,_0x380574[_0x385a('0x13')][_0x385a('0x14')]);return _0x4cefbf(_0x380574[_0x385a('0x13')][_0x385a('0x14')]);}logger[_0x385a('0x13')](_0x385a('0xf'),_0x27e826,_0x380574[_0x385a('0x13')][_0x385a('0x14')]);return _0xe10cc5(_0x380574[_0x385a('0x13')][_0x385a('0x14')]);}else{logger[_0x385a('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x27e826,_0x385a('0x10'));_0xe10cc5(_0x380574[_0x385a('0x15')][_0x385a('0x14')]);}})[_0x385a('0x16')](function(_0xb04571){logger['error'](_0x385a('0xf'),_0x27e826,_0xb04571);_0x4cefbf(_0xb04571);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 2fa9e0f..8b75cf1 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 _0x9f8d=['./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x29d87d,_0x23dc31){var _0x1fd84b=function(_0x4e2aa1){while(--_0x4e2aa1){_0x29d87d['push'](_0x29d87d['shift']());}};_0x1fd84b(++_0x23dc31);}(_0x9f8d,0xd5));var _0xd9f8=function(_0x4c2698,_0x2720c2){_0x4c2698=_0x4c2698-0x0;var _0x309bed=_0x9f8d[_0x4c2698];return _0x309bed;};'use strict';var multer=require(_0xd9f8('0x0'));var util=require('util');var path=require(_0xd9f8('0x1'));var express=require(_0xd9f8('0x2'));var router=express[_0xd9f8('0x3')]();var auth=require(_0xd9f8('0x4'));var interaction=require(_0xd9f8('0x5'));var config=require(_0xd9f8('0x6'));var controller=require(_0xd9f8('0x7'));router[_0xd9f8('0x8')]('/',auth[_0xd9f8('0x9')](),controller[_0xd9f8('0xa')]);router['get'](_0xd9f8('0xb'),auth[_0xd9f8('0x9')](),controller[_0xd9f8('0xc')]);router['get'](_0xd9f8('0xd'),auth['isAuthenticated'](),controller[_0xd9f8('0xe')]);router[_0xd9f8('0xf')]('/',auth[_0xd9f8('0x9')](),controller[_0xd9f8('0x10')]);router[_0xd9f8('0x11')]('/:id',auth[_0xd9f8('0x9')](),controller[_0xd9f8('0x12')]);router[_0xd9f8('0x13')](_0xd9f8('0xb'),auth[_0xd9f8('0x9')](),controller[_0xd9f8('0x14')]);module[_0xd9f8('0x15')]=router; \ No newline at end of file +var _0xc1ea=['update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','show','/:id/download','download','create','put','/:id'];(function(_0x54d1ae,_0x56a2b9){var _0x5b033b=function(_0x4e1cc9){while(--_0x4e1cc9){_0x54d1ae['push'](_0x54d1ae['shift']());}};_0x5b033b(++_0x56a2b9);}(_0xc1ea,0xb4));var _0xac1e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc1ea[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xac1e('0x0'));var util=require(_0xac1e('0x1'));var path=require(_0xac1e('0x2'));var express=require(_0xac1e('0x3'));var router=express[_0xac1e('0x4')]();var auth=require(_0xac1e('0x5'));var interaction=require(_0xac1e('0x6'));var config=require(_0xac1e('0x7'));var controller=require(_0xac1e('0x8'));router['get']('/',auth[_0xac1e('0x9')](),controller[_0xac1e('0xa')]);router[_0xac1e('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xac1e('0xc')]);router[_0xac1e('0xb')](_0xac1e('0xd'),auth[_0xac1e('0x9')](),controller[_0xac1e('0xe')]);router['post']('/',auth[_0xac1e('0x9')](),controller[_0xac1e('0xf')]);router[_0xac1e('0x10')](_0xac1e('0x11'),auth['isAuthenticated'](),controller[_0xac1e('0x12')]);router[_0xac1e('0x13')](_0xac1e('0x11'),auth[_0xac1e('0x9')](),controller[_0xac1e('0x14')]);module[_0xac1e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 239dac1..a623470 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 _0x3ece=['BOOLEAN','exports','STRING'];(function(_0x72a33d,_0x5691da){var _0x2621d5=function(_0x95b7c6){while(--_0x95b7c6){_0x72a33d['push'](_0x72a33d['shift']());}};_0x2621d5(++_0x5691da);}(_0x3ece,0x181));var _0xe3ec=function(_0x4e1924,_0x561843){_0x4e1924=_0x4e1924-0x0;var _0x5c3f20=_0x3ece[_0x4e1924];return _0x5c3f20;};'use strict';var Sequelize=require('sequelize');module[_0xe3ec('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xe3ec('0x1')]},'function':{'type':Sequelize[_0xe3ec('0x1')]},'format':{'type':Sequelize[_0xe3ec('0x1')]},'groupBy':{'type':Sequelize[_0xe3ec('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xe3ec('0x1')]},'custom':{'type':Sequelize[_0xe3ec('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xa774=['BOOLEAN','sequelize','TEXT','STRING'];(function(_0x5d2df7,_0x36fd29){var _0x46b121=function(_0x4d427b){while(--_0x4d427b){_0x5d2df7['push'](_0x5d2df7['shift']());}};_0x46b121(++_0x36fd29);}(_0xa774,0x71));var _0x4a77=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0xa774[_0x19159a];return _0xa677f4;};'use strict';var Sequelize=require(_0x4a77('0x0'));module['exports']={'field':{'type':Sequelize[_0x4a77('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x4a77('0x2')]},'groupBy':{'type':Sequelize[_0x4a77('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x4a77('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index a42bb92..44e0728 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 _0x5496=['ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','set','json','apply','update','then','destroy','sendStatus','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','add','day','merge','where','filter','map','includeAll','rows','catch','show','params','include','options','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x5496,0x175));var _0x6549=function(_0x17ad18,_0xa7ac00){_0x17ad18=_0x17ad18-0x0;var _0x2ce142=_0x5496[_0x17ad18];return _0x2ce142;};'use strict';var jsonpatch=require(_0x6549('0x0'));var rp=require(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require(_0x6549('0x3'));var Mustache=require(_0x6549('0x4'));var util=require('util');var path=require(_0x6549('0x5'));var sox=require('sox');var csv=require(_0x6549('0x6'));var ejs=require(_0x6549('0x7'));var fs=require('fs');var _=require(_0x6549('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6549('0x9'));var deskjs=require(_0x6549('0xa'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xb'));var Papa=require(_0x6549('0xc'));var qs=require(_0x6549('0xd'));var logger=require('../../config/logger')(_0x6549('0xe'));var utils=require(_0x6549('0xf'));var config=require(_0x6549('0x10'));var db=require(_0x6549('0x11'))['db'];function respondWithStatusCode(_0x1e5083,_0x3e08a6){_0x3e08a6=_0x3e08a6||0xcc;return function(_0x50fa35){if(_0x50fa35){return _0x1e5083['sendStatus'](_0x3e08a6);}return _0x1e5083[_0x6549('0x12')](_0x3e08a6)[_0x6549('0x13')]();};}function respondWithResult(_0x3c5f9b,_0x216620){_0x216620=_0x216620||0xc8;return function(_0x1a0f72){if(_0x1a0f72){return _0x3c5f9b['status'](_0x216620)['json'](_0x1a0f72);}};}function respondWithFilteredResult(_0x3f844f,_0x39d78c){return function(_0x57a149){if(_0x57a149){var _0x200ff1=_0x57a149[_0x6549('0x14')],_0x150fc8=_0x39d78c[_0x6549('0x15')],_0x195d25=_0x39d78c['offset']+_0x39d78c['limit'],_0x12b068;if(_0x195d25>=_0x200ff1){_0x195d25=_0x200ff1;_0x12b068=0xc8;}else{_0x12b068=0xce;}_0x3f844f[_0x6549('0x12')](_0x12b068);return _0x3f844f[_0x6549('0x16')]('Content-Range',_0x150fc8+'-'+_0x195d25+'/'+_0x200ff1)[_0x6549('0x17')](_0x57a149);}return null;};}function patchUpdates(_0x67acc0){return function(_0x4608fb){try{jsonpatch[_0x6549('0x18')](_0x4608fb,_0x67acc0,!![]);}catch(_0xffc8b9){return BPromise['reject'](_0xffc8b9);}return _0x4608fb['save']();};}function saveUpdates(_0x26a212,_0x48f037){return function(_0x56c15b){if(_0x56c15b){return _0x56c15b[_0x6549('0x19')](_0x26a212)[_0x6549('0x1a')](function(_0x19c4a6){return _0x19c4a6;});}return null;};}function removeEntity(_0xfca192,_0x236fd9){return function(_0x5ce3aa){if(_0x5ce3aa){return _0x5ce3aa[_0x6549('0x1b')]()['then'](function(){_0xfca192[_0x6549('0x12')](0xcc)[_0x6549('0x13')]();});}};}function handleEntityNotFound(_0x3992cf,_0x29c6b3){return function(_0x22bcf8){if(!_0x22bcf8){_0x3992cf[_0x6549('0x1c')](0x194);}return _0x22bcf8;};}function handleError(_0x427b47,_0x25bc01){_0x25bc01=_0x25bc01||0x1f4;return function(_0x2be467){logger[_0x6549('0x1d')](_0x2be467[_0x6549('0x1e')]);if(_0x2be467[_0x6549('0x1f')]){delete _0x2be467[_0x6549('0x1f')];}_0x427b47['status'](_0x25bc01)[_0x6549('0x20')](_0x2be467);};}exports[_0x6549('0x21')]=function(_0x53bbca,_0x126967){var _0x29f89e={},_0x3768cb={},_0x583c7d={'count':0x0,'rows':[]};var _0x31a95=db[_0x6549('0x22')][_0x6549('0x23')];_0x3768cb[_0x6549('0x24')]=_[_0x6549('0x25')](_0x31a95);var _0x3edf02={'dateStart':_0x53bbca[_0x6549('0x26')][_0x6549('0x27')],'dateEnd':_0x53bbca['query'][_0x6549('0x28')]};delete _0x53bbca[_0x6549('0x26')][_0x6549('0x27')];delete _0x53bbca['query'][_0x6549('0x28')];_0x3768cb['query']=_['keys'](_0x53bbca['query']);_0x3768cb[_0x6549('0x29')]=_[_0x6549('0x2a')](_0x3768cb['model'],_0x3768cb[_0x6549('0x26')]);_0x29f89e[_0x6549('0x2b')]=_[_0x6549('0x2a')](_0x3768cb[_0x6549('0x24')],qs[_0x6549('0x2c')](_0x53bbca[_0x6549('0x26')][_0x6549('0x2c')]));_0x29f89e['attributes']=_0x29f89e[_0x6549('0x2b')][_0x6549('0x2d')]?_0x29f89e[_0x6549('0x2b')]:_0x3768cb[_0x6549('0x24')];if(!_0x53bbca[_0x6549('0x26')][_0x6549('0x2e')]('nolimit')){_0x29f89e[_0x6549('0x2f')]=qs['limit'](_0x53bbca[_0x6549('0x26')]['limit']);_0x29f89e[_0x6549('0x15')]=qs[_0x6549('0x15')](_0x53bbca[_0x6549('0x26')]['offset']);}_0x29f89e[_0x6549('0x30')]=qs[_0x6549('0x31')](_0x53bbca[_0x6549('0x26')][_0x6549('0x31')]);_0x29f89e['where']=qs['filters'](_['pick'](_0x53bbca[_0x6549('0x26')],_0x3768cb[_0x6549('0x29')]));if(_0x3edf02['dateStart']){if(_0x3edf02[_0x6549('0x28')]){_0x3edf02[_0x6549('0x28')]=moment(_0x3edf02[_0x6549('0x28')])[_0x6549('0x32')](0x1,_0x6549('0x33'));}else{_0x3edf02['dateEnd']=moment(_0x3edf02['dateStart'])[_0x6549('0x32')](0x1,_0x6549('0x33'));}_[_0x6549('0x34')](_0x29f89e[_0x6549('0x35')],{'createdAt':{'$gte':_0x3edf02[_0x6549('0x27')],'$lte':_0x3edf02[_0x6549('0x28')]}});}if(_0x53bbca[_0x6549('0x26')][_0x6549('0x36')]){_0x29f89e[_0x6549('0x35')]=_[_0x6549('0x34')](_0x29f89e['where'],{'$or':_[_0x6549('0x37')](_0x29f89e[_0x6549('0x2b')],function(_0x2ea977){var _0x38f048={};_0x38f048[_0x2ea977]={'$like':'%'+_0x53bbca[_0x6549('0x26')]['filter']+'%'};return _0x38f048;})});}_0x29f89e=_['merge']({},_0x29f89e,_0x53bbca['options']);var _0x22b919={'where':_0x29f89e[_0x6549('0x35')]};return db[_0x6549('0x22')][_0x6549('0x14')](_0x22b919)['then'](function(_0x56ce9f){_0x583c7d[_0x6549('0x14')]=_0x56ce9f;if(_0x53bbca[_0x6549('0x26')][_0x6549('0x38')]){_0x29f89e['include']=[{'all':!![]}];}return db[_0x6549('0x22')]['findAll'](_0x29f89e);})[_0x6549('0x1a')](function(_0x2ec614){_0x583c7d[_0x6549('0x39')]=_0x2ec614;return _0x583c7d;})[_0x6549('0x1a')](respondWithFilteredResult(_0x126967,_0x29f89e))[_0x6549('0x3a')](handleError(_0x126967,null));};exports[_0x6549('0x3b')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':![],'where':{'id':_0xbbfdc9[_0x6549('0x3c')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x24')]=_[_0x6549('0x25')](db[_0x6549('0x22')][_0x6549('0x23')]);_0x309f45[_0x6549('0x26')]=_[_0x6549('0x25')](_0xbbfdc9[_0x6549('0x26')]);_0x309f45[_0x6549('0x29')]=_[_0x6549('0x2a')](_0x309f45[_0x6549('0x24')],_0x309f45[_0x6549('0x26')]);_0x132625[_0x6549('0x2b')]=_[_0x6549('0x2a')](_0x309f45['model'],qs[_0x6549('0x2c')](_0xbbfdc9[_0x6549('0x26')][_0x6549('0x2c')]));_0x132625[_0x6549('0x2b')]=_0x132625['attributes'][_0x6549('0x2d')]?_0x132625['attributes']:_0x309f45[_0x6549('0x24')];if(_0xbbfdc9[_0x6549('0x26')]['includeAll']){_0x132625[_0x6549('0x3d')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x34')]({},_0x132625,_0xbbfdc9[_0x6549('0x3e')]);return db[_0x6549('0x22')][_0x6549('0x3f')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x3a')](handleError(_0x4deaab,null));};exports[_0x6549('0x40')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x22')]['create'](_0x41d675[_0x6549('0x41')],{})[_0x6549('0x1a')](respondWithResult(_0x1712f3,0xc9))[_0x6549('0x3a')](handleError(_0x1712f3,null));};exports[_0x6549('0x42')]=function(_0xa4c650,_0x25a6ee){return db[_0x6549('0x22')][_0x6549('0x42')](_0xa4c650['body'],{'raw':![],'individualHooks':!![]})[_0x6549('0x1a')](respondWithResult(_0x25a6ee,0xc9))['catch'](handleError(_0x25a6ee,null));};exports[_0x6549('0x19')]=function(_0x1e09e1,_0x1da901){if(_0x1e09e1['body']['id']){delete _0x1e09e1[_0x6549('0x41')]['id'];}return db[_0x6549('0x22')][_0x6549('0x3f')]({'where':{'id':_0x1e09e1['params']['id']}})[_0x6549('0x1a')](handleEntityNotFound(_0x1da901,null))[_0x6549('0x1a')](saveUpdates(_0x1e09e1[_0x6549('0x41')],null))[_0x6549('0x1a')](respondWithResult(_0x1da901,null))[_0x6549('0x3a')](handleError(_0x1da901,null));};exports[_0x6549('0x1b')]=function(_0x489275,_0x28af00){return db['AnalyticFieldReport'][_0x6549('0x3f')]({'where':{'id':_0x489275[_0x6549('0x3c')]['id']}})[_0x6549('0x1a')](handleEntityNotFound(_0x28af00,null))[_0x6549('0x1a')](removeEntity(_0x28af00,null))[_0x6549('0x3a')](handleError(_0x28af00,null));};exports[_0x6549('0x43')]=function(_0x292b52,_0x2e59ad){return db[_0x6549('0x22')][_0x6549('0x1b')]({'where':{'id':_0x292b52[_0x6549('0x26')][_0x6549('0x44')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2e59ad,0xcc))[_0x6549('0x3a')](handleError(_0x2e59ad,null));};exports[_0x6549('0x45')]=function(_0x325c0a,_0x1eaa0f,_0x260097){return db[_0x6549('0x46')][_0x6549('0x47')]({'where':{'id':_0x325c0a[_0x6549('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1eaa0f,null))[_0x6549('0x1a')](function(_0x46e923){if(_0x46e923){return db[_0x6549('0x48')][_0x6549('0x49')](function(_0x2b0ba8){return db[_0x6549('0x22')][_0x6549('0x1b')]({'where':{'CustomReportId':_0x325c0a[_0x6549('0x3c')]['id']},'transaction':_0x2b0ba8})['then'](function(_0x201554){var _0x3b89d0=_[_0x6549('0x37')](_0x325c0a[_0x6549('0x41')],function(_0x46d2df){delete _0x46d2df['id'];_0x46d2df[_0x6549('0x4a')]=_0x325c0a['params']['id'];return _0x46d2df;});return db[_0x6549('0x22')][_0x6549('0x42')](_0x3b89d0,{'transaction':_0x2b0ba8});});})['then'](function(){return db[_0x6549('0x22')][_0x6549('0x4b')]({'where':{'CustomReportId':_0x325c0a[_0x6549('0x3c')]['id']}});});}})['then'](respondWithResult(_0x1eaa0f,null))[_0x6549('0x3a')](handleError(_0x1eaa0f,null));}; \ No newline at end of file +var _0x5d58=['length','nolimit','order','sort','where','filters','pick','add','day','merge','map','filter','options','AnalyticFieldReport','include','findAll','rows','show','params','includeAll','create','bulkCreate','catch','body','find','bulkDestroy','addFields','findOne','sequelize','transaction','CustomReportId','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','attributes','intersection','fields'];(function(_0x553765,_0x53dbda){var _0x24d87c=function(_0x9e185a){while(--_0x9e185a){_0x553765['push'](_0x553765['shift']());}};_0x24d87c(++_0x53dbda);}(_0x5d58,0x187));var _0x85d5=function(_0x387ea6,_0x10be93){_0x387ea6=_0x387ea6-0x0;var _0x30df26=_0x5d58[_0x387ea6];return _0x30df26;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x85d5('0x0'));var path=require(_0x85d5('0x1'));var sox=require('sox');var csv=require(_0x85d5('0x2'));var ejs=require(_0x85d5('0x3'));var fs=require('fs');var _=require('lodash');var squel=require(_0x85d5('0x4'));var crypto=require(_0x85d5('0x5'));var jsforce=require(_0x85d5('0x6'));var deskjs=require(_0x85d5('0x7'));var toCsv=require('to-csv');var querystring=require(_0x85d5('0x8'));var Papa=require(_0x85d5('0x9'));var qs=require('../../components/parsers/qs');var logger=require(_0x85d5('0xa'))('api');var utils=require(_0x85d5('0xb'));var config=require(_0x85d5('0xc'));var db=require(_0x85d5('0xd'))['db'];function respondWithStatusCode(_0x488dcb,_0x499b36){_0x499b36=_0x499b36||0xcc;return function(_0x4e147a){if(_0x4e147a){return _0x488dcb[_0x85d5('0xe')](_0x499b36);}return _0x488dcb[_0x85d5('0xf')](_0x499b36)[_0x85d5('0x10')]();};}function respondWithResult(_0x25369e,_0x229355){_0x229355=_0x229355||0xc8;return function(_0x18331f){if(_0x18331f){return _0x25369e[_0x85d5('0xf')](_0x229355)['json'](_0x18331f);}};}function respondWithFilteredResult(_0x4bbf2a,_0x4869ca){return function(_0x3e1285){if(_0x3e1285){var _0x226d34=_0x3e1285[_0x85d5('0x11')],_0x339d4f=_0x4869ca[_0x85d5('0x12')],_0x1704f0=_0x4869ca['offset']+_0x4869ca[_0x85d5('0x13')],_0x18a20c;if(_0x1704f0>=_0x226d34){_0x1704f0=_0x226d34;_0x18a20c=0xc8;}else{_0x18a20c=0xce;}_0x4bbf2a[_0x85d5('0xf')](_0x18a20c);return _0x4bbf2a[_0x85d5('0x14')](_0x85d5('0x15'),_0x339d4f+'-'+_0x1704f0+'/'+_0x226d34)[_0x85d5('0x16')](_0x3e1285);}return null;};}function patchUpdates(_0x3dc83c){return function(_0x2dbf13){try{jsonpatch[_0x85d5('0x17')](_0x2dbf13,_0x3dc83c,!![]);}catch(_0x17652b){return BPromise[_0x85d5('0x18')](_0x17652b);}return _0x2dbf13[_0x85d5('0x19')]();};}function saveUpdates(_0x432bd6,_0x34b981){return function(_0x3df634){if(_0x3df634){return _0x3df634[_0x85d5('0x1a')](_0x432bd6)[_0x85d5('0x1b')](function(_0x54e991){return _0x54e991;});}return null;};}function removeEntity(_0x1d6134,_0x53bd11){return function(_0xc56ad1){if(_0xc56ad1){return _0xc56ad1[_0x85d5('0x1c')]()['then'](function(){_0x1d6134[_0x85d5('0xf')](0xcc)[_0x85d5('0x10')]();});}};}function handleEntityNotFound(_0x52ef3a,_0x58290b){return function(_0x347337){if(!_0x347337){_0x52ef3a['sendStatus'](0x194);}return _0x347337;};}function handleError(_0x2f2bae,_0x5ce96e){_0x5ce96e=_0x5ce96e||0x1f4;return function(_0x240000){logger[_0x85d5('0x1d')](_0x240000['stack']);if(_0x240000['name']){delete _0x240000['name'];}_0x2f2bae['status'](_0x5ce96e)[_0x85d5('0x1e')](_0x240000);};}exports[_0x85d5('0x1f')]=function(_0x244353,_0x466bbd){var _0x12fea3={},_0xef2405={},_0x53f5b9={'count':0x0,'rows':[]};var _0x7e9a11=db['AnalyticFieldReport'][_0x85d5('0x20')];_0xef2405[_0x85d5('0x21')]=_[_0x85d5('0x22')](_0x7e9a11);var _0x5cc2cf={'dateStart':_0x244353[_0x85d5('0x23')][_0x85d5('0x24')],'dateEnd':_0x244353[_0x85d5('0x23')][_0x85d5('0x25')]};delete _0x244353[_0x85d5('0x23')]['dateStart'];delete _0x244353[_0x85d5('0x23')][_0x85d5('0x25')];_0xef2405[_0x85d5('0x23')]=_[_0x85d5('0x22')](_0x244353[_0x85d5('0x23')]);_0xef2405['filters']=_['intersection'](_0xef2405[_0x85d5('0x21')],_0xef2405[_0x85d5('0x23')]);_0x12fea3[_0x85d5('0x26')]=_[_0x85d5('0x27')](_0xef2405[_0x85d5('0x21')],qs['fields'](_0x244353[_0x85d5('0x23')][_0x85d5('0x28')]));_0x12fea3['attributes']=_0x12fea3['attributes'][_0x85d5('0x29')]?_0x12fea3[_0x85d5('0x26')]:_0xef2405['model'];if(!_0x244353[_0x85d5('0x23')]['hasOwnProperty'](_0x85d5('0x2a'))){_0x12fea3[_0x85d5('0x13')]=qs['limit'](_0x244353[_0x85d5('0x23')][_0x85d5('0x13')]);_0x12fea3[_0x85d5('0x12')]=qs[_0x85d5('0x12')](_0x244353['query']['offset']);}_0x12fea3[_0x85d5('0x2b')]=qs[_0x85d5('0x2c')](_0x244353[_0x85d5('0x23')][_0x85d5('0x2c')]);_0x12fea3[_0x85d5('0x2d')]=qs[_0x85d5('0x2e')](_[_0x85d5('0x2f')](_0x244353[_0x85d5('0x23')],_0xef2405[_0x85d5('0x2e')]));if(_0x5cc2cf['dateStart']){if(_0x5cc2cf['dateEnd']){_0x5cc2cf[_0x85d5('0x25')]=moment(_0x5cc2cf[_0x85d5('0x25')])[_0x85d5('0x30')](0x1,_0x85d5('0x31'));}else{_0x5cc2cf[_0x85d5('0x25')]=moment(_0x5cc2cf[_0x85d5('0x24')])[_0x85d5('0x30')](0x1,_0x85d5('0x31'));}_['merge'](_0x12fea3[_0x85d5('0x2d')],{'createdAt':{'$gte':_0x5cc2cf[_0x85d5('0x24')],'$lte':_0x5cc2cf[_0x85d5('0x25')]}});}if(_0x244353[_0x85d5('0x23')]['filter']){_0x12fea3[_0x85d5('0x2d')]=_[_0x85d5('0x32')](_0x12fea3[_0x85d5('0x2d')],{'$or':_[_0x85d5('0x33')](_0x12fea3['attributes'],function(_0x34caed){var _0x5bb970={};_0x5bb970[_0x34caed]={'$like':'%'+_0x244353['query'][_0x85d5('0x34')]+'%'};return _0x5bb970;})});}_0x12fea3=_['merge']({},_0x12fea3,_0x244353[_0x85d5('0x35')]);var _0x5ddba7={'where':_0x12fea3['where']};return db[_0x85d5('0x36')][_0x85d5('0x11')](_0x5ddba7)[_0x85d5('0x1b')](function(_0x1beffc){_0x53f5b9[_0x85d5('0x11')]=_0x1beffc;if(_0x244353['query']['includeAll']){_0x12fea3[_0x85d5('0x37')]=[{'all':!![]}];}return db[_0x85d5('0x36')][_0x85d5('0x38')](_0x12fea3);})[_0x85d5('0x1b')](function(_0xdd8b3e){_0x53f5b9[_0x85d5('0x39')]=_0xdd8b3e;return _0x53f5b9;})['then'](respondWithFilteredResult(_0x466bbd,_0x12fea3))['catch'](handleError(_0x466bbd,null));};exports[_0x85d5('0x3a')]=function(_0x52c99b,_0xfbf466){var _0x18e94d={'raw':![],'where':{'id':_0x52c99b[_0x85d5('0x3b')]['id']}},_0x7dd430={};_0x7dd430[_0x85d5('0x21')]=_['keys'](db['AnalyticFieldReport'][_0x85d5('0x20')]);_0x7dd430[_0x85d5('0x23')]=_[_0x85d5('0x22')](_0x52c99b[_0x85d5('0x23')]);_0x7dd430[_0x85d5('0x2e')]=_[_0x85d5('0x27')](_0x7dd430[_0x85d5('0x21')],_0x7dd430[_0x85d5('0x23')]);_0x18e94d[_0x85d5('0x26')]=_[_0x85d5('0x27')](_0x7dd430[_0x85d5('0x21')],qs[_0x85d5('0x28')](_0x52c99b[_0x85d5('0x23')][_0x85d5('0x28')]));_0x18e94d[_0x85d5('0x26')]=_0x18e94d[_0x85d5('0x26')][_0x85d5('0x29')]?_0x18e94d['attributes']:_0x7dd430['model'];if(_0x52c99b[_0x85d5('0x23')][_0x85d5('0x3c')]){_0x18e94d[_0x85d5('0x37')]=[{'all':!![]}];}_0x18e94d=_[_0x85d5('0x32')]({},_0x18e94d,_0x52c99b[_0x85d5('0x35')]);return db[_0x85d5('0x36')]['find'](_0x18e94d)[_0x85d5('0x1b')](handleEntityNotFound(_0xfbf466,null))['then'](respondWithResult(_0xfbf466,null))['catch'](handleError(_0xfbf466,null));};exports[_0x85d5('0x3d')]=function(_0x13ab32,_0x12a03){return db[_0x85d5('0x36')][_0x85d5('0x3d')](_0x13ab32['body'],{})[_0x85d5('0x1b')](respondWithResult(_0x12a03,0xc9))['catch'](handleError(_0x12a03,null));};exports[_0x85d5('0x3e')]=function(_0xd8db57,_0x219154){return db['AnalyticFieldReport']['bulkCreate'](_0xd8db57['body'],{'raw':![],'individualHooks':!![]})[_0x85d5('0x1b')](respondWithResult(_0x219154,0xc9))[_0x85d5('0x3f')](handleError(_0x219154,null));};exports[_0x85d5('0x1a')]=function(_0x520d66,_0x5a5cf1){if(_0x520d66[_0x85d5('0x40')]['id']){delete _0x520d66[_0x85d5('0x40')]['id'];}return db[_0x85d5('0x36')][_0x85d5('0x41')]({'where':{'id':_0x520d66['params']['id']}})[_0x85d5('0x1b')](handleEntityNotFound(_0x5a5cf1,null))[_0x85d5('0x1b')](saveUpdates(_0x520d66[_0x85d5('0x40')],null))[_0x85d5('0x1b')](respondWithResult(_0x5a5cf1,null))[_0x85d5('0x3f')](handleError(_0x5a5cf1,null));};exports[_0x85d5('0x1c')]=function(_0x31cdeb,_0x34b784){return db[_0x85d5('0x36')][_0x85d5('0x41')]({'where':{'id':_0x31cdeb[_0x85d5('0x3b')]['id']}})[_0x85d5('0x1b')](handleEntityNotFound(_0x34b784,null))[_0x85d5('0x1b')](removeEntity(_0x34b784,null))[_0x85d5('0x3f')](handleError(_0x34b784,null));};exports[_0x85d5('0x42')]=function(_0x4ce2ab,_0x19603e){return db[_0x85d5('0x36')][_0x85d5('0x1c')]({'where':{'id':_0x4ce2ab[_0x85d5('0x23')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x85d5('0x1b')](respondWithResult(_0x19603e,0xcc))['catch'](handleError(_0x19603e,null));};exports[_0x85d5('0x43')]=function(_0x363aeb,_0x2755cc,_0x261007){return db['AnalyticCustomReport'][_0x85d5('0x44')]({'where':{'id':_0x363aeb['params']['id']}})['then'](handleEntityNotFound(_0x2755cc,null))['then'](function(_0x25b90d){if(_0x25b90d){return db[_0x85d5('0x45')][_0x85d5('0x46')](function(_0x42313f){return db[_0x85d5('0x36')]['destroy']({'where':{'CustomReportId':_0x363aeb['params']['id']},'transaction':_0x42313f})[_0x85d5('0x1b')](function(_0x43457c){var _0x421ba7=_[_0x85d5('0x33')](_0x363aeb['body'],function(_0x3062ea){delete _0x3062ea['id'];_0x3062ea[_0x85d5('0x47')]=_0x363aeb[_0x85d5('0x3b')]['id'];return _0x3062ea;});return db['AnalyticFieldReport']['bulkCreate'](_0x421ba7,{'transaction':_0x42313f});});})[_0x85d5('0x1b')](function(){return db[_0x85d5('0x36')][_0x85d5('0x38')]({'where':{'CustomReportId':_0x363aeb['params']['id']}});});}})[_0x85d5('0x1b')](respondWithResult(_0x2755cc,null))[_0x85d5('0x3f')](handleError(_0x2755cc,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 92cfda6..cc2d370 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 _0x80c1=['util','../../config/logger','api','moment','bluebird','request-promise','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash'];(function(_0x2b10bc,_0x537612){var _0x192c1d=function(_0x497556){while(--_0x497556){_0x2b10bc['push'](_0x2b10bc['shift']());}};_0x192c1d(++_0x537612);}(_0x80c1,0xc5));var _0x180c=function(_0x44d116,_0x4932bc){_0x44d116=_0x44d116-0x0;var _0x142e09=_0x80c1[_0x44d116];return _0x142e09;};'use strict';var _=require(_0x180c('0x0'));var util=require(_0x180c('0x1'));var logger=require(_0x180c('0x2'))(_0x180c('0x3'));var moment=require(_0x180c('0x4'));var BPromise=require(_0x180c('0x5'));var rp=require(_0x180c('0x6'));var attributes=require(_0x180c('0x7'));module[_0x180c('0x8')]=function(_0x2d96f2,_0x590dd5){return _0x2d96f2['define'](_0x180c('0x9'),attributes,{'tableName':_0x180c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2539=['lodash','../../config/logger','moment','bluebird','request-promise','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields'];(function(_0x19da21,_0x3c8951){var _0x161cbc=function(_0x319740){while(--_0x319740){_0x19da21['push'](_0x19da21['shift']());}};_0x161cbc(++_0x3c8951);}(_0x2539,0x6e));var _0x9253=function(_0x1dcda3,_0x55eb8c){_0x1dcda3=_0x1dcda3-0x0;var _0x24279a=_0x2539[_0x1dcda3];return _0x24279a;};'use strict';var _=require(_0x9253('0x0'));var util=require('util');var logger=require(_0x9253('0x1'))('api');var moment=require(_0x9253('0x2'));var BPromise=require(_0x9253('0x3'));var rp=require(_0x9253('0x4'));var attributes=require(_0x9253('0x5'));module[_0x9253('0x6')]=function(_0x47ad49,_0x364c3a){return _0x47ad49[_0x9253('0x7')](_0x9253('0x8'),attributes,{'tableName':_0x9253('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index aef7f74..20660d2 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 _0x3729=['AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x383f96,_0x136f62){var _0x4aa968=function(_0x55ad14){while(--_0x55ad14){_0x383f96['push'](_0x383f96['shift']());}};_0x4aa968(++_0x136f62);}(_0x3729,0xf1));var _0x9372=function(_0x356116,_0x4d2c42){_0x356116=_0x356116-0x0;var _0x233a6c=_0x3729[_0x356116];return _0x233a6c;};'use strict';var _=require(_0x9372('0x0'));var util=require(_0x9372('0x1'));var moment=require(_0x9372('0x2'));var BPromise=require(_0x9372('0x3'));var rs=require(_0x9372('0x4'));var fs=require('fs');var db=require(_0x9372('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9372('0x6'));var config=require(_0x9372('0x7'));var jayson=require(_0x9372('0x8'));var client=jayson[_0x9372('0x9')][_0x9372('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x336c06,_0x4b2681,_0x1d5482){return new BPromise(function(_0x45400e,_0x4e36e9){return client['request'](_0x336c06,_0x1d5482)['then'](function(_0x273966){logger['info'](_0x9372('0xb'),_0x4b2681,_0x9372('0xc'));logger[_0x9372('0xd')](_0x9372('0xe'),_0x4b2681,_0x9372('0xc'),JSON[_0x9372('0xf')](_0x273966));if(_0x273966[_0x9372('0x10')]){if(_0x273966[_0x9372('0x10')]['code']===0x1f4){logger['error'](_0x9372('0xb'),_0x4b2681,_0x273966[_0x9372('0x10')][_0x9372('0x11')]);return _0x4e36e9(_0x273966['error'][_0x9372('0x11')]);}logger[_0x9372('0x10')](_0x9372('0xb'),_0x4b2681,_0x273966[_0x9372('0x10')]['message']);return _0x45400e(_0x273966[_0x9372('0x10')][_0x9372('0x11')]);}else{logger['info'](_0x9372('0xb'),_0x4b2681,_0x9372('0xc'));_0x45400e(_0x273966['result']['message']);}})['catch'](function(_0x26f051){logger[_0x9372('0x10')](_0x9372('0xb'),_0x4b2681,_0x26f051);_0x4e36e9(_0x26f051);});});} \ No newline at end of file +var _0x9f75=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','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'];(function(_0x5105bd,_0x22efe7){var _0x41b3be=function(_0xa40bf){while(--_0xa40bf){_0x5105bd['push'](_0x5105bd['shift']());}};_0x41b3be(++_0x22efe7);}(_0x9f75,0x16e));var _0x59f7=function(_0x52b6a0,_0x40a5b8){_0x52b6a0=_0x52b6a0-0x0;var _0x5e9566=_0x9f75[_0x52b6a0];return _0x5e9566;};'use strict';var _=require(_0x59f7('0x0'));var util=require(_0x59f7('0x1'));var moment=require(_0x59f7('0x2'));var BPromise=require(_0x59f7('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x59f7('0x4'))['db'];var utils=require(_0x59f7('0x5'));var logger=require(_0x59f7('0x6'))(_0x59f7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x59f7('0x8')][_0x59f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x462acc,_0x5a123d,_0x22a853){return new BPromise(function(_0x1caf3f,_0x1ccec4){return client[_0x59f7('0xa')](_0x462acc,_0x22a853)[_0x59f7('0xb')](function(_0x4dc7b0){logger[_0x59f7('0xc')](_0x59f7('0xd'),_0x5a123d,_0x59f7('0xe'));logger[_0x59f7('0xf')](_0x59f7('0x10'),_0x5a123d,_0x59f7('0xe'),JSON[_0x59f7('0x11')](_0x4dc7b0));if(_0x4dc7b0['error']){if(_0x4dc7b0[_0x59f7('0x12')][_0x59f7('0x13')]===0x1f4){logger[_0x59f7('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5a123d,_0x4dc7b0[_0x59f7('0x12')]['message']);return _0x1ccec4(_0x4dc7b0[_0x59f7('0x12')][_0x59f7('0x14')]);}logger[_0x59f7('0x12')](_0x59f7('0xd'),_0x5a123d,_0x4dc7b0[_0x59f7('0x12')][_0x59f7('0x14')]);return _0x1caf3f(_0x4dc7b0[_0x59f7('0x12')][_0x59f7('0x14')]);}else{logger[_0x59f7('0xc')](_0x59f7('0xd'),_0x5a123d,_0x59f7('0xe'));_0x1caf3f(_0x4dc7b0[_0x59f7('0x15')]['message']);}})[_0x59f7('0x16')](function(_0x4f101c){logger[_0x59f7('0x12')](_0x59f7('0xd'),_0x5a123d,_0x4f101c);_0x1ccec4(_0x4f101c);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 1b9fc19..5c7473b 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 _0x6598=['bulkDestroy','delete','destroy','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','show','post','isAuthenticated','create','/create_many','bulkCreate','/:id/create_many','addFields','put','update'];(function(_0x1d99d2,_0x25bbfd){var _0xeac936=function(_0x2a7ff1){while(--_0x2a7ff1){_0x1d99d2['push'](_0x1d99d2['shift']());}};_0xeac936(++_0x25bbfd);}(_0x6598,0x1b8));var _0x8659=function(_0xea3649,_0x557e6a){_0xea3649=_0xea3649-0x0;var _0x5e7d67=_0x6598[_0xea3649];return _0x5e7d67;};'use strict';var multer=require('multer');var util=require(_0x8659('0x0'));var path=require('path');var express=require(_0x8659('0x1'));var router=express[_0x8659('0x2')]();var auth=require(_0x8659('0x3'));var interaction=require(_0x8659('0x4'));var config=require(_0x8659('0x5'));var controller=require(_0x8659('0x6'));router[_0x8659('0x7')]('/',auth['isAuthenticated'](),controller[_0x8659('0x8')]);router[_0x8659('0x7')](_0x8659('0x9'),auth['isAuthenticated'](),controller[_0x8659('0xa')]);router[_0x8659('0xb')]('/',auth[_0x8659('0xc')](),controller[_0x8659('0xd')]);router[_0x8659('0xb')](_0x8659('0xe'),auth[_0x8659('0xc')](),controller[_0x8659('0xf')]);router[_0x8659('0xb')](_0x8659('0x10'),auth[_0x8659('0xc')](),controller[_0x8659('0x11')]);router[_0x8659('0x12')](_0x8659('0x9'),auth[_0x8659('0xc')](),controller[_0x8659('0x13')]);router['delete']('/destroy_many',auth[_0x8659('0xc')](),controller[_0x8659('0x14')]);router[_0x8659('0x15')]('/:id',auth[_0x8659('0xc')](),controller[_0x8659('0x16')]);module['exports']=router; \ No newline at end of file +var _0x4448=['./analyticFieldReport.controller','get','isAuthenticated','show','post','create','/create_many','/:id/create_many','addFields','put','/:id','update','delete','/destroy_many','bulkDestroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x1dde47,_0x3ab263){var _0x54b354=function(_0x1e2a6e){while(--_0x1e2a6e){_0x1dde47['push'](_0x1dde47['shift']());}};_0x54b354(++_0x3ab263);}(_0x4448,0x135));var _0x8444=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4448[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x8444('0x0'));var util=require(_0x8444('0x1'));var path=require(_0x8444('0x2'));var express=require(_0x8444('0x3'));var router=express['Router']();var auth=require(_0x8444('0x4'));var interaction=require(_0x8444('0x5'));var config=require('../../config/environment');var controller=require(_0x8444('0x6'));router[_0x8444('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8444('0x7')]('/:id',auth[_0x8444('0x8')](),controller[_0x8444('0x9')]);router[_0x8444('0xa')]('/',auth[_0x8444('0x8')](),controller[_0x8444('0xb')]);router[_0x8444('0xa')](_0x8444('0xc'),auth[_0x8444('0x8')](),controller['bulkCreate']);router['post'](_0x8444('0xd'),auth['isAuthenticated'](),controller[_0x8444('0xe')]);router[_0x8444('0xf')](_0x8444('0x10'),auth[_0x8444('0x8')](),controller[_0x8444('0x11')]);router[_0x8444('0x12')](_0x8444('0x13'),auth['isAuthenticated'](),controller[_0x8444('0x14')]);router['delete'](_0x8444('0x10'),auth[_0x8444('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index f1bb500..1219245 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 _0x587e=['STRING','name','TEXT'];(function(_0xb78f74,_0x2548d1){var _0x465eb1=function(_0x590567){while(--_0x590567){_0xb78f74['push'](_0xb78f74['shift']());}};_0x465eb1(++_0x2548d1);}(_0x587e,0x114));var _0xe587=function(_0x302b74,_0x1916bb){_0x302b74=_0x302b74-0x0;var _0x53e970=_0x587e[_0x302b74];return _0x53e970;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe587('0x0')],'allowNull':![],'unique':_0xe587('0x1')},'table':{'type':Sequelize[_0xe587('0x0')]},'metric':{'type':Sequelize[_0xe587('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4738=['STRING','TEXT','exports','name'];(function(_0x11b1aa,_0x6b7b8){var _0xa0c21=function(_0x3336be){while(--_0x3336be){_0x11b1aa['push'](_0x11b1aa['shift']());}};_0xa0c21(++_0x6b7b8);}(_0x4738,0xfa));var _0x8473=function(_0x65959d,_0x4dd888){_0x65959d=_0x65959d-0x0;var _0x2d71aa=_0x4738[_0x65959d];return _0x2d71aa;};'use strict';var Sequelize=require('sequelize');module[_0x8473('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8473('0x1')},'table':{'type':Sequelize[_0x8473('0x2')]},'metric':{'type':Sequelize[_0x8473('0x3')]},'description':{'type':Sequelize[_0x8473('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index e3e90c7..3b561b8 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 _0x5c82=['offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','AnalyticMetric','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','day','add','filter','merge','map','options','includeAll','include','rows','show','params','find','create','body','catch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count'];(function(_0x99ba67,_0x10eae9){var _0x5c4f7d=function(_0x2962f6){while(--_0x2962f6){_0x99ba67['push'](_0x99ba67['shift']());}};_0x5c4f7d(++_0x10eae9);}(_0x5c82,0x18c));var _0x25c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c82[_0x3dd15e];return _0x231fd0;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x25c8('0x0'));var moment=require(_0x25c8('0x1'));var BPromise=require(_0x25c8('0x2'));var Mustache=require('mustache');var util=require(_0x25c8('0x3'));var path=require(_0x25c8('0x4'));var sox=require(_0x25c8('0x5'));var csv=require(_0x25c8('0x6'));var ejs=require(_0x25c8('0x7'));var fs=require('fs');var _=require(_0x25c8('0x8'));var squel=require(_0x25c8('0x9'));var crypto=require(_0x25c8('0xa'));var jsforce=require(_0x25c8('0xb'));var deskjs=require(_0x25c8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x25c8('0xd'));var Papa=require(_0x25c8('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0x25c8('0xf'))(_0x25c8('0x10'));var utils=require(_0x25c8('0x11'));var config=require(_0x25c8('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f9bad,_0x219c09){_0x219c09=_0x219c09||0xcc;return function(_0x568500){if(_0x568500){return _0x3f9bad[_0x25c8('0x13')](_0x219c09);}return _0x3f9bad[_0x25c8('0x14')](_0x219c09)[_0x25c8('0x15')]();};}function respondWithResult(_0x36a545,_0x5a3b36){_0x5a3b36=_0x5a3b36||0xc8;return function(_0x538a83){if(_0x538a83){return _0x36a545[_0x25c8('0x14')](_0x5a3b36)[_0x25c8('0x16')](_0x538a83);}};}function respondWithFilteredResult(_0x248039,_0x332409){return function(_0x2c0171){if(_0x2c0171){var _0x168452=_0x2c0171[_0x25c8('0x17')],_0x32fd9a=_0x332409[_0x25c8('0x18')],_0x1d7442=_0x332409[_0x25c8('0x18')]+_0x332409['limit'],_0x19823a;if(_0x1d7442>=_0x168452){_0x1d7442=_0x168452;_0x19823a=0xc8;}else{_0x19823a=0xce;}_0x248039[_0x25c8('0x14')](_0x19823a);return _0x248039[_0x25c8('0x19')](_0x25c8('0x1a'),_0x32fd9a+'-'+_0x1d7442+'/'+_0x168452)['json'](_0x2c0171);}return null;};}function patchUpdates(_0x3ed486){return function(_0x26ed00){try{jsonpatch['apply'](_0x26ed00,_0x3ed486,!![]);}catch(_0x1a543e){return BPromise[_0x25c8('0x1b')](_0x1a543e);}return _0x26ed00[_0x25c8('0x1c')]();};}function saveUpdates(_0x152050,_0x161022){return function(_0x28a93e){if(_0x28a93e){return _0x28a93e[_0x25c8('0x1d')](_0x152050)[_0x25c8('0x1e')](function(_0x1617c7){return _0x1617c7;});}return null;};}function removeEntity(_0x453831,_0x25e31c){return function(_0x7ed8e7){if(_0x7ed8e7){return _0x7ed8e7[_0x25c8('0x1f')]()['then'](function(){_0x453831[_0x25c8('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27dd3a,_0x161a67){return function(_0x4c9502){if(!_0x4c9502){_0x27dd3a[_0x25c8('0x13')](0x194);}return _0x4c9502;};}function handleError(_0x399d49,_0x42357d){_0x42357d=_0x42357d||0x1f4;return function(_0x1801cb){logger[_0x25c8('0x20')](_0x1801cb[_0x25c8('0x21')]);if(_0x1801cb[_0x25c8('0x22')]){delete _0x1801cb[_0x25c8('0x22')];}_0x399d49[_0x25c8('0x14')](_0x42357d)[_0x25c8('0x23')](_0x1801cb);};}exports[_0x25c8('0x24')]=function(_0x37c2ef,_0x4d94b1){var _0x3a1478={},_0x362a9f={},_0x12fd97={'count':0x0,'rows':[]};var _0x1b7c7f=db[_0x25c8('0x25')][_0x25c8('0x26')];_0x362a9f[_0x25c8('0x27')]=_[_0x25c8('0x28')](_0x1b7c7f);var _0x1803c0={'dateStart':_0x37c2ef[_0x25c8('0x29')][_0x25c8('0x2a')],'dateEnd':_0x37c2ef[_0x25c8('0x29')][_0x25c8('0x2b')]};delete _0x37c2ef[_0x25c8('0x29')][_0x25c8('0x2a')];delete _0x37c2ef[_0x25c8('0x29')][_0x25c8('0x2b')];_0x362a9f['query']=_[_0x25c8('0x28')](_0x37c2ef[_0x25c8('0x29')]);_0x362a9f[_0x25c8('0x2c')]=_['intersection'](_0x362a9f[_0x25c8('0x27')],_0x362a9f[_0x25c8('0x29')]);_0x3a1478[_0x25c8('0x2d')]=_[_0x25c8('0x2e')](_0x362a9f[_0x25c8('0x27')],qs[_0x25c8('0x2f')](_0x37c2ef[_0x25c8('0x29')][_0x25c8('0x2f')]));_0x3a1478[_0x25c8('0x2d')]=_0x3a1478[_0x25c8('0x2d')][_0x25c8('0x30')]?_0x3a1478[_0x25c8('0x2d')]:_0x362a9f[_0x25c8('0x27')];if(!_0x37c2ef['query'][_0x25c8('0x31')](_0x25c8('0x32'))){_0x3a1478[_0x25c8('0x33')]=qs[_0x25c8('0x33')](_0x37c2ef[_0x25c8('0x29')]['limit']);_0x3a1478[_0x25c8('0x18')]=qs[_0x25c8('0x18')](_0x37c2ef[_0x25c8('0x29')][_0x25c8('0x18')]);}_0x3a1478['order']=qs[_0x25c8('0x34')](_0x37c2ef[_0x25c8('0x29')][_0x25c8('0x34')]);_0x3a1478[_0x25c8('0x35')]=qs[_0x25c8('0x2c')](_[_0x25c8('0x36')](_0x37c2ef[_0x25c8('0x29')],_0x362a9f[_0x25c8('0x2c')]));if(_0x1803c0[_0x25c8('0x2a')]){if(_0x1803c0[_0x25c8('0x2b')]){_0x1803c0[_0x25c8('0x2b')]=moment(_0x1803c0[_0x25c8('0x2b')])['add'](0x1,_0x25c8('0x37'));}else{_0x1803c0[_0x25c8('0x2b')]=moment(_0x1803c0[_0x25c8('0x2a')])[_0x25c8('0x38')](0x1,'day');}_['merge'](_0x3a1478['where'],{'createdAt':{'$gte':_0x1803c0[_0x25c8('0x2a')],'$lte':_0x1803c0[_0x25c8('0x2b')]}});}if(_0x37c2ef[_0x25c8('0x29')][_0x25c8('0x39')]){_0x3a1478['where']=_[_0x25c8('0x3a')](_0x3a1478[_0x25c8('0x35')],{'$or':_[_0x25c8('0x3b')](_0x3a1478[_0x25c8('0x2d')],function(_0x553ffd){var _0x184ed1={};_0x184ed1[_0x553ffd]={'$like':'%'+_0x37c2ef[_0x25c8('0x29')][_0x25c8('0x39')]+'%'};return _0x184ed1;})});}_0x3a1478=_['merge']({},_0x3a1478,_0x37c2ef[_0x25c8('0x3c')]);var _0x54ffb9={'where':_0x3a1478[_0x25c8('0x35')]};return db[_0x25c8('0x25')][_0x25c8('0x17')](_0x54ffb9)['then'](function(_0x509c55){_0x12fd97[_0x25c8('0x17')]=_0x509c55;if(_0x37c2ef[_0x25c8('0x29')][_0x25c8('0x3d')]){_0x3a1478[_0x25c8('0x3e')]=[{'all':!![]}];}return db[_0x25c8('0x25')]['findAll'](_0x3a1478);})[_0x25c8('0x1e')](function(_0x40951a){_0x12fd97[_0x25c8('0x3f')]=_0x40951a;return _0x12fd97;})[_0x25c8('0x1e')](respondWithFilteredResult(_0x4d94b1,_0x3a1478))['catch'](handleError(_0x4d94b1,null));};exports[_0x25c8('0x40')]=function(_0x239cdd,_0x2c84a7){var _0x16fdc3={'raw':!![],'where':{'id':_0x239cdd[_0x25c8('0x41')]['id']}},_0x124d19={};_0x124d19['model']=_[_0x25c8('0x28')](db[_0x25c8('0x25')]['rawAttributes']);_0x124d19[_0x25c8('0x29')]=_[_0x25c8('0x28')](_0x239cdd[_0x25c8('0x29')]);_0x124d19[_0x25c8('0x2c')]=_[_0x25c8('0x2e')](_0x124d19['model'],_0x124d19['query']);_0x16fdc3[_0x25c8('0x2d')]=_[_0x25c8('0x2e')](_0x124d19[_0x25c8('0x27')],qs['fields'](_0x239cdd[_0x25c8('0x29')][_0x25c8('0x2f')]));_0x16fdc3[_0x25c8('0x2d')]=_0x16fdc3[_0x25c8('0x2d')][_0x25c8('0x30')]?_0x16fdc3[_0x25c8('0x2d')]:_0x124d19[_0x25c8('0x27')];if(_0x239cdd[_0x25c8('0x29')][_0x25c8('0x3d')]){_0x16fdc3['include']=[{'all':!![]}];}_0x16fdc3=_['merge']({},_0x16fdc3,_0x239cdd[_0x25c8('0x3c')]);return db[_0x25c8('0x25')][_0x25c8('0x42')](_0x16fdc3)[_0x25c8('0x1e')](handleEntityNotFound(_0x2c84a7,null))[_0x25c8('0x1e')](respondWithResult(_0x2c84a7,null))['catch'](handleError(_0x2c84a7,null));};exports[_0x25c8('0x43')]=function(_0x3515c7,_0x242530){return db[_0x25c8('0x25')][_0x25c8('0x43')](_0x3515c7[_0x25c8('0x44')],{})[_0x25c8('0x1e')](respondWithResult(_0x242530,0xc9))[_0x25c8('0x45')](handleError(_0x242530,null));};exports[_0x25c8('0x1d')]=function(_0x2be3b,_0x58def4){if(_0x2be3b[_0x25c8('0x44')]['id']){delete _0x2be3b[_0x25c8('0x44')]['id'];}return db[_0x25c8('0x25')]['find']({'where':{'id':_0x2be3b['params']['id']}})[_0x25c8('0x1e')](handleEntityNotFound(_0x58def4,null))[_0x25c8('0x1e')](saveUpdates(_0x2be3b['body'],null))['then'](respondWithResult(_0x58def4,null))[_0x25c8('0x45')](handleError(_0x58def4,null));};exports[_0x25c8('0x1f')]=function(_0x2c35b2,_0x2ef12c){return db[_0x25c8('0x25')][_0x25c8('0x42')]({'where':{'id':_0x2c35b2['params']['id']}})['then'](handleEntityNotFound(_0x2ef12c,null))[_0x25c8('0x1e')](removeEntity(_0x2ef12c,null))[_0x25c8('0x45')](handleError(_0x2ef12c,null));}; \ No newline at end of file +var _0x7868=['limit','apply','reject','save','update','then','error','name','index','AnalyticMetric','rawAttributes','model','keys','query','dateStart','dateEnd','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','day','merge','filter','map','options','includeAll','include','findAll','catch','show','find','create','body','params','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset'];(function(_0x3ad19a,_0x2d0540){var _0x4f220b=function(_0x23f53a){while(--_0x23f53a){_0x3ad19a['push'](_0x3ad19a['shift']());}};_0x4f220b(++_0x2d0540);}(_0x7868,0x67));var _0x8786=function(_0x5b93ce,_0x3a26cd){_0x5b93ce=_0x5b93ce-0x0;var _0x319b59=_0x7868[_0x5b93ce];return _0x319b59;};'use strict';var jsonpatch=require(_0x8786('0x0'));var rp=require(_0x8786('0x1'));var moment=require(_0x8786('0x2'));var BPromise=require(_0x8786('0x3'));var Mustache=require(_0x8786('0x4'));var util=require(_0x8786('0x5'));var path=require(_0x8786('0x6'));var sox=require(_0x8786('0x7'));var csv=require(_0x8786('0x8'));var ejs=require(_0x8786('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8786('0xa'));var crypto=require(_0x8786('0xb'));var jsforce=require(_0x8786('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8786('0x8'));var querystring=require('querystring');var Papa=require(_0x8786('0xd'));var qs=require(_0x8786('0xe'));var logger=require(_0x8786('0xf'))('api');var utils=require(_0x8786('0x10'));var config=require('../../config/environment');var db=require(_0x8786('0x11'))['db'];function respondWithStatusCode(_0x28702b,_0x3b0cf5){_0x3b0cf5=_0x3b0cf5||0xcc;return function(_0x23f8fb){if(_0x23f8fb){return _0x28702b[_0x8786('0x12')](_0x3b0cf5);}return _0x28702b[_0x8786('0x13')](_0x3b0cf5)[_0x8786('0x14')]();};}function respondWithResult(_0x4ec413,_0x42fd0d){_0x42fd0d=_0x42fd0d||0xc8;return function(_0x3e4c1b){if(_0x3e4c1b){return _0x4ec413[_0x8786('0x13')](_0x42fd0d)['json'](_0x3e4c1b);}};}function respondWithFilteredResult(_0x25f7ba,_0x3f9705){return function(_0x145788){if(_0x145788){var _0x3a4175=_0x145788[_0x8786('0x15')],_0xbddfaa=_0x3f9705[_0x8786('0x16')],_0x4ba373=_0x3f9705['offset']+_0x3f9705[_0x8786('0x17')],_0xf563c7;if(_0x4ba373>=_0x3a4175){_0x4ba373=_0x3a4175;_0xf563c7=0xc8;}else{_0xf563c7=0xce;}_0x25f7ba[_0x8786('0x13')](_0xf563c7);return _0x25f7ba['set']('Content-Range',_0xbddfaa+'-'+_0x4ba373+'/'+_0x3a4175)['json'](_0x145788);}return null;};}function patchUpdates(_0x2dbd83){return function(_0x3b2521){try{jsonpatch[_0x8786('0x18')](_0x3b2521,_0x2dbd83,!![]);}catch(_0x5dec57){return BPromise[_0x8786('0x19')](_0x5dec57);}return _0x3b2521[_0x8786('0x1a')]();};}function saveUpdates(_0x25935d,_0x511748){return function(_0x581127){if(_0x581127){return _0x581127[_0x8786('0x1b')](_0x25935d)[_0x8786('0x1c')](function(_0xe92ef7){return _0xe92ef7;});}return null;};}function removeEntity(_0x16a6df,_0x5037b9){return function(_0x478223){if(_0x478223){return _0x478223['destroy']()[_0x8786('0x1c')](function(){_0x16a6df['status'](0xcc)[_0x8786('0x14')]();});}};}function handleEntityNotFound(_0x351b66,_0x1aa2fc){return function(_0x2bcb07){if(!_0x2bcb07){_0x351b66[_0x8786('0x12')](0x194);}return _0x2bcb07;};}function handleError(_0x2ce5b9,_0x390ced){_0x390ced=_0x390ced||0x1f4;return function(_0x5eb33b){logger[_0x8786('0x1d')](_0x5eb33b['stack']);if(_0x5eb33b[_0x8786('0x1e')]){delete _0x5eb33b[_0x8786('0x1e')];}_0x2ce5b9[_0x8786('0x13')](_0x390ced)['send'](_0x5eb33b);};}exports[_0x8786('0x1f')]=function(_0x3d52cf,_0x1ee047){var _0x1023fc={},_0xedf8bc={},_0x3f054d={'count':0x0,'rows':[]};var _0x4e2a1d=db[_0x8786('0x20')][_0x8786('0x21')];_0xedf8bc[_0x8786('0x22')]=_[_0x8786('0x23')](_0x4e2a1d);var _0x1964fd={'dateStart':_0x3d52cf[_0x8786('0x24')][_0x8786('0x25')],'dateEnd':_0x3d52cf[_0x8786('0x24')][_0x8786('0x26')]};delete _0x3d52cf[_0x8786('0x24')]['dateStart'];delete _0x3d52cf[_0x8786('0x24')]['dateEnd'];_0xedf8bc[_0x8786('0x24')]=_['keys'](_0x3d52cf[_0x8786('0x24')]);_0xedf8bc['filters']=_['intersection'](_0xedf8bc[_0x8786('0x22')],_0xedf8bc[_0x8786('0x24')]);_0x1023fc[_0x8786('0x27')]=_[_0x8786('0x28')](_0xedf8bc[_0x8786('0x22')],qs[_0x8786('0x29')](_0x3d52cf[_0x8786('0x24')][_0x8786('0x29')]));_0x1023fc[_0x8786('0x27')]=_0x1023fc[_0x8786('0x27')][_0x8786('0x2a')]?_0x1023fc[_0x8786('0x27')]:_0xedf8bc['model'];if(!_0x3d52cf['query'][_0x8786('0x2b')](_0x8786('0x2c'))){_0x1023fc['limit']=qs['limit'](_0x3d52cf[_0x8786('0x24')][_0x8786('0x17')]);_0x1023fc[_0x8786('0x16')]=qs[_0x8786('0x16')](_0x3d52cf[_0x8786('0x24')][_0x8786('0x16')]);}_0x1023fc['order']=qs[_0x8786('0x2d')](_0x3d52cf['query']['sort']);_0x1023fc[_0x8786('0x2e')]=qs[_0x8786('0x2f')](_[_0x8786('0x30')](_0x3d52cf[_0x8786('0x24')],_0xedf8bc[_0x8786('0x2f')]));if(_0x1964fd[_0x8786('0x25')]){if(_0x1964fd['dateEnd']){_0x1964fd[_0x8786('0x26')]=moment(_0x1964fd[_0x8786('0x26')])['add'](0x1,'day');}else{_0x1964fd[_0x8786('0x26')]=moment(_0x1964fd['dateStart'])['add'](0x1,_0x8786('0x31'));}_[_0x8786('0x32')](_0x1023fc[_0x8786('0x2e')],{'createdAt':{'$gte':_0x1964fd[_0x8786('0x25')],'$lte':_0x1964fd[_0x8786('0x26')]}});}if(_0x3d52cf[_0x8786('0x24')][_0x8786('0x33')]){_0x1023fc[_0x8786('0x2e')]=_[_0x8786('0x32')](_0x1023fc[_0x8786('0x2e')],{'$or':_[_0x8786('0x34')](_0x1023fc['attributes'],function(_0x5119ab){var _0x23a6eb={};_0x23a6eb[_0x5119ab]={'$like':'%'+_0x3d52cf['query'][_0x8786('0x33')]+'%'};return _0x23a6eb;})});}_0x1023fc=_[_0x8786('0x32')]({},_0x1023fc,_0x3d52cf[_0x8786('0x35')]);var _0x435037={'where':_0x1023fc[_0x8786('0x2e')]};return db[_0x8786('0x20')]['count'](_0x435037)['then'](function(_0x576107){_0x3f054d['count']=_0x576107;if(_0x3d52cf[_0x8786('0x24')][_0x8786('0x36')]){_0x1023fc[_0x8786('0x37')]=[{'all':!![]}];}return db[_0x8786('0x20')][_0x8786('0x38')](_0x1023fc);})['then'](function(_0x586ce5){_0x3f054d['rows']=_0x586ce5;return _0x3f054d;})[_0x8786('0x1c')](respondWithFilteredResult(_0x1ee047,_0x1023fc))[_0x8786('0x39')](handleError(_0x1ee047,null));};exports[_0x8786('0x3a')]=function(_0x46eb56,_0x52b093){var _0xfe8162={'raw':!![],'where':{'id':_0x46eb56['params']['id']}},_0x29d29d={};_0x29d29d[_0x8786('0x22')]=_['keys'](db['AnalyticMetric'][_0x8786('0x21')]);_0x29d29d[_0x8786('0x24')]=_['keys'](_0x46eb56[_0x8786('0x24')]);_0x29d29d[_0x8786('0x2f')]=_[_0x8786('0x28')](_0x29d29d[_0x8786('0x22')],_0x29d29d[_0x8786('0x24')]);_0xfe8162['attributes']=_[_0x8786('0x28')](_0x29d29d[_0x8786('0x22')],qs[_0x8786('0x29')](_0x46eb56['query'][_0x8786('0x29')]));_0xfe8162[_0x8786('0x27')]=_0xfe8162[_0x8786('0x27')][_0x8786('0x2a')]?_0xfe8162[_0x8786('0x27')]:_0x29d29d['model'];if(_0x46eb56[_0x8786('0x24')]['includeAll']){_0xfe8162[_0x8786('0x37')]=[{'all':!![]}];}_0xfe8162=_[_0x8786('0x32')]({},_0xfe8162,_0x46eb56[_0x8786('0x35')]);return db[_0x8786('0x20')][_0x8786('0x3b')](_0xfe8162)[_0x8786('0x1c')](handleEntityNotFound(_0x52b093,null))[_0x8786('0x1c')](respondWithResult(_0x52b093,null))[_0x8786('0x39')](handleError(_0x52b093,null));};exports[_0x8786('0x3c')]=function(_0x4016c3,_0x40a587){return db[_0x8786('0x20')][_0x8786('0x3c')](_0x4016c3[_0x8786('0x3d')],{})[_0x8786('0x1c')](respondWithResult(_0x40a587,0xc9))[_0x8786('0x39')](handleError(_0x40a587,null));};exports['update']=function(_0x2af7ef,_0x2068da){if(_0x2af7ef[_0x8786('0x3d')]['id']){delete _0x2af7ef['body']['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0x2af7ef['params']['id']}})[_0x8786('0x1c')](handleEntityNotFound(_0x2068da,null))['then'](saveUpdates(_0x2af7ef[_0x8786('0x3d')],null))[_0x8786('0x1c')](respondWithResult(_0x2068da,null))[_0x8786('0x39')](handleError(_0x2068da,null));};exports['destroy']=function(_0x16d6d2,_0xd85fc1){return db[_0x8786('0x20')][_0x8786('0x3b')]({'where':{'id':_0x16d6d2[_0x8786('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd85fc1,null))[_0x8786('0x1c')](removeEntity(_0xd85fc1,null))[_0x8786('0x39')](handleError(_0xd85fc1,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 72cb98a..5c617fc 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 _0x82b2=['AnalyticMetric','analytics_metrics','lodash','util','api','moment','bluebird','define'];(function(_0x4a01a3,_0xa47ef6){var _0xd20294=function(_0x3aab1e){while(--_0x3aab1e){_0x4a01a3['push'](_0x4a01a3['shift']());}};_0xd20294(++_0xa47ef6);}(_0x82b2,0xb2));var _0x282b=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x82b2[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0x282b('0x0'));var util=require(_0x282b('0x1'));var logger=require('../../config/logger')(_0x282b('0x2'));var moment=require(_0x282b('0x3'));var BPromise=require(_0x282b('0x4'));var rp=require('request-promise');var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x331116,_0x53d524){return _0x331116[_0x282b('0x5')](_0x282b('0x6'),attributes,{'tableName':_0x282b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4271=['./analyticMetric.attributes','exports','define','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0x4271,0xc0));var _0x1427=function(_0x575395,_0x23cc3e){_0x575395=_0x575395-0x0;var _0x223bf5=_0x4271[_0x575395];return _0x223bf5;};'use strict';var _=require(_0x1427('0x0'));var util=require(_0x1427('0x1'));var logger=require(_0x1427('0x2'))(_0x1427('0x3'));var moment=require(_0x1427('0x4'));var BPromise=require('bluebird');var rp=require(_0x1427('0x5'));var attributes=require(_0x1427('0x6'));module[_0x1427('0x7')]=function(_0x3935e1,_0x2e55f1){return _0x3935e1[_0x1427('0x8')]('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 3b254a2..119989b 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 _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(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_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 +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(_0x156a0d,_0x3946ce){var _0x98a9ba=function(_0x46c1b2){while(--_0x46c1b2){_0x156a0d['push'](_0x156a0d['shift']());}};_0x98a9ba(++_0x3946ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 5d1b416..b6be7e3 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 _0x1619=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','post','put','/:id','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x2f2cb8,_0x417d38){var _0x5a7add=function(_0xc1da1d){while(--_0xc1da1d){_0x2f2cb8['push'](_0x2f2cb8['shift']());}};_0x5a7add(++_0x417d38);}(_0x1619,0x193));var _0x9161=function(_0x523a34,_0x4f0364){_0x523a34=_0x523a34-0x0;var _0x35d8ff=_0x1619[_0x523a34];return _0x35d8ff;};'use strict';var multer=require(_0x9161('0x0'));var util=require(_0x9161('0x1'));var path=require(_0x9161('0x2'));var express=require(_0x9161('0x3'));var router=express[_0x9161('0x4')]();var auth=require(_0x9161('0x5'));var interaction=require(_0x9161('0x6'));var config=require(_0x9161('0x7'));var controller=require(_0x9161('0x8'));router[_0x9161('0x9')]('/',auth[_0x9161('0xa')](),controller['index']);router[_0x9161('0x9')]('/:id',auth[_0x9161('0xa')](),controller['show']);router[_0x9161('0xb')]('/',auth[_0x9161('0xa')](),controller['create']);router[_0x9161('0xc')](_0x9161('0xd'),auth[_0x9161('0xa')](),controller['update']);router[_0x9161('0xe')](_0x9161('0xd'),auth['isAuthenticated'](),controller[_0x9161('0xf')]);module[_0x9161('0x10')]=router; \ No newline at end of file +var _0xe53c=['post','create','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xe53c,0x16e));var _0xce53=function(_0x1b8f6f,_0x3dacc0){_0x1b8f6f=_0x1b8f6f-0x0;var _0x15410d=_0xe53c[_0x1b8f6f];return _0x15410d;};'use strict';var multer=require(_0xce53('0x0'));var util=require(_0xce53('0x1'));var path=require(_0xce53('0x2'));var express=require(_0xce53('0x3'));var router=express[_0xce53('0x4')]();var auth=require(_0xce53('0x5'));var interaction=require(_0xce53('0x6'));var config=require(_0xce53('0x7'));var controller=require(_0xce53('0x8'));router[_0xce53('0x9')]('/',auth[_0xce53('0xa')](),controller[_0xce53('0xb')]);router['get'](_0xce53('0xc'),auth['isAuthenticated'](),controller[_0xce53('0xd')]);router[_0xce53('0xe')]('/',auth[_0xce53('0xa')](),controller[_0xce53('0xf')]);router['put'](_0xce53('0xc'),auth[_0xce53('0xa')](),controller['update']);router[_0xce53('0x10')]('/:id',auth[_0xce53('0xa')](),controller[_0xce53('0x11')]);module[_0xce53('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index bb4a09d..8cee6fe 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 _0x2b5f=['TEXT','exports'];(function(_0x3f1a4d,_0x4c4c7d){var _0x5e401a=function(_0x245dfd){while(--_0x245dfd){_0x3f1a4d['push'](_0x3f1a4d['shift']());}};_0x5e401a(++_0x4c4c7d);}(_0x2b5f,0xd5));var _0xf2b5=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x2b5f[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0xf2b5('0x0')]={'tree':{'type':Sequelize[_0xf2b5('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x2fbd=['sequelize','exports'];(function(_0x558a3d,_0x12c77c){var _0x54a667=function(_0x11272a){while(--_0x11272a){_0x558a3d['push'](_0x558a3d['shift']());}};_0x54a667(++_0x12c77c);}(_0x2fbd,0x7a));var _0xd2fb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2fbd[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xd2fb('0x0'));module[_0xd2fb('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 93d1834..34d3171 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 _0x3976=['desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','save','update','then','error','name','send','index','AnalyticTreeReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','day','add','filter','map','merge','options','includeAll','rows','catch','show','params','include','find','create','body','destroy','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x3976,0x149));var _0x6397=function(_0x391a1e,_0x10742f){_0x391a1e=_0x391a1e-0x0;var _0x4b4a0f=_0x3976[_0x391a1e];return _0x4b4a0f;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x6397('0x0'));var moment=require(_0x6397('0x1'));var BPromise=require(_0x6397('0x2'));var Mustache=require(_0x6397('0x3'));var util=require(_0x6397('0x4'));var path=require('path');var sox=require(_0x6397('0x5'));var csv=require(_0x6397('0x6'));var ejs=require(_0x6397('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6397('0x8'));var crypto=require(_0x6397('0x9'));var jsforce=require(_0x6397('0xa'));var deskjs=require(_0x6397('0xb'));var toCsv=require(_0x6397('0x6'));var querystring=require(_0x6397('0xc'));var Papa=require(_0x6397('0xd'));var qs=require(_0x6397('0xe'));var logger=require(_0x6397('0xf'))('api');var utils=require(_0x6397('0x10'));var config=require(_0x6397('0x11'));var db=require(_0x6397('0x12'))['db'];function respondWithStatusCode(_0xbe3e05,_0x4479dc){_0x4479dc=_0x4479dc||0xcc;return function(_0x527191){if(_0x527191){return _0xbe3e05[_0x6397('0x13')](_0x4479dc);}return _0xbe3e05['status'](_0x4479dc)[_0x6397('0x14')]();};}function respondWithResult(_0x4968a5,_0x5802b2){_0x5802b2=_0x5802b2||0xc8;return function(_0x51a3e8){if(_0x51a3e8){return _0x4968a5[_0x6397('0x15')](_0x5802b2)[_0x6397('0x16')](_0x51a3e8);}};}function respondWithFilteredResult(_0x34e02c,_0x34bc96){return function(_0x21239b){if(_0x21239b){var _0x9839da=_0x21239b[_0x6397('0x17')],_0x458261=_0x34bc96[_0x6397('0x18')],_0x55f5ab=_0x34bc96[_0x6397('0x18')]+_0x34bc96[_0x6397('0x19')],_0x3076d1;if(_0x55f5ab>=_0x9839da){_0x55f5ab=_0x9839da;_0x3076d1=0xc8;}else{_0x3076d1=0xce;}_0x34e02c['status'](_0x3076d1);return _0x34e02c[_0x6397('0x1a')]('Content-Range',_0x458261+'-'+_0x55f5ab+'/'+_0x9839da)[_0x6397('0x16')](_0x21239b);}return null;};}function patchUpdates(_0xdacf78){return function(_0xeeba6e){try{jsonpatch[_0x6397('0x1b')](_0xeeba6e,_0xdacf78,!![]);}catch(_0x1a7f5f){return BPromise['reject'](_0x1a7f5f);}return _0xeeba6e[_0x6397('0x1c')]();};}function saveUpdates(_0x572897,_0x3c4061){return function(_0x54d83d){if(_0x54d83d){return _0x54d83d[_0x6397('0x1d')](_0x572897)['then'](function(_0xeab00b){return _0xeab00b;});}return null;};}function removeEntity(_0x4d7589,_0x37d2cd){return function(_0x37fce1){if(_0x37fce1){return _0x37fce1['destroy']()[_0x6397('0x1e')](function(){_0x4d7589[_0x6397('0x15')](0xcc)[_0x6397('0x14')]();});}};}function handleEntityNotFound(_0x57d374,_0x1c2c52){return function(_0xeec45d){if(!_0xeec45d){_0x57d374[_0x6397('0x13')](0x194);}return _0xeec45d;};}function handleError(_0x3a38d5,_0x5b5cd9){_0x5b5cd9=_0x5b5cd9||0x1f4;return function(_0x2cb7d7){logger[_0x6397('0x1f')](_0x2cb7d7['stack']);if(_0x2cb7d7[_0x6397('0x20')]){delete _0x2cb7d7['name'];}_0x3a38d5['status'](_0x5b5cd9)[_0x6397('0x21')](_0x2cb7d7);};}exports[_0x6397('0x22')]=function(_0x33b2d3,_0x349193){var _0x2ab273={},_0x254583={},_0x241a4a={'count':0x0,'rows':[]};var _0x5c38b9=db[_0x6397('0x23')][_0x6397('0x24')];_0x254583[_0x6397('0x25')]=_[_0x6397('0x26')](_0x5c38b9);var _0x2b6d3a={'dateStart':_0x33b2d3[_0x6397('0x27')][_0x6397('0x28')],'dateEnd':_0x33b2d3[_0x6397('0x27')][_0x6397('0x29')]};delete _0x33b2d3[_0x6397('0x27')][_0x6397('0x28')];delete _0x33b2d3[_0x6397('0x27')][_0x6397('0x29')];_0x254583[_0x6397('0x27')]=_[_0x6397('0x26')](_0x33b2d3[_0x6397('0x27')]);_0x254583[_0x6397('0x2a')]=_[_0x6397('0x2b')](_0x254583[_0x6397('0x25')],_0x254583[_0x6397('0x27')]);_0x2ab273[_0x6397('0x2c')]=_[_0x6397('0x2b')](_0x254583[_0x6397('0x25')],qs[_0x6397('0x2d')](_0x33b2d3[_0x6397('0x27')]['fields']));_0x2ab273[_0x6397('0x2c')]=_0x2ab273[_0x6397('0x2c')][_0x6397('0x2e')]?_0x2ab273[_0x6397('0x2c')]:_0x254583['model'];if(!_0x33b2d3[_0x6397('0x27')][_0x6397('0x2f')](_0x6397('0x30'))){_0x2ab273[_0x6397('0x19')]=qs[_0x6397('0x19')](_0x33b2d3['query'][_0x6397('0x19')]);_0x2ab273[_0x6397('0x18')]=qs[_0x6397('0x18')](_0x33b2d3['query'][_0x6397('0x18')]);}_0x2ab273[_0x6397('0x31')]=qs['sort'](_0x33b2d3[_0x6397('0x27')][_0x6397('0x32')]);_0x2ab273[_0x6397('0x33')]=qs[_0x6397('0x2a')](_['pick'](_0x33b2d3[_0x6397('0x27')],_0x254583[_0x6397('0x2a')]));if(_0x2b6d3a[_0x6397('0x28')]){if(_0x2b6d3a[_0x6397('0x29')]){_0x2b6d3a[_0x6397('0x29')]=moment(_0x2b6d3a[_0x6397('0x29')])['add'](0x1,_0x6397('0x34'));}else{_0x2b6d3a[_0x6397('0x29')]=moment(_0x2b6d3a[_0x6397('0x28')])[_0x6397('0x35')](0x1,_0x6397('0x34'));}_['merge'](_0x2ab273[_0x6397('0x33')],{'createdAt':{'$gte':_0x2b6d3a[_0x6397('0x28')],'$lte':_0x2b6d3a[_0x6397('0x29')]}});}if(_0x33b2d3[_0x6397('0x27')][_0x6397('0x36')]){_0x2ab273[_0x6397('0x33')]=_['merge'](_0x2ab273[_0x6397('0x33')],{'$or':_[_0x6397('0x37')](_0x2ab273[_0x6397('0x2c')],function(_0x2ff26a){var _0x4d7db0={};_0x4d7db0[_0x2ff26a]={'$like':'%'+_0x33b2d3[_0x6397('0x27')]['filter']+'%'};return _0x4d7db0;})});}_0x2ab273=_[_0x6397('0x38')]({},_0x2ab273,_0x33b2d3[_0x6397('0x39')]);var _0x242c82={'where':_0x2ab273[_0x6397('0x33')]};return db[_0x6397('0x23')]['count'](_0x242c82)['then'](function(_0x36b5cf){_0x241a4a[_0x6397('0x17')]=_0x36b5cf;if(_0x33b2d3[_0x6397('0x27')][_0x6397('0x3a')]){_0x2ab273['include']=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x2ab273);})[_0x6397('0x1e')](function(_0x21393e){_0x241a4a[_0x6397('0x3b')]=_0x21393e;return _0x241a4a;})[_0x6397('0x1e')](respondWithFilteredResult(_0x349193,_0x2ab273))[_0x6397('0x3c')](handleError(_0x349193,null));};exports[_0x6397('0x3d')]=function(_0x309c9d,_0x4978fc){var _0x1deff3={'raw':!![],'where':{'id':_0x309c9d[_0x6397('0x3e')]['id']}},_0x4c8c76={};_0x4c8c76[_0x6397('0x25')]=_[_0x6397('0x26')](db[_0x6397('0x23')][_0x6397('0x24')]);_0x4c8c76[_0x6397('0x27')]=_[_0x6397('0x26')](_0x309c9d['query']);_0x4c8c76[_0x6397('0x2a')]=_[_0x6397('0x2b')](_0x4c8c76[_0x6397('0x25')],_0x4c8c76[_0x6397('0x27')]);_0x1deff3[_0x6397('0x2c')]=_[_0x6397('0x2b')](_0x4c8c76[_0x6397('0x25')],qs['fields'](_0x309c9d[_0x6397('0x27')][_0x6397('0x2d')]));_0x1deff3[_0x6397('0x2c')]=_0x1deff3[_0x6397('0x2c')]['length']?_0x1deff3['attributes']:_0x4c8c76[_0x6397('0x25')];if(_0x309c9d[_0x6397('0x27')][_0x6397('0x3a')]){_0x1deff3[_0x6397('0x3f')]=[{'all':!![]}];}_0x1deff3=_[_0x6397('0x38')]({},_0x1deff3,_0x309c9d[_0x6397('0x39')]);return db[_0x6397('0x23')][_0x6397('0x40')](_0x1deff3)['then'](handleEntityNotFound(_0x4978fc,null))[_0x6397('0x1e')](respondWithResult(_0x4978fc,null))['catch'](handleError(_0x4978fc,null));};exports[_0x6397('0x41')]=function(_0x1946fc,_0x3ad9b7){return db[_0x6397('0x23')]['create'](_0x1946fc[_0x6397('0x42')],{})[_0x6397('0x1e')](respondWithResult(_0x3ad9b7,0xc9))[_0x6397('0x3c')](handleError(_0x3ad9b7,null));};exports['update']=function(_0x3dfc3d,_0x196c00){if(_0x3dfc3d[_0x6397('0x42')]['id']){delete _0x3dfc3d[_0x6397('0x42')]['id'];}return db['AnalyticTreeReport'][_0x6397('0x40')]({'where':{'id':_0x3dfc3d[_0x6397('0x3e')]['id']}})[_0x6397('0x1e')](handleEntityNotFound(_0x196c00,null))[_0x6397('0x1e')](saveUpdates(_0x3dfc3d[_0x6397('0x42')],null))[_0x6397('0x1e')](respondWithResult(_0x196c00,null))['catch'](handleError(_0x196c00,null));};exports[_0x6397('0x43')]=function(_0x481f9c,_0x36064b){return db['AnalyticTreeReport']['find']({'where':{'id':_0x481f9c[_0x6397('0x3e')]['id']}})[_0x6397('0x1e')](handleEntityNotFound(_0x36064b,null))[_0x6397('0x1e')](removeEntity(_0x36064b,null))[_0x6397('0x3c')](handleError(_0x36064b,null));}; \ No newline at end of file +var _0xdb8e=['set','json','apply','save','then','destroy','stack','name','send','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','AnalyticTreeReport','findAll','rows','catch','show','params','find','create','body','update','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit'];(function(_0x46e092,_0x2e5836){var _0x97bb84=function(_0x1fba9e){while(--_0x1fba9e){_0x46e092['push'](_0x46e092['shift']());}};_0x97bb84(++_0x2e5836);}(_0xdb8e,0x6e));var _0xedb8=function(_0x10e1ce,_0x1f28eb){_0x10e1ce=_0x10e1ce-0x0;var _0x5be2ea=_0xdb8e[_0x10e1ce];return _0x5be2ea;};'use strict';var jsonpatch=require(_0xedb8('0x0'));var rp=require(_0xedb8('0x1'));var moment=require(_0xedb8('0x2'));var BPromise=require(_0xedb8('0x3'));var Mustache=require(_0xedb8('0x4'));var util=require(_0xedb8('0x5'));var path=require(_0xedb8('0x6'));var sox=require('sox');var csv=require(_0xedb8('0x7'));var ejs=require(_0xedb8('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xedb8('0x9'));var crypto=require('crypto');var jsforce=require(_0xedb8('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xedb8('0xb'));var Papa=require(_0xedb8('0xc'));var qs=require(_0xedb8('0xd'));var logger=require(_0xedb8('0xe'))(_0xedb8('0xf'));var utils=require(_0xedb8('0x10'));var config=require(_0xedb8('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x838f92,_0x384e15){_0x384e15=_0x384e15||0xcc;return function(_0x115642){if(_0x115642){return _0x838f92[_0xedb8('0x12')](_0x384e15);}return _0x838f92[_0xedb8('0x13')](_0x384e15)[_0xedb8('0x14')]();};}function respondWithResult(_0x19c4d9,_0x19446d){_0x19446d=_0x19446d||0xc8;return function(_0x40b627){if(_0x40b627){return _0x19c4d9[_0xedb8('0x13')](_0x19446d)['json'](_0x40b627);}};}function respondWithFilteredResult(_0x821cb3,_0x1a6310){return function(_0xf2e47b){if(_0xf2e47b){var _0x2ebd48=_0xf2e47b[_0xedb8('0x15')],_0x4f1d77=_0x1a6310[_0xedb8('0x16')],_0x4d619c=_0x1a6310[_0xedb8('0x16')]+_0x1a6310[_0xedb8('0x17')],_0xe6147a;if(_0x4d619c>=_0x2ebd48){_0x4d619c=_0x2ebd48;_0xe6147a=0xc8;}else{_0xe6147a=0xce;}_0x821cb3['status'](_0xe6147a);return _0x821cb3[_0xedb8('0x18')]('Content-Range',_0x4f1d77+'-'+_0x4d619c+'/'+_0x2ebd48)[_0xedb8('0x19')](_0xf2e47b);}return null;};}function patchUpdates(_0x3add92){return function(_0x4d5e19){try{jsonpatch[_0xedb8('0x1a')](_0x4d5e19,_0x3add92,!![]);}catch(_0x4da9fe){return BPromise['reject'](_0x4da9fe);}return _0x4d5e19[_0xedb8('0x1b')]();};}function saveUpdates(_0x1b6713,_0x7c63c7){return function(_0x351ab4){if(_0x351ab4){return _0x351ab4['update'](_0x1b6713)[_0xedb8('0x1c')](function(_0x25cd18){return _0x25cd18;});}return null;};}function removeEntity(_0x57667b,_0x2135e6){return function(_0x3708a5){if(_0x3708a5){return _0x3708a5[_0xedb8('0x1d')]()[_0xedb8('0x1c')](function(){_0x57667b[_0xedb8('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a5e2f,_0x5d51e7){return function(_0x4c1c24){if(!_0x4c1c24){_0x4a5e2f[_0xedb8('0x12')](0x194);}return _0x4c1c24;};}function handleError(_0x2bc4cf,_0x13e977){_0x13e977=_0x13e977||0x1f4;return function(_0x24b7fd){logger['error'](_0x24b7fd[_0xedb8('0x1e')]);if(_0x24b7fd['name']){delete _0x24b7fd[_0xedb8('0x1f')];}_0x2bc4cf['status'](_0x13e977)[_0xedb8('0x20')](_0x24b7fd);};}exports['index']=function(_0x82cef0,_0x36e832){var _0x32dfe2={},_0x3f7d73={},_0x20d324={'count':0x0,'rows':[]};var _0x116a0b=db['AnalyticTreeReport'][_0xedb8('0x21')];_0x3f7d73[_0xedb8('0x22')]=_['keys'](_0x116a0b);var _0x535e19={'dateStart':_0x82cef0[_0xedb8('0x23')][_0xedb8('0x24')],'dateEnd':_0x82cef0[_0xedb8('0x23')][_0xedb8('0x25')]};delete _0x82cef0['query'][_0xedb8('0x24')];delete _0x82cef0[_0xedb8('0x23')][_0xedb8('0x25')];_0x3f7d73[_0xedb8('0x23')]=_[_0xedb8('0x26')](_0x82cef0[_0xedb8('0x23')]);_0x3f7d73[_0xedb8('0x27')]=_['intersection'](_0x3f7d73[_0xedb8('0x22')],_0x3f7d73[_0xedb8('0x23')]);_0x32dfe2['attributes']=_[_0xedb8('0x28')](_0x3f7d73[_0xedb8('0x22')],qs['fields'](_0x82cef0[_0xedb8('0x23')][_0xedb8('0x29')]));_0x32dfe2[_0xedb8('0x2a')]=_0x32dfe2[_0xedb8('0x2a')][_0xedb8('0x2b')]?_0x32dfe2['attributes']:_0x3f7d73[_0xedb8('0x22')];if(!_0x82cef0[_0xedb8('0x23')][_0xedb8('0x2c')](_0xedb8('0x2d'))){_0x32dfe2[_0xedb8('0x17')]=qs[_0xedb8('0x17')](_0x82cef0[_0xedb8('0x23')][_0xedb8('0x17')]);_0x32dfe2[_0xedb8('0x16')]=qs[_0xedb8('0x16')](_0x82cef0[_0xedb8('0x23')][_0xedb8('0x16')]);}_0x32dfe2['order']=qs[_0xedb8('0x2e')](_0x82cef0['query'][_0xedb8('0x2e')]);_0x32dfe2[_0xedb8('0x2f')]=qs[_0xedb8('0x27')](_[_0xedb8('0x30')](_0x82cef0[_0xedb8('0x23')],_0x3f7d73[_0xedb8('0x27')]));if(_0x535e19[_0xedb8('0x24')]){if(_0x535e19[_0xedb8('0x25')]){_0x535e19['dateEnd']=moment(_0x535e19['dateEnd'])[_0xedb8('0x31')](0x1,_0xedb8('0x32'));}else{_0x535e19['dateEnd']=moment(_0x535e19[_0xedb8('0x24')])['add'](0x1,'day');}_[_0xedb8('0x33')](_0x32dfe2[_0xedb8('0x2f')],{'createdAt':{'$gte':_0x535e19[_0xedb8('0x24')],'$lte':_0x535e19[_0xedb8('0x25')]}});}if(_0x82cef0[_0xedb8('0x23')][_0xedb8('0x34')]){_0x32dfe2[_0xedb8('0x2f')]=_[_0xedb8('0x33')](_0x32dfe2[_0xedb8('0x2f')],{'$or':_[_0xedb8('0x35')](_0x32dfe2[_0xedb8('0x2a')],function(_0x243465){var _0x5adec4={};_0x5adec4[_0x243465]={'$like':'%'+_0x82cef0['query'][_0xedb8('0x34')]+'%'};return _0x5adec4;})});}_0x32dfe2=_[_0xedb8('0x33')]({},_0x32dfe2,_0x82cef0[_0xedb8('0x36')]);var _0x24dbe0={'where':_0x32dfe2[_0xedb8('0x2f')]};return db['AnalyticTreeReport'][_0xedb8('0x15')](_0x24dbe0)[_0xedb8('0x1c')](function(_0xfc01f){_0x20d324['count']=_0xfc01f;if(_0x82cef0[_0xedb8('0x23')][_0xedb8('0x37')]){_0x32dfe2[_0xedb8('0x38')]=[{'all':!![]}];}return db[_0xedb8('0x39')][_0xedb8('0x3a')](_0x32dfe2);})[_0xedb8('0x1c')](function(_0x2e61fe){_0x20d324[_0xedb8('0x3b')]=_0x2e61fe;return _0x20d324;})[_0xedb8('0x1c')](respondWithFilteredResult(_0x36e832,_0x32dfe2))[_0xedb8('0x3c')](handleError(_0x36e832,null));};exports[_0xedb8('0x3d')]=function(_0x1196ed,_0x23c00e){var _0x1b4dfe={'raw':!![],'where':{'id':_0x1196ed[_0xedb8('0x3e')]['id']}},_0x467744={};_0x467744[_0xedb8('0x22')]=_['keys'](db[_0xedb8('0x39')][_0xedb8('0x21')]);_0x467744[_0xedb8('0x23')]=_[_0xedb8('0x26')](_0x1196ed[_0xedb8('0x23')]);_0x467744[_0xedb8('0x27')]=_[_0xedb8('0x28')](_0x467744[_0xedb8('0x22')],_0x467744[_0xedb8('0x23')]);_0x1b4dfe['attributes']=_[_0xedb8('0x28')](_0x467744['model'],qs[_0xedb8('0x29')](_0x1196ed['query'][_0xedb8('0x29')]));_0x1b4dfe[_0xedb8('0x2a')]=_0x1b4dfe[_0xedb8('0x2a')]['length']?_0x1b4dfe[_0xedb8('0x2a')]:_0x467744['model'];if(_0x1196ed['query'][_0xedb8('0x37')]){_0x1b4dfe['include']=[{'all':!![]}];}_0x1b4dfe=_[_0xedb8('0x33')]({},_0x1b4dfe,_0x1196ed[_0xedb8('0x36')]);return db[_0xedb8('0x39')][_0xedb8('0x3f')](_0x1b4dfe)[_0xedb8('0x1c')](handleEntityNotFound(_0x23c00e,null))[_0xedb8('0x1c')](respondWithResult(_0x23c00e,null))[_0xedb8('0x3c')](handleError(_0x23c00e,null));};exports['create']=function(_0x5f5933,_0x229df7){return db[_0xedb8('0x39')][_0xedb8('0x40')](_0x5f5933[_0xedb8('0x41')],{})[_0xedb8('0x1c')](respondWithResult(_0x229df7,0xc9))[_0xedb8('0x3c')](handleError(_0x229df7,null));};exports[_0xedb8('0x42')]=function(_0x1d60be,_0x2f0524){if(_0x1d60be['body']['id']){delete _0x1d60be[_0xedb8('0x41')]['id'];}return db['AnalyticTreeReport'][_0xedb8('0x3f')]({'where':{'id':_0x1d60be[_0xedb8('0x3e')]['id']}})[_0xedb8('0x1c')](handleEntityNotFound(_0x2f0524,null))['then'](saveUpdates(_0x1d60be[_0xedb8('0x41')],null))[_0xedb8('0x1c')](respondWithResult(_0x2f0524,null))[_0xedb8('0x3c')](handleError(_0x2f0524,null));};exports[_0xedb8('0x1d')]=function(_0x5541f4,_0xfaf213){return db[_0xedb8('0x39')]['find']({'where':{'id':_0x5541f4[_0xedb8('0x3e')]['id']}})[_0xedb8('0x1c')](handleEntityNotFound(_0xfaf213,null))['then'](removeEntity(_0xfaf213,null))[_0xedb8('0x3c')](handleError(_0xfaf213,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 24cbda4..9f0c591 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 _0x94b9=['lodash','api','moment','bluebird','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees'];(function(_0x28f355,_0x1a3d25){var _0x4d6ec3=function(_0x2a0bb1){while(--_0x2a0bb1){_0x28f355['push'](_0x28f355['shift']());}};_0x4d6ec3(++_0x1a3d25);}(_0x94b9,0x75));var _0x994b=function(_0x15556a,_0x3dc205){_0x15556a=_0x15556a-0x0;var _0x2cc566=_0x94b9[_0x15556a];return _0x2cc566;};'use strict';var _=require(_0x994b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x994b('0x1'));var moment=require(_0x994b('0x2'));var BPromise=require(_0x994b('0x3'));var rp=require('request-promise');var attributes=require(_0x994b('0x4'));module[_0x994b('0x5')]=function(_0x4f6f83,_0x22de0b){return _0x4f6f83[_0x994b('0x6')](_0x994b('0x7'),attributes,{'tableName':_0x994b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49c0=['define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','bluebird','request-promise','./analyticTreeReport.attributes','exports'];(function(_0x562f07,_0x421108){var _0x3d3335=function(_0x2e7fee){while(--_0x2e7fee){_0x562f07['push'](_0x562f07['shift']());}};_0x3d3335(++_0x421108);}(_0x49c0,0x193));var _0x049c=function(_0x24427c,_0x2d56da){_0x24427c=_0x24427c-0x0;var _0x566136=_0x49c0[_0x24427c];return _0x566136;};'use strict';var _=require(_0x049c('0x0'));var util=require(_0x049c('0x1'));var logger=require(_0x049c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x049c('0x3'));var rp=require(_0x049c('0x4'));var attributes=require(_0x049c('0x5'));module[_0x049c('0x6')]=function(_0x180f31,_0x1285b1){return _0x180f31[_0x049c('0x7')](_0x049c('0x8'),attributes,{'tableName':_0x049c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 24a8fa1..80b3c0e 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 _0xc8b5=['../../config/environment','http','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x18b7de,_0x174f89){var _0x20d1be=function(_0x3712ce){while(--_0x3712ce){_0x18b7de['push'](_0x18b7de['shift']());}};_0x20d1be(++_0x174f89);}(_0xc8b5,0x161));var _0x5c8b=function(_0x2897f9,_0x4c4be3){_0x2897f9=_0x2897f9-0x0;var _0x4f4da5=_0xc8b5[_0x2897f9];return _0x4f4da5;};'use strict';var _=require(_0x5c8b('0x0'));var util=require(_0x5c8b('0x1'));var moment=require(_0x5c8b('0x2'));var BPromise=require('bluebird');var rs=require(_0x5c8b('0x3'));var fs=require('fs');var db=require(_0x5c8b('0x4'))['db'];var utils=require(_0x5c8b('0x5'));var logger=require('../../config/logger')(_0x5c8b('0x6'));var config=require(_0x5c8b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5c8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x6ac4c5,_0x2c9571,_0x659fa8){return new BPromise(function(_0x3fd10b,_0xf59d11){return client['request'](_0x6ac4c5,_0x659fa8)['then'](function(_0x2c090e){logger[_0x5c8b('0x9')](_0x5c8b('0xa'),_0x2c9571,_0x5c8b('0xb'));logger[_0x5c8b('0xc')](_0x5c8b('0xd'),_0x2c9571,_0x5c8b('0xb'),JSON[_0x5c8b('0xe')](_0x2c090e));if(_0x2c090e[_0x5c8b('0xf')]){if(_0x2c090e[_0x5c8b('0xf')][_0x5c8b('0x10')]===0x1f4){logger['error'](_0x5c8b('0xa'),_0x2c9571,_0x2c090e[_0x5c8b('0xf')][_0x5c8b('0x11')]);return _0xf59d11(_0x2c090e[_0x5c8b('0xf')][_0x5c8b('0x11')]);}logger[_0x5c8b('0xf')](_0x5c8b('0xa'),_0x2c9571,_0x2c090e[_0x5c8b('0xf')]['message']);return _0x3fd10b(_0x2c090e[_0x5c8b('0xf')]['message']);}else{logger[_0x5c8b('0x9')](_0x5c8b('0xa'),_0x2c9571,_0x5c8b('0xb'));_0x3fd10b(_0x2c090e[_0x5c8b('0x12')][_0x5c8b('0x11')]);}})[_0x5c8b('0x13')](function(_0x4abd52){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x2c9571,_0x4abd52);_0xf59d11(_0x4abd52);});});} \ No newline at end of file +var _0xede3=['code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x3203a1,_0x46c498){var _0x24215e=function(_0x4ffab0){while(--_0x4ffab0){_0x3203a1['push'](_0x3203a1['shift']());}};_0x24215e(++_0x46c498);}(_0xede3,0x193));var _0x3ede=function(_0x20ff03,_0x4cbe92){_0x20ff03=_0x20ff03-0x0;var _0x35de52=_0xede3[_0x20ff03];return _0x35de52;};'use strict';var _=require(_0x3ede('0x0'));var util=require(_0x3ede('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3ede('0x2'));var fs=require('fs');var db=require(_0x3ede('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3ede('0x4'))(_0x3ede('0x5'));var config=require(_0x3ede('0x6'));var jayson=require(_0x3ede('0x7'));var client=jayson['client'][_0x3ede('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x536495,_0x587f05,_0x5b3ab2){return new BPromise(function(_0x1fea8a,_0x43f898){return client[_0x3ede('0x9')](_0x536495,_0x5b3ab2)[_0x3ede('0xa')](function(_0x1d28c2){logger[_0x3ede('0xb')](_0x3ede('0xc'),_0x587f05,'request\x20sent');logger[_0x3ede('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x587f05,_0x3ede('0xe'),JSON[_0x3ede('0xf')](_0x1d28c2));if(_0x1d28c2['error']){if(_0x1d28c2[_0x3ede('0x10')][_0x3ede('0x11')]===0x1f4){logger[_0x3ede('0x10')](_0x3ede('0xc'),_0x587f05,_0x1d28c2[_0x3ede('0x10')][_0x3ede('0x12')]);return _0x43f898(_0x1d28c2['error']['message']);}logger['error'](_0x3ede('0xc'),_0x587f05,_0x1d28c2[_0x3ede('0x10')][_0x3ede('0x12')]);return _0x1fea8a(_0x1d28c2[_0x3ede('0x10')]['message']);}else{logger[_0x3ede('0xb')](_0x3ede('0xc'),_0x587f05,'request\x20sent');_0x1fea8a(_0x1d28c2[_0x3ede('0x13')][_0x3ede('0x12')]);}})[_0x3ede('0x14')](function(_0x3f44cb){logger[_0x3ede('0x10')]('AnalyticTreeReport,\x20%s,\x20%s',_0x587f05,_0x3f44cb);_0x43f898(_0x3f44cb);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 5764bf1..34b5842 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 _0xd76b=['get','show','post','create','/:id','update','delete','destroy','exports','multer','path','Router','./analyticTreeReport.controller','isAuthenticated','index'];(function(_0x389ed9,_0xbd0522){var _0x491550=function(_0x215f1b){while(--_0x215f1b){_0x389ed9['push'](_0x389ed9['shift']());}};_0x491550(++_0xbd0522);}(_0xd76b,0xdb));var _0xbd76=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd76b[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xbd76('0x0'));var util=require('util');var path=require(_0xbd76('0x1'));var express=require('express');var router=express[_0xbd76('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbd76('0x3'));router['get']('/',auth[_0xbd76('0x4')](),controller[_0xbd76('0x5')]);router[_0xbd76('0x6')]('/:id',auth[_0xbd76('0x4')](),controller[_0xbd76('0x7')]);router[_0xbd76('0x8')]('/',auth[_0xbd76('0x4')](),controller[_0xbd76('0x9')]);router['put'](_0xbd76('0xa'),auth['isAuthenticated'](),controller[_0xbd76('0xb')]);router[_0xbd76('0xc')](_0xbd76('0xa'),auth[_0xbd76('0x4')](),controller[_0xbd76('0xd')]);module[_0xbd76('0xe')]=router; \ No newline at end of file +var _0xb574=['express','Router','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy'];(function(_0x1d503c,_0x5125d9){var _0x1928b2=function(_0x4d0ff1){while(--_0x4d0ff1){_0x1d503c['push'](_0x1d503c['shift']());}};_0x1928b2(++_0x5125d9);}(_0xb574,0x14a));var _0x4b57=function(_0x4c41d3,_0x598f16){_0x4c41d3=_0x4c41d3-0x0;var _0x14f5ad=_0xb574[_0x4c41d3];return _0x14f5ad;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0x4b57('0x0'));var router=express[_0x4b57('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x4b57('0x2'));var config=require(_0x4b57('0x3'));var controller=require(_0x4b57('0x4'));router[_0x4b57('0x5')]('/',auth[_0x4b57('0x6')](),controller[_0x4b57('0x7')]);router['get'](_0x4b57('0x8'),auth['isAuthenticated'](),controller[_0x4b57('0x9')]);router['post']('/',auth[_0x4b57('0x6')](),controller[_0x4b57('0xa')]);router[_0x4b57('0xb')](_0x4b57('0x8'),auth[_0x4b57('0x6')](),controller[_0x4b57('0xc')]);router[_0x4b57('0xd')](_0x4b57('0x8'),auth[_0x4b57('0x6')](),controller[_0x4b57('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index b98d00d..deac3d4 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 _0x60f7=['STRING','exports'];(function(_0xd2a568,_0x4e8606){var _0x4cf0ba=function(_0x1f9dfc){while(--_0x1f9dfc){_0xd2a568['push'](_0xd2a568['shift']());}};_0x4cf0ba(++_0x4e8606);}(_0x60f7,0xcf));var _0x760f=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x60f7[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0x760f('0x0')]={'name':{'type':Sequelize[_0x760f('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb909=['exports','STRING'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb909,0x140));var _0x9b90=function(_0x52c72f,_0x38dcfe){_0x52c72f=_0x52c72f-0x0;var _0x11329d=_0xb909[_0x52c72f];return _0x11329d;};'use strict';var Sequelize=require('sequelize');module[_0x9b90('0x0')]={'name':{'type':Sequelize[_0x9b90('0x1')]},'basename':{'type':Sequelize[_0x9b90('0x1')]},'type':{'type':Sequelize[_0x9b90('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index c8c42f1..a620588 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 _0x09bc=['intersection','attributes','fields','length','hasOwnProperty','order','where','day','merge','map','filter','options','Attachment','count','includeAll','findAll','rows','catch','params','include','find','body','destroy','create','file','originalname','basename','filename','download','findOne','join','server/files/attachments/','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','set','reject','save','update','then','sendStatus','error','stack','name','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters'];(function(_0x16759a,_0x2c1f70){var _0x49d27a=function(_0xf9815d){while(--_0xf9815d){_0x16759a['push'](_0x16759a['shift']());}};_0x49d27a(++_0x2c1f70);}(_0x09bc,0x13c));var _0xc09b=function(_0x18afca,_0x4219d9){_0x18afca=_0x18afca-0x0;var _0x11603f=_0x09bc[_0x18afca];return _0x11603f;};'use strict';var jsonpatch=require(_0xc09b('0x0'));var rp=require(_0xc09b('0x1'));var moment=require(_0xc09b('0x2'));var BPromise=require(_0xc09b('0x3'));var Mustache=require(_0xc09b('0x4'));var util=require('util');var path=require(_0xc09b('0x5'));var sox=require(_0xc09b('0x6'));var csv=require(_0xc09b('0x7'));var ejs=require(_0xc09b('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc09b('0x9'));var jsforce=require(_0xc09b('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc09b('0x7'));var querystring=require(_0xc09b('0xb'));var Papa=require(_0xc09b('0xc'));var qs=require('../../components/parsers/qs');var logger=require(_0xc09b('0xd'))(_0xc09b('0xe'));var utils=require(_0xc09b('0xf'));var config=require('../../config/environment');var db=require(_0xc09b('0x10'))['db'];function respondWithStatusCode(_0xd60a4,_0x12bed0){_0x12bed0=_0x12bed0||0xcc;return function(_0x58bc47){if(_0x58bc47){return _0xd60a4['sendStatus'](_0x12bed0);}return _0xd60a4[_0xc09b('0x11')](_0x12bed0)[_0xc09b('0x12')]();};}function respondWithResult(_0x56ccfa,_0x22a0f3){_0x22a0f3=_0x22a0f3||0xc8;return function(_0x1d2326){if(_0x1d2326){return _0x56ccfa[_0xc09b('0x11')](_0x22a0f3)[_0xc09b('0x13')](_0x1d2326);}};}function respondWithFilteredResult(_0x4f09a3,_0x2d4995){return function(_0x4a8131){if(_0x4a8131){var _0x416430=_0x4a8131['count'],_0x16b5a9=_0x2d4995[_0xc09b('0x14')],_0x593e14=_0x2d4995[_0xc09b('0x14')]+_0x2d4995[_0xc09b('0x15')],_0x5e96ce;if(_0x593e14>=_0x416430){_0x593e14=_0x416430;_0x5e96ce=0xc8;}else{_0x5e96ce=0xce;}_0x4f09a3[_0xc09b('0x11')](_0x5e96ce);return _0x4f09a3[_0xc09b('0x16')]('Content-Range',_0x16b5a9+'-'+_0x593e14+'/'+_0x416430)['json'](_0x4a8131);}return null;};}function patchUpdates(_0x4f9e2e){return function(_0x7d0a88){try{jsonpatch['apply'](_0x7d0a88,_0x4f9e2e,!![]);}catch(_0x49e23a){return BPromise[_0xc09b('0x17')](_0x49e23a);}return _0x7d0a88[_0xc09b('0x18')]();};}function saveUpdates(_0x33914f,_0x546bfc){return function(_0x5c03e9){if(_0x5c03e9){return _0x5c03e9[_0xc09b('0x19')](_0x33914f)[_0xc09b('0x1a')](function(_0x584e14){return _0x584e14;});}return null;};}function removeEntity(_0x2c3ef2,_0x20ccf4){return function(_0x4bc514){if(_0x4bc514){return _0x4bc514['destroy']()[_0xc09b('0x1a')](function(){_0x2c3ef2[_0xc09b('0x11')](0xcc)[_0xc09b('0x12')]();});}};}function handleEntityNotFound(_0x17ac49,_0x123bd1){return function(_0x272cf0){if(!_0x272cf0){_0x17ac49[_0xc09b('0x1b')](0x194);}return _0x272cf0;};}function handleError(_0x1775cf,_0x5479ce){_0x5479ce=_0x5479ce||0x1f4;return function(_0xaa3c){logger[_0xc09b('0x1c')](_0xaa3c[_0xc09b('0x1d')]);if(_0xaa3c[_0xc09b('0x1e')]){delete _0xaa3c[_0xc09b('0x1e')];}_0x1775cf[_0xc09b('0x11')](_0x5479ce)['send'](_0xaa3c);};}exports[_0xc09b('0x1f')]=function(_0x2a42f6,_0x490172){var _0x5862fd={},_0x2fb76f={},_0x4dadbe={'count':0x0,'rows':[]};var _0xf8f882=db['Attachment'][_0xc09b('0x20')];_0x2fb76f[_0xc09b('0x21')]=_[_0xc09b('0x22')](_0xf8f882);var _0x512e52={'dateStart':_0x2a42f6[_0xc09b('0x23')][_0xc09b('0x24')],'dateEnd':_0x2a42f6[_0xc09b('0x23')][_0xc09b('0x25')]};delete _0x2a42f6[_0xc09b('0x23')][_0xc09b('0x24')];delete _0x2a42f6[_0xc09b('0x23')]['dateEnd'];_0x2fb76f[_0xc09b('0x23')]=_['keys'](_0x2a42f6[_0xc09b('0x23')]);_0x2fb76f[_0xc09b('0x26')]=_[_0xc09b('0x27')](_0x2fb76f['model'],_0x2fb76f[_0xc09b('0x23')]);_0x5862fd[_0xc09b('0x28')]=_[_0xc09b('0x27')](_0x2fb76f[_0xc09b('0x21')],qs['fields'](_0x2a42f6[_0xc09b('0x23')][_0xc09b('0x29')]));_0x5862fd[_0xc09b('0x28')]=_0x5862fd[_0xc09b('0x28')][_0xc09b('0x2a')]?_0x5862fd[_0xc09b('0x28')]:_0x2fb76f['model'];if(!_0x2a42f6[_0xc09b('0x23')][_0xc09b('0x2b')]('nolimit')){_0x5862fd[_0xc09b('0x15')]=qs[_0xc09b('0x15')](_0x2a42f6[_0xc09b('0x23')][_0xc09b('0x15')]);_0x5862fd[_0xc09b('0x14')]=qs[_0xc09b('0x14')](_0x2a42f6[_0xc09b('0x23')][_0xc09b('0x14')]);}_0x5862fd[_0xc09b('0x2c')]=qs['sort'](_0x2a42f6[_0xc09b('0x23')]['sort']);_0x5862fd[_0xc09b('0x2d')]=qs[_0xc09b('0x26')](_['pick'](_0x2a42f6[_0xc09b('0x23')],_0x2fb76f['filters']));if(_0x512e52[_0xc09b('0x24')]){if(_0x512e52[_0xc09b('0x25')]){_0x512e52[_0xc09b('0x25')]=moment(_0x512e52[_0xc09b('0x25')])['add'](0x1,_0xc09b('0x2e'));}else{_0x512e52[_0xc09b('0x25')]=moment(_0x512e52[_0xc09b('0x24')])['add'](0x1,_0xc09b('0x2e'));}_[_0xc09b('0x2f')](_0x5862fd[_0xc09b('0x2d')],{'createdAt':{'$gte':_0x512e52['dateStart'],'$lte':_0x512e52['dateEnd']}});}if(_0x2a42f6[_0xc09b('0x23')]['filter']){_0x5862fd['where']=_[_0xc09b('0x2f')](_0x5862fd[_0xc09b('0x2d')],{'$or':_[_0xc09b('0x30')](_0x5862fd[_0xc09b('0x28')],function(_0x399df0){var _0x7d1b86={};_0x7d1b86[_0x399df0]={'$like':'%'+_0x2a42f6[_0xc09b('0x23')][_0xc09b('0x31')]+'%'};return _0x7d1b86;})});}_0x5862fd=_['merge']({},_0x5862fd,_0x2a42f6[_0xc09b('0x32')]);var _0x175f25={'where':_0x5862fd[_0xc09b('0x2d')]};return db[_0xc09b('0x33')]['count'](_0x175f25)[_0xc09b('0x1a')](function(_0x424df2){_0x4dadbe[_0xc09b('0x34')]=_0x424df2;if(_0x2a42f6[_0xc09b('0x23')][_0xc09b('0x35')]){_0x5862fd['include']=[{'all':!![]}];}return db[_0xc09b('0x33')][_0xc09b('0x36')](_0x5862fd);})[_0xc09b('0x1a')](function(_0x4050e4){_0x4dadbe[_0xc09b('0x37')]=_0x4050e4;return _0x4dadbe;})[_0xc09b('0x1a')](respondWithFilteredResult(_0x490172,_0x5862fd))[_0xc09b('0x38')](handleError(_0x490172,null));};exports['show']=function(_0x3dee11,_0x170de3){var _0xb3d292={'raw':!![],'where':{'id':_0x3dee11[_0xc09b('0x39')]['id']}},_0x47d2c3={};_0x47d2c3[_0xc09b('0x21')]=_[_0xc09b('0x22')](db[_0xc09b('0x33')][_0xc09b('0x20')]);_0x47d2c3['query']=_[_0xc09b('0x22')](_0x3dee11[_0xc09b('0x23')]);_0x47d2c3[_0xc09b('0x26')]=_[_0xc09b('0x27')](_0x47d2c3[_0xc09b('0x21')],_0x47d2c3[_0xc09b('0x23')]);_0xb3d292[_0xc09b('0x28')]=_[_0xc09b('0x27')](_0x47d2c3[_0xc09b('0x21')],qs[_0xc09b('0x29')](_0x3dee11[_0xc09b('0x23')][_0xc09b('0x29')]));_0xb3d292['attributes']=_0xb3d292[_0xc09b('0x28')][_0xc09b('0x2a')]?_0xb3d292[_0xc09b('0x28')]:_0x47d2c3[_0xc09b('0x21')];if(_0x3dee11['query'][_0xc09b('0x35')]){_0xb3d292[_0xc09b('0x3a')]=[{'all':!![]}];}_0xb3d292=_[_0xc09b('0x2f')]({},_0xb3d292,_0x3dee11[_0xc09b('0x32')]);return db['Attachment'][_0xc09b('0x3b')](_0xb3d292)['then'](handleEntityNotFound(_0x170de3,null))['then'](respondWithResult(_0x170de3,null))[_0xc09b('0x38')](handleError(_0x170de3,null));};exports[_0xc09b('0x19')]=function(_0x21b870,_0x55c204){if(_0x21b870[_0xc09b('0x3c')]['id']){delete _0x21b870[_0xc09b('0x3c')]['id'];}return db[_0xc09b('0x33')][_0xc09b('0x3b')]({'where':{'id':_0x21b870[_0xc09b('0x39')]['id']}})[_0xc09b('0x1a')](handleEntityNotFound(_0x55c204,null))['then'](saveUpdates(_0x21b870['body'],null))[_0xc09b('0x1a')](respondWithResult(_0x55c204,null))[_0xc09b('0x38')](handleError(_0x55c204,null));};exports[_0xc09b('0x3d')]=function(_0x35eb54,_0x455ca9){return db[_0xc09b('0x33')]['find']({'where':{'id':_0x35eb54[_0xc09b('0x39')]['id']}})[_0xc09b('0x1a')](handleEntityNotFound(_0x455ca9,null))[_0xc09b('0x1a')](removeEntity(_0x455ca9,null))[_0xc09b('0x38')](handleError(_0x455ca9,null));};exports[_0xc09b('0x3e')]=function(_0xa5c00f,_0x2a9831,_0x36b03e){_0xa5c00f[_0xc09b('0x3c')]['name']=_0xa5c00f[_0xc09b('0x3f')][_0xc09b('0x40')];_0xa5c00f[_0xc09b('0x3c')][_0xc09b('0x41')]=_0xa5c00f[_0xc09b('0x3f')][_0xc09b('0x42')];_0xa5c00f['body']['type']=_0xa5c00f[_0xc09b('0x3f')]['mimetype'];return db[_0xc09b('0x33')][_0xc09b('0x3e')](_0xa5c00f[_0xc09b('0x3c')])['then'](respondWithResult(_0x2a9831,0xc9))[_0xc09b('0x38')](handleError(_0x2a9831,null));};exports[_0xc09b('0x43')]=function(_0x278d31,_0x4b5a5e,_0x439689){return db[_0xc09b('0x33')][_0xc09b('0x44')]({'where':{'id':_0x278d31[_0xc09b('0x39')]['id']},'raw':!![]})[_0xc09b('0x1a')](handleEntityNotFound(_0x4b5a5e,null))[_0xc09b('0x1a')](function(_0x12a565){if(_0x12a565){return _0x4b5a5e[_0xc09b('0x43')](path[_0xc09b('0x45')](config['root'],_0xc09b('0x46'),_0x12a565[_0xc09b('0x41')]));}})[_0xc09b('0x38')](handleError(_0x4b5a5e,null));}; \ No newline at end of file +var _0xb157=['papaparse','../../config/logger','../../config/utils','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','update','then','error','stack','name','send','rawAttributes','model','query','dateEnd','dateStart','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','add','day','merge','map','filter','Attachment','includeAll','include','findAll','rows','catch','show','params','options','body','find','destroy','create','file','originalname','type','download','findOne','join','root','server/files/attachments/','basename','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x4a0ae2,_0x4930df){var _0x3986a6=function(_0xd8c3cf){while(--_0xd8c3cf){_0x4a0ae2['push'](_0x4a0ae2['shift']());}};_0x3986a6(++_0x4930df);}(_0xb157,0x11e));var _0x7b15=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb157[_0x3947c9];return _0x2e7871;};'use strict';var jsonpatch=require(_0x7b15('0x0'));var rp=require(_0x7b15('0x1'));var moment=require(_0x7b15('0x2'));var BPromise=require(_0x7b15('0x3'));var Mustache=require('mustache');var util=require(_0x7b15('0x4'));var path=require(_0x7b15('0x5'));var sox=require(_0x7b15('0x6'));var csv=require(_0x7b15('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7b15('0x8'));var squel=require(_0x7b15('0x9'));var crypto=require(_0x7b15('0xa'));var jsforce=require(_0x7b15('0xb'));var deskjs=require(_0x7b15('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7b15('0xd'));var Papa=require(_0x7b15('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0x7b15('0xf'))('api');var utils=require(_0x7b15('0x10'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4979b3,_0x35fd50){_0x35fd50=_0x35fd50||0xcc;return function(_0x5c3d21){if(_0x5c3d21){return _0x4979b3[_0x7b15('0x11')](_0x35fd50);}return _0x4979b3['status'](_0x35fd50)['end']();};}function respondWithResult(_0x2be3d1,_0x307d7e){_0x307d7e=_0x307d7e||0xc8;return function(_0x2a7e63){if(_0x2a7e63){return _0x2be3d1[_0x7b15('0x12')](_0x307d7e)['json'](_0x2a7e63);}};}function respondWithFilteredResult(_0x3b306b,_0x510c9f){return function(_0x7440f9){if(_0x7440f9){var _0x53d1bf=_0x7440f9[_0x7b15('0x13')],_0x430a3f=_0x510c9f['offset'],_0x513ce5=_0x510c9f[_0x7b15('0x14')]+_0x510c9f[_0x7b15('0x15')],_0x1ea90e;if(_0x513ce5>=_0x53d1bf){_0x513ce5=_0x53d1bf;_0x1ea90e=0xc8;}else{_0x1ea90e=0xce;}_0x3b306b[_0x7b15('0x12')](_0x1ea90e);return _0x3b306b[_0x7b15('0x16')](_0x7b15('0x17'),_0x430a3f+'-'+_0x513ce5+'/'+_0x53d1bf)[_0x7b15('0x18')](_0x7440f9);}return null;};}function patchUpdates(_0x3c89da){return function(_0x5d5ac3){try{jsonpatch[_0x7b15('0x19')](_0x5d5ac3,_0x3c89da,!![]);}catch(_0x16cc49){return BPromise['reject'](_0x16cc49);}return _0x5d5ac3['save']();};}function saveUpdates(_0x28b326,_0x4d13ba){return function(_0x37758a){if(_0x37758a){return _0x37758a[_0x7b15('0x1a')](_0x28b326)[_0x7b15('0x1b')](function(_0x63c8a){return _0x63c8a;});}return null;};}function removeEntity(_0x3494a6,_0x17e17b){return function(_0x363873){if(_0x363873){return _0x363873['destroy']()[_0x7b15('0x1b')](function(){_0x3494a6[_0x7b15('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bebbd,_0x396d99){return function(_0x197976){if(!_0x197976){_0x1bebbd[_0x7b15('0x11')](0x194);}return _0x197976;};}function handleError(_0x413563,_0x579d19){_0x579d19=_0x579d19||0x1f4;return function(_0x586f12){logger[_0x7b15('0x1c')](_0x586f12[_0x7b15('0x1d')]);if(_0x586f12['name']){delete _0x586f12[_0x7b15('0x1e')];}_0x413563[_0x7b15('0x12')](_0x579d19)[_0x7b15('0x1f')](_0x586f12);};}exports['index']=function(_0x164a44,_0x4e5279){var _0x49eca7={},_0x2e4f6d={},_0x1afa98={'count':0x0,'rows':[]};var _0x57cc5c=db['Attachment'][_0x7b15('0x20')];_0x2e4f6d[_0x7b15('0x21')]=_['keys'](_0x57cc5c);var _0x4a0106={'dateStart':_0x164a44[_0x7b15('0x22')]['dateStart'],'dateEnd':_0x164a44['query'][_0x7b15('0x23')]};delete _0x164a44[_0x7b15('0x22')][_0x7b15('0x24')];delete _0x164a44[_0x7b15('0x22')]['dateEnd'];_0x2e4f6d[_0x7b15('0x22')]=_[_0x7b15('0x25')](_0x164a44['query']);_0x2e4f6d['filters']=_['intersection'](_0x2e4f6d[_0x7b15('0x21')],_0x2e4f6d[_0x7b15('0x22')]);_0x49eca7['attributes']=_[_0x7b15('0x26')](_0x2e4f6d[_0x7b15('0x21')],qs[_0x7b15('0x27')](_0x164a44['query'][_0x7b15('0x27')]));_0x49eca7[_0x7b15('0x28')]=_0x49eca7[_0x7b15('0x28')][_0x7b15('0x29')]?_0x49eca7['attributes']:_0x2e4f6d[_0x7b15('0x21')];if(!_0x164a44[_0x7b15('0x22')]['hasOwnProperty'](_0x7b15('0x2a'))){_0x49eca7[_0x7b15('0x15')]=qs[_0x7b15('0x15')](_0x164a44[_0x7b15('0x22')][_0x7b15('0x15')]);_0x49eca7[_0x7b15('0x14')]=qs['offset'](_0x164a44[_0x7b15('0x22')]['offset']);}_0x49eca7[_0x7b15('0x2b')]=qs[_0x7b15('0x2c')](_0x164a44[_0x7b15('0x22')][_0x7b15('0x2c')]);_0x49eca7[_0x7b15('0x2d')]=qs[_0x7b15('0x2e')](_[_0x7b15('0x2f')](_0x164a44[_0x7b15('0x22')],_0x2e4f6d[_0x7b15('0x2e')]));if(_0x4a0106[_0x7b15('0x24')]){if(_0x4a0106[_0x7b15('0x23')]){_0x4a0106[_0x7b15('0x23')]=moment(_0x4a0106[_0x7b15('0x23')])[_0x7b15('0x30')](0x1,_0x7b15('0x31'));}else{_0x4a0106[_0x7b15('0x23')]=moment(_0x4a0106['dateStart'])[_0x7b15('0x30')](0x1,'day');}_[_0x7b15('0x32')](_0x49eca7['where'],{'createdAt':{'$gte':_0x4a0106[_0x7b15('0x24')],'$lte':_0x4a0106[_0x7b15('0x23')]}});}if(_0x164a44['query']['filter']){_0x49eca7[_0x7b15('0x2d')]=_[_0x7b15('0x32')](_0x49eca7['where'],{'$or':_[_0x7b15('0x33')](_0x49eca7['attributes'],function(_0x9e731e){var _0x5e7e5c={};_0x5e7e5c[_0x9e731e]={'$like':'%'+_0x164a44[_0x7b15('0x22')][_0x7b15('0x34')]+'%'};return _0x5e7e5c;})});}_0x49eca7=_[_0x7b15('0x32')]({},_0x49eca7,_0x164a44['options']);var _0x8bd2b={'where':_0x49eca7[_0x7b15('0x2d')]};return db[_0x7b15('0x35')][_0x7b15('0x13')](_0x8bd2b)[_0x7b15('0x1b')](function(_0x4f0425){_0x1afa98[_0x7b15('0x13')]=_0x4f0425;if(_0x164a44[_0x7b15('0x22')][_0x7b15('0x36')]){_0x49eca7[_0x7b15('0x37')]=[{'all':!![]}];}return db[_0x7b15('0x35')][_0x7b15('0x38')](_0x49eca7);})['then'](function(_0x387b24){_0x1afa98[_0x7b15('0x39')]=_0x387b24;return _0x1afa98;})[_0x7b15('0x1b')](respondWithFilteredResult(_0x4e5279,_0x49eca7))[_0x7b15('0x3a')](handleError(_0x4e5279,null));};exports[_0x7b15('0x3b')]=function(_0x36b85b,_0x518ee6){var _0x472ecf={'raw':!![],'where':{'id':_0x36b85b[_0x7b15('0x3c')]['id']}},_0x4ad001={};_0x4ad001[_0x7b15('0x21')]=_[_0x7b15('0x25')](db[_0x7b15('0x35')][_0x7b15('0x20')]);_0x4ad001[_0x7b15('0x22')]=_['keys'](_0x36b85b[_0x7b15('0x22')]);_0x4ad001[_0x7b15('0x2e')]=_[_0x7b15('0x26')](_0x4ad001[_0x7b15('0x21')],_0x4ad001['query']);_0x472ecf[_0x7b15('0x28')]=_['intersection'](_0x4ad001['model'],qs[_0x7b15('0x27')](_0x36b85b[_0x7b15('0x22')][_0x7b15('0x27')]));_0x472ecf['attributes']=_0x472ecf['attributes'][_0x7b15('0x29')]?_0x472ecf['attributes']:_0x4ad001['model'];if(_0x36b85b[_0x7b15('0x22')]['includeAll']){_0x472ecf[_0x7b15('0x37')]=[{'all':!![]}];}_0x472ecf=_[_0x7b15('0x32')]({},_0x472ecf,_0x36b85b[_0x7b15('0x3d')]);return db[_0x7b15('0x35')]['find'](_0x472ecf)['then'](handleEntityNotFound(_0x518ee6,null))['then'](respondWithResult(_0x518ee6,null))[_0x7b15('0x3a')](handleError(_0x518ee6,null));};exports[_0x7b15('0x1a')]=function(_0x20ad47,_0xfe170e){if(_0x20ad47[_0x7b15('0x3e')]['id']){delete _0x20ad47[_0x7b15('0x3e')]['id'];}return db[_0x7b15('0x35')][_0x7b15('0x3f')]({'where':{'id':_0x20ad47[_0x7b15('0x3c')]['id']}})['then'](handleEntityNotFound(_0xfe170e,null))['then'](saveUpdates(_0x20ad47[_0x7b15('0x3e')],null))['then'](respondWithResult(_0xfe170e,null))['catch'](handleError(_0xfe170e,null));};exports[_0x7b15('0x40')]=function(_0x45e030,_0x381d76){return db['Attachment'][_0x7b15('0x3f')]({'where':{'id':_0x45e030[_0x7b15('0x3c')]['id']}})[_0x7b15('0x1b')](handleEntityNotFound(_0x381d76,null))[_0x7b15('0x1b')](removeEntity(_0x381d76,null))[_0x7b15('0x3a')](handleError(_0x381d76,null));};exports[_0x7b15('0x41')]=function(_0x54818a,_0x498ee9,_0x4bb9f9){_0x54818a[_0x7b15('0x3e')][_0x7b15('0x1e')]=_0x54818a[_0x7b15('0x42')][_0x7b15('0x43')];_0x54818a['body']['basename']=_0x54818a[_0x7b15('0x42')]['filename'];_0x54818a[_0x7b15('0x3e')][_0x7b15('0x44')]=_0x54818a['file']['mimetype'];return db[_0x7b15('0x35')][_0x7b15('0x41')](_0x54818a['body'])[_0x7b15('0x1b')](respondWithResult(_0x498ee9,0xc9))[_0x7b15('0x3a')](handleError(_0x498ee9,null));};exports[_0x7b15('0x45')]=function(_0x23b92a,_0x614506,_0x59e501){return db[_0x7b15('0x35')][_0x7b15('0x46')]({'where':{'id':_0x23b92a[_0x7b15('0x3c')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x614506,null))[_0x7b15('0x1b')](function(_0x4f67b1){if(_0x4f67b1){return _0x614506['download'](path[_0x7b15('0x47')](config[_0x7b15('0x48')],_0x7b15('0x49'),_0x4f67b1[_0x7b15('0x4a')]));}})['catch'](handleError(_0x614506,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index cecbba1..600fab9 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 _0x1cb9=['exports','define','Attachment','attachments','lodash','../../config/logger','api','moment','bluebird','./attachment.attributes'];(function(_0x3d27ba,_0x2671a3){var _0xf01885=function(_0x311f5c){while(--_0x311f5c){_0x3d27ba['push'](_0x3d27ba['shift']());}};_0xf01885(++_0x2671a3);}(_0x1cb9,0x14e));var _0x91cb=function(_0x63927c,_0x298ea4){_0x63927c=_0x63927c-0x0;var _0x337f26=_0x1cb9[_0x63927c];return _0x337f26;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var attributes=require(_0x91cb('0x5'));module[_0x91cb('0x6')]=function(_0x5652cd,_0x17c21c){return _0x5652cd[_0x91cb('0x7')](_0x91cb('0x8'),attributes,{'tableName':_0x91cb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['util','../../config/logger','api','moment','bluebird','request-promise','exports','define','lodash'];(function(_0x1f1b51,_0x3604eb){var _0x3ccf2f=function(_0x2c2e7d){while(--_0x2c2e7d){_0x1f1b51['push'](_0x1f1b51['shift']());}};_0x3ccf2f(++_0x3604eb);}(_0x8ef6,0xf2));var _0x68ef=function(_0x371fb3,_0x3f10f7){_0x371fb3=_0x371fb3-0x0;var _0x152c7c=_0x8ef6[_0x371fb3];return _0x152c7c;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var attributes=require('./attachment.attributes');module[_0x68ef('0x7')]=function(_0x129ce,_0xbab618){return _0x129ce[_0x68ef('0x8')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index e0c5d12..076bfdf 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 _0x5236=['http','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateAttachment','Attachment','create','options','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x58999b,_0xea4695){var _0x5efc3a=function(_0x98de31){while(--_0x98de31){_0x58999b['push'](_0x58999b['shift']());}};_0x5efc3a(++_0xea4695);}(_0x5236,0x109));var _0x6523=function(_0x1cee0f,_0x27016c){_0x1cee0f=_0x1cee0f-0x0;var _0x1c4fc7=_0x5236[_0x1cee0f];return _0x1c4fc7;};'use strict';var _=require(_0x6523('0x0'));var util=require(_0x6523('0x1'));var moment=require(_0x6523('0x2'));var BPromise=require(_0x6523('0x3'));var rs=require(_0x6523('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x6523('0x5'));var logger=require(_0x6523('0x6'))('rpc');var config=require(_0x6523('0x7'));var jayson=require(_0x6523('0x8'));var client=jayson[_0x6523('0x9')][_0x6523('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fcb0d,_0x53548c,_0x32e99c){return new BPromise(function(_0x17b335,_0x24550b){return client['request'](_0x3fcb0d,_0x32e99c)[_0x6523('0xb')](function(_0x1c7d9f){logger[_0x6523('0xc')](_0x6523('0xd'),_0x53548c,_0x6523('0xe'));logger[_0x6523('0xf')]('Attachment,\x20%s,\x20%s,\x20%s',_0x53548c,_0x6523('0xe'),JSON[_0x6523('0x10')](_0x1c7d9f));if(_0x1c7d9f[_0x6523('0x11')]){if(_0x1c7d9f[_0x6523('0x11')][_0x6523('0x12')]===0x1f4){logger['error'](_0x6523('0xd'),_0x53548c,_0x1c7d9f[_0x6523('0x11')]['message']);return _0x24550b(_0x1c7d9f[_0x6523('0x11')]['message']);}logger['error'](_0x6523('0xd'),_0x53548c,_0x1c7d9f[_0x6523('0x11')][_0x6523('0x13')]);return _0x17b335(_0x1c7d9f[_0x6523('0x11')][_0x6523('0x13')]);}else{logger[_0x6523('0xc')]('Attachment,\x20%s,\x20%s',_0x53548c,_0x6523('0xe'));_0x17b335(_0x1c7d9f['result'][_0x6523('0x13')]);}})[_0x6523('0x14')](function(_0x15eaf8){logger[_0x6523('0x11')](_0x6523('0xd'),_0x53548c,_0x15eaf8);_0x24550b(_0x15eaf8);});});}exports[_0x6523('0x15')]=function(_0x17325a){var _0x303a1e=this;return new Promise(function(_0x59db97,_0x9bc6b1){return db[_0x6523('0x16')][_0x6523('0x17')](_0x17325a['body'],{'raw':_0x17325a[_0x6523('0x18')]?_0x17325a['options']['raw']===undefined?!![]:![]:!![]})[_0x6523('0xb')](function(_0x193be6){logger[_0x6523('0xc')](_0x6523('0x15'),_0x17325a);logger[_0x6523('0xf')](_0x6523('0x15'),_0x17325a,JSON[_0x6523('0x10')](_0x193be6));_0x59db97(_0x193be6);})[_0x6523('0x14')](function(_0x5ca8c4){logger['error'](_0x6523('0x15'),_0x5ca8c4['message'],_0x17325a);_0x9bc6b1(_0x303a1e[_0x6523('0x11')](0x1f4,_0x5ca8c4[_0x6523('0x13')]));});});}; \ No newline at end of file +var _0x6017=['then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','Attachment,\x20%s,\x20%s','message','result','catch','Attachment','create','body','options','raw','CreateAttachment','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','http'];(function(_0xfa5045,_0x4b8b43){var _0x742b13=function(_0x537b48){while(--_0x537b48){_0xfa5045['push'](_0xfa5045['shift']());}};_0x742b13(++_0x4b8b43);}(_0x6017,0xae));var _0x7601=function(_0x5c6c50,_0x12d0b1){_0x5c6c50=_0x5c6c50-0x0;var _0x1410d1=_0x6017[_0x5c6c50];return _0x1410d1;};'use strict';var _=require(_0x7601('0x0'));var util=require(_0x7601('0x1'));var moment=require(_0x7601('0x2'));var BPromise=require('bluebird');var rs=require(_0x7601('0x3'));var fs=require('fs');var db=require(_0x7601('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7601('0x5'))('rpc');var config=require(_0x7601('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7601('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xc62b2c,_0xcb5ed9,_0x34a36d){return new BPromise(function(_0x2bc643,_0xe6e524){return client['request'](_0xc62b2c,_0x34a36d)[_0x7601('0x8')](function(_0x343215){logger[_0x7601('0x9')]('Attachment,\x20%s,\x20%s',_0xcb5ed9,_0x7601('0xa'));logger[_0x7601('0xb')](_0x7601('0xc'),_0xcb5ed9,'request\x20sent',JSON[_0x7601('0xd')](_0x343215));if(_0x343215[_0x7601('0xe')]){if(_0x343215[_0x7601('0xe')][_0x7601('0xf')]===0x1f4){logger[_0x7601('0xe')](_0x7601('0x10'),_0xcb5ed9,_0x343215[_0x7601('0xe')][_0x7601('0x11')]);return _0xe6e524(_0x343215[_0x7601('0xe')][_0x7601('0x11')]);}logger['error'](_0x7601('0x10'),_0xcb5ed9,_0x343215['error'][_0x7601('0x11')]);return _0x2bc643(_0x343215[_0x7601('0xe')][_0x7601('0x11')]);}else{logger[_0x7601('0x9')](_0x7601('0x10'),_0xcb5ed9,_0x7601('0xa'));_0x2bc643(_0x343215[_0x7601('0x12')][_0x7601('0x11')]);}})[_0x7601('0x13')](function(_0x5e99b9){logger[_0x7601('0xe')](_0x7601('0x10'),_0xcb5ed9,_0x5e99b9);_0xe6e524(_0x5e99b9);});});}exports['CreateAttachment']=function(_0x17ed47){var _0x5c3fb7=this;return new Promise(function(_0x5f530e,_0x22520e){return db[_0x7601('0x14')][_0x7601('0x15')](_0x17ed47[_0x7601('0x16')],{'raw':_0x17ed47[_0x7601('0x17')]?_0x17ed47[_0x7601('0x17')][_0x7601('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x1e1901){logger[_0x7601('0x9')]('CreateAttachment',_0x17ed47);logger[_0x7601('0xb')](_0x7601('0x19'),_0x17ed47,JSON[_0x7601('0xd')](_0x1e1901));_0x5f530e(_0x1e1901);})[_0x7601('0x13')](function(_0x99ab5b){logger[_0x7601('0xe')]('CreateAttachment',_0x99ab5b[_0x7601('0x11')],_0x17ed47);_0x22520e(_0x5c3fb7[_0x7601('0xe')](0x1f4,_0x99ab5b[_0x7601('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index d3f7404..6febcf2 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 _0xa9fc=['format','now','originalname','replace','post','single','file','create','put','exports','multer','util','path','express','Router','../../components/interaction/service','./attachment.controller','get','/:id','show','/:id/download','isAuthenticated','download','diskStorage','join','root','server/files/attachments/'];(function(_0x913be,_0x46ec6a){var _0x403cbf=function(_0x417351){while(--_0x417351){_0x913be['push'](_0x913be['shift']());}};_0x403cbf(++_0x46ec6a);}(_0xa9fc,0x19f));var _0xca9f=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0xa9fc[_0x22f8ab];return _0x2a70e5;};'use strict';var multer=require(_0xca9f('0x0'));var util=require(_0xca9f('0x1'));var path=require(_0xca9f('0x2'));var express=require(_0xca9f('0x3'));var router=express[_0xca9f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xca9f('0x5'));var config=require('../../config/environment');var controller=require(_0xca9f('0x6'));router[_0xca9f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xca9f('0x8'),auth['isAuthenticated'](),controller[_0xca9f('0x9')]);router[_0xca9f('0x7')](_0xca9f('0xa'),auth[_0xca9f('0xb')](),controller[_0xca9f('0xc')]);var upload=multer({'storage':multer[_0xca9f('0xd')]({'destination':function(_0x4713f0,_0x5ae48c,_0x5cd1db){_0x5cd1db(null,path[_0xca9f('0xe')](config[_0xca9f('0xf')],_0xca9f('0x10')));},'filename':function(_0x5d7bd8,_0x529ed0,_0x41bca1){_0x41bca1(null,util[_0xca9f('0x11')]('%s-%s',Date[_0xca9f('0x12')](),_0x529ed0[_0xca9f('0x13')][_0xca9f('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xca9f('0x15')]('/',upload[_0xca9f('0x16')](_0xca9f('0x17')),controller[_0xca9f('0x18')]);router[_0xca9f('0x19')](_0xca9f('0x8'),auth[_0xca9f('0xb')](),controller['update']);router['delete'](_0xca9f('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xca9f('0x1a')]=router; \ No newline at end of file +var _0x17a7=['post','update','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','./attachment.controller','isAuthenticated','index','/:id','show','get','diskStorage','join','format','%s-%s','originalname'];(function(_0x44c5c1,_0x4d9d55){var _0x467172=function(_0x584e24){while(--_0x584e24){_0x44c5c1['push'](_0x44c5c1['shift']());}};_0x467172(++_0x4d9d55);}(_0x17a7,0xc2));var _0x717a=function(_0x1c8dc9,_0x1945d0){_0x1c8dc9=_0x1c8dc9-0x0;var _0xf61493=_0x17a7[_0x1c8dc9];return _0xf61493;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0x717a('0x0'));var router=express[_0x717a('0x1')]();var auth=require(_0x717a('0x2'));var interaction=require(_0x717a('0x3'));var config=require('../../config/environment');var controller=require(_0x717a('0x4'));router['get']('/',auth[_0x717a('0x5')](),controller[_0x717a('0x6')]);router['get'](_0x717a('0x7'),auth[_0x717a('0x5')](),controller[_0x717a('0x8')]);router[_0x717a('0x9')]('/:id/download',auth[_0x717a('0x5')](),controller['download']);var upload=multer({'storage':multer[_0x717a('0xa')]({'destination':function(_0x567130,_0x21a2b1,_0x158be5){_0x158be5(null,path[_0x717a('0xb')](config['root'],'server/files/attachments/'));},'filename':function(_0x1d99ab,_0x273bb0,_0x2569eb){_0x2569eb(null,util[_0x717a('0xc')](_0x717a('0xd'),Date['now'](),_0x273bb0[_0x717a('0xe')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x717a('0xf')]('/',upload['single']('file'),controller['create']);router['put'](_0x717a('0x7'),auth['isAuthenticated'](),controller[_0x717a('0x10')]);router['delete'](_0x717a('0x7'),auth['isAuthenticated'](),controller[_0x717a('0x11')]);module[_0x717a('0x12')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 4cfd2f2..cda564d 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 _0x0a01=['emails','admin','user','agent','then','User\x20email\x20not\x20found!','lodash','passport','passport-google-oauth20','Strategy','../../config/environment','../../components/auth/service','signToken','login','authenticate','google','/login','profile','callback','use','clientSecret','secret','callbackURL','User','find','map'];(function(_0x296b88,_0x293cef){var _0x150363=function(_0x37ca28){while(--_0x37ca28){_0x296b88['push'](_0x296b88['shift']());}};_0x150363(++_0x293cef);}(_0x0a01,0x1a6));var _0x10a0=function(_0x292ecc,_0x2ed340){_0x292ecc=_0x292ecc-0x0;var _0x59aabc=_0x0a01[_0x292ecc];return _0x59aabc;};'use strict';var _=require(_0x10a0('0x0'));var passport=require(_0x10a0('0x1'));var GoogleStrategy=require(_0x10a0('0x2'))[_0x10a0('0x3')];var db=require('../../mysqldb')['db'];var config=require(_0x10a0('0x4'));var signToken=require(_0x10a0('0x5'))[_0x10a0('0x6')];exports[_0x10a0('0x7')]=passport[_0x10a0('0x8')](_0x10a0('0x9'),{'failureRedirect':_0x10a0('0xa'),'scope':[_0x10a0('0xb'),'email'],'session':![]});exports[_0x10a0('0xc')]=passport[_0x10a0('0x8')](_0x10a0('0x9'),{'failureRedirect':_0x10a0('0xa'),'session':![]});passport[_0x10a0('0xd')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config['google']?config[_0x10a0('0x9')][_0x10a0('0xe')]:_0x10a0('0xf'),'callbackURL':config[_0x10a0('0x9')]?config[_0x10a0('0x9')][_0x10a0('0x10')]:''},function(_0x14456c,_0x69aaff,_0x4f52ca,_0x28c3b0){db[_0x10a0('0x11')][_0x10a0('0x12')]({'where':{'email':_[_0x10a0('0x13')](_0x4f52ca[_0x10a0('0x14')],'value'),'role':{'$or':[_0x10a0('0x15'),_0x10a0('0x16'),_0x10a0('0x17')]}}})[_0x10a0('0x18')](function(_0x2e599d){if(_0x2e599d){return _0x28c3b0(null,_0x2e599d);}_0x28c3b0(_0x10a0('0x19'));})['catch'](function(_0x2d1e5d){_0x28c3b0(_0x2d1e5d);});})); \ No newline at end of file +var _0x6deb=['callbackURL','map','emails','value','user','agent','then','catch','lodash','passport','Strategy','signToken','login','authenticate','google','/login','email','callback','use','clientID','clientSecret','secret'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x6deb,0x8c));var _0xb6de=function(_0x48721b,_0x34b636){_0x48721b=_0x48721b-0x0;var _0x121c5e=_0x6deb[_0x48721b];return _0x121c5e;};'use strict';var _=require(_0xb6de('0x0'));var passport=require(_0xb6de('0x1'));var GoogleStrategy=require('passport-google-oauth20')[_0xb6de('0x2')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var signToken=require('../../components/auth/service')[_0xb6de('0x3')];exports[_0xb6de('0x4')]=passport[_0xb6de('0x5')](_0xb6de('0x6'),{'failureRedirect':_0xb6de('0x7'),'scope':['profile',_0xb6de('0x8')],'session':![]});exports[_0xb6de('0x9')]=passport[_0xb6de('0x5')](_0xb6de('0x6'),{'failureRedirect':_0xb6de('0x7'),'session':![]});passport[_0xb6de('0xa')](new GoogleStrategy({'clientID':config[_0xb6de('0x6')]?config[_0xb6de('0x6')][_0xb6de('0xb')]:'id','clientSecret':config['google']?config[_0xb6de('0x6')][_0xb6de('0xc')]:_0xb6de('0xd'),'callbackURL':config[_0xb6de('0x6')]?config[_0xb6de('0x6')][_0xb6de('0xe')]:''},function(_0x2db191,_0x556d27,_0x28b1dd,_0x371b70){db['User']['find']({'where':{'email':_[_0xb6de('0xf')](_0x28b1dd[_0xb6de('0x10')],_0xb6de('0x11')),'role':{'$or':['admin',_0xb6de('0x12'),_0xb6de('0x13')]}}})[_0xb6de('0x14')](function(_0x2365a6){if(_0x2365a6){return _0x371b70(null,_0x2365a6);}_0x371b70('User\x20email\x20not\x20found!');})[_0xb6de('0x15')](function(_0x393ba5){_0x371b70(_0x393ba5);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index ca90492..fede6f1 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 _0x6979=['../../components/auth/service','setTokenCookie','get','callback','exports','passport','Router','./authGoogle.controller'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0x6979,0x10d));var _0x9697=function(_0xb15182,_0x48d8fb){_0xb15182=_0xb15182-0x0;var _0x4a8749=_0x6979[_0xb15182];return _0x4a8749;};'use strict';var express=require('express');var passport=require(_0x9697('0x0'));var router=express[_0x9697('0x1')]();var controller=require(_0x9697('0x2'));var setTokenCookie=require(_0x9697('0x3'))[_0x9697('0x4')];router[_0x9697('0x5')]('/',controller['login']);router['get']('/callback',controller[_0x9697('0x6')],setTokenCookie);module[_0x9697('0x7')]=router; \ No newline at end of file +var _0x36cf=['/callback','exports','express','passport','Router','./authGoogle.controller','setTokenCookie','get','login'];(function(_0x18adec,_0x581874){var _0x4c4d5a=function(_0x230f94){while(--_0x230f94){_0x18adec['push'](_0x18adec['shift']());}};_0x4c4d5a(++_0x581874);}(_0x36cf,0xd1));var _0xf36c=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x36cf[_0x9df060];return _0x338dfe;};'use strict';var express=require(_0xf36c('0x0'));var passport=require(_0xf36c('0x1'));var router=express[_0xf36c('0x2')]();var controller=require(_0xf36c('0x3'));var setTokenCookie=require('../../components/auth/service')[_0xf36c('0x4')];router[_0xf36c('0x5')]('/',controller[_0xf36c('0x6')]);router[_0xf36c('0x5')](_0xf36c('0x7'),controller['callback'],setTokenCookie);module[_0xf36c('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index e022ef8..2d61aca 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 _0xdd89=['getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','find','trim','admin','This\x20name\x20is\x20not\x20registered.','authenticate','MailAccount','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','secure','authentication','user','pass','merge','format','\x22%s\x22\x20<%s>','name','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','stringify','status','send','message','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','generate','toLowerCase','This\x20email\x20is\x20not\x20registered.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','password','resetPasswordExpires','Password\x20reset!','use','util','passport','passport-local','Strategy','bluebird','lodash','../../config/logger','api','randomstring','../../mysqldb','../../components/auth/service','signToken','client','http','role','agent','User','count','then','../../config/license/util'];(function(_0x3f349f,_0x5ef575){var _0x304cd6=function(_0x43206e){while(--_0x43206e){_0x3f349f['push'](_0x3f349f['shift']());}};_0x304cd6(++_0x5ef575);}(_0xdd89,0x86));var _0x9dd8=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0xdd89[_0x45b034];return _0x509cb0;};'use strict';var util=require(_0x9dd8('0x0'));var passport=require(_0x9dd8('0x1'));var LocalStrategy=require(_0x9dd8('0x2'))[_0x9dd8('0x3')];var BPromise=require(_0x9dd8('0x4'));var jayson=require('jayson/promise');var _=require(_0x9dd8('0x5'));var logger=require(_0x9dd8('0x6'))(_0x9dd8('0x7'));var rs=require(_0x9dd8('0x8'));var db=require(_0x9dd8('0x9'))['db'];var signToken=require(_0x9dd8('0xa'))[_0x9dd8('0xb')];var client=jayson[_0x9dd8('0xc')][_0x9dd8('0xd')]({'port':0x232b});var getLicense=function(_0x1785a3){return new BPromise(function(_0x4ac891,_0x19de70){var _0x361c33=0x0;_0x1785a3[_0x9dd8('0xe')]!==_0x9dd8('0xf')&&_0x4ac891(_0x1785a3);return db[_0x9dd8('0x10')][_0x9dd8('0x11')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x1785a3['id']}}})[_0x9dd8('0x12')](function(_0xe0dc6b){_0x361c33=_0xe0dc6b;return require(_0x9dd8('0x13'))[_0x9dd8('0x14')]();})[_0x9dd8('0x12')](function(_0x29fe46){if(_0x29fe46&&_0x29fe46['agents']&&_0x361c33>=_0x29fe46[_0x9dd8('0x15')]){return _0x19de70({'message':_0x9dd8('0x16')});}return _0x4ac891(_0x1785a3);})[_0x9dd8('0x17')](function(_0x4e19d9){return _0x19de70(_0x4e19d9);});});};function localAuthenticate(_0x52ec62,_0x171817,_0x15486d,_0x5b1eec){var _0xa5ef05;_0x52ec62[_0x9dd8('0x18')]({'where':{'name':_0x171817[_0x9dd8('0x19')](),'role':{'$or':[_0x9dd8('0x1a'),'user',_0x9dd8('0xf')]}}})['then'](function(_0x114d15){if(!_0x114d15){return _0x5b1eec(null,![],{'message':_0x9dd8('0x1b')});}return getLicense(_0x114d15);})[_0x9dd8('0x12')](function(_0x181165){_0x181165[_0x9dd8('0x1c')](_0x15486d,function(_0x237624,_0x39954a){if(_0x237624){return _0x5b1eec(_0x237624);}if(!_0x39954a){return _0x5b1eec(null,![],{'message':'This\x20password\x20is\x20not\x20correct.'});}else{return _0x5b1eec(null,_0x181165);}});})[_0x9dd8('0x17')](function(_0x331e36){_0x5b1eec(_0x331e36);});}function sendServiceMail(_0x1b602e){return db[_0x9dd8('0x1d')][_0x9dd8('0x18')]({'where':{'service':!![]},'attributes':['id','name',_0x9dd8('0x1e')],'include':[{'model':db['MailServerOut'],'as':_0x9dd8('0x1f')}]})[_0x9dd8('0x12')](function(_0x533131){if(!_0x533131){throw new Error(_0x9dd8('0x20'));}var _0x484af3={'tls':{'rejectUnauthorized':![]}};if(_0x533131[_0x9dd8('0x1f')][_0x9dd8('0x21')]){_0x484af3[_0x9dd8('0x21')]=_0x533131[_0x9dd8('0x1f')]['service'];}else{_0x484af3[_0x9dd8('0x22')]=_0x533131[_0x9dd8('0x1f')][_0x9dd8('0x22')];_0x484af3['port']=_0x533131[_0x9dd8('0x1f')]['port'];_0x484af3[_0x9dd8('0x23')]=_0x533131['Smtp'][_0x9dd8('0x23')];}if(_0x533131[_0x9dd8('0x1f')][_0x9dd8('0x24')]){_0x484af3['auth']={'user':_0x533131[_0x9dd8('0x1f')][_0x9dd8('0x25')],'pass':_0x533131[_0x9dd8('0x1f')][_0x9dd8('0x26')]};}var _0x20d35f={'account':_0x484af3,'message':_[_0x9dd8('0x27')]({'from':util[_0x9dd8('0x28')](_0x9dd8('0x29'),_0x533131[_0x9dd8('0x2a')],_0x533131[_0x9dd8('0x1e')]||_0x533131[_0x9dd8('0x1f')][_0x9dd8('0x25')])},_0x1b602e)};return client['request'](_0x9dd8('0x2b'),_0x20d35f);})[_0x9dd8('0x12')](function(_0x40e3f3){if(_0x40e3f3['error']){throw new Error(util[_0x9dd8('0x28')](_0x9dd8('0x2c'),_0x40e3f3[_0x9dd8('0x2d')]['message']||JSON[_0x9dd8('0x2e')](_0x40e3f3['error'])));}return!![];});}function handleError(_0x31e840,_0x372882,_0x4a0588){return _0x31e840[_0x9dd8('0x2f')](_0x372882||0x1f4)[_0x9dd8('0x30')]({'message':_0x4a0588?_0x4a0588[_0x9dd8('0x31')]||_0x4a0588:''});}exports[_0x9dd8('0x32')]=function(_0x28dfe7,_0x7aeceb,_0x1a9366){passport[_0x9dd8('0x1c')](_0x9dd8('0x33'),function(_0x56983a,_0x4d542e,_0xda6c02){var _0x28938d=_0x56983a||_0xda6c02;if(_0x28938d){return handleError(_0x7aeceb,0x191,_0x28938d);}if(!_0x4d542e){return handleError(_0x7aeceb,0x194,{'message':_0x9dd8('0x34')});}var _0x1da158=signToken(_0x4d542e['id'],_0x4d542e['role']);_0x7aeceb[_0x9dd8('0x35')]({'id':_0x4d542e['id'],'token':_0x1da158,'statusCall':'','isAlreadyLogged':_0x4d542e[_0x9dd8('0x36')]});})(_0x28dfe7,_0x7aeceb,_0x1a9366);};exports[_0x9dd8('0x37')]=function(_0x3bc2a0,_0x2aef8f,_0xbac7f){if(!_0x3bc2a0[_0x9dd8('0x38')][_0x9dd8('0x1e')]){return handleError(_0x2aef8f,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x1dc316=rs[_0x9dd8('0x39')]();_0x3bc2a0['body'][_0x9dd8('0x1e')]=_0x3bc2a0[_0x9dd8('0x38')][_0x9dd8('0x1e')][_0x9dd8('0x19')]()[_0x9dd8('0x3a')]();return db[_0x9dd8('0x10')][_0x9dd8('0x18')]({'where':{'email':_0x3bc2a0[_0x9dd8('0x38')]['email']}})['then'](function(_0x424bb0){if(!_0x424bb0){throw new Error(_0x9dd8('0x3b'));}_0x424bb0[_0x9dd8('0x3c')]=_0x1dc316;_0x424bb0['resetPasswordExpires']=Date[_0x9dd8('0x3d')]()+0x36ee80;return _0x424bb0[_0x9dd8('0x3e')]();})[_0x9dd8('0x12')](function(){return sendServiceMail({'to':_0x3bc2a0['body']['email'],'subject':_0x9dd8('0x3f'),'text':_0x9dd8('0x40')+_0x9dd8('0x41')+_0x9dd8('0x42')+_0x3bc2a0[_0x9dd8('0x43')][_0x9dd8('0x22')]+'/reset/'+_0x1dc316+'\x0a\x0a'+_0x9dd8('0x44')});})[_0x9dd8('0x12')](function(){_0x2aef8f[_0x9dd8('0x2f')](0xc8)[_0x9dd8('0x30')]({'message':_0x9dd8('0x45')});})[_0x9dd8('0x17')](function(_0x13bff9){return handleError(_0x2aef8f,0x1f4,_0x13bff9);});};exports[_0x9dd8('0x46')]=function(_0x151077,_0x18d8eb,_0x313234){return db['User'][_0x9dd8('0x18')]({'where':{'resetPasswordToken':_0x151077[_0x9dd8('0x47')][_0x9dd8('0x48')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x9dd8('0x12')](function(_0x25baae){if(!_0x25baae){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}_0x25baae[_0x9dd8('0x49')]=_0x151077['body']['password'];_0x25baae[_0x9dd8('0x3c')]=null;_0x25baae[_0x9dd8('0x4a')]=null;return _0x25baae['save']();})[_0x9dd8('0x12')](function(){_0x18d8eb['status'](0xc8)[_0x9dd8('0x30')]({'message':_0x9dd8('0x4b')});})[_0x9dd8('0x17')](function(_0x278415){return handleError(_0x18d8eb,0x1f4,_0x278415);});};passport[_0x9dd8('0x4c')](new LocalStrategy({'usernameField':'name','passwordField':_0x9dd8('0x49')},function(_0x58b136,_0x36f1f7,_0x30774f){return localAuthenticate(db['User'],_0x58b136,_0x36f1f7,_0x30774f);})); \ No newline at end of file +var _0xfb96=['\x22%s\x22\x20<%s>','email','SendMail','error','message','stringify','status','login','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','reset','params','password','resetPasswordExpires','Password\x20reset!','use','util','passport','passport-local','bluebird','jayson/promise','lodash','../../config/logger','randomstring','signToken','client','http','role','agent','User','then','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','find','trim','user','This\x20name\x20is\x20not\x20registered.','MailAccount','name','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','format'];(function(_0x49b5ed,_0x35cb99){var _0x117247=function(_0x13d664){while(--_0x13d664){_0x49b5ed['push'](_0x49b5ed['shift']());}};_0x117247(++_0x35cb99);}(_0xfb96,0xb3));var _0x6fb9=function(_0x2a4937,_0x3c3440){_0x2a4937=_0x2a4937-0x0;var _0x1fc2c1=_0xfb96[_0x2a4937];return _0x1fc2c1;};'use strict';var util=require(_0x6fb9('0x0'));var passport=require(_0x6fb9('0x1'));var LocalStrategy=require(_0x6fb9('0x2'))['Strategy'];var BPromise=require(_0x6fb9('0x3'));var jayson=require(_0x6fb9('0x4'));var _=require(_0x6fb9('0x5'));var logger=require(_0x6fb9('0x6'))('api');var rs=require(_0x6fb9('0x7'));var db=require('../../mysqldb')['db'];var signToken=require('../../components/auth/service')[_0x6fb9('0x8')];var client=jayson[_0x6fb9('0x9')][_0x6fb9('0xa')]({'port':0x232b});var getLicense=function(_0xc17f9){return new BPromise(function(_0x56d3d7,_0x38e048){var _0x494973=0x0;_0xc17f9[_0x6fb9('0xb')]!==_0x6fb9('0xc')&&_0x56d3d7(_0xc17f9);return db[_0x6fb9('0xd')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0xc17f9['id']}}})[_0x6fb9('0xe')](function(_0x558f05){_0x494973=_0x558f05;return require(_0x6fb9('0xf'))[_0x6fb9('0x10')]();})['then'](function(_0x4bf5bd){if(_0x4bf5bd&&_0x4bf5bd[_0x6fb9('0x11')]&&_0x494973>=_0x4bf5bd[_0x6fb9('0x11')]){return _0x38e048({'message':_0x6fb9('0x12')});}return _0x56d3d7(_0xc17f9);})[_0x6fb9('0x13')](function(_0x5f247a){return _0x38e048(_0x5f247a);});});};function localAuthenticate(_0x81d88,_0x478586,_0x314220,_0x14755b){var _0x190dc4;_0x81d88[_0x6fb9('0x14')]({'where':{'name':_0x478586[_0x6fb9('0x15')](),'role':{'$or':['admin',_0x6fb9('0x16'),_0x6fb9('0xc')]}}})[_0x6fb9('0xe')](function(_0x3c9f98){if(!_0x3c9f98){return _0x14755b(null,![],{'message':_0x6fb9('0x17')});}return getLicense(_0x3c9f98);})[_0x6fb9('0xe')](function(_0x1dad4c){_0x1dad4c['authenticate'](_0x314220,function(_0x185511,_0x259dae){if(_0x185511){return _0x14755b(_0x185511);}if(!_0x259dae){return _0x14755b(null,![],{'message':'This\x20password\x20is\x20not\x20correct.'});}else{return _0x14755b(null,_0x1dad4c);}});})['catch'](function(_0x1d4d04){_0x14755b(_0x1d4d04);});}function sendServiceMail(_0x3237ce){return db[_0x6fb9('0x18')][_0x6fb9('0x14')]({'where':{'service':!![]},'attributes':['id',_0x6fb9('0x19'),'email'],'include':[{'model':db['MailServerOut'],'as':_0x6fb9('0x1a')}]})[_0x6fb9('0xe')](function(_0x5388f5){if(!_0x5388f5){throw new Error(_0x6fb9('0x1b'));}var _0x2c8ce3={'tls':{'rejectUnauthorized':![]}};if(_0x5388f5[_0x6fb9('0x1a')]['service']){_0x2c8ce3[_0x6fb9('0x1c')]=_0x5388f5[_0x6fb9('0x1a')][_0x6fb9('0x1c')];}else{_0x2c8ce3['host']=_0x5388f5[_0x6fb9('0x1a')][_0x6fb9('0x1d')];_0x2c8ce3[_0x6fb9('0x1e')]=_0x5388f5['Smtp'][_0x6fb9('0x1e')];_0x2c8ce3[_0x6fb9('0x1f')]=_0x5388f5[_0x6fb9('0x1a')][_0x6fb9('0x1f')];}if(_0x5388f5[_0x6fb9('0x1a')][_0x6fb9('0x20')]){_0x2c8ce3[_0x6fb9('0x21')]={'user':_0x5388f5[_0x6fb9('0x1a')]['user'],'pass':_0x5388f5[_0x6fb9('0x1a')][_0x6fb9('0x22')]};}var _0x166d5b={'account':_0x2c8ce3,'message':_[_0x6fb9('0x23')]({'from':util[_0x6fb9('0x24')](_0x6fb9('0x25'),_0x5388f5[_0x6fb9('0x19')],_0x5388f5[_0x6fb9('0x26')]||_0x5388f5['Smtp'][_0x6fb9('0x16')])},_0x3237ce)};return client['request'](_0x6fb9('0x27'),_0x166d5b);})['then'](function(_0x5ce092){if(_0x5ce092[_0x6fb9('0x28')]){throw new Error(util[_0x6fb9('0x24')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x5ce092['error'][_0x6fb9('0x29')]||JSON[_0x6fb9('0x2a')](_0x5ce092[_0x6fb9('0x28')])));}return!![];});}function handleError(_0x22b636,_0x458b62,_0x52d58f){return _0x22b636[_0x6fb9('0x2b')](_0x458b62||0x1f4)['send']({'message':_0x52d58f?_0x52d58f[_0x6fb9('0x29')]||_0x52d58f:''});}exports[_0x6fb9('0x2c')]=function(_0x343b82,_0x2c9b38,_0x4b8c60){passport[_0x6fb9('0x2d')](_0x6fb9('0x2e'),function(_0x11136f,_0x492a41,_0x29539a){var _0x2d4b09=_0x11136f||_0x29539a;if(_0x2d4b09){return handleError(_0x2c9b38,0x191,_0x2d4b09);}if(!_0x492a41){return handleError(_0x2c9b38,0x194,{'message':_0x6fb9('0x2f')});}var _0x43b4a1=signToken(_0x492a41['id'],_0x492a41[_0x6fb9('0xb')]);_0x2c9b38[_0x6fb9('0x30')]({'id':_0x492a41['id'],'token':_0x43b4a1,'statusCall':'','isAlreadyLogged':_0x492a41[_0x6fb9('0x31')]});})(_0x343b82,_0x2c9b38,_0x4b8c60);};exports[_0x6fb9('0x32')]=function(_0x2e8776,_0x52a7d3,_0x1065aa){if(!_0x2e8776[_0x6fb9('0x33')][_0x6fb9('0x26')]){return handleError(_0x52a7d3,0x1f4,{'message':_0x6fb9('0x34')});}var _0x37dc8b=rs[_0x6fb9('0x35')]();_0x2e8776[_0x6fb9('0x33')][_0x6fb9('0x26')]=_0x2e8776[_0x6fb9('0x33')][_0x6fb9('0x26')]['trim']()[_0x6fb9('0x36')]();return db[_0x6fb9('0xd')][_0x6fb9('0x14')]({'where':{'email':_0x2e8776['body']['email']}})[_0x6fb9('0xe')](function(_0x6d3737){if(!_0x6d3737){throw new Error('This\x20email\x20is\x20not\x20registered.');}_0x6d3737[_0x6fb9('0x37')]=_0x37dc8b;_0x6d3737['resetPasswordExpires']=Date[_0x6fb9('0x38')]()+0x36ee80;return _0x6d3737[_0x6fb9('0x39')]();})[_0x6fb9('0xe')](function(){return sendServiceMail({'to':_0x2e8776[_0x6fb9('0x33')][_0x6fb9('0x26')],'subject':_0x6fb9('0x3a'),'text':_0x6fb9('0x3b')+_0x6fb9('0x3c')+_0x6fb9('0x3d')+_0x2e8776[_0x6fb9('0x3e')]['host']+_0x6fb9('0x3f')+_0x37dc8b+'\x0a\x0a'+_0x6fb9('0x40')});})['then'](function(){_0x52a7d3[_0x6fb9('0x2b')](0xc8)[_0x6fb9('0x41')]({'message':'Reset\x20Email\x20sent!'});})[_0x6fb9('0x13')](function(_0x5a9f62){return handleError(_0x52a7d3,0x1f4,_0x5a9f62);});};exports[_0x6fb9('0x42')]=function(_0x45b543,_0x4c8f3b,_0x50171f){return db[_0x6fb9('0xd')][_0x6fb9('0x14')]({'where':{'resetPasswordToken':_0x45b543[_0x6fb9('0x43')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x30a001){if(!_0x30a001){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}_0x30a001[_0x6fb9('0x44')]=_0x45b543[_0x6fb9('0x33')][_0x6fb9('0x44')];_0x30a001[_0x6fb9('0x37')]=null;_0x30a001[_0x6fb9('0x45')]=null;return _0x30a001['save']();})[_0x6fb9('0xe')](function(){_0x4c8f3b['status'](0xc8)[_0x6fb9('0x41')]({'message':_0x6fb9('0x46')});})[_0x6fb9('0x13')](function(_0x24820d){return handleError(_0x4c8f3b,0x1f4,_0x24820d);});};passport[_0x6fb9('0x47')](new LocalStrategy({'usernameField':_0x6fb9('0x19'),'passwordField':_0x6fb9('0x44')},function(_0x10172e,_0x1968dc,_0x319f89){return localAuthenticate(db[_0x6fb9('0xd')],_0x10172e,_0x1968dc,_0x319f89);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 47fad47..2c236e3 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 _0xc3d8=['exports','express','Router','./authLocal.controller','post','login','/forgot'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc3d8,0x1b3));var _0x8c3d=function(_0x337db7,_0x25f94c){_0x337db7=_0x337db7-0x0;var _0x1733ba=_0xc3d8[_0x337db7];return _0x1733ba;};'use strict';var express=require(_0x8c3d('0x0'));var router=express[_0x8c3d('0x1')]();var controller=require(_0x8c3d('0x2'));router[_0x8c3d('0x3')]('/',controller[_0x8c3d('0x4')]);router[_0x8c3d('0x3')](_0x8c3d('0x5'),controller['forgot']);router[_0x8c3d('0x3')]('/reset/:token',controller['reset']);module[_0x8c3d('0x6')]=router; \ No newline at end of file +var _0x7251=['login','post','/forgot','forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller'];(function(_0x977be,_0x35932e){var _0x69ad1c=function(_0x2bce4d){while(--_0x2bce4d){_0x977be['push'](_0x977be['shift']());}};_0x69ad1c(++_0x35932e);}(_0x7251,0x6b));var _0x1725=function(_0x51902f,_0x18b76a){_0x51902f=_0x51902f-0x0;var _0x5d547b=_0x7251[_0x51902f];return _0x5d547b;};'use strict';var express=require(_0x1725('0x0'));var router=express[_0x1725('0x1')]();var controller=require(_0x1725('0x2'));router['post']('/',controller[_0x1725('0x3')]);router[_0x1725('0x4')](_0x1725('0x5'),controller[_0x1725('0x6')]);router[_0x1725('0x4')](_0x1725('0x7'),controller[_0x1725('0x8')]);module[_0x1725('0x9')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index e6dced0..7f307d3 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 _0x13cf=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x3a081b,_0x516437){var _0xb166c4=function(_0x22bc5d){while(--_0x22bc5d){_0x3a081b['push'](_0x3a081b['shift']());}};_0xb166c4(++_0x516437);}(_0x13cf,0x11d));var _0xf13c=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x13cf[_0x2d8fc2];return _0x3a9e53;};'use strict';var Sequelize=require(_0xf13c('0x0'));module[_0xf13c('0x1')]={'name':{'type':Sequelize[_0xf13c('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf13c('0x2')]},'status':{'type':Sequelize[_0xf13c('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xf13c('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x094c=['STRING','BOOLEAN','exports'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x094c,0x131));var _0xc094=function(_0x154cb5,_0x1a8d5a){_0x154cb5=_0x154cb5-0x0;var _0x3f574f=_0x094c[_0x154cb5];return _0x3f574f;};'use strict';var Sequelize=require('sequelize');module[_0xc094('0x0')]={'name':{'type':Sequelize[_0xc094('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc094('0x1')]},'status':{'type':Sequelize[_0xc094('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index e488294..171ae71 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 _0xf5bf=['sox','to-csv','lodash','crypto','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','save','update','then','destroy','sendStatus','name','send','index','Automation','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','include','catch','show','includeAll','options','find','create','body','params','addConditions','ids','omit','getConditions','Condition','addActions','getActions','findOne','Action','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x39af5b,_0x35a505){var _0x11dfbf=function(_0x498017){while(--_0x498017){_0x39af5b['push'](_0x39af5b['shift']());}};_0x11dfbf(++_0x35a505);}(_0xf5bf,0xd0));var _0xff5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf5bf[_0x3dd15e];return _0x231fd0;};'use strict';var jsonpatch=require(_0xff5b('0x0'));var rp=require('request-promise');var moment=require(_0xff5b('0x1'));var BPromise=require(_0xff5b('0x2'));var Mustache=require(_0xff5b('0x3'));var util=require(_0xff5b('0x4'));var path=require('path');var sox=require(_0xff5b('0x5'));var csv=require(_0xff5b('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xff5b('0x7'));var squel=require('squel');var crypto=require(_0xff5b('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xff5b('0x9'));var toCsv=require(_0xff5b('0x6'));var querystring=require(_0xff5b('0xa'));var Papa=require('papaparse');var qs=require(_0xff5b('0xb'));var logger=require(_0xff5b('0xc'))(_0xff5b('0xd'));var utils=require('../../config/utils');var config=require(_0xff5b('0xe'));var db=require(_0xff5b('0xf'))['db'];function respondWithStatusCode(_0x1b2114,_0x4454cc){_0x4454cc=_0x4454cc||0xcc;return function(_0x18bdff){if(_0x18bdff){return _0x1b2114['sendStatus'](_0x4454cc);}return _0x1b2114[_0xff5b('0x10')](_0x4454cc)['end']();};}function respondWithResult(_0x451fc3,_0x15f4ec){_0x15f4ec=_0x15f4ec||0xc8;return function(_0x22ae50){if(_0x22ae50){return _0x451fc3[_0xff5b('0x10')](_0x15f4ec)[_0xff5b('0x11')](_0x22ae50);}};}function respondWithFilteredResult(_0x3186b4,_0x5733c4){return function(_0x21f45e){if(_0x21f45e){var _0x4ce649=_0x21f45e[_0xff5b('0x12')],_0x3996d2=_0x5733c4['offset'],_0x5cc29b=_0x5733c4[_0xff5b('0x13')]+_0x5733c4[_0xff5b('0x14')],_0x2481b6;if(_0x5cc29b>=_0x4ce649){_0x5cc29b=_0x4ce649;_0x2481b6=0xc8;}else{_0x2481b6=0xce;}_0x3186b4['status'](_0x2481b6);return _0x3186b4[_0xff5b('0x15')]('Content-Range',_0x3996d2+'-'+_0x5cc29b+'/'+_0x4ce649)[_0xff5b('0x11')](_0x21f45e);}return null;};}function patchUpdates(_0x57dc91){return function(_0x354571){try{jsonpatch['apply'](_0x354571,_0x57dc91,!![]);}catch(_0x30067f){return BPromise['reject'](_0x30067f);}return _0x354571[_0xff5b('0x16')]();};}function saveUpdates(_0x7eb1b2,_0x3b3474){return function(_0x4954ec){if(_0x4954ec){return _0x4954ec[_0xff5b('0x17')](_0x7eb1b2)[_0xff5b('0x18')](function(_0x14d58b){return _0x14d58b;});}return null;};}function removeEntity(_0x5086cf,_0x38b6a8){return function(_0x328dba){if(_0x328dba){return _0x328dba[_0xff5b('0x19')]()[_0xff5b('0x18')](function(){_0x5086cf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b394c,_0x5a3d3d){return function(_0xf3a28b){if(!_0xf3a28b){_0x5b394c[_0xff5b('0x1a')](0x194);}return _0xf3a28b;};}function handleError(_0xc7d4a3,_0x2a031a){_0x2a031a=_0x2a031a||0x1f4;return function(_0x5b572e){logger['error'](_0x5b572e['stack']);if(_0x5b572e['name']){delete _0x5b572e[_0xff5b('0x1b')];}_0xc7d4a3[_0xff5b('0x10')](_0x2a031a)[_0xff5b('0x1c')](_0x5b572e);};}exports[_0xff5b('0x1d')]=function(_0x356f3a,_0xd0b72c){var _0x5c3484={},_0x564c42={},_0x2eafa2={'count':0x0,'rows':[]};var _0x2ff7b3=db[_0xff5b('0x1e')][_0xff5b('0x1f')];_0x564c42[_0xff5b('0x20')]=_[_0xff5b('0x21')](_0x2ff7b3);var _0x2efc28={'dateStart':_0x356f3a[_0xff5b('0x22')][_0xff5b('0x23')],'dateEnd':_0x356f3a[_0xff5b('0x22')][_0xff5b('0x24')]};delete _0x356f3a[_0xff5b('0x22')]['dateStart'];delete _0x356f3a[_0xff5b('0x22')]['dateEnd'];_0x564c42[_0xff5b('0x22')]=_[_0xff5b('0x21')](_0x356f3a[_0xff5b('0x22')]);_0x564c42[_0xff5b('0x25')]=_['intersection'](_0x564c42[_0xff5b('0x20')],_0x564c42[_0xff5b('0x22')]);_0x5c3484['attributes']=_[_0xff5b('0x26')](_0x564c42['model'],qs[_0xff5b('0x27')](_0x356f3a[_0xff5b('0x22')]['fields']));_0x5c3484[_0xff5b('0x28')]=_0x5c3484[_0xff5b('0x28')][_0xff5b('0x29')]?_0x5c3484['attributes']:_0x564c42[_0xff5b('0x20')];if(!_0x356f3a[_0xff5b('0x22')][_0xff5b('0x2a')](_0xff5b('0x2b'))){_0x5c3484[_0xff5b('0x14')]=qs[_0xff5b('0x14')](_0x356f3a[_0xff5b('0x22')][_0xff5b('0x14')]);_0x5c3484[_0xff5b('0x13')]=qs[_0xff5b('0x13')](_0x356f3a[_0xff5b('0x22')][_0xff5b('0x13')]);}_0x5c3484[_0xff5b('0x2c')]=qs[_0xff5b('0x2d')](_0x356f3a[_0xff5b('0x22')][_0xff5b('0x2d')]);_0x5c3484[_0xff5b('0x2e')]=qs[_0xff5b('0x25')](_[_0xff5b('0x2f')](_0x356f3a[_0xff5b('0x22')],_0x564c42[_0xff5b('0x25')]));if(_0x2efc28[_0xff5b('0x23')]){if(_0x2efc28[_0xff5b('0x24')]){_0x2efc28[_0xff5b('0x24')]=moment(_0x2efc28['dateEnd'])[_0xff5b('0x30')](0x1,'day');}else{_0x2efc28['dateEnd']=moment(_0x2efc28[_0xff5b('0x23')])[_0xff5b('0x30')](0x1,_0xff5b('0x31'));}_[_0xff5b('0x32')](_0x5c3484[_0xff5b('0x2e')],{'createdAt':{'$gte':_0x2efc28[_0xff5b('0x23')],'$lte':_0x2efc28[_0xff5b('0x24')]}});}if(_0x356f3a[_0xff5b('0x22')][_0xff5b('0x33')]){_0x5c3484[_0xff5b('0x2e')]=_[_0xff5b('0x32')](_0x5c3484['where'],{'$or':_[_0xff5b('0x34')](_0x5c3484[_0xff5b('0x28')],function(_0x4dfebe){var _0x2c0f2a={};_0x2c0f2a[_0x4dfebe]={'$like':'%'+_0x356f3a[_0xff5b('0x22')][_0xff5b('0x33')]+'%'};return _0x2c0f2a;})});}_0x5c3484=_[_0xff5b('0x32')]({},_0x5c3484,_0x356f3a['options']);var _0x1a95b3={'where':_0x5c3484[_0xff5b('0x2e')]};return db[_0xff5b('0x1e')][_0xff5b('0x12')](_0x1a95b3)[_0xff5b('0x18')](function(_0x5513dd){_0x2eafa2[_0xff5b('0x12')]=_0x5513dd;if(_0x356f3a[_0xff5b('0x22')]['includeAll']){_0x5c3484[_0xff5b('0x35')]=[{'all':!![]}];}return db[_0xff5b('0x1e')]['findAll'](_0x5c3484);})['then'](function(_0x31b590){_0x2eafa2['rows']=_0x31b590;return _0x2eafa2;})[_0xff5b('0x18')](respondWithFilteredResult(_0xd0b72c,_0x5c3484))[_0xff5b('0x36')](handleError(_0xd0b72c,null));};exports[_0xff5b('0x37')]=function(_0x417810,_0x586030){var _0x306aba={'raw':![],'where':{'id':_0x417810['params']['id']}},_0x3b5a2e={};_0x3b5a2e[_0xff5b('0x20')]=_[_0xff5b('0x21')](db[_0xff5b('0x1e')]['rawAttributes']);_0x3b5a2e[_0xff5b('0x22')]=_[_0xff5b('0x21')](_0x417810[_0xff5b('0x22')]);_0x3b5a2e[_0xff5b('0x25')]=_[_0xff5b('0x26')](_0x3b5a2e[_0xff5b('0x20')],_0x3b5a2e[_0xff5b('0x22')]);_0x306aba['attributes']=_[_0xff5b('0x26')](_0x3b5a2e['model'],qs[_0xff5b('0x27')](_0x417810['query'][_0xff5b('0x27')]));_0x306aba['attributes']=_0x306aba[_0xff5b('0x28')][_0xff5b('0x29')]?_0x306aba[_0xff5b('0x28')]:_0x3b5a2e['model'];if(_0x417810['query'][_0xff5b('0x38')]){_0x306aba[_0xff5b('0x35')]=[{'all':!![]}];}_0x306aba=_[_0xff5b('0x32')]({},_0x306aba,_0x417810[_0xff5b('0x39')]);return db[_0xff5b('0x1e')][_0xff5b('0x3a')](_0x306aba)[_0xff5b('0x18')](handleEntityNotFound(_0x586030,null))[_0xff5b('0x18')](respondWithResult(_0x586030,null))[_0xff5b('0x36')](handleError(_0x586030,null));};exports[_0xff5b('0x3b')]=function(_0x45bf01,_0x16143c){return db[_0xff5b('0x1e')][_0xff5b('0x3b')](_0x45bf01[_0xff5b('0x3c')],{})['then'](respondWithResult(_0x16143c,0xc9))['catch'](handleError(_0x16143c,null));};exports[_0xff5b('0x17')]=function(_0x5a5d67,_0x23fa34){if(_0x5a5d67['body']['id']){delete _0x5a5d67[_0xff5b('0x3c')]['id'];}return db['Automation']['find']({'where':{'id':_0x5a5d67['params']['id']}})[_0xff5b('0x18')](handleEntityNotFound(_0x23fa34,null))['then'](saveUpdates(_0x5a5d67['body'],null))[_0xff5b('0x18')](respondWithResult(_0x23fa34,null))[_0xff5b('0x36')](handleError(_0x23fa34,null));};exports[_0xff5b('0x19')]=function(_0x2b71e1,_0x4b27aa){return db[_0xff5b('0x1e')]['find']({'where':{'id':_0x2b71e1[_0xff5b('0x3d')]['id']}})[_0xff5b('0x18')](handleEntityNotFound(_0x4b27aa,null))['then'](removeEntity(_0x4b27aa,null))['catch'](handleError(_0x4b27aa,null));};exports[_0xff5b('0x3e')]=function(_0xd06797,_0x3b368c,_0x2a8842){return db['Condition'][_0xff5b('0x3a')]({'where':{'id':_0xd06797[_0xff5b('0x3d')]['id']}})[_0xff5b('0x18')](handleEntityNotFound(_0x3b368c,null))['then'](function(_0x39ad33){if(_0x39ad33){return _0x39ad33[_0xff5b('0x3e')](_0xd06797[_0xff5b('0x3c')][_0xff5b('0x3f')],_[_0xff5b('0x40')](_0xd06797[_0xff5b('0x3c')],[_0xff5b('0x3f'),'id'])||{});}})[_0xff5b('0x18')](respondWithResult(_0x3b368c,null))[_0xff5b('0x36')](handleError(_0x3b368c,null));};exports[_0xff5b('0x41')]=function(_0x4fd632,_0x777f6a,_0xd08927){var _0x3fe0e7={};var _0x251261={};var _0x178d14;var _0x27dcd5;return db[_0xff5b('0x1e')]['findOne']({'where':{'id':_0x4fd632['params']['id']}})[_0xff5b('0x18')](handleEntityNotFound(_0x777f6a,null))[_0xff5b('0x18')](function(_0x2a9e2b){if(_0x2a9e2b){_0x178d14=_0x2a9e2b;_0x251261['model']=_['keys'](db[_0xff5b('0x42')]['rawAttributes']);_0x251261[_0xff5b('0x22')]=_['keys'](_0x4fd632[_0xff5b('0x22')]);_0x251261[_0xff5b('0x25')]=_[_0xff5b('0x26')](_0x251261[_0xff5b('0x20')],_0x251261['query']);_0x3fe0e7['attributes']=_[_0xff5b('0x26')](_0x251261[_0xff5b('0x20')],qs[_0xff5b('0x27')](_0x4fd632[_0xff5b('0x22')][_0xff5b('0x27')]));_0x3fe0e7['attributes']=_0x3fe0e7[_0xff5b('0x28')][_0xff5b('0x29')]?_0x3fe0e7[_0xff5b('0x28')]:_0x251261[_0xff5b('0x20')];_0x3fe0e7[_0xff5b('0x2c')]=qs[_0xff5b('0x2d')](_0x4fd632['query'][_0xff5b('0x2d')]);_0x3fe0e7[_0xff5b('0x2e')]=qs[_0xff5b('0x25')](_[_0xff5b('0x2f')](_0x4fd632[_0xff5b('0x22')],_0x251261[_0xff5b('0x25')]));if(_0x4fd632[_0xff5b('0x22')]['filter']){_0x3fe0e7['where']=_[_0xff5b('0x32')](_0x3fe0e7[_0xff5b('0x2e')],{'$or':_[_0xff5b('0x34')](_0x3fe0e7[_0xff5b('0x28')],function(_0x4efd93){var _0x3fdb5d={};_0x3fdb5d[_0x4efd93]={'$like':'%'+_0x4fd632['query'][_0xff5b('0x33')]+'%'};return _0x3fdb5d;})});}_0x3fe0e7=_[_0xff5b('0x32')]({},_0x3fe0e7,_0x4fd632[_0xff5b('0x39')]);return _0x178d14[_0xff5b('0x41')](_0x3fe0e7);}})[_0xff5b('0x18')](function(_0x57d726){if(_0x57d726){_0x27dcd5=_0x57d726[_0xff5b('0x29')];if(!_0x4fd632[_0xff5b('0x22')][_0xff5b('0x2a')](_0xff5b('0x2b'))){_0x3fe0e7[_0xff5b('0x14')]=qs[_0xff5b('0x14')](_0x4fd632[_0xff5b('0x22')][_0xff5b('0x14')]);_0x3fe0e7['offset']=qs[_0xff5b('0x13')](_0x4fd632[_0xff5b('0x22')][_0xff5b('0x13')]);}return _0x178d14[_0xff5b('0x41')](_0x3fe0e7);}})[_0xff5b('0x18')](function(_0x4d1b87){if(_0x4d1b87){return _0x4d1b87?{'count':_0x27dcd5,'rows':_0x4d1b87}:null;}})[_0xff5b('0x18')](respondWithResult(_0x777f6a,null))['catch'](handleError(_0x777f6a,null));};exports[_0xff5b('0x43')]=function(_0x4a43a6,_0x4f79ab,_0x548460){return db['Action'][_0xff5b('0x3a')]({'where':{'id':_0x4a43a6[_0xff5b('0x3d')]['id']}})[_0xff5b('0x18')](handleEntityNotFound(_0x4f79ab,null))[_0xff5b('0x18')](function(_0x2fe10e){if(_0x2fe10e){return _0x2fe10e[_0xff5b('0x43')](_0x4a43a6[_0xff5b('0x3c')][_0xff5b('0x3f')],_[_0xff5b('0x40')](_0x4a43a6[_0xff5b('0x3c')],['ids','id'])||{});}})[_0xff5b('0x18')](respondWithResult(_0x4f79ab,null))[_0xff5b('0x36')](handleError(_0x4f79ab,null));};exports[_0xff5b('0x44')]=function(_0x4c4709,_0x5807fc,_0x2cf3f8){var _0x176d5f={};var _0x85271={};var _0xda0033;var _0x156342;return db[_0xff5b('0x1e')][_0xff5b('0x45')]({'where':{'id':_0x4c4709[_0xff5b('0x3d')]['id']}})[_0xff5b('0x18')](handleEntityNotFound(_0x5807fc,null))[_0xff5b('0x18')](function(_0x59d2d7){if(_0x59d2d7){_0xda0033=_0x59d2d7;_0x85271['model']=_[_0xff5b('0x21')](db[_0xff5b('0x46')][_0xff5b('0x1f')]);_0x85271[_0xff5b('0x22')]=_['keys'](_0x4c4709[_0xff5b('0x22')]);_0x85271[_0xff5b('0x25')]=_[_0xff5b('0x26')](_0x85271[_0xff5b('0x20')],_0x85271[_0xff5b('0x22')]);_0x176d5f['attributes']=_['intersection'](_0x85271['model'],qs[_0xff5b('0x27')](_0x4c4709[_0xff5b('0x22')]['fields']));_0x176d5f[_0xff5b('0x28')]=_0x176d5f[_0xff5b('0x28')][_0xff5b('0x29')]?_0x176d5f['attributes']:_0x85271[_0xff5b('0x20')];_0x176d5f[_0xff5b('0x2c')]=qs[_0xff5b('0x2d')](_0x4c4709['query'][_0xff5b('0x2d')]);_0x176d5f[_0xff5b('0x2e')]=qs[_0xff5b('0x25')](_['pick'](_0x4c4709[_0xff5b('0x22')],_0x85271['filters']));if(_0x4c4709[_0xff5b('0x22')][_0xff5b('0x33')]){_0x176d5f[_0xff5b('0x2e')]=_[_0xff5b('0x32')](_0x176d5f['where'],{'$or':_[_0xff5b('0x34')](_0x176d5f[_0xff5b('0x28')],function(_0x1362cc){var _0x2c4fc9={};_0x2c4fc9[_0x1362cc]={'$like':'%'+_0x4c4709[_0xff5b('0x22')]['filter']+'%'};return _0x2c4fc9;})});}_0x176d5f=_[_0xff5b('0x32')]({},_0x176d5f,_0x4c4709[_0xff5b('0x39')]);return _0xda0033[_0xff5b('0x44')](_0x176d5f);}})[_0xff5b('0x18')](function(_0x5e44ec){if(_0x5e44ec){_0x156342=_0x5e44ec[_0xff5b('0x29')];if(!_0x4c4709[_0xff5b('0x22')][_0xff5b('0x2a')]('nolimit')){_0x176d5f['limit']=qs[_0xff5b('0x14')](_0x4c4709[_0xff5b('0x22')][_0xff5b('0x14')]);_0x176d5f['offset']=qs[_0xff5b('0x13')](_0x4c4709[_0xff5b('0x22')][_0xff5b('0x13')]);}return _0xda0033[_0xff5b('0x44')](_0x176d5f);}})[_0xff5b('0x18')](function(_0xcf5cd3){if(_0xcf5cd3){return _0xcf5cd3?{'count':_0x156342,'rows':_0xcf5cd3}:null;}})['then'](respondWithResult(_0x5807fc,null))[_0xff5b('0x36')](handleError(_0x5807fc,null));}; \ No newline at end of file +var _0x7c28=['api','../../config/utils','../../mysqldb','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','Automation','model','keys','query','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','dateStart','add','day','filter','merge','map','options','includeAll','include','findAll','rows','catch','find','create','body','params','addConditions','ids','getConditions','findOne','Condition','rawAttributes','nolimit','addActions','Action','getActions','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger'];(function(_0x4465d2,_0x27b96e){var _0x4e13a2=function(_0x2661f8){while(--_0x2661f8){_0x4465d2['push'](_0x4465d2['shift']());}};_0x4e13a2(++_0x27b96e);}(_0x7c28,0x8d));var _0x87c2=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x7c28[_0x1d1779];return _0x2377e9;};'use strict';var jsonpatch=require(_0x87c2('0x0'));var rp=require(_0x87c2('0x1'));var moment=require(_0x87c2('0x2'));var BPromise=require(_0x87c2('0x3'));var Mustache=require(_0x87c2('0x4'));var util=require(_0x87c2('0x5'));var path=require(_0x87c2('0x6'));var sox=require('sox');var csv=require(_0x87c2('0x7'));var ejs=require(_0x87c2('0x8'));var fs=require('fs');var _=require(_0x87c2('0x9'));var squel=require(_0x87c2('0xa'));var crypto=require(_0x87c2('0xb'));var jsforce=require(_0x87c2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x87c2('0x7'));var querystring=require(_0x87c2('0xd'));var Papa=require(_0x87c2('0xe'));var qs=require(_0x87c2('0xf'));var logger=require(_0x87c2('0x10'))(_0x87c2('0x11'));var utils=require(_0x87c2('0x12'));var config=require('../../config/environment');var db=require(_0x87c2('0x13'))['db'];function respondWithStatusCode(_0xb3c557,_0x1725b9){_0x1725b9=_0x1725b9||0xcc;return function(_0x5ad547){if(_0x5ad547){return _0xb3c557['sendStatus'](_0x1725b9);}return _0xb3c557[_0x87c2('0x14')](_0x1725b9)[_0x87c2('0x15')]();};}function respondWithResult(_0x454dc4,_0x5f5db3){_0x5f5db3=_0x5f5db3||0xc8;return function(_0x3c27a7){if(_0x3c27a7){return _0x454dc4['status'](_0x5f5db3)['json'](_0x3c27a7);}};}function respondWithFilteredResult(_0x551174,_0x53a7d1){return function(_0x2b5e93){if(_0x2b5e93){var _0x1dc512=_0x2b5e93[_0x87c2('0x16')],_0x295849=_0x53a7d1[_0x87c2('0x17')],_0x3965a0=_0x53a7d1[_0x87c2('0x17')]+_0x53a7d1[_0x87c2('0x18')],_0x1f985c;if(_0x3965a0>=_0x1dc512){_0x3965a0=_0x1dc512;_0x1f985c=0xc8;}else{_0x1f985c=0xce;}_0x551174[_0x87c2('0x14')](_0x1f985c);return _0x551174[_0x87c2('0x19')](_0x87c2('0x1a'),_0x295849+'-'+_0x3965a0+'/'+_0x1dc512)['json'](_0x2b5e93);}return null;};}function patchUpdates(_0xcc40f){return function(_0x219915){try{jsonpatch[_0x87c2('0x1b')](_0x219915,_0xcc40f,!![]);}catch(_0x430705){return BPromise[_0x87c2('0x1c')](_0x430705);}return _0x219915[_0x87c2('0x1d')]();};}function saveUpdates(_0x47c23b,_0xdd3008){return function(_0x192737){if(_0x192737){return _0x192737[_0x87c2('0x1e')](_0x47c23b)[_0x87c2('0x1f')](function(_0x2cdbed){return _0x2cdbed;});}return null;};}function removeEntity(_0x2d70bb,_0x30b802){return function(_0xb8cd8e){if(_0xb8cd8e){return _0xb8cd8e[_0x87c2('0x20')]()[_0x87c2('0x1f')](function(){_0x2d70bb[_0x87c2('0x14')](0xcc)[_0x87c2('0x15')]();});}};}function handleEntityNotFound(_0x55982a,_0x513b51){return function(_0x5172f9){if(!_0x5172f9){_0x55982a[_0x87c2('0x21')](0x194);}return _0x5172f9;};}function handleError(_0x199745,_0x18c29a){_0x18c29a=_0x18c29a||0x1f4;return function(_0x260db8){logger[_0x87c2('0x22')](_0x260db8['stack']);if(_0x260db8[_0x87c2('0x23')]){delete _0x260db8[_0x87c2('0x23')];}_0x199745[_0x87c2('0x14')](_0x18c29a)[_0x87c2('0x24')](_0x260db8);};}exports[_0x87c2('0x25')]=function(_0x16decb,_0x58bccf){var _0x432cd7={},_0x25f576={},_0x32b399={'count':0x0,'rows':[]};var _0x539461=db[_0x87c2('0x26')]['rawAttributes'];_0x25f576[_0x87c2('0x27')]=_[_0x87c2('0x28')](_0x539461);var _0x399842={'dateStart':_0x16decb[_0x87c2('0x29')]['dateStart'],'dateEnd':_0x16decb[_0x87c2('0x29')][_0x87c2('0x2a')]};delete _0x16decb[_0x87c2('0x29')]['dateStart'];delete _0x16decb[_0x87c2('0x29')][_0x87c2('0x2a')];_0x25f576['query']=_[_0x87c2('0x28')](_0x16decb['query']);_0x25f576[_0x87c2('0x2b')]=_[_0x87c2('0x2c')](_0x25f576['model'],_0x25f576['query']);_0x432cd7['attributes']=_['intersection'](_0x25f576[_0x87c2('0x27')],qs[_0x87c2('0x2d')](_0x16decb[_0x87c2('0x29')][_0x87c2('0x2d')]));_0x432cd7[_0x87c2('0x2e')]=_0x432cd7[_0x87c2('0x2e')][_0x87c2('0x2f')]?_0x432cd7[_0x87c2('0x2e')]:_0x25f576[_0x87c2('0x27')];if(!_0x16decb['query'][_0x87c2('0x30')]('nolimit')){_0x432cd7[_0x87c2('0x18')]=qs[_0x87c2('0x18')](_0x16decb[_0x87c2('0x29')][_0x87c2('0x18')]);_0x432cd7[_0x87c2('0x17')]=qs[_0x87c2('0x17')](_0x16decb['query'][_0x87c2('0x17')]);}_0x432cd7[_0x87c2('0x31')]=qs[_0x87c2('0x32')](_0x16decb['query'][_0x87c2('0x32')]);_0x432cd7[_0x87c2('0x33')]=qs[_0x87c2('0x2b')](_[_0x87c2('0x34')](_0x16decb['query'],_0x25f576[_0x87c2('0x2b')]));if(_0x399842[_0x87c2('0x35')]){if(_0x399842['dateEnd']){_0x399842['dateEnd']=moment(_0x399842['dateEnd'])[_0x87c2('0x36')](0x1,_0x87c2('0x37'));}else{_0x399842[_0x87c2('0x2a')]=moment(_0x399842[_0x87c2('0x35')])[_0x87c2('0x36')](0x1,_0x87c2('0x37'));}_['merge'](_0x432cd7[_0x87c2('0x33')],{'createdAt':{'$gte':_0x399842[_0x87c2('0x35')],'$lte':_0x399842[_0x87c2('0x2a')]}});}if(_0x16decb['query'][_0x87c2('0x38')]){_0x432cd7[_0x87c2('0x33')]=_[_0x87c2('0x39')](_0x432cd7[_0x87c2('0x33')],{'$or':_[_0x87c2('0x3a')](_0x432cd7['attributes'],function(_0x5adbd0){var _0x250c3b={};_0x250c3b[_0x5adbd0]={'$like':'%'+_0x16decb[_0x87c2('0x29')][_0x87c2('0x38')]+'%'};return _0x250c3b;})});}_0x432cd7=_[_0x87c2('0x39')]({},_0x432cd7,_0x16decb[_0x87c2('0x3b')]);var _0x2f35a3={'where':_0x432cd7[_0x87c2('0x33')]};return db[_0x87c2('0x26')][_0x87c2('0x16')](_0x2f35a3)['then'](function(_0x56f5ad){_0x32b399[_0x87c2('0x16')]=_0x56f5ad;if(_0x16decb[_0x87c2('0x29')][_0x87c2('0x3c')]){_0x432cd7[_0x87c2('0x3d')]=[{'all':!![]}];}return db['Automation'][_0x87c2('0x3e')](_0x432cd7);})[_0x87c2('0x1f')](function(_0x3a6906){_0x32b399[_0x87c2('0x3f')]=_0x3a6906;return _0x32b399;})[_0x87c2('0x1f')](respondWithFilteredResult(_0x58bccf,_0x432cd7))[_0x87c2('0x40')](handleError(_0x58bccf,null));};exports['show']=function(_0x2b2d8b,_0x4fbb2d){var _0x6a50a4={'raw':![],'where':{'id':_0x2b2d8b['params']['id']}},_0x535ba1={};_0x535ba1[_0x87c2('0x27')]=_['keys'](db[_0x87c2('0x26')]['rawAttributes']);_0x535ba1['query']=_[_0x87c2('0x28')](_0x2b2d8b['query']);_0x535ba1[_0x87c2('0x2b')]=_[_0x87c2('0x2c')](_0x535ba1[_0x87c2('0x27')],_0x535ba1[_0x87c2('0x29')]);_0x6a50a4['attributes']=_[_0x87c2('0x2c')](_0x535ba1[_0x87c2('0x27')],qs[_0x87c2('0x2d')](_0x2b2d8b[_0x87c2('0x29')][_0x87c2('0x2d')]));_0x6a50a4[_0x87c2('0x2e')]=_0x6a50a4[_0x87c2('0x2e')][_0x87c2('0x2f')]?_0x6a50a4[_0x87c2('0x2e')]:_0x535ba1['model'];if(_0x2b2d8b[_0x87c2('0x29')][_0x87c2('0x3c')]){_0x6a50a4[_0x87c2('0x3d')]=[{'all':!![]}];}_0x6a50a4=_[_0x87c2('0x39')]({},_0x6a50a4,_0x2b2d8b[_0x87c2('0x3b')]);return db[_0x87c2('0x26')][_0x87c2('0x41')](_0x6a50a4)['then'](handleEntityNotFound(_0x4fbb2d,null))['then'](respondWithResult(_0x4fbb2d,null))[_0x87c2('0x40')](handleError(_0x4fbb2d,null));};exports[_0x87c2('0x42')]=function(_0x481767,_0x217fc3){return db[_0x87c2('0x26')]['create'](_0x481767[_0x87c2('0x43')],{})[_0x87c2('0x1f')](respondWithResult(_0x217fc3,0xc9))[_0x87c2('0x40')](handleError(_0x217fc3,null));};exports[_0x87c2('0x1e')]=function(_0x47cca8,_0x54ba7b){if(_0x47cca8[_0x87c2('0x43')]['id']){delete _0x47cca8['body']['id'];}return db[_0x87c2('0x26')]['find']({'where':{'id':_0x47cca8[_0x87c2('0x44')]['id']}})[_0x87c2('0x1f')](handleEntityNotFound(_0x54ba7b,null))[_0x87c2('0x1f')](saveUpdates(_0x47cca8[_0x87c2('0x43')],null))[_0x87c2('0x1f')](respondWithResult(_0x54ba7b,null))['catch'](handleError(_0x54ba7b,null));};exports[_0x87c2('0x20')]=function(_0x38c820,_0x3cf9c2){return db[_0x87c2('0x26')][_0x87c2('0x41')]({'where':{'id':_0x38c820[_0x87c2('0x44')]['id']}})[_0x87c2('0x1f')](handleEntityNotFound(_0x3cf9c2,null))[_0x87c2('0x1f')](removeEntity(_0x3cf9c2,null))[_0x87c2('0x40')](handleError(_0x3cf9c2,null));};exports[_0x87c2('0x45')]=function(_0x2ddeda,_0x5bb959,_0x56aa25){return db['Condition'][_0x87c2('0x41')]({'where':{'id':_0x2ddeda[_0x87c2('0x44')]['id']}})[_0x87c2('0x1f')](handleEntityNotFound(_0x5bb959,null))[_0x87c2('0x1f')](function(_0x50603e){if(_0x50603e){return _0x50603e[_0x87c2('0x45')](_0x2ddeda[_0x87c2('0x43')][_0x87c2('0x46')],_['omit'](_0x2ddeda['body'],['ids','id'])||{});}})[_0x87c2('0x1f')](respondWithResult(_0x5bb959,null))[_0x87c2('0x40')](handleError(_0x5bb959,null));};exports[_0x87c2('0x47')]=function(_0x36ee98,_0x5646e3,_0x3004e5){var _0x3117af={};var _0x45af1b={};var _0x1c2b8c;var _0x1c5b00;return db[_0x87c2('0x26')][_0x87c2('0x48')]({'where':{'id':_0x36ee98[_0x87c2('0x44')]['id']}})[_0x87c2('0x1f')](handleEntityNotFound(_0x5646e3,null))[_0x87c2('0x1f')](function(_0x5e9e40){if(_0x5e9e40){_0x1c2b8c=_0x5e9e40;_0x45af1b[_0x87c2('0x27')]=_[_0x87c2('0x28')](db[_0x87c2('0x49')][_0x87c2('0x4a')]);_0x45af1b[_0x87c2('0x29')]=_[_0x87c2('0x28')](_0x36ee98[_0x87c2('0x29')]);_0x45af1b[_0x87c2('0x2b')]=_[_0x87c2('0x2c')](_0x45af1b[_0x87c2('0x27')],_0x45af1b[_0x87c2('0x29')]);_0x3117af['attributes']=_[_0x87c2('0x2c')](_0x45af1b['model'],qs[_0x87c2('0x2d')](_0x36ee98['query'][_0x87c2('0x2d')]));_0x3117af['attributes']=_0x3117af[_0x87c2('0x2e')][_0x87c2('0x2f')]?_0x3117af[_0x87c2('0x2e')]:_0x45af1b[_0x87c2('0x27')];_0x3117af[_0x87c2('0x31')]=qs['sort'](_0x36ee98[_0x87c2('0x29')][_0x87c2('0x32')]);_0x3117af['where']=qs[_0x87c2('0x2b')](_[_0x87c2('0x34')](_0x36ee98[_0x87c2('0x29')],_0x45af1b[_0x87c2('0x2b')]));if(_0x36ee98['query'][_0x87c2('0x38')]){_0x3117af[_0x87c2('0x33')]=_[_0x87c2('0x39')](_0x3117af[_0x87c2('0x33')],{'$or':_[_0x87c2('0x3a')](_0x3117af[_0x87c2('0x2e')],function(_0xd6cca7){var _0x9e913e={};_0x9e913e[_0xd6cca7]={'$like':'%'+_0x36ee98[_0x87c2('0x29')][_0x87c2('0x38')]+'%'};return _0x9e913e;})});}_0x3117af=_[_0x87c2('0x39')]({},_0x3117af,_0x36ee98['options']);return _0x1c2b8c['getConditions'](_0x3117af);}})[_0x87c2('0x1f')](function(_0x316b0e){if(_0x316b0e){_0x1c5b00=_0x316b0e[_0x87c2('0x2f')];if(!_0x36ee98['query'][_0x87c2('0x30')](_0x87c2('0x4b'))){_0x3117af['limit']=qs['limit'](_0x36ee98[_0x87c2('0x29')][_0x87c2('0x18')]);_0x3117af[_0x87c2('0x17')]=qs[_0x87c2('0x17')](_0x36ee98['query'][_0x87c2('0x17')]);}return _0x1c2b8c[_0x87c2('0x47')](_0x3117af);}})[_0x87c2('0x1f')](function(_0x4224c4){if(_0x4224c4){return _0x4224c4?{'count':_0x1c5b00,'rows':_0x4224c4}:null;}})[_0x87c2('0x1f')](respondWithResult(_0x5646e3,null))[_0x87c2('0x40')](handleError(_0x5646e3,null));};exports[_0x87c2('0x4c')]=function(_0x42e1ed,_0x7e978a,_0x2d8e92){return db[_0x87c2('0x4d')][_0x87c2('0x41')]({'where':{'id':_0x42e1ed['params']['id']}})[_0x87c2('0x1f')](handleEntityNotFound(_0x7e978a,null))['then'](function(_0x611389){if(_0x611389){return _0x611389[_0x87c2('0x4c')](_0x42e1ed[_0x87c2('0x43')][_0x87c2('0x46')],_['omit'](_0x42e1ed[_0x87c2('0x43')],[_0x87c2('0x46'),'id'])||{});}})[_0x87c2('0x1f')](respondWithResult(_0x7e978a,null))[_0x87c2('0x40')](handleError(_0x7e978a,null));};exports[_0x87c2('0x4e')]=function(_0x11e4e6,_0x2d22d6,_0x3d2239){var _0x4b8c12={};var _0x1b61d3={};var _0xd2ce64;var _0x39c2da;return db[_0x87c2('0x26')]['findOne']({'where':{'id':_0x11e4e6[_0x87c2('0x44')]['id']}})[_0x87c2('0x1f')](handleEntityNotFound(_0x2d22d6,null))[_0x87c2('0x1f')](function(_0x3e2382){if(_0x3e2382){_0xd2ce64=_0x3e2382;_0x1b61d3[_0x87c2('0x27')]=_[_0x87c2('0x28')](db['Action'][_0x87c2('0x4a')]);_0x1b61d3[_0x87c2('0x29')]=_[_0x87c2('0x28')](_0x11e4e6[_0x87c2('0x29')]);_0x1b61d3['filters']=_[_0x87c2('0x2c')](_0x1b61d3[_0x87c2('0x27')],_0x1b61d3[_0x87c2('0x29')]);_0x4b8c12[_0x87c2('0x2e')]=_['intersection'](_0x1b61d3['model'],qs[_0x87c2('0x2d')](_0x11e4e6[_0x87c2('0x29')][_0x87c2('0x2d')]));_0x4b8c12[_0x87c2('0x2e')]=_0x4b8c12[_0x87c2('0x2e')]['length']?_0x4b8c12[_0x87c2('0x2e')]:_0x1b61d3[_0x87c2('0x27')];_0x4b8c12['order']=qs[_0x87c2('0x32')](_0x11e4e6[_0x87c2('0x29')]['sort']);_0x4b8c12['where']=qs[_0x87c2('0x2b')](_[_0x87c2('0x34')](_0x11e4e6['query'],_0x1b61d3[_0x87c2('0x2b')]));if(_0x11e4e6[_0x87c2('0x29')]['filter']){_0x4b8c12[_0x87c2('0x33')]=_['merge'](_0x4b8c12[_0x87c2('0x33')],{'$or':_['map'](_0x4b8c12[_0x87c2('0x2e')],function(_0x555d50){var _0x58ef5b={};_0x58ef5b[_0x555d50]={'$like':'%'+_0x11e4e6[_0x87c2('0x29')][_0x87c2('0x38')]+'%'};return _0x58ef5b;})});}_0x4b8c12=_[_0x87c2('0x39')]({},_0x4b8c12,_0x11e4e6[_0x87c2('0x3b')]);return _0xd2ce64[_0x87c2('0x4e')](_0x4b8c12);}})['then'](function(_0x59dbf0){if(_0x59dbf0){_0x39c2da=_0x59dbf0['length'];if(!_0x11e4e6['query'][_0x87c2('0x30')](_0x87c2('0x4b'))){_0x4b8c12['limit']=qs['limit'](_0x11e4e6[_0x87c2('0x29')][_0x87c2('0x18')]);_0x4b8c12[_0x87c2('0x17')]=qs['offset'](_0x11e4e6['query']['offset']);}return _0xd2ce64[_0x87c2('0x4e')](_0x4b8c12);}})[_0x87c2('0x1f')](function(_0x2bb419){if(_0x2bb419){return _0x2bb419?{'count':_0x39c2da,'rows':_0x2bb419}:null;}})[_0x87c2('0x1f')](respondWithResult(_0x2d22d6,null))[_0x87c2('0x40')](handleError(_0x2d22d6,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 87e505d..5c297d2 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 _0x1a0e=['request-promise','exports','Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1acd88,_0x3e3f54){var _0xf8e5ec=function(_0x343b42){while(--_0x343b42){_0x1acd88['push'](_0x1acd88['shift']());}};_0xf8e5ec(++_0x3e3f54);}(_0x1a0e,0x1c6));var _0xe1a0=function(_0x1391a8,_0x4e2f7f){_0x1391a8=_0x1391a8-0x0;var _0x1e3519=_0x1a0e[_0x1391a8];return _0x1e3519;};'use strict';var _=require(_0xe1a0('0x0'));var util=require(_0xe1a0('0x1'));var logger=require(_0xe1a0('0x2'))(_0xe1a0('0x3'));var moment=require(_0xe1a0('0x4'));var BPromise=require(_0xe1a0('0x5'));var rp=require(_0xe1a0('0x6'));var attributes=require('./automation.attributes');module[_0xe1a0('0x7')]=function(_0x5602cf,_0x47c1bc){return _0x5602cf['define'](_0xe1a0('0x8'),attributes,{'tableName':_0xe1a0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7624=['moment','bluebird','./automation.attributes','exports','define','Automation','lodash','util','../../config/logger','api'];(function(_0x4d457b,_0x53b576){var _0x1dcfa9=function(_0x627e4b){while(--_0x627e4b){_0x4d457b['push'](_0x4d457b['shift']());}};_0x1dcfa9(++_0x53b576);}(_0x7624,0x18c));var _0x4762=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7624[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x4762('0x0'));var util=require(_0x4762('0x1'));var logger=require(_0x4762('0x2'))(_0x4762('0x3'));var moment=require(_0x4762('0x4'));var BPromise=require(_0x4762('0x5'));var rp=require('request-promise');var attributes=require(_0x4762('0x6'));module[_0x4762('0x7')]=function(_0x542264,_0x3c95e5){return _0x542264[_0x4762('0x8')](_0x4762('0x9'),attributes,{'tableName':'tools_automations','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 e0ee29d..e790d3a 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 _0x5a8f=['error','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5a8f,0xdf));var _0xf5a8=function(_0x2bca07,_0x1a04b9){_0x2bca07=_0x2bca07-0x0;var _0x1ee9aa=_0x5a8f[_0x2bca07];return _0x1ee9aa;};'use strict';var _=require(_0xf5a8('0x0'));var util=require('util');var moment=require(_0xf5a8('0x1'));var BPromise=require('bluebird');var rs=require(_0xf5a8('0x2'));var fs=require('fs');var db=require(_0xf5a8('0x3'))['db'];var utils=require(_0xf5a8('0x4'));var logger=require(_0xf5a8('0x5'))('rpc');var config=require(_0xf5a8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf5a8('0x7')][_0xf5a8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x798c40,_0x5a32d3,_0x8c03f2){return new BPromise(function(_0x4add58,_0x3372a){return client[_0xf5a8('0x9')](_0x798c40,_0x8c03f2)[_0xf5a8('0xa')](function(_0x1db8aa){logger[_0xf5a8('0xb')](_0xf5a8('0xc'),_0x5a32d3,_0xf5a8('0xd'));logger[_0xf5a8('0xe')](_0xf5a8('0xf'),_0x5a32d3,_0xf5a8('0xd'),JSON[_0xf5a8('0x10')](_0x1db8aa));if(_0x1db8aa['error']){if(_0x1db8aa[_0xf5a8('0x11')]['code']===0x1f4){logger[_0xf5a8('0x11')](_0xf5a8('0xc'),_0x5a32d3,_0x1db8aa[_0xf5a8('0x11')]['message']);return _0x3372a(_0x1db8aa[_0xf5a8('0x11')][_0xf5a8('0x12')]);}logger[_0xf5a8('0x11')](_0xf5a8('0xc'),_0x5a32d3,_0x1db8aa[_0xf5a8('0x11')][_0xf5a8('0x12')]);return _0x4add58(_0x1db8aa[_0xf5a8('0x11')]['message']);}else{logger[_0xf5a8('0xb')](_0xf5a8('0xc'),_0x5a32d3,_0xf5a8('0xd'));_0x4add58(_0x1db8aa['result'][_0xf5a8('0x12')]);}})[_0xf5a8('0x13')](function(_0x471570){logger['error'](_0xf5a8('0xc'),_0x5a32d3,_0x471570);_0x3372a(_0x471570);});});} \ No newline at end of file +var _0x70a6=['jayson/promise','client','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1b1bc7,_0x135c05){var _0x2897a6=function(_0x43ba8e){while(--_0x43ba8e){_0x1b1bc7['push'](_0x1b1bc7['shift']());}};_0x2897a6(++_0x135c05);}(_0x70a6,0x91));var _0x670a=function(_0x3f2353,_0x29ccf1){_0x3f2353=_0x3f2353-0x0;var _0xdf4fdf=_0x70a6[_0x3f2353];return _0xdf4fdf;};'use strict';var _=require('lodash');var util=require(_0x670a('0x0'));var moment=require(_0x670a('0x1'));var BPromise=require(_0x670a('0x2'));var rs=require(_0x670a('0x3'));var fs=require('fs');var db=require(_0x670a('0x4'))['db'];var utils=require(_0x670a('0x5'));var logger=require(_0x670a('0x6'))(_0x670a('0x7'));var config=require(_0x670a('0x8'));var jayson=require(_0x670a('0x9'));var client=jayson[_0x670a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x579bf6,_0x1a51c7,_0x3688ba){return new BPromise(function(_0x329e94,_0x281b00){return client['request'](_0x579bf6,_0x3688ba)[_0x670a('0xb')](function(_0x5c81a7){logger[_0x670a('0xc')](_0x670a('0xd'),_0x1a51c7,_0x670a('0xe'));logger[_0x670a('0xf')](_0x670a('0x10'),_0x1a51c7,'request\x20sent',JSON[_0x670a('0x11')](_0x5c81a7));if(_0x5c81a7[_0x670a('0x12')]){if(_0x5c81a7[_0x670a('0x12')][_0x670a('0x13')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x1a51c7,_0x5c81a7['error'][_0x670a('0x14')]);return _0x281b00(_0x5c81a7[_0x670a('0x12')][_0x670a('0x14')]);}logger[_0x670a('0x12')](_0x670a('0xd'),_0x1a51c7,_0x5c81a7[_0x670a('0x12')][_0x670a('0x14')]);return _0x329e94(_0x5c81a7[_0x670a('0x12')][_0x670a('0x14')]);}else{logger[_0x670a('0xc')]('Automation,\x20%s,\x20%s',_0x1a51c7,_0x670a('0xe'));_0x329e94(_0x5c81a7['result'][_0x670a('0x14')]);}})[_0x670a('0x15')](function(_0x120ef9){logger['error'](_0x670a('0xd'),_0x1a51c7,_0x120ef9);_0x281b00(_0x120ef9);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 862eb53..f46e6dd 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(_0x33025b,_0x2f778f){var _0x30f787=function(_0x1abcdf){while(--_0x1abcdf){_0x33025b['push'](_0x33025b['shift']());}};_0x30f787(++_0x2f778f);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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(_0x2ded28,_0x2cb382){var _0x423373=function(_0x348de3){while(--_0x348de3){_0x2ded28['push'](_0x2ded28['shift']());}};_0x423373(++_0x2cb382);}(_0x7a54,0x106));var _0x47a5=function(_0x492858,_0x408745){_0x492858=_0x492858-0x0;var _0x40485a=_0x7a54[_0x492858];return _0x40485a;};'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 4b1b93a..7b9161e 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 _0xf0aa=['#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#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)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','never','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence'];(function(_0x4a8e69,_0x593023){var _0x55d440=function(_0x587986){while(--_0x587986){_0x4a8e69['push'](_0x4a8e69['shift']());}};_0x55d440(++_0x593023);}(_0xf0aa,0x100));var _0xaf0a=function(_0x46c3ec,_0x313165){_0x46c3ec=_0x46c3ec-0x0;var _0x516cf7=_0xf0aa[_0x46c3ec];return _0x516cf7;};'use strict';var Sequelize=require(_0xaf0a('0x0'));module[_0xaf0a('0x1')]={'name':{'type':Sequelize[_0xaf0a('0x2')],'unique':_0xaf0a('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xaf0a('0x4')]('ivr'),'allowNull':![],'defaultValue':_0xaf0a('0x5')},'description':{'type':Sequelize[_0xaf0a('0x2')]},'active':{'type':Sequelize[_0xaf0a('0x6')],'defaultValue':0x0,'comment':_0xaf0a('0x7')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xaf0a('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xaf0a('0x9')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xaf0a('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xaf0a('0xa')](0x3)[_0xaf0a('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf0a('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0xaf0a('0xa')](0x3)[_0xaf0a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf0a('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xaf0a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf0a('0xd')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xaf0a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xaf0a('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf0a('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xaf0a('0xa')](0x3)[_0xaf0a('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xaf0a('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf0a('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0xaf0a('0xa')](0x3)[_0xaf0a('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xaf0a('0x2')],'defaultValue':_0xaf0a('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xaf0a('0x4')]('always',_0xaf0a('0x11'),'onlyIfOpen'),'defaultValue':_0xaf0a('0x12')},'dialAMDActive':{'type':Sequelize[_0xaf0a('0x6')],'defaultValue':0x0,'comment':_0xaf0a('0x13')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xaf0a('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xaf0a('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xaf0a('0xa')](0x9)[_0xaf0a('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xaf0a('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xaf0a('0xa')](0x9)[_0xaf0a('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xaf0a('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xaf0a('0xa')](0x9)[_0xaf0a('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xaf0a('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xaf0a('0xa')](0x9)[_0xaf0a('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xaf0a('0xa')](0x9)[_0xaf0a('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xaf0a('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xaf0a('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xaf0a('0xa')](0x5)[_0xaf0a('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xaf0a('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xaf0a('0xa')](0x9)[_0xaf0a('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xaf0a('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xaf0a('0x4')](_0xaf0a('0x1b'),_0xaf0a('0x1c')),'defaultValue':_0xaf0a('0x1b')},'dialPrefix':{'type':Sequelize[_0xaf0a('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xaf0a('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xaf0a('0x1d')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xaf0a('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xaf0a('0x1e')}}; \ No newline at end of file +var _0xed59=['#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','sequelize','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence'];(function(_0xa93d50,_0x226539){var _0x5b6e6a=function(_0x52ce37){while(--_0x52ce37){_0xa93d50['push'](_0xa93d50['shift']());}};_0x5b6e6a(++_0x226539);}(_0xed59,0x1c7));var _0x9ed5=function(_0x4b957a,_0x2392b1){_0x4b957a=_0x4b957a-0x0;var _0x19f75f=_0xed59[_0x4b957a];return _0x19f75f;};'use strict';var Sequelize=require(_0x9ed5('0x0'));module['exports']={'name':{'type':Sequelize[_0x9ed5('0x1')],'unique':_0x9ed5('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x9ed5('0x3')](_0x9ed5('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x9ed5('0x1')]},'active':{'type':Sequelize[_0x9ed5('0x5')],'defaultValue':0x0,'comment':_0x9ed5('0x6')},'limitCalls':{'type':Sequelize[_0x9ed5('0x7')](0x4)[_0x9ed5('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x9ed5('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x9ed5('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9ed5('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x9ed5('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9ed5('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x9ed5('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9ed5('0x7')](0x5)[_0x9ed5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9ed5('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x9ed5('0x7')](0x3)[_0x9ed5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9ed5('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x9ed5('0x7')](0x5)[_0x9ed5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9ed5('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9ed5('0x7')](0x3)[_0x9ed5('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9ed5('0x7')](0x5)[_0x9ed5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9ed5('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9ed5('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9ed5('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9ed5('0x1')],'defaultValue':_0x9ed5('0x10')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x9ed5('0x11'),_0x9ed5('0x12'),_0x9ed5('0x13')),'defaultValue':_0x9ed5('0x11')},'dialAMDActive':{'type':Sequelize[_0x9ed5('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x9ed5('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x9ed5('0x7')](0x9)[_0x9ed5('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9ed5('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9ed5('0x7')](0x9)[_0x9ed5('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9ed5('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9ed5('0x7')](0x9)[_0x9ed5('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9ed5('0x16')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9ed5('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9ed5('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9ed5('0x7')](0x9)[_0x9ed5('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9ed5('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9ed5('0x7')](0x9)[_0x9ed5('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x9ed5('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9ed5('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9ed5('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9ed5('0x3')](_0x9ed5('0x1a'),_0x9ed5('0x1b')),'defaultValue':_0x9ed5('0x1a')},'dialPrefix':{'type':Sequelize[_0x9ed5('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9ed5('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9ed5('0x1c')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x9ed5('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9ed5('0x1d')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 4fa6dfb..60b27e4 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 _0x3012=['get','createdAt','updatedAt','omit','getHoppers','findOne','CmHopper','hasOwnProperty','CampaignId','options','getHopperHistories','CmHopperHistory','findAll','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','into','cm_contacts','phone\x20IS\x20NOT\x20NULL','insert','push','sequelize','all','removeLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','length','nolimit','limit','order','sort','where','pick','add','merge','filter','map','Campaign','includeAll','rows','catch','params','fields','find','create','body','clone','include'];(function(_0xabd82e,_0x395385){var _0x13927d=function(_0x14eb0e){while(--_0x14eb0e){_0xabd82e['push'](_0xabd82e['shift']());}};_0x13927d(++_0x395385);}(_0x3012,0x19b));var _0x2301=function(_0x480c13,_0xe67fac){_0x480c13=_0x480c13-0x0;var _0x53ee47=_0x3012[_0x480c13];return _0x53ee47;};'use strict';var jsonpatch=require(_0x2301('0x0'));var rp=require(_0x2301('0x1'));var moment=require(_0x2301('0x2'));var BPromise=require(_0x2301('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2301('0x4'));var sox=require(_0x2301('0x5'));var csv=require(_0x2301('0x6'));var ejs=require(_0x2301('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2301('0x8'));var jsforce=require(_0x2301('0x9'));var deskjs=require(_0x2301('0xa'));var toCsv=require('to-csv');var querystring=require(_0x2301('0xb'));var Papa=require(_0x2301('0xc'));var qs=require(_0x2301('0xd'));var logger=require('../../config/logger')('api');var utils=require(_0x2301('0xe'));var config=require(_0x2301('0xf'));var db=require(_0x2301('0x10'))['db'];function respondWithStatusCode(_0x1311fa,_0x4077d6){_0x4077d6=_0x4077d6||0xcc;return function(_0x53fe2d){if(_0x53fe2d){return _0x1311fa[_0x2301('0x11')](_0x4077d6);}return _0x1311fa[_0x2301('0x12')](_0x4077d6)[_0x2301('0x13')]();};}function respondWithResult(_0xa759a4,_0x1cca44){_0x1cca44=_0x1cca44||0xc8;return function(_0x2e0ce9){if(_0x2e0ce9){return _0xa759a4[_0x2301('0x12')](_0x1cca44)[_0x2301('0x14')](_0x2e0ce9);}};}function respondWithFilteredResult(_0x20c92f,_0x33c4e7){return function(_0x1cc69a){if(_0x1cc69a){var _0x4966bf=_0x1cc69a[_0x2301('0x15')],_0x31de17=_0x33c4e7['offset'],_0x210c70=_0x33c4e7[_0x2301('0x16')]+_0x33c4e7['limit'],_0x1bc65d;if(_0x210c70>=_0x4966bf){_0x210c70=_0x4966bf;_0x1bc65d=0xc8;}else{_0x1bc65d=0xce;}_0x20c92f[_0x2301('0x12')](_0x1bc65d);return _0x20c92f[_0x2301('0x17')](_0x2301('0x18'),_0x31de17+'-'+_0x210c70+'/'+_0x4966bf)[_0x2301('0x14')](_0x1cc69a);}return null;};}function patchUpdates(_0x42cf6a){return function(_0x49c748){try{jsonpatch['apply'](_0x49c748,_0x42cf6a,!![]);}catch(_0x2d0f2a){return BPromise[_0x2301('0x19')](_0x2d0f2a);}return _0x49c748[_0x2301('0x1a')]();};}function saveUpdates(_0x52aa75,_0x33e9e5){return function(_0x2a3c29){if(_0x2a3c29){return _0x2a3c29[_0x2301('0x1b')](_0x52aa75)[_0x2301('0x1c')](function(_0x54785a){return _0x54785a;});}return null;};}function removeEntity(_0x59c543,_0x1faee0){return function(_0x4a869b){if(_0x4a869b){return _0x4a869b[_0x2301('0x1d')]()[_0x2301('0x1c')](function(){_0x59c543['status'](0xcc)[_0x2301('0x13')]();});}};}function handleEntityNotFound(_0x60df5f,_0x56efb3){return function(_0x2e1034){if(!_0x2e1034){_0x60df5f['sendStatus'](0x194);}return _0x2e1034;};}function handleError(_0x256d13,_0x410f4a){_0x410f4a=_0x410f4a||0x1f4;return function(_0x3559f4){logger[_0x2301('0x1e')](_0x3559f4[_0x2301('0x1f')]);if(_0x3559f4[_0x2301('0x20')]){delete _0x3559f4[_0x2301('0x20')];}_0x256d13['status'](_0x410f4a)[_0x2301('0x21')](_0x3559f4);};}exports['index']=function(_0x2bbf5d,_0xe65ba4){var _0x18d9c8={},_0x5a76f9={},_0xbe675a={'count':0x0,'rows':[]};var _0x51d1ab=db['Campaign'][_0x2301('0x22')];_0x5a76f9[_0x2301('0x23')]=_[_0x2301('0x24')](_0x51d1ab);var _0x5e3b29={'dateStart':_0x2bbf5d[_0x2301('0x25')][_0x2301('0x26')],'dateEnd':_0x2bbf5d[_0x2301('0x25')][_0x2301('0x27')]};delete _0x2bbf5d[_0x2301('0x25')][_0x2301('0x26')];delete _0x2bbf5d[_0x2301('0x25')]['dateEnd'];_0x5a76f9[_0x2301('0x25')]=_[_0x2301('0x24')](_0x2bbf5d[_0x2301('0x25')]);_0x5a76f9[_0x2301('0x28')]=_[_0x2301('0x29')](_0x5a76f9[_0x2301('0x23')],_0x5a76f9[_0x2301('0x25')]);_0x18d9c8['attributes']=_[_0x2301('0x29')](_0x5a76f9[_0x2301('0x23')],qs['fields'](_0x2bbf5d[_0x2301('0x25')]['fields']));_0x18d9c8[_0x2301('0x2a')]=_0x18d9c8[_0x2301('0x2a')][_0x2301('0x2b')]?_0x18d9c8['attributes']:_0x5a76f9[_0x2301('0x23')];if(!_0x2bbf5d[_0x2301('0x25')]['hasOwnProperty'](_0x2301('0x2c'))){_0x18d9c8[_0x2301('0x2d')]=qs[_0x2301('0x2d')](_0x2bbf5d['query']['limit']);_0x18d9c8[_0x2301('0x16')]=qs['offset'](_0x2bbf5d[_0x2301('0x25')][_0x2301('0x16')]);}_0x18d9c8[_0x2301('0x2e')]=qs[_0x2301('0x2f')](_0x2bbf5d[_0x2301('0x25')][_0x2301('0x2f')]);_0x18d9c8[_0x2301('0x30')]=qs['filters'](_[_0x2301('0x31')](_0x2bbf5d['query'],_0x5a76f9[_0x2301('0x28')]));if(_0x5e3b29['dateStart']){if(_0x5e3b29[_0x2301('0x27')]){_0x5e3b29['dateEnd']=moment(_0x5e3b29[_0x2301('0x27')])[_0x2301('0x32')](0x1,'day');}else{_0x5e3b29[_0x2301('0x27')]=moment(_0x5e3b29[_0x2301('0x26')])[_0x2301('0x32')](0x1,'day');}_[_0x2301('0x33')](_0x18d9c8[_0x2301('0x30')],{'createdAt':{'$gte':_0x5e3b29[_0x2301('0x26')],'$lte':_0x5e3b29[_0x2301('0x27')]}});}if(_0x2bbf5d[_0x2301('0x25')][_0x2301('0x34')]){_0x18d9c8[_0x2301('0x30')]=_[_0x2301('0x33')](_0x18d9c8['where'],{'$or':_[_0x2301('0x35')](_0x18d9c8[_0x2301('0x2a')],function(_0x2ec348){var _0xe967f7={};_0xe967f7[_0x2ec348]={'$like':'%'+_0x2bbf5d['query'][_0x2301('0x34')]+'%'};return _0xe967f7;})});}_0x18d9c8=_['merge']({},_0x18d9c8,_0x2bbf5d['options']);var _0x30815d={'where':_0x18d9c8[_0x2301('0x30')]};return db[_0x2301('0x36')]['count'](_0x30815d)['then'](function(_0x52a133){_0xbe675a[_0x2301('0x15')]=_0x52a133;if(_0x2bbf5d[_0x2301('0x25')][_0x2301('0x37')]){_0x18d9c8['include']=[{'all':!![]}];}return db[_0x2301('0x36')]['findAll'](_0x18d9c8);})['then'](function(_0x3858d7){_0xbe675a[_0x2301('0x38')]=_0x3858d7;return _0xbe675a;})['then'](respondWithFilteredResult(_0xe65ba4,_0x18d9c8))[_0x2301('0x39')](handleError(_0xe65ba4,null));};exports['show']=function(_0x40dc93,_0x42a7fd){var _0x5d8ede={'raw':![],'where':{'id':_0x40dc93[_0x2301('0x3a')]['id']}},_0x32826e={};_0x32826e[_0x2301('0x23')]=_[_0x2301('0x24')](db[_0x2301('0x36')][_0x2301('0x22')]);_0x32826e[_0x2301('0x25')]=_[_0x2301('0x24')](_0x40dc93['query']);_0x32826e[_0x2301('0x28')]=_[_0x2301('0x29')](_0x32826e['model'],_0x32826e['query']);_0x5d8ede[_0x2301('0x2a')]=_['intersection'](_0x32826e[_0x2301('0x23')],qs[_0x2301('0x3b')](_0x40dc93['query'][_0x2301('0x3b')]));_0x5d8ede[_0x2301('0x2a')]=_0x5d8ede[_0x2301('0x2a')][_0x2301('0x2b')]?_0x5d8ede[_0x2301('0x2a')]:_0x32826e['model'];if(_0x40dc93[_0x2301('0x25')][_0x2301('0x37')]){_0x5d8ede['include']=[{'all':!![]}];}_0x5d8ede=_['merge']({},_0x5d8ede,_0x40dc93['options']);return db[_0x2301('0x36')][_0x2301('0x3c')](_0x5d8ede)[_0x2301('0x1c')](handleEntityNotFound(_0x42a7fd,null))[_0x2301('0x1c')](respondWithResult(_0x42a7fd,null))[_0x2301('0x39')](handleError(_0x42a7fd,null));};exports[_0x2301('0x3d')]=function(_0x34b099,_0x33ff17){return db[_0x2301('0x36')]['create'](_0x34b099[_0x2301('0x3e')],{})[_0x2301('0x1c')](respondWithResult(_0x33ff17,0xc9))[_0x2301('0x39')](handleError(_0x33ff17,null));};exports[_0x2301('0x3f')]=function(_0x42d599,_0x551472){var _0x1b32c0={'raw':![],'where':{'id':_0x42d599['params']['id']}},_0x3209c6={};_0x3209c6[_0x2301('0x23')]=_['keys'](db[_0x2301('0x36')][_0x2301('0x22')]);_0x1b32c0[_0x2301('0x2a')]=_[_0x2301('0x29')](_0x3209c6['model'],qs['fields'](_0x42d599[_0x2301('0x25')][_0x2301('0x3b')]));_0x1b32c0['attributes']=_0x1b32c0[_0x2301('0x2a')][_0x2301('0x2b')]?_0x1b32c0[_0x2301('0x2a')]:_0x3209c6[_0x2301('0x23')];if(_0x42d599[_0x2301('0x25')][_0x2301('0x37')]){_0x1b32c0[_0x2301('0x40')]=[{'all':!![]}];}_0x1b32c0=_[_0x2301('0x33')]({},_0x1b32c0,_0x42d599['options']);return db[_0x2301('0x36')][_0x2301('0x3c')](_0x1b32c0)['then'](handleEntityNotFound(_0x551472,null))['then'](function(_0x35b602){if(_0x35b602){var _0x3ef93d=_0x35b602[_0x2301('0x41')]({'plain':!![]});_0x3ef93d=qs['omit'](_0x3ef93d,['id',_0x2301('0x42'),_0x2301('0x43')]);_0x42d599[_0x2301('0x3e')]=_[_0x2301('0x44')](_0x42d599[_0x2301('0x3e')],['id',_0x2301('0x42'),_0x2301('0x43')]);return db[_0x2301('0x36')][_0x2301('0x3d')](_['merge'](_0x3ef93d,_0x42d599[_0x2301('0x3e')]),{'include':_0x42d599[_0x2301('0x25')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x2301('0x1c')](respondWithResult(_0x551472,0xc9))[_0x2301('0x39')](handleError(_0x551472,null));};exports[_0x2301('0x1b')]=function(_0x4efaf7,_0x1cdb8f){if(_0x4efaf7['body']['id']){delete _0x4efaf7[_0x2301('0x3e')]['id'];}return db['Campaign'][_0x2301('0x3c')]({'where':{'id':_0x4efaf7[_0x2301('0x3a')]['id']}})['then'](handleEntityNotFound(_0x1cdb8f,null))['then'](saveUpdates(_0x4efaf7[_0x2301('0x3e')],null))[_0x2301('0x1c')](respondWithResult(_0x1cdb8f,null))[_0x2301('0x39')](handleError(_0x1cdb8f,null));};exports[_0x2301('0x1d')]=function(_0x2672b0,_0x3ba67c){return db[_0x2301('0x36')][_0x2301('0x3c')]({'where':{'id':_0x2672b0[_0x2301('0x3a')]['id']}})[_0x2301('0x1c')](handleEntityNotFound(_0x3ba67c,null))[_0x2301('0x1c')](removeEntity(_0x3ba67c,null))[_0x2301('0x39')](handleError(_0x3ba67c,null));};exports[_0x2301('0x45')]=function(_0x46d16e,_0x56fb63,_0x28a234){var _0x52a2f1={'raw':!![],'where':{}};var _0x221a60={};var _0x473db6={'count':0x0,'rows':[]};return db[_0x2301('0x36')][_0x2301('0x46')]({'where':{'id':_0x46d16e[_0x2301('0x3a')]['id']}})[_0x2301('0x1c')](handleEntityNotFound(_0x56fb63,null))[_0x2301('0x1c')](function(_0x45b710){if(_0x45b710){_0x221a60[_0x2301('0x23')]=_[_0x2301('0x24')](db[_0x2301('0x47')][_0x2301('0x22')]);_0x221a60[_0x2301('0x25')]=_[_0x2301('0x24')](_0x46d16e[_0x2301('0x25')]);_0x221a60['filters']=_[_0x2301('0x29')](_0x221a60[_0x2301('0x23')],_0x221a60[_0x2301('0x25')]);_0x52a2f1['attributes']=_['intersection'](_0x221a60['model'],qs[_0x2301('0x3b')](_0x46d16e['query'][_0x2301('0x3b')]));_0x52a2f1['attributes']=_0x52a2f1[_0x2301('0x2a')][_0x2301('0x2b')]?_0x52a2f1[_0x2301('0x2a')]:_0x221a60[_0x2301('0x23')];if(!_0x46d16e[_0x2301('0x25')][_0x2301('0x48')]('nolimit')){_0x52a2f1['limit']=qs[_0x2301('0x2d')](_0x46d16e['query'][_0x2301('0x2d')]);_0x52a2f1[_0x2301('0x16')]=qs[_0x2301('0x16')](_0x46d16e[_0x2301('0x25')]['offset']);}_0x52a2f1[_0x2301('0x2e')]=qs['sort'](_0x46d16e[_0x2301('0x25')][_0x2301('0x2f')]);_0x52a2f1[_0x2301('0x30')]=qs[_0x2301('0x28')](_[_0x2301('0x31')](_0x46d16e[_0x2301('0x25')],_0x221a60[_0x2301('0x28')]));_0x52a2f1[_0x2301('0x30')][_0x2301('0x49')]=_0x45b710['id'];if(_0x46d16e[_0x2301('0x25')][_0x2301('0x34')]){_0x52a2f1[_0x2301('0x30')]=_[_0x2301('0x33')](_0x52a2f1[_0x2301('0x30')],{'$or':_[_0x2301('0x35')](_0x52a2f1['attributes'],function(_0x11d3ca){var _0x2fd6a1={};_0x2fd6a1[_0x11d3ca]={'$like':'%'+_0x46d16e[_0x2301('0x25')][_0x2301('0x34')]+'%'};return _0x2fd6a1;})});}_0x52a2f1=_[_0x2301('0x33')]({},_0x52a2f1,_0x46d16e[_0x2301('0x4a')]);return db[_0x2301('0x47')]['count']({'where':_0x52a2f1[_0x2301('0x30')]})[_0x2301('0x1c')](function(_0x467f65){_0x473db6['count']=_0x467f65;if(_0x46d16e[_0x2301('0x25')][_0x2301('0x37')]){_0x52a2f1[_0x2301('0x40')]=[{'all':!![]}];}return db[_0x2301('0x47')]['findAll'](_0x52a2f1);})[_0x2301('0x1c')](function(_0x2bff80){_0x473db6[_0x2301('0x38')]=_0x2bff80;return _0x473db6;});}})[_0x2301('0x1c')](respondWithFilteredResult(_0x56fb63,_0x52a2f1))['catch'](handleError(_0x56fb63,null));};exports[_0x2301('0x4b')]=function(_0x4769fb,_0x185a85,_0x11aff5){var _0x479f29={'raw':!![],'where':{}};var _0xa8e53f={};var _0x533545={'count':0x0,'rows':[]};return db[_0x2301('0x36')][_0x2301('0x46')]({'where':{'id':_0x4769fb[_0x2301('0x3a')]['id']}})[_0x2301('0x1c')](handleEntityNotFound(_0x185a85,null))[_0x2301('0x1c')](function(_0x4f48e1){if(_0x4f48e1){_0xa8e53f[_0x2301('0x23')]=_[_0x2301('0x24')](db[_0x2301('0x4c')]['rawAttributes']);_0xa8e53f[_0x2301('0x25')]=_['keys'](_0x4769fb[_0x2301('0x25')]);_0xa8e53f['filters']=_[_0x2301('0x29')](_0xa8e53f[_0x2301('0x23')],_0xa8e53f[_0x2301('0x25')]);_0x479f29[_0x2301('0x2a')]=_[_0x2301('0x29')](_0xa8e53f[_0x2301('0x23')],qs[_0x2301('0x3b')](_0x4769fb['query']['fields']));_0x479f29['attributes']=_0x479f29[_0x2301('0x2a')][_0x2301('0x2b')]?_0x479f29[_0x2301('0x2a')]:_0xa8e53f['model'];if(!_0x4769fb[_0x2301('0x25')][_0x2301('0x48')](_0x2301('0x2c'))){_0x479f29[_0x2301('0x2d')]=qs[_0x2301('0x2d')](_0x4769fb['query'][_0x2301('0x2d')]);_0x479f29['offset']=qs[_0x2301('0x16')](_0x4769fb[_0x2301('0x25')][_0x2301('0x16')]);}_0x479f29[_0x2301('0x2e')]=qs[_0x2301('0x2f')](_0x4769fb[_0x2301('0x25')][_0x2301('0x2f')]);_0x479f29[_0x2301('0x30')]=qs[_0x2301('0x28')](_[_0x2301('0x31')](_0x4769fb['query'],_0xa8e53f[_0x2301('0x28')]));_0x479f29[_0x2301('0x30')][_0x2301('0x49')]=_0x4f48e1['id'];if(_0x4769fb[_0x2301('0x25')][_0x2301('0x34')]){_0x479f29[_0x2301('0x30')]=_[_0x2301('0x33')](_0x479f29[_0x2301('0x30')],{'$or':_['map'](_0x479f29[_0x2301('0x2a')],function(_0x199c81){var _0x5aa5da={};_0x5aa5da[_0x199c81]={'$like':'%'+_0x4769fb[_0x2301('0x25')]['filter']+'%'};return _0x5aa5da;})});}_0x479f29=_[_0x2301('0x33')]({},_0x479f29,_0x4769fb[_0x2301('0x4a')]);return db[_0x2301('0x4c')][_0x2301('0x15')]({'where':_0x479f29[_0x2301('0x30')]})[_0x2301('0x1c')](function(_0x2d9b52){_0x533545[_0x2301('0x15')]=_0x2d9b52;if(_0x4769fb['query'][_0x2301('0x37')]){_0x479f29[_0x2301('0x40')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x2301('0x4d')](_0x479f29);})['then'](function(_0x33a8ba){_0x533545[_0x2301('0x38')]=_0x33a8ba;return _0x533545;});}})['then'](respondWithFilteredResult(_0x185a85,_0x479f29))[_0x2301('0x39')](handleError(_0x185a85,null));};exports[_0x2301('0x4e')]=function(_0x5f1d62,_0x17aa60,_0x39ad98){var _0x4c165e={'raw':!![],'where':{}};var _0x1a77ef={};var _0x15dc2e={'count':0x0,'rows':[]};return db[_0x2301('0x36')][_0x2301('0x46')]({'where':{'id':_0x5f1d62[_0x2301('0x3a')]['id']}})[_0x2301('0x1c')](handleEntityNotFound(_0x17aa60,null))['then'](function(_0x4ba993){if(_0x4ba993){_0x1a77ef[_0x2301('0x23')]=_[_0x2301('0x24')](db[_0x2301('0x4f')]['rawAttributes']);_0x1a77ef[_0x2301('0x25')]=_['keys'](_0x5f1d62[_0x2301('0x25')]);_0x1a77ef['filters']=_['intersection'](_0x1a77ef['model'],_0x1a77ef[_0x2301('0x25')]);_0x4c165e[_0x2301('0x2a')]=_[_0x2301('0x29')](_0x1a77ef[_0x2301('0x23')],qs[_0x2301('0x3b')](_0x5f1d62[_0x2301('0x25')][_0x2301('0x3b')]));_0x4c165e['attributes']=_0x4c165e[_0x2301('0x2a')]['length']?_0x4c165e[_0x2301('0x2a')]:_0x1a77ef[_0x2301('0x23')];if(!_0x5f1d62[_0x2301('0x25')]['hasOwnProperty']('nolimit')){_0x4c165e['limit']=qs[_0x2301('0x2d')](_0x5f1d62[_0x2301('0x25')]['limit']);_0x4c165e[_0x2301('0x16')]=qs[_0x2301('0x16')](_0x5f1d62['query'][_0x2301('0x16')]);}_0x4c165e['order']=qs[_0x2301('0x2f')](_0x5f1d62['query']['sort']);_0x4c165e[_0x2301('0x30')]=qs[_0x2301('0x28')](_['pick'](_0x5f1d62[_0x2301('0x25')],_0x1a77ef['filters']));_0x4c165e['where'][_0x2301('0x49')]=_0x4ba993['id'];if(_0x5f1d62['query'][_0x2301('0x34')]){_0x4c165e[_0x2301('0x30')]=_['merge'](_0x4c165e['where'],{'$or':_[_0x2301('0x35')](_0x4c165e[_0x2301('0x2a')],function(_0x53acf7){var _0xa4ca62={};_0xa4ca62[_0x53acf7]={'$like':'%'+_0x5f1d62['query']['filter']+'%'};return _0xa4ca62;})});}_0x4c165e=_[_0x2301('0x33')]({},_0x4c165e,_0x5f1d62[_0x2301('0x4a')]);return db[_0x2301('0x4f')]['count']({'where':_0x4c165e[_0x2301('0x30')]})[_0x2301('0x1c')](function(_0x4b7a6b){_0x15dc2e['count']=_0x4b7a6b;if(_0x5f1d62[_0x2301('0x25')][_0x2301('0x37')]){_0x4c165e['include']=[{'all':!![]}];}return db[_0x2301('0x4f')][_0x2301('0x4d')](_0x4c165e);})[_0x2301('0x1c')](function(_0x4241f5){_0x15dc2e[_0x2301('0x38')]=_0x4241f5;return _0x15dc2e;});}})[_0x2301('0x1c')](respondWithFilteredResult(_0x17aa60,_0x4c165e))['catch'](handleError(_0x17aa60,null));};exports[_0x2301('0x50')]=function(_0x1df3b5,_0x5b1a83,_0x3d5277){var _0x3794a9={'raw':!![],'where':{}};var _0xdcf9ea={};var _0x12433c={'count':0x0,'rows':[]};return db[_0x2301('0x36')]['findOne']({'where':{'id':_0x1df3b5[_0x2301('0x3a')]['id']}})['then'](handleEntityNotFound(_0x5b1a83,null))[_0x2301('0x1c')](function(_0xa2d11e){if(_0xa2d11e){_0xdcf9ea[_0x2301('0x23')]=_['keys'](db['CmHopperBlack'][_0x2301('0x22')]);_0xdcf9ea['query']=_[_0x2301('0x24')](_0x1df3b5[_0x2301('0x25')]);_0xdcf9ea[_0x2301('0x28')]=_['intersection'](_0xdcf9ea[_0x2301('0x23')],_0xdcf9ea['query']);_0x3794a9[_0x2301('0x2a')]=_[_0x2301('0x29')](_0xdcf9ea[_0x2301('0x23')],qs['fields'](_0x1df3b5[_0x2301('0x25')][_0x2301('0x3b')]));_0x3794a9[_0x2301('0x2a')]=_0x3794a9[_0x2301('0x2a')]['length']?_0x3794a9['attributes']:_0xdcf9ea[_0x2301('0x23')];if(!_0x1df3b5[_0x2301('0x25')]['hasOwnProperty'](_0x2301('0x2c'))){_0x3794a9[_0x2301('0x2d')]=qs['limit'](_0x1df3b5['query'][_0x2301('0x2d')]);_0x3794a9[_0x2301('0x16')]=qs[_0x2301('0x16')](_0x1df3b5[_0x2301('0x25')][_0x2301('0x16')]);}_0x3794a9[_0x2301('0x2e')]=qs[_0x2301('0x2f')](_0x1df3b5[_0x2301('0x25')][_0x2301('0x2f')]);_0x3794a9[_0x2301('0x30')]=qs['filters'](_[_0x2301('0x31')](_0x1df3b5[_0x2301('0x25')],_0xdcf9ea[_0x2301('0x28')]));_0x3794a9['where']['CampaignId']=_0xa2d11e['id'];if(_0x1df3b5[_0x2301('0x25')][_0x2301('0x34')]){_0x3794a9[_0x2301('0x30')]=_['merge'](_0x3794a9['where'],{'$or':_[_0x2301('0x35')](_0x3794a9[_0x2301('0x2a')],function(_0x1f7645){var _0x3171df={};_0x3171df[_0x1f7645]={'$like':'%'+_0x1df3b5[_0x2301('0x25')]['filter']+'%'};return _0x3171df;})});}_0x3794a9=_[_0x2301('0x33')]({},_0x3794a9,_0x1df3b5[_0x2301('0x4a')]);return db[_0x2301('0x51')]['count']({'where':_0x3794a9['where']})[_0x2301('0x1c')](function(_0x13c8d8){_0x12433c[_0x2301('0x15')]=_0x13c8d8;if(_0x1df3b5[_0x2301('0x25')][_0x2301('0x37')]){_0x3794a9[_0x2301('0x40')]=[{'all':!![]}];}return db[_0x2301('0x51')][_0x2301('0x4d')](_0x3794a9);})[_0x2301('0x1c')](function(_0x59d327){_0x12433c['rows']=_0x59d327;return _0x12433c;});}})[_0x2301('0x1c')](respondWithFilteredResult(_0x5b1a83,_0x3794a9))[_0x2301('0x39')](handleError(_0x5b1a83,null));};exports['getLists']=function(_0x875cb5,_0xcf59d2,_0x2f9e02){var _0x50e81f={};var _0x3135d3={};var _0x459500;var _0x528444;return db[_0x2301('0x36')]['findOne']({'where':{'id':_0x875cb5['params']['id']}})[_0x2301('0x1c')](handleEntityNotFound(_0xcf59d2,null))[_0x2301('0x1c')](function(_0xba8611){if(_0xba8611){_0x459500=_0xba8611;_0x3135d3['model']=_[_0x2301('0x24')](db['CmList'][_0x2301('0x22')]);_0x3135d3[_0x2301('0x25')]=_[_0x2301('0x24')](_0x875cb5[_0x2301('0x25')]);_0x3135d3[_0x2301('0x28')]=_[_0x2301('0x29')](_0x3135d3[_0x2301('0x23')],_0x3135d3[_0x2301('0x25')]);_0x50e81f[_0x2301('0x2a')]=_[_0x2301('0x29')](_0x3135d3[_0x2301('0x23')],qs[_0x2301('0x3b')](_0x875cb5[_0x2301('0x25')][_0x2301('0x3b')]));_0x50e81f[_0x2301('0x2a')]=_0x50e81f[_0x2301('0x2a')][_0x2301('0x2b')]?_0x50e81f['attributes']:_0x3135d3['model'];_0x50e81f['order']=qs[_0x2301('0x2f')](_0x875cb5['query'][_0x2301('0x2f')]);_0x50e81f[_0x2301('0x30')]=qs[_0x2301('0x28')](_[_0x2301('0x31')](_0x875cb5[_0x2301('0x25')],_0x3135d3[_0x2301('0x28')]));if(_0x875cb5[_0x2301('0x25')][_0x2301('0x34')]){_0x50e81f[_0x2301('0x30')]=_[_0x2301('0x33')](_0x50e81f[_0x2301('0x30')],{'$or':_[_0x2301('0x35')](_0x50e81f[_0x2301('0x2a')],function(_0x51c975){var _0x3bcd01={};_0x3bcd01[_0x51c975]={'$like':'%'+_0x875cb5[_0x2301('0x25')][_0x2301('0x34')]+'%'};return _0x3bcd01;})});}_0x50e81f=_[_0x2301('0x33')]({},_0x50e81f,_0x875cb5['options']);return _0x459500[_0x2301('0x52')](_0x50e81f);}})[_0x2301('0x1c')](function(_0x106242){if(_0x106242){_0x528444=_0x106242[_0x2301('0x2b')];if(!_0x875cb5['query'][_0x2301('0x48')](_0x2301('0x2c'))){_0x50e81f[_0x2301('0x2d')]=qs[_0x2301('0x2d')](_0x875cb5[_0x2301('0x25')]['limit']);_0x50e81f[_0x2301('0x16')]=qs[_0x2301('0x16')](_0x875cb5[_0x2301('0x25')]['offset']);}return _0x459500[_0x2301('0x52')](_0x50e81f);}})[_0x2301('0x1c')](function(_0x593e75){if(_0x593e75){return _0x593e75?{'count':_0x528444,'rows':_0x593e75}:null;}})['then'](respondWithResult(_0xcf59d2,null))['catch'](handleError(_0xcf59d2,null));};exports[_0x2301('0x53')]=function(_0x145026,_0x38d1e5,_0x1d0646){var _0x5b6e10,_0x1a8f20;return db[_0x2301('0x36')]['find']({'where':{'id':_0x145026[_0x2301('0x3a')]['id']}})[_0x2301('0x1c')](handleEntityNotFound(_0x38d1e5,null))[_0x2301('0x1c')](function(_0x42093f){if(_0x42093f){_0x1a8f20=_0x42093f;return _0x42093f[_0x2301('0x53')](_0x145026['body'][_0x2301('0x54')],_[_0x2301('0x44')](_0x145026['body'],[_0x2301('0x54'),'id'])||{});}return null;})[_0x2301('0x55')](function(_0x1a1c1f){var _0x4917ee;_0x5b6e10=_0x1a1c1f||[];var _0x5043c8=[];if(_0x1a1c1f){for(var _0xf61a68=0x0;_0xf61a68<_0x1a1c1f['length'];_0xf61a68+=0x1){var _0x332fc0=_0x1a1c1f[_0xf61a68][_0x2301('0x41')]({'plain':!![]});_0x1a8f20['dialCheckDuplicateType']=_0x145026['body'][_0x2301('0x56')]?_0x145026[_0x2301('0x3e')][_0x2301('0x56')]:_0x1a8f20[_0x2301('0x56')];switch(_0x1a8f20[_0x2301('0x56')]){case _0x2301('0x57'):_0x4917ee=squel['insert']()['into'](_0x2301('0x58'))[_0x2301('0x59')]([_0x2301('0x5a'),_0x2301('0x5b'),_0x2301('0x5c'),_0x2301('0x5d'),_0x2301('0x49'),_0x2301('0x42'),_0x2301('0x43')],squel[_0x2301('0x5e')]()[_0x2301('0x5f')]('phone',_0x2301('0x5a'))[_0x2301('0x5f')](_0x2301('0x60'),'scheduledAt')[_0x2301('0x5f')]('id',_0x2301('0x5c'))[_0x2301('0x5f')](_0x332fc0[_0x2301('0x61')]['toString'](),_0x2301('0x5d'))['field'](_0x145026[_0x2301('0x3a')]['id'][_0x2301('0x62')](),_0x2301('0x49'))[_0x2301('0x5f')](_0x2301('0x60'),_0x2301('0x42'))[_0x2301('0x5f')](_0x2301('0x60'),_0x2301('0x43'))[_0x2301('0x63')]('cm_contacts')[_0x2301('0x30')](_0x2301('0x64'))['where'](_0x2301('0x65'),_0x332fc0['CmListId'][_0x2301('0x62')]())[_0x2301('0x30')]('phone\x20IS\x20NOT\x20NULL')[_0x2301('0x30')](_0x2301('0x66'),squel[_0x2301('0x5e')]()[_0x2301('0x5f')](_0x2301('0x67'))['from'](_0x2301('0x68'))[_0x2301('0x30')]('CampaignId\x20=\x20?',_0x145026['params']['id'][_0x2301('0x62')]()))[_0x2301('0x30')](_0x2301('0x66'),squel[_0x2301('0x5e')]()[_0x2301('0x5f')](_0x2301('0x5a'))[_0x2301('0x63')]('cm_hopper')['where'](_0x2301('0x69'),_0x145026[_0x2301('0x3a')]['id'][_0x2301('0x62')]())))['toString']();break;case _0x2301('0x6a'):_0x4917ee=squel['insert']()[_0x2301('0x6b')](_0x2301('0x58'))[_0x2301('0x59')](['phone',_0x2301('0x5b'),'ContactId','ListId',_0x2301('0x49'),_0x2301('0x42'),'updatedAt'],squel[_0x2301('0x5e')]()[_0x2301('0x5f')](_0x2301('0x5a'),_0x2301('0x5a'))[_0x2301('0x5f')](_0x2301('0x60'),'scheduledAt')[_0x2301('0x5f')]('id',_0x2301('0x5c'))[_0x2301('0x5f')](_0x332fc0[_0x2301('0x61')]['toString'](),'ListId')[_0x2301('0x5f')](_0x145026[_0x2301('0x3a')]['id'][_0x2301('0x62')](),_0x2301('0x49'))[_0x2301('0x5f')](_0x2301('0x60'),'createdAt')[_0x2301('0x5f')](_0x2301('0x60'),_0x2301('0x43'))[_0x2301('0x63')](_0x2301('0x6c'))[_0x2301('0x30')]('deletedAt\x20IS\x20NULL')['where'](_0x2301('0x65'),_0x332fc0[_0x2301('0x61')][_0x2301('0x62')]())[_0x2301('0x30')](_0x2301('0x6d'))[_0x2301('0x30')](_0x2301('0x66'),squel[_0x2301('0x5e')]()[_0x2301('0x5f')](_0x2301('0x5a'))[_0x2301('0x63')]('cm_hopper')[_0x2301('0x30')](_0x2301('0x69'),_0x145026[_0x2301('0x3a')]['id'][_0x2301('0x62')]())))['toString']();break;default:_0x4917ee=squel[_0x2301('0x6e')]()[_0x2301('0x6b')](_0x2301('0x58'))[_0x2301('0x59')]([_0x2301('0x5a'),_0x2301('0x5b'),_0x2301('0x5c'),_0x2301('0x5d'),_0x2301('0x49'),_0x2301('0x42'),_0x2301('0x43')],squel[_0x2301('0x5e')]()[_0x2301('0x5f')](_0x2301('0x5a'),_0x2301('0x5a'))[_0x2301('0x5f')](_0x2301('0x60'),'scheduledAt')[_0x2301('0x5f')]('id',_0x2301('0x5c'))[_0x2301('0x5f')](_0x332fc0[_0x2301('0x61')]['toString'](),_0x2301('0x5d'))[_0x2301('0x5f')](_0x145026[_0x2301('0x3a')]['id'][_0x2301('0x62')](),_0x2301('0x49'))['field'](_0x2301('0x60'),'createdAt')[_0x2301('0x5f')]('NOW()',_0x2301('0x43'))[_0x2301('0x63')](_0x2301('0x6c'))[_0x2301('0x30')](_0x2301('0x64'))[_0x2301('0x30')]('ListId\x20=\x20?',_0x332fc0[_0x2301('0x61')][_0x2301('0x62')]())[_0x2301('0x30')]('phone\x20IS\x20NOT\x20NULL'))[_0x2301('0x62')]();}_0x5043c8[_0x2301('0x6f')](db[_0x2301('0x70')][_0x2301('0x25')](_0x4917ee));}return BPromise[_0x2301('0x71')](_0x5043c8);}})['then'](function(){return _0x5b6e10;})[_0x2301('0x1c')](respondWithResult(_0x38d1e5,null))[_0x2301('0x39')](handleError(_0x38d1e5,null));};exports[_0x2301('0x72')]=function(_0x1e2c43,_0x584788,_0x1d90c8){var _0x2fec87;return db['Campaign'][_0x2301('0x3c')]({'where':{'id':_0x1e2c43['params']['id']}})[_0x2301('0x1c')](handleEntityNotFound(_0x584788,null))['then'](function(_0x36a59a){if(_0x36a59a){return _0x36a59a['removeLists'](_0x1e2c43[_0x2301('0x25')]['ids']);}})[_0x2301('0x1c')](function(_0xf73fed){if(_0xf73fed){_0x2fec87=_0xf73fed;return db[_0x2301('0x47')][_0x2301('0x1d')]({'where':{'ListId':_0x1e2c43['query'][_0x2301('0x54')],'CampaignId':_0x1e2c43[_0x2301('0x3a')]['id']}})[_0x2301('0x1c')](function(){return _0x2fec87;});}})[_0x2301('0x1c')](respondWithStatusCode(_0x584788,null))['catch'](handleError(_0x584788,null));};exports['getBlackLists']=function(_0x1a486c,_0x50e085,_0x5bac40){var _0x4e3744={'raw':!![],'where':{}};var _0x468862={};var _0x3c27c6={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x1a486c[_0x2301('0x3a')]['id']}})['then'](handleEntityNotFound(_0x50e085,null))[_0x2301('0x1c')](function(_0x393522){if(_0x393522){_0x468862[_0x2301('0x23')]=_[_0x2301('0x24')](db[_0x2301('0x73')]['rawAttributes']);_0x468862[_0x2301('0x25')]=_[_0x2301('0x24')](_0x1a486c[_0x2301('0x25')]);_0x468862[_0x2301('0x28')]=_[_0x2301('0x29')](_0x468862[_0x2301('0x23')],_0x468862[_0x2301('0x25')]);_0x4e3744[_0x2301('0x2a')]=_['intersection'](_0x468862[_0x2301('0x23')],qs[_0x2301('0x3b')](_0x1a486c['query'][_0x2301('0x3b')]));_0x4e3744['attributes']=_0x4e3744['attributes'][_0x2301('0x2b')]?_0x4e3744['attributes']:_0x468862[_0x2301('0x23')];if(!_0x1a486c['query'][_0x2301('0x48')](_0x2301('0x2c'))){_0x4e3744[_0x2301('0x2d')]=qs['limit'](_0x1a486c[_0x2301('0x25')][_0x2301('0x2d')]);_0x4e3744[_0x2301('0x16')]=qs[_0x2301('0x16')](_0x1a486c[_0x2301('0x25')][_0x2301('0x16')]);}_0x4e3744[_0x2301('0x2e')]=qs['sort'](_0x1a486c['query'][_0x2301('0x2f')]);_0x4e3744['where']=qs[_0x2301('0x28')](_[_0x2301('0x31')](_0x1a486c[_0x2301('0x25')],_0x468862['filters']));_0x4e3744[_0x2301('0x30')][_0x2301('0x49')]=_0x393522['id'];if(_0x1a486c['query'][_0x2301('0x34')]){_0x4e3744['where']=_[_0x2301('0x33')](_0x4e3744[_0x2301('0x30')],{'$or':_[_0x2301('0x35')](_0x4e3744['attributes'],function(_0x2c42c1){var _0x22e47d={};_0x22e47d[_0x2c42c1]={'$like':'%'+_0x1a486c['query'][_0x2301('0x34')]+'%'};return _0x22e47d;})});}_0x4e3744=_[_0x2301('0x33')]({},_0x4e3744,_0x1a486c['options']);return db[_0x2301('0x73')][_0x2301('0x15')]({'where':_0x4e3744[_0x2301('0x30')]})[_0x2301('0x1c')](function(_0x106d26){_0x3c27c6['count']=_0x106d26;if(_0x1a486c[_0x2301('0x25')][_0x2301('0x37')]){_0x4e3744[_0x2301('0x40')]=[{'all':!![]}];}return db['CmList'][_0x2301('0x4d')](_0x4e3744);})[_0x2301('0x1c')](function(_0x138c03){_0x3c27c6[_0x2301('0x38')]=_0x138c03;return _0x3c27c6;});}})[_0x2301('0x1c')](respondWithFilteredResult(_0x50e085,_0x4e3744))[_0x2301('0x39')](handleError(_0x50e085,null));};exports['addBlackLists']=function(_0x253a59,_0x736c3c,_0x277023){var _0x144540,_0x427186;return db[_0x2301('0x36')]['find']({'where':{'id':_0x253a59[_0x2301('0x3a')]['id']}})[_0x2301('0x1c')](handleEntityNotFound(_0x736c3c,null))['then'](function(_0x2788df){if(_0x2788df){_0x427186=_0x2788df;return _0x2788df[_0x2301('0x74')](_0x253a59[_0x2301('0x3e')][_0x2301('0x54')],_['omit'](_0x253a59[_0x2301('0x3e')],[_0x2301('0x54'),'id'])||{});}return null;})['spread'](function(_0x41508a){var _0x152454;_0x144540=_0x41508a||[];var _0x279826=[];if(_0x41508a){for(var _0x485b13=0x0;_0x485b13<_0x41508a[_0x2301('0x2b')];_0x485b13+=0x1){var _0x182a0f=_0x41508a[_0x485b13]['get']({'plain':!![]});_0x152454=squel[_0x2301('0x6e')]()[_0x2301('0x6b')](_0x2301('0x75'))['fromQuery'](['phone',_0x2301('0x5c'),_0x2301('0x5d'),_0x2301('0x49'),'createdAt',_0x2301('0x43')],squel['select']()[_0x2301('0x5f')]('phone',_0x2301('0x5a'))[_0x2301('0x5f')]('id','ContactId')['field'](_0x182a0f[_0x2301('0x61')][_0x2301('0x62')](),_0x2301('0x5d'))[_0x2301('0x5f')](_0x253a59[_0x2301('0x3a')]['id'][_0x2301('0x62')](),_0x2301('0x49'))[_0x2301('0x5f')](_0x2301('0x60'),_0x2301('0x42'))[_0x2301('0x5f')](_0x2301('0x60'),_0x2301('0x43'))[_0x2301('0x63')](_0x2301('0x6c'))[_0x2301('0x30')]('deletedAt\x20IS\x20NULL')[_0x2301('0x30')](_0x2301('0x65'),_0x182a0f['CmListId'][_0x2301('0x62')]())[_0x2301('0x30')](_0x2301('0x6d')))['toString']();_0x279826[_0x2301('0x6f')](db['sequelize'][_0x2301('0x25')](_0x152454));}return BPromise[_0x2301('0x71')](_0x279826);}})[_0x2301('0x1c')](function(){return _0x144540;})[_0x2301('0x1c')](respondWithResult(_0x736c3c,null))[_0x2301('0x39')](handleError(_0x736c3c,null));};exports[_0x2301('0x76')]=function(_0x5c8778,_0x44bb01,_0x3d9a14){var _0x41edbc;return db[_0x2301('0x36')][_0x2301('0x3c')]({'where':{'id':_0x5c8778['params']['id']}})['then'](handleEntityNotFound(_0x44bb01,null))[_0x2301('0x1c')](function(_0x342cec){if(_0x342cec){return _0x342cec['removeBlackLists'](_0x5c8778['query']['ids']);}})[_0x2301('0x1c')](function(_0x51e2b){if(_0x51e2b){_0x41edbc=_0x51e2b;return db['CmHopperBlack'][_0x2301('0x1d')]({'where':{'ListId':_0x5c8778[_0x2301('0x25')][_0x2301('0x54')],'CampaignId':_0x5c8778[_0x2301('0x3a')]['id']}})[_0x2301('0x1c')](function(){return _0x41edbc;});}})[_0x2301('0x1c')](respondWithStatusCode(_0x44bb01,null))[_0x2301('0x39')](handleError(_0x44bb01,null));}; \ No newline at end of file +var _0xa6a5=['ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','field','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','CampaignId\x20=\x20?','ListId\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','get','cm_hopper_black','removeBlackLists','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','name','index','rawAttributes','query','dateStart','dateEnd','intersection','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','day','add','merge','filter','map','options','Campaign','includeAll','include','findAll','catch','show','keys','fields','find','create','body','params','omit','updatedAt','createdAt','getHoppers','findOne','CmHopper','CampaignId','rows','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists'];(function(_0x86c006,_0x59642a){var _0x283abe=function(_0x14302b){while(--_0x14302b){_0x86c006['push'](_0x86c006['shift']());}};_0x283abe(++_0x59642a);}(_0xa6a5,0x94));var _0x5a6a=function(_0x2b8077,_0x453634){_0x2b8077=_0x2b8077-0x0;var _0x308091=_0xa6a5[_0x2b8077];return _0x308091;};'use strict';var jsonpatch=require(_0x5a6a('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5a6a('0x1'));var Mustache=require(_0x5a6a('0x2'));var util=require('util');var path=require(_0x5a6a('0x3'));var sox=require(_0x5a6a('0x4'));var csv=require(_0x5a6a('0x5'));var ejs=require(_0x5a6a('0x6'));var fs=require('fs');var _=require(_0x5a6a('0x7'));var squel=require(_0x5a6a('0x8'));var crypto=require(_0x5a6a('0x9'));var jsforce=require(_0x5a6a('0xa'));var deskjs=require(_0x5a6a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5a6a('0xc'));var Papa=require(_0x5a6a('0xd'));var qs=require(_0x5a6a('0xe'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x5a6a('0xf'));var db=require(_0x5a6a('0x10'))['db'];function respondWithStatusCode(_0x166c84,_0x26c119){_0x26c119=_0x26c119||0xcc;return function(_0x78fc0d){if(_0x78fc0d){return _0x166c84[_0x5a6a('0x11')](_0x26c119);}return _0x166c84[_0x5a6a('0x12')](_0x26c119)[_0x5a6a('0x13')]();};}function respondWithResult(_0x1ed186,_0x15a8d7){_0x15a8d7=_0x15a8d7||0xc8;return function(_0x4ef08f){if(_0x4ef08f){return _0x1ed186[_0x5a6a('0x12')](_0x15a8d7)[_0x5a6a('0x14')](_0x4ef08f);}};}function respondWithFilteredResult(_0x3e0f75,_0x38e632){return function(_0x3b0d03){if(_0x3b0d03){var _0x581f89=_0x3b0d03[_0x5a6a('0x15')],_0x41c226=_0x38e632['offset'],_0x457b6b=_0x38e632[_0x5a6a('0x16')]+_0x38e632[_0x5a6a('0x17')],_0x1107b8;if(_0x457b6b>=_0x581f89){_0x457b6b=_0x581f89;_0x1107b8=0xc8;}else{_0x1107b8=0xce;}_0x3e0f75[_0x5a6a('0x12')](_0x1107b8);return _0x3e0f75['set'](_0x5a6a('0x18'),_0x41c226+'-'+_0x457b6b+'/'+_0x581f89)['json'](_0x3b0d03);}return null;};}function patchUpdates(_0x8008b6){return function(_0x363d69){try{jsonpatch['apply'](_0x363d69,_0x8008b6,!![]);}catch(_0x174736){return BPromise[_0x5a6a('0x19')](_0x174736);}return _0x363d69[_0x5a6a('0x1a')]();};}function saveUpdates(_0x3b2575,_0x45f926){return function(_0x278ff8){if(_0x278ff8){return _0x278ff8[_0x5a6a('0x1b')](_0x3b2575)[_0x5a6a('0x1c')](function(_0xcfd0ba){return _0xcfd0ba;});}return null;};}function removeEntity(_0x5703b6,_0x2be3cf){return function(_0x5549fc){if(_0x5549fc){return _0x5549fc[_0x5a6a('0x1d')]()[_0x5a6a('0x1c')](function(){_0x5703b6['status'](0xcc)[_0x5a6a('0x13')]();});}};}function handleEntityNotFound(_0x2830a3,_0x4cb09e){return function(_0x1e214c){if(!_0x1e214c){_0x2830a3[_0x5a6a('0x11')](0x194);}return _0x1e214c;};}function handleError(_0x59ae3f,_0x480d49){_0x480d49=_0x480d49||0x1f4;return function(_0x247a14){logger['error'](_0x247a14['stack']);if(_0x247a14[_0x5a6a('0x1e')]){delete _0x247a14[_0x5a6a('0x1e')];}_0x59ae3f[_0x5a6a('0x12')](_0x480d49)['send'](_0x247a14);};}exports[_0x5a6a('0x1f')]=function(_0x50bd3f,_0x5d6596){var _0x27c458={},_0x185d3d={},_0x4c92c1={'count':0x0,'rows':[]};var _0x58b2db=db['Campaign'][_0x5a6a('0x20')];_0x185d3d['model']=_['keys'](_0x58b2db);var _0x226bbf={'dateStart':_0x50bd3f[_0x5a6a('0x21')][_0x5a6a('0x22')],'dateEnd':_0x50bd3f[_0x5a6a('0x21')][_0x5a6a('0x23')]};delete _0x50bd3f[_0x5a6a('0x21')][_0x5a6a('0x22')];delete _0x50bd3f['query'][_0x5a6a('0x23')];_0x185d3d['query']=_['keys'](_0x50bd3f[_0x5a6a('0x21')]);_0x185d3d['filters']=_[_0x5a6a('0x24')](_0x185d3d['model'],_0x185d3d['query']);_0x27c458['attributes']=_['intersection'](_0x185d3d['model'],qs['fields'](_0x50bd3f['query']['fields']));_0x27c458[_0x5a6a('0x25')]=_0x27c458[_0x5a6a('0x25')][_0x5a6a('0x26')]?_0x27c458['attributes']:_0x185d3d[_0x5a6a('0x27')];if(!_0x50bd3f[_0x5a6a('0x21')][_0x5a6a('0x28')](_0x5a6a('0x29'))){_0x27c458[_0x5a6a('0x17')]=qs[_0x5a6a('0x17')](_0x50bd3f[_0x5a6a('0x21')][_0x5a6a('0x17')]);_0x27c458[_0x5a6a('0x16')]=qs['offset'](_0x50bd3f[_0x5a6a('0x21')]['offset']);}_0x27c458[_0x5a6a('0x2a')]=qs[_0x5a6a('0x2b')](_0x50bd3f[_0x5a6a('0x21')][_0x5a6a('0x2b')]);_0x27c458[_0x5a6a('0x2c')]=qs[_0x5a6a('0x2d')](_[_0x5a6a('0x2e')](_0x50bd3f[_0x5a6a('0x21')],_0x185d3d[_0x5a6a('0x2d')]));if(_0x226bbf[_0x5a6a('0x22')]){if(_0x226bbf[_0x5a6a('0x23')]){_0x226bbf[_0x5a6a('0x23')]=moment(_0x226bbf[_0x5a6a('0x23')])['add'](0x1,_0x5a6a('0x2f'));}else{_0x226bbf[_0x5a6a('0x23')]=moment(_0x226bbf[_0x5a6a('0x22')])[_0x5a6a('0x30')](0x1,_0x5a6a('0x2f'));}_[_0x5a6a('0x31')](_0x27c458['where'],{'createdAt':{'$gte':_0x226bbf['dateStart'],'$lte':_0x226bbf[_0x5a6a('0x23')]}});}if(_0x50bd3f[_0x5a6a('0x21')][_0x5a6a('0x32')]){_0x27c458[_0x5a6a('0x2c')]=_[_0x5a6a('0x31')](_0x27c458['where'],{'$or':_[_0x5a6a('0x33')](_0x27c458['attributes'],function(_0x5865bf){var _0x3f482b={};_0x3f482b[_0x5865bf]={'$like':'%'+_0x50bd3f[_0x5a6a('0x21')][_0x5a6a('0x32')]+'%'};return _0x3f482b;})});}_0x27c458=_[_0x5a6a('0x31')]({},_0x27c458,_0x50bd3f[_0x5a6a('0x34')]);var _0x44a223={'where':_0x27c458['where']};return db[_0x5a6a('0x35')]['count'](_0x44a223)['then'](function(_0x228d73){_0x4c92c1[_0x5a6a('0x15')]=_0x228d73;if(_0x50bd3f['query'][_0x5a6a('0x36')]){_0x27c458[_0x5a6a('0x37')]=[{'all':!![]}];}return db[_0x5a6a('0x35')][_0x5a6a('0x38')](_0x27c458);})[_0x5a6a('0x1c')](function(_0x98308f){_0x4c92c1['rows']=_0x98308f;return _0x4c92c1;})[_0x5a6a('0x1c')](respondWithFilteredResult(_0x5d6596,_0x27c458))[_0x5a6a('0x39')](handleError(_0x5d6596,null));};exports[_0x5a6a('0x3a')]=function(_0x181084,_0x1b74f9){var _0x24532b={'raw':![],'where':{'id':_0x181084['params']['id']}},_0x3c92c5={};_0x3c92c5['model']=_[_0x5a6a('0x3b')](db[_0x5a6a('0x35')][_0x5a6a('0x20')]);_0x3c92c5[_0x5a6a('0x21')]=_[_0x5a6a('0x3b')](_0x181084[_0x5a6a('0x21')]);_0x3c92c5[_0x5a6a('0x2d')]=_[_0x5a6a('0x24')](_0x3c92c5[_0x5a6a('0x27')],_0x3c92c5[_0x5a6a('0x21')]);_0x24532b['attributes']=_[_0x5a6a('0x24')](_0x3c92c5[_0x5a6a('0x27')],qs[_0x5a6a('0x3c')](_0x181084[_0x5a6a('0x21')][_0x5a6a('0x3c')]));_0x24532b[_0x5a6a('0x25')]=_0x24532b[_0x5a6a('0x25')]['length']?_0x24532b[_0x5a6a('0x25')]:_0x3c92c5[_0x5a6a('0x27')];if(_0x181084[_0x5a6a('0x21')]['includeAll']){_0x24532b[_0x5a6a('0x37')]=[{'all':!![]}];}_0x24532b=_[_0x5a6a('0x31')]({},_0x24532b,_0x181084['options']);return db[_0x5a6a('0x35')][_0x5a6a('0x3d')](_0x24532b)[_0x5a6a('0x1c')](handleEntityNotFound(_0x1b74f9,null))[_0x5a6a('0x1c')](respondWithResult(_0x1b74f9,null))[_0x5a6a('0x39')](handleError(_0x1b74f9,null));};exports[_0x5a6a('0x3e')]=function(_0x374b2c,_0x28fe02){return db[_0x5a6a('0x35')][_0x5a6a('0x3e')](_0x374b2c[_0x5a6a('0x3f')],{})[_0x5a6a('0x1c')](respondWithResult(_0x28fe02,0xc9))[_0x5a6a('0x39')](handleError(_0x28fe02,null));};exports['clone']=function(_0x4d86b0,_0x3020bd){var _0x4845f8={'raw':![],'where':{'id':_0x4d86b0[_0x5a6a('0x40')]['id']}},_0x453446={};_0x453446[_0x5a6a('0x27')]=_[_0x5a6a('0x3b')](db[_0x5a6a('0x35')][_0x5a6a('0x20')]);_0x4845f8[_0x5a6a('0x25')]=_[_0x5a6a('0x24')](_0x453446[_0x5a6a('0x27')],qs[_0x5a6a('0x3c')](_0x4d86b0['query'][_0x5a6a('0x3c')]));_0x4845f8[_0x5a6a('0x25')]=_0x4845f8[_0x5a6a('0x25')]['length']?_0x4845f8['attributes']:_0x453446[_0x5a6a('0x27')];if(_0x4d86b0[_0x5a6a('0x21')]['includeAll']){_0x4845f8['include']=[{'all':!![]}];}_0x4845f8=_['merge']({},_0x4845f8,_0x4d86b0[_0x5a6a('0x34')]);return db[_0x5a6a('0x35')][_0x5a6a('0x3d')](_0x4845f8)[_0x5a6a('0x1c')](handleEntityNotFound(_0x3020bd,null))[_0x5a6a('0x1c')](function(_0x2a359f){if(_0x2a359f){var _0xf69662=_0x2a359f['get']({'plain':!![]});_0xf69662=qs[_0x5a6a('0x41')](_0xf69662,['id','createdAt',_0x5a6a('0x42')]);_0x4d86b0[_0x5a6a('0x3f')]=_[_0x5a6a('0x41')](_0x4d86b0[_0x5a6a('0x3f')],['id',_0x5a6a('0x43'),_0x5a6a('0x42')]);return db[_0x5a6a('0x35')][_0x5a6a('0x3e')](_[_0x5a6a('0x31')](_0xf69662,_0x4d86b0['body']),{'include':_0x4d86b0[_0x5a6a('0x21')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x5a6a('0x1c')](respondWithResult(_0x3020bd,0xc9))[_0x5a6a('0x39')](handleError(_0x3020bd,null));};exports[_0x5a6a('0x1b')]=function(_0x52164f,_0x21c0be){if(_0x52164f[_0x5a6a('0x3f')]['id']){delete _0x52164f['body']['id'];}return db[_0x5a6a('0x35')]['find']({'where':{'id':_0x52164f['params']['id']}})[_0x5a6a('0x1c')](handleEntityNotFound(_0x21c0be,null))['then'](saveUpdates(_0x52164f[_0x5a6a('0x3f')],null))[_0x5a6a('0x1c')](respondWithResult(_0x21c0be,null))[_0x5a6a('0x39')](handleError(_0x21c0be,null));};exports['destroy']=function(_0x438123,_0x2f2886){return db[_0x5a6a('0x35')]['find']({'where':{'id':_0x438123[_0x5a6a('0x40')]['id']}})[_0x5a6a('0x1c')](handleEntityNotFound(_0x2f2886,null))[_0x5a6a('0x1c')](removeEntity(_0x2f2886,null))[_0x5a6a('0x39')](handleError(_0x2f2886,null));};exports[_0x5a6a('0x44')]=function(_0x52018a,_0x264161,_0x4a51e5){var _0x430d1a={'raw':!![],'where':{}};var _0x32c502={};var _0x3442b6={'count':0x0,'rows':[]};return db[_0x5a6a('0x35')][_0x5a6a('0x45')]({'where':{'id':_0x52018a[_0x5a6a('0x40')]['id']}})[_0x5a6a('0x1c')](handleEntityNotFound(_0x264161,null))['then'](function(_0xad98){if(_0xad98){_0x32c502['model']=_[_0x5a6a('0x3b')](db[_0x5a6a('0x46')][_0x5a6a('0x20')]);_0x32c502[_0x5a6a('0x21')]=_[_0x5a6a('0x3b')](_0x52018a['query']);_0x32c502[_0x5a6a('0x2d')]=_[_0x5a6a('0x24')](_0x32c502[_0x5a6a('0x27')],_0x32c502[_0x5a6a('0x21')]);_0x430d1a['attributes']=_[_0x5a6a('0x24')](_0x32c502['model'],qs[_0x5a6a('0x3c')](_0x52018a[_0x5a6a('0x21')]['fields']));_0x430d1a[_0x5a6a('0x25')]=_0x430d1a[_0x5a6a('0x25')][_0x5a6a('0x26')]?_0x430d1a[_0x5a6a('0x25')]:_0x32c502[_0x5a6a('0x27')];if(!_0x52018a[_0x5a6a('0x21')][_0x5a6a('0x28')](_0x5a6a('0x29'))){_0x430d1a[_0x5a6a('0x17')]=qs[_0x5a6a('0x17')](_0x52018a[_0x5a6a('0x21')][_0x5a6a('0x17')]);_0x430d1a['offset']=qs['offset'](_0x52018a[_0x5a6a('0x21')][_0x5a6a('0x16')]);}_0x430d1a[_0x5a6a('0x2a')]=qs[_0x5a6a('0x2b')](_0x52018a[_0x5a6a('0x21')][_0x5a6a('0x2b')]);_0x430d1a[_0x5a6a('0x2c')]=qs[_0x5a6a('0x2d')](_[_0x5a6a('0x2e')](_0x52018a[_0x5a6a('0x21')],_0x32c502['filters']));_0x430d1a[_0x5a6a('0x2c')][_0x5a6a('0x47')]=_0xad98['id'];if(_0x52018a[_0x5a6a('0x21')][_0x5a6a('0x32')]){_0x430d1a[_0x5a6a('0x2c')]=_[_0x5a6a('0x31')](_0x430d1a['where'],{'$or':_[_0x5a6a('0x33')](_0x430d1a[_0x5a6a('0x25')],function(_0x57a62d){var _0x5d1a97={};_0x5d1a97[_0x57a62d]={'$like':'%'+_0x52018a[_0x5a6a('0x21')]['filter']+'%'};return _0x5d1a97;})});}_0x430d1a=_[_0x5a6a('0x31')]({},_0x430d1a,_0x52018a[_0x5a6a('0x34')]);return db[_0x5a6a('0x46')][_0x5a6a('0x15')]({'where':_0x430d1a[_0x5a6a('0x2c')]})['then'](function(_0x17585c){_0x3442b6[_0x5a6a('0x15')]=_0x17585c;if(_0x52018a[_0x5a6a('0x21')]['includeAll']){_0x430d1a[_0x5a6a('0x37')]=[{'all':!![]}];}return db[_0x5a6a('0x46')]['findAll'](_0x430d1a);})[_0x5a6a('0x1c')](function(_0x370679){_0x3442b6[_0x5a6a('0x48')]=_0x370679;return _0x3442b6;});}})['then'](respondWithFilteredResult(_0x264161,_0x430d1a))[_0x5a6a('0x39')](handleError(_0x264161,null));};exports['getHopperHistories']=function(_0x420e05,_0x424b8d,_0x118c7d){var _0x5acb2b={'raw':!![],'where':{}};var _0x2387f5={};var _0x4185e2={'count':0x0,'rows':[]};return db['Campaign'][_0x5a6a('0x45')]({'where':{'id':_0x420e05[_0x5a6a('0x40')]['id']}})[_0x5a6a('0x1c')](handleEntityNotFound(_0x424b8d,null))[_0x5a6a('0x1c')](function(_0x420205){if(_0x420205){_0x2387f5[_0x5a6a('0x27')]=_[_0x5a6a('0x3b')](db[_0x5a6a('0x49')][_0x5a6a('0x20')]);_0x2387f5[_0x5a6a('0x21')]=_['keys'](_0x420e05[_0x5a6a('0x21')]);_0x2387f5['filters']=_[_0x5a6a('0x24')](_0x2387f5[_0x5a6a('0x27')],_0x2387f5[_0x5a6a('0x21')]);_0x5acb2b[_0x5a6a('0x25')]=_['intersection'](_0x2387f5[_0x5a6a('0x27')],qs[_0x5a6a('0x3c')](_0x420e05[_0x5a6a('0x21')][_0x5a6a('0x3c')]));_0x5acb2b[_0x5a6a('0x25')]=_0x5acb2b[_0x5a6a('0x25')]['length']?_0x5acb2b['attributes']:_0x2387f5['model'];if(!_0x420e05['query'][_0x5a6a('0x28')](_0x5a6a('0x29'))){_0x5acb2b[_0x5a6a('0x17')]=qs[_0x5a6a('0x17')](_0x420e05['query']['limit']);_0x5acb2b[_0x5a6a('0x16')]=qs['offset'](_0x420e05[_0x5a6a('0x21')][_0x5a6a('0x16')]);}_0x5acb2b['order']=qs[_0x5a6a('0x2b')](_0x420e05[_0x5a6a('0x21')]['sort']);_0x5acb2b[_0x5a6a('0x2c')]=qs[_0x5a6a('0x2d')](_[_0x5a6a('0x2e')](_0x420e05['query'],_0x2387f5[_0x5a6a('0x2d')]));_0x5acb2b[_0x5a6a('0x2c')][_0x5a6a('0x47')]=_0x420205['id'];if(_0x420e05[_0x5a6a('0x21')][_0x5a6a('0x32')]){_0x5acb2b['where']=_[_0x5a6a('0x31')](_0x5acb2b[_0x5a6a('0x2c')],{'$or':_[_0x5a6a('0x33')](_0x5acb2b[_0x5a6a('0x25')],function(_0x30fd46){var _0x5c759d={};_0x5c759d[_0x30fd46]={'$like':'%'+_0x420e05[_0x5a6a('0x21')]['filter']+'%'};return _0x5c759d;})});}_0x5acb2b=_[_0x5a6a('0x31')]({},_0x5acb2b,_0x420e05[_0x5a6a('0x34')]);return db['CmHopperHistory'][_0x5a6a('0x15')]({'where':_0x5acb2b['where']})[_0x5a6a('0x1c')](function(_0x4d5fd5){_0x4185e2[_0x5a6a('0x15')]=_0x4d5fd5;if(_0x420e05[_0x5a6a('0x21')][_0x5a6a('0x36')]){_0x5acb2b[_0x5a6a('0x37')]=[{'all':!![]}];}return db[_0x5a6a('0x49')][_0x5a6a('0x38')](_0x5acb2b);})[_0x5a6a('0x1c')](function(_0x11dcd1){_0x4185e2[_0x5a6a('0x48')]=_0x11dcd1;return _0x4185e2;});}})['then'](respondWithFilteredResult(_0x424b8d,_0x5acb2b))[_0x5a6a('0x39')](handleError(_0x424b8d,null));};exports['getHopperFinals']=function(_0x52f85e,_0x1642dd,_0x21c5ad){var _0x50c735={'raw':!![],'where':{}};var _0x4331fd={};var _0x4c5d48={'count':0x0,'rows':[]};return db[_0x5a6a('0x35')]['findOne']({'where':{'id':_0x52f85e['params']['id']}})['then'](handleEntityNotFound(_0x1642dd,null))[_0x5a6a('0x1c')](function(_0x159f4d){if(_0x159f4d){_0x4331fd['model']=_[_0x5a6a('0x3b')](db['CmHopperFinal'][_0x5a6a('0x20')]);_0x4331fd[_0x5a6a('0x21')]=_['keys'](_0x52f85e['query']);_0x4331fd[_0x5a6a('0x2d')]=_['intersection'](_0x4331fd[_0x5a6a('0x27')],_0x4331fd[_0x5a6a('0x21')]);_0x50c735['attributes']=_[_0x5a6a('0x24')](_0x4331fd[_0x5a6a('0x27')],qs[_0x5a6a('0x3c')](_0x52f85e['query'][_0x5a6a('0x3c')]));_0x50c735[_0x5a6a('0x25')]=_0x50c735[_0x5a6a('0x25')][_0x5a6a('0x26')]?_0x50c735[_0x5a6a('0x25')]:_0x4331fd[_0x5a6a('0x27')];if(!_0x52f85e[_0x5a6a('0x21')][_0x5a6a('0x28')](_0x5a6a('0x29'))){_0x50c735['limit']=qs[_0x5a6a('0x17')](_0x52f85e[_0x5a6a('0x21')][_0x5a6a('0x17')]);_0x50c735['offset']=qs[_0x5a6a('0x16')](_0x52f85e[_0x5a6a('0x21')][_0x5a6a('0x16')]);}_0x50c735[_0x5a6a('0x2a')]=qs[_0x5a6a('0x2b')](_0x52f85e['query']['sort']);_0x50c735[_0x5a6a('0x2c')]=qs[_0x5a6a('0x2d')](_[_0x5a6a('0x2e')](_0x52f85e[_0x5a6a('0x21')],_0x4331fd['filters']));_0x50c735[_0x5a6a('0x2c')][_0x5a6a('0x47')]=_0x159f4d['id'];if(_0x52f85e[_0x5a6a('0x21')][_0x5a6a('0x32')]){_0x50c735[_0x5a6a('0x2c')]=_[_0x5a6a('0x31')](_0x50c735[_0x5a6a('0x2c')],{'$or':_[_0x5a6a('0x33')](_0x50c735[_0x5a6a('0x25')],function(_0x29a319){var _0x722a09={};_0x722a09[_0x29a319]={'$like':'%'+_0x52f85e['query'][_0x5a6a('0x32')]+'%'};return _0x722a09;})});}_0x50c735=_['merge']({},_0x50c735,_0x52f85e[_0x5a6a('0x34')]);return db[_0x5a6a('0x4a')]['count']({'where':_0x50c735[_0x5a6a('0x2c')]})[_0x5a6a('0x1c')](function(_0x4b4007){_0x4c5d48[_0x5a6a('0x15')]=_0x4b4007;if(_0x52f85e[_0x5a6a('0x21')][_0x5a6a('0x36')]){_0x50c735['include']=[{'all':!![]}];}return db[_0x5a6a('0x4a')]['findAll'](_0x50c735);})[_0x5a6a('0x1c')](function(_0x1ba699){_0x4c5d48[_0x5a6a('0x48')]=_0x1ba699;return _0x4c5d48;});}})[_0x5a6a('0x1c')](respondWithFilteredResult(_0x1642dd,_0x50c735))[_0x5a6a('0x39')](handleError(_0x1642dd,null));};exports[_0x5a6a('0x4b')]=function(_0x12a624,_0x6116ad,_0x1721bb){var _0x4d4a82={'raw':!![],'where':{}};var _0x4684a7={};var _0x33cc8d={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x12a624[_0x5a6a('0x40')]['id']}})[_0x5a6a('0x1c')](handleEntityNotFound(_0x6116ad,null))[_0x5a6a('0x1c')](function(_0x263c9b){if(_0x263c9b){_0x4684a7[_0x5a6a('0x27')]=_[_0x5a6a('0x3b')](db['CmHopperBlack'][_0x5a6a('0x20')]);_0x4684a7['query']=_['keys'](_0x12a624[_0x5a6a('0x21')]);_0x4684a7[_0x5a6a('0x2d')]=_[_0x5a6a('0x24')](_0x4684a7[_0x5a6a('0x27')],_0x4684a7[_0x5a6a('0x21')]);_0x4d4a82[_0x5a6a('0x25')]=_[_0x5a6a('0x24')](_0x4684a7[_0x5a6a('0x27')],qs['fields'](_0x12a624[_0x5a6a('0x21')]['fields']));_0x4d4a82[_0x5a6a('0x25')]=_0x4d4a82['attributes'][_0x5a6a('0x26')]?_0x4d4a82['attributes']:_0x4684a7[_0x5a6a('0x27')];if(!_0x12a624[_0x5a6a('0x21')][_0x5a6a('0x28')]('nolimit')){_0x4d4a82['limit']=qs[_0x5a6a('0x17')](_0x12a624[_0x5a6a('0x21')][_0x5a6a('0x17')]);_0x4d4a82['offset']=qs['offset'](_0x12a624[_0x5a6a('0x21')][_0x5a6a('0x16')]);}_0x4d4a82[_0x5a6a('0x2a')]=qs[_0x5a6a('0x2b')](_0x12a624['query'][_0x5a6a('0x2b')]);_0x4d4a82[_0x5a6a('0x2c')]=qs[_0x5a6a('0x2d')](_[_0x5a6a('0x2e')](_0x12a624['query'],_0x4684a7[_0x5a6a('0x2d')]));_0x4d4a82[_0x5a6a('0x2c')][_0x5a6a('0x47')]=_0x263c9b['id'];if(_0x12a624[_0x5a6a('0x21')][_0x5a6a('0x32')]){_0x4d4a82[_0x5a6a('0x2c')]=_['merge'](_0x4d4a82[_0x5a6a('0x2c')],{'$or':_[_0x5a6a('0x33')](_0x4d4a82['attributes'],function(_0x1e9e91){var _0x5c0749={};_0x5c0749[_0x1e9e91]={'$like':'%'+_0x12a624[_0x5a6a('0x21')][_0x5a6a('0x32')]+'%'};return _0x5c0749;})});}_0x4d4a82=_[_0x5a6a('0x31')]({},_0x4d4a82,_0x12a624[_0x5a6a('0x34')]);return db[_0x5a6a('0x4c')][_0x5a6a('0x15')]({'where':_0x4d4a82['where']})[_0x5a6a('0x1c')](function(_0x57e217){_0x33cc8d[_0x5a6a('0x15')]=_0x57e217;if(_0x12a624[_0x5a6a('0x21')][_0x5a6a('0x36')]){_0x4d4a82[_0x5a6a('0x37')]=[{'all':!![]}];}return db[_0x5a6a('0x4c')]['findAll'](_0x4d4a82);})[_0x5a6a('0x1c')](function(_0x37f6ec){_0x33cc8d[_0x5a6a('0x48')]=_0x37f6ec;return _0x33cc8d;});}})[_0x5a6a('0x1c')](respondWithFilteredResult(_0x6116ad,_0x4d4a82))['catch'](handleError(_0x6116ad,null));};exports[_0x5a6a('0x4d')]=function(_0x1dee09,_0x57990c,_0x4349fd){var _0x501abd={};var _0x1008f9={};var _0x261030;var _0xdb2851;return db[_0x5a6a('0x35')][_0x5a6a('0x45')]({'where':{'id':_0x1dee09[_0x5a6a('0x40')]['id']}})['then'](handleEntityNotFound(_0x57990c,null))[_0x5a6a('0x1c')](function(_0x10faaa){if(_0x10faaa){_0x261030=_0x10faaa;_0x1008f9[_0x5a6a('0x27')]=_[_0x5a6a('0x3b')](db[_0x5a6a('0x4e')][_0x5a6a('0x20')]);_0x1008f9[_0x5a6a('0x21')]=_['keys'](_0x1dee09[_0x5a6a('0x21')]);_0x1008f9[_0x5a6a('0x2d')]=_[_0x5a6a('0x24')](_0x1008f9[_0x5a6a('0x27')],_0x1008f9[_0x5a6a('0x21')]);_0x501abd[_0x5a6a('0x25')]=_[_0x5a6a('0x24')](_0x1008f9[_0x5a6a('0x27')],qs['fields'](_0x1dee09[_0x5a6a('0x21')]['fields']));_0x501abd[_0x5a6a('0x25')]=_0x501abd[_0x5a6a('0x25')]['length']?_0x501abd[_0x5a6a('0x25')]:_0x1008f9[_0x5a6a('0x27')];_0x501abd[_0x5a6a('0x2a')]=qs['sort'](_0x1dee09[_0x5a6a('0x21')][_0x5a6a('0x2b')]);_0x501abd[_0x5a6a('0x2c')]=qs['filters'](_['pick'](_0x1dee09['query'],_0x1008f9[_0x5a6a('0x2d')]));if(_0x1dee09[_0x5a6a('0x21')][_0x5a6a('0x32')]){_0x501abd[_0x5a6a('0x2c')]=_[_0x5a6a('0x31')](_0x501abd[_0x5a6a('0x2c')],{'$or':_['map'](_0x501abd[_0x5a6a('0x25')],function(_0x526bf3){var _0x11c61a={};_0x11c61a[_0x526bf3]={'$like':'%'+_0x1dee09[_0x5a6a('0x21')][_0x5a6a('0x32')]+'%'};return _0x11c61a;})});}_0x501abd=_[_0x5a6a('0x31')]({},_0x501abd,_0x1dee09['options']);return _0x261030['getLists'](_0x501abd);}})[_0x5a6a('0x1c')](function(_0x1b9eeb){if(_0x1b9eeb){_0xdb2851=_0x1b9eeb[_0x5a6a('0x26')];if(!_0x1dee09['query'][_0x5a6a('0x28')]('nolimit')){_0x501abd['limit']=qs[_0x5a6a('0x17')](_0x1dee09[_0x5a6a('0x21')][_0x5a6a('0x17')]);_0x501abd[_0x5a6a('0x16')]=qs['offset'](_0x1dee09['query'][_0x5a6a('0x16')]);}return _0x261030['getLists'](_0x501abd);}})['then'](function(_0xb4f162){if(_0xb4f162){return _0xb4f162?{'count':_0xdb2851,'rows':_0xb4f162}:null;}})[_0x5a6a('0x1c')](respondWithResult(_0x57990c,null))[_0x5a6a('0x39')](handleError(_0x57990c,null));};exports[_0x5a6a('0x4f')]=function(_0x51ac83,_0x1247a1,_0x16bf4b){var _0x309c77,_0x21da38;return db[_0x5a6a('0x35')][_0x5a6a('0x3d')]({'where':{'id':_0x51ac83['params']['id']}})[_0x5a6a('0x1c')](handleEntityNotFound(_0x1247a1,null))['then'](function(_0x469694){if(_0x469694){_0x21da38=_0x469694;return _0x469694[_0x5a6a('0x4f')](_0x51ac83[_0x5a6a('0x3f')][_0x5a6a('0x50')],_['omit'](_0x51ac83[_0x5a6a('0x3f')],[_0x5a6a('0x50'),'id'])||{});}return null;})[_0x5a6a('0x51')](function(_0x1b89c1){var _0x3a6b1b;_0x309c77=_0x1b89c1||[];var _0x46106d=[];if(_0x1b89c1){for(var _0x2f2ca7=0x0;_0x2f2ca7<_0x1b89c1[_0x5a6a('0x26')];_0x2f2ca7+=0x1){var _0x143ca2=_0x1b89c1[_0x2f2ca7]['get']({'plain':!![]});_0x21da38['dialCheckDuplicateType']=_0x51ac83[_0x5a6a('0x3f')][_0x5a6a('0x52')]?_0x51ac83['body'][_0x5a6a('0x52')]:_0x21da38[_0x5a6a('0x52')];switch(_0x21da38[_0x5a6a('0x52')]){case'always':_0x3a6b1b=squel[_0x5a6a('0x53')]()[_0x5a6a('0x54')](_0x5a6a('0x55'))[_0x5a6a('0x56')]([_0x5a6a('0x57'),'scheduledAt',_0x5a6a('0x58'),_0x5a6a('0x59'),'CampaignId',_0x5a6a('0x43'),'updatedAt'],squel[_0x5a6a('0x5a')]()[_0x5a6a('0x5b')](_0x5a6a('0x57'),_0x5a6a('0x57'))[_0x5a6a('0x5b')](_0x5a6a('0x5c'),_0x5a6a('0x5d'))[_0x5a6a('0x5b')]('id',_0x5a6a('0x58'))[_0x5a6a('0x5b')](_0x143ca2['CmListId'][_0x5a6a('0x5e')](),_0x5a6a('0x59'))[_0x5a6a('0x5b')](_0x51ac83[_0x5a6a('0x40')]['id'][_0x5a6a('0x5e')](),_0x5a6a('0x47'))['field']('NOW()',_0x5a6a('0x43'))[_0x5a6a('0x5b')](_0x5a6a('0x5c'),_0x5a6a('0x42'))[_0x5a6a('0x5f')](_0x5a6a('0x60'))['where'](_0x5a6a('0x61'))[_0x5a6a('0x2c')]('ListId\x20=\x20?',_0x143ca2[_0x5a6a('0x62')][_0x5a6a('0x5e')]())['where'](_0x5a6a('0x63'))[_0x5a6a('0x2c')](_0x5a6a('0x64'),squel[_0x5a6a('0x5a')]()[_0x5a6a('0x5b')](_0x5a6a('0x65'))[_0x5a6a('0x5f')](_0x5a6a('0x66'))[_0x5a6a('0x2c')](_0x5a6a('0x67'),_0x51ac83['params']['id']['toString']()))['where'](_0x5a6a('0x64'),squel[_0x5a6a('0x5a')]()[_0x5a6a('0x5b')]('phone')[_0x5a6a('0x5f')](_0x5a6a('0x55'))['where']('CampaignId\x20=\x20?',_0x51ac83[_0x5a6a('0x40')]['id'][_0x5a6a('0x5e')]())))[_0x5a6a('0x5e')]();break;case'onlyIfOpen':_0x3a6b1b=squel[_0x5a6a('0x53')]()[_0x5a6a('0x54')]('cm_hopper')[_0x5a6a('0x56')]([_0x5a6a('0x57'),_0x5a6a('0x5d'),_0x5a6a('0x58'),_0x5a6a('0x59'),_0x5a6a('0x47'),_0x5a6a('0x43'),_0x5a6a('0x42')],squel[_0x5a6a('0x5a')]()[_0x5a6a('0x5b')]('phone',_0x5a6a('0x57'))[_0x5a6a('0x5b')](_0x5a6a('0x5c'),_0x5a6a('0x5d'))[_0x5a6a('0x5b')]('id',_0x5a6a('0x58'))[_0x5a6a('0x5b')](_0x143ca2[_0x5a6a('0x62')][_0x5a6a('0x5e')](),'ListId')[_0x5a6a('0x5b')](_0x51ac83[_0x5a6a('0x40')]['id'][_0x5a6a('0x5e')](),'CampaignId')[_0x5a6a('0x5b')](_0x5a6a('0x5c'),_0x5a6a('0x43'))[_0x5a6a('0x5b')](_0x5a6a('0x5c'),_0x5a6a('0x42'))[_0x5a6a('0x5f')](_0x5a6a('0x60'))[_0x5a6a('0x2c')]('deletedAt\x20IS\x20NULL')[_0x5a6a('0x2c')](_0x5a6a('0x68'),_0x143ca2[_0x5a6a('0x62')][_0x5a6a('0x5e')]())[_0x5a6a('0x2c')](_0x5a6a('0x63'))[_0x5a6a('0x2c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x5a6a('0x5a')]()[_0x5a6a('0x5b')](_0x5a6a('0x57'))['from'](_0x5a6a('0x55'))['where'](_0x5a6a('0x67'),_0x51ac83[_0x5a6a('0x40')]['id'][_0x5a6a('0x5e')]())))['toString']();break;default:_0x3a6b1b=squel[_0x5a6a('0x53')]()[_0x5a6a('0x54')](_0x5a6a('0x55'))[_0x5a6a('0x56')](['phone',_0x5a6a('0x5d'),_0x5a6a('0x58'),_0x5a6a('0x59'),_0x5a6a('0x47'),_0x5a6a('0x43'),_0x5a6a('0x42')],squel[_0x5a6a('0x5a')]()['field'](_0x5a6a('0x57'),_0x5a6a('0x57'))[_0x5a6a('0x5b')](_0x5a6a('0x5c'),_0x5a6a('0x5d'))[_0x5a6a('0x5b')]('id',_0x5a6a('0x58'))[_0x5a6a('0x5b')](_0x143ca2[_0x5a6a('0x62')]['toString'](),_0x5a6a('0x59'))[_0x5a6a('0x5b')](_0x51ac83['params']['id'][_0x5a6a('0x5e')](),'CampaignId')[_0x5a6a('0x5b')]('NOW()',_0x5a6a('0x43'))[_0x5a6a('0x5b')](_0x5a6a('0x5c'),_0x5a6a('0x42'))['from'](_0x5a6a('0x60'))[_0x5a6a('0x2c')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x143ca2[_0x5a6a('0x62')][_0x5a6a('0x5e')]())['where'](_0x5a6a('0x63')))[_0x5a6a('0x5e')]();}_0x46106d[_0x5a6a('0x69')](db[_0x5a6a('0x6a')][_0x5a6a('0x21')](_0x3a6b1b));}return BPromise[_0x5a6a('0x6b')](_0x46106d);}})[_0x5a6a('0x1c')](function(){return _0x309c77;})[_0x5a6a('0x1c')](respondWithResult(_0x1247a1,null))[_0x5a6a('0x39')](handleError(_0x1247a1,null));};exports[_0x5a6a('0x6c')]=function(_0x5be4c9,_0x9ff444,_0x12c0e5){var _0x10bb64;return db[_0x5a6a('0x35')][_0x5a6a('0x3d')]({'where':{'id':_0x5be4c9[_0x5a6a('0x40')]['id']}})[_0x5a6a('0x1c')](handleEntityNotFound(_0x9ff444,null))[_0x5a6a('0x1c')](function(_0x3e28ec){if(_0x3e28ec){return _0x3e28ec[_0x5a6a('0x6c')](_0x5be4c9[_0x5a6a('0x21')]['ids']);}})['then'](function(_0x2b7db3){if(_0x2b7db3){_0x10bb64=_0x2b7db3;return db[_0x5a6a('0x46')][_0x5a6a('0x1d')]({'where':{'ListId':_0x5be4c9[_0x5a6a('0x21')][_0x5a6a('0x50')],'CampaignId':_0x5be4c9['params']['id']}})[_0x5a6a('0x1c')](function(){return _0x10bb64;});}})[_0x5a6a('0x1c')](respondWithStatusCode(_0x9ff444,null))['catch'](handleError(_0x9ff444,null));};exports[_0x5a6a('0x6d')]=function(_0x26e43e,_0x2f3e35,_0x2b9121){var _0x9f115b={'raw':!![],'where':{}};var _0x516a4e={};var _0x259b7a={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x26e43e['params']['id']}})[_0x5a6a('0x1c')](handleEntityNotFound(_0x2f3e35,null))[_0x5a6a('0x1c')](function(_0x59ae72){if(_0x59ae72){_0x516a4e[_0x5a6a('0x27')]=_[_0x5a6a('0x3b')](db[_0x5a6a('0x4e')][_0x5a6a('0x20')]);_0x516a4e[_0x5a6a('0x21')]=_[_0x5a6a('0x3b')](_0x26e43e['query']);_0x516a4e[_0x5a6a('0x2d')]=_[_0x5a6a('0x24')](_0x516a4e['model'],_0x516a4e[_0x5a6a('0x21')]);_0x9f115b[_0x5a6a('0x25')]=_[_0x5a6a('0x24')](_0x516a4e[_0x5a6a('0x27')],qs[_0x5a6a('0x3c')](_0x26e43e[_0x5a6a('0x21')]['fields']));_0x9f115b['attributes']=_0x9f115b['attributes'][_0x5a6a('0x26')]?_0x9f115b[_0x5a6a('0x25')]:_0x516a4e['model'];if(!_0x26e43e[_0x5a6a('0x21')]['hasOwnProperty'](_0x5a6a('0x29'))){_0x9f115b[_0x5a6a('0x17')]=qs['limit'](_0x26e43e[_0x5a6a('0x21')]['limit']);_0x9f115b[_0x5a6a('0x16')]=qs[_0x5a6a('0x16')](_0x26e43e[_0x5a6a('0x21')]['offset']);}_0x9f115b['order']=qs['sort'](_0x26e43e[_0x5a6a('0x21')]['sort']);_0x9f115b[_0x5a6a('0x2c')]=qs['filters'](_['pick'](_0x26e43e[_0x5a6a('0x21')],_0x516a4e['filters']));_0x9f115b[_0x5a6a('0x2c')][_0x5a6a('0x47')]=_0x59ae72['id'];if(_0x26e43e[_0x5a6a('0x21')][_0x5a6a('0x32')]){_0x9f115b[_0x5a6a('0x2c')]=_[_0x5a6a('0x31')](_0x9f115b[_0x5a6a('0x2c')],{'$or':_[_0x5a6a('0x33')](_0x9f115b[_0x5a6a('0x25')],function(_0x41e735){var _0x19aea0={};_0x19aea0[_0x41e735]={'$like':'%'+_0x26e43e[_0x5a6a('0x21')][_0x5a6a('0x32')]+'%'};return _0x19aea0;})});}_0x9f115b=_[_0x5a6a('0x31')]({},_0x9f115b,_0x26e43e['options']);return db[_0x5a6a('0x4e')][_0x5a6a('0x15')]({'where':_0x9f115b[_0x5a6a('0x2c')]})[_0x5a6a('0x1c')](function(_0x1586cc){_0x259b7a[_0x5a6a('0x15')]=_0x1586cc;if(_0x26e43e['query'][_0x5a6a('0x36')]){_0x9f115b[_0x5a6a('0x37')]=[{'all':!![]}];}return db[_0x5a6a('0x4e')][_0x5a6a('0x38')](_0x9f115b);})['then'](function(_0x4ece2b){_0x259b7a[_0x5a6a('0x48')]=_0x4ece2b;return _0x259b7a;});}})[_0x5a6a('0x1c')](respondWithFilteredResult(_0x2f3e35,_0x9f115b))[_0x5a6a('0x39')](handleError(_0x2f3e35,null));};exports[_0x5a6a('0x6e')]=function(_0x58ccbe,_0x35f697,_0x2566e9){var _0x149e42,_0x142e30;return db[_0x5a6a('0x35')][_0x5a6a('0x3d')]({'where':{'id':_0x58ccbe['params']['id']}})['then'](handleEntityNotFound(_0x35f697,null))[_0x5a6a('0x1c')](function(_0x32d6a1){if(_0x32d6a1){_0x142e30=_0x32d6a1;return _0x32d6a1[_0x5a6a('0x6e')](_0x58ccbe['body'][_0x5a6a('0x50')],_[_0x5a6a('0x41')](_0x58ccbe[_0x5a6a('0x3f')],['ids','id'])||{});}return null;})[_0x5a6a('0x51')](function(_0x397128){var _0x437e9f;_0x149e42=_0x397128||[];var _0x12c638=[];if(_0x397128){for(var _0x1484ef=0x0;_0x1484ef<_0x397128[_0x5a6a('0x26')];_0x1484ef+=0x1){var _0x294b0c=_0x397128[_0x1484ef][_0x5a6a('0x6f')]({'plain':!![]});_0x437e9f=squel[_0x5a6a('0x53')]()['into'](_0x5a6a('0x70'))['fromQuery']([_0x5a6a('0x57'),_0x5a6a('0x58'),_0x5a6a('0x59'),_0x5a6a('0x47'),'createdAt',_0x5a6a('0x42')],squel['select']()[_0x5a6a('0x5b')](_0x5a6a('0x57'),_0x5a6a('0x57'))['field']('id',_0x5a6a('0x58'))[_0x5a6a('0x5b')](_0x294b0c['CmListId'][_0x5a6a('0x5e')](),_0x5a6a('0x59'))[_0x5a6a('0x5b')](_0x58ccbe[_0x5a6a('0x40')]['id']['toString'](),'CampaignId')[_0x5a6a('0x5b')](_0x5a6a('0x5c'),_0x5a6a('0x43'))[_0x5a6a('0x5b')]('NOW()',_0x5a6a('0x42'))[_0x5a6a('0x5f')](_0x5a6a('0x60'))[_0x5a6a('0x2c')](_0x5a6a('0x61'))[_0x5a6a('0x2c')](_0x5a6a('0x68'),_0x294b0c[_0x5a6a('0x62')]['toString']())[_0x5a6a('0x2c')](_0x5a6a('0x63')))[_0x5a6a('0x5e')]();_0x12c638[_0x5a6a('0x69')](db['sequelize'][_0x5a6a('0x21')](_0x437e9f));}return BPromise['all'](_0x12c638);}})[_0x5a6a('0x1c')](function(){return _0x149e42;})[_0x5a6a('0x1c')](respondWithResult(_0x35f697,null))[_0x5a6a('0x39')](handleError(_0x35f697,null));};exports[_0x5a6a('0x71')]=function(_0x57a1b5,_0x5cee4c,_0x48f04c){var _0x415bfd;return db[_0x5a6a('0x35')][_0x5a6a('0x3d')]({'where':{'id':_0x57a1b5[_0x5a6a('0x40')]['id']}})[_0x5a6a('0x1c')](handleEntityNotFound(_0x5cee4c,null))[_0x5a6a('0x1c')](function(_0x4b3943){if(_0x4b3943){return _0x4b3943[_0x5a6a('0x71')](_0x57a1b5['query'][_0x5a6a('0x50')]);}})[_0x5a6a('0x1c')](function(_0x342e62){if(_0x342e62){_0x415bfd=_0x342e62;return db[_0x5a6a('0x4c')]['destroy']({'where':{'ListId':_0x57a1b5[_0x5a6a('0x21')][_0x5a6a('0x50')],'CampaignId':_0x57a1b5[_0x5a6a('0x40')]['id']}})[_0x5a6a('0x1c')](function(){return _0x415bfd;});}})[_0x5a6a('0x1c')](respondWithStatusCode(_0x5cee4c,null))[_0x5a6a('0x39')](handleError(_0x5cee4c,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index f8b1373..85a9501 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 _0xf635=['lodash','util','../../config/logger','moment','bluebird','request-promise','exports','define','Campaign','campaigns'];(function(_0xacf370,_0x3bd96f){var _0x456f67=function(_0x2de878){while(--_0x2de878){_0xacf370['push'](_0xacf370['shift']());}};_0x456f67(++_0x3bd96f);}(_0xf635,0xdc));var _0x5f63=function(_0x402718,_0x22529c){_0x402718=_0x402718-0x0;var _0x3e6afb=_0xf635[_0x402718];return _0x3e6afb;};'use strict';var _=require(_0x5f63('0x0'));var util=require(_0x5f63('0x1'));var logger=require(_0x5f63('0x2'))('api');var moment=require(_0x5f63('0x3'));var BPromise=require(_0x5f63('0x4'));var rp=require(_0x5f63('0x5'));var attributes=require('./campaign.attributes');module[_0x5f63('0x6')]=function(_0x1ed505,_0x4663be){return _0x1ed505[_0x5f63('0x7')](_0x5f63('0x8'),attributes,{'tableName':_0x5f63('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc5e=['../../config/logger','api','moment','bluebird','request-promise','./campaign.attributes','define','Campaign','campaigns','lodash'];(function(_0x99facc,_0x548cd6){var _0xd39ed0=function(_0x207e47){while(--_0x207e47){_0x99facc['push'](_0x99facc['shift']());}};_0xd39ed0(++_0x548cd6);}(_0xcc5e,0x12b));var _0xecc5=function(_0x5508db,_0x22ecbe){_0x5508db=_0x5508db-0x0;var _0x54ce94=_0xcc5e[_0x5508db];return _0x54ce94;};'use strict';var _=require(_0xecc5('0x0'));var util=require('util');var logger=require(_0xecc5('0x1'))(_0xecc5('0x2'));var moment=require(_0xecc5('0x3'));var BPromise=require(_0xecc5('0x4'));var rp=require(_0xecc5('0x5'));var attributes=require(_0xecc5('0x6'));module['exports']=function(_0x1a6f56,_0x22b235){return _0x1a6f56[_0xecc5('0x7')](_0xecc5('0x8'),attributes,{'tableName':_0xecc5('0x9'),'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 362cbb6..dbebb7c 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 _0x6b46=['raw','attributes','include','map','model','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetCampaign','Campaign','options'];(function(_0x5d5edb,_0x3d416f){var _0x34324c=function(_0x52af0d){while(--_0x52af0d){_0x5d5edb['push'](_0x5d5edb['shift']());}};_0x34324c(++_0x3d416f);}(_0x6b46,0xd0));var _0x66b4=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6b46[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0x66b4('0x0'));var moment=require(_0x66b4('0x1'));var BPromise=require(_0x66b4('0x2'));var rs=require(_0x66b4('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x66b4('0x4'));var logger=require(_0x66b4('0x5'))(_0x66b4('0x6'));var config=require(_0x66b4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x66b4('0x8')][_0x66b4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4be2b1,_0x2f1411,_0x4b695b){return new BPromise(function(_0x464078,_0x24aa73){return client[_0x66b4('0xa')](_0x4be2b1,_0x4b695b)[_0x66b4('0xb')](function(_0x2848c4){logger[_0x66b4('0xc')](_0x66b4('0xd'),_0x2f1411,_0x66b4('0xe'));logger[_0x66b4('0xf')](_0x66b4('0x10'),_0x2f1411,_0x66b4('0xe'),JSON[_0x66b4('0x11')](_0x2848c4));if(_0x2848c4['error']){if(_0x2848c4['error']['code']===0x1f4){logger[_0x66b4('0x12')](_0x66b4('0xd'),_0x2f1411,_0x2848c4[_0x66b4('0x12')][_0x66b4('0x13')]);return _0x24aa73(_0x2848c4['error']['message']);}logger[_0x66b4('0x12')]('Campaign,\x20%s,\x20%s',_0x2f1411,_0x2848c4[_0x66b4('0x12')]['message']);return _0x464078(_0x2848c4[_0x66b4('0x12')][_0x66b4('0x13')]);}else{logger[_0x66b4('0xc')](_0x66b4('0xd'),_0x2f1411,_0x66b4('0xe'));_0x464078(_0x2848c4['result'][_0x66b4('0x13')]);}})[_0x66b4('0x14')](function(_0x2fc444){logger[_0x66b4('0x12')](_0x66b4('0xd'),_0x2f1411,_0x2fc444);_0x24aa73(_0x2fc444);});});}exports[_0x66b4('0x15')]=function(_0x5ee49e){var _0x4b6210=this;return new Promise(function(_0x324443,_0x55b3da){return db[_0x66b4('0x16')]['findAll']({'raw':_0x5ee49e['options']?_0x5ee49e[_0x66b4('0x17')][_0x66b4('0x18')]===undefined?!![]:![]:!![],'where':_0x5ee49e[_0x66b4('0x17')]?_0x5ee49e[_0x66b4('0x17')]['where']||null:null,'attributes':_0x5ee49e[_0x66b4('0x17')]?_0x5ee49e[_0x66b4('0x17')][_0x66b4('0x19')]||null:null,'limit':_0x5ee49e[_0x66b4('0x17')]?_0x5ee49e[_0x66b4('0x17')]['limit']||null:null,'include':_0x5ee49e[_0x66b4('0x17')]?_0x5ee49e[_0x66b4('0x17')][_0x66b4('0x1a')]?_['map'](_0x5ee49e[_0x66b4('0x17')][_0x66b4('0x1a')],function(_0x34e28c){return{'model':db[_0x34e28c['model']],'as':_0x34e28c['as'],'attributes':_0x34e28c[_0x66b4('0x19')],'include':_0x34e28c['include']?_[_0x66b4('0x1b')](_0x34e28c[_0x66b4('0x1a')],function(_0x74f831){return{'model':db[_0x74f831['model']],'as':_0x74f831['as'],'attributes':_0x74f831[_0x66b4('0x19')],'include':_0x74f831[_0x66b4('0x1a')]?_[_0x66b4('0x1b')](_0x74f831[_0x66b4('0x1a')],function(_0x4e388b){return{'model':db[_0x4e388b[_0x66b4('0x1c')]],'as':_0x4e388b['as'],'attributes':_0x4e388b[_0x66b4('0x19')]};}):[]};}):[]};}):[]:[]})[_0x66b4('0xb')](function(_0x1cbc48){logger[_0x66b4('0xc')](_0x66b4('0x15'),_0x5ee49e);logger['debug'](_0x66b4('0x15'),_0x5ee49e,JSON[_0x66b4('0x11')](_0x1cbc48));_0x324443(_0x1cbc48);})['catch'](function(_0x2093ba){logger[_0x66b4('0x12')](_0x66b4('0x15'),_0x2093ba[_0x66b4('0x13')],_0x5ee49e);_0x55b3da(_0x4b6210[_0x66b4('0x12')](0x1f4,_0x2093ba['message']));});});}; \ No newline at end of file +var _0x0799=['include','map','model','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCampaign','findAll','options','raw','where'];(function(_0x38f6c8,_0x3044f5){var _0x4464f0=function(_0x488f89){while(--_0x488f89){_0x38f6c8['push'](_0x38f6c8['shift']());}};_0x4464f0(++_0x3044f5);}(_0x0799,0x124));var _0x9079=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0799[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x9079('0x0'));var util=require(_0x9079('0x1'));var moment=require(_0x9079('0x2'));var BPromise=require(_0x9079('0x3'));var rs=require(_0x9079('0x4'));var fs=require('fs');var db=require(_0x9079('0x5'))['db'];var utils=require(_0x9079('0x6'));var logger=require(_0x9079('0x7'))(_0x9079('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9079('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31292f,_0x19fb79,_0x120712){return new BPromise(function(_0x29d2af,_0x19ffc2){return client[_0x9079('0xa')](_0x31292f,_0x120712)[_0x9079('0xb')](function(_0x204fea){logger[_0x9079('0xc')](_0x9079('0xd'),_0x19fb79,_0x9079('0xe'));logger[_0x9079('0xf')](_0x9079('0x10'),_0x19fb79,_0x9079('0xe'),JSON[_0x9079('0x11')](_0x204fea));if(_0x204fea['error']){if(_0x204fea[_0x9079('0x12')][_0x9079('0x13')]===0x1f4){logger['error'](_0x9079('0xd'),_0x19fb79,_0x204fea[_0x9079('0x12')][_0x9079('0x14')]);return _0x19ffc2(_0x204fea[_0x9079('0x12')][_0x9079('0x14')]);}logger[_0x9079('0x12')](_0x9079('0xd'),_0x19fb79,_0x204fea[_0x9079('0x12')][_0x9079('0x14')]);return _0x29d2af(_0x204fea[_0x9079('0x12')][_0x9079('0x14')]);}else{logger[_0x9079('0xc')]('Campaign,\x20%s,\x20%s',_0x19fb79,_0x9079('0xe'));_0x29d2af(_0x204fea[_0x9079('0x15')][_0x9079('0x14')]);}})[_0x9079('0x16')](function(_0x246e9a){logger[_0x9079('0x12')](_0x9079('0xd'),_0x19fb79,_0x246e9a);_0x19ffc2(_0x246e9a);});});}exports[_0x9079('0x17')]=function(_0x45dc18){var _0x1310b=this;return new Promise(function(_0x2c6750,_0x506ef5){return db['Campaign'][_0x9079('0x18')]({'raw':_0x45dc18['options']?_0x45dc18[_0x9079('0x19')][_0x9079('0x1a')]===undefined?!![]:![]:!![],'where':_0x45dc18[_0x9079('0x19')]?_0x45dc18[_0x9079('0x19')][_0x9079('0x1b')]||null:null,'attributes':_0x45dc18[_0x9079('0x19')]?_0x45dc18[_0x9079('0x19')]['attributes']||null:null,'limit':_0x45dc18['options']?_0x45dc18[_0x9079('0x19')]['limit']||null:null,'include':_0x45dc18[_0x9079('0x19')]?_0x45dc18['options'][_0x9079('0x1c')]?_[_0x9079('0x1d')](_0x45dc18[_0x9079('0x19')][_0x9079('0x1c')],function(_0x39ec5d){return{'model':db[_0x39ec5d[_0x9079('0x1e')]],'as':_0x39ec5d['as'],'attributes':_0x39ec5d[_0x9079('0x1f')],'include':_0x39ec5d[_0x9079('0x1c')]?_[_0x9079('0x1d')](_0x39ec5d[_0x9079('0x1c')],function(_0x4af3a1){return{'model':db[_0x4af3a1['model']],'as':_0x4af3a1['as'],'attributes':_0x4af3a1['attributes'],'include':_0x4af3a1['include']?_[_0x9079('0x1d')](_0x4af3a1[_0x9079('0x1c')],function(_0x21be4b){return{'model':db[_0x21be4b['model']],'as':_0x21be4b['as'],'attributes':_0x21be4b[_0x9079('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9b7967){logger[_0x9079('0xc')]('GetCampaign',_0x45dc18);logger[_0x9079('0xf')](_0x9079('0x17'),_0x45dc18,JSON[_0x9079('0x11')](_0x9b7967));_0x2c6750(_0x9b7967);})[_0x9079('0x16')](function(_0x273f00){logger['error'](_0x9079('0x17'),_0x273f00['message'],_0x45dc18);_0x506ef5(_0x1310b['error'](0x1f4,_0x273f00['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 84b1339..cca2063 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 _0x9d0d=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','put','update','destroy','delete','removeBlackLists','exports'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x9d0d,0xe7));var _0xd9d0=function(_0x53d7c0,_0xd0b7b8){_0x53d7c0=_0x53d7c0-0x0;var _0x322a0e=_0x9d0d[_0x53d7c0];return _0x322a0e;};'use strict';var multer=require(_0xd9d0('0x0'));var util=require('util');var path=require(_0xd9d0('0x1'));var express=require(_0xd9d0('0x2'));var router=express[_0xd9d0('0x3')]();var auth=require(_0xd9d0('0x4'));var interaction=require(_0xd9d0('0x5'));var config=require(_0xd9d0('0x6'));var controller=require(_0xd9d0('0x7'));router[_0xd9d0('0x8')]('/',auth[_0xd9d0('0x9')](),controller[_0xd9d0('0xa')]);router[_0xd9d0('0x8')](_0xd9d0('0xb'),auth[_0xd9d0('0x9')](),controller['show']);router['get'](_0xd9d0('0xc'),auth[_0xd9d0('0x9')](),controller[_0xd9d0('0xd')]);router[_0xd9d0('0x8')](_0xd9d0('0xe'),auth[_0xd9d0('0x9')](),controller['getHopperHistories']);router['get']('/:id/hopper_finals',auth[_0xd9d0('0x9')](),controller['getHopperFinals']);router[_0xd9d0('0x8')](_0xd9d0('0xf'),auth[_0xd9d0('0x9')](),controller[_0xd9d0('0x10')]);router[_0xd9d0('0x8')](_0xd9d0('0x11'),auth[_0xd9d0('0x9')](),controller[_0xd9d0('0x12')]);router[_0xd9d0('0x8')](_0xd9d0('0x13'),auth[_0xd9d0('0x9')](),controller[_0xd9d0('0x14')]);router[_0xd9d0('0x15')]('/',auth[_0xd9d0('0x9')](),controller[_0xd9d0('0x16')]);router[_0xd9d0('0x15')](_0xd9d0('0x17'),auth['isAuthenticated'](),controller[_0xd9d0('0x18')]);router[_0xd9d0('0x15')](_0xd9d0('0x11'),auth[_0xd9d0('0x9')](),controller[_0xd9d0('0x19')]);router['post']('/:id/blacklists',auth[_0xd9d0('0x9')](),controller[_0xd9d0('0x1a')]);router[_0xd9d0('0x1b')](_0xd9d0('0xb'),auth[_0xd9d0('0x9')](),controller[_0xd9d0('0x1c')]);router['delete'](_0xd9d0('0xb'),auth[_0xd9d0('0x9')](),controller[_0xd9d0('0x1d')]);router[_0xd9d0('0x1e')](_0xd9d0('0x11'),auth[_0xd9d0('0x9')](),controller['removeLists']);router['delete'](_0xd9d0('0x13'),auth[_0xd9d0('0x9')](),controller[_0xd9d0('0x1f')]);module[_0xd9d0('0x20')]=router; \ No newline at end of file +var _0xb6aa=['../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','put','update','delete','destroy','removeBlackLists','exports','path','express','Router'];(function(_0x178802,_0x4f3779){var _0x4d62c0=function(_0x277f50){while(--_0x277f50){_0x178802['push'](_0x178802['shift']());}};_0x4d62c0(++_0x4f3779);}(_0xb6aa,0x10b));var _0xab6a=function(_0x2034cb,_0x543c6b){_0x2034cb=_0x2034cb-0x0;var _0x3d6caa=_0xb6aa[_0x2034cb];return _0x3d6caa;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xab6a('0x0'));var express=require(_0xab6a('0x1'));var router=express[_0xab6a('0x2')]();var auth=require(_0xab6a('0x3'));var interaction=require(_0xab6a('0x4'));var config=require(_0xab6a('0x5'));var controller=require(_0xab6a('0x6'));router[_0xab6a('0x7')]('/',auth['isAuthenticated'](),controller[_0xab6a('0x8')]);router['get'](_0xab6a('0x9'),auth[_0xab6a('0xa')](),controller['show']);router[_0xab6a('0x7')](_0xab6a('0xb'),auth['isAuthenticated'](),controller['getHoppers']);router['get'](_0xab6a('0xc'),auth[_0xab6a('0xa')](),controller[_0xab6a('0xd')]);router['get'](_0xab6a('0xe'),auth[_0xab6a('0xa')](),controller[_0xab6a('0xf')]);router[_0xab6a('0x7')](_0xab6a('0x10'),auth[_0xab6a('0xa')](),controller['getHopperBlacks']);router[_0xab6a('0x7')](_0xab6a('0x11'),auth['isAuthenticated'](),controller['getLists']);router[_0xab6a('0x7')](_0xab6a('0x12'),auth[_0xab6a('0xa')](),controller[_0xab6a('0x13')]);router[_0xab6a('0x14')]('/',auth[_0xab6a('0xa')](),controller[_0xab6a('0x15')]);router[_0xab6a('0x14')](_0xab6a('0x16'),auth['isAuthenticated'](),controller[_0xab6a('0x17')]);router[_0xab6a('0x14')](_0xab6a('0x11'),auth[_0xab6a('0xa')](),controller['addLists']);router[_0xab6a('0x14')](_0xab6a('0x12'),auth[_0xab6a('0xa')](),controller['addBlackLists']);router[_0xab6a('0x18')](_0xab6a('0x9'),auth[_0xab6a('0xa')](),controller[_0xab6a('0x19')]);router[_0xab6a('0x1a')](_0xab6a('0x9'),auth[_0xab6a('0xa')](),controller[_0xab6a('0x1b')]);router[_0xab6a('0x1a')](_0xab6a('0x11'),auth['isAuthenticated'](),controller['removeLists']);router[_0xab6a('0x1a')](_0xab6a('0x12'),auth[_0xab6a('0xa')](),controller[_0xab6a('0x1c')]);module[_0xab6a('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 99030b1..41b1fb0 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 _0x4c60=['TEXT','sequelize','exports','STRING'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x4c60,0xc1));var _0x04c6=function(_0x765aa4,_0x5f49a2){_0x765aa4=_0x765aa4-0x0;var _0x10b33f=_0x4c60[_0x765aa4];return _0x10b33f;};'use strict';var Sequelize=require(_0x04c6('0x0'));module[_0x04c6('0x1')]={'key':{'type':Sequelize[_0x04c6('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x04c6('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1cb9=['TEXT','sequelize','STRING'];(function(_0x413851,_0x147d6d){var _0x3be041=function(_0x1b7bb3){while(--_0x1b7bb3){_0x413851['push'](_0x413851['shift']());}};_0x3be041(++_0x147d6d);}(_0x1cb9,0x14e));var _0x91cb=function(_0x255ae1,_0x26dae2){_0x255ae1=_0x255ae1-0x0;var _0x2f4b12=_0x1cb9[_0x255ae1];return _0x2f4b12;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'key':{'type':Sequelize[_0x91cb('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x91cb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x91cb('0x1')]}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 34297d1..d28ad83 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 _0xcd74=['keys','dateStart','query','dateEnd','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','filter','map','merge','includeAll','findAll','catch','show','rawAttributes','length','include','options','body','find','params','destroy','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','fast-json-patch','moment','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','count','offset','json','reject','update','then','end','sendStatus','error','name','send','index','CannedAnswer'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xcd74,0xad));var _0x4cd7=function(_0x3293de,_0x29c856){_0x3293de=_0x3293de-0x0;var _0x465384=_0xcd74[_0x3293de];return _0x465384;};'use strict';var jsonpatch=require(_0x4cd7('0x0'));var rp=require('request-promise');var moment=require(_0x4cd7('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4cd7('0x2'));var ejs=require(_0x4cd7('0x3'));var fs=require('fs');var _=require(_0x4cd7('0x4'));var squel=require(_0x4cd7('0x5'));var crypto=require(_0x4cd7('0x6'));var jsforce=require('jsforce');var deskjs=require(_0x4cd7('0x7'));var toCsv=require(_0x4cd7('0x2'));var querystring=require(_0x4cd7('0x8'));var Papa=require('papaparse');var qs=require(_0x4cd7('0x9'));var logger=require(_0x4cd7('0xa'))(_0x4cd7('0xb'));var utils=require('../../config/utils');var config=require(_0x4cd7('0xc'));var db=require(_0x4cd7('0xd'))['db'];function respondWithStatusCode(_0x644e17,_0x5af493){_0x5af493=_0x5af493||0xcc;return function(_0x3fba60){if(_0x3fba60){return _0x644e17['sendStatus'](_0x5af493);}return _0x644e17['status'](_0x5af493)['end']();};}function respondWithResult(_0x4fa393,_0x32ab04){_0x32ab04=_0x32ab04||0xc8;return function(_0x4518b3){if(_0x4518b3){return _0x4fa393[_0x4cd7('0xe')](_0x32ab04)['json'](_0x4518b3);}};}function respondWithFilteredResult(_0x496ef6,_0x466eb6){return function(_0x5809d0){if(_0x5809d0){var _0x50ceab=_0x5809d0[_0x4cd7('0xf')],_0xeca836=_0x466eb6[_0x4cd7('0x10')],_0x12e591=_0x466eb6['offset']+_0x466eb6['limit'],_0x1bbbe1;if(_0x12e591>=_0x50ceab){_0x12e591=_0x50ceab;_0x1bbbe1=0xc8;}else{_0x1bbbe1=0xce;}_0x496ef6[_0x4cd7('0xe')](_0x1bbbe1);return _0x496ef6['set']('Content-Range',_0xeca836+'-'+_0x12e591+'/'+_0x50ceab)[_0x4cd7('0x11')](_0x5809d0);}return null;};}function patchUpdates(_0x47f1bd){return function(_0x405984){try{jsonpatch['apply'](_0x405984,_0x47f1bd,!![]);}catch(_0x26b93a){return BPromise[_0x4cd7('0x12')](_0x26b93a);}return _0x405984['save']();};}function saveUpdates(_0x3b603f,_0x50b980){return function(_0x505b78){if(_0x505b78){return _0x505b78[_0x4cd7('0x13')](_0x3b603f)['then'](function(_0x109067){return _0x109067;});}return null;};}function removeEntity(_0x490152,_0x2ca9c5){return function(_0x163c4c){if(_0x163c4c){return _0x163c4c['destroy']()[_0x4cd7('0x14')](function(){_0x490152[_0x4cd7('0xe')](0xcc)[_0x4cd7('0x15')]();});}};}function handleEntityNotFound(_0x3b7856,_0x2cf3ad){return function(_0x38dbd8){if(!_0x38dbd8){_0x3b7856[_0x4cd7('0x16')](0x194);}return _0x38dbd8;};}function handleError(_0x2a4c94,_0x1357b5){_0x1357b5=_0x1357b5||0x1f4;return function(_0x14f292){logger[_0x4cd7('0x17')](_0x14f292['stack']);if(_0x14f292[_0x4cd7('0x18')]){delete _0x14f292[_0x4cd7('0x18')];}_0x2a4c94[_0x4cd7('0xe')](_0x1357b5)[_0x4cd7('0x19')](_0x14f292);};}exports[_0x4cd7('0x1a')]=function(_0x38f759,_0x492a77){var _0x912765={},_0x21d375={},_0x99e3c9={'count':0x0,'rows':[]};var _0x40e95a=db[_0x4cd7('0x1b')]['rawAttributes'];_0x21d375['model']=_[_0x4cd7('0x1c')](_0x40e95a);var _0x478119={'dateStart':_0x38f759['query'][_0x4cd7('0x1d')],'dateEnd':_0x38f759[_0x4cd7('0x1e')][_0x4cd7('0x1f')]};delete _0x38f759[_0x4cd7('0x1e')][_0x4cd7('0x1d')];delete _0x38f759['query'][_0x4cd7('0x1f')];_0x21d375['query']=_['keys'](_0x38f759[_0x4cd7('0x1e')]);_0x21d375[_0x4cd7('0x20')]=_[_0x4cd7('0x21')](_0x21d375[_0x4cd7('0x22')],_0x21d375[_0x4cd7('0x1e')]);_0x912765[_0x4cd7('0x23')]=_['intersection'](_0x21d375[_0x4cd7('0x22')],qs[_0x4cd7('0x24')](_0x38f759['query'][_0x4cd7('0x24')]));_0x912765[_0x4cd7('0x23')]=_0x912765['attributes']['length']?_0x912765['attributes']:_0x21d375[_0x4cd7('0x22')];if(!_0x38f759[_0x4cd7('0x1e')][_0x4cd7('0x25')](_0x4cd7('0x26'))){_0x912765[_0x4cd7('0x27')]=qs[_0x4cd7('0x27')](_0x38f759[_0x4cd7('0x1e')][_0x4cd7('0x27')]);_0x912765[_0x4cd7('0x10')]=qs[_0x4cd7('0x10')](_0x38f759[_0x4cd7('0x1e')]['offset']);}_0x912765[_0x4cd7('0x28')]=qs[_0x4cd7('0x29')](_0x38f759[_0x4cd7('0x1e')]['sort']);_0x912765[_0x4cd7('0x2a')]=qs[_0x4cd7('0x20')](_[_0x4cd7('0x2b')](_0x38f759[_0x4cd7('0x1e')],_0x21d375[_0x4cd7('0x20')]));if(_0x478119['dateStart']){if(_0x478119[_0x4cd7('0x1f')]){_0x478119[_0x4cd7('0x1f')]=moment(_0x478119[_0x4cd7('0x1f')])[_0x4cd7('0x2c')](0x1,_0x4cd7('0x2d'));}else{_0x478119[_0x4cd7('0x1f')]=moment(_0x478119['dateStart'])[_0x4cd7('0x2c')](0x1,_0x4cd7('0x2d'));}_['merge'](_0x912765[_0x4cd7('0x2a')],{'createdAt':{'$gte':_0x478119[_0x4cd7('0x1d')],'$lte':_0x478119[_0x4cd7('0x1f')]}});}if(_0x38f759['query'][_0x4cd7('0x2e')]){_0x912765[_0x4cd7('0x2a')]=_['merge'](_0x912765[_0x4cd7('0x2a')],{'$or':_[_0x4cd7('0x2f')](_0x912765[_0x4cd7('0x23')],function(_0x3e441d){var _0x1ea3dd={};_0x1ea3dd[_0x3e441d]={'$like':'%'+_0x38f759[_0x4cd7('0x1e')][_0x4cd7('0x2e')]+'%'};return _0x1ea3dd;})});}_0x912765=_[_0x4cd7('0x30')]({},_0x912765,_0x38f759['options']);var _0x636205={'where':_0x912765[_0x4cd7('0x2a')]};return db['CannedAnswer'][_0x4cd7('0xf')](_0x636205)[_0x4cd7('0x14')](function(_0x555aea){_0x99e3c9[_0x4cd7('0xf')]=_0x555aea;if(_0x38f759['query'][_0x4cd7('0x31')]){_0x912765['include']=[{'all':!![]}];}return db[_0x4cd7('0x1b')][_0x4cd7('0x32')](_0x912765);})[_0x4cd7('0x14')](function(_0x17ffef){_0x99e3c9['rows']=_0x17ffef;return _0x99e3c9;})[_0x4cd7('0x14')](respondWithFilteredResult(_0x492a77,_0x912765))[_0x4cd7('0x33')](handleError(_0x492a77,null));};exports[_0x4cd7('0x34')]=function(_0x1196ec,_0x553169){var _0x520e04={'raw':!![],'where':{'id':_0x1196ec['params']['id']}},_0x5561e2={};_0x5561e2[_0x4cd7('0x22')]=_[_0x4cd7('0x1c')](db[_0x4cd7('0x1b')][_0x4cd7('0x35')]);_0x5561e2[_0x4cd7('0x1e')]=_[_0x4cd7('0x1c')](_0x1196ec[_0x4cd7('0x1e')]);_0x5561e2[_0x4cd7('0x20')]=_['intersection'](_0x5561e2['model'],_0x5561e2[_0x4cd7('0x1e')]);_0x520e04[_0x4cd7('0x23')]=_[_0x4cd7('0x21')](_0x5561e2['model'],qs[_0x4cd7('0x24')](_0x1196ec['query'][_0x4cd7('0x24')]));_0x520e04[_0x4cd7('0x23')]=_0x520e04[_0x4cd7('0x23')][_0x4cd7('0x36')]?_0x520e04[_0x4cd7('0x23')]:_0x5561e2[_0x4cd7('0x22')];if(_0x1196ec['query'][_0x4cd7('0x31')]){_0x520e04[_0x4cd7('0x37')]=[{'all':!![]}];}_0x520e04=_[_0x4cd7('0x30')]({},_0x520e04,_0x1196ec[_0x4cd7('0x38')]);return db[_0x4cd7('0x1b')]['find'](_0x520e04)[_0x4cd7('0x14')](handleEntityNotFound(_0x553169,null))[_0x4cd7('0x14')](respondWithResult(_0x553169,null))[_0x4cd7('0x33')](handleError(_0x553169,null));};exports[_0x4cd7('0x13')]=function(_0x17ac19,_0x2a7277){if(_0x17ac19['body']['id']){delete _0x17ac19[_0x4cd7('0x39')]['id'];}return db[_0x4cd7('0x1b')][_0x4cd7('0x3a')]({'where':{'id':_0x17ac19[_0x4cd7('0x3b')]['id']}})[_0x4cd7('0x14')](handleEntityNotFound(_0x2a7277,null))[_0x4cd7('0x14')](saveUpdates(_0x17ac19[_0x4cd7('0x39')],null))['then'](respondWithResult(_0x2a7277,null))[_0x4cd7('0x33')](handleError(_0x2a7277,null));};exports[_0x4cd7('0x3c')]=function(_0x1402b0,_0x191051){return db[_0x4cd7('0x1b')][_0x4cd7('0x3a')]({'where':{'id':_0x1402b0[_0x4cd7('0x3b')]['id']}})[_0x4cd7('0x14')](handleEntityNotFound(_0x191051,null))[_0x4cd7('0x14')](removeEntity(_0x191051,null))[_0x4cd7('0x33')](handleError(_0x191051,null));};exports['create']=function(_0x4c319c,_0x28cac3){var _0x1f7bab={'key':_0x4c319c[_0x4cd7('0x39')]['key']};if(_0x4c319c[_0x4cd7('0x39')][_0x4cd7('0x3d')]){_0x1f7bab['MailAccountId']=_0x4c319c[_0x4cd7('0x39')][_0x4cd7('0x3d')];}else if(_0x4c319c[_0x4cd7('0x39')][_0x4cd7('0x3e')]){_0x1f7bab[_0x4cd7('0x3e')]=_0x4c319c[_0x4cd7('0x39')][_0x4cd7('0x3e')];}else if(_0x4c319c['body'][_0x4cd7('0x3f')]){_0x1f7bab[_0x4cd7('0x3f')]=_0x4c319c['body'][_0x4cd7('0x3f')];}else if(_0x4c319c['body'][_0x4cd7('0x40')]){_0x1f7bab[_0x4cd7('0x40')]=_0x4c319c[_0x4cd7('0x39')][_0x4cd7('0x40')];}return db[_0x4cd7('0x1b')][_0x4cd7('0x3a')]({'where':_0x1f7bab})[_0x4cd7('0x14')](function(_0x55958d){if(_0x55958d){throw new db[(_0x4cd7('0x41'))]['ValidationError'](_0x4cd7('0x42'));}return db['CannedAnswer']['create'](_0x4c319c[_0x4cd7('0x39')]);})[_0x4cd7('0x14')](respondWithResult(_0x28cac3,0xc9))[_0x4cd7('0x33')](handleError(_0x28cac3,null));}; \ No newline at end of file +var _0xbe4a=['MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','save','update','then','destroy','stack','name','send','index','CannedAnswer','rawAttributes','keys','query','dateStart','dateEnd','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filters','pick','add','day','merge','where','filter','map','options','includeAll','include','findAll','show','params','length','find','catch','body','create','key'];(function(_0x35d030,_0x209a35){var _0x462010=function(_0x2e8c5a){while(--_0x2e8c5a){_0x35d030['push'](_0x35d030['shift']());}};_0x462010(++_0x209a35);}(_0xbe4a,0x1b7));var _0xabe4=function(_0x7eadd1,_0x48a71b){_0x7eadd1=_0x7eadd1-0x0;var _0x51d796=_0xbe4a[_0x7eadd1];return _0x51d796;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xabe4('0x0'));var Mustache=require(_0xabe4('0x1'));var util=require('util');var path=require('path');var sox=require(_0xabe4('0x2'));var csv=require('to-csv');var ejs=require(_0xabe4('0x3'));var fs=require('fs');var _=require(_0xabe4('0x4'));var squel=require(_0xabe4('0x5'));var crypto=require(_0xabe4('0x6'));var jsforce=require(_0xabe4('0x7'));var deskjs=require(_0xabe4('0x8'));var toCsv=require('to-csv');var querystring=require(_0xabe4('0x9'));var Papa=require(_0xabe4('0xa'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xabe4('0xb'));var utils=require('../../config/utils');var config=require(_0xabe4('0xc'));var db=require(_0xabe4('0xd'))['db'];function respondWithStatusCode(_0x4a5e13,_0x2d83db){_0x2d83db=_0x2d83db||0xcc;return function(_0x53039c){if(_0x53039c){return _0x4a5e13[_0xabe4('0xe')](_0x2d83db);}return _0x4a5e13[_0xabe4('0xf')](_0x2d83db)[_0xabe4('0x10')]();};}function respondWithResult(_0x253e40,_0x16e960){_0x16e960=_0x16e960||0xc8;return function(_0x2e2659){if(_0x2e2659){return _0x253e40[_0xabe4('0xf')](_0x16e960)[_0xabe4('0x11')](_0x2e2659);}};}function respondWithFilteredResult(_0x226ec4,_0x401e40){return function(_0x8231ac){if(_0x8231ac){var _0x3663f3=_0x8231ac[_0xabe4('0x12')],_0xe6c1a=_0x401e40[_0xabe4('0x13')],_0x51501f=_0x401e40[_0xabe4('0x13')]+_0x401e40['limit'],_0x14c039;if(_0x51501f>=_0x3663f3){_0x51501f=_0x3663f3;_0x14c039=0xc8;}else{_0x14c039=0xce;}_0x226ec4[_0xabe4('0xf')](_0x14c039);return _0x226ec4[_0xabe4('0x14')]('Content-Range',_0xe6c1a+'-'+_0x51501f+'/'+_0x3663f3)[_0xabe4('0x11')](_0x8231ac);}return null;};}function patchUpdates(_0xe109c4){return function(_0x230bc9){try{jsonpatch[_0xabe4('0x15')](_0x230bc9,_0xe109c4,!![]);}catch(_0x540a87){return BPromise['reject'](_0x540a87);}return _0x230bc9[_0xabe4('0x16')]();};}function saveUpdates(_0x319759,_0x3cd7f9){return function(_0x3f3e96){if(_0x3f3e96){return _0x3f3e96[_0xabe4('0x17')](_0x319759)[_0xabe4('0x18')](function(_0xfbefc5){return _0xfbefc5;});}return null;};}function removeEntity(_0x4595c8,_0x21dbff){return function(_0x30ee9f){if(_0x30ee9f){return _0x30ee9f[_0xabe4('0x19')]()[_0xabe4('0x18')](function(){_0x4595c8['status'](0xcc)[_0xabe4('0x10')]();});}};}function handleEntityNotFound(_0x4a5d78,_0x3f2707){return function(_0x48c811){if(!_0x48c811){_0x4a5d78[_0xabe4('0xe')](0x194);}return _0x48c811;};}function handleError(_0x45c112,_0x252e40){_0x252e40=_0x252e40||0x1f4;return function(_0x36c237){logger['error'](_0x36c237[_0xabe4('0x1a')]);if(_0x36c237[_0xabe4('0x1b')]){delete _0x36c237[_0xabe4('0x1b')];}_0x45c112[_0xabe4('0xf')](_0x252e40)[_0xabe4('0x1c')](_0x36c237);};}exports[_0xabe4('0x1d')]=function(_0x24bb30,_0x48f75c){var _0x5c0a63={},_0x52760f={},_0x3818e4={'count':0x0,'rows':[]};var _0x10850f=db[_0xabe4('0x1e')][_0xabe4('0x1f')];_0x52760f['model']=_[_0xabe4('0x20')](_0x10850f);var _0x560fb8={'dateStart':_0x24bb30[_0xabe4('0x21')][_0xabe4('0x22')],'dateEnd':_0x24bb30[_0xabe4('0x21')]['dateEnd']};delete _0x24bb30[_0xabe4('0x21')][_0xabe4('0x22')];delete _0x24bb30[_0xabe4('0x21')][_0xabe4('0x23')];_0x52760f[_0xabe4('0x21')]=_[_0xabe4('0x20')](_0x24bb30[_0xabe4('0x21')]);_0x52760f['filters']=_[_0xabe4('0x24')](_0x52760f[_0xabe4('0x25')],_0x52760f[_0xabe4('0x21')]);_0x5c0a63[_0xabe4('0x26')]=_[_0xabe4('0x24')](_0x52760f['model'],qs[_0xabe4('0x27')](_0x24bb30[_0xabe4('0x21')][_0xabe4('0x27')]));_0x5c0a63[_0xabe4('0x26')]=_0x5c0a63[_0xabe4('0x26')]['length']?_0x5c0a63['attributes']:_0x52760f['model'];if(!_0x24bb30[_0xabe4('0x21')][_0xabe4('0x28')](_0xabe4('0x29'))){_0x5c0a63[_0xabe4('0x2a')]=qs['limit'](_0x24bb30[_0xabe4('0x21')][_0xabe4('0x2a')]);_0x5c0a63[_0xabe4('0x13')]=qs[_0xabe4('0x13')](_0x24bb30['query'][_0xabe4('0x13')]);}_0x5c0a63[_0xabe4('0x2b')]=qs['sort'](_0x24bb30[_0xabe4('0x21')][_0xabe4('0x2c')]);_0x5c0a63['where']=qs[_0xabe4('0x2d')](_[_0xabe4('0x2e')](_0x24bb30[_0xabe4('0x21')],_0x52760f['filters']));if(_0x560fb8[_0xabe4('0x22')]){if(_0x560fb8[_0xabe4('0x23')]){_0x560fb8[_0xabe4('0x23')]=moment(_0x560fb8[_0xabe4('0x23')])[_0xabe4('0x2f')](0x1,_0xabe4('0x30'));}else{_0x560fb8['dateEnd']=moment(_0x560fb8['dateStart'])['add'](0x1,_0xabe4('0x30'));}_[_0xabe4('0x31')](_0x5c0a63[_0xabe4('0x32')],{'createdAt':{'$gte':_0x560fb8[_0xabe4('0x22')],'$lte':_0x560fb8[_0xabe4('0x23')]}});}if(_0x24bb30[_0xabe4('0x21')][_0xabe4('0x33')]){_0x5c0a63[_0xabe4('0x32')]=_['merge'](_0x5c0a63[_0xabe4('0x32')],{'$or':_[_0xabe4('0x34')](_0x5c0a63['attributes'],function(_0x3ddd72){var _0x367c76={};_0x367c76[_0x3ddd72]={'$like':'%'+_0x24bb30['query'][_0xabe4('0x33')]+'%'};return _0x367c76;})});}_0x5c0a63=_[_0xabe4('0x31')]({},_0x5c0a63,_0x24bb30[_0xabe4('0x35')]);var _0x3bcb10={'where':_0x5c0a63[_0xabe4('0x32')]};return db[_0xabe4('0x1e')][_0xabe4('0x12')](_0x3bcb10)[_0xabe4('0x18')](function(_0x88c47c){_0x3818e4[_0xabe4('0x12')]=_0x88c47c;if(_0x24bb30[_0xabe4('0x21')][_0xabe4('0x36')]){_0x5c0a63[_0xabe4('0x37')]=[{'all':!![]}];}return db[_0xabe4('0x1e')][_0xabe4('0x38')](_0x5c0a63);})[_0xabe4('0x18')](function(_0x289921){_0x3818e4['rows']=_0x289921;return _0x3818e4;})[_0xabe4('0x18')](respondWithFilteredResult(_0x48f75c,_0x5c0a63))['catch'](handleError(_0x48f75c,null));};exports[_0xabe4('0x39')]=function(_0x45a7c0,_0x297427){var _0x238bad={'raw':!![],'where':{'id':_0x45a7c0[_0xabe4('0x3a')]['id']}},_0x5f1597={};_0x5f1597[_0xabe4('0x25')]=_[_0xabe4('0x20')](db[_0xabe4('0x1e')][_0xabe4('0x1f')]);_0x5f1597[_0xabe4('0x21')]=_[_0xabe4('0x20')](_0x45a7c0[_0xabe4('0x21')]);_0x5f1597['filters']=_['intersection'](_0x5f1597[_0xabe4('0x25')],_0x5f1597[_0xabe4('0x21')]);_0x238bad[_0xabe4('0x26')]=_['intersection'](_0x5f1597[_0xabe4('0x25')],qs['fields'](_0x45a7c0[_0xabe4('0x21')]['fields']));_0x238bad[_0xabe4('0x26')]=_0x238bad['attributes'][_0xabe4('0x3b')]?_0x238bad[_0xabe4('0x26')]:_0x5f1597[_0xabe4('0x25')];if(_0x45a7c0['query']['includeAll']){_0x238bad[_0xabe4('0x37')]=[{'all':!![]}];}_0x238bad=_['merge']({},_0x238bad,_0x45a7c0[_0xabe4('0x35')]);return db['CannedAnswer'][_0xabe4('0x3c')](_0x238bad)[_0xabe4('0x18')](handleEntityNotFound(_0x297427,null))['then'](respondWithResult(_0x297427,null))[_0xabe4('0x3d')](handleError(_0x297427,null));};exports[_0xabe4('0x17')]=function(_0x38afd8,_0x3d96a9){if(_0x38afd8['body']['id']){delete _0x38afd8[_0xabe4('0x3e')]['id'];}return db['CannedAnswer'][_0xabe4('0x3c')]({'where':{'id':_0x38afd8[_0xabe4('0x3a')]['id']}})[_0xabe4('0x18')](handleEntityNotFound(_0x3d96a9,null))[_0xabe4('0x18')](saveUpdates(_0x38afd8['body'],null))[_0xabe4('0x18')](respondWithResult(_0x3d96a9,null))[_0xabe4('0x3d')](handleError(_0x3d96a9,null));};exports['destroy']=function(_0x9adb30,_0x221285){return db['CannedAnswer'][_0xabe4('0x3c')]({'where':{'id':_0x9adb30['params']['id']}})[_0xabe4('0x18')](handleEntityNotFound(_0x221285,null))[_0xabe4('0x18')](removeEntity(_0x221285,null))[_0xabe4('0x3d')](handleError(_0x221285,null));};exports[_0xabe4('0x3f')]=function(_0x18f31b,_0x3223b1){var _0x584d9c={'key':_0x18f31b[_0xabe4('0x3e')][_0xabe4('0x40')]};if(_0x18f31b[_0xabe4('0x3e')][_0xabe4('0x41')]){_0x584d9c['MailAccountId']=_0x18f31b[_0xabe4('0x3e')][_0xabe4('0x41')];}else if(_0x18f31b[_0xabe4('0x3e')][_0xabe4('0x42')]){_0x584d9c[_0xabe4('0x42')]=_0x18f31b[_0xabe4('0x3e')]['SmsAccountId'];}else if(_0x18f31b[_0xabe4('0x3e')][_0xabe4('0x43')]){_0x584d9c[_0xabe4('0x43')]=_0x18f31b[_0xabe4('0x3e')][_0xabe4('0x43')];}else if(_0x18f31b[_0xabe4('0x3e')][_0xabe4('0x44')]){_0x584d9c[_0xabe4('0x44')]=_0x18f31b[_0xabe4('0x3e')][_0xabe4('0x44')];}return db[_0xabe4('0x1e')][_0xabe4('0x3c')]({'where':_0x584d9c})['then'](function(_0x4c3d7d){if(_0x4c3d7d){throw new db[(_0xabe4('0x45'))][(_0xabe4('0x46'))](_0xabe4('0x47'));}return db[_0xabe4('0x1e')]['create'](_0x18f31b['body']);})['then'](respondWithResult(_0x3223b1,0xc9))['catch'](handleError(_0x3223b1,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index b519ab4..7f6445f 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 _0xdb00=['exports','tools_canned_answers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./cannedAnswer.attributes'];(function(_0x20f143,_0x4619c7){var _0x42712e=function(_0x2c0d27){while(--_0x2c0d27){_0x20f143['push'](_0x20f143['shift']());}};_0x42712e(++_0x4619c7);}(_0xdb00,0x142));var _0x0db0=function(_0x32bbb1,_0xa0e27e){_0x32bbb1=_0x32bbb1-0x0;var _0x42b415=_0xdb00[_0x32bbb1];return _0x42b415;};'use strict';var _=require(_0x0db0('0x0'));var util=require(_0x0db0('0x1'));var logger=require(_0x0db0('0x2'))(_0x0db0('0x3'));var moment=require(_0x0db0('0x4'));var BPromise=require(_0x0db0('0x5'));var rp=require(_0x0db0('0x6'));var attributes=require(_0x0db0('0x7'));module[_0x0db0('0x8')]=function(_0xa34503,_0x10d5e7){return _0xa34503['define']('CannedAnswer',attributes,{'tableName':_0x0db0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc511=['../../config/logger','moment','bluebird','request-promise','./cannedAnswer.attributes','exports','define','CannedAnswer','util'];(function(_0x52666e,_0x5b3776){var _0x515330=function(_0x29cd4f){while(--_0x29cd4f){_0x52666e['push'](_0x52666e['shift']());}};_0x515330(++_0x5b3776);}(_0xc511,0xb3));var _0x1c51=function(_0x33080e,_0x1c600a){_0x33080e=_0x33080e-0x0;var _0x407395=_0xc511[_0x33080e];return _0x407395;};'use strict';var _=require('lodash');var util=require(_0x1c51('0x0'));var logger=require(_0x1c51('0x1'))('api');var moment=require(_0x1c51('0x2'));var BPromise=require(_0x1c51('0x3'));var rp=require(_0x1c51('0x4'));var attributes=require(_0x1c51('0x5'));module[_0x1c51('0x6')]=function(_0x28c627,_0x295325){return _0x28c627[_0x1c51('0x7')](_0x1c51('0x8'),attributes,{'tableName':'tools_canned_answers','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 051fc2f..344e244 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 _0x7fec=['request\x20sent','CannedAnswer,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CannedAnswer,\x20%s,\x20%s'];(function(_0x4477d1,_0x3fbbbc){var _0x421b7e=function(_0x25579e){while(--_0x25579e){_0x4477d1['push'](_0x4477d1['shift']());}};_0x421b7e(++_0x3fbbbc);}(_0x7fec,0xee));var _0xc7fe=function(_0x2747e7,_0xbfa7af){_0x2747e7=_0x2747e7-0x0;var _0x3002d3=_0x7fec[_0x2747e7];return _0x3002d3;};'use strict';var _=require(_0xc7fe('0x0'));var util=require(_0xc7fe('0x1'));var moment=require('moment');var BPromise=require(_0xc7fe('0x2'));var rs=require(_0xc7fe('0x3'));var fs=require('fs');var db=require(_0xc7fe('0x4'))['db'];var utils=require(_0xc7fe('0x5'));var logger=require(_0xc7fe('0x6'))(_0xc7fe('0x7'));var config=require(_0xc7fe('0x8'));var jayson=require(_0xc7fe('0x9'));var client=jayson[_0xc7fe('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x357c04,_0x2cac2c,_0x4c9cfa){return new BPromise(function(_0x7f881c,_0x575353){return client['request'](_0x357c04,_0x4c9cfa)[_0xc7fe('0xb')](function(_0x5176b7){logger[_0xc7fe('0xc')](_0xc7fe('0xd'),_0x2cac2c,_0xc7fe('0xe'));logger['debug'](_0xc7fe('0xf'),_0x2cac2c,_0xc7fe('0xe'),JSON['stringify'](_0x5176b7));if(_0x5176b7[_0xc7fe('0x10')]){if(_0x5176b7[_0xc7fe('0x10')][_0xc7fe('0x11')]===0x1f4){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x2cac2c,_0x5176b7[_0xc7fe('0x10')][_0xc7fe('0x12')]);return _0x575353(_0x5176b7[_0xc7fe('0x10')][_0xc7fe('0x12')]);}logger[_0xc7fe('0x10')](_0xc7fe('0xd'),_0x2cac2c,_0x5176b7[_0xc7fe('0x10')][_0xc7fe('0x12')]);return _0x7f881c(_0x5176b7[_0xc7fe('0x10')][_0xc7fe('0x12')]);}else{logger['info']('CannedAnswer,\x20%s,\x20%s',_0x2cac2c,_0xc7fe('0xe'));_0x7f881c(_0x5176b7[_0xc7fe('0x13')]['message']);}})[_0xc7fe('0x14')](function(_0x58e83b){logger[_0xc7fe('0x10')](_0xc7fe('0xd'),_0x2cac2c,_0x58e83b);_0x575353(_0x58e83b);});});} \ No newline at end of file +var _0x7003=['then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request'];(function(_0x5a0251,_0x400b67){var _0x21ec1c=function(_0x53c3c1){while(--_0x53c3c1){_0x5a0251['push'](_0x5a0251['shift']());}};_0x21ec1c(++_0x400b67);}(_0x7003,0x1ad));var _0x3700=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x7003[_0x1203f];return _0x365f0a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3700('0x0'));var rs=require(_0x3700('0x1'));var fs=require('fs');var db=require(_0x3700('0x2'))['db'];var utils=require(_0x3700('0x3'));var logger=require(_0x3700('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3700('0x5')][_0x3700('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4acb64,_0x428414,_0x4041a6){return new BPromise(function(_0x530589,_0xf0f9c6){return client[_0x3700('0x7')](_0x4acb64,_0x4041a6)[_0x3700('0x8')](function(_0x6add31){logger[_0x3700('0x9')](_0x3700('0xa'),_0x428414,_0x3700('0xb'));logger[_0x3700('0xc')](_0x3700('0xd'),_0x428414,_0x3700('0xb'),JSON[_0x3700('0xe')](_0x6add31));if(_0x6add31[_0x3700('0xf')]){if(_0x6add31[_0x3700('0xf')][_0x3700('0x10')]===0x1f4){logger[_0x3700('0xf')](_0x3700('0xa'),_0x428414,_0x6add31[_0x3700('0xf')][_0x3700('0x11')]);return _0xf0f9c6(_0x6add31[_0x3700('0xf')][_0x3700('0x11')]);}logger[_0x3700('0xf')](_0x3700('0xa'),_0x428414,_0x6add31[_0x3700('0xf')][_0x3700('0x11')]);return _0x530589(_0x6add31[_0x3700('0xf')][_0x3700('0x11')]);}else{logger[_0x3700('0x9')](_0x3700('0xa'),_0x428414,_0x3700('0xb'));_0x530589(_0x6add31['result']['message']);}})[_0x3700('0x12')](function(_0x3f6569){logger[_0x3700('0xf')](_0x3700('0xa'),_0x428414,_0x3f6569);_0xf0f9c6(_0x3f6569);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 4e0d00f..ab2f3e0 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 _0x8edf=['../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','multer','path','Router'];(function(_0x34f726,_0x421385){var _0x37b027=function(_0x458d00){while(--_0x458d00){_0x34f726['push'](_0x34f726['shift']());}};_0x37b027(++_0x421385);}(_0x8edf,0xad));var _0xf8ed=function(_0x28da0c,_0x4282ed){_0x28da0c=_0x28da0c-0x0;var _0x3a3aa2=_0x8edf[_0x28da0c];return _0x3a3aa2;};'use strict';var multer=require(_0xf8ed('0x0'));var util=require('util');var path=require(_0xf8ed('0x1'));var express=require('express');var router=express[_0xf8ed('0x2')]();var auth=require(_0xf8ed('0x3'));var interaction=require(_0xf8ed('0x4'));var config=require('../../config/environment');var controller=require(_0xf8ed('0x5'));router[_0xf8ed('0x6')]('/',auth[_0xf8ed('0x7')](),controller[_0xf8ed('0x8')]);router[_0xf8ed('0x6')](_0xf8ed('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xf8ed('0xa')]('/',auth['isAuthenticated'](),controller[_0xf8ed('0xb')]);router['put'](_0xf8ed('0x9'),auth[_0xf8ed('0x7')](),controller[_0xf8ed('0xc')]);router[_0xf8ed('0xd')](_0xf8ed('0x9'),auth[_0xf8ed('0x7')](),controller[_0xf8ed('0xe')]);module[_0xf8ed('0xf')]=router; \ No newline at end of file +var _0x5d36=['/:id','show','post','create','put','update','delete','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x23d7fd,_0x16d5b1){var _0x475743=function(_0x32a188){while(--_0x32a188){_0x23d7fd['push'](_0x23d7fd['shift']());}};_0x475743(++_0x16d5b1);}(_0x5d36,0x14c));var _0x65d3=function(_0x3af384,_0x2b2160){_0x3af384=_0x3af384-0x0;var _0x194aad=_0x5d36[_0x3af384];return _0x194aad;};'use strict';var multer=require(_0x65d3('0x0'));var util=require('util');var path=require(_0x65d3('0x1'));var express=require(_0x65d3('0x2'));var router=express[_0x65d3('0x3')]();var auth=require(_0x65d3('0x4'));var interaction=require(_0x65d3('0x5'));var config=require(_0x65d3('0x6'));var controller=require('./cannedAnswer.controller');router[_0x65d3('0x7')]('/',auth[_0x65d3('0x8')](),controller[_0x65d3('0x9')]);router[_0x65d3('0x7')](_0x65d3('0xa'),auth[_0x65d3('0x8')](),controller[_0x65d3('0xb')]);router[_0x65d3('0xc')]('/',auth['isAuthenticated'](),controller[_0x65d3('0xd')]);router[_0x65d3('0xe')](_0x65d3('0xa'),auth[_0x65d3('0x8')](),controller[_0x65d3('0xf')]);router[_0x65d3('0x10')](_0x65d3('0xa'),auth[_0x65d3('0x8')](),controller['destroy']);module[_0x65d3('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 4ad3ace..a2dd2cf 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 _0xde6e=['DATE','STRING','INTEGER','sequelize'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xde6e,0x177));var _0xede6=function(_0x263a2f,_0x1e81e3){_0x263a2f=_0x263a2f-0x0;var _0x8020e8=_0xde6e[_0x263a2f];return _0x8020e8;};'use strict';var Sequelize=require(_0xede6('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xede6('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xede6('0x2')]},'src':{'type':Sequelize[_0xede6('0x2')]},'dst':{'type':Sequelize[_0xede6('0x2')]},'dcontext':{'type':Sequelize[_0xede6('0x2')]},'channel':{'type':Sequelize[_0xede6('0x2')]},'dstchannel':{'type':Sequelize[_0xede6('0x2')]},'lastapp':{'type':Sequelize[_0xede6('0x2')]},'lastdata':{'type':Sequelize[_0xede6('0x2')]},'duration':{'type':Sequelize[_0xede6('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xede6('0x2')]},'amaflags':{'type':Sequelize[_0xede6('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xede6('0x2')]},'linkedid':{'type':Sequelize[_0xede6('0x2')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xede6('0x2')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xede6('0x2')]}}; \ No newline at end of file +var _0xb544=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x43e987,_0x5ac354){var _0x51760c=function(_0x236912){while(--_0x236912){_0x43e987['push'](_0x43e987['shift']());}};_0x51760c(++_0x5ac354);}(_0xb544,0xdc));var _0x4b54=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xb544[_0x1928c9];return _0x51b5fb;};'use strict';var Sequelize=require(_0x4b54('0x0'));module[_0x4b54('0x1')]={'calldate':{'type':Sequelize[_0x4b54('0x2')],'allowNull':![],'defaultValue':_0x4b54('0x3')},'clid':{'type':Sequelize[_0x4b54('0x4')]},'src':{'type':Sequelize[_0x4b54('0x4')]},'dst':{'type':Sequelize[_0x4b54('0x4')]},'dcontext':{'type':Sequelize[_0x4b54('0x4')]},'channel':{'type':Sequelize[_0x4b54('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x4b54('0x4')]},'lastdata':{'type':Sequelize[_0x4b54('0x4')]},'duration':{'type':Sequelize[_0x4b54('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x4b54('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4b54('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x4b54('0x4')]},'userfield':{'type':Sequelize[_0x4b54('0x4')]},'uniqueid':{'type':Sequelize[_0x4b54('0x4')]},'linkedid':{'type':Sequelize[_0x4b54('0x4')]},'sequence':{'type':Sequelize[_0x4b54('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4b54('0x4')]},'tag':{'type':Sequelize[_0x4b54('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index af36363..67b7ff4 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 _0xe0e4=['stack','name','send','index','Cdr','rawAttributes','model','keys','query','dateEnd','dateStart','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','filters','pick','add','day','merge','where','map','filter','options','includeAll','include','show','params','fields','find','catch','body','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error'];(function(_0x47f5a9,_0x40474a){var _0x407467=function(_0x60f244){while(--_0x60f244){_0x47f5a9['push'](_0x47f5a9['shift']());}};_0x407467(++_0x40474a);}(_0xe0e4,0x186));var _0x4e0e=function(_0x563a1c,_0x3c2949){_0x563a1c=_0x563a1c-0x0;var _0x11a860=_0xe0e4[_0x563a1c];return _0x11a860;};'use strict';var jsonpatch=require(_0x4e0e('0x0'));var rp=require(_0x4e0e('0x1'));var moment=require(_0x4e0e('0x2'));var BPromise=require(_0x4e0e('0x3'));var Mustache=require(_0x4e0e('0x4'));var util=require('util');var path=require(_0x4e0e('0x5'));var sox=require(_0x4e0e('0x6'));var csv=require('to-csv');var ejs=require(_0x4e0e('0x7'));var fs=require('fs');var _=require(_0x4e0e('0x8'));var squel=require(_0x4e0e('0x9'));var crypto=require(_0x4e0e('0xa'));var jsforce=require(_0x4e0e('0xb'));var deskjs=require(_0x4e0e('0xc'));var toCsv=require(_0x4e0e('0xd'));var querystring=require(_0x4e0e('0xe'));var Papa=require(_0x4e0e('0xf'));var qs=require(_0x4e0e('0x10'));var logger=require('../../config/logger')(_0x4e0e('0x11'));var utils=require(_0x4e0e('0x12'));var config=require(_0x4e0e('0x13'));var db=require(_0x4e0e('0x14'))['db'];function respondWithStatusCode(_0x57750d,_0x5efccc){_0x5efccc=_0x5efccc||0xcc;return function(_0x553776){if(_0x553776){return _0x57750d['sendStatus'](_0x5efccc);}return _0x57750d[_0x4e0e('0x15')](_0x5efccc)[_0x4e0e('0x16')]();};}function respondWithResult(_0x51439a,_0x3db635){_0x3db635=_0x3db635||0xc8;return function(_0x446e84){if(_0x446e84){return _0x51439a[_0x4e0e('0x15')](_0x3db635)[_0x4e0e('0x17')](_0x446e84);}};}function respondWithFilteredResult(_0x5c1280,_0x17110b){return function(_0x5d5b93){if(_0x5d5b93){var _0x11815b=_0x5d5b93[_0x4e0e('0x18')],_0x56da63=_0x17110b[_0x4e0e('0x19')],_0x1750e4=_0x17110b[_0x4e0e('0x19')]+_0x17110b[_0x4e0e('0x1a')],_0x2570de;if(_0x1750e4>=_0x11815b){_0x1750e4=_0x11815b;_0x2570de=0xc8;}else{_0x2570de=0xce;}_0x5c1280['status'](_0x2570de);return _0x5c1280[_0x4e0e('0x1b')](_0x4e0e('0x1c'),_0x56da63+'-'+_0x1750e4+'/'+_0x11815b)[_0x4e0e('0x17')](_0x5d5b93);}return null;};}function patchUpdates(_0x3a93e8){return function(_0x3ba25c){try{jsonpatch[_0x4e0e('0x1d')](_0x3ba25c,_0x3a93e8,!![]);}catch(_0xbe150b){return BPromise[_0x4e0e('0x1e')](_0xbe150b);}return _0x3ba25c[_0x4e0e('0x1f')]();};}function saveUpdates(_0xff56c7,_0x3a0513){return function(_0x53b067){if(_0x53b067){return _0x53b067[_0x4e0e('0x20')](_0xff56c7)[_0x4e0e('0x21')](function(_0x2468f9){return _0x2468f9;});}return null;};}function removeEntity(_0x3d571b,_0x2d1e0c){return function(_0x17bbbd){if(_0x17bbbd){return _0x17bbbd['destroy']()[_0x4e0e('0x21')](function(){_0x3d571b[_0x4e0e('0x15')](0xcc)[_0x4e0e('0x16')]();});}};}function handleEntityNotFound(_0x4181ee,_0x44cdfc){return function(_0x48e8d1){if(!_0x48e8d1){_0x4181ee[_0x4e0e('0x22')](0x194);}return _0x48e8d1;};}function handleError(_0x27634a,_0x73506b){_0x73506b=_0x73506b||0x1f4;return function(_0x11fd11){logger[_0x4e0e('0x23')](_0x11fd11[_0x4e0e('0x24')]);if(_0x11fd11[_0x4e0e('0x25')]){delete _0x11fd11[_0x4e0e('0x25')];}_0x27634a[_0x4e0e('0x15')](_0x73506b)[_0x4e0e('0x26')](_0x11fd11);};}exports[_0x4e0e('0x27')]=function(_0x36bd03,_0x1b79de){var _0x3be640={},_0x19deb9={},_0x40a92b={'count':0x0,'rows':[]};var _0x54c6b4=db[_0x4e0e('0x28')][_0x4e0e('0x29')];_0x19deb9[_0x4e0e('0x2a')]=_[_0x4e0e('0x2b')](_0x54c6b4);var _0x3020c5={'dateStart':_0x36bd03[_0x4e0e('0x2c')]['dateStart'],'dateEnd':_0x36bd03[_0x4e0e('0x2c')][_0x4e0e('0x2d')]};delete _0x36bd03['query'][_0x4e0e('0x2e')];delete _0x36bd03['query'][_0x4e0e('0x2d')];_0x19deb9[_0x4e0e('0x2c')]=_[_0x4e0e('0x2b')](_0x36bd03[_0x4e0e('0x2c')]);_0x19deb9['filters']=_['intersection'](_0x19deb9[_0x4e0e('0x2a')],_0x19deb9[_0x4e0e('0x2c')]);_0x3be640[_0x4e0e('0x2f')]=_[_0x4e0e('0x30')](_0x19deb9[_0x4e0e('0x2a')],qs['fields'](_0x36bd03[_0x4e0e('0x2c')]['fields']));_0x3be640['attributes']=_0x3be640[_0x4e0e('0x2f')][_0x4e0e('0x31')]?_0x3be640['attributes']:_0x19deb9[_0x4e0e('0x2a')];if(!_0x36bd03[_0x4e0e('0x2c')][_0x4e0e('0x32')](_0x4e0e('0x33'))){_0x3be640['limit']=qs['limit'](_0x36bd03['query'][_0x4e0e('0x1a')]);_0x3be640[_0x4e0e('0x19')]=qs[_0x4e0e('0x19')](_0x36bd03['query']['offset']);}_0x3be640[_0x4e0e('0x34')]=qs[_0x4e0e('0x35')](_0x36bd03[_0x4e0e('0x2c')][_0x4e0e('0x35')]);_0x3be640['where']=qs[_0x4e0e('0x36')](_[_0x4e0e('0x37')](_0x36bd03[_0x4e0e('0x2c')],_0x19deb9['filters']));if(_0x3020c5[_0x4e0e('0x2e')]){if(_0x3020c5[_0x4e0e('0x2d')]){_0x3020c5['dateEnd']=moment(_0x3020c5['dateEnd'])[_0x4e0e('0x38')](0x1,_0x4e0e('0x39'));}else{_0x3020c5['dateEnd']=moment(_0x3020c5[_0x4e0e('0x2e')])['add'](0x1,_0x4e0e('0x39'));}_[_0x4e0e('0x3a')](_0x3be640[_0x4e0e('0x3b')],{'createdAt':{'$gte':_0x3020c5[_0x4e0e('0x2e')],'$lte':_0x3020c5['dateEnd']}});}if(_0x36bd03[_0x4e0e('0x2c')]['filter']){_0x3be640['where']=_[_0x4e0e('0x3a')](_0x3be640[_0x4e0e('0x3b')],{'$or':_[_0x4e0e('0x3c')](_0x3be640[_0x4e0e('0x2f')],function(_0x359fdf){var _0x4c0944={};_0x4c0944[_0x359fdf]={'$like':'%'+_0x36bd03[_0x4e0e('0x2c')][_0x4e0e('0x3d')]+'%'};return _0x4c0944;})});}_0x3be640=_[_0x4e0e('0x3a')]({},_0x3be640,_0x36bd03[_0x4e0e('0x3e')]);var _0x2c46cb={'where':_0x3be640[_0x4e0e('0x3b')]};return db[_0x4e0e('0x28')]['count'](_0x2c46cb)[_0x4e0e('0x21')](function(_0x11fd9d){_0x40a92b[_0x4e0e('0x18')]=_0x11fd9d;if(_0x36bd03[_0x4e0e('0x2c')][_0x4e0e('0x3f')]){_0x3be640[_0x4e0e('0x40')]=[{'all':!![]}];}return db[_0x4e0e('0x28')]['findAll'](_0x3be640);})['then'](function(_0x408f21){_0x40a92b['rows']=_0x408f21;return _0x40a92b;})[_0x4e0e('0x21')](respondWithFilteredResult(_0x1b79de,_0x3be640))['catch'](handleError(_0x1b79de,null));};exports[_0x4e0e('0x41')]=function(_0x5111cd,_0x5939dd){var _0x4b2ff2={'raw':!![],'where':{'id':_0x5111cd[_0x4e0e('0x42')]['id']}},_0x351a8d={};_0x351a8d[_0x4e0e('0x2a')]=_['keys'](db['Cdr'][_0x4e0e('0x29')]);_0x351a8d[_0x4e0e('0x2c')]=_['keys'](_0x5111cd[_0x4e0e('0x2c')]);_0x351a8d[_0x4e0e('0x36')]=_['intersection'](_0x351a8d[_0x4e0e('0x2a')],_0x351a8d[_0x4e0e('0x2c')]);_0x4b2ff2[_0x4e0e('0x2f')]=_['intersection'](_0x351a8d['model'],qs[_0x4e0e('0x43')](_0x5111cd[_0x4e0e('0x2c')][_0x4e0e('0x43')]));_0x4b2ff2['attributes']=_0x4b2ff2[_0x4e0e('0x2f')]['length']?_0x4b2ff2[_0x4e0e('0x2f')]:_0x351a8d[_0x4e0e('0x2a')];if(_0x5111cd[_0x4e0e('0x2c')][_0x4e0e('0x3f')]){_0x4b2ff2[_0x4e0e('0x40')]=[{'all':!![]}];}_0x4b2ff2=_['merge']({},_0x4b2ff2,_0x5111cd[_0x4e0e('0x3e')]);return db[_0x4e0e('0x28')][_0x4e0e('0x44')](_0x4b2ff2)[_0x4e0e('0x21')](handleEntityNotFound(_0x5939dd,null))[_0x4e0e('0x21')](respondWithResult(_0x5939dd,null))[_0x4e0e('0x45')](handleError(_0x5939dd,null));};exports['create']=function(_0x2605c1,_0x389499){return db[_0x4e0e('0x28')]['create'](_0x2605c1[_0x4e0e('0x46')],{})[_0x4e0e('0x21')](respondWithResult(_0x389499,0xc9))[_0x4e0e('0x45')](handleError(_0x389499,null));};exports[_0x4e0e('0x20')]=function(_0x3b394d,_0x3e7fb9){if(_0x3b394d['body']['id']){delete _0x3b394d[_0x4e0e('0x46')]['id'];}return db['Cdr'][_0x4e0e('0x44')]({'where':{'id':_0x3b394d[_0x4e0e('0x42')]['id']}})[_0x4e0e('0x21')](handleEntityNotFound(_0x3e7fb9,null))[_0x4e0e('0x21')](saveUpdates(_0x3b394d[_0x4e0e('0x46')],null))['then'](respondWithResult(_0x3e7fb9,null))[_0x4e0e('0x45')](handleError(_0x3e7fb9,null));};exports['destroy']=function(_0x77a1c3,_0x179e22){return db[_0x4e0e('0x28')]['find']({'where':{'id':_0x77a1c3[_0x4e0e('0x42')]['id']}})[_0x4e0e('0x21')](handleEntityNotFound(_0x179e22,null))[_0x4e0e('0x21')](removeEntity(_0x179e22,null))['catch'](handleError(_0x179e22,null));}; \ No newline at end of file +var _0x2369=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','Cdr','rawAttributes','model','keys','dateStart','query','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','day','add','merge','map','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','request-promise','moment','bluebird','util','path','to-csv','ejs'];(function(_0x22da96,_0xfc5108){var _0x5a35dd=function(_0x19f9bc){while(--_0x19f9bc){_0x22da96['push'](_0x22da96['shift']());}};_0x5a35dd(++_0xfc5108);}(_0x2369,0x18b));var _0x9236=function(_0x43f4c8,_0x22a037){_0x43f4c8=_0x43f4c8-0x0;var _0x3a2e0c=_0x2369[_0x43f4c8];return _0x3a2e0c;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x9236('0x0'));var moment=require(_0x9236('0x1'));var BPromise=require(_0x9236('0x2'));var Mustache=require('mustache');var util=require(_0x9236('0x3'));var path=require(_0x9236('0x4'));var sox=require('sox');var csv=require(_0x9236('0x5'));var ejs=require(_0x9236('0x6'));var fs=require('fs');var _=require(_0x9236('0x7'));var squel=require(_0x9236('0x8'));var crypto=require(_0x9236('0x9'));var jsforce=require(_0x9236('0xa'));var deskjs=require(_0x9236('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9236('0xc'));var Papa=require(_0x9236('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0x9236('0xe'))(_0x9236('0xf'));var utils=require('../../config/utils');var config=require(_0x9236('0x10'));var db=require(_0x9236('0x11'))['db'];function respondWithStatusCode(_0x8836a7,_0xfa0a5d){_0xfa0a5d=_0xfa0a5d||0xcc;return function(_0x2c8f77){if(_0x2c8f77){return _0x8836a7['sendStatus'](_0xfa0a5d);}return _0x8836a7[_0x9236('0x12')](_0xfa0a5d)[_0x9236('0x13')]();};}function respondWithResult(_0xf6b8c2,_0x3a4d48){_0x3a4d48=_0x3a4d48||0xc8;return function(_0x2dfdef){if(_0x2dfdef){return _0xf6b8c2[_0x9236('0x12')](_0x3a4d48)[_0x9236('0x14')](_0x2dfdef);}};}function respondWithFilteredResult(_0x44cd92,_0x5cbadb){return function(_0x472ab5){if(_0x472ab5){var _0x78ab44=_0x472ab5[_0x9236('0x15')],_0x4c8d04=_0x5cbadb[_0x9236('0x16')],_0x3e4217=_0x5cbadb[_0x9236('0x16')]+_0x5cbadb[_0x9236('0x17')],_0x6ad367;if(_0x3e4217>=_0x78ab44){_0x3e4217=_0x78ab44;_0x6ad367=0xc8;}else{_0x6ad367=0xce;}_0x44cd92[_0x9236('0x12')](_0x6ad367);return _0x44cd92[_0x9236('0x18')](_0x9236('0x19'),_0x4c8d04+'-'+_0x3e4217+'/'+_0x78ab44)[_0x9236('0x14')](_0x472ab5);}return null;};}function patchUpdates(_0x25b769){return function(_0x275a77){try{jsonpatch[_0x9236('0x1a')](_0x275a77,_0x25b769,!![]);}catch(_0x2aa57c){return BPromise[_0x9236('0x1b')](_0x2aa57c);}return _0x275a77[_0x9236('0x1c')]();};}function saveUpdates(_0x158380,_0x289b6f){return function(_0x1a798){if(_0x1a798){return _0x1a798[_0x9236('0x1d')](_0x158380)[_0x9236('0x1e')](function(_0x4f64fe){return _0x4f64fe;});}return null;};}function removeEntity(_0x44771f,_0x59f7d5){return function(_0x23556c){if(_0x23556c){return _0x23556c[_0x9236('0x1f')]()[_0x9236('0x1e')](function(){_0x44771f['status'](0xcc)[_0x9236('0x13')]();});}};}function handleEntityNotFound(_0x170406,_0xfd7125){return function(_0x48ffa2){if(!_0x48ffa2){_0x170406['sendStatus'](0x194);}return _0x48ffa2;};}function handleError(_0x3c87c9,_0x1e4b92){_0x1e4b92=_0x1e4b92||0x1f4;return function(_0x5bf3b9){logger['error'](_0x5bf3b9[_0x9236('0x20')]);if(_0x5bf3b9[_0x9236('0x21')]){delete _0x5bf3b9[_0x9236('0x21')];}_0x3c87c9[_0x9236('0x12')](_0x1e4b92)[_0x9236('0x22')](_0x5bf3b9);};}exports[_0x9236('0x23')]=function(_0xfcc223,_0xbed84c){var _0x11230e={},_0x21f4c5={},_0xf79f34={'count':0x0,'rows':[]};var _0x4f05fb=db[_0x9236('0x24')][_0x9236('0x25')];_0x21f4c5[_0x9236('0x26')]=_[_0x9236('0x27')](_0x4f05fb);var _0x4cb2c2={'dateStart':_0xfcc223['query'][_0x9236('0x28')],'dateEnd':_0xfcc223['query']['dateEnd']};delete _0xfcc223[_0x9236('0x29')][_0x9236('0x28')];delete _0xfcc223[_0x9236('0x29')][_0x9236('0x2a')];_0x21f4c5['query']=_[_0x9236('0x27')](_0xfcc223['query']);_0x21f4c5[_0x9236('0x2b')]=_['intersection'](_0x21f4c5['model'],_0x21f4c5[_0x9236('0x29')]);_0x11230e[_0x9236('0x2c')]=_[_0x9236('0x2d')](_0x21f4c5[_0x9236('0x26')],qs[_0x9236('0x2e')](_0xfcc223[_0x9236('0x29')][_0x9236('0x2e')]));_0x11230e[_0x9236('0x2c')]=_0x11230e[_0x9236('0x2c')][_0x9236('0x2f')]?_0x11230e[_0x9236('0x2c')]:_0x21f4c5['model'];if(!_0xfcc223[_0x9236('0x29')][_0x9236('0x30')]('nolimit')){_0x11230e[_0x9236('0x17')]=qs[_0x9236('0x17')](_0xfcc223['query']['limit']);_0x11230e[_0x9236('0x16')]=qs[_0x9236('0x16')](_0xfcc223['query'][_0x9236('0x16')]);}_0x11230e[_0x9236('0x31')]=qs[_0x9236('0x32')](_0xfcc223[_0x9236('0x29')][_0x9236('0x32')]);_0x11230e[_0x9236('0x33')]=qs['filters'](_['pick'](_0xfcc223[_0x9236('0x29')],_0x21f4c5[_0x9236('0x2b')]));if(_0x4cb2c2[_0x9236('0x28')]){if(_0x4cb2c2[_0x9236('0x2a')]){_0x4cb2c2[_0x9236('0x2a')]=moment(_0x4cb2c2[_0x9236('0x2a')])['add'](0x1,_0x9236('0x34'));}else{_0x4cb2c2[_0x9236('0x2a')]=moment(_0x4cb2c2[_0x9236('0x28')])[_0x9236('0x35')](0x1,_0x9236('0x34'));}_[_0x9236('0x36')](_0x11230e[_0x9236('0x33')],{'createdAt':{'$gte':_0x4cb2c2[_0x9236('0x28')],'$lte':_0x4cb2c2[_0x9236('0x2a')]}});}if(_0xfcc223[_0x9236('0x29')]['filter']){_0x11230e[_0x9236('0x33')]=_[_0x9236('0x36')](_0x11230e[_0x9236('0x33')],{'$or':_[_0x9236('0x37')](_0x11230e[_0x9236('0x2c')],function(_0x2955e8){var _0x5828c7={};_0x5828c7[_0x2955e8]={'$like':'%'+_0xfcc223[_0x9236('0x29')]['filter']+'%'};return _0x5828c7;})});}_0x11230e=_[_0x9236('0x36')]({},_0x11230e,_0xfcc223[_0x9236('0x38')]);var _0x28ab0b={'where':_0x11230e[_0x9236('0x33')]};return db['Cdr']['count'](_0x28ab0b)[_0x9236('0x1e')](function(_0x1e8437){_0xf79f34['count']=_0x1e8437;if(_0xfcc223[_0x9236('0x29')][_0x9236('0x39')]){_0x11230e[_0x9236('0x3a')]=[{'all':!![]}];}return db[_0x9236('0x24')][_0x9236('0x3b')](_0x11230e);})['then'](function(_0x49be1b){_0xf79f34[_0x9236('0x3c')]=_0x49be1b;return _0xf79f34;})[_0x9236('0x1e')](respondWithFilteredResult(_0xbed84c,_0x11230e))[_0x9236('0x3d')](handleError(_0xbed84c,null));};exports[_0x9236('0x3e')]=function(_0x2bded6,_0x1879d7){var _0x143bcb={'raw':!![],'where':{'id':_0x2bded6[_0x9236('0x3f')]['id']}},_0x464d74={};_0x464d74[_0x9236('0x26')]=_['keys'](db[_0x9236('0x24')][_0x9236('0x25')]);_0x464d74[_0x9236('0x29')]=_[_0x9236('0x27')](_0x2bded6['query']);_0x464d74[_0x9236('0x2b')]=_['intersection'](_0x464d74['model'],_0x464d74[_0x9236('0x29')]);_0x143bcb['attributes']=_['intersection'](_0x464d74[_0x9236('0x26')],qs[_0x9236('0x2e')](_0x2bded6[_0x9236('0x29')][_0x9236('0x2e')]));_0x143bcb[_0x9236('0x2c')]=_0x143bcb[_0x9236('0x2c')][_0x9236('0x2f')]?_0x143bcb[_0x9236('0x2c')]:_0x464d74[_0x9236('0x26')];if(_0x2bded6['query'][_0x9236('0x39')]){_0x143bcb[_0x9236('0x3a')]=[{'all':!![]}];}_0x143bcb=_[_0x9236('0x36')]({},_0x143bcb,_0x2bded6[_0x9236('0x38')]);return db[_0x9236('0x24')]['find'](_0x143bcb)[_0x9236('0x1e')](handleEntityNotFound(_0x1879d7,null))[_0x9236('0x1e')](respondWithResult(_0x1879d7,null))[_0x9236('0x3d')](handleError(_0x1879d7,null));};exports[_0x9236('0x40')]=function(_0x5a5175,_0x46afae){return db[_0x9236('0x24')]['create'](_0x5a5175[_0x9236('0x41')],{})[_0x9236('0x1e')](respondWithResult(_0x46afae,0xc9))[_0x9236('0x3d')](handleError(_0x46afae,null));};exports[_0x9236('0x1d')]=function(_0xb8b7b0,_0x51a52a){if(_0xb8b7b0['body']['id']){delete _0xb8b7b0[_0x9236('0x41')]['id'];}return db[_0x9236('0x24')][_0x9236('0x42')]({'where':{'id':_0xb8b7b0[_0x9236('0x3f')]['id']}})[_0x9236('0x1e')](handleEntityNotFound(_0x51a52a,null))['then'](saveUpdates(_0xb8b7b0['body'],null))[_0x9236('0x1e')](respondWithResult(_0x51a52a,null))[_0x9236('0x3d')](handleError(_0x51a52a,null));};exports[_0x9236('0x1f')]=function(_0x533061,_0x4ef739){return db[_0x9236('0x24')][_0x9236('0x42')]({'where':{'id':_0x533061['params']['id']}})[_0x9236('0x1e')](handleEntityNotFound(_0x4ef739,null))[_0x9236('0x1e')](removeEntity(_0x4ef739,null))[_0x9236('0x3d')](handleError(_0x4ef739,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 0ab6064..f1d15ed 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 _0xaf9c=['request-promise','./cdr.attributes','exports','define','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','bluebird'];(function(_0x5b95f3,_0x576375){var _0x58a5ef=function(_0x4808d8){while(--_0x4808d8){_0x5b95f3['push'](_0x5b95f3['shift']());}};_0x58a5ef(++_0x576375);}(_0xaf9c,0xa5));var _0xcaf9=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xaf9c[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0xcaf9('0x0'));var util=require(_0xcaf9('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xcaf9('0x2'));var rp=require(_0xcaf9('0x3'));var attributes=require(_0xcaf9('0x4'));module[_0xcaf9('0x5')]=function(_0x32a298,_0x2b89cb){return _0x32a298[_0xcaf9('0x6')]('Cdr',attributes,{'tableName':_0xcaf9('0x7'),'paranoid':![],'indexes':[{'name':_0xcaf9('0x8'),'fields':['accountcode']},{'name':'calldate','fields':[_0xcaf9('0x9')]},{'name':_0xcaf9('0xa'),'fields':[_0xcaf9('0xa')]},{'name':_0xcaf9('0xb'),'fields':[_0xcaf9('0xb')]},{'name':_0xcaf9('0xc'),'fields':['src']},{'name':_0xcaf9('0xd'),'fields':[_0xcaf9('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xd35a=['./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xd07367,_0x14af9d){var _0x302209=function(_0x31399a){while(--_0x31399a){_0xd07367['push'](_0xd07367['shift']());}};_0x302209(++_0x14af9d);}(_0xd35a,0x14e));var _0xad35=function(_0x25e995,_0x143cdc){_0x25e995=_0x25e995-0x0;var _0x446a58=_0xd35a[_0x25e995];return _0x446a58;};'use strict';var _=require(_0xad35('0x0'));var util=require('util');var logger=require(_0xad35('0x1'))(_0xad35('0x2'));var moment=require(_0xad35('0x3'));var BPromise=require(_0xad35('0x4'));var rp=require(_0xad35('0x5'));var attributes=require(_0xad35('0x6'));module[_0xad35('0x7')]=function(_0x4547ea,_0x414f26){return _0x4547ea[_0xad35('0x8')](_0xad35('0x9'),attributes,{'tableName':_0xad35('0xa'),'paranoid':![],'indexes':[{'name':_0xad35('0xb'),'fields':[_0xad35('0xb')]},{'name':_0xad35('0xc'),'fields':['calldate']},{'name':_0xad35('0xd'),'fields':[_0xad35('0xd')]},{'name':_0xad35('0xe'),'fields':[_0xad35('0xe')]},{'name':_0xad35('0xf'),'fields':['src']},{'name':_0xad35('0x10'),'fields':[_0xad35('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 013e879..19d2f25 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 _0x528e=['request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Cdr,\x20%s,\x20%s','Cdr,\x20%s,\x20%s,\x20%s'];(function(_0x144310,_0x3f3931){var _0x3ac520=function(_0x2c1543){while(--_0x2c1543){_0x144310['push'](_0x144310['shift']());}};_0x3ac520(++_0x3f3931);}(_0x528e,0x1d2));var _0xe528=function(_0x49f96c,_0x6e8095){_0x49f96c=_0x49f96c-0x0;var _0x2ecaff=_0x528e[_0x49f96c];return _0x2ecaff;};'use strict';var _=require(_0xe528('0x0'));var util=require(_0xe528('0x1'));var moment=require(_0xe528('0x2'));var BPromise=require(_0xe528('0x3'));var rs=require(_0xe528('0x4'));var fs=require('fs');var db=require(_0xe528('0x5'))['db'];var utils=require(_0xe528('0x6'));var logger=require(_0xe528('0x7'))(_0xe528('0x8'));var config=require(_0xe528('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe528('0xa')][_0xe528('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x112e81,_0x1cda6c,_0x572ca3){return new BPromise(function(_0x2c0e02,_0x3bfc13){return client[_0xe528('0xc')](_0x112e81,_0x572ca3)[_0xe528('0xd')](function(_0x107929){logger[_0xe528('0xe')](_0xe528('0xf'),_0x1cda6c,'request\x20sent');logger['debug'](_0xe528('0x10'),_0x1cda6c,_0xe528('0x11'),JSON[_0xe528('0x12')](_0x107929));if(_0x107929[_0xe528('0x13')]){if(_0x107929[_0xe528('0x13')][_0xe528('0x14')]===0x1f4){logger[_0xe528('0x13')]('Cdr,\x20%s,\x20%s',_0x1cda6c,_0x107929[_0xe528('0x13')][_0xe528('0x15')]);return _0x3bfc13(_0x107929[_0xe528('0x13')][_0xe528('0x15')]);}logger[_0xe528('0x13')](_0xe528('0xf'),_0x1cda6c,_0x107929[_0xe528('0x13')][_0xe528('0x15')]);return _0x2c0e02(_0x107929[_0xe528('0x13')]['message']);}else{logger[_0xe528('0xe')](_0xe528('0xf'),_0x1cda6c,_0xe528('0x11'));_0x2c0e02(_0x107929['result'][_0xe528('0x15')]);}})[_0xe528('0x16')](function(_0x1c0109){logger[_0xe528('0x13')]('Cdr,\x20%s,\x20%s',_0x1cda6c,_0x1c0109);_0x3bfc13(_0x1c0109);});});} \ No newline at end of file +var _0xc615=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x1c22f0,_0x1924e2){var _0x5a32d8=function(_0x3490e8){while(--_0x3490e8){_0x1c22f0['push'](_0x1c22f0['shift']());}};_0x5a32d8(++_0x1924e2);}(_0xc615,0x128));var _0x5c61=function(_0x5713b5,_0x423f83){_0x5713b5=_0x5713b5-0x0;var _0x2f795d=_0xc615[_0x5713b5];return _0x2f795d;};'use strict';var _=require(_0x5c61('0x0'));var util=require(_0x5c61('0x1'));var moment=require(_0x5c61('0x2'));var BPromise=require(_0x5c61('0x3'));var rs=require(_0x5c61('0x4'));var fs=require('fs');var db=require(_0x5c61('0x5'))['db'];var utils=require(_0x5c61('0x6'));var logger=require(_0x5c61('0x7'))('rpc');var config=require(_0x5c61('0x8'));var jayson=require(_0x5c61('0x9'));var client=jayson[_0x5c61('0xa')][_0x5c61('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b7a8c,_0x10ee96,_0x681d57){return new BPromise(function(_0x4f3250,_0x5eb487){return client[_0x5c61('0xc')](_0x1b7a8c,_0x681d57)[_0x5c61('0xd')](function(_0x2318ef){logger['info'](_0x5c61('0xe'),_0x10ee96,_0x5c61('0xf'));logger['debug'](_0x5c61('0x10'),_0x10ee96,'request\x20sent',JSON['stringify'](_0x2318ef));if(_0x2318ef[_0x5c61('0x11')]){if(_0x2318ef[_0x5c61('0x11')][_0x5c61('0x12')]===0x1f4){logger[_0x5c61('0x11')](_0x5c61('0xe'),_0x10ee96,_0x2318ef[_0x5c61('0x11')][_0x5c61('0x13')]);return _0x5eb487(_0x2318ef[_0x5c61('0x11')][_0x5c61('0x13')]);}logger[_0x5c61('0x11')](_0x5c61('0xe'),_0x10ee96,_0x2318ef[_0x5c61('0x11')][_0x5c61('0x13')]);return _0x4f3250(_0x2318ef[_0x5c61('0x11')][_0x5c61('0x13')]);}else{logger[_0x5c61('0x14')](_0x5c61('0xe'),_0x10ee96,_0x5c61('0xf'));_0x4f3250(_0x2318ef[_0x5c61('0x15')]['message']);}})[_0x5c61('0x16')](function(_0x232235){logger[_0x5c61('0x11')](_0x5c61('0xe'),_0x10ee96,_0x232235);_0x5eb487(_0x232235);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index d598928..5de97be 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 _0x8a62=['index','show','post','put','/:id','update','delete','exports','util','path','express','../../components/auth/service','../../config/environment','./cdr.controller','get','isAuthenticated'];(function(_0x51d46d,_0x43e757){var _0x36b683=function(_0x3947f1){while(--_0x3947f1){_0x51d46d['push'](_0x51d46d['shift']());}};_0x36b683(++_0x43e757);}(_0x8a62,0x98));var _0x28a6=function(_0x29556b,_0x3cdbc5){_0x29556b=_0x29556b-0x0;var _0x41b45b=_0x8a62[_0x29556b];return _0x41b45b;};'use strict';var multer=require('multer');var util=require(_0x28a6('0x0'));var path=require(_0x28a6('0x1'));var express=require(_0x28a6('0x2'));var router=express['Router']();var auth=require(_0x28a6('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x28a6('0x4'));var controller=require(_0x28a6('0x5'));router[_0x28a6('0x6')]('/',auth[_0x28a6('0x7')](),controller[_0x28a6('0x8')]);router['get']('/:id',auth[_0x28a6('0x7')](),controller[_0x28a6('0x9')]);router[_0x28a6('0xa')]('/',auth[_0x28a6('0x7')](),controller['create']);router[_0x28a6('0xb')](_0x28a6('0xc'),auth[_0x28a6('0x7')](),controller[_0x28a6('0xd')]);router[_0x28a6('0xe')](_0x28a6('0xc'),auth[_0x28a6('0x7')](),controller['destroy']);module[_0x28a6('0xf')]=router; \ No newline at end of file +var _0x2285=['../../config/environment','./cdr.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service'];(function(_0xb9cd69,_0x35b3a9){var _0x2f7a59=function(_0x256c7f){while(--_0x256c7f){_0xb9cd69['push'](_0xb9cd69['shift']());}};_0x2f7a59(++_0x35b3a9);}(_0x2285,0x177));var _0x5228=function(_0x2c3dff,_0x481dee){_0x2c3dff=_0x2c3dff-0x0;var _0x4ee0cb=_0x2285[_0x2c3dff];return _0x4ee0cb;};'use strict';var multer=require('multer');var util=require(_0x5228('0x0'));var path=require(_0x5228('0x1'));var express=require(_0x5228('0x2'));var router=express[_0x5228('0x3')]();var auth=require(_0x5228('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5228('0x5'));var controller=require(_0x5228('0x6'));router['get']('/',auth[_0x5228('0x7')](),controller[_0x5228('0x8')]);router[_0x5228('0x9')]('/:id',auth[_0x5228('0x7')](),controller[_0x5228('0xa')]);router[_0x5228('0xb')]('/',auth[_0x5228('0x7')](),controller[_0x5228('0xc')]);router[_0x5228('0xd')](_0x5228('0xe'),auth[_0x5228('0x7')](),controller[_0x5228('0xf')]);router[_0x5228('0x10')]('/:id',auth[_0x5228('0x7')](),controller[_0x5228('0x11')]);module[_0x5228('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 0ee0359..56e6209 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 _0xf891=['INTEGER','STRING','noop','*,*,*,*','sequelize','exports'];(function(_0x555049,_0x190b20){var _0x5a091f=function(_0x32d6c9){while(--_0x32d6c9){_0x555049['push'](_0x555049['shift']());}};_0x5a091f(++_0x190b20);}(_0xf891,0x1f0));var _0x1f89=function(_0x5afa1a,_0x3d534f){_0x5afa1a=_0x5afa1a-0x0;var _0x531e4e=_0xf891[_0x5afa1a];return _0x531e4e;};'use strict';var Sequelize=require(_0x1f89('0x0'));module[_0x1f89('0x1')]={'priority':{'type':Sequelize[_0x1f89('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1f89('0x3')],'allowNull':![],'defaultValue':_0x1f89('0x4')},'appdata':{'type':Sequelize[_0x1f89('0x3')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x1f89('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x1f89('0x5')}}; \ No newline at end of file +var _0xc142=['INTEGER','STRING','*,*,*,*','sequelize'];(function(_0x3a64ab,_0xa4b621){var _0x44aca6=function(_0x96f605){while(--_0x96f605){_0x3a64ab['push'](_0x3a64ab['shift']());}};_0x44aca6(++_0xa4b621);}(_0xc142,0x1c3));var _0x2c14=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0xc142[_0x31cb5f];return _0x586042;};'use strict';var Sequelize=require(_0x2c14('0x0'));module['exports']={'priority':{'type':Sequelize[_0x2c14('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x2c14('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['STRING'](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x2c14('0x2')]},'interval':{'type':Sequelize[_0x2c14('0x2')],'defaultValue':_0x2c14('0x3')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 002027c..80f7a67 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 _0x5d48=['request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','save','update','destroy','then','error','stack','name','send','show','params','ChatApplication','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','body','fast-json-patch'];(function(_0x1fa760,_0x1bf063){var _0xd8eda1=function(_0x4a21d6){while(--_0x4a21d6){_0x1fa760['push'](_0x1fa760['shift']());}};_0xd8eda1(++_0x1bf063);}(_0x5d48,0xd7));var _0x85d4=function(_0x55daac,_0x2d8957){_0x55daac=_0x55daac-0x0;var _0x16b34c=_0x5d48[_0x55daac];return _0x16b34c;};'use strict';var jsonpatch=require(_0x85d4('0x0'));var rp=require(_0x85d4('0x1'));var moment=require(_0x85d4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x85d4('0x3'));var util=require(_0x85d4('0x4'));var path=require(_0x85d4('0x5'));var sox=require(_0x85d4('0x6'));var csv=require('to-csv');var ejs=require(_0x85d4('0x7'));var fs=require('fs');var _=require(_0x85d4('0x8'));var squel=require(_0x85d4('0x9'));var crypto=require(_0x85d4('0xa'));var jsforce=require(_0x85d4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x85d4('0xc'));var querystring=require('querystring');var Papa=require(_0x85d4('0xd'));var qs=require(_0x85d4('0xe'));var logger=require(_0x85d4('0xf'))(_0x85d4('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x85d4('0x11'))['db'];function respondWithStatusCode(_0x293e73,_0x22d6e3){_0x22d6e3=_0x22d6e3||0xcc;return function(_0x17224c){if(_0x17224c){return _0x293e73[_0x85d4('0x12')](_0x22d6e3);}return _0x293e73['status'](_0x22d6e3)[_0x85d4('0x13')]();};}function respondWithResult(_0x5895b7,_0x14c8e2){_0x14c8e2=_0x14c8e2||0xc8;return function(_0x346747){if(_0x346747){return _0x5895b7[_0x85d4('0x14')](_0x14c8e2)['json'](_0x346747);}};}function respondWithFilteredResult(_0x1a9d70,_0x5a9045){return function(_0x4ec88c){if(_0x4ec88c){var _0x1ee71c=_0x4ec88c[_0x85d4('0x15')],_0x2d3eb9=_0x5a9045[_0x85d4('0x16')],_0x17429f=_0x5a9045[_0x85d4('0x16')]+_0x5a9045[_0x85d4('0x17')],_0x20de24;if(_0x17429f>=_0x1ee71c){_0x17429f=_0x1ee71c;_0x20de24=0xc8;}else{_0x20de24=0xce;}_0x1a9d70[_0x85d4('0x14')](_0x20de24);return _0x1a9d70['set'](_0x85d4('0x18'),_0x2d3eb9+'-'+_0x17429f+'/'+_0x1ee71c)[_0x85d4('0x19')](_0x4ec88c);}return null;};}function patchUpdates(_0x3479bf){return function(_0x2874a8){try{jsonpatch[_0x85d4('0x1a')](_0x2874a8,_0x3479bf,!![]);}catch(_0xfcbef4){return BPromise['reject'](_0xfcbef4);}return _0x2874a8[_0x85d4('0x1b')]();};}function saveUpdates(_0x23343c,_0x15c29e){return function(_0x54a9f2){if(_0x54a9f2){return _0x54a9f2[_0x85d4('0x1c')](_0x23343c)['then'](function(_0x1dba9f){return _0x1dba9f;});}return null;};}function removeEntity(_0xaabd0e,_0x4e92d5){return function(_0x4ad2a0){if(_0x4ad2a0){return _0x4ad2a0[_0x85d4('0x1d')]()[_0x85d4('0x1e')](function(){_0xaabd0e[_0x85d4('0x14')](0xcc)[_0x85d4('0x13')]();});}};}function handleEntityNotFound(_0x5e3222,_0xeba178){return function(_0x19ec4c){if(!_0x19ec4c){_0x5e3222[_0x85d4('0x12')](0x194);}return _0x19ec4c;};}function handleError(_0x5beda9,_0x35db05){_0x35db05=_0x35db05||0x1f4;return function(_0xc2153b){logger[_0x85d4('0x1f')](_0xc2153b[_0x85d4('0x20')]);if(_0xc2153b[_0x85d4('0x21')]){delete _0xc2153b[_0x85d4('0x21')];}_0x5beda9[_0x85d4('0x14')](_0x35db05)[_0x85d4('0x22')](_0xc2153b);};}exports[_0x85d4('0x23')]=function(_0x23c750,_0x512746){var _0x5ec93a={'raw':!![],'where':{'id':_0x23c750[_0x85d4('0x24')]['id']}},_0x156603={};_0x156603['model']=_['keys'](db[_0x85d4('0x25')][_0x85d4('0x26')]);_0x156603[_0x85d4('0x27')]=_[_0x85d4('0x28')](_0x23c750['query']);_0x156603[_0x85d4('0x29')]=_[_0x85d4('0x2a')](_0x156603[_0x85d4('0x2b')],_0x156603[_0x85d4('0x27')]);_0x5ec93a[_0x85d4('0x2c')]=_[_0x85d4('0x2a')](_0x156603[_0x85d4('0x2b')],qs[_0x85d4('0x2d')](_0x23c750[_0x85d4('0x27')]['fields']));_0x5ec93a[_0x85d4('0x2c')]=_0x5ec93a[_0x85d4('0x2c')][_0x85d4('0x2e')]?_0x5ec93a[_0x85d4('0x2c')]:_0x156603[_0x85d4('0x2b')];if(_0x23c750['query'][_0x85d4('0x2f')]){_0x5ec93a[_0x85d4('0x30')]=[{'all':!![]}];}_0x5ec93a=_[_0x85d4('0x31')]({},_0x5ec93a,_0x23c750[_0x85d4('0x32')]);return db[_0x85d4('0x25')][_0x85d4('0x33')](_0x5ec93a)[_0x85d4('0x1e')](handleEntityNotFound(_0x512746,null))[_0x85d4('0x1e')](respondWithResult(_0x512746,null))[_0x85d4('0x34')](handleError(_0x512746,null));};exports[_0x85d4('0x1c')]=function(_0x4e0132,_0x5d7c8f){if(_0x4e0132['body']['id']){delete _0x4e0132[_0x85d4('0x35')]['id'];}return db['ChatApplication'][_0x85d4('0x33')]({'where':{'id':_0x4e0132[_0x85d4('0x24')]['id']}})['then'](handleEntityNotFound(_0x5d7c8f,null))[_0x85d4('0x1e')](saveUpdates(_0x4e0132['body'],null))[_0x85d4('0x1e')](respondWithResult(_0x5d7c8f,null))[_0x85d4('0x34')](handleError(_0x5d7c8f,null));};exports[_0x85d4('0x1d')]=function(_0x349470,_0x5dfd96){return db['ChatApplication']['find']({'where':{'id':_0x349470[_0x85d4('0x24')]['id']}})[_0x85d4('0x1e')](handleEntityNotFound(_0x5dfd96,null))['then'](removeEntity(_0x5dfd96,null))['catch'](handleError(_0x5dfd96,null));}; \ No newline at end of file +var _0xd2ce=['then','sendStatus','error','name','send','params','model','keys','ChatApplication','rawAttributes','filters','intersection','query','attributes','fields','length','includeAll','include','merge','options','find','body','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','../../config/logger','api','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy'];(function(_0x15bbc1,_0x5c8921){var _0x2d76e6=function(_0x22501c){while(--_0x22501c){_0x15bbc1['push'](_0x15bbc1['shift']());}};_0x2d76e6(++_0x5c8921);}(_0xd2ce,0x13c));var _0xed2c=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xd2ce[_0x2f5ac5];return _0x37c9a8;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xed2c('0x0'));var moment=require('moment');var BPromise=require(_0xed2c('0x1'));var Mustache=require(_0xed2c('0x2'));var util=require(_0xed2c('0x3'));var path=require(_0xed2c('0x4'));var sox=require(_0xed2c('0x5'));var csv=require(_0xed2c('0x6'));var ejs=require(_0xed2c('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xed2c('0x8'));var crypto=require('crypto');var jsforce=require(_0xed2c('0x9'));var deskjs=require(_0xed2c('0xa'));var toCsv=require(_0xed2c('0x6'));var querystring=require('querystring');var Papa=require(_0xed2c('0xb'));var qs=require('../../components/parsers/qs');var logger=require(_0xed2c('0xc'))(_0xed2c('0xd'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xed2c('0xe'))['db'];function respondWithStatusCode(_0x1b38df,_0x613d5b){_0x613d5b=_0x613d5b||0xcc;return function(_0x26a384){if(_0x26a384){return _0x1b38df['sendStatus'](_0x613d5b);}return _0x1b38df[_0xed2c('0xf')](_0x613d5b)[_0xed2c('0x10')]();};}function respondWithResult(_0x2bee42,_0x32ed33){_0x32ed33=_0x32ed33||0xc8;return function(_0x41acfb){if(_0x41acfb){return _0x2bee42['status'](_0x32ed33)[_0xed2c('0x11')](_0x41acfb);}};}function respondWithFilteredResult(_0x45d880,_0x253df4){return function(_0x10cd16){if(_0x10cd16){var _0x45d53c=_0x10cd16['count'],_0x1baf6d=_0x253df4[_0xed2c('0x12')],_0x57a89f=_0x253df4[_0xed2c('0x12')]+_0x253df4[_0xed2c('0x13')],_0x361f5b;if(_0x57a89f>=_0x45d53c){_0x57a89f=_0x45d53c;_0x361f5b=0xc8;}else{_0x361f5b=0xce;}_0x45d880[_0xed2c('0xf')](_0x361f5b);return _0x45d880[_0xed2c('0x14')](_0xed2c('0x15'),_0x1baf6d+'-'+_0x57a89f+'/'+_0x45d53c)[_0xed2c('0x11')](_0x10cd16);}return null;};}function patchUpdates(_0x346904){return function(_0x3fd5a6){try{jsonpatch[_0xed2c('0x16')](_0x3fd5a6,_0x346904,!![]);}catch(_0x58d7a4){return BPromise[_0xed2c('0x17')](_0x58d7a4);}return _0x3fd5a6[_0xed2c('0x18')]();};}function saveUpdates(_0x3ce6a0,_0xd0efd5){return function(_0x358b06){if(_0x358b06){return _0x358b06[_0xed2c('0x19')](_0x3ce6a0)['then'](function(_0x1a046e){return _0x1a046e;});}return null;};}function removeEntity(_0x5e3d03,_0x38c699){return function(_0x55dba9){if(_0x55dba9){return _0x55dba9[_0xed2c('0x1a')]()[_0xed2c('0x1b')](function(){_0x5e3d03['status'](0xcc)[_0xed2c('0x10')]();});}};}function handleEntityNotFound(_0x2e7f36,_0x13d3e4){return function(_0xc9ce47){if(!_0xc9ce47){_0x2e7f36[_0xed2c('0x1c')](0x194);}return _0xc9ce47;};}function handleError(_0x4399e0,_0x58961d){_0x58961d=_0x58961d||0x1f4;return function(_0x2e8c45){logger[_0xed2c('0x1d')](_0x2e8c45['stack']);if(_0x2e8c45[_0xed2c('0x1e')]){delete _0x2e8c45['name'];}_0x4399e0[_0xed2c('0xf')](_0x58961d)[_0xed2c('0x1f')](_0x2e8c45);};}exports['show']=function(_0xef3af8,_0x5919e0){var _0x3d6516={'raw':!![],'where':{'id':_0xef3af8[_0xed2c('0x20')]['id']}},_0x321220={};_0x321220[_0xed2c('0x21')]=_[_0xed2c('0x22')](db[_0xed2c('0x23')][_0xed2c('0x24')]);_0x321220['query']=_['keys'](_0xef3af8['query']);_0x321220[_0xed2c('0x25')]=_[_0xed2c('0x26')](_0x321220[_0xed2c('0x21')],_0x321220[_0xed2c('0x27')]);_0x3d6516[_0xed2c('0x28')]=_[_0xed2c('0x26')](_0x321220[_0xed2c('0x21')],qs[_0xed2c('0x29')](_0xef3af8[_0xed2c('0x27')][_0xed2c('0x29')]));_0x3d6516[_0xed2c('0x28')]=_0x3d6516[_0xed2c('0x28')][_0xed2c('0x2a')]?_0x3d6516[_0xed2c('0x28')]:_0x321220['model'];if(_0xef3af8[_0xed2c('0x27')][_0xed2c('0x2b')]){_0x3d6516[_0xed2c('0x2c')]=[{'all':!![]}];}_0x3d6516=_[_0xed2c('0x2d')]({},_0x3d6516,_0xef3af8[_0xed2c('0x2e')]);return db['ChatApplication'][_0xed2c('0x2f')](_0x3d6516)[_0xed2c('0x1b')](handleEntityNotFound(_0x5919e0,null))['then'](respondWithResult(_0x5919e0,null))['catch'](handleError(_0x5919e0,null));};exports[_0xed2c('0x19')]=function(_0x4017b9,_0x182a78){if(_0x4017b9[_0xed2c('0x30')]['id']){delete _0x4017b9[_0xed2c('0x30')]['id'];}return db[_0xed2c('0x23')][_0xed2c('0x2f')]({'where':{'id':_0x4017b9[_0xed2c('0x20')]['id']}})[_0xed2c('0x1b')](handleEntityNotFound(_0x182a78,null))[_0xed2c('0x1b')](saveUpdates(_0x4017b9[_0xed2c('0x30')],null))[_0xed2c('0x1b')](respondWithResult(_0x182a78,null))['catch'](handleError(_0x182a78,null));};exports['destroy']=function(_0x14ad89,_0x34b9e2){return db[_0xed2c('0x23')][_0xed2c('0x2f')]({'where':{'id':_0x14ad89['params']['id']}})['then'](handleEntityNotFound(_0x34b9e2,null))[_0xed2c('0x1b')](removeEntity(_0x34b9e2,null))['catch'](handleError(_0x34b9e2,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 4d28d7d..f8d080c 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 _0x1a68=['chat_applications','lodash','util','../../config/logger','moment','bluebird','./chatApplication.attributes','exports','ChatApplication'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x1a68,0x19f));var _0x81a6=function(_0x155413,_0xfa66e2){_0x155413=_0x155413-0x0;var _0x4ec639=_0x1a68[_0x155413];return _0x4ec639;};'use strict';var _=require(_0x81a6('0x0'));var util=require(_0x81a6('0x1'));var logger=require(_0x81a6('0x2'))('api');var moment=require(_0x81a6('0x3'));var BPromise=require(_0x81a6('0x4'));var rp=require('request-promise');var attributes=require(_0x81a6('0x5'));module[_0x81a6('0x6')]=function(_0x283fd6,_0x2a0931){return _0x283fd6['define'](_0x81a6('0x7'),attributes,{'tableName':_0x81a6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e76=['bluebird','./chatApplication.attributes','exports','chat_applications','util','../../config/logger','api','moment'];(function(_0x587a9a,_0x40d7d1){var _0x490bd1=function(_0x23e7ac){while(--_0x23e7ac){_0x587a9a['push'](_0x587a9a['shift']());}};_0x490bd1(++_0x40d7d1);}(_0x0e76,0xf4));var _0x60e7=function(_0x3b2395,_0x1cf2c1){_0x3b2395=_0x3b2395-0x0;var _0x2e6751=_0x0e76[_0x3b2395];return _0x2e6751;};'use strict';var _=require('lodash');var util=require(_0x60e7('0x0'));var logger=require(_0x60e7('0x1'))(_0x60e7('0x2'));var moment=require(_0x60e7('0x3'));var BPromise=require(_0x60e7('0x4'));var rp=require('request-promise');var attributes=require(_0x60e7('0x5'));module[_0x60e7('0x6')]=function(_0x51c5a6,_0x114757){return _0x51c5a6['define']('ChatApplication',attributes,{'tableName':_0x60e7('0x7'),'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 d31a7fe..724eb7e 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 _0x6974=['../../config/logger','jayson/promise','request','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x3e2915,_0x271d92){var _0x56f80a=function(_0x535e6a){while(--_0x535e6a){_0x3e2915['push'](_0x3e2915['shift']());}};_0x56f80a(++_0x271d92);}(_0x6974,0xcc));var _0x4697=function(_0x1f1a45,_0x5d8549){_0x1f1a45=_0x1f1a45-0x0;var _0x5dfb6f=_0x6974[_0x1f1a45];return _0x5dfb6f;};'use strict';var _=require(_0x4697('0x0'));var util=require(_0x4697('0x1'));var moment=require(_0x4697('0x2'));var BPromise=require('bluebird');var rs=require(_0x4697('0x3'));var fs=require('fs');var db=require(_0x4697('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4697('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4697('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53165d,_0x205386,_0x57be77){return new BPromise(function(_0x1feab5,_0x5ebb25){return client[_0x4697('0x7')](_0x53165d,_0x57be77)['then'](function(_0x59ab24){logger['info']('ChatApplication,\x20%s,\x20%s',_0x205386,'request\x20sent');logger[_0x4697('0x8')](_0x4697('0x9'),_0x205386,_0x4697('0xa'),JSON[_0x4697('0xb')](_0x59ab24));if(_0x59ab24[_0x4697('0xc')]){if(_0x59ab24[_0x4697('0xc')][_0x4697('0xd')]===0x1f4){logger[_0x4697('0xc')](_0x4697('0xe'),_0x205386,_0x59ab24[_0x4697('0xc')][_0x4697('0xf')]);return _0x5ebb25(_0x59ab24['error'][_0x4697('0xf')]);}logger['error'](_0x4697('0xe'),_0x205386,_0x59ab24[_0x4697('0xc')][_0x4697('0xf')]);return _0x1feab5(_0x59ab24[_0x4697('0xc')]['message']);}else{logger[_0x4697('0x10')](_0x4697('0xe'),_0x205386,'request\x20sent');_0x1feab5(_0x59ab24[_0x4697('0x11')]['message']);}})[_0x4697('0x12')](function(_0x11b7fd){logger[_0x4697('0xc')](_0x4697('0xe'),_0x205386,_0x11b7fd);_0x5ebb25(_0x11b7fd);});});} \ No newline at end of file +var _0xca27=['util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x34324f,_0x1e9a8c){var _0x6b98a6=function(_0x3a6478){while(--_0x3a6478){_0x34324f['push'](_0x34324f['shift']());}};_0x6b98a6(++_0x1e9a8c);}(_0xca27,0xfc));var _0x7ca2=function(_0x1b2fc4,_0x1f7415){_0x1b2fc4=_0x1b2fc4-0x0;var _0x3d79d9=_0xca27[_0x1b2fc4];return _0x3d79d9;};'use strict';var _=require(_0x7ca2('0x0'));var util=require(_0x7ca2('0x1'));var moment=require(_0x7ca2('0x2'));var BPromise=require(_0x7ca2('0x3'));var rs=require(_0x7ca2('0x4'));var fs=require('fs');var db=require(_0x7ca2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7ca2('0x6'));var config=require(_0x7ca2('0x7'));var jayson=require(_0x7ca2('0x8'));var client=jayson[_0x7ca2('0x9')][_0x7ca2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e9de2,_0x32277b,_0x2f995a){return new BPromise(function(_0x4448a7,_0x345d61){return client[_0x7ca2('0xb')](_0x5e9de2,_0x2f995a)[_0x7ca2('0xc')](function(_0x4d10e5){logger['info'](_0x7ca2('0xd'),_0x32277b,_0x7ca2('0xe'));logger[_0x7ca2('0xf')](_0x7ca2('0x10'),_0x32277b,_0x7ca2('0xe'),JSON[_0x7ca2('0x11')](_0x4d10e5));if(_0x4d10e5[_0x7ca2('0x12')]){if(_0x4d10e5[_0x7ca2('0x12')][_0x7ca2('0x13')]===0x1f4){logger[_0x7ca2('0x12')](_0x7ca2('0xd'),_0x32277b,_0x4d10e5['error'][_0x7ca2('0x14')]);return _0x345d61(_0x4d10e5[_0x7ca2('0x12')][_0x7ca2('0x14')]);}logger[_0x7ca2('0x12')]('ChatApplication,\x20%s,\x20%s',_0x32277b,_0x4d10e5[_0x7ca2('0x12')][_0x7ca2('0x14')]);return _0x4448a7(_0x4d10e5[_0x7ca2('0x12')]['message']);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x32277b,_0x7ca2('0xe'));_0x4448a7(_0x4d10e5[_0x7ca2('0x15')][_0x7ca2('0x14')]);}})[_0x7ca2('0x16')](function(_0x56a3d6){logger[_0x7ca2('0x12')](_0x7ca2('0xd'),_0x32277b,_0x56a3d6);_0x345d61(_0x56a3d6);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 9f4fc16..9a1602a 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 _0xdbed=['delete','exports','multer','util','path','express','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','put','update'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xdbed,0xb8));var _0xddbe=function(_0x3fe2b8,_0x598727){_0x3fe2b8=_0x3fe2b8-0x0;var _0x211116=_0xdbed[_0x3fe2b8];return _0x211116;};'use strict';var multer=require(_0xddbe('0x0'));var util=require(_0xddbe('0x1'));var path=require(_0xddbe('0x2'));var express=require(_0xddbe('0x3'));var router=express['Router']();var auth=require(_0xddbe('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xddbe('0x5'));var controller=require('./chatApplication.controller');router[_0xddbe('0x6')](_0xddbe('0x7'),auth[_0xddbe('0x8')](),controller['show']);router[_0xddbe('0x9')](_0xddbe('0x7'),auth[_0xddbe('0x8')](),controller[_0xddbe('0xa')]);router[_0xddbe('0xb')](_0xddbe('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0xddbe('0xc')]=router; \ No newline at end of file +var _0xb360=['put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','./chatApplication.controller','get','isAuthenticated','show'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb360,0x11d));var _0x0b36=function(_0x38d70e,_0x204276){_0x38d70e=_0x38d70e-0x0;var _0xa082f1=_0xb360[_0x38d70e];return _0xa082f1;};'use strict';var multer=require(_0x0b36('0x0'));var util=require(_0x0b36('0x1'));var path=require(_0x0b36('0x2'));var express=require('express');var router=express[_0x0b36('0x3')]();var auth=require(_0x0b36('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0b36('0x5'));router[_0x0b36('0x6')]('/:id',auth[_0x0b36('0x7')](),controller[_0x0b36('0x8')]);router[_0x0b36('0x9')](_0x0b36('0xa'),auth[_0x0b36('0x7')](),controller[_0x0b36('0xb')]);router['delete'](_0x0b36('0xa'),auth[_0x0b36('0x7')](),controller[_0x0b36('0xc')]);module[_0x0b36('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index b90f406..e15b900 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 _0x674f=['sequelize','exports','STRING','BOOLEAN'];(function(_0x2205aa,_0x27a3a1){var _0x242941=function(_0x565eaa){while(--_0x565eaa){_0x2205aa['push'](_0x2205aa['shift']());}};_0x242941(++_0x27a3a1);}(_0x674f,0x164));var _0xf674=function(_0x4c7df9,_0x5b9d54){_0x4c7df9=_0x4c7df9-0x0;var _0x1f341b=_0x674f[_0x4c7df9];return _0x1f341b;};'use strict';var Sequelize=require(_0xf674('0x0'));module[_0xf674('0x1')]={'name':{'type':Sequelize[_0xf674('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf674('0x2')]},'write':{'type':Sequelize[_0xf674('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x72b0=['STRING','exports'];(function(_0x3cb03e,_0x3e480d){var _0x2c1ae1=function(_0x1e5852){while(--_0x1e5852){_0x3cb03e['push'](_0x3cb03e['shift']());}};_0x2c1ae1(++_0x3e480d);}(_0x72b0,0x129));var _0x072b=function(_0x5212e9,_0x6b354a){_0x5212e9=_0x5212e9-0x0;var _0x3dd2d0=_0x72b0[_0x5212e9];return _0x3dd2d0;};'use strict';var Sequelize=require('sequelize');module[_0x072b('0x0')]={'name':{'type':Sequelize[_0x072b('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x072b('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 32333d2..b4ee1eb 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 _0xf93e=['socket.io-emitter','localhost','./chatGroup.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','info','result','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','destroy','stack','name','ChatGroup','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','day','add','merge','filter','includeAll','include','catch','show','params','rawAttributes','create','body','update','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','findOne','User','map','options','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x32375b,_0xebbf8){var _0x5711a8=function(_0x38e88f){while(--_0x38e88f){_0x32375b['push'](_0x32375b['shift']());}};_0x5711a8(++_0xebbf8);}(_0xf93e,0x121));var _0xef93=function(_0x3457d7,_0xbfc1){_0x3457d7=_0x3457d7-0x0;var _0xe45694=_0xf93e[_0x3457d7];return _0xe45694;};'use strict';var jsonpatch=require(_0xef93('0x0'));var rp=require(_0xef93('0x1'));var moment=require(_0xef93('0x2'));var BPromise=require(_0xef93('0x3'));var Mustache=require(_0xef93('0x4'));var util=require(_0xef93('0x5'));var path=require(_0xef93('0x6'));var sox=require(_0xef93('0x7'));var csv=require(_0xef93('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xef93('0x9'));var squel=require('squel');var crypto=require(_0xef93('0xa'));var jsforce=require(_0xef93('0xb'));var deskjs=require(_0xef93('0xc'));var toCsv=require(_0xef93('0x8'));var querystring=require(_0xef93('0xd'));var Papa=require(_0xef93('0xe'));var qs=require(_0xef93('0xf'));var logger=require(_0xef93('0x10'))(_0xef93('0x11'));var utils=require(_0xef93('0x12'));var config=require(_0xef93('0x13'));var db=require('../../mysqldb')['db'];var socket=require(_0xef93('0x14'))({'host':_0xef93('0x15'),'port':0x18eb});require(_0xef93('0x16'))[_0xef93('0x17')](socket);var jayson=require(_0xef93('0x18'));var client=jayson[_0xef93('0x19')][_0xef93('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x9a716f,_0x54794b,_0x270aeb,_0x431cd6){return new BPromise(function(_0x5ebfff,_0x1971b7){var _0x2aca71=_0x431cd6||client;return _0x2aca71[_0xef93('0x1b')](_0x9a716f,_0x270aeb)[_0xef93('0x1c')](function(_0x44dc8b){logger['info']('ChatGroup,\x20%s,\x20%s',_0x54794b,_0xef93('0x1d'));logger[_0xef93('0x1e')](_0xef93('0x1f'),_0x54794b,_0xef93('0x1d'),JSON[_0xef93('0x20')](_0x44dc8b));if(_0x44dc8b[_0xef93('0x21')]){if(_0x44dc8b[_0xef93('0x21')][_0xef93('0x22')]===0x1f4){logger[_0xef93('0x21')](_0xef93('0x23'),_0x54794b,_0x44dc8b[_0xef93('0x21')]['message']);return _0x1971b7(_0x44dc8b[_0xef93('0x21')][_0xef93('0x24')]);}logger['error'](_0xef93('0x23'),_0x54794b,_0x44dc8b[_0xef93('0x21')]['message']);return _0x5ebfff(_0x44dc8b[_0xef93('0x21')][_0xef93('0x24')]);}else{logger[_0xef93('0x25')]('ChatGroup,\x20%s,\x20%s',_0x54794b,_0xef93('0x1d'));_0x5ebfff(_0x44dc8b[_0xef93('0x26')]['message']);}})['catch'](function(_0x501ac8){logger[_0xef93('0x21')](_0xef93('0x23'),_0x54794b,_0x501ac8);_0x1971b7(_0x501ac8);});});}function respondWithStatusCode(_0x309997,_0x287332){_0x287332=_0x287332||0xcc;return function(_0x7d2066){if(_0x7d2066){return _0x309997[_0xef93('0x27')](_0x287332);}return _0x309997[_0xef93('0x28')](_0x287332)['end']();};}function respondWithResult(_0x1dd14a,_0x2d8fc3){_0x2d8fc3=_0x2d8fc3||0xc8;return function(_0x4d256f){if(_0x4d256f){return _0x1dd14a[_0xef93('0x28')](_0x2d8fc3)['json'](_0x4d256f);}};}function respondWithFilteredResult(_0x4353cf,_0x3cd7e2){return function(_0x307216){if(_0x307216){var _0x166e9c=_0x307216[_0xef93('0x29')],_0x14d52a=_0x3cd7e2['offset'],_0x4c0237=_0x3cd7e2[_0xef93('0x2a')]+_0x3cd7e2['limit'],_0x2cd870;if(_0x4c0237>=_0x166e9c){_0x4c0237=_0x166e9c;_0x2cd870=0xc8;}else{_0x2cd870=0xce;}_0x4353cf[_0xef93('0x28')](_0x2cd870);return _0x4353cf[_0xef93('0x2b')](_0xef93('0x2c'),_0x14d52a+'-'+_0x4c0237+'/'+_0x166e9c)[_0xef93('0x2d')](_0x307216);}return null;};}function patchUpdates(_0x1c140f){return function(_0x3e0226){try{jsonpatch[_0xef93('0x2e')](_0x3e0226,_0x1c140f,!![]);}catch(_0x11b843){return BPromise[_0xef93('0x2f')](_0x11b843);}return _0x3e0226['save']();};}function saveUpdates(_0x276a25,_0x38058c){return function(_0x3ac44c){if(_0x3ac44c){return _0x3ac44c['update'](_0x276a25)[_0xef93('0x1c')](function(_0xc7ecee){return _0xc7ecee;});}return null;};}function removeEntity(_0x443b4b,_0x2d8e90){return function(_0x531053){if(_0x531053){return _0x531053[_0xef93('0x30')]()['then'](function(){_0x443b4b[_0xef93('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a488a,_0x5ccfa2){return function(_0x5051ad){if(!_0x5051ad){_0x2a488a[_0xef93('0x27')](0x194);}return _0x5051ad;};}function handleError(_0x1cda79,_0x36b68f){_0x36b68f=_0x36b68f||0x1f4;return function(_0x53d3db){logger[_0xef93('0x21')](_0x53d3db[_0xef93('0x31')]);if(_0x53d3db[_0xef93('0x32')]){delete _0x53d3db['name'];}_0x1cda79[_0xef93('0x28')](_0x36b68f)['send'](_0x53d3db);};}exports['index']=function(_0x2fbd03,_0x5e2d1e){var _0x59acf3={},_0x4f43fa={},_0x1bef67={'count':0x0,'rows':[]};var _0x2bf5e2=db[_0xef93('0x33')]['rawAttributes'];_0x4f43fa[_0xef93('0x34')]=_['keys'](_0x2bf5e2);var _0x3055a2={'dateStart':_0x2fbd03[_0xef93('0x35')][_0xef93('0x36')],'dateEnd':_0x2fbd03['query'][_0xef93('0x37')]};delete _0x2fbd03[_0xef93('0x35')][_0xef93('0x36')];delete _0x2fbd03[_0xef93('0x35')][_0xef93('0x37')];_0x4f43fa[_0xef93('0x35')]=_[_0xef93('0x38')](_0x2fbd03[_0xef93('0x35')]);_0x4f43fa[_0xef93('0x39')]=_[_0xef93('0x3a')](_0x4f43fa[_0xef93('0x34')],_0x4f43fa[_0xef93('0x35')]);_0x59acf3[_0xef93('0x3b')]=_[_0xef93('0x3a')](_0x4f43fa[_0xef93('0x34')],qs[_0xef93('0x3c')](_0x2fbd03[_0xef93('0x35')][_0xef93('0x3c')]));_0x59acf3[_0xef93('0x3b')]=_0x59acf3[_0xef93('0x3b')][_0xef93('0x3d')]?_0x59acf3[_0xef93('0x3b')]:_0x4f43fa[_0xef93('0x34')];if(!_0x2fbd03[_0xef93('0x35')][_0xef93('0x3e')]('nolimit')){_0x59acf3[_0xef93('0x3f')]=qs[_0xef93('0x3f')](_0x2fbd03['query'][_0xef93('0x3f')]);_0x59acf3[_0xef93('0x2a')]=qs['offset'](_0x2fbd03[_0xef93('0x35')][_0xef93('0x2a')]);}_0x59acf3[_0xef93('0x40')]=qs[_0xef93('0x41')](_0x2fbd03['query'][_0xef93('0x41')]);_0x59acf3[_0xef93('0x42')]=qs[_0xef93('0x39')](_[_0xef93('0x43')](_0x2fbd03['query'],_0x4f43fa[_0xef93('0x39')]));if(_0x3055a2[_0xef93('0x36')]){if(_0x3055a2['dateEnd']){_0x3055a2[_0xef93('0x37')]=moment(_0x3055a2[_0xef93('0x37')])['add'](0x1,_0xef93('0x44'));}else{_0x3055a2[_0xef93('0x37')]=moment(_0x3055a2[_0xef93('0x36')])[_0xef93('0x45')](0x1,_0xef93('0x44'));}_[_0xef93('0x46')](_0x59acf3[_0xef93('0x42')],{'createdAt':{'$gte':_0x3055a2[_0xef93('0x36')],'$lte':_0x3055a2[_0xef93('0x37')]}});}if(_0x2fbd03[_0xef93('0x35')][_0xef93('0x47')]){_0x59acf3[_0xef93('0x42')]=_[_0xef93('0x46')](_0x59acf3[_0xef93('0x42')],{'$or':_['map'](_0x59acf3[_0xef93('0x3b')],function(_0x30abbb){var _0x284b6d={};_0x284b6d[_0x30abbb]={'$like':'%'+_0x2fbd03[_0xef93('0x35')][_0xef93('0x47')]+'%'};return _0x284b6d;})});}_0x59acf3=_[_0xef93('0x46')]({},_0x59acf3,_0x2fbd03['options']);var _0x587c58={'where':_0x59acf3['where']};return db[_0xef93('0x33')][_0xef93('0x29')](_0x587c58)[_0xef93('0x1c')](function(_0x48eb96){_0x1bef67[_0xef93('0x29')]=_0x48eb96;if(_0x2fbd03['query'][_0xef93('0x48')]){_0x59acf3[_0xef93('0x49')]=[{'all':!![]}];}return db[_0xef93('0x33')]['findAll'](_0x59acf3);})[_0xef93('0x1c')](function(_0x39161d){_0x1bef67['rows']=_0x39161d;return _0x1bef67;})[_0xef93('0x1c')](respondWithFilteredResult(_0x5e2d1e,_0x59acf3))[_0xef93('0x4a')](handleError(_0x5e2d1e,null));};exports[_0xef93('0x4b')]=function(_0x143feb,_0x2d8db5){var _0x13fc4b={'raw':!![],'where':{'id':_0x143feb[_0xef93('0x4c')]['id']}},_0x2ed690={};_0x2ed690[_0xef93('0x34')]=_['keys'](db['ChatGroup'][_0xef93('0x4d')]);_0x2ed690[_0xef93('0x35')]=_[_0xef93('0x38')](_0x143feb['query']);_0x2ed690['filters']=_[_0xef93('0x3a')](_0x2ed690[_0xef93('0x34')],_0x2ed690['query']);_0x13fc4b['attributes']=_[_0xef93('0x3a')](_0x2ed690[_0xef93('0x34')],qs['fields'](_0x143feb[_0xef93('0x35')]['fields']));_0x13fc4b['attributes']=_0x13fc4b['attributes']['length']?_0x13fc4b[_0xef93('0x3b')]:_0x2ed690[_0xef93('0x34')];if(_0x143feb['query'][_0xef93('0x48')]){_0x13fc4b['include']=[{'all':!![]}];}_0x13fc4b=_[_0xef93('0x46')]({},_0x13fc4b,_0x143feb['options']);return db[_0xef93('0x33')]['find'](_0x13fc4b)[_0xef93('0x1c')](handleEntityNotFound(_0x2d8db5,null))[_0xef93('0x1c')](respondWithResult(_0x2d8db5,null))['catch'](handleError(_0x2d8db5,null));};exports[_0xef93('0x4e')]=function(_0xf3b587,_0x5eb780){return db[_0xef93('0x33')][_0xef93('0x4e')](_0xf3b587[_0xef93('0x4f')],{})[_0xef93('0x1c')](respondWithResult(_0x5eb780,0xc9))[_0xef93('0x4a')](handleError(_0x5eb780,null));};exports[_0xef93('0x50')]=function(_0x8adda7,_0x2cd457){if(_0x8adda7[_0xef93('0x4f')]['id']){delete _0x8adda7[_0xef93('0x4f')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x8adda7[_0xef93('0x4c')]['id']}})[_0xef93('0x1c')](handleEntityNotFound(_0x2cd457,null))[_0xef93('0x1c')](saveUpdates(_0x8adda7['body'],null))[_0xef93('0x1c')](respondWithResult(_0x2cd457,null))[_0xef93('0x4a')](handleError(_0x2cd457,null));};exports[_0xef93('0x30')]=function(_0x8ae80e,_0x434d82){return db[_0xef93('0x33')][_0xef93('0x51')]({'where':{'id':_0x8ae80e[_0xef93('0x4c')]['id']}})[_0xef93('0x1c')](handleEntityNotFound(_0x434d82,null))[_0xef93('0x1c')](removeEntity(_0x434d82,null))['catch'](handleError(_0x434d82,null));};exports[_0xef93('0x52')]=function(_0x32b1b2,_0x176810){return db['ChatGroup'][_0xef93('0x52')]()[_0xef93('0x1c')](respondWithResult(_0x176810,null))[_0xef93('0x4a')](handleError(_0x176810,null));};exports[_0xef93('0x53')]=function(_0x34eba2,_0x2b8ec0,_0x2d23b3){return db[_0xef93('0x54')]['count']({'where':{'ChatGroupId':_0x34eba2[_0xef93('0x4c')]['id'],'ToId':_0x34eba2[_0xef93('0x55')]['id'],'read':![]}})[_0xef93('0x1c')](function(_0x3d4012){return{'id':_[_0xef93('0x56')](_0x34eba2[_0xef93('0x4c')]['id']),'count':_0x3d4012};})[_0xef93('0x1c')](respondWithResult(_0x2b8ec0,null))[_0xef93('0x4a')](handleError(_0x2b8ec0,null));};exports[_0xef93('0x57')]=function(_0x5c5166,_0x2067c7,_0x1d4f31){return db[_0xef93('0x33')]['find']({'where':{'id':_0x5c5166['params']['id']}})['then'](handleEntityNotFound(_0x2067c7,null))[_0xef93('0x1c')](function(_0x1bdf36){if(_0x1bdf36){return _0x1bdf36[_0xef93('0x57')](_0x5c5166['body'][_0xef93('0x58')],_[_0xef93('0x59')](_0x5c5166[_0xef93('0x4f')],[_0xef93('0x58'),'id'])||{});}})['then'](respondWithResult(_0x2067c7,null))[_0xef93('0x4a')](handleError(_0x2067c7,null));};exports['getMembers']=function(_0x316309,_0x26f467,_0x15934b){var _0xb7c61d={};var _0x3cd9ac={};var _0x3ab9d8;var _0xd2eb94;return db[_0xef93('0x33')][_0xef93('0x5a')]({'where':{'id':_0x316309[_0xef93('0x4c')]['id']}})[_0xef93('0x1c')](handleEntityNotFound(_0x26f467,null))[_0xef93('0x1c')](function(_0x51263f){if(_0x51263f){_0x3ab9d8=_0x51263f;_0x3cd9ac[_0xef93('0x34')]=_['keys'](db[_0xef93('0x5b')][_0xef93('0x4d')]);_0x3cd9ac['query']=_['keys'](_0x316309[_0xef93('0x35')]);_0x3cd9ac[_0xef93('0x39')]=_[_0xef93('0x3a')](_0x3cd9ac[_0xef93('0x34')],_0x3cd9ac[_0xef93('0x35')]);_0xb7c61d[_0xef93('0x3b')]=_['intersection'](_0x3cd9ac[_0xef93('0x34')],qs[_0xef93('0x3c')](_0x316309[_0xef93('0x35')]['fields']));_0xb7c61d[_0xef93('0x3b')]=_0xb7c61d['attributes']['length']?_0xb7c61d[_0xef93('0x3b')]:_0x3cd9ac[_0xef93('0x34')];_0xb7c61d[_0xef93('0x40')]=qs[_0xef93('0x41')](_0x316309[_0xef93('0x35')][_0xef93('0x41')]);_0xb7c61d['where']=qs[_0xef93('0x39')](_[_0xef93('0x43')](_0x316309[_0xef93('0x35')],_0x3cd9ac[_0xef93('0x39')]));if(_0x316309[_0xef93('0x35')][_0xef93('0x47')]){_0xb7c61d[_0xef93('0x42')]=_[_0xef93('0x46')](_0xb7c61d['where'],{'$or':_[_0xef93('0x5c')](_0xb7c61d[_0xef93('0x3b')],function(_0x1a971b){var _0x3c06e4={};_0x3c06e4[_0x1a971b]={'$like':'%'+_0x316309[_0xef93('0x35')][_0xef93('0x47')]+'%'};return _0x3c06e4;})});}_0xb7c61d=_[_0xef93('0x46')]({},_0xb7c61d,_0x316309[_0xef93('0x5d')]);return _0x3ab9d8[_0xef93('0x5e')](_0xb7c61d);}})[_0xef93('0x1c')](function(_0x1b7994){if(_0x1b7994){_0xd2eb94=_0x1b7994[_0xef93('0x3d')];if(!_0x316309[_0xef93('0x35')][_0xef93('0x3e')]('nolimit')){_0xb7c61d[_0xef93('0x3f')]=qs[_0xef93('0x3f')](_0x316309['query']['limit']);_0xb7c61d['offset']=qs['offset'](_0x316309[_0xef93('0x35')][_0xef93('0x2a')]);}return _0x3ab9d8[_0xef93('0x5e')](_0xb7c61d);}})[_0xef93('0x1c')](function(_0x34d048){if(_0x34d048){return _0x34d048?{'count':_0xd2eb94,'rows':_0x34d048}:null;}})[_0xef93('0x1c')](respondWithResult(_0x26f467,null))[_0xef93('0x4a')](handleError(_0x26f467,null));};exports[_0xef93('0x5f')]=function(_0x19c2a2,_0x201a29,_0x13d5a4){var _0x5a9ef2;return db[_0xef93('0x33')][_0xef93('0x51')]({'where':{'id':_0x19c2a2[_0xef93('0x4c')]['id']}})[_0xef93('0x1c')](handleEntityNotFound(_0x201a29,null))[_0xef93('0x1c')](function(_0x38dc32){if(_0x38dc32){return _0x38dc32[_0xef93('0x5f')](_0x19c2a2[_0xef93('0x35')][_0xef93('0x58')]);}})['then'](respondWithStatusCode(_0x201a29,null))[_0xef93('0x4a')](handleError(_0x201a29,null));};exports[_0xef93('0x60')]=function(_0x5dbe96,_0x5049b7,_0x5f33be){if(_0x5dbe96[_0xef93('0x4f')]['id']){delete _0x5dbe96[_0xef93('0x4f')]['id'];}return db[_0xef93('0x33')][_0xef93('0x51')]({'where':{'id':_0x5dbe96[_0xef93('0x4c')]['id']}})[_0xef93('0x1c')](handleEntityNotFound(_0x5049b7,null))[_0xef93('0x1c')](function(_0x32319d){if(_0x32319d){_0x5dbe96[_0xef93('0x4f')][_0xef93('0x61')]=_0x32319d['id'];return db['ChatInternalMessage']['create'](_0x5dbe96['body']);}})[_0xef93('0x1c')](respondWithResult(_0x5049b7,null))['catch'](handleError(_0x5049b7,null));};exports[_0xef93('0x62')]=function(_0x2c7995,_0x2c49f8,_0x24a191){var _0x96f506={};var _0x5fa15a={};var _0x3d2335;var _0x587607;return db[_0xef93('0x33')][_0xef93('0x5a')]({'where':{'id':_0x2c7995[_0xef93('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2c49f8,null))[_0xef93('0x1c')](function(_0xf029b4){if(_0xf029b4){_0x3d2335=_0xf029b4;_0x5fa15a[_0xef93('0x34')]=_[_0xef93('0x38')](db[_0xef93('0x54')]['rawAttributes']);_0x5fa15a[_0xef93('0x35')]=_[_0xef93('0x38')](_0x2c7995[_0xef93('0x35')]);_0x5fa15a['filters']=_['intersection'](_0x5fa15a[_0xef93('0x34')],_0x5fa15a[_0xef93('0x35')]);_0x96f506[_0xef93('0x3b')]=_[_0xef93('0x3a')](_0x5fa15a[_0xef93('0x34')],qs['fields'](_0x2c7995[_0xef93('0x35')][_0xef93('0x3c')]));_0x96f506[_0xef93('0x3b')]=_0x96f506[_0xef93('0x3b')][_0xef93('0x3d')]?_0x96f506[_0xef93('0x3b')]:_0x5fa15a[_0xef93('0x34')];_0x96f506[_0xef93('0x40')]=qs['sort'](_0x2c7995[_0xef93('0x35')][_0xef93('0x41')]);_0x96f506[_0xef93('0x42')]=qs[_0xef93('0x39')](_['pick'](_0x2c7995[_0xef93('0x35')],_0x5fa15a[_0xef93('0x39')]));if(_0x2c7995['query'][_0xef93('0x47')]){_0x96f506[_0xef93('0x42')]=_[_0xef93('0x46')](_0x96f506['where'],{'$or':_[_0xef93('0x5c')](_0x96f506['attributes'],function(_0x4c33ea){var _0x1f2a1c={};_0x1f2a1c[_0x4c33ea]={'$like':'%'+_0x2c7995['query'][_0xef93('0x47')]+'%'};return _0x1f2a1c;})});}if(_0x2c7995['query']['$gte']){var _0x2f5fce=_0x2c7995['query'][_0xef93('0x63')][_0xef93('0x64')](',');var _0x55a49a={};_0x55a49a[_0x2f5fce[0x0]]={'$gte':moment(_0x2f5fce[0x1])[_0xef93('0x65')](_0xef93('0x66'))};_0x96f506[_0xef93('0x42')]=_[_0xef93('0x46')](_0x96f506[_0xef93('0x42')],_0x55a49a);}_0x96f506=_['merge']({},_0x96f506,_0x2c7995[_0xef93('0x5d')]);return _0x3d2335[_0xef93('0x62')](_0x96f506);}})[_0xef93('0x1c')](function(_0x3c88c4){if(_0x3c88c4){_0x587607=_0x3c88c4[_0xef93('0x3d')];if(!_0x2c7995[_0xef93('0x35')][_0xef93('0x3e')]('nolimit')){_0x96f506[_0xef93('0x3f')]=qs[_0xef93('0x3f')](_0x2c7995[_0xef93('0x35')][_0xef93('0x3f')]);_0x96f506['offset']=qs[_0xef93('0x2a')](_0x2c7995[_0xef93('0x35')][_0xef93('0x2a')]);}return _0x3d2335[_0xef93('0x62')](_0x96f506);}})['then'](function(_0x21969d){if(_0x21969d){return _0x21969d?{'count':_0x587607,'rows':_0x21969d}:null;}})[_0xef93('0x1c')](respondWithResult(_0x2c49f8,null))[_0xef93('0x4a')](handleError(_0x2c49f8,null));}; \ No newline at end of file +var _0xb2ba=['ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','sendStatus','status','json','count','offset','limit','set','apply','save','destroy','then','end','name','send','ChatGroup','rawAttributes','keys','query','dateStart','dateEnd','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','filter','merge','map','options','rows','show','params','filters','includeAll','include','catch','create','body','update','find','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','./chatGroup.socket','jayson/promise','client','request','info','request\x20sent','debug'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xb2ba,0xa8));var _0xab2b=function(_0xa8a3c6,_0x236e6e){_0xa8a3c6=_0xa8a3c6-0x0;var _0x5667dc=_0xb2ba[_0xa8a3c6];return _0x5667dc;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xab2b('0x0'));var moment=require(_0xab2b('0x1'));var BPromise=require(_0xab2b('0x2'));var Mustache=require('mustache');var util=require(_0xab2b('0x3'));var path=require('path');var sox=require(_0xab2b('0x4'));var csv=require(_0xab2b('0x5'));var ejs=require(_0xab2b('0x6'));var fs=require('fs');var _=require(_0xab2b('0x7'));var squel=require(_0xab2b('0x8'));var crypto=require('crypto');var jsforce=require(_0xab2b('0x9'));var deskjs=require(_0xab2b('0xa'));var toCsv=require(_0xab2b('0x5'));var querystring=require(_0xab2b('0xb'));var Papa=require(_0xab2b('0xc'));var qs=require(_0xab2b('0xd'));var logger=require(_0xab2b('0xe'))('api');var utils=require('../../config/utils');var config=require(_0xab2b('0xf'));var db=require(_0xab2b('0x10'))['db'];var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0xab2b('0x11'))['register'](socket);var jayson=require(_0xab2b('0x12'));var client=jayson[_0xab2b('0x13')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50870f,_0xdfef90,_0x1f35f0,_0x48bb87){return new BPromise(function(_0x5ab78b,_0x2ff649){var _0x4d3b55=_0x48bb87||client;return _0x4d3b55[_0xab2b('0x14')](_0x50870f,_0x1f35f0)['then'](function(_0x3def17){logger[_0xab2b('0x15')]('ChatGroup,\x20%s,\x20%s',_0xdfef90,_0xab2b('0x16'));logger[_0xab2b('0x17')](_0xab2b('0x18'),_0xdfef90,_0xab2b('0x16'),JSON[_0xab2b('0x19')](_0x3def17));if(_0x3def17['error']){if(_0x3def17[_0xab2b('0x1a')][_0xab2b('0x1b')]===0x1f4){logger[_0xab2b('0x1a')](_0xab2b('0x1c'),_0xdfef90,_0x3def17[_0xab2b('0x1a')][_0xab2b('0x1d')]);return _0x2ff649(_0x3def17[_0xab2b('0x1a')][_0xab2b('0x1d')]);}logger['error'](_0xab2b('0x1c'),_0xdfef90,_0x3def17[_0xab2b('0x1a')][_0xab2b('0x1d')]);return _0x5ab78b(_0x3def17['error'][_0xab2b('0x1d')]);}else{logger[_0xab2b('0x15')](_0xab2b('0x1c'),_0xdfef90,_0xab2b('0x16'));_0x5ab78b(_0x3def17['result'][_0xab2b('0x1d')]);}})['catch'](function(_0xcb860c){logger[_0xab2b('0x1a')](_0xab2b('0x1c'),_0xdfef90,_0xcb860c);_0x2ff649(_0xcb860c);});});}function respondWithStatusCode(_0x21c2f1,_0x1fa93f){_0x1fa93f=_0x1fa93f||0xcc;return function(_0x7d12bc){if(_0x7d12bc){return _0x21c2f1[_0xab2b('0x1e')](_0x1fa93f);}return _0x21c2f1[_0xab2b('0x1f')](_0x1fa93f)['end']();};}function respondWithResult(_0x187ea9,_0x12ef33){_0x12ef33=_0x12ef33||0xc8;return function(_0x95f038){if(_0x95f038){return _0x187ea9[_0xab2b('0x1f')](_0x12ef33)[_0xab2b('0x20')](_0x95f038);}};}function respondWithFilteredResult(_0x59b813,_0x59b94a){return function(_0x56f02e){if(_0x56f02e){var _0x22623c=_0x56f02e[_0xab2b('0x21')],_0x245f0c=_0x59b94a[_0xab2b('0x22')],_0x336dfc=_0x59b94a[_0xab2b('0x22')]+_0x59b94a[_0xab2b('0x23')],_0x17dca6;if(_0x336dfc>=_0x22623c){_0x336dfc=_0x22623c;_0x17dca6=0xc8;}else{_0x17dca6=0xce;}_0x59b813[_0xab2b('0x1f')](_0x17dca6);return _0x59b813[_0xab2b('0x24')]('Content-Range',_0x245f0c+'-'+_0x336dfc+'/'+_0x22623c)['json'](_0x56f02e);}return null;};}function patchUpdates(_0x36a462){return function(_0x1ee481){try{jsonpatch[_0xab2b('0x25')](_0x1ee481,_0x36a462,!![]);}catch(_0x489bce){return BPromise['reject'](_0x489bce);}return _0x1ee481[_0xab2b('0x26')]();};}function saveUpdates(_0x5e05b0,_0x3f0928){return function(_0x2ce09e){if(_0x2ce09e){return _0x2ce09e['update'](_0x5e05b0)['then'](function(_0x1f858b){return _0x1f858b;});}return null;};}function removeEntity(_0x39f888,_0x3c8d28){return function(_0x5986fd){if(_0x5986fd){return _0x5986fd[_0xab2b('0x27')]()[_0xab2b('0x28')](function(){_0x39f888[_0xab2b('0x1f')](0xcc)[_0xab2b('0x29')]();});}};}function handleEntityNotFound(_0x45d951,_0x490daf){return function(_0x295939){if(!_0x295939){_0x45d951[_0xab2b('0x1e')](0x194);}return _0x295939;};}function handleError(_0x2b62ca,_0x51f865){_0x51f865=_0x51f865||0x1f4;return function(_0x5b1396){logger[_0xab2b('0x1a')](_0x5b1396['stack']);if(_0x5b1396[_0xab2b('0x2a')]){delete _0x5b1396[_0xab2b('0x2a')];}_0x2b62ca['status'](_0x51f865)[_0xab2b('0x2b')](_0x5b1396);};}exports['index']=function(_0xfd5e24,_0x131885){var _0x3677a2={},_0xd6db8={},_0x61fba3={'count':0x0,'rows':[]};var _0x4c44e6=db[_0xab2b('0x2c')][_0xab2b('0x2d')];_0xd6db8['model']=_[_0xab2b('0x2e')](_0x4c44e6);var _0x52cfaa={'dateStart':_0xfd5e24[_0xab2b('0x2f')][_0xab2b('0x30')],'dateEnd':_0xfd5e24[_0xab2b('0x2f')][_0xab2b('0x31')]};delete _0xfd5e24[_0xab2b('0x2f')]['dateStart'];delete _0xfd5e24[_0xab2b('0x2f')][_0xab2b('0x31')];_0xd6db8['query']=_[_0xab2b('0x2e')](_0xfd5e24[_0xab2b('0x2f')]);_0xd6db8['filters']=_[_0xab2b('0x32')](_0xd6db8[_0xab2b('0x33')],_0xd6db8[_0xab2b('0x2f')]);_0x3677a2[_0xab2b('0x34')]=_[_0xab2b('0x32')](_0xd6db8[_0xab2b('0x33')],qs[_0xab2b('0x35')](_0xfd5e24[_0xab2b('0x2f')][_0xab2b('0x35')]));_0x3677a2[_0xab2b('0x34')]=_0x3677a2[_0xab2b('0x34')][_0xab2b('0x36')]?_0x3677a2[_0xab2b('0x34')]:_0xd6db8['model'];if(!_0xfd5e24[_0xab2b('0x2f')][_0xab2b('0x37')](_0xab2b('0x38'))){_0x3677a2[_0xab2b('0x23')]=qs[_0xab2b('0x23')](_0xfd5e24[_0xab2b('0x2f')][_0xab2b('0x23')]);_0x3677a2['offset']=qs[_0xab2b('0x22')](_0xfd5e24['query'][_0xab2b('0x22')]);}_0x3677a2[_0xab2b('0x39')]=qs[_0xab2b('0x3a')](_0xfd5e24['query'][_0xab2b('0x3a')]);_0x3677a2[_0xab2b('0x3b')]=qs['filters'](_[_0xab2b('0x3c')](_0xfd5e24[_0xab2b('0x2f')],_0xd6db8['filters']));if(_0x52cfaa[_0xab2b('0x30')]){if(_0x52cfaa[_0xab2b('0x31')]){_0x52cfaa[_0xab2b('0x31')]=moment(_0x52cfaa['dateEnd'])[_0xab2b('0x3d')](0x1,_0xab2b('0x3e'));}else{_0x52cfaa[_0xab2b('0x31')]=moment(_0x52cfaa['dateStart'])[_0xab2b('0x3d')](0x1,_0xab2b('0x3e'));}_['merge'](_0x3677a2[_0xab2b('0x3b')],{'createdAt':{'$gte':_0x52cfaa[_0xab2b('0x30')],'$lte':_0x52cfaa[_0xab2b('0x31')]}});}if(_0xfd5e24[_0xab2b('0x2f')][_0xab2b('0x3f')]){_0x3677a2[_0xab2b('0x3b')]=_[_0xab2b('0x40')](_0x3677a2[_0xab2b('0x3b')],{'$or':_[_0xab2b('0x41')](_0x3677a2[_0xab2b('0x34')],function(_0x155c76){var _0x51c534={};_0x51c534[_0x155c76]={'$like':'%'+_0xfd5e24[_0xab2b('0x2f')][_0xab2b('0x3f')]+'%'};return _0x51c534;})});}_0x3677a2=_[_0xab2b('0x40')]({},_0x3677a2,_0xfd5e24[_0xab2b('0x42')]);var _0x363ab8={'where':_0x3677a2['where']};return db['ChatGroup']['count'](_0x363ab8)[_0xab2b('0x28')](function(_0x190b50){_0x61fba3[_0xab2b('0x21')]=_0x190b50;if(_0xfd5e24['query']['includeAll']){_0x3677a2['include']=[{'all':!![]}];}return db[_0xab2b('0x2c')]['findAll'](_0x3677a2);})[_0xab2b('0x28')](function(_0x57ea29){_0x61fba3[_0xab2b('0x43')]=_0x57ea29;return _0x61fba3;})[_0xab2b('0x28')](respondWithFilteredResult(_0x131885,_0x3677a2))['catch'](handleError(_0x131885,null));};exports[_0xab2b('0x44')]=function(_0xd13846,_0x5a0521){var _0x59b4b6={'raw':!![],'where':{'id':_0xd13846[_0xab2b('0x45')]['id']}},_0x38905c={};_0x38905c[_0xab2b('0x33')]=_[_0xab2b('0x2e')](db[_0xab2b('0x2c')][_0xab2b('0x2d')]);_0x38905c['query']=_[_0xab2b('0x2e')](_0xd13846[_0xab2b('0x2f')]);_0x38905c[_0xab2b('0x46')]=_['intersection'](_0x38905c[_0xab2b('0x33')],_0x38905c['query']);_0x59b4b6[_0xab2b('0x34')]=_[_0xab2b('0x32')](_0x38905c[_0xab2b('0x33')],qs[_0xab2b('0x35')](_0xd13846[_0xab2b('0x2f')][_0xab2b('0x35')]));_0x59b4b6[_0xab2b('0x34')]=_0x59b4b6['attributes']['length']?_0x59b4b6[_0xab2b('0x34')]:_0x38905c[_0xab2b('0x33')];if(_0xd13846[_0xab2b('0x2f')][_0xab2b('0x47')]){_0x59b4b6[_0xab2b('0x48')]=[{'all':!![]}];}_0x59b4b6=_[_0xab2b('0x40')]({},_0x59b4b6,_0xd13846[_0xab2b('0x42')]);return db[_0xab2b('0x2c')]['find'](_0x59b4b6)[_0xab2b('0x28')](handleEntityNotFound(_0x5a0521,null))[_0xab2b('0x28')](respondWithResult(_0x5a0521,null))[_0xab2b('0x49')](handleError(_0x5a0521,null));};exports[_0xab2b('0x4a')]=function(_0x1b23eb,_0x16d331){return db[_0xab2b('0x2c')]['create'](_0x1b23eb[_0xab2b('0x4b')],{})[_0xab2b('0x28')](respondWithResult(_0x16d331,0xc9))[_0xab2b('0x49')](handleError(_0x16d331,null));};exports[_0xab2b('0x4c')]=function(_0x4097ff,_0x4920c2){if(_0x4097ff[_0xab2b('0x4b')]['id']){delete _0x4097ff[_0xab2b('0x4b')]['id'];}return db[_0xab2b('0x2c')]['find']({'where':{'id':_0x4097ff[_0xab2b('0x45')]['id']}})['then'](handleEntityNotFound(_0x4920c2,null))['then'](saveUpdates(_0x4097ff['body'],null))[_0xab2b('0x28')](respondWithResult(_0x4920c2,null))[_0xab2b('0x49')](handleError(_0x4920c2,null));};exports[_0xab2b('0x27')]=function(_0x55fa3b,_0xbd4405){return db[_0xab2b('0x2c')][_0xab2b('0x4d')]({'where':{'id':_0x55fa3b[_0xab2b('0x45')]['id']}})['then'](handleEntityNotFound(_0xbd4405,null))[_0xab2b('0x28')](removeEntity(_0xbd4405,null))['catch'](handleError(_0xbd4405,null));};exports[_0xab2b('0x4e')]=function(_0x223f44,_0x1a2c32){return db[_0xab2b('0x2c')][_0xab2b('0x4e')]()[_0xab2b('0x28')](respondWithResult(_0x1a2c32,null))[_0xab2b('0x49')](handleError(_0x1a2c32,null));};exports[_0xab2b('0x4f')]=function(_0x585700,_0x461466,_0x5ac600){return db[_0xab2b('0x50')]['count']({'where':{'ChatGroupId':_0x585700[_0xab2b('0x45')]['id'],'ToId':_0x585700[_0xab2b('0x51')]['id'],'read':![]}})['then'](function(_0x50a895){return{'id':_['toInteger'](_0x585700[_0xab2b('0x45')]['id']),'count':_0x50a895};})[_0xab2b('0x28')](respondWithResult(_0x461466,null))[_0xab2b('0x49')](handleError(_0x461466,null));};exports[_0xab2b('0x52')]=function(_0x114b58,_0x4dc4ba,_0x122b6f){return db['ChatGroup'][_0xab2b('0x4d')]({'where':{'id':_0x114b58['params']['id']}})['then'](handleEntityNotFound(_0x4dc4ba,null))['then'](function(_0x1e4d3f){if(_0x1e4d3f){return _0x1e4d3f[_0xab2b('0x52')](_0x114b58[_0xab2b('0x4b')][_0xab2b('0x53')],_[_0xab2b('0x54')](_0x114b58['body'],[_0xab2b('0x53'),'id'])||{});}})[_0xab2b('0x28')](respondWithResult(_0x4dc4ba,null))[_0xab2b('0x49')](handleError(_0x4dc4ba,null));};exports[_0xab2b('0x55')]=function(_0x132578,_0x4b91dc,_0x113af0){var _0x5c7494={};var _0x307c18={};var _0x27f68d;var _0x1f6596;return db[_0xab2b('0x2c')][_0xab2b('0x56')]({'where':{'id':_0x132578[_0xab2b('0x45')]['id']}})[_0xab2b('0x28')](handleEntityNotFound(_0x4b91dc,null))[_0xab2b('0x28')](function(_0xc1f3ef){if(_0xc1f3ef){_0x27f68d=_0xc1f3ef;_0x307c18['model']=_[_0xab2b('0x2e')](db[_0xab2b('0x57')][_0xab2b('0x2d')]);_0x307c18[_0xab2b('0x2f')]=_['keys'](_0x132578['query']);_0x307c18[_0xab2b('0x46')]=_[_0xab2b('0x32')](_0x307c18[_0xab2b('0x33')],_0x307c18[_0xab2b('0x2f')]);_0x5c7494[_0xab2b('0x34')]=_['intersection'](_0x307c18['model'],qs[_0xab2b('0x35')](_0x132578[_0xab2b('0x2f')][_0xab2b('0x35')]));_0x5c7494[_0xab2b('0x34')]=_0x5c7494['attributes']['length']?_0x5c7494[_0xab2b('0x34')]:_0x307c18[_0xab2b('0x33')];_0x5c7494[_0xab2b('0x39')]=qs['sort'](_0x132578[_0xab2b('0x2f')]['sort']);_0x5c7494[_0xab2b('0x3b')]=qs[_0xab2b('0x46')](_[_0xab2b('0x3c')](_0x132578[_0xab2b('0x2f')],_0x307c18['filters']));if(_0x132578[_0xab2b('0x2f')]['filter']){_0x5c7494['where']=_[_0xab2b('0x40')](_0x5c7494[_0xab2b('0x3b')],{'$or':_['map'](_0x5c7494[_0xab2b('0x34')],function(_0x1ca7cd){var _0x59cfab={};_0x59cfab[_0x1ca7cd]={'$like':'%'+_0x132578['query'][_0xab2b('0x3f')]+'%'};return _0x59cfab;})});}_0x5c7494=_['merge']({},_0x5c7494,_0x132578[_0xab2b('0x42')]);return _0x27f68d[_0xab2b('0x55')](_0x5c7494);}})[_0xab2b('0x28')](function(_0x241b48){if(_0x241b48){_0x1f6596=_0x241b48[_0xab2b('0x36')];if(!_0x132578[_0xab2b('0x2f')]['hasOwnProperty'](_0xab2b('0x38'))){_0x5c7494[_0xab2b('0x23')]=qs[_0xab2b('0x23')](_0x132578[_0xab2b('0x2f')]['limit']);_0x5c7494[_0xab2b('0x22')]=qs[_0xab2b('0x22')](_0x132578[_0xab2b('0x2f')][_0xab2b('0x22')]);}return _0x27f68d['getMembers'](_0x5c7494);}})['then'](function(_0x4fd217){if(_0x4fd217){return _0x4fd217?{'count':_0x1f6596,'rows':_0x4fd217}:null;}})[_0xab2b('0x28')](respondWithResult(_0x4b91dc,null))[_0xab2b('0x49')](handleError(_0x4b91dc,null));};exports[_0xab2b('0x58')]=function(_0x126b21,_0x5bb7c0,_0xb9923){var _0x320b56;return db[_0xab2b('0x2c')][_0xab2b('0x4d')]({'where':{'id':_0x126b21[_0xab2b('0x45')]['id']}})['then'](handleEntityNotFound(_0x5bb7c0,null))[_0xab2b('0x28')](function(_0x2b460f){if(_0x2b460f){return _0x2b460f['removeMembers'](_0x126b21['query'][_0xab2b('0x53')]);}})[_0xab2b('0x28')](respondWithStatusCode(_0x5bb7c0,null))[_0xab2b('0x49')](handleError(_0x5bb7c0,null));};exports[_0xab2b('0x59')]=function(_0x11964f,_0x49fa9a,_0x1f4788){if(_0x11964f['body']['id']){delete _0x11964f[_0xab2b('0x4b')]['id'];}return db[_0xab2b('0x2c')]['find']({'where':{'id':_0x11964f[_0xab2b('0x45')]['id']}})[_0xab2b('0x28')](handleEntityNotFound(_0x49fa9a,null))[_0xab2b('0x28')](function(_0x510e64){if(_0x510e64){_0x11964f[_0xab2b('0x4b')][_0xab2b('0x5a')]=_0x510e64['id'];return db[_0xab2b('0x50')][_0xab2b('0x4a')](_0x11964f['body']);}})['then'](respondWithResult(_0x49fa9a,null))['catch'](handleError(_0x49fa9a,null));};exports[_0xab2b('0x5b')]=function(_0x44e8f4,_0x525647,_0x9ec217){var _0x471b65={};var _0xf05e22={};var _0x1139e8;var _0x25ec11;return db[_0xab2b('0x2c')][_0xab2b('0x56')]({'where':{'id':_0x44e8f4[_0xab2b('0x45')]['id']}})[_0xab2b('0x28')](handleEntityNotFound(_0x525647,null))[_0xab2b('0x28')](function(_0x1de73a){if(_0x1de73a){_0x1139e8=_0x1de73a;_0xf05e22[_0xab2b('0x33')]=_['keys'](db[_0xab2b('0x50')][_0xab2b('0x2d')]);_0xf05e22[_0xab2b('0x2f')]=_[_0xab2b('0x2e')](_0x44e8f4['query']);_0xf05e22['filters']=_[_0xab2b('0x32')](_0xf05e22['model'],_0xf05e22[_0xab2b('0x2f')]);_0x471b65[_0xab2b('0x34')]=_[_0xab2b('0x32')](_0xf05e22[_0xab2b('0x33')],qs[_0xab2b('0x35')](_0x44e8f4[_0xab2b('0x2f')][_0xab2b('0x35')]));_0x471b65[_0xab2b('0x34')]=_0x471b65[_0xab2b('0x34')]['length']?_0x471b65['attributes']:_0xf05e22[_0xab2b('0x33')];_0x471b65['order']=qs[_0xab2b('0x3a')](_0x44e8f4[_0xab2b('0x2f')]['sort']);_0x471b65[_0xab2b('0x3b')]=qs[_0xab2b('0x46')](_[_0xab2b('0x3c')](_0x44e8f4[_0xab2b('0x2f')],_0xf05e22['filters']));if(_0x44e8f4[_0xab2b('0x2f')][_0xab2b('0x3f')]){_0x471b65[_0xab2b('0x3b')]=_[_0xab2b('0x40')](_0x471b65['where'],{'$or':_[_0xab2b('0x41')](_0x471b65['attributes'],function(_0x1ad7f1){var _0x64b37={};_0x64b37[_0x1ad7f1]={'$like':'%'+_0x44e8f4[_0xab2b('0x2f')][_0xab2b('0x3f')]+'%'};return _0x64b37;})});}if(_0x44e8f4[_0xab2b('0x2f')][_0xab2b('0x5c')]){var _0x138293=_0x44e8f4[_0xab2b('0x2f')][_0xab2b('0x5c')][_0xab2b('0x5d')](',');var _0x510b63={};_0x510b63[_0x138293[0x0]]={'$gte':moment(_0x138293[0x1])[_0xab2b('0x5e')](_0xab2b('0x5f'))};_0x471b65[_0xab2b('0x3b')]=_[_0xab2b('0x40')](_0x471b65[_0xab2b('0x3b')],_0x510b63);}_0x471b65=_[_0xab2b('0x40')]({},_0x471b65,_0x44e8f4[_0xab2b('0x42')]);return _0x1139e8[_0xab2b('0x5b')](_0x471b65);}})[_0xab2b('0x28')](function(_0x2d862f){if(_0x2d862f){_0x25ec11=_0x2d862f['length'];if(!_0x44e8f4[_0xab2b('0x2f')]['hasOwnProperty'](_0xab2b('0x38'))){_0x471b65[_0xab2b('0x23')]=qs[_0xab2b('0x23')](_0x44e8f4[_0xab2b('0x2f')][_0xab2b('0x23')]);_0x471b65['offset']=qs[_0xab2b('0x22')](_0x44e8f4[_0xab2b('0x2f')][_0xab2b('0x22')]);}return _0x1139e8[_0xab2b('0x5b')](_0x471b65);}})[_0xab2b('0x28')](function(_0x2fb350){if(_0x2fb350){return _0x2fb350?{'count':_0x25ec11,'rows':_0x2fb350}:null;}})[_0xab2b('0x28')](respondWithResult(_0x525647,null))[_0xab2b('0x49')](handleError(_0x525647,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 4cc6afb..b7e4310 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 _0x6669=['events','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x2fd404,_0x369e73){var _0x516d76=function(_0xfb3644){while(--_0xfb3644){_0x2fd404['push'](_0x2fd404['shift']());}};_0x516d76(++_0x369e73);}(_0x6669,0x1e0));var _0x9666=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x6669[_0x5a79e2];return _0x266c45;};'use strict';var EventEmitter=require(_0x9666('0x0'));var ChatGroup=require(_0x9666('0x1'))['db'][_0x9666('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x9666('0x3')](0x0);var events={'afterCreate':_0x9666('0x4'),'afterUpdate':_0x9666('0x5'),'afterDestroy':_0x9666('0x6')};function emitEvent(_0x2828c8){return function(_0x3f8aa5,_0x3fde8c,_0x212e21){ChatGroupEvents[_0x9666('0x7')](_0x2828c8+':'+_0x3f8aa5['id'],_0x3f8aa5);ChatGroupEvents['emit'](_0x2828c8,_0x3f8aa5);_0x212e21(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x9666('0x8')](e,emitEvent(event));}}module[_0x9666('0x9')]=ChatGroupEvents; \ No newline at end of file +var _0xa831=['../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x32b599,_0x19e696){var _0x251073=function(_0x5f1ab1){while(--_0x5f1ab1){_0x32b599['push'](_0x32b599['shift']());}};_0x251073(++_0x19e696);}(_0xa831,0xb3));var _0x1a83=function(_0x2aee2f,_0xad9887){_0x2aee2f=_0x2aee2f-0x0;var _0x19337f=_0xa831[_0x2aee2f];return _0x19337f;};'use strict';var EventEmitter=require(_0x1a83('0x0'));var ChatGroup=require(_0x1a83('0x1'))['db'][_0x1a83('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x1a83('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1a83('0x4'),'afterDestroy':_0x1a83('0x5')};function emitEvent(_0x20db93){return function(_0x133259,_0x5021c4,_0x334a4a){ChatGroupEvents[_0x1a83('0x6')](_0x20db93+':'+_0x133259['id'],_0x133259);ChatGroupEvents['emit'](_0x20db93,_0x133259);_0x334a4a(null);};}for(var e in events){if(events[_0x1a83('0x7')](e)){var event=events[e];ChatGroup[_0x1a83('0x8')](e,emitEvent(event));}}module[_0x1a83('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 39ba5e0..cdef9b8 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 _0x4a31=['../../config/logger','api','moment','request-promise','exports','define','chat_groups','util'];(function(_0x5eafce,_0x3d62b6){var _0x414698=function(_0x58ff9a){while(--_0x58ff9a){_0x5eafce['push'](_0x5eafce['shift']());}};_0x414698(++_0x3d62b6);}(_0x4a31,0x187));var _0x14a3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a31[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x14a3('0x0'));var logger=require(_0x14a3('0x1'))(_0x14a3('0x2'));var moment=require(_0x14a3('0x3'));var BPromise=require('bluebird');var rp=require(_0x14a3('0x4'));var attributes=require('./chatGroup.attributes');module[_0x14a3('0x5')]=function(_0xadc3c7,_0x441702){return _0xadc3c7[_0x14a3('0x6')]('ChatGroup',attributes,{'tableName':_0x14a3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda41=['moment','bluebird','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util','api'];(function(_0x54b3ce,_0x3286f2){var _0x36fa84=function(_0x15ac03){while(--_0x15ac03){_0x54b3ce['push'](_0x54b3ce['shift']());}};_0x36fa84(++_0x3286f2);}(_0xda41,0x1f1));var _0x1da4=function(_0x4c84ad,_0x4c3e01){_0x4c84ad=_0x4c84ad-0x0;var _0x28c939=_0xda41[_0x4c84ad];return _0x28c939;};'use strict';var _=require(_0x1da4('0x0'));var util=require(_0x1da4('0x1'));var logger=require('../../config/logger')(_0x1da4('0x2'));var moment=require(_0x1da4('0x3'));var BPromise=require(_0x1da4('0x4'));var rp=require('request-promise');var attributes=require(_0x1da4('0x5'));module[_0x1da4('0x6')]=function(_0x1b055a,_0x26d91d){return _0x1b055a[_0x1da4('0x7')](_0x1da4('0x8'),attributes,{'tableName':_0x1da4('0x9'),'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 ebf1234..4a06621 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 _0x2a85=['then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','register','request'];(function(_0x23c671,_0x560893){var _0x3fb348=function(_0x5d1850){while(--_0x5d1850){_0x23c671['push'](_0x23c671['shift']());}};_0x3fb348(++_0x560893);}(_0x2a85,0x1ea));var _0x52a8=function(_0x347f53,_0x34eee3){_0x347f53=_0x347f53-0x0;var _0x33ecde=_0x2a85[_0x347f53];return _0x33ecde;};'use strict';var _=require(_0x52a8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x52a8('0x1'));var rs=require(_0x52a8('0x2'));var fs=require('fs');var db=require(_0x52a8('0x3'))['db'];var utils=require(_0x52a8('0x4'));var logger=require(_0x52a8('0x5'))(_0x52a8('0x6'));var config=require(_0x52a8('0x7'));var jayson=require(_0x52a8('0x8'));var client=jayson[_0x52a8('0x9')][_0x52a8('0xa')]({'port':0x232a});var socket=require(_0x52a8('0xb'))({'host':'localhost','port':0x18eb});require('./chatGroup.socket')[_0x52a8('0xc')](socket);function respondWithRpcPromise(_0x360463,_0x4c35eb,_0x5807d0){return new BPromise(function(_0x47428d,_0x33c57c){return client[_0x52a8('0xd')](_0x360463,_0x5807d0)[_0x52a8('0xe')](function(_0x569471){logger[_0x52a8('0xf')](_0x52a8('0x10'),_0x4c35eb,_0x52a8('0x11'));logger[_0x52a8('0x12')](_0x52a8('0x13'),_0x4c35eb,_0x52a8('0x11'),JSON[_0x52a8('0x14')](_0x569471));if(_0x569471[_0x52a8('0x15')]){if(_0x569471[_0x52a8('0x15')][_0x52a8('0x16')]===0x1f4){logger[_0x52a8('0x15')]('ChatGroup,\x20%s,\x20%s',_0x4c35eb,_0x569471[_0x52a8('0x15')][_0x52a8('0x17')]);return _0x33c57c(_0x569471[_0x52a8('0x15')][_0x52a8('0x17')]);}logger[_0x52a8('0x15')](_0x52a8('0x10'),_0x4c35eb,_0x569471[_0x52a8('0x15')][_0x52a8('0x17')]);return _0x47428d(_0x569471[_0x52a8('0x15')][_0x52a8('0x17')]);}else{logger[_0x52a8('0xf')](_0x52a8('0x10'),_0x4c35eb,_0x52a8('0x11'));_0x47428d(_0x569471['result'][_0x52a8('0x17')]);}})['catch'](function(_0x1d48a3){logger[_0x52a8('0x15')]('ChatGroup,\x20%s,\x20%s',_0x4c35eb,_0x1d48a3);_0x33c57c(_0x1d48a3);});});} \ No newline at end of file +var _0xdfd7=['ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','message','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','./chatGroup.socket','then','info'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xdfd7,0xb1));var _0x7dfd=function(_0x12ac18,_0x2a5be6){_0x12ac18=_0x12ac18-0x0;var _0x2b7c86=_0xdfd7[_0x12ac18];return _0x2b7c86;};'use strict';var _=require(_0x7dfd('0x0'));var util=require(_0x7dfd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7dfd('0x2'));var fs=require('fs');var db=require(_0x7dfd('0x3'))['db'];var utils=require(_0x7dfd('0x4'));var logger=require(_0x7dfd('0x5'))(_0x7dfd('0x6'));var config=require(_0x7dfd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7dfd('0x8')][_0x7dfd('0x9')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0x7dfd('0xa'))['register'](socket);function respondWithRpcPromise(_0x3cd014,_0x31c775,_0x791200){return new BPromise(function(_0x158c2c,_0x49bf06){return client['request'](_0x3cd014,_0x791200)[_0x7dfd('0xb')](function(_0x169249){logger[_0x7dfd('0xc')](_0x7dfd('0xd'),_0x31c775,_0x7dfd('0xe'));logger[_0x7dfd('0xf')](_0x7dfd('0x10'),_0x31c775,'request\x20sent',JSON['stringify'](_0x169249));if(_0x169249['error']){if(_0x169249[_0x7dfd('0x11')]['code']===0x1f4){logger[_0x7dfd('0x11')](_0x7dfd('0xd'),_0x31c775,_0x169249['error'][_0x7dfd('0x12')]);return _0x49bf06(_0x169249[_0x7dfd('0x11')][_0x7dfd('0x12')]);}logger[_0x7dfd('0x11')](_0x7dfd('0xd'),_0x31c775,_0x169249[_0x7dfd('0x11')][_0x7dfd('0x12')]);return _0x158c2c(_0x169249[_0x7dfd('0x11')][_0x7dfd('0x12')]);}else{logger[_0x7dfd('0xc')](_0x7dfd('0xd'),_0x31c775,'request\x20sent');_0x158c2c(_0x169249['result']['message']);}})['catch'](function(_0x56626f){logger[_0x7dfd('0x11')]('ChatGroup,\x20%s,\x20%s',_0x31c775,_0x56626f);_0x49bf06(_0x56626f);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index bfd0720..dc1b3c5 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 _0x1e69=['emit','removeListener','register','length','chatGroup:','save','remove','update'];(function(_0x1d02ac,_0x378eb2){var _0x1f01ba=function(_0x355bb4){while(--_0x355bb4){_0x1d02ac['push'](_0x1d02ac['shift']());}};_0x1f01ba(++_0x378eb2);}(_0x1e69,0x85));var _0x91e6=function(_0x102826,_0x35f7b9){_0x102826=_0x102826-0x0;var _0x57556e=_0x1e69[_0x102826];return _0x57556e;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x91e6('0x0'),_0x91e6('0x1'),_0x91e6('0x2')];function createListener(_0x3a523e,_0x4f5881){return function(_0x537c0e){_0x4f5881[_0x91e6('0x3')](_0x3a523e,_0x537c0e);};}function removeListener(_0x351c1d,_0x2b53b6){return function(){ChatGroupEvents[_0x91e6('0x4')](_0x351c1d,_0x2b53b6);};}exports[_0x91e6('0x5')]=function(_0x42fe90){for(var _0x4091b8=0x0,_0x2733bf=events[_0x91e6('0x6')];_0x4091b8<_0x2733bf;_0x4091b8++){var _0x375184=events[_0x4091b8];var _0x266fe6=createListener(_0x91e6('0x7')+_0x375184,_0x42fe90);ChatGroupEvents['on'](_0x375184,_0x266fe6);}}; \ No newline at end of file +var _0x2f72=['remove','update','emit','removeListener','register','length','chatGroup:','./chatGroup.events','save'];(function(_0x152958,_0x9bcee0){var _0x2b905e=function(_0x113ea4){while(--_0x113ea4){_0x152958['push'](_0x152958['shift']());}};_0x2b905e(++_0x9bcee0);}(_0x2f72,0x166));var _0x22f7=function(_0x5b873f,_0x32ba8e){_0x5b873f=_0x5b873f-0x0;var _0xdac9ec=_0x2f72[_0x5b873f];return _0xdac9ec;};'use strict';var ChatGroupEvents=require(_0x22f7('0x0'));var events=[_0x22f7('0x1'),_0x22f7('0x2'),_0x22f7('0x3')];function createListener(_0x30906f,_0x46ec3d){return function(_0x25ad0c){_0x46ec3d[_0x22f7('0x4')](_0x30906f,_0x25ad0c);};}function removeListener(_0x56837d,_0x24a994){return function(){ChatGroupEvents[_0x22f7('0x5')](_0x56837d,_0x24a994);};}exports[_0x22f7('0x6')]=function(_0x216f96){for(var _0xd85654=0x0,_0x11cb61=events[_0x22f7('0x7')];_0xd85654<_0x11cb61;_0xd85654++){var _0x1ad8d1=events[_0xd85654];var _0x261813=createListener(_0x22f7('0x8')+_0x1ad8d1,_0x216f96);ChatGroupEvents['on'](_0x1ad8d1,_0x261813);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 1c8e034..794c4cd 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 _0xc8d9=['/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','update','delete','destroy','removeMembers','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/unread','getUnread'];(function(_0x4a91fc,_0x5bc46c){var _0x255ae8=function(_0x33ddbb){while(--_0x33ddbb){_0x4a91fc['push'](_0x4a91fc['shift']());}};_0x255ae8(++_0x5bc46c);}(_0xc8d9,0x15d));var _0x9c8d=function(_0x50b1c5,_0x1cf2a9){_0x50b1c5=_0x50b1c5-0x0;var _0x344f99=_0xc8d9[_0x50b1c5];return _0x344f99;};'use strict';var multer=require('multer');var util=require(_0x9c8d('0x0'));var path=require('path');var express=require(_0x9c8d('0x1'));var router=express[_0x9c8d('0x2')]();var auth=require(_0x9c8d('0x3'));var interaction=require(_0x9c8d('0x4'));var config=require(_0x9c8d('0x5'));var controller=require(_0x9c8d('0x6'));router['get']('/',auth[_0x9c8d('0x7')](),controller[_0x9c8d('0x8')]);router[_0x9c8d('0x9')](_0x9c8d('0xa'),auth[_0x9c8d('0x7')](),controller[_0x9c8d('0xb')]);router['get'](_0x9c8d('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x9c8d('0xd'),auth[_0x9c8d('0x7')](),controller[_0x9c8d('0xe')]);router[_0x9c8d('0x9')](_0x9c8d('0xf'),auth[_0x9c8d('0x7')](),controller[_0x9c8d('0x10')]);router[_0x9c8d('0x9')](_0x9c8d('0x11'),auth[_0x9c8d('0x7')](),controller[_0x9c8d('0x12')]);router[_0x9c8d('0x13')]('/',auth[_0x9c8d('0x7')](),controller[_0x9c8d('0x14')]);router[_0x9c8d('0x13')](_0x9c8d('0xf'),auth[_0x9c8d('0x7')](),controller[_0x9c8d('0x15')]);router[_0x9c8d('0x13')](_0x9c8d('0x11'),auth[_0x9c8d('0x7')](),controller[_0x9c8d('0x16')]);router['put'](_0x9c8d('0xc'),auth[_0x9c8d('0x7')](),controller[_0x9c8d('0x17')]);router[_0x9c8d('0x18')]('/:id',auth[_0x9c8d('0x7')](),controller[_0x9c8d('0x19')]);router['delete'](_0x9c8d('0xf'),auth[_0x9c8d('0x7')](),controller[_0x9c8d('0x1a')]);module[_0x9c8d('0x1b')]=router; \ No newline at end of file +var _0xfaeb=['describe','/:id/unread','getUnread','getMembers','/:id/messages','post','create','addMembers','addMessage','put','/:id','update','delete','destroy','/:id/members','removeMembers','exports','util','path','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x282592,_0x3243aa){var _0x25612b=function(_0x2d825c){while(--_0x2d825c){_0x282592['push'](_0x282592['shift']());}};_0x25612b(++_0x3243aa);}(_0xfaeb,0x188));var _0xbfae=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0xfaeb[_0x397cfb];return _0x15fed9;};'use strict';var multer=require('multer');var util=require(_0xbfae('0x0'));var path=require(_0xbfae('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xbfae('0x2'));var config=require(_0xbfae('0x3'));var controller=require('./chatGroup.controller');router[_0xbfae('0x4')]('/',auth[_0xbfae('0x5')](),controller[_0xbfae('0x6')]);router[_0xbfae('0x4')](_0xbfae('0x7'),auth[_0xbfae('0x5')](),controller[_0xbfae('0x8')]);router[_0xbfae('0x4')]('/:id',auth[_0xbfae('0x5')](),controller['show']);router[_0xbfae('0x4')](_0xbfae('0x9'),auth[_0xbfae('0x5')](),controller[_0xbfae('0xa')]);router[_0xbfae('0x4')]('/:id/members',auth[_0xbfae('0x5')](),controller[_0xbfae('0xb')]);router[_0xbfae('0x4')](_0xbfae('0xc'),auth['isAuthenticated'](),controller['getMessages']);router[_0xbfae('0xd')]('/',auth[_0xbfae('0x5')](),controller[_0xbfae('0xe')]);router[_0xbfae('0xd')]('/:id/members',auth[_0xbfae('0x5')](),controller[_0xbfae('0xf')]);router['post'](_0xbfae('0xc'),auth[_0xbfae('0x5')](),controller[_0xbfae('0x10')]);router[_0xbfae('0x11')](_0xbfae('0x12'),auth[_0xbfae('0x5')](),controller[_0xbfae('0x13')]);router[_0xbfae('0x14')](_0xbfae('0x12'),auth[_0xbfae('0x5')](),controller[_0xbfae('0x15')]);router[_0xbfae('0x14')](_0xbfae('0x16'),auth['isAuthenticated'](),controller[_0xbfae('0x17')]);module[_0xbfae('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 55c6c80..470555b 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 _0x4483=['out','sequelize','exports','BOOLEAN','ENUM','star','thumb','TEXT','STRING','DATE','long'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4483,0x1a3));var _0x3448=function(_0x494444,_0x104f0a){_0x494444=_0x494444-0x0;var _0x291f1f=_0x4483[_0x494444];return _0x291f1f;};'use strict';var Sequelize=require(_0x3448('0x0'));module[_0x3448('0x1')]={'closed':{'type':Sequelize[_0x3448('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x3448('0x3')](_0x3448('0x4'),_0x3448('0x5')),'defaultValue':_0x3448('0x4')},'ratingMessage':{'type':Sequelize[_0x3448('0x6')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x3448('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x3448('0x8')]},'disposition':{'type':Sequelize[_0x3448('0x7')]},'note':{'type':Sequelize[_0x3448('0x7')]},'browserName':{'type':Sequelize[_0x3448('0x7')]},'browserVersion':{'type':Sequelize[_0x3448('0x7')]},'osName':{'type':Sequelize[_0x3448('0x7')]},'osVersion':{'type':Sequelize[_0x3448('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x3448('0x7')]},'referer':{'type':Sequelize[_0x3448('0x7')]},'customerIp':{'type':Sequelize[_0x3448('0x7')]},'formData':{'type':Sequelize[_0x3448('0x6')](_0x3448('0x9'))},'read1stAt':{'type':Sequelize[_0x3448('0x8')]},'lastMsgAt':{'type':Sequelize[_0x3448('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x3448('0x3')]('in',_0x3448('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x3448('0x7')]}}; \ No newline at end of file +var _0x5c00=['ENUM','thumb','star','TEXT','DATE','STRING','long','out','sequelize','exports','BOOLEAN'];(function(_0x16b316,_0x5c7788){var _0x908df9=function(_0x428ade){while(--_0x428ade){_0x16b316['push'](_0x16b316['shift']());}};_0x908df9(++_0x5c7788);}(_0x5c00,0x17e));var _0x05c0=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0x5c00[_0x533e4e];return _0x1f14bb;};'use strict';var Sequelize=require(_0x05c0('0x0'));module[_0x05c0('0x1')]={'closed':{'type':Sequelize[_0x05c0('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x05c0('0x3')]('star',_0x05c0('0x4')),'defaultValue':_0x05c0('0x5')},'ratingMessage':{'type':Sequelize[_0x05c0('0x6')]},'pathTranscript':{'type':Sequelize[_0x05c0('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x05c0('0x7')]},'disposition':{'type':Sequelize[_0x05c0('0x8')]},'note':{'type':Sequelize[_0x05c0('0x8')]},'browserName':{'type':Sequelize[_0x05c0('0x8')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x05c0('0x8')]},'osVersion':{'type':Sequelize[_0x05c0('0x8')]},'deviceModel':{'type':Sequelize[_0x05c0('0x8')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x05c0('0x8')]},'referer':{'type':Sequelize[_0x05c0('0x8')]},'customerIp':{'type':Sequelize[_0x05c0('0x8')]},'formData':{'type':Sequelize[_0x05c0('0x6')](_0x05c0('0x9'))},'read1stAt':{'type':Sequelize[_0x05c0('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x05c0('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 07886f9..7553b2a 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 _0x89b7=['code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','sendStatus','name','index','ChatInteraction','rawAttributes','model','keys','query','dateStart','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','dateEnd','add','day','where','filter','merge','options','include','tag','push','Tag','Tags','read','ChatMessage','direction','createdAt','distinct','includeAll','Users','fullname','CmContact','Contact','Owner','ChatWebsite','Account','key','color','ThroughTags','params','length','find','create','body','describe','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Sequelize','ValidationError','Interaction\x20already\x20assigned','closed','closedAt','disposition','AbandonInteraction','basename','file','filename','type','mimetype','attachmentDownload','findOne','Attachment','download','close','mailTranscript','join','server/files/chat/upload/','transcript-%s.txt','pathTranscript','Messages','User','ContactId','format','%s%d','agentAlias','System','customer','Visitor','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','secret','appendFileSync','Smtp','service','host','port','secure','auth','user','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','ChatInteractionId','map','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','includeAgent','addTags','spread','emit','chatInteractionTags:save','removeTags','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','querystring','papaparse','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','register','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x273e2c,_0x2acc61){var _0x11928d=function(_0x554b68){while(--_0x554b68){_0x273e2c['push'](_0x273e2c['shift']());}};_0x11928d(++_0x2acc61);}(_0x89b7,0x1dc));var _0x789b=function(_0x3f0189,_0x37da56){_0x3f0189=_0x3f0189-0x0;var _0x356d88=_0x89b7[_0x3f0189];return _0x356d88;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x789b('0x0'));var BPromise=require(_0x789b('0x1'));var Mustache=require(_0x789b('0x2'));var util=require(_0x789b('0x3'));var path=require(_0x789b('0x4'));var sox=require('sox');var csv=require(_0x789b('0x5'));var ejs=require(_0x789b('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x789b('0x7'));var crypto=require(_0x789b('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x789b('0x5'));var querystring=require(_0x789b('0x9'));var Papa=require(_0x789b('0xa'));var qs=require('../../components/parsers/qs');var logger=require(_0x789b('0xb'))('api');var utils=require(_0x789b('0xc'));var config=require(_0x789b('0xd'));var db=require(_0x789b('0xe'))['db'];var socket=require(_0x789b('0xf'))({'host':_0x789b('0x10'),'port':0x18eb});require('./chatInteraction.socket')[_0x789b('0x11')](socket);var jayson=require('jayson/promise');var client=jayson[_0x789b('0x12')][_0x789b('0x13')]({'port':0x232b});var client9004=jayson[_0x789b('0x12')][_0x789b('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x36f69a,_0x92d40,_0x27a130,_0x153882){return new BPromise(function(_0x3c681a,_0x31b2f9){var _0x4b8a65=_0x153882||client;return _0x4b8a65[_0x789b('0x14')](_0x36f69a,_0x27a130)[_0x789b('0x15')](function(_0x47cffb){logger[_0x789b('0x16')](_0x789b('0x17'),_0x92d40,_0x789b('0x18'));logger['debug'](_0x789b('0x19'),_0x92d40,_0x789b('0x18'),JSON[_0x789b('0x1a')](_0x47cffb));if(_0x47cffb[_0x789b('0x1b')]){if(_0x47cffb[_0x789b('0x1b')][_0x789b('0x1c')]===0x1f4){logger[_0x789b('0x1b')](_0x789b('0x17'),_0x92d40,_0x47cffb[_0x789b('0x1b')][_0x789b('0x1d')]);return _0x31b2f9(_0x47cffb[_0x789b('0x1b')][_0x789b('0x1d')]);}logger['error'](_0x789b('0x17'),_0x92d40,_0x47cffb[_0x789b('0x1b')][_0x789b('0x1d')]);return _0x3c681a(_0x47cffb['error'][_0x789b('0x1d')]);}else{logger[_0x789b('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x92d40,_0x789b('0x18'));_0x3c681a(_0x47cffb[_0x789b('0x1e')][_0x789b('0x1d')]);}})[_0x789b('0x1f')](function(_0x4ecfbc){logger[_0x789b('0x1b')](_0x789b('0x17'),_0x92d40,_0x4ecfbc);_0x31b2f9(_0x4ecfbc);});});}function respondWithStatusCode(_0x3fe83d,_0x912dfd){_0x912dfd=_0x912dfd||0xcc;return function(_0x1d9d9b){if(_0x1d9d9b){return _0x3fe83d['sendStatus'](_0x912dfd);}return _0x3fe83d[_0x789b('0x20')](_0x912dfd)[_0x789b('0x21')]();};}function respondWithResult(_0x46f55f,_0x3b4942){_0x3b4942=_0x3b4942||0xc8;return function(_0x2a6c1c){if(_0x2a6c1c){return _0x46f55f[_0x789b('0x20')](_0x3b4942)[_0x789b('0x22')](_0x2a6c1c);}};}function respondWithFilteredResult(_0x5d6d82,_0x10130b){return function(_0x14c402){if(_0x14c402){var _0xa94fa9=_0x14c402[_0x789b('0x23')],_0x5546f2=_0x10130b[_0x789b('0x24')],_0x5a96ab=_0x10130b['offset']+_0x10130b[_0x789b('0x25')],_0x281ad4;if(_0x5a96ab>=_0xa94fa9){_0x5a96ab=_0xa94fa9;_0x281ad4=0xc8;}else{_0x281ad4=0xce;}_0x5d6d82['status'](_0x281ad4);return _0x5d6d82[_0x789b('0x26')](_0x789b('0x27'),_0x5546f2+'-'+_0x5a96ab+'/'+_0xa94fa9)[_0x789b('0x22')](_0x14c402);}return null;};}function patchUpdates(_0x22ef57){return function(_0x5806ed){try{jsonpatch['apply'](_0x5806ed,_0x22ef57,!![]);}catch(_0x2e93c7){return BPromise[_0x789b('0x28')](_0x2e93c7);}return _0x5806ed[_0x789b('0x29')]();};}function saveUpdates(_0x1775d3,_0x3ad52d){return function(_0x20e94f){if(_0x20e94f){return _0x20e94f[_0x789b('0x2a')](_0x1775d3)[_0x789b('0x15')](function(_0x257b78){return _0x257b78;});}return null;};}function removeEntity(_0x47125d,_0x1411ad){return function(_0xc6f93d){if(_0xc6f93d){return _0xc6f93d['destroy']()['then'](function(){_0x47125d[_0x789b('0x20')](0xcc)[_0x789b('0x21')]();});}};}function handleEntityNotFound(_0x278b82,_0xdc1604){return function(_0x1e15eb){if(!_0x1e15eb){_0x278b82[_0x789b('0x2b')](0x194);}return _0x1e15eb;};}function handleError(_0x2414d4,_0x3d1284){_0x3d1284=_0x3d1284||0x1f4;return function(_0x5e5378){logger['error'](_0x5e5378['stack']);if(_0x5e5378[_0x789b('0x2c')]){delete _0x5e5378[_0x789b('0x2c')];}_0x2414d4[_0x789b('0x20')](_0x3d1284)['send'](_0x5e5378);};}exports[_0x789b('0x2d')]=function(_0x36f8b4,_0xe683){var _0x4c4ae7={},_0x2d43a8={},_0x3fd08c={'count':0x0,'rows':[]};var _0x5d757e=db[_0x789b('0x2e')][_0x789b('0x2f')];_0x2d43a8[_0x789b('0x30')]=_[_0x789b('0x31')](_0x5d757e);var _0x2beaa6={'dateStart':_0x36f8b4[_0x789b('0x32')][_0x789b('0x33')],'dateEnd':_0x36f8b4[_0x789b('0x32')]['dateEnd']};delete _0x36f8b4[_0x789b('0x32')][_0x789b('0x33')];delete _0x36f8b4[_0x789b('0x32')]['dateEnd'];_0x2d43a8[_0x789b('0x32')]=_[_0x789b('0x31')](_0x36f8b4[_0x789b('0x32')]);_0x2d43a8[_0x789b('0x34')]=_[_0x789b('0x35')](_0x2d43a8[_0x789b('0x30')],_0x2d43a8[_0x789b('0x32')]);_0x4c4ae7[_0x789b('0x36')]=_[_0x789b('0x35')](_0x2d43a8['model'],qs[_0x789b('0x37')](_0x36f8b4['query'][_0x789b('0x37')]));_0x4c4ae7[_0x789b('0x36')]=_0x4c4ae7[_0x789b('0x36')]['length']?_0x4c4ae7['attributes']:_0x2d43a8[_0x789b('0x30')];if(!_0x36f8b4['query'][_0x789b('0x38')](_0x789b('0x39'))){_0x4c4ae7['limit']=qs[_0x789b('0x25')](_0x36f8b4[_0x789b('0x32')][_0x789b('0x25')]);_0x4c4ae7[_0x789b('0x24')]=qs[_0x789b('0x24')](_0x36f8b4[_0x789b('0x32')][_0x789b('0x24')]);}_0x4c4ae7[_0x789b('0x3a')]=qs[_0x789b('0x3b')](_0x36f8b4[_0x789b('0x32')][_0x789b('0x3b')]);_0x4c4ae7['where']=qs[_0x789b('0x34')](_[_0x789b('0x3c')](_0x36f8b4[_0x789b('0x32')],_0x2d43a8[_0x789b('0x34')]));if(_0x2beaa6[_0x789b('0x33')]){if(_0x2beaa6[_0x789b('0x3d')]){_0x2beaa6[_0x789b('0x3d')]=moment(_0x2beaa6[_0x789b('0x3d')])[_0x789b('0x3e')](0x1,_0x789b('0x3f'));}else{_0x2beaa6[_0x789b('0x3d')]=moment(_0x2beaa6[_0x789b('0x33')])[_0x789b('0x3e')](0x1,'day');}_['merge'](_0x4c4ae7[_0x789b('0x40')],{'createdAt':{'$gte':_0x2beaa6[_0x789b('0x33')],'$lte':_0x2beaa6[_0x789b('0x3d')]}});}if(_0x36f8b4[_0x789b('0x32')][_0x789b('0x41')]){_0x4c4ae7['where']=_[_0x789b('0x42')](_0x4c4ae7[_0x789b('0x40')],{'$or':_['map'](_0x4c4ae7[_0x789b('0x36')],function(_0x1fff89){var _0x1a0c3a={};_0x1a0c3a[_0x1fff89]={'$like':'%'+_0x36f8b4[_0x789b('0x32')][_0x789b('0x41')]+'%'};return _0x1a0c3a;})});}_0x4c4ae7=_[_0x789b('0x42')]({},_0x4c4ae7,_0x36f8b4[_0x789b('0x43')]);var _0x38cd54={'where':_0x4c4ae7[_0x789b('0x40')]};_0x38cd54[_0x789b('0x44')]=[];if(_0x36f8b4[_0x789b('0x32')][_0x789b('0x45')]){_0x38cd54[_0x789b('0x44')][_0x789b('0x46')]({'model':db[_0x789b('0x47')],'as':_0x789b('0x48'),'attributes':['id'],'where':{'id':_0x36f8b4['query'][_0x789b('0x45')]},'required':!![]});_0x38cd54['distinct']=!![];}if(_0x36f8b4['query'][_0x789b('0x49')]){_0x38cd54[_0x789b('0x44')][_0x789b('0x46')]({'model':db[_0x789b('0x4a')],'as':'Messages','attributes':['id',_0x789b('0x4b'),_0x789b('0x4c'),_0x789b('0x49')],'where':{'direction':'in','read':_0x36f8b4[_0x789b('0x32')][_0x789b('0x49')]||![]},'required':!![]});_0x38cd54[_0x789b('0x4d')]=!![];}return db['ChatInteraction'][_0x789b('0x23')](_0x38cd54)['then'](function(_0x47634f){_0x3fd08c['count']=_0x47634f;if(_0x36f8b4[_0x789b('0x32')][_0x789b('0x4e')]){_0x4c4ae7[_0x789b('0x44')]=[{'model':db['User'],'as':_0x789b('0x4f'),'required':![],'attributes':['id','name',_0x789b('0x50')]},{'model':db[_0x789b('0x51')],'as':_0x789b('0x52'),'required':![]},{'model':db['User'],'as':_0x789b('0x53'),'attributes':[_0x789b('0x2c'),'fullname','internal'],'required':![]},{'model':db[_0x789b('0x54')],'as':_0x789b('0x55'),'attributes':[_0x789b('0x2c'),_0x789b('0x56')],'required':![]},{'model':db[_0x789b('0x4a')],'as':'Messages','attributes':['id',_0x789b('0x4b'),'createdAt',_0x789b('0x49')],'where':{'direction':'in','read':_0x36f8b4[_0x789b('0x32')][_0x789b('0x49')]||![]},'required':_0x36f8b4[_0x789b('0x32')][_0x789b('0x49')]||![]},{'model':db['Tag'],'as':_0x789b('0x48'),'attributes':['id',_0x789b('0x2c'),_0x789b('0x57')],'required':_0x36f8b4[_0x789b('0x32')][_0x789b('0x45')]?!![]:![]},{'model':db['Tag'],'as':_0x789b('0x58'),'attributes':['id',_0x789b('0x2c'),_0x789b('0x57')],'through':_0x36f8b4[_0x789b('0x32')]['tag']?{'attributes':[],'where':{'TagId':_0x36f8b4['query'][_0x789b('0x45')]||undefined}}:{},'required':_0x36f8b4[_0x789b('0x32')][_0x789b('0x45')]?!![]:![]}];}return db[_0x789b('0x2e')]['findAll'](_0x4c4ae7);})[_0x789b('0x15')](function(_0x525821){_0x3fd08c['rows']=_0x525821;return _0x3fd08c;})[_0x789b('0x15')](respondWithFilteredResult(_0xe683,_0x4c4ae7))['catch'](handleError(_0xe683,null));};exports['show']=function(_0x563651,_0x2c06da){var _0x3c9687={'raw':![],'where':{'id':_0x563651[_0x789b('0x59')]['id']}},_0x3df417={};_0x3df417['model']=_[_0x789b('0x31')](db[_0x789b('0x2e')][_0x789b('0x2f')]);_0x3df417[_0x789b('0x32')]=_[_0x789b('0x31')](_0x563651[_0x789b('0x32')]);_0x3df417[_0x789b('0x34')]=_[_0x789b('0x35')](_0x3df417[_0x789b('0x30')],_0x3df417[_0x789b('0x32')]);_0x3c9687[_0x789b('0x36')]=_['intersection'](_0x3df417[_0x789b('0x30')],qs[_0x789b('0x37')](_0x563651['query']['fields']));_0x3c9687[_0x789b('0x36')]=_0x3c9687[_0x789b('0x36')][_0x789b('0x5a')]?_0x3c9687['attributes']:_0x3df417[_0x789b('0x30')];if(_0x563651[_0x789b('0x32')][_0x789b('0x4e')]){_0x3c9687[_0x789b('0x44')]=[{'all':!![]}];}_0x3c9687=_[_0x789b('0x42')]({},_0x3c9687,_0x563651[_0x789b('0x43')]);return db[_0x789b('0x2e')][_0x789b('0x5b')](_0x3c9687)[_0x789b('0x15')](handleEntityNotFound(_0x2c06da,null))[_0x789b('0x15')](respondWithResult(_0x2c06da,null))[_0x789b('0x1f')](handleError(_0x2c06da,null));};exports[_0x789b('0x5c')]=function(_0x1c90b9,_0x521bdf){return db[_0x789b('0x2e')][_0x789b('0x5c')](_0x1c90b9[_0x789b('0x5d')],{})[_0x789b('0x15')](respondWithResult(_0x521bdf,0xc9))[_0x789b('0x1f')](handleError(_0x521bdf,null));};exports[_0x789b('0x2a')]=function(_0x562330,_0x3a4c4a){if(_0x562330[_0x789b('0x5d')]['id']){delete _0x562330['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x562330[_0x789b('0x59')]['id']}})[_0x789b('0x15')](handleEntityNotFound(_0x3a4c4a,null))[_0x789b('0x15')](saveUpdates(_0x562330[_0x789b('0x5d')],null))[_0x789b('0x15')](respondWithResult(_0x3a4c4a,null))[_0x789b('0x1f')](handleError(_0x3a4c4a,null));};exports['destroy']=function(_0x3ae521,_0x20e9a7){return db[_0x789b('0x2e')][_0x789b('0x5b')]({'where':{'id':_0x3ae521['params']['id']}})[_0x789b('0x15')](handleEntityNotFound(_0x20e9a7,null))[_0x789b('0x15')](removeEntity(_0x20e9a7,null))[_0x789b('0x1f')](handleError(_0x20e9a7,null));};exports['describe']=function(_0x31e2eb,_0x5ec6a5){return db[_0x789b('0x2e')][_0x789b('0x5e')]()[_0x789b('0x15')](respondWithResult(_0x5ec6a5,null))['catch'](handleError(_0x5ec6a5,null));};exports[_0x789b('0x5f')]=function(_0xc20b86,_0x39439b){if(_0xc20b86[_0x789b('0x5d')]['id']){delete _0xc20b86[_0x789b('0x5d')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0xc20b86[_0x789b('0x59')]['id']}})[_0x789b('0x15')](handleEntityNotFound(_0x39439b,null))[_0x789b('0x15')](saveUpdates(_0xc20b86[_0x789b('0x5d')],null))['then'](respondWithResult(_0x39439b,null))[_0x789b('0x1f')](handleError(_0x39439b,null));};exports[_0x789b('0x60')]=function(_0x132d7d,_0x125692,_0x505043){if(_0x132d7d[_0x789b('0x5d')]['id']){delete _0x132d7d[_0x789b('0x5d')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x132d7d['params']['id']}})[_0x789b('0x15')](function(_0x2bfaa2){if(!_0x2bfaa2){logger['error'](_0x789b('0x61'),_0x789b('0x60'),0x194,_0x789b('0x62'));_0x125692[_0x789b('0x2b')](0x194);}else{if(_0x2bfaa2[_0x789b('0x63')]){throw new db[(_0x789b('0x64'))][(_0x789b('0x65'))](_0x789b('0x66'));}}return _0x2bfaa2;})[_0x789b('0x15')](function(_0x529f2f){if(_0x529f2f){return _0x529f2f[_0x789b('0x2a')]({'closed':_0x132d7d['body'][_0x789b('0x67')],'closedAt':_0x132d7d[_0x789b('0x5d')][_0x789b('0x68')],'disposition':_0x132d7d[_0x789b('0x5d')][_0x789b('0x69')]})[_0x789b('0x15')](function(_0x2acb06){return _0x2acb06;});}})['then'](function(_0x3df0d7){return respondWithRpcPromise(_0x789b('0x6a'),_0x789b('0x60'),_0x132d7d[_0x789b('0x5d')],client9004);})[_0x789b('0x15')](respondWithResult(_0x125692,null))[_0x789b('0x1f')](handleError(_0x125692,null));};exports['attachmentUpload']=function(_0x15ccd3,_0x5ab6d0,_0x2153f7){_0x15ccd3[_0x789b('0x5d')][_0x789b('0x2c')]=_0x15ccd3['file']['originalname'];_0x15ccd3[_0x789b('0x5d')][_0x789b('0x6b')]=_0x15ccd3[_0x789b('0x6c')][_0x789b('0x6d')];_0x15ccd3[_0x789b('0x5d')][_0x789b('0x6e')]=_0x15ccd3[_0x789b('0x6c')][_0x789b('0x6f')];return db['Attachment']['create'](_0x15ccd3['body'])[_0x789b('0x15')](respondWithResult(_0x5ab6d0,0xc9))[_0x789b('0x1f')](handleError(_0x5ab6d0,null));};exports[_0x789b('0x70')]=function(_0x4f48cc,_0x4800c0,_0x4c45e4){return db[_0x789b('0x2e')][_0x789b('0x71')]({'where':{'id':_0x4f48cc[_0x789b('0x59')]['id']},'raw':!![]})[_0x789b('0x15')](handleEntityNotFound(_0x4800c0,null))[_0x789b('0x15')](function(_0x429a30){if(_0x429a30){if(_0x429a30[_0x789b('0x67')]){return _0x4800c0[_0x789b('0x20')](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0x789b('0x72')][_0x789b('0x71')]({'where':{'id':_0x4f48cc['query']['attachId']},'raw':!![]})[_0x789b('0x15')](handleEntityNotFound(_0x4800c0,null));}})[_0x789b('0x15')](function(_0x4a925e){if(_0x4a925e){return _0x4800c0[_0x789b('0x73')](path['join'](config['root'],'server/files/attachments/',_0x4a925e[_0x789b('0x6b')]));}})[_0x789b('0x1f')](handleError(_0x4800c0,null));};exports[_0x789b('0x74')]=function(_0x6bca5,_0x10e219){var _0x56cc11=null;var _0xefaea3=null;var _0x132022=null;var _0x2bba30=null;if(_0x6bca5[_0x789b('0x5d')]['id']){delete _0x6bca5[_0x789b('0x5d')]['id'];}if(_0x6bca5[_0x789b('0x5d')][_0x789b('0x75')]){_0x2bba30=path[_0x789b('0x76')](config['root'],_0x789b('0x77'),util['format'](_0x789b('0x78'),Date['now']()));_0x6bca5[_0x789b('0x5d')][_0x789b('0x79')]=_0x2bba30;}return db[_0x789b('0x2e')][_0x789b('0x5b')]({'where':{'id':_0x6bca5[_0x789b('0x59')]['id']},'include':[{'model':db[_0x789b('0x4a')],'as':_0x789b('0x7a'),'include':[{'model':db['User'],'as':_0x789b('0x7b')}]}]})[_0x789b('0x15')](handleEntityNotFound(_0x10e219,null))[_0x789b('0x15')](saveUpdates(_0x6bca5[_0x789b('0x5d')],null))['then'](function(_0x2037f7){if(_0x2037f7){_0x56cc11=_0x2037f7;return db[_0x789b('0x54')][_0x789b('0x5b')]({'where':{'id':_0x56cc11['ChatWebsiteId']}});}})[_0x789b('0x15')](function(_0x4befdf){if(_0x4befdf){_0x132022=_0x4befdf;return db[_0x789b('0x51')][_0x789b('0x5b')]({'where':{'id':_0x56cc11[_0x789b('0x7c')]}});}})[_0x789b('0x15')](function(_0xfd49d5){if(_0xfd49d5){_0xefaea3=_0xfd49d5;if(_0x2bba30){var _0x146c0c=null;for(var _0x1d0bd9=0x1;_0x1d0bd9<_0x56cc11['Messages'][_0x789b('0x5a')];++_0x1d0bd9){_0x146c0c=_0x56cc11[_0x789b('0x7a')][_0x1d0bd9];var _0x41dae0=_0x146c0c[_0x789b('0x63')]?util[_0x789b('0x7d')](_0x789b('0x7e'),_0x132022[_0x789b('0x7f')],_0x146c0c['UserId']):_0x789b('0x80');var _0x1b4d3d=_0x6bca5[_0x789b('0x5d')][_0x789b('0x81')]||util['format'](_0x789b('0x7e'),_0x789b('0x82'),_0x146c0c['ContactId']);switch(_0x132022['agentIdentifier']){case _0x789b('0x83'):_0x41dae0=_0x146c0c[_0x789b('0x63')]?util[_0x789b('0x7d')](_0x789b('0x7e'),_0x132022[_0x789b('0x7f')],_0x146c0c[_0x789b('0x63')]):_0x789b('0x80');break;case _0x789b('0x84'):_0x41dae0=_0x146c0c[_0x789b('0x63')]?_0x146c0c[_0x789b('0x7b')][_0x789b('0x85')]||_0x146c0c[_0x789b('0x7b')][_0x789b('0x50')]:_0x789b('0x80');break;case'agent_fullname':_0x41dae0=_0x146c0c[_0x789b('0x63')]?_0x146c0c[_0x789b('0x7b')][_0x789b('0x50')]:_0x789b('0x80');break;default:_0x41dae0=_0x146c0c[_0x789b('0x63')]?util['format'](_0x789b('0x7e'),_0x132022[_0x789b('0x7f')],_0x146c0c[_0x789b('0x63')]):_0x789b('0x80');}var _0x1a4c3c=util['format'](_0x789b('0x86'),moment(_0x146c0c[_0x789b('0x4c')])['format']('MM/DD/YYYY\x20HH:mm:ss'),_0x146c0c[_0x789b('0x4b')]==='in'?_0x1b4d3d:_0x41dae0,_0x146c0c['body']);if(!_0x146c0c[_0x789b('0x87')]){fs[_0x789b('0x88')](_0x2bba30,_0x1a4c3c);}}return db['MailAccount'][_0x789b('0x71')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x789b('0x89'),'raw':!![]}]});}}})[_0x789b('0x15')](function(_0x27a4cb){if(_0x27a4cb&&_0x27a4cb[_0x789b('0x89')]&&_0x6bca5[_0x789b('0x5d')]){var _0x154d2f={'tls':{'rejectUnauthorized':![]}};if(_0x27a4cb[_0x789b('0x89')][_0x789b('0x8a')]){_0x154d2f[_0x789b('0x8a')]=_0x27a4cb[_0x789b('0x89')][_0x789b('0x8a')];}else{_0x154d2f['host']=_0x27a4cb[_0x789b('0x89')][_0x789b('0x8b')];_0x154d2f[_0x789b('0x8c')]=_0x27a4cb[_0x789b('0x89')]['port'];_0x154d2f[_0x789b('0x8d')]=_0x27a4cb['Smtp'][_0x789b('0x8d')];}if(_0x27a4cb['Smtp']['authentication']){_0x154d2f[_0x789b('0x8e')]={'user':_0x27a4cb[_0x789b('0x89')][_0x789b('0x8f')],'pass':_0x27a4cb[_0x789b('0x89')][_0x789b('0x90')]};}return respondWithRpcPromise(_0x789b('0x91'),_0x789b('0x92'),{'account':_0x154d2f,'message':{'from':util[_0x789b('0x7d')](_0x789b('0x93'),_0x27a4cb['name'],_0x27a4cb[_0x789b('0x94')]||_0x27a4cb[_0x789b('0x89')][_0x789b('0x8f')]),'to':_0x6bca5[_0x789b('0x5d')][_0x789b('0x75')],'subject':_0x789b('0x95'),'text':util[_0x789b('0x7d')](_0x789b('0x96'),_0x6bca5[_0x789b('0x5d')]['mailTranscript']),'attachments':[{'path':_0x2bba30}]}})['then'](function(){return _0x56cc11;})[_0x789b('0x1f')](function(_0x21b5fb){console[_0x789b('0x1b')](_0x21b5fb);});}else{return _0x56cc11;}})['then'](respondWithStatusCode(_0x10e219,0xc8))[_0x789b('0x1f')](handleError(_0x10e219,null));};exports[_0x789b('0x97')]=function(_0x3e5b67,_0x55a230,_0x4c613e){return db['ChatMessage'][_0x789b('0x5b')]({'where':{'id':_0x3e5b67['params']['id']}})[_0x789b('0x15')](handleEntityNotFound(_0x55a230,null))[_0x789b('0x15')](function(_0x15c856){if(_0x15c856){return _0x15c856[_0x789b('0x97')](_0x3e5b67[_0x789b('0x5d')][_0x789b('0x98')],_[_0x789b('0x99')](_0x3e5b67[_0x789b('0x5d')],['ids','id'])||{});}})[_0x789b('0x15')](respondWithResult(_0x55a230,null))[_0x789b('0x1f')](handleError(_0x55a230,null));};exports[_0x789b('0x9a')]=function(_0x18c7e9,_0x24d1ab,_0x41c001){var _0x57c167={'raw':![],'where':{}};var _0x3a14e4={};var _0x1d9ee4={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x789b('0x71')]({'where':{'id':_0x18c7e9[_0x789b('0x59')]['id']}})[_0x789b('0x15')](handleEntityNotFound(_0x24d1ab,null))['then'](function(_0x33fa99){if(_0x33fa99){_0x3a14e4[_0x789b('0x30')]=_['keys'](db[_0x789b('0x4a')][_0x789b('0x2f')]);_0x3a14e4['query']=_[_0x789b('0x31')](_0x18c7e9[_0x789b('0x32')]);_0x3a14e4[_0x789b('0x34')]=_[_0x789b('0x35')](_0x3a14e4[_0x789b('0x30')],_0x3a14e4[_0x789b('0x32')]);_0x57c167[_0x789b('0x36')]=_[_0x789b('0x35')](_0x3a14e4[_0x789b('0x30')],qs[_0x789b('0x37')](_0x18c7e9[_0x789b('0x32')][_0x789b('0x37')]));_0x57c167['attributes']=_0x57c167['attributes'][_0x789b('0x5a')]?_0x57c167[_0x789b('0x36')]:_0x3a14e4['model'];if(!_0x18c7e9['query'][_0x789b('0x38')]('nolimit')){_0x57c167['limit']=qs[_0x789b('0x25')](_0x18c7e9[_0x789b('0x32')][_0x789b('0x25')]);_0x57c167[_0x789b('0x24')]=qs[_0x789b('0x24')](_0x18c7e9[_0x789b('0x32')]['offset']);}_0x57c167['order']=qs[_0x789b('0x3b')](_0x18c7e9[_0x789b('0x32')]['sort']);_0x57c167[_0x789b('0x40')]=qs[_0x789b('0x34')](_[_0x789b('0x3c')](_0x18c7e9[_0x789b('0x32')],_0x3a14e4[_0x789b('0x34')]));_0x57c167[_0x789b('0x40')][_0x789b('0x9b')]=_0x33fa99['id'];if(_0x18c7e9[_0x789b('0x32')][_0x789b('0x41')]){_0x57c167[_0x789b('0x40')]=_[_0x789b('0x42')](_0x57c167['where'],{'$or':_[_0x789b('0x9c')](_0x57c167[_0x789b('0x36')],function(_0x5a5abf){var _0x30a008={};_0x30a008[_0x5a5abf]={'$like':'%'+_0x18c7e9[_0x789b('0x32')]['filter']+'%'};return _0x30a008;})});}if(_0x18c7e9[_0x789b('0x32')][_0x789b('0x9d')]){var _0x4c122c=_0x18c7e9[_0x789b('0x32')][_0x789b('0x9d')]['split'](',');var _0xc18b60={};_0xc18b60[_0x4c122c[0x0]]={'$gte':moment(_0x4c122c[0x1])[_0x789b('0x7d')](_0x789b('0x9e'))};_0x57c167[_0x789b('0x40')]=_['merge'](_0x57c167['where'],_0xc18b60);}_0x57c167=_[_0x789b('0x42')]({},_0x57c167,_0x18c7e9[_0x789b('0x43')]);return db['ChatMessage'][_0x789b('0x23')]({'where':_0x57c167[_0x789b('0x40')]})['then'](function(_0x4e831e){_0x1d9ee4[_0x789b('0x23')]=_0x4e831e;if(_0x18c7e9['query'][_0x789b('0x4e')]){_0x57c167[_0x789b('0x44')]=[{'all':!![]}];}return db['ChatMessage'][_0x789b('0x9f')](_0x57c167);})['then'](function(_0x4201b5){_0x1d9ee4[_0x789b('0xa0')]=_0x4201b5;return _0x1d9ee4;});}})['then'](respondWithFilteredResult(_0x24d1ab,_0x57c167))[_0x789b('0x1f')](handleError(_0x24d1ab,null));};exports[_0x789b('0xa1')]=function(_0x4d15d9,_0x20104b,_0x402d28){var _0x1926a9={'where':{}},_0x542635={},_0x56bd30={'count':0x0,'rows':[]};return db[_0x789b('0x2e')][_0x789b('0x71')]({'where':{'id':_0x4d15d9[_0x789b('0x59')]['id']}})[_0x789b('0x15')](handleEntityNotFound(_0x20104b,null))[_0x789b('0x15')](function(_0x52e5bc){if(_0x52e5bc){_0x542635[_0x789b('0x30')]=_[_0x789b('0x31')](db[_0x789b('0x4a')][_0x789b('0x2f')]);_0x542635['query']=_[_0x789b('0x31')](_0x4d15d9['query']);_0x542635[_0x789b('0x34')]=_[_0x789b('0x35')](_0x542635['model'],_0x542635[_0x789b('0x32')]);_0x1926a9[_0x789b('0x36')]=_[_0x789b('0x35')](_0x542635[_0x789b('0x30')],qs[_0x789b('0x37')](_0x4d15d9[_0x789b('0x32')][_0x789b('0x37')]));_0x1926a9[_0x789b('0x36')]=_0x1926a9[_0x789b('0x36')][_0x789b('0x5a')]?_0x1926a9[_0x789b('0x36')]:_0x542635[_0x789b('0x30')];if(!_0x4d15d9[_0x789b('0x32')][_0x789b('0x38')](_0x789b('0x39'))){_0x1926a9[_0x789b('0x25')]=qs[_0x789b('0x25')](_0x4d15d9[_0x789b('0x32')][_0x789b('0x25')]);_0x1926a9[_0x789b('0x24')]=qs[_0x789b('0x24')](_0x4d15d9[_0x789b('0x32')][_0x789b('0x24')]);}_0x1926a9[_0x789b('0x3a')]=qs[_0x789b('0x3b')](_0x4d15d9['query'][_0x789b('0x3b')]);_0x1926a9['where']=qs[_0x789b('0x34')](_[_0x789b('0x3c')](_0x4d15d9[_0x789b('0x32')],_0x542635[_0x789b('0x34')]));_0x1926a9[_0x789b('0x40')]['ChatInteractionId']=_0x52e5bc['id'];if(_0x4d15d9['query'][_0x789b('0x41')]){_0x1926a9['where']=_['merge'](_0x1926a9[_0x789b('0x40')],{'$or':_['map'](_0x1926a9[_0x789b('0x36')],function(_0x57ecb5){var _0x535d35={};_0x535d35[_0x57ecb5]={'$like':'%'+_0x4d15d9[_0x789b('0x32')]['filter']+'%'};return _0x535d35;})});}_0x1926a9['where'][_0x789b('0x87')]=![];if(_0x4d15d9[_0x789b('0x32')]['id']){_0x1926a9['where']['id']={'$gt':_0x4d15d9[_0x789b('0x32')]['id']};}_0x1926a9=_['merge']({},_0x1926a9,_0x4d15d9['options']);return db['ChatMessage'][_0x789b('0x23')]({'where':_0x1926a9[_0x789b('0x40')]})[_0x789b('0x15')](function(_0x3e66ea){_0x56bd30['count']=_0x3e66ea;_0x1926a9[_0x789b('0x44')]=[];if(_0x4d15d9[_0x789b('0x32')][_0x789b('0xa2')]){_0x1926a9[_0x789b('0x44')][_0x789b('0x46')]({'model':db[_0x789b('0x7b')],'as':_0x789b('0x7b'),'attributes':['id',_0x789b('0x50'),_0x789b('0x85')]});}if(_0x4d15d9[_0x789b('0x32')][_0x789b('0x4e')]){_0x1926a9[_0x789b('0x44')]=[{'all':!![]}];}return db[_0x789b('0x4a')][_0x789b('0x9f')](_0x1926a9);})['then'](function(_0x1fd804){_0x56bd30['rows']=_0x1fd804;return _0x56bd30;});}})[_0x789b('0x15')](respondWithFilteredResult(_0x20104b,_0x1926a9))[_0x789b('0x1f')](handleError(_0x20104b,null));};exports[_0x789b('0xa3')]=function(_0x46b3d5,_0x386ee0,_0x2baea9){return db[_0x789b('0x2e')][_0x789b('0x5b')]({'where':{'id':_0x46b3d5[_0x789b('0x59')]['id']}})[_0x789b('0x15')](handleEntityNotFound(_0x386ee0,null))[_0x789b('0x15')](function(_0x3f5b33){if(_0x3f5b33){return _0x3f5b33['setTags'](_0x46b3d5['body'][_0x789b('0x98')],_[_0x789b('0x99')](_0x46b3d5[_0x789b('0x5d')],['ids','id'])||{})[_0x789b('0xa4')](function(){return db[_0x789b('0x47')][_0x789b('0x9f')]({'attributes':['id',_0x789b('0x2c'),_0x789b('0x57')],'where':{'id':_0x46b3d5['body'][_0x789b('0x98')]}});})[_0x789b('0x15')](function(_0x5c2aa0){socket[_0x789b('0xa5')](_0x789b('0xa6'),{'id':Number(_0x46b3d5[_0x789b('0x59')]['id']),'tags':_0x5c2aa0||[]});return{'id':Number(_0x46b3d5[_0x789b('0x59')]['id']),'tags':_0x5c2aa0||[]};});}})['then'](respondWithResult(_0x386ee0,null))[_0x789b('0x1f')](handleError(_0x386ee0,null));};exports[_0x789b('0xa7')]=function(_0x1ccf7e,_0x59e14f,_0x390e37){var _0x204961;return db['ChatInteraction'][_0x789b('0x5b')]({'where':{'id':_0x1ccf7e[_0x789b('0x59')]['id']}})[_0x789b('0x15')](handleEntityNotFound(_0x59e14f,null))[_0x789b('0x15')](function(_0x5b9738){if(_0x5b9738){return _0x5b9738['removeTags'](_0x1ccf7e[_0x789b('0x32')][_0x789b('0x98')]);}})['then'](respondWithStatusCode(_0x59e14f,null))['catch'](handleError(_0x59e14f,null));}; \ No newline at end of file +var _0xdb7c=['read','Messages','direction','createdAt','includeAll','Users','fullname','Contact','internal','ChatWebsite','Account','key','ChatMessage','color','ThroughTags','catch','show','params','length','find','create','update','describe','customUpdate','body','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Sequelize','ValidationError','closed','closedAt','disposition','AbandonInteraction','attachmentUpload','file','originalname','filename','type','mimetype','Attachment','attachmentDownload','findOne','attachId','download','join','root','server/files/attachments/','basename','close','mailTranscript','server/files/chat/upload/','format','now','pathTranscript','User','CmContact','ContactId','%s%d','agentAlias','customer','agentIdentifier','website_alias','UserId','agent_alias','agent_fullname','System','[%s]\x20%s:\x20%s\x0a','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','port','secure','authentication','auth','user','SendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','ChatInteractionId','$gte','split','findAll','rows','getMyMessages','order','includeAgent','alias','addTags','setTags','spread','removeTags','fast-json-patch','request-promise','moment','bluebird','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','jayson/promise','client','http','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','count','limit','set','Content-Range','json','apply','save','stack','name','index','ChatInteraction','rawAttributes','keys','query','dateStart','dateEnd','filters','model','attributes','intersection','fields','nolimit','offset','sort','where','pick','add','filter','merge','map','options','include','tag','push','Tag','Tags','distinct'];(function(_0x435f71,_0x2ff13d){var _0x6811ae=function(_0x13bdf4){while(--_0x13bdf4){_0x435f71['push'](_0x435f71['shift']());}};_0x6811ae(++_0x2ff13d);}(_0xdb7c,0x114));var _0xcdb7=function(_0x31b9cf,_0x1a809b){_0x31b9cf=_0x31b9cf-0x0;var _0x357b8a=_0xdb7c[_0x31b9cf];return _0x357b8a;};'use strict';var jsonpatch=require(_0xcdb7('0x0'));var rp=require(_0xcdb7('0x1'));var moment=require(_0xcdb7('0x2'));var BPromise=require(_0xcdb7('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xcdb7('0x4'));var csv=require(_0xcdb7('0x5'));var ejs=require(_0xcdb7('0x6'));var fs=require('fs');var _=require(_0xcdb7('0x7'));var squel=require(_0xcdb7('0x8'));var crypto=require(_0xcdb7('0x9'));var jsforce=require(_0xcdb7('0xa'));var deskjs=require(_0xcdb7('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcdb7('0xc'));var qs=require(_0xcdb7('0xd'));var logger=require(_0xcdb7('0xe'))(_0xcdb7('0xf'));var utils=require(_0xcdb7('0x10'));var config=require(_0xcdb7('0x11'));var db=require(_0xcdb7('0x12'))['db'];var socket=require(_0xcdb7('0x13'))({'host':_0xcdb7('0x14'),'port':0x18eb});require('./chatInteraction.socket')[_0xcdb7('0x15')](socket);var jayson=require(_0xcdb7('0x16'));var client=jayson[_0xcdb7('0x17')][_0xcdb7('0x18')]({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x187c85,_0xc48bd0,_0x8d6413,_0x7b9e8d){return new BPromise(function(_0xf13a8d,_0x2db1e8){var _0x5d7eee=_0x7b9e8d||client;return _0x5d7eee[_0xcdb7('0x19')](_0x187c85,_0x8d6413)[_0xcdb7('0x1a')](function(_0x224fe6){logger['info'](_0xcdb7('0x1b'),_0xc48bd0,_0xcdb7('0x1c'));logger[_0xcdb7('0x1d')](_0xcdb7('0x1e'),_0xc48bd0,_0xcdb7('0x1c'),JSON[_0xcdb7('0x1f')](_0x224fe6));if(_0x224fe6['error']){if(_0x224fe6[_0xcdb7('0x20')][_0xcdb7('0x21')]===0x1f4){logger[_0xcdb7('0x20')](_0xcdb7('0x1b'),_0xc48bd0,_0x224fe6[_0xcdb7('0x20')][_0xcdb7('0x22')]);return _0x2db1e8(_0x224fe6[_0xcdb7('0x20')][_0xcdb7('0x22')]);}logger[_0xcdb7('0x20')](_0xcdb7('0x1b'),_0xc48bd0,_0x224fe6[_0xcdb7('0x20')][_0xcdb7('0x22')]);return _0xf13a8d(_0x224fe6[_0xcdb7('0x20')]['message']);}else{logger['info'](_0xcdb7('0x1b'),_0xc48bd0,'request\x20sent');_0xf13a8d(_0x224fe6[_0xcdb7('0x23')][_0xcdb7('0x22')]);}})['catch'](function(_0x5c207b){logger['error'](_0xcdb7('0x1b'),_0xc48bd0,_0x5c207b);_0x2db1e8(_0x5c207b);});});}function respondWithStatusCode(_0x32e44b,_0x573bc6){_0x573bc6=_0x573bc6||0xcc;return function(_0x29b0c4){if(_0x29b0c4){return _0x32e44b[_0xcdb7('0x24')](_0x573bc6);}return _0x32e44b[_0xcdb7('0x25')](_0x573bc6)[_0xcdb7('0x26')]();};}function respondWithResult(_0x4b8275,_0x3205bc){_0x3205bc=_0x3205bc||0xc8;return function(_0x190b0f){if(_0x190b0f){return _0x4b8275[_0xcdb7('0x25')](_0x3205bc)['json'](_0x190b0f);}};}function respondWithFilteredResult(_0x266edb,_0x4d2d63){return function(_0x1f8499){if(_0x1f8499){var _0x51a170=_0x1f8499[_0xcdb7('0x27')],_0x24bb32=_0x4d2d63['offset'],_0x319b20=_0x4d2d63['offset']+_0x4d2d63[_0xcdb7('0x28')],_0x1f448e;if(_0x319b20>=_0x51a170){_0x319b20=_0x51a170;_0x1f448e=0xc8;}else{_0x1f448e=0xce;}_0x266edb[_0xcdb7('0x25')](_0x1f448e);return _0x266edb[_0xcdb7('0x29')](_0xcdb7('0x2a'),_0x24bb32+'-'+_0x319b20+'/'+_0x51a170)[_0xcdb7('0x2b')](_0x1f8499);}return null;};}function patchUpdates(_0x2a1bc8){return function(_0x14f25d){try{jsonpatch[_0xcdb7('0x2c')](_0x14f25d,_0x2a1bc8,!![]);}catch(_0x29c984){return BPromise['reject'](_0x29c984);}return _0x14f25d[_0xcdb7('0x2d')]();};}function saveUpdates(_0x462122,_0x4e0d3d){return function(_0x3f2249){if(_0x3f2249){return _0x3f2249['update'](_0x462122)['then'](function(_0x56118d){return _0x56118d;});}return null;};}function removeEntity(_0x5cd573,_0x5057d7){return function(_0x4eff3d){if(_0x4eff3d){return _0x4eff3d['destroy']()[_0xcdb7('0x1a')](function(){_0x5cd573[_0xcdb7('0x25')](0xcc)[_0xcdb7('0x26')]();});}};}function handleEntityNotFound(_0x4e903d,_0x56d2e6){return function(_0xab3025){if(!_0xab3025){_0x4e903d[_0xcdb7('0x24')](0x194);}return _0xab3025;};}function handleError(_0x1764ec,_0x206db9){_0x206db9=_0x206db9||0x1f4;return function(_0xc80f4b){logger[_0xcdb7('0x20')](_0xc80f4b[_0xcdb7('0x2e')]);if(_0xc80f4b[_0xcdb7('0x2f')]){delete _0xc80f4b[_0xcdb7('0x2f')];}_0x1764ec[_0xcdb7('0x25')](_0x206db9)['send'](_0xc80f4b);};}exports[_0xcdb7('0x30')]=function(_0x434c90,_0x24a241){var _0x550833={},_0x40ad36={},_0x3fee62={'count':0x0,'rows':[]};var _0x45fb75=db[_0xcdb7('0x31')][_0xcdb7('0x32')];_0x40ad36['model']=_[_0xcdb7('0x33')](_0x45fb75);var _0x285a3e={'dateStart':_0x434c90[_0xcdb7('0x34')][_0xcdb7('0x35')],'dateEnd':_0x434c90[_0xcdb7('0x34')][_0xcdb7('0x36')]};delete _0x434c90['query']['dateStart'];delete _0x434c90[_0xcdb7('0x34')][_0xcdb7('0x36')];_0x40ad36[_0xcdb7('0x34')]=_[_0xcdb7('0x33')](_0x434c90['query']);_0x40ad36[_0xcdb7('0x37')]=_['intersection'](_0x40ad36[_0xcdb7('0x38')],_0x40ad36[_0xcdb7('0x34')]);_0x550833[_0xcdb7('0x39')]=_[_0xcdb7('0x3a')](_0x40ad36[_0xcdb7('0x38')],qs['fields'](_0x434c90[_0xcdb7('0x34')][_0xcdb7('0x3b')]));_0x550833[_0xcdb7('0x39')]=_0x550833[_0xcdb7('0x39')]['length']?_0x550833[_0xcdb7('0x39')]:_0x40ad36[_0xcdb7('0x38')];if(!_0x434c90[_0xcdb7('0x34')]['hasOwnProperty'](_0xcdb7('0x3c'))){_0x550833[_0xcdb7('0x28')]=qs[_0xcdb7('0x28')](_0x434c90['query'][_0xcdb7('0x28')]);_0x550833[_0xcdb7('0x3d')]=qs[_0xcdb7('0x3d')](_0x434c90['query'][_0xcdb7('0x3d')]);}_0x550833['order']=qs[_0xcdb7('0x3e')](_0x434c90[_0xcdb7('0x34')][_0xcdb7('0x3e')]);_0x550833[_0xcdb7('0x3f')]=qs[_0xcdb7('0x37')](_[_0xcdb7('0x40')](_0x434c90['query'],_0x40ad36[_0xcdb7('0x37')]));if(_0x285a3e[_0xcdb7('0x35')]){if(_0x285a3e[_0xcdb7('0x36')]){_0x285a3e[_0xcdb7('0x36')]=moment(_0x285a3e['dateEnd'])[_0xcdb7('0x41')](0x1,'day');}else{_0x285a3e['dateEnd']=moment(_0x285a3e[_0xcdb7('0x35')])['add'](0x1,'day');}_['merge'](_0x550833[_0xcdb7('0x3f')],{'createdAt':{'$gte':_0x285a3e[_0xcdb7('0x35')],'$lte':_0x285a3e['dateEnd']}});}if(_0x434c90['query'][_0xcdb7('0x42')]){_0x550833['where']=_[_0xcdb7('0x43')](_0x550833['where'],{'$or':_[_0xcdb7('0x44')](_0x550833[_0xcdb7('0x39')],function(_0x12197c){var _0x35a46c={};_0x35a46c[_0x12197c]={'$like':'%'+_0x434c90['query'][_0xcdb7('0x42')]+'%'};return _0x35a46c;})});}_0x550833=_[_0xcdb7('0x43')]({},_0x550833,_0x434c90[_0xcdb7('0x45')]);var _0x55806e={'where':_0x550833[_0xcdb7('0x3f')]};_0x55806e[_0xcdb7('0x46')]=[];if(_0x434c90['query'][_0xcdb7('0x47')]){_0x55806e[_0xcdb7('0x46')][_0xcdb7('0x48')]({'model':db[_0xcdb7('0x49')],'as':_0xcdb7('0x4a'),'attributes':['id'],'where':{'id':_0x434c90[_0xcdb7('0x34')][_0xcdb7('0x47')]},'required':!![]});_0x55806e[_0xcdb7('0x4b')]=!![];}if(_0x434c90[_0xcdb7('0x34')][_0xcdb7('0x4c')]){_0x55806e['include']['push']({'model':db['ChatMessage'],'as':_0xcdb7('0x4d'),'attributes':['id',_0xcdb7('0x4e'),_0xcdb7('0x4f'),_0xcdb7('0x4c')],'where':{'direction':'in','read':_0x434c90[_0xcdb7('0x34')]['read']||![]},'required':!![]});_0x55806e[_0xcdb7('0x4b')]=!![];}return db[_0xcdb7('0x31')][_0xcdb7('0x27')](_0x55806e)[_0xcdb7('0x1a')](function(_0x2c2a05){_0x3fee62[_0xcdb7('0x27')]=_0x2c2a05;if(_0x434c90[_0xcdb7('0x34')][_0xcdb7('0x50')]){_0x550833[_0xcdb7('0x46')]=[{'model':db['User'],'as':_0xcdb7('0x51'),'required':![],'attributes':['id',_0xcdb7('0x2f'),_0xcdb7('0x52')]},{'model':db['CmContact'],'as':_0xcdb7('0x53'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name','fullname',_0xcdb7('0x54')],'required':![]},{'model':db[_0xcdb7('0x55')],'as':_0xcdb7('0x56'),'attributes':[_0xcdb7('0x2f'),_0xcdb7('0x57')],'required':![]},{'model':db[_0xcdb7('0x58')],'as':_0xcdb7('0x4d'),'attributes':['id',_0xcdb7('0x4e'),_0xcdb7('0x4f'),'read'],'where':{'direction':'in','read':_0x434c90[_0xcdb7('0x34')][_0xcdb7('0x4c')]||![]},'required':_0x434c90['query']['read']||![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0xcdb7('0x59')],'required':_0x434c90[_0xcdb7('0x34')][_0xcdb7('0x47')]?!![]:![]},{'model':db[_0xcdb7('0x49')],'as':_0xcdb7('0x5a'),'attributes':['id',_0xcdb7('0x2f'),_0xcdb7('0x59')],'through':_0x434c90[_0xcdb7('0x34')][_0xcdb7('0x47')]?{'attributes':[],'where':{'TagId':_0x434c90[_0xcdb7('0x34')][_0xcdb7('0x47')]||undefined}}:{},'required':_0x434c90['query']['tag']?!![]:![]}];}return db[_0xcdb7('0x31')]['findAll'](_0x550833);})[_0xcdb7('0x1a')](function(_0x13b839){_0x3fee62['rows']=_0x13b839;return _0x3fee62;})[_0xcdb7('0x1a')](respondWithFilteredResult(_0x24a241,_0x550833))[_0xcdb7('0x5b')](handleError(_0x24a241,null));};exports[_0xcdb7('0x5c')]=function(_0x594814,_0x5a28b4){var _0x13d035={'raw':![],'where':{'id':_0x594814[_0xcdb7('0x5d')]['id']}},_0x30817c={};_0x30817c[_0xcdb7('0x38')]=_['keys'](db['ChatInteraction'][_0xcdb7('0x32')]);_0x30817c[_0xcdb7('0x34')]=_[_0xcdb7('0x33')](_0x594814['query']);_0x30817c[_0xcdb7('0x37')]=_[_0xcdb7('0x3a')](_0x30817c['model'],_0x30817c[_0xcdb7('0x34')]);_0x13d035[_0xcdb7('0x39')]=_[_0xcdb7('0x3a')](_0x30817c[_0xcdb7('0x38')],qs['fields'](_0x594814[_0xcdb7('0x34')][_0xcdb7('0x3b')]));_0x13d035[_0xcdb7('0x39')]=_0x13d035[_0xcdb7('0x39')][_0xcdb7('0x5e')]?_0x13d035['attributes']:_0x30817c[_0xcdb7('0x38')];if(_0x594814[_0xcdb7('0x34')][_0xcdb7('0x50')]){_0x13d035[_0xcdb7('0x46')]=[{'all':!![]}];}_0x13d035=_[_0xcdb7('0x43')]({},_0x13d035,_0x594814[_0xcdb7('0x45')]);return db[_0xcdb7('0x31')][_0xcdb7('0x5f')](_0x13d035)['then'](handleEntityNotFound(_0x5a28b4,null))[_0xcdb7('0x1a')](respondWithResult(_0x5a28b4,null))[_0xcdb7('0x5b')](handleError(_0x5a28b4,null));};exports[_0xcdb7('0x60')]=function(_0x3a7887,_0x525ebc){return db[_0xcdb7('0x31')][_0xcdb7('0x60')](_0x3a7887['body'],{})[_0xcdb7('0x1a')](respondWithResult(_0x525ebc,0xc9))[_0xcdb7('0x5b')](handleError(_0x525ebc,null));};exports[_0xcdb7('0x61')]=function(_0x3bece8,_0x58fe5e){if(_0x3bece8['body']['id']){delete _0x3bece8['body']['id'];}return db['ChatInteraction'][_0xcdb7('0x5f')]({'where':{'id':_0x3bece8[_0xcdb7('0x5d')]['id']}})[_0xcdb7('0x1a')](handleEntityNotFound(_0x58fe5e,null))[_0xcdb7('0x1a')](saveUpdates(_0x3bece8['body'],null))[_0xcdb7('0x1a')](respondWithResult(_0x58fe5e,null))[_0xcdb7('0x5b')](handleError(_0x58fe5e,null));};exports['destroy']=function(_0x2e034a,_0x501f1e){return db[_0xcdb7('0x31')]['find']({'where':{'id':_0x2e034a[_0xcdb7('0x5d')]['id']}})[_0xcdb7('0x1a')](handleEntityNotFound(_0x501f1e,null))['then'](removeEntity(_0x501f1e,null))[_0xcdb7('0x5b')](handleError(_0x501f1e,null));};exports[_0xcdb7('0x62')]=function(_0x4bc6e6,_0x7347b){return db['ChatInteraction'][_0xcdb7('0x62')]()[_0xcdb7('0x1a')](respondWithResult(_0x7347b,null))[_0xcdb7('0x5b')](handleError(_0x7347b,null));};exports[_0xcdb7('0x63')]=function(_0x254bc5,_0x33fb0a){if(_0x254bc5[_0xcdb7('0x64')]['id']){delete _0x254bc5[_0xcdb7('0x64')]['id'];}return db[_0xcdb7('0x31')]['find']({'where':{'id':_0x254bc5[_0xcdb7('0x5d')]['id']}})['then'](handleEntityNotFound(_0x33fb0a,null))[_0xcdb7('0x1a')](saveUpdates(_0x254bc5[_0xcdb7('0x64')],null))[_0xcdb7('0x1a')](respondWithResult(_0x33fb0a,null))[_0xcdb7('0x5b')](handleError(_0x33fb0a,null));};exports[_0xcdb7('0x65')]=function(_0x29a5e3,_0x5ee2d2,_0x5001df){if(_0x29a5e3['body']['id']){delete _0x29a5e3[_0xcdb7('0x64')]['id'];}return db[_0xcdb7('0x31')][_0xcdb7('0x5f')]({'where':{'id':_0x29a5e3[_0xcdb7('0x5d')]['id']}})['then'](function(_0x418fd9){if(!_0x418fd9){logger[_0xcdb7('0x20')](_0xcdb7('0x66'),_0xcdb7('0x65'),0x194,_0xcdb7('0x67'));_0x5ee2d2[_0xcdb7('0x24')](0x194);}else{if(_0x418fd9['UserId']){throw new db[(_0xcdb7('0x68'))][(_0xcdb7('0x69'))]('Interaction\x20already\x20assigned');}}return _0x418fd9;})[_0xcdb7('0x1a')](function(_0x392721){if(_0x392721){return _0x392721[_0xcdb7('0x61')]({'closed':_0x29a5e3[_0xcdb7('0x64')][_0xcdb7('0x6a')],'closedAt':_0x29a5e3[_0xcdb7('0x64')][_0xcdb7('0x6b')],'disposition':_0x29a5e3[_0xcdb7('0x64')][_0xcdb7('0x6c')]})['then'](function(_0x549be5){return _0x549be5;});}})['then'](function(_0x26d31b){return respondWithRpcPromise(_0xcdb7('0x6d'),_0xcdb7('0x65'),_0x29a5e3[_0xcdb7('0x64')],client9004);})['then'](respondWithResult(_0x5ee2d2,null))[_0xcdb7('0x5b')](handleError(_0x5ee2d2,null));};exports[_0xcdb7('0x6e')]=function(_0x3da082,_0x7487f4,_0x1b1476){_0x3da082[_0xcdb7('0x64')][_0xcdb7('0x2f')]=_0x3da082[_0xcdb7('0x6f')][_0xcdb7('0x70')];_0x3da082['body']['basename']=_0x3da082[_0xcdb7('0x6f')][_0xcdb7('0x71')];_0x3da082['body'][_0xcdb7('0x72')]=_0x3da082[_0xcdb7('0x6f')][_0xcdb7('0x73')];return db[_0xcdb7('0x74')][_0xcdb7('0x60')](_0x3da082['body'])[_0xcdb7('0x1a')](respondWithResult(_0x7487f4,0xc9))['catch'](handleError(_0x7487f4,null));};exports[_0xcdb7('0x75')]=function(_0x3a9de0,_0x5f4c3f,_0x199b3a){return db[_0xcdb7('0x31')][_0xcdb7('0x76')]({'where':{'id':_0x3a9de0[_0xcdb7('0x5d')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x5f4c3f,null))[_0xcdb7('0x1a')](function(_0x22a033){if(_0x22a033){if(_0x22a033[_0xcdb7('0x6a')]){return _0x5f4c3f['status'](0x193)[_0xcdb7('0x2b')]({'status':0x193,'message':'Unauthorized'});}return db[_0xcdb7('0x74')][_0xcdb7('0x76')]({'where':{'id':_0x3a9de0[_0xcdb7('0x34')][_0xcdb7('0x77')]},'raw':!![]})['then'](handleEntityNotFound(_0x5f4c3f,null));}})[_0xcdb7('0x1a')](function(_0x4c5bef){if(_0x4c5bef){return _0x5f4c3f[_0xcdb7('0x78')](path[_0xcdb7('0x79')](config[_0xcdb7('0x7a')],_0xcdb7('0x7b'),_0x4c5bef[_0xcdb7('0x7c')]));}})[_0xcdb7('0x5b')](handleError(_0x5f4c3f,null));};exports[_0xcdb7('0x7d')]=function(_0x5a2998,_0x1430c7){var _0x4cb0ab=null;var _0x1085f0=null;var _0x2c9c4c=null;var _0x20828f=null;if(_0x5a2998[_0xcdb7('0x64')]['id']){delete _0x5a2998[_0xcdb7('0x64')]['id'];}if(_0x5a2998[_0xcdb7('0x64')][_0xcdb7('0x7e')]){_0x20828f=path[_0xcdb7('0x79')](config[_0xcdb7('0x7a')],_0xcdb7('0x7f'),util[_0xcdb7('0x80')]('transcript-%s.txt',Date[_0xcdb7('0x81')]()));_0x5a2998[_0xcdb7('0x64')][_0xcdb7('0x82')]=_0x20828f;}return db[_0xcdb7('0x31')]['find']({'where':{'id':_0x5a2998[_0xcdb7('0x5d')]['id']},'include':[{'model':db[_0xcdb7('0x58')],'as':_0xcdb7('0x4d'),'include':[{'model':db[_0xcdb7('0x83')],'as':'User'}]}]})[_0xcdb7('0x1a')](handleEntityNotFound(_0x1430c7,null))[_0xcdb7('0x1a')](saveUpdates(_0x5a2998[_0xcdb7('0x64')],null))['then'](function(_0x4cb539){if(_0x4cb539){_0x4cb0ab=_0x4cb539;return db[_0xcdb7('0x55')][_0xcdb7('0x5f')]({'where':{'id':_0x4cb0ab['ChatWebsiteId']}});}})[_0xcdb7('0x1a')](function(_0x5bd973){if(_0x5bd973){_0x2c9c4c=_0x5bd973;return db[_0xcdb7('0x84')][_0xcdb7('0x5f')]({'where':{'id':_0x4cb0ab[_0xcdb7('0x85')]}});}})[_0xcdb7('0x1a')](function(_0x13f25a){if(_0x13f25a){_0x1085f0=_0x13f25a;if(_0x20828f){var _0xb60554=null;for(var _0x50df87=0x1;_0x50df87<_0x4cb0ab[_0xcdb7('0x4d')][_0xcdb7('0x5e')];++_0x50df87){_0xb60554=_0x4cb0ab[_0xcdb7('0x4d')][_0x50df87];var _0x1342f2=_0xb60554['UserId']?util[_0xcdb7('0x80')](_0xcdb7('0x86'),_0x2c9c4c[_0xcdb7('0x87')],_0xb60554['UserId']):'System';var _0xd83062=_0x5a2998[_0xcdb7('0x64')][_0xcdb7('0x88')]||util[_0xcdb7('0x80')](_0xcdb7('0x86'),'Visitor',_0xb60554[_0xcdb7('0x85')]);switch(_0x2c9c4c[_0xcdb7('0x89')]){case _0xcdb7('0x8a'):_0x1342f2=_0xb60554[_0xcdb7('0x8b')]?util[_0xcdb7('0x80')]('%s%d',_0x2c9c4c[_0xcdb7('0x87')],_0xb60554['UserId']):'System';break;case _0xcdb7('0x8c'):_0x1342f2=_0xb60554[_0xcdb7('0x8b')]?_0xb60554[_0xcdb7('0x83')]['alias']||_0xb60554['User']['fullname']:'System';break;case _0xcdb7('0x8d'):_0x1342f2=_0xb60554[_0xcdb7('0x8b')]?_0xb60554[_0xcdb7('0x83')][_0xcdb7('0x52')]:_0xcdb7('0x8e');break;default:_0x1342f2=_0xb60554[_0xcdb7('0x8b')]?util[_0xcdb7('0x80')](_0xcdb7('0x86'),_0x2c9c4c[_0xcdb7('0x87')],_0xb60554[_0xcdb7('0x8b')]):'System';}var _0x185863=util[_0xcdb7('0x80')](_0xcdb7('0x8f'),moment(_0xb60554[_0xcdb7('0x4f')])[_0xcdb7('0x80')]('MM/DD/YYYY\x20HH:mm:ss'),_0xb60554['direction']==='in'?_0xd83062:_0x1342f2,_0xb60554[_0xcdb7('0x64')]);if(!_0xb60554[_0xcdb7('0x90')]){fs[_0xcdb7('0x91')](_0x20828f,_0x185863);}}return db[_0xcdb7('0x92')][_0xcdb7('0x76')]({'where':{'service':!![]},'include':[{'model':db[_0xcdb7('0x93')],'as':_0xcdb7('0x94'),'raw':!![]}]});}}})[_0xcdb7('0x1a')](function(_0x22ae64){if(_0x22ae64&&_0x22ae64[_0xcdb7('0x94')]&&_0x5a2998['body']){var _0x2ae587={'tls':{'rejectUnauthorized':![]}};if(_0x22ae64[_0xcdb7('0x94')][_0xcdb7('0x95')]){_0x2ae587['service']=_0x22ae64[_0xcdb7('0x94')][_0xcdb7('0x95')];}else{_0x2ae587['host']=_0x22ae64[_0xcdb7('0x94')]['host'];_0x2ae587[_0xcdb7('0x96')]=_0x22ae64['Smtp'][_0xcdb7('0x96')];_0x2ae587[_0xcdb7('0x97')]=_0x22ae64['Smtp']['secure'];}if(_0x22ae64['Smtp'][_0xcdb7('0x98')]){_0x2ae587[_0xcdb7('0x99')]={'user':_0x22ae64['Smtp'][_0xcdb7('0x9a')],'pass':_0x22ae64[_0xcdb7('0x94')]['pass']};}return respondWithRpcPromise(_0xcdb7('0x9b'),'sendMail',{'account':_0x2ae587,'message':{'from':util[_0xcdb7('0x80')]('\x22%s\x22\x20<%s>',_0x22ae64[_0xcdb7('0x2f')],_0x22ae64['email']||_0x22ae64[_0xcdb7('0x94')]['user']),'to':_0x5a2998['body'][_0xcdb7('0x7e')],'subject':_0xcdb7('0x9c'),'text':util[_0xcdb7('0x80')](_0xcdb7('0x9d'),_0x5a2998[_0xcdb7('0x64')]['mailTranscript']),'attachments':[{'path':_0x20828f}]}})[_0xcdb7('0x1a')](function(){return _0x4cb0ab;})[_0xcdb7('0x5b')](function(_0x44041e){console[_0xcdb7('0x20')](_0x44041e);});}else{return _0x4cb0ab;}})[_0xcdb7('0x1a')](respondWithStatusCode(_0x1430c7,0xc8))[_0xcdb7('0x5b')](handleError(_0x1430c7,null));};exports[_0xcdb7('0x9e')]=function(_0x547d25,_0x2fd64d,_0x1c537a){return db['ChatMessage'][_0xcdb7('0x5f')]({'where':{'id':_0x547d25['params']['id']}})['then'](handleEntityNotFound(_0x2fd64d,null))[_0xcdb7('0x1a')](function(_0x4395a8){if(_0x4395a8){return _0x4395a8[_0xcdb7('0x9e')](_0x547d25['body'][_0xcdb7('0x9f')],_[_0xcdb7('0xa0')](_0x547d25[_0xcdb7('0x64')],[_0xcdb7('0x9f'),'id'])||{});}})[_0xcdb7('0x1a')](respondWithResult(_0x2fd64d,null))[_0xcdb7('0x5b')](handleError(_0x2fd64d,null));};exports[_0xcdb7('0xa1')]=function(_0x15f1c8,_0x1d3135,_0x16e6d9){var _0x15157d={'raw':![],'where':{}};var _0x35376a={};var _0x3dcbe4={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xcdb7('0x76')]({'where':{'id':_0x15f1c8[_0xcdb7('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1d3135,null))[_0xcdb7('0x1a')](function(_0x55380b){if(_0x55380b){_0x35376a[_0xcdb7('0x38')]=_[_0xcdb7('0x33')](db['ChatMessage'][_0xcdb7('0x32')]);_0x35376a[_0xcdb7('0x34')]=_[_0xcdb7('0x33')](_0x15f1c8[_0xcdb7('0x34')]);_0x35376a['filters']=_['intersection'](_0x35376a[_0xcdb7('0x38')],_0x35376a[_0xcdb7('0x34')]);_0x15157d[_0xcdb7('0x39')]=_[_0xcdb7('0x3a')](_0x35376a[_0xcdb7('0x38')],qs[_0xcdb7('0x3b')](_0x15f1c8[_0xcdb7('0x34')][_0xcdb7('0x3b')]));_0x15157d['attributes']=_0x15157d['attributes'][_0xcdb7('0x5e')]?_0x15157d[_0xcdb7('0x39')]:_0x35376a['model'];if(!_0x15f1c8[_0xcdb7('0x34')][_0xcdb7('0xa2')](_0xcdb7('0x3c'))){_0x15157d[_0xcdb7('0x28')]=qs[_0xcdb7('0x28')](_0x15f1c8[_0xcdb7('0x34')][_0xcdb7('0x28')]);_0x15157d[_0xcdb7('0x3d')]=qs['offset'](_0x15f1c8['query'][_0xcdb7('0x3d')]);}_0x15157d['order']=qs[_0xcdb7('0x3e')](_0x15f1c8['query'][_0xcdb7('0x3e')]);_0x15157d[_0xcdb7('0x3f')]=qs[_0xcdb7('0x37')](_[_0xcdb7('0x40')](_0x15f1c8[_0xcdb7('0x34')],_0x35376a['filters']));_0x15157d['where'][_0xcdb7('0xa3')]=_0x55380b['id'];if(_0x15f1c8[_0xcdb7('0x34')]['filter']){_0x15157d[_0xcdb7('0x3f')]=_[_0xcdb7('0x43')](_0x15157d[_0xcdb7('0x3f')],{'$or':_[_0xcdb7('0x44')](_0x15157d['attributes'],function(_0x49ab37){var _0x41f7c5={};_0x41f7c5[_0x49ab37]={'$like':'%'+_0x15f1c8[_0xcdb7('0x34')][_0xcdb7('0x42')]+'%'};return _0x41f7c5;})});}if(_0x15f1c8[_0xcdb7('0x34')][_0xcdb7('0xa4')]){var _0x4e99ab=_0x15f1c8[_0xcdb7('0x34')][_0xcdb7('0xa4')][_0xcdb7('0xa5')](',');var _0x339ea6={};_0x339ea6[_0x4e99ab[0x0]]={'$gte':moment(_0x4e99ab[0x1])[_0xcdb7('0x80')]('YYYY-MM-DD\x20HH:mm:ss')};_0x15157d[_0xcdb7('0x3f')]=_[_0xcdb7('0x43')](_0x15157d[_0xcdb7('0x3f')],_0x339ea6);}_0x15157d=_[_0xcdb7('0x43')]({},_0x15157d,_0x15f1c8['options']);return db[_0xcdb7('0x58')][_0xcdb7('0x27')]({'where':_0x15157d[_0xcdb7('0x3f')]})[_0xcdb7('0x1a')](function(_0x407ffc){_0x3dcbe4[_0xcdb7('0x27')]=_0x407ffc;if(_0x15f1c8['query'][_0xcdb7('0x50')]){_0x15157d[_0xcdb7('0x46')]=[{'all':!![]}];}return db[_0xcdb7('0x58')][_0xcdb7('0xa6')](_0x15157d);})[_0xcdb7('0x1a')](function(_0x262b40){_0x3dcbe4[_0xcdb7('0xa7')]=_0x262b40;return _0x3dcbe4;});}})[_0xcdb7('0x1a')](respondWithFilteredResult(_0x1d3135,_0x15157d))[_0xcdb7('0x5b')](handleError(_0x1d3135,null));};exports[_0xcdb7('0xa8')]=function(_0x2de126,_0x3a888a,_0x356df6){var _0x46f08b={'where':{}},_0x43fa0d={},_0xed1f8a={'count':0x0,'rows':[]};return db[_0xcdb7('0x31')]['findOne']({'where':{'id':_0x2de126[_0xcdb7('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3a888a,null))[_0xcdb7('0x1a')](function(_0x13392f){if(_0x13392f){_0x43fa0d['model']=_[_0xcdb7('0x33')](db[_0xcdb7('0x58')][_0xcdb7('0x32')]);_0x43fa0d[_0xcdb7('0x34')]=_[_0xcdb7('0x33')](_0x2de126[_0xcdb7('0x34')]);_0x43fa0d[_0xcdb7('0x37')]=_[_0xcdb7('0x3a')](_0x43fa0d['model'],_0x43fa0d[_0xcdb7('0x34')]);_0x46f08b[_0xcdb7('0x39')]=_[_0xcdb7('0x3a')](_0x43fa0d['model'],qs[_0xcdb7('0x3b')](_0x2de126['query'][_0xcdb7('0x3b')]));_0x46f08b['attributes']=_0x46f08b['attributes'][_0xcdb7('0x5e')]?_0x46f08b[_0xcdb7('0x39')]:_0x43fa0d['model'];if(!_0x2de126[_0xcdb7('0x34')]['hasOwnProperty'](_0xcdb7('0x3c'))){_0x46f08b[_0xcdb7('0x28')]=qs['limit'](_0x2de126[_0xcdb7('0x34')][_0xcdb7('0x28')]);_0x46f08b[_0xcdb7('0x3d')]=qs[_0xcdb7('0x3d')](_0x2de126[_0xcdb7('0x34')][_0xcdb7('0x3d')]);}_0x46f08b[_0xcdb7('0xa9')]=qs['sort'](_0x2de126[_0xcdb7('0x34')]['sort']);_0x46f08b['where']=qs[_0xcdb7('0x37')](_[_0xcdb7('0x40')](_0x2de126[_0xcdb7('0x34')],_0x43fa0d[_0xcdb7('0x37')]));_0x46f08b[_0xcdb7('0x3f')][_0xcdb7('0xa3')]=_0x13392f['id'];if(_0x2de126[_0xcdb7('0x34')][_0xcdb7('0x42')]){_0x46f08b['where']=_['merge'](_0x46f08b['where'],{'$or':_[_0xcdb7('0x44')](_0x46f08b[_0xcdb7('0x39')],function(_0x443f2d){var _0x466bef={};_0x466bef[_0x443f2d]={'$like':'%'+_0x2de126[_0xcdb7('0x34')][_0xcdb7('0x42')]+'%'};return _0x466bef;})});}_0x46f08b['where'][_0xcdb7('0x90')]=![];if(_0x2de126['query']['id']){_0x46f08b[_0xcdb7('0x3f')]['id']={'$gt':_0x2de126[_0xcdb7('0x34')]['id']};}_0x46f08b=_[_0xcdb7('0x43')]({},_0x46f08b,_0x2de126[_0xcdb7('0x45')]);return db[_0xcdb7('0x58')][_0xcdb7('0x27')]({'where':_0x46f08b['where']})[_0xcdb7('0x1a')](function(_0x4c074a){_0xed1f8a['count']=_0x4c074a;_0x46f08b[_0xcdb7('0x46')]=[];if(_0x2de126[_0xcdb7('0x34')][_0xcdb7('0xaa')]){_0x46f08b[_0xcdb7('0x46')][_0xcdb7('0x48')]({'model':db[_0xcdb7('0x83')],'as':_0xcdb7('0x83'),'attributes':['id',_0xcdb7('0x52'),_0xcdb7('0xab')]});}if(_0x2de126['query'][_0xcdb7('0x50')]){_0x46f08b[_0xcdb7('0x46')]=[{'all':!![]}];}return db[_0xcdb7('0x58')][_0xcdb7('0xa6')](_0x46f08b);})[_0xcdb7('0x1a')](function(_0x3428cd){_0xed1f8a[_0xcdb7('0xa7')]=_0x3428cd;return _0xed1f8a;});}})[_0xcdb7('0x1a')](respondWithFilteredResult(_0x3a888a,_0x46f08b))[_0xcdb7('0x5b')](handleError(_0x3a888a,null));};exports[_0xcdb7('0xac')]=function(_0x41b636,_0x550bdc,_0x1dcbed){return db[_0xcdb7('0x31')][_0xcdb7('0x5f')]({'where':{'id':_0x41b636[_0xcdb7('0x5d')]['id']}})[_0xcdb7('0x1a')](handleEntityNotFound(_0x550bdc,null))[_0xcdb7('0x1a')](function(_0x30ea8a){if(_0x30ea8a){return _0x30ea8a[_0xcdb7('0xad')](_0x41b636[_0xcdb7('0x64')][_0xcdb7('0x9f')],_[_0xcdb7('0xa0')](_0x41b636[_0xcdb7('0x64')],[_0xcdb7('0x9f'),'id'])||{})[_0xcdb7('0xae')](function(){return db[_0xcdb7('0x49')][_0xcdb7('0xa6')]({'attributes':['id',_0xcdb7('0x2f'),'color'],'where':{'id':_0x41b636['body'][_0xcdb7('0x9f')]}});})[_0xcdb7('0x1a')](function(_0x16659d){socket['emit']('chatInteractionTags:save',{'id':Number(_0x41b636['params']['id']),'tags':_0x16659d||[]});return{'id':Number(_0x41b636[_0xcdb7('0x5d')]['id']),'tags':_0x16659d||[]};});}})[_0xcdb7('0x1a')](respondWithResult(_0x550bdc,null))['catch'](handleError(_0x550bdc,null));};exports['removeTags']=function(_0x4de050,_0x390e90,_0x336a4a){var _0x1b09a2;return db[_0xcdb7('0x31')][_0xcdb7('0x5f')]({'where':{'id':_0x4de050['params']['id']}})['then'](handleEntityNotFound(_0x390e90,null))['then'](function(_0x1fa113){if(_0x1fa113){return _0x1fa113[_0xcdb7('0xaf')](_0x4de050[_0xcdb7('0x34')][_0xcdb7('0x9f')]);}})[_0xcdb7('0x1a')](respondWithStatusCode(_0x390e90,null))['catch'](handleError(_0x390e90,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 4024b83..478f32d 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 _0xd84e=['../../mysqldb','ChatInteraction','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd84e,0x99));var _0xed84=function(_0x4a5062,_0x382922){_0x4a5062=_0x4a5062-0x0;var _0x39bd36=_0xd84e[_0x4a5062];return _0x39bd36;};'use strict';var EventEmitter=require(_0xed84('0x0'));var ChatInteraction=require(_0xed84('0x1'))['db'][_0xed84('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xed84('0x3')](0x0);var events={'afterCreate':_0xed84('0x4'),'afterUpdate':_0xed84('0x5'),'afterDestroy':_0xed84('0x6')};function emitEvent(_0x37a3fb){return function(_0x2c344c,_0x232331,_0x1fced9){ChatInteractionEvents[_0xed84('0x7')](_0x37a3fb+':'+_0x2c344c['id'],_0x2c344c);ChatInteractionEvents['emit'](_0x37a3fb,_0x2c344c);_0x1fced9(null);};}for(var e in events){if(events[_0xed84('0x8')](e)){var event=events[e];ChatInteraction[_0xed84('0x9')](e,emitEvent(event));}}module[_0xed84('0xa')]=ChatInteractionEvents; \ No newline at end of file +var _0xd1b1=['update','emit','hook','exports','../../mysqldb','ChatInteraction','save'];(function(_0x26d865,_0x5814bc){var _0x32b26f=function(_0x54a7d9){while(--_0x54a7d9){_0x26d865['push'](_0x26d865['shift']());}};_0x32b26f(++_0x5814bc);}(_0xd1b1,0x66));var _0x1d1b=function(_0x18e9e6,_0x37b745){_0x18e9e6=_0x18e9e6-0x0;var _0x3ac697=_0xd1b1[_0x18e9e6];return _0x3ac697;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x1d1b('0x0'))['db'][_0x1d1b('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1d1b('0x2'),'afterUpdate':_0x1d1b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x26d5ab){return function(_0x22e5a7,_0x2624f5,_0x1bbdff){ChatInteractionEvents['emit'](_0x26d5ab+':'+_0x22e5a7['id'],_0x22e5a7);ChatInteractionEvents[_0x1d1b('0x4')](_0x26d5ab,_0x22e5a7);_0x1bbdff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x1d1b('0x5')](e,emitEvent(event));}}module[_0x1d1b('0x6')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index c8da1c5..76789e5 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 _0x9e8a=['./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x13be07,_0x53c0d4){var _0x73948=function(_0x428f45){while(--_0x428f45){_0x13be07['push'](_0x13be07['shift']());}};_0x73948(++_0x53c0d4);}(_0x9e8a,0x11b));var _0xa9e8=function(_0x1c195e,_0x48c703){_0x1c195e=_0x1c195e-0x0;var _0x1020c3=_0x9e8a[_0x1c195e];return _0x1020c3;};'use strict';var _=require(_0xa9e8('0x0'));var util=require('util');var logger=require(_0xa9e8('0x1'))(_0xa9e8('0x2'));var moment=require('moment');var BPromise=require(_0xa9e8('0x3'));var rp=require(_0xa9e8('0x4'));var attributes=require(_0xa9e8('0x5'));module[_0xa9e8('0x6')]=function(_0x35dfda,_0x5b32de){return _0x35dfda['define'](_0xa9e8('0x7'),attributes,{'tableName':_0xa9e8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa94b=['lodash','util','../../config/logger','api','moment','bluebird','./chatInteraction.attributes','define','ChatInteraction','utf8mb4_unicode_ci'];(function(_0x5f0915,_0x422cac){var _0xadb0f5=function(_0x8fcfeb){while(--_0x8fcfeb){_0x5f0915['push'](_0x5f0915['shift']());}};_0xadb0f5(++_0x422cac);}(_0xa94b,0x1d6));var _0xba94=function(_0xdfa4ff,_0x4c4320){_0xdfa4ff=_0xdfa4ff-0x0;var _0x309c14=_0xa94b[_0xdfa4ff];return _0x309c14;};'use strict';var _=require(_0xba94('0x0'));var util=require(_0xba94('0x1'));var logger=require(_0xba94('0x2'))(_0xba94('0x3'));var moment=require(_0xba94('0x4'));var BPromise=require(_0xba94('0x5'));var rp=require('request-promise');var attributes=require(_0xba94('0x6'));module['exports']=function(_0x5b6453,_0xeda5d){return _0x5b6453[_0xba94('0x7')](_0xba94('0x8'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xba94('0x9')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 2a94c5e..4ed2b36 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 _0x471e=['attributes','limit','stringify','AddTagsToChatInteraction','find','where','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','http','socket.io-emitter','localhost','./chatInteraction.socket','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x471e,0x123));var _0xe471=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x471e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xe471('0x0'));var moment=require(_0xe471('0x1'));var BPromise=require(_0xe471('0x2'));var rs=require(_0xe471('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe471('0x4'));var config=require(_0xe471('0x5'));var jayson=require(_0xe471('0x6'));var client=jayson['client'][_0xe471('0x7')]({'port':0x232a});var socket=require(_0xe471('0x8'))({'host':_0xe471('0x9'),'port':0x18eb});require(_0xe471('0xa'))['register'](socket);function respondWithRpcPromise(_0x288efe,_0x59096e,_0x5c3cf6){return new BPromise(function(_0x3a7eb7,_0x47b4d5){return client[_0xe471('0xb')](_0x288efe,_0x5c3cf6)[_0xe471('0xc')](function(_0x19ebd2){logger[_0xe471('0xd')]('ChatInteraction,\x20%s,\x20%s',_0x59096e,_0xe471('0xe'));logger[_0xe471('0xf')](_0xe471('0x10'),_0x59096e,'request\x20sent',JSON['stringify'](_0x19ebd2));if(_0x19ebd2[_0xe471('0x11')]){if(_0x19ebd2['error'][_0xe471('0x12')]===0x1f4){logger['error'](_0xe471('0x13'),_0x59096e,_0x19ebd2[_0xe471('0x11')]['message']);return _0x47b4d5(_0x19ebd2[_0xe471('0x11')]['message']);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x59096e,_0x19ebd2['error'][_0xe471('0x14')]);return _0x3a7eb7(_0x19ebd2['error'][_0xe471('0x14')]);}else{logger[_0xe471('0xd')](_0xe471('0x13'),_0x59096e,_0xe471('0xe'));_0x3a7eb7(_0x19ebd2[_0xe471('0x15')][_0xe471('0x14')]);}})[_0xe471('0x16')](function(_0x2183da){logger['error'](_0xe471('0x13'),_0x59096e,_0x2183da);_0x47b4d5(_0x2183da);});});}exports[_0xe471('0x17')]=function(_0x53bd4a){var _0x178691=this;return new Promise(function(_0x4ed6e5,_0x156cff){return db[_0xe471('0x18')][_0xe471('0x19')](_0x53bd4a[_0xe471('0x1a')],{'raw':_0x53bd4a[_0xe471('0x1b')]?_0x53bd4a[_0xe471('0x1b')][_0xe471('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53bd4a['options']?_0x53bd4a[_0xe471('0x1b')]['where']||null:null,'attributes':_0x53bd4a[_0xe471('0x1b')]?_0x53bd4a['options'][_0xe471('0x1d')]||null:null,'limit':_0x53bd4a[_0xe471('0x1b')]?_0x53bd4a['options'][_0xe471('0x1e')]||null:null})[_0xe471('0xc')](function(_0x5d1c08){logger[_0xe471('0xd')]('UpdateChatInteraction',_0x53bd4a);logger[_0xe471('0xf')]('UpdateChatInteraction',_0x53bd4a,JSON[_0xe471('0x1f')](_0x5d1c08));_0x4ed6e5(_0x5d1c08);})[_0xe471('0x16')](function(_0x33203f){logger['error'](_0xe471('0x17'),_0x33203f[_0xe471('0x14')],_0x53bd4a);_0x156cff(_0x178691[_0xe471('0x11')](0x1f4,_0x33203f['message']));});});};exports[_0xe471('0x20')]=function(_0x26d4a8){return new Promise(function(_0x309285,_0xa5ea2a){return db[_0xe471('0x18')][_0xe471('0x21')]({'where':_0x26d4a8['options']?_0x26d4a8[_0xe471('0x1b')][_0xe471('0x22')]||null:null})['then'](function(_0x3386c2){if(_0x3386c2){return _0x3386c2[_0xe471('0x23')](_0x26d4a8['body'][_0xe471('0x24')],_[_0xe471('0x25')](_0x26d4a8['body'],['ids','id'])||{});}})[_0xe471('0x26')](function(_0x5b1284){logger[_0xe471('0xd')](_0xe471('0x27'),_0x26d4a8);logger[_0xe471('0xf')](_0xe471('0x27'),_0x26d4a8,JSON[_0xe471('0x1f')](_0x5b1284));_0x309285(_0x5b1284);})['catch'](function(_0x548958){logger['error'](_0xe471('0x27'),_0x548958[_0xe471('0x14')],_0x26d4a8);_0xa5ea2a(_this['error'](0x1f4,_0x548958[_0xe471('0x14')]));});});}; \ No newline at end of file +var _0x100c=['code','message','info','result','catch','UpdateChatInteraction','ChatInteraction','options','raw','where','attributes','limit','AddTagsToChatInteraction','body','ids','omit','spread','AddTags','lodash','util','moment','../../config/utils','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','./chatInteraction.socket','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x100c,0x15f));var _0xc100=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x100c[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xc100('0x0'));var util=require(_0xc100('0x1'));var moment=require(_0xc100('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xc100('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xc100('0x4'));var jayson=require(_0xc100('0x5'));var client=jayson[_0xc100('0x6')][_0xc100('0x7')]({'port':0x232a});var socket=require(_0xc100('0x8'))({'host':_0xc100('0x9'),'port':0x18eb});require(_0xc100('0xa'))['register'](socket);function respondWithRpcPromise(_0x50c6d5,_0xab180c,_0x207d11){return new BPromise(function(_0x41f85a,_0x17fb1c){return client[_0xc100('0xb')](_0x50c6d5,_0x207d11)[_0xc100('0xc')](function(_0x143c3c){logger['info'](_0xc100('0xd'),_0xab180c,_0xc100('0xe'));logger[_0xc100('0xf')](_0xc100('0x10'),_0xab180c,'request\x20sent',JSON[_0xc100('0x11')](_0x143c3c));if(_0x143c3c[_0xc100('0x12')]){if(_0x143c3c[_0xc100('0x12')][_0xc100('0x13')]===0x1f4){logger[_0xc100('0x12')](_0xc100('0xd'),_0xab180c,_0x143c3c[_0xc100('0x12')]['message']);return _0x17fb1c(_0x143c3c[_0xc100('0x12')][_0xc100('0x14')]);}logger[_0xc100('0x12')](_0xc100('0xd'),_0xab180c,_0x143c3c[_0xc100('0x12')][_0xc100('0x14')]);return _0x41f85a(_0x143c3c[_0xc100('0x12')][_0xc100('0x14')]);}else{logger[_0xc100('0x15')]('ChatInteraction,\x20%s,\x20%s',_0xab180c,_0xc100('0xe'));_0x41f85a(_0x143c3c[_0xc100('0x16')][_0xc100('0x14')]);}})[_0xc100('0x17')](function(_0x3de704){logger[_0xc100('0x12')](_0xc100('0xd'),_0xab180c,_0x3de704);_0x17fb1c(_0x3de704);});});}exports[_0xc100('0x18')]=function(_0x5846b6){var _0x4f8992=this;return new Promise(function(_0x5edd90,_0x28ec41){return db[_0xc100('0x19')]['update'](_0x5846b6['body'],{'raw':_0x5846b6[_0xc100('0x1a')]?_0x5846b6[_0xc100('0x1a')][_0xc100('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5846b6[_0xc100('0x1a')]?_0x5846b6['options'][_0xc100('0x1c')]||null:null,'attributes':_0x5846b6['options']?_0x5846b6[_0xc100('0x1a')][_0xc100('0x1d')]||null:null,'limit':_0x5846b6[_0xc100('0x1a')]?_0x5846b6[_0xc100('0x1a')][_0xc100('0x1e')]||null:null})[_0xc100('0xc')](function(_0x21502f){logger[_0xc100('0x15')](_0xc100('0x18'),_0x5846b6);logger[_0xc100('0xf')](_0xc100('0x18'),_0x5846b6,JSON[_0xc100('0x11')](_0x21502f));_0x5edd90(_0x21502f);})[_0xc100('0x17')](function(_0x539c2d){logger[_0xc100('0x12')](_0xc100('0x18'),_0x539c2d[_0xc100('0x14')],_0x5846b6);_0x28ec41(_0x4f8992[_0xc100('0x12')](0x1f4,_0x539c2d['message']));});});};exports[_0xc100('0x1f')]=function(_0x1d6022){return new Promise(function(_0x9053f2,_0x5c0687){return db[_0xc100('0x19')]['find']({'where':_0x1d6022[_0xc100('0x1a')]?_0x1d6022[_0xc100('0x1a')][_0xc100('0x1c')]||null:null})[_0xc100('0xc')](function(_0x47fb85){if(_0x47fb85){return _0x47fb85['addTags'](_0x1d6022[_0xc100('0x20')][_0xc100('0x21')],_[_0xc100('0x22')](_0x1d6022['body'],['ids','id'])||{});}})[_0xc100('0x23')](function(_0x5ca9e5){logger['info'](_0xc100('0x24'),_0x1d6022);logger[_0xc100('0xf')](_0xc100('0x24'),_0x1d6022,JSON[_0xc100('0x11')](_0x5ca9e5));_0x9053f2(_0x5ca9e5);})[_0xc100('0x17')](function(_0x1660a0){logger[_0xc100('0x12')]('AddTags',_0x1660a0['message'],_0x1d6022);_0x5c0687(_this[_0xc100('0x12')](0x1f4,_0x1660a0[_0xc100('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index dd15218..f119007 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 _0xe6c3=['update','removeListener','chatInteraction:','save'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xe6c3,0x8b));var _0x3e6c=function(_0x4adf43,_0x1a34ab){_0x4adf43=_0x4adf43-0x0;var _0x364d4f=_0xe6c3[_0x4adf43];return _0x364d4f;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x3e6c('0x0'),'remove',_0x3e6c('0x1')];function createListener(_0x3550e2,_0x1dbc3){return function(_0x407cef){_0x1dbc3['emit'](_0x3550e2,_0x407cef);};}function removeListener(_0x4390a1,_0x52a978){return function(){ChatInteractionEvents[_0x3e6c('0x2')](_0x4390a1,_0x52a978);};}exports['register']=function(_0x5e7f18){for(var _0x192196=0x0,_0x579abd=events['length'];_0x192196<_0x579abd;_0x192196++){var _0x3be191=events[_0x192196];var _0x449305=createListener(_0x3e6c('0x3')+_0x3be191,_0x5e7f18);ChatInteractionEvents['on'](_0x3be191,_0x449305);}}; \ No newline at end of file +var _0x579f=['removeListener','register','chatInteraction:','./chatInteraction.events','save','remove','update'];(function(_0x165c8b,_0x1be750){var _0x437dc1=function(_0x3b9639){while(--_0x3b9639){_0x165c8b['push'](_0x165c8b['shift']());}};_0x437dc1(++_0x1be750);}(_0x579f,0x9d));var _0xf579=function(_0xcb5fe7,_0x512cd5){_0xcb5fe7=_0xcb5fe7-0x0;var _0x51ae15=_0x579f[_0xcb5fe7];return _0x51ae15;};'use strict';var ChatInteractionEvents=require(_0xf579('0x0'));var events=[_0xf579('0x1'),_0xf579('0x2'),_0xf579('0x3')];function createListener(_0x130d38,_0xcecc6e){return function(_0x4a5939){_0xcecc6e['emit'](_0x130d38,_0x4a5939);};}function removeListener(_0xa1299c,_0x4cb2dd){return function(){ChatInteractionEvents[_0xf579('0x4')](_0xa1299c,_0x4cb2dd);};}exports[_0xf579('0x5')]=function(_0x524ee2){for(var _0x391846=0x0,_0x56ae4d=events['length'];_0x391846<_0x56ae4d;_0x391846++){var _0x5d546e=events[_0x391846];var _0x2cffcd=createListener(_0xf579('0x6')+_0x5d546e,_0x524ee2);ChatInteractionEvents['on'](_0x5d546e,_0x2cffcd);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 80706ea..5f21aba 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 _0x9327=['originalname','replace','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','chatinteraction:destroy','destroy','multer','util','path','express','Router','../../components/interaction/service','get','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','/:id/messages','getMessages','/:id/my_messages','getMyMessages','post','create','diskStorage','join','root','server/files/attachments/','format','now'];(function(_0x33ebd4,_0x294358){var _0xad487a=function(_0x2ba19f){while(--_0x2ba19f){_0x33ebd4['push'](_0x33ebd4['shift']());}};_0xad487a(++_0x294358);}(_0x9327,0x17d));var _0x7932=function(_0x4d5514,_0x3c0460){_0x4d5514=_0x4d5514-0x0;var _0x4bf726=_0x9327[_0x4d5514];return _0x4bf726;};'use strict';var multer=require(_0x7932('0x0'));var util=require(_0x7932('0x1'));var path=require(_0x7932('0x2'));var express=require(_0x7932('0x3'));var router=express[_0x7932('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7932('0x5'));var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router[_0x7932('0x6')]('/',auth[_0x7932('0x7')](),controller['index']);router[_0x7932('0x6')]('/describe',auth[_0x7932('0x7')](),controller[_0x7932('0x8')]);router[_0x7932('0x6')](_0x7932('0x9'),auth[_0x7932('0xa')](),controller[_0x7932('0xb')]);router[_0x7932('0x6')]('/:id/attachment_download',auth[_0x7932('0xa')](),controller['attachmentDownload']);router[_0x7932('0x6')](_0x7932('0xc'),auth[_0x7932('0x7')](),controller[_0x7932('0xd')]);router[_0x7932('0x6')](_0x7932('0xe'),auth['isChatInteractionAuthorized'](),controller[_0x7932('0xf')]);router[_0x7932('0x10')]('/',auth[_0x7932('0x7')](),controller[_0x7932('0x11')]);var upload=multer({'storage':multer[_0x7932('0x12')]({'destination':function(_0x3c2c06,_0x2eac88,_0x536296){_0x536296(null,path[_0x7932('0x13')](config[_0x7932('0x14')],_0x7932('0x15')));},'filename':function(_0x49a41a,_0x44bf57,_0x251c45){_0x251c45(null,util[_0x7932('0x16')]('%s-%s',Date[_0x7932('0x17')](),_0x44bf57[_0x7932('0x18')][_0x7932('0x19')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x7932('0x10')]('/:id/attachment_upload',upload[_0x7932('0x1a')](_0x7932('0x1b')),controller[_0x7932('0x1c')]);router['post']('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0x7932('0x1d')]);router[_0x7932('0x10')](_0x7932('0x1e'),auth[_0x7932('0x7')](),interaction[_0x7932('0x1f')](_0x7932('0x20'),_0x7932('0x21')),controller[_0x7932('0x22')]);router[_0x7932('0x23')](_0x7932('0x9'),auth[_0x7932('0x7')](),interaction[_0x7932('0x1f')](_0x7932('0x20'),_0x7932('0x24')),controller[_0x7932('0x25')]);router[_0x7932('0x23')](_0x7932('0x26'),controller[_0x7932('0x27')]);router[_0x7932('0x23')](_0x7932('0x28'),auth[_0x7932('0xa')](),controller[_0x7932('0x29')]);router[_0x7932('0x23')](_0x7932('0x2a'),controller['close']);router['delete']('/:id',auth[_0x7932('0x7')](),interaction[_0x7932('0x1f')](_0x7932('0x20'),_0x7932('0x2b')),controller[_0x7932('0x2c')]);router['delete'](_0x7932('0x1e'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x3519=['util','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/my_messages','getMyMessages','post','create','join','root','%s-%s','now','originalname','/:id/attachment_upload','addMessage','/:id/tags','tracked','chatinteraction:addtags','addTags','chat','update','put','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','destroy','removeTags','multer'];(function(_0xe928a6,_0x5e6b){var _0x5c26fb=function(_0xdf921e){while(--_0xdf921e){_0xe928a6['push'](_0xe928a6['shift']());}};_0x5c26fb(++_0x5e6b);}(_0x3519,0x13f));var _0x9351=function(_0x473b41,_0x1c320f){_0x473b41=_0x473b41-0x0;var _0x4e521d=_0x3519[_0x473b41];return _0x4e521d;};'use strict';var multer=require(_0x9351('0x0'));var util=require(_0x9351('0x1'));var path=require('path');var express=require(_0x9351('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x9351('0x3'));var config=require(_0x9351('0x4'));var controller=require('./chatInteraction.controller');router[_0x9351('0x5')]('/',auth[_0x9351('0x6')](),controller[_0x9351('0x7')]);router[_0x9351('0x5')](_0x9351('0x8'),auth[_0x9351('0x6')](),controller[_0x9351('0x9')]);router[_0x9351('0x5')](_0x9351('0xa'),auth[_0x9351('0xb')](),controller['show']);router[_0x9351('0x5')](_0x9351('0xc'),auth[_0x9351('0xb')](),controller[_0x9351('0xd')]);router['get']('/:id/messages',auth[_0x9351('0x6')](),controller['getMessages']);router[_0x9351('0x5')](_0x9351('0xe'),auth[_0x9351('0xb')](),controller[_0x9351('0xf')]);router[_0x9351('0x10')]('/',auth['isAuthenticated'](),controller[_0x9351('0x11')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5850c1,_0x386a74,_0x372e94){_0x372e94(null,path[_0x9351('0x12')](config[_0x9351('0x13')],'server/files/attachments/'));},'filename':function(_0x356e3e,_0x266aac,_0x38c453){_0x38c453(null,util['format'](_0x9351('0x14'),Date[_0x9351('0x15')](),_0x266aac[_0x9351('0x16')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x9351('0x10')](_0x9351('0x17'),upload['single']('file'),controller['attachmentUpload']);router[_0x9351('0x10')]('/:id/messages',auth[_0x9351('0xb')](),controller[_0x9351('0x18')]);router[_0x9351('0x10')](_0x9351('0x19'),auth[_0x9351('0x6')](),interaction[_0x9351('0x1a')]('chat',_0x9351('0x1b')),controller[_0x9351('0x1c')]);router['put'](_0x9351('0xa'),auth['isAuthenticated'](),interaction['tracked'](_0x9351('0x1d'),'chatinteraction:update'),controller[_0x9351('0x1e')]);router[_0x9351('0x1f')]('/:id/custom_update',controller[_0x9351('0x20')]);router['put'](_0x9351('0x21'),auth[_0x9351('0xb')](),controller[_0x9351('0x22')]);router[_0x9351('0x1f')](_0x9351('0x23'),controller[_0x9351('0x24')]);router[_0x9351('0x25')](_0x9351('0xa'),auth['isAuthenticated'](),interaction['tracked'](_0x9351('0x1d'),'chatinteraction:destroy'),controller[_0x9351('0x26')]);router['delete']('/:id/tags',auth[_0x9351('0x6')](),controller[_0x9351('0x27')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 22ad965..62ad3bf 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 _0xe785=['INTEGER','sequelize','exports','medium','BOOLEAN'];(function(_0x2833be,_0x37c058){var _0x3329f7=function(_0x48fa47){while(--_0x48fa47){_0x2833be['push'](_0x2833be['shift']());}};_0x3329f7(++_0x37c058);}(_0xe785,0x128));var _0x5e78=function(_0x2526bd,_0x751acd){_0x2526bd=_0x2526bd-0x0;var _0x5991a7=_0xe785[_0x2526bd];return _0x5991a7;};'use strict';var Sequelize=require(_0x5e78('0x0'));module[_0x5e78('0x1')]={'body':{'type':Sequelize['TEXT'](_0x5e78('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5e78('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x5e78('0x4')]}}; \ No newline at end of file +var _0x0120=['medium','BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x20714a,_0x7de591){var _0x15e877=function(_0x3f9f8d){while(--_0x3f9f8d){_0x20714a['push'](_0x20714a['shift']());}};_0x15e877(++_0x7de591);}(_0x0120,0x6f));var _0x0012=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0120[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x0012('0x0'));module[_0x0012('0x1')]={'body':{'type':Sequelize[_0x0012('0x2')](_0x0012('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0012('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x0012('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 13dabbb..ce6b18c 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 _0x8f18=['squel','jsforce','desk.js','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./chatInternalMessage.socket','sendStatus','status','end','count','offset','set','Content-Range','json','reject','save','update','destroy','stack','name','index','ChatInternalMessage','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','day','add','merge','filter','options','includeAll','include','then','rows','catch','show','params','rawAttributes','fields','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','findAll','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','type','push','FromId','ToId','read','-createdAt','all','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x5b1c50,_0x56e694){var _0x2d379b=function(_0x981b9c){while(--_0x981b9c){_0x5b1c50['push'](_0x5b1c50['shift']());}};_0x2d379b(++_0x56e694);}(_0x8f18,0x1ea));var _0x88f1=function(_0x2ae07b,_0x40a146){_0x2ae07b=_0x2ae07b-0x0;var _0x18c21b=_0x8f18[_0x2ae07b];return _0x18c21b;};'use strict';var jsonpatch=require(_0x88f1('0x0'));var rp=require(_0x88f1('0x1'));var moment=require(_0x88f1('0x2'));var BPromise=require(_0x88f1('0x3'));var Mustache=require(_0x88f1('0x4'));var util=require(_0x88f1('0x5'));var path=require(_0x88f1('0x6'));var sox=require(_0x88f1('0x7'));var csv=require(_0x88f1('0x8'));var ejs=require(_0x88f1('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x88f1('0xa'));var crypto=require('crypto');var jsforce=require(_0x88f1('0xb'));var deskjs=require(_0x88f1('0xc'));var toCsv=require(_0x88f1('0x8'));var querystring=require('querystring');var Papa=require(_0x88f1('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0x88f1('0xe'))(_0x88f1('0xf'));var utils=require(_0x88f1('0x10'));var config=require(_0x88f1('0x11'));var db=require(_0x88f1('0x12'))['db'];var socket=require(_0x88f1('0x13'))({'host':_0x88f1('0x14'),'port':0x18eb});require(_0x88f1('0x15'))['register'](socket);function respondWithStatusCode(_0x4ea73b,_0x188fdb){_0x188fdb=_0x188fdb||0xcc;return function(_0x2d022c){if(_0x2d022c){return _0x4ea73b[_0x88f1('0x16')](_0x188fdb);}return _0x4ea73b[_0x88f1('0x17')](_0x188fdb)[_0x88f1('0x18')]();};}function respondWithResult(_0x38fcff,_0x44a1b3){_0x44a1b3=_0x44a1b3||0xc8;return function(_0x2817c9){if(_0x2817c9){return _0x38fcff[_0x88f1('0x17')](_0x44a1b3)['json'](_0x2817c9);}};}function respondWithFilteredResult(_0xffb484,_0x350de3){return function(_0xe00421){if(_0xe00421){var _0x196eaf=_0xe00421[_0x88f1('0x19')],_0x1d300c=_0x350de3[_0x88f1('0x1a')],_0xc2f59c=_0x350de3['offset']+_0x350de3['limit'],_0x2765f6;if(_0xc2f59c>=_0x196eaf){_0xc2f59c=_0x196eaf;_0x2765f6=0xc8;}else{_0x2765f6=0xce;}_0xffb484['status'](_0x2765f6);return _0xffb484[_0x88f1('0x1b')](_0x88f1('0x1c'),_0x1d300c+'-'+_0xc2f59c+'/'+_0x196eaf)[_0x88f1('0x1d')](_0xe00421);}return null;};}function patchUpdates(_0x41975a){return function(_0x46a65e){try{jsonpatch['apply'](_0x46a65e,_0x41975a,!![]);}catch(_0x1d407c){return BPromise[_0x88f1('0x1e')](_0x1d407c);}return _0x46a65e[_0x88f1('0x1f')]();};}function saveUpdates(_0x58126f,_0x291d1d){return function(_0x39e460){if(_0x39e460){return _0x39e460[_0x88f1('0x20')](_0x58126f)['then'](function(_0x370a0d){return _0x370a0d;});}return null;};}function removeEntity(_0xa07c52,_0x3bc67d){return function(_0x49383f){if(_0x49383f){return _0x49383f[_0x88f1('0x21')]()['then'](function(){_0xa07c52[_0x88f1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x241a73,_0x3273b3){return function(_0x299cc6){if(!_0x299cc6){_0x241a73[_0x88f1('0x16')](0x194);}return _0x299cc6;};}function handleError(_0xb932f5,_0x53bd9f){_0x53bd9f=_0x53bd9f||0x1f4;return function(_0x301536){logger['error'](_0x301536[_0x88f1('0x22')]);if(_0x301536[_0x88f1('0x23')]){delete _0x301536[_0x88f1('0x23')];}_0xb932f5[_0x88f1('0x17')](_0x53bd9f)['send'](_0x301536);};}exports[_0x88f1('0x24')]=function(_0x1c752d,_0x4cdc54){var _0x216347={},_0x17f6d3={},_0x2d5c11={'count':0x0,'rows':[]};var _0x27691a=db[_0x88f1('0x25')]['rawAttributes'];_0x17f6d3[_0x88f1('0x26')]=_[_0x88f1('0x27')](_0x27691a);var _0x38af02={'dateStart':_0x1c752d[_0x88f1('0x28')][_0x88f1('0x29')],'dateEnd':_0x1c752d['query'][_0x88f1('0x2a')]};delete _0x1c752d[_0x88f1('0x28')][_0x88f1('0x29')];delete _0x1c752d['query'][_0x88f1('0x2a')];_0x17f6d3[_0x88f1('0x28')]=_[_0x88f1('0x27')](_0x1c752d[_0x88f1('0x28')]);_0x17f6d3[_0x88f1('0x2b')]=_[_0x88f1('0x2c')](_0x17f6d3[_0x88f1('0x26')],_0x17f6d3['query']);_0x216347[_0x88f1('0x2d')]=_['intersection'](_0x17f6d3['model'],qs['fields'](_0x1c752d[_0x88f1('0x28')]['fields']));_0x216347[_0x88f1('0x2d')]=_0x216347[_0x88f1('0x2d')][_0x88f1('0x2e')]?_0x216347[_0x88f1('0x2d')]:_0x17f6d3[_0x88f1('0x26')];if(!_0x1c752d[_0x88f1('0x28')][_0x88f1('0x2f')](_0x88f1('0x30'))){_0x216347['limit']=qs[_0x88f1('0x31')](_0x1c752d[_0x88f1('0x28')]['limit']);_0x216347['offset']=qs[_0x88f1('0x1a')](_0x1c752d['query']['offset']);}_0x216347[_0x88f1('0x32')]=qs['sort'](_0x1c752d[_0x88f1('0x28')][_0x88f1('0x33')]);_0x216347[_0x88f1('0x34')]=qs[_0x88f1('0x2b')](_['pick'](_0x1c752d[_0x88f1('0x28')],_0x17f6d3[_0x88f1('0x2b')]));if(_0x38af02[_0x88f1('0x29')]){if(_0x38af02[_0x88f1('0x2a')]){_0x38af02[_0x88f1('0x2a')]=moment(_0x38af02[_0x88f1('0x2a')])['add'](0x1,_0x88f1('0x35'));}else{_0x38af02['dateEnd']=moment(_0x38af02[_0x88f1('0x29')])[_0x88f1('0x36')](0x1,'day');}_[_0x88f1('0x37')](_0x216347['where'],{'createdAt':{'$gte':_0x38af02[_0x88f1('0x29')],'$lte':_0x38af02[_0x88f1('0x2a')]}});}if(_0x1c752d[_0x88f1('0x28')][_0x88f1('0x38')]){_0x216347[_0x88f1('0x34')]=_[_0x88f1('0x37')](_0x216347[_0x88f1('0x34')],{'$or':_['map'](_0x216347[_0x88f1('0x2d')],function(_0x4b9c90){var _0xbc228d={};_0xbc228d[_0x4b9c90]={'$like':'%'+_0x1c752d[_0x88f1('0x28')]['filter']+'%'};return _0xbc228d;})});}_0x216347=_[_0x88f1('0x37')]({},_0x216347,_0x1c752d[_0x88f1('0x39')]);var _0x59bca8={'where':_0x216347[_0x88f1('0x34')]};return db[_0x88f1('0x25')][_0x88f1('0x19')](_0x59bca8)['then'](function(_0x27c61c){_0x2d5c11[_0x88f1('0x19')]=_0x27c61c;if(_0x1c752d[_0x88f1('0x28')][_0x88f1('0x3a')]){_0x216347[_0x88f1('0x3b')]=[{'all':!![]}];}return db[_0x88f1('0x25')]['findAll'](_0x216347);})[_0x88f1('0x3c')](function(_0x2c4f04){_0x2d5c11[_0x88f1('0x3d')]=_0x2c4f04;return _0x2d5c11;})[_0x88f1('0x3c')](respondWithFilteredResult(_0x4cdc54,_0x216347))[_0x88f1('0x3e')](handleError(_0x4cdc54,null));};exports[_0x88f1('0x3f')]=function(_0x114aab,_0x11dca5){var _0x324927={'raw':!![],'where':{'id':_0x114aab[_0x88f1('0x40')]['id']}},_0x44e42={};_0x44e42[_0x88f1('0x26')]=_[_0x88f1('0x27')](db[_0x88f1('0x25')][_0x88f1('0x41')]);_0x44e42['query']=_[_0x88f1('0x27')](_0x114aab[_0x88f1('0x28')]);_0x44e42['filters']=_[_0x88f1('0x2c')](_0x44e42[_0x88f1('0x26')],_0x44e42[_0x88f1('0x28')]);_0x324927[_0x88f1('0x2d')]=_['intersection'](_0x44e42['model'],qs[_0x88f1('0x42')](_0x114aab['query'][_0x88f1('0x42')]));_0x324927[_0x88f1('0x2d')]=_0x324927[_0x88f1('0x2d')]['length']?_0x324927[_0x88f1('0x2d')]:_0x44e42[_0x88f1('0x26')];if(_0x114aab[_0x88f1('0x28')]['includeAll']){_0x324927[_0x88f1('0x3b')]=[{'all':!![]}];}_0x324927=_[_0x88f1('0x37')]({},_0x324927,_0x114aab[_0x88f1('0x39')]);return db['ChatInternalMessage'][_0x88f1('0x43')](_0x324927)[_0x88f1('0x3c')](handleEntityNotFound(_0x11dca5,null))[_0x88f1('0x3c')](respondWithResult(_0x11dca5,null))[_0x88f1('0x3e')](handleError(_0x11dca5,null));};exports['create']=function(_0x3de0d8,_0x74c338){return db[_0x88f1('0x25')][_0x88f1('0x44')](_0x3de0d8[_0x88f1('0x45')],{})[_0x88f1('0x3c')](respondWithResult(_0x74c338,0xc9))[_0x88f1('0x3e')](handleError(_0x74c338,null));};exports[_0x88f1('0x20')]=function(_0x50878,_0x62c779){if(_0x50878[_0x88f1('0x45')]['id']){delete _0x50878[_0x88f1('0x45')]['id'];}return db['ChatInternalMessage'][_0x88f1('0x43')]({'where':{'id':_0x50878[_0x88f1('0x40')]['id']}})[_0x88f1('0x3c')](handleEntityNotFound(_0x62c779,null))[_0x88f1('0x3c')](saveUpdates(_0x50878[_0x88f1('0x45')],null))[_0x88f1('0x3c')](respondWithResult(_0x62c779,null))[_0x88f1('0x3e')](handleError(_0x62c779,null));};exports[_0x88f1('0x21')]=function(_0x890858,_0x35d308){return db['ChatInternalMessage'][_0x88f1('0x43')]({'where':{'id':_0x890858[_0x88f1('0x40')]['id']}})[_0x88f1('0x3c')](handleEntityNotFound(_0x35d308,null))[_0x88f1('0x3c')](removeEntity(_0x35d308,null))[_0x88f1('0x3e')](handleError(_0x35d308,null));};exports[_0x88f1('0x46')]=function(_0x6f1a09,_0x4a23eb){return db['ChatInternalMessage'][_0x88f1('0x46')]()[_0x88f1('0x3c')](respondWithResult(_0x4a23eb,null))[_0x88f1('0x3e')](handleError(_0x4a23eb,null));};function wrapUser(_0x56ae0c){return function(_0x4d9959){var _0x502098=_0x56ae0c[_0x88f1('0x47')]({'plain':!![]});_0x502098[_0x88f1('0x48')]=[];if(_0x4d9959){_0x502098[_0x88f1('0x49')]=_0x4d9959[_0x88f1('0x4a')];_0x502098[_0x88f1('0x4b')]=_0x4d9959;}else{_0x502098[_0x88f1('0x49')]=moment(0x0)[_0x88f1('0x4c')](_0x88f1('0x4d'));_0x502098['lastMessage']={};}return _0x502098;};}exports['getUsers']=function(_0xb2c1db,_0x1d330e,_0x309f6c){var _0x3ef75e=[];return db[_0x88f1('0x4e')][_0x88f1('0x4f')]({'where':{'role':['agent',_0x88f1('0x50'),_0x88f1('0x51')]},'attributes':['id',_0x88f1('0x52'),_0x88f1('0x23'),_0x88f1('0x53'),_0x88f1('0x54'),_0x88f1('0x55'),_0x88f1('0x56'),_0x88f1('0x57'),_0x88f1('0x58'),_0x88f1('0x59')],'order':qs['sort'](_0x88f1('0x5a')),'include':[{'model':db[_0x88f1('0x5b')],'as':_0x88f1('0x5c'),'attributes':['id',_0x88f1('0x23'),_0x88f1('0x5d')],'through':{'attributes':[]}}]})[_0x88f1('0x3c')](function(_0x2758c9){var _0xa2d326=[];if(_0x2758c9){_0x3ef75e=_0x2758c9;for(var _0x5035c2=0x0;_0x5035c2<_0x2758c9[_0x88f1('0x2e')];_0x5035c2+=0x1){_0x3ef75e[_0x5035c2][_0x88f1('0x48')]=[];_0xa2d326[_0x88f1('0x5e')](db[_0x88f1('0x25')][_0x88f1('0x43')]({'where':{'FromId':[_0xb2c1db[_0x88f1('0x51')]['id'],_0x2758c9[_0x5035c2]['id']],'ToId':[_0xb2c1db[_0x88f1('0x51')]['id'],_0x2758c9[_0x5035c2]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x88f1('0x5f'),_0x88f1('0x60'),_0x88f1('0x61'),_0x88f1('0x45')],'order':qs[_0x88f1('0x33')](_0x88f1('0x62')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x2758c9[_0x5035c2])));}return BPromise[_0x88f1('0x63')](_0xa2d326);}return[];})[_0x88f1('0x3c')](function(_0xfdfbaa){return{'rows':_0xfdfbaa,'count':_0xfdfbaa[_0x88f1('0x2e')]};})[_0x88f1('0x3c')](respondWithResult(_0x1d330e,null))['catch'](handleError(_0x1d330e,null));}; \ No newline at end of file +var _0xdc9f=['length','nolimit','order','sort','where','filters','pick','day','add','filter','map','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','get','messages','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','User','agent','admin','user','userpic','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues','type','push','createdAt','FromId','read','-createdAt','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./chatInternalMessage.socket','register','sendStatus','status','json','offset','limit','set','reject','update','then','destroy','end','error','stack','name','send','ChatInternalMessage','rawAttributes','model','query','dateEnd','dateStart','keys','intersection','attributes','fields'];(function(_0x5195fe,_0x443327){var _0x14fb3b=function(_0x477c97){while(--_0x477c97){_0x5195fe['push'](_0x5195fe['shift']());}};_0x14fb3b(++_0x443327);}(_0xdc9f,0x8d));var _0xfdc9=function(_0xa23f0f,_0x465945){_0xa23f0f=_0xa23f0f-0x0;var _0x4da2f8=_0xdc9f[_0xa23f0f];return _0x4da2f8;};'use strict';var jsonpatch=require(_0xfdc9('0x0'));var rp=require('request-promise');var moment=require(_0xfdc9('0x1'));var BPromise=require(_0xfdc9('0x2'));var Mustache=require(_0xfdc9('0x3'));var util=require(_0xfdc9('0x4'));var path=require(_0xfdc9('0x5'));var sox=require('sox');var csv=require(_0xfdc9('0x6'));var ejs=require(_0xfdc9('0x7'));var fs=require('fs');var _=require(_0xfdc9('0x8'));var squel=require(_0xfdc9('0x9'));var crypto=require('crypto');var jsforce=require(_0xfdc9('0xa'));var deskjs=require(_0xfdc9('0xb'));var toCsv=require(_0xfdc9('0x6'));var querystring=require(_0xfdc9('0xc'));var Papa=require(_0xfdc9('0xd'));var qs=require(_0xfdc9('0xe'));var logger=require(_0xfdc9('0xf'))(_0xfdc9('0x10'));var utils=require(_0xfdc9('0x11'));var config=require(_0xfdc9('0x12'));var db=require(_0xfdc9('0x13'))['db'];var socket=require(_0xfdc9('0x14'))({'host':_0xfdc9('0x15'),'port':0x18eb});require(_0xfdc9('0x16'))[_0xfdc9('0x17')](socket);function respondWithStatusCode(_0x478d02,_0x4c95eb){_0x4c95eb=_0x4c95eb||0xcc;return function(_0x4c33df){if(_0x4c33df){return _0x478d02[_0xfdc9('0x18')](_0x4c95eb);}return _0x478d02[_0xfdc9('0x19')](_0x4c95eb)['end']();};}function respondWithResult(_0x3857ca,_0xf9f6c3){_0xf9f6c3=_0xf9f6c3||0xc8;return function(_0x345b6a){if(_0x345b6a){return _0x3857ca[_0xfdc9('0x19')](_0xf9f6c3)[_0xfdc9('0x1a')](_0x345b6a);}};}function respondWithFilteredResult(_0x1be5c7,_0x29c91f){return function(_0x393fe5){if(_0x393fe5){var _0x449f85=_0x393fe5['count'],_0x468058=_0x29c91f['offset'],_0xf9521e=_0x29c91f[_0xfdc9('0x1b')]+_0x29c91f[_0xfdc9('0x1c')],_0x2e39d1;if(_0xf9521e>=_0x449f85){_0xf9521e=_0x449f85;_0x2e39d1=0xc8;}else{_0x2e39d1=0xce;}_0x1be5c7[_0xfdc9('0x19')](_0x2e39d1);return _0x1be5c7[_0xfdc9('0x1d')]('Content-Range',_0x468058+'-'+_0xf9521e+'/'+_0x449f85)[_0xfdc9('0x1a')](_0x393fe5);}return null;};}function patchUpdates(_0x32eeed){return function(_0xdf01d4){try{jsonpatch['apply'](_0xdf01d4,_0x32eeed,!![]);}catch(_0x4397af){return BPromise[_0xfdc9('0x1e')](_0x4397af);}return _0xdf01d4['save']();};}function saveUpdates(_0x279ffe,_0x559535){return function(_0x4ecd2d){if(_0x4ecd2d){return _0x4ecd2d[_0xfdc9('0x1f')](_0x279ffe)[_0xfdc9('0x20')](function(_0x583af2){return _0x583af2;});}return null;};}function removeEntity(_0x345b1d,_0x4fc482){return function(_0x484997){if(_0x484997){return _0x484997[_0xfdc9('0x21')]()['then'](function(){_0x345b1d['status'](0xcc)[_0xfdc9('0x22')]();});}};}function handleEntityNotFound(_0x240b99,_0x43fe77){return function(_0x40a8b3){if(!_0x40a8b3){_0x240b99['sendStatus'](0x194);}return _0x40a8b3;};}function handleError(_0x218d49,_0x32b9a7){_0x32b9a7=_0x32b9a7||0x1f4;return function(_0x29dda2){logger[_0xfdc9('0x23')](_0x29dda2[_0xfdc9('0x24')]);if(_0x29dda2['name']){delete _0x29dda2[_0xfdc9('0x25')];}_0x218d49['status'](_0x32b9a7)[_0xfdc9('0x26')](_0x29dda2);};}exports['index']=function(_0x48edd6,_0x59d8f9){var _0x3918d1={},_0x459b38={},_0x5caaf6={'count':0x0,'rows':[]};var _0x284ce3=db[_0xfdc9('0x27')][_0xfdc9('0x28')];_0x459b38[_0xfdc9('0x29')]=_['keys'](_0x284ce3);var _0x5f0f5b={'dateStart':_0x48edd6['query']['dateStart'],'dateEnd':_0x48edd6[_0xfdc9('0x2a')][_0xfdc9('0x2b')]};delete _0x48edd6[_0xfdc9('0x2a')][_0xfdc9('0x2c')];delete _0x48edd6[_0xfdc9('0x2a')]['dateEnd'];_0x459b38['query']=_[_0xfdc9('0x2d')](_0x48edd6['query']);_0x459b38['filters']=_[_0xfdc9('0x2e')](_0x459b38[_0xfdc9('0x29')],_0x459b38[_0xfdc9('0x2a')]);_0x3918d1[_0xfdc9('0x2f')]=_[_0xfdc9('0x2e')](_0x459b38[_0xfdc9('0x29')],qs[_0xfdc9('0x30')](_0x48edd6[_0xfdc9('0x2a')][_0xfdc9('0x30')]));_0x3918d1['attributes']=_0x3918d1[_0xfdc9('0x2f')][_0xfdc9('0x31')]?_0x3918d1[_0xfdc9('0x2f')]:_0x459b38[_0xfdc9('0x29')];if(!_0x48edd6[_0xfdc9('0x2a')]['hasOwnProperty'](_0xfdc9('0x32'))){_0x3918d1[_0xfdc9('0x1c')]=qs[_0xfdc9('0x1c')](_0x48edd6[_0xfdc9('0x2a')][_0xfdc9('0x1c')]);_0x3918d1[_0xfdc9('0x1b')]=qs['offset'](_0x48edd6[_0xfdc9('0x2a')]['offset']);}_0x3918d1[_0xfdc9('0x33')]=qs[_0xfdc9('0x34')](_0x48edd6['query'][_0xfdc9('0x34')]);_0x3918d1[_0xfdc9('0x35')]=qs[_0xfdc9('0x36')](_[_0xfdc9('0x37')](_0x48edd6[_0xfdc9('0x2a')],_0x459b38[_0xfdc9('0x36')]));if(_0x5f0f5b['dateStart']){if(_0x5f0f5b[_0xfdc9('0x2b')]){_0x5f0f5b['dateEnd']=moment(_0x5f0f5b['dateEnd'])['add'](0x1,_0xfdc9('0x38'));}else{_0x5f0f5b['dateEnd']=moment(_0x5f0f5b['dateStart'])[_0xfdc9('0x39')](0x1,_0xfdc9('0x38'));}_['merge'](_0x3918d1[_0xfdc9('0x35')],{'createdAt':{'$gte':_0x5f0f5b[_0xfdc9('0x2c')],'$lte':_0x5f0f5b[_0xfdc9('0x2b')]}});}if(_0x48edd6['query'][_0xfdc9('0x3a')]){_0x3918d1[_0xfdc9('0x35')]=_['merge'](_0x3918d1[_0xfdc9('0x35')],{'$or':_[_0xfdc9('0x3b')](_0x3918d1[_0xfdc9('0x2f')],function(_0x3e123f){var _0x107019={};_0x107019[_0x3e123f]={'$like':'%'+_0x48edd6[_0xfdc9('0x2a')]['filter']+'%'};return _0x107019;})});}_0x3918d1=_[_0xfdc9('0x3c')]({},_0x3918d1,_0x48edd6[_0xfdc9('0x3d')]);var _0x4983c9={'where':_0x3918d1[_0xfdc9('0x35')]};return db[_0xfdc9('0x27')]['count'](_0x4983c9)[_0xfdc9('0x20')](function(_0x19e495){_0x5caaf6['count']=_0x19e495;if(_0x48edd6['query'][_0xfdc9('0x3e')]){_0x3918d1[_0xfdc9('0x3f')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xfdc9('0x40')](_0x3918d1);})[_0xfdc9('0x20')](function(_0x198892){_0x5caaf6[_0xfdc9('0x41')]=_0x198892;return _0x5caaf6;})['then'](respondWithFilteredResult(_0x59d8f9,_0x3918d1))['catch'](handleError(_0x59d8f9,null));};exports[_0xfdc9('0x42')]=function(_0x6b17c4,_0x3f7f5e){var _0x508105={'raw':!![],'where':{'id':_0x6b17c4[_0xfdc9('0x43')]['id']}},_0xaedff={};_0xaedff['model']=_[_0xfdc9('0x2d')](db[_0xfdc9('0x27')][_0xfdc9('0x28')]);_0xaedff['query']=_[_0xfdc9('0x2d')](_0x6b17c4[_0xfdc9('0x2a')]);_0xaedff[_0xfdc9('0x36')]=_[_0xfdc9('0x2e')](_0xaedff[_0xfdc9('0x29')],_0xaedff[_0xfdc9('0x2a')]);_0x508105['attributes']=_[_0xfdc9('0x2e')](_0xaedff[_0xfdc9('0x29')],qs['fields'](_0x6b17c4[_0xfdc9('0x2a')][_0xfdc9('0x30')]));_0x508105[_0xfdc9('0x2f')]=_0x508105['attributes'][_0xfdc9('0x31')]?_0x508105[_0xfdc9('0x2f')]:_0xaedff[_0xfdc9('0x29')];if(_0x6b17c4[_0xfdc9('0x2a')]['includeAll']){_0x508105[_0xfdc9('0x3f')]=[{'all':!![]}];}_0x508105=_['merge']({},_0x508105,_0x6b17c4['options']);return db[_0xfdc9('0x27')][_0xfdc9('0x44')](_0x508105)[_0xfdc9('0x20')](handleEntityNotFound(_0x3f7f5e,null))['then'](respondWithResult(_0x3f7f5e,null))[_0xfdc9('0x45')](handleError(_0x3f7f5e,null));};exports[_0xfdc9('0x46')]=function(_0x3d2fca,_0x420415){return db[_0xfdc9('0x27')][_0xfdc9('0x46')](_0x3d2fca[_0xfdc9('0x47')],{})[_0xfdc9('0x20')](respondWithResult(_0x420415,0xc9))[_0xfdc9('0x45')](handleError(_0x420415,null));};exports[_0xfdc9('0x1f')]=function(_0x71d0bb,_0x532f2a){if(_0x71d0bb[_0xfdc9('0x47')]['id']){delete _0x71d0bb[_0xfdc9('0x47')]['id'];}return db[_0xfdc9('0x27')][_0xfdc9('0x44')]({'where':{'id':_0x71d0bb[_0xfdc9('0x43')]['id']}})[_0xfdc9('0x20')](handleEntityNotFound(_0x532f2a,null))[_0xfdc9('0x20')](saveUpdates(_0x71d0bb[_0xfdc9('0x47')],null))[_0xfdc9('0x20')](respondWithResult(_0x532f2a,null))[_0xfdc9('0x45')](handleError(_0x532f2a,null));};exports[_0xfdc9('0x21')]=function(_0x1cd3e3,_0x595518){return db['ChatInternalMessage']['find']({'where':{'id':_0x1cd3e3['params']['id']}})['then'](handleEntityNotFound(_0x595518,null))[_0xfdc9('0x20')](removeEntity(_0x595518,null))['catch'](handleError(_0x595518,null));};exports['describe']=function(_0x1f5509,_0x59688d){return db[_0xfdc9('0x27')][_0xfdc9('0x48')]()[_0xfdc9('0x20')](respondWithResult(_0x59688d,null))[_0xfdc9('0x45')](handleError(_0x59688d,null));};function wrapUser(_0x10efb3){return function(_0x126056){var _0x47c214=_0x10efb3[_0xfdc9('0x49')]({'plain':!![]});_0x47c214[_0xfdc9('0x4a')]=[];if(_0x126056){_0x47c214[_0xfdc9('0x4b')]=_0x126056['createdAt'];_0x47c214['lastMessage']=_0x126056;}else{_0x47c214[_0xfdc9('0x4b')]=moment(0x0)['format'](_0xfdc9('0x4c'));_0x47c214['lastMessage']={};}return _0x47c214;};}exports['getUsers']=function(_0x45e221,_0x52de4a,_0x394bcb){var _0x11bf27=[];return db[_0xfdc9('0x4d')]['findAll']({'where':{'role':[_0xfdc9('0x4e'),_0xfdc9('0x4f'),_0xfdc9('0x50')]},'attributes':['id','fullname','name','role',_0xfdc9('0x51'),_0xfdc9('0x52'),_0xfdc9('0x53'),_0xfdc9('0x54'),_0xfdc9('0x55'),'showWebBar'],'order':qs[_0xfdc9('0x34')](_0xfdc9('0x56')),'include':[{'model':db[_0xfdc9('0x57')],'as':_0xfdc9('0x58'),'attributes':['id',_0xfdc9('0x25'),_0xfdc9('0x59')],'through':{'attributes':[]}}]})['then'](function(_0x4ad2d9){var _0x15ce26=[];if(_0x4ad2d9){_0x11bf27=_0x4ad2d9;for(var _0x36f607=0x0;_0x36f607<_0x4ad2d9[_0xfdc9('0x31')];_0x36f607+=0x1){_0x11bf27[_0x36f607][_0xfdc9('0x4a')]=[];_0x15ce26[_0xfdc9('0x5a')](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x45e221[_0xfdc9('0x50')]['id'],_0x4ad2d9[_0x36f607]['id']],'ToId':[_0x45e221[_0xfdc9('0x50')]['id'],_0x4ad2d9[_0x36f607]['id']],'ChatGroupId':null},'attributes':['id',_0xfdc9('0x5b'),_0xfdc9('0x5c'),'ToId',_0xfdc9('0x5d'),_0xfdc9('0x47')],'order':qs['sort'](_0xfdc9('0x5e')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x4ad2d9[_0x36f607])));}return BPromise['all'](_0x15ce26);}return[];})[_0xfdc9('0x20')](function(_0x1ad991){return{'rows':_0x1ad991,'count':_0x1ad991[_0xfdc9('0x31')]};})['then'](respondWithResult(_0x52de4a,null))[_0xfdc9('0x45')](handleError(_0x52de4a,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index e42fac0..495a583 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 _0x300a=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','emit'];(function(_0x349b00,_0x5b58c3){var _0x45744f=function(_0x3caf27){while(--_0x3caf27){_0x349b00['push'](_0x349b00['shift']());}};_0x45744f(++_0x5b58c3);}(_0x300a,0x143));var _0xa300=function(_0x3d474e,_0x431f54){_0x3d474e=_0x3d474e-0x0;var _0x30b3e3=_0x300a[_0x3d474e];return _0x30b3e3;};'use strict';var EventEmitter=require(_0xa300('0x0'));var ChatInternalMessage=require(_0xa300('0x1'))['db'][_0xa300('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xa300('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4211b4){return function(_0x331158,_0x49326b,_0x5a1144){ChatInternalMessageEvents[_0xa300('0x4')](_0x4211b4+':'+_0x331158['id'],_0x331158);ChatInternalMessageEvents[_0xa300('0x4')](_0x4211b4,_0x331158);_0x5a1144(null);};}for(var e in events){if(events[_0xa300('0x5')](e)){var event=events[e];ChatInternalMessage[_0xa300('0x6')](e,emitEvent(event));}}module[_0xa300('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x5856=['exports','events','../../mysqldb','setMaxListeners','save','update','emit','hook'];(function(_0xc7348b,_0x145880){var _0x307cec=function(_0x4f1554){while(--_0x4f1554){_0xc7348b['push'](_0xc7348b['shift']());}};_0x307cec(++_0x145880);}(_0x5856,0xc9));var _0x6585=function(_0x5817e6,_0x44a2d0){_0x5817e6=_0x5817e6-0x0;var _0x51916a=_0x5856[_0x5817e6];return _0x51916a;};'use strict';var EventEmitter=require(_0x6585('0x0'));var ChatInternalMessage=require(_0x6585('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6585('0x2')](0x0);var events={'afterCreate':_0x6585('0x3'),'afterUpdate':_0x6585('0x4'),'afterDestroy':'remove'};function emitEvent(_0x358a19){return function(_0x1983c9,_0x29b330,_0x4600a2){ChatInternalMessageEvents[_0x6585('0x5')](_0x358a19+':'+_0x1983c9['id'],_0x1983c9);ChatInternalMessageEvents['emit'](_0x358a19,_0x1983c9);_0x4600a2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x6585('0x6')](e,emitEvent(event));}}module[_0x6585('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index d03f71c..b25dcd8 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 _0x16cc=['utf8mb4','util','api','moment','exports','define','ChatInternalMessage','chat_internal_messages'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x16cc,0xc9));var _0xc16c=function(_0x4bce5c,_0x2575c0){_0x4bce5c=_0x4bce5c-0x0;var _0x329c06=_0x16cc[_0x4bce5c];return _0x329c06;};'use strict';var _=require('lodash');var util=require(_0xc16c('0x0'));var logger=require('../../config/logger')(_0xc16c('0x1'));var moment=require(_0xc16c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./chatInternalMessage.attributes');module[_0xc16c('0x3')]=function(_0x3c96d4,_0x1b203b){return _0x3c96d4[_0xc16c('0x4')](_0xc16c('0x5'),attributes,{'tableName':_0xc16c('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc16c('0x7'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe5d4=['chat_internal_messages','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','exports','define','ChatInternalMessage'];(function(_0xbc05d1,_0x1fed83){var _0x31ea3d=function(_0x44936c){while(--_0x44936c){_0xbc05d1['push'](_0xbc05d1['shift']());}};_0x31ea3d(++_0x1fed83);}(_0xe5d4,0x110));var _0x4e5d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe5d4[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x4e5d('0x0'));var util=require(_0x4e5d('0x1'));var logger=require(_0x4e5d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4e5d('0x3'));var rp=require(_0x4e5d('0x4'));var attributes=require('./chatInternalMessage.attributes');module[_0x4e5d('0x5')]=function(_0x38cf43,_0x29157e){return _0x38cf43[_0x4e5d('0x6')](_0x4e5d('0x7'),attributes,{'tableName':_0x4e5d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4e5d('0x9')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index fc4f84e..4d35c04 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 _0xc19b=['info','request\x20sent','debug','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','localhost','./chatInternalMessage.socket','register','request'];(function(_0x115bb1,_0x1d678a){var _0x86091f=function(_0x45bcaf){while(--_0x45bcaf){_0x115bb1['push'](_0x115bb1['shift']());}};_0x86091f(++_0x1d678a);}(_0xc19b,0x11c));var _0xbc19=function(_0x228641,_0x25d636){_0x228641=_0x228641-0x0;var _0x5d5d78=_0xc19b[_0x228641];return _0x5d5d78;};'use strict';var _=require(_0xbc19('0x0'));var util=require(_0xbc19('0x1'));var moment=require(_0xbc19('0x2'));var BPromise=require(_0xbc19('0x3'));var rs=require(_0xbc19('0x4'));var fs=require('fs');var db=require(_0xbc19('0x5'))['db'];var utils=require(_0xbc19('0x6'));var logger=require('../../config/logger')(_0xbc19('0x7'));var config=require(_0xbc19('0x8'));var jayson=require(_0xbc19('0x9'));var client=jayson[_0xbc19('0xa')][_0xbc19('0xb')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0xbc19('0xc'),'port':0x18eb});require(_0xbc19('0xd'))[_0xbc19('0xe')](socket);function respondWithRpcPromise(_0x33fa52,_0x582818,_0x4e236e){return new BPromise(function(_0x25ea51,_0x39b6ca){return client[_0xbc19('0xf')](_0x33fa52,_0x4e236e)['then'](function(_0x267b0e){logger[_0xbc19('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x582818,_0xbc19('0x11'));logger[_0xbc19('0x12')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x582818,_0xbc19('0x11'),JSON[_0xbc19('0x13')](_0x267b0e));if(_0x267b0e['error']){if(_0x267b0e[_0xbc19('0x14')][_0xbc19('0x15')]===0x1f4){logger[_0xbc19('0x14')](_0xbc19('0x16'),_0x582818,_0x267b0e[_0xbc19('0x14')][_0xbc19('0x17')]);return _0x39b6ca(_0x267b0e['error'][_0xbc19('0x17')]);}logger[_0xbc19('0x14')](_0xbc19('0x16'),_0x582818,_0x267b0e['error'][_0xbc19('0x17')]);return _0x25ea51(_0x267b0e[_0xbc19('0x14')][_0xbc19('0x17')]);}else{logger[_0xbc19('0x10')](_0xbc19('0x16'),_0x582818,_0xbc19('0x11'));_0x25ea51(_0x267b0e['result'][_0xbc19('0x17')]);}})[_0xbc19('0x18')](function(_0x2a4587){logger['error'](_0xbc19('0x16'),_0x582818,_0x2a4587);_0x39b6ca(_0x2a4587);});});} \ No newline at end of file +var _0x52ec=['error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','socket.io-emitter','localhost','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5255dc,_0x23070c){var _0x420245=function(_0x3727d7){while(--_0x3727d7){_0x5255dc['push'](_0x5255dc['shift']());}};_0x420245(++_0x23070c);}(_0x52ec,0xb3));var _0xc52e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x52ec[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0xc52e('0x0'));var util=require(_0xc52e('0x1'));var moment=require(_0xc52e('0x2'));var BPromise=require(_0xc52e('0x3'));var rs=require(_0xc52e('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc52e('0x5'))(_0xc52e('0x6'));var config=require(_0xc52e('0x7'));var jayson=require(_0xc52e('0x8'));var client=jayson['client'][_0xc52e('0x9')]({'port':0x232a});var socket=require(_0xc52e('0xa'))({'host':_0xc52e('0xb'),'port':0x18eb});require(_0xc52e('0xc'))[_0xc52e('0xd')](socket);function respondWithRpcPromise(_0x134d2f,_0x146f69,_0x3e7ab4){return new BPromise(function(_0x59da37,_0x1c163c){return client[_0xc52e('0xe')](_0x134d2f,_0x3e7ab4)[_0xc52e('0xf')](function(_0x1b3ceb){logger[_0xc52e('0x10')](_0xc52e('0x11'),_0x146f69,_0xc52e('0x12'));logger[_0xc52e('0x13')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x146f69,_0xc52e('0x12'),JSON[_0xc52e('0x14')](_0x1b3ceb));if(_0x1b3ceb[_0xc52e('0x15')]){if(_0x1b3ceb[_0xc52e('0x15')]['code']===0x1f4){logger['error'](_0xc52e('0x11'),_0x146f69,_0x1b3ceb[_0xc52e('0x15')][_0xc52e('0x16')]);return _0x1c163c(_0x1b3ceb['error'][_0xc52e('0x16')]);}logger['error'](_0xc52e('0x11'),_0x146f69,_0x1b3ceb[_0xc52e('0x15')][_0xc52e('0x16')]);return _0x59da37(_0x1b3ceb['error'][_0xc52e('0x16')]);}else{logger['info'](_0xc52e('0x11'),_0x146f69,_0xc52e('0x12'));_0x59da37(_0x1b3ceb[_0xc52e('0x17')][_0xc52e('0x16')]);}})[_0xc52e('0x18')](function(_0x2ae852){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x146f69,_0x2ae852);_0x1c163c(_0x2ae852);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 69fd08d..71fd25a 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 _0xe654=['./chatInternalMessage.events','save','remove','update','removeListener','length'];(function(_0x594847,_0x47b321){var _0xd05d17=function(_0x1e8ece){while(--_0x1e8ece){_0x594847['push'](_0x594847['shift']());}};_0xd05d17(++_0x47b321);}(_0xe654,0x162));var _0x4e65=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe654[_0x2dafbe];return _0x58a45a;};'use strict';var ChatInternalMessageEvents=require(_0x4e65('0x0'));var events=[_0x4e65('0x1'),_0x4e65('0x2'),_0x4e65('0x3')];function createListener(_0x3597e4,_0x1d9d8c){return function(_0x2e820e){_0x1d9d8c['emit'](_0x3597e4,_0x2e820e);};}function removeListener(_0x525a29,_0x20bdc3){return function(){ChatInternalMessageEvents[_0x4e65('0x4')](_0x525a29,_0x20bdc3);};}exports['register']=function(_0x2f6fc0){for(var _0x49b4b0=0x0,_0x37e973=events[_0x4e65('0x5')];_0x49b4b0<_0x37e973;_0x49b4b0++){var _0xbccbd5=events[_0x49b4b0];var _0x3b4000=createListener('chatInternalMessage:'+_0xbccbd5,_0x2f6fc0);ChatInternalMessageEvents['on'](_0xbccbd5,_0x3b4000);}}; \ No newline at end of file +var _0x1dba=['remove','update','removeListener','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x4ddc7a,_0x5b6cb8){var _0x4547c1=function(_0x3739e7){while(--_0x3739e7){_0x4ddc7a['push'](_0x4ddc7a['shift']());}};_0x4547c1(++_0x5b6cb8);}(_0x1dba,0x101));var _0xa1db=function(_0x589257,_0x229157){_0x589257=_0x589257-0x0;var _0x3f3d23=_0x1dba[_0x589257];return _0x3f3d23;};'use strict';var ChatInternalMessageEvents=require(_0xa1db('0x0'));var events=[_0xa1db('0x1'),_0xa1db('0x2'),_0xa1db('0x3')];function createListener(_0x15d7f3,_0x2d5738){return function(_0x36ba27){_0x2d5738['emit'](_0x15d7f3,_0x36ba27);};}function removeListener(_0x3f7b29,_0x1f3e1c){return function(){ChatInternalMessageEvents[_0xa1db('0x4')](_0x3f7b29,_0x1f3e1c);};}exports['register']=function(_0xd411ce){for(var _0x5b7958=0x0,_0x2e5f1c=events[_0xa1db('0x5')];_0x5b7958<_0x2e5f1c;_0x5b7958++){var _0x102b01=events[_0x5b7958];var _0x1f04a7=createListener(_0xa1db('0x6')+_0x102b01,_0xd411ce);ChatInternalMessageEvents['on'](_0x102b01,_0x1f04a7);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 870232d..6cea870 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 _0xa9e0=['destroy','exports','multer','util','path','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x685346,_0x3ef2e5){var _0x52e15b=function(_0x4435da){while(--_0x4435da){_0x685346['push'](_0x685346['shift']());}};_0x52e15b(++_0x3ef2e5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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']('/users',auth[_0x0a9e('0x7')](),controller['getUsers']);router['get'](_0x0a9e('0xb'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xe')]);router['put']('/:id',controller['update']);router['delete'](_0x0a9e('0xb'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xf')]);module[_0x0a9e('0x10')]=router; \ No newline at end of file +var _0xbaf0=['update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x322fe6,_0x653aa2){var _0x141d98=function(_0x229650){while(--_0x229650){_0x322fe6['push'](_0x322fe6['shift']());}};_0x141d98(++_0x653aa2);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'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')]('/users',auth[_0x0baf('0x8')](),controller['getUsers']);router[_0x0baf('0x7')](_0x0baf('0xc'),auth[_0x0baf('0x8')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0x8')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0xc'),controller[_0x0baf('0x11')]);router[_0x0baf('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0baf('0x13')]);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 14129b1..7d3c43f 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 _0xfb81=['DATE','sequelize','TEXT','medium','ENUM','out'];(function(_0x437aa2,_0x48d508){var _0x28ac4d=function(_0x4afc37){while(--_0x4afc37){_0x437aa2['push'](_0x437aa2['shift']());}};_0x28ac4d(++_0x48d508);}(_0xfb81,0x1f3));var _0x1fb8=function(_0x1214e4,_0x1cb35c){_0x1214e4=_0x1214e4-0x0;var _0x1250f6=_0xfb81[_0x1214e4];return _0x1250f6;};'use strict';var Sequelize=require(_0x1fb8('0x0'));module['exports']={'body':{'type':Sequelize[_0x1fb8('0x1')](_0x1fb8('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x1fb8('0x3')]('in',_0x1fb8('0x4')),'defaultValue':_0x1fb8('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x1fb8('0x5')]}}; \ No newline at end of file +var _0x74c3=['out','exports','TEXT','BOOLEAN','ENUM'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x74c3,0x6f));var _0x374c=function(_0x3e78c1,_0x13967d){_0x3e78c1=_0x3e78c1-0x0;var _0x1fb810=_0x74c3[_0x3e78c1];return _0x1fb810;};'use strict';var Sequelize=require('sequelize');module[_0x374c('0x0')]={'body':{'type':Sequelize[_0x374c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x374c('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x374c('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x374c('0x3')]('in',_0x374c('0x4')),'defaultValue':_0x374c('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index a2a951f..29655db 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 _0xf846=['model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','nolimit','limit','sort','where','filters','day','add','merge','filter','map','options','includeAll','findAll','rows','catch','show','include','create','body','find','params','destroy','../../config/logger','chat-interactions','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','parse','agent','get','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','moment','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../mysqldb','socket.io-emitter','./chatMessage.socket','register','client','http','request','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','sendStatus','end','json','count','offset','status','set','Content-Range','apply','reject','save','update','then','stack','name','ChatMessage','rawAttributes'];(function(_0x3257c2,_0x5652a7){var _0x55ad23=function(_0x525a92){while(--_0x525a92){_0x3257c2['push'](_0x3257c2['shift']());}};_0x55ad23(++_0x5652a7);}(_0xf846,0x119));var _0x6f84=function(_0x4a70ce,_0x13462f){_0x4a70ce=_0x4a70ce-0x0;var _0x5a74fd=_0xf846[_0x4a70ce];return _0x5a74fd;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6f84('0x0'));var BPromise=require(_0x6f84('0x1'));var Mustache=require('mustache');var util=require(_0x6f84('0x2'));var path=require(_0x6f84('0x3'));var sox=require('sox');var csv=require(_0x6f84('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6f84('0x5'));var squel=require(_0x6f84('0x6'));var crypto=require(_0x6f84('0x7'));var jsforce=require(_0x6f84('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6f84('0x9'));var Papa=require(_0x6f84('0xa'));var qs=require(_0x6f84('0xb'));var logger=require('../../config/logger')(_0x6f84('0xc'));var utils=require(_0x6f84('0xd'));var config=require('../../config/environment');var db=require(_0x6f84('0xe'))['db'];var socket=require(_0x6f84('0xf'))({'host':'localhost','port':0x18eb});require(_0x6f84('0x10'))[_0x6f84('0x11')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6f84('0x12')][_0x6f84('0x13')]({'port':0x232c});var client9002=jayson[_0x6f84('0x12')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ee0cc,_0x54eca0,_0x384c0b,_0x30fd9c){return new BPromise(function(_0x4d5641,_0x25bd2a){var _0x545455=_0x30fd9c||client;return _0x545455[_0x6f84('0x14')](_0x1ee0cc,_0x384c0b)['then'](function(_0xaf424a){logger['info'](_0x6f84('0x15'),_0x54eca0,_0x6f84('0x16'));logger[_0x6f84('0x17')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x54eca0,_0x6f84('0x16'),JSON[_0x6f84('0x18')](_0xaf424a));if(_0xaf424a[_0x6f84('0x19')]){if(_0xaf424a['error'][_0x6f84('0x1a')]===0x1f4){logger[_0x6f84('0x19')](_0x6f84('0x15'),_0x54eca0,_0xaf424a[_0x6f84('0x19')]['message']);return _0x25bd2a(_0xaf424a['error'][_0x6f84('0x1b')]);}logger['error'](_0x6f84('0x15'),_0x54eca0,_0xaf424a[_0x6f84('0x19')][_0x6f84('0x1b')]);return _0x4d5641(_0xaf424a[_0x6f84('0x19')]['message']);}else{logger[_0x6f84('0x1c')](_0x6f84('0x15'),_0x54eca0,'request\x20sent');_0x4d5641(_0xaf424a['result'][_0x6f84('0x1b')]);}})['catch'](function(_0x461f61){logger[_0x6f84('0x19')](_0x6f84('0x15'),_0x54eca0,_0x461f61);_0x25bd2a(_0x461f61);});});}function respondWithStatusCode(_0xea70d1,_0x24a7ff){_0x24a7ff=_0x24a7ff||0xcc;return function(_0x248866){if(_0x248866){return _0xea70d1[_0x6f84('0x1d')](_0x24a7ff);}return _0xea70d1['status'](_0x24a7ff)[_0x6f84('0x1e')]();};}function respondWithResult(_0x853675,_0x36750a){_0x36750a=_0x36750a||0xc8;return function(_0x555354){if(_0x555354){return _0x853675['status'](_0x36750a)[_0x6f84('0x1f')](_0x555354);}};}function respondWithFilteredResult(_0x31d3c0,_0x2d2e6a){return function(_0x333f20){if(_0x333f20){var _0x54ca48=_0x333f20[_0x6f84('0x20')],_0x5cf386=_0x2d2e6a[_0x6f84('0x21')],_0x1b8765=_0x2d2e6a[_0x6f84('0x21')]+_0x2d2e6a['limit'],_0xf13ba3;if(_0x1b8765>=_0x54ca48){_0x1b8765=_0x54ca48;_0xf13ba3=0xc8;}else{_0xf13ba3=0xce;}_0x31d3c0[_0x6f84('0x22')](_0xf13ba3);return _0x31d3c0[_0x6f84('0x23')](_0x6f84('0x24'),_0x5cf386+'-'+_0x1b8765+'/'+_0x54ca48)['json'](_0x333f20);}return null;};}function patchUpdates(_0x5629e3){return function(_0x49845b){try{jsonpatch[_0x6f84('0x25')](_0x49845b,_0x5629e3,!![]);}catch(_0x5ab437){return BPromise[_0x6f84('0x26')](_0x5ab437);}return _0x49845b[_0x6f84('0x27')]();};}function saveUpdates(_0x143c10,_0xabded7){return function(_0xa89683){if(_0xa89683){return _0xa89683[_0x6f84('0x28')](_0x143c10)[_0x6f84('0x29')](function(_0x5380fc){return _0x5380fc;});}return null;};}function removeEntity(_0x1d1d73,_0x1655f5){return function(_0x306388){if(_0x306388){return _0x306388['destroy']()[_0x6f84('0x29')](function(){_0x1d1d73[_0x6f84('0x22')](0xcc)[_0x6f84('0x1e')]();});}};}function handleEntityNotFound(_0x1bb2f6,_0x38b6fc){return function(_0x25f334){if(!_0x25f334){_0x1bb2f6[_0x6f84('0x1d')](0x194);}return _0x25f334;};}function handleError(_0x59b1df,_0x3b9581){_0x3b9581=_0x3b9581||0x1f4;return function(_0x2e1806){logger[_0x6f84('0x19')](_0x2e1806[_0x6f84('0x2a')]);if(_0x2e1806['name']){delete _0x2e1806[_0x6f84('0x2b')];}_0x59b1df[_0x6f84('0x22')](_0x3b9581)['send'](_0x2e1806);};}exports['index']=function(_0x3ea1cf,_0x10436e){var _0x4681d0={},_0x1665ce={},_0x387094={'count':0x0,'rows':[]};var _0x2da173=db[_0x6f84('0x2c')][_0x6f84('0x2d')];_0x1665ce[_0x6f84('0x2e')]=_[_0x6f84('0x2f')](_0x2da173);var _0x3a492f={'dateStart':_0x3ea1cf[_0x6f84('0x30')][_0x6f84('0x31')],'dateEnd':_0x3ea1cf[_0x6f84('0x30')][_0x6f84('0x32')]};delete _0x3ea1cf[_0x6f84('0x30')][_0x6f84('0x31')];delete _0x3ea1cf[_0x6f84('0x30')][_0x6f84('0x32')];_0x1665ce[_0x6f84('0x30')]=_['keys'](_0x3ea1cf[_0x6f84('0x30')]);_0x1665ce['filters']=_[_0x6f84('0x33')](_0x1665ce[_0x6f84('0x2e')],_0x1665ce['query']);_0x4681d0[_0x6f84('0x34')]=_[_0x6f84('0x33')](_0x1665ce[_0x6f84('0x2e')],qs[_0x6f84('0x35')](_0x3ea1cf['query']['fields']));_0x4681d0[_0x6f84('0x34')]=_0x4681d0[_0x6f84('0x34')][_0x6f84('0x36')]?_0x4681d0[_0x6f84('0x34')]:_0x1665ce['model'];if(!_0x3ea1cf[_0x6f84('0x30')]['hasOwnProperty'](_0x6f84('0x37'))){_0x4681d0[_0x6f84('0x38')]=qs[_0x6f84('0x38')](_0x3ea1cf[_0x6f84('0x30')][_0x6f84('0x38')]);_0x4681d0[_0x6f84('0x21')]=qs['offset'](_0x3ea1cf[_0x6f84('0x30')][_0x6f84('0x21')]);}_0x4681d0['order']=qs[_0x6f84('0x39')](_0x3ea1cf[_0x6f84('0x30')]['sort']);_0x4681d0[_0x6f84('0x3a')]=qs[_0x6f84('0x3b')](_['pick'](_0x3ea1cf[_0x6f84('0x30')],_0x1665ce[_0x6f84('0x3b')]));if(_0x3a492f[_0x6f84('0x31')]){if(_0x3a492f[_0x6f84('0x32')]){_0x3a492f[_0x6f84('0x32')]=moment(_0x3a492f[_0x6f84('0x32')])['add'](0x1,_0x6f84('0x3c'));}else{_0x3a492f[_0x6f84('0x32')]=moment(_0x3a492f[_0x6f84('0x31')])[_0x6f84('0x3d')](0x1,_0x6f84('0x3c'));}_[_0x6f84('0x3e')](_0x4681d0[_0x6f84('0x3a')],{'createdAt':{'$gte':_0x3a492f['dateStart'],'$lte':_0x3a492f[_0x6f84('0x32')]}});}if(_0x3ea1cf[_0x6f84('0x30')][_0x6f84('0x3f')]){_0x4681d0[_0x6f84('0x3a')]=_['merge'](_0x4681d0[_0x6f84('0x3a')],{'$or':_[_0x6f84('0x40')](_0x4681d0[_0x6f84('0x34')],function(_0x1c6996){var _0x47263e={};_0x47263e[_0x1c6996]={'$like':'%'+_0x3ea1cf[_0x6f84('0x30')][_0x6f84('0x3f')]+'%'};return _0x47263e;})});}_0x4681d0=_['merge']({},_0x4681d0,_0x3ea1cf[_0x6f84('0x41')]);var _0x52b0e1={'where':_0x4681d0[_0x6f84('0x3a')]};return db[_0x6f84('0x2c')][_0x6f84('0x20')](_0x52b0e1)['then'](function(_0x543ad7){_0x387094[_0x6f84('0x20')]=_0x543ad7;if(_0x3ea1cf[_0x6f84('0x30')][_0x6f84('0x42')]){_0x4681d0['include']=[{'all':!![]}];}return db['ChatMessage'][_0x6f84('0x43')](_0x4681d0);})[_0x6f84('0x29')](function(_0x353c0d){_0x387094[_0x6f84('0x44')]=_0x353c0d;return _0x387094;})[_0x6f84('0x29')](respondWithFilteredResult(_0x10436e,_0x4681d0))[_0x6f84('0x45')](handleError(_0x10436e,null));};exports[_0x6f84('0x46')]=function(_0x234603,_0x53df19){var _0x389a86={'raw':!![],'where':{'id':_0x234603['params']['id']}},_0x51949c={};_0x51949c[_0x6f84('0x2e')]=_[_0x6f84('0x2f')](db[_0x6f84('0x2c')][_0x6f84('0x2d')]);_0x51949c['query']=_[_0x6f84('0x2f')](_0x234603['query']);_0x51949c[_0x6f84('0x3b')]=_[_0x6f84('0x33')](_0x51949c[_0x6f84('0x2e')],_0x51949c[_0x6f84('0x30')]);_0x389a86['attributes']=_[_0x6f84('0x33')](_0x51949c[_0x6f84('0x2e')],qs[_0x6f84('0x35')](_0x234603[_0x6f84('0x30')][_0x6f84('0x35')]));_0x389a86[_0x6f84('0x34')]=_0x389a86[_0x6f84('0x34')][_0x6f84('0x36')]?_0x389a86['attributes']:_0x51949c[_0x6f84('0x2e')];if(_0x234603[_0x6f84('0x30')][_0x6f84('0x42')]){_0x389a86[_0x6f84('0x47')]=[{'all':!![]}];}_0x389a86=_[_0x6f84('0x3e')]({},_0x389a86,_0x234603['options']);return db[_0x6f84('0x2c')]['find'](_0x389a86)['then'](handleEntityNotFound(_0x53df19,null))[_0x6f84('0x29')](respondWithResult(_0x53df19,null))[_0x6f84('0x45')](handleError(_0x53df19,null));};exports[_0x6f84('0x48')]=function(_0xc6ae09,_0x40c641){return db[_0x6f84('0x2c')][_0x6f84('0x48')](_0xc6ae09[_0x6f84('0x49')],{})[_0x6f84('0x29')](respondWithResult(_0x40c641,0xc9))[_0x6f84('0x45')](handleError(_0x40c641,null));};exports[_0x6f84('0x28')]=function(_0x47ad75,_0x52bcff){if(_0x47ad75[_0x6f84('0x49')]['id']){delete _0x47ad75[_0x6f84('0x49')]['id'];}return db[_0x6f84('0x2c')][_0x6f84('0x4a')]({'where':{'id':_0x47ad75[_0x6f84('0x4b')]['id']}})[_0x6f84('0x29')](handleEntityNotFound(_0x52bcff,null))[_0x6f84('0x29')](saveUpdates(_0x47ad75[_0x6f84('0x49')],null))['then'](respondWithResult(_0x52bcff,null))[_0x6f84('0x45')](handleError(_0x52bcff,null));};exports[_0x6f84('0x4c')]=function(_0x3d5c4c,_0x2f4beb){return db[_0x6f84('0x2c')][_0x6f84('0x4a')]({'where':{'id':_0x3d5c4c['params']['id']}})[_0x6f84('0x29')](handleEntityNotFound(_0x2f4beb,null))[_0x6f84('0x29')](removeEntity(_0x2f4beb,null))['catch'](handleError(_0x2f4beb,null));};exports['describe']=function(_0xab0277,_0x4a20a4){return db[_0x6f84('0x2c')]['describe']()['then'](respondWithResult(_0x4a20a4,null))[_0x6f84('0x45')](handleError(_0x4a20a4,null));};var interaction_log=require(_0x6f84('0x4d'))(_0x6f84('0x4e'));exports[_0x6f84('0x4f')]=function(_0x205fb8,_0x2e8972,_0x580125){var _0x5c9312={'channel':_0x6f84('0x50')};if(_0x205fb8[_0x6f84('0x49')]['id']){delete _0x205fb8[_0x6f84('0x49')]['id'];}_0x205fb8[_0x6f84('0x49')]['read']=!![];_0x205fb8['body'][_0x6f84('0x51')]=moment()[_0x6f84('0x52')](_0x6f84('0x53'));_0x205fb8['body'][_0x6f84('0x54')]=_0x205fb8[_0x6f84('0x49')][_0x6f84('0x54')]||_0x205fb8[_0x6f84('0x55')]['id'];return db[_0x6f84('0x2c')][_0x6f84('0x4a')]({'where':{'id':_0x205fb8[_0x6f84('0x4b')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x6f84('0x56')}]})[_0x6f84('0x29')](handleEntityNotFound(_0x2e8972,null))[_0x6f84('0x29')](saveUpdates(_0x205fb8[_0x6f84('0x49')],null))['then'](function(_0x5129fd){if(_0x5129fd){_0x5c9312[_0x6f84('0x1b')]=_0x5129fd['get']({'plain':!![]});return db['ChatInteraction'][_0x6f84('0x4a')]({'where':{'id':_0x5129fd['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2e8972,null))[_0x6f84('0x29')](function(_0x4dbc2a){if(_0x4dbc2a){return _0x4dbc2a[_0x6f84('0x28')]({'UserId':_0x205fb8['body'][_0x6f84('0x54')],'read1stAt':_[_0x6f84('0x57')](_0x4dbc2a[_0x6f84('0x58')])?moment()[_0x6f84('0x52')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0xeeff0){if(_0xeeff0){_0x5c9312[_0x6f84('0x59')]=_0xeeff0['get']({'plain':!![]});interaction_log[_0x6f84('0x1c')](_0x6f84('0x5a'),_0x205fb8['user']['id'],_0x205fb8['user'][_0x6f84('0x2b')],_0x205fb8[_0x6f84('0x55')][_0x6f84('0x5b')],_0x5c9312[_0x6f84('0x59')]['id'],_0x205fb8[_0x6f84('0x49')]?JSON['stringify'](_0x205fb8[_0x6f84('0x49')]):_0x6f84('0x5c'));return respondWithRpcPromise(_0x6f84('0x5d'),'acceptMessage',_0x5c9312);}return null;})[_0x6f84('0x29')](function(_0x5f02bd){if(_0x5f02bd){if(_0x205fb8['body'][_0x6f84('0x5e')]){_0x5c9312[_0x6f84('0x1b')][_0x6f84('0x5f')]=util[_0x6f84('0x52')](_0x6f84('0x60'),_0x205fb8[_0x6f84('0x55')]['name']);_0x5c9312[_0x6f84('0x1b')][_0x6f84('0x61')]=_0x5c9312[_0x6f84('0x61')];_0x5c9312[_0x6f84('0x1b')]['event']='accept';return respondWithRpcPromise(_0x6f84('0x62'),'EventManager',{'event':_0x6f84('0x63'),'message':_[_0x6f84('0x3e')](_0x5c9312[_0x6f84('0x1b')],JSON[_0x6f84('0x64')](_0x5c9312[_0x6f84('0x59')]['formData']))},client9002)[_0x6f84('0x29')](function(){return _0x5c9312;});}return _0x5c9312;}return null;})[_0x6f84('0x29')](respondWithResult(_0x2e8972,null))['catch'](handleError(_0x2e8972,null));};var interaction_log=require(_0x6f84('0x4d'))(_0x6f84('0x4e'));exports[_0x6f84('0x26')]=function(_0x30f976,_0x90f043,_0x397824){var _0x42da76={'agent':{},'channel':'chat'};if(_0x30f976['body']['id']){delete _0x30f976['body']['id'];}_0x30f976[_0x6f84('0x49')][_0x6f84('0x54')]=_0x30f976['body'][_0x6f84('0x54')]||_0x30f976[_0x6f84('0x55')]['id'];_0x42da76[_0x6f84('0x65')]['id']=_0x30f976[_0x6f84('0x49')][_0x6f84('0x54')];return db[_0x6f84('0x2c')][_0x6f84('0x4a')]({'where':{'id':_0x30f976[_0x6f84('0x4b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x90f043,null))[_0x6f84('0x29')](function(_0x25ed55){if(_0x25ed55){_0x42da76[_0x6f84('0x1b')]=_0x25ed55[_0x6f84('0x66')]({'plain':!![]});return db['ChatInteraction'][_0x6f84('0x4a')]({'where':{'id':_0x25ed55[_0x6f84('0x67')]}});}return null;})[_0x6f84('0x29')](handleEntityNotFound(_0x90f043,null))[_0x6f84('0x29')](function(_0x47b8b1){if(_0x47b8b1){_0x42da76[_0x6f84('0x59')]=_0x47b8b1[_0x6f84('0x66')]({'plain':!![]});interaction_log[_0x6f84('0x1c')](_0x6f84('0x68'),_0x30f976['user']['id'],_0x30f976[_0x6f84('0x55')][_0x6f84('0x2b')],_0x30f976[_0x6f84('0x55')][_0x6f84('0x5b')],_0x42da76[_0x6f84('0x59')]['id'],_0x30f976[_0x6f84('0x49')]?JSON['stringify'](_0x30f976['body']):_0x6f84('0x5c'));return respondWithRpcPromise(_0x6f84('0x69'),_0x6f84('0x6a'),_0x42da76);}return null;})['then'](function(_0x115811){if(_0x115811){_0x115811[_0x6f84('0x1b')][_0x6f84('0x5f')]=util[_0x6f84('0x52')](_0x6f84('0x60'),_0x30f976[_0x6f84('0x55')][_0x6f84('0x2b')]);_0x115811['message']['channel']=_0x42da76[_0x6f84('0x61')];_0x115811[_0x6f84('0x1b')][_0x6f84('0x6b')]=_0x6f84('0x26');respondWithRpcPromise(_0x6f84('0x62'),_0x6f84('0x62'),{'event':_0x6f84('0x6c'),'message':_0x115811[_0x6f84('0x1b')]},client9002);return _0x42da76;}return null;})[_0x6f84('0x29')](respondWithResult(_0x90f043,null))[_0x6f84('0x45')](handleError(_0x90f043,null));}; \ No newline at end of file +var _0xc030=['UserId','user','CmContact','Contact','get','ChatInteractionId','isNil','read1stAt','interaction','info','role','null','AcceptMessage','acceptMessage','manual','channel','EventManager','acceptmessage','parse','formData','reject','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','event','fast-json-patch','moment','bluebird','util','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','./chatMessage.socket','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','apply','update','stack','name','send','index','model','keys','dateStart','query','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','add','day','filter','merge','map','ChatMessage','includeAll','include','findAll','show','params','rawAttributes','options','find','create','body','describe','chat-interactions','accept','chat','format'];(function(_0x166310,_0x49c9f4){var _0xd24eb8=function(_0x2b1aa8){while(--_0x2b1aa8){_0x166310['push'](_0x166310['shift']());}};_0xd24eb8(++_0x49c9f4);}(_0xc030,0x1e7));var _0x0c03=function(_0x12ac41,_0x416f99){_0x12ac41=_0x12ac41-0x0;var _0x41f4f2=_0xc030[_0x12ac41];return _0x41f4f2;};'use strict';var jsonpatch=require(_0x0c03('0x0'));var rp=require('request-promise');var moment=require(_0x0c03('0x1'));var BPromise=require(_0x0c03('0x2'));var Mustache=require('mustache');var util=require(_0x0c03('0x3'));var path=require(_0x0c03('0x4'));var sox=require(_0x0c03('0x5'));var csv=require(_0x0c03('0x6'));var ejs=require(_0x0c03('0x7'));var fs=require('fs');var _=require(_0x0c03('0x8'));var squel=require('squel');var crypto=require(_0x0c03('0x9'));var jsforce=require(_0x0c03('0xa'));var deskjs=require(_0x0c03('0xb'));var toCsv=require(_0x0c03('0x6'));var querystring=require(_0x0c03('0xc'));var Papa=require(_0x0c03('0xd'));var qs=require(_0x0c03('0xe'));var logger=require(_0x0c03('0xf'))(_0x0c03('0x10'));var utils=require(_0x0c03('0x11'));var config=require(_0x0c03('0x12'));var db=require(_0x0c03('0x13'))['db'];var socket=require(_0x0c03('0x14'))({'host':_0x0c03('0x15'),'port':0x18eb});require(_0x0c03('0x16'))['register'](socket);var jayson=require(_0x0c03('0x17'));var client=jayson[_0x0c03('0x18')][_0x0c03('0x19')]({'port':0x232c});var client9002=jayson['client'][_0x0c03('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x58af8c,_0xa8e03e,_0x120954,_0x590b2a){return new BPromise(function(_0x110980,_0x3310c3){var _0x756dbb=_0x590b2a||client;return _0x756dbb[_0x0c03('0x1a')](_0x58af8c,_0x120954)[_0x0c03('0x1b')](function(_0x2a73d6){logger['info'](_0x0c03('0x1c'),_0xa8e03e,_0x0c03('0x1d'));logger[_0x0c03('0x1e')](_0x0c03('0x1f'),_0xa8e03e,'request\x20sent',JSON[_0x0c03('0x20')](_0x2a73d6));if(_0x2a73d6[_0x0c03('0x21')]){if(_0x2a73d6[_0x0c03('0x21')][_0x0c03('0x22')]===0x1f4){logger[_0x0c03('0x21')]('ChatMessage,\x20%s,\x20%s',_0xa8e03e,_0x2a73d6[_0x0c03('0x21')][_0x0c03('0x23')]);return _0x3310c3(_0x2a73d6[_0x0c03('0x21')][_0x0c03('0x23')]);}logger['error'](_0x0c03('0x1c'),_0xa8e03e,_0x2a73d6[_0x0c03('0x21')][_0x0c03('0x23')]);return _0x110980(_0x2a73d6[_0x0c03('0x21')]['message']);}else{logger['info'](_0x0c03('0x1c'),_0xa8e03e,_0x0c03('0x1d'));_0x110980(_0x2a73d6[_0x0c03('0x24')][_0x0c03('0x23')]);}})[_0x0c03('0x25')](function(_0x434022){logger[_0x0c03('0x21')](_0x0c03('0x1c'),_0xa8e03e,_0x434022);_0x3310c3(_0x434022);});});}function respondWithStatusCode(_0x435939,_0x288d28){_0x288d28=_0x288d28||0xcc;return function(_0x19d748){if(_0x19d748){return _0x435939[_0x0c03('0x26')](_0x288d28);}return _0x435939['status'](_0x288d28)[_0x0c03('0x27')]();};}function respondWithResult(_0xba824a,_0x32c447){_0x32c447=_0x32c447||0xc8;return function(_0x47e109){if(_0x47e109){return _0xba824a[_0x0c03('0x28')](_0x32c447)[_0x0c03('0x29')](_0x47e109);}};}function respondWithFilteredResult(_0x57436c,_0x2728a8){return function(_0x514b72){if(_0x514b72){var _0x541110=_0x514b72[_0x0c03('0x2a')],_0x50be45=_0x2728a8['offset'],_0x18eb95=_0x2728a8[_0x0c03('0x2b')]+_0x2728a8[_0x0c03('0x2c')],_0x2e6922;if(_0x18eb95>=_0x541110){_0x18eb95=_0x541110;_0x2e6922=0xc8;}else{_0x2e6922=0xce;}_0x57436c[_0x0c03('0x28')](_0x2e6922);return _0x57436c[_0x0c03('0x2d')]('Content-Range',_0x50be45+'-'+_0x18eb95+'/'+_0x541110)['json'](_0x514b72);}return null;};}function patchUpdates(_0x2702ff){return function(_0x32fa96){try{jsonpatch[_0x0c03('0x2e')](_0x32fa96,_0x2702ff,!![]);}catch(_0x360657){return BPromise['reject'](_0x360657);}return _0x32fa96['save']();};}function saveUpdates(_0xfb56ae,_0x403bba){return function(_0x2d955e){if(_0x2d955e){return _0x2d955e[_0x0c03('0x2f')](_0xfb56ae)[_0x0c03('0x1b')](function(_0x5ad526){return _0x5ad526;});}return null;};}function removeEntity(_0x279154,_0x21f482){return function(_0x35aa79){if(_0x35aa79){return _0x35aa79['destroy']()['then'](function(){_0x279154[_0x0c03('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8793ad,_0x2a68b1){return function(_0x48b729){if(!_0x48b729){_0x8793ad[_0x0c03('0x26')](0x194);}return _0x48b729;};}function handleError(_0x34464b,_0x29ff03){_0x29ff03=_0x29ff03||0x1f4;return function(_0x149030){logger[_0x0c03('0x21')](_0x149030[_0x0c03('0x30')]);if(_0x149030[_0x0c03('0x31')]){delete _0x149030[_0x0c03('0x31')];}_0x34464b['status'](_0x29ff03)[_0x0c03('0x32')](_0x149030);};}exports[_0x0c03('0x33')]=function(_0x5d9e85,_0x297382){var _0x3a2430={},_0x234f7b={},_0x4c9d65={'count':0x0,'rows':[]};var _0x245baf=db['ChatMessage']['rawAttributes'];_0x234f7b[_0x0c03('0x34')]=_[_0x0c03('0x35')](_0x245baf);var _0x211fa0={'dateStart':_0x5d9e85['query'][_0x0c03('0x36')],'dateEnd':_0x5d9e85[_0x0c03('0x37')]['dateEnd']};delete _0x5d9e85['query'][_0x0c03('0x36')];delete _0x5d9e85[_0x0c03('0x37')][_0x0c03('0x38')];_0x234f7b[_0x0c03('0x37')]=_[_0x0c03('0x35')](_0x5d9e85['query']);_0x234f7b['filters']=_[_0x0c03('0x39')](_0x234f7b[_0x0c03('0x34')],_0x234f7b[_0x0c03('0x37')]);_0x3a2430[_0x0c03('0x3a')]=_[_0x0c03('0x39')](_0x234f7b['model'],qs[_0x0c03('0x3b')](_0x5d9e85[_0x0c03('0x37')][_0x0c03('0x3b')]));_0x3a2430[_0x0c03('0x3a')]=_0x3a2430['attributes'][_0x0c03('0x3c')]?_0x3a2430[_0x0c03('0x3a')]:_0x234f7b[_0x0c03('0x34')];if(!_0x5d9e85['query'][_0x0c03('0x3d')](_0x0c03('0x3e'))){_0x3a2430[_0x0c03('0x2c')]=qs[_0x0c03('0x2c')](_0x5d9e85[_0x0c03('0x37')]['limit']);_0x3a2430[_0x0c03('0x2b')]=qs[_0x0c03('0x2b')](_0x5d9e85[_0x0c03('0x37')][_0x0c03('0x2b')]);}_0x3a2430['order']=qs[_0x0c03('0x3f')](_0x5d9e85[_0x0c03('0x37')][_0x0c03('0x3f')]);_0x3a2430[_0x0c03('0x40')]=qs[_0x0c03('0x41')](_[_0x0c03('0x42')](_0x5d9e85[_0x0c03('0x37')],_0x234f7b[_0x0c03('0x41')]));if(_0x211fa0[_0x0c03('0x36')]){if(_0x211fa0['dateEnd']){_0x211fa0['dateEnd']=moment(_0x211fa0[_0x0c03('0x38')])[_0x0c03('0x43')](0x1,_0x0c03('0x44'));}else{_0x211fa0[_0x0c03('0x38')]=moment(_0x211fa0[_0x0c03('0x36')])[_0x0c03('0x43')](0x1,_0x0c03('0x44'));}_['merge'](_0x3a2430[_0x0c03('0x40')],{'createdAt':{'$gte':_0x211fa0[_0x0c03('0x36')],'$lte':_0x211fa0[_0x0c03('0x38')]}});}if(_0x5d9e85[_0x0c03('0x37')][_0x0c03('0x45')]){_0x3a2430[_0x0c03('0x40')]=_[_0x0c03('0x46')](_0x3a2430[_0x0c03('0x40')],{'$or':_[_0x0c03('0x47')](_0x3a2430[_0x0c03('0x3a')],function(_0x4164b2){var _0x7d4d54={};_0x7d4d54[_0x4164b2]={'$like':'%'+_0x5d9e85[_0x0c03('0x37')]['filter']+'%'};return _0x7d4d54;})});}_0x3a2430=_[_0x0c03('0x46')]({},_0x3a2430,_0x5d9e85['options']);var _0x3a3ea2={'where':_0x3a2430[_0x0c03('0x40')]};return db[_0x0c03('0x48')][_0x0c03('0x2a')](_0x3a3ea2)[_0x0c03('0x1b')](function(_0x40617b){_0x4c9d65[_0x0c03('0x2a')]=_0x40617b;if(_0x5d9e85['query'][_0x0c03('0x49')]){_0x3a2430[_0x0c03('0x4a')]=[{'all':!![]}];}return db[_0x0c03('0x48')][_0x0c03('0x4b')](_0x3a2430);})[_0x0c03('0x1b')](function(_0x4a404a){_0x4c9d65['rows']=_0x4a404a;return _0x4c9d65;})[_0x0c03('0x1b')](respondWithFilteredResult(_0x297382,_0x3a2430))[_0x0c03('0x25')](handleError(_0x297382,null));};exports[_0x0c03('0x4c')]=function(_0x3f905d,_0x51036c){var _0xf7cd37={'raw':!![],'where':{'id':_0x3f905d[_0x0c03('0x4d')]['id']}},_0x5514c5={};_0x5514c5[_0x0c03('0x34')]=_[_0x0c03('0x35')](db[_0x0c03('0x48')][_0x0c03('0x4e')]);_0x5514c5[_0x0c03('0x37')]=_['keys'](_0x3f905d[_0x0c03('0x37')]);_0x5514c5[_0x0c03('0x41')]=_[_0x0c03('0x39')](_0x5514c5[_0x0c03('0x34')],_0x5514c5[_0x0c03('0x37')]);_0xf7cd37['attributes']=_[_0x0c03('0x39')](_0x5514c5[_0x0c03('0x34')],qs[_0x0c03('0x3b')](_0x3f905d[_0x0c03('0x37')][_0x0c03('0x3b')]));_0xf7cd37[_0x0c03('0x3a')]=_0xf7cd37[_0x0c03('0x3a')][_0x0c03('0x3c')]?_0xf7cd37[_0x0c03('0x3a')]:_0x5514c5[_0x0c03('0x34')];if(_0x3f905d[_0x0c03('0x37')][_0x0c03('0x49')]){_0xf7cd37[_0x0c03('0x4a')]=[{'all':!![]}];}_0xf7cd37=_['merge']({},_0xf7cd37,_0x3f905d[_0x0c03('0x4f')]);return db[_0x0c03('0x48')][_0x0c03('0x50')](_0xf7cd37)[_0x0c03('0x1b')](handleEntityNotFound(_0x51036c,null))[_0x0c03('0x1b')](respondWithResult(_0x51036c,null))[_0x0c03('0x25')](handleError(_0x51036c,null));};exports[_0x0c03('0x51')]=function(_0x3fb0b8,_0x12c246){return db['ChatMessage'][_0x0c03('0x51')](_0x3fb0b8[_0x0c03('0x52')],{})['then'](respondWithResult(_0x12c246,0xc9))[_0x0c03('0x25')](handleError(_0x12c246,null));};exports[_0x0c03('0x2f')]=function(_0x335de7,_0x50bc0a){if(_0x335de7['body']['id']){delete _0x335de7[_0x0c03('0x52')]['id'];}return db[_0x0c03('0x48')][_0x0c03('0x50')]({'where':{'id':_0x335de7['params']['id']}})['then'](handleEntityNotFound(_0x50bc0a,null))[_0x0c03('0x1b')](saveUpdates(_0x335de7[_0x0c03('0x52')],null))[_0x0c03('0x1b')](respondWithResult(_0x50bc0a,null))[_0x0c03('0x25')](handleError(_0x50bc0a,null));};exports['destroy']=function(_0xd18159,_0x415fed){return db['ChatMessage'][_0x0c03('0x50')]({'where':{'id':_0xd18159[_0x0c03('0x4d')]['id']}})[_0x0c03('0x1b')](handleEntityNotFound(_0x415fed,null))[_0x0c03('0x1b')](removeEntity(_0x415fed,null))[_0x0c03('0x25')](handleError(_0x415fed,null));};exports['describe']=function(_0x2cd067,_0x3ec8ed){return db[_0x0c03('0x48')][_0x0c03('0x53')]()[_0x0c03('0x1b')](respondWithResult(_0x3ec8ed,null))[_0x0c03('0x25')](handleError(_0x3ec8ed,null));};var interaction_log=require(_0x0c03('0xf'))(_0x0c03('0x54'));exports[_0x0c03('0x55')]=function(_0x484537,_0xdc951c,_0x2afb45){var _0x20d99d={'channel':_0x0c03('0x56')};if(_0x484537[_0x0c03('0x52')]['id']){delete _0x484537['body']['id'];}_0x484537[_0x0c03('0x52')]['read']=!![];_0x484537[_0x0c03('0x52')]['readAt']=moment()[_0x0c03('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x484537['body'][_0x0c03('0x58')]=_0x484537['body']['UserId']||_0x484537[_0x0c03('0x59')]['id'];return db[_0x0c03('0x48')][_0x0c03('0x50')]({'where':{'id':_0x484537[_0x0c03('0x4d')]['id'],'UserId':null},'include':[{'model':db[_0x0c03('0x5a')],'as':_0x0c03('0x5b')}]})['then'](handleEntityNotFound(_0xdc951c,null))[_0x0c03('0x1b')](saveUpdates(_0x484537['body'],null))[_0x0c03('0x1b')](function(_0x48e994){if(_0x48e994){_0x20d99d[_0x0c03('0x23')]=_0x48e994[_0x0c03('0x5c')]({'plain':!![]});return db['ChatInteraction'][_0x0c03('0x50')]({'where':{'id':_0x48e994[_0x0c03('0x5d')]}});}return null;})[_0x0c03('0x1b')](handleEntityNotFound(_0xdc951c,null))[_0x0c03('0x1b')](function(_0x38aa15){if(_0x38aa15){return _0x38aa15[_0x0c03('0x2f')]({'UserId':_0x484537[_0x0c03('0x52')][_0x0c03('0x58')],'read1stAt':_[_0x0c03('0x5e')](_0x38aa15[_0x0c03('0x5f')])?moment()[_0x0c03('0x57')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x3eea65){if(_0x3eea65){_0x20d99d[_0x0c03('0x60')]=_0x3eea65[_0x0c03('0x5c')]({'plain':!![]});interaction_log[_0x0c03('0x61')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x484537[_0x0c03('0x59')]['id'],_0x484537['user'][_0x0c03('0x31')],_0x484537['user'][_0x0c03('0x62')],_0x20d99d[_0x0c03('0x60')]['id'],_0x484537[_0x0c03('0x52')]?JSON[_0x0c03('0x20')](_0x484537[_0x0c03('0x52')]):_0x0c03('0x63'));return respondWithRpcPromise(_0x0c03('0x64'),_0x0c03('0x65'),_0x20d99d);}return null;})[_0x0c03('0x1b')](function(_0x1c0faf){if(_0x1c0faf){if(_0x484537[_0x0c03('0x52')][_0x0c03('0x66')]){_0x20d99d['message']['interface']=util['format']('SIP/%s',_0x484537['user'][_0x0c03('0x31')]);_0x20d99d[_0x0c03('0x23')][_0x0c03('0x67')]=_0x20d99d[_0x0c03('0x67')];_0x20d99d[_0x0c03('0x23')]['event']='accept';return respondWithRpcPromise('EventManager',_0x0c03('0x68'),{'event':_0x0c03('0x69'),'message':_['merge'](_0x20d99d[_0x0c03('0x23')],JSON[_0x0c03('0x6a')](_0x20d99d['interaction'][_0x0c03('0x6b')]))},client9002)[_0x0c03('0x1b')](function(){return _0x20d99d;});}return _0x20d99d;}return null;})['then'](respondWithResult(_0xdc951c,null))[_0x0c03('0x25')](handleError(_0xdc951c,null));};var interaction_log=require(_0x0c03('0xf'))(_0x0c03('0x54'));exports[_0x0c03('0x6c')]=function(_0x30ad35,_0x195ec8,_0xa9a927){var _0x3a8c0a={'agent':{},'channel':'chat'};if(_0x30ad35[_0x0c03('0x52')]['id']){delete _0x30ad35[_0x0c03('0x52')]['id'];}_0x30ad35['body'][_0x0c03('0x58')]=_0x30ad35['body'][_0x0c03('0x58')]||_0x30ad35[_0x0c03('0x59')]['id'];_0x3a8c0a[_0x0c03('0x6d')]['id']=_0x30ad35[_0x0c03('0x52')][_0x0c03('0x58')];return db['ChatMessage'][_0x0c03('0x50')]({'where':{'id':_0x30ad35[_0x0c03('0x4d')]['id'],'UserId':null}})[_0x0c03('0x1b')](handleEntityNotFound(_0x195ec8,null))['then'](function(_0x5d6a25){if(_0x5d6a25){_0x3a8c0a[_0x0c03('0x23')]=_0x5d6a25[_0x0c03('0x5c')]({'plain':!![]});return db['ChatInteraction'][_0x0c03('0x50')]({'where':{'id':_0x5d6a25[_0x0c03('0x5d')]}});}return null;})[_0x0c03('0x1b')](handleEntityNotFound(_0x195ec8,null))[_0x0c03('0x1b')](function(_0x43d056){if(_0x43d056){_0x3a8c0a[_0x0c03('0x60')]=_0x43d056['get']({'plain':!![]});interaction_log['info'](_0x0c03('0x6e'),_0x30ad35[_0x0c03('0x59')]['id'],_0x30ad35[_0x0c03('0x59')]['name'],_0x30ad35[_0x0c03('0x59')]['role'],_0x3a8c0a['interaction']['id'],_0x30ad35[_0x0c03('0x52')]?JSON[_0x0c03('0x20')](_0x30ad35[_0x0c03('0x52')]):_0x0c03('0x63'));return respondWithRpcPromise(_0x0c03('0x6f'),_0x0c03('0x70'),_0x3a8c0a);}return null;})[_0x0c03('0x1b')](function(_0x2e7e72){if(_0x2e7e72){_0x2e7e72[_0x0c03('0x23')]['interface']=util['format'](_0x0c03('0x71'),_0x30ad35['user']['name']);_0x2e7e72[_0x0c03('0x23')]['channel']=_0x3a8c0a[_0x0c03('0x67')];_0x2e7e72[_0x0c03('0x23')][_0x0c03('0x72')]=_0x0c03('0x6c');respondWithRpcPromise(_0x0c03('0x68'),_0x0c03('0x68'),{'event':'rejectmessage','message':_0x2e7e72['message']},client9002);return _0x3a8c0a;}return null;})['then'](respondWithResult(_0x195ec8,null))['catch'](handleError(_0x195ec8,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 1146c70..69c7e6e 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 _0xbe23=['events','setMaxListeners','save','update','emit','exports'];(function(_0x1d8770,_0x1799c7){var _0x3f9f23=function(_0x1f5dad){while(--_0x1f5dad){_0x1d8770['push'](_0x1d8770['shift']());}};_0x3f9f23(++_0x1799c7);}(_0xbe23,0x1c2));var _0x3be2=function(_0x620fa6,_0x56789e){_0x620fa6=_0x620fa6-0x0;var _0x538a70=_0xbe23[_0x620fa6];return _0x538a70;};'use strict';var EventEmitter=require(_0x3be2('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x3be2('0x1')](0x0);var events={'afterCreate':_0x3be2('0x2'),'afterUpdate':_0x3be2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x24607a){return function(_0x3ae068,_0x181a8e,_0x30435c){ChatMessageEvents[_0x3be2('0x4')](_0x24607a+':'+_0x3ae068['id'],_0x3ae068);ChatMessageEvents[_0x3be2('0x4')](_0x24607a,_0x3ae068);_0x30435c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x3be2('0x5')]=ChatMessageEvents; \ No newline at end of file +var _0x13dd=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','remove','emit'];(function(_0x4052c0,_0x4271ab){var _0x296f04=function(_0x5373fc){while(--_0x5373fc){_0x4052c0['push'](_0x4052c0['shift']());}};_0x296f04(++_0x4271ab);}(_0x13dd,0x1a1));var _0xd13d=function(_0x62a56f,_0x4cedeb){_0x62a56f=_0x62a56f-0x0;var _0x156be0=_0x13dd[_0x62a56f];return _0x156be0;};'use strict';var EventEmitter=require(_0xd13d('0x0'));var ChatMessage=require(_0xd13d('0x1'))['db'][_0xd13d('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xd13d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd13d('0x4')};function emitEvent(_0x53d74d){return function(_0x13cb23,_0x1770bf,_0x75d2d1){ChatMessageEvents[_0xd13d('0x5')](_0x53d74d+':'+_0x13cb23['id'],_0x13cb23);ChatMessageEvents['emit'](_0x53d74d,_0x13cb23);_0x75d2d1(null);};}for(var e in events){if(events[_0xd13d('0x6')](e)){var event=events[e];ChatMessage[_0xd13d('0x7')](e,emitEvent(event));}}module[_0xd13d('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index b815ff4..88d3b5b 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 _0x56fe=['bluebird','./chatMessage.attributes','exports','ChatMessage','chat_messages','models','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','ChatInteractionId','then','update','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment'];(function(_0x470f3f,_0x336b96){var _0x5497bd=function(_0x133add){while(--_0x133add){_0x470f3f['push'](_0x470f3f['shift']());}};_0x5497bd(++_0x336b96);}(_0x56fe,0xe4));var _0xe56f=function(_0x209f89,_0x1b03c2){_0x209f89=_0x209f89-0x0;var _0x8b9c23=_0x56fe[_0x209f89];return _0x8b9c23;};'use strict';var _=require(_0xe56f('0x0'));var util=require(_0xe56f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe56f('0x2'));var BPromise=require(_0xe56f('0x3'));var rp=require('request-promise');var attributes=require(_0xe56f('0x4'));module[_0xe56f('0x5')]=function(_0x308e46,_0x1c41f6){return _0x308e46['define'](_0xe56f('0x6'),attributes,{'tableName':_0xe56f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e00bf,_0x575c9e,_0x1e093b){var _0x219537=_0x308e46[_0xe56f('0x8')];var _0x3f0afd=_0x2e00bf['get']({'plain':!![]});if(_0x3f0afd[_0xe56f('0x9')][_0xe56f('0xa')]()==='in'||_0x3f0afd[_0xe56f('0x9')][_0xe56f('0xa')]()==='out'&&!_0x3f0afd[_0xe56f('0xb')]&&!_[_0xe56f('0xc')](_0x3f0afd[_0xe56f('0xd')])){_0x219537[_0xe56f('0xe')]['findOne']({'where':{'id':_0x3f0afd[_0xe56f('0xf')]}})[_0xe56f('0x10')](function(_0x58f742){if(_0x58f742){_0x58f742[_0xe56f('0x11')]({'lastMsgAt':_0x3f0afd[_0xe56f('0x12')],'lastMsgDirection':_0x3f0afd['direction'][_0xe56f('0xa')](),'lastMsgBody':_0x3f0afd['body']});}})['catch'](function(_0x5aa3ef){console['error'](_0x5aa3ef);});}_0x1e093b();}},'charset':_0xe56f('0x13'),'collate':_0xe56f('0x14')});}; \ No newline at end of file +var _0x0bb4=['UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','exports','ChatMessage','chat_messages','models','get','direction','toLowerCase','out','secret','isNil'];(function(_0x2d093b,_0x460963){var _0x1abe4e=function(_0x3608b4){while(--_0x3608b4){_0x2d093b['push'](_0x2d093b['shift']());}};_0x1abe4e(++_0x460963);}(_0x0bb4,0x77));var _0x40bb=function(_0x671302,_0x8de53f){_0x671302=_0x671302-0x0;var _0x514ca2=_0x0bb4[_0x671302];return _0x514ca2;};'use strict';var _=require(_0x40bb('0x0'));var util=require(_0x40bb('0x1'));var logger=require('../../config/logger')(_0x40bb('0x2'));var moment=require(_0x40bb('0x3'));var BPromise=require(_0x40bb('0x4'));var rp=require(_0x40bb('0x5'));var attributes=require('./chatMessage.attributes');module[_0x40bb('0x6')]=function(_0x54fef0,_0x266cf4){return _0x54fef0['define'](_0x40bb('0x7'),attributes,{'tableName':_0x40bb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d15f6,_0x266c1e,_0x1243f4){var _0x50d70f=_0x54fef0[_0x40bb('0x9')];var _0x5d98d0=_0x4d15f6[_0x40bb('0xa')]({'plain':!![]});if(_0x5d98d0[_0x40bb('0xb')][_0x40bb('0xc')]()==='in'||_0x5d98d0[_0x40bb('0xb')][_0x40bb('0xc')]()===_0x40bb('0xd')&&!_0x5d98d0[_0x40bb('0xe')]&&!_[_0x40bb('0xf')](_0x5d98d0[_0x40bb('0x10')])){_0x50d70f[_0x40bb('0x11')][_0x40bb('0x12')]({'where':{'id':_0x5d98d0[_0x40bb('0x13')]}})[_0x40bb('0x14')](function(_0x344b09){if(_0x344b09){_0x344b09[_0x40bb('0x15')]({'lastMsgAt':_0x5d98d0[_0x40bb('0x16')],'lastMsgDirection':_0x5d98d0[_0x40bb('0xb')]['toLowerCase'](),'lastMsgBody':_0x5d98d0['body']});}})[_0x40bb('0x17')](function(_0x253932){console[_0x40bb('0x18')](_0x253932);});}_0x1243f4();}},'charset':_0x40bb('0x19'),'collate':_0x40bb('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 7cab29b..acc94d2 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 _0x1967=['./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','create','options','raw','CreateChatMessage','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','socket.io-emitter','localhost'];(function(_0x2a8509,_0x3c9b76){var _0x4c8567=function(_0x262800){while(--_0x262800){_0x2a8509['push'](_0x2a8509['shift']());}};_0x4c8567(++_0x3c9b76);}(_0x1967,0x173));var _0x7196=function(_0x402805,_0x1f5053){_0x402805=_0x402805-0x0;var _0x420a1b=_0x1967[_0x402805];return _0x420a1b;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var db=require(_0x7196('0x4'))['db'];var utils=require(_0x7196('0x5'));var logger=require(_0x7196('0x6'))(_0x7196('0x7'));var config=require(_0x7196('0x8'));var jayson=require(_0x7196('0x9'));var client=jayson['client'][_0x7196('0xa')]({'port':0x232a});var socket=require(_0x7196('0xb'))({'host':_0x7196('0xc'),'port':0x18eb});require(_0x7196('0xd'))[_0x7196('0xe')](socket);function respondWithRpcPromise(_0xad78a,_0x510c72,_0x218520){return new BPromise(function(_0xc6366f,_0x3f846e){return client[_0x7196('0xf')](_0xad78a,_0x218520)[_0x7196('0x10')](function(_0x503070){logger['info'](_0x7196('0x11'),_0x510c72,_0x7196('0x12'));logger[_0x7196('0x13')](_0x7196('0x14'),_0x510c72,_0x7196('0x12'),JSON[_0x7196('0x15')](_0x503070));if(_0x503070[_0x7196('0x16')]){if(_0x503070[_0x7196('0x16')][_0x7196('0x17')]===0x1f4){logger[_0x7196('0x16')](_0x7196('0x11'),_0x510c72,_0x503070['error'][_0x7196('0x18')]);return _0x3f846e(_0x503070[_0x7196('0x16')][_0x7196('0x18')]);}logger[_0x7196('0x16')]('ChatMessage,\x20%s,\x20%s',_0x510c72,_0x503070[_0x7196('0x16')]['message']);return _0xc6366f(_0x503070[_0x7196('0x16')][_0x7196('0x18')]);}else{logger[_0x7196('0x19')](_0x7196('0x11'),_0x510c72,_0x7196('0x12'));_0xc6366f(_0x503070[_0x7196('0x1a')][_0x7196('0x18')]);}})[_0x7196('0x1b')](function(_0x3e4e69){logger[_0x7196('0x16')](_0x7196('0x11'),_0x510c72,_0x3e4e69);_0x3f846e(_0x3e4e69);});});}exports['CreateChatMessage']=function(_0x4c4f91){var _0x448f13=this;return new Promise(function(_0x26b447,_0x40418d){return db['ChatMessage'][_0x7196('0x1c')](_0x4c4f91['body'],{'raw':_0x4c4f91['options']?_0x4c4f91[_0x7196('0x1d')][_0x7196('0x1e')]===undefined?!![]:![]:!![]})[_0x7196('0x10')](function(_0x4ddf78){logger['info'](_0x7196('0x1f'),_0x4c4f91);logger[_0x7196('0x13')]('CreateChatMessage',_0x4c4f91,JSON[_0x7196('0x15')](_0x4ddf78));_0x26b447(_0x4ddf78);})[_0x7196('0x1b')](function(_0x6e22e5){logger[_0x7196('0x16')](_0x7196('0x1f'),_0x6e22e5['message'],_0x4c4f91);_0x40418d(_0x448f13[_0x7196('0x16')](0x1f4,_0x6e22e5['message']));});});}; \ No newline at end of file +var _0xdb28=['error','code','message','ChatMessage,\x20%s,\x20%s','catch','CreateChatMessage','ChatMessage','create','options','raw','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','./chatMessage.socket','register','then','info','request\x20sent','debug','stringify'];(function(_0x13839f,_0x6cc6d){var _0x3e1f07=function(_0x53f61a){while(--_0x53f61a){_0x13839f['push'](_0x13839f['shift']());}};_0x3e1f07(++_0x6cc6d);}(_0xdb28,0x106));var _0x8db2=function(_0x4ada28,_0x31f782){_0x4ada28=_0x4ada28-0x0;var _0x3bac56=_0xdb28[_0x4ada28];return _0x3bac56;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x8db2('0x4'))['db'];var utils=require(_0x8db2('0x5'));var logger=require(_0x8db2('0x6'))(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8db2('0x9')][_0x8db2('0xa')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0x8db2('0xb'))[_0x8db2('0xc')](socket);function respondWithRpcPromise(_0x131537,_0x29f698,_0x2f3f2f){return new BPromise(function(_0x1ff362,_0x126c78){return client['request'](_0x131537,_0x2f3f2f)[_0x8db2('0xd')](function(_0x476216){logger[_0x8db2('0xe')]('ChatMessage,\x20%s,\x20%s',_0x29f698,_0x8db2('0xf'));logger[_0x8db2('0x10')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x29f698,_0x8db2('0xf'),JSON[_0x8db2('0x11')](_0x476216));if(_0x476216[_0x8db2('0x12')]){if(_0x476216[_0x8db2('0x12')][_0x8db2('0x13')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x29f698,_0x476216[_0x8db2('0x12')][_0x8db2('0x14')]);return _0x126c78(_0x476216[_0x8db2('0x12')][_0x8db2('0x14')]);}logger[_0x8db2('0x12')](_0x8db2('0x15'),_0x29f698,_0x476216[_0x8db2('0x12')][_0x8db2('0x14')]);return _0x1ff362(_0x476216[_0x8db2('0x12')][_0x8db2('0x14')]);}else{logger['info'](_0x8db2('0x15'),_0x29f698,_0x8db2('0xf'));_0x1ff362(_0x476216['result'][_0x8db2('0x14')]);}})[_0x8db2('0x16')](function(_0x21db8c){logger[_0x8db2('0x12')](_0x8db2('0x15'),_0x29f698,_0x21db8c);_0x126c78(_0x21db8c);});});}exports[_0x8db2('0x17')]=function(_0x51d60d){var _0x5df464=this;return new Promise(function(_0x77789,_0x104e33){return db[_0x8db2('0x18')][_0x8db2('0x19')](_0x51d60d['body'],{'raw':_0x51d60d[_0x8db2('0x1a')]?_0x51d60d[_0x8db2('0x1a')][_0x8db2('0x1b')]===undefined?!![]:![]:!![]})[_0x8db2('0xd')](function(_0x3dbe8e){logger['info'](_0x8db2('0x17'),_0x51d60d);logger[_0x8db2('0x10')](_0x8db2('0x17'),_0x51d60d,JSON[_0x8db2('0x11')](_0x3dbe8e));_0x77789(_0x3dbe8e);})[_0x8db2('0x16')](function(_0x21704c){logger[_0x8db2('0x12')]('CreateChatMessage',_0x21704c[_0x8db2('0x14')],_0x51d60d);_0x104e33(_0x5df464['error'](0x1f4,_0x21704c['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 5caf94f..8837f69 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 _0x3e74=['emit','removeListener','register','length','chatMessage:','./chatMessage.events','remove','update'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x3e74,0x175));var _0x43e7=function(_0x4e49b4,_0x19fce3){_0x4e49b4=_0x4e49b4-0x0;var _0x2a51a4=_0x3e74[_0x4e49b4];return _0x2a51a4;};'use strict';var ChatMessageEvents=require(_0x43e7('0x0'));var events=['save',_0x43e7('0x1'),_0x43e7('0x2')];function createListener(_0x151ad2,_0x494e45){return function(_0x490ced){_0x494e45[_0x43e7('0x3')](_0x151ad2,_0x490ced);};}function removeListener(_0x4f9bbe,_0x128b0f){return function(){ChatMessageEvents[_0x43e7('0x4')](_0x4f9bbe,_0x128b0f);};}exports[_0x43e7('0x5')]=function(_0x1c503b){for(var _0xc98b9c=0x0,_0x503698=events[_0x43e7('0x6')];_0xc98b9c<_0x503698;_0xc98b9c++){var _0x3491d6=events[_0xc98b9c];var _0x2ede2d=createListener(_0x43e7('0x7')+_0x3491d6,_0x1c503b);ChatMessageEvents['on'](_0x3491d6,_0x2ede2d);}}; \ No newline at end of file +var _0x9957=['register','length','chatMessage:','./chatMessage.events','save','remove','update','emit','removeListener'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var ChatMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){ChatMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);ChatMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 81c61f0..e5f30a9 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 _0x03d2=['update','accept','reject','delete','destroy','exports','path','express','../../config/environment','./chatMessage.controller','get','/describe','isAuthenticated','describe','show','post','chatmessage:create','create','put','/:id'];(function(_0x343561,_0x2ddcbc){var _0x18bda0=function(_0x393c4e){while(--_0x393c4e){_0x343561['push'](_0x343561['shift']());}};_0x18bda0(++_0x2ddcbc);}(_0x03d2,0x11e));var _0x203d=function(_0x4b163a,_0x209f4f){_0x4b163a=_0x4b163a-0x0;var _0x132d2b=_0x03d2[_0x4b163a];return _0x132d2b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x203d('0x0'));var express=require(_0x203d('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x203d('0x2'));var controller=require(_0x203d('0x3'));router[_0x203d('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0x203d('0x4')](_0x203d('0x5'),auth[_0x203d('0x6')](),controller[_0x203d('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x203d('0x8')]);router[_0x203d('0x9')]('/',auth[_0x203d('0x6')](),interaction['tracked']('chat',_0x203d('0xa')),controller[_0x203d('0xb')]);router[_0x203d('0xc')](_0x203d('0xd'),controller[_0x203d('0xe')]);router[_0x203d('0xc')]('/:id/accept',auth[_0x203d('0x6')](),controller[_0x203d('0xf')]);router[_0x203d('0xc')]('/:id/reject',auth[_0x203d('0x6')](),controller[_0x203d('0x10')]);router[_0x203d('0x11')](_0x203d('0xd'),auth['isAuthenticated'](),controller[_0x203d('0x12')]);module[_0x203d('0x13')]=router; \ No newline at end of file +var _0xfdc8=['show','post','tracked','chatmessage:create','put','accept','/:id/reject','reject','delete','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','get','/describe','/:id'];(function(_0x34c1dd,_0x4a4d34){var _0x477392=function(_0xc4cd1){while(--_0xc4cd1){_0x34c1dd['push'](_0x34c1dd['shift']());}};_0x477392(++_0x4a4d34);}(_0xfdc8,0x155));var _0x8fdc=function(_0xe4d6c6,_0x3bdbf2){_0xe4d6c6=_0xe4d6c6-0x0;var _0x3a8935=_0xfdc8[_0xe4d6c6];return _0x3a8935;};'use strict';var multer=require(_0x8fdc('0x0'));var util=require('util');var path=require('path');var express=require(_0x8fdc('0x1'));var router=express[_0x8fdc('0x2')]();var auth=require(_0x8fdc('0x3'));var interaction=require(_0x8fdc('0x4'));var config=require(_0x8fdc('0x5'));var controller=require(_0x8fdc('0x6'));router['get']('/',auth[_0x8fdc('0x7')](),controller['index']);router[_0x8fdc('0x8')](_0x8fdc('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x8fdc('0xa'),auth[_0x8fdc('0x7')](),controller[_0x8fdc('0xb')]);router[_0x8fdc('0xc')]('/',auth[_0x8fdc('0x7')](),interaction[_0x8fdc('0xd')]('chat',_0x8fdc('0xe')),controller['create']);router[_0x8fdc('0xf')]('/:id',controller['update']);router[_0x8fdc('0xf')]('/:id/accept',auth['isAuthenticated'](),controller[_0x8fdc('0x10')]);router[_0x8fdc('0xf')](_0x8fdc('0x11'),auth[_0x8fdc('0x7')](),controller[_0x8fdc('0x12')]);router[_0x8fdc('0x13')](_0x8fdc('0xa'),auth[_0x8fdc('0x7')](),controller[_0x8fdc('0x14')]);module[_0x8fdc('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index adc4b45..75ced00 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 _0xfed1=['sequelize','exports','medium'];(function(_0x30c7c5,_0x168208){var _0x29e24e=function(_0x427d3e){while(--_0x427d3e){_0x30c7c5['push'](_0x30c7c5['shift']());}};_0x29e24e(++_0x168208);}(_0xfed1,0xf0));var _0x1fed=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xfed1[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require(_0x1fed('0x0'));module[_0x1fed('0x1')]={'body':{'type':Sequelize['TEXT'](_0x1fed('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xaf1d=['sequelize','medium'];(function(_0xdc0eb2,_0x51d637){var _0x188a55=function(_0x54b543){while(--_0x54b543){_0xdc0eb2['push'](_0xdc0eb2['shift']());}};_0x188a55(++_0x51d637);}(_0xaf1d,0x116));var _0xdaf1=function(_0x12c41c,_0x4b0ddb){_0x12c41c=_0x12c41c-0x0;var _0xd2d041=_0xaf1d[_0x12c41c];return _0xd2d041;};'use strict';var Sequelize=require(_0xdaf1('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xdaf1('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 709c90f..1a0bae9 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 _0xc342=['offset','status','set','apply','reject','save','update','destroy','error','name','send','index','ChatOfflineMessage','model','query','dateStart','dateEnd','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','day','merge','map','options','count','then','includeAll','include','findAll','rows','show','rawAttributes','length','find','catch','create','body','params','describe','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end'];(function(_0x57a402,_0x40596b){var _0x753a36=function(_0x13b76b){while(--_0x13b76b){_0x57a402['push'](_0x57a402['shift']());}};_0x753a36(++_0x40596b);}(_0xc342,0x140));var _0x2c34=function(_0x4051be,_0x4e30dc){_0x4051be=_0x4051be-0x0;var _0x10d8e5=_0xc342[_0x4051be];return _0x10d8e5;};'use strict';var jsonpatch=require(_0x2c34('0x0'));var rp=require('request-promise');var moment=require(_0x2c34('0x1'));var BPromise=require(_0x2c34('0x2'));var Mustache=require(_0x2c34('0x3'));var util=require(_0x2c34('0x4'));var path=require(_0x2c34('0x5'));var sox=require('sox');var csv=require(_0x2c34('0x6'));var ejs=require(_0x2c34('0x7'));var fs=require('fs');var _=require(_0x2c34('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2c34('0x9'));var deskjs=require(_0x2c34('0xa'));var toCsv=require(_0x2c34('0x6'));var querystring=require(_0x2c34('0xb'));var Papa=require(_0x2c34('0xc'));var qs=require(_0x2c34('0xd'));var logger=require(_0x2c34('0xe'))(_0x2c34('0xf'));var utils=require(_0x2c34('0x10'));var config=require('../../config/environment');var db=require(_0x2c34('0x11'))['db'];function respondWithStatusCode(_0x3780fc,_0x337379){_0x337379=_0x337379||0xcc;return function(_0x15fde2){if(_0x15fde2){return _0x3780fc[_0x2c34('0x12')](_0x337379);}return _0x3780fc['status'](_0x337379)[_0x2c34('0x13')]();};}function respondWithResult(_0x2c17e4,_0x35f461){_0x35f461=_0x35f461||0xc8;return function(_0x14c3cd){if(_0x14c3cd){return _0x2c17e4['status'](_0x35f461)['json'](_0x14c3cd);}};}function respondWithFilteredResult(_0x3daee2,_0x552aaf){return function(_0x249332){if(_0x249332){var _0x21207c=_0x249332['count'],_0x31a653=_0x552aaf['offset'],_0x10a0f6=_0x552aaf[_0x2c34('0x14')]+_0x552aaf['limit'],_0x42e4dd;if(_0x10a0f6>=_0x21207c){_0x10a0f6=_0x21207c;_0x42e4dd=0xc8;}else{_0x42e4dd=0xce;}_0x3daee2[_0x2c34('0x15')](_0x42e4dd);return _0x3daee2[_0x2c34('0x16')]('Content-Range',_0x31a653+'-'+_0x10a0f6+'/'+_0x21207c)['json'](_0x249332);}return null;};}function patchUpdates(_0x95a1f){return function(_0x21caf7){try{jsonpatch[_0x2c34('0x17')](_0x21caf7,_0x95a1f,!![]);}catch(_0x46c2ff){return BPromise[_0x2c34('0x18')](_0x46c2ff);}return _0x21caf7[_0x2c34('0x19')]();};}function saveUpdates(_0x3d874c,_0x579412){return function(_0x16b8ae){if(_0x16b8ae){return _0x16b8ae[_0x2c34('0x1a')](_0x3d874c)['then'](function(_0x4ffc6b){return _0x4ffc6b;});}return null;};}function removeEntity(_0xae4858,_0x204c1a){return function(_0x5882eb){if(_0x5882eb){return _0x5882eb[_0x2c34('0x1b')]()['then'](function(){_0xae4858[_0x2c34('0x15')](0xcc)[_0x2c34('0x13')]();});}};}function handleEntityNotFound(_0x54c26c,_0x5cfe73){return function(_0x57d5cc){if(!_0x57d5cc){_0x54c26c[_0x2c34('0x12')](0x194);}return _0x57d5cc;};}function handleError(_0x4e1ba7,_0x1a302d){_0x1a302d=_0x1a302d||0x1f4;return function(_0x52cb8e){logger[_0x2c34('0x1c')](_0x52cb8e['stack']);if(_0x52cb8e['name']){delete _0x52cb8e[_0x2c34('0x1d')];}_0x4e1ba7['status'](_0x1a302d)[_0x2c34('0x1e')](_0x52cb8e);};}exports[_0x2c34('0x1f')]=function(_0x1e3c65,_0x3d933d){var _0x59baa4={},_0x30dc6f={},_0x502d61={'count':0x0,'rows':[]};var _0x1b1216=db[_0x2c34('0x20')]['rawAttributes'];_0x30dc6f[_0x2c34('0x21')]=_['keys'](_0x1b1216);var _0x5ad4e7={'dateStart':_0x1e3c65[_0x2c34('0x22')][_0x2c34('0x23')],'dateEnd':_0x1e3c65[_0x2c34('0x22')][_0x2c34('0x24')]};delete _0x1e3c65['query'][_0x2c34('0x23')];delete _0x1e3c65['query'][_0x2c34('0x24')];_0x30dc6f[_0x2c34('0x22')]=_[_0x2c34('0x25')](_0x1e3c65['query']);_0x30dc6f[_0x2c34('0x26')]=_[_0x2c34('0x27')](_0x30dc6f[_0x2c34('0x21')],_0x30dc6f[_0x2c34('0x22')]);_0x59baa4['attributes']=_[_0x2c34('0x27')](_0x30dc6f[_0x2c34('0x21')],qs[_0x2c34('0x28')](_0x1e3c65[_0x2c34('0x22')][_0x2c34('0x28')]));_0x59baa4[_0x2c34('0x29')]=_0x59baa4['attributes']['length']?_0x59baa4[_0x2c34('0x29')]:_0x30dc6f['model'];if(!_0x1e3c65[_0x2c34('0x22')][_0x2c34('0x2a')](_0x2c34('0x2b'))){_0x59baa4[_0x2c34('0x2c')]=qs[_0x2c34('0x2c')](_0x1e3c65[_0x2c34('0x22')][_0x2c34('0x2c')]);_0x59baa4[_0x2c34('0x14')]=qs[_0x2c34('0x14')](_0x1e3c65[_0x2c34('0x22')][_0x2c34('0x14')]);}_0x59baa4[_0x2c34('0x2d')]=qs[_0x2c34('0x2e')](_0x1e3c65[_0x2c34('0x22')][_0x2c34('0x2e')]);_0x59baa4[_0x2c34('0x2f')]=qs[_0x2c34('0x26')](_[_0x2c34('0x30')](_0x1e3c65[_0x2c34('0x22')],_0x30dc6f[_0x2c34('0x26')]));if(_0x5ad4e7[_0x2c34('0x23')]){if(_0x5ad4e7[_0x2c34('0x24')]){_0x5ad4e7[_0x2c34('0x24')]=moment(_0x5ad4e7[_0x2c34('0x24')])['add'](0x1,_0x2c34('0x31'));}else{_0x5ad4e7[_0x2c34('0x24')]=moment(_0x5ad4e7[_0x2c34('0x23')])['add'](0x1,'day');}_[_0x2c34('0x32')](_0x59baa4[_0x2c34('0x2f')],{'createdAt':{'$gte':_0x5ad4e7['dateStart'],'$lte':_0x5ad4e7[_0x2c34('0x24')]}});}if(_0x1e3c65[_0x2c34('0x22')]['filter']){_0x59baa4['where']=_['merge'](_0x59baa4[_0x2c34('0x2f')],{'$or':_[_0x2c34('0x33')](_0x59baa4['attributes'],function(_0x2cf4bc){var _0x4fca14={};_0x4fca14[_0x2cf4bc]={'$like':'%'+_0x1e3c65[_0x2c34('0x22')]['filter']+'%'};return _0x4fca14;})});}_0x59baa4=_['merge']({},_0x59baa4,_0x1e3c65[_0x2c34('0x34')]);var _0x3f76bb={'where':_0x59baa4['where']};return db[_0x2c34('0x20')][_0x2c34('0x35')](_0x3f76bb)[_0x2c34('0x36')](function(_0x175ee8){_0x502d61[_0x2c34('0x35')]=_0x175ee8;if(_0x1e3c65[_0x2c34('0x22')][_0x2c34('0x37')]){_0x59baa4[_0x2c34('0x38')]=[{'all':!![]}];}return db[_0x2c34('0x20')][_0x2c34('0x39')](_0x59baa4);})[_0x2c34('0x36')](function(_0x573a51){_0x502d61[_0x2c34('0x3a')]=_0x573a51;return _0x502d61;})['then'](respondWithFilteredResult(_0x3d933d,_0x59baa4))['catch'](handleError(_0x3d933d,null));};exports[_0x2c34('0x3b')]=function(_0x2e0615,_0x4a5223){var _0x9b8d24={'raw':!![],'where':{'id':_0x2e0615['params']['id']}},_0x3fa6de={};_0x3fa6de[_0x2c34('0x21')]=_[_0x2c34('0x25')](db['ChatOfflineMessage'][_0x2c34('0x3c')]);_0x3fa6de[_0x2c34('0x22')]=_[_0x2c34('0x25')](_0x2e0615[_0x2c34('0x22')]);_0x3fa6de['filters']=_[_0x2c34('0x27')](_0x3fa6de['model'],_0x3fa6de['query']);_0x9b8d24['attributes']=_['intersection'](_0x3fa6de[_0x2c34('0x21')],qs[_0x2c34('0x28')](_0x2e0615[_0x2c34('0x22')]['fields']));_0x9b8d24['attributes']=_0x9b8d24[_0x2c34('0x29')][_0x2c34('0x3d')]?_0x9b8d24[_0x2c34('0x29')]:_0x3fa6de['model'];if(_0x2e0615[_0x2c34('0x22')][_0x2c34('0x37')]){_0x9b8d24[_0x2c34('0x38')]=[{'all':!![]}];}_0x9b8d24=_[_0x2c34('0x32')]({},_0x9b8d24,_0x2e0615[_0x2c34('0x34')]);return db[_0x2c34('0x20')][_0x2c34('0x3e')](_0x9b8d24)[_0x2c34('0x36')](handleEntityNotFound(_0x4a5223,null))['then'](respondWithResult(_0x4a5223,null))[_0x2c34('0x3f')](handleError(_0x4a5223,null));};exports[_0x2c34('0x40')]=function(_0x28facc,_0x50523e){return db[_0x2c34('0x20')][_0x2c34('0x40')](_0x28facc[_0x2c34('0x41')],{})[_0x2c34('0x36')](respondWithResult(_0x50523e,0xc9))[_0x2c34('0x3f')](handleError(_0x50523e,null));};exports['update']=function(_0x28743f,_0x537b6){if(_0x28743f[_0x2c34('0x41')]['id']){delete _0x28743f[_0x2c34('0x41')]['id'];}return db[_0x2c34('0x20')]['find']({'where':{'id':_0x28743f['params']['id']}})[_0x2c34('0x36')](handleEntityNotFound(_0x537b6,null))[_0x2c34('0x36')](saveUpdates(_0x28743f[_0x2c34('0x41')],null))[_0x2c34('0x36')](respondWithResult(_0x537b6,null))['catch'](handleError(_0x537b6,null));};exports[_0x2c34('0x1b')]=function(_0x18182a,_0x131dac){return db[_0x2c34('0x20')][_0x2c34('0x3e')]({'where':{'id':_0x18182a[_0x2c34('0x42')]['id']}})[_0x2c34('0x36')](handleEntityNotFound(_0x131dac,null))[_0x2c34('0x36')](removeEntity(_0x131dac,null))[_0x2c34('0x3f')](handleError(_0x131dac,null));};exports[_0x2c34('0x43')]=function(_0x115331,_0x459299){return db[_0x2c34('0x20')][_0x2c34('0x43')]()[_0x2c34('0x36')](respondWithResult(_0x459299,null))['catch'](handleError(_0x459299,null));}; \ No newline at end of file +var _0x0b99=['crypto','jsforce','desk.js','querystring','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','reject','save','destroy','then','send','index','ChatOfflineMessage','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','add','day','filter','merge','map','options','includeAll','include','show','params','catch','create','body','find','describe','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0b99,0xf6));var _0x90b9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0b99[_0x14add3];return _0x4a174f;};'use strict';var jsonpatch=require(_0x90b9('0x0'));var rp=require(_0x90b9('0x1'));var moment=require(_0x90b9('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x90b9('0x3'));var util=require(_0x90b9('0x4'));var path=require(_0x90b9('0x5'));var sox=require(_0x90b9('0x6'));var csv=require(_0x90b9('0x7'));var ejs=require(_0x90b9('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x90b9('0x9'));var crypto=require(_0x90b9('0xa'));var jsforce=require(_0x90b9('0xb'));var deskjs=require(_0x90b9('0xc'));var toCsv=require(_0x90b9('0x7'));var querystring=require(_0x90b9('0xd'));var Papa=require('papaparse');var qs=require(_0x90b9('0xe'));var logger=require('../../config/logger')(_0x90b9('0xf'));var utils=require(_0x90b9('0x10'));var config=require(_0x90b9('0x11'));var db=require(_0x90b9('0x12'))['db'];function respondWithStatusCode(_0x3feeb2,_0x830034){_0x830034=_0x830034||0xcc;return function(_0x3f75c7){if(_0x3f75c7){return _0x3feeb2[_0x90b9('0x13')](_0x830034);}return _0x3feeb2[_0x90b9('0x14')](_0x830034)[_0x90b9('0x15')]();};}function respondWithResult(_0x1ae6d4,_0x3df897){_0x3df897=_0x3df897||0xc8;return function(_0x580da4){if(_0x580da4){return _0x1ae6d4[_0x90b9('0x14')](_0x3df897)[_0x90b9('0x16')](_0x580da4);}};}function respondWithFilteredResult(_0x240653,_0x3609db){return function(_0x85afa4){if(_0x85afa4){var _0x2f06b5=_0x85afa4[_0x90b9('0x17')],_0xffb41a=_0x3609db[_0x90b9('0x18')],_0x3b8d4b=_0x3609db[_0x90b9('0x18')]+_0x3609db['limit'],_0x2caa0b;if(_0x3b8d4b>=_0x2f06b5){_0x3b8d4b=_0x2f06b5;_0x2caa0b=0xc8;}else{_0x2caa0b=0xce;}_0x240653[_0x90b9('0x14')](_0x2caa0b);return _0x240653['set'](_0x90b9('0x19'),_0xffb41a+'-'+_0x3b8d4b+'/'+_0x2f06b5)[_0x90b9('0x16')](_0x85afa4);}return null;};}function patchUpdates(_0x1a051a){return function(_0x10d328){try{jsonpatch['apply'](_0x10d328,_0x1a051a,!![]);}catch(_0x51c3b5){return BPromise[_0x90b9('0x1a')](_0x51c3b5);}return _0x10d328[_0x90b9('0x1b')]();};}function saveUpdates(_0x49cb26,_0x2080ec){return function(_0x18a88d){if(_0x18a88d){return _0x18a88d['update'](_0x49cb26)['then'](function(_0x3c4734){return _0x3c4734;});}return null;};}function removeEntity(_0x29503f,_0xee8c19){return function(_0x33bafe){if(_0x33bafe){return _0x33bafe[_0x90b9('0x1c')]()[_0x90b9('0x1d')](function(){_0x29503f[_0x90b9('0x14')](0xcc)[_0x90b9('0x15')]();});}};}function handleEntityNotFound(_0x5e9864,_0xb26266){return function(_0x534c6a){if(!_0x534c6a){_0x5e9864[_0x90b9('0x13')](0x194);}return _0x534c6a;};}function handleError(_0x259bcc,_0x38ef04){_0x38ef04=_0x38ef04||0x1f4;return function(_0x5571d4){logger['error'](_0x5571d4['stack']);if(_0x5571d4['name']){delete _0x5571d4['name'];}_0x259bcc['status'](_0x38ef04)[_0x90b9('0x1e')](_0x5571d4);};}exports[_0x90b9('0x1f')]=function(_0x419040,_0x26c481){var _0x59b772={},_0x8eb42a={},_0x16ac96={'count':0x0,'rows':[]};var _0x141fb5=db[_0x90b9('0x20')][_0x90b9('0x21')];_0x8eb42a[_0x90b9('0x22')]=_[_0x90b9('0x23')](_0x141fb5);var _0x6fb210={'dateStart':_0x419040[_0x90b9('0x24')]['dateStart'],'dateEnd':_0x419040[_0x90b9('0x24')][_0x90b9('0x25')]};delete _0x419040[_0x90b9('0x24')][_0x90b9('0x26')];delete _0x419040['query'][_0x90b9('0x25')];_0x8eb42a['query']=_[_0x90b9('0x23')](_0x419040[_0x90b9('0x24')]);_0x8eb42a[_0x90b9('0x27')]=_[_0x90b9('0x28')](_0x8eb42a[_0x90b9('0x22')],_0x8eb42a[_0x90b9('0x24')]);_0x59b772[_0x90b9('0x29')]=_[_0x90b9('0x28')](_0x8eb42a[_0x90b9('0x22')],qs[_0x90b9('0x2a')](_0x419040['query'][_0x90b9('0x2a')]));_0x59b772[_0x90b9('0x29')]=_0x59b772[_0x90b9('0x29')][_0x90b9('0x2b')]?_0x59b772[_0x90b9('0x29')]:_0x8eb42a[_0x90b9('0x22')];if(!_0x419040[_0x90b9('0x24')][_0x90b9('0x2c')](_0x90b9('0x2d'))){_0x59b772['limit']=qs[_0x90b9('0x2e')](_0x419040['query'][_0x90b9('0x2e')]);_0x59b772[_0x90b9('0x18')]=qs['offset'](_0x419040[_0x90b9('0x24')][_0x90b9('0x18')]);}_0x59b772['order']=qs[_0x90b9('0x2f')](_0x419040['query']['sort']);_0x59b772[_0x90b9('0x30')]=qs[_0x90b9('0x27')](_['pick'](_0x419040[_0x90b9('0x24')],_0x8eb42a[_0x90b9('0x27')]));if(_0x6fb210[_0x90b9('0x26')]){if(_0x6fb210['dateEnd']){_0x6fb210[_0x90b9('0x25')]=moment(_0x6fb210['dateEnd'])[_0x90b9('0x31')](0x1,_0x90b9('0x32'));}else{_0x6fb210[_0x90b9('0x25')]=moment(_0x6fb210[_0x90b9('0x26')])['add'](0x1,'day');}_['merge'](_0x59b772['where'],{'createdAt':{'$gte':_0x6fb210[_0x90b9('0x26')],'$lte':_0x6fb210[_0x90b9('0x25')]}});}if(_0x419040[_0x90b9('0x24')][_0x90b9('0x33')]){_0x59b772[_0x90b9('0x30')]=_[_0x90b9('0x34')](_0x59b772['where'],{'$or':_[_0x90b9('0x35')](_0x59b772['attributes'],function(_0x26a133){var _0x2b0186={};_0x2b0186[_0x26a133]={'$like':'%'+_0x419040[_0x90b9('0x24')][_0x90b9('0x33')]+'%'};return _0x2b0186;})});}_0x59b772=_[_0x90b9('0x34')]({},_0x59b772,_0x419040[_0x90b9('0x36')]);var _0xc048e4={'where':_0x59b772[_0x90b9('0x30')]};return db[_0x90b9('0x20')]['count'](_0xc048e4)['then'](function(_0x14726d){_0x16ac96['count']=_0x14726d;if(_0x419040[_0x90b9('0x24')][_0x90b9('0x37')]){_0x59b772[_0x90b9('0x38')]=[{'all':!![]}];}return db['ChatOfflineMessage']['findAll'](_0x59b772);})[_0x90b9('0x1d')](function(_0x398f64){_0x16ac96['rows']=_0x398f64;return _0x16ac96;})['then'](respondWithFilteredResult(_0x26c481,_0x59b772))['catch'](handleError(_0x26c481,null));};exports[_0x90b9('0x39')]=function(_0x2990f4,_0x14f15c){var _0x24e240={'raw':!![],'where':{'id':_0x2990f4[_0x90b9('0x3a')]['id']}},_0x5836dc={};_0x5836dc['model']=_[_0x90b9('0x23')](db[_0x90b9('0x20')]['rawAttributes']);_0x5836dc[_0x90b9('0x24')]=_['keys'](_0x2990f4[_0x90b9('0x24')]);_0x5836dc['filters']=_['intersection'](_0x5836dc[_0x90b9('0x22')],_0x5836dc[_0x90b9('0x24')]);_0x24e240['attributes']=_[_0x90b9('0x28')](_0x5836dc[_0x90b9('0x22')],qs[_0x90b9('0x2a')](_0x2990f4[_0x90b9('0x24')]['fields']));_0x24e240['attributes']=_0x24e240[_0x90b9('0x29')][_0x90b9('0x2b')]?_0x24e240[_0x90b9('0x29')]:_0x5836dc[_0x90b9('0x22')];if(_0x2990f4[_0x90b9('0x24')][_0x90b9('0x37')]){_0x24e240[_0x90b9('0x38')]=[{'all':!![]}];}_0x24e240=_[_0x90b9('0x34')]({},_0x24e240,_0x2990f4['options']);return db[_0x90b9('0x20')]['find'](_0x24e240)['then'](handleEntityNotFound(_0x14f15c,null))[_0x90b9('0x1d')](respondWithResult(_0x14f15c,null))[_0x90b9('0x3b')](handleError(_0x14f15c,null));};exports['create']=function(_0x1c320d,_0x2a47da){return db[_0x90b9('0x20')][_0x90b9('0x3c')](_0x1c320d[_0x90b9('0x3d')],{})[_0x90b9('0x1d')](respondWithResult(_0x2a47da,0xc9))[_0x90b9('0x3b')](handleError(_0x2a47da,null));};exports['update']=function(_0x5e47d4,_0x28aee5){if(_0x5e47d4[_0x90b9('0x3d')]['id']){delete _0x5e47d4['body']['id'];}return db['ChatOfflineMessage']['find']({'where':{'id':_0x5e47d4[_0x90b9('0x3a')]['id']}})['then'](handleEntityNotFound(_0x28aee5,null))[_0x90b9('0x1d')](saveUpdates(_0x5e47d4['body'],null))[_0x90b9('0x1d')](respondWithResult(_0x28aee5,null))['catch'](handleError(_0x28aee5,null));};exports[_0x90b9('0x1c')]=function(_0x249462,_0x2e490c){return db[_0x90b9('0x20')][_0x90b9('0x3e')]({'where':{'id':_0x249462['params']['id']}})[_0x90b9('0x1d')](handleEntityNotFound(_0x2e490c,null))['then'](removeEntity(_0x2e490c,null))[_0x90b9('0x3b')](handleError(_0x2e490c,null));};exports[_0x90b9('0x3f')]=function(_0x5cecf5,_0x23c96a){return db[_0x90b9('0x20')]['describe']()[_0x90b9('0x1d')](respondWithResult(_0x23c96a,null))['catch'](handleError(_0x23c96a,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index ae41251..e5b9fdf 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 _0x364e=['utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x583af1,_0x2eb40a){var _0x8ea646=function(_0x300bb7){while(--_0x300bb7){_0x583af1['push'](_0x583af1['shift']());}};_0x8ea646(++_0x2eb40a);}(_0x364e,0x141));var _0xe364=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x364e[_0x543084];return _0x306a57;};'use strict';var _=require(_0xe364('0x0'));var util=require(_0xe364('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe364('0x2'));var rp=require(_0xe364('0x3'));var attributes=require(_0xe364('0x4'));module[_0xe364('0x5')]=function(_0x4e435b,_0x447b7c){return _0x4e435b[_0xe364('0x6')](_0xe364('0x7'),attributes,{'tableName':_0xe364('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe364('0x9')});}; \ No newline at end of file +var _0x25b8=['lodash','../../config/logger','moment','bluebird','request-promise','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x97501e,_0x48c8fd){var _0x5919c8=function(_0x4033bd){while(--_0x4033bd){_0x97501e['push'](_0x97501e['shift']());}};_0x5919c8(++_0x48c8fd);}(_0x25b8,0xc0));var _0x825b=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x25b8[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0x825b('0x0'));var util=require('util');var logger=require(_0x825b('0x1'))('api');var moment=require(_0x825b('0x2'));var BPromise=require(_0x825b('0x3'));var rp=require(_0x825b('0x4'));var attributes=require(_0x825b('0x5'));module[_0x825b('0x6')]=function(_0x5db670,_0x4bf512){return _0x5db670[_0x825b('0x7')](_0x825b('0x8'),attributes,{'tableName':_0x825b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x825b('0xa'),'collate':_0x825b('0xb')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 686121d..256a0f1 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 _0x8d41=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x182d07,_0x276b39){var _0x190b9c=function(_0x53f3ff){while(--_0x53f3ff){_0x182d07['push'](_0x182d07['shift']());}};_0x190b9c(++_0x276b39);}(_0x8d41,0x167));var _0x18d4=function(_0x49372d,_0x21e0bf){_0x49372d=_0x49372d-0x0;var _0x4cccf9=_0x8d41[_0x49372d];return _0x4cccf9;};'use strict';var _=require(_0x18d4('0x0'));var util=require(_0x18d4('0x1'));var moment=require(_0x18d4('0x2'));var BPromise=require(_0x18d4('0x3'));var rs=require(_0x18d4('0x4'));var fs=require('fs');var db=require(_0x18d4('0x5'))['db'];var utils=require(_0x18d4('0x6'));var logger=require('../../config/logger')(_0x18d4('0x7'));var config=require(_0x18d4('0x8'));var jayson=require(_0x18d4('0x9'));var client=jayson[_0x18d4('0xa')][_0x18d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d5381,_0x396f5c,_0x181e10){return new BPromise(function(_0x51539d,_0x2e1962){return client[_0x18d4('0xc')](_0x2d5381,_0x181e10)[_0x18d4('0xd')](function(_0x3dc017){logger[_0x18d4('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x396f5c,_0x18d4('0xf'));logger[_0x18d4('0x10')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x396f5c,_0x18d4('0xf'),JSON[_0x18d4('0x11')](_0x3dc017));if(_0x3dc017[_0x18d4('0x12')]){if(_0x3dc017['error'][_0x18d4('0x13')]===0x1f4){logger[_0x18d4('0x12')](_0x18d4('0x14'),_0x396f5c,_0x3dc017['error'][_0x18d4('0x15')]);return _0x2e1962(_0x3dc017['error']['message']);}logger[_0x18d4('0x12')](_0x18d4('0x14'),_0x396f5c,_0x3dc017[_0x18d4('0x12')][_0x18d4('0x15')]);return _0x51539d(_0x3dc017[_0x18d4('0x12')][_0x18d4('0x15')]);}else{logger['info'](_0x18d4('0x14'),_0x396f5c,_0x18d4('0xf'));_0x51539d(_0x3dc017[_0x18d4('0x16')][_0x18d4('0x15')]);}})[_0x18d4('0x17')](function(_0x5ac869){logger[_0x18d4('0x12')](_0x18d4('0x14'),_0x396f5c,_0x5ac869);_0x2e1962(_0x5ac869);});});} \ No newline at end of file +var _0x3a65=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util'];(function(_0x54e430,_0x2d71b9){var _0x12319c=function(_0x26a2f0){while(--_0x26a2f0){_0x54e430['push'](_0x54e430['shift']());}};_0x12319c(++_0x2d71b9);}(_0x3a65,0x124));var _0x53a6=function(_0x3cd560,_0x6d048){_0x3cd560=_0x3cd560-0x0;var _0x1154d4=_0x3a65[_0x3cd560];return _0x1154d4;};'use strict';var _=require(_0x53a6('0x0'));var util=require(_0x53a6('0x1'));var moment=require(_0x53a6('0x2'));var BPromise=require(_0x53a6('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x53a6('0x4'))['db'];var utils=require(_0x53a6('0x5'));var logger=require(_0x53a6('0x6'))(_0x53a6('0x7'));var config=require(_0x53a6('0x8'));var jayson=require(_0x53a6('0x9'));var client=jayson['client'][_0x53a6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1964eb,_0x5ed408,_0x575c96){return new BPromise(function(_0x396ec3,_0x4a9284){return client[_0x53a6('0xb')](_0x1964eb,_0x575c96)[_0x53a6('0xc')](function(_0x18458e){logger[_0x53a6('0xd')](_0x53a6('0xe'),_0x5ed408,'request\x20sent');logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x5ed408,_0x53a6('0xf'),JSON[_0x53a6('0x10')](_0x18458e));if(_0x18458e[_0x53a6('0x11')]){if(_0x18458e['error'][_0x53a6('0x12')]===0x1f4){logger[_0x53a6('0x11')](_0x53a6('0xe'),_0x5ed408,_0x18458e['error'][_0x53a6('0x13')]);return _0x4a9284(_0x18458e[_0x53a6('0x11')]['message']);}logger['error'](_0x53a6('0xe'),_0x5ed408,_0x18458e[_0x53a6('0x11')][_0x53a6('0x13')]);return _0x396ec3(_0x18458e[_0x53a6('0x11')]['message']);}else{logger[_0x53a6('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5ed408,_0x53a6('0xf'));_0x396ec3(_0x18458e[_0x53a6('0x14')][_0x53a6('0x13')]);}})['catch'](function(_0x465538){logger[_0x53a6('0x11')](_0x53a6('0xe'),_0x5ed408,_0x465538);_0x4a9284(_0x465538);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 8dcbf04..49696c4 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 _0x9120=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x9120,0x105));var _0x0912=function(_0x492532,_0x4c7a29){_0x492532=_0x492532-0x0;var _0x1832b0=_0x9120[_0x492532];return _0x1832b0;};'use strict';var multer=require(_0x0912('0x0'));var util=require('util');var path=require(_0x0912('0x1'));var express=require('express');var router=express[_0x0912('0x2')]();var auth=require(_0x0912('0x3'));var interaction=require(_0x0912('0x4'));var config=require(_0x0912('0x5'));var controller=require('./chatOfflineMessage.controller');router[_0x0912('0x6')]('/',auth[_0x0912('0x7')](),controller[_0x0912('0x8')]);router[_0x0912('0x6')](_0x0912('0x9'),auth[_0x0912('0x7')](),controller[_0x0912('0xa')]);router['get'](_0x0912('0xb'),auth[_0x0912('0x7')](),controller[_0x0912('0xc')]);router[_0x0912('0xd')]('/',auth['isAuthenticated'](),controller[_0x0912('0xe')]);router[_0x0912('0xf')]('/:id',auth[_0x0912('0x7')](),controller[_0x0912('0x10')]);router['delete'](_0x0912('0xb'),auth[_0x0912('0x7')](),controller[_0x0912('0x11')]);module[_0x0912('0x12')]=router; \ No newline at end of file +var _0x90e9=['util','path','Router','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/:id','post','create','put','update','destroy','exports','multer'];(function(_0x14758a,_0x10ac19){var _0x3f12e6=function(_0x2972a5){while(--_0x2972a5){_0x14758a['push'](_0x14758a['shift']());}};_0x3f12e6(++_0x10ac19);}(_0x90e9,0x10d));var _0x990e=function(_0x3e5b0a,_0x3fab42){_0x3e5b0a=_0x3e5b0a-0x0;var _0x2ee458=_0x90e9[_0x3e5b0a];return _0x2ee458;};'use strict';var multer=require(_0x990e('0x0'));var util=require(_0x990e('0x1'));var path=require(_0x990e('0x2'));var express=require('express');var router=express[_0x990e('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x990e('0x4'));var controller=require(_0x990e('0x5'));router[_0x990e('0x6')]('/',auth[_0x990e('0x7')](),controller['index']);router[_0x990e('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x990e('0x6')](_0x990e('0x8'),auth[_0x990e('0x7')](),controller['show']);router[_0x990e('0x9')]('/',auth['isAuthenticated'](),controller[_0x990e('0xa')]);router[_0x990e('0xb')](_0x990e('0x8'),auth[_0x990e('0x7')](),controller[_0x990e('0xc')]);router['delete'](_0x990e('0x8'),auth[_0x990e('0x7')](),controller[_0x990e('0xd')]);module[_0x990e('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 5e373ba..cd3f97b 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 _0x1c38=['mouseOver','INTEGER','exports','STRING','ENUM','timeout'];(function(_0xefc533,_0x508444){var _0x63cfb8=function(_0x2a28fe){while(--_0x2a28fe){_0xefc533['push'](_0xefc533['shift']());}};_0x63cfb8(++_0x508444);}(_0x1c38,0x188));var _0x81c3=function(_0x471a85,_0x239e8d){_0x471a85=_0x471a85-0x0;var _0x5f2039=_0x1c38[_0x471a85];return _0x5f2039;};'use strict';var Sequelize=require('sequelize');module[_0x81c3('0x0')]={'name':{'type':Sequelize[_0x81c3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x81c3('0x2')]('mouseOver',_0x81c3('0x3')),'defaultValue':_0x81c3('0x4')},'selector':{'type':Sequelize[_0x81c3('0x1')]},'timeout':{'type':Sequelize[_0x81c3('0x5')]}}; \ No newline at end of file +var _0x1635=['exports','mouseOver','timeout','STRING','sequelize'];(function(_0x514c08,_0x146538){var _0x17ed41=function(_0x5e6c6a){while(--_0x5e6c6a){_0x514c08['push'](_0x514c08['shift']());}};_0x17ed41(++_0x146538);}(_0x1635,0xea));var _0x5163=function(_0x3a9d4f,_0x90bdaf){_0x3a9d4f=_0x3a9d4f-0x0;var _0x8edeaf=_0x1635[_0x3a9d4f];return _0x8edeaf;};'use strict';var Sequelize=require(_0x5163('0x0'));module[_0x5163('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x5163('0x2'),_0x5163('0x3')),'defaultValue':_0x5163('0x2')},'selector':{'type':Sequelize[_0x5163('0x4')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 233059e..b36d395 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 _0x1c7b=['../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','update','then','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','query','intersection','attributes','length','includeAll','merge','options','find','catch','create','body','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils'];(function(_0xbd5c37,_0x28ca54){var _0x4f6bc9=function(_0x3ea779){while(--_0x3ea779){_0xbd5c37['push'](_0xbd5c37['shift']());}};_0x4f6bc9(++_0x28ca54);}(_0x1c7b,0x1ba));var _0xb1c7=function(_0x17ffac,_0x131aa5){_0x17ffac=_0x17ffac-0x0;var _0x9c54cf=_0x1c7b[_0x17ffac];return _0x9c54cf;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xb1c7('0x0'));var moment=require(_0xb1c7('0x1'));var BPromise=require(_0xb1c7('0x2'));var Mustache=require(_0xb1c7('0x3'));var util=require(_0xb1c7('0x4'));var path=require('path');var sox=require(_0xb1c7('0x5'));var csv=require(_0xb1c7('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb1c7('0x7'));var squel=require(_0xb1c7('0x8'));var crypto=require(_0xb1c7('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xb1c7('0xa'));var toCsv=require(_0xb1c7('0x6'));var querystring=require(_0xb1c7('0xb'));var Papa=require(_0xb1c7('0xc'));var qs=require(_0xb1c7('0xd'));var logger=require(_0xb1c7('0xe'))(_0xb1c7('0xf'));var utils=require(_0xb1c7('0x10'));var config=require(_0xb1c7('0x11'));var db=require(_0xb1c7('0x12'))['db'];function respondWithStatusCode(_0x5577b8,_0x7c3adf){_0x7c3adf=_0x7c3adf||0xcc;return function(_0x2d7f37){if(_0x2d7f37){return _0x5577b8[_0xb1c7('0x13')](_0x7c3adf);}return _0x5577b8[_0xb1c7('0x14')](_0x7c3adf)[_0xb1c7('0x15')]();};}function respondWithResult(_0x588ac9,_0x5263f4){_0x5263f4=_0x5263f4||0xc8;return function(_0x39a88d){if(_0x39a88d){return _0x588ac9[_0xb1c7('0x14')](_0x5263f4)[_0xb1c7('0x16')](_0x39a88d);}};}function respondWithFilteredResult(_0x2d5c4d,_0x5aca06){return function(_0x116a55){if(_0x116a55){var _0x143c0d=_0x116a55[_0xb1c7('0x17')],_0x22b3ed=_0x5aca06['offset'],_0xf2b9b0=_0x5aca06[_0xb1c7('0x18')]+_0x5aca06[_0xb1c7('0x19')],_0x10e6ff;if(_0xf2b9b0>=_0x143c0d){_0xf2b9b0=_0x143c0d;_0x10e6ff=0xc8;}else{_0x10e6ff=0xce;}_0x2d5c4d[_0xb1c7('0x14')](_0x10e6ff);return _0x2d5c4d['set'](_0xb1c7('0x1a'),_0x22b3ed+'-'+_0xf2b9b0+'/'+_0x143c0d)[_0xb1c7('0x16')](_0x116a55);}return null;};}function patchUpdates(_0x9893c2){return function(_0x5dafbe){try{jsonpatch[_0xb1c7('0x1b')](_0x5dafbe,_0x9893c2,!![]);}catch(_0x4e8a0e){return BPromise['reject'](_0x4e8a0e);}return _0x5dafbe['save']();};}function saveUpdates(_0x36de8a,_0x53e0fe){return function(_0x29ffad){if(_0x29ffad){return _0x29ffad[_0xb1c7('0x1c')](_0x36de8a)[_0xb1c7('0x1d')](function(_0x2d2e2b){return _0x2d2e2b;});}return null;};}function removeEntity(_0x365895,_0x3d3bad){return function(_0x4262ed){if(_0x4262ed){return _0x4262ed[_0xb1c7('0x1e')]()[_0xb1c7('0x1d')](function(){_0x365895[_0xb1c7('0x14')](0xcc)[_0xb1c7('0x15')]();});}};}function handleEntityNotFound(_0x55bc39,_0x2e61ff){return function(_0x5c717a){if(!_0x5c717a){_0x55bc39[_0xb1c7('0x13')](0x194);}return _0x5c717a;};}function handleError(_0x3c0764,_0x2b9c15){_0x2b9c15=_0x2b9c15||0x1f4;return function(_0x29151b){logger[_0xb1c7('0x1f')](_0x29151b[_0xb1c7('0x20')]);if(_0x29151b[_0xb1c7('0x21')]){delete _0x29151b[_0xb1c7('0x21')];}_0x3c0764['status'](_0x2b9c15)[_0xb1c7('0x22')](_0x29151b);};}exports[_0xb1c7('0x23')]=function(_0x3bced6,_0x5bf3ad){var _0x2b2d06={'raw':!![],'where':{'id':_0x3bced6[_0xb1c7('0x24')]['id']}},_0x40f38={};_0x40f38[_0xb1c7('0x25')]=_[_0xb1c7('0x26')](db[_0xb1c7('0x27')]['rawAttributes']);_0x40f38[_0xb1c7('0x28')]=_[_0xb1c7('0x26')](_0x3bced6[_0xb1c7('0x28')]);_0x40f38['filters']=_[_0xb1c7('0x29')](_0x40f38[_0xb1c7('0x25')],_0x40f38['query']);_0x2b2d06['attributes']=_[_0xb1c7('0x29')](_0x40f38[_0xb1c7('0x25')],qs['fields'](_0x3bced6[_0xb1c7('0x28')]['fields']));_0x2b2d06['attributes']=_0x2b2d06[_0xb1c7('0x2a')][_0xb1c7('0x2b')]?_0x2b2d06[_0xb1c7('0x2a')]:_0x40f38[_0xb1c7('0x25')];if(_0x3bced6[_0xb1c7('0x28')][_0xb1c7('0x2c')]){_0x2b2d06['include']=[{'all':!![]}];}_0x2b2d06=_[_0xb1c7('0x2d')]({},_0x2b2d06,_0x3bced6[_0xb1c7('0x2e')]);return db['ChatProactiveAction'][_0xb1c7('0x2f')](_0x2b2d06)['then'](handleEntityNotFound(_0x5bf3ad,null))['then'](respondWithResult(_0x5bf3ad,null))[_0xb1c7('0x30')](handleError(_0x5bf3ad,null));};exports[_0xb1c7('0x31')]=function(_0x4eebba,_0x57d805){return db['ChatProactiveAction'][_0xb1c7('0x31')](_0x4eebba[_0xb1c7('0x32')],{})['then'](respondWithResult(_0x57d805,0xc9))[_0xb1c7('0x30')](handleError(_0x57d805,null));};exports['update']=function(_0x3d9b4d,_0x544034){if(_0x3d9b4d[_0xb1c7('0x32')]['id']){delete _0x3d9b4d['body']['id'];}return db['ChatProactiveAction'][_0xb1c7('0x2f')]({'where':{'id':_0x3d9b4d[_0xb1c7('0x24')]['id']}})[_0xb1c7('0x1d')](handleEntityNotFound(_0x544034,null))['then'](saveUpdates(_0x3d9b4d[_0xb1c7('0x32')],null))['then'](respondWithResult(_0x544034,null))['catch'](handleError(_0x544034,null));};exports[_0xb1c7('0x1e')]=function(_0x4c3e7f,_0x2517f2){return db[_0xb1c7('0x27')][_0xb1c7('0x2f')]({'where':{'id':_0x4c3e7f['params']['id']}})[_0xb1c7('0x1d')](handleEntityNotFound(_0x2517f2,null))[_0xb1c7('0x1d')](removeEntity(_0x2517f2,null))[_0xb1c7('0x30')](handleError(_0x2517f2,null));}; \ No newline at end of file +var _0x4b82=['update','then','sendStatus','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','catch','body','destroy','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','Content-Range','apply'];(function(_0x82a071,_0x252266){var _0x15dda9=function(_0x3f73b0){while(--_0x3f73b0){_0x82a071['push'](_0x82a071['shift']());}};_0x15dda9(++_0x252266);}(_0x4b82,0x8a));var _0x24b8=function(_0x465f17,_0x4bd683){_0x465f17=_0x465f17-0x0;var _0x38fb72=_0x4b82[_0x465f17];return _0x38fb72;};'use strict';var jsonpatch=require(_0x24b8('0x0'));var rp=require(_0x24b8('0x1'));var moment=require(_0x24b8('0x2'));var BPromise=require(_0x24b8('0x3'));var Mustache=require(_0x24b8('0x4'));var util=require(_0x24b8('0x5'));var path=require(_0x24b8('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x24b8('0x7'));var squel=require(_0x24b8('0x8'));var crypto=require(_0x24b8('0x9'));var jsforce=require(_0x24b8('0xa'));var deskjs=require(_0x24b8('0xb'));var toCsv=require(_0x24b8('0xc'));var querystring=require(_0x24b8('0xd'));var Papa=require(_0x24b8('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0x24b8('0xf'))(_0x24b8('0x10'));var utils=require(_0x24b8('0x11'));var config=require(_0x24b8('0x12'));var db=require(_0x24b8('0x13'))['db'];function respondWithStatusCode(_0x5f2013,_0x1ac2b2){_0x1ac2b2=_0x1ac2b2||0xcc;return function(_0x444298){if(_0x444298){return _0x5f2013['sendStatus'](_0x1ac2b2);}return _0x5f2013['status'](_0x1ac2b2)[_0x24b8('0x14')]();};}function respondWithResult(_0x3eee9e,_0x46fa16){_0x46fa16=_0x46fa16||0xc8;return function(_0x8cd653){if(_0x8cd653){return _0x3eee9e[_0x24b8('0x15')](_0x46fa16)[_0x24b8('0x16')](_0x8cd653);}};}function respondWithFilteredResult(_0x5ef4e1,_0x3418ba){return function(_0x1e99f4){if(_0x1e99f4){var _0x5cc046=_0x1e99f4['count'],_0xc34d49=_0x3418ba[_0x24b8('0x17')],_0x12bd02=_0x3418ba[_0x24b8('0x17')]+_0x3418ba[_0x24b8('0x18')],_0x582f22;if(_0x12bd02>=_0x5cc046){_0x12bd02=_0x5cc046;_0x582f22=0xc8;}else{_0x582f22=0xce;}_0x5ef4e1[_0x24b8('0x15')](_0x582f22);return _0x5ef4e1['set'](_0x24b8('0x19'),_0xc34d49+'-'+_0x12bd02+'/'+_0x5cc046)[_0x24b8('0x16')](_0x1e99f4);}return null;};}function patchUpdates(_0x3fd0c5){return function(_0x1751c6){try{jsonpatch[_0x24b8('0x1a')](_0x1751c6,_0x3fd0c5,!![]);}catch(_0x278d0a){return BPromise['reject'](_0x278d0a);}return _0x1751c6['save']();};}function saveUpdates(_0x42c906,_0x3047dd){return function(_0x545a0b){if(_0x545a0b){return _0x545a0b[_0x24b8('0x1b')](_0x42c906)[_0x24b8('0x1c')](function(_0x1ca074){return _0x1ca074;});}return null;};}function removeEntity(_0x4791bd,_0x4e4b63){return function(_0x4da7d2){if(_0x4da7d2){return _0x4da7d2['destroy']()[_0x24b8('0x1c')](function(){_0x4791bd['status'](0xcc)[_0x24b8('0x14')]();});}};}function handleEntityNotFound(_0x10260d,_0x10d95d){return function(_0x3be90d){if(!_0x3be90d){_0x10260d[_0x24b8('0x1d')](0x194);}return _0x3be90d;};}function handleError(_0x5bfe0a,_0x12e0a4){_0x12e0a4=_0x12e0a4||0x1f4;return function(_0x3b5e6b){logger[_0x24b8('0x1e')](_0x3b5e6b[_0x24b8('0x1f')]);if(_0x3b5e6b[_0x24b8('0x20')]){delete _0x3b5e6b[_0x24b8('0x20')];}_0x5bfe0a[_0x24b8('0x15')](_0x12e0a4)[_0x24b8('0x21')](_0x3b5e6b);};}exports[_0x24b8('0x22')]=function(_0x467884,_0x28bc8d){var _0x362556={'raw':!![],'where':{'id':_0x467884[_0x24b8('0x23')]['id']}},_0x190e34={};_0x190e34[_0x24b8('0x24')]=_[_0x24b8('0x25')](db[_0x24b8('0x26')][_0x24b8('0x27')]);_0x190e34[_0x24b8('0x28')]=_[_0x24b8('0x25')](_0x467884[_0x24b8('0x28')]);_0x190e34[_0x24b8('0x29')]=_[_0x24b8('0x2a')](_0x190e34['model'],_0x190e34[_0x24b8('0x28')]);_0x362556[_0x24b8('0x2b')]=_[_0x24b8('0x2a')](_0x190e34[_0x24b8('0x24')],qs['fields'](_0x467884[_0x24b8('0x28')][_0x24b8('0x2c')]));_0x362556['attributes']=_0x362556['attributes'][_0x24b8('0x2d')]?_0x362556[_0x24b8('0x2b')]:_0x190e34[_0x24b8('0x24')];if(_0x467884['query'][_0x24b8('0x2e')]){_0x362556[_0x24b8('0x2f')]=[{'all':!![]}];}_0x362556=_[_0x24b8('0x30')]({},_0x362556,_0x467884[_0x24b8('0x31')]);return db[_0x24b8('0x26')][_0x24b8('0x32')](_0x362556)[_0x24b8('0x1c')](handleEntityNotFound(_0x28bc8d,null))[_0x24b8('0x1c')](respondWithResult(_0x28bc8d,null))['catch'](handleError(_0x28bc8d,null));};exports[_0x24b8('0x33')]=function(_0x2e47c1,_0x82a775){return db['ChatProactiveAction'][_0x24b8('0x33')](_0x2e47c1['body'],{})[_0x24b8('0x1c')](respondWithResult(_0x82a775,0xc9))[_0x24b8('0x34')](handleError(_0x82a775,null));};exports[_0x24b8('0x1b')]=function(_0x1c021d,_0x29c608){if(_0x1c021d[_0x24b8('0x35')]['id']){delete _0x1c021d[_0x24b8('0x35')]['id'];}return db['ChatProactiveAction'][_0x24b8('0x32')]({'where':{'id':_0x1c021d['params']['id']}})[_0x24b8('0x1c')](handleEntityNotFound(_0x29c608,null))['then'](saveUpdates(_0x1c021d['body'],null))['then'](respondWithResult(_0x29c608,null))[_0x24b8('0x34')](handleError(_0x29c608,null));};exports[_0x24b8('0x36')]=function(_0x7b733e,_0x405c89){return db['ChatProactiveAction'][_0x24b8('0x32')]({'where':{'id':_0x7b733e[_0x24b8('0x23')]['id']}})[_0x24b8('0x1c')](handleEntityNotFound(_0x405c89,null))[_0x24b8('0x1c')](removeEntity(_0x405c89,null))[_0x24b8('0x34')](handleError(_0x405c89,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 9087afa..a5b770c 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 _0xda2d=['ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api','moment','bluebird','define'];(function(_0x1fd67f,_0x1a8c30){var _0x5804bd=function(_0x50839f){while(--_0x50839f){_0x1fd67f['push'](_0x1fd67f['shift']());}};_0x5804bd(++_0x1a8c30);}(_0xda2d,0x102));var _0xdda2=function(_0x1abdd6,_0x267768){_0x1abdd6=_0x1abdd6-0x0;var _0x3e08a9=_0xda2d[_0x1abdd6];return _0x3e08a9;};'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('./chatProactiveAction.attributes');module['exports']=function(_0x357e97,_0x319129){return _0x357e97[_0xdda2('0x5')](_0xdda2('0x6'),attributes,{'tableName':_0xdda2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b0e=['chat_proactive_actions','lodash','../../config/logger','moment','bluebird','request-promise','./chatProactiveAction.attributes','exports','define','ChatProactiveAction'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x0b0e,0x187));var _0xe0b0=function(_0x20f96d,_0x23e67f){_0x20f96d=_0x20f96d-0x0;var _0x9a7524=_0x0b0e[_0x20f96d];return _0x9a7524;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var logger=require(_0xe0b0('0x1'))('api');var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var rp=require(_0xe0b0('0x4'));var attributes=require(_0xe0b0('0x5'));module[_0xe0b0('0x6')]=function(_0x38a058,_0x399e67){return _0x38a058[_0xe0b0('0x7')](_0xe0b0('0x8'),attributes,{'tableName':_0xe0b0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 819371d..33c4114 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 _0xfca0=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x2a6bc,_0x761a07){var _0x288d3a=function(_0x3c52d8){while(--_0x3c52d8){_0x2a6bc['push'](_0x2a6bc['shift']());}};_0x288d3a(++_0x761a07);}(_0xfca0,0x171));var _0x0fca=function(_0x1a940d,_0x398c3a){_0x1a940d=_0x1a940d-0x0;var _0x29c5b9=_0xfca0[_0x1a940d];return _0x29c5b9;};'use strict';var _=require(_0x0fca('0x0'));var util=require(_0x0fca('0x1'));var moment=require(_0x0fca('0x2'));var BPromise=require(_0x0fca('0x3'));var rs=require(_0x0fca('0x4'));var fs=require('fs');var db=require(_0x0fca('0x5'))['db'];var utils=require(_0x0fca('0x6'));var logger=require(_0x0fca('0x7'))('rpc');var config=require(_0x0fca('0x8'));var jayson=require(_0x0fca('0x9'));var client=jayson[_0x0fca('0xa')][_0x0fca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7324a6,_0x706948,_0x2bba5e){return new BPromise(function(_0x2a9c4d,_0x230b4b){return client[_0x0fca('0xc')](_0x7324a6,_0x2bba5e)[_0x0fca('0xd')](function(_0x43e7aa){logger[_0x0fca('0xe')](_0x0fca('0xf'),_0x706948,'request\x20sent');logger['debug'](_0x0fca('0x10'),_0x706948,_0x0fca('0x11'),JSON['stringify'](_0x43e7aa));if(_0x43e7aa[_0x0fca('0x12')]){if(_0x43e7aa['error'][_0x0fca('0x13')]===0x1f4){logger[_0x0fca('0x12')](_0x0fca('0xf'),_0x706948,_0x43e7aa[_0x0fca('0x12')][_0x0fca('0x14')]);return _0x230b4b(_0x43e7aa['error'][_0x0fca('0x14')]);}logger[_0x0fca('0x12')](_0x0fca('0xf'),_0x706948,_0x43e7aa[_0x0fca('0x12')][_0x0fca('0x14')]);return _0x2a9c4d(_0x43e7aa[_0x0fca('0x12')][_0x0fca('0x14')]);}else{logger[_0x0fca('0xe')](_0x0fca('0xf'),_0x706948,_0x0fca('0x11'));_0x2a9c4d(_0x43e7aa[_0x0fca('0x15')][_0x0fca('0x14')]);}})[_0x0fca('0x16')](function(_0x1222ce){logger[_0x0fca('0x12')](_0x0fca('0xf'),_0x706948,_0x1222ce);_0x230b4b(_0x1222ce);});});} \ No newline at end of file +var _0x8d01=['code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error'];(function(_0x313ec0,_0x3743d0){var _0x433d69=function(_0x219690){while(--_0x219690){_0x313ec0['push'](_0x313ec0['shift']());}};_0x433d69(++_0x3743d0);}(_0x8d01,0x193));var _0x18d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d01[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x18d0('0x0'));var util=require(_0x18d0('0x1'));var moment=require('moment');var BPromise=require(_0x18d0('0x2'));var rs=require(_0x18d0('0x3'));var fs=require('fs');var db=require(_0x18d0('0x4'))['db'];var utils=require(_0x18d0('0x5'));var logger=require(_0x18d0('0x6'))(_0x18d0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x18d0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5211ca,_0x3de2d8,_0xc3671f){return new BPromise(function(_0x4156ab,_0x2095ce){return client[_0x18d0('0x9')](_0x5211ca,_0xc3671f)[_0x18d0('0xa')](function(_0x5951be){logger[_0x18d0('0xb')](_0x18d0('0xc'),_0x3de2d8,_0x18d0('0xd'));logger[_0x18d0('0xe')](_0x18d0('0xf'),_0x3de2d8,_0x18d0('0xd'),JSON['stringify'](_0x5951be));if(_0x5951be[_0x18d0('0x10')]){if(_0x5951be[_0x18d0('0x10')][_0x18d0('0x11')]===0x1f4){logger['error'](_0x18d0('0xc'),_0x3de2d8,_0x5951be['error']['message']);return _0x2095ce(_0x5951be[_0x18d0('0x10')][_0x18d0('0x12')]);}logger[_0x18d0('0x10')](_0x18d0('0xc'),_0x3de2d8,_0x5951be[_0x18d0('0x10')]['message']);return _0x4156ab(_0x5951be[_0x18d0('0x10')][_0x18d0('0x12')]);}else{logger['info'](_0x18d0('0xc'),_0x3de2d8,'request\x20sent');_0x4156ab(_0x5951be[_0x18d0('0x13')][_0x18d0('0x12')]);}})[_0x18d0('0x14')](function(_0x16e89d){logger[_0x18d0('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x3de2d8,_0x16e89d);_0x2095ce(_0x16e89d);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 66cb817..04235d5 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 _0x902e=['post','create','put','update','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show'];(function(_0xc7144d,_0x5c332c){var _0x3a4323=function(_0x588d92){while(--_0x588d92){_0xc7144d['push'](_0xc7144d['shift']());}};_0x3a4323(++_0x5c332c);}(_0x902e,0x126));var _0xe902=function(_0xe0b186,_0x3ae911){_0xe0b186=_0xe0b186-0x0;var _0x39a0c9=_0x902e[_0xe0b186];return _0x39a0c9;};'use strict';var multer=require(_0xe902('0x0'));var util=require(_0xe902('0x1'));var path=require(_0xe902('0x2'));var express=require(_0xe902('0x3'));var router=express['Router']();var auth=require(_0xe902('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe902('0x5'));var controller=require('./chatProactiveAction.controller');router[_0xe902('0x6')](_0xe902('0x7'),auth[_0xe902('0x8')](),controller[_0xe902('0x9')]);router[_0xe902('0xa')]('/',auth['isAuthenticated'](),controller[_0xe902('0xb')]);router[_0xe902('0xc')](_0xe902('0x7'),auth[_0xe902('0x8')](),controller[_0xe902('0xd')]);router['delete'](_0xe902('0x7'),auth[_0xe902('0x8')](),controller[_0xe902('0xe')]);module[_0xe902('0xf')]=router; \ No newline at end of file +var _0x694a=['put','/:id','update','delete','destroy','exports','multer','util','path','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','get','isAuthenticated','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x694a,0xd8));var _0xa694=function(_0x262bc8,_0x27f87d){_0x262bc8=_0x262bc8-0x0;var _0x2c7d40=_0x694a[_0x262bc8];return _0x2c7d40;};'use strict';var multer=require(_0xa694('0x0'));var util=require(_0xa694('0x1'));var path=require(_0xa694('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xa694('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa694('0x4'));var controller=require(_0xa694('0x5'));router[_0xa694('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xa694('0x7')](),controller[_0xa694('0x8')]);router[_0xa694('0x9')](_0xa694('0xa'),auth[_0xa694('0x7')](),controller[_0xa694('0xb')]);router[_0xa694('0xc')](_0xa694('0xa'),auth[_0xa694('0x7')](),controller[_0xa694('0xd')]);module[_0xa694('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 489610c..88352be 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 _0x6bc8=['INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x189deb,_0x190457){var _0xda48f1=function(_0x544138){while(--_0x544138){_0x189deb['push'](_0x189deb['shift']());}};_0xda48f1(++_0x190457);}(_0x6bc8,0x104));var _0x86bc=function(_0x58653d,_0x5535d2){_0x58653d=_0x58653d-0x0;var _0x3e05f2=_0x6bc8[_0x58653d];return _0x3e05f2;};'use strict';var Sequelize=require(_0x86bc('0x0'));module[_0x86bc('0x1')]={'name':{'type':Sequelize[_0x86bc('0x2')],'unique':_0x86bc('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x86bc('0x2')]},'timeout':{'type':Sequelize[_0x86bc('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x86bc('0x5'),_0x86bc('0x6'),_0x86bc('0x7'))}}; \ No newline at end of file +var _0xbd15=['rrmemory','beepall','exports','STRING','name','INTEGER'];(function(_0x10d0f0,_0x1eba3d){var _0x93e308=function(_0x388548){while(--_0x388548){_0x10d0f0['push'](_0x10d0f0['shift']());}};_0x93e308(++_0x1eba3d);}(_0xbd15,0x86));var _0x5bd1=function(_0x64b210,_0x301877){_0x64b210=_0x64b210-0x0;var _0x232a2b=_0xbd15[_0x64b210];return _0x232a2b;};'use strict';var Sequelize=require('sequelize');module[_0x5bd1('0x0')]={'name':{'type':Sequelize[_0x5bd1('0x1')],'unique':_0x5bd1('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5bd1('0x1')]},'timeout':{'type':Sequelize[_0x5bd1('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x5bd1('0x4'),_0x5bd1('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index d919838..cedf88e 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 _0x720e=['map','includeAll','include','catch','show','params','intersection','options','find','create','body','describe','getMembers','findOne','get','UserChatQueue','filter','User','findAndCountAll','agent','createdAt','rows','%s/%s','chatPause','updatedAt','Team','getTeams','findAll','ids','Agents','addAgents','penalty','addTeams','removeTeams','removeAgents','emit','userChatQueue:save','userChatQueue:remove','getAgents','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','api','../../config/utils','../../config/environment','socket.io-emitter','localhost','./chatQueue.socket','register','jayson/promise','client','request','then','request\x20sent','debug','stringify','error','ChatQueue,\x20%s,\x20%s','message','info','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','ChatQueue','rawAttributes','keys','query','dateStart','dateEnd','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x720e,0x1cb));var _0xe720=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x720e[_0x37bd26];return _0xe83dc4;};'use strict';var jsonpatch=require(_0xe720('0x0'));var rp=require(_0xe720('0x1'));var moment=require(_0xe720('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe720('0x3'));var path=require('path');var sox=require(_0xe720('0x4'));var csv=require(_0xe720('0x5'));var ejs=require(_0xe720('0x6'));var fs=require('fs');var _=require(_0xe720('0x7'));var squel=require(_0xe720('0x8'));var crypto=require(_0xe720('0x9'));var jsforce=require(_0xe720('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xe720('0x5'));var querystring=require(_0xe720('0xb'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xe720('0xc'));var utils=require(_0xe720('0xd'));var config=require(_0xe720('0xe'));var db=require('../../mysqldb')['db'];var socket=require(_0xe720('0xf'))({'host':_0xe720('0x10'),'port':0x18eb});require(_0xe720('0x11'))[_0xe720('0x12')](socket);var jayson=require(_0xe720('0x13'));var client=jayson[_0xe720('0x14')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d651f,_0x2dd7bc,_0x128830,_0x1a82cc){return new BPromise(function(_0xac0320,_0xea1a0a){var _0x42a109=_0x1a82cc||client;return _0x42a109[_0xe720('0x15')](_0x4d651f,_0x128830)[_0xe720('0x16')](function(_0x3b25e5){logger['info']('ChatQueue,\x20%s,\x20%s',_0x2dd7bc,_0xe720('0x17'));logger[_0xe720('0x18')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x2dd7bc,_0xe720('0x17'),JSON[_0xe720('0x19')](_0x3b25e5));if(_0x3b25e5['error']){if(_0x3b25e5[_0xe720('0x1a')]['code']===0x1f4){logger[_0xe720('0x1a')](_0xe720('0x1b'),_0x2dd7bc,_0x3b25e5['error'][_0xe720('0x1c')]);return _0xea1a0a(_0x3b25e5['error'][_0xe720('0x1c')]);}logger[_0xe720('0x1a')](_0xe720('0x1b'),_0x2dd7bc,_0x3b25e5['error'][_0xe720('0x1c')]);return _0xac0320(_0x3b25e5['error'][_0xe720('0x1c')]);}else{logger[_0xe720('0x1d')](_0xe720('0x1b'),_0x2dd7bc,'request\x20sent');_0xac0320(_0x3b25e5['result'][_0xe720('0x1c')]);}})['catch'](function(_0x305438){logger[_0xe720('0x1a')](_0xe720('0x1b'),_0x2dd7bc,_0x305438);_0xea1a0a(_0x305438);});});}function respondWithStatusCode(_0xaa596f,_0xdb9b6){_0xdb9b6=_0xdb9b6||0xcc;return function(_0x3c1420){if(_0x3c1420){return _0xaa596f['sendStatus'](_0xdb9b6);}return _0xaa596f[_0xe720('0x1e')](_0xdb9b6)[_0xe720('0x1f')]();};}function respondWithResult(_0x4309a5,_0x47b367){_0x47b367=_0x47b367||0xc8;return function(_0x210a27){if(_0x210a27){return _0x4309a5[_0xe720('0x1e')](_0x47b367)[_0xe720('0x20')](_0x210a27);}};}function respondWithFilteredResult(_0xb7dc74,_0x35803c){return function(_0x1bca96){if(_0x1bca96){var _0x2c38ea=_0x1bca96[_0xe720('0x21')],_0x45d9ec=_0x35803c[_0xe720('0x22')],_0x3c5125=_0x35803c['offset']+_0x35803c[_0xe720('0x23')],_0xa49196;if(_0x3c5125>=_0x2c38ea){_0x3c5125=_0x2c38ea;_0xa49196=0xc8;}else{_0xa49196=0xce;}_0xb7dc74[_0xe720('0x1e')](_0xa49196);return _0xb7dc74[_0xe720('0x24')](_0xe720('0x25'),_0x45d9ec+'-'+_0x3c5125+'/'+_0x2c38ea)['json'](_0x1bca96);}return null;};}function patchUpdates(_0x28b6e2){return function(_0x3e9611){try{jsonpatch[_0xe720('0x26')](_0x3e9611,_0x28b6e2,!![]);}catch(_0x1ca67d){return BPromise[_0xe720('0x27')](_0x1ca67d);}return _0x3e9611[_0xe720('0x28')]();};}function saveUpdates(_0x388421,_0x360ac3){return function(_0x58ff8a){if(_0x58ff8a){return _0x58ff8a[_0xe720('0x29')](_0x388421)[_0xe720('0x16')](function(_0x4b2054){return _0x4b2054;});}return null;};}function removeEntity(_0x5166dc,_0x42d668){return function(_0x113b12){if(_0x113b12){return _0x113b12[_0xe720('0x2a')]()['then'](function(){_0x5166dc['status'](0xcc)[_0xe720('0x1f')]();});}};}function handleEntityNotFound(_0x3a107e,_0x2eb0db){return function(_0x5b641a){if(!_0x5b641a){_0x3a107e['sendStatus'](0x194);}return _0x5b641a;};}function handleError(_0x40efd7,_0x300eb8){_0x300eb8=_0x300eb8||0x1f4;return function(_0x21ed87){logger[_0xe720('0x1a')](_0x21ed87[_0xe720('0x2b')]);if(_0x21ed87[_0xe720('0x2c')]){delete _0x21ed87[_0xe720('0x2c')];}_0x40efd7[_0xe720('0x1e')](_0x300eb8)[_0xe720('0x2d')](_0x21ed87);};}exports['index']=function(_0x4edba6,_0x43e06a){var _0x4945d3={},_0x390429={},_0x166b24={'count':0x0,'rows':[]};var _0x2c38c9=db[_0xe720('0x2e')][_0xe720('0x2f')];_0x390429['model']=_[_0xe720('0x30')](_0x2c38c9);var _0x556807={'dateStart':_0x4edba6[_0xe720('0x31')][_0xe720('0x32')],'dateEnd':_0x4edba6[_0xe720('0x31')]['dateEnd']};delete _0x4edba6['query'][_0xe720('0x32')];delete _0x4edba6[_0xe720('0x31')][_0xe720('0x33')];_0x390429[_0xe720('0x31')]=_[_0xe720('0x30')](_0x4edba6['query']);_0x390429[_0xe720('0x34')]=_['intersection'](_0x390429['model'],_0x390429[_0xe720('0x31')]);_0x4945d3[_0xe720('0x35')]=_['intersection'](_0x390429[_0xe720('0x36')],qs[_0xe720('0x37')](_0x4edba6[_0xe720('0x31')][_0xe720('0x37')]));_0x4945d3[_0xe720('0x35')]=_0x4945d3['attributes'][_0xe720('0x38')]?_0x4945d3[_0xe720('0x35')]:_0x390429[_0xe720('0x36')];if(!_0x4edba6[_0xe720('0x31')][_0xe720('0x39')](_0xe720('0x3a'))){_0x4945d3[_0xe720('0x23')]=qs[_0xe720('0x23')](_0x4edba6[_0xe720('0x31')][_0xe720('0x23')]);_0x4945d3[_0xe720('0x22')]=qs[_0xe720('0x22')](_0x4edba6[_0xe720('0x31')][_0xe720('0x22')]);}_0x4945d3[_0xe720('0x3b')]=qs[_0xe720('0x3c')](_0x4edba6['query'][_0xe720('0x3c')]);_0x4945d3[_0xe720('0x3d')]=qs[_0xe720('0x34')](_[_0xe720('0x3e')](_0x4edba6[_0xe720('0x31')],_0x390429[_0xe720('0x34')]));if(_0x556807[_0xe720('0x32')]){if(_0x556807[_0xe720('0x33')]){_0x556807[_0xe720('0x33')]=moment(_0x556807[_0xe720('0x33')])[_0xe720('0x3f')](0x1,'day');}else{_0x556807['dateEnd']=moment(_0x556807[_0xe720('0x32')])[_0xe720('0x3f')](0x1,_0xe720('0x40'));}_['merge'](_0x4945d3[_0xe720('0x3d')],{'createdAt':{'$gte':_0x556807['dateStart'],'$lte':_0x556807[_0xe720('0x33')]}});}if(_0x4edba6[_0xe720('0x31')]['filter']){_0x4945d3[_0xe720('0x3d')]=_[_0xe720('0x41')](_0x4945d3['where'],{'$or':_[_0xe720('0x42')](_0x4945d3[_0xe720('0x35')],function(_0x22f331){var _0x19823d={};_0x19823d[_0x22f331]={'$like':'%'+_0x4edba6[_0xe720('0x31')]['filter']+'%'};return _0x19823d;})});}_0x4945d3=_[_0xe720('0x41')]({},_0x4945d3,_0x4edba6['options']);var _0x14f66d={'where':_0x4945d3[_0xe720('0x3d')]};return db[_0xe720('0x2e')][_0xe720('0x21')](_0x14f66d)['then'](function(_0x469590){_0x166b24[_0xe720('0x21')]=_0x469590;if(_0x4edba6[_0xe720('0x31')][_0xe720('0x43')]){_0x4945d3[_0xe720('0x44')]=[{'all':!![]}];}return db[_0xe720('0x2e')]['findAll'](_0x4945d3);})[_0xe720('0x16')](function(_0x127a92){_0x166b24['rows']=_0x127a92;return _0x166b24;})[_0xe720('0x16')](respondWithFilteredResult(_0x43e06a,_0x4945d3))[_0xe720('0x45')](handleError(_0x43e06a,null));};exports[_0xe720('0x46')]=function(_0x485739,_0x2ac7ab){var _0x17a395={'raw':!![],'where':{'id':_0x485739[_0xe720('0x47')]['id']}},_0x2278d5={};_0x2278d5[_0xe720('0x36')]=_['keys'](db[_0xe720('0x2e')]['rawAttributes']);_0x2278d5[_0xe720('0x31')]=_[_0xe720('0x30')](_0x485739['query']);_0x2278d5[_0xe720('0x34')]=_[_0xe720('0x48')](_0x2278d5[_0xe720('0x36')],_0x2278d5[_0xe720('0x31')]);_0x17a395[_0xe720('0x35')]=_[_0xe720('0x48')](_0x2278d5['model'],qs[_0xe720('0x37')](_0x485739['query'][_0xe720('0x37')]));_0x17a395['attributes']=_0x17a395[_0xe720('0x35')][_0xe720('0x38')]?_0x17a395[_0xe720('0x35')]:_0x2278d5['model'];if(_0x485739['query'][_0xe720('0x43')]){_0x17a395[_0xe720('0x44')]=[{'all':!![]}];}_0x17a395=_[_0xe720('0x41')]({},_0x17a395,_0x485739[_0xe720('0x49')]);return db[_0xe720('0x2e')][_0xe720('0x4a')](_0x17a395)[_0xe720('0x16')](handleEntityNotFound(_0x2ac7ab,null))[_0xe720('0x16')](respondWithResult(_0x2ac7ab,null))[_0xe720('0x45')](handleError(_0x2ac7ab,null));};exports['create']=function(_0x2acfb7,_0x32b21c){return db['ChatQueue'][_0xe720('0x4b')](_0x2acfb7[_0xe720('0x4c')],{})[_0xe720('0x16')](respondWithResult(_0x32b21c,0xc9))[_0xe720('0x45')](handleError(_0x32b21c,null));};exports[_0xe720('0x29')]=function(_0x567560,_0x191d9c){if(_0x567560['body']['id']){delete _0x567560[_0xe720('0x4c')]['id'];}return db[_0xe720('0x2e')]['find']({'where':{'id':_0x567560[_0xe720('0x47')]['id']}})[_0xe720('0x16')](handleEntityNotFound(_0x191d9c,null))[_0xe720('0x16')](saveUpdates(_0x567560[_0xe720('0x4c')],null))[_0xe720('0x16')](respondWithResult(_0x191d9c,null))[_0xe720('0x45')](handleError(_0x191d9c,null));};exports[_0xe720('0x2a')]=function(_0x4cddcb,_0x23bb98){return db[_0xe720('0x2e')][_0xe720('0x4a')]({'where':{'id':_0x4cddcb['params']['id']}})['then'](handleEntityNotFound(_0x23bb98,null))[_0xe720('0x16')](removeEntity(_0x23bb98,null))[_0xe720('0x45')](handleError(_0x23bb98,null));};exports[_0xe720('0x4d')]=function(_0x25ccee,_0x435161){return db[_0xe720('0x2e')][_0xe720('0x4d')]()[_0xe720('0x16')](respondWithResult(_0x435161,null))[_0xe720('0x45')](handleError(_0x435161,null));};exports[_0xe720('0x4e')]=function(_0x643c5c,_0x4b9f73,_0x18993b){var _0x21742a={'raw':!![],'where':{}},_0x3dd8c1={},_0x198ad1;return db[_0xe720('0x2e')][_0xe720('0x4f')]({'where':{'id':_0x643c5c['params']['id']}})[_0xe720('0x16')](handleEntityNotFound(_0x4b9f73,null))['then'](function(_0x20d1a1){if(_0x20d1a1){_0x198ad1=_0x20d1a1[_0xe720('0x50')]({'plain':!![]});_0x3dd8c1['model']=_['keys'](db[_0xe720('0x51')][_0xe720('0x2f')]);_0x3dd8c1[_0xe720('0x31')]=_[_0xe720('0x30')](_0x643c5c[_0xe720('0x31')]);_0x3dd8c1[_0xe720('0x34')]=_['intersection'](_0x3dd8c1[_0xe720('0x36')],_0x3dd8c1[_0xe720('0x31')]);_0x21742a[_0xe720('0x35')]=_[_0xe720('0x48')](_0x3dd8c1[_0xe720('0x36')],qs[_0xe720('0x37')](_0x643c5c[_0xe720('0x31')][_0xe720('0x37')]));_0x21742a[_0xe720('0x35')]=_0x21742a[_0xe720('0x35')]['length']?_0x21742a[_0xe720('0x35')]:_0x3dd8c1[_0xe720('0x36')];if(!_0x643c5c[_0xe720('0x31')][_0xe720('0x39')](_0xe720('0x3a'))){_0x21742a[_0xe720('0x23')]=qs[_0xe720('0x23')](_0x643c5c['query'][_0xe720('0x23')]);_0x21742a['offset']=qs[_0xe720('0x22')](_0x643c5c[_0xe720('0x31')][_0xe720('0x22')]);}_0x21742a['order']=qs[_0xe720('0x3c')](_0x643c5c[_0xe720('0x31')]['sort']);_0x21742a['where']=qs[_0xe720('0x34')](_[_0xe720('0x3e')](_0x643c5c[_0xe720('0x31')],_0x3dd8c1['filters']));_0x21742a['where']['ChatQueueId']=_0x20d1a1['id'];if(_0x643c5c[_0xe720('0x31')][_0xe720('0x52')]){_0x21742a['where']=_[_0xe720('0x41')](_0x21742a['where'],{'$or':_[_0xe720('0x42')](_0x21742a['attributes'],function(_0x2fab72){var _0x173ea8={};_0x173ea8[_0x2fab72]={'$like':'%'+_0x643c5c[_0xe720('0x31')][_0xe720('0x52')]+'%'};return _0x173ea8;})});}_0x21742a=_[_0xe720('0x41')]({},_0x21742a,_0x643c5c[_0xe720('0x49')]);return db['UserChatQueue']['findAll'](_0x21742a);}})[_0xe720('0x16')](function(_0x31a442){if(_0x31a442){return db[_0xe720('0x53')][_0xe720('0x54')]({'where':{'id':_['map'](_0x31a442,'UserId'),'role':_0xe720('0x55')},'attributes':['id',_0xe720('0x2c'),'chatPause','updatedAt',_0xe720('0x56')]});}})[_0xe720('0x16')](function(_0x146c91){if(_0x146c91){return{'count':_0x146c91[_0xe720('0x21')],'rows':_[_0xe720('0x42')](_0x146c91[_0xe720('0x57')],function(_0x51431b){return{'membername':_0x51431b[_0xe720('0x2c')],'UserId':_0x51431b['id'],'queue_name':_0x198ad1[_0xe720('0x2c')],'ChatQueueId':_0x198ad1['id'],'interface':util['format'](_0xe720('0x58'),'SIP',_0x51431b[_0xe720('0x2c')]),'penalty':0x0,'paused':_0x51431b[_0xe720('0x59')],'createdAt':_0x51431b[_0xe720('0x56')],'updatedAt':_0x51431b[_0xe720('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4b9f73,_0x21742a))[_0xe720('0x45')](handleError(_0x4b9f73,null));};exports['getTeams']=function(_0x1da890,_0xdf5385,_0x4e36b1){var _0x18dd4f={};var _0x2e3315={};var _0x43575e;var _0x3898db;return db[_0xe720('0x2e')][_0xe720('0x4f')]({'where':{'id':_0x1da890['params']['id']}})[_0xe720('0x16')](handleEntityNotFound(_0xdf5385,null))[_0xe720('0x16')](function(_0x1a899f){if(_0x1a899f){_0x43575e=_0x1a899f;_0x2e3315['model']=_[_0xe720('0x30')](db[_0xe720('0x5b')][_0xe720('0x2f')]);_0x2e3315[_0xe720('0x31')]=_[_0xe720('0x30')](_0x1da890[_0xe720('0x31')]);_0x2e3315[_0xe720('0x34')]=_[_0xe720('0x48')](_0x2e3315[_0xe720('0x36')],_0x2e3315[_0xe720('0x31')]);_0x18dd4f[_0xe720('0x35')]=_['intersection'](_0x2e3315[_0xe720('0x36')],qs[_0xe720('0x37')](_0x1da890[_0xe720('0x31')][_0xe720('0x37')]));_0x18dd4f['attributes']=_0x18dd4f[_0xe720('0x35')]['length']?_0x18dd4f['attributes']:_0x2e3315['model'];_0x18dd4f[_0xe720('0x3b')]=qs[_0xe720('0x3c')](_0x1da890[_0xe720('0x31')][_0xe720('0x3c')]);_0x18dd4f[_0xe720('0x3d')]=qs[_0xe720('0x34')](_[_0xe720('0x3e')](_0x1da890[_0xe720('0x31')],_0x2e3315['filters']));if(_0x1da890[_0xe720('0x31')][_0xe720('0x52')]){_0x18dd4f[_0xe720('0x3d')]=_['merge'](_0x18dd4f['where'],{'$or':_[_0xe720('0x42')](_0x18dd4f[_0xe720('0x35')],function(_0x3f4250){var _0x8a8b7={};_0x8a8b7[_0x3f4250]={'$like':'%'+_0x1da890[_0xe720('0x31')][_0xe720('0x52')]+'%'};return _0x8a8b7;})});}_0x18dd4f=_[_0xe720('0x41')]({},_0x18dd4f,_0x1da890[_0xe720('0x49')]);return _0x43575e[_0xe720('0x5c')](_0x18dd4f);}})[_0xe720('0x16')](function(_0x336f57){if(_0x336f57){_0x3898db=_0x336f57[_0xe720('0x38')];if(!_0x1da890[_0xe720('0x31')]['hasOwnProperty'](_0xe720('0x3a'))){_0x18dd4f[_0xe720('0x23')]=qs['limit'](_0x1da890[_0xe720('0x31')][_0xe720('0x23')]);_0x18dd4f['offset']=qs[_0xe720('0x22')](_0x1da890['query']['offset']);}return _0x43575e[_0xe720('0x5c')](_0x18dd4f);}})[_0xe720('0x16')](function(_0x3fea0e){if(_0x3fea0e){return _0x3fea0e?{'count':_0x3898db,'rows':_0x3fea0e}:null;}})[_0xe720('0x16')](respondWithResult(_0xdf5385,null))[_0xe720('0x45')](handleError(_0xdf5385,null));};exports['addTeams']=function(_0x242ace,_0x133527,_0x41d647){var _0x13883a=[];var _0x4c0d07;return db[_0xe720('0x5b')][_0xe720('0x5d')]({'where':{'id':_0x242ace['body'][_0xe720('0x5e')]},'attributes':['id'],'include':[{'model':db[_0xe720('0x53')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe720('0x16')](function(_0xc2c510){if(_0xc2c510){for(var _0x13956f=0x0;_0x13956f<_0xc2c510['length'];_0x13956f+=0x1){for(var _0x178d5c=0x0;_0x178d5c<_0xc2c510[_0x13956f][_0xe720('0x5f')][_0xe720('0x38')];_0x178d5c+=0x1){_0x13883a=_['union'](_0x13883a,[_0xc2c510[_0x13956f]['Agents'][_0x178d5c]['id']]);}}return _0x13883a;}})[_0xe720('0x16')](function(_0x2d0433){if(_0x2d0433){return db['ChatQueue'][_0xe720('0x4a')]({'where':{'id':_0x242ace[_0xe720('0x47')]['id']}});}})[_0xe720('0x16')](function(_0x6f584){if(_0x6f584){_0x4c0d07=_0x6f584;return _0x4c0d07[_0xe720('0x60')](_0x13883a,{'penalty':_0x242ace['body'][_0xe720('0x61')]});}})[_0xe720('0x16')](function(_0x22b462){if(_0x22b462){return _0x4c0d07[_0xe720('0x62')](_0x242ace[_0xe720('0x4c')]['ids']);}})[_0xe720('0x16')](handleEntityNotFound(_0x133527,null))[_0xe720('0x16')](respondWithStatusCode(_0x133527,null))[_0xe720('0x45')](handleError(_0x133527,null));};exports[_0xe720('0x63')]=function(_0x356a18,_0x4877ee,_0x59ff91){var _0xe2ef87=[];var _0x2cf17e;return db[_0xe720('0x5b')][_0xe720('0x5d')]({'where':{'id':_0x356a18['query'][_0xe720('0x5e')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe720('0x5f'),'attributes':['id'],'raw':!![]}]})[_0xe720('0x16')](function(_0xcc4e00){if(_0xcc4e00){for(var _0x1adbd2=0x0;_0x1adbd2<_0xcc4e00[_0xe720('0x38')];_0x1adbd2+=0x1){for(var _0x11fe7a=0x0;_0x11fe7a<_0xcc4e00[_0x1adbd2][_0xe720('0x5f')]['length'];_0x11fe7a+=0x1){_0xe2ef87=_['union'](_0xe2ef87,[_0xcc4e00[_0x1adbd2]['Agents'][_0x11fe7a]['id']]);}}return _0xe2ef87;}})[_0xe720('0x16')](function(_0x404c2a){if(_0x404c2a){return db[_0xe720('0x2e')]['find']({'where':{'id':_0x356a18[_0xe720('0x47')]['id']}});}})[_0xe720('0x16')](function(_0x131d24){if(_0x131d24){_0x2cf17e=_0x131d24;return _0x2cf17e[_0xe720('0x64')](_0xe2ef87);}})[_0xe720('0x16')](function(_0x495894){if(_0x2cf17e){return _0x2cf17e[_0xe720('0x63')](_0x356a18[_0xe720('0x31')][_0xe720('0x5e')]);}})[_0xe720('0x16')](handleEntityNotFound(_0x4877ee,null))['then'](respondWithStatusCode(_0x4877ee,null))[_0xe720('0x45')](handleError(_0x4877ee,null));};exports['addAgents']=function(_0x463904,_0x172485,_0x59ed89){return db['ChatQueue'][_0xe720('0x4a')]({'where':{'id':_0x463904['params']['id']}})['then'](handleEntityNotFound(_0x172485,null))[_0xe720('0x16')](function(_0x22c857){if(_0x22c857){return _0x22c857['addAgents'](_0x463904[_0xe720('0x4c')][_0xe720('0x5e')],_['omit'](_0x463904[_0xe720('0x4c')],['ids','id'])||{})['spread'](function(_0x1ef8c2){for(var _0xb00480=0x0;_0xb00480<_0x463904[_0xe720('0x4c')]['ids'][_0xe720('0x38')];_0xb00480+=0x1){socket[_0xe720('0x65')](_0xe720('0x66'),{'UserId':_0x463904['body'][_0xe720('0x5e')][_0xb00480],'ChatQueueId':_0x463904[_0xe720('0x47')]['id']});}return _0x1ef8c2;});}})[_0xe720('0x16')](respondWithResult(_0x172485,null))['catch'](handleError(_0x172485,null));};exports[_0xe720('0x64')]=function(_0x233ad6,_0x29792d,_0x1bd046){var _0x404030;return db['ChatQueue'][_0xe720('0x4a')]({'where':{'id':_0x233ad6[_0xe720('0x47')]['id']}})['then'](handleEntityNotFound(_0x29792d,null))[_0xe720('0x16')](function(_0x6e0c5d){if(_0x6e0c5d){return _0x6e0c5d['removeAgents'](_0x233ad6[_0xe720('0x31')][_0xe720('0x5e')])[_0xe720('0x16')](function(_0x638150){if(_['isArray'](_0x233ad6['query'][_0xe720('0x5e')])){for(var _0x239f8a=0x0;_0x239f8a<_0x233ad6[_0xe720('0x31')][_0xe720('0x5e')][_0xe720('0x38')];_0x239f8a+=0x1){socket[_0xe720('0x65')](_0xe720('0x67'),{'UserId':_0x233ad6[_0xe720('0x31')][_0xe720('0x5e')][_0x239f8a],'ChatQueueId':_0x233ad6[_0xe720('0x47')]['id']});}}else{socket[_0xe720('0x65')]('userChatQueue:remove',{'UserId':_0x233ad6[_0xe720('0x31')][_0xe720('0x5e')],'ChatQueueId':_0x233ad6[_0xe720('0x47')]['id']});}});}})[_0xe720('0x16')](respondWithStatusCode(_0x29792d,null))[_0xe720('0x45')](handleError(_0x29792d,null));};exports[_0xe720('0x68')]=function(_0x877133,_0x56a259,_0x4c0720){var _0x27a054={};var _0x345b5e={};var _0x1d60eb;var _0xfecdb3;return db['ChatQueue'][_0xe720('0x4f')]({'where':{'id':_0x877133['params']['id']}})[_0xe720('0x16')](handleEntityNotFound(_0x56a259,null))['then'](function(_0x1a99e2){if(_0x1a99e2){_0x1d60eb=_0x1a99e2;_0x345b5e[_0xe720('0x36')]=_[_0xe720('0x30')](db['User'][_0xe720('0x2f')]);_0x345b5e[_0xe720('0x31')]=_['keys'](_0x877133[_0xe720('0x31')]);_0x345b5e[_0xe720('0x34')]=_[_0xe720('0x48')](_0x345b5e['model'],_0x345b5e['query']);_0x27a054[_0xe720('0x35')]=_['intersection'](_0x345b5e[_0xe720('0x36')],qs[_0xe720('0x37')](_0x877133[_0xe720('0x31')][_0xe720('0x37')]));_0x27a054['attributes']=_0x27a054[_0xe720('0x35')][_0xe720('0x38')]?_0x27a054[_0xe720('0x35')]:_0x345b5e[_0xe720('0x36')];_0x27a054[_0xe720('0x3b')]=qs['sort'](_0x877133[_0xe720('0x31')][_0xe720('0x3c')]);_0x27a054[_0xe720('0x3d')]=qs[_0xe720('0x34')](_[_0xe720('0x3e')](_0x877133[_0xe720('0x31')],_0x345b5e[_0xe720('0x34')]));if(_0x877133[_0xe720('0x31')][_0xe720('0x52')]){_0x27a054[_0xe720('0x3d')]=_['merge'](_0x27a054[_0xe720('0x3d')],{'$or':_['map'](_0x27a054['attributes'],function(_0x20ab1a){var _0x2fee5e={};_0x2fee5e[_0x20ab1a]={'$like':'%'+_0x877133['query'][_0xe720('0x52')]+'%'};return _0x2fee5e;})});}_0x27a054=_['merge']({},_0x27a054,_0x877133[_0xe720('0x49')]);return _0x1d60eb[_0xe720('0x68')](_0x27a054);}})[_0xe720('0x16')](function(_0x15cfc7){if(_0x15cfc7){_0xfecdb3=_0x15cfc7[_0xe720('0x38')];if(!_0x877133[_0xe720('0x31')][_0xe720('0x39')](_0xe720('0x3a'))){_0x27a054[_0xe720('0x23')]=qs[_0xe720('0x23')](_0x877133[_0xe720('0x31')][_0xe720('0x23')]);_0x27a054['offset']=qs[_0xe720('0x22')](_0x877133[_0xe720('0x31')][_0xe720('0x22')]);}return _0x1d60eb[_0xe720('0x68')](_0x27a054);}})['then'](function(_0x3d3956){if(_0x3d3956){return _0x3d3956?{'count':_0xfecdb3,'rows':_0x3d3956}:null;}})[_0xe720('0x16')](respondWithResult(_0x56a259,null))['catch'](handleError(_0x56a259,null));}; \ No newline at end of file +var _0x58d6=['findAndCountAll','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','union','addAgents','penalty','removeAgents','removeTeams','omit','spread','emit','isArray','userChatQueue:remove','getAgents','request-promise','moment','mustache','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','socket.io-emitter','localhost','./chatQueue.socket','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','add','merge','filter','map','options','ChatQueue','includeAll','include','rows','show','params','create','body','find','describe','getMembers','findOne','get','UserChatQueue','nolimit','findAll','User'];(function(_0x35b0f5,_0x1393bc){var _0x22527a=function(_0x505251){while(--_0x505251){_0x35b0f5['push'](_0x35b0f5['shift']());}};_0x22527a(++_0x1393bc);}(_0x58d6,0x1d3));var _0x658d=function(_0x47031d,_0x35d7b1){_0x47031d=_0x47031d-0x0;var _0x47cf26=_0x58d6[_0x47031d];return _0x47cf26;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x658d('0x0'));var moment=require(_0x658d('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x658d('0x2'));var util=require('util');var path=require('path');var sox=require(_0x658d('0x3'));var csv=require(_0x658d('0x4'));var ejs=require(_0x658d('0x5'));var fs=require('fs');var _=require(_0x658d('0x6'));var squel=require('squel');var crypto=require(_0x658d('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x658d('0x8'));var toCsv=require(_0x658d('0x4'));var querystring=require(_0x658d('0x9'));var Papa=require('papaparse');var qs=require(_0x658d('0xa'));var logger=require(_0x658d('0xb'))(_0x658d('0xc'));var utils=require('../../config/utils');var config=require(_0x658d('0xd'));var db=require('../../mysqldb')['db'];var socket=require(_0x658d('0xe'))({'host':_0x658d('0xf'),'port':0x18eb});require(_0x658d('0x10'))['register'](socket);var jayson=require(_0x658d('0x11'));var client=jayson[_0x658d('0x12')][_0x658d('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x2a001c,_0xbfd392,_0x2a266b,_0x9efc8c){return new BPromise(function(_0x51295b,_0x2134dd){var _0x393077=_0x9efc8c||client;return _0x393077[_0x658d('0x14')](_0x2a001c,_0x2a266b)[_0x658d('0x15')](function(_0x43de3d){logger[_0x658d('0x16')](_0x658d('0x17'),_0xbfd392,_0x658d('0x18'));logger[_0x658d('0x19')](_0x658d('0x1a'),_0xbfd392,_0x658d('0x18'),JSON[_0x658d('0x1b')](_0x43de3d));if(_0x43de3d[_0x658d('0x1c')]){if(_0x43de3d['error'][_0x658d('0x1d')]===0x1f4){logger[_0x658d('0x1c')](_0x658d('0x17'),_0xbfd392,_0x43de3d[_0x658d('0x1c')][_0x658d('0x1e')]);return _0x2134dd(_0x43de3d[_0x658d('0x1c')][_0x658d('0x1e')]);}logger[_0x658d('0x1c')](_0x658d('0x17'),_0xbfd392,_0x43de3d['error']['message']);return _0x51295b(_0x43de3d[_0x658d('0x1c')][_0x658d('0x1e')]);}else{logger[_0x658d('0x16')](_0x658d('0x17'),_0xbfd392,_0x658d('0x18'));_0x51295b(_0x43de3d[_0x658d('0x1f')][_0x658d('0x1e')]);}})[_0x658d('0x20')](function(_0x3b4a1f){logger['error']('ChatQueue,\x20%s,\x20%s',_0xbfd392,_0x3b4a1f);_0x2134dd(_0x3b4a1f);});});}function respondWithStatusCode(_0x408996,_0x3ac068){_0x3ac068=_0x3ac068||0xcc;return function(_0x5bb5cc){if(_0x5bb5cc){return _0x408996[_0x658d('0x21')](_0x3ac068);}return _0x408996[_0x658d('0x22')](_0x3ac068)[_0x658d('0x23')]();};}function respondWithResult(_0x56dd20,_0x4f9418){_0x4f9418=_0x4f9418||0xc8;return function(_0x246acd){if(_0x246acd){return _0x56dd20[_0x658d('0x22')](_0x4f9418)['json'](_0x246acd);}};}function respondWithFilteredResult(_0x43b7c2,_0x41f238){return function(_0x5445b8){if(_0x5445b8){var _0x2088bd=_0x5445b8[_0x658d('0x24')],_0x17e5b8=_0x41f238[_0x658d('0x25')],_0x1e29b8=_0x41f238[_0x658d('0x25')]+_0x41f238[_0x658d('0x26')],_0x4a6a9c;if(_0x1e29b8>=_0x2088bd){_0x1e29b8=_0x2088bd;_0x4a6a9c=0xc8;}else{_0x4a6a9c=0xce;}_0x43b7c2[_0x658d('0x22')](_0x4a6a9c);return _0x43b7c2[_0x658d('0x27')](_0x658d('0x28'),_0x17e5b8+'-'+_0x1e29b8+'/'+_0x2088bd)[_0x658d('0x29')](_0x5445b8);}return null;};}function patchUpdates(_0x918588){return function(_0x27cccb){try{jsonpatch[_0x658d('0x2a')](_0x27cccb,_0x918588,!![]);}catch(_0x323042){return BPromise['reject'](_0x323042);}return _0x27cccb[_0x658d('0x2b')]();};}function saveUpdates(_0x29fb2e,_0x540303){return function(_0x11c191){if(_0x11c191){return _0x11c191[_0x658d('0x2c')](_0x29fb2e)[_0x658d('0x15')](function(_0x1e189b){return _0x1e189b;});}return null;};}function removeEntity(_0xc62d8,_0x9d8b62){return function(_0x30c33c){if(_0x30c33c){return _0x30c33c[_0x658d('0x2d')]()[_0x658d('0x15')](function(){_0xc62d8['status'](0xcc)[_0x658d('0x23')]();});}};}function handleEntityNotFound(_0x59baa7,_0x21c467){return function(_0x1d3a10){if(!_0x1d3a10){_0x59baa7[_0x658d('0x21')](0x194);}return _0x1d3a10;};}function handleError(_0x2565e,_0x452eb9){_0x452eb9=_0x452eb9||0x1f4;return function(_0x1b1874){logger[_0x658d('0x1c')](_0x1b1874[_0x658d('0x2e')]);if(_0x1b1874[_0x658d('0x2f')]){delete _0x1b1874[_0x658d('0x2f')];}_0x2565e[_0x658d('0x22')](_0x452eb9)[_0x658d('0x30')](_0x1b1874);};}exports[_0x658d('0x31')]=function(_0x1eb131,_0x1e56f8){var _0xab3f2d={},_0x53f2a5={},_0x5eb878={'count':0x0,'rows':[]};var _0x319871=db['ChatQueue'][_0x658d('0x32')];_0x53f2a5[_0x658d('0x33')]=_[_0x658d('0x34')](_0x319871);var _0x11bf24={'dateStart':_0x1eb131[_0x658d('0x35')][_0x658d('0x36')],'dateEnd':_0x1eb131[_0x658d('0x35')][_0x658d('0x37')]};delete _0x1eb131[_0x658d('0x35')]['dateStart'];delete _0x1eb131['query'][_0x658d('0x37')];_0x53f2a5[_0x658d('0x35')]=_[_0x658d('0x34')](_0x1eb131[_0x658d('0x35')]);_0x53f2a5[_0x658d('0x38')]=_[_0x658d('0x39')](_0x53f2a5[_0x658d('0x33')],_0x53f2a5[_0x658d('0x35')]);_0xab3f2d[_0x658d('0x3a')]=_[_0x658d('0x39')](_0x53f2a5[_0x658d('0x33')],qs['fields'](_0x1eb131[_0x658d('0x35')][_0x658d('0x3b')]));_0xab3f2d[_0x658d('0x3a')]=_0xab3f2d[_0x658d('0x3a')][_0x658d('0x3c')]?_0xab3f2d[_0x658d('0x3a')]:_0x53f2a5[_0x658d('0x33')];if(!_0x1eb131[_0x658d('0x35')][_0x658d('0x3d')]('nolimit')){_0xab3f2d[_0x658d('0x26')]=qs[_0x658d('0x26')](_0x1eb131[_0x658d('0x35')][_0x658d('0x26')]);_0xab3f2d[_0x658d('0x25')]=qs[_0x658d('0x25')](_0x1eb131[_0x658d('0x35')]['offset']);}_0xab3f2d[_0x658d('0x3e')]=qs[_0x658d('0x3f')](_0x1eb131[_0x658d('0x35')][_0x658d('0x3f')]);_0xab3f2d[_0x658d('0x40')]=qs['filters'](_[_0x658d('0x41')](_0x1eb131['query'],_0x53f2a5['filters']));if(_0x11bf24[_0x658d('0x36')]){if(_0x11bf24[_0x658d('0x37')]){_0x11bf24[_0x658d('0x37')]=moment(_0x11bf24['dateEnd'])[_0x658d('0x42')](0x1,'day');}else{_0x11bf24[_0x658d('0x37')]=moment(_0x11bf24[_0x658d('0x36')])[_0x658d('0x42')](0x1,'day');}_[_0x658d('0x43')](_0xab3f2d['where'],{'createdAt':{'$gte':_0x11bf24[_0x658d('0x36')],'$lte':_0x11bf24[_0x658d('0x37')]}});}if(_0x1eb131[_0x658d('0x35')][_0x658d('0x44')]){_0xab3f2d['where']=_[_0x658d('0x43')](_0xab3f2d['where'],{'$or':_[_0x658d('0x45')](_0xab3f2d[_0x658d('0x3a')],function(_0x4e4c72){var _0x4ff5fb={};_0x4ff5fb[_0x4e4c72]={'$like':'%'+_0x1eb131[_0x658d('0x35')][_0x658d('0x44')]+'%'};return _0x4ff5fb;})});}_0xab3f2d=_['merge']({},_0xab3f2d,_0x1eb131[_0x658d('0x46')]);var _0x2891b3={'where':_0xab3f2d[_0x658d('0x40')]};return db[_0x658d('0x47')]['count'](_0x2891b3)['then'](function(_0xd871be){_0x5eb878[_0x658d('0x24')]=_0xd871be;if(_0x1eb131[_0x658d('0x35')][_0x658d('0x48')]){_0xab3f2d[_0x658d('0x49')]=[{'all':!![]}];}return db[_0x658d('0x47')]['findAll'](_0xab3f2d);})['then'](function(_0x416a3e){_0x5eb878[_0x658d('0x4a')]=_0x416a3e;return _0x5eb878;})['then'](respondWithFilteredResult(_0x1e56f8,_0xab3f2d))[_0x658d('0x20')](handleError(_0x1e56f8,null));};exports[_0x658d('0x4b')]=function(_0x341107,_0x26e392){var _0x5d19b3={'raw':!![],'where':{'id':_0x341107[_0x658d('0x4c')]['id']}},_0x5af5c6={};_0x5af5c6[_0x658d('0x33')]=_[_0x658d('0x34')](db[_0x658d('0x47')][_0x658d('0x32')]);_0x5af5c6[_0x658d('0x35')]=_[_0x658d('0x34')](_0x341107[_0x658d('0x35')]);_0x5af5c6['filters']=_[_0x658d('0x39')](_0x5af5c6['model'],_0x5af5c6[_0x658d('0x35')]);_0x5d19b3[_0x658d('0x3a')]=_[_0x658d('0x39')](_0x5af5c6[_0x658d('0x33')],qs[_0x658d('0x3b')](_0x341107[_0x658d('0x35')][_0x658d('0x3b')]));_0x5d19b3[_0x658d('0x3a')]=_0x5d19b3[_0x658d('0x3a')][_0x658d('0x3c')]?_0x5d19b3[_0x658d('0x3a')]:_0x5af5c6['model'];if(_0x341107['query'][_0x658d('0x48')]){_0x5d19b3[_0x658d('0x49')]=[{'all':!![]}];}_0x5d19b3=_['merge']({},_0x5d19b3,_0x341107[_0x658d('0x46')]);return db['ChatQueue']['find'](_0x5d19b3)[_0x658d('0x15')](handleEntityNotFound(_0x26e392,null))[_0x658d('0x15')](respondWithResult(_0x26e392,null))[_0x658d('0x20')](handleError(_0x26e392,null));};exports[_0x658d('0x4d')]=function(_0x359854,_0x471041){return db[_0x658d('0x47')][_0x658d('0x4d')](_0x359854[_0x658d('0x4e')],{})[_0x658d('0x15')](respondWithResult(_0x471041,0xc9))[_0x658d('0x20')](handleError(_0x471041,null));};exports[_0x658d('0x2c')]=function(_0x26d7e8,_0x13f55f){if(_0x26d7e8[_0x658d('0x4e')]['id']){delete _0x26d7e8[_0x658d('0x4e')]['id'];}return db[_0x658d('0x47')][_0x658d('0x4f')]({'where':{'id':_0x26d7e8[_0x658d('0x4c')]['id']}})[_0x658d('0x15')](handleEntityNotFound(_0x13f55f,null))[_0x658d('0x15')](saveUpdates(_0x26d7e8[_0x658d('0x4e')],null))[_0x658d('0x15')](respondWithResult(_0x13f55f,null))[_0x658d('0x20')](handleError(_0x13f55f,null));};exports[_0x658d('0x2d')]=function(_0x47fd9c,_0x5dc5be){return db[_0x658d('0x47')][_0x658d('0x4f')]({'where':{'id':_0x47fd9c['params']['id']}})[_0x658d('0x15')](handleEntityNotFound(_0x5dc5be,null))['then'](removeEntity(_0x5dc5be,null))[_0x658d('0x20')](handleError(_0x5dc5be,null));};exports[_0x658d('0x50')]=function(_0x4a19f2,_0x5648bc){return db[_0x658d('0x47')][_0x658d('0x50')]()[_0x658d('0x15')](respondWithResult(_0x5648bc,null))['catch'](handleError(_0x5648bc,null));};exports[_0x658d('0x51')]=function(_0x12bf33,_0x128d31,_0x48a643){var _0x59c948={'raw':!![],'where':{}},_0x8d46a2={},_0x579ee2;return db[_0x658d('0x47')][_0x658d('0x52')]({'where':{'id':_0x12bf33['params']['id']}})[_0x658d('0x15')](handleEntityNotFound(_0x128d31,null))['then'](function(_0x1dd267){if(_0x1dd267){_0x579ee2=_0x1dd267[_0x658d('0x53')]({'plain':!![]});_0x8d46a2[_0x658d('0x33')]=_[_0x658d('0x34')](db[_0x658d('0x54')]['rawAttributes']);_0x8d46a2[_0x658d('0x35')]=_[_0x658d('0x34')](_0x12bf33[_0x658d('0x35')]);_0x8d46a2[_0x658d('0x38')]=_[_0x658d('0x39')](_0x8d46a2[_0x658d('0x33')],_0x8d46a2[_0x658d('0x35')]);_0x59c948['attributes']=_['intersection'](_0x8d46a2['model'],qs[_0x658d('0x3b')](_0x12bf33[_0x658d('0x35')][_0x658d('0x3b')]));_0x59c948[_0x658d('0x3a')]=_0x59c948[_0x658d('0x3a')][_0x658d('0x3c')]?_0x59c948[_0x658d('0x3a')]:_0x8d46a2[_0x658d('0x33')];if(!_0x12bf33[_0x658d('0x35')][_0x658d('0x3d')](_0x658d('0x55'))){_0x59c948[_0x658d('0x26')]=qs[_0x658d('0x26')](_0x12bf33[_0x658d('0x35')][_0x658d('0x26')]);_0x59c948['offset']=qs[_0x658d('0x25')](_0x12bf33[_0x658d('0x35')][_0x658d('0x25')]);}_0x59c948['order']=qs[_0x658d('0x3f')](_0x12bf33[_0x658d('0x35')][_0x658d('0x3f')]);_0x59c948[_0x658d('0x40')]=qs[_0x658d('0x38')](_[_0x658d('0x41')](_0x12bf33[_0x658d('0x35')],_0x8d46a2[_0x658d('0x38')]));_0x59c948['where']['ChatQueueId']=_0x1dd267['id'];if(_0x12bf33['query']['filter']){_0x59c948[_0x658d('0x40')]=_[_0x658d('0x43')](_0x59c948[_0x658d('0x40')],{'$or':_[_0x658d('0x45')](_0x59c948[_0x658d('0x3a')],function(_0x3b1d41){var _0x2225d8={};_0x2225d8[_0x3b1d41]={'$like':'%'+_0x12bf33[_0x658d('0x35')][_0x658d('0x44')]+'%'};return _0x2225d8;})});}_0x59c948=_[_0x658d('0x43')]({},_0x59c948,_0x12bf33[_0x658d('0x46')]);return db['UserChatQueue'][_0x658d('0x56')](_0x59c948);}})[_0x658d('0x15')](function(_0x8961fd){if(_0x8961fd){return db[_0x658d('0x57')][_0x658d('0x58')]({'where':{'id':_[_0x658d('0x45')](_0x8961fd,'UserId'),'role':'agent'},'attributes':['id',_0x658d('0x2f'),_0x658d('0x59'),_0x658d('0x5a'),_0x658d('0x5b')]});}})[_0x658d('0x15')](function(_0x5202c6){if(_0x5202c6){return{'count':_0x5202c6[_0x658d('0x24')],'rows':_[_0x658d('0x45')](_0x5202c6['rows'],function(_0x57d352){return{'membername':_0x57d352[_0x658d('0x2f')],'UserId':_0x57d352['id'],'queue_name':_0x579ee2[_0x658d('0x2f')],'ChatQueueId':_0x579ee2['id'],'interface':util[_0x658d('0x5c')](_0x658d('0x5d'),_0x658d('0x5e'),_0x57d352['name']),'penalty':0x0,'paused':_0x57d352[_0x658d('0x59')],'createdAt':_0x57d352[_0x658d('0x5b')],'updatedAt':_0x57d352[_0x658d('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x658d('0x15')](respondWithFilteredResult(_0x128d31,_0x59c948))[_0x658d('0x20')](handleError(_0x128d31,null));};exports[_0x658d('0x5f')]=function(_0x317b1f,_0x49f222,_0x57571b){var _0x3cc340={};var _0x1fc15b={};var _0x55e6d2;var _0x1334a9;return db[_0x658d('0x47')][_0x658d('0x52')]({'where':{'id':_0x317b1f[_0x658d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x49f222,null))[_0x658d('0x15')](function(_0x4e861b){if(_0x4e861b){_0x55e6d2=_0x4e861b;_0x1fc15b[_0x658d('0x33')]=_[_0x658d('0x34')](db[_0x658d('0x60')][_0x658d('0x32')]);_0x1fc15b[_0x658d('0x35')]=_[_0x658d('0x34')](_0x317b1f[_0x658d('0x35')]);_0x1fc15b[_0x658d('0x38')]=_[_0x658d('0x39')](_0x1fc15b['model'],_0x1fc15b[_0x658d('0x35')]);_0x3cc340['attributes']=_['intersection'](_0x1fc15b[_0x658d('0x33')],qs[_0x658d('0x3b')](_0x317b1f['query'][_0x658d('0x3b')]));_0x3cc340['attributes']=_0x3cc340[_0x658d('0x3a')][_0x658d('0x3c')]?_0x3cc340[_0x658d('0x3a')]:_0x1fc15b[_0x658d('0x33')];_0x3cc340[_0x658d('0x3e')]=qs[_0x658d('0x3f')](_0x317b1f[_0x658d('0x35')][_0x658d('0x3f')]);_0x3cc340[_0x658d('0x40')]=qs['filters'](_[_0x658d('0x41')](_0x317b1f[_0x658d('0x35')],_0x1fc15b[_0x658d('0x38')]));if(_0x317b1f[_0x658d('0x35')][_0x658d('0x44')]){_0x3cc340[_0x658d('0x40')]=_[_0x658d('0x43')](_0x3cc340[_0x658d('0x40')],{'$or':_[_0x658d('0x45')](_0x3cc340[_0x658d('0x3a')],function(_0x493816){var _0x5eaa6c={};_0x5eaa6c[_0x493816]={'$like':'%'+_0x317b1f[_0x658d('0x35')][_0x658d('0x44')]+'%'};return _0x5eaa6c;})});}_0x3cc340=_['merge']({},_0x3cc340,_0x317b1f[_0x658d('0x46')]);return _0x55e6d2[_0x658d('0x5f')](_0x3cc340);}})['then'](function(_0x202fd1){if(_0x202fd1){_0x1334a9=_0x202fd1[_0x658d('0x3c')];if(!_0x317b1f[_0x658d('0x35')][_0x658d('0x3d')]('nolimit')){_0x3cc340['limit']=qs[_0x658d('0x26')](_0x317b1f[_0x658d('0x35')][_0x658d('0x26')]);_0x3cc340[_0x658d('0x25')]=qs['offset'](_0x317b1f[_0x658d('0x35')]['offset']);}return _0x55e6d2[_0x658d('0x5f')](_0x3cc340);}})[_0x658d('0x15')](function(_0x1d74e2){if(_0x1d74e2){return _0x1d74e2?{'count':_0x1334a9,'rows':_0x1d74e2}:null;}})[_0x658d('0x15')](respondWithResult(_0x49f222,null))['catch'](handleError(_0x49f222,null));};exports[_0x658d('0x61')]=function(_0x4e92a4,_0x20be08,_0x17c58c){var _0x2eca8d=[];var _0x1d9d4f;return db[_0x658d('0x60')][_0x658d('0x56')]({'where':{'id':_0x4e92a4[_0x658d('0x4e')][_0x658d('0x62')]},'attributes':['id'],'include':[{'model':db[_0x658d('0x57')],'as':_0x658d('0x63'),'attributes':['id'],'raw':!![]}]})[_0x658d('0x15')](function(_0x20149e){if(_0x20149e){for(var _0x3bc9ca=0x0;_0x3bc9ca<_0x20149e[_0x658d('0x3c')];_0x3bc9ca+=0x1){for(var _0x4ed828=0x0;_0x4ed828<_0x20149e[_0x3bc9ca]['Agents'][_0x658d('0x3c')];_0x4ed828+=0x1){_0x2eca8d=_[_0x658d('0x64')](_0x2eca8d,[_0x20149e[_0x3bc9ca][_0x658d('0x63')][_0x4ed828]['id']]);}}return _0x2eca8d;}})[_0x658d('0x15')](function(_0x64879b){if(_0x64879b){return db[_0x658d('0x47')][_0x658d('0x4f')]({'where':{'id':_0x4e92a4[_0x658d('0x4c')]['id']}});}})[_0x658d('0x15')](function(_0x11444c){if(_0x11444c){_0x1d9d4f=_0x11444c;return _0x1d9d4f[_0x658d('0x65')](_0x2eca8d,{'penalty':_0x4e92a4[_0x658d('0x4e')][_0x658d('0x66')]});}})[_0x658d('0x15')](function(_0x55eb91){if(_0x55eb91){return _0x1d9d4f[_0x658d('0x61')](_0x4e92a4[_0x658d('0x4e')]['ids']);}})[_0x658d('0x15')](handleEntityNotFound(_0x20be08,null))['then'](respondWithStatusCode(_0x20be08,null))[_0x658d('0x20')](handleError(_0x20be08,null));};exports['removeTeams']=function(_0x447844,_0x51df6e,_0x3d7689){var _0x2feacb=[];var _0x25ac6c;return db[_0x658d('0x60')][_0x658d('0x56')]({'where':{'id':_0x447844[_0x658d('0x35')][_0x658d('0x62')]},'attributes':['id'],'include':[{'model':db[_0x658d('0x57')],'as':_0x658d('0x63'),'attributes':['id'],'raw':!![]}]})[_0x658d('0x15')](function(_0x167468){if(_0x167468){for(var _0x22cbe7=0x0;_0x22cbe7<_0x167468[_0x658d('0x3c')];_0x22cbe7+=0x1){for(var _0x4f285c=0x0;_0x4f285c<_0x167468[_0x22cbe7][_0x658d('0x63')][_0x658d('0x3c')];_0x4f285c+=0x1){_0x2feacb=_[_0x658d('0x64')](_0x2feacb,[_0x167468[_0x22cbe7][_0x658d('0x63')][_0x4f285c]['id']]);}}return _0x2feacb;}})[_0x658d('0x15')](function(_0x308a55){if(_0x308a55){return db[_0x658d('0x47')][_0x658d('0x4f')]({'where':{'id':_0x447844[_0x658d('0x4c')]['id']}});}})[_0x658d('0x15')](function(_0x512727){if(_0x512727){_0x25ac6c=_0x512727;return _0x25ac6c[_0x658d('0x67')](_0x2feacb);}})[_0x658d('0x15')](function(_0x53b80b){if(_0x25ac6c){return _0x25ac6c[_0x658d('0x68')](_0x447844[_0x658d('0x35')][_0x658d('0x62')]);}})['then'](handleEntityNotFound(_0x51df6e,null))[_0x658d('0x15')](respondWithStatusCode(_0x51df6e,null))[_0x658d('0x20')](handleError(_0x51df6e,null));};exports[_0x658d('0x65')]=function(_0x21f651,_0x2cf72d,_0x4741e8){return db[_0x658d('0x47')]['find']({'where':{'id':_0x21f651[_0x658d('0x4c')]['id']}})[_0x658d('0x15')](handleEntityNotFound(_0x2cf72d,null))[_0x658d('0x15')](function(_0x2d09af){if(_0x2d09af){return _0x2d09af[_0x658d('0x65')](_0x21f651['body'][_0x658d('0x62')],_[_0x658d('0x69')](_0x21f651[_0x658d('0x4e')],['ids','id'])||{})[_0x658d('0x6a')](function(_0x218557){for(var _0x558987=0x0;_0x558987<_0x21f651['body'][_0x658d('0x62')]['length'];_0x558987+=0x1){socket[_0x658d('0x6b')]('userChatQueue:save',{'UserId':_0x21f651[_0x658d('0x4e')][_0x658d('0x62')][_0x558987],'ChatQueueId':_0x21f651[_0x658d('0x4c')]['id']});}return _0x218557;});}})[_0x658d('0x15')](respondWithResult(_0x2cf72d,null))[_0x658d('0x20')](handleError(_0x2cf72d,null));};exports['removeAgents']=function(_0x1428b1,_0x340fba,_0x583ef1){var _0x51f23d;return db[_0x658d('0x47')][_0x658d('0x4f')]({'where':{'id':_0x1428b1[_0x658d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x340fba,null))[_0x658d('0x15')](function(_0x52401){if(_0x52401){return _0x52401[_0x658d('0x67')](_0x1428b1[_0x658d('0x35')][_0x658d('0x62')])['then'](function(_0x562c89){if(_[_0x658d('0x6c')](_0x1428b1[_0x658d('0x35')]['ids'])){for(var _0x3396dc=0x0;_0x3396dc<_0x1428b1[_0x658d('0x35')][_0x658d('0x62')][_0x658d('0x3c')];_0x3396dc+=0x1){socket[_0x658d('0x6b')]('userChatQueue:remove',{'UserId':_0x1428b1[_0x658d('0x35')][_0x658d('0x62')][_0x3396dc],'ChatQueueId':_0x1428b1[_0x658d('0x4c')]['id']});}}else{socket[_0x658d('0x6b')](_0x658d('0x6d'),{'UserId':_0x1428b1[_0x658d('0x35')][_0x658d('0x62')],'ChatQueueId':_0x1428b1['params']['id']});}});}})['then'](respondWithStatusCode(_0x340fba,null))[_0x658d('0x20')](handleError(_0x340fba,null));};exports[_0x658d('0x6e')]=function(_0x50bb1f,_0x587e51,_0x522bff){var _0x32405e={};var _0x4ac0b8={};var _0x15da2e;var _0x506caf;return db[_0x658d('0x47')]['findOne']({'where':{'id':_0x50bb1f['params']['id']}})[_0x658d('0x15')](handleEntityNotFound(_0x587e51,null))[_0x658d('0x15')](function(_0x5bb5e1){if(_0x5bb5e1){_0x15da2e=_0x5bb5e1;_0x4ac0b8['model']=_['keys'](db[_0x658d('0x57')][_0x658d('0x32')]);_0x4ac0b8[_0x658d('0x35')]=_['keys'](_0x50bb1f[_0x658d('0x35')]);_0x4ac0b8['filters']=_[_0x658d('0x39')](_0x4ac0b8[_0x658d('0x33')],_0x4ac0b8[_0x658d('0x35')]);_0x32405e['attributes']=_[_0x658d('0x39')](_0x4ac0b8[_0x658d('0x33')],qs[_0x658d('0x3b')](_0x50bb1f[_0x658d('0x35')][_0x658d('0x3b')]));_0x32405e[_0x658d('0x3a')]=_0x32405e[_0x658d('0x3a')][_0x658d('0x3c')]?_0x32405e[_0x658d('0x3a')]:_0x4ac0b8[_0x658d('0x33')];_0x32405e[_0x658d('0x3e')]=qs[_0x658d('0x3f')](_0x50bb1f[_0x658d('0x35')]['sort']);_0x32405e['where']=qs[_0x658d('0x38')](_['pick'](_0x50bb1f[_0x658d('0x35')],_0x4ac0b8[_0x658d('0x38')]));if(_0x50bb1f[_0x658d('0x35')][_0x658d('0x44')]){_0x32405e[_0x658d('0x40')]=_[_0x658d('0x43')](_0x32405e[_0x658d('0x40')],{'$or':_[_0x658d('0x45')](_0x32405e[_0x658d('0x3a')],function(_0x1cdae8){var _0x62e9d8={};_0x62e9d8[_0x1cdae8]={'$like':'%'+_0x50bb1f[_0x658d('0x35')][_0x658d('0x44')]+'%'};return _0x62e9d8;})});}_0x32405e=_['merge']({},_0x32405e,_0x50bb1f[_0x658d('0x46')]);return _0x15da2e[_0x658d('0x6e')](_0x32405e);}})[_0x658d('0x15')](function(_0x2897b9){if(_0x2897b9){_0x506caf=_0x2897b9[_0x658d('0x3c')];if(!_0x50bb1f[_0x658d('0x35')][_0x658d('0x3d')](_0x658d('0x55'))){_0x32405e[_0x658d('0x26')]=qs['limit'](_0x50bb1f[_0x658d('0x35')][_0x658d('0x26')]);_0x32405e[_0x658d('0x25')]=qs[_0x658d('0x25')](_0x50bb1f[_0x658d('0x35')][_0x658d('0x25')]);}return _0x15da2e[_0x658d('0x6e')](_0x32405e);}})[_0x658d('0x15')](function(_0x47b4ab){if(_0x47b4ab){return _0x47b4ab?{'count':_0x506caf,'rows':_0x47b4ab}:null;}})[_0x658d('0x15')](respondWithResult(_0x587e51,null))[_0x658d('0x20')](handleError(_0x587e51,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index b20c59a..231d963 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 _0xbc9d=['save','emit','hasOwnProperty','hook','events','../../mysqldb','ChatQueue','setMaxListeners'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x4eb684,_0xa7e5b8){_0x4eb684=_0x4eb684-0x0;var _0x25ca68=_0xbc9d[_0x4eb684];return _0x25ca68;};'use strict';var EventEmitter=require(_0xdbc9('0x0'));var ChatQueue=require(_0xdbc9('0x1'))['db'][_0xdbc9('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xdbc9('0x3')](0x0);var events={'afterCreate':_0xdbc9('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4fab6e){return function(_0x2aba48,_0x404513,_0x3e63f1){ChatQueueEvents[_0xdbc9('0x5')](_0x4fab6e+':'+_0x2aba48['id'],_0x2aba48);ChatQueueEvents[_0xdbc9('0x5')](_0x4fab6e,_0x2aba48);_0x3e63f1(null);};}for(var e in events){if(events[_0xdbc9('0x6')](e)){var event=events[e];ChatQueue[_0xdbc9('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x8dd6=['setMaxListeners','save','update','remove','emit','hook','exports','events','ChatQueue'];(function(_0x41f742,_0x4a3b00){var _0x3c5aee=function(_0x18f56f){while(--_0x18f56f){_0x41f742['push'](_0x41f742['shift']());}};_0x3c5aee(++_0x4a3b00);}(_0x8dd6,0xcd));var _0x68dd=function(_0x3ca8cc,_0x224709){_0x3ca8cc=_0x3ca8cc-0x0;var _0x489cd6=_0x8dd6[_0x3ca8cc];return _0x489cd6;};'use strict';var EventEmitter=require(_0x68dd('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x68dd('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x68dd('0x2')](0x0);var events={'afterCreate':_0x68dd('0x3'),'afterUpdate':_0x68dd('0x4'),'afterDestroy':_0x68dd('0x5')};function emitEvent(_0xb7a3f4){return function(_0x43d692,_0x53797f,_0x4fa62e){ChatQueueEvents[_0x68dd('0x6')](_0xb7a3f4+':'+_0x43d692['id'],_0x43d692);ChatQueueEvents['emit'](_0xb7a3f4,_0x43d692);_0x4fa62e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x68dd('0x7')](e,emitEvent(event));}}module[_0x68dd('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 294e436..c866ab1 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 _0x0309=['bluebird','request-promise','./chatQueue.attributes','exports','chat_queues','lodash','../../config/logger','moment'];(function(_0xb94789,_0x56c4e0){var _0x56f573=function(_0x4dd621){while(--_0x4dd621){_0xb94789['push'](_0xb94789['shift']());}};_0x56f573(++_0x56c4e0);}(_0x0309,0x165));var _0x9030=function(_0x12e4b7,_0x732556){_0x12e4b7=_0x12e4b7-0x0;var _0x3544d2=_0x0309[_0x12e4b7];return _0x3544d2;};'use strict';var _=require(_0x9030('0x0'));var util=require('util');var logger=require(_0x9030('0x1'))('api');var moment=require(_0x9030('0x2'));var BPromise=require(_0x9030('0x3'));var rp=require(_0x9030('0x4'));var attributes=require(_0x9030('0x5'));module[_0x9030('0x6')]=function(_0x2e6276,_0xcbbe57){return _0x2e6276['define']('ChatQueue',attributes,{'tableName':_0x9030('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c02=['ChatQueue','chat_queues','util','../../config/logger','moment','bluebird','request-promise','./chatQueue.attributes','exports','define'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x20c0('0x0'));var logger=require(_0x20c0('0x1'))('api');var moment=require(_0x20c0('0x2'));var BPromise=require(_0x20c0('0x3'));var rp=require(_0x20c0('0x4'));var attributes=require(_0x20c0('0x5'));module[_0x20c0('0x6')]=function(_0x2e9d65,_0x2afa72){return _0x2e9d65[_0x20c0('0x7')](_0x20c0('0x8'),attributes,{'tableName':_0x20c0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index df29085..b855b15 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(_0x20908f,_0x1f26ee){var _0x10f5a3=function(_0x2a9845){while(--_0x2a9845){_0x20908f['push'](_0x20908f['shift']());}};_0x10f5a3(++_0x1f26ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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(_0x460e2e,_0x95d40f){var _0x2a9ef9=function(_0x4155e1){while(--_0x4155e1){_0x460e2e['push'](_0x460e2e['shift']());}};_0x2a9ef9(++_0x95d40f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 52950db..f1bd88a 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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 fe910d3..06824cc 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 _0xfcbd=['describe','/:id','show','/:id/members','/:id/teams','getTeams','getAgents','post','create','/:id/users','addAgents','put','delete','removeTeams','exports','path','express','Router','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0xfcbd,0x1d1));var _0xdfcb=function(_0x1c2f29,_0x5a2668){_0x1c2f29=_0x1c2f29-0x0;var _0x258465=_0xfcbd[_0x1c2f29];return _0x258465;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdfcb('0x0'));var express=require(_0xdfcb('0x1'));var router=express[_0xdfcb('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xdfcb('0x3'));var config=require(_0xdfcb('0x4'));var controller=require(_0xdfcb('0x5'));router[_0xdfcb('0x6')]('/',auth[_0xdfcb('0x7')](),controller[_0xdfcb('0x8')]);router['get'](_0xdfcb('0x9'),auth[_0xdfcb('0x7')](),controller[_0xdfcb('0xa')]);router[_0xdfcb('0x6')](_0xdfcb('0xb'),auth[_0xdfcb('0x7')](),controller[_0xdfcb('0xc')]);router[_0xdfcb('0x6')](_0xdfcb('0xd'),auth[_0xdfcb('0x7')](),controller['getMembers']);router[_0xdfcb('0x6')](_0xdfcb('0xe'),auth[_0xdfcb('0x7')](),controller[_0xdfcb('0xf')]);router[_0xdfcb('0x6')]('/:id/users',auth[_0xdfcb('0x7')](),controller[_0xdfcb('0x10')]);router[_0xdfcb('0x11')]('/',auth[_0xdfcb('0x7')](),controller[_0xdfcb('0x12')]);router['post'](_0xdfcb('0xe'),auth[_0xdfcb('0x7')](),controller['addTeams']);router['post'](_0xdfcb('0x13'),auth[_0xdfcb('0x7')](),controller[_0xdfcb('0x14')]);router[_0xdfcb('0x15')](_0xdfcb('0xb'),auth[_0xdfcb('0x7')](),controller['update']);router['delete'](_0xdfcb('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0xdfcb('0x16')](_0xdfcb('0xe'),auth['isAuthenticated'](),controller[_0xdfcb('0x17')]);router['delete'](_0xdfcb('0x13'),auth[_0xdfcb('0x7')](),controller['removeAgents']);module[_0xdfcb('0x18')]=router; \ No newline at end of file +var _0xff5b=['getAgents','post','create','addTeams','update','delete','destroy','removeAgents','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x16d24f,_0x4686a5){var _0x3beec6=function(_0x552ae0){while(--_0x552ae0){_0x16d24f['push'](_0x16d24f['shift']());}};_0x3beec6(++_0x4686a5);}(_0xff5b,0x9f));var _0xbff5=function(_0x22065c,_0x59eec1){_0x22065c=_0x22065c-0x0;var _0x183463=_0xff5b[_0x22065c];return _0x183463;};'use strict';var multer=require(_0xbff5('0x0'));var util=require(_0xbff5('0x1'));var path=require(_0xbff5('0x2'));var express=require(_0xbff5('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xbff5('0x4'));var config=require(_0xbff5('0x5'));var controller=require('./chatQueue.controller');router[_0xbff5('0x6')]('/',auth[_0xbff5('0x7')](),controller[_0xbff5('0x8')]);router[_0xbff5('0x6')](_0xbff5('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xbff5('0x6')](_0xbff5('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xbff5('0x6')](_0xbff5('0xb'),auth[_0xbff5('0x7')](),controller[_0xbff5('0xc')]);router[_0xbff5('0x6')](_0xbff5('0xd'),auth[_0xbff5('0x7')](),controller[_0xbff5('0xe')]);router[_0xbff5('0x6')](_0xbff5('0xf'),auth[_0xbff5('0x7')](),controller[_0xbff5('0x10')]);router[_0xbff5('0x11')]('/',auth[_0xbff5('0x7')](),controller[_0xbff5('0x12')]);router[_0xbff5('0x11')]('/:id/teams',auth['isAuthenticated'](),controller[_0xbff5('0x13')]);router['post']('/:id/users',auth[_0xbff5('0x7')](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xbff5('0x14')]);router[_0xbff5('0x15')](_0xbff5('0xa'),auth[_0xbff5('0x7')](),controller[_0xbff5('0x16')]);router[_0xbff5('0x15')]('/:id/teams',auth[_0xbff5('0x7')](),controller['removeTeams']);router[_0xbff5('0x15')](_0xbff5('0xf'),auth[_0xbff5('0x7')](),controller[_0xbff5('0x17')]);module[_0xbff5('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 23233a9..1d604ef 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 _0x8966=['sequelize','exports','STRING','DATE','moment'];(function(_0x4466a5,_0x1b7aad){var _0x25e120=function(_0x4b2469){while(--_0x4b2469){_0x4466a5['push'](_0x4466a5['shift']());}};_0x25e120(++_0x1b7aad);}(_0x8966,0x185));var _0x6896=function(_0x418310,_0x50bb2a){_0x418310=_0x418310-0x0;var _0x36560d=_0x8966[_0x418310];return _0x36560d;};'use strict';var moment=require(_0x6896('0x0'));var Sequelize=require(_0x6896('0x1'));module[_0x6896('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x6896('0x3')]},'joinAt':{'type':Sequelize[_0x6896('0x4')]},'leaveAt':{'type':Sequelize[_0x6896('0x4')]},'acceptAt':{'type':Sequelize[_0x6896('0x4')]},'exitAt':{'type':Sequelize[_0x6896('0x4')]},'reason':{'type':Sequelize[_0x6896('0x3')]}}; \ No newline at end of file +var _0xfd3d=['moment','exports','STRING','DATE'];(function(_0xd7ca11,_0x394979){var _0x2e94fe=function(_0x5f0e0f){while(--_0x5f0e0f){_0xd7ca11['push'](_0xd7ca11['shift']());}};_0x2e94fe(++_0x394979);}(_0xfd3d,0xec));var _0xdfd3=function(_0x42701f,_0x3ffe04){_0x42701f=_0x42701f-0x0;var _0x5a6dd7=_0xfd3d[_0x42701f];return _0x5a6dd7;};'use strict';var moment=require(_0xdfd3('0x0'));var Sequelize=require('sequelize');module[_0xdfd3('0x1')]={'uniqueid':{'type':Sequelize[_0xdfd3('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdfd3('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xdfd3('0x3')]},'acceptAt':{'type':Sequelize[_0xdfd3('0x3')]},'exitAt':{'type':Sequelize[_0xdfd3('0x3')]},'reason':{'type':Sequelize[_0xdfd3('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 9959a7a..cd980ca 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 _0xbbba=['ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','Content-Range','destroy','stack','name','send','index','ChatQueueReport','rawAttributes','model','query','dateStart','dateEnd','attributes','fields','length','nolimit','order','sort','where','filters','pick','add','day','merge','filter','options','then','includeAll','include','findAll','catch','show','keys','intersection','create','update','body','find','params','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbbba,0x100));var _0xabbb=function(_0x5caf7e,_0x52e1bc){_0x5caf7e=_0x5caf7e-0x0;var _0x5c3435=_0xbbba[_0x5caf7e];return _0x5c3435;};'use strict';var jsonpatch=require(_0xabbb('0x0'));var rp=require(_0xabbb('0x1'));var moment=require(_0xabbb('0x2'));var BPromise=require(_0xabbb('0x3'));var Mustache=require(_0xabbb('0x4'));var util=require(_0xabbb('0x5'));var path=require(_0xabbb('0x6'));var sox=require('sox');var csv=require(_0xabbb('0x7'));var ejs=require(_0xabbb('0x8'));var fs=require('fs');var _=require(_0xabbb('0x9'));var squel=require(_0xabbb('0xa'));var crypto=require(_0xabbb('0xb'));var jsforce=require(_0xabbb('0xc'));var deskjs=require(_0xabbb('0xd'));var toCsv=require(_0xabbb('0x7'));var querystring=require('querystring');var Papa=require(_0xabbb('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0xabbb('0xf'))(_0xabbb('0x10'));var utils=require(_0xabbb('0x11'));var config=require(_0xabbb('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d1944,_0x4e69cf){_0x4e69cf=_0x4e69cf||0xcc;return function(_0x411a8c){if(_0x411a8c){return _0x3d1944[_0xabbb('0x13')](_0x4e69cf);}return _0x3d1944['status'](_0x4e69cf)[_0xabbb('0x14')]();};}function respondWithResult(_0x488f8b,_0x419261){_0x419261=_0x419261||0xc8;return function(_0x56a161){if(_0x56a161){return _0x488f8b[_0xabbb('0x15')](_0x419261)[_0xabbb('0x16')](_0x56a161);}};}function respondWithFilteredResult(_0x1f4c54,_0x5800de){return function(_0x123fdc){if(_0x123fdc){var _0x45e3b1=_0x123fdc[_0xabbb('0x17')],_0x1348e0=_0x5800de[_0xabbb('0x18')],_0x3a04cf=_0x5800de['offset']+_0x5800de[_0xabbb('0x19')],_0x445ffd;if(_0x3a04cf>=_0x45e3b1){_0x3a04cf=_0x45e3b1;_0x445ffd=0xc8;}else{_0x445ffd=0xce;}_0x1f4c54['status'](_0x445ffd);return _0x1f4c54['set'](_0xabbb('0x1a'),_0x1348e0+'-'+_0x3a04cf+'/'+_0x45e3b1)[_0xabbb('0x16')](_0x123fdc);}return null;};}function patchUpdates(_0x39b0d5){return function(_0x90a528){try{jsonpatch['apply'](_0x90a528,_0x39b0d5,!![]);}catch(_0xc8b05f){return BPromise['reject'](_0xc8b05f);}return _0x90a528['save']();};}function saveUpdates(_0x2a91b,_0x5b314f){return function(_0x3aea35){if(_0x3aea35){return _0x3aea35['update'](_0x2a91b)['then'](function(_0x30b2ce){return _0x30b2ce;});}return null;};}function removeEntity(_0x140ffc,_0x1f110b){return function(_0x396c6c){if(_0x396c6c){return _0x396c6c[_0xabbb('0x1b')]()['then'](function(){_0x140ffc[_0xabbb('0x15')](0xcc)[_0xabbb('0x14')]();});}};}function handleEntityNotFound(_0x5676e0,_0xa41204){return function(_0x1e8fab){if(!_0x1e8fab){_0x5676e0['sendStatus'](0x194);}return _0x1e8fab;};}function handleError(_0x576a06,_0x1d4a58){_0x1d4a58=_0x1d4a58||0x1f4;return function(_0x5b23aa){logger['error'](_0x5b23aa[_0xabbb('0x1c')]);if(_0x5b23aa[_0xabbb('0x1d')]){delete _0x5b23aa[_0xabbb('0x1d')];}_0x576a06[_0xabbb('0x15')](_0x1d4a58)[_0xabbb('0x1e')](_0x5b23aa);};}exports[_0xabbb('0x1f')]=function(_0x5d0f70,_0x58cbf5){var _0x4dedc0={},_0x1091e6={},_0x4afb2c={'count':0x0,'rows':[]};var _0x2e00b7=db[_0xabbb('0x20')][_0xabbb('0x21')];_0x1091e6[_0xabbb('0x22')]=_['keys'](_0x2e00b7);var _0x48a483={'dateStart':_0x5d0f70[_0xabbb('0x23')][_0xabbb('0x24')],'dateEnd':_0x5d0f70['query'][_0xabbb('0x25')]};delete _0x5d0f70[_0xabbb('0x23')][_0xabbb('0x24')];delete _0x5d0f70[_0xabbb('0x23')]['dateEnd'];_0x1091e6[_0xabbb('0x23')]=_['keys'](_0x5d0f70[_0xabbb('0x23')]);_0x1091e6['filters']=_['intersection'](_0x1091e6[_0xabbb('0x22')],_0x1091e6[_0xabbb('0x23')]);_0x4dedc0[_0xabbb('0x26')]=_['intersection'](_0x1091e6['model'],qs[_0xabbb('0x27')](_0x5d0f70[_0xabbb('0x23')]['fields']));_0x4dedc0[_0xabbb('0x26')]=_0x4dedc0[_0xabbb('0x26')][_0xabbb('0x28')]?_0x4dedc0['attributes']:_0x1091e6['model'];if(!_0x5d0f70[_0xabbb('0x23')]['hasOwnProperty'](_0xabbb('0x29'))){_0x4dedc0['limit']=qs['limit'](_0x5d0f70[_0xabbb('0x23')][_0xabbb('0x19')]);_0x4dedc0['offset']=qs[_0xabbb('0x18')](_0x5d0f70[_0xabbb('0x23')][_0xabbb('0x18')]);}_0x4dedc0[_0xabbb('0x2a')]=qs[_0xabbb('0x2b')](_0x5d0f70['query']['sort']);_0x4dedc0[_0xabbb('0x2c')]=qs[_0xabbb('0x2d')](_[_0xabbb('0x2e')](_0x5d0f70[_0xabbb('0x23')],_0x1091e6[_0xabbb('0x2d')]));if(_0x48a483['dateStart']){if(_0x48a483[_0xabbb('0x25')]){_0x48a483[_0xabbb('0x25')]=moment(_0x48a483['dateEnd'])[_0xabbb('0x2f')](0x1,_0xabbb('0x30'));}else{_0x48a483[_0xabbb('0x25')]=moment(_0x48a483[_0xabbb('0x24')])[_0xabbb('0x2f')](0x1,_0xabbb('0x30'));}_[_0xabbb('0x31')](_0x4dedc0[_0xabbb('0x2c')],{'createdAt':{'$gte':_0x48a483[_0xabbb('0x24')],'$lte':_0x48a483[_0xabbb('0x25')]}});}if(_0x5d0f70[_0xabbb('0x23')][_0xabbb('0x32')]){_0x4dedc0['where']=_[_0xabbb('0x31')](_0x4dedc0[_0xabbb('0x2c')],{'$or':_['map'](_0x4dedc0[_0xabbb('0x26')],function(_0x11f66c){var _0x354250={};_0x354250[_0x11f66c]={'$like':'%'+_0x5d0f70['query'][_0xabbb('0x32')]+'%'};return _0x354250;})});}_0x4dedc0=_[_0xabbb('0x31')]({},_0x4dedc0,_0x5d0f70[_0xabbb('0x33')]);var _0x13c02e={'where':_0x4dedc0[_0xabbb('0x2c')]};return db[_0xabbb('0x20')][_0xabbb('0x17')](_0x13c02e)[_0xabbb('0x34')](function(_0x38987b){_0x4afb2c[_0xabbb('0x17')]=_0x38987b;if(_0x5d0f70[_0xabbb('0x23')][_0xabbb('0x35')]){_0x4dedc0[_0xabbb('0x36')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xabbb('0x37')](_0x4dedc0);})[_0xabbb('0x34')](function(_0x439bd5){_0x4afb2c['rows']=_0x439bd5;return _0x4afb2c;})[_0xabbb('0x34')](respondWithFilteredResult(_0x58cbf5,_0x4dedc0))[_0xabbb('0x38')](handleError(_0x58cbf5,null));};exports[_0xabbb('0x39')]=function(_0x5208ca,_0x3c208d){var _0x4d9128={'raw':!![],'where':{'id':_0x5208ca['params']['id']}},_0x2cb689={};_0x2cb689[_0xabbb('0x22')]=_[_0xabbb('0x3a')](db[_0xabbb('0x20')][_0xabbb('0x21')]);_0x2cb689[_0xabbb('0x23')]=_[_0xabbb('0x3a')](_0x5208ca['query']);_0x2cb689['filters']=_[_0xabbb('0x3b')](_0x2cb689[_0xabbb('0x22')],_0x2cb689[_0xabbb('0x23')]);_0x4d9128['attributes']=_[_0xabbb('0x3b')](_0x2cb689[_0xabbb('0x22')],qs[_0xabbb('0x27')](_0x5208ca['query'][_0xabbb('0x27')]));_0x4d9128[_0xabbb('0x26')]=_0x4d9128[_0xabbb('0x26')][_0xabbb('0x28')]?_0x4d9128[_0xabbb('0x26')]:_0x2cb689[_0xabbb('0x22')];if(_0x5208ca[_0xabbb('0x23')][_0xabbb('0x35')]){_0x4d9128['include']=[{'all':!![]}];}_0x4d9128=_[_0xabbb('0x31')]({},_0x4d9128,_0x5208ca[_0xabbb('0x33')]);return db[_0xabbb('0x20')]['find'](_0x4d9128)[_0xabbb('0x34')](handleEntityNotFound(_0x3c208d,null))[_0xabbb('0x34')](respondWithResult(_0x3c208d,null))['catch'](handleError(_0x3c208d,null));};exports[_0xabbb('0x3c')]=function(_0x5bb2db,_0x3d97b5){return db['ChatQueueReport'][_0xabbb('0x3c')](_0x5bb2db['body'],{})['then'](respondWithResult(_0x3d97b5,0xc9))[_0xabbb('0x38')](handleError(_0x3d97b5,null));};exports[_0xabbb('0x3d')]=function(_0x248b55,_0x2d2bdd){if(_0x248b55[_0xabbb('0x3e')]['id']){delete _0x248b55[_0xabbb('0x3e')]['id'];}return db['ChatQueueReport'][_0xabbb('0x3f')]({'where':{'id':_0x248b55[_0xabbb('0x40')]['id']}})[_0xabbb('0x34')](handleEntityNotFound(_0x2d2bdd,null))['then'](saveUpdates(_0x248b55['body'],null))[_0xabbb('0x34')](respondWithResult(_0x2d2bdd,null))[_0xabbb('0x38')](handleError(_0x2d2bdd,null));};exports['destroy']=function(_0x37b676,_0x397585){return db[_0xabbb('0x20')][_0xabbb('0x3f')]({'where':{'id':_0x37b676[_0xabbb('0x40')]['id']}})[_0xabbb('0x34')](handleEntityNotFound(_0x397585,null))[_0xabbb('0x34')](removeEntity(_0x397585,null))[_0xabbb('0x38')](handleError(_0x397585,null));};exports[_0xabbb('0x41')]=function(_0x567f00,_0x5e055e){return db[_0xabbb('0x20')][_0xabbb('0x41')]()[_0xabbb('0x34')](respondWithResult(_0x5e055e,null))[_0xabbb('0x38')](handleError(_0x5e055e,null));}; \ No newline at end of file +var _0x0bd0=['describe','moment','bluebird','mustache','sox','to-csv','crypto','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','apply','save','update','destroy','end','name','send','index','ChatQueueReport','rawAttributes','model','keys','dateStart','query','dateEnd','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day','merge','filter','map','options','includeAll','then','rows','catch','show','length','include','find','create','body','params'];(function(_0x44334a,_0x181bce){var _0x20a140=function(_0x7ee785){while(--_0x7ee785){_0x44334a['push'](_0x44334a['shift']());}};_0x20a140(++_0x181bce);}(_0x0bd0,0x181));var _0x00bd=function(_0x135448,_0x4ca19f){_0x135448=_0x135448-0x0;var _0x28389e=_0x0bd0[_0x135448];return _0x28389e;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x00bd('0x0'));var BPromise=require(_0x00bd('0x1'));var Mustache=require(_0x00bd('0x2'));var util=require('util');var path=require('path');var sox=require(_0x00bd('0x3'));var csv=require(_0x00bd('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x00bd('0x5'));var jsforce=require('jsforce');var deskjs=require(_0x00bd('0x6'));var toCsv=require(_0x00bd('0x4'));var querystring=require(_0x00bd('0x7'));var Papa=require('papaparse');var qs=require(_0x00bd('0x8'));var logger=require(_0x00bd('0x9'))(_0x00bd('0xa'));var utils=require(_0x00bd('0xb'));var config=require(_0x00bd('0xc'));var db=require(_0x00bd('0xd'))['db'];function respondWithStatusCode(_0x25601f,_0x526730){_0x526730=_0x526730||0xcc;return function(_0x1d4e89){if(_0x1d4e89){return _0x25601f[_0x00bd('0xe')](_0x526730);}return _0x25601f[_0x00bd('0xf')](_0x526730)['end']();};}function respondWithResult(_0x4c3535,_0x3d2d40){_0x3d2d40=_0x3d2d40||0xc8;return function(_0x593a75){if(_0x593a75){return _0x4c3535[_0x00bd('0xf')](_0x3d2d40)['json'](_0x593a75);}};}function respondWithFilteredResult(_0x45e84e,_0x2b8f09){return function(_0x4cdf67){if(_0x4cdf67){var _0x10d3e2=_0x4cdf67[_0x00bd('0x10')],_0x294c0e=_0x2b8f09['offset'],_0x1f6844=_0x2b8f09[_0x00bd('0x11')]+_0x2b8f09[_0x00bd('0x12')],_0x37ca40;if(_0x1f6844>=_0x10d3e2){_0x1f6844=_0x10d3e2;_0x37ca40=0xc8;}else{_0x37ca40=0xce;}_0x45e84e[_0x00bd('0xf')](_0x37ca40);return _0x45e84e[_0x00bd('0x13')](_0x00bd('0x14'),_0x294c0e+'-'+_0x1f6844+'/'+_0x10d3e2)['json'](_0x4cdf67);}return null;};}function patchUpdates(_0x43a2bc){return function(_0x31b1f6){try{jsonpatch[_0x00bd('0x15')](_0x31b1f6,_0x43a2bc,!![]);}catch(_0x2144fd){return BPromise['reject'](_0x2144fd);}return _0x31b1f6[_0x00bd('0x16')]();};}function saveUpdates(_0x67594e,_0x11bbeb){return function(_0xa8974b){if(_0xa8974b){return _0xa8974b[_0x00bd('0x17')](_0x67594e)['then'](function(_0x501532){return _0x501532;});}return null;};}function removeEntity(_0xcbe2bb,_0x30d468){return function(_0x17e5da){if(_0x17e5da){return _0x17e5da[_0x00bd('0x18')]()['then'](function(){_0xcbe2bb[_0x00bd('0xf')](0xcc)[_0x00bd('0x19')]();});}};}function handleEntityNotFound(_0x8f762,_0x5ad75a){return function(_0x235720){if(!_0x235720){_0x8f762[_0x00bd('0xe')](0x194);}return _0x235720;};}function handleError(_0x2b817d,_0x4fb6e4){_0x4fb6e4=_0x4fb6e4||0x1f4;return function(_0x55b470){logger['error'](_0x55b470['stack']);if(_0x55b470[_0x00bd('0x1a')]){delete _0x55b470[_0x00bd('0x1a')];}_0x2b817d[_0x00bd('0xf')](_0x4fb6e4)[_0x00bd('0x1b')](_0x55b470);};}exports[_0x00bd('0x1c')]=function(_0x2c6d0a,_0x52b672){var _0x787f45={},_0x1c614e={},_0xf3c147={'count':0x0,'rows':[]};var _0xb35ee8=db[_0x00bd('0x1d')][_0x00bd('0x1e')];_0x1c614e[_0x00bd('0x1f')]=_[_0x00bd('0x20')](_0xb35ee8);var _0x2f51ac={'dateStart':_0x2c6d0a['query'][_0x00bd('0x21')],'dateEnd':_0x2c6d0a[_0x00bd('0x22')][_0x00bd('0x23')]};delete _0x2c6d0a[_0x00bd('0x22')]['dateStart'];delete _0x2c6d0a[_0x00bd('0x22')]['dateEnd'];_0x1c614e[_0x00bd('0x22')]=_[_0x00bd('0x20')](_0x2c6d0a[_0x00bd('0x22')]);_0x1c614e['filters']=_[_0x00bd('0x24')](_0x1c614e[_0x00bd('0x1f')],_0x1c614e[_0x00bd('0x22')]);_0x787f45['attributes']=_['intersection'](_0x1c614e[_0x00bd('0x1f')],qs['fields'](_0x2c6d0a[_0x00bd('0x22')][_0x00bd('0x25')]));_0x787f45[_0x00bd('0x26')]=_0x787f45['attributes']['length']?_0x787f45[_0x00bd('0x26')]:_0x1c614e['model'];if(!_0x2c6d0a[_0x00bd('0x22')][_0x00bd('0x27')](_0x00bd('0x28'))){_0x787f45[_0x00bd('0x12')]=qs[_0x00bd('0x12')](_0x2c6d0a[_0x00bd('0x22')][_0x00bd('0x12')]);_0x787f45[_0x00bd('0x11')]=qs[_0x00bd('0x11')](_0x2c6d0a[_0x00bd('0x22')][_0x00bd('0x11')]);}_0x787f45[_0x00bd('0x29')]=qs[_0x00bd('0x2a')](_0x2c6d0a[_0x00bd('0x22')]['sort']);_0x787f45[_0x00bd('0x2b')]=qs[_0x00bd('0x2c')](_[_0x00bd('0x2d')](_0x2c6d0a[_0x00bd('0x22')],_0x1c614e[_0x00bd('0x2c')]));if(_0x2f51ac[_0x00bd('0x21')]){if(_0x2f51ac['dateEnd']){_0x2f51ac[_0x00bd('0x23')]=moment(_0x2f51ac[_0x00bd('0x23')])[_0x00bd('0x2e')](0x1,_0x00bd('0x2f'));}else{_0x2f51ac['dateEnd']=moment(_0x2f51ac[_0x00bd('0x21')])['add'](0x1,_0x00bd('0x2f'));}_[_0x00bd('0x30')](_0x787f45[_0x00bd('0x2b')],{'createdAt':{'$gte':_0x2f51ac[_0x00bd('0x21')],'$lte':_0x2f51ac[_0x00bd('0x23')]}});}if(_0x2c6d0a[_0x00bd('0x22')][_0x00bd('0x31')]){_0x787f45[_0x00bd('0x2b')]=_[_0x00bd('0x30')](_0x787f45[_0x00bd('0x2b')],{'$or':_[_0x00bd('0x32')](_0x787f45[_0x00bd('0x26')],function(_0x27fa9e){var _0x2f3bef={};_0x2f3bef[_0x27fa9e]={'$like':'%'+_0x2c6d0a[_0x00bd('0x22')][_0x00bd('0x31')]+'%'};return _0x2f3bef;})});}_0x787f45=_[_0x00bd('0x30')]({},_0x787f45,_0x2c6d0a[_0x00bd('0x33')]);var _0x235de8={'where':_0x787f45[_0x00bd('0x2b')]};return db[_0x00bd('0x1d')][_0x00bd('0x10')](_0x235de8)['then'](function(_0x589154){_0xf3c147['count']=_0x589154;if(_0x2c6d0a[_0x00bd('0x22')][_0x00bd('0x34')]){_0x787f45['include']=[{'all':!![]}];}return db[_0x00bd('0x1d')]['findAll'](_0x787f45);})[_0x00bd('0x35')](function(_0x6f9cec){_0xf3c147[_0x00bd('0x36')]=_0x6f9cec;return _0xf3c147;})[_0x00bd('0x35')](respondWithFilteredResult(_0x52b672,_0x787f45))[_0x00bd('0x37')](handleError(_0x52b672,null));};exports[_0x00bd('0x38')]=function(_0x2a1c74,_0xb859c5){var _0x170335={'raw':!![],'where':{'id':_0x2a1c74['params']['id']}},_0x220e5d={};_0x220e5d[_0x00bd('0x1f')]=_[_0x00bd('0x20')](db[_0x00bd('0x1d')][_0x00bd('0x1e')]);_0x220e5d[_0x00bd('0x22')]=_['keys'](_0x2a1c74[_0x00bd('0x22')]);_0x220e5d[_0x00bd('0x2c')]=_[_0x00bd('0x24')](_0x220e5d['model'],_0x220e5d['query']);_0x170335[_0x00bd('0x26')]=_[_0x00bd('0x24')](_0x220e5d[_0x00bd('0x1f')],qs[_0x00bd('0x25')](_0x2a1c74[_0x00bd('0x22')][_0x00bd('0x25')]));_0x170335[_0x00bd('0x26')]=_0x170335[_0x00bd('0x26')][_0x00bd('0x39')]?_0x170335[_0x00bd('0x26')]:_0x220e5d[_0x00bd('0x1f')];if(_0x2a1c74[_0x00bd('0x22')][_0x00bd('0x34')]){_0x170335[_0x00bd('0x3a')]=[{'all':!![]}];}_0x170335=_['merge']({},_0x170335,_0x2a1c74[_0x00bd('0x33')]);return db[_0x00bd('0x1d')][_0x00bd('0x3b')](_0x170335)[_0x00bd('0x35')](handleEntityNotFound(_0xb859c5,null))['then'](respondWithResult(_0xb859c5,null))[_0x00bd('0x37')](handleError(_0xb859c5,null));};exports[_0x00bd('0x3c')]=function(_0x5510e2,_0x2a679f){return db[_0x00bd('0x1d')][_0x00bd('0x3c')](_0x5510e2[_0x00bd('0x3d')],{})[_0x00bd('0x35')](respondWithResult(_0x2a679f,0xc9))[_0x00bd('0x37')](handleError(_0x2a679f,null));};exports[_0x00bd('0x17')]=function(_0x456f31,_0x519d85){if(_0x456f31[_0x00bd('0x3d')]['id']){delete _0x456f31['body']['id'];}return db[_0x00bd('0x1d')]['find']({'where':{'id':_0x456f31[_0x00bd('0x3e')]['id']}})[_0x00bd('0x35')](handleEntityNotFound(_0x519d85,null))[_0x00bd('0x35')](saveUpdates(_0x456f31[_0x00bd('0x3d')],null))[_0x00bd('0x35')](respondWithResult(_0x519d85,null))['catch'](handleError(_0x519d85,null));};exports[_0x00bd('0x18')]=function(_0x24813f,_0x3a35ab){return db[_0x00bd('0x1d')][_0x00bd('0x3b')]({'where':{'id':_0x24813f[_0x00bd('0x3e')]['id']}})[_0x00bd('0x35')](handleEntityNotFound(_0x3a35ab,null))[_0x00bd('0x35')](removeEntity(_0x3a35ab,null))[_0x00bd('0x37')](handleError(_0x3a35ab,null));};exports[_0x00bd('0x3f')]=function(_0x5401ad,_0x357091){return db[_0x00bd('0x1d')][_0x00bd('0x3f')]()[_0x00bd('0x35')](respondWithResult(_0x357091,null))[_0x00bd('0x37')](handleError(_0x357091,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 6baa53d..e502a5b 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['request-promise','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util','bluebird'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x55ca,0x126));var _0xa55c=function(_0x59342a,_0x16827b){_0x59342a=_0x59342a-0x0;var _0x17abc9=_0x55ca[_0x59342a];return _0x17abc9;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var attributes=require('./chatQueueReport.attributes');module[_0xa55c('0x4')]=function(_0x2db02a,_0xcb02e3){return _0x2db02a[_0xa55c('0x5')](_0xa55c('0x6'),attributes,{'tableName':_0xa55c('0x7'),'paranoid':![],'indexes':[{'name':_0xa55c('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['ChatQueueReport','report_chat_queue','uniqueid','lodash','util','moment','bluebird','./chatQueueReport.attributes','define'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe14b,0x93));var _0xbe14=function(_0x1d27f7,_0x563aa2){_0x1d27f7=_0x1d27f7-0x0;var _0x3c1bf8=_0xe14b[_0x1d27f7];return _0x3c1bf8;};'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 diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 47de0cc..d95561b 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 _0x326f=['jayson/promise','client','http','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ChatQueueReport','create','raw','then','CreateChatQueueReport','UpdateChatQueueReport','options','where','attributes','limit','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x11ae3a,_0x173eba){var _0x1ce9de=function(_0x51af7f){while(--_0x51af7f){_0x11ae3a['push'](_0x11ae3a['shift']());}};_0x1ce9de(++_0x173eba);}(_0x326f,0xd1));var _0xf326=function(_0x5e2e20,_0x10c1d4){_0x5e2e20=_0x5e2e20-0x0;var _0x2df52c=_0x326f[_0x5e2e20];return _0x2df52c;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var db=require(_0xf326('0x3'))['db'];var utils=require(_0xf326('0x4'));var logger=require(_0xf326('0x5'))(_0xf326('0x6'));var config=require(_0xf326('0x7'));var jayson=require(_0xf326('0x8'));var client=jayson[_0xf326('0x9')][_0xf326('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c2249,_0x3c254d,_0x3851eb){return new BPromise(function(_0x165f95,_0x1e7b8a){return client['request'](_0x4c2249,_0x3851eb)['then'](function(_0x592975){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3c254d,_0xf326('0xd'));logger[_0xf326('0xe')](_0xf326('0xf'),_0x3c254d,'request\x20sent',JSON[_0xf326('0x10')](_0x592975));if(_0x592975['error']){if(_0x592975[_0xf326('0x11')]['code']===0x1f4){logger[_0xf326('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x3c254d,_0x592975[_0xf326('0x11')][_0xf326('0x12')]);return _0x1e7b8a(_0x592975['error'][_0xf326('0x12')]);}logger[_0xf326('0x11')](_0xf326('0xc'),_0x3c254d,_0x592975[_0xf326('0x11')]['message']);return _0x165f95(_0x592975[_0xf326('0x11')]['message']);}else{logger['info'](_0xf326('0xc'),_0x3c254d,_0xf326('0xd'));_0x165f95(_0x592975[_0xf326('0x13')][_0xf326('0x12')]);}})[_0xf326('0x14')](function(_0x287a2a){logger[_0xf326('0x11')](_0xf326('0xc'),_0x3c254d,_0x287a2a);_0x1e7b8a(_0x287a2a);});});}exports['CreateChatQueueReport']=function(_0x3ad7da){var _0x453100=this;return new Promise(function(_0x18bee3,_0x31ffb9){return db[_0xf326('0x15')][_0xf326('0x16')](_0x3ad7da['body'],{'raw':_0x3ad7da['options']?_0x3ad7da['options'][_0xf326('0x17')]===undefined?!![]:![]:!![]})[_0xf326('0x18')](function(_0x484cbe){logger['info'](_0xf326('0x19'),_0x3ad7da);logger['debug']('CreateChatQueueReport',_0x3ad7da,JSON[_0xf326('0x10')](_0x484cbe));_0x18bee3(_0x484cbe);})[_0xf326('0x14')](function(_0x549b46){logger['error'](_0xf326('0x19'),_0x549b46[_0xf326('0x12')],_0x3ad7da);_0x31ffb9(_0x453100['error'](0x1f4,_0x549b46[_0xf326('0x12')]));});});};exports[_0xf326('0x1a')]=function(_0x43c53e){var _0x295752=this;return new Promise(function(_0x17c157,_0x2049ec){return db['ChatQueueReport']['update'](_0x43c53e['body'],{'raw':_0x43c53e[_0xf326('0x1b')]?_0x43c53e[_0xf326('0x1b')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43c53e[_0xf326('0x1b')]?_0x43c53e[_0xf326('0x1b')][_0xf326('0x1c')]||null:null,'attributes':_0x43c53e['options']?_0x43c53e[_0xf326('0x1b')][_0xf326('0x1d')]||null:null,'limit':_0x43c53e[_0xf326('0x1b')]?_0x43c53e['options'][_0xf326('0x1e')]||null:null})['then'](function(_0x4a9abf){logger[_0xf326('0xb')](_0xf326('0x1a'),_0x43c53e);logger[_0xf326('0xe')]('UpdateChatQueueReport',_0x43c53e,JSON[_0xf326('0x10')](_0x4a9abf));_0x17c157(_0x4a9abf);})[_0xf326('0x14')](function(_0x55790d){logger[_0xf326('0x11')](_0xf326('0x1a'),_0x55790d[_0xf326('0x12')],_0x43c53e);_0x2049ec(_0x295752[_0xf326('0x11')](0x1f4,_0x55790d[_0xf326('0x12')]));});});}; \ No newline at end of file +var _0x1623=['create','body','options','raw','debug','catch','UpdateChatQueueReport','update','where','attributes','limit','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateChatQueueReport','ChatQueueReport'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x1623,0xab));var _0x3162=function(_0x570770,_0x5513d9){_0x570770=_0x570770-0x0;var _0xff29a8=_0x1623[_0x570770];return _0xff29a8;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var db=require(_0x3162('0x3'))['db'];var utils=require(_0x3162('0x4'));var logger=require(_0x3162('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3162('0x6'));var client=jayson['client'][_0x3162('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x428de6,_0x53260d,_0xffe9b6){return new BPromise(function(_0x2dc07e,_0x26ee32){return client[_0x3162('0x8')](_0x428de6,_0xffe9b6)[_0x3162('0x9')](function(_0x382676){logger[_0x3162('0xa')](_0x3162('0xb'),_0x53260d,'request\x20sent');logger['debug'](_0x3162('0xc'),_0x53260d,_0x3162('0xd'),JSON[_0x3162('0xe')](_0x382676));if(_0x382676[_0x3162('0xf')]){if(_0x382676[_0x3162('0xf')][_0x3162('0x10')]===0x1f4){logger[_0x3162('0xf')](_0x3162('0xb'),_0x53260d,_0x382676[_0x3162('0xf')]['message']);return _0x26ee32(_0x382676[_0x3162('0xf')]['message']);}logger[_0x3162('0xf')](_0x3162('0xb'),_0x53260d,_0x382676['error']['message']);return _0x2dc07e(_0x382676[_0x3162('0xf')][_0x3162('0x11')]);}else{logger[_0x3162('0xa')]('ChatQueueReport,\x20%s,\x20%s',_0x53260d,_0x3162('0xd'));_0x2dc07e(_0x382676[_0x3162('0x12')][_0x3162('0x11')]);}})['catch'](function(_0x78a56c){logger[_0x3162('0xf')](_0x3162('0xb'),_0x53260d,_0x78a56c);_0x26ee32(_0x78a56c);});});}exports[_0x3162('0x13')]=function(_0x930415){var _0x1eed46=this;return new Promise(function(_0x391d97,_0x4b2bf3){return db[_0x3162('0x14')][_0x3162('0x15')](_0x930415[_0x3162('0x16')],{'raw':_0x930415[_0x3162('0x17')]?_0x930415['options'][_0x3162('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x4ab3e8){logger[_0x3162('0xa')](_0x3162('0x13'),_0x930415);logger[_0x3162('0x19')]('CreateChatQueueReport',_0x930415,JSON['stringify'](_0x4ab3e8));_0x391d97(_0x4ab3e8);})[_0x3162('0x1a')](function(_0x396372){logger[_0x3162('0xf')](_0x3162('0x13'),_0x396372[_0x3162('0x11')],_0x930415);_0x4b2bf3(_0x1eed46[_0x3162('0xf')](0x1f4,_0x396372[_0x3162('0x11')]));});});};exports[_0x3162('0x1b')]=function(_0x5a4994){var _0xd283d6=this;return new Promise(function(_0x2433f8,_0x3919e7){return db[_0x3162('0x14')][_0x3162('0x1c')](_0x5a4994[_0x3162('0x16')],{'raw':_0x5a4994[_0x3162('0x17')]?_0x5a4994[_0x3162('0x17')][_0x3162('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a4994[_0x3162('0x17')]?_0x5a4994[_0x3162('0x17')][_0x3162('0x1d')]||null:null,'attributes':_0x5a4994[_0x3162('0x17')]?_0x5a4994['options'][_0x3162('0x1e')]||null:null,'limit':_0x5a4994['options']?_0x5a4994[_0x3162('0x17')][_0x3162('0x1f')]||null:null})[_0x3162('0x9')](function(_0x57f567){logger['info'](_0x3162('0x1b'),_0x5a4994);logger[_0x3162('0x19')](_0x3162('0x1b'),_0x5a4994,JSON[_0x3162('0xe')](_0x57f567));_0x2433f8(_0x57f567);})[_0x3162('0x1a')](function(_0x5c2d28){logger[_0x3162('0xf')]('UpdateChatQueueReport',_0x5c2d28[_0x3162('0x11')],_0x5a4994);_0x3919e7(_0xd283d6[_0x3162('0xf')](0x1f4,_0x5c2d28[_0x3162('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 8cd96a2..03ea9e4 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 _0xc08b=['put','delete','destroy','exports','util','express','Router','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create'];(function(_0x58803c,_0x4a34df){var _0xf95b9b=function(_0x597eb8){while(--_0x597eb8){_0x58803c['push'](_0x58803c['shift']());}};_0xf95b9b(++_0x4a34df);}(_0xc08b,0x1b4));var _0xbc08=function(_0xc4d753,_0x2196b9){_0xc4d753=_0xc4d753-0x0;var _0x53ed4c=_0xc08b[_0xc4d753];return _0x53ed4c;};'use strict';var multer=require('multer');var util=require(_0xbc08('0x0'));var path=require('path');var express=require(_0xbc08('0x1'));var router=express[_0xbc08('0x2')]();var auth=require(_0xbc08('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xbc08('0x4'));var controller=require(_0xbc08('0x5'));router[_0xbc08('0x6')]('/',auth[_0xbc08('0x7')](),controller[_0xbc08('0x8')]);router['get']('/describe',auth[_0xbc08('0x7')](),controller[_0xbc08('0x9')]);router[_0xbc08('0x6')](_0xbc08('0xa'),auth[_0xbc08('0x7')](),controller[_0xbc08('0xb')]);router[_0xbc08('0xc')]('/',auth[_0xbc08('0x7')](),controller[_0xbc08('0xd')]);router[_0xbc08('0xe')](_0xbc08('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xbc08('0xf')](_0xbc08('0xa'),auth['isAuthenticated'](),controller[_0xbc08('0x10')]);module[_0xbc08('0x11')]=router; \ No newline at end of file +var _0x6d07=['isAuthenticated','index','describe','/:id','create','update','delete','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0x6d07,0x158));var _0x76d0=function(_0x490c02,_0x2faa1b){_0x490c02=_0x490c02-0x0;var _0x4604ab=_0x6d07[_0x490c02];return _0x4604ab;};'use strict';var multer=require(_0x76d0('0x0'));var util=require(_0x76d0('0x1'));var path=require(_0x76d0('0x2'));var express=require(_0x76d0('0x3'));var router=express['Router']();var auth=require(_0x76d0('0x4'));var interaction=require(_0x76d0('0x5'));var config=require(_0x76d0('0x6'));var controller=require('./chatQueueReport.controller');router[_0x76d0('0x7')]('/',auth[_0x76d0('0x8')](),controller[_0x76d0('0x9')]);router[_0x76d0('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x76d0('0xa')]);router[_0x76d0('0x7')](_0x76d0('0xb'),auth[_0x76d0('0x8')](),controller['show']);router['post']('/',auth[_0x76d0('0x8')](),controller[_0x76d0('0xc')]);router['put'](_0x76d0('0xb'),auth['isAuthenticated'](),controller[_0x76d0('0xd')]);router[_0x76d0('0xe')](_0x76d0('0xb'),auth['isAuthenticated'](),controller[_0x76d0('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index a5c801b..0e40605 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 _0xca69=['agent','queue','DATE','NOW','sequelize','exports','ENUM'];(function(_0x23ac61,_0x48e4b4){var _0x974205=function(_0x1d60cd){while(--_0x1d60cd){_0x23ac61['push'](_0x23ac61['shift']());}};_0x974205(++_0x48e4b4);}(_0xca69,0xc8));var _0x9ca6=function(_0x1b419b,_0x3d6126){_0x1b419b=_0x1b419b-0x0;var _0x498ca8=_0xca69[_0x1b419b];return _0x498ca8;};'use strict';var moment=require('moment');var Sequelize=require(_0x9ca6('0x0'));module[_0x9ca6('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x9ca6('0x2')]('account',_0x9ca6('0x3'),'queue'),'allowNull':![],'defaultValue':_0x9ca6('0x4')},'transferredAt':{'type':Sequelize[_0x9ca6('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x9ca6('0x6')]}}; \ No newline at end of file +var _0x1de5=['account','queue','DATE','moment','sequelize','STRING','ENUM'];(function(_0x1f8bb2,_0x461efc){var _0x3c40b6=function(_0x22b9d4){while(--_0x22b9d4){_0x1f8bb2['push'](_0x1f8bb2['shift']());}};_0x3c40b6(++_0x461efc);}(_0x1de5,0x168));var _0x51de=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x1de5[_0x199572];return _0x13cfa3;};'use strict';var moment=require(_0x51de('0x0'));var Sequelize=require(_0x51de('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x51de('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x51de('0x3')](_0x51de('0x4'),'agent',_0x51de('0x5')),'allowNull':![],'defaultValue':_0x51de('0x5')},'transferredAt':{'type':Sequelize[_0x51de('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index de7f6e9..86e6766 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 _0xe921=['to-csv','ejs','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','end','json','count','offset','Content-Range','apply','reject','save','update','then','error','stack','name','status','ChatTransferReport','rawAttributes','model','keys','query','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','pick','dateEnd','add','day','merge','where','filter','findAll','rows','catch','params','includeAll','include','find','create','body','destroy','describe','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x1579a7,_0x5cb266){var _0x510ac3=function(_0x36aecc){while(--_0x36aecc){_0x1579a7['push'](_0x1579a7['shift']());}};_0x510ac3(++_0x5cb266);}(_0xe921,0x139));var _0x1e92=function(_0xac4c7c,_0x560be3){_0xac4c7c=_0xac4c7c-0x0;var _0x21a40c=_0xe921[_0xac4c7c];return _0x21a40c;};'use strict';var jsonpatch=require(_0x1e92('0x0'));var rp=require('request-promise');var moment=require(_0x1e92('0x1'));var BPromise=require(_0x1e92('0x2'));var Mustache=require(_0x1e92('0x3'));var util=require(_0x1e92('0x4'));var path=require(_0x1e92('0x5'));var sox=require(_0x1e92('0x6'));var csv=require(_0x1e92('0x7'));var ejs=require(_0x1e92('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1e92('0x9'));var crypto=require('crypto');var jsforce=require(_0x1e92('0xa'));var deskjs=require(_0x1e92('0xb'));var toCsv=require(_0x1e92('0x7'));var querystring=require('querystring');var Papa=require(_0x1e92('0xc'));var qs=require(_0x1e92('0xd'));var logger=require('../../config/logger')('api');var utils=require(_0x1e92('0xe'));var config=require(_0x1e92('0xf'));var db=require(_0x1e92('0x10'))['db'];function respondWithStatusCode(_0x6af6fd,_0x8be7c7){_0x8be7c7=_0x8be7c7||0xcc;return function(_0x16e47f){if(_0x16e47f){return _0x6af6fd['sendStatus'](_0x8be7c7);}return _0x6af6fd['status'](_0x8be7c7)[_0x1e92('0x11')]();};}function respondWithResult(_0x2c02b7,_0x1f8500){_0x1f8500=_0x1f8500||0xc8;return function(_0x348755){if(_0x348755){return _0x2c02b7['status'](_0x1f8500)[_0x1e92('0x12')](_0x348755);}};}function respondWithFilteredResult(_0x1845f2,_0x2acc8c){return function(_0x1e7c43){if(_0x1e7c43){var _0x30610c=_0x1e7c43[_0x1e92('0x13')],_0x328876=_0x2acc8c[_0x1e92('0x14')],_0x317933=_0x2acc8c[_0x1e92('0x14')]+_0x2acc8c['limit'],_0x381b37;if(_0x317933>=_0x30610c){_0x317933=_0x30610c;_0x381b37=0xc8;}else{_0x381b37=0xce;}_0x1845f2['status'](_0x381b37);return _0x1845f2['set'](_0x1e92('0x15'),_0x328876+'-'+_0x317933+'/'+_0x30610c)[_0x1e92('0x12')](_0x1e7c43);}return null;};}function patchUpdates(_0x14ff85){return function(_0x39f472){try{jsonpatch[_0x1e92('0x16')](_0x39f472,_0x14ff85,!![]);}catch(_0xfcf42d){return BPromise[_0x1e92('0x17')](_0xfcf42d);}return _0x39f472[_0x1e92('0x18')]();};}function saveUpdates(_0x47f07f,_0x1d952a){return function(_0x3d2406){if(_0x3d2406){return _0x3d2406[_0x1e92('0x19')](_0x47f07f)['then'](function(_0x1e6b4d){return _0x1e6b4d;});}return null;};}function removeEntity(_0x2e198a,_0x4b8b04){return function(_0x10dd87){if(_0x10dd87){return _0x10dd87['destroy']()[_0x1e92('0x1a')](function(){_0x2e198a['status'](0xcc)[_0x1e92('0x11')]();});}};}function handleEntityNotFound(_0x42721d,_0x324d88){return function(_0x2d8116){if(!_0x2d8116){_0x42721d['sendStatus'](0x194);}return _0x2d8116;};}function handleError(_0x4f2fc8,_0xd7be4){_0xd7be4=_0xd7be4||0x1f4;return function(_0x532114){logger[_0x1e92('0x1b')](_0x532114[_0x1e92('0x1c')]);if(_0x532114[_0x1e92('0x1d')]){delete _0x532114[_0x1e92('0x1d')];}_0x4f2fc8[_0x1e92('0x1e')](_0xd7be4)['send'](_0x532114);};}exports['index']=function(_0x3aafba,_0x3b6659){var _0x719308={},_0x1ee421={},_0x3a9132={'count':0x0,'rows':[]};var _0x1917f7=db[_0x1e92('0x1f')][_0x1e92('0x20')];_0x1ee421[_0x1e92('0x21')]=_[_0x1e92('0x22')](_0x1917f7);var _0x95492f={'dateStart':_0x3aafba[_0x1e92('0x23')][_0x1e92('0x24')],'dateEnd':_0x3aafba[_0x1e92('0x23')]['dateEnd']};delete _0x3aafba[_0x1e92('0x23')][_0x1e92('0x24')];delete _0x3aafba[_0x1e92('0x23')]['dateEnd'];_0x1ee421[_0x1e92('0x23')]=_['keys'](_0x3aafba[_0x1e92('0x23')]);_0x1ee421[_0x1e92('0x25')]=_[_0x1e92('0x26')](_0x1ee421[_0x1e92('0x21')],_0x1ee421[_0x1e92('0x23')]);_0x719308[_0x1e92('0x27')]=_[_0x1e92('0x26')](_0x1ee421[_0x1e92('0x21')],qs[_0x1e92('0x28')](_0x3aafba[_0x1e92('0x23')][_0x1e92('0x28')]));_0x719308[_0x1e92('0x27')]=_0x719308[_0x1e92('0x27')][_0x1e92('0x29')]?_0x719308[_0x1e92('0x27')]:_0x1ee421['model'];if(!_0x3aafba[_0x1e92('0x23')][_0x1e92('0x2a')](_0x1e92('0x2b'))){_0x719308['limit']=qs[_0x1e92('0x2c')](_0x3aafba['query'][_0x1e92('0x2c')]);_0x719308[_0x1e92('0x14')]=qs['offset'](_0x3aafba[_0x1e92('0x23')][_0x1e92('0x14')]);}_0x719308[_0x1e92('0x2d')]=qs['sort'](_0x3aafba[_0x1e92('0x23')]['sort']);_0x719308['where']=qs[_0x1e92('0x25')](_[_0x1e92('0x2e')](_0x3aafba[_0x1e92('0x23')],_0x1ee421[_0x1e92('0x25')]));if(_0x95492f[_0x1e92('0x24')]){if(_0x95492f[_0x1e92('0x2f')]){_0x95492f[_0x1e92('0x2f')]=moment(_0x95492f[_0x1e92('0x2f')])[_0x1e92('0x30')](0x1,_0x1e92('0x31'));}else{_0x95492f[_0x1e92('0x2f')]=moment(_0x95492f[_0x1e92('0x24')])['add'](0x1,_0x1e92('0x31'));}_[_0x1e92('0x32')](_0x719308[_0x1e92('0x33')],{'createdAt':{'$gte':_0x95492f[_0x1e92('0x24')],'$lte':_0x95492f[_0x1e92('0x2f')]}});}if(_0x3aafba[_0x1e92('0x23')][_0x1e92('0x34')]){_0x719308[_0x1e92('0x33')]=_[_0x1e92('0x32')](_0x719308[_0x1e92('0x33')],{'$or':_['map'](_0x719308[_0x1e92('0x27')],function(_0x3cceb3){var _0x139f5c={};_0x139f5c[_0x3cceb3]={'$like':'%'+_0x3aafba[_0x1e92('0x23')]['filter']+'%'};return _0x139f5c;})});}_0x719308=_[_0x1e92('0x32')]({},_0x719308,_0x3aafba['options']);var _0x326514={'where':_0x719308['where']};return db[_0x1e92('0x1f')]['count'](_0x326514)['then'](function(_0x29fcea){_0x3a9132[_0x1e92('0x13')]=_0x29fcea;if(_0x3aafba['query']['includeAll']){_0x719308['include']=[{'all':!![]}];}return db[_0x1e92('0x1f')][_0x1e92('0x35')](_0x719308);})[_0x1e92('0x1a')](function(_0x1babb5){_0x3a9132[_0x1e92('0x36')]=_0x1babb5;return _0x3a9132;})['then'](respondWithFilteredResult(_0x3b6659,_0x719308))[_0x1e92('0x37')](handleError(_0x3b6659,null));};exports['show']=function(_0x4657b7,_0x13f4f5){var _0x3e1a98={'raw':!![],'where':{'id':_0x4657b7[_0x1e92('0x38')]['id']}},_0x116b98={};_0x116b98[_0x1e92('0x21')]=_[_0x1e92('0x22')](db[_0x1e92('0x1f')]['rawAttributes']);_0x116b98[_0x1e92('0x23')]=_[_0x1e92('0x22')](_0x4657b7[_0x1e92('0x23')]);_0x116b98['filters']=_[_0x1e92('0x26')](_0x116b98[_0x1e92('0x21')],_0x116b98[_0x1e92('0x23')]);_0x3e1a98[_0x1e92('0x27')]=_['intersection'](_0x116b98[_0x1e92('0x21')],qs['fields'](_0x4657b7[_0x1e92('0x23')][_0x1e92('0x28')]));_0x3e1a98['attributes']=_0x3e1a98[_0x1e92('0x27')][_0x1e92('0x29')]?_0x3e1a98[_0x1e92('0x27')]:_0x116b98[_0x1e92('0x21')];if(_0x4657b7[_0x1e92('0x23')][_0x1e92('0x39')]){_0x3e1a98[_0x1e92('0x3a')]=[{'all':!![]}];}_0x3e1a98=_[_0x1e92('0x32')]({},_0x3e1a98,_0x4657b7['options']);return db['ChatTransferReport'][_0x1e92('0x3b')](_0x3e1a98)[_0x1e92('0x1a')](handleEntityNotFound(_0x13f4f5,null))[_0x1e92('0x1a')](respondWithResult(_0x13f4f5,null))['catch'](handleError(_0x13f4f5,null));};exports[_0x1e92('0x3c')]=function(_0xe70b4a,_0x322cf8){return db[_0x1e92('0x1f')][_0x1e92('0x3c')](_0xe70b4a[_0x1e92('0x3d')],{})[_0x1e92('0x1a')](respondWithResult(_0x322cf8,0xc9))['catch'](handleError(_0x322cf8,null));};exports[_0x1e92('0x19')]=function(_0x5d2509,_0x5a8f1c){if(_0x5d2509['body']['id']){delete _0x5d2509[_0x1e92('0x3d')]['id'];}return db['ChatTransferReport'][_0x1e92('0x3b')]({'where':{'id':_0x5d2509[_0x1e92('0x38')]['id']}})[_0x1e92('0x1a')](handleEntityNotFound(_0x5a8f1c,null))['then'](saveUpdates(_0x5d2509['body'],null))[_0x1e92('0x1a')](respondWithResult(_0x5a8f1c,null))[_0x1e92('0x37')](handleError(_0x5a8f1c,null));};exports[_0x1e92('0x3e')]=function(_0x26a8ea,_0x192b40){return db['ChatTransferReport'][_0x1e92('0x3b')]({'where':{'id':_0x26a8ea[_0x1e92('0x38')]['id']}})[_0x1e92('0x1a')](handleEntityNotFound(_0x192b40,null))[_0x1e92('0x1a')](removeEntity(_0x192b40,null))[_0x1e92('0x37')](handleError(_0x192b40,null));};exports[_0x1e92('0x3f')]=function(_0x4b3eea,_0x3c0930){return db[_0x1e92('0x1f')][_0x1e92('0x3f')]()[_0x1e92('0x1a')](respondWithResult(_0x3c0930,null))[_0x1e92('0x37')](handleError(_0x3c0930,null));}; \ No newline at end of file +var _0xc64f=['merge','map','options','includeAll','rows','catch','show','params','intersection','find','create','body','describe','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','status','error','name','send','ChatTransferReport','model','keys','query','dateStart','dateEnd','filters','attributes','fields','length','hasOwnProperty','order','sort','where','add','day','filter'];(function(_0x3a4f18,_0x1af741){var _0x4c20fc=function(_0x27115f){while(--_0x27115f){_0x3a4f18['push'](_0x3a4f18['shift']());}};_0x4c20fc(++_0x1af741);}(_0xc64f,0x15c));var _0xfc64=function(_0x49b224,_0x11fde0){_0x49b224=_0x49b224-0x0;var _0x35f73d=_0xc64f[_0x49b224];return _0x35f73d;};'use strict';var jsonpatch=require(_0xfc64('0x0'));var rp=require('request-promise');var moment=require(_0xfc64('0x1'));var BPromise=require(_0xfc64('0x2'));var Mustache=require(_0xfc64('0x3'));var util=require(_0xfc64('0x4'));var path=require(_0xfc64('0x5'));var sox=require(_0xfc64('0x6'));var csv=require(_0xfc64('0x7'));var ejs=require(_0xfc64('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfc64('0x9'));var crypto=require(_0xfc64('0xa'));var jsforce=require(_0xfc64('0xb'));var deskjs=require(_0xfc64('0xc'));var toCsv=require('to-csv');var querystring=require(_0xfc64('0xd'));var Papa=require(_0xfc64('0xe'));var qs=require(_0xfc64('0xf'));var logger=require(_0xfc64('0x10'))(_0xfc64('0x11'));var utils=require('../../config/utils');var config=require(_0xfc64('0x12'));var db=require(_0xfc64('0x13'))['db'];function respondWithStatusCode(_0x47ad64,_0x1213ca){_0x1213ca=_0x1213ca||0xcc;return function(_0xfc731e){if(_0xfc731e){return _0x47ad64[_0xfc64('0x14')](_0x1213ca);}return _0x47ad64['status'](_0x1213ca)[_0xfc64('0x15')]();};}function respondWithResult(_0x269cbe,_0x23cb74){_0x23cb74=_0x23cb74||0xc8;return function(_0x525d6c){if(_0x525d6c){return _0x269cbe['status'](_0x23cb74)[_0xfc64('0x16')](_0x525d6c);}};}function respondWithFilteredResult(_0x2a25b6,_0x267ae2){return function(_0x17225c){if(_0x17225c){var _0x59827e=_0x17225c[_0xfc64('0x17')],_0x1075e2=_0x267ae2[_0xfc64('0x18')],_0x2a3373=_0x267ae2[_0xfc64('0x18')]+_0x267ae2[_0xfc64('0x19')],_0x541d4b;if(_0x2a3373>=_0x59827e){_0x2a3373=_0x59827e;_0x541d4b=0xc8;}else{_0x541d4b=0xce;}_0x2a25b6['status'](_0x541d4b);return _0x2a25b6['set'](_0xfc64('0x1a'),_0x1075e2+'-'+_0x2a3373+'/'+_0x59827e)[_0xfc64('0x16')](_0x17225c);}return null;};}function patchUpdates(_0x4b6671){return function(_0x3423c0){try{jsonpatch[_0xfc64('0x1b')](_0x3423c0,_0x4b6671,!![]);}catch(_0x149d04){return BPromise[_0xfc64('0x1c')](_0x149d04);}return _0x3423c0[_0xfc64('0x1d')]();};}function saveUpdates(_0x21331c,_0x47671f){return function(_0x1689a0){if(_0x1689a0){return _0x1689a0[_0xfc64('0x1e')](_0x21331c)[_0xfc64('0x1f')](function(_0x534ada){return _0x534ada;});}return null;};}function removeEntity(_0x1315ca,_0x16e0e5){return function(_0x11a3bd){if(_0x11a3bd){return _0x11a3bd[_0xfc64('0x20')]()[_0xfc64('0x1f')](function(){_0x1315ca[_0xfc64('0x21')](0xcc)[_0xfc64('0x15')]();});}};}function handleEntityNotFound(_0x3c3bb1,_0x38fa21){return function(_0x57383b){if(!_0x57383b){_0x3c3bb1['sendStatus'](0x194);}return _0x57383b;};}function handleError(_0x5e4e2e,_0x3a4edc){_0x3a4edc=_0x3a4edc||0x1f4;return function(_0x30d967){logger[_0xfc64('0x22')](_0x30d967['stack']);if(_0x30d967[_0xfc64('0x23')]){delete _0x30d967['name'];}_0x5e4e2e[_0xfc64('0x21')](_0x3a4edc)[_0xfc64('0x24')](_0x30d967);};}exports['index']=function(_0x57a3a0,_0x1fdb2b){var _0x4d14d0={},_0x26b71a={},_0x435784={'count':0x0,'rows':[]};var _0x33249d=db[_0xfc64('0x25')]['rawAttributes'];_0x26b71a[_0xfc64('0x26')]=_[_0xfc64('0x27')](_0x33249d);var _0x4d478d={'dateStart':_0x57a3a0[_0xfc64('0x28')][_0xfc64('0x29')],'dateEnd':_0x57a3a0[_0xfc64('0x28')][_0xfc64('0x2a')]};delete _0x57a3a0['query'][_0xfc64('0x29')];delete _0x57a3a0[_0xfc64('0x28')][_0xfc64('0x2a')];_0x26b71a[_0xfc64('0x28')]=_[_0xfc64('0x27')](_0x57a3a0['query']);_0x26b71a[_0xfc64('0x2b')]=_['intersection'](_0x26b71a[_0xfc64('0x26')],_0x26b71a[_0xfc64('0x28')]);_0x4d14d0[_0xfc64('0x2c')]=_['intersection'](_0x26b71a[_0xfc64('0x26')],qs['fields'](_0x57a3a0[_0xfc64('0x28')][_0xfc64('0x2d')]));_0x4d14d0[_0xfc64('0x2c')]=_0x4d14d0[_0xfc64('0x2c')][_0xfc64('0x2e')]?_0x4d14d0['attributes']:_0x26b71a[_0xfc64('0x26')];if(!_0x57a3a0['query'][_0xfc64('0x2f')]('nolimit')){_0x4d14d0[_0xfc64('0x19')]=qs[_0xfc64('0x19')](_0x57a3a0[_0xfc64('0x28')]['limit']);_0x4d14d0[_0xfc64('0x18')]=qs[_0xfc64('0x18')](_0x57a3a0[_0xfc64('0x28')]['offset']);}_0x4d14d0[_0xfc64('0x30')]=qs[_0xfc64('0x31')](_0x57a3a0[_0xfc64('0x28')][_0xfc64('0x31')]);_0x4d14d0[_0xfc64('0x32')]=qs[_0xfc64('0x2b')](_['pick'](_0x57a3a0[_0xfc64('0x28')],_0x26b71a[_0xfc64('0x2b')]));if(_0x4d478d['dateStart']){if(_0x4d478d[_0xfc64('0x2a')]){_0x4d478d[_0xfc64('0x2a')]=moment(_0x4d478d[_0xfc64('0x2a')])[_0xfc64('0x33')](0x1,'day');}else{_0x4d478d[_0xfc64('0x2a')]=moment(_0x4d478d[_0xfc64('0x29')])[_0xfc64('0x33')](0x1,_0xfc64('0x34'));}_['merge'](_0x4d14d0['where'],{'createdAt':{'$gte':_0x4d478d[_0xfc64('0x29')],'$lte':_0x4d478d[_0xfc64('0x2a')]}});}if(_0x57a3a0[_0xfc64('0x28')][_0xfc64('0x35')]){_0x4d14d0[_0xfc64('0x32')]=_[_0xfc64('0x36')](_0x4d14d0['where'],{'$or':_[_0xfc64('0x37')](_0x4d14d0[_0xfc64('0x2c')],function(_0x16eea9){var _0xbde4bc={};_0xbde4bc[_0x16eea9]={'$like':'%'+_0x57a3a0['query'][_0xfc64('0x35')]+'%'};return _0xbde4bc;})});}_0x4d14d0=_[_0xfc64('0x36')]({},_0x4d14d0,_0x57a3a0[_0xfc64('0x38')]);var _0x472895={'where':_0x4d14d0[_0xfc64('0x32')]};return db['ChatTransferReport']['count'](_0x472895)[_0xfc64('0x1f')](function(_0x526eab){_0x435784[_0xfc64('0x17')]=_0x526eab;if(_0x57a3a0[_0xfc64('0x28')][_0xfc64('0x39')]){_0x4d14d0['include']=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0x4d14d0);})[_0xfc64('0x1f')](function(_0x16e196){_0x435784[_0xfc64('0x3a')]=_0x16e196;return _0x435784;})[_0xfc64('0x1f')](respondWithFilteredResult(_0x1fdb2b,_0x4d14d0))[_0xfc64('0x3b')](handleError(_0x1fdb2b,null));};exports[_0xfc64('0x3c')]=function(_0x1c5e9e,_0x4c2143){var _0x3614d8={'raw':!![],'where':{'id':_0x1c5e9e[_0xfc64('0x3d')]['id']}},_0x3db706={};_0x3db706['model']=_['keys'](db[_0xfc64('0x25')]['rawAttributes']);_0x3db706[_0xfc64('0x28')]=_[_0xfc64('0x27')](_0x1c5e9e[_0xfc64('0x28')]);_0x3db706['filters']=_[_0xfc64('0x3e')](_0x3db706['model'],_0x3db706['query']);_0x3614d8[_0xfc64('0x2c')]=_['intersection'](_0x3db706[_0xfc64('0x26')],qs['fields'](_0x1c5e9e[_0xfc64('0x28')][_0xfc64('0x2d')]));_0x3614d8[_0xfc64('0x2c')]=_0x3614d8[_0xfc64('0x2c')]['length']?_0x3614d8[_0xfc64('0x2c')]:_0x3db706[_0xfc64('0x26')];if(_0x1c5e9e[_0xfc64('0x28')][_0xfc64('0x39')]){_0x3614d8['include']=[{'all':!![]}];}_0x3614d8=_[_0xfc64('0x36')]({},_0x3614d8,_0x1c5e9e[_0xfc64('0x38')]);return db[_0xfc64('0x25')][_0xfc64('0x3f')](_0x3614d8)[_0xfc64('0x1f')](handleEntityNotFound(_0x4c2143,null))['then'](respondWithResult(_0x4c2143,null))[_0xfc64('0x3b')](handleError(_0x4c2143,null));};exports[_0xfc64('0x40')]=function(_0x5c11fe,_0x490427){return db[_0xfc64('0x25')][_0xfc64('0x40')](_0x5c11fe[_0xfc64('0x41')],{})[_0xfc64('0x1f')](respondWithResult(_0x490427,0xc9))['catch'](handleError(_0x490427,null));};exports[_0xfc64('0x1e')]=function(_0x5036ee,_0x30d1ca){if(_0x5036ee[_0xfc64('0x41')]['id']){delete _0x5036ee['body']['id'];}return db[_0xfc64('0x25')][_0xfc64('0x3f')]({'where':{'id':_0x5036ee['params']['id']}})[_0xfc64('0x1f')](handleEntityNotFound(_0x30d1ca,null))['then'](saveUpdates(_0x5036ee[_0xfc64('0x41')],null))['then'](respondWithResult(_0x30d1ca,null))['catch'](handleError(_0x30d1ca,null));};exports['destroy']=function(_0x3ae532,_0x49cece){return db[_0xfc64('0x25')]['find']({'where':{'id':_0x3ae532['params']['id']}})[_0xfc64('0x1f')](handleEntityNotFound(_0x49cece,null))[_0xfc64('0x1f')](removeEntity(_0x49cece,null))[_0xfc64('0x3b')](handleError(_0x49cece,null));};exports['describe']=function(_0x1d117a,_0x35d73c){return db[_0xfc64('0x25')][_0xfc64('0x42')]()[_0xfc64('0x1f')](respondWithResult(_0x35d73c,null))['catch'](handleError(_0x35d73c,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index fab1f2b..c80f518 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 _0x8bb8=['bluebird','request-promise','./chatTransferReport.attributes','exports','define','uniqueid','lodash','util','api','moment'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x8bb8,0x6a));var _0x88bb=function(_0x48ff71,_0x590466){_0x48ff71=_0x48ff71-0x0;var _0x248125=_0x8bb8[_0x48ff71];return _0x248125;};'use strict';var _=require(_0x88bb('0x0'));var util=require(_0x88bb('0x1'));var logger=require('../../config/logger')(_0x88bb('0x2'));var moment=require(_0x88bb('0x3'));var BPromise=require(_0x88bb('0x4'));var rp=require(_0x88bb('0x5'));var attributes=require(_0x88bb('0x6'));module[_0x88bb('0x7')]=function(_0x80f05b,_0x51c632){return _0x80f05b[_0x88bb('0x8')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x88bb('0x9'),'fields':[_0x88bb('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x47a5=['uniqueid','lodash','api','bluebird','request-promise','./chatTransferReport.attributes','define','report_chat_transfer'];(function(_0xca7b0b,_0x11c8eb){var _0x23d563=function(_0x5258d8){while(--_0x5258d8){_0xca7b0b['push'](_0xca7b0b['shift']());}};_0x23d563(++_0x11c8eb);}(_0x47a5,0x109));var _0x547a=function(_0x8e9235,_0x552ac0){_0x8e9235=_0x8e9235-0x0;var _0x385465=_0x47a5[_0x8e9235];return _0x385465;};'use strict';var _=require(_0x547a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x547a('0x1'));var moment=require('moment');var BPromise=require(_0x547a('0x2'));var rp=require(_0x547a('0x3'));var attributes=require(_0x547a('0x4'));module['exports']=function(_0x531e52,_0x3d0b84){return _0x531e52[_0x547a('0x5')]('ChatTransferReport',attributes,{'tableName':_0x547a('0x6'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x547a('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 70b3333..b1a4e5d 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 _0xc540=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','../../config/logger'];(function(_0xe252de,_0x4e1285){var _0x3b4427=function(_0x2dcfd5){while(--_0x2dcfd5){_0xe252de['push'](_0xe252de['shift']());}};_0x3b4427(++_0x4e1285);}(_0xc540,0x135));var _0x0c54=function(_0x40cc71,_0x27014f){_0x40cc71=_0x40cc71-0x0;var _0x546098=_0xc540[_0x40cc71];return _0x546098;};'use strict';var _=require(_0x0c54('0x0'));var util=require(_0x0c54('0x1'));var moment=require(_0x0c54('0x2'));var BPromise=require(_0x0c54('0x3'));var rs=require(_0x0c54('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0c54('0x5'))(_0x0c54('0x6'));var config=require(_0x0c54('0x7'));var jayson=require(_0x0c54('0x8'));var client=jayson[_0x0c54('0x9')][_0x0c54('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x358155,_0x1112c6,_0x2ed884){return new BPromise(function(_0x58e10e,_0xbc92db){return client[_0x0c54('0xb')](_0x358155,_0x2ed884)[_0x0c54('0xc')](function(_0x58615a){logger[_0x0c54('0xd')](_0x0c54('0xe'),_0x1112c6,_0x0c54('0xf'));logger[_0x0c54('0x10')](_0x0c54('0x11'),_0x1112c6,_0x0c54('0xf'),JSON['stringify'](_0x58615a));if(_0x58615a['error']){if(_0x58615a['error']['code']===0x1f4){logger[_0x0c54('0x12')](_0x0c54('0xe'),_0x1112c6,_0x58615a[_0x0c54('0x12')][_0x0c54('0x13')]);return _0xbc92db(_0x58615a[_0x0c54('0x12')]['message']);}logger[_0x0c54('0x12')](_0x0c54('0xe'),_0x1112c6,_0x58615a[_0x0c54('0x12')][_0x0c54('0x13')]);return _0x58e10e(_0x58615a[_0x0c54('0x12')][_0x0c54('0x13')]);}else{logger[_0x0c54('0xd')](_0x0c54('0xe'),_0x1112c6,'request\x20sent');_0x58e10e(_0x58615a[_0x0c54('0x14')][_0x0c54('0x13')]);}})['catch'](function(_0x97b4c1){logger[_0x0c54('0x12')](_0x0c54('0xe'),_0x1112c6,_0x97b4c1);_0xbc92db(_0x97b4c1);});});} \ No newline at end of file +var _0x8c3e=['ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x59881a,_0x5ef668){var _0x33a221=function(_0x396188){while(--_0x396188){_0x59881a['push'](_0x59881a['shift']());}};_0x33a221(++_0x5ef668);}(_0x8c3e,0x140));var _0xe8c3=function(_0x50667a,_0x86eb28){_0x50667a=_0x50667a-0x0;var _0x4987e5=_0x8c3e[_0x50667a];return _0x4987e5;};'use strict';var _=require(_0xe8c3('0x0'));var util=require(_0xe8c3('0x1'));var moment=require(_0xe8c3('0x2'));var BPromise=require(_0xe8c3('0x3'));var rs=require(_0xe8c3('0x4'));var fs=require('fs');var db=require(_0xe8c3('0x5'))['db'];var utils=require(_0xe8c3('0x6'));var logger=require(_0xe8c3('0x7'))(_0xe8c3('0x8'));var config=require(_0xe8c3('0x9'));var jayson=require(_0xe8c3('0xa'));var client=jayson[_0xe8c3('0xb')][_0xe8c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f20ba,_0x21c58d,_0xa82cb4){return new BPromise(function(_0x557c2e,_0x40edab){return client[_0xe8c3('0xd')](_0x4f20ba,_0xa82cb4)[_0xe8c3('0xe')](function(_0x4ce7ff){logger[_0xe8c3('0xf')](_0xe8c3('0x10'),_0x21c58d,_0xe8c3('0x11'));logger['debug'](_0xe8c3('0x12'),_0x21c58d,_0xe8c3('0x11'),JSON[_0xe8c3('0x13')](_0x4ce7ff));if(_0x4ce7ff['error']){if(_0x4ce7ff[_0xe8c3('0x14')][_0xe8c3('0x15')]===0x1f4){logger['error'](_0xe8c3('0x10'),_0x21c58d,_0x4ce7ff['error']['message']);return _0x40edab(_0x4ce7ff[_0xe8c3('0x14')][_0xe8c3('0x16')]);}logger[_0xe8c3('0x14')](_0xe8c3('0x10'),_0x21c58d,_0x4ce7ff[_0xe8c3('0x14')][_0xe8c3('0x16')]);return _0x557c2e(_0x4ce7ff['error'][_0xe8c3('0x16')]);}else{logger[_0xe8c3('0xf')](_0xe8c3('0x10'),_0x21c58d,'request\x20sent');_0x557c2e(_0x4ce7ff[_0xe8c3('0x17')]['message']);}})['catch'](function(_0x1d6ce3){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x21c58d,_0x1d6ce3);_0x40edab(_0x1d6ce3);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index bf0bb3c..499afce 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 _0xe706=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0xe706,0xa3));var _0x6e70=function(_0x274d4b,_0x128681){_0x274d4b=_0x274d4b-0x0;var _0x1a1f03=_0xe706[_0x274d4b];return _0x1a1f03;};'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('0xf')]('/',auth[_0x6e70('0x9')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')](_0x6e70('0xd'),auth[_0x6e70('0x9')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0x4fc2=['show','post','create','put','update','delete','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id'];(function(_0x1ff575,_0xdba21f){var _0x48fc9e=function(_0x51cf97){while(--_0x51cf97){_0x1ff575['push'](_0x1ff575['shift']());}};_0x48fc9e(++_0xdba21f);}(_0x4fc2,0x111));var _0x24fc=function(_0x7aee79,_0x124af2){_0x7aee79=_0x7aee79-0x0;var _0xcbf9d1=_0x4fc2[_0x7aee79];return _0xcbf9d1;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var express=require(_0x24fc('0x3'));var router=express['Router']();var auth=require(_0x24fc('0x4'));var interaction=require(_0x24fc('0x5'));var config=require(_0x24fc('0x6'));var controller=require('./chatTransferReport.controller');router[_0x24fc('0x7')]('/',auth[_0x24fc('0x8')](),controller['index']);router[_0x24fc('0x7')](_0x24fc('0x9'),auth['isAuthenticated'](),controller[_0x24fc('0xa')]);router[_0x24fc('0x7')](_0x24fc('0xb'),auth[_0x24fc('0x8')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth['isAuthenticated'](),controller[_0x24fc('0xe')]);router[_0x24fc('0xf')](_0x24fc('0xb'),auth[_0x24fc('0x8')](),controller[_0x24fc('0x10')]);router[_0x24fc('0x11')](_0x24fc('0xb'),auth[_0x24fc('0x8')](),controller['destroy']);module[_0x24fc('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index b85553f..181f75a 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 _0xa282=['We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea','Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','#fafafa','System','sequelize','randomstring','exports','STRING','address','email','#9f946a','#ffffff','INTEGER','BOOLEAN','ENUM','rounded'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa282,0x189));var _0x2a28=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xa282[_0x82129b];return _0x2ae5dc;};'use strict';var Sequelize=require(_0x2a28('0x0'));var rs=require(_0x2a28('0x1'));module[_0x2a28('0x2')]={'name':{'type':Sequelize[_0x2a28('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x2a28('0x3')],'allowNull':![],'unique':_0x2a28('0x4')},'description':{'type':Sequelize[_0x2a28('0x3')]},'mapKey':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0x5')},'mapKeyOffline':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0x5')},'key':{'type':Sequelize[_0x2a28('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x2a28('0x3')],'allowNull':![],'defaultValue':_0x2a28('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x2a28('0x3')],'allowNull':![],'defaultValue':_0x2a28('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2a28('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x2a28('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x2a28('0x3')]},'animation':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x2a28('0xa')](_0x2a28('0xb'),'squared'),'defaultValue':_0x2a28('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x2a28('0xc')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x2a28('0xd')},'offline_chat_button':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0xe')},'header_offline':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0xf')},'download_transcript':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x2a28('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x2a28('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x2a28('0x11')]},'closingQuestion':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0x12')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x2a28('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0x14')},'placeholderMessage':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0x15')},'closingMessageButton':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0xe')},'skipMessageButton':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0x16')},'conditionAgreement':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':![]},'ratingType':{'type':Sequelize[_0x2a28('0xa')](_0x2a28('0x17'),_0x2a28('0x18')),'defaultValue':_0x2a28('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x2a28('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x2a28('0x19')]({'items':[{'type':_0x2a28('0x1a'),'variable':null,'config':{'placeholder':_0x2a28('0x1b'),'type':_0x2a28('0x1c'),'required':!![]},'props':{'title':_0x2a28('0x1b'),'helpText':''}},{'type':_0x2a28('0x1a'),'props':{'title':_0x2a28('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x2a28('0x5'),'type':_0x2a28('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x2a28('0x1d')](_0x2a28('0x1e'))?JSON[_0x2a28('0x1f')](this[_0x2a28('0x1d')](_0x2a28('0x1e'))):{};},'set':function(_0x1d2e90){return this[_0x2a28('0x20')](_0x2a28('0x1e'),JSON[_0x2a28('0x19')](_0x1d2e90));}},'offlineForm':{'type':Sequelize[_0x2a28('0x11')],'defaultValue':function(){return JSON[_0x2a28('0x19')]({'items':[{'type':_0x2a28('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x2a28('0x5'),'type':_0x2a28('0x5')},'variable':null},{'type':_0x2a28('0x21'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0x2a28('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x2a28('0x1d')](_0x2a28('0x23'))?JSON[_0x2a28('0x1f')](this[_0x2a28('0x1d')]('offlineForm')):{};},'set':function(_0x11901c){return this[_0x2a28('0x20')](_0x2a28('0x23'),JSON[_0x2a28('0x19')](_0x11901c));}},'token':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':function(){return rs[_0x2a28('0x24')]();}},'autoclose':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x2a28('0x3')]},'forwardOffline':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0x26')},'offlineMessageBody':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x2a28('0x16')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x2a28('0xe')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x2a28('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x2a28('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x2a28('0x28');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x2a28('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0x29')},'verticalAlignment':{'type':Sequelize[_0x2a28('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0x2a')},'defaultTitle':{'type':Sequelize[_0x2a28('0x3')]},'customerAvatar':{'type':Sequelize[_0x2a28('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x2a28('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2a28('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2a28('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2a28('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0x2c')},'systemAvatar':{'type':Sequelize[_0x2a28('0x11')]}}; \ No newline at end of file +var _0x43ce=['Comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','System','sequelize','randomstring','exports','STRING','email','Agent','#9f946a','#ffffff','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','thumb','star','stringify','input','name','getDataValue','onlineForm','parse','setDataValue','textarea'];(function(_0x3f3f06,_0x581e5b){var _0x140feb=function(_0x4cc383){while(--_0x4cc383){_0x3f3f06['push'](_0x3f3f06['shift']());}};_0x140feb(++_0x581e5b);}(_0x43ce,0x16a));var _0xe43c=function(_0xccbfd6,_0xa4ed8a){_0xccbfd6=_0xccbfd6-0x0;var _0x44d115=_0x43ce[_0xccbfd6];return _0x44d115;};'use strict';var Sequelize=require(_0xe43c('0x0'));var rs=require(_0xe43c('0x1'));module[_0xe43c('0x2')]={'name':{'type':Sequelize[_0xe43c('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xe43c('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xe43c('0x3')],'defaultValue':_0xe43c('0x4')},'mapKeyOffline':{'type':Sequelize[_0xe43c('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0xe43c('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xe43c('0x3')],'defaultValue':_0xe43c('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xe43c('0x3')],'allowNull':![],'defaultValue':_0xe43c('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe43c('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xe43c('0x3')],'allowNull':![],'defaultValue':_0xe43c('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xe43c('0x3')]},'animation':{'type':Sequelize[_0xe43c('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xe43c('0x9')](_0xe43c('0xa'),'squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xe43c('0x3')],'defaultValue':_0xe43c('0xb')},'start_chat_button':{'type':Sequelize[_0xe43c('0x3')],'defaultValue':_0xe43c('0xc')},'offline_chat_button':{'type':Sequelize[_0xe43c('0x3')],'defaultValue':_0xe43c('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xe43c('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xe43c('0xf')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xe43c('0x3')],'defaultValue':_0xe43c('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0xe43c('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xe43c('0x11')]},'closingQuestion':{'type':Sequelize[_0xe43c('0x3')],'defaultValue':_0xe43c('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0xe43c('0x3')],'defaultValue':_0xe43c('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0xe43c('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xe43c('0x14')},'placeholderMessage':{'type':Sequelize[_0xe43c('0x3')],'defaultValue':_0xe43c('0x15')},'closingMessage':{'type':Sequelize[_0xe43c('0x3')],'defaultValue':_0xe43c('0x16')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xe43c('0xd')},'skipMessageButton':{'type':Sequelize[_0xe43c('0x3')],'defaultValue':_0xe43c('0x17')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xe43c('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xe43c('0x8')],'defaultValue':![]},'ratingType':{'type':Sequelize['ENUM']('star',_0xe43c('0x18')),'defaultValue':_0xe43c('0x19')},'ratingStarsNumber':{'type':Sequelize[_0xe43c('0xf')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xe43c('0x11')],'defaultValue':function(){return JSON[_0xe43c('0x1a')]({'items':[{'type':_0xe43c('0x1b'),'variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':_0xe43c('0x1c'),'helpText':''}},{'type':_0xe43c('0x1b'),'props':{'title':_0xe43c('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xe43c('0x4'),'type':_0xe43c('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xe43c('0x1d')](_0xe43c('0x1e'))?JSON[_0xe43c('0x1f')](this[_0xe43c('0x1d')](_0xe43c('0x1e'))):{};},'set':function(_0x3eb985){return this[_0xe43c('0x20')](_0xe43c('0x1e'),JSON[_0xe43c('0x1a')](_0x3eb985));}},'offlineForm':{'type':Sequelize[_0xe43c('0x11')],'defaultValue':function(){return JSON[_0xe43c('0x1a')]({'items':[{'type':_0xe43c('0x1b'),'props':{'title':_0xe43c('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xe43c('0x4'),'type':_0xe43c('0x4')},'variable':null},{'type':_0xe43c('0x21'),'config':{'placeholder':_0xe43c('0x22')},'props':{'title':_0xe43c('0x22'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xe43c('0x23'))?JSON[_0xe43c('0x1f')](this['getDataValue'](_0xe43c('0x23'))):{};},'set':function(_0x367285){return this[_0xe43c('0x20')](_0xe43c('0x23'),JSON['stringify'](_0x367285));}},'token':{'type':Sequelize[_0xe43c('0x3')],'defaultValue':function(){return rs[_0xe43c('0x24')]();}},'autoclose':{'type':Sequelize[_0xe43c('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xe43c('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xe43c('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xe43c('0x3')]},'forwardOffline':{'type':Sequelize[_0xe43c('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xe43c('0x3')]},'waitingTitle':{'type':Sequelize[_0xe43c('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xe43c('0x3')],'defaultValue':_0xe43c('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xe43c('0x3')],'defaultValue':_0xe43c('0x26')},'offlineMessageBody':{'type':Sequelize[_0xe43c('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xe43c('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xe43c('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xe43c('0x3')],'defaultValue':_0xe43c('0xd')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xe43c('0x11')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xe43c('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xe43c('0x27');}},'notificationSound':{'type':Sequelize[_0xe43c('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xe43c('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0xe43c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xe43c('0x3')],'defaultValue':_0xe43c('0x29')},'verticalAlignment':{'type':Sequelize[_0xe43c('0xf')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xe43c('0x3')],'defaultValue':_0xe43c('0x2a')},'defaultTitle':{'type':Sequelize[_0xe43c('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xe43c('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xe43c('0xf')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xe43c('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe43c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe43c('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xe43c('0x2b')},'systemAvatar':{'type':Sequelize[_0xe43c('0x11')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 88f0e20..b3013fc 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 _0x64d4=['custom','isNil','existsSync','root','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','download','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','setUA','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','ChatApplication','account','Applications','list','applications','orderBy','priority','asc','defaults','contact','firstName','referer','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','type','threadId','externalUrl','ContactId','interaction','ChatInteraction','lastName','get','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','EventManager','offline','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','user','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','Owner','internal','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','getLicense','License','increment','chatLicenseExceeded','all','readFileSync','server/files/chat/iframe.js','headers','x-forwarded-for','x-real-ip','remoteAddress','virtual','replace','alignment','verticalAlignment','addApplications','transaction','bulkCreate','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','false','onlineForm','fromKey','getOfflineMessages','addAgents','removeAgents','emit','userChatWebsite:remove','getAgents','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./chatWebsite.socket','register','jayson/promise','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','model','keys','query','dateEnd','dateStart','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','day','add','merge','where','filter','map','options','ChatWebsite','rows','show','params','rawAttributes','length','includeAll','create','body','find','describe','ChatWebsiteId','getDispositions','findOne','Disposition','order','include','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic','filename','agentAvatar','customerAvatar','addSystemAvatar','file','getLogo','join','../../config/license/util'];(function(_0x3e8be5,_0x2e69c4){var _0x1defa5=function(_0x56f9fc){while(--_0x56f9fc){_0x3e8be5['push'](_0x3e8be5['shift']());}};_0x1defa5(++_0x2e69c4);}(_0x64d4,0xa2));var _0x464d=function(_0x1f6fd8,_0xcbe574){_0x1f6fd8=_0x1f6fd8-0x0;var _0x3c6790=_0x64d4[_0x1f6fd8];return _0x3c6790;};'use strict';var jsonpatch=require(_0x464d('0x0'));var rp=require(_0x464d('0x1'));var moment=require('moment');var BPromise=require(_0x464d('0x2'));var Mustache=require(_0x464d('0x3'));var util=require('util');var path=require('path');var sox=require(_0x464d('0x4'));var csv=require('to-csv');var ejs=require(_0x464d('0x5'));var fs=require('fs');var _=require(_0x464d('0x6'));var squel=require(_0x464d('0x7'));var crypto=require('crypto');var jsforce=require(_0x464d('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x464d('0x9'));var querystring=require(_0x464d('0xa'));var Papa=require(_0x464d('0xb'));var qs=require(_0x464d('0xc'));var logger=require(_0x464d('0xd'))(_0x464d('0xe'));var utils=require(_0x464d('0xf'));var config=require(_0x464d('0x10'));var db=require(_0x464d('0x11'))['db'];var socket=require(_0x464d('0x12'))({'host':_0x464d('0x13'),'port':0x18eb});require(_0x464d('0x14'))[_0x464d('0x15')](socket);var jayson=require(_0x464d('0x16'));var client=jayson[_0x464d('0x17')][_0x464d('0x18')]({'port':0x232c});var client9002=jayson['client'][_0x464d('0x18')]({'port':0x232a});var client9003=jayson[_0x464d('0x17')]['http']({'port':0x232b});function respondWithRpcPromise(_0x339b30,_0x1c211f,_0x179a66,_0x4cfcc1){return new BPromise(function(_0x155a51,_0x3dc9e9){var _0x42c233=_0x4cfcc1||client;return _0x42c233[_0x464d('0x19')](_0x339b30,_0x179a66)['then'](function(_0x26d8e3){logger[_0x464d('0x1a')](_0x464d('0x1b'),_0x1c211f,_0x464d('0x1c'));logger[_0x464d('0x1d')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1c211f,_0x464d('0x1c'),JSON[_0x464d('0x1e')](_0x26d8e3));if(_0x26d8e3[_0x464d('0x1f')]){if(_0x26d8e3[_0x464d('0x1f')][_0x464d('0x20')]===0x1f4){logger['error'](_0x464d('0x1b'),_0x1c211f,_0x26d8e3[_0x464d('0x1f')][_0x464d('0x21')]);return _0x3dc9e9(_0x26d8e3[_0x464d('0x1f')]['message']);}logger[_0x464d('0x1f')]('ChatWebsite,\x20%s,\x20%s',_0x1c211f,_0x26d8e3[_0x464d('0x1f')][_0x464d('0x21')]);return _0x155a51(_0x26d8e3[_0x464d('0x1f')][_0x464d('0x21')]);}else{logger[_0x464d('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x1c211f,_0x464d('0x1c'));_0x155a51(_0x26d8e3[_0x464d('0x22')][_0x464d('0x21')]);}})[_0x464d('0x23')](function(_0x3b8e92){logger[_0x464d('0x1f')](_0x464d('0x1b'),_0x1c211f,_0x3b8e92);_0x3dc9e9(_0x3b8e92);});});}function respondWithStatusCode(_0x184cc3,_0x1b2edc){_0x1b2edc=_0x1b2edc||0xcc;return function(_0x4a1c74){if(_0x4a1c74){return _0x184cc3[_0x464d('0x24')](_0x1b2edc);}return _0x184cc3['status'](_0x1b2edc)[_0x464d('0x25')]();};}function respondWithResult(_0x16eb17,_0x5dce07){_0x5dce07=_0x5dce07||0xc8;return function(_0x3d5edc){if(_0x3d5edc){return _0x16eb17[_0x464d('0x26')](_0x5dce07)[_0x464d('0x27')](_0x3d5edc);}};}function respondWithFilteredResult(_0x1978f5,_0x8ff74d){return function(_0x5b4350){if(_0x5b4350){var _0x2678fa=_0x5b4350[_0x464d('0x28')],_0x1e6909=_0x8ff74d[_0x464d('0x29')],_0xcc1e84=_0x8ff74d[_0x464d('0x29')]+_0x8ff74d[_0x464d('0x2a')],_0x29f00f;if(_0xcc1e84>=_0x2678fa){_0xcc1e84=_0x2678fa;_0x29f00f=0xc8;}else{_0x29f00f=0xce;}_0x1978f5[_0x464d('0x26')](_0x29f00f);return _0x1978f5[_0x464d('0x2b')](_0x464d('0x2c'),_0x1e6909+'-'+_0xcc1e84+'/'+_0x2678fa)[_0x464d('0x27')](_0x5b4350);}return null;};}function patchUpdates(_0x10ec49){return function(_0x59a916){try{jsonpatch[_0x464d('0x2d')](_0x59a916,_0x10ec49,!![]);}catch(_0x4f8505){return BPromise[_0x464d('0x2e')](_0x4f8505);}return _0x59a916[_0x464d('0x2f')]();};}function saveUpdates(_0x346238,_0xbdd7be){return function(_0x2ca59e){if(_0x2ca59e){return _0x2ca59e[_0x464d('0x30')](_0x346238)['then'](function(_0x462749){return _0x462749;});}return null;};}function removeEntity(_0x3800ef,_0x292816){return function(_0x31d21c){if(_0x31d21c){return _0x31d21c[_0x464d('0x31')]()[_0x464d('0x32')](function(){_0x3800ef['status'](0xcc)[_0x464d('0x25')]();});}};}function handleEntityNotFound(_0x972d44,_0x368f20){return function(_0x2e5aa4){if(!_0x2e5aa4){_0x972d44[_0x464d('0x24')](0x194);}return _0x2e5aa4;};}function handleError(_0x3aa138,_0x49d3da){_0x49d3da=_0x49d3da||0x1f4;return function(_0x1f3bef){logger[_0x464d('0x1f')](_0x1f3bef[_0x464d('0x33')]);if(_0x1f3bef['name']){delete _0x1f3bef[_0x464d('0x34')];}_0x3aa138[_0x464d('0x26')](_0x49d3da)[_0x464d('0x35')](_0x1f3bef);};}exports[_0x464d('0x36')]=function(_0x41cc7f,_0x3a4cd7){var _0x43791f={},_0x29c73c={},_0x2d6afb={'count':0x0,'rows':[]};var _0xa9756c=db['ChatWebsite']['rawAttributes'];_0x29c73c[_0x464d('0x37')]=_[_0x464d('0x38')](_0xa9756c);var _0x135708={'dateStart':_0x41cc7f[_0x464d('0x39')]['dateStart'],'dateEnd':_0x41cc7f[_0x464d('0x39')][_0x464d('0x3a')]};delete _0x41cc7f[_0x464d('0x39')][_0x464d('0x3b')];delete _0x41cc7f[_0x464d('0x39')][_0x464d('0x3a')];_0x29c73c[_0x464d('0x39')]=_[_0x464d('0x38')](_0x41cc7f[_0x464d('0x39')]);_0x29c73c['filters']=_[_0x464d('0x3c')](_0x29c73c['model'],_0x29c73c['query']);_0x43791f[_0x464d('0x3d')]=_[_0x464d('0x3c')](_0x29c73c[_0x464d('0x37')],qs[_0x464d('0x3e')](_0x41cc7f[_0x464d('0x39')]['fields']));_0x43791f[_0x464d('0x3d')]=_0x43791f[_0x464d('0x3d')]['length']?_0x43791f[_0x464d('0x3d')]:_0x29c73c[_0x464d('0x37')];if(!_0x41cc7f[_0x464d('0x39')][_0x464d('0x3f')](_0x464d('0x40'))){_0x43791f[_0x464d('0x2a')]=qs[_0x464d('0x2a')](_0x41cc7f[_0x464d('0x39')][_0x464d('0x2a')]);_0x43791f[_0x464d('0x29')]=qs['offset'](_0x41cc7f['query'][_0x464d('0x29')]);}_0x43791f['order']=qs[_0x464d('0x41')](_0x41cc7f[_0x464d('0x39')][_0x464d('0x41')]);_0x43791f['where']=qs[_0x464d('0x42')](_[_0x464d('0x43')](_0x41cc7f['query'],_0x29c73c[_0x464d('0x42')]));if(_0x135708[_0x464d('0x3b')]){if(_0x135708[_0x464d('0x3a')]){_0x135708[_0x464d('0x3a')]=moment(_0x135708[_0x464d('0x3a')])['add'](0x1,_0x464d('0x44'));}else{_0x135708[_0x464d('0x3a')]=moment(_0x135708[_0x464d('0x3b')])[_0x464d('0x45')](0x1,_0x464d('0x44'));}_[_0x464d('0x46')](_0x43791f[_0x464d('0x47')],{'createdAt':{'$gte':_0x135708[_0x464d('0x3b')],'$lte':_0x135708[_0x464d('0x3a')]}});}if(_0x41cc7f[_0x464d('0x39')][_0x464d('0x48')]){_0x43791f[_0x464d('0x47')]=_[_0x464d('0x46')](_0x43791f[_0x464d('0x47')],{'$or':_[_0x464d('0x49')](_0x43791f['attributes'],function(_0x27181f){var _0x32b8b8={};_0x32b8b8[_0x27181f]={'$like':'%'+_0x41cc7f[_0x464d('0x39')][_0x464d('0x48')]+'%'};return _0x32b8b8;})});}_0x43791f=_[_0x464d('0x46')]({},_0x43791f,_0x41cc7f[_0x464d('0x4a')]);var _0x55e2f8={'where':_0x43791f[_0x464d('0x47')]};return db[_0x464d('0x4b')][_0x464d('0x28')](_0x55e2f8)[_0x464d('0x32')](function(_0x33801c){_0x2d6afb[_0x464d('0x28')]=_0x33801c;if(_0x41cc7f['query']['includeAll']){_0x43791f['include']=[{'all':!![]}];}return db[_0x464d('0x4b')]['findAll'](_0x43791f);})[_0x464d('0x32')](function(_0x1bd423){_0x2d6afb[_0x464d('0x4c')]=_0x1bd423;return _0x2d6afb;})[_0x464d('0x32')](respondWithFilteredResult(_0x3a4cd7,_0x43791f))[_0x464d('0x23')](handleError(_0x3a4cd7,null));};exports[_0x464d('0x4d')]=function(_0x7440c7,_0x2e163e){var _0x6205f0={'raw':![],'where':{'id':_0x7440c7[_0x464d('0x4e')]['id']}},_0x3071f6={};_0x3071f6[_0x464d('0x37')]=_[_0x464d('0x38')](db['ChatWebsite'][_0x464d('0x4f')]);_0x3071f6[_0x464d('0x39')]=_[_0x464d('0x38')](_0x7440c7[_0x464d('0x39')]);_0x3071f6['filters']=_[_0x464d('0x3c')](_0x3071f6['model'],_0x3071f6[_0x464d('0x39')]);_0x6205f0['attributes']=_['intersection'](_0x3071f6[_0x464d('0x37')],qs[_0x464d('0x3e')](_0x7440c7[_0x464d('0x39')]['fields']));_0x6205f0[_0x464d('0x3d')]=_0x6205f0[_0x464d('0x3d')][_0x464d('0x50')]?_0x6205f0['attributes']:_0x3071f6[_0x464d('0x37')];if(_0x7440c7[_0x464d('0x39')][_0x464d('0x51')]){_0x6205f0['include']=[{'all':!![]}];}_0x6205f0=_[_0x464d('0x46')]({},_0x6205f0,_0x7440c7['options']);return db[_0x464d('0x4b')]['find'](_0x6205f0)['then'](handleEntityNotFound(_0x2e163e,null))[_0x464d('0x32')](respondWithResult(_0x2e163e,null))[_0x464d('0x23')](handleError(_0x2e163e,null));};exports['create']=function(_0x50309d,_0x5b5e76){return db['ChatWebsite'][_0x464d('0x52')](_0x50309d[_0x464d('0x53')],{})[_0x464d('0x32')](respondWithResult(_0x5b5e76,0xc9))['catch'](handleError(_0x5b5e76,null));};exports['update']=function(_0x1e4589,_0x3aa600){if(_0x1e4589[_0x464d('0x53')]['id']){delete _0x1e4589[_0x464d('0x53')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x1e4589[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x3aa600,null))[_0x464d('0x32')](saveUpdates(_0x1e4589['body'],null))['then'](respondWithResult(_0x3aa600,null))[_0x464d('0x23')](handleError(_0x3aa600,null));};exports[_0x464d('0x31')]=function(_0xf07ec1,_0x364ee9){return db[_0x464d('0x4b')][_0x464d('0x54')]({'where':{'id':_0xf07ec1[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x364ee9,null))[_0x464d('0x32')](removeEntity(_0x364ee9,null))[_0x464d('0x23')](handleError(_0x364ee9,null));};exports[_0x464d('0x55')]=function(_0x56d903,_0x39374c){return db[_0x464d('0x4b')]['describe']()[_0x464d('0x32')](respondWithResult(_0x39374c,null))[_0x464d('0x23')](handleError(_0x39374c,null));};exports['addDisposition']=function(_0x26e11c,_0x469a29,_0x368611){if(_0x26e11c['body']['id']){delete _0x26e11c[_0x464d('0x53')]['id'];}return db[_0x464d('0x4b')][_0x464d('0x54')]({'where':{'id':_0x26e11c['params']['id']}})['then'](handleEntityNotFound(_0x469a29,null))[_0x464d('0x32')](function(_0x122d52){if(_0x122d52){_0x26e11c[_0x464d('0x53')][_0x464d('0x56')]=_0x122d52['id'];return db['Disposition']['create'](_0x26e11c['body']);}})[_0x464d('0x32')](respondWithResult(_0x469a29,null))['catch'](handleError(_0x469a29,null));};exports[_0x464d('0x57')]=function(_0x2afe11,_0x395c03,_0x5eaa4b){var _0x13a65b={'raw':![],'where':{}};var _0x28b9e7={};var _0x14905f={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x464d('0x58')]({'where':{'id':_0x2afe11[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x395c03,null))[_0x464d('0x32')](function(_0x52cd54){if(_0x52cd54){_0x28b9e7['model']=_['keys'](db[_0x464d('0x59')]['rawAttributes']);_0x28b9e7[_0x464d('0x39')]=_[_0x464d('0x38')](_0x2afe11[_0x464d('0x39')]);_0x28b9e7[_0x464d('0x42')]=_[_0x464d('0x3c')](_0x28b9e7[_0x464d('0x37')],_0x28b9e7[_0x464d('0x39')]);_0x13a65b[_0x464d('0x3d')]=_[_0x464d('0x3c')](_0x28b9e7[_0x464d('0x37')],qs[_0x464d('0x3e')](_0x2afe11[_0x464d('0x39')][_0x464d('0x3e')]));_0x13a65b['attributes']=_0x13a65b[_0x464d('0x3d')][_0x464d('0x50')]?_0x13a65b[_0x464d('0x3d')]:_0x28b9e7[_0x464d('0x37')];if(!_0x2afe11[_0x464d('0x39')][_0x464d('0x3f')]('nolimit')){_0x13a65b[_0x464d('0x2a')]=qs[_0x464d('0x2a')](_0x2afe11['query'][_0x464d('0x2a')]);_0x13a65b[_0x464d('0x29')]=qs[_0x464d('0x29')](_0x2afe11['query'][_0x464d('0x29')]);}_0x13a65b[_0x464d('0x5a')]=qs[_0x464d('0x41')](_0x2afe11[_0x464d('0x39')][_0x464d('0x41')]);_0x13a65b['where']=qs[_0x464d('0x42')](_['pick'](_0x2afe11[_0x464d('0x39')],_0x28b9e7[_0x464d('0x42')]));_0x13a65b[_0x464d('0x47')][_0x464d('0x56')]=_0x52cd54['id'];if(_0x2afe11['query']['filter']){_0x13a65b[_0x464d('0x47')]=_[_0x464d('0x46')](_0x13a65b[_0x464d('0x47')],{'$or':_[_0x464d('0x49')](_0x13a65b[_0x464d('0x3d')],function(_0x1fa785){var _0x36cd20={};_0x36cd20[_0x1fa785]={'$like':'%'+_0x2afe11[_0x464d('0x39')][_0x464d('0x48')]+'%'};return _0x36cd20;})});}_0x13a65b=_['merge']({},_0x13a65b,_0x2afe11['options']);return db['Disposition'][_0x464d('0x28')]({'where':_0x13a65b[_0x464d('0x47')]})[_0x464d('0x32')](function(_0x12d995){_0x14905f[_0x464d('0x28')]=_0x12d995;if(_0x2afe11[_0x464d('0x39')]['includeAll']){_0x13a65b[_0x464d('0x5b')]=[{'all':!![]}];}return db[_0x464d('0x59')][_0x464d('0x5c')](_0x13a65b);})[_0x464d('0x32')](function(_0x6ccb6){_0x14905f[_0x464d('0x4c')]=_0x6ccb6;return _0x14905f;});}})[_0x464d('0x32')](respondWithFilteredResult(_0x395c03,_0x13a65b))[_0x464d('0x23')](handleError(_0x395c03,null));};exports['removeDispositions']=function(_0x5f88d7,_0x50360b,_0x256562){var _0x53ea0c;return db[_0x464d('0x4b')]['find']({'where':{'id':_0x5f88d7[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x50360b,null))[_0x464d('0x32')](function(_0xd75844){if(_0xd75844){return _0xd75844[_0x464d('0x5d')](_0x5f88d7[_0x464d('0x39')][_0x464d('0x5e')]);}})['then'](respondWithStatusCode(_0x50360b,null))[_0x464d('0x23')](handleError(_0x50360b,null));};exports[_0x464d('0x5f')]=function(_0x500a15,_0x542760,_0x509d49){if(_0x500a15['body']['id']){delete _0x500a15[_0x464d('0x53')]['id'];}return db[_0x464d('0x4b')][_0x464d('0x54')]({'where':{'id':_0x500a15['params']['id']}})['then'](handleEntityNotFound(_0x542760,null))[_0x464d('0x32')](function(_0x3459e3){if(_0x3459e3){_0x500a15[_0x464d('0x53')][_0x464d('0x56')]=_0x3459e3['id'];return db['CannedAnswer'][_0x464d('0x52')](_0x500a15[_0x464d('0x53')]);}})[_0x464d('0x32')](respondWithResult(_0x542760,null))[_0x464d('0x23')](handleError(_0x542760,null));};exports[_0x464d('0x60')]=function(_0x131f51,_0x58c2fb,_0x5ed2dd){var _0x549430={'raw':![],'where':{}};var _0x2f2e6a={};var _0x2bd27c={'count':0x0,'rows':[]};return db[_0x464d('0x4b')]['findOne']({'where':{'id':_0x131f51[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x58c2fb,null))[_0x464d('0x32')](function(_0x5cd612){if(_0x5cd612){_0x2f2e6a[_0x464d('0x37')]=_['keys'](db[_0x464d('0x61')]['rawAttributes']);_0x2f2e6a[_0x464d('0x39')]=_[_0x464d('0x38')](_0x131f51[_0x464d('0x39')]);_0x2f2e6a[_0x464d('0x42')]=_[_0x464d('0x3c')](_0x2f2e6a['model'],_0x2f2e6a[_0x464d('0x39')]);_0x549430[_0x464d('0x3d')]=_[_0x464d('0x3c')](_0x2f2e6a[_0x464d('0x37')],qs['fields'](_0x131f51[_0x464d('0x39')][_0x464d('0x3e')]));_0x549430[_0x464d('0x3d')]=_0x549430['attributes'][_0x464d('0x50')]?_0x549430['attributes']:_0x2f2e6a[_0x464d('0x37')];if(!_0x131f51['query'][_0x464d('0x3f')](_0x464d('0x40'))){_0x549430[_0x464d('0x2a')]=qs['limit'](_0x131f51[_0x464d('0x39')]['limit']);_0x549430[_0x464d('0x29')]=qs[_0x464d('0x29')](_0x131f51[_0x464d('0x39')]['offset']);}_0x549430[_0x464d('0x5a')]=qs[_0x464d('0x41')](_0x131f51[_0x464d('0x39')][_0x464d('0x41')]);_0x549430[_0x464d('0x47')]=qs['filters'](_[_0x464d('0x43')](_0x131f51['query'],_0x2f2e6a[_0x464d('0x42')]));_0x549430['where'][_0x464d('0x56')]=_0x5cd612['id'];if(_0x131f51[_0x464d('0x39')][_0x464d('0x48')]){_0x549430[_0x464d('0x47')]=_[_0x464d('0x46')](_0x549430[_0x464d('0x47')],{'$or':_[_0x464d('0x49')](_0x549430[_0x464d('0x3d')],function(_0x111f26){var _0x1d6b2e={};_0x1d6b2e[_0x111f26]={'$like':'%'+_0x131f51[_0x464d('0x39')][_0x464d('0x48')]+'%'};return _0x1d6b2e;})});}_0x549430=_[_0x464d('0x46')]({},_0x549430,_0x131f51[_0x464d('0x4a')]);return db[_0x464d('0x61')]['count']({'where':_0x549430[_0x464d('0x47')]})[_0x464d('0x32')](function(_0x26158d){_0x2bd27c[_0x464d('0x28')]=_0x26158d;if(_0x131f51[_0x464d('0x39')][_0x464d('0x51')]){_0x549430[_0x464d('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x464d('0x5c')](_0x549430);})['then'](function(_0xbc8d40){_0x2bd27c['rows']=_0xbc8d40;return _0x2bd27c;});}})[_0x464d('0x32')](respondWithFilteredResult(_0x58c2fb,_0x549430))[_0x464d('0x23')](handleError(_0x58c2fb,null));};exports['removeAnswers']=function(_0x4ccc46,_0xa95be6,_0x30cd95){var _0xb06f50;return db[_0x464d('0x4b')]['find']({'where':{'id':_0x4ccc46[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0xa95be6,null))['then'](function(_0x135a1){if(_0x135a1){return _0x135a1[_0x464d('0x62')](_0x4ccc46['query']['ids']);}})[_0x464d('0x32')](respondWithStatusCode(_0xa95be6,null))[_0x464d('0x23')](handleError(_0xa95be6,null));};exports[_0x464d('0x63')]=function(_0x1c2361,_0xa10802,_0x3b0029){_0x1c2361[_0x464d('0x53')][_0x464d('0x64')]=_0x1c2361['file'][_0x464d('0x65')];return db[_0x464d('0x4b')]['find']({'where':{'id':_0x1c2361[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0xa10802,null))['then'](saveUpdates(_0x1c2361['body'],null))[_0x464d('0x32')](respondWithResult(_0xa10802,null))[_0x464d('0x23')](handleError(_0xa10802,null));};exports['addAvatar']=function(_0x518345,_0x329bb9,_0x577d42){_0x518345[_0x464d('0x53')][_0x464d('0x66')]=_0x518345['file'][_0x464d('0x65')];return db['ChatWebsite'][_0x464d('0x54')]({'where':{'id':_0x518345[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x329bb9,null))['then'](saveUpdates(_0x518345['body'],null))['then'](respondWithResult(_0x329bb9,null))['catch'](handleError(_0x329bb9,null));};exports['addCustomerAvatar']=function(_0x42cd24,_0x23944c,_0x1dcaf7){_0x42cd24[_0x464d('0x53')][_0x464d('0x67')]=_0x42cd24['file'][_0x464d('0x65')];return db['ChatWebsite']['find']({'where':{'id':_0x42cd24[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x23944c,null))['then'](saveUpdates(_0x42cd24['body'],null))[_0x464d('0x32')](respondWithResult(_0x23944c,null))[_0x464d('0x23')](handleError(_0x23944c,null));};exports[_0x464d('0x68')]=function(_0x3aaf48,_0x4466a2,_0x4f01d7){_0x3aaf48[_0x464d('0x53')]['systemAvatar']=_0x3aaf48[_0x464d('0x69')][_0x464d('0x65')];return db[_0x464d('0x4b')]['find']({'where':{'id':_0x3aaf48[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x4466a2,null))[_0x464d('0x32')](saveUpdates(_0x3aaf48[_0x464d('0x53')],null))[_0x464d('0x32')](respondWithResult(_0x4466a2,null))[_0x464d('0x23')](handleError(_0x4466a2,null));};exports[_0x464d('0x6a')]=function(_0x54b022,_0x1b68e1,_0x46e58e){var _0x51f8f6=path[_0x464d('0x6b')](config['root'],'server/files/images/logos/default_logo.png');var _0x21481d={'where':{'id':_0x54b022[_0x464d('0x4e')]['id']},'attributes':['id',_0x464d('0x64')],'raw':!![]};var _0x2f0b3a=![];return require(_0x464d('0x6c'))['getLicense']()[_0x464d('0x32')](function(_0x42209b){if(_0x42209b){_0x2f0b3a=_0x42209b[_0x464d('0x6d')];}})['then'](function(){return db[_0x464d('0x4b')]['find'](_0x21481d);})[_0x464d('0x32')](handleEntityNotFound(_0x1b68e1,null))[_0x464d('0x32')](function(_0x225e80){if(_0x225e80){if(!_[_0x464d('0x6e')](_0x225e80[_0x464d('0x64')])){if(fs[_0x464d('0x6f')](path[_0x464d('0x6b')](config['root'],'server/files/images/logos/',_0x225e80[_0x464d('0x64')]))&&_0x2f0b3a){_0x51f8f6=path[_0x464d('0x6b')](config[_0x464d('0x70')],'server/files/images/logos/',_0x225e80[_0x464d('0x64')]);}}return _0x1b68e1['download'](_0x51f8f6);}})[_0x464d('0x23')](handleError(_0x1b68e1,null));};exports['getAvatar']=function(_0x529c87,_0x586051,_0x5452c1){var _0x2d03f1=path[_0x464d('0x6b')](config[_0x464d('0x70')],_0x464d('0x71'));var _0x51aaa9={'where':{'id':_0x529c87[_0x464d('0x4e')]['id']},'attributes':['id',_0x464d('0x66')],'raw':!![]};return db[_0x464d('0x4b')][_0x464d('0x54')](_0x51aaa9)[_0x464d('0x32')](handleEntityNotFound(_0x586051,null))['then'](function(_0x2c8c64){if(_0x2c8c64){if(!_[_0x464d('0x6e')](_0x2c8c64[_0x464d('0x66')])){if(fs['existsSync'](path[_0x464d('0x6b')](config[_0x464d('0x70')],_0x464d('0x72'),_0x2c8c64[_0x464d('0x66')]))){_0x2d03f1=path[_0x464d('0x6b')](config[_0x464d('0x70')],_0x464d('0x72'),_0x2c8c64[_0x464d('0x66')]);}}return _0x586051['download'](_0x2d03f1);}})['catch'](handleError(_0x586051,null));};exports[_0x464d('0x73')]=function(_0x4f6655,_0x1e9214,_0x522258){var _0x16da6d=path[_0x464d('0x6b')](config[_0x464d('0x70')],_0x464d('0x74'));var _0x5d9aa2={'where':{'id':_0x4f6655['params']['id']},'attributes':['id','customerAvatar',_0x464d('0x75')],'raw':!![]};return db[_0x464d('0x4b')][_0x464d('0x54')](_0x5d9aa2)['then'](handleEntityNotFound(_0x1e9214,null))['then'](function(_0x125acc){if(_0x125acc){if(!_[_0x464d('0x6e')](_0x125acc[_0x464d('0x67')])){if(fs[_0x464d('0x6f')](path[_0x464d('0x6b')](config[_0x464d('0x70')],_0x464d('0x72'),_0x125acc[_0x464d('0x67')]))&&_0x125acc[_0x464d('0x75')]){_0x16da6d=path['join'](config['root'],_0x464d('0x72'),_0x125acc[_0x464d('0x67')]);}}return _0x1e9214[_0x464d('0x76')](_0x16da6d);}})[_0x464d('0x23')](handleError(_0x1e9214,null));};exports[_0x464d('0x77')]=function(_0x3a2339,_0x58d41f,_0x528a77){var _0x5902c8=path[_0x464d('0x6b')](config['root'],_0x464d('0x78'));var _0x48b652={'where':{'id':_0x3a2339[_0x464d('0x4e')]['id']},'attributes':['id',_0x464d('0x79')],'raw':!![]};return db['ChatWebsite'][_0x464d('0x54')](_0x48b652)[_0x464d('0x32')](handleEntityNotFound(_0x58d41f,null))[_0x464d('0x32')](function(_0x3b4908){if(_0x3b4908){if(!_[_0x464d('0x6e')](_0x3b4908['systemAvatar'])){if(fs['existsSync'](path[_0x464d('0x6b')](config['root'],_0x464d('0x72'),_0x3b4908['systemAvatar']))){_0x5902c8=path['join'](config[_0x464d('0x70')],_0x464d('0x72'),_0x3b4908['systemAvatar']);}}return _0x58d41f[_0x464d('0x76')](_0x5902c8);}})[_0x464d('0x23')](handleError(_0x58d41f,null));};exports[_0x464d('0x7a')]=function(_0x457ed2,_0x2fdd15,_0x6ca128){var _0x5e0965=require(_0x464d('0x7b'));var _0x1e6bc5=new _0x5e0965();var _0x51da8a=_0x1e6bc5[_0x464d('0x7c')](_0x457ed2['headers'][_0x464d('0x7d')])[_0x464d('0x7e')]();var _0x23e119={'body':_0x457ed2['body'],'channel':_0x464d('0x7f')};var _0x530857=[];var _0x2b902d=[];var _0x3a131d={};var _0x12ad0a=![];return db[_0x464d('0x80')]['describe']()['then'](function(_0x4b7450){if(!_0x4b7450){throw new db[(_0x464d('0x81'))][(_0x464d('0x82'))](_0x464d('0x83'));}_0x530857=_[_0x464d('0x84')](_[_0x464d('0x38')](_0x4b7450),[_0x464d('0x85'),_0x464d('0x86')]);_0x2b902d=_[_0x464d('0x84')](_['keys'](_0x4b7450),[_0x464d('0x85'),_0x464d('0x86'),_0x464d('0x87'),_0x464d('0x88')]);if(_0x457ed2[_0x464d('0x53')]['id']){delete _0x457ed2[_0x464d('0x53')]['id'];}if(_[_0x464d('0x6e')](_0x457ed2[_0x464d('0x53')][_0x464d('0x89')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x457ed2[_0x464d('0x53')][_0x464d('0x53')])||_0x457ed2[_0x464d('0x53')][_0x464d('0x53')]===''){throw new db['Sequelize'][(_0x464d('0x82'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x464d('0x6e')](_0x457ed2[_0x464d('0x53')][_0x464d('0x8a')])){throw new db['Sequelize'][(_0x464d('0x82'))](_0x464d('0x8b')+_0x2b902d);}if(!_[_0x464d('0x8c')](_0x2b902d,_0x457ed2['body'][_0x464d('0x8a')])){throw new db[(_0x464d('0x81'))][(_0x464d('0x82'))](_0x464d('0x8d')+_0x2b902d);}_0x3a131d[_0x457ed2[_0x464d('0x53')][_0x464d('0x8a')]]=_0x457ed2[_0x464d('0x53')][_0x464d('0x89')];})['then'](function(){return db[_0x464d('0x4b')][_0x464d('0x54')]({'where':{'id':_0x457ed2[_0x464d('0x4e')]['id']},'include':[{'model':db['CmList'],'as':_0x464d('0x8e'),'include':[{'model':db[_0x464d('0x80')],'as':_0x464d('0x8f'),'where':_0x3a131d,'limit':0x1,'order':[[_0x464d('0x86'),_0x464d('0x90')]]}]},{'model':db[_0x464d('0x91')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x2fdd15,null))[_0x464d('0x32')](function(_0x58d5bd){if(_0x58d5bd&&_0x58d5bd[_0x464d('0x8e')]){_0x23e119[_0x464d('0x92')]=_0x58d5bd;_0x23e119['applications']=_0x58d5bd[_0x464d('0x93')];_0x23e119[_0x464d('0x94')]=_0x58d5bd['List'];_0x23e119[_0x464d('0x95')]=_[_0x464d('0x96')](_0x23e119[_0x464d('0x95')],[_0x464d('0x97')],[_0x464d('0x98')]);if(_0x23e119[_0x464d('0x92')][_0x464d('0x93')]){delete _0x23e119[_0x464d('0x92')][_0x464d('0x93')];}if(_0x23e119['account'][_0x464d('0x8e')]&&_0x23e119['account']['List'][_0x464d('0x8f')][_0x464d('0x50')]){return _0x23e119[_0x464d('0x92')][_0x464d('0x8e')][_0x464d('0x8f')][0x0];}var _0x477b60=_[_0x464d('0x99')](_0x457ed2[_0x464d('0x53')],{'firstName':_0x457ed2[_0x464d('0x53')][_0x464d('0x89')],'ListId':_0x58d5bd[_0x464d('0x88')]});_0x477b60[_0x457ed2['body'][_0x464d('0x8a')]]=_0x457ed2[_0x464d('0x53')][_0x464d('0x89')];return db[_0x464d('0x80')][_0x464d('0x52')](_0x477b60,{'fields':_0x530857,'raw':!![]});}})[_0x464d('0x32')](handleEntityNotFound(_0x2fdd15,null))[_0x464d('0x32')](function(_0x2be127){_0x23e119[_0x464d('0x9a')]=_0x2be127;if(_0x2be127){var _0x34b16b={'ContactId':_0x2be127['id'],'ChatWebsiteId':_0x457ed2[_0x464d('0x4e')]['id'],'from':(_0x2be127[_0x464d('0x9b')]||'')+'\x20'+(_0x2be127['lastName']||''),'customerIp':_0x457ed2['body']['customerIp'],'referer':_0x457ed2['body'][_0x464d('0x9c')],'browserName':_0x51da8a['browser'][_0x464d('0x34')]&&_0x51da8a['browser'][_0x464d('0x9d')]?util[_0x464d('0x9e')](_0x464d('0x9f'),_0x51da8a['browser']['name'],_0x51da8a['browser'][_0x464d('0x9d')]):_0x464d('0xa0'),'browserVersion':_0x51da8a['browser'][_0x464d('0x9d')]||_0x464d('0xa0'),'osName':util[_0x464d('0x9e')](_0x464d('0x9f'),_0x51da8a['os'][_0x464d('0x34')],_0x51da8a['os'][_0x464d('0x9d')]),'osVersion':_0x51da8a['os'][_0x464d('0x9d')],'deviceModel':_0x51da8a[_0x464d('0xa1')][_0x464d('0x37')]&&_0x51da8a[_0x464d('0xa1')][_0x464d('0xa2')]?util[_0x464d('0x9e')](_0x464d('0xa3'),_0x51da8a[_0x464d('0xa1')]['model'],_0x51da8a[_0x464d('0xa1')][_0x464d('0xa2')],_0x51da8a['device'][_0x464d('0xa4')]):null,'deviceVendor':_0x51da8a[_0x464d('0xa1')][_0x464d('0xa2')],'deviceType':_0x51da8a['device']['type'],'formData':JSON[_0x464d('0x1e')](_0x457ed2[_0x464d('0x53')])};var _0xb5ee02={'ChatWebsiteId':_0x457ed2[_0x464d('0x4e')]['id'],'closed':![]};if(_0x457ed2[_0x464d('0x53')][_0x464d('0xa5')]){_0xb5ee02[_0x464d('0xa5')]=_0x457ed2[_0x464d('0x53')]['threadId'];return db['ChatInteraction'][_0x464d('0x54')]({'where':_0xb5ee02})[_0x464d('0x32')](function(_0x329b65){if(_0x329b65){return[_0x329b65,![]];}_0x34b16b[_0x464d('0xa5')]=_0x457ed2[_0x464d('0x53')]['threadId'];_0x34b16b[_0x464d('0xa6')]=_0x457ed2['body'][_0x464d('0xa6')];return db['ChatInteraction'][_0x464d('0x52')](_0x34b16b)[_0x464d('0x32')](function(_0x1cd412){return[_0x1cd412,!![]];});});}_0xb5ee02[_0x464d('0xa7')]=_0x2be127['id'];if(_0x457ed2[_0x464d('0x53')][_0x464d('0xa8')]&&_0x457ed2['body'][_0x464d('0xa8')]['id']){_0xb5ee02['id']=_0x457ed2['body'][_0x464d('0xa8')]['id'];return db[_0x464d('0xa9')][_0x464d('0x54')]({'where':_0xb5ee02})[_0x464d('0x32')](function(_0x252ddb){if(_0x252ddb){return[_0x252ddb,![]];}return db[_0x464d('0xa9')][_0x464d('0x52')](_0x34b16b)[_0x464d('0x32')](function(_0x46867b){return[_0x46867b,!![]];});});}return db['ChatInteraction']['create'](_0x34b16b)[_0x464d('0x32')](function(_0x44f426){return[_0x44f426,!![]];});}})['spread'](function(_0x4bea7e,_0x4e4bfd){if(_0x4bea7e){_0x12ad0a=_0x4e4bfd;if(!_0x4e4bfd){return _0x4bea7e['update']({'from':(_0x23e119[_0x464d('0x9a')][_0x464d('0x9b')]||'')+'\x20'+(_0x23e119[_0x464d('0x9a')][_0x464d('0xaa')]||'')});}else{return _0x4bea7e;}}})['then'](function(_0x3a435f){_0x23e119[_0x464d('0xa8')]=_0x3a435f[_0x464d('0xab')]({'plain':!![]});_0x23e119[_0x464d('0xa8')][_0x464d('0xac')]=_0x12ad0a;if(_0x23e119['interaction']['created']){if(_0x23e119['account'][_0x464d('0xad')]){_0x23e119[_0x464d('0x95')][_0x464d('0xae')]({'id':0x0,'priority':_0x23e119[_0x464d('0x95')]['length']+0x1,'app':_0x464d('0xaf'),'appdata':_0x464d('0xb0'),'interval':_0x464d('0xb1')});}}return db[_0x464d('0xb2')]['create']({'body':_0x457ed2[_0x464d('0x53')]['body'],'ChatWebsiteId':_0x457ed2['params']['id'],'ChatInteractionId':_0x3a435f['id'],'direction':'in','ContactId':_0x23e119[_0x464d('0x9a')]['id'],'AttachmentId':_0x457ed2[_0x464d('0x53')][_0x464d('0xb3')]});})[_0x464d('0x32')](function(_0x416314){_0x23e119[_0x464d('0x21')]=_0x416314;if(_0x23e119[_0x464d('0xa8')][_0x464d('0xb4')]){return db[_0x464d('0xb5')]['find']({'attributes':['id',_0x464d('0x34')],'where':{'id':_0x23e119[_0x464d('0xa8')][_0x464d('0xb4')]}})[_0x464d('0x32')](function(_0x4ac56c){if(_0x4ac56c){_0x23e119[_0x464d('0x95')][_0x464d('0xb6')]({'id':0x0,'priority':0x0,'app':_0x464d('0xb7'),'appdata':_0x4ac56c[_0x464d('0x34')]+','+(_0x23e119[_0x464d('0x92')][_0x464d('0xb8')]||0xa),'interval':_0x464d('0xb1')});_0x23e119[_0x464d('0xb9')]=!![];}return respondWithRpcPromise('Start','startRouting',_0x23e119);});}return respondWithRpcPromise('Start','startRouting',_0x23e119);})[_0x464d('0x32')](function(_0x597282){respondWithRpcPromise('EventManager',_0x464d('0xba'),{'event':'notify','message':_0x597282},client9002);return _0x597282;})[_0x464d('0x32')](respondWithResult(_0x2fdd15,null))[_0x464d('0x23')](handleError(_0x2fdd15,null));};exports[_0x464d('0xbb')]=function(_0xb5a3b1,_0x3fd996,_0xbb8bf2){var _0x379d86,_0x2fdaf9,_0x2b9518;var _0x121122=[];var _0x5b1b30=[];var _0x2e1968={};return db[_0x464d('0x80')][_0x464d('0x55')]()[_0x464d('0x32')](function(_0x53a3b9){if(!_0x53a3b9){throw new db[(_0x464d('0x81'))]['ValidationError'](_0x464d('0x83'));}_0x5b1b30=_[_0x464d('0x84')](_[_0x464d('0x38')](_0x53a3b9),[_0x464d('0x85'),'updatedAt']);_0x121122=_['difference'](_[_0x464d('0x38')](_0x53a3b9),[_0x464d('0x85'),_0x464d('0x86'),_0x464d('0x87'),_0x464d('0x88')]);if(_0xb5a3b1[_0x464d('0x53')]['id']){delete _0xb5a3b1['body']['id'];}if(_['isNil'](_0xb5a3b1[_0x464d('0x53')][_0x464d('0x89')])){throw _0x3fd996[_0x464d('0x26')](0x1f4)[_0x464d('0x35')](new db[(_0x464d('0x81'))][(_0x464d('0x82'))](_0x464d('0xbc')));}if(_['isNil'](_0xb5a3b1[_0x464d('0x53')][_0x464d('0x53')])||_0xb5a3b1['body'][_0x464d('0x53')]===''){throw _0x3fd996['status'](0x1f4)['send'](new db[(_0x464d('0x81'))][(_0x464d('0x82'))](_0x464d('0xbd')));}if(_[_0x464d('0x6e')](_0xb5a3b1[_0x464d('0x53')]['mapKeyOffline'])){throw _0x3fd996['status'](0x1f4)[_0x464d('0x35')](new db['Sequelize'][(_0x464d('0x82'))](_0x464d('0xbe')+_0x121122));}if(!_[_0x464d('0x8c')](_0x121122,_0xb5a3b1['body'][_0x464d('0xbf')])){throw _0x3fd996[_0x464d('0x26')](0x1f4)[_0x464d('0x35')](new db[(_0x464d('0x81'))]['ValidationError'](_0x464d('0xc0')+_0x121122));}_0x2e1968[_0xb5a3b1[_0x464d('0x53')]['mapKeyOffline']]=_0xb5a3b1[_0x464d('0x53')]['from'];})['then'](function(){return db[_0x464d('0x4b')][_0x464d('0x54')]({'where':{'id':_0xb5a3b1['params']['id']},'include':[{'model':db['CmList'],'as':_0x464d('0x8e')}]});})[_0x464d('0x32')](handleEntityNotFound(_0x3fd996,null))[_0x464d('0x32')](function(_0xdf91e){if(_0xdf91e&&_0xdf91e[_0x464d('0x8e')]){_0x2fdaf9=_0xdf91e;var _0x378e31=_[_0x464d('0x99')](_0xb5a3b1[_0x464d('0x53')],{'firstName':_0xb5a3b1['body']['from'],'phone':_0xb5a3b1[_0x464d('0x53')][_0x464d('0x89')],'ListId':_0xdf91e['ListId']});_0x378e31[_0xb5a3b1[_0x464d('0x53')][_0x464d('0xbf')]]=_0xb5a3b1[_0x464d('0x53')][_0x464d('0x89')];return db[_0x464d('0x80')][_0x464d('0xc1')]({'where':_0x2e1968,'defaults':_0x378e31});}})[_0x464d('0xc2')](function(_0x4fe286){if(_0x4fe286){_0x2b9518=_0x4fe286;var _0xc8eaa0=fs['readFileSync'](path[_0x464d('0x6b')](config[_0x464d('0x70')],_0x464d('0xc3')),_0x464d('0xc4'));var _0x5a59d5=ejs[_0x464d('0xc5')](_0xc8eaa0,{'body':_[_0x464d('0xc6')](_0xb5a3b1[_0x464d('0x53')][_0x464d('0x53')]),'bodyTitle':_0x2fdaf9[_0x464d('0xc7')]});return db[_0x464d('0xc8')]['create']({'body':_0x5a59d5,'ContactId':_0x4fe286['id'],'ChatWebsiteId':_0x2fdaf9['id']});}})['then'](function(_0x16b619){if(_0x16b619){_0x379d86=_0x16b619;return db['MailAccount'][_0x464d('0x58')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x464d('0xc9'),'raw':!![]}]});}})[_0x464d('0x32')](function(_0x1d2e7c){if(_0x1d2e7c&&_0x1d2e7c['Smtp']&&_0x2fdaf9[_0x464d('0xca')]){var _0x46adba={'tls':{'rejectUnauthorized':![]}};if(_0x1d2e7c['Smtp'][_0x464d('0xcb')]){_0x46adba[_0x464d('0xcb')]=_0x1d2e7c[_0x464d('0xc9')][_0x464d('0xcb')];}else{_0x46adba[_0x464d('0xcc')]=_0x1d2e7c[_0x464d('0xc9')]['host'];_0x46adba[_0x464d('0xcd')]=_0x1d2e7c[_0x464d('0xc9')]['port'];_0x46adba[_0x464d('0xce')]=_0x1d2e7c['Smtp'][_0x464d('0xce')];}if(_0x1d2e7c['Smtp'][_0x464d('0xcf')]){_0x46adba[_0x464d('0xd0')]={'user':_0x1d2e7c['Smtp'][_0x464d('0xd1')],'pass':_0x1d2e7c[_0x464d('0xc9')][_0x464d('0xd2')]};}return respondWithRpcPromise(_0x464d('0xd3'),_0x464d('0xd4'),{'account':_0x46adba,'message':{'from':util['format'](_0x464d('0xd5'),_0x1d2e7c['name'],_0x1d2e7c[_0x464d('0xd6')]||_0x1d2e7c[_0x464d('0xc9')][_0x464d('0xd1')]),'to':_0x2fdaf9[_0x464d('0xca')],'subject':_0x2fdaf9[_0x464d('0xd7')],'text':_0x379d86[_0x464d('0x53')]}},client9003)[_0x464d('0x32')](function(){return _0x379d86;})[_0x464d('0x23')](function(_0x449258){console[_0x464d('0x1f')](_0x449258);});}})['then'](function(){if(_0x379d86){return _0x379d86;}})[_0x464d('0x32')](respondWithResult(_0x3fd996,null))[_0x464d('0x23')](handleError(_0x3fd996,null));};exports[_0x464d('0xd8')]=function(_0x57540a,_0xf02382,_0x245508){return db[_0x464d('0xa9')][_0x464d('0x54')]({'where':{'id':_0x57540a[_0x464d('0x4e')]['id']}})['then'](handleEntityNotFound(_0xf02382,null))[_0x464d('0x32')](function(_0x5942db){if(_0x5942db){return _0x5942db[_0x464d('0xd8')](_0x57540a[_0x464d('0x53')]['ids'],_[_0x464d('0xd9')](_0x57540a[_0x464d('0x53')],['ids','id'])||{});}})[_0x464d('0x32')](respondWithResult(_0xf02382,null))[_0x464d('0x23')](handleError(_0xf02382,null));};exports[_0x464d('0xda')]=function(_0x127553,_0x354205,_0x4ca9f6){var _0x4ef5ed={'raw':![],'where':{}};var _0x2d62d2={};var _0x325802={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x127553[_0x464d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x354205,null))[_0x464d('0x32')](function(_0x30bf5f){if(_0x30bf5f){_0x2d62d2[_0x464d('0x37')]=_['keys'](db['ChatInteraction']['rawAttributes']);_0x2d62d2[_0x464d('0x39')]=_['keys'](_0x127553['query']);_0x2d62d2[_0x464d('0x42')]=_[_0x464d('0x3c')](_0x2d62d2[_0x464d('0x37')],_0x2d62d2[_0x464d('0x39')]);_0x4ef5ed['attributes']=_[_0x464d('0x3c')](_0x2d62d2['model'],qs[_0x464d('0x3e')](_0x127553[_0x464d('0x39')][_0x464d('0x3e')]));_0x4ef5ed[_0x464d('0x3d')]=_0x4ef5ed[_0x464d('0x3d')][_0x464d('0x50')]?_0x4ef5ed[_0x464d('0x3d')]:_0x2d62d2['model'];if(!_0x127553[_0x464d('0x39')][_0x464d('0x3f')](_0x464d('0x40'))){_0x4ef5ed[_0x464d('0x2a')]=qs[_0x464d('0x2a')](_0x127553[_0x464d('0x39')][_0x464d('0x2a')]);_0x4ef5ed['offset']=qs['offset'](_0x127553['query'][_0x464d('0x29')]);}_0x4ef5ed[_0x464d('0x5a')]=qs[_0x464d('0x41')](_0x127553[_0x464d('0x39')]['sort']);_0x4ef5ed[_0x464d('0x47')]=qs[_0x464d('0x42')](_['pick'](_0x127553[_0x464d('0x39')],_0x2d62d2[_0x464d('0x42')]));_0x4ef5ed[_0x464d('0x47')][_0x464d('0x56')]=_0x30bf5f['id'];if(_0x127553[_0x464d('0x39')]['filter']){_0x4ef5ed['where']=_[_0x464d('0x46')](_0x4ef5ed[_0x464d('0x47')],{'$or':_[_0x464d('0x49')](_0x4ef5ed[_0x464d('0x3d')],function(_0x4d8ee5){var _0x172109={};_0x172109[_0x4d8ee5]={'$like':'%'+_0x127553[_0x464d('0x39')][_0x464d('0x48')]+'%'};return _0x172109;})});}_0x4ef5ed=_[_0x464d('0x46')]({},_0x4ef5ed,_0x127553['options']);return db[_0x464d('0xa9')][_0x464d('0x28')]({'where':_0x4ef5ed[_0x464d('0x47')]})[_0x464d('0x32')](function(_0x3f81cc){_0x325802[_0x464d('0x28')]=_0x3f81cc;if(_0x127553['query'][_0x464d('0x51')]){_0x4ef5ed[_0x464d('0x5b')]=[{'model':db[_0x464d('0x80')],'as':_0x464d('0xdb'),'required':![]},{'model':db['User'],'as':_0x464d('0xdc'),'attributes':[_0x464d('0x34'),'fullname',_0x464d('0xdd')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0x464d('0xde')],'where':_0x127553[_0x464d('0x39')][_0x464d('0xdf')]?{'id':_0x127553[_0x464d('0x39')][_0x464d('0xdf')]}:undefined,'required':_0x127553[_0x464d('0x39')][_0x464d('0xdf')]?!![]:![]}];}return db[_0x464d('0xa9')][_0x464d('0x5c')](_0x4ef5ed);})['then'](function(_0x2087cd){_0x325802[_0x464d('0x4c')]=_0x2087cd;return _0x325802;});}})[_0x464d('0x32')](respondWithFilteredResult(_0x354205,_0x4ef5ed))[_0x464d('0x23')](handleError(_0x354205,null));};function iftimePromise(_0x5d07e8,_0x54f646){return respondWithRpcPromise('Command',_0x464d('0xe0'),{'command':_0x54f646[_0x464d('0xe1')]?util['format'](_0x464d('0xe2'),_0x5d07e8[_0x464d('0xe3')],_0x54f646[_0x464d('0xe1')]):util[_0x464d('0x9e')](_0x464d('0xe4'),_0x5d07e8[_0x464d('0xe3')])},client9002)[_0x464d('0x32')](function(_0x2adfcd){var _0x20a79f=_0x2adfcd&&_0x2adfcd[_0x464d('0xe5')](_0x464d('0xe6'))>=0x0?!![]:![];logger[_0x464d('0x1a')](_0x464d('0xe7'),_0x54f646['id'],_0x5d07e8['id'],_0x5d07e8[_0x464d('0xe3')],_0x20a79f?_0x464d('0xe8'):_0x464d('0xe9'),_0x54f646['timezone']?_0x54f646[_0x464d('0xe1')]:'No\x20timezone');return _0x20a79f;})[_0x464d('0x23')](function(_0xaa1f88){logger['error'](_0x464d('0xe7'),_0x54f646['id'],_0x5d07e8['id'],_0x5d07e8[_0x464d('0xe3')],util[_0x464d('0xea')](_0xaa1f88,{'showHidden':![],'depth':null}),_0x54f646['timezone']?_0x54f646[_0x464d('0xe1')]:_0x464d('0xeb'));return![];});}exports['getSnippet']=function(_0x2beb12,_0x21741f,_0x62bd2c){var _0x1acc4c=0x0;var _0x4609f3=0x0;var _0x55e91e=![];var _0x3221ae;var _0x4cad5e;return db['ChatWebsite'][_0x464d('0x54')]({'where':{'id':_0x2beb12[_0x464d('0x4e')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0x464d('0xec')],'as':_0x464d('0xed'),'attributes':['id',_0x464d('0xe3')],'raw':!![]}]}]})[_0x464d('0x32')](handleEntityNotFound(_0x21741f,null))['then'](function(_0x4d08d7){if(_0x4d08d7){_0x3221ae=_0x4d08d7;return _0x4d08d7[_0x464d('0xee')]({'raw':!![]});}})[_0x464d('0x32')](function(_0xb83225){if(_0x3221ae){if(_0xb83225){_0x4cad5e=_0xb83225;}}return require(_0x464d('0x6c'))[_0x464d('0xef')]();})[_0x464d('0x32')](function(_0x22cc47){if(_0x22cc47){_0x4609f3=_0x22cc47['virtual'];_0x55e91e=_0x22cc47[_0x464d('0x6d')];}})[_0x464d('0x32')](function(){return db['ChatInteraction'][_0x464d('0x28')]({'where':{'closed':![]}});})[_0x464d('0x32')](function(_0x3e4b2f){_0x1acc4c=_0x3e4b2f;if(_0x4609f3&&_0x3e4b2f>_0x4609f3){return db[_0x464d('0xf0')][_0x464d('0x58')]({'where':{'id':0x1}})[_0x464d('0x32')](function(_0x2c157c){if(_0x2c157c){_0x2c157c[_0x464d('0xf1')](_0x464d('0xf2'));}});}})[_0x464d('0x32')](function(){if(_0x3221ae[_0x464d('0xec')]&&_0x3221ae[_0x464d('0xec')][_0x464d('0xed')]){var _0x5f09d5=[];for(var _0x419c94=0x0;_0x419c94<_0x3221ae['Interval'][_0x464d('0xed')][_0x464d('0x50')];_0x419c94++){var _0x4923b1=_0x3221ae[_0x464d('0xec')][_0x464d('0xed')][_0x419c94][_0x464d('0xab')]({'plain':!![]});_0x5f09d5[_0x464d('0xae')](iftimePromise(_0x4923b1,_0x3221ae));}return BPromise[_0x464d('0xf3')](_0x5f09d5)[_0x464d('0x32')](function(_0x3b125a){return _['some'](_0x3b125a);});}else{return!![];}})[_0x464d('0x32')](function(_0x348530){var _0x41dbea=fs[_0x464d('0xf4')](path[_0x464d('0x6b')](config[_0x464d('0x70')],_0x464d('0xf5')),_0x464d('0xc4'));var _0x53dbc1={'remote':_0x3221ae['remote'],'query':querystring['stringify'](_[_0x464d('0x46')](_0x3221ae['get']({'plain':!![]}),{'customerIp':_0x2beb12[_0x464d('0xf6')][_0x464d('0xf7')]||_0x2beb12['headers'][_0x464d('0xf8')]||_0x2beb12['connection'][_0x464d('0xf9')]||_0x2beb12['ip'],'referer':_0x2beb12[_0x464d('0xf6')]['referer'],'openedInteractions':_0x1acc4c,'maxInteractions':_0x4609f3,'virtual':_0x55e91e[_0x464d('0xfa')],'online':_0x348530,'custom':_0x55e91e}))[_0x464d('0xfb')](/'/g,'\x5c\x27')};_0x21741f[_0x464d('0x35')](ejs[_0x464d('0xc5')](Mustache[_0x464d('0xc5')](_0x41dbea,_0x53dbc1),{'proactiveActions':_0x4cad5e,'alignment':_0x3221ae[_0x464d('0xfc')],'verticalAlignment':_0x3221ae[_0x464d('0xfd')]}));})[_0x464d('0x23')](handleError(_0x21741f,null));};exports[_0x464d('0xfe')]=function(_0x327967,_0x3146db,_0x52871c){return db['ChatWebsite']['findOne']({'where':{'id':_0x327967[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x3146db,null))[_0x464d('0x32')](function(_0x3e6b7b){if(_0x3e6b7b){return db['sequelize'][_0x464d('0xff')](function(_0x224661){return db[_0x464d('0x91')][_0x464d('0x31')]({'where':{'ChatWebsiteId':_0x327967['params']['id']},'transaction':_0x224661})[_0x464d('0x32')](function(_0x26f883){var _0x768c03=_[_0x464d('0x49')](_0x327967[_0x464d('0x53')],function(_0x2d3717){_0x2d3717['ChatWebsiteId']=_0x327967[_0x464d('0x4e')]['id'];return _0x2d3717;});return db[_0x464d('0x91')][_0x464d('0x100')](_0x768c03,{'transaction':_0x224661});});})[_0x464d('0x32')](function(){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x327967[_0x464d('0x4e')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x3146db,null))[_0x464d('0x23')](handleError(_0x3146db,null));};exports[_0x464d('0x101')]=function(_0x488836,_0x2d769f,_0x13a0f3){var _0x49900c={};var _0x158b45={};var _0x1d0332;var _0x283e1e;return db['ChatWebsite']['findOne']({'where':{'id':_0x488836['params']['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x2d769f,null))['then'](function(_0x2b752){if(_0x2b752){_0x1d0332=_0x2b752;_0x158b45[_0x464d('0x37')]=_[_0x464d('0x38')](db[_0x464d('0x91')][_0x464d('0x4f')]);_0x158b45[_0x464d('0x39')]=_[_0x464d('0x38')](_0x488836[_0x464d('0x39')]);_0x158b45[_0x464d('0x42')]=_['intersection'](_0x158b45[_0x464d('0x37')],_0x158b45[_0x464d('0x39')]);_0x49900c[_0x464d('0x3d')]=_['intersection'](_0x158b45['model'],qs['fields'](_0x488836[_0x464d('0x39')]['fields']));_0x49900c[_0x464d('0x3d')]=_0x49900c['attributes'][_0x464d('0x50')]?_0x49900c[_0x464d('0x3d')]:_0x158b45[_0x464d('0x37')];_0x49900c[_0x464d('0x5a')]=qs[_0x464d('0x41')](_0x488836[_0x464d('0x39')]['sort']);_0x49900c[_0x464d('0x47')]=qs[_0x464d('0x42')](_['pick'](_0x488836[_0x464d('0x39')],_0x158b45[_0x464d('0x42')]));if(_0x488836['query'][_0x464d('0x48')]){_0x49900c[_0x464d('0x47')]=_['merge'](_0x49900c[_0x464d('0x47')],{'$or':_['map'](_0x49900c[_0x464d('0x3d')],function(_0x5f5a19){var _0x56c5bc={};_0x56c5bc[_0x5f5a19]={'$like':'%'+_0x488836['query']['filter']+'%'};return _0x56c5bc;})});}_0x49900c=_[_0x464d('0x46')]({},_0x49900c,_0x488836[_0x464d('0x4a')]);return _0x1d0332[_0x464d('0x101')](_0x49900c);}})[_0x464d('0x32')](function(_0x49cd3c){if(_0x49cd3c){_0x283e1e=_0x49cd3c[_0x464d('0x50')];if(!_0x488836[_0x464d('0x39')]['hasOwnProperty']('nolimit')){_0x49900c[_0x464d('0x2a')]=qs['limit'](_0x488836[_0x464d('0x39')][_0x464d('0x2a')]);_0x49900c[_0x464d('0x29')]=qs[_0x464d('0x29')](_0x488836['query'][_0x464d('0x29')]);}return _0x1d0332[_0x464d('0x101')](_0x49900c);}})['then'](function(_0x37ef04){if(_0x37ef04){return _0x37ef04?{'count':_0x283e1e,'rows':_0x37ef04}:null;}})[_0x464d('0x32')](respondWithResult(_0x2d769f,null))[_0x464d('0x23')](handleError(_0x2d769f,null));};exports[_0x464d('0x102')]=function(_0x33e184,_0x31b455,_0xfd2e98){return db['chatProactiveAction'][_0x464d('0x54')]({'where':{'id':_0x33e184[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x31b455,null))[_0x464d('0x32')](function(_0x2e16b6){if(_0x2e16b6){return _0x2e16b6[_0x464d('0x102')](_0x33e184['body'][_0x464d('0x5e')],_[_0x464d('0xd9')](_0x33e184[_0x464d('0x53')],['ids','id'])||{});}})['then'](respondWithResult(_0x31b455,null))[_0x464d('0x23')](handleError(_0x31b455,null));};exports[_0x464d('0xee')]=function(_0x23e762,_0x10ea23,_0x46ef3c){var _0x4a57f8={};var _0x1aec44={};var _0x171973;var _0x29411e;return db['ChatWebsite'][_0x464d('0x58')]({'where':{'id':_0x23e762[_0x464d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x10ea23,null))[_0x464d('0x32')](function(_0x3334b9){if(_0x3334b9){_0x171973=_0x3334b9;_0x1aec44[_0x464d('0x37')]=_[_0x464d('0x38')](db[_0x464d('0x103')][_0x464d('0x4f')]);_0x1aec44[_0x464d('0x39')]=_['keys'](_0x23e762[_0x464d('0x39')]);_0x1aec44['filters']=_[_0x464d('0x3c')](_0x1aec44['model'],_0x1aec44[_0x464d('0x39')]);_0x4a57f8[_0x464d('0x3d')]=_[_0x464d('0x3c')](_0x1aec44['model'],qs[_0x464d('0x3e')](_0x23e762[_0x464d('0x39')][_0x464d('0x3e')]));_0x4a57f8[_0x464d('0x3d')]=_0x4a57f8[_0x464d('0x3d')]['length']?_0x4a57f8[_0x464d('0x3d')]:_0x1aec44[_0x464d('0x37')];_0x4a57f8[_0x464d('0x5a')]=qs['sort'](_0x23e762[_0x464d('0x39')][_0x464d('0x41')]);_0x4a57f8[_0x464d('0x47')]=qs['filters'](_[_0x464d('0x43')](_0x23e762[_0x464d('0x39')],_0x1aec44[_0x464d('0x42')]));if(_0x23e762[_0x464d('0x39')][_0x464d('0x48')]){_0x4a57f8[_0x464d('0x47')]=_['merge'](_0x4a57f8[_0x464d('0x47')],{'$or':_[_0x464d('0x49')](_0x4a57f8[_0x464d('0x3d')],function(_0xc39206){var _0xdfee41={};_0xdfee41[_0xc39206]={'$like':'%'+_0x23e762['query'][_0x464d('0x48')]+'%'};return _0xdfee41;})});}_0x4a57f8=_['merge']({},_0x4a57f8,_0x23e762[_0x464d('0x4a')]);return _0x171973[_0x464d('0xee')](_0x4a57f8);}})[_0x464d('0x32')](function(_0x48d3c7){if(_0x48d3c7){_0x29411e=_0x48d3c7['length'];if(!_0x23e762[_0x464d('0x39')]['hasOwnProperty'](_0x464d('0x40'))){_0x4a57f8[_0x464d('0x2a')]=qs[_0x464d('0x2a')](_0x23e762[_0x464d('0x39')][_0x464d('0x2a')]);_0x4a57f8['offset']=qs['offset'](_0x23e762[_0x464d('0x39')]['offset']);}return _0x171973['getProactiveActions'](_0x4a57f8);}})['then'](function(_0x5cdd8b){if(_0x5cdd8b){return _0x5cdd8b?{'count':_0x29411e,'rows':_0x5cdd8b}:null;}})['then'](respondWithResult(_0x10ea23,null))[_0x464d('0x23')](handleError(_0x10ea23,null));};exports[_0x464d('0x104')]=function(_0x441c58,_0x51109b,_0x2f7ee1){var _0x18a235=_0x441c58[_0x464d('0x39')][_0x464d('0x105')]===_0x464d('0x106')?'offlineForm':_0x464d('0x107');return db['ChatWebsite'][_0x464d('0x54')]({'attributes':['id',_0x18a235],'where':{'id':_0x441c58['params']['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x51109b,null))['then'](function(_0x18623e){if(_0x18623e){var _0x506e81=_0x18623e[_0x18a235];var _0x4d3922=_0x506e81&&_0x506e81['items']?_0x506e81['items']:[];_0x51109b[_0x464d('0x35')]({'fromKey':_[_0x464d('0x6e')](_0x506e81[_0x464d('0x108')])?undefined:_0x506e81[_0x464d('0x108')],'count':_0x4d3922['length'],'rows':_0x4d3922});}})['catch'](handleError(_0x51109b,null));};exports[_0x464d('0x109')]=function(_0x170555,_0x10d2f0,_0x50651a){var _0xdbc286={'raw':!![],'where':{}};var _0x26f912={};var _0xee33f1={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x464d('0x58')]({'where':{'id':_0x170555[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x10d2f0,null))[_0x464d('0x32')](function(_0x525a3b){if(_0x525a3b){_0x26f912['model']=_[_0x464d('0x38')](db[_0x464d('0xc8')]['rawAttributes']);_0x26f912[_0x464d('0x39')]=_['keys'](_0x170555[_0x464d('0x39')]);_0x26f912[_0x464d('0x42')]=_[_0x464d('0x3c')](_0x26f912[_0x464d('0x37')],_0x26f912[_0x464d('0x39')]);_0xdbc286['attributes']=_[_0x464d('0x3c')](_0x26f912[_0x464d('0x37')],qs['fields'](_0x170555[_0x464d('0x39')][_0x464d('0x3e')]));_0xdbc286[_0x464d('0x3d')]=_0xdbc286[_0x464d('0x3d')]['length']?_0xdbc286[_0x464d('0x3d')]:_0x26f912[_0x464d('0x37')];if(!_0x170555['query']['hasOwnProperty'](_0x464d('0x40'))){_0xdbc286[_0x464d('0x2a')]=qs[_0x464d('0x2a')](_0x170555[_0x464d('0x39')]['limit']);_0xdbc286['offset']=qs[_0x464d('0x29')](_0x170555[_0x464d('0x39')]['offset']);}_0xdbc286[_0x464d('0x5a')]=qs[_0x464d('0x41')](_0x170555[_0x464d('0x39')][_0x464d('0x41')]);_0xdbc286[_0x464d('0x47')]=qs[_0x464d('0x42')](_[_0x464d('0x43')](_0x170555[_0x464d('0x39')],_0x26f912['filters']));_0xdbc286[_0x464d('0x47')]['ChatWebsiteId']=_0x525a3b['id'];if(_0x170555['query'][_0x464d('0x48')]){_0xdbc286[_0x464d('0x47')]=_['merge'](_0xdbc286['where'],{'$or':_[_0x464d('0x49')](_0xdbc286[_0x464d('0x3d')],function(_0x20ddce){var _0x5b7eec={};_0x5b7eec[_0x20ddce]={'$like':'%'+_0x170555[_0x464d('0x39')][_0x464d('0x48')]+'%'};return _0x5b7eec;})});}_0xdbc286=_[_0x464d('0x46')]({},_0xdbc286,_0x170555['options']);return db[_0x464d('0xc8')][_0x464d('0x28')]({'where':_0xdbc286[_0x464d('0x47')]})[_0x464d('0x32')](function(_0x266bb4){_0xee33f1[_0x464d('0x28')]=_0x266bb4;if(_0x170555[_0x464d('0x39')][_0x464d('0x51')]){_0xdbc286[_0x464d('0x5b')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x464d('0x5c')](_0xdbc286);})[_0x464d('0x32')](function(_0x895b83){_0xee33f1[_0x464d('0x4c')]=_0x895b83;return _0xee33f1;});}})[_0x464d('0x32')](respondWithFilteredResult(_0x10d2f0,_0xdbc286))[_0x464d('0x23')](handleError(_0x10d2f0,null));};exports[_0x464d('0x10a')]=function(_0x32144d,_0x47f121,_0x394489){return db[_0x464d('0x4b')][_0x464d('0x54')]({'where':{'id':_0x32144d[_0x464d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x47f121,null))[_0x464d('0x32')](function(_0x5582ff){if(_0x5582ff){return _0x5582ff[_0x464d('0x10a')](_0x32144d[_0x464d('0x53')][_0x464d('0x5e')],_[_0x464d('0xd9')](_0x32144d[_0x464d('0x53')],[_0x464d('0x5e'),'id'])||{})[_0x464d('0xc2')](function(_0x3c4307){for(var _0x4d46c2=0x0;_0x4d46c2<_0x32144d[_0x464d('0x53')]['ids']['length'];_0x4d46c2+=0x1){socket['emit']('userChatWebsite:save',{'UserId':_0x32144d[_0x464d('0x53')][_0x464d('0x5e')][_0x4d46c2],'ChatWebsiteId':_0x32144d[_0x464d('0x4e')]['id']});}return _0x3c4307;});}})[_0x464d('0x32')](respondWithResult(_0x47f121,null))['catch'](handleError(_0x47f121,null));};exports[_0x464d('0x10b')]=function(_0x228a09,_0x5b5344,_0x51fc7f){var _0x57cdc9;return db[_0x464d('0x4b')][_0x464d('0x54')]({'where':{'id':_0x228a09[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x5b5344,null))[_0x464d('0x32')](function(_0x126e8c){if(_0x126e8c){return _0x126e8c[_0x464d('0x10b')](_0x228a09[_0x464d('0x39')][_0x464d('0x5e')])[_0x464d('0x32')](function(_0x2b20fa){if(_['isArray'](_0x228a09[_0x464d('0x39')]['ids'])){for(var _0x988357=0x0;_0x988357<_0x228a09[_0x464d('0x39')][_0x464d('0x5e')][_0x464d('0x50')];_0x988357+=0x1){socket[_0x464d('0x10c')](_0x464d('0x10d'),{'UserId':_0x228a09[_0x464d('0x39')][_0x464d('0x5e')][_0x988357],'ChatWebsiteId':_0x228a09[_0x464d('0x4e')]['id']});}}else{socket[_0x464d('0x10c')]('userChatWebsite:remove',{'UserId':_0x228a09['query'][_0x464d('0x5e')],'ChatWebsiteId':_0x228a09[_0x464d('0x4e')]['id']});}});}})[_0x464d('0x32')](respondWithStatusCode(_0x5b5344,null))['catch'](handleError(_0x5b5344,null));};exports[_0x464d('0x10e')]=function(_0x5ef3e7,_0x71182d,_0x5e2d7b){var _0x477cf8={};var _0x4f12d7={};var _0x57c081;var _0x4e2073;return db[_0x464d('0x4b')][_0x464d('0x58')]({'where':{'id':_0x5ef3e7[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x71182d,null))[_0x464d('0x32')](function(_0x47c226){if(_0x47c226){_0x57c081=_0x47c226;_0x4f12d7[_0x464d('0x37')]=_['keys'](db['User'][_0x464d('0x4f')]);_0x4f12d7['query']=_[_0x464d('0x38')](_0x5ef3e7[_0x464d('0x39')]);_0x4f12d7['filters']=_[_0x464d('0x3c')](_0x4f12d7[_0x464d('0x37')],_0x4f12d7[_0x464d('0x39')]);_0x477cf8[_0x464d('0x3d')]=_[_0x464d('0x3c')](_0x4f12d7[_0x464d('0x37')],qs[_0x464d('0x3e')](_0x5ef3e7[_0x464d('0x39')][_0x464d('0x3e')]));_0x477cf8[_0x464d('0x3d')]=_0x477cf8[_0x464d('0x3d')][_0x464d('0x50')]?_0x477cf8['attributes']:_0x4f12d7[_0x464d('0x37')];_0x477cf8[_0x464d('0x5a')]=qs[_0x464d('0x41')](_0x5ef3e7['query'][_0x464d('0x41')]);_0x477cf8[_0x464d('0x47')]=qs[_0x464d('0x42')](_['pick'](_0x5ef3e7[_0x464d('0x39')],_0x4f12d7[_0x464d('0x42')]));if(_0x5ef3e7['query'][_0x464d('0x48')]){_0x477cf8[_0x464d('0x47')]=_['merge'](_0x477cf8[_0x464d('0x47')],{'$or':_['map'](_0x477cf8[_0x464d('0x3d')],function(_0x3d86e2){var _0x51f2e2={};_0x51f2e2[_0x3d86e2]={'$like':'%'+_0x5ef3e7['query'][_0x464d('0x48')]+'%'};return _0x51f2e2;})});}_0x477cf8=_[_0x464d('0x46')]({},_0x477cf8,_0x5ef3e7['options']);return _0x57c081[_0x464d('0x10e')](_0x477cf8);}})[_0x464d('0x32')](function(_0x1194f1){if(_0x1194f1){_0x4e2073=_0x1194f1[_0x464d('0x50')];if(!_0x5ef3e7[_0x464d('0x39')][_0x464d('0x3f')](_0x464d('0x40'))){_0x477cf8['limit']=qs[_0x464d('0x2a')](_0x5ef3e7[_0x464d('0x39')][_0x464d('0x2a')]);_0x477cf8[_0x464d('0x29')]=qs[_0x464d('0x29')](_0x5ef3e7[_0x464d('0x39')][_0x464d('0x29')]);}return _0x57c081[_0x464d('0x10e')](_0x477cf8);}})[_0x464d('0x32')](function(_0x37b4e8){if(_0x37b4e8){return _0x37b4e8?{'count':_0x4e2073,'rows':_0x37b4e8}:null;}})[_0x464d('0x32')](respondWithResult(_0x71182d,null))['catch'](handleError(_0x71182d,null));}; \ No newline at end of file +var _0xbbad=['result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','index','ChatWebsite','model','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','rows','show','keys','find','create','body','params','addDisposition','ChatWebsiteId','getDispositions','findOne','Disposition','rawAttributes','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','filename','addAvatar','addCustomerAvatar','file','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.png','custom','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','isNil','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','list','priority','asc','defaults','contact','firstName','lastName','referer','browser','version','format','unknown','%s\x20%s','device','vendor','type','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','update','get','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','startRouting','Start','EventManager','offline','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','user','SendMail','sendMail','\x22%s\x22\x20<%s>','email','addInteraction','omit','getInteractions','Contact','fullname','internal','Tag','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','Interval','Intervals','getProactiveActions','../../config/license/util','getLicense','virtual','License','increment','chatLicenseExceeded','all','some','x-real-ip','connection','remoteAddress','verticalAlignment','addApplications','sequelize','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','items','fromKey','addAgents','userChatWebsite:save','removeAgents','emit','getAgents','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','./chatWebsite.socket','register','client','http','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x4308d6,_0x190ca7){var _0x6c2640=function(_0x49b7ea){while(--_0x49b7ea){_0x4308d6['push'](_0x4308d6['shift']());}};_0x6c2640(++_0x190ca7);}(_0xbbad,0xec));var _0xdbba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbad[_0x3dd15e];return _0x231fd0;};'use strict';var jsonpatch=require(_0xdbba('0x0'));var rp=require(_0xdbba('0x1'));var moment=require('moment');var BPromise=require(_0xdbba('0x2'));var Mustache=require(_0xdbba('0x3'));var util=require(_0xdbba('0x4'));var path=require(_0xdbba('0x5'));var sox=require(_0xdbba('0x6'));var csv=require(_0xdbba('0x7'));var ejs=require(_0xdbba('0x8'));var fs=require('fs');var _=require(_0xdbba('0x9'));var squel=require(_0xdbba('0xa'));var crypto=require('crypto');var jsforce=require(_0xdbba('0xb'));var deskjs=require(_0xdbba('0xc'));var toCsv=require('to-csv');var querystring=require(_0xdbba('0xd'));var Papa=require(_0xdbba('0xe'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xdbba('0xf'));var utils=require(_0xdbba('0x10'));var config=require(_0xdbba('0x11'));var db=require(_0xdbba('0x12'))['db'];var socket=require(_0xdbba('0x13'))({'host':'localhost','port':0x18eb});require(_0xdbba('0x14'))[_0xdbba('0x15')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdbba('0x16')][_0xdbba('0x17')]({'port':0x232c});var client9002=jayson[_0xdbba('0x16')][_0xdbba('0x17')]({'port':0x232a});var client9003=jayson[_0xdbba('0x16')][_0xdbba('0x17')]({'port':0x232b});function respondWithRpcPromise(_0x1b94e8,_0x258da7,_0x159345,_0x46b6ff){return new BPromise(function(_0x4623c6,_0x48c73){var _0x3ddc64=_0x46b6ff||client;return _0x3ddc64['request'](_0x1b94e8,_0x159345)['then'](function(_0x426069){logger[_0xdbba('0x18')](_0xdbba('0x19'),_0x258da7,_0xdbba('0x1a'));logger[_0xdbba('0x1b')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x258da7,_0xdbba('0x1a'),JSON[_0xdbba('0x1c')](_0x426069));if(_0x426069['error']){if(_0x426069[_0xdbba('0x1d')][_0xdbba('0x1e')]===0x1f4){logger[_0xdbba('0x1d')](_0xdbba('0x19'),_0x258da7,_0x426069[_0xdbba('0x1d')][_0xdbba('0x1f')]);return _0x48c73(_0x426069[_0xdbba('0x1d')]['message']);}logger['error'](_0xdbba('0x19'),_0x258da7,_0x426069[_0xdbba('0x1d')][_0xdbba('0x1f')]);return _0x4623c6(_0x426069['error']['message']);}else{logger[_0xdbba('0x18')](_0xdbba('0x19'),_0x258da7,'request\x20sent');_0x4623c6(_0x426069[_0xdbba('0x20')][_0xdbba('0x1f')]);}})[_0xdbba('0x21')](function(_0x1222b9){logger[_0xdbba('0x1d')](_0xdbba('0x19'),_0x258da7,_0x1222b9);_0x48c73(_0x1222b9);});});}function respondWithStatusCode(_0x3aaa8a,_0x50cffa){_0x50cffa=_0x50cffa||0xcc;return function(_0x2daa98){if(_0x2daa98){return _0x3aaa8a[_0xdbba('0x22')](_0x50cffa);}return _0x3aaa8a[_0xdbba('0x23')](_0x50cffa)['end']();};}function respondWithResult(_0x3ed101,_0x3b7119){_0x3b7119=_0x3b7119||0xc8;return function(_0x34ac64){if(_0x34ac64){return _0x3ed101[_0xdbba('0x23')](_0x3b7119)[_0xdbba('0x24')](_0x34ac64);}};}function respondWithFilteredResult(_0x54808d,_0x1e6d1b){return function(_0xaddaa8){if(_0xaddaa8){var _0x5632eb=_0xaddaa8[_0xdbba('0x25')],_0x15808a=_0x1e6d1b[_0xdbba('0x26')],_0x592207=_0x1e6d1b[_0xdbba('0x26')]+_0x1e6d1b[_0xdbba('0x27')],_0x2ee8dd;if(_0x592207>=_0x5632eb){_0x592207=_0x5632eb;_0x2ee8dd=0xc8;}else{_0x2ee8dd=0xce;}_0x54808d[_0xdbba('0x23')](_0x2ee8dd);return _0x54808d[_0xdbba('0x28')](_0xdbba('0x29'),_0x15808a+'-'+_0x592207+'/'+_0x5632eb)['json'](_0xaddaa8);}return null;};}function patchUpdates(_0x3284da){return function(_0x3218e7){try{jsonpatch[_0xdbba('0x2a')](_0x3218e7,_0x3284da,!![]);}catch(_0x1ca4f9){return BPromise[_0xdbba('0x2b')](_0x1ca4f9);}return _0x3218e7[_0xdbba('0x2c')]();};}function saveUpdates(_0x5ff80d,_0x8d422b){return function(_0x1cf2a4){if(_0x1cf2a4){return _0x1cf2a4['update'](_0x5ff80d)[_0xdbba('0x2d')](function(_0x80cb44){return _0x80cb44;});}return null;};}function removeEntity(_0x17aa0f,_0x52e3ce){return function(_0x1d2f83){if(_0x1d2f83){return _0x1d2f83[_0xdbba('0x2e')]()[_0xdbba('0x2d')](function(){_0x17aa0f[_0xdbba('0x23')](0xcc)[_0xdbba('0x2f')]();});}};}function handleEntityNotFound(_0x199271,_0x5df5e1){return function(_0x23f970){if(!_0x23f970){_0x199271[_0xdbba('0x22')](0x194);}return _0x23f970;};}function handleError(_0x2dde0a,_0xd3ea00){_0xd3ea00=_0xd3ea00||0x1f4;return function(_0x5150b3){logger[_0xdbba('0x1d')](_0x5150b3[_0xdbba('0x30')]);if(_0x5150b3[_0xdbba('0x31')]){delete _0x5150b3[_0xdbba('0x31')];}_0x2dde0a['status'](_0xd3ea00)[_0xdbba('0x32')](_0x5150b3);};}exports[_0xdbba('0x33')]=function(_0x538203,_0x135e08){var _0x5e9c89={},_0xe34fb5={},_0x21cb57={'count':0x0,'rows':[]};var _0x1c0f17=db[_0xdbba('0x34')]['rawAttributes'];_0xe34fb5[_0xdbba('0x35')]=_['keys'](_0x1c0f17);var _0x1db845={'dateStart':_0x538203[_0xdbba('0x36')][_0xdbba('0x37')],'dateEnd':_0x538203['query'][_0xdbba('0x38')]};delete _0x538203[_0xdbba('0x36')]['dateStart'];delete _0x538203[_0xdbba('0x36')][_0xdbba('0x38')];_0xe34fb5['query']=_['keys'](_0x538203[_0xdbba('0x36')]);_0xe34fb5[_0xdbba('0x39')]=_['intersection'](_0xe34fb5[_0xdbba('0x35')],_0xe34fb5[_0xdbba('0x36')]);_0x5e9c89[_0xdbba('0x3a')]=_[_0xdbba('0x3b')](_0xe34fb5[_0xdbba('0x35')],qs[_0xdbba('0x3c')](_0x538203[_0xdbba('0x36')][_0xdbba('0x3c')]));_0x5e9c89['attributes']=_0x5e9c89[_0xdbba('0x3a')][_0xdbba('0x3d')]?_0x5e9c89[_0xdbba('0x3a')]:_0xe34fb5[_0xdbba('0x35')];if(!_0x538203[_0xdbba('0x36')][_0xdbba('0x3e')](_0xdbba('0x3f'))){_0x5e9c89[_0xdbba('0x27')]=qs[_0xdbba('0x27')](_0x538203[_0xdbba('0x36')][_0xdbba('0x27')]);_0x5e9c89['offset']=qs[_0xdbba('0x26')](_0x538203[_0xdbba('0x36')][_0xdbba('0x26')]);}_0x5e9c89[_0xdbba('0x40')]=qs[_0xdbba('0x41')](_0x538203[_0xdbba('0x36')]['sort']);_0x5e9c89[_0xdbba('0x42')]=qs[_0xdbba('0x39')](_[_0xdbba('0x43')](_0x538203[_0xdbba('0x36')],_0xe34fb5[_0xdbba('0x39')]));if(_0x1db845[_0xdbba('0x37')]){if(_0x1db845[_0xdbba('0x38')]){_0x1db845[_0xdbba('0x38')]=moment(_0x1db845[_0xdbba('0x38')])[_0xdbba('0x44')](0x1,_0xdbba('0x45'));}else{_0x1db845[_0xdbba('0x38')]=moment(_0x1db845[_0xdbba('0x37')])[_0xdbba('0x44')](0x1,_0xdbba('0x45'));}_[_0xdbba('0x46')](_0x5e9c89[_0xdbba('0x42')],{'createdAt':{'$gte':_0x1db845['dateStart'],'$lte':_0x1db845['dateEnd']}});}if(_0x538203[_0xdbba('0x36')][_0xdbba('0x47')]){_0x5e9c89[_0xdbba('0x42')]=_[_0xdbba('0x46')](_0x5e9c89[_0xdbba('0x42')],{'$or':_[_0xdbba('0x48')](_0x5e9c89[_0xdbba('0x3a')],function(_0x4f7005){var _0x311e9d={};_0x311e9d[_0x4f7005]={'$like':'%'+_0x538203[_0xdbba('0x36')][_0xdbba('0x47')]+'%'};return _0x311e9d;})});}_0x5e9c89=_['merge']({},_0x5e9c89,_0x538203[_0xdbba('0x49')]);var _0x17658f={'where':_0x5e9c89[_0xdbba('0x42')]};return db['ChatWebsite'][_0xdbba('0x25')](_0x17658f)[_0xdbba('0x2d')](function(_0x2fe513){_0x21cb57['count']=_0x2fe513;if(_0x538203[_0xdbba('0x36')][_0xdbba('0x4a')]){_0x5e9c89[_0xdbba('0x4b')]=[{'all':!![]}];}return db[_0xdbba('0x34')]['findAll'](_0x5e9c89);})[_0xdbba('0x2d')](function(_0x2fe51e){_0x21cb57[_0xdbba('0x4c')]=_0x2fe51e;return _0x21cb57;})['then'](respondWithFilteredResult(_0x135e08,_0x5e9c89))[_0xdbba('0x21')](handleError(_0x135e08,null));};exports[_0xdbba('0x4d')]=function(_0x3ba555,_0x478743){var _0x3399a7={'raw':![],'where':{'id':_0x3ba555['params']['id']}},_0x2b550c={};_0x2b550c[_0xdbba('0x35')]=_[_0xdbba('0x4e')](db[_0xdbba('0x34')]['rawAttributes']);_0x2b550c[_0xdbba('0x36')]=_[_0xdbba('0x4e')](_0x3ba555[_0xdbba('0x36')]);_0x2b550c[_0xdbba('0x39')]=_[_0xdbba('0x3b')](_0x2b550c[_0xdbba('0x35')],_0x2b550c['query']);_0x3399a7[_0xdbba('0x3a')]=_[_0xdbba('0x3b')](_0x2b550c[_0xdbba('0x35')],qs[_0xdbba('0x3c')](_0x3ba555[_0xdbba('0x36')][_0xdbba('0x3c')]));_0x3399a7[_0xdbba('0x3a')]=_0x3399a7[_0xdbba('0x3a')]['length']?_0x3399a7[_0xdbba('0x3a')]:_0x2b550c['model'];if(_0x3ba555[_0xdbba('0x36')][_0xdbba('0x4a')]){_0x3399a7[_0xdbba('0x4b')]=[{'all':!![]}];}_0x3399a7=_[_0xdbba('0x46')]({},_0x3399a7,_0x3ba555[_0xdbba('0x49')]);return db[_0xdbba('0x34')][_0xdbba('0x4f')](_0x3399a7)[_0xdbba('0x2d')](handleEntityNotFound(_0x478743,null))['then'](respondWithResult(_0x478743,null))[_0xdbba('0x21')](handleError(_0x478743,null));};exports['create']=function(_0x3499e4,_0xf60856){return db[_0xdbba('0x34')][_0xdbba('0x50')](_0x3499e4[_0xdbba('0x51')],{})[_0xdbba('0x2d')](respondWithResult(_0xf60856,0xc9))[_0xdbba('0x21')](handleError(_0xf60856,null));};exports['update']=function(_0x5e405b,_0x6d4cb2){if(_0x5e405b[_0xdbba('0x51')]['id']){delete _0x5e405b[_0xdbba('0x51')]['id'];}return db[_0xdbba('0x34')][_0xdbba('0x4f')]({'where':{'id':_0x5e405b[_0xdbba('0x52')]['id']}})[_0xdbba('0x2d')](handleEntityNotFound(_0x6d4cb2,null))['then'](saveUpdates(_0x5e405b[_0xdbba('0x51')],null))['then'](respondWithResult(_0x6d4cb2,null))[_0xdbba('0x21')](handleError(_0x6d4cb2,null));};exports[_0xdbba('0x2e')]=function(_0x3753b9,_0x2f36d8){return db['ChatWebsite'][_0xdbba('0x4f')]({'where':{'id':_0x3753b9[_0xdbba('0x52')]['id']}})[_0xdbba('0x2d')](handleEntityNotFound(_0x2f36d8,null))['then'](removeEntity(_0x2f36d8,null))['catch'](handleError(_0x2f36d8,null));};exports['describe']=function(_0x57603f,_0x1a1e2f){return db[_0xdbba('0x34')]['describe']()[_0xdbba('0x2d')](respondWithResult(_0x1a1e2f,null))[_0xdbba('0x21')](handleError(_0x1a1e2f,null));};exports[_0xdbba('0x53')]=function(_0x1191ee,_0x5e74d5,_0xf77c92){if(_0x1191ee[_0xdbba('0x51')]['id']){delete _0x1191ee[_0xdbba('0x51')]['id'];}return db[_0xdbba('0x34')]['find']({'where':{'id':_0x1191ee[_0xdbba('0x52')]['id']}})['then'](handleEntityNotFound(_0x5e74d5,null))['then'](function(_0x325376){if(_0x325376){_0x1191ee[_0xdbba('0x51')][_0xdbba('0x54')]=_0x325376['id'];return db['Disposition'][_0xdbba('0x50')](_0x1191ee[_0xdbba('0x51')]);}})['then'](respondWithResult(_0x5e74d5,null))[_0xdbba('0x21')](handleError(_0x5e74d5,null));};exports[_0xdbba('0x55')]=function(_0x71761e,_0x242da9,_0x2c031f){var _0x1bd708={'raw':![],'where':{}};var _0x5efce6={};var _0x2dac18={'count':0x0,'rows':[]};return db[_0xdbba('0x34')][_0xdbba('0x56')]({'where':{'id':_0x71761e['params']['id']}})['then'](handleEntityNotFound(_0x242da9,null))[_0xdbba('0x2d')](function(_0x3c1560){if(_0x3c1560){_0x5efce6['model']=_[_0xdbba('0x4e')](db[_0xdbba('0x57')][_0xdbba('0x58')]);_0x5efce6[_0xdbba('0x36')]=_[_0xdbba('0x4e')](_0x71761e[_0xdbba('0x36')]);_0x5efce6[_0xdbba('0x39')]=_[_0xdbba('0x3b')](_0x5efce6['model'],_0x5efce6[_0xdbba('0x36')]);_0x1bd708[_0xdbba('0x3a')]=_[_0xdbba('0x3b')](_0x5efce6['model'],qs['fields'](_0x71761e[_0xdbba('0x36')][_0xdbba('0x3c')]));_0x1bd708['attributes']=_0x1bd708[_0xdbba('0x3a')][_0xdbba('0x3d')]?_0x1bd708[_0xdbba('0x3a')]:_0x5efce6[_0xdbba('0x35')];if(!_0x71761e[_0xdbba('0x36')][_0xdbba('0x3e')]('nolimit')){_0x1bd708['limit']=qs[_0xdbba('0x27')](_0x71761e['query']['limit']);_0x1bd708[_0xdbba('0x26')]=qs[_0xdbba('0x26')](_0x71761e[_0xdbba('0x36')][_0xdbba('0x26')]);}_0x1bd708[_0xdbba('0x40')]=qs[_0xdbba('0x41')](_0x71761e[_0xdbba('0x36')]['sort']);_0x1bd708[_0xdbba('0x42')]=qs['filters'](_[_0xdbba('0x43')](_0x71761e[_0xdbba('0x36')],_0x5efce6[_0xdbba('0x39')]));_0x1bd708[_0xdbba('0x42')]['ChatWebsiteId']=_0x3c1560['id'];if(_0x71761e[_0xdbba('0x36')][_0xdbba('0x47')]){_0x1bd708[_0xdbba('0x42')]=_[_0xdbba('0x46')](_0x1bd708[_0xdbba('0x42')],{'$or':_[_0xdbba('0x48')](_0x1bd708[_0xdbba('0x3a')],function(_0x50d3db){var _0x3b625c={};_0x3b625c[_0x50d3db]={'$like':'%'+_0x71761e['query'][_0xdbba('0x47')]+'%'};return _0x3b625c;})});}_0x1bd708=_[_0xdbba('0x46')]({},_0x1bd708,_0x71761e[_0xdbba('0x49')]);return db['Disposition'][_0xdbba('0x25')]({'where':_0x1bd708[_0xdbba('0x42')]})[_0xdbba('0x2d')](function(_0x46be77){_0x2dac18[_0xdbba('0x25')]=_0x46be77;if(_0x71761e[_0xdbba('0x36')]['includeAll']){_0x1bd708[_0xdbba('0x4b')]=[{'all':!![]}];}return db[_0xdbba('0x57')][_0xdbba('0x59')](_0x1bd708);})[_0xdbba('0x2d')](function(_0x5a006c){_0x2dac18[_0xdbba('0x4c')]=_0x5a006c;return _0x2dac18;});}})[_0xdbba('0x2d')](respondWithFilteredResult(_0x242da9,_0x1bd708))[_0xdbba('0x21')](handleError(_0x242da9,null));};exports[_0xdbba('0x5a')]=function(_0x3da6e9,_0x3f0618,_0x2106d6){var _0x3a1347;return db[_0xdbba('0x34')][_0xdbba('0x4f')]({'where':{'id':_0x3da6e9['params']['id']}})['then'](handleEntityNotFound(_0x3f0618,null))['then'](function(_0x1ab823){if(_0x1ab823){return _0x1ab823[_0xdbba('0x5a')](_0x3da6e9[_0xdbba('0x36')][_0xdbba('0x5b')]);}})[_0xdbba('0x2d')](respondWithStatusCode(_0x3f0618,null))[_0xdbba('0x21')](handleError(_0x3f0618,null));};exports[_0xdbba('0x5c')]=function(_0x106f9c,_0x35d3b0,_0x379cf1){if(_0x106f9c['body']['id']){delete _0x106f9c[_0xdbba('0x51')]['id'];}return db[_0xdbba('0x34')]['find']({'where':{'id':_0x106f9c['params']['id']}})['then'](handleEntityNotFound(_0x35d3b0,null))[_0xdbba('0x2d')](function(_0x37c5de){if(_0x37c5de){_0x106f9c['body']['ChatWebsiteId']=_0x37c5de['id'];return db[_0xdbba('0x5d')]['create'](_0x106f9c['body']);}})[_0xdbba('0x2d')](respondWithResult(_0x35d3b0,null))['catch'](handleError(_0x35d3b0,null));};exports[_0xdbba('0x5e')]=function(_0x2c1a3c,_0x22f4b7,_0x1c4e48){var _0x2b66bd={'raw':![],'where':{}};var _0xa32593={};var _0x127f98={'count':0x0,'rows':[]};return db[_0xdbba('0x34')][_0xdbba('0x56')]({'where':{'id':_0x2c1a3c[_0xdbba('0x52')]['id']}})[_0xdbba('0x2d')](handleEntityNotFound(_0x22f4b7,null))[_0xdbba('0x2d')](function(_0x2b5b61){if(_0x2b5b61){_0xa32593[_0xdbba('0x35')]=_['keys'](db[_0xdbba('0x5d')]['rawAttributes']);_0xa32593[_0xdbba('0x36')]=_[_0xdbba('0x4e')](_0x2c1a3c[_0xdbba('0x36')]);_0xa32593['filters']=_[_0xdbba('0x3b')](_0xa32593[_0xdbba('0x35')],_0xa32593[_0xdbba('0x36')]);_0x2b66bd[_0xdbba('0x3a')]=_[_0xdbba('0x3b')](_0xa32593[_0xdbba('0x35')],qs[_0xdbba('0x3c')](_0x2c1a3c['query']['fields']));_0x2b66bd['attributes']=_0x2b66bd['attributes'][_0xdbba('0x3d')]?_0x2b66bd['attributes']:_0xa32593['model'];if(!_0x2c1a3c[_0xdbba('0x36')][_0xdbba('0x3e')](_0xdbba('0x3f'))){_0x2b66bd[_0xdbba('0x27')]=qs[_0xdbba('0x27')](_0x2c1a3c[_0xdbba('0x36')][_0xdbba('0x27')]);_0x2b66bd[_0xdbba('0x26')]=qs[_0xdbba('0x26')](_0x2c1a3c[_0xdbba('0x36')]['offset']);}_0x2b66bd[_0xdbba('0x40')]=qs[_0xdbba('0x41')](_0x2c1a3c['query']['sort']);_0x2b66bd[_0xdbba('0x42')]=qs[_0xdbba('0x39')](_[_0xdbba('0x43')](_0x2c1a3c['query'],_0xa32593[_0xdbba('0x39')]));_0x2b66bd['where'][_0xdbba('0x54')]=_0x2b5b61['id'];if(_0x2c1a3c[_0xdbba('0x36')][_0xdbba('0x47')]){_0x2b66bd[_0xdbba('0x42')]=_['merge'](_0x2b66bd[_0xdbba('0x42')],{'$or':_[_0xdbba('0x48')](_0x2b66bd['attributes'],function(_0x5a2e05){var _0x13edeb={};_0x13edeb[_0x5a2e05]={'$like':'%'+_0x2c1a3c[_0xdbba('0x36')][_0xdbba('0x47')]+'%'};return _0x13edeb;})});}_0x2b66bd=_['merge']({},_0x2b66bd,_0x2c1a3c['options']);return db[_0xdbba('0x5d')][_0xdbba('0x25')]({'where':_0x2b66bd['where']})[_0xdbba('0x2d')](function(_0x1290eb){_0x127f98[_0xdbba('0x25')]=_0x1290eb;if(_0x2c1a3c[_0xdbba('0x36')][_0xdbba('0x4a')]){_0x2b66bd[_0xdbba('0x4b')]=[{'all':!![]}];}return db[_0xdbba('0x5d')]['findAll'](_0x2b66bd);})[_0xdbba('0x2d')](function(_0x443ceb){_0x127f98['rows']=_0x443ceb;return _0x127f98;});}})[_0xdbba('0x2d')](respondWithFilteredResult(_0x22f4b7,_0x2b66bd))[_0xdbba('0x21')](handleError(_0x22f4b7,null));};exports[_0xdbba('0x5f')]=function(_0x1bc0fa,_0x44ae24,_0x7c08e5){var _0x11382c;return db[_0xdbba('0x34')][_0xdbba('0x4f')]({'where':{'id':_0x1bc0fa[_0xdbba('0x52')]['id']}})[_0xdbba('0x2d')](handleEntityNotFound(_0x44ae24,null))[_0xdbba('0x2d')](function(_0x3c463f){if(_0x3c463f){return _0x3c463f['removeAnswers'](_0x1bc0fa[_0xdbba('0x36')][_0xdbba('0x5b')]);}})[_0xdbba('0x2d')](respondWithStatusCode(_0x44ae24,null))['catch'](handleError(_0x44ae24,null));};exports[_0xdbba('0x60')]=function(_0x4b6c6d,_0x229705,_0x257272){_0x4b6c6d[_0xdbba('0x51')][_0xdbba('0x61')]=_0x4b6c6d['file'][_0xdbba('0x62')];return db['ChatWebsite'][_0xdbba('0x4f')]({'where':{'id':_0x4b6c6d[_0xdbba('0x52')]['id']}})[_0xdbba('0x2d')](handleEntityNotFound(_0x229705,null))[_0xdbba('0x2d')](saveUpdates(_0x4b6c6d[_0xdbba('0x51')],null))[_0xdbba('0x2d')](respondWithResult(_0x229705,null))[_0xdbba('0x21')](handleError(_0x229705,null));};exports[_0xdbba('0x63')]=function(_0xfac202,_0x14c353,_0x4993f3){_0xfac202[_0xdbba('0x51')]['agentAvatar']=_0xfac202['file'][_0xdbba('0x62')];return db[_0xdbba('0x34')][_0xdbba('0x4f')]({'where':{'id':_0xfac202[_0xdbba('0x52')]['id']}})[_0xdbba('0x2d')](handleEntityNotFound(_0x14c353,null))['then'](saveUpdates(_0xfac202[_0xdbba('0x51')],null))[_0xdbba('0x2d')](respondWithResult(_0x14c353,null))['catch'](handleError(_0x14c353,null));};exports[_0xdbba('0x64')]=function(_0x4c54d3,_0x1a1355,_0x5a68a5){_0x4c54d3['body']['customerAvatar']=_0x4c54d3[_0xdbba('0x65')][_0xdbba('0x62')];return db[_0xdbba('0x34')]['find']({'where':{'id':_0x4c54d3[_0xdbba('0x52')]['id']}})['then'](handleEntityNotFound(_0x1a1355,null))[_0xdbba('0x2d')](saveUpdates(_0x4c54d3['body'],null))[_0xdbba('0x2d')](respondWithResult(_0x1a1355,null))[_0xdbba('0x21')](handleError(_0x1a1355,null));};exports[_0xdbba('0x66')]=function(_0x4b158f,_0x4a6f95,_0x52ce42){_0x4b158f['body'][_0xdbba('0x67')]=_0x4b158f[_0xdbba('0x65')][_0xdbba('0x62')];return db[_0xdbba('0x34')][_0xdbba('0x4f')]({'where':{'id':_0x4b158f[_0xdbba('0x52')]['id']}})[_0xdbba('0x2d')](handleEntityNotFound(_0x4a6f95,null))[_0xdbba('0x2d')](saveUpdates(_0x4b158f[_0xdbba('0x51')],null))[_0xdbba('0x2d')](respondWithResult(_0x4a6f95,null))[_0xdbba('0x21')](handleError(_0x4a6f95,null));};exports[_0xdbba('0x68')]=function(_0x1c75fb,_0x31e7a9,_0xf71ed0){var _0x95ed60=path[_0xdbba('0x69')](config['root'],_0xdbba('0x6a'));var _0x1da8a1={'where':{'id':_0x1c75fb[_0xdbba('0x52')]['id']},'attributes':['id',_0xdbba('0x61')],'raw':!![]};var _0x2f7aac=![];return require('../../config/license/util')['getLicense']()[_0xdbba('0x2d')](function(_0x14f86c){if(_0x14f86c){_0x2f7aac=_0x14f86c[_0xdbba('0x6b')];}})['then'](function(){return db[_0xdbba('0x34')]['find'](_0x1da8a1);})[_0xdbba('0x2d')](handleEntityNotFound(_0x31e7a9,null))[_0xdbba('0x2d')](function(_0x190eae){if(_0x190eae){if(!_['isNil'](_0x190eae[_0xdbba('0x61')])){if(fs[_0xdbba('0x6c')](path['join'](config[_0xdbba('0x6d')],'server/files/images/logos/',_0x190eae[_0xdbba('0x61')]))&&_0x2f7aac){_0x95ed60=path['join'](config[_0xdbba('0x6d')],_0xdbba('0x6e'),_0x190eae[_0xdbba('0x61')]);}}return _0x31e7a9[_0xdbba('0x6f')](_0x95ed60);}})[_0xdbba('0x21')](handleError(_0x31e7a9,null));};exports[_0xdbba('0x70')]=function(_0x255269,_0x3a1b97,_0x5331cc){var _0x2faf94=path[_0xdbba('0x69')](config[_0xdbba('0x6d')],_0xdbba('0x71'));var _0x5e6634={'where':{'id':_0x255269['params']['id']},'attributes':['id',_0xdbba('0x72')],'raw':!![]};return db[_0xdbba('0x34')][_0xdbba('0x4f')](_0x5e6634)[_0xdbba('0x2d')](handleEntityNotFound(_0x3a1b97,null))[_0xdbba('0x2d')](function(_0x2bd420){if(_0x2bd420){if(!_['isNil'](_0x2bd420[_0xdbba('0x72')])){if(fs['existsSync'](path['join'](config[_0xdbba('0x6d')],_0xdbba('0x73'),_0x2bd420[_0xdbba('0x72')]))){_0x2faf94=path[_0xdbba('0x69')](config[_0xdbba('0x6d')],'server/files/images/avatars/',_0x2bd420['agentAvatar']);}}return _0x3a1b97[_0xdbba('0x6f')](_0x2faf94);}})[_0xdbba('0x21')](handleError(_0x3a1b97,null));};exports[_0xdbba('0x74')]=function(_0xb3a1a2,_0xd21089,_0x4f5a71){var _0x5ee6c6=path[_0xdbba('0x69')](config[_0xdbba('0x6d')],_0xdbba('0x75'));var _0x33205a={'where':{'id':_0xb3a1a2['params']['id']},'attributes':['id',_0xdbba('0x76'),_0xdbba('0x77')],'raw':!![]};return db[_0xdbba('0x34')][_0xdbba('0x4f')](_0x33205a)[_0xdbba('0x2d')](handleEntityNotFound(_0xd21089,null))[_0xdbba('0x2d')](function(_0x258785){if(_0x258785){if(!_[_0xdbba('0x78')](_0x258785[_0xdbba('0x76')])){if(fs['existsSync'](path[_0xdbba('0x69')](config[_0xdbba('0x6d')],_0xdbba('0x73'),_0x258785[_0xdbba('0x76')]))&&_0x258785[_0xdbba('0x77')]){_0x5ee6c6=path['join'](config[_0xdbba('0x6d')],'server/files/images/avatars/',_0x258785['customerAvatar']);}}return _0xd21089[_0xdbba('0x6f')](_0x5ee6c6);}})[_0xdbba('0x21')](handleError(_0xd21089,null));};exports[_0xdbba('0x79')]=function(_0x497c83,_0x2bbad1,_0x1f7a32){var _0x3d64e3=path['join'](config[_0xdbba('0x6d')],_0xdbba('0x7a'));var _0x2ba1e1={'where':{'id':_0x497c83[_0xdbba('0x52')]['id']},'attributes':['id',_0xdbba('0x67')],'raw':!![]};return db[_0xdbba('0x34')][_0xdbba('0x4f')](_0x2ba1e1)[_0xdbba('0x2d')](handleEntityNotFound(_0x2bbad1,null))[_0xdbba('0x2d')](function(_0x383891){if(_0x383891){if(!_[_0xdbba('0x78')](_0x383891[_0xdbba('0x67')])){if(fs['existsSync'](path['join'](config[_0xdbba('0x6d')],_0xdbba('0x73'),_0x383891[_0xdbba('0x67')]))){_0x3d64e3=path[_0xdbba('0x69')](config[_0xdbba('0x6d')],_0xdbba('0x73'),_0x383891[_0xdbba('0x67')]);}}return _0x2bbad1[_0xdbba('0x6f')](_0x3d64e3);}})[_0xdbba('0x21')](handleError(_0x2bbad1,null));};exports[_0xdbba('0x7b')]=function(_0x5db912,_0x531baf,_0x211c53){var _0x1ac929=require(_0xdbba('0x7c'));var _0x316882=new _0x1ac929();var _0xcc8395=_0x316882[_0xdbba('0x7d')](_0x5db912[_0xdbba('0x7e')][_0xdbba('0x7f')])[_0xdbba('0x80')]();var _0x1865d8={'body':_0x5db912[_0xdbba('0x51')],'channel':_0xdbba('0x81')};var _0x1052f0=[];var _0x1a9d8b=[];var _0x2206ed={};var _0x22489b=![];return db[_0xdbba('0x82')][_0xdbba('0x83')]()[_0xdbba('0x2d')](function(_0x18bae2){if(!_0x18bae2){throw new db[(_0xdbba('0x84'))][(_0xdbba('0x85'))](_0xdbba('0x86'));}_0x1052f0=_['difference'](_['keys'](_0x18bae2),[_0xdbba('0x87'),_0xdbba('0x88')]);_0x1a9d8b=_[_0xdbba('0x89')](_[_0xdbba('0x4e')](_0x18bae2),[_0xdbba('0x87'),_0xdbba('0x88'),_0xdbba('0x8a'),_0xdbba('0x8b')]);if(_0x5db912[_0xdbba('0x51')]['id']){delete _0x5db912[_0xdbba('0x51')]['id'];}if(_[_0xdbba('0x78')](_0x5db912[_0xdbba('0x51')][_0xdbba('0x8c')])){throw new db[(_0xdbba('0x84'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xdbba('0x78')](_0x5db912[_0xdbba('0x51')][_0xdbba('0x51')])||_0x5db912[_0xdbba('0x51')][_0xdbba('0x51')]===''){throw new db['Sequelize']['ValidationError'](_0xdbba('0x8d'));}if(_[_0xdbba('0x78')](_0x5db912[_0xdbba('0x51')][_0xdbba('0x8e')])){throw new db[(_0xdbba('0x84'))][(_0xdbba('0x85'))](_0xdbba('0x8f')+_0x1a9d8b);}if(!_[_0xdbba('0x90')](_0x1a9d8b,_0x5db912[_0xdbba('0x51')][_0xdbba('0x8e')])){throw new db[(_0xdbba('0x84'))][(_0xdbba('0x85'))](_0xdbba('0x91')+_0x1a9d8b);}_0x2206ed[_0x5db912['body'][_0xdbba('0x8e')]]=_0x5db912[_0xdbba('0x51')][_0xdbba('0x8c')];})['then'](function(){return db[_0xdbba('0x34')]['find']({'where':{'id':_0x5db912['params']['id']},'include':[{'model':db[_0xdbba('0x92')],'as':_0xdbba('0x93'),'include':[{'model':db[_0xdbba('0x82')],'as':_0xdbba('0x94'),'where':_0x2206ed,'limit':0x1,'order':[[_0xdbba('0x88'),_0xdbba('0x95')]]}]},{'model':db[_0xdbba('0x96')],'as':_0xdbba('0x97')}]});})['then'](handleEntityNotFound(_0x531baf,null))[_0xdbba('0x2d')](function(_0x532152){if(_0x532152&&_0x532152[_0xdbba('0x93')]){_0x1865d8[_0xdbba('0x98')]=_0x532152;_0x1865d8[_0xdbba('0x99')]=_0x532152[_0xdbba('0x97')];_0x1865d8[_0xdbba('0x9a')]=_0x532152[_0xdbba('0x93')];_0x1865d8[_0xdbba('0x99')]=_['orderBy'](_0x1865d8['applications'],[_0xdbba('0x9b')],[_0xdbba('0x9c')]);if(_0x1865d8[_0xdbba('0x98')][_0xdbba('0x97')]){delete _0x1865d8[_0xdbba('0x98')]['Applications'];}if(_0x1865d8[_0xdbba('0x98')][_0xdbba('0x93')]&&_0x1865d8['account'][_0xdbba('0x93')][_0xdbba('0x94')]['length']){return _0x1865d8[_0xdbba('0x98')][_0xdbba('0x93')]['Contacts'][0x0];}var _0x31a753=_[_0xdbba('0x9d')](_0x5db912['body'],{'firstName':_0x5db912[_0xdbba('0x51')][_0xdbba('0x8c')],'ListId':_0x532152[_0xdbba('0x8b')]});_0x31a753[_0x5db912[_0xdbba('0x51')][_0xdbba('0x8e')]]=_0x5db912[_0xdbba('0x51')]['from'];return db[_0xdbba('0x82')][_0xdbba('0x50')](_0x31a753,{'fields':_0x1052f0,'raw':!![]});}})[_0xdbba('0x2d')](handleEntityNotFound(_0x531baf,null))[_0xdbba('0x2d')](function(_0x1e7c51){_0x1865d8[_0xdbba('0x9e')]=_0x1e7c51;if(_0x1e7c51){var _0x47594e={'ContactId':_0x1e7c51['id'],'ChatWebsiteId':_0x5db912[_0xdbba('0x52')]['id'],'from':(_0x1e7c51[_0xdbba('0x9f')]||'')+'\x20'+(_0x1e7c51[_0xdbba('0xa0')]||''),'customerIp':_0x5db912[_0xdbba('0x51')]['customerIp'],'referer':_0x5db912[_0xdbba('0x51')][_0xdbba('0xa1')],'browserName':_0xcc8395['browser']['name']&&_0xcc8395[_0xdbba('0xa2')][_0xdbba('0xa3')]?util[_0xdbba('0xa4')]('%s\x20%s',_0xcc8395[_0xdbba('0xa2')][_0xdbba('0x31')],_0xcc8395[_0xdbba('0xa2')][_0xdbba('0xa3')]):_0xdbba('0xa5'),'browserVersion':_0xcc8395[_0xdbba('0xa2')][_0xdbba('0xa3')]||_0xdbba('0xa5'),'osName':util[_0xdbba('0xa4')](_0xdbba('0xa6'),_0xcc8395['os']['name'],_0xcc8395['os'][_0xdbba('0xa3')]),'osVersion':_0xcc8395['os'][_0xdbba('0xa3')],'deviceModel':_0xcc8395[_0xdbba('0xa7')]['model']&&_0xcc8395[_0xdbba('0xa7')][_0xdbba('0xa8')]?util['format']('%s\x20%s\x20%s',_0xcc8395[_0xdbba('0xa7')]['model'],_0xcc8395[_0xdbba('0xa7')]['vendor'],_0xcc8395[_0xdbba('0xa7')][_0xdbba('0xa9')]):null,'deviceVendor':_0xcc8395['device']['vendor'],'deviceType':_0xcc8395[_0xdbba('0xa7')]['type'],'formData':JSON[_0xdbba('0x1c')](_0x5db912[_0xdbba('0x51')])};var _0x300ad0={'ChatWebsiteId':_0x5db912[_0xdbba('0x52')]['id'],'closed':![]};if(_0x5db912['body']['threadId']){_0x300ad0[_0xdbba('0xaa')]=_0x5db912[_0xdbba('0x51')][_0xdbba('0xaa')];return db[_0xdbba('0xab')]['find']({'where':_0x300ad0})[_0xdbba('0x2d')](function(_0x51e8a1){if(_0x51e8a1){return[_0x51e8a1,![]];}_0x47594e[_0xdbba('0xaa')]=_0x5db912[_0xdbba('0x51')][_0xdbba('0xaa')];_0x47594e[_0xdbba('0xac')]=_0x5db912[_0xdbba('0x51')][_0xdbba('0xac')];return db[_0xdbba('0xab')][_0xdbba('0x50')](_0x47594e)['then'](function(_0x289fb2){return[_0x289fb2,!![]];});});}_0x300ad0[_0xdbba('0xad')]=_0x1e7c51['id'];if(_0x5db912[_0xdbba('0x51')][_0xdbba('0xae')]&&_0x5db912[_0xdbba('0x51')]['interaction']['id']){_0x300ad0['id']=_0x5db912[_0xdbba('0x51')][_0xdbba('0xae')]['id'];return db['ChatInteraction'][_0xdbba('0x4f')]({'where':_0x300ad0})[_0xdbba('0x2d')](function(_0x119a5a){if(_0x119a5a){return[_0x119a5a,![]];}return db[_0xdbba('0xab')][_0xdbba('0x50')](_0x47594e)['then'](function(_0x1d9032){return[_0x1d9032,!![]];});});}return db[_0xdbba('0xab')]['create'](_0x47594e)[_0xdbba('0x2d')](function(_0x56cfa2){return[_0x56cfa2,!![]];});}})[_0xdbba('0xaf')](function(_0x3b5019,_0x1c2148){if(_0x3b5019){_0x22489b=_0x1c2148;if(!_0x1c2148){return _0x3b5019[_0xdbba('0xb0')]({'from':(_0x1865d8[_0xdbba('0x9e')][_0xdbba('0x9f')]||'')+'\x20'+(_0x1865d8[_0xdbba('0x9e')]['lastName']||'')});}else{return _0x3b5019;}}})[_0xdbba('0x2d')](function(_0x1e136e){_0x1865d8[_0xdbba('0xae')]=_0x1e136e[_0xdbba('0xb1')]({'plain':!![]});_0x1865d8[_0xdbba('0xae')][_0xdbba('0xb2')]=_0x22489b;if(_0x1865d8['interaction'][_0xdbba('0xb2')]){if(_0x1865d8[_0xdbba('0x98')][_0xdbba('0xb3')]){_0x1865d8[_0xdbba('0x99')][_0xdbba('0xb4')]({'id':0x0,'priority':_0x1865d8['applications'][_0xdbba('0x3d')]+0x1,'app':_0xdbba('0xb5'),'appdata':_0xdbba('0xb6'),'interval':_0xdbba('0xb7')});}}return db[_0xdbba('0xb8')][_0xdbba('0x50')]({'body':_0x5db912['body']['body'],'ChatWebsiteId':_0x5db912[_0xdbba('0x52')]['id'],'ChatInteractionId':_0x1e136e['id'],'direction':'in','ContactId':_0x1865d8[_0xdbba('0x9e')]['id'],'AttachmentId':_0x5db912[_0xdbba('0x51')][_0xdbba('0xb9')]});})['then'](function(_0x3acb5b){_0x1865d8[_0xdbba('0x1f')]=_0x3acb5b;if(_0x1865d8[_0xdbba('0xae')][_0xdbba('0xba')]){return db[_0xdbba('0xbb')][_0xdbba('0x4f')]({'attributes':['id',_0xdbba('0x31')],'where':{'id':_0x1865d8[_0xdbba('0xae')]['UserId']}})[_0xdbba('0x2d')](function(_0xcd32b0){if(_0xcd32b0){_0x1865d8['applications'][_0xdbba('0xbc')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xcd32b0[_0xdbba('0x31')]+','+(_0x1865d8[_0xdbba('0x98')][_0xdbba('0xbd')]||0xa),'interval':_0xdbba('0xb7')});_0x1865d8['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0xdbba('0xbe'),_0x1865d8);});}return respondWithRpcPromise(_0xdbba('0xbf'),'startRouting',_0x1865d8);})['then'](function(_0x51e4a1){respondWithRpcPromise(_0xdbba('0xc0'),_0xdbba('0xc0'),{'event':_0xdbba('0x7b'),'message':_0x51e4a1},client9002);return _0x51e4a1;})[_0xdbba('0x2d')](respondWithResult(_0x531baf,null))['catch'](handleError(_0x531baf,null));};exports[_0xdbba('0xc1')]=function(_0x4e0bc9,_0x4360c1,_0x5738f0){var _0x22f1d7,_0x515cf8,_0x4cf9c4;var _0x147ab7=[];var _0x486f9d=[];var _0xa3bd20={};return db[_0xdbba('0x82')][_0xdbba('0x83')]()['then'](function(_0x2c8f16){if(!_0x2c8f16){throw new db[(_0xdbba('0x84'))][(_0xdbba('0x85'))]('no\x20available\x20attributes');}_0x486f9d=_['difference'](_[_0xdbba('0x4e')](_0x2c8f16),[_0xdbba('0x87'),_0xdbba('0x88')]);_0x147ab7=_['difference'](_[_0xdbba('0x4e')](_0x2c8f16),[_0xdbba('0x87'),'updatedAt',_0xdbba('0x8a'),'ListId']);if(_0x4e0bc9[_0xdbba('0x51')]['id']){delete _0x4e0bc9[_0xdbba('0x51')]['id'];}if(_['isNil'](_0x4e0bc9[_0xdbba('0x51')][_0xdbba('0x8c')])){throw _0x4360c1[_0xdbba('0x23')](0x1f4)[_0xdbba('0x32')](new db[(_0xdbba('0x84'))]['ValidationError'](_0xdbba('0xc2')));}if(_[_0xdbba('0x78')](_0x4e0bc9['body'][_0xdbba('0x51')])||_0x4e0bc9['body'][_0xdbba('0x51')]===''){throw _0x4360c1[_0xdbba('0x23')](0x1f4)['send'](new db[(_0xdbba('0x84'))][(_0xdbba('0x85'))](_0xdbba('0x8d')));}if(_[_0xdbba('0x78')](_0x4e0bc9[_0xdbba('0x51')][_0xdbba('0xc3')])){throw _0x4360c1[_0xdbba('0x23')](0x1f4)[_0xdbba('0x32')](new db[(_0xdbba('0x84'))][(_0xdbba('0x85'))](_0xdbba('0xc4')+_0x147ab7));}if(!_['includes'](_0x147ab7,_0x4e0bc9[_0xdbba('0x51')][_0xdbba('0xc3')])){throw _0x4360c1[_0xdbba('0x23')](0x1f4)[_0xdbba('0x32')](new db[(_0xdbba('0x84'))][(_0xdbba('0x85'))](_0xdbba('0xc5')+_0x147ab7));}_0xa3bd20[_0x4e0bc9[_0xdbba('0x51')]['mapKeyOffline']]=_0x4e0bc9[_0xdbba('0x51')][_0xdbba('0x8c')];})['then'](function(){return db[_0xdbba('0x34')][_0xdbba('0x4f')]({'where':{'id':_0x4e0bc9[_0xdbba('0x52')]['id']},'include':[{'model':db[_0xdbba('0x92')],'as':_0xdbba('0x93')}]});})['then'](handleEntityNotFound(_0x4360c1,null))[_0xdbba('0x2d')](function(_0x4995d7){if(_0x4995d7&&_0x4995d7[_0xdbba('0x93')]){_0x515cf8=_0x4995d7;var _0x1f69ae=_['defaults'](_0x4e0bc9[_0xdbba('0x51')],{'firstName':_0x4e0bc9[_0xdbba('0x51')]['from'],'phone':_0x4e0bc9[_0xdbba('0x51')][_0xdbba('0x8c')],'ListId':_0x4995d7[_0xdbba('0x8b')]});_0x1f69ae[_0x4e0bc9[_0xdbba('0x51')][_0xdbba('0xc3')]]=_0x4e0bc9[_0xdbba('0x51')]['from'];return db[_0xdbba('0x82')]['findOrCreate']({'where':_0xa3bd20,'defaults':_0x1f69ae});}})[_0xdbba('0xaf')](function(_0x3d898b){if(_0x3d898b){_0x4cf9c4=_0x3d898b;var _0x4f7a3b=fs[_0xdbba('0xc6')](path['join'](config[_0xdbba('0x6d')],_0xdbba('0xc7')),_0xdbba('0xc8'));var _0x29e364=ejs[_0xdbba('0xc9')](_0x4f7a3b,{'body':_[_0xdbba('0xca')](_0x4e0bc9[_0xdbba('0x51')][_0xdbba('0x51')]),'bodyTitle':_0x515cf8['offlineMessageBody']});return db[_0xdbba('0xcb')][_0xdbba('0x50')]({'body':_0x29e364,'ContactId':_0x3d898b['id'],'ChatWebsiteId':_0x515cf8['id']});}})[_0xdbba('0x2d')](function(_0x549d62){if(_0x549d62){_0x22f1d7=_0x549d62;return db[_0xdbba('0xcc')][_0xdbba('0x56')]({'where':{'service':!![]},'include':[{'model':db[_0xdbba('0xcd')],'as':_0xdbba('0xce'),'raw':!![]}]});}})[_0xdbba('0x2d')](function(_0x5eb960){if(_0x5eb960&&_0x5eb960['Smtp']&&_0x515cf8[_0xdbba('0xcf')]){var _0x856afc={'tls':{'rejectUnauthorized':![]}};if(_0x5eb960[_0xdbba('0xce')][_0xdbba('0xd0')]){_0x856afc['service']=_0x5eb960['Smtp']['service'];}else{_0x856afc[_0xdbba('0xd1')]=_0x5eb960[_0xdbba('0xce')]['host'];_0x856afc[_0xdbba('0xd2')]=_0x5eb960[_0xdbba('0xce')][_0xdbba('0xd2')];_0x856afc[_0xdbba('0xd3')]=_0x5eb960['Smtp'][_0xdbba('0xd3')];}if(_0x5eb960['Smtp'][_0xdbba('0xd4')]){_0x856afc['auth']={'user':_0x5eb960['Smtp'][_0xdbba('0xd5')],'pass':_0x5eb960[_0xdbba('0xce')]['pass']};}return respondWithRpcPromise(_0xdbba('0xd6'),_0xdbba('0xd7'),{'account':_0x856afc,'message':{'from':util[_0xdbba('0xa4')](_0xdbba('0xd8'),_0x5eb960[_0xdbba('0x31')],_0x5eb960[_0xdbba('0xd9')]||_0x5eb960[_0xdbba('0xce')]['user']),'to':_0x515cf8[_0xdbba('0xcf')],'subject':_0x515cf8['offlineMessageSubject'],'text':_0x22f1d7[_0xdbba('0x51')]}},client9003)[_0xdbba('0x2d')](function(){return _0x22f1d7;})[_0xdbba('0x21')](function(_0x59092a){console[_0xdbba('0x1d')](_0x59092a);});}})[_0xdbba('0x2d')](function(){if(_0x22f1d7){return _0x22f1d7;}})[_0xdbba('0x2d')](respondWithResult(_0x4360c1,null))[_0xdbba('0x21')](handleError(_0x4360c1,null));};exports[_0xdbba('0xda')]=function(_0x128a60,_0x5d6477,_0x99dd22){return db['ChatInteraction']['find']({'where':{'id':_0x128a60[_0xdbba('0x52')]['id']}})[_0xdbba('0x2d')](handleEntityNotFound(_0x5d6477,null))[_0xdbba('0x2d')](function(_0x178b66){if(_0x178b66){return _0x178b66['addInteraction'](_0x128a60[_0xdbba('0x51')]['ids'],_[_0xdbba('0xdb')](_0x128a60[_0xdbba('0x51')],[_0xdbba('0x5b'),'id'])||{});}})[_0xdbba('0x2d')](respondWithResult(_0x5d6477,null))[_0xdbba('0x21')](handleError(_0x5d6477,null));};exports[_0xdbba('0xdc')]=function(_0x3ed82a,_0x4b0a25,_0x25b452){var _0xb89d94={'raw':![],'where':{}};var _0x1b6690={};var _0x43c01d={'count':0x0,'rows':[]};return db[_0xdbba('0x34')][_0xdbba('0x56')]({'where':{'id':_0x3ed82a['params']['id']}})[_0xdbba('0x2d')](handleEntityNotFound(_0x4b0a25,null))[_0xdbba('0x2d')](function(_0x4f96e5){if(_0x4f96e5){_0x1b6690[_0xdbba('0x35')]=_[_0xdbba('0x4e')](db[_0xdbba('0xab')][_0xdbba('0x58')]);_0x1b6690[_0xdbba('0x36')]=_[_0xdbba('0x4e')](_0x3ed82a['query']);_0x1b6690[_0xdbba('0x39')]=_[_0xdbba('0x3b')](_0x1b6690[_0xdbba('0x35')],_0x1b6690['query']);_0xb89d94[_0xdbba('0x3a')]=_[_0xdbba('0x3b')](_0x1b6690[_0xdbba('0x35')],qs[_0xdbba('0x3c')](_0x3ed82a[_0xdbba('0x36')]['fields']));_0xb89d94[_0xdbba('0x3a')]=_0xb89d94['attributes'][_0xdbba('0x3d')]?_0xb89d94['attributes']:_0x1b6690['model'];if(!_0x3ed82a[_0xdbba('0x36')][_0xdbba('0x3e')](_0xdbba('0x3f'))){_0xb89d94[_0xdbba('0x27')]=qs['limit'](_0x3ed82a[_0xdbba('0x36')]['limit']);_0xb89d94[_0xdbba('0x26')]=qs[_0xdbba('0x26')](_0x3ed82a[_0xdbba('0x36')]['offset']);}_0xb89d94['order']=qs[_0xdbba('0x41')](_0x3ed82a[_0xdbba('0x36')][_0xdbba('0x41')]);_0xb89d94[_0xdbba('0x42')]=qs[_0xdbba('0x39')](_[_0xdbba('0x43')](_0x3ed82a[_0xdbba('0x36')],_0x1b6690['filters']));_0xb89d94[_0xdbba('0x42')]['ChatWebsiteId']=_0x4f96e5['id'];if(_0x3ed82a[_0xdbba('0x36')]['filter']){_0xb89d94[_0xdbba('0x42')]=_['merge'](_0xb89d94['where'],{'$or':_[_0xdbba('0x48')](_0xb89d94['attributes'],function(_0xb50a0b){var _0x14afe1={};_0x14afe1[_0xb50a0b]={'$like':'%'+_0x3ed82a[_0xdbba('0x36')]['filter']+'%'};return _0x14afe1;})});}_0xb89d94=_[_0xdbba('0x46')]({},_0xb89d94,_0x3ed82a[_0xdbba('0x49')]);return db[_0xdbba('0xab')][_0xdbba('0x25')]({'where':_0xb89d94[_0xdbba('0x42')]})[_0xdbba('0x2d')](function(_0x3edec1){_0x43c01d[_0xdbba('0x25')]=_0x3edec1;if(_0x3ed82a[_0xdbba('0x36')][_0xdbba('0x4a')]){_0xb89d94[_0xdbba('0x4b')]=[{'model':db[_0xdbba('0x82')],'as':_0xdbba('0xdd'),'required':![]},{'model':db[_0xdbba('0xbb')],'as':'Owner','attributes':[_0xdbba('0x31'),_0xdbba('0xde'),_0xdbba('0xdf')],'required':![]},{'model':db[_0xdbba('0xe0')],'as':'Tags','attributes':['id',_0xdbba('0x31'),_0xdbba('0xe1')],'where':_0x3ed82a[_0xdbba('0x36')]['tag']?{'id':_0x3ed82a[_0xdbba('0x36')][_0xdbba('0xe2')]}:undefined,'required':_0x3ed82a['query'][_0xdbba('0xe2')]?!![]:![]}];}return db[_0xdbba('0xab')][_0xdbba('0x59')](_0xb89d94);})['then'](function(_0x18e824){_0x43c01d[_0xdbba('0x4c')]=_0x18e824;return _0x43c01d;});}})['then'](respondWithFilteredResult(_0x4b0a25,_0xb89d94))[_0xdbba('0x21')](handleError(_0x4b0a25,null));};function iftimePromise(_0x18f254,_0x2e146c){return respondWithRpcPromise('Command',_0xdbba('0xe3'),{'command':_0x2e146c[_0xdbba('0xe4')]?util[_0xdbba('0xa4')](_0xdbba('0xe5'),_0x18f254[_0xdbba('0xe6')],_0x2e146c[_0xdbba('0xe4')]):util[_0xdbba('0xa4')](_0xdbba('0xe7'),_0x18f254[_0xdbba('0xe6')])},client9002)[_0xdbba('0x2d')](function(_0x53db84){var _0x36b8e4=_0x53db84&&_0x53db84[_0xdbba('0xe8')]('true')>=0x0?!![]:![];logger[_0xdbba('0x18')](_0xdbba('0xe9'),_0x2e146c['id'],_0x18f254['id'],_0x18f254['interval'],_0x36b8e4?_0xdbba('0xea'):_0xdbba('0xeb'),_0x2e146c[_0xdbba('0xe4')]?_0x2e146c[_0xdbba('0xe4')]:'No\x20timezone');return _0x36b8e4;})[_0xdbba('0x21')](function(_0x1b6040){logger[_0xdbba('0x1d')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x2e146c['id'],_0x18f254['id'],_0x18f254['interval'],util['inspect'](_0x1b6040,{'showHidden':![],'depth':null}),_0x2e146c['timezone']?_0x2e146c['timezone']:_0xdbba('0xec'));return![];});}exports[_0xdbba('0xe3')]=function(_0x14075b,_0x103edd,_0x4b07c9){var _0x469513=0x0;var _0x386ee1=0x0;var _0x20b371=![];var _0x155d8a;var _0x43a7a8;return db[_0xdbba('0x34')][_0xdbba('0x4f')]({'where':{'id':_0x14075b[_0xdbba('0x52')]['id']},'include':[{'model':db[_0xdbba('0xed')],'as':_0xdbba('0xed'),'include':[{'model':db[_0xdbba('0xed')],'as':_0xdbba('0xee'),'attributes':['id',_0xdbba('0xe6')],'raw':!![]}]}]})[_0xdbba('0x2d')](handleEntityNotFound(_0x103edd,null))[_0xdbba('0x2d')](function(_0x10ea3d){if(_0x10ea3d){_0x155d8a=_0x10ea3d;return _0x10ea3d[_0xdbba('0xef')]({'raw':!![]});}})[_0xdbba('0x2d')](function(_0x54c92b){if(_0x155d8a){if(_0x54c92b){_0x43a7a8=_0x54c92b;}}return require(_0xdbba('0xf0'))[_0xdbba('0xf1')]();})[_0xdbba('0x2d')](function(_0x3ba041){if(_0x3ba041){_0x386ee1=_0x3ba041[_0xdbba('0xf2')];_0x20b371=_0x3ba041[_0xdbba('0x6b')];}})[_0xdbba('0x2d')](function(){return db['ChatInteraction'][_0xdbba('0x25')]({'where':{'closed':![]}});})[_0xdbba('0x2d')](function(_0x186ccf){_0x469513=_0x186ccf;if(_0x386ee1&&_0x186ccf>_0x386ee1){return db[_0xdbba('0xf3')][_0xdbba('0x56')]({'where':{'id':0x1}})[_0xdbba('0x2d')](function(_0x3e2c1f){if(_0x3e2c1f){_0x3e2c1f[_0xdbba('0xf4')](_0xdbba('0xf5'));}});}})[_0xdbba('0x2d')](function(){if(_0x155d8a[_0xdbba('0xed')]&&_0x155d8a[_0xdbba('0xed')]['Intervals']){var _0x2c7d53=[];for(var _0x395e01=0x0;_0x395e01<_0x155d8a['Interval']['Intervals'][_0xdbba('0x3d')];_0x395e01++){var _0x53fa04=_0x155d8a[_0xdbba('0xed')][_0xdbba('0xee')][_0x395e01][_0xdbba('0xb1')]({'plain':!![]});_0x2c7d53['push'](iftimePromise(_0x53fa04,_0x155d8a));}return BPromise[_0xdbba('0xf6')](_0x2c7d53)[_0xdbba('0x2d')](function(_0x462706){return _[_0xdbba('0xf7')](_0x462706);});}else{return!![];}})['then'](function(_0x35b307){var _0x81db57=fs[_0xdbba('0xc6')](path[_0xdbba('0x69')](config['root'],'server/files/chat/iframe.js'),_0xdbba('0xc8'));var _0x4d92ae={'remote':_0x155d8a['remote'],'query':querystring[_0xdbba('0x1c')](_[_0xdbba('0x46')](_0x155d8a[_0xdbba('0xb1')]({'plain':!![]}),{'customerIp':_0x14075b[_0xdbba('0x7e')]['x-forwarded-for']||_0x14075b['headers'][_0xdbba('0xf8')]||_0x14075b[_0xdbba('0xf9')][_0xdbba('0xfa')]||_0x14075b['ip'],'referer':_0x14075b[_0xdbba('0x7e')][_0xdbba('0xa1')],'openedInteractions':_0x469513,'maxInteractions':_0x386ee1,'virtual':_0x20b371[_0xdbba('0xf2')],'online':_0x35b307,'custom':_0x20b371}))['replace'](/'/g,'\x5c\x27')};_0x103edd[_0xdbba('0x32')](ejs['render'](Mustache['render'](_0x81db57,_0x4d92ae),{'proactiveActions':_0x43a7a8,'alignment':_0x155d8a['alignment'],'verticalAlignment':_0x155d8a[_0xdbba('0xfb')]}));})['catch'](handleError(_0x103edd,null));};exports[_0xdbba('0xfc')]=function(_0x11a44e,_0x269a62,_0x5375d9){return db[_0xdbba('0x34')][_0xdbba('0x56')]({'where':{'id':_0x11a44e[_0xdbba('0x52')]['id']}})[_0xdbba('0x2d')](handleEntityNotFound(_0x269a62,null))[_0xdbba('0x2d')](function(_0x2de4e8){if(_0x2de4e8){return db[_0xdbba('0xfd')]['transaction'](function(_0x35bcd2){return db[_0xdbba('0x96')][_0xdbba('0x2e')]({'where':{'ChatWebsiteId':_0x11a44e[_0xdbba('0x52')]['id']},'transaction':_0x35bcd2})[_0xdbba('0x2d')](function(_0x138f85){var _0x41f35f=_[_0xdbba('0x48')](_0x11a44e[_0xdbba('0x51')],function(_0x3a1998){_0x3a1998['ChatWebsiteId']=_0x11a44e[_0xdbba('0x52')]['id'];return _0x3a1998;});return db[_0xdbba('0x96')]['bulkCreate'](_0x41f35f,{'transaction':_0x35bcd2});});})[_0xdbba('0x2d')](function(){return db[_0xdbba('0x96')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x11a44e[_0xdbba('0x52')]['id']},'order':_0xdbba('0x9b')});});}})[_0xdbba('0x2d')](respondWithResult(_0x269a62,null))[_0xdbba('0x21')](handleError(_0x269a62,null));};exports[_0xdbba('0xfe')]=function(_0x53132a,_0x5e3793,_0x50e1cf){var _0x2ae77e={};var _0x21558e={};var _0x589e75;var _0x55c300;return db[_0xdbba('0x34')]['findOne']({'where':{'id':_0x53132a[_0xdbba('0x52')]['id']}})[_0xdbba('0x2d')](handleEntityNotFound(_0x5e3793,null))[_0xdbba('0x2d')](function(_0x1ae51f){if(_0x1ae51f){_0x589e75=_0x1ae51f;_0x21558e[_0xdbba('0x35')]=_['keys'](db[_0xdbba('0x96')]['rawAttributes']);_0x21558e[_0xdbba('0x36')]=_[_0xdbba('0x4e')](_0x53132a[_0xdbba('0x36')]);_0x21558e[_0xdbba('0x39')]=_[_0xdbba('0x3b')](_0x21558e[_0xdbba('0x35')],_0x21558e[_0xdbba('0x36')]);_0x2ae77e['attributes']=_[_0xdbba('0x3b')](_0x21558e[_0xdbba('0x35')],qs[_0xdbba('0x3c')](_0x53132a[_0xdbba('0x36')]['fields']));_0x2ae77e[_0xdbba('0x3a')]=_0x2ae77e[_0xdbba('0x3a')]['length']?_0x2ae77e['attributes']:_0x21558e['model'];_0x2ae77e[_0xdbba('0x40')]=qs[_0xdbba('0x41')](_0x53132a[_0xdbba('0x36')][_0xdbba('0x41')]);_0x2ae77e['where']=qs[_0xdbba('0x39')](_[_0xdbba('0x43')](_0x53132a[_0xdbba('0x36')],_0x21558e[_0xdbba('0x39')]));if(_0x53132a[_0xdbba('0x36')]['filter']){_0x2ae77e['where']=_['merge'](_0x2ae77e['where'],{'$or':_[_0xdbba('0x48')](_0x2ae77e['attributes'],function(_0xd67b99){var _0x3153f5={};_0x3153f5[_0xd67b99]={'$like':'%'+_0x53132a[_0xdbba('0x36')][_0xdbba('0x47')]+'%'};return _0x3153f5;})});}_0x2ae77e=_[_0xdbba('0x46')]({},_0x2ae77e,_0x53132a[_0xdbba('0x49')]);return _0x589e75[_0xdbba('0xfe')](_0x2ae77e);}})[_0xdbba('0x2d')](function(_0xe4c1c6){if(_0xe4c1c6){_0x55c300=_0xe4c1c6['length'];if(!_0x53132a[_0xdbba('0x36')][_0xdbba('0x3e')](_0xdbba('0x3f'))){_0x2ae77e[_0xdbba('0x27')]=qs[_0xdbba('0x27')](_0x53132a[_0xdbba('0x36')][_0xdbba('0x27')]);_0x2ae77e['offset']=qs[_0xdbba('0x26')](_0x53132a['query'][_0xdbba('0x26')]);}return _0x589e75[_0xdbba('0xfe')](_0x2ae77e);}})[_0xdbba('0x2d')](function(_0xc712cf){if(_0xc712cf){return _0xc712cf?{'count':_0x55c300,'rows':_0xc712cf}:null;}})['then'](respondWithResult(_0x5e3793,null))[_0xdbba('0x21')](handleError(_0x5e3793,null));};exports[_0xdbba('0xff')]=function(_0x43a4f4,_0x3b86be,_0xf13ea6){return db['chatProactiveAction'][_0xdbba('0x4f')]({'where':{'id':_0x43a4f4[_0xdbba('0x52')]['id']}})[_0xdbba('0x2d')](handleEntityNotFound(_0x3b86be,null))[_0xdbba('0x2d')](function(_0x12a122){if(_0x12a122){return _0x12a122['addProactiveActions'](_0x43a4f4[_0xdbba('0x51')]['ids'],_[_0xdbba('0xdb')](_0x43a4f4[_0xdbba('0x51')],[_0xdbba('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x3b86be,null))[_0xdbba('0x21')](handleError(_0x3b86be,null));};exports[_0xdbba('0xef')]=function(_0x3b4f17,_0xb67b2a,_0x37469c){var _0x5c0751={};var _0x258bd8={};var _0x342ccf;var _0x4ffd6b;return db[_0xdbba('0x34')][_0xdbba('0x56')]({'where':{'id':_0x3b4f17[_0xdbba('0x52')]['id']}})[_0xdbba('0x2d')](handleEntityNotFound(_0xb67b2a,null))[_0xdbba('0x2d')](function(_0x4c17c8){if(_0x4c17c8){_0x342ccf=_0x4c17c8;_0x258bd8['model']=_[_0xdbba('0x4e')](db[_0xdbba('0x100')][_0xdbba('0x58')]);_0x258bd8[_0xdbba('0x36')]=_[_0xdbba('0x4e')](_0x3b4f17[_0xdbba('0x36')]);_0x258bd8[_0xdbba('0x39')]=_[_0xdbba('0x3b')](_0x258bd8[_0xdbba('0x35')],_0x258bd8[_0xdbba('0x36')]);_0x5c0751[_0xdbba('0x3a')]=_[_0xdbba('0x3b')](_0x258bd8[_0xdbba('0x35')],qs['fields'](_0x3b4f17['query'][_0xdbba('0x3c')]));_0x5c0751[_0xdbba('0x3a')]=_0x5c0751['attributes']['length']?_0x5c0751['attributes']:_0x258bd8[_0xdbba('0x35')];_0x5c0751['order']=qs[_0xdbba('0x41')](_0x3b4f17[_0xdbba('0x36')][_0xdbba('0x41')]);_0x5c0751[_0xdbba('0x42')]=qs[_0xdbba('0x39')](_[_0xdbba('0x43')](_0x3b4f17[_0xdbba('0x36')],_0x258bd8['filters']));if(_0x3b4f17['query'][_0xdbba('0x47')]){_0x5c0751[_0xdbba('0x42')]=_[_0xdbba('0x46')](_0x5c0751[_0xdbba('0x42')],{'$or':_[_0xdbba('0x48')](_0x5c0751[_0xdbba('0x3a')],function(_0x43733e){var _0xe20960={};_0xe20960[_0x43733e]={'$like':'%'+_0x3b4f17[_0xdbba('0x36')][_0xdbba('0x47')]+'%'};return _0xe20960;})});}_0x5c0751=_['merge']({},_0x5c0751,_0x3b4f17['options']);return _0x342ccf[_0xdbba('0xef')](_0x5c0751);}})[_0xdbba('0x2d')](function(_0x46baa3){if(_0x46baa3){_0x4ffd6b=_0x46baa3['length'];if(!_0x3b4f17['query'][_0xdbba('0x3e')]('nolimit')){_0x5c0751[_0xdbba('0x27')]=qs['limit'](_0x3b4f17[_0xdbba('0x36')][_0xdbba('0x27')]);_0x5c0751[_0xdbba('0x26')]=qs['offset'](_0x3b4f17[_0xdbba('0x36')][_0xdbba('0x26')]);}return _0x342ccf[_0xdbba('0xef')](_0x5c0751);}})[_0xdbba('0x2d')](function(_0xbf09d5){if(_0xbf09d5){return _0xbf09d5?{'count':_0x4ffd6b,'rows':_0xbf09d5}:null;}})[_0xdbba('0x2d')](respondWithResult(_0xb67b2a,null))[_0xdbba('0x21')](handleError(_0xb67b2a,null));};exports[_0xdbba('0x101')]=function(_0x386e2e,_0x124d5b,_0x1ca01f){var _0x5d616f=_0x386e2e[_0xdbba('0x36')][_0xdbba('0x102')]===_0xdbba('0x103')?_0xdbba('0x104'):'onlineForm';return db[_0xdbba('0x34')][_0xdbba('0x4f')]({'attributes':['id',_0x5d616f],'where':{'id':_0x386e2e[_0xdbba('0x52')]['id']}})['then'](handleEntityNotFound(_0x124d5b,null))[_0xdbba('0x2d')](function(_0x161d10){if(_0x161d10){var _0x5102b2=_0x161d10[_0x5d616f];var _0x2a6ae3=_0x5102b2&&_0x5102b2[_0xdbba('0x105')]?_0x5102b2[_0xdbba('0x105')]:[];_0x124d5b['send']({'fromKey':_[_0xdbba('0x78')](_0x5102b2['fromKey'])?undefined:_0x5102b2[_0xdbba('0x106')],'count':_0x2a6ae3[_0xdbba('0x3d')],'rows':_0x2a6ae3});}})[_0xdbba('0x21')](handleError(_0x124d5b,null));};exports['getOfflineMessages']=function(_0x40bbe4,_0x5ca0be,_0x355c40){var _0x6dd8d0={'raw':!![],'where':{}};var _0x435507={};var _0x41bec2={'count':0x0,'rows':[]};return db[_0xdbba('0x34')]['findOne']({'where':{'id':_0x40bbe4['params']['id']}})[_0xdbba('0x2d')](handleEntityNotFound(_0x5ca0be,null))[_0xdbba('0x2d')](function(_0x5a9916){if(_0x5a9916){_0x435507['model']=_[_0xdbba('0x4e')](db[_0xdbba('0xcb')]['rawAttributes']);_0x435507['query']=_['keys'](_0x40bbe4[_0xdbba('0x36')]);_0x435507[_0xdbba('0x39')]=_[_0xdbba('0x3b')](_0x435507['model'],_0x435507[_0xdbba('0x36')]);_0x6dd8d0[_0xdbba('0x3a')]=_[_0xdbba('0x3b')](_0x435507[_0xdbba('0x35')],qs[_0xdbba('0x3c')](_0x40bbe4[_0xdbba('0x36')][_0xdbba('0x3c')]));_0x6dd8d0[_0xdbba('0x3a')]=_0x6dd8d0[_0xdbba('0x3a')][_0xdbba('0x3d')]?_0x6dd8d0['attributes']:_0x435507[_0xdbba('0x35')];if(!_0x40bbe4[_0xdbba('0x36')][_0xdbba('0x3e')](_0xdbba('0x3f'))){_0x6dd8d0['limit']=qs[_0xdbba('0x27')](_0x40bbe4['query'][_0xdbba('0x27')]);_0x6dd8d0[_0xdbba('0x26')]=qs['offset'](_0x40bbe4[_0xdbba('0x36')][_0xdbba('0x26')]);}_0x6dd8d0[_0xdbba('0x40')]=qs[_0xdbba('0x41')](_0x40bbe4[_0xdbba('0x36')][_0xdbba('0x41')]);_0x6dd8d0['where']=qs['filters'](_[_0xdbba('0x43')](_0x40bbe4[_0xdbba('0x36')],_0x435507['filters']));_0x6dd8d0[_0xdbba('0x42')]['ChatWebsiteId']=_0x5a9916['id'];if(_0x40bbe4[_0xdbba('0x36')][_0xdbba('0x47')]){_0x6dd8d0[_0xdbba('0x42')]=_[_0xdbba('0x46')](_0x6dd8d0[_0xdbba('0x42')],{'$or':_['map'](_0x6dd8d0['attributes'],function(_0x14a5ed){var _0x34400f={};_0x34400f[_0x14a5ed]={'$like':'%'+_0x40bbe4['query'][_0xdbba('0x47')]+'%'};return _0x34400f;})});}_0x6dd8d0=_[_0xdbba('0x46')]({},_0x6dd8d0,_0x40bbe4[_0xdbba('0x49')]);return db[_0xdbba('0xcb')][_0xdbba('0x25')]({'where':_0x6dd8d0[_0xdbba('0x42')]})[_0xdbba('0x2d')](function(_0x168ef0){_0x41bec2[_0xdbba('0x25')]=_0x168ef0;if(_0x40bbe4[_0xdbba('0x36')]['includeAll']){_0x6dd8d0[_0xdbba('0x4b')]=[{'all':!![]}];}return db[_0xdbba('0xcb')]['findAll'](_0x6dd8d0);})[_0xdbba('0x2d')](function(_0x7c4e44){_0x41bec2[_0xdbba('0x4c')]=_0x7c4e44;return _0x41bec2;});}})[_0xdbba('0x2d')](respondWithFilteredResult(_0x5ca0be,_0x6dd8d0))['catch'](handleError(_0x5ca0be,null));};exports[_0xdbba('0x107')]=function(_0x13fb4c,_0x49a172,_0x38c291){return db['ChatWebsite'][_0xdbba('0x4f')]({'where':{'id':_0x13fb4c[_0xdbba('0x52')]['id']}})[_0xdbba('0x2d')](handleEntityNotFound(_0x49a172,null))[_0xdbba('0x2d')](function(_0x49405f){if(_0x49405f){return _0x49405f[_0xdbba('0x107')](_0x13fb4c[_0xdbba('0x51')][_0xdbba('0x5b')],_[_0xdbba('0xdb')](_0x13fb4c[_0xdbba('0x51')],[_0xdbba('0x5b'),'id'])||{})[_0xdbba('0xaf')](function(_0x251dd6){for(var _0x379839=0x0;_0x379839<_0x13fb4c['body'][_0xdbba('0x5b')][_0xdbba('0x3d')];_0x379839+=0x1){socket['emit'](_0xdbba('0x108'),{'UserId':_0x13fb4c[_0xdbba('0x51')][_0xdbba('0x5b')][_0x379839],'ChatWebsiteId':_0x13fb4c['params']['id']});}return _0x251dd6;});}})[_0xdbba('0x2d')](respondWithResult(_0x49a172,null))[_0xdbba('0x21')](handleError(_0x49a172,null));};exports['removeAgents']=function(_0xc7a4cd,_0x3fda74,_0x38630c){var _0x3d0eaf;return db['ChatWebsite'][_0xdbba('0x4f')]({'where':{'id':_0xc7a4cd[_0xdbba('0x52')]['id']}})[_0xdbba('0x2d')](handleEntityNotFound(_0x3fda74,null))[_0xdbba('0x2d')](function(_0x24c0a8){if(_0x24c0a8){return _0x24c0a8[_0xdbba('0x109')](_0xc7a4cd[_0xdbba('0x36')][_0xdbba('0x5b')])['then'](function(_0x460af3){if(_['isArray'](_0xc7a4cd[_0xdbba('0x36')]['ids'])){for(var _0x581c5b=0x0;_0x581c5b<_0xc7a4cd['query'][_0xdbba('0x5b')][_0xdbba('0x3d')];_0x581c5b+=0x1){socket[_0xdbba('0x10a')]('userChatWebsite:remove',{'UserId':_0xc7a4cd[_0xdbba('0x36')][_0xdbba('0x5b')][_0x581c5b],'ChatWebsiteId':_0xc7a4cd[_0xdbba('0x52')]['id']});}}else{socket[_0xdbba('0x10a')]('userChatWebsite:remove',{'UserId':_0xc7a4cd[_0xdbba('0x36')][_0xdbba('0x5b')],'ChatWebsiteId':_0xc7a4cd[_0xdbba('0x52')]['id']});}});}})[_0xdbba('0x2d')](respondWithStatusCode(_0x3fda74,null))[_0xdbba('0x21')](handleError(_0x3fda74,null));};exports[_0xdbba('0x10b')]=function(_0x2cf622,_0x1c5cfc,_0x1be0e4){var _0x1b6e53={};var _0x46928e={};var _0x44c441;var _0x25be8b;return db[_0xdbba('0x34')][_0xdbba('0x56')]({'where':{'id':_0x2cf622[_0xdbba('0x52')]['id']}})[_0xdbba('0x2d')](handleEntityNotFound(_0x1c5cfc,null))[_0xdbba('0x2d')](function(_0xc3af76){if(_0xc3af76){_0x44c441=_0xc3af76;_0x46928e[_0xdbba('0x35')]=_[_0xdbba('0x4e')](db['User'][_0xdbba('0x58')]);_0x46928e[_0xdbba('0x36')]=_[_0xdbba('0x4e')](_0x2cf622[_0xdbba('0x36')]);_0x46928e[_0xdbba('0x39')]=_['intersection'](_0x46928e['model'],_0x46928e[_0xdbba('0x36')]);_0x1b6e53[_0xdbba('0x3a')]=_[_0xdbba('0x3b')](_0x46928e[_0xdbba('0x35')],qs['fields'](_0x2cf622[_0xdbba('0x36')][_0xdbba('0x3c')]));_0x1b6e53[_0xdbba('0x3a')]=_0x1b6e53['attributes'][_0xdbba('0x3d')]?_0x1b6e53[_0xdbba('0x3a')]:_0x46928e[_0xdbba('0x35')];_0x1b6e53[_0xdbba('0x40')]=qs[_0xdbba('0x41')](_0x2cf622[_0xdbba('0x36')][_0xdbba('0x41')]);_0x1b6e53[_0xdbba('0x42')]=qs[_0xdbba('0x39')](_['pick'](_0x2cf622[_0xdbba('0x36')],_0x46928e['filters']));if(_0x2cf622[_0xdbba('0x36')]['filter']){_0x1b6e53['where']=_['merge'](_0x1b6e53[_0xdbba('0x42')],{'$or':_['map'](_0x1b6e53[_0xdbba('0x3a')],function(_0x258316){var _0x1d5886={};_0x1d5886[_0x258316]={'$like':'%'+_0x2cf622[_0xdbba('0x36')][_0xdbba('0x47')]+'%'};return _0x1d5886;})});}_0x1b6e53=_[_0xdbba('0x46')]({},_0x1b6e53,_0x2cf622[_0xdbba('0x49')]);return _0x44c441[_0xdbba('0x10b')](_0x1b6e53);}})[_0xdbba('0x2d')](function(_0x17e923){if(_0x17e923){_0x25be8b=_0x17e923[_0xdbba('0x3d')];if(!_0x2cf622[_0xdbba('0x36')][_0xdbba('0x3e')](_0xdbba('0x3f'))){_0x1b6e53['limit']=qs[_0xdbba('0x27')](_0x2cf622[_0xdbba('0x36')][_0xdbba('0x27')]);_0x1b6e53[_0xdbba('0x26')]=qs[_0xdbba('0x26')](_0x2cf622[_0xdbba('0x36')][_0xdbba('0x26')]);}return _0x44c441['getAgents'](_0x1b6e53);}})[_0xdbba('0x2d')](function(_0x5d1e34){if(_0x5d1e34){return _0x5d1e34?{'count':_0x25be8b,'rows':_0x5d1e34}:null;}})[_0xdbba('0x2d')](respondWithResult(_0x1c5cfc,null))['catch'](handleError(_0x1c5cfc,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index a574cae..7d9b004 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 _0x0689=['remove','emit','hook','../../mysqldb','setMaxListeners','save','update'];(function(_0x594520,_0x2fe865){var _0x4e4aea=function(_0x465eec){while(--_0x465eec){_0x594520['push'](_0x594520['shift']());}};_0x4e4aea(++_0x2fe865);}(_0x0689,0x161));var _0x9068=function(_0x18d29b,_0x3034d2){_0x18d29b=_0x18d29b-0x0;var _0x3c354f=_0x0689[_0x18d29b];return _0x3c354f;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x9068('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9068('0x1')](0x0);var events={'afterCreate':_0x9068('0x2'),'afterUpdate':_0x9068('0x3'),'afterDestroy':_0x9068('0x4')};function emitEvent(_0x44080a){return function(_0x1c35ba,_0x3b12f4,_0x1dbc6f){ChatWebsiteEvents[_0x9068('0x5')](_0x44080a+':'+_0x1c35ba['id'],_0x1c35ba);ChatWebsiteEvents[_0x9068('0x5')](_0x44080a,_0x1c35ba);_0x1dbc6f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x9068('0x6')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x8fed=['exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x1ce644,_0x17b43c){var _0x442b28=function(_0x5bc0b0){while(--_0x5bc0b0){_0x1ce644['push'](_0x1ce644['shift']());}};_0x442b28(++_0x17b43c);}(_0x8fed,0xab));var _0xd8fe=function(_0x5f3c62,_0x3130df){_0x5f3c62=_0x5f3c62-0x0;var _0x5edaff=_0x8fed[_0x5f3c62];return _0x5edaff;};'use strict';var EventEmitter=require(_0xd8fe('0x0'));var ChatWebsite=require(_0xd8fe('0x1'))['db'][_0xd8fe('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xd8fe('0x3')](0x0);var events={'afterCreate':_0xd8fe('0x4'),'afterUpdate':_0xd8fe('0x5'),'afterDestroy':_0xd8fe('0x6')};function emitEvent(_0x250abb){return function(_0x398e5f,_0x3e2a87,_0x2f50f3){ChatWebsiteEvents[_0xd8fe('0x7')](_0x250abb+':'+_0x398e5f['id'],_0x398e5f);ChatWebsiteEvents[_0xd8fe('0x7')](_0x250abb,_0x398e5f);_0x2f50f3(null);};}for(var e in events){if(events[_0xd8fe('0x8')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xd8fe('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 15d3239..5ea5343 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 _0xf290=['bluebird','request-promise','./chatWebsite.attributes','exports','define','chat_websites','util','api'];(function(_0x59ee91,_0x5ca1ef){var _0x51b0b7=function(_0x55517f){while(--_0x55517f){_0x59ee91['push'](_0x59ee91['shift']());}};_0x51b0b7(++_0x5ca1ef);}(_0xf290,0xde));var _0x0f29=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0xf290[_0x1db251];return _0x56685a;};'use strict';var _=require('lodash');var util=require(_0x0f29('0x0'));var logger=require('../../config/logger')(_0x0f29('0x1'));var moment=require('moment');var BPromise=require(_0x0f29('0x2'));var rp=require(_0x0f29('0x3'));var attributes=require(_0x0f29('0x4'));module[_0x0f29('0x5')]=function(_0xfdab92,_0x5984ba){return _0xfdab92[_0x0f29('0x6')]('ChatWebsite',attributes,{'tableName':_0x0f29('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb18e=['../../config/logger','moment','request-promise','./chatWebsite.attributes','define','ChatWebsite','chat_websites'];(function(_0x1a3243,_0x201872){var _0x33f2ca=function(_0x59d32e){while(--_0x59d32e){_0x1a3243['push'](_0x1a3243['shift']());}};_0x33f2ca(++_0x201872);}(_0xb18e,0x181));var _0xeb18=function(_0x2fff83,_0x29d5fe){_0x2fff83=_0x2fff83-0x0;var _0xa2a722=_0xb18e[_0x2fff83];return _0xa2a722;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeb18('0x0'))('api');var moment=require(_0xeb18('0x1'));var BPromise=require('bluebird');var rp=require(_0xeb18('0x2'));var attributes=require(_0xeb18('0x3'));module['exports']=function(_0x125c34,_0x27c8d1){return _0x125c34[_0xeb18('0x4')](_0xeb18('0x5'),attributes,{'tableName':_0xeb18('0x6'),'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 babff3a..9135df8 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 _0xe362=['ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','http','socket.io-emitter','localhost','./chatWebsite.socket','request','then','info'];(function(_0x345fd3,_0x2128a4){var _0x18dbc9=function(_0x110e44){while(--_0x110e44){_0x345fd3['push'](_0x345fd3['shift']());}};_0x18dbc9(++_0x2128a4);}(_0xe362,0x194));var _0x2e36=function(_0x167307,_0x5a60ae){_0x167307=_0x167307-0x0;var _0x550140=_0xe362[_0x167307];return _0x550140;};'use strict';var _=require(_0x2e36('0x0'));var util=require('util');var moment=require(_0x2e36('0x1'));var BPromise=require(_0x2e36('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x2e36('0x3'))['db'];var utils=require(_0x2e36('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2e36('0x5'));var client=jayson[_0x2e36('0x6')][_0x2e36('0x7')]({'port':0x232a});var socket=require(_0x2e36('0x8'))({'host':_0x2e36('0x9'),'port':0x18eb});require(_0x2e36('0xa'))['register'](socket);function respondWithRpcPromise(_0x1091a0,_0x213f47,_0x19cdad){return new BPromise(function(_0x393e82,_0x4d5e88){return client[_0x2e36('0xb')](_0x1091a0,_0x19cdad)[_0x2e36('0xc')](function(_0x4676c4){logger[_0x2e36('0xd')](_0x2e36('0xe'),_0x213f47,_0x2e36('0xf'));logger['debug'](_0x2e36('0x10'),_0x213f47,_0x2e36('0xf'),JSON[_0x2e36('0x11')](_0x4676c4));if(_0x4676c4[_0x2e36('0x12')]){if(_0x4676c4[_0x2e36('0x12')][_0x2e36('0x13')]===0x1f4){logger[_0x2e36('0x12')](_0x2e36('0xe'),_0x213f47,_0x4676c4['error'][_0x2e36('0x14')]);return _0x4d5e88(_0x4676c4[_0x2e36('0x12')][_0x2e36('0x14')]);}logger[_0x2e36('0x12')](_0x2e36('0xe'),_0x213f47,_0x4676c4[_0x2e36('0x12')][_0x2e36('0x14')]);return _0x393e82(_0x4676c4['error'][_0x2e36('0x14')]);}else{logger[_0x2e36('0xd')](_0x2e36('0xe'),_0x213f47,'request\x20sent');_0x393e82(_0x4676c4['result']['message']);}})[_0x2e36('0x15')](function(_0x2bf5c5){logger['error'](_0x2e36('0xe'),_0x213f47,_0x2bf5c5);_0x4d5e88(_0x2bf5c5);});});} \ No newline at end of file +var _0x6d1c=['stringify','error','code','message','info','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','socket.io-emitter','localhost','./chatWebsite.socket','register','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s'];(function(_0x9ac89b,_0x25b61d){var _0x40da74=function(_0x2643a2){while(--_0x2643a2){_0x9ac89b['push'](_0x9ac89b['shift']());}};_0x40da74(++_0x25b61d);}(_0x6d1c,0x69));var _0xc6d1=function(_0x45ae0d,_0x1ea3b9){_0x45ae0d=_0x45ae0d-0x0;var _0x371826=_0x6d1c[_0x45ae0d];return _0x371826;};'use strict';var _=require(_0xc6d1('0x0'));var util=require(_0xc6d1('0x1'));var moment=require(_0xc6d1('0x2'));var BPromise=require(_0xc6d1('0x3'));var rs=require(_0xc6d1('0x4'));var fs=require('fs');var db=require(_0xc6d1('0x5'))['db'];var utils=require(_0xc6d1('0x6'));var logger=require(_0xc6d1('0x7'))('rpc');var config=require(_0xc6d1('0x8'));var jayson=require(_0xc6d1('0x9'));var client=jayson[_0xc6d1('0xa')]['http']({'port':0x232a});var socket=require(_0xc6d1('0xb'))({'host':_0xc6d1('0xc'),'port':0x18eb});require(_0xc6d1('0xd'))[_0xc6d1('0xe')](socket);function respondWithRpcPromise(_0x10c6bc,_0x3aea7a,_0x1973b6){return new BPromise(function(_0x5d9026,_0x34be98){return client['request'](_0x10c6bc,_0x1973b6)[_0xc6d1('0xf')](function(_0x1d8521){logger['info'](_0xc6d1('0x10'),_0x3aea7a,_0xc6d1('0x11'));logger[_0xc6d1('0x12')](_0xc6d1('0x13'),_0x3aea7a,_0xc6d1('0x11'),JSON[_0xc6d1('0x14')](_0x1d8521));if(_0x1d8521[_0xc6d1('0x15')]){if(_0x1d8521['error'][_0xc6d1('0x16')]===0x1f4){logger[_0xc6d1('0x15')](_0xc6d1('0x10'),_0x3aea7a,_0x1d8521[_0xc6d1('0x15')][_0xc6d1('0x17')]);return _0x34be98(_0x1d8521[_0xc6d1('0x15')][_0xc6d1('0x17')]);}logger[_0xc6d1('0x15')](_0xc6d1('0x10'),_0x3aea7a,_0x1d8521[_0xc6d1('0x15')][_0xc6d1('0x17')]);return _0x5d9026(_0x1d8521[_0xc6d1('0x15')][_0xc6d1('0x17')]);}else{logger[_0xc6d1('0x18')](_0xc6d1('0x10'),_0x3aea7a,'request\x20sent');_0x5d9026(_0x1d8521['result'][_0xc6d1('0x17')]);}})['catch'](function(_0x1218e4){logger[_0xc6d1('0x15')](_0xc6d1('0x10'),_0x3aea7a,_0x1218e4);_0x34be98(_0x1218e4);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 5e72f71..072f67e 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 _0x64c4=['removeListener','length','./chatWebsite.events','save','remove','update','emit'];(function(_0x5f1fbf,_0xc491d1){var _0x409ea7=function(_0x5af698){while(--_0x5af698){_0x5f1fbf['push'](_0x5f1fbf['shift']());}};_0x409ea7(++_0xc491d1);}(_0x64c4,0x1a6));var _0x464c=function(_0x3d071e,_0x4d61f9){_0x3d071e=_0x3d071e-0x0;var _0x4b959b=_0x64c4[_0x3d071e];return _0x4b959b;};'use strict';var ChatWebsiteEvents=require(_0x464c('0x0'));var events=[_0x464c('0x1'),_0x464c('0x2'),_0x464c('0x3')];function createListener(_0x4b964c,_0x384240){return function(_0x42970b){_0x384240[_0x464c('0x4')](_0x4b964c,_0x42970b);};}function removeListener(_0x500f8c,_0x395181){return function(){ChatWebsiteEvents[_0x464c('0x5')](_0x500f8c,_0x395181);};}exports['register']=function(_0x5cc86a){for(var _0x457c09=0x0,_0x3594ce=events[_0x464c('0x6')];_0x457c09<_0x3594ce;_0x457c09++){var _0xa23f13=events[_0x457c09];var _0x4cd5fa=createListener('chatWebsite:'+_0xa23f13,_0x5cc86a);ChatWebsiteEvents['on'](_0xa23f13,_0x4cd5fa);}}; \ No newline at end of file +var _0xb086=['register','chatWebsite:','./chatWebsite.events','save','remove','update','emit'];(function(_0x47ccca,_0x56e632){var _0x2ec2d0=function(_0x4cef09){while(--_0x4cef09){_0x47ccca['push'](_0x47ccca['shift']());}};_0x2ec2d0(++_0x56e632);}(_0xb086,0xb8));var _0x6b08=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb086[_0x57b54c];return _0x59cc19;};'use strict';var ChatWebsiteEvents=require(_0x6b08('0x0'));var events=[_0x6b08('0x1'),_0x6b08('0x2'),_0x6b08('0x3')];function createListener(_0x3139a6,_0x4a08d6){return function(_0x465a6f){_0x4a08d6[_0x6b08('0x4')](_0x3139a6,_0x465a6f);};}function removeListener(_0x1a56f1,_0x4e9990){return function(){ChatWebsiteEvents['removeListener'](_0x1a56f1,_0x4e9990);};}exports[_0x6b08('0x5')]=function(_0x43eb92){for(var _0x2e929=0x0,_0x434c26=events['length'];_0x2e929<_0x434c26;_0x2e929++){var _0x30c063=events[_0x2e929];var _0x20961a=createListener(_0x6b08('0x6')+_0x30c063,_0x43eb92);ChatWebsiteEvents['on'](_0x30c063,_0x20961a);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 456eeda..9057e03 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 _0x5fd3=['/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','getAgents','create','post','/:id/dispositions','addAnswer','join','server/files/images/logos/','format','%s-%s','diskStorage','root','server/files/images/avatars/','now','originalname','single','file','/:id/customer_avatar','addCustomerAvatar','/:id/notify','notify','/:id/offline','/:id/interactions','addProactiveActions','addAgents','put','delete','destroy','removeDispositions','/:id/users','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','./chatWebsite.controller','get','index','/describe','isAuthenticated','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5fd3,0x163));var _0x35fd=function(_0x47a525,_0xc2ebe0){_0x47a525=_0x47a525-0x0;var _0x32826d=_0x5fd3[_0x47a525];return _0x32826d;};'use strict';var multer=require(_0x35fd('0x0'));var util=require(_0x35fd('0x1'));var path=require(_0x35fd('0x2'));var express=require(_0x35fd('0x3'));var router=express[_0x35fd('0x4')]();var auth=require(_0x35fd('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x35fd('0x6'));router[_0x35fd('0x7')]('/',auth['isAuthenticated'](),controller[_0x35fd('0x8')]);router[_0x35fd('0x7')](_0x35fd('0x9'),auth[_0x35fd('0xa')](),controller[_0x35fd('0xb')]);router[_0x35fd('0x7')](_0x35fd('0xc'),auth[_0x35fd('0xa')](),controller['show']);router[_0x35fd('0x7')]('/:id/dispositions',auth[_0x35fd('0xa')](),controller[_0x35fd('0xd')]);router[_0x35fd('0x7')](_0x35fd('0xe'),auth[_0x35fd('0xa')](),controller[_0x35fd('0xf')]);router[_0x35fd('0x7')](_0x35fd('0x10'),controller['getLogo']);router['get'](_0x35fd('0x11'),controller[_0x35fd('0x12')]);router[_0x35fd('0x7')]('/:id/customer_avatar',controller[_0x35fd('0x13')]);router[_0x35fd('0x7')](_0x35fd('0x14'),controller[_0x35fd('0x15')]);router[_0x35fd('0x7')]('/:id/interactions',auth[_0x35fd('0xa')](),controller[_0x35fd('0x16')]);router['get'](_0x35fd('0x17'),controller[_0x35fd('0x18')]);router[_0x35fd('0x7')](_0x35fd('0x19'),auth[_0x35fd('0xa')](),controller[_0x35fd('0x1a')]);router['get'](_0x35fd('0x1b'),auth['isAuthenticated'](),controller[_0x35fd('0x1c')]);router['get'](_0x35fd('0x1d'),controller[_0x35fd('0x1e')]);router[_0x35fd('0x7')](_0x35fd('0x1f'),auth[_0x35fd('0xa')](),controller[_0x35fd('0x20')]);router['get']('/:id/users',auth[_0x35fd('0xa')](),controller[_0x35fd('0x21')]);router['post']('/',auth[_0x35fd('0xa')](),controller[_0x35fd('0x22')]);router[_0x35fd('0x23')](_0x35fd('0x24'),auth[_0x35fd('0xa')](),controller['addDisposition']);router[_0x35fd('0x23')](_0x35fd('0xe'),auth[_0x35fd('0xa')](),controller[_0x35fd('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x261522,_0x1cc0bd,_0x13325b){_0x13325b(null,path[_0x35fd('0x26')](config['root'],_0x35fd('0x27')));},'filename':function(_0x2af4ad,_0x58afda,_0x365fef){_0x365fef(null,util[_0x35fd('0x28')](_0x35fd('0x29'),Date['now'](),_0x58afda['originalname']));}})});router[_0x35fd('0x23')](_0x35fd('0x10'),upload['single']('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x35fd('0x2a')]({'destination':function(_0x204fe0,_0x1dbbf1,_0x26442b){_0x26442b(null,path[_0x35fd('0x26')](config[_0x35fd('0x2b')],_0x35fd('0x2c')));},'filename':function(_0x13deb0,_0x3345c5,_0x37ab01){_0x37ab01(null,util[_0x35fd('0x28')](_0x35fd('0x29'),Date[_0x35fd('0x2d')](),_0x3345c5[_0x35fd('0x2e')]));}})});router[_0x35fd('0x23')](_0x35fd('0x11'),upload[_0x35fd('0x2f')](_0x35fd('0x30')),controller['addAvatar']);var upload=multer({'storage':multer[_0x35fd('0x2a')]({'destination':function(_0x5b32d9,_0xfa0928,_0xbea5be){_0xbea5be(null,path[_0x35fd('0x26')](config[_0x35fd('0x2b')],_0x35fd('0x2c')));},'filename':function(_0x2260f5,_0x5987ea,_0x98cdae){_0x98cdae(null,util['format']('%s-%s',Date['now'](),_0x5987ea[_0x35fd('0x2e')]));}})});router[_0x35fd('0x23')](_0x35fd('0x31'),upload[_0x35fd('0x2f')](_0x35fd('0x30')),controller[_0x35fd('0x32')]);var upload=multer({'storage':multer[_0x35fd('0x2a')]({'destination':function(_0x5703aa,_0x4ac5aa,_0x2bc681){_0x2bc681(null,path[_0x35fd('0x26')](config[_0x35fd('0x2b')],'server/files/images/avatars/'));},'filename':function(_0x4a8841,_0x27051b,_0x53c95a){_0x53c95a(null,util[_0x35fd('0x28')](_0x35fd('0x29'),Date[_0x35fd('0x2d')](),_0x27051b['originalname']));}})});router[_0x35fd('0x23')](_0x35fd('0x14'),upload[_0x35fd('0x2f')]('file'),controller['addSystemAvatar']);router['post'](_0x35fd('0x33'),controller[_0x35fd('0x34')]);router[_0x35fd('0x23')](_0x35fd('0x35'),controller['offline']);router['post'](_0x35fd('0x36'),auth[_0x35fd('0xa')](),controller['addInteraction']);router['post'](_0x35fd('0x19'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0x35fd('0x1b'),auth[_0x35fd('0xa')](),controller[_0x35fd('0x37')]);router[_0x35fd('0x23')]('/:id/users',auth[_0x35fd('0xa')](),controller[_0x35fd('0x38')]);router[_0x35fd('0x39')](_0x35fd('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x35fd('0x3a')](_0x35fd('0xc'),auth['isAuthenticated'](),controller[_0x35fd('0x3b')]);router[_0x35fd('0x3a')](_0x35fd('0x24'),auth[_0x35fd('0xa')](),controller[_0x35fd('0x3c')]);router[_0x35fd('0x3a')](_0x35fd('0xe'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x35fd('0x3a')](_0x35fd('0x3d'),auth[_0x35fd('0xa')](),controller[_0x35fd('0x3e')]);module[_0x35fd('0x3f')]=router; \ No newline at end of file +var _0x50d3=['offline','addInteraction','addApplications','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','now','originalname','single','addLogo','server/files/images/avatars/','addAvatar','file','addCustomerAvatar','addSystemAvatar','notify','/:id/offline'];(function(_0x34450e,_0x350b08){var _0x348049=function(_0x43e6ef){while(--_0x43e6ef){_0x34450e['push'](_0x34450e['shift']());}};_0x348049(++_0x350b08);}(_0x50d3,0xd7));var _0x350d=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0x50d3[_0x4099ee];return _0x1b7bfc;};'use strict';var multer=require(_0x350d('0x0'));var util=require('util');var path=require(_0x350d('0x1'));var express=require(_0x350d('0x2'));var router=express['Router']();var auth=require(_0x350d('0x3'));var interaction=require(_0x350d('0x4'));var config=require(_0x350d('0x5'));var controller=require(_0x350d('0x6'));router[_0x350d('0x7')]('/',auth[_0x350d('0x8')](),controller[_0x350d('0x9')]);router[_0x350d('0x7')](_0x350d('0xa'),auth['isAuthenticated'](),controller[_0x350d('0xb')]);router[_0x350d('0x7')](_0x350d('0xc'),auth[_0x350d('0x8')](),controller[_0x350d('0xd')]);router[_0x350d('0x7')]('/:id/dispositions',auth[_0x350d('0x8')](),controller['getDispositions']);router[_0x350d('0x7')](_0x350d('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x350d('0x7')](_0x350d('0xf'),controller[_0x350d('0x10')]);router[_0x350d('0x7')](_0x350d('0x11'),controller[_0x350d('0x12')]);router[_0x350d('0x7')](_0x350d('0x13'),controller[_0x350d('0x14')]);router[_0x350d('0x7')](_0x350d('0x15'),controller[_0x350d('0x16')]);router['get'](_0x350d('0x17'),auth[_0x350d('0x8')](),controller[_0x350d('0x18')]);router['get'](_0x350d('0x19'),controller[_0x350d('0x1a')]);router[_0x350d('0x7')](_0x350d('0x1b'),auth[_0x350d('0x8')](),controller[_0x350d('0x1c')]);router[_0x350d('0x7')](_0x350d('0x1d'),auth[_0x350d('0x8')](),controller[_0x350d('0x1e')]);router['get'](_0x350d('0x1f'),controller[_0x350d('0x20')]);router[_0x350d('0x7')](_0x350d('0x21'),auth[_0x350d('0x8')](),controller['getOfflineMessages']);router[_0x350d('0x7')](_0x350d('0x22'),auth[_0x350d('0x8')](),controller[_0x350d('0x23')]);router[_0x350d('0x24')]('/',auth[_0x350d('0x8')](),controller[_0x350d('0x25')]);router['post'](_0x350d('0x26'),auth['isAuthenticated'](),controller[_0x350d('0x27')]);router[_0x350d('0x24')]('/:id/canned_answers',auth[_0x350d('0x8')](),controller[_0x350d('0x28')]);var upload=multer({'storage':multer[_0x350d('0x29')]({'destination':function(_0x1e6c3f,_0x33cbfd,_0x2785a7){_0x2785a7(null,path['join'](config[_0x350d('0x2a')],_0x350d('0x2b')));},'filename':function(_0x44ff62,_0x290fd2,_0x4f006d){_0x4f006d(null,util[_0x350d('0x2c')](_0x350d('0x2d'),Date[_0x350d('0x2e')](),_0x290fd2[_0x350d('0x2f')]));}})});router[_0x350d('0x24')](_0x350d('0xf'),upload[_0x350d('0x30')]('file'),controller[_0x350d('0x31')]);var upload=multer({'storage':multer[_0x350d('0x29')]({'destination':function(_0x53aece,_0xfb90a8,_0x3849ef){_0x3849ef(null,path['join'](config[_0x350d('0x2a')],_0x350d('0x32')));},'filename':function(_0x1f59a4,_0x59c455,_0x57484b){_0x57484b(null,util[_0x350d('0x2c')](_0x350d('0x2d'),Date[_0x350d('0x2e')](),_0x59c455[_0x350d('0x2f')]));}})});router['post'](_0x350d('0x11'),upload[_0x350d('0x30')]('file'),controller[_0x350d('0x33')]);var upload=multer({'storage':multer[_0x350d('0x29')]({'destination':function(_0x37aec9,_0x484525,_0x44d800){_0x44d800(null,path['join'](config[_0x350d('0x2a')],_0x350d('0x32')));},'filename':function(_0x5d9788,_0x5c284c,_0x4987d4){_0x4987d4(null,util[_0x350d('0x2c')](_0x350d('0x2d'),Date['now'](),_0x5c284c[_0x350d('0x2f')]));}})});router[_0x350d('0x24')](_0x350d('0x13'),upload[_0x350d('0x30')](_0x350d('0x34')),controller[_0x350d('0x35')]);var upload=multer({'storage':multer[_0x350d('0x29')]({'destination':function(_0xb6dd6,_0x2cf36e,_0xe7a1ad){_0xe7a1ad(null,path['join'](config[_0x350d('0x2a')],_0x350d('0x32')));},'filename':function(_0x3e1532,_0x54d740,_0x18ae3b){_0x18ae3b(null,util['format'](_0x350d('0x2d'),Date[_0x350d('0x2e')](),_0x54d740[_0x350d('0x2f')]));}})});router[_0x350d('0x24')](_0x350d('0x15'),upload[_0x350d('0x30')](_0x350d('0x34')),controller[_0x350d('0x36')]);router['post']('/:id/notify',controller[_0x350d('0x37')]);router[_0x350d('0x24')](_0x350d('0x38'),controller[_0x350d('0x39')]);router[_0x350d('0x24')](_0x350d('0x17'),auth[_0x350d('0x8')](),controller[_0x350d('0x3a')]);router['post']('/:id/applications',auth[_0x350d('0x8')](),controller[_0x350d('0x3b')]);router['post']('/:id/proactive_actions',auth[_0x350d('0x8')](),controller['addProactiveActions']);router[_0x350d('0x24')](_0x350d('0x22'),auth['isAuthenticated'](),controller[_0x350d('0x3c')]);router[_0x350d('0x3d')](_0x350d('0xc'),auth[_0x350d('0x8')](),controller[_0x350d('0x3e')]);router[_0x350d('0x3f')](_0x350d('0xc'),auth[_0x350d('0x8')](),controller['destroy']);router[_0x350d('0x3f')](_0x350d('0x26'),auth[_0x350d('0x8')](),controller[_0x350d('0x40')]);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x350d('0x41')]);router[_0x350d('0x3f')](_0x350d('0x22'),auth['isAuthenticated'](),controller[_0x350d('0x42')]);module[_0x350d('0x43')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index d3c4218..1d86987 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 _0x9df5=['exports','STRING'];(function(_0x371fdd,_0x546ace){var _0x1bbc92=function(_0x11dbd1){while(--_0x11dbd1){_0x371fdd['push'](_0x371fdd['shift']());}};_0x1bbc92(++_0x546ace);}(_0x9df5,0x196));var _0x59df=function(_0x517c42,_0xdcce20){_0x517c42=_0x517c42-0x0;var _0x444250=_0x9df5[_0x517c42];return _0x444250;};'use strict';var Sequelize=require('sequelize');module[_0x59df('0x0')]={'name':{'type':Sequelize[_0x59df('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x59df('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x59df('0x1')]},'phone':{'type':Sequelize[_0x59df('0x1')]},'fax':{'type':Sequelize[_0x59df('0x1')]},'type':{'type':Sequelize[_0x59df('0x1')]},'street':{'type':Sequelize[_0x59df('0x1')]},'postalCode':{'type':Sequelize[_0x59df('0x1')]},'city':{'type':Sequelize[_0x59df('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x59df('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x59df('0x1')]},'sStreet':{'type':Sequelize[_0x59df('0x1')]},'sPostalCode':{'type':Sequelize[_0x59df('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x59df('0x1')]},'description':{'type':Sequelize[_0x59df('0x1')]}}; \ No newline at end of file +var _0xff7f=['STRING','name','sequelize','exports'];(function(_0xeca459,_0x54a757){var _0x50cd37=function(_0x3b0ae4){while(--_0x3b0ae4){_0xeca459['push'](_0xeca459['shift']());}};_0x50cd37(++_0x54a757);}(_0xff7f,0x14a));var _0xfff7=function(_0x4303b5,_0x459458){_0x4303b5=_0x4303b5-0x0;var _0x3dedb1=_0xff7f[_0x4303b5];return _0x3dedb1;};'use strict';var Sequelize=require(_0xfff7('0x0'));module[_0xfff7('0x1')]={'name':{'type':Sequelize[_0xfff7('0x2')],'unique':_0xfff7('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xfff7('0x2')]},'website':{'type':Sequelize[_0xfff7('0x2')]},'phone':{'type':Sequelize[_0xfff7('0x2')]},'fax':{'type':Sequelize[_0xfff7('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xfff7('0x2')]},'city':{'type':Sequelize[_0xfff7('0x2')]},'country':{'type':Sequelize[_0xfff7('0x2')]},'email':{'type':Sequelize[_0xfff7('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xfff7('0x2')]},'sStreet':{'type':Sequelize[_0xfff7('0x2')]},'sPostalCode':{'type':Sequelize[_0xfff7('0x2')]},'sCity':{'type':Sequelize[_0xfff7('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfff7('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 403f556..3ee14cd 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 _0xe533=['mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../config/logger','../../config/utils','../../config/environment','status','json','count','offset','limit','set','apply','reject','save','update','destroy','then','end','sendStatus','stack','name','send','index','CmCompany','rawAttributes','model','keys','dateStart','query','dateEnd','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day','merge','filter','includeAll','findAll','catch','show','include','find','create','body','addContacts','CmContact','params','ids','getContacts','findOne','length','options','fast-json-patch','request-promise','moment','bluebird'];(function(_0x46ecd0,_0x36b6ab){var _0xe116a9=function(_0x3477de){while(--_0x3477de){_0x46ecd0['push'](_0x46ecd0['shift']());}};_0xe116a9(++_0x36b6ab);}(_0xe533,0xd7));var _0x3e53=function(_0x373ac1,_0x5deb7d){_0x373ac1=_0x373ac1-0x0;var _0x287b12=_0xe533[_0x373ac1];return _0x287b12;};'use strict';var jsonpatch=require(_0x3e53('0x0'));var rp=require(_0x3e53('0x1'));var moment=require(_0x3e53('0x2'));var BPromise=require(_0x3e53('0x3'));var Mustache=require(_0x3e53('0x4'));var util=require(_0x3e53('0x5'));var path=require(_0x3e53('0x6'));var sox=require(_0x3e53('0x7'));var csv=require(_0x3e53('0x8'));var ejs=require(_0x3e53('0x9'));var fs=require('fs');var _=require(_0x3e53('0xa'));var squel=require('squel');var crypto=require(_0x3e53('0xb'));var jsforce=require(_0x3e53('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3e53('0x8'));var querystring=require(_0x3e53('0xd'));var Papa=require(_0x3e53('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0x3e53('0xf'))('api');var utils=require(_0x3e53('0x10'));var config=require(_0x3e53('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d000e,_0x3719d9){_0x3719d9=_0x3719d9||0xcc;return function(_0x3928ad){if(_0x3928ad){return _0x4d000e['sendStatus'](_0x3719d9);}return _0x4d000e[_0x3e53('0x12')](_0x3719d9)['end']();};}function respondWithResult(_0x21d9d2,_0x3356d3){_0x3356d3=_0x3356d3||0xc8;return function(_0x322b0e){if(_0x322b0e){return _0x21d9d2[_0x3e53('0x12')](_0x3356d3)[_0x3e53('0x13')](_0x322b0e);}};}function respondWithFilteredResult(_0x12fa9b,_0x23396a){return function(_0x4d56cf){if(_0x4d56cf){var _0x47afdb=_0x4d56cf[_0x3e53('0x14')],_0x5c872f=_0x23396a[_0x3e53('0x15')],_0x38237a=_0x23396a[_0x3e53('0x15')]+_0x23396a[_0x3e53('0x16')],_0x8458f0;if(_0x38237a>=_0x47afdb){_0x38237a=_0x47afdb;_0x8458f0=0xc8;}else{_0x8458f0=0xce;}_0x12fa9b[_0x3e53('0x12')](_0x8458f0);return _0x12fa9b[_0x3e53('0x17')]('Content-Range',_0x5c872f+'-'+_0x38237a+'/'+_0x47afdb)[_0x3e53('0x13')](_0x4d56cf);}return null;};}function patchUpdates(_0x234132){return function(_0x11d585){try{jsonpatch[_0x3e53('0x18')](_0x11d585,_0x234132,!![]);}catch(_0x53c172){return BPromise[_0x3e53('0x19')](_0x53c172);}return _0x11d585[_0x3e53('0x1a')]();};}function saveUpdates(_0x2b41ec,_0x13f8c8){return function(_0x494f67){if(_0x494f67){return _0x494f67[_0x3e53('0x1b')](_0x2b41ec)['then'](function(_0x2fc910){return _0x2fc910;});}return null;};}function removeEntity(_0x1a4514,_0x3b3074){return function(_0x7e9c2f){if(_0x7e9c2f){return _0x7e9c2f[_0x3e53('0x1c')]()[_0x3e53('0x1d')](function(){_0x1a4514[_0x3e53('0x12')](0xcc)[_0x3e53('0x1e')]();});}};}function handleEntityNotFound(_0x2ec636,_0x5db649){return function(_0x19c55d){if(!_0x19c55d){_0x2ec636[_0x3e53('0x1f')](0x194);}return _0x19c55d;};}function handleError(_0x19e37f,_0x5dac20){_0x5dac20=_0x5dac20||0x1f4;return function(_0x28c6f6){logger['error'](_0x28c6f6[_0x3e53('0x20')]);if(_0x28c6f6[_0x3e53('0x21')]){delete _0x28c6f6['name'];}_0x19e37f[_0x3e53('0x12')](_0x5dac20)[_0x3e53('0x22')](_0x28c6f6);};}exports[_0x3e53('0x23')]=function(_0x2225bc,_0x3c0233){var _0x442657={},_0x1c1874={},_0x115df1={'count':0x0,'rows':[]};var _0x3400fc=db[_0x3e53('0x24')][_0x3e53('0x25')];_0x1c1874[_0x3e53('0x26')]=_[_0x3e53('0x27')](_0x3400fc);var _0x2bca62={'dateStart':_0x2225bc['query'][_0x3e53('0x28')],'dateEnd':_0x2225bc['query']['dateEnd']};delete _0x2225bc[_0x3e53('0x29')][_0x3e53('0x28')];delete _0x2225bc['query'][_0x3e53('0x2a')];_0x1c1874[_0x3e53('0x29')]=_[_0x3e53('0x27')](_0x2225bc[_0x3e53('0x29')]);_0x1c1874['filters']=_[_0x3e53('0x2b')](_0x1c1874['model'],_0x1c1874[_0x3e53('0x29')]);_0x442657[_0x3e53('0x2c')]=_[_0x3e53('0x2b')](_0x1c1874[_0x3e53('0x26')],qs['fields'](_0x2225bc[_0x3e53('0x29')][_0x3e53('0x2d')]));_0x442657[_0x3e53('0x2c')]=_0x442657[_0x3e53('0x2c')]['length']?_0x442657[_0x3e53('0x2c')]:_0x1c1874[_0x3e53('0x26')];if(!_0x2225bc[_0x3e53('0x29')][_0x3e53('0x2e')](_0x3e53('0x2f'))){_0x442657[_0x3e53('0x16')]=qs['limit'](_0x2225bc[_0x3e53('0x29')][_0x3e53('0x16')]);_0x442657[_0x3e53('0x15')]=qs[_0x3e53('0x15')](_0x2225bc['query']['offset']);}_0x442657[_0x3e53('0x30')]=qs[_0x3e53('0x31')](_0x2225bc['query'][_0x3e53('0x31')]);_0x442657[_0x3e53('0x32')]=qs[_0x3e53('0x33')](_[_0x3e53('0x34')](_0x2225bc[_0x3e53('0x29')],_0x1c1874[_0x3e53('0x33')]));if(_0x2bca62[_0x3e53('0x28')]){if(_0x2bca62[_0x3e53('0x2a')]){_0x2bca62[_0x3e53('0x2a')]=moment(_0x2bca62[_0x3e53('0x2a')])[_0x3e53('0x35')](0x1,_0x3e53('0x36'));}else{_0x2bca62[_0x3e53('0x2a')]=moment(_0x2bca62[_0x3e53('0x28')])['add'](0x1,_0x3e53('0x36'));}_[_0x3e53('0x37')](_0x442657[_0x3e53('0x32')],{'createdAt':{'$gte':_0x2bca62[_0x3e53('0x28')],'$lte':_0x2bca62[_0x3e53('0x2a')]}});}if(_0x2225bc[_0x3e53('0x29')][_0x3e53('0x38')]){_0x442657['where']=_[_0x3e53('0x37')](_0x442657['where'],{'$or':_['map'](_0x442657['attributes'],function(_0xf5f9c8){var _0x113e75={};_0x113e75[_0xf5f9c8]={'$like':'%'+_0x2225bc[_0x3e53('0x29')][_0x3e53('0x38')]+'%'};return _0x113e75;})});}_0x442657=_['merge']({},_0x442657,_0x2225bc['options']);var _0x5e5662={'where':_0x442657[_0x3e53('0x32')]};return db[_0x3e53('0x24')]['count'](_0x5e5662)[_0x3e53('0x1d')](function(_0x50d160){_0x115df1['count']=_0x50d160;if(_0x2225bc[_0x3e53('0x29')][_0x3e53('0x39')]){_0x442657['include']=[{'all':!![]}];}return db[_0x3e53('0x24')][_0x3e53('0x3a')](_0x442657);})['then'](function(_0xc487fd){_0x115df1['rows']=_0xc487fd;return _0x115df1;})[_0x3e53('0x1d')](respondWithFilteredResult(_0x3c0233,_0x442657))[_0x3e53('0x3b')](handleError(_0x3c0233,null));};exports[_0x3e53('0x3c')]=function(_0x14d7f9,_0x16acf4){var _0x5f1528={'raw':![],'where':{'id':_0x14d7f9['params']['id']}},_0x464eb8={};_0x464eb8[_0x3e53('0x26')]=_['keys'](db[_0x3e53('0x24')]['rawAttributes']);_0x464eb8['query']=_[_0x3e53('0x27')](_0x14d7f9[_0x3e53('0x29')]);_0x464eb8['filters']=_[_0x3e53('0x2b')](_0x464eb8[_0x3e53('0x26')],_0x464eb8[_0x3e53('0x29')]);_0x5f1528[_0x3e53('0x2c')]=_[_0x3e53('0x2b')](_0x464eb8[_0x3e53('0x26')],qs[_0x3e53('0x2d')](_0x14d7f9[_0x3e53('0x29')][_0x3e53('0x2d')]));_0x5f1528[_0x3e53('0x2c')]=_0x5f1528[_0x3e53('0x2c')]['length']?_0x5f1528[_0x3e53('0x2c')]:_0x464eb8[_0x3e53('0x26')];if(_0x14d7f9[_0x3e53('0x29')][_0x3e53('0x39')]){_0x5f1528[_0x3e53('0x3d')]=[{'all':!![]}];}_0x5f1528=_[_0x3e53('0x37')]({},_0x5f1528,_0x14d7f9['options']);return db[_0x3e53('0x24')][_0x3e53('0x3e')](_0x5f1528)['then'](handleEntityNotFound(_0x16acf4,null))[_0x3e53('0x1d')](respondWithResult(_0x16acf4,null))['catch'](handleError(_0x16acf4,null));};exports[_0x3e53('0x3f')]=function(_0x34fac7,_0x4a8c62){return db[_0x3e53('0x24')][_0x3e53('0x3f')](_0x34fac7[_0x3e53('0x40')],{})[_0x3e53('0x1d')](respondWithResult(_0x4a8c62,0xc9))['catch'](handleError(_0x4a8c62,null));};exports[_0x3e53('0x1b')]=function(_0x190b5b,_0x5a790c){if(_0x190b5b[_0x3e53('0x40')]['id']){delete _0x190b5b[_0x3e53('0x40')]['id'];}return db[_0x3e53('0x24')]['find']({'where':{'id':_0x190b5b['params']['id']}})[_0x3e53('0x1d')](handleEntityNotFound(_0x5a790c,null))[_0x3e53('0x1d')](saveUpdates(_0x190b5b['body'],null))[_0x3e53('0x1d')](respondWithResult(_0x5a790c,null))['catch'](handleError(_0x5a790c,null));};exports[_0x3e53('0x1c')]=function(_0x148478,_0x3f9bd7){return db['CmCompany'][_0x3e53('0x3e')]({'where':{'id':_0x148478['params']['id']}})[_0x3e53('0x1d')](handleEntityNotFound(_0x3f9bd7,null))['then'](removeEntity(_0x3f9bd7,null))[_0x3e53('0x3b')](handleError(_0x3f9bd7,null));};exports[_0x3e53('0x41')]=function(_0x335c0a,_0x60dcbf,_0x57dcb1){return db[_0x3e53('0x42')]['find']({'where':{'id':_0x335c0a[_0x3e53('0x43')]['id']}})[_0x3e53('0x1d')](handleEntityNotFound(_0x60dcbf,null))[_0x3e53('0x1d')](function(_0x428038){if(_0x428038){return _0x428038[_0x3e53('0x41')](_0x335c0a['body'][_0x3e53('0x44')],_['omit'](_0x335c0a[_0x3e53('0x40')],[_0x3e53('0x44'),'id'])||{});}})[_0x3e53('0x1d')](respondWithResult(_0x60dcbf,null))[_0x3e53('0x3b')](handleError(_0x60dcbf,null));};exports[_0x3e53('0x45')]=function(_0xfb121f,_0x577603,_0x5a26e3){var _0x30d9bc={};var _0x2f52d9={};var _0x270051;var _0x4d343b;return db['CmCompany'][_0x3e53('0x46')]({'where':{'id':_0xfb121f[_0x3e53('0x43')]['id']}})['then'](handleEntityNotFound(_0x577603,null))[_0x3e53('0x1d')](function(_0x346a8c){if(_0x346a8c){_0x270051=_0x346a8c;_0x2f52d9[_0x3e53('0x26')]=_[_0x3e53('0x27')](db['CmContact'][_0x3e53('0x25')]);_0x2f52d9[_0x3e53('0x29')]=_[_0x3e53('0x27')](_0xfb121f['query']);_0x2f52d9['filters']=_['intersection'](_0x2f52d9[_0x3e53('0x26')],_0x2f52d9['query']);_0x30d9bc['attributes']=_['intersection'](_0x2f52d9[_0x3e53('0x26')],qs['fields'](_0xfb121f[_0x3e53('0x29')]['fields']));_0x30d9bc[_0x3e53('0x2c')]=_0x30d9bc['attributes'][_0x3e53('0x47')]?_0x30d9bc['attributes']:_0x2f52d9[_0x3e53('0x26')];_0x30d9bc['order']=qs[_0x3e53('0x31')](_0xfb121f['query'][_0x3e53('0x31')]);_0x30d9bc['where']=qs[_0x3e53('0x33')](_[_0x3e53('0x34')](_0xfb121f[_0x3e53('0x29')],_0x2f52d9[_0x3e53('0x33')]));if(_0xfb121f[_0x3e53('0x29')]['filter']){_0x30d9bc[_0x3e53('0x32')]=_[_0x3e53('0x37')](_0x30d9bc['where'],{'$or':_['map'](_0x30d9bc['attributes'],function(_0x48e5e6){var _0x5cda89={};_0x5cda89[_0x48e5e6]={'$like':'%'+_0xfb121f[_0x3e53('0x29')]['filter']+'%'};return _0x5cda89;})});}_0x30d9bc=_[_0x3e53('0x37')]({},_0x30d9bc,_0xfb121f[_0x3e53('0x48')]);return _0x270051['getContacts'](_0x30d9bc);}})['then'](function(_0x262aae){if(_0x262aae){_0x4d343b=_0x262aae[_0x3e53('0x47')];if(!_0xfb121f[_0x3e53('0x29')][_0x3e53('0x2e')]('nolimit')){_0x30d9bc[_0x3e53('0x16')]=qs[_0x3e53('0x16')](_0xfb121f['query']['limit']);_0x30d9bc[_0x3e53('0x15')]=qs[_0x3e53('0x15')](_0xfb121f[_0x3e53('0x29')]['offset']);}return _0x270051[_0x3e53('0x45')](_0x30d9bc);}})['then'](function(_0x160190){if(_0x160190){return _0x160190?{'count':_0x4d343b,'rows':_0x160190}:null;}})[_0x3e53('0x1d')](respondWithResult(_0x577603,null))['catch'](handleError(_0x577603,null));}; \ No newline at end of file +var _0x3412=['filters','intersection','attributes','fields','nolimit','offset','order','where','pick','add','day','merge','filter','map','options','CmCompany','includeAll','findAll','catch','rawAttributes','length','create','body','params','addContacts','CmContact','ids','omit','getContacts','findOne','sort','hasOwnProperty','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','model','query','dateStart','dateEnd','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3412,0xfe));var _0x2341=function(_0x16dd47,_0xbdbafe){_0x16dd47=_0x16dd47-0x0;var _0xfc2bff=_0x3412[_0x16dd47];return _0xfc2bff;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2341('0x0'));var BPromise=require(_0x2341('0x1'));var Mustache=require(_0x2341('0x2'));var util=require(_0x2341('0x3'));var path=require(_0x2341('0x4'));var sox=require(_0x2341('0x5'));var csv=require(_0x2341('0x6'));var ejs=require(_0x2341('0x7'));var fs=require('fs');var _=require(_0x2341('0x8'));var squel=require(_0x2341('0x9'));var crypto=require(_0x2341('0xa'));var jsforce=require(_0x2341('0xb'));var deskjs=require(_0x2341('0xc'));var toCsv=require(_0x2341('0x6'));var querystring=require(_0x2341('0xd'));var Papa=require(_0x2341('0xe'));var qs=require(_0x2341('0xf'));var logger=require(_0x2341('0x10'))(_0x2341('0x11'));var utils=require(_0x2341('0x12'));var config=require('../../config/environment');var db=require(_0x2341('0x13'))['db'];function respondWithStatusCode(_0x7d1f30,_0x344f36){_0x344f36=_0x344f36||0xcc;return function(_0x23aaff){if(_0x23aaff){return _0x7d1f30[_0x2341('0x14')](_0x344f36);}return _0x7d1f30[_0x2341('0x15')](_0x344f36)['end']();};}function respondWithResult(_0x3dac22,_0x458555){_0x458555=_0x458555||0xc8;return function(_0x4d9662){if(_0x4d9662){return _0x3dac22[_0x2341('0x15')](_0x458555)[_0x2341('0x16')](_0x4d9662);}};}function respondWithFilteredResult(_0x5366ce,_0x4fdb2c){return function(_0x21c022){if(_0x21c022){var _0x89bb50=_0x21c022[_0x2341('0x17')],_0x1df5e0=_0x4fdb2c['offset'],_0x375a1f=_0x4fdb2c['offset']+_0x4fdb2c[_0x2341('0x18')],_0x47f70b;if(_0x375a1f>=_0x89bb50){_0x375a1f=_0x89bb50;_0x47f70b=0xc8;}else{_0x47f70b=0xce;}_0x5366ce['status'](_0x47f70b);return _0x5366ce[_0x2341('0x19')](_0x2341('0x1a'),_0x1df5e0+'-'+_0x375a1f+'/'+_0x89bb50)[_0x2341('0x16')](_0x21c022);}return null;};}function patchUpdates(_0x554557){return function(_0x4ab395){try{jsonpatch[_0x2341('0x1b')](_0x4ab395,_0x554557,!![]);}catch(_0x28a388){return BPromise[_0x2341('0x1c')](_0x28a388);}return _0x4ab395[_0x2341('0x1d')]();};}function saveUpdates(_0x1cf5bb,_0x22a144){return function(_0x50831e){if(_0x50831e){return _0x50831e[_0x2341('0x1e')](_0x1cf5bb)['then'](function(_0x4b7e7a){return _0x4b7e7a;});}return null;};}function removeEntity(_0x28c3ae,_0x5899b4){return function(_0x91553d){if(_0x91553d){return _0x91553d[_0x2341('0x1f')]()[_0x2341('0x20')](function(){_0x28c3ae[_0x2341('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x172786,_0x4b09c7){return function(_0x4dcde2){if(!_0x4dcde2){_0x172786[_0x2341('0x14')](0x194);}return _0x4dcde2;};}function handleError(_0x16f474,_0x4668a2){_0x4668a2=_0x4668a2||0x1f4;return function(_0xa33185){logger[_0x2341('0x21')](_0xa33185[_0x2341('0x22')]);if(_0xa33185[_0x2341('0x23')]){delete _0xa33185[_0x2341('0x23')];}_0x16f474[_0x2341('0x15')](_0x4668a2)[_0x2341('0x24')](_0xa33185);};}exports['index']=function(_0xc84ae1,_0x136fa7){var _0x2d210e={},_0x504e63={},_0x4a281f={'count':0x0,'rows':[]};var _0x40be61=db['CmCompany']['rawAttributes'];_0x504e63[_0x2341('0x25')]=_['keys'](_0x40be61);var _0xa9e84f={'dateStart':_0xc84ae1[_0x2341('0x26')][_0x2341('0x27')],'dateEnd':_0xc84ae1['query'][_0x2341('0x28')]};delete _0xc84ae1[_0x2341('0x26')][_0x2341('0x27')];delete _0xc84ae1[_0x2341('0x26')][_0x2341('0x28')];_0x504e63[_0x2341('0x26')]=_[_0x2341('0x29')](_0xc84ae1[_0x2341('0x26')]);_0x504e63[_0x2341('0x2a')]=_[_0x2341('0x2b')](_0x504e63[_0x2341('0x25')],_0x504e63[_0x2341('0x26')]);_0x2d210e[_0x2341('0x2c')]=_[_0x2341('0x2b')](_0x504e63[_0x2341('0x25')],qs[_0x2341('0x2d')](_0xc84ae1['query'][_0x2341('0x2d')]));_0x2d210e['attributes']=_0x2d210e['attributes']['length']?_0x2d210e[_0x2341('0x2c')]:_0x504e63[_0x2341('0x25')];if(!_0xc84ae1[_0x2341('0x26')]['hasOwnProperty'](_0x2341('0x2e'))){_0x2d210e[_0x2341('0x18')]=qs['limit'](_0xc84ae1[_0x2341('0x26')][_0x2341('0x18')]);_0x2d210e[_0x2341('0x2f')]=qs['offset'](_0xc84ae1['query'][_0x2341('0x2f')]);}_0x2d210e[_0x2341('0x30')]=qs['sort'](_0xc84ae1[_0x2341('0x26')]['sort']);_0x2d210e[_0x2341('0x31')]=qs[_0x2341('0x2a')](_[_0x2341('0x32')](_0xc84ae1[_0x2341('0x26')],_0x504e63[_0x2341('0x2a')]));if(_0xa9e84f[_0x2341('0x27')]){if(_0xa9e84f[_0x2341('0x28')]){_0xa9e84f['dateEnd']=moment(_0xa9e84f['dateEnd'])[_0x2341('0x33')](0x1,_0x2341('0x34'));}else{_0xa9e84f[_0x2341('0x28')]=moment(_0xa9e84f[_0x2341('0x27')])[_0x2341('0x33')](0x1,_0x2341('0x34'));}_[_0x2341('0x35')](_0x2d210e[_0x2341('0x31')],{'createdAt':{'$gte':_0xa9e84f[_0x2341('0x27')],'$lte':_0xa9e84f[_0x2341('0x28')]}});}if(_0xc84ae1['query'][_0x2341('0x36')]){_0x2d210e[_0x2341('0x31')]=_[_0x2341('0x35')](_0x2d210e['where'],{'$or':_[_0x2341('0x37')](_0x2d210e[_0x2341('0x2c')],function(_0x2e2bfe){var _0x447d5b={};_0x447d5b[_0x2e2bfe]={'$like':'%'+_0xc84ae1[_0x2341('0x26')][_0x2341('0x36')]+'%'};return _0x447d5b;})});}_0x2d210e=_['merge']({},_0x2d210e,_0xc84ae1[_0x2341('0x38')]);var _0x5b4a00={'where':_0x2d210e[_0x2341('0x31')]};return db[_0x2341('0x39')][_0x2341('0x17')](_0x5b4a00)['then'](function(_0x29578d){_0x4a281f['count']=_0x29578d;if(_0xc84ae1[_0x2341('0x26')][_0x2341('0x3a')]){_0x2d210e['include']=[{'all':!![]}];}return db[_0x2341('0x39')][_0x2341('0x3b')](_0x2d210e);})[_0x2341('0x20')](function(_0x2f66f6){_0x4a281f['rows']=_0x2f66f6;return _0x4a281f;})[_0x2341('0x20')](respondWithFilteredResult(_0x136fa7,_0x2d210e))[_0x2341('0x3c')](handleError(_0x136fa7,null));};exports['show']=function(_0x1a9037,_0x517cd6){var _0x2c8ac5={'raw':![],'where':{'id':_0x1a9037['params']['id']}},_0x43645f={};_0x43645f[_0x2341('0x25')]=_[_0x2341('0x29')](db[_0x2341('0x39')][_0x2341('0x3d')]);_0x43645f['query']=_[_0x2341('0x29')](_0x1a9037['query']);_0x43645f[_0x2341('0x2a')]=_[_0x2341('0x2b')](_0x43645f['model'],_0x43645f['query']);_0x2c8ac5[_0x2341('0x2c')]=_[_0x2341('0x2b')](_0x43645f[_0x2341('0x25')],qs[_0x2341('0x2d')](_0x1a9037[_0x2341('0x26')][_0x2341('0x2d')]));_0x2c8ac5[_0x2341('0x2c')]=_0x2c8ac5[_0x2341('0x2c')][_0x2341('0x3e')]?_0x2c8ac5[_0x2341('0x2c')]:_0x43645f[_0x2341('0x25')];if(_0x1a9037[_0x2341('0x26')][_0x2341('0x3a')]){_0x2c8ac5['include']=[{'all':!![]}];}_0x2c8ac5=_['merge']({},_0x2c8ac5,_0x1a9037['options']);return db['CmCompany']['find'](_0x2c8ac5)[_0x2341('0x20')](handleEntityNotFound(_0x517cd6,null))['then'](respondWithResult(_0x517cd6,null))[_0x2341('0x3c')](handleError(_0x517cd6,null));};exports[_0x2341('0x3f')]=function(_0x179030,_0x54bf10){return db[_0x2341('0x39')]['create'](_0x179030[_0x2341('0x40')],{})['then'](respondWithResult(_0x54bf10,0xc9))['catch'](handleError(_0x54bf10,null));};exports[_0x2341('0x1e')]=function(_0x3e8552,_0x210acb){if(_0x3e8552[_0x2341('0x40')]['id']){delete _0x3e8552[_0x2341('0x40')]['id'];}return db[_0x2341('0x39')]['find']({'where':{'id':_0x3e8552[_0x2341('0x41')]['id']}})[_0x2341('0x20')](handleEntityNotFound(_0x210acb,null))['then'](saveUpdates(_0x3e8552[_0x2341('0x40')],null))[_0x2341('0x20')](respondWithResult(_0x210acb,null))[_0x2341('0x3c')](handleError(_0x210acb,null));};exports[_0x2341('0x1f')]=function(_0x54e019,_0x16657e){return db[_0x2341('0x39')]['find']({'where':{'id':_0x54e019[_0x2341('0x41')]['id']}})['then'](handleEntityNotFound(_0x16657e,null))[_0x2341('0x20')](removeEntity(_0x16657e,null))['catch'](handleError(_0x16657e,null));};exports[_0x2341('0x42')]=function(_0x21ad43,_0x14ceb2,_0x11fc07){return db[_0x2341('0x43')]['find']({'where':{'id':_0x21ad43[_0x2341('0x41')]['id']}})[_0x2341('0x20')](handleEntityNotFound(_0x14ceb2,null))[_0x2341('0x20')](function(_0x1690a2){if(_0x1690a2){return _0x1690a2[_0x2341('0x42')](_0x21ad43[_0x2341('0x40')][_0x2341('0x44')],_[_0x2341('0x45')](_0x21ad43[_0x2341('0x40')],[_0x2341('0x44'),'id'])||{});}})[_0x2341('0x20')](respondWithResult(_0x14ceb2,null))[_0x2341('0x3c')](handleError(_0x14ceb2,null));};exports[_0x2341('0x46')]=function(_0x20e96c,_0x49db70,_0x18df68){var _0x461dc0={};var _0x465961={};var _0x1606f8;var _0x2705cc;return db['CmCompany'][_0x2341('0x47')]({'where':{'id':_0x20e96c[_0x2341('0x41')]['id']}})[_0x2341('0x20')](handleEntityNotFound(_0x49db70,null))['then'](function(_0x10b088){if(_0x10b088){_0x1606f8=_0x10b088;_0x465961[_0x2341('0x25')]=_[_0x2341('0x29')](db[_0x2341('0x43')][_0x2341('0x3d')]);_0x465961[_0x2341('0x26')]=_['keys'](_0x20e96c[_0x2341('0x26')]);_0x465961[_0x2341('0x2a')]=_[_0x2341('0x2b')](_0x465961[_0x2341('0x25')],_0x465961[_0x2341('0x26')]);_0x461dc0[_0x2341('0x2c')]=_[_0x2341('0x2b')](_0x465961[_0x2341('0x25')],qs[_0x2341('0x2d')](_0x20e96c[_0x2341('0x26')][_0x2341('0x2d')]));_0x461dc0[_0x2341('0x2c')]=_0x461dc0[_0x2341('0x2c')][_0x2341('0x3e')]?_0x461dc0[_0x2341('0x2c')]:_0x465961['model'];_0x461dc0['order']=qs[_0x2341('0x48')](_0x20e96c[_0x2341('0x26')][_0x2341('0x48')]);_0x461dc0[_0x2341('0x31')]=qs[_0x2341('0x2a')](_[_0x2341('0x32')](_0x20e96c[_0x2341('0x26')],_0x465961[_0x2341('0x2a')]));if(_0x20e96c[_0x2341('0x26')][_0x2341('0x36')]){_0x461dc0[_0x2341('0x31')]=_['merge'](_0x461dc0[_0x2341('0x31')],{'$or':_[_0x2341('0x37')](_0x461dc0[_0x2341('0x2c')],function(_0x273a33){var _0x44a980={};_0x44a980[_0x273a33]={'$like':'%'+_0x20e96c[_0x2341('0x26')][_0x2341('0x36')]+'%'};return _0x44a980;})});}_0x461dc0=_['merge']({},_0x461dc0,_0x20e96c[_0x2341('0x38')]);return _0x1606f8[_0x2341('0x46')](_0x461dc0);}})['then'](function(_0x16f963){if(_0x16f963){_0x2705cc=_0x16f963[_0x2341('0x3e')];if(!_0x20e96c['query'][_0x2341('0x49')]('nolimit')){_0x461dc0[_0x2341('0x18')]=qs['limit'](_0x20e96c[_0x2341('0x26')][_0x2341('0x18')]);_0x461dc0[_0x2341('0x2f')]=qs[_0x2341('0x2f')](_0x20e96c[_0x2341('0x26')]['offset']);}return _0x1606f8[_0x2341('0x46')](_0x461dc0);}})[_0x2341('0x20')](function(_0x29553a){if(_0x29553a){return _0x29553a?{'count':_0x2705cc,'rows':_0x29553a}:null;}})['then'](respondWithResult(_0x49db70,null))[_0x2341('0x3c')](handleError(_0x49db70,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 80a2eb7..62620c5 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 _0xaf93=['exports','define','CmCompany','cm_companies','lodash','util','moment','bluebird','./cmCompany.attributes'];(function(_0x3e13e9,_0x317a2b){var _0x5383a6=function(_0x203ac0){while(--_0x203ac0){_0x3e13e9['push'](_0x3e13e9['shift']());}};_0x5383a6(++_0x317a2b);}(_0xaf93,0x151));var _0x3af9=function(_0x275c4f,_0x1a968c){_0x275c4f=_0x275c4f-0x0;var _0x1957ef=_0xaf93[_0x275c4f];return _0x1957ef;};'use strict';var _=require(_0x3af9('0x0'));var util=require(_0x3af9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3af9('0x2'));var BPromise=require(_0x3af9('0x3'));var rp=require('request-promise');var attributes=require(_0x3af9('0x4'));module[_0x3af9('0x5')]=function(_0x5add3,_0x189013){return _0x5add3[_0x3af9('0x6')](_0x3af9('0x7'),attributes,{'tableName':_0x3af9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd139=['cm_companies','lodash','util','moment','bluebird','request-promise','./cmCompany.attributes','exports','CmCompany'];(function(_0x25992f,_0x56a18a){var _0x102a0b=function(_0x4d5b88){while(--_0x4d5b88){_0x25992f['push'](_0x25992f['shift']());}};_0x102a0b(++_0x56a18a);}(_0xd139,0x14e));var _0x9d13=function(_0x5541f3,_0x266df7){_0x5541f3=_0x5541f3-0x0;var _0xe30f20=_0xd139[_0x5541f3];return _0xe30f20;};'use strict';var _=require(_0x9d13('0x0'));var util=require(_0x9d13('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9d13('0x2'));var BPromise=require(_0x9d13('0x3'));var rp=require(_0x9d13('0x4'));var attributes=require(_0x9d13('0x5'));module[_0x9d13('0x6')]=function(_0xdeacf6,_0x16b9f2){return _0xdeacf6['define'](_0x9d13('0x7'),attributes,{'tableName':_0x9d13('0x8'),'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 4aa3cfb..01de0aa 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 _0x032e=['stringify','error','code','message','result','catch','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x032e,0x124));var _0xe032=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x032e[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var moment=require(_0xe032('0x1'));var BPromise=require(_0xe032('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xe032('0x3'));var logger=require(_0xe032('0x4'))(_0xe032('0x5'));var config=require(_0xe032('0x6'));var jayson=require(_0xe032('0x7'));var client=jayson[_0xe032('0x8')][_0xe032('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33ad0b,_0x37432f,_0x1576c8){return new BPromise(function(_0x3289b0,_0xd84027){return client[_0xe032('0xa')](_0x33ad0b,_0x1576c8)[_0xe032('0xb')](function(_0x3d62fa){logger[_0xe032('0xc')](_0xe032('0xd'),_0x37432f,_0xe032('0xe'));logger['debug'](_0xe032('0xf'),_0x37432f,_0xe032('0xe'),JSON[_0xe032('0x10')](_0x3d62fa));if(_0x3d62fa[_0xe032('0x11')]){if(_0x3d62fa[_0xe032('0x11')][_0xe032('0x12')]===0x1f4){logger[_0xe032('0x11')]('CmCompany,\x20%s,\x20%s',_0x37432f,_0x3d62fa[_0xe032('0x11')][_0xe032('0x13')]);return _0xd84027(_0x3d62fa[_0xe032('0x11')][_0xe032('0x13')]);}logger['error'](_0xe032('0xd'),_0x37432f,_0x3d62fa[_0xe032('0x11')][_0xe032('0x13')]);return _0x3289b0(_0x3d62fa[_0xe032('0x11')][_0xe032('0x13')]);}else{logger[_0xe032('0xc')](_0xe032('0xd'),_0x37432f,'request\x20sent');_0x3289b0(_0x3d62fa[_0xe032('0x14')][_0xe032('0x13')]);}})[_0xe032('0x15')](function(_0x3b57d3){logger[_0xe032('0x11')](_0xe032('0xd'),_0x37432f,_0x3b57d3);_0xd84027(_0x3b57d3);});});} \ No newline at end of file +var _0x31f0=['../../config/environment','jayson/promise','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xb3daf7,_0x33755a){var _0x11998f=function(_0x523e2b){while(--_0x523e2b){_0xb3daf7['push'](_0xb3daf7['shift']());}};_0x11998f(++_0x33755a);}(_0x31f0,0xb7));var _0x031f=function(_0x4b075c,_0x4f9d21){_0x4b075c=_0x4b075c-0x0;var _0x592931=_0x31f0[_0x4b075c];return _0x592931;};'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']('CmCompany,\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);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 06b87ac..6628514 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 _0x258b=['getContacts','post','addContacts','put','update','delete','destroy','exports','multer','util','path','../../components/auth/service','./cmCompany.controller','get','isAuthenticated','index','/:id','/:id/contacts'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x258b,0x1ee));var _0xb258=function(_0x53619f,_0xc0254f){_0x53619f=_0x53619f-0x0;var _0x156f23=_0x258b[_0x53619f];return _0x156f23;};'use strict';var multer=require(_0xb258('0x0'));var util=require(_0xb258('0x1'));var path=require(_0xb258('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xb258('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb258('0x4'));router[_0xb258('0x5')]('/',auth[_0xb258('0x6')](),controller[_0xb258('0x7')]);router[_0xb258('0x5')](_0xb258('0x8'),auth[_0xb258('0x6')](),controller['show']);router[_0xb258('0x5')](_0xb258('0x9'),auth[_0xb258('0x6')](),controller[_0xb258('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xb258('0xb')](_0xb258('0x9'),auth['isAuthenticated'](),controller[_0xb258('0xc')]);router[_0xb258('0xd')](_0xb258('0x8'),auth[_0xb258('0x6')](),controller[_0xb258('0xe')]);router[_0xb258('0xf')](_0xb258('0x8'),auth[_0xb258('0x6')](),controller[_0xb258('0x10')]);module[_0xb258('0x11')]=router; \ No newline at end of file +var _0x1dad=['express','Router','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','/:id','show','get','/:id/contacts','getContacts','create','post','addContacts','put','delete','destroy','exports','multer','path'];(function(_0x2c7b86,_0x59ef3c){var _0x256735=function(_0x352e33){while(--_0x352e33){_0x2c7b86['push'](_0x2c7b86['shift']());}};_0x256735(++_0x59ef3c);}(_0x1dad,0x18e));var _0xd1da=function(_0x26d8b4,_0x35456b){_0x26d8b4=_0x26d8b4-0x0;var _0x3745ad=_0x1dad[_0x26d8b4];return _0x3745ad;};'use strict';var multer=require(_0xd1da('0x0'));var util=require('util');var path=require(_0xd1da('0x1'));var express=require(_0xd1da('0x2'));var router=express[_0xd1da('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd1da('0x4'));var config=require(_0xd1da('0x5'));var controller=require(_0xd1da('0x6'));router['get']('/',auth[_0xd1da('0x7')](),controller['index']);router['get'](_0xd1da('0x8'),auth[_0xd1da('0x7')](),controller[_0xd1da('0x9')]);router[_0xd1da('0xa')](_0xd1da('0xb'),auth[_0xd1da('0x7')](),controller[_0xd1da('0xc')]);router['post']('/',auth[_0xd1da('0x7')](),controller[_0xd1da('0xd')]);router[_0xd1da('0xe')](_0xd1da('0xb'),auth[_0xd1da('0x7')](),controller[_0xd1da('0xf')]);router[_0xd1da('0x10')](_0xd1da('0x8'),auth[_0xd1da('0x7')](),controller['update']);router[_0xd1da('0x11')]('/:id',auth[_0xd1da('0x7')](),controller[_0xd1da('0x12')]);module[_0xd1da('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 2996e72..9f7ea40 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 _0xffca=['STRING','INTEGER','UNSIGNED','DATE','NOW','exports'];(function(_0x27ce31,_0x1a0614){var _0x3d61b0=function(_0x3fcc9a){while(--_0x3fcc9a){_0x27ce31['push'](_0x27ce31['shift']());}};_0x3d61b0(++_0x1a0614);}(_0xffca,0x167));var _0xaffc=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xffca[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0xaffc('0x0')]={'firstName':{'type':Sequelize[_0xaffc('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0xaffc('0x1')]},'street':{'type':Sequelize[_0xaffc('0x1')]},'postalCode':{'type':Sequelize[_0xaffc('0x1')]},'city':{'type':Sequelize[_0xaffc('0x1')]},'country':{'type':Sequelize[_0xaffc('0x1')]},'dateOfBirth':{'type':Sequelize[_0xaffc('0x1')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xaffc('0x1')]},'fax':{'type':Sequelize[_0xaffc('0x1')]},'email':{'type':Sequelize[_0xaffc('0x1')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xaffc('0x1')]},'twitter':{'type':Sequelize[_0xaffc('0x1')]},'skype':{'type':Sequelize[_0xaffc('0x1')]},'teams':{'type':Sequelize[_0xaffc('0x1')]},'viber':{'type':Sequelize[_0xaffc('0x1')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xaffc('0x1')]},'UserId':{'type':Sequelize[_0xaffc('0x2')]},'priority':{'type':Sequelize[_0xaffc('0x2')](0x2)[_0xaffc('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xaffc('0x4')],'defaultValue':Sequelize[_0xaffc('0x5')]}}; \ No newline at end of file +var _0xa681=['STRING','TEXT','INTEGER','lodash','sequelize'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa681,0x1c5));var _0x1a68=function(_0x18bfe9,_0x14f008){_0x18bfe9=_0x18bfe9-0x0;var _0x1a7a07=_0xa681[_0x18bfe9];return _0x1a7a07;};'use strict';var _=require(_0x1a68('0x0'));var Sequelize=require(_0x1a68('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x1a68('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x1a68('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x1a68('0x2')]},'city':{'type':Sequelize[_0x1a68('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1a68('0x3')]},'phone':{'type':Sequelize[_0x1a68('0x2')]},'mobile':{'type':Sequelize[_0x1a68('0x2')]},'fax':{'type':Sequelize[_0x1a68('0x2')]},'email':{'type':Sequelize[_0x1a68('0x2')]},'url':{'type':Sequelize[_0x1a68('0x2')]},'facebook':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x1a68('0x2')]},'viber':{'type':Sequelize[_0x1a68('0x2')]},'line':{'type':Sequelize[_0x1a68('0x2')]},'wechat':{'type':Sequelize[_0x1a68('0x2')]},'UserId':{'type':Sequelize[_0x1a68('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'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 9e938d1..a681f31 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 _0xef96=['0777','child_process','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','User','agent','binding','firstName','fork','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','fast-json-patch','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','localhost','register','sendStatus','status','end','count','offset','set','json','apply','update','then','destroy','error','name','send','index','CmContact','describe','query','dateStart','dateEnd','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','pick','add','day','where','filter','map','merge','include','tag','push','distinct','Tag','Tags','color','ThroughTags','findAll','rows','catch','find','params','body','from','length','get','mergeWith','tags','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','JscriptySessionReport','bulkCreate','each','duplicates','$or','ListId','findOrCreate','spread','show','$and','CmCustomField','cf_%d','pickBy','startsWith','cf_','format','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','toParam','values','phone','getTags','findOne','options','setTags','ids','rawAttributes','sort','ContactId','getHopperHistories','includeAll','getHopperFinals','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync'];(function(_0xb8531f,_0x3a0f68){var _0x24f2be=function(_0x2a0553){while(--_0x2a0553){_0xb8531f['push'](_0xb8531f['shift']());}};_0x24f2be(++_0x3a0f68);}(_0xef96,0xc0));var _0x6ef9=function(_0x2f4411,_0x19e23f){_0x2f4411=_0x2f4411-0x0;var _0x489ca6=_0xef96[_0x2f4411];return _0x489ca6;};'use strict';var jsonpatch=require(_0x6ef9('0x0'));var rp=require('request-promise');var moment=require(_0x6ef9('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x6ef9('0x2'));var util=require(_0x6ef9('0x3'));var path=require(_0x6ef9('0x4'));var sox=require(_0x6ef9('0x5'));var csv=require(_0x6ef9('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x6ef9('0x7'));var crypto=require(_0x6ef9('0x8'));var jsforce=require(_0x6ef9('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6ef9('0xa'));var Papa=require(_0x6ef9('0xb'));var qs=require('../../components/parsers/qs');var logger=require(_0x6ef9('0xc'))(_0x6ef9('0xd'));var utils=require(_0x6ef9('0xe'));var config=require(_0x6ef9('0xf'));var db=require(_0x6ef9('0x10'))['db'];var socket=require('socket.io-emitter')({'host':_0x6ef9('0x11'),'port':0x18eb});require('./cmContact.socket')[_0x6ef9('0x12')](socket);function respondWithStatusCode(_0x929f05,_0x2819cf){_0x2819cf=_0x2819cf||0xcc;return function(_0x10bdcf){if(_0x10bdcf){return _0x929f05[_0x6ef9('0x13')](_0x2819cf);}return _0x929f05[_0x6ef9('0x14')](_0x2819cf)[_0x6ef9('0x15')]();};}function respondWithResult(_0x171f2a,_0x32d9b2){_0x32d9b2=_0x32d9b2||0xc8;return function(_0x79400f){if(_0x79400f){return _0x171f2a[_0x6ef9('0x14')](_0x32d9b2)['json'](_0x79400f);}};}function respondWithFilteredResult(_0xde7a49,_0x3a3ca9){return function(_0x182b90){if(_0x182b90){var _0x1ae656=_0x182b90[_0x6ef9('0x16')],_0x3c123e=_0x3a3ca9[_0x6ef9('0x17')],_0x14ca77=_0x3a3ca9[_0x6ef9('0x17')]+_0x3a3ca9['limit'],_0x5ea3a4;if(_0x14ca77>=_0x1ae656){_0x14ca77=_0x1ae656;_0x5ea3a4=0xc8;}else{_0x5ea3a4=0xce;}_0xde7a49[_0x6ef9('0x14')](_0x5ea3a4);return _0xde7a49[_0x6ef9('0x18')]('Content-Range',_0x3c123e+'-'+_0x14ca77+'/'+_0x1ae656)[_0x6ef9('0x19')](_0x182b90);}return null;};}function patchUpdates(_0x28dbb3){return function(_0x20cafc){try{jsonpatch[_0x6ef9('0x1a')](_0x20cafc,_0x28dbb3,!![]);}catch(_0x253a58){return BPromise['reject'](_0x253a58);}return _0x20cafc['save']();};}function saveUpdates(_0x51f98b,_0x42e49d){return function(_0x1cb123){if(_0x1cb123){return _0x1cb123[_0x6ef9('0x1b')](_0x51f98b)[_0x6ef9('0x1c')](function(_0x10d3ca){return _0x10d3ca;});}return null;};}function removeEntity(_0x5625f6,_0x12c8d8){return function(_0x42d329){if(_0x42d329){return _0x42d329[_0x6ef9('0x1d')]()[_0x6ef9('0x1c')](function(){_0x5625f6[_0x6ef9('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x240349,_0x4c28e8){return function(_0x545c45){if(!_0x545c45){_0x240349[_0x6ef9('0x13')](0x194);}return _0x545c45;};}function handleError(_0x1aaebc,_0x4151fc){_0x4151fc=_0x4151fc||0x1f4;return function(_0x347c68){logger[_0x6ef9('0x1e')](_0x347c68['stack']);if(_0x347c68[_0x6ef9('0x1f')]){delete _0x347c68['name'];}_0x1aaebc[_0x6ef9('0x14')](_0x4151fc)[_0x6ef9('0x20')](_0x347c68);};}exports[_0x6ef9('0x21')]=function(_0x4ca103,_0x2fa3dc){var _0x488455={},_0x22875f={},_0x9ebf5a={'count':0x0,'rows':[]};return db[_0x6ef9('0x22')][_0x6ef9('0x23')]()[_0x6ef9('0x1c')](function(_0x17198c){_0x22875f['model']=_['keys'](_0x17198c);var _0x2a28f2={'dateStart':_0x4ca103[_0x6ef9('0x24')][_0x6ef9('0x25')],'dateEnd':_0x4ca103[_0x6ef9('0x24')][_0x6ef9('0x26')]};delete _0x4ca103[_0x6ef9('0x24')]['dateStart'];delete _0x4ca103[_0x6ef9('0x24')][_0x6ef9('0x26')];_0x22875f['query']=_[_0x6ef9('0x27')](_0x4ca103[_0x6ef9('0x24')]);_0x22875f[_0x6ef9('0x28')]=_['intersection'](_0x22875f[_0x6ef9('0x29')],_0x22875f[_0x6ef9('0x24')]);_0x488455[_0x6ef9('0x2a')]=_[_0x6ef9('0x2b')](_0x22875f[_0x6ef9('0x29')],qs[_0x6ef9('0x2c')](_0x4ca103[_0x6ef9('0x24')][_0x6ef9('0x2c')]));_0x488455[_0x6ef9('0x2a')]=_0x488455[_0x6ef9('0x2a')]['length']?_0x488455[_0x6ef9('0x2a')]:_0x22875f[_0x6ef9('0x29')];if(!_0x4ca103[_0x6ef9('0x24')][_0x6ef9('0x2d')](_0x6ef9('0x2e'))){_0x488455['limit']=qs[_0x6ef9('0x2f')](_0x4ca103['query'][_0x6ef9('0x2f')]);_0x488455[_0x6ef9('0x17')]=qs[_0x6ef9('0x17')](_0x4ca103['query'][_0x6ef9('0x17')]);}_0x488455[_0x6ef9('0x30')]=qs['sort'](_0x4ca103['query']['sort']);_0x488455['where']=qs[_0x6ef9('0x28')](_[_0x6ef9('0x31')](_0x4ca103[_0x6ef9('0x24')],_0x22875f[_0x6ef9('0x28')]));if(_0x2a28f2[_0x6ef9('0x25')]){if(_0x2a28f2[_0x6ef9('0x26')]){_0x2a28f2['dateEnd']=moment(_0x2a28f2[_0x6ef9('0x26')])[_0x6ef9('0x32')](0x1,_0x6ef9('0x33'));}else{_0x2a28f2[_0x6ef9('0x26')]=moment(_0x2a28f2[_0x6ef9('0x25')])[_0x6ef9('0x32')](0x1,_0x6ef9('0x33'));}_['merge'](_0x488455[_0x6ef9('0x34')],{'createdAt':{'$gte':_0x2a28f2[_0x6ef9('0x25')],'$lte':_0x2a28f2[_0x6ef9('0x26')]}});}if(_0x4ca103['query'][_0x6ef9('0x35')]){_0x488455['where']=_['merge'](_0x488455['where'],{'$or':_[_0x6ef9('0x36')](_0x488455[_0x6ef9('0x2a')],function(_0x14490b){var _0x26a942={};_0x26a942[_0x14490b]={'$like':'%'+_0x4ca103['query'][_0x6ef9('0x35')]+'%'};return _0x26a942;})});}_0x488455=_[_0x6ef9('0x37')]({},_0x488455,_0x4ca103['options']);var _0x31bd84={'where':_0x488455[_0x6ef9('0x34')]};_0x31bd84[_0x6ef9('0x38')]=[];if(_0x4ca103[_0x6ef9('0x24')][_0x6ef9('0x39')]){_0x31bd84[_0x6ef9('0x38')][_0x6ef9('0x3a')]({'model':db['Tag'],'as':'Tags','attributes':['id'],'where':{'id':_0x4ca103[_0x6ef9('0x24')][_0x6ef9('0x39')]},'required':!![]});_0x31bd84[_0x6ef9('0x3b')]=!![];}return db['CmContact']['count'](_0x31bd84)[_0x6ef9('0x1c')](function(_0x4ebdda){_0x9ebf5a[_0x6ef9('0x16')]=_0x4ebdda;if(_0x4ca103['query']['includeAll']){_0x488455[_0x6ef9('0x38')]=[{'model':db[_0x6ef9('0x3c')],'as':_0x6ef9('0x3d'),'attributes':['id',_0x6ef9('0x1f'),_0x6ef9('0x3e')],'required':_0x4ca103[_0x6ef9('0x24')][_0x6ef9('0x39')]?!![]:![]},{'model':db[_0x6ef9('0x3c')],'as':_0x6ef9('0x3f'),'attributes':['id',_0x6ef9('0x1f'),'color'],'through':_0x4ca103[_0x6ef9('0x24')][_0x6ef9('0x39')]?{'attributes':[],'where':{'TagId':_0x4ca103['query'][_0x6ef9('0x39')]||undefined}}:{},'required':_0x4ca103[_0x6ef9('0x24')]['tag']?!![]:![]}];}return db[_0x6ef9('0x22')][_0x6ef9('0x40')](_0x488455);})[_0x6ef9('0x1c')](function(_0x2b333e){_0x9ebf5a[_0x6ef9('0x41')]=_0x2b333e;return _0x9ebf5a;})[_0x6ef9('0x1c')](respondWithFilteredResult(_0x2fa3dc,_0x488455))[_0x6ef9('0x42')](handleError(_0x2fa3dc,null));});};exports[_0x6ef9('0x1d')]=function(_0x45f3c4,_0x12f346){return db[_0x6ef9('0x22')][_0x6ef9('0x43')]({'where':{'id':_0x45f3c4[_0x6ef9('0x44')]['id']}})[_0x6ef9('0x1c')](handleEntityNotFound(_0x12f346,null))['then'](removeEntity(_0x12f346,null))[_0x6ef9('0x42')](handleError(_0x12f346,null));};exports['describe']=function(_0x139af8,_0x256c70){return db['CmContact']['describe']()[_0x6ef9('0x1c')](respondWithResult(_0x256c70,null))[_0x6ef9('0x42')](handleError(_0x256c70,null));};exports['merge']=function(_0x3af46e,_0x280ab1){var _0x3d6bc9;var _0x12f093;var _0xdc8823;if(_0x3af46e['body']['id']){delete _0x3af46e['body']['id'];}return db[_0x6ef9('0x22')][_0x6ef9('0x40')]({'where':{'id':[_0x3af46e['body']['to'],_0x3af46e[_0x6ef9('0x45')][_0x6ef9('0x46')]]}})[_0x6ef9('0x1c')](function(_0x4b036d){if(_0x4b036d){if(_0x4b036d[_0x6ef9('0x47')]!==0x2){return null;}_0x4b036d[0x0]=_0x4b036d[0x0][_0x6ef9('0x48')]({'plain':!![]});_0x4b036d[0x1]=_0x4b036d[0x1]['get']({'plain':!![]});delete _0x4b036d[0x0]['id'];delete _0x4b036d[0x1]['id'];return _[_0x6ef9('0x49')](_0x4b036d[0x0],_0x4b036d[0x1],function(_0x20606f,_0x53b0ed){if(Array['isArray'](_0x53b0ed)&&!_0x53b0ed[_0x6ef9('0x47')]){return _0x20606f;}else if(!_0x53b0ed){return _0x20606f;}});}})[_0x6ef9('0x1c')](handleEntityNotFound(_0x280ab1,null))[_0x6ef9('0x1c')](function(_0x1d1103){if(_0x1d1103){if(_0x1d1103[_0x6ef9('0x4a')]&&_[_0x6ef9('0x4b')](_0x1d1103[_0x6ef9('0x4a')])){_0x1d1103[_0x6ef9('0x4a')]=_0x1d1103[_0x6ef9('0x4a')][_0x6ef9('0x4c')]();}logger['info'](_0x6ef9('0x4d'),_0x3af46e['body']['to'],_0x3af46e['body'][_0x6ef9('0x46')]);return db[_0x6ef9('0x4e')]['destroy']({'where':{'ContactId':[_0x3af46e['body']['to'],_0x3af46e[_0x6ef9('0x45')][_0x6ef9('0x46')]]}})['then'](function(_0x7d5f70){logger[_0x6ef9('0x4f')](_0x6ef9('0x50'),_0x7d5f70);return db[_0x6ef9('0x51')][_0x6ef9('0x1d')]({'where':{'ContactId':[_0x3af46e['body']['to'],_0x3af46e[_0x6ef9('0x45')]['from']]}})[_0x6ef9('0x1c')](function(_0x4d1d2c){logger[_0x6ef9('0x4f')](_0x6ef9('0x52'),_0x4d1d2c);return db[_0x6ef9('0x22')][_0x6ef9('0x53')](_0x1d1103);});});}})['then'](function(_0x4bb96f){if(_0x4bb96f){_0x3d6bc9=_0x4bb96f;_0x12f093={'ContactId':_0x3d6bc9['id']};_0xdc8823={'where':{'ContactId':[_0x3af46e[_0x6ef9('0x45')]['to'],_0x3af46e[_0x6ef9('0x45')][_0x6ef9('0x46')]]}};return db[_0x6ef9('0x54')]['update'](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db['ChatMessage'][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})['then'](function(){if(_0x3d6bc9){return db[_0x6ef9('0x55')][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x56')][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db['MailMessage'][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x56')]['update'](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x57')][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})['then'](function(){if(_0x3d6bc9){return db['SmsInteraction'][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db['SmsMessage'][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x58')][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x59')]['update'](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x5a')][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x5b')][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x5c')][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x5d')]['update'](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x5e')][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x5f')][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x60')]['update'](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x61')][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})['then'](function(){if(_0x3d6bc9){return db[_0x6ef9('0x62')]['update'](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x63')][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})['then'](function(){if(_0x3d6bc9){return db['SmsQueueReport'][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x64')][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x22')][_0x6ef9('0x1d')]({'where':{'id':[_0x3af46e[_0x6ef9('0x45')]['to'],_0x3af46e[_0x6ef9('0x45')]['from']]}});}})['then'](function(){if(_0x3d6bc9){return _0x3d6bc9;}})[_0x6ef9('0x1c')](respondWithResult(_0x280ab1,null))[_0x6ef9('0x42')](handleError(_0x280ab1,null));};exports[_0x6ef9('0x53')]=function(_0x18678a,_0x2e19a5){return db[_0x6ef9('0x22')][_0x6ef9('0x23')]()[_0x6ef9('0x1c')](function(_0x5416f0){if(_0x18678a[_0x6ef9('0x45')][_0x6ef9('0x4a')]&&_['isArray'](_0x18678a[_0x6ef9('0x45')]['tags'])){if(_0x18678a[_0x6ef9('0x45')]['tags'][_0x6ef9('0x47')]){_0x18678a[_0x6ef9('0x45')][_0x6ef9('0x4a')]=_0x18678a[_0x6ef9('0x45')][_0x6ef9('0x4a')][_0x6ef9('0x4c')](';')+';';}else{_0x18678a[_0x6ef9('0x45')]['tags']=null;}}else{_0x18678a[_0x6ef9('0x45')][_0x6ef9('0x4a')]=null;}return db[_0x6ef9('0x22')]['create'](_0x18678a[_0x6ef9('0x45')],{'fields':_[_0x6ef9('0x27')](_0x5416f0),'raw':!![]});})[_0x6ef9('0x1c')](respondWithResult(_0x2e19a5,0xc9))[_0x6ef9('0x42')](handleError(_0x2e19a5,null));};exports[_0x6ef9('0x65')]=function(_0x3b372c,_0xb4e7fa){var _0x1d6f76=[];var _0x3e6014=0x0;var _0x406825=0x0;var _0x1f397d=0x0;return db['CmContact']['describe']()[_0x6ef9('0x1c')](function(_0x1bf805){return BPromise[_0x6ef9('0x66')](_0x3b372c[_0x6ef9('0x45')],function(_0x177128){var _0x10dde6={'where':{'$or':[]},'defaults':_0x177128,'fields':_[_0x6ef9('0x27')](_0x1bf805),'raw':!![]};if(_0x177128['duplicates']){for(var _0x38288a=0x0;_0x38288a<_0x177128[_0x6ef9('0x67')]['length'];_0x38288a++){var _0x394fd9={};_0x394fd9[_0x177128['duplicates'][_0x38288a]]=_0x177128[_0x177128[_0x6ef9('0x67')][_0x38288a]];_0x10dde6[_0x6ef9('0x34')][_0x6ef9('0x68')][_0x6ef9('0x3a')](_0x394fd9);}_0x10dde6['where'][_0x6ef9('0x69')]=_0x177128[_0x6ef9('0x69')];}return db[_0x6ef9('0x22')][_0x6ef9('0x6a')](_0x10dde6)[_0x6ef9('0x6b')](function(_0x35a7d0,_0x4cebca){if(_0x4cebca){_0x3e6014++;}else{_0x1f397d++;}})[_0x6ef9('0x42')](function(_0xa07a3f){console['error'](_0xa07a3f);_0x406825++;});});})[_0x6ef9('0x1c')](function(_0x4fbc50){if(_0x4fbc50){return{'success':_0x3e6014,'failure':_0x406825,'duplicates':_0x1f397d};}})[_0x6ef9('0x1c')](respondWithResult(_0xb4e7fa,0xc9))['catch'](handleError(_0xb4e7fa,null));};exports[_0x6ef9('0x6c')]=function(_0xea0988,_0x8c9d65,_0x4f02c2){var _0x5e90dc;return db[_0x6ef9('0x22')]['describe']()[_0x6ef9('0x1c')](function(_0x4810ef){return db[_0x6ef9('0x22')]['find']({'where':{'id':_0xea0988['params']['id']},'include':[{'model':db['Tag'],'as':_0x6ef9('0x3d'),'attributes':['id',_0x6ef9('0x1f'),'color'],'required':_0xea0988['query']['tag']?!![]:![]}],'attributes':_['keys'](_0x4810ef)});})['then'](function(_0x163a89){_0x5e90dc=_0x163a89[_0x6ef9('0x48')]({'plain':!![]});var _0x3114d3={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x163a89&&_0x163a89[_0x6ef9('0x69')]){if(_0x163a89[_0x6ef9('0x69')]){_0x3114d3['where'][_0x6ef9('0x6d')]['push']({'ListId':{'$ne':_0x163a89['ListId']}});}}return db[_0x6ef9('0x6e')][_0x6ef9('0x40')](_0x3114d3);})[_0x6ef9('0x1c')](function(_0x31907e){return _['omit'](_0x5e90dc,_[_0x6ef9('0x36')](_0x31907e,function(_0x5eb29a){return util['format'](_0x6ef9('0x6f'),_0x5eb29a['id']);}));})[_0x6ef9('0x1c')](handleEntityNotFound(_0x8c9d65,null))['then'](respondWithResult(_0x8c9d65,null))['catch'](handleError(_0x8c9d65,null));};exports[_0x6ef9('0x1b')]=function(_0x340641,_0x5b8960){var _0x59066b;if(_0x340641[_0x6ef9('0x45')]['id']){delete _0x340641[_0x6ef9('0x45')]['id'];}return db[_0x6ef9('0x22')][_0x6ef9('0x43')]({'where':{'id':_0x340641[_0x6ef9('0x44')]['id']}})['then'](handleEntityNotFound(_0x5b8960,null))[_0x6ef9('0x1c')](saveUpdates(_0x340641['body'],null))[_0x6ef9('0x1c')](function(_0x33b71b){_0x59066b=_0x33b71b;var _0x22fd59={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x33b71b&&_0x33b71b[_0x6ef9('0x69')]){if(_0x33b71b[_0x6ef9('0x69')]){_0x22fd59[_0x6ef9('0x34')][_0x6ef9('0x6d')]['push']({'ListId':{'$ne':_0x33b71b[_0x6ef9('0x69')]}});}}return db[_0x6ef9('0x6e')][_0x6ef9('0x40')](_0x22fd59);})['then'](function(_0x1dba74){if(_0x1dba74){return _['omit'](_[_0x6ef9('0x70')](_0x340641[_0x6ef9('0x45')],function(_0x2bd070,_0x1cb4c2){return _[_0x6ef9('0x71')](_0x1cb4c2,_0x6ef9('0x72'));}),_[_0x6ef9('0x36')](_0x1dba74,function(_0x4f064e){return util[_0x6ef9('0x73')](_0x6ef9('0x6f'),_0x4f064e['id']);}));}})[_0x6ef9('0x1c')](function(_0x58d98e){if(_0x58d98e&&!_[_0x6ef9('0x74')](_0x58d98e)){var _0x3489a3=squel[_0x6ef9('0x1b')]()[_0x6ef9('0x75')](_0x6ef9('0x76'))[_0x6ef9('0x77')](_0x58d98e)[_0x6ef9('0x34')](_0x6ef9('0x78'),_0x340641[_0x6ef9('0x44')]['id'])[_0x6ef9('0x79')]();return db['sequelize'][_0x6ef9('0x24')](_0x3489a3['text'],{'replacements':_0x3489a3[_0x6ef9('0x7a')]});}})[_0x6ef9('0x1c')](function(){if(_0x340641['body'][_0x6ef9('0x7b')]&&_0x59066b){return db[_0x6ef9('0x4e')]['update']({'phone':_0x340641[_0x6ef9('0x45')][_0x6ef9('0x7b')]},{'where':{'ContactId':_0x59066b['id']}});}})[_0x6ef9('0x1c')](function(){return _0x59066b;})[_0x6ef9('0x1c')](respondWithResult(_0x5b8960,null))[_0x6ef9('0x42')](handleError(_0x5b8960,null));};exports[_0x6ef9('0x7c')]=function(_0x5557d3,_0x25a865,_0x28f067){var _0x3e9bdf={};var _0x59f031={};var _0x3ec825;var _0x583c61;return db[_0x6ef9('0x22')][_0x6ef9('0x7d')]({'where':{'id':_0x5557d3[_0x6ef9('0x44')]['id']}})[_0x6ef9('0x1c')](handleEntityNotFound(_0x25a865,null))[_0x6ef9('0x1c')](function(_0x4edad8){if(_0x4edad8){_0x3ec825=_0x4edad8;_0x59f031[_0x6ef9('0x29')]=_[_0x6ef9('0x27')](db[_0x6ef9('0x3c')]['rawAttributes']);_0x59f031[_0x6ef9('0x24')]=_[_0x6ef9('0x27')](_0x5557d3[_0x6ef9('0x24')]);_0x59f031[_0x6ef9('0x28')]=_['intersection'](_0x59f031[_0x6ef9('0x29')],_0x59f031[_0x6ef9('0x24')]);_0x3e9bdf['attributes']=_[_0x6ef9('0x2b')](_0x59f031[_0x6ef9('0x29')],qs['fields'](_0x5557d3[_0x6ef9('0x24')][_0x6ef9('0x2c')]));_0x3e9bdf[_0x6ef9('0x2a')]=_0x3e9bdf[_0x6ef9('0x2a')][_0x6ef9('0x47')]?_0x3e9bdf[_0x6ef9('0x2a')]:_0x59f031[_0x6ef9('0x29')];_0x3e9bdf[_0x6ef9('0x30')]=qs['sort'](_0x5557d3['query']['sort']);_0x3e9bdf['where']=qs[_0x6ef9('0x28')](_['pick'](_0x5557d3[_0x6ef9('0x24')],_0x59f031[_0x6ef9('0x28')]));if(_0x5557d3[_0x6ef9('0x24')][_0x6ef9('0x35')]){_0x3e9bdf[_0x6ef9('0x34')]=_[_0x6ef9('0x37')](_0x3e9bdf[_0x6ef9('0x34')],{'$or':_[_0x6ef9('0x36')](_0x3e9bdf[_0x6ef9('0x2a')],function(_0x1018a7){var _0x3a7634={};_0x3a7634[_0x1018a7]={'$like':'%'+_0x5557d3['query'][_0x6ef9('0x35')]+'%'};return _0x3a7634;})});}_0x3e9bdf=_['merge']({},_0x3e9bdf,_0x5557d3[_0x6ef9('0x7e')]);return _0x3ec825[_0x6ef9('0x7c')](_0x3e9bdf);}})[_0x6ef9('0x1c')](function(_0x1088af){if(_0x1088af){_0x583c61=_0x1088af[_0x6ef9('0x47')];if(!_0x5557d3[_0x6ef9('0x24')][_0x6ef9('0x2d')]('nolimit')){_0x3e9bdf['limit']=qs[_0x6ef9('0x2f')](_0x5557d3[_0x6ef9('0x24')][_0x6ef9('0x2f')]);_0x3e9bdf[_0x6ef9('0x17')]=qs[_0x6ef9('0x17')](_0x5557d3['query'][_0x6ef9('0x17')]);}return _0x3ec825['getTags'](_0x3e9bdf);}})[_0x6ef9('0x1c')](function(_0x35db26){if(_0x35db26){return _0x35db26?{'count':_0x583c61,'rows':_0x35db26}:null;}})[_0x6ef9('0x1c')](respondWithResult(_0x25a865,null))[_0x6ef9('0x42')](handleError(_0x25a865,null));};exports[_0x6ef9('0x7f')]=function(_0x8305d,_0x411b86,_0x625764){if(_0x8305d[_0x6ef9('0x45')]['id']){delete _0x8305d['body']['id'];}return db[_0x6ef9('0x22')][_0x6ef9('0x7d')]({'where':{'id':_0x8305d[_0x6ef9('0x44')]['id']}})[_0x6ef9('0x1c')](handleEntityNotFound(_0x411b86,null))[_0x6ef9('0x1c')](function(_0x4e1ccf){if(_0x4e1ccf){return _0x4e1ccf[_0x6ef9('0x7f')](_0x8305d[_0x6ef9('0x45')][_0x6ef9('0x80')]||[]);}return null;})[_0x6ef9('0x1c')](respondWithResult(_0x411b86,null))[_0x6ef9('0x42')](handleError(_0x411b86,null));};exports['getHoppers']=function(_0x48c901,_0x51e179,_0x406d4d){var _0x28cb07={'raw':![],'where':{}};var _0x56d5c2={};var _0x281151={'count':0x0,'rows':[]};return db[_0x6ef9('0x22')]['findOne']({'where':{'id':_0x48c901[_0x6ef9('0x44')]['id']}})['then'](handleEntityNotFound(_0x51e179,null))[_0x6ef9('0x1c')](function(_0x3f4dbd){if(_0x3f4dbd){_0x56d5c2[_0x6ef9('0x29')]=_[_0x6ef9('0x27')](db['CmHopper'][_0x6ef9('0x81')]);_0x56d5c2['query']=_[_0x6ef9('0x27')](_0x48c901[_0x6ef9('0x24')]);_0x56d5c2['filters']=_[_0x6ef9('0x2b')](_0x56d5c2[_0x6ef9('0x29')],_0x56d5c2[_0x6ef9('0x24')]);_0x28cb07[_0x6ef9('0x2a')]=_[_0x6ef9('0x2b')](_0x56d5c2[_0x6ef9('0x29')],qs['fields'](_0x48c901[_0x6ef9('0x24')][_0x6ef9('0x2c')]));_0x28cb07[_0x6ef9('0x2a')]=_0x28cb07['attributes']['length']?_0x28cb07[_0x6ef9('0x2a')]:_0x56d5c2[_0x6ef9('0x29')];if(!_0x48c901[_0x6ef9('0x24')][_0x6ef9('0x2d')](_0x6ef9('0x2e'))){_0x28cb07['limit']=qs['limit'](_0x48c901[_0x6ef9('0x24')][_0x6ef9('0x2f')]);_0x28cb07[_0x6ef9('0x17')]=qs[_0x6ef9('0x17')](_0x48c901[_0x6ef9('0x24')][_0x6ef9('0x17')]);}_0x28cb07[_0x6ef9('0x30')]=qs[_0x6ef9('0x82')](_0x48c901['query'][_0x6ef9('0x82')]);_0x28cb07[_0x6ef9('0x34')]=qs['filters'](_[_0x6ef9('0x31')](_0x48c901[_0x6ef9('0x24')],_0x56d5c2[_0x6ef9('0x28')]));_0x28cb07[_0x6ef9('0x34')][_0x6ef9('0x83')]=_0x3f4dbd['id'];if(_0x48c901['query'][_0x6ef9('0x35')]){_0x28cb07[_0x6ef9('0x34')]=_[_0x6ef9('0x37')](_0x28cb07[_0x6ef9('0x34')],{'$or':_[_0x6ef9('0x36')](_0x28cb07[_0x6ef9('0x2a')],function(_0x199ebc){var _0x46d70={};_0x46d70[_0x199ebc]={'$like':'%'+_0x48c901[_0x6ef9('0x24')][_0x6ef9('0x35')]+'%'};return _0x46d70;})});}_0x28cb07=_[_0x6ef9('0x37')]({},_0x28cb07,_0x48c901['options']);return db[_0x6ef9('0x4e')][_0x6ef9('0x16')]({'where':_0x28cb07[_0x6ef9('0x34')]})[_0x6ef9('0x1c')](function(_0xd26259){_0x281151['count']=_0xd26259;if(_0x48c901[_0x6ef9('0x24')]['includeAll']){_0x28cb07[_0x6ef9('0x38')]=[{'all':!![]}];}return db[_0x6ef9('0x4e')][_0x6ef9('0x40')](_0x28cb07);})[_0x6ef9('0x1c')](function(_0x6e1b0d){_0x281151[_0x6ef9('0x41')]=_0x6e1b0d;return _0x281151;});}})[_0x6ef9('0x1c')](respondWithFilteredResult(_0x51e179,_0x28cb07))[_0x6ef9('0x42')](handleError(_0x51e179,null));};exports[_0x6ef9('0x84')]=function(_0xca08a,_0x1b1707,_0x3a97b5){var _0x36fc7c={'raw':!![],'where':{}};var _0x5afa59={};var _0x5d2bcc={'count':0x0,'rows':[]};return db[_0x6ef9('0x22')]['findOne']({'where':{'id':_0xca08a[_0x6ef9('0x44')]['id']}})[_0x6ef9('0x1c')](handleEntityNotFound(_0x1b1707,null))[_0x6ef9('0x1c')](function(_0x5e18b1){if(_0x5e18b1){_0x5afa59['model']=_[_0x6ef9('0x27')](db[_0x6ef9('0x5d')][_0x6ef9('0x81')]);_0x5afa59[_0x6ef9('0x24')]=_[_0x6ef9('0x27')](_0xca08a[_0x6ef9('0x24')]);_0x5afa59[_0x6ef9('0x28')]=_[_0x6ef9('0x2b')](_0x5afa59[_0x6ef9('0x29')],_0x5afa59[_0x6ef9('0x24')]);_0x36fc7c['attributes']=_['intersection'](_0x5afa59[_0x6ef9('0x29')],qs[_0x6ef9('0x2c')](_0xca08a['query'][_0x6ef9('0x2c')]));_0x36fc7c[_0x6ef9('0x2a')]=_0x36fc7c[_0x6ef9('0x2a')][_0x6ef9('0x47')]?_0x36fc7c[_0x6ef9('0x2a')]:_0x5afa59['model'];if(!_0xca08a[_0x6ef9('0x24')][_0x6ef9('0x2d')](_0x6ef9('0x2e'))){_0x36fc7c[_0x6ef9('0x2f')]=qs[_0x6ef9('0x2f')](_0xca08a['query'][_0x6ef9('0x2f')]);_0x36fc7c[_0x6ef9('0x17')]=qs[_0x6ef9('0x17')](_0xca08a[_0x6ef9('0x24')][_0x6ef9('0x17')]);}_0x36fc7c[_0x6ef9('0x30')]=qs[_0x6ef9('0x82')](_0xca08a[_0x6ef9('0x24')][_0x6ef9('0x82')]);_0x36fc7c[_0x6ef9('0x34')]=qs[_0x6ef9('0x28')](_[_0x6ef9('0x31')](_0xca08a[_0x6ef9('0x24')],_0x5afa59['filters']));_0x36fc7c['where']['ContactId']=_0x5e18b1['id'];if(_0xca08a[_0x6ef9('0x24')][_0x6ef9('0x35')]){_0x36fc7c[_0x6ef9('0x34')]=_[_0x6ef9('0x37')](_0x36fc7c['where'],{'$or':_[_0x6ef9('0x36')](_0x36fc7c['attributes'],function(_0x116c6e){var _0x211b70={};_0x211b70[_0x116c6e]={'$like':'%'+_0xca08a['query']['filter']+'%'};return _0x211b70;})});}_0x36fc7c=_[_0x6ef9('0x37')]({},_0x36fc7c,_0xca08a[_0x6ef9('0x7e')]);return db[_0x6ef9('0x5d')][_0x6ef9('0x16')]({'where':_0x36fc7c['where']})[_0x6ef9('0x1c')](function(_0x1e2447){_0x5d2bcc[_0x6ef9('0x16')]=_0x1e2447;if(_0xca08a[_0x6ef9('0x24')][_0x6ef9('0x85')]){_0x36fc7c['include']=[{'all':!![]}];}return db[_0x6ef9('0x5d')]['findAll'](_0x36fc7c);})[_0x6ef9('0x1c')](function(_0x409195){_0x5d2bcc['rows']=_0x409195;return _0x5d2bcc;});}})[_0x6ef9('0x1c')](respondWithFilteredResult(_0x1b1707,_0x36fc7c))['catch'](handleError(_0x1b1707,null));};exports[_0x6ef9('0x86')]=function(_0x1dfb3a,_0x5b5156,_0x2ff4db){var _0x17c0b4={'raw':!![],'where':{}};var _0x57d9dc={};var _0xcb310f={'count':0x0,'rows':[]};return db[_0x6ef9('0x22')][_0x6ef9('0x7d')]({'where':{'id':_0x1dfb3a[_0x6ef9('0x44')]['id']}})[_0x6ef9('0x1c')](handleEntityNotFound(_0x5b5156,null))[_0x6ef9('0x1c')](function(_0x1606d0){if(_0x1606d0){_0x57d9dc[_0x6ef9('0x29')]=_[_0x6ef9('0x27')](db[_0x6ef9('0x5c')][_0x6ef9('0x81')]);_0x57d9dc['query']=_[_0x6ef9('0x27')](_0x1dfb3a[_0x6ef9('0x24')]);_0x57d9dc[_0x6ef9('0x28')]=_[_0x6ef9('0x2b')](_0x57d9dc[_0x6ef9('0x29')],_0x57d9dc[_0x6ef9('0x24')]);_0x17c0b4[_0x6ef9('0x2a')]=_[_0x6ef9('0x2b')](_0x57d9dc['model'],qs['fields'](_0x1dfb3a[_0x6ef9('0x24')]['fields']));_0x17c0b4['attributes']=_0x17c0b4['attributes'][_0x6ef9('0x47')]?_0x17c0b4[_0x6ef9('0x2a')]:_0x57d9dc[_0x6ef9('0x29')];if(!_0x1dfb3a[_0x6ef9('0x24')][_0x6ef9('0x2d')]('nolimit')){_0x17c0b4['limit']=qs[_0x6ef9('0x2f')](_0x1dfb3a[_0x6ef9('0x24')]['limit']);_0x17c0b4[_0x6ef9('0x17')]=qs[_0x6ef9('0x17')](_0x1dfb3a['query']['offset']);}_0x17c0b4[_0x6ef9('0x30')]=qs[_0x6ef9('0x82')](_0x1dfb3a['query'][_0x6ef9('0x82')]);_0x17c0b4['where']=qs[_0x6ef9('0x28')](_[_0x6ef9('0x31')](_0x1dfb3a[_0x6ef9('0x24')],_0x57d9dc['filters']));_0x17c0b4['where'][_0x6ef9('0x83')]=_0x1606d0['id'];if(_0x1dfb3a[_0x6ef9('0x24')]['filter']){_0x17c0b4['where']=_[_0x6ef9('0x37')](_0x17c0b4[_0x6ef9('0x34')],{'$or':_[_0x6ef9('0x36')](_0x17c0b4[_0x6ef9('0x2a')],function(_0x50697e){var _0x5c702f={};_0x5c702f[_0x50697e]={'$like':'%'+_0x1dfb3a[_0x6ef9('0x24')][_0x6ef9('0x35')]+'%'};return _0x5c702f;})});}_0x17c0b4=_['merge']({},_0x17c0b4,_0x1dfb3a[_0x6ef9('0x7e')]);return db[_0x6ef9('0x5c')]['count']({'where':_0x17c0b4[_0x6ef9('0x34')]})[_0x6ef9('0x1c')](function(_0x67e04d){_0xcb310f[_0x6ef9('0x16')]=_0x67e04d;if(_0x1dfb3a[_0x6ef9('0x24')]['includeAll']){_0x17c0b4[_0x6ef9('0x38')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x6ef9('0x40')](_0x17c0b4);})[_0x6ef9('0x1c')](function(_0x14bd86){_0xcb310f[_0x6ef9('0x41')]=_0x14bd86;return _0xcb310f;});}})['then'](respondWithFilteredResult(_0x5b5156,_0x17c0b4))[_0x6ef9('0x42')](handleError(_0x5b5156,null));};exports['getJscriptySessions']=function(_0xb3fe4c,_0x272a34,_0x386baa){var _0x3375d7={'raw':!![],'where':{}};var _0x2d0607={};var _0x38dc35={'count':0x0,'rows':[]};return db[_0x6ef9('0x22')]['findOne']({'where':{'id':_0xb3fe4c[_0x6ef9('0x44')]['id']}})[_0x6ef9('0x1c')](handleEntityNotFound(_0x272a34,null))['then'](function(_0x5cd190){if(_0x5cd190){_0x2d0607[_0x6ef9('0x29')]=_[_0x6ef9('0x27')](db[_0x6ef9('0x64')][_0x6ef9('0x81')]);_0x2d0607[_0x6ef9('0x24')]=_[_0x6ef9('0x27')](_0xb3fe4c[_0x6ef9('0x24')]);_0x2d0607['filters']=_[_0x6ef9('0x2b')](_0x2d0607[_0x6ef9('0x29')],_0x2d0607[_0x6ef9('0x24')]);_0x3375d7[_0x6ef9('0x2a')]=_['intersection'](_0x2d0607['model'],qs[_0x6ef9('0x2c')](_0xb3fe4c['query'][_0x6ef9('0x2c')]));_0x3375d7[_0x6ef9('0x2a')]=_0x3375d7[_0x6ef9('0x2a')][_0x6ef9('0x47')]?_0x3375d7['attributes']:_0x2d0607[_0x6ef9('0x29')];if(!_0xb3fe4c[_0x6ef9('0x24')]['hasOwnProperty'](_0x6ef9('0x2e'))){_0x3375d7[_0x6ef9('0x2f')]=qs['limit'](_0xb3fe4c['query']['limit']);_0x3375d7[_0x6ef9('0x17')]=qs['offset'](_0xb3fe4c[_0x6ef9('0x24')][_0x6ef9('0x17')]);}_0x3375d7['order']=qs[_0x6ef9('0x82')](_0xb3fe4c['query'][_0x6ef9('0x82')]);_0x3375d7[_0x6ef9('0x34')]=qs[_0x6ef9('0x28')](_[_0x6ef9('0x31')](_0xb3fe4c[_0x6ef9('0x24')],_0x2d0607[_0x6ef9('0x28')]));_0x3375d7[_0x6ef9('0x34')][_0x6ef9('0x83')]=_0x5cd190['id'];if(_0xb3fe4c[_0x6ef9('0x24')][_0x6ef9('0x35')]){_0x3375d7[_0x6ef9('0x34')]=_['merge'](_0x3375d7[_0x6ef9('0x34')],{'$or':_[_0x6ef9('0x36')](_0x3375d7[_0x6ef9('0x2a')],function(_0x4795f1){var _0x277279={};_0x277279[_0x4795f1]={'$like':'%'+_0xb3fe4c[_0x6ef9('0x24')]['filter']+'%'};return _0x277279;})});}_0x3375d7=_[_0x6ef9('0x37')]({},_0x3375d7,_0xb3fe4c['options']);return db[_0x6ef9('0x64')][_0x6ef9('0x16')]({'where':_0x3375d7[_0x6ef9('0x34')]})['then'](function(_0x2a46c3){_0x38dc35[_0x6ef9('0x16')]=_0x2a46c3;if(_0xb3fe4c['query'][_0x6ef9('0x85')]){_0x3375d7[_0x6ef9('0x38')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x3375d7);})[_0x6ef9('0x1c')](function(_0x11b450){_0x38dc35[_0x6ef9('0x41')]=_0x11b450;return _0x38dc35;});}})[_0x6ef9('0x1c')](respondWithFilteredResult(_0x272a34,_0x3375d7))[_0x6ef9('0x42')](handleError(_0x272a34,null));};exports[_0x6ef9('0x87')]=function(_0x1e2904,_0x45cf15,_0x7e9af8){try{if(!_0x1e2904[_0x6ef9('0x45')]['ListId']){throw new Error(_0x6ef9('0x88'));}if(!_0x1e2904['body'][_0x6ef9('0x89')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x1e2904[_0x6ef9('0x45')]['binding_values']){throw new Error(_0x6ef9('0x8a'));}if(!_0x1e2904[_0x6ef9('0x45')][_0x6ef9('0x8b')]){throw new Error(_0x6ef9('0x8c'));}var _0x4be3fe=_0x1e2904[_0x6ef9('0x45')][_0x6ef9('0x89')][_0x6ef9('0x8d')](',');var _0x34cf7c=_0x1e2904[_0x6ef9('0x45')][_0x6ef9('0x8e')][_0x6ef9('0x8d')](',');if(!_0x4be3fe[_0x6ef9('0x47')]||!_0x34cf7c[_0x6ef9('0x47')]||_0x4be3fe[_0x6ef9('0x47')]!==_0x34cf7c[_0x6ef9('0x47')]){throw new Error(_0x6ef9('0x8f'));}_0x1e2904[_0x6ef9('0x45')][_0x6ef9('0x2c')]=_[_0x6ef9('0x90')](_0x4be3fe,_0x34cf7c);if(!_0x1e2904[_0x6ef9('0x45')][_0x6ef9('0x2c')][_0x6ef9('0x7b')]){throw new Error(_0x6ef9('0x91'));}if(!_0x1e2904[_0x6ef9('0x45')][_0x6ef9('0x2c')]['firstName']){throw new Error(_0x6ef9('0x92'));}var _0x546059=path[_0x6ef9('0x4c')](config[_0x6ef9('0x93')],_0x6ef9('0x94'),_0x1e2904[_0x6ef9('0x95')][_0x6ef9('0x96')]);fs[_0x6ef9('0x97')](_0x546059,parseInt(_0x6ef9('0x98'),0x8));var _0xde91c9=require(_0x6ef9('0x99'))['fork'](path[_0x6ef9('0x4c')](__dirname,_0x6ef9('0x9a')),[_0x546059,_0x1e2904[_0x6ef9('0x45')][_0x6ef9('0x89')],_0x1e2904['body'][_0x6ef9('0x8e')],_0x1e2904[_0x6ef9('0x45')]['ListId'],_0x1e2904[_0x6ef9('0x45')][_0x6ef9('0x9b')],_0x1e2904[_0x6ef9('0x45')][_0x6ef9('0x67')],_0x1e2904['body']['socket_timestamp']]);return _0x45cf15[_0x6ef9('0x14')](0xc8)[_0x6ef9('0x19')]({'message':_0x6ef9('0x9c'),'pid':_0xde91c9[_0x6ef9('0x9d')]});}catch(_0x5b94bb){return _0x45cf15[_0x6ef9('0x14')](0x1f4)[_0x6ef9('0x20')](_0x5b94bb);}};exports[_0x6ef9('0x9e')]=function(_0x3f713b,_0x5f49dd,_0x1c803c){var _0x3add6b=fs[_0x6ef9('0x9f')](_0x3f713b[_0x6ef9('0x95')][_0x6ef9('0x4')]);Papa[_0x6ef9('0xa0')](_0x3add6b,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x1cfbef){return _0x5f49dd['status'](0xc8)[_0x6ef9('0x19')]({'file':_0x3f713b['file'],'fields':_0x1cfbef[_0x6ef9('0xa1')][_0x6ef9('0x2c')]});}});};exports['import']=function(_0x310bdb,_0x1705a6,_0x3e1448){return db[_0x6ef9('0xa2')][_0x6ef9('0x40')]({'raw':!![],'attributes':['id'],'where':{'role':_0x6ef9('0xa3')}})[_0x6ef9('0x1c')](function(_0xf8f9d5){var _0x4ac0ba=![];if(!_0x310bdb['body'][_0x6ef9('0x69')]){throw new Error('No\x20ListId\x20specified');}if(!_0x310bdb['body']['binding']['phone']){throw new Error(_0x6ef9('0x91'));}if(!_0x310bdb[_0x6ef9('0x45')][_0x6ef9('0xa4')][_0x6ef9('0xa5')]){throw new Error(_0x6ef9('0x92'));}if(!_0x310bdb[_0x6ef9('0x45')][_0x6ef9('0x8b')]){throw new Error(_0x6ef9('0x8c'));}var _0x29dc7e=require(_0x6ef9('0x99'))[_0x6ef9('0xa6')](path['join'](__dirname,'../../components/import/cm/csv2'),[_0x310bdb[_0x6ef9('0x44')]['id'],JSON['stringify'](_0x310bdb['body']),JSON[_0x6ef9('0xa7')](_0xf8f9d5)]);_0x29dc7e['on'](_0x6ef9('0xa8'),function(_0x130596){_0x4ac0ba=!![];return _0x1705a6[_0x6ef9('0x14')](0xc8)['json']({'message':_0x6ef9('0xa9'),'pid':_0x29dc7e['pid']});});_0x29dc7e['on'](_0x6ef9('0xaa'),function(_0x203f79){if(_0x203f79&&!_0x4ac0ba){return _0x1705a6[_0x6ef9('0x14')](0x1f4)[_0x6ef9('0x19')]({'message':_0x6ef9('0xab'),'pid':_0x29dc7e[_0x6ef9('0x9d')]});}});})[_0x6ef9('0x42')](handleError(_0x1705a6,null));}; \ No newline at end of file +var _0x8c30=['where','pick','day','merge','filter','map','options','tag','push','Tag','Tags','distinct','includeAll','include','color','ThroughTags','findAll','rows','catch','find','body','get','mergeWith','isArray','tags','info','CmHopper','from','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','join','duplicates','$or','ListId','spread','show','params','$and','CmCustomField','omit','pickBy','startsWith','cf_','format','cf_%d','isEmpty','table','cm_contacts','setFields','toParam','text','values','phone','getTags','findOne','rawAttributes','setTags','ids','getHoppers','ContactId','getHopperHistories','getHopperFinals','CmHopperFinal','getJscriptySessions','JscriptySessionReport','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','split','Incorrect\x20binding\x20parameters\x20passed!','No\x20firstName\x20column\x20specified','root','filename','0777','fork','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','upload','createReadStream','file','parse','meta','User','agent','binding','No\x20phone\x20column\x20specified','firstName','child_process','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','fast-json-patch','request-promise','mustache','util','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./cmContact.socket','register','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','CmContact','describe','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0x8c30,0x74));var _0x08c3=function(_0x1ac1a4,_0x174d5f){_0x1ac1a4=_0x1ac1a4-0x0;var _0xf6dcd7=_0x8c30[_0x1ac1a4];return _0xf6dcd7;};'use strict';var jsonpatch=require(_0x08c3('0x0'));var rp=require(_0x08c3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x08c3('0x2'));var util=require(_0x08c3('0x3'));var path=require('path');var sox=require(_0x08c3('0x4'));var csv=require('to-csv');var ejs=require(_0x08c3('0x5'));var fs=require('fs');var _=require(_0x08c3('0x6'));var squel=require('squel');var crypto=require(_0x08c3('0x7'));var jsforce=require(_0x08c3('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x08c3('0x9'));var querystring=require(_0x08c3('0xa'));var Papa=require(_0x08c3('0xb'));var qs=require(_0x08c3('0xc'));var logger=require('../../config/logger')(_0x08c3('0xd'));var utils=require(_0x08c3('0xe'));var config=require(_0x08c3('0xf'));var db=require(_0x08c3('0x10'))['db'];var socket=require(_0x08c3('0x11'))({'host':_0x08c3('0x12'),'port':0x18eb});require(_0x08c3('0x13'))[_0x08c3('0x14')](socket);function respondWithStatusCode(_0x90fff8,_0x2e4248){_0x2e4248=_0x2e4248||0xcc;return function(_0xeca1bb){if(_0xeca1bb){return _0x90fff8['sendStatus'](_0x2e4248);}return _0x90fff8['status'](_0x2e4248)[_0x08c3('0x15')]();};}function respondWithResult(_0x439a55,_0x2992cf){_0x2992cf=_0x2992cf||0xc8;return function(_0x1659ff){if(_0x1659ff){return _0x439a55[_0x08c3('0x16')](_0x2992cf)[_0x08c3('0x17')](_0x1659ff);}};}function respondWithFilteredResult(_0x383444,_0x3d8b6e){return function(_0x1b2fc5){if(_0x1b2fc5){var _0xcbfc36=_0x1b2fc5[_0x08c3('0x18')],_0x155752=_0x3d8b6e[_0x08c3('0x19')],_0x49a877=_0x3d8b6e[_0x08c3('0x19')]+_0x3d8b6e[_0x08c3('0x1a')],_0x15c264;if(_0x49a877>=_0xcbfc36){_0x49a877=_0xcbfc36;_0x15c264=0xc8;}else{_0x15c264=0xce;}_0x383444[_0x08c3('0x16')](_0x15c264);return _0x383444[_0x08c3('0x1b')](_0x08c3('0x1c'),_0x155752+'-'+_0x49a877+'/'+_0xcbfc36)[_0x08c3('0x17')](_0x1b2fc5);}return null;};}function patchUpdates(_0x59002d){return function(_0x2a4b48){try{jsonpatch[_0x08c3('0x1d')](_0x2a4b48,_0x59002d,!![]);}catch(_0x337f0e){return BPromise[_0x08c3('0x1e')](_0x337f0e);}return _0x2a4b48['save']();};}function saveUpdates(_0x2d58,_0x7216c7){return function(_0x5d6bdb){if(_0x5d6bdb){return _0x5d6bdb[_0x08c3('0x1f')](_0x2d58)[_0x08c3('0x20')](function(_0x2d52cd){return _0x2d52cd;});}return null;};}function removeEntity(_0x17da9c,_0x2eaebc){return function(_0xc98f56){if(_0xc98f56){return _0xc98f56[_0x08c3('0x21')]()['then'](function(){_0x17da9c[_0x08c3('0x16')](0xcc)[_0x08c3('0x15')]();});}};}function handleEntityNotFound(_0x298e4e,_0x23886a){return function(_0x548bea){if(!_0x548bea){_0x298e4e['sendStatus'](0x194);}return _0x548bea;};}function handleError(_0x344894,_0x164535){_0x164535=_0x164535||0x1f4;return function(_0x560a68){logger[_0x08c3('0x22')](_0x560a68['stack']);if(_0x560a68[_0x08c3('0x23')]){delete _0x560a68['name'];}_0x344894[_0x08c3('0x16')](_0x164535)[_0x08c3('0x24')](_0x560a68);};}exports[_0x08c3('0x25')]=function(_0x1072e8,_0x16a6b1){var _0x1d4a9a={},_0x316540={},_0xe49def={'count':0x0,'rows':[]};return db[_0x08c3('0x26')][_0x08c3('0x27')]()[_0x08c3('0x20')](function(_0xd7ec0c){_0x316540[_0x08c3('0x28')]=_[_0x08c3('0x29')](_0xd7ec0c);var _0x20f81e={'dateStart':_0x1072e8['query'][_0x08c3('0x2a')],'dateEnd':_0x1072e8[_0x08c3('0x2b')][_0x08c3('0x2c')]};delete _0x1072e8[_0x08c3('0x2b')][_0x08c3('0x2a')];delete _0x1072e8['query'][_0x08c3('0x2c')];_0x316540['query']=_[_0x08c3('0x29')](_0x1072e8[_0x08c3('0x2b')]);_0x316540[_0x08c3('0x2d')]=_[_0x08c3('0x2e')](_0x316540[_0x08c3('0x28')],_0x316540['query']);_0x1d4a9a[_0x08c3('0x2f')]=_[_0x08c3('0x2e')](_0x316540[_0x08c3('0x28')],qs[_0x08c3('0x30')](_0x1072e8[_0x08c3('0x2b')]['fields']));_0x1d4a9a[_0x08c3('0x2f')]=_0x1d4a9a[_0x08c3('0x2f')][_0x08c3('0x31')]?_0x1d4a9a[_0x08c3('0x2f')]:_0x316540[_0x08c3('0x28')];if(!_0x1072e8[_0x08c3('0x2b')][_0x08c3('0x32')](_0x08c3('0x33'))){_0x1d4a9a[_0x08c3('0x1a')]=qs[_0x08c3('0x1a')](_0x1072e8['query'][_0x08c3('0x1a')]);_0x1d4a9a['offset']=qs[_0x08c3('0x19')](_0x1072e8[_0x08c3('0x2b')][_0x08c3('0x19')]);}_0x1d4a9a[_0x08c3('0x34')]=qs['sort'](_0x1072e8[_0x08c3('0x2b')][_0x08c3('0x35')]);_0x1d4a9a[_0x08c3('0x36')]=qs['filters'](_[_0x08c3('0x37')](_0x1072e8[_0x08c3('0x2b')],_0x316540[_0x08c3('0x2d')]));if(_0x20f81e[_0x08c3('0x2a')]){if(_0x20f81e[_0x08c3('0x2c')]){_0x20f81e[_0x08c3('0x2c')]=moment(_0x20f81e[_0x08c3('0x2c')])['add'](0x1,_0x08c3('0x38'));}else{_0x20f81e['dateEnd']=moment(_0x20f81e['dateStart'])['add'](0x1,_0x08c3('0x38'));}_[_0x08c3('0x39')](_0x1d4a9a['where'],{'createdAt':{'$gte':_0x20f81e[_0x08c3('0x2a')],'$lte':_0x20f81e['dateEnd']}});}if(_0x1072e8[_0x08c3('0x2b')][_0x08c3('0x3a')]){_0x1d4a9a['where']=_[_0x08c3('0x39')](_0x1d4a9a[_0x08c3('0x36')],{'$or':_[_0x08c3('0x3b')](_0x1d4a9a['attributes'],function(_0x274dd1){var _0x318e54={};_0x318e54[_0x274dd1]={'$like':'%'+_0x1072e8[_0x08c3('0x2b')][_0x08c3('0x3a')]+'%'};return _0x318e54;})});}_0x1d4a9a=_[_0x08c3('0x39')]({},_0x1d4a9a,_0x1072e8[_0x08c3('0x3c')]);var _0x3c9a5c={'where':_0x1d4a9a['where']};_0x3c9a5c['include']=[];if(_0x1072e8[_0x08c3('0x2b')][_0x08c3('0x3d')]){_0x3c9a5c['include'][_0x08c3('0x3e')]({'model':db[_0x08c3('0x3f')],'as':_0x08c3('0x40'),'attributes':['id'],'where':{'id':_0x1072e8[_0x08c3('0x2b')]['tag']},'required':!![]});_0x3c9a5c[_0x08c3('0x41')]=!![];}return db[_0x08c3('0x26')][_0x08c3('0x18')](_0x3c9a5c)['then'](function(_0x5695f8){_0xe49def[_0x08c3('0x18')]=_0x5695f8;if(_0x1072e8[_0x08c3('0x2b')][_0x08c3('0x42')]){_0x1d4a9a[_0x08c3('0x43')]=[{'model':db[_0x08c3('0x3f')],'as':_0x08c3('0x40'),'attributes':['id',_0x08c3('0x23'),_0x08c3('0x44')],'required':_0x1072e8[_0x08c3('0x2b')]['tag']?!![]:![]},{'model':db[_0x08c3('0x3f')],'as':_0x08c3('0x45'),'attributes':['id','name',_0x08c3('0x44')],'through':_0x1072e8[_0x08c3('0x2b')][_0x08c3('0x3d')]?{'attributes':[],'where':{'TagId':_0x1072e8[_0x08c3('0x2b')][_0x08c3('0x3d')]||undefined}}:{},'required':_0x1072e8['query'][_0x08c3('0x3d')]?!![]:![]}];}return db[_0x08c3('0x26')][_0x08c3('0x46')](_0x1d4a9a);})[_0x08c3('0x20')](function(_0x131006){_0xe49def[_0x08c3('0x47')]=_0x131006;return _0xe49def;})[_0x08c3('0x20')](respondWithFilteredResult(_0x16a6b1,_0x1d4a9a))[_0x08c3('0x48')](handleError(_0x16a6b1,null));});};exports[_0x08c3('0x21')]=function(_0x3d3b3c,_0x1c8cd1){return db['CmContact'][_0x08c3('0x49')]({'where':{'id':_0x3d3b3c['params']['id']}})['then'](handleEntityNotFound(_0x1c8cd1,null))[_0x08c3('0x20')](removeEntity(_0x1c8cd1,null))[_0x08c3('0x48')](handleError(_0x1c8cd1,null));};exports['describe']=function(_0x51647f,_0x2f2f3d){return db[_0x08c3('0x26')][_0x08c3('0x27')]()[_0x08c3('0x20')](respondWithResult(_0x2f2f3d,null))[_0x08c3('0x48')](handleError(_0x2f2f3d,null));};exports[_0x08c3('0x39')]=function(_0x52ed8a,_0x2d43){var _0x617eac;var _0x1ea236;var _0x285444;if(_0x52ed8a['body']['id']){delete _0x52ed8a[_0x08c3('0x4a')]['id'];}return db[_0x08c3('0x26')][_0x08c3('0x46')]({'where':{'id':[_0x52ed8a[_0x08c3('0x4a')]['to'],_0x52ed8a[_0x08c3('0x4a')]['from']]}})[_0x08c3('0x20')](function(_0xae1803){if(_0xae1803){if(_0xae1803[_0x08c3('0x31')]!==0x2){return null;}_0xae1803[0x0]=_0xae1803[0x0][_0x08c3('0x4b')]({'plain':!![]});_0xae1803[0x1]=_0xae1803[0x1][_0x08c3('0x4b')]({'plain':!![]});delete _0xae1803[0x0]['id'];delete _0xae1803[0x1]['id'];return _[_0x08c3('0x4c')](_0xae1803[0x0],_0xae1803[0x1],function(_0x40a559,_0x597e68){if(Array[_0x08c3('0x4d')](_0x597e68)&&!_0x597e68[_0x08c3('0x31')]){return _0x40a559;}else if(!_0x597e68){return _0x40a559;}});}})[_0x08c3('0x20')](handleEntityNotFound(_0x2d43,null))['then'](function(_0x2e7a8a){if(_0x2e7a8a){if(_0x2e7a8a[_0x08c3('0x4e')]&&_['isArray'](_0x2e7a8a[_0x08c3('0x4e')])){_0x2e7a8a[_0x08c3('0x4e')]=_0x2e7a8a[_0x08c3('0x4e')]['join']();}logger[_0x08c3('0x4f')]('[CmContact][merge]\x20to\x20%s\x20from\x20%s',_0x52ed8a[_0x08c3('0x4a')]['to'],_0x52ed8a[_0x08c3('0x4a')]['from']);return db[_0x08c3('0x50')][_0x08c3('0x21')]({'where':{'ContactId':[_0x52ed8a['body']['to'],_0x52ed8a[_0x08c3('0x4a')][_0x08c3('0x51')]]}})['then'](function(_0x21c678){logger[_0x08c3('0x4f')](_0x08c3('0x52'),_0x21c678);return db[_0x08c3('0x53')][_0x08c3('0x21')]({'where':{'ContactId':[_0x52ed8a[_0x08c3('0x4a')]['to'],_0x52ed8a[_0x08c3('0x4a')][_0x08c3('0x51')]]}})[_0x08c3('0x20')](function(_0x51bfa0){logger[_0x08c3('0x4f')](_0x08c3('0x54'),_0x51bfa0);return db[_0x08c3('0x26')][_0x08c3('0x55')](_0x2e7a8a);});});}})[_0x08c3('0x20')](function(_0x20ee7a){if(_0x20ee7a){_0x617eac=_0x20ee7a;_0x1ea236={'ContactId':_0x617eac['id']};_0x285444={'where':{'ContactId':[_0x52ed8a[_0x08c3('0x4a')]['to'],_0x52ed8a[_0x08c3('0x4a')][_0x08c3('0x51')]]}};return db[_0x08c3('0x56')][_0x08c3('0x1f')](_0x1ea236,_0x285444);}})[_0x08c3('0x20')](function(){if(_0x617eac){return db[_0x08c3('0x57')][_0x08c3('0x1f')](_0x1ea236,_0x285444);}})[_0x08c3('0x20')](function(){if(_0x617eac){return db['ChatOfflineMessage'][_0x08c3('0x1f')](_0x1ea236,_0x285444);}})['then'](function(){if(_0x617eac){return db[_0x08c3('0x58')][_0x08c3('0x1f')](_0x1ea236,_0x285444);}})[_0x08c3('0x20')](function(){if(_0x617eac){return db['MailMessage'][_0x08c3('0x1f')](_0x1ea236,_0x285444);}})[_0x08c3('0x20')](function(){if(_0x617eac){return db[_0x08c3('0x58')]['update'](_0x1ea236,_0x285444);}})[_0x08c3('0x20')](function(){if(_0x617eac){return db[_0x08c3('0x59')][_0x08c3('0x1f')](_0x1ea236,_0x285444);}})[_0x08c3('0x20')](function(){if(_0x617eac){return db['SmsInteraction'][_0x08c3('0x1f')](_0x1ea236,_0x285444);}})[_0x08c3('0x20')](function(){if(_0x617eac){return db[_0x08c3('0x5a')][_0x08c3('0x1f')](_0x1ea236,_0x285444);}})['then'](function(){if(_0x617eac){return db['FaxInteraction'][_0x08c3('0x1f')](_0x1ea236,_0x285444);}})[_0x08c3('0x20')](function(){if(_0x617eac){return db[_0x08c3('0x5b')][_0x08c3('0x1f')](_0x1ea236,_0x285444);}})[_0x08c3('0x20')](function(){if(_0x617eac){return db[_0x08c3('0x5c')]['update'](_0x1ea236,_0x285444);}})[_0x08c3('0x20')](function(){if(_0x617eac){return db[_0x08c3('0x5d')][_0x08c3('0x1f')](_0x1ea236,_0x285444);}})[_0x08c3('0x20')](function(){if(_0x617eac){return db['CmHopperFinal'][_0x08c3('0x1f')](_0x1ea236,_0x285444);}})[_0x08c3('0x20')](function(){if(_0x617eac){return db[_0x08c3('0x5e')][_0x08c3('0x1f')](_0x1ea236,_0x285444);}})['then'](function(){if(_0x617eac){return db[_0x08c3('0x5f')][_0x08c3('0x1f')](_0x1ea236,_0x285444);}})[_0x08c3('0x20')](function(){if(_0x617eac){return db[_0x08c3('0x60')][_0x08c3('0x1f')](_0x1ea236,_0x285444);}})[_0x08c3('0x20')](function(){if(_0x617eac){return db[_0x08c3('0x61')][_0x08c3('0x1f')](_0x1ea236,_0x285444);}})[_0x08c3('0x20')](function(){if(_0x617eac){return db['FaxQueueReport'][_0x08c3('0x1f')](_0x1ea236,_0x285444);}})[_0x08c3('0x20')](function(){if(_0x617eac){return db[_0x08c3('0x62')]['update'](_0x1ea236,_0x285444);}})[_0x08c3('0x20')](function(){if(_0x617eac){return db[_0x08c3('0x63')][_0x08c3('0x1f')](_0x1ea236,_0x285444);}})[_0x08c3('0x20')](function(){if(_0x617eac){return db[_0x08c3('0x64')][_0x08c3('0x1f')](_0x1ea236,_0x285444);}})[_0x08c3('0x20')](function(){if(_0x617eac){return db['JscriptySessionReport']['update'](_0x1ea236,_0x285444);}})[_0x08c3('0x20')](function(){if(_0x617eac){return db[_0x08c3('0x26')][_0x08c3('0x21')]({'where':{'id':[_0x52ed8a['body']['to'],_0x52ed8a['body'][_0x08c3('0x51')]]}});}})[_0x08c3('0x20')](function(){if(_0x617eac){return _0x617eac;}})[_0x08c3('0x20')](respondWithResult(_0x2d43,null))[_0x08c3('0x48')](handleError(_0x2d43,null));};exports['create']=function(_0xd530b0,_0x17884c){return db[_0x08c3('0x26')][_0x08c3('0x27')]()[_0x08c3('0x20')](function(_0x4badc){if(_0xd530b0['body'][_0x08c3('0x4e')]&&_[_0x08c3('0x4d')](_0xd530b0['body'][_0x08c3('0x4e')])){if(_0xd530b0['body'][_0x08c3('0x4e')][_0x08c3('0x31')]){_0xd530b0[_0x08c3('0x4a')][_0x08c3('0x4e')]=_0xd530b0[_0x08c3('0x4a')][_0x08c3('0x4e')][_0x08c3('0x65')](';')+';';}else{_0xd530b0[_0x08c3('0x4a')][_0x08c3('0x4e')]=null;}}else{_0xd530b0[_0x08c3('0x4a')][_0x08c3('0x4e')]=null;}return db['CmContact']['create'](_0xd530b0['body'],{'fields':_[_0x08c3('0x29')](_0x4badc),'raw':!![]});})[_0x08c3('0x20')](respondWithResult(_0x17884c,0xc9))['catch'](handleError(_0x17884c,null));};exports['bulkCreate']=function(_0x33a92e,_0x31d491){var _0x57463c=[];var _0x9f54b6=0x0;var _0x3fa5b6=0x0;var _0x21d748=0x0;return db[_0x08c3('0x26')][_0x08c3('0x27')]()[_0x08c3('0x20')](function(_0x805342){return BPromise['each'](_0x33a92e[_0x08c3('0x4a')],function(_0x4295c6){var _0x2e91af={'where':{'$or':[]},'defaults':_0x4295c6,'fields':_[_0x08c3('0x29')](_0x805342),'raw':!![]};if(_0x4295c6[_0x08c3('0x66')]){for(var _0x1a7157=0x0;_0x1a7157<_0x4295c6[_0x08c3('0x66')][_0x08c3('0x31')];_0x1a7157++){var _0x167858={};_0x167858[_0x4295c6[_0x08c3('0x66')][_0x1a7157]]=_0x4295c6[_0x4295c6[_0x08c3('0x66')][_0x1a7157]];_0x2e91af[_0x08c3('0x36')][_0x08c3('0x67')][_0x08c3('0x3e')](_0x167858);}_0x2e91af[_0x08c3('0x36')][_0x08c3('0x68')]=_0x4295c6[_0x08c3('0x68')];}return db[_0x08c3('0x26')]['findOrCreate'](_0x2e91af)[_0x08c3('0x69')](function(_0x1105b4,_0x3a5f21){if(_0x3a5f21){_0x9f54b6++;}else{_0x21d748++;}})[_0x08c3('0x48')](function(_0x4ee8e7){console[_0x08c3('0x22')](_0x4ee8e7);_0x3fa5b6++;});});})[_0x08c3('0x20')](function(_0x143c55){if(_0x143c55){return{'success':_0x9f54b6,'failure':_0x3fa5b6,'duplicates':_0x21d748};}})['then'](respondWithResult(_0x31d491,0xc9))[_0x08c3('0x48')](handleError(_0x31d491,null));};exports[_0x08c3('0x6a')]=function(_0x16bb8b,_0x37a2de,_0x285677){var _0xac458a;return db[_0x08c3('0x26')]['describe']()[_0x08c3('0x20')](function(_0x3fe950){return db['CmContact'][_0x08c3('0x49')]({'where':{'id':_0x16bb8b[_0x08c3('0x6b')]['id']},'include':[{'model':db[_0x08c3('0x3f')],'as':_0x08c3('0x40'),'attributes':['id',_0x08c3('0x23'),_0x08c3('0x44')],'required':_0x16bb8b[_0x08c3('0x2b')][_0x08c3('0x3d')]?!![]:![]}],'attributes':_[_0x08c3('0x29')](_0x3fe950)});})[_0x08c3('0x20')](function(_0x11204d){_0xac458a=_0x11204d['get']({'plain':!![]});var _0x5f6652={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x11204d&&_0x11204d[_0x08c3('0x68')]){if(_0x11204d[_0x08c3('0x68')]){_0x5f6652[_0x08c3('0x36')][_0x08c3('0x6c')][_0x08c3('0x3e')]({'ListId':{'$ne':_0x11204d[_0x08c3('0x68')]}});}}return db[_0x08c3('0x6d')][_0x08c3('0x46')](_0x5f6652);})['then'](function(_0x41c0ca){return _[_0x08c3('0x6e')](_0xac458a,_['map'](_0x41c0ca,function(_0x39e1b4){return util['format']('cf_%d',_0x39e1b4['id']);}));})[_0x08c3('0x20')](handleEntityNotFound(_0x37a2de,null))[_0x08c3('0x20')](respondWithResult(_0x37a2de,null))[_0x08c3('0x48')](handleError(_0x37a2de,null));};exports[_0x08c3('0x1f')]=function(_0x4ce04c,_0x217a4c){var _0x24adcd;if(_0x4ce04c['body']['id']){delete _0x4ce04c[_0x08c3('0x4a')]['id'];}return db[_0x08c3('0x26')][_0x08c3('0x49')]({'where':{'id':_0x4ce04c['params']['id']}})['then'](handleEntityNotFound(_0x217a4c,null))[_0x08c3('0x20')](saveUpdates(_0x4ce04c[_0x08c3('0x4a')],null))[_0x08c3('0x20')](function(_0x2ba0b6){_0x24adcd=_0x2ba0b6;var _0x19767f={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2ba0b6&&_0x2ba0b6['ListId']){if(_0x2ba0b6[_0x08c3('0x68')]){_0x19767f[_0x08c3('0x36')]['$and'][_0x08c3('0x3e')]({'ListId':{'$ne':_0x2ba0b6[_0x08c3('0x68')]}});}}return db[_0x08c3('0x6d')][_0x08c3('0x46')](_0x19767f);})[_0x08c3('0x20')](function(_0x11432){if(_0x11432){return _[_0x08c3('0x6e')](_[_0x08c3('0x6f')](_0x4ce04c[_0x08c3('0x4a')],function(_0x23821d,_0x610749){return _[_0x08c3('0x70')](_0x610749,_0x08c3('0x71'));}),_[_0x08c3('0x3b')](_0x11432,function(_0x934548){return util[_0x08c3('0x72')](_0x08c3('0x73'),_0x934548['id']);}));}})[_0x08c3('0x20')](function(_0x171d9d){if(_0x171d9d&&!_[_0x08c3('0x74')](_0x171d9d)){var _0x4e7629=squel[_0x08c3('0x1f')]()[_0x08c3('0x75')](_0x08c3('0x76'))[_0x08c3('0x77')](_0x171d9d)[_0x08c3('0x36')]('id\x20=\x20?',_0x4ce04c[_0x08c3('0x6b')]['id'])[_0x08c3('0x78')]();return db['sequelize'][_0x08c3('0x2b')](_0x4e7629[_0x08c3('0x79')],{'replacements':_0x4e7629[_0x08c3('0x7a')]});}})['then'](function(){if(_0x4ce04c[_0x08c3('0x4a')][_0x08c3('0x7b')]&&_0x24adcd){return db[_0x08c3('0x50')][_0x08c3('0x1f')]({'phone':_0x4ce04c[_0x08c3('0x4a')][_0x08c3('0x7b')]},{'where':{'ContactId':_0x24adcd['id']}});}})[_0x08c3('0x20')](function(){return _0x24adcd;})[_0x08c3('0x20')](respondWithResult(_0x217a4c,null))['catch'](handleError(_0x217a4c,null));};exports[_0x08c3('0x7c')]=function(_0x26c27a,_0x217a40,_0x1f8853){var _0x203f9e={};var _0x5c468d={};var _0x1c77e3;var _0x5c5a8b;return db[_0x08c3('0x26')][_0x08c3('0x7d')]({'where':{'id':_0x26c27a['params']['id']}})[_0x08c3('0x20')](handleEntityNotFound(_0x217a40,null))[_0x08c3('0x20')](function(_0x28c236){if(_0x28c236){_0x1c77e3=_0x28c236;_0x5c468d[_0x08c3('0x28')]=_[_0x08c3('0x29')](db[_0x08c3('0x3f')][_0x08c3('0x7e')]);_0x5c468d[_0x08c3('0x2b')]=_[_0x08c3('0x29')](_0x26c27a[_0x08c3('0x2b')]);_0x5c468d[_0x08c3('0x2d')]=_['intersection'](_0x5c468d[_0x08c3('0x28')],_0x5c468d[_0x08c3('0x2b')]);_0x203f9e[_0x08c3('0x2f')]=_[_0x08c3('0x2e')](_0x5c468d[_0x08c3('0x28')],qs['fields'](_0x26c27a[_0x08c3('0x2b')][_0x08c3('0x30')]));_0x203f9e[_0x08c3('0x2f')]=_0x203f9e[_0x08c3('0x2f')][_0x08c3('0x31')]?_0x203f9e['attributes']:_0x5c468d['model'];_0x203f9e[_0x08c3('0x34')]=qs['sort'](_0x26c27a[_0x08c3('0x2b')][_0x08c3('0x35')]);_0x203f9e[_0x08c3('0x36')]=qs[_0x08c3('0x2d')](_['pick'](_0x26c27a[_0x08c3('0x2b')],_0x5c468d[_0x08c3('0x2d')]));if(_0x26c27a[_0x08c3('0x2b')][_0x08c3('0x3a')]){_0x203f9e['where']=_[_0x08c3('0x39')](_0x203f9e[_0x08c3('0x36')],{'$or':_[_0x08c3('0x3b')](_0x203f9e[_0x08c3('0x2f')],function(_0x22f77c){var _0x45b31c={};_0x45b31c[_0x22f77c]={'$like':'%'+_0x26c27a[_0x08c3('0x2b')][_0x08c3('0x3a')]+'%'};return _0x45b31c;})});}_0x203f9e=_[_0x08c3('0x39')]({},_0x203f9e,_0x26c27a[_0x08c3('0x3c')]);return _0x1c77e3[_0x08c3('0x7c')](_0x203f9e);}})[_0x08c3('0x20')](function(_0x4512d7){if(_0x4512d7){_0x5c5a8b=_0x4512d7[_0x08c3('0x31')];if(!_0x26c27a[_0x08c3('0x2b')][_0x08c3('0x32')](_0x08c3('0x33'))){_0x203f9e[_0x08c3('0x1a')]=qs['limit'](_0x26c27a[_0x08c3('0x2b')][_0x08c3('0x1a')]);_0x203f9e['offset']=qs[_0x08c3('0x19')](_0x26c27a[_0x08c3('0x2b')][_0x08c3('0x19')]);}return _0x1c77e3[_0x08c3('0x7c')](_0x203f9e);}})[_0x08c3('0x20')](function(_0x53f95f){if(_0x53f95f){return _0x53f95f?{'count':_0x5c5a8b,'rows':_0x53f95f}:null;}})[_0x08c3('0x20')](respondWithResult(_0x217a40,null))[_0x08c3('0x48')](handleError(_0x217a40,null));};exports['setTags']=function(_0x5e800b,_0x47d625,_0x3b93c8){if(_0x5e800b['body']['id']){delete _0x5e800b[_0x08c3('0x4a')]['id'];}return db['CmContact']['findOne']({'where':{'id':_0x5e800b['params']['id']}})['then'](handleEntityNotFound(_0x47d625,null))[_0x08c3('0x20')](function(_0x31eae5){if(_0x31eae5){return _0x31eae5[_0x08c3('0x7f')](_0x5e800b[_0x08c3('0x4a')][_0x08c3('0x80')]||[]);}return null;})[_0x08c3('0x20')](respondWithResult(_0x47d625,null))[_0x08c3('0x48')](handleError(_0x47d625,null));};exports[_0x08c3('0x81')]=function(_0x2cfded,_0x5be02c,_0x3c2568){var _0x493402={'raw':![],'where':{}};var _0x26b1eb={};var _0x5ceb85={'count':0x0,'rows':[]};return db[_0x08c3('0x26')][_0x08c3('0x7d')]({'where':{'id':_0x2cfded[_0x08c3('0x6b')]['id']}})[_0x08c3('0x20')](handleEntityNotFound(_0x5be02c,null))[_0x08c3('0x20')](function(_0x344623){if(_0x344623){_0x26b1eb[_0x08c3('0x28')]=_['keys'](db[_0x08c3('0x50')]['rawAttributes']);_0x26b1eb[_0x08c3('0x2b')]=_[_0x08c3('0x29')](_0x2cfded[_0x08c3('0x2b')]);_0x26b1eb['filters']=_[_0x08c3('0x2e')](_0x26b1eb['model'],_0x26b1eb[_0x08c3('0x2b')]);_0x493402[_0x08c3('0x2f')]=_[_0x08c3('0x2e')](_0x26b1eb[_0x08c3('0x28')],qs[_0x08c3('0x30')](_0x2cfded[_0x08c3('0x2b')][_0x08c3('0x30')]));_0x493402[_0x08c3('0x2f')]=_0x493402[_0x08c3('0x2f')][_0x08c3('0x31')]?_0x493402['attributes']:_0x26b1eb[_0x08c3('0x28')];if(!_0x2cfded[_0x08c3('0x2b')][_0x08c3('0x32')](_0x08c3('0x33'))){_0x493402[_0x08c3('0x1a')]=qs[_0x08c3('0x1a')](_0x2cfded['query'][_0x08c3('0x1a')]);_0x493402[_0x08c3('0x19')]=qs[_0x08c3('0x19')](_0x2cfded[_0x08c3('0x2b')]['offset']);}_0x493402[_0x08c3('0x34')]=qs[_0x08c3('0x35')](_0x2cfded[_0x08c3('0x2b')][_0x08c3('0x35')]);_0x493402[_0x08c3('0x36')]=qs[_0x08c3('0x2d')](_[_0x08c3('0x37')](_0x2cfded[_0x08c3('0x2b')],_0x26b1eb[_0x08c3('0x2d')]));_0x493402[_0x08c3('0x36')][_0x08c3('0x82')]=_0x344623['id'];if(_0x2cfded[_0x08c3('0x2b')][_0x08c3('0x3a')]){_0x493402[_0x08c3('0x36')]=_[_0x08c3('0x39')](_0x493402[_0x08c3('0x36')],{'$or':_['map'](_0x493402['attributes'],function(_0x51917c){var _0x3a82fe={};_0x3a82fe[_0x51917c]={'$like':'%'+_0x2cfded[_0x08c3('0x2b')][_0x08c3('0x3a')]+'%'};return _0x3a82fe;})});}_0x493402=_[_0x08c3('0x39')]({},_0x493402,_0x2cfded[_0x08c3('0x3c')]);return db[_0x08c3('0x50')][_0x08c3('0x18')]({'where':_0x493402[_0x08c3('0x36')]})['then'](function(_0x5a0c5b){_0x5ceb85[_0x08c3('0x18')]=_0x5a0c5b;if(_0x2cfded[_0x08c3('0x2b')]['includeAll']){_0x493402['include']=[{'all':!![]}];}return db[_0x08c3('0x50')][_0x08c3('0x46')](_0x493402);})['then'](function(_0x2954b0){_0x5ceb85[_0x08c3('0x47')]=_0x2954b0;return _0x5ceb85;});}})[_0x08c3('0x20')](respondWithFilteredResult(_0x5be02c,_0x493402))[_0x08c3('0x48')](handleError(_0x5be02c,null));};exports[_0x08c3('0x83')]=function(_0xaf8c4b,_0xa4e008,_0x41ad6d){var _0x28da15={'raw':!![],'where':{}};var _0x4b2df3={};var _0x177405={'count':0x0,'rows':[]};return db[_0x08c3('0x26')][_0x08c3('0x7d')]({'where':{'id':_0xaf8c4b[_0x08c3('0x6b')]['id']}})[_0x08c3('0x20')](handleEntityNotFound(_0xa4e008,null))[_0x08c3('0x20')](function(_0x5b21b4){if(_0x5b21b4){_0x4b2df3[_0x08c3('0x28')]=_[_0x08c3('0x29')](db[_0x08c3('0x5e')]['rawAttributes']);_0x4b2df3['query']=_[_0x08c3('0x29')](_0xaf8c4b[_0x08c3('0x2b')]);_0x4b2df3[_0x08c3('0x2d')]=_['intersection'](_0x4b2df3[_0x08c3('0x28')],_0x4b2df3['query']);_0x28da15[_0x08c3('0x2f')]=_[_0x08c3('0x2e')](_0x4b2df3[_0x08c3('0x28')],qs['fields'](_0xaf8c4b[_0x08c3('0x2b')][_0x08c3('0x30')]));_0x28da15[_0x08c3('0x2f')]=_0x28da15[_0x08c3('0x2f')]['length']?_0x28da15[_0x08c3('0x2f')]:_0x4b2df3['model'];if(!_0xaf8c4b[_0x08c3('0x2b')][_0x08c3('0x32')](_0x08c3('0x33'))){_0x28da15['limit']=qs['limit'](_0xaf8c4b[_0x08c3('0x2b')][_0x08c3('0x1a')]);_0x28da15['offset']=qs[_0x08c3('0x19')](_0xaf8c4b[_0x08c3('0x2b')][_0x08c3('0x19')]);}_0x28da15[_0x08c3('0x34')]=qs[_0x08c3('0x35')](_0xaf8c4b['query'][_0x08c3('0x35')]);_0x28da15[_0x08c3('0x36')]=qs[_0x08c3('0x2d')](_['pick'](_0xaf8c4b['query'],_0x4b2df3[_0x08c3('0x2d')]));_0x28da15[_0x08c3('0x36')][_0x08c3('0x82')]=_0x5b21b4['id'];if(_0xaf8c4b[_0x08c3('0x2b')][_0x08c3('0x3a')]){_0x28da15[_0x08c3('0x36')]=_[_0x08c3('0x39')](_0x28da15[_0x08c3('0x36')],{'$or':_[_0x08c3('0x3b')](_0x28da15[_0x08c3('0x2f')],function(_0x2a8598){var _0x1ee6f6={};_0x1ee6f6[_0x2a8598]={'$like':'%'+_0xaf8c4b[_0x08c3('0x2b')][_0x08c3('0x3a')]+'%'};return _0x1ee6f6;})});}_0x28da15=_[_0x08c3('0x39')]({},_0x28da15,_0xaf8c4b[_0x08c3('0x3c')]);return db['CmHopperHistory']['count']({'where':_0x28da15[_0x08c3('0x36')]})['then'](function(_0x44b702){_0x177405[_0x08c3('0x18')]=_0x44b702;if(_0xaf8c4b[_0x08c3('0x2b')][_0x08c3('0x42')]){_0x28da15[_0x08c3('0x43')]=[{'all':!![]}];}return db[_0x08c3('0x5e')]['findAll'](_0x28da15);})[_0x08c3('0x20')](function(_0x2ada7e){_0x177405['rows']=_0x2ada7e;return _0x177405;});}})['then'](respondWithFilteredResult(_0xa4e008,_0x28da15))[_0x08c3('0x48')](handleError(_0xa4e008,null));};exports[_0x08c3('0x84')]=function(_0x5f55ef,_0x42aba5,_0x1f1656){var _0x4de519={'raw':!![],'where':{}};var _0xdfd12c={};var _0x42d50a={'count':0x0,'rows':[]};return db[_0x08c3('0x26')][_0x08c3('0x7d')]({'where':{'id':_0x5f55ef[_0x08c3('0x6b')]['id']}})[_0x08c3('0x20')](handleEntityNotFound(_0x42aba5,null))[_0x08c3('0x20')](function(_0xc1c682){if(_0xc1c682){_0xdfd12c[_0x08c3('0x28')]=_['keys'](db[_0x08c3('0x85')][_0x08c3('0x7e')]);_0xdfd12c[_0x08c3('0x2b')]=_[_0x08c3('0x29')](_0x5f55ef[_0x08c3('0x2b')]);_0xdfd12c[_0x08c3('0x2d')]=_[_0x08c3('0x2e')](_0xdfd12c[_0x08c3('0x28')],_0xdfd12c[_0x08c3('0x2b')]);_0x4de519[_0x08c3('0x2f')]=_[_0x08c3('0x2e')](_0xdfd12c[_0x08c3('0x28')],qs['fields'](_0x5f55ef['query'][_0x08c3('0x30')]));_0x4de519[_0x08c3('0x2f')]=_0x4de519[_0x08c3('0x2f')][_0x08c3('0x31')]?_0x4de519[_0x08c3('0x2f')]:_0xdfd12c[_0x08c3('0x28')];if(!_0x5f55ef[_0x08c3('0x2b')][_0x08c3('0x32')](_0x08c3('0x33'))){_0x4de519[_0x08c3('0x1a')]=qs[_0x08c3('0x1a')](_0x5f55ef['query'][_0x08c3('0x1a')]);_0x4de519[_0x08c3('0x19')]=qs[_0x08c3('0x19')](_0x5f55ef[_0x08c3('0x2b')][_0x08c3('0x19')]);}_0x4de519[_0x08c3('0x34')]=qs[_0x08c3('0x35')](_0x5f55ef['query'][_0x08c3('0x35')]);_0x4de519[_0x08c3('0x36')]=qs['filters'](_['pick'](_0x5f55ef['query'],_0xdfd12c['filters']));_0x4de519[_0x08c3('0x36')]['ContactId']=_0xc1c682['id'];if(_0x5f55ef[_0x08c3('0x2b')][_0x08c3('0x3a')]){_0x4de519[_0x08c3('0x36')]=_[_0x08c3('0x39')](_0x4de519[_0x08c3('0x36')],{'$or':_[_0x08c3('0x3b')](_0x4de519['attributes'],function(_0x5da579){var _0x30e850={};_0x30e850[_0x5da579]={'$like':'%'+_0x5f55ef[_0x08c3('0x2b')]['filter']+'%'};return _0x30e850;})});}_0x4de519=_[_0x08c3('0x39')]({},_0x4de519,_0x5f55ef[_0x08c3('0x3c')]);return db['CmHopperFinal'][_0x08c3('0x18')]({'where':_0x4de519[_0x08c3('0x36')]})[_0x08c3('0x20')](function(_0x2661b4){_0x42d50a[_0x08c3('0x18')]=_0x2661b4;if(_0x5f55ef[_0x08c3('0x2b')][_0x08c3('0x42')]){_0x4de519['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x4de519);})['then'](function(_0x56248){_0x42d50a[_0x08c3('0x47')]=_0x56248;return _0x42d50a;});}})['then'](respondWithFilteredResult(_0x42aba5,_0x4de519))['catch'](handleError(_0x42aba5,null));};exports[_0x08c3('0x86')]=function(_0x192853,_0x57f841,_0x17a24c){var _0x46746f={'raw':!![],'where':{}};var _0x5a64ee={};var _0x587ac5={'count':0x0,'rows':[]};return db['CmContact'][_0x08c3('0x7d')]({'where':{'id':_0x192853[_0x08c3('0x6b')]['id']}})[_0x08c3('0x20')](handleEntityNotFound(_0x57f841,null))[_0x08c3('0x20')](function(_0x77e67c){if(_0x77e67c){_0x5a64ee['model']=_[_0x08c3('0x29')](db[_0x08c3('0x87')]['rawAttributes']);_0x5a64ee['query']=_[_0x08c3('0x29')](_0x192853[_0x08c3('0x2b')]);_0x5a64ee[_0x08c3('0x2d')]=_[_0x08c3('0x2e')](_0x5a64ee[_0x08c3('0x28')],_0x5a64ee[_0x08c3('0x2b')]);_0x46746f[_0x08c3('0x2f')]=_[_0x08c3('0x2e')](_0x5a64ee[_0x08c3('0x28')],qs[_0x08c3('0x30')](_0x192853['query'][_0x08c3('0x30')]));_0x46746f[_0x08c3('0x2f')]=_0x46746f[_0x08c3('0x2f')][_0x08c3('0x31')]?_0x46746f[_0x08c3('0x2f')]:_0x5a64ee[_0x08c3('0x28')];if(!_0x192853[_0x08c3('0x2b')][_0x08c3('0x32')](_0x08c3('0x33'))){_0x46746f[_0x08c3('0x1a')]=qs['limit'](_0x192853[_0x08c3('0x2b')][_0x08c3('0x1a')]);_0x46746f['offset']=qs[_0x08c3('0x19')](_0x192853[_0x08c3('0x2b')]['offset']);}_0x46746f[_0x08c3('0x34')]=qs['sort'](_0x192853[_0x08c3('0x2b')][_0x08c3('0x35')]);_0x46746f['where']=qs[_0x08c3('0x2d')](_[_0x08c3('0x37')](_0x192853[_0x08c3('0x2b')],_0x5a64ee[_0x08c3('0x2d')]));_0x46746f[_0x08c3('0x36')]['ContactId']=_0x77e67c['id'];if(_0x192853[_0x08c3('0x2b')]['filter']){_0x46746f[_0x08c3('0x36')]=_['merge'](_0x46746f['where'],{'$or':_[_0x08c3('0x3b')](_0x46746f[_0x08c3('0x2f')],function(_0x18bb68){var _0x4350f9={};_0x4350f9[_0x18bb68]={'$like':'%'+_0x192853[_0x08c3('0x2b')]['filter']+'%'};return _0x4350f9;})});}_0x46746f=_[_0x08c3('0x39')]({},_0x46746f,_0x192853[_0x08c3('0x3c')]);return db[_0x08c3('0x87')][_0x08c3('0x18')]({'where':_0x46746f[_0x08c3('0x36')]})[_0x08c3('0x20')](function(_0x1ce575){_0x587ac5[_0x08c3('0x18')]=_0x1ce575;if(_0x192853[_0x08c3('0x2b')][_0x08c3('0x42')]){_0x46746f[_0x08c3('0x43')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x08c3('0x46')](_0x46746f);})['then'](function(_0x2e0e5d){_0x587ac5[_0x08c3('0x47')]=_0x2e0e5d;return _0x587ac5;});}})[_0x08c3('0x20')](respondWithFilteredResult(_0x57f841,_0x46746f))[_0x08c3('0x48')](handleError(_0x57f841,null));};exports['uploadCsv']=function(_0x6d4de9,_0x4aacf2,_0x3bddc1){try{if(!_0x6d4de9[_0x08c3('0x4a')][_0x08c3('0x68')]){throw new Error(_0x08c3('0x88'));}if(!_0x6d4de9[_0x08c3('0x4a')]['binding_keys']){throw new Error(_0x08c3('0x89'));}if(!_0x6d4de9['body'][_0x08c3('0x8a')]){throw new Error(_0x08c3('0x8b'));}if(!_0x6d4de9[_0x08c3('0x4a')][_0x08c3('0x8c')]){throw new Error(_0x08c3('0x8d'));}var _0x3ccbcc=_0x6d4de9[_0x08c3('0x4a')][_0x08c3('0x8e')][_0x08c3('0x8f')](',');var _0x2d12e2=_0x6d4de9[_0x08c3('0x4a')][_0x08c3('0x8a')]['split'](',');if(!_0x3ccbcc[_0x08c3('0x31')]||!_0x2d12e2['length']||_0x3ccbcc[_0x08c3('0x31')]!==_0x2d12e2['length']){throw new Error(_0x08c3('0x90'));}_0x6d4de9[_0x08c3('0x4a')][_0x08c3('0x30')]=_['zipObject'](_0x3ccbcc,_0x2d12e2);if(!_0x6d4de9[_0x08c3('0x4a')][_0x08c3('0x30')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x6d4de9['body'][_0x08c3('0x30')]['firstName']){throw new Error(_0x08c3('0x91'));}var _0x3083ec=path[_0x08c3('0x65')](config[_0x08c3('0x92')],'server/files/tmp',_0x6d4de9['file'][_0x08c3('0x93')]);fs['chmodSync'](_0x3083ec,parseInt(_0x08c3('0x94'),0x8));var _0x59f236=require('child_process')[_0x08c3('0x95')](path[_0x08c3('0x65')](__dirname,_0x08c3('0x96')),[_0x3083ec,_0x6d4de9[_0x08c3('0x4a')][_0x08c3('0x8e')],_0x6d4de9[_0x08c3('0x4a')][_0x08c3('0x8a')],_0x6d4de9[_0x08c3('0x4a')][_0x08c3('0x68')],_0x6d4de9['body']['CompanyId'],_0x6d4de9[_0x08c3('0x4a')][_0x08c3('0x66')],_0x6d4de9['body'][_0x08c3('0x8c')]]);return _0x4aacf2[_0x08c3('0x16')](0xc8)['json']({'message':_0x08c3('0x97'),'pid':_0x59f236[_0x08c3('0x98')]});}catch(_0x38f443){return _0x4aacf2[_0x08c3('0x16')](0x1f4)[_0x08c3('0x24')](_0x38f443);}};exports[_0x08c3('0x99')]=function(_0x7d81f2,_0x2fa593,_0x111d71){var _0x286309=fs[_0x08c3('0x9a')](_0x7d81f2[_0x08c3('0x9b')]['path']);Papa[_0x08c3('0x9c')](_0x286309,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x1ce2e0){return _0x2fa593['status'](0xc8)[_0x08c3('0x17')]({'file':_0x7d81f2[_0x08c3('0x9b')],'fields':_0x1ce2e0[_0x08c3('0x9d')][_0x08c3('0x30')]});}});};exports['import']=function(_0xb9962c,_0x3985ef,_0x505f09){return db[_0x08c3('0x9e')][_0x08c3('0x46')]({'raw':!![],'attributes':['id'],'where':{'role':_0x08c3('0x9f')}})[_0x08c3('0x20')](function(_0x3eae87){var _0x160446=![];if(!_0xb9962c[_0x08c3('0x4a')][_0x08c3('0x68')]){throw new Error('No\x20ListId\x20specified');}if(!_0xb9962c[_0x08c3('0x4a')][_0x08c3('0xa0')][_0x08c3('0x7b')]){throw new Error(_0x08c3('0xa1'));}if(!_0xb9962c[_0x08c3('0x4a')][_0x08c3('0xa0')][_0x08c3('0xa2')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0xb9962c[_0x08c3('0x4a')][_0x08c3('0x8c')]){throw new Error(_0x08c3('0x8d'));}var _0x48a453=require(_0x08c3('0xa3'))['fork'](path['join'](__dirname,_0x08c3('0xa4')),[_0xb9962c[_0x08c3('0x6b')]['id'],JSON[_0x08c3('0xa5')](_0xb9962c['body']),JSON['stringify'](_0x3eae87)]);_0x48a453['on'](_0x08c3('0xa6'),function(_0x39df49){_0x160446=!![];return _0x3985ef[_0x08c3('0x16')](0xc8)[_0x08c3('0x17')]({'message':_0x08c3('0xa7'),'pid':_0x48a453['pid']});});_0x48a453['on'](_0x08c3('0xa8'),function(_0x5dbe91){if(_0x5dbe91&&!_0x160446){return _0x3985ef[_0x08c3('0x16')](0x1f4)['json']({'message':_0x08c3('0xa9'),'pid':_0x48a453[_0x08c3('0x98')]});}});})[_0x08c3('0x48')](handleError(_0x3985ef,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 7e58e42..031b59d 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 _0x2765=['CmContact','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xafcc1c,_0xc96d6d){var _0xd87363=function(_0x4e705a){while(--_0x4e705a){_0xafcc1c['push'](_0xafcc1c['shift']());}};_0xd87363(++_0xc96d6d);}(_0x2765,0x19d));var _0x5276=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2765[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require('events');var CmContact=require('../../mysqldb')['db'][_0x5276('0x0')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5276('0x1'),'afterUpdate':_0x5276('0x2'),'afterDestroy':_0x5276('0x3')};function emitEvent(_0x36eaf8){return function(_0x5bb0ce,_0x314e50,_0x153297){CmContactEvents['emit'](_0x36eaf8+':'+_0x5bb0ce['id'],_0x5bb0ce);CmContactEvents[_0x5276('0x4')](_0x36eaf8,_0x5bb0ce);_0x153297(null);};}for(var e in events){if(events[_0x5276('0x5')](e)){var event=events[e];CmContact[_0x5276('0x6')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0xa75d=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','CmContact'];(function(_0x5bc871,_0x528327){var _0x4cd71a=function(_0x201251){while(--_0x201251){_0x5bc871['push'](_0x5bc871['shift']());}};_0x4cd71a(++_0x528327);}(_0xa75d,0x106));var _0xda75=function(_0x469eb0,_0x5d9dae){_0x469eb0=_0x469eb0-0x0;var _0x56ef38=_0xa75d[_0x469eb0];return _0x56ef38;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xda75('0x0'))['db'][_0xda75('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xda75('0x2'),'afterDestroy':_0xda75('0x3')};function emitEvent(_0x34ab62){return function(_0x2f9319,_0x1d533f,_0x5bf310){CmContactEvents['emit'](_0x34ab62+':'+_0x2f9319['id'],_0x2f9319);CmContactEvents[_0xda75('0x4')](_0x34ab62,_0x2f9319);_0x5bf310(null);};}for(var e in events){if(events[_0xda75('0x5')](e)){var event=events[e];CmContact[_0xda75('0x6')](e,emitEvent(event));}}module[_0xda75('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 fd809c4..0af833c 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 _0x6610=['length','dialCheckDuplicateType','onlyIfOpen','outbound','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','always','List\x20not\x20found','destroy','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Succesfull]','lodash','util','api','moment','request-promise','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','models','get','error','afterCreate','inspect','then','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','priority','scheduledAt','format','YYYY-MM-DD\x20HH:mm:ss','callbackUniqueid','CmHopper','findOne','isNil','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','cmContact','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','findAll','CmList','Lists'];(function(_0x4fccf2,_0xed0aa3){var _0x1b29f9=function(_0x4adb94){while(--_0x4adb94){_0x4fccf2['push'](_0x4fccf2['shift']());}};_0x1b29f9(++_0xed0aa3);}(_0x6610,0x138));var _0x0661=function(_0x2de60d,_0xdb1add){_0x2de60d=_0x2de60d-0x0;var _0xceae08=_0x6610[_0x2de60d];return _0xceae08;};'use strict';var _=require(_0x0661('0x0'));var util=require(_0x0661('0x1'));var logger=require('../../config/logger')(_0x0661('0x2'));var moment=require(_0x0661('0x3'));var BPromise=require('bluebird');var rp=require(_0x0661('0x4'));var attributes=require(_0x0661('0x5'));module[_0x0661('0x6')]=function(_0x421b6b,_0x4062d1){return _0x421b6b[_0x0661('0x7')](_0x0661('0x8'),attributes,{'tableName':_0x0661('0x9'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x0661('0xa')]}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3599a6,_0x23b9e1,_0x3db2c9){var _0x433a04=_0x421b6b[_0x0661('0xb')];var _0x9559fa=_0x3599a6[_0x0661('0xc')]({'plain':!![]});function _0x58979e(){return function(_0x16b6c0){logger[_0x0661('0xd')]('cmContact',_0x0661('0xe'),util[_0x0661('0xf')](_0x16b6c0,{'showHidden':![],'depth':null}));};}var _0x471a78=function(_0x2fcc95){return new BPromise(function(_0x3f9514,_0x5580c3){_0x433a04['CmHopper']['findOne']({'where':{'phone':_0x9559fa[_0x0661('0xa')],'VoiceQueueId':_0x2fcc95['id']}})[_0x0661('0x10')](function(_0x45dace){if(!_['isNil'](_0x45dace)){throw new Error(_0x0661('0x11')+_0x9559fa['phone']+_0x0661('0x12')+_0x2fcc95['id']);}return _0x433a04['CmHopper'][_0x0661('0x13')]({'phone':_0x9559fa[_0x0661('0xa')],'ContactId':_0x9559fa['id'],'ListId':_0x9559fa['ListId'],'priority':_0x9559fa[_0x0661('0x14')]?_0x9559fa[_0x0661('0x14')]:0x2,'scheduledat':_0x9559fa[_0x0661('0x15')]?_0x9559fa['scheduledAt']:moment()[_0x0661('0x16')](_0x0661('0x17')),'callback':_0x9559fa['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x9559fa[_0x0661('0x18')]?_0x9559fa[_0x0661('0x18')]:undefined,'callbackat':_0x9559fa[_0x0661('0x18')]?moment()[_0x0661('0x16')](_0x0661('0x17')):undefined,'VoiceQueueId':_0x2fcc95['id']});})['catch'](function(_0x3c52f9){_0x5580c3(_0x3c52f9);});});};var _0x13a32e=function(_0x1a1d9f){return new BPromise(function(_0x1805f7,_0x2388c2){_0x433a04[_0x0661('0x19')][_0x0661('0x1a')]({'where':{'phone':_0x9559fa['phone'],'VoiceQueueId':_0x1a1d9f['id']}})[_0x0661('0x10')](function(_0x5c96af){if(!_[_0x0661('0x1b')](_0x5c96af)){throw new Error('cmContact,\x20afterCreate\x20'+_0x9559fa['phone']+_0x0661('0x1c')+_0x1a1d9f['id']);}return _0x433a04['CmHopperFinal'][_0x0661('0x1a')]({'where':{'calleridnum':_0x9559fa['phone'],'VoiceQueueId':_0x1a1d9f['id']}});})[_0x0661('0x10')](function(_0x325320){if(!_[_0x0661('0x1b')](_0x325320)){throw new Error(_0x0661('0x1d')+_0x9559fa[_0x0661('0xa')]+_0x0661('0x1e')+_0x1a1d9f['id']);}return _0x433a04['CmHopper'][_0x0661('0x13')]({'phone':_0x9559fa[_0x0661('0xa')],'ContactId':_0x9559fa['id'],'ListId':_0x9559fa[_0x0661('0x1f')],'priority':_0x9559fa[_0x0661('0x14')]?_0x9559fa[_0x0661('0x14')]:0x2,'scheduledat':_0x9559fa[_0x0661('0x15')]?_0x9559fa[_0x0661('0x15')]:moment()[_0x0661('0x16')](_0x0661('0x17')),'callback':_0x9559fa[_0x0661('0x18')]?!![]:![],'callbackuniqueid':_0x9559fa['callbackUniqueid']?_0x9559fa[_0x0661('0x18')]:undefined,'callbackat':_0x9559fa['callbackUniqueid']?moment()[_0x0661('0x16')](_0x0661('0x17')):undefined,'VoiceQueueId':_0x1a1d9f['id']});})['catch'](function(_0x137ef1){_0x2388c2(_0x137ef1);});});};function _0x342ac2(){return function(_0x7451eb){logger[_0x0661('0xd')](_0x0661('0x20'),'afterCreate',util['inspect'](_0x7451eb,{'showHidden':![],'depth':null}));};}var _0xb356d=function(_0x283d17){return new BPromise(function(_0x86ebcd,_0x6c0a34){_0x433a04[_0x0661('0x19')]['findOne']({'where':{'phone':_0x9559fa[_0x0661('0xa')],'CampaignId':_0x283d17['id']}})[_0x0661('0x10')](function(_0x46bee2){if(!_[_0x0661('0x1b')](_0x46bee2)){throw new Error(_0x0661('0x11')+_0x9559fa[_0x0661('0xa')]+_0x0661('0x21')+_0x283d17['id']);}return _0x433a04[_0x0661('0x19')][_0x0661('0x13')]({'phone':_0x9559fa['phone'],'ContactId':_0x9559fa['id'],'ListId':_0x9559fa['ListId'],'priority':_0x9559fa[_0x0661('0x14')]?_0x9559fa[_0x0661('0x14')]:0x2,'scheduledat':_0x9559fa[_0x0661('0x15')]?_0x9559fa['scheduledAt']:moment()[_0x0661('0x16')](_0x0661('0x17')),'callback':_0x9559fa[_0x0661('0x18')]?!![]:![],'callbackuniqueid':_0x9559fa['callbackUniqueid']?_0x9559fa[_0x0661('0x18')]:undefined,'callbackat':_0x9559fa['callbackUniqueid']?moment()[_0x0661('0x16')](_0x0661('0x17')):undefined,'CampaignId':_0x283d17['id']});})[_0x0661('0x22')](function(_0x391404){_0x6c0a34(_0x391404);});});};var _0x5622ba=function(_0x435bc8){return new BPromise(function(_0x193f1f,_0x4a6531){_0x433a04[_0x0661('0x19')][_0x0661('0x1a')]({'where':{'phone':_0x9559fa['phone'],'CampaignId':_0x435bc8['id']}})[_0x0661('0x10')](function(_0x48eadb){if(!_[_0x0661('0x1b')](_0x48eadb)){throw new Error(_0x0661('0x11')+_0x9559fa['phone']+_0x0661('0x23')+_0x435bc8['id']);}return _0x433a04[_0x0661('0x24')][_0x0661('0x1a')]({'where':{'calleridnum':_0x9559fa['phone'],'CampaignId':_0x435bc8['id']}});})[_0x0661('0x10')](function(_0x4cb79f){if(!_[_0x0661('0x1b')](_0x4cb79f)){throw new Error(_0x0661('0x1d')+_0x9559fa[_0x0661('0xa')]+_0x0661('0x25')+_0x435bc8['id']);}return _0x433a04[_0x0661('0x19')]['create']({'phone':_0x9559fa[_0x0661('0xa')],'ContactId':_0x9559fa['id'],'ListId':_0x9559fa[_0x0661('0x1f')],'priority':_0x9559fa[_0x0661('0x14')]?_0x9559fa[_0x0661('0x14')]:0x2,'scheduledat':_0x9559fa['scheduledAt']?_0x9559fa[_0x0661('0x15')]:moment()[_0x0661('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x9559fa[_0x0661('0x18')]?!![]:![],'callbackuniqueid':_0x9559fa['callbackUniqueid']?_0x9559fa[_0x0661('0x18')]:undefined,'callbackat':_0x9559fa['callbackUniqueid']?moment()[_0x0661('0x16')](_0x0661('0x17')):undefined,'CampaignId':_0x435bc8['id']});})[_0x0661('0x22')](function(_0x3a2dfc){_0x4a6531(_0x3a2dfc);});});};if(_0x9559fa[_0x0661('0x1f')]){_0x433a04[_0x0661('0x26')][_0x0661('0x27')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':_0x433a04[_0x0661('0x28')],'as':_0x0661('0x29'),'where':{'id':_0x9559fa[_0x0661('0x1f')]}}]})['then'](function(_0x26672e){if(_0x26672e){var _0x2ab115=[];for(var _0x464e4f=0x0,_0x409212;_0x464e4f<_0x26672e[_0x0661('0x2a')];_0x464e4f+=0x1){_0x409212=_0x26672e[_0x464e4f][_0x0661('0xc')]({'plain':!![]});switch(_0x409212[_0x0661('0x2b')]){case'always':_0x13a32e(_0x409212)['catch'](_0x58979e());break;case _0x0661('0x2c'):_0x471a78(_0x409212)[_0x0661('0x22')](_0x58979e());break;default:_0x433a04[_0x0661('0x19')]['create']({'phone':_0x9559fa[_0x0661('0xa')],'ContactId':_0x9559fa['id'],'ListId':_0x9559fa[_0x0661('0x1f')],'scheduledat':_0x9559fa[_0x0661('0x15')]?_0x9559fa[_0x0661('0x15')]:moment()[_0x0661('0x16')](_0x0661('0x17')),'priority':_0x9559fa[_0x0661('0x14')]?_0x9559fa[_0x0661('0x14')]:0x2,'callback':_0x9559fa[_0x0661('0x18')]?!![]:![],'callbackuniqueid':_0x9559fa[_0x0661('0x18')]?_0x9559fa[_0x0661('0x18')]:undefined,'callbackat':_0x9559fa[_0x0661('0x18')]?moment()[_0x0661('0x16')](_0x0661('0x17')):undefined,'VoiceQueueId':_0x409212['id']})[_0x0661('0x22')](_0x58979e());}}}})[_0x0661('0x10')](function(){return _0x433a04['VoiceQueue'][_0x0661('0x27')]({'where':{'type':_0x0661('0x2d')},'attributes':['id'],'include':[{'model':_0x433a04[_0x0661('0x28')],'as':_0x0661('0x2e'),'where':{'id':_0x9559fa[_0x0661('0x1f')]}}]})['then'](function(_0x226552){if(_0x226552){var _0x459e89=[];for(var _0x35ae14=0x0,_0x376fea;_0x35ae14<_0x226552[_0x0661('0x2a')];_0x35ae14+=0x1){_0x376fea=_0x226552[_0x35ae14][_0x0661('0xc')]({'plain':!![]});_0x433a04[_0x0661('0x2f')][_0x0661('0x13')]({'phone':_0x9559fa[_0x0661('0xa')],'ContactId':_0x9559fa['id'],'ListId':_0x9559fa[_0x0661('0x1f')],'VoiceQueueId':_0x376fea['id']})[_0x0661('0x22')](function(_0xd8a222){logger['error'](_0x0661('0x30'),'afterCreate',_0xd8a222[_0x0661('0x31')]);});}}});})[_0x0661('0x10')](function(){return _0x433a04[_0x0661('0x32')][_0x0661('0x27')]({'attributes':['id',_0x0661('0x2b')],'include':[{'model':_0x433a04[_0x0661('0x28')],'as':_0x0661('0x29'),'where':{'id':_0x9559fa[_0x0661('0x1f')]}}]})[_0x0661('0x10')](function(_0x14279a){if(_0x14279a){var _0x31bf87=[];for(var _0x344931=0x0,_0x440500;_0x344931<_0x14279a[_0x0661('0x2a')];_0x344931+=0x1){_0x440500=_0x14279a[_0x344931][_0x0661('0xc')]({'plain':!![]});switch(_0x440500[_0x0661('0x2b')]){case _0x0661('0x33'):_0x5622ba(_0x440500)[_0x0661('0x22')](_0x342ac2());break;case _0x0661('0x2c'):_0xb356d(_0x440500)[_0x0661('0x22')](_0x342ac2());break;default:_0x433a04[_0x0661('0x19')][_0x0661('0x13')]({'phone':_0x9559fa[_0x0661('0xa')],'ContactId':_0x9559fa['id'],'ListId':_0x9559fa[_0x0661('0x1f')],'scheduledat':_0x9559fa[_0x0661('0x15')]?_0x9559fa['scheduledAt']:moment()[_0x0661('0x16')](_0x0661('0x17')),'priority':_0x9559fa[_0x0661('0x14')]?_0x9559fa[_0x0661('0x14')]:0x2,'callback':_0x9559fa[_0x0661('0x18')]?!![]:![],'callbackuniqueid':_0x9559fa['callbackUniqueid']?_0x9559fa[_0x0661('0x18')]:undefined,'callbackat':_0x9559fa[_0x0661('0x18')]?moment()['format'](_0x0661('0x17')):undefined,'CampaignId':_0x440500['id']})[_0x0661('0x22')](_0x342ac2());}}}});})['then'](function(){return _0x433a04[_0x0661('0x32')][_0x0661('0x27')]({'attributes':['id'],'include':[{'model':_0x433a04[_0x0661('0x28')],'as':_0x0661('0x2e'),'where':{'id':_0x9559fa[_0x0661('0x1f')]}}]})['then'](function(_0x5b67d1){if(_0x5b67d1){var _0x285fe4=[];for(var _0x5956d8=0x0,_0x1d0a68;_0x5956d8<_0x5b67d1[_0x0661('0x2a')];_0x5956d8+=0x1){_0x1d0a68=_0x5b67d1[_0x5956d8]['get']({'plain':!![]});_0x433a04[_0x0661('0x2f')][_0x0661('0x13')]({'phone':_0x9559fa['phone'],'ContactId':_0x9559fa['id'],'ListId':_0x9559fa['ListId'],'CampaignId':_0x1d0a68['id']})[_0x0661('0x22')](function(_0x520316){logger[_0x0661('0xd')](_0x0661('0x30'),_0x0661('0xe'),_0x520316[_0x0661('0x31')]);});}}});})['then'](function(){_0x3db2c9();})['catch'](function(_0x4145aa){logger['error']('cmContact,\x20%s,\x20%s',_0x0661('0xe'),_0x4145aa['message']);_0x3db2c9(_0x4145aa);});}else{_0x3db2c9(new Error(_0x0661('0x34')));}},'afterDestroy':function(_0x530d99,_0x15b36e,_0x56ec20){var _0x4dbc6a=_0x421b6b[_0x0661('0xb')];var _0x174513=_0x530d99[_0x0661('0xc')]({'plain':!![]});return _0x4dbc6a[_0x0661('0x19')][_0x0661('0x27')]({'raw':!![],'where':{'ListId':_0x174513[_0x0661('0x1f')],'ContactId':_0x174513['id']}})[_0x0661('0x10')](function(_0x32a018){if(!_['isEmpty'](_0x32a018)){var _0x5c33c1=[];for(var _0xb225fc=0x0;_0xb225fc<_0x32a018['length'];_0xb225fc+=0x1){var _0x48e3fc=_0x4dbc6a['CmHopper'][_0x0661('0x35')]({'where':{'ListId':_0x32a018[_0xb225fc][_0x0661('0x1f')],'ContactId':_0x32a018[_0xb225fc]['ContactId'],'VoiceQueueId':_0x32a018[_0xb225fc][_0x0661('0x36')],'CampaignId':_0x32a018[_0xb225fc]['CampaignId']}});_0x5c33c1[_0x0661('0x37')](_0x48e3fc);}return BPromise[_0x0661('0x38')](_0x5c33c1);}})[_0x0661('0x10')](function(_0x1e9eb3){logger[_0x0661('0x39')](_0x0661('0x3a'),util[_0x0661('0xf')](_0x1e9eb3,{'showHidden':![],'depth':null}));_0x56ec20();})[_0x0661('0x22')](function(_0x4092e0){logger['error']('[CmContact][afterDestroy][Error]',util[_0x0661('0xf')](_0x4092e0,{'showHidden':![],'depth':null}));_0x56ec20(_0x4092e0);});}}});}; \ No newline at end of file +var _0x247d=['\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','create','priority','inspect','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','ListId','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','length','always','onlyIfOpen','BlackLists','cmContact,\x20%s,\x20%s','message','isEmpty','destroy','ContactId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','api','bluebird','request-promise','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','models','get','error','cmContact','afterCreate','CmHopper','then','isNil','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','scheduledAt','YYYY-MM-DD\x20HH:mm:ss','callbackUniqueid','format','catch','findOne','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20'];(function(_0x52e572,_0x35c07f){var _0x2e8e31=function(_0x5f53e4){while(--_0x5f53e4){_0x52e572['push'](_0x52e572['shift']());}};_0x2e8e31(++_0x35c07f);}(_0x247d,0x102));var _0xd247=function(_0x5aeea3,_0x39f731){_0x5aeea3=_0x5aeea3-0x0;var _0x4ff24c=_0x247d[_0x5aeea3];return _0x4ff24c;};'use strict';var _=require(_0xd247('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd247('0x1'));var moment=require('moment');var BPromise=require(_0xd247('0x2'));var rp=require(_0xd247('0x3'));var attributes=require(_0xd247('0x4'));module[_0xd247('0x5')]=function(_0xe813c0,_0x23ef2f){return _0xe813c0[_0xd247('0x6')](_0xd247('0x7'),attributes,{'tableName':_0xd247('0x8'),'paranoid':!![],'indexes':[{'name':_0xd247('0x9'),'fields':['phone']}],'timestamps':!![],'hooks':{'afterCreate':function(_0x20f636,_0x12de40,_0x269335){var _0x2c9227=_0xe813c0[_0xd247('0xa')];var _0x34933b=_0x20f636[_0xd247('0xb')]({'plain':!![]});function _0x9cdbb(){return function(_0xa3c464){logger[_0xd247('0xc')](_0xd247('0xd'),_0xd247('0xe'),util['inspect'](_0xa3c464,{'showHidden':![],'depth':null}));};}var _0x476d62=function(_0x4db1da){return new BPromise(function(_0x3ac86f,_0x4a5deb){_0x2c9227[_0xd247('0xf')]['findOne']({'where':{'phone':_0x34933b[_0xd247('0x9')],'VoiceQueueId':_0x4db1da['id']}})[_0xd247('0x10')](function(_0x4b77bb){if(!_[_0xd247('0x11')](_0x4b77bb)){throw new Error('cmContact,\x20afterCreate\x20'+_0x34933b[_0xd247('0x9')]+_0xd247('0x12')+_0x4db1da['id']);}return _0x2c9227[_0xd247('0xf')]['create']({'phone':_0x34933b['phone'],'ContactId':_0x34933b['id'],'ListId':_0x34933b['ListId'],'priority':_0x34933b['priority']?_0x34933b['priority']:0x2,'scheduledat':_0x34933b[_0xd247('0x13')]?_0x34933b[_0xd247('0x13')]:moment()['format'](_0xd247('0x14')),'callback':_0x34933b[_0xd247('0x15')]?!![]:![],'callbackuniqueid':_0x34933b[_0xd247('0x15')]?_0x34933b['callbackUniqueid']:undefined,'callbackat':_0x34933b['callbackUniqueid']?moment()[_0xd247('0x16')](_0xd247('0x14')):undefined,'VoiceQueueId':_0x4db1da['id']});})[_0xd247('0x17')](function(_0x5ce4ac){_0x4a5deb(_0x5ce4ac);});});};var _0x2a9a5c=function(_0x179102){return new BPromise(function(_0x266150,_0x2f027e){_0x2c9227[_0xd247('0xf')][_0xd247('0x18')]({'where':{'phone':_0x34933b[_0xd247('0x9')],'VoiceQueueId':_0x179102['id']}})[_0xd247('0x10')](function(_0x46135b){if(!_['isNil'](_0x46135b)){throw new Error('cmContact,\x20afterCreate\x20'+_0x34933b[_0xd247('0x9')]+_0xd247('0x19')+_0x179102['id']);}return _0x2c9227['CmHopperFinal'][_0xd247('0x18')]({'where':{'calleridnum':_0x34933b[_0xd247('0x9')],'VoiceQueueId':_0x179102['id']}});})['then'](function(_0x2126de){if(!_[_0xd247('0x11')](_0x2126de)){throw new Error(_0xd247('0x1a')+_0x34933b['phone']+_0xd247('0x1b')+_0x179102['id']);}return _0x2c9227[_0xd247('0xf')][_0xd247('0x1c')]({'phone':_0x34933b['phone'],'ContactId':_0x34933b['id'],'ListId':_0x34933b['ListId'],'priority':_0x34933b['priority']?_0x34933b[_0xd247('0x1d')]:0x2,'scheduledat':_0x34933b[_0xd247('0x13')]?_0x34933b[_0xd247('0x13')]:moment()[_0xd247('0x16')](_0xd247('0x14')),'callback':_0x34933b[_0xd247('0x15')]?!![]:![],'callbackuniqueid':_0x34933b['callbackUniqueid']?_0x34933b[_0xd247('0x15')]:undefined,'callbackat':_0x34933b['callbackUniqueid']?moment()[_0xd247('0x16')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x179102['id']});})['catch'](function(_0x2d4403){_0x2f027e(_0x2d4403);});});};function _0x5a1db0(){return function(_0x13c35c){logger[_0xd247('0xc')](_0xd247('0xd'),_0xd247('0xe'),util[_0xd247('0x1e')](_0x13c35c,{'showHidden':![],'depth':null}));};}var _0x4324c2=function(_0x2709ca){return new BPromise(function(_0x37374b,_0x502a6d){_0x2c9227['CmHopper'][_0xd247('0x18')]({'where':{'phone':_0x34933b[_0xd247('0x9')],'CampaignId':_0x2709ca['id']}})[_0xd247('0x10')](function(_0x17108a){if(!_['isNil'](_0x17108a)){throw new Error(_0xd247('0x1f')+_0x34933b[_0xd247('0x9')]+_0xd247('0x20')+_0x2709ca['id']);}return _0x2c9227[_0xd247('0xf')]['create']({'phone':_0x34933b['phone'],'ContactId':_0x34933b['id'],'ListId':_0x34933b[_0xd247('0x21')],'priority':_0x34933b['priority']?_0x34933b[_0xd247('0x1d')]:0x2,'scheduledat':_0x34933b[_0xd247('0x13')]?_0x34933b[_0xd247('0x13')]:moment()[_0xd247('0x16')](_0xd247('0x14')),'callback':_0x34933b[_0xd247('0x15')]?!![]:![],'callbackuniqueid':_0x34933b[_0xd247('0x15')]?_0x34933b[_0xd247('0x15')]:undefined,'callbackat':_0x34933b['callbackUniqueid']?moment()[_0xd247('0x16')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x2709ca['id']});})[_0xd247('0x17')](function(_0x555fd8){_0x502a6d(_0x555fd8);});});};var _0x1a9e82=function(_0x13264c){return new BPromise(function(_0x4ee6b5,_0x40b1da){_0x2c9227[_0xd247('0xf')]['findOne']({'where':{'phone':_0x34933b[_0xd247('0x9')],'CampaignId':_0x13264c['id']}})[_0xd247('0x10')](function(_0x5e5f45){if(!_['isNil'](_0x5e5f45)){throw new Error(_0xd247('0x1f')+_0x34933b[_0xd247('0x9')]+_0xd247('0x22')+_0x13264c['id']);}return _0x2c9227[_0xd247('0x23')][_0xd247('0x18')]({'where':{'calleridnum':_0x34933b['phone'],'CampaignId':_0x13264c['id']}});})['then'](function(_0x334bb4){if(!_[_0xd247('0x11')](_0x334bb4)){throw new Error(_0xd247('0x1a')+_0x34933b[_0xd247('0x9')]+_0xd247('0x24')+_0x13264c['id']);}return _0x2c9227[_0xd247('0xf')][_0xd247('0x1c')]({'phone':_0x34933b[_0xd247('0x9')],'ContactId':_0x34933b['id'],'ListId':_0x34933b['ListId'],'priority':_0x34933b[_0xd247('0x1d')]?_0x34933b[_0xd247('0x1d')]:0x2,'scheduledat':_0x34933b[_0xd247('0x13')]?_0x34933b[_0xd247('0x13')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x34933b[_0xd247('0x15')]?!![]:![],'callbackuniqueid':_0x34933b['callbackUniqueid']?_0x34933b[_0xd247('0x15')]:undefined,'callbackat':_0x34933b[_0xd247('0x15')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x13264c['id']});})['catch'](function(_0x2531ce){_0x40b1da(_0x2531ce);});});};if(_0x34933b[_0xd247('0x21')]){_0x2c9227[_0xd247('0x25')][_0xd247('0x26')]({'where':{'type':_0xd247('0x27')},'attributes':['id',_0xd247('0x28')],'include':[{'model':_0x2c9227[_0xd247('0x29')],'as':'Lists','where':{'id':_0x34933b[_0xd247('0x21')]}}]})[_0xd247('0x10')](function(_0x537b66){if(_0x537b66){var _0x227aa3=[];for(var _0x4b2b0b=0x0,_0x45c6b5;_0x4b2b0b<_0x537b66[_0xd247('0x2a')];_0x4b2b0b+=0x1){_0x45c6b5=_0x537b66[_0x4b2b0b][_0xd247('0xb')]({'plain':!![]});switch(_0x45c6b5[_0xd247('0x28')]){case _0xd247('0x2b'):_0x2a9a5c(_0x45c6b5)[_0xd247('0x17')](_0x9cdbb());break;case'onlyIfOpen':_0x476d62(_0x45c6b5)[_0xd247('0x17')](_0x9cdbb());break;default:_0x2c9227[_0xd247('0xf')][_0xd247('0x1c')]({'phone':_0x34933b[_0xd247('0x9')],'ContactId':_0x34933b['id'],'ListId':_0x34933b[_0xd247('0x21')],'scheduledat':_0x34933b[_0xd247('0x13')]?_0x34933b[_0xd247('0x13')]:moment()[_0xd247('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x34933b[_0xd247('0x1d')]?_0x34933b[_0xd247('0x1d')]:0x2,'callback':_0x34933b[_0xd247('0x15')]?!![]:![],'callbackuniqueid':_0x34933b[_0xd247('0x15')]?_0x34933b['callbackUniqueid']:undefined,'callbackat':_0x34933b[_0xd247('0x15')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x45c6b5['id']})['catch'](_0x9cdbb());}}}})[_0xd247('0x10')](function(){return _0x2c9227[_0xd247('0x25')][_0xd247('0x26')]({'where':{'type':_0xd247('0x27')},'attributes':['id'],'include':[{'model':_0x2c9227[_0xd247('0x29')],'as':'BlackLists','where':{'id':_0x34933b[_0xd247('0x21')]}}]})[_0xd247('0x10')](function(_0x23c6d4){if(_0x23c6d4){var _0x463b2c=[];for(var _0x64da37=0x0,_0x157a7a;_0x64da37<_0x23c6d4[_0xd247('0x2a')];_0x64da37+=0x1){_0x157a7a=_0x23c6d4[_0x64da37][_0xd247('0xb')]({'plain':!![]});_0x2c9227['CmHopperBlack'][_0xd247('0x1c')]({'phone':_0x34933b['phone'],'ContactId':_0x34933b['id'],'ListId':_0x34933b[_0xd247('0x21')],'VoiceQueueId':_0x157a7a['id']})['catch'](function(_0x507d2a){logger[_0xd247('0xc')]('cmContact,\x20%s,\x20%s','afterCreate',_0x507d2a['message']);});}}});})[_0xd247('0x10')](function(){return _0x2c9227['Campaign'][_0xd247('0x26')]({'attributes':['id',_0xd247('0x28')],'include':[{'model':_0x2c9227['CmList'],'as':'Lists','where':{'id':_0x34933b[_0xd247('0x21')]}}]})[_0xd247('0x10')](function(_0x564bfd){if(_0x564bfd){var _0x4d547d=[];for(var _0x43daab=0x0,_0x1df899;_0x43daab<_0x564bfd[_0xd247('0x2a')];_0x43daab+=0x1){_0x1df899=_0x564bfd[_0x43daab]['get']({'plain':!![]});switch(_0x1df899[_0xd247('0x28')]){case _0xd247('0x2b'):_0x1a9e82(_0x1df899)[_0xd247('0x17')](_0x5a1db0());break;case _0xd247('0x2c'):_0x4324c2(_0x1df899)[_0xd247('0x17')](_0x5a1db0());break;default:_0x2c9227['CmHopper']['create']({'phone':_0x34933b[_0xd247('0x9')],'ContactId':_0x34933b['id'],'ListId':_0x34933b[_0xd247('0x21')],'scheduledat':_0x34933b[_0xd247('0x13')]?_0x34933b[_0xd247('0x13')]:moment()[_0xd247('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x34933b['priority']?_0x34933b[_0xd247('0x1d')]:0x2,'callback':_0x34933b[_0xd247('0x15')]?!![]:![],'callbackuniqueid':_0x34933b[_0xd247('0x15')]?_0x34933b[_0xd247('0x15')]:undefined,'callbackat':_0x34933b[_0xd247('0x15')]?moment()['format'](_0xd247('0x14')):undefined,'CampaignId':_0x1df899['id']})[_0xd247('0x17')](_0x5a1db0());}}}});})[_0xd247('0x10')](function(){return _0x2c9227['Campaign']['findAll']({'attributes':['id'],'include':[{'model':_0x2c9227[_0xd247('0x29')],'as':_0xd247('0x2d'),'where':{'id':_0x34933b[_0xd247('0x21')]}}]})[_0xd247('0x10')](function(_0x47acb3){if(_0x47acb3){var _0x58988f=[];for(var _0x1472e0=0x0,_0x5f003e;_0x1472e0<_0x47acb3[_0xd247('0x2a')];_0x1472e0+=0x1){_0x5f003e=_0x47acb3[_0x1472e0]['get']({'plain':!![]});_0x2c9227['CmHopperBlack'][_0xd247('0x1c')]({'phone':_0x34933b[_0xd247('0x9')],'ContactId':_0x34933b['id'],'ListId':_0x34933b[_0xd247('0x21')],'CampaignId':_0x5f003e['id']})[_0xd247('0x17')](function(_0x2dc8a1){logger[_0xd247('0xc')](_0xd247('0x2e'),'afterCreate',_0x2dc8a1[_0xd247('0x2f')]);});}}});})['then'](function(){_0x269335();})[_0xd247('0x17')](function(_0x5b91eb){logger[_0xd247('0xc')]('cmContact,\x20%s,\x20%s',_0xd247('0xe'),_0x5b91eb[_0xd247('0x2f')]);_0x269335(_0x5b91eb);});}else{_0x269335(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x5219b5,_0x44d8ab,_0x370b83){var _0x2b62d3=_0xe813c0[_0xd247('0xa')];var _0x4820e5=_0x5219b5[_0xd247('0xb')]({'plain':!![]});return _0x2b62d3[_0xd247('0xf')][_0xd247('0x26')]({'raw':!![],'where':{'ListId':_0x4820e5[_0xd247('0x21')],'ContactId':_0x4820e5['id']}})[_0xd247('0x10')](function(_0x44e22d){if(!_[_0xd247('0x30')](_0x44e22d)){var _0xc3aa11=[];for(var _0x2efd30=0x0;_0x2efd30<_0x44e22d[_0xd247('0x2a')];_0x2efd30+=0x1){var _0x4d9748=_0x2b62d3[_0xd247('0xf')][_0xd247('0x31')]({'where':{'ListId':_0x44e22d[_0x2efd30]['ListId'],'ContactId':_0x44e22d[_0x2efd30][_0xd247('0x32')],'VoiceQueueId':_0x44e22d[_0x2efd30]['VoiceQueueId'],'CampaignId':_0x44e22d[_0x2efd30][_0xd247('0x33')]}});_0xc3aa11[_0xd247('0x34')](_0x4d9748);}return BPromise[_0xd247('0x35')](_0xc3aa11);}})[_0xd247('0x10')](function(_0x3a1f3b){logger[_0xd247('0x36')](_0xd247('0x37'),util[_0xd247('0x1e')](_0x3a1f3b,{'showHidden':![],'depth':null}));_0x370b83();})[_0xd247('0x17')](function(_0x217f85){logger[_0xd247('0xc')](_0xd247('0x38'),util[_0xd247('0x1e')](_0x217f85,{'showHidden':![],'depth':null}));_0x370b83(_0x217f85);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 4e26714..9da8c9b 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 _0x53c0=['debug','create','body','CreateCmContact','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowCmContact','CmContact','find','options','raw','attributes','include','model','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53c0,0x191));var _0x053c=function(_0x4392af,_0xec5afe){_0x4392af=_0x4392af-0x0;var _0x9fa8eb=_0x53c0[_0x4392af];return _0x9fa8eb;};'use strict';var _=require(_0x053c('0x0'));var util=require(_0x053c('0x1'));var moment=require(_0x053c('0x2'));var BPromise=require(_0x053c('0x3'));var rs=require(_0x053c('0x4'));var fs=require('fs');var db=require(_0x053c('0x5'))['db'];var utils=require(_0x053c('0x6'));var logger=require(_0x053c('0x7'))('rpc');var config=require(_0x053c('0x8'));var jayson=require(_0x053c('0x9'));var client=jayson['client']['http']({'port':0x232a});var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0x053c('0xa'))[_0x053c('0xb')](socket);function respondWithRpcPromise(_0x2ceb49,_0x52162b,_0x3873b5){return new BPromise(function(_0x38ed19,_0x4001bf){return client[_0x053c('0xc')](_0x2ceb49,_0x3873b5)[_0x053c('0xd')](function(_0x44b307){logger[_0x053c('0xe')](_0x053c('0xf'),_0x52162b,_0x053c('0x10'));logger['debug'](_0x053c('0x11'),_0x52162b,_0x053c('0x10'),JSON['stringify'](_0x44b307));if(_0x44b307[_0x053c('0x12')]){if(_0x44b307[_0x053c('0x12')][_0x053c('0x13')]===0x1f4){logger[_0x053c('0x12')](_0x053c('0xf'),_0x52162b,_0x44b307[_0x053c('0x12')][_0x053c('0x14')]);return _0x4001bf(_0x44b307[_0x053c('0x12')][_0x053c('0x14')]);}logger[_0x053c('0x12')]('CmContact,\x20%s,\x20%s',_0x52162b,_0x44b307[_0x053c('0x12')][_0x053c('0x14')]);return _0x38ed19(_0x44b307[_0x053c('0x12')][_0x053c('0x14')]);}else{logger[_0x053c('0xe')](_0x053c('0xf'),_0x52162b,_0x053c('0x10'));_0x38ed19(_0x44b307['result'][_0x053c('0x14')]);}})[_0x053c('0x15')](function(_0xf6da0a){logger[_0x053c('0x12')](_0x053c('0xf'),_0x52162b,_0xf6da0a);_0x4001bf(_0xf6da0a);});});}exports[_0x053c('0x16')]=function(_0x284d3f){var _0x4b6896=this;return new Promise(function(_0x54bea0,_0xedb99c){return db[_0x053c('0x17')][_0x053c('0x18')]({'raw':_0x284d3f[_0x053c('0x19')]?_0x284d3f[_0x053c('0x19')][_0x053c('0x1a')]===undefined?!![]:![]:!![],'where':_0x284d3f[_0x053c('0x19')]?_0x284d3f[_0x053c('0x19')]['where']||null:null,'attributes':_0x284d3f['options']?_0x284d3f['options'][_0x053c('0x1b')]||null:null,'include':_0x284d3f[_0x053c('0x19')]?_0x284d3f[_0x053c('0x19')][_0x053c('0x1c')]?_['map'](_0x284d3f[_0x053c('0x19')][_0x053c('0x1c')],function(_0x521cd8){return{'model':db[_0x521cd8[_0x053c('0x1d')]],'as':_0x521cd8['as'],'attributes':_0x521cd8['attributes'],'include':_0x521cd8[_0x053c('0x1c')]?_[_0x053c('0x1e')](_0x521cd8[_0x053c('0x1c')],function(_0x6d0fd1){return{'model':db[_0x6d0fd1[_0x053c('0x1d')]],'as':_0x6d0fd1['as'],'attributes':_0x6d0fd1[_0x053c('0x1b')],'include':_0x6d0fd1['include']?_[_0x053c('0x1e')](_0x6d0fd1[_0x053c('0x1c')],function(_0x30040b){return{'model':db[_0x30040b[_0x053c('0x1d')]],'as':_0x30040b['as'],'attributes':_0x30040b['attributes']};}):[]};}):[]};}):[]:[]})[_0x053c('0xd')](function(_0xe39b4a){logger[_0x053c('0xe')](_0x053c('0x16'),_0x284d3f);logger[_0x053c('0x1f')](_0x053c('0x16'),_0x284d3f,JSON['stringify'](_0xe39b4a));_0x54bea0(_0xe39b4a);})[_0x053c('0x15')](function(_0x35ace2){logger['error'](_0x053c('0x16'),_0x35ace2['message'],_0x284d3f);_0xedb99c(_0x4b6896[_0x053c('0x12')](0x1f4,_0x35ace2[_0x053c('0x14')]));});});};exports['CreateCmContact']=function(_0x1e1d55){var _0x4c2b09=this;return new Promise(function(_0x4b34e0,_0x285e59){return db[_0x053c('0x17')][_0x053c('0x20')](_0x1e1d55[_0x053c('0x21')],{'raw':_0x1e1d55['options']?_0x1e1d55[_0x053c('0x19')][_0x053c('0x1a')]===undefined?!![]:![]:!![]})[_0x053c('0xd')](function(_0x27f592){logger[_0x053c('0xe')](_0x053c('0x22'),_0x1e1d55);logger[_0x053c('0x1f')](_0x053c('0x22'),_0x1e1d55,JSON[_0x053c('0x23')](_0x27f592));_0x4b34e0(_0x27f592);})[_0x053c('0x15')](function(_0x29a670){logger['error'](_0x053c('0x22'),_0x29a670['message'],_0x1e1d55);_0x285e59(_0x4c2b09[_0x053c('0x12')](0x1f4,_0x29a670[_0x053c('0x14')]));});});}; \ No newline at end of file +var _0xccc4=['CmContact,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','CmContact','find','options','where','attributes','map','model','include','ShowCmContact','stringify','CreateCmContact','create','body','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','socket.io-emitter','request','then','info','CmContact,\x20%s,\x20%s','debug'];(function(_0x22e7ee,_0xd43e98){var _0xbf4677=function(_0x52d1ab){while(--_0x52d1ab){_0x22e7ee['push'](_0x22e7ee['shift']());}};_0xbf4677(++_0xd43e98);}(_0xccc4,0x1e7));var _0x4ccc=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xccc4[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x4ccc('0x0'));var util=require(_0x4ccc('0x1'));var moment=require(_0x4ccc('0x2'));var BPromise=require('bluebird');var rs=require(_0x4ccc('0x3'));var fs=require('fs');var db=require(_0x4ccc('0x4'))['db'];var utils=require(_0x4ccc('0x5'));var logger=require(_0x4ccc('0x6'))(_0x4ccc('0x7'));var config=require(_0x4ccc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4ccc('0x9')][_0x4ccc('0xa')]({'port':0x232a});var socket=require(_0x4ccc('0xb'))({'host':'localhost','port':0x18eb});require('./cmContact.socket')['register'](socket);function respondWithRpcPromise(_0x233fab,_0x4a46ba,_0x353314){return new BPromise(function(_0x27b9a7,_0x46e72e){return client[_0x4ccc('0xc')](_0x233fab,_0x353314)[_0x4ccc('0xd')](function(_0x53b57c){logger[_0x4ccc('0xe')](_0x4ccc('0xf'),_0x4a46ba,'request\x20sent');logger[_0x4ccc('0x10')](_0x4ccc('0x11'),_0x4a46ba,_0x4ccc('0x12'),JSON['stringify'](_0x53b57c));if(_0x53b57c[_0x4ccc('0x13')]){if(_0x53b57c['error'][_0x4ccc('0x14')]===0x1f4){logger[_0x4ccc('0x13')](_0x4ccc('0xf'),_0x4a46ba,_0x53b57c[_0x4ccc('0x13')][_0x4ccc('0x15')]);return _0x46e72e(_0x53b57c[_0x4ccc('0x13')][_0x4ccc('0x15')]);}logger[_0x4ccc('0x13')]('CmContact,\x20%s,\x20%s',_0x4a46ba,_0x53b57c['error'][_0x4ccc('0x15')]);return _0x27b9a7(_0x53b57c[_0x4ccc('0x13')][_0x4ccc('0x15')]);}else{logger[_0x4ccc('0xe')](_0x4ccc('0xf'),_0x4a46ba,_0x4ccc('0x12'));_0x27b9a7(_0x53b57c['result']['message']);}})[_0x4ccc('0x16')](function(_0x4f6c91){logger['error']('CmContact,\x20%s,\x20%s',_0x4a46ba,_0x4f6c91);_0x46e72e(_0x4f6c91);});});}exports['ShowCmContact']=function(_0x457deb){var _0x11aab0=this;return new Promise(function(_0x3743e9,_0xb37300){return db[_0x4ccc('0x17')][_0x4ccc('0x18')]({'raw':_0x457deb['options']?_0x457deb[_0x4ccc('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x457deb[_0x4ccc('0x19')]?_0x457deb[_0x4ccc('0x19')][_0x4ccc('0x1a')]||null:null,'attributes':_0x457deb[_0x4ccc('0x19')]?_0x457deb['options'][_0x4ccc('0x1b')]||null:null,'include':_0x457deb[_0x4ccc('0x19')]?_0x457deb[_0x4ccc('0x19')]['include']?_[_0x4ccc('0x1c')](_0x457deb[_0x4ccc('0x19')]['include'],function(_0x5d73bb){return{'model':db[_0x5d73bb[_0x4ccc('0x1d')]],'as':_0x5d73bb['as'],'attributes':_0x5d73bb['attributes'],'include':_0x5d73bb[_0x4ccc('0x1e')]?_['map'](_0x5d73bb['include'],function(_0x485fb8){return{'model':db[_0x485fb8[_0x4ccc('0x1d')]],'as':_0x485fb8['as'],'attributes':_0x485fb8['attributes'],'include':_0x485fb8[_0x4ccc('0x1e')]?_[_0x4ccc('0x1c')](_0x485fb8['include'],function(_0x15a898){return{'model':db[_0x15a898[_0x4ccc('0x1d')]],'as':_0x15a898['as'],'attributes':_0x15a898['attributes']};}):[]};}):[]};}):[]:[]})[_0x4ccc('0xd')](function(_0x97940e){logger[_0x4ccc('0xe')]('ShowCmContact',_0x457deb);logger['debug'](_0x4ccc('0x1f'),_0x457deb,JSON[_0x4ccc('0x20')](_0x97940e));_0x3743e9(_0x97940e);})[_0x4ccc('0x16')](function(_0xca2ea5){logger[_0x4ccc('0x13')](_0x4ccc('0x1f'),_0xca2ea5[_0x4ccc('0x15')],_0x457deb);_0xb37300(_0x11aab0[_0x4ccc('0x13')](0x1f4,_0xca2ea5[_0x4ccc('0x15')]));});});};exports[_0x4ccc('0x21')]=function(_0x44a4a7){var _0x378a9a=this;return new Promise(function(_0x4c889f,_0x250578){return db[_0x4ccc('0x17')][_0x4ccc('0x22')](_0x44a4a7[_0x4ccc('0x23')],{'raw':_0x44a4a7['options']?_0x44a4a7[_0x4ccc('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x4ccc('0xd')](function(_0xda4a49){logger[_0x4ccc('0xe')](_0x4ccc('0x21'),_0x44a4a7);logger['debug'](_0x4ccc('0x21'),_0x44a4a7,JSON[_0x4ccc('0x20')](_0xda4a49));_0x4c889f(_0xda4a49);})['catch'](function(_0x129222){logger[_0x4ccc('0x13')](_0x4ccc('0x21'),_0x129222[_0x4ccc('0x15')],_0x44a4a7);_0x250578(_0x378a9a[_0x4ccc('0x13')](0x1f4,_0x129222[_0x4ccc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.socket.js b/server/api/cmContact/cmContact.socket.js index b6db5e2..9014096 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 _0x4074=['./cmContact.events','save','remove','emit','removeListener','register','length','cmContact:'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x4074,0xf0));var _0x4407=function(_0x17df8e,_0x24d406){_0x17df8e=_0x17df8e-0x0;var _0x3cc1a0=_0x4074[_0x17df8e];return _0x3cc1a0;};'use strict';var CmContactEvents=require(_0x4407('0x0'));var events=[_0x4407('0x1'),_0x4407('0x2'),'update'];function createListener(_0x1021e6,_0x2a756){return function(_0x14c0bc){_0x2a756[_0x4407('0x3')](_0x1021e6,_0x14c0bc);};}function removeListener(_0x188494,_0x3c9f5c){return function(){CmContactEvents[_0x4407('0x4')](_0x188494,_0x3c9f5c);};}exports[_0x4407('0x5')]=function(_0x3f085d){for(var _0x35899d=0x0,_0x4933cf=events[_0x4407('0x6')];_0x35899d<_0x4933cf;_0x35899d++){var _0x5f0699=events[_0x35899d];var _0x414f0a=createListener(_0x4407('0x7')+_0x5f0699,_0x3f085d);CmContactEvents['on'](_0x5f0699,_0x414f0a);}}; \ No newline at end of file +var _0x57d4=['length','./cmContact.events','save','update','emit','removeListener','register'];(function(_0x24525c,_0x2e8b83){var _0x168f44=function(_0x531a35){while(--_0x531a35){_0x24525c['push'](_0x24525c['shift']());}};_0x168f44(++_0x2e8b83);}(_0x57d4,0x78));var _0x457d=function(_0x5d6f29,_0x39f1e3){_0x5d6f29=_0x5d6f29-0x0;var _0x6817c6=_0x57d4[_0x5d6f29];return _0x6817c6;};'use strict';var CmContactEvents=require(_0x457d('0x0'));var events=[_0x457d('0x1'),'remove',_0x457d('0x2')];function createListener(_0xa408c8,_0x1e26ab){return function(_0x30a25c){_0x1e26ab[_0x457d('0x3')](_0xa408c8,_0x30a25c);};}function removeListener(_0x3c89b2,_0x3e2239){return function(){CmContactEvents[_0x457d('0x4')](_0x3c89b2,_0x3e2239);};}exports[_0x457d('0x5')]=function(_0x247ec7){for(var _0x3fd867=0x0,_0x5c6816=events[_0x457d('0x6')];_0x3fd867<_0x5c6816;_0x3fd867++){var _0x381e22=events[_0x3fd867];var _0x4e32c0=createListener('cmContact:'+_0x381e22,_0x247ec7);CmContactEvents['on'](_0x381e22,_0x4e32c0);}}; \ No newline at end of file diff --git a/server/api/cmContact/index.js b/server/api/cmContact/index.js index fe3f18a..adb3e91 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 _0x1f3f=['single','file','%s-%s%s','now','import','put','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','get','index','/describe','/:id','isAuthenticated','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getJscriptySessions','post','/merge','create','/create_many','bulkCreate','diskStorage','join','root','server/files/tmp','originalname','replace','format','basename','extname'];(function(_0x4684bb,_0x5c37e7){var _0x146724=function(_0x409499){while(--_0x409499){_0x4684bb['push'](_0x4684bb['shift']());}};_0x146724(++_0x5c37e7);}(_0x1f3f,0x13d));var _0xf1f3=function(_0x3e3d0a,_0x4745dd){_0x3e3d0a=_0x3e3d0a-0x0;var _0x3fc765=_0x1f3f[_0x3e3d0a];return _0x3fc765;};'use strict';var multer=require(_0xf1f3('0x0'));var util=require(_0xf1f3('0x1'));var path=require(_0xf1f3('0x2'));var express=require(_0xf1f3('0x3'));var router=express[_0xf1f3('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf1f3('0x5'));var config=require('../../config/environment');var controller=require('./cmContact.controller');router[_0xf1f3('0x6')]('/',auth['isAuthenticated'](),controller[_0xf1f3('0x7')]);router[_0xf1f3('0x6')](_0xf1f3('0x8'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xf1f3('0x9'),auth[_0xf1f3('0xa')](),controller[_0xf1f3('0xb')]);router['get'](_0xf1f3('0xc'),auth['isAuthenticated'](),controller[_0xf1f3('0xd')]);router[_0xf1f3('0x6')](_0xf1f3('0xe'),auth[_0xf1f3('0xa')](),controller[_0xf1f3('0xf')]);router[_0xf1f3('0x6')](_0xf1f3('0x10'),auth[_0xf1f3('0xa')](),controller[_0xf1f3('0x11')]);router[_0xf1f3('0x6')](_0xf1f3('0x12'),auth[_0xf1f3('0xa')](),controller[_0xf1f3('0x13')]);router[_0xf1f3('0x6')]('/:id/jscripty_sessions',auth[_0xf1f3('0xa')](),controller[_0xf1f3('0x14')]);router[_0xf1f3('0x15')](_0xf1f3('0x16'),auth[_0xf1f3('0xa')](),controller['merge']);router[_0xf1f3('0x15')]('/',auth['isAuthenticated'](),controller[_0xf1f3('0x17')]);router['post'](_0xf1f3('0x18'),auth['isAuthenticated'](),controller[_0xf1f3('0x19')]);router['post'](_0xf1f3('0xc'),auth[_0xf1f3('0xa')](),controller['setTags']);var upload=multer({'storage':multer[_0xf1f3('0x1a')]({'destination':function(_0x127b35,_0xfd0cee,_0x1dd2c7){_0x1dd2c7(null,path[_0xf1f3('0x1b')](config[_0xf1f3('0x1c')],_0xf1f3('0x1d')));},'filename':function(_0x1035ad,_0x165f2c,_0x5c06b1){_0x165f2c[_0xf1f3('0x1e')]=_0x165f2c[_0xf1f3('0x1e')][_0xf1f3('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5c06b1(null,util[_0xf1f3('0x20')]('%s-%s%s',path[_0xf1f3('0x21')](_0x165f2c[_0xf1f3('0x1e')],path[_0xf1f3('0x22')](_0x165f2c['originalname'])),Date['now'](),path[_0xf1f3('0x22')](_0x165f2c[_0xf1f3('0x1e')])));}})});router[_0xf1f3('0x15')]('/csv',upload[_0xf1f3('0x23')](_0xf1f3('0x24')),controller['uploadCsv']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x324b5b,_0xc2ce40,_0x42d8f0){_0x42d8f0(null,path[_0xf1f3('0x1b')](config['root'],_0xf1f3('0x1d')));},'filename':function(_0x20a24a,_0x55ba07,_0x306c36){_0x55ba07[_0xf1f3('0x1e')]=_0x55ba07[_0xf1f3('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x306c36(null,util[_0xf1f3('0x20')](_0xf1f3('0x25'),path[_0xf1f3('0x21')](_0x55ba07[_0xf1f3('0x1e')],path[_0xf1f3('0x22')](_0x55ba07[_0xf1f3('0x1e')])),Date[_0xf1f3('0x26')](),path['extname'](_0x55ba07['originalname'])));}})});router[_0xf1f3('0x15')]('/upload',upload[_0xf1f3('0x23')]('file'),controller['upload']);router[_0xf1f3('0x15')]('/upload/:id',auth['isAuthenticated'](),controller[_0xf1f3('0x27')]);router[_0xf1f3('0x28')](_0xf1f3('0x9'),auth[_0xf1f3('0xa')](),controller['update']);router[_0xf1f3('0x29')](_0xf1f3('0x9'),auth[_0xf1f3('0xa')](),controller[_0xf1f3('0x2a')]);module[_0xf1f3('0x2b')]=router; \ No newline at end of file +var _0x9fc7=['now','file','uploadCsv','diskStorage','replace','basename','/upload','/upload/:id','import','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','./cmContact.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/tags','getTags','getHoppers','/:id/hopper_histories','getHopperHistories','post','/merge','merge','create','/create_many','bulkCreate','join','server/files/tmp','originalname','format','%s-%s%s','extname'];(function(_0x22cc06,_0x5585c7){var _0x4dcb6f=function(_0x2b114a){while(--_0x2b114a){_0x22cc06['push'](_0x22cc06['shift']());}};_0x4dcb6f(++_0x5585c7);}(_0x9fc7,0x190));var _0x79fc=function(_0x238977,_0x2d6f8e){_0x238977=_0x238977-0x0;var _0x48231f=_0x9fc7[_0x238977];return _0x48231f;};'use strict';var multer=require(_0x79fc('0x0'));var util=require(_0x79fc('0x1'));var path=require(_0x79fc('0x2'));var express=require(_0x79fc('0x3'));var router=express[_0x79fc('0x4')]();var auth=require(_0x79fc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x79fc('0x6'));router[_0x79fc('0x7')]('/',auth[_0x79fc('0x8')](),controller[_0x79fc('0x9')]);router['get'](_0x79fc('0xa'),auth[_0x79fc('0x8')](),controller['describe']);router[_0x79fc('0x7')](_0x79fc('0xb'),auth[_0x79fc('0x8')](),controller[_0x79fc('0xc')]);router[_0x79fc('0x7')](_0x79fc('0xd'),auth[_0x79fc('0x8')](),controller[_0x79fc('0xe')]);router[_0x79fc('0x7')]('/:id/hoppers',auth[_0x79fc('0x8')](),controller[_0x79fc('0xf')]);router[_0x79fc('0x7')](_0x79fc('0x10'),auth[_0x79fc('0x8')](),controller[_0x79fc('0x11')]);router[_0x79fc('0x7')]('/:id/hopper_finals',auth[_0x79fc('0x8')](),controller['getHopperFinals']);router[_0x79fc('0x7')]('/:id/jscripty_sessions',auth['isAuthenticated'](),controller['getJscriptySessions']);router[_0x79fc('0x12')](_0x79fc('0x13'),auth['isAuthenticated'](),controller[_0x79fc('0x14')]);router[_0x79fc('0x12')]('/',auth[_0x79fc('0x8')](),controller[_0x79fc('0x15')]);router[_0x79fc('0x12')](_0x79fc('0x16'),auth[_0x79fc('0x8')](),controller[_0x79fc('0x17')]);router[_0x79fc('0x12')](_0x79fc('0xd'),auth[_0x79fc('0x8')](),controller['setTags']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4c782f,_0x385aa5,_0x3d1c1a){_0x3d1c1a(null,path[_0x79fc('0x18')](config['root'],_0x79fc('0x19')));},'filename':function(_0x4c44e2,_0x240d7f,_0x293d4d){_0x240d7f[_0x79fc('0x1a')]=_0x240d7f[_0x79fc('0x1a')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x293d4d(null,util[_0x79fc('0x1b')](_0x79fc('0x1c'),path['basename'](_0x240d7f[_0x79fc('0x1a')],path[_0x79fc('0x1d')](_0x240d7f['originalname'])),Date[_0x79fc('0x1e')](),path[_0x79fc('0x1d')](_0x240d7f[_0x79fc('0x1a')])));}})});router['post']('/csv',upload['single'](_0x79fc('0x1f')),controller[_0x79fc('0x20')]);var upload=multer({'storage':multer[_0x79fc('0x21')]({'destination':function(_0x234ee8,_0x506c52,_0x55529f){_0x55529f(null,path[_0x79fc('0x18')](config['root'],_0x79fc('0x19')));},'filename':function(_0x5c87fb,_0x262e38,_0x28060c){_0x262e38['originalname']=_0x262e38[_0x79fc('0x1a')][_0x79fc('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x28060c(null,util[_0x79fc('0x1b')](_0x79fc('0x1c'),path[_0x79fc('0x23')](_0x262e38[_0x79fc('0x1a')],path[_0x79fc('0x1d')](_0x262e38['originalname'])),Date[_0x79fc('0x1e')](),path['extname'](_0x262e38[_0x79fc('0x1a')])));}})});router['post'](_0x79fc('0x24'),upload['single'](_0x79fc('0x1f')),controller['upload']);router[_0x79fc('0x12')](_0x79fc('0x25'),auth[_0x79fc('0x8')](),controller[_0x79fc('0x26')]);router[_0x79fc('0x27')](_0x79fc('0xb'),auth['isAuthenticated'](),controller[_0x79fc('0x28')]);router[_0x79fc('0x29')](_0x79fc('0xb'),auth[_0x79fc('0x8')](),controller[_0x79fc('0x2a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 57a4899..ba92e54 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 _0x22de=['STRING','setDataValue','getDataValue','name','TEXT','long','parse','values','isArray','stringify','BOOLEAN','sequelize','lodash','exports','VIRTUAL','alias'];(function(_0x48af50,_0x9e9508){var _0x5570d8=function(_0x54c814){while(--_0x54c814){_0x48af50['push'](_0x48af50['shift']());}};_0x5570d8(++_0x9e9508);}(_0x22de,0xdb));var _0xe22d=function(_0x548068,_0x550179){_0x548068=_0x548068-0x0;var _0x1dd633=_0x22de[_0x548068];return _0x1dd633;};'use strict';var Sequelize=require(_0xe22d('0x0'));var _=require(_0xe22d('0x1'));module[_0xe22d('0x2')]={'name':{'type':Sequelize[_0xe22d('0x3')],'get':function(_0x4e0c75){return this['getDataValue'](_0xe22d('0x4'));}},'alias':{'type':Sequelize[_0xe22d('0x5')],'allowNull':![],'set':function(_0x353899){this[_0xe22d('0x6')](_0xe22d('0x4'),_0x353899?_0x353899:this[_0xe22d('0x7')](_0xe22d('0x8')));}},'type':{'type':Sequelize[_0xe22d('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xe22d('0x9')](_0xe22d('0xa')),'get':function(){if(this[_0xe22d('0x7')]('type')==='select'){return JSON[_0xe22d('0xb')](this[_0xe22d('0x7')](_0xe22d('0xc')));}else{return this[_0xe22d('0x7')](_0xe22d('0xc'));}},'set':function(_0x14c820){if(Array[_0xe22d('0xd')](_0x14c820)){this['setDataValue']('values',JSON[_0xe22d('0xe')](_0x14c820));}else{this[_0xe22d('0x6')](_0xe22d('0xc'),_0x14c820);}}},'required':{'type':Sequelize[_0xe22d('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0x0755=['alias','STRING','setDataValue','TEXT','type','select','values','isArray','stringify','sequelize','lodash','VIRTUAL','getDataValue'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x0755,0xcc));var _0x5075=function(_0x3be270,_0x468b14){_0x3be270=_0x3be270-0x0;var _0x1ba974=_0x0755[_0x3be270];return _0x1ba974;};'use strict';var Sequelize=require(_0x5075('0x0'));var _=require(_0x5075('0x1'));module['exports']={'name':{'type':Sequelize[_0x5075('0x2')],'get':function(_0x502d2d){return this[_0x5075('0x3')](_0x5075('0x4'));}},'alias':{'type':Sequelize[_0x5075('0x5')],'allowNull':![],'set':function(_0x1d1fc3){this[_0x5075('0x6')]('alias',_0x1d1fc3?_0x1d1fc3:this[_0x5075('0x3')]('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x5075('0x7')]('long'),'get':function(){if(this[_0x5075('0x3')](_0x5075('0x8'))===_0x5075('0x9')){return JSON['parse'](this[_0x5075('0x3')](_0x5075('0xa')));}else{return this[_0x5075('0x3')](_0x5075('0xa'));}},'set':function(_0x3dde48){if(Array[_0x5075('0xb')](_0x3dde48)){this[_0x5075('0x6')]('values',JSON[_0x5075('0xc')](_0x3dde48));}else{this[_0x5075('0x6')](_0x5075('0xa'),_0x3dde48);}}},'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 8832af4..e1ae614 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 _0x63c5=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','CmCustomField','rawAttributes','differenceBy','keys','query','dateStart','dateEnd','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','day','add','where','filter','merge','include','rows','catch','params','options','find','body','create','sequelize','transaction','Sequelize','TEXT','text','number','type','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs'];(function(_0x1663ae,_0x10484a){var _0x30ffb8=function(_0x21e006){while(--_0x21e006){_0x1663ae['push'](_0x1663ae['shift']());}};_0x30ffb8(++_0x10484a);}(_0x63c5,0xde));var _0x563c=function(_0x52096b,_0x20bab4){_0x52096b=_0x52096b-0x0;var _0x2b1cc7=_0x63c5[_0x52096b];return _0x2b1cc7;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x563c('0x0'));var BPromise=require(_0x563c('0x1'));var Mustache=require(_0x563c('0x2'));var util=require(_0x563c('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x563c('0x4'));var ejs=require(_0x563c('0x5'));var fs=require('fs');var _=require('lodash');var squel=require(_0x563c('0x6'));var crypto=require(_0x563c('0x7'));var jsforce=require(_0x563c('0x8'));var deskjs=require(_0x563c('0x9'));var toCsv=require('to-csv');var querystring=require(_0x563c('0xa'));var Papa=require('papaparse');var qs=require(_0x563c('0xb'));var logger=require(_0x563c('0xc'))('api');var utils=require(_0x563c('0xd'));var config=require(_0x563c('0xe'));var db=require(_0x563c('0xf'))['db'];function respondWithStatusCode(_0x29f927,_0x2bf1d6){_0x2bf1d6=_0x2bf1d6||0xcc;return function(_0x2330fd){if(_0x2330fd){return _0x29f927[_0x563c('0x10')](_0x2bf1d6);}return _0x29f927[_0x563c('0x11')](_0x2bf1d6)[_0x563c('0x12')]();};}function respondWithResult(_0x2a204f,_0x420e85){_0x420e85=_0x420e85||0xc8;return function(_0x4ba01f){if(_0x4ba01f){return _0x2a204f[_0x563c('0x11')](_0x420e85)[_0x563c('0x13')](_0x4ba01f);}};}function respondWithFilteredResult(_0x2febf8,_0x1b0b94){return function(_0x9cf36){if(_0x9cf36){var _0xf5cfa6=_0x9cf36[_0x563c('0x14')],_0x491bf4=_0x1b0b94['offset'],_0x26e98a=_0x1b0b94[_0x563c('0x15')]+_0x1b0b94[_0x563c('0x16')],_0x45b454;if(_0x26e98a>=_0xf5cfa6){_0x26e98a=_0xf5cfa6;_0x45b454=0xc8;}else{_0x45b454=0xce;}_0x2febf8[_0x563c('0x11')](_0x45b454);return _0x2febf8[_0x563c('0x17')](_0x563c('0x18'),_0x491bf4+'-'+_0x26e98a+'/'+_0xf5cfa6)['json'](_0x9cf36);}return null;};}function patchUpdates(_0x539d02){return function(_0x204aa9){try{jsonpatch[_0x563c('0x19')](_0x204aa9,_0x539d02,!![]);}catch(_0x2b7ba0){return BPromise[_0x563c('0x1a')](_0x2b7ba0);}return _0x204aa9[_0x563c('0x1b')]();};}function saveUpdates(_0x46c31f,_0x5cab19){return function(_0x86c745){if(_0x86c745){return _0x86c745[_0x563c('0x1c')](_0x46c31f)[_0x563c('0x1d')](function(_0x33e5b2){return _0x33e5b2;});}return null;};}function removeEntity(_0x28d753,_0x4c7ff2){return function(_0x54eed1){if(_0x54eed1){return _0x54eed1[_0x563c('0x1e')]()['then'](function(){_0x28d753[_0x563c('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5eb12a,_0xc86a26){return function(_0x378632){if(!_0x378632){_0x5eb12a[_0x563c('0x10')](0x194);}return _0x378632;};}function handleError(_0x2300a9,_0x5d5aa3){_0x5d5aa3=_0x5d5aa3||0x1f4;return function(_0x59e60b){logger['error'](_0x59e60b['stack']);if(_0x59e60b[_0x563c('0x1f')]){delete _0x59e60b[_0x563c('0x1f')];}_0x2300a9[_0x563c('0x11')](_0x5d5aa3)['send'](_0x59e60b);};}exports['index']=function(_0x2b0f70,_0x2f622c){var _0x56026c={},_0x52b146={},_0x24a6a9={'count':0x0,'rows':[]};var _0x24660a=db[_0x563c('0x20')][_0x563c('0x21')];_0x52b146['model']=_[_0x563c('0x22')](_[_0x563c('0x23')](_0x24660a),[_0x563c('0x1f')]);var _0x40cb12={'dateStart':_0x2b0f70[_0x563c('0x24')][_0x563c('0x25')],'dateEnd':_0x2b0f70[_0x563c('0x24')][_0x563c('0x26')]};delete _0x2b0f70[_0x563c('0x24')][_0x563c('0x25')];delete _0x2b0f70[_0x563c('0x24')][_0x563c('0x26')];_0x52b146[_0x563c('0x24')]=_[_0x563c('0x23')](_0x2b0f70[_0x563c('0x24')]);_0x52b146['filters']=_[_0x563c('0x27')](_0x52b146[_0x563c('0x28')],_0x52b146['query']);_0x56026c[_0x563c('0x29')]=_[_0x563c('0x27')](_0x52b146['model'],qs['fields'](_0x2b0f70[_0x563c('0x24')][_0x563c('0x2a')]));_0x56026c['attributes']=_0x56026c['attributes'][_0x563c('0x2b')]?_0x56026c[_0x563c('0x29')]:_0x52b146['model'];if(!_0x2b0f70[_0x563c('0x24')][_0x563c('0x2c')](_0x563c('0x2d'))){_0x56026c[_0x563c('0x16')]=qs[_0x563c('0x16')](_0x2b0f70[_0x563c('0x24')][_0x563c('0x16')]);_0x56026c[_0x563c('0x15')]=qs[_0x563c('0x15')](_0x2b0f70[_0x563c('0x24')][_0x563c('0x15')]);}_0x56026c[_0x563c('0x2e')]=qs['sort'](_0x2b0f70['query'][_0x563c('0x2f')]);_0x56026c['where']=qs['filters'](_[_0x563c('0x30')](_0x2b0f70[_0x563c('0x24')],_0x52b146[_0x563c('0x31')]));if(_0x40cb12[_0x563c('0x25')]){if(_0x40cb12['dateEnd']){_0x40cb12[_0x563c('0x26')]=moment(_0x40cb12[_0x563c('0x26')])['add'](0x1,_0x563c('0x32'));}else{_0x40cb12[_0x563c('0x26')]=moment(_0x40cb12[_0x563c('0x25')])[_0x563c('0x33')](0x1,_0x563c('0x32'));}_['merge'](_0x56026c[_0x563c('0x34')],{'createdAt':{'$gte':_0x40cb12['dateStart'],'$lte':_0x40cb12['dateEnd']}});}if(_0x2b0f70[_0x563c('0x24')][_0x563c('0x35')]){_0x56026c[_0x563c('0x34')]=_[_0x563c('0x36')](_0x56026c[_0x563c('0x34')],{'$or':_['map'](_0x56026c[_0x563c('0x29')],function(_0x54118d){var _0x8301fa={};_0x8301fa[_0x54118d]={'$like':'%'+_0x2b0f70['query']['filter']+'%'};return _0x8301fa;})});}_0x56026c=_[_0x563c('0x36')]({},_0x56026c,_0x2b0f70['options']);var _0x2b861d={'where':_0x56026c[_0x563c('0x34')]};return db['CmCustomField'][_0x563c('0x14')](_0x2b861d)[_0x563c('0x1d')](function(_0x53dd58){_0x24a6a9[_0x563c('0x14')]=_0x53dd58;if(_0x2b0f70[_0x563c('0x24')]['includeAll']){_0x56026c[_0x563c('0x37')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x56026c);})[_0x563c('0x1d')](function(_0x370682){_0x24a6a9[_0x563c('0x38')]=_0x370682;return _0x24a6a9;})[_0x563c('0x1d')](respondWithFilteredResult(_0x2f622c,_0x56026c))[_0x563c('0x39')](handleError(_0x2f622c,null));};exports['show']=function(_0x4ec75f,_0x1dbed8){var _0x554640={'raw':!![],'where':{'id':_0x4ec75f[_0x563c('0x3a')]['id']}},_0x42f76f={};_0x42f76f['model']=_[_0x563c('0x23')](db['CmCustomField']['rawAttributes']);_0x42f76f[_0x563c('0x24')]=_['keys'](_0x4ec75f[_0x563c('0x24')]);_0x42f76f[_0x563c('0x31')]=_[_0x563c('0x27')](_0x42f76f['model'],_0x42f76f[_0x563c('0x24')]);_0x554640['attributes']=_[_0x563c('0x27')](_0x42f76f[_0x563c('0x28')],qs[_0x563c('0x2a')](_0x4ec75f[_0x563c('0x24')][_0x563c('0x2a')]));_0x554640[_0x563c('0x29')]=_0x554640[_0x563c('0x29')][_0x563c('0x2b')]?_0x554640[_0x563c('0x29')]:_0x42f76f[_0x563c('0x28')];if(_0x4ec75f[_0x563c('0x24')]['includeAll']){_0x554640['include']=[{'all':!![]}];}_0x554640=_['merge']({},_0x554640,_0x4ec75f[_0x563c('0x3b')]);return db['CmCustomField'][_0x563c('0x3c')](_0x554640)[_0x563c('0x1d')](handleEntityNotFound(_0x1dbed8,null))[_0x563c('0x1d')](respondWithResult(_0x1dbed8,null))[_0x563c('0x39')](handleError(_0x1dbed8,null));};exports[_0x563c('0x1c')]=function(_0x400d83,_0x37cdb4){if(_0x400d83[_0x563c('0x3d')]['id']){delete _0x400d83[_0x563c('0x3d')]['id'];}return db[_0x563c('0x20')][_0x563c('0x3c')]({'where':{'id':_0x400d83['params']['id']}})[_0x563c('0x1d')](handleEntityNotFound(_0x37cdb4,null))['then'](saveUpdates(_0x400d83[_0x563c('0x3d')],null))[_0x563c('0x1d')](respondWithResult(_0x37cdb4,null))[_0x563c('0x39')](handleError(_0x37cdb4,null));};exports[_0x563c('0x1e')]=function(_0x50a78f,_0x176415){return db[_0x563c('0x20')][_0x563c('0x3c')]({'where':{'id':_0x50a78f[_0x563c('0x3a')]['id']}})[_0x563c('0x1d')](handleEntityNotFound(_0x176415,null))['then'](removeEntity(_0x176415,null))['catch'](handleError(_0x176415,null));};exports[_0x563c('0x3e')]=function(_0x2451bf,_0xd879a){var _0xf29521;return db[_0x563c('0x3f')][_0x563c('0x40')](function(_0x3adc48){return db['CmCustomField']['create'](_0x2451bf[_0x563c('0x3d')],{'transaction':_0x3adc48})[_0x563c('0x1d')](function(_0x39da22){_0xf29521=_0x39da22;var _0x5bac2a={'type':db[_0x563c('0x41')][_0x563c('0x42')],'transaction':_0x3adc48};switch(_0x2451bf['body']['type']){case _0x563c('0x43'):_0x5bac2a['type']=db[_0x563c('0x41')][_0x563c('0x42')];break;case _0x563c('0x44'):_0x5bac2a[_0x563c('0x45')]=db[_0x563c('0x41')]['INTEGER'];break;case _0x563c('0x46'):_0x5bac2a[_0x563c('0x45')]=db[_0x563c('0x41')][_0x563c('0x47')];_0x5bac2a[_0x563c('0x48')]=![];break;default:}return db[_0x563c('0x3f')][_0x563c('0x49')][_0x563c('0x4a')](_0x563c('0x4b'),util[_0x563c('0x4c')](_0x563c('0x4d'),_0xf29521['id']),_0x5bac2a);})[_0x563c('0x1d')](function(){return _0xf29521;});})['then'](respondWithResult(_0xd879a,0xc9))[_0x563c('0x39')](handleError(_0xd879a,null));}; \ No newline at end of file +var _0x75dd=['filter','map','count','includeAll','findAll','rows','show','params','include','options','find','body','catch','create','sequelize','Sequelize','TEXT','type','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','set','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','CmCustomField','rawAttributes','keys','query','dateStart','dateEnd','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','day','merge'];(function(_0x1f69b6,_0x14c4bf){var _0x220a4a=function(_0x6c2d3c){while(--_0x6c2d3c){_0x1f69b6['push'](_0x1f69b6['shift']());}};_0x220a4a(++_0x14c4bf);}(_0x75dd,0x6e));var _0xd75d=function(_0x1df3c5,_0x179765){_0x1df3c5=_0x1df3c5-0x0;var _0x241e97=_0x75dd[_0x1df3c5];return _0x241e97;};'use strict';var jsonpatch=require(_0xd75d('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd75d('0x1'));var Mustache=require(_0xd75d('0x2'));var util=require(_0xd75d('0x3'));var path=require(_0xd75d('0x4'));var sox=require(_0xd75d('0x5'));var csv=require(_0xd75d('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd75d('0x7'));var squel=require('squel');var crypto=require(_0xd75d('0x8'));var jsforce=require(_0xd75d('0x9'));var deskjs=require(_0xd75d('0xa'));var toCsv=require(_0xd75d('0x6'));var querystring=require(_0xd75d('0xb'));var Papa=require(_0xd75d('0xc'));var qs=require(_0xd75d('0xd'));var logger=require(_0xd75d('0xe'))(_0xd75d('0xf'));var utils=require(_0xd75d('0x10'));var config=require(_0xd75d('0x11'));var db=require(_0xd75d('0x12'))['db'];function respondWithStatusCode(_0x15a2ef,_0x464f4c){_0x464f4c=_0x464f4c||0xcc;return function(_0x256db8){if(_0x256db8){return _0x15a2ef['sendStatus'](_0x464f4c);}return _0x15a2ef[_0xd75d('0x13')](_0x464f4c)['end']();};}function respondWithResult(_0x44248a,_0x5b963f){_0x5b963f=_0x5b963f||0xc8;return function(_0x1ff825){if(_0x1ff825){return _0x44248a['status'](_0x5b963f)[_0xd75d('0x14')](_0x1ff825);}};}function respondWithFilteredResult(_0x3b97a6,_0x539fc1){return function(_0x4ef872){if(_0x4ef872){var _0x22d67f=_0x4ef872['count'],_0x408e93=_0x539fc1[_0xd75d('0x15')],_0x19967f=_0x539fc1[_0xd75d('0x15')]+_0x539fc1[_0xd75d('0x16')],_0x15dac1;if(_0x19967f>=_0x22d67f){_0x19967f=_0x22d67f;_0x15dac1=0xc8;}else{_0x15dac1=0xce;}_0x3b97a6[_0xd75d('0x13')](_0x15dac1);return _0x3b97a6[_0xd75d('0x17')]('Content-Range',_0x408e93+'-'+_0x19967f+'/'+_0x22d67f)[_0xd75d('0x14')](_0x4ef872);}return null;};}function patchUpdates(_0x315dc7){return function(_0x237296){try{jsonpatch[_0xd75d('0x18')](_0x237296,_0x315dc7,!![]);}catch(_0xbe9dda){return BPromise[_0xd75d('0x19')](_0xbe9dda);}return _0x237296[_0xd75d('0x1a')]();};}function saveUpdates(_0x3a211b,_0x5effe1){return function(_0x11c80c){if(_0x11c80c){return _0x11c80c[_0xd75d('0x1b')](_0x3a211b)[_0xd75d('0x1c')](function(_0x2a762e){return _0x2a762e;});}return null;};}function removeEntity(_0x56bef6,_0x59f973){return function(_0x404dda){if(_0x404dda){return _0x404dda[_0xd75d('0x1d')]()[_0xd75d('0x1c')](function(){_0x56bef6['status'](0xcc)[_0xd75d('0x1e')]();});}};}function handleEntityNotFound(_0x2ebb86,_0x42ad52){return function(_0x34c808){if(!_0x34c808){_0x2ebb86[_0xd75d('0x1f')](0x194);}return _0x34c808;};}function handleError(_0x51b1dc,_0x2b0bdc){_0x2b0bdc=_0x2b0bdc||0x1f4;return function(_0x35543f){logger[_0xd75d('0x20')](_0x35543f[_0xd75d('0x21')]);if(_0x35543f['name']){delete _0x35543f[_0xd75d('0x22')];}_0x51b1dc[_0xd75d('0x13')](_0x2b0bdc)['send'](_0x35543f);};}exports[_0xd75d('0x23')]=function(_0x4bca9c,_0x5a1956){var _0x5362fa={},_0x92728a={},_0x111e16={'count':0x0,'rows':[]};var _0x20b7bb=db[_0xd75d('0x24')][_0xd75d('0x25')];_0x92728a['model']=_['differenceBy'](_[_0xd75d('0x26')](_0x20b7bb),['name']);var _0x12b443={'dateStart':_0x4bca9c[_0xd75d('0x27')][_0xd75d('0x28')],'dateEnd':_0x4bca9c['query'][_0xd75d('0x29')]};delete _0x4bca9c['query'][_0xd75d('0x28')];delete _0x4bca9c[_0xd75d('0x27')][_0xd75d('0x29')];_0x92728a['query']=_[_0xd75d('0x26')](_0x4bca9c[_0xd75d('0x27')]);_0x92728a['filters']=_[_0xd75d('0x2a')](_0x92728a[_0xd75d('0x2b')],_0x92728a['query']);_0x5362fa['attributes']=_['intersection'](_0x92728a[_0xd75d('0x2b')],qs[_0xd75d('0x2c')](_0x4bca9c[_0xd75d('0x27')][_0xd75d('0x2c')]));_0x5362fa[_0xd75d('0x2d')]=_0x5362fa[_0xd75d('0x2d')][_0xd75d('0x2e')]?_0x5362fa[_0xd75d('0x2d')]:_0x92728a['model'];if(!_0x4bca9c['query'][_0xd75d('0x2f')](_0xd75d('0x30'))){_0x5362fa['limit']=qs[_0xd75d('0x16')](_0x4bca9c[_0xd75d('0x27')][_0xd75d('0x16')]);_0x5362fa['offset']=qs[_0xd75d('0x15')](_0x4bca9c['query'][_0xd75d('0x15')]);}_0x5362fa[_0xd75d('0x31')]=qs['sort'](_0x4bca9c['query'][_0xd75d('0x32')]);_0x5362fa[_0xd75d('0x33')]=qs[_0xd75d('0x34')](_[_0xd75d('0x35')](_0x4bca9c[_0xd75d('0x27')],_0x92728a[_0xd75d('0x34')]));if(_0x12b443['dateStart']){if(_0x12b443[_0xd75d('0x29')]){_0x12b443[_0xd75d('0x29')]=moment(_0x12b443[_0xd75d('0x29')])['add'](0x1,_0xd75d('0x36'));}else{_0x12b443[_0xd75d('0x29')]=moment(_0x12b443[_0xd75d('0x28')])['add'](0x1,_0xd75d('0x36'));}_[_0xd75d('0x37')](_0x5362fa['where'],{'createdAt':{'$gte':_0x12b443['dateStart'],'$lte':_0x12b443[_0xd75d('0x29')]}});}if(_0x4bca9c[_0xd75d('0x27')][_0xd75d('0x38')]){_0x5362fa[_0xd75d('0x33')]=_[_0xd75d('0x37')](_0x5362fa['where'],{'$or':_[_0xd75d('0x39')](_0x5362fa[_0xd75d('0x2d')],function(_0x1f22fb){var _0x2e8b68={};_0x2e8b68[_0x1f22fb]={'$like':'%'+_0x4bca9c[_0xd75d('0x27')]['filter']+'%'};return _0x2e8b68;})});}_0x5362fa=_['merge']({},_0x5362fa,_0x4bca9c['options']);var _0x5a2ae7={'where':_0x5362fa[_0xd75d('0x33')]};return db[_0xd75d('0x24')][_0xd75d('0x3a')](_0x5a2ae7)[_0xd75d('0x1c')](function(_0x52f0ba){_0x111e16[_0xd75d('0x3a')]=_0x52f0ba;if(_0x4bca9c[_0xd75d('0x27')][_0xd75d('0x3b')]){_0x5362fa['include']=[{'all':!![]}];}return db[_0xd75d('0x24')][_0xd75d('0x3c')](_0x5362fa);})[_0xd75d('0x1c')](function(_0x7e4187){_0x111e16[_0xd75d('0x3d')]=_0x7e4187;return _0x111e16;})[_0xd75d('0x1c')](respondWithFilteredResult(_0x5a1956,_0x5362fa))['catch'](handleError(_0x5a1956,null));};exports[_0xd75d('0x3e')]=function(_0x2266c8,_0x54f3a8){var _0xb64e40={'raw':!![],'where':{'id':_0x2266c8[_0xd75d('0x3f')]['id']}},_0x867c2c={};_0x867c2c[_0xd75d('0x2b')]=_[_0xd75d('0x26')](db[_0xd75d('0x24')][_0xd75d('0x25')]);_0x867c2c[_0xd75d('0x27')]=_['keys'](_0x2266c8[_0xd75d('0x27')]);_0x867c2c[_0xd75d('0x34')]=_['intersection'](_0x867c2c[_0xd75d('0x2b')],_0x867c2c[_0xd75d('0x27')]);_0xb64e40[_0xd75d('0x2d')]=_['intersection'](_0x867c2c[_0xd75d('0x2b')],qs[_0xd75d('0x2c')](_0x2266c8[_0xd75d('0x27')][_0xd75d('0x2c')]));_0xb64e40[_0xd75d('0x2d')]=_0xb64e40[_0xd75d('0x2d')][_0xd75d('0x2e')]?_0xb64e40[_0xd75d('0x2d')]:_0x867c2c[_0xd75d('0x2b')];if(_0x2266c8[_0xd75d('0x27')][_0xd75d('0x3b')]){_0xb64e40[_0xd75d('0x40')]=[{'all':!![]}];}_0xb64e40=_[_0xd75d('0x37')]({},_0xb64e40,_0x2266c8[_0xd75d('0x41')]);return db[_0xd75d('0x24')][_0xd75d('0x42')](_0xb64e40)[_0xd75d('0x1c')](handleEntityNotFound(_0x54f3a8,null))[_0xd75d('0x1c')](respondWithResult(_0x54f3a8,null))['catch'](handleError(_0x54f3a8,null));};exports[_0xd75d('0x1b')]=function(_0x4c722c,_0x206716){if(_0x4c722c[_0xd75d('0x43')]['id']){delete _0x4c722c[_0xd75d('0x43')]['id'];}return db[_0xd75d('0x24')]['find']({'where':{'id':_0x4c722c['params']['id']}})[_0xd75d('0x1c')](handleEntityNotFound(_0x206716,null))[_0xd75d('0x1c')](saveUpdates(_0x4c722c[_0xd75d('0x43')],null))[_0xd75d('0x1c')](respondWithResult(_0x206716,null))[_0xd75d('0x44')](handleError(_0x206716,null));};exports['destroy']=function(_0xfe51b9,_0x1c106a){return db[_0xd75d('0x24')][_0xd75d('0x42')]({'where':{'id':_0xfe51b9[_0xd75d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1c106a,null))['then'](removeEntity(_0x1c106a,null))[_0xd75d('0x44')](handleError(_0x1c106a,null));};exports[_0xd75d('0x45')]=function(_0x116882,_0x395326){var _0x433972;return db[_0xd75d('0x46')]['transaction'](function(_0x1272eb){return db[_0xd75d('0x24')][_0xd75d('0x45')](_0x116882[_0xd75d('0x43')],{'transaction':_0x1272eb})['then'](function(_0x7082b7){_0x433972=_0x7082b7;var _0x231f17={'type':db[_0xd75d('0x47')][_0xd75d('0x48')],'transaction':_0x1272eb};switch(_0x116882['body'][_0xd75d('0x49')]){case _0xd75d('0x4a'):_0x231f17['type']=db[_0xd75d('0x47')][_0xd75d('0x48')];break;case _0xd75d('0x4b'):_0x231f17[_0xd75d('0x49')]=db['Sequelize'][_0xd75d('0x4c')];break;case _0xd75d('0x4d'):_0x231f17[_0xd75d('0x49')]=db[_0xd75d('0x47')][_0xd75d('0x4e')];_0x231f17[_0xd75d('0x4f')]=![];break;default:}return db['sequelize'][_0xd75d('0x50')]['addColumn'](_0xd75d('0x51'),util[_0xd75d('0x52')]('cf_%d',_0x433972['id']),_0x231f17);})[_0xd75d('0x1c')](function(){return _0x433972;});})[_0xd75d('0x1c')](respondWithResult(_0x395326,0xc9))[_0xd75d('0x44')](handleError(_0x395326,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 30b717f..d168909 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 _0xd6d2=['CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','define'];(function(_0x43b0a6,_0x4e08bb){var _0x355aa2=function(_0x16b254){while(--_0x16b254){_0x43b0a6['push'](_0x43b0a6['shift']());}};_0x355aa2(++_0x4e08bb);}(_0xd6d2,0xf2));var _0x2d6d=function(_0x1274cd,_0x5b00d6){_0x1274cd=_0x1274cd-0x0;var _0x3095c2=_0xd6d2[_0x1274cd];return _0x3095c2;};'use strict';var _=require(_0x2d6d('0x0'));var util=require(_0x2d6d('0x1'));var logger=require(_0x2d6d('0x2'))(_0x2d6d('0x3'));var moment=require(_0x2d6d('0x4'));var BPromise=require(_0x2d6d('0x5'));var rp=require(_0x2d6d('0x6'));var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x3bfb68,_0x2d4cc7){return _0x3bfb68[_0x2d6d('0x7')](_0x2d6d('0x8'),attributes,{'tableName':_0x2d6d('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60b6=['CmCustomField','cm_custom_fields','../../config/logger','api','moment','bluebird','./cmCustomField.attributes','define'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x60b6,0xea));var _0x660b=function(_0x11a5bc,_0x192310){_0x11a5bc=_0x11a5bc-0x0;var _0xea8223=_0x60b6[_0x11a5bc];return _0xea8223;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x660b('0x0'))(_0x660b('0x1'));var moment=require(_0x660b('0x2'));var BPromise=require(_0x660b('0x3'));var rp=require('request-promise');var attributes=require(_0x660b('0x4'));module['exports']=function(_0x2e9436,_0x522ccb){return _0x2e9436[_0x660b('0x5')](_0x660b('0x6'),attributes,{'tableName':_0x660b('0x7'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index ec838f7..cf0f320 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 _0xff43=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x2990a6,_0x4374bf){var _0x4b64fb=function(_0x4e7ccb){while(--_0x4e7ccb){_0x2990a6['push'](_0x2990a6['shift']());}};_0x4b64fb(++_0x4374bf);}(_0xff43,0x65));var _0x3ff4=function(_0x50a444,_0x4e34ac){_0x50a444=_0x50a444-0x0;var _0xaf00ac=_0xff43[_0x50a444];return _0xaf00ac;};'use strict';var _=require('lodash');var util=require(_0x3ff4('0x0'));var moment=require(_0x3ff4('0x1'));var BPromise=require(_0x3ff4('0x2'));var rs=require(_0x3ff4('0x3'));var fs=require('fs');var db=require(_0x3ff4('0x4'))['db'];var utils=require(_0x3ff4('0x5'));var logger=require(_0x3ff4('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3ff4('0x7'));var client=jayson[_0x3ff4('0x8')][_0x3ff4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30167e,_0xf3b14c,_0x260334){return new BPromise(function(_0x394fe6,_0x50266b){return client[_0x3ff4('0xa')](_0x30167e,_0x260334)[_0x3ff4('0xb')](function(_0x396df8){logger[_0x3ff4('0xc')](_0x3ff4('0xd'),_0xf3b14c,_0x3ff4('0xe'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0xf3b14c,'request\x20sent',JSON[_0x3ff4('0xf')](_0x396df8));if(_0x396df8[_0x3ff4('0x10')]){if(_0x396df8[_0x3ff4('0x10')]['code']===0x1f4){logger[_0x3ff4('0x10')]('CmCustomField,\x20%s,\x20%s',_0xf3b14c,_0x396df8[_0x3ff4('0x10')][_0x3ff4('0x11')]);return _0x50266b(_0x396df8['error'][_0x3ff4('0x11')]);}logger[_0x3ff4('0x10')](_0x3ff4('0xd'),_0xf3b14c,_0x396df8[_0x3ff4('0x10')][_0x3ff4('0x11')]);return _0x394fe6(_0x396df8[_0x3ff4('0x10')][_0x3ff4('0x11')]);}else{logger['info'](_0x3ff4('0xd'),_0xf3b14c,_0x3ff4('0xe'));_0x394fe6(_0x396df8[_0x3ff4('0x12')][_0x3ff4('0x11')]);}})[_0x3ff4('0x13')](function(_0x28e951){logger[_0x3ff4('0x10')]('CmCustomField,\x20%s,\x20%s',_0xf3b14c,_0x28e951);_0x50266b(_0x28e951);});});} \ No newline at end of file +var _0xece2=['randomstring','../../mysqldb','../../config/environment','client','http','request','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','moment'];(function(_0x51b758,_0x3b6975){var _0xaabed5=function(_0x55851b){while(--_0x55851b){_0x51b758['push'](_0x51b758['shift']());}};_0xaabed5(++_0x3b6975);}(_0xece2,0x1f2));var _0x2ece=function(_0x43b2da,_0x591c68){_0x43b2da=_0x43b2da-0x0;var _0x14acf8=_0xece2[_0x43b2da];return _0x14acf8;};'use strict';var _=require(_0x2ece('0x0'));var util=require('util');var moment=require(_0x2ece('0x1'));var BPromise=require('bluebird');var rs=require(_0x2ece('0x2'));var fs=require('fs');var db=require(_0x2ece('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2ece('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x2ece('0x5')][_0x2ece('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x589ab4,_0x1b8b46,_0x545682){return new BPromise(function(_0x8a3d11,_0x118fc6){return client[_0x2ece('0x7')](_0x589ab4,_0x545682)[_0x2ece('0x8')](function(_0x5a7c28){logger[_0x2ece('0x9')]('CmCustomField,\x20%s,\x20%s',_0x1b8b46,_0x2ece('0xa'));logger[_0x2ece('0xb')](_0x2ece('0xc'),_0x1b8b46,_0x2ece('0xa'),JSON[_0x2ece('0xd')](_0x5a7c28));if(_0x5a7c28[_0x2ece('0xe')]){if(_0x5a7c28[_0x2ece('0xe')][_0x2ece('0xf')]===0x1f4){logger[_0x2ece('0xe')](_0x2ece('0x10'),_0x1b8b46,_0x5a7c28[_0x2ece('0xe')][_0x2ece('0x11')]);return _0x118fc6(_0x5a7c28[_0x2ece('0xe')][_0x2ece('0x11')]);}logger[_0x2ece('0xe')](_0x2ece('0x10'),_0x1b8b46,_0x5a7c28[_0x2ece('0xe')][_0x2ece('0x11')]);return _0x8a3d11(_0x5a7c28[_0x2ece('0xe')][_0x2ece('0x11')]);}else{logger[_0x2ece('0x9')](_0x2ece('0x10'),_0x1b8b46,'request\x20sent');_0x8a3d11(_0x5a7c28[_0x2ece('0x12')]['message']);}})[_0x2ece('0x13')](function(_0x5b73c2){logger[_0x2ece('0xe')](_0x2ece('0x10'),_0x1b8b46,_0x5b73c2);_0x118fc6(_0x5b73c2);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index e95e355..e5f8be8 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 _0x036f=['get','index','/:id','isAuthenticated','show','post','create','update','destroy','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','./cmCustomField.controller'];(function(_0x32175b,_0x8f7caf){var _0x59d1cc=function(_0x391c91){while(--_0x391c91){_0x32175b['push'](_0x32175b['shift']());}};_0x59d1cc(++_0x8f7caf);}(_0x036f,0x1c4));var _0xf036=function(_0x4c06ac,_0x568788){_0x4c06ac=_0x4c06ac-0x0;var _0x2333cb=_0x036f[_0x4c06ac];return _0x2333cb;};'use strict';var multer=require(_0xf036('0x0'));var util=require(_0xf036('0x1'));var path=require('path');var express=require(_0xf036('0x2'));var router=express[_0xf036('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf036('0x4'));var config=require(_0xf036('0x5'));var controller=require(_0xf036('0x6'));router[_0xf036('0x7')]('/',auth['isAuthenticated'](),controller[_0xf036('0x8')]);router[_0xf036('0x7')](_0xf036('0x9'),auth[_0xf036('0xa')](),controller[_0xf036('0xb')]);router[_0xf036('0xc')]('/',auth[_0xf036('0xa')](),controller[_0xf036('0xd')]);router['put'](_0xf036('0x9'),auth[_0xf036('0xa')](),controller[_0xf036('0xe')]);router['delete'](_0xf036('0x9'),auth[_0xf036('0xa')](),controller[_0xf036('0xf')]);module[_0xf036('0x10')]=router; \ No newline at end of file +var _0xad50=['/:id','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','isAuthenticated','post','create','put'];(function(_0x4abd62,_0x374ab1){var _0x31e57e=function(_0x444d1a){while(--_0x444d1a){_0x4abd62['push'](_0x4abd62['shift']());}};_0x31e57e(++_0x374ab1);}(_0xad50,0x8a));var _0x0ad5=function(_0x5d6e35,_0x4d1ac0){_0x5d6e35=_0x5d6e35-0x0;var _0x5d7ada=_0xad50[_0x5d6e35];return _0x5d7ada;};'use strict';var multer=require(_0x0ad5('0x0'));var util=require('util');var path=require(_0x0ad5('0x1'));var express=require(_0x0ad5('0x2'));var router=express[_0x0ad5('0x3')]();var auth=require(_0x0ad5('0x4'));var interaction=require(_0x0ad5('0x5'));var config=require(_0x0ad5('0x6'));var controller=require(_0x0ad5('0x7'));router[_0x0ad5('0x8')]('/',auth['isAuthenticated'](),controller[_0x0ad5('0x9')]);router[_0x0ad5('0x8')]('/:id',auth[_0x0ad5('0xa')](),controller['show']);router[_0x0ad5('0xb')]('/',auth[_0x0ad5('0xa')](),controller[_0x0ad5('0xc')]);router[_0x0ad5('0xd')](_0x0ad5('0xe'),auth[_0x0ad5('0xa')](),controller[_0x0ad5('0xf')]);router[_0x0ad5('0x10')](_0x0ad5('0xe'),auth[_0x0ad5('0xa')](),controller[_0x0ad5('0x11')]);module[_0x0ad5('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 44b8dd0..ebe2fcb 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 _0x2b15=['contactListQueue','moment','sequelize','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','UNSIGNED'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x2b15,0x141));var _0x52b1=function(_0x10dc94,_0x2fed4f){_0x10dc94=_0x10dc94-0x0;var _0x4a462d=_0x2b15[_0x10dc94];return _0x4a462d;};'use strict';var moment=require(_0x52b1('0x0'));var Sequelize=require(_0x52b1('0x1'));module['exports']={'phone':{'type':Sequelize[_0x52b1('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x52b1('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x52b1('0x4')](_0x52b1('0x5'))},'countbusyretry':{'type':Sequelize[_0x52b1('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x52b1('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x52b1('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x52b1('0x7')]},'priority':{'type':Sequelize[_0x52b1('0x6')](0x2)[_0x52b1('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x52b1('0x6')],'unique':_0x52b1('0x9')},'ListId':{'type':Sequelize[_0x52b1('0x6')],'unique':_0x52b1('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x52b1('0x9')},'CampaignId':{'type':Sequelize[_0x52b1('0x6')]}}; \ No newline at end of file +var _0x1b42=['exports','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue'];(function(_0x5ec945,_0x48d653){var _0x2325ef=function(_0x18cc50){while(--_0x18cc50){_0x5ec945['push'](_0x5ec945['shift']());}};_0x2325ef(++_0x48d653);}(_0x1b42,0x1c2));var _0x21b4=function(_0x215264,_0x5d4324){_0x215264=_0x215264-0x0;var _0x1965ed=_0x1b42[_0x215264];return _0x1965ed;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x21b4('0x0')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x21b4('0x1')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x21b4('0x2')],'defaultValue':moment()[_0x21b4('0x3')](_0x21b4('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x21b4('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x21b4('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x21b4('0x1')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x21b4('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x21b4('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x21b4('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x21b4('0x1')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x21b4('0x8')},'ListId':{'type':Sequelize[_0x21b4('0x5')],'unique':_0x21b4('0x8')},'UserId':{'type':Sequelize[_0x21b4('0x5')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x21b4('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 080d6b7..cf13f36 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 _0x3308=['moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','CmHopper','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','add','day','merge','filter','where','map','options','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','update','params','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','end','getPreview','getVoiceQueues','preview','sequelize','transaction','isEmpty','hopperIds','findOne','scheduledat','priority','DESC','dialOrderByScheduledAt','ASC','UPDATE','Contact','Company','CmList','List','Queue','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','fast-json-patch','request-promise'];(function(_0x454e70,_0x5367ae){var _0x57a428=function(_0x995a6){while(--_0x995a6){_0x454e70['push'](_0x454e70['shift']());}};_0x57a428(++_0x5367ae);}(_0x3308,0x160));var _0x8330=function(_0x4c1f59,_0x11dbda){_0x4c1f59=_0x4c1f59-0x0;var _0x307147=_0x3308[_0x4c1f59];return _0x307147;};'use strict';var jsonpatch=require(_0x8330('0x0'));var rp=require(_0x8330('0x1'));var moment=require(_0x8330('0x2'));var BPromise=require(_0x8330('0x3'));var Mustache=require(_0x8330('0x4'));var util=require(_0x8330('0x5'));var path=require(_0x8330('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8330('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8330('0x8'));var crypto=require(_0x8330('0x9'));var jsforce=require(_0x8330('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8330('0xb'));var querystring=require(_0x8330('0xc'));var Papa=require(_0x8330('0xd'));var qs=require(_0x8330('0xe'));var logger=require(_0x8330('0xf'))(_0x8330('0x10'));var utils=require('../../config/utils');var config=require(_0x8330('0x11'));var db=require(_0x8330('0x12'))['db'];function respondWithStatusCode(_0xc80f4c,_0x5ec516){_0x5ec516=_0x5ec516||0xcc;return function(_0x52522c){if(_0x52522c){return _0xc80f4c['sendStatus'](_0x5ec516);}return _0xc80f4c['status'](_0x5ec516)['end']();};}function respondWithResult(_0x54a18b,_0x30e631){_0x30e631=_0x30e631||0xc8;return function(_0x55db5c){if(_0x55db5c){return _0x54a18b[_0x8330('0x13')](_0x30e631)[_0x8330('0x14')](_0x55db5c);}};}function respondWithFilteredResult(_0x252953,_0x3ceb1e){return function(_0x306b34){if(_0x306b34){var _0x4ee58b=_0x306b34[_0x8330('0x15')],_0x199da4=_0x3ceb1e[_0x8330('0x16')],_0x4f0cf0=_0x3ceb1e[_0x8330('0x16')]+_0x3ceb1e[_0x8330('0x17')],_0x293658;if(_0x4f0cf0>=_0x4ee58b){_0x4f0cf0=_0x4ee58b;_0x293658=0xc8;}else{_0x293658=0xce;}_0x252953[_0x8330('0x13')](_0x293658);return _0x252953[_0x8330('0x18')](_0x8330('0x19'),_0x199da4+'-'+_0x4f0cf0+'/'+_0x4ee58b)[_0x8330('0x14')](_0x306b34);}return null;};}function patchUpdates(_0x4d9662){return function(_0x27ebf8){try{jsonpatch[_0x8330('0x1a')](_0x27ebf8,_0x4d9662,!![]);}catch(_0x47895b){return BPromise[_0x8330('0x1b')](_0x47895b);}return _0x27ebf8[_0x8330('0x1c')]();};}function saveUpdates(_0x457dc7,_0x56fc18){return function(_0xca2672){if(_0xca2672){return _0xca2672['update'](_0x457dc7)[_0x8330('0x1d')](function(_0x58e614){return _0x58e614;});}return null;};}function removeEntity(_0x3e8c0e,_0x16a208){return function(_0x57a7f6){if(_0x57a7f6){return _0x57a7f6[_0x8330('0x1e')]()['then'](function(){_0x3e8c0e[_0x8330('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x239822,_0x1fc4e8){return function(_0x1b213f){if(!_0x1b213f){_0x239822[_0x8330('0x1f')](0x194);}return _0x1b213f;};}function handleError(_0x317045,_0x1ebee7){_0x1ebee7=_0x1ebee7||0x1f4;return function(_0x121d03){logger[_0x8330('0x20')](_0x121d03[_0x8330('0x21')]);if(_0x121d03[_0x8330('0x22')]){delete _0x121d03[_0x8330('0x22')];}_0x317045['status'](_0x1ebee7)['send'](_0x121d03);};}exports['index']=function(_0x23a439,_0x1fb538){var _0x36db54={},_0xa04d8={},_0x44adb5={'count':0x0,'rows':[]};var _0x7ea841=db[_0x8330('0x23')]['rawAttributes'];_0xa04d8[_0x8330('0x24')]=_[_0x8330('0x25')](_0x7ea841);var _0x545e15={'dateStart':_0x23a439[_0x8330('0x26')][_0x8330('0x27')],'dateEnd':_0x23a439[_0x8330('0x26')][_0x8330('0x28')]};delete _0x23a439[_0x8330('0x26')]['dateStart'];delete _0x23a439[_0x8330('0x26')]['dateEnd'];_0xa04d8[_0x8330('0x26')]=_[_0x8330('0x25')](_0x23a439[_0x8330('0x26')]);_0xa04d8['filters']=_[_0x8330('0x29')](_0xa04d8[_0x8330('0x24')],_0xa04d8['query']);_0x36db54[_0x8330('0x2a')]=_['intersection'](_0xa04d8[_0x8330('0x24')],qs[_0x8330('0x2b')](_0x23a439[_0x8330('0x26')][_0x8330('0x2b')]));_0x36db54[_0x8330('0x2a')]=_0x36db54[_0x8330('0x2a')][_0x8330('0x2c')]?_0x36db54[_0x8330('0x2a')]:_0xa04d8[_0x8330('0x24')];if(!_0x23a439[_0x8330('0x26')][_0x8330('0x2d')]('nolimit')){_0x36db54['limit']=qs[_0x8330('0x17')](_0x23a439['query'][_0x8330('0x17')]);_0x36db54['offset']=qs['offset'](_0x23a439[_0x8330('0x26')][_0x8330('0x16')]);}_0x36db54[_0x8330('0x2e')]=qs[_0x8330('0x2f')](_0x23a439['query'][_0x8330('0x2f')]);_0x36db54['where']=qs[_0x8330('0x30')](_[_0x8330('0x31')](_0x23a439[_0x8330('0x26')],_0xa04d8[_0x8330('0x30')]));if(_0x545e15[_0x8330('0x27')]){if(_0x545e15[_0x8330('0x28')]){_0x545e15['dateEnd']=moment(_0x545e15[_0x8330('0x28')])[_0x8330('0x32')](0x1,_0x8330('0x33'));}else{_0x545e15[_0x8330('0x28')]=moment(_0x545e15[_0x8330('0x27')])[_0x8330('0x32')](0x1,_0x8330('0x33'));}_[_0x8330('0x34')](_0x36db54['where'],{'createdAt':{'$gte':_0x545e15['dateStart'],'$lte':_0x545e15[_0x8330('0x28')]}});}if(_0x23a439[_0x8330('0x26')][_0x8330('0x35')]){_0x36db54[_0x8330('0x36')]=_[_0x8330('0x34')](_0x36db54[_0x8330('0x36')],{'$or':_[_0x8330('0x37')](_0x36db54[_0x8330('0x2a')],function(_0x3ccfa1){var _0x4a7634={};_0x4a7634[_0x3ccfa1]={'$like':'%'+_0x23a439[_0x8330('0x26')][_0x8330('0x35')]+'%'};return _0x4a7634;})});}_0x36db54=_[_0x8330('0x34')]({},_0x36db54,_0x23a439[_0x8330('0x38')]);var _0xf1c683={'where':_0x36db54[_0x8330('0x36')]};return db[_0x8330('0x23')][_0x8330('0x15')](_0xf1c683)[_0x8330('0x1d')](function(_0xdc529a){_0x44adb5[_0x8330('0x15')]=_0xdc529a;if(_0x23a439[_0x8330('0x26')][_0x8330('0x39')]){_0x36db54[_0x8330('0x3a')]=[{'all':!![]}];}return db[_0x8330('0x23')][_0x8330('0x3b')](_0x36db54);})['then'](function(_0x2e06fb){_0x44adb5[_0x8330('0x3c')]=_0x2e06fb;return _0x44adb5;})[_0x8330('0x1d')](respondWithFilteredResult(_0x1fb538,_0x36db54))[_0x8330('0x3d')](handleError(_0x1fb538,null));};exports['show']=function(_0x136919,_0x752941){var _0x1e71df={'raw':!![],'where':{'id':_0x136919['params']['id']}},_0x11dabe={};_0x11dabe[_0x8330('0x24')]=_['keys'](db['CmHopper'][_0x8330('0x3e')]);_0x11dabe['query']=_['keys'](_0x136919['query']);_0x11dabe[_0x8330('0x30')]=_[_0x8330('0x29')](_0x11dabe[_0x8330('0x24')],_0x11dabe[_0x8330('0x26')]);_0x1e71df[_0x8330('0x2a')]=_[_0x8330('0x29')](_0x11dabe[_0x8330('0x24')],qs[_0x8330('0x2b')](_0x136919[_0x8330('0x26')]['fields']));_0x1e71df[_0x8330('0x2a')]=_0x1e71df[_0x8330('0x2a')][_0x8330('0x2c')]?_0x1e71df[_0x8330('0x2a')]:_0x11dabe[_0x8330('0x24')];if(_0x136919[_0x8330('0x26')][_0x8330('0x39')]){_0x1e71df[_0x8330('0x3a')]=[{'all':!![]}];}_0x1e71df=_[_0x8330('0x34')]({},_0x1e71df,_0x136919[_0x8330('0x38')]);return db[_0x8330('0x23')][_0x8330('0x3f')](_0x1e71df)['then'](handleEntityNotFound(_0x752941,null))[_0x8330('0x1d')](respondWithResult(_0x752941,null))[_0x8330('0x3d')](handleError(_0x752941,null));};exports[_0x8330('0x40')]=function(_0x927efc,_0x3afffc){return db['CmHopper'][_0x8330('0x40')](_0x927efc[_0x8330('0x41')],{})[_0x8330('0x1d')](respondWithResult(_0x3afffc,0xc9))['catch'](handleError(_0x3afffc,null));};exports[_0x8330('0x42')]=function(_0x504a75,_0x4d5466){if(_0x504a75[_0x8330('0x41')]['id']){delete _0x504a75[_0x8330('0x41')]['id'];}return db[_0x8330('0x23')]['find']({'where':{'id':_0x504a75[_0x8330('0x43')]['id']}})[_0x8330('0x1d')](handleEntityNotFound(_0x4d5466,null))[_0x8330('0x1d')](saveUpdates(_0x504a75[_0x8330('0x41')],null))['then'](respondWithResult(_0x4d5466,null))[_0x8330('0x3d')](handleError(_0x4d5466,null));};exports[_0x8330('0x44')]=function(_0x1c9e8d,_0x5df830){return db[_0x8330('0x23')]['describe']()[_0x8330('0x1d')](respondWithResult(_0x5df830,null))[_0x8330('0x3d')](handleError(_0x5df830,null));};exports[_0x8330('0x1e')]=function(_0x510197,_0x42e4fd){var _0x268ce7;return db[_0x8330('0x23')][_0x8330('0x3f')]({'where':{'id':_0x510197[_0x8330('0x43')]['id']}})['then'](handleEntityNotFound(_0x42e4fd,null))[_0x8330('0x1d')](function(_0x3d1636){if(_0x3d1636){return _0x3d1636[_0x8330('0x1e')]()[_0x8330('0x1d')](function(_0xad07bc){return _0xad07bc;});}})[_0x8330('0x1d')](function(_0x34084a){_0x268ce7=_0x34084a;if(_0x34084a){if(_0x34084a[_0x8330('0x45')]||_0x34084a[_0x8330('0x46')]){return db[_0x34084a[_0x8330('0x45')]?_0x8330('0x47'):_0x8330('0x48')][_0x8330('0x3f')]({'where':{'id':_0x34084a['VoiceQueueId']?_0x34084a[_0x8330('0x45')]:_0x34084a['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0x8330('0x1d')](function(_0x19dba9){var _0x432cb6={};if(_0x19dba9){_[_0x8330('0x34')](_0x432cb6,_['omit'](_0x268ce7[_0x8330('0x49')],[_0x8330('0x4a'),_0x8330('0x4b'),'id']));_0x432cb6['state']=0x15;_0x432cb6[_0x8330('0x4c')]=_0x8330('0x4d');_0x432cb6[_0x8330('0x4e')]=_0x19dba9['name'];_0x432cb6['membername']=_0x510197[_0x8330('0x4f')][_0x8330('0x22')];_0x432cb6[_0x8330('0x50')]=_0x510197[_0x8330('0x4f')]['id'];_0x432cb6[_0x8330('0x4d')]=!![];_0x432cb6[_0x8330('0x51')]=moment()[_0x8330('0x52')](_0x8330('0x53'));_0x432cb6[_0x8330('0x54')]=_0x268ce7[_0x8330('0x55')];_0x432cb6['campaigntype']=_0x268ce7[_0x8330('0x45')]?'queue':'ivr';return db[_0x8330('0x56')]['find']({'where':{'id':_0x432cb6[_0x8330('0x57')]},'attributes':['firstName',_0x8330('0x58')]})[_0x8330('0x1d')](function(_0x44f4a5){if(!_[_0x8330('0x59')](_0x42e4fd)&&!_['isNil'](_0x44f4a5[_0x8330('0x5a')])){_0x432cb6[_0x8330('0x5b')]=_0x44f4a5['firstName'];if(!_[_0x8330('0x59')](_0x44f4a5['lastName'])){_0x432cb6[_0x8330('0x5b')]+='\x20'+_0x44f4a5[_0x8330('0x58')];}}})[_0x8330('0x5c')](function(){return db[_0x8330('0x5d')][_0x8330('0x40')](_0x432cb6);});}})[_0x8330('0x1d')](function(){return _0x42e4fd['status'](0xcc)[_0x8330('0x5e')]();})[_0x8330('0x3d')](handleError(_0x42e4fd,null));};exports[_0x8330('0x5f')]=function(_0x328b1f,_0x4988b5,_0x5c0c2a){var _0x1ccdb7=[];return db[_0x8330('0x56')][_0x8330('0x44')]()[_0x8330('0x1d')](function(_0x19362f){_0x1ccdb7=_['keys'](_0x19362f);return _0x328b1f['user'][_0x8330('0x60')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x8330('0x61')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0x8330('0x1d')](function(_0x324a36){if(_0x324a36&&_0x324a36[_0x8330('0x2c')]){return db[_0x8330('0x62')][_0x8330('0x63')](function(_0x45f605){var _0x5af4b9={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8330('0x52')](_0x8330('0x53'))},'VoiceQueueId':{'$in':_[_0x8330('0x37')](_0x324a36,'id')},'$or':[{'UserId':null},{'UserId':_0x328b1f['user']['id']}]};if(!_[_0x8330('0x64')](_0x328b1f[_0x8330('0x41')]['hopperIds'])){var _0x43807a={'$notIn':_0x328b1f['body'][_0x8330('0x65')]};_0x5af4b9['id']=_0x43807a;}return db[_0x8330('0x23')][_0x8330('0x66')]({'attributes':['id',_0x8330('0x67')],'where':_0x5af4b9,'order':[[_0x8330('0x68'),_0x8330('0x69')],['scheduledAt',_0x324a36[0x0][_0x8330('0x6a')]],['UserId',_0x8330('0x69')],['id',_0x8330('0x6b')]],'transaction':_0x45f605,'lock':_0x45f605['LOCK'][_0x8330('0x6c')],'include':[{'model':db[_0x8330('0x56')],'as':_0x8330('0x6d'),'attributes':_0x1ccdb7,'include':[{'model':db['CmCompany'],'as':_0x8330('0x6e'),'attributes':['id',_0x8330('0x22')]}]},{'model':db[_0x8330('0x6f')],'as':_0x8330('0x70'),'attributes':['id','name']},{'model':db[_0x8330('0x47')],'as':_0x8330('0x71'),'attributes':['id',_0x8330('0x22'),'dialActive']}]})[_0x8330('0x1d')](function(_0x4f7449){if(_0x4f7449){return _0x4f7449[_0x8330('0x42')]({'UserId':_0x328b1f[_0x8330('0x4f')]['id']},{'transaction':_0x45f605});}});});}})[_0x8330('0x1d')](handleEntityNotFound(_0x4988b5,null))[_0x8330('0x1d')](respondWithResult(_0x4988b5,null))[_0x8330('0x3d')](handleError(_0x4988b5,null));};exports[_0x8330('0x72')]=function(_0x249fd9,_0x2ff8cf,_0xd0f784){return _0x249fd9[_0x8330('0x4f')][_0x8330('0x60')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x1c2417){if(_0x1c2417&&_0x1c2417[_0x8330('0x2c')]){return db[_0x8330('0x23')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8330('0x52')](_0x8330('0x53'))},'VoiceQueueId':{'$in':_[_0x8330('0x37')](_0x1c2417,'id')},'$or':[{'UserId':null},{'UserId':_0x249fd9[_0x8330('0x4f')]['id']}]}});}return 0x0;})['then'](function(_0x5358ac){if(!_[_0x8330('0x59')](_0x5358ac)&&_[_0x8330('0x73')](_0x5358ac)){return _0x2ff8cf[_0x8330('0x13')](0xc8)[_0x8330('0x14')]({'contacts':_0x5358ac});}else{logger[_0x8330('0x20')](_0x8330('0x74'),_0x8330('0x72'),0x194,_0x8330('0x75'));_0x2ff8cf[_0x8330('0x1f')](0x194);}})['catch'](handleError(_0x2ff8cf,null));}; \ No newline at end of file +var _0x44d4=['finally','getVoiceQueues','preview','transaction','YYYY-MM-DD\x20HH:mm:ss','hopperIds','findOne','scheduledat','priority','DESC','dialOrderByScheduledAt','ASC','LOCK','UPDATE','Contact','Company','List','Queue','getOpenContacts','outbound','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','fast-json-patch','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','error','stack','name','send','index','rawAttributes','dateStart','query','dateEnd','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','where','add','day','merge','filter','map','CmHopper','includeAll','findAll','rows','catch','show','params','include','options','find','body','describe','CampaignId','VoiceQueue','Campaign','VoiceQueueId','omit','createdAt','updatedAt','statedesc','user','UserId','deletedat','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname'];(function(_0xf09465,_0x2a9b48){var _0x5f06da=function(_0x158202){while(--_0x158202){_0xf09465['push'](_0xf09465['shift']());}};_0x5f06da(++_0x2a9b48);}(_0x44d4,0x161));var _0x444d=function(_0x566d0a,_0x23882d){_0x566d0a=_0x566d0a-0x0;var _0x3b0ce0=_0x44d4[_0x566d0a];return _0x3b0ce0;};'use strict';var jsonpatch=require(_0x444d('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x444d('0x1'));var util=require(_0x444d('0x2'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x444d('0x3'));var fs=require('fs');var _=require(_0x444d('0x4'));var squel=require(_0x444d('0x5'));var crypto=require(_0x444d('0x6'));var jsforce=require(_0x444d('0x7'));var deskjs=require(_0x444d('0x8'));var toCsv=require(_0x444d('0x9'));var querystring=require('querystring');var Papa=require(_0x444d('0xa'));var qs=require('../../components/parsers/qs');var logger=require(_0x444d('0xb'))(_0x444d('0xc'));var utils=require(_0x444d('0xd'));var config=require(_0x444d('0xe'));var db=require(_0x444d('0xf'))['db'];function respondWithStatusCode(_0x44cd15,_0x2e98c9){_0x2e98c9=_0x2e98c9||0xcc;return function(_0x13a27c){if(_0x13a27c){return _0x44cd15[_0x444d('0x10')](_0x2e98c9);}return _0x44cd15[_0x444d('0x11')](_0x2e98c9)[_0x444d('0x12')]();};}function respondWithResult(_0x5cbd8f,_0x457847){_0x457847=_0x457847||0xc8;return function(_0x1a07cc){if(_0x1a07cc){return _0x5cbd8f['status'](_0x457847)[_0x444d('0x13')](_0x1a07cc);}};}function respondWithFilteredResult(_0x3a2d03,_0x2807fb){return function(_0x488ef6){if(_0x488ef6){var _0x3382a4=_0x488ef6[_0x444d('0x14')],_0x41b794=_0x2807fb['offset'],_0x390231=_0x2807fb[_0x444d('0x15')]+_0x2807fb[_0x444d('0x16')],_0x545a4b;if(_0x390231>=_0x3382a4){_0x390231=_0x3382a4;_0x545a4b=0xc8;}else{_0x545a4b=0xce;}_0x3a2d03[_0x444d('0x11')](_0x545a4b);return _0x3a2d03[_0x444d('0x17')]('Content-Range',_0x41b794+'-'+_0x390231+'/'+_0x3382a4)['json'](_0x488ef6);}return null;};}function patchUpdates(_0x4da5e3){return function(_0x52fb87){try{jsonpatch[_0x444d('0x18')](_0x52fb87,_0x4da5e3,!![]);}catch(_0x3f5372){return BPromise[_0x444d('0x19')](_0x3f5372);}return _0x52fb87['save']();};}function saveUpdates(_0x54e12a,_0x2f7809){return function(_0x144020){if(_0x144020){return _0x144020[_0x444d('0x1a')](_0x54e12a)[_0x444d('0x1b')](function(_0x3e2bd2){return _0x3e2bd2;});}return null;};}function removeEntity(_0x4bbcd1,_0x10639f){return function(_0x474c65){if(_0x474c65){return _0x474c65[_0x444d('0x1c')]()[_0x444d('0x1b')](function(){_0x4bbcd1[_0x444d('0x11')](0xcc)[_0x444d('0x12')]();});}};}function handleEntityNotFound(_0x3365ae,_0x5bfca7){return function(_0x5e071f){if(!_0x5e071f){_0x3365ae[_0x444d('0x10')](0x194);}return _0x5e071f;};}function handleError(_0x4ef57b,_0x4dd652){_0x4dd652=_0x4dd652||0x1f4;return function(_0x43ec13){logger[_0x444d('0x1d')](_0x43ec13[_0x444d('0x1e')]);if(_0x43ec13['name']){delete _0x43ec13[_0x444d('0x1f')];}_0x4ef57b[_0x444d('0x11')](_0x4dd652)[_0x444d('0x20')](_0x43ec13);};}exports[_0x444d('0x21')]=function(_0x90967,_0x2faf9e){var _0x4016b8={},_0x394d06={},_0x218873={'count':0x0,'rows':[]};var _0x49c2fd=db['CmHopper'][_0x444d('0x22')];_0x394d06['model']=_['keys'](_0x49c2fd);var _0x278cb8={'dateStart':_0x90967['query'][_0x444d('0x23')],'dateEnd':_0x90967[_0x444d('0x24')]['dateEnd']};delete _0x90967[_0x444d('0x24')][_0x444d('0x23')];delete _0x90967[_0x444d('0x24')][_0x444d('0x25')];_0x394d06['query']=_[_0x444d('0x26')](_0x90967['query']);_0x394d06[_0x444d('0x27')]=_['intersection'](_0x394d06[_0x444d('0x28')],_0x394d06[_0x444d('0x24')]);_0x4016b8[_0x444d('0x29')]=_[_0x444d('0x2a')](_0x394d06[_0x444d('0x28')],qs['fields'](_0x90967[_0x444d('0x24')][_0x444d('0x2b')]));_0x4016b8[_0x444d('0x29')]=_0x4016b8[_0x444d('0x29')][_0x444d('0x2c')]?_0x4016b8[_0x444d('0x29')]:_0x394d06[_0x444d('0x28')];if(!_0x90967[_0x444d('0x24')][_0x444d('0x2d')]('nolimit')){_0x4016b8['limit']=qs[_0x444d('0x16')](_0x90967[_0x444d('0x24')]['limit']);_0x4016b8[_0x444d('0x15')]=qs[_0x444d('0x15')](_0x90967[_0x444d('0x24')][_0x444d('0x15')]);}_0x4016b8[_0x444d('0x2e')]=qs['sort'](_0x90967['query']['sort']);_0x4016b8[_0x444d('0x2f')]=qs[_0x444d('0x27')](_['pick'](_0x90967[_0x444d('0x24')],_0x394d06['filters']));if(_0x278cb8[_0x444d('0x23')]){if(_0x278cb8[_0x444d('0x25')]){_0x278cb8[_0x444d('0x25')]=moment(_0x278cb8[_0x444d('0x25')])[_0x444d('0x30')](0x1,'day');}else{_0x278cb8['dateEnd']=moment(_0x278cb8[_0x444d('0x23')])[_0x444d('0x30')](0x1,_0x444d('0x31'));}_[_0x444d('0x32')](_0x4016b8[_0x444d('0x2f')],{'createdAt':{'$gte':_0x278cb8[_0x444d('0x23')],'$lte':_0x278cb8[_0x444d('0x25')]}});}if(_0x90967['query'][_0x444d('0x33')]){_0x4016b8[_0x444d('0x2f')]=_['merge'](_0x4016b8['where'],{'$or':_[_0x444d('0x34')](_0x4016b8[_0x444d('0x29')],function(_0x54d632){var _0x4352f1={};_0x4352f1[_0x54d632]={'$like':'%'+_0x90967[_0x444d('0x24')][_0x444d('0x33')]+'%'};return _0x4352f1;})});}_0x4016b8=_[_0x444d('0x32')]({},_0x4016b8,_0x90967['options']);var _0x4c2d45={'where':_0x4016b8['where']};return db[_0x444d('0x35')]['count'](_0x4c2d45)[_0x444d('0x1b')](function(_0x2d3a8d){_0x218873['count']=_0x2d3a8d;if(_0x90967[_0x444d('0x24')][_0x444d('0x36')]){_0x4016b8['include']=[{'all':!![]}];}return db[_0x444d('0x35')][_0x444d('0x37')](_0x4016b8);})[_0x444d('0x1b')](function(_0x2fa717){_0x218873[_0x444d('0x38')]=_0x2fa717;return _0x218873;})[_0x444d('0x1b')](respondWithFilteredResult(_0x2faf9e,_0x4016b8))[_0x444d('0x39')](handleError(_0x2faf9e,null));};exports[_0x444d('0x3a')]=function(_0x51a898,_0x526a49){var _0x5d8a5b={'raw':!![],'where':{'id':_0x51a898[_0x444d('0x3b')]['id']}},_0x2a4988={};_0x2a4988[_0x444d('0x28')]=_[_0x444d('0x26')](db['CmHopper'][_0x444d('0x22')]);_0x2a4988[_0x444d('0x24')]=_[_0x444d('0x26')](_0x51a898['query']);_0x2a4988[_0x444d('0x27')]=_['intersection'](_0x2a4988[_0x444d('0x28')],_0x2a4988[_0x444d('0x24')]);_0x5d8a5b[_0x444d('0x29')]=_[_0x444d('0x2a')](_0x2a4988['model'],qs[_0x444d('0x2b')](_0x51a898[_0x444d('0x24')][_0x444d('0x2b')]));_0x5d8a5b[_0x444d('0x29')]=_0x5d8a5b[_0x444d('0x29')][_0x444d('0x2c')]?_0x5d8a5b[_0x444d('0x29')]:_0x2a4988[_0x444d('0x28')];if(_0x51a898[_0x444d('0x24')][_0x444d('0x36')]){_0x5d8a5b[_0x444d('0x3c')]=[{'all':!![]}];}_0x5d8a5b=_[_0x444d('0x32')]({},_0x5d8a5b,_0x51a898[_0x444d('0x3d')]);return db[_0x444d('0x35')][_0x444d('0x3e')](_0x5d8a5b)[_0x444d('0x1b')](handleEntityNotFound(_0x526a49,null))[_0x444d('0x1b')](respondWithResult(_0x526a49,null))['catch'](handleError(_0x526a49,null));};exports['create']=function(_0x34be33,_0x2014d8){return db[_0x444d('0x35')]['create'](_0x34be33['body'],{})['then'](respondWithResult(_0x2014d8,0xc9))[_0x444d('0x39')](handleError(_0x2014d8,null));};exports[_0x444d('0x1a')]=function(_0x351d20,_0x1bf30f){if(_0x351d20[_0x444d('0x3f')]['id']){delete _0x351d20[_0x444d('0x3f')]['id'];}return db[_0x444d('0x35')][_0x444d('0x3e')]({'where':{'id':_0x351d20[_0x444d('0x3b')]['id']}})[_0x444d('0x1b')](handleEntityNotFound(_0x1bf30f,null))[_0x444d('0x1b')](saveUpdates(_0x351d20[_0x444d('0x3f')],null))['then'](respondWithResult(_0x1bf30f,null))[_0x444d('0x39')](handleError(_0x1bf30f,null));};exports['describe']=function(_0x276aa4,_0x3b7d0f){return db['CmHopper'][_0x444d('0x40')]()[_0x444d('0x1b')](respondWithResult(_0x3b7d0f,null))[_0x444d('0x39')](handleError(_0x3b7d0f,null));};exports['destroy']=function(_0x599ffc,_0x3c08f7){var _0x194087;return db[_0x444d('0x35')]['find']({'where':{'id':_0x599ffc[_0x444d('0x3b')]['id']}})[_0x444d('0x1b')](handleEntityNotFound(_0x3c08f7,null))[_0x444d('0x1b')](function(_0x3e356e){if(_0x3e356e){return _0x3e356e[_0x444d('0x1c')]()[_0x444d('0x1b')](function(_0x4e7464){return _0x4e7464;});}})[_0x444d('0x1b')](function(_0x527474){_0x194087=_0x527474;if(_0x527474){if(_0x527474['VoiceQueueId']||_0x527474[_0x444d('0x41')]){return db[_0x527474['VoiceQueueId']?_0x444d('0x42'):_0x444d('0x43')][_0x444d('0x3e')]({'where':{'id':_0x527474[_0x444d('0x44')]?_0x527474['VoiceQueueId']:_0x527474[_0x444d('0x41')]},'attributes':['id',_0x444d('0x1f')],'raw':!![]});}}})[_0x444d('0x1b')](function(_0x1bc3b2){var _0x303435={};if(_0x1bc3b2){_[_0x444d('0x32')](_0x303435,_[_0x444d('0x45')](_0x194087['dataValues'],[_0x444d('0x46'),_0x444d('0x47'),'id']));_0x303435['state']=0x15;_0x303435[_0x444d('0x48')]='deleted';_0x303435['campaign']=_0x1bc3b2[_0x444d('0x1f')];_0x303435['membername']=_0x599ffc[_0x444d('0x49')][_0x444d('0x1f')];_0x303435[_0x444d('0x4a')]=_0x599ffc[_0x444d('0x49')]['id'];_0x303435['deleted']=!![];_0x303435[_0x444d('0x4b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x303435[_0x444d('0x4c')]=_0x194087[_0x444d('0x4d')];_0x303435[_0x444d('0x4e')]=_0x194087[_0x444d('0x44')]?_0x444d('0x4f'):_0x444d('0x50');return db[_0x444d('0x51')]['find']({'where':{'id':_0x303435[_0x444d('0x52')]},'attributes':[_0x444d('0x53'),_0x444d('0x54')]})['then'](function(_0xc68385){if(!_[_0x444d('0x55')](_0x3c08f7)&&!_[_0x444d('0x55')](_0xc68385['firstName'])){_0x303435[_0x444d('0x56')]=_0xc68385[_0x444d('0x53')];if(!_[_0x444d('0x55')](_0xc68385[_0x444d('0x54')])){_0x303435[_0x444d('0x56')]+='\x20'+_0xc68385[_0x444d('0x54')];}}})[_0x444d('0x57')](function(){return db['CmHopperFinal']['create'](_0x303435);});}})[_0x444d('0x1b')](function(){return _0x3c08f7[_0x444d('0x11')](0xcc)[_0x444d('0x12')]();})[_0x444d('0x39')](handleError(_0x3c08f7,null));};exports['getPreview']=function(_0x2b2e0c,_0x1ac218,_0x13a230){var _0x287153=[];return db[_0x444d('0x51')]['describe']()[_0x444d('0x1b')](function(_0x32a31e){_0x287153=_[_0x444d('0x26')](_0x32a31e);return _0x2b2e0c[_0x444d('0x49')][_0x444d('0x58')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x444d('0x59')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0x444d('0x1b')](function(_0x575cfb){if(_0x575cfb&&_0x575cfb['length']){return db['sequelize'][_0x444d('0x5a')](function(_0x5592da){var _0x25efff={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x444d('0x5b'))},'VoiceQueueId':{'$in':_[_0x444d('0x34')](_0x575cfb,'id')},'$or':[{'UserId':null},{'UserId':_0x2b2e0c[_0x444d('0x49')]['id']}]};if(!_['isEmpty'](_0x2b2e0c[_0x444d('0x3f')][_0x444d('0x5c')])){var _0x2b669a={'$notIn':_0x2b2e0c[_0x444d('0x3f')][_0x444d('0x5c')]};_0x25efff['id']=_0x2b669a;}return db['CmHopper'][_0x444d('0x5d')]({'attributes':['id',_0x444d('0x5e')],'where':_0x25efff,'order':[[_0x444d('0x5f'),_0x444d('0x60')],['scheduledAt',_0x575cfb[0x0][_0x444d('0x61')]],[_0x444d('0x4a'),'DESC'],['id',_0x444d('0x62')]],'transaction':_0x5592da,'lock':_0x5592da[_0x444d('0x63')][_0x444d('0x64')],'include':[{'model':db[_0x444d('0x51')],'as':_0x444d('0x65'),'attributes':_0x287153,'include':[{'model':db['CmCompany'],'as':_0x444d('0x66'),'attributes':['id',_0x444d('0x1f')]}]},{'model':db['CmList'],'as':_0x444d('0x67'),'attributes':['id',_0x444d('0x1f')]},{'model':db[_0x444d('0x42')],'as':_0x444d('0x68'),'attributes':['id','name','dialActive']}]})[_0x444d('0x1b')](function(_0x5e4a65){if(_0x5e4a65){return _0x5e4a65['update']({'UserId':_0x2b2e0c['user']['id']},{'transaction':_0x5592da});}});});}})[_0x444d('0x1b')](handleEntityNotFound(_0x1ac218,null))[_0x444d('0x1b')](respondWithResult(_0x1ac218,null))[_0x444d('0x39')](handleError(_0x1ac218,null));};exports[_0x444d('0x69')]=function(_0x2fff43,_0x5bf483,_0x4286bb){return _0x2fff43[_0x444d('0x49')][_0x444d('0x58')]({'where':{'type':_0x444d('0x6a'),'dialActive':!![],'dialMethod':_0x444d('0x59')},'attributes':['id'],'raw':!![]})[_0x444d('0x1b')](function(_0x2b53a8){if(_0x2b53a8&&_0x2b53a8['length']){return db[_0x444d('0x35')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x444d('0x5b'))},'VoiceQueueId':{'$in':_[_0x444d('0x34')](_0x2b53a8,'id')},'$or':[{'UserId':null},{'UserId':_0x2fff43[_0x444d('0x49')]['id']}]}});}return 0x0;})[_0x444d('0x1b')](function(_0x87cf4f){if(!_[_0x444d('0x55')](_0x87cf4f)&&_[_0x444d('0x6b')](_0x87cf4f)){return _0x5bf483[_0x444d('0x11')](0xc8)['json']({'contacts':_0x87cf4f});}else{logger[_0x444d('0x1d')](_0x444d('0x6c'),_0x444d('0x69'),0x194,_0x444d('0x6d'));_0x5bf483[_0x444d('0x10')](0x194);}})[_0x444d('0x39')](handleError(_0x5bf483,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 9805e5d..a9ec0d1 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 _0x825f=['cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api','moment','bluebird','./cmHopper.attributes','exports','define','CmHopper'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x825f,0x122));var _0xf825=function(_0x5859f9,_0x4428e5){_0x5859f9=_0x5859f9-0x0;var _0x126499=_0x825f[_0x5859f9];return _0x126499;};'use strict';var _=require(_0xf825('0x0'));var util=require('util');var logger=require(_0xf825('0x1'))(_0xf825('0x2'));var moment=require(_0xf825('0x3'));var BPromise=require(_0xf825('0x4'));var rp=require('request-promise');var attributes=require(_0xf825('0x5'));module[_0xf825('0x6')]=function(_0x4c5bb2,_0x810fce){return _0x4c5bb2[_0xf825('0x7')](_0xf825('0x8'),attributes,{'tableName':_0xf825('0x9'),'paranoid':![],'indexes':[{'name':_0xf825('0xa'),'fields':[_0xf825('0xa')]},{'name':_0xf825('0xb'),'fields':[_0xf825('0xb')]},{'name':_0xf825('0xc'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf741=['phone','lodash','util','../../config/logger','bluebird','./cmHopper.attributes','exports','define','cm_hopper','scheduledat'];(function(_0x4541b6,_0xf1632c){var _0x561b1e=function(_0x3f12b6){while(--_0x3f12b6){_0x4541b6['push'](_0x4541b6['shift']());}};_0x561b1e(++_0xf1632c);}(_0xf741,0x79));var _0x1f74=function(_0x1e53dd,_0x51966e){_0x1e53dd=_0x1e53dd-0x0;var _0x10505c=_0xf741[_0x1e53dd];return _0x10505c;};'use strict';var _=require(_0x1f74('0x0'));var util=require(_0x1f74('0x1'));var logger=require(_0x1f74('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1f74('0x3'));var rp=require('request-promise');var attributes=require(_0x1f74('0x4'));module[_0x1f74('0x5')]=function(_0x2a3191,_0x3f6b5a){return _0x2a3191[_0x1f74('0x6')]('CmHopper',attributes,{'tableName':_0x1f74('0x7'),'paranoid':![],'indexes':[{'name':_0x1f74('0x8'),'fields':[_0x1f74('0x8')]},{'name':'phone','fields':[_0x1f74('0x9')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 1de2fcc..66e8adf 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 _0xad8c=['destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','transaction','order','LOCK','UPDATE','keys','length','push','update','all','sequelize','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','UserId','GetContactRecallMe','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetCmHopper','CmHopper','findAll','options','attributes','include','map','model','find','raw','where','ShowCmHopper','create','body','CreateCmHopper','limit','UpdateCmHopper'];(function(_0x4b5efc,_0x473301){var _0x15f834=function(_0x142b65){while(--_0x142b65){_0x4b5efc['push'](_0x4b5efc['shift']());}};_0x15f834(++_0x473301);}(_0xad8c,0x123));var _0xcad8=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xad8c[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0xcad8('0x0'));var util=require('util');var moment=require(_0xcad8('0x1'));var BPromise=require(_0xcad8('0x2'));var rs=require(_0xcad8('0x3'));var fs=require('fs');var db=require(_0xcad8('0x4'))['db'];var utils=require(_0xcad8('0x5'));var logger=require(_0xcad8('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcad8('0x7'));var client=jayson[_0xcad8('0x8')][_0xcad8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3da7b9,_0x59cf94,_0x471042){return new BPromise(function(_0x3e9407,_0x5d173f){return client[_0xcad8('0xa')](_0x3da7b9,_0x471042)[_0xcad8('0xb')](function(_0x213111){logger[_0xcad8('0xc')](_0xcad8('0xd'),_0x59cf94,_0xcad8('0xe'));logger[_0xcad8('0xf')](_0xcad8('0x10'),_0x59cf94,_0xcad8('0xe'),JSON[_0xcad8('0x11')](_0x213111));if(_0x213111['error']){if(_0x213111[_0xcad8('0x12')]['code']===0x1f4){logger[_0xcad8('0x12')](_0xcad8('0xd'),_0x59cf94,_0x213111[_0xcad8('0x12')][_0xcad8('0x13')]);return _0x5d173f(_0x213111[_0xcad8('0x12')][_0xcad8('0x13')]);}logger[_0xcad8('0x12')](_0xcad8('0xd'),_0x59cf94,_0x213111[_0xcad8('0x12')][_0xcad8('0x13')]);return _0x3e9407(_0x213111[_0xcad8('0x12')][_0xcad8('0x13')]);}else{logger[_0xcad8('0xc')](_0xcad8('0xd'),_0x59cf94,'request\x20sent');_0x3e9407(_0x213111[_0xcad8('0x14')][_0xcad8('0x13')]);}})[_0xcad8('0x15')](function(_0x57ecfa){logger['error'](_0xcad8('0xd'),_0x59cf94,_0x57ecfa);_0x5d173f(_0x57ecfa);});});}exports[_0xcad8('0x16')]=function(_0x1a91a0){var _0xe6a1a0=this;return new Promise(function(_0x4c7a99,_0x48e8d5){return db[_0xcad8('0x17')][_0xcad8('0x18')]({'raw':_0x1a91a0[_0xcad8('0x19')]?_0x1a91a0[_0xcad8('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1a91a0[_0xcad8('0x19')]?_0x1a91a0[_0xcad8('0x19')]['where']||null:null,'attributes':_0x1a91a0[_0xcad8('0x19')]?_0x1a91a0[_0xcad8('0x19')][_0xcad8('0x1a')]||null:null,'limit':_0x1a91a0['options']?_0x1a91a0[_0xcad8('0x19')]['limit']||null:null,'include':_0x1a91a0[_0xcad8('0x19')]?_0x1a91a0['options'][_0xcad8('0x1b')]?_[_0xcad8('0x1c')](_0x1a91a0['options']['include'],function(_0x56cd0e){return{'model':db[_0x56cd0e[_0xcad8('0x1d')]],'as':_0x56cd0e['as'],'attributes':_0x56cd0e[_0xcad8('0x1a')],'include':_0x56cd0e[_0xcad8('0x1b')]?_['map'](_0x56cd0e[_0xcad8('0x1b')],function(_0x4cac2f){return{'model':db[_0x4cac2f[_0xcad8('0x1d')]],'as':_0x4cac2f['as'],'attributes':_0x4cac2f[_0xcad8('0x1a')],'include':_0x4cac2f[_0xcad8('0x1b')]?_['map'](_0x4cac2f[_0xcad8('0x1b')],function(_0xcbdd22){return{'model':db[_0xcbdd22[_0xcad8('0x1d')]],'as':_0xcbdd22['as'],'attributes':_0xcbdd22[_0xcad8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcad8('0xb')](function(_0x42b089){logger[_0xcad8('0xc')]('GetCmHopper',_0x1a91a0);logger[_0xcad8('0xf')]('GetCmHopper',_0x1a91a0,JSON[_0xcad8('0x11')](_0x42b089));_0x4c7a99(_0x42b089);})[_0xcad8('0x15')](function(_0x1287e2){logger['error']('GetCmHopper',_0x1287e2[_0xcad8('0x13')],_0x1a91a0);_0x48e8d5(_0xe6a1a0[_0xcad8('0x12')](0x1f4,_0x1287e2['message']));});});};exports['ShowCmHopper']=function(_0x2914ce){var _0x470efa=this;return new Promise(function(_0x2494fd,_0x28e13d){return db['CmHopper'][_0xcad8('0x1e')]({'raw':_0x2914ce[_0xcad8('0x19')]?_0x2914ce['options'][_0xcad8('0x1f')]===undefined?!![]:![]:!![],'where':_0x2914ce['options']?_0x2914ce[_0xcad8('0x19')][_0xcad8('0x20')]||null:null,'attributes':_0x2914ce[_0xcad8('0x19')]?_0x2914ce[_0xcad8('0x19')][_0xcad8('0x1a')]||null:null,'include':_0x2914ce[_0xcad8('0x19')]?_0x2914ce['options'][_0xcad8('0x1b')]?_[_0xcad8('0x1c')](_0x2914ce[_0xcad8('0x19')][_0xcad8('0x1b')],function(_0x4e4ac1){return{'model':db[_0x4e4ac1[_0xcad8('0x1d')]],'as':_0x4e4ac1['as'],'attributes':_0x4e4ac1[_0xcad8('0x1a')],'include':_0x4e4ac1[_0xcad8('0x1b')]?_[_0xcad8('0x1c')](_0x4e4ac1[_0xcad8('0x1b')],function(_0x1cda5a){return{'model':db[_0x1cda5a[_0xcad8('0x1d')]],'as':_0x1cda5a['as'],'attributes':_0x1cda5a[_0xcad8('0x1a')],'include':_0x1cda5a[_0xcad8('0x1b')]?_['map'](_0x1cda5a[_0xcad8('0x1b')],function(_0x31c6aa){return{'model':db[_0x31c6aa[_0xcad8('0x1d')]],'as':_0x31c6aa['as'],'attributes':_0x31c6aa[_0xcad8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcad8('0xb')](function(_0x63fe69){logger['info']('ShowCmHopper',_0x2914ce);logger[_0xcad8('0xf')](_0xcad8('0x21'),_0x2914ce,JSON[_0xcad8('0x11')](_0x63fe69));_0x2494fd(_0x63fe69);})['catch'](function(_0x5bfac7){logger[_0xcad8('0x12')](_0xcad8('0x21'),_0x5bfac7[_0xcad8('0x13')],_0x2914ce);_0x28e13d(_0x470efa[_0xcad8('0x12')](0x1f4,_0x5bfac7[_0xcad8('0x13')]));});});};exports['CreateCmHopper']=function(_0x4dc4c8){var _0x2fece0=this;return new Promise(function(_0x1d407c,_0x3fd135){return db['CmHopper'][_0xcad8('0x22')](_0x4dc4c8[_0xcad8('0x23')],{'raw':_0x4dc4c8[_0xcad8('0x19')]?_0x4dc4c8[_0xcad8('0x19')][_0xcad8('0x1f')]===undefined?!![]:![]:!![]})[_0xcad8('0xb')](function(_0x4a0d04){logger[_0xcad8('0xc')](_0xcad8('0x24'),_0x4dc4c8);logger[_0xcad8('0xf')](_0xcad8('0x24'),_0x4dc4c8,JSON[_0xcad8('0x11')](_0x4a0d04));_0x1d407c(_0x4a0d04);})[_0xcad8('0x15')](function(_0x182d89){logger['error']('CreateCmHopper',_0x182d89[_0xcad8('0x13')],_0x4dc4c8);_0x3fd135(_0x2fece0[_0xcad8('0x12')](0x1f4,_0x182d89['message']));});});};exports['UpdateCmHopper']=function(_0x44c443){var _0xba6efe=this;return new Promise(function(_0x22e1fd,_0x46cb30){return db[_0xcad8('0x17')]['update'](_0x44c443[_0xcad8('0x23')],{'raw':_0x44c443[_0xcad8('0x19')]?_0x44c443['options'][_0xcad8('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44c443['options']?_0x44c443[_0xcad8('0x19')][_0xcad8('0x20')]||null:null,'attributes':_0x44c443[_0xcad8('0x19')]?_0x44c443['options'][_0xcad8('0x1a')]||null:null,'limit':_0x44c443['options']?_0x44c443[_0xcad8('0x19')][_0xcad8('0x25')]||null:null})[_0xcad8('0xb')](function(_0x5cc603){logger[_0xcad8('0xc')](_0xcad8('0x26'),_0x44c443);logger['debug'](_0xcad8('0x26'),_0x44c443,JSON[_0xcad8('0x11')](_0x5cc603));_0x22e1fd(_0x5cc603);})['catch'](function(_0x215253){logger[_0xcad8('0x12')]('UpdateCmHopper',_0x215253['message'],_0x44c443);_0x46cb30(_0xba6efe[_0xcad8('0x12')](0x1f4,_0x215253[_0xcad8('0x13')]));});});};exports['DestroyCmHopper']=function(_0x5c630e){var _0xc6c527=this;return new Promise(function(_0x5d1cab,_0x26c80b){return db['CmHopper'][_0xcad8('0x27')]({'where':_0x5c630e[_0xcad8('0x19')]?_0x5c630e['options']['where']||null:null})[_0xcad8('0xb')](function(_0x28b8e1){logger[_0xcad8('0xc')]('DestroyCmHopper',_0x5c630e);logger[_0xcad8('0xf')](_0xcad8('0x28'),_0x5c630e,JSON[_0xcad8('0x11')](_0x28b8e1));_0x5d1cab(_0x28b8e1);})[_0xcad8('0x15')](function(_0xf803c9){logger['error'](_0xcad8('0x28'),_0xf803c9[_0xcad8('0x13')],_0x5c630e);_0x26c80b(_0xc6c527[_0xcad8('0x12')](0x1f4,_0xf803c9[_0xcad8('0x13')]));});});};exports[_0xcad8('0x29')]=function(_0x27bf33){var _0x4c1523=this;return new Promise(function(_0xfd7092,_0x214aee){return db[_0xcad8('0x2a')][_0xcad8('0x2b')]()['then'](function(_0x49f20e){return db['sequelize'][_0xcad8('0x2c')](function(_0x2a89fb){return db[_0xcad8('0x17')][_0xcad8('0x18')]({'where':_0x27bf33[_0xcad8('0x19')]?_0x27bf33['options'][_0xcad8('0x20')]||null:null,'attributes':_0x27bf33[_0xcad8('0x19')]?_0x27bf33['options'][_0xcad8('0x1a')]||null:null,'limit':_0x27bf33[_0xcad8('0x19')]?_0x27bf33[_0xcad8('0x19')][_0xcad8('0x25')]||null:null,'order':_0x27bf33['options']?_0x27bf33[_0xcad8('0x19')][_0xcad8('0x2d')]||null:null,'transaction':_0x2a89fb,'lock':_0x2a89fb[_0xcad8('0x2e')][_0xcad8('0x2f')],'include':[{'model':db[_0xcad8('0x2a')],'as':'Contact','attributes':_[_0xcad8('0x30')](_0x49f20e)}]})[_0xcad8('0xb')](function(_0x53ebd0){var _0x282a71=[];for(var _0x21d18d=0x0;_0x21d18d<_0x53ebd0[_0xcad8('0x31')];_0x21d18d+=0x1){_0x282a71[_0xcad8('0x32')](_0x53ebd0[_0x21d18d][_0xcad8('0x33')](_0x27bf33['body'],{'transaction':_0x2a89fb}));}return BPromise[_0xcad8('0x34')](_0x282a71);});})[_0xcad8('0xb')](function(_0x1da4c2){logger[_0xcad8('0xc')](_0xcad8('0x29'),_0x27bf33);logger[_0xcad8('0xf')](_0xcad8('0x29'),_0x27bf33,JSON['stringify'](_0x1da4c2));_0xfd7092(_0x1da4c2);})['catch'](function(_0x11f5ec){logger[_0xcad8('0x12')](_0xcad8('0x29'),_0x11f5ec['message'],_0x27bf33);_0x214aee(_0x4c1523[_0xcad8('0x12')](0x1f4,_0x11f5ec[_0xcad8('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x338592){var _0x148c69=this;return new Promise(function(_0x7b3605,_0x46dc85){return db[_0xcad8('0x35')][_0xcad8('0x2c')](function(_0x2073c9){return db[_0xcad8('0x36')][_0xcad8('0x22')](_0x338592['body'],{'raw':_0x338592[_0xcad8('0x19')]?_0x338592[_0xcad8('0x19')]['raw']===undefined?!![]:![]:!![],'transaction':_0x2073c9})[_0xcad8('0xb')](function(){return db[_0xcad8('0x17')][_0xcad8('0x27')]({'where':_0x338592[_0xcad8('0x19')]?_0x338592[_0xcad8('0x19')][_0xcad8('0x20')]||null:null,'transaction':_0x2073c9});});})['then'](function(_0x27eb97){logger[_0xcad8('0xc')]('MoveContactManagedDialer',_0x338592);logger[_0xcad8('0xf')](_0xcad8('0x37'),_0x338592,JSON[_0xcad8('0x11')](_0x27eb97));_0x7b3605(_0x27eb97);})['catch'](function(_0x37c24a){logger[_0xcad8('0x12')](_0xcad8('0x37'),_0x37c24a['message'],_0x338592);_0x46dc85(_0x148c69[_0xcad8('0x12')](0x1f4,_0x37c24a[_0xcad8('0x13')]));});});};exports[_0xcad8('0x38')]=function(_0x53fbea){var _0x4520b2=this;return new Promise(function(_0x5f3dad,_0x48eb05){return db[_0xcad8('0x17')][_0xcad8('0x18')]({'raw':_0x53fbea['options']?_0x53fbea['options']['raw']===undefined?!![]:![]:!![],'where':_0x53fbea['options']?_0x53fbea[_0xcad8('0x19')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xcad8('0x39'),db[_0xcad8('0x35')]['fn']('IF',db[_0xcad8('0x35')][_0xcad8('0x3a')](_0xcad8('0x3b')+util['format']('\x22%s\x22',moment()[_0xcad8('0x3c')](_0xcad8('0x3d')))+_0xcad8('0x3e')))),_0xcad8('0x3f')]]})['then'](function(_0x1c1fac){logger[_0xcad8('0xc')](_0xcad8('0x38'),_0x53fbea);logger[_0xcad8('0xf')](_0xcad8('0x38'),_0x53fbea,JSON[_0xcad8('0x11')](_0x1c1fac));_0x5f3dad(_0x1c1fac);})[_0xcad8('0x15')](function(_0xc417){logger[_0xcad8('0x12')](_0xcad8('0x38'),_0xc417[_0xcad8('0x13')],_0x53fbea);_0x48eb05(_0x4520b2[_0xcad8('0x12')](0x1f4,_0xc417[_0xcad8('0x13')]));});});};exports['GetContactRecallMe']=function(_0xe96d51){var _0x3cb03c=this;return new Promise(function(_0x4bf893,_0x545e57){return db[_0xcad8('0x2a')]['describe']()[_0xcad8('0xb')](function(_0x3f250e){return db[_0xcad8('0x35')]['transaction'](function(_0x404d62){return db['CmHopper']['findAll']({'where':_0xe96d51[_0xcad8('0x19')]?_0xe96d51[_0xcad8('0x19')][_0xcad8('0x20')]||null:null,'attributes':_0xe96d51[_0xcad8('0x19')]?_0xe96d51['options']['attributes']||null:null,'limit':0x1,'order':_0xe96d51['options']?_0xe96d51[_0xcad8('0x19')][_0xcad8('0x2d')]||null:null,'group':db[_0xcad8('0x17')][_0xcad8('0x40')],'transaction':_0x404d62,'lock':_0x404d62[_0xcad8('0x2e')][_0xcad8('0x2f')],'include':_0xe96d51[_0xcad8('0x19')]?_0xe96d51[_0xcad8('0x19')]['include']?_[_0xcad8('0x1c')](_0xe96d51[_0xcad8('0x19')][_0xcad8('0x1b')],function(_0x181aa2){return{'model':db[_0x181aa2['model']],'as':_0x181aa2['as'],'attributes':_0x181aa2['attributes'],'include':_0x181aa2['include']?_[_0xcad8('0x1c')](_0x181aa2['include'],function(_0x4b47e2){return{'model':db[_0x4b47e2[_0xcad8('0x1d')]],'as':_0x4b47e2['as'],'attributes':_0x4b47e2[_0xcad8('0x1a')],'include':_0x4b47e2[_0xcad8('0x1b')]?_[_0xcad8('0x1c')](_0x4b47e2[_0xcad8('0x1b')],function(_0x2bb98f){return{'model':db[_0x2bb98f['model']],'as':_0x2bb98f['as'],'attributes':_0x2bb98f[_0xcad8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcad8('0xb')](function(_0x299f99){var _0x174730=[];for(var _0x59c82a=0x0;_0x59c82a<_0x299f99['length'];_0x59c82a+=0x1){_0x174730[_0xcad8('0x32')](_0x299f99[_0x59c82a][_0xcad8('0x33')](_0xe96d51[_0xcad8('0x23')],{'transaction':_0x404d62}));}return BPromise['all'](_0x174730);});})['then'](function(_0x306c76){logger[_0xcad8('0xc')](_0xcad8('0x41'),_0xe96d51);logger[_0xcad8('0xf')](_0xcad8('0x41'),_0xe96d51,JSON[_0xcad8('0x11')](_0x306c76));_0x4bf893(_0x306c76);})[_0xcad8('0x15')](function(_0x489b51){logger[_0xcad8('0x12')]('GetContactRecallMe',_0x489b51['message'],_0xe96d51);_0x545e57(_0x3cb03c[_0xcad8('0x12')](0x1f4,_0x489b51[_0xcad8('0x13')]));});});});}; \ No newline at end of file +var _0xbdc0=['../../config/environment','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CmHopper','findAll','options','raw','where','attributes','include','map','GetCmHopper','ShowCmHopper','find','model','CreateCmHopper','create','body','UpdateCmHopper','update','limit','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','transaction','order','LOCK','UPDATE','Contact','keys','length','all','MoveContactManagedDialer','sequelize','CmHopperFinal','CountReScheduled','COUNT','literal','format','YYYY-MM-DD\x20HH:mm:ss','GetContactRecallMe','UserId','push','lodash','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x3fd275,_0xf0cd7){var _0xe4f14f=function(_0x23971d){while(--_0x23971d){_0x3fd275['push'](_0x3fd275['shift']());}};_0xe4f14f(++_0xf0cd7);}(_0xbdc0,0x1eb));var _0x0bdc=function(_0x180291,_0xbeed0f){_0x180291=_0x180291-0x0;var _0x11a550=_0xbdc0[_0x180291];return _0x11a550;};'use strict';var _=require(_0x0bdc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0bdc('0x1'));var rs=require(_0x0bdc('0x2'));var fs=require('fs');var db=require(_0x0bdc('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0bdc('0x4'))('rpc');var config=require(_0x0bdc('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0bdc('0x6')][_0x0bdc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x42153d,_0x47e9f5,_0x575f53){return new BPromise(function(_0x969c74,_0x29225a){return client[_0x0bdc('0x8')](_0x42153d,_0x575f53)[_0x0bdc('0x9')](function(_0x12daa9){logger[_0x0bdc('0xa')](_0x0bdc('0xb'),_0x47e9f5,_0x0bdc('0xc'));logger[_0x0bdc('0xd')](_0x0bdc('0xe'),_0x47e9f5,_0x0bdc('0xc'),JSON[_0x0bdc('0xf')](_0x12daa9));if(_0x12daa9[_0x0bdc('0x10')]){if(_0x12daa9[_0x0bdc('0x10')][_0x0bdc('0x11')]===0x1f4){logger[_0x0bdc('0x10')]('CmHopper,\x20%s,\x20%s',_0x47e9f5,_0x12daa9['error'][_0x0bdc('0x12')]);return _0x29225a(_0x12daa9[_0x0bdc('0x10')]['message']);}logger[_0x0bdc('0x10')](_0x0bdc('0xb'),_0x47e9f5,_0x12daa9[_0x0bdc('0x10')][_0x0bdc('0x12')]);return _0x969c74(_0x12daa9['error'][_0x0bdc('0x12')]);}else{logger['info'](_0x0bdc('0xb'),_0x47e9f5,_0x0bdc('0xc'));_0x969c74(_0x12daa9['result'][_0x0bdc('0x12')]);}})[_0x0bdc('0x13')](function(_0x4b1bac){logger[_0x0bdc('0x10')](_0x0bdc('0xb'),_0x47e9f5,_0x4b1bac);_0x29225a(_0x4b1bac);});});}exports['GetCmHopper']=function(_0x1d0eb0){var _0x268905=this;return new Promise(function(_0x51383c,_0x1e05d1){return db[_0x0bdc('0x14')][_0x0bdc('0x15')]({'raw':_0x1d0eb0[_0x0bdc('0x16')]?_0x1d0eb0[_0x0bdc('0x16')][_0x0bdc('0x17')]===undefined?!![]:![]:!![],'where':_0x1d0eb0['options']?_0x1d0eb0[_0x0bdc('0x16')][_0x0bdc('0x18')]||null:null,'attributes':_0x1d0eb0[_0x0bdc('0x16')]?_0x1d0eb0[_0x0bdc('0x16')][_0x0bdc('0x19')]||null:null,'limit':_0x1d0eb0[_0x0bdc('0x16')]?_0x1d0eb0[_0x0bdc('0x16')]['limit']||null:null,'include':_0x1d0eb0['options']?_0x1d0eb0[_0x0bdc('0x16')][_0x0bdc('0x1a')]?_[_0x0bdc('0x1b')](_0x1d0eb0[_0x0bdc('0x16')][_0x0bdc('0x1a')],function(_0x5e61fc){return{'model':db[_0x5e61fc['model']],'as':_0x5e61fc['as'],'attributes':_0x5e61fc['attributes'],'include':_0x5e61fc[_0x0bdc('0x1a')]?_[_0x0bdc('0x1b')](_0x5e61fc[_0x0bdc('0x1a')],function(_0x397b9b){return{'model':db[_0x397b9b['model']],'as':_0x397b9b['as'],'attributes':_0x397b9b['attributes'],'include':_0x397b9b[_0x0bdc('0x1a')]?_['map'](_0x397b9b[_0x0bdc('0x1a')],function(_0x8541b6){return{'model':db[_0x8541b6['model']],'as':_0x8541b6['as'],'attributes':_0x8541b6[_0x0bdc('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0bdc('0x9')](function(_0xbb09ab){logger[_0x0bdc('0xa')](_0x0bdc('0x1c'),_0x1d0eb0);logger['debug'](_0x0bdc('0x1c'),_0x1d0eb0,JSON['stringify'](_0xbb09ab));_0x51383c(_0xbb09ab);})[_0x0bdc('0x13')](function(_0x5c9ec8){logger['error']('GetCmHopper',_0x5c9ec8[_0x0bdc('0x12')],_0x1d0eb0);_0x1e05d1(_0x268905[_0x0bdc('0x10')](0x1f4,_0x5c9ec8[_0x0bdc('0x12')]));});});};exports[_0x0bdc('0x1d')]=function(_0x2cea5c){var _0x7e3abe=this;return new Promise(function(_0x2a6ac5,_0x36492d){return db['CmHopper'][_0x0bdc('0x1e')]({'raw':_0x2cea5c[_0x0bdc('0x16')]?_0x2cea5c[_0x0bdc('0x16')][_0x0bdc('0x17')]===undefined?!![]:![]:!![],'where':_0x2cea5c['options']?_0x2cea5c[_0x0bdc('0x16')]['where']||null:null,'attributes':_0x2cea5c[_0x0bdc('0x16')]?_0x2cea5c[_0x0bdc('0x16')][_0x0bdc('0x19')]||null:null,'include':_0x2cea5c[_0x0bdc('0x16')]?_0x2cea5c[_0x0bdc('0x16')][_0x0bdc('0x1a')]?_[_0x0bdc('0x1b')](_0x2cea5c[_0x0bdc('0x16')]['include'],function(_0x2ff57c){return{'model':db[_0x2ff57c[_0x0bdc('0x1f')]],'as':_0x2ff57c['as'],'attributes':_0x2ff57c[_0x0bdc('0x19')],'include':_0x2ff57c['include']?_[_0x0bdc('0x1b')](_0x2ff57c[_0x0bdc('0x1a')],function(_0x2ded3e){return{'model':db[_0x2ded3e['model']],'as':_0x2ded3e['as'],'attributes':_0x2ded3e[_0x0bdc('0x19')],'include':_0x2ded3e[_0x0bdc('0x1a')]?_[_0x0bdc('0x1b')](_0x2ded3e[_0x0bdc('0x1a')],function(_0x1520ca){return{'model':db[_0x1520ca[_0x0bdc('0x1f')]],'as':_0x1520ca['as'],'attributes':_0x1520ca[_0x0bdc('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0bdc('0x9')](function(_0x5e84f4){logger['info'](_0x0bdc('0x1d'),_0x2cea5c);logger[_0x0bdc('0xd')]('ShowCmHopper',_0x2cea5c,JSON['stringify'](_0x5e84f4));_0x2a6ac5(_0x5e84f4);})[_0x0bdc('0x13')](function(_0xaf313e){logger[_0x0bdc('0x10')]('ShowCmHopper',_0xaf313e[_0x0bdc('0x12')],_0x2cea5c);_0x36492d(_0x7e3abe['error'](0x1f4,_0xaf313e[_0x0bdc('0x12')]));});});};exports[_0x0bdc('0x20')]=function(_0x2a0fe8){var _0x4c6693=this;return new Promise(function(_0x292e20,_0x37d57d){return db[_0x0bdc('0x14')][_0x0bdc('0x21')](_0x2a0fe8[_0x0bdc('0x22')],{'raw':_0x2a0fe8[_0x0bdc('0x16')]?_0x2a0fe8['options'][_0x0bdc('0x17')]===undefined?!![]:![]:!![]})[_0x0bdc('0x9')](function(_0x1d1278){logger[_0x0bdc('0xa')](_0x0bdc('0x20'),_0x2a0fe8);logger[_0x0bdc('0xd')]('CreateCmHopper',_0x2a0fe8,JSON[_0x0bdc('0xf')](_0x1d1278));_0x292e20(_0x1d1278);})[_0x0bdc('0x13')](function(_0x3a65f9){logger[_0x0bdc('0x10')](_0x0bdc('0x20'),_0x3a65f9[_0x0bdc('0x12')],_0x2a0fe8);_0x37d57d(_0x4c6693[_0x0bdc('0x10')](0x1f4,_0x3a65f9[_0x0bdc('0x12')]));});});};exports[_0x0bdc('0x23')]=function(_0x1f7bb1){var _0x41ad7e=this;return new Promise(function(_0x191aaf,_0x3a861f){return db[_0x0bdc('0x14')][_0x0bdc('0x24')](_0x1f7bb1[_0x0bdc('0x22')],{'raw':_0x1f7bb1[_0x0bdc('0x16')]?_0x1f7bb1['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f7bb1[_0x0bdc('0x16')]?_0x1f7bb1[_0x0bdc('0x16')]['where']||null:null,'attributes':_0x1f7bb1['options']?_0x1f7bb1[_0x0bdc('0x16')]['attributes']||null:null,'limit':_0x1f7bb1[_0x0bdc('0x16')]?_0x1f7bb1[_0x0bdc('0x16')][_0x0bdc('0x25')]||null:null})[_0x0bdc('0x9')](function(_0x3afda1){logger[_0x0bdc('0xa')](_0x0bdc('0x23'),_0x1f7bb1);logger['debug'](_0x0bdc('0x23'),_0x1f7bb1,JSON['stringify'](_0x3afda1));_0x191aaf(_0x3afda1);})[_0x0bdc('0x13')](function(_0x22f33b){logger[_0x0bdc('0x10')](_0x0bdc('0x23'),_0x22f33b[_0x0bdc('0x12')],_0x1f7bb1);_0x3a861f(_0x41ad7e[_0x0bdc('0x10')](0x1f4,_0x22f33b[_0x0bdc('0x12')]));});});};exports['DestroyCmHopper']=function(_0x5d9a0e){var _0x512341=this;return new Promise(function(_0x2f6e03,_0x339389){return db[_0x0bdc('0x14')][_0x0bdc('0x26')]({'where':_0x5d9a0e[_0x0bdc('0x16')]?_0x5d9a0e['options']['where']||null:null})[_0x0bdc('0x9')](function(_0x552d5f){logger[_0x0bdc('0xa')](_0x0bdc('0x27'),_0x5d9a0e);logger[_0x0bdc('0xd')](_0x0bdc('0x27'),_0x5d9a0e,JSON[_0x0bdc('0xf')](_0x552d5f));_0x2f6e03(_0x552d5f);})[_0x0bdc('0x13')](function(_0x1280bd){logger['error'](_0x0bdc('0x27'),_0x1280bd['message'],_0x5d9a0e);_0x339389(_0x512341['error'](0x1f4,_0x1280bd[_0x0bdc('0x12')]));});});};exports[_0x0bdc('0x28')]=function(_0x1c5893){var _0x3c3d27=this;return new Promise(function(_0x29bfe6,_0x16c37a){return db[_0x0bdc('0x29')][_0x0bdc('0x2a')]()[_0x0bdc('0x9')](function(_0x4618fd){return db['sequelize'][_0x0bdc('0x2b')](function(_0x56a435){return db[_0x0bdc('0x14')][_0x0bdc('0x15')]({'where':_0x1c5893[_0x0bdc('0x16')]?_0x1c5893[_0x0bdc('0x16')][_0x0bdc('0x18')]||null:null,'attributes':_0x1c5893[_0x0bdc('0x16')]?_0x1c5893[_0x0bdc('0x16')][_0x0bdc('0x19')]||null:null,'limit':_0x1c5893[_0x0bdc('0x16')]?_0x1c5893['options']['limit']||null:null,'order':_0x1c5893[_0x0bdc('0x16')]?_0x1c5893[_0x0bdc('0x16')][_0x0bdc('0x2c')]||null:null,'transaction':_0x56a435,'lock':_0x56a435[_0x0bdc('0x2d')][_0x0bdc('0x2e')],'include':[{'model':db[_0x0bdc('0x29')],'as':_0x0bdc('0x2f'),'attributes':_[_0x0bdc('0x30')](_0x4618fd)}]})[_0x0bdc('0x9')](function(_0x1c4d77){var _0x19f8ac=[];for(var _0x5309e7=0x0;_0x5309e7<_0x1c4d77[_0x0bdc('0x31')];_0x5309e7+=0x1){_0x19f8ac['push'](_0x1c4d77[_0x5309e7][_0x0bdc('0x24')](_0x1c5893['body'],{'transaction':_0x56a435}));}return BPromise[_0x0bdc('0x32')](_0x19f8ac);});})['then'](function(_0x4da696){logger[_0x0bdc('0xa')](_0x0bdc('0x28'),_0x1c5893);logger[_0x0bdc('0xd')]('GetContactDialer',_0x1c5893,JSON[_0x0bdc('0xf')](_0x4da696));_0x29bfe6(_0x4da696);})[_0x0bdc('0x13')](function(_0x42c649){logger['error']('GetContactDialer',_0x42c649['message'],_0x1c5893);_0x16c37a(_0x3c3d27[_0x0bdc('0x10')](0x1f4,_0x42c649['message']));});});});};exports[_0x0bdc('0x33')]=function(_0x15db6e){var _0x330b97=this;return new Promise(function(_0x29c3cc,_0x4fe7e6){return db[_0x0bdc('0x34')]['transaction'](function(_0x53c4aa){return db[_0x0bdc('0x35')][_0x0bdc('0x21')](_0x15db6e[_0x0bdc('0x22')],{'raw':_0x15db6e['options']?_0x15db6e[_0x0bdc('0x16')][_0x0bdc('0x17')]===undefined?!![]:![]:!![],'transaction':_0x53c4aa})[_0x0bdc('0x9')](function(){return db['CmHopper']['destroy']({'where':_0x15db6e[_0x0bdc('0x16')]?_0x15db6e[_0x0bdc('0x16')]['where']||null:null,'transaction':_0x53c4aa});});})[_0x0bdc('0x9')](function(_0xc5d9be){logger[_0x0bdc('0xa')](_0x0bdc('0x33'),_0x15db6e);logger[_0x0bdc('0xd')](_0x0bdc('0x33'),_0x15db6e,JSON[_0x0bdc('0xf')](_0xc5d9be));_0x29c3cc(_0xc5d9be);})[_0x0bdc('0x13')](function(_0x29848b){logger[_0x0bdc('0x10')]('MoveContactManagedDialer',_0x29848b['message'],_0x15db6e);_0x4fe7e6(_0x330b97[_0x0bdc('0x10')](0x1f4,_0x29848b['message']));});});};exports[_0x0bdc('0x36')]=function(_0x200323){var _0x2a1ac3=this;return new Promise(function(_0x282d49,_0x235829){return db['CmHopper']['findAll']({'raw':_0x200323['options']?_0x200323[_0x0bdc('0x16')][_0x0bdc('0x17')]===undefined?!![]:![]:!![],'where':_0x200323[_0x0bdc('0x16')]?_0x200323[_0x0bdc('0x16')][_0x0bdc('0x18')]||null:null,'attributes':[[db['sequelize']['fn'](_0x0bdc('0x37'),db[_0x0bdc('0x34')]['fn']('IF',db[_0x0bdc('0x34')][_0x0bdc('0x38')]('`scheduledat`\x20>=\x20'+util[_0x0bdc('0x39')]('\x22%s\x22',moment()[_0x0bdc('0x39')](_0x0bdc('0x3a')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0x0bdc('0x9')](function(_0x17f2a5){logger[_0x0bdc('0xa')](_0x0bdc('0x36'),_0x200323);logger[_0x0bdc('0xd')](_0x0bdc('0x36'),_0x200323,JSON[_0x0bdc('0xf')](_0x17f2a5));_0x282d49(_0x17f2a5);})['catch'](function(_0x2a823d){logger['error'](_0x0bdc('0x36'),_0x2a823d[_0x0bdc('0x12')],_0x200323);_0x235829(_0x2a1ac3[_0x0bdc('0x10')](0x1f4,_0x2a823d[_0x0bdc('0x12')]));});});};exports[_0x0bdc('0x3b')]=function(_0x4a746a){var _0x1dc3c3=this;return new Promise(function(_0xc3b0fb,_0x42e693){return db[_0x0bdc('0x29')][_0x0bdc('0x2a')]()['then'](function(_0x58426a){return db[_0x0bdc('0x34')]['transaction'](function(_0x188e63){return db[_0x0bdc('0x14')]['findAll']({'where':_0x4a746a[_0x0bdc('0x16')]?_0x4a746a[_0x0bdc('0x16')][_0x0bdc('0x18')]||null:null,'attributes':_0x4a746a[_0x0bdc('0x16')]?_0x4a746a['options'][_0x0bdc('0x19')]||null:null,'limit':0x1,'order':_0x4a746a[_0x0bdc('0x16')]?_0x4a746a[_0x0bdc('0x16')]['order']||null:null,'group':db['CmHopper'][_0x0bdc('0x3c')],'transaction':_0x188e63,'lock':_0x188e63[_0x0bdc('0x2d')][_0x0bdc('0x2e')],'include':_0x4a746a[_0x0bdc('0x16')]?_0x4a746a[_0x0bdc('0x16')]['include']?_[_0x0bdc('0x1b')](_0x4a746a[_0x0bdc('0x16')]['include'],function(_0x105106){return{'model':db[_0x105106['model']],'as':_0x105106['as'],'attributes':_0x105106[_0x0bdc('0x19')],'include':_0x105106[_0x0bdc('0x1a')]?_[_0x0bdc('0x1b')](_0x105106['include'],function(_0x1023c1){return{'model':db[_0x1023c1[_0x0bdc('0x1f')]],'as':_0x1023c1['as'],'attributes':_0x1023c1['attributes'],'include':_0x1023c1[_0x0bdc('0x1a')]?_[_0x0bdc('0x1b')](_0x1023c1[_0x0bdc('0x1a')],function(_0x42f39e){return{'model':db[_0x42f39e['model']],'as':_0x42f39e['as'],'attributes':_0x42f39e['attributes']};}):[]};}):[]};}):[]:[]})[_0x0bdc('0x9')](function(_0x2b1498){var _0x512a1e=[];for(var _0x48d980=0x0;_0x48d980<_0x2b1498[_0x0bdc('0x31')];_0x48d980+=0x1){_0x512a1e[_0x0bdc('0x3d')](_0x2b1498[_0x48d980][_0x0bdc('0x24')](_0x4a746a['body'],{'transaction':_0x188e63}));}return BPromise['all'](_0x512a1e);});})['then'](function(_0x7ec58e){logger[_0x0bdc('0xa')](_0x0bdc('0x3b'),_0x4a746a);logger['debug'](_0x0bdc('0x3b'),_0x4a746a,JSON[_0x0bdc('0xf')](_0x7ec58e));_0xc3b0fb(_0x7ec58e);})[_0x0bdc('0x13')](function(_0x4a1791){logger[_0x0bdc('0x10')](_0x0bdc('0x3b'),_0x4a1791[_0x0bdc('0x12')],_0x4a746a);_0x42e693(_0x1dc3c3['error'](0x1f4,_0x4a1791[_0x0bdc('0x12')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 87bdf4d..f6afcce 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 _0x0713=['delete','destroy','path','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','show','post','create','/preview','getPreview','put','/:id'];(function(_0x4c7ecc,_0x2eb72a){var _0x5b6620=function(_0x1a6fca){while(--_0x1a6fca){_0x4c7ecc['push'](_0x4c7ecc['shift']());}};_0x5b6620(++_0x2eb72a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var express=require(_0x3071('0x1'));var router=express[_0x3071('0x2')]();var auth=require(_0x3071('0x3'));var interaction=require(_0x3071('0x4'));var config=require('../../config/environment');var controller=require(_0x3071('0x5'));router[_0x3071('0x6')]('/',auth[_0x3071('0x7')](),controller[_0x3071('0x8')]);router[_0x3071('0x6')](_0x3071('0x9'),auth[_0x3071('0x7')](),controller[_0x3071('0xa')]);router[_0x3071('0x6')](_0x3071('0xb'),auth[_0x3071('0x7')](),controller[_0x3071('0xc')]);router[_0x3071('0x6')]('/:id',auth[_0x3071('0x7')](),controller[_0x3071('0xd')]);router[_0x3071('0xe')]('/',auth[_0x3071('0x7')](),controller[_0x3071('0xf')]);router['post'](_0x3071('0x10'),auth[_0x3071('0x7')](),controller[_0x3071('0x11')]);router[_0x3071('0x12')](_0x3071('0x13'),auth['isAuthenticated'](),controller['update']);router[_0x3071('0x14')]('/:id',auth[_0x3071('0x7')](),controller[_0x3071('0x15')]);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(_0x4bb757,_0xbae3d9){var _0x1dd30e=function(_0x51cabd){while(--_0x51cabd){_0x4bb757['push'](_0x4bb757['shift']());}};_0x1dd30e(++_0xbae3d9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'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 2fd3eb5..cca149d 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 _0xe4d2=['INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x463faa,_0x28d99e){var _0xfbb01c=function(_0x50ddce){while(--_0x50ddce){_0x463faa['push'](_0x463faa['shift']());}};_0xfbb01c(++_0x28d99e);}(_0xe4d2,0xed));var _0x2e4d=function(_0x47c39d,_0x3eea90){_0x47c39d=_0x47c39d-0x0;var _0xd41416=_0xe4d2[_0x47c39d];return _0xd41416;};'use strict';var moment=require(_0x2e4d('0x0'));var Sequelize=require(_0x2e4d('0x1'));module[_0x2e4d('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x2e4d('0x3')],'unique':_0x2e4d('0x4')},'ListId':{'type':Sequelize[_0x2e4d('0x3')],'unique':_0x2e4d('0x4')},'VoiceQueueId':{'type':Sequelize[_0x2e4d('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x8f8e=['STRING','INTEGER','contactListQueue','moment','exports'];(function(_0x16d68a,_0x4f98bb){var _0x4b39b3=function(_0x5b357d){while(--_0x5b357d){_0x16d68a['push'](_0x16d68a['shift']());}};_0x4b39b3(++_0x4f98bb);}(_0x8f8e,0x11b));var _0xe8f8=function(_0x507403,_0x3f954d){_0x507403=_0x507403-0x0;var _0x1327c=_0x8f8e[_0x507403];return _0x1327c;};'use strict';var moment=require(_0xe8f8('0x0'));var Sequelize=require('sequelize');module[_0xe8f8('0x1')]={'phone':{'type':Sequelize[_0xe8f8('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xe8f8('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xe8f8('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xe8f8('0x3')],'unique':_0xe8f8('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 8bac0f0..90d6736 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 _0x96cc=['filter','merge','map','options','includeAll','findAll','rows','catch','show','params','include','find','body','describe','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','CmHopperBlack','rawAttributes','query','dateStart','dateEnd','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','add'];(function(_0xb27df3,_0x4063cc){var _0x3f3c63=function(_0x2bfde0){while(--_0x2bfde0){_0xb27df3['push'](_0xb27df3['shift']());}};_0x3f3c63(++_0x4063cc);}(_0x96cc,0x16c));var _0xc96c=function(_0x2d3d0d,_0x67ac82){_0x2d3d0d=_0x2d3d0d-0x0;var _0xca35b6=_0x96cc[_0x2d3d0d];return _0xca35b6;};'use strict';var jsonpatch=require(_0xc96c('0x0'));var rp=require('request-promise');var moment=require(_0xc96c('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xc96c('0x2'));var util=require(_0xc96c('0x3'));var path=require(_0xc96c('0x4'));var sox=require(_0xc96c('0x5'));var csv=require(_0xc96c('0x6'));var ejs=require(_0xc96c('0x7'));var fs=require('fs');var _=require(_0xc96c('0x8'));var squel=require(_0xc96c('0x9'));var crypto=require(_0xc96c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc96c('0xb'));var toCsv=require(_0xc96c('0x6'));var querystring=require(_0xc96c('0xc'));var Papa=require(_0xc96c('0xd'));var qs=require(_0xc96c('0xe'));var logger=require(_0xc96c('0xf'))(_0xc96c('0x10'));var utils=require('../../config/utils');var config=require(_0xc96c('0x11'));var db=require(_0xc96c('0x12'))['db'];function respondWithStatusCode(_0x19f599,_0x5ceddc){_0x5ceddc=_0x5ceddc||0xcc;return function(_0x95ce8e){if(_0x95ce8e){return _0x19f599['sendStatus'](_0x5ceddc);}return _0x19f599[_0xc96c('0x13')](_0x5ceddc)['end']();};}function respondWithResult(_0x18a1a6,_0x32f682){_0x32f682=_0x32f682||0xc8;return function(_0x3ef47a){if(_0x3ef47a){return _0x18a1a6[_0xc96c('0x13')](_0x32f682)['json'](_0x3ef47a);}};}function respondWithFilteredResult(_0x3fe3d5,_0x43fcaa){return function(_0x1e7742){if(_0x1e7742){var _0x3f65fd=_0x1e7742[_0xc96c('0x14')],_0x48de8d=_0x43fcaa[_0xc96c('0x15')],_0x35da94=_0x43fcaa[_0xc96c('0x15')]+_0x43fcaa[_0xc96c('0x16')],_0xbed0c9;if(_0x35da94>=_0x3f65fd){_0x35da94=_0x3f65fd;_0xbed0c9=0xc8;}else{_0xbed0c9=0xce;}_0x3fe3d5[_0xc96c('0x13')](_0xbed0c9);return _0x3fe3d5[_0xc96c('0x17')](_0xc96c('0x18'),_0x48de8d+'-'+_0x35da94+'/'+_0x3f65fd)[_0xc96c('0x19')](_0x1e7742);}return null;};}function patchUpdates(_0x861230){return function(_0x5f1344){try{jsonpatch['apply'](_0x5f1344,_0x861230,!![]);}catch(_0x406791){return BPromise[_0xc96c('0x1a')](_0x406791);}return _0x5f1344[_0xc96c('0x1b')]();};}function saveUpdates(_0x2ae19a,_0x4aa6a3){return function(_0x2c4c83){if(_0x2c4c83){return _0x2c4c83[_0xc96c('0x1c')](_0x2ae19a)[_0xc96c('0x1d')](function(_0x3c0864){return _0x3c0864;});}return null;};}function removeEntity(_0x184128,_0x335910){return function(_0x43cc22){if(_0x43cc22){return _0x43cc22[_0xc96c('0x1e')]()[_0xc96c('0x1d')](function(){_0x184128[_0xc96c('0x13')](0xcc)[_0xc96c('0x1f')]();});}};}function handleEntityNotFound(_0x1203a1,_0x3f9603){return function(_0x45edee){if(!_0x45edee){_0x1203a1[_0xc96c('0x20')](0x194);}return _0x45edee;};}function handleError(_0x3b5c6c,_0x3e2615){_0x3e2615=_0x3e2615||0x1f4;return function(_0x51dabe){logger[_0xc96c('0x21')](_0x51dabe[_0xc96c('0x22')]);if(_0x51dabe[_0xc96c('0x23')]){delete _0x51dabe[_0xc96c('0x23')];}_0x3b5c6c[_0xc96c('0x13')](_0x3e2615)[_0xc96c('0x24')](_0x51dabe);};}exports[_0xc96c('0x25')]=function(_0x415d33,_0x1a77df){var _0x14f171={},_0x50fc07={},_0x3a23cb={'count':0x0,'rows':[]};var _0x117f17=db[_0xc96c('0x26')][_0xc96c('0x27')];_0x50fc07['model']=_['keys'](_0x117f17);var _0x39c191={'dateStart':_0x415d33[_0xc96c('0x28')][_0xc96c('0x29')],'dateEnd':_0x415d33[_0xc96c('0x28')][_0xc96c('0x2a')]};delete _0x415d33[_0xc96c('0x28')][_0xc96c('0x29')];delete _0x415d33[_0xc96c('0x28')][_0xc96c('0x2a')];_0x50fc07[_0xc96c('0x28')]=_[_0xc96c('0x2b')](_0x415d33[_0xc96c('0x28')]);_0x50fc07[_0xc96c('0x2c')]=_[_0xc96c('0x2d')](_0x50fc07['model'],_0x50fc07[_0xc96c('0x28')]);_0x14f171['attributes']=_[_0xc96c('0x2d')](_0x50fc07[_0xc96c('0x2e')],qs[_0xc96c('0x2f')](_0x415d33['query'][_0xc96c('0x2f')]));_0x14f171[_0xc96c('0x30')]=_0x14f171[_0xc96c('0x30')][_0xc96c('0x31')]?_0x14f171['attributes']:_0x50fc07['model'];if(!_0x415d33[_0xc96c('0x28')][_0xc96c('0x32')](_0xc96c('0x33'))){_0x14f171['limit']=qs[_0xc96c('0x16')](_0x415d33[_0xc96c('0x28')][_0xc96c('0x16')]);_0x14f171[_0xc96c('0x15')]=qs['offset'](_0x415d33[_0xc96c('0x28')][_0xc96c('0x15')]);}_0x14f171['order']=qs[_0xc96c('0x34')](_0x415d33[_0xc96c('0x28')][_0xc96c('0x34')]);_0x14f171[_0xc96c('0x35')]=qs[_0xc96c('0x2c')](_[_0xc96c('0x36')](_0x415d33['query'],_0x50fc07[_0xc96c('0x2c')]));if(_0x39c191[_0xc96c('0x29')]){if(_0x39c191[_0xc96c('0x2a')]){_0x39c191[_0xc96c('0x2a')]=moment(_0x39c191[_0xc96c('0x2a')])[_0xc96c('0x37')](0x1,'day');}else{_0x39c191['dateEnd']=moment(_0x39c191[_0xc96c('0x29')])[_0xc96c('0x37')](0x1,'day');}_['merge'](_0x14f171[_0xc96c('0x35')],{'createdAt':{'$gte':_0x39c191[_0xc96c('0x29')],'$lte':_0x39c191[_0xc96c('0x2a')]}});}if(_0x415d33[_0xc96c('0x28')][_0xc96c('0x38')]){_0x14f171[_0xc96c('0x35')]=_[_0xc96c('0x39')](_0x14f171[_0xc96c('0x35')],{'$or':_[_0xc96c('0x3a')](_0x14f171[_0xc96c('0x30')],function(_0x1b68e6){var _0x5ed343={};_0x5ed343[_0x1b68e6]={'$like':'%'+_0x415d33[_0xc96c('0x28')][_0xc96c('0x38')]+'%'};return _0x5ed343;})});}_0x14f171=_[_0xc96c('0x39')]({},_0x14f171,_0x415d33[_0xc96c('0x3b')]);var _0x4eb180={'where':_0x14f171[_0xc96c('0x35')]};return db[_0xc96c('0x26')][_0xc96c('0x14')](_0x4eb180)['then'](function(_0x510252){_0x3a23cb[_0xc96c('0x14')]=_0x510252;if(_0x415d33[_0xc96c('0x28')][_0xc96c('0x3c')]){_0x14f171['include']=[{'all':!![]}];}return db[_0xc96c('0x26')][_0xc96c('0x3d')](_0x14f171);})[_0xc96c('0x1d')](function(_0x2a8ea7){_0x3a23cb[_0xc96c('0x3e')]=_0x2a8ea7;return _0x3a23cb;})[_0xc96c('0x1d')](respondWithFilteredResult(_0x1a77df,_0x14f171))[_0xc96c('0x3f')](handleError(_0x1a77df,null));};exports[_0xc96c('0x40')]=function(_0x25df41,_0x4d5a1b){var _0x4c3088={'raw':!![],'where':{'id':_0x25df41[_0xc96c('0x41')]['id']}},_0x30b3ac={};_0x30b3ac[_0xc96c('0x2e')]=_[_0xc96c('0x2b')](db['CmHopperBlack']['rawAttributes']);_0x30b3ac[_0xc96c('0x28')]=_[_0xc96c('0x2b')](_0x25df41[_0xc96c('0x28')]);_0x30b3ac[_0xc96c('0x2c')]=_[_0xc96c('0x2d')](_0x30b3ac[_0xc96c('0x2e')],_0x30b3ac[_0xc96c('0x28')]);_0x4c3088['attributes']=_[_0xc96c('0x2d')](_0x30b3ac[_0xc96c('0x2e')],qs[_0xc96c('0x2f')](_0x25df41[_0xc96c('0x28')]['fields']));_0x4c3088['attributes']=_0x4c3088[_0xc96c('0x30')][_0xc96c('0x31')]?_0x4c3088[_0xc96c('0x30')]:_0x30b3ac[_0xc96c('0x2e')];if(_0x25df41[_0xc96c('0x28')][_0xc96c('0x3c')]){_0x4c3088[_0xc96c('0x42')]=[{'all':!![]}];}_0x4c3088=_[_0xc96c('0x39')]({},_0x4c3088,_0x25df41[_0xc96c('0x3b')]);return db[_0xc96c('0x26')][_0xc96c('0x43')](_0x4c3088)[_0xc96c('0x1d')](handleEntityNotFound(_0x4d5a1b,null))[_0xc96c('0x1d')](respondWithResult(_0x4d5a1b,null))['catch'](handleError(_0x4d5a1b,null));};exports[_0xc96c('0x1c')]=function(_0x2e5045,_0x307d58){if(_0x2e5045[_0xc96c('0x44')]['id']){delete _0x2e5045['body']['id'];}return db[_0xc96c('0x26')]['find']({'where':{'id':_0x2e5045[_0xc96c('0x41')]['id']}})[_0xc96c('0x1d')](handleEntityNotFound(_0x307d58,null))['then'](saveUpdates(_0x2e5045[_0xc96c('0x44')],null))[_0xc96c('0x1d')](respondWithResult(_0x307d58,null))[_0xc96c('0x3f')](handleError(_0x307d58,null));};exports[_0xc96c('0x1e')]=function(_0x1e38e1,_0x1bd694){return db['CmHopperBlack']['find']({'where':{'id':_0x1e38e1['params']['id']}})[_0xc96c('0x1d')](handleEntityNotFound(_0x1bd694,null))['then'](removeEntity(_0x1bd694,null))[_0xc96c('0x3f')](handleError(_0x1bd694,null));};exports[_0xc96c('0x45')]=function(_0x65a0a7,_0x17c764){return db[_0xc96c('0x26')][_0xc96c('0x45')]()[_0xc96c('0x1d')](respondWithResult(_0x17c764,null))[_0xc96c('0x3f')](handleError(_0x17c764,null));}; \ No newline at end of file +var _0x7a4d=['sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','end','error','name','send','index','query','dateStart','dateEnd','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','add','day','merge','filter','map','options','CmHopperBlack','count','findAll','rows','show','params','rawAttributes','length','find','catch','body','describe','fast-json-patch','request-promise','mustache','util','path'];(function(_0x128fb8,_0x53a5c1){var _0x3a5a95=function(_0x4e5116){while(--_0x4e5116){_0x128fb8['push'](_0x128fb8['shift']());}};_0x3a5a95(++_0x53a5c1);}(_0x7a4d,0x18d));var _0xd7a4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x7a4d[_0x5d2803];return _0xdcad2c;};'use strict';var jsonpatch=require(_0xd7a4('0x0'));var rp=require(_0xd7a4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd7a4('0x2'));var util=require(_0xd7a4('0x3'));var path=require(_0xd7a4('0x4'));var sox=require(_0xd7a4('0x5'));var csv=require(_0xd7a4('0x6'));var ejs=require(_0xd7a4('0x7'));var fs=require('fs');var _=require(_0xd7a4('0x8'));var squel=require('squel');var crypto=require(_0xd7a4('0x9'));var jsforce=require(_0xd7a4('0xa'));var deskjs=require(_0xd7a4('0xb'));var toCsv=require(_0xd7a4('0x6'));var querystring=require(_0xd7a4('0xc'));var Papa=require('papaparse');var qs=require(_0xd7a4('0xd'));var logger=require('../../config/logger')(_0xd7a4('0xe'));var utils=require(_0xd7a4('0xf'));var config=require(_0xd7a4('0x10'));var db=require(_0xd7a4('0x11'))['db'];function respondWithStatusCode(_0x48b912,_0x55232e){_0x55232e=_0x55232e||0xcc;return function(_0x5b550b){if(_0x5b550b){return _0x48b912[_0xd7a4('0x12')](_0x55232e);}return _0x48b912['status'](_0x55232e)['end']();};}function respondWithResult(_0xb83c5f,_0x5b2996){_0x5b2996=_0x5b2996||0xc8;return function(_0x30a798){if(_0x30a798){return _0xb83c5f['status'](_0x5b2996)[_0xd7a4('0x13')](_0x30a798);}};}function respondWithFilteredResult(_0x3ce5c5,_0x46d6a7){return function(_0x2ca575){if(_0x2ca575){var _0x9ed6a=_0x2ca575['count'],_0x1d33a6=_0x46d6a7['offset'],_0x439091=_0x46d6a7[_0xd7a4('0x14')]+_0x46d6a7[_0xd7a4('0x15')],_0x5aba4d;if(_0x439091>=_0x9ed6a){_0x439091=_0x9ed6a;_0x5aba4d=0xc8;}else{_0x5aba4d=0xce;}_0x3ce5c5[_0xd7a4('0x16')](_0x5aba4d);return _0x3ce5c5[_0xd7a4('0x17')](_0xd7a4('0x18'),_0x1d33a6+'-'+_0x439091+'/'+_0x9ed6a)[_0xd7a4('0x13')](_0x2ca575);}return null;};}function patchUpdates(_0x34a387){return function(_0x49f508){try{jsonpatch[_0xd7a4('0x19')](_0x49f508,_0x34a387,!![]);}catch(_0xfe7405){return BPromise[_0xd7a4('0x1a')](_0xfe7405);}return _0x49f508['save']();};}function saveUpdates(_0x24624a,_0x274c96){return function(_0x43f8c4){if(_0x43f8c4){return _0x43f8c4[_0xd7a4('0x1b')](_0x24624a)[_0xd7a4('0x1c')](function(_0x19bad9){return _0x19bad9;});}return null;};}function removeEntity(_0x1ecbf1,_0x4118a6){return function(_0x51fc44){if(_0x51fc44){return _0x51fc44[_0xd7a4('0x1d')]()['then'](function(){_0x1ecbf1[_0xd7a4('0x16')](0xcc)[_0xd7a4('0x1e')]();});}};}function handleEntityNotFound(_0x526197,_0x3af46a){return function(_0x3f3a78){if(!_0x3f3a78){_0x526197[_0xd7a4('0x12')](0x194);}return _0x3f3a78;};}function handleError(_0x1e4fdd,_0x50c809){_0x50c809=_0x50c809||0x1f4;return function(_0x83bbc5){logger[_0xd7a4('0x1f')](_0x83bbc5['stack']);if(_0x83bbc5[_0xd7a4('0x20')]){delete _0x83bbc5['name'];}_0x1e4fdd[_0xd7a4('0x16')](_0x50c809)[_0xd7a4('0x21')](_0x83bbc5);};}exports[_0xd7a4('0x22')]=function(_0x5bf832,_0x1a6930){var _0x5394ac={},_0x554010={},_0x10ed5f={'count':0x0,'rows':[]};var _0x59dba6=db['CmHopperBlack']['rawAttributes'];_0x554010['model']=_['keys'](_0x59dba6);var _0x3da8db={'dateStart':_0x5bf832[_0xd7a4('0x23')][_0xd7a4('0x24')],'dateEnd':_0x5bf832[_0xd7a4('0x23')][_0xd7a4('0x25')]};delete _0x5bf832[_0xd7a4('0x23')]['dateStart'];delete _0x5bf832[_0xd7a4('0x23')][_0xd7a4('0x25')];_0x554010[_0xd7a4('0x23')]=_[_0xd7a4('0x26')](_0x5bf832[_0xd7a4('0x23')]);_0x554010[_0xd7a4('0x27')]=_[_0xd7a4('0x28')](_0x554010[_0xd7a4('0x29')],_0x554010[_0xd7a4('0x23')]);_0x5394ac[_0xd7a4('0x2a')]=_['intersection'](_0x554010['model'],qs[_0xd7a4('0x2b')](_0x5bf832[_0xd7a4('0x23')][_0xd7a4('0x2b')]));_0x5394ac[_0xd7a4('0x2a')]=_0x5394ac[_0xd7a4('0x2a')]['length']?_0x5394ac[_0xd7a4('0x2a')]:_0x554010[_0xd7a4('0x29')];if(!_0x5bf832['query'][_0xd7a4('0x2c')](_0xd7a4('0x2d'))){_0x5394ac['limit']=qs[_0xd7a4('0x15')](_0x5bf832[_0xd7a4('0x23')]['limit']);_0x5394ac[_0xd7a4('0x14')]=qs['offset'](_0x5bf832['query'][_0xd7a4('0x14')]);}_0x5394ac['order']=qs[_0xd7a4('0x2e')](_0x5bf832[_0xd7a4('0x23')][_0xd7a4('0x2e')]);_0x5394ac[_0xd7a4('0x2f')]=qs[_0xd7a4('0x27')](_[_0xd7a4('0x30')](_0x5bf832['query'],_0x554010[_0xd7a4('0x27')]));if(_0x3da8db[_0xd7a4('0x24')]){if(_0x3da8db[_0xd7a4('0x25')]){_0x3da8db[_0xd7a4('0x25')]=moment(_0x3da8db['dateEnd'])[_0xd7a4('0x31')](0x1,_0xd7a4('0x32'));}else{_0x3da8db[_0xd7a4('0x25')]=moment(_0x3da8db[_0xd7a4('0x24')])[_0xd7a4('0x31')](0x1,_0xd7a4('0x32'));}_[_0xd7a4('0x33')](_0x5394ac[_0xd7a4('0x2f')],{'createdAt':{'$gte':_0x3da8db[_0xd7a4('0x24')],'$lte':_0x3da8db[_0xd7a4('0x25')]}});}if(_0x5bf832[_0xd7a4('0x23')][_0xd7a4('0x34')]){_0x5394ac['where']=_[_0xd7a4('0x33')](_0x5394ac[_0xd7a4('0x2f')],{'$or':_[_0xd7a4('0x35')](_0x5394ac[_0xd7a4('0x2a')],function(_0x3dba09){var _0x235a48={};_0x235a48[_0x3dba09]={'$like':'%'+_0x5bf832[_0xd7a4('0x23')][_0xd7a4('0x34')]+'%'};return _0x235a48;})});}_0x5394ac=_[_0xd7a4('0x33')]({},_0x5394ac,_0x5bf832[_0xd7a4('0x36')]);var _0x2b305f={'where':_0x5394ac[_0xd7a4('0x2f')]};return db[_0xd7a4('0x37')][_0xd7a4('0x38')](_0x2b305f)[_0xd7a4('0x1c')](function(_0x79ec24){_0x10ed5f['count']=_0x79ec24;if(_0x5bf832[_0xd7a4('0x23')]['includeAll']){_0x5394ac['include']=[{'all':!![]}];}return db[_0xd7a4('0x37')][_0xd7a4('0x39')](_0x5394ac);})[_0xd7a4('0x1c')](function(_0x2a75e7){_0x10ed5f[_0xd7a4('0x3a')]=_0x2a75e7;return _0x10ed5f;})[_0xd7a4('0x1c')](respondWithFilteredResult(_0x1a6930,_0x5394ac))['catch'](handleError(_0x1a6930,null));};exports[_0xd7a4('0x3b')]=function(_0x4157cf,_0x4c0507){var _0x59a854={'raw':!![],'where':{'id':_0x4157cf[_0xd7a4('0x3c')]['id']}},_0x5e80df={};_0x5e80df['model']=_[_0xd7a4('0x26')](db[_0xd7a4('0x37')][_0xd7a4('0x3d')]);_0x5e80df['query']=_[_0xd7a4('0x26')](_0x4157cf[_0xd7a4('0x23')]);_0x5e80df[_0xd7a4('0x27')]=_[_0xd7a4('0x28')](_0x5e80df['model'],_0x5e80df['query']);_0x59a854[_0xd7a4('0x2a')]=_[_0xd7a4('0x28')](_0x5e80df[_0xd7a4('0x29')],qs[_0xd7a4('0x2b')](_0x4157cf[_0xd7a4('0x23')][_0xd7a4('0x2b')]));_0x59a854[_0xd7a4('0x2a')]=_0x59a854[_0xd7a4('0x2a')][_0xd7a4('0x3e')]?_0x59a854[_0xd7a4('0x2a')]:_0x5e80df[_0xd7a4('0x29')];if(_0x4157cf[_0xd7a4('0x23')]['includeAll']){_0x59a854['include']=[{'all':!![]}];}_0x59a854=_[_0xd7a4('0x33')]({},_0x59a854,_0x4157cf[_0xd7a4('0x36')]);return db[_0xd7a4('0x37')][_0xd7a4('0x3f')](_0x59a854)[_0xd7a4('0x1c')](handleEntityNotFound(_0x4c0507,null))[_0xd7a4('0x1c')](respondWithResult(_0x4c0507,null))[_0xd7a4('0x40')](handleError(_0x4c0507,null));};exports[_0xd7a4('0x1b')]=function(_0x47eb35,_0x30b132){if(_0x47eb35[_0xd7a4('0x41')]['id']){delete _0x47eb35['body']['id'];}return db[_0xd7a4('0x37')][_0xd7a4('0x3f')]({'where':{'id':_0x47eb35[_0xd7a4('0x3c')]['id']}})[_0xd7a4('0x1c')](handleEntityNotFound(_0x30b132,null))[_0xd7a4('0x1c')](saveUpdates(_0x47eb35[_0xd7a4('0x41')],null))[_0xd7a4('0x1c')](respondWithResult(_0x30b132,null))['catch'](handleError(_0x30b132,null));};exports[_0xd7a4('0x1d')]=function(_0xc1064e,_0x2247f5){return db['CmHopperBlack'][_0xd7a4('0x3f')]({'where':{'id':_0xc1064e[_0xd7a4('0x3c')]['id']}})[_0xd7a4('0x1c')](handleEntityNotFound(_0x2247f5,null))[_0xd7a4('0x1c')](removeEntity(_0x2247f5,null))[_0xd7a4('0x40')](handleError(_0x2247f5,null));};exports[_0xd7a4('0x42')]=function(_0x5b2983,_0x3df973){return db[_0xd7a4('0x37')][_0xd7a4('0x42')]()[_0xd7a4('0x1c')](respondWithResult(_0x3df973,null))[_0xd7a4('0x40')](handleError(_0x3df973,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index dbb7dc8..2cb24ed 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 _0x4cd0=['cm_hopper_black','lodash','../../config/logger','api','moment','bluebird','request-promise','./cmHopperBlack.attributes','exports','CmHopperBlack'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x4cd0,0x1d7));var _0x04cd=function(_0x76e6db,_0x13e203){_0x76e6db=_0x76e6db-0x0;var _0xdef203=_0x4cd0[_0x76e6db];return _0xdef203;};'use strict';var _=require(_0x04cd('0x0'));var util=require('util');var logger=require(_0x04cd('0x1'))(_0x04cd('0x2'));var moment=require(_0x04cd('0x3'));var BPromise=require(_0x04cd('0x4'));var rp=require(_0x04cd('0x5'));var attributes=require(_0x04cd('0x6'));module[_0x04cd('0x7')]=function(_0x3d94bd,_0x4e98d7){return _0x3d94bd['define'](_0x04cd('0x8'),attributes,{'tableName':_0x04cd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1147=['request-promise','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1b8956,_0x4bc4ee){var _0x48302f=function(_0x3dc977){while(--_0x3dc977){_0x1b8956['push'](_0x1b8956['shift']());}};_0x48302f(++_0x4bc4ee);}(_0x1147,0xf5));var _0x7114=function(_0x363a67,_0x2ac9a2){_0x363a67=_0x363a67-0x0;var _0x3b9fa6=_0x1147[_0x363a67];return _0x3b9fa6;};'use strict';var _=require(_0x7114('0x0'));var util=require('util');var logger=require(_0x7114('0x1'))(_0x7114('0x2'));var moment=require(_0x7114('0x3'));var BPromise=require(_0x7114('0x4'));var rp=require(_0x7114('0x5'));var attributes=require(_0x7114('0x6'));module[_0x7114('0x7')]=function(_0x1bdc17,_0x167c93){return _0x1bdc17[_0x7114('0x8')]('CmHopperBlack',attributes,{'tableName':_0x7114('0x9'),'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 2f8cf88..e2899c9 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 _0x5f1f=['map','model','UpdateCmHopperBlack','update','body','debug','DestroyCmHopperBlack','destroy','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','info','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include'];(function(_0x12049f,_0x25f34f){var _0x23667e=function(_0x58f936){while(--_0x58f936){_0x12049f['push'](_0x12049f['shift']());}};_0x23667e(++_0x25f34f);}(_0x5f1f,0x7d));var _0xf5f1=function(_0x37e886,_0x17d0ad){_0x37e886=_0x37e886-0x0;var _0x57c5cd=_0x5f1f[_0x37e886];return _0x57c5cd;};'use strict';var _=require(_0xf5f1('0x0'));var util=require('util');var moment=require(_0xf5f1('0x1'));var BPromise=require(_0xf5f1('0x2'));var rs=require(_0xf5f1('0x3'));var fs=require('fs');var db=require(_0xf5f1('0x4'))['db'];var utils=require(_0xf5f1('0x5'));var logger=require(_0xf5f1('0x6'))(_0xf5f1('0x7'));var config=require(_0xf5f1('0x8'));var jayson=require(_0xf5f1('0x9'));var client=jayson[_0xf5f1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d6d6d,_0x3a30d8,_0x2d5cb4){return new BPromise(function(_0x291102,_0x381870){return client[_0xf5f1('0xb')](_0x4d6d6d,_0x2d5cb4)[_0xf5f1('0xc')](function(_0x9e84f9){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x3a30d8,_0xf5f1('0xd'));logger['debug'](_0xf5f1('0xe'),_0x3a30d8,_0xf5f1('0xd'),JSON[_0xf5f1('0xf')](_0x9e84f9));if(_0x9e84f9[_0xf5f1('0x10')]){if(_0x9e84f9[_0xf5f1('0x10')][_0xf5f1('0x11')]===0x1f4){logger[_0xf5f1('0x10')](_0xf5f1('0x12'),_0x3a30d8,_0x9e84f9[_0xf5f1('0x10')][_0xf5f1('0x13')]);return _0x381870(_0x9e84f9[_0xf5f1('0x10')][_0xf5f1('0x13')]);}logger[_0xf5f1('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x3a30d8,_0x9e84f9[_0xf5f1('0x10')]['message']);return _0x291102(_0x9e84f9['error']['message']);}else{logger[_0xf5f1('0x14')](_0xf5f1('0x12'),_0x3a30d8,_0xf5f1('0xd'));_0x291102(_0x9e84f9['result']['message']);}})[_0xf5f1('0x15')](function(_0x8de6d7){logger['error'](_0xf5f1('0x12'),_0x3a30d8,_0x8de6d7);_0x381870(_0x8de6d7);});});}exports[_0xf5f1('0x16')]=function(_0x28dc59){var _0x2715e8=this;return new Promise(function(_0x3468a0,_0x6afc0c){return db[_0xf5f1('0x17')][_0xf5f1('0x18')]({'raw':_0x28dc59['options']?_0x28dc59[_0xf5f1('0x19')][_0xf5f1('0x1a')]===undefined?!![]:![]:!![],'where':_0x28dc59[_0xf5f1('0x19')]?_0x28dc59[_0xf5f1('0x19')][_0xf5f1('0x1b')]||null:null,'attributes':_0x28dc59[_0xf5f1('0x19')]?_0x28dc59['options'][_0xf5f1('0x1c')]||null:null,'limit':_0x28dc59[_0xf5f1('0x19')]?_0x28dc59[_0xf5f1('0x19')][_0xf5f1('0x1d')]||null:null,'include':_0x28dc59['options']?_0x28dc59['options'][_0xf5f1('0x1e')]?_[_0xf5f1('0x1f')](_0x28dc59[_0xf5f1('0x19')]['include'],function(_0x5c97ba){return{'model':db[_0x5c97ba['model']],'as':_0x5c97ba['as'],'attributes':_0x5c97ba[_0xf5f1('0x1c')],'include':_0x5c97ba['include']?_['map'](_0x5c97ba[_0xf5f1('0x1e')],function(_0x362642){return{'model':db[_0x362642[_0xf5f1('0x20')]],'as':_0x362642['as'],'attributes':_0x362642['attributes'],'include':_0x362642['include']?_['map'](_0x362642[_0xf5f1('0x1e')],function(_0x112838){return{'model':db[_0x112838[_0xf5f1('0x20')]],'as':_0x112838['as'],'attributes':_0x112838[_0xf5f1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf5f1('0xc')](function(_0x588b91){logger[_0xf5f1('0x14')](_0xf5f1('0x16'),_0x28dc59);logger['debug'](_0xf5f1('0x16'),_0x28dc59,JSON[_0xf5f1('0xf')](_0x588b91));_0x3468a0(_0x588b91);})['catch'](function(_0x35eb5e){logger['error'](_0xf5f1('0x16'),_0x35eb5e[_0xf5f1('0x13')],_0x28dc59);_0x6afc0c(_0x2715e8[_0xf5f1('0x10')](0x1f4,_0x35eb5e[_0xf5f1('0x13')]));});});};exports[_0xf5f1('0x21')]=function(_0x2858e2){var _0x71e252=this;return new Promise(function(_0x46b599,_0x38ccb4){return db['CmHopperBlack'][_0xf5f1('0x22')](_0x2858e2[_0xf5f1('0x23')],{'raw':_0x2858e2[_0xf5f1('0x19')]?_0x2858e2[_0xf5f1('0x19')][_0xf5f1('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2858e2[_0xf5f1('0x19')]?_0x2858e2[_0xf5f1('0x19')][_0xf5f1('0x1b')]||null:null,'attributes':_0x2858e2[_0xf5f1('0x19')]?_0x2858e2[_0xf5f1('0x19')][_0xf5f1('0x1c')]||null:null,'limit':_0x2858e2[_0xf5f1('0x19')]?_0x2858e2['options']['limit']||null:null})[_0xf5f1('0xc')](function(_0x28cfa0){logger[_0xf5f1('0x14')](_0xf5f1('0x21'),_0x2858e2);logger[_0xf5f1('0x24')](_0xf5f1('0x21'),_0x2858e2,JSON[_0xf5f1('0xf')](_0x28cfa0));_0x46b599(_0x28cfa0);})[_0xf5f1('0x15')](function(_0x22475a){logger[_0xf5f1('0x10')](_0xf5f1('0x21'),_0x22475a[_0xf5f1('0x13')],_0x2858e2);_0x38ccb4(_0x71e252[_0xf5f1('0x10')](0x1f4,_0x22475a[_0xf5f1('0x13')]));});});};exports[_0xf5f1('0x25')]=function(_0x597709){var _0x506d82=this;return new Promise(function(_0x36cbee,_0x20a792){return db[_0xf5f1('0x17')][_0xf5f1('0x26')]({'where':_0x597709['options']?_0x597709[_0xf5f1('0x19')][_0xf5f1('0x1b')]||null:null})[_0xf5f1('0xc')](function(_0x166ebc){logger['info']('DestroyCmHopperBlack',_0x597709);logger[_0xf5f1('0x24')](_0xf5f1('0x25'),_0x597709,JSON[_0xf5f1('0xf')](_0x166ebc));_0x36cbee(_0x166ebc);})[_0xf5f1('0x15')](function(_0x3778fb){logger[_0xf5f1('0x10')](_0xf5f1('0x25'),_0x3778fb[_0xf5f1('0x13')],_0x597709);_0x20a792(_0x506d82[_0xf5f1('0x10')](0x1f4,_0x3778fb['message']));});});}; \ No newline at end of file +var _0x210d=['info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','message','result','GetCmHopperBlack','findAll','options','raw','attributes','include','map','model','then','stringify','catch','UpdateCmHopperBlack','CmHopperBlack','body','where','limit','DestroyCmHopperBlack','destroy','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x210d,0x1ee));var _0xd210=function(_0x1a1b6e,_0x3a07a9){_0x1a1b6e=_0x1a1b6e-0x0;var _0x571e2c=_0x210d[_0x1a1b6e];return _0x571e2c;};'use strict';var _=require('lodash');var util=require(_0xd210('0x0'));var moment=require('moment');var BPromise=require(_0xd210('0x1'));var rs=require(_0xd210('0x2'));var fs=require('fs');var db=require(_0xd210('0x3'))['db'];var utils=require(_0xd210('0x4'));var logger=require(_0xd210('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd210('0x6'));var client=jayson[_0xd210('0x7')][_0xd210('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x13b7a6,_0x5c97dd,_0xc56195){return new BPromise(function(_0x1e24c1,_0x572de2){return client[_0xd210('0x9')](_0x13b7a6,_0xc56195)['then'](function(_0x1823d0){logger[_0xd210('0xa')](_0xd210('0xb'),_0x5c97dd,_0xd210('0xc'));logger[_0xd210('0xd')](_0xd210('0xe'),_0x5c97dd,'request\x20sent',JSON['stringify'](_0x1823d0));if(_0x1823d0['error']){if(_0x1823d0[_0xd210('0xf')]['code']===0x1f4){logger[_0xd210('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x5c97dd,_0x1823d0[_0xd210('0xf')]['message']);return _0x572de2(_0x1823d0[_0xd210('0xf')][_0xd210('0x10')]);}logger[_0xd210('0xf')](_0xd210('0xb'),_0x5c97dd,_0x1823d0[_0xd210('0xf')][_0xd210('0x10')]);return _0x1e24c1(_0x1823d0[_0xd210('0xf')][_0xd210('0x10')]);}else{logger['info'](_0xd210('0xb'),_0x5c97dd,_0xd210('0xc'));_0x1e24c1(_0x1823d0[_0xd210('0x11')]['message']);}})['catch'](function(_0x490316){logger[_0xd210('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x5c97dd,_0x490316);_0x572de2(_0x490316);});});}exports[_0xd210('0x12')]=function(_0x4ec776){var _0x3c64e6=this;return new Promise(function(_0x431e06,_0x16984f){return db['CmHopperBlack'][_0xd210('0x13')]({'raw':_0x4ec776[_0xd210('0x14')]?_0x4ec776[_0xd210('0x14')][_0xd210('0x15')]===undefined?!![]:![]:!![],'where':_0x4ec776[_0xd210('0x14')]?_0x4ec776[_0xd210('0x14')]['where']||null:null,'attributes':_0x4ec776[_0xd210('0x14')]?_0x4ec776[_0xd210('0x14')][_0xd210('0x16')]||null:null,'limit':_0x4ec776[_0xd210('0x14')]?_0x4ec776['options']['limit']||null:null,'include':_0x4ec776[_0xd210('0x14')]?_0x4ec776[_0xd210('0x14')]['include']?_['map'](_0x4ec776[_0xd210('0x14')][_0xd210('0x17')],function(_0x135f57){return{'model':db[_0x135f57['model']],'as':_0x135f57['as'],'attributes':_0x135f57[_0xd210('0x16')],'include':_0x135f57[_0xd210('0x17')]?_[_0xd210('0x18')](_0x135f57['include'],function(_0x28fc41){return{'model':db[_0x28fc41[_0xd210('0x19')]],'as':_0x28fc41['as'],'attributes':_0x28fc41[_0xd210('0x16')],'include':_0x28fc41[_0xd210('0x17')]?_['map'](_0x28fc41[_0xd210('0x17')],function(_0x5bdf77){return{'model':db[_0x5bdf77[_0xd210('0x19')]],'as':_0x5bdf77['as'],'attributes':_0x5bdf77[_0xd210('0x16')]};}):[]};}):[]};}):[]:[]})[_0xd210('0x1a')](function(_0x69f78c){logger[_0xd210('0xa')](_0xd210('0x12'),_0x4ec776);logger[_0xd210('0xd')](_0xd210('0x12'),_0x4ec776,JSON[_0xd210('0x1b')](_0x69f78c));_0x431e06(_0x69f78c);})[_0xd210('0x1c')](function(_0x2b3428){logger[_0xd210('0xf')]('GetCmHopperBlack',_0x2b3428[_0xd210('0x10')],_0x4ec776);_0x16984f(_0x3c64e6[_0xd210('0xf')](0x1f4,_0x2b3428[_0xd210('0x10')]));});});};exports[_0xd210('0x1d')]=function(_0x34d2f3){var _0x216883=this;return new Promise(function(_0x43703f,_0x27553a){return db[_0xd210('0x1e')]['update'](_0x34d2f3[_0xd210('0x1f')],{'raw':_0x34d2f3[_0xd210('0x14')]?_0x34d2f3[_0xd210('0x14')][_0xd210('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34d2f3['options']?_0x34d2f3[_0xd210('0x14')][_0xd210('0x20')]||null:null,'attributes':_0x34d2f3[_0xd210('0x14')]?_0x34d2f3[_0xd210('0x14')][_0xd210('0x16')]||null:null,'limit':_0x34d2f3[_0xd210('0x14')]?_0x34d2f3['options'][_0xd210('0x21')]||null:null})[_0xd210('0x1a')](function(_0x896aa3){logger[_0xd210('0xa')]('UpdateCmHopperBlack',_0x34d2f3);logger['debug'](_0xd210('0x1d'),_0x34d2f3,JSON['stringify'](_0x896aa3));_0x43703f(_0x896aa3);})[_0xd210('0x1c')](function(_0x4a8dfa){logger['error']('UpdateCmHopperBlack',_0x4a8dfa[_0xd210('0x10')],_0x34d2f3);_0x27553a(_0x216883[_0xd210('0xf')](0x1f4,_0x4a8dfa['message']));});});};exports[_0xd210('0x22')]=function(_0x4c32a0){var _0x27e4d8=this;return new Promise(function(_0xcdea91,_0x189660){return db[_0xd210('0x1e')][_0xd210('0x23')]({'where':_0x4c32a0[_0xd210('0x14')]?_0x4c32a0['options'][_0xd210('0x20')]||null:null})[_0xd210('0x1a')](function(_0x1447e1){logger[_0xd210('0xa')](_0xd210('0x22'),_0x4c32a0);logger[_0xd210('0xd')](_0xd210('0x22'),_0x4c32a0,JSON[_0xd210('0x1b')](_0x1447e1));_0xcdea91(_0x1447e1);})['catch'](function(_0xab168d){logger['error'](_0xd210('0x22'),_0xab168d['message'],_0x4c32a0);_0x189660(_0x27e4d8['error'](0x1f4,_0xab168d[_0xd210('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 05e8d72..01a2ec6 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 _0x2269=['show','put','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','isAuthenticated','describe'];(function(_0x6182ff,_0x59d492){var _0x1cec22=function(_0x2e96f8){while(--_0x2e96f8){_0x6182ff['push'](_0x6182ff['shift']());}};_0x1cec22(++_0x59d492);}(_0x2269,0x101));var _0x9226=function(_0x5d6482,_0x1c9b00){_0x5d6482=_0x5d6482-0x0;var _0x32e681=_0x2269[_0x5d6482];return _0x32e681;};'use strict';var multer=require(_0x9226('0x0'));var util=require(_0x9226('0x1'));var path=require(_0x9226('0x2'));var express=require(_0x9226('0x3'));var router=express[_0x9226('0x4')]();var auth=require(_0x9226('0x5'));var interaction=require(_0x9226('0x6'));var config=require(_0x9226('0x7'));var controller=require(_0x9226('0x8'));router[_0x9226('0x9')]('/',auth['isAuthenticated'](),controller[_0x9226('0xa')]);router['get']('/describe',auth[_0x9226('0xb')](),controller[_0x9226('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9226('0xd')]);router[_0x9226('0xe')]('/:id',auth[_0x9226('0xb')](),controller['update']);router['delete'](_0x9226('0xf'),auth['isAuthenticated'](),controller[_0x9226('0x10')]);module[_0x9226('0x11')]=router; \ No newline at end of file +var _0x871f=['../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','destroy','exports','express','Router','../../components/auth/service'];(function(_0x5a5113,_0x1c008b){var _0x16a596=function(_0x2726d8){while(--_0x2726d8){_0x5a5113['push'](_0x5a5113['shift']());}};_0x16a596(++_0x1c008b);}(_0x871f,0x1bf));var _0xf871=function(_0x6caabc,_0x11b507){_0x6caabc=_0x6caabc-0x0;var _0xe08a28=_0x871f[_0x6caabc];return _0xe08a28;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0xf871('0x0'));var router=express[_0xf871('0x1')]();var auth=require(_0xf871('0x2'));var interaction=require(_0xf871('0x3'));var config=require(_0xf871('0x4'));var controller=require(_0xf871('0x5'));router[_0xf871('0x6')]('/',auth[_0xf871('0x7')](),controller[_0xf871('0x8')]);router[_0xf871('0x6')](_0xf871('0x9'),auth['isAuthenticated'](),controller[_0xf871('0xa')]);router[_0xf871('0x6')](_0xf871('0xb'),auth[_0xf871('0x7')](),controller[_0xf871('0xc')]);router[_0xf871('0xd')](_0xf871('0xb'),auth['isAuthenticated'](),controller[_0xf871('0xe')]);router[_0xf871('0xf')](_0xf871('0xb'),auth[_0xf871('0x7')](),controller[_0xf871('0x10')]);module[_0xf871('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 b369b46..0fb999c 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 _0x5426=['setDataValue','followuptime','diff','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime'];(function(_0x24ec6f,_0x1de736){var _0x2b3d05=function(_0x1d5215){while(--_0x1d5215){_0x24ec6f['push'](_0x24ec6f['shift']());}};_0x2b3d05(++_0x1de736);}(_0x5426,0xd5));var _0x6542=function(_0x286d27,_0xc83500){_0x286d27=_0x286d27-0x0;var _0x53544e=_0x5426[_0x286d27];return _0x53544e;};'use strict';var Sequelize=require(_0x6542('0x0'));var moment=require(_0x6542('0x1'));module[_0x6542('0x2')]={'state':{'type':Sequelize[_0x6542('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x6542('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6542('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6542('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6542('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6542('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x6542('0x4')]},'originatecalleridname':{'type':Sequelize[_0x6542('0x4')]},'calleridnum':{'type':Sequelize[_0x6542('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x6542('0x5')]},'responsetime':{'type':Sequelize[_0x6542('0x5')]},'answertime':{'type':Sequelize[_0x6542('0x5')]},'droptime':{'type':Sequelize[_0x6542('0x5')]},'endtime':{'type':Sequelize[_0x6542('0x5')]},'ringtime':{'type':Sequelize[_0x6542('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6542('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6542('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6542('0x4')]},'campaign':{'type':Sequelize[_0x6542('0x4')]},'campaigntype':{'type':Sequelize[_0x6542('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x6542('0x4')]},'disposition':{'type':Sequelize[_0x6542('0x4')]},'dispositionat':{'type':Sequelize[_0x6542('0x5')],'set':function(_0x341bf1){var _0x35f89a=this[_0x6542('0x6')](_0x6542('0x7'));if(_0x35f89a&&_0x341bf1){this[_0x6542('0x8')](_0x6542('0x9'),moment(_0x341bf1)[_0x6542('0xa')](moment(_0x35f89a),'seconds'));}return this[_0x6542('0x8')](_0x6542('0xb'),_0x341bf1);}},'amd':{'type':Sequelize[_0x6542('0xc')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6542('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6542('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6542('0x5')]},'callback':{'type':Sequelize[_0x6542('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6542('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6542('0x5')]},'recallme':{'type':Sequelize[_0x6542('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6542('0x5')]}}; \ No newline at end of file +var _0xb18a=['setDataValue','diff','seconds','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime'];(function(_0x1d4bca,_0x83f0b6){var _0x2d97b3=function(_0x51c4e4){while(--_0x51c4e4){_0x1d4bca['push'](_0x1d4bca['shift']());}};_0x2d97b3(++_0x83f0b6);}(_0xb18a,0xfc));var _0xab18=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xb18a[_0x101e7b];return _0x4995c0;};'use strict';var Sequelize=require(_0xab18('0x0'));var moment=require(_0xab18('0x1'));module[_0xab18('0x2')]={'state':{'type':Sequelize[_0xab18('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xab18('0x4')]},'scheduledat':{'type':Sequelize[_0xab18('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xab18('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xab18('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xab18('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xab18('0x4')]},'originatecalleridname':{'type':Sequelize[_0xab18('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xab18('0x4')]},'starttime':{'type':Sequelize[_0xab18('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xab18('0x5')]},'droptime':{'type':Sequelize[_0xab18('0x5')]},'endtime':{'type':Sequelize[_0xab18('0x5')]},'ringtime':{'type':Sequelize[_0xab18('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xab18('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xab18('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xab18('0x4')]},'campaign':{'type':Sequelize[_0xab18('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xab18('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xab18('0x5')],'set':function(_0x2408ed){var _0x30b9b9=this[_0xab18('0x6')](_0xab18('0x7'));if(_0x30b9b9&&_0x2408ed){this[_0xab18('0x8')]('followuptime',moment(_0x2408ed)[_0xab18('0x9')](moment(_0x30b9b9),_0xab18('0xa')));}return this['setDataValue'](_0xab18('0xb'),_0x2408ed);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xab18('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xab18('0x5')]},'callback':{'type':Sequelize[_0xab18('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xab18('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xab18('0x5')]},'deleted':{'type':Sequelize[_0xab18('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xab18('0x5')]},'recallme':{'type':Sequelize[_0xab18('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xab18('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 8112521..628652c 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 _0x8a1f=['jsforce','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','status','end','json','offset','limit','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','index','CmHopperFinal','rawAttributes','keys','dateStart','query','dateEnd','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day','merge','filter','map','options','count','includeAll','include','findAll','rows','catch','show','find','body','uniqueid','params','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','NOW()','field','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','findOne','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x4b71ae,_0x3333ad){var _0x1efc6b=function(_0x136e6b){while(--_0x136e6b){_0x4b71ae['push'](_0x4b71ae['shift']());}};_0x1efc6b(++_0x3333ad);}(_0x8a1f,0x70));var _0xf8a1=function(_0x1c66f1,_0x53c85c){_0x1c66f1=_0x1c66f1-0x0;var _0x682d89=_0x8a1f[_0x1c66f1];return _0x682d89;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf8a1('0x0'));var BPromise=require(_0xf8a1('0x1'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf8a1('0x2'));var sox=require(_0xf8a1('0x3'));var csv=require(_0xf8a1('0x4'));var ejs=require(_0xf8a1('0x5'));var fs=require('fs');var _=require(_0xf8a1('0x6'));var squel=require(_0xf8a1('0x7'));var crypto=require(_0xf8a1('0x8'));var jsforce=require(_0xf8a1('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xf8a1('0x4'));var querystring=require('querystring');var Papa=require(_0xf8a1('0xa'));var qs=require(_0xf8a1('0xb'));var logger=require(_0xf8a1('0xc'))('api');var utils=require(_0xf8a1('0xd'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1630ce,_0xdf9e1f){_0xdf9e1f=_0xdf9e1f||0xcc;return function(_0x12df15){if(_0x12df15){return _0x1630ce['sendStatus'](_0xdf9e1f);}return _0x1630ce[_0xf8a1('0xe')](_0xdf9e1f)[_0xf8a1('0xf')]();};}function respondWithResult(_0xecc8d1,_0x44a4cc){_0x44a4cc=_0x44a4cc||0xc8;return function(_0xb52655){if(_0xb52655){return _0xecc8d1[_0xf8a1('0xe')](_0x44a4cc)[_0xf8a1('0x10')](_0xb52655);}};}function respondWithFilteredResult(_0x2cd271,_0x3882d6){return function(_0x176212){if(_0x176212){var _0x2c8b96=_0x176212['count'],_0x30990e=_0x3882d6[_0xf8a1('0x11')],_0x5a79e7=_0x3882d6[_0xf8a1('0x11')]+_0x3882d6[_0xf8a1('0x12')],_0x511f45;if(_0x5a79e7>=_0x2c8b96){_0x5a79e7=_0x2c8b96;_0x511f45=0xc8;}else{_0x511f45=0xce;}_0x2cd271[_0xf8a1('0xe')](_0x511f45);return _0x2cd271['set'](_0xf8a1('0x13'),_0x30990e+'-'+_0x5a79e7+'/'+_0x2c8b96)['json'](_0x176212);}return null;};}function patchUpdates(_0x5efdf3){return function(_0x32437e){try{jsonpatch['apply'](_0x32437e,_0x5efdf3,!![]);}catch(_0xfbeae9){return BPromise[_0xf8a1('0x14')](_0xfbeae9);}return _0x32437e['save']();};}function saveUpdates(_0x5ea1cc,_0x589720){return function(_0x317dda){if(_0x317dda){return _0x317dda[_0xf8a1('0x15')](_0x5ea1cc)[_0xf8a1('0x16')](function(_0x454d00){return _0x454d00;});}return null;};}function removeEntity(_0x38ddcc,_0x40cbcf){return function(_0x510828){if(_0x510828){return _0x510828[_0xf8a1('0x17')]()[_0xf8a1('0x16')](function(){_0x38ddcc[_0xf8a1('0xe')](0xcc)[_0xf8a1('0xf')]();});}};}function handleEntityNotFound(_0x47a9ce,_0x19e086){return function(_0x4e455f){if(!_0x4e455f){_0x47a9ce[_0xf8a1('0x18')](0x194);}return _0x4e455f;};}function handleError(_0x59e81b,_0x49b96f){_0x49b96f=_0x49b96f||0x1f4;return function(_0x27d36e){logger[_0xf8a1('0x19')](_0x27d36e[_0xf8a1('0x1a')]);if(_0x27d36e[_0xf8a1('0x1b')]){delete _0x27d36e['name'];}_0x59e81b['status'](_0x49b96f)[_0xf8a1('0x1c')](_0x27d36e);};}exports[_0xf8a1('0x1d')]=function(_0x31ec18,_0x2e84e2){var _0x51cbeb={},_0x363c19={},_0x5485ee={'count':0x0,'rows':[]};var _0xe24bf2=db[_0xf8a1('0x1e')][_0xf8a1('0x1f')];_0x363c19['model']=_[_0xf8a1('0x20')](_0xe24bf2);var _0xe8ec56={'dateStart':_0x31ec18['query'][_0xf8a1('0x21')],'dateEnd':_0x31ec18[_0xf8a1('0x22')][_0xf8a1('0x23')]};delete _0x31ec18[_0xf8a1('0x22')][_0xf8a1('0x21')];delete _0x31ec18[_0xf8a1('0x22')]['dateEnd'];_0x363c19['query']=_[_0xf8a1('0x20')](_0x31ec18[_0xf8a1('0x22')]);_0x363c19['filters']=_[_0xf8a1('0x24')](_0x363c19[_0xf8a1('0x25')],_0x363c19['query']);_0x51cbeb[_0xf8a1('0x26')]=_['intersection'](_0x363c19[_0xf8a1('0x25')],qs[_0xf8a1('0x27')](_0x31ec18['query']['fields']));_0x51cbeb[_0xf8a1('0x26')]=_0x51cbeb[_0xf8a1('0x26')][_0xf8a1('0x28')]?_0x51cbeb[_0xf8a1('0x26')]:_0x363c19[_0xf8a1('0x25')];if(!_0x31ec18[_0xf8a1('0x22')][_0xf8a1('0x29')](_0xf8a1('0x2a'))){_0x51cbeb[_0xf8a1('0x12')]=qs[_0xf8a1('0x12')](_0x31ec18[_0xf8a1('0x22')][_0xf8a1('0x12')]);_0x51cbeb[_0xf8a1('0x11')]=qs[_0xf8a1('0x11')](_0x31ec18[_0xf8a1('0x22')][_0xf8a1('0x11')]);}_0x51cbeb[_0xf8a1('0x2b')]=qs[_0xf8a1('0x2c')](_0x31ec18[_0xf8a1('0x22')][_0xf8a1('0x2c')]);_0x51cbeb[_0xf8a1('0x2d')]=qs[_0xf8a1('0x2e')](_[_0xf8a1('0x2f')](_0x31ec18[_0xf8a1('0x22')],_0x363c19[_0xf8a1('0x2e')]));if(_0xe8ec56['dateStart']){if(_0xe8ec56[_0xf8a1('0x23')]){_0xe8ec56[_0xf8a1('0x23')]=moment(_0xe8ec56[_0xf8a1('0x23')])[_0xf8a1('0x30')](0x1,'day');}else{_0xe8ec56[_0xf8a1('0x23')]=moment(_0xe8ec56[_0xf8a1('0x21')])['add'](0x1,_0xf8a1('0x31'));}_[_0xf8a1('0x32')](_0x51cbeb['where'],{'createdAt':{'$gte':_0xe8ec56['dateStart'],'$lte':_0xe8ec56[_0xf8a1('0x23')]}});}if(_0x31ec18[_0xf8a1('0x22')][_0xf8a1('0x33')]){_0x51cbeb[_0xf8a1('0x2d')]=_['merge'](_0x51cbeb[_0xf8a1('0x2d')],{'$or':_[_0xf8a1('0x34')](_0x51cbeb[_0xf8a1('0x26')],function(_0x293fe6){var _0x398942={};_0x398942[_0x293fe6]={'$like':'%'+_0x31ec18[_0xf8a1('0x22')]['filter']+'%'};return _0x398942;})});}_0x51cbeb=_[_0xf8a1('0x32')]({},_0x51cbeb,_0x31ec18[_0xf8a1('0x35')]);var _0x4a353c={'where':_0x51cbeb['where']};return db[_0xf8a1('0x1e')]['count'](_0x4a353c)[_0xf8a1('0x16')](function(_0x2ce94b){_0x5485ee[_0xf8a1('0x36')]=_0x2ce94b;if(_0x31ec18['query'][_0xf8a1('0x37')]){_0x51cbeb[_0xf8a1('0x38')]=[{'all':!![]}];}return db[_0xf8a1('0x1e')][_0xf8a1('0x39')](_0x51cbeb);})[_0xf8a1('0x16')](function(_0x4f8a4e){_0x5485ee[_0xf8a1('0x3a')]=_0x4f8a4e;return _0x5485ee;})[_0xf8a1('0x16')](respondWithFilteredResult(_0x2e84e2,_0x51cbeb))[_0xf8a1('0x3b')](handleError(_0x2e84e2,null));};exports[_0xf8a1('0x3c')]=function(_0x3d3135,_0x19888e){var _0x1495d9={'raw':!![],'where':{'id':_0x3d3135['params']['id']}},_0x369786={};_0x369786[_0xf8a1('0x25')]=_[_0xf8a1('0x20')](db[_0xf8a1('0x1e')][_0xf8a1('0x1f')]);_0x369786[_0xf8a1('0x22')]=_[_0xf8a1('0x20')](_0x3d3135[_0xf8a1('0x22')]);_0x369786[_0xf8a1('0x2e')]=_[_0xf8a1('0x24')](_0x369786['model'],_0x369786[_0xf8a1('0x22')]);_0x1495d9[_0xf8a1('0x26')]=_[_0xf8a1('0x24')](_0x369786[_0xf8a1('0x25')],qs[_0xf8a1('0x27')](_0x3d3135[_0xf8a1('0x22')][_0xf8a1('0x27')]));_0x1495d9[_0xf8a1('0x26')]=_0x1495d9['attributes']['length']?_0x1495d9['attributes']:_0x369786[_0xf8a1('0x25')];if(_0x3d3135[_0xf8a1('0x22')][_0xf8a1('0x37')]){_0x1495d9[_0xf8a1('0x38')]=[{'all':!![]}];}_0x1495d9=_['merge']({},_0x1495d9,_0x3d3135[_0xf8a1('0x35')]);return db[_0xf8a1('0x1e')][_0xf8a1('0x3d')](_0x1495d9)[_0xf8a1('0x16')](handleEntityNotFound(_0x19888e,null))[_0xf8a1('0x16')](respondWithResult(_0x19888e,null))[_0xf8a1('0x3b')](handleError(_0x19888e,null));};exports['describe']=function(_0x1545e7,_0x42709c){return db[_0xf8a1('0x1e')]['describe']()[_0xf8a1('0x16')](respondWithResult(_0x42709c,null))['catch'](handleError(_0x42709c,null));};exports[_0xf8a1('0x15')]=function(_0xd63de0,_0x1950f1){if(_0xd63de0[_0xf8a1('0x3e')]['uniqueid']){delete _0xd63de0[_0xf8a1('0x3e')][_0xf8a1('0x3f')];}return db[_0xf8a1('0x1e')][_0xf8a1('0x3d')]({'where':{'uniqueid':_0xd63de0[_0xf8a1('0x40')]['id']}})[_0xf8a1('0x16')](handleEntityNotFound(_0x1950f1,null))[_0xf8a1('0x16')](saveUpdates(_0xd63de0[_0xf8a1('0x3e')],null))[_0xf8a1('0x16')](respondWithResult(_0x1950f1,null))[_0xf8a1('0x3b')](handleError(_0x1950f1,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x3b9df,_0x54c7cd,_0x157dd7){return db[_0xf8a1('0x1e')][_0xf8a1('0x39')]({'raw':![],'where':{'VoiceQueueId':_0x3b9df[_0xf8a1('0x40')]['id']},'attributes':[[db[_0xf8a1('0x41')]['fn'](_0xf8a1('0x42'),db[_0xf8a1('0x41')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0xf8a1('0x41')]['fn'](_0xf8a1('0x42'),db[_0xf8a1('0x41')]['fn']('IF',db[_0xf8a1('0x41')][_0xf8a1('0x43')](_0xf8a1('0x44')))),_0xf8a1('0x45')],[db['sequelize']['fn'](_0xf8a1('0x42'),db[_0xf8a1('0x41')]['fn']('IF',db['sequelize'][_0xf8a1('0x43')]('`state`\x20=\x205,\x201,\x20null'))),_0xf8a1('0x46')],[db[_0xf8a1('0x41')]['fn']('COUNT',db[_0xf8a1('0x41')]['fn']('IF',db[_0xf8a1('0x41')]['literal'](_0xf8a1('0x47')))),_0xf8a1('0x48')],[db['sequelize']['fn'](_0xf8a1('0x42'),db[_0xf8a1('0x41')]['fn']('IF',db['sequelize'][_0xf8a1('0x43')](_0xf8a1('0x49')))),_0xf8a1('0x4a')],[db[_0xf8a1('0x41')]['fn'](_0xf8a1('0x42'),db[_0xf8a1('0x41')]['fn']('IF',db[_0xf8a1('0x41')][_0xf8a1('0x43')](_0xf8a1('0x4b')))),_0xf8a1('0x4c')],[db['sequelize']['fn']('COUNT',db[_0xf8a1('0x41')]['fn']('IF',db[_0xf8a1('0x41')][_0xf8a1('0x43')](_0xf8a1('0x4d')))),'reCallContacts']]})[_0xf8a1('0x16')](handleEntityNotFound(_0x54c7cd,null))[_0xf8a1('0x16')](respondWithResult(_0x54c7cd,null))['catch'](handleError(_0x54c7cd,null));};exports[_0xf8a1('0x4e')]=function(_0x5ea33c,_0x4e93b2,_0x2dfa24){return db[_0xf8a1('0x1e')][_0xf8a1('0x39')]({'raw':![],'where':{'CampaignId':_0x5ea33c[_0xf8a1('0x40')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xf8a1('0x4f')))),_0xf8a1('0x50')],[db['sequelize']['fn'](_0xf8a1('0x42'),db[_0xf8a1('0x41')]['fn']('IF',db['sequelize']['literal'](_0xf8a1('0x44')))),_0xf8a1('0x45')],[db[_0xf8a1('0x41')]['fn'](_0xf8a1('0x42'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xf8a1('0x51')))),_0xf8a1('0x46')],[db[_0xf8a1('0x41')]['fn'](_0xf8a1('0x42'),db[_0xf8a1('0x41')]['fn']('IF',db[_0xf8a1('0x41')][_0xf8a1('0x43')]('`state`\x20=\x208,\x201,\x20null'))),_0xf8a1('0x48')],[db[_0xf8a1('0x41')]['fn'](_0xf8a1('0x42'),db['sequelize']['fn']('IF',db[_0xf8a1('0x41')][_0xf8a1('0x43')](_0xf8a1('0x49')))),'dropContacts'],[db['sequelize']['fn'](_0xf8a1('0x42'),db[_0xf8a1('0x41')]['fn']('IF',db[_0xf8a1('0x41')][_0xf8a1('0x43')](_0xf8a1('0x4b')))),_0xf8a1('0x4c')],[db['sequelize']['fn'](_0xf8a1('0x42'),db[_0xf8a1('0x41')]['fn']('IF',db['sequelize'][_0xf8a1('0x43')](_0xf8a1('0x4d')))),_0xf8a1('0x52')]]})[_0xf8a1('0x16')](handleEntityNotFound(_0x4e93b2,null))['then'](respondWithResult(_0x4e93b2,null))['catch'](handleError(_0x4e93b2,null));};exports[_0xf8a1('0x53')]=function(_0x3a5347,_0x4e0db6,_0x5109df){return db[_0xf8a1('0x54')]['find']({'where':{'id':_0x3a5347['params']['id']}})[_0xf8a1('0x16')](handleEntityNotFound(_0x4e0db6,null))[_0xf8a1('0x16')](function(_0x2849dc){var _0x323605;if(_0x2849dc){_0x323605=squel[_0xf8a1('0x55')]()[_0xf8a1('0x56')](_0xf8a1('0x57'))[_0xf8a1('0x58')]([_0xf8a1('0x59'),_0xf8a1('0x5a'),_0xf8a1('0x5b'),'ListId',_0xf8a1('0x5c'),_0xf8a1('0x5d'),_0xf8a1('0x5e')],squel[_0xf8a1('0x5f')]()['field'](_0xf8a1('0x60'),_0xf8a1('0x59'))['field'](_0xf8a1('0x61'),'scheduledAt')[_0xf8a1('0x62')]('ANY_VALUE(ContactId)',_0xf8a1('0x5b'))[_0xf8a1('0x62')]('ANY_VALUE(ListId)',_0xf8a1('0x63'))['field'](_0xf8a1('0x64'),_0xf8a1('0x5c'))[_0xf8a1('0x62')]('NOW()',_0xf8a1('0x5d'))[_0xf8a1('0x62')](_0xf8a1('0x61'),_0xf8a1('0x5e'))[_0xf8a1('0x65')](_0xf8a1('0x66'))[_0xf8a1('0x2d')]('VoiceQueueId\x20=\x20?',_0x3a5347['params']['id'][_0xf8a1('0x67')]())[_0xf8a1('0x2d')](_0xf8a1('0x68'),_0x3a5347[_0xf8a1('0x3e')][_0xf8a1('0x69')][_0xf8a1('0x67')]())[_0xf8a1('0x2d')](_0xf8a1('0x6a'))[_0xf8a1('0x2d')](_0xf8a1('0x6b'),squel['select']()[_0xf8a1('0x62')](_0xf8a1('0x59'))['from'](_0xf8a1('0x57'))[_0xf8a1('0x2d')](_0xf8a1('0x6c'),_0x3a5347['params']['id'][_0xf8a1('0x67')]()))[_0xf8a1('0x2d')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0xf8a1('0x62')](_0xf8a1('0x6d'))['from'](_0xf8a1('0x66'))['where'](_0xf8a1('0x6c'),_0x3a5347['params']['id'][_0xf8a1('0x67')]())['where'](_0xf8a1('0x6e')))['group'](_0xf8a1('0x5b')))['toString']();return db[_0xf8a1('0x41')][_0xf8a1('0x22')](_0x323605);}return[];})[_0xf8a1('0x16')](respondWithResult(_0x4e0db6,null))[_0xf8a1('0x3b')](handleError(_0x4e0db6,null));};exports[_0xf8a1('0x6f')]=function(_0x4312d6,_0x243646,_0xe4f726){return db[_0xf8a1('0x70')][_0xf8a1('0x3d')]({'where':{'id':_0x4312d6[_0xf8a1('0x40')]['id']}})['then'](handleEntityNotFound(_0x243646,null))[_0xf8a1('0x16')](function(_0x1a4b4c){var _0x4e2c2a;if(_0x1a4b4c){_0x4e2c2a=squel['insert']()[_0xf8a1('0x56')](_0xf8a1('0x57'))[_0xf8a1('0x58')](['phone','scheduledAt','ContactId','ListId','CampaignId','createdAt',_0xf8a1('0x5e')],squel[_0xf8a1('0x5f')]()[_0xf8a1('0x62')](_0xf8a1('0x60'),_0xf8a1('0x59'))['field'](_0xf8a1('0x61'),_0xf8a1('0x5a'))[_0xf8a1('0x62')]('ANY_VALUE(ContactId)',_0xf8a1('0x5b'))[_0xf8a1('0x62')](_0xf8a1('0x71'),_0xf8a1('0x63'))[_0xf8a1('0x62')](_0xf8a1('0x72'),_0xf8a1('0x73'))[_0xf8a1('0x62')](_0xf8a1('0x61'),_0xf8a1('0x5d'))[_0xf8a1('0x62')]('NOW()','updatedAt')[_0xf8a1('0x65')]('cm_hopper_final')[_0xf8a1('0x2d')](_0xf8a1('0x74'),_0x4312d6[_0xf8a1('0x40')]['id'][_0xf8a1('0x67')]())[_0xf8a1('0x2d')](_0xf8a1('0x68'),_0x4312d6[_0xf8a1('0x3e')][_0xf8a1('0x69')]['toString']())[_0xf8a1('0x2d')](_0xf8a1('0x6a'))[_0xf8a1('0x2d')](_0xf8a1('0x6b'),squel[_0xf8a1('0x5f')]()[_0xf8a1('0x62')](_0xf8a1('0x59'))[_0xf8a1('0x65')](_0xf8a1('0x57'))[_0xf8a1('0x2d')](_0xf8a1('0x74'),_0x4312d6[_0xf8a1('0x40')]['id'][_0xf8a1('0x67')]()))[_0xf8a1('0x2d')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xf8a1('0x5f')]()['field'](_0xf8a1('0x6d'))[_0xf8a1('0x65')](_0xf8a1('0x66'))[_0xf8a1('0x2d')](_0xf8a1('0x74'),_0x4312d6[_0xf8a1('0x40')]['id']['toString']())[_0xf8a1('0x2d')](_0xf8a1('0x6e')))[_0xf8a1('0x75')](_0xf8a1('0x5b')))['toString']();return db[_0xf8a1('0x41')][_0xf8a1('0x22')](_0x4e2c2a);}return[];})['then'](respondWithResult(_0x243646,null))[_0xf8a1('0x3b')](handleError(_0x243646,null));};exports[_0xf8a1('0x76')]=function(_0x112709,_0x5cbc56,_0x51e11e){return db[_0xf8a1('0x77')][_0xf8a1('0x78')]({'where':{'VoiceQueueId':_0x112709['body']['VoiceQueueId'],'CampaignId':_0x112709[_0xf8a1('0x3e')][_0xf8a1('0x73')],'ContactId':_0x112709[_0xf8a1('0x3e')][_0xf8a1('0x5b')]}})[_0xf8a1('0x16')](handleEntityNotFound(_0x5cbc56,null))[_0xf8a1('0x16')](function(_0x503974){if(_0x503974){return _0x503974;}return null;})[_0xf8a1('0x16')](respondWithResult(_0x5cbc56,null))['catch'](handleError(_0x5cbc56,null));}; \ No newline at end of file +var _0xc381=['Content-Range','json','reject','save','update','then','error','stack','name','send','index','CmHopperFinal','rawAttributes','model','keys','query','dateStart','intersection','fields','attributes','length','nolimit','offset','order','sort','filters','pick','dateEnd','day','where','filter','map','merge','options','includeAll','include','findAll','rows','catch','show','params','find','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','COUNT','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','congestionContacts','dropContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','state\x20=\x204','Campaign','fromQuery','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','findOne','fast-json-patch','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set'];(function(_0xacabb,_0x1fbcd9){var _0x2b4a14=function(_0x3a2353){while(--_0x3a2353){_0xacabb['push'](_0xacabb['shift']());}};_0x2b4a14(++_0x1fbcd9);}(_0xc381,0x1da));var _0x1c38=function(_0x3132b0,_0x1e43ce){_0x3132b0=_0x3132b0-0x0;var _0xea4468=_0xc381[_0x3132b0];return _0xea4468;};'use strict';var jsonpatch=require(_0x1c38('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1c38('0x1'));var path=require(_0x1c38('0x2'));var sox=require(_0x1c38('0x3'));var csv=require(_0x1c38('0x4'));var ejs=require(_0x1c38('0x5'));var fs=require('fs');var _=require(_0x1c38('0x6'));var squel=require(_0x1c38('0x7'));var crypto=require('crypto');var jsforce=require(_0x1c38('0x8'));var deskjs=require(_0x1c38('0x9'));var toCsv=require(_0x1c38('0x4'));var querystring=require(_0x1c38('0xa'));var Papa=require(_0x1c38('0xb'));var qs=require(_0x1c38('0xc'));var logger=require('../../config/logger')('api');var utils=require(_0x1c38('0xd'));var config=require(_0x1c38('0xe'));var db=require(_0x1c38('0xf'))['db'];function respondWithStatusCode(_0x4368be,_0x161bbc){_0x161bbc=_0x161bbc||0xcc;return function(_0x69eea1){if(_0x69eea1){return _0x4368be[_0x1c38('0x10')](_0x161bbc);}return _0x4368be[_0x1c38('0x11')](_0x161bbc)[_0x1c38('0x12')]();};}function respondWithResult(_0x4c58f7,_0x3adb2f){_0x3adb2f=_0x3adb2f||0xc8;return function(_0x4c93b8){if(_0x4c93b8){return _0x4c58f7[_0x1c38('0x11')](_0x3adb2f)['json'](_0x4c93b8);}};}function respondWithFilteredResult(_0x21c5c4,_0x4b1eb7){return function(_0x1b36f1){if(_0x1b36f1){var _0xad6c2d=_0x1b36f1[_0x1c38('0x13')],_0x34316d=_0x4b1eb7['offset'],_0x547100=_0x4b1eb7['offset']+_0x4b1eb7[_0x1c38('0x14')],_0x37a3cf;if(_0x547100>=_0xad6c2d){_0x547100=_0xad6c2d;_0x37a3cf=0xc8;}else{_0x37a3cf=0xce;}_0x21c5c4[_0x1c38('0x11')](_0x37a3cf);return _0x21c5c4[_0x1c38('0x15')](_0x1c38('0x16'),_0x34316d+'-'+_0x547100+'/'+_0xad6c2d)[_0x1c38('0x17')](_0x1b36f1);}return null;};}function patchUpdates(_0x1ec4f5){return function(_0x24ced8){try{jsonpatch['apply'](_0x24ced8,_0x1ec4f5,!![]);}catch(_0x319fad){return BPromise[_0x1c38('0x18')](_0x319fad);}return _0x24ced8[_0x1c38('0x19')]();};}function saveUpdates(_0x4028af,_0x5c7fcb){return function(_0x4e600f){if(_0x4e600f){return _0x4e600f[_0x1c38('0x1a')](_0x4028af)[_0x1c38('0x1b')](function(_0x1426eb){return _0x1426eb;});}return null;};}function removeEntity(_0x459cec,_0x20844e){return function(_0xb7b8cd){if(_0xb7b8cd){return _0xb7b8cd['destroy']()[_0x1c38('0x1b')](function(){_0x459cec[_0x1c38('0x11')](0xcc)[_0x1c38('0x12')]();});}};}function handleEntityNotFound(_0x996345,_0x56f302){return function(_0x4d641b){if(!_0x4d641b){_0x996345[_0x1c38('0x10')](0x194);}return _0x4d641b;};}function handleError(_0x5dd8e4,_0x20e9b3){_0x20e9b3=_0x20e9b3||0x1f4;return function(_0x14c6fc){logger[_0x1c38('0x1c')](_0x14c6fc[_0x1c38('0x1d')]);if(_0x14c6fc[_0x1c38('0x1e')]){delete _0x14c6fc[_0x1c38('0x1e')];}_0x5dd8e4[_0x1c38('0x11')](_0x20e9b3)[_0x1c38('0x1f')](_0x14c6fc);};}exports[_0x1c38('0x20')]=function(_0x1e0fd2,_0x1f3d07){var _0x135f3d={},_0xbe1a85={},_0x52fa34={'count':0x0,'rows':[]};var _0x1da232=db[_0x1c38('0x21')][_0x1c38('0x22')];_0xbe1a85[_0x1c38('0x23')]=_[_0x1c38('0x24')](_0x1da232);var _0x13ca36={'dateStart':_0x1e0fd2[_0x1c38('0x25')][_0x1c38('0x26')],'dateEnd':_0x1e0fd2[_0x1c38('0x25')]['dateEnd']};delete _0x1e0fd2[_0x1c38('0x25')][_0x1c38('0x26')];delete _0x1e0fd2[_0x1c38('0x25')]['dateEnd'];_0xbe1a85[_0x1c38('0x25')]=_[_0x1c38('0x24')](_0x1e0fd2[_0x1c38('0x25')]);_0xbe1a85['filters']=_['intersection'](_0xbe1a85[_0x1c38('0x23')],_0xbe1a85[_0x1c38('0x25')]);_0x135f3d['attributes']=_[_0x1c38('0x27')](_0xbe1a85[_0x1c38('0x23')],qs[_0x1c38('0x28')](_0x1e0fd2[_0x1c38('0x25')][_0x1c38('0x28')]));_0x135f3d[_0x1c38('0x29')]=_0x135f3d[_0x1c38('0x29')][_0x1c38('0x2a')]?_0x135f3d[_0x1c38('0x29')]:_0xbe1a85[_0x1c38('0x23')];if(!_0x1e0fd2['query']['hasOwnProperty'](_0x1c38('0x2b'))){_0x135f3d['limit']=qs[_0x1c38('0x14')](_0x1e0fd2[_0x1c38('0x25')][_0x1c38('0x14')]);_0x135f3d[_0x1c38('0x2c')]=qs[_0x1c38('0x2c')](_0x1e0fd2[_0x1c38('0x25')][_0x1c38('0x2c')]);}_0x135f3d[_0x1c38('0x2d')]=qs[_0x1c38('0x2e')](_0x1e0fd2['query'][_0x1c38('0x2e')]);_0x135f3d['where']=qs[_0x1c38('0x2f')](_[_0x1c38('0x30')](_0x1e0fd2[_0x1c38('0x25')],_0xbe1a85['filters']));if(_0x13ca36[_0x1c38('0x26')]){if(_0x13ca36[_0x1c38('0x31')]){_0x13ca36['dateEnd']=moment(_0x13ca36[_0x1c38('0x31')])['add'](0x1,_0x1c38('0x32'));}else{_0x13ca36[_0x1c38('0x31')]=moment(_0x13ca36['dateStart'])['add'](0x1,'day');}_['merge'](_0x135f3d[_0x1c38('0x33')],{'createdAt':{'$gte':_0x13ca36['dateStart'],'$lte':_0x13ca36['dateEnd']}});}if(_0x1e0fd2[_0x1c38('0x25')][_0x1c38('0x34')]){_0x135f3d['where']=_['merge'](_0x135f3d['where'],{'$or':_[_0x1c38('0x35')](_0x135f3d[_0x1c38('0x29')],function(_0x2b0489){var _0x22612b={};_0x22612b[_0x2b0489]={'$like':'%'+_0x1e0fd2[_0x1c38('0x25')][_0x1c38('0x34')]+'%'};return _0x22612b;})});}_0x135f3d=_[_0x1c38('0x36')]({},_0x135f3d,_0x1e0fd2[_0x1c38('0x37')]);var _0x3c5d76={'where':_0x135f3d[_0x1c38('0x33')]};return db[_0x1c38('0x21')][_0x1c38('0x13')](_0x3c5d76)[_0x1c38('0x1b')](function(_0x40c171){_0x52fa34[_0x1c38('0x13')]=_0x40c171;if(_0x1e0fd2['query'][_0x1c38('0x38')]){_0x135f3d[_0x1c38('0x39')]=[{'all':!![]}];}return db[_0x1c38('0x21')][_0x1c38('0x3a')](_0x135f3d);})[_0x1c38('0x1b')](function(_0x3aaec2){_0x52fa34[_0x1c38('0x3b')]=_0x3aaec2;return _0x52fa34;})[_0x1c38('0x1b')](respondWithFilteredResult(_0x1f3d07,_0x135f3d))[_0x1c38('0x3c')](handleError(_0x1f3d07,null));};exports[_0x1c38('0x3d')]=function(_0x25876f,_0x8e2c30){var _0x1d8efc={'raw':!![],'where':{'id':_0x25876f[_0x1c38('0x3e')]['id']}},_0x44c0af={};_0x44c0af[_0x1c38('0x23')]=_[_0x1c38('0x24')](db[_0x1c38('0x21')]['rawAttributes']);_0x44c0af['query']=_[_0x1c38('0x24')](_0x25876f[_0x1c38('0x25')]);_0x44c0af[_0x1c38('0x2f')]=_[_0x1c38('0x27')](_0x44c0af['model'],_0x44c0af['query']);_0x1d8efc[_0x1c38('0x29')]=_[_0x1c38('0x27')](_0x44c0af[_0x1c38('0x23')],qs[_0x1c38('0x28')](_0x25876f[_0x1c38('0x25')][_0x1c38('0x28')]));_0x1d8efc[_0x1c38('0x29')]=_0x1d8efc['attributes'][_0x1c38('0x2a')]?_0x1d8efc[_0x1c38('0x29')]:_0x44c0af['model'];if(_0x25876f[_0x1c38('0x25')][_0x1c38('0x38')]){_0x1d8efc['include']=[{'all':!![]}];}_0x1d8efc=_[_0x1c38('0x36')]({},_0x1d8efc,_0x25876f[_0x1c38('0x37')]);return db[_0x1c38('0x21')][_0x1c38('0x3f')](_0x1d8efc)[_0x1c38('0x1b')](handleEntityNotFound(_0x8e2c30,null))[_0x1c38('0x1b')](respondWithResult(_0x8e2c30,null))['catch'](handleError(_0x8e2c30,null));};exports['describe']=function(_0x43bd80,_0x95ea0){return db[_0x1c38('0x21')][_0x1c38('0x40')]()[_0x1c38('0x1b')](respondWithResult(_0x95ea0,null))[_0x1c38('0x3c')](handleError(_0x95ea0,null));};exports[_0x1c38('0x1a')]=function(_0x53b733,_0x459f96){if(_0x53b733['body'][_0x1c38('0x41')]){delete _0x53b733[_0x1c38('0x42')][_0x1c38('0x41')];}return db[_0x1c38('0x21')][_0x1c38('0x3f')]({'where':{'uniqueid':_0x53b733['params']['id']}})['then'](handleEntityNotFound(_0x459f96,null))[_0x1c38('0x1b')](saveUpdates(_0x53b733['body'],null))['then'](respondWithResult(_0x459f96,null))['catch'](handleError(_0x459f96,null));};exports[_0x1c38('0x43')]=function(_0x542b22,_0x5cd8cb,_0x3a033d){return db[_0x1c38('0x21')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x542b22[_0x1c38('0x3e')]['id']},'attributes':[[db[_0x1c38('0x44')]['fn']('COUNT',db[_0x1c38('0x44')]['fn']('IF',db['sequelize'][_0x1c38('0x45')](_0x1c38('0x46')))),_0x1c38('0x47')],[db[_0x1c38('0x44')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1c38('0x44')][_0x1c38('0x45')]('`state`\x20=\x203,\x201,\x20null'))),_0x1c38('0x48')],[db[_0x1c38('0x44')]['fn'](_0x1c38('0x49'),db[_0x1c38('0x44')]['fn']('IF',db[_0x1c38('0x44')][_0x1c38('0x45')](_0x1c38('0x4a')))),_0x1c38('0x4b')],[db[_0x1c38('0x44')]['fn']('COUNT',db[_0x1c38('0x44')]['fn']('IF',db[_0x1c38('0x44')]['literal'](_0x1c38('0x4c')))),'congestionContacts'],[db[_0x1c38('0x44')]['fn']('COUNT',db[_0x1c38('0x44')]['fn']('IF',db[_0x1c38('0x44')][_0x1c38('0x45')](_0x1c38('0x4d')))),'dropContacts'],[db[_0x1c38('0x44')]['fn']('COUNT',db[_0x1c38('0x44')]['fn']('IF',db[_0x1c38('0x44')][_0x1c38('0x45')](_0x1c38('0x4e')))),_0x1c38('0x4f')],[db[_0x1c38('0x44')]['fn'](_0x1c38('0x49'),db[_0x1c38('0x44')]['fn']('IF',db[_0x1c38('0x44')][_0x1c38('0x45')](_0x1c38('0x50')))),_0x1c38('0x51')]]})[_0x1c38('0x1b')](handleEntityNotFound(_0x5cd8cb,null))['then'](respondWithResult(_0x5cd8cb,null))['catch'](handleError(_0x5cd8cb,null));};exports[_0x1c38('0x52')]=function(_0x188aba,_0x42d019,_0x2f0e24){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x188aba[_0x1c38('0x3e')]['id']},'attributes':[[db[_0x1c38('0x44')]['fn'](_0x1c38('0x49'),db[_0x1c38('0x44')]['fn']('IF',db['sequelize'][_0x1c38('0x45')](_0x1c38('0x46')))),'noSuchContacts'],[db[_0x1c38('0x44')]['fn'](_0x1c38('0x49'),db[_0x1c38('0x44')]['fn']('IF',db[_0x1c38('0x44')][_0x1c38('0x45')](_0x1c38('0x53')))),_0x1c38('0x48')],[db[_0x1c38('0x44')]['fn'](_0x1c38('0x49'),db[_0x1c38('0x44')]['fn']('IF',db[_0x1c38('0x44')][_0x1c38('0x45')](_0x1c38('0x4a')))),_0x1c38('0x4b')],[db[_0x1c38('0x44')]['fn'](_0x1c38('0x49'),db[_0x1c38('0x44')]['fn']('IF',db[_0x1c38('0x44')]['literal'](_0x1c38('0x4c')))),_0x1c38('0x54')],[db[_0x1c38('0x44')]['fn'](_0x1c38('0x49'),db[_0x1c38('0x44')]['fn']('IF',db[_0x1c38('0x44')]['literal'](_0x1c38('0x4d')))),_0x1c38('0x55')],[db[_0x1c38('0x44')]['fn'](_0x1c38('0x49'),db[_0x1c38('0x44')]['fn']('IF',db[_0x1c38('0x44')][_0x1c38('0x45')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x1c38('0x4f')],[db['sequelize']['fn'](_0x1c38('0x49'),db[_0x1c38('0x44')]['fn']('IF',db[_0x1c38('0x44')][_0x1c38('0x45')]('`state`\x20=\x2022,\x201,\x20null'))),_0x1c38('0x51')]]})[_0x1c38('0x1b')](handleEntityNotFound(_0x42d019,null))[_0x1c38('0x1b')](respondWithResult(_0x42d019,null))['catch'](handleError(_0x42d019,null));};exports[_0x1c38('0x56')]=function(_0x1831b9,_0x24470a,_0x4488b6){return db[_0x1c38('0x57')][_0x1c38('0x3f')]({'where':{'id':_0x1831b9[_0x1c38('0x3e')]['id']}})[_0x1c38('0x1b')](handleEntityNotFound(_0x24470a,null))[_0x1c38('0x1b')](function(_0x3e8526){var _0x52c379;if(_0x3e8526){_0x52c379=squel[_0x1c38('0x58')]()[_0x1c38('0x59')](_0x1c38('0x5a'))['fromQuery'](['phone',_0x1c38('0x5b'),_0x1c38('0x5c'),_0x1c38('0x5d'),_0x1c38('0x5e'),_0x1c38('0x5f'),_0x1c38('0x60')],squel['select']()[_0x1c38('0x61')](_0x1c38('0x62'),_0x1c38('0x63'))['field'](_0x1c38('0x64'),_0x1c38('0x5b'))[_0x1c38('0x61')](_0x1c38('0x65'),_0x1c38('0x5c'))['field']('ANY_VALUE(ListId)','ListId')[_0x1c38('0x61')](_0x1c38('0x66'),'VoiceQueueId')['field']('NOW()',_0x1c38('0x5f'))[_0x1c38('0x61')]('NOW()',_0x1c38('0x60'))[_0x1c38('0x67')](_0x1c38('0x68'))[_0x1c38('0x33')](_0x1c38('0x69'),_0x1831b9[_0x1c38('0x3e')]['id'][_0x1c38('0x6a')]())[_0x1c38('0x33')](_0x1c38('0x6b'),_0x1831b9[_0x1c38('0x42')][_0x1c38('0x6c')][_0x1c38('0x6a')]())[_0x1c38('0x33')](_0x1c38('0x6d'))[_0x1c38('0x33')](_0x1c38('0x6e'),squel[_0x1c38('0x6f')]()[_0x1c38('0x61')]('phone')[_0x1c38('0x67')](_0x1c38('0x5a'))['where'](_0x1c38('0x69'),_0x1831b9[_0x1c38('0x3e')]['id']['toString']()))[_0x1c38('0x33')](_0x1c38('0x6e'),squel[_0x1c38('0x6f')]()[_0x1c38('0x61')](_0x1c38('0x70'))[_0x1c38('0x67')]('cm_hopper_final')[_0x1c38('0x33')](_0x1c38('0x69'),_0x1831b9[_0x1c38('0x3e')]['id'][_0x1c38('0x6a')]())[_0x1c38('0x33')](_0x1c38('0x71')))['group'](_0x1c38('0x5c')))[_0x1c38('0x6a')]();return db['sequelize'][_0x1c38('0x25')](_0x52c379);}return[];})[_0x1c38('0x1b')](respondWithResult(_0x24470a,null))[_0x1c38('0x3c')](handleError(_0x24470a,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1108a3,_0x124439,_0x54b348){return db[_0x1c38('0x72')][_0x1c38('0x3f')]({'where':{'id':_0x1108a3[_0x1c38('0x3e')]['id']}})[_0x1c38('0x1b')](handleEntityNotFound(_0x124439,null))[_0x1c38('0x1b')](function(_0x592c22){var _0x5e8281;if(_0x592c22){_0x5e8281=squel[_0x1c38('0x58')]()[_0x1c38('0x59')](_0x1c38('0x5a'))[_0x1c38('0x73')]([_0x1c38('0x63'),_0x1c38('0x5b'),_0x1c38('0x5c'),_0x1c38('0x5d'),_0x1c38('0x74'),_0x1c38('0x5f'),_0x1c38('0x60')],squel['select']()[_0x1c38('0x61')](_0x1c38('0x62'),'phone')[_0x1c38('0x61')]('NOW()',_0x1c38('0x5b'))[_0x1c38('0x61')](_0x1c38('0x65'),'ContactId')['field'](_0x1c38('0x75'),_0x1c38('0x5d'))['field'](_0x1c38('0x76'),'CampaignId')[_0x1c38('0x61')](_0x1c38('0x64'),'createdAt')[_0x1c38('0x61')]('NOW()',_0x1c38('0x60'))[_0x1c38('0x67')]('cm_hopper_final')[_0x1c38('0x33')](_0x1c38('0x77'),_0x1108a3['params']['id']['toString']())[_0x1c38('0x33')](_0x1c38('0x6b'),_0x1108a3[_0x1c38('0x42')][_0x1c38('0x6c')][_0x1c38('0x6a')]())[_0x1c38('0x33')](_0x1c38('0x6d'))[_0x1c38('0x33')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field']('phone')[_0x1c38('0x67')]('cm_hopper')[_0x1c38('0x33')](_0x1c38('0x77'),_0x1108a3[_0x1c38('0x3e')]['id']['toString']()))[_0x1c38('0x33')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x1c38('0x61')](_0x1c38('0x70'))[_0x1c38('0x67')](_0x1c38('0x68'))[_0x1c38('0x33')]('CampaignId\x20=\x20?',_0x1108a3[_0x1c38('0x3e')]['id'][_0x1c38('0x6a')]())['where'](_0x1c38('0x71')))[_0x1c38('0x78')]('ContactId'))['toString']();return db['sequelize']['query'](_0x5e8281);}return[];})[_0x1c38('0x1b')](respondWithResult(_0x124439,null))[_0x1c38('0x3c')](handleError(_0x124439,null));};exports[_0x1c38('0x79')]=function(_0x528046,_0xf3de9e,_0x50dd86){return db[_0x1c38('0x7a')][_0x1c38('0x7b')]({'where':{'VoiceQueueId':_0x528046[_0x1c38('0x42')][_0x1c38('0x5e')],'CampaignId':_0x528046[_0x1c38('0x42')]['CampaignId'],'ContactId':_0x528046[_0x1c38('0x42')][_0x1c38('0x5c')]}})['then'](handleEntityNotFound(_0xf3de9e,null))['then'](function(_0x76c2a8){if(_0x76c2a8){return _0x76c2a8;}return null;})[_0x1c38('0x1b')](respondWithResult(_0xf3de9e,null))[_0x1c38('0x3c')](handleError(_0xf3de9e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 41a032f..a5e298c 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 _0x7a54=['../../config/logger','moment','bluebird','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0x172948,_0x4262cc){var _0x4aeaa9=function(_0x5ec4b3){while(--_0x5ec4b3){_0x172948['push'](_0x172948['shift']());}};_0x4aeaa9(++_0x4262cc);}(_0x7a54,0x106));var _0x47a5=function(_0x232f7b,_0x586835){_0x232f7b=_0x232f7b-0x0;var _0x44ca38=_0x7a54[_0x232f7b];return _0x44ca38;};'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')]('CmHopperFinal',attributes,{'tableName':_0x47a5('0x8'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x47a5('0x9')]},{'name':_0x47a5('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x57ca=['util','../../config/logger','moment','bluebird','request-promise','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x57ca,0x108));var _0xa57c=function(_0x3439bb,_0x247007){_0x3439bb=_0x3439bb-0x0;var _0x2bb264=_0x57ca[_0x3439bb];return _0x2bb264;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var logger=require(_0xa57c('0x1'))('api');var moment=require(_0xa57c('0x2'));var BPromise=require(_0xa57c('0x3'));var rp=require(_0xa57c('0x4'));var attributes=require(_0xa57c('0x5'));module[_0xa57c('0x6')]=function(_0x48be2d,_0x40ba22){return _0x48be2d[_0xa57c('0x7')](_0xa57c('0x8'),attributes,{'tableName':_0xa57c('0x9'),'paranoid':![],'indexes':[{'name':_0xa57c('0xa'),'fields':[_0xa57c('0xa')]},{'name':_0xa57c('0xb'),'fields':[_0xa57c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 1a36aec..db64fe6 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 _0x55da=['CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xf2f8d2,_0x3162c6){var _0x45ce4f=function(_0x31a13a){while(--_0x31a13a){_0xf2f8d2['push'](_0xf2f8d2['shift']());}};_0x45ce4f(++_0x3162c6);}(_0x55da,0xa6));var _0xa55d=function(_0x24c4bd,_0x2a5676){_0x24c4bd=_0x24c4bd-0x0;var _0x3ca5f0=_0x55da[_0x24c4bd];return _0x3ca5f0;};'use strict';var _=require('lodash');var util=require(_0xa55d('0x0'));var moment=require('moment');var BPromise=require(_0xa55d('0x1'));var rs=require(_0xa55d('0x2'));var fs=require('fs');var db=require(_0xa55d('0x3'))['db'];var utils=require(_0xa55d('0x4'));var logger=require(_0xa55d('0x5'))(_0xa55d('0x6'));var config=require(_0xa55d('0x7'));var jayson=require(_0xa55d('0x8'));var client=jayson[_0xa55d('0x9')][_0xa55d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bd89e,_0x3f19b5,_0x4da2fa){return new BPromise(function(_0x5eafb2,_0x1b7110){return client[_0xa55d('0xb')](_0x1bd89e,_0x4da2fa)[_0xa55d('0xc')](function(_0xc70267){logger[_0xa55d('0xd')](_0xa55d('0xe'),_0x3f19b5,_0xa55d('0xf'));logger[_0xa55d('0x10')](_0xa55d('0x11'),_0x3f19b5,_0xa55d('0xf'),JSON[_0xa55d('0x12')](_0xc70267));if(_0xc70267[_0xa55d('0x13')]){if(_0xc70267[_0xa55d('0x13')][_0xa55d('0x14')]===0x1f4){logger[_0xa55d('0x13')](_0xa55d('0xe'),_0x3f19b5,_0xc70267[_0xa55d('0x13')][_0xa55d('0x15')]);return _0x1b7110(_0xc70267[_0xa55d('0x13')][_0xa55d('0x15')]);}logger[_0xa55d('0x13')](_0xa55d('0xe'),_0x3f19b5,_0xc70267['error'][_0xa55d('0x15')]);return _0x5eafb2(_0xc70267[_0xa55d('0x13')]['message']);}else{logger[_0xa55d('0xd')](_0xa55d('0xe'),_0x3f19b5,_0xa55d('0xf'));_0x5eafb2(_0xc70267[_0xa55d('0x16')][_0xa55d('0x15')]);}})[_0xa55d('0x17')](function(_0x412b8b){logger['error'](_0xa55d('0xe'),_0x3f19b5,_0x412b8b);_0x1b7110(_0x412b8b);});});}exports[_0xa55d('0x18')]=function(_0x10a568){var _0x151bff=this;return new Promise(function(_0x267026,_0x3db7f0){return db[_0xa55d('0x19')][_0xa55d('0x1a')](_0x10a568[_0xa55d('0x1b')],{'raw':_0x10a568[_0xa55d('0x1c')]?_0x10a568[_0xa55d('0x1c')][_0xa55d('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x2e3455){logger['info']('CreateCmHopperFinal',_0x10a568);logger[_0xa55d('0x10')](_0xa55d('0x18'),_0x10a568,JSON[_0xa55d('0x12')](_0x2e3455));_0x267026(_0x2e3455);})['catch'](function(_0x1dfc73){logger[_0xa55d('0x13')]('CreateCmHopperFinal',_0x1dfc73['message'],_0x10a568);_0x3db7f0(_0x151bff[_0xa55d('0x13')](0x1f4,_0x1dfc73[_0xa55d('0x15')]));});});}; \ No newline at end of file +var _0xbd17=['moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','CmHopperFinal,\x20%s,\x20%s','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','CreateCmHopperFinal','CmHopperFinal','create','options','raw','catch','lodash','util'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0xbd17,0x11e));var _0x7bd1=function(_0x5becd6,_0x13e651){_0x5becd6=_0x5becd6-0x0;var _0x3b7b78=_0xbd17[_0x5becd6];return _0x3b7b78;};'use strict';var _=require(_0x7bd1('0x0'));var util=require(_0x7bd1('0x1'));var moment=require(_0x7bd1('0x2'));var BPromise=require(_0x7bd1('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x7bd1('0x4'));var logger=require('../../config/logger')(_0x7bd1('0x5'));var config=require(_0x7bd1('0x6'));var jayson=require(_0x7bd1('0x7'));var client=jayson[_0x7bd1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3606fe,_0x3611cb,_0x1743e9){return new BPromise(function(_0x2d6c84,_0x48b27f){return client['request'](_0x3606fe,_0x1743e9)[_0x7bd1('0x9')](function(_0x1ec07f){logger[_0x7bd1('0xa')](_0x7bd1('0xb'),_0x3611cb,'request\x20sent');logger[_0x7bd1('0xc')](_0x7bd1('0xd'),_0x3611cb,_0x7bd1('0xe'),JSON[_0x7bd1('0xf')](_0x1ec07f));if(_0x1ec07f[_0x7bd1('0x10')]){if(_0x1ec07f['error']['code']===0x1f4){logger['error'](_0x7bd1('0xb'),_0x3611cb,_0x1ec07f[_0x7bd1('0x10')][_0x7bd1('0x11')]);return _0x48b27f(_0x1ec07f['error'][_0x7bd1('0x11')]);}logger[_0x7bd1('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0x3611cb,_0x1ec07f[_0x7bd1('0x10')][_0x7bd1('0x11')]);return _0x2d6c84(_0x1ec07f[_0x7bd1('0x10')][_0x7bd1('0x11')]);}else{logger[_0x7bd1('0xa')](_0x7bd1('0xb'),_0x3611cb,_0x7bd1('0xe'));_0x2d6c84(_0x1ec07f['result']['message']);}})['catch'](function(_0x4c9f18){logger[_0x7bd1('0x10')](_0x7bd1('0xb'),_0x3611cb,_0x4c9f18);_0x48b27f(_0x4c9f18);});});}exports[_0x7bd1('0x12')]=function(_0x42d609){var _0x756e22=this;return new Promise(function(_0x342188,_0x2555be){return db[_0x7bd1('0x13')][_0x7bd1('0x14')](_0x42d609['body'],{'raw':_0x42d609[_0x7bd1('0x15')]?_0x42d609[_0x7bd1('0x15')][_0x7bd1('0x16')]===undefined?!![]:![]:!![]})[_0x7bd1('0x9')](function(_0x827b01){logger[_0x7bd1('0xa')](_0x7bd1('0x12'),_0x42d609);logger[_0x7bd1('0xc')](_0x7bd1('0x12'),_0x42d609,JSON['stringify'](_0x827b01));_0x342188(_0x827b01);})[_0x7bd1('0x17')](function(_0x47d252){logger[_0x7bd1('0x10')]('CreateCmHopperFinal',_0x47d252[_0x7bd1('0x11')],_0x42d609);_0x2555be(_0x756e22['error'](0x1f4,_0x47d252[_0x7bd1('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 3ffefea..1e66e43 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 _0x7118=['countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal'];(function(_0x9d0cde,_0x163fc8){var _0x2812cb=function(_0x4e7016){while(--_0x4e7016){_0x9d0cde['push'](_0x9d0cde['shift']());}};_0x2812cb(++_0x163fc8);}(_0x7118,0x159));var _0x8711=function(_0x3797b4,_0x58ab4c){_0x3797b4=_0x3797b4-0x0;var _0x23284e=_0x7118[_0x3797b4];return _0x23284e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8711('0x0'));var express=require(_0x8711('0x1'));var router=express['Router']();var auth=require(_0x8711('0x2'));var interaction=require(_0x8711('0x3'));var config=require(_0x8711('0x4'));var controller=require(_0x8711('0x5'));router[_0x8711('0x6')]('/',auth[_0x8711('0x7')](),controller[_0x8711('0x8')]);router['get'](_0x8711('0x9'),auth[_0x8711('0x7')](),controller[_0x8711('0xa')]);router[_0x8711('0x6')](_0x8711('0xb'),auth[_0x8711('0x7')](),controller[_0x8711('0xc')]);router[_0x8711('0x6')](_0x8711('0xd'),auth[_0x8711('0x7')](),controller[_0x8711('0xe')]);router['get']('/campaign/countAttributes/:id',auth[_0x8711('0x7')](),controller[_0x8711('0xf')]);router[_0x8711('0x10')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0x8711('0x11')]);router[_0x8711('0x10')]('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller[_0x8711('0x12')]);router[_0x8711('0x10')](_0x8711('0x13'),auth[_0x8711('0x7')](),controller[_0x8711('0x14')]);router[_0x8711('0x15')](_0x8711('0xb'),auth['isAuthenticated'](),controller[_0x8711('0x16')]);module[_0x8711('0x17')]=router; \ No newline at end of file +var _0x7a2d=['express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path'];(function(_0xb746a4,_0x355bdc){var _0x4b6a58=function(_0x3ebf70){while(--_0x3ebf70){_0xb746a4['push'](_0xb746a4['shift']());}};_0x4b6a58(++_0x355bdc);}(_0x7a2d,0x142));var _0xd7a2=function(_0x45748,_0x53c1ca){_0x45748=_0x45748-0x0;var _0x4419cb=_0x7a2d[_0x45748];return _0x4419cb;};'use strict';var multer=require(_0xd7a2('0x0'));var util=require(_0xd7a2('0x1'));var path=require(_0xd7a2('0x2'));var express=require(_0xd7a2('0x3'));var router=express[_0xd7a2('0x4')]();var auth=require(_0xd7a2('0x5'));var interaction=require(_0xd7a2('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0xd7a2('0x7')]('/',auth[_0xd7a2('0x8')](),controller[_0xd7a2('0x9')]);router[_0xd7a2('0x7')]('/describe',auth[_0xd7a2('0x8')](),controller[_0xd7a2('0xa')]);router[_0xd7a2('0x7')](_0xd7a2('0xb'),auth[_0xd7a2('0x8')](),controller[_0xd7a2('0xc')]);router[_0xd7a2('0x7')](_0xd7a2('0xd'),auth[_0xd7a2('0x8')](),controller['countContactsQueueCampaignHopperFinal']);router[_0xd7a2('0x7')](_0xd7a2('0xe'),auth[_0xd7a2('0x8')](),controller[_0xd7a2('0xf')]);router[_0xd7a2('0x10')](_0xd7a2('0x11'),auth[_0xd7a2('0x8')](),controller['moveContactsQueueCampaignHopperFinal']);router['post'](_0xd7a2('0x12'),auth['isAuthenticated'](),controller[_0xd7a2('0x13')]);router[_0xd7a2('0x10')](_0xd7a2('0x14'),auth[_0xd7a2('0x8')](),controller[_0xd7a2('0x15')]);router[_0xd7a2('0x16')](_0xd7a2('0xb'),auth[_0xd7a2('0x8')](),controller[_0xd7a2('0x17')]);module[_0xd7a2('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 98621ae..b67e544 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 _0xcd59=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x3f0f6f,_0x32d8b9){var _0xb1511b=function(_0x4e02d9){while(--_0x4e02d9){_0x3f0f6f['push'](_0x3f0f6f['shift']());}};_0xb1511b(++_0x32d8b9);}(_0xcd59,0x14b));var _0x9cd5=function(_0x1b4912,_0x3e8bb9){_0x1b4912=_0x1b4912-0x0;var _0x48cac5=_0xcd59[_0x1b4912];return _0x48cac5;};'use strict';var Sequelize=require(_0x9cd5('0x0'));module[_0x9cd5('0x1')]={'state':{'type':Sequelize[_0x9cd5('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x9cd5('0x3')]},'scheduledat':{'type':Sequelize[_0x9cd5('0x4')]},'countbusyretry':{'type':Sequelize[_0x9cd5('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9cd5('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x9cd5('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x9cd5('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x9cd5('0x3')]},'originatecalleridname':{'type':Sequelize[_0x9cd5('0x3')]},'calleridnum':{'type':Sequelize[_0x9cd5('0x3')]},'calleridname':{'type':Sequelize[_0x9cd5('0x3')]},'starttime':{'type':Sequelize[_0x9cd5('0x4')]},'responsetime':{'type':Sequelize[_0x9cd5('0x4')]},'answertime':{'type':Sequelize[_0x9cd5('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x9cd5('0x4')]},'ringtime':{'type':Sequelize[_0x9cd5('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x9cd5('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x9cd5('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x9cd5('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9cd5('0x3')]},'campaign':{'type':Sequelize[_0x9cd5('0x3')]},'campaigntype':{'type':Sequelize[_0x9cd5('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x9cd5('0x3')]},'amd':{'type':Sequelize[_0x9cd5('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x9cd5('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x9cd5('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x9cd5('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x9cd5('0x4')]},'edited':{'type':Sequelize[_0x9cd5('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x28a2=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x178ff4,_0x377361){var _0x4f63e2=function(_0x55200b){while(--_0x55200b){_0x178ff4['push'](_0x178ff4['shift']());}};_0x4f63e2(++_0x377361);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x228a('0x0'));module[_0x228a('0x1')]={'state':{'type':Sequelize[_0x228a('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x228a('0x3')]},'scheduledat':{'type':Sequelize[_0x228a('0x4')]},'countbusyretry':{'type':Sequelize[_0x228a('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x228a('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x228a('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x228a('0x3')]},'originatecalleridname':{'type':Sequelize[_0x228a('0x3')]},'calleridnum':{'type':Sequelize[_0x228a('0x3')]},'calleridname':{'type':Sequelize[_0x228a('0x3')]},'starttime':{'type':Sequelize[_0x228a('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x228a('0x4')]},'droptime':{'type':Sequelize[_0x228a('0x4')]},'endtime':{'type':Sequelize[_0x228a('0x4')]},'ringtime':{'type':Sequelize[_0x228a('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x228a('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x228a('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x228a('0x3')]},'campaign':{'type':Sequelize[_0x228a('0x3')]},'campaigntype':{'type':Sequelize[_0x228a('0x3')]},'membername':{'type':Sequelize[_0x228a('0x3')]},'reason':{'type':Sequelize[_0x228a('0x3')]},'amd':{'type':Sequelize[_0x228a('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x228a('0x4')]},'recallme':{'type':Sequelize[_0x228a('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x228a('0x4')]},'edited':{'type':Sequelize[_0x228a('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 049ad8a..2e2c033 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 _0x3e8e=['length','hasOwnProperty','nolimit','order','sort','where','filters','day','add','merge','map','options','includeAll','include','findAll','rows','show','params','rawAttributes','intersection','find','create','body','describe','catch','uniqueid','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','../../config/environment','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','CmHopperHistory','model','keys','dateStart','query','dateEnd','attributes','fields'];(function(_0x4a78a8,_0x2f6cfd){var _0x22959d=function(_0x4127e5){while(--_0x4127e5){_0x4a78a8['push'](_0x4a78a8['shift']());}};_0x22959d(++_0x2f6cfd);}(_0x3e8e,0x1b8));var _0xe3e8=function(_0x1d63e2,_0x35f417){_0x1d63e2=_0x1d63e2-0x0;var _0x3b9709=_0x3e8e[_0x1d63e2];return _0x3b9709;};'use strict';var jsonpatch=require(_0xe3e8('0x0'));var rp=require(_0xe3e8('0x1'));var moment=require(_0xe3e8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe3e8('0x3'));var util=require(_0xe3e8('0x4'));var path=require(_0xe3e8('0x5'));var sox=require(_0xe3e8('0x6'));var csv=require(_0xe3e8('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe3e8('0x8'));var squel=require(_0xe3e8('0x9'));var crypto=require(_0xe3e8('0xa'));var jsforce=require(_0xe3e8('0xb'));var deskjs=require(_0xe3e8('0xc'));var toCsv=require(_0xe3e8('0x7'));var querystring=require(_0xe3e8('0xd'));var Papa=require('papaparse');var qs=require(_0xe3e8('0xe'));var logger=require(_0xe3e8('0xf'))('api');var utils=require('../../config/utils');var config=require(_0xe3e8('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x160e11,_0xe9891e){_0xe9891e=_0xe9891e||0xcc;return function(_0x1824c3){if(_0x1824c3){return _0x160e11['sendStatus'](_0xe9891e);}return _0x160e11[_0xe3e8('0x11')](_0xe9891e)[_0xe3e8('0x12')]();};}function respondWithResult(_0x126091,_0x515512){_0x515512=_0x515512||0xc8;return function(_0x34092d){if(_0x34092d){return _0x126091[_0xe3e8('0x11')](_0x515512)['json'](_0x34092d);}};}function respondWithFilteredResult(_0x3e3b42,_0x826313){return function(_0x27f743){if(_0x27f743){var _0x3fe5fa=_0x27f743[_0xe3e8('0x13')],_0x428592=_0x826313[_0xe3e8('0x14')],_0x41a4b5=_0x826313[_0xe3e8('0x14')]+_0x826313[_0xe3e8('0x15')],_0xb76966;if(_0x41a4b5>=_0x3fe5fa){_0x41a4b5=_0x3fe5fa;_0xb76966=0xc8;}else{_0xb76966=0xce;}_0x3e3b42[_0xe3e8('0x11')](_0xb76966);return _0x3e3b42[_0xe3e8('0x16')](_0xe3e8('0x17'),_0x428592+'-'+_0x41a4b5+'/'+_0x3fe5fa)[_0xe3e8('0x18')](_0x27f743);}return null;};}function patchUpdates(_0x5d3955){return function(_0x50168a){try{jsonpatch[_0xe3e8('0x19')](_0x50168a,_0x5d3955,!![]);}catch(_0x1a401b){return BPromise[_0xe3e8('0x1a')](_0x1a401b);}return _0x50168a['save']();};}function saveUpdates(_0xe8a199,_0x46467c){return function(_0xf171a1){if(_0xf171a1){return _0xf171a1[_0xe3e8('0x1b')](_0xe8a199)[_0xe3e8('0x1c')](function(_0x3cb872){return _0x3cb872;});}return null;};}function removeEntity(_0x1d06d9,_0x1e4495){return function(_0x31efd3){if(_0x31efd3){return _0x31efd3[_0xe3e8('0x1d')]()[_0xe3e8('0x1c')](function(){_0x1d06d9[_0xe3e8('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb0f28f,_0x293961){return function(_0x513d65){if(!_0x513d65){_0xb0f28f[_0xe3e8('0x1e')](0x194);}return _0x513d65;};}function handleError(_0x101eed,_0xd302fe){_0xd302fe=_0xd302fe||0x1f4;return function(_0x369054){logger[_0xe3e8('0x1f')](_0x369054[_0xe3e8('0x20')]);if(_0x369054[_0xe3e8('0x21')]){delete _0x369054[_0xe3e8('0x21')];}_0x101eed[_0xe3e8('0x11')](_0xd302fe)[_0xe3e8('0x22')](_0x369054);};}exports['index']=function(_0x5cb16d,_0x77fb19){var _0x3e1b60={},_0x1d68f3={},_0x5691d6={'count':0x0,'rows':[]};var _0x35546d=db[_0xe3e8('0x23')]['rawAttributes'];_0x1d68f3[_0xe3e8('0x24')]=_[_0xe3e8('0x25')](_0x35546d);var _0x3802e1={'dateStart':_0x5cb16d['query'][_0xe3e8('0x26')],'dateEnd':_0x5cb16d[_0xe3e8('0x27')]['dateEnd']};delete _0x5cb16d['query'][_0xe3e8('0x26')];delete _0x5cb16d[_0xe3e8('0x27')][_0xe3e8('0x28')];_0x1d68f3[_0xe3e8('0x27')]=_[_0xe3e8('0x25')](_0x5cb16d[_0xe3e8('0x27')]);_0x1d68f3['filters']=_['intersection'](_0x1d68f3['model'],_0x1d68f3[_0xe3e8('0x27')]);_0x3e1b60[_0xe3e8('0x29')]=_['intersection'](_0x1d68f3[_0xe3e8('0x24')],qs['fields'](_0x5cb16d[_0xe3e8('0x27')][_0xe3e8('0x2a')]));_0x3e1b60[_0xe3e8('0x29')]=_0x3e1b60[_0xe3e8('0x29')][_0xe3e8('0x2b')]?_0x3e1b60['attributes']:_0x1d68f3[_0xe3e8('0x24')];if(!_0x5cb16d[_0xe3e8('0x27')][_0xe3e8('0x2c')](_0xe3e8('0x2d'))){_0x3e1b60['limit']=qs['limit'](_0x5cb16d[_0xe3e8('0x27')]['limit']);_0x3e1b60['offset']=qs['offset'](_0x5cb16d[_0xe3e8('0x27')]['offset']);}_0x3e1b60[_0xe3e8('0x2e')]=qs[_0xe3e8('0x2f')](_0x5cb16d[_0xe3e8('0x27')][_0xe3e8('0x2f')]);_0x3e1b60[_0xe3e8('0x30')]=qs[_0xe3e8('0x31')](_['pick'](_0x5cb16d[_0xe3e8('0x27')],_0x1d68f3[_0xe3e8('0x31')]));if(_0x3802e1[_0xe3e8('0x26')]){if(_0x3802e1[_0xe3e8('0x28')]){_0x3802e1[_0xe3e8('0x28')]=moment(_0x3802e1[_0xe3e8('0x28')])['add'](0x1,_0xe3e8('0x32'));}else{_0x3802e1[_0xe3e8('0x28')]=moment(_0x3802e1[_0xe3e8('0x26')])[_0xe3e8('0x33')](0x1,_0xe3e8('0x32'));}_[_0xe3e8('0x34')](_0x3e1b60[_0xe3e8('0x30')],{'createdAt':{'$gte':_0x3802e1[_0xe3e8('0x26')],'$lte':_0x3802e1['dateEnd']}});}if(_0x5cb16d['query']['filter']){_0x3e1b60['where']=_[_0xe3e8('0x34')](_0x3e1b60[_0xe3e8('0x30')],{'$or':_[_0xe3e8('0x35')](_0x3e1b60['attributes'],function(_0x36d501){var _0x53d7b6={};_0x53d7b6[_0x36d501]={'$like':'%'+_0x5cb16d[_0xe3e8('0x27')]['filter']+'%'};return _0x53d7b6;})});}_0x3e1b60=_[_0xe3e8('0x34')]({},_0x3e1b60,_0x5cb16d[_0xe3e8('0x36')]);var _0x9d0da8={'where':_0x3e1b60[_0xe3e8('0x30')]};return db[_0xe3e8('0x23')][_0xe3e8('0x13')](_0x9d0da8)[_0xe3e8('0x1c')](function(_0x2f254c){_0x5691d6['count']=_0x2f254c;if(_0x5cb16d[_0xe3e8('0x27')][_0xe3e8('0x37')]){_0x3e1b60[_0xe3e8('0x38')]=[{'all':!![]}];}return db[_0xe3e8('0x23')][_0xe3e8('0x39')](_0x3e1b60);})[_0xe3e8('0x1c')](function(_0xfecf26){_0x5691d6[_0xe3e8('0x3a')]=_0xfecf26;return _0x5691d6;})[_0xe3e8('0x1c')](respondWithFilteredResult(_0x77fb19,_0x3e1b60))['catch'](handleError(_0x77fb19,null));};exports[_0xe3e8('0x3b')]=function(_0x3a6a8f,_0x43e065){var _0x5c9a47={'raw':!![],'where':{'id':_0x3a6a8f[_0xe3e8('0x3c')]['id']}},_0x163b63={};_0x163b63[_0xe3e8('0x24')]=_[_0xe3e8('0x25')](db[_0xe3e8('0x23')][_0xe3e8('0x3d')]);_0x163b63['query']=_[_0xe3e8('0x25')](_0x3a6a8f[_0xe3e8('0x27')]);_0x163b63[_0xe3e8('0x31')]=_[_0xe3e8('0x3e')](_0x163b63['model'],_0x163b63[_0xe3e8('0x27')]);_0x5c9a47[_0xe3e8('0x29')]=_[_0xe3e8('0x3e')](_0x163b63[_0xe3e8('0x24')],qs[_0xe3e8('0x2a')](_0x3a6a8f[_0xe3e8('0x27')][_0xe3e8('0x2a')]));_0x5c9a47['attributes']=_0x5c9a47[_0xe3e8('0x29')][_0xe3e8('0x2b')]?_0x5c9a47[_0xe3e8('0x29')]:_0x163b63[_0xe3e8('0x24')];if(_0x3a6a8f[_0xe3e8('0x27')][_0xe3e8('0x37')]){_0x5c9a47[_0xe3e8('0x38')]=[{'all':!![]}];}_0x5c9a47=_[_0xe3e8('0x34')]({},_0x5c9a47,_0x3a6a8f['options']);return db[_0xe3e8('0x23')][_0xe3e8('0x3f')](_0x5c9a47)['then'](handleEntityNotFound(_0x43e065,null))['then'](respondWithResult(_0x43e065,null))['catch'](handleError(_0x43e065,null));};exports['create']=function(_0x16b9eb,_0xf521f5){return db[_0xe3e8('0x23')][_0xe3e8('0x40')](_0x16b9eb[_0xe3e8('0x41')],{})[_0xe3e8('0x1c')](respondWithResult(_0xf521f5,0xc9))['catch'](handleError(_0xf521f5,null));};exports[_0xe3e8('0x42')]=function(_0x12edd1,_0x2f5294){return db[_0xe3e8('0x23')][_0xe3e8('0x42')]()[_0xe3e8('0x1c')](respondWithResult(_0x2f5294,null))[_0xe3e8('0x43')](handleError(_0x2f5294,null));};exports[_0xe3e8('0x1b')]=function(_0x2e340e,_0x58bb85){if(_0x2e340e[_0xe3e8('0x41')][_0xe3e8('0x44')]){delete _0x2e340e[_0xe3e8('0x41')][_0xe3e8('0x44')];}return db[_0xe3e8('0x23')]['find']({'where':{'uniqueid':_0x2e340e['params']['id']}})[_0xe3e8('0x1c')](handleEntityNotFound(_0x58bb85,null))[_0xe3e8('0x1c')](saveUpdates(_0x2e340e[_0xe3e8('0x41')],null))[_0xe3e8('0x1c')](respondWithResult(_0x58bb85,null))['catch'](handleError(_0x58bb85,null));}; \ No newline at end of file +var _0xea69=['day','merge','filter','count','includeAll','include','params','rawAttributes','options','find','catch','create','body','describe','uniqueid','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','CmHopperHistory','model','keys','query','dateEnd','dateStart','filters','intersection','fields','attributes','length','nolimit','offset','order','where','pick'];(function(_0xd82c17,_0x12cb72){var _0x25987a=function(_0x5e2436){while(--_0x5e2436){_0xd82c17['push'](_0xd82c17['shift']());}};_0x25987a(++_0x12cb72);}(_0xea69,0x195));var _0x9ea6=function(_0xc29644,_0x2d70e9){_0xc29644=_0xc29644-0x0;var _0x2a92bd=_0xea69[_0xc29644];return _0x2a92bd;};'use strict';var jsonpatch=require(_0x9ea6('0x0'));var rp=require(_0x9ea6('0x1'));var moment=require('moment');var BPromise=require(_0x9ea6('0x2'));var Mustache=require(_0x9ea6('0x3'));var util=require(_0x9ea6('0x4'));var path=require(_0x9ea6('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9ea6('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9ea6('0x7'));var crypto=require('crypto');var jsforce=require(_0x9ea6('0x8'));var deskjs=require(_0x9ea6('0x9'));var toCsv=require(_0x9ea6('0xa'));var querystring=require(_0x9ea6('0xb'));var Papa=require(_0x9ea6('0xc'));var qs=require(_0x9ea6('0xd'));var logger=require(_0x9ea6('0xe'))(_0x9ea6('0xf'));var utils=require(_0x9ea6('0x10'));var config=require(_0x9ea6('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf87c98,_0x4d80d9){_0x4d80d9=_0x4d80d9||0xcc;return function(_0x2399cb){if(_0x2399cb){return _0xf87c98[_0x9ea6('0x12')](_0x4d80d9);}return _0xf87c98['status'](_0x4d80d9)[_0x9ea6('0x13')]();};}function respondWithResult(_0x27cd9f,_0x2ea750){_0x2ea750=_0x2ea750||0xc8;return function(_0x2b9134){if(_0x2b9134){return _0x27cd9f[_0x9ea6('0x14')](_0x2ea750)[_0x9ea6('0x15')](_0x2b9134);}};}function respondWithFilteredResult(_0x3079cc,_0x30eb39){return function(_0x2c19f0){if(_0x2c19f0){var _0x9c4058=_0x2c19f0['count'],_0x5ca107=_0x30eb39['offset'],_0x374d84=_0x30eb39['offset']+_0x30eb39[_0x9ea6('0x16')],_0x5dabec;if(_0x374d84>=_0x9c4058){_0x374d84=_0x9c4058;_0x5dabec=0xc8;}else{_0x5dabec=0xce;}_0x3079cc[_0x9ea6('0x14')](_0x5dabec);return _0x3079cc[_0x9ea6('0x17')](_0x9ea6('0x18'),_0x5ca107+'-'+_0x374d84+'/'+_0x9c4058)[_0x9ea6('0x15')](_0x2c19f0);}return null;};}function patchUpdates(_0xa86cac){return function(_0x2788b4){try{jsonpatch[_0x9ea6('0x19')](_0x2788b4,_0xa86cac,!![]);}catch(_0x5118cd){return BPromise[_0x9ea6('0x1a')](_0x5118cd);}return _0x2788b4[_0x9ea6('0x1b')]();};}function saveUpdates(_0x3c07cb,_0x27fff2){return function(_0x10dad7){if(_0x10dad7){return _0x10dad7[_0x9ea6('0x1c')](_0x3c07cb)[_0x9ea6('0x1d')](function(_0x44670d){return _0x44670d;});}return null;};}function removeEntity(_0x40a765,_0x305b49){return function(_0x3b4289){if(_0x3b4289){return _0x3b4289[_0x9ea6('0x1e')]()[_0x9ea6('0x1d')](function(){_0x40a765[_0x9ea6('0x14')](0xcc)[_0x9ea6('0x13')]();});}};}function handleEntityNotFound(_0x133343,_0x37c3b1){return function(_0x40d35d){if(!_0x40d35d){_0x133343[_0x9ea6('0x12')](0x194);}return _0x40d35d;};}function handleError(_0x27e4f2,_0x3b911a){_0x3b911a=_0x3b911a||0x1f4;return function(_0x5d24cb){logger[_0x9ea6('0x1f')](_0x5d24cb['stack']);if(_0x5d24cb[_0x9ea6('0x20')]){delete _0x5d24cb[_0x9ea6('0x20')];}_0x27e4f2[_0x9ea6('0x14')](_0x3b911a)['send'](_0x5d24cb);};}exports[_0x9ea6('0x21')]=function(_0x207d36,_0xefb12a){var _0x4a2c1d={},_0x1535a9={},_0x396dd9={'count':0x0,'rows':[]};var _0x3e9c7d=db[_0x9ea6('0x22')]['rawAttributes'];_0x1535a9[_0x9ea6('0x23')]=_[_0x9ea6('0x24')](_0x3e9c7d);var _0x2f3280={'dateStart':_0x207d36[_0x9ea6('0x25')]['dateStart'],'dateEnd':_0x207d36[_0x9ea6('0x25')][_0x9ea6('0x26')]};delete _0x207d36[_0x9ea6('0x25')][_0x9ea6('0x27')];delete _0x207d36[_0x9ea6('0x25')]['dateEnd'];_0x1535a9[_0x9ea6('0x25')]=_[_0x9ea6('0x24')](_0x207d36[_0x9ea6('0x25')]);_0x1535a9[_0x9ea6('0x28')]=_[_0x9ea6('0x29')](_0x1535a9[_0x9ea6('0x23')],_0x1535a9[_0x9ea6('0x25')]);_0x4a2c1d['attributes']=_[_0x9ea6('0x29')](_0x1535a9[_0x9ea6('0x23')],qs[_0x9ea6('0x2a')](_0x207d36[_0x9ea6('0x25')][_0x9ea6('0x2a')]));_0x4a2c1d[_0x9ea6('0x2b')]=_0x4a2c1d[_0x9ea6('0x2b')][_0x9ea6('0x2c')]?_0x4a2c1d['attributes']:_0x1535a9['model'];if(!_0x207d36[_0x9ea6('0x25')]['hasOwnProperty'](_0x9ea6('0x2d'))){_0x4a2c1d[_0x9ea6('0x16')]=qs[_0x9ea6('0x16')](_0x207d36[_0x9ea6('0x25')]['limit']);_0x4a2c1d['offset']=qs[_0x9ea6('0x2e')](_0x207d36[_0x9ea6('0x25')][_0x9ea6('0x2e')]);}_0x4a2c1d[_0x9ea6('0x2f')]=qs['sort'](_0x207d36[_0x9ea6('0x25')]['sort']);_0x4a2c1d[_0x9ea6('0x30')]=qs[_0x9ea6('0x28')](_[_0x9ea6('0x31')](_0x207d36[_0x9ea6('0x25')],_0x1535a9[_0x9ea6('0x28')]));if(_0x2f3280[_0x9ea6('0x27')]){if(_0x2f3280[_0x9ea6('0x26')]){_0x2f3280['dateEnd']=moment(_0x2f3280[_0x9ea6('0x26')])['add'](0x1,_0x9ea6('0x32'));}else{_0x2f3280['dateEnd']=moment(_0x2f3280[_0x9ea6('0x27')])['add'](0x1,'day');}_[_0x9ea6('0x33')](_0x4a2c1d['where'],{'createdAt':{'$gte':_0x2f3280['dateStart'],'$lte':_0x2f3280[_0x9ea6('0x26')]}});}if(_0x207d36[_0x9ea6('0x25')][_0x9ea6('0x34')]){_0x4a2c1d[_0x9ea6('0x30')]=_['merge'](_0x4a2c1d[_0x9ea6('0x30')],{'$or':_['map'](_0x4a2c1d[_0x9ea6('0x2b')],function(_0x2c7270){var _0x108fcd={};_0x108fcd[_0x2c7270]={'$like':'%'+_0x207d36[_0x9ea6('0x25')][_0x9ea6('0x34')]+'%'};return _0x108fcd;})});}_0x4a2c1d=_[_0x9ea6('0x33')]({},_0x4a2c1d,_0x207d36['options']);var _0x7cc22c={'where':_0x4a2c1d[_0x9ea6('0x30')]};return db[_0x9ea6('0x22')]['count'](_0x7cc22c)['then'](function(_0x1a42f2){_0x396dd9[_0x9ea6('0x35')]=_0x1a42f2;if(_0x207d36[_0x9ea6('0x25')][_0x9ea6('0x36')]){_0x4a2c1d[_0x9ea6('0x37')]=[{'all':!![]}];}return db[_0x9ea6('0x22')]['findAll'](_0x4a2c1d);})[_0x9ea6('0x1d')](function(_0x30e24b){_0x396dd9['rows']=_0x30e24b;return _0x396dd9;})[_0x9ea6('0x1d')](respondWithFilteredResult(_0xefb12a,_0x4a2c1d))['catch'](handleError(_0xefb12a,null));};exports['show']=function(_0x438d10,_0x40c0bb){var _0x4a2bf8={'raw':!![],'where':{'id':_0x438d10[_0x9ea6('0x38')]['id']}},_0xca6903={};_0xca6903[_0x9ea6('0x23')]=_[_0x9ea6('0x24')](db[_0x9ea6('0x22')][_0x9ea6('0x39')]);_0xca6903[_0x9ea6('0x25')]=_[_0x9ea6('0x24')](_0x438d10[_0x9ea6('0x25')]);_0xca6903[_0x9ea6('0x28')]=_[_0x9ea6('0x29')](_0xca6903[_0x9ea6('0x23')],_0xca6903[_0x9ea6('0x25')]);_0x4a2bf8['attributes']=_[_0x9ea6('0x29')](_0xca6903['model'],qs[_0x9ea6('0x2a')](_0x438d10[_0x9ea6('0x25')][_0x9ea6('0x2a')]));_0x4a2bf8['attributes']=_0x4a2bf8[_0x9ea6('0x2b')][_0x9ea6('0x2c')]?_0x4a2bf8[_0x9ea6('0x2b')]:_0xca6903['model'];if(_0x438d10['query'][_0x9ea6('0x36')]){_0x4a2bf8[_0x9ea6('0x37')]=[{'all':!![]}];}_0x4a2bf8=_[_0x9ea6('0x33')]({},_0x4a2bf8,_0x438d10[_0x9ea6('0x3a')]);return db['CmHopperHistory'][_0x9ea6('0x3b')](_0x4a2bf8)[_0x9ea6('0x1d')](handleEntityNotFound(_0x40c0bb,null))[_0x9ea6('0x1d')](respondWithResult(_0x40c0bb,null))[_0x9ea6('0x3c')](handleError(_0x40c0bb,null));};exports[_0x9ea6('0x3d')]=function(_0x43a27b,_0x21a0af){return db[_0x9ea6('0x22')][_0x9ea6('0x3d')](_0x43a27b[_0x9ea6('0x3e')],{})[_0x9ea6('0x1d')](respondWithResult(_0x21a0af,0xc9))['catch'](handleError(_0x21a0af,null));};exports[_0x9ea6('0x3f')]=function(_0x33cd6b,_0x5acb0d){return db[_0x9ea6('0x22')][_0x9ea6('0x3f')]()['then'](respondWithResult(_0x5acb0d,null))[_0x9ea6('0x3c')](handleError(_0x5acb0d,null));};exports[_0x9ea6('0x1c')]=function(_0x476a1f,_0x3298ec){if(_0x476a1f[_0x9ea6('0x3e')][_0x9ea6('0x40')]){delete _0x476a1f[_0x9ea6('0x3e')][_0x9ea6('0x40')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x476a1f[_0x9ea6('0x38')]['id']}})['then'](handleEntityNotFound(_0x3298ec,null))[_0x9ea6('0x1d')](saveUpdates(_0x476a1f[_0x9ea6('0x3e')],null))[_0x9ea6('0x1d')](respondWithResult(_0x3298ec,null))[_0x9ea6('0x3c')](handleError(_0x3298ec,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index f38e9f5..f3657ee 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 _0x4b58=['./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','moment','request-promise'];(function(_0x4e1dbd,_0x159091){var _0x2e4a31=function(_0x564417){while(--_0x564417){_0x4e1dbd['push'](_0x4e1dbd['shift']());}};_0x2e4a31(++_0x159091);}(_0x4b58,0x10f));var _0x84b5=function(_0x3a433a,_0x559f3b){_0x3a433a=_0x3a433a-0x0;var _0x417696=_0x4b58[_0x3a433a];return _0x417696;};'use strict';var _=require(_0x84b5('0x0'));var util=require(_0x84b5('0x1'));var logger=require(_0x84b5('0x2'))('api');var moment=require(_0x84b5('0x3'));var BPromise=require('bluebird');var rp=require(_0x84b5('0x4'));var attributes=require(_0x84b5('0x5'));module[_0x84b5('0x6')]=function(_0x2ceb95,_0x5c4016){return _0x2ceb95[_0x84b5('0x7')](_0x84b5('0x8'),attributes,{'tableName':_0x84b5('0x9'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x84b5('0xa')]},{'name':_0x84b5('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa6a7=['request-promise','./cmHopperHistory.attributes','exports','CmHopperHistory','endtime','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x5ac0da,_0x2f0653){var _0x59f62f=function(_0x33939d){while(--_0x33939d){_0x5ac0da['push'](_0x5ac0da['shift']());}};_0x59f62f(++_0x2f0653);}(_0xa6a7,0x166));var _0x7a6a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa6a7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7a6a('0x0'));var util=require(_0x7a6a('0x1'));var logger=require(_0x7a6a('0x2'))('api');var moment=require(_0x7a6a('0x3'));var BPromise=require(_0x7a6a('0x4'));var rp=require(_0x7a6a('0x5'));var attributes=require(_0x7a6a('0x6'));module[_0x7a6a('0x7')]=function(_0x48ee0c,_0x541a67){return _0x48ee0c['define'](_0x7a6a('0x8'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x7a6a('0x9'),'fields':[_0x7a6a('0x9')]},{'name':_0x7a6a('0xa'),'fields':[_0x7a6a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 6822e62..a9ec1a2 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 _0x314a=['`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgTalktime','raw','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','col','ivrAnswerCallsDay','GetCampaignHopperHistory','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','then','AvgHandleTime','findAll','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG'];(function(_0x13806c,_0x442882){var _0x43391d=function(_0x147756){while(--_0x147756){_0x13806c['push'](_0x13806c['shift']());}};_0x43391d(++_0x442882);}(_0x314a,0xab));var _0xa314=function(_0x39f9f2,_0x37fc06){_0x39f9f2=_0x39f9f2-0x0;var _0x3febf8=_0x314a[_0x39f9f2];return _0x3febf8;};'use strict';var _=require('lodash');var util=require(_0xa314('0x0'));var moment=require('moment');var BPromise=require(_0xa314('0x1'));var rs=require(_0xa314('0x2'));var fs=require('fs');var db=require(_0xa314('0x3'))['db'];var utils=require(_0xa314('0x4'));var logger=require(_0xa314('0x5'))(_0xa314('0x6'));var config=require(_0xa314('0x7'));var jayson=require(_0xa314('0x8'));var client=jayson[_0xa314('0x9')][_0xa314('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d6e26,_0x4d42f4,_0x14c1ce){return new BPromise(function(_0x26c49e,_0x1cec08){return client['request'](_0x1d6e26,_0x14c1ce)['then'](function(_0x39e74d){logger[_0xa314('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x4d42f4,_0xa314('0xc'));logger[_0xa314('0xd')](_0xa314('0xe'),_0x4d42f4,'request\x20sent',JSON[_0xa314('0xf')](_0x39e74d));if(_0x39e74d['error']){if(_0x39e74d[_0xa314('0x10')][_0xa314('0x11')]===0x1f4){logger['error'](_0xa314('0x12'),_0x4d42f4,_0x39e74d['error'][_0xa314('0x13')]);return _0x1cec08(_0x39e74d[_0xa314('0x10')][_0xa314('0x13')]);}logger[_0xa314('0x10')](_0xa314('0x12'),_0x4d42f4,_0x39e74d['error'][_0xa314('0x13')]);return _0x26c49e(_0x39e74d[_0xa314('0x10')]['message']);}else{logger[_0xa314('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x4d42f4,_0xa314('0xc'));_0x26c49e(_0x39e74d[_0xa314('0x14')][_0xa314('0x13')]);}})[_0xa314('0x15')](function(_0x444aae){logger[_0xa314('0x10')](_0xa314('0x12'),_0x4d42f4,_0x444aae);_0x1cec08(_0x444aae);});});}exports[_0xa314('0x16')]=function(_0x30fa7f){var _0x87bf3a=this;return new Promise(function(_0x4f4c1a,_0xfb0520){return db[_0xa314('0x17')][_0xa314('0x18')](_0x30fa7f[_0xa314('0x19')],{'raw':_0x30fa7f[_0xa314('0x1a')]?_0x30fa7f['options']['raw']===undefined?!![]:![]:!![]})[_0xa314('0x1b')](function(_0x1ad8e7){logger[_0xa314('0xb')](_0xa314('0x16'),_0x30fa7f);logger[_0xa314('0xd')](_0xa314('0x16'),_0x30fa7f,JSON[_0xa314('0xf')](_0x1ad8e7));_0x4f4c1a(_0x1ad8e7);})[_0xa314('0x15')](function(_0x5c2e0c){logger[_0xa314('0x10')](_0xa314('0x16'),_0x5c2e0c[_0xa314('0x13')],_0x30fa7f);_0xfb0520(_0x87bf3a[_0xa314('0x10')](0x1f4,_0x5c2e0c[_0xa314('0x13')]));});});};exports[_0xa314('0x1c')]=function(_0x34fc04){var _0x5007a2=this;return new Promise(function(_0x2a414f,_0x1ee4b1){return db['CmHopperHistory'][_0xa314('0x1d')]({'raw':_0x34fc04[_0xa314('0x1a')]?_0x34fc04[_0xa314('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x34fc04[_0xa314('0x1a')]?_0x34fc04[_0xa314('0x1a')][_0xa314('0x1e')]||null:null,'attributes':[[db[_0xa314('0x1f')]['fn'](_0xa314('0x20'),db[_0xa314('0x1f')]['col']('id')),_0xa314('0x21')],[db['sequelize']['fn'](_0xa314('0x20'),db[_0xa314('0x1f')]['fn']('IF',db[_0xa314('0x1f')][_0xa314('0x22')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0xa314('0x1f')]['fn'](_0xa314('0x20'),db[_0xa314('0x1f')]['fn']('IF',db[_0xa314('0x1f')][_0xa314('0x22')](_0xa314('0x23')))),_0xa314('0x24')],[db[_0xa314('0x1f')]['fn'](_0xa314('0x20'),db[_0xa314('0x1f')]['fn']('IF',db['sequelize'][_0xa314('0x22')](_0xa314('0x25')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xa314('0x1f')]['fn'](_0xa314('0x26'),db[_0xa314('0x1f')]['fn']('IF',db[_0xa314('0x1f')][_0xa314('0x22')](_0xa314('0x27')))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn']('AVG',db[_0xa314('0x1f')]['fn']('IF',db[_0xa314('0x1f')][_0xa314('0x22')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xa314('0x28')]]})[_0xa314('0x1b')](function(_0x154994){logger[_0xa314('0xb')](_0xa314('0x1c'),_0x34fc04);logger['debug'](_0xa314('0x1c'),_0x34fc04,JSON[_0xa314('0xf')](_0x154994));_0x2a414f(_0x154994);})[_0xa314('0x15')](function(_0x472519){logger[_0xa314('0x10')]('AvgHandleTime',_0x472519[_0xa314('0x13')],_0x34fc04);_0x1ee4b1(_0x5007a2['error'](0x1f4,_0x472519[_0xa314('0x13')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x140e2d){var _0x3cc77e=this;return new Promise(function(_0x33c786,_0x4f1d59){return db['CmHopperHistory'][_0xa314('0x1d')]({'raw':_0x140e2d[_0xa314('0x1a')]?_0x140e2d[_0xa314('0x1a')][_0xa314('0x29')]===undefined?!![]:![]:!![],'where':_0x140e2d[_0xa314('0x1a')]?_0x140e2d[_0xa314('0x1a')][_0xa314('0x1e')]||null:null,'attributes':[[_0xa314('0x2a'),_0xa314('0x2b')],[db['sequelize']['fn'](_0xa314('0x20'),db[_0xa314('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xa314('0x2c')))),_0xa314('0x2d')],[db[_0xa314('0x1f')]['fn'](_0xa314('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0xa314('0x22')](_0xa314('0x2e')))),_0xa314('0x2f')],[db[_0xa314('0x1f')]['fn'](_0xa314('0x20'),db[_0xa314('0x1f')]['fn']('IF',db[_0xa314('0x1f')][_0xa314('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0xa314('0x30')],[db[_0xa314('0x1f')]['fn']('COUNT',db[_0xa314('0x1f')]['fn']('IF',db[_0xa314('0x1f')]['literal'](_0xa314('0x31')))),'outboundBusyCallsDay'],[db['sequelize']['fn'](_0xa314('0x20'),db[_0xa314('0x1f')]['fn']('IF',db[_0xa314('0x1f')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xa314('0x32')],[db[_0xa314('0x1f')]['fn']('COUNT',db[_0xa314('0x1f')]['fn']('IF',db['sequelize'][_0xa314('0x22')](_0xa314('0x33')))),_0xa314('0x34')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xa314('0x22')](_0xa314('0x35')))),'outboundDropCallsDayCallersExit'],[db[_0xa314('0x1f')]['fn'](_0xa314('0x20'),db[_0xa314('0x1f')]['fn']('IF',db[_0xa314('0x1f')][_0xa314('0x22')](_0xa314('0x36')))),'outboundUnknownCallsDay'],[db[_0xa314('0x1f')]['fn'](_0xa314('0x20'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xa314('0x37')))),_0xa314('0x38')],[db['sequelize']['fn'](_0xa314('0x20'),db[_0xa314('0x1f')]['fn']('IF',db[_0xa314('0x1f')][_0xa314('0x22')](_0xa314('0x39')))),_0xa314('0x3a')],[db[_0xa314('0x1f')]['fn'](_0xa314('0x20'),db['sequelize']['fn']('IF',db[_0xa314('0x1f')][_0xa314('0x22')](_0xa314('0x3b')))),_0xa314('0x3c')],[db[_0xa314('0x1f')]['fn'](_0xa314('0x20'),db[_0xa314('0x1f')]['fn']('IF',db[_0xa314('0x1f')]['literal'](_0xa314('0x3d')))),_0xa314('0x3e')],[db[_0xa314('0x1f')]['fn'](_0xa314('0x20'),db[_0xa314('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xa314('0x3f')))),_0xa314('0x3c')],[db[_0xa314('0x1f')]['fn'](_0xa314('0x20'),db[_0xa314('0x1f')]['fn']('IF',db['sequelize'][_0xa314('0x22')](_0xa314('0x40')))),_0xa314('0x41')]],'group':[_0xa314('0x2a')]})[_0xa314('0x1b')](function(_0x345a19){logger[_0xa314('0xb')](_0xa314('0x42'),_0x140e2d);logger[_0xa314('0xd')](_0xa314('0x42'),_0x140e2d,JSON[_0xa314('0xf')](_0x345a19));_0x33c786(_0x345a19);})[_0xa314('0x15')](function(_0xd66e8){logger[_0xa314('0x10')](_0xa314('0x42'),_0xd66e8['message'],_0x140e2d);_0x4f1d59(_0x3cc77e[_0xa314('0x10')](0x1f4,_0xd66e8[_0xa314('0x13')]));});});};exports['GetCampaignHopperHistory']=function(_0x2d4a4e){var _0x37807b=this;return new Promise(function(_0x49ecf6,_0x2ac976){return db[_0xa314('0x17')][_0xa314('0x1d')]({'raw':_0x2d4a4e[_0xa314('0x1a')]?_0x2d4a4e['options'][_0xa314('0x29')]===undefined?!![]:![]:!![],'where':_0x2d4a4e['options']?_0x2d4a4e[_0xa314('0x1a')][_0xa314('0x1e')]||null:null,'attributes':[[_0xa314('0x2a'),_0xa314('0x2b')],[db['sequelize']['fn'](_0xa314('0x20'),db[_0xa314('0x1f')][_0xa314('0x43')]('id')),'ivrTotalCallsDays'],[db[_0xa314('0x1f')]['fn'](_0xa314('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0xa314('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0xa314('0x44')]],'group':[_0xa314('0x2a')]})[_0xa314('0x1b')](function(_0x79f548){logger[_0xa314('0xb')]('GetCampaignHopperHistory',_0x2d4a4e);logger[_0xa314('0xd')]('GetCampaignHopperHistory',_0x2d4a4e,JSON[_0xa314('0xf')](_0x79f548));_0x49ecf6(_0x79f548);})[_0xa314('0x15')](function(_0x5828a9){logger[_0xa314('0x10')](_0xa314('0x45'),_0x5828a9[_0xa314('0x13')],_0x2d4a4e);_0x2ac976(_0x37807b[_0xa314('0x10')](0x1f4,_0x5828a9[_0xa314('0x13')]));});});}; \ No newline at end of file +var _0x22fb=['then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','CmHopperHistory','body','options','raw','CreateCmHopperHistory','catch','AvgHandleTime','where','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x22fb,0x10d));var _0xb22f=function(_0x39cbe5,_0x58db68){_0x39cbe5=_0x39cbe5-0x0;var _0x36ffb3=_0x22fb[_0x39cbe5];return _0x36ffb3;};'use strict';var _=require(_0xb22f('0x0'));var util=require('util');var moment=require(_0xb22f('0x1'));var BPromise=require(_0xb22f('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xb22f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb22f('0x4'))(_0xb22f('0x5'));var config=require(_0xb22f('0x6'));var jayson=require(_0xb22f('0x7'));var client=jayson[_0xb22f('0x8')][_0xb22f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xad2593,_0x1739b0,_0x144198){return new BPromise(function(_0x259c03,_0x4ad029){return client[_0xb22f('0xa')](_0xad2593,_0x144198)[_0xb22f('0xb')](function(_0x245633){logger[_0xb22f('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x1739b0,_0xb22f('0xd'));logger[_0xb22f('0xe')](_0xb22f('0xf'),_0x1739b0,_0xb22f('0xd'),JSON[_0xb22f('0x10')](_0x245633));if(_0x245633[_0xb22f('0x11')]){if(_0x245633[_0xb22f('0x11')][_0xb22f('0x12')]===0x1f4){logger[_0xb22f('0x11')](_0xb22f('0x13'),_0x1739b0,_0x245633[_0xb22f('0x11')][_0xb22f('0x14')]);return _0x4ad029(_0x245633[_0xb22f('0x11')]['message']);}logger['error'](_0xb22f('0x13'),_0x1739b0,_0x245633[_0xb22f('0x11')]['message']);return _0x259c03(_0x245633[_0xb22f('0x11')][_0xb22f('0x14')]);}else{logger[_0xb22f('0xc')](_0xb22f('0x13'),_0x1739b0,_0xb22f('0xd'));_0x259c03(_0x245633[_0xb22f('0x15')][_0xb22f('0x14')]);}})['catch'](function(_0x4116c1){logger[_0xb22f('0x11')](_0xb22f('0x13'),_0x1739b0,_0x4116c1);_0x4ad029(_0x4116c1);});});}exports['CreateCmHopperHistory']=function(_0x30a637){var _0x3382ca=this;return new Promise(function(_0xc8f93c,_0x5eb4e0){return db[_0xb22f('0x16')]['create'](_0x30a637[_0xb22f('0x17')],{'raw':_0x30a637[_0xb22f('0x18')]?_0x30a637[_0xb22f('0x18')][_0xb22f('0x19')]===undefined?!![]:![]:!![]})[_0xb22f('0xb')](function(_0x5aebd9){logger[_0xb22f('0xc')](_0xb22f('0x1a'),_0x30a637);logger[_0xb22f('0xe')](_0xb22f('0x1a'),_0x30a637,JSON['stringify'](_0x5aebd9));_0xc8f93c(_0x5aebd9);})[_0xb22f('0x1b')](function(_0x4d0e8a){logger[_0xb22f('0x11')](_0xb22f('0x1a'),_0x4d0e8a[_0xb22f('0x14')],_0x30a637);_0x5eb4e0(_0x3382ca['error'](0x1f4,_0x4d0e8a['message']));});});};exports[_0xb22f('0x1c')]=function(_0x3df3ea){var _0x22d6c5=this;return new Promise(function(_0x4078e4,_0x3e273){return db['CmHopperHistory']['findAll']({'raw':_0x3df3ea[_0xb22f('0x18')]?_0x3df3ea['options'][_0xb22f('0x19')]===undefined?!![]:![]:!![],'where':_0x3df3ea['options']?_0x3df3ea[_0xb22f('0x18')][_0xb22f('0x1d')]||null:null,'attributes':[[db['sequelize']['fn'](_0xb22f('0x1e'),db[_0xb22f('0x1f')][_0xb22f('0x20')]('id')),_0xb22f('0x21')],[db['sequelize']['fn'](_0xb22f('0x1e'),db['sequelize']['fn']('IF',db[_0xb22f('0x1f')][_0xb22f('0x22')](_0xb22f('0x23')))),_0xb22f('0x24')],[db[_0xb22f('0x1f')]['fn'](_0xb22f('0x1e'),db[_0xb22f('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xb22f('0x25')))),_0xb22f('0x26')],[db[_0xb22f('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xb22f('0x27')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xb22f('0x1f')]['fn'](_0xb22f('0x28'),db[_0xb22f('0x1f')]['fn']('IF',db['sequelize'][_0xb22f('0x22')](_0xb22f('0x29')))),_0xb22f('0x2a')],[db[_0xb22f('0x1f')]['fn'](_0xb22f('0x28'),db['sequelize']['fn']('IF',db['sequelize'][_0xb22f('0x22')](_0xb22f('0x2b')))),_0xb22f('0x2c')]]})['then'](function(_0x326697){logger[_0xb22f('0xc')](_0xb22f('0x1c'),_0x3df3ea);logger[_0xb22f('0xe')]('AvgHandleTime',_0x3df3ea,JSON[_0xb22f('0x10')](_0x326697));_0x4078e4(_0x326697);})['catch'](function(_0x5ebce9){logger[_0xb22f('0x11')](_0xb22f('0x1c'),_0x5ebce9['message'],_0x3df3ea);_0x3e273(_0x22d6c5['error'](0x1f4,_0x5ebce9[_0xb22f('0x14')]));});});};exports[_0xb22f('0x2d')]=function(_0x5ac003){var _0x2e43da=this;return new Promise(function(_0x3ed3a0,_0x58d40a){return db[_0xb22f('0x16')][_0xb22f('0x2e')]({'raw':_0x5ac003[_0xb22f('0x18')]?_0x5ac003[_0xb22f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5ac003[_0xb22f('0x18')]?_0x5ac003[_0xb22f('0x18')][_0xb22f('0x1d')]||null:null,'attributes':[[_0xb22f('0x2f'),_0xb22f('0x30')],[db[_0xb22f('0x1f')]['fn'](_0xb22f('0x1e'),db[_0xb22f('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xb22f('0x31')))),'outboundNoSuchCallsDay'],[db[_0xb22f('0x1f')]['fn']('COUNT',db[_0xb22f('0x1f')]['fn']('IF',db[_0xb22f('0x1f')]['literal'](_0xb22f('0x32')))),_0xb22f('0x33')],[db[_0xb22f('0x1f')]['fn']('COUNT',db[_0xb22f('0x1f')]['fn']('IF',db[_0xb22f('0x1f')][_0xb22f('0x22')](_0xb22f('0x23')))),_0xb22f('0x34')],[db[_0xb22f('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb22f('0x1f')][_0xb22f('0x22')](_0xb22f('0x35')))),'outboundBusyCallsDay'],[db[_0xb22f('0x1f')]['fn'](_0xb22f('0x1e'),db[_0xb22f('0x1f')]['fn']('IF',db[_0xb22f('0x1f')]['literal'](_0xb22f('0x36')))),'outboundCongestionCallsDay'],[db[_0xb22f('0x1f')]['fn']('COUNT',db[_0xb22f('0x1f')]['fn']('IF',db[_0xb22f('0x1f')][_0xb22f('0x22')](_0xb22f('0x37')))),_0xb22f('0x38')],[db[_0xb22f('0x1f')]['fn']('COUNT',db[_0xb22f('0x1f')]['fn']('IF',db[_0xb22f('0x1f')][_0xb22f('0x22')](_0xb22f('0x39')))),_0xb22f('0x3a')],[db['sequelize']['fn']('COUNT',db[_0xb22f('0x1f')]['fn']('IF',db[_0xb22f('0x1f')][_0xb22f('0x22')](_0xb22f('0x3b')))),'outboundUnknownCallsDay'],[db[_0xb22f('0x1f')]['fn'](_0xb22f('0x1e'),db[_0xb22f('0x1f')]['fn']('IF',db[_0xb22f('0x1f')][_0xb22f('0x22')](_0xb22f('0x3c')))),'outboundBlacklistCallsDay'],[db[_0xb22f('0x1f')]['fn']('COUNT',db[_0xb22f('0x1f')]['fn']('IF',db['sequelize'][_0xb22f('0x22')]('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db[_0xb22f('0x1f')]['fn'](_0xb22f('0x1e'),db[_0xb22f('0x1f')]['fn']('IF',db[_0xb22f('0x1f')][_0xb22f('0x22')](_0xb22f('0x3d')))),_0xb22f('0x3e')],[db[_0xb22f('0x1f')]['fn'](_0xb22f('0x1e'),db[_0xb22f('0x1f')]['fn']('IF',db[_0xb22f('0x1f')]['literal'](_0xb22f('0x3f')))),_0xb22f('0x40')],[db['sequelize']['fn']('COUNT',db[_0xb22f('0x1f')]['fn']('IF',db[_0xb22f('0x1f')][_0xb22f('0x22')](_0xb22f('0x41')))),_0xb22f('0x3e')],[db[_0xb22f('0x1f')]['fn']('COUNT',db[_0xb22f('0x1f')]['fn']('IF',db[_0xb22f('0x1f')][_0xb22f('0x22')](_0xb22f('0x42')))),'outboundReCallsDay']],'group':['campaign']})[_0xb22f('0xb')](function(_0x2532b2){logger[_0xb22f('0xc')](_0xb22f('0x2d'),_0x5ac003);logger[_0xb22f('0xe')]('GetVoiceQueueHopperHistory',_0x5ac003,JSON[_0xb22f('0x10')](_0x2532b2));_0x3ed3a0(_0x2532b2);})[_0xb22f('0x1b')](function(_0x1cbee2){logger[_0xb22f('0x11')](_0xb22f('0x2d'),_0x1cbee2['message'],_0x5ac003);_0x58d40a(_0x2e43da[_0xb22f('0x11')](0x1f4,_0x1cbee2['message']));});});};exports[_0xb22f('0x43')]=function(_0x586ec0){var _0x2fa2be=this;return new Promise(function(_0x24e76e,_0x1b8eeb){return db[_0xb22f('0x16')]['findAll']({'raw':_0x586ec0[_0xb22f('0x18')]?_0x586ec0['options'][_0xb22f('0x19')]===undefined?!![]:![]:!![],'where':_0x586ec0[_0xb22f('0x18')]?_0x586ec0[_0xb22f('0x18')][_0xb22f('0x1d')]||null:null,'attributes':[[_0xb22f('0x2f'),'name'],[db['sequelize']['fn'](_0xb22f('0x1e'),db[_0xb22f('0x1f')][_0xb22f('0x20')]('id')),_0xb22f('0x44')],[db[_0xb22f('0x1f')]['fn'](_0xb22f('0x1e'),db[_0xb22f('0x1f')]['fn']('IF',db[_0xb22f('0x1f')][_0xb22f('0x22')](_0xb22f('0x23')))),_0xb22f('0x45')]],'group':[_0xb22f('0x2f')]})['then'](function(_0x6001ec){logger[_0xb22f('0xc')](_0xb22f('0x43'),_0x586ec0);logger[_0xb22f('0xe')]('GetCampaignHopperHistory',_0x586ec0,JSON['stringify'](_0x6001ec));_0x24e76e(_0x6001ec);})['catch'](function(_0x31c977){logger[_0xb22f('0x11')](_0xb22f('0x43'),_0x31c977[_0xb22f('0x14')],_0x586ec0);_0x1b8eeb(_0x2fa2be[_0xb22f('0x11')](0x1f4,_0x31c977[_0xb22f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 2d12390..d9079f1 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(_0x301f8f,_0x2087c6){var _0x203692=function(_0x51d7c5){while(--_0x51d7c5){_0x301f8f['push'](_0x301f8f['shift']());}};_0x203692(++_0x2087c6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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(_0x558849,_0x9ac0a7){var _0x2e0052=function(_0x4f742b){while(--_0x4f742b){_0x558849['push'](_0x558849['shift']());}};_0x2e0052(++_0x9ac0a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 00bc9ed..a9486b8 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 _0x9957=['exports','STRING','name','sequelize'];(function(_0x155214,_0x331973){var _0x5df1ae=function(_0x582257){while(--_0x582257){_0x155214['push'](_0x155214['shift']());}};_0x5df1ae(++_0x331973);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x31f0=['STRING','sequelize'];(function(_0x3ccac6,_0x3bb920){var _0x45433c=function(_0x20e5dd){while(--_0x20e5dd){_0x3ccac6['push'](_0x3ccac6['shift']());}};_0x45433c(++_0x3bb920);}(_0x31f0,0xb7));var _0x031f=function(_0x271d6c,_0x16f863){_0x271d6c=_0x271d6c-0x0;var _0x1a6f6e=_0x31f0[_0x271d6c];return _0x1a6f6e;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'name':{'type':Sequelize[_0x031f('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x031f('0x1')]},'dialPrefix':{'type':Sequelize[_0x031f('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 30c9fd2..a732836 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 _0x9a0d=['bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','register','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','destroy','then','name','send','index','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','add','day','merge','where','filter','map','options','CmList','includeAll','catch','show','params','include','create','body','update','find','describe','addDisposition','Disposition','getDispositions','findOne','pick','ListId','rows','removeDispositions','CmContact','tags','isArray','join','push','omit','ids','dataValues','errors','message','getContacts','CmCustomField','CustomFields','rawAttributes','concat','format','cf_%d','raw','getContactsCsv','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','download','addCustomField','sequelize','transaction','Sequelize','TEXT','type','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','addAgents','removeAgents','userCmList:remove','getAgents','fast-json-patch','moment'];(function(_0x3e251b,_0x159cc2){var _0x3b2957=function(_0x419dfe){while(--_0x419dfe){_0x3e251b['push'](_0x3e251b['shift']());}};_0x3b2957(++_0x159cc2);}(_0x9a0d,0x1ee));var _0xd9a0=function(_0x1c1509,_0x2dfa81){_0x1c1509=_0x1c1509-0x0;var _0xf11b7=_0x9a0d[_0x1c1509];return _0xf11b7;};'use strict';var jsonpatch=require(_0xd9a0('0x0'));var rp=require('request-promise');var moment=require(_0xd9a0('0x1'));var BPromise=require(_0xd9a0('0x2'));var Mustache=require(_0xd9a0('0x3'));var util=require(_0xd9a0('0x4'));var path=require(_0xd9a0('0x5'));var sox=require(_0xd9a0('0x6'));var csv=require(_0xd9a0('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd9a0('0x8'));var squel=require(_0xd9a0('0x9'));var crypto=require(_0xd9a0('0xa'));var jsforce=require(_0xd9a0('0xb'));var deskjs=require(_0xd9a0('0xc'));var toCsv=require(_0xd9a0('0x7'));var querystring=require(_0xd9a0('0xd'));var Papa=require(_0xd9a0('0xe'));var qs=require(_0xd9a0('0xf'));var logger=require(_0xd9a0('0x10'))('api');var utils=require(_0xd9a0('0x11'));var config=require(_0xd9a0('0x12'));var db=require(_0xd9a0('0x13'))['db'];var socket=require(_0xd9a0('0x14'))({'host':_0xd9a0('0x15'),'port':0x18eb});require('./cmList.socket')[_0xd9a0('0x16')](socket);function respondWithStatusCode(_0x482557,_0x50536c){_0x50536c=_0x50536c||0xcc;return function(_0x37e300){if(_0x37e300){return _0x482557[_0xd9a0('0x17')](_0x50536c);}return _0x482557[_0xd9a0('0x18')](_0x50536c)['end']();};}function respondWithResult(_0x4d7c8a,_0x302a08){_0x302a08=_0x302a08||0xc8;return function(_0x16a4b0){if(_0x16a4b0){return _0x4d7c8a[_0xd9a0('0x18')](_0x302a08)[_0xd9a0('0x19')](_0x16a4b0);}};}function respondWithFilteredResult(_0x221d93,_0x2311bf){return function(_0x1c0009){if(_0x1c0009){var _0x1c016a=_0x1c0009[_0xd9a0('0x1a')],_0x287237=_0x2311bf[_0xd9a0('0x1b')],_0x155d74=_0x2311bf[_0xd9a0('0x1b')]+_0x2311bf[_0xd9a0('0x1c')],_0xaa5fa7;if(_0x155d74>=_0x1c016a){_0x155d74=_0x1c016a;_0xaa5fa7=0xc8;}else{_0xaa5fa7=0xce;}_0x221d93['status'](_0xaa5fa7);return _0x221d93['set'](_0xd9a0('0x1d'),_0x287237+'-'+_0x155d74+'/'+_0x1c016a)[_0xd9a0('0x19')](_0x1c0009);}return null;};}function patchUpdates(_0x3448f2){return function(_0x70720d){try{jsonpatch['apply'](_0x70720d,_0x3448f2,!![]);}catch(_0x150129){return BPromise[_0xd9a0('0x1e')](_0x150129);}return _0x70720d[_0xd9a0('0x1f')]();};}function saveUpdates(_0x519df7,_0x104899){return function(_0x3effbe){if(_0x3effbe){return _0x3effbe['update'](_0x519df7)['then'](function(_0x5400ef){return _0x5400ef;});}return null;};}function removeEntity(_0x5c8de4,_0x401877){return function(_0x282350){if(_0x282350){return _0x282350[_0xd9a0('0x20')]()[_0xd9a0('0x21')](function(){_0x5c8de4[_0xd9a0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a76f2,_0x577e15){return function(_0x2e22ef){if(!_0x2e22ef){_0x3a76f2[_0xd9a0('0x17')](0x194);}return _0x2e22ef;};}function handleError(_0x2d3248,_0x14caea){_0x14caea=_0x14caea||0x1f4;return function(_0x34ef20){logger['error'](_0x34ef20['stack']);if(_0x34ef20[_0xd9a0('0x22')]){delete _0x34ef20[_0xd9a0('0x22')];}_0x2d3248['status'](_0x14caea)[_0xd9a0('0x23')](_0x34ef20);};}exports[_0xd9a0('0x24')]=function(_0x25d5e7,_0x3ded1d){var _0x40267f={},_0x37c7ed={},_0x589d12={'count':0x0,'rows':[]};var _0x2e6f4e=db['CmList']['rawAttributes'];_0x37c7ed[_0xd9a0('0x25')]=_[_0xd9a0('0x26')](_0x2e6f4e);var _0x18a1b1={'dateStart':_0x25d5e7[_0xd9a0('0x27')][_0xd9a0('0x28')],'dateEnd':_0x25d5e7['query'][_0xd9a0('0x29')]};delete _0x25d5e7['query'][_0xd9a0('0x28')];delete _0x25d5e7[_0xd9a0('0x27')][_0xd9a0('0x29')];_0x37c7ed[_0xd9a0('0x27')]=_[_0xd9a0('0x26')](_0x25d5e7[_0xd9a0('0x27')]);_0x37c7ed[_0xd9a0('0x2a')]=_['intersection'](_0x37c7ed['model'],_0x37c7ed[_0xd9a0('0x27')]);_0x40267f[_0xd9a0('0x2b')]=_[_0xd9a0('0x2c')](_0x37c7ed[_0xd9a0('0x25')],qs['fields'](_0x25d5e7[_0xd9a0('0x27')][_0xd9a0('0x2d')]));_0x40267f[_0xd9a0('0x2b')]=_0x40267f[_0xd9a0('0x2b')][_0xd9a0('0x2e')]?_0x40267f[_0xd9a0('0x2b')]:_0x37c7ed['model'];if(!_0x25d5e7[_0xd9a0('0x27')][_0xd9a0('0x2f')](_0xd9a0('0x30'))){_0x40267f[_0xd9a0('0x1c')]=qs[_0xd9a0('0x1c')](_0x25d5e7[_0xd9a0('0x27')][_0xd9a0('0x1c')]);_0x40267f['offset']=qs['offset'](_0x25d5e7[_0xd9a0('0x27')][_0xd9a0('0x1b')]);}_0x40267f[_0xd9a0('0x31')]=qs[_0xd9a0('0x32')](_0x25d5e7[_0xd9a0('0x27')]['sort']);_0x40267f['where']=qs[_0xd9a0('0x2a')](_['pick'](_0x25d5e7[_0xd9a0('0x27')],_0x37c7ed['filters']));if(_0x18a1b1['dateStart']){if(_0x18a1b1['dateEnd']){_0x18a1b1['dateEnd']=moment(_0x18a1b1[_0xd9a0('0x29')])[_0xd9a0('0x33')](0x1,_0xd9a0('0x34'));}else{_0x18a1b1['dateEnd']=moment(_0x18a1b1[_0xd9a0('0x28')])[_0xd9a0('0x33')](0x1,_0xd9a0('0x34'));}_[_0xd9a0('0x35')](_0x40267f[_0xd9a0('0x36')],{'createdAt':{'$gte':_0x18a1b1[_0xd9a0('0x28')],'$lte':_0x18a1b1['dateEnd']}});}if(_0x25d5e7[_0xd9a0('0x27')][_0xd9a0('0x37')]){_0x40267f[_0xd9a0('0x36')]=_['merge'](_0x40267f[_0xd9a0('0x36')],{'$or':_[_0xd9a0('0x38')](_0x40267f[_0xd9a0('0x2b')],function(_0x160d83){var _0x30c879={};_0x30c879[_0x160d83]={'$like':'%'+_0x25d5e7[_0xd9a0('0x27')][_0xd9a0('0x37')]+'%'};return _0x30c879;})});}_0x40267f=_['merge']({},_0x40267f,_0x25d5e7[_0xd9a0('0x39')]);var _0x4baa10={'where':_0x40267f['where']};return db[_0xd9a0('0x3a')][_0xd9a0('0x1a')](_0x4baa10)[_0xd9a0('0x21')](function(_0x2e83fd){_0x589d12[_0xd9a0('0x1a')]=_0x2e83fd;if(_0x25d5e7[_0xd9a0('0x27')][_0xd9a0('0x3b')]){_0x40267f['include']=[{'all':!![]}];}return db[_0xd9a0('0x3a')]['findAll'](_0x40267f);})[_0xd9a0('0x21')](function(_0x2618e2){_0x589d12['rows']=_0x2618e2;return _0x589d12;})[_0xd9a0('0x21')](respondWithFilteredResult(_0x3ded1d,_0x40267f))[_0xd9a0('0x3c')](handleError(_0x3ded1d,null));};exports[_0xd9a0('0x3d')]=function(_0x263dea,_0x510ec7){var _0x210053={'raw':![],'where':{'id':_0x263dea[_0xd9a0('0x3e')]['id']}},_0x3a0ff5={};_0x3a0ff5[_0xd9a0('0x25')]=_[_0xd9a0('0x26')](db[_0xd9a0('0x3a')]['rawAttributes']);_0x3a0ff5[_0xd9a0('0x27')]=_['keys'](_0x263dea[_0xd9a0('0x27')]);_0x3a0ff5[_0xd9a0('0x2a')]=_['intersection'](_0x3a0ff5['model'],_0x3a0ff5[_0xd9a0('0x27')]);_0x210053[_0xd9a0('0x2b')]=_['intersection'](_0x3a0ff5[_0xd9a0('0x25')],qs[_0xd9a0('0x2d')](_0x263dea[_0xd9a0('0x27')][_0xd9a0('0x2d')]));_0x210053['attributes']=_0x210053['attributes'][_0xd9a0('0x2e')]?_0x210053[_0xd9a0('0x2b')]:_0x3a0ff5['model'];if(_0x263dea[_0xd9a0('0x27')][_0xd9a0('0x3b')]){_0x210053[_0xd9a0('0x3f')]=[{'all':!![]}];}_0x210053=_[_0xd9a0('0x35')]({},_0x210053,_0x263dea[_0xd9a0('0x39')]);return db[_0xd9a0('0x3a')]['find'](_0x210053)[_0xd9a0('0x21')](handleEntityNotFound(_0x510ec7,null))[_0xd9a0('0x21')](respondWithResult(_0x510ec7,null))['catch'](handleError(_0x510ec7,null));};exports[_0xd9a0('0x40')]=function(_0x1ce1dd,_0x5a513f){return db[_0xd9a0('0x3a')]['create'](_0x1ce1dd[_0xd9a0('0x41')],{})[_0xd9a0('0x21')](respondWithResult(_0x5a513f,0xc9))[_0xd9a0('0x3c')](handleError(_0x5a513f,null));};exports[_0xd9a0('0x42')]=function(_0x164349,_0x35be58){if(_0x164349[_0xd9a0('0x41')]['id']){delete _0x164349[_0xd9a0('0x41')]['id'];}return db[_0xd9a0('0x3a')][_0xd9a0('0x43')]({'where':{'id':_0x164349[_0xd9a0('0x3e')]['id']}})[_0xd9a0('0x21')](handleEntityNotFound(_0x35be58,null))[_0xd9a0('0x21')](saveUpdates(_0x164349[_0xd9a0('0x41')],null))['then'](respondWithResult(_0x35be58,null))[_0xd9a0('0x3c')](handleError(_0x35be58,null));};exports[_0xd9a0('0x20')]=function(_0x13cbe9,_0x4bf191){return db[_0xd9a0('0x3a')][_0xd9a0('0x43')]({'where':{'id':_0x13cbe9['params']['id']}})['then'](handleEntityNotFound(_0x4bf191,null))['then'](removeEntity(_0x4bf191,null))['catch'](handleError(_0x4bf191,null));};exports[_0xd9a0('0x44')]=function(_0x558db8,_0x607bcd){return db['CmList'][_0xd9a0('0x44')]()[_0xd9a0('0x21')](respondWithResult(_0x607bcd,null))[_0xd9a0('0x3c')](handleError(_0x607bcd,null));};exports[_0xd9a0('0x45')]=function(_0x393b09,_0xdc9327,_0x253b10){if(_0x393b09['body']['id']){delete _0x393b09[_0xd9a0('0x41')]['id'];}return db[_0xd9a0('0x3a')][_0xd9a0('0x43')]({'where':{'id':_0x393b09['params']['id']}})[_0xd9a0('0x21')](handleEntityNotFound(_0xdc9327,null))['then'](function(_0x13fe85){if(_0x13fe85){_0x393b09[_0xd9a0('0x41')]['ListId']=_0x13fe85['id'];return db[_0xd9a0('0x46')][_0xd9a0('0x40')](_0x393b09[_0xd9a0('0x41')]);}})[_0xd9a0('0x21')](respondWithResult(_0xdc9327,null))[_0xd9a0('0x3c')](handleError(_0xdc9327,null));};exports[_0xd9a0('0x47')]=function(_0x5e3713,_0x5e0f1e,_0x7bc100){var _0x2f34de={'raw':![],'where':{}};var _0x53eb0c={};var _0x36276a={'count':0x0,'rows':[]};return db[_0xd9a0('0x3a')][_0xd9a0('0x48')]({'where':{'id':_0x5e3713[_0xd9a0('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5e0f1e,null))[_0xd9a0('0x21')](function(_0xc5cc6b){if(_0xc5cc6b){_0x53eb0c[_0xd9a0('0x25')]=_[_0xd9a0('0x26')](db[_0xd9a0('0x46')]['rawAttributes']);_0x53eb0c[_0xd9a0('0x27')]=_[_0xd9a0('0x26')](_0x5e3713['query']);_0x53eb0c[_0xd9a0('0x2a')]=_['intersection'](_0x53eb0c[_0xd9a0('0x25')],_0x53eb0c[_0xd9a0('0x27')]);_0x2f34de['attributes']=_[_0xd9a0('0x2c')](_0x53eb0c[_0xd9a0('0x25')],qs[_0xd9a0('0x2d')](_0x5e3713[_0xd9a0('0x27')][_0xd9a0('0x2d')]));_0x2f34de[_0xd9a0('0x2b')]=_0x2f34de[_0xd9a0('0x2b')][_0xd9a0('0x2e')]?_0x2f34de[_0xd9a0('0x2b')]:_0x53eb0c[_0xd9a0('0x25')];if(!_0x5e3713[_0xd9a0('0x27')][_0xd9a0('0x2f')](_0xd9a0('0x30'))){_0x2f34de[_0xd9a0('0x1c')]=qs[_0xd9a0('0x1c')](_0x5e3713['query'][_0xd9a0('0x1c')]);_0x2f34de[_0xd9a0('0x1b')]=qs[_0xd9a0('0x1b')](_0x5e3713[_0xd9a0('0x27')][_0xd9a0('0x1b')]);}_0x2f34de[_0xd9a0('0x31')]=qs[_0xd9a0('0x32')](_0x5e3713['query']['sort']);_0x2f34de[_0xd9a0('0x36')]=qs[_0xd9a0('0x2a')](_[_0xd9a0('0x49')](_0x5e3713[_0xd9a0('0x27')],_0x53eb0c[_0xd9a0('0x2a')]));_0x2f34de[_0xd9a0('0x36')][_0xd9a0('0x4a')]=_0xc5cc6b['id'];if(_0x5e3713[_0xd9a0('0x27')]['filter']){_0x2f34de[_0xd9a0('0x36')]=_['merge'](_0x2f34de[_0xd9a0('0x36')],{'$or':_[_0xd9a0('0x38')](_0x2f34de['attributes'],function(_0x3e58e1){var _0x24c72c={};_0x24c72c[_0x3e58e1]={'$like':'%'+_0x5e3713[_0xd9a0('0x27')][_0xd9a0('0x37')]+'%'};return _0x24c72c;})});}_0x2f34de=_[_0xd9a0('0x35')]({},_0x2f34de,_0x5e3713[_0xd9a0('0x39')]);return db[_0xd9a0('0x46')][_0xd9a0('0x1a')]({'where':_0x2f34de[_0xd9a0('0x36')]})['then'](function(_0x466417){_0x36276a['count']=_0x466417;if(_0x5e3713['query'][_0xd9a0('0x3b')]){_0x2f34de[_0xd9a0('0x3f')]=[{'all':!![]}];}return db[_0xd9a0('0x46')]['findAll'](_0x2f34de);})['then'](function(_0x514b45){_0x36276a[_0xd9a0('0x4b')]=_0x514b45;return _0x36276a;});}})['then'](respondWithFilteredResult(_0x5e0f1e,_0x2f34de))[_0xd9a0('0x3c')](handleError(_0x5e0f1e,null));};exports[_0xd9a0('0x4c')]=function(_0x42d72c,_0x372e89,_0x6e05ba){var _0x1edd4a;return db[_0xd9a0('0x3a')][_0xd9a0('0x43')]({'where':{'id':_0x42d72c['params']['id']}})['then'](handleEntityNotFound(_0x372e89,null))[_0xd9a0('0x21')](function(_0x155a6d){if(_0x155a6d){return _0x155a6d[_0xd9a0('0x4c')](_0x42d72c[_0xd9a0('0x27')]['ids']);}})[_0xd9a0('0x21')](respondWithStatusCode(_0x372e89,null))['catch'](handleError(_0x372e89,null));};exports['addContacts']=function(_0x2029f3,_0x274845,_0x49fa91){return db[_0xd9a0('0x3a')][_0xd9a0('0x43')]({'where':{'id':_0x2029f3[_0xd9a0('0x3e')]['id']}})[_0xd9a0('0x21')](handleEntityNotFound(_0x274845,null))[_0xd9a0('0x21')](function(_0x423279){if(_0x423279){var _0x217730=[];var _0xc2eb26={'success':[],'errors':[]};return db[_0xd9a0('0x4d')]['describe']()[_0xd9a0('0x21')](function(_0x2982ff){if(_0x2029f3[_0xd9a0('0x41')][_0xd9a0('0x4e')]&&_[_0xd9a0('0x4f')](_0x2029f3[_0xd9a0('0x41')]['tags'])){if(_0x2029f3[_0xd9a0('0x41')][_0xd9a0('0x4e')]['length']){_0x2029f3[_0xd9a0('0x41')][_0xd9a0('0x4e')]=_0x2029f3[_0xd9a0('0x41')][_0xd9a0('0x4e')][_0xd9a0('0x50')](';')+';';}else{_0x2029f3[_0xd9a0('0x41')]['tags']=null;}}else{_0x2029f3['body'][_0xd9a0('0x4e')]=null;}if(_0x2029f3['body']&&_[_0xd9a0('0x4f')](_0x2029f3[_0xd9a0('0x41')])){for(var _0x1161be=0x0;_0x1161be<_0x2029f3[_0xd9a0('0x41')][_0xd9a0('0x2e')];_0x1161be+=0x1){_0x2029f3[_0xd9a0('0x41')][_0x1161be][_0xd9a0('0x4a')]=_0x2029f3[_0xd9a0('0x3e')]['id'];_0x217730[_0xd9a0('0x51')](_0x2029f3[_0xd9a0('0x41')][_0x1161be]);}return BPromise['each'](_0x217730,function(_0x455a81){return db[_0xd9a0('0x4d')][_0xd9a0('0x40')](_[_0xd9a0('0x52')](_0x455a81,[_0xd9a0('0x53'),'id'])||{},{'fields':_[_0xd9a0('0x26')](_0x2982ff),'raw':!![]})['then'](function(_0x2851f0){_0xc2eb26['success'][_0xd9a0('0x51')](_0x2851f0[_0xd9a0('0x54')]);})['catch'](function(_0x498c08){_0xc2eb26[_0xd9a0('0x55')][_0xd9a0('0x51')]({'data':_0x455a81,'error':_0x498c08[_0xd9a0('0x56')]});});})[_0xd9a0('0x21')](function(_0x4ab580){return _0xc2eb26;})[_0xd9a0('0x3c')](function(_0x44299a){return _0x44299a;});}else{_0x274845['status'](0x190)[_0xd9a0('0x19')]({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x274845,null))[_0xd9a0('0x3c')](handleError(_0x274845,null));};exports[_0xd9a0('0x57')]=function(_0x56d32e,_0x346076,_0x348d58){var _0x3bd347;return db[_0xd9a0('0x3a')][_0xd9a0('0x43')]({'where':{'id':_0x56d32e['params']['id']},'include':[{'model':db[_0xd9a0('0x58')],'as':_0xd9a0('0x59')}]})[_0xd9a0('0x21')](handleEntityNotFound(_0x346076,null))['then'](function(_0x138578){if(_0x138578){_0x3bd347=_0x138578;return db['CmContact'][_0xd9a0('0x5a')];}})[_0xd9a0('0x21')](function(_0x49e1e7){if(_0x49e1e7){var _0x541742={};var _0x234bdc={};_0x234bdc['model']=_[_0xd9a0('0x5b')](_['keys'](_0x49e1e7),_[_0xd9a0('0x38')](_0x3bd347[_0xd9a0('0x59')],function(_0x8e6020){return util[_0xd9a0('0x5c')](_0xd9a0('0x5d'),_0x8e6020['id']);}));_0x234bdc['query']=_['keys'](_0x56d32e[_0xd9a0('0x27')]);_0x234bdc[_0xd9a0('0x2a')]=_[_0xd9a0('0x2c')](_0x234bdc[_0xd9a0('0x25')],_0x234bdc['query']);_0x541742[_0xd9a0('0x2b')]=_[_0xd9a0('0x2c')](_0x234bdc['model'],qs[_0xd9a0('0x2d')](_0x56d32e['query'][_0xd9a0('0x2d')]));_0x541742[_0xd9a0('0x2b')]=_0x541742[_0xd9a0('0x2b')][_0xd9a0('0x2e')]?_0x541742['attributes']:_0x234bdc['model'];if(!_0x56d32e[_0xd9a0('0x27')]['hasOwnProperty']('nolimit')){_0x541742['limit']=qs[_0xd9a0('0x1c')](_0x56d32e[_0xd9a0('0x27')][_0xd9a0('0x1c')]);_0x541742['offset']=qs['offset'](_0x56d32e[_0xd9a0('0x27')]['offset']);}_0x541742['order']=qs[_0xd9a0('0x32')](_0x56d32e[_0xd9a0('0x27')][_0xd9a0('0x32')]);_0x541742[_0xd9a0('0x36')]=qs['filters'](_['pick'](_0x56d32e['query'],_0x234bdc[_0xd9a0('0x2a')]));_0x541742[_0xd9a0('0x5e')]=!![];if(_0x56d32e[_0xd9a0('0x27')][_0xd9a0('0x37')]){_0x541742[_0xd9a0('0x36')]=_[_0xd9a0('0x35')](_0x541742['where'],{'$or':_[_0xd9a0('0x38')](_0x541742[_0xd9a0('0x2b')],function(_0x17071c){var _0x327252={};_0x327252[_0x17071c]={'$like':'%'+_0x56d32e[_0xd9a0('0x27')]['filter']+'%'};return _0x327252;})});}_0x541742=_[_0xd9a0('0x35')]({},_0x541742,_0x56d32e['options']);return _0x3bd347[_0xd9a0('0x57')](_0x541742);}})[_0xd9a0('0x21')](respondWithResult(_0x346076,null))[_0xd9a0('0x3c')](handleError(_0x346076,null));};exports[_0xd9a0('0x5f')]=function(_0xa9a34e,_0x1779c2,_0xf9a85f){var _0x21d5b0;return db['CmList'][_0xd9a0('0x43')]({'where':{'id':_0xa9a34e[_0xd9a0('0x3e')]['id']},'include':[{'model':db[_0xd9a0('0x58')],'as':_0xd9a0('0x59')}]})[_0xd9a0('0x21')](handleEntityNotFound(_0x1779c2,null))[_0xd9a0('0x21')](function(_0x4ee8c7){if(_0x4ee8c7){_0x21d5b0=_0x4ee8c7;return db[_0xd9a0('0x4d')][_0xd9a0('0x5a')];}})['then'](function(_0x51310d){if(_0x51310d){var _0x51ce60={};var _0x42c7a6={};_0x42c7a6[_0xd9a0('0x25')]=_[_0xd9a0('0x5b')](_['keys'](_0x51310d),_['map'](_0x21d5b0['CustomFields'],function(_0x30e170){return util['format'](_0xd9a0('0x5d'),_0x30e170['id']);}));_0x42c7a6[_0xd9a0('0x27')]=_['keys'](_0xa9a34e['query']);_0x42c7a6[_0xd9a0('0x2a')]=_[_0xd9a0('0x2c')](_0x42c7a6[_0xd9a0('0x25')],_0x42c7a6['query']);_0x51ce60['attributes']=_[_0xd9a0('0x2c')](_0x42c7a6['model'],qs['fields'](_0xa9a34e[_0xd9a0('0x27')][_0xd9a0('0x2d')]));_0x51ce60[_0xd9a0('0x2b')]=_0x51ce60[_0xd9a0('0x2b')][_0xd9a0('0x2e')]?_0x51ce60['attributes']:_0x42c7a6[_0xd9a0('0x25')];if(!_0xa9a34e[_0xd9a0('0x27')][_0xd9a0('0x2f')](_0xd9a0('0x30'))){_0x51ce60[_0xd9a0('0x1c')]=qs[_0xd9a0('0x1c')](_0xa9a34e[_0xd9a0('0x27')][_0xd9a0('0x1c')]);_0x51ce60[_0xd9a0('0x1b')]=qs['offset'](_0xa9a34e[_0xd9a0('0x27')][_0xd9a0('0x1b')]);}_0x51ce60[_0xd9a0('0x31')]=qs[_0xd9a0('0x32')](_0xa9a34e['query']['sort']);_0x51ce60[_0xd9a0('0x36')]=qs[_0xd9a0('0x2a')](_[_0xd9a0('0x49')](_0xa9a34e[_0xd9a0('0x27')],_0x42c7a6[_0xd9a0('0x2a')]));_0x51ce60[_0xd9a0('0x5e')]=!![];if(_0xa9a34e[_0xd9a0('0x27')][_0xd9a0('0x37')]){_0x51ce60[_0xd9a0('0x36')]=_[_0xd9a0('0x35')](_0x51ce60[_0xd9a0('0x36')],{'$or':_[_0xd9a0('0x38')](_0x51ce60[_0xd9a0('0x2b')],function(_0x2f5dc0){var _0x139bcb={};_0x139bcb[_0x2f5dc0]={'$like':'%'+_0xa9a34e[_0xd9a0('0x27')][_0xd9a0('0x37')]+'%'};return _0x139bcb;})});}_0x51ce60=_[_0xd9a0('0x35')]({},_0x51ce60,_0xa9a34e[_0xd9a0('0x39')]);return _0x21d5b0[_0xd9a0('0x57')](_0x51ce60);}})[_0xd9a0('0x21')](function(_0x54e278){if(!_[_0xd9a0('0x60')](_0x54e278)){var _0x54fc01=toCsv(_0x54e278);var _0x27b7dc=Date['now']();fs[_0xd9a0('0x61')](util[_0xd9a0('0x5c')](_0xd9a0('0x62'),_0x21d5b0['id'],_0x27b7dc),_0x54fc01);_0x1779c2['setHeader'](_0xd9a0('0x63'),_0xd9a0('0x64')+util['format'](_0xd9a0('0x65'),_0x21d5b0['id'],_0x27b7dc));_0x1779c2[_0xd9a0('0x66')](_0xd9a0('0x67'),_0xd9a0('0x68'));return _0x1779c2[_0xd9a0('0x69')](util[_0xd9a0('0x5c')]('/tmp/list_%d_%s.csv',_0x21d5b0['id'],_0x27b7dc));}else{return _0x1779c2['sendStatus'](0xcc);}})[_0xd9a0('0x3c')](handleError(_0x1779c2,null));};exports[_0xd9a0('0x6a')]=function(_0x57658f,_0x2332c3,_0x5eb4fb){var _0x1251cf;delete _0x57658f[_0xd9a0('0x41')]['id'];return db[_0xd9a0('0x3a')][_0xd9a0('0x48')]({'where':{'id':_0x57658f[_0xd9a0('0x3e')]['id']}})[_0xd9a0('0x21')](handleEntityNotFound(_0x2332c3,null))[_0xd9a0('0x21')](function(_0x514a67){if(_0x514a67){return db[_0xd9a0('0x6b')][_0xd9a0('0x6c')](function(_0xd0168e){return db[_0xd9a0('0x58')][_0xd9a0('0x40')](_0x57658f['body'],{'transaction':_0xd0168e})[_0xd9a0('0x21')](function(_0xac1f0d){_0x1251cf=_0xac1f0d;return _0x514a67['addCustomFields'](_0xac1f0d,{'transaction':_0xd0168e});})[_0xd9a0('0x21')](function(){var _0x4ca885={'type':db[_0xd9a0('0x6d')][_0xd9a0('0x6e')],'transaction':_0xd0168e};switch(_0x57658f[_0xd9a0('0x41')][_0xd9a0('0x6f')]){case _0xd9a0('0x70'):_0x4ca885['type']=db[_0xd9a0('0x6d')][_0xd9a0('0x6e')];break;case'number':_0x4ca885[_0xd9a0('0x6f')]=db[_0xd9a0('0x6d')][_0xd9a0('0x71')];break;case _0xd9a0('0x72'):_0x4ca885[_0xd9a0('0x6f')]=db['Sequelize'][_0xd9a0('0x73')];_0x4ca885[_0xd9a0('0x74')]=![];break;default:}return db['sequelize'][_0xd9a0('0x75')][_0xd9a0('0x76')](_0xd9a0('0x77'),util[_0xd9a0('0x5c')]('cf_%s',_0x1251cf['id']),_0x4ca885);})[_0xd9a0('0x21')](function(){return _0x1251cf;});});}})['then'](respondWithResult(_0x2332c3,null))['catch'](handleError(_0x2332c3,null));};exports['getCustomFields']=function(_0x6823e0,_0x5b8f78,_0x48cc5e){var _0xa6eb5d={};var _0x405eb4={};var _0x3e01c5;var _0x53a801;return db[_0xd9a0('0x3a')][_0xd9a0('0x48')]({'where':{'id':_0x6823e0[_0xd9a0('0x3e')]['id']}})[_0xd9a0('0x21')](handleEntityNotFound(_0x5b8f78,null))[_0xd9a0('0x21')](function(_0x2f5fc0){if(_0x2f5fc0){_0x3e01c5=_0x2f5fc0;_0x405eb4[_0xd9a0('0x25')]=_[_0xd9a0('0x26')](db[_0xd9a0('0x58')]['rawAttributes']);_0x405eb4[_0xd9a0('0x27')]=_[_0xd9a0('0x26')](_0x6823e0['query']);_0x405eb4['filters']=_[_0xd9a0('0x2c')](_0x405eb4['model'],_0x405eb4['query']);_0xa6eb5d[_0xd9a0('0x2b')]=_['intersection'](_0x405eb4[_0xd9a0('0x25')],qs[_0xd9a0('0x2d')](_0x6823e0[_0xd9a0('0x27')][_0xd9a0('0x2d')]));_0xa6eb5d['attributes']=_0xa6eb5d[_0xd9a0('0x2b')][_0xd9a0('0x2e')]?_0xa6eb5d[_0xd9a0('0x2b')]:_0x405eb4[_0xd9a0('0x25')];_0xa6eb5d['order']=qs[_0xd9a0('0x32')](_0x6823e0[_0xd9a0('0x27')]['sort']);_0xa6eb5d[_0xd9a0('0x36')]=qs['filters'](_[_0xd9a0('0x49')](_0x6823e0[_0xd9a0('0x27')],_0x405eb4[_0xd9a0('0x2a')]));_0xa6eb5d[_0xd9a0('0x36')]=_[_0xd9a0('0x35')](_0xa6eb5d[_0xd9a0('0x36')],{'$or':[{'ListId':_0x2f5fc0['id']},{'ListId':null}]});if(_0x6823e0[_0xd9a0('0x27')][_0xd9a0('0x37')]){_0xa6eb5d[_0xd9a0('0x36')]=_[_0xd9a0('0x35')](_0xa6eb5d[_0xd9a0('0x36')],{'$or':_['map'](_0xa6eb5d[_0xd9a0('0x2b')],function(_0x8122f2){var _0x160632={};_0x160632[_0x8122f2]={'$like':'%'+_0x6823e0[_0xd9a0('0x27')]['filter']+'%'};return _0x160632;})});}_0xa6eb5d=_[_0xd9a0('0x35')]({},_0xa6eb5d,_0x6823e0['options']);return db['CmCustomField']['findAndCountAll'](_0xa6eb5d);}})['then'](respondWithResult(_0x5b8f78,null))[_0xd9a0('0x3c')](handleError(_0x5b8f78,null));};exports['addAgents']=function(_0x42a436,_0x5344d6,_0x5eff3b){return db[_0xd9a0('0x3a')]['find']({'where':{'id':_0x42a436[_0xd9a0('0x3e')]['id']}})[_0xd9a0('0x21')](handleEntityNotFound(_0x5344d6,null))[_0xd9a0('0x21')](function(_0x505fb9){if(_0x505fb9){return _0x505fb9[_0xd9a0('0x78')](_0x42a436[_0xd9a0('0x41')][_0xd9a0('0x53')],_[_0xd9a0('0x52')](_0x42a436[_0xd9a0('0x41')],[_0xd9a0('0x53'),'id'])||{})['spread'](function(_0x48b2cc){for(var _0x466cd3=0x0;_0x466cd3<_0x42a436[_0xd9a0('0x41')][_0xd9a0('0x53')]['length'];_0x466cd3+=0x1){socket['emit']('userCmList:save',{'UserId':_0x42a436[_0xd9a0('0x41')][_0xd9a0('0x53')][_0x466cd3],'CmListId':_0x42a436[_0xd9a0('0x3e')]['id']});}return _0x48b2cc;});}})[_0xd9a0('0x21')](respondWithResult(_0x5344d6,null))[_0xd9a0('0x3c')](handleError(_0x5344d6,null));};exports['removeAgents']=function(_0x2685c4,_0x4fa7bc,_0x18ae2b){var _0x4d29a1;return db['CmList'][_0xd9a0('0x43')]({'where':{'id':_0x2685c4[_0xd9a0('0x3e')]['id']}})[_0xd9a0('0x21')](handleEntityNotFound(_0x4fa7bc,null))[_0xd9a0('0x21')](function(_0x44edfe){if(_0x44edfe){return _0x44edfe[_0xd9a0('0x79')](_0x2685c4[_0xd9a0('0x27')]['ids'])[_0xd9a0('0x21')](function(_0x4dbebd){if(_[_0xd9a0('0x4f')](_0x2685c4[_0xd9a0('0x27')][_0xd9a0('0x53')])){for(var _0x5214b6=0x0;_0x5214b6<_0x2685c4['query'][_0xd9a0('0x53')][_0xd9a0('0x2e')];_0x5214b6+=0x1){socket['emit'](_0xd9a0('0x7a'),{'UserId':_0x2685c4[_0xd9a0('0x27')]['ids'][_0x5214b6],'CmListId':_0x2685c4[_0xd9a0('0x3e')]['id']});}}else{socket['emit'](_0xd9a0('0x7a'),{'UserId':_0x2685c4[_0xd9a0('0x27')][_0xd9a0('0x53')],'CmListId':_0x2685c4[_0xd9a0('0x3e')]['id']});}});}})['then'](respondWithStatusCode(_0x4fa7bc,null))[_0xd9a0('0x3c')](handleError(_0x4fa7bc,null));};exports[_0xd9a0('0x7b')]=function(_0x470072,_0x3a8054,_0x241c3b){var _0xb8fb36={};var _0x14e27e={};var _0x5b49ae;var _0x76e734;return db[_0xd9a0('0x3a')][_0xd9a0('0x48')]({'where':{'id':_0x470072['params']['id']}})[_0xd9a0('0x21')](handleEntityNotFound(_0x3a8054,null))[_0xd9a0('0x21')](function(_0x2dcce){if(_0x2dcce){_0x5b49ae=_0x2dcce;_0x14e27e[_0xd9a0('0x25')]=_[_0xd9a0('0x26')](db['User'][_0xd9a0('0x5a')]);_0x14e27e[_0xd9a0('0x27')]=_['keys'](_0x470072['query']);_0x14e27e['filters']=_[_0xd9a0('0x2c')](_0x14e27e[_0xd9a0('0x25')],_0x14e27e[_0xd9a0('0x27')]);_0xb8fb36[_0xd9a0('0x2b')]=_[_0xd9a0('0x2c')](_0x14e27e[_0xd9a0('0x25')],qs['fields'](_0x470072[_0xd9a0('0x27')]['fields']));_0xb8fb36[_0xd9a0('0x2b')]=_0xb8fb36[_0xd9a0('0x2b')][_0xd9a0('0x2e')]?_0xb8fb36[_0xd9a0('0x2b')]:_0x14e27e[_0xd9a0('0x25')];_0xb8fb36[_0xd9a0('0x31')]=qs[_0xd9a0('0x32')](_0x470072['query'][_0xd9a0('0x32')]);_0xb8fb36[_0xd9a0('0x36')]=qs['filters'](_[_0xd9a0('0x49')](_0x470072[_0xd9a0('0x27')],_0x14e27e[_0xd9a0('0x2a')]));if(_0x470072[_0xd9a0('0x27')][_0xd9a0('0x37')]){_0xb8fb36['where']=_[_0xd9a0('0x35')](_0xb8fb36[_0xd9a0('0x36')],{'$or':_[_0xd9a0('0x38')](_0xb8fb36[_0xd9a0('0x2b')],function(_0x41dd59){var _0x174f46={};_0x174f46[_0x41dd59]={'$like':'%'+_0x470072['query'][_0xd9a0('0x37')]+'%'};return _0x174f46;})});}_0xb8fb36=_[_0xd9a0('0x35')]({},_0xb8fb36,_0x470072[_0xd9a0('0x39')]);return _0x5b49ae[_0xd9a0('0x7b')](_0xb8fb36);}})[_0xd9a0('0x21')](function(_0x12596e){if(_0x12596e){_0x76e734=_0x12596e['length'];if(!_0x470072[_0xd9a0('0x27')][_0xd9a0('0x2f')]('nolimit')){_0xb8fb36[_0xd9a0('0x1c')]=qs[_0xd9a0('0x1c')](_0x470072[_0xd9a0('0x27')][_0xd9a0('0x1c')]);_0xb8fb36[_0xd9a0('0x1b')]=qs[_0xd9a0('0x1b')](_0x470072[_0xd9a0('0x27')][_0xd9a0('0x1b')]);}return _0x5b49ae['getAgents'](_0xb8fb36);}})['then'](function(_0x3a083a){if(_0x3a083a){return _0x3a083a?{'count':_0x76e734,'rows':_0x3a083a}:null;}})['then'](respondWithResult(_0x3a8054,null))[_0xd9a0('0x3c')](handleError(_0x3a8054,null));}; \ No newline at end of file +var _0x007c=['isArray','push','CmContact','omit','dataValues','CmCustomField','concat','format','cf_%d','getContacts','getContactsCsv','CustomFields','raw','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','sendStatus','addCustomField','sequelize','transaction','addCustomFields','Sequelize','text','type','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','cf_%s','getCustomFields','findOne','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','userCmList:remove','emit','getAgents','User','fast-json-patch','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../mysqldb','./cmList.socket','register','status','end','json','count','offset','limit','Content-Range','reject','save','update','destroy','then','error','name','send','index','rawAttributes','model','keys','query','dateStart','filters','intersection','attributes','fields','length','nolimit','order','sort','where','dateEnd','add','day','merge','filter','options','CmList','includeAll','include','findAll','catch','show','params','find','create','body','describe','addDisposition','ListId','Disposition','hasOwnProperty','pick','map','rows','removeDispositions','ids','addContacts','tags'];(function(_0x3de13e,_0x57618c){var _0x304413=function(_0x208c2a){while(--_0x208c2a){_0x3de13e['push'](_0x3de13e['shift']());}};_0x304413(++_0x57618c);}(_0x007c,0x1ac));var _0xc007=function(_0x2aedbd,_0x2a73b2){_0x2aedbd=_0x2aedbd-0x0;var _0x272d73=_0x007c[_0x2aedbd];return _0x272d73;};'use strict';var jsonpatch=require(_0xc007('0x0'));var rp=require('request-promise');var moment=require(_0xc007('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc007('0x2'));var path=require(_0xc007('0x3'));var sox=require('sox');var csv=require(_0xc007('0x4'));var ejs=require(_0xc007('0x5'));var fs=require('fs');var _=require(_0xc007('0x6'));var squel=require(_0xc007('0x7'));var crypto=require(_0xc007('0x8'));var jsforce=require(_0xc007('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc007('0xa'));var Papa=require(_0xc007('0xb'));var qs=require(_0xc007('0xc'));var logger=require('../../config/logger')(_0xc007('0xd'));var utils=require(_0xc007('0xe'));var config=require('../../config/environment');var db=require(_0xc007('0xf'))['db'];var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0xc007('0x10'))[_0xc007('0x11')](socket);function respondWithStatusCode(_0x11d9cb,_0x4ac4d0){_0x4ac4d0=_0x4ac4d0||0xcc;return function(_0x21d49c){if(_0x21d49c){return _0x11d9cb['sendStatus'](_0x4ac4d0);}return _0x11d9cb[_0xc007('0x12')](_0x4ac4d0)[_0xc007('0x13')]();};}function respondWithResult(_0x4e473b,_0x27d967){_0x27d967=_0x27d967||0xc8;return function(_0x3349a9){if(_0x3349a9){return _0x4e473b[_0xc007('0x12')](_0x27d967)[_0xc007('0x14')](_0x3349a9);}};}function respondWithFilteredResult(_0x3520e7,_0x20e2a3){return function(_0x10e4a4){if(_0x10e4a4){var _0x31c086=_0x10e4a4[_0xc007('0x15')],_0x499217=_0x20e2a3[_0xc007('0x16')],_0x18fb2e=_0x20e2a3['offset']+_0x20e2a3[_0xc007('0x17')],_0x141f48;if(_0x18fb2e>=_0x31c086){_0x18fb2e=_0x31c086;_0x141f48=0xc8;}else{_0x141f48=0xce;}_0x3520e7[_0xc007('0x12')](_0x141f48);return _0x3520e7['set'](_0xc007('0x18'),_0x499217+'-'+_0x18fb2e+'/'+_0x31c086)[_0xc007('0x14')](_0x10e4a4);}return null;};}function patchUpdates(_0x57d45d){return function(_0x1e6c89){try{jsonpatch['apply'](_0x1e6c89,_0x57d45d,!![]);}catch(_0x4ee7ee){return BPromise[_0xc007('0x19')](_0x4ee7ee);}return _0x1e6c89[_0xc007('0x1a')]();};}function saveUpdates(_0x1128d8,_0xf8ab01){return function(_0x12335f){if(_0x12335f){return _0x12335f[_0xc007('0x1b')](_0x1128d8)['then'](function(_0x25f6d1){return _0x25f6d1;});}return null;};}function removeEntity(_0x521749,_0x2655b3){return function(_0x32f777){if(_0x32f777){return _0x32f777[_0xc007('0x1c')]()[_0xc007('0x1d')](function(){_0x521749[_0xc007('0x12')](0xcc)[_0xc007('0x13')]();});}};}function handleEntityNotFound(_0x4d7317,_0x1715e0){return function(_0x42d456){if(!_0x42d456){_0x4d7317['sendStatus'](0x194);}return _0x42d456;};}function handleError(_0x187cfc,_0x31c70a){_0x31c70a=_0x31c70a||0x1f4;return function(_0x2a7636){logger[_0xc007('0x1e')](_0x2a7636['stack']);if(_0x2a7636[_0xc007('0x1f')]){delete _0x2a7636[_0xc007('0x1f')];}_0x187cfc[_0xc007('0x12')](_0x31c70a)[_0xc007('0x20')](_0x2a7636);};}exports[_0xc007('0x21')]=function(_0x1c0922,_0x5422a8){var _0x206e7c={},_0x107736={},_0x1b3a8a={'count':0x0,'rows':[]};var _0x1aade2=db['CmList'][_0xc007('0x22')];_0x107736[_0xc007('0x23')]=_[_0xc007('0x24')](_0x1aade2);var _0x39009a={'dateStart':_0x1c0922[_0xc007('0x25')][_0xc007('0x26')],'dateEnd':_0x1c0922[_0xc007('0x25')]['dateEnd']};delete _0x1c0922[_0xc007('0x25')][_0xc007('0x26')];delete _0x1c0922[_0xc007('0x25')]['dateEnd'];_0x107736['query']=_['keys'](_0x1c0922['query']);_0x107736[_0xc007('0x27')]=_[_0xc007('0x28')](_0x107736[_0xc007('0x23')],_0x107736[_0xc007('0x25')]);_0x206e7c[_0xc007('0x29')]=_[_0xc007('0x28')](_0x107736[_0xc007('0x23')],qs['fields'](_0x1c0922['query'][_0xc007('0x2a')]));_0x206e7c[_0xc007('0x29')]=_0x206e7c['attributes'][_0xc007('0x2b')]?_0x206e7c[_0xc007('0x29')]:_0x107736[_0xc007('0x23')];if(!_0x1c0922['query']['hasOwnProperty'](_0xc007('0x2c'))){_0x206e7c[_0xc007('0x17')]=qs[_0xc007('0x17')](_0x1c0922[_0xc007('0x25')][_0xc007('0x17')]);_0x206e7c['offset']=qs[_0xc007('0x16')](_0x1c0922[_0xc007('0x25')][_0xc007('0x16')]);}_0x206e7c[_0xc007('0x2d')]=qs['sort'](_0x1c0922[_0xc007('0x25')][_0xc007('0x2e')]);_0x206e7c[_0xc007('0x2f')]=qs['filters'](_['pick'](_0x1c0922[_0xc007('0x25')],_0x107736['filters']));if(_0x39009a[_0xc007('0x26')]){if(_0x39009a[_0xc007('0x30')]){_0x39009a[_0xc007('0x30')]=moment(_0x39009a[_0xc007('0x30')])[_0xc007('0x31')](0x1,_0xc007('0x32'));}else{_0x39009a[_0xc007('0x30')]=moment(_0x39009a[_0xc007('0x26')])['add'](0x1,'day');}_[_0xc007('0x33')](_0x206e7c['where'],{'createdAt':{'$gte':_0x39009a[_0xc007('0x26')],'$lte':_0x39009a[_0xc007('0x30')]}});}if(_0x1c0922[_0xc007('0x25')][_0xc007('0x34')]){_0x206e7c[_0xc007('0x2f')]=_[_0xc007('0x33')](_0x206e7c[_0xc007('0x2f')],{'$or':_['map'](_0x206e7c['attributes'],function(_0x1f0990){var _0x13e4d9={};_0x13e4d9[_0x1f0990]={'$like':'%'+_0x1c0922['query'][_0xc007('0x34')]+'%'};return _0x13e4d9;})});}_0x206e7c=_['merge']({},_0x206e7c,_0x1c0922[_0xc007('0x35')]);var _0x3286d3={'where':_0x206e7c[_0xc007('0x2f')]};return db[_0xc007('0x36')][_0xc007('0x15')](_0x3286d3)[_0xc007('0x1d')](function(_0x2237e3){_0x1b3a8a[_0xc007('0x15')]=_0x2237e3;if(_0x1c0922[_0xc007('0x25')][_0xc007('0x37')]){_0x206e7c[_0xc007('0x38')]=[{'all':!![]}];}return db[_0xc007('0x36')][_0xc007('0x39')](_0x206e7c);})['then'](function(_0x205b1e){_0x1b3a8a['rows']=_0x205b1e;return _0x1b3a8a;})[_0xc007('0x1d')](respondWithFilteredResult(_0x5422a8,_0x206e7c))[_0xc007('0x3a')](handleError(_0x5422a8,null));};exports[_0xc007('0x3b')]=function(_0x3f9436,_0x51f01c){var _0x2a54bb={'raw':![],'where':{'id':_0x3f9436[_0xc007('0x3c')]['id']}},_0x344275={};_0x344275[_0xc007('0x23')]=_['keys'](db[_0xc007('0x36')][_0xc007('0x22')]);_0x344275[_0xc007('0x25')]=_['keys'](_0x3f9436[_0xc007('0x25')]);_0x344275[_0xc007('0x27')]=_[_0xc007('0x28')](_0x344275[_0xc007('0x23')],_0x344275[_0xc007('0x25')]);_0x2a54bb[_0xc007('0x29')]=_[_0xc007('0x28')](_0x344275[_0xc007('0x23')],qs['fields'](_0x3f9436[_0xc007('0x25')]['fields']));_0x2a54bb[_0xc007('0x29')]=_0x2a54bb[_0xc007('0x29')][_0xc007('0x2b')]?_0x2a54bb[_0xc007('0x29')]:_0x344275['model'];if(_0x3f9436['query'][_0xc007('0x37')]){_0x2a54bb[_0xc007('0x38')]=[{'all':!![]}];}_0x2a54bb=_[_0xc007('0x33')]({},_0x2a54bb,_0x3f9436[_0xc007('0x35')]);return db[_0xc007('0x36')][_0xc007('0x3d')](_0x2a54bb)[_0xc007('0x1d')](handleEntityNotFound(_0x51f01c,null))[_0xc007('0x1d')](respondWithResult(_0x51f01c,null))[_0xc007('0x3a')](handleError(_0x51f01c,null));};exports[_0xc007('0x3e')]=function(_0x497ff5,_0x49c90d){return db[_0xc007('0x36')]['create'](_0x497ff5[_0xc007('0x3f')],{})[_0xc007('0x1d')](respondWithResult(_0x49c90d,0xc9))['catch'](handleError(_0x49c90d,null));};exports[_0xc007('0x1b')]=function(_0xb7deed,_0x27a087){if(_0xb7deed['body']['id']){delete _0xb7deed[_0xc007('0x3f')]['id'];}return db[_0xc007('0x36')][_0xc007('0x3d')]({'where':{'id':_0xb7deed[_0xc007('0x3c')]['id']}})[_0xc007('0x1d')](handleEntityNotFound(_0x27a087,null))[_0xc007('0x1d')](saveUpdates(_0xb7deed[_0xc007('0x3f')],null))[_0xc007('0x1d')](respondWithResult(_0x27a087,null))[_0xc007('0x3a')](handleError(_0x27a087,null));};exports[_0xc007('0x1c')]=function(_0x4ec1d7,_0x279267){return db[_0xc007('0x36')][_0xc007('0x3d')]({'where':{'id':_0x4ec1d7[_0xc007('0x3c')]['id']}})[_0xc007('0x1d')](handleEntityNotFound(_0x279267,null))[_0xc007('0x1d')](removeEntity(_0x279267,null))[_0xc007('0x3a')](handleError(_0x279267,null));};exports[_0xc007('0x40')]=function(_0x2d3fd8,_0x553d36){return db[_0xc007('0x36')]['describe']()['then'](respondWithResult(_0x553d36,null))[_0xc007('0x3a')](handleError(_0x553d36,null));};exports[_0xc007('0x41')]=function(_0x103b30,_0x5e22d9,_0x13250c){if(_0x103b30[_0xc007('0x3f')]['id']){delete _0x103b30['body']['id'];}return db[_0xc007('0x36')][_0xc007('0x3d')]({'where':{'id':_0x103b30[_0xc007('0x3c')]['id']}})[_0xc007('0x1d')](handleEntityNotFound(_0x5e22d9,null))[_0xc007('0x1d')](function(_0x49ead3){if(_0x49ead3){_0x103b30[_0xc007('0x3f')][_0xc007('0x42')]=_0x49ead3['id'];return db[_0xc007('0x43')][_0xc007('0x3e')](_0x103b30[_0xc007('0x3f')]);}})[_0xc007('0x1d')](respondWithResult(_0x5e22d9,null))[_0xc007('0x3a')](handleError(_0x5e22d9,null));};exports['getDispositions']=function(_0x20e951,_0x1c1bb6,_0x5c002f){var _0x1799ab={'raw':![],'where':{}};var _0x385210={};var _0xa51ea5={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x20e951['params']['id']}})['then'](handleEntityNotFound(_0x1c1bb6,null))[_0xc007('0x1d')](function(_0x4574ee){if(_0x4574ee){_0x385210[_0xc007('0x23')]=_[_0xc007('0x24')](db[_0xc007('0x43')][_0xc007('0x22')]);_0x385210[_0xc007('0x25')]=_[_0xc007('0x24')](_0x20e951[_0xc007('0x25')]);_0x385210[_0xc007('0x27')]=_[_0xc007('0x28')](_0x385210[_0xc007('0x23')],_0x385210['query']);_0x1799ab[_0xc007('0x29')]=_['intersection'](_0x385210[_0xc007('0x23')],qs[_0xc007('0x2a')](_0x20e951['query'][_0xc007('0x2a')]));_0x1799ab['attributes']=_0x1799ab[_0xc007('0x29')]['length']?_0x1799ab[_0xc007('0x29')]:_0x385210['model'];if(!_0x20e951[_0xc007('0x25')][_0xc007('0x44')](_0xc007('0x2c'))){_0x1799ab[_0xc007('0x17')]=qs[_0xc007('0x17')](_0x20e951[_0xc007('0x25')]['limit']);_0x1799ab[_0xc007('0x16')]=qs['offset'](_0x20e951[_0xc007('0x25')][_0xc007('0x16')]);}_0x1799ab[_0xc007('0x2d')]=qs[_0xc007('0x2e')](_0x20e951[_0xc007('0x25')][_0xc007('0x2e')]);_0x1799ab[_0xc007('0x2f')]=qs[_0xc007('0x27')](_[_0xc007('0x45')](_0x20e951['query'],_0x385210[_0xc007('0x27')]));_0x1799ab[_0xc007('0x2f')][_0xc007('0x42')]=_0x4574ee['id'];if(_0x20e951[_0xc007('0x25')][_0xc007('0x34')]){_0x1799ab[_0xc007('0x2f')]=_[_0xc007('0x33')](_0x1799ab[_0xc007('0x2f')],{'$or':_[_0xc007('0x46')](_0x1799ab[_0xc007('0x29')],function(_0x1beaad){var _0x21cc67={};_0x21cc67[_0x1beaad]={'$like':'%'+_0x20e951['query'][_0xc007('0x34')]+'%'};return _0x21cc67;})});}_0x1799ab=_[_0xc007('0x33')]({},_0x1799ab,_0x20e951[_0xc007('0x35')]);return db[_0xc007('0x43')]['count']({'where':_0x1799ab[_0xc007('0x2f')]})[_0xc007('0x1d')](function(_0x2aa934){_0xa51ea5[_0xc007('0x15')]=_0x2aa934;if(_0x20e951['query'][_0xc007('0x37')]){_0x1799ab[_0xc007('0x38')]=[{'all':!![]}];}return db[_0xc007('0x43')][_0xc007('0x39')](_0x1799ab);})[_0xc007('0x1d')](function(_0x11198f){_0xa51ea5[_0xc007('0x47')]=_0x11198f;return _0xa51ea5;});}})[_0xc007('0x1d')](respondWithFilteredResult(_0x1c1bb6,_0x1799ab))[_0xc007('0x3a')](handleError(_0x1c1bb6,null));};exports['removeDispositions']=function(_0x337345,_0x4a7e45,_0x46a2ef){var _0x399ffc;return db[_0xc007('0x36')][_0xc007('0x3d')]({'where':{'id':_0x337345['params']['id']}})['then'](handleEntityNotFound(_0x4a7e45,null))[_0xc007('0x1d')](function(_0xeb0bfa){if(_0xeb0bfa){return _0xeb0bfa[_0xc007('0x48')](_0x337345[_0xc007('0x25')][_0xc007('0x49')]);}})[_0xc007('0x1d')](respondWithStatusCode(_0x4a7e45,null))[_0xc007('0x3a')](handleError(_0x4a7e45,null));};exports[_0xc007('0x4a')]=function(_0x4d49a4,_0x1a05da,_0x1e6e41){return db[_0xc007('0x36')][_0xc007('0x3d')]({'where':{'id':_0x4d49a4['params']['id']}})[_0xc007('0x1d')](handleEntityNotFound(_0x1a05da,null))['then'](function(_0x35ae83){if(_0x35ae83){var _0xdc1e3d=[];var _0x233c03={'success':[],'errors':[]};return db['CmContact'][_0xc007('0x40')]()[_0xc007('0x1d')](function(_0x166c29){if(_0x4d49a4['body'][_0xc007('0x4b')]&&_[_0xc007('0x4c')](_0x4d49a4['body'][_0xc007('0x4b')])){if(_0x4d49a4['body']['tags'][_0xc007('0x2b')]){_0x4d49a4['body'][_0xc007('0x4b')]=_0x4d49a4[_0xc007('0x3f')][_0xc007('0x4b')]['join'](';')+';';}else{_0x4d49a4[_0xc007('0x3f')]['tags']=null;}}else{_0x4d49a4[_0xc007('0x3f')][_0xc007('0x4b')]=null;}if(_0x4d49a4[_0xc007('0x3f')]&&_['isArray'](_0x4d49a4[_0xc007('0x3f')])){for(var _0x44aa26=0x0;_0x44aa26<_0x4d49a4['body'][_0xc007('0x2b')];_0x44aa26+=0x1){_0x4d49a4[_0xc007('0x3f')][_0x44aa26][_0xc007('0x42')]=_0x4d49a4[_0xc007('0x3c')]['id'];_0xdc1e3d[_0xc007('0x4d')](_0x4d49a4[_0xc007('0x3f')][_0x44aa26]);}return BPromise['each'](_0xdc1e3d,function(_0x2831b4){return db[_0xc007('0x4e')]['create'](_[_0xc007('0x4f')](_0x2831b4,[_0xc007('0x49'),'id'])||{},{'fields':_[_0xc007('0x24')](_0x166c29),'raw':!![]})[_0xc007('0x1d')](function(_0x278687){_0x233c03['success']['push'](_0x278687[_0xc007('0x50')]);})['catch'](function(_0x300cf4){_0x233c03['errors'][_0xc007('0x4d')]({'data':_0x2831b4,'error':_0x300cf4['message']});});})[_0xc007('0x1d')](function(_0x98216c){return _0x233c03;})[_0xc007('0x3a')](function(_0x46457d){return _0x46457d;});}else{_0x1a05da['status'](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x1a05da,null))['catch'](handleError(_0x1a05da,null));};exports['getContacts']=function(_0x159f0d,_0x3653a6,_0x153bab){var _0x24bbc9;return db[_0xc007('0x36')][_0xc007('0x3d')]({'where':{'id':_0x159f0d[_0xc007('0x3c')]['id']},'include':[{'model':db[_0xc007('0x51')],'as':'CustomFields'}]})[_0xc007('0x1d')](handleEntityNotFound(_0x3653a6,null))[_0xc007('0x1d')](function(_0x1d7a00){if(_0x1d7a00){_0x24bbc9=_0x1d7a00;return db['CmContact']['rawAttributes'];}})[_0xc007('0x1d')](function(_0x250588){if(_0x250588){var _0x488f71={};var _0x2cec83={};_0x2cec83[_0xc007('0x23')]=_[_0xc007('0x52')](_[_0xc007('0x24')](_0x250588),_['map'](_0x24bbc9['CustomFields'],function(_0x5c9c16){return util[_0xc007('0x53')](_0xc007('0x54'),_0x5c9c16['id']);}));_0x2cec83['query']=_['keys'](_0x159f0d[_0xc007('0x25')]);_0x2cec83['filters']=_[_0xc007('0x28')](_0x2cec83[_0xc007('0x23')],_0x2cec83[_0xc007('0x25')]);_0x488f71['attributes']=_['intersection'](_0x2cec83[_0xc007('0x23')],qs['fields'](_0x159f0d[_0xc007('0x25')]['fields']));_0x488f71[_0xc007('0x29')]=_0x488f71[_0xc007('0x29')][_0xc007('0x2b')]?_0x488f71[_0xc007('0x29')]:_0x2cec83[_0xc007('0x23')];if(!_0x159f0d[_0xc007('0x25')]['hasOwnProperty'](_0xc007('0x2c'))){_0x488f71[_0xc007('0x17')]=qs[_0xc007('0x17')](_0x159f0d[_0xc007('0x25')][_0xc007('0x17')]);_0x488f71[_0xc007('0x16')]=qs[_0xc007('0x16')](_0x159f0d[_0xc007('0x25')][_0xc007('0x16')]);}_0x488f71[_0xc007('0x2d')]=qs[_0xc007('0x2e')](_0x159f0d[_0xc007('0x25')]['sort']);_0x488f71[_0xc007('0x2f')]=qs[_0xc007('0x27')](_[_0xc007('0x45')](_0x159f0d['query'],_0x2cec83[_0xc007('0x27')]));_0x488f71['raw']=!![];if(_0x159f0d[_0xc007('0x25')]['filter']){_0x488f71[_0xc007('0x2f')]=_['merge'](_0x488f71[_0xc007('0x2f')],{'$or':_[_0xc007('0x46')](_0x488f71[_0xc007('0x29')],function(_0x3800ef){var _0x10c343={};_0x10c343[_0x3800ef]={'$like':'%'+_0x159f0d[_0xc007('0x25')]['filter']+'%'};return _0x10c343;})});}_0x488f71=_[_0xc007('0x33')]({},_0x488f71,_0x159f0d[_0xc007('0x35')]);return _0x24bbc9[_0xc007('0x55')](_0x488f71);}})[_0xc007('0x1d')](respondWithResult(_0x3653a6,null))[_0xc007('0x3a')](handleError(_0x3653a6,null));};exports[_0xc007('0x56')]=function(_0x30977c,_0xa7fe38,_0x1c87ed){var _0x31ccd6;return db['CmList'][_0xc007('0x3d')]({'where':{'id':_0x30977c[_0xc007('0x3c')]['id']},'include':[{'model':db[_0xc007('0x51')],'as':_0xc007('0x57')}]})['then'](handleEntityNotFound(_0xa7fe38,null))[_0xc007('0x1d')](function(_0x312a36){if(_0x312a36){_0x31ccd6=_0x312a36;return db[_0xc007('0x4e')][_0xc007('0x22')];}})[_0xc007('0x1d')](function(_0x2dc102){if(_0x2dc102){var _0x986e2d={};var _0x5dfb3c={};_0x5dfb3c[_0xc007('0x23')]=_[_0xc007('0x52')](_[_0xc007('0x24')](_0x2dc102),_[_0xc007('0x46')](_0x31ccd6[_0xc007('0x57')],function(_0x1b7e3e){return util[_0xc007('0x53')]('cf_%d',_0x1b7e3e['id']);}));_0x5dfb3c['query']=_[_0xc007('0x24')](_0x30977c[_0xc007('0x25')]);_0x5dfb3c['filters']=_[_0xc007('0x28')](_0x5dfb3c['model'],_0x5dfb3c[_0xc007('0x25')]);_0x986e2d[_0xc007('0x29')]=_['intersection'](_0x5dfb3c[_0xc007('0x23')],qs[_0xc007('0x2a')](_0x30977c[_0xc007('0x25')]['fields']));_0x986e2d['attributes']=_0x986e2d['attributes']['length']?_0x986e2d['attributes']:_0x5dfb3c[_0xc007('0x23')];if(!_0x30977c[_0xc007('0x25')][_0xc007('0x44')](_0xc007('0x2c'))){_0x986e2d[_0xc007('0x17')]=qs[_0xc007('0x17')](_0x30977c[_0xc007('0x25')][_0xc007('0x17')]);_0x986e2d[_0xc007('0x16')]=qs[_0xc007('0x16')](_0x30977c[_0xc007('0x25')][_0xc007('0x16')]);}_0x986e2d[_0xc007('0x2d')]=qs[_0xc007('0x2e')](_0x30977c[_0xc007('0x25')]['sort']);_0x986e2d[_0xc007('0x2f')]=qs[_0xc007('0x27')](_['pick'](_0x30977c['query'],_0x5dfb3c[_0xc007('0x27')]));_0x986e2d[_0xc007('0x58')]=!![];if(_0x30977c[_0xc007('0x25')][_0xc007('0x34')]){_0x986e2d['where']=_[_0xc007('0x33')](_0x986e2d['where'],{'$or':_['map'](_0x986e2d['attributes'],function(_0x1c30d6){var _0x5b198a={};_0x5b198a[_0x1c30d6]={'$like':'%'+_0x30977c[_0xc007('0x25')][_0xc007('0x34')]+'%'};return _0x5b198a;})});}_0x986e2d=_[_0xc007('0x33')]({},_0x986e2d,_0x30977c[_0xc007('0x35')]);return _0x31ccd6[_0xc007('0x55')](_0x986e2d);}})['then'](function(_0xebe16c){if(!_[_0xc007('0x59')](_0xebe16c)){var _0x1b63b5=toCsv(_0xebe16c);var _0x2dc7d3=Date[_0xc007('0x5a')]();fs[_0xc007('0x5b')](util['format'](_0xc007('0x5c'),_0x31ccd6['id'],_0x2dc7d3),_0x1b63b5);_0xa7fe38[_0xc007('0x5d')](_0xc007('0x5e'),_0xc007('0x5f')+util[_0xc007('0x53')](_0xc007('0x60'),_0x31ccd6['id'],_0x2dc7d3));_0xa7fe38[_0xc007('0x5d')](_0xc007('0x61'),_0xc007('0x62'));return _0xa7fe38[_0xc007('0x63')](util[_0xc007('0x53')](_0xc007('0x5c'),_0x31ccd6['id'],_0x2dc7d3));}else{return _0xa7fe38[_0xc007('0x64')](0xcc);}})['catch'](handleError(_0xa7fe38,null));};exports[_0xc007('0x65')]=function(_0x529505,_0x57efdc,_0x12a5f6){var _0x1889b7;delete _0x529505[_0xc007('0x3f')]['id'];return db[_0xc007('0x36')]['findOne']({'where':{'id':_0x529505[_0xc007('0x3c')]['id']}})[_0xc007('0x1d')](handleEntityNotFound(_0x57efdc,null))[_0xc007('0x1d')](function(_0x529e39){if(_0x529e39){return db[_0xc007('0x66')][_0xc007('0x67')](function(_0x3d52bf){return db[_0xc007('0x51')][_0xc007('0x3e')](_0x529505['body'],{'transaction':_0x3d52bf})[_0xc007('0x1d')](function(_0x22316c){_0x1889b7=_0x22316c;return _0x529e39[_0xc007('0x68')](_0x22316c,{'transaction':_0x3d52bf});})['then'](function(){var _0x44434c={'type':db[_0xc007('0x69')]['TEXT'],'transaction':_0x3d52bf};switch(_0x529505[_0xc007('0x3f')]['type']){case _0xc007('0x6a'):_0x44434c[_0xc007('0x6b')]=db['Sequelize']['TEXT'];break;case'number':_0x44434c[_0xc007('0x6b')]=db[_0xc007('0x69')][_0xc007('0x6c')];break;case _0xc007('0x6d'):_0x44434c[_0xc007('0x6b')]=db[_0xc007('0x69')][_0xc007('0x6e')];_0x44434c[_0xc007('0x6f')]=![];break;default:}return db[_0xc007('0x66')][_0xc007('0x70')]['addColumn'](_0xc007('0x71'),util[_0xc007('0x53')](_0xc007('0x72'),_0x1889b7['id']),_0x44434c);})[_0xc007('0x1d')](function(){return _0x1889b7;});});}})[_0xc007('0x1d')](respondWithResult(_0x57efdc,null))[_0xc007('0x3a')](handleError(_0x57efdc,null));};exports[_0xc007('0x73')]=function(_0x1cc908,_0x5f1319,_0x99ec14){var _0x1afe27={};var _0x414184={};var _0x37ac32;var _0x3fd7e3;return db[_0xc007('0x36')][_0xc007('0x74')]({'where':{'id':_0x1cc908[_0xc007('0x3c')]['id']}})[_0xc007('0x1d')](handleEntityNotFound(_0x5f1319,null))[_0xc007('0x1d')](function(_0x56792b){if(_0x56792b){_0x37ac32=_0x56792b;_0x414184[_0xc007('0x23')]=_['keys'](db[_0xc007('0x51')]['rawAttributes']);_0x414184[_0xc007('0x25')]=_[_0xc007('0x24')](_0x1cc908['query']);_0x414184[_0xc007('0x27')]=_[_0xc007('0x28')](_0x414184[_0xc007('0x23')],_0x414184['query']);_0x1afe27[_0xc007('0x29')]=_[_0xc007('0x28')](_0x414184[_0xc007('0x23')],qs[_0xc007('0x2a')](_0x1cc908[_0xc007('0x25')][_0xc007('0x2a')]));_0x1afe27[_0xc007('0x29')]=_0x1afe27[_0xc007('0x29')][_0xc007('0x2b')]?_0x1afe27[_0xc007('0x29')]:_0x414184[_0xc007('0x23')];_0x1afe27[_0xc007('0x2d')]=qs[_0xc007('0x2e')](_0x1cc908[_0xc007('0x25')][_0xc007('0x2e')]);_0x1afe27[_0xc007('0x2f')]=qs[_0xc007('0x27')](_['pick'](_0x1cc908[_0xc007('0x25')],_0x414184[_0xc007('0x27')]));_0x1afe27[_0xc007('0x2f')]=_[_0xc007('0x33')](_0x1afe27[_0xc007('0x2f')],{'$or':[{'ListId':_0x56792b['id']},{'ListId':null}]});if(_0x1cc908[_0xc007('0x25')][_0xc007('0x34')]){_0x1afe27['where']=_[_0xc007('0x33')](_0x1afe27[_0xc007('0x2f')],{'$or':_[_0xc007('0x46')](_0x1afe27['attributes'],function(_0x192e6c){var _0x270522={};_0x270522[_0x192e6c]={'$like':'%'+_0x1cc908[_0xc007('0x25')][_0xc007('0x34')]+'%'};return _0x270522;})});}_0x1afe27=_[_0xc007('0x33')]({},_0x1afe27,_0x1cc908[_0xc007('0x35')]);return db['CmCustomField'][_0xc007('0x75')](_0x1afe27);}})['then'](respondWithResult(_0x5f1319,null))['catch'](handleError(_0x5f1319,null));};exports['addAgents']=function(_0x3bc078,_0x1a7153,_0x46ef21){return db[_0xc007('0x36')][_0xc007('0x3d')]({'where':{'id':_0x3bc078[_0xc007('0x3c')]['id']}})[_0xc007('0x1d')](handleEntityNotFound(_0x1a7153,null))[_0xc007('0x1d')](function(_0x54f084){if(_0x54f084){return _0x54f084[_0xc007('0x76')](_0x3bc078[_0xc007('0x3f')]['ids'],_['omit'](_0x3bc078[_0xc007('0x3f')],[_0xc007('0x49'),'id'])||{})[_0xc007('0x77')](function(_0x215752){for(var _0x3fac24=0x0;_0x3fac24<_0x3bc078['body'][_0xc007('0x49')][_0xc007('0x2b')];_0x3fac24+=0x1){socket['emit'](_0xc007('0x78'),{'UserId':_0x3bc078[_0xc007('0x3f')][_0xc007('0x49')][_0x3fac24],'CmListId':_0x3bc078[_0xc007('0x3c')]['id']});}return _0x215752;});}})[_0xc007('0x1d')](respondWithResult(_0x1a7153,null))[_0xc007('0x3a')](handleError(_0x1a7153,null));};exports[_0xc007('0x79')]=function(_0x3542f7,_0x47b4ea,_0x414069){var _0xd67654;return db[_0xc007('0x36')][_0xc007('0x3d')]({'where':{'id':_0x3542f7[_0xc007('0x3c')]['id']}})[_0xc007('0x1d')](handleEntityNotFound(_0x47b4ea,null))['then'](function(_0x5c94af){if(_0x5c94af){return _0x5c94af[_0xc007('0x79')](_0x3542f7['query']['ids'])[_0xc007('0x1d')](function(_0x1dd545){if(_[_0xc007('0x4c')](_0x3542f7['query'][_0xc007('0x49')])){for(var _0x3f3fe5=0x0;_0x3f3fe5<_0x3542f7[_0xc007('0x25')]['ids'][_0xc007('0x2b')];_0x3f3fe5+=0x1){socket['emit'](_0xc007('0x7a'),{'UserId':_0x3542f7[_0xc007('0x25')]['ids'][_0x3f3fe5],'CmListId':_0x3542f7[_0xc007('0x3c')]['id']});}}else{socket[_0xc007('0x7b')]('userCmList:remove',{'UserId':_0x3542f7[_0xc007('0x25')][_0xc007('0x49')],'CmListId':_0x3542f7[_0xc007('0x3c')]['id']});}});}})[_0xc007('0x1d')](respondWithStatusCode(_0x47b4ea,null))[_0xc007('0x3a')](handleError(_0x47b4ea,null));};exports[_0xc007('0x7c')]=function(_0x3f232a,_0x2e7bbb,_0x359f85){var _0x4949d7={};var _0xa4256b={};var _0x94028b;var _0x697652;return db[_0xc007('0x36')][_0xc007('0x74')]({'where':{'id':_0x3f232a['params']['id']}})[_0xc007('0x1d')](handleEntityNotFound(_0x2e7bbb,null))[_0xc007('0x1d')](function(_0x4c1276){if(_0x4c1276){_0x94028b=_0x4c1276;_0xa4256b[_0xc007('0x23')]=_['keys'](db[_0xc007('0x7d')][_0xc007('0x22')]);_0xa4256b[_0xc007('0x25')]=_['keys'](_0x3f232a['query']);_0xa4256b[_0xc007('0x27')]=_[_0xc007('0x28')](_0xa4256b[_0xc007('0x23')],_0xa4256b[_0xc007('0x25')]);_0x4949d7['attributes']=_[_0xc007('0x28')](_0xa4256b[_0xc007('0x23')],qs[_0xc007('0x2a')](_0x3f232a[_0xc007('0x25')]['fields']));_0x4949d7['attributes']=_0x4949d7[_0xc007('0x29')][_0xc007('0x2b')]?_0x4949d7[_0xc007('0x29')]:_0xa4256b['model'];_0x4949d7[_0xc007('0x2d')]=qs[_0xc007('0x2e')](_0x3f232a[_0xc007('0x25')]['sort']);_0x4949d7[_0xc007('0x2f')]=qs[_0xc007('0x27')](_[_0xc007('0x45')](_0x3f232a[_0xc007('0x25')],_0xa4256b[_0xc007('0x27')]));if(_0x3f232a[_0xc007('0x25')][_0xc007('0x34')]){_0x4949d7['where']=_[_0xc007('0x33')](_0x4949d7[_0xc007('0x2f')],{'$or':_[_0xc007('0x46')](_0x4949d7['attributes'],function(_0x2f76f2){var _0x57b5af={};_0x57b5af[_0x2f76f2]={'$like':'%'+_0x3f232a[_0xc007('0x25')][_0xc007('0x34')]+'%'};return _0x57b5af;})});}_0x4949d7=_[_0xc007('0x33')]({},_0x4949d7,_0x3f232a[_0xc007('0x35')]);return _0x94028b[_0xc007('0x7c')](_0x4949d7);}})[_0xc007('0x1d')](function(_0x59d2b0){if(_0x59d2b0){_0x697652=_0x59d2b0['length'];if(!_0x3f232a[_0xc007('0x25')][_0xc007('0x44')]('nolimit')){_0x4949d7[_0xc007('0x17')]=qs[_0xc007('0x17')](_0x3f232a['query'][_0xc007('0x17')]);_0x4949d7[_0xc007('0x16')]=qs[_0xc007('0x16')](_0x3f232a[_0xc007('0x25')][_0xc007('0x16')]);}return _0x94028b[_0xc007('0x7c')](_0x4949d7);}})['then'](function(_0x36d055){if(_0x36d055){return _0x36d055?{'count':_0x697652,'rows':_0x36d055}:null;}})['then'](respondWithResult(_0x2e7bbb,null))['catch'](handleError(_0x2e7bbb,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index d02c128..073f5b2 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 _0xdf1a=['../../mysqldb','CmList','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0x1e76e8,_0x41ec55){var _0x2d7a1f=function(_0x15a0bd){while(--_0x15a0bd){_0x1e76e8['push'](_0x1e76e8['shift']());}};_0x2d7a1f(++_0x41ec55);}(_0xdf1a,0x8f));var _0xadf1=function(_0x515afd,_0x1a1e91){_0x515afd=_0x515afd-0x0;var _0x536d53=_0xdf1a[_0x515afd];return _0x536d53;};'use strict';var EventEmitter=require(_0xadf1('0x0'));var CmList=require(_0xadf1('0x1'))['db'][_0xadf1('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xadf1('0x3')](0x0);var events={'afterCreate':_0xadf1('0x4'),'afterUpdate':_0xadf1('0x5'),'afterDestroy':_0xadf1('0x6')};function emitEvent(_0x352a60){return function(_0x55aa8,_0x338699,_0x3dfa8d){CmListEvents[_0xadf1('0x7')](_0x352a60+':'+_0x55aa8['id'],_0x55aa8);CmListEvents[_0xadf1('0x7')](_0x352a60,_0x55aa8);_0x3dfa8d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0xadf1('0x8')]=CmListEvents; \ No newline at end of file +var _0x72b8=['CmList','remove','emit','hook','events','../../mysqldb'];(function(_0x5708c1,_0x5e6e0e){var _0xf0a659=function(_0x3a09e3){while(--_0x3a09e3){_0x5708c1['push'](_0x5708c1['shift']());}};_0xf0a659(++_0x5e6e0e);}(_0x72b8,0xd0));var _0x872b=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x72b8[_0x1d1779];return _0x2377e9;};'use strict';var EventEmitter=require(_0x872b('0x0'));var CmList=require(_0x872b('0x1'))['db'][_0x872b('0x2')];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x872b('0x3')};function emitEvent(_0x3072d7){return function(_0xa4ed39,_0x18b5e4,_0x32a385){CmListEvents[_0x872b('0x4')](_0x3072d7+':'+_0xa4ed39['id'],_0xa4ed39);CmListEvents['emit'](_0x3072d7,_0xa4ed39);_0x32a385(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x872b('0x5')](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 d8a2629..6c3a388 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 _0x7297=['request-promise','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util','moment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7297,0x180));var _0x7729=function(_0x2ae076,_0x3edab3){_0x2ae076=_0x2ae076-0x0;var _0xa4da77=_0x7297[_0x2ae076];return _0xa4da77;};'use strict';var _=require(_0x7729('0x0'));var util=require(_0x7729('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7729('0x2'));var BPromise=require('bluebird');var rp=require(_0x7729('0x3'));var attributes=require(_0x7729('0x4'));module[_0x7729('0x5')]=function(_0x26ad47,_0x2ee7ac){return _0x26ad47[_0x7729('0x6')](_0x7729('0x7'),attributes,{'tableName':_0x7729('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd85e=['cm_lists','util','api','bluebird','request-promise','./cmList.attributes','define','CmList'];(function(_0x1e99bc,_0x3a0006){var _0x281232=function(_0x11c8cb){while(--_0x11c8cb){_0x1e99bc['push'](_0x1e99bc['shift']());}};_0x281232(++_0x3a0006);}(_0xd85e,0x1c1));var _0xed85=function(_0x36dd76,_0x22f39e){_0x36dd76=_0x36dd76-0x0;var _0x5d7968=_0xd85e[_0x36dd76];return _0x5d7968;};'use strict';var _=require('lodash');var util=require(_0xed85('0x0'));var logger=require('../../config/logger')(_0xed85('0x1'));var moment=require('moment');var BPromise=require(_0xed85('0x2'));var rp=require(_0xed85('0x3'));var attributes=require(_0xed85('0x4'));module['exports']=function(_0x1439e4,_0x4d65d3){return _0x1439e4[_0xed85('0x5')](_0xed85('0x6'),attributes,{'tableName':_0xed85('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index ed8ca3f..ae3b045 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 _0x74ae=['stringify','error','code','CmList,\x20%s,\x20%s','message','result','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','localhost','./cmList.socket','register','request','then','info','request\x20sent','CmList,\x20%s,\x20%s,\x20%s'];(function(_0x429fe,_0x18ea96){var _0x4052e3=function(_0xc09b93){while(--_0xc09b93){_0x429fe['push'](_0x429fe['shift']());}};_0x4052e3(++_0x18ea96);}(_0x74ae,0x15f));var _0xe74a=function(_0x2ebce5,_0x4d089a){_0x2ebce5=_0x2ebce5-0x0;var _0x2173cf=_0x74ae[_0x2ebce5];return _0x2173cf;};'use strict';var _=require('lodash');var util=require(_0xe74a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe74a('0x1'));var fs=require('fs');var db=require(_0xe74a('0x2'))['db'];var utils=require(_0xe74a('0x3'));var logger=require(_0xe74a('0x4'))(_0xe74a('0x5'));var config=require(_0xe74a('0x6'));var jayson=require(_0xe74a('0x7'));var client=jayson[_0xe74a('0x8')]['http']({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0xe74a('0x9'),'port':0x18eb});require(_0xe74a('0xa'))[_0xe74a('0xb')](socket);function respondWithRpcPromise(_0x3da312,_0x186b58,_0x518d2b){return new BPromise(function(_0x16232d,_0x50743f){return client[_0xe74a('0xc')](_0x3da312,_0x518d2b)[_0xe74a('0xd')](function(_0x1bbd1e){logger[_0xe74a('0xe')]('CmList,\x20%s,\x20%s',_0x186b58,_0xe74a('0xf'));logger['debug'](_0xe74a('0x10'),_0x186b58,_0xe74a('0xf'),JSON[_0xe74a('0x11')](_0x1bbd1e));if(_0x1bbd1e[_0xe74a('0x12')]){if(_0x1bbd1e[_0xe74a('0x12')][_0xe74a('0x13')]===0x1f4){logger[_0xe74a('0x12')](_0xe74a('0x14'),_0x186b58,_0x1bbd1e[_0xe74a('0x12')]['message']);return _0x50743f(_0x1bbd1e[_0xe74a('0x12')][_0xe74a('0x15')]);}logger[_0xe74a('0x12')]('CmList,\x20%s,\x20%s',_0x186b58,_0x1bbd1e[_0xe74a('0x12')][_0xe74a('0x15')]);return _0x16232d(_0x1bbd1e[_0xe74a('0x12')][_0xe74a('0x15')]);}else{logger[_0xe74a('0xe')]('CmList,\x20%s,\x20%s',_0x186b58,_0xe74a('0xf'));_0x16232d(_0x1bbd1e[_0xe74a('0x16')][_0xe74a('0x15')]);}})['catch'](function(_0x3c901f){logger[_0xe74a('0x12')](_0xe74a('0x14'),_0x186b58,_0x3c901f);_0x50743f(_0x3c901f);});});} \ No newline at end of file +var _0x812d=['then','info','CmList,\x20%s,\x20%s','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','localhost','./cmList.socket'];(function(_0x54128a,_0x128d4d){var _0x6b9354=function(_0x21e0b8){while(--_0x21e0b8){_0x54128a['push'](_0x54128a['shift']());}};_0x6b9354(++_0x128d4d);}(_0x812d,0x107));var _0xd812=function(_0x23d87b,_0x2c6a45){_0x23d87b=_0x23d87b-0x0;var _0x47bbab=_0x812d[_0x23d87b];return _0x47bbab;};'use strict';var _=require(_0xd812('0x0'));var util=require(_0xd812('0x1'));var moment=require(_0xd812('0x2'));var BPromise=require(_0xd812('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xd812('0x4'))['db'];var utils=require(_0xd812('0x5'));var logger=require(_0xd812('0x6'))(_0xd812('0x7'));var config=require(_0xd812('0x8'));var jayson=require(_0xd812('0x9'));var client=jayson['client'][_0xd812('0xa')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0xd812('0xb'),'port':0x18eb});require(_0xd812('0xc'))['register'](socket);function respondWithRpcPromise(_0x3ff19b,_0x4a848c,_0x1f1d0a){return new BPromise(function(_0x37bfa1,_0x3851b8){return client['request'](_0x3ff19b,_0x1f1d0a)[_0xd812('0xd')](function(_0x1e1fd6){logger[_0xd812('0xe')](_0xd812('0xf'),_0x4a848c,'request\x20sent');logger['debug'](_0xd812('0x10'),_0x4a848c,_0xd812('0x11'),JSON[_0xd812('0x12')](_0x1e1fd6));if(_0x1e1fd6['error']){if(_0x1e1fd6['error'][_0xd812('0x13')]===0x1f4){logger['error'](_0xd812('0xf'),_0x4a848c,_0x1e1fd6[_0xd812('0x14')]['message']);return _0x3851b8(_0x1e1fd6[_0xd812('0x14')][_0xd812('0x15')]);}logger[_0xd812('0x14')](_0xd812('0xf'),_0x4a848c,_0x1e1fd6['error'][_0xd812('0x15')]);return _0x37bfa1(_0x1e1fd6['error'][_0xd812('0x15')]);}else{logger[_0xd812('0xe')](_0xd812('0xf'),_0x4a848c,_0xd812('0x11'));_0x37bfa1(_0x1e1fd6['result'][_0xd812('0x15')]);}})[_0xd812('0x16')](function(_0x445d13){logger[_0xd812('0x14')](_0xd812('0xf'),_0x4a848c,_0x445d13);_0x3851b8(_0x445d13);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index ca59805..b2502e5 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 _0x20bd=['length','cmList:','./cmList.events','remove','update','emit','register'];(function(_0x4803d7,_0xcacf36){var _0x1bc64d=function(_0x2af553){while(--_0x2af553){_0x4803d7['push'](_0x4803d7['shift']());}};_0x1bc64d(++_0xcacf36);}(_0x20bd,0xfe));var _0xd20b=function(_0x4af65b,_0x18d3f0){_0x4af65b=_0x4af65b-0x0;var _0x582787=_0x20bd[_0x4af65b];return _0x582787;};'use strict';var CmListEvents=require(_0xd20b('0x0'));var events=['save',_0xd20b('0x1'),_0xd20b('0x2')];function createListener(_0x16dc9c,_0x399dad){return function(_0x30a7d4){_0x399dad[_0xd20b('0x3')](_0x16dc9c,_0x30a7d4);};}function removeListener(_0x2c7377,_0x2c1740){return function(){CmListEvents['removeListener'](_0x2c7377,_0x2c1740);};}exports[_0xd20b('0x4')]=function(_0x49f2b3){for(var _0x430735=0x0,_0x27f415=events[_0xd20b('0x5')];_0x430735<_0x27f415;_0x430735++){var _0x1dce88=events[_0x430735];var _0x3198d1=createListener(_0xd20b('0x6')+_0x1dce88,_0x49f2b3);CmListEvents['on'](_0x1dce88,_0x3198d1);}}; \ No newline at end of file +var _0x98f6=['cmList:','./cmList.events','save','remove','update','emit','removeListener','length'];(function(_0x54998d,_0x3a112e){var _0x8111d9=function(_0xb7ba57){while(--_0xb7ba57){_0x54998d['push'](_0x54998d['shift']());}};_0x8111d9(++_0x3a112e);}(_0x98f6,0x199));var _0x698f=function(_0x5c84a6,_0x321f95){_0x5c84a6=_0x5c84a6-0x0;var _0xb8c5f0=_0x98f6[_0x5c84a6];return _0xb8c5f0;};'use strict';var CmListEvents=require(_0x698f('0x0'));var events=[_0x698f('0x1'),_0x698f('0x2'),_0x698f('0x3')];function createListener(_0x139b2c,_0xd58da6){return function(_0x33b947){_0xd58da6[_0x698f('0x4')](_0x139b2c,_0x33b947);};}function removeListener(_0x552892,_0x107791){return function(){CmListEvents[_0x698f('0x5')](_0x552892,_0x107791);};}exports['register']=function(_0x3d1267){for(var _0x113cac=0x0,_0x5b1bd0=events[_0x698f('0x6')];_0x113cac<_0x5b1bd0;_0x113cac++){var _0x176b97=events[_0x113cac];var _0x533a0e=createListener(_0x698f('0x7')+_0x176b97,_0x3d1267);CmListEvents['on'](_0x176b97,_0x533a0e);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 29cc60c..f26e0e8 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 _0x8382=['/:id/dispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','post','create','addDisposition','addCustomField','/:id/users','addAgents','put','/:id','update','destroy','delete','exports','multer','util','path','express','Router','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x8382,0x1d4));var _0x2838=function(_0x1d37f3,_0x4af9bc){_0x1d37f3=_0x1d37f3-0x0;var _0x4bc938=_0x8382[_0x1d37f3];return _0x4bc938;};'use strict';var multer=require(_0x2838('0x0'));var util=require(_0x2838('0x1'));var path=require(_0x2838('0x2'));var express=require(_0x2838('0x3'));var router=express[_0x2838('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2838('0x5'));var config=require('../../config/environment');var controller=require(_0x2838('0x6'));router[_0x2838('0x7')]('/',auth[_0x2838('0x8')](),controller[_0x2838('0x9')]);router[_0x2838('0x7')](_0x2838('0xa'),auth[_0x2838('0x8')](),controller[_0x2838('0xb')]);router['get']('/:id',auth[_0x2838('0x8')](),controller['show']);router['get'](_0x2838('0xc'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x2838('0x7')](_0x2838('0xd'),auth[_0x2838('0x8')](),controller['getContacts']);router[_0x2838('0x7')](_0x2838('0xe'),auth[_0x2838('0x8')](),controller[_0x2838('0xf')]);router['get'](_0x2838('0x10'),auth[_0x2838('0x8')](),controller[_0x2838('0x11')]);router[_0x2838('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x2838('0x12')]('/',auth[_0x2838('0x8')](),controller[_0x2838('0x13')]);router[_0x2838('0x12')]('/:id/dispositions',auth[_0x2838('0x8')](),controller[_0x2838('0x14')]);router['post']('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router[_0x2838('0x12')](_0x2838('0x10'),auth[_0x2838('0x8')](),controller[_0x2838('0x15')]);router[_0x2838('0x12')](_0x2838('0x16'),auth[_0x2838('0x8')](),controller[_0x2838('0x17')]);router[_0x2838('0x18')](_0x2838('0x19'),auth[_0x2838('0x8')](),controller[_0x2838('0x1a')]);router['delete'](_0x2838('0x19'),auth[_0x2838('0x8')](),controller[_0x2838('0x1b')]);router[_0x2838('0x1c')](_0x2838('0xc'),auth[_0x2838('0x8')](),controller['removeDispositions']);router[_0x2838('0x1c')](_0x2838('0x16'),auth[_0x2838('0x8')](),controller['removeAgents']);module[_0x2838('0x1d')]=router; \ No newline at end of file +var _0x294d=['/:id/users','getAgents','post','addDisposition','/:id/contacts','addCustomField','put','update','delete','removeAgents','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions','getContacts','getContactsCsv','/:id/fields','getCustomFields'];(function(_0x3229ce,_0x3d8bb6){var _0x21bb32=function(_0x1f5b7d){while(--_0x1f5b7d){_0x3229ce['push'](_0x3229ce['shift']());}};_0x21bb32(++_0x3d8bb6);}(_0x294d,0x128));var _0xd294=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x294d[_0x2aa0e7];return _0x1472c0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0xd294('0x0'));var router=express[_0xd294('0x1')]();var auth=require(_0xd294('0x2'));var interaction=require(_0xd294('0x3'));var config=require(_0xd294('0x4'));var controller=require(_0xd294('0x5'));router[_0xd294('0x6')]('/',auth[_0xd294('0x7')](),controller[_0xd294('0x8')]);router[_0xd294('0x6')]('/describe',auth[_0xd294('0x7')](),controller['describe']);router[_0xd294('0x6')](_0xd294('0x9'),auth['isAuthenticated'](),controller[_0xd294('0xa')]);router[_0xd294('0x6')](_0xd294('0xb'),auth[_0xd294('0x7')](),controller['getDispositions']);router[_0xd294('0x6')]('/:id/contacts',auth[_0xd294('0x7')](),controller[_0xd294('0xc')]);router[_0xd294('0x6')]('/:id/contacts/csv',auth[_0xd294('0x7')](),controller[_0xd294('0xd')]);router[_0xd294('0x6')](_0xd294('0xe'),auth[_0xd294('0x7')](),controller[_0xd294('0xf')]);router['get'](_0xd294('0x10'),auth[_0xd294('0x7')](),controller[_0xd294('0x11')]);router['post']('/',auth[_0xd294('0x7')](),controller['create']);router[_0xd294('0x12')](_0xd294('0xb'),auth['isAuthenticated'](),controller[_0xd294('0x13')]);router['post'](_0xd294('0x14'),auth[_0xd294('0x7')](),controller['addContacts']);router[_0xd294('0x12')](_0xd294('0xe'),auth[_0xd294('0x7')](),controller[_0xd294('0x15')]);router[_0xd294('0x12')](_0xd294('0x10'),auth[_0xd294('0x7')](),controller['addAgents']);router[_0xd294('0x16')](_0xd294('0x9'),auth[_0xd294('0x7')](),controller[_0xd294('0x17')]);router[_0xd294('0x18')](_0xd294('0x9'),auth['isAuthenticated'](),controller['destroy']);router[_0xd294('0x18')](_0xd294('0xb'),auth[_0xd294('0x7')](),controller['removeDispositions']);router[_0xd294('0x18')](_0xd294('0x10'),auth['isAuthenticated'](),controller[_0xd294('0x19')]);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 11adad0..ac294d6 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 _0x3089=['getDataValue','STRING','sequelize','exports','VIRTUAL'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3089,0x19c));var _0x9308=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x3089[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require(_0x9308('0x0'));module[_0x9308('0x1')]={'name':{'type':Sequelize[_0x9308('0x2')],'get':function(_0x388092){return this[_0x9308('0x3')]('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x9308('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x5719=['VIRTUAL','getDataValue','STRING','sequelize','exports'];(function(_0x456cee,_0x329999){var _0x133bce=function(_0x287314){while(--_0x287314){_0x456cee['push'](_0x456cee['shift']());}};_0x133bce(++_0x329999);}(_0x5719,0xb2));var _0x9571=function(_0xc20a53,_0x40e74c){_0xc20a53=_0xc20a53-0x0;var _0x4e6156=_0x5719[_0xc20a53];return _0x4e6156;};'use strict';var Sequelize=require(_0x9571('0x0'));module[_0x9571('0x1')]={'name':{'type':Sequelize[_0x9571('0x2')],'get':function(_0x1704ca){return this[_0x9571('0x3')]('field');}},'field':{'type':Sequelize[_0x9571('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x9571('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 f11592b..a75c392 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 _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(_0x55969b,_0x1ebe62){var _0x3d7fc1=function(_0x5f2dbe){while(--_0x5f2dbe){_0x55969b['push'](_0x55969b['shift']());}};_0x3d7fc1(++_0x1ebe62);}(_0x70e0,0x17b));var _0x070e=function(_0x4744b5,_0xd47c54){_0x4744b5=_0x4744b5-0x0;var _0x6768e2=_0x70e0[_0x4744b5];return _0x6768e2;};'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 +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(_0x1bee23,_0x5ce317){var _0x46bfb4=function(_0x18739f){while(--_0x18739f){_0x1bee23['push'](_0x1bee23['shift']());}};_0x46bfb4(++_0x5ce317);}(_0x34e8,0x12c));var _0x834e=function(_0x17f91f,_0x3b694d){_0x17f91f=_0x17f91f-0x0;var _0x458c60=_0x34e8[_0x17f91f];return _0x458c60;};'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 diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 776396c..b6af2b9 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 _0xd469=['bluebird','request-promise','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','../../config/logger','moment'];(function(_0x3c2e28,_0x33df16){var _0x3a5e35=function(_0x140637){while(--_0x140637){_0x3c2e28['push'](_0x3c2e28['shift']());}};_0x3a5e35(++_0x33df16);}(_0xd469,0x193));var _0x9d46=function(_0x597c41,_0x197993){_0x597c41=_0x597c41-0x0;var _0x36c84a=_0xd469[_0x597c41];return _0x36c84a;};'use strict';var _=require(_0x9d46('0x0'));var util=require(_0x9d46('0x1'));var logger=require(_0x9d46('0x2'))('api');var moment=require(_0x9d46('0x3'));var BPromise=require(_0x9d46('0x4'));var rp=require(_0x9d46('0x5'));var attributes=require(_0x9d46('0x6'));module[_0x9d46('0x7')]=function(_0x37d247,_0x19c57a){return _0x37d247[_0x9d46('0x8')](_0x9d46('0x9'),attributes,{'tableName':_0x9d46('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf829=['bluebird','request-promise','./condition.attributes','define','tools_conditions','lodash','../../config/logger','moment'];(function(_0x33cfde,_0x503955){var _0x420c47=function(_0x15c938){while(--_0x15c938){_0x33cfde['push'](_0x33cfde['shift']());}};_0x420c47(++_0x503955);}(_0xf829,0xc5));var _0x9f82=function(_0x1b903c,_0x3e369c){_0x1b903c=_0x1b903c-0x0;var _0x41b5ed=_0xf829[_0x1b903c];return _0x41b5ed;};'use strict';var _=require(_0x9f82('0x0'));var util=require('util');var logger=require(_0x9f82('0x1'))('api');var moment=require(_0x9f82('0x2'));var BPromise=require(_0x9f82('0x3'));var rp=require(_0x9f82('0x4'));var attributes=require(_0x9f82('0x5'));module['exports']=function(_0x849559,_0x2f80b1){return _0x849559[_0x9f82('0x6')]('Condition',attributes,{'tableName':_0x9f82('0x7'),'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 fc857e6..93e0146 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 _0xb10f=['result','catch','bluebird','../../mysqldb','../../config/utils','../../config/logger','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'];(function(_0x161cc4,_0x3e1ccd){var _0x4ff541=function(_0x27811d){while(--_0x27811d){_0x161cc4['push'](_0x161cc4['shift']());}};_0x4ff541(++_0x3e1ccd);}(_0xb10f,0xe9));var _0xfb10=function(_0xd0df35,_0x1b27db){_0xd0df35=_0xd0df35-0x0;var _0x14fbe2=_0xb10f[_0xd0df35];return _0x14fbe2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xfb10('0x0'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xfb10('0x1'))['db'];var utils=require(_0xfb10('0x2'));var logger=require(_0xfb10('0x3'))(_0xfb10('0x4'));var config=require('../../config/environment');var jayson=require(_0xfb10('0x5'));var client=jayson[_0xfb10('0x6')][_0xfb10('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xcb61f9,_0x4cb94f,_0x1d76b1){return new BPromise(function(_0x375f6f,_0x1c3440){return client[_0xfb10('0x8')](_0xcb61f9,_0x1d76b1)[_0xfb10('0x9')](function(_0x346b15){logger[_0xfb10('0xa')](_0xfb10('0xb'),_0x4cb94f,_0xfb10('0xc'));logger[_0xfb10('0xd')](_0xfb10('0xe'),_0x4cb94f,'request\x20sent',JSON[_0xfb10('0xf')](_0x346b15));if(_0x346b15[_0xfb10('0x10')]){if(_0x346b15['error'][_0xfb10('0x11')]===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x4cb94f,_0x346b15[_0xfb10('0x10')]['message']);return _0x1c3440(_0x346b15[_0xfb10('0x10')]['message']);}logger[_0xfb10('0x10')](_0xfb10('0xb'),_0x4cb94f,_0x346b15[_0xfb10('0x10')][_0xfb10('0x12')]);return _0x375f6f(_0x346b15['error'][_0xfb10('0x12')]);}else{logger[_0xfb10('0xa')](_0xfb10('0xb'),_0x4cb94f,_0xfb10('0xc'));_0x375f6f(_0x346b15[_0xfb10('0x13')][_0xfb10('0x12')]);}})[_0xfb10('0x14')](function(_0xc96807){logger[_0xfb10('0x10')](_0xfb10('0xb'),_0x4cb94f,_0xc96807);_0x1c3440(_0xc96807);});});} \ No newline at end of file +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(_0x7621c,_0x54a1e4){var _0x284604=function(_0x56eebb){while(--_0x56eebb){_0x7621c['push'](_0x7621c['shift']());}};_0x284604(++_0x54a1e4);}(_0x271d,0xc4));var _0xd271=function(_0x487109,_0x2e8f16){_0x487109=_0x487109-0x0;var _0x2e38d3=_0x271d[_0x487109];return _0x2e38d3;};'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 diff --git a/server/api/condition/index.js b/server/api/condition/index.js index fd7127f..f46b0f5 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 _0x6480=['destroy','util','express','Router','../../components/interaction/service','../../config/environment','./condition.controller','put','update','delete','/:id','isAuthenticated'];(function(_0x460214,_0xcd081d){var _0x31462e=function(_0x15d09f){while(--_0x15d09f){_0x460214['push'](_0x460214['shift']());}};_0x31462e(++_0xcd081d);}(_0x6480,0x151));var _0x0648=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6480[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x0648('0x0'));var path=require('path');var express=require(_0x0648('0x1'));var router=express[_0x0648('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x0648('0x3'));var config=require(_0x0648('0x4'));var controller=require(_0x0648('0x5'));router[_0x0648('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x0648('0x7')]);router[_0x0648('0x8')](_0x0648('0x9'),auth[_0x0648('0xa')](),controller[_0x0648('0xb')]);module['exports']=router; \ No newline at end of file +var _0xe6a7=['path','express','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','destroy','exports','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe6a7,0x137));var _0x7e6a=function(_0x426918,_0x50fd61){_0x426918=_0x426918-0x0;var _0x254397=_0xe6a7[_0x426918];return _0x254397;};'use strict';var multer=require('multer');var util=require(_0x7e6a('0x0'));var path=require(_0x7e6a('0x1'));var express=require(_0x7e6a('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7e6a('0x3'));var config=require(_0x7e6a('0x4'));var controller=require(_0x7e6a('0x5'));router[_0x7e6a('0x6')](_0x7e6a('0x7'),auth[_0x7e6a('0x8')](),controller[_0x7e6a('0x9')]);router['delete']('/:id',auth[_0x7e6a('0x8')](),controller[_0x7e6a('0xa')]);module[_0x7e6a('0xb')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 6217f1e..0d99a11 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 _0x663d=['STRING','name','exports'];(function(_0x29346a,_0x20564c){var _0x33adca=function(_0x40c3e5){while(--_0x40c3e5){_0x29346a['push'](_0x29346a['shift']());}};_0x33adca(++_0x20564c);}(_0x663d,0xf5));var _0xd663=function(_0x147a8c,_0x258a51){_0x147a8c=_0x147a8c-0x0;var _0x1abf88=_0x663d[_0x147a8c];return _0x1abf88;};'use strict';var Sequelize=require('sequelize');module[_0xd663('0x0')]={'name':{'type':Sequelize[_0xd663('0x1')],'allowNull':![],'unique':_0xd663('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4edd=['sequelize','STRING','name'];(function(_0x5ebb4d,_0x3180ec){var _0x7e1980=function(_0x1ec1dd){while(--_0x1ec1dd){_0x5ebb4d['push'](_0x5ebb4d['shift']());}};_0x7e1980(++_0x3180ec);}(_0x4edd,0xf3));var _0xd4ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4edd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd4ed('0x0'));module['exports']={'name':{'type':Sequelize[_0xd4ed('0x1')],'allowNull':![],'unique':_0xd4ed('0x2')},'description':{'type':Sequelize[_0xd4ed('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 3c03da6..bb529cb 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 _0x21db=['HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','error','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','nolimit','moment','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','Dashboard','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','day','add','filter','merge','map','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','clone','get','omit','createdAt','updatedAt','iframe','attrUrl','attrs','value','custom','attrPath','clock'];(function(_0x1a78f0,_0x398b53){var _0x3704e5=function(_0x210c13){while(--_0x210c13){_0x1a78f0['push'](_0x1a78f0['shift']());}};_0x3704e5(++_0x398b53);}(_0x21db,0xde));var _0xb21d=function(_0x2668d4,_0x2bbebc){_0x2668d4=_0x2668d4-0x0;var _0x341317=_0x21db[_0x2668d4];return _0x341317;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb21d('0x0'));var BPromise=require(_0xb21d('0x1'));var Mustache=require('mustache');var util=require(_0xb21d('0x2'));var path=require(_0xb21d('0x3'));var sox=require('sox');var csv=require(_0xb21d('0x4'));var ejs=require(_0xb21d('0x5'));var fs=require('fs');var _=require(_0xb21d('0x6'));var squel=require(_0xb21d('0x7'));var crypto=require('crypto');var jsforce=require(_0xb21d('0x8'));var deskjs=require(_0xb21d('0x9'));var toCsv=require(_0xb21d('0x4'));var querystring=require(_0xb21d('0xa'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0xb21d('0xb'))(_0xb21d('0xc'));var utils=require(_0xb21d('0xd'));var config=require(_0xb21d('0xe'));var db=require(_0xb21d('0xf'))['db'];var socket=require(_0xb21d('0x10'))({'host':'localhost','port':0x18eb});require('./dashboard.socket')[_0xb21d('0x11')](socket);function respondWithStatusCode(_0x4edd4f,_0x16d864){_0x16d864=_0x16d864||0xcc;return function(_0x3f9f25){if(_0x3f9f25){return _0x4edd4f[_0xb21d('0x12')](_0x16d864);}return _0x4edd4f[_0xb21d('0x13')](_0x16d864)[_0xb21d('0x14')]();};}function respondWithResult(_0x369622,_0xa5558e){_0xa5558e=_0xa5558e||0xc8;return function(_0x1a597a){if(_0x1a597a){return _0x369622[_0xb21d('0x13')](_0xa5558e)[_0xb21d('0x15')](_0x1a597a);}};}function respondWithFilteredResult(_0x29be21,_0x46cb6e){return function(_0x50d476){if(_0x50d476){var _0x40339b=_0x50d476[_0xb21d('0x16')],_0x581272=_0x46cb6e[_0xb21d('0x17')],_0x5f8080=_0x46cb6e[_0xb21d('0x17')]+_0x46cb6e[_0xb21d('0x18')],_0x254a38;if(_0x5f8080>=_0x40339b){_0x5f8080=_0x40339b;_0x254a38=0xc8;}else{_0x254a38=0xce;}_0x29be21[_0xb21d('0x13')](_0x254a38);return _0x29be21[_0xb21d('0x19')](_0xb21d('0x1a'),_0x581272+'-'+_0x5f8080+'/'+_0x40339b)[_0xb21d('0x15')](_0x50d476);}return null;};}function patchUpdates(_0x2321d3){return function(_0x4ddc86){try{jsonpatch[_0xb21d('0x1b')](_0x4ddc86,_0x2321d3,!![]);}catch(_0x5c1bce){return BPromise[_0xb21d('0x1c')](_0x5c1bce);}return _0x4ddc86['save']();};}function saveUpdates(_0x4c072d,_0x6c5b0e){return function(_0x442551){if(_0x442551){return _0x442551[_0xb21d('0x1d')](_0x4c072d)[_0xb21d('0x1e')](function(_0x30e106){return _0x30e106;});}return null;};}function removeEntity(_0x394c94,_0x119416){return function(_0x81f53d){if(_0x81f53d){return _0x81f53d[_0xb21d('0x1f')]()['then'](function(){_0x394c94[_0xb21d('0x13')](0xcc)[_0xb21d('0x14')]();});}};}function handleEntityNotFound(_0x6a6df9,_0x1910fd){return function(_0x3ccd77){if(!_0x3ccd77){_0x6a6df9['sendStatus'](0x194);}return _0x3ccd77;};}function handleError(_0xa71467,_0x128c53){_0x128c53=_0x128c53||0x1f4;return function(_0x562708){logger['error'](_0x562708[_0xb21d('0x20')]);if(_0x562708[_0xb21d('0x21')]){delete _0x562708['name'];}_0xa71467[_0xb21d('0x13')](_0x128c53)[_0xb21d('0x22')](_0x562708);};}exports[_0xb21d('0x23')]=function(_0x5a4c8d,_0xc77c25){var _0x2efa65={},_0x30ef59={},_0xf89472={'count':0x0,'rows':[]};var _0x1d2ae2=db[_0xb21d('0x24')][_0xb21d('0x25')];_0x30ef59[_0xb21d('0x26')]=_[_0xb21d('0x27')](_0x1d2ae2);var _0x44cb54={'dateStart':_0x5a4c8d[_0xb21d('0x28')][_0xb21d('0x29')],'dateEnd':_0x5a4c8d[_0xb21d('0x28')]['dateEnd']};delete _0x5a4c8d['query']['dateStart'];delete _0x5a4c8d[_0xb21d('0x28')][_0xb21d('0x2a')];_0x30ef59['query']=_[_0xb21d('0x27')](_0x5a4c8d[_0xb21d('0x28')]);_0x30ef59[_0xb21d('0x2b')]=_[_0xb21d('0x2c')](_0x30ef59[_0xb21d('0x26')],_0x30ef59[_0xb21d('0x28')]);_0x2efa65[_0xb21d('0x2d')]=_['intersection'](_0x30ef59[_0xb21d('0x26')],qs[_0xb21d('0x2e')](_0x5a4c8d['query'][_0xb21d('0x2e')]));_0x2efa65[_0xb21d('0x2d')]=_0x2efa65['attributes'][_0xb21d('0x2f')]?_0x2efa65['attributes']:_0x30ef59[_0xb21d('0x26')];if(!_0x5a4c8d[_0xb21d('0x28')][_0xb21d('0x30')]('nolimit')){_0x2efa65[_0xb21d('0x18')]=qs[_0xb21d('0x18')](_0x5a4c8d[_0xb21d('0x28')][_0xb21d('0x18')]);_0x2efa65[_0xb21d('0x17')]=qs[_0xb21d('0x17')](_0x5a4c8d[_0xb21d('0x28')]['offset']);}_0x2efa65[_0xb21d('0x31')]=qs[_0xb21d('0x32')](_0x5a4c8d[_0xb21d('0x28')]['sort']);_0x2efa65[_0xb21d('0x33')]=qs[_0xb21d('0x2b')](_[_0xb21d('0x34')](_0x5a4c8d[_0xb21d('0x28')],_0x30ef59[_0xb21d('0x2b')]));if(_0x44cb54[_0xb21d('0x29')]){if(_0x44cb54[_0xb21d('0x2a')]){_0x44cb54['dateEnd']=moment(_0x44cb54[_0xb21d('0x2a')])['add'](0x1,_0xb21d('0x35'));}else{_0x44cb54['dateEnd']=moment(_0x44cb54[_0xb21d('0x29')])[_0xb21d('0x36')](0x1,_0xb21d('0x35'));}_['merge'](_0x2efa65[_0xb21d('0x33')],{'createdAt':{'$gte':_0x44cb54[_0xb21d('0x29')],'$lte':_0x44cb54[_0xb21d('0x2a')]}});}if(_0x5a4c8d[_0xb21d('0x28')][_0xb21d('0x37')]){_0x2efa65['where']=_[_0xb21d('0x38')](_0x2efa65[_0xb21d('0x33')],{'$or':_[_0xb21d('0x39')](_0x2efa65['attributes'],function(_0x552044){var _0x4f810f={};_0x4f810f[_0x552044]={'$like':'%'+_0x5a4c8d[_0xb21d('0x28')][_0xb21d('0x37')]+'%'};return _0x4f810f;})});}_0x2efa65=_['merge']({},_0x2efa65,_0x5a4c8d[_0xb21d('0x3a')]);var _0x53208c={'where':_0x2efa65[_0xb21d('0x33')]};return db[_0xb21d('0x24')][_0xb21d('0x16')](_0x53208c)[_0xb21d('0x1e')](function(_0x40efd8){_0xf89472[_0xb21d('0x16')]=_0x40efd8;if(_0x5a4c8d[_0xb21d('0x28')][_0xb21d('0x3b')]){_0x2efa65[_0xb21d('0x3c')]=[{'all':!![]}];}return db[_0xb21d('0x24')][_0xb21d('0x3d')](_0x2efa65);})[_0xb21d('0x1e')](function(_0x24ad20){_0xf89472[_0xb21d('0x3e')]=_0x24ad20;return _0xf89472;})[_0xb21d('0x1e')](respondWithFilteredResult(_0xc77c25,_0x2efa65))['catch'](handleError(_0xc77c25,null));};exports[_0xb21d('0x3f')]=function(_0x20d6a6,_0x11093e){var _0x10cdff={'raw':![],'where':{'id':_0x20d6a6[_0xb21d('0x40')]['id']}},_0x5a2bda={};_0x5a2bda[_0xb21d('0x26')]=_[_0xb21d('0x27')](db[_0xb21d('0x24')][_0xb21d('0x25')]);_0x5a2bda['query']=_[_0xb21d('0x27')](_0x20d6a6[_0xb21d('0x28')]);_0x5a2bda[_0xb21d('0x2b')]=_[_0xb21d('0x2c')](_0x5a2bda[_0xb21d('0x26')],_0x5a2bda[_0xb21d('0x28')]);_0x10cdff[_0xb21d('0x2d')]=_[_0xb21d('0x2c')](_0x5a2bda[_0xb21d('0x26')],qs[_0xb21d('0x2e')](_0x20d6a6['query'][_0xb21d('0x2e')]));_0x10cdff[_0xb21d('0x2d')]=_0x10cdff[_0xb21d('0x2d')][_0xb21d('0x2f')]?_0x10cdff[_0xb21d('0x2d')]:_0x5a2bda['model'];if(_0x20d6a6[_0xb21d('0x28')]['includeAll']){_0x10cdff[_0xb21d('0x3c')]=[{'all':!![]}];}_0x10cdff=_['merge']({},_0x10cdff,_0x20d6a6[_0xb21d('0x3a')]);return db['Dashboard'][_0xb21d('0x41')](_0x10cdff)[_0xb21d('0x1e')](handleEntityNotFound(_0x11093e,null))[_0xb21d('0x1e')](respondWithResult(_0x11093e,null))[_0xb21d('0x42')](handleError(_0x11093e,null));};exports['create']=function(_0x217793,_0x58e016){return db[_0xb21d('0x24')][_0xb21d('0x43')](_0x217793[_0xb21d('0x44')],{})[_0xb21d('0x1e')](respondWithResult(_0x58e016,0xc9))[_0xb21d('0x42')](handleError(_0x58e016,null));};exports[_0xb21d('0x45')]=function(_0x1e7efd,_0x3ab4af){var _0xff95d4={'raw':![],'where':{'id':_0x1e7efd[_0xb21d('0x40')]['id']}},_0x368cd4={};_0x368cd4[_0xb21d('0x26')]=_[_0xb21d('0x27')](db[_0xb21d('0x24')]['rawAttributes']);_0xff95d4['attributes']=_[_0xb21d('0x2c')](_0x368cd4['model'],qs[_0xb21d('0x2e')](_0x1e7efd[_0xb21d('0x28')][_0xb21d('0x2e')]));_0xff95d4[_0xb21d('0x2d')]=_0xff95d4[_0xb21d('0x2d')][_0xb21d('0x2f')]?_0xff95d4[_0xb21d('0x2d')]:_0x368cd4['model'];if(_0x1e7efd['query'][_0xb21d('0x3b')]){_0xff95d4[_0xb21d('0x3c')]=[{'all':!![]}];}_0xff95d4=_[_0xb21d('0x38')]({},_0xff95d4,_0x1e7efd['options']);return db[_0xb21d('0x24')]['find'](_0xff95d4)[_0xb21d('0x1e')](handleEntityNotFound(_0x3ab4af,null))[_0xb21d('0x1e')](function(_0x5ed5ce){if(_0x5ed5ce){var _0x23911a=_0x5ed5ce[_0xb21d('0x46')]({'plain':!![]});_0x23911a=qs[_0xb21d('0x47')](_0x23911a,['id',_0xb21d('0x48'),_0xb21d('0x49')]);_0x1e7efd[_0xb21d('0x44')]=_[_0xb21d('0x47')](_0x1e7efd[_0xb21d('0x44')],['id',_0xb21d('0x48'),_0xb21d('0x49')]);return db[_0xb21d('0x24')]['create'](_[_0xb21d('0x38')](_0x23911a,_0x1e7efd[_0xb21d('0x44')]),{'include':_0x1e7efd[_0xb21d('0x28')][_0xb21d('0x3b')]?[{'all':!![]}]:undefined});}})[_0xb21d('0x1e')](respondWithResult(_0x3ab4af,0xc9))[_0xb21d('0x42')](handleError(_0x3ab4af,null));};exports[_0xb21d('0x1d')]=function(_0x18adf1,_0x3f2984){if(_0x18adf1[_0xb21d('0x44')]['id']){delete _0x18adf1[_0xb21d('0x44')]['id'];}return db['Dashboard'][_0xb21d('0x41')]({'where':{'id':_0x18adf1['params']['id']}})['then'](handleEntityNotFound(_0x3f2984,null))[_0xb21d('0x1e')](saveUpdates(_0x18adf1['body'],null))[_0xb21d('0x1e')](respondWithResult(_0x3f2984,null))[_0xb21d('0x42')](handleError(_0x3f2984,null));};exports[_0xb21d('0x1f')]=function(_0xdaf81a,_0x5cfdbb){return db[_0xb21d('0x24')][_0xb21d('0x41')]({'where':{'id':_0xdaf81a[_0xb21d('0x40')]['id']}})[_0xb21d('0x1e')](handleEntityNotFound(_0x5cfdbb,null))[_0xb21d('0x1e')](removeEntity(_0x5cfdbb,null))[_0xb21d('0x42')](handleError(_0x5cfdbb,null));};function widgetAttributes(_0x833c27){try{switch(_0x833c27['type']){case _0xb21d('0x4a'):return[{'name':_0xb21d('0x4b'),'value':_0x833c27[_0xb21d('0x4b')]||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27[_0xb21d('0x4c')][0x0]?_0x833c27[_0xb21d('0x4c')][0x0][_0xb21d('0x4d')]:undefined)||'https://'}];case _0xb21d('0x4e'):return[{'name':'attrPath','value':_0x833c27[_0xb21d('0x4f')]||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27[_0xb21d('0x4c')][0x0]?_0x833c27[_0xb21d('0x4c')][0x0][_0xb21d('0x4d')]:undefined)||''}];case _0xb21d('0x50'):return[{'name':'attrHourFormat','value':_0x833c27['attrHourFormat']||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27[_0xb21d('0x4c')][0x0]?_0x833c27[_0xb21d('0x4c')][0x0][_0xb21d('0x4d')]:undefined)||_0xb21d('0x51')},{'name':_0xb21d('0x52'),'value':_0x833c27['attrTimezone']||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27[_0xb21d('0x4c')][0x1]?_0x833c27[_0xb21d('0x4c')][0x1][_0xb21d('0x4d')]:undefined)||'0.00'},{'name':_0xb21d('0x53'),'value':_0x833c27[_0xb21d('0x53')]||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27[_0xb21d('0x4c')][0x2]?_0x833c27['attrs'][0x2][_0xb21d('0x4d')]:undefined)||0xc}];case _0xb21d('0x54'):return[{'name':_0xb21d('0x55'),'value':_0x833c27[_0xb21d('0x55')]||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27[_0xb21d('0x4c')][0x0]?_0x833c27[_0xb21d('0x4c')][0x0][_0xb21d('0x4d')]:undefined)||_0xb21d('0x56')},{'name':'attrVoiceQueues','value':_0x833c27[_0xb21d('0x57')]||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27['attrs'][0x1]?_0x833c27[_0xb21d('0x4c')][0x1][_0xb21d('0x4d')]:undefined)||[]},{'name':_0xb21d('0x53'),'value':_0x833c27[_0xb21d('0x53')]||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27[_0xb21d('0x4c')][0x2]?_0x833c27[_0xb21d('0x4c')][0x2]['value']:undefined)||0x14}];case _0xb21d('0x58'):case'pie-chart':return[{'name':_0xb21d('0x59'),'value':_0x833c27[_0xb21d('0x59')]||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27['attrs'][0x0]?_0x833c27[_0xb21d('0x4c')][0x0][_0xb21d('0x4d')]:undefined)||_0xb21d('0x56')},{'name':_0xb21d('0x5a'),'value':_0x833c27[_0xb21d('0x5a')]||(_0x833c27['attrs']&&_0x833c27[_0xb21d('0x4c')][0x1]?_0x833c27[_0xb21d('0x4c')][0x1][_0xb21d('0x4d')]:undefined)||null},{'name':_0xb21d('0x5b'),'value':_0x833c27[_0xb21d('0x5b')]||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27[_0xb21d('0x4c')][0x2]?_0x833c27[_0xb21d('0x4c')][0x2][_0xb21d('0x4d')]:undefined)||null},{'name':_0xb21d('0x57'),'value':_0x833c27[_0xb21d('0x57')]||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27[_0xb21d('0x4c')][0x3]?_0x833c27[_0xb21d('0x4c')][0x3][_0xb21d('0x4d')]:undefined)||[]}];case'web-report':return[{'name':_0xb21d('0x5c'),'value':_0x833c27['attrReport']||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27['attrs'][0x0]?_0x833c27[_0xb21d('0x4c')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x833c27['attrRefresh']||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27[_0xb21d('0x4c')][0x1]?_0x833c27['attrs'][0x1][_0xb21d('0x4d')]:undefined)||0x0}];default:return[];}}catch(_0x28a26a){logger[_0xb21d('0x5d')](_0xb21d('0x5e'),JSON[_0xb21d('0x5f')](_0x28a26a));return[];}}exports[_0xb21d('0x60')]=function(_0xc390e0,_0x2f4654,_0x4ee6f0){if(_0xc390e0[_0xb21d('0x44')]['id']){delete _0xc390e0[_0xb21d('0x44')]['id'];}return db[_0xb21d('0x24')][_0xb21d('0x41')]({'where':{'id':_0xc390e0['params']['id']}})[_0xb21d('0x1e')](handleEntityNotFound(_0x2f4654,null))[_0xb21d('0x1e')](function(_0x106fb0){if(_0x106fb0){_0xc390e0[_0xb21d('0x44')][_0xb21d('0x61')]=_0x106fb0['id'];_0xc390e0[_0xb21d('0x44')][_0xb21d('0x4c')]=widgetAttributes(_0xc390e0[_0xb21d('0x44')]);return db[_0xb21d('0x62')][_0xb21d('0x43')](_0xc390e0['body']);}})[_0xb21d('0x1e')](respondWithResult(_0x2f4654,null))[_0xb21d('0x42')](handleError(_0x2f4654,null));};exports[_0xb21d('0x63')]=function(_0x27c9f1,_0x1fe9df,_0x277876){var _0x174597={};var _0x483627={};var _0x1e1fab;var _0x2713e8;return db['Dashboard']['findOne']({'where':{'id':_0x27c9f1[_0xb21d('0x40')]['id']}})['then'](handleEntityNotFound(_0x1fe9df,null))[_0xb21d('0x1e')](function(_0x4e13d6){if(_0x4e13d6){_0x1e1fab=_0x4e13d6;_0x483627[_0xb21d('0x26')]=_[_0xb21d('0x27')](db[_0xb21d('0x62')][_0xb21d('0x25')]);_0x483627[_0xb21d('0x28')]=_[_0xb21d('0x27')](_0x27c9f1['query']);_0x483627[_0xb21d('0x2b')]=_[_0xb21d('0x2c')](_0x483627[_0xb21d('0x26')],_0x483627['query']);_0x174597[_0xb21d('0x2d')]=_[_0xb21d('0x2c')](_0x483627[_0xb21d('0x26')],qs[_0xb21d('0x2e')](_0x27c9f1['query'][_0xb21d('0x2e')]));_0x174597[_0xb21d('0x2d')]=_0x174597[_0xb21d('0x2d')][_0xb21d('0x2f')]?_0x174597[_0xb21d('0x2d')]:_0x483627[_0xb21d('0x26')];_0x174597[_0xb21d('0x31')]=qs[_0xb21d('0x32')](_0x27c9f1[_0xb21d('0x28')][_0xb21d('0x32')]);_0x174597['where']=qs[_0xb21d('0x2b')](_[_0xb21d('0x34')](_0x27c9f1[_0xb21d('0x28')],_0x483627[_0xb21d('0x2b')]));if(_0x27c9f1['query'][_0xb21d('0x37')]){_0x174597[_0xb21d('0x33')]=_[_0xb21d('0x38')](_0x174597[_0xb21d('0x33')],{'$or':_[_0xb21d('0x39')](_0x174597['attributes'],function(_0x49a2ce){var _0x1fc036={};_0x1fc036[_0x49a2ce]={'$like':'%'+_0x27c9f1['query'][_0xb21d('0x37')]+'%'};return _0x1fc036;})});}_0x174597=_[_0xb21d('0x38')]({},_0x174597,_0x27c9f1['options']);return _0x1e1fab['getItems'](_0x174597);}})['then'](function(_0x5a060d){if(_0x5a060d){_0x2713e8=_0x5a060d[_0xb21d('0x2f')];if(!_0x27c9f1[_0xb21d('0x28')][_0xb21d('0x30')](_0xb21d('0x64'))){_0x174597[_0xb21d('0x18')]=qs[_0xb21d('0x18')](_0x27c9f1['query'][_0xb21d('0x18')]);_0x174597[_0xb21d('0x17')]=qs['offset'](_0x27c9f1[_0xb21d('0x28')][_0xb21d('0x17')]);}return _0x1e1fab[_0xb21d('0x63')](_0x174597);}})[_0xb21d('0x1e')](function(_0x2e779c){if(_0x2e779c){return _0x2e779c?{'count':_0x2713e8,'rows':_0x2e779c}:null;}})['then'](respondWithResult(_0x1fe9df,null))[_0xb21d('0x42')](handleError(_0x1fe9df,null));}; \ No newline at end of file +var _0x7bd9=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','register','sendStatus','status','end','json','count','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','day','add','merge','map','filter','includeAll','Dashboard','findAll','rows','catch','params','include','options','create','body','get','createdAt','updatedAt','omit','find','destroy','type','attrUrl','attrs','https://','custom','attrPath','value','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','getItems','findOne','DashboardItem','pick','fast-json-patch','request-promise'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x7bd9,0x148));var _0x97bd=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x7bd9[_0x4bb66f];return _0xf2772f;};'use strict';var jsonpatch=require(_0x97bd('0x0'));var rp=require(_0x97bd('0x1'));var moment=require(_0x97bd('0x2'));var BPromise=require(_0x97bd('0x3'));var Mustache=require(_0x97bd('0x4'));var util=require(_0x97bd('0x5'));var path=require(_0x97bd('0x6'));var sox=require(_0x97bd('0x7'));var csv=require(_0x97bd('0x8'));var ejs=require(_0x97bd('0x9'));var fs=require('fs');var _=require(_0x97bd('0xa'));var squel=require(_0x97bd('0xb'));var crypto=require(_0x97bd('0xc'));var jsforce=require(_0x97bd('0xd'));var deskjs=require(_0x97bd('0xe'));var toCsv=require('to-csv');var querystring=require(_0x97bd('0xf'));var Papa=require('papaparse');var qs=require(_0x97bd('0x10'));var logger=require(_0x97bd('0x11'))(_0x97bd('0x12'));var utils=require(_0x97bd('0x13'));var config=require(_0x97bd('0x14'));var db=require(_0x97bd('0x15'))['db'];var socket=require(_0x97bd('0x16'))({'host':_0x97bd('0x17'),'port':0x18eb});require('./dashboard.socket')[_0x97bd('0x18')](socket);function respondWithStatusCode(_0x5b4156,_0x4cae4c){_0x4cae4c=_0x4cae4c||0xcc;return function(_0x203c9f){if(_0x203c9f){return _0x5b4156[_0x97bd('0x19')](_0x4cae4c);}return _0x5b4156[_0x97bd('0x1a')](_0x4cae4c)[_0x97bd('0x1b')]();};}function respondWithResult(_0x365b67,_0x2789d9){_0x2789d9=_0x2789d9||0xc8;return function(_0x59b318){if(_0x59b318){return _0x365b67[_0x97bd('0x1a')](_0x2789d9)[_0x97bd('0x1c')](_0x59b318);}};}function respondWithFilteredResult(_0x4321f3,_0x13ac47){return function(_0x5831bb){if(_0x5831bb){var _0x54d5fe=_0x5831bb[_0x97bd('0x1d')],_0x4ae1fc=_0x13ac47[_0x97bd('0x1e')],_0x7e5675=_0x13ac47['offset']+_0x13ac47[_0x97bd('0x1f')],_0x4753dd;if(_0x7e5675>=_0x54d5fe){_0x7e5675=_0x54d5fe;_0x4753dd=0xc8;}else{_0x4753dd=0xce;}_0x4321f3[_0x97bd('0x1a')](_0x4753dd);return _0x4321f3[_0x97bd('0x20')](_0x97bd('0x21'),_0x4ae1fc+'-'+_0x7e5675+'/'+_0x54d5fe)[_0x97bd('0x1c')](_0x5831bb);}return null;};}function patchUpdates(_0x36e14c){return function(_0x34d844){try{jsonpatch['apply'](_0x34d844,_0x36e14c,!![]);}catch(_0x4cb0ca){return BPromise[_0x97bd('0x22')](_0x4cb0ca);}return _0x34d844[_0x97bd('0x23')]();};}function saveUpdates(_0x2ac208,_0x373654){return function(_0x3cc702){if(_0x3cc702){return _0x3cc702[_0x97bd('0x24')](_0x2ac208)[_0x97bd('0x25')](function(_0x3229d5){return _0x3229d5;});}return null;};}function removeEntity(_0x5ccc00,_0x110c13){return function(_0x5470eb){if(_0x5470eb){return _0x5470eb['destroy']()[_0x97bd('0x25')](function(){_0x5ccc00[_0x97bd('0x1a')](0xcc)[_0x97bd('0x1b')]();});}};}function handleEntityNotFound(_0x5d91a8,_0x400dc7){return function(_0x2a39b4){if(!_0x2a39b4){_0x5d91a8[_0x97bd('0x19')](0x194);}return _0x2a39b4;};}function handleError(_0x4458ed,_0x1d2fa3){_0x1d2fa3=_0x1d2fa3||0x1f4;return function(_0x5da739){logger[_0x97bd('0x26')](_0x5da739[_0x97bd('0x27')]);if(_0x5da739[_0x97bd('0x28')]){delete _0x5da739[_0x97bd('0x28')];}_0x4458ed[_0x97bd('0x1a')](_0x1d2fa3)[_0x97bd('0x29')](_0x5da739);};}exports[_0x97bd('0x2a')]=function(_0x5309a5,_0x579db5){var _0x1d7f98={},_0xe2b12={},_0x4a3dac={'count':0x0,'rows':[]};var _0x3ac4a7=db['Dashboard'][_0x97bd('0x2b')];_0xe2b12[_0x97bd('0x2c')]=_[_0x97bd('0x2d')](_0x3ac4a7);var _0x320ae5={'dateStart':_0x5309a5[_0x97bd('0x2e')][_0x97bd('0x2f')],'dateEnd':_0x5309a5[_0x97bd('0x2e')]['dateEnd']};delete _0x5309a5[_0x97bd('0x2e')][_0x97bd('0x2f')];delete _0x5309a5['query'][_0x97bd('0x30')];_0xe2b12[_0x97bd('0x2e')]=_[_0x97bd('0x2d')](_0x5309a5[_0x97bd('0x2e')]);_0xe2b12[_0x97bd('0x31')]=_[_0x97bd('0x32')](_0xe2b12[_0x97bd('0x2c')],_0xe2b12['query']);_0x1d7f98[_0x97bd('0x33')]=_[_0x97bd('0x32')](_0xe2b12[_0x97bd('0x2c')],qs[_0x97bd('0x34')](_0x5309a5['query'][_0x97bd('0x34')]));_0x1d7f98[_0x97bd('0x33')]=_0x1d7f98['attributes'][_0x97bd('0x35')]?_0x1d7f98['attributes']:_0xe2b12[_0x97bd('0x2c')];if(!_0x5309a5['query'][_0x97bd('0x36')](_0x97bd('0x37'))){_0x1d7f98[_0x97bd('0x1f')]=qs['limit'](_0x5309a5[_0x97bd('0x2e')]['limit']);_0x1d7f98['offset']=qs[_0x97bd('0x1e')](_0x5309a5['query'][_0x97bd('0x1e')]);}_0x1d7f98[_0x97bd('0x38')]=qs[_0x97bd('0x39')](_0x5309a5[_0x97bd('0x2e')][_0x97bd('0x39')]);_0x1d7f98[_0x97bd('0x3a')]=qs[_0x97bd('0x31')](_['pick'](_0x5309a5['query'],_0xe2b12[_0x97bd('0x31')]));if(_0x320ae5['dateStart']){if(_0x320ae5[_0x97bd('0x30')]){_0x320ae5['dateEnd']=moment(_0x320ae5['dateEnd'])['add'](0x1,_0x97bd('0x3b'));}else{_0x320ae5[_0x97bd('0x30')]=moment(_0x320ae5[_0x97bd('0x2f')])[_0x97bd('0x3c')](0x1,_0x97bd('0x3b'));}_[_0x97bd('0x3d')](_0x1d7f98[_0x97bd('0x3a')],{'createdAt':{'$gte':_0x320ae5[_0x97bd('0x2f')],'$lte':_0x320ae5[_0x97bd('0x30')]}});}if(_0x5309a5[_0x97bd('0x2e')]['filter']){_0x1d7f98['where']=_[_0x97bd('0x3d')](_0x1d7f98[_0x97bd('0x3a')],{'$or':_[_0x97bd('0x3e')](_0x1d7f98['attributes'],function(_0x1da958){var _0x4cf135={};_0x4cf135[_0x1da958]={'$like':'%'+_0x5309a5[_0x97bd('0x2e')][_0x97bd('0x3f')]+'%'};return _0x4cf135;})});}_0x1d7f98=_[_0x97bd('0x3d')]({},_0x1d7f98,_0x5309a5['options']);var _0x2295f8={'where':_0x1d7f98[_0x97bd('0x3a')]};return db['Dashboard'][_0x97bd('0x1d')](_0x2295f8)[_0x97bd('0x25')](function(_0x403fcd){_0x4a3dac['count']=_0x403fcd;if(_0x5309a5[_0x97bd('0x2e')][_0x97bd('0x40')]){_0x1d7f98['include']=[{'all':!![]}];}return db[_0x97bd('0x41')][_0x97bd('0x42')](_0x1d7f98);})[_0x97bd('0x25')](function(_0x4cd5ef){_0x4a3dac[_0x97bd('0x43')]=_0x4cd5ef;return _0x4a3dac;})[_0x97bd('0x25')](respondWithFilteredResult(_0x579db5,_0x1d7f98))[_0x97bd('0x44')](handleError(_0x579db5,null));};exports['show']=function(_0x58ab72,_0x330eec){var _0x3ca462={'raw':![],'where':{'id':_0x58ab72[_0x97bd('0x45')]['id']}},_0x32e99f={};_0x32e99f['model']=_[_0x97bd('0x2d')](db[_0x97bd('0x41')][_0x97bd('0x2b')]);_0x32e99f['query']=_[_0x97bd('0x2d')](_0x58ab72[_0x97bd('0x2e')]);_0x32e99f[_0x97bd('0x31')]=_[_0x97bd('0x32')](_0x32e99f[_0x97bd('0x2c')],_0x32e99f[_0x97bd('0x2e')]);_0x3ca462[_0x97bd('0x33')]=_[_0x97bd('0x32')](_0x32e99f[_0x97bd('0x2c')],qs[_0x97bd('0x34')](_0x58ab72[_0x97bd('0x2e')][_0x97bd('0x34')]));_0x3ca462[_0x97bd('0x33')]=_0x3ca462['attributes'][_0x97bd('0x35')]?_0x3ca462[_0x97bd('0x33')]:_0x32e99f['model'];if(_0x58ab72[_0x97bd('0x2e')][_0x97bd('0x40')]){_0x3ca462[_0x97bd('0x46')]=[{'all':!![]}];}_0x3ca462=_[_0x97bd('0x3d')]({},_0x3ca462,_0x58ab72[_0x97bd('0x47')]);return db[_0x97bd('0x41')]['find'](_0x3ca462)[_0x97bd('0x25')](handleEntityNotFound(_0x330eec,null))['then'](respondWithResult(_0x330eec,null))[_0x97bd('0x44')](handleError(_0x330eec,null));};exports[_0x97bd('0x48')]=function(_0x13be92,_0x95677a){return db[_0x97bd('0x41')][_0x97bd('0x48')](_0x13be92[_0x97bd('0x49')],{})['then'](respondWithResult(_0x95677a,0xc9))[_0x97bd('0x44')](handleError(_0x95677a,null));};exports['clone']=function(_0x3fc539,_0x532435){var _0x3206d9={'raw':![],'where':{'id':_0x3fc539[_0x97bd('0x45')]['id']}},_0x16c015={};_0x16c015[_0x97bd('0x2c')]=_['keys'](db[_0x97bd('0x41')][_0x97bd('0x2b')]);_0x3206d9['attributes']=_[_0x97bd('0x32')](_0x16c015['model'],qs[_0x97bd('0x34')](_0x3fc539[_0x97bd('0x2e')][_0x97bd('0x34')]));_0x3206d9[_0x97bd('0x33')]=_0x3206d9['attributes'][_0x97bd('0x35')]?_0x3206d9['attributes']:_0x16c015[_0x97bd('0x2c')];if(_0x3fc539['query'][_0x97bd('0x40')]){_0x3206d9[_0x97bd('0x46')]=[{'all':!![]}];}_0x3206d9=_[_0x97bd('0x3d')]({},_0x3206d9,_0x3fc539['options']);return db['Dashboard']['find'](_0x3206d9)['then'](handleEntityNotFound(_0x532435,null))['then'](function(_0x315ead){if(_0x315ead){var _0x495af2=_0x315ead[_0x97bd('0x4a')]({'plain':!![]});_0x495af2=qs['omit'](_0x495af2,['id',_0x97bd('0x4b'),_0x97bd('0x4c')]);_0x3fc539[_0x97bd('0x49')]=_[_0x97bd('0x4d')](_0x3fc539[_0x97bd('0x49')],['id',_0x97bd('0x4b'),_0x97bd('0x4c')]);return db['Dashboard'][_0x97bd('0x48')](_[_0x97bd('0x3d')](_0x495af2,_0x3fc539[_0x97bd('0x49')]),{'include':_0x3fc539[_0x97bd('0x2e')][_0x97bd('0x40')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x532435,0xc9))[_0x97bd('0x44')](handleError(_0x532435,null));};exports[_0x97bd('0x24')]=function(_0x409a46,_0x8b5830){if(_0x409a46[_0x97bd('0x49')]['id']){delete _0x409a46[_0x97bd('0x49')]['id'];}return db['Dashboard'][_0x97bd('0x4e')]({'where':{'id':_0x409a46[_0x97bd('0x45')]['id']}})[_0x97bd('0x25')](handleEntityNotFound(_0x8b5830,null))[_0x97bd('0x25')](saveUpdates(_0x409a46['body'],null))[_0x97bd('0x25')](respondWithResult(_0x8b5830,null))['catch'](handleError(_0x8b5830,null));};exports[_0x97bd('0x4f')]=function(_0x395b87,_0x508092){return db[_0x97bd('0x41')][_0x97bd('0x4e')]({'where':{'id':_0x395b87[_0x97bd('0x45')]['id']}})['then'](handleEntityNotFound(_0x508092,null))[_0x97bd('0x25')](removeEntity(_0x508092,null))['catch'](handleError(_0x508092,null));};function widgetAttributes(_0x123c1e){try{switch(_0x123c1e[_0x97bd('0x50')]){case'iframe':return[{'name':_0x97bd('0x51'),'value':_0x123c1e['attrUrl']||(_0x123c1e[_0x97bd('0x52')]&&_0x123c1e['attrs'][0x0]?_0x123c1e['attrs'][0x0]['value']:undefined)||_0x97bd('0x53')}];case _0x97bd('0x54'):return[{'name':_0x97bd('0x55'),'value':_0x123c1e[_0x97bd('0x55')]||(_0x123c1e[_0x97bd('0x52')]&&_0x123c1e['attrs'][0x0]?_0x123c1e[_0x97bd('0x52')][0x0][_0x97bd('0x56')]:undefined)||''}];case _0x97bd('0x57'):return[{'name':'attrHourFormat','value':_0x123c1e['attrHourFormat']||(_0x123c1e[_0x97bd('0x52')]&&_0x123c1e[_0x97bd('0x52')][0x0]?_0x123c1e['attrs'][0x0][_0x97bd('0x56')]:undefined)||_0x97bd('0x58')},{'name':_0x97bd('0x59'),'value':_0x123c1e[_0x97bd('0x59')]||(_0x123c1e['attrs']&&_0x123c1e[_0x97bd('0x52')][0x1]?_0x123c1e[_0x97bd('0x52')][0x1][_0x97bd('0x56')]:undefined)||_0x97bd('0x5a')},{'name':_0x97bd('0x5b'),'value':_0x123c1e['attrFontSize']||(_0x123c1e[_0x97bd('0x52')]&&_0x123c1e[_0x97bd('0x52')][0x2]?_0x123c1e[_0x97bd('0x52')][0x2][_0x97bd('0x56')]:undefined)||0xc}];case _0x97bd('0x5c'):return[{'name':_0x97bd('0x5d'),'value':_0x123c1e[_0x97bd('0x5d')]||(_0x123c1e[_0x97bd('0x52')]&&_0x123c1e[_0x97bd('0x52')][0x0]?_0x123c1e['attrs'][0x0][_0x97bd('0x56')]:undefined)||_0x97bd('0x5e')},{'name':_0x97bd('0x5f'),'value':_0x123c1e[_0x97bd('0x5f')]||(_0x123c1e['attrs']&&_0x123c1e['attrs'][0x1]?_0x123c1e[_0x97bd('0x52')][0x1][_0x97bd('0x56')]:undefined)||[]},{'name':_0x97bd('0x5b'),'value':_0x123c1e[_0x97bd('0x5b')]||(_0x123c1e[_0x97bd('0x52')]&&_0x123c1e['attrs'][0x2]?_0x123c1e[_0x97bd('0x52')][0x2]['value']:undefined)||0x14}];case _0x97bd('0x60'):case _0x97bd('0x61'):return[{'name':_0x97bd('0x62'),'value':_0x123c1e[_0x97bd('0x62')]||(_0x123c1e[_0x97bd('0x52')]&&_0x123c1e['attrs'][0x0]?_0x123c1e['attrs'][0x0]['value']:undefined)||'total'},{'name':_0x97bd('0x63'),'value':_0x123c1e[_0x97bd('0x63')]||(_0x123c1e[_0x97bd('0x52')]&&_0x123c1e['attrs'][0x1]?_0x123c1e['attrs'][0x1][_0x97bd('0x56')]:undefined)||null},{'name':_0x97bd('0x64'),'value':_0x123c1e['attrSerie3']||(_0x123c1e[_0x97bd('0x52')]&&_0x123c1e['attrs'][0x2]?_0x123c1e[_0x97bd('0x52')][0x2][_0x97bd('0x56')]:undefined)||null},{'name':_0x97bd('0x5f'),'value':_0x123c1e[_0x97bd('0x5f')]||(_0x123c1e[_0x97bd('0x52')]&&_0x123c1e[_0x97bd('0x52')][0x3]?_0x123c1e[_0x97bd('0x52')][0x3][_0x97bd('0x56')]:undefined)||[]}];case _0x97bd('0x65'):return[{'name':_0x97bd('0x66'),'value':_0x123c1e['attrReport']||(_0x123c1e['attrs']&&_0x123c1e[_0x97bd('0x52')][0x0]?_0x123c1e['attrs'][0x0][_0x97bd('0x56')]:undefined)||null},{'name':_0x97bd('0x67'),'value':_0x123c1e[_0x97bd('0x67')]||(_0x123c1e['attrs']&&_0x123c1e[_0x97bd('0x52')][0x1]?_0x123c1e[_0x97bd('0x52')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x3299f0){logger[_0x97bd('0x26')](_0x97bd('0x68'),JSON[_0x97bd('0x69')](_0x3299f0));return[];}}exports['addItem']=function(_0x54c0c5,_0x1bf590,_0x2b1832){if(_0x54c0c5[_0x97bd('0x49')]['id']){delete _0x54c0c5[_0x97bd('0x49')]['id'];}return db[_0x97bd('0x41')][_0x97bd('0x4e')]({'where':{'id':_0x54c0c5[_0x97bd('0x45')]['id']}})[_0x97bd('0x25')](handleEntityNotFound(_0x1bf590,null))[_0x97bd('0x25')](function(_0x321465){if(_0x321465){_0x54c0c5['body']['DashboardId']=_0x321465['id'];_0x54c0c5[_0x97bd('0x49')][_0x97bd('0x52')]=widgetAttributes(_0x54c0c5[_0x97bd('0x49')]);return db['DashboardItem'][_0x97bd('0x48')](_0x54c0c5[_0x97bd('0x49')]);}})[_0x97bd('0x25')](respondWithResult(_0x1bf590,null))[_0x97bd('0x44')](handleError(_0x1bf590,null));};exports[_0x97bd('0x6a')]=function(_0x41567a,_0x3ac8d7,_0x22ae4f){var _0x114a9b={};var _0x1eb366={};var _0x40e2ab;var _0x2c97a2;return db[_0x97bd('0x41')][_0x97bd('0x6b')]({'where':{'id':_0x41567a[_0x97bd('0x45')]['id']}})[_0x97bd('0x25')](handleEntityNotFound(_0x3ac8d7,null))[_0x97bd('0x25')](function(_0x50eba5){if(_0x50eba5){_0x40e2ab=_0x50eba5;_0x1eb366['model']=_[_0x97bd('0x2d')](db[_0x97bd('0x6c')][_0x97bd('0x2b')]);_0x1eb366[_0x97bd('0x2e')]=_[_0x97bd('0x2d')](_0x41567a[_0x97bd('0x2e')]);_0x1eb366[_0x97bd('0x31')]=_['intersection'](_0x1eb366[_0x97bd('0x2c')],_0x1eb366[_0x97bd('0x2e')]);_0x114a9b[_0x97bd('0x33')]=_[_0x97bd('0x32')](_0x1eb366[_0x97bd('0x2c')],qs[_0x97bd('0x34')](_0x41567a[_0x97bd('0x2e')][_0x97bd('0x34')]));_0x114a9b[_0x97bd('0x33')]=_0x114a9b[_0x97bd('0x33')][_0x97bd('0x35')]?_0x114a9b[_0x97bd('0x33')]:_0x1eb366[_0x97bd('0x2c')];_0x114a9b[_0x97bd('0x38')]=qs['sort'](_0x41567a[_0x97bd('0x2e')][_0x97bd('0x39')]);_0x114a9b['where']=qs[_0x97bd('0x31')](_[_0x97bd('0x6d')](_0x41567a[_0x97bd('0x2e')],_0x1eb366[_0x97bd('0x31')]));if(_0x41567a[_0x97bd('0x2e')]['filter']){_0x114a9b[_0x97bd('0x3a')]=_['merge'](_0x114a9b['where'],{'$or':_['map'](_0x114a9b[_0x97bd('0x33')],function(_0x204cc1){var _0x5394f={};_0x5394f[_0x204cc1]={'$like':'%'+_0x41567a[_0x97bd('0x2e')][_0x97bd('0x3f')]+'%'};return _0x5394f;})});}_0x114a9b=_[_0x97bd('0x3d')]({},_0x114a9b,_0x41567a['options']);return _0x40e2ab[_0x97bd('0x6a')](_0x114a9b);}})['then'](function(_0x4b05ed){if(_0x4b05ed){_0x2c97a2=_0x4b05ed[_0x97bd('0x35')];if(!_0x41567a['query'][_0x97bd('0x36')]('nolimit')){_0x114a9b[_0x97bd('0x1f')]=qs[_0x97bd('0x1f')](_0x41567a[_0x97bd('0x2e')][_0x97bd('0x1f')]);_0x114a9b[_0x97bd('0x1e')]=qs['offset'](_0x41567a['query'][_0x97bd('0x1e')]);}return _0x40e2ab[_0x97bd('0x6a')](_0x114a9b);}})[_0x97bd('0x25')](function(_0x565601){if(_0x565601){return _0x565601?{'count':_0x2c97a2,'rows':_0x565601}:null;}})[_0x97bd('0x25')](respondWithResult(_0x3ac8d7,null))[_0x97bd('0x44')](handleError(_0x3ac8d7,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 7bb6288..032b313 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 _0xb98b=['Dashboard','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0xb98b,0xee));var _0xbb98=function(_0x18514e,_0x551acd){_0x18514e=_0x18514e-0x0;var _0x14fe42=_0xb98b[_0x18514e];return _0x14fe42;};'use strict';var EventEmitter=require(_0xbb98('0x0'));var Dashboard=require(_0xbb98('0x1'))['db'][_0xbb98('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbb98('0x3'),'afterUpdate':_0xbb98('0x4'),'afterDestroy':_0xbb98('0x5')};function emitEvent(_0x20affe){return function(_0x30c675,_0x5411c4,_0xcbfba4){DashboardEvents[_0xbb98('0x6')](_0x20affe+':'+_0x30c675['id'],_0x30c675);DashboardEvents[_0xbb98('0x6')](_0x20affe,_0x30c675);_0xcbfba4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xbb98('0x7')]=DashboardEvents; \ No newline at end of file +var _0x4126=['setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb','Dashboard'];(function(_0x3c151c,_0x3d6b5f){var _0x57948c=function(_0x1147af){while(--_0x1147af){_0x3c151c['push'](_0x3c151c['shift']());}};_0x57948c(++_0x3d6b5f);}(_0x4126,0x1a4));var _0x6412=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x4126[_0x2faddb];return _0x273c05;};'use strict';var EventEmitter=require(_0x6412('0x0'));var Dashboard=require(_0x6412('0x1'))['db'][_0x6412('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x6412('0x3')](0x0);var events={'afterCreate':_0x6412('0x4'),'afterUpdate':_0x6412('0x5'),'afterDestroy':_0x6412('0x6')};function emitEvent(_0x95d244){return function(_0x387937,_0x53d026,_0x6c5306){DashboardEvents['emit'](_0x95d244+':'+_0x387937['id'],_0x387937);DashboardEvents[_0x6412('0x7')](_0x95d244,_0x387937);_0x6c5306(null);};}for(var e in events){if(events[_0x6412('0x8')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index c789401..67f0284 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 _0x3cd0=['define','Dashboard','dashboards','lodash','api','bluebird','request-promise','./dashboard.attributes','exports'];(function(_0x1794d6,_0x193740){var _0x10af9e=function(_0x4295d6){while(--_0x4295d6){_0x1794d6['push'](_0x1794d6['shift']());}};_0x10af9e(++_0x193740);}(_0x3cd0,0x8a));var _0x03cd=function(_0x4382bc,_0x231a2d){_0x4382bc=_0x4382bc-0x0;var _0x13c82a=_0x3cd0[_0x4382bc];return _0x13c82a;};'use strict';var _=require(_0x03cd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x03cd('0x1'));var moment=require('moment');var BPromise=require(_0x03cd('0x2'));var rp=require(_0x03cd('0x3'));var attributes=require(_0x03cd('0x4'));module[_0x03cd('0x5')]=function(_0x3d4a90,_0x5a7068){return _0x3d4a90[_0x03cd('0x6')](_0x03cd('0x7'),attributes,{'tableName':_0x03cd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed03=['exports','define','Dashboard','dashboards','lodash','util','api','request-promise'];(function(_0x168e36,_0x37cbd3){var _0x3be85b=function(_0x250557){while(--_0x250557){_0x168e36['push'](_0x168e36['shift']());}};_0x3be85b(++_0x37cbd3);}(_0xed03,0xdc));var _0x3ed0=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xed03[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x3ed0('0x0'));var util=require(_0x3ed0('0x1'));var logger=require('../../config/logger')(_0x3ed0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3ed0('0x3'));var attributes=require('./dashboard.attributes');module[_0x3ed0('0x4')]=function(_0x47cf4d,_0xbea9e2){return _0x47cf4d[_0x3ed0('0x5')](_0x3ed0('0x6'),attributes,{'tableName':_0x3ed0('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 d115329..98fc30d 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 _0x9af7=['rpc','../../config/environment','jayson/promise','client','http','localhost','./dashboard.socket','register','request','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5b2011,_0x59cd2e){var _0xca3680=function(_0x53f4d9){while(--_0x53f4d9){_0x5b2011['push'](_0x5b2011['shift']());}};_0xca3680(++_0x59cd2e);}(_0x9af7,0x7a));var _0x79af=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9af7[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x79af('0x0'));var util=require(_0x79af('0x1'));var moment=require(_0x79af('0x2'));var BPromise=require(_0x79af('0x3'));var rs=require(_0x79af('0x4'));var fs=require('fs');var db=require(_0x79af('0x5'))['db'];var utils=require(_0x79af('0x6'));var logger=require(_0x79af('0x7'))(_0x79af('0x8'));var config=require(_0x79af('0x9'));var jayson=require(_0x79af('0xa'));var client=jayson[_0x79af('0xb')][_0x79af('0xc')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0x79af('0xd'),'port':0x18eb});require(_0x79af('0xe'))[_0x79af('0xf')](socket);function respondWithRpcPromise(_0x2cb88f,_0x299ac3,_0x5c4b20){return new BPromise(function(_0x33bf67,_0xe17707){return client[_0x79af('0x10')](_0x2cb88f,_0x5c4b20)['then'](function(_0x387993){logger['info'](_0x79af('0x11'),_0x299ac3,_0x79af('0x12'));logger[_0x79af('0x13')](_0x79af('0x14'),_0x299ac3,_0x79af('0x12'),JSON['stringify'](_0x387993));if(_0x387993[_0x79af('0x15')]){if(_0x387993['error'][_0x79af('0x16')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x299ac3,_0x387993[_0x79af('0x15')][_0x79af('0x17')]);return _0xe17707(_0x387993['error'][_0x79af('0x17')]);}logger[_0x79af('0x15')](_0x79af('0x11'),_0x299ac3,_0x387993[_0x79af('0x15')][_0x79af('0x17')]);return _0x33bf67(_0x387993[_0x79af('0x15')][_0x79af('0x17')]);}else{logger['info'](_0x79af('0x11'),_0x299ac3,_0x79af('0x12'));_0x33bf67(_0x387993[_0x79af('0x18')]['message']);}})[_0x79af('0x19')](function(_0x3b39be){logger['error'](_0x79af('0x11'),_0x299ac3,_0x3b39be);_0xe17707(_0x3b39be);});});} \ No newline at end of file +var _0x92a7=['info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','socket.io-emitter','./dashboard.socket','register','request','then'];(function(_0x51335c,_0x4950ea){var _0x3a4360=function(_0x55e526){while(--_0x55e526){_0x51335c['push'](_0x51335c['shift']());}};_0x3a4360(++_0x4950ea);}(_0x92a7,0x11d));var _0x792a=function(_0x3b31bf,_0x541cb8){_0x3b31bf=_0x3b31bf-0x0;var _0xcffe62=_0x92a7[_0x3b31bf];return _0xcffe62;};'use strict';var _=require('lodash');var util=require(_0x792a('0x0'));var moment=require(_0x792a('0x1'));var BPromise=require('bluebird');var rs=require(_0x792a('0x2'));var fs=require('fs');var db=require(_0x792a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x792a('0x4'))(_0x792a('0x5'));var config=require(_0x792a('0x6'));var jayson=require(_0x792a('0x7'));var client=jayson['client'][_0x792a('0x8')]({'port':0x232a});var socket=require(_0x792a('0x9'))({'host':'localhost','port':0x18eb});require(_0x792a('0xa'))[_0x792a('0xb')](socket);function respondWithRpcPromise(_0x48ce35,_0x9cf2f3,_0x58d2fd){return new BPromise(function(_0x2e30f1,_0xdf1744){return client[_0x792a('0xc')](_0x48ce35,_0x58d2fd)[_0x792a('0xd')](function(_0x152b55){logger[_0x792a('0xe')](_0x792a('0xf'),_0x9cf2f3,_0x792a('0x10'));logger[_0x792a('0x11')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x9cf2f3,_0x792a('0x10'),JSON['stringify'](_0x152b55));if(_0x152b55[_0x792a('0x12')]){if(_0x152b55['error'][_0x792a('0x13')]===0x1f4){logger[_0x792a('0x12')](_0x792a('0xf'),_0x9cf2f3,_0x152b55[_0x792a('0x12')][_0x792a('0x14')]);return _0xdf1744(_0x152b55[_0x792a('0x12')][_0x792a('0x14')]);}logger['error'](_0x792a('0xf'),_0x9cf2f3,_0x152b55['error'][_0x792a('0x14')]);return _0x2e30f1(_0x152b55[_0x792a('0x12')]['message']);}else{logger[_0x792a('0xe')](_0x792a('0xf'),_0x9cf2f3,_0x792a('0x10'));_0x2e30f1(_0x152b55[_0x792a('0x15')]['message']);}})[_0x792a('0x16')](function(_0x1b8f9d){logger['error'](_0x792a('0xf'),_0x9cf2f3,_0x1b8f9d);_0xdf1744(_0x1b8f9d);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 67222f4..1a59134 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 _0xa07e=['save','remove','removeListener','length','./dashboard.events'];(function(_0x3fbeea,_0x59b594){var _0x479753=function(_0x2d874d){while(--_0x2d874d){_0x3fbeea['push'](_0x3fbeea['shift']());}};_0x479753(++_0x59b594);}(_0xa07e,0x10d));var _0xea07=function(_0x1f7ecc,_0x5e12fc){_0x1f7ecc=_0x1f7ecc-0x0;var _0x285151=_0xa07e[_0x1f7ecc];return _0x285151;};'use strict';var DashboardEvents=require(_0xea07('0x0'));var events=[_0xea07('0x1'),_0xea07('0x2'),'update'];function createListener(_0x5eefb9,_0x41fb56){return function(_0x1aa67f){_0x41fb56['emit'](_0x5eefb9,_0x1aa67f);};}function removeListener(_0x521e71,_0xbf50a3){return function(){DashboardEvents[_0xea07('0x3')](_0x521e71,_0xbf50a3);};}exports['register']=function(_0x170684){for(var _0x374cab=0x0,_0x2d9a90=events[_0xea07('0x4')];_0x374cab<_0x2d9a90;_0x374cab++){var _0x3165f4=events[_0x374cab];var _0x5f35d3=createListener('dashboard:'+_0x3165f4,_0x170684);DashboardEvents['on'](_0x3165f4,_0x5f35d3);}}; \ No newline at end of file +var _0x374b=['emit','removeListener','register','length','save','update'];(function(_0x22d1ef,_0x5e45ae){var _0x3fd819=function(_0x55899a){while(--_0x55899a){_0x22d1ef['push'](_0x22d1ef['shift']());}};_0x3fd819(++_0x5e45ae);}(_0x374b,0x130));var _0xb374=function(_0x56904b,_0x5e971f){_0x56904b=_0x56904b-0x0;var _0x34cd51=_0x374b[_0x56904b];return _0x34cd51;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xb374('0x0'),'remove',_0xb374('0x1')];function createListener(_0x52d34e,_0x3de34c){return function(_0x1b26b1){_0x3de34c[_0xb374('0x2')](_0x52d34e,_0x1b26b1);};}function removeListener(_0x288414,_0x25943b){return function(){DashboardEvents[_0xb374('0x3')](_0x288414,_0x25943b);};}exports[_0xb374('0x4')]=function(_0x32b331){for(var _0x1e0f56=0x0,_0x49a6d4=events[_0xb374('0x5')];_0x1e0f56<_0x49a6d4;_0x1e0f56++){var _0x221699=events[_0x1e0f56];var _0x139f61=createListener('dashboard:'+_0x221699,_0x32b331);DashboardEvents['on'](_0x221699,_0x139f61);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 14040ee..276f232 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 _0x9ec0=['index','/:id','show','/:id/items','post','create','/:id/clone','update','delete','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x534cd7,_0x574fd5){var _0x25a9a2=function(_0x33bef3){while(--_0x33bef3){_0x534cd7['push'](_0x534cd7['shift']());}};_0x25a9a2(++_0x574fd5);}(_0x9ec0,0x1bf));var _0x09ec=function(_0x40ad05,_0x18c3ae){_0x40ad05=_0x40ad05-0x0;var _0x5cc00f=_0x9ec0[_0x40ad05];return _0x5cc00f;};'use strict';var multer=require(_0x09ec('0x0'));var util=require(_0x09ec('0x1'));var path=require(_0x09ec('0x2'));var express=require(_0x09ec('0x3'));var router=express[_0x09ec('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x09ec('0x5'));var config=require(_0x09ec('0x6'));var controller=require('./dashboard.controller');router[_0x09ec('0x7')]('/',auth[_0x09ec('0x8')](),controller[_0x09ec('0x9')]);router[_0x09ec('0x7')](_0x09ec('0xa'),auth[_0x09ec('0x8')](),controller[_0x09ec('0xb')]);router[_0x09ec('0x7')](_0x09ec('0xc'),auth[_0x09ec('0x8')](),controller['getItems']);router[_0x09ec('0xd')]('/',auth[_0x09ec('0x8')](),controller[_0x09ec('0xe')]);router[_0x09ec('0xd')](_0x09ec('0xf'),auth[_0x09ec('0x8')](),controller['clone']);router['post'](_0x09ec('0xc'),auth[_0x09ec('0x8')](),controller['addItem']);router['put']('/:id',auth[_0x09ec('0x8')](),controller[_0x09ec('0x10')]);router[_0x09ec('0x11')](_0x09ec('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x09ec('0x12')]=router; \ No newline at end of file +var _0x9b4d=['../../config/environment','get','isAuthenticated','/:id/items','getItems','create','/:id/clone','post','addItem','put','/:id','delete','destroy','exports','util','path','Router','../../components/interaction/service'];(function(_0x3ba924,_0x3b99f0){var _0x4cc1df=function(_0x15bf28){while(--_0x15bf28){_0x3ba924['push'](_0x3ba924['shift']());}};_0x4cc1df(++_0x3b99f0);}(_0x9b4d,0x10a));var _0xd9b4=function(_0x3411a4,_0x60d585){_0x3411a4=_0x3411a4-0x0;var _0x4eb325=_0x9b4d[_0x3411a4];return _0x4eb325;};'use strict';var multer=require('multer');var util=require(_0xd9b4('0x0'));var path=require(_0xd9b4('0x1'));var express=require('express');var router=express[_0xd9b4('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xd9b4('0x3'));var config=require(_0xd9b4('0x4'));var controller=require('./dashboard.controller');router[_0xd9b4('0x5')]('/',auth[_0xd9b4('0x6')](),controller['index']);router[_0xd9b4('0x5')]('/:id',auth[_0xd9b4('0x6')](),controller['show']);router[_0xd9b4('0x5')](_0xd9b4('0x7'),auth[_0xd9b4('0x6')](),controller[_0xd9b4('0x8')]);router['post']('/',auth[_0xd9b4('0x6')](),controller[_0xd9b4('0x9')]);router['post'](_0xd9b4('0xa'),auth[_0xd9b4('0x6')](),controller['clone']);router[_0xd9b4('0xb')](_0xd9b4('0x7'),auth[_0xd9b4('0x6')](),controller[_0xd9b4('0xc')]);router[_0xd9b4('0xd')](_0xd9b4('0xe'),auth[_0xd9b4('0x6')](),controller['update']);router[_0xd9b4('0xf')]('/:id',auth[_0xd9b4('0x6')](),controller[_0xd9b4('0x10')]);module[_0xd9b4('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 2b39449..0cfbb5d 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 _0x020a=['INTEGER','#ffffff','sequelize','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue'];(function(_0x3b0b91,_0x5bdb01){var _0x24950a=function(_0x1af66f){while(--_0x1af66f){_0x3b0b91['push'](_0x3b0b91['shift']());}};_0x24950a(++_0x5bdb01);}(_0x020a,0xdf));var _0xa020=function(_0x450689,_0x3b857c){_0x450689=_0x450689-0x0;var _0x46ffb0=_0x020a[_0x450689];return _0x46ffb0;};'use strict';var Sequelize=require(_0xa020('0x0'));var squel=require('squel');var _=require(_0xa020('0x1'));module[_0xa020('0x2')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xa020('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xa020('0x4')](_0xa020('0x5')),'get':function(){try{return JSON[_0xa020('0x6')](this[_0xa020('0x7')](_0xa020('0x8')));}catch(_0x47b091){return[];}},'set':function(_0x5834af){try{this['setDataValue'](_0xa020('0x8'),JSON[_0xa020('0x9')](_0x5834af));}catch(_0x33e296){this[_0xa020('0xa')](_0xa020('0x8'),JSON[_0xa020('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xa020('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0xa020('0xb')]},'background':{'type':Sequelize[_0xa020('0x3')],'allowNull':![],'defaultValue':_0xa020('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xa020('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xa020('0x3')]}}; \ No newline at end of file +var _0x8b53=['lodash','TEXT','long','parse','attrs','setDataValue','stringify','INTEGER','STRING','#ffffff','#2196f3','sequelize','squel'];(function(_0x15f392,_0x13405f){var _0x2f369f=function(_0x103895){while(--_0x103895){_0x15f392['push'](_0x15f392['shift']());}};_0x2f369f(++_0x13405f);}(_0x8b53,0x80));var _0x38b5=function(_0x226a3c,_0x2daf63){_0x226a3c=_0x226a3c-0x0;var _0x509351=_0x8b53[_0x226a3c];return _0x509351;};'use strict';var Sequelize=require(_0x38b5('0x0'));var squel=require(_0x38b5('0x1'));var _=require(_0x38b5('0x2'));module['exports']={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x38b5('0x3')](_0x38b5('0x4')),'get':function(){try{return JSON[_0x38b5('0x5')](this['getDataValue'](_0x38b5('0x6')));}catch(_0x48ea92){return[];}},'set':function(_0x535529){try{this[_0x38b5('0x7')]('attrs',JSON[_0x38b5('0x8')](_0x535529));}catch(_0x9e9a73){this['setDataValue'](_0x38b5('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x38b5('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x38b5('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x38b5('0x9')]},'background':{'type':Sequelize[_0x38b5('0xa')],'allowNull':![],'defaultValue':_0x38b5('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x38b5('0xa')],'allowNull':![],'defaultValue':_0x38b5('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 90a7210..d2ceaf7 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 _0x98d5=['multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','create','body','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','params','model','keys','rawAttributes','query','filters','intersection','attributes','length','includeAll','include','merge','options','DashboardItem','find','catch','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','total','attrVoiceQueues'];(function(_0xfc0bc,_0x432c2e){var _0x2d9484=function(_0x1474da){while(--_0x1474da){_0xfc0bc['push'](_0xfc0bc['shift']());}};_0x2d9484(++_0x432c2e);}(_0x98d5,0x1d8));var _0x598d=function(_0x4aa3ae,_0x4e60c9){_0x4aa3ae=_0x4aa3ae-0x0;var _0x130c6c=_0x98d5[_0x4aa3ae];return _0x130c6c;};'use strict';var jsonpatch=require(_0x598d('0x0'));var rp=require(_0x598d('0x1'));var moment=require(_0x598d('0x2'));var BPromise=require(_0x598d('0x3'));var Mustache=require('mustache');var util=require(_0x598d('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x598d('0x5'));var ejs=require(_0x598d('0x6'));var fs=require('fs');var _=require(_0x598d('0x7'));var squel=require('squel');var crypto=require(_0x598d('0x8'));var jsforce=require(_0x598d('0x9'));var deskjs=require(_0x598d('0xa'));var toCsv=require('to-csv');var querystring=require(_0x598d('0xb'));var Papa=require(_0x598d('0xc'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x598d('0xd'));var utils=require(_0x598d('0xe'));var config=require(_0x598d('0xf'));var db=require(_0x598d('0x10'))['db'];var socket=require(_0x598d('0x11'))({'host':'localhost','port':0x18eb});require(_0x598d('0x12'))['register'](socket);function respondWithStatusCode(_0x7c0da6,_0x4745b8){_0x4745b8=_0x4745b8||0xcc;return function(_0x2b38d4){if(_0x2b38d4){return _0x7c0da6[_0x598d('0x13')](_0x4745b8);}return _0x7c0da6[_0x598d('0x14')](_0x4745b8)[_0x598d('0x15')]();};}function respondWithResult(_0x1a242e,_0x387841){_0x387841=_0x387841||0xc8;return function(_0x2a9ddf){if(_0x2a9ddf){return _0x1a242e[_0x598d('0x14')](_0x387841)[_0x598d('0x16')](_0x2a9ddf);}};}function respondWithFilteredResult(_0x1af83a,_0xd573ee){return function(_0x409d1e){if(_0x409d1e){var _0x34be05=_0x409d1e[_0x598d('0x17')],_0x52af2d=_0xd573ee[_0x598d('0x18')],_0x43b80f=_0xd573ee[_0x598d('0x18')]+_0xd573ee[_0x598d('0x19')],_0x17f4e3;if(_0x43b80f>=_0x34be05){_0x43b80f=_0x34be05;_0x17f4e3=0xc8;}else{_0x17f4e3=0xce;}_0x1af83a['status'](_0x17f4e3);return _0x1af83a[_0x598d('0x1a')]('Content-Range',_0x52af2d+'-'+_0x43b80f+'/'+_0x34be05)[_0x598d('0x16')](_0x409d1e);}return null;};}function patchUpdates(_0x4eb54d){return function(_0x5101af){try{jsonpatch[_0x598d('0x1b')](_0x5101af,_0x4eb54d,!![]);}catch(_0x59f947){return BPromise[_0x598d('0x1c')](_0x59f947);}return _0x5101af[_0x598d('0x1d')]();};}function saveUpdates(_0x586a53,_0x54e1f3){return function(_0x4fa550){if(_0x4fa550){return _0x4fa550[_0x598d('0x1e')](_0x586a53)['then'](function(_0x5ede35){return _0x5ede35;});}return null;};}function removeEntity(_0x4b5586,_0x3ffbfa){return function(_0xaf9437){if(_0xaf9437){return _0xaf9437['destroy']()[_0x598d('0x1f')](function(){_0x4b5586['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x188506,_0x3cbef3){return function(_0x108a01){if(!_0x108a01){_0x188506[_0x598d('0x13')](0x194);}return _0x108a01;};}function handleError(_0x12674c,_0x50c8c3){_0x50c8c3=_0x50c8c3||0x1f4;return function(_0x49ce4b){logger[_0x598d('0x20')](_0x49ce4b[_0x598d('0x21')]);if(_0x49ce4b[_0x598d('0x22')]){delete _0x49ce4b[_0x598d('0x22')];}_0x12674c['status'](_0x50c8c3)[_0x598d('0x23')](_0x49ce4b);};}exports['show']=function(_0x5ee13d,_0x234dc0){var _0x410bc7={'raw':![],'where':{'id':_0x5ee13d[_0x598d('0x24')]['id']}},_0x400ce8={};_0x400ce8[_0x598d('0x25')]=_[_0x598d('0x26')](db['DashboardItem'][_0x598d('0x27')]);_0x400ce8[_0x598d('0x28')]=_[_0x598d('0x26')](_0x5ee13d['query']);_0x400ce8[_0x598d('0x29')]=_[_0x598d('0x2a')](_0x400ce8[_0x598d('0x25')],_0x400ce8[_0x598d('0x28')]);_0x410bc7['attributes']=_[_0x598d('0x2a')](_0x400ce8['model'],qs['fields'](_0x5ee13d[_0x598d('0x28')]['fields']));_0x410bc7[_0x598d('0x2b')]=_0x410bc7[_0x598d('0x2b')][_0x598d('0x2c')]?_0x410bc7[_0x598d('0x2b')]:_0x400ce8[_0x598d('0x25')];if(_0x5ee13d['query'][_0x598d('0x2d')]){_0x410bc7[_0x598d('0x2e')]=[{'all':!![]}];}_0x410bc7=_[_0x598d('0x2f')]({},_0x410bc7,_0x5ee13d[_0x598d('0x30')]);return db[_0x598d('0x31')][_0x598d('0x32')](_0x410bc7)[_0x598d('0x1f')](handleEntityNotFound(_0x234dc0,null))[_0x598d('0x1f')](respondWithResult(_0x234dc0,null))[_0x598d('0x33')](handleError(_0x234dc0,null));};exports['destroy']=function(_0x38af89,_0x29ce45){return db[_0x598d('0x31')]['find']({'where':{'id':_0x38af89['params']['id']}})[_0x598d('0x1f')](handleEntityNotFound(_0x29ce45,null))[_0x598d('0x1f')](removeEntity(_0x29ce45,null))[_0x598d('0x33')](handleError(_0x29ce45,null));};function widgetAttributes(_0x4e5ca6){try{switch(_0x4e5ca6[_0x598d('0x34')]){case _0x598d('0x35'):return[{'name':_0x598d('0x36'),'value':_0x4e5ca6[_0x598d('0x36')]||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6[_0x598d('0x37')][0x0]?_0x4e5ca6['attrs'][0x0][_0x598d('0x38')]:undefined)||_0x598d('0x39')}];case'custom':return[{'name':'attrPath','value':_0x4e5ca6[_0x598d('0x3a')]||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6[_0x598d('0x37')][0x0]?_0x4e5ca6[_0x598d('0x37')][0x0][_0x598d('0x38')]:undefined)||''}];case _0x598d('0x3b'):return[{'name':_0x598d('0x3c'),'value':_0x4e5ca6['attrHourFormat']||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6[_0x598d('0x37')][0x0]?_0x4e5ca6[_0x598d('0x37')][0x0]['value']:undefined)||_0x598d('0x3d')},{'name':_0x598d('0x3e'),'value':_0x4e5ca6['attrTimezone']||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6[_0x598d('0x37')][0x1]?_0x4e5ca6[_0x598d('0x37')][0x1][_0x598d('0x38')]:undefined)||_0x598d('0x3f')},{'name':'attrFontSize','value':_0x4e5ca6[_0x598d('0x40')]||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6['attrs'][0x2]?_0x4e5ca6['attrs'][0x2][_0x598d('0x38')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x4e5ca6['attrMetric']||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6[_0x598d('0x37')][0x0]?_0x4e5ca6[_0x598d('0x37')][0x0][_0x598d('0x38')]:undefined)||_0x598d('0x41')},{'name':'attrVoiceQueues','value':_0x4e5ca6[_0x598d('0x42')]||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6[_0x598d('0x37')][0x1]?_0x4e5ca6['attrs'][0x1]['value']:undefined)||[]},{'name':_0x598d('0x40'),'value':_0x4e5ca6[_0x598d('0x40')]||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6['attrs'][0x2]?_0x4e5ca6[_0x598d('0x37')][0x2][_0x598d('0x38')]:undefined)||0x14}];case _0x598d('0x43'):case'pie-chart':return[{'name':_0x598d('0x44'),'value':_0x4e5ca6[_0x598d('0x44')]||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6[_0x598d('0x37')][0x0]?_0x4e5ca6[_0x598d('0x37')][0x0]['value']:undefined)||'total'},{'name':_0x598d('0x45'),'value':_0x4e5ca6[_0x598d('0x45')]||(_0x4e5ca6['attrs']&&_0x4e5ca6['attrs'][0x1]?_0x4e5ca6['attrs'][0x1]['value']:undefined)||null},{'name':_0x598d('0x46'),'value':_0x4e5ca6[_0x598d('0x46')]||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6[_0x598d('0x37')][0x2]?_0x4e5ca6[_0x598d('0x37')][0x2][_0x598d('0x38')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x4e5ca6['attrVoiceQueues']||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6[_0x598d('0x37')][0x3]?_0x4e5ca6['attrs'][0x3][_0x598d('0x38')]:undefined)||[]}];case _0x598d('0x47'):return[{'name':_0x598d('0x48'),'value':_0x4e5ca6[_0x598d('0x48')]||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6[_0x598d('0x37')][0x0]?_0x4e5ca6[_0x598d('0x37')][0x0][_0x598d('0x38')]:undefined)||null},{'name':_0x598d('0x49'),'value':_0x4e5ca6[_0x598d('0x49')]||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6[_0x598d('0x37')][0x1]?_0x4e5ca6['attrs'][0x1][_0x598d('0x38')]:undefined)||0x0}];default:return[];}}catch(_0x5ceeb6){logger[_0x598d('0x20')](_0x598d('0x4a'),JSON['stringify'](_0x5ceeb6));return[];}}exports[_0x598d('0x4b')]=function(_0xfe2c28,_0x45696f){if(_0xfe2c28[_0x598d('0x4c')]){_0xfe2c28[_0x598d('0x4c')]['attrs']=widgetAttributes(_0xfe2c28['body']);}return db[_0x598d('0x31')][_0x598d('0x4b')](_0xfe2c28[_0x598d('0x4c')],{})[_0x598d('0x1f')](respondWithResult(_0x45696f,0xc9))['catch'](handleError(_0x45696f,null));};exports[_0x598d('0x1e')]=function(_0x13ba09,_0x275343){if(_0x13ba09[_0x598d('0x4c')]['id']){delete _0x13ba09[_0x598d('0x4c')]['id'];}_0x13ba09[_0x598d('0x4c')][_0x598d('0x37')]=widgetAttributes(_0x13ba09['body']);return db[_0x598d('0x31')][_0x598d('0x32')]({'where':{'id':_0x13ba09[_0x598d('0x24')]['id']}})['then'](handleEntityNotFound(_0x275343,null))[_0x598d('0x1f')](saveUpdates(_0x13ba09[_0x598d('0x4c')],null))[_0x598d('0x1f')](respondWithResult(_0x275343,null))['catch'](handleError(_0x275343,null));}; \ No newline at end of file +var _0xd176=['attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','error','widgetAttributes:\x20%s','create','body','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./dashboardItem.socket','register','sendStatus','status','end','json','count','set','Content-Range','apply','reject','save','update','then','stack','name','show','params','model','keys','rawAttributes','query','filters','fields','attributes','length','merge','DashboardItem','catch','find','type','iframe','attrUrl'];(function(_0x2e8d40,_0x19b45d){var _0x3a4195=function(_0x4f04bd){while(--_0x4f04bd){_0x2e8d40['push'](_0x2e8d40['shift']());}};_0x3a4195(++_0x19b45d);}(_0xd176,0x10c));var _0x6d17=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0xd176[_0x20c9b2];return _0x2c6030;};'use strict';var jsonpatch=require(_0x6d17('0x0'));var rp=require(_0x6d17('0x1'));var moment=require(_0x6d17('0x2'));var BPromise=require(_0x6d17('0x3'));var Mustache=require(_0x6d17('0x4'));var util=require(_0x6d17('0x5'));var path=require(_0x6d17('0x6'));var sox=require(_0x6d17('0x7'));var csv=require(_0x6d17('0x8'));var ejs=require(_0x6d17('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6d17('0xa'));var crypto=require(_0x6d17('0xb'));var jsforce=require(_0x6d17('0xc'));var deskjs=require(_0x6d17('0xd'));var toCsv=require(_0x6d17('0x8'));var querystring=require(_0x6d17('0xe'));var Papa=require(_0x6d17('0xf'));var qs=require(_0x6d17('0x10'));var logger=require(_0x6d17('0x11'))('api');var utils=require(_0x6d17('0x12'));var config=require(_0x6d17('0x13'));var db=require(_0x6d17('0x14'))['db'];var socket=require(_0x6d17('0x15'))({'host':_0x6d17('0x16'),'port':0x18eb});require(_0x6d17('0x17'))[_0x6d17('0x18')](socket);function respondWithStatusCode(_0x4713c1,_0x465351){_0x465351=_0x465351||0xcc;return function(_0x149c40){if(_0x149c40){return _0x4713c1[_0x6d17('0x19')](_0x465351);}return _0x4713c1[_0x6d17('0x1a')](_0x465351)[_0x6d17('0x1b')]();};}function respondWithResult(_0x51ed7f,_0x10aaa3){_0x10aaa3=_0x10aaa3||0xc8;return function(_0x2ecf0e){if(_0x2ecf0e){return _0x51ed7f[_0x6d17('0x1a')](_0x10aaa3)[_0x6d17('0x1c')](_0x2ecf0e);}};}function respondWithFilteredResult(_0x55d231,_0x5deca5){return function(_0x2fa715){if(_0x2fa715){var _0x465c88=_0x2fa715[_0x6d17('0x1d')],_0x349f13=_0x5deca5['offset'],_0x2680f0=_0x5deca5['offset']+_0x5deca5['limit'],_0x2bf040;if(_0x2680f0>=_0x465c88){_0x2680f0=_0x465c88;_0x2bf040=0xc8;}else{_0x2bf040=0xce;}_0x55d231[_0x6d17('0x1a')](_0x2bf040);return _0x55d231[_0x6d17('0x1e')](_0x6d17('0x1f'),_0x349f13+'-'+_0x2680f0+'/'+_0x465c88)['json'](_0x2fa715);}return null;};}function patchUpdates(_0x352d21){return function(_0x59d6f0){try{jsonpatch[_0x6d17('0x20')](_0x59d6f0,_0x352d21,!![]);}catch(_0x50991c){return BPromise[_0x6d17('0x21')](_0x50991c);}return _0x59d6f0[_0x6d17('0x22')]();};}function saveUpdates(_0x535b0b,_0x23b8c4){return function(_0x2e90de){if(_0x2e90de){return _0x2e90de[_0x6d17('0x23')](_0x535b0b)[_0x6d17('0x24')](function(_0x20862b){return _0x20862b;});}return null;};}function removeEntity(_0x1685db,_0x48396e){return function(_0x3e0335){if(_0x3e0335){return _0x3e0335['destroy']()[_0x6d17('0x24')](function(){_0x1685db[_0x6d17('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c214d,_0x32e1fc){return function(_0x472356){if(!_0x472356){_0x3c214d['sendStatus'](0x194);}return _0x472356;};}function handleError(_0x2f9cb4,_0x49a408){_0x49a408=_0x49a408||0x1f4;return function(_0x4ab719){logger['error'](_0x4ab719[_0x6d17('0x25')]);if(_0x4ab719[_0x6d17('0x26')]){delete _0x4ab719[_0x6d17('0x26')];}_0x2f9cb4[_0x6d17('0x1a')](_0x49a408)['send'](_0x4ab719);};}exports[_0x6d17('0x27')]=function(_0x5d2435,_0x4a542b){var _0x36ac4b={'raw':![],'where':{'id':_0x5d2435[_0x6d17('0x28')]['id']}},_0x57fe47={};_0x57fe47[_0x6d17('0x29')]=_[_0x6d17('0x2a')](db['DashboardItem'][_0x6d17('0x2b')]);_0x57fe47[_0x6d17('0x2c')]=_[_0x6d17('0x2a')](_0x5d2435['query']);_0x57fe47[_0x6d17('0x2d')]=_['intersection'](_0x57fe47[_0x6d17('0x29')],_0x57fe47[_0x6d17('0x2c')]);_0x36ac4b['attributes']=_['intersection'](_0x57fe47['model'],qs[_0x6d17('0x2e')](_0x5d2435[_0x6d17('0x2c')][_0x6d17('0x2e')]));_0x36ac4b[_0x6d17('0x2f')]=_0x36ac4b[_0x6d17('0x2f')][_0x6d17('0x30')]?_0x36ac4b['attributes']:_0x57fe47[_0x6d17('0x29')];if(_0x5d2435[_0x6d17('0x2c')]['includeAll']){_0x36ac4b['include']=[{'all':!![]}];}_0x36ac4b=_[_0x6d17('0x31')]({},_0x36ac4b,_0x5d2435['options']);return db[_0x6d17('0x32')]['find'](_0x36ac4b)[_0x6d17('0x24')](handleEntityNotFound(_0x4a542b,null))['then'](respondWithResult(_0x4a542b,null))[_0x6d17('0x33')](handleError(_0x4a542b,null));};exports['destroy']=function(_0x27d22c,_0x5c7919){return db[_0x6d17('0x32')][_0x6d17('0x34')]({'where':{'id':_0x27d22c[_0x6d17('0x28')]['id']}})[_0x6d17('0x24')](handleEntityNotFound(_0x5c7919,null))[_0x6d17('0x24')](removeEntity(_0x5c7919,null))['catch'](handleError(_0x5c7919,null));};function widgetAttributes(_0x5db43e){try{switch(_0x5db43e[_0x6d17('0x35')]){case _0x6d17('0x36'):return[{'name':_0x6d17('0x37'),'value':_0x5db43e[_0x6d17('0x37')]||(_0x5db43e[_0x6d17('0x38')]&&_0x5db43e[_0x6d17('0x38')][0x0]?_0x5db43e['attrs'][0x0][_0x6d17('0x39')]:undefined)||_0x6d17('0x3a')}];case'custom':return[{'name':_0x6d17('0x3b'),'value':_0x5db43e[_0x6d17('0x3b')]||(_0x5db43e[_0x6d17('0x38')]&&_0x5db43e[_0x6d17('0x38')][0x0]?_0x5db43e[_0x6d17('0x38')][0x0][_0x6d17('0x39')]:undefined)||''}];case _0x6d17('0x3c'):return[{'name':_0x6d17('0x3d'),'value':_0x5db43e[_0x6d17('0x3d')]||(_0x5db43e['attrs']&&_0x5db43e[_0x6d17('0x38')][0x0]?_0x5db43e[_0x6d17('0x38')][0x0]['value']:undefined)||_0x6d17('0x3e')},{'name':'attrTimezone','value':_0x5db43e['attrTimezone']||(_0x5db43e['attrs']&&_0x5db43e[_0x6d17('0x38')][0x1]?_0x5db43e[_0x6d17('0x38')][0x1]['value']:undefined)||_0x6d17('0x3f')},{'name':_0x6d17('0x40'),'value':_0x5db43e[_0x6d17('0x40')]||(_0x5db43e[_0x6d17('0x38')]&&_0x5db43e[_0x6d17('0x38')][0x2]?_0x5db43e[_0x6d17('0x38')][0x2][_0x6d17('0x39')]:undefined)||0xc}];case _0x6d17('0x41'):return[{'name':_0x6d17('0x42'),'value':_0x5db43e[_0x6d17('0x42')]||(_0x5db43e[_0x6d17('0x38')]&&_0x5db43e[_0x6d17('0x38')][0x0]?_0x5db43e['attrs'][0x0][_0x6d17('0x39')]:undefined)||'total'},{'name':_0x6d17('0x43'),'value':_0x5db43e[_0x6d17('0x43')]||(_0x5db43e[_0x6d17('0x38')]&&_0x5db43e[_0x6d17('0x38')][0x1]?_0x5db43e[_0x6d17('0x38')][0x1][_0x6d17('0x39')]:undefined)||[]},{'name':'attrFontSize','value':_0x5db43e[_0x6d17('0x40')]||(_0x5db43e[_0x6d17('0x38')]&&_0x5db43e[_0x6d17('0x38')][0x2]?_0x5db43e[_0x6d17('0x38')][0x2][_0x6d17('0x39')]:undefined)||0x14}];case _0x6d17('0x44'):case _0x6d17('0x45'):return[{'name':_0x6d17('0x46'),'value':_0x5db43e['attrSerie1']||(_0x5db43e[_0x6d17('0x38')]&&_0x5db43e[_0x6d17('0x38')][0x0]?_0x5db43e[_0x6d17('0x38')][0x0]['value']:undefined)||_0x6d17('0x47')},{'name':_0x6d17('0x48'),'value':_0x5db43e[_0x6d17('0x48')]||(_0x5db43e[_0x6d17('0x38')]&&_0x5db43e[_0x6d17('0x38')][0x1]?_0x5db43e['attrs'][0x1][_0x6d17('0x39')]:undefined)||null},{'name':_0x6d17('0x49'),'value':_0x5db43e[_0x6d17('0x49')]||(_0x5db43e[_0x6d17('0x38')]&&_0x5db43e['attrs'][0x2]?_0x5db43e[_0x6d17('0x38')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x5db43e[_0x6d17('0x43')]||(_0x5db43e[_0x6d17('0x38')]&&_0x5db43e[_0x6d17('0x38')][0x3]?_0x5db43e[_0x6d17('0x38')][0x3][_0x6d17('0x39')]:undefined)||[]}];case _0x6d17('0x4a'):return[{'name':'attrReport','value':_0x5db43e[_0x6d17('0x4b')]||(_0x5db43e[_0x6d17('0x38')]&&_0x5db43e[_0x6d17('0x38')][0x0]?_0x5db43e['attrs'][0x0][_0x6d17('0x39')]:undefined)||null},{'name':_0x6d17('0x4c'),'value':_0x5db43e[_0x6d17('0x4c')]||(_0x5db43e[_0x6d17('0x38')]&&_0x5db43e[_0x6d17('0x38')][0x1]?_0x5db43e[_0x6d17('0x38')][0x1][_0x6d17('0x39')]:undefined)||0x0}];default:return[];}}catch(_0x183f30){logger[_0x6d17('0x4d')](_0x6d17('0x4e'),JSON['stringify'](_0x183f30));return[];}}exports[_0x6d17('0x4f')]=function(_0x31f0af,_0x12d0ee){if(_0x31f0af[_0x6d17('0x50')]){_0x31f0af[_0x6d17('0x50')][_0x6d17('0x38')]=widgetAttributes(_0x31f0af[_0x6d17('0x50')]);}return db[_0x6d17('0x32')][_0x6d17('0x4f')](_0x31f0af[_0x6d17('0x50')],{})[_0x6d17('0x24')](respondWithResult(_0x12d0ee,0xc9))[_0x6d17('0x33')](handleError(_0x12d0ee,null));};exports[_0x6d17('0x23')]=function(_0x1e5f15,_0x167b8a){if(_0x1e5f15[_0x6d17('0x50')]['id']){delete _0x1e5f15['body']['id'];}_0x1e5f15[_0x6d17('0x50')][_0x6d17('0x38')]=widgetAttributes(_0x1e5f15[_0x6d17('0x50')]);return db[_0x6d17('0x32')][_0x6d17('0x34')]({'where':{'id':_0x1e5f15[_0x6d17('0x28')]['id']}})['then'](handleEntityNotFound(_0x167b8a,null))[_0x6d17('0x24')](saveUpdates(_0x1e5f15[_0x6d17('0x50')],null))['then'](respondWithResult(_0x167b8a,null))[_0x6d17('0x33')](handleError(_0x167b8a,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 222bd42..4414bfd 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 _0xf213=['remove','emit','hook','exports','events','save','update'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf213,0x162));var _0x3f21=function(_0x20c3ae,_0x37eae0){_0x20c3ae=_0x20c3ae-0x0;var _0x3946a9=_0xf213[_0x20c3ae];return _0x3946a9;};'use strict';var EventEmitter=require(_0x3f21('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3f21('0x1'),'afterUpdate':_0x3f21('0x2'),'afterDestroy':_0x3f21('0x3')};function emitEvent(_0x455024){return function(_0x14f92c,_0x301244,_0x3b025d){DashboardItemEvents[_0x3f21('0x4')](_0x455024+':'+_0x14f92c['id'],_0x14f92c);DashboardItemEvents[_0x3f21('0x4')](_0x455024,_0x14f92c);_0x3b025d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x3f21('0x5')](e,emitEvent(event));}}module[_0x3f21('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0xcba3=['events','DashboardItem','setMaxListeners','save','emit','hasOwnProperty','exports'];(function(_0x14e244,_0x1e1445){var _0xeaa5b6=function(_0x571563){while(--_0x571563){_0x14e244['push'](_0x14e244['shift']());}};_0xeaa5b6(++_0x1e1445);}(_0xcba3,0xaf));var _0x3cba=function(_0x567ba0,_0x212f96){_0x567ba0=_0x567ba0-0x0;var _0x46c5af=_0xcba3[_0x567ba0];return _0x46c5af;};'use strict';var EventEmitter=require(_0x3cba('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x3cba('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x3cba('0x2')](0x0);var events={'afterCreate':_0x3cba('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x27e7a3){return function(_0x2fa502,_0x287c93,_0x33dbea){DashboardItemEvents[_0x3cba('0x4')](_0x27e7a3+':'+_0x2fa502['id'],_0x2fa502);DashboardItemEvents[_0x3cba('0x4')](_0x27e7a3,_0x2fa502);_0x33dbea(null);};}for(var e in events){if(events[_0x3cba('0x5')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x3cba('0x6')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 4218d1d..0ec3f4e 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(_0x1ccf3d,_0x461209){var _0x5345c1=function(_0x55c638){while(--_0x55c638){_0x1ccf3d['push'](_0x1ccf3d['shift']());}};_0x5345c1(++_0x461209);}(_0x7a54,0x106));var _0x47a5=function(_0x1c83fb,_0x385d4f){_0x1c83fb=_0x1c83fb-0x0;var _0x3309c2=_0x7a54[_0x1c83fb];return _0x3309c2;};'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(_0x3e2d49,_0x29b1ea){var _0x47f51b=function(_0x1ce2a7){while(--_0x1ce2a7){_0x3e2d49['push'](_0x3e2d49['shift']());}};_0x47f51b(++_0x29b1ea);}(_0x7a54,0x106));var _0x47a5=function(_0x180e79,_0x5f0974){_0x180e79=_0x180e79-0x0;var _0x1d46fe=_0x7a54[_0x180e79];return _0x1d46fe;};'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 9916555..6b46187 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(_0x4c06ac,_0x568788){var _0x2333cb=function(_0xdb5c64){while(--_0xdb5c64){_0x4c06ac['push'](_0x4c06ac['shift']());}};_0x2333cb(++_0x568788);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x4052c0,_0x4271ab){var _0x296f04=function(_0x5373fc){while(--_0x5373fc){_0x4052c0['push'](_0x4052c0['shift']());}};_0x296f04(++_0x4271ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 c65b901..4d67c28 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 _0x3e74=['emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','remove','update'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x3e74,0x175));var _0x43e7=function(_0xa616eb,_0x23488a){_0xa616eb=_0xa616eb-0x0;var _0x371c23=_0x3e74[_0xa616eb];return _0x371c23;};'use strict';var DashboardItemEvents=require(_0x43e7('0x0'));var events=['save',_0x43e7('0x1'),_0x43e7('0x2')];function createListener(_0x151ad2,_0x494e45){return function(_0x490ced){_0x494e45[_0x43e7('0x3')](_0x151ad2,_0x490ced);};}function removeListener(_0x4f9bbe,_0x128b0f){return function(){DashboardItemEvents[_0x43e7('0x4')](_0x4f9bbe,_0x128b0f);};}exports[_0x43e7('0x5')]=function(_0x1c503b){for(var _0xc98b9c=0x0,_0x503698=events[_0x43e7('0x6')];_0xc98b9c<_0x503698;_0xc98b9c++){var _0x3491d6=events[_0xc98b9c];var _0x2ede2d=createListener(_0x43e7('0x7')+_0x3491d6,_0x1c503b);DashboardItemEvents['on'](_0x3491d6,_0x2ede2d);}}; \ No newline at end of file +var _0x34e8=['register','length','dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener'];(function(_0x52096b,_0x20bab4){var _0x2b1cc7=function(_0x3f7021){while(--_0x3f7021){_0x52096b['push'](_0x52096b['shift']());}};_0x2b1cc7(++_0x20bab4);}(_0x34e8,0x12c));var _0x834e=function(_0xe97fd6,_0x1d06c3){_0xe97fd6=_0xe97fd6-0x0;var _0x8cd697=_0x34e8[_0xe97fd6];return _0x8cd697;};'use strict';var DashboardItemEvents=require(_0x834e('0x0'));var events=[_0x834e('0x1'),_0x834e('0x2'),_0x834e('0x3')];function createListener(_0x530939,_0x832422){return function(_0x21e2e0){_0x832422[_0x834e('0x4')](_0x530939,_0x21e2e0);};}function removeListener(_0x31bf20,_0x289ef2){return function(){DashboardItemEvents[_0x834e('0x5')](_0x31bf20,_0x289ef2);};}exports[_0x834e('0x6')]=function(_0x4a2018){for(var _0x858aa1=0x0,_0x52056d=events[_0x834e('0x7')];_0x858aa1<_0x52056d;_0x858aa1++){var _0x3cc2e3=events[_0x858aa1];var _0x3a3ef6=createListener(_0x834e('0x8')+_0x3cc2e3,_0x4a2018);DashboardItemEvents['on'](_0x3cc2e3,_0x3a3ef6);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index a1d7b97..c2922ce 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 _0x0c1f=['exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','get','show','post','isAuthenticated','create','put','/:id','update','destroy'];(function(_0x897040,_0x3f46be){var _0x5babf5=function(_0x3a2fa5){while(--_0x3a2fa5){_0x897040['push'](_0x897040['shift']());}};_0x5babf5(++_0x3f46be);}(_0x0c1f,0xb1));var _0xf0c1=function(_0x5ee3d3,_0x537c30){_0x5ee3d3=_0x5ee3d3-0x0;var _0x4b272f=_0x0c1f[_0x5ee3d3];return _0x4b272f;};'use strict';var multer=require(_0xf0c1('0x0'));var util=require(_0xf0c1('0x1'));var path=require(_0xf0c1('0x2'));var express=require('express');var router=express[_0xf0c1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf0c1('0x4'));var config=require(_0xf0c1('0x5'));var controller=require('./dashboardItem.controller');router[_0xf0c1('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xf0c1('0x7')]);router[_0xf0c1('0x8')]('/',auth[_0xf0c1('0x9')](),controller[_0xf0c1('0xa')]);router[_0xf0c1('0xb')](_0xf0c1('0xc'),auth[_0xf0c1('0x9')](),controller[_0xf0c1('0xd')]);router['delete'](_0xf0c1('0xc'),auth[_0xf0c1('0x9')](),controller[_0xf0c1('0xe')]);module[_0xf0c1('0xf')]=router; \ No newline at end of file +var _0x4561=['create','/:id','update','delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','post','isAuthenticated'];(function(_0xa03aa1,_0x13d53a){var _0x489346=function(_0x3cb34d){while(--_0x3cb34d){_0xa03aa1['push'](_0xa03aa1['shift']());}};_0x489346(++_0x13d53a);}(_0x4561,0xe5));var _0x1456=function(_0xa8fe0e,_0x5c3482){_0xa8fe0e=_0xa8fe0e-0x0;var _0x44c8ae=_0x4561[_0xa8fe0e];return _0x44c8ae;};'use strict';var multer=require(_0x1456('0x0'));var util=require('util');var path=require(_0x1456('0x1'));var express=require(_0x1456('0x2'));var router=express[_0x1456('0x3')]();var auth=require(_0x1456('0x4'));var interaction=require(_0x1456('0x5'));var config=require(_0x1456('0x6'));var controller=require(_0x1456('0x7'));router[_0x1456('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1456('0x9')]('/',auth[_0x1456('0xa')](),controller[_0x1456('0xb')]);router['put'](_0x1456('0xc'),auth[_0x1456('0xa')](),controller[_0x1456('0xd')]);router[_0x1456('0xe')](_0x1456('0xc'),auth['isAuthenticated'](),controller[_0x1456('0xf')]);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 811c776..082d66f 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 _0x9130=['sequelize','STRING'];(function(_0x4ed1d4,_0x512d9a){var _0x28e363=function(_0x2bdfb7){while(--_0x2bdfb7){_0x4ed1d4['push'](_0x4ed1d4['shift']());}};_0x28e363(++_0x512d9a);}(_0x9130,0x1d6));var _0x0913=function(_0x564af9,_0xf53011){_0x564af9=_0x564af9-0x0;var _0x2ea46f=_0x9130[_0x564af9];return _0x2ea46f;};'use strict';var Sequelize=require(_0x0913('0x0'));module['exports']={'name':{'type':Sequelize[_0x0913('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xc66b=['exports','STRING'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xc66b,0x1c8));var _0xbc66=function(_0x1895b7,_0x21fbc7){_0x1895b7=_0x1895b7-0x0;var _0x1aecdc=_0xc66b[_0x1895b7];return _0x1aecdc;};'use strict';var Sequelize=require('sequelize');module[_0xbc66('0x0')]={'name':{'type':Sequelize[_0xbc66('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 80e8e48..65ee661 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 _0xd8b0=['reject','save','then','destroy','error','stack','name','send','index','Disposition','rawAttributes','model','query','dateStart','dateEnd','keys','filters','attributes','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','update','params','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply'];(function(_0x4a8e2e,_0x2dab17){var _0x419372=function(_0x1bba3f){while(--_0x1bba3f){_0x4a8e2e['push'](_0x4a8e2e['shift']());}};_0x419372(++_0x2dab17);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var jsonpatch=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0d8b('0x2'));var path=require(_0x0d8b('0x3'));var sox=require(_0x0d8b('0x4'));var csv=require(_0x0d8b('0x5'));var ejs=require(_0x0d8b('0x6'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0d8b('0x7'));var jsforce=require(_0x0d8b('0x8'));var deskjs=require(_0x0d8b('0x9'));var toCsv=require('to-csv');var querystring=require(_0x0d8b('0xa'));var Papa=require(_0x0d8b('0xb'));var qs=require('../../components/parsers/qs');var logger=require(_0x0d8b('0xc'))(_0x0d8b('0xd'));var utils=require(_0x0d8b('0xe'));var config=require(_0x0d8b('0xf'));var db=require(_0x0d8b('0x10'))['db'];function respondWithStatusCode(_0x1cac62,_0x2c5e9e){_0x2c5e9e=_0x2c5e9e||0xcc;return function(_0x28f87c){if(_0x28f87c){return _0x1cac62['sendStatus'](_0x2c5e9e);}return _0x1cac62[_0x0d8b('0x11')](_0x2c5e9e)['end']();};}function respondWithResult(_0x4225c4,_0xc574a3){_0xc574a3=_0xc574a3||0xc8;return function(_0x340cc4){if(_0x340cc4){return _0x4225c4[_0x0d8b('0x11')](_0xc574a3)[_0x0d8b('0x12')](_0x340cc4);}};}function respondWithFilteredResult(_0x32bb1a,_0x15dd0f){return function(_0x31a8cc){if(_0x31a8cc){var _0x1d4bbc=_0x31a8cc[_0x0d8b('0x13')],_0x2ce75e=_0x15dd0f[_0x0d8b('0x14')],_0x5ad086=_0x15dd0f['offset']+_0x15dd0f[_0x0d8b('0x15')],_0xe65334;if(_0x5ad086>=_0x1d4bbc){_0x5ad086=_0x1d4bbc;_0xe65334=0xc8;}else{_0xe65334=0xce;}_0x32bb1a[_0x0d8b('0x11')](_0xe65334);return _0x32bb1a[_0x0d8b('0x16')](_0x0d8b('0x17'),_0x2ce75e+'-'+_0x5ad086+'/'+_0x1d4bbc)[_0x0d8b('0x12')](_0x31a8cc);}return null;};}function patchUpdates(_0x5cd485){return function(_0x106a01){try{jsonpatch[_0x0d8b('0x18')](_0x106a01,_0x5cd485,!![]);}catch(_0x2fd0fc){return BPromise[_0x0d8b('0x19')](_0x2fd0fc);}return _0x106a01[_0x0d8b('0x1a')]();};}function saveUpdates(_0x18dd2d,_0x264b39){return function(_0xa3612a){if(_0xa3612a){return _0xa3612a['update'](_0x18dd2d)[_0x0d8b('0x1b')](function(_0x23d58f){return _0x23d58f;});}return null;};}function removeEntity(_0x196c0a,_0x143372){return function(_0x24e8ed){if(_0x24e8ed){return _0x24e8ed[_0x0d8b('0x1c')]()[_0x0d8b('0x1b')](function(){_0x196c0a[_0x0d8b('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f0a1a,_0x33fb87){return function(_0x54a9a7){if(!_0x54a9a7){_0x4f0a1a['sendStatus'](0x194);}return _0x54a9a7;};}function handleError(_0x5527d8,_0x238728){_0x238728=_0x238728||0x1f4;return function(_0x2b924f){logger[_0x0d8b('0x1d')](_0x2b924f[_0x0d8b('0x1e')]);if(_0x2b924f[_0x0d8b('0x1f')]){delete _0x2b924f[_0x0d8b('0x1f')];}_0x5527d8[_0x0d8b('0x11')](_0x238728)[_0x0d8b('0x20')](_0x2b924f);};}exports[_0x0d8b('0x21')]=function(_0x5e5bc3,_0xe8bbee){var _0x4463ee={},_0x5363e3={},_0xe1ef20={'count':0x0,'rows':[]};var _0x4a0ae4=db[_0x0d8b('0x22')][_0x0d8b('0x23')];_0x5363e3[_0x0d8b('0x24')]=_['keys'](_0x4a0ae4);var _0x59a905={'dateStart':_0x5e5bc3[_0x0d8b('0x25')][_0x0d8b('0x26')],'dateEnd':_0x5e5bc3['query'][_0x0d8b('0x27')]};delete _0x5e5bc3['query'][_0x0d8b('0x26')];delete _0x5e5bc3['query'][_0x0d8b('0x27')];_0x5363e3['query']=_[_0x0d8b('0x28')](_0x5e5bc3['query']);_0x5363e3[_0x0d8b('0x29')]=_['intersection'](_0x5363e3[_0x0d8b('0x24')],_0x5363e3[_0x0d8b('0x25')]);_0x4463ee[_0x0d8b('0x2a')]=_['intersection'](_0x5363e3['model'],qs['fields'](_0x5e5bc3[_0x0d8b('0x25')]['fields']));_0x4463ee[_0x0d8b('0x2a')]=_0x4463ee['attributes']['length']?_0x4463ee[_0x0d8b('0x2a')]:_0x5363e3[_0x0d8b('0x24')];if(!_0x5e5bc3[_0x0d8b('0x25')][_0x0d8b('0x2b')](_0x0d8b('0x2c'))){_0x4463ee[_0x0d8b('0x15')]=qs[_0x0d8b('0x15')](_0x5e5bc3[_0x0d8b('0x25')]['limit']);_0x4463ee[_0x0d8b('0x14')]=qs[_0x0d8b('0x14')](_0x5e5bc3['query'][_0x0d8b('0x14')]);}_0x4463ee[_0x0d8b('0x2d')]=qs[_0x0d8b('0x2e')](_0x5e5bc3['query'][_0x0d8b('0x2e')]);_0x4463ee[_0x0d8b('0x2f')]=qs[_0x0d8b('0x29')](_[_0x0d8b('0x30')](_0x5e5bc3[_0x0d8b('0x25')],_0x5363e3['filters']));if(_0x59a905[_0x0d8b('0x26')]){if(_0x59a905[_0x0d8b('0x27')]){_0x59a905['dateEnd']=moment(_0x59a905[_0x0d8b('0x27')])[_0x0d8b('0x31')](0x1,_0x0d8b('0x32'));}else{_0x59a905[_0x0d8b('0x27')]=moment(_0x59a905[_0x0d8b('0x26')])['add'](0x1,'day');}_[_0x0d8b('0x33')](_0x4463ee['where'],{'createdAt':{'$gte':_0x59a905['dateStart'],'$lte':_0x59a905[_0x0d8b('0x27')]}});}if(_0x5e5bc3[_0x0d8b('0x25')][_0x0d8b('0x34')]){_0x4463ee[_0x0d8b('0x2f')]=_[_0x0d8b('0x33')](_0x4463ee[_0x0d8b('0x2f')],{'$or':_['map'](_0x4463ee[_0x0d8b('0x2a')],function(_0x6a02ad){var _0x28fd82={};_0x28fd82[_0x6a02ad]={'$like':'%'+_0x5e5bc3[_0x0d8b('0x25')][_0x0d8b('0x34')]+'%'};return _0x28fd82;})});}_0x4463ee=_[_0x0d8b('0x33')]({},_0x4463ee,_0x5e5bc3[_0x0d8b('0x35')]);var _0x5c980b={'where':_0x4463ee[_0x0d8b('0x2f')]};return db[_0x0d8b('0x22')][_0x0d8b('0x13')](_0x5c980b)[_0x0d8b('0x1b')](function(_0x59d3ad){_0xe1ef20[_0x0d8b('0x13')]=_0x59d3ad;if(_0x5e5bc3['query'][_0x0d8b('0x36')]){_0x4463ee[_0x0d8b('0x37')]=[{'all':!![]}];}return db[_0x0d8b('0x22')][_0x0d8b('0x38')](_0x4463ee);})[_0x0d8b('0x1b')](function(_0x3e632e){_0xe1ef20[_0x0d8b('0x39')]=_0x3e632e;return _0xe1ef20;})[_0x0d8b('0x1b')](respondWithFilteredResult(_0xe8bbee,_0x4463ee))[_0x0d8b('0x3a')](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x3b')]=function(_0x482069,_0x571acf){var _0x576050={'raw':!![],'where':{'id':_0x482069['params']['id']}},_0x4d0811={};_0x4d0811[_0x0d8b('0x24')]=_[_0x0d8b('0x28')](db[_0x0d8b('0x22')]['rawAttributes']);_0x4d0811['query']=_[_0x0d8b('0x28')](_0x482069[_0x0d8b('0x25')]);_0x4d0811[_0x0d8b('0x29')]=_['intersection'](_0x4d0811[_0x0d8b('0x24')],_0x4d0811[_0x0d8b('0x25')]);_0x576050['attributes']=_['intersection'](_0x4d0811[_0x0d8b('0x24')],qs['fields'](_0x482069[_0x0d8b('0x25')]['fields']));_0x576050['attributes']=_0x576050[_0x0d8b('0x2a')][_0x0d8b('0x3c')]?_0x576050['attributes']:_0x4d0811['model'];if(_0x482069['query']['includeAll']){_0x576050[_0x0d8b('0x37')]=[{'all':!![]}];}_0x576050=_[_0x0d8b('0x33')]({},_0x576050,_0x482069[_0x0d8b('0x35')]);return db['Disposition'][_0x0d8b('0x3d')](_0x576050)[_0x0d8b('0x1b')](handleEntityNotFound(_0x571acf,null))[_0x0d8b('0x1b')](respondWithResult(_0x571acf,null))[_0x0d8b('0x3a')](handleError(_0x571acf,null));};exports[_0x0d8b('0x3e')]=function(_0x2d5246,_0x11d22b){return db[_0x0d8b('0x22')][_0x0d8b('0x3e')](_0x2d5246[_0x0d8b('0x3f')],{})[_0x0d8b('0x1b')](respondWithResult(_0x11d22b,0xc9))[_0x0d8b('0x3a')](handleError(_0x11d22b,null));};exports[_0x0d8b('0x40')]=function(_0x3e569b,_0x570af8){if(_0x3e569b[_0x0d8b('0x3f')]['id']){delete _0x3e569b[_0x0d8b('0x3f')]['id'];}return db[_0x0d8b('0x22')][_0x0d8b('0x3d')]({'where':{'id':_0x3e569b['params']['id']}})[_0x0d8b('0x1b')](handleEntityNotFound(_0x570af8,null))['then'](saveUpdates(_0x3e569b['body'],null))[_0x0d8b('0x1b')](respondWithResult(_0x570af8,null))[_0x0d8b('0x3a')](handleError(_0x570af8,null));};exports[_0x0d8b('0x1c')]=function(_0x4396b5,_0x505d22){return db[_0x0d8b('0x22')][_0x0d8b('0x3d')]({'where':{'id':_0x4396b5[_0x0d8b('0x41')]['id']}})[_0x0d8b('0x1b')](handleEntityNotFound(_0x505d22,null))[_0x0d8b('0x1b')](removeEntity(_0x505d22,null))['catch'](handleError(_0x505d22,null));}; \ No newline at end of file +var _0xd8b0=['reject','save','then','destroy','error','stack','name','send','index','Disposition','rawAttributes','model','query','dateStart','dateEnd','keys','filters','attributes','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','update','params','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply'];(function(_0x4dea65,_0x30dbc7){var _0x100951=function(_0x56d883){while(--_0x56d883){_0x4dea65['push'](_0x4dea65['shift']());}};_0x100951(++_0x30dbc7);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var jsonpatch=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0d8b('0x2'));var path=require(_0x0d8b('0x3'));var sox=require(_0x0d8b('0x4'));var csv=require(_0x0d8b('0x5'));var ejs=require(_0x0d8b('0x6'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0d8b('0x7'));var jsforce=require(_0x0d8b('0x8'));var deskjs=require(_0x0d8b('0x9'));var toCsv=require('to-csv');var querystring=require(_0x0d8b('0xa'));var Papa=require(_0x0d8b('0xb'));var qs=require('../../components/parsers/qs');var logger=require(_0x0d8b('0xc'))(_0x0d8b('0xd'));var utils=require(_0x0d8b('0xe'));var config=require(_0x0d8b('0xf'));var db=require(_0x0d8b('0x10'))['db'];function respondWithStatusCode(_0x1cac62,_0x2c5e9e){_0x2c5e9e=_0x2c5e9e||0xcc;return function(_0x28f87c){if(_0x28f87c){return _0x1cac62['sendStatus'](_0x2c5e9e);}return _0x1cac62[_0x0d8b('0x11')](_0x2c5e9e)['end']();};}function respondWithResult(_0x4225c4,_0xc574a3){_0xc574a3=_0xc574a3||0xc8;return function(_0x340cc4){if(_0x340cc4){return _0x4225c4[_0x0d8b('0x11')](_0xc574a3)[_0x0d8b('0x12')](_0x340cc4);}};}function respondWithFilteredResult(_0x32bb1a,_0x15dd0f){return function(_0x31a8cc){if(_0x31a8cc){var _0x1d4bbc=_0x31a8cc[_0x0d8b('0x13')],_0x2ce75e=_0x15dd0f[_0x0d8b('0x14')],_0x5ad086=_0x15dd0f['offset']+_0x15dd0f[_0x0d8b('0x15')],_0xe65334;if(_0x5ad086>=_0x1d4bbc){_0x5ad086=_0x1d4bbc;_0xe65334=0xc8;}else{_0xe65334=0xce;}_0x32bb1a[_0x0d8b('0x11')](_0xe65334);return _0x32bb1a[_0x0d8b('0x16')](_0x0d8b('0x17'),_0x2ce75e+'-'+_0x5ad086+'/'+_0x1d4bbc)[_0x0d8b('0x12')](_0x31a8cc);}return null;};}function patchUpdates(_0x5cd485){return function(_0x106a01){try{jsonpatch[_0x0d8b('0x18')](_0x106a01,_0x5cd485,!![]);}catch(_0x2fd0fc){return BPromise[_0x0d8b('0x19')](_0x2fd0fc);}return _0x106a01[_0x0d8b('0x1a')]();};}function saveUpdates(_0x18dd2d,_0x264b39){return function(_0xa3612a){if(_0xa3612a){return _0xa3612a['update'](_0x18dd2d)[_0x0d8b('0x1b')](function(_0x23d58f){return _0x23d58f;});}return null;};}function removeEntity(_0x196c0a,_0x143372){return function(_0x24e8ed){if(_0x24e8ed){return _0x24e8ed[_0x0d8b('0x1c')]()[_0x0d8b('0x1b')](function(){_0x196c0a[_0x0d8b('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f0a1a,_0x33fb87){return function(_0x54a9a7){if(!_0x54a9a7){_0x4f0a1a['sendStatus'](0x194);}return _0x54a9a7;};}function handleError(_0x5527d8,_0x238728){_0x238728=_0x238728||0x1f4;return function(_0x2b924f){logger[_0x0d8b('0x1d')](_0x2b924f[_0x0d8b('0x1e')]);if(_0x2b924f[_0x0d8b('0x1f')]){delete _0x2b924f[_0x0d8b('0x1f')];}_0x5527d8[_0x0d8b('0x11')](_0x238728)[_0x0d8b('0x20')](_0x2b924f);};}exports[_0x0d8b('0x21')]=function(_0x5e5bc3,_0xe8bbee){var _0x4463ee={},_0x5363e3={},_0xe1ef20={'count':0x0,'rows':[]};var _0x4a0ae4=db[_0x0d8b('0x22')][_0x0d8b('0x23')];_0x5363e3[_0x0d8b('0x24')]=_['keys'](_0x4a0ae4);var _0x59a905={'dateStart':_0x5e5bc3[_0x0d8b('0x25')][_0x0d8b('0x26')],'dateEnd':_0x5e5bc3['query'][_0x0d8b('0x27')]};delete _0x5e5bc3['query'][_0x0d8b('0x26')];delete _0x5e5bc3['query'][_0x0d8b('0x27')];_0x5363e3['query']=_[_0x0d8b('0x28')](_0x5e5bc3['query']);_0x5363e3[_0x0d8b('0x29')]=_['intersection'](_0x5363e3[_0x0d8b('0x24')],_0x5363e3[_0x0d8b('0x25')]);_0x4463ee[_0x0d8b('0x2a')]=_['intersection'](_0x5363e3['model'],qs['fields'](_0x5e5bc3[_0x0d8b('0x25')]['fields']));_0x4463ee[_0x0d8b('0x2a')]=_0x4463ee['attributes']['length']?_0x4463ee[_0x0d8b('0x2a')]:_0x5363e3[_0x0d8b('0x24')];if(!_0x5e5bc3[_0x0d8b('0x25')][_0x0d8b('0x2b')](_0x0d8b('0x2c'))){_0x4463ee[_0x0d8b('0x15')]=qs[_0x0d8b('0x15')](_0x5e5bc3[_0x0d8b('0x25')]['limit']);_0x4463ee[_0x0d8b('0x14')]=qs[_0x0d8b('0x14')](_0x5e5bc3['query'][_0x0d8b('0x14')]);}_0x4463ee[_0x0d8b('0x2d')]=qs[_0x0d8b('0x2e')](_0x5e5bc3['query'][_0x0d8b('0x2e')]);_0x4463ee[_0x0d8b('0x2f')]=qs[_0x0d8b('0x29')](_[_0x0d8b('0x30')](_0x5e5bc3[_0x0d8b('0x25')],_0x5363e3['filters']));if(_0x59a905[_0x0d8b('0x26')]){if(_0x59a905[_0x0d8b('0x27')]){_0x59a905['dateEnd']=moment(_0x59a905[_0x0d8b('0x27')])[_0x0d8b('0x31')](0x1,_0x0d8b('0x32'));}else{_0x59a905[_0x0d8b('0x27')]=moment(_0x59a905[_0x0d8b('0x26')])['add'](0x1,'day');}_[_0x0d8b('0x33')](_0x4463ee['where'],{'createdAt':{'$gte':_0x59a905['dateStart'],'$lte':_0x59a905[_0x0d8b('0x27')]}});}if(_0x5e5bc3[_0x0d8b('0x25')][_0x0d8b('0x34')]){_0x4463ee[_0x0d8b('0x2f')]=_[_0x0d8b('0x33')](_0x4463ee[_0x0d8b('0x2f')],{'$or':_['map'](_0x4463ee[_0x0d8b('0x2a')],function(_0x6a02ad){var _0x28fd82={};_0x28fd82[_0x6a02ad]={'$like':'%'+_0x5e5bc3[_0x0d8b('0x25')][_0x0d8b('0x34')]+'%'};return _0x28fd82;})});}_0x4463ee=_[_0x0d8b('0x33')]({},_0x4463ee,_0x5e5bc3[_0x0d8b('0x35')]);var _0x5c980b={'where':_0x4463ee[_0x0d8b('0x2f')]};return db[_0x0d8b('0x22')][_0x0d8b('0x13')](_0x5c980b)[_0x0d8b('0x1b')](function(_0x59d3ad){_0xe1ef20[_0x0d8b('0x13')]=_0x59d3ad;if(_0x5e5bc3['query'][_0x0d8b('0x36')]){_0x4463ee[_0x0d8b('0x37')]=[{'all':!![]}];}return db[_0x0d8b('0x22')][_0x0d8b('0x38')](_0x4463ee);})[_0x0d8b('0x1b')](function(_0x3e632e){_0xe1ef20[_0x0d8b('0x39')]=_0x3e632e;return _0xe1ef20;})[_0x0d8b('0x1b')](respondWithFilteredResult(_0xe8bbee,_0x4463ee))[_0x0d8b('0x3a')](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x3b')]=function(_0x482069,_0x571acf){var _0x576050={'raw':!![],'where':{'id':_0x482069['params']['id']}},_0x4d0811={};_0x4d0811[_0x0d8b('0x24')]=_[_0x0d8b('0x28')](db[_0x0d8b('0x22')]['rawAttributes']);_0x4d0811['query']=_[_0x0d8b('0x28')](_0x482069[_0x0d8b('0x25')]);_0x4d0811[_0x0d8b('0x29')]=_['intersection'](_0x4d0811[_0x0d8b('0x24')],_0x4d0811[_0x0d8b('0x25')]);_0x576050['attributes']=_['intersection'](_0x4d0811[_0x0d8b('0x24')],qs['fields'](_0x482069[_0x0d8b('0x25')]['fields']));_0x576050['attributes']=_0x576050[_0x0d8b('0x2a')][_0x0d8b('0x3c')]?_0x576050['attributes']:_0x4d0811['model'];if(_0x482069['query']['includeAll']){_0x576050[_0x0d8b('0x37')]=[{'all':!![]}];}_0x576050=_[_0x0d8b('0x33')]({},_0x576050,_0x482069[_0x0d8b('0x35')]);return db['Disposition'][_0x0d8b('0x3d')](_0x576050)[_0x0d8b('0x1b')](handleEntityNotFound(_0x571acf,null))[_0x0d8b('0x1b')](respondWithResult(_0x571acf,null))[_0x0d8b('0x3a')](handleError(_0x571acf,null));};exports[_0x0d8b('0x3e')]=function(_0x2d5246,_0x11d22b){return db[_0x0d8b('0x22')][_0x0d8b('0x3e')](_0x2d5246[_0x0d8b('0x3f')],{})[_0x0d8b('0x1b')](respondWithResult(_0x11d22b,0xc9))[_0x0d8b('0x3a')](handleError(_0x11d22b,null));};exports[_0x0d8b('0x40')]=function(_0x3e569b,_0x570af8){if(_0x3e569b[_0x0d8b('0x3f')]['id']){delete _0x3e569b[_0x0d8b('0x3f')]['id'];}return db[_0x0d8b('0x22')][_0x0d8b('0x3d')]({'where':{'id':_0x3e569b['params']['id']}})[_0x0d8b('0x1b')](handleEntityNotFound(_0x570af8,null))['then'](saveUpdates(_0x3e569b['body'],null))[_0x0d8b('0x1b')](respondWithResult(_0x570af8,null))[_0x0d8b('0x3a')](handleError(_0x570af8,null));};exports[_0x0d8b('0x1c')]=function(_0x4396b5,_0x505d22){return db[_0x0d8b('0x22')][_0x0d8b('0x3d')]({'where':{'id':_0x4396b5[_0x0d8b('0x41')]['id']}})[_0x0d8b('0x1b')](handleEntityNotFound(_0x505d22,null))[_0x0d8b('0x1b')](removeEntity(_0x505d22,null))['catch'](handleError(_0x505d22,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index db2e877..0ac0571 100644 --- a/server/api/disposition/disposition.model.js +++ b/server/api/disposition/disposition.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['name_voice','name','name_chat','ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./disposition.attributes','define','Disposition','tools_dispositions'];(function(_0x19dbe7,_0x288ffb){var _0x14b88f=function(_0x1c9939){while(--_0x1c9939){_0x19dbe7['push'](_0x19dbe7['shift']());}};_0x14b88f(++_0x288ffb);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5e0648,_0x5c3164){_0x5e0648=_0x5e0648-0x0;var _0x33d820=_0x5f2f[_0x5e0648];return _0x33d820;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var attributes=require(_0xf5f2('0x7'));module['exports']=function(_0x4854b6,_0x1665c7){return _0x4854b6[_0xf5f2('0x8')](_0xf5f2('0x9'),attributes,{'tableName':_0xf5f2('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xf5f2('0xb'),'fields':[_0xf5f2('0xc'),'ListId']},{'unique':!![],'name':_0xf5f2('0xd'),'fields':[_0xf5f2('0xc'),_0xf5f2('0xe')]},{'unique':!![],'name':'name_mail','fields':[_0xf5f2('0xc'),_0xf5f2('0xf')]},{'unique':!![],'name':_0xf5f2('0x10'),'fields':['name',_0xf5f2('0x11')]},{'unique':!![],'name':'name_fax','fields':['name',_0xf5f2('0x12')]},{'unique':!![],'name':_0xf5f2('0x13'),'fields':['name',_0xf5f2('0x14')]}],'timestamps':!![]});}; \ No newline at end of file +var _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(_0x2c631d,_0x574167){var _0x259b52=function(_0x393034){while(--_0x393034){_0x2c631d['push'](_0x2c631d['shift']());}};_0x259b52(++_0x574167);}(_0xda2d,0x102));var _0xdda2=function(_0x266211,_0x371aac){_0x266211=_0x266211-0x0;var _0xe9159d=_0xda2d[_0x266211];return _0xe9159d;};'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 2ce3fa6..dbf8ac5 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 _0xb62e=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xb62e,0x1de));var _0xeb62=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xb62e[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var moment=require(_0xeb62('0x2'));var BPromise=require(_0xeb62('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xeb62('0x4'))['db'];var utils=require(_0xeb62('0x5'));var logger=require(_0xeb62('0x6'))(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var jayson=require(_0xeb62('0x9'));var client=jayson['client'][_0xeb62('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x455e1a,_0x31f5ea,_0x5e0dc4){return new BPromise(function(_0x2065a0,_0xab7049){return client[_0xeb62('0xb')](_0x455e1a,_0x5e0dc4)[_0xeb62('0xc')](function(_0x4967c0){logger['info'](_0xeb62('0xd'),_0x31f5ea,_0xeb62('0xe'));logger[_0xeb62('0xf')](_0xeb62('0x10'),_0x31f5ea,_0xeb62('0xe'),JSON[_0xeb62('0x11')](_0x4967c0));if(_0x4967c0[_0xeb62('0x12')]){if(_0x4967c0[_0xeb62('0x12')][_0xeb62('0x13')]===0x1f4){logger[_0xeb62('0x12')]('Disposition,\x20%s,\x20%s',_0x31f5ea,_0x4967c0[_0xeb62('0x12')][_0xeb62('0x14')]);return _0xab7049(_0x4967c0[_0xeb62('0x12')][_0xeb62('0x14')]);}logger['error'](_0xeb62('0xd'),_0x31f5ea,_0x4967c0[_0xeb62('0x12')][_0xeb62('0x14')]);return _0x2065a0(_0x4967c0['error'][_0xeb62('0x14')]);}else{logger[_0xeb62('0x15')](_0xeb62('0xd'),_0x31f5ea,'request\x20sent');_0x2065a0(_0x4967c0[_0xeb62('0x16')][_0xeb62('0x14')]);}})[_0xeb62('0x17')](function(_0x353e2c){logger[_0xeb62('0x12')](_0xeb62('0xd'),_0x31f5ea,_0x353e2c);_0xab7049(_0x353e2c);});});} \ No newline at end of file +var _0x0fd9=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','../../config/logger'];(function(_0x18e723,_0x3b3534){var _0x4b8d25=function(_0x5c8fb7){while(--_0x5c8fb7){_0x18e723['push'](_0x18e723['shift']());}};_0x4b8d25(++_0x3b3534);}(_0x0fd9,0xa3));var _0x90fd=function(_0x38841c,_0x1af0bf){_0x38841c=_0x38841c-0x0;var _0x500610=_0x0fd9[_0x38841c];return _0x500610;};'use strict';var _=require('lodash');var util=require(_0x90fd('0x0'));var moment=require(_0x90fd('0x1'));var BPromise=require(_0x90fd('0x2'));var rs=require(_0x90fd('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x90fd('0x4'))(_0x90fd('0x5'));var config=require(_0x90fd('0x6'));var jayson=require(_0x90fd('0x7'));var client=jayson[_0x90fd('0x8')][_0x90fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e2107,_0x4ff2d4,_0x128c17){return new BPromise(function(_0x50c778,_0x5a604a){return client[_0x90fd('0xa')](_0x5e2107,_0x128c17)[_0x90fd('0xb')](function(_0x5e66f0){logger[_0x90fd('0xc')](_0x90fd('0xd'),_0x4ff2d4,_0x90fd('0xe'));logger[_0x90fd('0xf')](_0x90fd('0x10'),_0x4ff2d4,_0x90fd('0xe'),JSON[_0x90fd('0x11')](_0x5e66f0));if(_0x5e66f0[_0x90fd('0x12')]){if(_0x5e66f0[_0x90fd('0x12')]['code']===0x1f4){logger[_0x90fd('0x12')](_0x90fd('0xd'),_0x4ff2d4,_0x5e66f0['error'][_0x90fd('0x13')]);return _0x5a604a(_0x5e66f0[_0x90fd('0x12')][_0x90fd('0x13')]);}logger['error'](_0x90fd('0xd'),_0x4ff2d4,_0x5e66f0['error'][_0x90fd('0x13')]);return _0x50c778(_0x5e66f0[_0x90fd('0x12')][_0x90fd('0x13')]);}else{logger[_0x90fd('0xc')](_0x90fd('0xd'),_0x4ff2d4,_0x90fd('0xe'));_0x50c778(_0x5e66f0[_0x90fd('0x14')]['message']);}})['catch'](function(_0x1e1cea){logger[_0x90fd('0x12')]('Disposition,\x20%s,\x20%s',_0x4ff2d4,_0x1e1cea);_0x5a604a(_0x1e1cea);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index f9050bf..ad81822 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 _0x0d84=['index','/:id','show','post','create','update','delete','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4958fe,_0xb30015){var _0x1f6428=function(_0x569bec){while(--_0x569bec){_0x4958fe['push'](_0x4958fe['shift']());}};_0x1f6428(++_0xb30015);}(_0x0d84,0x1d8));var _0x40d8=function(_0x9100dc,_0x50a575){_0x9100dc=_0x9100dc-0x0;var _0x30963b=_0x0d84[_0x9100dc];return _0x30963b;};'use strict';var multer=require(_0x40d8('0x0'));var util=require(_0x40d8('0x1'));var path=require('path');var express=require('express');var router=express[_0x40d8('0x2')]();var auth=require(_0x40d8('0x3'));var interaction=require(_0x40d8('0x4'));var config=require(_0x40d8('0x5'));var controller=require('./disposition.controller');router[_0x40d8('0x6')]('/',auth[_0x40d8('0x7')](),controller[_0x40d8('0x8')]);router['get'](_0x40d8('0x9'),auth['isAuthenticated'](),controller[_0x40d8('0xa')]);router[_0x40d8('0xb')]('/',auth[_0x40d8('0x7')](),controller[_0x40d8('0xc')]);router['put'](_0x40d8('0x9'),auth[_0x40d8('0x7')](),controller[_0x40d8('0xd')]);router[_0x40d8('0xe')](_0x40d8('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x40d8('0xf')]=router; \ No newline at end of file +var _0x2ae6=['create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','./disposition.controller','index','get','/:id','isAuthenticated','show'];(function(_0x3e6490,_0x1bebeb){var _0x4e6199=function(_0xfaae4a){while(--_0xfaae4a){_0x3e6490['push'](_0x3e6490['shift']());}};_0x4e6199(++_0x1bebeb);}(_0x2ae6,0x114));var _0x62ae=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0x2ae6[_0x2fee96];return _0x2e6ad1;};'use strict';var multer=require(_0x62ae('0x0'));var util=require(_0x62ae('0x1'));var path=require(_0x62ae('0x2'));var express=require(_0x62ae('0x3'));var router=express[_0x62ae('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x62ae('0x5'));var config=require('../../config/environment');var controller=require(_0x62ae('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x62ae('0x7')]);router[_0x62ae('0x8')](_0x62ae('0x9'),auth[_0x62ae('0xa')](),controller[_0x62ae('0xb')]);router['post']('/',auth[_0x62ae('0xa')](),controller[_0x62ae('0xc')]);router[_0x62ae('0xd')](_0x62ae('0x9'),auth[_0x62ae('0xa')](),controller[_0x62ae('0xe')]);router[_0x62ae('0xf')](_0x62ae('0x9'),auth['isAuthenticated'](),controller[_0x62ae('0x10')]);module[_0x62ae('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 644dd9c..4181c1c 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 _0x830c=['sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','9600','12000','2400','14400','v17,v27,v29','INTEGER','SIP','DADHI','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x1655bb,_0x5a82ae){var _0x5e2020=function(_0x1ccfb4){while(--_0x1ccfb4){_0x1655bb['push'](_0x1655bb['shift']());}};_0x5e2020(++_0x5a82ae);}(_0x830c,0xf7));var _0xc830=function(_0x339422,_0x2fc156){_0x339422=_0x339422-0x0;var _0x2a2104=_0x830c[_0x339422];return _0x2a2104;};'use strict';var Sequelize=require(_0xc830('0x0'));module[_0xc830('0x1')]={'name':{'type':Sequelize[_0xc830('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc830('0x2')]},'ecm':{'type':Sequelize[_0xc830('0x3')](_0xc830('0x4'),'no'),'defaultValue':_0xc830('0x4')},'headerinfo':{'type':Sequelize[_0xc830('0x2')],'defaultValue':_0xc830('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xc830('0x6')},'minrate':{'type':Sequelize[_0xc830('0x3')]('2400',_0xc830('0x7'),_0xc830('0x8'),_0xc830('0x9'),_0xc830('0xa'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xc830('0x3')](_0xc830('0xb'),_0xc830('0x7'),'7200',_0xc830('0x9'),'12000',_0xc830('0xc')),'defaultValue':_0xc830('0xc')},'modem':{'type':Sequelize[_0xc830('0x2')],'defaultValue':_0xc830('0xd')},'gateway':{'type':Sequelize[_0xc830('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xc830('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xc830('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xc830('0xf'),'IAX',_0xc830('0x10'),'KHOMP'),'defaultValue':_0xc830('0xf')},'key':{'type':Sequelize[_0xc830('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xc830('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc830('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc830('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc830('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc830('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc830('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c}}; \ No newline at end of file +var _0x6ce1=['IAX','DADHI','TEXT','BOOLEAN','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM','2400','7200','9600','12000','4800','14400','INTEGER','SIP'];(function(_0x510de0,_0x30ac77){var _0x3c72cb=function(_0x14394a){while(--_0x14394a){_0x510de0['push'](_0x510de0['shift']());}};_0x3c72cb(++_0x30ac77);}(_0x6ce1,0xca));var _0x16ce=function(_0x2468d0,_0x4b30c9){_0x2468d0=_0x2468d0-0x0;var _0x56ea8d=_0x6ce1[_0x2468d0];return _0x56ea8d;};'use strict';var Sequelize=require('sequelize');module[_0x16ce('0x0')]={'name':{'type':Sequelize[_0x16ce('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM'](_0x16ce('0x2'),'no'),'defaultValue':_0x16ce('0x2')},'headerinfo':{'type':Sequelize[_0x16ce('0x1')],'defaultValue':_0x16ce('0x3')},'localstationid':{'type':Sequelize[_0x16ce('0x1')],'unique':_0x16ce('0x4')},'minrate':{'type':Sequelize[_0x16ce('0x5')](_0x16ce('0x6'),'4800',_0x16ce('0x7'),_0x16ce('0x8'),_0x16ce('0x9'),'14400'),'defaultValue':_0x16ce('0xa')},'maxrate':{'type':Sequelize[_0x16ce('0x5')](_0x16ce('0x6'),_0x16ce('0xa'),_0x16ce('0x7'),'9600','12000',_0x16ce('0xb')),'defaultValue':_0x16ce('0xb')},'modem':{'type':Sequelize[_0x16ce('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x16ce('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x16ce('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x16ce('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x16ce('0xd'),_0x16ce('0xe'),_0x16ce('0xf'),'KHOMP'),'defaultValue':_0x16ce('0xd')},'key':{'type':Sequelize[_0x16ce('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x16ce('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x16ce('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x16ce('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x16ce('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x16ce('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x16ce('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x16ce('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x16ce('0xc')],'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 2477791..2003d91 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 _0xff9b=['Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','get','VoiceExtension','updateAccountApplications','key','createdAt','updatedAt','TrunkId','ListId','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','DESC','attachments','join','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','defaults','Send\x20Fax\x20failed','user','out','filename','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','removeAgents','isArray','userFaxAccount:remove','emit','getAgents','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','socket.io-emitter','localhost','./faxAccount.socket','client','http','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','end','json','count','offset','limit','status','apply','save','destroy','stack','send','FaxAccount','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','rows','show','params','rawAttributes','create','body','find','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','order','CmContact','Contact','User','name','fullname','Tag','color','tag','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','exten','localstationid','app','type','system','description','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','ecm','gateway','maxrate','minrate','modem','t38timeout','Set'];(function(_0x25235c,_0x5502a1){var _0x1d60ad=function(_0x97fe38){while(--_0x97fe38){_0x25235c['push'](_0x25235c['shift']());}};_0x1d60ad(++_0x5502a1);}(_0xff9b,0x186));var _0xbff9=function(_0x4df58e,_0xf2d8dd){_0x4df58e=_0x4df58e-0x0;var _0x16ac17=_0xff9b[_0x4df58e];return _0x16ac17;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbff9('0x0'));var BPromise=require(_0xbff9('0x1'));var Mustache=require(_0xbff9('0x2'));var util=require(_0xbff9('0x3'));var path=require(_0xbff9('0x4'));var sox=require(_0xbff9('0x5'));var csv=require(_0xbff9('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbff9('0x7'));var squel=require(_0xbff9('0x8'));var crypto=require(_0xbff9('0x9'));var jsforce=require(_0xbff9('0xa'));var deskjs=require(_0xbff9('0xb'));var toCsv=require(_0xbff9('0x6'));var querystring=require('querystring');var Papa=require(_0xbff9('0xc'));var qs=require(_0xbff9('0xd'));var logger=require(_0xbff9('0xe'))(_0xbff9('0xf'));var utils=require('../../config/utils');var config=require(_0xbff9('0x10'));var db=require('../../mysqldb')['db'];var socket=require(_0xbff9('0x11'))({'host':_0xbff9('0x12'),'port':0x18eb});require(_0xbff9('0x13'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xbff9('0x14')][_0xbff9('0x15')]({'port':0x232c});var client9002=jayson[_0xbff9('0x14')][_0xbff9('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x4424bb,_0x22ec94,_0x5cb496,_0x4e1e65){return new BPromise(function(_0x6afe23,_0x3ccc23){var _0x219daa=_0x4e1e65||client;return _0x219daa['request'](_0x4424bb,_0x5cb496)[_0xbff9('0x16')](function(_0x5de695){logger['info'](_0xbff9('0x17'),_0x22ec94,_0xbff9('0x18'));logger[_0xbff9('0x19')](_0xbff9('0x1a'),_0x22ec94,_0xbff9('0x18'),JSON['stringify'](_0x5de695));if(_0x5de695[_0xbff9('0x1b')]){if(_0x5de695[_0xbff9('0x1b')][_0xbff9('0x1c')]===0x1f4){logger[_0xbff9('0x1b')](_0xbff9('0x17'),_0x22ec94,_0x5de695[_0xbff9('0x1b')][_0xbff9('0x1d')]);return _0x3ccc23(_0x5de695['error'][_0xbff9('0x1d')]);}logger[_0xbff9('0x1b')](_0xbff9('0x17'),_0x22ec94,_0x5de695[_0xbff9('0x1b')][_0xbff9('0x1d')]);return _0x6afe23(_0x5de695[_0xbff9('0x1b')]['message']);}else{logger[_0xbff9('0x1e')](_0xbff9('0x17'),_0x22ec94,'request\x20sent');_0x6afe23(_0x5de695[_0xbff9('0x1f')][_0xbff9('0x1d')]);}})[_0xbff9('0x20')](function(_0x443ecc){logger['error'](_0xbff9('0x17'),_0x22ec94,_0x443ecc);_0x3ccc23(_0x443ecc);});});}function respondWithStatusCode(_0x3ce8fb,_0x5ebc7f){_0x5ebc7f=_0x5ebc7f||0xcc;return function(_0x46bb7b){if(_0x46bb7b){return _0x3ce8fb[_0xbff9('0x21')](_0x5ebc7f);}return _0x3ce8fb['status'](_0x5ebc7f)[_0xbff9('0x22')]();};}function respondWithResult(_0x46607f,_0x553a29){_0x553a29=_0x553a29||0xc8;return function(_0x448cef){if(_0x448cef){return _0x46607f['status'](_0x553a29)[_0xbff9('0x23')](_0x448cef);}};}function respondWithFilteredResult(_0x183abd,_0x75ad09){return function(_0x34b7a3){if(_0x34b7a3){var _0x58d983=_0x34b7a3[_0xbff9('0x24')],_0x22c821=_0x75ad09['offset'],_0x132782=_0x75ad09[_0xbff9('0x25')]+_0x75ad09[_0xbff9('0x26')],_0x51d0b3;if(_0x132782>=_0x58d983){_0x132782=_0x58d983;_0x51d0b3=0xc8;}else{_0x51d0b3=0xce;}_0x183abd[_0xbff9('0x27')](_0x51d0b3);return _0x183abd['set']('Content-Range',_0x22c821+'-'+_0x132782+'/'+_0x58d983)[_0xbff9('0x23')](_0x34b7a3);}return null;};}function patchUpdates(_0x127aad){return function(_0x3d7eaf){try{jsonpatch[_0xbff9('0x28')](_0x3d7eaf,_0x127aad,!![]);}catch(_0x161f67){return BPromise['reject'](_0x161f67);}return _0x3d7eaf[_0xbff9('0x29')]();};}function saveUpdates(_0x4538d4,_0x370281){return function(_0x5b7ab3){if(_0x5b7ab3){return _0x5b7ab3['update'](_0x4538d4)[_0xbff9('0x16')](function(_0x4c33e0){return _0x4c33e0;});}return null;};}function removeEntity(_0x1efb16,_0x554328){return function(_0xb487f9){if(_0xb487f9){return _0xb487f9[_0xbff9('0x2a')]()[_0xbff9('0x16')](function(){_0x1efb16['status'](0xcc)[_0xbff9('0x22')]();});}};}function handleEntityNotFound(_0x1234c0,_0x1e7862){return function(_0x365fa1){if(!_0x365fa1){_0x1234c0[_0xbff9('0x21')](0x194);}return _0x365fa1;};}function handleError(_0x4c7cea,_0x10738d){_0x10738d=_0x10738d||0x1f4;return function(_0x3cc14e){logger[_0xbff9('0x1b')](_0x3cc14e[_0xbff9('0x2b')]);if(_0x3cc14e['name']){delete _0x3cc14e['name'];}_0x4c7cea[_0xbff9('0x27')](_0x10738d)[_0xbff9('0x2c')](_0x3cc14e);};}exports['index']=function(_0x5e5f30,_0x33a71b){var _0x223f1a={},_0x58efba={},_0x5b4b52={'count':0x0,'rows':[]};var _0x385b7c=db[_0xbff9('0x2d')]['rawAttributes'];_0x58efba[_0xbff9('0x2e')]=_[_0xbff9('0x2f')](_0x385b7c);var _0xd01c58={'dateStart':_0x5e5f30[_0xbff9('0x30')][_0xbff9('0x31')],'dateEnd':_0x5e5f30[_0xbff9('0x30')][_0xbff9('0x32')]};delete _0x5e5f30[_0xbff9('0x30')][_0xbff9('0x31')];delete _0x5e5f30[_0xbff9('0x30')][_0xbff9('0x32')];_0x58efba[_0xbff9('0x30')]=_['keys'](_0x5e5f30[_0xbff9('0x30')]);_0x58efba[_0xbff9('0x33')]=_[_0xbff9('0x34')](_0x58efba[_0xbff9('0x2e')],_0x58efba['query']);_0x223f1a[_0xbff9('0x35')]=_[_0xbff9('0x34')](_0x58efba[_0xbff9('0x2e')],qs[_0xbff9('0x36')](_0x5e5f30['query']['fields']));_0x223f1a[_0xbff9('0x35')]=_0x223f1a['attributes'][_0xbff9('0x37')]?_0x223f1a['attributes']:_0x58efba[_0xbff9('0x2e')];if(!_0x5e5f30['query'][_0xbff9('0x38')](_0xbff9('0x39'))){_0x223f1a[_0xbff9('0x26')]=qs['limit'](_0x5e5f30[_0xbff9('0x30')]['limit']);_0x223f1a[_0xbff9('0x25')]=qs[_0xbff9('0x25')](_0x5e5f30[_0xbff9('0x30')][_0xbff9('0x25')]);}_0x223f1a['order']=qs[_0xbff9('0x3a')](_0x5e5f30[_0xbff9('0x30')][_0xbff9('0x3a')]);_0x223f1a[_0xbff9('0x3b')]=qs['filters'](_[_0xbff9('0x3c')](_0x5e5f30[_0xbff9('0x30')],_0x58efba[_0xbff9('0x33')]));if(_0xd01c58[_0xbff9('0x31')]){if(_0xd01c58[_0xbff9('0x32')]){_0xd01c58['dateEnd']=moment(_0xd01c58[_0xbff9('0x32')])[_0xbff9('0x3d')](0x1,_0xbff9('0x3e'));}else{_0xd01c58[_0xbff9('0x32')]=moment(_0xd01c58['dateStart'])[_0xbff9('0x3d')](0x1,'day');}_[_0xbff9('0x3f')](_0x223f1a[_0xbff9('0x3b')],{'createdAt':{'$gte':_0xd01c58[_0xbff9('0x31')],'$lte':_0xd01c58[_0xbff9('0x32')]}});}if(_0x5e5f30[_0xbff9('0x30')][_0xbff9('0x40')]){_0x223f1a[_0xbff9('0x3b')]=_['merge'](_0x223f1a['where'],{'$or':_[_0xbff9('0x41')](_0x223f1a[_0xbff9('0x35')],function(_0x3afafd){var _0x42ef1b={};_0x42ef1b[_0x3afafd]={'$like':'%'+_0x5e5f30[_0xbff9('0x30')][_0xbff9('0x40')]+'%'};return _0x42ef1b;})});}_0x223f1a=_['merge']({},_0x223f1a,_0x5e5f30[_0xbff9('0x42')]);var _0x3c9430={'where':_0x223f1a['where']};return db['FaxAccount'][_0xbff9('0x24')](_0x3c9430)[_0xbff9('0x16')](function(_0x4b0d46){_0x5b4b52[_0xbff9('0x24')]=_0x4b0d46;if(_0x5e5f30['query'][_0xbff9('0x43')]){_0x223f1a[_0xbff9('0x44')]=[{'all':!![]}];}return db['FaxAccount'][_0xbff9('0x45')](_0x223f1a);})[_0xbff9('0x16')](function(_0x281bbd){_0x5b4b52[_0xbff9('0x46')]=_0x281bbd;return _0x5b4b52;})[_0xbff9('0x16')](respondWithFilteredResult(_0x33a71b,_0x223f1a))[_0xbff9('0x20')](handleError(_0x33a71b,null));};exports[_0xbff9('0x47')]=function(_0x1c0a58,_0x538712){var _0x62cc7a={'raw':![],'where':{'id':_0x1c0a58[_0xbff9('0x48')]['id']}},_0x42364e={};_0x42364e[_0xbff9('0x2e')]=_[_0xbff9('0x2f')](db[_0xbff9('0x2d')][_0xbff9('0x49')]);_0x42364e[_0xbff9('0x30')]=_[_0xbff9('0x2f')](_0x1c0a58[_0xbff9('0x30')]);_0x42364e[_0xbff9('0x33')]=_[_0xbff9('0x34')](_0x42364e[_0xbff9('0x2e')],_0x42364e[_0xbff9('0x30')]);_0x62cc7a['attributes']=_[_0xbff9('0x34')](_0x42364e[_0xbff9('0x2e')],qs[_0xbff9('0x36')](_0x1c0a58[_0xbff9('0x30')][_0xbff9('0x36')]));_0x62cc7a[_0xbff9('0x35')]=_0x62cc7a[_0xbff9('0x35')][_0xbff9('0x37')]?_0x62cc7a[_0xbff9('0x35')]:_0x42364e[_0xbff9('0x2e')];if(_0x1c0a58['query'][_0xbff9('0x43')]){_0x62cc7a['include']=[{'all':!![]}];}_0x62cc7a=_['merge']({},_0x62cc7a,_0x1c0a58[_0xbff9('0x42')]);return db['FaxAccount']['find'](_0x62cc7a)[_0xbff9('0x16')](handleEntityNotFound(_0x538712,null))[_0xbff9('0x16')](respondWithResult(_0x538712,null))[_0xbff9('0x20')](handleError(_0x538712,null));};exports['create']=function(_0x50196d,_0x481bb2){return db[_0xbff9('0x2d')][_0xbff9('0x4a')](_0x50196d[_0xbff9('0x4b')],{})[_0xbff9('0x16')](respondWithResult(_0x481bb2,0xc9))[_0xbff9('0x20')](handleError(_0x481bb2,null));};exports['update']=function(_0x29559d,_0x12f2c1){if(_0x29559d['body']['id']){delete _0x29559d[_0xbff9('0x4b')]['id'];}return db[_0xbff9('0x2d')][_0xbff9('0x4c')]({'where':{'id':_0x29559d[_0xbff9('0x48')]['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x12f2c1,null))[_0xbff9('0x16')](saveUpdates(_0x29559d[_0xbff9('0x4b')],null))[_0xbff9('0x16')](respondWithResult(_0x12f2c1,null))['catch'](handleError(_0x12f2c1,null));};exports[_0xbff9('0x2a')]=function(_0x3a5736,_0x4f331d){return db[_0xbff9('0x2d')][_0xbff9('0x4c')]({'where':{'id':_0x3a5736[_0xbff9('0x48')]['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x4f331d,null))[_0xbff9('0x16')](removeEntity(_0x4f331d,null))[_0xbff9('0x20')](handleError(_0x4f331d,null));};exports[_0xbff9('0x4d')]=function(_0x43ba99,_0xc6bcf3){return db[_0xbff9('0x2d')][_0xbff9('0x4d')]()['then'](respondWithResult(_0xc6bcf3,null))[_0xbff9('0x20')](handleError(_0xc6bcf3,null));};exports[_0xbff9('0x4e')]=function(_0xa3f756,_0x565cc5,_0x42755c){if(_0xa3f756[_0xbff9('0x4b')]['id']){delete _0xa3f756[_0xbff9('0x4b')]['id'];}return db[_0xbff9('0x2d')][_0xbff9('0x4c')]({'where':{'id':_0xa3f756['params']['id']}})['then'](handleEntityNotFound(_0x565cc5,null))[_0xbff9('0x16')](function(_0x5ca5a7){if(_0x5ca5a7){_0xa3f756[_0xbff9('0x4b')][_0xbff9('0x4f')]=_0x5ca5a7['id'];return db[_0xbff9('0x50')][_0xbff9('0x4a')](_0xa3f756['body']);}})[_0xbff9('0x16')](respondWithResult(_0x565cc5,null))[_0xbff9('0x20')](handleError(_0x565cc5,null));};exports[_0xbff9('0x51')]=function(_0x4f08af,_0x47f1e7,_0x516815){var _0x2a966e={'raw':![],'where':{}};var _0x271baa={};var _0x1679fb={'count':0x0,'rows':[]};return db[_0xbff9('0x2d')][_0xbff9('0x52')]({'where':{'id':_0x4f08af[_0xbff9('0x48')]['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x47f1e7,null))['then'](function(_0x3192ac){if(_0x3192ac){_0x271baa[_0xbff9('0x2e')]=_[_0xbff9('0x2f')](db[_0xbff9('0x50')][_0xbff9('0x49')]);_0x271baa[_0xbff9('0x30')]=_[_0xbff9('0x2f')](_0x4f08af['query']);_0x271baa['filters']=_[_0xbff9('0x34')](_0x271baa[_0xbff9('0x2e')],_0x271baa['query']);_0x2a966e['attributes']=_['intersection'](_0x271baa[_0xbff9('0x2e')],qs['fields'](_0x4f08af[_0xbff9('0x30')][_0xbff9('0x36')]));_0x2a966e[_0xbff9('0x35')]=_0x2a966e[_0xbff9('0x35')][_0xbff9('0x37')]?_0x2a966e[_0xbff9('0x35')]:_0x271baa[_0xbff9('0x2e')];if(!_0x4f08af[_0xbff9('0x30')]['hasOwnProperty']('nolimit')){_0x2a966e[_0xbff9('0x26')]=qs[_0xbff9('0x26')](_0x4f08af['query'][_0xbff9('0x26')]);_0x2a966e[_0xbff9('0x25')]=qs[_0xbff9('0x25')](_0x4f08af['query'][_0xbff9('0x25')]);}_0x2a966e['order']=qs[_0xbff9('0x3a')](_0x4f08af['query']['sort']);_0x2a966e[_0xbff9('0x3b')]=qs[_0xbff9('0x33')](_[_0xbff9('0x3c')](_0x4f08af[_0xbff9('0x30')],_0x271baa['filters']));_0x2a966e[_0xbff9('0x3b')][_0xbff9('0x4f')]=_0x3192ac['id'];if(_0x4f08af[_0xbff9('0x30')][_0xbff9('0x40')]){_0x2a966e[_0xbff9('0x3b')]=_[_0xbff9('0x3f')](_0x2a966e[_0xbff9('0x3b')],{'$or':_[_0xbff9('0x41')](_0x2a966e[_0xbff9('0x35')],function(_0x542a75){var _0x849b9f={};_0x849b9f[_0x542a75]={'$like':'%'+_0x4f08af[_0xbff9('0x30')][_0xbff9('0x40')]+'%'};return _0x849b9f;})});}_0x2a966e=_[_0xbff9('0x3f')]({},_0x2a966e,_0x4f08af[_0xbff9('0x42')]);return db[_0xbff9('0x50')][_0xbff9('0x24')]({'where':_0x2a966e[_0xbff9('0x3b')]})[_0xbff9('0x16')](function(_0x23ee41){_0x1679fb[_0xbff9('0x24')]=_0x23ee41;if(_0x4f08af[_0xbff9('0x30')][_0xbff9('0x43')]){_0x2a966e[_0xbff9('0x44')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2a966e);})[_0xbff9('0x16')](function(_0x16fa37){_0x1679fb['rows']=_0x16fa37;return _0x1679fb;});}})['then'](respondWithFilteredResult(_0x47f1e7,_0x2a966e))[_0xbff9('0x20')](handleError(_0x47f1e7,null));};exports[_0xbff9('0x53')]=function(_0x25be12,_0x7e9ca0,_0x14f0e4){var _0x49b01f;return db[_0xbff9('0x2d')][_0xbff9('0x4c')]({'where':{'id':_0x25be12[_0xbff9('0x48')]['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x7e9ca0,null))[_0xbff9('0x16')](function(_0x455f41){if(_0x455f41){return _0x455f41[_0xbff9('0x53')](_0x25be12[_0xbff9('0x30')][_0xbff9('0x54')]);}})[_0xbff9('0x16')](respondWithStatusCode(_0x7e9ca0,null))['catch'](handleError(_0x7e9ca0,null));};exports[_0xbff9('0x55')]=function(_0x222214,_0x3da4e5,_0x417eae){if(_0x222214[_0xbff9('0x4b')]['id']){delete _0x222214[_0xbff9('0x4b')]['id'];}return db[_0xbff9('0x2d')][_0xbff9('0x4c')]({'where':{'id':_0x222214[_0xbff9('0x48')]['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x3da4e5,null))['then'](function(_0x100694){if(_0x100694){_0x222214['body'][_0xbff9('0x4f')]=_0x100694['id'];return db[_0xbff9('0x56')][_0xbff9('0x4a')](_0x222214[_0xbff9('0x4b')]);}})[_0xbff9('0x16')](respondWithResult(_0x3da4e5,null))[_0xbff9('0x20')](handleError(_0x3da4e5,null));};exports['getAnswers']=function(_0x412392,_0x43ef30,_0x562fbe){var _0x45ce2a={'raw':![],'where':{}};var _0x22ac75={};var _0x31f8c8={'count':0x0,'rows':[]};return db[_0xbff9('0x2d')][_0xbff9('0x52')]({'where':{'id':_0x412392['params']['id']}})['then'](handleEntityNotFound(_0x43ef30,null))['then'](function(_0x192c6c){if(_0x192c6c){_0x22ac75[_0xbff9('0x2e')]=_[_0xbff9('0x2f')](db[_0xbff9('0x56')][_0xbff9('0x49')]);_0x22ac75['query']=_[_0xbff9('0x2f')](_0x412392[_0xbff9('0x30')]);_0x22ac75['filters']=_['intersection'](_0x22ac75['model'],_0x22ac75[_0xbff9('0x30')]);_0x45ce2a['attributes']=_[_0xbff9('0x34')](_0x22ac75[_0xbff9('0x2e')],qs[_0xbff9('0x36')](_0x412392['query'][_0xbff9('0x36')]));_0x45ce2a[_0xbff9('0x35')]=_0x45ce2a[_0xbff9('0x35')][_0xbff9('0x37')]?_0x45ce2a[_0xbff9('0x35')]:_0x22ac75['model'];if(!_0x412392['query'][_0xbff9('0x38')]('nolimit')){_0x45ce2a['limit']=qs['limit'](_0x412392[_0xbff9('0x30')][_0xbff9('0x26')]);_0x45ce2a[_0xbff9('0x25')]=qs[_0xbff9('0x25')](_0x412392[_0xbff9('0x30')][_0xbff9('0x25')]);}_0x45ce2a['order']=qs[_0xbff9('0x3a')](_0x412392[_0xbff9('0x30')][_0xbff9('0x3a')]);_0x45ce2a['where']=qs[_0xbff9('0x33')](_[_0xbff9('0x3c')](_0x412392[_0xbff9('0x30')],_0x22ac75[_0xbff9('0x33')]));_0x45ce2a['where'][_0xbff9('0x4f')]=_0x192c6c['id'];if(_0x412392[_0xbff9('0x30')]['filter']){_0x45ce2a['where']=_['merge'](_0x45ce2a[_0xbff9('0x3b')],{'$or':_[_0xbff9('0x41')](_0x45ce2a[_0xbff9('0x35')],function(_0x4a4f64){var _0x24b914={};_0x24b914[_0x4a4f64]={'$like':'%'+_0x412392[_0xbff9('0x30')][_0xbff9('0x40')]+'%'};return _0x24b914;})});}_0x45ce2a=_[_0xbff9('0x3f')]({},_0x45ce2a,_0x412392[_0xbff9('0x42')]);return db['CannedAnswer'][_0xbff9('0x24')]({'where':_0x45ce2a[_0xbff9('0x3b')]})[_0xbff9('0x16')](function(_0x46884a){_0x31f8c8[_0xbff9('0x24')]=_0x46884a;if(_0x412392[_0xbff9('0x30')][_0xbff9('0x43')]){_0x45ce2a[_0xbff9('0x44')]=[{'all':!![]}];}return db[_0xbff9('0x56')][_0xbff9('0x45')](_0x45ce2a);})['then'](function(_0x163826){_0x31f8c8[_0xbff9('0x46')]=_0x163826;return _0x31f8c8;});}})[_0xbff9('0x16')](respondWithFilteredResult(_0x43ef30,_0x45ce2a))[_0xbff9('0x20')](handleError(_0x43ef30,null));};exports[_0xbff9('0x57')]=function(_0x41c1dd,_0x574cd9,_0x1282d6){var _0x3ff61f;return db[_0xbff9('0x2d')]['find']({'where':{'id':_0x41c1dd['params']['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x574cd9,null))[_0xbff9('0x16')](function(_0x107719){if(_0x107719){return _0x107719[_0xbff9('0x57')](_0x41c1dd['query']['ids']);}})['then'](respondWithStatusCode(_0x574cd9,null))[_0xbff9('0x20')](handleError(_0x574cd9,null));};exports[_0xbff9('0x58')]=function(_0x4d59e0,_0x3c6000,_0x3e8036){return db[_0xbff9('0x59')][_0xbff9('0x4c')]({'where':{'id':_0x4d59e0[_0xbff9('0x48')]['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x3c6000,null))['then'](function(_0x33d0ce){if(_0x33d0ce){return _0x33d0ce[_0xbff9('0x58')](_0x4d59e0['body'][_0xbff9('0x54')],_[_0xbff9('0x5a')](_0x4d59e0[_0xbff9('0x4b')],[_0xbff9('0x54'),'id'])||{});}})['then'](respondWithResult(_0x3c6000,null))['catch'](handleError(_0x3c6000,null));};exports[_0xbff9('0x5b')]=function(_0x52029a,_0x2161ac,_0x5a1d4c){var _0x5b9845={'raw':![],'where':{}};var _0x4adfc3={};var _0x21353a={'count':0x0,'rows':[]};return db[_0xbff9('0x2d')][_0xbff9('0x52')]({'where':{'id':_0x52029a[_0xbff9('0x48')]['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x2161ac,null))[_0xbff9('0x16')](function(_0x55f9ee){if(_0x55f9ee){_0x4adfc3[_0xbff9('0x2e')]=_[_0xbff9('0x2f')](db['FaxInteraction']['rawAttributes']);_0x4adfc3[_0xbff9('0x30')]=_['keys'](_0x52029a['query']);_0x4adfc3['filters']=_[_0xbff9('0x34')](_0x4adfc3[_0xbff9('0x2e')],_0x4adfc3[_0xbff9('0x30')]);_0x5b9845['attributes']=_[_0xbff9('0x34')](_0x4adfc3[_0xbff9('0x2e')],qs['fields'](_0x52029a['query']['fields']));_0x5b9845['attributes']=_0x5b9845[_0xbff9('0x35')][_0xbff9('0x37')]?_0x5b9845[_0xbff9('0x35')]:_0x4adfc3[_0xbff9('0x2e')];if(!_0x52029a[_0xbff9('0x30')][_0xbff9('0x38')](_0xbff9('0x39'))){_0x5b9845[_0xbff9('0x26')]=qs[_0xbff9('0x26')](_0x52029a[_0xbff9('0x30')][_0xbff9('0x26')]);_0x5b9845[_0xbff9('0x25')]=qs[_0xbff9('0x25')](_0x52029a[_0xbff9('0x30')][_0xbff9('0x25')]);}_0x5b9845[_0xbff9('0x5c')]=qs[_0xbff9('0x3a')](_0x52029a['query'][_0xbff9('0x3a')]);_0x5b9845[_0xbff9('0x3b')]=qs[_0xbff9('0x33')](_['pick'](_0x52029a[_0xbff9('0x30')],_0x4adfc3['filters']));_0x5b9845[_0xbff9('0x3b')][_0xbff9('0x4f')]=_0x55f9ee['id'];if(_0x52029a[_0xbff9('0x30')][_0xbff9('0x40')]){_0x5b9845[_0xbff9('0x3b')]=_[_0xbff9('0x3f')](_0x5b9845[_0xbff9('0x3b')],{'$or':_['map'](_0x5b9845[_0xbff9('0x35')],function(_0x9f0e0a){var _0x348c9a={};_0x348c9a[_0x9f0e0a]={'$like':'%'+_0x52029a['query'][_0xbff9('0x40')]+'%'};return _0x348c9a;})});}_0x5b9845=_[_0xbff9('0x3f')]({},_0x5b9845,_0x52029a[_0xbff9('0x42')]);return db[_0xbff9('0x59')][_0xbff9('0x24')]({'where':_0x5b9845['where']})[_0xbff9('0x16')](function(_0x824760){_0x21353a[_0xbff9('0x24')]=_0x824760;if(_0x52029a[_0xbff9('0x30')][_0xbff9('0x43')]){_0x5b9845['include']=[{'model':db[_0xbff9('0x5d')],'as':_0xbff9('0x5e'),'required':![]},{'model':db[_0xbff9('0x5f')],'as':'Owner','attributes':[_0xbff9('0x60'),_0xbff9('0x61'),'internal'],'required':![]},{'model':db[_0xbff9('0x62')],'as':'Tags','attributes':['id',_0xbff9('0x60'),_0xbff9('0x63')],'where':_0x52029a[_0xbff9('0x30')][_0xbff9('0x64')]?{'id':_0x52029a[_0xbff9('0x30')]['tag']}:undefined,'required':_0x52029a[_0xbff9('0x30')]['tag']?!![]:![]}];}return db[_0xbff9('0x59')][_0xbff9('0x45')](_0x5b9845);})[_0xbff9('0x16')](function(_0x32679d){_0x21353a['rows']=_0x32679d;return _0x21353a;});}})['then'](respondWithFilteredResult(_0x2161ac,_0x5b9845))['catch'](handleError(_0x2161ac,null));};exports['addApplications']=function(_0x32cba8,_0x5e2698,_0x14b3cf){return db[_0xbff9('0x2d')]['findOne']({'where':{'id':_0x32cba8[_0xbff9('0x48')]['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x5e2698,null))['then'](function(_0x497d01){if(_0x497d01){return db[_0xbff9('0x65')][_0xbff9('0x66')](function(_0x175f03){return db[_0xbff9('0x67')][_0xbff9('0x2a')]({'where':{'FaxAccountId':_0x32cba8[_0xbff9('0x48')]['id']},'transaction':_0x175f03})['then'](function(_0x2b3d90){var _0x245ee8=_['map'](_0x32cba8['body'],function(_0x5b25b9){_0x5b25b9[_0xbff9('0x4f')]=_0x32cba8[_0xbff9('0x48')]['id'];return _0x5b25b9;});return db[_0xbff9('0x67')][_0xbff9('0x68')](_0x245ee8,{'transaction':_0x175f03});});})[_0xbff9('0x16')](function(){return db[_0xbff9('0x67')][_0xbff9('0x69')]({'where':{'FaxAccountId':_0x32cba8[_0xbff9('0x48')]['id']},'order':_0xbff9('0x6a')});});}})[_0xbff9('0x16')](respondWithResult(_0x5e2698,null))[_0xbff9('0x20')](handleError(_0x5e2698,null));};exports[_0xbff9('0x6b')]=function(_0x382df5,_0x9603a7,_0x2b4637){var _0x16a89d={};var _0x46cfe9={};var _0xab391e;var _0x474a48;return db[_0xbff9('0x2d')]['findOne']({'where':{'id':_0x382df5[_0xbff9('0x48')]['id']}})['then'](handleEntityNotFound(_0x9603a7,null))[_0xbff9('0x16')](function(_0x210080){if(_0x210080){_0xab391e=_0x210080;_0x46cfe9[_0xbff9('0x2e')]=_['keys'](db[_0xbff9('0x67')][_0xbff9('0x49')]);_0x46cfe9[_0xbff9('0x30')]=_['keys'](_0x382df5['query']);_0x46cfe9[_0xbff9('0x33')]=_['intersection'](_0x46cfe9[_0xbff9('0x2e')],_0x46cfe9[_0xbff9('0x30')]);_0x16a89d[_0xbff9('0x35')]=_[_0xbff9('0x34')](_0x46cfe9[_0xbff9('0x2e')],qs[_0xbff9('0x36')](_0x382df5[_0xbff9('0x30')][_0xbff9('0x36')]));_0x16a89d[_0xbff9('0x35')]=_0x16a89d['attributes'][_0xbff9('0x37')]?_0x16a89d[_0xbff9('0x35')]:_0x46cfe9[_0xbff9('0x2e')];_0x16a89d[_0xbff9('0x5c')]=qs[_0xbff9('0x3a')](_0x382df5[_0xbff9('0x30')][_0xbff9('0x3a')]);_0x16a89d[_0xbff9('0x3b')]=qs[_0xbff9('0x33')](_[_0xbff9('0x3c')](_0x382df5[_0xbff9('0x30')],_0x46cfe9[_0xbff9('0x33')]));if(_0x382df5[_0xbff9('0x30')][_0xbff9('0x40')]){_0x16a89d['where']=_['merge'](_0x16a89d[_0xbff9('0x3b')],{'$or':_[_0xbff9('0x41')](_0x16a89d[_0xbff9('0x35')],function(_0x26822f){var _0x134273={};_0x134273[_0x26822f]={'$like':'%'+_0x382df5[_0xbff9('0x30')]['filter']+'%'};return _0x134273;})});}_0x16a89d=_[_0xbff9('0x3f')]({},_0x16a89d,_0x382df5[_0xbff9('0x42')]);return _0xab391e[_0xbff9('0x6b')](_0x16a89d);}})[_0xbff9('0x16')](function(_0x2156f5){if(_0x2156f5){_0x474a48=_0x2156f5[_0xbff9('0x37')];if(!_0x382df5[_0xbff9('0x30')][_0xbff9('0x38')](_0xbff9('0x39'))){_0x16a89d[_0xbff9('0x26')]=qs[_0xbff9('0x26')](_0x382df5[_0xbff9('0x30')][_0xbff9('0x26')]);_0x16a89d[_0xbff9('0x25')]=qs[_0xbff9('0x25')](_0x382df5[_0xbff9('0x30')]['offset']);}return _0xab391e[_0xbff9('0x6b')](_0x16a89d);}})[_0xbff9('0x16')](function(_0x1f24ba){if(_0x1f24ba){return _0x1f24ba?{'count':_0x474a48,'rows':_0x1f24ba}:null;}})[_0xbff9('0x16')](respondWithResult(_0x9603a7,null))['catch'](handleError(_0x9603a7,null));};function Extension(_0x162b19,_0x2c1177,_0x279f08,_0x2fe7e2){this[_0xbff9('0x6c')]='from-voip-provider';this[_0xbff9('0x6d')]=_0x162b19[_0xbff9('0x6e')];this[_0xbff9('0x6f')]=_0x2fe7e2;this[_0xbff9('0x70')]=_0xbff9('0x71');this[_0xbff9('0x72')]=_0xbff9('0x73');this[_0xbff9('0x4f')]=_0x162b19['id'];this[_0xbff9('0x6a')]=_0x2c1177;this['appdata']=_0x279f08;}function createExtensionsReciveFax(_0x217b47){var _0x3f8d0a=0x1;var _0xba15ab=[];_0xba15ab[_0xbff9('0x74')](new Extension(_0x217b47,_0x3f8d0a,'',_0xbff9('0x75')));_0x3f8d0a+=0x1;_0xba15ab[_0xbff9('0x74')](new Extension(_0x217b47,_0x3f8d0a,_0xbff9('0x76'),'Set'));_0x3f8d0a+=0x1;for(var _0x232c3c in _0x217b47){if(_0x217b47[_0xbff9('0x38')](_0x232c3c)&&(_0x232c3c===_0xbff9('0x77')||_0x232c3c===_0xbff9('0x6e')||_0x232c3c===_0xbff9('0x78')||_0x232c3c==='faxdetect'||_0x232c3c==='headerinfo'||_0x232c3c===_0xbff9('0x79')||_0x232c3c===_0xbff9('0x7a')||_0x232c3c===_0xbff9('0x7b')||_0x232c3c===_0xbff9('0x7c'))){_0xba15ab[_0xbff9('0x74')](new Extension(_0x217b47,_0x3f8d0a,'FAXOPT('+_0x232c3c+')='+_0x217b47[_0x232c3c],_0xbff9('0x7d')));_0x3f8d0a+=0x1;}}_0xba15ab[_0xbff9('0x74')](new Extension(_0x217b47,_0x3f8d0a,'6',_0xbff9('0x7e')));_0x3f8d0a+=0x1;_0xba15ab['push'](new Extension(_0x217b47,_0x3f8d0a,_0xbff9('0x7f'),_0xbff9('0x80')));_0x3f8d0a=0x0;return _0xba15ab;}exports[_0xbff9('0x81')]=function(_0x42b896,_0x5b90e4,_0xf0c01d){var _0x552955;return db[_0xbff9('0x65')][_0xbff9('0x66')](function(_0x2f1557){return db[_0xbff9('0x2d')][_0xbff9('0x4a')](_0x42b896[_0xbff9('0x4b')],{'transaction':_0x2f1557})[_0xbff9('0x16')](function(_0x50d97a){_0x552955=_0x50d97a[_0xbff9('0x82')]({'plain':!![]});return db[_0xbff9('0x83')][_0xbff9('0x68')](createExtensionsReciveFax(_0x552955),{'transaction':_0x2f1557});});})['then'](function(){return _0x552955;})[_0xbff9('0x16')](respondWithResult(_0x5b90e4,null))[_0xbff9('0x20')](handleError(_0x5b90e4,null));};exports[_0xbff9('0x84')]=function(_0x8dc1a4,_0x40dde1,_0x5db060){var _0x90b56c;return db['sequelize'][_0xbff9('0x66')](function(_0x2962f4){return db[_0xbff9('0x2d')]['update'](_0x8dc1a4[_0xbff9('0x4b')],{'where':{'id':_0x8dc1a4[_0xbff9('0x4b')]['id']},'transaction':_0x2962f4})[_0xbff9('0x16')](function(_0x586611){return db[_0xbff9('0x83')][_0xbff9('0x2a')]({'where':{'FaxAccountId':_0x8dc1a4[_0xbff9('0x4b')]['id']},'transaction':_0x2962f4})[_0xbff9('0x16')](function(_0x35fd08){return db['VoiceExtension'][_0xbff9('0x68')](createExtensionsReciveFax(_[_0xbff9('0x5a')](_0x8dc1a4['body'],['tech',_0xbff9('0x85'),_0xbff9('0x86'),_0xbff9('0x87'),_0xbff9('0x88'),_0xbff9('0x89')])),{'transaction':_0x2962f4});});});})[_0xbff9('0x16')](function(){return db[_0xbff9('0x2d')]['findById'](_0x8dc1a4['body']['id']);})[_0xbff9('0x16')](respondWithResult(_0x40dde1,null))['catch'](handleError(_0x40dde1,null));};exports['getMessages']=function(_0x414d6a,_0x292fae,_0x36d892){var _0x3ff9ef={'raw':!![],'where':{}};var _0x585828={};var _0x4a43d5={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x414d6a['params']['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x292fae,null))[_0xbff9('0x16')](function(_0x269f2){if(_0x269f2){_0x585828[_0xbff9('0x2e')]=_[_0xbff9('0x2f')](db[_0xbff9('0x8a')][_0xbff9('0x49')]);_0x585828[_0xbff9('0x30')]=_['keys'](_0x414d6a[_0xbff9('0x30')]);_0x585828[_0xbff9('0x33')]=_[_0xbff9('0x34')](_0x585828[_0xbff9('0x2e')],_0x585828['query']);_0x3ff9ef[_0xbff9('0x35')]=_['intersection'](_0x585828['model'],qs[_0xbff9('0x36')](_0x414d6a[_0xbff9('0x30')]['fields']));_0x3ff9ef[_0xbff9('0x35')]=_0x3ff9ef['attributes'][_0xbff9('0x37')]?_0x3ff9ef['attributes']:_0x585828[_0xbff9('0x2e')];if(!_0x414d6a[_0xbff9('0x30')]['hasOwnProperty'](_0xbff9('0x39'))){_0x3ff9ef[_0xbff9('0x26')]=qs['limit'](_0x414d6a[_0xbff9('0x30')][_0xbff9('0x26')]);_0x3ff9ef[_0xbff9('0x25')]=qs[_0xbff9('0x25')](_0x414d6a['query'][_0xbff9('0x25')]);}_0x3ff9ef[_0xbff9('0x5c')]=qs['sort'](_0x414d6a[_0xbff9('0x30')][_0xbff9('0x3a')]);_0x3ff9ef[_0xbff9('0x3b')]=qs[_0xbff9('0x33')](_['pick'](_0x414d6a['query'],_0x585828['filters']));_0x3ff9ef[_0xbff9('0x3b')]['FaxAccountId']=_0x269f2['id'];if(_0x414d6a[_0xbff9('0x30')]['filter']){_0x3ff9ef[_0xbff9('0x3b')]=_[_0xbff9('0x3f')](_0x3ff9ef[_0xbff9('0x3b')],{'$or':_[_0xbff9('0x41')](_0x3ff9ef[_0xbff9('0x35')],function(_0x2252d0){var _0x44673e={};_0x44673e[_0x2252d0]={'$like':'%'+_0x414d6a['query'][_0xbff9('0x40')]+'%'};return _0x44673e;})});}if(_0x414d6a[_0xbff9('0x30')][_0xbff9('0x8b')]){var _0x34724e=_0x414d6a[_0xbff9('0x30')][_0xbff9('0x8b')][_0xbff9('0x8c')](',');var _0x398cc9={};_0x398cc9[_0x34724e[0x0]]={'$gte':moment(_0x34724e[0x1])[_0xbff9('0x8d')](_0xbff9('0x8e'))};_0x3ff9ef[_0xbff9('0x3b')]=_[_0xbff9('0x3f')](_0x3ff9ef[_0xbff9('0x3b')],_0x398cc9);}_0x3ff9ef=_[_0xbff9('0x3f')]({},_0x3ff9ef,_0x414d6a[_0xbff9('0x42')]);return db['FaxMessage'][_0xbff9('0x24')]({'where':_0x3ff9ef[_0xbff9('0x3b')]})[_0xbff9('0x16')](function(_0x16556d){_0x4a43d5['count']=_0x16556d;if(_0x414d6a[_0xbff9('0x30')][_0xbff9('0x43')]){_0x3ff9ef[_0xbff9('0x44')]=[{'all':!![]}];}return db['FaxMessage'][_0xbff9('0x45')](_0x3ff9ef);})[_0xbff9('0x16')](function(_0x19d6ed){_0x4a43d5[_0xbff9('0x46')]=_0x19d6ed;return _0x4a43d5;});}})[_0xbff9('0x16')](respondWithFilteredResult(_0x292fae,_0x3ff9ef))[_0xbff9('0x20')](handleError(_0x292fae,null));};exports[_0xbff9('0x2c')]=function(_0x54378e,_0xe6ebba,_0x2540d6){var _0x48bd2f,_0x4e4f90={},_0x77748d;if(_0x54378e[_0xbff9('0x4b')]['to']){_0x77748d=_0x54378e[_0xbff9('0x4b')]['to'][0x0];}return db[_0xbff9('0x2d')][_0xbff9('0x4c')]({'where':{'id':_0x54378e[_0xbff9('0x48')]['id']},'include':[{'model':db[_0xbff9('0x8f')],'as':_0xbff9('0x90'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x77748d},'limit':0x1,'order':[[_0xbff9('0x87'),_0xbff9('0x91')]]}]}]})[_0xbff9('0x16')](handleEntityNotFound(_0xe6ebba,null))[_0xbff9('0x16')](function(_0x3dcb71){_0x48bd2f=_0x3dcb71;if(_0x54378e[_0xbff9('0x4b')][_0xbff9('0x92')]&&_0x54378e['body'][_0xbff9('0x92')]['length']){for(var _0x2d5cd3=0x0;_0x2d5cd3<_0x54378e[_0xbff9('0x4b')][_0xbff9('0x92')][_0xbff9('0x37')];_0x2d5cd3+=0x1){_0x54378e[_0xbff9('0x4b')][_0xbff9('0x92')][_0x2d5cd3]={'filename':_0x54378e[_0xbff9('0x4b')][_0xbff9('0x92')][_0x2d5cd3][_0xbff9('0x60')],'id':_0x54378e[_0xbff9('0x4b')]['attachments'][_0x2d5cd3]['id'],'path':path[_0xbff9('0x93')](config['root'],_0xbff9('0x94'),_0x54378e['body'][_0xbff9('0x92')][_0x2d5cd3]['basename'])};}}return respondWithRpcPromise(_0xbff9('0x95'),'CheckAfterSend',{'FaxAccountId':_[_0xbff9('0x96')](_0x54378e[_0xbff9('0x48')]['id'])?undefined:_0x54378e[_0xbff9('0x48')]['id'],'path':_['isNil'](_0x54378e[_0xbff9('0x4b')][_0xbff9('0x92')][0x0]['path'])?undefined:_0x54378e['body'][_0xbff9('0x92')][0x0][_0xbff9('0x4')],'fax':_[_0xbff9('0x96')](_0x54378e[_0xbff9('0x4b')]['to'][0x0])?undefined:_0x54378e[_0xbff9('0x4b')]['to'][0x0]},client9002);})[_0xbff9('0x16')](function(){if(_0x48bd2f){if(_[_0xbff9('0x96')](_0x54378e['body'][_0xbff9('0x97')])){_0x54378e[_0xbff9('0x4b')]['from']=util[_0xbff9('0x8d')](_0xbff9('0x98'),_0x48bd2f['name'],_0x48bd2f[_0xbff9('0x99')]);}if(_0x48bd2f[_0xbff9('0x90')]){if(_0x48bd2f[_0xbff9('0x90')][_0xbff9('0x9a')][_0xbff9('0x37')]){return _0x48bd2f[_0xbff9('0x90')][_0xbff9('0x9a')][0x0];}else{return db[_0xbff9('0x5d')][_0xbff9('0x4a')](_[_0xbff9('0x9b')](_0x54378e[_0xbff9('0x4b')],{'firstName':_0x54378e[_0xbff9('0x4b')]['to'][0x0],'phone':_0x54378e[_0xbff9('0x4b')]['to'][0x0],'fax':_0x54378e[_0xbff9('0x4b')]['to'][0x0],'ListId':_0x48bd2f['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xbff9('0x9c'));}})[_0xbff9('0x16')](function(_0x20013e){if(_0x20013e){return db[_0xbff9('0x59')]['find']({'where':{'ContactId':_0x20013e['id'],'closed':![],'FaxAccountId':_0x48bd2f['id']}})[_0xbff9('0x16')](function(_0x561105){if(_0x561105){return[_0x561105,![]];}return db[_0xbff9('0x59')][_0xbff9('0x4a')]({'UserId':_0x54378e[_0xbff9('0x9d')]['id'],'ContactId':_0x20013e['id'],'FaxAccountId':_0x48bd2f['id'],'fax':_0x54378e[_0xbff9('0x4b')]['to'][0x0],'firstMsgDirection':_0xbff9('0x9e'),'Messages':[_[_0xbff9('0x3f')](_0x54378e[_0xbff9('0x4b')],{'read':![],'body':_0x54378e[_0xbff9('0x4b')][_0xbff9('0x92')][0x0][_0xbff9('0x9f')],'FaxAccountId':_0x48bd2f['id'],'UserId':_0x54378e[_0xbff9('0x9d')]['id'],'ContactId':_0x20013e['id'],'AttachmentId':_0x54378e['body'][_0xbff9('0x92')][0x0]['id']})]},{'include':[{'model':db[_0xbff9('0x8a')],'as':'Messages'}]})[_0xbff9('0x16')](function(_0x27201e){return[_0x27201e,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xbff9('0xa0')](function(_0x2c17e3,_0x54307d){if(_0x54307d){return _0x2c17e3;}return db[_0xbff9('0x8a')]['create']({'direction':_0xbff9('0x9e'),'read':![],'body':_0x54378e[_0xbff9('0x4b')]['attachments'][0x0][_0xbff9('0x9f')],'FaxAccountId':_0x48bd2f['id'],'FaxInteractionId':_0x2c17e3['id'],'UserId':_0x54378e['user']['id'],'ContactId':_0x2c17e3[_0xbff9('0xa1')],'AttachmentId':_0x54378e[_0xbff9('0x4b')][_0xbff9('0x92')][0x0]['id']})[_0xbff9('0x16')](function(_0x21b493){_0x2c17e3[_0xbff9('0xa2')][_0xbff9('0xa3')]=[];_0x2c17e3[_0xbff9('0xa2')]['Messages'][_0xbff9('0x74')](_0x21b493[_0xbff9('0xa2')]);return _0x2c17e3;});})[_0xbff9('0x16')](function(_0x1ce36a){respondWithRpcPromise(_0xbff9('0xa4'),'SendFax',{'FaxAccountId':_[_0xbff9('0x96')](_0x54378e[_0xbff9('0x48')]['id'])?undefined:_0x54378e[_0xbff9('0x48')]['id'],'path':_['isNil'](_0x54378e[_0xbff9('0x4b')]['attachments'][0x0][_0xbff9('0x4')])?undefined:_0x54378e[_0xbff9('0x4b')]['attachments'][0x0][_0xbff9('0x4')],'fax':_['isNil'](_0x54378e['body']['to'][0x0])?undefined:_0x54378e['body']['to'][0x0],'AttachmentId':_0x54378e[_0xbff9('0x4b')][_0xbff9('0x92')][0x0]['id']},client9002)[_0xbff9('0x16')](function(_0x5f59ec){logger[_0xbff9('0x1e')]('SendFaxRpc,\x20%s',_0x5f59ec);})[_0xbff9('0x20')](function(_0x1bf962){logger[_0xbff9('0x1e')](_0xbff9('0xa5'),_0x1bf962);});return _0x1ce36a;})[_0xbff9('0x16')](respondWithResult(_0xe6ebba,null))['catch'](handleError(_0xe6ebba,null));};exports[_0xbff9('0xa6')]=function(_0x5b463a,_0x5e1988,_0x4d1cfa){return db[_0xbff9('0x2d')][_0xbff9('0x4c')]({'where':{'id':_0x5b463a[_0xbff9('0x48')]['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x5e1988,null))[_0xbff9('0x16')](function(_0x25474c){if(_0x25474c){return _0x25474c[_0xbff9('0xa6')](_0x5b463a[_0xbff9('0x4b')][_0xbff9('0x54')],_[_0xbff9('0x5a')](_0x5b463a[_0xbff9('0x4b')],[_0xbff9('0x54'),'id'])||{})['spread'](function(_0x1cfb3c){for(var _0x328056=0x0;_0x328056<_0x5b463a[_0xbff9('0x4b')]['ids']['length'];_0x328056+=0x1){socket['emit']('userFaxAccount:save',{'UserId':_0x5b463a['body'][_0xbff9('0x54')][_0x328056],'FaxAccountId':_0x5b463a['params']['id']});}return _0x1cfb3c;});}})[_0xbff9('0x16')](respondWithResult(_0x5e1988,null))[_0xbff9('0x20')](handleError(_0x5e1988,null));};exports[_0xbff9('0xa7')]=function(_0x4fbf7d,_0x1b8331,_0x184979){var _0x4a4393;return db[_0xbff9('0x2d')][_0xbff9('0x4c')]({'where':{'id':_0x4fbf7d[_0xbff9('0x48')]['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x1b8331,null))[_0xbff9('0x16')](function(_0x3063ed){if(_0x3063ed){return _0x3063ed[_0xbff9('0xa7')](_0x4fbf7d[_0xbff9('0x30')][_0xbff9('0x54')])[_0xbff9('0x16')](function(_0x4231e3){if(_[_0xbff9('0xa8')](_0x4fbf7d[_0xbff9('0x30')][_0xbff9('0x54')])){for(var _0x45afd2=0x0;_0x45afd2<_0x4fbf7d[_0xbff9('0x30')][_0xbff9('0x54')]['length'];_0x45afd2+=0x1){socket['emit'](_0xbff9('0xa9'),{'UserId':_0x4fbf7d[_0xbff9('0x30')][_0xbff9('0x54')][_0x45afd2],'FaxAccountId':_0x4fbf7d[_0xbff9('0x48')]['id']});}}else{socket[_0xbff9('0xaa')]('userFaxAccount:remove',{'UserId':_0x4fbf7d['query'][_0xbff9('0x54')],'FaxAccountId':_0x4fbf7d[_0xbff9('0x48')]['id']});}});}})[_0xbff9('0x16')](respondWithStatusCode(_0x1b8331,null))[_0xbff9('0x20')](handleError(_0x1b8331,null));};exports['getAgents']=function(_0x5cc3c9,_0x52adda,_0x46a98b){var _0x24f4b0={};var _0x59aee3={};var _0x23e6d1;var _0x45f17e;return db[_0xbff9('0x2d')][_0xbff9('0x52')]({'where':{'id':_0x5cc3c9['params']['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x52adda,null))[_0xbff9('0x16')](function(_0x566f25){if(_0x566f25){_0x23e6d1=_0x566f25;_0x59aee3[_0xbff9('0x2e')]=_['keys'](db[_0xbff9('0x5f')][_0xbff9('0x49')]);_0x59aee3[_0xbff9('0x30')]=_[_0xbff9('0x2f')](_0x5cc3c9[_0xbff9('0x30')]);_0x59aee3[_0xbff9('0x33')]=_[_0xbff9('0x34')](_0x59aee3[_0xbff9('0x2e')],_0x59aee3[_0xbff9('0x30')]);_0x24f4b0[_0xbff9('0x35')]=_[_0xbff9('0x34')](_0x59aee3[_0xbff9('0x2e')],qs[_0xbff9('0x36')](_0x5cc3c9['query'][_0xbff9('0x36')]));_0x24f4b0[_0xbff9('0x35')]=_0x24f4b0[_0xbff9('0x35')][_0xbff9('0x37')]?_0x24f4b0[_0xbff9('0x35')]:_0x59aee3[_0xbff9('0x2e')];_0x24f4b0[_0xbff9('0x5c')]=qs['sort'](_0x5cc3c9[_0xbff9('0x30')][_0xbff9('0x3a')]);_0x24f4b0[_0xbff9('0x3b')]=qs[_0xbff9('0x33')](_[_0xbff9('0x3c')](_0x5cc3c9[_0xbff9('0x30')],_0x59aee3[_0xbff9('0x33')]));if(_0x5cc3c9[_0xbff9('0x30')][_0xbff9('0x40')]){_0x24f4b0['where']=_[_0xbff9('0x3f')](_0x24f4b0[_0xbff9('0x3b')],{'$or':_[_0xbff9('0x41')](_0x24f4b0[_0xbff9('0x35')],function(_0x4b4fda){var _0xa78973={};_0xa78973[_0x4b4fda]={'$like':'%'+_0x5cc3c9[_0xbff9('0x30')]['filter']+'%'};return _0xa78973;})});}_0x24f4b0=_[_0xbff9('0x3f')]({},_0x24f4b0,_0x5cc3c9[_0xbff9('0x42')]);return _0x23e6d1[_0xbff9('0xab')](_0x24f4b0);}})['then'](function(_0x3af6d7){if(_0x3af6d7){_0x45f17e=_0x3af6d7['length'];if(!_0x5cc3c9[_0xbff9('0x30')]['hasOwnProperty'](_0xbff9('0x39'))){_0x24f4b0[_0xbff9('0x26')]=qs['limit'](_0x5cc3c9[_0xbff9('0x30')][_0xbff9('0x26')]);_0x24f4b0[_0xbff9('0x25')]=qs[_0xbff9('0x25')](_0x5cc3c9['query']['offset']);}return _0x23e6d1['getAgents'](_0x24f4b0);}})[_0xbff9('0x16')](function(_0xb8c2a8){if(_0xb8c2a8){return _0xb8c2a8?{'count':_0x45f17e,'rows':_0xb8c2a8}:null;}})[_0xbff9('0x16')](respondWithResult(_0x52adda,null))[_0xbff9('0x20')](handleError(_0x52adda,null));}; \ No newline at end of file +var _0xf5b5=['sendStatus','status','end','count','offset','limit','set','Content-Range','json','save','update','destroy','stack','name','send','index','FaxAccount','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','add','day','merge','where','map','filter','includeAll','findAll','rows','show','params','rawAttributes','length','include','options','find','create','body','describe','addDisposition','FaxAccountId','Disposition','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','order','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','fullname','internal','Tag','Tags','tag','addApplications','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','exten','localstationid','app','type','system','description','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','minrate','modem','t38timeout','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','get','VoiceExtension','updateAccountApplications','key','createdAt','TrunkId','ListId','findById','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','List','Contacts','updatedAt','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','defaults','List\x20not\x20found','Send\x20Fax\x20failed','user','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','spread','emit','removeAgents','userFaxAccount:remove','getAgents','fast-json-patch','request-promise','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x588806,_0x1bf949){var _0x5677c5=function(_0x439793){while(--_0x439793){_0x588806['push'](_0x588806['shift']());}};_0x5677c5(++_0x1bf949);}(_0xf5b5,0x91));var _0x5f5b=function(_0x5a43fc,_0x302add){_0x5a43fc=_0x5a43fc-0x0;var _0x41048c=_0xf5b5[_0x5a43fc];return _0x41048c;};'use strict';var jsonpatch=require(_0x5f5b('0x0'));var rp=require(_0x5f5b('0x1'));var moment=require('moment');var BPromise=require(_0x5f5b('0x2'));var Mustache=require('mustache');var util=require(_0x5f5b('0x3'));var path=require('path');var sox=require(_0x5f5b('0x4'));var csv=require(_0x5f5b('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5f5b('0x6'));var squel=require(_0x5f5b('0x7'));var crypto=require(_0x5f5b('0x8'));var jsforce=require(_0x5f5b('0x9'));var deskjs=require(_0x5f5b('0xa'));var toCsv=require(_0x5f5b('0x5'));var querystring=require(_0x5f5b('0xb'));var Papa=require(_0x5f5b('0xc'));var qs=require(_0x5f5b('0xd'));var logger=require(_0x5f5b('0xe'))(_0x5f5b('0xf'));var utils=require('../../config/utils');var config=require(_0x5f5b('0x10'));var db=require(_0x5f5b('0x11'))['db'];var socket=require(_0x5f5b('0x12'))({'host':'localhost','port':0x18eb});require(_0x5f5b('0x13'))[_0x5f5b('0x14')](socket);var jayson=require(_0x5f5b('0x15'));var client=jayson[_0x5f5b('0x16')]['http']({'port':0x232c});var client9002=jayson[_0x5f5b('0x16')][_0x5f5b('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x4dbf80,_0x33974f,_0x2ebb42,_0xc0c332){return new BPromise(function(_0x5c60d7,_0x4aa1ec){var _0x421b2a=_0xc0c332||client;return _0x421b2a['request'](_0x4dbf80,_0x2ebb42)[_0x5f5b('0x18')](function(_0xde05ae){logger['info'](_0x5f5b('0x19'),_0x33974f,_0x5f5b('0x1a'));logger[_0x5f5b('0x1b')](_0x5f5b('0x1c'),_0x33974f,_0x5f5b('0x1a'),JSON[_0x5f5b('0x1d')](_0xde05ae));if(_0xde05ae['error']){if(_0xde05ae[_0x5f5b('0x1e')][_0x5f5b('0x1f')]===0x1f4){logger[_0x5f5b('0x1e')](_0x5f5b('0x19'),_0x33974f,_0xde05ae[_0x5f5b('0x1e')]['message']);return _0x4aa1ec(_0xde05ae['error'][_0x5f5b('0x20')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x33974f,_0xde05ae[_0x5f5b('0x1e')][_0x5f5b('0x20')]);return _0x5c60d7(_0xde05ae[_0x5f5b('0x1e')][_0x5f5b('0x20')]);}else{logger[_0x5f5b('0x21')](_0x5f5b('0x19'),_0x33974f,_0x5f5b('0x1a'));_0x5c60d7(_0xde05ae[_0x5f5b('0x22')]['message']);}})[_0x5f5b('0x23')](function(_0x1a3748){logger[_0x5f5b('0x1e')]('FaxAccount,\x20%s,\x20%s',_0x33974f,_0x1a3748);_0x4aa1ec(_0x1a3748);});});}function respondWithStatusCode(_0x2ef604,_0x24e697){_0x24e697=_0x24e697||0xcc;return function(_0x5bbe68){if(_0x5bbe68){return _0x2ef604[_0x5f5b('0x24')](_0x24e697);}return _0x2ef604[_0x5f5b('0x25')](_0x24e697)[_0x5f5b('0x26')]();};}function respondWithResult(_0x1ae36e,_0x3aee69){_0x3aee69=_0x3aee69||0xc8;return function(_0x38ab99){if(_0x38ab99){return _0x1ae36e[_0x5f5b('0x25')](_0x3aee69)['json'](_0x38ab99);}};}function respondWithFilteredResult(_0x5eb033,_0x5a1729){return function(_0x410b10){if(_0x410b10){var _0x284170=_0x410b10[_0x5f5b('0x27')],_0x35a7e0=_0x5a1729[_0x5f5b('0x28')],_0x48ce14=_0x5a1729[_0x5f5b('0x28')]+_0x5a1729[_0x5f5b('0x29')],_0x1ca43e;if(_0x48ce14>=_0x284170){_0x48ce14=_0x284170;_0x1ca43e=0xc8;}else{_0x1ca43e=0xce;}_0x5eb033[_0x5f5b('0x25')](_0x1ca43e);return _0x5eb033[_0x5f5b('0x2a')](_0x5f5b('0x2b'),_0x35a7e0+'-'+_0x48ce14+'/'+_0x284170)[_0x5f5b('0x2c')](_0x410b10);}return null;};}function patchUpdates(_0x35f88e){return function(_0x33040b){try{jsonpatch['apply'](_0x33040b,_0x35f88e,!![]);}catch(_0x335b37){return BPromise['reject'](_0x335b37);}return _0x33040b[_0x5f5b('0x2d')]();};}function saveUpdates(_0xb0ebd1,_0x5a0414){return function(_0x2657a6){if(_0x2657a6){return _0x2657a6[_0x5f5b('0x2e')](_0xb0ebd1)[_0x5f5b('0x18')](function(_0x271d89){return _0x271d89;});}return null;};}function removeEntity(_0x1e90af,_0x4f0051){return function(_0x437953){if(_0x437953){return _0x437953[_0x5f5b('0x2f')]()[_0x5f5b('0x18')](function(){_0x1e90af[_0x5f5b('0x25')](0xcc)[_0x5f5b('0x26')]();});}};}function handleEntityNotFound(_0x91d4cc,_0x12271c){return function(_0x234e87){if(!_0x234e87){_0x91d4cc['sendStatus'](0x194);}return _0x234e87;};}function handleError(_0x585e83,_0x701628){_0x701628=_0x701628||0x1f4;return function(_0x3de57c){logger[_0x5f5b('0x1e')](_0x3de57c[_0x5f5b('0x30')]);if(_0x3de57c['name']){delete _0x3de57c[_0x5f5b('0x31')];}_0x585e83[_0x5f5b('0x25')](_0x701628)[_0x5f5b('0x32')](_0x3de57c);};}exports[_0x5f5b('0x33')]=function(_0x115b59,_0x47bc70){var _0x178fe9={},_0x3f38c5={},_0x570082={'count':0x0,'rows':[]};var _0xceacd7=db[_0x5f5b('0x34')]['rawAttributes'];_0x3f38c5[_0x5f5b('0x35')]=_[_0x5f5b('0x36')](_0xceacd7);var _0x454184={'dateStart':_0x115b59[_0x5f5b('0x37')][_0x5f5b('0x38')],'dateEnd':_0x115b59[_0x5f5b('0x37')][_0x5f5b('0x39')]};delete _0x115b59[_0x5f5b('0x37')][_0x5f5b('0x38')];delete _0x115b59[_0x5f5b('0x37')][_0x5f5b('0x39')];_0x3f38c5[_0x5f5b('0x37')]=_[_0x5f5b('0x36')](_0x115b59[_0x5f5b('0x37')]);_0x3f38c5[_0x5f5b('0x3a')]=_[_0x5f5b('0x3b')](_0x3f38c5['model'],_0x3f38c5['query']);_0x178fe9[_0x5f5b('0x3c')]=_[_0x5f5b('0x3b')](_0x3f38c5['model'],qs[_0x5f5b('0x3d')](_0x115b59['query']['fields']));_0x178fe9['attributes']=_0x178fe9[_0x5f5b('0x3c')]['length']?_0x178fe9[_0x5f5b('0x3c')]:_0x3f38c5[_0x5f5b('0x35')];if(!_0x115b59['query'][_0x5f5b('0x3e')](_0x5f5b('0x3f'))){_0x178fe9[_0x5f5b('0x29')]=qs['limit'](_0x115b59[_0x5f5b('0x37')][_0x5f5b('0x29')]);_0x178fe9[_0x5f5b('0x28')]=qs['offset'](_0x115b59['query']['offset']);}_0x178fe9['order']=qs[_0x5f5b('0x40')](_0x115b59[_0x5f5b('0x37')][_0x5f5b('0x40')]);_0x178fe9['where']=qs[_0x5f5b('0x3a')](_['pick'](_0x115b59[_0x5f5b('0x37')],_0x3f38c5[_0x5f5b('0x3a')]));if(_0x454184[_0x5f5b('0x38')]){if(_0x454184['dateEnd']){_0x454184[_0x5f5b('0x39')]=moment(_0x454184[_0x5f5b('0x39')])['add'](0x1,'day');}else{_0x454184[_0x5f5b('0x39')]=moment(_0x454184[_0x5f5b('0x38')])[_0x5f5b('0x41')](0x1,_0x5f5b('0x42'));}_[_0x5f5b('0x43')](_0x178fe9['where'],{'createdAt':{'$gte':_0x454184[_0x5f5b('0x38')],'$lte':_0x454184[_0x5f5b('0x39')]}});}if(_0x115b59[_0x5f5b('0x37')]['filter']){_0x178fe9['where']=_[_0x5f5b('0x43')](_0x178fe9[_0x5f5b('0x44')],{'$or':_[_0x5f5b('0x45')](_0x178fe9[_0x5f5b('0x3c')],function(_0x29c1e4){var _0x250cb9={};_0x250cb9[_0x29c1e4]={'$like':'%'+_0x115b59[_0x5f5b('0x37')][_0x5f5b('0x46')]+'%'};return _0x250cb9;})});}_0x178fe9=_[_0x5f5b('0x43')]({},_0x178fe9,_0x115b59['options']);var _0x486b3b={'where':_0x178fe9[_0x5f5b('0x44')]};return db[_0x5f5b('0x34')]['count'](_0x486b3b)['then'](function(_0x1a9d34){_0x570082[_0x5f5b('0x27')]=_0x1a9d34;if(_0x115b59['query'][_0x5f5b('0x47')]){_0x178fe9['include']=[{'all':!![]}];}return db[_0x5f5b('0x34')][_0x5f5b('0x48')](_0x178fe9);})[_0x5f5b('0x18')](function(_0x5bd061){_0x570082[_0x5f5b('0x49')]=_0x5bd061;return _0x570082;})[_0x5f5b('0x18')](respondWithFilteredResult(_0x47bc70,_0x178fe9))['catch'](handleError(_0x47bc70,null));};exports[_0x5f5b('0x4a')]=function(_0x63c433,_0xccac6e){var _0xf05224={'raw':![],'where':{'id':_0x63c433[_0x5f5b('0x4b')]['id']}},_0x24e05f={};_0x24e05f['model']=_['keys'](db['FaxAccount'][_0x5f5b('0x4c')]);_0x24e05f[_0x5f5b('0x37')]=_[_0x5f5b('0x36')](_0x63c433[_0x5f5b('0x37')]);_0x24e05f[_0x5f5b('0x3a')]=_[_0x5f5b('0x3b')](_0x24e05f[_0x5f5b('0x35')],_0x24e05f['query']);_0xf05224[_0x5f5b('0x3c')]=_[_0x5f5b('0x3b')](_0x24e05f[_0x5f5b('0x35')],qs[_0x5f5b('0x3d')](_0x63c433[_0x5f5b('0x37')]['fields']));_0xf05224[_0x5f5b('0x3c')]=_0xf05224[_0x5f5b('0x3c')][_0x5f5b('0x4d')]?_0xf05224['attributes']:_0x24e05f[_0x5f5b('0x35')];if(_0x63c433['query'][_0x5f5b('0x47')]){_0xf05224[_0x5f5b('0x4e')]=[{'all':!![]}];}_0xf05224=_[_0x5f5b('0x43')]({},_0xf05224,_0x63c433[_0x5f5b('0x4f')]);return db[_0x5f5b('0x34')][_0x5f5b('0x50')](_0xf05224)['then'](handleEntityNotFound(_0xccac6e,null))[_0x5f5b('0x18')](respondWithResult(_0xccac6e,null))['catch'](handleError(_0xccac6e,null));};exports[_0x5f5b('0x51')]=function(_0x1984cc,_0x125c84){return db[_0x5f5b('0x34')][_0x5f5b('0x51')](_0x1984cc[_0x5f5b('0x52')],{})[_0x5f5b('0x18')](respondWithResult(_0x125c84,0xc9))[_0x5f5b('0x23')](handleError(_0x125c84,null));};exports['update']=function(_0x31d334,_0x36ca01){if(_0x31d334[_0x5f5b('0x52')]['id']){delete _0x31d334['body']['id'];}return db['FaxAccount'][_0x5f5b('0x50')]({'where':{'id':_0x31d334['params']['id']}})[_0x5f5b('0x18')](handleEntityNotFound(_0x36ca01,null))[_0x5f5b('0x18')](saveUpdates(_0x31d334[_0x5f5b('0x52')],null))[_0x5f5b('0x18')](respondWithResult(_0x36ca01,null))[_0x5f5b('0x23')](handleError(_0x36ca01,null));};exports['destroy']=function(_0x12999d,_0x48e1aa){return db['FaxAccount']['find']({'where':{'id':_0x12999d['params']['id']}})[_0x5f5b('0x18')](handleEntityNotFound(_0x48e1aa,null))[_0x5f5b('0x18')](removeEntity(_0x48e1aa,null))['catch'](handleError(_0x48e1aa,null));};exports[_0x5f5b('0x53')]=function(_0x15d343,_0x2787ab){return db['FaxAccount']['describe']()[_0x5f5b('0x18')](respondWithResult(_0x2787ab,null))[_0x5f5b('0x23')](handleError(_0x2787ab,null));};exports[_0x5f5b('0x54')]=function(_0x68510f,_0x7bdfc6,_0x5afbcd){if(_0x68510f[_0x5f5b('0x52')]['id']){delete _0x68510f[_0x5f5b('0x52')]['id'];}return db['FaxAccount'][_0x5f5b('0x50')]({'where':{'id':_0x68510f[_0x5f5b('0x4b')]['id']}})[_0x5f5b('0x18')](handleEntityNotFound(_0x7bdfc6,null))[_0x5f5b('0x18')](function(_0xf8aa7f){if(_0xf8aa7f){_0x68510f[_0x5f5b('0x52')][_0x5f5b('0x55')]=_0xf8aa7f['id'];return db[_0x5f5b('0x56')][_0x5f5b('0x51')](_0x68510f[_0x5f5b('0x52')]);}})['then'](respondWithResult(_0x7bdfc6,null))[_0x5f5b('0x23')](handleError(_0x7bdfc6,null));};exports['getDispositions']=function(_0x46be4b,_0x3cb6a3,_0x567bbf){var _0x11d394={'raw':![],'where':{}};var _0x2227c5={};var _0xb00e4={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x46be4b[_0x5f5b('0x4b')]['id']}})[_0x5f5b('0x18')](handleEntityNotFound(_0x3cb6a3,null))[_0x5f5b('0x18')](function(_0x3d9455){if(_0x3d9455){_0x2227c5[_0x5f5b('0x35')]=_[_0x5f5b('0x36')](db[_0x5f5b('0x56')][_0x5f5b('0x4c')]);_0x2227c5[_0x5f5b('0x37')]=_[_0x5f5b('0x36')](_0x46be4b[_0x5f5b('0x37')]);_0x2227c5['filters']=_['intersection'](_0x2227c5[_0x5f5b('0x35')],_0x2227c5[_0x5f5b('0x37')]);_0x11d394[_0x5f5b('0x3c')]=_['intersection'](_0x2227c5['model'],qs[_0x5f5b('0x3d')](_0x46be4b[_0x5f5b('0x37')][_0x5f5b('0x3d')]));_0x11d394[_0x5f5b('0x3c')]=_0x11d394[_0x5f5b('0x3c')][_0x5f5b('0x4d')]?_0x11d394[_0x5f5b('0x3c')]:_0x2227c5[_0x5f5b('0x35')];if(!_0x46be4b[_0x5f5b('0x37')][_0x5f5b('0x3e')](_0x5f5b('0x3f'))){_0x11d394['limit']=qs[_0x5f5b('0x29')](_0x46be4b[_0x5f5b('0x37')]['limit']);_0x11d394[_0x5f5b('0x28')]=qs[_0x5f5b('0x28')](_0x46be4b[_0x5f5b('0x37')][_0x5f5b('0x28')]);}_0x11d394['order']=qs['sort'](_0x46be4b[_0x5f5b('0x37')][_0x5f5b('0x40')]);_0x11d394[_0x5f5b('0x44')]=qs[_0x5f5b('0x3a')](_[_0x5f5b('0x57')](_0x46be4b[_0x5f5b('0x37')],_0x2227c5['filters']));_0x11d394[_0x5f5b('0x44')][_0x5f5b('0x55')]=_0x3d9455['id'];if(_0x46be4b[_0x5f5b('0x37')][_0x5f5b('0x46')]){_0x11d394[_0x5f5b('0x44')]=_['merge'](_0x11d394[_0x5f5b('0x44')],{'$or':_[_0x5f5b('0x45')](_0x11d394[_0x5f5b('0x3c')],function(_0x3d8ef5){var _0x343bd4={};_0x343bd4[_0x3d8ef5]={'$like':'%'+_0x46be4b['query']['filter']+'%'};return _0x343bd4;})});}_0x11d394=_[_0x5f5b('0x43')]({},_0x11d394,_0x46be4b[_0x5f5b('0x4f')]);return db['Disposition'][_0x5f5b('0x27')]({'where':_0x11d394[_0x5f5b('0x44')]})[_0x5f5b('0x18')](function(_0x2ffc41){_0xb00e4['count']=_0x2ffc41;if(_0x46be4b[_0x5f5b('0x37')][_0x5f5b('0x47')]){_0x11d394[_0x5f5b('0x4e')]=[{'all':!![]}];}return db[_0x5f5b('0x56')][_0x5f5b('0x48')](_0x11d394);})[_0x5f5b('0x18')](function(_0x432f3e){_0xb00e4[_0x5f5b('0x49')]=_0x432f3e;return _0xb00e4;});}})['then'](respondWithFilteredResult(_0x3cb6a3,_0x11d394))[_0x5f5b('0x23')](handleError(_0x3cb6a3,null));};exports[_0x5f5b('0x58')]=function(_0x3e4187,_0x457d77,_0x4b9389){var _0x241932;return db[_0x5f5b('0x34')][_0x5f5b('0x50')]({'where':{'id':_0x3e4187[_0x5f5b('0x4b')]['id']}})[_0x5f5b('0x18')](handleEntityNotFound(_0x457d77,null))['then'](function(_0x14b0ab){if(_0x14b0ab){return _0x14b0ab[_0x5f5b('0x58')](_0x3e4187[_0x5f5b('0x37')][_0x5f5b('0x59')]);}})[_0x5f5b('0x18')](respondWithStatusCode(_0x457d77,null))[_0x5f5b('0x23')](handleError(_0x457d77,null));};exports[_0x5f5b('0x5a')]=function(_0x2cac72,_0x2a6181,_0x1fbf9e){if(_0x2cac72[_0x5f5b('0x52')]['id']){delete _0x2cac72[_0x5f5b('0x52')]['id'];}return db[_0x5f5b('0x34')][_0x5f5b('0x50')]({'where':{'id':_0x2cac72[_0x5f5b('0x4b')]['id']}})[_0x5f5b('0x18')](handleEntityNotFound(_0x2a6181,null))['then'](function(_0x5a0064){if(_0x5a0064){_0x2cac72['body']['FaxAccountId']=_0x5a0064['id'];return db[_0x5f5b('0x5b')][_0x5f5b('0x51')](_0x2cac72['body']);}})[_0x5f5b('0x18')](respondWithResult(_0x2a6181,null))['catch'](handleError(_0x2a6181,null));};exports[_0x5f5b('0x5c')]=function(_0xcfd181,_0x272412,_0x2ae7e5){var _0x3b70c0={'raw':![],'where':{}};var _0x5da74e={};var _0x27c7f9={'count':0x0,'rows':[]};return db['FaxAccount'][_0x5f5b('0x5d')]({'where':{'id':_0xcfd181['params']['id']}})[_0x5f5b('0x18')](handleEntityNotFound(_0x272412,null))[_0x5f5b('0x18')](function(_0x3a4641){if(_0x3a4641){_0x5da74e[_0x5f5b('0x35')]=_[_0x5f5b('0x36')](db[_0x5f5b('0x5b')][_0x5f5b('0x4c')]);_0x5da74e[_0x5f5b('0x37')]=_[_0x5f5b('0x36')](_0xcfd181[_0x5f5b('0x37')]);_0x5da74e[_0x5f5b('0x3a')]=_[_0x5f5b('0x3b')](_0x5da74e['model'],_0x5da74e['query']);_0x3b70c0['attributes']=_['intersection'](_0x5da74e['model'],qs[_0x5f5b('0x3d')](_0xcfd181['query'][_0x5f5b('0x3d')]));_0x3b70c0[_0x5f5b('0x3c')]=_0x3b70c0[_0x5f5b('0x3c')][_0x5f5b('0x4d')]?_0x3b70c0[_0x5f5b('0x3c')]:_0x5da74e[_0x5f5b('0x35')];if(!_0xcfd181['query'][_0x5f5b('0x3e')](_0x5f5b('0x3f'))){_0x3b70c0['limit']=qs[_0x5f5b('0x29')](_0xcfd181['query'][_0x5f5b('0x29')]);_0x3b70c0['offset']=qs[_0x5f5b('0x28')](_0xcfd181['query'][_0x5f5b('0x28')]);}_0x3b70c0[_0x5f5b('0x5e')]=qs[_0x5f5b('0x40')](_0xcfd181[_0x5f5b('0x37')][_0x5f5b('0x40')]);_0x3b70c0[_0x5f5b('0x44')]=qs[_0x5f5b('0x3a')](_[_0x5f5b('0x57')](_0xcfd181[_0x5f5b('0x37')],_0x5da74e[_0x5f5b('0x3a')]));_0x3b70c0['where'][_0x5f5b('0x55')]=_0x3a4641['id'];if(_0xcfd181[_0x5f5b('0x37')][_0x5f5b('0x46')]){_0x3b70c0['where']=_[_0x5f5b('0x43')](_0x3b70c0['where'],{'$or':_[_0x5f5b('0x45')](_0x3b70c0[_0x5f5b('0x3c')],function(_0x818fdc){var _0x37b8c5={};_0x37b8c5[_0x818fdc]={'$like':'%'+_0xcfd181[_0x5f5b('0x37')][_0x5f5b('0x46')]+'%'};return _0x37b8c5;})});}_0x3b70c0=_['merge']({},_0x3b70c0,_0xcfd181[_0x5f5b('0x4f')]);return db[_0x5f5b('0x5b')][_0x5f5b('0x27')]({'where':_0x3b70c0['where']})['then'](function(_0x7b793f){_0x27c7f9[_0x5f5b('0x27')]=_0x7b793f;if(_0xcfd181['query'][_0x5f5b('0x47')]){_0x3b70c0[_0x5f5b('0x4e')]=[{'all':!![]}];}return db[_0x5f5b('0x5b')][_0x5f5b('0x48')](_0x3b70c0);})[_0x5f5b('0x18')](function(_0x54d72e){_0x27c7f9[_0x5f5b('0x49')]=_0x54d72e;return _0x27c7f9;});}})[_0x5f5b('0x18')](respondWithFilteredResult(_0x272412,_0x3b70c0))['catch'](handleError(_0x272412,null));};exports[_0x5f5b('0x5f')]=function(_0x12f30f,_0x430d77,_0x51c398){var _0x4865a3;return db[_0x5f5b('0x34')][_0x5f5b('0x50')]({'where':{'id':_0x12f30f[_0x5f5b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x430d77,null))[_0x5f5b('0x18')](function(_0x55f487){if(_0x55f487){return _0x55f487[_0x5f5b('0x5f')](_0x12f30f[_0x5f5b('0x37')][_0x5f5b('0x59')]);}})[_0x5f5b('0x18')](respondWithStatusCode(_0x430d77,null))['catch'](handleError(_0x430d77,null));};exports[_0x5f5b('0x60')]=function(_0x3ee9c4,_0x25c4fc,_0x3f3793){return db[_0x5f5b('0x61')]['find']({'where':{'id':_0x3ee9c4[_0x5f5b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x25c4fc,null))['then'](function(_0x4972fa){if(_0x4972fa){return _0x4972fa[_0x5f5b('0x60')](_0x3ee9c4['body'][_0x5f5b('0x59')],_[_0x5f5b('0x62')](_0x3ee9c4['body'],[_0x5f5b('0x59'),'id'])||{});}})['then'](respondWithResult(_0x25c4fc,null))[_0x5f5b('0x23')](handleError(_0x25c4fc,null));};exports[_0x5f5b('0x63')]=function(_0x58138a,_0x13dd9a,_0x3b94d3){var _0x586f8e={'raw':![],'where':{}};var _0x5732a7={};var _0x4dcd87={'count':0x0,'rows':[]};return db['FaxAccount'][_0x5f5b('0x5d')]({'where':{'id':_0x58138a[_0x5f5b('0x4b')]['id']}})[_0x5f5b('0x18')](handleEntityNotFound(_0x13dd9a,null))[_0x5f5b('0x18')](function(_0x5970b3){if(_0x5970b3){_0x5732a7[_0x5f5b('0x35')]=_[_0x5f5b('0x36')](db[_0x5f5b('0x61')]['rawAttributes']);_0x5732a7['query']=_[_0x5f5b('0x36')](_0x58138a['query']);_0x5732a7[_0x5f5b('0x3a')]=_[_0x5f5b('0x3b')](_0x5732a7[_0x5f5b('0x35')],_0x5732a7[_0x5f5b('0x37')]);_0x586f8e[_0x5f5b('0x3c')]=_[_0x5f5b('0x3b')](_0x5732a7[_0x5f5b('0x35')],qs[_0x5f5b('0x3d')](_0x58138a[_0x5f5b('0x37')][_0x5f5b('0x3d')]));_0x586f8e['attributes']=_0x586f8e[_0x5f5b('0x3c')][_0x5f5b('0x4d')]?_0x586f8e['attributes']:_0x5732a7[_0x5f5b('0x35')];if(!_0x58138a[_0x5f5b('0x37')][_0x5f5b('0x3e')](_0x5f5b('0x3f'))){_0x586f8e[_0x5f5b('0x29')]=qs[_0x5f5b('0x29')](_0x58138a[_0x5f5b('0x37')][_0x5f5b('0x29')]);_0x586f8e[_0x5f5b('0x28')]=qs[_0x5f5b('0x28')](_0x58138a[_0x5f5b('0x37')]['offset']);}_0x586f8e[_0x5f5b('0x5e')]=qs[_0x5f5b('0x40')](_0x58138a[_0x5f5b('0x37')][_0x5f5b('0x40')]);_0x586f8e[_0x5f5b('0x44')]=qs[_0x5f5b('0x3a')](_[_0x5f5b('0x57')](_0x58138a[_0x5f5b('0x37')],_0x5732a7[_0x5f5b('0x3a')]));_0x586f8e[_0x5f5b('0x44')]['FaxAccountId']=_0x5970b3['id'];if(_0x58138a['query']['filter']){_0x586f8e['where']=_[_0x5f5b('0x43')](_0x586f8e[_0x5f5b('0x44')],{'$or':_[_0x5f5b('0x45')](_0x586f8e['attributes'],function(_0x4228c5){var _0x37e381={};_0x37e381[_0x4228c5]={'$like':'%'+_0x58138a[_0x5f5b('0x37')][_0x5f5b('0x46')]+'%'};return _0x37e381;})});}_0x586f8e=_[_0x5f5b('0x43')]({},_0x586f8e,_0x58138a[_0x5f5b('0x4f')]);return db['FaxInteraction']['count']({'where':_0x586f8e['where']})['then'](function(_0x3c0a29){_0x4dcd87[_0x5f5b('0x27')]=_0x3c0a29;if(_0x58138a[_0x5f5b('0x37')][_0x5f5b('0x47')]){_0x586f8e[_0x5f5b('0x4e')]=[{'model':db[_0x5f5b('0x64')],'as':_0x5f5b('0x65'),'required':![]},{'model':db[_0x5f5b('0x66')],'as':'Owner','attributes':[_0x5f5b('0x31'),_0x5f5b('0x67'),_0x5f5b('0x68')],'required':![]},{'model':db[_0x5f5b('0x69')],'as':_0x5f5b('0x6a'),'attributes':['id','name','color'],'where':_0x58138a[_0x5f5b('0x37')]['tag']?{'id':_0x58138a[_0x5f5b('0x37')][_0x5f5b('0x6b')]}:undefined,'required':_0x58138a['query'][_0x5f5b('0x6b')]?!![]:![]}];}return db[_0x5f5b('0x61')][_0x5f5b('0x48')](_0x586f8e);})[_0x5f5b('0x18')](function(_0x5b0ce8){_0x4dcd87[_0x5f5b('0x49')]=_0x5b0ce8;return _0x4dcd87;});}})[_0x5f5b('0x18')](respondWithFilteredResult(_0x13dd9a,_0x586f8e))[_0x5f5b('0x23')](handleError(_0x13dd9a,null));};exports[_0x5f5b('0x6c')]=function(_0xcf5c4f,_0xc8598,_0x3968f8){return db['FaxAccount'][_0x5f5b('0x5d')]({'where':{'id':_0xcf5c4f['params']['id']}})['then'](handleEntityNotFound(_0xc8598,null))[_0x5f5b('0x18')](function(_0xac70e0){if(_0xac70e0){return db['sequelize'][_0x5f5b('0x6d')](function(_0x4fba59){return db[_0x5f5b('0x6e')]['destroy']({'where':{'FaxAccountId':_0xcf5c4f['params']['id']},'transaction':_0x4fba59})['then'](function(_0x1dd7ec){var _0x3d9f0e=_[_0x5f5b('0x45')](_0xcf5c4f[_0x5f5b('0x52')],function(_0xd93c3d){_0xd93c3d[_0x5f5b('0x55')]=_0xcf5c4f[_0x5f5b('0x4b')]['id'];return _0xd93c3d;});return db[_0x5f5b('0x6e')][_0x5f5b('0x6f')](_0x3d9f0e,{'transaction':_0x4fba59});});})['then'](function(){return db[_0x5f5b('0x6e')][_0x5f5b('0x70')]({'where':{'FaxAccountId':_0xcf5c4f[_0x5f5b('0x4b')]['id']},'order':_0x5f5b('0x71')});});}})[_0x5f5b('0x18')](respondWithResult(_0xc8598,null))[_0x5f5b('0x23')](handleError(_0xc8598,null));};exports[_0x5f5b('0x72')]=function(_0x5d516f,_0x528849,_0x45837b){var _0x33f999={};var _0x264b4d={};var _0x11cdfa;var _0x30c8c8;return db[_0x5f5b('0x34')][_0x5f5b('0x5d')]({'where':{'id':_0x5d516f[_0x5f5b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x528849,null))[_0x5f5b('0x18')](function(_0x45bebe){if(_0x45bebe){_0x11cdfa=_0x45bebe;_0x264b4d[_0x5f5b('0x35')]=_[_0x5f5b('0x36')](db[_0x5f5b('0x6e')][_0x5f5b('0x4c')]);_0x264b4d[_0x5f5b('0x37')]=_[_0x5f5b('0x36')](_0x5d516f[_0x5f5b('0x37')]);_0x264b4d['filters']=_['intersection'](_0x264b4d[_0x5f5b('0x35')],_0x264b4d[_0x5f5b('0x37')]);_0x33f999[_0x5f5b('0x3c')]=_[_0x5f5b('0x3b')](_0x264b4d[_0x5f5b('0x35')],qs[_0x5f5b('0x3d')](_0x5d516f[_0x5f5b('0x37')]['fields']));_0x33f999[_0x5f5b('0x3c')]=_0x33f999['attributes']['length']?_0x33f999['attributes']:_0x264b4d[_0x5f5b('0x35')];_0x33f999[_0x5f5b('0x5e')]=qs[_0x5f5b('0x40')](_0x5d516f[_0x5f5b('0x37')][_0x5f5b('0x40')]);_0x33f999[_0x5f5b('0x44')]=qs['filters'](_[_0x5f5b('0x57')](_0x5d516f[_0x5f5b('0x37')],_0x264b4d[_0x5f5b('0x3a')]));if(_0x5d516f[_0x5f5b('0x37')][_0x5f5b('0x46')]){_0x33f999[_0x5f5b('0x44')]=_[_0x5f5b('0x43')](_0x33f999[_0x5f5b('0x44')],{'$or':_[_0x5f5b('0x45')](_0x33f999[_0x5f5b('0x3c')],function(_0x344110){var _0x27d059={};_0x27d059[_0x344110]={'$like':'%'+_0x5d516f[_0x5f5b('0x37')][_0x5f5b('0x46')]+'%'};return _0x27d059;})});}_0x33f999=_[_0x5f5b('0x43')]({},_0x33f999,_0x5d516f[_0x5f5b('0x4f')]);return _0x11cdfa['getApplications'](_0x33f999);}})[_0x5f5b('0x18')](function(_0x13e934){if(_0x13e934){_0x30c8c8=_0x13e934[_0x5f5b('0x4d')];if(!_0x5d516f['query'][_0x5f5b('0x3e')](_0x5f5b('0x3f'))){_0x33f999[_0x5f5b('0x29')]=qs[_0x5f5b('0x29')](_0x5d516f[_0x5f5b('0x37')][_0x5f5b('0x29')]);_0x33f999[_0x5f5b('0x28')]=qs['offset'](_0x5d516f[_0x5f5b('0x37')][_0x5f5b('0x28')]);}return _0x11cdfa['getApplications'](_0x33f999);}})[_0x5f5b('0x18')](function(_0x53f918){if(_0x53f918){return _0x53f918?{'count':_0x30c8c8,'rows':_0x53f918}:null;}})[_0x5f5b('0x18')](respondWithResult(_0x528849,null))[_0x5f5b('0x23')](handleError(_0x528849,null));};function Extension(_0x3fdc45,_0x1cd1c7,_0x491fc3,_0x685971){this['context']='from-voip-provider';this[_0x5f5b('0x73')]=_0x3fdc45[_0x5f5b('0x74')];this[_0x5f5b('0x75')]=_0x685971;this[_0x5f5b('0x76')]=_0x5f5b('0x77');this[_0x5f5b('0x78')]=_0x5f5b('0x79');this[_0x5f5b('0x55')]=_0x3fdc45['id'];this[_0x5f5b('0x71')]=_0x1cd1c7;this[_0x5f5b('0x7a')]=_0x491fc3;}function createExtensionsReciveFax(_0x2d2654){var _0x1a6ffb=0x1;var _0x38e01b=[];_0x38e01b['push'](new Extension(_0x2d2654,_0x1a6ffb,'',_0x5f5b('0x7b')));_0x1a6ffb+=0x1;_0x38e01b[_0x5f5b('0x7c')](new Extension(_0x2d2654,_0x1a6ffb,_0x5f5b('0x7d'),_0x5f5b('0x7e')));_0x1a6ffb+=0x1;for(var _0x541a2d in _0x2d2654){if(_0x2d2654[_0x5f5b('0x3e')](_0x541a2d)&&(_0x541a2d===_0x5f5b('0x7f')||_0x541a2d===_0x5f5b('0x74')||_0x541a2d===_0x5f5b('0x80')||_0x541a2d===_0x5f5b('0x81')||_0x541a2d==='headerinfo'||_0x541a2d==='maxrate'||_0x541a2d===_0x5f5b('0x82')||_0x541a2d===_0x5f5b('0x83')||_0x541a2d===_0x5f5b('0x84'))){_0x38e01b[_0x5f5b('0x7c')](new Extension(_0x2d2654,_0x1a6ffb,_0x5f5b('0x85')+_0x541a2d+')='+_0x2d2654[_0x541a2d],_0x5f5b('0x7e')));_0x1a6ffb+=0x1;}}_0x38e01b[_0x5f5b('0x7c')](new Extension(_0x2d2654,_0x1a6ffb,'6','Wait'));_0x1a6ffb+=0x1;_0x38e01b['push'](new Extension(_0x2d2654,_0x1a6ffb,_0x5f5b('0x86'),_0x5f5b('0x87')));_0x1a6ffb=0x0;return _0x38e01b;}exports[_0x5f5b('0x88')]=function(_0xa3b0e0,_0x48d1cd,_0x129166){var _0x3d8a14;return db['sequelize'][_0x5f5b('0x6d')](function(_0x4e2c65){return db[_0x5f5b('0x34')]['create'](_0xa3b0e0[_0x5f5b('0x52')],{'transaction':_0x4e2c65})[_0x5f5b('0x18')](function(_0x55426b){_0x3d8a14=_0x55426b[_0x5f5b('0x89')]({'plain':!![]});return db[_0x5f5b('0x8a')][_0x5f5b('0x6f')](createExtensionsReciveFax(_0x3d8a14),{'transaction':_0x4e2c65});});})[_0x5f5b('0x18')](function(){return _0x3d8a14;})[_0x5f5b('0x18')](respondWithResult(_0x48d1cd,null))[_0x5f5b('0x23')](handleError(_0x48d1cd,null));};exports[_0x5f5b('0x8b')]=function(_0x387345,_0x5f1a7c,_0x3ad7e5){var _0xeb9616;return db['sequelize']['transaction'](function(_0x17ce21){return db[_0x5f5b('0x34')][_0x5f5b('0x2e')](_0x387345[_0x5f5b('0x52')],{'where':{'id':_0x387345[_0x5f5b('0x52')]['id']},'transaction':_0x17ce21})[_0x5f5b('0x18')](function(_0x3c5671){return db['VoiceExtension'][_0x5f5b('0x2f')]({'where':{'FaxAccountId':_0x387345[_0x5f5b('0x52')]['id']},'transaction':_0x17ce21})[_0x5f5b('0x18')](function(_0x27a8f6){return db['VoiceExtension'][_0x5f5b('0x6f')](createExtensionsReciveFax(_[_0x5f5b('0x62')](_0x387345['body'],['tech',_0x5f5b('0x8c'),_0x5f5b('0x8d'),'updatedAt',_0x5f5b('0x8e'),_0x5f5b('0x8f')])),{'transaction':_0x17ce21});});});})[_0x5f5b('0x18')](function(){return db[_0x5f5b('0x34')][_0x5f5b('0x90')](_0x387345[_0x5f5b('0x52')]['id']);})[_0x5f5b('0x18')](respondWithResult(_0x5f1a7c,null))[_0x5f5b('0x23')](handleError(_0x5f1a7c,null));};exports['getMessages']=function(_0x38497d,_0x41c3a0,_0x377107){var _0x3ad29f={'raw':!![],'where':{}};var _0x192381={};var _0x365a44={'count':0x0,'rows':[]};return db[_0x5f5b('0x34')]['findOne']({'where':{'id':_0x38497d[_0x5f5b('0x4b')]['id']}})[_0x5f5b('0x18')](handleEntityNotFound(_0x41c3a0,null))[_0x5f5b('0x18')](function(_0xad9c4d){if(_0xad9c4d){_0x192381['model']=_[_0x5f5b('0x36')](db['FaxMessage'][_0x5f5b('0x4c')]);_0x192381[_0x5f5b('0x37')]=_[_0x5f5b('0x36')](_0x38497d[_0x5f5b('0x37')]);_0x192381['filters']=_[_0x5f5b('0x3b')](_0x192381[_0x5f5b('0x35')],_0x192381[_0x5f5b('0x37')]);_0x3ad29f[_0x5f5b('0x3c')]=_[_0x5f5b('0x3b')](_0x192381[_0x5f5b('0x35')],qs[_0x5f5b('0x3d')](_0x38497d['query'][_0x5f5b('0x3d')]));_0x3ad29f[_0x5f5b('0x3c')]=_0x3ad29f[_0x5f5b('0x3c')]['length']?_0x3ad29f[_0x5f5b('0x3c')]:_0x192381[_0x5f5b('0x35')];if(!_0x38497d[_0x5f5b('0x37')][_0x5f5b('0x3e')](_0x5f5b('0x3f'))){_0x3ad29f[_0x5f5b('0x29')]=qs['limit'](_0x38497d[_0x5f5b('0x37')]['limit']);_0x3ad29f[_0x5f5b('0x28')]=qs['offset'](_0x38497d[_0x5f5b('0x37')][_0x5f5b('0x28')]);}_0x3ad29f[_0x5f5b('0x5e')]=qs['sort'](_0x38497d[_0x5f5b('0x37')][_0x5f5b('0x40')]);_0x3ad29f[_0x5f5b('0x44')]=qs[_0x5f5b('0x3a')](_['pick'](_0x38497d[_0x5f5b('0x37')],_0x192381[_0x5f5b('0x3a')]));_0x3ad29f[_0x5f5b('0x44')][_0x5f5b('0x55')]=_0xad9c4d['id'];if(_0x38497d['query'][_0x5f5b('0x46')]){_0x3ad29f['where']=_[_0x5f5b('0x43')](_0x3ad29f['where'],{'$or':_['map'](_0x3ad29f[_0x5f5b('0x3c')],function(_0x20f8aa){var _0x512be8={};_0x512be8[_0x20f8aa]={'$like':'%'+_0x38497d[_0x5f5b('0x37')][_0x5f5b('0x46')]+'%'};return _0x512be8;})});}if(_0x38497d['query'][_0x5f5b('0x91')]){var _0x2a5704=_0x38497d['query'][_0x5f5b('0x91')][_0x5f5b('0x92')](',');var _0x382e8e={};_0x382e8e[_0x2a5704[0x0]]={'$gte':moment(_0x2a5704[0x1])[_0x5f5b('0x93')](_0x5f5b('0x94'))};_0x3ad29f['where']=_[_0x5f5b('0x43')](_0x3ad29f['where'],_0x382e8e);}_0x3ad29f=_['merge']({},_0x3ad29f,_0x38497d[_0x5f5b('0x4f')]);return db['FaxMessage'][_0x5f5b('0x27')]({'where':_0x3ad29f[_0x5f5b('0x44')]})[_0x5f5b('0x18')](function(_0x717645){_0x365a44['count']=_0x717645;if(_0x38497d['query'][_0x5f5b('0x47')]){_0x3ad29f[_0x5f5b('0x4e')]=[{'all':!![]}];}return db[_0x5f5b('0x95')][_0x5f5b('0x48')](_0x3ad29f);})['then'](function(_0x57a912){_0x365a44[_0x5f5b('0x49')]=_0x57a912;return _0x365a44;});}})['then'](respondWithFilteredResult(_0x41c3a0,_0x3ad29f))['catch'](handleError(_0x41c3a0,null));};exports[_0x5f5b('0x32')]=function(_0x567d29,_0x312a0f,_0x5e7f45){var _0x4afeca,_0x53050b={},_0x54b44b;if(_0x567d29[_0x5f5b('0x52')]['to']){_0x54b44b=_0x567d29[_0x5f5b('0x52')]['to'][0x0];}return db[_0x5f5b('0x34')][_0x5f5b('0x50')]({'where':{'id':_0x567d29['params']['id']},'include':[{'model':db['CmList'],'as':_0x5f5b('0x96'),'include':[{'model':db[_0x5f5b('0x64')],'as':_0x5f5b('0x97'),'where':{'fax':_0x54b44b},'limit':0x1,'order':[[_0x5f5b('0x98'),_0x5f5b('0x99')]]}]}]})[_0x5f5b('0x18')](handleEntityNotFound(_0x312a0f,null))[_0x5f5b('0x18')](function(_0x1718e1){_0x4afeca=_0x1718e1;if(_0x567d29[_0x5f5b('0x52')][_0x5f5b('0x9a')]&&_0x567d29[_0x5f5b('0x52')][_0x5f5b('0x9a')][_0x5f5b('0x4d')]){for(var _0x565c08=0x0;_0x565c08<_0x567d29[_0x5f5b('0x52')][_0x5f5b('0x9a')][_0x5f5b('0x4d')];_0x565c08+=0x1){_0x567d29[_0x5f5b('0x52')][_0x5f5b('0x9a')][_0x565c08]={'filename':_0x567d29['body'][_0x5f5b('0x9a')][_0x565c08][_0x5f5b('0x31')],'id':_0x567d29[_0x5f5b('0x52')]['attachments'][_0x565c08]['id'],'path':path[_0x5f5b('0x9b')](config['root'],_0x5f5b('0x9c'),_0x567d29[_0x5f5b('0x52')][_0x5f5b('0x9a')][_0x565c08][_0x5f5b('0x9d')])};}}return respondWithRpcPromise('CheckAfterSend',_0x5f5b('0x9e'),{'FaxAccountId':_[_0x5f5b('0x9f')](_0x567d29[_0x5f5b('0x4b')]['id'])?undefined:_0x567d29['params']['id'],'path':_[_0x5f5b('0x9f')](_0x567d29[_0x5f5b('0x52')][_0x5f5b('0x9a')][0x0][_0x5f5b('0xa0')])?undefined:_0x567d29['body'][_0x5f5b('0x9a')][0x0][_0x5f5b('0xa0')],'fax':_[_0x5f5b('0x9f')](_0x567d29['body']['to'][0x0])?undefined:_0x567d29[_0x5f5b('0x52')]['to'][0x0]},client9002);})[_0x5f5b('0x18')](function(){if(_0x4afeca){if(_['isNil'](_0x567d29['body'][_0x5f5b('0xa1')])){_0x567d29['body'][_0x5f5b('0xa1')]=util['format'](_0x5f5b('0xa2'),_0x4afeca['name'],_0x4afeca[_0x5f5b('0xa3')]);}if(_0x4afeca[_0x5f5b('0x96')]){if(_0x4afeca['List'][_0x5f5b('0x97')][_0x5f5b('0x4d')]){return _0x4afeca[_0x5f5b('0x96')][_0x5f5b('0x97')][0x0];}else{return db[_0x5f5b('0x64')]['create'](_[_0x5f5b('0xa4')](_0x567d29[_0x5f5b('0x52')],{'firstName':_0x567d29[_0x5f5b('0x52')]['to'][0x0],'phone':_0x567d29['body']['to'][0x0],'fax':_0x567d29[_0x5f5b('0x52')]['to'][0x0],'ListId':_0x4afeca[_0x5f5b('0x8f')]}));}}else{throw new Error(_0x5f5b('0xa5'));}}else{throw new Error(_0x5f5b('0xa6'));}})['then'](function(_0x29f0e0){if(_0x29f0e0){return db[_0x5f5b('0x61')][_0x5f5b('0x50')]({'where':{'ContactId':_0x29f0e0['id'],'closed':![],'FaxAccountId':_0x4afeca['id']}})[_0x5f5b('0x18')](function(_0x43a36c){if(_0x43a36c){return[_0x43a36c,![]];}return db[_0x5f5b('0x61')]['create']({'UserId':_0x567d29[_0x5f5b('0xa7')]['id'],'ContactId':_0x29f0e0['id'],'FaxAccountId':_0x4afeca['id'],'fax':_0x567d29[_0x5f5b('0x52')]['to'][0x0],'firstMsgDirection':_0x5f5b('0xa8'),'Messages':[_[_0x5f5b('0x43')](_0x567d29['body'],{'read':![],'body':_0x567d29[_0x5f5b('0x52')][_0x5f5b('0x9a')][0x0][_0x5f5b('0xa9')],'FaxAccountId':_0x4afeca['id'],'UserId':_0x567d29[_0x5f5b('0xa7')]['id'],'ContactId':_0x29f0e0['id'],'AttachmentId':_0x567d29['body'][_0x5f5b('0x9a')][0x0]['id']})]},{'include':[{'model':db[_0x5f5b('0x95')],'as':_0x5f5b('0xaa')}]})[_0x5f5b('0x18')](function(_0x3feb66){return[_0x3feb66,!![]];});});}else{throw new Error(_0x5f5b('0xab'));}})['spread'](function(_0x16d1b4,_0x71677e){if(_0x71677e){return _0x16d1b4;}return db[_0x5f5b('0x95')][_0x5f5b('0x51')]({'direction':_0x5f5b('0xa8'),'read':![],'body':_0x567d29[_0x5f5b('0x52')][_0x5f5b('0x9a')][0x0][_0x5f5b('0xa9')],'FaxAccountId':_0x4afeca['id'],'FaxInteractionId':_0x16d1b4['id'],'UserId':_0x567d29[_0x5f5b('0xa7')]['id'],'ContactId':_0x16d1b4[_0x5f5b('0xac')],'AttachmentId':_0x567d29[_0x5f5b('0x52')][_0x5f5b('0x9a')][0x0]['id']})[_0x5f5b('0x18')](function(_0xc8676){_0x16d1b4['dataValues'][_0x5f5b('0xaa')]=[];_0x16d1b4[_0x5f5b('0xad')]['Messages'][_0x5f5b('0x7c')](_0xc8676['dataValues']);return _0x16d1b4;});})[_0x5f5b('0x18')](function(_0x10d800){respondWithRpcPromise(_0x5f5b('0xae'),_0x5f5b('0xae'),{'FaxAccountId':_['isNil'](_0x567d29['params']['id'])?undefined:_0x567d29[_0x5f5b('0x4b')]['id'],'path':_[_0x5f5b('0x9f')](_0x567d29['body'][_0x5f5b('0x9a')][0x0]['path'])?undefined:_0x567d29[_0x5f5b('0x52')][_0x5f5b('0x9a')][0x0]['path'],'fax':_[_0x5f5b('0x9f')](_0x567d29[_0x5f5b('0x52')]['to'][0x0])?undefined:_0x567d29[_0x5f5b('0x52')]['to'][0x0],'AttachmentId':_0x567d29[_0x5f5b('0x52')][_0x5f5b('0x9a')][0x0]['id']},client9002)[_0x5f5b('0x18')](function(_0x4cad0c){logger[_0x5f5b('0x21')](_0x5f5b('0xaf'),_0x4cad0c);})[_0x5f5b('0x23')](function(_0x31c4c0){logger[_0x5f5b('0x21')]('SendFaxRpc,\x20%s',_0x31c4c0);});return _0x10d800;})[_0x5f5b('0x18')](respondWithResult(_0x312a0f,null))[_0x5f5b('0x23')](handleError(_0x312a0f,null));};exports['addAgents']=function(_0xa541d2,_0x2b1007,_0x216d24){return db[_0x5f5b('0x34')][_0x5f5b('0x50')]({'where':{'id':_0xa541d2[_0x5f5b('0x4b')]['id']}})[_0x5f5b('0x18')](handleEntityNotFound(_0x2b1007,null))[_0x5f5b('0x18')](function(_0x59d08c){if(_0x59d08c){return _0x59d08c['addAgents'](_0xa541d2[_0x5f5b('0x52')][_0x5f5b('0x59')],_['omit'](_0xa541d2[_0x5f5b('0x52')],[_0x5f5b('0x59'),'id'])||{})[_0x5f5b('0xb0')](function(_0x3d8df3){for(var _0x27bc34=0x0;_0x27bc34<_0xa541d2[_0x5f5b('0x52')][_0x5f5b('0x59')][_0x5f5b('0x4d')];_0x27bc34+=0x1){socket[_0x5f5b('0xb1')]('userFaxAccount:save',{'UserId':_0xa541d2[_0x5f5b('0x52')]['ids'][_0x27bc34],'FaxAccountId':_0xa541d2[_0x5f5b('0x4b')]['id']});}return _0x3d8df3;});}})[_0x5f5b('0x18')](respondWithResult(_0x2b1007,null))[_0x5f5b('0x23')](handleError(_0x2b1007,null));};exports['removeAgents']=function(_0x4e3bec,_0x34421d,_0x5e537f){var _0x1266c0;return db['FaxAccount'][_0x5f5b('0x50')]({'where':{'id':_0x4e3bec[_0x5f5b('0x4b')]['id']}})[_0x5f5b('0x18')](handleEntityNotFound(_0x34421d,null))[_0x5f5b('0x18')](function(_0x2f272b){if(_0x2f272b){return _0x2f272b[_0x5f5b('0xb2')](_0x4e3bec[_0x5f5b('0x37')][_0x5f5b('0x59')])['then'](function(_0x86c0b5){if(_['isArray'](_0x4e3bec[_0x5f5b('0x37')][_0x5f5b('0x59')])){for(var _0xbafbc8=0x0;_0xbafbc8<_0x4e3bec[_0x5f5b('0x37')][_0x5f5b('0x59')][_0x5f5b('0x4d')];_0xbafbc8+=0x1){socket['emit'](_0x5f5b('0xb3'),{'UserId':_0x4e3bec['query'][_0x5f5b('0x59')][_0xbafbc8],'FaxAccountId':_0x4e3bec[_0x5f5b('0x4b')]['id']});}}else{socket[_0x5f5b('0xb1')](_0x5f5b('0xb3'),{'UserId':_0x4e3bec[_0x5f5b('0x37')][_0x5f5b('0x59')],'FaxAccountId':_0x4e3bec[_0x5f5b('0x4b')]['id']});}});}})[_0x5f5b('0x18')](respondWithStatusCode(_0x34421d,null))[_0x5f5b('0x23')](handleError(_0x34421d,null));};exports[_0x5f5b('0xb4')]=function(_0x1fdf4e,_0x40f067,_0x46236b){var _0x13074f={};var _0x98ce22={};var _0x4b43da;var _0x79505c;return db['FaxAccount'][_0x5f5b('0x5d')]({'where':{'id':_0x1fdf4e[_0x5f5b('0x4b')]['id']}})[_0x5f5b('0x18')](handleEntityNotFound(_0x40f067,null))['then'](function(_0x50eecb){if(_0x50eecb){_0x4b43da=_0x50eecb;_0x98ce22[_0x5f5b('0x35')]=_[_0x5f5b('0x36')](db[_0x5f5b('0x66')][_0x5f5b('0x4c')]);_0x98ce22[_0x5f5b('0x37')]=_[_0x5f5b('0x36')](_0x1fdf4e[_0x5f5b('0x37')]);_0x98ce22['filters']=_[_0x5f5b('0x3b')](_0x98ce22[_0x5f5b('0x35')],_0x98ce22[_0x5f5b('0x37')]);_0x13074f[_0x5f5b('0x3c')]=_['intersection'](_0x98ce22[_0x5f5b('0x35')],qs[_0x5f5b('0x3d')](_0x1fdf4e['query']['fields']));_0x13074f[_0x5f5b('0x3c')]=_0x13074f[_0x5f5b('0x3c')][_0x5f5b('0x4d')]?_0x13074f[_0x5f5b('0x3c')]:_0x98ce22[_0x5f5b('0x35')];_0x13074f['order']=qs[_0x5f5b('0x40')](_0x1fdf4e[_0x5f5b('0x37')][_0x5f5b('0x40')]);_0x13074f[_0x5f5b('0x44')]=qs[_0x5f5b('0x3a')](_['pick'](_0x1fdf4e[_0x5f5b('0x37')],_0x98ce22[_0x5f5b('0x3a')]));if(_0x1fdf4e['query'][_0x5f5b('0x46')]){_0x13074f['where']=_['merge'](_0x13074f[_0x5f5b('0x44')],{'$or':_[_0x5f5b('0x45')](_0x13074f[_0x5f5b('0x3c')],function(_0x1dc518){var _0x1ebf73={};_0x1ebf73[_0x1dc518]={'$like':'%'+_0x1fdf4e[_0x5f5b('0x37')][_0x5f5b('0x46')]+'%'};return _0x1ebf73;})});}_0x13074f=_['merge']({},_0x13074f,_0x1fdf4e['options']);return _0x4b43da[_0x5f5b('0xb4')](_0x13074f);}})[_0x5f5b('0x18')](function(_0x118abd){if(_0x118abd){_0x79505c=_0x118abd[_0x5f5b('0x4d')];if(!_0x1fdf4e[_0x5f5b('0x37')][_0x5f5b('0x3e')](_0x5f5b('0x3f'))){_0x13074f[_0x5f5b('0x29')]=qs[_0x5f5b('0x29')](_0x1fdf4e['query'][_0x5f5b('0x29')]);_0x13074f[_0x5f5b('0x28')]=qs[_0x5f5b('0x28')](_0x1fdf4e[_0x5f5b('0x37')][_0x5f5b('0x28')]);}return _0x4b43da[_0x5f5b('0xb4')](_0x13074f);}})[_0x5f5b('0x18')](function(_0x12ac12){if(_0x12ac12){return _0x12ac12?{'count':_0x79505c,'rows':_0x12ac12}:null;}})['then'](respondWithResult(_0x40f067,null))[_0x5f5b('0x23')](handleError(_0x40f067,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 380c11a..b2243be 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 _0x8511=['hasOwnProperty','events','../../mysqldb','FaxAccount','save','update','emit'];(function(_0x585fe0,_0x2a42c6){var _0x219da5=function(_0x52da95){while(--_0x52da95){_0x585fe0['push'](_0x585fe0['shift']());}};_0x219da5(++_0x2a42c6);}(_0x8511,0x135));var _0x1851=function(_0xfea597,_0x5bc88d){_0xfea597=_0xfea597-0x0;var _0x5e3649=_0x8511[_0xfea597];return _0x5e3649;};'use strict';var EventEmitter=require(_0x1851('0x0'));var FaxAccount=require(_0x1851('0x1'))['db'][_0x1851('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1851('0x3'),'afterUpdate':_0x1851('0x4'),'afterDestroy':'remove'};function emitEvent(_0x560bef){return function(_0x3548c8,_0x2e15ca,_0x5b9d1d){FaxAccountEvents['emit'](_0x560bef+':'+_0x3548c8['id'],_0x3548c8);FaxAccountEvents[_0x1851('0x5')](_0x560bef,_0x3548c8);_0x5b9d1d(null);};}for(var e in events){if(events[_0x1851('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xed18=['hook','exports','events','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x57fecd,_0x237179){var _0x5cb1ed=function(_0x121837){while(--_0x121837){_0x57fecd['push'](_0x57fecd['shift']());}};_0x5cb1ed(++_0x237179);}(_0xed18,0x1ba));var _0x8ed1=function(_0x2253ea,_0x6320e){_0x2253ea=_0x2253ea-0x0;var _0x2d046c=_0xed18[_0x2253ea];return _0x2d046c;};'use strict';var EventEmitter=require(_0x8ed1('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x8ed1('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x8ed1('0x2')](0x0);var events={'afterCreate':_0x8ed1('0x3'),'afterUpdate':_0x8ed1('0x4'),'afterDestroy':_0x8ed1('0x5')};function emitEvent(_0x517f4f){return function(_0x139cfc,_0x1d6c48,_0x91330e){FaxAccountEvents[_0x8ed1('0x6')](_0x517f4f+':'+_0x139cfc['id'],_0x139cfc);FaxAccountEvents['emit'](_0x517f4f,_0x139cfc);_0x91330e(null);};}for(var e in events){if(events[_0x8ed1('0x7')](e)){var event=events[e];FaxAccount[_0x8ed1('0x8')](e,emitEvent(event));}}module[_0x8ed1('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 185d397..f2ab3cc 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 _0xd2f9=['lodash','util','api','moment','request-promise','./faxAccount.attributes','exports','FaxAccount','fax_accounts'];(function(_0xb9ccf7,_0x58b5e2){var _0x1a5e02=function(_0x419c96){while(--_0x419c96){_0xb9ccf7['push'](_0xb9ccf7['shift']());}};_0x1a5e02(++_0x58b5e2);}(_0xd2f9,0x1ef));var _0x9d2f=function(_0x1a89ca,_0x27394b){_0x1a89ca=_0x1a89ca-0x0;var _0x29cbb2=_0xd2f9[_0x1a89ca];return _0x29cbb2;};'use strict';var _=require(_0x9d2f('0x0'));var util=require(_0x9d2f('0x1'));var logger=require('../../config/logger')(_0x9d2f('0x2'));var moment=require(_0x9d2f('0x3'));var BPromise=require('bluebird');var rp=require(_0x9d2f('0x4'));var attributes=require(_0x9d2f('0x5'));module[_0x9d2f('0x6')]=function(_0x2045a1,_0x2836c5){return _0x2045a1['define'](_0x9d2f('0x7'),attributes,{'tableName':_0x9d2f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x147f=['define','FaxAccount','fax_accounts','lodash','util','../../config/logger','moment','bluebird','./faxAccount.attributes','exports'];(function(_0xc40b9f,_0x17ec1f){var _0x535b9c=function(_0x591b19){while(--_0x591b19){_0xc40b9f['push'](_0xc40b9f['shift']());}};_0x535b9c(++_0x17ec1f);}(_0x147f,0xd5));var _0xf147=function(_0x3f8f8e,_0x607078){_0x3f8f8e=_0x3f8f8e-0x0;var _0x552df9=_0x147f[_0x3f8f8e];return _0x552df9;};'use strict';var _=require(_0xf147('0x0'));var util=require(_0xf147('0x1'));var logger=require(_0xf147('0x2'))('api');var moment=require(_0xf147('0x3'));var BPromise=require(_0xf147('0x4'));var rp=require('request-promise');var attributes=require(_0xf147('0x5'));module[_0xf147('0x6')]=function(_0x34787e,_0x24480b){return _0x34787e[_0xf147('0x7')](_0xf147('0x8'),attributes,{'tableName':_0xf147('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index a2713b6..5a3f1f0 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 _0x4571=['http','localhost','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFaxAccount','findAll','raw','options','where','limit','include','model','map','attributes','NotifyFaxAccount','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','body','isNil','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','FaxAccount','find','account','CmList','DESC','Applications','List','applications','orderBy','priority','asc','Contacts','length','defaults','create','contact','FaxInteraction','spread','get','close','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','User','name','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dbaba,_0x15f997){var _0x4894ac=function(_0x6f3267){while(--_0x6f3267){_0x3dbaba['push'](_0x3dbaba['shift']());}};_0x4894ac(++_0x15f997);}(_0x4571,0x1af));var _0x1457=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0x4571[_0x35f7f5];return _0x5567a4;};'use strict';var _=require(_0x1457('0x0'));var util=require(_0x1457('0x1'));var moment=require(_0x1457('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0x1457('0x3'))['db'];var utils=require(_0x1457('0x4'));var logger=require('../../config/logger')(_0x1457('0x5'));var config=require(_0x1457('0x6'));var jayson=require(_0x1457('0x7'));var client=jayson[_0x1457('0x8')][_0x1457('0x9')]({'port':0x232c});var socket=require('socket.io-emitter')({'host':_0x1457('0xa'),'port':0x18eb});require(_0x1457('0xb'))[_0x1457('0xc')](socket);function respondWithRpcPromise(_0x332d11,_0x135bc2,_0x56db4a){return new BPromise(function(_0x20ce3f,_0x191556){return client[_0x1457('0xd')](_0x332d11,_0x56db4a)[_0x1457('0xe')](function(_0x272b03){logger[_0x1457('0xf')](_0x1457('0x10'),_0x135bc2,_0x1457('0x11'));logger[_0x1457('0x12')](_0x1457('0x13'),_0x135bc2,_0x1457('0x11'),JSON[_0x1457('0x14')](_0x272b03));if(_0x272b03['error']){if(_0x272b03[_0x1457('0x15')]['code']===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x135bc2,_0x272b03['error'][_0x1457('0x16')]);return _0x191556(_0x272b03[_0x1457('0x15')][_0x1457('0x16')]);}logger[_0x1457('0x15')](_0x1457('0x10'),_0x135bc2,_0x272b03[_0x1457('0x15')][_0x1457('0x16')]);return _0x20ce3f(_0x272b03[_0x1457('0x15')][_0x1457('0x16')]);}else{logger[_0x1457('0xf')](_0x1457('0x10'),_0x135bc2,_0x1457('0x11'));_0x20ce3f(_0x272b03[_0x1457('0x17')][_0x1457('0x16')]);}})[_0x1457('0x18')](function(_0x243621){logger[_0x1457('0x15')](_0x1457('0x10'),_0x135bc2,_0x243621);_0x191556(_0x243621);});});}exports[_0x1457('0x19')]=function(_0x2e766d){var _0x72af5d=this;return new Promise(function(_0x1b8f8e,_0x4823b8){return db['FaxAccount'][_0x1457('0x1a')]({'raw':_0x2e766d['options']?_0x2e766d['options'][_0x1457('0x1b')]===undefined?!![]:![]:!![],'where':_0x2e766d[_0x1457('0x1c')]?_0x2e766d[_0x1457('0x1c')][_0x1457('0x1d')]||null:null,'attributes':_0x2e766d['options']?_0x2e766d['options']['attributes']||null:null,'limit':_0x2e766d[_0x1457('0x1c')]?_0x2e766d[_0x1457('0x1c')][_0x1457('0x1e')]||null:null,'include':_0x2e766d['options']?_0x2e766d[_0x1457('0x1c')]['include']?_['map'](_0x2e766d[_0x1457('0x1c')][_0x1457('0x1f')],function(_0x171f4d){return{'model':db[_0x171f4d[_0x1457('0x20')]],'as':_0x171f4d['as'],'attributes':_0x171f4d['attributes'],'include':_0x171f4d[_0x1457('0x1f')]?_[_0x1457('0x21')](_0x171f4d[_0x1457('0x1f')],function(_0x38ecfe){return{'model':db[_0x38ecfe[_0x1457('0x20')]],'as':_0x38ecfe['as'],'attributes':_0x38ecfe['attributes'],'include':_0x38ecfe['include']?_[_0x1457('0x21')](_0x38ecfe[_0x1457('0x1f')],function(_0x24112f){return{'model':db[_0x24112f[_0x1457('0x20')]],'as':_0x24112f['as'],'attributes':_0x24112f[_0x1457('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1457('0xe')](function(_0x150433){logger['info']('GetFaxAccount',_0x2e766d);logger[_0x1457('0x12')]('GetFaxAccount',_0x2e766d,JSON[_0x1457('0x14')](_0x150433));_0x1b8f8e(_0x150433);})[_0x1457('0x18')](function(_0x4031d5){logger[_0x1457('0x15')](_0x1457('0x19'),_0x4031d5['message'],_0x2e766d);_0x4823b8(_0x72af5d[_0x1457('0x15')](0x1f4,_0x4031d5[_0x1457('0x16')]));});});};exports[_0x1457('0x23')]=function(_0x3f240d,_0x54e6c5,_0x4225ba){var _0x451e52=this;return new Promise(function(_0x36e810,_0x5a95a9){var _0xbcfe61={'body':_0x3f240d['body'],'channel':_0x1457('0x24')};var _0x543d70=[];var _0x4697e7=[];var _0x49e424={};return db[_0x1457('0x25')][_0x1457('0x26')]()[_0x1457('0xe')](function(_0x497472){if(!_0x497472){throw new db[(_0x1457('0x27'))]['ValidationError'](_0x1457('0x28'));}_0x543d70=_[_0x1457('0x29')](_[_0x1457('0x2a')](_0x497472),[_0x1457('0x2b'),_0x1457('0x2c')]);_0x4697e7=_[_0x1457('0x29')](_['keys'](_0x497472),[_0x1457('0x2b'),_0x1457('0x2c'),'CompanyId',_0x1457('0x2d')]);if(_0x3f240d[_0x1457('0x2e')]['id']){delete _0x3f240d[_0x1457('0x2e')]['id'];}if(_[_0x1457('0x2f')](_0x3f240d[_0x1457('0x2e')]['from'])){throw new db[(_0x1457('0x27'))][(_0x1457('0x30'))](_0x1457('0x31'));}if(_[_0x1457('0x2f')](_0x3f240d[_0x1457('0x2e')][_0x1457('0x2e')])||_0x3f240d['body'][_0x1457('0x2e')]===''){throw new db[(_0x1457('0x27'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1457('0x2f')](_0x3f240d[_0x1457('0x2e')][_0x1457('0x32')])){throw new db['Sequelize'][(_0x1457('0x30'))](_0x1457('0x33')+_0x4697e7);}if(!_[_0x1457('0x34')](_0x4697e7,_0x3f240d[_0x1457('0x2e')][_0x1457('0x32')])){throw new db[(_0x1457('0x27'))]['ValidationError'](_0x1457('0x35')+_0x4697e7);}_0x49e424[_0x3f240d[_0x1457('0x2e')]['mapKey']]=_0x3f240d['body'][_0x1457('0x36')];})[_0x1457('0xe')](function(){return db[_0x1457('0x37')][_0x1457('0x38')]({'where':{'id':_0x3f240d[_0x1457('0x39')]['id']},'include':[{'model':db[_0x1457('0x3a')],'as':'List','include':[{'model':db[_0x1457('0x25')],'as':'Contacts','where':_0x49e424,'limit':0x1,'order':[[_0x1457('0x2c'),_0x1457('0x3b')]]}]},{'model':db['FaxApplication'],'as':_0x1457('0x3c')}]});})[_0x1457('0xe')](function(_0x1be340){if(_0x1be340&&_0x1be340['List']){var _0xa4458a=_0x1be340['get']({'plain':!![]});_0xbcfe61['account']=_0xa4458a;_0xbcfe61['applications']=_0xa4458a[_0x1457('0x3c')];_0xbcfe61['list']=_0xa4458a[_0x1457('0x3d')];_0xbcfe61[_0x1457('0x3e')]=_[_0x1457('0x3f')](_0xbcfe61['applications'],[_0x1457('0x40')],[_0x1457('0x41')]);if(_0xbcfe61['account']['Applications']){delete _0xbcfe61[_0x1457('0x39')]['Applications'];}if(_0xbcfe61[_0x1457('0x39')][_0x1457('0x3d')]&&_0xbcfe61['account'][_0x1457('0x3d')][_0x1457('0x42')][_0x1457('0x43')]){return _0xbcfe61['account'][_0x1457('0x3d')]['Contacts'][0x0];}var _0x540ac2=_[_0x1457('0x44')](_0x3f240d['body'],{'firstName':_0x3f240d[_0x1457('0x2e')]['from'],'ListId':_0xa4458a['ListId']});_0x540ac2[_0x3f240d[_0x1457('0x2e')][_0x1457('0x32')]]=_0x3f240d['body'][_0x1457('0x36')];return db[_0x1457('0x25')][_0x1457('0x45')](_0x540ac2,{'fields':_0x543d70,'raw':!![]});}})[_0x1457('0xe')](function(_0x1e6d0b){_0xbcfe61[_0x1457('0x46')]=_0x1e6d0b;if(_0x1e6d0b){var _0x34c762={'ContactId':_0x1e6d0b['id'],'FaxAccountId':_0x3f240d['account']['id'],'fax':_0x1e6d0b['fax']};return db[_0x1457('0x47')][_0x1457('0x38')]({'where':{'ContactId':_0x1e6d0b['id'],'closed':![],'FaxAccountId':_0x3f240d['account']['id']}})['then'](function(_0x451d32){if(_0x451d32){return[_0x451d32,![]];}return db['FaxInteraction'][_0x1457('0x45')](_0x34c762)[_0x1457('0xe')](function(_0x3ff6b3){return[_0x3ff6b3,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x1457('0x48')](function(_0x157f78,_0x5b8dbe){var _0x35394d=_0x157f78[_0x1457('0x49')]({'plain':!![]});if(_0x5b8dbe){if(_0xbcfe61[_0x1457('0x39')]['autoclose']){_0xbcfe61['applications']['push']({'id':0x0,'priority':_0xbcfe61['applications'][_0x1457('0x43')]+0x1,'app':_0x1457('0x4a'),'appdata':'unmanaged','interval':_0x1457('0x4b')});}_0x35394d[_0x1457('0x4c')]=!![];}else{_0x35394d[_0x1457('0x4c')]=![];}_0xbcfe61[_0x1457('0x4d')]=_0x35394d;return db[_0x1457('0x4e')][_0x1457('0x45')]({'body':_0x3f240d[_0x1457('0x2e')]['body'],'FaxAccountId':_0x3f240d[_0x1457('0x39')]['id'],'FaxInteractionId':_0x157f78['id'],'direction':'in','ContactId':_0x157f78[_0x1457('0x4f')],'AttachmentId':_0x3f240d[_0x1457('0x2e')][_0x1457('0x50')]});})[_0x1457('0xe')](function(_0x2d9fde){_0xbcfe61['message']=_0x2d9fde;if(_0xbcfe61[_0x1457('0x4d')]['UserId']){return db[_0x1457('0x51')]['find']({'attributes':['id',_0x1457('0x52')],'where':{'id':_0xbcfe61[_0x1457('0x4d')][_0x1457('0x53')]}})[_0x1457('0xe')](function(_0x5964a9){if(_0x5964a9){_0xbcfe61[_0x1457('0x3e')][_0x1457('0x54')]({'id':0x0,'priority':0x0,'app':_0x1457('0x55'),'appdata':_0x5964a9['name']+','+(_0xbcfe61[_0x1457('0x39')][_0x1457('0x56')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x1457('0x57'),_0xbcfe61);});}return respondWithRpcPromise('Start',_0x1457('0x57'),_0xbcfe61);})[_0x1457('0xe')](function(_0x4265d0){_0x36e810(_0x4265d0);})['catch'](function(_0x279ef5){_0x5a95a9(_0x451e52[_0x1457('0x15')](0x1f4,_0x279ef5[_0x1457('0x16')]));});});}; \ No newline at end of file +var _0x70cd=['Sequelize','no\x20available\x20attributes','createdAt','difference','CompanyId','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account','List','Contacts','updatedAt','DESC','Applications','applications','list','orderBy','priority','asc','length','ListId','create','contact','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','User','agent','Start','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','where','limit','map','model','attributes','include','GetFaxAccount','NotifyFaxAccount','body','fax','describe'];(function(_0x4907de,_0x5bbdc6){var _0x482054=function(_0x39ecf6){while(--_0x39ecf6){_0x4907de['push'](_0x4907de['shift']());}};_0x482054(++_0x5bbdc6);}(_0x70cd,0x18a));var _0xd70c=function(_0x2d486b,_0x5f213c){_0x2d486b=_0x2d486b-0x0;var _0x4291d1=_0x70cd[_0x2d486b];return _0x4291d1;};'use strict';var _=require(_0xd70c('0x0'));var util=require(_0xd70c('0x1'));var moment=require('moment');var BPromise=require(_0xd70c('0x2'));var rs=require(_0xd70c('0x3'));var fs=require('fs');var db=require(_0xd70c('0x4'))['db'];var utils=require(_0xd70c('0x5'));var logger=require(_0xd70c('0x6'))(_0xd70c('0x7'));var config=require(_0xd70c('0x8'));var jayson=require(_0xd70c('0x9'));var client=jayson[_0xd70c('0xa')][_0xd70c('0xb')]({'port':0x232c});var socket=require(_0xd70c('0xc'))({'host':_0xd70c('0xd'),'port':0x18eb});require(_0xd70c('0xe'))[_0xd70c('0xf')](socket);function respondWithRpcPromise(_0x5ad008,_0x24bb5f,_0x2b9739){return new BPromise(function(_0x4992ca,_0x29b164){return client[_0xd70c('0x10')](_0x5ad008,_0x2b9739)[_0xd70c('0x11')](function(_0x39e552){logger[_0xd70c('0x12')](_0xd70c('0x13'),_0x24bb5f,'request\x20sent');logger[_0xd70c('0x14')](_0xd70c('0x15'),_0x24bb5f,'request\x20sent',JSON[_0xd70c('0x16')](_0x39e552));if(_0x39e552[_0xd70c('0x17')]){if(_0x39e552['error'][_0xd70c('0x18')]===0x1f4){logger[_0xd70c('0x17')](_0xd70c('0x13'),_0x24bb5f,_0x39e552['error']['message']);return _0x29b164(_0x39e552[_0xd70c('0x17')][_0xd70c('0x19')]);}logger[_0xd70c('0x17')]('FaxAccount,\x20%s,\x20%s',_0x24bb5f,_0x39e552[_0xd70c('0x17')]['message']);return _0x4992ca(_0x39e552[_0xd70c('0x17')][_0xd70c('0x19')]);}else{logger['info'](_0xd70c('0x13'),_0x24bb5f,'request\x20sent');_0x4992ca(_0x39e552[_0xd70c('0x1a')]['message']);}})[_0xd70c('0x1b')](function(_0x62430f){logger[_0xd70c('0x17')](_0xd70c('0x13'),_0x24bb5f,_0x62430f);_0x29b164(_0x62430f);});});}exports['GetFaxAccount']=function(_0x4198b0){var _0x399f59=this;return new Promise(function(_0x1578e7,_0x597834){return db['FaxAccount'][_0xd70c('0x1c')]({'raw':_0x4198b0[_0xd70c('0x1d')]?_0x4198b0['options']['raw']===undefined?!![]:![]:!![],'where':_0x4198b0['options']?_0x4198b0[_0xd70c('0x1d')][_0xd70c('0x1e')]||null:null,'attributes':_0x4198b0[_0xd70c('0x1d')]?_0x4198b0['options']['attributes']||null:null,'limit':_0x4198b0['options']?_0x4198b0[_0xd70c('0x1d')][_0xd70c('0x1f')]||null:null,'include':_0x4198b0[_0xd70c('0x1d')]?_0x4198b0[_0xd70c('0x1d')]['include']?_[_0xd70c('0x20')](_0x4198b0[_0xd70c('0x1d')]['include'],function(_0x496689){return{'model':db[_0x496689[_0xd70c('0x21')]],'as':_0x496689['as'],'attributes':_0x496689[_0xd70c('0x22')],'include':_0x496689['include']?_[_0xd70c('0x20')](_0x496689['include'],function(_0x9d7826){return{'model':db[_0x9d7826['model']],'as':_0x9d7826['as'],'attributes':_0x9d7826[_0xd70c('0x22')],'include':_0x9d7826[_0xd70c('0x23')]?_[_0xd70c('0x20')](_0x9d7826[_0xd70c('0x23')],function(_0x1412f9){return{'model':db[_0x1412f9[_0xd70c('0x21')]],'as':_0x1412f9['as'],'attributes':_0x1412f9['attributes']};}):[]};}):[]};}):[]:[]})[_0xd70c('0x11')](function(_0x363f68){logger[_0xd70c('0x12')](_0xd70c('0x24'),_0x4198b0);logger[_0xd70c('0x14')](_0xd70c('0x24'),_0x4198b0,JSON[_0xd70c('0x16')](_0x363f68));_0x1578e7(_0x363f68);})[_0xd70c('0x1b')](function(_0xec1434){logger[_0xd70c('0x17')](_0xd70c('0x24'),_0xec1434[_0xd70c('0x19')],_0x4198b0);_0x597834(_0x399f59['error'](0x1f4,_0xec1434[_0xd70c('0x19')]));});});};exports[_0xd70c('0x25')]=function(_0x4f3edb,_0x27b5c9,_0x13e238){var _0x5b9a8a=this;return new Promise(function(_0x49b1fa,_0x4f60d4){var _0x58e206={'body':_0x4f3edb[_0xd70c('0x26')],'channel':_0xd70c('0x27')};var _0x1e46ee=[];var _0x4ca839=[];var _0x59b859={};return db['CmContact'][_0xd70c('0x28')]()[_0xd70c('0x11')](function(_0x3d2150){if(!_0x3d2150){throw new db[(_0xd70c('0x29'))]['ValidationError'](_0xd70c('0x2a'));}_0x1e46ee=_['difference'](_['keys'](_0x3d2150),[_0xd70c('0x2b'),'updatedAt']);_0x4ca839=_[_0xd70c('0x2c')](_['keys'](_0x3d2150),[_0xd70c('0x2b'),'updatedAt',_0xd70c('0x2d'),'ListId']);if(_0x4f3edb[_0xd70c('0x26')]['id']){delete _0x4f3edb[_0xd70c('0x26')]['id'];}if(_['isNil'](_0x4f3edb[_0xd70c('0x26')][_0xd70c('0x2e')])){throw new db[(_0xd70c('0x29'))][(_0xd70c('0x2f'))](_0xd70c('0x30'));}if(_['isNil'](_0x4f3edb[_0xd70c('0x26')][_0xd70c('0x26')])||_0x4f3edb[_0xd70c('0x26')][_0xd70c('0x26')]===''){throw new db['Sequelize'][(_0xd70c('0x2f'))](_0xd70c('0x31'));}if(_[_0xd70c('0x32')](_0x4f3edb[_0xd70c('0x26')][_0xd70c('0x33')])){throw new db[(_0xd70c('0x29'))]['ValidationError'](_0xd70c('0x34')+_0x4ca839);}if(!_[_0xd70c('0x35')](_0x4ca839,_0x4f3edb[_0xd70c('0x26')][_0xd70c('0x33')])){throw new db[(_0xd70c('0x29'))][(_0xd70c('0x2f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4ca839);}_0x59b859[_0x4f3edb['body'][_0xd70c('0x33')]]=_0x4f3edb[_0xd70c('0x26')][_0xd70c('0x2e')];})[_0xd70c('0x11')](function(){return db['FaxAccount'][_0xd70c('0x36')]({'where':{'id':_0x4f3edb[_0xd70c('0x37')]['id']},'include':[{'model':db['CmList'],'as':_0xd70c('0x38'),'include':[{'model':db['CmContact'],'as':_0xd70c('0x39'),'where':_0x59b859,'limit':0x1,'order':[[_0xd70c('0x3a'),_0xd70c('0x3b')]]}]},{'model':db['FaxApplication'],'as':_0xd70c('0x3c')}]});})['then'](function(_0x436834){if(_0x436834&&_0x436834['List']){var _0x5914b1=_0x436834['get']({'plain':!![]});_0x58e206[_0xd70c('0x37')]=_0x5914b1;_0x58e206[_0xd70c('0x3d')]=_0x5914b1['Applications'];_0x58e206[_0xd70c('0x3e')]=_0x5914b1[_0xd70c('0x38')];_0x58e206[_0xd70c('0x3d')]=_[_0xd70c('0x3f')](_0x58e206[_0xd70c('0x3d')],[_0xd70c('0x40')],[_0xd70c('0x41')]);if(_0x58e206[_0xd70c('0x37')][_0xd70c('0x3c')]){delete _0x58e206[_0xd70c('0x37')][_0xd70c('0x3c')];}if(_0x58e206['account']['List']&&_0x58e206[_0xd70c('0x37')][_0xd70c('0x38')][_0xd70c('0x39')][_0xd70c('0x42')]){return _0x58e206[_0xd70c('0x37')][_0xd70c('0x38')]['Contacts'][0x0];}var _0x31ae97=_['defaults'](_0x4f3edb[_0xd70c('0x26')],{'firstName':_0x4f3edb[_0xd70c('0x26')]['from'],'ListId':_0x5914b1[_0xd70c('0x43')]});_0x31ae97[_0x4f3edb[_0xd70c('0x26')][_0xd70c('0x33')]]=_0x4f3edb[_0xd70c('0x26')][_0xd70c('0x2e')];return db['CmContact'][_0xd70c('0x44')](_0x31ae97,{'fields':_0x1e46ee,'raw':!![]});}})[_0xd70c('0x11')](function(_0x262ba4){_0x58e206[_0xd70c('0x45')]=_0x262ba4;if(_0x262ba4){var _0x1fe615={'ContactId':_0x262ba4['id'],'FaxAccountId':_0x4f3edb['account']['id'],'fax':_0x262ba4[_0xd70c('0x27')]};return db['FaxInteraction'][_0xd70c('0x36')]({'where':{'ContactId':_0x262ba4['id'],'closed':![],'FaxAccountId':_0x4f3edb[_0xd70c('0x37')]['id']}})[_0xd70c('0x11')](function(_0x3b3f11){if(_0x3b3f11){return[_0x3b3f11,![]];}return db[_0xd70c('0x46')][_0xd70c('0x44')](_0x1fe615)[_0xd70c('0x11')](function(_0x4a2eb1){return[_0x4a2eb1,!![]];});});}else{throw new Error(_0xd70c('0x47'));}})[_0xd70c('0x48')](function(_0x53d8a1,_0x174bc4){var _0x6428f7=_0x53d8a1[_0xd70c('0x49')]({'plain':!![]});if(_0x174bc4){if(_0x58e206['account'][_0xd70c('0x4a')]){_0x58e206[_0xd70c('0x3d')][_0xd70c('0x4b')]({'id':0x0,'priority':_0x58e206[_0xd70c('0x3d')][_0xd70c('0x42')]+0x1,'app':_0xd70c('0x4c'),'appdata':_0xd70c('0x4d'),'interval':_0xd70c('0x4e')});}_0x6428f7[_0xd70c('0x4f')]=!![];}else{_0x6428f7['created']=![];}_0x58e206[_0xd70c('0x50')]=_0x6428f7;return db[_0xd70c('0x51')][_0xd70c('0x44')]({'body':_0x4f3edb[_0xd70c('0x26')][_0xd70c('0x26')],'FaxAccountId':_0x4f3edb[_0xd70c('0x37')]['id'],'FaxInteractionId':_0x53d8a1['id'],'direction':'in','ContactId':_0x53d8a1[_0xd70c('0x52')],'AttachmentId':_0x4f3edb[_0xd70c('0x26')]['AttachmentId']});})[_0xd70c('0x11')](function(_0x93dca3){_0x58e206['message']=_0x93dca3;if(_0x58e206['interaction'][_0xd70c('0x53')]){return db[_0xd70c('0x54')]['find']({'attributes':['id','name'],'where':{'id':_0x58e206['interaction'][_0xd70c('0x53')]}})['then'](function(_0x183503){if(_0x183503){_0x58e206[_0xd70c('0x3d')]['unshift']({'id':0x0,'priority':0x0,'app':_0xd70c('0x55'),'appdata':_0x183503['name']+','+(_0x58e206['account']['waitForTheAssignedAgent']||0xa),'interval':_0xd70c('0x4e')});}return respondWithRpcPromise(_0xd70c('0x56'),'startRouting',_0x58e206);});}return respondWithRpcPromise('Start','startRouting',_0x58e206);})[_0xd70c('0x11')](function(_0x464041){_0x49b1fa(_0x464041);})[_0xd70c('0x1b')](function(_0x60f18){_0x4f60d4(_0x5b9a8a['error'](0x1f4,_0x60f18[_0xd70c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 2c7de8e..d95ca97 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 _0x9c41=['save','update','length'];(function(_0x40737d,_0x4fcfbc){var _0x11b37b=function(_0x40a15a){while(--_0x40a15a){_0x40737d['push'](_0x40737d['shift']());}};_0x11b37b(++_0x4fcfbc);}(_0x9c41,0x1c8));var _0x19c4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9c41[_0x14add3];return _0x4a174f;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x19c4('0x0'),'remove',_0x19c4('0x1')];function createListener(_0x183ac2,_0x53ddc0){return function(_0x405b53){_0x53ddc0['emit'](_0x183ac2,_0x405b53);};}function removeListener(_0x4a3689,_0x9ecfa4){return function(){FaxAccountEvents['removeListener'](_0x4a3689,_0x9ecfa4);};}exports['register']=function(_0x1586a4){for(var _0x4d36ac=0x0,_0x5921be=events[_0x19c4('0x2')];_0x4d36ac<_0x5921be;_0x4d36ac++){var _0x44e396=events[_0x4d36ac];var _0x27b52c=createListener('faxAccount:'+_0x44e396,_0x1586a4);FaxAccountEvents['on'](_0x44e396,_0x27b52c);}}; \ No newline at end of file +var _0x5a94=['length','faxAccount:','save','remove','update','removeListener'];(function(_0x5473da,_0x49396c){var _0x3b0928=function(_0x556ba7){while(--_0x556ba7){_0x5473da['push'](_0x5473da['shift']());}};_0x3b0928(++_0x49396c);}(_0x5a94,0x1c4));var _0x45a9=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x5a94[_0x51020b];return _0x371e47;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x45a9('0x0'),_0x45a9('0x1'),_0x45a9('0x2')];function createListener(_0x2f0f3c,_0x2c7cc3){return function(_0x5efb4b){_0x2c7cc3['emit'](_0x2f0f3c,_0x5efb4b);};}function removeListener(_0x36bfc4,_0x47d1fc){return function(){FaxAccountEvents[_0x45a9('0x3')](_0x36bfc4,_0x47d1fc);};}exports['register']=function(_0x475dee){for(var _0x219cde=0x0,_0x577d6f=events[_0x45a9('0x4')];_0x219cde<_0x577d6f;_0x219cde++){var _0x3efa0e=events[_0x219cde];var _0x208915=createListener(_0x45a9('0x5')+_0x3efa0e,_0x475dee);FaxAccountEvents['on'](_0x3efa0e,_0x208915);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index a79b0c6..66f39dc 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 _0x38c7=['/:id/messages','getMessages','getAgents','create','post','addInteraction','/:id/applications','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','put','update','delete','destroy','/:id/users','removeAgents','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','getApplications'];(function(_0x249228,_0x107f61){var _0xbecdeb=function(_0x3d0c3c){while(--_0x3d0c3c){_0x249228['push'](_0x249228['shift']());}};_0xbecdeb(++_0x107f61);}(_0x38c7,0x111));var _0x738c=function(_0x3dcecb,_0x9c907){_0x3dcecb=_0x3dcecb-0x0;var _0x19fa75=_0x38c7[_0x3dcecb];return _0x19fa75;};'use strict';var multer=require(_0x738c('0x0'));var util=require(_0x738c('0x1'));var path=require(_0x738c('0x2'));var express=require(_0x738c('0x3'));var router=express['Router']();var auth=require(_0x738c('0x4'));var interaction=require(_0x738c('0x5'));var config=require(_0x738c('0x6'));var controller=require(_0x738c('0x7'));router[_0x738c('0x8')]('/',auth[_0x738c('0x9')](),controller[_0x738c('0xa')]);router[_0x738c('0x8')](_0x738c('0xb'),auth[_0x738c('0x9')](),controller[_0x738c('0xc')]);router[_0x738c('0x8')](_0x738c('0xd'),auth[_0x738c('0x9')](),controller[_0x738c('0xe')]);router[_0x738c('0x8')](_0x738c('0xf'),auth['isAuthenticated'](),controller[_0x738c('0x10')]);router[_0x738c('0x8')](_0x738c('0x11'),auth[_0x738c('0x9')](),controller['getAnswers']);router[_0x738c('0x8')](_0x738c('0x12'),auth[_0x738c('0x9')](),controller[_0x738c('0x13')]);router[_0x738c('0x8')]('/:id/applications',auth[_0x738c('0x9')](),controller[_0x738c('0x14')]);router[_0x738c('0x8')](_0x738c('0x15'),auth['isAuthenticated'](),controller[_0x738c('0x16')]);router[_0x738c('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x738c('0x17')]);router['post']('/',auth[_0x738c('0x9')](),controller[_0x738c('0x18')]);router['post'](_0x738c('0xf'),auth[_0x738c('0x9')](),controller['addDisposition']);router[_0x738c('0x19')]('/:id/canned_answers',auth[_0x738c('0x9')](),controller['addAnswer']);router['post'](_0x738c('0x12'),auth[_0x738c('0x9')](),controller[_0x738c('0x1a')]);router[_0x738c('0x19')](_0x738c('0x1b'),auth[_0x738c('0x9')](),controller[_0x738c('0x1c')]);router[_0x738c('0x19')](_0x738c('0x1d'),auth[_0x738c('0x9')](),controller[_0x738c('0x1e')]);router['post'](_0x738c('0x1f'),auth['isAuthenticated'](),controller[_0x738c('0x20')]);router[_0x738c('0x19')](_0x738c('0x21'),auth[_0x738c('0x9')](),controller[_0x738c('0x22')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x738c('0x23')](_0x738c('0xd'),auth[_0x738c('0x9')](),controller[_0x738c('0x24')]);router[_0x738c('0x25')]('/:id',auth[_0x738c('0x9')](),controller[_0x738c('0x26')]);router[_0x738c('0x25')](_0x738c('0xf'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x738c('0x11'),auth[_0x738c('0x9')](),controller['removeAnswers']);router[_0x738c('0x25')](_0x738c('0x27'),auth[_0x738c('0x9')](),controller[_0x738c('0x28')]);module[_0x738c('0x29')]=router; \ No newline at end of file +var _0x2d12=['getInteractions','/:id/applications','getApplications','/:id/messages','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','addInteraction','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','describe','/:id/canned_answers','getAnswers','/:id/interactions'];(function(_0x165d27,_0xa67b28){var _0x2e7643=function(_0x122179){while(--_0x122179){_0x165d27['push'](_0x165d27['shift']());}};_0x2e7643(++_0xa67b28);}(_0x2d12,0x198));var _0x22d1=function(_0x17ca55,_0xd297e1){_0x17ca55=_0x17ca55-0x0;var _0x5bea5d=_0x2d12[_0x17ca55];return _0x5bea5d;};'use strict';var multer=require('multer');var util=require(_0x22d1('0x0'));var path=require('path');var express=require('express');var router=express[_0x22d1('0x1')]();var auth=require(_0x22d1('0x2'));var interaction=require(_0x22d1('0x3'));var config=require(_0x22d1('0x4'));var controller=require(_0x22d1('0x5'));router[_0x22d1('0x6')]('/',auth[_0x22d1('0x7')](),controller['index']);router['get']('/describe',auth[_0x22d1('0x7')](),controller[_0x22d1('0x8')]);router['get']('/:id',auth[_0x22d1('0x7')](),controller['show']);router[_0x22d1('0x6')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0x22d1('0x6')](_0x22d1('0x9'),auth[_0x22d1('0x7')](),controller[_0x22d1('0xa')]);router['get'](_0x22d1('0xb'),auth[_0x22d1('0x7')](),controller[_0x22d1('0xc')]);router['get'](_0x22d1('0xd'),auth['isAuthenticated'](),controller[_0x22d1('0xe')]);router[_0x22d1('0x6')](_0x22d1('0xf'),auth['isAuthenticated'](),controller['getMessages']);router[_0x22d1('0x6')](_0x22d1('0x10'),auth[_0x22d1('0x7')](),controller[_0x22d1('0x11')]);router[_0x22d1('0x12')]('/',auth[_0x22d1('0x7')](),controller['create']);router[_0x22d1('0x12')](_0x22d1('0x13'),auth[_0x22d1('0x7')](),controller[_0x22d1('0x14')]);router[_0x22d1('0x12')](_0x22d1('0x9'),auth[_0x22d1('0x7')](),controller[_0x22d1('0x15')]);router[_0x22d1('0x12')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x22d1('0x16')]);router[_0x22d1('0x12')](_0x22d1('0xd'),auth[_0x22d1('0x7')](),controller['addApplications']);router[_0x22d1('0x12')](_0x22d1('0x17'),auth[_0x22d1('0x7')](),controller['addAccountApplications']);router[_0x22d1('0x12')](_0x22d1('0x18'),auth[_0x22d1('0x7')](),controller[_0x22d1('0x19')]);router['post'](_0x22d1('0x1a'),auth[_0x22d1('0x7')](),controller['send']);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x22d1('0x1b'),auth['isAuthenticated'](),controller[_0x22d1('0x1c')]);router['delete'](_0x22d1('0x1b'),auth[_0x22d1('0x7')](),controller[_0x22d1('0x1d')]);router[_0x22d1('0x1e')](_0x22d1('0x13'),auth['isAuthenticated'](),controller[_0x22d1('0x1f')]);router[_0x22d1('0x1e')](_0x22d1('0x9'),auth['isAuthenticated'](),controller[_0x22d1('0x20')]);router[_0x22d1('0x1e')](_0x22d1('0x10'),auth[_0x22d1('0x7')](),controller[_0x22d1('0x21')]);module[_0x22d1('0x22')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 6f2fcf6..83d62c7 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 _0xe6b4=['exports','STRING','sequelize'];(function(_0x29af0e,_0x35f669){var _0x349e39=function(_0x251fba){while(--_0x251fba){_0x29af0e['push'](_0x29af0e['shift']());}};_0x349e39(++_0x35f669);}(_0xe6b4,0x182));var _0x4e6b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe6b4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4e6b('0x0'));module[_0x4e6b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x4e6b('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x4e6b('0x2')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x4e6b('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x5b8f=['noop','STRING','sequelize','INTEGER'];(function(_0x32413a,_0x2fbe54){var _0x1439e0=function(_0x108320){while(--_0x108320){_0x32413a['push'](_0x32413a['shift']());}};_0x1439e0(++_0x2fbe54);}(_0x5b8f,0xfa));var _0xf5b8=function(_0x2842b4,_0x2b1b7b){_0x2842b4=_0x2842b4-0x0;var _0x2b9521=_0x5b8f[_0x2842b4];return _0x2b9521;};'use strict';var Sequelize=require(_0xf5b8('0x0'));module['exports']={'priority':{'type':Sequelize[_0xf5b8('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf5b8('0x2')},'appdata':{'type':Sequelize[_0xf5b8('0x3')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0xf5b8('0x3')]},'interval':{'type':Sequelize[_0xf5b8('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 88822f3..2b259a4 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 _0x4450=['dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','add','day','where','filter','merge','map','options','FaxApplication','includeAll','findAll','catch','show','params','include','body','find','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','name','index','rawAttributes','model','keys','dateStart','query'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x4450,0x15f));var _0x0445=function(_0x5670c2,_0xeabcd5){_0x5670c2=_0x5670c2-0x0;var _0x583021=_0x4450[_0x5670c2];return _0x583021;};'use strict';var jsonpatch=require(_0x0445('0x0'));var rp=require(_0x0445('0x1'));var moment=require(_0x0445('0x2'));var BPromise=require(_0x0445('0x3'));var Mustache=require(_0x0445('0x4'));var util=require(_0x0445('0x5'));var path=require('path');var sox=require(_0x0445('0x6'));var csv=require(_0x0445('0x7'));var ejs=require(_0x0445('0x8'));var fs=require('fs');var _=require(_0x0445('0x9'));var squel=require(_0x0445('0xa'));var crypto=require(_0x0445('0xb'));var jsforce=require(_0x0445('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0445('0xd'));var Papa=require(_0x0445('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0x0445('0xf'))(_0x0445('0x10'));var utils=require(_0x0445('0x11'));var config=require(_0x0445('0x12'));var db=require(_0x0445('0x13'))['db'];function respondWithStatusCode(_0x363ed3,_0x1e7843){_0x1e7843=_0x1e7843||0xcc;return function(_0xe3d8ba){if(_0xe3d8ba){return _0x363ed3['sendStatus'](_0x1e7843);}return _0x363ed3[_0x0445('0x14')](_0x1e7843)[_0x0445('0x15')]();};}function respondWithResult(_0x322e33,_0xb7447b){_0xb7447b=_0xb7447b||0xc8;return function(_0x3b162e){if(_0x3b162e){return _0x322e33[_0x0445('0x14')](_0xb7447b)[_0x0445('0x16')](_0x3b162e);}};}function respondWithFilteredResult(_0x5b2593,_0x396c5d){return function(_0x5d5baf){if(_0x5d5baf){var _0x9ff4be=_0x5d5baf[_0x0445('0x17')],_0x1cc40f=_0x396c5d['offset'],_0x274e72=_0x396c5d[_0x0445('0x18')]+_0x396c5d[_0x0445('0x19')],_0x5345e7;if(_0x274e72>=_0x9ff4be){_0x274e72=_0x9ff4be;_0x5345e7=0xc8;}else{_0x5345e7=0xce;}_0x5b2593[_0x0445('0x14')](_0x5345e7);return _0x5b2593[_0x0445('0x1a')]('Content-Range',_0x1cc40f+'-'+_0x274e72+'/'+_0x9ff4be)[_0x0445('0x16')](_0x5d5baf);}return null;};}function patchUpdates(_0x1799af){return function(_0x6490d3){try{jsonpatch['apply'](_0x6490d3,_0x1799af,!![]);}catch(_0x4a2f11){return BPromise[_0x0445('0x1b')](_0x4a2f11);}return _0x6490d3[_0x0445('0x1c')]();};}function saveUpdates(_0x1e0ac4,_0xfcc640){return function(_0xab3d9e){if(_0xab3d9e){return _0xab3d9e[_0x0445('0x1d')](_0x1e0ac4)[_0x0445('0x1e')](function(_0x1847ba){return _0x1847ba;});}return null;};}function removeEntity(_0x411707,_0x8457da){return function(_0x4e87e3){if(_0x4e87e3){return _0x4e87e3[_0x0445('0x1f')]()[_0x0445('0x1e')](function(){_0x411707[_0x0445('0x14')](0xcc)[_0x0445('0x15')]();});}};}function handleEntityNotFound(_0x2538d4,_0x17ad7b){return function(_0x2d8ef4){if(!_0x2d8ef4){_0x2538d4['sendStatus'](0x194);}return _0x2d8ef4;};}function handleError(_0x4f99d6,_0x390530){_0x390530=_0x390530||0x1f4;return function(_0x5e6d75){logger['error'](_0x5e6d75['stack']);if(_0x5e6d75[_0x0445('0x20')]){delete _0x5e6d75[_0x0445('0x20')];}_0x4f99d6[_0x0445('0x14')](_0x390530)['send'](_0x5e6d75);};}exports[_0x0445('0x21')]=function(_0x28751e,_0x51007d){var _0x3c682b={},_0x90f924={},_0x520776={'count':0x0,'rows':[]};var _0xcc38e4=db['FaxApplication'][_0x0445('0x22')];_0x90f924[_0x0445('0x23')]=_[_0x0445('0x24')](_0xcc38e4);var _0x327db1={'dateStart':_0x28751e['query'][_0x0445('0x25')],'dateEnd':_0x28751e[_0x0445('0x26')]['dateEnd']};delete _0x28751e['query'][_0x0445('0x25')];delete _0x28751e['query'][_0x0445('0x27')];_0x90f924[_0x0445('0x26')]=_[_0x0445('0x24')](_0x28751e[_0x0445('0x26')]);_0x90f924[_0x0445('0x28')]=_[_0x0445('0x29')](_0x90f924[_0x0445('0x23')],_0x90f924[_0x0445('0x26')]);_0x3c682b[_0x0445('0x2a')]=_[_0x0445('0x29')](_0x90f924[_0x0445('0x23')],qs[_0x0445('0x2b')](_0x28751e[_0x0445('0x26')][_0x0445('0x2b')]));_0x3c682b[_0x0445('0x2a')]=_0x3c682b[_0x0445('0x2a')][_0x0445('0x2c')]?_0x3c682b[_0x0445('0x2a')]:_0x90f924[_0x0445('0x23')];if(!_0x28751e[_0x0445('0x26')][_0x0445('0x2d')]('nolimit')){_0x3c682b[_0x0445('0x19')]=qs['limit'](_0x28751e[_0x0445('0x26')][_0x0445('0x19')]);_0x3c682b[_0x0445('0x18')]=qs[_0x0445('0x18')](_0x28751e[_0x0445('0x26')][_0x0445('0x18')]);}_0x3c682b[_0x0445('0x2e')]=qs[_0x0445('0x2f')](_0x28751e[_0x0445('0x26')][_0x0445('0x2f')]);_0x3c682b['where']=qs[_0x0445('0x28')](_[_0x0445('0x30')](_0x28751e['query'],_0x90f924[_0x0445('0x28')]));if(_0x327db1[_0x0445('0x25')]){if(_0x327db1[_0x0445('0x27')]){_0x327db1[_0x0445('0x27')]=moment(_0x327db1[_0x0445('0x27')])[_0x0445('0x31')](0x1,'day');}else{_0x327db1['dateEnd']=moment(_0x327db1['dateStart'])[_0x0445('0x31')](0x1,_0x0445('0x32'));}_['merge'](_0x3c682b[_0x0445('0x33')],{'createdAt':{'$gte':_0x327db1[_0x0445('0x25')],'$lte':_0x327db1[_0x0445('0x27')]}});}if(_0x28751e[_0x0445('0x26')][_0x0445('0x34')]){_0x3c682b[_0x0445('0x33')]=_[_0x0445('0x35')](_0x3c682b[_0x0445('0x33')],{'$or':_[_0x0445('0x36')](_0x3c682b[_0x0445('0x2a')],function(_0x4d2289){var _0x3bcd38={};_0x3bcd38[_0x4d2289]={'$like':'%'+_0x28751e['query'][_0x0445('0x34')]+'%'};return _0x3bcd38;})});}_0x3c682b=_[_0x0445('0x35')]({},_0x3c682b,_0x28751e[_0x0445('0x37')]);var _0x175411={'where':_0x3c682b['where']};return db[_0x0445('0x38')][_0x0445('0x17')](_0x175411)[_0x0445('0x1e')](function(_0x28d3f0){_0x520776['count']=_0x28d3f0;if(_0x28751e[_0x0445('0x26')][_0x0445('0x39')]){_0x3c682b['include']=[{'all':!![]}];}return db['FaxApplication'][_0x0445('0x3a')](_0x3c682b);})[_0x0445('0x1e')](function(_0x417192){_0x520776['rows']=_0x417192;return _0x520776;})[_0x0445('0x1e')](respondWithFilteredResult(_0x51007d,_0x3c682b))[_0x0445('0x3b')](handleError(_0x51007d,null));};exports[_0x0445('0x3c')]=function(_0x2f889d,_0x4af637){var _0xd43284={'raw':!![],'where':{'id':_0x2f889d[_0x0445('0x3d')]['id']}},_0x2afba6={};_0x2afba6[_0x0445('0x23')]=_['keys'](db[_0x0445('0x38')]['rawAttributes']);_0x2afba6['query']=_['keys'](_0x2f889d[_0x0445('0x26')]);_0x2afba6[_0x0445('0x28')]=_['intersection'](_0x2afba6['model'],_0x2afba6['query']);_0xd43284[_0x0445('0x2a')]=_[_0x0445('0x29')](_0x2afba6[_0x0445('0x23')],qs['fields'](_0x2f889d[_0x0445('0x26')]['fields']));_0xd43284[_0x0445('0x2a')]=_0xd43284[_0x0445('0x2a')][_0x0445('0x2c')]?_0xd43284[_0x0445('0x2a')]:_0x2afba6['model'];if(_0x2f889d['query'][_0x0445('0x39')]){_0xd43284[_0x0445('0x3e')]=[{'all':!![]}];}_0xd43284=_[_0x0445('0x35')]({},_0xd43284,_0x2f889d[_0x0445('0x37')]);return db[_0x0445('0x38')]['find'](_0xd43284)[_0x0445('0x1e')](handleEntityNotFound(_0x4af637,null))['then'](respondWithResult(_0x4af637,null))[_0x0445('0x3b')](handleError(_0x4af637,null));};exports['create']=function(_0x171cb3,_0x3a480c){return db['FaxApplication']['create'](_0x171cb3[_0x0445('0x3f')],{})[_0x0445('0x1e')](respondWithResult(_0x3a480c,0xc9))['catch'](handleError(_0x3a480c,null));};exports['update']=function(_0x1517f8,_0x5ef6fc){if(_0x1517f8['body']['id']){delete _0x1517f8['body']['id'];}return db[_0x0445('0x38')]['find']({'where':{'id':_0x1517f8[_0x0445('0x3d')]['id']}})[_0x0445('0x1e')](handleEntityNotFound(_0x5ef6fc,null))[_0x0445('0x1e')](saveUpdates(_0x1517f8[_0x0445('0x3f')],null))[_0x0445('0x1e')](respondWithResult(_0x5ef6fc,null))[_0x0445('0x3b')](handleError(_0x5ef6fc,null));};exports['destroy']=function(_0x455561,_0x41d1b8){return db[_0x0445('0x38')][_0x0445('0x40')]({'where':{'id':_0x455561[_0x0445('0x3d')]['id']}})[_0x0445('0x1e')](handleEntityNotFound(_0x41d1b8,null))[_0x0445('0x1e')](removeEntity(_0x41d1b8,null))[_0x0445('0x3b')](handleError(_0x41d1b8,null));}; \ No newline at end of file +var _0x3908=['length','hasOwnProperty','nolimit','order','sort','where','day','add','map','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','request-promise','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','FaxApplication','rawAttributes','model','query','dateEnd','dateStart','keys','filters','intersection','attributes','fields'];(function(_0x4dcab0,_0x44ce62){var _0x5c8ef3=function(_0x4c596){while(--_0x4c596){_0x4dcab0['push'](_0x4dcab0['shift']());}};_0x5c8ef3(++_0x44ce62);}(_0x3908,0x11e));var _0x8390=function(_0x380a3f,_0x202483){_0x380a3f=_0x380a3f-0x0;var _0x2b4eca=_0x3908[_0x380a3f];return _0x2b4eca;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x8390('0x0'));var moment=require('moment');var BPromise=require(_0x8390('0x1'));var Mustache=require(_0x8390('0x2'));var util=require(_0x8390('0x3'));var path=require(_0x8390('0x4'));var sox=require(_0x8390('0x5'));var csv=require(_0x8390('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8390('0x7'));var jsforce=require(_0x8390('0x8'));var deskjs=require(_0x8390('0x9'));var toCsv=require(_0x8390('0x6'));var querystring=require(_0x8390('0xa'));var Papa=require(_0x8390('0xb'));var qs=require(_0x8390('0xc'));var logger=require('../../config/logger')(_0x8390('0xd'));var utils=require(_0x8390('0xe'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bd6cf,_0x42500d){_0x42500d=_0x42500d||0xcc;return function(_0x3eec81){if(_0x3eec81){return _0x5bd6cf[_0x8390('0xf')](_0x42500d);}return _0x5bd6cf['status'](_0x42500d)[_0x8390('0x10')]();};}function respondWithResult(_0x24f098,_0x25fd4e){_0x25fd4e=_0x25fd4e||0xc8;return function(_0x2f2a9a){if(_0x2f2a9a){return _0x24f098['status'](_0x25fd4e)[_0x8390('0x11')](_0x2f2a9a);}};}function respondWithFilteredResult(_0x15b1c8,_0x45e507){return function(_0x13a2cc){if(_0x13a2cc){var _0x2935f5=_0x13a2cc[_0x8390('0x12')],_0x156b8c=_0x45e507[_0x8390('0x13')],_0x431fd7=_0x45e507[_0x8390('0x13')]+_0x45e507[_0x8390('0x14')],_0x21e68d;if(_0x431fd7>=_0x2935f5){_0x431fd7=_0x2935f5;_0x21e68d=0xc8;}else{_0x21e68d=0xce;}_0x15b1c8[_0x8390('0x15')](_0x21e68d);return _0x15b1c8[_0x8390('0x16')](_0x8390('0x17'),_0x156b8c+'-'+_0x431fd7+'/'+_0x2935f5)['json'](_0x13a2cc);}return null;};}function patchUpdates(_0x1431e6){return function(_0x2ee911){try{jsonpatch[_0x8390('0x18')](_0x2ee911,_0x1431e6,!![]);}catch(_0x563435){return BPromise[_0x8390('0x19')](_0x563435);}return _0x2ee911[_0x8390('0x1a')]();};}function saveUpdates(_0x46f9bb,_0x3f5036){return function(_0x3e0dcd){if(_0x3e0dcd){return _0x3e0dcd[_0x8390('0x1b')](_0x46f9bb)[_0x8390('0x1c')](function(_0x4c74b6){return _0x4c74b6;});}return null;};}function removeEntity(_0x11ec92,_0x25656f){return function(_0x3597e2){if(_0x3597e2){return _0x3597e2[_0x8390('0x1d')]()[_0x8390('0x1c')](function(){_0x11ec92[_0x8390('0x15')](0xcc)[_0x8390('0x10')]();});}};}function handleEntityNotFound(_0x3fdcb4,_0xdcc251){return function(_0x4de30d){if(!_0x4de30d){_0x3fdcb4[_0x8390('0xf')](0x194);}return _0x4de30d;};}function handleError(_0x5384a7,_0xf2bfc){_0xf2bfc=_0xf2bfc||0x1f4;return function(_0x30c5c7){logger[_0x8390('0x1e')](_0x30c5c7['stack']);if(_0x30c5c7[_0x8390('0x1f')]){delete _0x30c5c7[_0x8390('0x1f')];}_0x5384a7[_0x8390('0x15')](_0xf2bfc)['send'](_0x30c5c7);};}exports[_0x8390('0x20')]=function(_0x382b9d,_0x47277a){var _0x199441={},_0x5514f4={},_0x264843={'count':0x0,'rows':[]};var _0x265a88=db[_0x8390('0x21')][_0x8390('0x22')];_0x5514f4[_0x8390('0x23')]=_['keys'](_0x265a88);var _0x41aebd={'dateStart':_0x382b9d[_0x8390('0x24')]['dateStart'],'dateEnd':_0x382b9d[_0x8390('0x24')][_0x8390('0x25')]};delete _0x382b9d['query'][_0x8390('0x26')];delete _0x382b9d[_0x8390('0x24')][_0x8390('0x25')];_0x5514f4['query']=_[_0x8390('0x27')](_0x382b9d[_0x8390('0x24')]);_0x5514f4[_0x8390('0x28')]=_[_0x8390('0x29')](_0x5514f4[_0x8390('0x23')],_0x5514f4[_0x8390('0x24')]);_0x199441[_0x8390('0x2a')]=_[_0x8390('0x29')](_0x5514f4['model'],qs[_0x8390('0x2b')](_0x382b9d[_0x8390('0x24')]['fields']));_0x199441[_0x8390('0x2a')]=_0x199441[_0x8390('0x2a')][_0x8390('0x2c')]?_0x199441[_0x8390('0x2a')]:_0x5514f4[_0x8390('0x23')];if(!_0x382b9d[_0x8390('0x24')][_0x8390('0x2d')](_0x8390('0x2e'))){_0x199441['limit']=qs[_0x8390('0x14')](_0x382b9d[_0x8390('0x24')][_0x8390('0x14')]);_0x199441[_0x8390('0x13')]=qs[_0x8390('0x13')](_0x382b9d[_0x8390('0x24')]['offset']);}_0x199441[_0x8390('0x2f')]=qs[_0x8390('0x30')](_0x382b9d['query']['sort']);_0x199441[_0x8390('0x31')]=qs[_0x8390('0x28')](_['pick'](_0x382b9d['query'],_0x5514f4['filters']));if(_0x41aebd[_0x8390('0x26')]){if(_0x41aebd[_0x8390('0x25')]){_0x41aebd['dateEnd']=moment(_0x41aebd[_0x8390('0x25')])['add'](0x1,_0x8390('0x32'));}else{_0x41aebd['dateEnd']=moment(_0x41aebd['dateStart'])[_0x8390('0x33')](0x1,_0x8390('0x32'));}_['merge'](_0x199441[_0x8390('0x31')],{'createdAt':{'$gte':_0x41aebd[_0x8390('0x26')],'$lte':_0x41aebd[_0x8390('0x25')]}});}if(_0x382b9d['query']['filter']){_0x199441['where']=_['merge'](_0x199441[_0x8390('0x31')],{'$or':_[_0x8390('0x34')](_0x199441['attributes'],function(_0xcc0b7c){var _0x26d7bd={};_0x26d7bd[_0xcc0b7c]={'$like':'%'+_0x382b9d[_0x8390('0x24')][_0x8390('0x35')]+'%'};return _0x26d7bd;})});}_0x199441=_[_0x8390('0x36')]({},_0x199441,_0x382b9d['options']);var _0x2fcc6b={'where':_0x199441[_0x8390('0x31')]};return db[_0x8390('0x21')][_0x8390('0x12')](_0x2fcc6b)[_0x8390('0x1c')](function(_0x2a1468){_0x264843['count']=_0x2a1468;if(_0x382b9d[_0x8390('0x24')][_0x8390('0x37')]){_0x199441[_0x8390('0x38')]=[{'all':!![]}];}return db[_0x8390('0x21')][_0x8390('0x39')](_0x199441);})[_0x8390('0x1c')](function(_0x19927e){_0x264843[_0x8390('0x3a')]=_0x19927e;return _0x264843;})[_0x8390('0x1c')](respondWithFilteredResult(_0x47277a,_0x199441))[_0x8390('0x3b')](handleError(_0x47277a,null));};exports[_0x8390('0x3c')]=function(_0x1a18a7,_0x1366a1){var _0x2c6662={'raw':!![],'where':{'id':_0x1a18a7[_0x8390('0x3d')]['id']}},_0x31e170={};_0x31e170[_0x8390('0x23')]=_[_0x8390('0x27')](db['FaxApplication'][_0x8390('0x22')]);_0x31e170[_0x8390('0x24')]=_[_0x8390('0x27')](_0x1a18a7['query']);_0x31e170[_0x8390('0x28')]=_[_0x8390('0x29')](_0x31e170[_0x8390('0x23')],_0x31e170[_0x8390('0x24')]);_0x2c6662[_0x8390('0x2a')]=_[_0x8390('0x29')](_0x31e170[_0x8390('0x23')],qs[_0x8390('0x2b')](_0x1a18a7[_0x8390('0x24')][_0x8390('0x2b')]));_0x2c6662['attributes']=_0x2c6662['attributes']['length']?_0x2c6662[_0x8390('0x2a')]:_0x31e170[_0x8390('0x23')];if(_0x1a18a7[_0x8390('0x24')][_0x8390('0x37')]){_0x2c6662[_0x8390('0x38')]=[{'all':!![]}];}_0x2c6662=_['merge']({},_0x2c6662,_0x1a18a7[_0x8390('0x3e')]);return db[_0x8390('0x21')]['find'](_0x2c6662)[_0x8390('0x1c')](handleEntityNotFound(_0x1366a1,null))[_0x8390('0x1c')](respondWithResult(_0x1366a1,null))[_0x8390('0x3b')](handleError(_0x1366a1,null));};exports[_0x8390('0x3f')]=function(_0x9045f5,_0x5719ed){return db[_0x8390('0x21')][_0x8390('0x3f')](_0x9045f5['body'],{})['then'](respondWithResult(_0x5719ed,0xc9))[_0x8390('0x3b')](handleError(_0x5719ed,null));};exports[_0x8390('0x1b')]=function(_0x263b77,_0x3fafbe){if(_0x263b77['body']['id']){delete _0x263b77[_0x8390('0x40')]['id'];}return db[_0x8390('0x21')][_0x8390('0x41')]({'where':{'id':_0x263b77[_0x8390('0x3d')]['id']}})[_0x8390('0x1c')](handleEntityNotFound(_0x3fafbe,null))[_0x8390('0x1c')](saveUpdates(_0x263b77[_0x8390('0x40')],null))['then'](respondWithResult(_0x3fafbe,null))[_0x8390('0x3b')](handleError(_0x3fafbe,null));};exports['destroy']=function(_0x2b0b48,_0x548faa){return db[_0x8390('0x21')]['find']({'where':{'id':_0x2b0b48[_0x8390('0x3d')]['id']}})['then'](handleEntityNotFound(_0x548faa,null))[_0x8390('0x1c')](removeEntity(_0x548faa,null))['catch'](handleError(_0x548faa,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index d00f793..8f30189 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 _0x4a9d=['define','FaxApplication','fax_applications','util','api','moment','bluebird','request-promise'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x4a9d,0x1e3));var _0xd4a9=function(_0x4f7258,_0x81abfe){_0x4f7258=_0x4f7258-0x0;var _0x1017f3=_0x4a9d[_0x4f7258];return _0x1017f3;};'use strict';var _=require('lodash');var util=require(_0xd4a9('0x0'));var logger=require('../../config/logger')(_0xd4a9('0x1'));var moment=require(_0xd4a9('0x2'));var BPromise=require(_0xd4a9('0x3'));var rp=require(_0xd4a9('0x4'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0xe4d033,_0x14b869){return _0xe4d033[_0xd4a9('0x5')](_0xd4a9('0x6'),attributes,{'tableName':_0xd4a9('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7079=['request-promise','./faxApplication.attributes','define','FaxApplication','fax_applications','util','../../config/logger','api','moment','bluebird'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7079,0x1c7));var _0x9707=function(_0x249811,_0x162ca7){_0x249811=_0x249811-0x0;var _0x4eb652=_0x7079[_0x249811];return _0x4eb652;};'use strict';var _=require('lodash');var util=require(_0x9707('0x0'));var logger=require(_0x9707('0x1'))(_0x9707('0x2'));var moment=require(_0x9707('0x3'));var BPromise=require(_0x9707('0x4'));var rp=require(_0x9707('0x5'));var attributes=require(_0x9707('0x6'));module['exports']=function(_0x483071,_0x4872d0){return _0x483071[_0x9707('0x7')](_0x9707('0x8'),attributes,{'tableName':_0x9707('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 5fb71f3..b3490d7 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 _0x535f=['attributes','debug','stringify','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','UpdateFaxApplication','update','body','options'];(function(_0x77c3bb,_0xce09ed){var _0x5e44db=function(_0x5618b7){while(--_0x5618b7){_0x77c3bb['push'](_0x77c3bb['shift']());}};_0x5e44db(++_0xce09ed);}(_0x535f,0x111));var _0xf535=function(_0x50ecfd,_0x47b417){_0x50ecfd=_0x50ecfd-0x0;var _0x561933=_0x535f[_0x50ecfd];return _0x561933;};'use strict';var _=require('lodash');var util=require(_0xf535('0x0'));var moment=require(_0xf535('0x1'));var BPromise=require('bluebird');var rs=require(_0xf535('0x2'));var fs=require('fs');var db=require(_0xf535('0x3'))['db'];var utils=require(_0xf535('0x4'));var logger=require(_0xf535('0x5'))('rpc');var config=require(_0xf535('0x6'));var jayson=require(_0xf535('0x7'));var client=jayson[_0xf535('0x8')][_0xf535('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41ca74,_0xc74104,_0x580328){return new BPromise(function(_0x510b86,_0x17f72e){return client[_0xf535('0xa')](_0x41ca74,_0x580328)[_0xf535('0xb')](function(_0x51b742){logger[_0xf535('0xc')](_0xf535('0xd'),_0xc74104,'request\x20sent');logger['debug'](_0xf535('0xe'),_0xc74104,_0xf535('0xf'),JSON['stringify'](_0x51b742));if(_0x51b742['error']){if(_0x51b742[_0xf535('0x10')][_0xf535('0x11')]===0x1f4){logger[_0xf535('0x10')](_0xf535('0xd'),_0xc74104,_0x51b742[_0xf535('0x10')]['message']);return _0x17f72e(_0x51b742[_0xf535('0x10')][_0xf535('0x12')]);}logger[_0xf535('0x10')](_0xf535('0xd'),_0xc74104,_0x51b742[_0xf535('0x10')][_0xf535('0x12')]);return _0x510b86(_0x51b742[_0xf535('0x10')][_0xf535('0x12')]);}else{logger[_0xf535('0xc')](_0xf535('0xd'),_0xc74104,_0xf535('0xf'));_0x510b86(_0x51b742['result'][_0xf535('0x12')]);}})[_0xf535('0x13')](function(_0x302a4e){logger[_0xf535('0x10')](_0xf535('0xd'),_0xc74104,_0x302a4e);_0x17f72e(_0x302a4e);});});}exports[_0xf535('0x14')]=function(_0xc790c9){var _0x33a8c3=this;return new Promise(function(_0x15132b,_0x477c1d){return db['FaxApplication'][_0xf535('0x15')](_0xc790c9[_0xf535('0x16')],{'raw':_0xc790c9[_0xf535('0x17')]?_0xc790c9[_0xf535('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc790c9[_0xf535('0x17')]?_0xc790c9[_0xf535('0x17')]['where']||null:null,'attributes':_0xc790c9['options']?_0xc790c9['options'][_0xf535('0x18')]||null:null,'limit':_0xc790c9[_0xf535('0x17')]?_0xc790c9[_0xf535('0x17')]['limit']||null:null})['then'](function(_0x438cb1){logger[_0xf535('0xc')](_0xf535('0x14'),_0xc790c9);logger[_0xf535('0x19')](_0xf535('0x14'),_0xc790c9,JSON[_0xf535('0x1a')](_0x438cb1));_0x15132b(_0x438cb1);})[_0xf535('0x13')](function(_0x43ea4b){logger[_0xf535('0x10')](_0xf535('0x14'),_0x43ea4b[_0xf535('0x12')],_0xc790c9);_0x477c1d(_0x33a8c3['error'](0x1f4,_0x43ea4b[_0xf535('0x12')]));});});}; \ No newline at end of file +var _0x1e69=['raw','where','attributes','limit','UpdateFaxApplication','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','FaxApplication','update','body','options'];(function(_0xec0590,_0xd27f54){var _0x58158f=function(_0x4e6cef){while(--_0x4e6cef){_0xec0590['push'](_0xec0590['shift']());}};_0x58158f(++_0xd27f54);}(_0x1e69,0x85));var _0x91e6=function(_0x58d379,_0x4d6fa5){_0x58d379=_0x58d379-0x0;var _0x4c322b=_0x1e69[_0x58d379];return _0x4c322b;};'use strict';var _=require('lodash');var util=require(_0x91e6('0x0'));var moment=require(_0x91e6('0x1'));var BPromise=require(_0x91e6('0x2'));var rs=require(_0x91e6('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x91e6('0x4'))(_0x91e6('0x5'));var config=require(_0x91e6('0x6'));var jayson=require(_0x91e6('0x7'));var client=jayson[_0x91e6('0x8')][_0x91e6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4091b8,_0x2733bf,_0x1347c3){return new BPromise(function(_0x375184,_0x266fe6){return client[_0x91e6('0xa')](_0x4091b8,_0x1347c3)[_0x91e6('0xb')](function(_0x592630){logger['info'](_0x91e6('0xc'),_0x2733bf,_0x91e6('0xd'));logger[_0x91e6('0xe')](_0x91e6('0xf'),_0x2733bf,'request\x20sent',JSON[_0x91e6('0x10')](_0x592630));if(_0x592630[_0x91e6('0x11')]){if(_0x592630[_0x91e6('0x11')][_0x91e6('0x12')]===0x1f4){logger['error'](_0x91e6('0xc'),_0x2733bf,_0x592630[_0x91e6('0x11')][_0x91e6('0x13')]);return _0x266fe6(_0x592630[_0x91e6('0x11')][_0x91e6('0x13')]);}logger[_0x91e6('0x11')](_0x91e6('0xc'),_0x2733bf,_0x592630['error'][_0x91e6('0x13')]);return _0x375184(_0x592630[_0x91e6('0x11')][_0x91e6('0x13')]);}else{logger[_0x91e6('0x14')]('FaxApplication,\x20%s,\x20%s',_0x2733bf,_0x91e6('0xd'));_0x375184(_0x592630[_0x91e6('0x15')]['message']);}})[_0x91e6('0x16')](function(_0x4a7219){logger['error']('FaxApplication,\x20%s,\x20%s',_0x2733bf,_0x4a7219);_0x266fe6(_0x4a7219);});});}exports['UpdateFaxApplication']=function(_0x38ff1a){var _0xdc9327=this;return new Promise(function(_0x4b53b0,_0x5bda45){return db[_0x91e6('0x17')][_0x91e6('0x18')](_0x38ff1a[_0x91e6('0x19')],{'raw':_0x38ff1a[_0x91e6('0x1a')]?_0x38ff1a[_0x91e6('0x1a')][_0x91e6('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38ff1a[_0x91e6('0x1a')]?_0x38ff1a[_0x91e6('0x1a')][_0x91e6('0x1c')]||null:null,'attributes':_0x38ff1a[_0x91e6('0x1a')]?_0x38ff1a['options'][_0x91e6('0x1d')]||null:null,'limit':_0x38ff1a[_0x91e6('0x1a')]?_0x38ff1a[_0x91e6('0x1a')][_0x91e6('0x1e')]||null:null})[_0x91e6('0xb')](function(_0x458e49){logger['info']('UpdateFaxApplication',_0x38ff1a);logger[_0x91e6('0xe')](_0x91e6('0x1f'),_0x38ff1a,JSON[_0x91e6('0x10')](_0x458e49));_0x4b53b0(_0x458e49);})[_0x91e6('0x16')](function(_0x5e2d8d){logger[_0x91e6('0x11')](_0x91e6('0x1f'),_0x5e2d8d[_0x91e6('0x13')],_0x38ff1a);_0x5bda45(_0xdc9327[_0x91e6('0x11')](0x1f4,_0x5e2d8d[_0x91e6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index f086dca..e553082 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 _0x814b=['multer','util','path','express','Router','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','exports'];(function(_0x528133,_0x2d67fc){var _0x4493b3=function(_0x488fd3){while(--_0x488fd3){_0x528133['push'](_0x528133['shift']());}};_0x4493b3(++_0x2d67fc);}(_0x814b,0x1a2));var _0xb814=function(_0x26474a,_0x3cfcfd){_0x26474a=_0x26474a-0x0;var _0x32e0e0=_0x814b[_0x26474a];return _0x32e0e0;};'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 _0xc1c6=['/:id','show','post','isAuthenticated','create','delete','destroy','multer','util','path','Router','../../components/interaction/service','../../config/environment','./faxApplication.controller','index'];(function(_0x1410d4,_0x14e7a7){var _0x4f079f=function(_0x1d5dd1){while(--_0x1d5dd1){_0x1410d4['push'](_0x1410d4['shift']());}};_0x4f079f(++_0x14e7a7);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x528e4a,_0x3f355f){_0x528e4a=_0x528e4a-0x0;var _0x476825=_0xc1c6[_0x528e4a];return _0x476825;};'use strict';var multer=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var path=require(_0x6c1c('0x2'));var express=require('express');var router=express[_0x6c1c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6c1c('0x4'));var config=require(_0x6c1c('0x5'));var controller=require(_0x6c1c('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x6c1c('0x7')]);router['get'](_0x6c1c('0x8'),auth['isAuthenticated'](),controller[_0x6c1c('0x9')]);router[_0x6c1c('0xa')]('/',auth[_0x6c1c('0xb')](),controller[_0x6c1c('0xc')]);router['put'](_0x6c1c('0x8'),auth[_0x6c1c('0xb')](),controller['update']);router[_0x6c1c('0xd')](_0x6c1c('0x8'),auth[_0x6c1c('0xb')](),controller[_0x6c1c('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 804a3f9..272277a 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 _0x34f6=['ENUM','out','sequelize','DATE','STRING'];(function(_0x5c731c,_0x25b6ca){var _0x94da03=function(_0x597922){while(--_0x597922){_0x5c731c['push'](_0x5c731c['shift']());}};_0x94da03(++_0x25b6ca);}(_0x34f6,0x8e));var _0x634f=function(_0x236f13,_0x52bc53){_0x236f13=_0x236f13-0x0;var _0xf98878=_0x34f6[_0x236f13];return _0xf98878;};'use strict';var Sequelize=require(_0x634f('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x634f('0x1')]},'disposition':{'type':Sequelize[_0x634f('0x2')]},'note':{'type':Sequelize[_0x634f('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x634f('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x634f('0x3')]('in',_0x634f('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x634f('0x3')]('in',_0x634f('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xfd20=['exports','DATE','STRING','ENUM','out'];(function(_0x11c032,_0x4ca503){var _0x55919f=function(_0x97e42c){while(--_0x97e42c){_0x11c032['push'](_0x11c032['shift']());}};_0x55919f(++_0x4ca503);}(_0xfd20,0x154));var _0x0fd2=function(_0x4e0403,_0x23bb0a){_0x4e0403=_0x4e0403-0x0;var _0xb4ab4f=_0xfd20[_0x4e0403];return _0xb4ab4f;};'use strict';var Sequelize=require('sequelize');module[_0x0fd2('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0fd2('0x1')]},'disposition':{'type':Sequelize[_0x0fd2('0x2')]},'note':{'type':Sequelize[_0x0fd2('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x0fd2('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x0fd2('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0fd2('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x0fd2('0x3')]('in',_0x0fd2('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 9765813..8ccce78 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 _0xfb2a=['find','body','describe','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','FaxInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','addTags','spread','color','faxInteractionTags:save','removeTags','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./faxInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','error','stack','name','send','FaxInteraction','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','sort','where','pick','add','day','filter','merge','map','include','tag','push','Tag','Tags','distinct','read','createdAt','User','Users','fullname','Contact','internal','FaxAccount','Account','FaxMessage','Messages','direction','ThroughTags','findAll','rows','catch','params','options'];(function(_0x9c55b9,_0x5eba12){var _0xa590b5=function(_0x340e52){while(--_0x340e52){_0x9c55b9['push'](_0x9c55b9['shift']());}};_0xa590b5(++_0x5eba12);}(_0xfb2a,0x7b));var _0xafb2=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xfb2a[_0x3e5086];return _0xfeb102;};'use strict';var jsonpatch=require(_0xafb2('0x0'));var rp=require(_0xafb2('0x1'));var moment=require(_0xafb2('0x2'));var BPromise=require(_0xafb2('0x3'));var Mustache=require(_0xafb2('0x4'));var util=require(_0xafb2('0x5'));var path=require(_0xafb2('0x6'));var sox=require('sox');var csv=require(_0xafb2('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xafb2('0x8'));var squel=require(_0xafb2('0x9'));var crypto=require(_0xafb2('0xa'));var jsforce=require(_0xafb2('0xb'));var deskjs=require(_0xafb2('0xc'));var toCsv=require(_0xafb2('0x7'));var querystring=require(_0xafb2('0xd'));var Papa=require(_0xafb2('0xe'));var qs=require(_0xafb2('0xf'));var logger=require(_0xafb2('0x10'))(_0xafb2('0x11'));var utils=require('../../config/utils');var config=require(_0xafb2('0x12'));var db=require(_0xafb2('0x13'))['db'];var socket=require(_0xafb2('0x14'))({'host':_0xafb2('0x15'),'port':0x18eb});require(_0xafb2('0x16'))[_0xafb2('0x17')](socket);function respondWithStatusCode(_0x438139,_0x8bb3bb){_0x8bb3bb=_0x8bb3bb||0xcc;return function(_0x55cf81){if(_0x55cf81){return _0x438139[_0xafb2('0x18')](_0x8bb3bb);}return _0x438139[_0xafb2('0x19')](_0x8bb3bb)[_0xafb2('0x1a')]();};}function respondWithResult(_0x3e6d43,_0xc7a558){_0xc7a558=_0xc7a558||0xc8;return function(_0x7e733a){if(_0x7e733a){return _0x3e6d43['status'](_0xc7a558)[_0xafb2('0x1b')](_0x7e733a);}};}function respondWithFilteredResult(_0x1c7720,_0x185335){return function(_0x292411){if(_0x292411){var _0x5b4204=_0x292411[_0xafb2('0x1c')],_0x3a88b2=_0x185335['offset'],_0x381c51=_0x185335[_0xafb2('0x1d')]+_0x185335[_0xafb2('0x1e')],_0x1bae99;if(_0x381c51>=_0x5b4204){_0x381c51=_0x5b4204;_0x1bae99=0xc8;}else{_0x1bae99=0xce;}_0x1c7720[_0xafb2('0x19')](_0x1bae99);return _0x1c7720[_0xafb2('0x1f')]('Content-Range',_0x3a88b2+'-'+_0x381c51+'/'+_0x5b4204)[_0xafb2('0x1b')](_0x292411);}return null;};}function patchUpdates(_0x2ed4ca){return function(_0x3a1fd0){try{jsonpatch[_0xafb2('0x20')](_0x3a1fd0,_0x2ed4ca,!![]);}catch(_0xe08efc){return BPromise['reject'](_0xe08efc);}return _0x3a1fd0[_0xafb2('0x21')]();};}function saveUpdates(_0x1dabd9,_0x558f2c){return function(_0x13d2fe){if(_0x13d2fe){return _0x13d2fe[_0xafb2('0x22')](_0x1dabd9)[_0xafb2('0x23')](function(_0xdbff19){return _0xdbff19;});}return null;};}function removeEntity(_0x33cbb4,_0xc65584){return function(_0x5b419a){if(_0x5b419a){return _0x5b419a[_0xafb2('0x24')]()['then'](function(){_0x33cbb4[_0xafb2('0x19')](0xcc)[_0xafb2('0x1a')]();});}};}function handleEntityNotFound(_0x3c414a,_0x5302c1){return function(_0x473bd7){if(!_0x473bd7){_0x3c414a[_0xafb2('0x18')](0x194);}return _0x473bd7;};}function handleError(_0x3fc513,_0x108a2c){_0x108a2c=_0x108a2c||0x1f4;return function(_0x217e4d){logger[_0xafb2('0x25')](_0x217e4d[_0xafb2('0x26')]);if(_0x217e4d['name']){delete _0x217e4d[_0xafb2('0x27')];}_0x3fc513[_0xafb2('0x19')](_0x108a2c)[_0xafb2('0x28')](_0x217e4d);};}exports['index']=function(_0x3c6e99,_0x30a516){var _0x2ef65b={},_0x44fddf={},_0x28830e={'count':0x0,'rows':[]};var _0x2662c2=db[_0xafb2('0x29')][_0xafb2('0x2a')];_0x44fddf[_0xafb2('0x2b')]=_['keys'](_0x2662c2);var _0x8ca979={'dateStart':_0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x2d')],'dateEnd':_0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x2e')]};delete _0x3c6e99['query'][_0xafb2('0x2d')];delete _0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x2e')];_0x44fddf[_0xafb2('0x2c')]=_[_0xafb2('0x2f')](_0x3c6e99[_0xafb2('0x2c')]);_0x44fddf[_0xafb2('0x30')]=_[_0xafb2('0x31')](_0x44fddf[_0xafb2('0x2b')],_0x44fddf['query']);_0x2ef65b[_0xafb2('0x32')]=_['intersection'](_0x44fddf[_0xafb2('0x2b')],qs[_0xafb2('0x33')](_0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x33')]));_0x2ef65b[_0xafb2('0x32')]=_0x2ef65b[_0xafb2('0x32')][_0xafb2('0x34')]?_0x2ef65b['attributes']:_0x44fddf[_0xafb2('0x2b')];if(!_0x3c6e99[_0xafb2('0x2c')]['hasOwnProperty']('nolimit')){_0x2ef65b[_0xafb2('0x1e')]=qs['limit'](_0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x1e')]);_0x2ef65b[_0xafb2('0x1d')]=qs[_0xafb2('0x1d')](_0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x1d')]);}_0x2ef65b['order']=qs['sort'](_0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x35')]);_0x2ef65b[_0xafb2('0x36')]=qs['filters'](_[_0xafb2('0x37')](_0x3c6e99[_0xafb2('0x2c')],_0x44fddf[_0xafb2('0x30')]));if(_0x8ca979['dateStart']){if(_0x8ca979[_0xafb2('0x2e')]){_0x8ca979[_0xafb2('0x2e')]=moment(_0x8ca979[_0xafb2('0x2e')])[_0xafb2('0x38')](0x1,_0xafb2('0x39'));}else{_0x8ca979[_0xafb2('0x2e')]=moment(_0x8ca979[_0xafb2('0x2d')])['add'](0x1,_0xafb2('0x39'));}_['merge'](_0x2ef65b[_0xafb2('0x36')],{'createdAt':{'$gte':_0x8ca979[_0xafb2('0x2d')],'$lte':_0x8ca979[_0xafb2('0x2e')]}});}if(_0x3c6e99['query'][_0xafb2('0x3a')]){_0x2ef65b[_0xafb2('0x36')]=_[_0xafb2('0x3b')](_0x2ef65b[_0xafb2('0x36')],{'$or':_[_0xafb2('0x3c')](_0x2ef65b['attributes'],function(_0x2f9e01){var _0x196975={};_0x196975[_0x2f9e01]={'$like':'%'+_0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x3a')]+'%'};return _0x196975;})});}_0x2ef65b=_[_0xafb2('0x3b')]({},_0x2ef65b,_0x3c6e99['options']);var _0x1c7f10={'where':_0x2ef65b[_0xafb2('0x36')]};_0x1c7f10[_0xafb2('0x3d')]=[];if(_0x3c6e99['query'][_0xafb2('0x3e')]){_0x1c7f10[_0xafb2('0x3d')][_0xafb2('0x3f')]({'model':db[_0xafb2('0x40')],'as':_0xafb2('0x41'),'attributes':['id'],'where':{'id':_0x3c6e99['query'][_0xafb2('0x3e')]},'required':!![]});_0x1c7f10[_0xafb2('0x42')]=!![];}if(_0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x43')]){_0x1c7f10[_0xafb2('0x3d')][_0xafb2('0x3f')]({'model':db['FaxMessage'],'as':'Messages','attributes':['id','direction',_0xafb2('0x44'),_0xafb2('0x43')],'where':{'direction':'in','read':_0x3c6e99['query'][_0xafb2('0x43')]||![]},'required':!![]});_0x1c7f10['distinct']=!![];}return db[_0xafb2('0x29')][_0xafb2('0x1c')](_0x1c7f10)[_0xafb2('0x23')](function(_0x4fc51f){_0x28830e['count']=_0x4fc51f;if(_0x3c6e99[_0xafb2('0x2c')]['includeAll']){_0x2ef65b[_0xafb2('0x3d')]=[{'model':db[_0xafb2('0x45')],'as':_0xafb2('0x46'),'required':![],'attributes':['id',_0xafb2('0x27'),_0xafb2('0x47')]},{'model':db['CmContact'],'as':_0xafb2('0x48'),'required':![]},{'model':db[_0xafb2('0x45')],'as':'Owner','attributes':['name','fullname',_0xafb2('0x49')],'required':![]},{'model':db[_0xafb2('0x4a')],'as':_0xafb2('0x4b'),'attributes':[_0xafb2('0x27'),'key'],'required':![]},{'model':db[_0xafb2('0x4c')],'as':_0xafb2('0x4d'),'attributes':['id',_0xafb2('0x4e'),_0xafb2('0x44'),_0xafb2('0x43')],'where':{'direction':'in','read':_0x3c6e99['query'][_0xafb2('0x43')]||![]},'required':_0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x43')]||![]},{'model':db['Tag'],'as':_0xafb2('0x41'),'attributes':['id',_0xafb2('0x27'),'color'],'required':_0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x3e')]?!![]:![]},{'model':db[_0xafb2('0x40')],'as':_0xafb2('0x4f'),'attributes':['id',_0xafb2('0x27'),'color'],'through':_0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x3e')]?{'attributes':[],'where':{'TagId':_0x3c6e99['query'][_0xafb2('0x3e')]||undefined}}:{},'required':_0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x3e')]?!![]:![]}];}return db['FaxInteraction'][_0xafb2('0x50')](_0x2ef65b);})[_0xafb2('0x23')](function(_0x3f339f){_0x28830e[_0xafb2('0x51')]=_0x3f339f;return _0x28830e;})[_0xafb2('0x23')](respondWithFilteredResult(_0x30a516,_0x2ef65b))[_0xafb2('0x52')](handleError(_0x30a516,null));};exports['show']=function(_0x34a742,_0x3d72ca){var _0x161e11={'raw':![],'where':{'id':_0x34a742[_0xafb2('0x53')]['id']}},_0x59a330={};_0x59a330[_0xafb2('0x2b')]=_[_0xafb2('0x2f')](db[_0xafb2('0x29')]['rawAttributes']);_0x59a330[_0xafb2('0x2c')]=_[_0xafb2('0x2f')](_0x34a742[_0xafb2('0x2c')]);_0x59a330[_0xafb2('0x30')]=_['intersection'](_0x59a330[_0xafb2('0x2b')],_0x59a330[_0xafb2('0x2c')]);_0x161e11[_0xafb2('0x32')]=_['intersection'](_0x59a330[_0xafb2('0x2b')],qs[_0xafb2('0x33')](_0x34a742[_0xafb2('0x2c')][_0xafb2('0x33')]));_0x161e11['attributes']=_0x161e11[_0xafb2('0x32')][_0xafb2('0x34')]?_0x161e11['attributes']:_0x59a330[_0xafb2('0x2b')];if(_0x34a742[_0xafb2('0x2c')]['includeAll']){_0x161e11[_0xafb2('0x3d')]=[{'all':!![]}];}_0x161e11=_['merge']({},_0x161e11,_0x34a742[_0xafb2('0x54')]);return db[_0xafb2('0x29')][_0xafb2('0x55')](_0x161e11)[_0xafb2('0x23')](handleEntityNotFound(_0x3d72ca,null))['then'](respondWithResult(_0x3d72ca,null))[_0xafb2('0x52')](handleError(_0x3d72ca,null));};exports['create']=function(_0x58dd94,_0x47240){return db[_0xafb2('0x29')]['create'](_0x58dd94[_0xafb2('0x56')],{})[_0xafb2('0x23')](respondWithResult(_0x47240,0xc9))['catch'](handleError(_0x47240,null));};exports['update']=function(_0x270a7d,_0x2b8c07){if(_0x270a7d[_0xafb2('0x56')]['id']){delete _0x270a7d['body']['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x270a7d['params']['id']}})['then'](handleEntityNotFound(_0x2b8c07,null))[_0xafb2('0x23')](saveUpdates(_0x270a7d[_0xafb2('0x56')],null))[_0xafb2('0x23')](respondWithResult(_0x2b8c07,null))[_0xafb2('0x52')](handleError(_0x2b8c07,null));};exports[_0xafb2('0x24')]=function(_0x39e2c1,_0x1de68e){return db[_0xafb2('0x29')][_0xafb2('0x55')]({'where':{'id':_0x39e2c1[_0xafb2('0x53')]['id']}})[_0xafb2('0x23')](handleEntityNotFound(_0x1de68e,null))[_0xafb2('0x23')](removeEntity(_0x1de68e,null))[_0xafb2('0x52')](handleError(_0x1de68e,null));};exports[_0xafb2('0x57')]=function(_0x27d8b7,_0x4ce0a6){return db[_0xafb2('0x29')][_0xafb2('0x57')]()['then'](respondWithResult(_0x4ce0a6,null))[_0xafb2('0x52')](handleError(_0x4ce0a6,null));};exports[_0xafb2('0x58')]=function(_0x1bdd17,_0x14e5f5,_0x9405fc){return db[_0xafb2('0x4c')][_0xafb2('0x55')]({'where':{'id':_0x1bdd17[_0xafb2('0x53')]['id']}})[_0xafb2('0x23')](handleEntityNotFound(_0x14e5f5,null))[_0xafb2('0x23')](function(_0x2c095a){if(_0x2c095a){return _0x2c095a[_0xafb2('0x58')](_0x1bdd17[_0xafb2('0x56')][_0xafb2('0x59')],_[_0xafb2('0x5a')](_0x1bdd17[_0xafb2('0x56')],[_0xafb2('0x59'),'id'])||{});}})['then'](respondWithResult(_0x14e5f5,null))[_0xafb2('0x52')](handleError(_0x14e5f5,null));};exports[_0xafb2('0x5b')]=function(_0x2f28ee,_0x40e829,_0x177500){var _0x23ef35={'raw':![],'where':{}};var _0x448fdc={};var _0x350f4a={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xafb2('0x5c')]({'where':{'id':_0x2f28ee[_0xafb2('0x53')]['id']}})['then'](handleEntityNotFound(_0x40e829,null))[_0xafb2('0x23')](function(_0x1dc709){if(_0x1dc709){_0x448fdc[_0xafb2('0x2b')]=_[_0xafb2('0x2f')](db[_0xafb2('0x4c')]['rawAttributes']);_0x448fdc[_0xafb2('0x2c')]=_['keys'](_0x2f28ee[_0xafb2('0x2c')]);_0x448fdc[_0xafb2('0x30')]=_[_0xafb2('0x31')](_0x448fdc[_0xafb2('0x2b')],_0x448fdc[_0xafb2('0x2c')]);_0x23ef35[_0xafb2('0x32')]=_[_0xafb2('0x31')](_0x448fdc[_0xafb2('0x2b')],qs['fields'](_0x2f28ee[_0xafb2('0x2c')][_0xafb2('0x33')]));_0x23ef35[_0xafb2('0x32')]=_0x23ef35[_0xafb2('0x32')][_0xafb2('0x34')]?_0x23ef35['attributes']:_0x448fdc[_0xafb2('0x2b')];if(!_0x2f28ee['query'][_0xafb2('0x5d')](_0xafb2('0x5e'))){_0x23ef35[_0xafb2('0x1e')]=qs[_0xafb2('0x1e')](_0x2f28ee[_0xafb2('0x2c')][_0xafb2('0x1e')]);_0x23ef35[_0xafb2('0x1d')]=qs[_0xafb2('0x1d')](_0x2f28ee[_0xafb2('0x2c')][_0xafb2('0x1d')]);}_0x23ef35['order']=qs[_0xafb2('0x35')](_0x2f28ee[_0xafb2('0x2c')]['sort']);_0x23ef35['where']=qs['filters'](_[_0xafb2('0x37')](_0x2f28ee['query'],_0x448fdc['filters']));_0x23ef35['where'][_0xafb2('0x5f')]=_0x1dc709['id'];if(_0x2f28ee[_0xafb2('0x2c')][_0xafb2('0x3a')]){_0x23ef35[_0xafb2('0x36')]=_[_0xafb2('0x3b')](_0x23ef35['where'],{'$or':_[_0xafb2('0x3c')](_0x23ef35[_0xafb2('0x32')],function(_0x2f1d23){var _0x515686={};_0x515686[_0x2f1d23]={'$like':'%'+_0x2f28ee[_0xafb2('0x2c')][_0xafb2('0x3a')]+'%'};return _0x515686;})});}if(_0x2f28ee[_0xafb2('0x2c')][_0xafb2('0x60')]){var _0x159d72=_0x2f28ee['query'][_0xafb2('0x60')]['split'](',');var _0x16da0b={};_0x16da0b[_0x159d72[0x0]]={'$gte':moment(_0x159d72[0x1])[_0xafb2('0x61')](_0xafb2('0x62'))};_0x23ef35[_0xafb2('0x36')]=_[_0xafb2('0x3b')](_0x23ef35[_0xafb2('0x36')],_0x16da0b);}_0x23ef35=_[_0xafb2('0x3b')]({},_0x23ef35,_0x2f28ee[_0xafb2('0x54')]);return db[_0xafb2('0x4c')][_0xafb2('0x1c')]({'where':_0x23ef35[_0xafb2('0x36')]})['then'](function(_0x4bef4e){_0x350f4a[_0xafb2('0x1c')]=_0x4bef4e;if(_0x2f28ee[_0xafb2('0x2c')]['includeAll']){_0x23ef35[_0xafb2('0x3d')]=[{'all':!![]}];}return db[_0xafb2('0x4c')][_0xafb2('0x50')](_0x23ef35);})[_0xafb2('0x23')](function(_0xc0d07e){_0x350f4a[_0xafb2('0x51')]=_0xc0d07e;return _0x350f4a;});}})[_0xafb2('0x23')](respondWithFilteredResult(_0x40e829,_0x23ef35))[_0xafb2('0x52')](handleError(_0x40e829,null));};exports[_0xafb2('0x63')]=function(_0x316a6f,_0x38abcc,_0x32b9ff){return db['FaxInteraction'][_0xafb2('0x55')]({'where':{'id':_0x316a6f[_0xafb2('0x53')]['id']}})[_0xafb2('0x23')](handleEntityNotFound(_0x38abcc,null))[_0xafb2('0x23')](function(_0x4a8d31){if(_0x4a8d31){return _0x4a8d31['setTags'](_0x316a6f[_0xafb2('0x56')]['ids'],_[_0xafb2('0x5a')](_0x316a6f['body'],[_0xafb2('0x59'),'id'])||{})[_0xafb2('0x64')](function(){return db[_0xafb2('0x40')]['findAll']({'attributes':['id',_0xafb2('0x27'),_0xafb2('0x65')],'where':{'id':_0x316a6f[_0xafb2('0x56')][_0xafb2('0x59')]}});})['then'](function(_0x2535b1){socket['emit'](_0xafb2('0x66'),{'id':Number(_0x316a6f[_0xafb2('0x53')]['id']),'tags':_0x2535b1||[]});return{'id':Number(_0x316a6f[_0xafb2('0x53')]['id']),'tags':_0x2535b1||[]};});}})[_0xafb2('0x23')](respondWithResult(_0x38abcc,null))['catch'](handleError(_0x38abcc,null));};exports[_0xafb2('0x67')]=function(_0x255a62,_0x5790b2,_0x2f1fb4){var _0x2c2fd7;return db[_0xafb2('0x29')]['find']({'where':{'id':_0x255a62[_0xafb2('0x53')]['id']}})['then'](handleEntityNotFound(_0x5790b2,null))[_0xafb2('0x23')](function(_0x5b7752){if(_0x5b7752){return _0x5b7752[_0xafb2('0x67')](_0x255a62['query'][_0xafb2('0x59')]);}})[_0xafb2('0x23')](respondWithStatusCode(_0x5790b2,null))[_0xafb2('0x52')](handleError(_0x5790b2,null));}; \ No newline at end of file +var _0x8cad=['params','length','find','catch','create','body','describe','addMessage','ids','omit','getMessages','$gte','split','format','addTags','setTags','spread','removeTags','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','socket.io-emitter','./faxInteraction.socket','register','status','end','json','count','offset','limit','set','apply','update','then','destroy','sendStatus','error','name','index','FaxInteraction','rawAttributes','model','query','dateStart','dateEnd','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day','merge','filter','map','options','tag','push','Tag','Tags','distinct','read','include','FaxMessage','direction','createdAt','includeAll','User','fullname','Contact','internal','FaxAccount','Account','key','Messages','color','ThroughTags','findAll','rows','show'];(function(_0x2c7860,_0x32d9d0){var _0x16bdfc=function(_0x327c98){while(--_0x327c98){_0x2c7860['push'](_0x2c7860['shift']());}};_0x16bdfc(++_0x32d9d0);}(_0x8cad,0x19a));var _0xd8ca=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x8cad[_0x220f3f];return _0x1f170e;};'use strict';var jsonpatch=require(_0xd8ca('0x0'));var rp=require(_0xd8ca('0x1'));var moment=require(_0xd8ca('0x2'));var BPromise=require(_0xd8ca('0x3'));var Mustache=require(_0xd8ca('0x4'));var util=require(_0xd8ca('0x5'));var path=require('path');var sox=require(_0xd8ca('0x6'));var csv=require(_0xd8ca('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd8ca('0x8'));var squel=require(_0xd8ca('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd8ca('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0xd8ca('0xa'));var logger=require(_0xd8ca('0xb'))(_0xd8ca('0xc'));var utils=require(_0xd8ca('0xd'));var config=require(_0xd8ca('0xe'));var db=require('../../mysqldb')['db'];var socket=require(_0xd8ca('0xf'))({'host':'localhost','port':0x18eb});require(_0xd8ca('0x10'))[_0xd8ca('0x11')](socket);function respondWithStatusCode(_0x448f31,_0x3bc511){_0x3bc511=_0x3bc511||0xcc;return function(_0x204824){if(_0x204824){return _0x448f31['sendStatus'](_0x3bc511);}return _0x448f31[_0xd8ca('0x12')](_0x3bc511)[_0xd8ca('0x13')]();};}function respondWithResult(_0x231722,_0x4d060e){_0x4d060e=_0x4d060e||0xc8;return function(_0x1041ee){if(_0x1041ee){return _0x231722[_0xd8ca('0x12')](_0x4d060e)[_0xd8ca('0x14')](_0x1041ee);}};}function respondWithFilteredResult(_0x4f942c,_0x82a4ff){return function(_0x3eaeed){if(_0x3eaeed){var _0x579db3=_0x3eaeed[_0xd8ca('0x15')],_0x4cdb0b=_0x82a4ff[_0xd8ca('0x16')],_0x2920e2=_0x82a4ff[_0xd8ca('0x16')]+_0x82a4ff[_0xd8ca('0x17')],_0xc8b7bc;if(_0x2920e2>=_0x579db3){_0x2920e2=_0x579db3;_0xc8b7bc=0xc8;}else{_0xc8b7bc=0xce;}_0x4f942c[_0xd8ca('0x12')](_0xc8b7bc);return _0x4f942c[_0xd8ca('0x18')]('Content-Range',_0x4cdb0b+'-'+_0x2920e2+'/'+_0x579db3)[_0xd8ca('0x14')](_0x3eaeed);}return null;};}function patchUpdates(_0x4cfdc3){return function(_0x34d985){try{jsonpatch[_0xd8ca('0x19')](_0x34d985,_0x4cfdc3,!![]);}catch(_0x3a5c59){return BPromise['reject'](_0x3a5c59);}return _0x34d985['save']();};}function saveUpdates(_0xcbf394,_0x50878e){return function(_0x397dbf){if(_0x397dbf){return _0x397dbf[_0xd8ca('0x1a')](_0xcbf394)[_0xd8ca('0x1b')](function(_0x270470){return _0x270470;});}return null;};}function removeEntity(_0x35ad5c,_0x38657a){return function(_0x397493){if(_0x397493){return _0x397493[_0xd8ca('0x1c')]()['then'](function(){_0x35ad5c[_0xd8ca('0x12')](0xcc)[_0xd8ca('0x13')]();});}};}function handleEntityNotFound(_0x569e99,_0xef651d){return function(_0x3d34b1){if(!_0x3d34b1){_0x569e99[_0xd8ca('0x1d')](0x194);}return _0x3d34b1;};}function handleError(_0x5a02ac,_0x1081b0){_0x1081b0=_0x1081b0||0x1f4;return function(_0x5dc3fb){logger[_0xd8ca('0x1e')](_0x5dc3fb['stack']);if(_0x5dc3fb[_0xd8ca('0x1f')]){delete _0x5dc3fb[_0xd8ca('0x1f')];}_0x5a02ac[_0xd8ca('0x12')](_0x1081b0)['send'](_0x5dc3fb);};}exports[_0xd8ca('0x20')]=function(_0x21e57a,_0x5c7b9){var _0x779368={},_0x18f784={},_0x1ccbb7={'count':0x0,'rows':[]};var _0x1809ac=db[_0xd8ca('0x21')][_0xd8ca('0x22')];_0x18f784[_0xd8ca('0x23')]=_['keys'](_0x1809ac);var _0x561407={'dateStart':_0x21e57a[_0xd8ca('0x24')][_0xd8ca('0x25')],'dateEnd':_0x21e57a[_0xd8ca('0x24')][_0xd8ca('0x26')]};delete _0x21e57a[_0xd8ca('0x24')][_0xd8ca('0x25')];delete _0x21e57a[_0xd8ca('0x24')]['dateEnd'];_0x18f784[_0xd8ca('0x24')]=_[_0xd8ca('0x27')](_0x21e57a[_0xd8ca('0x24')]);_0x18f784['filters']=_[_0xd8ca('0x28')](_0x18f784[_0xd8ca('0x23')],_0x18f784[_0xd8ca('0x24')]);_0x779368[_0xd8ca('0x29')]=_[_0xd8ca('0x28')](_0x18f784[_0xd8ca('0x23')],qs[_0xd8ca('0x2a')](_0x21e57a['query'][_0xd8ca('0x2a')]));_0x779368[_0xd8ca('0x29')]=_0x779368[_0xd8ca('0x29')]['length']?_0x779368[_0xd8ca('0x29')]:_0x18f784[_0xd8ca('0x23')];if(!_0x21e57a['query'][_0xd8ca('0x2b')](_0xd8ca('0x2c'))){_0x779368['limit']=qs[_0xd8ca('0x17')](_0x21e57a[_0xd8ca('0x24')][_0xd8ca('0x17')]);_0x779368[_0xd8ca('0x16')]=qs[_0xd8ca('0x16')](_0x21e57a['query'][_0xd8ca('0x16')]);}_0x779368[_0xd8ca('0x2d')]=qs['sort'](_0x21e57a[_0xd8ca('0x24')][_0xd8ca('0x2e')]);_0x779368[_0xd8ca('0x2f')]=qs[_0xd8ca('0x30')](_[_0xd8ca('0x31')](_0x21e57a['query'],_0x18f784[_0xd8ca('0x30')]));if(_0x561407[_0xd8ca('0x25')]){if(_0x561407[_0xd8ca('0x26')]){_0x561407[_0xd8ca('0x26')]=moment(_0x561407['dateEnd'])[_0xd8ca('0x32')](0x1,_0xd8ca('0x33'));}else{_0x561407[_0xd8ca('0x26')]=moment(_0x561407['dateStart'])[_0xd8ca('0x32')](0x1,'day');}_[_0xd8ca('0x34')](_0x779368[_0xd8ca('0x2f')],{'createdAt':{'$gte':_0x561407[_0xd8ca('0x25')],'$lte':_0x561407[_0xd8ca('0x26')]}});}if(_0x21e57a[_0xd8ca('0x24')][_0xd8ca('0x35')]){_0x779368['where']=_[_0xd8ca('0x34')](_0x779368['where'],{'$or':_[_0xd8ca('0x36')](_0x779368[_0xd8ca('0x29')],function(_0x2ea09f){var _0x114df4={};_0x114df4[_0x2ea09f]={'$like':'%'+_0x21e57a[_0xd8ca('0x24')][_0xd8ca('0x35')]+'%'};return _0x114df4;})});}_0x779368=_[_0xd8ca('0x34')]({},_0x779368,_0x21e57a[_0xd8ca('0x37')]);var _0xb765f5={'where':_0x779368[_0xd8ca('0x2f')]};_0xb765f5['include']=[];if(_0x21e57a[_0xd8ca('0x24')][_0xd8ca('0x38')]){_0xb765f5['include'][_0xd8ca('0x39')]({'model':db[_0xd8ca('0x3a')],'as':_0xd8ca('0x3b'),'attributes':['id'],'where':{'id':_0x21e57a[_0xd8ca('0x24')][_0xd8ca('0x38')]},'required':!![]});_0xb765f5[_0xd8ca('0x3c')]=!![];}if(_0x21e57a[_0xd8ca('0x24')][_0xd8ca('0x3d')]){_0xb765f5[_0xd8ca('0x3e')]['push']({'model':db[_0xd8ca('0x3f')],'as':'Messages','attributes':['id',_0xd8ca('0x40'),_0xd8ca('0x41'),_0xd8ca('0x3d')],'where':{'direction':'in','read':_0x21e57a[_0xd8ca('0x24')][_0xd8ca('0x3d')]||![]},'required':!![]});_0xb765f5[_0xd8ca('0x3c')]=!![];}return db[_0xd8ca('0x21')][_0xd8ca('0x15')](_0xb765f5)[_0xd8ca('0x1b')](function(_0x211304){_0x1ccbb7[_0xd8ca('0x15')]=_0x211304;if(_0x21e57a['query'][_0xd8ca('0x42')]){_0x779368[_0xd8ca('0x3e')]=[{'model':db[_0xd8ca('0x43')],'as':'Users','required':![],'attributes':['id',_0xd8ca('0x1f'),_0xd8ca('0x44')]},{'model':db['CmContact'],'as':_0xd8ca('0x45'),'required':![]},{'model':db[_0xd8ca('0x43')],'as':'Owner','attributes':['name','fullname',_0xd8ca('0x46')],'required':![]},{'model':db[_0xd8ca('0x47')],'as':_0xd8ca('0x48'),'attributes':[_0xd8ca('0x1f'),_0xd8ca('0x49')],'required':![]},{'model':db[_0xd8ca('0x3f')],'as':_0xd8ca('0x4a'),'attributes':['id',_0xd8ca('0x40'),'createdAt','read'],'where':{'direction':'in','read':_0x21e57a[_0xd8ca('0x24')][_0xd8ca('0x3d')]||![]},'required':_0x21e57a[_0xd8ca('0x24')]['read']||![]},{'model':db[_0xd8ca('0x3a')],'as':'Tags','attributes':['id',_0xd8ca('0x1f'),_0xd8ca('0x4b')],'required':_0x21e57a[_0xd8ca('0x24')][_0xd8ca('0x38')]?!![]:![]},{'model':db[_0xd8ca('0x3a')],'as':_0xd8ca('0x4c'),'attributes':['id',_0xd8ca('0x1f'),_0xd8ca('0x4b')],'through':_0x21e57a['query'][_0xd8ca('0x38')]?{'attributes':[],'where':{'TagId':_0x21e57a[_0xd8ca('0x24')][_0xd8ca('0x38')]||undefined}}:{},'required':_0x21e57a['query']['tag']?!![]:![]}];}return db['FaxInteraction'][_0xd8ca('0x4d')](_0x779368);})[_0xd8ca('0x1b')](function(_0x3bcfee){_0x1ccbb7[_0xd8ca('0x4e')]=_0x3bcfee;return _0x1ccbb7;})[_0xd8ca('0x1b')](respondWithFilteredResult(_0x5c7b9,_0x779368))['catch'](handleError(_0x5c7b9,null));};exports[_0xd8ca('0x4f')]=function(_0x179370,_0x43fdf5){var _0x535a60={'raw':![],'where':{'id':_0x179370[_0xd8ca('0x50')]['id']}},_0xe6de03={};_0xe6de03[_0xd8ca('0x23')]=_[_0xd8ca('0x27')](db[_0xd8ca('0x21')]['rawAttributes']);_0xe6de03[_0xd8ca('0x24')]=_[_0xd8ca('0x27')](_0x179370[_0xd8ca('0x24')]);_0xe6de03[_0xd8ca('0x30')]=_[_0xd8ca('0x28')](_0xe6de03['model'],_0xe6de03[_0xd8ca('0x24')]);_0x535a60[_0xd8ca('0x29')]=_[_0xd8ca('0x28')](_0xe6de03['model'],qs[_0xd8ca('0x2a')](_0x179370['query'][_0xd8ca('0x2a')]));_0x535a60['attributes']=_0x535a60['attributes'][_0xd8ca('0x51')]?_0x535a60['attributes']:_0xe6de03[_0xd8ca('0x23')];if(_0x179370['query'][_0xd8ca('0x42')]){_0x535a60[_0xd8ca('0x3e')]=[{'all':!![]}];}_0x535a60=_[_0xd8ca('0x34')]({},_0x535a60,_0x179370[_0xd8ca('0x37')]);return db[_0xd8ca('0x21')][_0xd8ca('0x52')](_0x535a60)[_0xd8ca('0x1b')](handleEntityNotFound(_0x43fdf5,null))[_0xd8ca('0x1b')](respondWithResult(_0x43fdf5,null))[_0xd8ca('0x53')](handleError(_0x43fdf5,null));};exports[_0xd8ca('0x54')]=function(_0x309d4b,_0x59e843){return db[_0xd8ca('0x21')][_0xd8ca('0x54')](_0x309d4b['body'],{})[_0xd8ca('0x1b')](respondWithResult(_0x59e843,0xc9))[_0xd8ca('0x53')](handleError(_0x59e843,null));};exports['update']=function(_0x21a5a1,_0x1ce62d){if(_0x21a5a1[_0xd8ca('0x55')]['id']){delete _0x21a5a1[_0xd8ca('0x55')]['id'];}return db[_0xd8ca('0x21')]['find']({'where':{'id':_0x21a5a1[_0xd8ca('0x50')]['id']}})[_0xd8ca('0x1b')](handleEntityNotFound(_0x1ce62d,null))[_0xd8ca('0x1b')](saveUpdates(_0x21a5a1[_0xd8ca('0x55')],null))[_0xd8ca('0x1b')](respondWithResult(_0x1ce62d,null))[_0xd8ca('0x53')](handleError(_0x1ce62d,null));};exports[_0xd8ca('0x1c')]=function(_0x1f5474,_0x1327e1){return db[_0xd8ca('0x21')][_0xd8ca('0x52')]({'where':{'id':_0x1f5474[_0xd8ca('0x50')]['id']}})[_0xd8ca('0x1b')](handleEntityNotFound(_0x1327e1,null))[_0xd8ca('0x1b')](removeEntity(_0x1327e1,null))[_0xd8ca('0x53')](handleError(_0x1327e1,null));};exports[_0xd8ca('0x56')]=function(_0x49fff2,_0x2e09db){return db[_0xd8ca('0x21')][_0xd8ca('0x56')]()[_0xd8ca('0x1b')](respondWithResult(_0x2e09db,null))['catch'](handleError(_0x2e09db,null));};exports[_0xd8ca('0x57')]=function(_0x631240,_0x46db85,_0x4f6ffe){return db[_0xd8ca('0x3f')][_0xd8ca('0x52')]({'where':{'id':_0x631240[_0xd8ca('0x50')]['id']}})[_0xd8ca('0x1b')](handleEntityNotFound(_0x46db85,null))[_0xd8ca('0x1b')](function(_0x2de759){if(_0x2de759){return _0x2de759[_0xd8ca('0x57')](_0x631240[_0xd8ca('0x55')][_0xd8ca('0x58')],_[_0xd8ca('0x59')](_0x631240[_0xd8ca('0x55')],[_0xd8ca('0x58'),'id'])||{});}})[_0xd8ca('0x1b')](respondWithResult(_0x46db85,null))[_0xd8ca('0x53')](handleError(_0x46db85,null));};exports[_0xd8ca('0x5a')]=function(_0x5841f8,_0x14fbfb,_0x3f3993){var _0x33ad47={'raw':![],'where':{}};var _0x4f3b6f={};var _0x566e43={'count':0x0,'rows':[]};return db[_0xd8ca('0x21')]['findOne']({'where':{'id':_0x5841f8[_0xd8ca('0x50')]['id']}})['then'](handleEntityNotFound(_0x14fbfb,null))[_0xd8ca('0x1b')](function(_0x4e656c){if(_0x4e656c){_0x4f3b6f[_0xd8ca('0x23')]=_[_0xd8ca('0x27')](db['FaxMessage']['rawAttributes']);_0x4f3b6f[_0xd8ca('0x24')]=_['keys'](_0x5841f8[_0xd8ca('0x24')]);_0x4f3b6f[_0xd8ca('0x30')]=_[_0xd8ca('0x28')](_0x4f3b6f['model'],_0x4f3b6f['query']);_0x33ad47[_0xd8ca('0x29')]=_[_0xd8ca('0x28')](_0x4f3b6f[_0xd8ca('0x23')],qs[_0xd8ca('0x2a')](_0x5841f8['query'][_0xd8ca('0x2a')]));_0x33ad47[_0xd8ca('0x29')]=_0x33ad47[_0xd8ca('0x29')][_0xd8ca('0x51')]?_0x33ad47['attributes']:_0x4f3b6f[_0xd8ca('0x23')];if(!_0x5841f8[_0xd8ca('0x24')]['hasOwnProperty'](_0xd8ca('0x2c'))){_0x33ad47[_0xd8ca('0x17')]=qs['limit'](_0x5841f8[_0xd8ca('0x24')][_0xd8ca('0x17')]);_0x33ad47['offset']=qs['offset'](_0x5841f8[_0xd8ca('0x24')][_0xd8ca('0x16')]);}_0x33ad47[_0xd8ca('0x2d')]=qs[_0xd8ca('0x2e')](_0x5841f8[_0xd8ca('0x24')]['sort']);_0x33ad47[_0xd8ca('0x2f')]=qs[_0xd8ca('0x30')](_[_0xd8ca('0x31')](_0x5841f8[_0xd8ca('0x24')],_0x4f3b6f[_0xd8ca('0x30')]));_0x33ad47[_0xd8ca('0x2f')]['FaxInteractionId']=_0x4e656c['id'];if(_0x5841f8[_0xd8ca('0x24')][_0xd8ca('0x35')]){_0x33ad47[_0xd8ca('0x2f')]=_[_0xd8ca('0x34')](_0x33ad47[_0xd8ca('0x2f')],{'$or':_[_0xd8ca('0x36')](_0x33ad47[_0xd8ca('0x29')],function(_0x25beb3){var _0xdf21fb={};_0xdf21fb[_0x25beb3]={'$like':'%'+_0x5841f8[_0xd8ca('0x24')]['filter']+'%'};return _0xdf21fb;})});}if(_0x5841f8[_0xd8ca('0x24')][_0xd8ca('0x5b')]){var _0x590316=_0x5841f8[_0xd8ca('0x24')][_0xd8ca('0x5b')][_0xd8ca('0x5c')](',');var _0x165dcb={};_0x165dcb[_0x590316[0x0]]={'$gte':moment(_0x590316[0x1])[_0xd8ca('0x5d')]('YYYY-MM-DD\x20HH:mm:ss')};_0x33ad47['where']=_[_0xd8ca('0x34')](_0x33ad47['where'],_0x165dcb);}_0x33ad47=_[_0xd8ca('0x34')]({},_0x33ad47,_0x5841f8[_0xd8ca('0x37')]);return db['FaxMessage'][_0xd8ca('0x15')]({'where':_0x33ad47['where']})['then'](function(_0x1c8f35){_0x566e43[_0xd8ca('0x15')]=_0x1c8f35;if(_0x5841f8[_0xd8ca('0x24')][_0xd8ca('0x42')]){_0x33ad47[_0xd8ca('0x3e')]=[{'all':!![]}];}return db[_0xd8ca('0x3f')][_0xd8ca('0x4d')](_0x33ad47);})[_0xd8ca('0x1b')](function(_0x1e018d){_0x566e43[_0xd8ca('0x4e')]=_0x1e018d;return _0x566e43;});}})['then'](respondWithFilteredResult(_0x14fbfb,_0x33ad47))[_0xd8ca('0x53')](handleError(_0x14fbfb,null));};exports[_0xd8ca('0x5e')]=function(_0x707ea6,_0x468d64,_0x25b3df){return db[_0xd8ca('0x21')][_0xd8ca('0x52')]({'where':{'id':_0x707ea6['params']['id']}})[_0xd8ca('0x1b')](handleEntityNotFound(_0x468d64,null))['then'](function(_0x457a13){if(_0x457a13){return _0x457a13[_0xd8ca('0x5f')](_0x707ea6[_0xd8ca('0x55')][_0xd8ca('0x58')],_[_0xd8ca('0x59')](_0x707ea6['body'],[_0xd8ca('0x58'),'id'])||{})[_0xd8ca('0x60')](function(){return db['Tag'][_0xd8ca('0x4d')]({'attributes':['id','name',_0xd8ca('0x4b')],'where':{'id':_0x707ea6[_0xd8ca('0x55')]['ids']}});})['then'](function(_0x12196e){socket['emit']('faxInteractionTags:save',{'id':Number(_0x707ea6[_0xd8ca('0x50')]['id']),'tags':_0x12196e||[]});return{'id':Number(_0x707ea6['params']['id']),'tags':_0x12196e||[]};});}})[_0xd8ca('0x1b')](respondWithResult(_0x468d64,null))['catch'](handleError(_0x468d64,null));};exports[_0xd8ca('0x61')]=function(_0x5279e5,_0x31513b,_0x35a74a){var _0x434a95;return db[_0xd8ca('0x21')][_0xd8ca('0x52')]({'where':{'id':_0x5279e5[_0xd8ca('0x50')]['id']}})['then'](handleEntityNotFound(_0x31513b,null))['then'](function(_0xa620a){if(_0xa620a){return _0xa620a['removeTags'](_0x5279e5[_0xd8ca('0x24')][_0xd8ca('0x58')]);}})['then'](respondWithStatusCode(_0x31513b,null))[_0xd8ca('0x53')](handleError(_0x31513b,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 25a5ec5..2c175a0 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 _0xbdb7=['save','update','remove','hasOwnProperty','hook','events','../../mysqldb','FaxInteraction','setMaxListeners'];(function(_0x3e3c9c,_0x5d9adb){var _0x49d7ff=function(_0x1fd768){while(--_0x1fd768){_0x3e3c9c['push'](_0x3e3c9c['shift']());}};_0x49d7ff(++_0x5d9adb);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1da289,_0x417651){_0x1da289=_0x1da289-0x0;var _0x41c889=_0xbdb7[_0x1da289];return _0x41c889;};'use strict';var EventEmitter=require(_0x7bdb('0x0'));var FaxInteraction=require(_0x7bdb('0x1'))['db'][_0x7bdb('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x7bdb('0x3')](0x0);var events={'afterCreate':_0x7bdb('0x4'),'afterUpdate':_0x7bdb('0x5'),'afterDestroy':_0x7bdb('0x6')};function emitEvent(_0x2c7e07){return function(_0x46c068,_0x47aec5,_0x28542c){FaxInteractionEvents['emit'](_0x2c7e07+':'+_0x46c068['id'],_0x46c068);FaxInteractionEvents['emit'](_0x2c7e07,_0x46c068);_0x28542c(null);};}for(var e in events){if(events[_0x7bdb('0x7')](e)){var event=events[e];FaxInteraction[_0x7bdb('0x8')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0xeb74=['emit','hook','events','../../mysqldb','FaxInteraction','setMaxListeners','save','update','remove'];(function(_0x35344a,_0x1790b6){var _0x285085=function(_0x30a6ca){while(--_0x30a6ca){_0x35344a['push'](_0x35344a['shift']());}};_0x285085(++_0x1790b6);}(_0xeb74,0xe3));var _0x4eb7=function(_0x1406d9,_0x3f6591){_0x1406d9=_0x1406d9-0x0;var _0x410afb=_0xeb74[_0x1406d9];return _0x410afb;};'use strict';var EventEmitter=require(_0x4eb7('0x0'));var FaxInteraction=require(_0x4eb7('0x1'))['db'][_0x4eb7('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x4eb7('0x3')](0x0);var events={'afterCreate':_0x4eb7('0x4'),'afterUpdate':_0x4eb7('0x5'),'afterDestroy':_0x4eb7('0x6')};function emitEvent(_0x568531){return function(_0x35c7ca,_0x1dc8d0,_0x29b666){FaxInteractionEvents[_0x4eb7('0x7')](_0x568531+':'+_0x35c7ca['id'],_0x35c7ca);FaxInteractionEvents[_0x4eb7('0x7')](_0x568531,_0x35c7ca);_0x29b666(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x4eb7('0x8')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 83fb016..6d669f8 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 _0x67e7=['request-promise','./faxInteraction.attributes','exports','define','FaxInteraction','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x565b65,_0x2134b0){var _0x2b9d8a=function(_0x1e50d1){while(--_0x1e50d1){_0x565b65['push'](_0x565b65['shift']());}};_0x2b9d8a(++_0x2134b0);}(_0x67e7,0x1a7));var _0x767e=function(_0x65968f,_0x5d0325){_0x65968f=_0x65968f-0x0;var _0x4f192f=_0x67e7[_0x65968f];return _0x4f192f;};'use strict';var _=require(_0x767e('0x0'));var util=require(_0x767e('0x1'));var logger=require(_0x767e('0x2'))(_0x767e('0x3'));var moment=require(_0x767e('0x4'));var BPromise=require(_0x767e('0x5'));var rp=require(_0x767e('0x6'));var attributes=require(_0x767e('0x7'));module[_0x767e('0x8')]=function(_0x5251e5,_0x194e50){return _0x5251e5[_0x767e('0x9')](_0x767e('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc045=['./faxInteraction.attributes','FaxInteraction','fax_interactions','lodash','../../config/logger','api','moment','request-promise'];(function(_0x153fc7,_0x378a3c){var _0x4a005e=function(_0x482222){while(--_0x482222){_0x153fc7['push'](_0x153fc7['shift']());}};_0x4a005e(++_0x378a3c);}(_0xc045,0x12b));var _0x5c04=function(_0x45e064,_0x411c6a){_0x45e064=_0x45e064-0x0;var _0x1c1ee4=_0xc045[_0x45e064];return _0x1c1ee4;};'use strict';var _=require(_0x5c04('0x0'));var util=require('util');var logger=require(_0x5c04('0x1'))(_0x5c04('0x2'));var moment=require(_0x5c04('0x3'));var BPromise=require('bluebird');var rp=require(_0x5c04('0x4'));var attributes=require(_0x5c04('0x5'));module['exports']=function(_0x3f1ecd,_0x5debb7){return _0x3f1ecd['define'](_0x5c04('0x6'),attributes,{'tableName':_0x5c04('0x7'),'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 3313546..4dd831b 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 _0xbae6=['rpc','jayson/promise','client','http','socket.io-emitter','localhost','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','attributes','addTags','ids','omit','spread','AddTags','catch','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5a8a6f,_0x16e10d){var _0x4f0032=function(_0x2df12b){while(--_0x2df12b){_0x5a8a6f['push'](_0x5a8a6f['shift']());}};_0x4f0032(++_0x16e10d);}(_0xbae6,0xf8));var _0x6bae=function(_0x3340dc,_0x3a3c73){_0x3340dc=_0x3340dc-0x0;var _0x105594=_0xbae6[_0x3340dc];return _0x105594;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6bae('0x0'));var fs=require('fs');var db=require(_0x6bae('0x1'))['db'];var utils=require(_0x6bae('0x2'));var logger=require(_0x6bae('0x3'))(_0x6bae('0x4'));var config=require('../../config/environment');var jayson=require(_0x6bae('0x5'));var client=jayson[_0x6bae('0x6')][_0x6bae('0x7')]({'port':0x232a});var socket=require(_0x6bae('0x8'))({'host':_0x6bae('0x9'),'port':0x18eb});require('./faxInteraction.socket')[_0x6bae('0xa')](socket);function respondWithRpcPromise(_0x5e798e,_0x333015,_0x297d46){return new BPromise(function(_0xa1d7a6,_0x100501){return client[_0x6bae('0xb')](_0x5e798e,_0x297d46)[_0x6bae('0xc')](function(_0x7355b6){logger[_0x6bae('0xd')](_0x6bae('0xe'),_0x333015,_0x6bae('0xf'));logger[_0x6bae('0x10')](_0x6bae('0x11'),_0x333015,_0x6bae('0xf'),JSON[_0x6bae('0x12')](_0x7355b6));if(_0x7355b6[_0x6bae('0x13')]){if(_0x7355b6[_0x6bae('0x13')][_0x6bae('0x14')]===0x1f4){logger[_0x6bae('0x13')](_0x6bae('0xe'),_0x333015,_0x7355b6[_0x6bae('0x13')][_0x6bae('0x15')]);return _0x100501(_0x7355b6[_0x6bae('0x13')][_0x6bae('0x15')]);}logger['error'](_0x6bae('0xe'),_0x333015,_0x7355b6['error']['message']);return _0xa1d7a6(_0x7355b6[_0x6bae('0x13')][_0x6bae('0x15')]);}else{logger[_0x6bae('0xd')](_0x6bae('0xe'),_0x333015,'request\x20sent');_0xa1d7a6(_0x7355b6[_0x6bae('0x16')]['message']);}})['catch'](function(_0x298e56){logger[_0x6bae('0x13')](_0x6bae('0xe'),_0x333015,_0x298e56);_0x100501(_0x298e56);});});}exports[_0x6bae('0x17')]=function(_0x474730){var _0x292bde=this;return new Promise(function(_0x5855eb,_0x4ef36b){return db[_0x6bae('0x18')]['update'](_0x474730[_0x6bae('0x19')],{'raw':_0x474730[_0x6bae('0x1a')]?_0x474730[_0x6bae('0x1a')][_0x6bae('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x474730[_0x6bae('0x1a')]?_0x474730['options'][_0x6bae('0x1c')]||null:null,'attributes':_0x474730[_0x6bae('0x1a')]?_0x474730['options'][_0x6bae('0x1d')]||null:null,'limit':_0x474730[_0x6bae('0x1a')]?_0x474730[_0x6bae('0x1a')]['limit']||null:null})['then'](function(_0x5703a1){logger[_0x6bae('0xd')](_0x6bae('0x17'),_0x474730);logger[_0x6bae('0x10')](_0x6bae('0x17'),_0x474730,JSON[_0x6bae('0x12')](_0x5703a1));_0x5855eb(_0x5703a1);})['catch'](function(_0x4a395c){logger[_0x6bae('0x13')](_0x6bae('0x17'),_0x4a395c[_0x6bae('0x15')],_0x474730);_0x4ef36b(_0x292bde['error'](0x1f4,_0x4a395c[_0x6bae('0x15')]));});});};exports['AddTagsToFaxInteraction']=function(_0x1bb0ca){return new Promise(function(_0x518988,_0x4fa1ca){return db[_0x6bae('0x18')]['find']({'where':_0x1bb0ca[_0x6bae('0x1a')]?_0x1bb0ca[_0x6bae('0x1a')][_0x6bae('0x1c')]||null:null})['then'](function(_0x56d0b4){if(_0x56d0b4){return _0x56d0b4[_0x6bae('0x1e')](_0x1bb0ca[_0x6bae('0x19')][_0x6bae('0x1f')],_[_0x6bae('0x20')](_0x1bb0ca[_0x6bae('0x19')],['ids','id'])||{});}})[_0x6bae('0x21')](function(_0x4593bb){logger[_0x6bae('0xd')]('AddTags',_0x1bb0ca);logger[_0x6bae('0x10')](_0x6bae('0x22'),_0x1bb0ca,JSON[_0x6bae('0x12')](_0x4593bb));_0x518988(_0x4593bb);})[_0x6bae('0x23')](function(_0xa9d806){logger[_0x6bae('0x13')](_0x6bae('0x22'),_0xa9d806[_0x6bae('0x15')],_0x1bb0ca);_0x4fa1ca(_this['error'](0x1f4,_0xa9d806[_0x6bae('0x15')]));});});}; \ No newline at end of file +var _0xa063=['body','options','raw','attributes','limit','stringify','catch','AddTagsToFaxInteraction','FaxInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','socket.io-emitter','./faxInteraction.socket','register','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','FaxInteraction,\x20%s,\x20%s','UpdateFaxInteraction'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xa063,0x158));var _0x3a06=function(_0x51da78,_0x2b4176){_0x51da78=_0x51da78-0x0;var _0x31e9b3=_0xa063[_0x51da78];return _0x31e9b3;};'use strict';var _=require(_0x3a06('0x0'));var util=require(_0x3a06('0x1'));var moment=require(_0x3a06('0x2'));var BPromise=require(_0x3a06('0x3'));var rs=require(_0x3a06('0x4'));var fs=require('fs');var db=require(_0x3a06('0x5'))['db'];var utils=require(_0x3a06('0x6'));var logger=require(_0x3a06('0x7'))(_0x3a06('0x8'));var config=require(_0x3a06('0x9'));var jayson=require(_0x3a06('0xa'));var client=jayson[_0x3a06('0xb')]['http']({'port':0x232a});var socket=require(_0x3a06('0xc'))({'host':'localhost','port':0x18eb});require(_0x3a06('0xd'))[_0x3a06('0xe')](socket);function respondWithRpcPromise(_0x4d3437,_0x5ad216,_0x1240e2){return new BPromise(function(_0x5afc5e,_0x3558a2){return client['request'](_0x4d3437,_0x1240e2)[_0x3a06('0xf')](function(_0x4f47d5){logger[_0x3a06('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x5ad216,_0x3a06('0x11'));logger[_0x3a06('0x12')](_0x3a06('0x13'),_0x5ad216,_0x3a06('0x11'),JSON['stringify'](_0x4f47d5));if(_0x4f47d5['error']){if(_0x4f47d5[_0x3a06('0x14')][_0x3a06('0x15')]===0x1f4){logger[_0x3a06('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x5ad216,_0x4f47d5['error'][_0x3a06('0x16')]);return _0x3558a2(_0x4f47d5[_0x3a06('0x14')][_0x3a06('0x16')]);}logger[_0x3a06('0x14')](_0x3a06('0x17'),_0x5ad216,_0x4f47d5[_0x3a06('0x14')]['message']);return _0x5afc5e(_0x4f47d5[_0x3a06('0x14')][_0x3a06('0x16')]);}else{logger[_0x3a06('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x5ad216,_0x3a06('0x11'));_0x5afc5e(_0x4f47d5['result'][_0x3a06('0x16')]);}})['catch'](function(_0x3d0686){logger[_0x3a06('0x14')](_0x3a06('0x17'),_0x5ad216,_0x3d0686);_0x3558a2(_0x3d0686);});});}exports[_0x3a06('0x18')]=function(_0x59246c){var _0x4ea4e6=this;return new Promise(function(_0x43571b,_0x363c56){return db['FaxInteraction']['update'](_0x59246c[_0x3a06('0x19')],{'raw':_0x59246c[_0x3a06('0x1a')]?_0x59246c[_0x3a06('0x1a')][_0x3a06('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59246c['options']?_0x59246c['options']['where']||null:null,'attributes':_0x59246c[_0x3a06('0x1a')]?_0x59246c[_0x3a06('0x1a')][_0x3a06('0x1c')]||null:null,'limit':_0x59246c[_0x3a06('0x1a')]?_0x59246c[_0x3a06('0x1a')][_0x3a06('0x1d')]||null:null})['then'](function(_0x1a0e77){logger[_0x3a06('0x10')](_0x3a06('0x18'),_0x59246c);logger[_0x3a06('0x12')](_0x3a06('0x18'),_0x59246c,JSON[_0x3a06('0x1e')](_0x1a0e77));_0x43571b(_0x1a0e77);})[_0x3a06('0x1f')](function(_0x625dd){logger[_0x3a06('0x14')](_0x3a06('0x18'),_0x625dd['message'],_0x59246c);_0x363c56(_0x4ea4e6[_0x3a06('0x14')](0x1f4,_0x625dd[_0x3a06('0x16')]));});});};exports[_0x3a06('0x20')]=function(_0x9d04d1){return new Promise(function(_0x13f4ab,_0x17e290){return db[_0x3a06('0x21')][_0x3a06('0x22')]({'where':_0x9d04d1[_0x3a06('0x1a')]?_0x9d04d1['options'][_0x3a06('0x23')]||null:null})[_0x3a06('0xf')](function(_0x34c3f9){if(_0x34c3f9){return _0x34c3f9[_0x3a06('0x24')](_0x9d04d1[_0x3a06('0x19')][_0x3a06('0x25')],_[_0x3a06('0x26')](_0x9d04d1[_0x3a06('0x19')],[_0x3a06('0x25'),'id'])||{});}})[_0x3a06('0x27')](function(_0x31d08f){logger[_0x3a06('0x10')](_0x3a06('0x28'),_0x9d04d1);logger[_0x3a06('0x12')](_0x3a06('0x28'),_0x9d04d1,JSON[_0x3a06('0x1e')](_0x31d08f));_0x13f4ab(_0x31d08f);})[_0x3a06('0x1f')](function(_0x4a9423){logger[_0x3a06('0x14')](_0x3a06('0x28'),_0x4a9423[_0x3a06('0x16')],_0x9d04d1);_0x17e290(_this[_0x3a06('0x14')](0x1f4,_0x4a9423[_0x3a06('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index dca794c..85f8fb0 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 _0x882f=['length','./faxInteraction.events','remove','update','removeListener','register'];(function(_0x3fbeea,_0x59b594){var _0x479753=function(_0x2d874d){while(--_0x2d874d){_0x3fbeea['push'](_0x3fbeea['shift']());}};_0x479753(++_0x59b594);}(_0x882f,0x85));var _0xf882=function(_0x3e5595,_0xbe4275){_0x3e5595=_0x3e5595-0x0;var _0x3fd3a6=_0x882f[_0x3e5595];return _0x3fd3a6;};'use strict';var FaxInteractionEvents=require(_0xf882('0x0'));var events=['save',_0xf882('0x1'),_0xf882('0x2')];function createListener(_0x510672,_0x5658dd){return function(_0x215abe){_0x5658dd['emit'](_0x510672,_0x215abe);};}function removeListener(_0x4612e4,_0x35f522){return function(){FaxInteractionEvents[_0xf882('0x3')](_0x4612e4,_0x35f522);};}exports[_0xf882('0x4')]=function(_0x292f4b){for(var _0x3cb43d=0x0,_0x226cf0=events[_0xf882('0x5')];_0x3cb43d<_0x226cf0;_0x3cb43d++){var _0x3a4f02=events[_0x3cb43d];var _0x21c8e3=createListener('faxInteraction:'+_0x3a4f02,_0x292f4b);FaxInteractionEvents['on'](_0x3a4f02,_0x21c8e3);}}; \ No newline at end of file +var _0xd97a=['save','remove','removeListener','length','faxInteraction:','./faxInteraction.events'];(function(_0x46a75b,_0x487318){var _0x2fedbe=function(_0xed57dc){while(--_0xed57dc){_0x46a75b['push'](_0x46a75b['shift']());}};_0x2fedbe(++_0x487318);}(_0xd97a,0x14f));var _0xad97=function(_0x15670d,_0x21fa02){_0x15670d=_0x15670d-0x0;var _0x28e28c=_0xd97a[_0x15670d];return _0x28e28c;};'use strict';var FaxInteractionEvents=require(_0xad97('0x0'));var events=[_0xad97('0x1'),_0xad97('0x2'),'update'];function createListener(_0x56dc94,_0x24b4b5){return function(_0xc46c6d){_0x24b4b5['emit'](_0x56dc94,_0xc46c6d);};}function removeListener(_0x10b383,_0xc0e2d5){return function(){FaxInteractionEvents[_0xad97('0x3')](_0x10b383,_0xc0e2d5);};}exports['register']=function(_0x8ddceb){for(var _0xb40069=0x0,_0x351a1c=events[_0xad97('0x4')];_0xb40069<_0x351a1c;_0xb40069++){var _0x51548e=events[_0xb40069];var _0x4e69c8=createListener(_0xad97('0x5')+_0x51548e,_0x8ddceb);FaxInteractionEvents['on'](_0x51548e,_0x4e69c8);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 41a86cc..e9b8c0e 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 _0x986c=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','delete','faxinteraction:destroy','destroy','removeTags','multer','util','Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller'];(function(_0x3d34c8,_0x12ca06){var _0x11eecd=function(_0x43777e){while(--_0x43777e){_0x3d34c8['push'](_0x3d34c8['shift']());}};_0x11eecd(++_0x12ca06);}(_0x986c,0xff));var _0xc986=function(_0x3d7635,_0x1db21e){_0x3d7635=_0x3d7635-0x0;var _0x3f611f=_0x986c[_0x3d7635];return _0x3f611f;};'use strict';var multer=require(_0xc986('0x0'));var util=require(_0xc986('0x1'));var path=require('path');var express=require('express');var router=express[_0xc986('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xc986('0x3'));var config=require(_0xc986('0x4'));var controller=require(_0xc986('0x5'));router[_0xc986('0x6')]('/',auth[_0xc986('0x7')](),controller[_0xc986('0x8')]);router['get'](_0xc986('0x9'),auth[_0xc986('0x7')](),controller[_0xc986('0xa')]);router[_0xc986('0x6')](_0xc986('0xb'),auth[_0xc986('0x7')](),controller[_0xc986('0xc')]);router[_0xc986('0x6')](_0xc986('0xd'),auth[_0xc986('0x7')](),controller[_0xc986('0xe')]);router[_0xc986('0xf')]('/',auth[_0xc986('0x7')](),controller[_0xc986('0x10')]);router[_0xc986('0xf')](_0xc986('0xd'),auth[_0xc986('0x7')](),controller[_0xc986('0x11')]);router[_0xc986('0xf')](_0xc986('0x12'),auth['isAuthenticated'](),interaction[_0xc986('0x13')](_0xc986('0x14'),_0xc986('0x15')),controller[_0xc986('0x16')]);router[_0xc986('0x17')](_0xc986('0xb'),auth[_0xc986('0x7')](),interaction[_0xc986('0x13')](_0xc986('0x14'),_0xc986('0x18')),controller['update']);router[_0xc986('0x19')](_0xc986('0xb'),auth['isAuthenticated'](),interaction[_0xc986('0x13')]('fax',_0xc986('0x1a')),controller[_0xc986('0x1b')]);router[_0xc986('0x19')](_0xc986('0x12'),auth[_0xc986('0x7')](),controller[_0xc986('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x6f74=['describe','get','/:id','show','/:id/messages','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','faxinteraction:destroy','destroy','delete','removeTags','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./faxInteraction.controller','isAuthenticated','index','/describe'];(function(_0x330cc5,_0x147150){var _0x5b3ad9=function(_0x418fc7){while(--_0x418fc7){_0x330cc5['push'](_0x330cc5['shift']());}};_0x5b3ad9(++_0x147150);}(_0x6f74,0x16f));var _0x46f7=function(_0x1c9a9a,_0x30a12f){_0x1c9a9a=_0x1c9a9a-0x0;var _0xca3172=_0x6f74[_0x1c9a9a];return _0xca3172;};'use strict';var multer=require(_0x46f7('0x0'));var util=require(_0x46f7('0x1'));var path=require('path');var express=require(_0x46f7('0x2'));var router=express[_0x46f7('0x3')]();var auth=require(_0x46f7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x46f7('0x5'));var controller=require(_0x46f7('0x6'));router['get']('/',auth[_0x46f7('0x7')](),controller[_0x46f7('0x8')]);router['get'](_0x46f7('0x9'),auth['isAuthenticated'](),controller[_0x46f7('0xa')]);router[_0x46f7('0xb')](_0x46f7('0xc'),auth[_0x46f7('0x7')](),controller[_0x46f7('0xd')]);router[_0x46f7('0xb')](_0x46f7('0xe'),auth[_0x46f7('0x7')](),controller['getMessages']);router[_0x46f7('0xf')]('/',auth[_0x46f7('0x7')](),controller['create']);router[_0x46f7('0xf')](_0x46f7('0xe'),auth[_0x46f7('0x7')](),controller[_0x46f7('0x10')]);router[_0x46f7('0xf')](_0x46f7('0x11'),auth[_0x46f7('0x7')](),interaction[_0x46f7('0x12')](_0x46f7('0x13'),_0x46f7('0x14')),controller[_0x46f7('0x15')]);router[_0x46f7('0x16')](_0x46f7('0xc'),auth[_0x46f7('0x7')](),interaction[_0x46f7('0x12')](_0x46f7('0x13'),_0x46f7('0x17')),controller['update']);router['delete'](_0x46f7('0xc'),auth[_0x46f7('0x7')](),interaction[_0x46f7('0x12')](_0x46f7('0x13'),_0x46f7('0x18')),controller[_0x46f7('0x19')]);router[_0x46f7('0x1a')](_0x46f7('0x11'),auth[_0x46f7('0x7')](),controller[_0x46f7('0x1b')]);module[_0x46f7('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 578303c..093988f 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 _0x2e3b=['BOOLEAN','ENUM','out','exports','TEXT','medium'];(function(_0xc4ea75,_0x273753){var _0x52ea5e=function(_0x1ee872){while(--_0x1ee872){_0xc4ea75['push'](_0xc4ea75['shift']());}};_0x52ea5e(++_0x273753);}(_0x2e3b,0x81));var _0xb2e3=function(_0x4d952,_0x2b6b04){_0x4d952=_0x4d952-0x0;var _0x33de2e=_0x2e3b[_0x4d952];return _0x33de2e;};'use strict';var Sequelize=require('sequelize');module[_0xb2e3('0x0')]={'body':{'type':Sequelize[_0xb2e3('0x1')](_0xb2e3('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xb2e3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb2e3('0x4')]('in',_0xb2e3('0x5')),'defaultValue':_0xb2e3('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xb2e3('0x1')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x8222=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x28088b,_0x55c067){var _0x50d2f3=function(_0x338749){while(--_0x338749){_0x28088b['push'](_0x28088b['shift']());}};_0x50d2f3(++_0x55c067);}(_0x8222,0x120));var _0x2822=function(_0xa9785b,_0x527d20){_0xa9785b=_0xa9785b-0x0;var _0x5e3e76=_0x8222[_0xa9785b];return _0x5e3e76;};'use strict';var Sequelize=require(_0x2822('0x0'));module[_0x2822('0x1')]={'body':{'type':Sequelize[_0x2822('0x2')](_0x2822('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x2822('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2822('0x5')),'defaultValue':_0x2822('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x2822('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x2822('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 29c4db5..29d16a5 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 _0xda81=['code','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','json','update','destroy','stack','name','send','FaxMessage','rawAttributes','model','query','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','dateEnd','add','day','merge','where','filter','map','options','include','findAll','catch','show','params','keys','includeAll','find','describe','accept','fax','body','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get','FaxInteraction','FaxInteractionId','user','interaction','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','fax-interactions','reject','agent','role','rejectmessage','create','CmContact','findOne','ContactId','isNil','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','socket.io-emitter','localhost','./faxMessage.socket','register','jayson/promise','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x253825,_0x1751b9){var _0x21823f=function(_0x5e8358){while(--_0x5e8358){_0x253825['push'](_0x253825['shift']());}};_0x21823f(++_0x1751b9);}(_0xda81,0x1c3));var _0x1da8=function(_0x560b2b,_0x1a08f2){_0x560b2b=_0x560b2b-0x0;var _0x267dd9=_0xda81[_0x560b2b];return _0x267dd9;};'use strict';var jsonpatch=require(_0x1da8('0x0'));var rp=require(_0x1da8('0x1'));var moment=require(_0x1da8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1da8('0x3'));var util=require(_0x1da8('0x4'));var path=require(_0x1da8('0x5'));var sox=require(_0x1da8('0x6'));var csv=require('to-csv');var ejs=require(_0x1da8('0x7'));var fs=require('fs');var _=require(_0x1da8('0x8'));var squel=require('squel');var crypto=require(_0x1da8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x1da8('0xa'));var toCsv=require(_0x1da8('0xb'));var querystring=require(_0x1da8('0xc'));var Papa=require(_0x1da8('0xd'));var qs=require(_0x1da8('0xe'));var logger=require(_0x1da8('0xf'))(_0x1da8('0x10'));var utils=require(_0x1da8('0x11'));var config=require(_0x1da8('0x12'));var db=require('../../mysqldb')['db'];var socket=require(_0x1da8('0x13'))({'host':_0x1da8('0x14'),'port':0x18eb});require(_0x1da8('0x15'))[_0x1da8('0x16')](socket);var jayson=require(_0x1da8('0x17'));var client=jayson['client'][_0x1da8('0x18')]({'port':0x232c});var client9002=jayson['client'][_0x1da8('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4127c8,_0x2717e6,_0x444ea6,_0x44c1a7){return new BPromise(function(_0x5c722d,_0x9d4cd3){var _0x491a3f=_0x44c1a7||client;return _0x491a3f[_0x1da8('0x19')](_0x4127c8,_0x444ea6)[_0x1da8('0x1a')](function(_0x126954){logger[_0x1da8('0x1b')](_0x1da8('0x1c'),_0x2717e6,_0x1da8('0x1d'));logger['debug'](_0x1da8('0x1e'),_0x2717e6,_0x1da8('0x1d'),JSON[_0x1da8('0x1f')](_0x126954));if(_0x126954[_0x1da8('0x20')]){if(_0x126954[_0x1da8('0x20')][_0x1da8('0x21')]===0x1f4){logger[_0x1da8('0x20')](_0x1da8('0x1c'),_0x2717e6,_0x126954[_0x1da8('0x20')]['message']);return _0x9d4cd3(_0x126954[_0x1da8('0x20')][_0x1da8('0x22')]);}logger[_0x1da8('0x20')](_0x1da8('0x1c'),_0x2717e6,_0x126954[_0x1da8('0x20')][_0x1da8('0x22')]);return _0x5c722d(_0x126954['error'][_0x1da8('0x22')]);}else{logger[_0x1da8('0x1b')](_0x1da8('0x1c'),_0x2717e6,_0x1da8('0x1d'));_0x5c722d(_0x126954[_0x1da8('0x23')][_0x1da8('0x22')]);}})['catch'](function(_0x283ff8){logger['error'](_0x1da8('0x1c'),_0x2717e6,_0x283ff8);_0x9d4cd3(_0x283ff8);});});}function respondWithStatusCode(_0x2a127f,_0x3c9abf){_0x3c9abf=_0x3c9abf||0xcc;return function(_0x370d2a){if(_0x370d2a){return _0x2a127f[_0x1da8('0x24')](_0x3c9abf);}return _0x2a127f[_0x1da8('0x25')](_0x3c9abf)[_0x1da8('0x26')]();};}function respondWithResult(_0x4b926b,_0x4a703d){_0x4a703d=_0x4a703d||0xc8;return function(_0xac4b2a){if(_0xac4b2a){return _0x4b926b[_0x1da8('0x25')](_0x4a703d)['json'](_0xac4b2a);}};}function respondWithFilteredResult(_0x242e69,_0x1509a9){return function(_0xa6da1b){if(_0xa6da1b){var _0x138aad=_0xa6da1b[_0x1da8('0x27')],_0x1e2d3e=_0x1509a9[_0x1da8('0x28')],_0x46af20=_0x1509a9[_0x1da8('0x28')]+_0x1509a9[_0x1da8('0x29')],_0x5c3960;if(_0x46af20>=_0x138aad){_0x46af20=_0x138aad;_0x5c3960=0xc8;}else{_0x5c3960=0xce;}_0x242e69[_0x1da8('0x25')](_0x5c3960);return _0x242e69[_0x1da8('0x2a')](_0x1da8('0x2b'),_0x1e2d3e+'-'+_0x46af20+'/'+_0x138aad)[_0x1da8('0x2c')](_0xa6da1b);}return null;};}function patchUpdates(_0x442043){return function(_0x21f3fe){try{jsonpatch['apply'](_0x21f3fe,_0x442043,!![]);}catch(_0x157977){return BPromise['reject'](_0x157977);}return _0x21f3fe['save']();};}function saveUpdates(_0x585ccc,_0x54d3fd){return function(_0x3e7c00){if(_0x3e7c00){return _0x3e7c00[_0x1da8('0x2d')](_0x585ccc)['then'](function(_0x198b31){return _0x198b31;});}return null;};}function removeEntity(_0x59d3c5,_0x1b26dc){return function(_0x202017){if(_0x202017){return _0x202017[_0x1da8('0x2e')]()['then'](function(){_0x59d3c5[_0x1da8('0x25')](0xcc)[_0x1da8('0x26')]();});}};}function handleEntityNotFound(_0x354513,_0x7678be){return function(_0x5ec22c){if(!_0x5ec22c){_0x354513[_0x1da8('0x24')](0x194);}return _0x5ec22c;};}function handleError(_0x3e622f,_0x32b72){_0x32b72=_0x32b72||0x1f4;return function(_0x21cc4b){logger[_0x1da8('0x20')](_0x21cc4b[_0x1da8('0x2f')]);if(_0x21cc4b['name']){delete _0x21cc4b[_0x1da8('0x30')];}_0x3e622f[_0x1da8('0x25')](_0x32b72)[_0x1da8('0x31')](_0x21cc4b);};}exports['index']=function(_0x1e50da,_0x12ce12){var _0x31995e={},_0x16424c={},_0x4089c6={'count':0x0,'rows':[]};var _0x504b51=db[_0x1da8('0x32')][_0x1da8('0x33')];_0x16424c[_0x1da8('0x34')]=_['keys'](_0x504b51);var _0x4f8291={'dateStart':_0x1e50da[_0x1da8('0x35')]['dateStart'],'dateEnd':_0x1e50da['query']['dateEnd']};delete _0x1e50da[_0x1da8('0x35')][_0x1da8('0x36')];delete _0x1e50da[_0x1da8('0x35')]['dateEnd'];_0x16424c[_0x1da8('0x35')]=_['keys'](_0x1e50da[_0x1da8('0x35')]);_0x16424c[_0x1da8('0x37')]=_[_0x1da8('0x38')](_0x16424c[_0x1da8('0x34')],_0x16424c[_0x1da8('0x35')]);_0x31995e[_0x1da8('0x39')]=_[_0x1da8('0x38')](_0x16424c[_0x1da8('0x34')],qs[_0x1da8('0x3a')](_0x1e50da[_0x1da8('0x35')][_0x1da8('0x3a')]));_0x31995e[_0x1da8('0x39')]=_0x31995e['attributes'][_0x1da8('0x3b')]?_0x31995e[_0x1da8('0x39')]:_0x16424c['model'];if(!_0x1e50da[_0x1da8('0x35')][_0x1da8('0x3c')](_0x1da8('0x3d'))){_0x31995e['limit']=qs[_0x1da8('0x29')](_0x1e50da[_0x1da8('0x35')][_0x1da8('0x29')]);_0x31995e[_0x1da8('0x28')]=qs[_0x1da8('0x28')](_0x1e50da['query'][_0x1da8('0x28')]);}_0x31995e[_0x1da8('0x3e')]=qs[_0x1da8('0x3f')](_0x1e50da['query'][_0x1da8('0x3f')]);_0x31995e['where']=qs[_0x1da8('0x37')](_[_0x1da8('0x40')](_0x1e50da[_0x1da8('0x35')],_0x16424c[_0x1da8('0x37')]));if(_0x4f8291[_0x1da8('0x36')]){if(_0x4f8291[_0x1da8('0x41')]){_0x4f8291[_0x1da8('0x41')]=moment(_0x4f8291[_0x1da8('0x41')])[_0x1da8('0x42')](0x1,_0x1da8('0x43'));}else{_0x4f8291['dateEnd']=moment(_0x4f8291[_0x1da8('0x36')])[_0x1da8('0x42')](0x1,_0x1da8('0x43'));}_[_0x1da8('0x44')](_0x31995e[_0x1da8('0x45')],{'createdAt':{'$gte':_0x4f8291['dateStart'],'$lte':_0x4f8291[_0x1da8('0x41')]}});}if(_0x1e50da[_0x1da8('0x35')][_0x1da8('0x46')]){_0x31995e[_0x1da8('0x45')]=_[_0x1da8('0x44')](_0x31995e[_0x1da8('0x45')],{'$or':_[_0x1da8('0x47')](_0x31995e[_0x1da8('0x39')],function(_0x3235ab){var _0x3d7755={};_0x3d7755[_0x3235ab]={'$like':'%'+_0x1e50da[_0x1da8('0x35')][_0x1da8('0x46')]+'%'};return _0x3d7755;})});}_0x31995e=_[_0x1da8('0x44')]({},_0x31995e,_0x1e50da[_0x1da8('0x48')]);var _0x4e515f={'where':_0x31995e['where']};return db[_0x1da8('0x32')][_0x1da8('0x27')](_0x4e515f)[_0x1da8('0x1a')](function(_0x31d76e){_0x4089c6[_0x1da8('0x27')]=_0x31d76e;if(_0x1e50da[_0x1da8('0x35')]['includeAll']){_0x31995e[_0x1da8('0x49')]=[{'all':!![]}];}return db['FaxMessage'][_0x1da8('0x4a')](_0x31995e);})[_0x1da8('0x1a')](function(_0x426894){_0x4089c6['rows']=_0x426894;return _0x4089c6;})[_0x1da8('0x1a')](respondWithFilteredResult(_0x12ce12,_0x31995e))[_0x1da8('0x4b')](handleError(_0x12ce12,null));};exports[_0x1da8('0x4c')]=function(_0x3566d1,_0x2fd418){var _0x40a2c4={'raw':!![],'where':{'id':_0x3566d1[_0x1da8('0x4d')]['id']}},_0x54311d={};_0x54311d['model']=_[_0x1da8('0x4e')](db['FaxMessage'][_0x1da8('0x33')]);_0x54311d['query']=_[_0x1da8('0x4e')](_0x3566d1[_0x1da8('0x35')]);_0x54311d[_0x1da8('0x37')]=_['intersection'](_0x54311d[_0x1da8('0x34')],_0x54311d[_0x1da8('0x35')]);_0x40a2c4[_0x1da8('0x39')]=_['intersection'](_0x54311d['model'],qs[_0x1da8('0x3a')](_0x3566d1[_0x1da8('0x35')][_0x1da8('0x3a')]));_0x40a2c4[_0x1da8('0x39')]=_0x40a2c4[_0x1da8('0x39')][_0x1da8('0x3b')]?_0x40a2c4[_0x1da8('0x39')]:_0x54311d[_0x1da8('0x34')];if(_0x3566d1['query'][_0x1da8('0x4f')]){_0x40a2c4[_0x1da8('0x49')]=[{'all':!![]}];}_0x40a2c4=_[_0x1da8('0x44')]({},_0x40a2c4,_0x3566d1['options']);return db[_0x1da8('0x32')][_0x1da8('0x50')](_0x40a2c4)[_0x1da8('0x1a')](handleEntityNotFound(_0x2fd418,null))['then'](respondWithResult(_0x2fd418,null))[_0x1da8('0x4b')](handleError(_0x2fd418,null));};exports['update']=function(_0x48c4b7,_0x1ecadf){if(_0x48c4b7['body']['id']){delete _0x48c4b7['body']['id'];}return db[_0x1da8('0x32')][_0x1da8('0x50')]({'where':{'id':_0x48c4b7[_0x1da8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1ecadf,null))['then'](saveUpdates(_0x48c4b7['body'],null))[_0x1da8('0x1a')](respondWithResult(_0x1ecadf,null))[_0x1da8('0x4b')](handleError(_0x1ecadf,null));};exports['destroy']=function(_0x5c65de,_0x8d512b){return db[_0x1da8('0x32')]['find']({'where':{'id':_0x5c65de[_0x1da8('0x4d')]['id']}})[_0x1da8('0x1a')](handleEntityNotFound(_0x8d512b,null))[_0x1da8('0x1a')](removeEntity(_0x8d512b,null))[_0x1da8('0x4b')](handleError(_0x8d512b,null));};exports['describe']=function(_0x4663ac,_0x489c4a){return db[_0x1da8('0x32')][_0x1da8('0x51')]()['then'](respondWithResult(_0x489c4a,null))[_0x1da8('0x4b')](handleError(_0x489c4a,null));};var interaction_log=require(_0x1da8('0xf'))('fax-interactions');exports[_0x1da8('0x52')]=function(_0x442460,_0x532a88,_0x7a4c6e){var _0x42980e={'channel':_0x1da8('0x53')};if(_0x442460[_0x1da8('0x54')]['id']){delete _0x442460[_0x1da8('0x54')]['id'];}_0x442460['body'][_0x1da8('0x55')]=!![];_0x442460[_0x1da8('0x54')][_0x1da8('0x56')]=moment()[_0x1da8('0x57')](_0x1da8('0x58'));_0x442460[_0x1da8('0x54')]['UserId']=_0x442460[_0x1da8('0x54')][_0x1da8('0x59')]||_0x442460['user']['id'];return db[_0x1da8('0x32')][_0x1da8('0x50')]({'where':{'id':_0x442460[_0x1da8('0x4d')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x1da8('0x5a')}]})['then'](handleEntityNotFound(_0x532a88,null))[_0x1da8('0x1a')](saveUpdates(_0x442460[_0x1da8('0x54')],null))[_0x1da8('0x1a')](function(_0x1f9295){if(_0x1f9295){_0x42980e[_0x1da8('0x22')]=_0x1f9295[_0x1da8('0x5b')]({'plain':!![]});return db[_0x1da8('0x5c')][_0x1da8('0x50')]({'where':{'id':_0x1f9295[_0x1da8('0x5d')]}});}return null;})['then'](handleEntityNotFound(_0x532a88,null))[_0x1da8('0x1a')](function(_0x2ef656){if(_0x2ef656){return _0x2ef656[_0x1da8('0x2d')]({'UserId':_0x442460[_0x1da8('0x54')][_0x1da8('0x59')],'read1stAt':_['isNil'](_0x2ef656['read1stAt'])?moment()['format'](_0x1da8('0x58')):undefined});}return null;})[_0x1da8('0x1a')](function(_0xcff857){if(_0xcff857){_0x42980e['interaction']=_0xcff857[_0x1da8('0x5b')]({'plain':!![]});interaction_log[_0x1da8('0x1b')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x442460[_0x1da8('0x5e')]['id'],_0x442460[_0x1da8('0x5e')][_0x1da8('0x30')],_0x442460[_0x1da8('0x5e')]['role'],_0x42980e[_0x1da8('0x5f')]['id'],_0x442460[_0x1da8('0x54')]?JSON['stringify'](_0x442460[_0x1da8('0x54')]):_0x1da8('0x60'));return respondWithRpcPromise(_0x1da8('0x61'),_0x1da8('0x62'),_0x42980e);}return null;})[_0x1da8('0x1a')](function(_0x5d03c8){if(_0x5d03c8){if(_0x442460[_0x1da8('0x54')][_0x1da8('0x63')]){_0x42980e[_0x1da8('0x22')][_0x1da8('0x64')]=util[_0x1da8('0x57')](_0x1da8('0x65'),_0x442460[_0x1da8('0x5e')]['name']);_0x42980e[_0x1da8('0x22')][_0x1da8('0x66')]=_0x42980e[_0x1da8('0x66')];_0x42980e[_0x1da8('0x22')][_0x1da8('0x67')]='accept';return respondWithRpcPromise(_0x1da8('0x68'),_0x1da8('0x68'),{'event':_0x1da8('0x69'),'message':_0x42980e[_0x1da8('0x22')]},client9002)['then'](function(){return _0x42980e;});}return _0x42980e;}return null;})[_0x1da8('0x1a')](respondWithResult(_0x532a88,null))['catch'](handleError(_0x532a88,null));};var interaction_log=require('../../config/logger')(_0x1da8('0x6a'));exports[_0x1da8('0x6b')]=function(_0xf38be8,_0x4bf467,_0x3e51ff){var _0x4499ed={'agent':{},'channel':_0x1da8('0x53')};if(_0xf38be8[_0x1da8('0x54')]['id']){delete _0xf38be8[_0x1da8('0x54')]['id'];}_0xf38be8[_0x1da8('0x54')][_0x1da8('0x59')]=_0xf38be8[_0x1da8('0x54')]['UserId']||_0xf38be8[_0x1da8('0x5e')]['id'];_0x4499ed[_0x1da8('0x6c')]['id']=_0xf38be8['body'][_0x1da8('0x59')];return db['FaxMessage'][_0x1da8('0x50')]({'where':{'id':_0xf38be8[_0x1da8('0x4d')]['id'],'UserId':null}})[_0x1da8('0x1a')](handleEntityNotFound(_0x4bf467,null))[_0x1da8('0x1a')](function(_0x4af980){if(_0x4af980){_0x4499ed[_0x1da8('0x22')]=_0x4af980[_0x1da8('0x5b')]({'plain':!![]});return db[_0x1da8('0x5c')][_0x1da8('0x50')]({'where':{'id':_0x4af980[_0x1da8('0x5d')]}});}return null;})[_0x1da8('0x1a')](handleEntityNotFound(_0x4bf467,null))[_0x1da8('0x1a')](function(_0x13dd21){if(_0x13dd21){_0x4499ed[_0x1da8('0x5f')]=_0x13dd21['get']({'plain':!![]});interaction_log[_0x1da8('0x1b')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xf38be8[_0x1da8('0x5e')]['id'],_0xf38be8[_0x1da8('0x5e')][_0x1da8('0x30')],_0xf38be8[_0x1da8('0x5e')][_0x1da8('0x6d')],_0x4499ed[_0x1da8('0x5f')]['id'],_0xf38be8[_0x1da8('0x54')]?JSON[_0x1da8('0x1f')](_0xf38be8[_0x1da8('0x54')]):_0x1da8('0x60'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x4499ed);}return null;})['then'](function(_0x12b2ec){if(_0x12b2ec){_0x12b2ec['message'][_0x1da8('0x64')]=util[_0x1da8('0x57')]('SIP/%s',_0xf38be8[_0x1da8('0x5e')]['name']);_0x12b2ec[_0x1da8('0x22')][_0x1da8('0x66')]=_0x4499ed[_0x1da8('0x66')];_0x12b2ec[_0x1da8('0x22')][_0x1da8('0x67')]='reject';respondWithRpcPromise('EventManager',_0x1da8('0x68'),{'event':_0x1da8('0x6e'),'message':_0x12b2ec[_0x1da8('0x22')]},client9002);return _0x4499ed;}return null;})['then'](respondWithResult(_0x4bf467,null))[_0x1da8('0x4b')](handleError(_0x4bf467,null));};exports[_0x1da8('0x6f')]=function(_0x551841,_0x536b1f){var _0x56dd81;return db[_0x1da8('0x32')][_0x1da8('0x6f')](_0x551841['body'],{})[_0x1da8('0x1a')](function(_0x2dbc9c){_0x56dd81=_0x2dbc9c;return db[_0x1da8('0x70')][_0x1da8('0x71')]({'where':{'id':_0x56dd81[_0x1da8('0x72')]}});})[_0x1da8('0x1a')](function(_0xbb30ac){if(_[_0x1da8('0x73')](_0xbb30ac)){return;}else{_0x56dd81[_0x1da8('0x53')]=_0xbb30ac[_0x1da8('0x53')];return db['Attachment']['findOne']({'where':{'id':_0x56dd81[_0x1da8('0x74')]}});}})[_0x1da8('0x1a')](function(_0x2db6e6){return respondWithRpcPromise(_0x1da8('0x75'),'SendFax',{'FaxAccountId':_[_0x1da8('0x73')](_0x551841['body'])?undefined:_0x551841[_0x1da8('0x54')][_0x1da8('0x76')],'path':_['isNil'](_0x2db6e6)?undefined:util[_0x1da8('0x57')](_0x1da8('0x77'),_0x2db6e6[_0x1da8('0x78')]),'fax':_[_0x1da8('0x73')](_0x56dd81['fax'])?undefined:_0x56dd81[_0x1da8('0x53')],'AttachmentId':_0x56dd81[_0x1da8('0x74')]},client9002);})[_0x1da8('0x1a')](respondWithResult(_0x536b1f,0xc9))['catch'](handleError(_0x536b1f,null));}; \ No newline at end of file +var _0x5f6f=['RejectMessage','create','findOne','ContactId','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','socket.io-emitter','localhost','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','FaxMessage,\x20%s,\x20%s','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','sendStatus','stack','name','send','index','rawAttributes','model','keys','dateStart','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','dateEnd','add','day','merge','filter','options','includeAll','FaxMessage','findAll','rows','show','params','intersection','include','find','body','describe','fax-interactions','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','user','CmContact','Contact','get','FaxInteraction','FaxInteractionId','UserId','isNil','read1stAt','format','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x5e1ece,_0x175943){var _0x150488=function(_0x10123c){while(--_0x10123c){_0x5e1ece['push'](_0x5e1ece['shift']());}};_0x150488(++_0x175943);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0x514bca,_0x164471){_0x514bca=_0x514bca-0x0;var _0x1c2c6e=_0x5f6f[_0x514bca];return _0x1c2c6e;};'use strict';var jsonpatch=require(_0xf5f6('0x0'));var rp=require(_0xf5f6('0x1'));var moment=require(_0xf5f6('0x2'));var BPromise=require(_0xf5f6('0x3'));var Mustache=require(_0xf5f6('0x4'));var util=require('util');var path=require(_0xf5f6('0x5'));var sox=require(_0xf5f6('0x6'));var csv=require(_0xf5f6('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf5f6('0x8'));var squel=require(_0xf5f6('0x9'));var crypto=require(_0xf5f6('0xa'));var jsforce=require(_0xf5f6('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf5f6('0xc'));var Papa=require(_0xf5f6('0xd'));var qs=require(_0xf5f6('0xe'));var logger=require(_0xf5f6('0xf'))(_0xf5f6('0x10'));var utils=require(_0xf5f6('0x11'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0xf5f6('0x12'))({'host':_0xf5f6('0x13'),'port':0x18eb});require('./faxMessage.socket')[_0xf5f6('0x14')](socket);var jayson=require(_0xf5f6('0x15'));var client=jayson[_0xf5f6('0x16')][_0xf5f6('0x17')]({'port':0x232c});var client9002=jayson[_0xf5f6('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b407d,_0x4cde56,_0x2a62c5,_0x2282c2){return new BPromise(function(_0x1441ae,_0x3e056c){var _0x52648d=_0x2282c2||client;return _0x52648d[_0xf5f6('0x18')](_0x3b407d,_0x2a62c5)[_0xf5f6('0x19')](function(_0x1db51c){logger[_0xf5f6('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x4cde56,_0xf5f6('0x1b'));logger[_0xf5f6('0x1c')](_0xf5f6('0x1d'),_0x4cde56,_0xf5f6('0x1b'),JSON['stringify'](_0x1db51c));if(_0x1db51c['error']){if(_0x1db51c[_0xf5f6('0x1e')]['code']===0x1f4){logger[_0xf5f6('0x1e')]('FaxMessage,\x20%s,\x20%s',_0x4cde56,_0x1db51c[_0xf5f6('0x1e')][_0xf5f6('0x1f')]);return _0x3e056c(_0x1db51c[_0xf5f6('0x1e')][_0xf5f6('0x1f')]);}logger[_0xf5f6('0x1e')](_0xf5f6('0x20'),_0x4cde56,_0x1db51c['error'][_0xf5f6('0x1f')]);return _0x1441ae(_0x1db51c[_0xf5f6('0x1e')][_0xf5f6('0x1f')]);}else{logger[_0xf5f6('0x1a')](_0xf5f6('0x20'),_0x4cde56,'request\x20sent');_0x1441ae(_0x1db51c[_0xf5f6('0x21')][_0xf5f6('0x1f')]);}})[_0xf5f6('0x22')](function(_0x579375){logger[_0xf5f6('0x1e')](_0xf5f6('0x20'),_0x4cde56,_0x579375);_0x3e056c(_0x579375);});});}function respondWithStatusCode(_0x1a6fc3,_0x277ac8){_0x277ac8=_0x277ac8||0xcc;return function(_0x49906c){if(_0x49906c){return _0x1a6fc3['sendStatus'](_0x277ac8);}return _0x1a6fc3[_0xf5f6('0x23')](_0x277ac8)[_0xf5f6('0x24')]();};}function respondWithResult(_0xb4f1ec,_0x535d4b){_0x535d4b=_0x535d4b||0xc8;return function(_0x31d0fb){if(_0x31d0fb){return _0xb4f1ec[_0xf5f6('0x23')](_0x535d4b)[_0xf5f6('0x25')](_0x31d0fb);}};}function respondWithFilteredResult(_0x4db805,_0x537a81){return function(_0x3e728d){if(_0x3e728d){var _0x43c29d=_0x3e728d[_0xf5f6('0x26')],_0x23ed8c=_0x537a81[_0xf5f6('0x27')],_0x265457=_0x537a81['offset']+_0x537a81[_0xf5f6('0x28')],_0x55d9ec;if(_0x265457>=_0x43c29d){_0x265457=_0x43c29d;_0x55d9ec=0xc8;}else{_0x55d9ec=0xce;}_0x4db805['status'](_0x55d9ec);return _0x4db805[_0xf5f6('0x29')](_0xf5f6('0x2a'),_0x23ed8c+'-'+_0x265457+'/'+_0x43c29d)['json'](_0x3e728d);}return null;};}function patchUpdates(_0x3e66b9){return function(_0x3043fd){try{jsonpatch[_0xf5f6('0x2b')](_0x3043fd,_0x3e66b9,!![]);}catch(_0x1e6cf2){return BPromise['reject'](_0x1e6cf2);}return _0x3043fd[_0xf5f6('0x2c')]();};}function saveUpdates(_0x58f320,_0x254810){return function(_0x301a59){if(_0x301a59){return _0x301a59[_0xf5f6('0x2d')](_0x58f320)[_0xf5f6('0x19')](function(_0x5bc8b1){return _0x5bc8b1;});}return null;};}function removeEntity(_0x1ddc9b,_0x5166d6){return function(_0x2e532b){if(_0x2e532b){return _0x2e532b[_0xf5f6('0x2e')]()['then'](function(){_0x1ddc9b[_0xf5f6('0x23')](0xcc)[_0xf5f6('0x24')]();});}};}function handleEntityNotFound(_0x13a87c,_0x3fd504){return function(_0x32d47b){if(!_0x32d47b){_0x13a87c[_0xf5f6('0x2f')](0x194);}return _0x32d47b;};}function handleError(_0x36507a,_0x481495){_0x481495=_0x481495||0x1f4;return function(_0x407554){logger['error'](_0x407554[_0xf5f6('0x30')]);if(_0x407554[_0xf5f6('0x31')]){delete _0x407554['name'];}_0x36507a['status'](_0x481495)[_0xf5f6('0x32')](_0x407554);};}exports[_0xf5f6('0x33')]=function(_0x1dc325,_0x22ccce){var _0x1837ed={},_0xd2d0b2={},_0x3ec485={'count':0x0,'rows':[]};var _0x34f318=db['FaxMessage'][_0xf5f6('0x34')];_0xd2d0b2[_0xf5f6('0x35')]=_[_0xf5f6('0x36')](_0x34f318);var _0x58653f={'dateStart':_0x1dc325['query'][_0xf5f6('0x37')],'dateEnd':_0x1dc325['query']['dateEnd']};delete _0x1dc325[_0xf5f6('0x38')][_0xf5f6('0x37')];delete _0x1dc325[_0xf5f6('0x38')]['dateEnd'];_0xd2d0b2[_0xf5f6('0x38')]=_[_0xf5f6('0x36')](_0x1dc325['query']);_0xd2d0b2[_0xf5f6('0x39')]=_['intersection'](_0xd2d0b2['model'],_0xd2d0b2[_0xf5f6('0x38')]);_0x1837ed['attributes']=_['intersection'](_0xd2d0b2[_0xf5f6('0x35')],qs[_0xf5f6('0x3a')](_0x1dc325[_0xf5f6('0x38')]['fields']));_0x1837ed['attributes']=_0x1837ed[_0xf5f6('0x3b')][_0xf5f6('0x3c')]?_0x1837ed[_0xf5f6('0x3b')]:_0xd2d0b2['model'];if(!_0x1dc325[_0xf5f6('0x38')][_0xf5f6('0x3d')](_0xf5f6('0x3e'))){_0x1837ed[_0xf5f6('0x28')]=qs[_0xf5f6('0x28')](_0x1dc325[_0xf5f6('0x38')][_0xf5f6('0x28')]);_0x1837ed[_0xf5f6('0x27')]=qs[_0xf5f6('0x27')](_0x1dc325['query'][_0xf5f6('0x27')]);}_0x1837ed[_0xf5f6('0x3f')]=qs[_0xf5f6('0x40')](_0x1dc325[_0xf5f6('0x38')][_0xf5f6('0x40')]);_0x1837ed[_0xf5f6('0x41')]=qs[_0xf5f6('0x39')](_[_0xf5f6('0x42')](_0x1dc325[_0xf5f6('0x38')],_0xd2d0b2[_0xf5f6('0x39')]));if(_0x58653f[_0xf5f6('0x37')]){if(_0x58653f['dateEnd']){_0x58653f[_0xf5f6('0x43')]=moment(_0x58653f[_0xf5f6('0x43')])[_0xf5f6('0x44')](0x1,'day');}else{_0x58653f[_0xf5f6('0x43')]=moment(_0x58653f[_0xf5f6('0x37')])['add'](0x1,_0xf5f6('0x45'));}_['merge'](_0x1837ed['where'],{'createdAt':{'$gte':_0x58653f[_0xf5f6('0x37')],'$lte':_0x58653f[_0xf5f6('0x43')]}});}if(_0x1dc325[_0xf5f6('0x38')]['filter']){_0x1837ed[_0xf5f6('0x41')]=_[_0xf5f6('0x46')](_0x1837ed[_0xf5f6('0x41')],{'$or':_['map'](_0x1837ed[_0xf5f6('0x3b')],function(_0x59fac2){var _0x46fa50={};_0x46fa50[_0x59fac2]={'$like':'%'+_0x1dc325['query'][_0xf5f6('0x47')]+'%'};return _0x46fa50;})});}_0x1837ed=_[_0xf5f6('0x46')]({},_0x1837ed,_0x1dc325[_0xf5f6('0x48')]);var _0x1edd4f={'where':_0x1837ed[_0xf5f6('0x41')]};return db['FaxMessage']['count'](_0x1edd4f)[_0xf5f6('0x19')](function(_0x521473){_0x3ec485[_0xf5f6('0x26')]=_0x521473;if(_0x1dc325[_0xf5f6('0x38')][_0xf5f6('0x49')]){_0x1837ed['include']=[{'all':!![]}];}return db[_0xf5f6('0x4a')][_0xf5f6('0x4b')](_0x1837ed);})[_0xf5f6('0x19')](function(_0x469827){_0x3ec485[_0xf5f6('0x4c')]=_0x469827;return _0x3ec485;})[_0xf5f6('0x19')](respondWithFilteredResult(_0x22ccce,_0x1837ed))['catch'](handleError(_0x22ccce,null));};exports[_0xf5f6('0x4d')]=function(_0x150d81,_0x58809f){var _0xf092b6={'raw':!![],'where':{'id':_0x150d81[_0xf5f6('0x4e')]['id']}},_0x8c09ff={};_0x8c09ff[_0xf5f6('0x35')]=_[_0xf5f6('0x36')](db[_0xf5f6('0x4a')][_0xf5f6('0x34')]);_0x8c09ff[_0xf5f6('0x38')]=_['keys'](_0x150d81[_0xf5f6('0x38')]);_0x8c09ff['filters']=_[_0xf5f6('0x4f')](_0x8c09ff[_0xf5f6('0x35')],_0x8c09ff[_0xf5f6('0x38')]);_0xf092b6['attributes']=_[_0xf5f6('0x4f')](_0x8c09ff[_0xf5f6('0x35')],qs[_0xf5f6('0x3a')](_0x150d81['query'][_0xf5f6('0x3a')]));_0xf092b6[_0xf5f6('0x3b')]=_0xf092b6[_0xf5f6('0x3b')][_0xf5f6('0x3c')]?_0xf092b6[_0xf5f6('0x3b')]:_0x8c09ff[_0xf5f6('0x35')];if(_0x150d81[_0xf5f6('0x38')]['includeAll']){_0xf092b6[_0xf5f6('0x50')]=[{'all':!![]}];}_0xf092b6=_[_0xf5f6('0x46')]({},_0xf092b6,_0x150d81[_0xf5f6('0x48')]);return db['FaxMessage'][_0xf5f6('0x51')](_0xf092b6)['then'](handleEntityNotFound(_0x58809f,null))[_0xf5f6('0x19')](respondWithResult(_0x58809f,null))[_0xf5f6('0x22')](handleError(_0x58809f,null));};exports[_0xf5f6('0x2d')]=function(_0x1295ab,_0x1400ed){if(_0x1295ab[_0xf5f6('0x52')]['id']){delete _0x1295ab[_0xf5f6('0x52')]['id'];}return db[_0xf5f6('0x4a')][_0xf5f6('0x51')]({'where':{'id':_0x1295ab[_0xf5f6('0x4e')]['id']}})[_0xf5f6('0x19')](handleEntityNotFound(_0x1400ed,null))[_0xf5f6('0x19')](saveUpdates(_0x1295ab[_0xf5f6('0x52')],null))[_0xf5f6('0x19')](respondWithResult(_0x1400ed,null))[_0xf5f6('0x22')](handleError(_0x1400ed,null));};exports[_0xf5f6('0x2e')]=function(_0x3e1a40,_0x8ce5c9){return db['FaxMessage']['find']({'where':{'id':_0x3e1a40[_0xf5f6('0x4e')]['id']}})[_0xf5f6('0x19')](handleEntityNotFound(_0x8ce5c9,null))['then'](removeEntity(_0x8ce5c9,null))['catch'](handleError(_0x8ce5c9,null));};exports[_0xf5f6('0x53')]=function(_0x410018,_0x446a02){return db[_0xf5f6('0x4a')][_0xf5f6('0x53')]()[_0xf5f6('0x19')](respondWithResult(_0x446a02,null))[_0xf5f6('0x22')](handleError(_0x446a02,null));};var interaction_log=require(_0xf5f6('0xf'))(_0xf5f6('0x54'));exports[_0xf5f6('0x55')]=function(_0x3b7b36,_0x3565e3,_0x48e940){var _0x468144={'channel':_0xf5f6('0x56')};if(_0x3b7b36[_0xf5f6('0x52')]['id']){delete _0x3b7b36[_0xf5f6('0x52')]['id'];}_0x3b7b36[_0xf5f6('0x52')][_0xf5f6('0x57')]=!![];_0x3b7b36[_0xf5f6('0x52')][_0xf5f6('0x58')]=moment()['format'](_0xf5f6('0x59'));_0x3b7b36['body']['UserId']=_0x3b7b36[_0xf5f6('0x52')]['UserId']||_0x3b7b36[_0xf5f6('0x5a')]['id'];return db['FaxMessage'][_0xf5f6('0x51')]({'where':{'id':_0x3b7b36[_0xf5f6('0x4e')]['id'],'UserId':null},'include':[{'model':db[_0xf5f6('0x5b')],'as':_0xf5f6('0x5c')}]})[_0xf5f6('0x19')](handleEntityNotFound(_0x3565e3,null))['then'](saveUpdates(_0x3b7b36[_0xf5f6('0x52')],null))[_0xf5f6('0x19')](function(_0x305912){if(_0x305912){_0x468144[_0xf5f6('0x1f')]=_0x305912[_0xf5f6('0x5d')]({'plain':!![]});return db[_0xf5f6('0x5e')][_0xf5f6('0x51')]({'where':{'id':_0x305912[_0xf5f6('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x3565e3,null))[_0xf5f6('0x19')](function(_0x10135b){if(_0x10135b){return _0x10135b[_0xf5f6('0x2d')]({'UserId':_0x3b7b36[_0xf5f6('0x52')][_0xf5f6('0x60')],'read1stAt':_[_0xf5f6('0x61')](_0x10135b[_0xf5f6('0x62')])?moment()[_0xf5f6('0x63')](_0xf5f6('0x59')):undefined});}return null;})[_0xf5f6('0x19')](function(_0x407485){if(_0x407485){_0x468144['interaction']=_0x407485[_0xf5f6('0x5d')]({'plain':!![]});interaction_log['info'](_0xf5f6('0x64'),_0x3b7b36[_0xf5f6('0x5a')]['id'],_0x3b7b36['user'][_0xf5f6('0x31')],_0x3b7b36['user'][_0xf5f6('0x65')],_0x468144[_0xf5f6('0x66')]['id'],_0x3b7b36['body']?JSON[_0xf5f6('0x67')](_0x3b7b36[_0xf5f6('0x52')]):_0xf5f6('0x68'));return respondWithRpcPromise(_0xf5f6('0x69'),'acceptMessage',_0x468144);}return null;})[_0xf5f6('0x19')](function(_0x5d80c8){if(_0x5d80c8){if(_0x3b7b36['body'][_0xf5f6('0x6a')]){_0x468144[_0xf5f6('0x1f')][_0xf5f6('0x6b')]=util['format'](_0xf5f6('0x6c'),_0x3b7b36[_0xf5f6('0x5a')]['name']);_0x468144['message'][_0xf5f6('0x6d')]=_0x468144[_0xf5f6('0x6d')];_0x468144[_0xf5f6('0x1f')][_0xf5f6('0x6e')]='accept';return respondWithRpcPromise('EventManager',_0xf5f6('0x6f'),{'event':_0xf5f6('0x70'),'message':_0x468144['message']},client9002)[_0xf5f6('0x19')](function(){return _0x468144;});}return _0x468144;}return null;})[_0xf5f6('0x19')](respondWithResult(_0x3565e3,null))[_0xf5f6('0x22')](handleError(_0x3565e3,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0xf5f6('0x71')]=function(_0x26e49f,_0x15f696,_0x528938){var _0x16e6a1={'agent':{},'channel':'fax'};if(_0x26e49f[_0xf5f6('0x52')]['id']){delete _0x26e49f[_0xf5f6('0x52')]['id'];}_0x26e49f[_0xf5f6('0x52')][_0xf5f6('0x60')]=_0x26e49f['body'][_0xf5f6('0x60')]||_0x26e49f[_0xf5f6('0x5a')]['id'];_0x16e6a1['agent']['id']=_0x26e49f['body'][_0xf5f6('0x60')];return db[_0xf5f6('0x4a')]['find']({'where':{'id':_0x26e49f['params']['id'],'UserId':null}})[_0xf5f6('0x19')](handleEntityNotFound(_0x15f696,null))[_0xf5f6('0x19')](function(_0x25c479){if(_0x25c479){_0x16e6a1['message']=_0x25c479['get']({'plain':!![]});return db[_0xf5f6('0x5e')][_0xf5f6('0x51')]({'where':{'id':_0x25c479[_0xf5f6('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x15f696,null))['then'](function(_0x1cfaeb){if(_0x1cfaeb){_0x16e6a1[_0xf5f6('0x66')]=_0x1cfaeb[_0xf5f6('0x5d')]({'plain':!![]});interaction_log['info'](_0xf5f6('0x72'),_0x26e49f[_0xf5f6('0x5a')]['id'],_0x26e49f[_0xf5f6('0x5a')][_0xf5f6('0x31')],_0x26e49f[_0xf5f6('0x5a')][_0xf5f6('0x65')],_0x16e6a1['interaction']['id'],_0x26e49f['body']?JSON['stringify'](_0x26e49f[_0xf5f6('0x52')]):_0xf5f6('0x68'));return respondWithRpcPromise(_0xf5f6('0x73'),'rejectMessage',_0x16e6a1);}return null;})[_0xf5f6('0x19')](function(_0x2df866){if(_0x2df866){_0x2df866['message'][_0xf5f6('0x6b')]=util[_0xf5f6('0x63')]('SIP/%s',_0x26e49f[_0xf5f6('0x5a')][_0xf5f6('0x31')]);_0x2df866[_0xf5f6('0x1f')]['channel']=_0x16e6a1[_0xf5f6('0x6d')];_0x2df866[_0xf5f6('0x1f')][_0xf5f6('0x6e')]=_0xf5f6('0x71');respondWithRpcPromise(_0xf5f6('0x6f'),_0xf5f6('0x6f'),{'event':'rejectmessage','message':_0x2df866['message']},client9002);return _0x16e6a1;}return null;})['then'](respondWithResult(_0x15f696,null))['catch'](handleError(_0x15f696,null));};exports[_0xf5f6('0x74')]=function(_0x1af13d,_0x414a97){var _0x2bc895;return db['FaxMessage']['create'](_0x1af13d['body'],{})[_0xf5f6('0x19')](function(_0x194684){_0x2bc895=_0x194684;return db[_0xf5f6('0x5b')][_0xf5f6('0x75')]({'where':{'id':_0x2bc895[_0xf5f6('0x76')]}});})[_0xf5f6('0x19')](function(_0x187150){if(_[_0xf5f6('0x61')](_0x187150)){return;}else{_0x2bc895[_0xf5f6('0x56')]=_0x187150[_0xf5f6('0x56')];return db['Attachment']['findOne']({'where':{'id':_0x2bc895[_0xf5f6('0x77')]}});}})[_0xf5f6('0x19')](function(_0x5dc3b7){return respondWithRpcPromise(_0xf5f6('0x78'),_0xf5f6('0x78'),{'FaxAccountId':_[_0xf5f6('0x61')](_0x1af13d['body'])?undefined:_0x1af13d[_0xf5f6('0x52')]['FaxAccountId'],'path':_[_0xf5f6('0x61')](_0x5dc3b7)?undefined:util['format'](_0xf5f6('0x79'),_0x5dc3b7['basename']),'fax':_[_0xf5f6('0x61')](_0x2bc895[_0xf5f6('0x56')])?undefined:_0x2bc895[_0xf5f6('0x56')],'AttachmentId':_0x2bc895[_0xf5f6('0x77')]},client9002);})[_0xf5f6('0x19')](respondWithResult(_0x414a97,0xc9))[_0xf5f6('0x22')](handleError(_0x414a97,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index bdf54f9..5934a78 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 _0xbe76=['remove','emit','hasOwnProperty','events','update'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xbe76,0xe4));var _0x6be7=function(_0x591781,_0x8e0ed2){_0x591781=_0x591781-0x0;var _0x315bd9=_0xbe76[_0x591781];return _0x315bd9;};'use strict';var EventEmitter=require(_0x6be7('0x0'));var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6be7('0x1'),'afterDestroy':_0x6be7('0x2')};function emitEvent(_0x475971){return function(_0x16d8eb,_0x1d69d1,_0x4eadce){FaxMessageEvents[_0x6be7('0x3')](_0x475971+':'+_0x16d8eb['id'],_0x16d8eb);FaxMessageEvents[_0x6be7('0x3')](_0x475971,_0x16d8eb);_0x4eadce(null);};}for(var e in events){if(events[_0x6be7('0x4')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0xe740=['hook','exports','events','FaxMessage','setMaxListeners','update','emit'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xe740,0x14b));var _0x0e74=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0xe740[_0x1bc013];return _0x55df36;};'use strict';var EventEmitter=require(_0x0e74('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x0e74('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x0e74('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0e74('0x3'),'afterDestroy':'remove'};function emitEvent(_0x35bed6){return function(_0x5ed338,_0xe2aea7,_0x41795e){FaxMessageEvents['emit'](_0x35bed6+':'+_0x5ed338['id'],_0x5ed338);FaxMessageEvents[_0x0e74('0x4')](_0x35bed6,_0x5ed338);_0x41795e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x0e74('0x5')](e,emitEvent(event));}}module[_0x0e74('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 026f354..46e2edc 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 _0x5518=['../../config/logger','api','moment','request-promise','exports','FaxMessage','fax_messages','get','toLowerCase','direction','out','secret','isNil','UserId','FaxInteraction','findOne','createdAt','body','catch','utf8mb4','lodash','util'];(function(_0x287eaf,_0x41d318){var _0x321683=function(_0x4bda72){while(--_0x4bda72){_0x287eaf['push'](_0x287eaf['shift']());}};_0x321683(++_0x41d318);}(_0x5518,0xae));var _0x8551=function(_0x43b548,_0x30ea37){_0x43b548=_0x43b548-0x0;var _0x37f928=_0x5518[_0x43b548];return _0x37f928;};'use strict';var _=require(_0x8551('0x0'));var util=require(_0x8551('0x1'));var logger=require(_0x8551('0x2'))(_0x8551('0x3'));var moment=require(_0x8551('0x4'));var BPromise=require('bluebird');var rp=require(_0x8551('0x5'));var attributes=require('./faxMessage.attributes');module[_0x8551('0x6')]=function(_0x1eb84b,_0x2a91b6){return _0x1eb84b['define'](_0x8551('0x7'),attributes,{'tableName':_0x8551('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1d1928,_0x573203,_0x23ba60){var _0xa73dd9=_0x1eb84b['models'];var _0xe41e8a=_0x1d1928[_0x8551('0x9')]({'plain':!![]});if(_0xe41e8a['direction'][_0x8551('0xa')]()==='in'||_0xe41e8a[_0x8551('0xb')][_0x8551('0xa')]()===_0x8551('0xc')&&!_0xe41e8a[_0x8551('0xd')]&&!_[_0x8551('0xe')](_0xe41e8a[_0x8551('0xf')])){_0xa73dd9[_0x8551('0x10')][_0x8551('0x11')]({'where':{'id':_0xe41e8a['FaxInteractionId']}})['then'](function(_0x5a7804){if(_0x5a7804){_0x5a7804['update']({'lastMsgAt':_0xe41e8a[_0x8551('0x12')],'lastMsgDirection':_0xe41e8a[_0x8551('0xb')][_0x8551('0xa')](),'lastMsgBody':_0xe41e8a[_0x8551('0x13')]});}})[_0x8551('0x14')](function(_0x7e1a82){console['error'](_0x7e1a82);});}_0x23ba60();}},'charset':_0x8551('0x15'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x99bd=['FaxMessage','fax_messages','models','get','direction','toLowerCase','out','secret','isNil','findOne','FaxInteractionId','then','update','createdAt','body','catch','error','util','../../config/logger','api','bluebird','request-promise','./faxMessage.attributes','define'];(function(_0x5d3c39,_0x278203){var _0x109c87=function(_0x53d654){while(--_0x53d654){_0x5d3c39['push'](_0x5d3c39['shift']());}};_0x109c87(++_0x278203);}(_0x99bd,0x1d9));var _0xd99b=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x99bd[_0x36c5b0];return _0xf19333;};'use strict';var _=require('lodash');var util=require(_0xd99b('0x0'));var logger=require(_0xd99b('0x1'))(_0xd99b('0x2'));var moment=require('moment');var BPromise=require(_0xd99b('0x3'));var rp=require(_0xd99b('0x4'));var attributes=require(_0xd99b('0x5'));module['exports']=function(_0x5d7475,_0xe96d88){return _0x5d7475[_0xd99b('0x6')](_0xd99b('0x7'),attributes,{'tableName':_0xd99b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4e55b4,_0x3cdcc6,_0x3296f4){var _0x5e87f6=_0x5d7475[_0xd99b('0x9')];var _0xd21d8=_0x4e55b4[_0xd99b('0xa')]({'plain':!![]});if(_0xd21d8[_0xd99b('0xb')]['toLowerCase']()==='in'||_0xd21d8[_0xd99b('0xb')][_0xd99b('0xc')]()===_0xd99b('0xd')&&!_0xd21d8[_0xd99b('0xe')]&&!_[_0xd99b('0xf')](_0xd21d8['UserId'])){_0x5e87f6['FaxInteraction'][_0xd99b('0x10')]({'where':{'id':_0xd21d8[_0xd99b('0x11')]}})[_0xd99b('0x12')](function(_0x3f192c){if(_0x3f192c){_0x3f192c[_0xd99b('0x13')]({'lastMsgAt':_0xd21d8[_0xd99b('0x14')],'lastMsgDirection':_0xd21d8[_0xd99b('0xb')][_0xd99b('0xc')](),'lastMsgBody':_0xd21d8[_0xd99b('0x15')]});}})[_0xd99b('0x16')](function(_0x1d27fa){console[_0xd99b('0x17')](_0x1d27fa);});}_0x3296f4();}},'charset':'utf8mb4','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 0404f50..a3b6527 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 _0xce7d=['catch','FaxMessage','create','body','options','raw','CreateFaxMessage','debug','UpdateFaxMessage','update','attributes','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','socket.io-emitter','localhost','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x1ae9c5,_0x2b607){var _0x5ccc0c=function(_0x468260){while(--_0x468260){_0x1ae9c5['push'](_0x1ae9c5['shift']());}};_0x5ccc0c(++_0x2b607);}(_0xce7d,0xd1));var _0xdce7=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xce7d[_0x1cc8fe];return _0x230054;};'use strict';var _=require('lodash');var util=require(_0xdce7('0x0'));var moment=require(_0xdce7('0x1'));var BPromise=require(_0xdce7('0x2'));var rs=require(_0xdce7('0x3'));var fs=require('fs');var db=require(_0xdce7('0x4'))['db'];var utils=require(_0xdce7('0x5'));var logger=require(_0xdce7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdce7('0x7'));var client=jayson['client'][_0xdce7('0x8')]({'port':0x232a});var socket=require(_0xdce7('0x9'))({'host':_0xdce7('0xa'),'port':0x18eb});require(_0xdce7('0xb'))[_0xdce7('0xc')](socket);function respondWithRpcPromise(_0x1218a8,_0x19aa9d,_0x558d5a){return new BPromise(function(_0x1902ce,_0x2fdb53){return client[_0xdce7('0xd')](_0x1218a8,_0x558d5a)[_0xdce7('0xe')](function(_0x2d09e0){logger['info'](_0xdce7('0xf'),_0x19aa9d,_0xdce7('0x10'));logger['debug'](_0xdce7('0x11'),_0x19aa9d,_0xdce7('0x10'),JSON[_0xdce7('0x12')](_0x2d09e0));if(_0x2d09e0[_0xdce7('0x13')]){if(_0x2d09e0['error']['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x19aa9d,_0x2d09e0[_0xdce7('0x13')]['message']);return _0x2fdb53(_0x2d09e0[_0xdce7('0x13')][_0xdce7('0x14')]);}logger[_0xdce7('0x13')]('FaxMessage,\x20%s,\x20%s',_0x19aa9d,_0x2d09e0['error'][_0xdce7('0x14')]);return _0x1902ce(_0x2d09e0[_0xdce7('0x13')][_0xdce7('0x14')]);}else{logger[_0xdce7('0x15')](_0xdce7('0xf'),_0x19aa9d,_0xdce7('0x10'));_0x1902ce(_0x2d09e0['result']['message']);}})[_0xdce7('0x16')](function(_0x21745d){logger['error'](_0xdce7('0xf'),_0x19aa9d,_0x21745d);_0x2fdb53(_0x21745d);});});}exports['CreateFaxMessage']=function(_0x2d5e67){var _0x3213a3=this;return new Promise(function(_0x5552fc,_0x36596a){return db[_0xdce7('0x17')][_0xdce7('0x18')](_0x2d5e67[_0xdce7('0x19')],{'raw':_0x2d5e67[_0xdce7('0x1a')]?_0x2d5e67[_0xdce7('0x1a')][_0xdce7('0x1b')]===undefined?!![]:![]:!![]})[_0xdce7('0xe')](function(_0x4f2115){logger[_0xdce7('0x15')](_0xdce7('0x1c'),_0x2d5e67);logger[_0xdce7('0x1d')](_0xdce7('0x1c'),_0x2d5e67,JSON['stringify'](_0x4f2115));_0x5552fc(_0x4f2115);})[_0xdce7('0x16')](function(_0x1e4902){logger[_0xdce7('0x13')]('CreateFaxMessage',_0x1e4902[_0xdce7('0x14')],_0x2d5e67);_0x36596a(_0x3213a3[_0xdce7('0x13')](0x1f4,_0x1e4902[_0xdce7('0x14')]));});});};exports[_0xdce7('0x1e')]=function(_0x2785e9){var _0x9daa96=this;return new Promise(function(_0xb60e2e,_0x195a23){return db['FaxMessage'][_0xdce7('0x1f')](_0x2785e9[_0xdce7('0x19')],{'raw':_0x2785e9[_0xdce7('0x1a')]?_0x2785e9[_0xdce7('0x1a')][_0xdce7('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2785e9[_0xdce7('0x1a')]?_0x2785e9[_0xdce7('0x1a')]['where']||null:null,'attributes':_0x2785e9[_0xdce7('0x1a')]?_0x2785e9[_0xdce7('0x1a')][_0xdce7('0x20')]||null:null,'limit':_0x2785e9[_0xdce7('0x1a')]?_0x2785e9[_0xdce7('0x1a')]['limit']||null:null})[_0xdce7('0xe')](function(_0x58c71e){logger[_0xdce7('0x15')](_0xdce7('0x1e'),_0x2785e9);logger[_0xdce7('0x1d')](_0xdce7('0x1e'),_0x2785e9,JSON[_0xdce7('0x12')](_0x58c71e));_0xb60e2e(_0x58c71e);})['catch'](function(_0x1de0d9){logger['error'](_0xdce7('0x1e'),_0x1de0d9['message'],_0x2785e9);_0x195a23(_0x9daa96[_0xdce7('0x13')](0x1f4,_0x1de0d9['message']));});});}; \ No newline at end of file +var _0x1869=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','./faxMessage.socket','register','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage','create','options','raw','then','stringify','UpdateFaxMessage','FaxMessage','body','attributes','limit','lodash'];(function(_0xfe941c,_0x39b7c9){var _0x161483=function(_0x17d214){while(--_0x17d214){_0xfe941c['push'](_0xfe941c['shift']());}};_0x161483(++_0x39b7c9);}(_0x1869,0x1ed));var _0x9186=function(_0x52b591,_0x4a0e5f){_0x52b591=_0x52b591-0x0;var _0x2c9dd7=_0x1869[_0x52b591];return _0x2c9dd7;};'use strict';var _=require(_0x9186('0x0'));var util=require(_0x9186('0x1'));var moment=require(_0x9186('0x2'));var BPromise=require(_0x9186('0x3'));var rs=require(_0x9186('0x4'));var fs=require('fs');var db=require(_0x9186('0x5'))['db'];var utils=require(_0x9186('0x6'));var logger=require(_0x9186('0x7'))(_0x9186('0x8'));var config=require(_0x9186('0x9'));var jayson=require(_0x9186('0xa'));var client=jayson[_0x9186('0xb')][_0x9186('0xc')]({'port':0x232a});var socket=require(_0x9186('0xd'))({'host':_0x9186('0xe'),'port':0x18eb});require(_0x9186('0xf'))[_0x9186('0x10')](socket);function respondWithRpcPromise(_0x4b9da6,_0x4a79b7,_0x360fdf){return new BPromise(function(_0x4a39dc,_0x46ae2a){return client['request'](_0x4b9da6,_0x360fdf)['then'](function(_0x14d8fc){logger[_0x9186('0x11')]('FaxMessage,\x20%s,\x20%s',_0x4a79b7,_0x9186('0x12'));logger[_0x9186('0x13')](_0x9186('0x14'),_0x4a79b7,_0x9186('0x12'),JSON['stringify'](_0x14d8fc));if(_0x14d8fc[_0x9186('0x15')]){if(_0x14d8fc[_0x9186('0x15')][_0x9186('0x16')]===0x1f4){logger[_0x9186('0x15')](_0x9186('0x17'),_0x4a79b7,_0x14d8fc[_0x9186('0x15')][_0x9186('0x18')]);return _0x46ae2a(_0x14d8fc['error']['message']);}logger[_0x9186('0x15')](_0x9186('0x17'),_0x4a79b7,_0x14d8fc[_0x9186('0x15')][_0x9186('0x18')]);return _0x4a39dc(_0x14d8fc[_0x9186('0x15')][_0x9186('0x18')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x4a79b7,_0x9186('0x12'));_0x4a39dc(_0x14d8fc[_0x9186('0x19')][_0x9186('0x18')]);}})[_0x9186('0x1a')](function(_0x362627){logger[_0x9186('0x15')](_0x9186('0x17'),_0x4a79b7,_0x362627);_0x46ae2a(_0x362627);});});}exports[_0x9186('0x1b')]=function(_0x46a90c){var _0x540caf=this;return new Promise(function(_0x27dbd1,_0xe40731){return db['FaxMessage'][_0x9186('0x1c')](_0x46a90c['body'],{'raw':_0x46a90c['options']?_0x46a90c[_0x9186('0x1d')][_0x9186('0x1e')]===undefined?!![]:![]:!![]})[_0x9186('0x1f')](function(_0x42878f){logger[_0x9186('0x11')](_0x9186('0x1b'),_0x46a90c);logger['debug'](_0x9186('0x1b'),_0x46a90c,JSON[_0x9186('0x20')](_0x42878f));_0x27dbd1(_0x42878f);})[_0x9186('0x1a')](function(_0x9b9b89){logger[_0x9186('0x15')](_0x9186('0x1b'),_0x9b9b89[_0x9186('0x18')],_0x46a90c);_0xe40731(_0x540caf[_0x9186('0x15')](0x1f4,_0x9b9b89[_0x9186('0x18')]));});});};exports[_0x9186('0x21')]=function(_0x2c40ae){var _0x17a336=this;return new Promise(function(_0xaca53b,_0x520765){return db[_0x9186('0x22')]['update'](_0x2c40ae[_0x9186('0x23')],{'raw':_0x2c40ae[_0x9186('0x1d')]?_0x2c40ae[_0x9186('0x1d')][_0x9186('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c40ae[_0x9186('0x1d')]?_0x2c40ae['options']['where']||null:null,'attributes':_0x2c40ae['options']?_0x2c40ae[_0x9186('0x1d')][_0x9186('0x24')]||null:null,'limit':_0x2c40ae[_0x9186('0x1d')]?_0x2c40ae[_0x9186('0x1d')][_0x9186('0x25')]||null:null})[_0x9186('0x1f')](function(_0x30fda2){logger[_0x9186('0x11')]('UpdateFaxMessage',_0x2c40ae);logger[_0x9186('0x13')]('UpdateFaxMessage',_0x2c40ae,JSON[_0x9186('0x20')](_0x30fda2));_0xaca53b(_0x30fda2);})[_0x9186('0x1a')](function(_0x307f53){logger[_0x9186('0x15')](_0x9186('0x21'),_0x307f53[_0x9186('0x18')],_0x2c40ae);_0x520765(_0x17a336[_0x9186('0x15')](0x1f4,_0x307f53[_0x9186('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 2dd58fa..af260bf 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 _0x9559=['remove','emit','removeListener','length','faxMessage:','./faxMessage.events'];(function(_0x1d537c,_0x2b834d){var _0x184fb9=function(_0x248647){while(--_0x248647){_0x1d537c['push'](_0x1d537c['shift']());}};_0x184fb9(++_0x2b834d);}(_0x9559,0x12b));var _0x9955=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x9559[_0x51020b];return _0x371e47;};'use strict';var FaxMessageEvents=require(_0x9955('0x0'));var events=['save',_0x9955('0x1'),'update'];function createListener(_0x6c0c51,_0x9736a0){return function(_0x52f499){_0x9736a0[_0x9955('0x2')](_0x6c0c51,_0x52f499);};}function removeListener(_0x14a6a9,_0x4b4dc8){return function(){FaxMessageEvents[_0x9955('0x3')](_0x14a6a9,_0x4b4dc8);};}exports['register']=function(_0x64d0be){for(var _0x406788=0x0,_0x59d3c8=events[_0x9955('0x4')];_0x406788<_0x59d3c8;_0x406788++){var _0x489056=events[_0x406788];var _0x2ceb68=createListener(_0x9955('0x5')+_0x489056,_0x64d0be);FaxMessageEvents['on'](_0x489056,_0x2ceb68);}}; \ No newline at end of file +var _0xd1bd=['./faxMessage.events','remove','update','register','length','faxMessage:'];(function(_0x4faf46,_0x403799){var _0x5e618d=function(_0x4afb65){while(--_0x4afb65){_0x4faf46['push'](_0x4faf46['shift']());}};_0x5e618d(++_0x403799);}(_0xd1bd,0x8a));var _0xdd1b=function(_0x124f8a,_0x117c26){_0x124f8a=_0x124f8a-0x0;var _0x50c557=_0xd1bd[_0x124f8a];return _0x50c557;};'use strict';var FaxMessageEvents=require(_0xdd1b('0x0'));var events=['save',_0xdd1b('0x1'),_0xdd1b('0x2')];function createListener(_0x5442c6,_0xb83bf7){return function(_0x95fb31){_0xb83bf7['emit'](_0x5442c6,_0x95fb31);};}function removeListener(_0x1b06ad,_0x5cf25e){return function(){FaxMessageEvents['removeListener'](_0x1b06ad,_0x5cf25e);};}exports[_0xdd1b('0x3')]=function(_0x4a71e9){for(var _0x111d3e=0x0,_0x3dadd2=events[_0xdd1b('0x4')];_0x111d3e<_0x3dadd2;_0x111d3e++){var _0x5e50b1=events[_0x111d3e];var _0x505776=createListener(_0xdd1b('0x5')+_0x5e50b1,_0x4a71e9);FaxMessageEvents['on'](_0x5e50b1,_0x505776);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index c8fd890..d159587 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 _0xa882=['show','tracked','fax','put','/:id','update','accept','reject','destroy','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe'];(function(_0x51679b,_0x2d621c){var _0x4085f3=function(_0x14c945){while(--_0x14c945){_0x51679b['push'](_0x51679b['shift']());}};_0x4085f3(++_0x2d621c);}(_0xa882,0x1d5));var _0x2a88=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xa882[_0x10004e];return _0x5af990;};'use strict';var multer=require(_0x2a88('0x0'));var util=require(_0x2a88('0x1'));var path=require(_0x2a88('0x2'));var express=require(_0x2a88('0x3'));var router=express[_0x2a88('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2a88('0x5'));var config=require(_0x2a88('0x6'));var controller=require('./faxMessage.controller');router[_0x2a88('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2a88('0x7')](_0x2a88('0x8'),auth[_0x2a88('0x9')](),controller[_0x2a88('0xa')]);router[_0x2a88('0x7')]('/:id',auth[_0x2a88('0x9')](),controller[_0x2a88('0xb')]);router['post']('/',auth[_0x2a88('0x9')](),interaction[_0x2a88('0xc')](_0x2a88('0xd'),'faxmessage:create'),controller['create']);router[_0x2a88('0xe')](_0x2a88('0xf'),auth[_0x2a88('0x9')](),controller[_0x2a88('0x10')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x2a88('0x11')]);router[_0x2a88('0xe')]('/:id/reject',auth[_0x2a88('0x9')](),controller[_0x2a88('0x12')]);router['delete'](_0x2a88('0xf'),auth[_0x2a88('0x9')](),controller[_0x2a88('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf3b1=['get','index','/describe','describe','isAuthenticated','show','post','tracked','fax','faxmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','/:id','destroy','multer','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller'];(function(_0x307c8f,_0xf7d49f){var _0x12407e=function(_0x84f66c){while(--_0x84f66c){_0x307c8f['push'](_0x307c8f['shift']());}};_0x12407e(++_0xf7d49f);}(_0xf3b1,0x102));var _0x1f3b=function(_0x1af982,_0x2bacd2){_0x1af982=_0x1af982-0x0;var _0x17340a=_0xf3b1[_0x1af982];return _0x17340a;};'use strict';var multer=require(_0x1f3b('0x0'));var util=require('util');var path=require('path');var express=require(_0x1f3b('0x1'));var router=express['Router']();var auth=require(_0x1f3b('0x2'));var interaction=require(_0x1f3b('0x3'));var config=require(_0x1f3b('0x4'));var controller=require(_0x1f3b('0x5'));router[_0x1f3b('0x6')]('/',auth['isAuthenticated'](),controller[_0x1f3b('0x7')]);router[_0x1f3b('0x6')](_0x1f3b('0x8'),auth['isAuthenticated'](),controller[_0x1f3b('0x9')]);router[_0x1f3b('0x6')]('/:id',auth[_0x1f3b('0xa')](),controller[_0x1f3b('0xb')]);router[_0x1f3b('0xc')]('/',auth[_0x1f3b('0xa')](),interaction[_0x1f3b('0xd')](_0x1f3b('0xe'),_0x1f3b('0xf')),controller['create']);router[_0x1f3b('0x10')]('/:id',auth[_0x1f3b('0xa')](),controller[_0x1f3b('0x11')]);router[_0x1f3b('0x10')](_0x1f3b('0x12'),auth[_0x1f3b('0xa')](),controller[_0x1f3b('0x13')]);router[_0x1f3b('0x10')](_0x1f3b('0x14'),auth[_0x1f3b('0xa')](),controller[_0x1f3b('0x15')]);router['delete'](_0x1f3b('0x16'),auth[_0x1f3b('0xa')](),controller[_0x1f3b('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 77f2d48..b842445 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 _0xa9bc=['name','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9bc,0x12d));var _0xca9b=function(_0x888aa2,_0x239e10){_0x888aa2=_0x888aa2-0x0;var _0x3d4b8d=_0xa9bc[_0x888aa2];return _0x3d4b8d;};'use strict';var Sequelize=require(_0xca9b('0x0'));module[_0xca9b('0x1')]={'name':{'type':Sequelize[_0xca9b('0x2')],'unique':_0xca9b('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xca9b('0x2')]},'timeout':{'type':Sequelize[_0xca9b('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xca9b('0x5')](_0xca9b('0x6'),'beepall',_0xca9b('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xca9b('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd734=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x33ef32,_0x343b10){var _0x246b86=function(_0x310d40){while(--_0x310d40){_0x33ef32['push'](_0x33ef32['shift']());}};_0x246b86(++_0x343b10);}(_0xd734,0xf1));var _0x4d73=function(_0x5e2a0c,_0x2717ef){_0x5e2a0c=_0x5e2a0c-0x0;var _0x3d5ed0=_0xd734[_0x5e2a0c];return _0x3d5ed0;};'use strict';var Sequelize=require(_0x4d73('0x0'));module[_0x4d73('0x1')]={'name':{'type':Sequelize[_0x4d73('0x2')],'unique':_0x4d73('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4d73('0x2')]},'timeout':{'type':Sequelize[_0x4d73('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4d73('0x5')](_0x4d73('0x6'),_0x4d73('0x7'),_0x4d73('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 00c9944..a4c664b 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 _0x0a62=['json','offset','limit','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','index','FaxQueue','rawAttributes','model','keys','dateStart','query','dateEnd','intersection','attributes','fields','length','nolimit','order','sort','pick','filters','add','day','merge','where','filter','options','count','includeAll','include','rows','catch','show','find','create','body','params','describe','findOne','get','hasOwnProperty','FaxQueueId','map','UserFaxQueue','User','UserId','agent','faxPause','format','%s/%s','updatedAt','Team','getTeams','addTeams','findAll','Agents','union','addAgents','penalty','ids','removeTeams','removeAgents','omit','spread','emit','userFaxQueue:save','isArray','userFaxQueue:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/environment','../../mysqldb','socket.io-emitter','localhost','register','sendStatus','status'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0a62,0x119));var _0x20a6=function(_0x1c3c59,_0x5f251a){_0x1c3c59=_0x1c3c59-0x0;var _0x1100b7=_0x0a62[_0x1c3c59];return _0x1100b7;};'use strict';var jsonpatch=require(_0x20a6('0x0'));var rp=require(_0x20a6('0x1'));var moment=require(_0x20a6('0x2'));var BPromise=require(_0x20a6('0x3'));var Mustache=require(_0x20a6('0x4'));var util=require(_0x20a6('0x5'));var path=require(_0x20a6('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x20a6('0x7'));var fs=require('fs');var _=require(_0x20a6('0x8'));var squel=require('squel');var crypto=require(_0x20a6('0x9'));var jsforce=require(_0x20a6('0xa'));var deskjs=require(_0x20a6('0xb'));var toCsv=require(_0x20a6('0xc'));var querystring=require(_0x20a6('0xd'));var Papa=require(_0x20a6('0xe'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x20a6('0xf'));var db=require(_0x20a6('0x10'))['db'];var socket=require(_0x20a6('0x11'))({'host':_0x20a6('0x12'),'port':0x18eb});require('./faxQueue.socket')[_0x20a6('0x13')](socket);function respondWithStatusCode(_0xf33c1f,_0x337b53){_0x337b53=_0x337b53||0xcc;return function(_0xaad751){if(_0xaad751){return _0xf33c1f[_0x20a6('0x14')](_0x337b53);}return _0xf33c1f['status'](_0x337b53)['end']();};}function respondWithResult(_0x38513d,_0x2b5314){_0x2b5314=_0x2b5314||0xc8;return function(_0x300e36){if(_0x300e36){return _0x38513d[_0x20a6('0x15')](_0x2b5314)[_0x20a6('0x16')](_0x300e36);}};}function respondWithFilteredResult(_0x4619ff,_0xf0de0e){return function(_0x5361a9){if(_0x5361a9){var _0x356a6f=_0x5361a9['count'],_0x3b3faa=_0xf0de0e[_0x20a6('0x17')],_0x1d7600=_0xf0de0e[_0x20a6('0x17')]+_0xf0de0e[_0x20a6('0x18')],_0x5d40b4;if(_0x1d7600>=_0x356a6f){_0x1d7600=_0x356a6f;_0x5d40b4=0xc8;}else{_0x5d40b4=0xce;}_0x4619ff['status'](_0x5d40b4);return _0x4619ff['set'](_0x20a6('0x19'),_0x3b3faa+'-'+_0x1d7600+'/'+_0x356a6f)[_0x20a6('0x16')](_0x5361a9);}return null;};}function patchUpdates(_0x147e6b){return function(_0x3ed2f4){try{jsonpatch['apply'](_0x3ed2f4,_0x147e6b,!![]);}catch(_0x5ece96){return BPromise[_0x20a6('0x1a')](_0x5ece96);}return _0x3ed2f4[_0x20a6('0x1b')]();};}function saveUpdates(_0x7fcd2a,_0x27144f){return function(_0x2a8813){if(_0x2a8813){return _0x2a8813[_0x20a6('0x1c')](_0x7fcd2a)['then'](function(_0x456788){return _0x456788;});}return null;};}function removeEntity(_0x25ee09,_0x442203){return function(_0x28cec6){if(_0x28cec6){return _0x28cec6[_0x20a6('0x1d')]()[_0x20a6('0x1e')](function(){_0x25ee09[_0x20a6('0x15')](0xcc)[_0x20a6('0x1f')]();});}};}function handleEntityNotFound(_0x449ad0,_0x288027){return function(_0x39f6d9){if(!_0x39f6d9){_0x449ad0['sendStatus'](0x194);}return _0x39f6d9;};}function handleError(_0x29a051,_0x3cca9c){_0x3cca9c=_0x3cca9c||0x1f4;return function(_0x32f9ba){logger[_0x20a6('0x20')](_0x32f9ba[_0x20a6('0x21')]);if(_0x32f9ba[_0x20a6('0x22')]){delete _0x32f9ba[_0x20a6('0x22')];}_0x29a051[_0x20a6('0x15')](_0x3cca9c)[_0x20a6('0x23')](_0x32f9ba);};}exports[_0x20a6('0x24')]=function(_0x18cb71,_0x458cc4){var _0x56c604={},_0x124612={},_0x54e514={'count':0x0,'rows':[]};var _0x4dfbfc=db[_0x20a6('0x25')][_0x20a6('0x26')];_0x124612[_0x20a6('0x27')]=_[_0x20a6('0x28')](_0x4dfbfc);var _0x2f26e6={'dateStart':_0x18cb71['query'][_0x20a6('0x29')],'dateEnd':_0x18cb71[_0x20a6('0x2a')][_0x20a6('0x2b')]};delete _0x18cb71[_0x20a6('0x2a')][_0x20a6('0x29')];delete _0x18cb71[_0x20a6('0x2a')][_0x20a6('0x2b')];_0x124612['query']=_[_0x20a6('0x28')](_0x18cb71[_0x20a6('0x2a')]);_0x124612['filters']=_[_0x20a6('0x2c')](_0x124612[_0x20a6('0x27')],_0x124612['query']);_0x56c604[_0x20a6('0x2d')]=_[_0x20a6('0x2c')](_0x124612[_0x20a6('0x27')],qs[_0x20a6('0x2e')](_0x18cb71[_0x20a6('0x2a')][_0x20a6('0x2e')]));_0x56c604['attributes']=_0x56c604[_0x20a6('0x2d')][_0x20a6('0x2f')]?_0x56c604[_0x20a6('0x2d')]:_0x124612[_0x20a6('0x27')];if(!_0x18cb71['query']['hasOwnProperty'](_0x20a6('0x30'))){_0x56c604[_0x20a6('0x18')]=qs[_0x20a6('0x18')](_0x18cb71['query'][_0x20a6('0x18')]);_0x56c604[_0x20a6('0x17')]=qs[_0x20a6('0x17')](_0x18cb71[_0x20a6('0x2a')][_0x20a6('0x17')]);}_0x56c604[_0x20a6('0x31')]=qs[_0x20a6('0x32')](_0x18cb71['query'][_0x20a6('0x32')]);_0x56c604['where']=qs['filters'](_[_0x20a6('0x33')](_0x18cb71['query'],_0x124612[_0x20a6('0x34')]));if(_0x2f26e6[_0x20a6('0x29')]){if(_0x2f26e6[_0x20a6('0x2b')]){_0x2f26e6[_0x20a6('0x2b')]=moment(_0x2f26e6[_0x20a6('0x2b')])[_0x20a6('0x35')](0x1,_0x20a6('0x36'));}else{_0x2f26e6[_0x20a6('0x2b')]=moment(_0x2f26e6[_0x20a6('0x29')])['add'](0x1,_0x20a6('0x36'));}_[_0x20a6('0x37')](_0x56c604[_0x20a6('0x38')],{'createdAt':{'$gte':_0x2f26e6[_0x20a6('0x29')],'$lte':_0x2f26e6[_0x20a6('0x2b')]}});}if(_0x18cb71[_0x20a6('0x2a')][_0x20a6('0x39')]){_0x56c604[_0x20a6('0x38')]=_[_0x20a6('0x37')](_0x56c604[_0x20a6('0x38')],{'$or':_['map'](_0x56c604[_0x20a6('0x2d')],function(_0x5a8a93){var _0xaaee8c={};_0xaaee8c[_0x5a8a93]={'$like':'%'+_0x18cb71[_0x20a6('0x2a')][_0x20a6('0x39')]+'%'};return _0xaaee8c;})});}_0x56c604=_[_0x20a6('0x37')]({},_0x56c604,_0x18cb71[_0x20a6('0x3a')]);var _0x20370d={'where':_0x56c604[_0x20a6('0x38')]};return db[_0x20a6('0x25')][_0x20a6('0x3b')](_0x20370d)['then'](function(_0x4adec0){_0x54e514[_0x20a6('0x3b')]=_0x4adec0;if(_0x18cb71[_0x20a6('0x2a')][_0x20a6('0x3c')]){_0x56c604[_0x20a6('0x3d')]=[{'all':!![]}];}return db[_0x20a6('0x25')]['findAll'](_0x56c604);})[_0x20a6('0x1e')](function(_0x2f996c){_0x54e514[_0x20a6('0x3e')]=_0x2f996c;return _0x54e514;})['then'](respondWithFilteredResult(_0x458cc4,_0x56c604))[_0x20a6('0x3f')](handleError(_0x458cc4,null));};exports[_0x20a6('0x40')]=function(_0x191b50,_0x5e03f6){var _0x49a3d6={'raw':!![],'where':{'id':_0x191b50['params']['id']}},_0x51cef9={};_0x51cef9[_0x20a6('0x27')]=_[_0x20a6('0x28')](db[_0x20a6('0x25')][_0x20a6('0x26')]);_0x51cef9['query']=_[_0x20a6('0x28')](_0x191b50[_0x20a6('0x2a')]);_0x51cef9['filters']=_[_0x20a6('0x2c')](_0x51cef9['model'],_0x51cef9['query']);_0x49a3d6['attributes']=_[_0x20a6('0x2c')](_0x51cef9[_0x20a6('0x27')],qs[_0x20a6('0x2e')](_0x191b50[_0x20a6('0x2a')][_0x20a6('0x2e')]));_0x49a3d6[_0x20a6('0x2d')]=_0x49a3d6[_0x20a6('0x2d')][_0x20a6('0x2f')]?_0x49a3d6['attributes']:_0x51cef9['model'];if(_0x191b50[_0x20a6('0x2a')][_0x20a6('0x3c')]){_0x49a3d6[_0x20a6('0x3d')]=[{'all':!![]}];}_0x49a3d6=_[_0x20a6('0x37')]({},_0x49a3d6,_0x191b50[_0x20a6('0x3a')]);return db[_0x20a6('0x25')][_0x20a6('0x41')](_0x49a3d6)[_0x20a6('0x1e')](handleEntityNotFound(_0x5e03f6,null))[_0x20a6('0x1e')](respondWithResult(_0x5e03f6,null))[_0x20a6('0x3f')](handleError(_0x5e03f6,null));};exports[_0x20a6('0x42')]=function(_0x8436e,_0x27dc6a){return db[_0x20a6('0x25')][_0x20a6('0x42')](_0x8436e[_0x20a6('0x43')],{})[_0x20a6('0x1e')](respondWithResult(_0x27dc6a,0xc9))[_0x20a6('0x3f')](handleError(_0x27dc6a,null));};exports['update']=function(_0x45c3a7,_0x5d904e){if(_0x45c3a7[_0x20a6('0x43')]['id']){delete _0x45c3a7[_0x20a6('0x43')]['id'];}return db[_0x20a6('0x25')]['find']({'where':{'id':_0x45c3a7[_0x20a6('0x44')]['id']}})[_0x20a6('0x1e')](handleEntityNotFound(_0x5d904e,null))['then'](saveUpdates(_0x45c3a7[_0x20a6('0x43')],null))[_0x20a6('0x1e')](respondWithResult(_0x5d904e,null))[_0x20a6('0x3f')](handleError(_0x5d904e,null));};exports[_0x20a6('0x1d')]=function(_0x1f8d7f,_0x379ce4){return db[_0x20a6('0x25')][_0x20a6('0x41')]({'where':{'id':_0x1f8d7f[_0x20a6('0x44')]['id']}})[_0x20a6('0x1e')](handleEntityNotFound(_0x379ce4,null))[_0x20a6('0x1e')](removeEntity(_0x379ce4,null))['catch'](handleError(_0x379ce4,null));};exports[_0x20a6('0x45')]=function(_0x151867,_0x4d5b05){return db[_0x20a6('0x25')]['describe']()[_0x20a6('0x1e')](respondWithResult(_0x4d5b05,null))[_0x20a6('0x3f')](handleError(_0x4d5b05,null));};exports['getMembers']=function(_0x56be93,_0xe6442f,_0x43f07f){var _0x2106dc={'raw':!![],'where':{}},_0x4bbf8d={},_0x1c96f8;return db[_0x20a6('0x25')][_0x20a6('0x46')]({'where':{'id':_0x56be93[_0x20a6('0x44')]['id']}})['then'](handleEntityNotFound(_0xe6442f,null))[_0x20a6('0x1e')](function(_0x4200f5){if(_0x4200f5){_0x1c96f8=_0x4200f5[_0x20a6('0x47')]({'plain':!![]});_0x4bbf8d[_0x20a6('0x27')]=_[_0x20a6('0x28')](db['UserFaxQueue'][_0x20a6('0x26')]);_0x4bbf8d[_0x20a6('0x2a')]=_['keys'](_0x56be93[_0x20a6('0x2a')]);_0x4bbf8d[_0x20a6('0x34')]=_[_0x20a6('0x2c')](_0x4bbf8d[_0x20a6('0x27')],_0x4bbf8d[_0x20a6('0x2a')]);_0x2106dc[_0x20a6('0x2d')]=_[_0x20a6('0x2c')](_0x4bbf8d[_0x20a6('0x27')],qs[_0x20a6('0x2e')](_0x56be93[_0x20a6('0x2a')][_0x20a6('0x2e')]));_0x2106dc[_0x20a6('0x2d')]=_0x2106dc[_0x20a6('0x2d')]['length']?_0x2106dc[_0x20a6('0x2d')]:_0x4bbf8d['model'];if(!_0x56be93[_0x20a6('0x2a')][_0x20a6('0x48')](_0x20a6('0x30'))){_0x2106dc[_0x20a6('0x18')]=qs[_0x20a6('0x18')](_0x56be93[_0x20a6('0x2a')][_0x20a6('0x18')]);_0x2106dc[_0x20a6('0x17')]=qs[_0x20a6('0x17')](_0x56be93['query']['offset']);}_0x2106dc['order']=qs[_0x20a6('0x32')](_0x56be93[_0x20a6('0x2a')][_0x20a6('0x32')]);_0x2106dc[_0x20a6('0x38')]=qs[_0x20a6('0x34')](_[_0x20a6('0x33')](_0x56be93[_0x20a6('0x2a')],_0x4bbf8d[_0x20a6('0x34')]));_0x2106dc[_0x20a6('0x38')][_0x20a6('0x49')]=_0x4200f5['id'];if(_0x56be93['query']['filter']){_0x2106dc['where']=_[_0x20a6('0x37')](_0x2106dc['where'],{'$or':_[_0x20a6('0x4a')](_0x2106dc[_0x20a6('0x2d')],function(_0x4e378e){var _0x140bd3={};_0x140bd3[_0x4e378e]={'$like':'%'+_0x56be93['query'][_0x20a6('0x39')]+'%'};return _0x140bd3;})});}_0x2106dc=_[_0x20a6('0x37')]({},_0x2106dc,_0x56be93[_0x20a6('0x3a')]);return db[_0x20a6('0x4b')]['findAll'](_0x2106dc);}})['then'](function(_0x2f444d){if(_0x2f444d){return db[_0x20a6('0x4c')]['findAndCountAll']({'where':{'id':_[_0x20a6('0x4a')](_0x2f444d,_0x20a6('0x4d')),'role':_0x20a6('0x4e')},'attributes':['id','name',_0x20a6('0x4f'),'updatedAt','createdAt']});}})[_0x20a6('0x1e')](function(_0x17dfa2){if(_0x17dfa2){return{'count':_0x17dfa2[_0x20a6('0x3b')],'rows':_['map'](_0x17dfa2['rows'],function(_0x3505d8){return{'membername':_0x3505d8[_0x20a6('0x22')],'UserId':_0x3505d8['id'],'queue_name':_0x1c96f8[_0x20a6('0x22')],'FaxQueueId':_0x1c96f8['id'],'interface':util[_0x20a6('0x50')](_0x20a6('0x51'),'SIP',_0x3505d8['name']),'penalty':0x0,'paused':_0x3505d8[_0x20a6('0x4f')],'createdAt':_0x3505d8['createdAt'],'updatedAt':_0x3505d8[_0x20a6('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xe6442f,_0x2106dc))[_0x20a6('0x3f')](handleError(_0xe6442f,null));};exports['getTeams']=function(_0x29a902,_0x3cd3c8,_0xaeb70c){var _0x2a4255={};var _0x1b9a00={};var _0xf79804;var _0x43a92e;return db[_0x20a6('0x25')][_0x20a6('0x46')]({'where':{'id':_0x29a902[_0x20a6('0x44')]['id']}})['then'](handleEntityNotFound(_0x3cd3c8,null))[_0x20a6('0x1e')](function(_0x2f5e93){if(_0x2f5e93){_0xf79804=_0x2f5e93;_0x1b9a00[_0x20a6('0x27')]=_[_0x20a6('0x28')](db[_0x20a6('0x53')][_0x20a6('0x26')]);_0x1b9a00[_0x20a6('0x2a')]=_['keys'](_0x29a902[_0x20a6('0x2a')]);_0x1b9a00[_0x20a6('0x34')]=_[_0x20a6('0x2c')](_0x1b9a00['model'],_0x1b9a00[_0x20a6('0x2a')]);_0x2a4255[_0x20a6('0x2d')]=_[_0x20a6('0x2c')](_0x1b9a00[_0x20a6('0x27')],qs[_0x20a6('0x2e')](_0x29a902[_0x20a6('0x2a')][_0x20a6('0x2e')]));_0x2a4255[_0x20a6('0x2d')]=_0x2a4255['attributes'][_0x20a6('0x2f')]?_0x2a4255[_0x20a6('0x2d')]:_0x1b9a00[_0x20a6('0x27')];_0x2a4255[_0x20a6('0x31')]=qs[_0x20a6('0x32')](_0x29a902['query'][_0x20a6('0x32')]);_0x2a4255[_0x20a6('0x38')]=qs['filters'](_['pick'](_0x29a902['query'],_0x1b9a00[_0x20a6('0x34')]));if(_0x29a902[_0x20a6('0x2a')]['filter']){_0x2a4255[_0x20a6('0x38')]=_['merge'](_0x2a4255[_0x20a6('0x38')],{'$or':_['map'](_0x2a4255['attributes'],function(_0x283ef2){var _0x3a0131={};_0x3a0131[_0x283ef2]={'$like':'%'+_0x29a902[_0x20a6('0x2a')][_0x20a6('0x39')]+'%'};return _0x3a0131;})});}_0x2a4255=_[_0x20a6('0x37')]({},_0x2a4255,_0x29a902['options']);return _0xf79804[_0x20a6('0x54')](_0x2a4255);}})[_0x20a6('0x1e')](function(_0x5ab7f2){if(_0x5ab7f2){_0x43a92e=_0x5ab7f2[_0x20a6('0x2f')];if(!_0x29a902[_0x20a6('0x2a')][_0x20a6('0x48')](_0x20a6('0x30'))){_0x2a4255['limit']=qs[_0x20a6('0x18')](_0x29a902[_0x20a6('0x2a')]['limit']);_0x2a4255[_0x20a6('0x17')]=qs[_0x20a6('0x17')](_0x29a902[_0x20a6('0x2a')][_0x20a6('0x17')]);}return _0xf79804[_0x20a6('0x54')](_0x2a4255);}})[_0x20a6('0x1e')](function(_0x47667e){if(_0x47667e){return _0x47667e?{'count':_0x43a92e,'rows':_0x47667e}:null;}})['then'](respondWithResult(_0x3cd3c8,null))[_0x20a6('0x3f')](handleError(_0x3cd3c8,null));};exports[_0x20a6('0x55')]=function(_0x23a9eb,_0x9c82c5,_0x145036){var _0x5a48e4=[];var _0x277382;return db[_0x20a6('0x53')][_0x20a6('0x56')]({'where':{'id':_0x23a9eb[_0x20a6('0x43')]['ids']},'attributes':['id'],'include':[{'model':db[_0x20a6('0x4c')],'as':_0x20a6('0x57'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x5d7e98){if(_0x5d7e98){for(var _0x1eecde=0x0;_0x1eecde<_0x5d7e98['length'];_0x1eecde+=0x1){for(var _0x4a3daf=0x0;_0x4a3daf<_0x5d7e98[_0x1eecde][_0x20a6('0x57')]['length'];_0x4a3daf+=0x1){_0x5a48e4=_[_0x20a6('0x58')](_0x5a48e4,[_0x5d7e98[_0x1eecde][_0x20a6('0x57')][_0x4a3daf]['id']]);}}return _0x5a48e4;}})[_0x20a6('0x1e')](function(_0x5a3deb){if(_0x5a3deb){return db[_0x20a6('0x25')]['find']({'where':{'id':_0x23a9eb[_0x20a6('0x44')]['id']}});}})['then'](function(_0x5bfe16){if(_0x5bfe16){_0x277382=_0x5bfe16;return _0x277382[_0x20a6('0x59')](_0x5a48e4,{'penalty':_0x23a9eb[_0x20a6('0x43')][_0x20a6('0x5a')]});}})[_0x20a6('0x1e')](function(_0x40aeac){if(_0x40aeac){return _0x277382['addTeams'](_0x23a9eb[_0x20a6('0x43')][_0x20a6('0x5b')]);}})[_0x20a6('0x1e')](handleEntityNotFound(_0x9c82c5,null))['then'](respondWithStatusCode(_0x9c82c5,null))[_0x20a6('0x3f')](handleError(_0x9c82c5,null));};exports[_0x20a6('0x5c')]=function(_0x150aef,_0x3b3fa8,_0x29cb6e){var _0x1ff883=[];var _0x365cee;return db[_0x20a6('0x53')][_0x20a6('0x56')]({'where':{'id':_0x150aef[_0x20a6('0x2a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x20a6('0x4c')],'as':_0x20a6('0x57'),'attributes':['id'],'raw':!![]}]})[_0x20a6('0x1e')](function(_0x5df465){if(_0x5df465){for(var _0x4a3a48=0x0;_0x4a3a48<_0x5df465[_0x20a6('0x2f')];_0x4a3a48+=0x1){for(var _0x4cdfdf=0x0;_0x4cdfdf<_0x5df465[_0x4a3a48]['Agents'][_0x20a6('0x2f')];_0x4cdfdf+=0x1){_0x1ff883=_[_0x20a6('0x58')](_0x1ff883,[_0x5df465[_0x4a3a48][_0x20a6('0x57')][_0x4cdfdf]['id']]);}}return _0x1ff883;}})[_0x20a6('0x1e')](function(_0x3d3814){if(_0x3d3814){return db[_0x20a6('0x25')][_0x20a6('0x41')]({'where':{'id':_0x150aef[_0x20a6('0x44')]['id']}});}})[_0x20a6('0x1e')](function(_0x3e5d55){if(_0x3e5d55){_0x365cee=_0x3e5d55;return _0x365cee[_0x20a6('0x5d')](_0x1ff883);}})[_0x20a6('0x1e')](function(_0x6140c4){if(_0x365cee){return _0x365cee['removeTeams'](_0x150aef[_0x20a6('0x2a')][_0x20a6('0x5b')]);}})[_0x20a6('0x1e')](handleEntityNotFound(_0x3b3fa8,null))[_0x20a6('0x1e')](respondWithStatusCode(_0x3b3fa8,null))[_0x20a6('0x3f')](handleError(_0x3b3fa8,null));};exports[_0x20a6('0x59')]=function(_0x13300d,_0x550b54,_0x382d45){return db['FaxQueue'][_0x20a6('0x41')]({'where':{'id':_0x13300d[_0x20a6('0x44')]['id']}})['then'](handleEntityNotFound(_0x550b54,null))[_0x20a6('0x1e')](function(_0x19e3f2){if(_0x19e3f2){return _0x19e3f2[_0x20a6('0x59')](_0x13300d[_0x20a6('0x43')][_0x20a6('0x5b')],_[_0x20a6('0x5e')](_0x13300d['body'],['ids','id'])||{})[_0x20a6('0x5f')](function(_0x52fc95){for(var _0x208791=0x0;_0x208791<_0x13300d[_0x20a6('0x43')][_0x20a6('0x5b')][_0x20a6('0x2f')];_0x208791+=0x1){socket[_0x20a6('0x60')](_0x20a6('0x61'),{'UserId':_0x13300d[_0x20a6('0x43')]['ids'][_0x208791],'FaxQueueId':_0x13300d['params']['id']});}return _0x52fc95;});}})[_0x20a6('0x1e')](respondWithResult(_0x550b54,null))[_0x20a6('0x3f')](handleError(_0x550b54,null));};exports[_0x20a6('0x5d')]=function(_0x28920e,_0x5b35b6,_0x4cc445){var _0x43fcc2;return db['FaxQueue'][_0x20a6('0x41')]({'where':{'id':_0x28920e[_0x20a6('0x44')]['id']}})[_0x20a6('0x1e')](handleEntityNotFound(_0x5b35b6,null))['then'](function(_0x5d5494){if(_0x5d5494){return _0x5d5494[_0x20a6('0x5d')](_0x28920e[_0x20a6('0x2a')][_0x20a6('0x5b')])[_0x20a6('0x1e')](function(_0x52472a){if(_[_0x20a6('0x62')](_0x28920e[_0x20a6('0x2a')][_0x20a6('0x5b')])){for(var _0x47c2f9=0x0;_0x47c2f9<_0x28920e['query']['ids'][_0x20a6('0x2f')];_0x47c2f9+=0x1){socket['emit'](_0x20a6('0x63'),{'UserId':_0x28920e[_0x20a6('0x2a')][_0x20a6('0x5b')][_0x47c2f9],'FaxQueueId':_0x28920e['params']['id']});}}else{socket[_0x20a6('0x60')](_0x20a6('0x63'),{'UserId':_0x28920e['query'][_0x20a6('0x5b')],'FaxQueueId':_0x28920e[_0x20a6('0x44')]['id']});}});}})[_0x20a6('0x1e')](respondWithStatusCode(_0x5b35b6,null))[_0x20a6('0x3f')](handleError(_0x5b35b6,null));};exports[_0x20a6('0x64')]=function(_0x1f8514,_0x1323ae,_0x5187e0){var _0x364256={};var _0x4b17e2={};var _0x4b5e5f;var _0x424ca1;return db[_0x20a6('0x25')][_0x20a6('0x46')]({'where':{'id':_0x1f8514[_0x20a6('0x44')]['id']}})[_0x20a6('0x1e')](handleEntityNotFound(_0x1323ae,null))[_0x20a6('0x1e')](function(_0x155496){if(_0x155496){_0x4b5e5f=_0x155496;_0x4b17e2[_0x20a6('0x27')]=_['keys'](db[_0x20a6('0x4c')]['rawAttributes']);_0x4b17e2['query']=_[_0x20a6('0x28')](_0x1f8514['query']);_0x4b17e2[_0x20a6('0x34')]=_['intersection'](_0x4b17e2[_0x20a6('0x27')],_0x4b17e2[_0x20a6('0x2a')]);_0x364256[_0x20a6('0x2d')]=_[_0x20a6('0x2c')](_0x4b17e2[_0x20a6('0x27')],qs[_0x20a6('0x2e')](_0x1f8514['query']['fields']));_0x364256['attributes']=_0x364256[_0x20a6('0x2d')][_0x20a6('0x2f')]?_0x364256[_0x20a6('0x2d')]:_0x4b17e2[_0x20a6('0x27')];_0x364256[_0x20a6('0x31')]=qs[_0x20a6('0x32')](_0x1f8514[_0x20a6('0x2a')][_0x20a6('0x32')]);_0x364256[_0x20a6('0x38')]=qs[_0x20a6('0x34')](_[_0x20a6('0x33')](_0x1f8514[_0x20a6('0x2a')],_0x4b17e2['filters']));if(_0x1f8514[_0x20a6('0x2a')]['filter']){_0x364256['where']=_[_0x20a6('0x37')](_0x364256[_0x20a6('0x38')],{'$or':_['map'](_0x364256[_0x20a6('0x2d')],function(_0x4b42ce){var _0x268fe1={};_0x268fe1[_0x4b42ce]={'$like':'%'+_0x1f8514[_0x20a6('0x2a')][_0x20a6('0x39')]+'%'};return _0x268fe1;})});}_0x364256=_[_0x20a6('0x37')]({},_0x364256,_0x1f8514[_0x20a6('0x3a')]);return _0x4b5e5f[_0x20a6('0x64')](_0x364256);}})[_0x20a6('0x1e')](function(_0x3501bc){if(_0x3501bc){_0x424ca1=_0x3501bc[_0x20a6('0x2f')];if(!_0x1f8514[_0x20a6('0x2a')][_0x20a6('0x48')](_0x20a6('0x30'))){_0x364256['limit']=qs[_0x20a6('0x18')](_0x1f8514[_0x20a6('0x2a')][_0x20a6('0x18')]);_0x364256[_0x20a6('0x17')]=qs[_0x20a6('0x17')](_0x1f8514[_0x20a6('0x2a')]['offset']);}return _0x4b5e5f[_0x20a6('0x64')](_0x364256);}})['then'](function(_0x1ebae5){if(_0x1ebae5){return _0x1ebae5?{'count':_0x424ca1,'rows':_0x1ebae5}:null;}})[_0x20a6('0x1e')](respondWithResult(_0x1323ae,null))[_0x20a6('0x3f')](handleError(_0x1323ae,null));}; \ No newline at end of file +var _0xee0f=['../../config/utils','../../config/environment','socket.io-emitter','localhost','register','sendStatus','status','end','json','offset','limit','set','apply','update','then','destroy','error','stack','name','index','FaxQueue','rawAttributes','query','dateStart','dateEnd','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','add','day','merge','where','filter','count','includeAll','include','findAll','rows','show','params','keys','options','catch','create','body','find','describe','getMembers','findOne','get','UserFaxQueue','nolimit','FaxQueueId','map','findAndCountAll','agent','updatedAt','createdAt','format','%s/%s','SIP','faxPause','getTeams','Team','addTeams','User','Agents','addAgents','penalty','ids','removeAgents','removeTeams','omit','spread','emit','userFaxQueue:save','isArray','userFaxQueue:remove','getAgents','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger'];(function(_0x157761,_0x1a60df){var _0xb1028=function(_0x175edb){while(--_0x175edb){_0x157761['push'](_0x157761['shift']());}};_0xb1028(++_0x1a60df);}(_0xee0f,0x1ea));var _0xfee0=function(_0x5b311b,_0x3e0280){_0x5b311b=_0x5b311b-0x0;var _0x4fa0de=_0xee0f[_0x5b311b];return _0x4fa0de;};'use strict';var jsonpatch=require(_0xfee0('0x0'));var rp=require('request-promise');var moment=require(_0xfee0('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xfee0('0x2'));var util=require('util');var path=require(_0xfee0('0x3'));var sox=require(_0xfee0('0x4'));var csv=require(_0xfee0('0x5'));var ejs=require(_0xfee0('0x6'));var fs=require('fs');var _=require(_0xfee0('0x7'));var squel=require(_0xfee0('0x8'));var crypto=require(_0xfee0('0x9'));var jsforce=require(_0xfee0('0xa'));var deskjs=require(_0xfee0('0xb'));var toCsv=require(_0xfee0('0x5'));var querystring=require(_0xfee0('0xc'));var Papa=require(_0xfee0('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0xfee0('0xe'))('api');var utils=require(_0xfee0('0xf'));var config=require(_0xfee0('0x10'));var db=require('../../mysqldb')['db'];var socket=require(_0xfee0('0x11'))({'host':_0xfee0('0x12'),'port':0x18eb});require('./faxQueue.socket')[_0xfee0('0x13')](socket);function respondWithStatusCode(_0x4ef29c,_0x3b2756){_0x3b2756=_0x3b2756||0xcc;return function(_0x1c9472){if(_0x1c9472){return _0x4ef29c[_0xfee0('0x14')](_0x3b2756);}return _0x4ef29c[_0xfee0('0x15')](_0x3b2756)[_0xfee0('0x16')]();};}function respondWithResult(_0x47e93b,_0xc467d7){_0xc467d7=_0xc467d7||0xc8;return function(_0x3c1a74){if(_0x3c1a74){return _0x47e93b[_0xfee0('0x15')](_0xc467d7)[_0xfee0('0x17')](_0x3c1a74);}};}function respondWithFilteredResult(_0x4abab6,_0xe3d629){return function(_0x35c57e){if(_0x35c57e){var _0x16fb42=_0x35c57e['count'],_0x19aa37=_0xe3d629['offset'],_0x359670=_0xe3d629[_0xfee0('0x18')]+_0xe3d629[_0xfee0('0x19')],_0x31ec52;if(_0x359670>=_0x16fb42){_0x359670=_0x16fb42;_0x31ec52=0xc8;}else{_0x31ec52=0xce;}_0x4abab6['status'](_0x31ec52);return _0x4abab6[_0xfee0('0x1a')]('Content-Range',_0x19aa37+'-'+_0x359670+'/'+_0x16fb42)[_0xfee0('0x17')](_0x35c57e);}return null;};}function patchUpdates(_0x2945bb){return function(_0x2c4645){try{jsonpatch[_0xfee0('0x1b')](_0x2c4645,_0x2945bb,!![]);}catch(_0x52ce60){return BPromise['reject'](_0x52ce60);}return _0x2c4645['save']();};}function saveUpdates(_0x29dbbe,_0x5dc13b){return function(_0x35c908){if(_0x35c908){return _0x35c908[_0xfee0('0x1c')](_0x29dbbe)[_0xfee0('0x1d')](function(_0x55912a){return _0x55912a;});}return null;};}function removeEntity(_0x1fddc2,_0x45b20b){return function(_0x3a728f){if(_0x3a728f){return _0x3a728f[_0xfee0('0x1e')]()[_0xfee0('0x1d')](function(){_0x1fddc2[_0xfee0('0x15')](0xcc)[_0xfee0('0x16')]();});}};}function handleEntityNotFound(_0x23afda,_0x5ed750){return function(_0x4dc91d){if(!_0x4dc91d){_0x23afda[_0xfee0('0x14')](0x194);}return _0x4dc91d;};}function handleError(_0x582e76,_0x242a65){_0x242a65=_0x242a65||0x1f4;return function(_0x3cddb0){logger[_0xfee0('0x1f')](_0x3cddb0[_0xfee0('0x20')]);if(_0x3cddb0['name']){delete _0x3cddb0[_0xfee0('0x21')];}_0x582e76[_0xfee0('0x15')](_0x242a65)['send'](_0x3cddb0);};}exports[_0xfee0('0x22')]=function(_0xc61c40,_0x50eccb){var _0x38d1be={},_0x5edd55={},_0x58598d={'count':0x0,'rows':[]};var _0x14e069=db[_0xfee0('0x23')][_0xfee0('0x24')];_0x5edd55['model']=_['keys'](_0x14e069);var _0x440410={'dateStart':_0xc61c40[_0xfee0('0x25')][_0xfee0('0x26')],'dateEnd':_0xc61c40[_0xfee0('0x25')]['dateEnd']};delete _0xc61c40[_0xfee0('0x25')][_0xfee0('0x26')];delete _0xc61c40[_0xfee0('0x25')][_0xfee0('0x27')];_0x5edd55[_0xfee0('0x25')]=_['keys'](_0xc61c40[_0xfee0('0x25')]);_0x5edd55[_0xfee0('0x28')]=_['intersection'](_0x5edd55[_0xfee0('0x29')],_0x5edd55[_0xfee0('0x25')]);_0x38d1be[_0xfee0('0x2a')]=_[_0xfee0('0x2b')](_0x5edd55['model'],qs[_0xfee0('0x2c')](_0xc61c40[_0xfee0('0x25')][_0xfee0('0x2c')]));_0x38d1be[_0xfee0('0x2a')]=_0x38d1be[_0xfee0('0x2a')][_0xfee0('0x2d')]?_0x38d1be[_0xfee0('0x2a')]:_0x5edd55['model'];if(!_0xc61c40['query'][_0xfee0('0x2e')]('nolimit')){_0x38d1be[_0xfee0('0x19')]=qs['limit'](_0xc61c40[_0xfee0('0x25')][_0xfee0('0x19')]);_0x38d1be[_0xfee0('0x18')]=qs['offset'](_0xc61c40[_0xfee0('0x25')][_0xfee0('0x18')]);}_0x38d1be[_0xfee0('0x2f')]=qs['sort'](_0xc61c40[_0xfee0('0x25')][_0xfee0('0x30')]);_0x38d1be['where']=qs[_0xfee0('0x28')](_[_0xfee0('0x31')](_0xc61c40[_0xfee0('0x25')],_0x5edd55[_0xfee0('0x28')]));if(_0x440410['dateStart']){if(_0x440410[_0xfee0('0x27')]){_0x440410[_0xfee0('0x27')]=moment(_0x440410['dateEnd'])[_0xfee0('0x32')](0x1,'day');}else{_0x440410[_0xfee0('0x27')]=moment(_0x440410['dateStart'])[_0xfee0('0x32')](0x1,_0xfee0('0x33'));}_[_0xfee0('0x34')](_0x38d1be[_0xfee0('0x35')],{'createdAt':{'$gte':_0x440410[_0xfee0('0x26')],'$lte':_0x440410[_0xfee0('0x27')]}});}if(_0xc61c40['query']['filter']){_0x38d1be['where']=_[_0xfee0('0x34')](_0x38d1be[_0xfee0('0x35')],{'$or':_['map'](_0x38d1be[_0xfee0('0x2a')],function(_0x5e34a4){var _0x185a9c={};_0x185a9c[_0x5e34a4]={'$like':'%'+_0xc61c40[_0xfee0('0x25')][_0xfee0('0x36')]+'%'};return _0x185a9c;})});}_0x38d1be=_[_0xfee0('0x34')]({},_0x38d1be,_0xc61c40['options']);var _0x18a55c={'where':_0x38d1be[_0xfee0('0x35')]};return db[_0xfee0('0x23')][_0xfee0('0x37')](_0x18a55c)[_0xfee0('0x1d')](function(_0x2f329c){_0x58598d[_0xfee0('0x37')]=_0x2f329c;if(_0xc61c40[_0xfee0('0x25')][_0xfee0('0x38')]){_0x38d1be[_0xfee0('0x39')]=[{'all':!![]}];}return db[_0xfee0('0x23')][_0xfee0('0x3a')](_0x38d1be);})[_0xfee0('0x1d')](function(_0x4fc492){_0x58598d[_0xfee0('0x3b')]=_0x4fc492;return _0x58598d;})[_0xfee0('0x1d')](respondWithFilteredResult(_0x50eccb,_0x38d1be))['catch'](handleError(_0x50eccb,null));};exports[_0xfee0('0x3c')]=function(_0x1a3812,_0xd03b24){var _0x4cd10f={'raw':!![],'where':{'id':_0x1a3812[_0xfee0('0x3d')]['id']}},_0x5b7ed9={};_0x5b7ed9[_0xfee0('0x29')]=_[_0xfee0('0x3e')](db['FaxQueue'][_0xfee0('0x24')]);_0x5b7ed9[_0xfee0('0x25')]=_[_0xfee0('0x3e')](_0x1a3812['query']);_0x5b7ed9[_0xfee0('0x28')]=_[_0xfee0('0x2b')](_0x5b7ed9[_0xfee0('0x29')],_0x5b7ed9[_0xfee0('0x25')]);_0x4cd10f[_0xfee0('0x2a')]=_[_0xfee0('0x2b')](_0x5b7ed9[_0xfee0('0x29')],qs['fields'](_0x1a3812[_0xfee0('0x25')][_0xfee0('0x2c')]));_0x4cd10f[_0xfee0('0x2a')]=_0x4cd10f['attributes'][_0xfee0('0x2d')]?_0x4cd10f[_0xfee0('0x2a')]:_0x5b7ed9['model'];if(_0x1a3812[_0xfee0('0x25')][_0xfee0('0x38')]){_0x4cd10f[_0xfee0('0x39')]=[{'all':!![]}];}_0x4cd10f=_[_0xfee0('0x34')]({},_0x4cd10f,_0x1a3812[_0xfee0('0x3f')]);return db[_0xfee0('0x23')]['find'](_0x4cd10f)[_0xfee0('0x1d')](handleEntityNotFound(_0xd03b24,null))[_0xfee0('0x1d')](respondWithResult(_0xd03b24,null))[_0xfee0('0x40')](handleError(_0xd03b24,null));};exports[_0xfee0('0x41')]=function(_0x356b4e,_0xcb462d){return db[_0xfee0('0x23')][_0xfee0('0x41')](_0x356b4e[_0xfee0('0x42')],{})['then'](respondWithResult(_0xcb462d,0xc9))[_0xfee0('0x40')](handleError(_0xcb462d,null));};exports[_0xfee0('0x1c')]=function(_0x396f0e,_0x2d0d63){if(_0x396f0e[_0xfee0('0x42')]['id']){delete _0x396f0e[_0xfee0('0x42')]['id'];}return db[_0xfee0('0x23')]['find']({'where':{'id':_0x396f0e[_0xfee0('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2d0d63,null))[_0xfee0('0x1d')](saveUpdates(_0x396f0e[_0xfee0('0x42')],null))[_0xfee0('0x1d')](respondWithResult(_0x2d0d63,null))[_0xfee0('0x40')](handleError(_0x2d0d63,null));};exports['destroy']=function(_0x248407,_0x240556){return db[_0xfee0('0x23')][_0xfee0('0x43')]({'where':{'id':_0x248407[_0xfee0('0x3d')]['id']}})[_0xfee0('0x1d')](handleEntityNotFound(_0x240556,null))['then'](removeEntity(_0x240556,null))[_0xfee0('0x40')](handleError(_0x240556,null));};exports[_0xfee0('0x44')]=function(_0x1adfca,_0xf240ea){return db[_0xfee0('0x23')]['describe']()[_0xfee0('0x1d')](respondWithResult(_0xf240ea,null))[_0xfee0('0x40')](handleError(_0xf240ea,null));};exports[_0xfee0('0x45')]=function(_0x2a4378,_0x431eb9,_0x54cab7){var _0x4e0b8b={'raw':!![],'where':{}},_0x50e3a5={},_0x306f6e;return db[_0xfee0('0x23')][_0xfee0('0x46')]({'where':{'id':_0x2a4378['params']['id']}})['then'](handleEntityNotFound(_0x431eb9,null))['then'](function(_0x5cd5f5){if(_0x5cd5f5){_0x306f6e=_0x5cd5f5[_0xfee0('0x47')]({'plain':!![]});_0x50e3a5['model']=_[_0xfee0('0x3e')](db[_0xfee0('0x48')][_0xfee0('0x24')]);_0x50e3a5[_0xfee0('0x25')]=_[_0xfee0('0x3e')](_0x2a4378['query']);_0x50e3a5[_0xfee0('0x28')]=_[_0xfee0('0x2b')](_0x50e3a5[_0xfee0('0x29')],_0x50e3a5[_0xfee0('0x25')]);_0x4e0b8b[_0xfee0('0x2a')]=_[_0xfee0('0x2b')](_0x50e3a5[_0xfee0('0x29')],qs['fields'](_0x2a4378[_0xfee0('0x25')][_0xfee0('0x2c')]));_0x4e0b8b[_0xfee0('0x2a')]=_0x4e0b8b['attributes'][_0xfee0('0x2d')]?_0x4e0b8b[_0xfee0('0x2a')]:_0x50e3a5[_0xfee0('0x29')];if(!_0x2a4378[_0xfee0('0x25')][_0xfee0('0x2e')](_0xfee0('0x49'))){_0x4e0b8b['limit']=qs['limit'](_0x2a4378[_0xfee0('0x25')][_0xfee0('0x19')]);_0x4e0b8b[_0xfee0('0x18')]=qs[_0xfee0('0x18')](_0x2a4378[_0xfee0('0x25')]['offset']);}_0x4e0b8b[_0xfee0('0x2f')]=qs['sort'](_0x2a4378['query'][_0xfee0('0x30')]);_0x4e0b8b[_0xfee0('0x35')]=qs[_0xfee0('0x28')](_['pick'](_0x2a4378[_0xfee0('0x25')],_0x50e3a5[_0xfee0('0x28')]));_0x4e0b8b['where'][_0xfee0('0x4a')]=_0x5cd5f5['id'];if(_0x2a4378['query'][_0xfee0('0x36')]){_0x4e0b8b[_0xfee0('0x35')]=_[_0xfee0('0x34')](_0x4e0b8b['where'],{'$or':_[_0xfee0('0x4b')](_0x4e0b8b[_0xfee0('0x2a')],function(_0x45e3d8){var _0x3471ce={};_0x3471ce[_0x45e3d8]={'$like':'%'+_0x2a4378['query'][_0xfee0('0x36')]+'%'};return _0x3471ce;})});}_0x4e0b8b=_['merge']({},_0x4e0b8b,_0x2a4378[_0xfee0('0x3f')]);return db[_0xfee0('0x48')][_0xfee0('0x3a')](_0x4e0b8b);}})[_0xfee0('0x1d')](function(_0x1654be){if(_0x1654be){return db['User'][_0xfee0('0x4c')]({'where':{'id':_[_0xfee0('0x4b')](_0x1654be,'UserId'),'role':_0xfee0('0x4d')},'attributes':['id',_0xfee0('0x21'),'faxPause',_0xfee0('0x4e'),_0xfee0('0x4f')]});}})[_0xfee0('0x1d')](function(_0x2e799c){if(_0x2e799c){return{'count':_0x2e799c[_0xfee0('0x37')],'rows':_[_0xfee0('0x4b')](_0x2e799c[_0xfee0('0x3b')],function(_0x410077){return{'membername':_0x410077[_0xfee0('0x21')],'UserId':_0x410077['id'],'queue_name':_0x306f6e[_0xfee0('0x21')],'FaxQueueId':_0x306f6e['id'],'interface':util[_0xfee0('0x50')](_0xfee0('0x51'),_0xfee0('0x52'),_0x410077['name']),'penalty':0x0,'paused':_0x410077[_0xfee0('0x53')],'createdAt':_0x410077[_0xfee0('0x4f')],'updatedAt':_0x410077[_0xfee0('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x431eb9,_0x4e0b8b))[_0xfee0('0x40')](handleError(_0x431eb9,null));};exports[_0xfee0('0x54')]=function(_0x5ac2ed,_0x4384e7,_0x32b06b){var _0x550bea={};var _0x33f15f={};var _0x2b15ee;var _0x5d6724;return db[_0xfee0('0x23')][_0xfee0('0x46')]({'where':{'id':_0x5ac2ed['params']['id']}})['then'](handleEntityNotFound(_0x4384e7,null))[_0xfee0('0x1d')](function(_0x3af027){if(_0x3af027){_0x2b15ee=_0x3af027;_0x33f15f[_0xfee0('0x29')]=_[_0xfee0('0x3e')](db[_0xfee0('0x55')]['rawAttributes']);_0x33f15f[_0xfee0('0x25')]=_[_0xfee0('0x3e')](_0x5ac2ed['query']);_0x33f15f[_0xfee0('0x28')]=_['intersection'](_0x33f15f['model'],_0x33f15f[_0xfee0('0x25')]);_0x550bea[_0xfee0('0x2a')]=_[_0xfee0('0x2b')](_0x33f15f['model'],qs[_0xfee0('0x2c')](_0x5ac2ed[_0xfee0('0x25')][_0xfee0('0x2c')]));_0x550bea['attributes']=_0x550bea[_0xfee0('0x2a')][_0xfee0('0x2d')]?_0x550bea[_0xfee0('0x2a')]:_0x33f15f[_0xfee0('0x29')];_0x550bea[_0xfee0('0x2f')]=qs['sort'](_0x5ac2ed['query']['sort']);_0x550bea[_0xfee0('0x35')]=qs['filters'](_[_0xfee0('0x31')](_0x5ac2ed[_0xfee0('0x25')],_0x33f15f['filters']));if(_0x5ac2ed[_0xfee0('0x25')]['filter']){_0x550bea[_0xfee0('0x35')]=_['merge'](_0x550bea['where'],{'$or':_['map'](_0x550bea['attributes'],function(_0x586dfe){var _0x18841f={};_0x18841f[_0x586dfe]={'$like':'%'+_0x5ac2ed[_0xfee0('0x25')][_0xfee0('0x36')]+'%'};return _0x18841f;})});}_0x550bea=_[_0xfee0('0x34')]({},_0x550bea,_0x5ac2ed[_0xfee0('0x3f')]);return _0x2b15ee[_0xfee0('0x54')](_0x550bea);}})[_0xfee0('0x1d')](function(_0x5f3e53){if(_0x5f3e53){_0x5d6724=_0x5f3e53[_0xfee0('0x2d')];if(!_0x5ac2ed[_0xfee0('0x25')][_0xfee0('0x2e')](_0xfee0('0x49'))){_0x550bea['limit']=qs[_0xfee0('0x19')](_0x5ac2ed['query'][_0xfee0('0x19')]);_0x550bea[_0xfee0('0x18')]=qs['offset'](_0x5ac2ed[_0xfee0('0x25')][_0xfee0('0x18')]);}return _0x2b15ee['getTeams'](_0x550bea);}})[_0xfee0('0x1d')](function(_0x2d01d6){if(_0x2d01d6){return _0x2d01d6?{'count':_0x5d6724,'rows':_0x2d01d6}:null;}})['then'](respondWithResult(_0x4384e7,null))[_0xfee0('0x40')](handleError(_0x4384e7,null));};exports[_0xfee0('0x56')]=function(_0x2b103a,_0x6ff77f,_0xa74f88){var _0x59144a=[];var _0x3c098b;return db[_0xfee0('0x55')][_0xfee0('0x3a')]({'where':{'id':_0x2b103a[_0xfee0('0x42')]['ids']},'attributes':['id'],'include':[{'model':db[_0xfee0('0x57')],'as':_0xfee0('0x58'),'attributes':['id'],'raw':!![]}]})[_0xfee0('0x1d')](function(_0xfa5b7d){if(_0xfa5b7d){for(var _0x186a3d=0x0;_0x186a3d<_0xfa5b7d[_0xfee0('0x2d')];_0x186a3d+=0x1){for(var _0x272e3e=0x0;_0x272e3e<_0xfa5b7d[_0x186a3d][_0xfee0('0x58')][_0xfee0('0x2d')];_0x272e3e+=0x1){_0x59144a=_['union'](_0x59144a,[_0xfa5b7d[_0x186a3d]['Agents'][_0x272e3e]['id']]);}}return _0x59144a;}})[_0xfee0('0x1d')](function(_0x471bd7){if(_0x471bd7){return db[_0xfee0('0x23')][_0xfee0('0x43')]({'where':{'id':_0x2b103a['params']['id']}});}})[_0xfee0('0x1d')](function(_0x44702e){if(_0x44702e){_0x3c098b=_0x44702e;return _0x3c098b[_0xfee0('0x59')](_0x59144a,{'penalty':_0x2b103a['body'][_0xfee0('0x5a')]});}})['then'](function(_0x3454db){if(_0x3454db){return _0x3c098b[_0xfee0('0x56')](_0x2b103a[_0xfee0('0x42')][_0xfee0('0x5b')]);}})[_0xfee0('0x1d')](handleEntityNotFound(_0x6ff77f,null))[_0xfee0('0x1d')](respondWithStatusCode(_0x6ff77f,null))[_0xfee0('0x40')](handleError(_0x6ff77f,null));};exports['removeTeams']=function(_0x10ca65,_0x5c6238,_0x756b0){var _0x3147f8=[];var _0x6ff0f;return db[_0xfee0('0x55')][_0xfee0('0x3a')]({'where':{'id':_0x10ca65['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xfee0('0x57')],'as':_0xfee0('0x58'),'attributes':['id'],'raw':!![]}]})[_0xfee0('0x1d')](function(_0xcccd6e){if(_0xcccd6e){for(var _0x4d99a9=0x0;_0x4d99a9<_0xcccd6e[_0xfee0('0x2d')];_0x4d99a9+=0x1){for(var _0x53e5b1=0x0;_0x53e5b1<_0xcccd6e[_0x4d99a9]['Agents']['length'];_0x53e5b1+=0x1){_0x3147f8=_['union'](_0x3147f8,[_0xcccd6e[_0x4d99a9][_0xfee0('0x58')][_0x53e5b1]['id']]);}}return _0x3147f8;}})[_0xfee0('0x1d')](function(_0x5bda87){if(_0x5bda87){return db['FaxQueue'][_0xfee0('0x43')]({'where':{'id':_0x10ca65['params']['id']}});}})[_0xfee0('0x1d')](function(_0x383009){if(_0x383009){_0x6ff0f=_0x383009;return _0x6ff0f[_0xfee0('0x5c')](_0x3147f8);}})['then'](function(_0x2e6fbf){if(_0x6ff0f){return _0x6ff0f[_0xfee0('0x5d')](_0x10ca65[_0xfee0('0x25')]['ids']);}})[_0xfee0('0x1d')](handleEntityNotFound(_0x5c6238,null))[_0xfee0('0x1d')](respondWithStatusCode(_0x5c6238,null))['catch'](handleError(_0x5c6238,null));};exports['addAgents']=function(_0x2acf46,_0x5df99e,_0xdaf986){return db[_0xfee0('0x23')]['find']({'where':{'id':_0x2acf46[_0xfee0('0x3d')]['id']}})[_0xfee0('0x1d')](handleEntityNotFound(_0x5df99e,null))['then'](function(_0x3c00c9){if(_0x3c00c9){return _0x3c00c9[_0xfee0('0x59')](_0x2acf46['body'][_0xfee0('0x5b')],_[_0xfee0('0x5e')](_0x2acf46[_0xfee0('0x42')],['ids','id'])||{})[_0xfee0('0x5f')](function(_0x361268){for(var _0x4bab2f=0x0;_0x4bab2f<_0x2acf46[_0xfee0('0x42')][_0xfee0('0x5b')][_0xfee0('0x2d')];_0x4bab2f+=0x1){socket[_0xfee0('0x60')](_0xfee0('0x61'),{'UserId':_0x2acf46[_0xfee0('0x42')]['ids'][_0x4bab2f],'FaxQueueId':_0x2acf46[_0xfee0('0x3d')]['id']});}return _0x361268;});}})[_0xfee0('0x1d')](respondWithResult(_0x5df99e,null))[_0xfee0('0x40')](handleError(_0x5df99e,null));};exports[_0xfee0('0x5c')]=function(_0x5c6308,_0x64e1d7,_0x2bdfc8){var _0xf14997;return db['FaxQueue']['find']({'where':{'id':_0x5c6308[_0xfee0('0x3d')]['id']}})['then'](handleEntityNotFound(_0x64e1d7,null))[_0xfee0('0x1d')](function(_0x50ca2d){if(_0x50ca2d){return _0x50ca2d[_0xfee0('0x5c')](_0x5c6308[_0xfee0('0x25')][_0xfee0('0x5b')])[_0xfee0('0x1d')](function(_0x55ec62){if(_[_0xfee0('0x62')](_0x5c6308[_0xfee0('0x25')][_0xfee0('0x5b')])){for(var _0x2333d0=0x0;_0x2333d0<_0x5c6308[_0xfee0('0x25')]['ids'][_0xfee0('0x2d')];_0x2333d0+=0x1){socket[_0xfee0('0x60')](_0xfee0('0x63'),{'UserId':_0x5c6308[_0xfee0('0x25')]['ids'][_0x2333d0],'FaxQueueId':_0x5c6308['params']['id']});}}else{socket['emit'](_0xfee0('0x63'),{'UserId':_0x5c6308[_0xfee0('0x25')][_0xfee0('0x5b')],'FaxQueueId':_0x5c6308['params']['id']});}});}})[_0xfee0('0x1d')](respondWithStatusCode(_0x64e1d7,null))[_0xfee0('0x40')](handleError(_0x64e1d7,null));};exports['getAgents']=function(_0x17b01c,_0x1c740c,_0x2080ca){var _0x4d5657={};var _0x518d0f={};var _0x368d8d;var _0x14b39b;return db[_0xfee0('0x23')][_0xfee0('0x46')]({'where':{'id':_0x17b01c[_0xfee0('0x3d')]['id']}})[_0xfee0('0x1d')](handleEntityNotFound(_0x1c740c,null))[_0xfee0('0x1d')](function(_0x59825d){if(_0x59825d){_0x368d8d=_0x59825d;_0x518d0f[_0xfee0('0x29')]=_[_0xfee0('0x3e')](db[_0xfee0('0x57')]['rawAttributes']);_0x518d0f['query']=_[_0xfee0('0x3e')](_0x17b01c[_0xfee0('0x25')]);_0x518d0f[_0xfee0('0x28')]=_[_0xfee0('0x2b')](_0x518d0f[_0xfee0('0x29')],_0x518d0f[_0xfee0('0x25')]);_0x4d5657[_0xfee0('0x2a')]=_['intersection'](_0x518d0f[_0xfee0('0x29')],qs[_0xfee0('0x2c')](_0x17b01c[_0xfee0('0x25')]['fields']));_0x4d5657[_0xfee0('0x2a')]=_0x4d5657['attributes'][_0xfee0('0x2d')]?_0x4d5657['attributes']:_0x518d0f['model'];_0x4d5657[_0xfee0('0x2f')]=qs['sort'](_0x17b01c[_0xfee0('0x25')][_0xfee0('0x30')]);_0x4d5657[_0xfee0('0x35')]=qs[_0xfee0('0x28')](_[_0xfee0('0x31')](_0x17b01c[_0xfee0('0x25')],_0x518d0f[_0xfee0('0x28')]));if(_0x17b01c['query'][_0xfee0('0x36')]){_0x4d5657[_0xfee0('0x35')]=_[_0xfee0('0x34')](_0x4d5657[_0xfee0('0x35')],{'$or':_[_0xfee0('0x4b')](_0x4d5657['attributes'],function(_0x585ac9){var _0x1c4164={};_0x1c4164[_0x585ac9]={'$like':'%'+_0x17b01c[_0xfee0('0x25')][_0xfee0('0x36')]+'%'};return _0x1c4164;})});}_0x4d5657=_[_0xfee0('0x34')]({},_0x4d5657,_0x17b01c[_0xfee0('0x3f')]);return _0x368d8d[_0xfee0('0x64')](_0x4d5657);}})['then'](function(_0x2b226b){if(_0x2b226b){_0x14b39b=_0x2b226b[_0xfee0('0x2d')];if(!_0x17b01c[_0xfee0('0x25')]['hasOwnProperty'](_0xfee0('0x49'))){_0x4d5657[_0xfee0('0x19')]=qs[_0xfee0('0x19')](_0x17b01c['query']['limit']);_0x4d5657[_0xfee0('0x18')]=qs[_0xfee0('0x18')](_0x17b01c[_0xfee0('0x25')]['offset']);}return _0x368d8d[_0xfee0('0x64')](_0x4d5657);}})['then'](function(_0x39c0fd){if(_0x39c0fd){return _0x39c0fd?{'count':_0x14b39b,'rows':_0x39c0fd}:null;}})['then'](respondWithResult(_0x1c740c,null))[_0xfee0('0x40')](handleError(_0x1c740c,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index d2af88e..d043a05 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 _0x5292=['hook','exports','events','../../mysqldb','setMaxListeners','update','remove'];(function(_0xa6b0c9,_0x1c102a){var _0x17eba9=function(_0x5bb7df){while(--_0x5bb7df){_0xa6b0c9['push'](_0xa6b0c9['shift']());}};_0x17eba9(++_0x1c102a);}(_0x5292,0xf7));var _0x2529=function(_0x5da01c,_0x53bf77){_0x5da01c=_0x5da01c-0x0;var _0x1216c2=_0x5292[_0x5da01c];return _0x1216c2;};'use strict';var EventEmitter=require(_0x2529('0x0'));var FaxQueue=require(_0x2529('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x2529('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2529('0x3'),'afterDestroy':_0x2529('0x4')};function emitEvent(_0x29576c){return function(_0x228165,_0x5d25dc,_0x28c08d){FaxQueueEvents['emit'](_0x29576c+':'+_0x228165['id'],_0x228165);FaxQueueEvents['emit'](_0x29576c,_0x228165);_0x28c08d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x2529('0x5')](e,emitEvent(event));}}module[_0x2529('0x6')]=FaxQueueEvents; \ No newline at end of file +var _0x98a8=['remove','emit','hook','events','../../mysqldb','FaxQueue','setMaxListeners','save','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x98a8,0x12c));var _0x898a=function(_0xfba4e4,_0x18f4c6){_0xfba4e4=_0xfba4e4-0x0;var _0x53fdc4=_0x98a8[_0xfba4e4];return _0x53fdc4;};'use strict';var EventEmitter=require(_0x898a('0x0'));var FaxQueue=require(_0x898a('0x1'))['db'][_0x898a('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x898a('0x3')](0x0);var events={'afterCreate':_0x898a('0x4'),'afterUpdate':_0x898a('0x5'),'afterDestroy':_0x898a('0x6')};function emitEvent(_0x4a0836){return function(_0x2bb3e2,_0xf84a19,_0x1b3dd0){FaxQueueEvents[_0x898a('0x7')](_0x4a0836+':'+_0x2bb3e2['id'],_0x2bb3e2);FaxQueueEvents[_0x898a('0x7')](_0x4a0836,_0x2bb3e2);_0x1b3dd0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x898a('0x8')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index d2ae056..5a72731 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 _0xb6ab=['../../config/logger','api','moment','bluebird','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','util'];(function(_0x835a1,_0x88f505){var _0x2fdd76=function(_0x7b4348){while(--_0x7b4348){_0x835a1['push'](_0x835a1['shift']());}};_0x2fdd76(++_0x88f505);}(_0xb6ab,0x10d));var _0xbb6a=function(_0x3c1d68,_0x44cce2){_0x3c1d68=_0x3c1d68-0x0;var _0x19c5aa=_0xb6ab[_0x3c1d68];return _0x19c5aa;};'use strict';var _=require('lodash');var util=require(_0xbb6a('0x0'));var logger=require(_0xbb6a('0x1'))(_0xbb6a('0x2'));var moment=require(_0xbb6a('0x3'));var BPromise=require(_0xbb6a('0x4'));var rp=require('request-promise');var attributes=require(_0xbb6a('0x5'));module[_0xbb6a('0x6')]=function(_0x3ae683,_0x4dd0cb){return _0x3ae683[_0xbb6a('0x7')](_0xbb6a('0x8'),attributes,{'tableName':_0xbb6a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d76=['./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x386b86,_0x5afb5d){var _0x401a18=function(_0x497c3e){while(--_0x497c3e){_0x386b86['push'](_0x386b86['shift']());}};_0x401a18(++_0x5afb5d);}(_0x2d76,0xeb));var _0x62d7=function(_0x3aff71,_0x493a7c){_0x3aff71=_0x3aff71-0x0;var _0x23b3ed=_0x2d76[_0x3aff71];return _0x23b3ed;};'use strict';var _=require(_0x62d7('0x0'));var util=require(_0x62d7('0x1'));var logger=require(_0x62d7('0x2'))('api');var moment=require(_0x62d7('0x3'));var BPromise=require(_0x62d7('0x4'));var rp=require('request-promise');var attributes=require(_0x62d7('0x5'));module[_0x62d7('0x6')]=function(_0xf108b7,_0x2bdf7b){return _0xf108b7[_0x62d7('0x7')](_0x62d7('0x8'),attributes,{'tableName':_0x62d7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 69a4e01..1771c3b 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 _0x8a76=['../../config/environment','client','http','socket.io-emitter','localhost','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetFaxQueue','FaxQueue','findAll','raw','options','where','limit','include','map','model','attributes','stringify','ShowFaxQueue','find','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8a76,0x17f));var _0x68a7=function(_0x55afd9,_0x564f0a){_0x55afd9=_0x55afd9-0x0;var _0x506682=_0x8a76[_0x55afd9];return _0x506682;};'use strict';var _=require(_0x68a7('0x0'));var util=require(_0x68a7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x68a7('0x2'));var fs=require('fs');var db=require(_0x68a7('0x3'))['db'];var utils=require(_0x68a7('0x4'));var logger=require(_0x68a7('0x5'))(_0x68a7('0x6'));var config=require(_0x68a7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x68a7('0x8')][_0x68a7('0x9')]({'port':0x232a});var socket=require(_0x68a7('0xa'))({'host':_0x68a7('0xb'),'port':0x18eb});require(_0x68a7('0xc'))[_0x68a7('0xd')](socket);function respondWithRpcPromise(_0x56f2aa,_0x3a09d7,_0x157454){return new BPromise(function(_0x5786d7,_0x2ed464){return client[_0x68a7('0xe')](_0x56f2aa,_0x157454)[_0x68a7('0xf')](function(_0x18a66b){logger[_0x68a7('0x10')](_0x68a7('0x11'),_0x3a09d7,_0x68a7('0x12'));logger[_0x68a7('0x13')](_0x68a7('0x14'),_0x3a09d7,_0x68a7('0x12'),JSON['stringify'](_0x18a66b));if(_0x18a66b[_0x68a7('0x15')]){if(_0x18a66b[_0x68a7('0x15')]['code']===0x1f4){logger[_0x68a7('0x15')](_0x68a7('0x11'),_0x3a09d7,_0x18a66b[_0x68a7('0x15')]['message']);return _0x2ed464(_0x18a66b['error']['message']);}logger[_0x68a7('0x15')]('FaxQueue,\x20%s,\x20%s',_0x3a09d7,_0x18a66b[_0x68a7('0x15')]['message']);return _0x5786d7(_0x18a66b[_0x68a7('0x15')][_0x68a7('0x16')]);}else{logger[_0x68a7('0x10')]('FaxQueue,\x20%s,\x20%s',_0x3a09d7,_0x68a7('0x12'));_0x5786d7(_0x18a66b[_0x68a7('0x17')]['message']);}})[_0x68a7('0x18')](function(_0x4d1c5d){logger[_0x68a7('0x15')](_0x68a7('0x11'),_0x3a09d7,_0x4d1c5d);_0x2ed464(_0x4d1c5d);});});}exports[_0x68a7('0x19')]=function(_0x428f07){var _0x28e9ba=this;return new Promise(function(_0x3e7e66,_0x415754){return db[_0x68a7('0x1a')][_0x68a7('0x1b')]({'raw':_0x428f07['options']?_0x428f07['options'][_0x68a7('0x1c')]===undefined?!![]:![]:!![],'where':_0x428f07[_0x68a7('0x1d')]?_0x428f07['options'][_0x68a7('0x1e')]||null:null,'attributes':_0x428f07[_0x68a7('0x1d')]?_0x428f07['options']['attributes']||null:null,'limit':_0x428f07[_0x68a7('0x1d')]?_0x428f07[_0x68a7('0x1d')][_0x68a7('0x1f')]||null:null,'include':_0x428f07[_0x68a7('0x1d')]?_0x428f07[_0x68a7('0x1d')][_0x68a7('0x20')]?_[_0x68a7('0x21')](_0x428f07[_0x68a7('0x1d')]['include'],function(_0x2d2604){return{'model':db[_0x2d2604['model']],'as':_0x2d2604['as'],'attributes':_0x2d2604['attributes'],'include':_0x2d2604['include']?_[_0x68a7('0x21')](_0x2d2604[_0x68a7('0x20')],function(_0x5e0b82){return{'model':db[_0x5e0b82[_0x68a7('0x22')]],'as':_0x5e0b82['as'],'attributes':_0x5e0b82[_0x68a7('0x23')],'include':_0x5e0b82[_0x68a7('0x20')]?_[_0x68a7('0x21')](_0x5e0b82[_0x68a7('0x20')],function(_0x591430){return{'model':db[_0x591430[_0x68a7('0x22')]],'as':_0x591430['as'],'attributes':_0x591430[_0x68a7('0x23')]};}):[]};}):[]};}):[]:[]})[_0x68a7('0xf')](function(_0x4323ce){logger['info']('GetFaxQueue',_0x428f07);logger[_0x68a7('0x13')](_0x68a7('0x19'),_0x428f07,JSON[_0x68a7('0x24')](_0x4323ce));_0x3e7e66(_0x4323ce);})[_0x68a7('0x18')](function(_0x4c0a91){logger[_0x68a7('0x15')](_0x68a7('0x19'),_0x4c0a91[_0x68a7('0x16')],_0x428f07);_0x415754(_0x28e9ba[_0x68a7('0x15')](0x1f4,_0x4c0a91[_0x68a7('0x16')]));});});};exports[_0x68a7('0x25')]=function(_0x27fc7a){var _0x257a87=this;return new Promise(function(_0x487427,_0x50acf9){return db[_0x68a7('0x1a')][_0x68a7('0x26')]({'raw':_0x27fc7a[_0x68a7('0x1d')]?_0x27fc7a[_0x68a7('0x1d')][_0x68a7('0x1c')]===undefined?!![]:![]:!![],'where':_0x27fc7a[_0x68a7('0x1d')]?_0x27fc7a[_0x68a7('0x1d')]['where']||null:null,'attributes':_0x27fc7a[_0x68a7('0x1d')]?_0x27fc7a[_0x68a7('0x1d')][_0x68a7('0x23')]||null:null,'include':_0x27fc7a[_0x68a7('0x1d')]?_0x27fc7a[_0x68a7('0x1d')][_0x68a7('0x20')]?_['map'](_0x27fc7a[_0x68a7('0x1d')][_0x68a7('0x20')],function(_0x1ffb5b){return{'model':db[_0x1ffb5b['model']],'as':_0x1ffb5b['as'],'attributes':_0x1ffb5b[_0x68a7('0x23')],'include':_0x1ffb5b[_0x68a7('0x20')]?_['map'](_0x1ffb5b[_0x68a7('0x20')],function(_0x1eb3e3){return{'model':db[_0x1eb3e3[_0x68a7('0x22')]],'as':_0x1eb3e3['as'],'attributes':_0x1eb3e3['attributes'],'include':_0x1eb3e3[_0x68a7('0x20')]?_[_0x68a7('0x21')](_0x1eb3e3[_0x68a7('0x20')],function(_0x325966){return{'model':db[_0x325966[_0x68a7('0x22')]],'as':_0x325966['as'],'attributes':_0x325966['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xd5bc58){logger[_0x68a7('0x10')](_0x68a7('0x25'),_0x27fc7a);logger['debug'](_0x68a7('0x25'),_0x27fc7a,JSON[_0x68a7('0x24')](_0xd5bc58));_0x487427(_0xd5bc58);})[_0x68a7('0x18')](function(_0x230e1e){logger[_0x68a7('0x15')](_0x68a7('0x25'),_0x230e1e[_0x68a7('0x16')],_0x27fc7a);_0x50acf9(_0x257a87[_0x68a7('0x15')](0x1f4,_0x230e1e[_0x68a7('0x16')]));});});}; \ No newline at end of file +var _0xc66f=['lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','map','include','model','attributes','ShowFaxQueue','find'];(function(_0x333834,_0x5941da){var _0x44490f=function(_0xf54930){while(--_0xf54930){_0x333834['push'](_0x333834['shift']());}};_0x44490f(++_0x5941da);}(_0xc66f,0xb9));var _0xfc66=function(_0x1d58c7,_0x14bcf7){_0x1d58c7=_0x1d58c7-0x0;var _0x4de7cb=_0xc66f[_0x1d58c7];return _0x4de7cb;};'use strict';var _=require(_0xfc66('0x0'));var util=require('util');var moment=require(_0xfc66('0x1'));var BPromise=require(_0xfc66('0x2'));var rs=require(_0xfc66('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xfc66('0x4'));var logger=require(_0xfc66('0x5'))(_0xfc66('0x6'));var config=require(_0xfc66('0x7'));var jayson=require(_0xfc66('0x8'));var client=jayson[_0xfc66('0x9')][_0xfc66('0xa')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0xfc66('0xb'),'port':0x18eb});require(_0xfc66('0xc'))[_0xfc66('0xd')](socket);function respondWithRpcPromise(_0x2429d1,_0x2b0ce5,_0x5bf1dd){return new BPromise(function(_0x408804,_0x19afbe){return client[_0xfc66('0xe')](_0x2429d1,_0x5bf1dd)[_0xfc66('0xf')](function(_0x542f87){logger[_0xfc66('0x10')](_0xfc66('0x11'),_0x2b0ce5,_0xfc66('0x12'));logger[_0xfc66('0x13')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x2b0ce5,_0xfc66('0x12'),JSON[_0xfc66('0x14')](_0x542f87));if(_0x542f87[_0xfc66('0x15')]){if(_0x542f87['error'][_0xfc66('0x16')]===0x1f4){logger[_0xfc66('0x15')](_0xfc66('0x11'),_0x2b0ce5,_0x542f87['error']['message']);return _0x19afbe(_0x542f87[_0xfc66('0x15')][_0xfc66('0x17')]);}logger[_0xfc66('0x15')](_0xfc66('0x11'),_0x2b0ce5,_0x542f87[_0xfc66('0x15')][_0xfc66('0x17')]);return _0x408804(_0x542f87['error'][_0xfc66('0x17')]);}else{logger[_0xfc66('0x10')](_0xfc66('0x11'),_0x2b0ce5,_0xfc66('0x12'));_0x408804(_0x542f87[_0xfc66('0x18')]['message']);}})[_0xfc66('0x19')](function(_0x5e0a5e){logger[_0xfc66('0x15')](_0xfc66('0x11'),_0x2b0ce5,_0x5e0a5e);_0x19afbe(_0x5e0a5e);});});}exports[_0xfc66('0x1a')]=function(_0x5653bc){var _0x22cfe0=this;return new Promise(function(_0x580252,_0x6d15cc){return db[_0xfc66('0x1b')][_0xfc66('0x1c')]({'raw':_0x5653bc['options']?_0x5653bc['options']['raw']===undefined?!![]:![]:!![],'where':_0x5653bc[_0xfc66('0x1d')]?_0x5653bc['options'][_0xfc66('0x1e')]||null:null,'attributes':_0x5653bc[_0xfc66('0x1d')]?_0x5653bc['options']['attributes']||null:null,'limit':_0x5653bc['options']?_0x5653bc[_0xfc66('0x1d')]['limit']||null:null,'include':_0x5653bc[_0xfc66('0x1d')]?_0x5653bc[_0xfc66('0x1d')]['include']?_[_0xfc66('0x1f')](_0x5653bc['options'][_0xfc66('0x20')],function(_0x20d9bd){return{'model':db[_0x20d9bd['model']],'as':_0x20d9bd['as'],'attributes':_0x20d9bd['attributes'],'include':_0x20d9bd[_0xfc66('0x20')]?_[_0xfc66('0x1f')](_0x20d9bd[_0xfc66('0x20')],function(_0x185e72){return{'model':db[_0x185e72[_0xfc66('0x21')]],'as':_0x185e72['as'],'attributes':_0x185e72[_0xfc66('0x22')],'include':_0x185e72[_0xfc66('0x20')]?_['map'](_0x185e72[_0xfc66('0x20')],function(_0x2482b7){return{'model':db[_0x2482b7[_0xfc66('0x21')]],'as':_0x2482b7['as'],'attributes':_0x2482b7[_0xfc66('0x22')]};}):[]};}):[]};}):[]:[]})[_0xfc66('0xf')](function(_0x513c43){logger[_0xfc66('0x10')](_0xfc66('0x1a'),_0x5653bc);logger[_0xfc66('0x13')](_0xfc66('0x1a'),_0x5653bc,JSON[_0xfc66('0x14')](_0x513c43));_0x580252(_0x513c43);})[_0xfc66('0x19')](function(_0x4802b5){logger[_0xfc66('0x15')]('GetFaxQueue',_0x4802b5[_0xfc66('0x17')],_0x5653bc);_0x6d15cc(_0x22cfe0[_0xfc66('0x15')](0x1f4,_0x4802b5['message']));});});};exports[_0xfc66('0x23')]=function(_0x2817ec){var _0x26bd97=this;return new Promise(function(_0x7863b,_0x209df3){return db[_0xfc66('0x1b')][_0xfc66('0x24')]({'raw':_0x2817ec[_0xfc66('0x1d')]?_0x2817ec[_0xfc66('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2817ec[_0xfc66('0x1d')]?_0x2817ec[_0xfc66('0x1d')]['where']||null:null,'attributes':_0x2817ec[_0xfc66('0x1d')]?_0x2817ec[_0xfc66('0x1d')][_0xfc66('0x22')]||null:null,'include':_0x2817ec[_0xfc66('0x1d')]?_0x2817ec[_0xfc66('0x1d')][_0xfc66('0x20')]?_['map'](_0x2817ec[_0xfc66('0x1d')][_0xfc66('0x20')],function(_0x496832){return{'model':db[_0x496832['model']],'as':_0x496832['as'],'attributes':_0x496832['attributes'],'include':_0x496832[_0xfc66('0x20')]?_[_0xfc66('0x1f')](_0x496832[_0xfc66('0x20')],function(_0x5b1752){return{'model':db[_0x5b1752['model']],'as':_0x5b1752['as'],'attributes':_0x5b1752[_0xfc66('0x22')],'include':_0x5b1752[_0xfc66('0x20')]?_[_0xfc66('0x1f')](_0x5b1752['include'],function(_0x528dfc){return{'model':db[_0x528dfc[_0xfc66('0x21')]],'as':_0x528dfc['as'],'attributes':_0x528dfc[_0xfc66('0x22')]};}):[]};}):[]};}):[]:[]})[_0xfc66('0xf')](function(_0x41e572){logger[_0xfc66('0x10')]('ShowFaxQueue',_0x2817ec);logger[_0xfc66('0x13')](_0xfc66('0x23'),_0x2817ec,JSON[_0xfc66('0x14')](_0x41e572));_0x7863b(_0x41e572);})[_0xfc66('0x19')](function(_0x3a787c){logger[_0xfc66('0x15')]('ShowFaxQueue',_0x3a787c[_0xfc66('0x17')],_0x2817ec);_0x209df3(_0x26bd97[_0xfc66('0x15')](0x1f4,_0x3a787c[_0xfc66('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 748f5d4..4fb75db 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 _0xf274=['update','removeListener','register','length','./faxQueue.events','save','remove'];(function(_0x4e4989,_0x3c3d9e){var _0x4dabe5=function(_0x288f5b){while(--_0x288f5b){_0x4e4989['push'](_0x4e4989['shift']());}};_0x4dabe5(++_0x3c3d9e);}(_0xf274,0x1ee));var _0x4f27=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0xf274[_0x39c734];return _0xb2a2f9;};'use strict';var FaxQueueEvents=require(_0x4f27('0x0'));var events=[_0x4f27('0x1'),_0x4f27('0x2'),_0x4f27('0x3')];function createListener(_0x13aee8,_0x15b21e){return function(_0x26e6a9){_0x15b21e['emit'](_0x13aee8,_0x26e6a9);};}function removeListener(_0x36570a,_0xd8cdf8){return function(){FaxQueueEvents[_0x4f27('0x4')](_0x36570a,_0xd8cdf8);};}exports[_0x4f27('0x5')]=function(_0x5b7022){for(var _0x441cf3=0x0,_0x19ac13=events[_0x4f27('0x6')];_0x441cf3<_0x19ac13;_0x441cf3++){var _0x428fd8=events[_0x441cf3];var _0x543b83=createListener('faxQueue:'+_0x428fd8,_0x5b7022);FaxQueueEvents['on'](_0x428fd8,_0x543b83);}}; \ No newline at end of file +var _0x4e56=['faxQueue:','./faxQueue.events','save','remove','emit','register','length'];(function(_0x292ed7,_0x4fe68e){var _0xcfb8a0=function(_0x4d133e){while(--_0x4d133e){_0x292ed7['push'](_0x292ed7['shift']());}};_0xcfb8a0(++_0x4fe68e);}(_0x4e56,0x1f2));var _0x64e5=function(_0x4c2ea0,_0x40fe9e){_0x4c2ea0=_0x4c2ea0-0x0;var _0xcf8096=_0x4e56[_0x4c2ea0];return _0xcf8096;};'use strict';var FaxQueueEvents=require(_0x64e5('0x0'));var events=[_0x64e5('0x1'),_0x64e5('0x2'),'update'];function createListener(_0x449754,_0x9fb525){return function(_0x282cf8){_0x9fb525[_0x64e5('0x3')](_0x449754,_0x282cf8);};}function removeListener(_0x25ce3d,_0x192ef3){return function(){FaxQueueEvents['removeListener'](_0x25ce3d,_0x192ef3);};}exports[_0x64e5('0x4')]=function(_0x335ef4){for(var _0x532f42=0x0,_0x280e00=events[_0x64e5('0x5')];_0x532f42<_0x280e00;_0x532f42++){var _0x52e941=events[_0x532f42];var _0x3ffc9d=createListener(_0x64e5('0x6')+_0x52e941,_0x335ef4);FaxQueueEvents['on'](_0x52e941,_0x3ffc9d);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index ba84ca8..9e3bad5 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 _0xd98a=['get','/describe','isAuthenticated','describe','/:id','getTeams','/:id/users','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','index'];(function(_0x3b9fbe,_0x193298){var _0x309bd1=function(_0x28aa42){while(--_0x28aa42){_0x3b9fbe['push'](_0x3b9fbe['shift']());}};_0x309bd1(++_0x193298);}(_0xd98a,0xfc));var _0xad98=function(_0x227e46,_0x5a362f){_0x227e46=_0x227e46-0x0;var _0x3f7de0=_0xd98a[_0x227e46];return _0x3f7de0;};'use strict';var multer=require(_0xad98('0x0'));var util=require('util');var path=require('path');var express=require(_0xad98('0x1'));var router=express[_0xad98('0x2')]();var auth=require(_0xad98('0x3'));var interaction=require(_0xad98('0x4'));var config=require(_0xad98('0x5'));var controller=require(_0xad98('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xad98('0x7')]);router[_0xad98('0x8')](_0xad98('0x9'),auth[_0xad98('0xa')](),controller[_0xad98('0xb')]);router['get'](_0xad98('0xc'),auth[_0xad98('0xa')](),controller['show']);router[_0xad98('0x8')]('/:id/members',auth[_0xad98('0xa')](),controller['getMembers']);router['get']('/:id/teams',auth[_0xad98('0xa')](),controller[_0xad98('0xd')]);router[_0xad98('0x8')](_0xad98('0xe'),auth['isAuthenticated'](),controller['getAgents']);router[_0xad98('0xf')]('/',auth[_0xad98('0xa')](),controller[_0xad98('0x10')]);router[_0xad98('0xf')](_0xad98('0x11'),auth[_0xad98('0xa')](),controller[_0xad98('0x12')]);router[_0xad98('0xf')](_0xad98('0xe'),auth['isAuthenticated'](),controller[_0xad98('0x13')]);router[_0xad98('0x14')](_0xad98('0xc'),auth[_0xad98('0xa')](),controller[_0xad98('0x15')]);router[_0xad98('0x16')](_0xad98('0xc'),auth[_0xad98('0xa')](),controller[_0xad98('0x17')]);router['delete']('/:id/teams',auth[_0xad98('0xa')](),controller['removeTeams']);router[_0xad98('0x16')](_0xad98('0xe'),auth[_0xad98('0xa')](),controller[_0xad98('0x18')]);module[_0xad98('0x19')]=router; \ No newline at end of file +var _0x9672=['destroy','delete','removeTeams','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams','post','put'];(function(_0x182119,_0x7dcec2){var _0x4ae2b6=function(_0x225a99){while(--_0x225a99){_0x182119['push'](_0x182119['shift']());}};_0x4ae2b6(++_0x7dcec2);}(_0x9672,0xee));var _0x2967=function(_0x20ff3e,_0x8163ae){_0x20ff3e=_0x20ff3e-0x0;var _0xf246ad=_0x9672[_0x20ff3e];return _0xf246ad;};'use strict';var multer=require(_0x2967('0x0'));var util=require(_0x2967('0x1'));var path=require('path');var express=require(_0x2967('0x2'));var router=express[_0x2967('0x3')]();var auth=require(_0x2967('0x4'));var interaction=require(_0x2967('0x5'));var config=require('../../config/environment');var controller=require(_0x2967('0x6'));router[_0x2967('0x7')]('/',auth[_0x2967('0x8')](),controller['index']);router['get'](_0x2967('0x9'),auth[_0x2967('0x8')](),controller[_0x2967('0xa')]);router[_0x2967('0x7')](_0x2967('0xb'),auth[_0x2967('0x8')](),controller[_0x2967('0xc')]);router[_0x2967('0x7')]('/:id/members',auth[_0x2967('0x8')](),controller[_0x2967('0xd')]);router[_0x2967('0x7')](_0x2967('0xe'),auth[_0x2967('0x8')](),controller[_0x2967('0xf')]);router['get'](_0x2967('0x10'),auth['isAuthenticated'](),controller[_0x2967('0x11')]);router['post']('/',auth[_0x2967('0x8')](),controller[_0x2967('0x12')]);router['post'](_0x2967('0xe'),auth['isAuthenticated'](),controller[_0x2967('0x13')]);router[_0x2967('0x14')](_0x2967('0x10'),auth['isAuthenticated'](),controller['addAgents']);router[_0x2967('0x15')](_0x2967('0xb'),auth[_0x2967('0x8')](),controller['update']);router['delete'](_0x2967('0xb'),auth[_0x2967('0x8')](),controller[_0x2967('0x16')]);router[_0x2967('0x17')](_0x2967('0xe'),auth[_0x2967('0x8')](),controller[_0x2967('0x18')]);router[_0x2967('0x17')](_0x2967('0x10'),auth[_0x2967('0x8')](),controller['removeAgents']);module[_0x2967('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index d6cdb96..ae886f5 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 _0x3076=['exports','DATE','STRING','sequelize'];(function(_0x34048f,_0x5f11bf){var _0x4d2ce7=function(_0x307a5d){while(--_0x307a5d){_0x34048f['push'](_0x34048f['shift']());}};_0x4d2ce7(++_0x5f11bf);}(_0x3076,0x193));var _0x6307=function(_0x22bdd3,_0x552e50){_0x22bdd3=_0x22bdd3-0x0;var _0x44d9d9=_0x3076[_0x22bdd3];return _0x44d9d9;};'use strict';var moment=require('moment');var Sequelize=require(_0x6307('0x0'));module[_0x6307('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x6307('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x6307('0x2')]},'exitAt':{'type':Sequelize[_0x6307('0x2')]},'reason':{'type':Sequelize[_0x6307('0x3')]}}; \ No newline at end of file +var _0x85eb=['sequelize','exports','STRING','DATE'];(function(_0x2dbcf0,_0x1c9ce9){var _0x185a15=function(_0x51b059){while(--_0x51b059){_0x2dbcf0['push'](_0x2dbcf0['shift']());}};_0x185a15(++_0x1c9ce9);}(_0x85eb,0xc0));var _0xb85e=function(_0x2127c8,_0x30add1){_0x2127c8=_0x2127c8-0x0;var _0x32748e=_0x85eb[_0x2127c8];return _0x32748e;};'use strict';var moment=require('moment');var Sequelize=require(_0xb85e('0x0'));module[_0xb85e('0x1')]={'uniqueid':{'type':Sequelize[_0xb85e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb85e('0x2')]},'joinAt':{'type':Sequelize[_0xb85e('0x3')]},'leaveAt':{'type':Sequelize[_0xb85e('0x3')]},'acceptAt':{'type':Sequelize[_0xb85e('0x3')]},'exitAt':{'type':Sequelize[_0xb85e('0x3')]},'reason':{'type':Sequelize[_0xb85e('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 9bd5f86..c84cb88 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 _0xca9b=['reject','save','update','error','stack','name','send','index','FaxQueueReport','model','query','dateStart','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','dateEnd','add','day','merge','filter','map','options','count','then','includeAll','include','findAll','catch','show','params','rawAttributes','find','body','describe','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xca9b,0xb4));var _0xbca9=function(_0x223689,_0x852368){_0x223689=_0x223689-0x0;var _0x71e743=_0xca9b[_0x223689];return _0x71e743;};'use strict';var jsonpatch=require(_0xbca9('0x0'));var rp=require('request-promise');var moment=require(_0xbca9('0x1'));var BPromise=require(_0xbca9('0x2'));var Mustache=require('mustache');var util=require(_0xbca9('0x3'));var path=require(_0xbca9('0x4'));var sox=require('sox');var csv=require(_0xbca9('0x5'));var ejs=require(_0xbca9('0x6'));var fs=require('fs');var _=require(_0xbca9('0x7'));var squel=require(_0xbca9('0x8'));var crypto=require(_0xbca9('0x9'));var jsforce=require(_0xbca9('0xa'));var deskjs=require(_0xbca9('0xb'));var toCsv=require(_0xbca9('0x5'));var querystring=require(_0xbca9('0xc'));var Papa=require(_0xbca9('0xd'));var qs=require(_0xbca9('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0xbca9('0xf'));var config=require(_0xbca9('0x10'));var db=require(_0xbca9('0x11'))['db'];function respondWithStatusCode(_0x10878e,_0x2cb7f4){_0x2cb7f4=_0x2cb7f4||0xcc;return function(_0x26841e){if(_0x26841e){return _0x10878e[_0xbca9('0x12')](_0x2cb7f4);}return _0x10878e[_0xbca9('0x13')](_0x2cb7f4)[_0xbca9('0x14')]();};}function respondWithResult(_0x567bf9,_0x25d70a){_0x25d70a=_0x25d70a||0xc8;return function(_0x37eda1){if(_0x37eda1){return _0x567bf9[_0xbca9('0x13')](_0x25d70a)[_0xbca9('0x15')](_0x37eda1);}};}function respondWithFilteredResult(_0x22bd1f,_0x443cb0){return function(_0x1780be){if(_0x1780be){var _0x4e7f5f=_0x1780be['count'],_0x16903e=_0x443cb0[_0xbca9('0x16')],_0x50a187=_0x443cb0['offset']+_0x443cb0[_0xbca9('0x17')],_0x4b6b21;if(_0x50a187>=_0x4e7f5f){_0x50a187=_0x4e7f5f;_0x4b6b21=0xc8;}else{_0x4b6b21=0xce;}_0x22bd1f[_0xbca9('0x13')](_0x4b6b21);return _0x22bd1f[_0xbca9('0x18')](_0xbca9('0x19'),_0x16903e+'-'+_0x50a187+'/'+_0x4e7f5f)['json'](_0x1780be);}return null;};}function patchUpdates(_0x551f56){return function(_0xd3b676){try{jsonpatch[_0xbca9('0x1a')](_0xd3b676,_0x551f56,!![]);}catch(_0x2ff72d){return BPromise[_0xbca9('0x1b')](_0x2ff72d);}return _0xd3b676[_0xbca9('0x1c')]();};}function saveUpdates(_0x55aafa,_0x1b7a2b){return function(_0x596e77){if(_0x596e77){return _0x596e77[_0xbca9('0x1d')](_0x55aafa)['then'](function(_0x1eb5f3){return _0x1eb5f3;});}return null;};}function removeEntity(_0x2da435,_0x227c40){return function(_0x4a12e5){if(_0x4a12e5){return _0x4a12e5['destroy']()['then'](function(){_0x2da435[_0xbca9('0x13')](0xcc)[_0xbca9('0x14')]();});}};}function handleEntityNotFound(_0x46b91a,_0x255be7){return function(_0xdefe2e){if(!_0xdefe2e){_0x46b91a[_0xbca9('0x12')](0x194);}return _0xdefe2e;};}function handleError(_0x144bad,_0x39303f){_0x39303f=_0x39303f||0x1f4;return function(_0x3b699c){logger[_0xbca9('0x1e')](_0x3b699c[_0xbca9('0x1f')]);if(_0x3b699c[_0xbca9('0x20')]){delete _0x3b699c[_0xbca9('0x20')];}_0x144bad[_0xbca9('0x13')](_0x39303f)[_0xbca9('0x21')](_0x3b699c);};}exports[_0xbca9('0x22')]=function(_0x55a38b,_0x2060b5){var _0x43585f={},_0x3f638b={},_0x95f1c3={'count':0x0,'rows':[]};var _0x20bb63=db[_0xbca9('0x23')]['rawAttributes'];_0x3f638b[_0xbca9('0x24')]=_['keys'](_0x20bb63);var _0x2b92e5={'dateStart':_0x55a38b[_0xbca9('0x25')][_0xbca9('0x26')],'dateEnd':_0x55a38b[_0xbca9('0x25')]['dateEnd']};delete _0x55a38b[_0xbca9('0x25')][_0xbca9('0x26')];delete _0x55a38b[_0xbca9('0x25')]['dateEnd'];_0x3f638b[_0xbca9('0x25')]=_[_0xbca9('0x27')](_0x55a38b[_0xbca9('0x25')]);_0x3f638b[_0xbca9('0x28')]=_['intersection'](_0x3f638b[_0xbca9('0x24')],_0x3f638b[_0xbca9('0x25')]);_0x43585f['attributes']=_[_0xbca9('0x29')](_0x3f638b[_0xbca9('0x24')],qs[_0xbca9('0x2a')](_0x55a38b[_0xbca9('0x25')][_0xbca9('0x2a')]));_0x43585f['attributes']=_0x43585f[_0xbca9('0x2b')][_0xbca9('0x2c')]?_0x43585f[_0xbca9('0x2b')]:_0x3f638b[_0xbca9('0x24')];if(!_0x55a38b[_0xbca9('0x25')]['hasOwnProperty'](_0xbca9('0x2d'))){_0x43585f['limit']=qs[_0xbca9('0x17')](_0x55a38b['query'][_0xbca9('0x17')]);_0x43585f[_0xbca9('0x16')]=qs[_0xbca9('0x16')](_0x55a38b[_0xbca9('0x25')]['offset']);}_0x43585f[_0xbca9('0x2e')]=qs[_0xbca9('0x2f')](_0x55a38b[_0xbca9('0x25')][_0xbca9('0x2f')]);_0x43585f[_0xbca9('0x30')]=qs['filters'](_[_0xbca9('0x31')](_0x55a38b[_0xbca9('0x25')],_0x3f638b[_0xbca9('0x28')]));if(_0x2b92e5[_0xbca9('0x26')]){if(_0x2b92e5[_0xbca9('0x32')]){_0x2b92e5['dateEnd']=moment(_0x2b92e5[_0xbca9('0x32')])[_0xbca9('0x33')](0x1,_0xbca9('0x34'));}else{_0x2b92e5[_0xbca9('0x32')]=moment(_0x2b92e5[_0xbca9('0x26')])[_0xbca9('0x33')](0x1,_0xbca9('0x34'));}_[_0xbca9('0x35')](_0x43585f[_0xbca9('0x30')],{'createdAt':{'$gte':_0x2b92e5[_0xbca9('0x26')],'$lte':_0x2b92e5[_0xbca9('0x32')]}});}if(_0x55a38b['query'][_0xbca9('0x36')]){_0x43585f['where']=_['merge'](_0x43585f[_0xbca9('0x30')],{'$or':_[_0xbca9('0x37')](_0x43585f[_0xbca9('0x2b')],function(_0x57d6f9){var _0x441c76={};_0x441c76[_0x57d6f9]={'$like':'%'+_0x55a38b[_0xbca9('0x25')]['filter']+'%'};return _0x441c76;})});}_0x43585f=_['merge']({},_0x43585f,_0x55a38b[_0xbca9('0x38')]);var _0x254bed={'where':_0x43585f[_0xbca9('0x30')]};return db['FaxQueueReport'][_0xbca9('0x39')](_0x254bed)[_0xbca9('0x3a')](function(_0x104308){_0x95f1c3[_0xbca9('0x39')]=_0x104308;if(_0x55a38b[_0xbca9('0x25')][_0xbca9('0x3b')]){_0x43585f[_0xbca9('0x3c')]=[{'all':!![]}];}return db['FaxQueueReport'][_0xbca9('0x3d')](_0x43585f);})[_0xbca9('0x3a')](function(_0x1ccdb2){_0x95f1c3['rows']=_0x1ccdb2;return _0x95f1c3;})[_0xbca9('0x3a')](respondWithFilteredResult(_0x2060b5,_0x43585f))[_0xbca9('0x3e')](handleError(_0x2060b5,null));};exports[_0xbca9('0x3f')]=function(_0x562dd6,_0x582913){var _0x123251={'raw':!![],'where':{'id':_0x562dd6[_0xbca9('0x40')]['id']}},_0x4ee490={};_0x4ee490[_0xbca9('0x24')]=_[_0xbca9('0x27')](db[_0xbca9('0x23')][_0xbca9('0x41')]);_0x4ee490[_0xbca9('0x25')]=_[_0xbca9('0x27')](_0x562dd6[_0xbca9('0x25')]);_0x4ee490['filters']=_[_0xbca9('0x29')](_0x4ee490[_0xbca9('0x24')],_0x4ee490['query']);_0x123251[_0xbca9('0x2b')]=_['intersection'](_0x4ee490['model'],qs[_0xbca9('0x2a')](_0x562dd6[_0xbca9('0x25')][_0xbca9('0x2a')]));_0x123251[_0xbca9('0x2b')]=_0x123251[_0xbca9('0x2b')][_0xbca9('0x2c')]?_0x123251[_0xbca9('0x2b')]:_0x4ee490[_0xbca9('0x24')];if(_0x562dd6[_0xbca9('0x25')][_0xbca9('0x3b')]){_0x123251[_0xbca9('0x3c')]=[{'all':!![]}];}_0x123251=_[_0xbca9('0x35')]({},_0x123251,_0x562dd6['options']);return db[_0xbca9('0x23')][_0xbca9('0x42')](_0x123251)[_0xbca9('0x3a')](handleEntityNotFound(_0x582913,null))[_0xbca9('0x3a')](respondWithResult(_0x582913,null))[_0xbca9('0x3e')](handleError(_0x582913,null));};exports['create']=function(_0x258b00,_0xa3baf0){return db[_0xbca9('0x23')]['create'](_0x258b00['body'],{})[_0xbca9('0x3a')](respondWithResult(_0xa3baf0,0xc9))['catch'](handleError(_0xa3baf0,null));};exports[_0xbca9('0x1d')]=function(_0x418ac5,_0x5b29ef){if(_0x418ac5[_0xbca9('0x43')]['id']){delete _0x418ac5['body']['id'];}return db['FaxQueueReport'][_0xbca9('0x42')]({'where':{'id':_0x418ac5[_0xbca9('0x40')]['id']}})[_0xbca9('0x3a')](handleEntityNotFound(_0x5b29ef,null))[_0xbca9('0x3a')](saveUpdates(_0x418ac5[_0xbca9('0x43')],null))[_0xbca9('0x3a')](respondWithResult(_0x5b29ef,null))[_0xbca9('0x3e')](handleError(_0x5b29ef,null));};exports['destroy']=function(_0x1df081,_0x3ad187){return db[_0xbca9('0x23')][_0xbca9('0x42')]({'where':{'id':_0x1df081[_0xbca9('0x40')]['id']}})[_0xbca9('0x3a')](handleEntityNotFound(_0x3ad187,null))[_0xbca9('0x3a')](removeEntity(_0x3ad187,null))[_0xbca9('0x3e')](handleError(_0x3ad187,null));};exports[_0xbca9('0x44')]=function(_0x14c2a3,_0x1239b1){return db[_0xbca9('0x23')][_0xbca9('0x44')]()[_0xbca9('0x3a')](respondWithResult(_0x1239b1,null))[_0xbca9('0x3e')](handleError(_0x1239b1,null));}; \ No newline at end of file +var _0x75b0=['query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','day','add','merge','filter','map','FaxQueueReport','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','destroy','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','save','update','then','end','stack','name','send','index','model','keys'];(function(_0x3cadff,_0xf88fa1){var _0x6c9fbe=function(_0x2fc9d4){while(--_0x2fc9d4){_0x3cadff['push'](_0x3cadff['shift']());}};_0x6c9fbe(++_0xf88fa1);}(_0x75b0,0x1cb));var _0x075b=function(_0x58788b,_0x1ab00b){_0x58788b=_0x58788b-0x0;var _0x13435c=_0x75b0[_0x58788b];return _0x13435c;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x075b('0x0'));var moment=require(_0x075b('0x1'));var BPromise=require(_0x075b('0x2'));var Mustache=require('mustache');var util=require(_0x075b('0x3'));var path=require(_0x075b('0x4'));var sox=require(_0x075b('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x075b('0x6'));var squel=require(_0x075b('0x7'));var crypto=require(_0x075b('0x8'));var jsforce=require(_0x075b('0x9'));var deskjs=require(_0x075b('0xa'));var toCsv=require(_0x075b('0xb'));var querystring=require(_0x075b('0xc'));var Papa=require(_0x075b('0xd'));var qs=require(_0x075b('0xe'));var logger=require(_0x075b('0xf'))(_0x075b('0x10'));var utils=require(_0x075b('0x11'));var config=require(_0x075b('0x12'));var db=require(_0x075b('0x13'))['db'];function respondWithStatusCode(_0x29a24b,_0x27904a){_0x27904a=_0x27904a||0xcc;return function(_0x1db467){if(_0x1db467){return _0x29a24b[_0x075b('0x14')](_0x27904a);}return _0x29a24b[_0x075b('0x15')](_0x27904a)['end']();};}function respondWithResult(_0x598fcd,_0x252192){_0x252192=_0x252192||0xc8;return function(_0x2cc82f){if(_0x2cc82f){return _0x598fcd['status'](_0x252192)[_0x075b('0x16')](_0x2cc82f);}};}function respondWithFilteredResult(_0x422e67,_0x10125a){return function(_0x25b7a8){if(_0x25b7a8){var _0x182bc6=_0x25b7a8[_0x075b('0x17')],_0x432f30=_0x10125a[_0x075b('0x18')],_0x33b4f8=_0x10125a['offset']+_0x10125a[_0x075b('0x19')],_0x16663e;if(_0x33b4f8>=_0x182bc6){_0x33b4f8=_0x182bc6;_0x16663e=0xc8;}else{_0x16663e=0xce;}_0x422e67[_0x075b('0x15')](_0x16663e);return _0x422e67[_0x075b('0x1a')]('Content-Range',_0x432f30+'-'+_0x33b4f8+'/'+_0x182bc6)['json'](_0x25b7a8);}return null;};}function patchUpdates(_0x19301c){return function(_0x3cc276){try{jsonpatch[_0x075b('0x1b')](_0x3cc276,_0x19301c,!![]);}catch(_0x10f234){return BPromise['reject'](_0x10f234);}return _0x3cc276[_0x075b('0x1c')]();};}function saveUpdates(_0x29bde3,_0x4176b7){return function(_0x1b79bb){if(_0x1b79bb){return _0x1b79bb[_0x075b('0x1d')](_0x29bde3)[_0x075b('0x1e')](function(_0x3eebd6){return _0x3eebd6;});}return null;};}function removeEntity(_0x18f253,_0x3e284c){return function(_0x2de699){if(_0x2de699){return _0x2de699['destroy']()[_0x075b('0x1e')](function(){_0x18f253['status'](0xcc)[_0x075b('0x1f')]();});}};}function handleEntityNotFound(_0x85cdc0,_0x20f345){return function(_0x55042b){if(!_0x55042b){_0x85cdc0[_0x075b('0x14')](0x194);}return _0x55042b;};}function handleError(_0x26cd0f,_0x2bdd63){_0x2bdd63=_0x2bdd63||0x1f4;return function(_0x53912c){logger['error'](_0x53912c[_0x075b('0x20')]);if(_0x53912c['name']){delete _0x53912c[_0x075b('0x21')];}_0x26cd0f[_0x075b('0x15')](_0x2bdd63)[_0x075b('0x22')](_0x53912c);};}exports[_0x075b('0x23')]=function(_0x2191b5,_0x21e4b4){var _0x407a21={},_0x2a296d={},_0x56d5f9={'count':0x0,'rows':[]};var _0x22a86f=db['FaxQueueReport']['rawAttributes'];_0x2a296d[_0x075b('0x24')]=_[_0x075b('0x25')](_0x22a86f);var _0x552dac={'dateStart':_0x2191b5[_0x075b('0x26')][_0x075b('0x27')],'dateEnd':_0x2191b5['query'][_0x075b('0x28')]};delete _0x2191b5[_0x075b('0x26')][_0x075b('0x27')];delete _0x2191b5[_0x075b('0x26')]['dateEnd'];_0x2a296d[_0x075b('0x26')]=_[_0x075b('0x25')](_0x2191b5['query']);_0x2a296d[_0x075b('0x29')]=_[_0x075b('0x2a')](_0x2a296d['model'],_0x2a296d[_0x075b('0x26')]);_0x407a21[_0x075b('0x2b')]=_[_0x075b('0x2a')](_0x2a296d['model'],qs['fields'](_0x2191b5['query'][_0x075b('0x2c')]));_0x407a21[_0x075b('0x2b')]=_0x407a21[_0x075b('0x2b')][_0x075b('0x2d')]?_0x407a21[_0x075b('0x2b')]:_0x2a296d[_0x075b('0x24')];if(!_0x2191b5['query'][_0x075b('0x2e')](_0x075b('0x2f'))){_0x407a21[_0x075b('0x19')]=qs[_0x075b('0x19')](_0x2191b5['query']['limit']);_0x407a21[_0x075b('0x18')]=qs[_0x075b('0x18')](_0x2191b5[_0x075b('0x26')][_0x075b('0x18')]);}_0x407a21[_0x075b('0x30')]=qs[_0x075b('0x31')](_0x2191b5[_0x075b('0x26')][_0x075b('0x31')]);_0x407a21[_0x075b('0x32')]=qs['filters'](_[_0x075b('0x33')](_0x2191b5[_0x075b('0x26')],_0x2a296d[_0x075b('0x29')]));if(_0x552dac[_0x075b('0x27')]){if(_0x552dac[_0x075b('0x28')]){_0x552dac[_0x075b('0x28')]=moment(_0x552dac['dateEnd'])['add'](0x1,_0x075b('0x34'));}else{_0x552dac[_0x075b('0x28')]=moment(_0x552dac[_0x075b('0x27')])[_0x075b('0x35')](0x1,_0x075b('0x34'));}_[_0x075b('0x36')](_0x407a21[_0x075b('0x32')],{'createdAt':{'$gte':_0x552dac['dateStart'],'$lte':_0x552dac['dateEnd']}});}if(_0x2191b5['query'][_0x075b('0x37')]){_0x407a21[_0x075b('0x32')]=_[_0x075b('0x36')](_0x407a21[_0x075b('0x32')],{'$or':_[_0x075b('0x38')](_0x407a21['attributes'],function(_0x83126e){var _0x225d0b={};_0x225d0b[_0x83126e]={'$like':'%'+_0x2191b5[_0x075b('0x26')][_0x075b('0x37')]+'%'};return _0x225d0b;})});}_0x407a21=_[_0x075b('0x36')]({},_0x407a21,_0x2191b5['options']);var _0x15a437={'where':_0x407a21[_0x075b('0x32')]};return db[_0x075b('0x39')][_0x075b('0x17')](_0x15a437)['then'](function(_0x4950ed){_0x56d5f9[_0x075b('0x17')]=_0x4950ed;if(_0x2191b5[_0x075b('0x26')][_0x075b('0x3a')]){_0x407a21['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0x075b('0x3b')](_0x407a21);})[_0x075b('0x1e')](function(_0x144e32){_0x56d5f9[_0x075b('0x3c')]=_0x144e32;return _0x56d5f9;})[_0x075b('0x1e')](respondWithFilteredResult(_0x21e4b4,_0x407a21))[_0x075b('0x3d')](handleError(_0x21e4b4,null));};exports[_0x075b('0x3e')]=function(_0x1f3598,_0x14b57e){var _0x4d9dcb={'raw':!![],'where':{'id':_0x1f3598[_0x075b('0x3f')]['id']}},_0xe499c0={};_0xe499c0['model']=_[_0x075b('0x25')](db[_0x075b('0x39')][_0x075b('0x40')]);_0xe499c0[_0x075b('0x26')]=_[_0x075b('0x25')](_0x1f3598[_0x075b('0x26')]);_0xe499c0[_0x075b('0x29')]=_[_0x075b('0x2a')](_0xe499c0[_0x075b('0x24')],_0xe499c0[_0x075b('0x26')]);_0x4d9dcb[_0x075b('0x2b')]=_[_0x075b('0x2a')](_0xe499c0['model'],qs[_0x075b('0x2c')](_0x1f3598[_0x075b('0x26')]['fields']));_0x4d9dcb[_0x075b('0x2b')]=_0x4d9dcb['attributes']['length']?_0x4d9dcb[_0x075b('0x2b')]:_0xe499c0[_0x075b('0x24')];if(_0x1f3598['query'][_0x075b('0x3a')]){_0x4d9dcb[_0x075b('0x41')]=[{'all':!![]}];}_0x4d9dcb=_['merge']({},_0x4d9dcb,_0x1f3598[_0x075b('0x42')]);return db[_0x075b('0x39')][_0x075b('0x43')](_0x4d9dcb)[_0x075b('0x1e')](handleEntityNotFound(_0x14b57e,null))[_0x075b('0x1e')](respondWithResult(_0x14b57e,null))['catch'](handleError(_0x14b57e,null));};exports[_0x075b('0x44')]=function(_0x1c07c4,_0x2aa861){return db[_0x075b('0x39')][_0x075b('0x44')](_0x1c07c4['body'],{})['then'](respondWithResult(_0x2aa861,0xc9))['catch'](handleError(_0x2aa861,null));};exports[_0x075b('0x1d')]=function(_0x4c3cbb,_0x273355){if(_0x4c3cbb['body']['id']){delete _0x4c3cbb[_0x075b('0x45')]['id'];}return db[_0x075b('0x39')][_0x075b('0x43')]({'where':{'id':_0x4c3cbb[_0x075b('0x3f')]['id']}})[_0x075b('0x1e')](handleEntityNotFound(_0x273355,null))[_0x075b('0x1e')](saveUpdates(_0x4c3cbb['body'],null))[_0x075b('0x1e')](respondWithResult(_0x273355,null))[_0x075b('0x3d')](handleError(_0x273355,null));};exports[_0x075b('0x46')]=function(_0x29a30e,_0x258d5a){return db[_0x075b('0x39')][_0x075b('0x43')]({'where':{'id':_0x29a30e[_0x075b('0x3f')]['id']}})[_0x075b('0x1e')](handleEntityNotFound(_0x258d5a,null))[_0x075b('0x1e')](removeEntity(_0x258d5a,null))[_0x075b('0x3d')](handleError(_0x258d5a,null));};exports['describe']=function(_0x41ef04,_0x538239){return db['FaxQueueReport']['describe']()[_0x075b('0x1e')](respondWithResult(_0x538239,null))['catch'](handleError(_0x538239,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index d2d512d..482677a 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 _0x1047=['./faxQueueReport.attributes','exports','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x1047,0x11c));var _0x7104=function(_0x27b295,_0x17f598){_0x27b295=_0x27b295-0x0;var _0xd79398=_0x1047[_0x27b295];return _0xd79398;};'use strict';var _=require(_0x7104('0x0'));var util=require(_0x7104('0x1'));var logger=require(_0x7104('0x2'))(_0x7104('0x3'));var moment=require('moment');var BPromise=require(_0x7104('0x4'));var rp=require(_0x7104('0x5'));var attributes=require(_0x7104('0x6'));module[_0x7104('0x7')]=function(_0x2db81c,_0x3e2147){return _0x2db81c['define']('FaxQueueReport',attributes,{'tableName':_0x7104('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7104('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x50e7=['api','moment','bluebird','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger'];(function(_0x3cdcfb,_0x161e5c){var _0x59f5da=function(_0x337416){while(--_0x337416){_0x3cdcfb['push'](_0x3cdcfb['shift']());}};_0x59f5da(++_0x161e5c);}(_0x50e7,0xd9));var _0x750e=function(_0x5bbe4d,_0x17af4f){_0x5bbe4d=_0x5bbe4d-0x0;var _0xaafc80=_0x50e7[_0x5bbe4d];return _0xaafc80;};'use strict';var _=require(_0x750e('0x0'));var util=require(_0x750e('0x1'));var logger=require(_0x750e('0x2'))(_0x750e('0x3'));var moment=require(_0x750e('0x4'));var BPromise=require(_0x750e('0x5'));var rp=require('request-promise');var attributes=require(_0x750e('0x6'));module[_0x750e('0x7')]=function(_0x217fa3,_0x49a6ed){return _0x217fa3['define'](_0x750e('0x8'),attributes,{'tableName':_0x750e('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 529659b..470b8ac 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 _0xb0fd=['../../config/logger','rpc','jayson/promise','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateFaxQueueReport','create','options','raw','UpdateFaxQueueReport','update','body','stringify','lodash','util','moment','bluebird','../../config/utils'];(function(_0x1baef6,_0x104b34){var _0x5f34a6=function(_0x4db449){while(--_0x4db449){_0x1baef6['push'](_0x1baef6['shift']());}};_0x5f34a6(++_0x104b34);}(_0xb0fd,0xdb));var _0xdb0f=function(_0x4c06a3,_0x1e6b6f){_0x4c06a3=_0x4c06a3-0x0;var _0x7ff53c=_0xb0fd[_0x4c06a3];return _0x7ff53c;};'use strict';var _=require(_0xdb0f('0x0'));var util=require(_0xdb0f('0x1'));var moment=require(_0xdb0f('0x2'));var BPromise=require(_0xdb0f('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xdb0f('0x4'));var logger=require(_0xdb0f('0x5'))(_0xdb0f('0x6'));var config=require('../../config/environment');var jayson=require(_0xdb0f('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26fb06,_0x58646e,_0x2b5954){return new BPromise(function(_0x4a2946,_0x588977){return client[_0xdb0f('0x8')](_0x26fb06,_0x2b5954)[_0xdb0f('0x9')](function(_0x454809){logger[_0xdb0f('0xa')](_0xdb0f('0xb'),_0x58646e,_0xdb0f('0xc'));logger[_0xdb0f('0xd')](_0xdb0f('0xe'),_0x58646e,_0xdb0f('0xc'),JSON['stringify'](_0x454809));if(_0x454809[_0xdb0f('0xf')]){if(_0x454809[_0xdb0f('0xf')][_0xdb0f('0x10')]===0x1f4){logger[_0xdb0f('0xf')](_0xdb0f('0xb'),_0x58646e,_0x454809['error']['message']);return _0x588977(_0x454809[_0xdb0f('0xf')][_0xdb0f('0x11')]);}logger['error'](_0xdb0f('0xb'),_0x58646e,_0x454809['error'][_0xdb0f('0x11')]);return _0x4a2946(_0x454809[_0xdb0f('0xf')][_0xdb0f('0x11')]);}else{logger[_0xdb0f('0xa')](_0xdb0f('0xb'),_0x58646e,_0xdb0f('0xc'));_0x4a2946(_0x454809[_0xdb0f('0x12')]['message']);}})[_0xdb0f('0x13')](function(_0x1c9ebb){logger['error'](_0xdb0f('0xb'),_0x58646e,_0x1c9ebb);_0x588977(_0x1c9ebb);});});}exports[_0xdb0f('0x14')]=function(_0x527d47){var _0x4b2650=this;return new Promise(function(_0x637e3f,_0x5dbeb4){return db['FaxQueueReport'][_0xdb0f('0x15')](_0x527d47['body'],{'raw':_0x527d47[_0xdb0f('0x16')]?_0x527d47[_0xdb0f('0x16')][_0xdb0f('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x3d340c){logger['info'](_0xdb0f('0x14'),_0x527d47);logger[_0xdb0f('0xd')]('CreateFaxQueueReport',_0x527d47,JSON['stringify'](_0x3d340c));_0x637e3f(_0x3d340c);})['catch'](function(_0x43bc11){logger[_0xdb0f('0xf')](_0xdb0f('0x14'),_0x43bc11['message'],_0x527d47);_0x5dbeb4(_0x4b2650['error'](0x1f4,_0x43bc11['message']));});});};exports[_0xdb0f('0x18')]=function(_0xa8b1c4){var _0x1d21ea=this;return new Promise(function(_0x39edb8,_0x39c623){return db['FaxQueueReport'][_0xdb0f('0x19')](_0xa8b1c4[_0xdb0f('0x1a')],{'raw':_0xa8b1c4[_0xdb0f('0x16')]?_0xa8b1c4['options'][_0xdb0f('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa8b1c4[_0xdb0f('0x16')]?_0xa8b1c4['options']['where']||null:null,'attributes':_0xa8b1c4['options']?_0xa8b1c4[_0xdb0f('0x16')]['attributes']||null:null,'limit':_0xa8b1c4[_0xdb0f('0x16')]?_0xa8b1c4[_0xdb0f('0x16')]['limit']||null:null})[_0xdb0f('0x9')](function(_0x411db6){logger[_0xdb0f('0xa')](_0xdb0f('0x18'),_0xa8b1c4);logger[_0xdb0f('0xd')]('UpdateFaxQueueReport',_0xa8b1c4,JSON[_0xdb0f('0x1b')](_0x411db6));_0x39edb8(_0x411db6);})[_0xdb0f('0x13')](function(_0x5eb706){logger[_0xdb0f('0xf')](_0xdb0f('0x18'),_0x5eb706['message'],_0xa8b1c4);_0x39c623(_0x1d21ea[_0xdb0f('0xf')](0x1f4,_0x5eb706[_0xdb0f('0x11')]));});});}; \ No newline at end of file +var _0x5f7d=['code','message','info','result','CreateFaxQueueReport','FaxQueueReport','body','raw','debug','catch','UpdateFaxQueueReport','options','where','limit','then','stringify','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x5f7d,0x6d));var _0xd5f7=function(_0x5eed57,_0x224dc5){_0x5eed57=_0x5eed57-0x0;var _0x1ca877=_0x5f7d[_0x5eed57];return _0x1ca877;};'use strict';var _=require(_0xd5f7('0x0'));var util=require(_0xd5f7('0x1'));var moment=require(_0xd5f7('0x2'));var BPromise=require(_0xd5f7('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xd5f7('0x4'))['db'];var utils=require(_0xd5f7('0x5'));var logger=require(_0xd5f7('0x6'))(_0xd5f7('0x7'));var config=require(_0xd5f7('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd5f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4dd30e,_0x346365,_0x583d4d){return new BPromise(function(_0x32e81c,_0x4f365d){return client[_0xd5f7('0xa')](_0x4dd30e,_0x583d4d)['then'](function(_0x18643f){logger['info'](_0xd5f7('0xb'),_0x346365,_0xd5f7('0xc'));logger['debug'](_0xd5f7('0xd'),_0x346365,_0xd5f7('0xc'),JSON['stringify'](_0x18643f));if(_0x18643f[_0xd5f7('0xe')]){if(_0x18643f[_0xd5f7('0xe')][_0xd5f7('0xf')]===0x1f4){logger[_0xd5f7('0xe')](_0xd5f7('0xb'),_0x346365,_0x18643f[_0xd5f7('0xe')][_0xd5f7('0x10')]);return _0x4f365d(_0x18643f[_0xd5f7('0xe')][_0xd5f7('0x10')]);}logger[_0xd5f7('0xe')](_0xd5f7('0xb'),_0x346365,_0x18643f[_0xd5f7('0xe')][_0xd5f7('0x10')]);return _0x32e81c(_0x18643f['error'][_0xd5f7('0x10')]);}else{logger[_0xd5f7('0x11')](_0xd5f7('0xb'),_0x346365,_0xd5f7('0xc'));_0x32e81c(_0x18643f[_0xd5f7('0x12')][_0xd5f7('0x10')]);}})['catch'](function(_0x46997a){logger[_0xd5f7('0xe')](_0xd5f7('0xb'),_0x346365,_0x46997a);_0x4f365d(_0x46997a);});});}exports[_0xd5f7('0x13')]=function(_0x370bc9){var _0x1dd2dc=this;return new Promise(function(_0x41f463,_0x2df270){return db[_0xd5f7('0x14')]['create'](_0x370bc9[_0xd5f7('0x15')],{'raw':_0x370bc9['options']?_0x370bc9['options'][_0xd5f7('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x27d037){logger[_0xd5f7('0x11')]('CreateFaxQueueReport',_0x370bc9);logger[_0xd5f7('0x17')]('CreateFaxQueueReport',_0x370bc9,JSON['stringify'](_0x27d037));_0x41f463(_0x27d037);})[_0xd5f7('0x18')](function(_0x5b4811){logger[_0xd5f7('0xe')](_0xd5f7('0x13'),_0x5b4811[_0xd5f7('0x10')],_0x370bc9);_0x2df270(_0x1dd2dc[_0xd5f7('0xe')](0x1f4,_0x5b4811[_0xd5f7('0x10')]));});});};exports[_0xd5f7('0x19')]=function(_0x117327){var _0x524254=this;return new Promise(function(_0x5a443c,_0x4df605){return db[_0xd5f7('0x14')]['update'](_0x117327[_0xd5f7('0x15')],{'raw':_0x117327[_0xd5f7('0x1a')]?_0x117327[_0xd5f7('0x1a')][_0xd5f7('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x117327[_0xd5f7('0x1a')]?_0x117327['options'][_0xd5f7('0x1b')]||null:null,'attributes':_0x117327[_0xd5f7('0x1a')]?_0x117327[_0xd5f7('0x1a')]['attributes']||null:null,'limit':_0x117327[_0xd5f7('0x1a')]?_0x117327[_0xd5f7('0x1a')][_0xd5f7('0x1c')]||null:null})[_0xd5f7('0x1d')](function(_0x1b7f9c){logger[_0xd5f7('0x11')](_0xd5f7('0x19'),_0x117327);logger[_0xd5f7('0x17')]('UpdateFaxQueueReport',_0x117327,JSON[_0xd5f7('0x1e')](_0x1b7f9c));_0x5a443c(_0x1b7f9c);})[_0xd5f7('0x18')](function(_0x566414){logger['error'](_0xd5f7('0x19'),_0x566414[_0xd5f7('0x10')],_0x117327);_0x4df605(_0x524254['error'](0x1f4,_0x566414['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 8ea1922..a556680 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 _0x8580=['isAuthenticated','get','/describe','/:id','show','post','create','put','update','delete','exports','path','express','Router','../../components/auth/service','../../config/environment','./faxQueueReport.controller'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x8580,0x192));var _0x0858=function(_0x1f0add,_0x7c2793){_0x1f0add=_0x1f0add-0x0;var _0x16c85c=_0x8580[_0x1f0add];return _0x16c85c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0858('0x0'));var express=require(_0x0858('0x1'));var router=express[_0x0858('0x2')]();var auth=require(_0x0858('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0858('0x4'));var controller=require(_0x0858('0x5'));router['get']('/',auth[_0x0858('0x6')](),controller['index']);router[_0x0858('0x7')](_0x0858('0x8'),auth[_0x0858('0x6')](),controller['describe']);router[_0x0858('0x7')](_0x0858('0x9'),auth[_0x0858('0x6')](),controller[_0x0858('0xa')]);router[_0x0858('0xb')]('/',auth['isAuthenticated'](),controller[_0x0858('0xc')]);router[_0x0858('0xd')](_0x0858('0x9'),auth[_0x0858('0x6')](),controller[_0x0858('0xe')]);router[_0x0858('0xf')](_0x0858('0x9'),auth[_0x0858('0x6')](),controller['destroy']);module[_0x0858('0x10')]=router; \ No newline at end of file +var _0x5d55=['describe','post','create','put','/:id','exports','util','path','express','../../components/interaction/service','index','get','isAuthenticated'];(function(_0x1ea6b4,_0x3930fe){var _0x1f5599=function(_0x6da484){while(--_0x6da484){_0x1ea6b4['push'](_0x1ea6b4['shift']());}};_0x1f5599(++_0x3930fe);}(_0x5d55,0x1cd));var _0x55d5=function(_0x44c2a9,_0x534521){_0x44c2a9=_0x44c2a9-0x0;var _0x19f27e=_0x5d55[_0x44c2a9];return _0x19f27e;};'use strict';var multer=require('multer');var util=require(_0x55d5('0x0'));var path=require(_0x55d5('0x1'));var express=require(_0x55d5('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x55d5('0x3'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x55d5('0x4')]);router[_0x55d5('0x5')]('/describe',auth[_0x55d5('0x6')](),controller[_0x55d5('0x7')]);router[_0x55d5('0x5')]('/:id',auth[_0x55d5('0x6')](),controller['show']);router[_0x55d5('0x8')]('/',auth['isAuthenticated'](),controller[_0x55d5('0x9')]);router[_0x55d5('0xa')](_0x55d5('0xb'),auth[_0x55d5('0x6')](),controller['update']);router['delete'](_0x55d5('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x55d5('0xc')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 494efd4..6caee3e 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 _0xbd16=['DATE','NOW','moment','exports','ENUM','account','queue'];(function(_0x2437b1,_0x3997c0){var _0x4054b6=function(_0x10f58e){while(--_0x10f58e){_0x2437b1['push'](_0x2437b1['shift']());}};_0x4054b6(++_0x3997c0);}(_0xbd16,0xbf));var _0x6bd1=function(_0x3760bc,_0x583ce3){_0x3760bc=_0x3760bc-0x0;var _0x103d18=_0xbd16[_0x3760bc];return _0x103d18;};'use strict';var moment=require(_0x6bd1('0x0'));var Sequelize=require('sequelize');module[_0x6bd1('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6bd1('0x2')](_0x6bd1('0x3'),'agent',_0x6bd1('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x6bd1('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x6bd1('0x6')]}}; \ No newline at end of file +var _0xfc67=['STRING','ENUM','agent','queue','DATE','NOW','exports'];(function(_0x1407fb,_0x5ad6b8){var _0x33648b=function(_0x51b34f){while(--_0x51b34f){_0x1407fb['push'](_0x1407fb['shift']());}};_0x33648b(++_0x5ad6b8);}(_0xfc67,0x76));var _0x7fc6=function(_0x5f035f,_0x5300d1){_0x5f035f=_0x5f035f-0x0;var _0xad281e=_0xfc67[_0x5f035f];return _0xad281e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x7fc6('0x0')]={'uniqueid':{'type':Sequelize[_0x7fc6('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x7fc6('0x2')]('account',_0x7fc6('0x3'),_0x7fc6('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x7fc6('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x7fc6('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 4f37bca..3c9894b 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 _0xf863=['rows','show','params','includeAll','include','find','catch','create','body','destroy','describe','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','add','day','merge','filter','map','options','FaxTransferReport'];(function(_0x359eb9,_0x408dbd){var _0x3cba6d=function(_0x2edbf9){while(--_0x2edbf9){_0x359eb9['push'](_0x359eb9['shift']());}};_0x3cba6d(++_0x408dbd);}(_0xf863,0x117));var _0x3f86=function(_0x223283,_0x7eeb6a){_0x223283=_0x223283-0x0;var _0x4a9347=_0xf863[_0x223283];return _0x4a9347;};'use strict';var jsonpatch=require(_0x3f86('0x0'));var rp=require(_0x3f86('0x1'));var moment=require('moment');var BPromise=require(_0x3f86('0x2'));var Mustache=require('mustache');var util=require(_0x3f86('0x3'));var path=require(_0x3f86('0x4'));var sox=require(_0x3f86('0x5'));var csv=require(_0x3f86('0x6'));var ejs=require(_0x3f86('0x7'));var fs=require('fs');var _=require(_0x3f86('0x8'));var squel=require(_0x3f86('0x9'));var crypto=require(_0x3f86('0xa'));var jsforce=require(_0x3f86('0xb'));var deskjs=require(_0x3f86('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3f86('0xd'));var Papa=require(_0x3f86('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0x3f86('0xf'))(_0x3f86('0x10'));var utils=require(_0x3f86('0x11'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b5584,_0x23b79d){_0x23b79d=_0x23b79d||0xcc;return function(_0xcc8dfd){if(_0xcc8dfd){return _0x1b5584[_0x3f86('0x12')](_0x23b79d);}return _0x1b5584['status'](_0x23b79d)[_0x3f86('0x13')]();};}function respondWithResult(_0x5e76d1,_0x1ed632){_0x1ed632=_0x1ed632||0xc8;return function(_0x130366){if(_0x130366){return _0x5e76d1[_0x3f86('0x14')](_0x1ed632)[_0x3f86('0x15')](_0x130366);}};}function respondWithFilteredResult(_0xd6d0b6,_0x4373f8){return function(_0x2f5104){if(_0x2f5104){var _0x1fa9e0=_0x2f5104[_0x3f86('0x16')],_0x46a5d6=_0x4373f8[_0x3f86('0x17')],_0x36bf79=_0x4373f8['offset']+_0x4373f8[_0x3f86('0x18')],_0x470946;if(_0x36bf79>=_0x1fa9e0){_0x36bf79=_0x1fa9e0;_0x470946=0xc8;}else{_0x470946=0xce;}_0xd6d0b6[_0x3f86('0x14')](_0x470946);return _0xd6d0b6['set'](_0x3f86('0x19'),_0x46a5d6+'-'+_0x36bf79+'/'+_0x1fa9e0)[_0x3f86('0x15')](_0x2f5104);}return null;};}function patchUpdates(_0x2b5004){return function(_0x3bbf31){try{jsonpatch[_0x3f86('0x1a')](_0x3bbf31,_0x2b5004,!![]);}catch(_0x23535e){return BPromise[_0x3f86('0x1b')](_0x23535e);}return _0x3bbf31[_0x3f86('0x1c')]();};}function saveUpdates(_0x5b7bd8,_0x105299){return function(_0x573d3a){if(_0x573d3a){return _0x573d3a[_0x3f86('0x1d')](_0x5b7bd8)[_0x3f86('0x1e')](function(_0x2425c9){return _0x2425c9;});}return null;};}function removeEntity(_0x4f2f5b,_0x429429){return function(_0x367379){if(_0x367379){return _0x367379['destroy']()[_0x3f86('0x1e')](function(){_0x4f2f5b[_0x3f86('0x14')](0xcc)[_0x3f86('0x13')]();});}};}function handleEntityNotFound(_0x8d7d66,_0x307bbd){return function(_0x2d87f4){if(!_0x2d87f4){_0x8d7d66[_0x3f86('0x12')](0x194);}return _0x2d87f4;};}function handleError(_0xe2e1b6,_0x28da68){_0x28da68=_0x28da68||0x1f4;return function(_0x23cfcf){logger[_0x3f86('0x1f')](_0x23cfcf[_0x3f86('0x20')]);if(_0x23cfcf[_0x3f86('0x21')]){delete _0x23cfcf[_0x3f86('0x21')];}_0xe2e1b6[_0x3f86('0x14')](_0x28da68)[_0x3f86('0x22')](_0x23cfcf);};}exports['index']=function(_0x1cf3e4,_0x2c3782){var _0xd94e1b={},_0x471eec={},_0x2a74d3={'count':0x0,'rows':[]};var _0xe12fd4=db['FaxTransferReport'][_0x3f86('0x23')];_0x471eec[_0x3f86('0x24')]=_[_0x3f86('0x25')](_0xe12fd4);var _0x4b9fd4={'dateStart':_0x1cf3e4[_0x3f86('0x26')][_0x3f86('0x27')],'dateEnd':_0x1cf3e4['query'][_0x3f86('0x28')]};delete _0x1cf3e4[_0x3f86('0x26')][_0x3f86('0x27')];delete _0x1cf3e4['query'][_0x3f86('0x28')];_0x471eec['query']=_[_0x3f86('0x25')](_0x1cf3e4[_0x3f86('0x26')]);_0x471eec[_0x3f86('0x29')]=_[_0x3f86('0x2a')](_0x471eec[_0x3f86('0x24')],_0x471eec[_0x3f86('0x26')]);_0xd94e1b[_0x3f86('0x2b')]=_['intersection'](_0x471eec['model'],qs['fields'](_0x1cf3e4[_0x3f86('0x26')][_0x3f86('0x2c')]));_0xd94e1b[_0x3f86('0x2b')]=_0xd94e1b[_0x3f86('0x2b')][_0x3f86('0x2d')]?_0xd94e1b[_0x3f86('0x2b')]:_0x471eec['model'];if(!_0x1cf3e4[_0x3f86('0x26')][_0x3f86('0x2e')](_0x3f86('0x2f'))){_0xd94e1b[_0x3f86('0x18')]=qs[_0x3f86('0x18')](_0x1cf3e4[_0x3f86('0x26')][_0x3f86('0x18')]);_0xd94e1b[_0x3f86('0x17')]=qs[_0x3f86('0x17')](_0x1cf3e4['query']['offset']);}_0xd94e1b['order']=qs['sort'](_0x1cf3e4[_0x3f86('0x26')]['sort']);_0xd94e1b[_0x3f86('0x30')]=qs[_0x3f86('0x29')](_['pick'](_0x1cf3e4[_0x3f86('0x26')],_0x471eec[_0x3f86('0x29')]));if(_0x4b9fd4[_0x3f86('0x27')]){if(_0x4b9fd4[_0x3f86('0x28')]){_0x4b9fd4[_0x3f86('0x28')]=moment(_0x4b9fd4['dateEnd'])[_0x3f86('0x31')](0x1,_0x3f86('0x32'));}else{_0x4b9fd4[_0x3f86('0x28')]=moment(_0x4b9fd4[_0x3f86('0x27')])[_0x3f86('0x31')](0x1,_0x3f86('0x32'));}_[_0x3f86('0x33')](_0xd94e1b[_0x3f86('0x30')],{'createdAt':{'$gte':_0x4b9fd4[_0x3f86('0x27')],'$lte':_0x4b9fd4['dateEnd']}});}if(_0x1cf3e4['query'][_0x3f86('0x34')]){_0xd94e1b[_0x3f86('0x30')]=_[_0x3f86('0x33')](_0xd94e1b[_0x3f86('0x30')],{'$or':_[_0x3f86('0x35')](_0xd94e1b['attributes'],function(_0x39a35c){var _0x1f295e={};_0x1f295e[_0x39a35c]={'$like':'%'+_0x1cf3e4[_0x3f86('0x26')][_0x3f86('0x34')]+'%'};return _0x1f295e;})});}_0xd94e1b=_[_0x3f86('0x33')]({},_0xd94e1b,_0x1cf3e4[_0x3f86('0x36')]);var _0x57490d={'where':_0xd94e1b['where']};return db[_0x3f86('0x37')][_0x3f86('0x16')](_0x57490d)[_0x3f86('0x1e')](function(_0x3befd8){_0x2a74d3[_0x3f86('0x16')]=_0x3befd8;if(_0x1cf3e4[_0x3f86('0x26')]['includeAll']){_0xd94e1b['include']=[{'all':!![]}];}return db[_0x3f86('0x37')]['findAll'](_0xd94e1b);})[_0x3f86('0x1e')](function(_0x1e441b){_0x2a74d3[_0x3f86('0x38')]=_0x1e441b;return _0x2a74d3;})[_0x3f86('0x1e')](respondWithFilteredResult(_0x2c3782,_0xd94e1b))['catch'](handleError(_0x2c3782,null));};exports[_0x3f86('0x39')]=function(_0x2d302c,_0x14f594){var _0x567bfb={'raw':!![],'where':{'id':_0x2d302c[_0x3f86('0x3a')]['id']}},_0x2f9712={};_0x2f9712['model']=_[_0x3f86('0x25')](db[_0x3f86('0x37')][_0x3f86('0x23')]);_0x2f9712['query']=_[_0x3f86('0x25')](_0x2d302c['query']);_0x2f9712['filters']=_[_0x3f86('0x2a')](_0x2f9712[_0x3f86('0x24')],_0x2f9712[_0x3f86('0x26')]);_0x567bfb[_0x3f86('0x2b')]=_[_0x3f86('0x2a')](_0x2f9712[_0x3f86('0x24')],qs[_0x3f86('0x2c')](_0x2d302c['query']['fields']));_0x567bfb[_0x3f86('0x2b')]=_0x567bfb[_0x3f86('0x2b')][_0x3f86('0x2d')]?_0x567bfb[_0x3f86('0x2b')]:_0x2f9712[_0x3f86('0x24')];if(_0x2d302c[_0x3f86('0x26')][_0x3f86('0x3b')]){_0x567bfb[_0x3f86('0x3c')]=[{'all':!![]}];}_0x567bfb=_[_0x3f86('0x33')]({},_0x567bfb,_0x2d302c['options']);return db['FaxTransferReport'][_0x3f86('0x3d')](_0x567bfb)[_0x3f86('0x1e')](handleEntityNotFound(_0x14f594,null))[_0x3f86('0x1e')](respondWithResult(_0x14f594,null))[_0x3f86('0x3e')](handleError(_0x14f594,null));};exports[_0x3f86('0x3f')]=function(_0x1f15fb,_0x202408){return db['FaxTransferReport']['create'](_0x1f15fb[_0x3f86('0x40')],{})['then'](respondWithResult(_0x202408,0xc9))['catch'](handleError(_0x202408,null));};exports[_0x3f86('0x1d')]=function(_0x219dda,_0x41b5ff){if(_0x219dda[_0x3f86('0x40')]['id']){delete _0x219dda[_0x3f86('0x40')]['id'];}return db[_0x3f86('0x37')][_0x3f86('0x3d')]({'where':{'id':_0x219dda['params']['id']}})[_0x3f86('0x1e')](handleEntityNotFound(_0x41b5ff,null))[_0x3f86('0x1e')](saveUpdates(_0x219dda['body'],null))[_0x3f86('0x1e')](respondWithResult(_0x41b5ff,null))[_0x3f86('0x3e')](handleError(_0x41b5ff,null));};exports[_0x3f86('0x41')]=function(_0x155fb8,_0x5844dc){return db['FaxTransferReport'][_0x3f86('0x3d')]({'where':{'id':_0x155fb8[_0x3f86('0x3a')]['id']}})[_0x3f86('0x1e')](handleEntityNotFound(_0x5844dc,null))[_0x3f86('0x1e')](removeEntity(_0x5844dc,null))[_0x3f86('0x3e')](handleError(_0x5844dc,null));};exports[_0x3f86('0x42')]=function(_0xdf273d,_0x27dbed){return db['FaxTransferReport'][_0x3f86('0x42')]()[_0x3f86('0x1e')](respondWithResult(_0x27dbed,null))['catch'](handleError(_0x27dbed,null));}; \ No newline at end of file +var _0xb6a6=['order','sort','where','pick','add','day','merge','filter','map','rows','catch','params','FaxTransferReport','intersection','length','include','options','create','body','find','describe','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../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','model','keys','query','dateStart','dateEnd','filters','attributes','fields','hasOwnProperty','nolimit'];(function(_0x136f75,_0x4cdf22){var _0x3bd946=function(_0x207964){while(--_0x207964){_0x136f75['push'](_0x136f75['shift']());}};_0x3bd946(++_0x4cdf22);}(_0xb6a6,0xe4));var _0x6b6a=function(_0x492619,_0x5e8109){_0x492619=_0x492619-0x0;var _0x4d14ea=_0xb6a6[_0x492619];return _0x4d14ea;};'use strict';var jsonpatch=require(_0x6b6a('0x0'));var rp=require('request-promise');var moment=require(_0x6b6a('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6b6a('0x2'));var path=require(_0x6b6a('0x3'));var sox=require(_0x6b6a('0x4'));var csv=require(_0x6b6a('0x5'));var ejs=require(_0x6b6a('0x6'));var fs=require('fs');var _=require(_0x6b6a('0x7'));var squel=require(_0x6b6a('0x8'));var crypto=require(_0x6b6a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x6b6a('0xa'));var toCsv=require('to-csv');var querystring=require(_0x6b6a('0xb'));var Papa=require(_0x6b6a('0xc'));var qs=require(_0x6b6a('0xd'));var logger=require('../../config/logger')(_0x6b6a('0xe'));var utils=require(_0x6b6a('0xf'));var config=require(_0x6b6a('0x10'));var db=require(_0x6b6a('0x11'))['db'];function respondWithStatusCode(_0xadad,_0x7cf655){_0x7cf655=_0x7cf655||0xcc;return function(_0x211ef4){if(_0x211ef4){return _0xadad[_0x6b6a('0x12')](_0x7cf655);}return _0xadad[_0x6b6a('0x13')](_0x7cf655)[_0x6b6a('0x14')]();};}function respondWithResult(_0x45647f,_0x1e7a04){_0x1e7a04=_0x1e7a04||0xc8;return function(_0x56b5a6){if(_0x56b5a6){return _0x45647f[_0x6b6a('0x13')](_0x1e7a04)[_0x6b6a('0x15')](_0x56b5a6);}};}function respondWithFilteredResult(_0x1c631c,_0x29e876){return function(_0x114268){if(_0x114268){var _0x461cd8=_0x114268[_0x6b6a('0x16')],_0x2baa4d=_0x29e876[_0x6b6a('0x17')],_0x4c745b=_0x29e876[_0x6b6a('0x17')]+_0x29e876[_0x6b6a('0x18')],_0x695a9e;if(_0x4c745b>=_0x461cd8){_0x4c745b=_0x461cd8;_0x695a9e=0xc8;}else{_0x695a9e=0xce;}_0x1c631c['status'](_0x695a9e);return _0x1c631c[_0x6b6a('0x19')](_0x6b6a('0x1a'),_0x2baa4d+'-'+_0x4c745b+'/'+_0x461cd8)[_0x6b6a('0x15')](_0x114268);}return null;};}function patchUpdates(_0x555c24){return function(_0x2ad1bc){try{jsonpatch[_0x6b6a('0x1b')](_0x2ad1bc,_0x555c24,!![]);}catch(_0x40541f){return BPromise[_0x6b6a('0x1c')](_0x40541f);}return _0x2ad1bc[_0x6b6a('0x1d')]();};}function saveUpdates(_0x215f29,_0x1b6c46){return function(_0x477ff5){if(_0x477ff5){return _0x477ff5[_0x6b6a('0x1e')](_0x215f29)[_0x6b6a('0x1f')](function(_0x25822a){return _0x25822a;});}return null;};}function removeEntity(_0x44433a,_0x4afb4c){return function(_0x4af5d4){if(_0x4af5d4){return _0x4af5d4[_0x6b6a('0x20')]()[_0x6b6a('0x1f')](function(){_0x44433a[_0x6b6a('0x13')](0xcc)[_0x6b6a('0x14')]();});}};}function handleEntityNotFound(_0x4b382d,_0xbb257e){return function(_0x23b41c){if(!_0x23b41c){_0x4b382d[_0x6b6a('0x12')](0x194);}return _0x23b41c;};}function handleError(_0x8a3c06,_0x81281d){_0x81281d=_0x81281d||0x1f4;return function(_0x5873c4){logger[_0x6b6a('0x21')](_0x5873c4[_0x6b6a('0x22')]);if(_0x5873c4[_0x6b6a('0x23')]){delete _0x5873c4[_0x6b6a('0x23')];}_0x8a3c06[_0x6b6a('0x13')](_0x81281d)[_0x6b6a('0x24')](_0x5873c4);};}exports[_0x6b6a('0x25')]=function(_0x553d7e,_0x530e4f){var _0x119edd={},_0x3f16a9={},_0x2a24df={'count':0x0,'rows':[]};var _0x42e719=db['FaxTransferReport']['rawAttributes'];_0x3f16a9[_0x6b6a('0x26')]=_[_0x6b6a('0x27')](_0x42e719);var _0x278374={'dateStart':_0x553d7e[_0x6b6a('0x28')][_0x6b6a('0x29')],'dateEnd':_0x553d7e['query']['dateEnd']};delete _0x553d7e[_0x6b6a('0x28')][_0x6b6a('0x29')];delete _0x553d7e[_0x6b6a('0x28')][_0x6b6a('0x2a')];_0x3f16a9['query']=_[_0x6b6a('0x27')](_0x553d7e[_0x6b6a('0x28')]);_0x3f16a9[_0x6b6a('0x2b')]=_['intersection'](_0x3f16a9[_0x6b6a('0x26')],_0x3f16a9[_0x6b6a('0x28')]);_0x119edd[_0x6b6a('0x2c')]=_['intersection'](_0x3f16a9['model'],qs[_0x6b6a('0x2d')](_0x553d7e['query']['fields']));_0x119edd[_0x6b6a('0x2c')]=_0x119edd['attributes']['length']?_0x119edd[_0x6b6a('0x2c')]:_0x3f16a9['model'];if(!_0x553d7e[_0x6b6a('0x28')][_0x6b6a('0x2e')](_0x6b6a('0x2f'))){_0x119edd[_0x6b6a('0x18')]=qs[_0x6b6a('0x18')](_0x553d7e[_0x6b6a('0x28')]['limit']);_0x119edd[_0x6b6a('0x17')]=qs[_0x6b6a('0x17')](_0x553d7e[_0x6b6a('0x28')]['offset']);}_0x119edd[_0x6b6a('0x30')]=qs['sort'](_0x553d7e['query'][_0x6b6a('0x31')]);_0x119edd[_0x6b6a('0x32')]=qs['filters'](_[_0x6b6a('0x33')](_0x553d7e[_0x6b6a('0x28')],_0x3f16a9[_0x6b6a('0x2b')]));if(_0x278374[_0x6b6a('0x29')]){if(_0x278374['dateEnd']){_0x278374[_0x6b6a('0x2a')]=moment(_0x278374['dateEnd'])[_0x6b6a('0x34')](0x1,_0x6b6a('0x35'));}else{_0x278374[_0x6b6a('0x2a')]=moment(_0x278374[_0x6b6a('0x29')])[_0x6b6a('0x34')](0x1,_0x6b6a('0x35'));}_[_0x6b6a('0x36')](_0x119edd[_0x6b6a('0x32')],{'createdAt':{'$gte':_0x278374[_0x6b6a('0x29')],'$lte':_0x278374[_0x6b6a('0x2a')]}});}if(_0x553d7e['query'][_0x6b6a('0x37')]){_0x119edd[_0x6b6a('0x32')]=_[_0x6b6a('0x36')](_0x119edd[_0x6b6a('0x32')],{'$or':_[_0x6b6a('0x38')](_0x119edd[_0x6b6a('0x2c')],function(_0x1e7981){var _0x2157a2={};_0x2157a2[_0x1e7981]={'$like':'%'+_0x553d7e['query'][_0x6b6a('0x37')]+'%'};return _0x2157a2;})});}_0x119edd=_['merge']({},_0x119edd,_0x553d7e['options']);var _0x1810fe={'where':_0x119edd[_0x6b6a('0x32')]};return db['FaxTransferReport'][_0x6b6a('0x16')](_0x1810fe)['then'](function(_0x466d56){_0x2a24df[_0x6b6a('0x16')]=_0x466d56;if(_0x553d7e[_0x6b6a('0x28')]['includeAll']){_0x119edd['include']=[{'all':!![]}];}return db['FaxTransferReport']['findAll'](_0x119edd);})['then'](function(_0x483192){_0x2a24df[_0x6b6a('0x39')]=_0x483192;return _0x2a24df;})[_0x6b6a('0x1f')](respondWithFilteredResult(_0x530e4f,_0x119edd))[_0x6b6a('0x3a')](handleError(_0x530e4f,null));};exports['show']=function(_0x36bea2,_0x21fe71){var _0x26231b={'raw':!![],'where':{'id':_0x36bea2[_0x6b6a('0x3b')]['id']}},_0x1e4219={};_0x1e4219[_0x6b6a('0x26')]=_['keys'](db[_0x6b6a('0x3c')]['rawAttributes']);_0x1e4219[_0x6b6a('0x28')]=_[_0x6b6a('0x27')](_0x36bea2[_0x6b6a('0x28')]);_0x1e4219[_0x6b6a('0x2b')]=_['intersection'](_0x1e4219[_0x6b6a('0x26')],_0x1e4219['query']);_0x26231b['attributes']=_[_0x6b6a('0x3d')](_0x1e4219[_0x6b6a('0x26')],qs[_0x6b6a('0x2d')](_0x36bea2[_0x6b6a('0x28')][_0x6b6a('0x2d')]));_0x26231b[_0x6b6a('0x2c')]=_0x26231b[_0x6b6a('0x2c')][_0x6b6a('0x3e')]?_0x26231b[_0x6b6a('0x2c')]:_0x1e4219[_0x6b6a('0x26')];if(_0x36bea2[_0x6b6a('0x28')]['includeAll']){_0x26231b[_0x6b6a('0x3f')]=[{'all':!![]}];}_0x26231b=_['merge']({},_0x26231b,_0x36bea2[_0x6b6a('0x40')]);return db[_0x6b6a('0x3c')]['find'](_0x26231b)[_0x6b6a('0x1f')](handleEntityNotFound(_0x21fe71,null))[_0x6b6a('0x1f')](respondWithResult(_0x21fe71,null))[_0x6b6a('0x3a')](handleError(_0x21fe71,null));};exports[_0x6b6a('0x41')]=function(_0x57ff5a,_0xe27340){return db[_0x6b6a('0x3c')][_0x6b6a('0x41')](_0x57ff5a[_0x6b6a('0x42')],{})[_0x6b6a('0x1f')](respondWithResult(_0xe27340,0xc9))[_0x6b6a('0x3a')](handleError(_0xe27340,null));};exports['update']=function(_0x3ea53b,_0x587be1){if(_0x3ea53b[_0x6b6a('0x42')]['id']){delete _0x3ea53b[_0x6b6a('0x42')]['id'];}return db[_0x6b6a('0x3c')][_0x6b6a('0x43')]({'where':{'id':_0x3ea53b[_0x6b6a('0x3b')]['id']}})[_0x6b6a('0x1f')](handleEntityNotFound(_0x587be1,null))[_0x6b6a('0x1f')](saveUpdates(_0x3ea53b['body'],null))[_0x6b6a('0x1f')](respondWithResult(_0x587be1,null))[_0x6b6a('0x3a')](handleError(_0x587be1,null));};exports[_0x6b6a('0x20')]=function(_0xbf4eff,_0x392626){return db[_0x6b6a('0x3c')]['find']({'where':{'id':_0xbf4eff[_0x6b6a('0x3b')]['id']}})[_0x6b6a('0x1f')](handleEntityNotFound(_0x392626,null))[_0x6b6a('0x1f')](removeEntity(_0x392626,null))['catch'](handleError(_0x392626,null));};exports[_0x6b6a('0x44')]=function(_0xb22f30,_0x19fa27){return db[_0x6b6a('0x3c')]['describe']()[_0x6b6a('0x1f')](respondWithResult(_0x19fa27,null))['catch'](handleError(_0x19fa27,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 7bfb9c5..287b1b6 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 _0xfa44=['moment','bluebird','request-promise','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','api'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xfa44,0x8c));var _0x4fa4=function(_0x3cba93,_0x5c2fd8){_0x3cba93=_0x3cba93-0x0;var _0x4a2991=_0xfa44[_0x3cba93];return _0x4a2991;};'use strict';var _=require(_0x4fa4('0x0'));var util=require(_0x4fa4('0x1'));var logger=require('../../config/logger')(_0x4fa4('0x2'));var moment=require(_0x4fa4('0x3'));var BPromise=require(_0x4fa4('0x4'));var rp=require(_0x4fa4('0x5'));var attributes=require(_0x4fa4('0x6'));module[_0x4fa4('0x7')]=function(_0x4dcced,_0xadc7d6){return _0x4dcced['define'](_0x4fa4('0x8'),attributes,{'tableName':_0x4fa4('0x9'),'paranoid':![],'indexes':[{'name':_0x4fa4('0xa'),'fields':[_0x4fa4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcdd2=['../../config/logger','api','moment','bluebird','request-promise','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util'];(function(_0x213cb9,_0x43d78d){var _0x5dd16d=function(_0x19fb96){while(--_0x19fb96){_0x213cb9['push'](_0x213cb9['shift']());}};_0x5dd16d(++_0x43d78d);}(_0xcdd2,0xa6));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var logger=require(_0x2cdd('0x2'))(_0x2cdd('0x3'));var moment=require(_0x2cdd('0x4'));var BPromise=require(_0x2cdd('0x5'));var rp=require(_0x2cdd('0x6'));var attributes=require(_0x2cdd('0x7'));module['exports']=function(_0x124d73,_0x50d8d3){return _0x124d73[_0x2cdd('0x8')](_0x2cdd('0x9'),attributes,{'tableName':_0x2cdd('0xa'),'paranoid':![],'indexes':[{'name':_0x2cdd('0xb'),'fields':[_0x2cdd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index c9ed288..a5f0d54 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 _0x53d3=['request\x20sent','debug','stringify','error','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x53d3,0xd8));var _0x353d=function(_0x9a6054,_0x5a23ed){_0x9a6054=_0x9a6054-0x0;var _0x48e88c=_0x53d3[_0x9a6054];return _0x48e88c;};'use strict';var _=require(_0x353d('0x0'));var util=require('util');var moment=require(_0x353d('0x1'));var BPromise=require(_0x353d('0x2'));var rs=require(_0x353d('0x3'));var fs=require('fs');var db=require(_0x353d('0x4'))['db'];var utils=require(_0x353d('0x5'));var logger=require(_0x353d('0x6'))('rpc');var config=require(_0x353d('0x7'));var jayson=require(_0x353d('0x8'));var client=jayson[_0x353d('0x9')][_0x353d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x363d2d,_0x77ea11,_0x3c8f0b){return new BPromise(function(_0x112b86,_0x30ac83){return client[_0x353d('0xb')](_0x363d2d,_0x3c8f0b)[_0x353d('0xc')](function(_0xa5bc76){logger[_0x353d('0xd')](_0x353d('0xe'),_0x77ea11,_0x353d('0xf'));logger[_0x353d('0x10')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x77ea11,_0x353d('0xf'),JSON[_0x353d('0x11')](_0xa5bc76));if(_0xa5bc76[_0x353d('0x12')]){if(_0xa5bc76[_0x353d('0x12')]['code']===0x1f4){logger[_0x353d('0x12')](_0x353d('0xe'),_0x77ea11,_0xa5bc76[_0x353d('0x12')][_0x353d('0x13')]);return _0x30ac83(_0xa5bc76[_0x353d('0x12')][_0x353d('0x13')]);}logger[_0x353d('0x12')](_0x353d('0xe'),_0x77ea11,_0xa5bc76[_0x353d('0x12')][_0x353d('0x13')]);return _0x112b86(_0xa5bc76['error']['message']);}else{logger[_0x353d('0xd')](_0x353d('0xe'),_0x77ea11,_0x353d('0xf'));_0x112b86(_0xa5bc76['result'][_0x353d('0x13')]);}})[_0x353d('0x14')](function(_0x2dd0c4){logger['error'](_0x353d('0xe'),_0x77ea11,_0x2dd0c4);_0x30ac83(_0x2dd0c4);});});} \ No newline at end of file +var _0xe760=['../../config/environment','jayson/promise','client','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x4875dc,_0x22a8e6){var _0x21eaf1=function(_0x4a598e){while(--_0x4a598e){_0x4875dc['push'](_0x4875dc['shift']());}};_0x21eaf1(++_0x22a8e6);}(_0xe760,0xbf));var _0x0e76=function(_0x3466f1,_0x79a7d9){_0x3466f1=_0x3466f1-0x0;var _0x12d5fa=_0xe760[_0x3466f1];return _0x12d5fa;};'use strict';var _=require(_0x0e76('0x0'));var util=require(_0x0e76('0x1'));var moment=require(_0x0e76('0x2'));var BPromise=require(_0x0e76('0x3'));var rs=require(_0x0e76('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x0e76('0x5'));var logger=require(_0x0e76('0x6'))('rpc');var config=require(_0x0e76('0x7'));var jayson=require(_0x0e76('0x8'));var client=jayson[_0x0e76('0x9')][_0x0e76('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x67237e,_0x3b0103,_0x5da925){return new BPromise(function(_0x2381e2,_0x4254ef){return client['request'](_0x67237e,_0x5da925)[_0x0e76('0xb')](function(_0x9d1fe2){logger[_0x0e76('0xc')](_0x0e76('0xd'),_0x3b0103,_0x0e76('0xe'));logger[_0x0e76('0xf')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x3b0103,_0x0e76('0xe'),JSON[_0x0e76('0x10')](_0x9d1fe2));if(_0x9d1fe2[_0x0e76('0x11')]){if(_0x9d1fe2[_0x0e76('0x11')][_0x0e76('0x12')]===0x1f4){logger[_0x0e76('0x11')](_0x0e76('0xd'),_0x3b0103,_0x9d1fe2[_0x0e76('0x11')]['message']);return _0x4254ef(_0x9d1fe2['error'][_0x0e76('0x13')]);}logger[_0x0e76('0x11')](_0x0e76('0xd'),_0x3b0103,_0x9d1fe2[_0x0e76('0x11')][_0x0e76('0x13')]);return _0x2381e2(_0x9d1fe2['error']['message']);}else{logger[_0x0e76('0xc')](_0x0e76('0xd'),_0x3b0103,_0x0e76('0xe'));_0x2381e2(_0x9d1fe2[_0x0e76('0x14')]['message']);}})[_0x0e76('0x15')](function(_0x14a331){logger[_0x0e76('0x11')](_0x0e76('0xd'),_0x3b0103,_0x14a331);_0x4254ef(_0x14a331);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 49e45ef..d4e5b1e 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 _0x8c99=['put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','show','post','create'];(function(_0x4694a9,_0x82531f){var _0x596dc8=function(_0x24c97f){while(--_0x24c97f){_0x4694a9['push'](_0x4694a9['shift']());}};_0x596dc8(++_0x82531f);}(_0x8c99,0x1a8));var _0x98c9=function(_0x214266,_0x1f6f52){_0x214266=_0x214266-0x0;var _0x568f75=_0x8c99[_0x214266];return _0x568f75;};'use strict';var multer=require(_0x98c9('0x0'));var util=require(_0x98c9('0x1'));var path=require(_0x98c9('0x2'));var express=require(_0x98c9('0x3'));var router=express[_0x98c9('0x4')]();var auth=require(_0x98c9('0x5'));var interaction=require(_0x98c9('0x6'));var config=require(_0x98c9('0x7'));var controller=require(_0x98c9('0x8'));router[_0x98c9('0x9')]('/',auth[_0x98c9('0xa')](),controller[_0x98c9('0xb')]);router['get'](_0x98c9('0xc'),auth[_0x98c9('0xa')](),controller['describe']);router['get']('/:id',auth[_0x98c9('0xa')](),controller[_0x98c9('0xd')]);router[_0x98c9('0xe')]('/',auth[_0x98c9('0xa')](),controller[_0x98c9('0xf')]);router[_0x98c9('0x10')](_0x98c9('0x11'),auth[_0x98c9('0xa')](),controller[_0x98c9('0x12')]);router[_0x98c9('0x13')](_0x98c9('0x11'),auth['isAuthenticated'](),controller[_0x98c9('0x14')]);module[_0x98c9('0x15')]=router; \ No newline at end of file +var _0x8f1f=['/:id','update','delete','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put'];(function(_0x5a64a7,_0x434278){var _0x1b2add=function(_0x3ec09a){while(--_0x3ec09a){_0x5a64a7['push'](_0x5a64a7['shift']());}};_0x1b2add(++_0x434278);}(_0x8f1f,0xe1));var _0xf8f1=function(_0x4c901d,_0x3733e4){_0x4c901d=_0x4c901d-0x0;var _0x4b7ae2=_0x8f1f[_0x4c901d];return _0x4b7ae2;};'use strict';var multer=require(_0xf8f1('0x0'));var util=require('util');var path=require('path');var express=require(_0xf8f1('0x1'));var router=express[_0xf8f1('0x2')]();var auth=require(_0xf8f1('0x3'));var interaction=require(_0xf8f1('0x4'));var config=require(_0xf8f1('0x5'));var controller=require(_0xf8f1('0x6'));router[_0xf8f1('0x7')]('/',auth[_0xf8f1('0x8')](),controller['index']);router[_0xf8f1('0x7')](_0xf8f1('0x9'),auth[_0xf8f1('0x8')](),controller[_0xf8f1('0xa')]);router[_0xf8f1('0x7')]('/:id',auth[_0xf8f1('0x8')](),controller[_0xf8f1('0xb')]);router[_0xf8f1('0xc')]('/',auth[_0xf8f1('0x8')](),controller[_0xf8f1('0xd')]);router[_0xf8f1('0xe')](_0xf8f1('0xf'),auth['isAuthenticated'](),controller[_0xf8f1('0x10')]);router[_0xf8f1('0x11')](_0xf8f1('0xf'),auth[_0xf8f1('0x8')](),controller[_0xf8f1('0x12')]);module[_0xf8f1('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 94d5aaa..e925821 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 _0xf109=['create','addConfiguration','put','update','delete','destroy','multer','util','path','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','post'];(function(_0x221d9f,_0x11ec04){var _0x3dd059=function(_0x685dbc){while(--_0x685dbc){_0x221d9f['push'](_0x221d9f['shift']());}};_0x3dd059(++_0x11ec04);}(_0xf109,0xce));var _0x9f10=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xf109[_0x3070dc];return _0x431489;};'use strict';var multer=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var path=require(_0x9f10('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x9f10('0x3'));var config=require(_0x9f10('0x4'));var controller=require(_0x9f10('0x5'));router[_0x9f10('0x6')]('/',auth[_0x9f10('0x7')](),controller[_0x9f10('0x8')]);router[_0x9f10('0x6')](_0x9f10('0x9'),auth[_0x9f10('0x7')](),controller[_0x9f10('0xa')]);router[_0x9f10('0x6')]('/:id/configurations',auth[_0x9f10('0x7')](),controller[_0x9f10('0xb')]);router[_0x9f10('0x6')](_0x9f10('0xc'),auth[_0x9f10('0x7')](),controller['getFields']);router[_0x9f10('0xd')]('/',auth[_0x9f10('0x7')](),controller[_0x9f10('0xe')]);router['post']('/:id/configurations',auth[_0x9f10('0x7')](),controller[_0x9f10('0xf')]);router[_0x9f10('0x10')]('/:id',auth[_0x9f10('0x7')](),controller[_0x9f10('0x11')]);router[_0x9f10('0x12')]('/:id',auth[_0x9f10('0x7')](),controller[_0x9f10('0x13')]);module['exports']=router; \ No newline at end of file +var _0x5c12=['get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x5c12,0x188));var _0x25c1=function(_0x3ef8f7,_0x35359a){_0x3ef8f7=_0x3ef8f7-0x0;var _0x3b097e=_0x5c12[_0x3ef8f7];return _0x3b097e;};'use strict';var multer=require('multer');var util=require(_0x25c1('0x0'));var path=require(_0x25c1('0x1'));var express=require('express');var router=express[_0x25c1('0x2')]();var auth=require(_0x25c1('0x3'));var interaction=require(_0x25c1('0x4'));var config=require(_0x25c1('0x5'));var controller=require(_0x25c1('0x6'));router[_0x25c1('0x7')]('/',auth[_0x25c1('0x8')](),controller['index']);router[_0x25c1('0x7')](_0x25c1('0x9'),auth[_0x25c1('0x8')](),controller['show']);router['get'](_0x25c1('0xa'),auth[_0x25c1('0x8')](),controller[_0x25c1('0xb')]);router[_0x25c1('0x7')](_0x25c1('0xc'),auth['isAuthenticated'](),controller[_0x25c1('0xd')]);router[_0x25c1('0xe')]('/',auth[_0x25c1('0x8')](),controller[_0x25c1('0xf')]);router[_0x25c1('0xe')]('/:id/configurations',auth[_0x25c1('0x8')](),controller[_0x25c1('0x10')]);router['put'](_0x25c1('0x9'),auth[_0x25c1('0x8')](),controller[_0x25c1('0x11')]);router[_0x25c1('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 726470d..591a62b 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 _0x4608=['newTab','sequelize','exports','STRING','ENUM','basic','integrationTab'];(function(_0x5b2f2c,_0x481fb6){var _0x5e37d2=function(_0x29a88c){while(--_0x29a88c){_0x5b2f2c['push'](_0x5b2f2c['shift']());}};_0x5e37d2(++_0x481fb6);}(_0x4608,0x1dd));var _0x8460=function(_0x582efe,_0x2f9ad8){_0x582efe=_0x582efe-0x0;var _0x4973f1=_0x4608[_0x582efe];return _0x4973f1;};'use strict';var Sequelize=require(_0x8460('0x0'));module[_0x8460('0x1')]={'name':{'type':Sequelize[_0x8460('0x2')]},'description':{'type':Sequelize[_0x8460('0x2')]},'username':{'type':Sequelize[_0x8460('0x2')]},'remoteUri':{'type':Sequelize[_0x8460('0x2')]},'authType':{'type':Sequelize[_0x8460('0x3')](_0x8460('0x4')),'defaultValue':_0x8460('0x4')},'password':{'type':Sequelize[_0x8460('0x2')]},'consumerKey':{'type':Sequelize[_0x8460('0x2')]},'consumerSecret':{'type':Sequelize[_0x8460('0x2')]},'token':{'type':Sequelize[_0x8460('0x2')]},'tokenSecret':{'type':Sequelize[_0x8460('0x2')]},'serverUrl':{'type':Sequelize[_0x8460('0x2')]},'type':{'type':Sequelize[_0x8460('0x3')](_0x8460('0x5'),_0x8460('0x6')),'defaultValue':_0x8460('0x5')}}; \ No newline at end of file +var _0xe24e=['integrationTab','exports','STRING','ENUM','basic','newTab'];(function(_0x500ea3,_0xc89056){var _0x3bb0=function(_0x4ae917){while(--_0x4ae917){_0x500ea3['push'](_0x500ea3['shift']());}};_0x3bb0(++_0xc89056);}(_0xe24e,0xe5));var _0xee24=function(_0x31172e,_0xa59e5){_0x31172e=_0x31172e-0x0;var _0x414ada=_0xe24e[_0x31172e];return _0x414ada;};'use strict';var Sequelize=require('sequelize');module[_0xee24('0x0')]={'name':{'type':Sequelize[_0xee24('0x1')]},'description':{'type':Sequelize[_0xee24('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xee24('0x1')]},'authType':{'type':Sequelize[_0xee24('0x2')](_0xee24('0x3')),'defaultValue':_0xee24('0x3')},'password':{'type':Sequelize[_0xee24('0x1')]},'consumerKey':{'type':Sequelize[_0xee24('0x1')]},'consumerSecret':{'type':Sequelize[_0xee24('0x1')]},'token':{'type':Sequelize[_0xee24('0x1')]},'tokenSecret':{'type':Sequelize[_0xee24('0x1')]},'serverUrl':{'type':Sequelize[_0xee24('0x1')]},'type':{'type':Sequelize[_0xee24('0x2')]('integrationTab',_0xee24('0x4')),'defaultValue':_0xee24('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 6060d3a..ed011e4 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 _0x5a7b=['mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','request','then','info','DeskAccount,\x20%s,\x20%s','debug','request\x20sent','error','message','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','end','name','send','index','DeskAccount','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','add','merge','where','map','filter','options','includeAll','findAll','rows','show','params','find','create','body','destroy','getConfigurations','findOne','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','username','password','consumerKey','consumerSecret','tokenSecret','GET','format','%s/custom_fields','application/json','authType','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','entries','active','label','getFields,\x20%s,\x20%s,\x20%s','stringify','test','statusCode','fast-json-patch','request-promise','moment'];(function(_0x264872,_0x21298c){var _0x206a64=function(_0x239300){while(--_0x239300){_0x264872['push'](_0x264872['shift']());}};_0x206a64(++_0x21298c);}(_0x5a7b,0x1c5));var _0xb5a7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5a7b[_0x14add3];return _0x4a174f;};'use strict';var jsonpatch=require(_0xb5a7('0x0'));var rp=require(_0xb5a7('0x1'));var moment=require(_0xb5a7('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb5a7('0x3'));var util=require('util');var path=require(_0xb5a7('0x4'));var sox=require(_0xb5a7('0x5'));var csv=require('to-csv');var ejs=require(_0xb5a7('0x6'));var fs=require('fs');var _=require(_0xb5a7('0x7'));var squel=require(_0xb5a7('0x8'));var crypto=require(_0xb5a7('0x9'));var jsforce=require(_0xb5a7('0xa'));var deskjs=require(_0xb5a7('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0xb5a7('0xc'));var logger=require(_0xb5a7('0xd'))('api');var utils=require(_0xb5a7('0xe'));var config=require(_0xb5a7('0xf'));var db=require(_0xb5a7('0x10'))['db'];var integrations=require(_0xb5a7('0x11'));var jayson=require('jayson/promise');var client=jayson[_0xb5a7('0x12')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53fcca,_0x13804b,_0x6e23d,_0x338434){return new BPromise(function(_0x31cd23,_0x34579d){var _0x208009=_0x338434||client;return _0x208009[_0xb5a7('0x13')](_0x53fcca,_0x6e23d)[_0xb5a7('0x14')](function(_0x53e794){logger[_0xb5a7('0x15')](_0xb5a7('0x16'),_0x13804b,'request\x20sent');logger[_0xb5a7('0x17')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x13804b,_0xb5a7('0x18'),JSON['stringify'](_0x53e794));if(_0x53e794[_0xb5a7('0x19')]){if(_0x53e794[_0xb5a7('0x19')]['code']===0x1f4){logger['error'](_0xb5a7('0x16'),_0x13804b,_0x53e794[_0xb5a7('0x19')][_0xb5a7('0x1a')]);return _0x34579d(_0x53e794[_0xb5a7('0x19')][_0xb5a7('0x1a')]);}logger['error'](_0xb5a7('0x16'),_0x13804b,_0x53e794['error'][_0xb5a7('0x1a')]);return _0x31cd23(_0x53e794[_0xb5a7('0x19')][_0xb5a7('0x1a')]);}else{logger[_0xb5a7('0x15')](_0xb5a7('0x16'),_0x13804b,_0xb5a7('0x18'));_0x31cd23(_0x53e794['result'][_0xb5a7('0x1a')]);}})[_0xb5a7('0x1b')](function(_0x57cd77){logger[_0xb5a7('0x19')]('DeskAccount,\x20%s,\x20%s',_0x13804b,_0x57cd77);_0x34579d(_0x57cd77);});});}function respondWithStatusCode(_0x4b271a,_0x18b229){_0x18b229=_0x18b229||0xcc;return function(_0x12eced){if(_0x12eced){return _0x4b271a[_0xb5a7('0x1c')](_0x18b229);}return _0x4b271a[_0xb5a7('0x1d')](_0x18b229)['end']();};}function respondWithResult(_0x479ae4,_0x4b0e0b){_0x4b0e0b=_0x4b0e0b||0xc8;return function(_0x2512c6){if(_0x2512c6){return _0x479ae4['status'](_0x4b0e0b)[_0xb5a7('0x1e')](_0x2512c6);}};}function respondWithFilteredResult(_0x3c4ca8,_0x15973a){return function(_0x53edee){if(_0x53edee){var _0x483a99=_0x53edee[_0xb5a7('0x1f')],_0x43c914=_0x15973a[_0xb5a7('0x20')],_0x24c47a=_0x15973a['offset']+_0x15973a[_0xb5a7('0x21')],_0x198b6e;if(_0x24c47a>=_0x483a99){_0x24c47a=_0x483a99;_0x198b6e=0xc8;}else{_0x198b6e=0xce;}_0x3c4ca8['status'](_0x198b6e);return _0x3c4ca8['set'](_0xb5a7('0x22'),_0x43c914+'-'+_0x24c47a+'/'+_0x483a99)[_0xb5a7('0x1e')](_0x53edee);}return null;};}function patchUpdates(_0x24eb8c){return function(_0x148233){try{jsonpatch[_0xb5a7('0x23')](_0x148233,_0x24eb8c,!![]);}catch(_0x1d8a52){return BPromise[_0xb5a7('0x24')](_0x1d8a52);}return _0x148233[_0xb5a7('0x25')]();};}function saveUpdates(_0x46451e,_0x5c20f3){return function(_0x8eb128){if(_0x8eb128){return _0x8eb128[_0xb5a7('0x26')](_0x46451e)[_0xb5a7('0x14')](function(_0x399e89){return _0x399e89;});}return null;};}function removeEntity(_0x583ce6,_0x3d6de1){return function(_0x54947a){if(_0x54947a){return _0x54947a['destroy']()[_0xb5a7('0x14')](function(){_0x583ce6[_0xb5a7('0x1d')](0xcc)[_0xb5a7('0x27')]();});}};}function handleEntityNotFound(_0x25708d,_0x4d2d22){return function(_0x177295){if(!_0x177295){_0x25708d[_0xb5a7('0x1c')](0x194);}return _0x177295;};}function handleError(_0x2c62da,_0x2fcdbd){_0x2fcdbd=_0x2fcdbd||0x1f4;return function(_0x2706ce){logger[_0xb5a7('0x19')](_0x2706ce['stack']);if(_0x2706ce['name']){delete _0x2706ce[_0xb5a7('0x28')];}_0x2c62da[_0xb5a7('0x1d')](_0x2fcdbd)[_0xb5a7('0x29')](_0x2706ce);};}exports[_0xb5a7('0x2a')]=function(_0x52328a,_0x1d0860){var _0x2061bc={},_0x92e0b2={},_0x5db8d2={'count':0x0,'rows':[]};var _0x39c0ad=db[_0xb5a7('0x2b')][_0xb5a7('0x2c')];_0x92e0b2[_0xb5a7('0x2d')]=_[_0xb5a7('0x2e')](_0x39c0ad);var _0x54d55f={'dateStart':_0x52328a['query']['dateStart'],'dateEnd':_0x52328a[_0xb5a7('0x2f')][_0xb5a7('0x30')]};delete _0x52328a[_0xb5a7('0x2f')][_0xb5a7('0x31')];delete _0x52328a[_0xb5a7('0x2f')][_0xb5a7('0x30')];_0x92e0b2[_0xb5a7('0x2f')]=_[_0xb5a7('0x2e')](_0x52328a[_0xb5a7('0x2f')]);_0x92e0b2[_0xb5a7('0x32')]=_[_0xb5a7('0x33')](_0x92e0b2['model'],_0x92e0b2[_0xb5a7('0x2f')]);_0x2061bc['attributes']=_[_0xb5a7('0x33')](_0x92e0b2[_0xb5a7('0x2d')],qs[_0xb5a7('0x34')](_0x52328a[_0xb5a7('0x2f')][_0xb5a7('0x34')]));_0x2061bc['attributes']=_0x2061bc[_0xb5a7('0x35')][_0xb5a7('0x36')]?_0x2061bc[_0xb5a7('0x35')]:_0x92e0b2[_0xb5a7('0x2d')];if(!_0x52328a[_0xb5a7('0x2f')][_0xb5a7('0x37')](_0xb5a7('0x38'))){_0x2061bc[_0xb5a7('0x21')]=qs[_0xb5a7('0x21')](_0x52328a['query'][_0xb5a7('0x21')]);_0x2061bc[_0xb5a7('0x20')]=qs['offset'](_0x52328a[_0xb5a7('0x2f')][_0xb5a7('0x20')]);}_0x2061bc[_0xb5a7('0x39')]=qs['sort'](_0x52328a[_0xb5a7('0x2f')][_0xb5a7('0x3a')]);_0x2061bc['where']=qs[_0xb5a7('0x32')](_['pick'](_0x52328a[_0xb5a7('0x2f')],_0x92e0b2[_0xb5a7('0x32')]));if(_0x54d55f[_0xb5a7('0x31')]){if(_0x54d55f[_0xb5a7('0x30')]){_0x54d55f['dateEnd']=moment(_0x54d55f[_0xb5a7('0x30')])[_0xb5a7('0x3b')](0x1,'day');}else{_0x54d55f[_0xb5a7('0x30')]=moment(_0x54d55f[_0xb5a7('0x31')])[_0xb5a7('0x3b')](0x1,'day');}_[_0xb5a7('0x3c')](_0x2061bc[_0xb5a7('0x3d')],{'createdAt':{'$gte':_0x54d55f[_0xb5a7('0x31')],'$lte':_0x54d55f['dateEnd']}});}if(_0x52328a[_0xb5a7('0x2f')]['filter']){_0x2061bc[_0xb5a7('0x3d')]=_[_0xb5a7('0x3c')](_0x2061bc['where'],{'$or':_[_0xb5a7('0x3e')](_0x2061bc[_0xb5a7('0x35')],function(_0x55082b){var _0x4acd97={};_0x4acd97[_0x55082b]={'$like':'%'+_0x52328a[_0xb5a7('0x2f')][_0xb5a7('0x3f')]+'%'};return _0x4acd97;})});}_0x2061bc=_[_0xb5a7('0x3c')]({},_0x2061bc,_0x52328a[_0xb5a7('0x40')]);var _0x4e6dc3={'where':_0x2061bc[_0xb5a7('0x3d')]};return db[_0xb5a7('0x2b')][_0xb5a7('0x1f')](_0x4e6dc3)[_0xb5a7('0x14')](function(_0x30f0af){_0x5db8d2['count']=_0x30f0af;if(_0x52328a[_0xb5a7('0x2f')][_0xb5a7('0x41')]){_0x2061bc['include']=[{'all':!![]}];}return db[_0xb5a7('0x2b')][_0xb5a7('0x42')](_0x2061bc);})['then'](function(_0x251180){_0x5db8d2[_0xb5a7('0x43')]=_0x251180;return _0x5db8d2;})[_0xb5a7('0x14')](respondWithFilteredResult(_0x1d0860,_0x2061bc))[_0xb5a7('0x1b')](handleError(_0x1d0860,null));};exports[_0xb5a7('0x44')]=function(_0x229192,_0x454641){var _0x49f519={'raw':![],'where':{'id':_0x229192[_0xb5a7('0x45')]['id']}},_0x4f6915={};_0x4f6915[_0xb5a7('0x2d')]=_[_0xb5a7('0x2e')](db[_0xb5a7('0x2b')]['rawAttributes']);_0x4f6915[_0xb5a7('0x2f')]=_[_0xb5a7('0x2e')](_0x229192[_0xb5a7('0x2f')]);_0x4f6915[_0xb5a7('0x32')]=_[_0xb5a7('0x33')](_0x4f6915[_0xb5a7('0x2d')],_0x4f6915[_0xb5a7('0x2f')]);_0x49f519['attributes']=_['intersection'](_0x4f6915[_0xb5a7('0x2d')],qs[_0xb5a7('0x34')](_0x229192[_0xb5a7('0x2f')][_0xb5a7('0x34')]));_0x49f519[_0xb5a7('0x35')]=_0x49f519[_0xb5a7('0x35')][_0xb5a7('0x36')]?_0x49f519[_0xb5a7('0x35')]:_0x4f6915[_0xb5a7('0x2d')];if(_0x229192['query'][_0xb5a7('0x41')]){_0x49f519['include']=[{'all':!![]}];}_0x49f519=_[_0xb5a7('0x3c')]({},_0x49f519,_0x229192[_0xb5a7('0x40')]);return db[_0xb5a7('0x2b')][_0xb5a7('0x46')](_0x49f519)[_0xb5a7('0x14')](handleEntityNotFound(_0x454641,null))[_0xb5a7('0x14')](respondWithResult(_0x454641,null))[_0xb5a7('0x1b')](handleError(_0x454641,null));};exports[_0xb5a7('0x47')]=function(_0x57dbe4,_0x16832e){return db[_0xb5a7('0x2b')]['create'](_0x57dbe4[_0xb5a7('0x48')],{})['then'](respondWithResult(_0x16832e,0xc9))[_0xb5a7('0x1b')](handleError(_0x16832e,null));};exports['update']=function(_0xdf3dff,_0x4bfc1b){if(_0xdf3dff['body']['id']){delete _0xdf3dff[_0xb5a7('0x48')]['id'];}return db['DeskAccount'][_0xb5a7('0x46')]({'where':{'id':_0xdf3dff[_0xb5a7('0x45')]['id']}})['then'](handleEntityNotFound(_0x4bfc1b,null))['then'](saveUpdates(_0xdf3dff[_0xb5a7('0x48')],null))[_0xb5a7('0x14')](respondWithResult(_0x4bfc1b,null))[_0xb5a7('0x1b')](handleError(_0x4bfc1b,null));};exports[_0xb5a7('0x49')]=function(_0x56f164,_0x29b789){return db[_0xb5a7('0x2b')][_0xb5a7('0x46')]({'where':{'id':_0x56f164[_0xb5a7('0x45')]['id']}})[_0xb5a7('0x14')](handleEntityNotFound(_0x29b789,null))[_0xb5a7('0x14')](removeEntity(_0x29b789,null))[_0xb5a7('0x1b')](handleError(_0x29b789,null));};exports[_0xb5a7('0x4a')]=function(_0x45e4a3,_0x25f63b,_0x28424c){var _0x2ff83a={};var _0x3ad3a7={};var _0xc5dd19;var _0xe55e04;return db[_0xb5a7('0x2b')][_0xb5a7('0x4b')]({'where':{'id':_0x45e4a3['params']['id']}})[_0xb5a7('0x14')](handleEntityNotFound(_0x25f63b,null))['then'](function(_0x2834ce){if(_0x2834ce){_0xc5dd19=_0x2834ce;_0x3ad3a7[_0xb5a7('0x2d')]=_[_0xb5a7('0x2e')](db['DeskConfiguration']['rawAttributes']);_0x3ad3a7[_0xb5a7('0x2f')]=_['keys'](_0x45e4a3[_0xb5a7('0x2f')]);_0x3ad3a7[_0xb5a7('0x32')]=_[_0xb5a7('0x33')](_0x3ad3a7[_0xb5a7('0x2d')],_0x3ad3a7[_0xb5a7('0x2f')]);_0x2ff83a[_0xb5a7('0x35')]=_['intersection'](_0x3ad3a7[_0xb5a7('0x2d')],qs['fields'](_0x45e4a3[_0xb5a7('0x2f')]['fields']));_0x2ff83a[_0xb5a7('0x35')]=_0x2ff83a[_0xb5a7('0x35')]['length']?_0x2ff83a[_0xb5a7('0x35')]:_0x3ad3a7[_0xb5a7('0x2d')];_0x2ff83a[_0xb5a7('0x39')]=qs[_0xb5a7('0x3a')](_0x45e4a3[_0xb5a7('0x2f')]['sort']);_0x2ff83a[_0xb5a7('0x3d')]=qs[_0xb5a7('0x32')](_[_0xb5a7('0x4c')](_0x45e4a3[_0xb5a7('0x2f')],_0x3ad3a7[_0xb5a7('0x32')]));if(_0x45e4a3[_0xb5a7('0x2f')][_0xb5a7('0x3f')]){_0x2ff83a[_0xb5a7('0x3d')]=_[_0xb5a7('0x3c')](_0x2ff83a[_0xb5a7('0x3d')],{'$or':_['map'](_0x2ff83a[_0xb5a7('0x35')],function(_0x914cc){var _0x54056f={};_0x54056f[_0x914cc]={'$like':'%'+_0x45e4a3[_0xb5a7('0x2f')]['filter']+'%'};return _0x54056f;})});}_0x2ff83a=_[_0xb5a7('0x3c')]({},_0x2ff83a,_0x45e4a3[_0xb5a7('0x40')]);return _0xc5dd19['getConfigurations'](_0x2ff83a);}})[_0xb5a7('0x14')](function(_0x333dcb){if(_0x333dcb){_0xe55e04=_0x333dcb[_0xb5a7('0x36')];if(!_0x45e4a3['query']['hasOwnProperty'](_0xb5a7('0x38'))){_0x2ff83a[_0xb5a7('0x21')]=qs['limit'](_0x45e4a3[_0xb5a7('0x2f')][_0xb5a7('0x21')]);_0x2ff83a[_0xb5a7('0x20')]=qs[_0xb5a7('0x20')](_0x45e4a3['query'][_0xb5a7('0x20')]);}return _0xc5dd19[_0xb5a7('0x4a')](_0x2ff83a);}})[_0xb5a7('0x14')](function(_0x534d28){if(_0x534d28){return _0x534d28?{'count':_0xe55e04,'rows':_0x534d28}:null;}})[_0xb5a7('0x14')](respondWithResult(_0x25f63b,null))[_0xb5a7('0x1b')](handleError(_0x25f63b,null));};exports[_0xb5a7('0x4d')]=function(_0xdda242,_0xa0d742,_0x18bafb){if(_0xdda242['body']['id']){delete _0xdda242[_0xb5a7('0x48')]['id'];}return db[_0xb5a7('0x2b')][_0xb5a7('0x4b')]({'where':{'id':_0xdda242[_0xb5a7('0x45')]['id']}})[_0xb5a7('0x14')](handleEntityNotFound(_0xa0d742,null))[_0xb5a7('0x14')](function(_0x17c1a2){if(_0x17c1a2){_0xdda242['body'][_0xb5a7('0x4e')]=_0x17c1a2['id'];_0xdda242[_0xb5a7('0x48')][_0xb5a7('0x4f')]=integrations[_0xb5a7('0x50')](_0xdda242[_0xb5a7('0x48')][_0xb5a7('0x51')],_0xdda242['body'][_0xb5a7('0x52')]);_0xdda242[_0xb5a7('0x48')][_0xb5a7('0x53')]=integrations[_0xb5a7('0x54')](_0xdda242[_0xb5a7('0x48')][_0xb5a7('0x51')],_0xdda242[_0xb5a7('0x48')][_0xb5a7('0x52')]);return db['DeskConfiguration'][_0xb5a7('0x47')](_0xdda242[_0xb5a7('0x48')],{'include':[{'model':db[_0xb5a7('0x55')],'as':_0xb5a7('0x4f')},{'model':db[_0xb5a7('0x55')],'as':'Descriptions'}]});}return null;})[_0xb5a7('0x14')](respondWithResult(_0xa0d742,null))[_0xb5a7('0x1b')](handleError(_0xa0d742,null));};exports[_0xb5a7('0x56')]=function(_0x220b21,_0x521bd4,_0x43d6b0){var _0x34a3c8=[{'name':_0xb5a7('0x57'),'label':_0xb5a7('0x57'),'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[_0xb5a7('0x2b')][_0xb5a7('0x4b')]({'where':{'id':_0x220b21[_0xb5a7('0x45')]['id']},'attributes':['id',_0xb5a7('0x58'),'authType',_0xb5a7('0x59'),_0xb5a7('0x5a'),_0xb5a7('0x5b'),_0xb5a7('0x5c'),'token',_0xb5a7('0x5d')]})['then'](handleEntityNotFound(_0x521bd4,null))[_0xb5a7('0x14')](function(_0x50052f){if(_0x50052f){var _0x572fda={'method':_0xb5a7('0x5e'),'uri':util[_0xb5a7('0x5f')](_0xb5a7('0x60'),_0x50052f[_0xb5a7('0x58')]),'headers':{'Content-Type':_0xb5a7('0x61'),'Accept':'application/json'},'json':!![]};if(_0x50052f[_0xb5a7('0x62')]===_0xb5a7('0x63')){_0x572fda[_0xb5a7('0x64')][_0xb5a7('0x65')]=util['format'](_0xb5a7('0x66'),new Buffer(util[_0xb5a7('0x5f')](_0xb5a7('0x67'),_0x50052f[_0xb5a7('0x59')],_0x50052f[_0xb5a7('0x5a')]))[_0xb5a7('0x68')](_0xb5a7('0x69')));}return rp(_0x572fda)['then'](function(_0x4f3112){return _0x34a3c8[_0xb5a7('0x6a')](_['map'](_0x4f3112['_embedded'][_0xb5a7('0x6b')],function(_0x7952e2){return{'id':_0x7952e2['name'],'name':_0x7952e2['name'],'type':_0x7952e2['type'],'active':_0x7952e2[_0xb5a7('0x6c')],'label':_0x7952e2[_0xb5a7('0x6d')],'custom':!![]};}));});}})['then'](function(_0x35a5dd){return{'count':_0x35a5dd[_0xb5a7('0x36')],'rows':_0x35a5dd};})[_0xb5a7('0x14')](respondWithResult(_0x521bd4,null))[_0xb5a7('0x1b')](function(_0x6cae40){var _0x423b28=_0x220b21['query']['test']?0x1f4:_0x6cae40['statusCode']||0x1f4;logger[_0xb5a7('0x19')](_0xb5a7('0x6e'),_0xb5a7('0x56'),_0x423b28,JSON[_0xb5a7('0x6f')](_0x6cae40));delete _0x6cae40[_0xb5a7('0x28')];if(_0x423b28===0x191){_0x423b28=0x190;}_0x521bd4[_0xb5a7('0x1d')](_0x423b28)[_0xb5a7('0x29')](_0x220b21['query'][_0xb5a7('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x6cae40[_0xb5a7('0x71')]}:_0x6cae40);});}; \ No newline at end of file +var _0xb1c7=['username','password','consumerKey','token','tokenSecret','GET','format','%s/custom_fields','application/json','authType','basic','headers','Authorization','Basic\x20%s','%s:%s','base64','concat','_embedded','entries','name','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','DeskAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','stack','send','index','DeskAccount','rawAttributes','keys','dateStart','query','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','add','merge','where','filter','map','options','include','findAll','rows','show','params','includeAll','find','create','body','destroy','getConfigurations','findOne','DeskConfiguration','order','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','type','DeskField','getFields','priority','remoteUri'];(function(_0x334303,_0x50919f){var _0x42f384=function(_0x5954f5){while(--_0x5954f5){_0x334303['push'](_0x334303['shift']());}};_0x42f384(++_0x50919f);}(_0xb1c7,0x183));var _0x7b1c=function(_0x868611,_0x1a176e){_0x868611=_0x868611-0x0;var _0x143a08=_0xb1c7[_0x868611];return _0x143a08;};'use strict';var jsonpatch=require(_0x7b1c('0x0'));var rp=require(_0x7b1c('0x1'));var moment=require(_0x7b1c('0x2'));var BPromise=require(_0x7b1c('0x3'));var Mustache=require('mustache');var util=require(_0x7b1c('0x4'));var path=require(_0x7b1c('0x5'));var sox=require(_0x7b1c('0x6'));var csv=require(_0x7b1c('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7b1c('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7b1c('0x9'));var deskjs=require(_0x7b1c('0xa'));var toCsv=require(_0x7b1c('0x7'));var querystring=require(_0x7b1c('0xb'));var Papa=require(_0x7b1c('0xc'));var qs=require(_0x7b1c('0xd'));var logger=require(_0x7b1c('0xe'))(_0x7b1c('0xf'));var utils=require('../../config/utils');var config=require(_0x7b1c('0x10'));var db=require(_0x7b1c('0x11'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x7b1c('0x12'));var client=jayson[_0x7b1c('0x13')][_0x7b1c('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x2a1cda,_0x437cbe,_0x608951,_0x39509b){return new BPromise(function(_0x23c45a,_0xb9b2ee){var _0x396b85=_0x39509b||client;return _0x396b85[_0x7b1c('0x15')](_0x2a1cda,_0x608951)[_0x7b1c('0x16')](function(_0x3451a1){logger[_0x7b1c('0x17')]('DeskAccount,\x20%s,\x20%s',_0x437cbe,'request\x20sent');logger[_0x7b1c('0x18')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x437cbe,_0x7b1c('0x19'),JSON['stringify'](_0x3451a1));if(_0x3451a1[_0x7b1c('0x1a')]){if(_0x3451a1[_0x7b1c('0x1a')]['code']===0x1f4){logger[_0x7b1c('0x1a')](_0x7b1c('0x1b'),_0x437cbe,_0x3451a1[_0x7b1c('0x1a')][_0x7b1c('0x1c')]);return _0xb9b2ee(_0x3451a1['error'][_0x7b1c('0x1c')]);}logger[_0x7b1c('0x1a')](_0x7b1c('0x1b'),_0x437cbe,_0x3451a1[_0x7b1c('0x1a')][_0x7b1c('0x1c')]);return _0x23c45a(_0x3451a1[_0x7b1c('0x1a')][_0x7b1c('0x1c')]);}else{logger['info'](_0x7b1c('0x1b'),_0x437cbe,_0x7b1c('0x19'));_0x23c45a(_0x3451a1[_0x7b1c('0x1d')][_0x7b1c('0x1c')]);}})[_0x7b1c('0x1e')](function(_0x5f4d6b){logger[_0x7b1c('0x1a')](_0x7b1c('0x1b'),_0x437cbe,_0x5f4d6b);_0xb9b2ee(_0x5f4d6b);});});}function respondWithStatusCode(_0x1f64c7,_0x3d6826){_0x3d6826=_0x3d6826||0xcc;return function(_0x1c0c56){if(_0x1c0c56){return _0x1f64c7[_0x7b1c('0x1f')](_0x3d6826);}return _0x1f64c7[_0x7b1c('0x20')](_0x3d6826)[_0x7b1c('0x21')]();};}function respondWithResult(_0x58df77,_0x4572e3){_0x4572e3=_0x4572e3||0xc8;return function(_0x3fc42e){if(_0x3fc42e){return _0x58df77[_0x7b1c('0x20')](_0x4572e3)[_0x7b1c('0x22')](_0x3fc42e);}};}function respondWithFilteredResult(_0x1628ba,_0x5c8091){return function(_0x345022){if(_0x345022){var _0x1ed593=_0x345022[_0x7b1c('0x23')],_0x45f4d2=_0x5c8091[_0x7b1c('0x24')],_0x4dc3b2=_0x5c8091[_0x7b1c('0x24')]+_0x5c8091[_0x7b1c('0x25')],_0x35861a;if(_0x4dc3b2>=_0x1ed593){_0x4dc3b2=_0x1ed593;_0x35861a=0xc8;}else{_0x35861a=0xce;}_0x1628ba[_0x7b1c('0x20')](_0x35861a);return _0x1628ba['set'](_0x7b1c('0x26'),_0x45f4d2+'-'+_0x4dc3b2+'/'+_0x1ed593)[_0x7b1c('0x22')](_0x345022);}return null;};}function patchUpdates(_0x1e9a07){return function(_0x31c7ac){try{jsonpatch[_0x7b1c('0x27')](_0x31c7ac,_0x1e9a07,!![]);}catch(_0x99aae4){return BPromise['reject'](_0x99aae4);}return _0x31c7ac[_0x7b1c('0x28')]();};}function saveUpdates(_0xc06b3f,_0x18a316){return function(_0x1fcca9){if(_0x1fcca9){return _0x1fcca9[_0x7b1c('0x29')](_0xc06b3f)[_0x7b1c('0x16')](function(_0x8831d5){return _0x8831d5;});}return null;};}function removeEntity(_0xcdeaf5,_0x33e355){return function(_0x3df090){if(_0x3df090){return _0x3df090['destroy']()[_0x7b1c('0x16')](function(){_0xcdeaf5[_0x7b1c('0x20')](0xcc)[_0x7b1c('0x21')]();});}};}function handleEntityNotFound(_0xb48e8b,_0x1bac58){return function(_0xfa7813){if(!_0xfa7813){_0xb48e8b[_0x7b1c('0x1f')](0x194);}return _0xfa7813;};}function handleError(_0x3afb2f,_0x2fea5e){_0x2fea5e=_0x2fea5e||0x1f4;return function(_0x2620be){logger[_0x7b1c('0x1a')](_0x2620be[_0x7b1c('0x2a')]);if(_0x2620be['name']){delete _0x2620be['name'];}_0x3afb2f[_0x7b1c('0x20')](_0x2fea5e)[_0x7b1c('0x2b')](_0x2620be);};}exports[_0x7b1c('0x2c')]=function(_0x15e472,_0x547d59){var _0xbe663={},_0x287c89={},_0xd5d8a6={'count':0x0,'rows':[]};var _0x48e5ab=db[_0x7b1c('0x2d')][_0x7b1c('0x2e')];_0x287c89['model']=_[_0x7b1c('0x2f')](_0x48e5ab);var _0x5da6ab={'dateStart':_0x15e472['query'][_0x7b1c('0x30')],'dateEnd':_0x15e472[_0x7b1c('0x31')][_0x7b1c('0x32')]};delete _0x15e472['query'][_0x7b1c('0x30')];delete _0x15e472['query'][_0x7b1c('0x32')];_0x287c89['query']=_[_0x7b1c('0x2f')](_0x15e472['query']);_0x287c89[_0x7b1c('0x33')]=_[_0x7b1c('0x34')](_0x287c89[_0x7b1c('0x35')],_0x287c89['query']);_0xbe663[_0x7b1c('0x36')]=_['intersection'](_0x287c89[_0x7b1c('0x35')],qs[_0x7b1c('0x37')](_0x15e472[_0x7b1c('0x31')]['fields']));_0xbe663['attributes']=_0xbe663[_0x7b1c('0x36')][_0x7b1c('0x38')]?_0xbe663[_0x7b1c('0x36')]:_0x287c89[_0x7b1c('0x35')];if(!_0x15e472[_0x7b1c('0x31')][_0x7b1c('0x39')]('nolimit')){_0xbe663['limit']=qs['limit'](_0x15e472['query'][_0x7b1c('0x25')]);_0xbe663[_0x7b1c('0x24')]=qs[_0x7b1c('0x24')](_0x15e472[_0x7b1c('0x31')][_0x7b1c('0x24')]);}_0xbe663['order']=qs[_0x7b1c('0x3a')](_0x15e472[_0x7b1c('0x31')][_0x7b1c('0x3a')]);_0xbe663['where']=qs[_0x7b1c('0x33')](_['pick'](_0x15e472[_0x7b1c('0x31')],_0x287c89[_0x7b1c('0x33')]));if(_0x5da6ab[_0x7b1c('0x30')]){if(_0x5da6ab[_0x7b1c('0x32')]){_0x5da6ab[_0x7b1c('0x32')]=moment(_0x5da6ab[_0x7b1c('0x32')])[_0x7b1c('0x3b')](0x1,'day');}else{_0x5da6ab[_0x7b1c('0x32')]=moment(_0x5da6ab['dateStart'])[_0x7b1c('0x3b')](0x1,'day');}_[_0x7b1c('0x3c')](_0xbe663[_0x7b1c('0x3d')],{'createdAt':{'$gte':_0x5da6ab['dateStart'],'$lte':_0x5da6ab['dateEnd']}});}if(_0x15e472['query'][_0x7b1c('0x3e')]){_0xbe663['where']=_[_0x7b1c('0x3c')](_0xbe663[_0x7b1c('0x3d')],{'$or':_[_0x7b1c('0x3f')](_0xbe663[_0x7b1c('0x36')],function(_0x3c9440){var _0x49d75e={};_0x49d75e[_0x3c9440]={'$like':'%'+_0x15e472[_0x7b1c('0x31')]['filter']+'%'};return _0x49d75e;})});}_0xbe663=_[_0x7b1c('0x3c')]({},_0xbe663,_0x15e472[_0x7b1c('0x40')]);var _0x2f9ab5={'where':_0xbe663[_0x7b1c('0x3d')]};return db['DeskAccount'][_0x7b1c('0x23')](_0x2f9ab5)[_0x7b1c('0x16')](function(_0x4d1686){_0xd5d8a6[_0x7b1c('0x23')]=_0x4d1686;if(_0x15e472[_0x7b1c('0x31')]['includeAll']){_0xbe663[_0x7b1c('0x41')]=[{'all':!![]}];}return db[_0x7b1c('0x2d')][_0x7b1c('0x42')](_0xbe663);})['then'](function(_0x4f486d){_0xd5d8a6[_0x7b1c('0x43')]=_0x4f486d;return _0xd5d8a6;})[_0x7b1c('0x16')](respondWithFilteredResult(_0x547d59,_0xbe663))[_0x7b1c('0x1e')](handleError(_0x547d59,null));};exports[_0x7b1c('0x44')]=function(_0x4ed85c,_0x27fb5c){var _0x529ca7={'raw':![],'where':{'id':_0x4ed85c[_0x7b1c('0x45')]['id']}},_0x4c77c3={};_0x4c77c3['model']=_[_0x7b1c('0x2f')](db['DeskAccount'][_0x7b1c('0x2e')]);_0x4c77c3[_0x7b1c('0x31')]=_[_0x7b1c('0x2f')](_0x4ed85c[_0x7b1c('0x31')]);_0x4c77c3['filters']=_['intersection'](_0x4c77c3[_0x7b1c('0x35')],_0x4c77c3[_0x7b1c('0x31')]);_0x529ca7[_0x7b1c('0x36')]=_[_0x7b1c('0x34')](_0x4c77c3[_0x7b1c('0x35')],qs[_0x7b1c('0x37')](_0x4ed85c['query'][_0x7b1c('0x37')]));_0x529ca7['attributes']=_0x529ca7[_0x7b1c('0x36')][_0x7b1c('0x38')]?_0x529ca7[_0x7b1c('0x36')]:_0x4c77c3[_0x7b1c('0x35')];if(_0x4ed85c[_0x7b1c('0x31')][_0x7b1c('0x46')]){_0x529ca7[_0x7b1c('0x41')]=[{'all':!![]}];}_0x529ca7=_[_0x7b1c('0x3c')]({},_0x529ca7,_0x4ed85c[_0x7b1c('0x40')]);return db['DeskAccount'][_0x7b1c('0x47')](_0x529ca7)[_0x7b1c('0x16')](handleEntityNotFound(_0x27fb5c,null))[_0x7b1c('0x16')](respondWithResult(_0x27fb5c,null))['catch'](handleError(_0x27fb5c,null));};exports[_0x7b1c('0x48')]=function(_0x5bc56f,_0x466b9a){return db[_0x7b1c('0x2d')]['create'](_0x5bc56f[_0x7b1c('0x49')],{})[_0x7b1c('0x16')](respondWithResult(_0x466b9a,0xc9))['catch'](handleError(_0x466b9a,null));};exports[_0x7b1c('0x29')]=function(_0x254dd8,_0x5561f0){if(_0x254dd8[_0x7b1c('0x49')]['id']){delete _0x254dd8[_0x7b1c('0x49')]['id'];}return db[_0x7b1c('0x2d')][_0x7b1c('0x47')]({'where':{'id':_0x254dd8[_0x7b1c('0x45')]['id']}})[_0x7b1c('0x16')](handleEntityNotFound(_0x5561f0,null))['then'](saveUpdates(_0x254dd8[_0x7b1c('0x49')],null))[_0x7b1c('0x16')](respondWithResult(_0x5561f0,null))[_0x7b1c('0x1e')](handleError(_0x5561f0,null));};exports[_0x7b1c('0x4a')]=function(_0x19d141,_0xe9b24f){return db[_0x7b1c('0x2d')][_0x7b1c('0x47')]({'where':{'id':_0x19d141[_0x7b1c('0x45')]['id']}})[_0x7b1c('0x16')](handleEntityNotFound(_0xe9b24f,null))[_0x7b1c('0x16')](removeEntity(_0xe9b24f,null))[_0x7b1c('0x1e')](handleError(_0xe9b24f,null));};exports[_0x7b1c('0x4b')]=function(_0x54f7ef,_0x352d01,_0x140b2f){var _0x20e1a7={};var _0x5bd067={};var _0x588bab;var _0xf9ed77;return db[_0x7b1c('0x2d')][_0x7b1c('0x4c')]({'where':{'id':_0x54f7ef[_0x7b1c('0x45')]['id']}})[_0x7b1c('0x16')](handleEntityNotFound(_0x352d01,null))[_0x7b1c('0x16')](function(_0x503011){if(_0x503011){_0x588bab=_0x503011;_0x5bd067[_0x7b1c('0x35')]=_[_0x7b1c('0x2f')](db[_0x7b1c('0x4d')]['rawAttributes']);_0x5bd067[_0x7b1c('0x31')]=_[_0x7b1c('0x2f')](_0x54f7ef[_0x7b1c('0x31')]);_0x5bd067[_0x7b1c('0x33')]=_[_0x7b1c('0x34')](_0x5bd067[_0x7b1c('0x35')],_0x5bd067[_0x7b1c('0x31')]);_0x20e1a7['attributes']=_['intersection'](_0x5bd067[_0x7b1c('0x35')],qs[_0x7b1c('0x37')](_0x54f7ef['query']['fields']));_0x20e1a7['attributes']=_0x20e1a7[_0x7b1c('0x36')][_0x7b1c('0x38')]?_0x20e1a7[_0x7b1c('0x36')]:_0x5bd067[_0x7b1c('0x35')];_0x20e1a7[_0x7b1c('0x4e')]=qs['sort'](_0x54f7ef[_0x7b1c('0x31')][_0x7b1c('0x3a')]);_0x20e1a7[_0x7b1c('0x3d')]=qs['filters'](_[_0x7b1c('0x4f')](_0x54f7ef['query'],_0x5bd067[_0x7b1c('0x33')]));if(_0x54f7ef['query'][_0x7b1c('0x3e')]){_0x20e1a7[_0x7b1c('0x3d')]=_[_0x7b1c('0x3c')](_0x20e1a7['where'],{'$or':_['map'](_0x20e1a7[_0x7b1c('0x36')],function(_0x3cf5c7){var _0xb22029={};_0xb22029[_0x3cf5c7]={'$like':'%'+_0x54f7ef['query'][_0x7b1c('0x3e')]+'%'};return _0xb22029;})});}_0x20e1a7=_['merge']({},_0x20e1a7,_0x54f7ef['options']);return _0x588bab[_0x7b1c('0x4b')](_0x20e1a7);}})[_0x7b1c('0x16')](function(_0x5deae4){if(_0x5deae4){_0xf9ed77=_0x5deae4['length'];if(!_0x54f7ef[_0x7b1c('0x31')][_0x7b1c('0x39')](_0x7b1c('0x50'))){_0x20e1a7['limit']=qs[_0x7b1c('0x25')](_0x54f7ef[_0x7b1c('0x31')][_0x7b1c('0x25')]);_0x20e1a7[_0x7b1c('0x24')]=qs[_0x7b1c('0x24')](_0x54f7ef[_0x7b1c('0x31')][_0x7b1c('0x24')]);}return _0x588bab['getConfigurations'](_0x20e1a7);}})[_0x7b1c('0x16')](function(_0x499fb4){if(_0x499fb4){return _0x499fb4?{'count':_0xf9ed77,'rows':_0x499fb4}:null;}})[_0x7b1c('0x16')](respondWithResult(_0x352d01,null))[_0x7b1c('0x1e')](handleError(_0x352d01,null));};exports[_0x7b1c('0x51')]=function(_0x43e729,_0x5b82c6,_0x5e7c6d){if(_0x43e729[_0x7b1c('0x49')]['id']){delete _0x43e729[_0x7b1c('0x49')]['id'];}return db[_0x7b1c('0x2d')]['findOne']({'where':{'id':_0x43e729[_0x7b1c('0x45')]['id']}})[_0x7b1c('0x16')](handleEntityNotFound(_0x5b82c6,null))[_0x7b1c('0x16')](function(_0x27e99e){if(_0x27e99e){_0x43e729['body'][_0x7b1c('0x52')]=_0x27e99e['id'];_0x43e729[_0x7b1c('0x49')][_0x7b1c('0x53')]=integrations[_0x7b1c('0x54')](_0x43e729[_0x7b1c('0x49')][_0x7b1c('0x55')],_0x43e729['body']['type']);_0x43e729['body'][_0x7b1c('0x56')]=integrations[_0x7b1c('0x57')](_0x43e729[_0x7b1c('0x49')][_0x7b1c('0x55')],_0x43e729[_0x7b1c('0x49')][_0x7b1c('0x58')]);return db['DeskConfiguration']['create'](_0x43e729[_0x7b1c('0x49')],{'include':[{'model':db['DeskField'],'as':_0x7b1c('0x53')},{'model':db[_0x7b1c('0x59')],'as':'Descriptions'}]});}return null;})[_0x7b1c('0x16')](respondWithResult(_0x5b82c6,null))[_0x7b1c('0x1e')](handleError(_0x5b82c6,null));};exports[_0x7b1c('0x5a')]=function(_0x2485a4,_0x247db1,_0x1e2679){var _0x51d247=[{'name':_0x7b1c('0x5b'),'label':_0x7b1c('0x5b'),'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[_0x7b1c('0x2d')][_0x7b1c('0x4c')]({'where':{'id':_0x2485a4[_0x7b1c('0x45')]['id']},'attributes':['id',_0x7b1c('0x5c'),'authType',_0x7b1c('0x5d'),_0x7b1c('0x5e'),_0x7b1c('0x5f'),'consumerSecret',_0x7b1c('0x60'),_0x7b1c('0x61')]})[_0x7b1c('0x16')](handleEntityNotFound(_0x247db1,null))[_0x7b1c('0x16')](function(_0x1730ed){if(_0x1730ed){var _0x2c1781={'method':_0x7b1c('0x62'),'uri':util[_0x7b1c('0x63')](_0x7b1c('0x64'),_0x1730ed['remoteUri']),'headers':{'Content-Type':_0x7b1c('0x65'),'Accept':_0x7b1c('0x65')},'json':!![]};if(_0x1730ed[_0x7b1c('0x66')]===_0x7b1c('0x67')){_0x2c1781[_0x7b1c('0x68')][_0x7b1c('0x69')]=util['format'](_0x7b1c('0x6a'),new Buffer(util[_0x7b1c('0x63')](_0x7b1c('0x6b'),_0x1730ed[_0x7b1c('0x5d')],_0x1730ed['password']))['toString'](_0x7b1c('0x6c')));}return rp(_0x2c1781)[_0x7b1c('0x16')](function(_0x261a56){return _0x51d247[_0x7b1c('0x6d')](_[_0x7b1c('0x3f')](_0x261a56[_0x7b1c('0x6e')][_0x7b1c('0x6f')],function(_0x33e6eb){return{'id':_0x33e6eb[_0x7b1c('0x70')],'name':_0x33e6eb[_0x7b1c('0x70')],'type':_0x33e6eb[_0x7b1c('0x58')],'active':_0x33e6eb[_0x7b1c('0x71')],'label':_0x33e6eb[_0x7b1c('0x72')],'custom':!![]};}));});}})['then'](function(_0x3a0cb7){return{'count':_0x3a0cb7['length'],'rows':_0x3a0cb7};})[_0x7b1c('0x16')](respondWithResult(_0x247db1,null))[_0x7b1c('0x1e')](function(_0x2e895e){var _0x5a4030=_0x2485a4[_0x7b1c('0x31')][_0x7b1c('0x73')]?0x1f4:_0x2e895e[_0x7b1c('0x74')]||0x1f4;logger[_0x7b1c('0x1a')](_0x7b1c('0x75'),_0x7b1c('0x5a'),_0x5a4030,JSON[_0x7b1c('0x76')](_0x2e895e));delete _0x2e895e[_0x7b1c('0x70')];if(_0x5a4030===0x191){_0x5a4030=0x190;}_0x247db1[_0x7b1c('0x20')](_0x5a4030)[_0x7b1c('0x2b')](_0x2485a4[_0x7b1c('0x31')][_0x7b1c('0x73')]?{'message':_0x7b1c('0x77'),'statusCode':_0x2e895e[_0x7b1c('0x74')]}:_0x2e895e);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 85aa9bb..af23b35 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 _0xdfb1=['api','bluebird','request-promise','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger'];(function(_0x2b0f81,_0x3917f0){var _0x5ce74c=function(_0x12dc0d){while(--_0x12dc0d){_0x2b0f81['push'](_0x2b0f81['shift']());}};_0x5ce74c(++_0x3917f0);}(_0xdfb1,0x8c));var _0x1dfb=function(_0x2aa95b,_0x3be607){_0x2aa95b=_0x2aa95b-0x0;var _0x50caca=_0xdfb1[_0x2aa95b];return _0x50caca;};'use strict';var _=require(_0x1dfb('0x0'));var util=require(_0x1dfb('0x1'));var logger=require(_0x1dfb('0x2'))(_0x1dfb('0x3'));var moment=require('moment');var BPromise=require(_0x1dfb('0x4'));var rp=require(_0x1dfb('0x5'));var attributes=require(_0x1dfb('0x6'));var integrations=require(_0x1dfb('0x7'));module['exports']=function(_0x51ad43,_0x4ba239){return _0x51ad43[_0x1dfb('0x8')](_0x1dfb('0x9'),attributes,{'tableName':_0x1dfb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda81=['int_desk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','./intDeskAccount.attributes','exports','define'];(function(_0x3b6e0e,_0x1a7238){var _0x23e579=function(_0x2517ad){while(--_0x2517ad){_0x3b6e0e['push'](_0x3b6e0e['shift']());}};_0x23e579(++_0x1a7238);}(_0xda81,0x1c3));var _0x1da8=function(_0x357194,_0x84511e){_0x357194=_0x357194-0x0;var _0x24cab8=_0xda81[_0x357194];return _0x24cab8;};'use strict';var _=require(_0x1da8('0x0'));var util=require(_0x1da8('0x1'));var logger=require(_0x1da8('0x2'))('api');var moment=require(_0x1da8('0x3'));var BPromise=require(_0x1da8('0x4'));var rp=require(_0x1da8('0x5'));var attributes=require(_0x1da8('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x1da8('0x7')]=function(_0x2692c1,_0x5ac2b7){return _0x2692c1[_0x1da8('0x8')]('DeskAccount',attributes,{'tableName':_0x1da8('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 2bb91d8..7b175d9 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 _0x3f84=['request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','options','raw','where','attributes','limit','include','map','model','ShowDeskAccount','find','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s'];(function(_0x5c0ca4,_0x191abb){var _0x597047=function(_0x3a4dd4){while(--_0x3a4dd4){_0x5c0ca4['push'](_0x5c0ca4['shift']());}};_0x597047(++_0x191abb);}(_0x3f84,0x99));var _0x43f8=function(_0x56abe6,_0x1dfa2b){_0x56abe6=_0x56abe6-0x0;var _0x39a04d=_0x3f84[_0x56abe6];return _0x39a04d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x43f8('0x0'));var BPromise=require(_0x43f8('0x1'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x43f8('0x2'))['db'];var utils=require(_0x43f8('0x3'));var logger=require(_0x43f8('0x4'))(_0x43f8('0x5'));var config=require('../../config/environment');var jayson=require(_0x43f8('0x6'));var client=jayson[_0x43f8('0x7')][_0x43f8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e6944,_0x4cb3c7,_0x105ec3){return new BPromise(function(_0x5169e7,_0x588e3b){return client['request'](_0x5e6944,_0x105ec3)[_0x43f8('0x9')](function(_0x20a4d3){logger[_0x43f8('0xa')](_0x43f8('0xb'),_0x4cb3c7,_0x43f8('0xc'));logger[_0x43f8('0xd')](_0x43f8('0xe'),_0x4cb3c7,'request\x20sent',JSON[_0x43f8('0xf')](_0x20a4d3));if(_0x20a4d3[_0x43f8('0x10')]){if(_0x20a4d3['error'][_0x43f8('0x11')]===0x1f4){logger[_0x43f8('0x10')](_0x43f8('0xb'),_0x4cb3c7,_0x20a4d3[_0x43f8('0x10')][_0x43f8('0x12')]);return _0x588e3b(_0x20a4d3[_0x43f8('0x10')][_0x43f8('0x12')]);}logger[_0x43f8('0x10')](_0x43f8('0xb'),_0x4cb3c7,_0x20a4d3[_0x43f8('0x10')]['message']);return _0x5169e7(_0x20a4d3[_0x43f8('0x10')][_0x43f8('0x12')]);}else{logger['info'](_0x43f8('0xb'),_0x4cb3c7,_0x43f8('0xc'));_0x5169e7(_0x20a4d3[_0x43f8('0x13')]['message']);}})[_0x43f8('0x14')](function(_0x22c0a4){logger[_0x43f8('0x10')](_0x43f8('0xb'),_0x4cb3c7,_0x22c0a4);_0x588e3b(_0x22c0a4);});});}exports[_0x43f8('0x15')]=function(_0x571026){var _0x4e21cc=this;return new Promise(function(_0x24120a,_0x157f5a){return db[_0x43f8('0x16')]['findAll']({'raw':_0x571026[_0x43f8('0x17')]?_0x571026[_0x43f8('0x17')][_0x43f8('0x18')]===undefined?!![]:![]:!![],'where':_0x571026['options']?_0x571026[_0x43f8('0x17')][_0x43f8('0x19')]||null:null,'attributes':_0x571026[_0x43f8('0x17')]?_0x571026[_0x43f8('0x17')][_0x43f8('0x1a')]||null:null,'limit':_0x571026[_0x43f8('0x17')]?_0x571026[_0x43f8('0x17')][_0x43f8('0x1b')]||null:null,'include':_0x571026[_0x43f8('0x17')]?_0x571026[_0x43f8('0x17')][_0x43f8('0x1c')]?_[_0x43f8('0x1d')](_0x571026[_0x43f8('0x17')][_0x43f8('0x1c')],function(_0x189a67){return{'model':db[_0x189a67[_0x43f8('0x1e')]],'as':_0x189a67['as'],'attributes':_0x189a67['attributes'],'include':_0x189a67[_0x43f8('0x1c')]?_[_0x43f8('0x1d')](_0x189a67[_0x43f8('0x1c')],function(_0x17c61){return{'model':db[_0x17c61[_0x43f8('0x1e')]],'as':_0x17c61['as'],'attributes':_0x17c61[_0x43f8('0x1a')],'include':_0x17c61[_0x43f8('0x1c')]?_[_0x43f8('0x1d')](_0x17c61[_0x43f8('0x1c')],function(_0x455a90){return{'model':db[_0x455a90['model']],'as':_0x455a90['as'],'attributes':_0x455a90[_0x43f8('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a143d){logger[_0x43f8('0xa')]('GetDeskAccount',_0x571026);logger[_0x43f8('0xd')](_0x43f8('0x15'),_0x571026,JSON[_0x43f8('0xf')](_0x3a143d));_0x24120a(_0x3a143d);})[_0x43f8('0x14')](function(_0x7acd4c){logger[_0x43f8('0x10')](_0x43f8('0x15'),_0x7acd4c['message'],_0x571026);_0x157f5a(_0x4e21cc[_0x43f8('0x10')](0x1f4,_0x7acd4c[_0x43f8('0x12')]));});});};exports[_0x43f8('0x1f')]=function(_0x515e2f){var _0x40a2f8=this;return new Promise(function(_0x5c8964,_0x4375f0){return db[_0x43f8('0x16')][_0x43f8('0x20')]({'raw':_0x515e2f[_0x43f8('0x17')]?_0x515e2f[_0x43f8('0x17')][_0x43f8('0x18')]===undefined?!![]:![]:!![],'where':_0x515e2f[_0x43f8('0x17')]?_0x515e2f['options'][_0x43f8('0x19')]||null:null,'attributes':_0x515e2f[_0x43f8('0x17')]?_0x515e2f[_0x43f8('0x17')][_0x43f8('0x1a')]||null:null,'include':_0x515e2f[_0x43f8('0x17')]?_0x515e2f[_0x43f8('0x17')]['include']?_[_0x43f8('0x1d')](_0x515e2f[_0x43f8('0x17')]['include'],function(_0x3d15ff){return{'model':db[_0x3d15ff['model']],'as':_0x3d15ff['as'],'attributes':_0x3d15ff['attributes'],'include':_0x3d15ff[_0x43f8('0x1c')]?_[_0x43f8('0x1d')](_0x3d15ff[_0x43f8('0x1c')],function(_0x359190){return{'model':db[_0x359190[_0x43f8('0x1e')]],'as':_0x359190['as'],'attributes':_0x359190[_0x43f8('0x1a')],'include':_0x359190[_0x43f8('0x1c')]?_[_0x43f8('0x1d')](_0x359190['include'],function(_0x81fac9){return{'model':db[_0x81fac9['model']],'as':_0x81fac9['as'],'attributes':_0x81fac9[_0x43f8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x43f8('0x9')](function(_0x5b8a4e){logger['info'](_0x43f8('0x1f'),_0x515e2f);logger['debug']('ShowDeskAccount',_0x515e2f,JSON[_0x43f8('0xf')](_0x5b8a4e));_0x5c8964(_0x5b8a4e);})[_0x43f8('0x14')](function(_0x4c7f78){logger[_0x43f8('0x10')]('ShowDeskAccount',_0x4c7f78[_0x43f8('0x12')],_0x515e2f);_0x4375f0(_0x40a2f8['error'](0x1f4,_0x4c7f78[_0x43f8('0x12')]));});});}; \ No newline at end of file +var _0x5b6c=['message','result','GetDeskAccount','DeskAccount','findAll','options','where','attributes','include','map','model','stringify','ShowDeskAccount','raw','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x254df7,_0x2d798c){var _0xd6b2f8=function(_0x37149d){while(--_0x37149d){_0x254df7['push'](_0x254df7['shift']());}};_0xd6b2f8(++_0x2d798c);}(_0x5b6c,0x141));var _0xc5b6=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x5b6c[_0x4ed520];return _0x4415a6;};'use strict';var _=require(_0xc5b6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc5b6('0x1'));var rs=require(_0xc5b6('0x2'));var fs=require('fs');var db=require(_0xc5b6('0x3'))['db'];var utils=require(_0xc5b6('0x4'));var logger=require(_0xc5b6('0x5'))(_0xc5b6('0x6'));var config=require(_0xc5b6('0x7'));var jayson=require(_0xc5b6('0x8'));var client=jayson[_0xc5b6('0x9')][_0xc5b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x501582,_0x43d9cf,_0x16df03){return new BPromise(function(_0xe893fd,_0x45d5d7){return client[_0xc5b6('0xb')](_0x501582,_0x16df03)[_0xc5b6('0xc')](function(_0x3771f6){logger[_0xc5b6('0xd')](_0xc5b6('0xe'),_0x43d9cf,_0xc5b6('0xf'));logger[_0xc5b6('0x10')](_0xc5b6('0x11'),_0x43d9cf,_0xc5b6('0xf'),JSON['stringify'](_0x3771f6));if(_0x3771f6[_0xc5b6('0x12')]){if(_0x3771f6[_0xc5b6('0x12')]['code']===0x1f4){logger[_0xc5b6('0x12')](_0xc5b6('0xe'),_0x43d9cf,_0x3771f6[_0xc5b6('0x12')][_0xc5b6('0x13')]);return _0x45d5d7(_0x3771f6[_0xc5b6('0x12')]['message']);}logger[_0xc5b6('0x12')](_0xc5b6('0xe'),_0x43d9cf,_0x3771f6[_0xc5b6('0x12')]['message']);return _0xe893fd(_0x3771f6[_0xc5b6('0x12')][_0xc5b6('0x13')]);}else{logger[_0xc5b6('0xd')](_0xc5b6('0xe'),_0x43d9cf,_0xc5b6('0xf'));_0xe893fd(_0x3771f6[_0xc5b6('0x14')][_0xc5b6('0x13')]);}})['catch'](function(_0x2fc624){logger[_0xc5b6('0x12')]('DeskAccount,\x20%s,\x20%s',_0x43d9cf,_0x2fc624);_0x45d5d7(_0x2fc624);});});}exports[_0xc5b6('0x15')]=function(_0x20483b){var _0x2f1daa=this;return new Promise(function(_0x497b04,_0x4c36af){return db[_0xc5b6('0x16')][_0xc5b6('0x17')]({'raw':_0x20483b[_0xc5b6('0x18')]?_0x20483b[_0xc5b6('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x20483b['options']?_0x20483b['options'][_0xc5b6('0x19')]||null:null,'attributes':_0x20483b[_0xc5b6('0x18')]?_0x20483b[_0xc5b6('0x18')][_0xc5b6('0x1a')]||null:null,'limit':_0x20483b[_0xc5b6('0x18')]?_0x20483b['options']['limit']||null:null,'include':_0x20483b[_0xc5b6('0x18')]?_0x20483b[_0xc5b6('0x18')][_0xc5b6('0x1b')]?_[_0xc5b6('0x1c')](_0x20483b['options'][_0xc5b6('0x1b')],function(_0x2fd747){return{'model':db[_0x2fd747['model']],'as':_0x2fd747['as'],'attributes':_0x2fd747[_0xc5b6('0x1a')],'include':_0x2fd747['include']?_['map'](_0x2fd747[_0xc5b6('0x1b')],function(_0x5bcebd){return{'model':db[_0x5bcebd[_0xc5b6('0x1d')]],'as':_0x5bcebd['as'],'attributes':_0x5bcebd['attributes'],'include':_0x5bcebd['include']?_[_0xc5b6('0x1c')](_0x5bcebd[_0xc5b6('0x1b')],function(_0x433e17){return{'model':db[_0x433e17[_0xc5b6('0x1d')]],'as':_0x433e17['as'],'attributes':_0x433e17['attributes']};}):[]};}):[]};}):[]:[]})[_0xc5b6('0xc')](function(_0x6fe72b){logger[_0xc5b6('0xd')](_0xc5b6('0x15'),_0x20483b);logger[_0xc5b6('0x10')](_0xc5b6('0x15'),_0x20483b,JSON[_0xc5b6('0x1e')](_0x6fe72b));_0x497b04(_0x6fe72b);})['catch'](function(_0x434f77){logger[_0xc5b6('0x12')]('GetDeskAccount',_0x434f77[_0xc5b6('0x13')],_0x20483b);_0x4c36af(_0x2f1daa[_0xc5b6('0x12')](0x1f4,_0x434f77['message']));});});};exports[_0xc5b6('0x1f')]=function(_0x1338da){var _0x3a313c=this;return new Promise(function(_0x2a3080,_0x1ccd70){return db[_0xc5b6('0x16')]['find']({'raw':_0x1338da[_0xc5b6('0x18')]?_0x1338da[_0xc5b6('0x18')][_0xc5b6('0x20')]===undefined?!![]:![]:!![],'where':_0x1338da[_0xc5b6('0x18')]?_0x1338da[_0xc5b6('0x18')][_0xc5b6('0x19')]||null:null,'attributes':_0x1338da[_0xc5b6('0x18')]?_0x1338da[_0xc5b6('0x18')][_0xc5b6('0x1a')]||null:null,'include':_0x1338da[_0xc5b6('0x18')]?_0x1338da[_0xc5b6('0x18')][_0xc5b6('0x1b')]?_[_0xc5b6('0x1c')](_0x1338da[_0xc5b6('0x18')][_0xc5b6('0x1b')],function(_0xe69c99){return{'model':db[_0xe69c99[_0xc5b6('0x1d')]],'as':_0xe69c99['as'],'attributes':_0xe69c99[_0xc5b6('0x1a')],'include':_0xe69c99['include']?_[_0xc5b6('0x1c')](_0xe69c99['include'],function(_0x635364){return{'model':db[_0x635364[_0xc5b6('0x1d')]],'as':_0x635364['as'],'attributes':_0x635364[_0xc5b6('0x1a')],'include':_0x635364[_0xc5b6('0x1b')]?_[_0xc5b6('0x1c')](_0x635364[_0xc5b6('0x1b')],function(_0x3f034d){return{'model':db[_0x3f034d[_0xc5b6('0x1d')]],'as':_0x3f034d['as'],'attributes':_0x3f034d[_0xc5b6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc5b6('0xc')](function(_0x653d53){logger[_0xc5b6('0xd')](_0xc5b6('0x1f'),_0x1338da);logger[_0xc5b6('0x10')](_0xc5b6('0x1f'),_0x1338da,JSON[_0xc5b6('0x1e')](_0x653d53));_0x2a3080(_0x653d53);})[_0xc5b6('0x21')](function(_0x46db11){logger[_0xc5b6('0x12')](_0xc5b6('0x1f'),_0x46db11[_0xc5b6('0x13')],_0x1338da);_0x1ccd70(_0x3a313c[_0xc5b6('0x12')](0x1f4,_0x46db11[_0xc5b6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index d446860..14e000b 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 _0xedd9=['delete','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','put','update'];(function(_0x58562c,_0x4fd99e){var _0xc23738=function(_0x1a31d2){while(--_0x1a31d2){_0x58562c['push'](_0x58562c['shift']());}};_0xc23738(++_0x4fd99e);}(_0xedd9,0xfc));var _0x9edd=function(_0x555e07,_0x2d41d4){_0x555e07=_0x555e07-0x0;var _0x2ad74e=_0xedd9[_0x555e07];return _0x2ad74e;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var express=require(_0x9edd('0x2'));var router=express[_0x9edd('0x3')]();var auth=require(_0x9edd('0x4'));var interaction=require(_0x9edd('0x5'));var config=require(_0x9edd('0x6'));var controller=require(_0x9edd('0x7'));router['get']('/',auth[_0x9edd('0x8')](),controller[_0x9edd('0x9')]);router[_0x9edd('0xa')](_0x9edd('0xb'),auth['isAuthenticated'](),controller[_0x9edd('0xc')]);router['get'](_0x9edd('0xd'),auth[_0x9edd('0x8')](),controller[_0x9edd('0xe')]);router[_0x9edd('0xa')]('/:id/subjects',auth[_0x9edd('0x8')](),controller['getSubjects']);router[_0x9edd('0xa')](_0x9edd('0xf'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0xa')]('/:id/tags',auth[_0x9edd('0x8')](),controller[_0x9edd('0x11')]);router[_0x9edd('0x12')]('/',auth[_0x9edd('0x8')](),controller[_0x9edd('0x13')]);router[_0x9edd('0x12')](_0x9edd('0x14'),auth[_0x9edd('0x8')](),controller['setTags']);router[_0x9edd('0x15')](_0x9edd('0xb'),auth[_0x9edd('0x8')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x17')](_0x9edd('0xb'),auth[_0x9edd('0x8')](),controller[_0x9edd('0x18')]);module['exports']=router; \ No newline at end of file +var _0xf4eb=['isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getTags','/:id/tags','setTags','put','destroy','multer','../../components/auth/service','./intDeskConfiguration.controller','get'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5576ab,_0x4cdd2e){_0x5576ab=_0x5576ab-0x0;var _0x2d6ffb=_0xf4eb[_0x5576ab];return _0x2d6ffb;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var express=require('express');var router=express['Router']();var auth=require(_0xbf4e('0x1'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbf4e('0x2'));router[_0xbf4e('0x3')]('/',auth[_0xbf4e('0x4')](),controller[_0xbf4e('0x5')]);router[_0xbf4e('0x3')](_0xbf4e('0x6'),auth[_0xbf4e('0x4')](),controller['show']);router[_0xbf4e('0x3')]('/:id/fields',auth['isAuthenticated'](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x3')](_0xbf4e('0x8'),auth[_0xbf4e('0x4')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x3')](_0xbf4e('0xa'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xbf4e('0x3')]('/:id/tags',auth[_0xbf4e('0x4')](),controller[_0xbf4e('0xb')]);router['post']('/',auth[_0xbf4e('0x4')](),controller['create']);router['post'](_0xbf4e('0xc'),auth[_0xbf4e('0x4')](),controller[_0xbf4e('0xd')]);router[_0xbf4e('0xe')](_0xbf4e('0x6'),auth[_0xbf4e('0x4')](),controller['update']);router['delete'](_0xbf4e('0x6'),auth[_0xbf4e('0x4')](),controller[_0xbf4e('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 3f9623e..36425e8 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 _0xb328=['exports','STRING'];(function(_0xdf21ac,_0x521373){var _0x460b6c=function(_0x2daae8){while(--_0x2daae8){_0xdf21ac['push'](_0xdf21ac['shift']());}};_0x460b6c(++_0x521373);}(_0xb328,0x158));var _0x8b32=function(_0x1bbf01,_0x2c5f05){_0x1bbf01=_0x1bbf01-0x0;var _0x1865ce=_0xb328[_0x1bbf01];return _0x1865ce;};'use strict';var Sequelize=require('sequelize');module[_0x8b32('0x0')]={'name':{'type':Sequelize[_0x8b32('0x1')]},'description':{'type':Sequelize[_0x8b32('0x1')]}}; \ No newline at end of file +var _0xd9fd=['STRING','exports'];(function(_0x6dd5c,_0x4bfc19){var _0x5a87fa=function(_0x3b068b){while(--_0x3b068b){_0x6dd5c['push'](_0x6dd5c['shift']());}};_0x5a87fa(++_0x4bfc19);}(_0xd9fd,0x11b));var _0xdd9f=function(_0x602ea1,_0xded178){_0x602ea1=_0x602ea1-0x0;var _0x284d77=_0xd9fd[_0x602ea1];return _0x284d77;};'use strict';var Sequelize=require('sequelize');module[_0xdd9f('0x0')]={'name':{'type':Sequelize[_0xdd9f('0x1')]},'description':{'type':Sequelize[_0xdd9f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 37b288c..6629432 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 _0x98dc=['options','count','includeAll','include','findAll','show','params','fields','find','create','body','destroy','getFields','findOne','DeskField','map','getSubjects','getDescriptions','getTags','Tag','setTags','ids','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','end','status','json','offset','limit','Content-Range','apply','reject','update','sendStatus','stack','name','send','index','DeskConfiguration','rawAttributes','model','dateStart','query','dateEnd','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter'];(function(_0x20a237,_0x3db0ed){var _0x5632e7=function(_0x1c534b){while(--_0x1c534b){_0x20a237['push'](_0x20a237['shift']());}};_0x5632e7(++_0x3db0ed);}(_0x98dc,0x11b));var _0xc98d=function(_0x39bf60,_0x2ceb09){_0x39bf60=_0x39bf60-0x0;var _0xf77b5b=_0x98dc[_0x39bf60];return _0xf77b5b;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xc98d('0x0'));var moment=require(_0xc98d('0x1'));var BPromise=require(_0xc98d('0x2'));var Mustache=require(_0xc98d('0x3'));var util=require(_0xc98d('0x4'));var path=require(_0xc98d('0x5'));var sox=require(_0xc98d('0x6'));var csv=require(_0xc98d('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc98d('0x8'));var crypto=require(_0xc98d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc98d('0xa'));var toCsv=require(_0xc98d('0x7'));var querystring=require(_0xc98d('0xb'));var Papa=require(_0xc98d('0xc'));var qs=require(_0xc98d('0xd'));var logger=require(_0xc98d('0xe'))(_0xc98d('0xf'));var utils=require('../../config/utils');var config=require(_0xc98d('0x10'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xc98d('0x11')][_0xc98d('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x26a4f9,_0x272a8a,_0x19d752,_0x45f5ad){return new BPromise(function(_0x1d6411,_0x58dbda){var _0x39dc99=_0x45f5ad||client;return _0x39dc99['request'](_0x26a4f9,_0x19d752)[_0xc98d('0x13')](function(_0x25c7ee){logger[_0xc98d('0x14')](_0xc98d('0x15'),_0x272a8a,_0xc98d('0x16'));logger[_0xc98d('0x17')](_0xc98d('0x18'),_0x272a8a,'request\x20sent',JSON['stringify'](_0x25c7ee));if(_0x25c7ee[_0xc98d('0x19')]){if(_0x25c7ee[_0xc98d('0x19')][_0xc98d('0x1a')]===0x1f4){logger[_0xc98d('0x19')](_0xc98d('0x15'),_0x272a8a,_0x25c7ee['error'][_0xc98d('0x1b')]);return _0x58dbda(_0x25c7ee[_0xc98d('0x19')][_0xc98d('0x1b')]);}logger[_0xc98d('0x19')](_0xc98d('0x15'),_0x272a8a,_0x25c7ee[_0xc98d('0x19')][_0xc98d('0x1b')]);return _0x1d6411(_0x25c7ee['error'][_0xc98d('0x1b')]);}else{logger[_0xc98d('0x14')](_0xc98d('0x15'),_0x272a8a,_0xc98d('0x16'));_0x1d6411(_0x25c7ee[_0xc98d('0x1c')]['message']);}})[_0xc98d('0x1d')](function(_0x5bafd4){logger[_0xc98d('0x19')](_0xc98d('0x15'),_0x272a8a,_0x5bafd4);_0x58dbda(_0x5bafd4);});});}function respondWithStatusCode(_0x10fa35,_0x1693db){_0x1693db=_0x1693db||0xcc;return function(_0x49d93d){if(_0x49d93d){return _0x10fa35['sendStatus'](_0x1693db);}return _0x10fa35['status'](_0x1693db)[_0xc98d('0x1e')]();};}function respondWithResult(_0x3b5edd,_0x509b62){_0x509b62=_0x509b62||0xc8;return function(_0x11f5f8){if(_0x11f5f8){return _0x3b5edd[_0xc98d('0x1f')](_0x509b62)[_0xc98d('0x20')](_0x11f5f8);}};}function respondWithFilteredResult(_0x295aa9,_0x305488){return function(_0x34754b){if(_0x34754b){var _0x132465=_0x34754b['count'],_0x166719=_0x305488[_0xc98d('0x21')],_0x54c720=_0x305488[_0xc98d('0x21')]+_0x305488[_0xc98d('0x22')],_0x368315;if(_0x54c720>=_0x132465){_0x54c720=_0x132465;_0x368315=0xc8;}else{_0x368315=0xce;}_0x295aa9['status'](_0x368315);return _0x295aa9['set'](_0xc98d('0x23'),_0x166719+'-'+_0x54c720+'/'+_0x132465)[_0xc98d('0x20')](_0x34754b);}return null;};}function patchUpdates(_0x3c9d3b){return function(_0x4c7fc5){try{jsonpatch[_0xc98d('0x24')](_0x4c7fc5,_0x3c9d3b,!![]);}catch(_0x3e0413){return BPromise[_0xc98d('0x25')](_0x3e0413);}return _0x4c7fc5['save']();};}function saveUpdates(_0x36bd6a,_0x58912b){return function(_0x679401){if(_0x679401){return _0x679401[_0xc98d('0x26')](_0x36bd6a)[_0xc98d('0x13')](function(_0x103283){return _0x103283;});}return null;};}function removeEntity(_0x4795d6,_0x3bb4d6){return function(_0x27c2b7){if(_0x27c2b7){return _0x27c2b7['destroy']()[_0xc98d('0x13')](function(){_0x4795d6['status'](0xcc)[_0xc98d('0x1e')]();});}};}function handleEntityNotFound(_0x3ddb51,_0x54ccfe){return function(_0x2c5503){if(!_0x2c5503){_0x3ddb51[_0xc98d('0x27')](0x194);}return _0x2c5503;};}function handleError(_0x42ec99,_0x56417c){_0x56417c=_0x56417c||0x1f4;return function(_0x7ef6e5){logger['error'](_0x7ef6e5[_0xc98d('0x28')]);if(_0x7ef6e5[_0xc98d('0x29')]){delete _0x7ef6e5['name'];}_0x42ec99[_0xc98d('0x1f')](_0x56417c)[_0xc98d('0x2a')](_0x7ef6e5);};}exports[_0xc98d('0x2b')]=function(_0x1ea268,_0x48581a){var _0x251c60={},_0x2903f6={},_0x23a2cb={'count':0x0,'rows':[]};var _0xd500ad=db[_0xc98d('0x2c')][_0xc98d('0x2d')];_0x2903f6[_0xc98d('0x2e')]=_['keys'](_0xd500ad);var _0x49ef38={'dateStart':_0x1ea268['query'][_0xc98d('0x2f')],'dateEnd':_0x1ea268['query']['dateEnd']};delete _0x1ea268[_0xc98d('0x30')][_0xc98d('0x2f')];delete _0x1ea268['query'][_0xc98d('0x31')];_0x2903f6['query']=_[_0xc98d('0x32')](_0x1ea268['query']);_0x2903f6[_0xc98d('0x33')]=_[_0xc98d('0x34')](_0x2903f6[_0xc98d('0x2e')],_0x2903f6[_0xc98d('0x30')]);_0x251c60[_0xc98d('0x35')]=_[_0xc98d('0x34')](_0x2903f6[_0xc98d('0x2e')],qs['fields'](_0x1ea268[_0xc98d('0x30')]['fields']));_0x251c60['attributes']=_0x251c60['attributes'][_0xc98d('0x36')]?_0x251c60[_0xc98d('0x35')]:_0x2903f6['model'];if(!_0x1ea268[_0xc98d('0x30')][_0xc98d('0x37')](_0xc98d('0x38'))){_0x251c60[_0xc98d('0x22')]=qs[_0xc98d('0x22')](_0x1ea268['query'][_0xc98d('0x22')]);_0x251c60[_0xc98d('0x21')]=qs[_0xc98d('0x21')](_0x1ea268[_0xc98d('0x30')][_0xc98d('0x21')]);}_0x251c60[_0xc98d('0x39')]=qs['sort'](_0x1ea268['query'][_0xc98d('0x3a')]);_0x251c60[_0xc98d('0x3b')]=qs[_0xc98d('0x33')](_[_0xc98d('0x3c')](_0x1ea268[_0xc98d('0x30')],_0x2903f6['filters']));if(_0x49ef38[_0xc98d('0x2f')]){if(_0x49ef38[_0xc98d('0x31')]){_0x49ef38[_0xc98d('0x31')]=moment(_0x49ef38[_0xc98d('0x31')])['add'](0x1,'day');}else{_0x49ef38[_0xc98d('0x31')]=moment(_0x49ef38['dateStart'])[_0xc98d('0x3d')](0x1,_0xc98d('0x3e'));}_[_0xc98d('0x3f')](_0x251c60[_0xc98d('0x3b')],{'createdAt':{'$gte':_0x49ef38[_0xc98d('0x2f')],'$lte':_0x49ef38[_0xc98d('0x31')]}});}if(_0x1ea268[_0xc98d('0x30')][_0xc98d('0x40')]){_0x251c60[_0xc98d('0x3b')]=_[_0xc98d('0x3f')](_0x251c60['where'],{'$or':_['map'](_0x251c60[_0xc98d('0x35')],function(_0x15ee7b){var _0xf5da1c={};_0xf5da1c[_0x15ee7b]={'$like':'%'+_0x1ea268[_0xc98d('0x30')][_0xc98d('0x40')]+'%'};return _0xf5da1c;})});}_0x251c60=_['merge']({},_0x251c60,_0x1ea268[_0xc98d('0x41')]);var _0x77f7b6={'where':_0x251c60['where']};return db[_0xc98d('0x2c')][_0xc98d('0x42')](_0x77f7b6)[_0xc98d('0x13')](function(_0x2fe1bf){_0x23a2cb[_0xc98d('0x42')]=_0x2fe1bf;if(_0x1ea268[_0xc98d('0x30')][_0xc98d('0x43')]){_0x251c60[_0xc98d('0x44')]=[{'all':!![]}];}return db[_0xc98d('0x2c')][_0xc98d('0x45')](_0x251c60);})[_0xc98d('0x13')](function(_0x1cb0dd){_0x23a2cb['rows']=_0x1cb0dd;return _0x23a2cb;})[_0xc98d('0x13')](respondWithFilteredResult(_0x48581a,_0x251c60))[_0xc98d('0x1d')](handleError(_0x48581a,null));};exports[_0xc98d('0x46')]=function(_0x15eb4f,_0x2cd348){var _0x5e9f9b={'raw':![],'where':{'id':_0x15eb4f[_0xc98d('0x47')]['id']}},_0x1eb137={};_0x1eb137[_0xc98d('0x2e')]=_[_0xc98d('0x32')](db[_0xc98d('0x2c')][_0xc98d('0x2d')]);_0x1eb137[_0xc98d('0x30')]=_[_0xc98d('0x32')](_0x15eb4f['query']);_0x1eb137[_0xc98d('0x33')]=_[_0xc98d('0x34')](_0x1eb137[_0xc98d('0x2e')],_0x1eb137[_0xc98d('0x30')]);_0x5e9f9b[_0xc98d('0x35')]=_['intersection'](_0x1eb137['model'],qs[_0xc98d('0x48')](_0x15eb4f[_0xc98d('0x30')][_0xc98d('0x48')]));_0x5e9f9b['attributes']=_0x5e9f9b[_0xc98d('0x35')][_0xc98d('0x36')]?_0x5e9f9b['attributes']:_0x1eb137[_0xc98d('0x2e')];if(_0x15eb4f[_0xc98d('0x30')][_0xc98d('0x43')]){_0x5e9f9b[_0xc98d('0x44')]=[{'all':!![]}];}_0x5e9f9b=_[_0xc98d('0x3f')]({},_0x5e9f9b,_0x15eb4f[_0xc98d('0x41')]);return db[_0xc98d('0x2c')][_0xc98d('0x49')](_0x5e9f9b)[_0xc98d('0x13')](handleEntityNotFound(_0x2cd348,null))[_0xc98d('0x13')](respondWithResult(_0x2cd348,null))[_0xc98d('0x1d')](handleError(_0x2cd348,null));};exports['create']=function(_0x4a1ad5,_0x4792d7){return db[_0xc98d('0x2c')][_0xc98d('0x4a')](_0x4a1ad5[_0xc98d('0x4b')],{})[_0xc98d('0x13')](respondWithResult(_0x4792d7,0xc9))[_0xc98d('0x1d')](handleError(_0x4792d7,null));};exports[_0xc98d('0x26')]=function(_0x8ebd80,_0x236aa3){if(_0x8ebd80[_0xc98d('0x4b')]['id']){delete _0x8ebd80[_0xc98d('0x4b')]['id'];}return db[_0xc98d('0x2c')]['find']({'where':{'id':_0x8ebd80[_0xc98d('0x47')]['id']}})[_0xc98d('0x13')](handleEntityNotFound(_0x236aa3,null))['then'](saveUpdates(_0x8ebd80[_0xc98d('0x4b')],null))[_0xc98d('0x13')](respondWithResult(_0x236aa3,null))[_0xc98d('0x1d')](handleError(_0x236aa3,null));};exports[_0xc98d('0x4c')]=function(_0x262371,_0x2cce38){return db['DeskConfiguration'][_0xc98d('0x49')]({'where':{'id':_0x262371[_0xc98d('0x47')]['id']}})[_0xc98d('0x13')](handleEntityNotFound(_0x2cce38,null))[_0xc98d('0x13')](removeEntity(_0x2cce38,null))[_0xc98d('0x1d')](handleError(_0x2cce38,null));};exports[_0xc98d('0x4d')]=function(_0x31649e,_0xf1d10d,_0x39968d){var _0x2add9a={};var _0x56ef0f={};var _0x58b5ec;var _0x57ac30;return db['DeskConfiguration'][_0xc98d('0x4e')]({'where':{'id':_0x31649e['params']['id']}})[_0xc98d('0x13')](handleEntityNotFound(_0xf1d10d,null))[_0xc98d('0x13')](function(_0x37d99f){if(_0x37d99f){_0x58b5ec=_0x37d99f;_0x56ef0f[_0xc98d('0x2e')]=_['keys'](db[_0xc98d('0x4f')]['rawAttributes']);_0x56ef0f['query']=_[_0xc98d('0x32')](_0x31649e[_0xc98d('0x30')]);_0x56ef0f[_0xc98d('0x33')]=_[_0xc98d('0x34')](_0x56ef0f[_0xc98d('0x2e')],_0x56ef0f['query']);_0x2add9a['attributes']=_[_0xc98d('0x34')](_0x56ef0f['model'],qs['fields'](_0x31649e[_0xc98d('0x30')][_0xc98d('0x48')]));_0x2add9a['attributes']=_0x2add9a[_0xc98d('0x35')]['length']?_0x2add9a[_0xc98d('0x35')]:_0x56ef0f[_0xc98d('0x2e')];_0x2add9a[_0xc98d('0x39')]=qs[_0xc98d('0x3a')](_0x31649e[_0xc98d('0x30')][_0xc98d('0x3a')]);_0x2add9a[_0xc98d('0x3b')]=qs['filters'](_[_0xc98d('0x3c')](_0x31649e[_0xc98d('0x30')],_0x56ef0f[_0xc98d('0x33')]));if(_0x31649e[_0xc98d('0x30')][_0xc98d('0x40')]){_0x2add9a[_0xc98d('0x3b')]=_['merge'](_0x2add9a[_0xc98d('0x3b')],{'$or':_[_0xc98d('0x50')](_0x2add9a['attributes'],function(_0x315628){var _0xb7873a={};_0xb7873a[_0x315628]={'$like':'%'+_0x31649e[_0xc98d('0x30')][_0xc98d('0x40')]+'%'};return _0xb7873a;})});}_0x2add9a=_[_0xc98d('0x3f')]({},_0x2add9a,_0x31649e[_0xc98d('0x41')]);return _0x58b5ec[_0xc98d('0x4d')](_0x2add9a);}})[_0xc98d('0x13')](function(_0xacf442){if(_0xacf442){_0x57ac30=_0xacf442[_0xc98d('0x36')];if(!_0x31649e[_0xc98d('0x30')]['hasOwnProperty'](_0xc98d('0x38'))){_0x2add9a[_0xc98d('0x22')]=qs['limit'](_0x31649e['query'][_0xc98d('0x22')]);_0x2add9a[_0xc98d('0x21')]=qs[_0xc98d('0x21')](_0x31649e[_0xc98d('0x30')]['offset']);}return _0x58b5ec[_0xc98d('0x4d')](_0x2add9a);}})[_0xc98d('0x13')](function(_0x266ee2){if(_0x266ee2){return _0x266ee2?{'count':_0x57ac30,'rows':_0x266ee2}:null;}})['then'](respondWithResult(_0xf1d10d,null))[_0xc98d('0x1d')](handleError(_0xf1d10d,null));};exports[_0xc98d('0x51')]=function(_0x1a0387,_0x501a63,_0x5070a2){var _0xbf418b={};var _0x5092fc={};var _0x370ca8;var _0x4d4e58;return db[_0xc98d('0x2c')][_0xc98d('0x4e')]({'where':{'id':_0x1a0387[_0xc98d('0x47')]['id']}})['then'](handleEntityNotFound(_0x501a63,null))['then'](function(_0x5400ae){if(_0x5400ae){_0x370ca8=_0x5400ae;_0x5092fc[_0xc98d('0x2e')]=_['keys'](db[_0xc98d('0x4f')][_0xc98d('0x2d')]);_0x5092fc[_0xc98d('0x30')]=_['keys'](_0x1a0387['query']);_0x5092fc[_0xc98d('0x33')]=_[_0xc98d('0x34')](_0x5092fc['model'],_0x5092fc[_0xc98d('0x30')]);_0xbf418b[_0xc98d('0x35')]=_[_0xc98d('0x34')](_0x5092fc[_0xc98d('0x2e')],qs[_0xc98d('0x48')](_0x1a0387[_0xc98d('0x30')][_0xc98d('0x48')]));_0xbf418b['attributes']=_0xbf418b[_0xc98d('0x35')][_0xc98d('0x36')]?_0xbf418b['attributes']:_0x5092fc[_0xc98d('0x2e')];_0xbf418b['order']=qs[_0xc98d('0x3a')](_0x1a0387[_0xc98d('0x30')][_0xc98d('0x3a')]);_0xbf418b[_0xc98d('0x3b')]=qs['filters'](_[_0xc98d('0x3c')](_0x1a0387[_0xc98d('0x30')],_0x5092fc['filters']));if(_0x1a0387['query'][_0xc98d('0x40')]){_0xbf418b['where']=_[_0xc98d('0x3f')](_0xbf418b['where'],{'$or':_['map'](_0xbf418b[_0xc98d('0x35')],function(_0x27d54d){var _0x1e5a6e={};_0x1e5a6e[_0x27d54d]={'$like':'%'+_0x1a0387[_0xc98d('0x30')][_0xc98d('0x40')]+'%'};return _0x1e5a6e;})});}_0xbf418b=_[_0xc98d('0x3f')]({},_0xbf418b,_0x1a0387['options']);return _0x370ca8['getSubjects'](_0xbf418b);}})[_0xc98d('0x13')](function(_0xb48b92){if(_0xb48b92){_0x4d4e58=_0xb48b92['length'];if(!_0x1a0387[_0xc98d('0x30')][_0xc98d('0x37')]('nolimit')){_0xbf418b[_0xc98d('0x22')]=qs[_0xc98d('0x22')](_0x1a0387['query'][_0xc98d('0x22')]);_0xbf418b[_0xc98d('0x21')]=qs[_0xc98d('0x21')](_0x1a0387[_0xc98d('0x30')][_0xc98d('0x21')]);}return _0x370ca8[_0xc98d('0x51')](_0xbf418b);}})[_0xc98d('0x13')](function(_0x14914e){if(_0x14914e){return _0x14914e?{'count':_0x4d4e58,'rows':_0x14914e}:null;}})[_0xc98d('0x13')](respondWithResult(_0x501a63,null))[_0xc98d('0x1d')](handleError(_0x501a63,null));};exports[_0xc98d('0x52')]=function(_0x3e9631,_0x4cf035,_0x1325e7){var _0x42baf1={};var _0x7d4c62={};var _0x20db47;var _0x5a4433;return db[_0xc98d('0x2c')][_0xc98d('0x4e')]({'where':{'id':_0x3e9631[_0xc98d('0x47')]['id']}})[_0xc98d('0x13')](handleEntityNotFound(_0x4cf035,null))['then'](function(_0xc51f29){if(_0xc51f29){_0x20db47=_0xc51f29;_0x7d4c62['model']=_[_0xc98d('0x32')](db[_0xc98d('0x4f')][_0xc98d('0x2d')]);_0x7d4c62['query']=_[_0xc98d('0x32')](_0x3e9631[_0xc98d('0x30')]);_0x7d4c62[_0xc98d('0x33')]=_['intersection'](_0x7d4c62[_0xc98d('0x2e')],_0x7d4c62[_0xc98d('0x30')]);_0x42baf1[_0xc98d('0x35')]=_[_0xc98d('0x34')](_0x7d4c62[_0xc98d('0x2e')],qs['fields'](_0x3e9631[_0xc98d('0x30')][_0xc98d('0x48')]));_0x42baf1[_0xc98d('0x35')]=_0x42baf1['attributes'][_0xc98d('0x36')]?_0x42baf1[_0xc98d('0x35')]:_0x7d4c62['model'];_0x42baf1[_0xc98d('0x39')]=qs[_0xc98d('0x3a')](_0x3e9631['query'][_0xc98d('0x3a')]);_0x42baf1[_0xc98d('0x3b')]=qs[_0xc98d('0x33')](_['pick'](_0x3e9631[_0xc98d('0x30')],_0x7d4c62[_0xc98d('0x33')]));if(_0x3e9631[_0xc98d('0x30')][_0xc98d('0x40')]){_0x42baf1[_0xc98d('0x3b')]=_['merge'](_0x42baf1[_0xc98d('0x3b')],{'$or':_[_0xc98d('0x50')](_0x42baf1['attributes'],function(_0xb91e68){var _0x240fe3={};_0x240fe3[_0xb91e68]={'$like':'%'+_0x3e9631['query']['filter']+'%'};return _0x240fe3;})});}_0x42baf1=_[_0xc98d('0x3f')]({},_0x42baf1,_0x3e9631[_0xc98d('0x41')]);return _0x20db47['getDescriptions'](_0x42baf1);}})[_0xc98d('0x13')](function(_0xdada6e){if(_0xdada6e){_0x5a4433=_0xdada6e['length'];if(!_0x3e9631['query'][_0xc98d('0x37')]('nolimit')){_0x42baf1[_0xc98d('0x22')]=qs[_0xc98d('0x22')](_0x3e9631[_0xc98d('0x30')][_0xc98d('0x22')]);_0x42baf1[_0xc98d('0x21')]=qs[_0xc98d('0x21')](_0x3e9631[_0xc98d('0x30')][_0xc98d('0x21')]);}return _0x20db47[_0xc98d('0x52')](_0x42baf1);}})['then'](function(_0x392687){if(_0x392687){return _0x392687?{'count':_0x5a4433,'rows':_0x392687}:null;}})[_0xc98d('0x13')](respondWithResult(_0x4cf035,null))[_0xc98d('0x1d')](handleError(_0x4cf035,null));};exports[_0xc98d('0x53')]=function(_0x457416,_0x3efcce,_0x157e7c){var _0x4faa5f={};var _0x1068b7={};var _0x5c16bc;var _0x3ef65f;return db[_0xc98d('0x2c')][_0xc98d('0x4e')]({'where':{'id':_0x457416[_0xc98d('0x47')]['id']}})[_0xc98d('0x13')](handleEntityNotFound(_0x3efcce,null))['then'](function(_0x4de093){if(_0x4de093){_0x5c16bc=_0x4de093;_0x1068b7[_0xc98d('0x2e')]=_[_0xc98d('0x32')](db[_0xc98d('0x54')][_0xc98d('0x2d')]);_0x1068b7['query']=_[_0xc98d('0x32')](_0x457416[_0xc98d('0x30')]);_0x1068b7[_0xc98d('0x33')]=_[_0xc98d('0x34')](_0x1068b7[_0xc98d('0x2e')],_0x1068b7[_0xc98d('0x30')]);_0x4faa5f[_0xc98d('0x35')]=_[_0xc98d('0x34')](_0x1068b7[_0xc98d('0x2e')],qs[_0xc98d('0x48')](_0x457416[_0xc98d('0x30')][_0xc98d('0x48')]));_0x4faa5f['attributes']=_0x4faa5f[_0xc98d('0x35')][_0xc98d('0x36')]?_0x4faa5f[_0xc98d('0x35')]:_0x1068b7['model'];_0x4faa5f['order']=qs[_0xc98d('0x3a')](_0x457416['query'][_0xc98d('0x3a')]);_0x4faa5f[_0xc98d('0x3b')]=qs[_0xc98d('0x33')](_[_0xc98d('0x3c')](_0x457416['query'],_0x1068b7['filters']));if(_0x457416[_0xc98d('0x30')]['filter']){_0x4faa5f[_0xc98d('0x3b')]=_[_0xc98d('0x3f')](_0x4faa5f[_0xc98d('0x3b')],{'$or':_[_0xc98d('0x50')](_0x4faa5f[_0xc98d('0x35')],function(_0x25d873){var _0x1bfec2={};_0x1bfec2[_0x25d873]={'$like':'%'+_0x457416['query'][_0xc98d('0x40')]+'%'};return _0x1bfec2;})});}_0x4faa5f=_['merge']({},_0x4faa5f,_0x457416['options']);return _0x5c16bc[_0xc98d('0x53')](_0x4faa5f);}})['then'](function(_0x31d279){if(_0x31d279){_0x3ef65f=_0x31d279[_0xc98d('0x36')];if(!_0x457416[_0xc98d('0x30')][_0xc98d('0x37')](_0xc98d('0x38'))){_0x4faa5f[_0xc98d('0x22')]=qs[_0xc98d('0x22')](_0x457416[_0xc98d('0x30')][_0xc98d('0x22')]);_0x4faa5f[_0xc98d('0x21')]=qs['offset'](_0x457416[_0xc98d('0x30')][_0xc98d('0x21')]);}return _0x5c16bc[_0xc98d('0x53')](_0x4faa5f);}})['then'](function(_0xbc17a2){if(_0xbc17a2){return _0xbc17a2?{'count':_0x3ef65f,'rows':_0xbc17a2}:null;}})[_0xc98d('0x13')](respondWithResult(_0x3efcce,null))[_0xc98d('0x1d')](handleError(_0x3efcce,null));};exports[_0xc98d('0x55')]=function(_0x3df4f6,_0x1650a9,_0x516a3d){if(_0x3df4f6['body']['id']){delete _0x3df4f6[_0xc98d('0x4b')]['id'];}return db[_0xc98d('0x2c')][_0xc98d('0x4e')]({'where':{'id':_0x3df4f6[_0xc98d('0x47')]['id']}})[_0xc98d('0x13')](handleEntityNotFound(_0x1650a9,null))['then'](function(_0x33ef91){if(_0x33ef91){return _0x33ef91[_0xc98d('0x55')](_0x3df4f6[_0xc98d('0x4b')][_0xc98d('0x56')]||[]);}return null;})[_0xc98d('0x13')](respondWithResult(_0x1650a9,null))[_0xc98d('0x1d')](handleError(_0x1650a9,null));}; \ No newline at end of file +var _0x08c0=['ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','destroy','stack','name','index','DeskConfiguration','rawAttributes','model','dateStart','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','add','day','merge','filter','where','map','options','include','findAll','rows','show','params','keys','includeAll','create','body','find','getFields','DeskField','pick','nolimit','getSubjects','getDescriptions','getTags','findOne','setTags','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv'];(function(_0x553cf0,_0x468057){var _0x3716dc=function(_0x20b59e){while(--_0x20b59e){_0x553cf0['push'](_0x553cf0['shift']());}};_0x3716dc(++_0x468057);}(_0x08c0,0xa9));var _0x008c=function(_0x3e7a97,_0x106c99){_0x3e7a97=_0x3e7a97-0x0;var _0x558b58=_0x08c0[_0x3e7a97];return _0x558b58;};'use strict';var jsonpatch=require(_0x008c('0x0'));var rp=require(_0x008c('0x1'));var moment=require(_0x008c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x008c('0x3'));var util=require('util');var path=require(_0x008c('0x4'));var sox=require(_0x008c('0x5'));var csv=require(_0x008c('0x6'));var ejs=require(_0x008c('0x7'));var fs=require('fs');var _=require(_0x008c('0x8'));var squel=require('squel');var crypto=require(_0x008c('0x9'));var jsforce=require(_0x008c('0xa'));var deskjs=require(_0x008c('0xb'));var toCsv=require(_0x008c('0x6'));var querystring=require(_0x008c('0xc'));var Papa=require(_0x008c('0xd'));var qs=require(_0x008c('0xe'));var logger=require(_0x008c('0xf'))(_0x008c('0x10'));var utils=require('../../config/utils');var config=require(_0x008c('0x11'));var db=require(_0x008c('0x12'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x008c('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x502549,_0x3d3836,_0x53d9cb,_0xbcd298){return new BPromise(function(_0x59dd39,_0x5d0691){var _0x35b855=_0xbcd298||client;return _0x35b855[_0x008c('0x14')](_0x502549,_0x53d9cb)[_0x008c('0x15')](function(_0x44f1c7){logger[_0x008c('0x16')](_0x008c('0x17'),_0x3d3836,_0x008c('0x18'));logger[_0x008c('0x19')](_0x008c('0x1a'),_0x3d3836,_0x008c('0x18'),JSON[_0x008c('0x1b')](_0x44f1c7));if(_0x44f1c7[_0x008c('0x1c')]){if(_0x44f1c7[_0x008c('0x1c')][_0x008c('0x1d')]===0x1f4){logger[_0x008c('0x1c')]('DeskConfiguration,\x20%s,\x20%s',_0x3d3836,_0x44f1c7[_0x008c('0x1c')]['message']);return _0x5d0691(_0x44f1c7[_0x008c('0x1c')][_0x008c('0x1e')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x3d3836,_0x44f1c7[_0x008c('0x1c')]['message']);return _0x59dd39(_0x44f1c7['error'][_0x008c('0x1e')]);}else{logger['info'](_0x008c('0x17'),_0x3d3836,'request\x20sent');_0x59dd39(_0x44f1c7[_0x008c('0x1f')][_0x008c('0x1e')]);}})[_0x008c('0x20')](function(_0x46b0a8){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x3d3836,_0x46b0a8);_0x5d0691(_0x46b0a8);});});}function respondWithStatusCode(_0x18bdad,_0x5b8864){_0x5b8864=_0x5b8864||0xcc;return function(_0x487439){if(_0x487439){return _0x18bdad[_0x008c('0x21')](_0x5b8864);}return _0x18bdad[_0x008c('0x22')](_0x5b8864)[_0x008c('0x23')]();};}function respondWithResult(_0x1e905a,_0x364a77){_0x364a77=_0x364a77||0xc8;return function(_0x315857){if(_0x315857){return _0x1e905a[_0x008c('0x22')](_0x364a77)[_0x008c('0x24')](_0x315857);}};}function respondWithFilteredResult(_0x3ebc74,_0x3ea112){return function(_0x6f034){if(_0x6f034){var _0x4dff19=_0x6f034[_0x008c('0x25')],_0xedc219=_0x3ea112['offset'],_0x3e460e=_0x3ea112[_0x008c('0x26')]+_0x3ea112[_0x008c('0x27')],_0x4b8ce7;if(_0x3e460e>=_0x4dff19){_0x3e460e=_0x4dff19;_0x4b8ce7=0xc8;}else{_0x4b8ce7=0xce;}_0x3ebc74[_0x008c('0x22')](_0x4b8ce7);return _0x3ebc74[_0x008c('0x28')]('Content-Range',_0xedc219+'-'+_0x3e460e+'/'+_0x4dff19)[_0x008c('0x24')](_0x6f034);}return null;};}function patchUpdates(_0x5c724b){return function(_0x25fc1e){try{jsonpatch[_0x008c('0x29')](_0x25fc1e,_0x5c724b,!![]);}catch(_0x3fe0ce){return BPromise[_0x008c('0x2a')](_0x3fe0ce);}return _0x25fc1e['save']();};}function saveUpdates(_0x146337,_0x3fe850){return function(_0x2f1845){if(_0x2f1845){return _0x2f1845[_0x008c('0x2b')](_0x146337)[_0x008c('0x15')](function(_0x526867){return _0x526867;});}return null;};}function removeEntity(_0x570dbc,_0x237a0a){return function(_0x237740){if(_0x237740){return _0x237740[_0x008c('0x2c')]()[_0x008c('0x15')](function(){_0x570dbc[_0x008c('0x22')](0xcc)[_0x008c('0x23')]();});}};}function handleEntityNotFound(_0x55e4bf,_0x3a18f8){return function(_0x4de2de){if(!_0x4de2de){_0x55e4bf[_0x008c('0x21')](0x194);}return _0x4de2de;};}function handleError(_0x2c63a9,_0x5b298e){_0x5b298e=_0x5b298e||0x1f4;return function(_0x127364){logger[_0x008c('0x1c')](_0x127364[_0x008c('0x2d')]);if(_0x127364[_0x008c('0x2e')]){delete _0x127364['name'];}_0x2c63a9[_0x008c('0x22')](_0x5b298e)['send'](_0x127364);};}exports[_0x008c('0x2f')]=function(_0x4b18ae,_0x5a2dd6){var _0x2aaea3={},_0x3ea195={},_0x8ea1e6={'count':0x0,'rows':[]};var _0x5c59e1=db[_0x008c('0x30')][_0x008c('0x31')];_0x3ea195[_0x008c('0x32')]=_['keys'](_0x5c59e1);var _0x132c5a={'dateStart':_0x4b18ae['query'][_0x008c('0x33')],'dateEnd':_0x4b18ae[_0x008c('0x34')]['dateEnd']};delete _0x4b18ae['query']['dateStart'];delete _0x4b18ae[_0x008c('0x34')][_0x008c('0x35')];_0x3ea195[_0x008c('0x34')]=_['keys'](_0x4b18ae[_0x008c('0x34')]);_0x3ea195[_0x008c('0x36')]=_[_0x008c('0x37')](_0x3ea195['model'],_0x3ea195[_0x008c('0x34')]);_0x2aaea3[_0x008c('0x38')]=_[_0x008c('0x37')](_0x3ea195[_0x008c('0x32')],qs[_0x008c('0x39')](_0x4b18ae[_0x008c('0x34')][_0x008c('0x39')]));_0x2aaea3[_0x008c('0x38')]=_0x2aaea3[_0x008c('0x38')][_0x008c('0x3a')]?_0x2aaea3[_0x008c('0x38')]:_0x3ea195[_0x008c('0x32')];if(!_0x4b18ae[_0x008c('0x34')][_0x008c('0x3b')]('nolimit')){_0x2aaea3['limit']=qs[_0x008c('0x27')](_0x4b18ae[_0x008c('0x34')][_0x008c('0x27')]);_0x2aaea3['offset']=qs[_0x008c('0x26')](_0x4b18ae['query']['offset']);}_0x2aaea3[_0x008c('0x3c')]=qs[_0x008c('0x3d')](_0x4b18ae[_0x008c('0x34')][_0x008c('0x3d')]);_0x2aaea3['where']=qs[_0x008c('0x36')](_['pick'](_0x4b18ae['query'],_0x3ea195[_0x008c('0x36')]));if(_0x132c5a['dateStart']){if(_0x132c5a[_0x008c('0x35')]){_0x132c5a[_0x008c('0x35')]=moment(_0x132c5a[_0x008c('0x35')])[_0x008c('0x3e')](0x1,_0x008c('0x3f'));}else{_0x132c5a[_0x008c('0x35')]=moment(_0x132c5a[_0x008c('0x33')])[_0x008c('0x3e')](0x1,_0x008c('0x3f'));}_[_0x008c('0x40')](_0x2aaea3['where'],{'createdAt':{'$gte':_0x132c5a[_0x008c('0x33')],'$lte':_0x132c5a[_0x008c('0x35')]}});}if(_0x4b18ae[_0x008c('0x34')][_0x008c('0x41')]){_0x2aaea3['where']=_[_0x008c('0x40')](_0x2aaea3[_0x008c('0x42')],{'$or':_[_0x008c('0x43')](_0x2aaea3[_0x008c('0x38')],function(_0x3d6303){var _0xbbdaf6={};_0xbbdaf6[_0x3d6303]={'$like':'%'+_0x4b18ae['query'][_0x008c('0x41')]+'%'};return _0xbbdaf6;})});}_0x2aaea3=_[_0x008c('0x40')]({},_0x2aaea3,_0x4b18ae[_0x008c('0x44')]);var _0xc34b71={'where':_0x2aaea3[_0x008c('0x42')]};return db[_0x008c('0x30')][_0x008c('0x25')](_0xc34b71)[_0x008c('0x15')](function(_0x167af9){_0x8ea1e6[_0x008c('0x25')]=_0x167af9;if(_0x4b18ae[_0x008c('0x34')]['includeAll']){_0x2aaea3[_0x008c('0x45')]=[{'all':!![]}];}return db[_0x008c('0x30')][_0x008c('0x46')](_0x2aaea3);})[_0x008c('0x15')](function(_0x35ea5e){_0x8ea1e6[_0x008c('0x47')]=_0x35ea5e;return _0x8ea1e6;})['then'](respondWithFilteredResult(_0x5a2dd6,_0x2aaea3))['catch'](handleError(_0x5a2dd6,null));};exports[_0x008c('0x48')]=function(_0x2ff7bc,_0x477820){var _0x24d649={'raw':![],'where':{'id':_0x2ff7bc[_0x008c('0x49')]['id']}},_0x52ad03={};_0x52ad03['model']=_[_0x008c('0x4a')](db[_0x008c('0x30')]['rawAttributes']);_0x52ad03['query']=_['keys'](_0x2ff7bc['query']);_0x52ad03[_0x008c('0x36')]=_[_0x008c('0x37')](_0x52ad03['model'],_0x52ad03['query']);_0x24d649[_0x008c('0x38')]=_[_0x008c('0x37')](_0x52ad03[_0x008c('0x32')],qs[_0x008c('0x39')](_0x2ff7bc['query'][_0x008c('0x39')]));_0x24d649[_0x008c('0x38')]=_0x24d649[_0x008c('0x38')]['length']?_0x24d649[_0x008c('0x38')]:_0x52ad03[_0x008c('0x32')];if(_0x2ff7bc[_0x008c('0x34')][_0x008c('0x4b')]){_0x24d649['include']=[{'all':!![]}];}_0x24d649=_[_0x008c('0x40')]({},_0x24d649,_0x2ff7bc[_0x008c('0x44')]);return db['DeskConfiguration']['find'](_0x24d649)[_0x008c('0x15')](handleEntityNotFound(_0x477820,null))['then'](respondWithResult(_0x477820,null))['catch'](handleError(_0x477820,null));};exports['create']=function(_0x263d4b,_0x542f9b){return db['DeskConfiguration'][_0x008c('0x4c')](_0x263d4b[_0x008c('0x4d')],{})['then'](respondWithResult(_0x542f9b,0xc9))[_0x008c('0x20')](handleError(_0x542f9b,null));};exports[_0x008c('0x2b')]=function(_0x52bab2,_0x346c45){if(_0x52bab2[_0x008c('0x4d')]['id']){delete _0x52bab2[_0x008c('0x4d')]['id'];}return db[_0x008c('0x30')][_0x008c('0x4e')]({'where':{'id':_0x52bab2[_0x008c('0x49')]['id']}})[_0x008c('0x15')](handleEntityNotFound(_0x346c45,null))['then'](saveUpdates(_0x52bab2['body'],null))[_0x008c('0x15')](respondWithResult(_0x346c45,null))[_0x008c('0x20')](handleError(_0x346c45,null));};exports['destroy']=function(_0x24abc9,_0x28a97f){return db[_0x008c('0x30')][_0x008c('0x4e')]({'where':{'id':_0x24abc9[_0x008c('0x49')]['id']}})[_0x008c('0x15')](handleEntityNotFound(_0x28a97f,null))[_0x008c('0x15')](removeEntity(_0x28a97f,null))[_0x008c('0x20')](handleError(_0x28a97f,null));};exports[_0x008c('0x4f')]=function(_0x4fabec,_0x18eb35,_0x10a76c){var _0x5678b7={};var _0x4fde12={};var _0x10baa6;var _0xd26dcb;return db[_0x008c('0x30')]['findOne']({'where':{'id':_0x4fabec['params']['id']}})[_0x008c('0x15')](handleEntityNotFound(_0x18eb35,null))[_0x008c('0x15')](function(_0x32e02e){if(_0x32e02e){_0x10baa6=_0x32e02e;_0x4fde12[_0x008c('0x32')]=_['keys'](db[_0x008c('0x50')][_0x008c('0x31')]);_0x4fde12[_0x008c('0x34')]=_['keys'](_0x4fabec['query']);_0x4fde12[_0x008c('0x36')]=_['intersection'](_0x4fde12[_0x008c('0x32')],_0x4fde12[_0x008c('0x34')]);_0x5678b7[_0x008c('0x38')]=_[_0x008c('0x37')](_0x4fde12[_0x008c('0x32')],qs[_0x008c('0x39')](_0x4fabec[_0x008c('0x34')]['fields']));_0x5678b7[_0x008c('0x38')]=_0x5678b7[_0x008c('0x38')][_0x008c('0x3a')]?_0x5678b7[_0x008c('0x38')]:_0x4fde12[_0x008c('0x32')];_0x5678b7[_0x008c('0x3c')]=qs['sort'](_0x4fabec[_0x008c('0x34')][_0x008c('0x3d')]);_0x5678b7[_0x008c('0x42')]=qs[_0x008c('0x36')](_[_0x008c('0x51')](_0x4fabec[_0x008c('0x34')],_0x4fde12[_0x008c('0x36')]));if(_0x4fabec[_0x008c('0x34')][_0x008c('0x41')]){_0x5678b7[_0x008c('0x42')]=_[_0x008c('0x40')](_0x5678b7['where'],{'$or':_['map'](_0x5678b7['attributes'],function(_0x1bf3c2){var _0x1f5cb1={};_0x1f5cb1[_0x1bf3c2]={'$like':'%'+_0x4fabec[_0x008c('0x34')][_0x008c('0x41')]+'%'};return _0x1f5cb1;})});}_0x5678b7=_[_0x008c('0x40')]({},_0x5678b7,_0x4fabec[_0x008c('0x44')]);return _0x10baa6[_0x008c('0x4f')](_0x5678b7);}})[_0x008c('0x15')](function(_0x1618ac){if(_0x1618ac){_0xd26dcb=_0x1618ac[_0x008c('0x3a')];if(!_0x4fabec[_0x008c('0x34')][_0x008c('0x3b')](_0x008c('0x52'))){_0x5678b7['limit']=qs[_0x008c('0x27')](_0x4fabec[_0x008c('0x34')][_0x008c('0x27')]);_0x5678b7[_0x008c('0x26')]=qs[_0x008c('0x26')](_0x4fabec[_0x008c('0x34')][_0x008c('0x26')]);}return _0x10baa6[_0x008c('0x4f')](_0x5678b7);}})[_0x008c('0x15')](function(_0xd512c4){if(_0xd512c4){return _0xd512c4?{'count':_0xd26dcb,'rows':_0xd512c4}:null;}})[_0x008c('0x15')](respondWithResult(_0x18eb35,null))[_0x008c('0x20')](handleError(_0x18eb35,null));};exports['getSubjects']=function(_0xc32a8d,_0xb83378,_0x5f5d11){var _0x24d17c={};var _0x3171ae={};var _0x503187;var _0x2bdcf3;return db[_0x008c('0x30')]['findOne']({'where':{'id':_0xc32a8d['params']['id']}})[_0x008c('0x15')](handleEntityNotFound(_0xb83378,null))[_0x008c('0x15')](function(_0x397903){if(_0x397903){_0x503187=_0x397903;_0x3171ae[_0x008c('0x32')]=_['keys'](db[_0x008c('0x50')]['rawAttributes']);_0x3171ae['query']=_[_0x008c('0x4a')](_0xc32a8d[_0x008c('0x34')]);_0x3171ae[_0x008c('0x36')]=_[_0x008c('0x37')](_0x3171ae['model'],_0x3171ae[_0x008c('0x34')]);_0x24d17c[_0x008c('0x38')]=_[_0x008c('0x37')](_0x3171ae[_0x008c('0x32')],qs['fields'](_0xc32a8d[_0x008c('0x34')][_0x008c('0x39')]));_0x24d17c[_0x008c('0x38')]=_0x24d17c[_0x008c('0x38')][_0x008c('0x3a')]?_0x24d17c[_0x008c('0x38')]:_0x3171ae[_0x008c('0x32')];_0x24d17c[_0x008c('0x3c')]=qs[_0x008c('0x3d')](_0xc32a8d[_0x008c('0x34')][_0x008c('0x3d')]);_0x24d17c[_0x008c('0x42')]=qs[_0x008c('0x36')](_[_0x008c('0x51')](_0xc32a8d[_0x008c('0x34')],_0x3171ae[_0x008c('0x36')]));if(_0xc32a8d[_0x008c('0x34')]['filter']){_0x24d17c[_0x008c('0x42')]=_['merge'](_0x24d17c[_0x008c('0x42')],{'$or':_['map'](_0x24d17c[_0x008c('0x38')],function(_0x32fa0c){var _0x268fa4={};_0x268fa4[_0x32fa0c]={'$like':'%'+_0xc32a8d[_0x008c('0x34')][_0x008c('0x41')]+'%'};return _0x268fa4;})});}_0x24d17c=_[_0x008c('0x40')]({},_0x24d17c,_0xc32a8d[_0x008c('0x44')]);return _0x503187[_0x008c('0x53')](_0x24d17c);}})[_0x008c('0x15')](function(_0x294306){if(_0x294306){_0x2bdcf3=_0x294306[_0x008c('0x3a')];if(!_0xc32a8d[_0x008c('0x34')]['hasOwnProperty']('nolimit')){_0x24d17c[_0x008c('0x27')]=qs[_0x008c('0x27')](_0xc32a8d[_0x008c('0x34')][_0x008c('0x27')]);_0x24d17c[_0x008c('0x26')]=qs[_0x008c('0x26')](_0xc32a8d[_0x008c('0x34')][_0x008c('0x26')]);}return _0x503187[_0x008c('0x53')](_0x24d17c);}})['then'](function(_0x22577f){if(_0x22577f){return _0x22577f?{'count':_0x2bdcf3,'rows':_0x22577f}:null;}})[_0x008c('0x15')](respondWithResult(_0xb83378,null))[_0x008c('0x20')](handleError(_0xb83378,null));};exports[_0x008c('0x54')]=function(_0x3004f0,_0x252a6d,_0x16f517){var _0x58fa87={};var _0x47ad0b={};var _0x596104;var _0x9b1c43;return db[_0x008c('0x30')]['findOne']({'where':{'id':_0x3004f0['params']['id']}})['then'](handleEntityNotFound(_0x252a6d,null))[_0x008c('0x15')](function(_0x843d1){if(_0x843d1){_0x596104=_0x843d1;_0x47ad0b[_0x008c('0x32')]=_['keys'](db[_0x008c('0x50')]['rawAttributes']);_0x47ad0b[_0x008c('0x34')]=_['keys'](_0x3004f0['query']);_0x47ad0b[_0x008c('0x36')]=_[_0x008c('0x37')](_0x47ad0b[_0x008c('0x32')],_0x47ad0b[_0x008c('0x34')]);_0x58fa87['attributes']=_[_0x008c('0x37')](_0x47ad0b[_0x008c('0x32')],qs[_0x008c('0x39')](_0x3004f0['query'][_0x008c('0x39')]));_0x58fa87[_0x008c('0x38')]=_0x58fa87[_0x008c('0x38')][_0x008c('0x3a')]?_0x58fa87[_0x008c('0x38')]:_0x47ad0b[_0x008c('0x32')];_0x58fa87['order']=qs[_0x008c('0x3d')](_0x3004f0['query'][_0x008c('0x3d')]);_0x58fa87[_0x008c('0x42')]=qs[_0x008c('0x36')](_[_0x008c('0x51')](_0x3004f0[_0x008c('0x34')],_0x47ad0b[_0x008c('0x36')]));if(_0x3004f0[_0x008c('0x34')]['filter']){_0x58fa87['where']=_[_0x008c('0x40')](_0x58fa87[_0x008c('0x42')],{'$or':_[_0x008c('0x43')](_0x58fa87[_0x008c('0x38')],function(_0x47e438){var _0x386038={};_0x386038[_0x47e438]={'$like':'%'+_0x3004f0[_0x008c('0x34')][_0x008c('0x41')]+'%'};return _0x386038;})});}_0x58fa87=_[_0x008c('0x40')]({},_0x58fa87,_0x3004f0[_0x008c('0x44')]);return _0x596104[_0x008c('0x54')](_0x58fa87);}})[_0x008c('0x15')](function(_0x1b69c5){if(_0x1b69c5){_0x9b1c43=_0x1b69c5[_0x008c('0x3a')];if(!_0x3004f0['query'][_0x008c('0x3b')]('nolimit')){_0x58fa87['limit']=qs[_0x008c('0x27')](_0x3004f0[_0x008c('0x34')][_0x008c('0x27')]);_0x58fa87[_0x008c('0x26')]=qs[_0x008c('0x26')](_0x3004f0[_0x008c('0x34')][_0x008c('0x26')]);}return _0x596104[_0x008c('0x54')](_0x58fa87);}})[_0x008c('0x15')](function(_0x4c8b74){if(_0x4c8b74){return _0x4c8b74?{'count':_0x9b1c43,'rows':_0x4c8b74}:null;}})['then'](respondWithResult(_0x252a6d,null))['catch'](handleError(_0x252a6d,null));};exports[_0x008c('0x55')]=function(_0x54e6dc,_0x17d908,_0x1aebb6){var _0x134fe2={};var _0xcb560c={};var _0x5ef278;var _0x1b854e;return db[_0x008c('0x30')][_0x008c('0x56')]({'where':{'id':_0x54e6dc[_0x008c('0x49')]['id']}})[_0x008c('0x15')](handleEntityNotFound(_0x17d908,null))['then'](function(_0x159eb){if(_0x159eb){_0x5ef278=_0x159eb;_0xcb560c['model']=_[_0x008c('0x4a')](db['Tag'][_0x008c('0x31')]);_0xcb560c['query']=_[_0x008c('0x4a')](_0x54e6dc['query']);_0xcb560c['filters']=_[_0x008c('0x37')](_0xcb560c[_0x008c('0x32')],_0xcb560c['query']);_0x134fe2['attributes']=_[_0x008c('0x37')](_0xcb560c[_0x008c('0x32')],qs[_0x008c('0x39')](_0x54e6dc['query'][_0x008c('0x39')]));_0x134fe2[_0x008c('0x38')]=_0x134fe2['attributes'][_0x008c('0x3a')]?_0x134fe2[_0x008c('0x38')]:_0xcb560c[_0x008c('0x32')];_0x134fe2['order']=qs['sort'](_0x54e6dc[_0x008c('0x34')][_0x008c('0x3d')]);_0x134fe2[_0x008c('0x42')]=qs[_0x008c('0x36')](_[_0x008c('0x51')](_0x54e6dc[_0x008c('0x34')],_0xcb560c[_0x008c('0x36')]));if(_0x54e6dc[_0x008c('0x34')][_0x008c('0x41')]){_0x134fe2[_0x008c('0x42')]=_[_0x008c('0x40')](_0x134fe2[_0x008c('0x42')],{'$or':_['map'](_0x134fe2[_0x008c('0x38')],function(_0x142bb3){var _0xadbf39={};_0xadbf39[_0x142bb3]={'$like':'%'+_0x54e6dc[_0x008c('0x34')][_0x008c('0x41')]+'%'};return _0xadbf39;})});}_0x134fe2=_[_0x008c('0x40')]({},_0x134fe2,_0x54e6dc['options']);return _0x5ef278[_0x008c('0x55')](_0x134fe2);}})[_0x008c('0x15')](function(_0x35328b){if(_0x35328b){_0x1b854e=_0x35328b[_0x008c('0x3a')];if(!_0x54e6dc['query'][_0x008c('0x3b')](_0x008c('0x52'))){_0x134fe2['limit']=qs[_0x008c('0x27')](_0x54e6dc[_0x008c('0x34')]['limit']);_0x134fe2[_0x008c('0x26')]=qs[_0x008c('0x26')](_0x54e6dc[_0x008c('0x34')]['offset']);}return _0x5ef278[_0x008c('0x55')](_0x134fe2);}})['then'](function(_0xe79c04){if(_0xe79c04){return _0xe79c04?{'count':_0x1b854e,'rows':_0xe79c04}:null;}})[_0x008c('0x15')](respondWithResult(_0x17d908,null))[_0x008c('0x20')](handleError(_0x17d908,null));};exports[_0x008c('0x57')]=function(_0xfd16fe,_0xdd7143,_0xac800e){if(_0xfd16fe['body']['id']){delete _0xfd16fe['body']['id'];}return db[_0x008c('0x30')][_0x008c('0x56')]({'where':{'id':_0xfd16fe['params']['id']}})[_0x008c('0x15')](handleEntityNotFound(_0xdd7143,null))[_0x008c('0x15')](function(_0x5edb18){if(_0x5edb18){return _0x5edb18['setTags'](_0xfd16fe[_0x008c('0x4d')]['ids']||[]);}return null;})[_0x008c('0x15')](respondWithResult(_0xdd7143,null))[_0x008c('0x20')](handleError(_0xdd7143,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 89a983c..a57f69c 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 _0x14a0=['api','moment','bluebird','request-promise','./intDeskConfiguration.attributes','define','DeskConfiguration','util','../../config/logger'];(function(_0x1587d1,_0x4ac855){var _0x376394=function(_0x513269){while(--_0x513269){_0x1587d1['push'](_0x1587d1['shift']());}};_0x376394(++_0x4ac855);}(_0x14a0,0x8e));var _0x014a=function(_0x47d972,_0x115aa5){_0x47d972=_0x47d972-0x0;var _0x15936b=_0x14a0[_0x47d972];return _0x15936b;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var logger=require(_0x014a('0x1'))(_0x014a('0x2'));var moment=require(_0x014a('0x3'));var BPromise=require(_0x014a('0x4'));var rp=require(_0x014a('0x5'));var attributes=require(_0x014a('0x6'));module['exports']=function(_0x57a522,_0x1730a5){return _0x57a522[_0x014a('0x7')](_0x014a('0x8'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4f4=['moment','bluebird','request-promise','./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','lodash','util','api'];(function(_0x2acbb3,_0x29e1b4){var _0x5c0cc7=function(_0x48c6a5){while(--_0x48c6a5){_0x2acbb3['push'](_0x2acbb3['shift']());}};_0x5c0cc7(++_0x29e1b4);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x4faad9,_0x3ba3b5){_0x4faad9=_0x4faad9-0x0;var _0xd3503d=_0xf4f4[_0x4faad9];return _0xd3503d;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var logger=require('../../config/logger')(_0x4f4f('0x2'));var moment=require(_0x4f4f('0x3'));var BPromise=require(_0x4f4f('0x4'));var rp=require(_0x4f4f('0x5'));var attributes=require(_0x4f4f('0x6'));module['exports']=function(_0x5a752b,_0x593952){return _0x5a752b[_0x4f4f('0x7')](_0x4f4f('0x8'),attributes,{'tableName':_0x4f4f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 7396962..5ddcffd 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 _0x9ffd=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','lodash'];(function(_0x388744,_0x315d33){var _0x2a57fd=function(_0x2e00ff){while(--_0x2e00ff){_0x388744['push'](_0x388744['shift']());}};_0x2a57fd(++_0x315d33);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1830e1,_0x40be07){_0x1830e1=_0x1830e1-0x0;var _0x20777d=_0x9ffd[_0x1830e1];return _0x20777d;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var db=require(_0xd9ff('0x4'))['db'];var utils=require(_0xd9ff('0x5'));var logger=require(_0xd9ff('0x6'))('rpc');var config=require(_0xd9ff('0x7'));var jayson=require(_0xd9ff('0x8'));var client=jayson['client'][_0xd9ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2982c3,_0x13ea8c,_0x270eb2){return new BPromise(function(_0x45c60a,_0x66282d){return client[_0xd9ff('0xa')](_0x2982c3,_0x270eb2)[_0xd9ff('0xb')](function(_0x977487){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x13ea8c,'request\x20sent');logger['debug'](_0xd9ff('0xc'),_0x13ea8c,_0xd9ff('0xd'),JSON[_0xd9ff('0xe')](_0x977487));if(_0x977487[_0xd9ff('0xf')]){if(_0x977487[_0xd9ff('0xf')][_0xd9ff('0x10')]===0x1f4){logger[_0xd9ff('0xf')](_0xd9ff('0x11'),_0x13ea8c,_0x977487['error']['message']);return _0x66282d(_0x977487[_0xd9ff('0xf')][_0xd9ff('0x12')]);}logger[_0xd9ff('0xf')](_0xd9ff('0x11'),_0x13ea8c,_0x977487[_0xd9ff('0xf')]['message']);return _0x45c60a(_0x977487[_0xd9ff('0xf')][_0xd9ff('0x12')]);}else{logger['info'](_0xd9ff('0x11'),_0x13ea8c,'request\x20sent');_0x45c60a(_0x977487['result']['message']);}})['catch'](function(_0x271287){logger['error'](_0xd9ff('0x11'),_0x13ea8c,_0x271287);_0x66282d(_0x271287);});});} \ No newline at end of file +var _0x9ffd=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','lodash'];(function(_0x378010,_0x512c43){var _0x306535=function(_0x557884){while(--_0x557884){_0x378010['push'](_0x378010['shift']());}};_0x306535(++_0x512c43);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x5727ca,_0x26d51b){_0x5727ca=_0x5727ca-0x0;var _0x563f4a=_0x9ffd[_0x5727ca];return _0x563f4a;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var db=require(_0xd9ff('0x4'))['db'];var utils=require(_0xd9ff('0x5'));var logger=require(_0xd9ff('0x6'))('rpc');var config=require(_0xd9ff('0x7'));var jayson=require(_0xd9ff('0x8'));var client=jayson['client'][_0xd9ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2982c3,_0x13ea8c,_0x270eb2){return new BPromise(function(_0x45c60a,_0x66282d){return client[_0xd9ff('0xa')](_0x2982c3,_0x270eb2)[_0xd9ff('0xb')](function(_0x977487){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x13ea8c,'request\x20sent');logger['debug'](_0xd9ff('0xc'),_0x13ea8c,_0xd9ff('0xd'),JSON[_0xd9ff('0xe')](_0x977487));if(_0x977487[_0xd9ff('0xf')]){if(_0x977487[_0xd9ff('0xf')][_0xd9ff('0x10')]===0x1f4){logger[_0xd9ff('0xf')](_0xd9ff('0x11'),_0x13ea8c,_0x977487['error']['message']);return _0x66282d(_0x977487[_0xd9ff('0xf')][_0xd9ff('0x12')]);}logger[_0xd9ff('0xf')](_0xd9ff('0x11'),_0x13ea8c,_0x977487[_0xd9ff('0xf')]['message']);return _0x45c60a(_0x977487[_0xd9ff('0xf')][_0xd9ff('0x12')]);}else{logger['info'](_0xd9ff('0x11'),_0x13ea8c,'request\x20sent');_0x45c60a(_0x977487['result']['message']);}})['catch'](function(_0x271287){logger['error'](_0xd9ff('0x11'),_0x13ea8c,_0x271287);_0x66282d(_0x271287);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 83636e6..1700e1a 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 _0xd978=['util','path','express','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','multer'];(function(_0x226dec,_0x620d40){var _0x267d7a=function(_0x4ae3ad){while(--_0x4ae3ad){_0x226dec['push'](_0x226dec['shift']());}};_0x267d7a(++_0x620d40);}(_0xd978,0x17f));var _0x8d97=function(_0x5cc5dc,_0x1af669){_0x5cc5dc=_0x5cc5dc-0x0;var _0x421a9c=_0xd978[_0x5cc5dc];return _0x421a9c;};'use strict';var multer=require(_0x8d97('0x0'));var util=require(_0x8d97('0x1'));var path=require(_0x8d97('0x2'));var express=require(_0x8d97('0x3'));var router=express['Router']();var auth=require(_0x8d97('0x4'));var interaction=require(_0x8d97('0x5'));var config=require('../../config/environment');var controller=require(_0x8d97('0x6'));router['get']('/',auth[_0x8d97('0x7')](),controller[_0x8d97('0x8')]);router[_0x8d97('0x9')](_0x8d97('0xa'),auth['isAuthenticated'](),controller[_0x8d97('0xb')]);router[_0x8d97('0xc')]('/',auth['isAuthenticated'](),controller[_0x8d97('0xd')]);router['put'](_0x8d97('0xa'),auth[_0x8d97('0x7')](),controller[_0x8d97('0xe')]);router[_0x8d97('0xf')](_0x8d97('0xa'),auth[_0x8d97('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3fd6=['express','Router','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','util','path'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0x3fd6,0x142));var _0x63fd=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3fd6[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require(_0x63fd('0x0'));var path=require(_0x63fd('0x1'));var express=require(_0x63fd('0x2'));var router=express[_0x63fd('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x63fd('0x4'));var config=require(_0x63fd('0x5'));var controller=require(_0x63fd('0x6'));router[_0x63fd('0x7')]('/',auth['isAuthenticated'](),controller[_0x63fd('0x8')]);router[_0x63fd('0x7')](_0x63fd('0x9'),auth[_0x63fd('0xa')](),controller[_0x63fd('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x63fd('0xc')]);router[_0x63fd('0xd')](_0x63fd('0x9'),auth[_0x63fd('0xa')](),controller[_0x63fd('0xe')]);router[_0x63fd('0xf')]('/:id',auth[_0x63fd('0xa')](),controller[_0x63fd('0x10')]);module[_0x63fd('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 72e26a5..afae1ae 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 _0xbdb7=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x13b392,_0x3481f2){var _0x39db24=function(_0xab91e5){while(--_0xab91e5){_0x13b392['push'](_0x13b392['shift']());}};_0x39db24(++_0x3481f2);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1cbcb2,_0x1237a3){_0x1cbcb2=_0x1cbcb2-0x0;var _0x41ac9f=_0xbdb7[_0x1cbcb2];return _0x41ac9f;};'use strict';var Sequelize=require(_0x7bdb('0x0'));module[_0x7bdb('0x1')]={'type':{'type':Sequelize[_0x7bdb('0x2')](_0x7bdb('0x3'),_0x7bdb('0x4'),_0x7bdb('0x5'),_0x7bdb('0x6')),'defaultValue':_0x7bdb('0x3')},'content':{'type':Sequelize[_0x7bdb('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7bdb('0x2')]('string','variable',_0x7bdb('0x5'))},'keyContent':{'type':Sequelize[_0x7bdb('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7bdb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7bdb('0x7')]}}; \ No newline at end of file +var _0x0bb5=['string','STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue'];(function(_0x34b821,_0x504e55){var _0x5e00a0=function(_0x242892){while(--_0x242892){_0x34b821['push'](_0x34b821['shift']());}};_0x5e00a0(++_0x504e55);}(_0x0bb5,0x148));var _0x50bb=function(_0xb2bdf6,_0x2f4d08){_0xb2bdf6=_0xb2bdf6-0x0;var _0x263a6b=_0x0bb5[_0xb2bdf6];return _0x263a6b;};'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 diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 51896c9..eeb33c5 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 _0x8cda=['stack','name','send','index','DeskField','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','nolimit','order','sort','where','add','day','filter','merge','map','options','includeAll','rows','include','find','create','body','catch','params','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../mysqldb','status','end','json','count','offset','limit','apply','reject','update','then','destroy','error'];(function(_0x224f9b,_0x220287){var _0x313ad6=function(_0x28e96b){while(--_0x28e96b){_0x224f9b['push'](_0x224f9b['shift']());}};_0x313ad6(++_0x220287);}(_0x8cda,0x1db));var _0xa8cd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8cda[_0x20a584];return _0x4b41a8;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xa8cd('0x0'));var moment=require(_0xa8cd('0x1'));var BPromise=require(_0xa8cd('0x2'));var Mustache=require(_0xa8cd('0x3'));var util=require(_0xa8cd('0x4'));var path=require(_0xa8cd('0x5'));var sox=require('sox');var csv=require(_0xa8cd('0x6'));var ejs=require(_0xa8cd('0x7'));var fs=require('fs');var _=require(_0xa8cd('0x8'));var squel=require('squel');var crypto=require(_0xa8cd('0x9'));var jsforce=require(_0xa8cd('0xa'));var deskjs=require(_0xa8cd('0xb'));var toCsv=require(_0xa8cd('0x6'));var querystring=require(_0xa8cd('0xc'));var Papa=require(_0xa8cd('0xd'));var qs=require(_0xa8cd('0xe'));var logger=require(_0xa8cd('0xf'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xa8cd('0x10'))['db'];function respondWithStatusCode(_0x4dfa9f,_0x1cb52f){_0x1cb52f=_0x1cb52f||0xcc;return function(_0x3e6bed){if(_0x3e6bed){return _0x4dfa9f['sendStatus'](_0x1cb52f);}return _0x4dfa9f[_0xa8cd('0x11')](_0x1cb52f)[_0xa8cd('0x12')]();};}function respondWithResult(_0x598d4c,_0x56083d){_0x56083d=_0x56083d||0xc8;return function(_0xec5e4){if(_0xec5e4){return _0x598d4c[_0xa8cd('0x11')](_0x56083d)[_0xa8cd('0x13')](_0xec5e4);}};}function respondWithFilteredResult(_0xefdff9,_0x144881){return function(_0x53a5d3){if(_0x53a5d3){var _0x3a87ff=_0x53a5d3[_0xa8cd('0x14')],_0x51d29e=_0x144881['offset'],_0x16f366=_0x144881[_0xa8cd('0x15')]+_0x144881[_0xa8cd('0x16')],_0x5ccd85;if(_0x16f366>=_0x3a87ff){_0x16f366=_0x3a87ff;_0x5ccd85=0xc8;}else{_0x5ccd85=0xce;}_0xefdff9[_0xa8cd('0x11')](_0x5ccd85);return _0xefdff9['set']('Content-Range',_0x51d29e+'-'+_0x16f366+'/'+_0x3a87ff)[_0xa8cd('0x13')](_0x53a5d3);}return null;};}function patchUpdates(_0x6d5f40){return function(_0x2494cf){try{jsonpatch[_0xa8cd('0x17')](_0x2494cf,_0x6d5f40,!![]);}catch(_0x55c494){return BPromise[_0xa8cd('0x18')](_0x55c494);}return _0x2494cf['save']();};}function saveUpdates(_0x1cacd5,_0x2ef224){return function(_0x572230){if(_0x572230){return _0x572230[_0xa8cd('0x19')](_0x1cacd5)[_0xa8cd('0x1a')](function(_0x56d8cf){return _0x56d8cf;});}return null;};}function removeEntity(_0x2acedd,_0x385224){return function(_0x1ecce0){if(_0x1ecce0){return _0x1ecce0[_0xa8cd('0x1b')]()[_0xa8cd('0x1a')](function(){_0x2acedd['status'](0xcc)[_0xa8cd('0x12')]();});}};}function handleEntityNotFound(_0x3e43fc,_0x426baf){return function(_0x447d7f){if(!_0x447d7f){_0x3e43fc['sendStatus'](0x194);}return _0x447d7f;};}function handleError(_0x1f15c0,_0x514665){_0x514665=_0x514665||0x1f4;return function(_0x50d0ec){logger[_0xa8cd('0x1c')](_0x50d0ec[_0xa8cd('0x1d')]);if(_0x50d0ec['name']){delete _0x50d0ec[_0xa8cd('0x1e')];}_0x1f15c0[_0xa8cd('0x11')](_0x514665)[_0xa8cd('0x1f')](_0x50d0ec);};}exports[_0xa8cd('0x20')]=function(_0x27b672,_0x2d1ef5){var _0x1f369d={},_0x4a5221={},_0x3c5812={'count':0x0,'rows':[]};var _0x42ae30=db[_0xa8cd('0x21')][_0xa8cd('0x22')];_0x4a5221[_0xa8cd('0x23')]=_[_0xa8cd('0x24')](_0x42ae30);var _0x4e5230={'dateStart':_0x27b672[_0xa8cd('0x25')][_0xa8cd('0x26')],'dateEnd':_0x27b672[_0xa8cd('0x25')][_0xa8cd('0x27')]};delete _0x27b672[_0xa8cd('0x25')][_0xa8cd('0x26')];delete _0x27b672[_0xa8cd('0x25')][_0xa8cd('0x27')];_0x4a5221[_0xa8cd('0x25')]=_[_0xa8cd('0x24')](_0x27b672[_0xa8cd('0x25')]);_0x4a5221[_0xa8cd('0x28')]=_[_0xa8cd('0x29')](_0x4a5221[_0xa8cd('0x23')],_0x4a5221[_0xa8cd('0x25')]);_0x1f369d[_0xa8cd('0x2a')]=_['intersection'](_0x4a5221['model'],qs['fields'](_0x27b672[_0xa8cd('0x25')][_0xa8cd('0x2b')]));_0x1f369d[_0xa8cd('0x2a')]=_0x1f369d[_0xa8cd('0x2a')][_0xa8cd('0x2c')]?_0x1f369d[_0xa8cd('0x2a')]:_0x4a5221['model'];if(!_0x27b672['query']['hasOwnProperty'](_0xa8cd('0x2d'))){_0x1f369d[_0xa8cd('0x16')]=qs[_0xa8cd('0x16')](_0x27b672[_0xa8cd('0x25')][_0xa8cd('0x16')]);_0x1f369d[_0xa8cd('0x15')]=qs[_0xa8cd('0x15')](_0x27b672['query'][_0xa8cd('0x15')]);}_0x1f369d[_0xa8cd('0x2e')]=qs['sort'](_0x27b672[_0xa8cd('0x25')][_0xa8cd('0x2f')]);_0x1f369d[_0xa8cd('0x30')]=qs[_0xa8cd('0x28')](_['pick'](_0x27b672[_0xa8cd('0x25')],_0x4a5221[_0xa8cd('0x28')]));if(_0x4e5230['dateStart']){if(_0x4e5230[_0xa8cd('0x27')]){_0x4e5230[_0xa8cd('0x27')]=moment(_0x4e5230[_0xa8cd('0x27')])[_0xa8cd('0x31')](0x1,'day');}else{_0x4e5230['dateEnd']=moment(_0x4e5230[_0xa8cd('0x26')])['add'](0x1,_0xa8cd('0x32'));}_['merge'](_0x1f369d[_0xa8cd('0x30')],{'createdAt':{'$gte':_0x4e5230[_0xa8cd('0x26')],'$lte':_0x4e5230['dateEnd']}});}if(_0x27b672[_0xa8cd('0x25')][_0xa8cd('0x33')]){_0x1f369d[_0xa8cd('0x30')]=_[_0xa8cd('0x34')](_0x1f369d[_0xa8cd('0x30')],{'$or':_[_0xa8cd('0x35')](_0x1f369d[_0xa8cd('0x2a')],function(_0x5100d5){var _0x2437b0={};_0x2437b0[_0x5100d5]={'$like':'%'+_0x27b672[_0xa8cd('0x25')]['filter']+'%'};return _0x2437b0;})});}_0x1f369d=_['merge']({},_0x1f369d,_0x27b672[_0xa8cd('0x36')]);var _0x3da42e={'where':_0x1f369d[_0xa8cd('0x30')]};return db[_0xa8cd('0x21')][_0xa8cd('0x14')](_0x3da42e)[_0xa8cd('0x1a')](function(_0x40cd4e){_0x3c5812[_0xa8cd('0x14')]=_0x40cd4e;if(_0x27b672['query'][_0xa8cd('0x37')]){_0x1f369d['include']=[{'all':!![]}];}return db[_0xa8cd('0x21')]['findAll'](_0x1f369d);})[_0xa8cd('0x1a')](function(_0x27a64c){_0x3c5812[_0xa8cd('0x38')]=_0x27a64c;return _0x3c5812;})[_0xa8cd('0x1a')](respondWithFilteredResult(_0x2d1ef5,_0x1f369d))['catch'](handleError(_0x2d1ef5,null));};exports['show']=function(_0x5067d3,_0x5e8a6c){var _0x1b9f17={'raw':!![],'where':{'id':_0x5067d3['params']['id']}},_0x40c80d={};_0x40c80d[_0xa8cd('0x23')]=_[_0xa8cd('0x24')](db[_0xa8cd('0x21')][_0xa8cd('0x22')]);_0x40c80d[_0xa8cd('0x25')]=_[_0xa8cd('0x24')](_0x5067d3['query']);_0x40c80d['filters']=_[_0xa8cd('0x29')](_0x40c80d[_0xa8cd('0x23')],_0x40c80d[_0xa8cd('0x25')]);_0x1b9f17[_0xa8cd('0x2a')]=_['intersection'](_0x40c80d[_0xa8cd('0x23')],qs[_0xa8cd('0x2b')](_0x5067d3[_0xa8cd('0x25')][_0xa8cd('0x2b')]));_0x1b9f17['attributes']=_0x1b9f17['attributes']['length']?_0x1b9f17[_0xa8cd('0x2a')]:_0x40c80d[_0xa8cd('0x23')];if(_0x5067d3['query'][_0xa8cd('0x37')]){_0x1b9f17[_0xa8cd('0x39')]=[{'all':!![]}];}_0x1b9f17=_[_0xa8cd('0x34')]({},_0x1b9f17,_0x5067d3[_0xa8cd('0x36')]);return db[_0xa8cd('0x21')][_0xa8cd('0x3a')](_0x1b9f17)['then'](handleEntityNotFound(_0x5e8a6c,null))['then'](respondWithResult(_0x5e8a6c,null))['catch'](handleError(_0x5e8a6c,null));};exports[_0xa8cd('0x3b')]=function(_0x2f3d01,_0x97f52a){return db[_0xa8cd('0x21')][_0xa8cd('0x3b')](_0x2f3d01[_0xa8cd('0x3c')],{})[_0xa8cd('0x1a')](respondWithResult(_0x97f52a,0xc9))[_0xa8cd('0x3d')](handleError(_0x97f52a,null));};exports[_0xa8cd('0x19')]=function(_0x534f5a,_0x5429e8){if(_0x534f5a[_0xa8cd('0x3c')]['id']){delete _0x534f5a['body']['id'];}return db[_0xa8cd('0x21')][_0xa8cd('0x3a')]({'where':{'id':_0x534f5a[_0xa8cd('0x3e')]['id']}})[_0xa8cd('0x1a')](handleEntityNotFound(_0x5429e8,null))[_0xa8cd('0x1a')](saveUpdates(_0x534f5a['body'],null))[_0xa8cd('0x1a')](respondWithResult(_0x5429e8,null))['catch'](handleError(_0x5429e8,null));};exports[_0xa8cd('0x1b')]=function(_0x9dd1a3,_0x2114f2){return db[_0xa8cd('0x21')][_0xa8cd('0x3a')]({'where':{'id':_0x9dd1a3[_0xa8cd('0x3e')]['id']}})[_0xa8cd('0x1a')](handleEntityNotFound(_0x2114f2,null))[_0xa8cd('0x1a')](removeEntity(_0x2114f2,null))[_0xa8cd('0x3d')](handleError(_0x2114f2,null));}; \ No newline at end of file +var _0x794b=['filters','add','day','merge','filter','map','options','DeskField','rows','show','params','includeAll','catch','create','body','find','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','error','stack','name','send','rawAttributes','model','query','dateStart','dateEnd','keys','attributes','intersection','fields','length','nolimit','sort','where'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x794b,0x1c2));var _0xb794=function(_0xf4671d,_0x1fa41c){_0xf4671d=_0xf4671d-0x0;var _0x2bd1c4=_0x794b[_0xf4671d];return _0x2bd1c4;};'use strict';var jsonpatch=require(_0xb794('0x0'));var rp=require(_0xb794('0x1'));var moment=require('moment');var BPromise=require(_0xb794('0x2'));var Mustache=require(_0xb794('0x3'));var util=require('util');var path=require('path');var sox=require(_0xb794('0x4'));var csv=require(_0xb794('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb794('0x6'));var crypto=require(_0xb794('0x7'));var jsforce=require(_0xb794('0x8'));var deskjs=require(_0xb794('0x9'));var toCsv=require(_0xb794('0x5'));var querystring=require(_0xb794('0xa'));var Papa=require('papaparse');var qs=require(_0xb794('0xb'));var logger=require(_0xb794('0xc'))(_0xb794('0xd'));var utils=require(_0xb794('0xe'));var config=require(_0xb794('0xf'));var db=require(_0xb794('0x10'))['db'];function respondWithStatusCode(_0x13bd3d,_0x1f224a){_0x1f224a=_0x1f224a||0xcc;return function(_0x19cfa0){if(_0x19cfa0){return _0x13bd3d[_0xb794('0x11')](_0x1f224a);}return _0x13bd3d[_0xb794('0x12')](_0x1f224a)[_0xb794('0x13')]();};}function respondWithResult(_0x381f7a,_0x780c5b){_0x780c5b=_0x780c5b||0xc8;return function(_0x12b09e){if(_0x12b09e){return _0x381f7a[_0xb794('0x12')](_0x780c5b)[_0xb794('0x14')](_0x12b09e);}};}function respondWithFilteredResult(_0x3be436,_0xd13441){return function(_0x3b036b){if(_0x3b036b){var _0x20f84a=_0x3b036b[_0xb794('0x15')],_0x57c750=_0xd13441[_0xb794('0x16')],_0x44e714=_0xd13441[_0xb794('0x16')]+_0xd13441[_0xb794('0x17')],_0x14927e;if(_0x44e714>=_0x20f84a){_0x44e714=_0x20f84a;_0x14927e=0xc8;}else{_0x14927e=0xce;}_0x3be436['status'](_0x14927e);return _0x3be436[_0xb794('0x18')](_0xb794('0x19'),_0x57c750+'-'+_0x44e714+'/'+_0x20f84a)['json'](_0x3b036b);}return null;};}function patchUpdates(_0x408766){return function(_0x11244f){try{jsonpatch['apply'](_0x11244f,_0x408766,!![]);}catch(_0x1c84ff){return BPromise[_0xb794('0x1a')](_0x1c84ff);}return _0x11244f[_0xb794('0x1b')]();};}function saveUpdates(_0x518d3d,_0x722b1b){return function(_0xa0c655){if(_0xa0c655){return _0xa0c655['update'](_0x518d3d)[_0xb794('0x1c')](function(_0x22d126){return _0x22d126;});}return null;};}function removeEntity(_0x3d9fc4,_0x324903){return function(_0x42a013){if(_0x42a013){return _0x42a013['destroy']()[_0xb794('0x1c')](function(){_0x3d9fc4[_0xb794('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c5f4f,_0x240c06){return function(_0x29d308){if(!_0x29d308){_0x2c5f4f[_0xb794('0x11')](0x194);}return _0x29d308;};}function handleError(_0x31bd91,_0x189677){_0x189677=_0x189677||0x1f4;return function(_0x375b41){logger[_0xb794('0x1d')](_0x375b41[_0xb794('0x1e')]);if(_0x375b41[_0xb794('0x1f')]){delete _0x375b41[_0xb794('0x1f')];}_0x31bd91[_0xb794('0x12')](_0x189677)[_0xb794('0x20')](_0x375b41);};}exports['index']=function(_0x3b17fb,_0x3f6b71){var _0xeebf12={},_0x47e38c={},_0x4bebc9={'count':0x0,'rows':[]};var _0x1675ea=db['DeskField'][_0xb794('0x21')];_0x47e38c[_0xb794('0x22')]=_['keys'](_0x1675ea);var _0x4d1d9f={'dateStart':_0x3b17fb[_0xb794('0x23')][_0xb794('0x24')],'dateEnd':_0x3b17fb[_0xb794('0x23')]['dateEnd']};delete _0x3b17fb['query'][_0xb794('0x24')];delete _0x3b17fb[_0xb794('0x23')][_0xb794('0x25')];_0x47e38c[_0xb794('0x23')]=_[_0xb794('0x26')](_0x3b17fb[_0xb794('0x23')]);_0x47e38c['filters']=_['intersection'](_0x47e38c['model'],_0x47e38c[_0xb794('0x23')]);_0xeebf12[_0xb794('0x27')]=_[_0xb794('0x28')](_0x47e38c['model'],qs[_0xb794('0x29')](_0x3b17fb['query'][_0xb794('0x29')]));_0xeebf12[_0xb794('0x27')]=_0xeebf12['attributes'][_0xb794('0x2a')]?_0xeebf12['attributes']:_0x47e38c[_0xb794('0x22')];if(!_0x3b17fb[_0xb794('0x23')]['hasOwnProperty'](_0xb794('0x2b'))){_0xeebf12[_0xb794('0x17')]=qs[_0xb794('0x17')](_0x3b17fb[_0xb794('0x23')][_0xb794('0x17')]);_0xeebf12[_0xb794('0x16')]=qs[_0xb794('0x16')](_0x3b17fb['query'][_0xb794('0x16')]);}_0xeebf12['order']=qs[_0xb794('0x2c')](_0x3b17fb['query'][_0xb794('0x2c')]);_0xeebf12[_0xb794('0x2d')]=qs[_0xb794('0x2e')](_['pick'](_0x3b17fb['query'],_0x47e38c[_0xb794('0x2e')]));if(_0x4d1d9f[_0xb794('0x24')]){if(_0x4d1d9f[_0xb794('0x25')]){_0x4d1d9f['dateEnd']=moment(_0x4d1d9f[_0xb794('0x25')])[_0xb794('0x2f')](0x1,_0xb794('0x30'));}else{_0x4d1d9f[_0xb794('0x25')]=moment(_0x4d1d9f[_0xb794('0x24')])['add'](0x1,_0xb794('0x30'));}_[_0xb794('0x31')](_0xeebf12[_0xb794('0x2d')],{'createdAt':{'$gte':_0x4d1d9f[_0xb794('0x24')],'$lte':_0x4d1d9f['dateEnd']}});}if(_0x3b17fb[_0xb794('0x23')][_0xb794('0x32')]){_0xeebf12[_0xb794('0x2d')]=_['merge'](_0xeebf12['where'],{'$or':_[_0xb794('0x33')](_0xeebf12[_0xb794('0x27')],function(_0x4928b9){var _0x1606c6={};_0x1606c6[_0x4928b9]={'$like':'%'+_0x3b17fb[_0xb794('0x23')][_0xb794('0x32')]+'%'};return _0x1606c6;})});}_0xeebf12=_['merge']({},_0xeebf12,_0x3b17fb[_0xb794('0x34')]);var _0xb9ad03={'where':_0xeebf12[_0xb794('0x2d')]};return db[_0xb794('0x35')][_0xb794('0x15')](_0xb9ad03)[_0xb794('0x1c')](function(_0x3f856a){_0x4bebc9[_0xb794('0x15')]=_0x3f856a;if(_0x3b17fb[_0xb794('0x23')]['includeAll']){_0xeebf12['include']=[{'all':!![]}];}return db[_0xb794('0x35')]['findAll'](_0xeebf12);})[_0xb794('0x1c')](function(_0x2265b7){_0x4bebc9[_0xb794('0x36')]=_0x2265b7;return _0x4bebc9;})[_0xb794('0x1c')](respondWithFilteredResult(_0x3f6b71,_0xeebf12))['catch'](handleError(_0x3f6b71,null));};exports[_0xb794('0x37')]=function(_0x5f2a0a,_0x12c344){var _0x8240e1={'raw':!![],'where':{'id':_0x5f2a0a[_0xb794('0x38')]['id']}},_0x27794d={};_0x27794d[_0xb794('0x22')]=_['keys'](db[_0xb794('0x35')][_0xb794('0x21')]);_0x27794d[_0xb794('0x23')]=_[_0xb794('0x26')](_0x5f2a0a[_0xb794('0x23')]);_0x27794d[_0xb794('0x2e')]=_[_0xb794('0x28')](_0x27794d[_0xb794('0x22')],_0x27794d[_0xb794('0x23')]);_0x8240e1[_0xb794('0x27')]=_[_0xb794('0x28')](_0x27794d[_0xb794('0x22')],qs['fields'](_0x5f2a0a['query']['fields']));_0x8240e1['attributes']=_0x8240e1[_0xb794('0x27')]['length']?_0x8240e1[_0xb794('0x27')]:_0x27794d[_0xb794('0x22')];if(_0x5f2a0a[_0xb794('0x23')][_0xb794('0x39')]){_0x8240e1['include']=[{'all':!![]}];}_0x8240e1=_['merge']({},_0x8240e1,_0x5f2a0a[_0xb794('0x34')]);return db['DeskField']['find'](_0x8240e1)['then'](handleEntityNotFound(_0x12c344,null))['then'](respondWithResult(_0x12c344,null))[_0xb794('0x3a')](handleError(_0x12c344,null));};exports[_0xb794('0x3b')]=function(_0x620576,_0x6c8365){return db[_0xb794('0x35')][_0xb794('0x3b')](_0x620576[_0xb794('0x3c')],{})[_0xb794('0x1c')](respondWithResult(_0x6c8365,0xc9))['catch'](handleError(_0x6c8365,null));};exports['update']=function(_0x3dc181,_0x4bff19){if(_0x3dc181[_0xb794('0x3c')]['id']){delete _0x3dc181[_0xb794('0x3c')]['id'];}return db[_0xb794('0x35')][_0xb794('0x3d')]({'where':{'id':_0x3dc181['params']['id']}})[_0xb794('0x1c')](handleEntityNotFound(_0x4bff19,null))['then'](saveUpdates(_0x3dc181['body'],null))[_0xb794('0x1c')](respondWithResult(_0x4bff19,null))['catch'](handleError(_0x4bff19,null));};exports['destroy']=function(_0x1c5609,_0x36ba32){return db[_0xb794('0x35')]['find']({'where':{'id':_0x1c5609['params']['id']}})['then'](handleEntityNotFound(_0x36ba32,null))[_0xb794('0x1c')](removeEntity(_0x36ba32,null))['catch'](handleError(_0x36ba32,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index b9baac2..a223487 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 _0xac31=['DeskField','int_desk_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xac31,0xca));var _0x1ac3=function(_0x3f7c8b,_0x3cbe20){_0x3f7c8b=_0x3f7c8b-0x0;var _0x57f478=_0xac31[_0x3f7c8b];return _0x57f478;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var logger=require(_0x1ac3('0x2'))(_0x1ac3('0x3'));var moment=require(_0x1ac3('0x4'));var BPromise=require(_0x1ac3('0x5'));var rp=require(_0x1ac3('0x6'));var attributes=require('./intDeskField.attributes');module[_0x1ac3('0x7')]=function(_0x434b5e,_0x4dcc96){return _0x434b5e['define'](_0x1ac3('0x8'),attributes,{'tableName':_0x1ac3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7c8=['int_desk_fields','util','../../config/logger','api','moment','bluebird','request-promise','./intDeskField.attributes','define','DeskField'];(function(_0x51200b,_0x2d4bda){var _0xc90934=function(_0x159384){while(--_0x159384){_0x51200b['push'](_0x51200b['shift']());}};_0xc90934(++_0x2d4bda);}(_0xb7c8,0x119));var _0x8b7c=function(_0x37e74d,_0x5d0d64){_0x37e74d=_0x37e74d-0x0;var _0xf9f588=_0xb7c8[_0x37e74d];return _0xf9f588;};'use strict';var _=require('lodash');var util=require(_0x8b7c('0x0'));var logger=require(_0x8b7c('0x1'))(_0x8b7c('0x2'));var moment=require(_0x8b7c('0x3'));var BPromise=require(_0x8b7c('0x4'));var rp=require(_0x8b7c('0x5'));var attributes=require(_0x8b7c('0x6'));module['exports']=function(_0x38672b,_0x412f93){return _0x38672b[_0x8b7c('0x7')](_0x8b7c('0x8'),attributes,{'tableName':_0x8b7c('0x9'),'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 ecb05b2..1481579 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 _0xf501=['debug','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','DeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xf501,0xcd));var _0x1f50=function(_0x3702cc,_0x25d4f4){_0x3702cc=_0x3702cc-0x0;var _0x307485=_0xf501[_0x3702cc];return _0x307485;};'use strict';var _=require(_0x1f50('0x0'));var util=require(_0x1f50('0x1'));var moment=require(_0x1f50('0x2'));var BPromise=require(_0x1f50('0x3'));var rs=require(_0x1f50('0x4'));var fs=require('fs');var db=require(_0x1f50('0x5'))['db'];var utils=require(_0x1f50('0x6'));var logger=require(_0x1f50('0x7'))(_0x1f50('0x8'));var config=require('../../config/environment');var jayson=require(_0x1f50('0x9'));var client=jayson[_0x1f50('0xa')][_0x1f50('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d3d7e,_0xf6cb7,_0x4e71cd){return new BPromise(function(_0x38f082,_0x412e5d){return client['request'](_0x3d3d7e,_0x4e71cd)['then'](function(_0x37b833){logger[_0x1f50('0xc')](_0x1f50('0xd'),_0xf6cb7,_0x1f50('0xe'));logger[_0x1f50('0xf')]('DeskField,\x20%s,\x20%s,\x20%s',_0xf6cb7,_0x1f50('0xe'),JSON[_0x1f50('0x10')](_0x37b833));if(_0x37b833[_0x1f50('0x11')]){if(_0x37b833[_0x1f50('0x11')]['code']===0x1f4){logger[_0x1f50('0x11')]('DeskField,\x20%s,\x20%s',_0xf6cb7,_0x37b833[_0x1f50('0x11')]['message']);return _0x412e5d(_0x37b833[_0x1f50('0x11')][_0x1f50('0x12')]);}logger['error'](_0x1f50('0xd'),_0xf6cb7,_0x37b833[_0x1f50('0x11')]['message']);return _0x38f082(_0x37b833[_0x1f50('0x11')][_0x1f50('0x12')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0xf6cb7,_0x1f50('0xe'));_0x38f082(_0x37b833['result']['message']);}})[_0x1f50('0x13')](function(_0x14d217){logger[_0x1f50('0x11')](_0x1f50('0xd'),_0xf6cb7,_0x14d217);_0x412e5d(_0x14d217);});});} \ No newline at end of file +var _0x4c3d=['lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x5e2b71,_0x32882f){var _0x4ba620=function(_0x12afd1){while(--_0x12afd1){_0x5e2b71['push'](_0x5e2b71['shift']());}};_0x4ba620(++_0x32882f);}(_0x4c3d,0xe7));var _0xd4c3=function(_0x50516c,_0x500c0f){_0x50516c=_0x50516c-0x0;var _0x5c3523=_0x4c3d[_0x50516c];return _0x5c3523;};'use strict';var _=require(_0xd4c3('0x0'));var util=require(_0xd4c3('0x1'));var moment=require(_0xd4c3('0x2'));var BPromise=require(_0xd4c3('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xd4c3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd4c3('0x5'))(_0xd4c3('0x6'));var config=require(_0xd4c3('0x7'));var jayson=require(_0xd4c3('0x8'));var client=jayson[_0xd4c3('0x9')][_0xd4c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x396fa6,_0x52e1cb,_0x25d89c){return new BPromise(function(_0x1df958,_0x925041){return client['request'](_0x396fa6,_0x25d89c)['then'](function(_0x3e1498){logger[_0xd4c3('0xb')](_0xd4c3('0xc'),_0x52e1cb,_0xd4c3('0xd'));logger[_0xd4c3('0xe')](_0xd4c3('0xf'),_0x52e1cb,_0xd4c3('0xd'),JSON[_0xd4c3('0x10')](_0x3e1498));if(_0x3e1498[_0xd4c3('0x11')]){if(_0x3e1498['error'][_0xd4c3('0x12')]===0x1f4){logger[_0xd4c3('0x11')](_0xd4c3('0xc'),_0x52e1cb,_0x3e1498[_0xd4c3('0x11')][_0xd4c3('0x13')]);return _0x925041(_0x3e1498['error'][_0xd4c3('0x13')]);}logger['error']('DeskField,\x20%s,\x20%s',_0x52e1cb,_0x3e1498[_0xd4c3('0x11')][_0xd4c3('0x13')]);return _0x1df958(_0x3e1498[_0xd4c3('0x11')][_0xd4c3('0x13')]);}else{logger['info'](_0xd4c3('0xc'),_0x52e1cb,_0xd4c3('0xd'));_0x1df958(_0x3e1498['result'][_0xd4c3('0x13')]);}})[_0xd4c3('0x14')](function(_0x56226c){logger['error']('DeskField,\x20%s,\x20%s',_0x52e1cb,_0x56226c);_0x925041(_0x56226c);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index de6db66..a5e85cb 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 _0x535a=['Router','../../components/interaction/service','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x5ff8d4,_0x32230e){var _0x4629d8=function(_0x3b4770){while(--_0x3b4770){_0x5ff8d4['push'](_0x5ff8d4['shift']());}};_0x4629d8(++_0x32230e);}(_0x535a,0x13f));var _0xa535=function(_0x5b6a83,_0x1a5635){_0x5b6a83=_0x5b6a83-0x0;var _0x10c365=_0x535a[_0x5b6a83];return _0x10c365;};'use strict';var multer=require(_0xa535('0x0'));var util=require(_0xa535('0x1'));var path=require(_0xa535('0x2'));var express=require(_0xa535('0x3'));var router=express[_0xa535('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa535('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0xa535('0x6')]('/',auth[_0xa535('0x7')](),controller['index']);router[_0xa535('0x6')](_0xa535('0x8'),auth[_0xa535('0x7')](),controller['show']);router[_0xa535('0x6')](_0xa535('0x9'),auth[_0xa535('0x7')](),controller[_0xa535('0xa')]);router['get'](_0xa535('0xb'),auth[_0xa535('0x7')](),controller[_0xa535('0xc')]);router[_0xa535('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0xa535('0x7')](),controller['addConfiguration']);router[_0xa535('0xe')]('/:id',auth[_0xa535('0x7')](),controller[_0xa535('0xf')]);router[_0xa535('0x10')]('/:id',auth[_0xa535('0x7')](),controller[_0xa535('0x11')]);module[_0xa535('0x12')]=router; \ No newline at end of file +var _0x6bff=['../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','/:id','exports','multer','util','path','express','../../components/auth/service'];(function(_0x532572,_0x4abe2e){var _0x5603e7=function(_0x58c6fb){while(--_0x58c6fb){_0x532572['push'](_0x532572['shift']());}};_0x5603e7(++_0x4abe2e);}(_0x6bff,0x1de));var _0xf6bf=function(_0x326df5,_0x7b757d){_0x326df5=_0x326df5-0x0;var _0x20d1df=_0x6bff[_0x326df5];return _0x20d1df;};'use strict';var multer=require(_0xf6bf('0x0'));var util=require(_0xf6bf('0x1'));var path=require(_0xf6bf('0x2'));var express=require(_0xf6bf('0x3'));var router=express['Router']();var auth=require(_0xf6bf('0x4'));var interaction=require(_0xf6bf('0x5'));var config=require(_0xf6bf('0x6'));var controller=require(_0xf6bf('0x7'));router[_0xf6bf('0x8')]('/',auth[_0xf6bf('0x9')](),controller[_0xf6bf('0xa')]);router[_0xf6bf('0x8')]('/:id',auth[_0xf6bf('0x9')](),controller['show']);router[_0xf6bf('0x8')](_0xf6bf('0xb'),auth[_0xf6bf('0x9')](),controller[_0xf6bf('0xc')]);router['get'](_0xf6bf('0xd'),auth[_0xf6bf('0x9')](),controller[_0xf6bf('0xe')]);router['post']('/',auth[_0xf6bf('0x9')](),controller[_0xf6bf('0xf')]);router[_0xf6bf('0x10')]('/:id/configurations',auth[_0xf6bf('0x9')](),controller[_0xf6bf('0x11')]);router[_0xf6bf('0x12')](_0xf6bf('0x13'),auth[_0xf6bf('0x9')](),controller['update']);router['delete'](_0xf6bf('0x13'),auth[_0xf6bf('0x9')](),controller['destroy']);module[_0xf6bf('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 1e4524d..5de95af 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 _0x97b7=['exports','STRING','username','sequelize'];(function(_0x35a140,_0x3aeac6){var _0x30ab82=function(_0x15a7c3){while(--_0x15a7c3){_0x35a140['push'](_0x35a140['shift']());}};_0x30ab82(++_0x3aeac6);}(_0x97b7,0x1bf));var _0x797b=function(_0x4351d0,_0xc369cc){_0x4351d0=_0x4351d0-0x0;var _0x1f8fd5=_0x97b7[_0x4351d0];return _0x1f8fd5;};'use strict';var Sequelize=require(_0x797b('0x0'));module[_0x797b('0x1')]={'name':{'type':Sequelize[_0x797b('0x2')]},'description':{'type':Sequelize[_0x797b('0x2')]},'username':{'type':Sequelize[_0x797b('0x2')],'unique':_0x797b('0x3')},'apiKey':{'type':Sequelize[_0x797b('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x797b('0x2')]}}; \ No newline at end of file +var _0x27bf=['remoteUri','exports','STRING'];(function(_0xf48d35,_0x2044f4){var _0x23522=function(_0x5defe9){while(--_0x5defe9){_0xf48d35['push'](_0xf48d35['shift']());}};_0x23522(++_0x2044f4);}(_0x27bf,0x166));var _0xf27b=function(_0x191972,_0x1db9fa){_0x191972=_0x191972-0x0;var _0x152e1c=_0x27bf[_0x191972];return _0x152e1c;};'use strict';var Sequelize=require('sequelize');module[_0xf27b('0x0')]={'name':{'type':Sequelize[_0xf27b('0x1')]},'description':{'type':Sequelize[_0xf27b('0x1')]},'username':{'type':Sequelize[_0xf27b('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0xf27b('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xf27b('0x2')},'serverUrl':{'type':Sequelize[_0xf27b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index a83d4da..8bb5d20 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 _0x039a=['mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','../../components/parsers/qs','../../config/logger','api','../../config/utils','client','http','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshdeskAccount,\x20%s,\x20%s','catch','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','stack','name','send','index','FreshdeskAccount','keys','query','dateEnd','dateStart','filters','model','attributes','intersection','fields','length','order','where','pick','add','day','merge','filter','count','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','body','findOne','sort','map','hasOwnProperty','getConfigurations','AccountId','channel','type','Descriptions','getDescriptions','FreshdeskField','Subjects','getFields','remoteUri','apiKey','GET','api/v2/ticket_fields','format','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','source','group','company','remove','includes','default','custom_text','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','request-promise','bluebird'];(function(_0x1f5070,_0x3fa65f){var _0x2b9cfd=function(_0x3a2cae){while(--_0x3a2cae){_0x1f5070['push'](_0x1f5070['shift']());}};_0x2b9cfd(++_0x3fa65f);}(_0x039a,0x6f));var _0xa039=function(_0x177dc7,_0x13501c){_0x177dc7=_0x177dc7-0x0;var _0x19b7dc=_0x039a[_0x177dc7];return _0x19b7dc;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xa039('0x0'));var moment=require('moment');var BPromise=require(_0xa039('0x1'));var Mustache=require(_0xa039('0x2'));var util=require(_0xa039('0x3'));var path=require(_0xa039('0x4'));var sox=require('sox');var csv=require(_0xa039('0x5'));var ejs=require(_0xa039('0x6'));var fs=require('fs');var _=require(_0xa039('0x7'));var squel=require('squel');var crypto=require(_0xa039('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xa039('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0xa039('0xa'));var logger=require(_0xa039('0xb'))(_0xa039('0xc'));var utils=require(_0xa039('0xd'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xa039('0xe')][_0xa039('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x1b2820,_0x589759,_0x4656af,_0x29e7c5){return new BPromise(function(_0x57971b,_0x38b775){var _0x26a294=_0x29e7c5||client;return _0x26a294['request'](_0x1b2820,_0x4656af)[_0xa039('0x10')](function(_0x191c45){logger[_0xa039('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x589759,_0xa039('0x12'));logger[_0xa039('0x13')](_0xa039('0x14'),_0x589759,_0xa039('0x12'),JSON[_0xa039('0x15')](_0x191c45));if(_0x191c45[_0xa039('0x16')]){if(_0x191c45[_0xa039('0x16')]['code']===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x589759,_0x191c45[_0xa039('0x16')][_0xa039('0x17')]);return _0x38b775(_0x191c45[_0xa039('0x16')]['message']);}logger[_0xa039('0x16')]('FreshdeskAccount,\x20%s,\x20%s',_0x589759,_0x191c45[_0xa039('0x16')]['message']);return _0x57971b(_0x191c45[_0xa039('0x16')][_0xa039('0x17')]);}else{logger['info'](_0xa039('0x18'),_0x589759,_0xa039('0x12'));_0x57971b(_0x191c45['result']['message']);}})[_0xa039('0x19')](function(_0x23b3df){logger[_0xa039('0x16')]('FreshdeskAccount,\x20%s,\x20%s',_0x589759,_0x23b3df);_0x38b775(_0x23b3df);});});}function respondWithStatusCode(_0x5af279,_0x1c764f){_0x1c764f=_0x1c764f||0xcc;return function(_0x45c769){if(_0x45c769){return _0x5af279['sendStatus'](_0x1c764f);}return _0x5af279[_0xa039('0x1a')](_0x1c764f)['end']();};}function respondWithResult(_0x305e4e,_0x3ee72e){_0x3ee72e=_0x3ee72e||0xc8;return function(_0x50b986){if(_0x50b986){return _0x305e4e[_0xa039('0x1a')](_0x3ee72e)[_0xa039('0x1b')](_0x50b986);}};}function respondWithFilteredResult(_0x5bdbba,_0x49e9c0){return function(_0x4de9c2){if(_0x4de9c2){var _0x3a4410=_0x4de9c2['count'],_0xbe36ad=_0x49e9c0[_0xa039('0x1c')],_0x33ea45=_0x49e9c0[_0xa039('0x1c')]+_0x49e9c0[_0xa039('0x1d')],_0x4b86a9;if(_0x33ea45>=_0x3a4410){_0x33ea45=_0x3a4410;_0x4b86a9=0xc8;}else{_0x4b86a9=0xce;}_0x5bdbba[_0xa039('0x1a')](_0x4b86a9);return _0x5bdbba[_0xa039('0x1e')](_0xa039('0x1f'),_0xbe36ad+'-'+_0x33ea45+'/'+_0x3a4410)[_0xa039('0x1b')](_0x4de9c2);}return null;};}function patchUpdates(_0x417a29){return function(_0x1b4a9a){try{jsonpatch[_0xa039('0x20')](_0x1b4a9a,_0x417a29,!![]);}catch(_0x4ffcde){return BPromise[_0xa039('0x21')](_0x4ffcde);}return _0x1b4a9a[_0xa039('0x22')]();};}function saveUpdates(_0x47b923,_0x2cad7a){return function(_0x33a1cb){if(_0x33a1cb){return _0x33a1cb[_0xa039('0x23')](_0x47b923)[_0xa039('0x10')](function(_0x206e01){return _0x206e01;});}return null;};}function removeEntity(_0x4a46f7,_0x1b1d30){return function(_0x2fdf02){if(_0x2fdf02){return _0x2fdf02[_0xa039('0x24')]()[_0xa039('0x10')](function(){_0x4a46f7[_0xa039('0x1a')](0xcc)[_0xa039('0x25')]();});}};}function handleEntityNotFound(_0x560a75,_0x4f59f6){return function(_0x438da7){if(!_0x438da7){_0x560a75[_0xa039('0x26')](0x194);}return _0x438da7;};}function handleError(_0x112d35,_0x48a1ee){_0x48a1ee=_0x48a1ee||0x1f4;return function(_0x2c1355){logger[_0xa039('0x16')](_0x2c1355[_0xa039('0x27')]);if(_0x2c1355[_0xa039('0x28')]){delete _0x2c1355[_0xa039('0x28')];}_0x112d35[_0xa039('0x1a')](_0x48a1ee)[_0xa039('0x29')](_0x2c1355);};}exports[_0xa039('0x2a')]=function(_0x4038f7,_0x18fd59){var _0x5aa6fb={},_0x4cfc5f={},_0x32da30={'count':0x0,'rows':[]};var _0x4240d4=db[_0xa039('0x2b')]['rawAttributes'];_0x4cfc5f['model']=_[_0xa039('0x2c')](_0x4240d4);var _0x213203={'dateStart':_0x4038f7[_0xa039('0x2d')]['dateStart'],'dateEnd':_0x4038f7[_0xa039('0x2d')][_0xa039('0x2e')]};delete _0x4038f7[_0xa039('0x2d')][_0xa039('0x2f')];delete _0x4038f7[_0xa039('0x2d')][_0xa039('0x2e')];_0x4cfc5f[_0xa039('0x2d')]=_[_0xa039('0x2c')](_0x4038f7['query']);_0x4cfc5f[_0xa039('0x30')]=_['intersection'](_0x4cfc5f[_0xa039('0x31')],_0x4cfc5f[_0xa039('0x2d')]);_0x5aa6fb[_0xa039('0x32')]=_[_0xa039('0x33')](_0x4cfc5f[_0xa039('0x31')],qs['fields'](_0x4038f7['query'][_0xa039('0x34')]));_0x5aa6fb[_0xa039('0x32')]=_0x5aa6fb['attributes'][_0xa039('0x35')]?_0x5aa6fb['attributes']:_0x4cfc5f[_0xa039('0x31')];if(!_0x4038f7[_0xa039('0x2d')]['hasOwnProperty']('nolimit')){_0x5aa6fb[_0xa039('0x1d')]=qs[_0xa039('0x1d')](_0x4038f7[_0xa039('0x2d')][_0xa039('0x1d')]);_0x5aa6fb[_0xa039('0x1c')]=qs[_0xa039('0x1c')](_0x4038f7['query'][_0xa039('0x1c')]);}_0x5aa6fb[_0xa039('0x36')]=qs['sort'](_0x4038f7[_0xa039('0x2d')]['sort']);_0x5aa6fb[_0xa039('0x37')]=qs['filters'](_[_0xa039('0x38')](_0x4038f7[_0xa039('0x2d')],_0x4cfc5f[_0xa039('0x30')]));if(_0x213203[_0xa039('0x2f')]){if(_0x213203[_0xa039('0x2e')]){_0x213203[_0xa039('0x2e')]=moment(_0x213203['dateEnd'])[_0xa039('0x39')](0x1,_0xa039('0x3a'));}else{_0x213203['dateEnd']=moment(_0x213203[_0xa039('0x2f')])[_0xa039('0x39')](0x1,_0xa039('0x3a'));}_[_0xa039('0x3b')](_0x5aa6fb['where'],{'createdAt':{'$gte':_0x213203[_0xa039('0x2f')],'$lte':_0x213203[_0xa039('0x2e')]}});}if(_0x4038f7['query'][_0xa039('0x3c')]){_0x5aa6fb[_0xa039('0x37')]=_[_0xa039('0x3b')](_0x5aa6fb[_0xa039('0x37')],{'$or':_['map'](_0x5aa6fb[_0xa039('0x32')],function(_0x56d746){var _0x41eabf={};_0x41eabf[_0x56d746]={'$like':'%'+_0x4038f7['query']['filter']+'%'};return _0x41eabf;})});}_0x5aa6fb=_[_0xa039('0x3b')]({},_0x5aa6fb,_0x4038f7['options']);var _0xfb6d70={'where':_0x5aa6fb[_0xa039('0x37')]};return db[_0xa039('0x2b')]['count'](_0xfb6d70)[_0xa039('0x10')](function(_0x5f0f8b){_0x32da30[_0xa039('0x3d')]=_0x5f0f8b;if(_0x4038f7['query'][_0xa039('0x3e')]){_0x5aa6fb['include']=[{'all':!![]}];}return db[_0xa039('0x2b')][_0xa039('0x3f')](_0x5aa6fb);})[_0xa039('0x10')](function(_0x84bbc7){_0x32da30[_0xa039('0x40')]=_0x84bbc7;return _0x32da30;})[_0xa039('0x10')](respondWithFilteredResult(_0x18fd59,_0x5aa6fb))[_0xa039('0x19')](handleError(_0x18fd59,null));};exports[_0xa039('0x41')]=function(_0x1e99c8,_0x16f396){var _0x19d688={'raw':![],'where':{'id':_0x1e99c8[_0xa039('0x42')]['id']}},_0x4db92f={};_0x4db92f[_0xa039('0x31')]=_['keys'](db['FreshdeskAccount'][_0xa039('0x43')]);_0x4db92f[_0xa039('0x2d')]=_['keys'](_0x1e99c8[_0xa039('0x2d')]);_0x4db92f[_0xa039('0x30')]=_[_0xa039('0x33')](_0x4db92f[_0xa039('0x31')],_0x4db92f[_0xa039('0x2d')]);_0x19d688[_0xa039('0x32')]=_[_0xa039('0x33')](_0x4db92f['model'],qs[_0xa039('0x34')](_0x1e99c8[_0xa039('0x2d')][_0xa039('0x34')]));_0x19d688[_0xa039('0x32')]=_0x19d688[_0xa039('0x32')][_0xa039('0x35')]?_0x19d688[_0xa039('0x32')]:_0x4db92f[_0xa039('0x31')];if(_0x1e99c8[_0xa039('0x2d')]['includeAll']){_0x19d688[_0xa039('0x44')]=[{'all':!![]}];}_0x19d688=_[_0xa039('0x3b')]({},_0x19d688,_0x1e99c8['options']);return db[_0xa039('0x2b')][_0xa039('0x45')](_0x19d688)[_0xa039('0x10')](handleEntityNotFound(_0x16f396,null))[_0xa039('0x10')](respondWithResult(_0x16f396,null))[_0xa039('0x19')](handleError(_0x16f396,null));};exports[_0xa039('0x46')]=function(_0x432727,_0xfd6dd8){return db[_0xa039('0x2b')][_0xa039('0x46')](_0x432727['body'],{})['then'](respondWithResult(_0xfd6dd8,0xc9))[_0xa039('0x19')](handleError(_0xfd6dd8,null));};exports[_0xa039('0x23')]=function(_0x3d9f2c,_0x5cefc3){if(_0x3d9f2c[_0xa039('0x47')]['id']){delete _0x3d9f2c[_0xa039('0x47')]['id'];}return db['FreshdeskAccount'][_0xa039('0x45')]({'where':{'id':_0x3d9f2c[_0xa039('0x42')]['id']}})['then'](handleEntityNotFound(_0x5cefc3,null))[_0xa039('0x10')](saveUpdates(_0x3d9f2c['body'],null))[_0xa039('0x10')](respondWithResult(_0x5cefc3,null))[_0xa039('0x19')](handleError(_0x5cefc3,null));};exports[_0xa039('0x24')]=function(_0x4445e0,_0x24823e){return db[_0xa039('0x2b')]['find']({'where':{'id':_0x4445e0[_0xa039('0x42')]['id']}})[_0xa039('0x10')](handleEntityNotFound(_0x24823e,null))['then'](removeEntity(_0x24823e,null))[_0xa039('0x19')](handleError(_0x24823e,null));};exports['getConfigurations']=function(_0x3e1798,_0xe4d701,_0xcef48e){var _0x1eb59a={};var _0x4e6f45={};var _0x47b615;var _0x5e61a4;return db[_0xa039('0x2b')][_0xa039('0x48')]({'where':{'id':_0x3e1798[_0xa039('0x42')]['id']}})[_0xa039('0x10')](handleEntityNotFound(_0xe4d701,null))['then'](function(_0x4d432e){if(_0x4d432e){_0x47b615=_0x4d432e;_0x4e6f45[_0xa039('0x31')]=_[_0xa039('0x2c')](db['FreshdeskConfiguration'][_0xa039('0x43')]);_0x4e6f45[_0xa039('0x2d')]=_['keys'](_0x3e1798[_0xa039('0x2d')]);_0x4e6f45[_0xa039('0x30')]=_[_0xa039('0x33')](_0x4e6f45[_0xa039('0x31')],_0x4e6f45[_0xa039('0x2d')]);_0x1eb59a[_0xa039('0x32')]=_[_0xa039('0x33')](_0x4e6f45[_0xa039('0x31')],qs[_0xa039('0x34')](_0x3e1798['query']['fields']));_0x1eb59a[_0xa039('0x32')]=_0x1eb59a[_0xa039('0x32')]['length']?_0x1eb59a['attributes']:_0x4e6f45[_0xa039('0x31')];_0x1eb59a[_0xa039('0x36')]=qs['sort'](_0x3e1798['query'][_0xa039('0x49')]);_0x1eb59a[_0xa039('0x37')]=qs[_0xa039('0x30')](_['pick'](_0x3e1798[_0xa039('0x2d')],_0x4e6f45[_0xa039('0x30')]));if(_0x3e1798[_0xa039('0x2d')][_0xa039('0x3c')]){_0x1eb59a[_0xa039('0x37')]=_[_0xa039('0x3b')](_0x1eb59a[_0xa039('0x37')],{'$or':_[_0xa039('0x4a')](_0x1eb59a[_0xa039('0x32')],function(_0x5d3184){var _0x9d8a94={};_0x9d8a94[_0x5d3184]={'$like':'%'+_0x3e1798[_0xa039('0x2d')][_0xa039('0x3c')]+'%'};return _0x9d8a94;})});}_0x1eb59a=_[_0xa039('0x3b')]({},_0x1eb59a,_0x3e1798['options']);return _0x47b615['getConfigurations'](_0x1eb59a);}})[_0xa039('0x10')](function(_0x3d8809){if(_0x3d8809){_0x5e61a4=_0x3d8809[_0xa039('0x35')];if(!_0x3e1798[_0xa039('0x2d')][_0xa039('0x4b')]('nolimit')){_0x1eb59a[_0xa039('0x1d')]=qs[_0xa039('0x1d')](_0x3e1798[_0xa039('0x2d')][_0xa039('0x1d')]);_0x1eb59a[_0xa039('0x1c')]=qs[_0xa039('0x1c')](_0x3e1798['query'][_0xa039('0x1c')]);}return _0x47b615[_0xa039('0x4c')](_0x1eb59a);}})[_0xa039('0x10')](function(_0x435ad8){if(_0x435ad8){return _0x435ad8?{'count':_0x5e61a4,'rows':_0x435ad8}:null;}})['then'](respondWithResult(_0xe4d701,null))[_0xa039('0x19')](handleError(_0xe4d701,null));};exports['addConfiguration']=function(_0xf0c655,_0x543acc,_0x577bca){if(_0xf0c655[_0xa039('0x47')]['id']){delete _0xf0c655[_0xa039('0x47')]['id'];}return db[_0xa039('0x2b')][_0xa039('0x48')]({'where':{'id':_0xf0c655[_0xa039('0x42')]['id']}})[_0xa039('0x10')](handleEntityNotFound(_0x543acc,null))['then'](function(_0x283d18){if(_0x283d18){_0xf0c655['body'][_0xa039('0x4d')]=_0x283d18['id'];_0xf0c655['body']['Subjects']=integrations['getSubjects'](_0xf0c655[_0xa039('0x47')][_0xa039('0x4e')],_0xf0c655['body'][_0xa039('0x4f')]);_0xf0c655[_0xa039('0x47')][_0xa039('0x50')]=integrations[_0xa039('0x51')](_0xf0c655[_0xa039('0x47')][_0xa039('0x4e')],_0xf0c655[_0xa039('0x47')][_0xa039('0x4f')]);return db['FreshdeskConfiguration'][_0xa039('0x46')](_0xf0c655['body'],{'include':[{'model':db[_0xa039('0x52')],'as':_0xa039('0x53')},{'model':db[_0xa039('0x52')],'as':_0xa039('0x50')}]});}return null;})[_0xa039('0x10')](respondWithResult(_0x543acc,null))[_0xa039('0x19')](handleError(_0x543acc,null));};exports[_0xa039('0x54')]=function(_0x5229f2,_0x577568,_0x379b59){return db[_0xa039('0x2b')]['findOne']({'where':{'id':_0x5229f2['params']['id']},'attributes':['id',_0xa039('0x55'),_0xa039('0x56')]})['then'](handleEntityNotFound(_0x577568,null))[_0xa039('0x10')](function(_0xb174a0){if(_0xb174a0){return rp({'method':_0xa039('0x57'),'uri':util['format']('%s%s',_0xb174a0[_0xa039('0x55')],_0xa039('0x58')),'headers':{'Authorization':util[_0xa039('0x59')](_0xa039('0x5a'),new Buffer(util[_0xa039('0x59')](_0xa039('0x5b'),_0xb174a0[_0xa039('0x56')]))[_0xa039('0x5c')](_0xa039('0x5d')))},'json':!![]});}})[_0xa039('0x10')](function(_0x292b11){if(_0x292b11){var _0x3d900e=[_0xa039('0x5e'),_0xa039('0x5f'),_0xa039('0x60'),_0xa039('0x61'),'status',_0xa039('0x62'),'group',_0xa039('0x63'),'ticket_type',_0xa039('0x64'),_0xa039('0x65')];_[_0xa039('0x66')](_0x292b11,function(_0x5453cd){return _0x3d900e[_0xa039('0x67')](_0x5453cd[_0xa039('0x28')])||!_0x5453cd[_0xa039('0x68')]&&_0x5453cd['type']!==_0xa039('0x69');});return{'count':_0x292b11[_0xa039('0x35')],'rows':_[_0xa039('0x4a')](_0x292b11,function(_0x44f6e4){return{'id':_0x44f6e4[_0xa039('0x28')],'name':_0x44f6e4[_0xa039('0x6a')],'custom':!_0x44f6e4[_0xa039('0x68')],'options':_0x44f6e4['choices']?_[_0xa039('0x4a')](_0x44f6e4[_0xa039('0x6b')],function(_0x1e0ace){return{'name':_[_0xa039('0x6c')](_0x1e0ace),'value':_0x1e0ace};}):[]};})};}})[_0xa039('0x10')](respondWithResult(_0x577568,null))[_0xa039('0x19')](function(_0x25d34e){var _0x17fa65=_0x5229f2[_0xa039('0x2d')][_0xa039('0x6d')]?0x1f4:_0x25d34e[_0xa039('0x6e')]||0x1f4;logger[_0xa039('0x16')](_0xa039('0x6f'),_0xa039('0x54'),_0x17fa65,JSON[_0xa039('0x15')](_0x25d34e));delete _0x25d34e['name'];if(_0x17fa65===0x191){_0x17fa65=0x190;}_0x577568[_0xa039('0x1a')](_0x17fa65)[_0xa039('0x29')](_0x5229f2[_0xa039('0x2d')][_0xa039('0x6d')]?{'message':_0xa039('0x70'),'statusCode':_0x25d34e[_0xa039('0x6e')]}:_0x25d34e);});}; \ No newline at end of file +var _0xe7e8=['Descriptions','FreshdeskField','getFields','apiKey','GET','%s%s','remoteUri','Basic\x20%s','%s:X','toString','base64','requester','agent','description','priority','group','source','ticket_type','company','remove','default','custom_text','label','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/integrations/configuration','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','catch','status','end','json','offset','limit','set','reject','save','update','sendStatus','stack','name','send','index','FreshdeskAccount','rawAttributes','keys','dateStart','query','dateEnd','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','map','filter','options','count','includeAll','include','params','create','body','destroy','find','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','channel','type'];(function(_0x27aab6,_0xabe76d){var _0x76dfd5=function(_0x3947ce){while(--_0x3947ce){_0x27aab6['push'](_0x27aab6['shift']());}};_0x76dfd5(++_0xabe76d);}(_0xe7e8,0x155));var _0x8e7e=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0xe7e8[_0x1d87fc];return _0x492b56;};'use strict';var jsonpatch=require(_0x8e7e('0x0'));var rp=require(_0x8e7e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8e7e('0x2'));var util=require(_0x8e7e('0x3'));var path=require('path');var sox=require(_0x8e7e('0x4'));var csv=require(_0x8e7e('0x5'));var ejs=require(_0x8e7e('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8e7e('0x7'));var crypto=require('crypto');var jsforce=require(_0x8e7e('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8e7e('0x9'));var Papa=require(_0x8e7e('0xa'));var qs=require(_0x8e7e('0xb'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x8e7e('0xc'));var jayson=require(_0x8e7e('0xd'));var client=jayson['client'][_0x8e7e('0xe')]({'port':0x232a});function respondWithRpcPromise(_0x1e6370,_0x312770,_0x4c697d,_0x113ccd){return new BPromise(function(_0x20db6d,_0x156da1){var _0x3ec0c3=_0x113ccd||client;return _0x3ec0c3[_0x8e7e('0xf')](_0x1e6370,_0x4c697d)[_0x8e7e('0x10')](function(_0x46be12){logger[_0x8e7e('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x312770,_0x8e7e('0x12'));logger[_0x8e7e('0x13')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x312770,_0x8e7e('0x12'),JSON[_0x8e7e('0x14')](_0x46be12));if(_0x46be12[_0x8e7e('0x15')]){if(_0x46be12[_0x8e7e('0x15')]['code']===0x1f4){logger[_0x8e7e('0x15')](_0x8e7e('0x16'),_0x312770,_0x46be12[_0x8e7e('0x15')][_0x8e7e('0x17')]);return _0x156da1(_0x46be12[_0x8e7e('0x15')][_0x8e7e('0x17')]);}logger[_0x8e7e('0x15')]('FreshdeskAccount,\x20%s,\x20%s',_0x312770,_0x46be12[_0x8e7e('0x15')]['message']);return _0x20db6d(_0x46be12[_0x8e7e('0x15')][_0x8e7e('0x17')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x312770,_0x8e7e('0x12'));_0x20db6d(_0x46be12['result'][_0x8e7e('0x17')]);}})[_0x8e7e('0x18')](function(_0x391f95){logger[_0x8e7e('0x15')](_0x8e7e('0x16'),_0x312770,_0x391f95);_0x156da1(_0x391f95);});});}function respondWithStatusCode(_0x3f72cc,_0x37e589){_0x37e589=_0x37e589||0xcc;return function(_0x22847d){if(_0x22847d){return _0x3f72cc['sendStatus'](_0x37e589);}return _0x3f72cc[_0x8e7e('0x19')](_0x37e589)[_0x8e7e('0x1a')]();};}function respondWithResult(_0x45a89b,_0x20506f){_0x20506f=_0x20506f||0xc8;return function(_0x323f3a){if(_0x323f3a){return _0x45a89b['status'](_0x20506f)[_0x8e7e('0x1b')](_0x323f3a);}};}function respondWithFilteredResult(_0x452eeb,_0x5ac754){return function(_0x4df2cd){if(_0x4df2cd){var _0x3a24e8=_0x4df2cd['count'],_0x7ae953=_0x5ac754[_0x8e7e('0x1c')],_0x211036=_0x5ac754[_0x8e7e('0x1c')]+_0x5ac754[_0x8e7e('0x1d')],_0x1798f5;if(_0x211036>=_0x3a24e8){_0x211036=_0x3a24e8;_0x1798f5=0xc8;}else{_0x1798f5=0xce;}_0x452eeb['status'](_0x1798f5);return _0x452eeb[_0x8e7e('0x1e')]('Content-Range',_0x7ae953+'-'+_0x211036+'/'+_0x3a24e8)[_0x8e7e('0x1b')](_0x4df2cd);}return null;};}function patchUpdates(_0x365661){return function(_0x4f4f62){try{jsonpatch['apply'](_0x4f4f62,_0x365661,!![]);}catch(_0x1ac9bb){return BPromise[_0x8e7e('0x1f')](_0x1ac9bb);}return _0x4f4f62[_0x8e7e('0x20')]();};}function saveUpdates(_0x56d20c,_0x592d1b){return function(_0xda51be){if(_0xda51be){return _0xda51be[_0x8e7e('0x21')](_0x56d20c)['then'](function(_0x665907){return _0x665907;});}return null;};}function removeEntity(_0x50fd69,_0x12db06){return function(_0x180ebc){if(_0x180ebc){return _0x180ebc['destroy']()[_0x8e7e('0x10')](function(){_0x50fd69['status'](0xcc)[_0x8e7e('0x1a')]();});}};}function handleEntityNotFound(_0xa6b151,_0x5becfc){return function(_0x42b827){if(!_0x42b827){_0xa6b151[_0x8e7e('0x22')](0x194);}return _0x42b827;};}function handleError(_0x1e7e5e,_0x2c7926){_0x2c7926=_0x2c7926||0x1f4;return function(_0x2981cf){logger[_0x8e7e('0x15')](_0x2981cf[_0x8e7e('0x23')]);if(_0x2981cf[_0x8e7e('0x24')]){delete _0x2981cf[_0x8e7e('0x24')];}_0x1e7e5e['status'](_0x2c7926)[_0x8e7e('0x25')](_0x2981cf);};}exports[_0x8e7e('0x26')]=function(_0x1ee469,_0x36f74c){var _0x231bfd={},_0x998e8b={},_0x64cfa2={'count':0x0,'rows':[]};var _0x316054=db[_0x8e7e('0x27')][_0x8e7e('0x28')];_0x998e8b['model']=_[_0x8e7e('0x29')](_0x316054);var _0x1f9ccc={'dateStart':_0x1ee469['query'][_0x8e7e('0x2a')],'dateEnd':_0x1ee469[_0x8e7e('0x2b')][_0x8e7e('0x2c')]};delete _0x1ee469['query'][_0x8e7e('0x2a')];delete _0x1ee469['query'][_0x8e7e('0x2c')];_0x998e8b[_0x8e7e('0x2b')]=_[_0x8e7e('0x29')](_0x1ee469[_0x8e7e('0x2b')]);_0x998e8b[_0x8e7e('0x2d')]=_[_0x8e7e('0x2e')](_0x998e8b[_0x8e7e('0x2f')],_0x998e8b[_0x8e7e('0x2b')]);_0x231bfd['attributes']=_['intersection'](_0x998e8b[_0x8e7e('0x2f')],qs[_0x8e7e('0x30')](_0x1ee469[_0x8e7e('0x2b')][_0x8e7e('0x30')]));_0x231bfd['attributes']=_0x231bfd[_0x8e7e('0x31')][_0x8e7e('0x32')]?_0x231bfd[_0x8e7e('0x31')]:_0x998e8b[_0x8e7e('0x2f')];if(!_0x1ee469[_0x8e7e('0x2b')][_0x8e7e('0x33')](_0x8e7e('0x34'))){_0x231bfd['limit']=qs[_0x8e7e('0x1d')](_0x1ee469['query'][_0x8e7e('0x1d')]);_0x231bfd['offset']=qs[_0x8e7e('0x1c')](_0x1ee469[_0x8e7e('0x2b')][_0x8e7e('0x1c')]);}_0x231bfd[_0x8e7e('0x35')]=qs[_0x8e7e('0x36')](_0x1ee469['query']['sort']);_0x231bfd[_0x8e7e('0x37')]=qs[_0x8e7e('0x2d')](_[_0x8e7e('0x38')](_0x1ee469[_0x8e7e('0x2b')],_0x998e8b[_0x8e7e('0x2d')]));if(_0x1f9ccc[_0x8e7e('0x2a')]){if(_0x1f9ccc[_0x8e7e('0x2c')]){_0x1f9ccc['dateEnd']=moment(_0x1f9ccc[_0x8e7e('0x2c')])[_0x8e7e('0x39')](0x1,'day');}else{_0x1f9ccc[_0x8e7e('0x2c')]=moment(_0x1f9ccc[_0x8e7e('0x2a')])[_0x8e7e('0x39')](0x1,_0x8e7e('0x3a'));}_[_0x8e7e('0x3b')](_0x231bfd[_0x8e7e('0x37')],{'createdAt':{'$gte':_0x1f9ccc[_0x8e7e('0x2a')],'$lte':_0x1f9ccc[_0x8e7e('0x2c')]}});}if(_0x1ee469[_0x8e7e('0x2b')]['filter']){_0x231bfd[_0x8e7e('0x37')]=_[_0x8e7e('0x3b')](_0x231bfd[_0x8e7e('0x37')],{'$or':_[_0x8e7e('0x3c')](_0x231bfd[_0x8e7e('0x31')],function(_0x3a1365){var _0x2ee3fa={};_0x2ee3fa[_0x3a1365]={'$like':'%'+_0x1ee469[_0x8e7e('0x2b')][_0x8e7e('0x3d')]+'%'};return _0x2ee3fa;})});}_0x231bfd=_[_0x8e7e('0x3b')]({},_0x231bfd,_0x1ee469[_0x8e7e('0x3e')]);var _0x32e10a={'where':_0x231bfd[_0x8e7e('0x37')]};return db[_0x8e7e('0x27')][_0x8e7e('0x3f')](_0x32e10a)[_0x8e7e('0x10')](function(_0x440983){_0x64cfa2[_0x8e7e('0x3f')]=_0x440983;if(_0x1ee469[_0x8e7e('0x2b')][_0x8e7e('0x40')]){_0x231bfd[_0x8e7e('0x41')]=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x231bfd);})[_0x8e7e('0x10')](function(_0x3e2c21){_0x64cfa2['rows']=_0x3e2c21;return _0x64cfa2;})[_0x8e7e('0x10')](respondWithFilteredResult(_0x36f74c,_0x231bfd))['catch'](handleError(_0x36f74c,null));};exports['show']=function(_0x57df68,_0x5a6ab0){var _0x3f078b={'raw':![],'where':{'id':_0x57df68[_0x8e7e('0x42')]['id']}},_0x120597={};_0x120597[_0x8e7e('0x2f')]=_[_0x8e7e('0x29')](db['FreshdeskAccount'][_0x8e7e('0x28')]);_0x120597[_0x8e7e('0x2b')]=_[_0x8e7e('0x29')](_0x57df68[_0x8e7e('0x2b')]);_0x120597[_0x8e7e('0x2d')]=_[_0x8e7e('0x2e')](_0x120597[_0x8e7e('0x2f')],_0x120597[_0x8e7e('0x2b')]);_0x3f078b[_0x8e7e('0x31')]=_[_0x8e7e('0x2e')](_0x120597['model'],qs[_0x8e7e('0x30')](_0x57df68[_0x8e7e('0x2b')][_0x8e7e('0x30')]));_0x3f078b[_0x8e7e('0x31')]=_0x3f078b[_0x8e7e('0x31')][_0x8e7e('0x32')]?_0x3f078b[_0x8e7e('0x31')]:_0x120597[_0x8e7e('0x2f')];if(_0x57df68[_0x8e7e('0x2b')][_0x8e7e('0x40')]){_0x3f078b[_0x8e7e('0x41')]=[{'all':!![]}];}_0x3f078b=_[_0x8e7e('0x3b')]({},_0x3f078b,_0x57df68[_0x8e7e('0x3e')]);return db[_0x8e7e('0x27')]['find'](_0x3f078b)['then'](handleEntityNotFound(_0x5a6ab0,null))[_0x8e7e('0x10')](respondWithResult(_0x5a6ab0,null))[_0x8e7e('0x18')](handleError(_0x5a6ab0,null));};exports[_0x8e7e('0x43')]=function(_0x217f8c,_0x228db3){return db['FreshdeskAccount'][_0x8e7e('0x43')](_0x217f8c['body'],{})[_0x8e7e('0x10')](respondWithResult(_0x228db3,0xc9))[_0x8e7e('0x18')](handleError(_0x228db3,null));};exports[_0x8e7e('0x21')]=function(_0x22a38c,_0x3f764e){if(_0x22a38c[_0x8e7e('0x44')]['id']){delete _0x22a38c['body']['id'];}return db[_0x8e7e('0x27')]['find']({'where':{'id':_0x22a38c['params']['id']}})[_0x8e7e('0x10')](handleEntityNotFound(_0x3f764e,null))[_0x8e7e('0x10')](saveUpdates(_0x22a38c[_0x8e7e('0x44')],null))['then'](respondWithResult(_0x3f764e,null))['catch'](handleError(_0x3f764e,null));};exports[_0x8e7e('0x45')]=function(_0x1d61c0,_0x20c839){return db[_0x8e7e('0x27')][_0x8e7e('0x46')]({'where':{'id':_0x1d61c0[_0x8e7e('0x42')]['id']}})[_0x8e7e('0x10')](handleEntityNotFound(_0x20c839,null))['then'](removeEntity(_0x20c839,null))[_0x8e7e('0x18')](handleError(_0x20c839,null));};exports[_0x8e7e('0x47')]=function(_0x15f033,_0x40aa23,_0x5a117a){var _0xacdafa={};var _0x5b2718={};var _0x214584;var _0x2629cb;return db['FreshdeskAccount'][_0x8e7e('0x48')]({'where':{'id':_0x15f033[_0x8e7e('0x42')]['id']}})[_0x8e7e('0x10')](handleEntityNotFound(_0x40aa23,null))[_0x8e7e('0x10')](function(_0x551bcf){if(_0x551bcf){_0x214584=_0x551bcf;_0x5b2718[_0x8e7e('0x2f')]=_['keys'](db[_0x8e7e('0x49')][_0x8e7e('0x28')]);_0x5b2718[_0x8e7e('0x2b')]=_[_0x8e7e('0x29')](_0x15f033[_0x8e7e('0x2b')]);_0x5b2718[_0x8e7e('0x2d')]=_[_0x8e7e('0x2e')](_0x5b2718[_0x8e7e('0x2f')],_0x5b2718[_0x8e7e('0x2b')]);_0xacdafa['attributes']=_[_0x8e7e('0x2e')](_0x5b2718['model'],qs[_0x8e7e('0x30')](_0x15f033[_0x8e7e('0x2b')]['fields']));_0xacdafa['attributes']=_0xacdafa[_0x8e7e('0x31')][_0x8e7e('0x32')]?_0xacdafa[_0x8e7e('0x31')]:_0x5b2718['model'];_0xacdafa[_0x8e7e('0x35')]=qs['sort'](_0x15f033[_0x8e7e('0x2b')]['sort']);_0xacdafa[_0x8e7e('0x37')]=qs[_0x8e7e('0x2d')](_[_0x8e7e('0x38')](_0x15f033[_0x8e7e('0x2b')],_0x5b2718['filters']));if(_0x15f033[_0x8e7e('0x2b')]['filter']){_0xacdafa[_0x8e7e('0x37')]=_[_0x8e7e('0x3b')](_0xacdafa[_0x8e7e('0x37')],{'$or':_[_0x8e7e('0x3c')](_0xacdafa[_0x8e7e('0x31')],function(_0x2aa8e5){var _0x5e18ae={};_0x5e18ae[_0x2aa8e5]={'$like':'%'+_0x15f033[_0x8e7e('0x2b')]['filter']+'%'};return _0x5e18ae;})});}_0xacdafa=_['merge']({},_0xacdafa,_0x15f033[_0x8e7e('0x3e')]);return _0x214584['getConfigurations'](_0xacdafa);}})[_0x8e7e('0x10')](function(_0x2e352b){if(_0x2e352b){_0x2629cb=_0x2e352b['length'];if(!_0x15f033[_0x8e7e('0x2b')][_0x8e7e('0x33')](_0x8e7e('0x34'))){_0xacdafa[_0x8e7e('0x1d')]=qs['limit'](_0x15f033[_0x8e7e('0x2b')][_0x8e7e('0x1d')]);_0xacdafa[_0x8e7e('0x1c')]=qs[_0x8e7e('0x1c')](_0x15f033['query']['offset']);}return _0x214584[_0x8e7e('0x47')](_0xacdafa);}})[_0x8e7e('0x10')](function(_0x21beaa){if(_0x21beaa){return _0x21beaa?{'count':_0x2629cb,'rows':_0x21beaa}:null;}})[_0x8e7e('0x10')](respondWithResult(_0x40aa23,null))[_0x8e7e('0x18')](handleError(_0x40aa23,null));};exports[_0x8e7e('0x4a')]=function(_0x101767,_0x361cc2,_0x424928){if(_0x101767[_0x8e7e('0x44')]['id']){delete _0x101767[_0x8e7e('0x44')]['id'];}return db['FreshdeskAccount'][_0x8e7e('0x48')]({'where':{'id':_0x101767['params']['id']}})[_0x8e7e('0x10')](handleEntityNotFound(_0x361cc2,null))[_0x8e7e('0x10')](function(_0x3b85d1){if(_0x3b85d1){_0x101767['body'][_0x8e7e('0x4b')]=_0x3b85d1['id'];_0x101767[_0x8e7e('0x44')][_0x8e7e('0x4c')]=integrations['getSubjects'](_0x101767['body'][_0x8e7e('0x4d')],_0x101767[_0x8e7e('0x44')][_0x8e7e('0x4e')]);_0x101767['body'][_0x8e7e('0x4f')]=integrations['getDescriptions'](_0x101767['body'][_0x8e7e('0x4d')],_0x101767[_0x8e7e('0x44')][_0x8e7e('0x4e')]);return db['FreshdeskConfiguration'][_0x8e7e('0x43')](_0x101767[_0x8e7e('0x44')],{'include':[{'model':db['FreshdeskField'],'as':_0x8e7e('0x4c')},{'model':db[_0x8e7e('0x50')],'as':'Descriptions'}]});}return null;})[_0x8e7e('0x10')](respondWithResult(_0x361cc2,null))[_0x8e7e('0x18')](handleError(_0x361cc2,null));};exports[_0x8e7e('0x51')]=function(_0x493726,_0x48a055,_0x3b3ab2){return db[_0x8e7e('0x27')][_0x8e7e('0x48')]({'where':{'id':_0x493726[_0x8e7e('0x42')]['id']},'attributes':['id','remoteUri',_0x8e7e('0x52')]})[_0x8e7e('0x10')](handleEntityNotFound(_0x48a055,null))[_0x8e7e('0x10')](function(_0x2eae7c){if(_0x2eae7c){return rp({'method':_0x8e7e('0x53'),'uri':util['format'](_0x8e7e('0x54'),_0x2eae7c[_0x8e7e('0x55')],'api/v2/ticket_fields'),'headers':{'Authorization':util['format'](_0x8e7e('0x56'),new Buffer(util['format'](_0x8e7e('0x57'),_0x2eae7c['apiKey']))[_0x8e7e('0x58')](_0x8e7e('0x59')))},'json':!![]});}})[_0x8e7e('0x10')](function(_0x40c10a){if(_0x40c10a){var _0x195ae2=[_0x8e7e('0x5a'),'subject',_0x8e7e('0x5b'),_0x8e7e('0x5c'),_0x8e7e('0x19'),_0x8e7e('0x5d'),_0x8e7e('0x5e'),_0x8e7e('0x5f'),_0x8e7e('0x60'),_0x8e7e('0x5e'),_0x8e7e('0x61')];_[_0x8e7e('0x62')](_0x40c10a,function(_0x1b35b8){return _0x195ae2['includes'](_0x1b35b8['name'])||!_0x1b35b8[_0x8e7e('0x63')]&&_0x1b35b8[_0x8e7e('0x4e')]!==_0x8e7e('0x64');});return{'count':_0x40c10a['length'],'rows':_[_0x8e7e('0x3c')](_0x40c10a,function(_0x3a6080){return{'id':_0x3a6080[_0x8e7e('0x24')],'name':_0x3a6080[_0x8e7e('0x65')],'custom':!_0x3a6080[_0x8e7e('0x63')],'options':_0x3a6080['choices']?_['map'](_0x3a6080['choices'],function(_0x13c7af){return{'name':_[_0x8e7e('0x66')](_0x13c7af),'value':_0x13c7af};}):[]};})};}})[_0x8e7e('0x10')](respondWithResult(_0x48a055,null))[_0x8e7e('0x18')](function(_0x5c76ce){var _0x2e97bf=_0x493726['query'][_0x8e7e('0x67')]?0x1f4:_0x5c76ce['statusCode']||0x1f4;logger['error'](_0x8e7e('0x68'),_0x8e7e('0x51'),_0x2e97bf,JSON['stringify'](_0x5c76ce));delete _0x5c76ce[_0x8e7e('0x24')];if(_0x2e97bf===0x191){_0x2e97bf=0x190;}_0x48a055[_0x8e7e('0x19')](_0x2e97bf)[_0x8e7e('0x25')](_0x493726['query'][_0x8e7e('0x67')]?{'message':'Wrong\x20credentials','statusCode':_0x5c76ce['statusCode']}:_0x5c76ce);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 86e75a9..8c4a899 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 _0x0624=['moment','bluebird','request-promise','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x5df332,_0x261dbe){var _0x42dc78=function(_0xb5f83b){while(--_0xb5f83b){_0x5df332['push'](_0x5df332['shift']());}};_0x42dc78(++_0x261dbe);}(_0x0624,0x132));var _0x4062=function(_0x49f69c,_0x5d4ff6){_0x49f69c=_0x49f69c-0x0;var _0x2c3029=_0x0624[_0x49f69c];return _0x2c3029;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4062('0x0'));var BPromise=require(_0x4062('0x1'));var rp=require(_0x4062('0x2'));var attributes=require(_0x4062('0x3'));var integrations=require(_0x4062('0x4'));module[_0x4062('0x5')]=function(_0x4bb157,_0x553d08){return _0x4bb157[_0x4062('0x6')](_0x4062('0x7'),attributes,{'tableName':_0x4062('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba30=['moment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger'];(function(_0x1098db,_0x39ba6b){var _0x14f090=function(_0x473ffe){while(--_0x473ffe){_0x1098db['push'](_0x1098db['shift']());}};_0x14f090(++_0x39ba6b);}(_0xba30,0xf0));var _0x0ba3=function(_0x36921f,_0x3d8888){_0x36921f=_0x36921f-0x0;var _0x2a20bb=_0xba30[_0x36921f];return _0x2a20bb;};'use strict';var _=require(_0x0ba3('0x0'));var util=require(_0x0ba3('0x1'));var logger=require(_0x0ba3('0x2'))('api');var moment=require(_0x0ba3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x0ba3('0x4'));var integrations=require(_0x0ba3('0x5'));module['exports']=function(_0xa28ed1,_0x1a905a){return _0xa28ed1[_0x0ba3('0x6')](_0x0ba3('0x7'),attributes,{'tableName':_0x0ba3('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 37c7cec..78bec1f 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 _0x689b=['result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetFreshdeskAccount','ShowFreshdeskAccount','FreshdeskAccount','find','stringify','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','error','code','FreshdeskAccount,\x20%s,\x20%s','message'];(function(_0x56fb02,_0x179d7a){var _0x177f5b=function(_0x47e149){while(--_0x47e149){_0x56fb02['push'](_0x56fb02['shift']());}};_0x177f5b(++_0x179d7a);}(_0x689b,0x142));var _0xb689=function(_0x443ed0,_0x532284){_0x443ed0=_0x443ed0-0x0;var _0x4425d1=_0x689b[_0x443ed0];return _0x4425d1;};'use strict';var _=require(_0xb689('0x0'));var util=require('util');var moment=require(_0xb689('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0xb689('0x2'))['db'];var utils=require(_0xb689('0x3'));var logger=require(_0xb689('0x4'))(_0xb689('0x5'));var config=require(_0xb689('0x6'));var jayson=require(_0xb689('0x7'));var client=jayson[_0xb689('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b9fed,_0x5ee263,_0x47752c){return new BPromise(function(_0x56c6ba,_0x6eaf58){return client[_0xb689('0x9')](_0x1b9fed,_0x47752c)[_0xb689('0xa')](function(_0x4e7c57){logger[_0xb689('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x5ee263,'request\x20sent');logger[_0xb689('0xc')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x5ee263,_0xb689('0xd'),JSON['stringify'](_0x4e7c57));if(_0x4e7c57[_0xb689('0xe')]){if(_0x4e7c57[_0xb689('0xe')][_0xb689('0xf')]===0x1f4){logger[_0xb689('0xe')](_0xb689('0x10'),_0x5ee263,_0x4e7c57[_0xb689('0xe')][_0xb689('0x11')]);return _0x6eaf58(_0x4e7c57[_0xb689('0xe')][_0xb689('0x11')]);}logger['error'](_0xb689('0x10'),_0x5ee263,_0x4e7c57[_0xb689('0xe')][_0xb689('0x11')]);return _0x56c6ba(_0x4e7c57[_0xb689('0xe')][_0xb689('0x11')]);}else{logger[_0xb689('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x5ee263,_0xb689('0xd'));_0x56c6ba(_0x4e7c57[_0xb689('0x12')]['message']);}})[_0xb689('0x13')](function(_0x51647d){logger[_0xb689('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x5ee263,_0x51647d);_0x6eaf58(_0x51647d);});});}exports['GetFreshdeskAccount']=function(_0x37ece8){var _0x143b5c=this;return new Promise(function(_0x55a414,_0x4439ef){return db['FreshdeskAccount'][_0xb689('0x14')]({'raw':_0x37ece8['options']?_0x37ece8[_0xb689('0x15')][_0xb689('0x16')]===undefined?!![]:![]:!![],'where':_0x37ece8[_0xb689('0x15')]?_0x37ece8[_0xb689('0x15')][_0xb689('0x17')]||null:null,'attributes':_0x37ece8[_0xb689('0x15')]?_0x37ece8[_0xb689('0x15')][_0xb689('0x18')]||null:null,'limit':_0x37ece8['options']?_0x37ece8[_0xb689('0x15')][_0xb689('0x19')]||null:null,'include':_0x37ece8['options']?_0x37ece8['options'][_0xb689('0x1a')]?_[_0xb689('0x1b')](_0x37ece8[_0xb689('0x15')][_0xb689('0x1a')],function(_0x2f7d0f){return{'model':db[_0x2f7d0f[_0xb689('0x1c')]],'as':_0x2f7d0f['as'],'attributes':_0x2f7d0f[_0xb689('0x18')],'include':_0x2f7d0f[_0xb689('0x1a')]?_[_0xb689('0x1b')](_0x2f7d0f[_0xb689('0x1a')],function(_0xf821f2){return{'model':db[_0xf821f2[_0xb689('0x1c')]],'as':_0xf821f2['as'],'attributes':_0xf821f2[_0xb689('0x18')],'include':_0xf821f2[_0xb689('0x1a')]?_[_0xb689('0x1b')](_0xf821f2['include'],function(_0x1d8fb4){return{'model':db[_0x1d8fb4[_0xb689('0x1c')]],'as':_0x1d8fb4['as'],'attributes':_0x1d8fb4[_0xb689('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb689('0xa')](function(_0x2dca44){logger[_0xb689('0xb')](_0xb689('0x1d'),_0x37ece8);logger[_0xb689('0xc')](_0xb689('0x1d'),_0x37ece8,JSON['stringify'](_0x2dca44));_0x55a414(_0x2dca44);})['catch'](function(_0xd73d16){logger[_0xb689('0xe')](_0xb689('0x1d'),_0xd73d16[_0xb689('0x11')],_0x37ece8);_0x4439ef(_0x143b5c[_0xb689('0xe')](0x1f4,_0xd73d16[_0xb689('0x11')]));});});};exports[_0xb689('0x1e')]=function(_0x5ef406){var _0x5bf627=this;return new Promise(function(_0x5572f5,_0x155bc2){return db[_0xb689('0x1f')][_0xb689('0x20')]({'raw':_0x5ef406[_0xb689('0x15')]?_0x5ef406[_0xb689('0x15')][_0xb689('0x16')]===undefined?!![]:![]:!![],'where':_0x5ef406['options']?_0x5ef406[_0xb689('0x15')][_0xb689('0x17')]||null:null,'attributes':_0x5ef406[_0xb689('0x15')]?_0x5ef406[_0xb689('0x15')]['attributes']||null:null,'include':_0x5ef406[_0xb689('0x15')]?_0x5ef406[_0xb689('0x15')]['include']?_[_0xb689('0x1b')](_0x5ef406[_0xb689('0x15')]['include'],function(_0x17fb7c){return{'model':db[_0x17fb7c['model']],'as':_0x17fb7c['as'],'attributes':_0x17fb7c[_0xb689('0x18')],'include':_0x17fb7c[_0xb689('0x1a')]?_[_0xb689('0x1b')](_0x17fb7c['include'],function(_0xa868f){return{'model':db[_0xa868f[_0xb689('0x1c')]],'as':_0xa868f['as'],'attributes':_0xa868f[_0xb689('0x18')],'include':_0xa868f[_0xb689('0x1a')]?_['map'](_0xa868f[_0xb689('0x1a')],function(_0x3f1d40){return{'model':db[_0x3f1d40[_0xb689('0x1c')]],'as':_0x3f1d40['as'],'attributes':_0x3f1d40[_0xb689('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54f608){logger[_0xb689('0xb')]('ShowFreshdeskAccount',_0x5ef406);logger[_0xb689('0xc')](_0xb689('0x1e'),_0x5ef406,JSON[_0xb689('0x21')](_0x54f608));_0x5572f5(_0x54f608);})[_0xb689('0x13')](function(_0x4e9896){logger[_0xb689('0xe')](_0xb689('0x1e'),_0x4e9896[_0xb689('0x11')],_0x5ef406);_0x155bc2(_0x5bf627[_0xb689('0xe')](0x1f4,_0x4e9896[_0xb689('0x11')]));});});}; \ No newline at end of file +var _0x205d=['../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','find','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x45985f,_0x36d567){var _0x37b396=function(_0x485b78){while(--_0x485b78){_0x45985f['push'](_0x45985f['shift']());}};_0x37b396(++_0x36d567);}(_0x205d,0xf6));var _0xd205=function(_0x4bb691,_0x37679a){_0x4bb691=_0x4bb691-0x0;var _0x588b53=_0x205d[_0x4bb691];return _0x588b53;};'use strict';var _=require(_0xd205('0x0'));var util=require(_0xd205('0x1'));var moment=require(_0xd205('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0xd205('0x3'))['db'];var utils=require(_0xd205('0x4'));var logger=require(_0xd205('0x5'))('rpc');var config=require(_0xd205('0x6'));var jayson=require(_0xd205('0x7'));var client=jayson[_0xd205('0x8')][_0xd205('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c078b,_0x2614e7,_0x2b6078){return new BPromise(function(_0xdb99a8,_0x372211){return client[_0xd205('0xa')](_0x4c078b,_0x2b6078)[_0xd205('0xb')](function(_0x5d60d6){logger[_0xd205('0xc')](_0xd205('0xd'),_0x2614e7,'request\x20sent');logger[_0xd205('0xe')](_0xd205('0xf'),_0x2614e7,_0xd205('0x10'),JSON[_0xd205('0x11')](_0x5d60d6));if(_0x5d60d6['error']){if(_0x5d60d6[_0xd205('0x12')][_0xd205('0x13')]===0x1f4){logger[_0xd205('0x12')](_0xd205('0xd'),_0x2614e7,_0x5d60d6[_0xd205('0x12')][_0xd205('0x14')]);return _0x372211(_0x5d60d6[_0xd205('0x12')]['message']);}logger[_0xd205('0x12')](_0xd205('0xd'),_0x2614e7,_0x5d60d6[_0xd205('0x12')]['message']);return _0xdb99a8(_0x5d60d6['error'][_0xd205('0x14')]);}else{logger['info'](_0xd205('0xd'),_0x2614e7,'request\x20sent');_0xdb99a8(_0x5d60d6[_0xd205('0x15')][_0xd205('0x14')]);}})[_0xd205('0x16')](function(_0x3b7bc1){logger['error'](_0xd205('0xd'),_0x2614e7,_0x3b7bc1);_0x372211(_0x3b7bc1);});});}exports[_0xd205('0x17')]=function(_0x27fc56){var _0x135e9d=this;return new Promise(function(_0x1af3b3,_0x31eb94){return db[_0xd205('0x18')][_0xd205('0x19')]({'raw':_0x27fc56[_0xd205('0x1a')]?_0x27fc56['options'][_0xd205('0x1b')]===undefined?!![]:![]:!![],'where':_0x27fc56['options']?_0x27fc56['options'][_0xd205('0x1c')]||null:null,'attributes':_0x27fc56['options']?_0x27fc56['options'][_0xd205('0x1d')]||null:null,'limit':_0x27fc56[_0xd205('0x1a')]?_0x27fc56[_0xd205('0x1a')][_0xd205('0x1e')]||null:null,'include':_0x27fc56[_0xd205('0x1a')]?_0x27fc56[_0xd205('0x1a')][_0xd205('0x1f')]?_[_0xd205('0x20')](_0x27fc56[_0xd205('0x1a')][_0xd205('0x1f')],function(_0x17b032){return{'model':db[_0x17b032[_0xd205('0x21')]],'as':_0x17b032['as'],'attributes':_0x17b032[_0xd205('0x1d')],'include':_0x17b032[_0xd205('0x1f')]?_[_0xd205('0x20')](_0x17b032[_0xd205('0x1f')],function(_0x1cdf16){return{'model':db[_0x1cdf16[_0xd205('0x21')]],'as':_0x1cdf16['as'],'attributes':_0x1cdf16[_0xd205('0x1d')],'include':_0x1cdf16[_0xd205('0x1f')]?_['map'](_0x1cdf16[_0xd205('0x1f')],function(_0x1c3609){return{'model':db[_0x1c3609[_0xd205('0x21')]],'as':_0x1c3609['as'],'attributes':_0x1c3609[_0xd205('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd205('0xb')](function(_0x1ce10d){logger['info']('GetFreshdeskAccount',_0x27fc56);logger['debug'](_0xd205('0x17'),_0x27fc56,JSON[_0xd205('0x11')](_0x1ce10d));_0x1af3b3(_0x1ce10d);})[_0xd205('0x16')](function(_0x102094){logger[_0xd205('0x12')](_0xd205('0x17'),_0x102094[_0xd205('0x14')],_0x27fc56);_0x31eb94(_0x135e9d['error'](0x1f4,_0x102094[_0xd205('0x14')]));});});};exports[_0xd205('0x22')]=function(_0x229349){var _0x281601=this;return new Promise(function(_0x4e7750,_0x55cdf7){return db[_0xd205('0x18')][_0xd205('0x23')]({'raw':_0x229349[_0xd205('0x1a')]?_0x229349['options'][_0xd205('0x1b')]===undefined?!![]:![]:!![],'where':_0x229349[_0xd205('0x1a')]?_0x229349[_0xd205('0x1a')]['where']||null:null,'attributes':_0x229349[_0xd205('0x1a')]?_0x229349[_0xd205('0x1a')][_0xd205('0x1d')]||null:null,'include':_0x229349['options']?_0x229349['options'][_0xd205('0x1f')]?_['map'](_0x229349[_0xd205('0x1a')][_0xd205('0x1f')],function(_0x38b8ad){return{'model':db[_0x38b8ad[_0xd205('0x21')]],'as':_0x38b8ad['as'],'attributes':_0x38b8ad['attributes'],'include':_0x38b8ad[_0xd205('0x1f')]?_['map'](_0x38b8ad[_0xd205('0x1f')],function(_0x332d53){return{'model':db[_0x332d53['model']],'as':_0x332d53['as'],'attributes':_0x332d53[_0xd205('0x1d')],'include':_0x332d53['include']?_[_0xd205('0x20')](_0x332d53[_0xd205('0x1f')],function(_0x3d3c64){return{'model':db[_0x3d3c64[_0xd205('0x21')]],'as':_0x3d3c64['as'],'attributes':_0x3d3c64[_0xd205('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd205('0xb')](function(_0x37cd70){logger[_0xd205('0xc')](_0xd205('0x22'),_0x229349);logger[_0xd205('0xe')]('ShowFreshdeskAccount',_0x229349,JSON[_0xd205('0x11')](_0x37cd70));_0x4e7750(_0x37cd70);})[_0xd205('0x16')](function(_0x59140e){logger['error']('ShowFreshdeskAccount',_0x59140e[_0xd205('0x14')],_0x229349);_0x55cdf7(_0x281601[_0xd205('0x12')](0x1f4,_0x59140e[_0xd205('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index cc45009..c0004ad 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(_0x31b728,_0x5567ad){var _0x53dfd0=function(_0x4e058a){while(--_0x4e058a){_0x31b728['push'](_0x31b728['shift']());}};_0x53dfd0(++_0x5567ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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(_0x192437,_0x3fda23){var _0x1d27af=function(_0x1914fb){while(--_0x1914fb){_0x192437['push'](_0x192437['shift']());}};_0x1d27af(++_0x3fda23);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 762edcb..3e75fbd 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 _0x117a=['exports','STRING'];(function(_0x1c901e,_0x84a234){var _0x5ee1c3=function(_0x1ff904){while(--_0x1ff904){_0x1c901e['push'](_0x1c901e['shift']());}};_0x5ee1c3(++_0x84a234);}(_0x117a,0x1aa));var _0xa117=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x117a[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0xa117('0x0')]={'name':{'type':Sequelize[_0xa117('0x1')]},'description':{'type':Sequelize[_0xa117('0x1')]}}; \ No newline at end of file +var _0xce0c=['exports','STRING'];(function(_0x3bd191,_0x7813a2){var _0x32b5ba=function(_0x49f0ba){while(--_0x49f0ba){_0x3bd191['push'](_0x3bd191['shift']());}};_0x32b5ba(++_0x7813a2);}(_0xce0c,0x1f2));var _0xcce0=function(_0x463376,_0x13871c){_0x463376=_0x463376-0x0;var _0x336ccd=_0xce0c[_0x463376];return _0x336ccd;};'use strict';var Sequelize=require('sequelize');module[_0xcce0('0x0')]={'name':{'type':Sequelize[_0xcce0('0x1')]},'description':{'type':Sequelize[_0xcce0('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 7aadd16..1bdbf7e 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 _0x84bc=['../../mysqldb','jayson/promise','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','update','destroy','stack','name','send','index','FreshdeskConfiguration','keys','query','dateStart','dateEnd','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','add','day','merge','where','map','filter','options','include','rows','show','rawAttributes','includeAll','find','create','body','params','getFields','findOne','getSubjects','FreshdeskField','getDescriptions','getTags','Tag','setTags','ids','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','papaparse','../../config/logger','../../config/utils'];(function(_0x1c510a,_0x1413a9){var _0x23cedd=function(_0x3f3e43){while(--_0x3f3e43){_0x1c510a['push'](_0x1c510a['shift']());}};_0x23cedd(++_0x1413a9);}(_0x84bc,0x9b));var _0xc84b=function(_0x567be2,_0x1b2e31){_0x567be2=_0x567be2-0x0;var _0x325c75=_0x84bc[_0x567be2];return _0x325c75;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xc84b('0x0'));var moment=require(_0xc84b('0x1'));var BPromise=require(_0xc84b('0x2'));var Mustache=require('mustache');var util=require(_0xc84b('0x3'));var path=require(_0xc84b('0x4'));var sox=require(_0xc84b('0x5'));var csv=require(_0xc84b('0x6'));var ejs=require(_0xc84b('0x7'));var fs=require('fs');var _=require(_0xc84b('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc84b('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc84b('0xa'));var qs=require('../../components/parsers/qs');var logger=require(_0xc84b('0xb'))('api');var utils=require(_0xc84b('0xc'));var config=require('../../config/environment');var db=require(_0xc84b('0xd'))['db'];var jayson=require(_0xc84b('0xe'));var client=jayson['client'][_0xc84b('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x5a8e12,_0x9645ed,_0x550441,_0x128ec7){return new BPromise(function(_0x1439ff,_0x402f48){var _0xd44dba=_0x128ec7||client;return _0xd44dba['request'](_0x5a8e12,_0x550441)[_0xc84b('0x10')](function(_0x406a11){logger[_0xc84b('0x11')](_0xc84b('0x12'),_0x9645ed,'request\x20sent');logger[_0xc84b('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x9645ed,_0xc84b('0x14'),JSON[_0xc84b('0x15')](_0x406a11));if(_0x406a11[_0xc84b('0x16')]){if(_0x406a11[_0xc84b('0x16')][_0xc84b('0x17')]===0x1f4){logger['error'](_0xc84b('0x12'),_0x9645ed,_0x406a11[_0xc84b('0x16')][_0xc84b('0x18')]);return _0x402f48(_0x406a11['error'][_0xc84b('0x18')]);}logger[_0xc84b('0x16')](_0xc84b('0x12'),_0x9645ed,_0x406a11[_0xc84b('0x16')][_0xc84b('0x18')]);return _0x1439ff(_0x406a11['error'][_0xc84b('0x18')]);}else{logger[_0xc84b('0x11')](_0xc84b('0x12'),_0x9645ed,_0xc84b('0x14'));_0x1439ff(_0x406a11[_0xc84b('0x19')]['message']);}})[_0xc84b('0x1a')](function(_0x193fb5){logger[_0xc84b('0x16')](_0xc84b('0x12'),_0x9645ed,_0x193fb5);_0x402f48(_0x193fb5);});});}function respondWithStatusCode(_0x4e688d,_0x5c702d){_0x5c702d=_0x5c702d||0xcc;return function(_0x5a5355){if(_0x5a5355){return _0x4e688d[_0xc84b('0x1b')](_0x5c702d);}return _0x4e688d[_0xc84b('0x1c')](_0x5c702d)[_0xc84b('0x1d')]();};}function respondWithResult(_0x20521f,_0x55186d){_0x55186d=_0x55186d||0xc8;return function(_0x524732){if(_0x524732){return _0x20521f[_0xc84b('0x1c')](_0x55186d)['json'](_0x524732);}};}function respondWithFilteredResult(_0x8a989e,_0x59e7c1){return function(_0x79901d){if(_0x79901d){var _0x5e5c79=_0x79901d[_0xc84b('0x1e')],_0x3c7ae1=_0x59e7c1[_0xc84b('0x1f')],_0x464116=_0x59e7c1[_0xc84b('0x1f')]+_0x59e7c1[_0xc84b('0x20')],_0x22ef38;if(_0x464116>=_0x5e5c79){_0x464116=_0x5e5c79;_0x22ef38=0xc8;}else{_0x22ef38=0xce;}_0x8a989e[_0xc84b('0x1c')](_0x22ef38);return _0x8a989e[_0xc84b('0x21')](_0xc84b('0x22'),_0x3c7ae1+'-'+_0x464116+'/'+_0x5e5c79)[_0xc84b('0x23')](_0x79901d);}return null;};}function patchUpdates(_0x1d73e8){return function(_0x3e333b){try{jsonpatch[_0xc84b('0x24')](_0x3e333b,_0x1d73e8,!![]);}catch(_0x53906a){return BPromise['reject'](_0x53906a);}return _0x3e333b['save']();};}function saveUpdates(_0x2bcac3,_0x4e571b){return function(_0x117f2a){if(_0x117f2a){return _0x117f2a[_0xc84b('0x25')](_0x2bcac3)['then'](function(_0x45e0ac){return _0x45e0ac;});}return null;};}function removeEntity(_0x34b51b,_0x27e687){return function(_0x2c043c){if(_0x2c043c){return _0x2c043c[_0xc84b('0x26')]()[_0xc84b('0x10')](function(){_0x34b51b['status'](0xcc)[_0xc84b('0x1d')]();});}};}function handleEntityNotFound(_0x197f9c,_0x467994){return function(_0x1ad213){if(!_0x1ad213){_0x197f9c['sendStatus'](0x194);}return _0x1ad213;};}function handleError(_0x5c0672,_0x4de9c0){_0x4de9c0=_0x4de9c0||0x1f4;return function(_0x2bd7c7){logger[_0xc84b('0x16')](_0x2bd7c7[_0xc84b('0x27')]);if(_0x2bd7c7[_0xc84b('0x28')]){delete _0x2bd7c7[_0xc84b('0x28')];}_0x5c0672['status'](_0x4de9c0)[_0xc84b('0x29')](_0x2bd7c7);};}exports[_0xc84b('0x2a')]=function(_0x24d52c,_0x216af2){var _0x513311={},_0x5ab553={},_0x10e6ca={'count':0x0,'rows':[]};var _0x2ba508=db[_0xc84b('0x2b')]['rawAttributes'];_0x5ab553['model']=_[_0xc84b('0x2c')](_0x2ba508);var _0x474170={'dateStart':_0x24d52c[_0xc84b('0x2d')][_0xc84b('0x2e')],'dateEnd':_0x24d52c['query'][_0xc84b('0x2f')]};delete _0x24d52c[_0xc84b('0x2d')][_0xc84b('0x2e')];delete _0x24d52c['query'][_0xc84b('0x2f')];_0x5ab553['query']=_[_0xc84b('0x2c')](_0x24d52c[_0xc84b('0x2d')]);_0x5ab553['filters']=_['intersection'](_0x5ab553[_0xc84b('0x30')],_0x5ab553[_0xc84b('0x2d')]);_0x513311[_0xc84b('0x31')]=_[_0xc84b('0x32')](_0x5ab553[_0xc84b('0x30')],qs['fields'](_0x24d52c[_0xc84b('0x2d')][_0xc84b('0x33')]));_0x513311[_0xc84b('0x31')]=_0x513311[_0xc84b('0x31')][_0xc84b('0x34')]?_0x513311[_0xc84b('0x31')]:_0x5ab553['model'];if(!_0x24d52c[_0xc84b('0x2d')][_0xc84b('0x35')](_0xc84b('0x36'))){_0x513311[_0xc84b('0x20')]=qs[_0xc84b('0x20')](_0x24d52c['query'][_0xc84b('0x20')]);_0x513311[_0xc84b('0x1f')]=qs[_0xc84b('0x1f')](_0x24d52c[_0xc84b('0x2d')][_0xc84b('0x1f')]);}_0x513311[_0xc84b('0x37')]=qs[_0xc84b('0x38')](_0x24d52c[_0xc84b('0x2d')][_0xc84b('0x38')]);_0x513311['where']=qs['filters'](_[_0xc84b('0x39')](_0x24d52c[_0xc84b('0x2d')],_0x5ab553[_0xc84b('0x3a')]));if(_0x474170[_0xc84b('0x2e')]){if(_0x474170[_0xc84b('0x2f')]){_0x474170['dateEnd']=moment(_0x474170[_0xc84b('0x2f')])[_0xc84b('0x3b')](0x1,_0xc84b('0x3c'));}else{_0x474170[_0xc84b('0x2f')]=moment(_0x474170['dateStart'])['add'](0x1,_0xc84b('0x3c'));}_[_0xc84b('0x3d')](_0x513311[_0xc84b('0x3e')],{'createdAt':{'$gte':_0x474170[_0xc84b('0x2e')],'$lte':_0x474170[_0xc84b('0x2f')]}});}if(_0x24d52c['query']['filter']){_0x513311['where']=_['merge'](_0x513311['where'],{'$or':_[_0xc84b('0x3f')](_0x513311['attributes'],function(_0x1a542d){var _0x15f1ae={};_0x15f1ae[_0x1a542d]={'$like':'%'+_0x24d52c[_0xc84b('0x2d')][_0xc84b('0x40')]+'%'};return _0x15f1ae;})});}_0x513311=_[_0xc84b('0x3d')]({},_0x513311,_0x24d52c[_0xc84b('0x41')]);var _0x4e8a4c={'where':_0x513311[_0xc84b('0x3e')]};return db[_0xc84b('0x2b')]['count'](_0x4e8a4c)['then'](function(_0x3d4aa8){_0x10e6ca['count']=_0x3d4aa8;if(_0x24d52c[_0xc84b('0x2d')]['includeAll']){_0x513311[_0xc84b('0x42')]=[{'all':!![]}];}return db[_0xc84b('0x2b')]['findAll'](_0x513311);})[_0xc84b('0x10')](function(_0x1d0c0a){_0x10e6ca[_0xc84b('0x43')]=_0x1d0c0a;return _0x10e6ca;})[_0xc84b('0x10')](respondWithFilteredResult(_0x216af2,_0x513311))[_0xc84b('0x1a')](handleError(_0x216af2,null));};exports[_0xc84b('0x44')]=function(_0x3d164a,_0x537252){var _0x40eb6d={'raw':![],'where':{'id':_0x3d164a['params']['id']}},_0x1db1b8={};_0x1db1b8['model']=_[_0xc84b('0x2c')](db[_0xc84b('0x2b')][_0xc84b('0x45')]);_0x1db1b8[_0xc84b('0x2d')]=_[_0xc84b('0x2c')](_0x3d164a[_0xc84b('0x2d')]);_0x1db1b8[_0xc84b('0x3a')]=_[_0xc84b('0x32')](_0x1db1b8[_0xc84b('0x30')],_0x1db1b8[_0xc84b('0x2d')]);_0x40eb6d[_0xc84b('0x31')]=_['intersection'](_0x1db1b8[_0xc84b('0x30')],qs['fields'](_0x3d164a[_0xc84b('0x2d')][_0xc84b('0x33')]));_0x40eb6d['attributes']=_0x40eb6d[_0xc84b('0x31')][_0xc84b('0x34')]?_0x40eb6d['attributes']:_0x1db1b8[_0xc84b('0x30')];if(_0x3d164a[_0xc84b('0x2d')][_0xc84b('0x46')]){_0x40eb6d[_0xc84b('0x42')]=[{'all':!![]}];}_0x40eb6d=_[_0xc84b('0x3d')]({},_0x40eb6d,_0x3d164a[_0xc84b('0x41')]);return db[_0xc84b('0x2b')][_0xc84b('0x47')](_0x40eb6d)[_0xc84b('0x10')](handleEntityNotFound(_0x537252,null))[_0xc84b('0x10')](respondWithResult(_0x537252,null))['catch'](handleError(_0x537252,null));};exports[_0xc84b('0x48')]=function(_0x157ad,_0x65dcc){return db[_0xc84b('0x2b')][_0xc84b('0x48')](_0x157ad[_0xc84b('0x49')],{})[_0xc84b('0x10')](respondWithResult(_0x65dcc,0xc9))[_0xc84b('0x1a')](handleError(_0x65dcc,null));};exports[_0xc84b('0x25')]=function(_0x4a0303,_0x49f15b){if(_0x4a0303[_0xc84b('0x49')]['id']){delete _0x4a0303['body']['id'];}return db[_0xc84b('0x2b')][_0xc84b('0x47')]({'where':{'id':_0x4a0303['params']['id']}})[_0xc84b('0x10')](handleEntityNotFound(_0x49f15b,null))[_0xc84b('0x10')](saveUpdates(_0x4a0303['body'],null))['then'](respondWithResult(_0x49f15b,null))[_0xc84b('0x1a')](handleError(_0x49f15b,null));};exports[_0xc84b('0x26')]=function(_0x5b8cde,_0x51f30d){return db[_0xc84b('0x2b')][_0xc84b('0x47')]({'where':{'id':_0x5b8cde[_0xc84b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x51f30d,null))[_0xc84b('0x10')](removeEntity(_0x51f30d,null))[_0xc84b('0x1a')](handleError(_0x51f30d,null));};exports[_0xc84b('0x4b')]=function(_0x463e1a,_0x3096e5,_0x1e34c1){var _0x4548e8={};var _0x4ab377={};var _0x2f2fb6;var _0x2ab23b;return db['FreshdeskConfiguration'][_0xc84b('0x4c')]({'where':{'id':_0x463e1a[_0xc84b('0x4a')]['id']}})[_0xc84b('0x10')](handleEntityNotFound(_0x3096e5,null))['then'](function(_0x67cd64){if(_0x67cd64){_0x2f2fb6=_0x67cd64;_0x4ab377[_0xc84b('0x30')]=_['keys'](db['FreshdeskField'][_0xc84b('0x45')]);_0x4ab377[_0xc84b('0x2d')]=_[_0xc84b('0x2c')](_0x463e1a['query']);_0x4ab377[_0xc84b('0x3a')]=_[_0xc84b('0x32')](_0x4ab377['model'],_0x4ab377[_0xc84b('0x2d')]);_0x4548e8['attributes']=_[_0xc84b('0x32')](_0x4ab377[_0xc84b('0x30')],qs[_0xc84b('0x33')](_0x463e1a[_0xc84b('0x2d')][_0xc84b('0x33')]));_0x4548e8[_0xc84b('0x31')]=_0x4548e8['attributes'][_0xc84b('0x34')]?_0x4548e8[_0xc84b('0x31')]:_0x4ab377['model'];_0x4548e8[_0xc84b('0x37')]=qs[_0xc84b('0x38')](_0x463e1a[_0xc84b('0x2d')]['sort']);_0x4548e8[_0xc84b('0x3e')]=qs[_0xc84b('0x3a')](_[_0xc84b('0x39')](_0x463e1a[_0xc84b('0x2d')],_0x4ab377[_0xc84b('0x3a')]));if(_0x463e1a[_0xc84b('0x2d')][_0xc84b('0x40')]){_0x4548e8[_0xc84b('0x3e')]=_[_0xc84b('0x3d')](_0x4548e8[_0xc84b('0x3e')],{'$or':_[_0xc84b('0x3f')](_0x4548e8[_0xc84b('0x31')],function(_0x31db32){var _0x2285cf={};_0x2285cf[_0x31db32]={'$like':'%'+_0x463e1a[_0xc84b('0x2d')][_0xc84b('0x40')]+'%'};return _0x2285cf;})});}_0x4548e8=_[_0xc84b('0x3d')]({},_0x4548e8,_0x463e1a[_0xc84b('0x41')]);return _0x2f2fb6[_0xc84b('0x4b')](_0x4548e8);}})[_0xc84b('0x10')](function(_0x3188ed){if(_0x3188ed){_0x2ab23b=_0x3188ed[_0xc84b('0x34')];if(!_0x463e1a[_0xc84b('0x2d')][_0xc84b('0x35')](_0xc84b('0x36'))){_0x4548e8[_0xc84b('0x20')]=qs[_0xc84b('0x20')](_0x463e1a['query']['limit']);_0x4548e8[_0xc84b('0x1f')]=qs[_0xc84b('0x1f')](_0x463e1a[_0xc84b('0x2d')][_0xc84b('0x1f')]);}return _0x2f2fb6['getFields'](_0x4548e8);}})[_0xc84b('0x10')](function(_0x1f2619){if(_0x1f2619){return _0x1f2619?{'count':_0x2ab23b,'rows':_0x1f2619}:null;}})[_0xc84b('0x10')](respondWithResult(_0x3096e5,null))['catch'](handleError(_0x3096e5,null));};exports[_0xc84b('0x4d')]=function(_0x405da4,_0x1e6825,_0x1f256f){var _0x261a1d={};var _0x2dff20={};var _0x3b2930;var _0x58df03;return db[_0xc84b('0x2b')][_0xc84b('0x4c')]({'where':{'id':_0x405da4[_0xc84b('0x4a')]['id']}})[_0xc84b('0x10')](handleEntityNotFound(_0x1e6825,null))[_0xc84b('0x10')](function(_0x32705d){if(_0x32705d){_0x3b2930=_0x32705d;_0x2dff20[_0xc84b('0x30')]=_[_0xc84b('0x2c')](db[_0xc84b('0x4e')][_0xc84b('0x45')]);_0x2dff20['query']=_[_0xc84b('0x2c')](_0x405da4[_0xc84b('0x2d')]);_0x2dff20[_0xc84b('0x3a')]=_[_0xc84b('0x32')](_0x2dff20[_0xc84b('0x30')],_0x2dff20['query']);_0x261a1d[_0xc84b('0x31')]=_[_0xc84b('0x32')](_0x2dff20[_0xc84b('0x30')],qs['fields'](_0x405da4['query'][_0xc84b('0x33')]));_0x261a1d[_0xc84b('0x31')]=_0x261a1d[_0xc84b('0x31')][_0xc84b('0x34')]?_0x261a1d[_0xc84b('0x31')]:_0x2dff20['model'];_0x261a1d[_0xc84b('0x37')]=qs[_0xc84b('0x38')](_0x405da4[_0xc84b('0x2d')][_0xc84b('0x38')]);_0x261a1d['where']=qs[_0xc84b('0x3a')](_['pick'](_0x405da4['query'],_0x2dff20[_0xc84b('0x3a')]));if(_0x405da4[_0xc84b('0x2d')][_0xc84b('0x40')]){_0x261a1d[_0xc84b('0x3e')]=_[_0xc84b('0x3d')](_0x261a1d['where'],{'$or':_[_0xc84b('0x3f')](_0x261a1d[_0xc84b('0x31')],function(_0x535d5){var _0x17594e={};_0x17594e[_0x535d5]={'$like':'%'+_0x405da4[_0xc84b('0x2d')][_0xc84b('0x40')]+'%'};return _0x17594e;})});}_0x261a1d=_['merge']({},_0x261a1d,_0x405da4[_0xc84b('0x41')]);return _0x3b2930[_0xc84b('0x4d')](_0x261a1d);}})['then'](function(_0x19da64){if(_0x19da64){_0x58df03=_0x19da64['length'];if(!_0x405da4[_0xc84b('0x2d')][_0xc84b('0x35')](_0xc84b('0x36'))){_0x261a1d[_0xc84b('0x20')]=qs[_0xc84b('0x20')](_0x405da4[_0xc84b('0x2d')][_0xc84b('0x20')]);_0x261a1d[_0xc84b('0x1f')]=qs[_0xc84b('0x1f')](_0x405da4[_0xc84b('0x2d')][_0xc84b('0x1f')]);}return _0x3b2930[_0xc84b('0x4d')](_0x261a1d);}})[_0xc84b('0x10')](function(_0x3c0ea5){if(_0x3c0ea5){return _0x3c0ea5?{'count':_0x58df03,'rows':_0x3c0ea5}:null;}})[_0xc84b('0x10')](respondWithResult(_0x1e6825,null))[_0xc84b('0x1a')](handleError(_0x1e6825,null));};exports[_0xc84b('0x4f')]=function(_0x3aae9e,_0x1eb84e,_0x13d41a){var _0xe377a5={};var _0x5ded21={};var _0x3a27a3;var _0x5839f2;return db[_0xc84b('0x2b')][_0xc84b('0x4c')]({'where':{'id':_0x3aae9e[_0xc84b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1eb84e,null))[_0xc84b('0x10')](function(_0x59a874){if(_0x59a874){_0x3a27a3=_0x59a874;_0x5ded21[_0xc84b('0x30')]=_['keys'](db[_0xc84b('0x4e')][_0xc84b('0x45')]);_0x5ded21[_0xc84b('0x2d')]=_[_0xc84b('0x2c')](_0x3aae9e[_0xc84b('0x2d')]);_0x5ded21[_0xc84b('0x3a')]=_[_0xc84b('0x32')](_0x5ded21[_0xc84b('0x30')],_0x5ded21[_0xc84b('0x2d')]);_0xe377a5[_0xc84b('0x31')]=_[_0xc84b('0x32')](_0x5ded21['model'],qs[_0xc84b('0x33')](_0x3aae9e[_0xc84b('0x2d')]['fields']));_0xe377a5[_0xc84b('0x31')]=_0xe377a5[_0xc84b('0x31')]['length']?_0xe377a5[_0xc84b('0x31')]:_0x5ded21['model'];_0xe377a5['order']=qs[_0xc84b('0x38')](_0x3aae9e[_0xc84b('0x2d')][_0xc84b('0x38')]);_0xe377a5[_0xc84b('0x3e')]=qs[_0xc84b('0x3a')](_[_0xc84b('0x39')](_0x3aae9e[_0xc84b('0x2d')],_0x5ded21[_0xc84b('0x3a')]));if(_0x3aae9e['query'][_0xc84b('0x40')]){_0xe377a5['where']=_['merge'](_0xe377a5[_0xc84b('0x3e')],{'$or':_[_0xc84b('0x3f')](_0xe377a5['attributes'],function(_0x2970e9){var _0x440f86={};_0x440f86[_0x2970e9]={'$like':'%'+_0x3aae9e['query'][_0xc84b('0x40')]+'%'};return _0x440f86;})});}_0xe377a5=_['merge']({},_0xe377a5,_0x3aae9e[_0xc84b('0x41')]);return _0x3a27a3[_0xc84b('0x4f')](_0xe377a5);}})[_0xc84b('0x10')](function(_0x4b888e){if(_0x4b888e){_0x5839f2=_0x4b888e[_0xc84b('0x34')];if(!_0x3aae9e[_0xc84b('0x2d')][_0xc84b('0x35')]('nolimit')){_0xe377a5[_0xc84b('0x20')]=qs['limit'](_0x3aae9e['query']['limit']);_0xe377a5[_0xc84b('0x1f')]=qs['offset'](_0x3aae9e['query']['offset']);}return _0x3a27a3[_0xc84b('0x4f')](_0xe377a5);}})[_0xc84b('0x10')](function(_0x5d3d00){if(_0x5d3d00){return _0x5d3d00?{'count':_0x5839f2,'rows':_0x5d3d00}:null;}})[_0xc84b('0x10')](respondWithResult(_0x1eb84e,null))['catch'](handleError(_0x1eb84e,null));};exports[_0xc84b('0x50')]=function(_0x1a590a,_0x155446,_0x33d454){var _0x5484aa={};var _0x2beb20={};var _0x182808;var _0x4fd848;return db[_0xc84b('0x2b')][_0xc84b('0x4c')]({'where':{'id':_0x1a590a[_0xc84b('0x4a')]['id']}})[_0xc84b('0x10')](handleEntityNotFound(_0x155446,null))['then'](function(_0x1d9e28){if(_0x1d9e28){_0x182808=_0x1d9e28;_0x2beb20[_0xc84b('0x30')]=_[_0xc84b('0x2c')](db[_0xc84b('0x51')][_0xc84b('0x45')]);_0x2beb20[_0xc84b('0x2d')]=_['keys'](_0x1a590a[_0xc84b('0x2d')]);_0x2beb20[_0xc84b('0x3a')]=_[_0xc84b('0x32')](_0x2beb20[_0xc84b('0x30')],_0x2beb20['query']);_0x5484aa['attributes']=_[_0xc84b('0x32')](_0x2beb20[_0xc84b('0x30')],qs[_0xc84b('0x33')](_0x1a590a[_0xc84b('0x2d')]['fields']));_0x5484aa['attributes']=_0x5484aa[_0xc84b('0x31')]['length']?_0x5484aa['attributes']:_0x2beb20[_0xc84b('0x30')];_0x5484aa[_0xc84b('0x37')]=qs[_0xc84b('0x38')](_0x1a590a[_0xc84b('0x2d')][_0xc84b('0x38')]);_0x5484aa[_0xc84b('0x3e')]=qs['filters'](_[_0xc84b('0x39')](_0x1a590a[_0xc84b('0x2d')],_0x2beb20[_0xc84b('0x3a')]));if(_0x1a590a[_0xc84b('0x2d')][_0xc84b('0x40')]){_0x5484aa['where']=_[_0xc84b('0x3d')](_0x5484aa[_0xc84b('0x3e')],{'$or':_[_0xc84b('0x3f')](_0x5484aa[_0xc84b('0x31')],function(_0x45bf83){var _0x4a40f0={};_0x4a40f0[_0x45bf83]={'$like':'%'+_0x1a590a['query']['filter']+'%'};return _0x4a40f0;})});}_0x5484aa=_[_0xc84b('0x3d')]({},_0x5484aa,_0x1a590a['options']);return _0x182808[_0xc84b('0x50')](_0x5484aa);}})[_0xc84b('0x10')](function(_0x642769){if(_0x642769){_0x4fd848=_0x642769[_0xc84b('0x34')];if(!_0x1a590a['query'][_0xc84b('0x35')](_0xc84b('0x36'))){_0x5484aa[_0xc84b('0x20')]=qs[_0xc84b('0x20')](_0x1a590a[_0xc84b('0x2d')]['limit']);_0x5484aa[_0xc84b('0x1f')]=qs[_0xc84b('0x1f')](_0x1a590a[_0xc84b('0x2d')]['offset']);}return _0x182808[_0xc84b('0x50')](_0x5484aa);}})[_0xc84b('0x10')](function(_0x19ccfe){if(_0x19ccfe){return _0x19ccfe?{'count':_0x4fd848,'rows':_0x19ccfe}:null;}})[_0xc84b('0x10')](respondWithResult(_0x155446,null))[_0xc84b('0x1a')](handleError(_0x155446,null));};exports[_0xc84b('0x52')]=function(_0x1b5241,_0x5a63b1,_0x5d6bc2){if(_0x1b5241[_0xc84b('0x49')]['id']){delete _0x1b5241[_0xc84b('0x49')]['id'];}return db[_0xc84b('0x2b')][_0xc84b('0x4c')]({'where':{'id':_0x1b5241[_0xc84b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5a63b1,null))[_0xc84b('0x10')](function(_0x21c8f3){if(_0x21c8f3){return _0x21c8f3[_0xc84b('0x52')](_0x1b5241[_0xc84b('0x49')][_0xc84b('0x53')]||[]);}return null;})[_0xc84b('0x10')](respondWithResult(_0x5a63b1,null))[_0xc84b('0x1a')](handleError(_0x5a63b1,null));}; \ No newline at end of file +var _0x60b3=['rawAttributes','keys','query','dateStart','filters','model','intersection','attributes','length','nolimit','where','dateEnd','add','day','merge','filter','map','options','includeAll','include','findAll','rows','show','params','find','body','update','getFields','findOne','FreshdeskField','fields','order','sort','pick','hasOwnProperty','getSubjects','getDescriptions','Tag','getTags','setTags','ids','fast-json-patch','moment','mustache','util','sox','to-csv','crypto','jsforce','querystring','../../components/parsers/qs','../../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','end','json','count','offset','limit','status','reject','save','then','destroy','name','FreshdeskConfiguration'];(function(_0x40308e,_0x4ab6cb){var _0x2fc4f5=function(_0x327574){while(--_0x327574){_0x40308e['push'](_0x40308e['shift']());}};_0x2fc4f5(++_0x4ab6cb);}(_0x60b3,0xc5));var _0x360b=function(_0x11fb47,_0x50fbf8){_0x11fb47=_0x11fb47-0x0;var _0xa0d270=_0x60b3[_0x11fb47];return _0xa0d270;};'use strict';var jsonpatch=require(_0x360b('0x0'));var rp=require('request-promise');var moment=require(_0x360b('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x360b('0x2'));var util=require(_0x360b('0x3'));var path=require('path');var sox=require(_0x360b('0x4'));var csv=require(_0x360b('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x360b('0x6'));var jsforce=require(_0x360b('0x7'));var deskjs=require('desk.js');var toCsv=require(_0x360b('0x5'));var querystring=require(_0x360b('0x8'));var Papa=require('papaparse');var qs=require(_0x360b('0x9'));var logger=require(_0x360b('0xa'))(_0x360b('0xb'));var utils=require(_0x360b('0xc'));var config=require('../../config/environment');var db=require(_0x360b('0xd'))['db'];var jayson=require(_0x360b('0xe'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d5dfc,_0x567b31,_0x414e73,_0x4b69a1){return new BPromise(function(_0x4f0344,_0xa4189c){var _0x2c0900=_0x4b69a1||client;return _0x2c0900['request'](_0x4d5dfc,_0x414e73)['then'](function(_0x2e3bf2){logger[_0x360b('0xf')](_0x360b('0x10'),_0x567b31,_0x360b('0x11'));logger[_0x360b('0x12')](_0x360b('0x13'),_0x567b31,_0x360b('0x11'),JSON['stringify'](_0x2e3bf2));if(_0x2e3bf2[_0x360b('0x14')]){if(_0x2e3bf2[_0x360b('0x14')][_0x360b('0x15')]===0x1f4){logger['error'](_0x360b('0x10'),_0x567b31,_0x2e3bf2[_0x360b('0x14')][_0x360b('0x16')]);return _0xa4189c(_0x2e3bf2[_0x360b('0x14')][_0x360b('0x16')]);}logger[_0x360b('0x14')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x567b31,_0x2e3bf2[_0x360b('0x14')][_0x360b('0x16')]);return _0x4f0344(_0x2e3bf2[_0x360b('0x14')][_0x360b('0x16')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x567b31,'request\x20sent');_0x4f0344(_0x2e3bf2[_0x360b('0x17')][_0x360b('0x16')]);}})[_0x360b('0x18')](function(_0x361227){logger[_0x360b('0x14')](_0x360b('0x10'),_0x567b31,_0x361227);_0xa4189c(_0x361227);});});}function respondWithStatusCode(_0x137b42,_0x2f2039){_0x2f2039=_0x2f2039||0xcc;return function(_0xc18077){if(_0xc18077){return _0x137b42['sendStatus'](_0x2f2039);}return _0x137b42['status'](_0x2f2039)[_0x360b('0x19')]();};}function respondWithResult(_0x2c3a5e,_0x57a327){_0x57a327=_0x57a327||0xc8;return function(_0xedd06f){if(_0xedd06f){return _0x2c3a5e['status'](_0x57a327)[_0x360b('0x1a')](_0xedd06f);}};}function respondWithFilteredResult(_0x1d74ab,_0x4a809e){return function(_0x564769){if(_0x564769){var _0x503c56=_0x564769[_0x360b('0x1b')],_0x4a343b=_0x4a809e[_0x360b('0x1c')],_0x88465c=_0x4a809e[_0x360b('0x1c')]+_0x4a809e[_0x360b('0x1d')],_0x5d25cf;if(_0x88465c>=_0x503c56){_0x88465c=_0x503c56;_0x5d25cf=0xc8;}else{_0x5d25cf=0xce;}_0x1d74ab[_0x360b('0x1e')](_0x5d25cf);return _0x1d74ab['set']('Content-Range',_0x4a343b+'-'+_0x88465c+'/'+_0x503c56)[_0x360b('0x1a')](_0x564769);}return null;};}function patchUpdates(_0x3e7b04){return function(_0x31e110){try{jsonpatch['apply'](_0x31e110,_0x3e7b04,!![]);}catch(_0x4d9cee){return BPromise[_0x360b('0x1f')](_0x4d9cee);}return _0x31e110[_0x360b('0x20')]();};}function saveUpdates(_0x134dde,_0x3d6c01){return function(_0x5ec0ad){if(_0x5ec0ad){return _0x5ec0ad['update'](_0x134dde)[_0x360b('0x21')](function(_0x36ae5e){return _0x36ae5e;});}return null;};}function removeEntity(_0x4000e4,_0x90d8fa){return function(_0x579340){if(_0x579340){return _0x579340[_0x360b('0x22')]()[_0x360b('0x21')](function(){_0x4000e4[_0x360b('0x1e')](0xcc)[_0x360b('0x19')]();});}};}function handleEntityNotFound(_0x26e38b,_0xf7b461){return function(_0x90b2e7){if(!_0x90b2e7){_0x26e38b['sendStatus'](0x194);}return _0x90b2e7;};}function handleError(_0x1d3b24,_0x30ba30){_0x30ba30=_0x30ba30||0x1f4;return function(_0x37d2e8){logger['error'](_0x37d2e8['stack']);if(_0x37d2e8[_0x360b('0x23')]){delete _0x37d2e8['name'];}_0x1d3b24[_0x360b('0x1e')](_0x30ba30)['send'](_0x37d2e8);};}exports['index']=function(_0x528192,_0x1e42e7){var _0xec2e95={},_0x3bd580={},_0x6250c7={'count':0x0,'rows':[]};var _0x1395c8=db[_0x360b('0x24')][_0x360b('0x25')];_0x3bd580['model']=_[_0x360b('0x26')](_0x1395c8);var _0x149742={'dateStart':_0x528192[_0x360b('0x27')][_0x360b('0x28')],'dateEnd':_0x528192[_0x360b('0x27')]['dateEnd']};delete _0x528192[_0x360b('0x27')]['dateStart'];delete _0x528192[_0x360b('0x27')]['dateEnd'];_0x3bd580[_0x360b('0x27')]=_[_0x360b('0x26')](_0x528192[_0x360b('0x27')]);_0x3bd580[_0x360b('0x29')]=_['intersection'](_0x3bd580[_0x360b('0x2a')],_0x3bd580['query']);_0xec2e95['attributes']=_[_0x360b('0x2b')](_0x3bd580[_0x360b('0x2a')],qs['fields'](_0x528192[_0x360b('0x27')]['fields']));_0xec2e95[_0x360b('0x2c')]=_0xec2e95[_0x360b('0x2c')][_0x360b('0x2d')]?_0xec2e95[_0x360b('0x2c')]:_0x3bd580[_0x360b('0x2a')];if(!_0x528192[_0x360b('0x27')]['hasOwnProperty'](_0x360b('0x2e'))){_0xec2e95['limit']=qs[_0x360b('0x1d')](_0x528192[_0x360b('0x27')][_0x360b('0x1d')]);_0xec2e95[_0x360b('0x1c')]=qs[_0x360b('0x1c')](_0x528192[_0x360b('0x27')][_0x360b('0x1c')]);}_0xec2e95['order']=qs['sort'](_0x528192[_0x360b('0x27')]['sort']);_0xec2e95[_0x360b('0x2f')]=qs[_0x360b('0x29')](_['pick'](_0x528192[_0x360b('0x27')],_0x3bd580['filters']));if(_0x149742[_0x360b('0x28')]){if(_0x149742['dateEnd']){_0x149742[_0x360b('0x30')]=moment(_0x149742[_0x360b('0x30')])[_0x360b('0x31')](0x1,_0x360b('0x32'));}else{_0x149742[_0x360b('0x30')]=moment(_0x149742['dateStart'])['add'](0x1,_0x360b('0x32'));}_[_0x360b('0x33')](_0xec2e95[_0x360b('0x2f')],{'createdAt':{'$gte':_0x149742[_0x360b('0x28')],'$lte':_0x149742['dateEnd']}});}if(_0x528192[_0x360b('0x27')][_0x360b('0x34')]){_0xec2e95['where']=_['merge'](_0xec2e95[_0x360b('0x2f')],{'$or':_[_0x360b('0x35')](_0xec2e95[_0x360b('0x2c')],function(_0x196d90){var _0x225e09={};_0x225e09[_0x196d90]={'$like':'%'+_0x528192[_0x360b('0x27')][_0x360b('0x34')]+'%'};return _0x225e09;})});}_0xec2e95=_[_0x360b('0x33')]({},_0xec2e95,_0x528192[_0x360b('0x36')]);var _0x12822e={'where':_0xec2e95[_0x360b('0x2f')]};return db[_0x360b('0x24')][_0x360b('0x1b')](_0x12822e)[_0x360b('0x21')](function(_0x7734d2){_0x6250c7[_0x360b('0x1b')]=_0x7734d2;if(_0x528192['query'][_0x360b('0x37')]){_0xec2e95[_0x360b('0x38')]=[{'all':!![]}];}return db[_0x360b('0x24')][_0x360b('0x39')](_0xec2e95);})[_0x360b('0x21')](function(_0x14dee3){_0x6250c7[_0x360b('0x3a')]=_0x14dee3;return _0x6250c7;})[_0x360b('0x21')](respondWithFilteredResult(_0x1e42e7,_0xec2e95))['catch'](handleError(_0x1e42e7,null));};exports[_0x360b('0x3b')]=function(_0x4cec84,_0x30389a){var _0x48a0f5={'raw':![],'where':{'id':_0x4cec84[_0x360b('0x3c')]['id']}},_0x42f48f={};_0x42f48f[_0x360b('0x2a')]=_['keys'](db[_0x360b('0x24')][_0x360b('0x25')]);_0x42f48f[_0x360b('0x27')]=_[_0x360b('0x26')](_0x4cec84[_0x360b('0x27')]);_0x42f48f['filters']=_['intersection'](_0x42f48f[_0x360b('0x2a')],_0x42f48f[_0x360b('0x27')]);_0x48a0f5[_0x360b('0x2c')]=_[_0x360b('0x2b')](_0x42f48f[_0x360b('0x2a')],qs['fields'](_0x4cec84[_0x360b('0x27')]['fields']));_0x48a0f5[_0x360b('0x2c')]=_0x48a0f5[_0x360b('0x2c')]['length']?_0x48a0f5[_0x360b('0x2c')]:_0x42f48f[_0x360b('0x2a')];if(_0x4cec84[_0x360b('0x27')][_0x360b('0x37')]){_0x48a0f5[_0x360b('0x38')]=[{'all':!![]}];}_0x48a0f5=_[_0x360b('0x33')]({},_0x48a0f5,_0x4cec84[_0x360b('0x36')]);return db['FreshdeskConfiguration'][_0x360b('0x3d')](_0x48a0f5)[_0x360b('0x21')](handleEntityNotFound(_0x30389a,null))[_0x360b('0x21')](respondWithResult(_0x30389a,null))[_0x360b('0x18')](handleError(_0x30389a,null));};exports['create']=function(_0x206c01,_0x5f10be){return db[_0x360b('0x24')]['create'](_0x206c01[_0x360b('0x3e')],{})[_0x360b('0x21')](respondWithResult(_0x5f10be,0xc9))[_0x360b('0x18')](handleError(_0x5f10be,null));};exports[_0x360b('0x3f')]=function(_0x157b5f,_0x53527f){if(_0x157b5f[_0x360b('0x3e')]['id']){delete _0x157b5f[_0x360b('0x3e')]['id'];}return db[_0x360b('0x24')]['find']({'where':{'id':_0x157b5f[_0x360b('0x3c')]['id']}})[_0x360b('0x21')](handleEntityNotFound(_0x53527f,null))[_0x360b('0x21')](saveUpdates(_0x157b5f['body'],null))[_0x360b('0x21')](respondWithResult(_0x53527f,null))[_0x360b('0x18')](handleError(_0x53527f,null));};exports[_0x360b('0x22')]=function(_0x31a875,_0x33cb4f){return db[_0x360b('0x24')][_0x360b('0x3d')]({'where':{'id':_0x31a875[_0x360b('0x3c')]['id']}})['then'](handleEntityNotFound(_0x33cb4f,null))[_0x360b('0x21')](removeEntity(_0x33cb4f,null))[_0x360b('0x18')](handleError(_0x33cb4f,null));};exports[_0x360b('0x40')]=function(_0x322a4b,_0x1355b4,_0x3ff2cc){var _0x37e577={};var _0x8e5788={};var _0x264a12;var _0xe576d7;return db['FreshdeskConfiguration'][_0x360b('0x41')]({'where':{'id':_0x322a4b[_0x360b('0x3c')]['id']}})[_0x360b('0x21')](handleEntityNotFound(_0x1355b4,null))[_0x360b('0x21')](function(_0x35be00){if(_0x35be00){_0x264a12=_0x35be00;_0x8e5788['model']=_['keys'](db[_0x360b('0x42')][_0x360b('0x25')]);_0x8e5788[_0x360b('0x27')]=_[_0x360b('0x26')](_0x322a4b[_0x360b('0x27')]);_0x8e5788['filters']=_[_0x360b('0x2b')](_0x8e5788['model'],_0x8e5788[_0x360b('0x27')]);_0x37e577[_0x360b('0x2c')]=_[_0x360b('0x2b')](_0x8e5788[_0x360b('0x2a')],qs[_0x360b('0x43')](_0x322a4b['query']['fields']));_0x37e577['attributes']=_0x37e577['attributes'][_0x360b('0x2d')]?_0x37e577[_0x360b('0x2c')]:_0x8e5788['model'];_0x37e577[_0x360b('0x44')]=qs[_0x360b('0x45')](_0x322a4b[_0x360b('0x27')][_0x360b('0x45')]);_0x37e577[_0x360b('0x2f')]=qs[_0x360b('0x29')](_[_0x360b('0x46')](_0x322a4b[_0x360b('0x27')],_0x8e5788[_0x360b('0x29')]));if(_0x322a4b[_0x360b('0x27')][_0x360b('0x34')]){_0x37e577[_0x360b('0x2f')]=_['merge'](_0x37e577[_0x360b('0x2f')],{'$or':_[_0x360b('0x35')](_0x37e577[_0x360b('0x2c')],function(_0x4b0ba2){var _0x4b8c23={};_0x4b8c23[_0x4b0ba2]={'$like':'%'+_0x322a4b[_0x360b('0x27')][_0x360b('0x34')]+'%'};return _0x4b8c23;})});}_0x37e577=_[_0x360b('0x33')]({},_0x37e577,_0x322a4b[_0x360b('0x36')]);return _0x264a12[_0x360b('0x40')](_0x37e577);}})[_0x360b('0x21')](function(_0x1c9520){if(_0x1c9520){_0xe576d7=_0x1c9520[_0x360b('0x2d')];if(!_0x322a4b[_0x360b('0x27')][_0x360b('0x47')](_0x360b('0x2e'))){_0x37e577[_0x360b('0x1d')]=qs[_0x360b('0x1d')](_0x322a4b[_0x360b('0x27')]['limit']);_0x37e577[_0x360b('0x1c')]=qs[_0x360b('0x1c')](_0x322a4b[_0x360b('0x27')][_0x360b('0x1c')]);}return _0x264a12[_0x360b('0x40')](_0x37e577);}})[_0x360b('0x21')](function(_0x5d6346){if(_0x5d6346){return _0x5d6346?{'count':_0xe576d7,'rows':_0x5d6346}:null;}})[_0x360b('0x21')](respondWithResult(_0x1355b4,null))['catch'](handleError(_0x1355b4,null));};exports[_0x360b('0x48')]=function(_0x49ad42,_0x3dfb2f,_0x314d00){var _0x5d5181={};var _0x17b9ee={};var _0x4c5940;var _0x338d55;return db[_0x360b('0x24')][_0x360b('0x41')]({'where':{'id':_0x49ad42[_0x360b('0x3c')]['id']}})[_0x360b('0x21')](handleEntityNotFound(_0x3dfb2f,null))[_0x360b('0x21')](function(_0x2f810f){if(_0x2f810f){_0x4c5940=_0x2f810f;_0x17b9ee[_0x360b('0x2a')]=_[_0x360b('0x26')](db[_0x360b('0x42')]['rawAttributes']);_0x17b9ee['query']=_['keys'](_0x49ad42[_0x360b('0x27')]);_0x17b9ee[_0x360b('0x29')]=_['intersection'](_0x17b9ee[_0x360b('0x2a')],_0x17b9ee['query']);_0x5d5181[_0x360b('0x2c')]=_[_0x360b('0x2b')](_0x17b9ee[_0x360b('0x2a')],qs['fields'](_0x49ad42['query'][_0x360b('0x43')]));_0x5d5181[_0x360b('0x2c')]=_0x5d5181[_0x360b('0x2c')][_0x360b('0x2d')]?_0x5d5181['attributes']:_0x17b9ee['model'];_0x5d5181[_0x360b('0x44')]=qs[_0x360b('0x45')](_0x49ad42[_0x360b('0x27')][_0x360b('0x45')]);_0x5d5181[_0x360b('0x2f')]=qs[_0x360b('0x29')](_[_0x360b('0x46')](_0x49ad42[_0x360b('0x27')],_0x17b9ee['filters']));if(_0x49ad42[_0x360b('0x27')][_0x360b('0x34')]){_0x5d5181['where']=_[_0x360b('0x33')](_0x5d5181['where'],{'$or':_[_0x360b('0x35')](_0x5d5181[_0x360b('0x2c')],function(_0x1e4d01){var _0x198df0={};_0x198df0[_0x1e4d01]={'$like':'%'+_0x49ad42[_0x360b('0x27')][_0x360b('0x34')]+'%'};return _0x198df0;})});}_0x5d5181=_[_0x360b('0x33')]({},_0x5d5181,_0x49ad42['options']);return _0x4c5940[_0x360b('0x48')](_0x5d5181);}})['then'](function(_0x313fba){if(_0x313fba){_0x338d55=_0x313fba[_0x360b('0x2d')];if(!_0x49ad42[_0x360b('0x27')][_0x360b('0x47')]('nolimit')){_0x5d5181[_0x360b('0x1d')]=qs[_0x360b('0x1d')](_0x49ad42['query'][_0x360b('0x1d')]);_0x5d5181[_0x360b('0x1c')]=qs[_0x360b('0x1c')](_0x49ad42[_0x360b('0x27')]['offset']);}return _0x4c5940['getSubjects'](_0x5d5181);}})[_0x360b('0x21')](function(_0x1c8287){if(_0x1c8287){return _0x1c8287?{'count':_0x338d55,'rows':_0x1c8287}:null;}})[_0x360b('0x21')](respondWithResult(_0x3dfb2f,null))['catch'](handleError(_0x3dfb2f,null));};exports[_0x360b('0x49')]=function(_0x5ef98d,_0x5848b6,_0x10044f){var _0x13ee4e={};var _0x78722={};var _0x348b4e;var _0x5edbb7;return db[_0x360b('0x24')][_0x360b('0x41')]({'where':{'id':_0x5ef98d[_0x360b('0x3c')]['id']}})[_0x360b('0x21')](handleEntityNotFound(_0x5848b6,null))[_0x360b('0x21')](function(_0xc37991){if(_0xc37991){_0x348b4e=_0xc37991;_0x78722[_0x360b('0x2a')]=_[_0x360b('0x26')](db[_0x360b('0x42')][_0x360b('0x25')]);_0x78722['query']=_['keys'](_0x5ef98d['query']);_0x78722[_0x360b('0x29')]=_[_0x360b('0x2b')](_0x78722[_0x360b('0x2a')],_0x78722['query']);_0x13ee4e[_0x360b('0x2c')]=_[_0x360b('0x2b')](_0x78722[_0x360b('0x2a')],qs[_0x360b('0x43')](_0x5ef98d[_0x360b('0x27')][_0x360b('0x43')]));_0x13ee4e[_0x360b('0x2c')]=_0x13ee4e['attributes'][_0x360b('0x2d')]?_0x13ee4e[_0x360b('0x2c')]:_0x78722['model'];_0x13ee4e[_0x360b('0x44')]=qs[_0x360b('0x45')](_0x5ef98d[_0x360b('0x27')][_0x360b('0x45')]);_0x13ee4e[_0x360b('0x2f')]=qs[_0x360b('0x29')](_['pick'](_0x5ef98d[_0x360b('0x27')],_0x78722[_0x360b('0x29')]));if(_0x5ef98d['query']['filter']){_0x13ee4e[_0x360b('0x2f')]=_[_0x360b('0x33')](_0x13ee4e[_0x360b('0x2f')],{'$or':_[_0x360b('0x35')](_0x13ee4e[_0x360b('0x2c')],function(_0x304836){var _0x10716b={};_0x10716b[_0x304836]={'$like':'%'+_0x5ef98d[_0x360b('0x27')][_0x360b('0x34')]+'%'};return _0x10716b;})});}_0x13ee4e=_['merge']({},_0x13ee4e,_0x5ef98d[_0x360b('0x36')]);return _0x348b4e[_0x360b('0x49')](_0x13ee4e);}})[_0x360b('0x21')](function(_0x1da124){if(_0x1da124){_0x5edbb7=_0x1da124['length'];if(!_0x5ef98d[_0x360b('0x27')]['hasOwnProperty'](_0x360b('0x2e'))){_0x13ee4e['limit']=qs[_0x360b('0x1d')](_0x5ef98d['query'][_0x360b('0x1d')]);_0x13ee4e[_0x360b('0x1c')]=qs[_0x360b('0x1c')](_0x5ef98d[_0x360b('0x27')][_0x360b('0x1c')]);}return _0x348b4e[_0x360b('0x49')](_0x13ee4e);}})['then'](function(_0x261213){if(_0x261213){return _0x261213?{'count':_0x5edbb7,'rows':_0x261213}:null;}})[_0x360b('0x21')](respondWithResult(_0x5848b6,null))[_0x360b('0x18')](handleError(_0x5848b6,null));};exports['getTags']=function(_0x2ac972,_0x45759d,_0x10e25c){var _0x4b74f8={};var _0x5db246={};var _0x4d5c85;var _0x1afddc;return db[_0x360b('0x24')]['findOne']({'where':{'id':_0x2ac972[_0x360b('0x3c')]['id']}})[_0x360b('0x21')](handleEntityNotFound(_0x45759d,null))['then'](function(_0x1b550d){if(_0x1b550d){_0x4d5c85=_0x1b550d;_0x5db246[_0x360b('0x2a')]=_[_0x360b('0x26')](db[_0x360b('0x4a')][_0x360b('0x25')]);_0x5db246['query']=_['keys'](_0x2ac972[_0x360b('0x27')]);_0x5db246['filters']=_[_0x360b('0x2b')](_0x5db246[_0x360b('0x2a')],_0x5db246['query']);_0x4b74f8[_0x360b('0x2c')]=_['intersection'](_0x5db246[_0x360b('0x2a')],qs[_0x360b('0x43')](_0x2ac972['query']['fields']));_0x4b74f8[_0x360b('0x2c')]=_0x4b74f8[_0x360b('0x2c')][_0x360b('0x2d')]?_0x4b74f8[_0x360b('0x2c')]:_0x5db246[_0x360b('0x2a')];_0x4b74f8['order']=qs[_0x360b('0x45')](_0x2ac972[_0x360b('0x27')]['sort']);_0x4b74f8[_0x360b('0x2f')]=qs[_0x360b('0x29')](_[_0x360b('0x46')](_0x2ac972[_0x360b('0x27')],_0x5db246['filters']));if(_0x2ac972[_0x360b('0x27')][_0x360b('0x34')]){_0x4b74f8['where']=_[_0x360b('0x33')](_0x4b74f8[_0x360b('0x2f')],{'$or':_[_0x360b('0x35')](_0x4b74f8['attributes'],function(_0x5a3516){var _0x39d9f7={};_0x39d9f7[_0x5a3516]={'$like':'%'+_0x2ac972[_0x360b('0x27')][_0x360b('0x34')]+'%'};return _0x39d9f7;})});}_0x4b74f8=_[_0x360b('0x33')]({},_0x4b74f8,_0x2ac972[_0x360b('0x36')]);return _0x4d5c85[_0x360b('0x4b')](_0x4b74f8);}})[_0x360b('0x21')](function(_0x3c3dfd){if(_0x3c3dfd){_0x1afddc=_0x3c3dfd[_0x360b('0x2d')];if(!_0x2ac972[_0x360b('0x27')]['hasOwnProperty'](_0x360b('0x2e'))){_0x4b74f8[_0x360b('0x1d')]=qs['limit'](_0x2ac972[_0x360b('0x27')][_0x360b('0x1d')]);_0x4b74f8[_0x360b('0x1c')]=qs[_0x360b('0x1c')](_0x2ac972[_0x360b('0x27')][_0x360b('0x1c')]);}return _0x4d5c85['getTags'](_0x4b74f8);}})['then'](function(_0x4d4542){if(_0x4d4542){return _0x4d4542?{'count':_0x1afddc,'rows':_0x4d4542}:null;}})[_0x360b('0x21')](respondWithResult(_0x45759d,null))[_0x360b('0x18')](handleError(_0x45759d,null));};exports[_0x360b('0x4c')]=function(_0x2feb31,_0x1f7891,_0x4d6be4){if(_0x2feb31[_0x360b('0x3e')]['id']){delete _0x2feb31[_0x360b('0x3e')]['id'];}return db[_0x360b('0x24')][_0x360b('0x41')]({'where':{'id':_0x2feb31['params']['id']}})[_0x360b('0x21')](handleEntityNotFound(_0x1f7891,null))[_0x360b('0x21')](function(_0x5bdb52){if(_0x5bdb52){return _0x5bdb52[_0x360b('0x4c')](_0x2feb31[_0x360b('0x3e')][_0x360b('0x4d')]||[]);}return null;})['then'](respondWithResult(_0x1f7891,null))['catch'](handleError(_0x1f7891,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 230c6d0..8522193 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 _0xf2ca=['util','../../config/logger','moment','bluebird','request-promise','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash'];(function(_0x27880a,_0x527c39){var _0x1487b1=function(_0x74803){while(--_0x74803){_0x27880a['push'](_0x27880a['shift']());}};_0x1487b1(++_0x527c39);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x512973,_0x564e8b){_0x512973=_0x512973-0x0;var _0x32f2e1=_0xf2ca[_0x512973];return _0x32f2e1;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var logger=require(_0xaf2c('0x2'))('api');var moment=require(_0xaf2c('0x3'));var BPromise=require(_0xaf2c('0x4'));var rp=require(_0xaf2c('0x5'));var attributes=require(_0xaf2c('0x6'));module[_0xaf2c('0x7')]=function(_0x10c910,_0x5b8c81){return _0x10c910[_0xaf2c('0x8')](_0xaf2c('0x9'),attributes,{'tableName':_0xaf2c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a9f=['bluebird','./intFreshdeskConfiguration.attributes','FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a9f,0x64));var _0xf0a9=function(_0x2aaf0c,_0x120301){_0x2aaf0c=_0x2aaf0c-0x0;var _0x2ccbed=_0x0a9f[_0x2aaf0c];return _0x2ccbed;};'use strict';var _=require('lodash');var util=require(_0xf0a9('0x0'));var logger=require(_0xf0a9('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf0a9('0x2'));var rp=require('request-promise');var attributes=require(_0xf0a9('0x3'));module['exports']=function(_0x5f203f,_0x55b37c){return _0x5f203f['define'](_0xf0a9('0x4'),attributes,{'tableName':_0xf0a9('0x5'),'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 36fa237..f14d079 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 _0x8c6a=['debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','rpc','jayson/promise','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x5d6a51,_0x30c4c0){var _0x551c72=function(_0x46c92d){while(--_0x46c92d){_0x5d6a51['push'](_0x5d6a51['shift']());}};_0x551c72(++_0x30c4c0);}(_0x8c6a,0xe4));var _0xa8c6=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x8c6a[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0xa8c6('0x0'));var util=require(_0xa8c6('0x1'));var moment=require(_0xa8c6('0x2'));var BPromise=require(_0xa8c6('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xa8c6('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa8c6('0x5'));var config=require('../../config/environment');var jayson=require(_0xa8c6('0x6'));var client=jayson[_0xa8c6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34cbdc,_0x56975c,_0x582d12){return new BPromise(function(_0x36f68f,_0x5cb78e){return client[_0xa8c6('0x8')](_0x34cbdc,_0x582d12)[_0xa8c6('0x9')](function(_0x2b6ba0){logger[_0xa8c6('0xa')](_0xa8c6('0xb'),_0x56975c,'request\x20sent');logger[_0xa8c6('0xc')](_0xa8c6('0xd'),_0x56975c,_0xa8c6('0xe'),JSON[_0xa8c6('0xf')](_0x2b6ba0));if(_0x2b6ba0[_0xa8c6('0x10')]){if(_0x2b6ba0[_0xa8c6('0x10')]['code']===0x1f4){logger[_0xa8c6('0x10')](_0xa8c6('0xb'),_0x56975c,_0x2b6ba0[_0xa8c6('0x10')][_0xa8c6('0x11')]);return _0x5cb78e(_0x2b6ba0[_0xa8c6('0x10')]['message']);}logger[_0xa8c6('0x10')](_0xa8c6('0xb'),_0x56975c,_0x2b6ba0[_0xa8c6('0x10')][_0xa8c6('0x11')]);return _0x36f68f(_0x2b6ba0['error'][_0xa8c6('0x11')]);}else{logger['info'](_0xa8c6('0xb'),_0x56975c,'request\x20sent');_0x36f68f(_0x2b6ba0[_0xa8c6('0x12')][_0xa8c6('0x11')]);}})[_0xa8c6('0x13')](function(_0x307e73){logger[_0xa8c6('0x10')](_0xa8c6('0xb'),_0x56975c,_0x307e73);_0x5cb78e(_0x307e73);});});} \ No newline at end of file +var _0x98e6=['../../config/environment','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x5e3a45,_0x45f0c5){var _0x13419f=function(_0x5ac996){while(--_0x5ac996){_0x5e3a45['push'](_0x5e3a45['shift']());}};_0x13419f(++_0x45f0c5);}(_0x98e6,0x1be));var _0x698e=function(_0x406738,_0x3dbc07){_0x406738=_0x406738-0x0;var _0x3a76ca=_0x98e6[_0x406738];return _0x3a76ca;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x698e('0x0'));var rs=require(_0x698e('0x1'));var fs=require('fs');var db=require(_0x698e('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x698e('0x3'))('rpc');var config=require(_0x698e('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x698e('0x5')][_0x698e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x32cd14,_0x22addb,_0x6ebd50){return new BPromise(function(_0x1bb4ce,_0x153d2b){return client[_0x698e('0x7')](_0x32cd14,_0x6ebd50)[_0x698e('0x8')](function(_0x4a4c78){logger[_0x698e('0x9')](_0x698e('0xa'),_0x22addb,_0x698e('0xb'));logger[_0x698e('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x22addb,_0x698e('0xb'),JSON['stringify'](_0x4a4c78));if(_0x4a4c78[_0x698e('0xd')]){if(_0x4a4c78[_0x698e('0xd')][_0x698e('0xe')]===0x1f4){logger[_0x698e('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x22addb,_0x4a4c78[_0x698e('0xd')][_0x698e('0xf')]);return _0x153d2b(_0x4a4c78[_0x698e('0xd')][_0x698e('0xf')]);}logger[_0x698e('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x22addb,_0x4a4c78[_0x698e('0xd')][_0x698e('0xf')]);return _0x1bb4ce(_0x4a4c78[_0x698e('0xd')][_0x698e('0xf')]);}else{logger['info'](_0x698e('0xa'),_0x22addb,_0x698e('0xb'));_0x1bb4ce(_0x4a4c78[_0x698e('0x10')][_0x698e('0xf')]);}})[_0x698e('0x11')](function(_0x165530){logger[_0x698e('0xd')](_0x698e('0xa'),_0x22addb,_0x165530);_0x153d2b(_0x165530);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index cda8a46..c0869bc 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 _0x62fc=['get','isAuthenticated','show','put','update','/:id','destroy','exports','util','express','Router','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x62fc,0xda));var _0xc62f=function(_0xb51a2d,_0x5c7437){_0xb51a2d=_0xb51a2d-0x0;var _0x1ea1e0=_0x62fc[_0xb51a2d];return _0x1ea1e0;};'use strict';var multer=require('multer');var util=require(_0xc62f('0x0'));var path=require('path');var express=require(_0xc62f('0x1'));var router=express[_0xc62f('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xc62f('0x3'));var config=require(_0xc62f('0x4'));var controller=require(_0xc62f('0x5'));router[_0xc62f('0x6')]('/',auth[_0xc62f('0x7')](),controller['index']);router[_0xc62f('0x6')]('/:id',auth[_0xc62f('0x7')](),controller[_0xc62f('0x8')]);router['post']('/',auth[_0xc62f('0x7')](),controller['create']);router[_0xc62f('0x9')]('/:id',auth[_0xc62f('0x7')](),controller[_0xc62f('0xa')]);router['delete'](_0xc62f('0xb'),auth[_0xc62f('0x7')](),controller[_0xc62f('0xc')]);module[_0xc62f('0xd')]=router; \ No newline at end of file +var _0x44d9=['show','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','./intFreshdeskField.controller','isAuthenticated','index','get','/:id'];(function(_0x119705,_0xba9427){var _0x2affc2=function(_0x16f7e2){while(--_0x16f7e2){_0x119705['push'](_0x119705['shift']());}};_0x2affc2(++_0xba9427);}(_0x44d9,0x85));var _0x944d=function(_0x5d10e9,_0x1d41c3){_0x5d10e9=_0x5d10e9-0x0;var _0x349847=_0x44d9[_0x5d10e9];return _0x349847;};'use strict';var multer=require(_0x944d('0x0'));var util=require(_0x944d('0x1'));var path=require(_0x944d('0x2'));var express=require(_0x944d('0x3'));var router=express[_0x944d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x944d('0x5'));var config=require('../../config/environment');var controller=require(_0x944d('0x6'));router['get']('/',auth[_0x944d('0x7')](),controller[_0x944d('0x8')]);router[_0x944d('0x9')](_0x944d('0xa'),auth[_0x944d('0x7')](),controller[_0x944d('0xb')]);router['post']('/',auth[_0x944d('0x7')](),controller[_0x944d('0xc')]);router[_0x944d('0xd')](_0x944d('0xa'),auth['isAuthenticated'](),controller[_0x944d('0xe')]);router[_0x944d('0xf')](_0x944d('0xa'),auth[_0x944d('0x7')](),controller[_0x944d('0x10')]);module[_0x944d('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 94e4f4b..38d30c3 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 _0x6e6c=['variable','STRING','BOOLEAN','sequelize','exports','string'];(function(_0x40f59c,_0x1a7c33){var _0x36f110=function(_0x494939){while(--_0x494939){_0x40f59c['push'](_0x40f59c['shift']());}};_0x36f110(++_0x1a7c33);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xc6e6('0x0'));module[_0xc6e6('0x1')]={'type':{'type':Sequelize['ENUM'](_0xc6e6('0x2'),_0xc6e6('0x3'),'customVariable','keyValue'),'defaultValue':_0xc6e6('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc6e6('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0xc6e6('0x2'),_0xc6e6('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xc6e6('0x4')]},'idField':{'type':Sequelize[_0xc6e6('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc6e6('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc6e6('0x4')]}}; \ No newline at end of file +var _0x1be1=['STRING','variable','BOOLEAN','ENUM','string','customVariable','keyValue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1be1,0x192));var _0x11be=function(_0x349bfa,_0x5db9d5){_0x349bfa=_0x349bfa-0x0;var _0xfd1ef=_0x1be1[_0x349bfa];return _0xfd1ef;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x11be('0x0')](_0x11be('0x1'),'variable',_0x11be('0x2'),_0x11be('0x3')),'defaultValue':_0x11be('0x1')},'content':{'type':Sequelize[_0x11be('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x11be('0x0')](_0x11be('0x1'),_0x11be('0x5'),'customVariable')},'keyContent':{'type':Sequelize[_0x11be('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x11be('0x4')]},'customField':{'type':Sequelize[_0x11be('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x11be('0x4')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index b54801a..6d566ae 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 _0xd1f8=['util','sox','ejs','squel','crypto','desk.js','to-csv','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','error','stack','name','send','index','FreshdeskField','rawAttributes','keys','query','dateEnd','filters','intersection','model','attributes','fields','length','nolimit','order','sort','dateStart','day','add','where','filter','map','merge','options','include','rows','catch','show','params','find','create','body','fast-json-patch','request-promise','moment','bluebird'];(function(_0x45cb2b,_0x285349){var _0x9411a6=function(_0x15da36){while(--_0x15da36){_0x45cb2b['push'](_0x45cb2b['shift']());}};_0x9411a6(++_0x285349);}(_0xd1f8,0x18e));var _0x8d1f=function(_0x402c8f,_0x30cc1d){_0x402c8f=_0x402c8f-0x0;var _0x11e809=_0xd1f8[_0x402c8f];return _0x11e809;};'use strict';var jsonpatch=require(_0x8d1f('0x0'));var rp=require(_0x8d1f('0x1'));var moment=require(_0x8d1f('0x2'));var BPromise=require(_0x8d1f('0x3'));var Mustache=require('mustache');var util=require(_0x8d1f('0x4'));var path=require('path');var sox=require(_0x8d1f('0x5'));var csv=require('to-csv');var ejs=require(_0x8d1f('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8d1f('0x7'));var crypto=require(_0x8d1f('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x8d1f('0x9'));var toCsv=require(_0x8d1f('0xa'));var querystring=require(_0x8d1f('0xb'));var Papa=require(_0x8d1f('0xc'));var qs=require(_0x8d1f('0xd'));var logger=require('../../config/logger')(_0x8d1f('0xe'));var utils=require(_0x8d1f('0xf'));var config=require('../../config/environment');var db=require(_0x8d1f('0x10'))['db'];function respondWithStatusCode(_0x470e55,_0x228a85){_0x228a85=_0x228a85||0xcc;return function(_0x425838){if(_0x425838){return _0x470e55[_0x8d1f('0x11')](_0x228a85);}return _0x470e55['status'](_0x228a85)['end']();};}function respondWithResult(_0x140dfa,_0x525334){_0x525334=_0x525334||0xc8;return function(_0x236eaf){if(_0x236eaf){return _0x140dfa[_0x8d1f('0x12')](_0x525334)['json'](_0x236eaf);}};}function respondWithFilteredResult(_0x52cd91,_0x2052f6){return function(_0x50ccc){if(_0x50ccc){var _0x5e0805=_0x50ccc[_0x8d1f('0x13')],_0x7d9ae5=_0x2052f6[_0x8d1f('0x14')],_0x8c423c=_0x2052f6[_0x8d1f('0x14')]+_0x2052f6[_0x8d1f('0x15')],_0x443511;if(_0x8c423c>=_0x5e0805){_0x8c423c=_0x5e0805;_0x443511=0xc8;}else{_0x443511=0xce;}_0x52cd91[_0x8d1f('0x12')](_0x443511);return _0x52cd91[_0x8d1f('0x16')](_0x8d1f('0x17'),_0x7d9ae5+'-'+_0x8c423c+'/'+_0x5e0805)[_0x8d1f('0x18')](_0x50ccc);}return null;};}function patchUpdates(_0x1c106a){return function(_0x431beb){try{jsonpatch[_0x8d1f('0x19')](_0x431beb,_0x1c106a,!![]);}catch(_0x3b33c9){return BPromise[_0x8d1f('0x1a')](_0x3b33c9);}return _0x431beb[_0x8d1f('0x1b')]();};}function saveUpdates(_0x495655,_0x4c39d9){return function(_0x1f921a){if(_0x1f921a){return _0x1f921a[_0x8d1f('0x1c')](_0x495655)[_0x8d1f('0x1d')](function(_0x11948d){return _0x11948d;});}return null;};}function removeEntity(_0x224b46,_0x20241e){return function(_0x59bd2f){if(_0x59bd2f){return _0x59bd2f[_0x8d1f('0x1e')]()[_0x8d1f('0x1d')](function(){_0x224b46[_0x8d1f('0x12')](0xcc)[_0x8d1f('0x1f')]();});}};}function handleEntityNotFound(_0x4d5466,_0x47cfb0){return function(_0x4519bc){if(!_0x4519bc){_0x4d5466[_0x8d1f('0x11')](0x194);}return _0x4519bc;};}function handleError(_0x5175a5,_0xc7f18e){_0xc7f18e=_0xc7f18e||0x1f4;return function(_0x55faa4){logger[_0x8d1f('0x20')](_0x55faa4[_0x8d1f('0x21')]);if(_0x55faa4[_0x8d1f('0x22')]){delete _0x55faa4[_0x8d1f('0x22')];}_0x5175a5[_0x8d1f('0x12')](_0xc7f18e)[_0x8d1f('0x23')](_0x55faa4);};}exports[_0x8d1f('0x24')]=function(_0x38170b,_0x296d0c){var _0x4ba072={},_0x24c04a={},_0x213321={'count':0x0,'rows':[]};var _0x584157=db[_0x8d1f('0x25')][_0x8d1f('0x26')];_0x24c04a['model']=_[_0x8d1f('0x27')](_0x584157);var _0x2dbc3d={'dateStart':_0x38170b[_0x8d1f('0x28')]['dateStart'],'dateEnd':_0x38170b[_0x8d1f('0x28')][_0x8d1f('0x29')]};delete _0x38170b[_0x8d1f('0x28')]['dateStart'];delete _0x38170b[_0x8d1f('0x28')]['dateEnd'];_0x24c04a['query']=_[_0x8d1f('0x27')](_0x38170b[_0x8d1f('0x28')]);_0x24c04a[_0x8d1f('0x2a')]=_[_0x8d1f('0x2b')](_0x24c04a[_0x8d1f('0x2c')],_0x24c04a[_0x8d1f('0x28')]);_0x4ba072[_0x8d1f('0x2d')]=_[_0x8d1f('0x2b')](_0x24c04a['model'],qs[_0x8d1f('0x2e')](_0x38170b[_0x8d1f('0x28')][_0x8d1f('0x2e')]));_0x4ba072[_0x8d1f('0x2d')]=_0x4ba072[_0x8d1f('0x2d')][_0x8d1f('0x2f')]?_0x4ba072['attributes']:_0x24c04a[_0x8d1f('0x2c')];if(!_0x38170b[_0x8d1f('0x28')]['hasOwnProperty'](_0x8d1f('0x30'))){_0x4ba072[_0x8d1f('0x15')]=qs['limit'](_0x38170b['query']['limit']);_0x4ba072[_0x8d1f('0x14')]=qs[_0x8d1f('0x14')](_0x38170b[_0x8d1f('0x28')][_0x8d1f('0x14')]);}_0x4ba072[_0x8d1f('0x31')]=qs[_0x8d1f('0x32')](_0x38170b[_0x8d1f('0x28')][_0x8d1f('0x32')]);_0x4ba072['where']=qs['filters'](_['pick'](_0x38170b[_0x8d1f('0x28')],_0x24c04a[_0x8d1f('0x2a')]));if(_0x2dbc3d[_0x8d1f('0x33')]){if(_0x2dbc3d[_0x8d1f('0x29')]){_0x2dbc3d[_0x8d1f('0x29')]=moment(_0x2dbc3d[_0x8d1f('0x29')])['add'](0x1,_0x8d1f('0x34'));}else{_0x2dbc3d['dateEnd']=moment(_0x2dbc3d[_0x8d1f('0x33')])[_0x8d1f('0x35')](0x1,'day');}_['merge'](_0x4ba072[_0x8d1f('0x36')],{'createdAt':{'$gte':_0x2dbc3d[_0x8d1f('0x33')],'$lte':_0x2dbc3d[_0x8d1f('0x29')]}});}if(_0x38170b[_0x8d1f('0x28')][_0x8d1f('0x37')]){_0x4ba072[_0x8d1f('0x36')]=_['merge'](_0x4ba072[_0x8d1f('0x36')],{'$or':_[_0x8d1f('0x38')](_0x4ba072[_0x8d1f('0x2d')],function(_0x19273f){var _0x331a10={};_0x331a10[_0x19273f]={'$like':'%'+_0x38170b[_0x8d1f('0x28')][_0x8d1f('0x37')]+'%'};return _0x331a10;})});}_0x4ba072=_[_0x8d1f('0x39')]({},_0x4ba072,_0x38170b[_0x8d1f('0x3a')]);var _0x2f1c93={'where':_0x4ba072[_0x8d1f('0x36')]};return db['FreshdeskField'][_0x8d1f('0x13')](_0x2f1c93)[_0x8d1f('0x1d')](function(_0x1dfa97){_0x213321['count']=_0x1dfa97;if(_0x38170b['query']['includeAll']){_0x4ba072[_0x8d1f('0x3b')]=[{'all':!![]}];}return db[_0x8d1f('0x25')]['findAll'](_0x4ba072);})[_0x8d1f('0x1d')](function(_0x1dfd62){_0x213321[_0x8d1f('0x3c')]=_0x1dfd62;return _0x213321;})[_0x8d1f('0x1d')](respondWithFilteredResult(_0x296d0c,_0x4ba072))[_0x8d1f('0x3d')](handleError(_0x296d0c,null));};exports[_0x8d1f('0x3e')]=function(_0x345d19,_0x279e9a){var _0x1b8186={'raw':!![],'where':{'id':_0x345d19[_0x8d1f('0x3f')]['id']}},_0x2d891e={};_0x2d891e['model']=_[_0x8d1f('0x27')](db[_0x8d1f('0x25')]['rawAttributes']);_0x2d891e[_0x8d1f('0x28')]=_[_0x8d1f('0x27')](_0x345d19[_0x8d1f('0x28')]);_0x2d891e[_0x8d1f('0x2a')]=_['intersection'](_0x2d891e['model'],_0x2d891e['query']);_0x1b8186['attributes']=_[_0x8d1f('0x2b')](_0x2d891e[_0x8d1f('0x2c')],qs['fields'](_0x345d19[_0x8d1f('0x28')]['fields']));_0x1b8186['attributes']=_0x1b8186['attributes'][_0x8d1f('0x2f')]?_0x1b8186[_0x8d1f('0x2d')]:_0x2d891e[_0x8d1f('0x2c')];if(_0x345d19[_0x8d1f('0x28')]['includeAll']){_0x1b8186[_0x8d1f('0x3b')]=[{'all':!![]}];}_0x1b8186=_['merge']({},_0x1b8186,_0x345d19['options']);return db[_0x8d1f('0x25')][_0x8d1f('0x40')](_0x1b8186)[_0x8d1f('0x1d')](handleEntityNotFound(_0x279e9a,null))[_0x8d1f('0x1d')](respondWithResult(_0x279e9a,null))[_0x8d1f('0x3d')](handleError(_0x279e9a,null));};exports[_0x8d1f('0x41')]=function(_0x103957,_0x436125){return db[_0x8d1f('0x25')]['create'](_0x103957[_0x8d1f('0x42')],{})[_0x8d1f('0x1d')](respondWithResult(_0x436125,0xc9))[_0x8d1f('0x3d')](handleError(_0x436125,null));};exports[_0x8d1f('0x1c')]=function(_0x174093,_0x239111){if(_0x174093[_0x8d1f('0x42')]['id']){delete _0x174093[_0x8d1f('0x42')]['id'];}return db[_0x8d1f('0x25')][_0x8d1f('0x40')]({'where':{'id':_0x174093[_0x8d1f('0x3f')]['id']}})[_0x8d1f('0x1d')](handleEntityNotFound(_0x239111,null))[_0x8d1f('0x1d')](saveUpdates(_0x174093[_0x8d1f('0x42')],null))[_0x8d1f('0x1d')](respondWithResult(_0x239111,null))[_0x8d1f('0x3d')](handleError(_0x239111,null));};exports['destroy']=function(_0x21a44a,_0xe7e4e3){return db[_0x8d1f('0x25')][_0x8d1f('0x40')]({'where':{'id':_0x21a44a[_0x8d1f('0x3f')]['id']}})[_0x8d1f('0x1d')](handleEntityNotFound(_0xe7e4e3,null))[_0x8d1f('0x1d')](removeEntity(_0xe7e4e3,null))[_0x8d1f('0x3d')](handleError(_0xe7e4e3,null));}; \ No newline at end of file +var _0x34bd=['nolimit','order','sort','where','add','day','merge','filter','map','options','FreshdeskField','includeAll','findAll','params','catch','body','update','find','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','squel','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','reject','save','then','destroy','end','sendStatus','error','stack','name','send','index','rawAttributes','model','query','dateStart','dateEnd','keys','filters','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x34bd,0x1d2));var _0xd34b=function(_0x4c9ad2,_0x3bb687){_0x4c9ad2=_0x4c9ad2-0x0;var _0x507886=_0x34bd[_0x4c9ad2];return _0x507886;};'use strict';var jsonpatch=require(_0xd34b('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd34b('0x1'));var Mustache=require(_0xd34b('0x2'));var util=require(_0xd34b('0x3'));var path=require(_0xd34b('0x4'));var sox=require(_0xd34b('0x5'));var csv=require(_0xd34b('0x6'));var ejs=require(_0xd34b('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd34b('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd34b('0x6'));var querystring=require(_0xd34b('0x9'));var Papa=require(_0xd34b('0xa'));var qs=require(_0xd34b('0xb'));var logger=require(_0xd34b('0xc'))(_0xd34b('0xd'));var utils=require(_0xd34b('0xe'));var config=require(_0xd34b('0xf'));var db=require(_0xd34b('0x10'))['db'];function respondWithStatusCode(_0xa9672d,_0xb94ed2){_0xb94ed2=_0xb94ed2||0xcc;return function(_0xfbc101){if(_0xfbc101){return _0xa9672d['sendStatus'](_0xb94ed2);}return _0xa9672d[_0xd34b('0x11')](_0xb94ed2)['end']();};}function respondWithResult(_0x449bc1,_0x2e0e8c){_0x2e0e8c=_0x2e0e8c||0xc8;return function(_0x13dbae){if(_0x13dbae){return _0x449bc1[_0xd34b('0x11')](_0x2e0e8c)[_0xd34b('0x12')](_0x13dbae);}};}function respondWithFilteredResult(_0x3a11b2,_0x5b6e2d){return function(_0x41012b){if(_0x41012b){var _0x3af475=_0x41012b[_0xd34b('0x13')],_0x4a2dbf=_0x5b6e2d['offset'],_0x14e108=_0x5b6e2d[_0xd34b('0x14')]+_0x5b6e2d[_0xd34b('0x15')],_0x2f4fe4;if(_0x14e108>=_0x3af475){_0x14e108=_0x3af475;_0x2f4fe4=0xc8;}else{_0x2f4fe4=0xce;}_0x3a11b2['status'](_0x2f4fe4);return _0x3a11b2[_0xd34b('0x16')]('Content-Range',_0x4a2dbf+'-'+_0x14e108+'/'+_0x3af475)[_0xd34b('0x12')](_0x41012b);}return null;};}function patchUpdates(_0x438b61){return function(_0x2ace5a){try{jsonpatch['apply'](_0x2ace5a,_0x438b61,!![]);}catch(_0x152c8d){return BPromise[_0xd34b('0x17')](_0x152c8d);}return _0x2ace5a[_0xd34b('0x18')]();};}function saveUpdates(_0x105f67,_0x206f16){return function(_0x5d45e5){if(_0x5d45e5){return _0x5d45e5['update'](_0x105f67)[_0xd34b('0x19')](function(_0x327b91){return _0x327b91;});}return null;};}function removeEntity(_0xdfcc11,_0x1e4523){return function(_0x291a00){if(_0x291a00){return _0x291a00[_0xd34b('0x1a')]()['then'](function(){_0xdfcc11[_0xd34b('0x11')](0xcc)[_0xd34b('0x1b')]();});}};}function handleEntityNotFound(_0x1ae4ec,_0x17466c){return function(_0x5f1f0d){if(!_0x5f1f0d){_0x1ae4ec[_0xd34b('0x1c')](0x194);}return _0x5f1f0d;};}function handleError(_0x259abb,_0x92bcb3){_0x92bcb3=_0x92bcb3||0x1f4;return function(_0x219673){logger[_0xd34b('0x1d')](_0x219673[_0xd34b('0x1e')]);if(_0x219673['name']){delete _0x219673[_0xd34b('0x1f')];}_0x259abb['status'](_0x92bcb3)[_0xd34b('0x20')](_0x219673);};}exports[_0xd34b('0x21')]=function(_0x54c88a,_0x5f3325){var _0x5e5519={},_0x1d4c8b={},_0x187b33={'count':0x0,'rows':[]};var _0x14b8b9=db['FreshdeskField'][_0xd34b('0x22')];_0x1d4c8b[_0xd34b('0x23')]=_['keys'](_0x14b8b9);var _0x21a653={'dateStart':_0x54c88a[_0xd34b('0x24')][_0xd34b('0x25')],'dateEnd':_0x54c88a['query'][_0xd34b('0x26')]};delete _0x54c88a['query'][_0xd34b('0x25')];delete _0x54c88a[_0xd34b('0x24')][_0xd34b('0x26')];_0x1d4c8b['query']=_[_0xd34b('0x27')](_0x54c88a['query']);_0x1d4c8b[_0xd34b('0x28')]=_['intersection'](_0x1d4c8b[_0xd34b('0x23')],_0x1d4c8b['query']);_0x5e5519[_0xd34b('0x29')]=_[_0xd34b('0x2a')](_0x1d4c8b['model'],qs[_0xd34b('0x2b')](_0x54c88a[_0xd34b('0x24')][_0xd34b('0x2b')]));_0x5e5519['attributes']=_0x5e5519[_0xd34b('0x29')][_0xd34b('0x2c')]?_0x5e5519[_0xd34b('0x29')]:_0x1d4c8b['model'];if(!_0x54c88a[_0xd34b('0x24')][_0xd34b('0x2d')](_0xd34b('0x2e'))){_0x5e5519[_0xd34b('0x15')]=qs[_0xd34b('0x15')](_0x54c88a[_0xd34b('0x24')][_0xd34b('0x15')]);_0x5e5519['offset']=qs[_0xd34b('0x14')](_0x54c88a[_0xd34b('0x24')][_0xd34b('0x14')]);}_0x5e5519[_0xd34b('0x2f')]=qs[_0xd34b('0x30')](_0x54c88a['query'][_0xd34b('0x30')]);_0x5e5519[_0xd34b('0x31')]=qs[_0xd34b('0x28')](_['pick'](_0x54c88a['query'],_0x1d4c8b[_0xd34b('0x28')]));if(_0x21a653[_0xd34b('0x25')]){if(_0x21a653[_0xd34b('0x26')]){_0x21a653['dateEnd']=moment(_0x21a653[_0xd34b('0x26')])[_0xd34b('0x32')](0x1,_0xd34b('0x33'));}else{_0x21a653[_0xd34b('0x26')]=moment(_0x21a653['dateStart'])['add'](0x1,_0xd34b('0x33'));}_[_0xd34b('0x34')](_0x5e5519['where'],{'createdAt':{'$gte':_0x21a653['dateStart'],'$lte':_0x21a653['dateEnd']}});}if(_0x54c88a[_0xd34b('0x24')][_0xd34b('0x35')]){_0x5e5519['where']=_[_0xd34b('0x34')](_0x5e5519[_0xd34b('0x31')],{'$or':_[_0xd34b('0x36')](_0x5e5519[_0xd34b('0x29')],function(_0x11f707){var _0x51db95={};_0x51db95[_0x11f707]={'$like':'%'+_0x54c88a[_0xd34b('0x24')][_0xd34b('0x35')]+'%'};return _0x51db95;})});}_0x5e5519=_[_0xd34b('0x34')]({},_0x5e5519,_0x54c88a[_0xd34b('0x37')]);var _0x589ec9={'where':_0x5e5519[_0xd34b('0x31')]};return db[_0xd34b('0x38')]['count'](_0x589ec9)['then'](function(_0x3f9aeb){_0x187b33[_0xd34b('0x13')]=_0x3f9aeb;if(_0x54c88a[_0xd34b('0x24')][_0xd34b('0x39')]){_0x5e5519['include']=[{'all':!![]}];}return db[_0xd34b('0x38')][_0xd34b('0x3a')](_0x5e5519);})['then'](function(_0x58fe5d){_0x187b33['rows']=_0x58fe5d;return _0x187b33;})[_0xd34b('0x19')](respondWithFilteredResult(_0x5f3325,_0x5e5519))['catch'](handleError(_0x5f3325,null));};exports['show']=function(_0x431f01,_0x5a7bc6){var _0x44ee0c={'raw':!![],'where':{'id':_0x431f01[_0xd34b('0x3b')]['id']}},_0x5579d7={};_0x5579d7[_0xd34b('0x23')]=_[_0xd34b('0x27')](db[_0xd34b('0x38')][_0xd34b('0x22')]);_0x5579d7['query']=_[_0xd34b('0x27')](_0x431f01[_0xd34b('0x24')]);_0x5579d7[_0xd34b('0x28')]=_[_0xd34b('0x2a')](_0x5579d7[_0xd34b('0x23')],_0x5579d7[_0xd34b('0x24')]);_0x44ee0c[_0xd34b('0x29')]=_[_0xd34b('0x2a')](_0x5579d7[_0xd34b('0x23')],qs[_0xd34b('0x2b')](_0x431f01[_0xd34b('0x24')][_0xd34b('0x2b')]));_0x44ee0c['attributes']=_0x44ee0c['attributes'][_0xd34b('0x2c')]?_0x44ee0c[_0xd34b('0x29')]:_0x5579d7['model'];if(_0x431f01[_0xd34b('0x24')][_0xd34b('0x39')]){_0x44ee0c['include']=[{'all':!![]}];}_0x44ee0c=_[_0xd34b('0x34')]({},_0x44ee0c,_0x431f01[_0xd34b('0x37')]);return db['FreshdeskField']['find'](_0x44ee0c)[_0xd34b('0x19')](handleEntityNotFound(_0x5a7bc6,null))[_0xd34b('0x19')](respondWithResult(_0x5a7bc6,null))[_0xd34b('0x3c')](handleError(_0x5a7bc6,null));};exports['create']=function(_0x33c2ef,_0x47acc6){return db[_0xd34b('0x38')]['create'](_0x33c2ef[_0xd34b('0x3d')],{})['then'](respondWithResult(_0x47acc6,0xc9))[_0xd34b('0x3c')](handleError(_0x47acc6,null));};exports[_0xd34b('0x3e')]=function(_0x2fee4e,_0x334661){if(_0x2fee4e[_0xd34b('0x3d')]['id']){delete _0x2fee4e[_0xd34b('0x3d')]['id'];}return db[_0xd34b('0x38')][_0xd34b('0x3f')]({'where':{'id':_0x2fee4e[_0xd34b('0x3b')]['id']}})[_0xd34b('0x19')](handleEntityNotFound(_0x334661,null))[_0xd34b('0x19')](saveUpdates(_0x2fee4e[_0xd34b('0x3d')],null))[_0xd34b('0x19')](respondWithResult(_0x334661,null))[_0xd34b('0x3c')](handleError(_0x334661,null));};exports[_0xd34b('0x1a')]=function(_0x35549f,_0x4dc1c5){return db[_0xd34b('0x38')][_0xd34b('0x3f')]({'where':{'id':_0x35549f[_0xd34b('0x3b')]['id']}})[_0xd34b('0x19')](handleEntityNotFound(_0x4dc1c5,null))[_0xd34b('0x19')](removeEntity(_0x4dc1c5,null))[_0xd34b('0x3c')](handleError(_0x4dc1c5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index de89b77..539691e 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 _0xccde=['moment','bluebird','exports','define','FreshdeskField','lodash','../../config/logger'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xccde,0x1e1));var _0xeccd=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xccde[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0xeccd('0x0'));var util=require('util');var logger=require(_0xeccd('0x1'))('api');var moment=require(_0xeccd('0x2'));var BPromise=require(_0xeccd('0x3'));var rp=require('request-promise');var attributes=require('./intFreshdeskField.attributes');module[_0xeccd('0x4')]=function(_0x3eede4,_0x175682){return _0x3eede4[_0xeccd('0x5')](_0xeccd('0x6'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a37=['./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2b70f8,_0x361789){var _0x2f741e=function(_0x50d901){while(--_0x50d901){_0x2b70f8['push'](_0x2b70f8['shift']());}};_0x2f741e(++_0x361789);}(_0x1a37,0xb4));var _0x71a3=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x1a37[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var logger=require(_0x71a3('0x2'))(_0x71a3('0x3'));var moment=require(_0x71a3('0x4'));var BPromise=require(_0x71a3('0x5'));var rp=require(_0x71a3('0x6'));var attributes=require(_0x71a3('0x7'));module[_0x71a3('0x8')]=function(_0x100181,_0x4af5b4){return _0x100181[_0x71a3('0x9')]('FreshdeskField',attributes,{'tableName':_0x71a3('0xa'),'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 6d3d58a..62eb4b3 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 _0x8dda=['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','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5053b6,_0x128dd9){var _0xf5b176=function(_0x1b301c){while(--_0x1b301c){_0x5053b6['push'](_0x5053b6['shift']());}};_0xf5b176(++_0x128dd9);}(_0x8dda,0x13a));var _0xa8dd=function(_0x5443e2,_0xe2863c){_0x5443e2=_0x5443e2-0x0;var _0x5cb7c0=_0x8dda[_0x5443e2];return _0x5cb7c0;};'use strict';var _=require(_0xa8dd('0x0'));var util=require('util');var moment=require(_0xa8dd('0x1'));var BPromise=require(_0xa8dd('0x2'));var rs=require(_0xa8dd('0x3'));var fs=require('fs');var db=require(_0xa8dd('0x4'))['db'];var utils=require(_0xa8dd('0x5'));var logger=require(_0xa8dd('0x6'))(_0xa8dd('0x7'));var config=require(_0xa8dd('0x8'));var jayson=require(_0xa8dd('0x9'));var client=jayson[_0xa8dd('0xa')][_0xa8dd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39108c,_0x2b167c,_0x5de8be){return new BPromise(function(_0x89cf0e,_0x5246fb){return client[_0xa8dd('0xc')](_0x39108c,_0x5de8be)[_0xa8dd('0xd')](function(_0x59fa60){logger[_0xa8dd('0xe')](_0xa8dd('0xf'),_0x2b167c,_0xa8dd('0x10'));logger[_0xa8dd('0x11')](_0xa8dd('0x12'),_0x2b167c,_0xa8dd('0x10'),JSON[_0xa8dd('0x13')](_0x59fa60));if(_0x59fa60[_0xa8dd('0x14')]){if(_0x59fa60['error'][_0xa8dd('0x15')]===0x1f4){logger[_0xa8dd('0x14')](_0xa8dd('0xf'),_0x2b167c,_0x59fa60[_0xa8dd('0x14')][_0xa8dd('0x16')]);return _0x5246fb(_0x59fa60['error'][_0xa8dd('0x16')]);}logger[_0xa8dd('0x14')]('FreshdeskField,\x20%s,\x20%s',_0x2b167c,_0x59fa60[_0xa8dd('0x14')][_0xa8dd('0x16')]);return _0x89cf0e(_0x59fa60[_0xa8dd('0x14')][_0xa8dd('0x16')]);}else{logger['info'](_0xa8dd('0xf'),_0x2b167c,_0xa8dd('0x10'));_0x89cf0e(_0x59fa60[_0xa8dd('0x17')][_0xa8dd('0x16')]);}})[_0xa8dd('0x18')](function(_0x18feef){logger['error'](_0xa8dd('0xf'),_0x2b167c,_0x18feef);_0x5246fb(_0x18feef);});});} \ No newline at end of file +var _0x0cde=['../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x5c59e9,_0x253541){var _0x56b0b3=function(_0xeb6ad2){while(--_0xeb6ad2){_0x5c59e9['push'](_0x5c59e9['shift']());}};_0x56b0b3(++_0x253541);}(_0x0cde,0x19c));var _0xe0cd=function(_0x402158,_0x19738e){_0x402158=_0x402158-0x0;var _0x1b29c2=_0x0cde[_0x402158];return _0x1b29c2;};'use strict';var _=require(_0xe0cd('0x0'));var util=require(_0xe0cd('0x1'));var moment=require(_0xe0cd('0x2'));var BPromise=require(_0xe0cd('0x3'));var rs=require(_0xe0cd('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xe0cd('0x5'));var logger=require(_0xe0cd('0x6'))('rpc');var config=require(_0xe0cd('0x7'));var jayson=require(_0xe0cd('0x8'));var client=jayson[_0xe0cd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b3ee0,_0x16d5a5,_0x223784){return new BPromise(function(_0x45309b,_0x2c8853){return client[_0xe0cd('0xa')](_0x5b3ee0,_0x223784)[_0xe0cd('0xb')](function(_0x2b1541){logger[_0xe0cd('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x16d5a5,_0xe0cd('0xd'));logger[_0xe0cd('0xe')](_0xe0cd('0xf'),_0x16d5a5,_0xe0cd('0xd'),JSON[_0xe0cd('0x10')](_0x2b1541));if(_0x2b1541['error']){if(_0x2b1541[_0xe0cd('0x11')][_0xe0cd('0x12')]===0x1f4){logger['error'](_0xe0cd('0x13'),_0x16d5a5,_0x2b1541[_0xe0cd('0x11')][_0xe0cd('0x14')]);return _0x2c8853(_0x2b1541[_0xe0cd('0x11')][_0xe0cd('0x14')]);}logger[_0xe0cd('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x16d5a5,_0x2b1541[_0xe0cd('0x11')][_0xe0cd('0x14')]);return _0x45309b(_0x2b1541[_0xe0cd('0x11')][_0xe0cd('0x14')]);}else{logger[_0xe0cd('0xc')](_0xe0cd('0x13'),_0x16d5a5,'request\x20sent');_0x45309b(_0x2b1541['result'][_0xe0cd('0x14')]);}})[_0xe0cd('0x15')](function(_0x2577ae){logger[_0xe0cd('0x11')](_0xe0cd('0x13'),_0x16d5a5,_0x2577ae);_0x2c8853(_0x2577ae);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index fff1448..5637ba3 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 _0xb0b3=['../../components/auth/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','post','addConfiguration','put','update','delete','destroy','util','express','Router'];(function(_0xd8dd34,_0x308cbc){var _0x467266=function(_0x40d598){while(--_0x40d598){_0xd8dd34['push'](_0xd8dd34['shift']());}};_0x467266(++_0x308cbc);}(_0xb0b3,0x7b));var _0x3b0b=function(_0x29996e,_0x429c6a){_0x29996e=_0x29996e-0x0;var _0xe026a5=_0xb0b3[_0x29996e];return _0xe026a5;};'use strict';var multer=require('multer');var util=require(_0x3b0b('0x0'));var path=require('path');var express=require(_0x3b0b('0x1'));var router=express[_0x3b0b('0x2')]();var auth=require(_0x3b0b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3b0b('0x4'));var controller=require(_0x3b0b('0x5'));router[_0x3b0b('0x6')]('/',auth['isAuthenticated'](),controller[_0x3b0b('0x7')]);router[_0x3b0b('0x6')](_0x3b0b('0x8'),auth['isAuthenticated'](),controller[_0x3b0b('0x9')]);router[_0x3b0b('0x6')](_0x3b0b('0xa'),auth[_0x3b0b('0xb')](),controller['getConfigurations']);router[_0x3b0b('0x6')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x3b0b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3b0b('0xc')](_0x3b0b('0xa'),auth[_0x3b0b('0xb')](),controller[_0x3b0b('0xd')]);router[_0x3b0b('0xe')]('/:id',auth[_0x3b0b('0xb')](),controller[_0x3b0b('0xf')]);router[_0x3b0b('0x10')]('/:id',auth[_0x3b0b('0xb')](),controller[_0x3b0b('0x11')]);module['exports']=router; \ No newline at end of file +var _0xfdb2=['get','/:id','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','multer','util','../../config/environment','./intSalesforceAccount.controller','isAuthenticated','index'];(function(_0x3acef9,_0x65d155){var _0x4bb694=function(_0x3fe5c2){while(--_0x3fe5c2){_0x3acef9['push'](_0x3acef9['shift']());}};_0x4bb694(++_0x65d155);}(_0xfdb2,0x8a));var _0x2fdb=function(_0x3ce0ff,_0x284faf){_0x3ce0ff=_0x3ce0ff-0x0;var _0x32963c=_0xfdb2[_0x3ce0ff];return _0x32963c;};'use strict';var multer=require(_0x2fdb('0x0'));var util=require(_0x2fdb('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(_0x2fdb('0x2'));var controller=require(_0x2fdb('0x3'));router['get']('/',auth[_0x2fdb('0x4')](),controller[_0x2fdb('0x5')]);router[_0x2fdb('0x6')](_0x2fdb('0x7'),auth['isAuthenticated'](),controller[_0x2fdb('0x8')]);router[_0x2fdb('0x6')](_0x2fdb('0x9'),auth[_0x2fdb('0x4')](),controller['getConfigurations']);router[_0x2fdb('0x6')](_0x2fdb('0xa'),auth[_0x2fdb('0x4')](),controller[_0x2fdb('0xb')]);router[_0x2fdb('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2fdb('0xc')](_0x2fdb('0x9'),auth[_0x2fdb('0x4')](),controller[_0x2fdb('0xd')]);router[_0x2fdb('0xe')](_0x2fdb('0x7'),auth[_0x2fdb('0x4')](),controller[_0x2fdb('0xf')]);router[_0x2fdb('0x10')](_0x2fdb('0x7'),auth[_0x2fdb('0x4')](),controller[_0x2fdb('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index bb784ca..d0688f0 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 _0x9f2a=['ENUM','integrationTab','sequelize','STRING','username'];(function(_0x2df84d,_0x56d874){var _0x2634ce=function(_0x8e8e31){while(--_0x8e8e31){_0x2df84d['push'](_0x2df84d['shift']());}};_0x2634ce(++_0x56d874);}(_0x9f2a,0xc5));var _0xa9f2=function(_0x3518e1,_0x5b3c10){_0x3518e1=_0x3518e1-0x0;var _0x54e74a=_0x9f2a[_0x3518e1];return _0x54e74a;};'use strict';var Sequelize=require(_0xa9f2('0x0'));module['exports']={'name':{'type':Sequelize[_0xa9f2('0x1')]},'description':{'type':Sequelize[_0xa9f2('0x1')]},'username':{'type':Sequelize[_0xa9f2('0x1')],'unique':_0xa9f2('0x2')},'remoteUri':{'type':Sequelize[_0xa9f2('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xa9f2('0x1')]},'serverUrl':{'type':Sequelize[_0xa9f2('0x1')]},'type':{'type':Sequelize[_0xa9f2('0x3')](_0xa9f2('0x4'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xf505=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf505,0x18f));var _0x5f50=function(_0x470212,_0x1387de){_0x470212=_0x470212-0x0;var _0x5083cb=_0xf505[_0x470212];return _0x5083cb;};'use strict';var Sequelize=require(_0x5f50('0x0'));module[_0x5f50('0x1')]={'name':{'type':Sequelize[_0x5f50('0x2')]},'description':{'type':Sequelize[_0x5f50('0x2')]},'username':{'type':Sequelize[_0x5f50('0x2')],'unique':_0x5f50('0x3')},'remoteUri':{'type':Sequelize[_0x5f50('0x2')]},'password':{'type':Sequelize[_0x5f50('0x2')]},'clientId':{'type':Sequelize[_0x5f50('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x5f50('0x2')]},'serverUrl':{'type':Sequelize[_0x5f50('0x2')]},'type':{'type':Sequelize[_0x5f50('0x4')](_0x5f50('0x5'),_0x5f50('0x6')),'defaultValue':_0x5f50('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index bfd7c04..7ce433f 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 _0xf28a=['intersection','fields','attributes','nolimit','order','pick','day','merge','where','map','options','include','findAll','rows','includeAll','create','update','body','find','params','destroy','findOne','SalesforceConfiguration','length','sort','filter','getConfigurations','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','SalesforceField','remoteUri','clientSecret','password','securityToken','Connection','login','username','sobject','Task','describe','CallDisposition','CallObject','CallType','Priority','Status','Type','remove','custom','includes','picklistValues','label','value','test','getFields','stringify','statusCode','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','stack','name','send','SalesforceAccount','rawAttributes','model','keys','query','dateStart','dateEnd','filters'];(function(_0x26bbd1,_0xb274f3){var _0x26b1eb=function(_0x4cf794){while(--_0x4cf794){_0x26bbd1['push'](_0x26bbd1['shift']());}};_0x26b1eb(++_0xb274f3);}(_0xf28a,0x1a1));var _0xaf28=function(_0x58aa35,_0x14d356){_0x58aa35=_0x58aa35-0x0;var _0x7066c8=_0xf28a[_0x58aa35];return _0x7066c8;};'use strict';var jsonpatch=require(_0xaf28('0x0'));var rp=require('request-promise');var moment=require(_0xaf28('0x1'));var BPromise=require(_0xaf28('0x2'));var Mustache=require(_0xaf28('0x3'));var util=require(_0xaf28('0x4'));var path=require(_0xaf28('0x5'));var sox=require(_0xaf28('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xaf28('0x7'));var squel=require(_0xaf28('0x8'));var crypto=require(_0xaf28('0x9'));var jsforce=require(_0xaf28('0xa'));var deskjs=require(_0xaf28('0xb'));var toCsv=require(_0xaf28('0xc'));var querystring=require(_0xaf28('0xd'));var Papa=require('papaparse');var qs=require(_0xaf28('0xe'));var logger=require(_0xaf28('0xf'))(_0xaf28('0x10'));var utils=require(_0xaf28('0x11'));var config=require(_0xaf28('0x12'));var db=require(_0xaf28('0x13'))['db'];var integrations=require(_0xaf28('0x14'));var jayson=require(_0xaf28('0x15'));var client=jayson[_0xaf28('0x16')][_0xaf28('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x3c60af,_0x5cdaf9,_0x28709d,_0x446e45){return new BPromise(function(_0x53e6d6,_0x4897c1){var _0x49607d=_0x446e45||client;return _0x49607d[_0xaf28('0x18')](_0x3c60af,_0x28709d)[_0xaf28('0x19')](function(_0x275c76){logger[_0xaf28('0x1a')](_0xaf28('0x1b'),_0x5cdaf9,'request\x20sent');logger[_0xaf28('0x1c')](_0xaf28('0x1d'),_0x5cdaf9,_0xaf28('0x1e'),JSON['stringify'](_0x275c76));if(_0x275c76[_0xaf28('0x1f')]){if(_0x275c76[_0xaf28('0x1f')][_0xaf28('0x20')]===0x1f4){logger[_0xaf28('0x1f')](_0xaf28('0x1b'),_0x5cdaf9,_0x275c76[_0xaf28('0x1f')][_0xaf28('0x21')]);return _0x4897c1(_0x275c76[_0xaf28('0x1f')][_0xaf28('0x21')]);}logger[_0xaf28('0x1f')]('SalesforceAccount,\x20%s,\x20%s',_0x5cdaf9,_0x275c76['error']['message']);return _0x53e6d6(_0x275c76[_0xaf28('0x1f')]['message']);}else{logger[_0xaf28('0x1a')](_0xaf28('0x1b'),_0x5cdaf9,_0xaf28('0x1e'));_0x53e6d6(_0x275c76[_0xaf28('0x22')][_0xaf28('0x21')]);}})[_0xaf28('0x23')](function(_0x1cd52a){logger[_0xaf28('0x1f')]('SalesforceAccount,\x20%s,\x20%s',_0x5cdaf9,_0x1cd52a);_0x4897c1(_0x1cd52a);});});}function respondWithStatusCode(_0x11fbac,_0x28a330){_0x28a330=_0x28a330||0xcc;return function(_0x3dadf0){if(_0x3dadf0){return _0x11fbac[_0xaf28('0x24')](_0x28a330);}return _0x11fbac['status'](_0x28a330)[_0xaf28('0x25')]();};}function respondWithResult(_0x1b8470,_0x677258){_0x677258=_0x677258||0xc8;return function(_0x5d7556){if(_0x5d7556){return _0x1b8470[_0xaf28('0x26')](_0x677258)[_0xaf28('0x27')](_0x5d7556);}};}function respondWithFilteredResult(_0x54705a,_0x25e35d){return function(_0x16cd9d){if(_0x16cd9d){var _0x285c97=_0x16cd9d[_0xaf28('0x28')],_0x4efd62=_0x25e35d[_0xaf28('0x29')],_0x5f3b32=_0x25e35d['offset']+_0x25e35d[_0xaf28('0x2a')],_0xd308;if(_0x5f3b32>=_0x285c97){_0x5f3b32=_0x285c97;_0xd308=0xc8;}else{_0xd308=0xce;}_0x54705a['status'](_0xd308);return _0x54705a[_0xaf28('0x2b')](_0xaf28('0x2c'),_0x4efd62+'-'+_0x5f3b32+'/'+_0x285c97)[_0xaf28('0x27')](_0x16cd9d);}return null;};}function patchUpdates(_0x1ed9fb){return function(_0x466ba0){try{jsonpatch[_0xaf28('0x2d')](_0x466ba0,_0x1ed9fb,!![]);}catch(_0x4132c6){return BPromise[_0xaf28('0x2e')](_0x4132c6);}return _0x466ba0[_0xaf28('0x2f')]();};}function saveUpdates(_0x529ff1,_0x7c242c){return function(_0x5a69a4){if(_0x5a69a4){return _0x5a69a4['update'](_0x529ff1)[_0xaf28('0x19')](function(_0x34f3bf){return _0x34f3bf;});}return null;};}function removeEntity(_0x4f3d92,_0xeb34f9){return function(_0x59d99b){if(_0x59d99b){return _0x59d99b['destroy']()[_0xaf28('0x19')](function(){_0x4f3d92[_0xaf28('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c9409,_0x4d0206){return function(_0x4aa562){if(!_0x4aa562){_0x4c9409['sendStatus'](0x194);}return _0x4aa562;};}function handleError(_0x1091c0,_0x1a237d){_0x1a237d=_0x1a237d||0x1f4;return function(_0x5c880){logger[_0xaf28('0x1f')](_0x5c880[_0xaf28('0x30')]);if(_0x5c880[_0xaf28('0x31')]){delete _0x5c880[_0xaf28('0x31')];}_0x1091c0[_0xaf28('0x26')](_0x1a237d)[_0xaf28('0x32')](_0x5c880);};}exports['index']=function(_0x3948b8,_0x331ab7){var _0x35fa7a={},_0x1d38e4={},_0x75cdcb={'count':0x0,'rows':[]};var _0x352f20=db[_0xaf28('0x33')][_0xaf28('0x34')];_0x1d38e4[_0xaf28('0x35')]=_[_0xaf28('0x36')](_0x352f20);var _0x8b137c={'dateStart':_0x3948b8[_0xaf28('0x37')][_0xaf28('0x38')],'dateEnd':_0x3948b8[_0xaf28('0x37')]['dateEnd']};delete _0x3948b8[_0xaf28('0x37')]['dateStart'];delete _0x3948b8[_0xaf28('0x37')][_0xaf28('0x39')];_0x1d38e4[_0xaf28('0x37')]=_['keys'](_0x3948b8[_0xaf28('0x37')]);_0x1d38e4[_0xaf28('0x3a')]=_[_0xaf28('0x3b')](_0x1d38e4[_0xaf28('0x35')],_0x1d38e4[_0xaf28('0x37')]);_0x35fa7a['attributes']=_[_0xaf28('0x3b')](_0x1d38e4[_0xaf28('0x35')],qs['fields'](_0x3948b8[_0xaf28('0x37')][_0xaf28('0x3c')]));_0x35fa7a[_0xaf28('0x3d')]=_0x35fa7a['attributes']['length']?_0x35fa7a['attributes']:_0x1d38e4['model'];if(!_0x3948b8[_0xaf28('0x37')]['hasOwnProperty'](_0xaf28('0x3e'))){_0x35fa7a[_0xaf28('0x2a')]=qs[_0xaf28('0x2a')](_0x3948b8[_0xaf28('0x37')][_0xaf28('0x2a')]);_0x35fa7a['offset']=qs[_0xaf28('0x29')](_0x3948b8[_0xaf28('0x37')][_0xaf28('0x29')]);}_0x35fa7a[_0xaf28('0x3f')]=qs['sort'](_0x3948b8[_0xaf28('0x37')]['sort']);_0x35fa7a['where']=qs[_0xaf28('0x3a')](_[_0xaf28('0x40')](_0x3948b8['query'],_0x1d38e4[_0xaf28('0x3a')]));if(_0x8b137c[_0xaf28('0x38')]){if(_0x8b137c[_0xaf28('0x39')]){_0x8b137c[_0xaf28('0x39')]=moment(_0x8b137c[_0xaf28('0x39')])['add'](0x1,_0xaf28('0x41'));}else{_0x8b137c[_0xaf28('0x39')]=moment(_0x8b137c[_0xaf28('0x38')])['add'](0x1,_0xaf28('0x41'));}_[_0xaf28('0x42')](_0x35fa7a['where'],{'createdAt':{'$gte':_0x8b137c[_0xaf28('0x38')],'$lte':_0x8b137c[_0xaf28('0x39')]}});}if(_0x3948b8['query']['filter']){_0x35fa7a[_0xaf28('0x43')]=_['merge'](_0x35fa7a['where'],{'$or':_[_0xaf28('0x44')](_0x35fa7a[_0xaf28('0x3d')],function(_0x586d24){var _0x35f1cd={};_0x35f1cd[_0x586d24]={'$like':'%'+_0x3948b8[_0xaf28('0x37')]['filter']+'%'};return _0x35f1cd;})});}_0x35fa7a=_['merge']({},_0x35fa7a,_0x3948b8[_0xaf28('0x45')]);var _0x59d573={'where':_0x35fa7a['where']};return db[_0xaf28('0x33')][_0xaf28('0x28')](_0x59d573)[_0xaf28('0x19')](function(_0x13675a){_0x75cdcb[_0xaf28('0x28')]=_0x13675a;if(_0x3948b8[_0xaf28('0x37')]['includeAll']){_0x35fa7a[_0xaf28('0x46')]=[{'all':!![]}];}return db[_0xaf28('0x33')][_0xaf28('0x47')](_0x35fa7a);})[_0xaf28('0x19')](function(_0x1b06a9){_0x75cdcb[_0xaf28('0x48')]=_0x1b06a9;return _0x75cdcb;})[_0xaf28('0x19')](respondWithFilteredResult(_0x331ab7,_0x35fa7a))[_0xaf28('0x23')](handleError(_0x331ab7,null));};exports['show']=function(_0x522f19,_0x45f307){var _0x34dcd3={'raw':![],'where':{'id':_0x522f19['params']['id']}},_0x230ac2={};_0x230ac2[_0xaf28('0x35')]=_[_0xaf28('0x36')](db[_0xaf28('0x33')][_0xaf28('0x34')]);_0x230ac2[_0xaf28('0x37')]=_[_0xaf28('0x36')](_0x522f19[_0xaf28('0x37')]);_0x230ac2['filters']=_[_0xaf28('0x3b')](_0x230ac2[_0xaf28('0x35')],_0x230ac2[_0xaf28('0x37')]);_0x34dcd3['attributes']=_[_0xaf28('0x3b')](_0x230ac2[_0xaf28('0x35')],qs[_0xaf28('0x3c')](_0x522f19[_0xaf28('0x37')][_0xaf28('0x3c')]));_0x34dcd3['attributes']=_0x34dcd3[_0xaf28('0x3d')]['length']?_0x34dcd3['attributes']:_0x230ac2[_0xaf28('0x35')];if(_0x522f19['query'][_0xaf28('0x49')]){_0x34dcd3['include']=[{'all':!![]}];}_0x34dcd3=_[_0xaf28('0x42')]({},_0x34dcd3,_0x522f19[_0xaf28('0x45')]);return db[_0xaf28('0x33')]['find'](_0x34dcd3)['then'](handleEntityNotFound(_0x45f307,null))[_0xaf28('0x19')](respondWithResult(_0x45f307,null))[_0xaf28('0x23')](handleError(_0x45f307,null));};exports[_0xaf28('0x4a')]=function(_0x1450d5,_0x5333ad){return db['SalesforceAccount'][_0xaf28('0x4a')](_0x1450d5['body'],{})[_0xaf28('0x19')](respondWithResult(_0x5333ad,0xc9))[_0xaf28('0x23')](handleError(_0x5333ad,null));};exports[_0xaf28('0x4b')]=function(_0x53b2fb,_0x2b8172){if(_0x53b2fb['body']['id']){delete _0x53b2fb[_0xaf28('0x4c')]['id'];}return db[_0xaf28('0x33')][_0xaf28('0x4d')]({'where':{'id':_0x53b2fb[_0xaf28('0x4e')]['id']}})[_0xaf28('0x19')](handleEntityNotFound(_0x2b8172,null))[_0xaf28('0x19')](saveUpdates(_0x53b2fb[_0xaf28('0x4c')],null))['then'](respondWithResult(_0x2b8172,null))['catch'](handleError(_0x2b8172,null));};exports[_0xaf28('0x4f')]=function(_0x234012,_0x2ac183){return db[_0xaf28('0x33')][_0xaf28('0x4d')]({'where':{'id':_0x234012['params']['id']}})[_0xaf28('0x19')](handleEntityNotFound(_0x2ac183,null))[_0xaf28('0x19')](removeEntity(_0x2ac183,null))[_0xaf28('0x23')](handleError(_0x2ac183,null));};exports['getConfigurations']=function(_0x4c1a9c,_0x13793f,_0x327b27){var _0x47178e={};var _0x12675f={};var _0x151ca3;var _0x4bae33;return db['SalesforceAccount'][_0xaf28('0x50')]({'where':{'id':_0x4c1a9c[_0xaf28('0x4e')]['id']}})['then'](handleEntityNotFound(_0x13793f,null))['then'](function(_0x2262aa){if(_0x2262aa){_0x151ca3=_0x2262aa;_0x12675f[_0xaf28('0x35')]=_[_0xaf28('0x36')](db[_0xaf28('0x51')][_0xaf28('0x34')]);_0x12675f[_0xaf28('0x37')]=_['keys'](_0x4c1a9c[_0xaf28('0x37')]);_0x12675f[_0xaf28('0x3a')]=_[_0xaf28('0x3b')](_0x12675f[_0xaf28('0x35')],_0x12675f['query']);_0x47178e[_0xaf28('0x3d')]=_[_0xaf28('0x3b')](_0x12675f[_0xaf28('0x35')],qs['fields'](_0x4c1a9c['query'][_0xaf28('0x3c')]));_0x47178e[_0xaf28('0x3d')]=_0x47178e[_0xaf28('0x3d')][_0xaf28('0x52')]?_0x47178e[_0xaf28('0x3d')]:_0x12675f[_0xaf28('0x35')];_0x47178e['order']=qs[_0xaf28('0x53')](_0x4c1a9c['query'][_0xaf28('0x53')]);_0x47178e[_0xaf28('0x43')]=qs['filters'](_[_0xaf28('0x40')](_0x4c1a9c['query'],_0x12675f['filters']));if(_0x4c1a9c[_0xaf28('0x37')][_0xaf28('0x54')]){_0x47178e[_0xaf28('0x43')]=_[_0xaf28('0x42')](_0x47178e[_0xaf28('0x43')],{'$or':_[_0xaf28('0x44')](_0x47178e[_0xaf28('0x3d')],function(_0x50e876){var _0x296c2d={};_0x296c2d[_0x50e876]={'$like':'%'+_0x4c1a9c[_0xaf28('0x37')]['filter']+'%'};return _0x296c2d;})});}_0x47178e=_[_0xaf28('0x42')]({},_0x47178e,_0x4c1a9c[_0xaf28('0x45')]);return _0x151ca3[_0xaf28('0x55')](_0x47178e);}})[_0xaf28('0x19')](function(_0x423eb6){if(_0x423eb6){_0x4bae33=_0x423eb6['length'];if(!_0x4c1a9c[_0xaf28('0x37')]['hasOwnProperty'](_0xaf28('0x3e'))){_0x47178e[_0xaf28('0x2a')]=qs['limit'](_0x4c1a9c[_0xaf28('0x37')][_0xaf28('0x2a')]);_0x47178e[_0xaf28('0x29')]=qs[_0xaf28('0x29')](_0x4c1a9c[_0xaf28('0x37')][_0xaf28('0x29')]);}return _0x151ca3[_0xaf28('0x55')](_0x47178e);}})[_0xaf28('0x19')](function(_0x4c9690){if(_0x4c9690){return _0x4c9690?{'count':_0x4bae33,'rows':_0x4c9690}:null;}})['then'](respondWithResult(_0x13793f,null))[_0xaf28('0x23')](handleError(_0x13793f,null));};exports['addConfiguration']=function(_0x1211f3,_0x21ea56,_0x2835b0){if(_0x1211f3[_0xaf28('0x4c')]['id']){delete _0x1211f3[_0xaf28('0x4c')]['id'];}return db['SalesforceAccount'][_0xaf28('0x50')]({'where':{'id':_0x1211f3[_0xaf28('0x4e')]['id']}})[_0xaf28('0x19')](handleEntityNotFound(_0x21ea56,null))[_0xaf28('0x19')](function(_0x36f672){if(_0x36f672){_0x1211f3[_0xaf28('0x4c')]['AccountId']=_0x36f672['id'];_0x1211f3[_0xaf28('0x4c')][_0xaf28('0x56')]=integrations[_0xaf28('0x57')](_0x1211f3['body'][_0xaf28('0x58')],_0x1211f3[_0xaf28('0x4c')][_0xaf28('0x59')]);_0x1211f3['body'][_0xaf28('0x5a')]=integrations[_0xaf28('0x5b')](_0x1211f3['body'][_0xaf28('0x58')],_0x1211f3['body']['type']);return db[_0xaf28('0x51')][_0xaf28('0x4a')](_0x1211f3[_0xaf28('0x4c')],{'include':[{'model':db[_0xaf28('0x5c')],'as':_0xaf28('0x56')},{'model':db[_0xaf28('0x5c')],'as':_0xaf28('0x5a')}]});}return null;})[_0xaf28('0x19')](respondWithResult(_0x21ea56,null))[_0xaf28('0x23')](handleError(_0x21ea56,null));};exports['getFields']=function(_0x10ca1c,_0x1677ef,_0x1efcfa){var _0x164eaf;return db[_0xaf28('0x33')]['findOne']({'where':{'id':_0x10ca1c[_0xaf28('0x4e')]['id']},'attributes':['id',_0xaf28('0x5d'),'clientId',_0xaf28('0x5e'),'username',_0xaf28('0x5f'),_0xaf28('0x60')]})['then'](handleEntityNotFound(_0x1677ef,null))['then'](function(_0x46cce2){if(_0x46cce2){_0x164eaf=new jsforce[(_0xaf28('0x61'))]({'oauth2':{'loginUrl':_0x46cce2['remoteUri'],'clientId':_0x46cce2['clientId'],'clientSecret':_0x46cce2[_0xaf28('0x5e')]}});return _0x164eaf[_0xaf28('0x62')](_0x46cce2[_0xaf28('0x63')],_0x46cce2['password']['concat'](_0x46cce2['securityToken']));}})[_0xaf28('0x19')](function(_0x44274c){if(_0x44274c){return _0x164eaf[_0xaf28('0x64')](_0xaf28('0x65'))[_0xaf28('0x66')]();}})[_0xaf28('0x19')](function(_0x485e11){var _0x33b883=[_0xaf28('0x67'),'CallDurationInSeconds',_0xaf28('0x68'),_0xaf28('0x69'),'IsArchived',_0xaf28('0x6a'),_0xaf28('0x6b'),_0xaf28('0x6c')];if(_0x485e11){_[_0xaf28('0x6d')](_0x485e11[_0xaf28('0x3c')],function(_0x132505){return _0x132505[_0xaf28('0x6e')]===![]&&!_0x33b883[_0xaf28('0x6f')](_0x132505[_0xaf28('0x31')]);});return{'count':_0x485e11[_0xaf28('0x3c')][_0xaf28('0x52')],'rows':_[_0xaf28('0x44')](_0x485e11[_0xaf28('0x3c')],function(_0x192270){return{'id':_0x192270[_0xaf28('0x31')],'name':_0x192270['label'],'custom':_0x192270[_0xaf28('0x6e')],'options':_0x192270['picklistValues']?_['map'](_0x192270[_0xaf28('0x70')],function(_0xbfe72e){return{'name':_0xbfe72e[_0xaf28('0x71')],'value':_0xbfe72e[_0xaf28('0x72')]};}):[]};})};}})[_0xaf28('0x19')](respondWithResult(_0x1677ef,null))[_0xaf28('0x23')](function(_0x1f037e){var _0x2e3918=_0x10ca1c['query'][_0xaf28('0x73')]?0x1f4:_0x1f037e['statusCode']||0x1f4;logger[_0xaf28('0x1f')]('getFields,\x20%s,\x20%s,\x20%s',_0xaf28('0x74'),_0x2e3918,JSON[_0xaf28('0x75')](_0x1f037e));delete _0x1f037e[_0xaf28('0x31')];if(_0x2e3918===0x191){_0x2e3918=0x190;}_0x1677ef[_0xaf28('0x26')](_0x2e3918)['send'](_0x10ca1c[_0xaf28('0x37')][_0xaf28('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x1f037e[_0xaf28('0x76')]}:_0x1f037e);});}; \ No newline at end of file +var _0x3c31=['find','create','body','getConfigurations','SalesforceConfiguration','order','pick','nolimit','AccountId','Subjects','type','Descriptions','SalesforceField','getFields','findOne','clientId','clientSecret','username','Connection','remoteUri','login','password','concat','securityToken','sobject','describe','CallDurationInSeconds','CallObject','CallType','IsArchived','Priority','Status','Type','remove','custom','includes','label','picklistValues','value','test','statusCode','Wrong\x20credentials','fast-json-patch','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','client','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','update','destroy','stack','name','send','index','rawAttributes','model','dateStart','dateEnd','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','day','filter','merge','map','options','includeAll','include','rows','params','SalesforceAccount'];(function(_0x521e8d,_0x23a290){var _0x518bbd=function(_0x4241eb){while(--_0x4241eb){_0x521e8d['push'](_0x521e8d['shift']());}};_0x518bbd(++_0x23a290);}(_0x3c31,0x108));var _0x13c3=function(_0xada995,_0x2e4868){_0xada995=_0xada995-0x0;var _0x3db761=_0x3c31[_0xada995];return _0x3db761;};'use strict';var jsonpatch=require(_0x13c3('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x13c3('0x1'));var util=require('util');var path=require(_0x13c3('0x2'));var sox=require(_0x13c3('0x3'));var csv=require('to-csv');var ejs=require(_0x13c3('0x4'));var fs=require('fs');var _=require(_0x13c3('0x5'));var squel=require(_0x13c3('0x6'));var crypto=require(_0x13c3('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x13c3('0x8'));var toCsv=require(_0x13c3('0x9'));var querystring=require('querystring');var Papa=require(_0x13c3('0xa'));var qs=require(_0x13c3('0xb'));var logger=require(_0x13c3('0xc'))(_0x13c3('0xd'));var utils=require('../../config/utils');var config=require(_0x13c3('0xe'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x13c3('0xf')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb8d49c,_0x24134c,_0x44ade9,_0x530174){return new BPromise(function(_0xa21946,_0x395d84){var _0x4fd469=_0x530174||client;return _0x4fd469[_0x13c3('0x10')](_0xb8d49c,_0x44ade9)[_0x13c3('0x11')](function(_0x3ba5e5){logger[_0x13c3('0x12')](_0x13c3('0x13'),_0x24134c,_0x13c3('0x14'));logger[_0x13c3('0x15')](_0x13c3('0x16'),_0x24134c,'request\x20sent',JSON[_0x13c3('0x17')](_0x3ba5e5));if(_0x3ba5e5[_0x13c3('0x18')]){if(_0x3ba5e5[_0x13c3('0x18')][_0x13c3('0x19')]===0x1f4){logger['error'](_0x13c3('0x13'),_0x24134c,_0x3ba5e5[_0x13c3('0x18')]['message']);return _0x395d84(_0x3ba5e5[_0x13c3('0x18')][_0x13c3('0x1a')]);}logger[_0x13c3('0x18')]('SalesforceAccount,\x20%s,\x20%s',_0x24134c,_0x3ba5e5[_0x13c3('0x18')][_0x13c3('0x1a')]);return _0xa21946(_0x3ba5e5['error'][_0x13c3('0x1a')]);}else{logger[_0x13c3('0x12')](_0x13c3('0x13'),_0x24134c,_0x13c3('0x14'));_0xa21946(_0x3ba5e5[_0x13c3('0x1b')][_0x13c3('0x1a')]);}})[_0x13c3('0x1c')](function(_0x37b79a){logger['error'](_0x13c3('0x13'),_0x24134c,_0x37b79a);_0x395d84(_0x37b79a);});});}function respondWithStatusCode(_0x17add5,_0x43b829){_0x43b829=_0x43b829||0xcc;return function(_0x44a428){if(_0x44a428){return _0x17add5[_0x13c3('0x1d')](_0x43b829);}return _0x17add5[_0x13c3('0x1e')](_0x43b829)[_0x13c3('0x1f')]();};}function respondWithResult(_0x333bf8,_0x1bdc7b){_0x1bdc7b=_0x1bdc7b||0xc8;return function(_0x5ef2fa){if(_0x5ef2fa){return _0x333bf8[_0x13c3('0x1e')](_0x1bdc7b)['json'](_0x5ef2fa);}};}function respondWithFilteredResult(_0x384bf8,_0x74d980){return function(_0x50c73e){if(_0x50c73e){var _0x5671ec=_0x50c73e[_0x13c3('0x20')],_0x3bd0c0=_0x74d980['offset'],_0x52276b=_0x74d980[_0x13c3('0x21')]+_0x74d980[_0x13c3('0x22')],_0x58553c;if(_0x52276b>=_0x5671ec){_0x52276b=_0x5671ec;_0x58553c=0xc8;}else{_0x58553c=0xce;}_0x384bf8['status'](_0x58553c);return _0x384bf8['set'](_0x13c3('0x23'),_0x3bd0c0+'-'+_0x52276b+'/'+_0x5671ec)[_0x13c3('0x24')](_0x50c73e);}return null;};}function patchUpdates(_0x3f3f88){return function(_0x40dd7e){try{jsonpatch[_0x13c3('0x25')](_0x40dd7e,_0x3f3f88,!![]);}catch(_0x56cc69){return BPromise[_0x13c3('0x26')](_0x56cc69);}return _0x40dd7e['save']();};}function saveUpdates(_0x101d82,_0x22f44f){return function(_0x2c7a06){if(_0x2c7a06){return _0x2c7a06[_0x13c3('0x27')](_0x101d82)[_0x13c3('0x11')](function(_0x1c6fa0){return _0x1c6fa0;});}return null;};}function removeEntity(_0xf6c548,_0x177314){return function(_0x1d874b){if(_0x1d874b){return _0x1d874b[_0x13c3('0x28')]()['then'](function(){_0xf6c548['status'](0xcc)[_0x13c3('0x1f')]();});}};}function handleEntityNotFound(_0x254cb3,_0x1fc399){return function(_0x1e472b){if(!_0x1e472b){_0x254cb3[_0x13c3('0x1d')](0x194);}return _0x1e472b;};}function handleError(_0x1b6944,_0x37b8fa){_0x37b8fa=_0x37b8fa||0x1f4;return function(_0x2d3c79){logger['error'](_0x2d3c79[_0x13c3('0x29')]);if(_0x2d3c79[_0x13c3('0x2a')]){delete _0x2d3c79[_0x13c3('0x2a')];}_0x1b6944['status'](_0x37b8fa)[_0x13c3('0x2b')](_0x2d3c79);};}exports[_0x13c3('0x2c')]=function(_0x2a5bb1,_0x2952d3){var _0x29dda5={},_0x30d94e={},_0x1ff54a={'count':0x0,'rows':[]};var _0x6a9f7e=db['SalesforceAccount'][_0x13c3('0x2d')];_0x30d94e[_0x13c3('0x2e')]=_['keys'](_0x6a9f7e);var _0x1bcd63={'dateStart':_0x2a5bb1['query'][_0x13c3('0x2f')],'dateEnd':_0x2a5bb1['query'][_0x13c3('0x30')]};delete _0x2a5bb1[_0x13c3('0x31')][_0x13c3('0x2f')];delete _0x2a5bb1[_0x13c3('0x31')][_0x13c3('0x30')];_0x30d94e[_0x13c3('0x31')]=_[_0x13c3('0x32')](_0x2a5bb1[_0x13c3('0x31')]);_0x30d94e[_0x13c3('0x33')]=_[_0x13c3('0x34')](_0x30d94e['model'],_0x30d94e['query']);_0x29dda5[_0x13c3('0x35')]=_[_0x13c3('0x34')](_0x30d94e[_0x13c3('0x2e')],qs['fields'](_0x2a5bb1[_0x13c3('0x31')][_0x13c3('0x36')]));_0x29dda5[_0x13c3('0x35')]=_0x29dda5['attributes'][_0x13c3('0x37')]?_0x29dda5[_0x13c3('0x35')]:_0x30d94e[_0x13c3('0x2e')];if(!_0x2a5bb1[_0x13c3('0x31')][_0x13c3('0x38')]('nolimit')){_0x29dda5[_0x13c3('0x22')]=qs[_0x13c3('0x22')](_0x2a5bb1['query'][_0x13c3('0x22')]);_0x29dda5[_0x13c3('0x21')]=qs[_0x13c3('0x21')](_0x2a5bb1[_0x13c3('0x31')][_0x13c3('0x21')]);}_0x29dda5['order']=qs[_0x13c3('0x39')](_0x2a5bb1[_0x13c3('0x31')]['sort']);_0x29dda5[_0x13c3('0x3a')]=qs['filters'](_['pick'](_0x2a5bb1[_0x13c3('0x31')],_0x30d94e[_0x13c3('0x33')]));if(_0x1bcd63[_0x13c3('0x2f')]){if(_0x1bcd63['dateEnd']){_0x1bcd63[_0x13c3('0x30')]=moment(_0x1bcd63[_0x13c3('0x30')])['add'](0x1,_0x13c3('0x3b'));}else{_0x1bcd63[_0x13c3('0x30')]=moment(_0x1bcd63[_0x13c3('0x2f')])['add'](0x1,_0x13c3('0x3b'));}_['merge'](_0x29dda5[_0x13c3('0x3a')],{'createdAt':{'$gte':_0x1bcd63['dateStart'],'$lte':_0x1bcd63['dateEnd']}});}if(_0x2a5bb1[_0x13c3('0x31')][_0x13c3('0x3c')]){_0x29dda5[_0x13c3('0x3a')]=_[_0x13c3('0x3d')](_0x29dda5[_0x13c3('0x3a')],{'$or':_[_0x13c3('0x3e')](_0x29dda5[_0x13c3('0x35')],function(_0x1e639a){var _0x1fa342={};_0x1fa342[_0x1e639a]={'$like':'%'+_0x2a5bb1['query'][_0x13c3('0x3c')]+'%'};return _0x1fa342;})});}_0x29dda5=_[_0x13c3('0x3d')]({},_0x29dda5,_0x2a5bb1[_0x13c3('0x3f')]);var _0x51a1fe={'where':_0x29dda5[_0x13c3('0x3a')]};return db['SalesforceAccount'][_0x13c3('0x20')](_0x51a1fe)[_0x13c3('0x11')](function(_0x3ab569){_0x1ff54a['count']=_0x3ab569;if(_0x2a5bb1['query'][_0x13c3('0x40')]){_0x29dda5[_0x13c3('0x41')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x29dda5);})[_0x13c3('0x11')](function(_0x128c70){_0x1ff54a[_0x13c3('0x42')]=_0x128c70;return _0x1ff54a;})[_0x13c3('0x11')](respondWithFilteredResult(_0x2952d3,_0x29dda5))[_0x13c3('0x1c')](handleError(_0x2952d3,null));};exports['show']=function(_0x50cbba,_0x12cac7){var _0x156364={'raw':![],'where':{'id':_0x50cbba[_0x13c3('0x43')]['id']}},_0x34d5cf={};_0x34d5cf[_0x13c3('0x2e')]=_['keys'](db[_0x13c3('0x44')][_0x13c3('0x2d')]);_0x34d5cf[_0x13c3('0x31')]=_['keys'](_0x50cbba[_0x13c3('0x31')]);_0x34d5cf[_0x13c3('0x33')]=_[_0x13c3('0x34')](_0x34d5cf[_0x13c3('0x2e')],_0x34d5cf[_0x13c3('0x31')]);_0x156364[_0x13c3('0x35')]=_[_0x13c3('0x34')](_0x34d5cf[_0x13c3('0x2e')],qs['fields'](_0x50cbba[_0x13c3('0x31')][_0x13c3('0x36')]));_0x156364[_0x13c3('0x35')]=_0x156364['attributes'][_0x13c3('0x37')]?_0x156364[_0x13c3('0x35')]:_0x34d5cf[_0x13c3('0x2e')];if(_0x50cbba[_0x13c3('0x31')][_0x13c3('0x40')]){_0x156364[_0x13c3('0x41')]=[{'all':!![]}];}_0x156364=_[_0x13c3('0x3d')]({},_0x156364,_0x50cbba[_0x13c3('0x3f')]);return db[_0x13c3('0x44')][_0x13c3('0x45')](_0x156364)[_0x13c3('0x11')](handleEntityNotFound(_0x12cac7,null))[_0x13c3('0x11')](respondWithResult(_0x12cac7,null))[_0x13c3('0x1c')](handleError(_0x12cac7,null));};exports[_0x13c3('0x46')]=function(_0x134711,_0x102db0){return db[_0x13c3('0x44')]['create'](_0x134711['body'],{})[_0x13c3('0x11')](respondWithResult(_0x102db0,0xc9))[_0x13c3('0x1c')](handleError(_0x102db0,null));};exports[_0x13c3('0x27')]=function(_0x4333c4,_0x5b3cdd){if(_0x4333c4[_0x13c3('0x47')]['id']){delete _0x4333c4[_0x13c3('0x47')]['id'];}return db[_0x13c3('0x44')][_0x13c3('0x45')]({'where':{'id':_0x4333c4[_0x13c3('0x43')]['id']}})[_0x13c3('0x11')](handleEntityNotFound(_0x5b3cdd,null))[_0x13c3('0x11')](saveUpdates(_0x4333c4['body'],null))[_0x13c3('0x11')](respondWithResult(_0x5b3cdd,null))[_0x13c3('0x1c')](handleError(_0x5b3cdd,null));};exports[_0x13c3('0x28')]=function(_0x3bf6ff,_0x302906){return db['SalesforceAccount']['find']({'where':{'id':_0x3bf6ff[_0x13c3('0x43')]['id']}})['then'](handleEntityNotFound(_0x302906,null))[_0x13c3('0x11')](removeEntity(_0x302906,null))[_0x13c3('0x1c')](handleError(_0x302906,null));};exports[_0x13c3('0x48')]=function(_0x4af7f3,_0x56fa9c,_0x1a7d03){var _0x452e0f={};var _0x58857a={};var _0x578272;var _0x522387;return db[_0x13c3('0x44')]['findOne']({'where':{'id':_0x4af7f3['params']['id']}})[_0x13c3('0x11')](handleEntityNotFound(_0x56fa9c,null))[_0x13c3('0x11')](function(_0xe785b8){if(_0xe785b8){_0x578272=_0xe785b8;_0x58857a[_0x13c3('0x2e')]=_[_0x13c3('0x32')](db[_0x13c3('0x49')][_0x13c3('0x2d')]);_0x58857a[_0x13c3('0x31')]=_['keys'](_0x4af7f3[_0x13c3('0x31')]);_0x58857a[_0x13c3('0x33')]=_[_0x13c3('0x34')](_0x58857a['model'],_0x58857a[_0x13c3('0x31')]);_0x452e0f['attributes']=_[_0x13c3('0x34')](_0x58857a[_0x13c3('0x2e')],qs[_0x13c3('0x36')](_0x4af7f3[_0x13c3('0x31')]['fields']));_0x452e0f[_0x13c3('0x35')]=_0x452e0f['attributes']['length']?_0x452e0f['attributes']:_0x58857a[_0x13c3('0x2e')];_0x452e0f[_0x13c3('0x4a')]=qs[_0x13c3('0x39')](_0x4af7f3[_0x13c3('0x31')][_0x13c3('0x39')]);_0x452e0f[_0x13c3('0x3a')]=qs['filters'](_[_0x13c3('0x4b')](_0x4af7f3[_0x13c3('0x31')],_0x58857a[_0x13c3('0x33')]));if(_0x4af7f3[_0x13c3('0x31')]['filter']){_0x452e0f[_0x13c3('0x3a')]=_[_0x13c3('0x3d')](_0x452e0f[_0x13c3('0x3a')],{'$or':_['map'](_0x452e0f[_0x13c3('0x35')],function(_0x1dc80a){var _0xa54f12={};_0xa54f12[_0x1dc80a]={'$like':'%'+_0x4af7f3[_0x13c3('0x31')][_0x13c3('0x3c')]+'%'};return _0xa54f12;})});}_0x452e0f=_[_0x13c3('0x3d')]({},_0x452e0f,_0x4af7f3[_0x13c3('0x3f')]);return _0x578272[_0x13c3('0x48')](_0x452e0f);}})[_0x13c3('0x11')](function(_0x1e4504){if(_0x1e4504){_0x522387=_0x1e4504[_0x13c3('0x37')];if(!_0x4af7f3[_0x13c3('0x31')][_0x13c3('0x38')](_0x13c3('0x4c'))){_0x452e0f['limit']=qs['limit'](_0x4af7f3[_0x13c3('0x31')][_0x13c3('0x22')]);_0x452e0f[_0x13c3('0x21')]=qs[_0x13c3('0x21')](_0x4af7f3[_0x13c3('0x31')][_0x13c3('0x21')]);}return _0x578272[_0x13c3('0x48')](_0x452e0f);}})[_0x13c3('0x11')](function(_0x411e51){if(_0x411e51){return _0x411e51?{'count':_0x522387,'rows':_0x411e51}:null;}})[_0x13c3('0x11')](respondWithResult(_0x56fa9c,null))[_0x13c3('0x1c')](handleError(_0x56fa9c,null));};exports['addConfiguration']=function(_0x1f15ae,_0x33166b,_0x3caac1){if(_0x1f15ae[_0x13c3('0x47')]['id']){delete _0x1f15ae[_0x13c3('0x47')]['id'];}return db[_0x13c3('0x44')]['findOne']({'where':{'id':_0x1f15ae[_0x13c3('0x43')]['id']}})[_0x13c3('0x11')](handleEntityNotFound(_0x33166b,null))[_0x13c3('0x11')](function(_0x5501b7){if(_0x5501b7){_0x1f15ae[_0x13c3('0x47')][_0x13c3('0x4d')]=_0x5501b7['id'];_0x1f15ae[_0x13c3('0x47')][_0x13c3('0x4e')]=integrations['getSubjects'](_0x1f15ae[_0x13c3('0x47')]['channel'],_0x1f15ae['body'][_0x13c3('0x4f')]);_0x1f15ae[_0x13c3('0x47')][_0x13c3('0x50')]=integrations['getDescriptions'](_0x1f15ae['body']['channel'],_0x1f15ae[_0x13c3('0x47')][_0x13c3('0x4f')]);return db['SalesforceConfiguration'][_0x13c3('0x46')](_0x1f15ae[_0x13c3('0x47')],{'include':[{'model':db[_0x13c3('0x51')],'as':_0x13c3('0x4e')},{'model':db[_0x13c3('0x51')],'as':_0x13c3('0x50')}]});}return null;})['then'](respondWithResult(_0x33166b,null))[_0x13c3('0x1c')](handleError(_0x33166b,null));};exports[_0x13c3('0x52')]=function(_0x55c8ae,_0x4fdbf4,_0xb352f9){var _0x1b7ea1;return db[_0x13c3('0x44')][_0x13c3('0x53')]({'where':{'id':_0x55c8ae[_0x13c3('0x43')]['id']},'attributes':['id','remoteUri',_0x13c3('0x54'),_0x13c3('0x55'),_0x13c3('0x56'),'password','securityToken']})[_0x13c3('0x11')](handleEntityNotFound(_0x4fdbf4,null))['then'](function(_0x497fc7){if(_0x497fc7){_0x1b7ea1=new jsforce[(_0x13c3('0x57'))]({'oauth2':{'loginUrl':_0x497fc7[_0x13c3('0x58')],'clientId':_0x497fc7[_0x13c3('0x54')],'clientSecret':_0x497fc7[_0x13c3('0x55')]}});return _0x1b7ea1[_0x13c3('0x59')](_0x497fc7[_0x13c3('0x56')],_0x497fc7[_0x13c3('0x5a')][_0x13c3('0x5b')](_0x497fc7[_0x13c3('0x5c')]));}})[_0x13c3('0x11')](function(_0x471981){if(_0x471981){return _0x1b7ea1[_0x13c3('0x5d')]('Task')[_0x13c3('0x5e')]();}})['then'](function(_0x580d58){var _0x51e8cf=['CallDisposition',_0x13c3('0x5f'),_0x13c3('0x60'),_0x13c3('0x61'),_0x13c3('0x62'),_0x13c3('0x63'),_0x13c3('0x64'),_0x13c3('0x65')];if(_0x580d58){_[_0x13c3('0x66')](_0x580d58[_0x13c3('0x36')],function(_0x24fc4b){return _0x24fc4b[_0x13c3('0x67')]===![]&&!_0x51e8cf[_0x13c3('0x68')](_0x24fc4b[_0x13c3('0x2a')]);});return{'count':_0x580d58[_0x13c3('0x36')][_0x13c3('0x37')],'rows':_[_0x13c3('0x3e')](_0x580d58['fields'],function(_0x3deeea){return{'id':_0x3deeea[_0x13c3('0x2a')],'name':_0x3deeea[_0x13c3('0x69')],'custom':_0x3deeea['custom'],'options':_0x3deeea[_0x13c3('0x6a')]?_[_0x13c3('0x3e')](_0x3deeea[_0x13c3('0x6a')],function(_0x1d0397){return{'name':_0x1d0397['label'],'value':_0x1d0397[_0x13c3('0x6b')]};}):[]};})};}})[_0x13c3('0x11')](respondWithResult(_0x4fdbf4,null))[_0x13c3('0x1c')](function(_0x11b202){var _0x53df38=_0x55c8ae[_0x13c3('0x31')][_0x13c3('0x6c')]?0x1f4:_0x11b202[_0x13c3('0x6d')]||0x1f4;logger[_0x13c3('0x18')]('getFields,\x20%s,\x20%s,\x20%s',_0x13c3('0x52'),_0x53df38,JSON[_0x13c3('0x17')](_0x11b202));delete _0x11b202[_0x13c3('0x2a')];if(_0x53df38===0x191){_0x53df38=0x190;}_0x4fdbf4[_0x13c3('0x1e')](_0x53df38)[_0x13c3('0x2b')](_0x55c8ae['query'][_0x13c3('0x6c')]?{'message':_0x13c3('0x6e'),'statusCode':_0x11b202['statusCode']}:_0x11b202);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 33fc7b0..4012ebe 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 _0xd380=['bluebird','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','util','moment'];(function(_0x29d21a,_0x184b5f){var _0x18b135=function(_0x2fdee1){while(--_0x2fdee1){_0x29d21a['push'](_0x29d21a['shift']());}};_0x18b135(++_0x184b5f);}(_0xd380,0x13e));var _0x0d38=function(_0x4446bc,_0x29eb08){_0x4446bc=_0x4446bc-0x0;var _0x4c53a2=_0xd380[_0x4446bc];return _0x4c53a2;};'use strict';var _=require('lodash');var util=require(_0x0d38('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x0d38('0x1'));var BPromise=require(_0x0d38('0x2'));var rp=require('request-promise');var attributes=require(_0x0d38('0x3'));var integrations=require(_0x0d38('0x4'));module[_0x0d38('0x5')]=function(_0x114bb7,_0x35e0e4){return _0x114bb7[_0x0d38('0x6')](_0x0d38('0x7'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b0f=['request-promise','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','int_salesforce_accounts','../../config/logger','api','moment'];(function(_0x5ab9da,_0x5c258c){var _0x340257=function(_0x2c8636){while(--_0x2c8636){_0x5ab9da['push'](_0x5ab9da['shift']());}};_0x340257(++_0x5c258c);}(_0x5b0f,0x14a));var _0xf5b0=function(_0x52a858,_0x1df8ea){_0x52a858=_0x52a858-0x0;var _0x247399=_0x5b0f[_0x52a858];return _0x247399;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf5b0('0x0'))(_0xf5b0('0x1'));var moment=require(_0xf5b0('0x2'));var BPromise=require('bluebird');var rp=require(_0xf5b0('0x3'));var attributes=require(_0xf5b0('0x4'));var integrations=require(_0xf5b0('0x5'));module[_0xf5b0('0x6')]=function(_0x134af9,_0x31272a){return _0x134af9[_0xf5b0('0x7')]('SalesforceAccount',attributes,{'tableName':_0xf5b0('0x8'),'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 9c8be7e..f8b8ba7 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 _0x5ca0=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','where','attributes','limit','include','map','model','then','ShowSalesforceAccount','find','raw','lodash','util','moment','bluebird'];(function(_0x2e05dd,_0x327206){var _0x5798d6=function(_0x5e4ae6){while(--_0x5e4ae6){_0x2e05dd['push'](_0x2e05dd['shift']());}};_0x5798d6(++_0x327206);}(_0x5ca0,0x12e));var _0x05ca=function(_0x1d6fa0,_0x2be621){_0x1d6fa0=_0x1d6fa0-0x0;var _0x195c93=_0x5ca0[_0x1d6fa0];return _0x195c93;};'use strict';var _=require(_0x05ca('0x0'));var util=require(_0x05ca('0x1'));var moment=require(_0x05ca('0x2'));var BPromise=require(_0x05ca('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x05ca('0x4'));var logger=require(_0x05ca('0x5'))(_0x05ca('0x6'));var config=require(_0x05ca('0x7'));var jayson=require(_0x05ca('0x8'));var client=jayson[_0x05ca('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c226f,_0x208e73,_0x411ccc){return new BPromise(function(_0x518451,_0x2ace84){return client['request'](_0x3c226f,_0x411ccc)['then'](function(_0xf80079){logger[_0x05ca('0xa')](_0x05ca('0xb'),_0x208e73,_0x05ca('0xc'));logger[_0x05ca('0xd')](_0x05ca('0xe'),_0x208e73,_0x05ca('0xc'),JSON[_0x05ca('0xf')](_0xf80079));if(_0xf80079[_0x05ca('0x10')]){if(_0xf80079[_0x05ca('0x10')][_0x05ca('0x11')]===0x1f4){logger[_0x05ca('0x10')](_0x05ca('0xb'),_0x208e73,_0xf80079[_0x05ca('0x10')][_0x05ca('0x12')]);return _0x2ace84(_0xf80079[_0x05ca('0x10')]['message']);}logger['error'](_0x05ca('0xb'),_0x208e73,_0xf80079[_0x05ca('0x10')][_0x05ca('0x12')]);return _0x518451(_0xf80079[_0x05ca('0x10')][_0x05ca('0x12')]);}else{logger[_0x05ca('0xa')](_0x05ca('0xb'),_0x208e73,_0x05ca('0xc'));_0x518451(_0xf80079[_0x05ca('0x13')][_0x05ca('0x12')]);}})[_0x05ca('0x14')](function(_0x30fd04){logger[_0x05ca('0x10')](_0x05ca('0xb'),_0x208e73,_0x30fd04);_0x2ace84(_0x30fd04);});});}exports[_0x05ca('0x15')]=function(_0x2775ea){var _0x37511f=this;return new Promise(function(_0x294195,_0x37344b){return db[_0x05ca('0x16')]['findAll']({'raw':_0x2775ea['options']?_0x2775ea[_0x05ca('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2775ea[_0x05ca('0x17')]?_0x2775ea[_0x05ca('0x17')][_0x05ca('0x18')]||null:null,'attributes':_0x2775ea[_0x05ca('0x17')]?_0x2775ea[_0x05ca('0x17')][_0x05ca('0x19')]||null:null,'limit':_0x2775ea[_0x05ca('0x17')]?_0x2775ea['options'][_0x05ca('0x1a')]||null:null,'include':_0x2775ea[_0x05ca('0x17')]?_0x2775ea['options'][_0x05ca('0x1b')]?_[_0x05ca('0x1c')](_0x2775ea['options']['include'],function(_0x492fbd){return{'model':db[_0x492fbd[_0x05ca('0x1d')]],'as':_0x492fbd['as'],'attributes':_0x492fbd[_0x05ca('0x19')],'include':_0x492fbd[_0x05ca('0x1b')]?_[_0x05ca('0x1c')](_0x492fbd[_0x05ca('0x1b')],function(_0x6a22a8){return{'model':db[_0x6a22a8[_0x05ca('0x1d')]],'as':_0x6a22a8['as'],'attributes':_0x6a22a8[_0x05ca('0x19')],'include':_0x6a22a8[_0x05ca('0x1b')]?_[_0x05ca('0x1c')](_0x6a22a8['include'],function(_0x457392){return{'model':db[_0x457392[_0x05ca('0x1d')]],'as':_0x457392['as'],'attributes':_0x457392[_0x05ca('0x19')]};}):[]};}):[]};}):[]:[]})[_0x05ca('0x1e')](function(_0x29867f){logger[_0x05ca('0xa')]('GetSalesforceAccount',_0x2775ea);logger[_0x05ca('0xd')](_0x05ca('0x15'),_0x2775ea,JSON[_0x05ca('0xf')](_0x29867f));_0x294195(_0x29867f);})[_0x05ca('0x14')](function(_0x29f307){logger[_0x05ca('0x10')](_0x05ca('0x15'),_0x29f307[_0x05ca('0x12')],_0x2775ea);_0x37344b(_0x37511f[_0x05ca('0x10')](0x1f4,_0x29f307[_0x05ca('0x12')]));});});};exports[_0x05ca('0x1f')]=function(_0x2679fb){var _0x4710d0=this;return new Promise(function(_0x43d3dd,_0x304762){return db[_0x05ca('0x16')][_0x05ca('0x20')]({'raw':_0x2679fb[_0x05ca('0x17')]?_0x2679fb['options'][_0x05ca('0x21')]===undefined?!![]:![]:!![],'where':_0x2679fb[_0x05ca('0x17')]?_0x2679fb['options']['where']||null:null,'attributes':_0x2679fb['options']?_0x2679fb[_0x05ca('0x17')][_0x05ca('0x19')]||null:null,'include':_0x2679fb[_0x05ca('0x17')]?_0x2679fb[_0x05ca('0x17')][_0x05ca('0x1b')]?_[_0x05ca('0x1c')](_0x2679fb[_0x05ca('0x17')][_0x05ca('0x1b')],function(_0x30cf7b){return{'model':db[_0x30cf7b[_0x05ca('0x1d')]],'as':_0x30cf7b['as'],'attributes':_0x30cf7b['attributes'],'include':_0x30cf7b[_0x05ca('0x1b')]?_[_0x05ca('0x1c')](_0x30cf7b[_0x05ca('0x1b')],function(_0x26df59){return{'model':db[_0x26df59[_0x05ca('0x1d')]],'as':_0x26df59['as'],'attributes':_0x26df59[_0x05ca('0x19')],'include':_0x26df59[_0x05ca('0x1b')]?_[_0x05ca('0x1c')](_0x26df59[_0x05ca('0x1b')],function(_0xa4415d){return{'model':db[_0xa4415d[_0x05ca('0x1d')]],'as':_0xa4415d['as'],'attributes':_0xa4415d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x59f9aa){logger[_0x05ca('0xa')](_0x05ca('0x1f'),_0x2679fb);logger['debug'](_0x05ca('0x1f'),_0x2679fb,JSON['stringify'](_0x59f9aa));_0x43d3dd(_0x59f9aa);})[_0x05ca('0x14')](function(_0x141295){logger['error'](_0x05ca('0x1f'),_0x141295[_0x05ca('0x12')],_0x2679fb);_0x304762(_0x4710d0['error'](0x1f4,_0x141295[_0x05ca('0x12')]));});});}; \ No newline at end of file +var _0x8a93=['jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','attributes','limit','include','model','map','then','ShowSalesforceAccount','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2c61b3,_0x42e8df){var _0x4d588b=function(_0xd23639){while(--_0xd23639){_0x2c61b3['push'](_0x2c61b3['shift']());}};_0x4d588b(++_0x42e8df);}(_0x8a93,0x163));var _0x38a9=function(_0x5dd351,_0x19ebc5){_0x5dd351=_0x5dd351-0x0;var _0x1fbdba=_0x8a93[_0x5dd351];return _0x1fbdba;};'use strict';var _=require('lodash');var util=require(_0x38a9('0x0'));var moment=require(_0x38a9('0x1'));var BPromise=require(_0x38a9('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x38a9('0x3'))['db'];var utils=require(_0x38a9('0x4'));var logger=require(_0x38a9('0x5'))(_0x38a9('0x6'));var config=require(_0x38a9('0x7'));var jayson=require(_0x38a9('0x8'));var client=jayson[_0x38a9('0x9')][_0x38a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x156859,_0x53cb4c,_0x12d2d3){return new BPromise(function(_0x3c91a8,_0x5b67f2){return client[_0x38a9('0xb')](_0x156859,_0x12d2d3)['then'](function(_0x4ecf6f){logger[_0x38a9('0xc')](_0x38a9('0xd'),_0x53cb4c,'request\x20sent');logger[_0x38a9('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x53cb4c,_0x38a9('0xf'),JSON[_0x38a9('0x10')](_0x4ecf6f));if(_0x4ecf6f['error']){if(_0x4ecf6f[_0x38a9('0x11')][_0x38a9('0x12')]===0x1f4){logger[_0x38a9('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x53cb4c,_0x4ecf6f[_0x38a9('0x11')][_0x38a9('0x13')]);return _0x5b67f2(_0x4ecf6f[_0x38a9('0x11')][_0x38a9('0x13')]);}logger[_0x38a9('0x11')](_0x38a9('0xd'),_0x53cb4c,_0x4ecf6f[_0x38a9('0x11')][_0x38a9('0x13')]);return _0x3c91a8(_0x4ecf6f[_0x38a9('0x11')][_0x38a9('0x13')]);}else{logger[_0x38a9('0xc')](_0x38a9('0xd'),_0x53cb4c,_0x38a9('0xf'));_0x3c91a8(_0x4ecf6f[_0x38a9('0x14')][_0x38a9('0x13')]);}})[_0x38a9('0x15')](function(_0x11a033){logger[_0x38a9('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x53cb4c,_0x11a033);_0x5b67f2(_0x11a033);});});}exports[_0x38a9('0x16')]=function(_0x471036){var _0x52fddc=this;return new Promise(function(_0x195309,_0x5c4812){return db[_0x38a9('0x17')]['findAll']({'raw':_0x471036[_0x38a9('0x18')]?_0x471036[_0x38a9('0x18')][_0x38a9('0x19')]===undefined?!![]:![]:!![],'where':_0x471036['options']?_0x471036[_0x38a9('0x18')]['where']||null:null,'attributes':_0x471036['options']?_0x471036['options'][_0x38a9('0x1a')]||null:null,'limit':_0x471036[_0x38a9('0x18')]?_0x471036['options'][_0x38a9('0x1b')]||null:null,'include':_0x471036[_0x38a9('0x18')]?_0x471036[_0x38a9('0x18')][_0x38a9('0x1c')]?_['map'](_0x471036[_0x38a9('0x18')][_0x38a9('0x1c')],function(_0x2a8af3){return{'model':db[_0x2a8af3[_0x38a9('0x1d')]],'as':_0x2a8af3['as'],'attributes':_0x2a8af3[_0x38a9('0x1a')],'include':_0x2a8af3['include']?_[_0x38a9('0x1e')](_0x2a8af3[_0x38a9('0x1c')],function(_0x1ed18d){return{'model':db[_0x1ed18d['model']],'as':_0x1ed18d['as'],'attributes':_0x1ed18d[_0x38a9('0x1a')],'include':_0x1ed18d[_0x38a9('0x1c')]?_[_0x38a9('0x1e')](_0x1ed18d[_0x38a9('0x1c')],function(_0x2380d4){return{'model':db[_0x2380d4[_0x38a9('0x1d')]],'as':_0x2380d4['as'],'attributes':_0x2380d4[_0x38a9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x38a9('0x1f')](function(_0x4a8f57){logger['info'](_0x38a9('0x16'),_0x471036);logger[_0x38a9('0xe')]('GetSalesforceAccount',_0x471036,JSON[_0x38a9('0x10')](_0x4a8f57));_0x195309(_0x4a8f57);})['catch'](function(_0x4808b0){logger[_0x38a9('0x11')](_0x38a9('0x16'),_0x4808b0[_0x38a9('0x13')],_0x471036);_0x5c4812(_0x52fddc[_0x38a9('0x11')](0x1f4,_0x4808b0[_0x38a9('0x13')]));});});};exports[_0x38a9('0x20')]=function(_0x39eacb){var _0x1ae6c2=this;return new Promise(function(_0x1d4cb4,_0x34284a){return db[_0x38a9('0x17')]['find']({'raw':_0x39eacb['options']?_0x39eacb[_0x38a9('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x39eacb[_0x38a9('0x18')]?_0x39eacb['options']['where']||null:null,'attributes':_0x39eacb[_0x38a9('0x18')]?_0x39eacb[_0x38a9('0x18')][_0x38a9('0x1a')]||null:null,'include':_0x39eacb[_0x38a9('0x18')]?_0x39eacb['options'][_0x38a9('0x1c')]?_[_0x38a9('0x1e')](_0x39eacb['options'][_0x38a9('0x1c')],function(_0x1fc5a6){return{'model':db[_0x1fc5a6[_0x38a9('0x1d')]],'as':_0x1fc5a6['as'],'attributes':_0x1fc5a6['attributes'],'include':_0x1fc5a6[_0x38a9('0x1c')]?_[_0x38a9('0x1e')](_0x1fc5a6[_0x38a9('0x1c')],function(_0x2325b8){return{'model':db[_0x2325b8[_0x38a9('0x1d')]],'as':_0x2325b8['as'],'attributes':_0x2325b8['attributes'],'include':_0x2325b8[_0x38a9('0x1c')]?_[_0x38a9('0x1e')](_0x2325b8['include'],function(_0xef79){return{'model':db[_0xef79[_0x38a9('0x1d')]],'as':_0xef79['as'],'attributes':_0xef79[_0x38a9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x38a9('0x1f')](function(_0x2ba7c9){logger[_0x38a9('0xc')](_0x38a9('0x20'),_0x39eacb);logger[_0x38a9('0xe')](_0x38a9('0x20'),_0x39eacb,JSON[_0x38a9('0x10')](_0x2ba7c9));_0x1d4cb4(_0x2ba7c9);})['catch'](function(_0x35d8d5){logger[_0x38a9('0x11')](_0x38a9('0x20'),_0x35d8d5[_0x38a9('0x13')],_0x39eacb);_0x34284a(_0x1ae6c2[_0x38a9('0x11')](0x1f4,_0x35d8d5[_0x38a9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index c53c5cc..eeafc88 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 _0xc88f=['index','/:id','show','/:id/fields','getFields','/:id/subjects','post','create','put','update','delete','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','isAuthenticated'];(function(_0x4bc80a,_0x204c27){var _0x373c51=function(_0x2bbf06){while(--_0x2bbf06){_0x4bc80a['push'](_0x4bc80a['shift']());}};_0x373c51(++_0x204c27);}(_0xc88f,0xf3));var _0xfc88=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc88f[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xfc88('0x0'));var util=require(_0xfc88('0x1'));var path=require('path');var express=require(_0xfc88('0x2'));var router=express[_0xfc88('0x3')]();var auth=require(_0xfc88('0x4'));var interaction=require(_0xfc88('0x5'));var config=require('../../config/environment');var controller=require(_0xfc88('0x6'));router[_0xfc88('0x7')]('/',auth[_0xfc88('0x8')](),controller[_0xfc88('0x9')]);router[_0xfc88('0x7')](_0xfc88('0xa'),auth[_0xfc88('0x8')](),controller[_0xfc88('0xb')]);router[_0xfc88('0x7')](_0xfc88('0xc'),auth[_0xfc88('0x8')](),controller[_0xfc88('0xd')]);router[_0xfc88('0x7')](_0xfc88('0xe'),auth[_0xfc88('0x8')](),controller['getSubjects']);router[_0xfc88('0x7')]('/:id/descriptions',auth[_0xfc88('0x8')](),controller['getDescriptions']);router[_0xfc88('0xf')]('/',auth[_0xfc88('0x8')](),controller[_0xfc88('0x10')]);router[_0xfc88('0x11')](_0xfc88('0xa'),auth['isAuthenticated'](),controller[_0xfc88('0x12')]);router[_0xfc88('0x13')](_0xfc88('0xa'),auth[_0xfc88('0x8')](),controller[_0xfc88('0x14')]);module['exports']=router; \ No newline at end of file +var _0x808e=['/:id/fields','/:id/descriptions','post','create','put','update','delete','exports','multer','Router','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x592234,_0x58c15e){var _0x3ffa85=function(_0x124cb1){while(--_0x124cb1){_0x592234['push'](_0x592234['shift']());}};_0x3ffa85(++_0x58c15e);}(_0x808e,0x104));var _0xe808=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x808e[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0xe808('0x0'));var util=require('util');var path=require('path');var express=require('express');var router=express[_0xe808('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xe808('0x2'));var config=require(_0xe808('0x3'));var controller=require(_0xe808('0x4'));router[_0xe808('0x5')]('/',auth[_0xe808('0x6')](),controller[_0xe808('0x7')]);router['get'](_0xe808('0x8'),auth[_0xe808('0x6')](),controller[_0xe808('0x9')]);router[_0xe808('0x5')](_0xe808('0xa'),auth[_0xe808('0x6')](),controller['getFields']);router[_0xe808('0x5')]('/:id/subjects',auth[_0xe808('0x6')](),controller['getSubjects']);router[_0xe808('0x5')](_0xe808('0xb'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xe808('0xc')]('/',auth[_0xe808('0x6')](),controller[_0xe808('0xd')]);router[_0xe808('0xe')](_0xe808('0x8'),auth['isAuthenticated'](),controller[_0xe808('0xf')]);router[_0xe808('0x10')](_0xe808('0x8'),auth[_0xe808('0x6')](),controller['destroy']);module[_0xe808('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 405a047..3c8d083 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 _0xc607=['contact_lead','contact','lead','nothing','sequelize','exports','STRING','ENUM'];(function(_0x145b3c,_0x31ea4a){var _0x1b6e36=function(_0xfccee6){while(--_0xfccee6){_0x145b3c['push'](_0x145b3c['shift']());}};_0x1b6e36(++_0x31ea4a);}(_0xc607,0x1c4));var _0x7c60=function(_0x1197d3,_0xb59c45){_0x1197d3=_0x1197d3-0x0;var _0x5402e9=_0xc607[_0x1197d3];return _0x5402e9;};'use strict';var Sequelize=require(_0x7c60('0x0'));module[_0x7c60('0x1')]={'name':{'type':Sequelize[_0x7c60('0x2')]},'description':{'type':Sequelize[_0x7c60('0x2')]},'moduleSearch':{'type':Sequelize[_0x7c60('0x3')](_0x7c60('0x4'),_0x7c60('0x5'),_0x7c60('0x6')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM'](_0x7c60('0x7'),_0x7c60('0x5'),'lead'),'defaultValue':_0x7c60('0x6')}}; \ No newline at end of file +var _0xd75f=['contact_lead','ENUM','nothing','contact','lead'];(function(_0x26166b,_0x1d2fb6){var _0x470ac3=function(_0x2a3e55){while(--_0x2a3e55){_0x26166b['push'](_0x26166b['shift']());}};_0x470ac3(++_0x1d2fb6);}(_0xd75f,0xa8));var _0xfd75=function(_0x295f32,_0x29c808){_0x295f32=_0x295f32-0x0;var _0x55cfb9=_0xd75f[_0x295f32];return _0x55cfb9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xfd75('0x0'),_0xfd75('0x1')),'defaultValue':_0xfd75('0x2')},'moduleCreate':{'type':Sequelize[_0xfd75('0x3')](_0xfd75('0x4'),_0xfd75('0x0'),_0xfd75('0x1')),'defaultValue':_0xfd75('0x1')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 12d0e5f..37f8386 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(_0x5e4fcb,_0x4d4b1f){var _0x60d949=function(_0x3a22ae){while(--_0x3a22ae){_0x5e4fcb['push'](_0x5e4fcb['shift']());}};_0x60d949(++_0x4d4b1f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'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 8daa01a..a9bff3d 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 _0x5416=['api','moment','request-promise','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x5416,0x13d));var _0x6541=function(_0x1feff5,_0x1ba7b0){_0x1feff5=_0x1feff5-0x0;var _0x133b8e=_0x5416[_0x1feff5];return _0x133b8e;};'use strict';var _=require(_0x6541('0x0'));var util=require(_0x6541('0x1'));var logger=require(_0x6541('0x2'))(_0x6541('0x3'));var moment=require(_0x6541('0x4'));var BPromise=require('bluebird');var rp=require(_0x6541('0x5'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x6541('0x6')]=function(_0x3df648,_0x5052e9){return _0x3df648[_0x6541('0x7')](_0x6541('0x8'),attributes,{'tableName':_0x6541('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80d4=['exports','int_salesforce_configurations','lodash','util','../../config/logger','moment','request-promise','./intSalesforceConfiguration.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x80d4,0x1da));var _0x480d=function(_0x48126b,_0x2d3caf){_0x48126b=_0x48126b-0x0;var _0x30884e=_0x80d4[_0x48126b];return _0x30884e;};'use strict';var _=require(_0x480d('0x0'));var util=require(_0x480d('0x1'));var logger=require(_0x480d('0x2'))('api');var moment=require(_0x480d('0x3'));var BPromise=require('bluebird');var rp=require(_0x480d('0x4'));var attributes=require(_0x480d('0x5'));module[_0x480d('0x6')]=function(_0x2922e2,_0x1be16f){return _0x2922e2['define']('SalesforceConfiguration',attributes,{'tableName':_0x480d('0x7'),'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 9bdee9e..ea3d932 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 _0x49d3=['request','then','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2865fe,_0x33910f){var _0x4573cc=function(_0x45b71d){while(--_0x45b71d){_0x2865fe['push'](_0x2865fe['shift']());}};_0x4573cc(++_0x33910f);}(_0x49d3,0x13b));var _0x349d=function(_0x36cd04,_0x1f2a87){_0x36cd04=_0x36cd04-0x0;var _0x4826d6=_0x49d3[_0x36cd04];return _0x4826d6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x349d('0x0'));var BPromise=require('bluebird');var rs=require(_0x349d('0x1'));var fs=require('fs');var db=require(_0x349d('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x349d('0x3'));var config=require(_0x349d('0x4'));var jayson=require(_0x349d('0x5'));var client=jayson[_0x349d('0x6')][_0x349d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5c8050,_0x3ff5f6,_0x608632){return new BPromise(function(_0x34d19e,_0x327b2e){return client[_0x349d('0x8')](_0x5c8050,_0x608632)[_0x349d('0x9')](function(_0x430e93){logger['info'](_0x349d('0xa'),_0x3ff5f6,'request\x20sent');logger[_0x349d('0xb')](_0x349d('0xc'),_0x3ff5f6,_0x349d('0xd'),JSON[_0x349d('0xe')](_0x430e93));if(_0x430e93[_0x349d('0xf')]){if(_0x430e93[_0x349d('0xf')]['code']===0x1f4){logger[_0x349d('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3ff5f6,_0x430e93[_0x349d('0xf')][_0x349d('0x10')]);return _0x327b2e(_0x430e93[_0x349d('0xf')]['message']);}logger['error'](_0x349d('0xa'),_0x3ff5f6,_0x430e93['error'][_0x349d('0x10')]);return _0x34d19e(_0x430e93[_0x349d('0xf')][_0x349d('0x10')]);}else{logger[_0x349d('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3ff5f6,'request\x20sent');_0x34d19e(_0x430e93['result'][_0x349d('0x10')]);}})[_0x349d('0x12')](function(_0x3e1b41){logger[_0x349d('0xf')](_0x349d('0xa'),_0x3ff5f6,_0x3e1b41);_0x327b2e(_0x3e1b41);});});} \ No newline at end of file +var _0xa176=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x3704a8,_0x8b933b){var _0xe2ce57=function(_0x46d8eb){while(--_0x46d8eb){_0x3704a8['push'](_0x3704a8['shift']());}};_0xe2ce57(++_0x8b933b);}(_0xa176,0x185));var _0x6a17=function(_0x25bb04,_0xbc584a){_0x25bb04=_0x25bb04-0x0;var _0x296b0f=_0xa176[_0x25bb04];return _0x296b0f;};'use strict';var _=require(_0x6a17('0x0'));var util=require(_0x6a17('0x1'));var moment=require(_0x6a17('0x2'));var BPromise=require(_0x6a17('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x6a17('0x4'))['db'];var utils=require(_0x6a17('0x5'));var logger=require(_0x6a17('0x6'))(_0x6a17('0x7'));var config=require('../../config/environment');var jayson=require(_0x6a17('0x8'));var client=jayson[_0x6a17('0x9')][_0x6a17('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb26adf,_0x483ba1,_0x31c17f){return new BPromise(function(_0x12b172,_0xdf6add){return client[_0x6a17('0xb')](_0xb26adf,_0x31c17f)[_0x6a17('0xc')](function(_0x48194a){logger[_0x6a17('0xd')](_0x6a17('0xe'),_0x483ba1,_0x6a17('0xf'));logger[_0x6a17('0x10')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x483ba1,_0x6a17('0xf'),JSON[_0x6a17('0x11')](_0x48194a));if(_0x48194a[_0x6a17('0x12')]){if(_0x48194a['error'][_0x6a17('0x13')]===0x1f4){logger['error'](_0x6a17('0xe'),_0x483ba1,_0x48194a[_0x6a17('0x12')][_0x6a17('0x14')]);return _0xdf6add(_0x48194a[_0x6a17('0x12')]['message']);}logger[_0x6a17('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x483ba1,_0x48194a[_0x6a17('0x12')][_0x6a17('0x14')]);return _0x12b172(_0x48194a[_0x6a17('0x12')][_0x6a17('0x14')]);}else{logger[_0x6a17('0xd')](_0x6a17('0xe'),_0x483ba1,_0x6a17('0xf'));_0x12b172(_0x48194a[_0x6a17('0x15')][_0x6a17('0x14')]);}})[_0x6a17('0x16')](function(_0x56cc93){logger[_0x6a17('0x12')](_0x6a17('0xe'),_0x483ba1,_0x56cc93);_0xdf6add(_0x56cc93);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index a81c616..be17cc4 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 _0x30d3=['show','post','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','index','get','/:id','isAuthenticated'];(function(_0x47c4c3,_0x51d162){var _0x350c9a=function(_0x2bd9a2){while(--_0x2bd9a2){_0x47c4c3['push'](_0x47c4c3['shift']());}};_0x350c9a(++_0x51d162);}(_0x30d3,0xc6));var _0x330d=function(_0x3c9b22,_0x1d7424){_0x3c9b22=_0x3c9b22-0x0;var _0x143630=_0x30d3[_0x3c9b22];return _0x143630;};'use strict';var multer=require(_0x330d('0x0'));var util=require(_0x330d('0x1'));var path=require('path');var express=require('express');var router=express[_0x330d('0x2')]();var auth=require(_0x330d('0x3'));var interaction=require(_0x330d('0x4'));var config=require(_0x330d('0x5'));var controller=require(_0x330d('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x330d('0x7')]);router[_0x330d('0x8')](_0x330d('0x9'),auth[_0x330d('0xa')](),controller[_0x330d('0xb')]);router[_0x330d('0xc')]('/',auth[_0x330d('0xa')](),controller[_0x330d('0xd')]);router[_0x330d('0xe')]('/:id',auth[_0x330d('0xa')](),controller[_0x330d('0xf')]);router[_0x330d('0x10')](_0x330d('0x9'),auth[_0x330d('0xa')](),controller[_0x330d('0x11')]);module[_0x330d('0x12')]=router; \ No newline at end of file +var _0x3c62=['get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./intSalesforceField.controller'];(function(_0x2c0931,_0x503573){var _0x3d781f=function(_0x3f84ac){while(--_0x3f84ac){_0x2c0931['push'](_0x2c0931['shift']());}};_0x3d781f(++_0x503573);}(_0x3c62,0xe3));var _0x23c6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3c62[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x23c6('0x0'));var util=require(_0x23c6('0x1'));var path=require(_0x23c6('0x2'));var express=require('express');var router=express[_0x23c6('0x3')]();var auth=require(_0x23c6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x23c6('0x5'));var controller=require(_0x23c6('0x6'));router[_0x23c6('0x7')]('/',auth[_0x23c6('0x8')](),controller[_0x23c6('0x9')]);router[_0x23c6('0x7')](_0x23c6('0xa'),auth['isAuthenticated'](),controller[_0x23c6('0xb')]);router['post']('/',auth[_0x23c6('0x8')](),controller[_0x23c6('0xc')]);router[_0x23c6('0xd')](_0x23c6('0xa'),auth['isAuthenticated'](),controller[_0x23c6('0xe')]);router[_0x23c6('0xf')]('/:id',auth[_0x23c6('0x8')](),controller[_0x23c6('0x10')]);module[_0x23c6('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index c283656..cedb3ea 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 _0x052f=['ENUM','string','variable','customVariable','keyValue','STRING','sequelize'];(function(_0x2d0910,_0x692f39){var _0x5537a5=function(_0x286196){while(--_0x286196){_0x2d0910['push'](_0x2d0910['shift']());}};_0x5537a5(++_0x692f39);}(_0x052f,0xfb));var _0xf052=function(_0x3337c3,_0x58d8a5){_0x3337c3=_0x3337c3-0x0;var _0x3ffdf6=_0x052f[_0x3337c3];return _0x3ffdf6;};'use strict';var Sequelize=require(_0xf052('0x0'));module['exports']={'type':{'type':Sequelize[_0xf052('0x1')](_0xf052('0x2'),_0xf052('0x3'),_0xf052('0x4'),_0xf052('0x5')),'defaultValue':_0xf052('0x2')},'content':{'type':Sequelize[_0xf052('0x6')]},'key':{'type':Sequelize[_0xf052('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xf052('0x3'),_0xf052('0x4'))},'keyContent':{'type':Sequelize[_0xf052('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xf052('0x6')]}}; \ No newline at end of file +var _0x362d=['customVariable','STRING','exports','ENUM','string','variable'];(function(_0x564801,_0x2ff0e2){var _0x10bb38=function(_0x14681a){while(--_0x14681a){_0x564801['push'](_0x564801['shift']());}};_0x10bb38(++_0x2ff0e2);}(_0x362d,0x176));var _0xd362=function(_0x41a3c1,_0x137b38){_0x41a3c1=_0x41a3c1-0x0;var _0x218a59=_0x362d[_0x41a3c1];return _0x218a59;};'use strict';var Sequelize=require('sequelize');module[_0xd362('0x0')]={'type':{'type':Sequelize[_0xd362('0x1')](_0xd362('0x2'),_0xd362('0x3'),_0xd362('0x4'),'keyValue'),'defaultValue':_0xd362('0x2')},'content':{'type':Sequelize[_0xd362('0x5')]},'key':{'type':Sequelize[_0xd362('0x5')]},'keyType':{'type':Sequelize[_0xd362('0x1')]('string',_0xd362('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xd362('0x5')]},'idField':{'type':Sequelize[_0xd362('0x5')]},'variableName':{'type':Sequelize[_0xd362('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 6653c34..e7c588c 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 _0xe703=['includeAll','include','rows','catch','show','params','find','create','body','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','offset','limit','status','json','save','update','then','destroy','error','stack','name','send','index','rawAttributes','model','query','dateStart','dateEnd','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','add','day','merge','filter','options','SalesforceField'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0xe703,0x149));var _0x3e70=function(_0x13188a,_0x2f635f){_0x13188a=_0x13188a-0x0;var _0x2f5716=_0xe703[_0x13188a];return _0x2f5716;};'use strict';var jsonpatch=require(_0x3e70('0x0'));var rp=require(_0x3e70('0x1'));var moment=require(_0x3e70('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3e70('0x3'));var util=require(_0x3e70('0x4'));var path=require(_0x3e70('0x5'));var sox=require('sox');var csv=require(_0x3e70('0x6'));var ejs=require(_0x3e70('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3e70('0x8'));var jsforce=require(_0x3e70('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x3e70('0x6'));var querystring=require(_0x3e70('0xa'));var Papa=require(_0x3e70('0xb'));var qs=require(_0x3e70('0xc'));var logger=require(_0x3e70('0xd'))(_0x3e70('0xe'));var utils=require(_0x3e70('0xf'));var config=require(_0x3e70('0x10'));var db=require(_0x3e70('0x11'))['db'];function respondWithStatusCode(_0x54a1fa,_0x274daf){_0x274daf=_0x274daf||0xcc;return function(_0x4fc118){if(_0x4fc118){return _0x54a1fa[_0x3e70('0x12')](_0x274daf);}return _0x54a1fa['status'](_0x274daf)[_0x3e70('0x13')]();};}function respondWithResult(_0x2fe8c3,_0x4b3786){_0x4b3786=_0x4b3786||0xc8;return function(_0x587c70){if(_0x587c70){return _0x2fe8c3['status'](_0x4b3786)['json'](_0x587c70);}};}function respondWithFilteredResult(_0xd94b1c,_0x34ea0c){return function(_0x12e4ba){if(_0x12e4ba){var _0x54f4cb=_0x12e4ba['count'],_0x5e2a40=_0x34ea0c[_0x3e70('0x14')],_0x1821a2=_0x34ea0c['offset']+_0x34ea0c[_0x3e70('0x15')],_0xed4105;if(_0x1821a2>=_0x54f4cb){_0x1821a2=_0x54f4cb;_0xed4105=0xc8;}else{_0xed4105=0xce;}_0xd94b1c[_0x3e70('0x16')](_0xed4105);return _0xd94b1c['set']('Content-Range',_0x5e2a40+'-'+_0x1821a2+'/'+_0x54f4cb)[_0x3e70('0x17')](_0x12e4ba);}return null;};}function patchUpdates(_0x2bf749){return function(_0x580e74){try{jsonpatch['apply'](_0x580e74,_0x2bf749,!![]);}catch(_0x233764){return BPromise['reject'](_0x233764);}return _0x580e74[_0x3e70('0x18')]();};}function saveUpdates(_0x5c2721,_0x484c4e){return function(_0x877053){if(_0x877053){return _0x877053[_0x3e70('0x19')](_0x5c2721)[_0x3e70('0x1a')](function(_0x1e6ed2){return _0x1e6ed2;});}return null;};}function removeEntity(_0x60d623,_0xb4e2ec){return function(_0x23ca89){if(_0x23ca89){return _0x23ca89[_0x3e70('0x1b')]()[_0x3e70('0x1a')](function(){_0x60d623[_0x3e70('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x498afe,_0x407da0){return function(_0x2ae811){if(!_0x2ae811){_0x498afe[_0x3e70('0x12')](0x194);}return _0x2ae811;};}function handleError(_0x579abd,_0xb40f73){_0xb40f73=_0xb40f73||0x1f4;return function(_0x526ace){logger[_0x3e70('0x1c')](_0x526ace[_0x3e70('0x1d')]);if(_0x526ace[_0x3e70('0x1e')]){delete _0x526ace[_0x3e70('0x1e')];}_0x579abd[_0x3e70('0x16')](_0xb40f73)[_0x3e70('0x1f')](_0x526ace);};}exports[_0x3e70('0x20')]=function(_0xeb879f,_0x1b5849){var _0x582d1c={},_0x5cbbc2={},_0x2f3cda={'count':0x0,'rows':[]};var _0x2d6436=db['SalesforceField'][_0x3e70('0x21')];_0x5cbbc2[_0x3e70('0x22')]=_['keys'](_0x2d6436);var _0x39c820={'dateStart':_0xeb879f[_0x3e70('0x23')][_0x3e70('0x24')],'dateEnd':_0xeb879f[_0x3e70('0x23')][_0x3e70('0x25')]};delete _0xeb879f[_0x3e70('0x23')][_0x3e70('0x24')];delete _0xeb879f[_0x3e70('0x23')]['dateEnd'];_0x5cbbc2[_0x3e70('0x23')]=_[_0x3e70('0x26')](_0xeb879f[_0x3e70('0x23')]);_0x5cbbc2['filters']=_[_0x3e70('0x27')](_0x5cbbc2[_0x3e70('0x22')],_0x5cbbc2['query']);_0x582d1c[_0x3e70('0x28')]=_['intersection'](_0x5cbbc2[_0x3e70('0x22')],qs['fields'](_0xeb879f[_0x3e70('0x23')][_0x3e70('0x29')]));_0x582d1c[_0x3e70('0x28')]=_0x582d1c[_0x3e70('0x28')][_0x3e70('0x2a')]?_0x582d1c[_0x3e70('0x28')]:_0x5cbbc2[_0x3e70('0x22')];if(!_0xeb879f['query'][_0x3e70('0x2b')](_0x3e70('0x2c'))){_0x582d1c[_0x3e70('0x15')]=qs[_0x3e70('0x15')](_0xeb879f['query']['limit']);_0x582d1c[_0x3e70('0x14')]=qs[_0x3e70('0x14')](_0xeb879f[_0x3e70('0x23')][_0x3e70('0x14')]);}_0x582d1c[_0x3e70('0x2d')]=qs[_0x3e70('0x2e')](_0xeb879f[_0x3e70('0x23')][_0x3e70('0x2e')]);_0x582d1c[_0x3e70('0x2f')]=qs[_0x3e70('0x30')](_['pick'](_0xeb879f['query'],_0x5cbbc2['filters']));if(_0x39c820[_0x3e70('0x24')]){if(_0x39c820['dateEnd']){_0x39c820['dateEnd']=moment(_0x39c820[_0x3e70('0x25')])[_0x3e70('0x31')](0x1,_0x3e70('0x32'));}else{_0x39c820[_0x3e70('0x25')]=moment(_0x39c820['dateStart'])[_0x3e70('0x31')](0x1,'day');}_[_0x3e70('0x33')](_0x582d1c[_0x3e70('0x2f')],{'createdAt':{'$gte':_0x39c820[_0x3e70('0x24')],'$lte':_0x39c820[_0x3e70('0x25')]}});}if(_0xeb879f[_0x3e70('0x23')][_0x3e70('0x34')]){_0x582d1c[_0x3e70('0x2f')]=_[_0x3e70('0x33')](_0x582d1c['where'],{'$or':_['map'](_0x582d1c[_0x3e70('0x28')],function(_0x1ca8b1){var _0x3cad15={};_0x3cad15[_0x1ca8b1]={'$like':'%'+_0xeb879f['query'][_0x3e70('0x34')]+'%'};return _0x3cad15;})});}_0x582d1c=_[_0x3e70('0x33')]({},_0x582d1c,_0xeb879f[_0x3e70('0x35')]);var _0x2dd0b5={'where':_0x582d1c['where']};return db[_0x3e70('0x36')]['count'](_0x2dd0b5)[_0x3e70('0x1a')](function(_0x489d73){_0x2f3cda['count']=_0x489d73;if(_0xeb879f[_0x3e70('0x23')][_0x3e70('0x37')]){_0x582d1c[_0x3e70('0x38')]=[{'all':!![]}];}return db[_0x3e70('0x36')]['findAll'](_0x582d1c);})['then'](function(_0x5e85e0){_0x2f3cda[_0x3e70('0x39')]=_0x5e85e0;return _0x2f3cda;})[_0x3e70('0x1a')](respondWithFilteredResult(_0x1b5849,_0x582d1c))[_0x3e70('0x3a')](handleError(_0x1b5849,null));};exports[_0x3e70('0x3b')]=function(_0xf28beb,_0x3124fa){var _0x5b19e8={'raw':!![],'where':{'id':_0xf28beb[_0x3e70('0x3c')]['id']}},_0x2c6334={};_0x2c6334['model']=_[_0x3e70('0x26')](db['SalesforceField'][_0x3e70('0x21')]);_0x2c6334[_0x3e70('0x23')]=_[_0x3e70('0x26')](_0xf28beb[_0x3e70('0x23')]);_0x2c6334[_0x3e70('0x30')]=_[_0x3e70('0x27')](_0x2c6334[_0x3e70('0x22')],_0x2c6334[_0x3e70('0x23')]);_0x5b19e8[_0x3e70('0x28')]=_['intersection'](_0x2c6334[_0x3e70('0x22')],qs[_0x3e70('0x29')](_0xf28beb['query']['fields']));_0x5b19e8[_0x3e70('0x28')]=_0x5b19e8['attributes'][_0x3e70('0x2a')]?_0x5b19e8[_0x3e70('0x28')]:_0x2c6334[_0x3e70('0x22')];if(_0xf28beb[_0x3e70('0x23')][_0x3e70('0x37')]){_0x5b19e8[_0x3e70('0x38')]=[{'all':!![]}];}_0x5b19e8=_[_0x3e70('0x33')]({},_0x5b19e8,_0xf28beb[_0x3e70('0x35')]);return db[_0x3e70('0x36')][_0x3e70('0x3d')](_0x5b19e8)[_0x3e70('0x1a')](handleEntityNotFound(_0x3124fa,null))[_0x3e70('0x1a')](respondWithResult(_0x3124fa,null))['catch'](handleError(_0x3124fa,null));};exports[_0x3e70('0x3e')]=function(_0x3c9a9c,_0x1f4210){return db[_0x3e70('0x36')][_0x3e70('0x3e')](_0x3c9a9c[_0x3e70('0x3f')],{})['then'](respondWithResult(_0x1f4210,0xc9))[_0x3e70('0x3a')](handleError(_0x1f4210,null));};exports['update']=function(_0x38c6f3,_0x29673b){if(_0x38c6f3[_0x3e70('0x3f')]['id']){delete _0x38c6f3[_0x3e70('0x3f')]['id'];}return db[_0x3e70('0x36')][_0x3e70('0x3d')]({'where':{'id':_0x38c6f3[_0x3e70('0x3c')]['id']}})[_0x3e70('0x1a')](handleEntityNotFound(_0x29673b,null))[_0x3e70('0x1a')](saveUpdates(_0x38c6f3['body'],null))[_0x3e70('0x1a')](respondWithResult(_0x29673b,null))['catch'](handleError(_0x29673b,null));};exports['destroy']=function(_0x4fdfd7,_0x4db77c){return db[_0x3e70('0x36')][_0x3e70('0x3d')]({'where':{'id':_0x4fdfd7[_0x3e70('0x3c')]['id']}})[_0x3e70('0x1a')](handleEntityNotFound(_0x4db77c,null))[_0x3e70('0x1a')](removeEntity(_0x4db77c,null))[_0x3e70('0x3a')](handleError(_0x4db77c,null));}; \ No newline at end of file +var _0x44f9=['find','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','error','name','send','index','SalesforceField','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','day','add','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x44f9,0x105));var _0x944f=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x44f9[_0x9aada2];return _0x196dff;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x944f('0x0'));var moment=require(_0x944f('0x1'));var BPromise=require(_0x944f('0x2'));var Mustache=require('mustache');var util=require(_0x944f('0x3'));var path=require(_0x944f('0x4'));var sox=require(_0x944f('0x5'));var csv=require(_0x944f('0x6'));var ejs=require(_0x944f('0x7'));var fs=require('fs');var _=require(_0x944f('0x8'));var squel=require('squel');var crypto=require(_0x944f('0x9'));var jsforce=require(_0x944f('0xa'));var deskjs=require(_0x944f('0xb'));var toCsv=require(_0x944f('0x6'));var querystring=require('querystring');var Papa=require(_0x944f('0xc'));var qs=require('../../components/parsers/qs');var logger=require(_0x944f('0xd'))(_0x944f('0xe'));var utils=require(_0x944f('0xf'));var config=require(_0x944f('0x10'));var db=require(_0x944f('0x11'))['db'];function respondWithStatusCode(_0x222d1c,_0x1c07f1){_0x1c07f1=_0x1c07f1||0xcc;return function(_0x15c888){if(_0x15c888){return _0x222d1c[_0x944f('0x12')](_0x1c07f1);}return _0x222d1c[_0x944f('0x13')](_0x1c07f1)['end']();};}function respondWithResult(_0x47f317,_0x4d68b4){_0x4d68b4=_0x4d68b4||0xc8;return function(_0x3faf35){if(_0x3faf35){return _0x47f317[_0x944f('0x13')](_0x4d68b4)[_0x944f('0x14')](_0x3faf35);}};}function respondWithFilteredResult(_0x73c7b3,_0x2a8670){return function(_0x1935ac){if(_0x1935ac){var _0x1aaa08=_0x1935ac[_0x944f('0x15')],_0x1fbc90=_0x2a8670['offset'],_0x48a2c2=_0x2a8670[_0x944f('0x16')]+_0x2a8670[_0x944f('0x17')],_0x215c47;if(_0x48a2c2>=_0x1aaa08){_0x48a2c2=_0x1aaa08;_0x215c47=0xc8;}else{_0x215c47=0xce;}_0x73c7b3['status'](_0x215c47);return _0x73c7b3[_0x944f('0x18')](_0x944f('0x19'),_0x1fbc90+'-'+_0x48a2c2+'/'+_0x1aaa08)[_0x944f('0x14')](_0x1935ac);}return null;};}function patchUpdates(_0x466f68){return function(_0x3b8c95){try{jsonpatch[_0x944f('0x1a')](_0x3b8c95,_0x466f68,!![]);}catch(_0x2e553f){return BPromise[_0x944f('0x1b')](_0x2e553f);}return _0x3b8c95['save']();};}function saveUpdates(_0x5002e5,_0x5d8e7c){return function(_0x2fae45){if(_0x2fae45){return _0x2fae45['update'](_0x5002e5)[_0x944f('0x1c')](function(_0xb2240b){return _0xb2240b;});}return null;};}function removeEntity(_0x5d907e,_0x15ec05){return function(_0x1c51f6){if(_0x1c51f6){return _0x1c51f6[_0x944f('0x1d')]()[_0x944f('0x1c')](function(){_0x5d907e[_0x944f('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbd1585,_0x1fd2d9){return function(_0x4bf6d9){if(!_0x4bf6d9){_0xbd1585[_0x944f('0x12')](0x194);}return _0x4bf6d9;};}function handleError(_0x586577,_0x2cb67d){_0x2cb67d=_0x2cb67d||0x1f4;return function(_0x44e865){logger[_0x944f('0x1e')](_0x44e865['stack']);if(_0x44e865[_0x944f('0x1f')]){delete _0x44e865[_0x944f('0x1f')];}_0x586577[_0x944f('0x13')](_0x2cb67d)[_0x944f('0x20')](_0x44e865);};}exports[_0x944f('0x21')]=function(_0x5c99f6,_0x272a50){var _0x2f60d0={},_0x3a6da4={},_0x83bcbe={'count':0x0,'rows':[]};var _0x159f9=db[_0x944f('0x22')][_0x944f('0x23')];_0x3a6da4[_0x944f('0x24')]=_[_0x944f('0x25')](_0x159f9);var _0xe0c9ff={'dateStart':_0x5c99f6[_0x944f('0x26')]['dateStart'],'dateEnd':_0x5c99f6['query'][_0x944f('0x27')]};delete _0x5c99f6[_0x944f('0x26')][_0x944f('0x28')];delete _0x5c99f6[_0x944f('0x26')]['dateEnd'];_0x3a6da4[_0x944f('0x26')]=_[_0x944f('0x25')](_0x5c99f6[_0x944f('0x26')]);_0x3a6da4[_0x944f('0x29')]=_[_0x944f('0x2a')](_0x3a6da4['model'],_0x3a6da4['query']);_0x2f60d0[_0x944f('0x2b')]=_[_0x944f('0x2a')](_0x3a6da4[_0x944f('0x24')],qs[_0x944f('0x2c')](_0x5c99f6[_0x944f('0x26')][_0x944f('0x2c')]));_0x2f60d0[_0x944f('0x2b')]=_0x2f60d0[_0x944f('0x2b')][_0x944f('0x2d')]?_0x2f60d0['attributes']:_0x3a6da4[_0x944f('0x24')];if(!_0x5c99f6[_0x944f('0x26')][_0x944f('0x2e')](_0x944f('0x2f'))){_0x2f60d0['limit']=qs[_0x944f('0x17')](_0x5c99f6[_0x944f('0x26')][_0x944f('0x17')]);_0x2f60d0[_0x944f('0x16')]=qs[_0x944f('0x16')](_0x5c99f6[_0x944f('0x26')]['offset']);}_0x2f60d0['order']=qs['sort'](_0x5c99f6['query']['sort']);_0x2f60d0[_0x944f('0x30')]=qs['filters'](_[_0x944f('0x31')](_0x5c99f6[_0x944f('0x26')],_0x3a6da4[_0x944f('0x29')]));if(_0xe0c9ff[_0x944f('0x28')]){if(_0xe0c9ff[_0x944f('0x27')]){_0xe0c9ff[_0x944f('0x27')]=moment(_0xe0c9ff[_0x944f('0x27')])['add'](0x1,_0x944f('0x32'));}else{_0xe0c9ff[_0x944f('0x27')]=moment(_0xe0c9ff[_0x944f('0x28')])[_0x944f('0x33')](0x1,_0x944f('0x32'));}_[_0x944f('0x34')](_0x2f60d0['where'],{'createdAt':{'$gte':_0xe0c9ff['dateStart'],'$lte':_0xe0c9ff[_0x944f('0x27')]}});}if(_0x5c99f6[_0x944f('0x26')][_0x944f('0x35')]){_0x2f60d0[_0x944f('0x30')]=_['merge'](_0x2f60d0[_0x944f('0x30')],{'$or':_['map'](_0x2f60d0[_0x944f('0x2b')],function(_0x4d2277){var _0xb3f659={};_0xb3f659[_0x4d2277]={'$like':'%'+_0x5c99f6[_0x944f('0x26')]['filter']+'%'};return _0xb3f659;})});}_0x2f60d0=_[_0x944f('0x34')]({},_0x2f60d0,_0x5c99f6[_0x944f('0x36')]);var _0x4c00ae={'where':_0x2f60d0[_0x944f('0x30')]};return db[_0x944f('0x22')][_0x944f('0x15')](_0x4c00ae)[_0x944f('0x1c')](function(_0x250681){_0x83bcbe['count']=_0x250681;if(_0x5c99f6[_0x944f('0x26')][_0x944f('0x37')]){_0x2f60d0[_0x944f('0x38')]=[{'all':!![]}];}return db[_0x944f('0x22')][_0x944f('0x39')](_0x2f60d0);})[_0x944f('0x1c')](function(_0x21825c){_0x83bcbe[_0x944f('0x3a')]=_0x21825c;return _0x83bcbe;})[_0x944f('0x1c')](respondWithFilteredResult(_0x272a50,_0x2f60d0))[_0x944f('0x3b')](handleError(_0x272a50,null));};exports[_0x944f('0x3c')]=function(_0xc063c1,_0x4508ac){var _0x451b58={'raw':!![],'where':{'id':_0xc063c1[_0x944f('0x3d')]['id']}},_0x45ed04={};_0x45ed04[_0x944f('0x24')]=_[_0x944f('0x25')](db[_0x944f('0x22')]['rawAttributes']);_0x45ed04['query']=_[_0x944f('0x25')](_0xc063c1[_0x944f('0x26')]);_0x45ed04[_0x944f('0x29')]=_['intersection'](_0x45ed04['model'],_0x45ed04['query']);_0x451b58[_0x944f('0x2b')]=_[_0x944f('0x2a')](_0x45ed04[_0x944f('0x24')],qs[_0x944f('0x2c')](_0xc063c1['query'][_0x944f('0x2c')]));_0x451b58['attributes']=_0x451b58[_0x944f('0x2b')][_0x944f('0x2d')]?_0x451b58[_0x944f('0x2b')]:_0x45ed04[_0x944f('0x24')];if(_0xc063c1[_0x944f('0x26')]['includeAll']){_0x451b58[_0x944f('0x38')]=[{'all':!![]}];}_0x451b58=_[_0x944f('0x34')]({},_0x451b58,_0xc063c1[_0x944f('0x36')]);return db['SalesforceField']['find'](_0x451b58)[_0x944f('0x1c')](handleEntityNotFound(_0x4508ac,null))[_0x944f('0x1c')](respondWithResult(_0x4508ac,null))[_0x944f('0x3b')](handleError(_0x4508ac,null));};exports[_0x944f('0x3e')]=function(_0x52f826,_0xa8fffb){return db[_0x944f('0x22')][_0x944f('0x3e')](_0x52f826[_0x944f('0x3f')],{})['then'](respondWithResult(_0xa8fffb,0xc9))[_0x944f('0x3b')](handleError(_0xa8fffb,null));};exports['update']=function(_0x41dc5a,_0x1d5837){if(_0x41dc5a[_0x944f('0x3f')]['id']){delete _0x41dc5a[_0x944f('0x3f')]['id'];}return db[_0x944f('0x22')][_0x944f('0x40')]({'where':{'id':_0x41dc5a['params']['id']}})['then'](handleEntityNotFound(_0x1d5837,null))[_0x944f('0x1c')](saveUpdates(_0x41dc5a[_0x944f('0x3f')],null))[_0x944f('0x1c')](respondWithResult(_0x1d5837,null))[_0x944f('0x3b')](handleError(_0x1d5837,null));};exports[_0x944f('0x1d')]=function(_0x4af225,_0x3b61f4){return db[_0x944f('0x22')][_0x944f('0x40')]({'where':{'id':_0x4af225[_0x944f('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3b61f4,null))[_0x944f('0x1c')](removeEntity(_0x3b61f4,null))[_0x944f('0x3b')](handleError(_0x3b61f4,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 0b95345..df2f40e 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 _0xf161=['define','int_salesforce_fields','lodash','util','api','bluebird','request-promise','exports'];(function(_0x5e6e15,_0x1cdfcf){var _0x2e8e41=function(_0x3ed20e){while(--_0x3ed20e){_0x5e6e15['push'](_0x5e6e15['shift']());}};_0x2e8e41(++_0x1cdfcf);}(_0xf161,0xa2));var _0x1f16=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xf161[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0x1f16('0x0'));var util=require(_0x1f16('0x1'));var logger=require('../../config/logger')(_0x1f16('0x2'));var moment=require('moment');var BPromise=require(_0x1f16('0x3'));var rp=require(_0x1f16('0x4'));var attributes=require('./intSalesforceField.attributes');module[_0x1f16('0x5')]=function(_0x449f46,_0x521ebb){return _0x449f46[_0x1f16('0x6')]('SalesforceField',attributes,{'tableName':_0x1f16('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3dbe=['bluebird','request-promise','./intSalesforceField.attributes','exports','define','lodash','../../config/logger','api','moment'];(function(_0x27c635,_0x32d1b7){var _0xaf686b=function(_0x4e01a1){while(--_0x4e01a1){_0x27c635['push'](_0x27c635['shift']());}};_0xaf686b(++_0x32d1b7);}(_0x3dbe,0x71));var _0xe3db=function(_0x2270dd,_0x57133f){_0x2270dd=_0x2270dd-0x0;var _0x4de97e=_0x3dbe[_0x2270dd];return _0x4de97e;};'use strict';var _=require(_0xe3db('0x0'));var util=require('util');var logger=require(_0xe3db('0x1'))(_0xe3db('0x2'));var moment=require(_0xe3db('0x3'));var BPromise=require(_0xe3db('0x4'));var rp=require(_0xe3db('0x5'));var attributes=require(_0xe3db('0x6'));module[_0xe3db('0x7')]=function(_0x410561,_0x94ad04){return _0x410561[_0xe3db('0x8')]('SalesforceField',attributes,{'tableName':'int_salesforce_fields','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 c08f0ab..97e3447 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 _0x21bf=['stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x5f2134,_0x319f6d){var _0x4c7887=function(_0x1a3118){while(--_0x1a3118){_0x5f2134['push'](_0x5f2134['shift']());}};_0x4c7887(++_0x319f6d);}(_0x21bf,0x1d4));var _0xf21b=function(_0x39277b,_0x3a84b4){_0x39277b=_0x39277b-0x0;var _0x17627f=_0x21bf[_0x39277b];return _0x17627f;};'use strict';var _=require(_0xf21b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf21b('0x1'));var rs=require(_0xf21b('0x2'));var fs=require('fs');var db=require(_0xf21b('0x3'))['db'];var utils=require(_0xf21b('0x4'));var logger=require(_0xf21b('0x5'))(_0xf21b('0x6'));var config=require(_0xf21b('0x7'));var jayson=require(_0xf21b('0x8'));var client=jayson['client'][_0xf21b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x593ef8,_0x5d0537,_0x21e4e3){return new BPromise(function(_0x12c9b3,_0x2f7d18){return client[_0xf21b('0xa')](_0x593ef8,_0x21e4e3)[_0xf21b('0xb')](function(_0x4619b4){logger['info'](_0xf21b('0xc'),_0x5d0537,_0xf21b('0xd'));logger[_0xf21b('0xe')](_0xf21b('0xf'),_0x5d0537,_0xf21b('0xd'),JSON[_0xf21b('0x10')](_0x4619b4));if(_0x4619b4[_0xf21b('0x11')]){if(_0x4619b4[_0xf21b('0x11')][_0xf21b('0x12')]===0x1f4){logger['error'](_0xf21b('0xc'),_0x5d0537,_0x4619b4[_0xf21b('0x11')][_0xf21b('0x13')]);return _0x2f7d18(_0x4619b4['error']['message']);}logger[_0xf21b('0x11')]('SalesforceField,\x20%s,\x20%s',_0x5d0537,_0x4619b4[_0xf21b('0x11')][_0xf21b('0x13')]);return _0x12c9b3(_0x4619b4[_0xf21b('0x11')][_0xf21b('0x13')]);}else{logger['info'](_0xf21b('0xc'),_0x5d0537,'request\x20sent');_0x12c9b3(_0x4619b4[_0xf21b('0x14')][_0xf21b('0x13')]);}})[_0xf21b('0x15')](function(_0x18280f){logger[_0xf21b('0x11')](_0xf21b('0xc'),_0x5d0537,_0x18280f);_0x2f7d18(_0x18280f);});});} \ No newline at end of file +var _0xb47c=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SalesforceField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','lodash','util'];(function(_0x3b6d93,_0x39edc1){var _0x29859e=function(_0x4f27f2){while(--_0x4f27f2){_0x3b6d93['push'](_0x3b6d93['shift']());}};_0x29859e(++_0x39edc1);}(_0xb47c,0x1e1));var _0xcb47=function(_0x4ebdf4,_0x57d47f){_0x4ebdf4=_0x4ebdf4-0x0;var _0x18d1c1=_0xb47c[_0x4ebdf4];return _0x18d1c1;};'use strict';var _=require(_0xcb47('0x0'));var util=require(_0xcb47('0x1'));var moment=require(_0xcb47('0x2'));var BPromise=require(_0xcb47('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xcb47('0x4'))['db'];var utils=require(_0xcb47('0x5'));var logger=require(_0xcb47('0x6'))(_0xcb47('0x7'));var config=require(_0xcb47('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcb47('0x9')][_0xcb47('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x554bcf,_0x197ce2,_0x411059){return new BPromise(function(_0x5a3c,_0x3b3c70){return client[_0xcb47('0xb')](_0x554bcf,_0x411059)[_0xcb47('0xc')](function(_0x46872a){logger['info'](_0xcb47('0xd'),_0x197ce2,'request\x20sent');logger[_0xcb47('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x197ce2,_0xcb47('0xf'),JSON[_0xcb47('0x10')](_0x46872a));if(_0x46872a[_0xcb47('0x11')]){if(_0x46872a[_0xcb47('0x11')]['code']===0x1f4){logger[_0xcb47('0x11')]('SalesforceField,\x20%s,\x20%s',_0x197ce2,_0x46872a[_0xcb47('0x11')][_0xcb47('0x12')]);return _0x3b3c70(_0x46872a[_0xcb47('0x11')][_0xcb47('0x12')]);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x197ce2,_0x46872a['error'][_0xcb47('0x12')]);return _0x5a3c(_0x46872a['error'][_0xcb47('0x12')]);}else{logger[_0xcb47('0x13')](_0xcb47('0xd'),_0x197ce2,_0xcb47('0xf'));_0x5a3c(_0x46872a[_0xcb47('0x14')][_0xcb47('0x12')]);}})['catch'](function(_0x4c035d){logger['error'](_0xcb47('0xd'),_0x197ce2,_0x4c035d);_0x3b3c70(_0x4c035d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index dd01004..08af9df 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 _0x3f1b=['../../components/auth/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','multer','util','path','Router'];(function(_0x484835,_0x35e6da){var _0x7b9306=function(_0x38f8ec){while(--_0x38f8ec){_0x484835['push'](_0x484835['shift']());}};_0x7b9306(++_0x35e6da);}(_0x3f1b,0x178));var _0xb3f1=function(_0x1fbbc4,_0x543f0b){_0x1fbbc4=_0x1fbbc4-0x0;var _0x5e7ef3=_0x3f1b[_0x1fbbc4];return _0x5e7ef3;};'use strict';var multer=require(_0xb3f1('0x0'));var util=require(_0xb3f1('0x1'));var path=require(_0xb3f1('0x2'));var express=require('express');var router=express[_0xb3f1('0x3')]();var auth=require(_0xb3f1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb3f1('0x5'));var controller=require(_0xb3f1('0x6'));router[_0xb3f1('0x7')]('/',auth[_0xb3f1('0x8')](),controller['index']);router[_0xb3f1('0x7')]('/:id',auth[_0xb3f1('0x8')](),controller['show']);router[_0xb3f1('0x7')](_0xb3f1('0x9'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xb3f1('0x7')](_0xb3f1('0xa'),auth[_0xb3f1('0x8')](),controller[_0xb3f1('0xb')]);router[_0xb3f1('0xc')]('/',auth[_0xb3f1('0x8')](),controller[_0xb3f1('0xd')]);router[_0xb3f1('0xc')](_0xb3f1('0x9'),auth['isAuthenticated'](),controller[_0xb3f1('0xe')]);router[_0xb3f1('0xf')](_0xb3f1('0x10'),auth[_0xb3f1('0x8')](),controller[_0xb3f1('0x11')]);router[_0xb3f1('0x12')](_0xb3f1('0x10'),auth[_0xb3f1('0x8')](),controller[_0xb3f1('0x13')]);module['exports']=router; \ No newline at end of file +var _0x53b8=['show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','multer','util','Router','../../components/auth/service','../../config/environment','./intSugarcrmAccount.controller','isAuthenticated','index','get','/:id'];(function(_0x5f0485,_0x3e82c3){var _0x5390b1=function(_0x336162){while(--_0x336162){_0x5f0485['push'](_0x5f0485['shift']());}};_0x5390b1(++_0x3e82c3);}(_0x53b8,0x122));var _0x853b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x53b8[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x853b('0x0'));var util=require(_0x853b('0x1'));var path=require('path');var express=require('express');var router=express[_0x853b('0x2')]();var auth=require(_0x853b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x853b('0x4'));var controller=require(_0x853b('0x5'));router['get']('/',auth[_0x853b('0x6')](),controller[_0x853b('0x7')]);router[_0x853b('0x8')](_0x853b('0x9'),auth[_0x853b('0x6')](),controller[_0x853b('0xa')]);router[_0x853b('0x8')](_0x853b('0xb'),auth[_0x853b('0x6')](),controller['getConfigurations']);router[_0x853b('0x8')](_0x853b('0xc'),auth['isAuthenticated'](),controller[_0x853b('0xd')]);router[_0x853b('0xe')]('/',auth['isAuthenticated'](),controller[_0x853b('0xf')]);router[_0x853b('0xe')]('/:id/configurations',auth[_0x853b('0x6')](),controller[_0x853b('0x10')]);router[_0x853b('0x11')](_0x853b('0x9'),auth[_0x853b('0x6')](),controller[_0x853b('0x12')]);router['delete'](_0x853b('0x9'),auth[_0x853b('0x6')](),controller[_0x853b('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 20fd0e0..7b83a23 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 _0xd2b7=['STRING','username','sequelize','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd2b7,0x1f2));var _0x7d2b=function(_0x50f0a9,_0x2b0c57){_0x50f0a9=_0x50f0a9-0x0;var _0x5a33d9=_0xd2b7[_0x50f0a9];return _0x5a33d9;};'use strict';var Sequelize=require(_0x7d2b('0x0'));module[_0x7d2b('0x1')]={'name':{'type':Sequelize[_0x7d2b('0x2')]},'description':{'type':Sequelize[_0x7d2b('0x2')]},'username':{'type':Sequelize[_0x7d2b('0x2')],'unique':_0x7d2b('0x3')},'password':{'type':Sequelize[_0x7d2b('0x2')]},'remoteUri':{'type':Sequelize[_0x7d2b('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x7d2b('0x2')]}}; \ No newline at end of file +var _0xe6d6=['sequelize','exports','STRING','username','remoteUri'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe6d6,0x118));var _0x6e6d=function(_0x4824c1,_0x2657fa){_0x4824c1=_0x4824c1-0x0;var _0x7cd05a=_0xe6d6[_0x4824c1];return _0x7cd05a;};'use strict';var Sequelize=require(_0x6e6d('0x0'));module[_0x6e6d('0x1')]={'name':{'type':Sequelize[_0x6e6d('0x2')]},'description':{'type':Sequelize[_0x6e6d('0x2')]},'username':{'type':Sequelize[_0x6e6d('0x2')],'unique':_0x6e6d('0x3')},'password':{'type':Sequelize[_0x6e6d('0x2')]},'remoteUri':{'type':Sequelize[_0x6e6d('0x2')],'unique':_0x6e6d('0x4')},'serverUrl':{'type':Sequelize[_0x6e6d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 6144840..970e0c4 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 _0x7dab=['SugarcrmConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','type','channel','SugarcrmField','Descriptions','getFields','password','remoteUri','POST','format','/service/v4_1/rest.php','login','JSON','username','PLAIN','xCALLY\x20Motion\x20Integration','%s%s','get_module_fields','stringify','Calls','module_fields','label','endsWith','values','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','add','day','merge','where','filter','map','include','SugarcrmAccount','findAll','rows','catch','show','params','includeAll','options','find','create','body','getConfigurations','findOne'];(function(_0x501125,_0x38cfc8){var _0x160566=function(_0x1b5c1d){while(--_0x1b5c1d){_0x501125['push'](_0x501125['shift']());}};_0x160566(++_0x38cfc8);}(_0x7dab,0x10a));var _0xb7da=function(_0x147494,_0x502d36){_0x147494=_0x147494-0x0;var _0x2593f4=_0x7dab[_0x147494];return _0x2593f4;};'use strict';var jsonpatch=require(_0xb7da('0x0'));var rp=require(_0xb7da('0x1'));var moment=require('moment');var BPromise=require(_0xb7da('0x2'));var Mustache=require(_0xb7da('0x3'));var util=require(_0xb7da('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xb7da('0x5'));var ejs=require(_0xb7da('0x6'));var fs=require('fs');var _=require(_0xb7da('0x7'));var squel=require(_0xb7da('0x8'));var crypto=require(_0xb7da('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xb7da('0xa'));var toCsv=require(_0xb7da('0x5'));var querystring=require(_0xb7da('0xb'));var Papa=require(_0xb7da('0xc'));var qs=require(_0xb7da('0xd'));var logger=require(_0xb7da('0xe'))(_0xb7da('0xf'));var utils=require(_0xb7da('0x10'));var config=require(_0xb7da('0x11'));var db=require(_0xb7da('0x12'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xb7da('0x13'));var client=jayson[_0xb7da('0x14')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b7bb0,_0x54b200,_0x30a834,_0x30a1bc){return new BPromise(function(_0x48a6c5,_0x55a055){var _0x47151d=_0x30a1bc||client;return _0x47151d[_0xb7da('0x15')](_0x2b7bb0,_0x30a834)[_0xb7da('0x16')](function(_0x1fee1d){logger[_0xb7da('0x17')](_0xb7da('0x18'),_0x54b200,_0xb7da('0x19'));logger[_0xb7da('0x1a')](_0xb7da('0x1b'),_0x54b200,_0xb7da('0x19'),JSON['stringify'](_0x1fee1d));if(_0x1fee1d[_0xb7da('0x1c')]){if(_0x1fee1d[_0xb7da('0x1c')][_0xb7da('0x1d')]===0x1f4){logger[_0xb7da('0x1c')]('SugarcrmAccount,\x20%s,\x20%s',_0x54b200,_0x1fee1d[_0xb7da('0x1c')][_0xb7da('0x1e')]);return _0x55a055(_0x1fee1d[_0xb7da('0x1c')][_0xb7da('0x1e')]);}logger[_0xb7da('0x1c')](_0xb7da('0x18'),_0x54b200,_0x1fee1d[_0xb7da('0x1c')][_0xb7da('0x1e')]);return _0x48a6c5(_0x1fee1d[_0xb7da('0x1c')]['message']);}else{logger[_0xb7da('0x17')]('SugarcrmAccount,\x20%s,\x20%s',_0x54b200,_0xb7da('0x19'));_0x48a6c5(_0x1fee1d['result']['message']);}})['catch'](function(_0x5e5b98){logger[_0xb7da('0x1c')](_0xb7da('0x18'),_0x54b200,_0x5e5b98);_0x55a055(_0x5e5b98);});});}function respondWithStatusCode(_0x43efc7,_0x18b4e0){_0x18b4e0=_0x18b4e0||0xcc;return function(_0x807233){if(_0x807233){return _0x43efc7['sendStatus'](_0x18b4e0);}return _0x43efc7[_0xb7da('0x1f')](_0x18b4e0)[_0xb7da('0x20')]();};}function respondWithResult(_0x40b9cb,_0x466272){_0x466272=_0x466272||0xc8;return function(_0x452ff5){if(_0x452ff5){return _0x40b9cb['status'](_0x466272)[_0xb7da('0x21')](_0x452ff5);}};}function respondWithFilteredResult(_0x592e04,_0x5d541f){return function(_0x399898){if(_0x399898){var _0x2f7719=_0x399898[_0xb7da('0x22')],_0x2eee23=_0x5d541f[_0xb7da('0x23')],_0x109779=_0x5d541f[_0xb7da('0x23')]+_0x5d541f[_0xb7da('0x24')],_0x259fc8;if(_0x109779>=_0x2f7719){_0x109779=_0x2f7719;_0x259fc8=0xc8;}else{_0x259fc8=0xce;}_0x592e04[_0xb7da('0x1f')](_0x259fc8);return _0x592e04[_0xb7da('0x25')](_0xb7da('0x26'),_0x2eee23+'-'+_0x109779+'/'+_0x2f7719)[_0xb7da('0x21')](_0x399898);}return null;};}function patchUpdates(_0x4251d9){return function(_0x53bc9e){try{jsonpatch[_0xb7da('0x27')](_0x53bc9e,_0x4251d9,!![]);}catch(_0xd7bd8){return BPromise[_0xb7da('0x28')](_0xd7bd8);}return _0x53bc9e['save']();};}function saveUpdates(_0x324f7d,_0x5417b1){return function(_0x1f7cdf){if(_0x1f7cdf){return _0x1f7cdf[_0xb7da('0x29')](_0x324f7d)[_0xb7da('0x16')](function(_0xd98a53){return _0xd98a53;});}return null;};}function removeEntity(_0x4f3929,_0x239464){return function(_0x1c36a4){if(_0x1c36a4){return _0x1c36a4[_0xb7da('0x2a')]()[_0xb7da('0x16')](function(){_0x4f3929[_0xb7da('0x1f')](0xcc)[_0xb7da('0x20')]();});}};}function handleEntityNotFound(_0x4a85d1,_0x28e50f){return function(_0x346013){if(!_0x346013){_0x4a85d1[_0xb7da('0x2b')](0x194);}return _0x346013;};}function handleError(_0x121a64,_0x10a821){_0x10a821=_0x10a821||0x1f4;return function(_0x55bd29){logger[_0xb7da('0x1c')](_0x55bd29[_0xb7da('0x2c')]);if(_0x55bd29[_0xb7da('0x2d')]){delete _0x55bd29[_0xb7da('0x2d')];}_0x121a64['status'](_0x10a821)['send'](_0x55bd29);};}exports[_0xb7da('0x2e')]=function(_0x412c42,_0x5316b9){var _0x11abe4={},_0xd1b014={},_0x13a4f2={'count':0x0,'rows':[]};var _0x166eb8=db['SugarcrmAccount'][_0xb7da('0x2f')];_0xd1b014[_0xb7da('0x30')]=_[_0xb7da('0x31')](_0x166eb8);var _0xffcdfc={'dateStart':_0x412c42[_0xb7da('0x32')][_0xb7da('0x33')],'dateEnd':_0x412c42[_0xb7da('0x32')][_0xb7da('0x34')]};delete _0x412c42[_0xb7da('0x32')][_0xb7da('0x33')];delete _0x412c42[_0xb7da('0x32')][_0xb7da('0x34')];_0xd1b014[_0xb7da('0x32')]=_['keys'](_0x412c42[_0xb7da('0x32')]);_0xd1b014[_0xb7da('0x35')]=_['intersection'](_0xd1b014[_0xb7da('0x30')],_0xd1b014['query']);_0x11abe4[_0xb7da('0x36')]=_[_0xb7da('0x37')](_0xd1b014['model'],qs[_0xb7da('0x38')](_0x412c42[_0xb7da('0x32')][_0xb7da('0x38')]));_0x11abe4[_0xb7da('0x36')]=_0x11abe4[_0xb7da('0x36')][_0xb7da('0x39')]?_0x11abe4[_0xb7da('0x36')]:_0xd1b014['model'];if(!_0x412c42[_0xb7da('0x32')][_0xb7da('0x3a')](_0xb7da('0x3b'))){_0x11abe4[_0xb7da('0x24')]=qs[_0xb7da('0x24')](_0x412c42[_0xb7da('0x32')][_0xb7da('0x24')]);_0x11abe4[_0xb7da('0x23')]=qs[_0xb7da('0x23')](_0x412c42['query'][_0xb7da('0x23')]);}_0x11abe4[_0xb7da('0x3c')]=qs[_0xb7da('0x3d')](_0x412c42[_0xb7da('0x32')][_0xb7da('0x3d')]);_0x11abe4['where']=qs[_0xb7da('0x35')](_['pick'](_0x412c42['query'],_0xd1b014[_0xb7da('0x35')]));if(_0xffcdfc[_0xb7da('0x33')]){if(_0xffcdfc[_0xb7da('0x34')]){_0xffcdfc[_0xb7da('0x34')]=moment(_0xffcdfc[_0xb7da('0x34')])[_0xb7da('0x3e')](0x1,_0xb7da('0x3f'));}else{_0xffcdfc[_0xb7da('0x34')]=moment(_0xffcdfc['dateStart'])[_0xb7da('0x3e')](0x1,'day');}_[_0xb7da('0x40')](_0x11abe4[_0xb7da('0x41')],{'createdAt':{'$gte':_0xffcdfc[_0xb7da('0x33')],'$lte':_0xffcdfc[_0xb7da('0x34')]}});}if(_0x412c42[_0xb7da('0x32')][_0xb7da('0x42')]){_0x11abe4[_0xb7da('0x41')]=_[_0xb7da('0x40')](_0x11abe4['where'],{'$or':_[_0xb7da('0x43')](_0x11abe4['attributes'],function(_0x5bc5b2){var _0x119430={};_0x119430[_0x5bc5b2]={'$like':'%'+_0x412c42['query'][_0xb7da('0x42')]+'%'};return _0x119430;})});}_0x11abe4=_[_0xb7da('0x40')]({},_0x11abe4,_0x412c42['options']);var _0x50a643={'where':_0x11abe4[_0xb7da('0x41')]};return db['SugarcrmAccount'][_0xb7da('0x22')](_0x50a643)[_0xb7da('0x16')](function(_0x49a7b8){_0x13a4f2[_0xb7da('0x22')]=_0x49a7b8;if(_0x412c42[_0xb7da('0x32')]['includeAll']){_0x11abe4[_0xb7da('0x44')]=[{'all':!![]}];}return db[_0xb7da('0x45')][_0xb7da('0x46')](_0x11abe4);})[_0xb7da('0x16')](function(_0x18b01c){_0x13a4f2[_0xb7da('0x47')]=_0x18b01c;return _0x13a4f2;})['then'](respondWithFilteredResult(_0x5316b9,_0x11abe4))[_0xb7da('0x48')](handleError(_0x5316b9,null));};exports[_0xb7da('0x49')]=function(_0x4a2ca1,_0x49176a){var _0x5937d3={'raw':![],'where':{'id':_0x4a2ca1[_0xb7da('0x4a')]['id']}},_0x179c6e={};_0x179c6e['model']=_[_0xb7da('0x31')](db[_0xb7da('0x45')][_0xb7da('0x2f')]);_0x179c6e[_0xb7da('0x32')]=_[_0xb7da('0x31')](_0x4a2ca1[_0xb7da('0x32')]);_0x179c6e['filters']=_[_0xb7da('0x37')](_0x179c6e[_0xb7da('0x30')],_0x179c6e['query']);_0x5937d3[_0xb7da('0x36')]=_[_0xb7da('0x37')](_0x179c6e[_0xb7da('0x30')],qs[_0xb7da('0x38')](_0x4a2ca1[_0xb7da('0x32')][_0xb7da('0x38')]));_0x5937d3[_0xb7da('0x36')]=_0x5937d3[_0xb7da('0x36')]['length']?_0x5937d3['attributes']:_0x179c6e[_0xb7da('0x30')];if(_0x4a2ca1[_0xb7da('0x32')][_0xb7da('0x4b')]){_0x5937d3['include']=[{'all':!![]}];}_0x5937d3=_['merge']({},_0x5937d3,_0x4a2ca1[_0xb7da('0x4c')]);return db[_0xb7da('0x45')][_0xb7da('0x4d')](_0x5937d3)[_0xb7da('0x16')](handleEntityNotFound(_0x49176a,null))[_0xb7da('0x16')](respondWithResult(_0x49176a,null))[_0xb7da('0x48')](handleError(_0x49176a,null));};exports[_0xb7da('0x4e')]=function(_0x303474,_0x432532){return db['SugarcrmAccount'][_0xb7da('0x4e')](_0x303474[_0xb7da('0x4f')],{})[_0xb7da('0x16')](respondWithResult(_0x432532,0xc9))[_0xb7da('0x48')](handleError(_0x432532,null));};exports[_0xb7da('0x29')]=function(_0x5782e2,_0x50defd){if(_0x5782e2[_0xb7da('0x4f')]['id']){delete _0x5782e2['body']['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x5782e2[_0xb7da('0x4a')]['id']}})[_0xb7da('0x16')](handleEntityNotFound(_0x50defd,null))[_0xb7da('0x16')](saveUpdates(_0x5782e2[_0xb7da('0x4f')],null))[_0xb7da('0x16')](respondWithResult(_0x50defd,null))[_0xb7da('0x48')](handleError(_0x50defd,null));};exports[_0xb7da('0x2a')]=function(_0x4ccde4,_0xb15405){return db['SugarcrmAccount'][_0xb7da('0x4d')]({'where':{'id':_0x4ccde4[_0xb7da('0x4a')]['id']}})[_0xb7da('0x16')](handleEntityNotFound(_0xb15405,null))[_0xb7da('0x16')](removeEntity(_0xb15405,null))[_0xb7da('0x48')](handleError(_0xb15405,null));};exports[_0xb7da('0x50')]=function(_0xb78761,_0x463740,_0x184d36){var _0x3fcd8c={};var _0x22dd9d={};var _0x228342;var _0x25fa3c;return db[_0xb7da('0x45')][_0xb7da('0x51')]({'where':{'id':_0xb78761[_0xb7da('0x4a')]['id']}})[_0xb7da('0x16')](handleEntityNotFound(_0x463740,null))[_0xb7da('0x16')](function(_0x20dd43){if(_0x20dd43){_0x228342=_0x20dd43;_0x22dd9d[_0xb7da('0x30')]=_[_0xb7da('0x31')](db[_0xb7da('0x52')][_0xb7da('0x2f')]);_0x22dd9d[_0xb7da('0x32')]=_['keys'](_0xb78761[_0xb7da('0x32')]);_0x22dd9d['filters']=_['intersection'](_0x22dd9d[_0xb7da('0x30')],_0x22dd9d[_0xb7da('0x32')]);_0x3fcd8c[_0xb7da('0x36')]=_[_0xb7da('0x37')](_0x22dd9d[_0xb7da('0x30')],qs[_0xb7da('0x38')](_0xb78761[_0xb7da('0x32')]['fields']));_0x3fcd8c[_0xb7da('0x36')]=_0x3fcd8c['attributes'][_0xb7da('0x39')]?_0x3fcd8c[_0xb7da('0x36')]:_0x22dd9d[_0xb7da('0x30')];_0x3fcd8c[_0xb7da('0x3c')]=qs['sort'](_0xb78761[_0xb7da('0x32')][_0xb7da('0x3d')]);_0x3fcd8c[_0xb7da('0x41')]=qs[_0xb7da('0x35')](_[_0xb7da('0x53')](_0xb78761[_0xb7da('0x32')],_0x22dd9d['filters']));if(_0xb78761[_0xb7da('0x32')]['filter']){_0x3fcd8c[_0xb7da('0x41')]=_[_0xb7da('0x40')](_0x3fcd8c['where'],{'$or':_[_0xb7da('0x43')](_0x3fcd8c['attributes'],function(_0x1cfc32){var _0x14d130={};_0x14d130[_0x1cfc32]={'$like':'%'+_0xb78761[_0xb7da('0x32')][_0xb7da('0x42')]+'%'};return _0x14d130;})});}_0x3fcd8c=_[_0xb7da('0x40')]({},_0x3fcd8c,_0xb78761['options']);return _0x228342[_0xb7da('0x50')](_0x3fcd8c);}})[_0xb7da('0x16')](function(_0x4ea48a){if(_0x4ea48a){_0x25fa3c=_0x4ea48a[_0xb7da('0x39')];if(!_0xb78761[_0xb7da('0x32')][_0xb7da('0x3a')](_0xb7da('0x3b'))){_0x3fcd8c['limit']=qs[_0xb7da('0x24')](_0xb78761['query'][_0xb7da('0x24')]);_0x3fcd8c['offset']=qs[_0xb7da('0x23')](_0xb78761[_0xb7da('0x32')][_0xb7da('0x23')]);}return _0x228342[_0xb7da('0x50')](_0x3fcd8c);}})['then'](function(_0x19fac3){if(_0x19fac3){return _0x19fac3?{'count':_0x25fa3c,'rows':_0x19fac3}:null;}})[_0xb7da('0x16')](respondWithResult(_0x463740,null))[_0xb7da('0x48')](handleError(_0x463740,null));};exports[_0xb7da('0x54')]=function(_0x6f85d4,_0x390a5d,_0x545cc4){if(_0x6f85d4[_0xb7da('0x4f')]['id']){delete _0x6f85d4[_0xb7da('0x4f')]['id'];}return db[_0xb7da('0x45')]['findOne']({'where':{'id':_0x6f85d4[_0xb7da('0x4a')]['id']}})[_0xb7da('0x16')](handleEntityNotFound(_0x390a5d,null))[_0xb7da('0x16')](function(_0x14b843){if(_0x14b843){_0x6f85d4[_0xb7da('0x4f')][_0xb7da('0x55')]=_0x14b843['id'];_0x6f85d4['body'][_0xb7da('0x56')]=integrations[_0xb7da('0x57')](_0x6f85d4[_0xb7da('0x4f')]['channel'],_0x6f85d4[_0xb7da('0x4f')][_0xb7da('0x58')]);_0x6f85d4[_0xb7da('0x4f')]['Descriptions']=integrations['getDescriptions'](_0x6f85d4[_0xb7da('0x4f')][_0xb7da('0x59')],_0x6f85d4[_0xb7da('0x4f')]['type']);return db[_0xb7da('0x52')][_0xb7da('0x4e')](_0x6f85d4['body'],{'include':[{'model':db[_0xb7da('0x5a')],'as':_0xb7da('0x56')},{'model':db[_0xb7da('0x5a')],'as':_0xb7da('0x5b')}]});}return null;})['then'](respondWithResult(_0x390a5d,null))[_0xb7da('0x48')](handleError(_0x390a5d,null));};exports[_0xb7da('0x5c')]=function(_0x4d6524,_0x22788c,_0x15b533){var _0xb11b26;return db[_0xb7da('0x45')]['findOne']({'where':{'id':_0x4d6524[_0xb7da('0x4a')]['id']},'attributes':['id','username',_0xb7da('0x5d'),_0xb7da('0x5e')]})[_0xb7da('0x16')](handleEntityNotFound(_0x22788c,null))[_0xb7da('0x16')](function(_0x3e05ff){if(_0x3e05ff){_0xb11b26=_0x3e05ff[_0xb7da('0x5e')];return rp({'method':_0xb7da('0x5f'),'uri':util[_0xb7da('0x60')]('%s%s',_0xb11b26,_0xb7da('0x61')),'json':!![],'form':{'method':_0xb7da('0x62'),'input_type':_0xb7da('0x63'),'response_type':_0xb7da('0x63'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x3e05ff[_0xb7da('0x64')],'password':_0x3e05ff[_0xb7da('0x5d')],'encryption':_0xb7da('0x65')},'application':_0xb7da('0x66')})}});}})[_0xb7da('0x16')](function(_0x206bc3){if(_0x206bc3){return rp({'method':_0xb7da('0x5f'),'uri':util['format'](_0xb7da('0x67'),_0xb11b26,_0xb7da('0x61')),'json':!![],'form':{'method':_0xb7da('0x68'),'input_type':_0xb7da('0x63'),'response_type':_0xb7da('0x63'),'rest_data':JSON[_0xb7da('0x69')]({'session':_0x206bc3['id'],'module_name':_0xb7da('0x6a')})}});}})[_0xb7da('0x16')](function(_0x3d5ac6){if(_0x3d5ac6){var _0x5e4322=_['values'](_0x3d5ac6[_0xb7da('0x6b')]);return{'count':_0x5e4322['length'],'rows':_[_0xb7da('0x43')](_0x5e4322,function(_0x7eaeaf){return{'id':_0x7eaeaf[_0xb7da('0x2d')],'name':_0x7eaeaf[_0xb7da('0x6c')],'custom':_[_0xb7da('0x6d')](_0x7eaeaf[_0xb7da('0x2d')],'_c')?!![]:![],'options':_0x7eaeaf[_0xb7da('0x4c')]?_[_0xb7da('0x43')](_[_0xb7da('0x6e')](_0x7eaeaf[_0xb7da('0x4c')]),function(_0x11a74c){return{'name':_0x11a74c[_0xb7da('0x6f')],'value':_0x11a74c[_0xb7da('0x2d')]};}):[]};})};}})[_0xb7da('0x16')](respondWithResult(_0x22788c,null))[_0xb7da('0x48')](function(_0x2005c7){var _0x2582cb=_0x4d6524[_0xb7da('0x32')][_0xb7da('0x70')]?0x1f4:_0x2005c7[_0xb7da('0x71')]||0x1f4;logger[_0xb7da('0x1c')](_0xb7da('0x72'),'getFields',_0x2582cb,JSON[_0xb7da('0x69')](_0x2005c7));delete _0x2005c7[_0xb7da('0x2d')];if(_0x2582cb===0x191){_0x2582cb=0x190;}_0x22788c[_0xb7da('0x1f')](_0x2582cb)[_0xb7da('0x73')](_0x4d6524['query'][_0xb7da('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x2005c7[_0xb7da('0x71')]}:_0x2005c7);});}; \ No newline at end of file +var _0xa57c=['desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','reject','save','update','stack','name','index','SugarcrmAccount','rawAttributes','model','keys','dateStart','dateEnd','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','day','merge','where','filter','options','includeAll','include','rows','params','find','create','body','destroy','getConfigurations','findOne','pick','map','addConfiguration','Subjects','getSubjects','channel','Descriptions','type','SugarcrmField','getFields','username','password','remoteUri','POST','format','%s%s','login','JSON','PLAIN','/service/v4_1/rest.php','get_module_fields','values','module_fields','label','endsWith','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce'];(function(_0x344895,_0x390148){var _0x5abf7e=function(_0x49b2ea){while(--_0x49b2ea){_0x344895['push'](_0x344895['shift']());}};_0x5abf7e(++_0x390148);}(_0xa57c,0x1a9));var _0xca57=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xa57c[_0x46e363];return _0x3fb059;};'use strict';var jsonpatch=require(_0xca57('0x0'));var rp=require(_0xca57('0x1'));var moment=require(_0xca57('0x2'));var BPromise=require(_0xca57('0x3'));var Mustache=require(_0xca57('0x4'));var util=require(_0xca57('0x5'));var path=require(_0xca57('0x6'));var sox=require(_0xca57('0x7'));var csv=require('to-csv');var ejs=require(_0xca57('0x8'));var fs=require('fs');var _=require(_0xca57('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xca57('0xa'));var deskjs=require(_0xca57('0xb'));var toCsv=require(_0xca57('0xc'));var querystring=require(_0xca57('0xd'));var Papa=require(_0xca57('0xe'));var qs=require(_0xca57('0xf'));var logger=require(_0xca57('0x10'))(_0xca57('0x11'));var utils=require(_0xca57('0x12'));var config=require('../../config/environment');var db=require(_0xca57('0x13'))['db'];var integrations=require(_0xca57('0x14'));var jayson=require(_0xca57('0x15'));var client=jayson[_0xca57('0x16')][_0xca57('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x37f21f,_0x2cca17,_0x42f4d1,_0x10d6dc){return new BPromise(function(_0x5bed38,_0x1b141c){var _0x448fc4=_0x10d6dc||client;return _0x448fc4['request'](_0x37f21f,_0x42f4d1)[_0xca57('0x18')](function(_0x3605a6){logger['info'](_0xca57('0x19'),_0x2cca17,_0xca57('0x1a'));logger[_0xca57('0x1b')](_0xca57('0x1c'),_0x2cca17,_0xca57('0x1a'),JSON[_0xca57('0x1d')](_0x3605a6));if(_0x3605a6[_0xca57('0x1e')]){if(_0x3605a6['error'][_0xca57('0x1f')]===0x1f4){logger[_0xca57('0x1e')]('SugarcrmAccount,\x20%s,\x20%s',_0x2cca17,_0x3605a6[_0xca57('0x1e')][_0xca57('0x20')]);return _0x1b141c(_0x3605a6[_0xca57('0x1e')][_0xca57('0x20')]);}logger['error'](_0xca57('0x19'),_0x2cca17,_0x3605a6[_0xca57('0x1e')][_0xca57('0x20')]);return _0x5bed38(_0x3605a6['error'][_0xca57('0x20')]);}else{logger[_0xca57('0x21')]('SugarcrmAccount,\x20%s,\x20%s',_0x2cca17,'request\x20sent');_0x5bed38(_0x3605a6[_0xca57('0x22')][_0xca57('0x20')]);}})[_0xca57('0x23')](function(_0x5f2778){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x2cca17,_0x5f2778);_0x1b141c(_0x5f2778);});});}function respondWithStatusCode(_0x469039,_0x65bc32){_0x65bc32=_0x65bc32||0xcc;return function(_0x30286f){if(_0x30286f){return _0x469039[_0xca57('0x24')](_0x65bc32);}return _0x469039[_0xca57('0x25')](_0x65bc32)['end']();};}function respondWithResult(_0x3f4df0,_0x54f0db){_0x54f0db=_0x54f0db||0xc8;return function(_0x33871c){if(_0x33871c){return _0x3f4df0[_0xca57('0x25')](_0x54f0db)[_0xca57('0x26')](_0x33871c);}};}function respondWithFilteredResult(_0x1d091e,_0x2e9213){return function(_0x2f4fb1){if(_0x2f4fb1){var _0x537daf=_0x2f4fb1[_0xca57('0x27')],_0xc89081=_0x2e9213['offset'],_0x175b5f=_0x2e9213[_0xca57('0x28')]+_0x2e9213[_0xca57('0x29')],_0x3e4068;if(_0x175b5f>=_0x537daf){_0x175b5f=_0x537daf;_0x3e4068=0xc8;}else{_0x3e4068=0xce;}_0x1d091e[_0xca57('0x25')](_0x3e4068);return _0x1d091e[_0xca57('0x2a')]('Content-Range',_0xc89081+'-'+_0x175b5f+'/'+_0x537daf)['json'](_0x2f4fb1);}return null;};}function patchUpdates(_0x41e08d){return function(_0x5896ff){try{jsonpatch['apply'](_0x5896ff,_0x41e08d,!![]);}catch(_0x229539){return BPromise[_0xca57('0x2b')](_0x229539);}return _0x5896ff[_0xca57('0x2c')]();};}function saveUpdates(_0x3f1606,_0x3a338f){return function(_0x56c8b2){if(_0x56c8b2){return _0x56c8b2[_0xca57('0x2d')](_0x3f1606)[_0xca57('0x18')](function(_0x670aef){return _0x670aef;});}return null;};}function removeEntity(_0x266c7f,_0x3dce0e){return function(_0x1633cb){if(_0x1633cb){return _0x1633cb['destroy']()[_0xca57('0x18')](function(){_0x266c7f[_0xca57('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bc404,_0x189866){return function(_0x2aebec){if(!_0x2aebec){_0x1bc404[_0xca57('0x24')](0x194);}return _0x2aebec;};}function handleError(_0x597384,_0x29e4cc){_0x29e4cc=_0x29e4cc||0x1f4;return function(_0x247ab6){logger['error'](_0x247ab6[_0xca57('0x2e')]);if(_0x247ab6[_0xca57('0x2f')]){delete _0x247ab6['name'];}_0x597384['status'](_0x29e4cc)['send'](_0x247ab6);};}exports[_0xca57('0x30')]=function(_0x5db9aa,_0x28291e){var _0x16dfbb={},_0x2f8f93={},_0x1f7f1a={'count':0x0,'rows':[]};var _0x2d21c4=db[_0xca57('0x31')][_0xca57('0x32')];_0x2f8f93[_0xca57('0x33')]=_[_0xca57('0x34')](_0x2d21c4);var _0x3c30c2={'dateStart':_0x5db9aa['query'][_0xca57('0x35')],'dateEnd':_0x5db9aa['query'][_0xca57('0x36')]};delete _0x5db9aa[_0xca57('0x37')]['dateStart'];delete _0x5db9aa[_0xca57('0x37')]['dateEnd'];_0x2f8f93[_0xca57('0x37')]=_[_0xca57('0x34')](_0x5db9aa['query']);_0x2f8f93['filters']=_['intersection'](_0x2f8f93[_0xca57('0x33')],_0x2f8f93['query']);_0x16dfbb['attributes']=_[_0xca57('0x38')](_0x2f8f93[_0xca57('0x33')],qs[_0xca57('0x39')](_0x5db9aa[_0xca57('0x37')][_0xca57('0x39')]));_0x16dfbb[_0xca57('0x3a')]=_0x16dfbb[_0xca57('0x3a')][_0xca57('0x3b')]?_0x16dfbb[_0xca57('0x3a')]:_0x2f8f93['model'];if(!_0x5db9aa[_0xca57('0x37')][_0xca57('0x3c')](_0xca57('0x3d'))){_0x16dfbb[_0xca57('0x29')]=qs[_0xca57('0x29')](_0x5db9aa[_0xca57('0x37')]['limit']);_0x16dfbb[_0xca57('0x28')]=qs[_0xca57('0x28')](_0x5db9aa[_0xca57('0x37')][_0xca57('0x28')]);}_0x16dfbb[_0xca57('0x3e')]=qs[_0xca57('0x3f')](_0x5db9aa[_0xca57('0x37')][_0xca57('0x3f')]);_0x16dfbb['where']=qs[_0xca57('0x40')](_['pick'](_0x5db9aa['query'],_0x2f8f93[_0xca57('0x40')]));if(_0x3c30c2['dateStart']){if(_0x3c30c2[_0xca57('0x36')]){_0x3c30c2[_0xca57('0x36')]=moment(_0x3c30c2[_0xca57('0x36')])['add'](0x1,_0xca57('0x41'));}else{_0x3c30c2[_0xca57('0x36')]=moment(_0x3c30c2[_0xca57('0x35')])['add'](0x1,_0xca57('0x41'));}_[_0xca57('0x42')](_0x16dfbb[_0xca57('0x43')],{'createdAt':{'$gte':_0x3c30c2['dateStart'],'$lte':_0x3c30c2[_0xca57('0x36')]}});}if(_0x5db9aa['query'][_0xca57('0x44')]){_0x16dfbb[_0xca57('0x43')]=_[_0xca57('0x42')](_0x16dfbb[_0xca57('0x43')],{'$or':_['map'](_0x16dfbb['attributes'],function(_0xcd23e9){var _0x47b7c0={};_0x47b7c0[_0xcd23e9]={'$like':'%'+_0x5db9aa['query'][_0xca57('0x44')]+'%'};return _0x47b7c0;})});}_0x16dfbb=_[_0xca57('0x42')]({},_0x16dfbb,_0x5db9aa[_0xca57('0x45')]);var _0x2aef7e={'where':_0x16dfbb[_0xca57('0x43')]};return db[_0xca57('0x31')][_0xca57('0x27')](_0x2aef7e)[_0xca57('0x18')](function(_0x418797){_0x1f7f1a[_0xca57('0x27')]=_0x418797;if(_0x5db9aa[_0xca57('0x37')][_0xca57('0x46')]){_0x16dfbb[_0xca57('0x47')]=[{'all':!![]}];}return db[_0xca57('0x31')]['findAll'](_0x16dfbb);})[_0xca57('0x18')](function(_0x40cf3d){_0x1f7f1a[_0xca57('0x48')]=_0x40cf3d;return _0x1f7f1a;})[_0xca57('0x18')](respondWithFilteredResult(_0x28291e,_0x16dfbb))[_0xca57('0x23')](handleError(_0x28291e,null));};exports['show']=function(_0x1e5b1f,_0xbe583e){var _0x39f2ce={'raw':![],'where':{'id':_0x1e5b1f[_0xca57('0x49')]['id']}},_0x13a4ec={};_0x13a4ec[_0xca57('0x33')]=_['keys'](db[_0xca57('0x31')][_0xca57('0x32')]);_0x13a4ec['query']=_['keys'](_0x1e5b1f['query']);_0x13a4ec[_0xca57('0x40')]=_[_0xca57('0x38')](_0x13a4ec['model'],_0x13a4ec[_0xca57('0x37')]);_0x39f2ce[_0xca57('0x3a')]=_['intersection'](_0x13a4ec[_0xca57('0x33')],qs['fields'](_0x1e5b1f[_0xca57('0x37')][_0xca57('0x39')]));_0x39f2ce[_0xca57('0x3a')]=_0x39f2ce['attributes'][_0xca57('0x3b')]?_0x39f2ce[_0xca57('0x3a')]:_0x13a4ec['model'];if(_0x1e5b1f[_0xca57('0x37')][_0xca57('0x46')]){_0x39f2ce['include']=[{'all':!![]}];}_0x39f2ce=_['merge']({},_0x39f2ce,_0x1e5b1f[_0xca57('0x45')]);return db[_0xca57('0x31')][_0xca57('0x4a')](_0x39f2ce)[_0xca57('0x18')](handleEntityNotFound(_0xbe583e,null))[_0xca57('0x18')](respondWithResult(_0xbe583e,null))['catch'](handleError(_0xbe583e,null));};exports[_0xca57('0x4b')]=function(_0x2d55dc,_0xb74a1d){return db[_0xca57('0x31')][_0xca57('0x4b')](_0x2d55dc[_0xca57('0x4c')],{})[_0xca57('0x18')](respondWithResult(_0xb74a1d,0xc9))[_0xca57('0x23')](handleError(_0xb74a1d,null));};exports[_0xca57('0x2d')]=function(_0xe7a13c,_0x51bb51){if(_0xe7a13c[_0xca57('0x4c')]['id']){delete _0xe7a13c['body']['id'];}return db[_0xca57('0x31')][_0xca57('0x4a')]({'where':{'id':_0xe7a13c['params']['id']}})[_0xca57('0x18')](handleEntityNotFound(_0x51bb51,null))[_0xca57('0x18')](saveUpdates(_0xe7a13c['body'],null))[_0xca57('0x18')](respondWithResult(_0x51bb51,null))['catch'](handleError(_0x51bb51,null));};exports[_0xca57('0x4d')]=function(_0xfccf30,_0x5ba57a){return db[_0xca57('0x31')]['find']({'where':{'id':_0xfccf30[_0xca57('0x49')]['id']}})[_0xca57('0x18')](handleEntityNotFound(_0x5ba57a,null))[_0xca57('0x18')](removeEntity(_0x5ba57a,null))['catch'](handleError(_0x5ba57a,null));};exports[_0xca57('0x4e')]=function(_0x38c349,_0x39f00f,_0x5a5aba){var _0x5457cd={};var _0x106a07={};var _0x1242ce;var _0x3e1c19;return db[_0xca57('0x31')][_0xca57('0x4f')]({'where':{'id':_0x38c349['params']['id']}})['then'](handleEntityNotFound(_0x39f00f,null))[_0xca57('0x18')](function(_0xfc22c9){if(_0xfc22c9){_0x1242ce=_0xfc22c9;_0x106a07[_0xca57('0x33')]=_[_0xca57('0x34')](db['SugarcrmConfiguration']['rawAttributes']);_0x106a07[_0xca57('0x37')]=_[_0xca57('0x34')](_0x38c349[_0xca57('0x37')]);_0x106a07[_0xca57('0x40')]=_[_0xca57('0x38')](_0x106a07[_0xca57('0x33')],_0x106a07[_0xca57('0x37')]);_0x5457cd[_0xca57('0x3a')]=_[_0xca57('0x38')](_0x106a07[_0xca57('0x33')],qs[_0xca57('0x39')](_0x38c349['query']['fields']));_0x5457cd[_0xca57('0x3a')]=_0x5457cd[_0xca57('0x3a')]['length']?_0x5457cd[_0xca57('0x3a')]:_0x106a07[_0xca57('0x33')];_0x5457cd['order']=qs['sort'](_0x38c349[_0xca57('0x37')][_0xca57('0x3f')]);_0x5457cd['where']=qs['filters'](_[_0xca57('0x50')](_0x38c349['query'],_0x106a07[_0xca57('0x40')]));if(_0x38c349[_0xca57('0x37')][_0xca57('0x44')]){_0x5457cd['where']=_[_0xca57('0x42')](_0x5457cd[_0xca57('0x43')],{'$or':_[_0xca57('0x51')](_0x5457cd[_0xca57('0x3a')],function(_0xa78d6a){var _0x4c8870={};_0x4c8870[_0xa78d6a]={'$like':'%'+_0x38c349[_0xca57('0x37')][_0xca57('0x44')]+'%'};return _0x4c8870;})});}_0x5457cd=_[_0xca57('0x42')]({},_0x5457cd,_0x38c349[_0xca57('0x45')]);return _0x1242ce[_0xca57('0x4e')](_0x5457cd);}})[_0xca57('0x18')](function(_0x50e6a0){if(_0x50e6a0){_0x3e1c19=_0x50e6a0[_0xca57('0x3b')];if(!_0x38c349[_0xca57('0x37')][_0xca57('0x3c')](_0xca57('0x3d'))){_0x5457cd[_0xca57('0x29')]=qs[_0xca57('0x29')](_0x38c349[_0xca57('0x37')][_0xca57('0x29')]);_0x5457cd[_0xca57('0x28')]=qs[_0xca57('0x28')](_0x38c349[_0xca57('0x37')][_0xca57('0x28')]);}return _0x1242ce[_0xca57('0x4e')](_0x5457cd);}})[_0xca57('0x18')](function(_0x4c1e8e){if(_0x4c1e8e){return _0x4c1e8e?{'count':_0x3e1c19,'rows':_0x4c1e8e}:null;}})[_0xca57('0x18')](respondWithResult(_0x39f00f,null))[_0xca57('0x23')](handleError(_0x39f00f,null));};exports[_0xca57('0x52')]=function(_0xd40204,_0x16d1a9,_0x3cbb99){if(_0xd40204['body']['id']){delete _0xd40204['body']['id'];}return db['SugarcrmAccount'][_0xca57('0x4f')]({'where':{'id':_0xd40204['params']['id']}})[_0xca57('0x18')](handleEntityNotFound(_0x16d1a9,null))[_0xca57('0x18')](function(_0x2fba5b){if(_0x2fba5b){_0xd40204[_0xca57('0x4c')]['AccountId']=_0x2fba5b['id'];_0xd40204[_0xca57('0x4c')][_0xca57('0x53')]=integrations[_0xca57('0x54')](_0xd40204['body'][_0xca57('0x55')],_0xd40204[_0xca57('0x4c')]['type']);_0xd40204[_0xca57('0x4c')][_0xca57('0x56')]=integrations['getDescriptions'](_0xd40204[_0xca57('0x4c')][_0xca57('0x55')],_0xd40204['body'][_0xca57('0x57')]);return db['SugarcrmConfiguration']['create'](_0xd40204['body'],{'include':[{'model':db['SugarcrmField'],'as':_0xca57('0x53')},{'model':db[_0xca57('0x58')],'as':_0xca57('0x56')}]});}return null;})[_0xca57('0x18')](respondWithResult(_0x16d1a9,null))[_0xca57('0x23')](handleError(_0x16d1a9,null));};exports[_0xca57('0x59')]=function(_0x4f5d83,_0x49680b,_0x12bef0){var _0x46a4d0;return db['SugarcrmAccount'][_0xca57('0x4f')]({'where':{'id':_0x4f5d83[_0xca57('0x49')]['id']},'attributes':['id',_0xca57('0x5a'),_0xca57('0x5b'),_0xca57('0x5c')]})[_0xca57('0x18')](handleEntityNotFound(_0x49680b,null))[_0xca57('0x18')](function(_0x2fdace){if(_0x2fdace){_0x46a4d0=_0x2fdace[_0xca57('0x5c')];return rp({'method':_0xca57('0x5d'),'uri':util[_0xca57('0x5e')](_0xca57('0x5f'),_0x46a4d0,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xca57('0x60'),'input_type':_0xca57('0x61'),'response_type':_0xca57('0x61'),'rest_data':JSON[_0xca57('0x1d')]({'user_auth':{'user_name':_0x2fdace[_0xca57('0x5a')],'password':_0x2fdace[_0xca57('0x5b')],'encryption':_0xca57('0x62')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xca57('0x18')](function(_0x25de78){if(_0x25de78){return rp({'method':'POST','uri':util[_0xca57('0x5e')](_0xca57('0x5f'),_0x46a4d0,_0xca57('0x63')),'json':!![],'form':{'method':_0xca57('0x64'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x25de78['id'],'module_name':'Calls'})}});}})['then'](function(_0xcda0e1){if(_0xcda0e1){var _0x3a28a6=_[_0xca57('0x65')](_0xcda0e1[_0xca57('0x66')]);return{'count':_0x3a28a6[_0xca57('0x3b')],'rows':_[_0xca57('0x51')](_0x3a28a6,function(_0x51ad20){return{'id':_0x51ad20[_0xca57('0x2f')],'name':_0x51ad20[_0xca57('0x67')],'custom':_[_0xca57('0x68')](_0x51ad20['name'],'_c')?!![]:![],'options':_0x51ad20['options']?_['map'](_[_0xca57('0x65')](_0x51ad20['options']),function(_0x52f206){return{'name':_0x52f206['value'],'value':_0x52f206['name']};}):[]};})};}})['then'](respondWithResult(_0x49680b,null))[_0xca57('0x23')](function(_0x54b7b0){var _0xaee7e1=_0x4f5d83[_0xca57('0x37')][_0xca57('0x69')]?0x1f4:_0x54b7b0['statusCode']||0x1f4;logger[_0xca57('0x1e')](_0xca57('0x6a'),'getFields',_0xaee7e1,JSON['stringify'](_0x54b7b0));delete _0x54b7b0['name'];if(_0xaee7e1===0x191){_0xaee7e1=0x190;}_0x49680b[_0xca57('0x25')](_0xaee7e1)[_0xca57('0x6b')](_0x4f5d83[_0xca57('0x37')]['test']?{'message':_0xca57('0x6c'),'statusCode':_0x54b7b0['statusCode']}:_0x54b7b0);});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 56e659c..c8e6c5a 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 _0x8858=['SugarcrmAccount','lodash','../../config/logger','api','bluebird','request-promise','../../components/integrations/configuration','exports','define'];(function(_0x467918,_0x30a84c){var _0xd65d72=function(_0x568134){while(--_0x568134){_0x467918['push'](_0x467918['shift']());}};_0xd65d72(++_0x30a84c);}(_0x8858,0xf4));var _0x8885=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x8858[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x8885('0x0'));var util=require('util');var logger=require(_0x8885('0x1'))(_0x8885('0x2'));var moment=require('moment');var BPromise=require(_0x8885('0x3'));var rp=require(_0x8885('0x4'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x8885('0x5'));module[_0x8885('0x6')]=function(_0x319b50,_0x3d2694){return _0x319b50[_0x8885('0x7')](_0x8885('0x8'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe564=['define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports'];(function(_0x5705cd,_0x350347){var _0x4597b4=function(_0x55f633){while(--_0x55f633){_0x5705cd['push'](_0x5705cd['shift']());}};_0x4597b4(++_0x350347);}(_0xe564,0x6d));var _0x4e56=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe564[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4e56('0x0'));var util=require(_0x4e56('0x1'));var logger=require(_0x4e56('0x2'))(_0x4e56('0x3'));var moment=require(_0x4e56('0x4'));var BPromise=require(_0x4e56('0x5'));var rp=require(_0x4e56('0x6'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x4e56('0x7')]=function(_0x291fc2,_0x50f31d){return _0x291fc2[_0x4e56('0x8')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 3b1b90c..a596700 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 _0x3d11=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SugarcrmAccount,\x20%s,\x20%s','error','message','request\x20sent','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','attributes','limit','map','model','include','then','find','where','debug','ShowSugarcrmAccount','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x31e2be,_0x463b36){var _0x3de32e=function(_0x18a103){while(--_0x18a103){_0x31e2be['push'](_0x31e2be['shift']());}};_0x3de32e(++_0x463b36);}(_0x3d11,0x158));var _0x13d1=function(_0x25ac2d,_0x154c4e){_0x25ac2d=_0x25ac2d-0x0;var _0x1c7365=_0x3d11[_0x25ac2d];return _0x1c7365;};'use strict';var _=require(_0x13d1('0x0'));var util=require(_0x13d1('0x1'));var moment=require(_0x13d1('0x2'));var BPromise=require('bluebird');var rs=require(_0x13d1('0x3'));var fs=require('fs');var db=require(_0x13d1('0x4'))['db'];var utils=require(_0x13d1('0x5'));var logger=require(_0x13d1('0x6'))(_0x13d1('0x7'));var config=require(_0x13d1('0x8'));var jayson=require(_0x13d1('0x9'));var client=jayson[_0x13d1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3288d1,_0x36eb01,_0x270fbf){return new BPromise(function(_0x435266,_0x2d6718){return client[_0x13d1('0xb')](_0x3288d1,_0x270fbf)['then'](function(_0x2f14a5){logger[_0x13d1('0xc')](_0x13d1('0xd'),_0x36eb01,'request\x20sent');logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x36eb01,'request\x20sent',JSON['stringify'](_0x2f14a5));if(_0x2f14a5[_0x13d1('0xe')]){if(_0x2f14a5[_0x13d1('0xe')]['code']===0x1f4){logger[_0x13d1('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x36eb01,_0x2f14a5[_0x13d1('0xe')][_0x13d1('0xf')]);return _0x2d6718(_0x2f14a5[_0x13d1('0xe')][_0x13d1('0xf')]);}logger[_0x13d1('0xe')](_0x13d1('0xd'),_0x36eb01,_0x2f14a5['error'][_0x13d1('0xf')]);return _0x435266(_0x2f14a5[_0x13d1('0xe')]['message']);}else{logger[_0x13d1('0xc')](_0x13d1('0xd'),_0x36eb01,_0x13d1('0x10'));_0x435266(_0x2f14a5[_0x13d1('0x11')][_0x13d1('0xf')]);}})[_0x13d1('0x12')](function(_0x289aa6){logger[_0x13d1('0xe')](_0x13d1('0xd'),_0x36eb01,_0x289aa6);_0x2d6718(_0x289aa6);});});}exports[_0x13d1('0x13')]=function(_0x3f1185){var _0xa41afd=this;return new Promise(function(_0x4b0885,_0x4933c9){return db[_0x13d1('0x14')][_0x13d1('0x15')]({'raw':_0x3f1185[_0x13d1('0x16')]?_0x3f1185[_0x13d1('0x16')][_0x13d1('0x17')]===undefined?!![]:![]:!![],'where':_0x3f1185[_0x13d1('0x16')]?_0x3f1185['options']['where']||null:null,'attributes':_0x3f1185['options']?_0x3f1185['options'][_0x13d1('0x18')]||null:null,'limit':_0x3f1185['options']?_0x3f1185[_0x13d1('0x16')][_0x13d1('0x19')]||null:null,'include':_0x3f1185[_0x13d1('0x16')]?_0x3f1185[_0x13d1('0x16')]['include']?_[_0x13d1('0x1a')](_0x3f1185[_0x13d1('0x16')]['include'],function(_0xde0d43){return{'model':db[_0xde0d43[_0x13d1('0x1b')]],'as':_0xde0d43['as'],'attributes':_0xde0d43[_0x13d1('0x18')],'include':_0xde0d43[_0x13d1('0x1c')]?_[_0x13d1('0x1a')](_0xde0d43[_0x13d1('0x1c')],function(_0x37acf7){return{'model':db[_0x37acf7[_0x13d1('0x1b')]],'as':_0x37acf7['as'],'attributes':_0x37acf7[_0x13d1('0x18')],'include':_0x37acf7['include']?_['map'](_0x37acf7['include'],function(_0x5517d5){return{'model':db[_0x5517d5[_0x13d1('0x1b')]],'as':_0x5517d5['as'],'attributes':_0x5517d5[_0x13d1('0x18')]};}):[]};}):[]};}):[]:[]})[_0x13d1('0x1d')](function(_0x434f32){logger[_0x13d1('0xc')](_0x13d1('0x13'),_0x3f1185);logger['debug']('GetSugarcrmAccount',_0x3f1185,JSON['stringify'](_0x434f32));_0x4b0885(_0x434f32);})[_0x13d1('0x12')](function(_0x9f32dc){logger[_0x13d1('0xe')](_0x13d1('0x13'),_0x9f32dc['message'],_0x3f1185);_0x4933c9(_0xa41afd[_0x13d1('0xe')](0x1f4,_0x9f32dc[_0x13d1('0xf')]));});});};exports['ShowSugarcrmAccount']=function(_0x3b502c){var _0x54952d=this;return new Promise(function(_0x40524e,_0x450f0f){return db[_0x13d1('0x14')][_0x13d1('0x1e')]({'raw':_0x3b502c['options']?_0x3b502c[_0x13d1('0x16')][_0x13d1('0x17')]===undefined?!![]:![]:!![],'where':_0x3b502c[_0x13d1('0x16')]?_0x3b502c[_0x13d1('0x16')][_0x13d1('0x1f')]||null:null,'attributes':_0x3b502c['options']?_0x3b502c['options'][_0x13d1('0x18')]||null:null,'include':_0x3b502c['options']?_0x3b502c['options'][_0x13d1('0x1c')]?_[_0x13d1('0x1a')](_0x3b502c[_0x13d1('0x16')]['include'],function(_0x514855){return{'model':db[_0x514855[_0x13d1('0x1b')]],'as':_0x514855['as'],'attributes':_0x514855[_0x13d1('0x18')],'include':_0x514855[_0x13d1('0x1c')]?_[_0x13d1('0x1a')](_0x514855[_0x13d1('0x1c')],function(_0x4c565b){return{'model':db[_0x4c565b[_0x13d1('0x1b')]],'as':_0x4c565b['as'],'attributes':_0x4c565b[_0x13d1('0x18')],'include':_0x4c565b[_0x13d1('0x1c')]?_[_0x13d1('0x1a')](_0x4c565b[_0x13d1('0x1c')],function(_0xa38bbb){return{'model':db[_0xa38bbb[_0x13d1('0x1b')]],'as':_0xa38bbb['as'],'attributes':_0xa38bbb[_0x13d1('0x18')]};}):[]};}):[]};}):[]:[]})[_0x13d1('0x1d')](function(_0x2df717){logger[_0x13d1('0xc')]('ShowSugarcrmAccount',_0x3b502c);logger[_0x13d1('0x20')](_0x13d1('0x21'),_0x3b502c,JSON[_0x13d1('0x22')](_0x2df717));_0x40524e(_0x2df717);})['catch'](function(_0x1fa51a){logger['error'](_0x13d1('0x21'),_0x1fa51a[_0x13d1('0xf')],_0x3b502c);_0x450f0f(_0x54952d[_0x13d1('0xe')](0x1f4,_0x1fa51a[_0x13d1('0xf')]));});});}; \ No newline at end of file +var _0xf36b=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','SugarcrmAccount,\x20%s,\x20%s','debug','error','code','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','attributes','limit','include','map','model','then','stringify','catch','ShowSugarcrmAccount','find','lodash','moment','bluebird','randomstring'];(function(_0x2d9a23,_0x481dc4){var _0x5198ee=function(_0x27d373){while(--_0x27d373){_0x2d9a23['push'](_0x2d9a23['shift']());}};_0x5198ee(++_0x481dc4);}(_0xf36b,0xbc));var _0xbf36=function(_0x5585b5,_0x23e877){_0x5585b5=_0x5585b5-0x0;var _0x58958d=_0xf36b[_0x5585b5];return _0x58958d;};'use strict';var _=require(_0xbf36('0x0'));var util=require('util');var moment=require(_0xbf36('0x1'));var BPromise=require(_0xbf36('0x2'));var rs=require(_0xbf36('0x3'));var fs=require('fs');var db=require(_0xbf36('0x4'))['db'];var utils=require(_0xbf36('0x5'));var logger=require(_0xbf36('0x6'))('rpc');var config=require(_0xbf36('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbf36('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31765d,_0x257c4b,_0x52165b){return new BPromise(function(_0x32c8b0,_0x1226c0){return client[_0xbf36('0x9')](_0x31765d,_0x52165b)['then'](function(_0x4d347e){logger[_0xbf36('0xa')](_0xbf36('0xb'),_0x257c4b,'request\x20sent');logger[_0xbf36('0xc')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x257c4b,'request\x20sent',JSON['stringify'](_0x4d347e));if(_0x4d347e['error']){if(_0x4d347e[_0xbf36('0xd')][_0xbf36('0xe')]===0x1f4){logger[_0xbf36('0xd')](_0xbf36('0xb'),_0x257c4b,_0x4d347e[_0xbf36('0xd')][_0xbf36('0xf')]);return _0x1226c0(_0x4d347e[_0xbf36('0xd')][_0xbf36('0xf')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x257c4b,_0x4d347e['error']['message']);return _0x32c8b0(_0x4d347e[_0xbf36('0xd')][_0xbf36('0xf')]);}else{logger[_0xbf36('0xa')](_0xbf36('0xb'),_0x257c4b,'request\x20sent');_0x32c8b0(_0x4d347e[_0xbf36('0x10')][_0xbf36('0xf')]);}})['catch'](function(_0x2f3e00){logger[_0xbf36('0xd')](_0xbf36('0xb'),_0x257c4b,_0x2f3e00);_0x1226c0(_0x2f3e00);});});}exports[_0xbf36('0x11')]=function(_0x2027bb){var _0x5cf7e8=this;return new Promise(function(_0x186ad7,_0x3614e6){return db[_0xbf36('0x12')][_0xbf36('0x13')]({'raw':_0x2027bb[_0xbf36('0x14')]?_0x2027bb[_0xbf36('0x14')][_0xbf36('0x15')]===undefined?!![]:![]:!![],'where':_0x2027bb['options']?_0x2027bb[_0xbf36('0x14')]['where']||null:null,'attributes':_0x2027bb[_0xbf36('0x14')]?_0x2027bb['options'][_0xbf36('0x16')]||null:null,'limit':_0x2027bb['options']?_0x2027bb[_0xbf36('0x14')][_0xbf36('0x17')]||null:null,'include':_0x2027bb['options']?_0x2027bb[_0xbf36('0x14')][_0xbf36('0x18')]?_[_0xbf36('0x19')](_0x2027bb[_0xbf36('0x14')][_0xbf36('0x18')],function(_0x536c0f){return{'model':db[_0x536c0f[_0xbf36('0x1a')]],'as':_0x536c0f['as'],'attributes':_0x536c0f[_0xbf36('0x16')],'include':_0x536c0f['include']?_[_0xbf36('0x19')](_0x536c0f[_0xbf36('0x18')],function(_0x1cbd40){return{'model':db[_0x1cbd40[_0xbf36('0x1a')]],'as':_0x1cbd40['as'],'attributes':_0x1cbd40['attributes'],'include':_0x1cbd40[_0xbf36('0x18')]?_['map'](_0x1cbd40[_0xbf36('0x18')],function(_0x25e9d7){return{'model':db[_0x25e9d7[_0xbf36('0x1a')]],'as':_0x25e9d7['as'],'attributes':_0x25e9d7[_0xbf36('0x16')]};}):[]};}):[]};}):[]:[]})[_0xbf36('0x1b')](function(_0x941fb2){logger['info'](_0xbf36('0x11'),_0x2027bb);logger['debug'](_0xbf36('0x11'),_0x2027bb,JSON[_0xbf36('0x1c')](_0x941fb2));_0x186ad7(_0x941fb2);})[_0xbf36('0x1d')](function(_0x4c4fb2){logger[_0xbf36('0xd')]('GetSugarcrmAccount',_0x4c4fb2[_0xbf36('0xf')],_0x2027bb);_0x3614e6(_0x5cf7e8[_0xbf36('0xd')](0x1f4,_0x4c4fb2[_0xbf36('0xf')]));});});};exports[_0xbf36('0x1e')]=function(_0xf5e5db){var _0x4ed8ad=this;return new Promise(function(_0x593639,_0x9df6a5){return db['SugarcrmAccount'][_0xbf36('0x1f')]({'raw':_0xf5e5db[_0xbf36('0x14')]?_0xf5e5db[_0xbf36('0x14')][_0xbf36('0x15')]===undefined?!![]:![]:!![],'where':_0xf5e5db['options']?_0xf5e5db[_0xbf36('0x14')]['where']||null:null,'attributes':_0xf5e5db['options']?_0xf5e5db['options'][_0xbf36('0x16')]||null:null,'include':_0xf5e5db[_0xbf36('0x14')]?_0xf5e5db[_0xbf36('0x14')]['include']?_['map'](_0xf5e5db['options'][_0xbf36('0x18')],function(_0x77cb3d){return{'model':db[_0x77cb3d['model']],'as':_0x77cb3d['as'],'attributes':_0x77cb3d[_0xbf36('0x16')],'include':_0x77cb3d[_0xbf36('0x18')]?_[_0xbf36('0x19')](_0x77cb3d['include'],function(_0x575928){return{'model':db[_0x575928[_0xbf36('0x1a')]],'as':_0x575928['as'],'attributes':_0x575928[_0xbf36('0x16')],'include':_0x575928['include']?_['map'](_0x575928[_0xbf36('0x18')],function(_0x583f87){return{'model':db[_0x583f87[_0xbf36('0x1a')]],'as':_0x583f87['as'],'attributes':_0x583f87[_0xbf36('0x16')]};}):[]};}):[]};}):[]:[]})[_0xbf36('0x1b')](function(_0xbc4b28){logger[_0xbf36('0xa')](_0xbf36('0x1e'),_0xf5e5db);logger[_0xbf36('0xc')](_0xbf36('0x1e'),_0xf5e5db,JSON['stringify'](_0xbc4b28));_0x593639(_0xbc4b28);})[_0xbf36('0x1d')](function(_0x240527){logger[_0xbf36('0xd')](_0xbf36('0x1e'),_0x240527['message'],_0xf5e5db);_0x9df6a5(_0x4ed8ad[_0xbf36('0xd')](0x1f4,_0x240527[_0xbf36('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 4b05fba..7010d6d 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 _0x62fe=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x62fe,0x111));var _0xe62f=function(_0x5ce42c,_0x13c493){_0x5ce42c=_0x5ce42c-0x0;var _0x68a914=_0x62fe[_0x5ce42c];return _0x68a914;};'use strict';var multer=require(_0xe62f('0x0'));var util=require(_0xe62f('0x1'));var path=require('path');var express=require(_0xe62f('0x2'));var router=express[_0xe62f('0x3')]();var auth=require(_0xe62f('0x4'));var interaction=require(_0xe62f('0x5'));var config=require(_0xe62f('0x6'));var controller=require(_0xe62f('0x7'));router[_0xe62f('0x8')]('/',auth[_0xe62f('0x9')](),controller['index']);router[_0xe62f('0x8')](_0xe62f('0xa'),auth[_0xe62f('0x9')](),controller[_0xe62f('0xb')]);router['get'](_0xe62f('0xc'),auth[_0xe62f('0x9')](),controller[_0xe62f('0xd')]);router[_0xe62f('0x8')](_0xe62f('0xe'),auth[_0xe62f('0x9')](),controller[_0xe62f('0xf')]);router[_0xe62f('0x8')](_0xe62f('0x10'),auth[_0xe62f('0x9')](),controller[_0xe62f('0x11')]);router[_0xe62f('0x12')]('/',auth[_0xe62f('0x9')](),controller[_0xe62f('0x13')]);router[_0xe62f('0x14')]('/:id',auth[_0xe62f('0x9')](),controller[_0xe62f('0x15')]);router[_0xe62f('0x16')](_0xe62f('0xa'),auth['isAuthenticated'](),controller[_0xe62f('0x17')]);module[_0xe62f('0x18')]=router; \ No newline at end of file +var _0xa1ef=['../../config/environment','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id','delete','destroy','util','path','express','Router','../../components/interaction/service'];(function(_0x16443b,_0x598f07){var _0x4f9c5b=function(_0x5e5187){while(--_0x5e5187){_0x16443b['push'](_0x16443b['shift']());}};_0x4f9c5b(++_0x598f07);}(_0xa1ef,0x12b));var _0xfa1e=function(_0x7b8a87,_0x2f2523){_0x7b8a87=_0x7b8a87-0x0;var _0x2131a1=_0xa1ef[_0x7b8a87];return _0x2131a1;};'use strict';var multer=require('multer');var util=require(_0xfa1e('0x0'));var path=require(_0xfa1e('0x1'));var express=require(_0xfa1e('0x2'));var router=express[_0xfa1e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xfa1e('0x4'));var config=require(_0xfa1e('0x5'));var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth[_0xfa1e('0x6')](),controller[_0xfa1e('0x7')]);router[_0xfa1e('0x8')]('/:id',auth[_0xfa1e('0x6')](),controller[_0xfa1e('0x9')]);router[_0xfa1e('0x8')](_0xfa1e('0xa'),auth[_0xfa1e('0x6')](),controller[_0xfa1e('0xb')]);router[_0xfa1e('0x8')](_0xfa1e('0xc'),auth['isAuthenticated'](),controller[_0xfa1e('0xd')]);router[_0xfa1e('0x8')](_0xfa1e('0xe'),auth[_0xfa1e('0x6')](),controller[_0xfa1e('0xf')]);router['post']('/',auth[_0xfa1e('0x6')](),controller['create']);router['put'](_0xfa1e('0x10'),auth[_0xfa1e('0x6')](),controller['update']);router[_0xfa1e('0x11')](_0xfa1e('0x10'),auth['isAuthenticated'](),controller[_0xfa1e('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index e938891..3181023 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 _0xe676=['exports','STRING','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe676,0x6e));var _0x6e67=function(_0x5d860f,_0x467498){_0x5d860f=_0x5d860f-0x0;var _0x236490=_0xe676[_0x5d860f];return _0x236490;};'use strict';var Sequelize=require(_0x6e67('0x0'));module[_0x6e67('0x1')]={'name':{'type':Sequelize[_0x6e67('0x2')]},'description':{'type':Sequelize[_0x6e67('0x2')]}}; \ No newline at end of file +var _0x55d6=['sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x55d6,0x114));var _0x655d=function(_0x4e294c,_0x41cf20){_0x4e294c=_0x4e294c-0x0;var _0x50ca6d=_0x55d6[_0x4e294c];return _0x50ca6d;};'use strict';var Sequelize=require(_0x655d('0x0'));module['exports']={'name':{'type':Sequelize[_0x655d('0x1')]},'description':{'type':Sequelize[_0x655d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index f8cd748..444b74a 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 _0xb3a3=['destroy','getFields','getSubjects','findOne','getDescriptions','SugarcrmField','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','name','index','SugarcrmConfiguration','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','params','rawAttributes','length','find','create','body'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xb3a3,0x1a5));var _0x3b3a=function(_0x2d7427,_0x4a9645){_0x2d7427=_0x2d7427-0x0;var _0x15d012=_0xb3a3[_0x2d7427];return _0x15d012;};'use strict';var jsonpatch=require(_0x3b3a('0x0'));var rp=require(_0x3b3a('0x1'));var moment=require(_0x3b3a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3b3a('0x3'));var util=require(_0x3b3a('0x4'));var path=require(_0x3b3a('0x5'));var sox=require('sox');var csv=require(_0x3b3a('0x6'));var ejs=require(_0x3b3a('0x7'));var fs=require('fs');var _=require(_0x3b3a('0x8'));var squel=require(_0x3b3a('0x9'));var crypto=require(_0x3b3a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3b3a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3b3a('0xc'));var Papa=require('papaparse');var qs=require(_0x3b3a('0xd'));var logger=require(_0x3b3a('0xe'))(_0x3b3a('0xf'));var utils=require(_0x3b3a('0x10'));var config=require(_0x3b3a('0x11'));var db=require(_0x3b3a('0x12'))['db'];var jayson=require(_0x3b3a('0x13'));var client=jayson[_0x3b3a('0x14')][_0x3b3a('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x56c3de,_0x5223b9,_0x7dde6c,_0x4793cb){return new BPromise(function(_0x48cb60,_0x32664f){var _0x51bf70=_0x4793cb||client;return _0x51bf70['request'](_0x56c3de,_0x7dde6c)[_0x3b3a('0x16')](function(_0x1eeeca){logger['info'](_0x3b3a('0x17'),_0x5223b9,_0x3b3a('0x18'));logger[_0x3b3a('0x19')](_0x3b3a('0x1a'),_0x5223b9,_0x3b3a('0x18'),JSON['stringify'](_0x1eeeca));if(_0x1eeeca[_0x3b3a('0x1b')]){if(_0x1eeeca[_0x3b3a('0x1b')][_0x3b3a('0x1c')]===0x1f4){logger['error'](_0x3b3a('0x17'),_0x5223b9,_0x1eeeca[_0x3b3a('0x1b')]['message']);return _0x32664f(_0x1eeeca[_0x3b3a('0x1b')][_0x3b3a('0x1d')]);}logger[_0x3b3a('0x1b')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5223b9,_0x1eeeca['error']['message']);return _0x48cb60(_0x1eeeca[_0x3b3a('0x1b')][_0x3b3a('0x1d')]);}else{logger['info'](_0x3b3a('0x17'),_0x5223b9,'request\x20sent');_0x48cb60(_0x1eeeca[_0x3b3a('0x1e')][_0x3b3a('0x1d')]);}})[_0x3b3a('0x1f')](function(_0x55e7c7){logger[_0x3b3a('0x1b')](_0x3b3a('0x17'),_0x5223b9,_0x55e7c7);_0x32664f(_0x55e7c7);});});}function respondWithStatusCode(_0x4f31d4,_0x3ae5d6){_0x3ae5d6=_0x3ae5d6||0xcc;return function(_0x60f1f){if(_0x60f1f){return _0x4f31d4[_0x3b3a('0x20')](_0x3ae5d6);}return _0x4f31d4[_0x3b3a('0x21')](_0x3ae5d6)[_0x3b3a('0x22')]();};}function respondWithResult(_0x399caf,_0x2bf671){_0x2bf671=_0x2bf671||0xc8;return function(_0xcaa903){if(_0xcaa903){return _0x399caf[_0x3b3a('0x21')](_0x2bf671)[_0x3b3a('0x23')](_0xcaa903);}};}function respondWithFilteredResult(_0x2ae35b,_0x217383){return function(_0x2160de){if(_0x2160de){var _0x2855c2=_0x2160de[_0x3b3a('0x24')],_0x46ada6=_0x217383[_0x3b3a('0x25')],_0x1ca6a0=_0x217383['offset']+_0x217383['limit'],_0x4531c7;if(_0x1ca6a0>=_0x2855c2){_0x1ca6a0=_0x2855c2;_0x4531c7=0xc8;}else{_0x4531c7=0xce;}_0x2ae35b[_0x3b3a('0x21')](_0x4531c7);return _0x2ae35b[_0x3b3a('0x26')](_0x3b3a('0x27'),_0x46ada6+'-'+_0x1ca6a0+'/'+_0x2855c2)['json'](_0x2160de);}return null;};}function patchUpdates(_0x2e9c16){return function(_0x1a93a4){try{jsonpatch[_0x3b3a('0x28')](_0x1a93a4,_0x2e9c16,!![]);}catch(_0x24162b){return BPromise['reject'](_0x24162b);}return _0x1a93a4[_0x3b3a('0x29')]();};}function saveUpdates(_0x542133,_0xe11af0){return function(_0x4ddf78){if(_0x4ddf78){return _0x4ddf78[_0x3b3a('0x2a')](_0x542133)['then'](function(_0x55db6c){return _0x55db6c;});}return null;};}function removeEntity(_0x1018ad,_0x4f3934){return function(_0x48a8fe){if(_0x48a8fe){return _0x48a8fe['destroy']()['then'](function(){_0x1018ad[_0x3b3a('0x21')](0xcc)[_0x3b3a('0x22')]();});}};}function handleEntityNotFound(_0x1820e2,_0x36e712){return function(_0x2aa0a8){if(!_0x2aa0a8){_0x1820e2[_0x3b3a('0x20')](0x194);}return _0x2aa0a8;};}function handleError(_0x19dd91,_0x348dbb){_0x348dbb=_0x348dbb||0x1f4;return function(_0x3075bc){logger[_0x3b3a('0x1b')](_0x3075bc['stack']);if(_0x3075bc[_0x3b3a('0x2b')]){delete _0x3075bc[_0x3b3a('0x2b')];}_0x19dd91[_0x3b3a('0x21')](_0x348dbb)['send'](_0x3075bc);};}exports[_0x3b3a('0x2c')]=function(_0x31b9d4,_0xbf7b13){var _0x48c502={},_0x154b71={},_0x240866={'count':0x0,'rows':[]};var _0x501c76=db[_0x3b3a('0x2d')]['rawAttributes'];_0x154b71[_0x3b3a('0x2e')]=_[_0x3b3a('0x2f')](_0x501c76);var _0x5bc760={'dateStart':_0x31b9d4[_0x3b3a('0x30')][_0x3b3a('0x31')],'dateEnd':_0x31b9d4[_0x3b3a('0x30')][_0x3b3a('0x32')]};delete _0x31b9d4[_0x3b3a('0x30')][_0x3b3a('0x31')];delete _0x31b9d4[_0x3b3a('0x30')][_0x3b3a('0x32')];_0x154b71[_0x3b3a('0x30')]=_['keys'](_0x31b9d4[_0x3b3a('0x30')]);_0x154b71[_0x3b3a('0x33')]=_['intersection'](_0x154b71[_0x3b3a('0x2e')],_0x154b71['query']);_0x48c502['attributes']=_[_0x3b3a('0x34')](_0x154b71[_0x3b3a('0x2e')],qs[_0x3b3a('0x35')](_0x31b9d4[_0x3b3a('0x30')][_0x3b3a('0x35')]));_0x48c502[_0x3b3a('0x36')]=_0x48c502[_0x3b3a('0x36')]['length']?_0x48c502['attributes']:_0x154b71[_0x3b3a('0x2e')];if(!_0x31b9d4['query'][_0x3b3a('0x37')](_0x3b3a('0x38'))){_0x48c502[_0x3b3a('0x39')]=qs[_0x3b3a('0x39')](_0x31b9d4[_0x3b3a('0x30')][_0x3b3a('0x39')]);_0x48c502['offset']=qs[_0x3b3a('0x25')](_0x31b9d4['query'][_0x3b3a('0x25')]);}_0x48c502[_0x3b3a('0x3a')]=qs[_0x3b3a('0x3b')](_0x31b9d4[_0x3b3a('0x30')]['sort']);_0x48c502[_0x3b3a('0x3c')]=qs[_0x3b3a('0x33')](_[_0x3b3a('0x3d')](_0x31b9d4[_0x3b3a('0x30')],_0x154b71[_0x3b3a('0x33')]));if(_0x5bc760['dateStart']){if(_0x5bc760[_0x3b3a('0x32')]){_0x5bc760['dateEnd']=moment(_0x5bc760['dateEnd'])[_0x3b3a('0x3e')](0x1,_0x3b3a('0x3f'));}else{_0x5bc760['dateEnd']=moment(_0x5bc760['dateStart'])[_0x3b3a('0x3e')](0x1,_0x3b3a('0x3f'));}_[_0x3b3a('0x40')](_0x48c502[_0x3b3a('0x3c')],{'createdAt':{'$gte':_0x5bc760[_0x3b3a('0x31')],'$lte':_0x5bc760[_0x3b3a('0x32')]}});}if(_0x31b9d4['query'][_0x3b3a('0x41')]){_0x48c502[_0x3b3a('0x3c')]=_[_0x3b3a('0x40')](_0x48c502[_0x3b3a('0x3c')],{'$or':_[_0x3b3a('0x42')](_0x48c502['attributes'],function(_0x2afa1d){var _0x18fb01={};_0x18fb01[_0x2afa1d]={'$like':'%'+_0x31b9d4[_0x3b3a('0x30')][_0x3b3a('0x41')]+'%'};return _0x18fb01;})});}_0x48c502=_[_0x3b3a('0x40')]({},_0x48c502,_0x31b9d4[_0x3b3a('0x43')]);var _0x505fd2={'where':_0x48c502[_0x3b3a('0x3c')]};return db[_0x3b3a('0x2d')][_0x3b3a('0x24')](_0x505fd2)[_0x3b3a('0x16')](function(_0x4a5f0e){_0x240866[_0x3b3a('0x24')]=_0x4a5f0e;if(_0x31b9d4[_0x3b3a('0x30')][_0x3b3a('0x44')]){_0x48c502[_0x3b3a('0x45')]=[{'all':!![]}];}return db[_0x3b3a('0x2d')][_0x3b3a('0x46')](_0x48c502);})['then'](function(_0x3cf72f){_0x240866['rows']=_0x3cf72f;return _0x240866;})[_0x3b3a('0x16')](respondWithFilteredResult(_0xbf7b13,_0x48c502))[_0x3b3a('0x1f')](handleError(_0xbf7b13,null));};exports['show']=function(_0x1ccdd7,_0xbbbd46){var _0x3ae5c2={'raw':![],'where':{'id':_0x1ccdd7[_0x3b3a('0x47')]['id']}},_0x3584f0={};_0x3584f0[_0x3b3a('0x2e')]=_['keys'](db[_0x3b3a('0x2d')][_0x3b3a('0x48')]);_0x3584f0[_0x3b3a('0x30')]=_[_0x3b3a('0x2f')](_0x1ccdd7[_0x3b3a('0x30')]);_0x3584f0[_0x3b3a('0x33')]=_[_0x3b3a('0x34')](_0x3584f0[_0x3b3a('0x2e')],_0x3584f0[_0x3b3a('0x30')]);_0x3ae5c2[_0x3b3a('0x36')]=_[_0x3b3a('0x34')](_0x3584f0[_0x3b3a('0x2e')],qs[_0x3b3a('0x35')](_0x1ccdd7[_0x3b3a('0x30')][_0x3b3a('0x35')]));_0x3ae5c2['attributes']=_0x3ae5c2[_0x3b3a('0x36')][_0x3b3a('0x49')]?_0x3ae5c2[_0x3b3a('0x36')]:_0x3584f0[_0x3b3a('0x2e')];if(_0x1ccdd7[_0x3b3a('0x30')][_0x3b3a('0x44')]){_0x3ae5c2[_0x3b3a('0x45')]=[{'all':!![]}];}_0x3ae5c2=_[_0x3b3a('0x40')]({},_0x3ae5c2,_0x1ccdd7[_0x3b3a('0x43')]);return db['SugarcrmConfiguration'][_0x3b3a('0x4a')](_0x3ae5c2)[_0x3b3a('0x16')](handleEntityNotFound(_0xbbbd46,null))[_0x3b3a('0x16')](respondWithResult(_0xbbbd46,null))[_0x3b3a('0x1f')](handleError(_0xbbbd46,null));};exports['create']=function(_0xbac751,_0xc16104){return db[_0x3b3a('0x2d')][_0x3b3a('0x4b')](_0xbac751[_0x3b3a('0x4c')],{})['then'](respondWithResult(_0xc16104,0xc9))[_0x3b3a('0x1f')](handleError(_0xc16104,null));};exports['update']=function(_0x7809c8,_0x35fdac){if(_0x7809c8[_0x3b3a('0x4c')]['id']){delete _0x7809c8[_0x3b3a('0x4c')]['id'];}return db['SugarcrmConfiguration'][_0x3b3a('0x4a')]({'where':{'id':_0x7809c8['params']['id']}})[_0x3b3a('0x16')](handleEntityNotFound(_0x35fdac,null))[_0x3b3a('0x16')](saveUpdates(_0x7809c8[_0x3b3a('0x4c')],null))[_0x3b3a('0x16')](respondWithResult(_0x35fdac,null))[_0x3b3a('0x1f')](handleError(_0x35fdac,null));};exports[_0x3b3a('0x4d')]=function(_0x2fe5cb,_0x3d5265){return db[_0x3b3a('0x2d')]['find']({'where':{'id':_0x2fe5cb[_0x3b3a('0x47')]['id']}})[_0x3b3a('0x16')](handleEntityNotFound(_0x3d5265,null))[_0x3b3a('0x16')](removeEntity(_0x3d5265,null))['catch'](handleError(_0x3d5265,null));};exports[_0x3b3a('0x4e')]=function(_0x342231,_0x5448d4,_0x16ef18){var _0x9fb738={};var _0x4a3f16={};var _0x19fd6;var _0x1ab7d0;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x342231[_0x3b3a('0x47')]['id']}})[_0x3b3a('0x16')](handleEntityNotFound(_0x5448d4,null))[_0x3b3a('0x16')](function(_0x3721ad){if(_0x3721ad){_0x19fd6=_0x3721ad;_0x4a3f16[_0x3b3a('0x2e')]=_[_0x3b3a('0x2f')](db['SugarcrmField'][_0x3b3a('0x48')]);_0x4a3f16[_0x3b3a('0x30')]=_[_0x3b3a('0x2f')](_0x342231[_0x3b3a('0x30')]);_0x4a3f16[_0x3b3a('0x33')]=_[_0x3b3a('0x34')](_0x4a3f16[_0x3b3a('0x2e')],_0x4a3f16['query']);_0x9fb738[_0x3b3a('0x36')]=_[_0x3b3a('0x34')](_0x4a3f16[_0x3b3a('0x2e')],qs[_0x3b3a('0x35')](_0x342231[_0x3b3a('0x30')][_0x3b3a('0x35')]));_0x9fb738[_0x3b3a('0x36')]=_0x9fb738[_0x3b3a('0x36')][_0x3b3a('0x49')]?_0x9fb738['attributes']:_0x4a3f16['model'];_0x9fb738['order']=qs[_0x3b3a('0x3b')](_0x342231['query']['sort']);_0x9fb738[_0x3b3a('0x3c')]=qs[_0x3b3a('0x33')](_[_0x3b3a('0x3d')](_0x342231['query'],_0x4a3f16[_0x3b3a('0x33')]));if(_0x342231[_0x3b3a('0x30')][_0x3b3a('0x41')]){_0x9fb738[_0x3b3a('0x3c')]=_[_0x3b3a('0x40')](_0x9fb738[_0x3b3a('0x3c')],{'$or':_[_0x3b3a('0x42')](_0x9fb738[_0x3b3a('0x36')],function(_0x30205b){var _0x3de122={};_0x3de122[_0x30205b]={'$like':'%'+_0x342231[_0x3b3a('0x30')][_0x3b3a('0x41')]+'%'};return _0x3de122;})});}_0x9fb738=_[_0x3b3a('0x40')]({},_0x9fb738,_0x342231[_0x3b3a('0x43')]);return _0x19fd6[_0x3b3a('0x4e')](_0x9fb738);}})['then'](function(_0x4de33b){if(_0x4de33b){_0x1ab7d0=_0x4de33b[_0x3b3a('0x49')];if(!_0x342231[_0x3b3a('0x30')][_0x3b3a('0x37')]('nolimit')){_0x9fb738['limit']=qs[_0x3b3a('0x39')](_0x342231[_0x3b3a('0x30')][_0x3b3a('0x39')]);_0x9fb738[_0x3b3a('0x25')]=qs[_0x3b3a('0x25')](_0x342231[_0x3b3a('0x30')][_0x3b3a('0x25')]);}return _0x19fd6[_0x3b3a('0x4e')](_0x9fb738);}})['then'](function(_0x126891){if(_0x126891){return _0x126891?{'count':_0x1ab7d0,'rows':_0x126891}:null;}})['then'](respondWithResult(_0x5448d4,null))[_0x3b3a('0x1f')](handleError(_0x5448d4,null));};exports[_0x3b3a('0x4f')]=function(_0xf415a6,_0x51d26c,_0x188501){var _0x759db8={};var _0x1894c8={};var _0x178c78;var _0x44fc3e;return db[_0x3b3a('0x2d')][_0x3b3a('0x50')]({'where':{'id':_0xf415a6[_0x3b3a('0x47')]['id']}})[_0x3b3a('0x16')](handleEntityNotFound(_0x51d26c,null))[_0x3b3a('0x16')](function(_0x3c232f){if(_0x3c232f){_0x178c78=_0x3c232f;_0x1894c8['model']=_['keys'](db['SugarcrmField'][_0x3b3a('0x48')]);_0x1894c8[_0x3b3a('0x30')]=_[_0x3b3a('0x2f')](_0xf415a6[_0x3b3a('0x30')]);_0x1894c8[_0x3b3a('0x33')]=_[_0x3b3a('0x34')](_0x1894c8['model'],_0x1894c8['query']);_0x759db8['attributes']=_[_0x3b3a('0x34')](_0x1894c8[_0x3b3a('0x2e')],qs['fields'](_0xf415a6[_0x3b3a('0x30')][_0x3b3a('0x35')]));_0x759db8['attributes']=_0x759db8[_0x3b3a('0x36')][_0x3b3a('0x49')]?_0x759db8[_0x3b3a('0x36')]:_0x1894c8[_0x3b3a('0x2e')];_0x759db8['order']=qs[_0x3b3a('0x3b')](_0xf415a6['query'][_0x3b3a('0x3b')]);_0x759db8[_0x3b3a('0x3c')]=qs[_0x3b3a('0x33')](_[_0x3b3a('0x3d')](_0xf415a6[_0x3b3a('0x30')],_0x1894c8[_0x3b3a('0x33')]));if(_0xf415a6[_0x3b3a('0x30')]['filter']){_0x759db8[_0x3b3a('0x3c')]=_[_0x3b3a('0x40')](_0x759db8['where'],{'$or':_[_0x3b3a('0x42')](_0x759db8['attributes'],function(_0x3d9817){var _0x56cdd6={};_0x56cdd6[_0x3d9817]={'$like':'%'+_0xf415a6['query']['filter']+'%'};return _0x56cdd6;})});}_0x759db8=_['merge']({},_0x759db8,_0xf415a6[_0x3b3a('0x43')]);return _0x178c78[_0x3b3a('0x4f')](_0x759db8);}})[_0x3b3a('0x16')](function(_0x1e725e){if(_0x1e725e){_0x44fc3e=_0x1e725e[_0x3b3a('0x49')];if(!_0xf415a6[_0x3b3a('0x30')][_0x3b3a('0x37')]('nolimit')){_0x759db8[_0x3b3a('0x39')]=qs[_0x3b3a('0x39')](_0xf415a6[_0x3b3a('0x30')][_0x3b3a('0x39')]);_0x759db8[_0x3b3a('0x25')]=qs[_0x3b3a('0x25')](_0xf415a6[_0x3b3a('0x30')][_0x3b3a('0x25')]);}return _0x178c78[_0x3b3a('0x4f')](_0x759db8);}})[_0x3b3a('0x16')](function(_0x491987){if(_0x491987){return _0x491987?{'count':_0x44fc3e,'rows':_0x491987}:null;}})['then'](respondWithResult(_0x51d26c,null))[_0x3b3a('0x1f')](handleError(_0x51d26c,null));};exports[_0x3b3a('0x51')]=function(_0x43e71d,_0x292d1e,_0x536fc2){var _0x570505={};var _0x5686aa={};var _0x2b12e5;var _0x44b9e1;return db['SugarcrmConfiguration'][_0x3b3a('0x50')]({'where':{'id':_0x43e71d[_0x3b3a('0x47')]['id']}})['then'](handleEntityNotFound(_0x292d1e,null))[_0x3b3a('0x16')](function(_0x26b32e){if(_0x26b32e){_0x2b12e5=_0x26b32e;_0x5686aa[_0x3b3a('0x2e')]=_['keys'](db[_0x3b3a('0x52')][_0x3b3a('0x48')]);_0x5686aa['query']=_[_0x3b3a('0x2f')](_0x43e71d[_0x3b3a('0x30')]);_0x5686aa[_0x3b3a('0x33')]=_[_0x3b3a('0x34')](_0x5686aa[_0x3b3a('0x2e')],_0x5686aa[_0x3b3a('0x30')]);_0x570505[_0x3b3a('0x36')]=_[_0x3b3a('0x34')](_0x5686aa[_0x3b3a('0x2e')],qs[_0x3b3a('0x35')](_0x43e71d[_0x3b3a('0x30')][_0x3b3a('0x35')]));_0x570505[_0x3b3a('0x36')]=_0x570505[_0x3b3a('0x36')][_0x3b3a('0x49')]?_0x570505[_0x3b3a('0x36')]:_0x5686aa[_0x3b3a('0x2e')];_0x570505[_0x3b3a('0x3a')]=qs[_0x3b3a('0x3b')](_0x43e71d['query'][_0x3b3a('0x3b')]);_0x570505['where']=qs[_0x3b3a('0x33')](_['pick'](_0x43e71d[_0x3b3a('0x30')],_0x5686aa['filters']));if(_0x43e71d[_0x3b3a('0x30')][_0x3b3a('0x41')]){_0x570505['where']=_['merge'](_0x570505['where'],{'$or':_[_0x3b3a('0x42')](_0x570505[_0x3b3a('0x36')],function(_0x39c6ee){var _0x3f8b76={};_0x3f8b76[_0x39c6ee]={'$like':'%'+_0x43e71d[_0x3b3a('0x30')][_0x3b3a('0x41')]+'%'};return _0x3f8b76;})});}_0x570505=_['merge']({},_0x570505,_0x43e71d['options']);return _0x2b12e5[_0x3b3a('0x51')](_0x570505);}})[_0x3b3a('0x16')](function(_0x1b9ba5){if(_0x1b9ba5){_0x44b9e1=_0x1b9ba5[_0x3b3a('0x49')];if(!_0x43e71d[_0x3b3a('0x30')][_0x3b3a('0x37')](_0x3b3a('0x38'))){_0x570505['limit']=qs[_0x3b3a('0x39')](_0x43e71d[_0x3b3a('0x30')][_0x3b3a('0x39')]);_0x570505[_0x3b3a('0x25')]=qs[_0x3b3a('0x25')](_0x43e71d[_0x3b3a('0x30')][_0x3b3a('0x25')]);}return _0x2b12e5['getDescriptions'](_0x570505);}})[_0x3b3a('0x16')](function(_0xa3dc48){if(_0xa3dc48){return _0xa3dc48?{'count':_0x44b9e1,'rows':_0xa3dc48}:null;}})[_0x3b3a('0x16')](respondWithResult(_0x292d1e,null))[_0x3b3a('0x1f')](handleError(_0x292d1e,null));}; \ No newline at end of file +var _0x4763=['map','options','count','then','findAll','rows','show','length','includeAll','find','create','body','params','findOne','SugarcrmField','getFields','getSubjects','pick','hasOwnProperty','getDescriptions','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','SugarcrmConfiguration,\x20%s,\x20%s','result','catch','status','end','json','offset','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','SugarcrmConfiguration','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields','limit','order','sort','where','day','add','filter','merge'];(function(_0x5844e8,_0x3caa67){var _0x189b5b=function(_0xb39b10){while(--_0xb39b10){_0x5844e8['push'](_0x5844e8['shift']());}};_0x189b5b(++_0x3caa67);}(_0x4763,0x113));var _0x3476=function(_0x276339,_0x20600e){_0x276339=_0x276339-0x0;var _0x23d7aa=_0x4763[_0x276339];return _0x23d7aa;};'use strict';var jsonpatch=require(_0x3476('0x0'));var rp=require(_0x3476('0x1'));var moment=require(_0x3476('0x2'));var BPromise=require(_0x3476('0x3'));var Mustache=require(_0x3476('0x4'));var util=require('util');var path=require(_0x3476('0x5'));var sox=require(_0x3476('0x6'));var csv=require(_0x3476('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3476('0x8'));var squel=require(_0x3476('0x9'));var crypto=require(_0x3476('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3476('0xb'));var toCsv=require(_0x3476('0x7'));var querystring=require('querystring');var Papa=require(_0x3476('0xc'));var qs=require(_0x3476('0xd'));var logger=require(_0x3476('0xe'))('api');var utils=require(_0x3476('0xf'));var config=require(_0x3476('0x10'));var db=require(_0x3476('0x11'))['db'];var jayson=require(_0x3476('0x12'));var client=jayson[_0x3476('0x13')][_0x3476('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x4bab98,_0x5860ed,_0x5d37c6,_0x3737eb){return new BPromise(function(_0x552352,_0x1fb166){var _0x115080=_0x3737eb||client;return _0x115080[_0x3476('0x15')](_0x4bab98,_0x5d37c6)['then'](function(_0x43638a){logger[_0x3476('0x16')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5860ed,_0x3476('0x17'));logger[_0x3476('0x18')](_0x3476('0x19'),_0x5860ed,_0x3476('0x17'),JSON['stringify'](_0x43638a));if(_0x43638a[_0x3476('0x1a')]){if(_0x43638a[_0x3476('0x1a')][_0x3476('0x1b')]===0x1f4){logger[_0x3476('0x1a')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5860ed,_0x43638a[_0x3476('0x1a')][_0x3476('0x1c')]);return _0x1fb166(_0x43638a[_0x3476('0x1a')][_0x3476('0x1c')]);}logger[_0x3476('0x1a')](_0x3476('0x1d'),_0x5860ed,_0x43638a[_0x3476('0x1a')][_0x3476('0x1c')]);return _0x552352(_0x43638a[_0x3476('0x1a')]['message']);}else{logger[_0x3476('0x16')](_0x3476('0x1d'),_0x5860ed,'request\x20sent');_0x552352(_0x43638a[_0x3476('0x1e')][_0x3476('0x1c')]);}})[_0x3476('0x1f')](function(_0x30da9f){logger[_0x3476('0x1a')](_0x3476('0x1d'),_0x5860ed,_0x30da9f);_0x1fb166(_0x30da9f);});});}function respondWithStatusCode(_0x561dbb,_0x121889){_0x121889=_0x121889||0xcc;return function(_0x9aa573){if(_0x9aa573){return _0x561dbb['sendStatus'](_0x121889);}return _0x561dbb[_0x3476('0x20')](_0x121889)[_0x3476('0x21')]();};}function respondWithResult(_0x42dc92,_0xf349f5){_0xf349f5=_0xf349f5||0xc8;return function(_0x4bb84b){if(_0x4bb84b){return _0x42dc92['status'](_0xf349f5)[_0x3476('0x22')](_0x4bb84b);}};}function respondWithFilteredResult(_0x470b57,_0xc8079e){return function(_0x11d1cd){if(_0x11d1cd){var _0x92465b=_0x11d1cd['count'],_0x5e3758=_0xc8079e[_0x3476('0x23')],_0x3c6150=_0xc8079e['offset']+_0xc8079e['limit'],_0x46f18d;if(_0x3c6150>=_0x92465b){_0x3c6150=_0x92465b;_0x46f18d=0xc8;}else{_0x46f18d=0xce;}_0x470b57[_0x3476('0x20')](_0x46f18d);return _0x470b57[_0x3476('0x24')](_0x3476('0x25'),_0x5e3758+'-'+_0x3c6150+'/'+_0x92465b)[_0x3476('0x22')](_0x11d1cd);}return null;};}function patchUpdates(_0x10e927){return function(_0x241310){try{jsonpatch[_0x3476('0x26')](_0x241310,_0x10e927,!![]);}catch(_0x296971){return BPromise[_0x3476('0x27')](_0x296971);}return _0x241310[_0x3476('0x28')]();};}function saveUpdates(_0x4c39cf,_0x1462b6){return function(_0x4d6849){if(_0x4d6849){return _0x4d6849[_0x3476('0x29')](_0x4c39cf)['then'](function(_0x319be5){return _0x319be5;});}return null;};}function removeEntity(_0xcc54ab,_0x35bb86){return function(_0x500a30){if(_0x500a30){return _0x500a30[_0x3476('0x2a')]()['then'](function(){_0xcc54ab[_0x3476('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f0888,_0x420edd){return function(_0x4c12c7){if(!_0x4c12c7){_0x5f0888[_0x3476('0x2b')](0x194);}return _0x4c12c7;};}function handleError(_0x3df8f8,_0x509b34){_0x509b34=_0x509b34||0x1f4;return function(_0x1f0429){logger[_0x3476('0x1a')](_0x1f0429['stack']);if(_0x1f0429[_0x3476('0x2c')]){delete _0x1f0429[_0x3476('0x2c')];}_0x3df8f8[_0x3476('0x20')](_0x509b34)[_0x3476('0x2d')](_0x1f0429);};}exports['index']=function(_0x323b38,_0x32fa55){var _0x5b965b={},_0x4c8f07={},_0x15b34e={'count':0x0,'rows':[]};var _0x2f4632=db[_0x3476('0x2e')][_0x3476('0x2f')];_0x4c8f07[_0x3476('0x30')]=_[_0x3476('0x31')](_0x2f4632);var _0x1b2d69={'dateStart':_0x323b38['query']['dateStart'],'dateEnd':_0x323b38[_0x3476('0x32')][_0x3476('0x33')]};delete _0x323b38[_0x3476('0x32')][_0x3476('0x34')];delete _0x323b38[_0x3476('0x32')]['dateEnd'];_0x4c8f07[_0x3476('0x32')]=_[_0x3476('0x31')](_0x323b38[_0x3476('0x32')]);_0x4c8f07[_0x3476('0x35')]=_[_0x3476('0x36')](_0x4c8f07[_0x3476('0x30')],_0x4c8f07[_0x3476('0x32')]);_0x5b965b[_0x3476('0x37')]=_[_0x3476('0x36')](_0x4c8f07[_0x3476('0x30')],qs[_0x3476('0x38')](_0x323b38[_0x3476('0x32')][_0x3476('0x38')]));_0x5b965b[_0x3476('0x37')]=_0x5b965b[_0x3476('0x37')]['length']?_0x5b965b[_0x3476('0x37')]:_0x4c8f07[_0x3476('0x30')];if(!_0x323b38[_0x3476('0x32')]['hasOwnProperty']('nolimit')){_0x5b965b[_0x3476('0x39')]=qs['limit'](_0x323b38['query'][_0x3476('0x39')]);_0x5b965b['offset']=qs[_0x3476('0x23')](_0x323b38['query'][_0x3476('0x23')]);}_0x5b965b[_0x3476('0x3a')]=qs[_0x3476('0x3b')](_0x323b38[_0x3476('0x32')][_0x3476('0x3b')]);_0x5b965b[_0x3476('0x3c')]=qs['filters'](_['pick'](_0x323b38['query'],_0x4c8f07[_0x3476('0x35')]));if(_0x1b2d69['dateStart']){if(_0x1b2d69[_0x3476('0x33')]){_0x1b2d69[_0x3476('0x33')]=moment(_0x1b2d69[_0x3476('0x33')])['add'](0x1,_0x3476('0x3d'));}else{_0x1b2d69['dateEnd']=moment(_0x1b2d69[_0x3476('0x34')])[_0x3476('0x3e')](0x1,'day');}_['merge'](_0x5b965b[_0x3476('0x3c')],{'createdAt':{'$gte':_0x1b2d69[_0x3476('0x34')],'$lte':_0x1b2d69[_0x3476('0x33')]}});}if(_0x323b38[_0x3476('0x32')][_0x3476('0x3f')]){_0x5b965b[_0x3476('0x3c')]=_[_0x3476('0x40')](_0x5b965b['where'],{'$or':_[_0x3476('0x41')](_0x5b965b['attributes'],function(_0x28496c){var _0x1f23b1={};_0x1f23b1[_0x28496c]={'$like':'%'+_0x323b38['query']['filter']+'%'};return _0x1f23b1;})});}_0x5b965b=_[_0x3476('0x40')]({},_0x5b965b,_0x323b38[_0x3476('0x42')]);var _0x4c209e={'where':_0x5b965b[_0x3476('0x3c')]};return db[_0x3476('0x2e')][_0x3476('0x43')](_0x4c209e)[_0x3476('0x44')](function(_0x46bdff){_0x15b34e[_0x3476('0x43')]=_0x46bdff;if(_0x323b38['query']['includeAll']){_0x5b965b['include']=[{'all':!![]}];}return db[_0x3476('0x2e')][_0x3476('0x45')](_0x5b965b);})['then'](function(_0x29e2eb){_0x15b34e[_0x3476('0x46')]=_0x29e2eb;return _0x15b34e;})[_0x3476('0x44')](respondWithFilteredResult(_0x32fa55,_0x5b965b))['catch'](handleError(_0x32fa55,null));};exports[_0x3476('0x47')]=function(_0x49c5e7,_0x50c1a7){var _0x5b555a={'raw':![],'where':{'id':_0x49c5e7['params']['id']}},_0x3f7460={};_0x3f7460[_0x3476('0x30')]=_[_0x3476('0x31')](db[_0x3476('0x2e')][_0x3476('0x2f')]);_0x3f7460[_0x3476('0x32')]=_[_0x3476('0x31')](_0x49c5e7[_0x3476('0x32')]);_0x3f7460[_0x3476('0x35')]=_['intersection'](_0x3f7460[_0x3476('0x30')],_0x3f7460[_0x3476('0x32')]);_0x5b555a[_0x3476('0x37')]=_[_0x3476('0x36')](_0x3f7460[_0x3476('0x30')],qs[_0x3476('0x38')](_0x49c5e7['query'][_0x3476('0x38')]));_0x5b555a[_0x3476('0x37')]=_0x5b555a[_0x3476('0x37')][_0x3476('0x48')]?_0x5b555a[_0x3476('0x37')]:_0x3f7460[_0x3476('0x30')];if(_0x49c5e7['query'][_0x3476('0x49')]){_0x5b555a['include']=[{'all':!![]}];}_0x5b555a=_[_0x3476('0x40')]({},_0x5b555a,_0x49c5e7[_0x3476('0x42')]);return db[_0x3476('0x2e')][_0x3476('0x4a')](_0x5b555a)['then'](handleEntityNotFound(_0x50c1a7,null))[_0x3476('0x44')](respondWithResult(_0x50c1a7,null))[_0x3476('0x1f')](handleError(_0x50c1a7,null));};exports[_0x3476('0x4b')]=function(_0x169de5,_0xd970d4){return db['SugarcrmConfiguration'][_0x3476('0x4b')](_0x169de5[_0x3476('0x4c')],{})[_0x3476('0x44')](respondWithResult(_0xd970d4,0xc9))[_0x3476('0x1f')](handleError(_0xd970d4,null));};exports[_0x3476('0x29')]=function(_0x23bd17,_0x359f58){if(_0x23bd17[_0x3476('0x4c')]['id']){delete _0x23bd17['body']['id'];}return db[_0x3476('0x2e')][_0x3476('0x4a')]({'where':{'id':_0x23bd17[_0x3476('0x4d')]['id']}})['then'](handleEntityNotFound(_0x359f58,null))[_0x3476('0x44')](saveUpdates(_0x23bd17['body'],null))['then'](respondWithResult(_0x359f58,null))[_0x3476('0x1f')](handleError(_0x359f58,null));};exports[_0x3476('0x2a')]=function(_0xf7a3f1,_0x3f64cf){return db['SugarcrmConfiguration'][_0x3476('0x4a')]({'where':{'id':_0xf7a3f1[_0x3476('0x4d')]['id']}})[_0x3476('0x44')](handleEntityNotFound(_0x3f64cf,null))[_0x3476('0x44')](removeEntity(_0x3f64cf,null))[_0x3476('0x1f')](handleError(_0x3f64cf,null));};exports['getFields']=function(_0x15fe34,_0x5f2ff0,_0x13c3f1){var _0x5a23e8={};var _0x19b4fd={};var _0x114857;var _0x5d4f56;return db['SugarcrmConfiguration'][_0x3476('0x4e')]({'where':{'id':_0x15fe34[_0x3476('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5f2ff0,null))[_0x3476('0x44')](function(_0x2ddc06){if(_0x2ddc06){_0x114857=_0x2ddc06;_0x19b4fd['model']=_['keys'](db[_0x3476('0x4f')][_0x3476('0x2f')]);_0x19b4fd['query']=_['keys'](_0x15fe34['query']);_0x19b4fd[_0x3476('0x35')]=_[_0x3476('0x36')](_0x19b4fd['model'],_0x19b4fd[_0x3476('0x32')]);_0x5a23e8[_0x3476('0x37')]=_[_0x3476('0x36')](_0x19b4fd[_0x3476('0x30')],qs[_0x3476('0x38')](_0x15fe34[_0x3476('0x32')]['fields']));_0x5a23e8['attributes']=_0x5a23e8['attributes']['length']?_0x5a23e8[_0x3476('0x37')]:_0x19b4fd[_0x3476('0x30')];_0x5a23e8[_0x3476('0x3a')]=qs[_0x3476('0x3b')](_0x15fe34[_0x3476('0x32')]['sort']);_0x5a23e8[_0x3476('0x3c')]=qs[_0x3476('0x35')](_['pick'](_0x15fe34[_0x3476('0x32')],_0x19b4fd[_0x3476('0x35')]));if(_0x15fe34[_0x3476('0x32')]['filter']){_0x5a23e8['where']=_[_0x3476('0x40')](_0x5a23e8[_0x3476('0x3c')],{'$or':_['map'](_0x5a23e8[_0x3476('0x37')],function(_0x190fe2){var _0x40ced6={};_0x40ced6[_0x190fe2]={'$like':'%'+_0x15fe34[_0x3476('0x32')][_0x3476('0x3f')]+'%'};return _0x40ced6;})});}_0x5a23e8=_[_0x3476('0x40')]({},_0x5a23e8,_0x15fe34[_0x3476('0x42')]);return _0x114857[_0x3476('0x50')](_0x5a23e8);}})[_0x3476('0x44')](function(_0x17b91e){if(_0x17b91e){_0x5d4f56=_0x17b91e['length'];if(!_0x15fe34[_0x3476('0x32')]['hasOwnProperty']('nolimit')){_0x5a23e8[_0x3476('0x39')]=qs[_0x3476('0x39')](_0x15fe34[_0x3476('0x32')][_0x3476('0x39')]);_0x5a23e8[_0x3476('0x23')]=qs[_0x3476('0x23')](_0x15fe34[_0x3476('0x32')][_0x3476('0x23')]);}return _0x114857['getFields'](_0x5a23e8);}})[_0x3476('0x44')](function(_0x41ae9b){if(_0x41ae9b){return _0x41ae9b?{'count':_0x5d4f56,'rows':_0x41ae9b}:null;}})[_0x3476('0x44')](respondWithResult(_0x5f2ff0,null))[_0x3476('0x1f')](handleError(_0x5f2ff0,null));};exports[_0x3476('0x51')]=function(_0x2841f4,_0x2ee010,_0x1c2b61){var _0x1d1142={};var _0x2b18d2={};var _0x34a7d4;var _0x54f1d0;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x2841f4[_0x3476('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2ee010,null))['then'](function(_0x56d482){if(_0x56d482){_0x34a7d4=_0x56d482;_0x2b18d2[_0x3476('0x30')]=_[_0x3476('0x31')](db['SugarcrmField']['rawAttributes']);_0x2b18d2[_0x3476('0x32')]=_[_0x3476('0x31')](_0x2841f4[_0x3476('0x32')]);_0x2b18d2[_0x3476('0x35')]=_[_0x3476('0x36')](_0x2b18d2[_0x3476('0x30')],_0x2b18d2['query']);_0x1d1142[_0x3476('0x37')]=_[_0x3476('0x36')](_0x2b18d2[_0x3476('0x30')],qs[_0x3476('0x38')](_0x2841f4[_0x3476('0x32')]['fields']));_0x1d1142[_0x3476('0x37')]=_0x1d1142['attributes']['length']?_0x1d1142[_0x3476('0x37')]:_0x2b18d2[_0x3476('0x30')];_0x1d1142['order']=qs[_0x3476('0x3b')](_0x2841f4[_0x3476('0x32')]['sort']);_0x1d1142[_0x3476('0x3c')]=qs['filters'](_[_0x3476('0x52')](_0x2841f4[_0x3476('0x32')],_0x2b18d2[_0x3476('0x35')]));if(_0x2841f4[_0x3476('0x32')][_0x3476('0x3f')]){_0x1d1142[_0x3476('0x3c')]=_[_0x3476('0x40')](_0x1d1142[_0x3476('0x3c')],{'$or':_[_0x3476('0x41')](_0x1d1142[_0x3476('0x37')],function(_0x38a941){var _0x5bf6e6={};_0x5bf6e6[_0x38a941]={'$like':'%'+_0x2841f4[_0x3476('0x32')][_0x3476('0x3f')]+'%'};return _0x5bf6e6;})});}_0x1d1142=_[_0x3476('0x40')]({},_0x1d1142,_0x2841f4[_0x3476('0x42')]);return _0x34a7d4['getSubjects'](_0x1d1142);}})[_0x3476('0x44')](function(_0xb14348){if(_0xb14348){_0x54f1d0=_0xb14348[_0x3476('0x48')];if(!_0x2841f4[_0x3476('0x32')][_0x3476('0x53')]('nolimit')){_0x1d1142[_0x3476('0x39')]=qs['limit'](_0x2841f4['query'][_0x3476('0x39')]);_0x1d1142[_0x3476('0x23')]=qs[_0x3476('0x23')](_0x2841f4[_0x3476('0x32')]['offset']);}return _0x34a7d4[_0x3476('0x51')](_0x1d1142);}})['then'](function(_0x44ef56){if(_0x44ef56){return _0x44ef56?{'count':_0x54f1d0,'rows':_0x44ef56}:null;}})['then'](respondWithResult(_0x2ee010,null))['catch'](handleError(_0x2ee010,null));};exports[_0x3476('0x54')]=function(_0x313f9e,_0x5b0da8,_0x5ca1e0){var _0x331da7={};var _0x94469e={};var _0x4be07d;var _0x53cd52;return db[_0x3476('0x2e')][_0x3476('0x4e')]({'where':{'id':_0x313f9e[_0x3476('0x4d')]['id']}})[_0x3476('0x44')](handleEntityNotFound(_0x5b0da8,null))[_0x3476('0x44')](function(_0x18c5c4){if(_0x18c5c4){_0x4be07d=_0x18c5c4;_0x94469e[_0x3476('0x30')]=_['keys'](db['SugarcrmField'][_0x3476('0x2f')]);_0x94469e[_0x3476('0x32')]=_['keys'](_0x313f9e[_0x3476('0x32')]);_0x94469e[_0x3476('0x35')]=_['intersection'](_0x94469e[_0x3476('0x30')],_0x94469e['query']);_0x331da7['attributes']=_[_0x3476('0x36')](_0x94469e[_0x3476('0x30')],qs['fields'](_0x313f9e[_0x3476('0x32')]['fields']));_0x331da7[_0x3476('0x37')]=_0x331da7[_0x3476('0x37')][_0x3476('0x48')]?_0x331da7[_0x3476('0x37')]:_0x94469e[_0x3476('0x30')];_0x331da7[_0x3476('0x3a')]=qs['sort'](_0x313f9e[_0x3476('0x32')][_0x3476('0x3b')]);_0x331da7[_0x3476('0x3c')]=qs[_0x3476('0x35')](_[_0x3476('0x52')](_0x313f9e[_0x3476('0x32')],_0x94469e['filters']));if(_0x313f9e[_0x3476('0x32')][_0x3476('0x3f')]){_0x331da7[_0x3476('0x3c')]=_[_0x3476('0x40')](_0x331da7[_0x3476('0x3c')],{'$or':_[_0x3476('0x41')](_0x331da7[_0x3476('0x37')],function(_0x558b38){var _0x1d481e={};_0x1d481e[_0x558b38]={'$like':'%'+_0x313f9e['query'][_0x3476('0x3f')]+'%'};return _0x1d481e;})});}_0x331da7=_[_0x3476('0x40')]({},_0x331da7,_0x313f9e['options']);return _0x4be07d[_0x3476('0x54')](_0x331da7);}})['then'](function(_0xf8d40a){if(_0xf8d40a){_0x53cd52=_0xf8d40a[_0x3476('0x48')];if(!_0x313f9e['query'][_0x3476('0x53')]('nolimit')){_0x331da7[_0x3476('0x39')]=qs['limit'](_0x313f9e[_0x3476('0x32')][_0x3476('0x39')]);_0x331da7[_0x3476('0x23')]=qs[_0x3476('0x23')](_0x313f9e[_0x3476('0x32')][_0x3476('0x23')]);}return _0x4be07d[_0x3476('0x54')](_0x331da7);}})[_0x3476('0x44')](function(_0x1d6722){if(_0x1d6722){return _0x1d6722?{'count':_0x53cd52,'rows':_0x1d6722}:null;}})[_0x3476('0x44')](respondWithResult(_0x5b0da8,null))['catch'](handleError(_0x5b0da8,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index a4c2b4c..002447a 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 _0xe3cd=['lodash','util','../../config/logger','request-promise','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xe3cd,0x1e0));var _0xde3c=function(_0x3ad60e,_0x2fb035){_0x3ad60e=_0x3ad60e-0x0;var _0xba9aad=_0xe3cd[_0x3ad60e];return _0xba9aad;};'use strict';var _=require(_0xde3c('0x0'));var util=require(_0xde3c('0x1'));var logger=require(_0xde3c('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xde3c('0x3'));var attributes=require(_0xde3c('0x4'));module[_0xde3c('0x5')]=function(_0x215a40,_0x120d61){return _0x215a40['define'](_0xde3c('0x6'),attributes,{'tableName':_0xde3c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbfd=['exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','bluebird','request-promise'];(function(_0x59831f,_0x5154ca){var _0x11f70c=function(_0x3e7adf){while(--_0x3e7adf){_0x59831f['push'](_0x59831f['shift']());}};_0x11f70c(++_0x5154ca);}(_0xdbfd,0x18b));var _0xddbf=function(_0x24c042,_0x5533e5){_0x24c042=_0x24c042-0x0;var _0x161fd3=_0xdbfd[_0x24c042];return _0x161fd3;};'use strict';var _=require(_0xddbf('0x0'));var util=require(_0xddbf('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xddbf('0x2'));var rp=require(_0xddbf('0x3'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xddbf('0x4')]=function(_0x3d7079,_0x4ba2f0){return _0x3d7079['define'](_0xddbf('0x5'),attributes,{'tableName':_0xddbf('0x6'),'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 6870774..ee60902 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 _0xe5c7=['request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xe5c7,0x1a5));var _0x7e5c=function(_0x587c9f,_0x549043){_0x587c9f=_0x587c9f-0x0;var _0x10d54e=_0xe5c7[_0x587c9f];return _0x10d54e;};'use strict';var _=require(_0x7e5c('0x0'));var util=require(_0x7e5c('0x1'));var moment=require(_0x7e5c('0x2'));var BPromise=require(_0x7e5c('0x3'));var rs=require(_0x7e5c('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x7e5c('0x5'));var logger=require(_0x7e5c('0x6'))(_0x7e5c('0x7'));var config=require(_0x7e5c('0x8'));var jayson=require(_0x7e5c('0x9'));var client=jayson[_0x7e5c('0xa')][_0x7e5c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13fbfa,_0x1a90c9,_0x32dba5){return new BPromise(function(_0x31e32e,_0x212243){return client[_0x7e5c('0xc')](_0x13fbfa,_0x32dba5)[_0x7e5c('0xd')](function(_0x277b02){logger[_0x7e5c('0xe')](_0x7e5c('0xf'),_0x1a90c9,_0x7e5c('0x10'));logger['debug'](_0x7e5c('0x11'),_0x1a90c9,_0x7e5c('0x10'),JSON['stringify'](_0x277b02));if(_0x277b02[_0x7e5c('0x12')]){if(_0x277b02[_0x7e5c('0x12')][_0x7e5c('0x13')]===0x1f4){logger[_0x7e5c('0x12')](_0x7e5c('0xf'),_0x1a90c9,_0x277b02[_0x7e5c('0x12')]['message']);return _0x212243(_0x277b02[_0x7e5c('0x12')][_0x7e5c('0x14')]);}logger[_0x7e5c('0x12')](_0x7e5c('0xf'),_0x1a90c9,_0x277b02['error'][_0x7e5c('0x14')]);return _0x31e32e(_0x277b02[_0x7e5c('0x12')][_0x7e5c('0x14')]);}else{logger['info'](_0x7e5c('0xf'),_0x1a90c9,'request\x20sent');_0x31e32e(_0x277b02[_0x7e5c('0x15')][_0x7e5c('0x14')]);}})[_0x7e5c('0x16')](function(_0x8aa188){logger[_0x7e5c('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1a90c9,_0x8aa188);_0x212243(_0x8aa188);});});} \ No newline at end of file +var _0x6ca5=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','SugarcrmConfiguration,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x36c6eb,_0x4fb127){var _0x30675b=function(_0x3a788b){while(--_0x3a788b){_0x36c6eb['push'](_0x36c6eb['shift']());}};_0x30675b(++_0x4fb127);}(_0x6ca5,0x119));var _0x56ca=function(_0x44d4d7,_0x21d99a){_0x44d4d7=_0x44d4d7-0x0;var _0x1bc581=_0x6ca5[_0x44d4d7];return _0x1bc581;};'use strict';var _=require(_0x56ca('0x0'));var util=require(_0x56ca('0x1'));var moment=require(_0x56ca('0x2'));var BPromise=require(_0x56ca('0x3'));var rs=require(_0x56ca('0x4'));var fs=require('fs');var db=require(_0x56ca('0x5'))['db'];var utils=require(_0x56ca('0x6'));var logger=require(_0x56ca('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x56ca('0x8'));var client=jayson[_0x56ca('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481318,_0x4cf4b4,_0x17f3a0){return new BPromise(function(_0x372dd3,_0xc5da79){return client[_0x56ca('0xa')](_0x481318,_0x17f3a0)[_0x56ca('0xb')](function(_0x370f99){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x4cf4b4,_0x56ca('0xc'));logger[_0x56ca('0xd')](_0x56ca('0xe'),_0x4cf4b4,_0x56ca('0xc'),JSON[_0x56ca('0xf')](_0x370f99));if(_0x370f99['error']){if(_0x370f99[_0x56ca('0x10')][_0x56ca('0x11')]===0x1f4){logger[_0x56ca('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4cf4b4,_0x370f99[_0x56ca('0x10')][_0x56ca('0x12')]);return _0xc5da79(_0x370f99[_0x56ca('0x10')][_0x56ca('0x12')]);}logger[_0x56ca('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4cf4b4,_0x370f99[_0x56ca('0x10')][_0x56ca('0x12')]);return _0x372dd3(_0x370f99['error']['message']);}else{logger[_0x56ca('0x13')](_0x56ca('0x14'),_0x4cf4b4,_0x56ca('0xc'));_0x372dd3(_0x370f99['result'][_0x56ca('0x12')]);}})[_0x56ca('0x15')](function(_0x3e7d5d){logger[_0x56ca('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4cf4b4,_0x3e7d5d);_0xc5da79(_0x3e7d5d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index d76baff..224c137 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 _0xbd51=['show','post','create','/:id','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','isAuthenticated','index','get'];(function(_0x5c7eb9,_0x1f4029){var _0x25fff2=function(_0x5b5022){while(--_0x5b5022){_0x5c7eb9['push'](_0x5c7eb9['shift']());}};_0x25fff2(++_0x1f4029);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x5f247d,_0x12f88e){_0x5f247d=_0x5f247d-0x0;var _0x585d4e=_0xbd51[_0x5f247d];return _0x585d4e;};'use strict';var multer=require(_0x1bd5('0x0'));var util=require('util');var path=require(_0x1bd5('0x1'));var express=require(_0x1bd5('0x2'));var router=express[_0x1bd5('0x3')]();var auth=require(_0x1bd5('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router['get']('/',auth[_0x1bd5('0x5')](),controller[_0x1bd5('0x6')]);router[_0x1bd5('0x7')]('/:id',auth[_0x1bd5('0x5')](),controller[_0x1bd5('0x8')]);router[_0x1bd5('0x9')]('/',auth[_0x1bd5('0x5')](),controller[_0x1bd5('0xa')]);router['put'](_0x1bd5('0xb'),auth['isAuthenticated'](),controller[_0x1bd5('0xc')]);router[_0x1bd5('0xd')](_0x1bd5('0xb'),auth[_0x1bd5('0x5')](),controller[_0x1bd5('0xe')]);module[_0x1bd5('0xf')]=router; \ No newline at end of file +var _0x1b20=['util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x3a038b,_0x54214b){var _0x1b7f02=function(_0x2c0c1c){while(--_0x2c0c1c){_0x3a038b['push'](_0x3a038b['shift']());}};_0x1b7f02(++_0x54214b);}(_0x1b20,0x66));var _0x01b2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1b20[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x01b2('0x0'));var path=require(_0x01b2('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x01b2('0x2'));var interaction=require(_0x01b2('0x3'));var config=require(_0x01b2('0x4'));var controller=require(_0x01b2('0x5'));router[_0x01b2('0x6')]('/',auth[_0x01b2('0x7')](),controller[_0x01b2('0x8')]);router[_0x01b2('0x6')](_0x01b2('0x9'),auth[_0x01b2('0x7')](),controller[_0x01b2('0xa')]);router[_0x01b2('0xb')]('/',auth['isAuthenticated'](),controller[_0x01b2('0xc')]);router['put'](_0x01b2('0x9'),auth[_0x01b2('0x7')](),controller[_0x01b2('0xd')]);router[_0x01b2('0xe')](_0x01b2('0x9'),auth[_0x01b2('0x7')](),controller[_0x01b2('0xf')]);module[_0x01b2('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 920a360..b2a7867 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 _0xb43b=['ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','STRING'];(function(_0x8a0d94,_0x16fcee){var _0x48f382=function(_0x46ab83){while(--_0x46ab83){_0x8a0d94['push'](_0x8a0d94['shift']());}};_0x48f382(++_0x16fcee);}(_0xb43b,0x1b2));var _0xbb43=function(_0x504561,_0x289695){_0x504561=_0x504561-0x0;var _0x1fc536=_0xb43b[_0x504561];return _0x1fc536;};'use strict';var Sequelize=require(_0xbb43('0x0'));module[_0xbb43('0x1')]={'type':{'type':Sequelize['ENUM'](_0xbb43('0x2'),_0xbb43('0x3'),_0xbb43('0x4'),'keyValue'),'defaultValue':_0xbb43('0x2')},'content':{'type':Sequelize[_0xbb43('0x5')]},'key':{'type':Sequelize[_0xbb43('0x5')]},'keyType':{'type':Sequelize[_0xbb43('0x6')]('string','variable',_0xbb43('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xbb43('0x5')]},'nameField':{'type':Sequelize[_0xbb43('0x5')]},'customField':{'type':Sequelize[_0xbb43('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbb43('0x5')]}}; \ No newline at end of file +var _0x41bb=['exports','string','customVariable','keyValue','STRING','ENUM','variable','BOOLEAN','sequelize'];(function(_0x3e3e71,_0x1967ef){var _0x143062=function(_0x42d5bc){while(--_0x42d5bc){_0x3e3e71['push'](_0x3e3e71['shift']());}};_0x143062(++_0x1967ef);}(_0x41bb,0xc5));var _0xb41b=function(_0x47d73c,_0xf9fe8c){_0x47d73c=_0x47d73c-0x0;var _0x32b206=_0x41bb[_0x47d73c];return _0x32b206;};'use strict';var Sequelize=require(_0xb41b('0x0'));module[_0xb41b('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb41b('0x2'),'variable',_0xb41b('0x3'),_0xb41b('0x4')),'defaultValue':_0xb41b('0x2')},'content':{'type':Sequelize[_0xb41b('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb41b('0x6')](_0xb41b('0x2'),_0xb41b('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb41b('0x5')]},'customField':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 586f5b9..d84db50 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 _0x381e=['ejs','lodash','crypto','jsforce','desk.js','querystring','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','apply','reject','update','then','error','name','send','index','SugarcrmField','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','add','day','merge','filter','map','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x85ce6,_0x4b6efc){var _0x21dfc3=function(_0x345adc){while(--_0x345adc){_0x85ce6['push'](_0x85ce6['shift']());}};_0x21dfc3(++_0x4b6efc);}(_0x381e,0x18f));var _0xe381=function(_0x46f77c,_0x43a1db){_0x46f77c=_0x46f77c-0x0;var _0x375630=_0x381e[_0x46f77c];return _0x375630;};'use strict';var jsonpatch=require(_0xe381('0x0'));var rp=require(_0xe381('0x1'));var moment=require(_0xe381('0x2'));var BPromise=require(_0xe381('0x3'));var Mustache=require(_0xe381('0x4'));var util=require(_0xe381('0x5'));var path=require(_0xe381('0x6'));var sox=require(_0xe381('0x7'));var csv=require(_0xe381('0x8'));var ejs=require(_0xe381('0x9'));var fs=require('fs');var _=require(_0xe381('0xa'));var squel=require('squel');var crypto=require(_0xe381('0xb'));var jsforce=require(_0xe381('0xc'));var deskjs=require(_0xe381('0xd'));var toCsv=require(_0xe381('0x8'));var querystring=require(_0xe381('0xe'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0xe381('0xf'))(_0xe381('0x10'));var utils=require('../../config/utils');var config=require(_0xe381('0x11'));var db=require(_0xe381('0x12'))['db'];function respondWithStatusCode(_0x155546,_0x4df107){_0x4df107=_0x4df107||0xcc;return function(_0xcb3f0c){if(_0xcb3f0c){return _0x155546[_0xe381('0x13')](_0x4df107);}return _0x155546['status'](_0x4df107)[_0xe381('0x14')]();};}function respondWithResult(_0x156964,_0x2a9994){_0x2a9994=_0x2a9994||0xc8;return function(_0x4077d4){if(_0x4077d4){return _0x156964[_0xe381('0x15')](_0x2a9994)[_0xe381('0x16')](_0x4077d4);}};}function respondWithFilteredResult(_0x564452,_0x3094f3){return function(_0x1924e3){if(_0x1924e3){var _0x49febc=_0x1924e3['count'],_0xf4135b=_0x3094f3[_0xe381('0x17')],_0x588857=_0x3094f3[_0xe381('0x17')]+_0x3094f3[_0xe381('0x18')],_0x398e15;if(_0x588857>=_0x49febc){_0x588857=_0x49febc;_0x398e15=0xc8;}else{_0x398e15=0xce;}_0x564452[_0xe381('0x15')](_0x398e15);return _0x564452[_0xe381('0x19')]('Content-Range',_0xf4135b+'-'+_0x588857+'/'+_0x49febc)[_0xe381('0x16')](_0x1924e3);}return null;};}function patchUpdates(_0x37623e){return function(_0x242976){try{jsonpatch[_0xe381('0x1a')](_0x242976,_0x37623e,!![]);}catch(_0x2d3179){return BPromise[_0xe381('0x1b')](_0x2d3179);}return _0x242976['save']();};}function saveUpdates(_0xf4813f,_0x513ef0){return function(_0x466480){if(_0x466480){return _0x466480[_0xe381('0x1c')](_0xf4813f)[_0xe381('0x1d')](function(_0x197f10){return _0x197f10;});}return null;};}function removeEntity(_0x295ed7,_0x4e5c09){return function(_0x3acbdd){if(_0x3acbdd){return _0x3acbdd['destroy']()[_0xe381('0x1d')](function(){_0x295ed7[_0xe381('0x15')](0xcc)[_0xe381('0x14')]();});}};}function handleEntityNotFound(_0x3db835,_0x14039b){return function(_0x43c0af){if(!_0x43c0af){_0x3db835[_0xe381('0x13')](0x194);}return _0x43c0af;};}function handleError(_0x251017,_0x22713d){_0x22713d=_0x22713d||0x1f4;return function(_0x45b4ed){logger[_0xe381('0x1e')](_0x45b4ed['stack']);if(_0x45b4ed[_0xe381('0x1f')]){delete _0x45b4ed[_0xe381('0x1f')];}_0x251017[_0xe381('0x15')](_0x22713d)[_0xe381('0x20')](_0x45b4ed);};}exports[_0xe381('0x21')]=function(_0x1cc452,_0x3e7125){var _0x5ee9bf={},_0x339d35={},_0x4b76a8={'count':0x0,'rows':[]};var _0x8b303c=db[_0xe381('0x22')][_0xe381('0x23')];_0x339d35[_0xe381('0x24')]=_['keys'](_0x8b303c);var _0xa14de6={'dateStart':_0x1cc452[_0xe381('0x25')][_0xe381('0x26')],'dateEnd':_0x1cc452['query'][_0xe381('0x27')]};delete _0x1cc452['query'][_0xe381('0x26')];delete _0x1cc452['query'][_0xe381('0x27')];_0x339d35[_0xe381('0x25')]=_[_0xe381('0x28')](_0x1cc452[_0xe381('0x25')]);_0x339d35[_0xe381('0x29')]=_[_0xe381('0x2a')](_0x339d35[_0xe381('0x24')],_0x339d35[_0xe381('0x25')]);_0x5ee9bf[_0xe381('0x2b')]=_[_0xe381('0x2a')](_0x339d35[_0xe381('0x24')],qs[_0xe381('0x2c')](_0x1cc452[_0xe381('0x25')][_0xe381('0x2c')]));_0x5ee9bf[_0xe381('0x2b')]=_0x5ee9bf[_0xe381('0x2b')][_0xe381('0x2d')]?_0x5ee9bf[_0xe381('0x2b')]:_0x339d35[_0xe381('0x24')];if(!_0x1cc452[_0xe381('0x25')]['hasOwnProperty']('nolimit')){_0x5ee9bf['limit']=qs[_0xe381('0x18')](_0x1cc452[_0xe381('0x25')][_0xe381('0x18')]);_0x5ee9bf[_0xe381('0x17')]=qs[_0xe381('0x17')](_0x1cc452[_0xe381('0x25')][_0xe381('0x17')]);}_0x5ee9bf[_0xe381('0x2e')]=qs[_0xe381('0x2f')](_0x1cc452[_0xe381('0x25')]['sort']);_0x5ee9bf[_0xe381('0x30')]=qs[_0xe381('0x29')](_[_0xe381('0x31')](_0x1cc452[_0xe381('0x25')],_0x339d35['filters']));if(_0xa14de6[_0xe381('0x26')]){if(_0xa14de6[_0xe381('0x27')]){_0xa14de6[_0xe381('0x27')]=moment(_0xa14de6[_0xe381('0x27')])[_0xe381('0x32')](0x1,_0xe381('0x33'));}else{_0xa14de6[_0xe381('0x27')]=moment(_0xa14de6[_0xe381('0x26')])[_0xe381('0x32')](0x1,_0xe381('0x33'));}_[_0xe381('0x34')](_0x5ee9bf['where'],{'createdAt':{'$gte':_0xa14de6[_0xe381('0x26')],'$lte':_0xa14de6[_0xe381('0x27')]}});}if(_0x1cc452['query'][_0xe381('0x35')]){_0x5ee9bf['where']=_['merge'](_0x5ee9bf[_0xe381('0x30')],{'$or':_[_0xe381('0x36')](_0x5ee9bf[_0xe381('0x2b')],function(_0x14414a){var _0x3bf3b5={};_0x3bf3b5[_0x14414a]={'$like':'%'+_0x1cc452[_0xe381('0x25')][_0xe381('0x35')]+'%'};return _0x3bf3b5;})});}_0x5ee9bf=_[_0xe381('0x34')]({},_0x5ee9bf,_0x1cc452[_0xe381('0x37')]);var _0x38be83={'where':_0x5ee9bf[_0xe381('0x30')]};return db[_0xe381('0x22')][_0xe381('0x38')](_0x38be83)[_0xe381('0x1d')](function(_0x1962bd){_0x4b76a8[_0xe381('0x38')]=_0x1962bd;if(_0x1cc452[_0xe381('0x25')][_0xe381('0x39')]){_0x5ee9bf[_0xe381('0x3a')]=[{'all':!![]}];}return db[_0xe381('0x22')][_0xe381('0x3b')](_0x5ee9bf);})['then'](function(_0x4cf556){_0x4b76a8[_0xe381('0x3c')]=_0x4cf556;return _0x4b76a8;})['then'](respondWithFilteredResult(_0x3e7125,_0x5ee9bf))[_0xe381('0x3d')](handleError(_0x3e7125,null));};exports[_0xe381('0x3e')]=function(_0x30dadd,_0x1d61e9){var _0x174d6d={'raw':!![],'where':{'id':_0x30dadd[_0xe381('0x3f')]['id']}},_0x332a37={};_0x332a37[_0xe381('0x24')]=_[_0xe381('0x28')](db[_0xe381('0x22')]['rawAttributes']);_0x332a37[_0xe381('0x25')]=_['keys'](_0x30dadd[_0xe381('0x25')]);_0x332a37[_0xe381('0x29')]=_[_0xe381('0x2a')](_0x332a37[_0xe381('0x24')],_0x332a37[_0xe381('0x25')]);_0x174d6d['attributes']=_[_0xe381('0x2a')](_0x332a37[_0xe381('0x24')],qs[_0xe381('0x2c')](_0x30dadd['query'][_0xe381('0x2c')]));_0x174d6d['attributes']=_0x174d6d[_0xe381('0x2b')][_0xe381('0x2d')]?_0x174d6d[_0xe381('0x2b')]:_0x332a37['model'];if(_0x30dadd[_0xe381('0x25')][_0xe381('0x39')]){_0x174d6d[_0xe381('0x3a')]=[{'all':!![]}];}_0x174d6d=_[_0xe381('0x34')]({},_0x174d6d,_0x30dadd[_0xe381('0x37')]);return db[_0xe381('0x22')][_0xe381('0x40')](_0x174d6d)[_0xe381('0x1d')](handleEntityNotFound(_0x1d61e9,null))[_0xe381('0x1d')](respondWithResult(_0x1d61e9,null))[_0xe381('0x3d')](handleError(_0x1d61e9,null));};exports[_0xe381('0x41')]=function(_0xab7c08,_0x16fe87){return db['SugarcrmField'][_0xe381('0x41')](_0xab7c08[_0xe381('0x42')],{})['then'](respondWithResult(_0x16fe87,0xc9))[_0xe381('0x3d')](handleError(_0x16fe87,null));};exports[_0xe381('0x1c')]=function(_0x4985a7,_0x1154a8){if(_0x4985a7[_0xe381('0x42')]['id']){delete _0x4985a7['body']['id'];}return db[_0xe381('0x22')][_0xe381('0x40')]({'where':{'id':_0x4985a7[_0xe381('0x3f')]['id']}})[_0xe381('0x1d')](handleEntityNotFound(_0x1154a8,null))[_0xe381('0x1d')](saveUpdates(_0x4985a7[_0xe381('0x42')],null))[_0xe381('0x1d')](respondWithResult(_0x1154a8,null))['catch'](handleError(_0x1154a8,null));};exports[_0xe381('0x43')]=function(_0x12c8cf,_0x1fcecd){return db['SugarcrmField'][_0xe381('0x40')]({'where':{'id':_0x12c8cf['params']['id']}})[_0xe381('0x1d')](handleEntityNotFound(_0x1fcecd,null))[_0xe381('0x1d')](removeEntity(_0x1fcecd,null))[_0xe381('0x3d')](handleError(_0x1fcecd,null));}; \ No newline at end of file +var _0x0701=['set','json','apply','reject','save','destroy','then','stack','name','send','index','SugarcrmField','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','where','day','add','merge','filter','map','options','includeAll','include','rows','catch','create','body','update','find','params','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','end','status','count','limit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0701,0x166));var _0x1070=function(_0x40ee66,_0x380c45){_0x40ee66=_0x40ee66-0x0;var _0x2ce75f=_0x0701[_0x40ee66];return _0x2ce75f;};'use strict';var jsonpatch=require(_0x1070('0x0'));var rp=require(_0x1070('0x1'));var moment=require('moment');var BPromise=require(_0x1070('0x2'));var Mustache=require(_0x1070('0x3'));var util=require(_0x1070('0x4'));var path=require(_0x1070('0x5'));var sox=require(_0x1070('0x6'));var csv=require(_0x1070('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1070('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1070('0x9'));var toCsv=require(_0x1070('0x7'));var querystring=require('querystring');var Papa=require(_0x1070('0xa'));var qs=require(_0x1070('0xb'));var logger=require(_0x1070('0xc'))(_0x1070('0xd'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x1070('0xe'))['db'];function respondWithStatusCode(_0x1b3ebc,_0x4ac132){_0x4ac132=_0x4ac132||0xcc;return function(_0x1e752c){if(_0x1e752c){return _0x1b3ebc[_0x1070('0xf')](_0x4ac132);}return _0x1b3ebc['status'](_0x4ac132)[_0x1070('0x10')]();};}function respondWithResult(_0x1ce2df,_0x3e27b2){_0x3e27b2=_0x3e27b2||0xc8;return function(_0x216f33){if(_0x216f33){return _0x1ce2df[_0x1070('0x11')](_0x3e27b2)['json'](_0x216f33);}};}function respondWithFilteredResult(_0x128ed8,_0x536416){return function(_0x4dbd79){if(_0x4dbd79){var _0x5af992=_0x4dbd79[_0x1070('0x12')],_0x19070e=_0x536416['offset'],_0x40edf5=_0x536416['offset']+_0x536416[_0x1070('0x13')],_0x4270f3;if(_0x40edf5>=_0x5af992){_0x40edf5=_0x5af992;_0x4270f3=0xc8;}else{_0x4270f3=0xce;}_0x128ed8[_0x1070('0x11')](_0x4270f3);return _0x128ed8[_0x1070('0x14')]('Content-Range',_0x19070e+'-'+_0x40edf5+'/'+_0x5af992)[_0x1070('0x15')](_0x4dbd79);}return null;};}function patchUpdates(_0xec4621){return function(_0x57ec8d){try{jsonpatch[_0x1070('0x16')](_0x57ec8d,_0xec4621,!![]);}catch(_0x18750d){return BPromise[_0x1070('0x17')](_0x18750d);}return _0x57ec8d[_0x1070('0x18')]();};}function saveUpdates(_0x395d51,_0x5cabe8){return function(_0x18093d){if(_0x18093d){return _0x18093d['update'](_0x395d51)['then'](function(_0x59fa51){return _0x59fa51;});}return null;};}function removeEntity(_0x281099,_0x19b38a){return function(_0x52b459){if(_0x52b459){return _0x52b459[_0x1070('0x19')]()[_0x1070('0x1a')](function(){_0x281099['status'](0xcc)[_0x1070('0x10')]();});}};}function handleEntityNotFound(_0x2d3ae1,_0x259d54){return function(_0x46659c){if(!_0x46659c){_0x2d3ae1[_0x1070('0xf')](0x194);}return _0x46659c;};}function handleError(_0x11c30a,_0x449a8d){_0x449a8d=_0x449a8d||0x1f4;return function(_0x4fb1d8){logger['error'](_0x4fb1d8[_0x1070('0x1b')]);if(_0x4fb1d8['name']){delete _0x4fb1d8[_0x1070('0x1c')];}_0x11c30a[_0x1070('0x11')](_0x449a8d)[_0x1070('0x1d')](_0x4fb1d8);};}exports[_0x1070('0x1e')]=function(_0x78bf61,_0x13a6b3){var _0x5134bc={},_0x31593e={},_0x336865={'count':0x0,'rows':[]};var _0x189f8e=db[_0x1070('0x1f')][_0x1070('0x20')];_0x31593e[_0x1070('0x21')]=_[_0x1070('0x22')](_0x189f8e);var _0x233088={'dateStart':_0x78bf61[_0x1070('0x23')]['dateStart'],'dateEnd':_0x78bf61[_0x1070('0x23')][_0x1070('0x24')]};delete _0x78bf61[_0x1070('0x23')][_0x1070('0x25')];delete _0x78bf61[_0x1070('0x23')][_0x1070('0x24')];_0x31593e[_0x1070('0x23')]=_['keys'](_0x78bf61['query']);_0x31593e[_0x1070('0x26')]=_['intersection'](_0x31593e['model'],_0x31593e[_0x1070('0x23')]);_0x5134bc['attributes']=_[_0x1070('0x27')](_0x31593e[_0x1070('0x21')],qs[_0x1070('0x28')](_0x78bf61[_0x1070('0x23')][_0x1070('0x28')]));_0x5134bc['attributes']=_0x5134bc[_0x1070('0x29')][_0x1070('0x2a')]?_0x5134bc[_0x1070('0x29')]:_0x31593e[_0x1070('0x21')];if(!_0x78bf61[_0x1070('0x23')][_0x1070('0x2b')](_0x1070('0x2c'))){_0x5134bc['limit']=qs['limit'](_0x78bf61[_0x1070('0x23')][_0x1070('0x13')]);_0x5134bc[_0x1070('0x2d')]=qs[_0x1070('0x2d')](_0x78bf61[_0x1070('0x23')][_0x1070('0x2d')]);}_0x5134bc['order']=qs[_0x1070('0x2e')](_0x78bf61[_0x1070('0x23')][_0x1070('0x2e')]);_0x5134bc[_0x1070('0x2f')]=qs[_0x1070('0x26')](_['pick'](_0x78bf61[_0x1070('0x23')],_0x31593e[_0x1070('0x26')]));if(_0x233088[_0x1070('0x25')]){if(_0x233088['dateEnd']){_0x233088['dateEnd']=moment(_0x233088[_0x1070('0x24')])['add'](0x1,_0x1070('0x30'));}else{_0x233088[_0x1070('0x24')]=moment(_0x233088[_0x1070('0x25')])[_0x1070('0x31')](0x1,_0x1070('0x30'));}_[_0x1070('0x32')](_0x5134bc[_0x1070('0x2f')],{'createdAt':{'$gte':_0x233088['dateStart'],'$lte':_0x233088[_0x1070('0x24')]}});}if(_0x78bf61['query'][_0x1070('0x33')]){_0x5134bc[_0x1070('0x2f')]=_[_0x1070('0x32')](_0x5134bc[_0x1070('0x2f')],{'$or':_[_0x1070('0x34')](_0x5134bc[_0x1070('0x29')],function(_0x596289){var _0x377156={};_0x377156[_0x596289]={'$like':'%'+_0x78bf61[_0x1070('0x23')][_0x1070('0x33')]+'%'};return _0x377156;})});}_0x5134bc=_[_0x1070('0x32')]({},_0x5134bc,_0x78bf61[_0x1070('0x35')]);var _0x1b7c5a={'where':_0x5134bc[_0x1070('0x2f')]};return db['SugarcrmField']['count'](_0x1b7c5a)[_0x1070('0x1a')](function(_0x5c6c11){_0x336865[_0x1070('0x12')]=_0x5c6c11;if(_0x78bf61[_0x1070('0x23')][_0x1070('0x36')]){_0x5134bc[_0x1070('0x37')]=[{'all':!![]}];}return db[_0x1070('0x1f')]['findAll'](_0x5134bc);})[_0x1070('0x1a')](function(_0x1a9edb){_0x336865[_0x1070('0x38')]=_0x1a9edb;return _0x336865;})['then'](respondWithFilteredResult(_0x13a6b3,_0x5134bc))[_0x1070('0x39')](handleError(_0x13a6b3,null));};exports['show']=function(_0x48f8b8,_0x6613c8){var _0x3b9ff9={'raw':!![],'where':{'id':_0x48f8b8['params']['id']}},_0x85cb42={};_0x85cb42['model']=_['keys'](db[_0x1070('0x1f')][_0x1070('0x20')]);_0x85cb42[_0x1070('0x23')]=_[_0x1070('0x22')](_0x48f8b8[_0x1070('0x23')]);_0x85cb42[_0x1070('0x26')]=_[_0x1070('0x27')](_0x85cb42['model'],_0x85cb42[_0x1070('0x23')]);_0x3b9ff9[_0x1070('0x29')]=_[_0x1070('0x27')](_0x85cb42[_0x1070('0x21')],qs[_0x1070('0x28')](_0x48f8b8[_0x1070('0x23')][_0x1070('0x28')]));_0x3b9ff9['attributes']=_0x3b9ff9['attributes'][_0x1070('0x2a')]?_0x3b9ff9[_0x1070('0x29')]:_0x85cb42[_0x1070('0x21')];if(_0x48f8b8['query'][_0x1070('0x36')]){_0x3b9ff9['include']=[{'all':!![]}];}_0x3b9ff9=_[_0x1070('0x32')]({},_0x3b9ff9,_0x48f8b8[_0x1070('0x35')]);return db[_0x1070('0x1f')]['find'](_0x3b9ff9)[_0x1070('0x1a')](handleEntityNotFound(_0x6613c8,null))[_0x1070('0x1a')](respondWithResult(_0x6613c8,null))[_0x1070('0x39')](handleError(_0x6613c8,null));};exports[_0x1070('0x3a')]=function(_0x472560,_0x3b999e){return db['SugarcrmField']['create'](_0x472560[_0x1070('0x3b')],{})[_0x1070('0x1a')](respondWithResult(_0x3b999e,0xc9))[_0x1070('0x39')](handleError(_0x3b999e,null));};exports[_0x1070('0x3c')]=function(_0x35f60a,_0x35bc28){if(_0x35f60a['body']['id']){delete _0x35f60a[_0x1070('0x3b')]['id'];}return db[_0x1070('0x1f')][_0x1070('0x3d')]({'where':{'id':_0x35f60a[_0x1070('0x3e')]['id']}})[_0x1070('0x1a')](handleEntityNotFound(_0x35bc28,null))['then'](saveUpdates(_0x35f60a[_0x1070('0x3b')],null))[_0x1070('0x1a')](respondWithResult(_0x35bc28,null))['catch'](handleError(_0x35bc28,null));};exports['destroy']=function(_0x54db63,_0xe862bb){return db[_0x1070('0x1f')][_0x1070('0x3d')]({'where':{'id':_0x54db63[_0x1070('0x3e')]['id']}})[_0x1070('0x1a')](handleEntityNotFound(_0xe862bb,null))[_0x1070('0x1a')](removeEntity(_0xe862bb,null))[_0x1070('0x39')](handleError(_0xe862bb,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 3a20753..5ecbbf6 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 _0x63d6=['exports','define','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x532b64,_0x19811f){var _0x27a875=function(_0x45998d){while(--_0x45998d){_0x532b64['push'](_0x532b64['shift']());}};_0x27a875(++_0x19811f);}(_0x63d6,0x17a));var _0x663d=function(_0x14ee98,_0x3fe42f){_0x14ee98=_0x14ee98-0x0;var _0x4d16c0=_0x63d6[_0x14ee98];return _0x4d16c0;};'use strict';var _=require('lodash');var util=require(_0x663d('0x0'));var logger=require(_0x663d('0x1'))(_0x663d('0x2'));var moment=require(_0x663d('0x3'));var BPromise=require(_0x663d('0x4'));var rp=require(_0x663d('0x5'));var attributes=require('./intSugarcrmField.attributes');module[_0x663d('0x6')]=function(_0x2ce437,_0x24cc9c){return _0x2ce437[_0x663d('0x7')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbc8=['../../config/logger','api','moment','bluebird','request-promise','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields'];(function(_0x2abd38,_0x326694){var _0xc53434=function(_0x2a34f3){while(--_0x2a34f3){_0x2abd38['push'](_0x2abd38['shift']());}};_0xc53434(++_0x326694);}(_0xfbc8,0x168));var _0x8fbc=function(_0x4649c4,_0x4c8c1a){_0x4649c4=_0x4649c4-0x0;var _0x4166e2=_0xfbc8[_0x4649c4];return _0x4166e2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8fbc('0x0'))(_0x8fbc('0x1'));var moment=require(_0x8fbc('0x2'));var BPromise=require(_0x8fbc('0x3'));var rp=require(_0x8fbc('0x4'));var attributes=require(_0x8fbc('0x5'));module[_0x8fbc('0x6')]=function(_0x3d481f,_0x5c3e5b){return _0x3d481f[_0x8fbc('0x7')]('SugarcrmField',attributes,{'tableName':_0x8fbc('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 8a557ea..d041d0b 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 _0x4428=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x3b1899,_0x3d2575){var _0x505d4b=function(_0x124679){while(--_0x124679){_0x3b1899['push'](_0x3b1899['shift']());}};_0x505d4b(++_0x3d2575);}(_0x4428,0x65));var _0x8442=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x4428[_0x2dadb9];return _0x2f0097;};'use strict';var _=require('lodash');var util=require(_0x8442('0x0'));var moment=require(_0x8442('0x1'));var BPromise=require(_0x8442('0x2'));var rs=require(_0x8442('0x3'));var fs=require('fs');var db=require(_0x8442('0x4'))['db'];var utils=require(_0x8442('0x5'));var logger=require(_0x8442('0x6'))(_0x8442('0x7'));var config=require(_0x8442('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8442('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e6971,_0xfb4e24,_0x14bb42){return new BPromise(function(_0x65c70c,_0x188f9f){return client[_0x8442('0xa')](_0x4e6971,_0x14bb42)[_0x8442('0xb')](function(_0x21fd7b){logger[_0x8442('0xc')](_0x8442('0xd'),_0xfb4e24,_0x8442('0xe'));logger[_0x8442('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0xfb4e24,'request\x20sent',JSON['stringify'](_0x21fd7b));if(_0x21fd7b['error']){if(_0x21fd7b['error'][_0x8442('0x10')]===0x1f4){logger[_0x8442('0x11')]('SugarcrmField,\x20%s,\x20%s',_0xfb4e24,_0x21fd7b[_0x8442('0x11')][_0x8442('0x12')]);return _0x188f9f(_0x21fd7b[_0x8442('0x11')][_0x8442('0x12')]);}logger[_0x8442('0x11')](_0x8442('0xd'),_0xfb4e24,_0x21fd7b[_0x8442('0x11')][_0x8442('0x12')]);return _0x65c70c(_0x21fd7b[_0x8442('0x11')][_0x8442('0x12')]);}else{logger['info'](_0x8442('0xd'),_0xfb4e24,_0x8442('0xe'));_0x65c70c(_0x21fd7b[_0x8442('0x13')]['message']);}})[_0x8442('0x14')](function(_0x280664){logger[_0x8442('0x11')](_0x8442('0xd'),_0xfb4e24,_0x280664);_0x188f9f(_0x280664);});});} \ No newline at end of file +var _0x9217=['message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x9217,0x143));var _0x7921=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9217[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7921('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7921('0x1'));var rs=require(_0x7921('0x2'));var fs=require('fs');var db=require(_0x7921('0x3'))['db'];var utils=require(_0x7921('0x4'));var logger=require(_0x7921('0x5'))(_0x7921('0x6'));var config=require(_0x7921('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7921('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e1462,_0x619a80,_0x59cebc){return new BPromise(function(_0x32be7f,_0xaac819){return client['request'](_0x2e1462,_0x59cebc)[_0x7921('0x9')](function(_0x5f1283){logger[_0x7921('0xa')](_0x7921('0xb'),_0x619a80,_0x7921('0xc'));logger[_0x7921('0xd')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x619a80,_0x7921('0xc'),JSON[_0x7921('0xe')](_0x5f1283));if(_0x5f1283[_0x7921('0xf')]){if(_0x5f1283['error'][_0x7921('0x10')]===0x1f4){logger[_0x7921('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x619a80,_0x5f1283[_0x7921('0xf')]['message']);return _0xaac819(_0x5f1283[_0x7921('0xf')][_0x7921('0x11')]);}logger[_0x7921('0xf')](_0x7921('0xb'),_0x619a80,_0x5f1283['error'][_0x7921('0x11')]);return _0x32be7f(_0x5f1283[_0x7921('0xf')][_0x7921('0x11')]);}else{logger[_0x7921('0xa')](_0x7921('0xb'),_0x619a80,_0x7921('0xc'));_0x32be7f(_0x5f1283[_0x7921('0x12')][_0x7921('0x11')]);}})[_0x7921('0x13')](function(_0x5932fb){logger[_0x7921('0xf')](_0x7921('0xb'),_0x619a80,_0x5932fb);_0xaac819(_0x5932fb);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index f2ecc88..33279da 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 _0xcb68=['../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','util','path','express','Router'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xcb68,0x104));var _0x8cb6=function(_0x10c8e1,_0x5eeec7){_0x10c8e1=_0x10c8e1-0x0;var _0x43ace6=_0xcb68[_0x10c8e1];return _0x43ace6;};'use strict';var multer=require('multer');var util=require(_0x8cb6('0x0'));var path=require(_0x8cb6('0x1'));var express=require(_0x8cb6('0x2'));var router=express[_0x8cb6('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8cb6('0x4'));var config=require(_0x8cb6('0x5'));var controller=require(_0x8cb6('0x6'));router[_0x8cb6('0x7')]('/',auth[_0x8cb6('0x8')](),controller[_0x8cb6('0x9')]);router[_0x8cb6('0x7')](_0x8cb6('0xa'),auth[_0x8cb6('0x8')](),controller['show']);router['get'](_0x8cb6('0xb'),auth['isAuthenticated'](),controller[_0x8cb6('0xc')]);router[_0x8cb6('0x7')](_0x8cb6('0xd'),auth[_0x8cb6('0x8')](),controller[_0x8cb6('0xe')]);router[_0x8cb6('0xf')]('/',auth[_0x8cb6('0x8')](),controller[_0x8cb6('0x10')]);router[_0x8cb6('0xf')](_0x8cb6('0xb'),auth[_0x8cb6('0x8')](),controller['addConfiguration']);router[_0x8cb6('0x11')](_0x8cb6('0xa'),auth[_0x8cb6('0x8')](),controller[_0x8cb6('0x12')]);router[_0x8cb6('0x13')](_0x8cb6('0xa'),auth[_0x8cb6('0x8')](),controller[_0x8cb6('0x14')]);module[_0x8cb6('0x15')]=router; \ No newline at end of file +var _0xaeda=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer'];(function(_0x23e239,_0x124280){var _0x574d22=function(_0x5475c2){while(--_0x5475c2){_0x23e239['push'](_0x23e239['shift']());}};_0x574d22(++_0x124280);}(_0xaeda,0x1b4));var _0xaaed=function(_0x4f9bb8,_0x1b0060){_0x4f9bb8=_0x4f9bb8-0x0;var _0x6f8be2=_0xaeda[_0x4f9bb8];return _0x6f8be2;};'use strict';var multer=require(_0xaaed('0x0'));var util=require('util');var path=require('path');var express=require(_0xaaed('0x1'));var router=express[_0xaaed('0x2')]();var auth=require(_0xaaed('0x3'));var interaction=require(_0xaaed('0x4'));var config=require(_0xaaed('0x5'));var controller=require('./intVtigerAccount.controller');router[_0xaaed('0x6')]('/',auth[_0xaaed('0x7')](),controller[_0xaaed('0x8')]);router[_0xaaed('0x6')](_0xaaed('0x9'),auth[_0xaaed('0x7')](),controller[_0xaaed('0xa')]);router[_0xaaed('0x6')](_0xaaed('0xb'),auth[_0xaaed('0x7')](),controller[_0xaaed('0xc')]);router['get'](_0xaaed('0xd'),auth[_0xaaed('0x7')](),controller[_0xaaed('0xe')]);router[_0xaaed('0xf')]('/',auth[_0xaaed('0x7')](),controller[_0xaaed('0x10')]);router['post'](_0xaaed('0xb'),auth[_0xaaed('0x7')](),controller[_0xaaed('0x11')]);router[_0xaaed('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xaaed('0x13')]);router[_0xaaed('0x14')](_0xaaed('0x9'),auth[_0xaaed('0x7')](),controller[_0xaaed('0x15')]);module[_0xaaed('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 47ced82..11b0310 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 _0xa932=['exports','STRING','HelpDesk','sequelize'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xa932,0xbb));var _0x2a93=function(_0x36665f,_0x4f9488){_0x36665f=_0x36665f-0x0;var _0x481d25=_0xa932[_0x36665f];return _0x481d25;};'use strict';var Sequelize=require(_0x2a93('0x0'));module[_0x2a93('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x2a93('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x2a93('0x2')],'allowNull':![],'defaultValue':_0x2a93('0x3')},'remoteUri':{'type':Sequelize[_0x2a93('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x2a93('0x2')]},'accessKey':{'type':Sequelize[_0x2a93('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x9e49=['exports','STRING','sequelize'];(function(_0x2e359f,_0x299664){var _0x1ba85d=function(_0x51affc){while(--_0x51affc){_0x2e359f['push'](_0x2e359f['shift']());}};_0x1ba85d(++_0x299664);}(_0x9e49,0xe6));var _0x99e4=function(_0x1ab57d,_0x135ad1){_0x1ab57d=_0x1ab57d-0x0;var _0x349faa=_0x9e49[_0x1ab57d];return _0x349faa;};'use strict';var Sequelize=require(_0x99e4('0x0'));module[_0x99e4('0x1')]={'name':{'type':Sequelize[_0x99e4('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x99e4('0x2')]},'username':{'type':Sequelize[_0x99e4('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x99e4('0x2')]},'accessKey':{'type':Sequelize[_0x99e4('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index e327559..45e8638 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 _0xffdc=['value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','end','status','json','count','offset','set','Content-Range','apply','reject','save','destroy','name','send','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','merge','filter','map','options','VtigerAccount','includeAll','include','findAll','rows','show','params','filters','find','create','body','update','getConfigurations','findOne','VtigerConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','VtigerField','getFields','description','moduleName','remoteUri','serverUrl','accessKey','username','format','GET','getchallenge','success','token','describe','sessionName','autogenerated','owner','remove','editable','false','label','startsWith','cf_','picklist','picklistValues'];(function(_0x478098,_0x4d9d5a){var _0x48da53=function(_0x4477ea){while(--_0x4477ea){_0x478098['push'](_0x478098['shift']());}};_0x48da53(++_0x4d9d5a);}(_0xffdc,0x7f));var _0xcffd=function(_0x274394,_0x6fd912){_0x274394=_0x274394-0x0;var _0x2a2773=_0xffdc[_0x274394];return _0x2a2773;};'use strict';var jsonpatch=require(_0xcffd('0x0'));var rp=require(_0xcffd('0x1'));var moment=require('moment');var BPromise=require(_0xcffd('0x2'));var Mustache=require(_0xcffd('0x3'));var util=require('util');var path=require(_0xcffd('0x4'));var sox=require(_0xcffd('0x5'));var csv=require(_0xcffd('0x6'));var ejs=require(_0xcffd('0x7'));var fs=require('fs');var _=require(_0xcffd('0x8'));var squel=require('squel');var crypto=require(_0xcffd('0x9'));var jsforce=require(_0xcffd('0xa'));var deskjs=require(_0xcffd('0xb'));var toCsv=require(_0xcffd('0x6'));var querystring=require(_0xcffd('0xc'));var Papa=require(_0xcffd('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0xcffd('0xe'))(_0xcffd('0xf'));var utils=require('../../config/utils');var config=require(_0xcffd('0x10'));var db=require(_0xcffd('0x11'))['db'];var integrations=require(_0xcffd('0x12'));var jayson=require('jayson/promise');var client=jayson[_0xcffd('0x13')][_0xcffd('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x1f6494,_0x457c9b,_0x4cb73e,_0x55a51a){return new BPromise(function(_0x1d010a,_0x187ca8){var _0x1340b0=_0x55a51a||client;return _0x1340b0['request'](_0x1f6494,_0x4cb73e)[_0xcffd('0x15')](function(_0x4dcb59){logger['info'](_0xcffd('0x16'),_0x457c9b,_0xcffd('0x17'));logger['debug'](_0xcffd('0x18'),_0x457c9b,_0xcffd('0x17'),JSON[_0xcffd('0x19')](_0x4dcb59));if(_0x4dcb59[_0xcffd('0x1a')]){if(_0x4dcb59['error']['code']===0x1f4){logger[_0xcffd('0x1a')](_0xcffd('0x16'),_0x457c9b,_0x4dcb59[_0xcffd('0x1a')][_0xcffd('0x1b')]);return _0x187ca8(_0x4dcb59[_0xcffd('0x1a')]['message']);}logger[_0xcffd('0x1a')]('VtigerAccount,\x20%s,\x20%s',_0x457c9b,_0x4dcb59[_0xcffd('0x1a')][_0xcffd('0x1b')]);return _0x1d010a(_0x4dcb59[_0xcffd('0x1a')][_0xcffd('0x1b')]);}else{logger[_0xcffd('0x1c')](_0xcffd('0x16'),_0x457c9b,_0xcffd('0x17'));_0x1d010a(_0x4dcb59[_0xcffd('0x1d')]['message']);}})[_0xcffd('0x1e')](function(_0x1f36f4){logger[_0xcffd('0x1a')](_0xcffd('0x16'),_0x457c9b,_0x1f36f4);_0x187ca8(_0x1f36f4);});});}function respondWithStatusCode(_0x44f32d,_0x17c273){_0x17c273=_0x17c273||0xcc;return function(_0x1ad69f){if(_0x1ad69f){return _0x44f32d['sendStatus'](_0x17c273);}return _0x44f32d['status'](_0x17c273)[_0xcffd('0x1f')]();};}function respondWithResult(_0x2fa778,_0x44f901){_0x44f901=_0x44f901||0xc8;return function(_0x3935ff){if(_0x3935ff){return _0x2fa778[_0xcffd('0x20')](_0x44f901)[_0xcffd('0x21')](_0x3935ff);}};}function respondWithFilteredResult(_0x2723db,_0x2ea762){return function(_0x2162a6){if(_0x2162a6){var _0x19e0d9=_0x2162a6[_0xcffd('0x22')],_0x37185d=_0x2ea762[_0xcffd('0x23')],_0x1f232a=_0x2ea762[_0xcffd('0x23')]+_0x2ea762['limit'],_0x544ae7;if(_0x1f232a>=_0x19e0d9){_0x1f232a=_0x19e0d9;_0x544ae7=0xc8;}else{_0x544ae7=0xce;}_0x2723db[_0xcffd('0x20')](_0x544ae7);return _0x2723db[_0xcffd('0x24')](_0xcffd('0x25'),_0x37185d+'-'+_0x1f232a+'/'+_0x19e0d9)['json'](_0x2162a6);}return null;};}function patchUpdates(_0x4f0078){return function(_0x214271){try{jsonpatch[_0xcffd('0x26')](_0x214271,_0x4f0078,!![]);}catch(_0x4b1c7d){return BPromise[_0xcffd('0x27')](_0x4b1c7d);}return _0x214271[_0xcffd('0x28')]();};}function saveUpdates(_0x5a97cf,_0x3f46ea){return function(_0x3ab051){if(_0x3ab051){return _0x3ab051['update'](_0x5a97cf)['then'](function(_0x3a9634){return _0x3a9634;});}return null;};}function removeEntity(_0x1c40fb,_0x318cdf){return function(_0x5eea07){if(_0x5eea07){return _0x5eea07[_0xcffd('0x29')]()[_0xcffd('0x15')](function(){_0x1c40fb['status'](0xcc)[_0xcffd('0x1f')]();});}};}function handleEntityNotFound(_0xd2a94,_0x567ca7){return function(_0x4216e2){if(!_0x4216e2){_0xd2a94['sendStatus'](0x194);}return _0x4216e2;};}function handleError(_0x3547f0,_0x19d3ca){_0x19d3ca=_0x19d3ca||0x1f4;return function(_0x481c36){logger[_0xcffd('0x1a')](_0x481c36['stack']);if(_0x481c36['name']){delete _0x481c36[_0xcffd('0x2a')];}_0x3547f0[_0xcffd('0x20')](_0x19d3ca)[_0xcffd('0x2b')](_0x481c36);};}exports['index']=function(_0x4c9fcf,_0x7ab8be){var _0x434cfb={},_0x4dd5c0={},_0x50c2f6={'count':0x0,'rows':[]};var _0x3e2888=db['VtigerAccount'][_0xcffd('0x2c')];_0x4dd5c0[_0xcffd('0x2d')]=_[_0xcffd('0x2e')](_0x3e2888);var _0x40a6d3={'dateStart':_0x4c9fcf[_0xcffd('0x2f')][_0xcffd('0x30')],'dateEnd':_0x4c9fcf['query'][_0xcffd('0x31')]};delete _0x4c9fcf[_0xcffd('0x2f')][_0xcffd('0x30')];delete _0x4c9fcf[_0xcffd('0x2f')][_0xcffd('0x31')];_0x4dd5c0[_0xcffd('0x2f')]=_['keys'](_0x4c9fcf[_0xcffd('0x2f')]);_0x4dd5c0['filters']=_[_0xcffd('0x32')](_0x4dd5c0['model'],_0x4dd5c0[_0xcffd('0x2f')]);_0x434cfb[_0xcffd('0x33')]=_[_0xcffd('0x32')](_0x4dd5c0[_0xcffd('0x2d')],qs[_0xcffd('0x34')](_0x4c9fcf[_0xcffd('0x2f')][_0xcffd('0x34')]));_0x434cfb['attributes']=_0x434cfb[_0xcffd('0x33')][_0xcffd('0x35')]?_0x434cfb[_0xcffd('0x33')]:_0x4dd5c0['model'];if(!_0x4c9fcf[_0xcffd('0x2f')][_0xcffd('0x36')](_0xcffd('0x37'))){_0x434cfb['limit']=qs['limit'](_0x4c9fcf['query'][_0xcffd('0x38')]);_0x434cfb[_0xcffd('0x23')]=qs[_0xcffd('0x23')](_0x4c9fcf['query'][_0xcffd('0x23')]);}_0x434cfb[_0xcffd('0x39')]=qs[_0xcffd('0x3a')](_0x4c9fcf[_0xcffd('0x2f')][_0xcffd('0x3a')]);_0x434cfb[_0xcffd('0x3b')]=qs['filters'](_[_0xcffd('0x3c')](_0x4c9fcf[_0xcffd('0x2f')],_0x4dd5c0['filters']));if(_0x40a6d3[_0xcffd('0x30')]){if(_0x40a6d3[_0xcffd('0x31')]){_0x40a6d3['dateEnd']=moment(_0x40a6d3[_0xcffd('0x31')])[_0xcffd('0x3d')](0x1,_0xcffd('0x3e'));}else{_0x40a6d3[_0xcffd('0x31')]=moment(_0x40a6d3[_0xcffd('0x30')])[_0xcffd('0x3d')](0x1,_0xcffd('0x3e'));}_[_0xcffd('0x3f')](_0x434cfb[_0xcffd('0x3b')],{'createdAt':{'$gte':_0x40a6d3[_0xcffd('0x30')],'$lte':_0x40a6d3['dateEnd']}});}if(_0x4c9fcf[_0xcffd('0x2f')][_0xcffd('0x40')]){_0x434cfb['where']=_['merge'](_0x434cfb[_0xcffd('0x3b')],{'$or':_[_0xcffd('0x41')](_0x434cfb[_0xcffd('0x33')],function(_0x14be8a){var _0x447c36={};_0x447c36[_0x14be8a]={'$like':'%'+_0x4c9fcf['query']['filter']+'%'};return _0x447c36;})});}_0x434cfb=_['merge']({},_0x434cfb,_0x4c9fcf[_0xcffd('0x42')]);var _0x432bfe={'where':_0x434cfb[_0xcffd('0x3b')]};return db[_0xcffd('0x43')][_0xcffd('0x22')](_0x432bfe)[_0xcffd('0x15')](function(_0x2b655e){_0x50c2f6[_0xcffd('0x22')]=_0x2b655e;if(_0x4c9fcf[_0xcffd('0x2f')][_0xcffd('0x44')]){_0x434cfb[_0xcffd('0x45')]=[{'all':!![]}];}return db[_0xcffd('0x43')][_0xcffd('0x46')](_0x434cfb);})[_0xcffd('0x15')](function(_0x52f2cd){_0x50c2f6[_0xcffd('0x47')]=_0x52f2cd;return _0x50c2f6;})['then'](respondWithFilteredResult(_0x7ab8be,_0x434cfb))['catch'](handleError(_0x7ab8be,null));};exports[_0xcffd('0x48')]=function(_0x54dea5,_0x6e3701){var _0x42b396={'raw':![],'where':{'id':_0x54dea5[_0xcffd('0x49')]['id']}},_0x589e6c={};_0x589e6c[_0xcffd('0x2d')]=_[_0xcffd('0x2e')](db[_0xcffd('0x43')][_0xcffd('0x2c')]);_0x589e6c['query']=_[_0xcffd('0x2e')](_0x54dea5[_0xcffd('0x2f')]);_0x589e6c[_0xcffd('0x4a')]=_[_0xcffd('0x32')](_0x589e6c[_0xcffd('0x2d')],_0x589e6c[_0xcffd('0x2f')]);_0x42b396[_0xcffd('0x33')]=_['intersection'](_0x589e6c['model'],qs['fields'](_0x54dea5['query']['fields']));_0x42b396[_0xcffd('0x33')]=_0x42b396['attributes']['length']?_0x42b396[_0xcffd('0x33')]:_0x589e6c[_0xcffd('0x2d')];if(_0x54dea5[_0xcffd('0x2f')][_0xcffd('0x44')]){_0x42b396[_0xcffd('0x45')]=[{'all':!![]}];}_0x42b396=_[_0xcffd('0x3f')]({},_0x42b396,_0x54dea5[_0xcffd('0x42')]);return db[_0xcffd('0x43')][_0xcffd('0x4b')](_0x42b396)[_0xcffd('0x15')](handleEntityNotFound(_0x6e3701,null))[_0xcffd('0x15')](respondWithResult(_0x6e3701,null))[_0xcffd('0x1e')](handleError(_0x6e3701,null));};exports[_0xcffd('0x4c')]=function(_0x255fc1,_0x177e7b){return db['VtigerAccount'][_0xcffd('0x4c')](_0x255fc1[_0xcffd('0x4d')],{})[_0xcffd('0x15')](respondWithResult(_0x177e7b,0xc9))[_0xcffd('0x1e')](handleError(_0x177e7b,null));};exports[_0xcffd('0x4e')]=function(_0x32389e,_0x36d275){if(_0x32389e[_0xcffd('0x4d')]['id']){delete _0x32389e[_0xcffd('0x4d')]['id'];}return db[_0xcffd('0x43')][_0xcffd('0x4b')]({'where':{'id':_0x32389e[_0xcffd('0x49')]['id']}})[_0xcffd('0x15')](handleEntityNotFound(_0x36d275,null))[_0xcffd('0x15')](saveUpdates(_0x32389e[_0xcffd('0x4d')],null))[_0xcffd('0x15')](respondWithResult(_0x36d275,null))[_0xcffd('0x1e')](handleError(_0x36d275,null));};exports['destroy']=function(_0x7f0a57,_0x35caa5){return db['VtigerAccount']['find']({'where':{'id':_0x7f0a57[_0xcffd('0x49')]['id']}})[_0xcffd('0x15')](handleEntityNotFound(_0x35caa5,null))['then'](removeEntity(_0x35caa5,null))[_0xcffd('0x1e')](handleError(_0x35caa5,null));};exports[_0xcffd('0x4f')]=function(_0x1d4c10,_0x5eec57,_0x335cee){var _0x36e991={};var _0x304706={};var _0x440af8;var _0x236818;return db[_0xcffd('0x43')][_0xcffd('0x50')]({'where':{'id':_0x1d4c10[_0xcffd('0x49')]['id']}})[_0xcffd('0x15')](handleEntityNotFound(_0x5eec57,null))[_0xcffd('0x15')](function(_0xa9aa45){if(_0xa9aa45){_0x440af8=_0xa9aa45;_0x304706[_0xcffd('0x2d')]=_[_0xcffd('0x2e')](db[_0xcffd('0x51')][_0xcffd('0x2c')]);_0x304706[_0xcffd('0x2f')]=_[_0xcffd('0x2e')](_0x1d4c10[_0xcffd('0x2f')]);_0x304706[_0xcffd('0x4a')]=_[_0xcffd('0x32')](_0x304706[_0xcffd('0x2d')],_0x304706[_0xcffd('0x2f')]);_0x36e991[_0xcffd('0x33')]=_[_0xcffd('0x32')](_0x304706[_0xcffd('0x2d')],qs[_0xcffd('0x34')](_0x1d4c10[_0xcffd('0x2f')][_0xcffd('0x34')]));_0x36e991[_0xcffd('0x33')]=_0x36e991['attributes'][_0xcffd('0x35')]?_0x36e991['attributes']:_0x304706[_0xcffd('0x2d')];_0x36e991[_0xcffd('0x39')]=qs[_0xcffd('0x3a')](_0x1d4c10[_0xcffd('0x2f')][_0xcffd('0x3a')]);_0x36e991[_0xcffd('0x3b')]=qs[_0xcffd('0x4a')](_[_0xcffd('0x3c')](_0x1d4c10[_0xcffd('0x2f')],_0x304706[_0xcffd('0x4a')]));if(_0x1d4c10[_0xcffd('0x2f')][_0xcffd('0x40')]){_0x36e991['where']=_['merge'](_0x36e991[_0xcffd('0x3b')],{'$or':_[_0xcffd('0x41')](_0x36e991[_0xcffd('0x33')],function(_0x2e15d0){var _0x2c7d09={};_0x2c7d09[_0x2e15d0]={'$like':'%'+_0x1d4c10['query'][_0xcffd('0x40')]+'%'};return _0x2c7d09;})});}_0x36e991=_['merge']({},_0x36e991,_0x1d4c10[_0xcffd('0x42')]);return _0x440af8[_0xcffd('0x4f')](_0x36e991);}})[_0xcffd('0x15')](function(_0x1ee2ea){if(_0x1ee2ea){_0x236818=_0x1ee2ea[_0xcffd('0x35')];if(!_0x1d4c10[_0xcffd('0x2f')][_0xcffd('0x36')](_0xcffd('0x37'))){_0x36e991[_0xcffd('0x38')]=qs[_0xcffd('0x38')](_0x1d4c10[_0xcffd('0x2f')]['limit']);_0x36e991[_0xcffd('0x23')]=qs[_0xcffd('0x23')](_0x1d4c10[_0xcffd('0x2f')][_0xcffd('0x23')]);}return _0x440af8[_0xcffd('0x4f')](_0x36e991);}})[_0xcffd('0x15')](function(_0x50b3fe){if(_0x50b3fe){return _0x50b3fe?{'count':_0x236818,'rows':_0x50b3fe}:null;}})[_0xcffd('0x15')](respondWithResult(_0x5eec57,null))['catch'](handleError(_0x5eec57,null));};exports['addConfiguration']=function(_0x2feedb,_0x1cd67c,_0x46b124){if(_0x2feedb['body']['id']){delete _0x2feedb[_0xcffd('0x4d')]['id'];}return db[_0xcffd('0x43')][_0xcffd('0x50')]({'where':{'id':_0x2feedb['params']['id']}})[_0xcffd('0x15')](handleEntityNotFound(_0x1cd67c,null))[_0xcffd('0x15')](function(_0x12a542){if(_0x12a542){_0x2feedb[_0xcffd('0x4d')][_0xcffd('0x52')]=_0x12a542['id'];_0x2feedb[_0xcffd('0x4d')][_0xcffd('0x53')]=integrations[_0xcffd('0x54')](_0x2feedb[_0xcffd('0x4d')][_0xcffd('0x55')],_0x2feedb[_0xcffd('0x4d')][_0xcffd('0x56')]);_0x2feedb[_0xcffd('0x4d')][_0xcffd('0x57')]=integrations['getDescriptions'](_0x2feedb[_0xcffd('0x4d')][_0xcffd('0x55')],_0x2feedb[_0xcffd('0x4d')]['type']);return db[_0xcffd('0x51')][_0xcffd('0x4c')](_0x2feedb[_0xcffd('0x4d')],{'include':[{'model':db[_0xcffd('0x58')],'as':_0xcffd('0x53')},{'model':db['VtigerField'],'as':_0xcffd('0x57')}]});}return null;})[_0xcffd('0x15')](respondWithResult(_0x1cd67c,null))[_0xcffd('0x1e')](handleError(_0x1cd67c,null));};var md5=require('md5');exports[_0xcffd('0x59')]=function(_0x1b166e,_0x4779e0,_0x4fad1a){var _0x43ce1c=null;var _0x2780b6=null;var _0x3baee1=null;var _0x4f8494=null;return db[_0xcffd('0x43')]['findOne']({'where':{'id':_0x1b166e[_0xcffd('0x49')]['id']},'attributes':['id',_0xcffd('0x2a'),'username',_0xcffd('0x5a'),_0xcffd('0x5b'),_0xcffd('0x5c'),_0xcffd('0x5d'),_0xcffd('0x5e')]})[_0xcffd('0x15')](handleEntityNotFound(_0x4779e0,null))[_0xcffd('0x15')](function(_0xe8fcc2){if(_0xe8fcc2){_0x43ce1c=_0xe8fcc2[_0xcffd('0x5f')];_0x2780b6=_0xe8fcc2[_0xcffd('0x5e')];_0x3baee1=_0xe8fcc2[_0xcffd('0x5b')];_0x4f8494=util[_0xcffd('0x60')]('%s/webservice.php',_0xe8fcc2[_0xcffd('0x5c')]);var _0x17cc7a={'method':_0xcffd('0x61'),'uri':_0x4f8494,'qs':{'operation':_0xcffd('0x62'),'username':_0xe8fcc2[_0xcffd('0x5f')]},'json':!![]};return rp(_0x17cc7a);}})[_0xcffd('0x15')](function(_0x3cfa9e){if(_0x3cfa9e[_0xcffd('0x63')]){var _0x54151c={'method':'POST','uri':_0x4f8494,'form':{'operation':'login','username':_0x43ce1c,'accessKey':md5(_0x3cfa9e['result'][_0xcffd('0x64')]+_0x2780b6)},'json':!![]};return rp(_0x54151c);}})[_0xcffd('0x15')](function(_0x500916){if(_0x500916['success']){var _0x26daf9={'method':_0xcffd('0x61'),'uri':_0x4f8494,'qs':{'operation':_0xcffd('0x65'),'username':_0x43ce1c,'sessionName':_0x500916[_0xcffd('0x1d')][_0xcffd('0x66')],'elementType':_0x3baee1},'json':!![]};return rp(_0x26daf9);}})[_0xcffd('0x15')](function(_0x53e9eb){if(_0x53e9eb['success']){var _0x17ad39=[_0xcffd('0x67'),'reference',_0xcffd('0x68')];_[_0xcffd('0x69')](_0x53e9eb['result'][_0xcffd('0x34')],function(_0x334122){return _0x17ad39['includes'](_0x334122[_0xcffd('0x56')][_0xcffd('0x2a')]);});_[_0xcffd('0x69')](_0x53e9eb[_0xcffd('0x1d')]['fields'],function(_0x2f1f1d){return _0x2f1f1d[_0xcffd('0x6a')]===_0xcffd('0x6b');});return{'count':_0x53e9eb[_0xcffd('0x1d')][_0xcffd('0x34')][_0xcffd('0x35')],'rows':_['map'](_0x53e9eb[_0xcffd('0x1d')][_0xcffd('0x34')],function(_0x411f2d){return{'id':_0x411f2d['name'],'name':_0x411f2d[_0xcffd('0x6c')],'custom':_[_0xcffd('0x6d')](_0x411f2d[_0xcffd('0x2a')],_0xcffd('0x6e'))?!![]:![],'options':_0x411f2d['type']['name']===_0xcffd('0x6f')&&_0x411f2d[_0xcffd('0x56')][_0xcffd('0x70')]['length']>0x0?_[_0xcffd('0x41')](_0x411f2d['type']['picklistValues'],function(_0x1d7acb){return{'name':_0x1d7acb[_0xcffd('0x6c')],'value':_0x1d7acb[_0xcffd('0x71')]};}):[]};})};}})['then'](respondWithResult(_0x4779e0,null))['catch'](function(_0x18d7fe){console[_0xcffd('0x72')](_0xcffd('0x73')+_0x18d7fe);var _0x2a0681=_0x1b166e[_0xcffd('0x2f')]['test']?0x1f4:_0x18d7fe[_0xcffd('0x74')]||0x1f4;logger[_0xcffd('0x1a')](_0xcffd('0x75'),_0xcffd('0x59'),_0x2a0681,JSON[_0xcffd('0x19')](_0x18d7fe));delete _0x18d7fe['name'];if(_0x2a0681===0x191){_0x2a0681=0x190;}_0x4779e0[_0xcffd('0x20')](_0x2a0681)[_0xcffd('0x2b')](_0x1b166e['query'][_0xcffd('0x76')]?{'message':_0xcffd('0x77'),'statusCode':_0x18d7fe[_0xcffd('0x74')]}:_0x18d7fe);});}; \ No newline at end of file +var _0x3eec=['request','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','end','status','json','offset','limit','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','VtigerAccount','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','add','day','merge','where','map','count','includeAll','include','findAll','rows','show','params','options','create','body','find','getConfigurations','findOne','VtigerConfiguration','filter','addConfiguration','getSubjects','channel','type','Descriptions','VtigerField','md5','getFields','moduleName','remoteUri','serverUrl','format','%s/webservice.php','GET','getchallenge','username','success','POST','token','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../components/integrations/configuration','jayson/promise','client','http'];(function(_0x179bf9,_0x191199){var _0xa42ca8=function(_0x41fabd){while(--_0x41fabd){_0x179bf9['push'](_0x179bf9['shift']());}};_0xa42ca8(++_0x191199);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x5a823f,_0x1b46cd){_0x5a823f=_0x5a823f-0x0;var _0x25b597=_0x3eec[_0x5a823f];return _0x25b597;};'use strict';var jsonpatch=require(_0xc3ee('0x0'));var rp=require(_0xc3ee('0x1'));var moment=require(_0xc3ee('0x2'));var BPromise=require(_0xc3ee('0x3'));var Mustache=require('mustache');var util=require(_0xc3ee('0x4'));var path=require(_0xc3ee('0x5'));var sox=require(_0xc3ee('0x6'));var csv=require(_0xc3ee('0x7'));var ejs=require(_0xc3ee('0x8'));var fs=require('fs');var _=require(_0xc3ee('0x9'));var squel=require('squel');var crypto=require(_0xc3ee('0xa'));var jsforce=require(_0xc3ee('0xb'));var deskjs=require(_0xc3ee('0xc'));var toCsv=require(_0xc3ee('0x7'));var querystring=require(_0xc3ee('0xd'));var Papa=require(_0xc3ee('0xe'));var qs=require(_0xc3ee('0xf'));var logger=require(_0xc3ee('0x10'))(_0xc3ee('0x11'));var utils=require(_0xc3ee('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0xc3ee('0x13'));var jayson=require(_0xc3ee('0x14'));var client=jayson[_0xc3ee('0x15')][_0xc3ee('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x4f27b5,_0x1c4eac,_0x4b1bff,_0x42058d){return new BPromise(function(_0x416fd2,_0x4beb01){var _0x5f2c3a=_0x42058d||client;return _0x5f2c3a[_0xc3ee('0x17')](_0x4f27b5,_0x4b1bff)['then'](function(_0x7ce8a7){logger['info'](_0xc3ee('0x18'),_0x1c4eac,'request\x20sent');logger[_0xc3ee('0x19')](_0xc3ee('0x1a'),_0x1c4eac,_0xc3ee('0x1b'),JSON[_0xc3ee('0x1c')](_0x7ce8a7));if(_0x7ce8a7[_0xc3ee('0x1d')]){if(_0x7ce8a7[_0xc3ee('0x1d')][_0xc3ee('0x1e')]===0x1f4){logger['error'](_0xc3ee('0x18'),_0x1c4eac,_0x7ce8a7['error'][_0xc3ee('0x1f')]);return _0x4beb01(_0x7ce8a7[_0xc3ee('0x1d')][_0xc3ee('0x1f')]);}logger[_0xc3ee('0x1d')](_0xc3ee('0x18'),_0x1c4eac,_0x7ce8a7[_0xc3ee('0x1d')][_0xc3ee('0x1f')]);return _0x416fd2(_0x7ce8a7[_0xc3ee('0x1d')][_0xc3ee('0x1f')]);}else{logger[_0xc3ee('0x20')](_0xc3ee('0x18'),_0x1c4eac,_0xc3ee('0x1b'));_0x416fd2(_0x7ce8a7[_0xc3ee('0x21')][_0xc3ee('0x1f')]);}})[_0xc3ee('0x22')](function(_0x46a8c9){logger[_0xc3ee('0x1d')](_0xc3ee('0x18'),_0x1c4eac,_0x46a8c9);_0x4beb01(_0x46a8c9);});});}function respondWithStatusCode(_0x327c45,_0x1c33a7){_0x1c33a7=_0x1c33a7||0xcc;return function(_0x11778f){if(_0x11778f){return _0x327c45['sendStatus'](_0x1c33a7);}return _0x327c45['status'](_0x1c33a7)[_0xc3ee('0x23')]();};}function respondWithResult(_0x36b235,_0x3b8f75){_0x3b8f75=_0x3b8f75||0xc8;return function(_0x464ffc){if(_0x464ffc){return _0x36b235[_0xc3ee('0x24')](_0x3b8f75)[_0xc3ee('0x25')](_0x464ffc);}};}function respondWithFilteredResult(_0x57ab05,_0x450cd1){return function(_0x3f8f7b){if(_0x3f8f7b){var _0x2d2750=_0x3f8f7b['count'],_0xfd03bd=_0x450cd1[_0xc3ee('0x26')],_0x5c366e=_0x450cd1[_0xc3ee('0x26')]+_0x450cd1[_0xc3ee('0x27')],_0x525ae5;if(_0x5c366e>=_0x2d2750){_0x5c366e=_0x2d2750;_0x525ae5=0xc8;}else{_0x525ae5=0xce;}_0x57ab05[_0xc3ee('0x24')](_0x525ae5);return _0x57ab05[_0xc3ee('0x28')]('Content-Range',_0xfd03bd+'-'+_0x5c366e+'/'+_0x2d2750)['json'](_0x3f8f7b);}return null;};}function patchUpdates(_0x4e0bc0){return function(_0x1be005){try{jsonpatch[_0xc3ee('0x29')](_0x1be005,_0x4e0bc0,!![]);}catch(_0x44678b){return BPromise[_0xc3ee('0x2a')](_0x44678b);}return _0x1be005[_0xc3ee('0x2b')]();};}function saveUpdates(_0x50ffaa,_0x13f30d){return function(_0xfa3111){if(_0xfa3111){return _0xfa3111[_0xc3ee('0x2c')](_0x50ffaa)[_0xc3ee('0x2d')](function(_0x1f7b3a){return _0x1f7b3a;});}return null;};}function removeEntity(_0x8bbe1e,_0x3b17f7){return function(_0x4da264){if(_0x4da264){return _0x4da264[_0xc3ee('0x2e')]()[_0xc3ee('0x2d')](function(){_0x8bbe1e[_0xc3ee('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x69d43e,_0x240a16){return function(_0x3b06ab){if(!_0x3b06ab){_0x69d43e[_0xc3ee('0x2f')](0x194);}return _0x3b06ab;};}function handleError(_0x4422b0,_0x46a8bd){_0x46a8bd=_0x46a8bd||0x1f4;return function(_0x16677d){logger['error'](_0x16677d[_0xc3ee('0x30')]);if(_0x16677d['name']){delete _0x16677d[_0xc3ee('0x31')];}_0x4422b0[_0xc3ee('0x24')](_0x46a8bd)[_0xc3ee('0x32')](_0x16677d);};}exports[_0xc3ee('0x33')]=function(_0x16d14b,_0x2239f2){var _0x4b6ed7={},_0x198653={},_0x3f2e5a={'count':0x0,'rows':[]};var _0x25315a=db[_0xc3ee('0x34')][_0xc3ee('0x35')];_0x198653[_0xc3ee('0x36')]=_[_0xc3ee('0x37')](_0x25315a);var _0x17d5df={'dateStart':_0x16d14b[_0xc3ee('0x38')][_0xc3ee('0x39')],'dateEnd':_0x16d14b[_0xc3ee('0x38')][_0xc3ee('0x3a')]};delete _0x16d14b[_0xc3ee('0x38')][_0xc3ee('0x39')];delete _0x16d14b[_0xc3ee('0x38')][_0xc3ee('0x3a')];_0x198653[_0xc3ee('0x38')]=_[_0xc3ee('0x37')](_0x16d14b[_0xc3ee('0x38')]);_0x198653[_0xc3ee('0x3b')]=_[_0xc3ee('0x3c')](_0x198653['model'],_0x198653[_0xc3ee('0x38')]);_0x4b6ed7['attributes']=_[_0xc3ee('0x3c')](_0x198653[_0xc3ee('0x36')],qs[_0xc3ee('0x3d')](_0x16d14b[_0xc3ee('0x38')][_0xc3ee('0x3d')]));_0x4b6ed7[_0xc3ee('0x3e')]=_0x4b6ed7['attributes'][_0xc3ee('0x3f')]?_0x4b6ed7[_0xc3ee('0x3e')]:_0x198653[_0xc3ee('0x36')];if(!_0x16d14b['query'][_0xc3ee('0x40')](_0xc3ee('0x41'))){_0x4b6ed7[_0xc3ee('0x27')]=qs[_0xc3ee('0x27')](_0x16d14b[_0xc3ee('0x38')][_0xc3ee('0x27')]);_0x4b6ed7[_0xc3ee('0x26')]=qs[_0xc3ee('0x26')](_0x16d14b[_0xc3ee('0x38')][_0xc3ee('0x26')]);}_0x4b6ed7[_0xc3ee('0x42')]=qs['sort'](_0x16d14b[_0xc3ee('0x38')][_0xc3ee('0x43')]);_0x4b6ed7['where']=qs['filters'](_[_0xc3ee('0x44')](_0x16d14b[_0xc3ee('0x38')],_0x198653[_0xc3ee('0x3b')]));if(_0x17d5df['dateStart']){if(_0x17d5df[_0xc3ee('0x3a')]){_0x17d5df[_0xc3ee('0x3a')]=moment(_0x17d5df[_0xc3ee('0x3a')])[_0xc3ee('0x45')](0x1,_0xc3ee('0x46'));}else{_0x17d5df[_0xc3ee('0x3a')]=moment(_0x17d5df[_0xc3ee('0x39')])[_0xc3ee('0x45')](0x1,_0xc3ee('0x46'));}_[_0xc3ee('0x47')](_0x4b6ed7[_0xc3ee('0x48')],{'createdAt':{'$gte':_0x17d5df[_0xc3ee('0x39')],'$lte':_0x17d5df[_0xc3ee('0x3a')]}});}if(_0x16d14b[_0xc3ee('0x38')]['filter']){_0x4b6ed7[_0xc3ee('0x48')]=_['merge'](_0x4b6ed7['where'],{'$or':_[_0xc3ee('0x49')](_0x4b6ed7[_0xc3ee('0x3e')],function(_0x4d6f19){var _0x1ef4b8={};_0x1ef4b8[_0x4d6f19]={'$like':'%'+_0x16d14b[_0xc3ee('0x38')]['filter']+'%'};return _0x1ef4b8;})});}_0x4b6ed7=_[_0xc3ee('0x47')]({},_0x4b6ed7,_0x16d14b['options']);var _0xaba710={'where':_0x4b6ed7['where']};return db[_0xc3ee('0x34')][_0xc3ee('0x4a')](_0xaba710)['then'](function(_0x50ea2f){_0x3f2e5a['count']=_0x50ea2f;if(_0x16d14b[_0xc3ee('0x38')][_0xc3ee('0x4b')]){_0x4b6ed7[_0xc3ee('0x4c')]=[{'all':!![]}];}return db[_0xc3ee('0x34')][_0xc3ee('0x4d')](_0x4b6ed7);})['then'](function(_0x4d06a8){_0x3f2e5a[_0xc3ee('0x4e')]=_0x4d06a8;return _0x3f2e5a;})[_0xc3ee('0x2d')](respondWithFilteredResult(_0x2239f2,_0x4b6ed7))['catch'](handleError(_0x2239f2,null));};exports[_0xc3ee('0x4f')]=function(_0x554987,_0x60e36a){var _0x5d0017={'raw':![],'where':{'id':_0x554987[_0xc3ee('0x50')]['id']}},_0x2e5b94={};_0x2e5b94[_0xc3ee('0x36')]=_[_0xc3ee('0x37')](db[_0xc3ee('0x34')][_0xc3ee('0x35')]);_0x2e5b94[_0xc3ee('0x38')]=_['keys'](_0x554987[_0xc3ee('0x38')]);_0x2e5b94[_0xc3ee('0x3b')]=_[_0xc3ee('0x3c')](_0x2e5b94[_0xc3ee('0x36')],_0x2e5b94['query']);_0x5d0017[_0xc3ee('0x3e')]=_[_0xc3ee('0x3c')](_0x2e5b94[_0xc3ee('0x36')],qs[_0xc3ee('0x3d')](_0x554987[_0xc3ee('0x38')][_0xc3ee('0x3d')]));_0x5d0017[_0xc3ee('0x3e')]=_0x5d0017['attributes']['length']?_0x5d0017['attributes']:_0x2e5b94['model'];if(_0x554987[_0xc3ee('0x38')][_0xc3ee('0x4b')]){_0x5d0017[_0xc3ee('0x4c')]=[{'all':!![]}];}_0x5d0017=_[_0xc3ee('0x47')]({},_0x5d0017,_0x554987[_0xc3ee('0x51')]);return db['VtigerAccount']['find'](_0x5d0017)[_0xc3ee('0x2d')](handleEntityNotFound(_0x60e36a,null))['then'](respondWithResult(_0x60e36a,null))[_0xc3ee('0x22')](handleError(_0x60e36a,null));};exports[_0xc3ee('0x52')]=function(_0x30e20e,_0x4f5cd3){return db[_0xc3ee('0x34')][_0xc3ee('0x52')](_0x30e20e[_0xc3ee('0x53')],{})[_0xc3ee('0x2d')](respondWithResult(_0x4f5cd3,0xc9))[_0xc3ee('0x22')](handleError(_0x4f5cd3,null));};exports[_0xc3ee('0x2c')]=function(_0x44e8fe,_0x2ff728){if(_0x44e8fe[_0xc3ee('0x53')]['id']){delete _0x44e8fe['body']['id'];}return db[_0xc3ee('0x34')][_0xc3ee('0x54')]({'where':{'id':_0x44e8fe[_0xc3ee('0x50')]['id']}})[_0xc3ee('0x2d')](handleEntityNotFound(_0x2ff728,null))[_0xc3ee('0x2d')](saveUpdates(_0x44e8fe[_0xc3ee('0x53')],null))[_0xc3ee('0x2d')](respondWithResult(_0x2ff728,null))[_0xc3ee('0x22')](handleError(_0x2ff728,null));};exports[_0xc3ee('0x2e')]=function(_0x18db2e,_0xf0f722){return db[_0xc3ee('0x34')][_0xc3ee('0x54')]({'where':{'id':_0x18db2e['params']['id']}})[_0xc3ee('0x2d')](handleEntityNotFound(_0xf0f722,null))[_0xc3ee('0x2d')](removeEntity(_0xf0f722,null))[_0xc3ee('0x22')](handleError(_0xf0f722,null));};exports[_0xc3ee('0x55')]=function(_0x654ad,_0x37e878,_0x4e556e){var _0x475dec={};var _0xca7710={};var _0x1e93f2;var _0x1f8d5e;return db[_0xc3ee('0x34')][_0xc3ee('0x56')]({'where':{'id':_0x654ad[_0xc3ee('0x50')]['id']}})[_0xc3ee('0x2d')](handleEntityNotFound(_0x37e878,null))[_0xc3ee('0x2d')](function(_0x33bc42){if(_0x33bc42){_0x1e93f2=_0x33bc42;_0xca7710[_0xc3ee('0x36')]=_[_0xc3ee('0x37')](db[_0xc3ee('0x57')]['rawAttributes']);_0xca7710['query']=_['keys'](_0x654ad[_0xc3ee('0x38')]);_0xca7710['filters']=_[_0xc3ee('0x3c')](_0xca7710[_0xc3ee('0x36')],_0xca7710[_0xc3ee('0x38')]);_0x475dec['attributes']=_[_0xc3ee('0x3c')](_0xca7710['model'],qs['fields'](_0x654ad[_0xc3ee('0x38')][_0xc3ee('0x3d')]));_0x475dec[_0xc3ee('0x3e')]=_0x475dec[_0xc3ee('0x3e')][_0xc3ee('0x3f')]?_0x475dec[_0xc3ee('0x3e')]:_0xca7710[_0xc3ee('0x36')];_0x475dec[_0xc3ee('0x42')]=qs['sort'](_0x654ad[_0xc3ee('0x38')][_0xc3ee('0x43')]);_0x475dec['where']=qs[_0xc3ee('0x3b')](_[_0xc3ee('0x44')](_0x654ad[_0xc3ee('0x38')],_0xca7710[_0xc3ee('0x3b')]));if(_0x654ad[_0xc3ee('0x38')][_0xc3ee('0x58')]){_0x475dec['where']=_[_0xc3ee('0x47')](_0x475dec[_0xc3ee('0x48')],{'$or':_[_0xc3ee('0x49')](_0x475dec[_0xc3ee('0x3e')],function(_0x1f1816){var _0x44936a={};_0x44936a[_0x1f1816]={'$like':'%'+_0x654ad['query'][_0xc3ee('0x58')]+'%'};return _0x44936a;})});}_0x475dec=_['merge']({},_0x475dec,_0x654ad[_0xc3ee('0x51')]);return _0x1e93f2['getConfigurations'](_0x475dec);}})[_0xc3ee('0x2d')](function(_0xf9409f){if(_0xf9409f){_0x1f8d5e=_0xf9409f['length'];if(!_0x654ad['query'][_0xc3ee('0x40')](_0xc3ee('0x41'))){_0x475dec['limit']=qs[_0xc3ee('0x27')](_0x654ad[_0xc3ee('0x38')][_0xc3ee('0x27')]);_0x475dec[_0xc3ee('0x26')]=qs[_0xc3ee('0x26')](_0x654ad[_0xc3ee('0x38')][_0xc3ee('0x26')]);}return _0x1e93f2[_0xc3ee('0x55')](_0x475dec);}})[_0xc3ee('0x2d')](function(_0x1a9d58){if(_0x1a9d58){return _0x1a9d58?{'count':_0x1f8d5e,'rows':_0x1a9d58}:null;}})[_0xc3ee('0x2d')](respondWithResult(_0x37e878,null))[_0xc3ee('0x22')](handleError(_0x37e878,null));};exports[_0xc3ee('0x59')]=function(_0x265ff9,_0x2d119c,_0x36561b){if(_0x265ff9[_0xc3ee('0x53')]['id']){delete _0x265ff9[_0xc3ee('0x53')]['id'];}return db[_0xc3ee('0x34')]['findOne']({'where':{'id':_0x265ff9[_0xc3ee('0x50')]['id']}})[_0xc3ee('0x2d')](handleEntityNotFound(_0x2d119c,null))[_0xc3ee('0x2d')](function(_0x4b2b47){if(_0x4b2b47){_0x265ff9[_0xc3ee('0x53')]['AccountId']=_0x4b2b47['id'];_0x265ff9[_0xc3ee('0x53')]['Subjects']=integrations[_0xc3ee('0x5a')](_0x265ff9[_0xc3ee('0x53')][_0xc3ee('0x5b')],_0x265ff9[_0xc3ee('0x53')][_0xc3ee('0x5c')]);_0x265ff9['body'][_0xc3ee('0x5d')]=integrations['getDescriptions'](_0x265ff9['body'][_0xc3ee('0x5b')],_0x265ff9[_0xc3ee('0x53')][_0xc3ee('0x5c')]);return db[_0xc3ee('0x57')][_0xc3ee('0x52')](_0x265ff9[_0xc3ee('0x53')],{'include':[{'model':db[_0xc3ee('0x5e')],'as':'Subjects'},{'model':db[_0xc3ee('0x5e')],'as':_0xc3ee('0x5d')}]});}return null;})[_0xc3ee('0x2d')](respondWithResult(_0x2d119c,null))[_0xc3ee('0x22')](handleError(_0x2d119c,null));};var md5=require(_0xc3ee('0x5f'));exports[_0xc3ee('0x60')]=function(_0x2619f6,_0x295608,_0x50124d){var _0x572684=null;var _0x2a80e4=null;var _0x484931=null;var _0xba5328=null;return db[_0xc3ee('0x34')]['findOne']({'where':{'id':_0x2619f6['params']['id']},'attributes':['id',_0xc3ee('0x31'),'username','description',_0xc3ee('0x61'),_0xc3ee('0x62'),_0xc3ee('0x63'),'accessKey']})['then'](handleEntityNotFound(_0x295608,null))[_0xc3ee('0x2d')](function(_0x552744){if(_0x552744){_0x572684=_0x552744['username'];_0x2a80e4=_0x552744['accessKey'];_0x484931=_0x552744[_0xc3ee('0x61')];_0xba5328=util[_0xc3ee('0x64')](_0xc3ee('0x65'),_0x552744[_0xc3ee('0x62')]);var _0x15f3e2={'method':_0xc3ee('0x66'),'uri':_0xba5328,'qs':{'operation':_0xc3ee('0x67'),'username':_0x552744[_0xc3ee('0x68')]},'json':!![]};return rp(_0x15f3e2);}})[_0xc3ee('0x2d')](function(_0x4fc624){if(_0x4fc624[_0xc3ee('0x69')]){var _0x98349e={'method':_0xc3ee('0x6a'),'uri':_0xba5328,'form':{'operation':'login','username':_0x572684,'accessKey':md5(_0x4fc624['result'][_0xc3ee('0x6b')]+_0x2a80e4)},'json':!![]};return rp(_0x98349e);}})['then'](function(_0x1c5089){if(_0x1c5089[_0xc3ee('0x69')]){var _0x4627bc={'method':_0xc3ee('0x66'),'uri':_0xba5328,'qs':{'operation':_0xc3ee('0x6c'),'username':_0x572684,'sessionName':_0x1c5089['result'][_0xc3ee('0x6d')],'elementType':_0x484931},'json':!![]};return rp(_0x4627bc);}})['then'](function(_0x2b3fe3){if(_0x2b3fe3[_0xc3ee('0x69')]){var _0x2a0add=[_0xc3ee('0x6e'),_0xc3ee('0x6f'),_0xc3ee('0x70')];_[_0xc3ee('0x71')](_0x2b3fe3[_0xc3ee('0x21')][_0xc3ee('0x3d')],function(_0x1651a2){return _0x2a0add[_0xc3ee('0x72')](_0x1651a2[_0xc3ee('0x5c')][_0xc3ee('0x31')]);});_[_0xc3ee('0x71')](_0x2b3fe3[_0xc3ee('0x21')]['fields'],function(_0x28137c){return _0x28137c[_0xc3ee('0x73')]===_0xc3ee('0x74');});return{'count':_0x2b3fe3['result'][_0xc3ee('0x3d')]['length'],'rows':_[_0xc3ee('0x49')](_0x2b3fe3[_0xc3ee('0x21')]['fields'],function(_0x7726af){return{'id':_0x7726af[_0xc3ee('0x31')],'name':_0x7726af[_0xc3ee('0x75')],'custom':_[_0xc3ee('0x76')](_0x7726af[_0xc3ee('0x31')],_0xc3ee('0x77'))?!![]:![],'options':_0x7726af[_0xc3ee('0x5c')][_0xc3ee('0x31')]==='picklist'&&_0x7726af['type']['picklistValues'][_0xc3ee('0x3f')]>0x0?_['map'](_0x7726af['type'][_0xc3ee('0x78')],function(_0x51aea2){return{'name':_0x51aea2[_0xc3ee('0x75')],'value':_0x51aea2[_0xc3ee('0x79')]};}):[]};})};}})[_0xc3ee('0x2d')](respondWithResult(_0x295608,null))[_0xc3ee('0x22')](function(_0xba2e54){console[_0xc3ee('0x7a')](_0xc3ee('0x7b')+_0xba2e54);var _0xb806b0=_0x2619f6[_0xc3ee('0x38')][_0xc3ee('0x7c')]?0x1f4:_0xba2e54[_0xc3ee('0x7d')]||0x1f4;logger[_0xc3ee('0x1d')](_0xc3ee('0x7e'),'getFields',_0xb806b0,JSON['stringify'](_0xba2e54));delete _0xba2e54[_0xc3ee('0x31')];if(_0xb806b0===0x191){_0xb806b0=0x190;}_0x295608[_0xc3ee('0x24')](_0xb806b0)[_0xc3ee('0x32')](_0x2619f6[_0xc3ee('0x38')][_0xc3ee('0x7c')]?{'message':_0xc3ee('0x7f'),'statusCode':_0xba2e54[_0xc3ee('0x7d')]}:_0xba2e54);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 368c80f..f4b2597 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 _0x3c75=['int_vtiger_accounts','lodash','util','../../config/logger','moment','request-promise','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount'];(function(_0xde5d8a,_0x4afa17){var _0x2b3040=function(_0x112a1e){while(--_0x112a1e){_0xde5d8a['push'](_0xde5d8a['shift']());}};_0x2b3040(++_0x4afa17);}(_0x3c75,0xe8));var _0x53c7=function(_0x58776f,_0x35bef3){_0x58776f=_0x58776f-0x0;var _0x18ed26=_0x3c75[_0x58776f];return _0x18ed26;};'use strict';var _=require(_0x53c7('0x0'));var util=require(_0x53c7('0x1'));var logger=require(_0x53c7('0x2'))('api');var moment=require(_0x53c7('0x3'));var BPromise=require('bluebird');var rp=require(_0x53c7('0x4'));var attributes=require(_0x53c7('0x5'));var integrations=require(_0x53c7('0x6'));module[_0x53c7('0x7')]=function(_0x3552d0,_0xb53c63){return _0x3552d0[_0x53c7('0x8')](_0x53c7('0x9'),attributes,{'tableName':_0x53c7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2aaa=['util','api','request-promise','./intVtigerAccount.attributes','exports','define','VtigerAccount','int_vtiger_accounts'];(function(_0x3fe0fe,_0x3bdc49){var _0x5c11f4=function(_0x127973){while(--_0x127973){_0x3fe0fe['push'](_0x3fe0fe['shift']());}};_0x5c11f4(++_0x3bdc49);}(_0x2aaa,0x1b8));var _0xa2aa=function(_0x25f2c8,_0x543abe){_0x25f2c8=_0x25f2c8-0x0;var _0x4963d1=_0x2aaa[_0x25f2c8];return _0x4963d1;};'use strict';var _=require('lodash');var util=require(_0xa2aa('0x0'));var logger=require('../../config/logger')(_0xa2aa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa2aa('0x2'));var attributes=require(_0xa2aa('0x3'));var integrations=require('../../components/integrations/configuration');module[_0xa2aa('0x4')]=function(_0x5a4f5d,_0x103598){return _0x5a4f5d[_0xa2aa('0x5')](_0xa2aa('0x6'),attributes,{'tableName':_0xa2aa('0x7'),'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 70d4feb..7a63212 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 _0xe0a8=['model','then','ShowVtigerAccount','VtigerAccount','lodash','util','moment','randomstring','rpc','../../config/environment','client','http','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVtigerAccount','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x1a75f2,_0x5bb75b){var _0x269a6a=function(_0x7c28d){while(--_0x7c28d){_0x1a75f2['push'](_0x1a75f2['shift']());}};_0x269a6a(++_0x5bb75b);}(_0xe0a8,0x7c));var _0x8e0a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe0a8[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x8e0a('0x0'));var util=require(_0x8e0a('0x1'));var moment=require(_0x8e0a('0x2'));var BPromise=require('bluebird');var rs=require(_0x8e0a('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8e0a('0x4'));var config=require(_0x8e0a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x8e0a('0x6')][_0x8e0a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3d7e1,_0x271271,_0x2752ba){return new BPromise(function(_0x18594b,_0x421b42){return client['request'](_0x3d7e1,_0x2752ba)['then'](function(_0x2ef98b){logger[_0x8e0a('0x8')](_0x8e0a('0x9'),_0x271271,_0x8e0a('0xa'));logger[_0x8e0a('0xb')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x271271,_0x8e0a('0xa'),JSON[_0x8e0a('0xc')](_0x2ef98b));if(_0x2ef98b[_0x8e0a('0xd')]){if(_0x2ef98b[_0x8e0a('0xd')][_0x8e0a('0xe')]===0x1f4){logger[_0x8e0a('0xd')](_0x8e0a('0x9'),_0x271271,_0x2ef98b[_0x8e0a('0xd')][_0x8e0a('0xf')]);return _0x421b42(_0x2ef98b[_0x8e0a('0xd')][_0x8e0a('0xf')]);}logger[_0x8e0a('0xd')](_0x8e0a('0x9'),_0x271271,_0x2ef98b[_0x8e0a('0xd')][_0x8e0a('0xf')]);return _0x18594b(_0x2ef98b[_0x8e0a('0xd')][_0x8e0a('0xf')]);}else{logger['info'](_0x8e0a('0x9'),_0x271271,_0x8e0a('0xa'));_0x18594b(_0x2ef98b['result'][_0x8e0a('0xf')]);}})[_0x8e0a('0x10')](function(_0x327337){logger['error'](_0x8e0a('0x9'),_0x271271,_0x327337);_0x421b42(_0x327337);});});}exports[_0x8e0a('0x11')]=function(_0x4e30ea){var _0x8455f1=this;return new Promise(function(_0x2a96ba,_0x1f8562){return db['VtigerAccount'][_0x8e0a('0x12')]({'raw':_0x4e30ea[_0x8e0a('0x13')]?_0x4e30ea['options'][_0x8e0a('0x14')]===undefined?!![]:![]:!![],'where':_0x4e30ea[_0x8e0a('0x13')]?_0x4e30ea[_0x8e0a('0x13')][_0x8e0a('0x15')]||null:null,'attributes':_0x4e30ea[_0x8e0a('0x13')]?_0x4e30ea[_0x8e0a('0x13')][_0x8e0a('0x16')]||null:null,'limit':_0x4e30ea[_0x8e0a('0x13')]?_0x4e30ea['options'][_0x8e0a('0x17')]||null:null,'include':_0x4e30ea['options']?_0x4e30ea[_0x8e0a('0x13')][_0x8e0a('0x18')]?_[_0x8e0a('0x19')](_0x4e30ea[_0x8e0a('0x13')]['include'],function(_0x3c148d){return{'model':db[_0x3c148d['model']],'as':_0x3c148d['as'],'attributes':_0x3c148d[_0x8e0a('0x16')],'include':_0x3c148d[_0x8e0a('0x18')]?_[_0x8e0a('0x19')](_0x3c148d[_0x8e0a('0x18')],function(_0x38adcd){return{'model':db[_0x38adcd[_0x8e0a('0x1a')]],'as':_0x38adcd['as'],'attributes':_0x38adcd['attributes'],'include':_0x38adcd[_0x8e0a('0x18')]?_[_0x8e0a('0x19')](_0x38adcd[_0x8e0a('0x18')],function(_0x4c9c83){return{'model':db[_0x4c9c83[_0x8e0a('0x1a')]],'as':_0x4c9c83['as'],'attributes':_0x4c9c83['attributes']};}):[]};}):[]};}):[]:[]})[_0x8e0a('0x1b')](function(_0xe7923e){logger['info'](_0x8e0a('0x11'),_0x4e30ea);logger[_0x8e0a('0xb')](_0x8e0a('0x11'),_0x4e30ea,JSON['stringify'](_0xe7923e));_0x2a96ba(_0xe7923e);})[_0x8e0a('0x10')](function(_0x4d75b8){logger[_0x8e0a('0xd')]('GetVtigerAccount',_0x4d75b8[_0x8e0a('0xf')],_0x4e30ea);_0x1f8562(_0x8455f1['error'](0x1f4,_0x4d75b8[_0x8e0a('0xf')]));});});};exports[_0x8e0a('0x1c')]=function(_0x130007){var _0x142433=this;return new Promise(function(_0x48a9ed,_0x5a6fad){return db[_0x8e0a('0x1d')]['find']({'raw':_0x130007[_0x8e0a('0x13')]?_0x130007[_0x8e0a('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x130007[_0x8e0a('0x13')]?_0x130007['options'][_0x8e0a('0x15')]||null:null,'attributes':_0x130007['options']?_0x130007['options'][_0x8e0a('0x16')]||null:null,'include':_0x130007[_0x8e0a('0x13')]?_0x130007[_0x8e0a('0x13')][_0x8e0a('0x18')]?_[_0x8e0a('0x19')](_0x130007[_0x8e0a('0x13')][_0x8e0a('0x18')],function(_0x497152){return{'model':db[_0x497152[_0x8e0a('0x1a')]],'as':_0x497152['as'],'attributes':_0x497152[_0x8e0a('0x16')],'include':_0x497152[_0x8e0a('0x18')]?_['map'](_0x497152[_0x8e0a('0x18')],function(_0x40f1b6){return{'model':db[_0x40f1b6['model']],'as':_0x40f1b6['as'],'attributes':_0x40f1b6['attributes'],'include':_0x40f1b6[_0x8e0a('0x18')]?_['map'](_0x40f1b6[_0x8e0a('0x18')],function(_0x211567){return{'model':db[_0x211567['model']],'as':_0x211567['as'],'attributes':_0x211567[_0x8e0a('0x16')]};}):[]};}):[]};}):[]:[]})[_0x8e0a('0x1b')](function(_0x327f25){logger[_0x8e0a('0x8')](_0x8e0a('0x1c'),_0x130007);logger[_0x8e0a('0xb')](_0x8e0a('0x1c'),_0x130007,JSON[_0x8e0a('0xc')](_0x327f25));_0x48a9ed(_0x327f25);})[_0x8e0a('0x10')](function(_0x33ccf9){logger[_0x8e0a('0xd')](_0x8e0a('0x1c'),_0x33ccf9[_0x8e0a('0xf')],_0x130007);_0x5a6fad(_0x142433[_0x8e0a('0xd')](0x1f4,_0x33ccf9[_0x8e0a('0xf')]));});});}; \ No newline at end of file +var _0xe9b1=['include','ShowVtigerAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','VtigerAccount','options','raw','where','attributes','limit','map','model'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0xe9b1,0xf7));var _0x1e9b=function(_0x1bf611,_0x5a169b){_0x1bf611=_0x1bf611-0x0;var _0x46c450=_0xe9b1[_0x1bf611];return _0x46c450;};'use strict';var _=require(_0x1e9b('0x0'));var util=require(_0x1e9b('0x1'));var moment=require(_0x1e9b('0x2'));var BPromise=require(_0x1e9b('0x3'));var rs=require(_0x1e9b('0x4'));var fs=require('fs');var db=require(_0x1e9b('0x5'))['db'];var utils=require(_0x1e9b('0x6'));var logger=require(_0x1e9b('0x7'))(_0x1e9b('0x8'));var config=require(_0x1e9b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1e9b('0xa')][_0x1e9b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x370e7b,_0x24cc7b,_0x267d86){return new BPromise(function(_0x525eca,_0x7a5d12){return client[_0x1e9b('0xc')](_0x370e7b,_0x267d86)[_0x1e9b('0xd')](function(_0x27b331){logger[_0x1e9b('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x24cc7b,_0x1e9b('0xf'));logger[_0x1e9b('0x10')](_0x1e9b('0x11'),_0x24cc7b,_0x1e9b('0xf'),JSON[_0x1e9b('0x12')](_0x27b331));if(_0x27b331[_0x1e9b('0x13')]){if(_0x27b331[_0x1e9b('0x13')]['code']===0x1f4){logger[_0x1e9b('0x13')](_0x1e9b('0x14'),_0x24cc7b,_0x27b331['error'][_0x1e9b('0x15')]);return _0x7a5d12(_0x27b331[_0x1e9b('0x13')][_0x1e9b('0x15')]);}logger[_0x1e9b('0x13')](_0x1e9b('0x14'),_0x24cc7b,_0x27b331[_0x1e9b('0x13')][_0x1e9b('0x15')]);return _0x525eca(_0x27b331[_0x1e9b('0x13')][_0x1e9b('0x15')]);}else{logger[_0x1e9b('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x24cc7b,_0x1e9b('0xf'));_0x525eca(_0x27b331[_0x1e9b('0x16')]['message']);}})[_0x1e9b('0x17')](function(_0x130a2f){logger[_0x1e9b('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x24cc7b,_0x130a2f);_0x7a5d12(_0x130a2f);});});}exports[_0x1e9b('0x18')]=function(_0x11ed67){var _0x28d88e=this;return new Promise(function(_0x9e4bc4,_0x5064be){return db[_0x1e9b('0x19')]['findAll']({'raw':_0x11ed67[_0x1e9b('0x1a')]?_0x11ed67['options'][_0x1e9b('0x1b')]===undefined?!![]:![]:!![],'where':_0x11ed67['options']?_0x11ed67['options'][_0x1e9b('0x1c')]||null:null,'attributes':_0x11ed67['options']?_0x11ed67['options'][_0x1e9b('0x1d')]||null:null,'limit':_0x11ed67[_0x1e9b('0x1a')]?_0x11ed67[_0x1e9b('0x1a')][_0x1e9b('0x1e')]||null:null,'include':_0x11ed67[_0x1e9b('0x1a')]?_0x11ed67[_0x1e9b('0x1a')]['include']?_[_0x1e9b('0x1f')](_0x11ed67[_0x1e9b('0x1a')]['include'],function(_0x543a6e){return{'model':db[_0x543a6e[_0x1e9b('0x20')]],'as':_0x543a6e['as'],'attributes':_0x543a6e[_0x1e9b('0x1d')],'include':_0x543a6e[_0x1e9b('0x21')]?_[_0x1e9b('0x1f')](_0x543a6e['include'],function(_0x5b4d9a){return{'model':db[_0x5b4d9a[_0x1e9b('0x20')]],'as':_0x5b4d9a['as'],'attributes':_0x5b4d9a[_0x1e9b('0x1d')],'include':_0x5b4d9a[_0x1e9b('0x21')]?_[_0x1e9b('0x1f')](_0x5b4d9a[_0x1e9b('0x21')],function(_0x4c286e){return{'model':db[_0x4c286e['model']],'as':_0x4c286e['as'],'attributes':_0x4c286e[_0x1e9b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1e9b('0xd')](function(_0x2322a0){logger[_0x1e9b('0xe')](_0x1e9b('0x18'),_0x11ed67);logger['debug'](_0x1e9b('0x18'),_0x11ed67,JSON[_0x1e9b('0x12')](_0x2322a0));_0x9e4bc4(_0x2322a0);})[_0x1e9b('0x17')](function(_0x3f21b4){logger[_0x1e9b('0x13')](_0x1e9b('0x18'),_0x3f21b4[_0x1e9b('0x15')],_0x11ed67);_0x5064be(_0x28d88e['error'](0x1f4,_0x3f21b4[_0x1e9b('0x15')]));});});};exports['ShowVtigerAccount']=function(_0x3a9006){var _0x5186e0=this;return new Promise(function(_0x19b364,_0x4846c2){return db[_0x1e9b('0x19')]['find']({'raw':_0x3a9006[_0x1e9b('0x1a')]?_0x3a9006[_0x1e9b('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3a9006[_0x1e9b('0x1a')]?_0x3a9006[_0x1e9b('0x1a')]['where']||null:null,'attributes':_0x3a9006['options']?_0x3a9006['options'][_0x1e9b('0x1d')]||null:null,'include':_0x3a9006[_0x1e9b('0x1a')]?_0x3a9006[_0x1e9b('0x1a')][_0x1e9b('0x21')]?_[_0x1e9b('0x1f')](_0x3a9006[_0x1e9b('0x1a')][_0x1e9b('0x21')],function(_0x574f89){return{'model':db[_0x574f89['model']],'as':_0x574f89['as'],'attributes':_0x574f89[_0x1e9b('0x1d')],'include':_0x574f89[_0x1e9b('0x21')]?_[_0x1e9b('0x1f')](_0x574f89[_0x1e9b('0x21')],function(_0x3c50e4){return{'model':db[_0x3c50e4[_0x1e9b('0x20')]],'as':_0x3c50e4['as'],'attributes':_0x3c50e4[_0x1e9b('0x1d')],'include':_0x3c50e4['include']?_[_0x1e9b('0x1f')](_0x3c50e4[_0x1e9b('0x21')],function(_0x3b8e07){return{'model':db[_0x3b8e07[_0x1e9b('0x20')]],'as':_0x3b8e07['as'],'attributes':_0x3b8e07[_0x1e9b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1e9b('0xd')](function(_0x2d4da1){logger[_0x1e9b('0xe')]('ShowVtigerAccount',_0x3a9006);logger[_0x1e9b('0x10')](_0x1e9b('0x22'),_0x3a9006,JSON['stringify'](_0x2d4da1));_0x19b364(_0x2d4da1);})[_0x1e9b('0x17')](function(_0x1c8423){logger['error'](_0x1e9b('0x22'),_0x1c8423[_0x1e9b('0x15')],_0x3a9006);_0x4846c2(_0x5186e0[_0x1e9b('0x13')](0x1f4,_0x1c8423[_0x1e9b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 27684bb..be43792 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 _0x616e=['destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','update','delete'];(function(_0x32b30c,_0x4c5567){var _0x59bc79=function(_0x5ef43d){while(--_0x5ef43d){_0x32b30c['push'](_0x32b30c['shift']());}};_0x59bc79(++_0x4c5567);}(_0x616e,0x17e));var _0xe616=function(_0x4f5108,_0x46a54b){_0x4f5108=_0x4f5108-0x0;var _0x2d56ca=_0x616e[_0x4f5108];return _0x2d56ca;};'use strict';var multer=require('multer');var util=require(_0xe616('0x0'));var path=require('path');var express=require('express');var router=express[_0xe616('0x1')]();var auth=require(_0xe616('0x2'));var interaction=require(_0xe616('0x3'));var config=require(_0xe616('0x4'));var controller=require(_0xe616('0x5'));router[_0xe616('0x6')]('/',auth['isAuthenticated'](),controller[_0xe616('0x7')]);router[_0xe616('0x6')](_0xe616('0x8'),auth[_0xe616('0x9')](),controller[_0xe616('0xa')]);router[_0xe616('0x6')](_0xe616('0xb'),auth['isAuthenticated'](),controller[_0xe616('0xc')]);router[_0xe616('0x6')]('/:id/subjects',auth[_0xe616('0x9')](),controller['getSubjects']);router['get'](_0xe616('0xd'),auth[_0xe616('0x9')](),controller[_0xe616('0xe')]);router['post']('/',auth[_0xe616('0x9')](),controller['create']);router['put']('/:id',auth[_0xe616('0x9')](),controller[_0xe616('0xf')]);router[_0xe616('0x10')]('/:id',auth[_0xe616('0x9')](),controller[_0xe616('0x11')]);module[_0xe616('0x12')]=router; \ No newline at end of file +var _0x0fde=['getDescriptions','put','update','delete','destroy','exports','multer','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x204eb7,_0x4974c3){var _0x37e444=function(_0x390613){while(--_0x390613){_0x204eb7['push'](_0x204eb7['shift']());}};_0x37e444(++_0x4974c3);}(_0x0fde,0x1a4));var _0xe0fd=function(_0xd46c1e,_0x1538ba){_0xd46c1e=_0xd46c1e-0x0;var _0x160a52=_0x0fde[_0xd46c1e];return _0x160a52;};'use strict';var multer=require(_0xe0fd('0x0'));var util=require('util');var path=require('path');var express=require('express');var router=express['Router']();var auth=require(_0xe0fd('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0xe0fd('0x2'));var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth[_0xe0fd('0x3')](),controller[_0xe0fd('0x4')]);router[_0xe0fd('0x5')](_0xe0fd('0x6'),auth[_0xe0fd('0x3')](),controller['show']);router[_0xe0fd('0x5')](_0xe0fd('0x7'),auth['isAuthenticated'](),controller[_0xe0fd('0x8')]);router[_0xe0fd('0x5')](_0xe0fd('0x9'),auth[_0xe0fd('0x3')](),controller[_0xe0fd('0xa')]);router[_0xe0fd('0x5')](_0xe0fd('0xb'),auth[_0xe0fd('0x3')](),controller[_0xe0fd('0xc')]);router['post']('/',auth[_0xe0fd('0x3')](),controller['create']);router[_0xe0fd('0xd')](_0xe0fd('0x6'),auth[_0xe0fd('0x3')](),controller[_0xe0fd('0xe')]);router[_0xe0fd('0xf')](_0xe0fd('0x6'),auth[_0xe0fd('0x3')](),controller[_0xe0fd('0x10')]);module[_0xe0fd('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 954e34a..d3bc883 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 _0xf3cd=['STRING','sequelize','exports'];(function(_0x305b20,_0x5e57e9){var _0x26d64a=function(_0x2e17f0){while(--_0x2e17f0){_0x305b20['push'](_0x305b20['shift']());}};_0x26d64a(++_0x5e57e9);}(_0xf3cd,0x17e));var _0xdf3c=function(_0x3c42ff,_0x45ee1f){_0x3c42ff=_0x3c42ff-0x0;var _0x4c0f6d=_0xf3cd[_0x3c42ff];return _0x4c0f6d;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'name':{'type':Sequelize[_0xdf3c('0x2')]},'description':{'type':Sequelize[_0xdf3c('0x2')]}}; \ No newline at end of file +var _0xe2d7=['STRING','exports'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0xe2d7,0x1d9));var _0x7e2d=function(_0x3f477a,_0x121667){_0x3f477a=_0x3f477a-0x0;var _0x285009=_0xe2d7[_0x3f477a];return _0x285009;};'use strict';var Sequelize=require('sequelize');module[_0x7e2d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7e2d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index b575204..d9220e7 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 _0x5423=['jayson/promise','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','VtigerConfiguration','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','rows','params','create','body','find','getFields','findOne','VtigerField','getSubjects','getDescriptions','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment'];(function(_0x4192ec,_0xc3c2ea){var _0x30168b=function(_0x14748f){while(--_0x14748f){_0x4192ec['push'](_0x4192ec['shift']());}};_0x30168b(++_0xc3c2ea);}(_0x5423,0xe3));var _0x3542=function(_0x3650cf,_0x475b22){_0x3650cf=_0x3650cf-0x0;var _0x15d255=_0x5423[_0x3650cf];return _0x15d255;};'use strict';var jsonpatch=require(_0x3542('0x0'));var rp=require(_0x3542('0x1'));var moment=require('moment');var BPromise=require(_0x3542('0x2'));var Mustache=require(_0x3542('0x3'));var util=require('util');var path=require(_0x3542('0x4'));var sox=require(_0x3542('0x5'));var csv=require(_0x3542('0x6'));var ejs=require(_0x3542('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3542('0x8'));var crypto=require(_0x3542('0x9'));var jsforce=require(_0x3542('0xa'));var deskjs=require(_0x3542('0xb'));var toCsv=require(_0x3542('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x3542('0xc'));var logger=require(_0x3542('0xd'))('api');var utils=require(_0x3542('0xe'));var config=require(_0x3542('0xf'));var db=require('../../mysqldb')['db'];var jayson=require(_0x3542('0x10'));var client=jayson[_0x3542('0x11')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d3180,_0x702b64,_0x48ae2a,_0x328e56){return new BPromise(function(_0x471ea0,_0x3bb6a0){var _0x1cf710=_0x328e56||client;return _0x1cf710[_0x3542('0x12')](_0x1d3180,_0x48ae2a)[_0x3542('0x13')](function(_0x1a9062){logger[_0x3542('0x14')](_0x3542('0x15'),_0x702b64,_0x3542('0x16'));logger['debug'](_0x3542('0x17'),_0x702b64,'request\x20sent',JSON[_0x3542('0x18')](_0x1a9062));if(_0x1a9062[_0x3542('0x19')]){if(_0x1a9062[_0x3542('0x19')]['code']===0x1f4){logger[_0x3542('0x19')](_0x3542('0x15'),_0x702b64,_0x1a9062[_0x3542('0x19')]['message']);return _0x3bb6a0(_0x1a9062[_0x3542('0x19')][_0x3542('0x1a')]);}logger[_0x3542('0x19')](_0x3542('0x15'),_0x702b64,_0x1a9062['error'][_0x3542('0x1a')]);return _0x471ea0(_0x1a9062['error'][_0x3542('0x1a')]);}else{logger[_0x3542('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0x702b64,_0x3542('0x16'));_0x471ea0(_0x1a9062[_0x3542('0x1b')][_0x3542('0x1a')]);}})[_0x3542('0x1c')](function(_0x212950){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x702b64,_0x212950);_0x3bb6a0(_0x212950);});});}function respondWithStatusCode(_0x4c58f1,_0x17e3cf){_0x17e3cf=_0x17e3cf||0xcc;return function(_0x527222){if(_0x527222){return _0x4c58f1[_0x3542('0x1d')](_0x17e3cf);}return _0x4c58f1['status'](_0x17e3cf)[_0x3542('0x1e')]();};}function respondWithResult(_0x55774d,_0x4ccefa){_0x4ccefa=_0x4ccefa||0xc8;return function(_0x3eacd0){if(_0x3eacd0){return _0x55774d[_0x3542('0x1f')](_0x4ccefa)['json'](_0x3eacd0);}};}function respondWithFilteredResult(_0x5d05b2,_0x3fc964){return function(_0x5123f0){if(_0x5123f0){var _0x160caa=_0x5123f0[_0x3542('0x20')],_0x367146=_0x3fc964[_0x3542('0x21')],_0x1e0723=_0x3fc964[_0x3542('0x21')]+_0x3fc964[_0x3542('0x22')],_0x2f2e63;if(_0x1e0723>=_0x160caa){_0x1e0723=_0x160caa;_0x2f2e63=0xc8;}else{_0x2f2e63=0xce;}_0x5d05b2[_0x3542('0x1f')](_0x2f2e63);return _0x5d05b2[_0x3542('0x23')](_0x3542('0x24'),_0x367146+'-'+_0x1e0723+'/'+_0x160caa)[_0x3542('0x25')](_0x5123f0);}return null;};}function patchUpdates(_0x220021){return function(_0x9d9ca4){try{jsonpatch[_0x3542('0x26')](_0x9d9ca4,_0x220021,!![]);}catch(_0x39050a){return BPromise[_0x3542('0x27')](_0x39050a);}return _0x9d9ca4[_0x3542('0x28')]();};}function saveUpdates(_0x3bd666,_0x5590a2){return function(_0x31ad47){if(_0x31ad47){return _0x31ad47[_0x3542('0x29')](_0x3bd666)[_0x3542('0x13')](function(_0x4a3ad0){return _0x4a3ad0;});}return null;};}function removeEntity(_0x402c97,_0xc6f23b){return function(_0x2e883a){if(_0x2e883a){return _0x2e883a[_0x3542('0x2a')]()['then'](function(){_0x402c97['status'](0xcc)[_0x3542('0x1e')]();});}};}function handleEntityNotFound(_0x326498,_0xd19bf4){return function(_0x44e8f7){if(!_0x44e8f7){_0x326498[_0x3542('0x1d')](0x194);}return _0x44e8f7;};}function handleError(_0x1e5789,_0x1f43d2){_0x1f43d2=_0x1f43d2||0x1f4;return function(_0x49b18a){logger['error'](_0x49b18a[_0x3542('0x2b')]);if(_0x49b18a['name']){delete _0x49b18a['name'];}_0x1e5789[_0x3542('0x1f')](_0x1f43d2)['send'](_0x49b18a);};}exports['index']=function(_0x412ee3,_0x3daf41){var _0x1bf178={},_0x595a4d={},_0x1ef7b4={'count':0x0,'rows':[]};var _0x49b523=db[_0x3542('0x2c')][_0x3542('0x2d')];_0x595a4d['model']=_[_0x3542('0x2e')](_0x49b523);var _0x487514={'dateStart':_0x412ee3[_0x3542('0x2f')][_0x3542('0x30')],'dateEnd':_0x412ee3[_0x3542('0x2f')]['dateEnd']};delete _0x412ee3[_0x3542('0x2f')]['dateStart'];delete _0x412ee3[_0x3542('0x2f')][_0x3542('0x31')];_0x595a4d[_0x3542('0x2f')]=_[_0x3542('0x2e')](_0x412ee3[_0x3542('0x2f')]);_0x595a4d[_0x3542('0x32')]=_[_0x3542('0x33')](_0x595a4d[_0x3542('0x34')],_0x595a4d[_0x3542('0x2f')]);_0x1bf178[_0x3542('0x35')]=_[_0x3542('0x33')](_0x595a4d[_0x3542('0x34')],qs[_0x3542('0x36')](_0x412ee3['query'][_0x3542('0x36')]));_0x1bf178['attributes']=_0x1bf178['attributes'][_0x3542('0x37')]?_0x1bf178[_0x3542('0x35')]:_0x595a4d[_0x3542('0x34')];if(!_0x412ee3[_0x3542('0x2f')][_0x3542('0x38')](_0x3542('0x39'))){_0x1bf178[_0x3542('0x22')]=qs[_0x3542('0x22')](_0x412ee3['query'][_0x3542('0x22')]);_0x1bf178['offset']=qs[_0x3542('0x21')](_0x412ee3[_0x3542('0x2f')]['offset']);}_0x1bf178[_0x3542('0x3a')]=qs[_0x3542('0x3b')](_0x412ee3['query'][_0x3542('0x3b')]);_0x1bf178[_0x3542('0x3c')]=qs['filters'](_[_0x3542('0x3d')](_0x412ee3[_0x3542('0x2f')],_0x595a4d[_0x3542('0x32')]));if(_0x487514[_0x3542('0x30')]){if(_0x487514[_0x3542('0x31')]){_0x487514[_0x3542('0x31')]=moment(_0x487514[_0x3542('0x31')])['add'](0x1,'day');}else{_0x487514[_0x3542('0x31')]=moment(_0x487514[_0x3542('0x30')])[_0x3542('0x3e')](0x1,_0x3542('0x3f'));}_[_0x3542('0x40')](_0x1bf178['where'],{'createdAt':{'$gte':_0x487514[_0x3542('0x30')],'$lte':_0x487514['dateEnd']}});}if(_0x412ee3[_0x3542('0x2f')][_0x3542('0x41')]){_0x1bf178[_0x3542('0x3c')]=_['merge'](_0x1bf178[_0x3542('0x3c')],{'$or':_[_0x3542('0x42')](_0x1bf178['attributes'],function(_0x4090d0){var _0x4491f3={};_0x4491f3[_0x4090d0]={'$like':'%'+_0x412ee3[_0x3542('0x2f')][_0x3542('0x41')]+'%'};return _0x4491f3;})});}_0x1bf178=_[_0x3542('0x40')]({},_0x1bf178,_0x412ee3[_0x3542('0x43')]);var _0x2da4f4={'where':_0x1bf178[_0x3542('0x3c')]};return db['VtigerConfiguration']['count'](_0x2da4f4)['then'](function(_0x3b3719){_0x1ef7b4[_0x3542('0x20')]=_0x3b3719;if(_0x412ee3[_0x3542('0x2f')][_0x3542('0x44')]){_0x1bf178[_0x3542('0x45')]=[{'all':!![]}];}return db[_0x3542('0x2c')][_0x3542('0x46')](_0x1bf178);})['then'](function(_0x157683){_0x1ef7b4[_0x3542('0x47')]=_0x157683;return _0x1ef7b4;})[_0x3542('0x13')](respondWithFilteredResult(_0x3daf41,_0x1bf178))[_0x3542('0x1c')](handleError(_0x3daf41,null));};exports['show']=function(_0x2d8854,_0x1d8184){var _0x55b43a={'raw':![],'where':{'id':_0x2d8854[_0x3542('0x48')]['id']}},_0x528f8c={};_0x528f8c[_0x3542('0x34')]=_[_0x3542('0x2e')](db[_0x3542('0x2c')][_0x3542('0x2d')]);_0x528f8c[_0x3542('0x2f')]=_[_0x3542('0x2e')](_0x2d8854['query']);_0x528f8c[_0x3542('0x32')]=_[_0x3542('0x33')](_0x528f8c[_0x3542('0x34')],_0x528f8c[_0x3542('0x2f')]);_0x55b43a[_0x3542('0x35')]=_[_0x3542('0x33')](_0x528f8c[_0x3542('0x34')],qs[_0x3542('0x36')](_0x2d8854[_0x3542('0x2f')]['fields']));_0x55b43a['attributes']=_0x55b43a[_0x3542('0x35')]['length']?_0x55b43a['attributes']:_0x528f8c['model'];if(_0x2d8854[_0x3542('0x2f')][_0x3542('0x44')]){_0x55b43a[_0x3542('0x45')]=[{'all':!![]}];}_0x55b43a=_['merge']({},_0x55b43a,_0x2d8854[_0x3542('0x43')]);return db[_0x3542('0x2c')]['find'](_0x55b43a)[_0x3542('0x13')](handleEntityNotFound(_0x1d8184,null))[_0x3542('0x13')](respondWithResult(_0x1d8184,null))[_0x3542('0x1c')](handleError(_0x1d8184,null));};exports[_0x3542('0x49')]=function(_0x179249,_0x518ad6){return db[_0x3542('0x2c')][_0x3542('0x49')](_0x179249[_0x3542('0x4a')],{})[_0x3542('0x13')](respondWithResult(_0x518ad6,0xc9))[_0x3542('0x1c')](handleError(_0x518ad6,null));};exports['update']=function(_0x513ea9,_0x429a7b){if(_0x513ea9[_0x3542('0x4a')]['id']){delete _0x513ea9[_0x3542('0x4a')]['id'];}return db['VtigerConfiguration'][_0x3542('0x4b')]({'where':{'id':_0x513ea9[_0x3542('0x48')]['id']}})[_0x3542('0x13')](handleEntityNotFound(_0x429a7b,null))[_0x3542('0x13')](saveUpdates(_0x513ea9[_0x3542('0x4a')],null))['then'](respondWithResult(_0x429a7b,null))['catch'](handleError(_0x429a7b,null));};exports[_0x3542('0x2a')]=function(_0x4cd6fd,_0x1fd8c8){return db[_0x3542('0x2c')]['find']({'where':{'id':_0x4cd6fd[_0x3542('0x48')]['id']}})[_0x3542('0x13')](handleEntityNotFound(_0x1fd8c8,null))[_0x3542('0x13')](removeEntity(_0x1fd8c8,null))[_0x3542('0x1c')](handleError(_0x1fd8c8,null));};exports[_0x3542('0x4c')]=function(_0x52a75b,_0x4cb73f,_0x271dd0){var _0x56b920={};var _0x1ffa0a={};var _0x3a23a8;var _0x219922;return db['VtigerConfiguration'][_0x3542('0x4d')]({'where':{'id':_0x52a75b[_0x3542('0x48')]['id']}})[_0x3542('0x13')](handleEntityNotFound(_0x4cb73f,null))[_0x3542('0x13')](function(_0x1bf743){if(_0x1bf743){_0x3a23a8=_0x1bf743;_0x1ffa0a[_0x3542('0x34')]=_['keys'](db[_0x3542('0x4e')][_0x3542('0x2d')]);_0x1ffa0a[_0x3542('0x2f')]=_[_0x3542('0x2e')](_0x52a75b[_0x3542('0x2f')]);_0x1ffa0a[_0x3542('0x32')]=_['intersection'](_0x1ffa0a[_0x3542('0x34')],_0x1ffa0a[_0x3542('0x2f')]);_0x56b920[_0x3542('0x35')]=_[_0x3542('0x33')](_0x1ffa0a['model'],qs[_0x3542('0x36')](_0x52a75b[_0x3542('0x2f')]['fields']));_0x56b920['attributes']=_0x56b920[_0x3542('0x35')]['length']?_0x56b920[_0x3542('0x35')]:_0x1ffa0a['model'];_0x56b920['order']=qs[_0x3542('0x3b')](_0x52a75b[_0x3542('0x2f')][_0x3542('0x3b')]);_0x56b920[_0x3542('0x3c')]=qs[_0x3542('0x32')](_[_0x3542('0x3d')](_0x52a75b[_0x3542('0x2f')],_0x1ffa0a['filters']));if(_0x52a75b[_0x3542('0x2f')][_0x3542('0x41')]){_0x56b920[_0x3542('0x3c')]=_[_0x3542('0x40')](_0x56b920[_0x3542('0x3c')],{'$or':_['map'](_0x56b920[_0x3542('0x35')],function(_0x15d58c){var _0x2c5546={};_0x2c5546[_0x15d58c]={'$like':'%'+_0x52a75b[_0x3542('0x2f')][_0x3542('0x41')]+'%'};return _0x2c5546;})});}_0x56b920=_[_0x3542('0x40')]({},_0x56b920,_0x52a75b[_0x3542('0x43')]);return _0x3a23a8['getFields'](_0x56b920);}})[_0x3542('0x13')](function(_0x5e8411){if(_0x5e8411){_0x219922=_0x5e8411[_0x3542('0x37')];if(!_0x52a75b[_0x3542('0x2f')][_0x3542('0x38')](_0x3542('0x39'))){_0x56b920['limit']=qs['limit'](_0x52a75b['query'][_0x3542('0x22')]);_0x56b920[_0x3542('0x21')]=qs[_0x3542('0x21')](_0x52a75b[_0x3542('0x2f')][_0x3542('0x21')]);}return _0x3a23a8[_0x3542('0x4c')](_0x56b920);}})[_0x3542('0x13')](function(_0x77f0af){if(_0x77f0af){return _0x77f0af?{'count':_0x219922,'rows':_0x77f0af}:null;}})[_0x3542('0x13')](respondWithResult(_0x4cb73f,null))['catch'](handleError(_0x4cb73f,null));};exports[_0x3542('0x4f')]=function(_0x2820b1,_0x3d9acc,_0x2d41dc){var _0x2af318={};var _0x576ee5={};var _0x4a5851;var _0x51b83c;return db[_0x3542('0x2c')]['findOne']({'where':{'id':_0x2820b1[_0x3542('0x48')]['id']}})['then'](handleEntityNotFound(_0x3d9acc,null))[_0x3542('0x13')](function(_0x5ab738){if(_0x5ab738){_0x4a5851=_0x5ab738;_0x576ee5[_0x3542('0x34')]=_[_0x3542('0x2e')](db['VtigerField']['rawAttributes']);_0x576ee5['query']=_[_0x3542('0x2e')](_0x2820b1['query']);_0x576ee5[_0x3542('0x32')]=_[_0x3542('0x33')](_0x576ee5['model'],_0x576ee5[_0x3542('0x2f')]);_0x2af318[_0x3542('0x35')]=_[_0x3542('0x33')](_0x576ee5['model'],qs[_0x3542('0x36')](_0x2820b1['query'][_0x3542('0x36')]));_0x2af318['attributes']=_0x2af318[_0x3542('0x35')][_0x3542('0x37')]?_0x2af318[_0x3542('0x35')]:_0x576ee5['model'];_0x2af318[_0x3542('0x3a')]=qs[_0x3542('0x3b')](_0x2820b1[_0x3542('0x2f')][_0x3542('0x3b')]);_0x2af318['where']=qs['filters'](_[_0x3542('0x3d')](_0x2820b1[_0x3542('0x2f')],_0x576ee5[_0x3542('0x32')]));if(_0x2820b1[_0x3542('0x2f')][_0x3542('0x41')]){_0x2af318[_0x3542('0x3c')]=_[_0x3542('0x40')](_0x2af318[_0x3542('0x3c')],{'$or':_[_0x3542('0x42')](_0x2af318[_0x3542('0x35')],function(_0x43f9ff){var _0x1c318c={};_0x1c318c[_0x43f9ff]={'$like':'%'+_0x2820b1[_0x3542('0x2f')][_0x3542('0x41')]+'%'};return _0x1c318c;})});}_0x2af318=_[_0x3542('0x40')]({},_0x2af318,_0x2820b1[_0x3542('0x43')]);return _0x4a5851[_0x3542('0x4f')](_0x2af318);}})[_0x3542('0x13')](function(_0x4e04b6){if(_0x4e04b6){_0x51b83c=_0x4e04b6[_0x3542('0x37')];if(!_0x2820b1[_0x3542('0x2f')]['hasOwnProperty']('nolimit')){_0x2af318[_0x3542('0x22')]=qs[_0x3542('0x22')](_0x2820b1[_0x3542('0x2f')][_0x3542('0x22')]);_0x2af318['offset']=qs[_0x3542('0x21')](_0x2820b1[_0x3542('0x2f')]['offset']);}return _0x4a5851[_0x3542('0x4f')](_0x2af318);}})['then'](function(_0x140bac){if(_0x140bac){return _0x140bac?{'count':_0x51b83c,'rows':_0x140bac}:null;}})['then'](respondWithResult(_0x3d9acc,null))[_0x3542('0x1c')](handleError(_0x3d9acc,null));};exports[_0x3542('0x50')]=function(_0x26e903,_0x23e66f,_0x3787cd){var _0x293ad0={};var _0x32586c={};var _0x59e3bc;var _0x350c2a;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x26e903[_0x3542('0x48')]['id']}})[_0x3542('0x13')](handleEntityNotFound(_0x23e66f,null))[_0x3542('0x13')](function(_0x40c19c){if(_0x40c19c){_0x59e3bc=_0x40c19c;_0x32586c['model']=_[_0x3542('0x2e')](db[_0x3542('0x4e')][_0x3542('0x2d')]);_0x32586c[_0x3542('0x2f')]=_[_0x3542('0x2e')](_0x26e903[_0x3542('0x2f')]);_0x32586c[_0x3542('0x32')]=_[_0x3542('0x33')](_0x32586c[_0x3542('0x34')],_0x32586c[_0x3542('0x2f')]);_0x293ad0['attributes']=_['intersection'](_0x32586c[_0x3542('0x34')],qs['fields'](_0x26e903[_0x3542('0x2f')][_0x3542('0x36')]));_0x293ad0[_0x3542('0x35')]=_0x293ad0['attributes'][_0x3542('0x37')]?_0x293ad0[_0x3542('0x35')]:_0x32586c[_0x3542('0x34')];_0x293ad0['order']=qs[_0x3542('0x3b')](_0x26e903['query'][_0x3542('0x3b')]);_0x293ad0[_0x3542('0x3c')]=qs[_0x3542('0x32')](_['pick'](_0x26e903[_0x3542('0x2f')],_0x32586c['filters']));if(_0x26e903[_0x3542('0x2f')]['filter']){_0x293ad0['where']=_[_0x3542('0x40')](_0x293ad0[_0x3542('0x3c')],{'$or':_['map'](_0x293ad0[_0x3542('0x35')],function(_0x5432be){var _0x157700={};_0x157700[_0x5432be]={'$like':'%'+_0x26e903['query'][_0x3542('0x41')]+'%'};return _0x157700;})});}_0x293ad0=_[_0x3542('0x40')]({},_0x293ad0,_0x26e903[_0x3542('0x43')]);return _0x59e3bc[_0x3542('0x50')](_0x293ad0);}})[_0x3542('0x13')](function(_0x4accdb){if(_0x4accdb){_0x350c2a=_0x4accdb[_0x3542('0x37')];if(!_0x26e903[_0x3542('0x2f')][_0x3542('0x38')]('nolimit')){_0x293ad0[_0x3542('0x22')]=qs[_0x3542('0x22')](_0x26e903[_0x3542('0x2f')][_0x3542('0x22')]);_0x293ad0[_0x3542('0x21')]=qs[_0x3542('0x21')](_0x26e903[_0x3542('0x2f')]['offset']);}return _0x59e3bc[_0x3542('0x50')](_0x293ad0);}})[_0x3542('0x13')](function(_0x5d5cbd){if(_0x5d5cbd){return _0x5d5cbd?{'count':_0x350c2a,'rows':_0x5d5cbd}:null;}})['then'](respondWithResult(_0x23e66f,null))['catch'](handleError(_0x23e66f,null));}; \ No newline at end of file +var _0xbb53=['error','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','limit','json','apply','update','destroy','stack','name','send','index','VtigerConfiguration','rawAttributes','model','keys','query','dateStart','dateEnd','attributes','fields','length','hasOwnProperty','order','sort','where','pick','add','day','merge','filter','map','options','count','includeAll','include','findAll','params','intersection','find','create','body','getFields','findOne','VtigerField','filters','nolimit','getSubjects','getDescriptions','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','api','../../config/utils','../../config/environment','jayson/promise','then','info','request\x20sent','debug','stringify'];(function(_0x48ae07,_0x1e046f){var _0x1bb782=function(_0x5c15d9){while(--_0x5c15d9){_0x48ae07['push'](_0x48ae07['shift']());}};_0x1bb782(++_0x1e046f);}(_0xbb53,0x121));var _0x3bb5=function(_0xcd7827,_0x5effe2){_0xcd7827=_0xcd7827-0x0;var _0x432f21=_0xbb53[_0xcd7827];return _0x432f21;};'use strict';var jsonpatch=require(_0x3bb5('0x0'));var rp=require(_0x3bb5('0x1'));var moment=require(_0x3bb5('0x2'));var BPromise=require(_0x3bb5('0x3'));var Mustache=require(_0x3bb5('0x4'));var util=require(_0x3bb5('0x5'));var path=require(_0x3bb5('0x6'));var sox=require(_0x3bb5('0x7'));var csv=require(_0x3bb5('0x8'));var ejs=require(_0x3bb5('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3bb5('0xa'));var jsforce=require(_0x3bb5('0xb'));var deskjs=require(_0x3bb5('0xc'));var toCsv=require(_0x3bb5('0x8'));var querystring=require(_0x3bb5('0xd'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x3bb5('0xe'));var utils=require(_0x3bb5('0xf'));var config=require(_0x3bb5('0x10'));var db=require('../../mysqldb')['db'];var jayson=require(_0x3bb5('0x11'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd8d9bf,_0x2b915a,_0x5cfc6b,_0xe00ace){return new BPromise(function(_0x511e41,_0x69f59a){var _0x511bd8=_0xe00ace||client;return _0x511bd8['request'](_0xd8d9bf,_0x5cfc6b)[_0x3bb5('0x12')](function(_0x35a99b){logger[_0x3bb5('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x2b915a,_0x3bb5('0x14'));logger[_0x3bb5('0x15')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x2b915a,_0x3bb5('0x14'),JSON[_0x3bb5('0x16')](_0x35a99b));if(_0x35a99b['error']){if(_0x35a99b['error']['code']===0x1f4){logger[_0x3bb5('0x17')](_0x3bb5('0x18'),_0x2b915a,_0x35a99b['error'][_0x3bb5('0x19')]);return _0x69f59a(_0x35a99b[_0x3bb5('0x17')][_0x3bb5('0x19')]);}logger[_0x3bb5('0x17')]('VtigerConfiguration,\x20%s,\x20%s',_0x2b915a,_0x35a99b[_0x3bb5('0x17')][_0x3bb5('0x19')]);return _0x511e41(_0x35a99b[_0x3bb5('0x17')]['message']);}else{logger['info'](_0x3bb5('0x18'),_0x2b915a,_0x3bb5('0x14'));_0x511e41(_0x35a99b[_0x3bb5('0x1a')]['message']);}})[_0x3bb5('0x1b')](function(_0x2afe6e){logger[_0x3bb5('0x17')](_0x3bb5('0x18'),_0x2b915a,_0x2afe6e);_0x69f59a(_0x2afe6e);});});}function respondWithStatusCode(_0x21a3ff,_0x11d156){_0x11d156=_0x11d156||0xcc;return function(_0x504c29){if(_0x504c29){return _0x21a3ff[_0x3bb5('0x1c')](_0x11d156);}return _0x21a3ff[_0x3bb5('0x1d')](_0x11d156)[_0x3bb5('0x1e')]();};}function respondWithResult(_0x2d4dae,_0x1a55e6){_0x1a55e6=_0x1a55e6||0xc8;return function(_0xfb9e8){if(_0xfb9e8){return _0x2d4dae[_0x3bb5('0x1d')](_0x1a55e6)['json'](_0xfb9e8);}};}function respondWithFilteredResult(_0x1d2a24,_0x3ef331){return function(_0x559720){if(_0x559720){var _0x4fc81b=_0x559720['count'],_0x43815e=_0x3ef331[_0x3bb5('0x1f')],_0x36cfda=_0x3ef331[_0x3bb5('0x1f')]+_0x3ef331[_0x3bb5('0x20')],_0x58acdb;if(_0x36cfda>=_0x4fc81b){_0x36cfda=_0x4fc81b;_0x58acdb=0xc8;}else{_0x58acdb=0xce;}_0x1d2a24[_0x3bb5('0x1d')](_0x58acdb);return _0x1d2a24['set']('Content-Range',_0x43815e+'-'+_0x36cfda+'/'+_0x4fc81b)[_0x3bb5('0x21')](_0x559720);}return null;};}function patchUpdates(_0x4e8c65){return function(_0x175593){try{jsonpatch[_0x3bb5('0x22')](_0x175593,_0x4e8c65,!![]);}catch(_0x2e67f7){return BPromise['reject'](_0x2e67f7);}return _0x175593['save']();};}function saveUpdates(_0x19e61d,_0x39f1ad){return function(_0x17ada7){if(_0x17ada7){return _0x17ada7[_0x3bb5('0x23')](_0x19e61d)[_0x3bb5('0x12')](function(_0x33571b){return _0x33571b;});}return null;};}function removeEntity(_0x3ed2cc,_0x5ce225){return function(_0x1b429e){if(_0x1b429e){return _0x1b429e[_0x3bb5('0x24')]()[_0x3bb5('0x12')](function(){_0x3ed2cc[_0x3bb5('0x1d')](0xcc)[_0x3bb5('0x1e')]();});}};}function handleEntityNotFound(_0x13e783,_0x464c2f){return function(_0x52cd46){if(!_0x52cd46){_0x13e783[_0x3bb5('0x1c')](0x194);}return _0x52cd46;};}function handleError(_0x25ba4c,_0x53654b){_0x53654b=_0x53654b||0x1f4;return function(_0x396345){logger[_0x3bb5('0x17')](_0x396345[_0x3bb5('0x25')]);if(_0x396345[_0x3bb5('0x26')]){delete _0x396345[_0x3bb5('0x26')];}_0x25ba4c['status'](_0x53654b)[_0x3bb5('0x27')](_0x396345);};}exports[_0x3bb5('0x28')]=function(_0x42ec4d,_0xdb73f4){var _0x5c95d1={},_0x57aed6={},_0x125820={'count':0x0,'rows':[]};var _0xeeb452=db[_0x3bb5('0x29')][_0x3bb5('0x2a')];_0x57aed6[_0x3bb5('0x2b')]=_[_0x3bb5('0x2c')](_0xeeb452);var _0x2a2419={'dateStart':_0x42ec4d[_0x3bb5('0x2d')][_0x3bb5('0x2e')],'dateEnd':_0x42ec4d['query'][_0x3bb5('0x2f')]};delete _0x42ec4d[_0x3bb5('0x2d')]['dateStart'];delete _0x42ec4d['query'][_0x3bb5('0x2f')];_0x57aed6[_0x3bb5('0x2d')]=_[_0x3bb5('0x2c')](_0x42ec4d[_0x3bb5('0x2d')]);_0x57aed6['filters']=_['intersection'](_0x57aed6[_0x3bb5('0x2b')],_0x57aed6['query']);_0x5c95d1[_0x3bb5('0x30')]=_['intersection'](_0x57aed6['model'],qs[_0x3bb5('0x31')](_0x42ec4d['query']['fields']));_0x5c95d1[_0x3bb5('0x30')]=_0x5c95d1[_0x3bb5('0x30')][_0x3bb5('0x32')]?_0x5c95d1['attributes']:_0x57aed6[_0x3bb5('0x2b')];if(!_0x42ec4d['query'][_0x3bb5('0x33')]('nolimit')){_0x5c95d1[_0x3bb5('0x20')]=qs[_0x3bb5('0x20')](_0x42ec4d[_0x3bb5('0x2d')][_0x3bb5('0x20')]);_0x5c95d1[_0x3bb5('0x1f')]=qs[_0x3bb5('0x1f')](_0x42ec4d['query'][_0x3bb5('0x1f')]);}_0x5c95d1[_0x3bb5('0x34')]=qs['sort'](_0x42ec4d[_0x3bb5('0x2d')][_0x3bb5('0x35')]);_0x5c95d1[_0x3bb5('0x36')]=qs['filters'](_[_0x3bb5('0x37')](_0x42ec4d[_0x3bb5('0x2d')],_0x57aed6['filters']));if(_0x2a2419[_0x3bb5('0x2e')]){if(_0x2a2419[_0x3bb5('0x2f')]){_0x2a2419[_0x3bb5('0x2f')]=moment(_0x2a2419[_0x3bb5('0x2f')])[_0x3bb5('0x38')](0x1,_0x3bb5('0x39'));}else{_0x2a2419[_0x3bb5('0x2f')]=moment(_0x2a2419[_0x3bb5('0x2e')])[_0x3bb5('0x38')](0x1,_0x3bb5('0x39'));}_[_0x3bb5('0x3a')](_0x5c95d1[_0x3bb5('0x36')],{'createdAt':{'$gte':_0x2a2419[_0x3bb5('0x2e')],'$lte':_0x2a2419[_0x3bb5('0x2f')]}});}if(_0x42ec4d['query'][_0x3bb5('0x3b')]){_0x5c95d1[_0x3bb5('0x36')]=_['merge'](_0x5c95d1['where'],{'$or':_[_0x3bb5('0x3c')](_0x5c95d1[_0x3bb5('0x30')],function(_0x9c36d0){var _0x31e7e9={};_0x31e7e9[_0x9c36d0]={'$like':'%'+_0x42ec4d[_0x3bb5('0x2d')][_0x3bb5('0x3b')]+'%'};return _0x31e7e9;})});}_0x5c95d1=_[_0x3bb5('0x3a')]({},_0x5c95d1,_0x42ec4d[_0x3bb5('0x3d')]);var _0x51c76e={'where':_0x5c95d1['where']};return db[_0x3bb5('0x29')][_0x3bb5('0x3e')](_0x51c76e)[_0x3bb5('0x12')](function(_0x4c322f){_0x125820[_0x3bb5('0x3e')]=_0x4c322f;if(_0x42ec4d['query'][_0x3bb5('0x3f')]){_0x5c95d1[_0x3bb5('0x40')]=[{'all':!![]}];}return db[_0x3bb5('0x29')][_0x3bb5('0x41')](_0x5c95d1);})[_0x3bb5('0x12')](function(_0x2b7c68){_0x125820['rows']=_0x2b7c68;return _0x125820;})[_0x3bb5('0x12')](respondWithFilteredResult(_0xdb73f4,_0x5c95d1))[_0x3bb5('0x1b')](handleError(_0xdb73f4,null));};exports['show']=function(_0x961438,_0x13860a){var _0x5075bd={'raw':![],'where':{'id':_0x961438[_0x3bb5('0x42')]['id']}},_0x41edf7={};_0x41edf7[_0x3bb5('0x2b')]=_[_0x3bb5('0x2c')](db[_0x3bb5('0x29')]['rawAttributes']);_0x41edf7[_0x3bb5('0x2d')]=_[_0x3bb5('0x2c')](_0x961438['query']);_0x41edf7['filters']=_[_0x3bb5('0x43')](_0x41edf7[_0x3bb5('0x2b')],_0x41edf7[_0x3bb5('0x2d')]);_0x5075bd[_0x3bb5('0x30')]=_[_0x3bb5('0x43')](_0x41edf7['model'],qs[_0x3bb5('0x31')](_0x961438[_0x3bb5('0x2d')][_0x3bb5('0x31')]));_0x5075bd[_0x3bb5('0x30')]=_0x5075bd[_0x3bb5('0x30')][_0x3bb5('0x32')]?_0x5075bd[_0x3bb5('0x30')]:_0x41edf7['model'];if(_0x961438[_0x3bb5('0x2d')][_0x3bb5('0x3f')]){_0x5075bd[_0x3bb5('0x40')]=[{'all':!![]}];}_0x5075bd=_[_0x3bb5('0x3a')]({},_0x5075bd,_0x961438[_0x3bb5('0x3d')]);return db['VtigerConfiguration'][_0x3bb5('0x44')](_0x5075bd)[_0x3bb5('0x12')](handleEntityNotFound(_0x13860a,null))[_0x3bb5('0x12')](respondWithResult(_0x13860a,null))[_0x3bb5('0x1b')](handleError(_0x13860a,null));};exports[_0x3bb5('0x45')]=function(_0x3f9133,_0x421bbf){return db[_0x3bb5('0x29')]['create'](_0x3f9133[_0x3bb5('0x46')],{})[_0x3bb5('0x12')](respondWithResult(_0x421bbf,0xc9))[_0x3bb5('0x1b')](handleError(_0x421bbf,null));};exports[_0x3bb5('0x23')]=function(_0x5d6d39,_0x44f21b){if(_0x5d6d39['body']['id']){delete _0x5d6d39[_0x3bb5('0x46')]['id'];}return db[_0x3bb5('0x29')][_0x3bb5('0x44')]({'where':{'id':_0x5d6d39[_0x3bb5('0x42')]['id']}})[_0x3bb5('0x12')](handleEntityNotFound(_0x44f21b,null))['then'](saveUpdates(_0x5d6d39[_0x3bb5('0x46')],null))[_0x3bb5('0x12')](respondWithResult(_0x44f21b,null))[_0x3bb5('0x1b')](handleError(_0x44f21b,null));};exports[_0x3bb5('0x24')]=function(_0x4fc8a4,_0xe88e97){return db[_0x3bb5('0x29')][_0x3bb5('0x44')]({'where':{'id':_0x4fc8a4[_0x3bb5('0x42')]['id']}})[_0x3bb5('0x12')](handleEntityNotFound(_0xe88e97,null))[_0x3bb5('0x12')](removeEntity(_0xe88e97,null))[_0x3bb5('0x1b')](handleError(_0xe88e97,null));};exports[_0x3bb5('0x47')]=function(_0x4a711b,_0x3d0776,_0x17173a){var _0x3a61cb={};var _0x5a98cf={};var _0x56397c;var _0x27d764;return db[_0x3bb5('0x29')][_0x3bb5('0x48')]({'where':{'id':_0x4a711b['params']['id']}})[_0x3bb5('0x12')](handleEntityNotFound(_0x3d0776,null))[_0x3bb5('0x12')](function(_0x45b661){if(_0x45b661){_0x56397c=_0x45b661;_0x5a98cf[_0x3bb5('0x2b')]=_[_0x3bb5('0x2c')](db[_0x3bb5('0x49')][_0x3bb5('0x2a')]);_0x5a98cf['query']=_['keys'](_0x4a711b[_0x3bb5('0x2d')]);_0x5a98cf[_0x3bb5('0x4a')]=_[_0x3bb5('0x43')](_0x5a98cf[_0x3bb5('0x2b')],_0x5a98cf[_0x3bb5('0x2d')]);_0x3a61cb[_0x3bb5('0x30')]=_['intersection'](_0x5a98cf[_0x3bb5('0x2b')],qs[_0x3bb5('0x31')](_0x4a711b[_0x3bb5('0x2d')][_0x3bb5('0x31')]));_0x3a61cb['attributes']=_0x3a61cb[_0x3bb5('0x30')][_0x3bb5('0x32')]?_0x3a61cb[_0x3bb5('0x30')]:_0x5a98cf[_0x3bb5('0x2b')];_0x3a61cb[_0x3bb5('0x34')]=qs[_0x3bb5('0x35')](_0x4a711b[_0x3bb5('0x2d')][_0x3bb5('0x35')]);_0x3a61cb['where']=qs[_0x3bb5('0x4a')](_[_0x3bb5('0x37')](_0x4a711b[_0x3bb5('0x2d')],_0x5a98cf[_0x3bb5('0x4a')]));if(_0x4a711b[_0x3bb5('0x2d')]['filter']){_0x3a61cb[_0x3bb5('0x36')]=_['merge'](_0x3a61cb[_0x3bb5('0x36')],{'$or':_['map'](_0x3a61cb[_0x3bb5('0x30')],function(_0x3407d){var _0x102428={};_0x102428[_0x3407d]={'$like':'%'+_0x4a711b['query'][_0x3bb5('0x3b')]+'%'};return _0x102428;})});}_0x3a61cb=_[_0x3bb5('0x3a')]({},_0x3a61cb,_0x4a711b[_0x3bb5('0x3d')]);return _0x56397c['getFields'](_0x3a61cb);}})[_0x3bb5('0x12')](function(_0x14cf65){if(_0x14cf65){_0x27d764=_0x14cf65[_0x3bb5('0x32')];if(!_0x4a711b['query'][_0x3bb5('0x33')](_0x3bb5('0x4b'))){_0x3a61cb[_0x3bb5('0x20')]=qs[_0x3bb5('0x20')](_0x4a711b[_0x3bb5('0x2d')][_0x3bb5('0x20')]);_0x3a61cb[_0x3bb5('0x1f')]=qs['offset'](_0x4a711b['query'][_0x3bb5('0x1f')]);}return _0x56397c[_0x3bb5('0x47')](_0x3a61cb);}})['then'](function(_0xbb4bca){if(_0xbb4bca){return _0xbb4bca?{'count':_0x27d764,'rows':_0xbb4bca}:null;}})['then'](respondWithResult(_0x3d0776,null))[_0x3bb5('0x1b')](handleError(_0x3d0776,null));};exports[_0x3bb5('0x4c')]=function(_0x215a60,_0x380dcb,_0x4c0dc9){var _0x28cc70={};var _0x30524d={};var _0xfb07d3;var _0x4eaff8;return db[_0x3bb5('0x29')][_0x3bb5('0x48')]({'where':{'id':_0x215a60['params']['id']}})[_0x3bb5('0x12')](handleEntityNotFound(_0x380dcb,null))[_0x3bb5('0x12')](function(_0x162854){if(_0x162854){_0xfb07d3=_0x162854;_0x30524d[_0x3bb5('0x2b')]=_[_0x3bb5('0x2c')](db[_0x3bb5('0x49')][_0x3bb5('0x2a')]);_0x30524d['query']=_['keys'](_0x215a60['query']);_0x30524d['filters']=_['intersection'](_0x30524d[_0x3bb5('0x2b')],_0x30524d[_0x3bb5('0x2d')]);_0x28cc70[_0x3bb5('0x30')]=_[_0x3bb5('0x43')](_0x30524d[_0x3bb5('0x2b')],qs[_0x3bb5('0x31')](_0x215a60[_0x3bb5('0x2d')][_0x3bb5('0x31')]));_0x28cc70['attributes']=_0x28cc70[_0x3bb5('0x30')][_0x3bb5('0x32')]?_0x28cc70[_0x3bb5('0x30')]:_0x30524d[_0x3bb5('0x2b')];_0x28cc70[_0x3bb5('0x34')]=qs[_0x3bb5('0x35')](_0x215a60[_0x3bb5('0x2d')]['sort']);_0x28cc70[_0x3bb5('0x36')]=qs['filters'](_[_0x3bb5('0x37')](_0x215a60[_0x3bb5('0x2d')],_0x30524d[_0x3bb5('0x4a')]));if(_0x215a60['query'][_0x3bb5('0x3b')]){_0x28cc70[_0x3bb5('0x36')]=_[_0x3bb5('0x3a')](_0x28cc70[_0x3bb5('0x36')],{'$or':_['map'](_0x28cc70[_0x3bb5('0x30')],function(_0x59a637){var _0x48c78b={};_0x48c78b[_0x59a637]={'$like':'%'+_0x215a60[_0x3bb5('0x2d')][_0x3bb5('0x3b')]+'%'};return _0x48c78b;})});}_0x28cc70=_[_0x3bb5('0x3a')]({},_0x28cc70,_0x215a60[_0x3bb5('0x3d')]);return _0xfb07d3['getSubjects'](_0x28cc70);}})[_0x3bb5('0x12')](function(_0x4cfead){if(_0x4cfead){_0x4eaff8=_0x4cfead[_0x3bb5('0x32')];if(!_0x215a60[_0x3bb5('0x2d')][_0x3bb5('0x33')](_0x3bb5('0x4b'))){_0x28cc70[_0x3bb5('0x20')]=qs['limit'](_0x215a60[_0x3bb5('0x2d')]['limit']);_0x28cc70[_0x3bb5('0x1f')]=qs['offset'](_0x215a60[_0x3bb5('0x2d')][_0x3bb5('0x1f')]);}return _0xfb07d3[_0x3bb5('0x4c')](_0x28cc70);}})[_0x3bb5('0x12')](function(_0x2cd66d){if(_0x2cd66d){return _0x2cd66d?{'count':_0x4eaff8,'rows':_0x2cd66d}:null;}})[_0x3bb5('0x12')](respondWithResult(_0x380dcb,null))[_0x3bb5('0x1b')](handleError(_0x380dcb,null));};exports['getDescriptions']=function(_0x536219,_0x4cfb81,_0x59e0c4){var _0x3fb277={};var _0x1c4231={};var _0xdcbd32;var _0x12ad9d;return db['VtigerConfiguration'][_0x3bb5('0x48')]({'where':{'id':_0x536219['params']['id']}})[_0x3bb5('0x12')](handleEntityNotFound(_0x4cfb81,null))[_0x3bb5('0x12')](function(_0x1a0686){if(_0x1a0686){_0xdcbd32=_0x1a0686;_0x1c4231[_0x3bb5('0x2b')]=_[_0x3bb5('0x2c')](db[_0x3bb5('0x49')][_0x3bb5('0x2a')]);_0x1c4231[_0x3bb5('0x2d')]=_[_0x3bb5('0x2c')](_0x536219['query']);_0x1c4231[_0x3bb5('0x4a')]=_[_0x3bb5('0x43')](_0x1c4231[_0x3bb5('0x2b')],_0x1c4231[_0x3bb5('0x2d')]);_0x3fb277[_0x3bb5('0x30')]=_[_0x3bb5('0x43')](_0x1c4231[_0x3bb5('0x2b')],qs[_0x3bb5('0x31')](_0x536219[_0x3bb5('0x2d')]['fields']));_0x3fb277['attributes']=_0x3fb277[_0x3bb5('0x30')][_0x3bb5('0x32')]?_0x3fb277[_0x3bb5('0x30')]:_0x1c4231[_0x3bb5('0x2b')];_0x3fb277[_0x3bb5('0x34')]=qs[_0x3bb5('0x35')](_0x536219['query'][_0x3bb5('0x35')]);_0x3fb277[_0x3bb5('0x36')]=qs[_0x3bb5('0x4a')](_[_0x3bb5('0x37')](_0x536219[_0x3bb5('0x2d')],_0x1c4231['filters']));if(_0x536219[_0x3bb5('0x2d')][_0x3bb5('0x3b')]){_0x3fb277[_0x3bb5('0x36')]=_[_0x3bb5('0x3a')](_0x3fb277[_0x3bb5('0x36')],{'$or':_[_0x3bb5('0x3c')](_0x3fb277['attributes'],function(_0x1724d9){var _0x47162d={};_0x47162d[_0x1724d9]={'$like':'%'+_0x536219[_0x3bb5('0x2d')][_0x3bb5('0x3b')]+'%'};return _0x47162d;})});}_0x3fb277=_['merge']({},_0x3fb277,_0x536219[_0x3bb5('0x3d')]);return _0xdcbd32[_0x3bb5('0x4d')](_0x3fb277);}})['then'](function(_0x171392){if(_0x171392){_0x12ad9d=_0x171392['length'];if(!_0x536219[_0x3bb5('0x2d')][_0x3bb5('0x33')](_0x3bb5('0x4b'))){_0x3fb277[_0x3bb5('0x20')]=qs[_0x3bb5('0x20')](_0x536219[_0x3bb5('0x2d')][_0x3bb5('0x20')]);_0x3fb277[_0x3bb5('0x1f')]=qs[_0x3bb5('0x1f')](_0x536219['query'][_0x3bb5('0x1f')]);}return _0xdcbd32[_0x3bb5('0x4d')](_0x3fb277);}})[_0x3bb5('0x12')](function(_0x92a269){if(_0x92a269){return _0x92a269?{'count':_0x12ad9d,'rows':_0x92a269}:null;}})['then'](respondWithResult(_0x4cfb81,null))[_0x3bb5('0x1b')](handleError(_0x4cfb81,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index cc8f739..06902a5 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 _0xf645=['moment','bluebird','request-promise','VtigerConfiguration','int_vtiger_configurations','../../config/logger','api'];(function(_0x562553,_0x410c2a){var _0x154f70=function(_0xde5d88){while(--_0xde5d88){_0x562553['push'](_0x562553['shift']());}};_0x154f70(++_0x410c2a);}(_0xf645,0x67));var _0x5f64=function(_0x4c64d7,_0x5d93e6){_0x4c64d7=_0x4c64d7-0x0;var _0x5d613d=_0xf645[_0x4c64d7];return _0x5d613d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5f64('0x0'))(_0x5f64('0x1'));var moment=require(_0x5f64('0x2'));var BPromise=require(_0x5f64('0x3'));var rp=require(_0x5f64('0x4'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x53580e,_0x19d4bb){return _0x53580e['define'](_0x5f64('0x5'),attributes,{'tableName':_0x5f64('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe10=['lodash','util','../../config/logger','api','moment','request-promise','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xfe10,0x8c));var _0x0fe1=function(_0x415841,_0x529045){_0x415841=_0x415841-0x0;var _0x515538=_0xfe10[_0x415841];return _0x515538;};'use strict';var _=require(_0x0fe1('0x0'));var util=require(_0x0fe1('0x1'));var logger=require(_0x0fe1('0x2'))(_0x0fe1('0x3'));var moment=require(_0x0fe1('0x4'));var BPromise=require('bluebird');var rp=require(_0x0fe1('0x5'));var attributes=require(_0x0fe1('0x6'));module[_0x0fe1('0x7')]=function(_0x3ef36a,_0x1e0cec){return _0x3ef36a['define'](_0x0fe1('0x8'),attributes,{'tableName':_0x0fe1('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 ac21a9a..3146f55 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 _0x4dff=['debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x12fc2c,_0x155251){var _0x118444=function(_0x5ab61f){while(--_0x5ab61f){_0x12fc2c['push'](_0x12fc2c['shift']());}};_0x118444(++_0x155251);}(_0x4dff,0x70));var _0xf4df=function(_0xd6fefa,_0x413784){_0xd6fefa=_0xd6fefa-0x0;var _0x131e73=_0x4dff[_0xd6fefa];return _0x131e73;};'use strict';var _=require(_0xf4df('0x0'));var util=require(_0xf4df('0x1'));var moment=require(_0xf4df('0x2'));var BPromise=require(_0xf4df('0x3'));var rs=require(_0xf4df('0x4'));var fs=require('fs');var db=require(_0xf4df('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4df('0x6'))('rpc');var config=require(_0xf4df('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf4df('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa792b0,_0x2f6fc7,_0xf3d51){return new BPromise(function(_0x232db8,_0xd8a982){return client[_0xf4df('0x9')](_0xa792b0,_0xf3d51)[_0xf4df('0xa')](function(_0x643afa){logger[_0xf4df('0xb')](_0xf4df('0xc'),_0x2f6fc7,_0xf4df('0xd'));logger[_0xf4df('0xe')](_0xf4df('0xf'),_0x2f6fc7,_0xf4df('0xd'),JSON['stringify'](_0x643afa));if(_0x643afa['error']){if(_0x643afa[_0xf4df('0x10')][_0xf4df('0x11')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x2f6fc7,_0x643afa[_0xf4df('0x10')][_0xf4df('0x12')]);return _0xd8a982(_0x643afa['error']['message']);}logger[_0xf4df('0x10')](_0xf4df('0xc'),_0x2f6fc7,_0x643afa[_0xf4df('0x10')][_0xf4df('0x12')]);return _0x232db8(_0x643afa['error'][_0xf4df('0x12')]);}else{logger[_0xf4df('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x2f6fc7,_0xf4df('0xd'));_0x232db8(_0x643afa[_0xf4df('0x13')]['message']);}})[_0xf4df('0x14')](function(_0x234387){logger[_0xf4df('0x10')](_0xf4df('0xc'),_0x2f6fc7,_0x234387);_0xd8a982(_0x234387);});});} \ No newline at end of file +var _0x14b0=['../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x15876a,_0x15383d){var _0xbd900f=function(_0x103e59){while(--_0x103e59){_0x15876a['push'](_0x15876a['shift']());}};_0xbd900f(++_0x15383d);}(_0x14b0,0x19c));var _0x014b=function(_0xf6c982,_0x346031){_0xf6c982=_0xf6c982-0x0;var _0x5d406c=_0x14b0[_0xf6c982];return _0x5d406c;};'use strict';var _=require(_0x014b('0x0'));var util=require(_0x014b('0x1'));var moment=require(_0x014b('0x2'));var BPromise=require(_0x014b('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x014b('0x4'))['db'];var utils=require(_0x014b('0x5'));var logger=require(_0x014b('0x6'))('rpc');var config=require(_0x014b('0x7'));var jayson=require(_0x014b('0x8'));var client=jayson[_0x014b('0x9')][_0x014b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x354144,_0x5736fb,_0x4dbaca){return new BPromise(function(_0x23fb05,_0x84ddb){return client[_0x014b('0xb')](_0x354144,_0x4dbaca)['then'](function(_0x545d6d){logger[_0x014b('0xc')](_0x014b('0xd'),_0x5736fb,_0x014b('0xe'));logger[_0x014b('0xf')](_0x014b('0x10'),_0x5736fb,_0x014b('0xe'),JSON[_0x014b('0x11')](_0x545d6d));if(_0x545d6d['error']){if(_0x545d6d[_0x014b('0x12')][_0x014b('0x13')]===0x1f4){logger['error'](_0x014b('0xd'),_0x5736fb,_0x545d6d[_0x014b('0x12')]['message']);return _0x84ddb(_0x545d6d[_0x014b('0x12')][_0x014b('0x14')]);}logger[_0x014b('0x12')](_0x014b('0xd'),_0x5736fb,_0x545d6d[_0x014b('0x12')][_0x014b('0x14')]);return _0x23fb05(_0x545d6d['error']['message']);}else{logger[_0x014b('0xc')](_0x014b('0xd'),_0x5736fb,_0x014b('0xe'));_0x23fb05(_0x545d6d['result']['message']);}})[_0x014b('0x15')](function(_0x34aa41){logger[_0x014b('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x5736fb,_0x34aa41);_0x84ddb(_0x34aa41);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index b9b8682..a15fb28 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 _0xe574=['update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','post','put'];(function(_0x3b7503,_0x18682c){var _0x1ce4c8=function(_0x2403fe){while(--_0x2403fe){_0x3b7503['push'](_0x3b7503['shift']());}};_0x1ce4c8(++_0x18682c);}(_0xe574,0x100));var _0x4e57=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe574[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x4e57('0x0'));var util=require('util');var path=require(_0x4e57('0x1'));var express=require(_0x4e57('0x2'));var router=express[_0x4e57('0x3')]();var auth=require(_0x4e57('0x4'));var interaction=require(_0x4e57('0x5'));var config=require(_0x4e57('0x6'));var controller=require(_0x4e57('0x7'));router[_0x4e57('0x8')]('/',auth[_0x4e57('0x9')](),controller[_0x4e57('0xa')]);router[_0x4e57('0x8')](_0x4e57('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x4e57('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4e57('0xd')](_0x4e57('0xb'),auth[_0x4e57('0x9')](),controller[_0x4e57('0xe')]);router[_0x4e57('0xf')]('/:id',auth[_0x4e57('0x9')](),controller[_0x4e57('0x10')]);module[_0x4e57('0x11')]=router; \ No newline at end of file +var _0x014c=['delete','destroy','util','express','Router','../../components/auth/service','./intVtigerField.controller','get','isAuthenticated','index','show','put','/:id'];(function(_0x1917d9,_0x2ceda8){var _0x54a14c=function(_0x4d3847){while(--_0x4d3847){_0x1917d9['push'](_0x1917d9['shift']());}};_0x54a14c(++_0x2ceda8);}(_0x014c,0x17b));var _0xc014=function(_0x27530d,_0x46480a){_0x27530d=_0x27530d-0x0;var _0x59e561=_0x014c[_0x27530d];return _0x59e561;};'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')]('/:id',auth[_0xc014('0x6')](),controller[_0xc014('0x8')]);router['post']('/',auth[_0xc014('0x6')](),controller['create']);router[_0xc014('0x9')](_0xc014('0xa'),auth[_0xc014('0x6')](),controller['update']);router[_0xc014('0xb')](_0xc014('0xa'),auth[_0xc014('0x6')](),controller[_0xc014('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index c98fe84..35fd1ba 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 _0x5c00=['string','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue'];(function(_0xc23d0e,_0x1d7215){var _0x3e6928=function(_0x26e528){while(--_0x26e528){_0xc23d0e['push'](_0xc23d0e['shift']());}};_0x3e6928(++_0x1d7215);}(_0x5c00,0x17e));var _0x05c0=function(_0x38ce4c,_0xfdbe8c){_0x38ce4c=_0x38ce4c-0x0;var _0x5d4544=_0x5c00[_0x38ce4c];return _0x5d4544;};'use strict';var Sequelize=require(_0x05c0('0x0'));module[_0x05c0('0x1')]={'type':{'type':Sequelize[_0x05c0('0x2')]('string',_0x05c0('0x3'),'customVariable',_0x05c0('0x4')),'defaultValue':_0x05c0('0x5')},'content':{'type':Sequelize[_0x05c0('0x6')]},'key':{'type':Sequelize[_0x05c0('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x05c0('0x5'),_0x05c0('0x3'),_0x05c0('0x7'))},'keyContent':{'type':Sequelize[_0x05c0('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x05c0('0x6')]},'customField':{'type':Sequelize[_0x05c0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x05c0('0x6')]}}; \ No newline at end of file +var _0x4ea3=['sequelize','exports','ENUM','string','customVariable','variable','STRING'];(function(_0x575331,_0x5f5788){var _0x2a4e39=function(_0x436764){while(--_0x436764){_0x575331['push'](_0x575331['shift']());}};_0x2a4e39(++_0x5f5788);}(_0x4ea3,0x70));var _0x34ea=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x4ea3[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x34ea('0x0'));module[_0x34ea('0x1')]={'type':{'type':Sequelize[_0x34ea('0x2')](_0x34ea('0x3'),'variable',_0x34ea('0x4'),'keyValue'),'defaultValue':_0x34ea('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x34ea('0x2')](_0x34ea('0x3'),_0x34ea('0x5'),_0x34ea('0x4'))},'keyContent':{'type':Sequelize[_0x34ea('0x6')]},'idField':{'type':Sequelize[_0x34ea('0x6')]},'nameField':{'type':Sequelize[_0x34ea('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x34ea('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index e974783..acecead 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 _0x92d2=['offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','model','query','dateStart','dateEnd','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','add','day','merge','filter','options','VtigerField','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','fast-json-patch','moment','bluebird','util','path','ejs','lodash','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count'];(function(_0x46ba84,_0x1cd8f7){var _0x545a31=function(_0xaf84cb){while(--_0xaf84cb){_0x46ba84['push'](_0x46ba84['shift']());}};_0x545a31(++_0x1cd8f7);}(_0x92d2,0x6f));var _0x292d=function(_0x9ddb44,_0x40acb1){_0x9ddb44=_0x9ddb44-0x0;var _0x36fb24=_0x92d2[_0x9ddb44];return _0x36fb24;};'use strict';var jsonpatch=require(_0x292d('0x0'));var rp=require('request-promise');var moment=require(_0x292d('0x1'));var BPromise=require(_0x292d('0x2'));var Mustache=require('mustache');var util=require(_0x292d('0x3'));var path=require(_0x292d('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x292d('0x5'));var fs=require('fs');var _=require(_0x292d('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x292d('0x7'));var toCsv=require(_0x292d('0x8'));var querystring=require(_0x292d('0x9'));var Papa=require(_0x292d('0xa'));var qs=require(_0x292d('0xb'));var logger=require('../../config/logger')(_0x292d('0xc'));var utils=require(_0x292d('0xd'));var config=require(_0x292d('0xe'));var db=require(_0x292d('0xf'))['db'];function respondWithStatusCode(_0x493b27,_0x17bbf4){_0x17bbf4=_0x17bbf4||0xcc;return function(_0x5b798f){if(_0x5b798f){return _0x493b27[_0x292d('0x10')](_0x17bbf4);}return _0x493b27[_0x292d('0x11')](_0x17bbf4)[_0x292d('0x12')]();};}function respondWithResult(_0x44d4d7,_0x52fb0a){_0x52fb0a=_0x52fb0a||0xc8;return function(_0x3830c9){if(_0x3830c9){return _0x44d4d7[_0x292d('0x11')](_0x52fb0a)[_0x292d('0x13')](_0x3830c9);}};}function respondWithFilteredResult(_0x5dc837,_0x4544c5){return function(_0x23dd59){if(_0x23dd59){var _0x1e729a=_0x23dd59[_0x292d('0x14')],_0x324e14=_0x4544c5[_0x292d('0x15')],_0x11cfbf=_0x4544c5[_0x292d('0x15')]+_0x4544c5[_0x292d('0x16')],_0x46b67d;if(_0x11cfbf>=_0x1e729a){_0x11cfbf=_0x1e729a;_0x46b67d=0xc8;}else{_0x46b67d=0xce;}_0x5dc837[_0x292d('0x11')](_0x46b67d);return _0x5dc837['set'](_0x292d('0x17'),_0x324e14+'-'+_0x11cfbf+'/'+_0x1e729a)['json'](_0x23dd59);}return null;};}function patchUpdates(_0x54c082){return function(_0x3ed3d3){try{jsonpatch[_0x292d('0x18')](_0x3ed3d3,_0x54c082,!![]);}catch(_0x593d53){return BPromise[_0x292d('0x19')](_0x593d53);}return _0x3ed3d3[_0x292d('0x1a')]();};}function saveUpdates(_0x24ab60,_0x1cdc92){return function(_0x5e57b5){if(_0x5e57b5){return _0x5e57b5[_0x292d('0x1b')](_0x24ab60)[_0x292d('0x1c')](function(_0x481365){return _0x481365;});}return null;};}function removeEntity(_0x2905ea,_0x215fb6){return function(_0x4d2c01){if(_0x4d2c01){return _0x4d2c01[_0x292d('0x1d')]()[_0x292d('0x1c')](function(){_0x2905ea[_0x292d('0x11')](0xcc)[_0x292d('0x12')]();});}};}function handleEntityNotFound(_0x4ae60c,_0xc4d7ef){return function(_0x44a614){if(!_0x44a614){_0x4ae60c[_0x292d('0x10')](0x194);}return _0x44a614;};}function handleError(_0x2ef7c0,_0x154a53){_0x154a53=_0x154a53||0x1f4;return function(_0x5ae668){logger[_0x292d('0x1e')](_0x5ae668['stack']);if(_0x5ae668['name']){delete _0x5ae668[_0x292d('0x1f')];}_0x2ef7c0[_0x292d('0x11')](_0x154a53)[_0x292d('0x20')](_0x5ae668);};}exports[_0x292d('0x21')]=function(_0x497962,_0x30c59d){var _0x14994f={},_0x2fad24={},_0x57336d={'count':0x0,'rows':[]};var _0x4f0bda=db['VtigerField'][_0x292d('0x22')];_0x2fad24[_0x292d('0x23')]=_['keys'](_0x4f0bda);var _0x5e8f27={'dateStart':_0x497962['query']['dateStart'],'dateEnd':_0x497962[_0x292d('0x24')]['dateEnd']};delete _0x497962[_0x292d('0x24')][_0x292d('0x25')];delete _0x497962[_0x292d('0x24')][_0x292d('0x26')];_0x2fad24[_0x292d('0x24')]=_['keys'](_0x497962[_0x292d('0x24')]);_0x2fad24['filters']=_['intersection'](_0x2fad24[_0x292d('0x23')],_0x2fad24[_0x292d('0x24')]);_0x14994f[_0x292d('0x27')]=_[_0x292d('0x28')](_0x2fad24['model'],qs[_0x292d('0x29')](_0x497962[_0x292d('0x24')]['fields']));_0x14994f['attributes']=_0x14994f[_0x292d('0x27')][_0x292d('0x2a')]?_0x14994f[_0x292d('0x27')]:_0x2fad24['model'];if(!_0x497962['query'][_0x292d('0x2b')]('nolimit')){_0x14994f[_0x292d('0x16')]=qs[_0x292d('0x16')](_0x497962[_0x292d('0x24')][_0x292d('0x16')]);_0x14994f[_0x292d('0x15')]=qs['offset'](_0x497962['query']['offset']);}_0x14994f[_0x292d('0x2c')]=qs[_0x292d('0x2d')](_0x497962[_0x292d('0x24')][_0x292d('0x2d')]);_0x14994f[_0x292d('0x2e')]=qs[_0x292d('0x2f')](_[_0x292d('0x30')](_0x497962['query'],_0x2fad24[_0x292d('0x2f')]));if(_0x5e8f27[_0x292d('0x25')]){if(_0x5e8f27['dateEnd']){_0x5e8f27['dateEnd']=moment(_0x5e8f27['dateEnd'])[_0x292d('0x31')](0x1,_0x292d('0x32'));}else{_0x5e8f27['dateEnd']=moment(_0x5e8f27[_0x292d('0x25')])[_0x292d('0x31')](0x1,_0x292d('0x32'));}_[_0x292d('0x33')](_0x14994f[_0x292d('0x2e')],{'createdAt':{'$gte':_0x5e8f27[_0x292d('0x25')],'$lte':_0x5e8f27[_0x292d('0x26')]}});}if(_0x497962[_0x292d('0x24')][_0x292d('0x34')]){_0x14994f[_0x292d('0x2e')]=_[_0x292d('0x33')](_0x14994f[_0x292d('0x2e')],{'$or':_['map'](_0x14994f['attributes'],function(_0x1353e1){var _0x1f4924={};_0x1f4924[_0x1353e1]={'$like':'%'+_0x497962[_0x292d('0x24')]['filter']+'%'};return _0x1f4924;})});}_0x14994f=_[_0x292d('0x33')]({},_0x14994f,_0x497962[_0x292d('0x35')]);var _0x2b53f1={'where':_0x14994f[_0x292d('0x2e')]};return db[_0x292d('0x36')][_0x292d('0x14')](_0x2b53f1)[_0x292d('0x1c')](function(_0x4ab811){_0x57336d[_0x292d('0x14')]=_0x4ab811;if(_0x497962[_0x292d('0x24')][_0x292d('0x37')]){_0x14994f[_0x292d('0x38')]=[{'all':!![]}];}return db[_0x292d('0x36')][_0x292d('0x39')](_0x14994f);})[_0x292d('0x1c')](function(_0x2f2379){_0x57336d[_0x292d('0x3a')]=_0x2f2379;return _0x57336d;})['then'](respondWithFilteredResult(_0x30c59d,_0x14994f))[_0x292d('0x3b')](handleError(_0x30c59d,null));};exports[_0x292d('0x3c')]=function(_0x5f520b,_0x853499){var _0x1c6d65={'raw':!![],'where':{'id':_0x5f520b[_0x292d('0x3d')]['id']}},_0x4f2df1={};_0x4f2df1[_0x292d('0x23')]=_[_0x292d('0x3e')](db['VtigerField'][_0x292d('0x22')]);_0x4f2df1['query']=_['keys'](_0x5f520b[_0x292d('0x24')]);_0x4f2df1[_0x292d('0x2f')]=_[_0x292d('0x28')](_0x4f2df1[_0x292d('0x23')],_0x4f2df1['query']);_0x1c6d65[_0x292d('0x27')]=_[_0x292d('0x28')](_0x4f2df1[_0x292d('0x23')],qs[_0x292d('0x29')](_0x5f520b[_0x292d('0x24')][_0x292d('0x29')]));_0x1c6d65[_0x292d('0x27')]=_0x1c6d65[_0x292d('0x27')][_0x292d('0x2a')]?_0x1c6d65[_0x292d('0x27')]:_0x4f2df1[_0x292d('0x23')];if(_0x5f520b['query'][_0x292d('0x37')]){_0x1c6d65[_0x292d('0x38')]=[{'all':!![]}];}_0x1c6d65=_['merge']({},_0x1c6d65,_0x5f520b[_0x292d('0x35')]);return db['VtigerField'][_0x292d('0x3f')](_0x1c6d65)['then'](handleEntityNotFound(_0x853499,null))[_0x292d('0x1c')](respondWithResult(_0x853499,null))[_0x292d('0x3b')](handleError(_0x853499,null));};exports['create']=function(_0x2e4515,_0x2aa73b){return db[_0x292d('0x36')][_0x292d('0x40')](_0x2e4515[_0x292d('0x41')],{})['then'](respondWithResult(_0x2aa73b,0xc9))[_0x292d('0x3b')](handleError(_0x2aa73b,null));};exports[_0x292d('0x1b')]=function(_0x2e742f,_0x35d74d){if(_0x2e742f[_0x292d('0x41')]['id']){delete _0x2e742f[_0x292d('0x41')]['id'];}return db[_0x292d('0x36')]['find']({'where':{'id':_0x2e742f[_0x292d('0x3d')]['id']}})[_0x292d('0x1c')](handleEntityNotFound(_0x35d74d,null))[_0x292d('0x1c')](saveUpdates(_0x2e742f[_0x292d('0x41')],null))[_0x292d('0x1c')](respondWithResult(_0x35d74d,null))['catch'](handleError(_0x35d74d,null));};exports[_0x292d('0x1d')]=function(_0x3d6521,_0x2e49a1){return db[_0x292d('0x36')]['find']({'where':{'id':_0x3d6521[_0x292d('0x3d')]['id']}})[_0x292d('0x1c')](handleEntityNotFound(_0x2e49a1,null))[_0x292d('0x1c')](removeEntity(_0x2e49a1,null))[_0x292d('0x3b')](handleError(_0x2e49a1,null));}; \ No newline at end of file +var _0xd9c9=['lodash','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','update','destroy','then','error','stack','name','send','index','VtigerField','rawAttributes','model','keys','query','dateEnd','dateStart','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','add','day','merge','filter','map','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xd9c9,0x1e1));var _0x9d9c=function(_0x28bc24,_0x2d36ac){_0x28bc24=_0x28bc24-0x0;var _0x5e8445=_0xd9c9[_0x28bc24];return _0x5e8445;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x9d9c('0x0'));var moment=require(_0x9d9c('0x1'));var BPromise=require(_0x9d9c('0x2'));var Mustache=require(_0x9d9c('0x3'));var util=require(_0x9d9c('0x4'));var path=require(_0x9d9c('0x5'));var sox=require(_0x9d9c('0x6'));var csv=require(_0x9d9c('0x7'));var ejs=require(_0x9d9c('0x8'));var fs=require('fs');var _=require(_0x9d9c('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9d9c('0xa'));var deskjs=require(_0x9d9c('0xb'));var toCsv=require(_0x9d9c('0x7'));var querystring=require(_0x9d9c('0xc'));var Papa=require(_0x9d9c('0xd'));var qs=require(_0x9d9c('0xe'));var logger=require(_0x9d9c('0xf'))('api');var utils=require(_0x9d9c('0x10'));var config=require(_0x9d9c('0x11'));var db=require(_0x9d9c('0x12'))['db'];function respondWithStatusCode(_0x12451e,_0x157933){_0x157933=_0x157933||0xcc;return function(_0x5dc370){if(_0x5dc370){return _0x12451e[_0x9d9c('0x13')](_0x157933);}return _0x12451e[_0x9d9c('0x14')](_0x157933)[_0x9d9c('0x15')]();};}function respondWithResult(_0xfbe93e,_0xbaf888){_0xbaf888=_0xbaf888||0xc8;return function(_0x5dd7ac){if(_0x5dd7ac){return _0xfbe93e[_0x9d9c('0x14')](_0xbaf888)['json'](_0x5dd7ac);}};}function respondWithFilteredResult(_0x54103e,_0x1e07ec){return function(_0x4f0dd8){if(_0x4f0dd8){var _0x268232=_0x4f0dd8[_0x9d9c('0x16')],_0x3b739c=_0x1e07ec[_0x9d9c('0x17')],_0xa3bebd=_0x1e07ec[_0x9d9c('0x17')]+_0x1e07ec[_0x9d9c('0x18')],_0x38b853;if(_0xa3bebd>=_0x268232){_0xa3bebd=_0x268232;_0x38b853=0xc8;}else{_0x38b853=0xce;}_0x54103e[_0x9d9c('0x14')](_0x38b853);return _0x54103e[_0x9d9c('0x19')](_0x9d9c('0x1a'),_0x3b739c+'-'+_0xa3bebd+'/'+_0x268232)[_0x9d9c('0x1b')](_0x4f0dd8);}return null;};}function patchUpdates(_0x3152d5){return function(_0x401522){try{jsonpatch[_0x9d9c('0x1c')](_0x401522,_0x3152d5,!![]);}catch(_0x2feeaa){return BPromise['reject'](_0x2feeaa);}return _0x401522['save']();};}function saveUpdates(_0x53f58c,_0x8f531c){return function(_0x1993ec){if(_0x1993ec){return _0x1993ec[_0x9d9c('0x1d')](_0x53f58c)['then'](function(_0x50ba09){return _0x50ba09;});}return null;};}function removeEntity(_0x1c3e76,_0x1ae9af){return function(_0x307c43){if(_0x307c43){return _0x307c43[_0x9d9c('0x1e')]()[_0x9d9c('0x1f')](function(){_0x1c3e76[_0x9d9c('0x14')](0xcc)[_0x9d9c('0x15')]();});}};}function handleEntityNotFound(_0x509a92,_0x587625){return function(_0x496524){if(!_0x496524){_0x509a92[_0x9d9c('0x13')](0x194);}return _0x496524;};}function handleError(_0x5a8d15,_0x5720a2){_0x5720a2=_0x5720a2||0x1f4;return function(_0x4681c4){logger[_0x9d9c('0x20')](_0x4681c4[_0x9d9c('0x21')]);if(_0x4681c4[_0x9d9c('0x22')]){delete _0x4681c4[_0x9d9c('0x22')];}_0x5a8d15['status'](_0x5720a2)[_0x9d9c('0x23')](_0x4681c4);};}exports[_0x9d9c('0x24')]=function(_0x365e27,_0x3b95ef){var _0xa6be26={},_0x496dd9={},_0x22d510={'count':0x0,'rows':[]};var _0x3cc613=db[_0x9d9c('0x25')][_0x9d9c('0x26')];_0x496dd9[_0x9d9c('0x27')]=_[_0x9d9c('0x28')](_0x3cc613);var _0x4ba163={'dateStart':_0x365e27[_0x9d9c('0x29')]['dateStart'],'dateEnd':_0x365e27['query'][_0x9d9c('0x2a')]};delete _0x365e27[_0x9d9c('0x29')][_0x9d9c('0x2b')];delete _0x365e27[_0x9d9c('0x29')][_0x9d9c('0x2a')];_0x496dd9[_0x9d9c('0x29')]=_[_0x9d9c('0x28')](_0x365e27[_0x9d9c('0x29')]);_0x496dd9['filters']=_[_0x9d9c('0x2c')](_0x496dd9[_0x9d9c('0x27')],_0x496dd9[_0x9d9c('0x29')]);_0xa6be26[_0x9d9c('0x2d')]=_[_0x9d9c('0x2c')](_0x496dd9[_0x9d9c('0x27')],qs['fields'](_0x365e27[_0x9d9c('0x29')][_0x9d9c('0x2e')]));_0xa6be26[_0x9d9c('0x2d')]=_0xa6be26['attributes'][_0x9d9c('0x2f')]?_0xa6be26[_0x9d9c('0x2d')]:_0x496dd9[_0x9d9c('0x27')];if(!_0x365e27[_0x9d9c('0x29')][_0x9d9c('0x30')]('nolimit')){_0xa6be26[_0x9d9c('0x18')]=qs[_0x9d9c('0x18')](_0x365e27['query'][_0x9d9c('0x18')]);_0xa6be26['offset']=qs['offset'](_0x365e27['query'][_0x9d9c('0x17')]);}_0xa6be26[_0x9d9c('0x31')]=qs[_0x9d9c('0x32')](_0x365e27[_0x9d9c('0x29')]['sort']);_0xa6be26[_0x9d9c('0x33')]=qs[_0x9d9c('0x34')](_[_0x9d9c('0x35')](_0x365e27[_0x9d9c('0x29')],_0x496dd9[_0x9d9c('0x34')]));if(_0x4ba163[_0x9d9c('0x2b')]){if(_0x4ba163[_0x9d9c('0x2a')]){_0x4ba163[_0x9d9c('0x2a')]=moment(_0x4ba163[_0x9d9c('0x2a')])[_0x9d9c('0x36')](0x1,_0x9d9c('0x37'));}else{_0x4ba163['dateEnd']=moment(_0x4ba163[_0x9d9c('0x2b')])[_0x9d9c('0x36')](0x1,'day');}_[_0x9d9c('0x38')](_0xa6be26[_0x9d9c('0x33')],{'createdAt':{'$gte':_0x4ba163[_0x9d9c('0x2b')],'$lte':_0x4ba163['dateEnd']}});}if(_0x365e27[_0x9d9c('0x29')][_0x9d9c('0x39')]){_0xa6be26[_0x9d9c('0x33')]=_[_0x9d9c('0x38')](_0xa6be26['where'],{'$or':_[_0x9d9c('0x3a')](_0xa6be26['attributes'],function(_0x37a891){var _0x5cb036={};_0x5cb036[_0x37a891]={'$like':'%'+_0x365e27[_0x9d9c('0x29')][_0x9d9c('0x39')]+'%'};return _0x5cb036;})});}_0xa6be26=_[_0x9d9c('0x38')]({},_0xa6be26,_0x365e27[_0x9d9c('0x3b')]);var _0x2eb6d8={'where':_0xa6be26['where']};return db[_0x9d9c('0x25')][_0x9d9c('0x16')](_0x2eb6d8)[_0x9d9c('0x1f')](function(_0x11651b){_0x22d510['count']=_0x11651b;if(_0x365e27[_0x9d9c('0x29')][_0x9d9c('0x3c')]){_0xa6be26[_0x9d9c('0x3d')]=[{'all':!![]}];}return db[_0x9d9c('0x25')][_0x9d9c('0x3e')](_0xa6be26);})[_0x9d9c('0x1f')](function(_0x51a777){_0x22d510[_0x9d9c('0x3f')]=_0x51a777;return _0x22d510;})[_0x9d9c('0x1f')](respondWithFilteredResult(_0x3b95ef,_0xa6be26))['catch'](handleError(_0x3b95ef,null));};exports[_0x9d9c('0x40')]=function(_0x197abc,_0x4d458e){var _0x5b36e0={'raw':!![],'where':{'id':_0x197abc[_0x9d9c('0x41')]['id']}},_0x3220ea={};_0x3220ea[_0x9d9c('0x27')]=_[_0x9d9c('0x28')](db['VtigerField'][_0x9d9c('0x26')]);_0x3220ea['query']=_[_0x9d9c('0x28')](_0x197abc[_0x9d9c('0x29')]);_0x3220ea[_0x9d9c('0x34')]=_['intersection'](_0x3220ea[_0x9d9c('0x27')],_0x3220ea[_0x9d9c('0x29')]);_0x5b36e0[_0x9d9c('0x2d')]=_[_0x9d9c('0x2c')](_0x3220ea[_0x9d9c('0x27')],qs[_0x9d9c('0x2e')](_0x197abc[_0x9d9c('0x29')][_0x9d9c('0x2e')]));_0x5b36e0[_0x9d9c('0x2d')]=_0x5b36e0[_0x9d9c('0x2d')]['length']?_0x5b36e0[_0x9d9c('0x2d')]:_0x3220ea[_0x9d9c('0x27')];if(_0x197abc[_0x9d9c('0x29')]['includeAll']){_0x5b36e0['include']=[{'all':!![]}];}_0x5b36e0=_[_0x9d9c('0x38')]({},_0x5b36e0,_0x197abc[_0x9d9c('0x3b')]);return db['VtigerField'][_0x9d9c('0x42')](_0x5b36e0)[_0x9d9c('0x1f')](handleEntityNotFound(_0x4d458e,null))[_0x9d9c('0x1f')](respondWithResult(_0x4d458e,null))['catch'](handleError(_0x4d458e,null));};exports[_0x9d9c('0x43')]=function(_0x252f64,_0x2bab1c){return db[_0x9d9c('0x25')][_0x9d9c('0x43')](_0x252f64[_0x9d9c('0x44')],{})[_0x9d9c('0x1f')](respondWithResult(_0x2bab1c,0xc9))[_0x9d9c('0x45')](handleError(_0x2bab1c,null));};exports['update']=function(_0x2b2ddc,_0x8b08d7){if(_0x2b2ddc['body']['id']){delete _0x2b2ddc[_0x9d9c('0x44')]['id'];}return db[_0x9d9c('0x25')][_0x9d9c('0x42')]({'where':{'id':_0x2b2ddc[_0x9d9c('0x41')]['id']}})['then'](handleEntityNotFound(_0x8b08d7,null))[_0x9d9c('0x1f')](saveUpdates(_0x2b2ddc[_0x9d9c('0x44')],null))[_0x9d9c('0x1f')](respondWithResult(_0x8b08d7,null))[_0x9d9c('0x45')](handleError(_0x8b08d7,null));};exports[_0x9d9c('0x1e')]=function(_0x197c3e,_0x120f78){return db[_0x9d9c('0x25')][_0x9d9c('0x42')]({'where':{'id':_0x197c3e[_0x9d9c('0x41')]['id']}})[_0x9d9c('0x1f')](handleEntityNotFound(_0x120f78,null))[_0x9d9c('0x1f')](removeEntity(_0x120f78,null))[_0x9d9c('0x45')](handleError(_0x120f78,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 9e9385b..0b4282f 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 _0xfa04=['VtigerField','util','../../config/logger','moment','bluebird','request-promise','./intVtigerField.attributes'];(function(_0x32c25f,_0x65d6ea){var _0x8065f4=function(_0x1367d4){while(--_0x1367d4){_0x32c25f['push'](_0x32c25f['shift']());}};_0x8065f4(++_0x65d6ea);}(_0xfa04,0x1ba));var _0x4fa0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfa04[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x4fa0('0x0'));var logger=require(_0x4fa0('0x1'))('api');var moment=require(_0x4fa0('0x2'));var BPromise=require(_0x4fa0('0x3'));var rp=require(_0x4fa0('0x4'));var attributes=require(_0x4fa0('0x5'));module['exports']=function(_0x4cb150,_0x10ee8d){return _0x4cb150['define'](_0x4fa0('0x6'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x784f=['lodash','../../config/logger','api','moment','bluebird','request-promise','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields'];(function(_0x24b8a6,_0x24e364){var _0xc114e6=function(_0x5d2690){while(--_0x5d2690){_0x24b8a6['push'](_0x24b8a6['shift']());}};_0xc114e6(++_0x24e364);}(_0x784f,0x64));var _0xf784=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x784f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf784('0x0'));var util=require('util');var logger=require(_0xf784('0x1'))(_0xf784('0x2'));var moment=require(_0xf784('0x3'));var BPromise=require(_0xf784('0x4'));var rp=require(_0xf784('0x5'));var attributes=require(_0xf784('0x6'));module['exports']=function(_0x59308e,_0x4f5276){return _0x59308e[_0xf784('0x7')](_0xf784('0x8'),attributes,{'tableName':_0xf784('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 6a52bd6..ba8a82f 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 _0xe959=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe959,0x170));var _0x9e95=function(_0xfa96da,_0x5b77c7){_0xfa96da=_0xfa96da-0x0;var _0x1b22a4=_0xe959[_0xfa96da];return _0x1b22a4;};'use strict';var _=require(_0x9e95('0x0'));var util=require(_0x9e95('0x1'));var moment=require(_0x9e95('0x2'));var BPromise=require(_0x9e95('0x3'));var rs=require(_0x9e95('0x4'));var fs=require('fs');var db=require(_0x9e95('0x5'))['db'];var utils=require(_0x9e95('0x6'));var logger=require(_0x9e95('0x7'))(_0x9e95('0x8'));var config=require(_0x9e95('0x9'));var jayson=require(_0x9e95('0xa'));var client=jayson[_0x9e95('0xb')][_0x9e95('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1657f6,_0x26d9b0,_0x1c2de2){return new BPromise(function(_0x357e90,_0xc58e78){return client[_0x9e95('0xd')](_0x1657f6,_0x1c2de2)[_0x9e95('0xe')](function(_0x9cf333){logger[_0x9e95('0xf')](_0x9e95('0x10'),_0x26d9b0,_0x9e95('0x11'));logger[_0x9e95('0x12')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x26d9b0,'request\x20sent',JSON['stringify'](_0x9cf333));if(_0x9cf333[_0x9e95('0x13')]){if(_0x9cf333[_0x9e95('0x13')]['code']===0x1f4){logger['error'](_0x9e95('0x10'),_0x26d9b0,_0x9cf333[_0x9e95('0x13')][_0x9e95('0x14')]);return _0xc58e78(_0x9cf333['error']['message']);}logger[_0x9e95('0x13')]('VtigerField,\x20%s,\x20%s',_0x26d9b0,_0x9cf333[_0x9e95('0x13')][_0x9e95('0x14')]);return _0x357e90(_0x9cf333[_0x9e95('0x13')][_0x9e95('0x14')]);}else{logger[_0x9e95('0xf')](_0x9e95('0x10'),_0x26d9b0,_0x9e95('0x11'));_0x357e90(_0x9cf333[_0x9e95('0x15')][_0x9e95('0x14')]);}})[_0x9e95('0x16')](function(_0x283430){logger['error']('VtigerField,\x20%s,\x20%s',_0x26d9b0,_0x283430);_0xc58e78(_0x283430);});});} \ No newline at end of file +var _0xde22=['message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x414ff6,_0x42e9d9){var _0xcda628=function(_0x377cd9){while(--_0x377cd9){_0x414ff6['push'](_0x414ff6['shift']());}};_0xcda628(++_0x42e9d9);}(_0xde22,0x146));var _0x2de2=function(_0x442ab4,_0x350bb2){_0x442ab4=_0x442ab4-0x0;var _0x24cb3f=_0xde22[_0x442ab4];return _0x24cb3f;};'use strict';var _=require('lodash');var util=require(_0x2de2('0x0'));var moment=require(_0x2de2('0x1'));var BPromise=require(_0x2de2('0x2'));var rs=require(_0x2de2('0x3'));var fs=require('fs');var db=require(_0x2de2('0x4'))['db'];var utils=require(_0x2de2('0x5'));var logger=require(_0x2de2('0x6'))(_0x2de2('0x7'));var config=require(_0x2de2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2de2('0x9')][_0x2de2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c1298,_0x532492,_0x3c33a5){return new BPromise(function(_0x3a3b20,_0x1ab454){return client[_0x2de2('0xb')](_0x3c1298,_0x3c33a5)[_0x2de2('0xc')](function(_0x92982a){logger['info'](_0x2de2('0xd'),_0x532492,_0x2de2('0xe'));logger[_0x2de2('0xf')](_0x2de2('0x10'),_0x532492,_0x2de2('0xe'),JSON['stringify'](_0x92982a));if(_0x92982a['error']){if(_0x92982a['error'][_0x2de2('0x11')]===0x1f4){logger[_0x2de2('0x12')](_0x2de2('0xd'),_0x532492,_0x92982a['error'][_0x2de2('0x13')]);return _0x1ab454(_0x92982a[_0x2de2('0x12')][_0x2de2('0x13')]);}logger[_0x2de2('0x12')](_0x2de2('0xd'),_0x532492,_0x92982a['error'][_0x2de2('0x13')]);return _0x3a3b20(_0x92982a[_0x2de2('0x12')][_0x2de2('0x13')]);}else{logger[_0x2de2('0x14')]('VtigerField,\x20%s,\x20%s',_0x532492,_0x2de2('0xe'));_0x3a3b20(_0x92982a[_0x2de2('0x15')][_0x2de2('0x13')]);}})[_0x2de2('0x16')](function(_0x59526c){logger[_0x2de2('0x12')](_0x2de2('0xd'),_0x532492,_0x59526c);_0x1ab454(_0x59526c);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 1ff1132..48832f7 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 _0xd906=['destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','put','update','delete'];(function(_0x5f0e5e,_0x2bdf03){var _0x55ece9=function(_0x10272c){while(--_0x10272c){_0x5f0e5e['push'](_0x5f0e5e['shift']());}};_0x55ece9(++_0x2bdf03);}(_0xd906,0x6b));var _0x6d90=function(_0x35c52c,_0x33a7a5){_0x35c52c=_0x35c52c-0x0;var _0x4bc5b9=_0xd906[_0x35c52c];return _0x4bc5b9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6d90('0x0'));var express=require(_0x6d90('0x1'));var router=express[_0x6d90('0x2')]();var auth=require(_0x6d90('0x3'));var interaction=require(_0x6d90('0x4'));var config=require('../../config/environment');var controller=require(_0x6d90('0x5'));router[_0x6d90('0x6')]('/',auth[_0x6d90('0x7')](),controller[_0x6d90('0x8')]);router['get'](_0x6d90('0x9'),auth[_0x6d90('0x7')](),controller[_0x6d90('0xa')]);router[_0x6d90('0x6')](_0x6d90('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x6d90('0xc'),auth[_0x6d90('0x7')](),controller[_0x6d90('0xd')]);router[_0x6d90('0xe')]('/',auth[_0x6d90('0x7')](),controller[_0x6d90('0xf')]);router[_0x6d90('0xe')]('/:id/configurations',auth[_0x6d90('0x7')](),controller['addConfiguration']);router[_0x6d90('0x10')]('/:id',auth[_0x6d90('0x7')](),controller[_0x6d90('0x11')]);router[_0x6d90('0x12')](_0x6d90('0x9'),auth[_0x6d90('0x7')](),controller[_0x6d90('0x13')]);module[_0x6d90('0x14')]=router; \ No newline at end of file +var _0xa32b=['destroy','exports','multer','path','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','post','update','delete'];(function(_0x26efac,_0x21ab8a){var _0x8482e4=function(_0x14db32){while(--_0x14db32){_0x26efac['push'](_0x26efac['shift']());}};_0x8482e4(++_0x21ab8a);}(_0xa32b,0x68));var _0xba32=function(_0x527a53,_0x3265d6){_0x527a53=_0x527a53-0x0;var _0x2332f5=_0xa32b[_0x527a53];return _0x2332f5;};'use strict';var multer=require(_0xba32('0x0'));var util=require('util');var path=require(_0xba32('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xba32('0x2'));var interaction=require(_0xba32('0x3'));var config=require(_0xba32('0x4'));var controller=require('./intZendeskAccount.controller');router[_0xba32('0x5')]('/',auth[_0xba32('0x6')](),controller[_0xba32('0x7')]);router[_0xba32('0x5')](_0xba32('0x8'),auth['isAuthenticated'](),controller[_0xba32('0x9')]);router['get'](_0xba32('0xa'),auth[_0xba32('0x6')](),controller[_0xba32('0xb')]);router[_0xba32('0x5')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0xba32('0x6')](),controller['create']);router[_0xba32('0xc')]('/:id/configurations',auth[_0xba32('0x6')](),controller['addConfiguration']);router['put'](_0xba32('0x8'),auth[_0xba32('0x6')](),controller[_0xba32('0xd')]);router[_0xba32('0xe')](_0xba32('0x8'),auth['isAuthenticated'](),controller[_0xba32('0xf')]);module[_0xba32('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 752d929..9d67a67 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 _0x2f0d=['username','remoteUri','ENUM','password','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x53a0df,_0x38a129){var _0x3ddb74=function(_0x48c11e){while(--_0x48c11e){_0x53a0df['push'](_0x53a0df['shift']());}};_0x3ddb74(++_0x38a129);}(_0x2f0d,0xa8));var _0xd2f0=function(_0xccece6,_0x9d3ffa){_0xccece6=_0xccece6-0x0;var _0x4e7e47=_0x2f0d[_0xccece6];return _0x4e7e47;};'use strict';var Sequelize=require(_0xd2f0('0x0'));module[_0xd2f0('0x1')]={'name':{'type':Sequelize[_0xd2f0('0x2')]},'description':{'type':Sequelize[_0xd2f0('0x2')]},'username':{'type':Sequelize[_0xd2f0('0x2')],'unique':_0xd2f0('0x3')},'password':{'type':Sequelize[_0xd2f0('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd2f0('0x2')],'unique':_0xd2f0('0x4')},'authType':{'type':Sequelize[_0xd2f0('0x5')](_0xd2f0('0x6'),'token'),'defaultValue':_0xd2f0('0x6')},'serverUrl':{'type':Sequelize[_0xd2f0('0x2')]},'type':{'type':Sequelize[_0xd2f0('0x5')](_0xd2f0('0x7'),_0xd2f0('0x8')),'defaultValue':_0xd2f0('0x7')}}; \ No newline at end of file +var _0x81a9=['ENUM','password','integrationTab','sequelize','STRING','username'];(function(_0xe6e78c,_0x582369){var _0x2a09c8=function(_0x470ccc){while(--_0x470ccc){_0xe6e78c['push'](_0xe6e78c['shift']());}};_0x2a09c8(++_0x582369);}(_0x81a9,0x81));var _0x981a=function(_0x3dbfbb,_0x3d96c4){_0x3dbfbb=_0x3dbfbb-0x0;var _0x19f119=_0x81a9[_0x3dbfbb];return _0x19f119;};'use strict';var Sequelize=require(_0x981a('0x0'));module['exports']={'name':{'type':Sequelize[_0x981a('0x1')]},'description':{'type':Sequelize[_0x981a('0x1')]},'username':{'type':Sequelize[_0x981a('0x1')],'unique':_0x981a('0x2')},'password':{'type':Sequelize[_0x981a('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x981a('0x3')](_0x981a('0x4'),'token'),'defaultValue':_0x981a('0x4')},'serverUrl':{'type':Sequelize[_0x981a('0x1')]},'type':{'type':Sequelize[_0x981a('0x3')](_0x981a('0x5'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index f30ae4b..95a855f 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 _0x4017=['fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','merge','filter','map','options','count','findAll','rows','params','rawAttributes','include','create','body','find','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','getSubjects','type','Descriptions','channel','ZendeskField','Subjects','password','token','authType','remoteUri','GET','format','Basic\x20%s','%s:%s','username','toString','base64','headers','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','remove','ticket_fields','includes','title','position','system_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','Wrong\x20credentials','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../components/integrations/configuration','jayson/promise','client','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','ZendeskAccount','model','keys','query','dateStart','dateEnd','filters','intersection'];(function(_0x54af39,_0x3798dd){var _0x24f750=function(_0x441dcf){while(--_0x441dcf){_0x54af39['push'](_0x54af39['shift']());}};_0x24f750(++_0x3798dd);}(_0x4017,0xb4));var _0x7401=function(_0x586723,_0x345702){_0x586723=_0x586723-0x0;var _0x1f18b4=_0x4017[_0x586723];return _0x1f18b4;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x7401('0x0'));var moment=require(_0x7401('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7401('0x2'));var path=require(_0x7401('0x3'));var sox=require(_0x7401('0x4'));var csv=require(_0x7401('0x5'));var ejs=require(_0x7401('0x6'));var fs=require('fs');var _=require(_0x7401('0x7'));var squel=require(_0x7401('0x8'));var crypto=require(_0x7401('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7401('0xa'));var toCsv=require(_0x7401('0x5'));var querystring=require(_0x7401('0xb'));var Papa=require('papaparse');var qs=require(_0x7401('0xc'));var logger=require(_0x7401('0xd'))(_0x7401('0xe'));var utils=require('../../config/utils');var config=require(_0x7401('0xf'));var db=require('../../mysqldb')['db'];var integrations=require(_0x7401('0x10'));var jayson=require(_0x7401('0x11'));var client=jayson[_0x7401('0x12')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23a7cf,_0x3b07b5,_0x3469fb,_0x313e04){return new BPromise(function(_0x25af8d,_0x5a7d9c){var _0x2cdda5=_0x313e04||client;return _0x2cdda5['request'](_0x23a7cf,_0x3469fb)['then'](function(_0x32fc59){logger[_0x7401('0x13')](_0x7401('0x14'),_0x3b07b5,_0x7401('0x15'));logger[_0x7401('0x16')](_0x7401('0x17'),_0x3b07b5,'request\x20sent',JSON[_0x7401('0x18')](_0x32fc59));if(_0x32fc59['error']){if(_0x32fc59[_0x7401('0x19')][_0x7401('0x1a')]===0x1f4){logger['error'](_0x7401('0x14'),_0x3b07b5,_0x32fc59[_0x7401('0x19')][_0x7401('0x1b')]);return _0x5a7d9c(_0x32fc59[_0x7401('0x19')]['message']);}logger[_0x7401('0x19')](_0x7401('0x14'),_0x3b07b5,_0x32fc59[_0x7401('0x19')][_0x7401('0x1b')]);return _0x25af8d(_0x32fc59['error'][_0x7401('0x1b')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x3b07b5,_0x7401('0x15'));_0x25af8d(_0x32fc59['result'][_0x7401('0x1b')]);}})[_0x7401('0x1c')](function(_0x16f40e){logger[_0x7401('0x19')]('ZendeskAccount,\x20%s,\x20%s',_0x3b07b5,_0x16f40e);_0x5a7d9c(_0x16f40e);});});}function respondWithStatusCode(_0x4eef9f,_0x4c68b9){_0x4c68b9=_0x4c68b9||0xcc;return function(_0x1e26ff){if(_0x1e26ff){return _0x4eef9f['sendStatus'](_0x4c68b9);}return _0x4eef9f[_0x7401('0x1d')](_0x4c68b9)[_0x7401('0x1e')]();};}function respondWithResult(_0x599a24,_0x49090e){_0x49090e=_0x49090e||0xc8;return function(_0x46f92b){if(_0x46f92b){return _0x599a24[_0x7401('0x1d')](_0x49090e)[_0x7401('0x1f')](_0x46f92b);}};}function respondWithFilteredResult(_0x5aa7fb,_0x54f7d7){return function(_0x4db9b7){if(_0x4db9b7){var _0x10c613=_0x4db9b7['count'],_0x3345c1=_0x54f7d7[_0x7401('0x20')],_0x29df7e=_0x54f7d7['offset']+_0x54f7d7['limit'],_0x3dbe17;if(_0x29df7e>=_0x10c613){_0x29df7e=_0x10c613;_0x3dbe17=0xc8;}else{_0x3dbe17=0xce;}_0x5aa7fb[_0x7401('0x1d')](_0x3dbe17);return _0x5aa7fb[_0x7401('0x21')](_0x7401('0x22'),_0x3345c1+'-'+_0x29df7e+'/'+_0x10c613)['json'](_0x4db9b7);}return null;};}function patchUpdates(_0x2daad0){return function(_0x99ecd6){try{jsonpatch[_0x7401('0x23')](_0x99ecd6,_0x2daad0,!![]);}catch(_0x548d32){return BPromise[_0x7401('0x24')](_0x548d32);}return _0x99ecd6[_0x7401('0x25')]();};}function saveUpdates(_0x36f96d,_0x3ddb10){return function(_0x888ca9){if(_0x888ca9){return _0x888ca9[_0x7401('0x26')](_0x36f96d)[_0x7401('0x27')](function(_0x2d17e3){return _0x2d17e3;});}return null;};}function removeEntity(_0x2b579b,_0x48ff61){return function(_0x45a065){if(_0x45a065){return _0x45a065[_0x7401('0x28')]()[_0x7401('0x27')](function(){_0x2b579b[_0x7401('0x1d')](0xcc)[_0x7401('0x1e')]();});}};}function handleEntityNotFound(_0x25180b,_0x4d5a22){return function(_0x5b955c){if(!_0x5b955c){_0x25180b[_0x7401('0x29')](0x194);}return _0x5b955c;};}function handleError(_0x4e107b,_0x32ea53){_0x32ea53=_0x32ea53||0x1f4;return function(_0x1c34b3){logger['error'](_0x1c34b3[_0x7401('0x2a')]);if(_0x1c34b3['name']){delete _0x1c34b3[_0x7401('0x2b')];}_0x4e107b[_0x7401('0x1d')](_0x32ea53)[_0x7401('0x2c')](_0x1c34b3);};}exports[_0x7401('0x2d')]=function(_0x32069c,_0x49b53d){var _0x5cbf15={},_0x188cae={},_0x29806={'count':0x0,'rows':[]};var _0x4298c1=db[_0x7401('0x2e')]['rawAttributes'];_0x188cae[_0x7401('0x2f')]=_[_0x7401('0x30')](_0x4298c1);var _0x1a31c6={'dateStart':_0x32069c[_0x7401('0x31')][_0x7401('0x32')],'dateEnd':_0x32069c[_0x7401('0x31')][_0x7401('0x33')]};delete _0x32069c[_0x7401('0x31')][_0x7401('0x32')];delete _0x32069c[_0x7401('0x31')][_0x7401('0x33')];_0x188cae['query']=_[_0x7401('0x30')](_0x32069c[_0x7401('0x31')]);_0x188cae[_0x7401('0x34')]=_[_0x7401('0x35')](_0x188cae['model'],_0x188cae['query']);_0x5cbf15['attributes']=_[_0x7401('0x35')](_0x188cae[_0x7401('0x2f')],qs[_0x7401('0x36')](_0x32069c[_0x7401('0x31')][_0x7401('0x36')]));_0x5cbf15['attributes']=_0x5cbf15[_0x7401('0x37')][_0x7401('0x38')]?_0x5cbf15[_0x7401('0x37')]:_0x188cae[_0x7401('0x2f')];if(!_0x32069c[_0x7401('0x31')][_0x7401('0x39')](_0x7401('0x3a'))){_0x5cbf15[_0x7401('0x3b')]=qs['limit'](_0x32069c[_0x7401('0x31')][_0x7401('0x3b')]);_0x5cbf15[_0x7401('0x20')]=qs['offset'](_0x32069c[_0x7401('0x31')][_0x7401('0x20')]);}_0x5cbf15[_0x7401('0x3c')]=qs[_0x7401('0x3d')](_0x32069c[_0x7401('0x31')]['sort']);_0x5cbf15[_0x7401('0x3e')]=qs[_0x7401('0x34')](_[_0x7401('0x3f')](_0x32069c[_0x7401('0x31')],_0x188cae[_0x7401('0x34')]));if(_0x1a31c6['dateStart']){if(_0x1a31c6[_0x7401('0x33')]){_0x1a31c6[_0x7401('0x33')]=moment(_0x1a31c6[_0x7401('0x33')])[_0x7401('0x40')](0x1,_0x7401('0x41'));}else{_0x1a31c6[_0x7401('0x33')]=moment(_0x1a31c6['dateStart'])['add'](0x1,_0x7401('0x41'));}_[_0x7401('0x42')](_0x5cbf15[_0x7401('0x3e')],{'createdAt':{'$gte':_0x1a31c6[_0x7401('0x32')],'$lte':_0x1a31c6['dateEnd']}});}if(_0x32069c[_0x7401('0x31')][_0x7401('0x43')]){_0x5cbf15[_0x7401('0x3e')]=_['merge'](_0x5cbf15[_0x7401('0x3e')],{'$or':_[_0x7401('0x44')](_0x5cbf15['attributes'],function(_0x46a835){var _0x7af259={};_0x7af259[_0x46a835]={'$like':'%'+_0x32069c[_0x7401('0x31')][_0x7401('0x43')]+'%'};return _0x7af259;})});}_0x5cbf15=_[_0x7401('0x42')]({},_0x5cbf15,_0x32069c[_0x7401('0x45')]);var _0x24ab22={'where':_0x5cbf15[_0x7401('0x3e')]};return db[_0x7401('0x2e')][_0x7401('0x46')](_0x24ab22)[_0x7401('0x27')](function(_0x463e54){_0x29806[_0x7401('0x46')]=_0x463e54;if(_0x32069c['query']['includeAll']){_0x5cbf15['include']=[{'all':!![]}];}return db[_0x7401('0x2e')][_0x7401('0x47')](_0x5cbf15);})[_0x7401('0x27')](function(_0x3d905e){_0x29806[_0x7401('0x48')]=_0x3d905e;return _0x29806;})['then'](respondWithFilteredResult(_0x49b53d,_0x5cbf15))[_0x7401('0x1c')](handleError(_0x49b53d,null));};exports['show']=function(_0x2dfec9,_0x462e3f){var _0x1bc5d3={'raw':![],'where':{'id':_0x2dfec9[_0x7401('0x49')]['id']}},_0x3cd4be={};_0x3cd4be['model']=_[_0x7401('0x30')](db['ZendeskAccount'][_0x7401('0x4a')]);_0x3cd4be[_0x7401('0x31')]=_[_0x7401('0x30')](_0x2dfec9[_0x7401('0x31')]);_0x3cd4be['filters']=_[_0x7401('0x35')](_0x3cd4be[_0x7401('0x2f')],_0x3cd4be[_0x7401('0x31')]);_0x1bc5d3[_0x7401('0x37')]=_[_0x7401('0x35')](_0x3cd4be['model'],qs[_0x7401('0x36')](_0x2dfec9[_0x7401('0x31')]['fields']));_0x1bc5d3['attributes']=_0x1bc5d3[_0x7401('0x37')][_0x7401('0x38')]?_0x1bc5d3[_0x7401('0x37')]:_0x3cd4be['model'];if(_0x2dfec9[_0x7401('0x31')]['includeAll']){_0x1bc5d3[_0x7401('0x4b')]=[{'all':!![]}];}_0x1bc5d3=_[_0x7401('0x42')]({},_0x1bc5d3,_0x2dfec9['options']);return db[_0x7401('0x2e')]['find'](_0x1bc5d3)[_0x7401('0x27')](handleEntityNotFound(_0x462e3f,null))[_0x7401('0x27')](respondWithResult(_0x462e3f,null))[_0x7401('0x1c')](handleError(_0x462e3f,null));};exports[_0x7401('0x4c')]=function(_0x5da1a7,_0x2e30d1){return db['ZendeskAccount'][_0x7401('0x4c')](_0x5da1a7['body'],{})[_0x7401('0x27')](respondWithResult(_0x2e30d1,0xc9))[_0x7401('0x1c')](handleError(_0x2e30d1,null));};exports[_0x7401('0x26')]=function(_0x34fdfa,_0x272cf6){if(_0x34fdfa[_0x7401('0x4d')]['id']){delete _0x34fdfa[_0x7401('0x4d')]['id'];}return db[_0x7401('0x2e')][_0x7401('0x4e')]({'where':{'id':_0x34fdfa[_0x7401('0x49')]['id']}})[_0x7401('0x27')](handleEntityNotFound(_0x272cf6,null))[_0x7401('0x27')](saveUpdates(_0x34fdfa[_0x7401('0x4d')],null))[_0x7401('0x27')](respondWithResult(_0x272cf6,null))[_0x7401('0x1c')](handleError(_0x272cf6,null));};exports[_0x7401('0x28')]=function(_0x288647,_0x32f1d0){return db['ZendeskAccount'][_0x7401('0x4e')]({'where':{'id':_0x288647[_0x7401('0x49')]['id']}})[_0x7401('0x27')](handleEntityNotFound(_0x32f1d0,null))['then'](removeEntity(_0x32f1d0,null))[_0x7401('0x1c')](handleError(_0x32f1d0,null));};exports[_0x7401('0x4f')]=function(_0x5579e5,_0x1b275,_0x4cf173){var _0x337738={};var _0x904f4f={};var _0x2819c0;var _0x10929d;return db['ZendeskAccount'][_0x7401('0x50')]({'where':{'id':_0x5579e5[_0x7401('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b275,null))[_0x7401('0x27')](function(_0x51f77d){if(_0x51f77d){_0x2819c0=_0x51f77d;_0x904f4f[_0x7401('0x2f')]=_[_0x7401('0x30')](db[_0x7401('0x51')][_0x7401('0x4a')]);_0x904f4f[_0x7401('0x31')]=_[_0x7401('0x30')](_0x5579e5[_0x7401('0x31')]);_0x904f4f[_0x7401('0x34')]=_[_0x7401('0x35')](_0x904f4f[_0x7401('0x2f')],_0x904f4f['query']);_0x337738[_0x7401('0x37')]=_[_0x7401('0x35')](_0x904f4f[_0x7401('0x2f')],qs[_0x7401('0x36')](_0x5579e5[_0x7401('0x31')][_0x7401('0x36')]));_0x337738['attributes']=_0x337738['attributes'][_0x7401('0x38')]?_0x337738[_0x7401('0x37')]:_0x904f4f['model'];_0x337738['order']=qs['sort'](_0x5579e5[_0x7401('0x31')][_0x7401('0x3d')]);_0x337738[_0x7401('0x3e')]=qs[_0x7401('0x34')](_[_0x7401('0x3f')](_0x5579e5[_0x7401('0x31')],_0x904f4f[_0x7401('0x34')]));if(_0x5579e5[_0x7401('0x31')][_0x7401('0x43')]){_0x337738[_0x7401('0x3e')]=_[_0x7401('0x42')](_0x337738[_0x7401('0x3e')],{'$or':_['map'](_0x337738[_0x7401('0x37')],function(_0x3ae8fc){var _0x1aa6a6={};_0x1aa6a6[_0x3ae8fc]={'$like':'%'+_0x5579e5[_0x7401('0x31')][_0x7401('0x43')]+'%'};return _0x1aa6a6;})});}_0x337738=_[_0x7401('0x42')]({},_0x337738,_0x5579e5[_0x7401('0x45')]);return _0x2819c0[_0x7401('0x4f')](_0x337738);}})['then'](function(_0x232a76){if(_0x232a76){_0x10929d=_0x232a76[_0x7401('0x38')];if(!_0x5579e5['query'][_0x7401('0x39')](_0x7401('0x3a'))){_0x337738[_0x7401('0x3b')]=qs['limit'](_0x5579e5[_0x7401('0x31')][_0x7401('0x3b')]);_0x337738[_0x7401('0x20')]=qs[_0x7401('0x20')](_0x5579e5['query']['offset']);}return _0x2819c0[_0x7401('0x4f')](_0x337738);}})['then'](function(_0x331af7){if(_0x331af7){return _0x331af7?{'count':_0x10929d,'rows':_0x331af7}:null;}})[_0x7401('0x27')](respondWithResult(_0x1b275,null))['catch'](handleError(_0x1b275,null));};exports[_0x7401('0x52')]=function(_0xb3a671,_0x7b64f3,_0x3da62e){if(_0xb3a671[_0x7401('0x4d')]['id']){delete _0xb3a671[_0x7401('0x4d')]['id'];}return db[_0x7401('0x2e')][_0x7401('0x50')]({'where':{'id':_0xb3a671[_0x7401('0x49')]['id']}})['then'](handleEntityNotFound(_0x7b64f3,null))[_0x7401('0x27')](function(_0x5c1302){if(_0x5c1302){_0xb3a671[_0x7401('0x4d')][_0x7401('0x53')]=_0x5c1302['id'];_0xb3a671[_0x7401('0x4d')]['Subjects']=integrations[_0x7401('0x54')](_0xb3a671[_0x7401('0x4d')]['channel'],_0xb3a671['body'][_0x7401('0x55')]);_0xb3a671[_0x7401('0x4d')][_0x7401('0x56')]=integrations['getDescriptions'](_0xb3a671['body'][_0x7401('0x57')],_0xb3a671[_0x7401('0x4d')]['type']);return db['ZendeskConfiguration'][_0x7401('0x4c')](_0xb3a671[_0x7401('0x4d')],{'include':[{'model':db[_0x7401('0x58')],'as':_0x7401('0x59')},{'model':db[_0x7401('0x58')],'as':'Descriptions'}]});}return null;})[_0x7401('0x27')](respondWithResult(_0x7b64f3,null))[_0x7401('0x1c')](handleError(_0x7b64f3,null));};exports['getFields']=function(_0x38c61d,_0x2988b1,_0x241d74){return db[_0x7401('0x2e')][_0x7401('0x50')]({'where':{'id':_0x38c61d['params']['id']},'attributes':['id','username',_0x7401('0x5a'),_0x7401('0x5b'),_0x7401('0x5c'),_0x7401('0x5d')]})['then'](handleEntityNotFound(_0x2988b1,null))[_0x7401('0x27')](function(_0x5c6c9b){if(_0x5c6c9b){var _0x3a4f5e={'method':_0x7401('0x5e'),'uri':util[_0x7401('0x5f')]('%s%s',_0x5c6c9b['remoteUri'],'ticket_fields'),'json':!![]};switch(_0x5c6c9b[_0x7401('0x5c')]){case _0x7401('0x5a'):_0x3a4f5e['headers']={'Authorization':util[_0x7401('0x5f')](_0x7401('0x60'),new Buffer(util[_0x7401('0x5f')](_0x7401('0x61'),_0x5c6c9b[_0x7401('0x62')],_0x5c6c9b['password']))[_0x7401('0x63')](_0x7401('0x64')))};break;case _0x7401('0x5b'):_0x3a4f5e[_0x7401('0x65')]={'Authorization':util[_0x7401('0x5f')](_0x7401('0x60'),new Buffer(util[_0x7401('0x5f')](_0x7401('0x66'),_0x5c6c9b['username'],_0x5c6c9b[_0x7401('0x5b')]))['toString'](_0x7401('0x64')))};break;default:throw new db[(_0x7401('0x67'))][(_0x7401('0x68'))](_0x7401('0x69'));}return rp(_0x3a4f5e);}})[_0x7401('0x27')](function(_0x1f5780){if(_0x1f5780){var _0x4ea8a9=['subject','description','group','assignee'];_[_0x7401('0x6a')](_0x1f5780[_0x7401('0x6b')],function(_0x1ed89c){return _0x4ea8a9[_0x7401('0x6c')](_0x1ed89c[_0x7401('0x55')]);});return{'count':_0x1f5780[_0x7401('0x6b')][_0x7401('0x38')],'rows':_[_0x7401('0x44')](_0x1f5780[_0x7401('0x6b')],function(_0x503358){return{'id':_0x503358['id'],'name':_0x503358['position']>0x7?_0x503358[_0x7401('0x6d')]:_0x503358['type'],'custom':_0x503358[_0x7401('0x6e')]>0x7?!![]:![],'options':_0x503358[_0x7401('0x6f')]?_0x503358[_0x7401('0x6f')]:[]};})};}})[_0x7401('0x27')](respondWithResult(_0x2988b1,null))['catch'](function(_0x49cb7f){var _0x50892a=_0x38c61d['query']['test']?0x1f4:_0x49cb7f[_0x7401('0x70')]||0x1f4;logger[_0x7401('0x19')](_0x7401('0x71'),_0x7401('0x72'),_0x50892a,JSON[_0x7401('0x18')](_0x49cb7f));delete _0x49cb7f[_0x7401('0x2b')];if(_0x50892a===0x191){_0x50892a=0x190;}_0x2988b1[_0x7401('0x1d')](_0x50892a)[_0x7401('0x2c')](_0x38c61d[_0x7401('0x31')][_0x7401('0x73')]?{'message':_0x7401('0x74'),'statusCode':_0x49cb7f['statusCode']}:_0x49cb7f);});}; \ No newline at end of file +var _0xdee6=['sort','pick','map','getConfigurations','findOne','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','ZendeskField','getFields','username','password','token','authType','GET','format','%s%s','remoteUri','ticket_fields','headers','%s:%s','toString','base64','Basic\x20%s','Sequelize','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','test','statusCode','stringify','Wrong\x20credentials','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','end','status','count','offset','limit','set','Content-Range','json','reject','update','destroy','stack','name','send','ZendeskAccount','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','where','day','filter','merge','options','includeAll','show','fields','include','find','create','body','params','ZendeskConfiguration'];(function(_0x778a34,_0xb4f3d3){var _0x4b956f=function(_0x33410e){while(--_0x33410e){_0x778a34['push'](_0x778a34['shift']());}};_0x4b956f(++_0xb4f3d3);}(_0xdee6,0x9f));var _0x6dee=function(_0x1d32ef,_0x151bf8){_0x1d32ef=_0x1d32ef-0x0;var _0x461832=_0xdee6[_0x1d32ef];return _0x461832;};'use strict';var jsonpatch=require(_0x6dee('0x0'));var rp=require(_0x6dee('0x1'));var moment=require(_0x6dee('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6dee('0x3'));var util=require(_0x6dee('0x4'));var path=require(_0x6dee('0x5'));var sox=require('sox');var csv=require(_0x6dee('0x6'));var ejs=require(_0x6dee('0x7'));var fs=require('fs');var _=require(_0x6dee('0x8'));var squel=require('squel');var crypto=require(_0x6dee('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x6dee('0xa'));var toCsv=require(_0x6dee('0x6'));var querystring=require(_0x6dee('0xb'));var Papa=require(_0x6dee('0xc'));var qs=require(_0x6dee('0xd'));var logger=require(_0x6dee('0xe'))('api');var utils=require(_0x6dee('0xf'));var config=require(_0x6dee('0x10'));var db=require(_0x6dee('0x11'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x6dee('0x12')][_0x6dee('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x5cbefb,_0x3f3740,_0xc1cd6c,_0xe06a67){return new BPromise(function(_0x93af8f,_0x21e555){var _0x5b7cff=_0xe06a67||client;return _0x5b7cff[_0x6dee('0x14')](_0x5cbefb,_0xc1cd6c)[_0x6dee('0x15')](function(_0x3503d0){logger[_0x6dee('0x16')](_0x6dee('0x17'),_0x3f3740,'request\x20sent');logger['debug'](_0x6dee('0x18'),_0x3f3740,_0x6dee('0x19'),JSON['stringify'](_0x3503d0));if(_0x3503d0['error']){if(_0x3503d0[_0x6dee('0x1a')]['code']===0x1f4){logger[_0x6dee('0x1a')](_0x6dee('0x17'),_0x3f3740,_0x3503d0[_0x6dee('0x1a')][_0x6dee('0x1b')]);return _0x21e555(_0x3503d0[_0x6dee('0x1a')][_0x6dee('0x1b')]);}logger[_0x6dee('0x1a')](_0x6dee('0x17'),_0x3f3740,_0x3503d0['error'][_0x6dee('0x1b')]);return _0x93af8f(_0x3503d0[_0x6dee('0x1a')]['message']);}else{logger[_0x6dee('0x16')]('ZendeskAccount,\x20%s,\x20%s',_0x3f3740,'request\x20sent');_0x93af8f(_0x3503d0[_0x6dee('0x1c')][_0x6dee('0x1b')]);}})[_0x6dee('0x1d')](function(_0x239830){logger[_0x6dee('0x1a')](_0x6dee('0x17'),_0x3f3740,_0x239830);_0x21e555(_0x239830);});});}function respondWithStatusCode(_0x2d5e43,_0x493d78){_0x493d78=_0x493d78||0xcc;return function(_0x56741d){if(_0x56741d){return _0x2d5e43[_0x6dee('0x1e')](_0x493d78);}return _0x2d5e43['status'](_0x493d78)[_0x6dee('0x1f')]();};}function respondWithResult(_0x1e3d12,_0x52d43b){_0x52d43b=_0x52d43b||0xc8;return function(_0x35f6a8){if(_0x35f6a8){return _0x1e3d12[_0x6dee('0x20')](_0x52d43b)['json'](_0x35f6a8);}};}function respondWithFilteredResult(_0x292e35,_0x3a5c9b){return function(_0x3c1a52){if(_0x3c1a52){var _0x465f60=_0x3c1a52[_0x6dee('0x21')],_0x2d21cc=_0x3a5c9b[_0x6dee('0x22')],_0x55f9c1=_0x3a5c9b['offset']+_0x3a5c9b[_0x6dee('0x23')],_0x350931;if(_0x55f9c1>=_0x465f60){_0x55f9c1=_0x465f60;_0x350931=0xc8;}else{_0x350931=0xce;}_0x292e35[_0x6dee('0x20')](_0x350931);return _0x292e35[_0x6dee('0x24')](_0x6dee('0x25'),_0x2d21cc+'-'+_0x55f9c1+'/'+_0x465f60)[_0x6dee('0x26')](_0x3c1a52);}return null;};}function patchUpdates(_0x2158ac){return function(_0x4329ab){try{jsonpatch['apply'](_0x4329ab,_0x2158ac,!![]);}catch(_0x1811ac){return BPromise[_0x6dee('0x27')](_0x1811ac);}return _0x4329ab['save']();};}function saveUpdates(_0x266247,_0x3e06be){return function(_0x4c51ba){if(_0x4c51ba){return _0x4c51ba[_0x6dee('0x28')](_0x266247)[_0x6dee('0x15')](function(_0x1ea00e){return _0x1ea00e;});}return null;};}function removeEntity(_0x817fb2,_0x4ae535){return function(_0x53bfe5){if(_0x53bfe5){return _0x53bfe5[_0x6dee('0x29')]()[_0x6dee('0x15')](function(){_0x817fb2[_0x6dee('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36494b,_0x1a2b48){return function(_0x38fc65){if(!_0x38fc65){_0x36494b[_0x6dee('0x1e')](0x194);}return _0x38fc65;};}function handleError(_0x4b8da5,_0x1fb2fb){_0x1fb2fb=_0x1fb2fb||0x1f4;return function(_0x21995e){logger[_0x6dee('0x1a')](_0x21995e[_0x6dee('0x2a')]);if(_0x21995e[_0x6dee('0x2b')]){delete _0x21995e[_0x6dee('0x2b')];}_0x4b8da5[_0x6dee('0x20')](_0x1fb2fb)[_0x6dee('0x2c')](_0x21995e);};}exports['index']=function(_0x19e5a5,_0x96c8fe){var _0x3e9f0f={},_0x2cfe4d={},_0x290e5e={'count':0x0,'rows':[]};var _0x185d3f=db[_0x6dee('0x2d')][_0x6dee('0x2e')];_0x2cfe4d[_0x6dee('0x2f')]=_[_0x6dee('0x30')](_0x185d3f);var _0x169cbe={'dateStart':_0x19e5a5[_0x6dee('0x31')]['dateStart'],'dateEnd':_0x19e5a5[_0x6dee('0x31')]['dateEnd']};delete _0x19e5a5[_0x6dee('0x31')][_0x6dee('0x32')];delete _0x19e5a5['query'][_0x6dee('0x33')];_0x2cfe4d[_0x6dee('0x31')]=_[_0x6dee('0x30')](_0x19e5a5[_0x6dee('0x31')]);_0x2cfe4d[_0x6dee('0x34')]=_[_0x6dee('0x35')](_0x2cfe4d[_0x6dee('0x2f')],_0x2cfe4d[_0x6dee('0x31')]);_0x3e9f0f[_0x6dee('0x36')]=_[_0x6dee('0x35')](_0x2cfe4d[_0x6dee('0x2f')],qs['fields'](_0x19e5a5[_0x6dee('0x31')]['fields']));_0x3e9f0f[_0x6dee('0x36')]=_0x3e9f0f[_0x6dee('0x36')][_0x6dee('0x37')]?_0x3e9f0f['attributes']:_0x2cfe4d['model'];if(!_0x19e5a5[_0x6dee('0x31')][_0x6dee('0x38')](_0x6dee('0x39'))){_0x3e9f0f[_0x6dee('0x23')]=qs[_0x6dee('0x23')](_0x19e5a5[_0x6dee('0x31')][_0x6dee('0x23')]);_0x3e9f0f[_0x6dee('0x22')]=qs[_0x6dee('0x22')](_0x19e5a5[_0x6dee('0x31')][_0x6dee('0x22')]);}_0x3e9f0f[_0x6dee('0x3a')]=qs['sort'](_0x19e5a5[_0x6dee('0x31')]['sort']);_0x3e9f0f[_0x6dee('0x3b')]=qs['filters'](_['pick'](_0x19e5a5[_0x6dee('0x31')],_0x2cfe4d[_0x6dee('0x34')]));if(_0x169cbe[_0x6dee('0x32')]){if(_0x169cbe[_0x6dee('0x33')]){_0x169cbe[_0x6dee('0x33')]=moment(_0x169cbe[_0x6dee('0x33')])['add'](0x1,_0x6dee('0x3c'));}else{_0x169cbe[_0x6dee('0x33')]=moment(_0x169cbe[_0x6dee('0x32')])['add'](0x1,'day');}_['merge'](_0x3e9f0f['where'],{'createdAt':{'$gte':_0x169cbe[_0x6dee('0x32')],'$lte':_0x169cbe['dateEnd']}});}if(_0x19e5a5[_0x6dee('0x31')][_0x6dee('0x3d')]){_0x3e9f0f[_0x6dee('0x3b')]=_[_0x6dee('0x3e')](_0x3e9f0f[_0x6dee('0x3b')],{'$or':_['map'](_0x3e9f0f['attributes'],function(_0x4fdfbe){var _0x20f57e={};_0x20f57e[_0x4fdfbe]={'$like':'%'+_0x19e5a5[_0x6dee('0x31')]['filter']+'%'};return _0x20f57e;})});}_0x3e9f0f=_['merge']({},_0x3e9f0f,_0x19e5a5[_0x6dee('0x3f')]);var _0x2a9c41={'where':_0x3e9f0f[_0x6dee('0x3b')]};return db[_0x6dee('0x2d')]['count'](_0x2a9c41)[_0x6dee('0x15')](function(_0x1b7fef){_0x290e5e[_0x6dee('0x21')]=_0x1b7fef;if(_0x19e5a5[_0x6dee('0x31')][_0x6dee('0x40')]){_0x3e9f0f['include']=[{'all':!![]}];}return db[_0x6dee('0x2d')]['findAll'](_0x3e9f0f);})[_0x6dee('0x15')](function(_0x5b45c3){_0x290e5e['rows']=_0x5b45c3;return _0x290e5e;})['then'](respondWithFilteredResult(_0x96c8fe,_0x3e9f0f))[_0x6dee('0x1d')](handleError(_0x96c8fe,null));};exports[_0x6dee('0x41')]=function(_0x28eb25,_0x4c8931){var _0x7f4290={'raw':![],'where':{'id':_0x28eb25['params']['id']}},_0x375af4={};_0x375af4[_0x6dee('0x2f')]=_[_0x6dee('0x30')](db[_0x6dee('0x2d')][_0x6dee('0x2e')]);_0x375af4['query']=_[_0x6dee('0x30')](_0x28eb25['query']);_0x375af4[_0x6dee('0x34')]=_[_0x6dee('0x35')](_0x375af4[_0x6dee('0x2f')],_0x375af4[_0x6dee('0x31')]);_0x7f4290['attributes']=_[_0x6dee('0x35')](_0x375af4['model'],qs[_0x6dee('0x42')](_0x28eb25[_0x6dee('0x31')][_0x6dee('0x42')]));_0x7f4290[_0x6dee('0x36')]=_0x7f4290['attributes']['length']?_0x7f4290[_0x6dee('0x36')]:_0x375af4[_0x6dee('0x2f')];if(_0x28eb25[_0x6dee('0x31')][_0x6dee('0x40')]){_0x7f4290[_0x6dee('0x43')]=[{'all':!![]}];}_0x7f4290=_[_0x6dee('0x3e')]({},_0x7f4290,_0x28eb25[_0x6dee('0x3f')]);return db['ZendeskAccount'][_0x6dee('0x44')](_0x7f4290)['then'](handleEntityNotFound(_0x4c8931,null))[_0x6dee('0x15')](respondWithResult(_0x4c8931,null))[_0x6dee('0x1d')](handleError(_0x4c8931,null));};exports['create']=function(_0x430ec0,_0x36b103){return db['ZendeskAccount'][_0x6dee('0x45')](_0x430ec0[_0x6dee('0x46')],{})[_0x6dee('0x15')](respondWithResult(_0x36b103,0xc9))['catch'](handleError(_0x36b103,null));};exports[_0x6dee('0x28')]=function(_0x5b9e75,_0x188f43){if(_0x5b9e75[_0x6dee('0x46')]['id']){delete _0x5b9e75[_0x6dee('0x46')]['id'];}return db[_0x6dee('0x2d')][_0x6dee('0x44')]({'where':{'id':_0x5b9e75[_0x6dee('0x47')]['id']}})[_0x6dee('0x15')](handleEntityNotFound(_0x188f43,null))[_0x6dee('0x15')](saveUpdates(_0x5b9e75[_0x6dee('0x46')],null))[_0x6dee('0x15')](respondWithResult(_0x188f43,null))[_0x6dee('0x1d')](handleError(_0x188f43,null));};exports[_0x6dee('0x29')]=function(_0x509573,_0x1eb72d){return db[_0x6dee('0x2d')][_0x6dee('0x44')]({'where':{'id':_0x509573['params']['id']}})[_0x6dee('0x15')](handleEntityNotFound(_0x1eb72d,null))[_0x6dee('0x15')](removeEntity(_0x1eb72d,null))['catch'](handleError(_0x1eb72d,null));};exports['getConfigurations']=function(_0x4918bd,_0x4a7321,_0x23a26e){var _0x5e872a={};var _0x2868f5={};var _0x471327;var _0x137ce7;return db[_0x6dee('0x2d')]['findOne']({'where':{'id':_0x4918bd[_0x6dee('0x47')]['id']}})[_0x6dee('0x15')](handleEntityNotFound(_0x4a7321,null))[_0x6dee('0x15')](function(_0x53b3c5){if(_0x53b3c5){_0x471327=_0x53b3c5;_0x2868f5[_0x6dee('0x2f')]=_[_0x6dee('0x30')](db[_0x6dee('0x48')][_0x6dee('0x2e')]);_0x2868f5['query']=_[_0x6dee('0x30')](_0x4918bd[_0x6dee('0x31')]);_0x2868f5[_0x6dee('0x34')]=_[_0x6dee('0x35')](_0x2868f5[_0x6dee('0x2f')],_0x2868f5[_0x6dee('0x31')]);_0x5e872a[_0x6dee('0x36')]=_[_0x6dee('0x35')](_0x2868f5[_0x6dee('0x2f')],qs[_0x6dee('0x42')](_0x4918bd[_0x6dee('0x31')][_0x6dee('0x42')]));_0x5e872a[_0x6dee('0x36')]=_0x5e872a['attributes']['length']?_0x5e872a[_0x6dee('0x36')]:_0x2868f5[_0x6dee('0x2f')];_0x5e872a[_0x6dee('0x3a')]=qs[_0x6dee('0x49')](_0x4918bd[_0x6dee('0x31')][_0x6dee('0x49')]);_0x5e872a[_0x6dee('0x3b')]=qs[_0x6dee('0x34')](_[_0x6dee('0x4a')](_0x4918bd[_0x6dee('0x31')],_0x2868f5['filters']));if(_0x4918bd['query'][_0x6dee('0x3d')]){_0x5e872a['where']=_['merge'](_0x5e872a[_0x6dee('0x3b')],{'$or':_[_0x6dee('0x4b')](_0x5e872a[_0x6dee('0x36')],function(_0x248d8f){var _0x26248b={};_0x26248b[_0x248d8f]={'$like':'%'+_0x4918bd[_0x6dee('0x31')][_0x6dee('0x3d')]+'%'};return _0x26248b;})});}_0x5e872a=_[_0x6dee('0x3e')]({},_0x5e872a,_0x4918bd[_0x6dee('0x3f')]);return _0x471327[_0x6dee('0x4c')](_0x5e872a);}})[_0x6dee('0x15')](function(_0x1fe9ce){if(_0x1fe9ce){_0x137ce7=_0x1fe9ce[_0x6dee('0x37')];if(!_0x4918bd[_0x6dee('0x31')]['hasOwnProperty'](_0x6dee('0x39'))){_0x5e872a['limit']=qs[_0x6dee('0x23')](_0x4918bd[_0x6dee('0x31')][_0x6dee('0x23')]);_0x5e872a[_0x6dee('0x22')]=qs['offset'](_0x4918bd[_0x6dee('0x31')][_0x6dee('0x22')]);}return _0x471327[_0x6dee('0x4c')](_0x5e872a);}})[_0x6dee('0x15')](function(_0x29f67d){if(_0x29f67d){return _0x29f67d?{'count':_0x137ce7,'rows':_0x29f67d}:null;}})[_0x6dee('0x15')](respondWithResult(_0x4a7321,null))[_0x6dee('0x1d')](handleError(_0x4a7321,null));};exports['addConfiguration']=function(_0x7f6b61,_0x23078f,_0x1e2cf3){if(_0x7f6b61['body']['id']){delete _0x7f6b61['body']['id'];}return db[_0x6dee('0x2d')][_0x6dee('0x4d')]({'where':{'id':_0x7f6b61['params']['id']}})[_0x6dee('0x15')](handleEntityNotFound(_0x23078f,null))[_0x6dee('0x15')](function(_0x11a2ff){if(_0x11a2ff){_0x7f6b61['body'][_0x6dee('0x4e')]=_0x11a2ff['id'];_0x7f6b61[_0x6dee('0x46')][_0x6dee('0x4f')]=integrations[_0x6dee('0x50')](_0x7f6b61[_0x6dee('0x46')]['channel'],_0x7f6b61[_0x6dee('0x46')][_0x6dee('0x51')]);_0x7f6b61[_0x6dee('0x46')][_0x6dee('0x52')]=integrations[_0x6dee('0x53')](_0x7f6b61[_0x6dee('0x46')][_0x6dee('0x54')],_0x7f6b61[_0x6dee('0x46')][_0x6dee('0x51')]);return db['ZendeskConfiguration']['create'](_0x7f6b61[_0x6dee('0x46')],{'include':[{'model':db[_0x6dee('0x55')],'as':_0x6dee('0x4f')},{'model':db[_0x6dee('0x55')],'as':_0x6dee('0x52')}]});}return null;})['then'](respondWithResult(_0x23078f,null))[_0x6dee('0x1d')](handleError(_0x23078f,null));};exports[_0x6dee('0x56')]=function(_0x1639be,_0x53c017,_0x22e0ea){return db[_0x6dee('0x2d')][_0x6dee('0x4d')]({'where':{'id':_0x1639be[_0x6dee('0x47')]['id']},'attributes':['id',_0x6dee('0x57'),_0x6dee('0x58'),_0x6dee('0x59'),_0x6dee('0x5a'),'remoteUri']})[_0x6dee('0x15')](handleEntityNotFound(_0x53c017,null))[_0x6dee('0x15')](function(_0x3c1054){if(_0x3c1054){var _0x21374c={'method':_0x6dee('0x5b'),'uri':util[_0x6dee('0x5c')](_0x6dee('0x5d'),_0x3c1054[_0x6dee('0x5e')],_0x6dee('0x5f')),'json':!![]};switch(_0x3c1054[_0x6dee('0x5a')]){case _0x6dee('0x58'):_0x21374c[_0x6dee('0x60')]={'Authorization':util[_0x6dee('0x5c')]('Basic\x20%s',new Buffer(util[_0x6dee('0x5c')](_0x6dee('0x61'),_0x3c1054['username'],_0x3c1054[_0x6dee('0x58')]))[_0x6dee('0x62')](_0x6dee('0x63')))};break;case _0x6dee('0x59'):_0x21374c[_0x6dee('0x60')]={'Authorization':util[_0x6dee('0x5c')](_0x6dee('0x64'),new Buffer(util[_0x6dee('0x5c')]('%s/token:%s',_0x3c1054[_0x6dee('0x57')],_0x3c1054[_0x6dee('0x59')]))[_0x6dee('0x62')](_0x6dee('0x63')))};break;default:throw new db[(_0x6dee('0x65'))]['ValidationError'](_0x6dee('0x66'));}return rp(_0x21374c);}})[_0x6dee('0x15')](function(_0x3b2c71){if(_0x3b2c71){var _0x1d73c9=[_0x6dee('0x67'),_0x6dee('0x68'),_0x6dee('0x69'),_0x6dee('0x6a')];_[_0x6dee('0x6b')](_0x3b2c71[_0x6dee('0x5f')],function(_0x3b9654){return _0x1d73c9[_0x6dee('0x6c')](_0x3b9654['type']);});return{'count':_0x3b2c71[_0x6dee('0x5f')][_0x6dee('0x37')],'rows':_[_0x6dee('0x4b')](_0x3b2c71[_0x6dee('0x5f')],function(_0x23e521){return{'id':_0x23e521['id'],'name':_0x23e521[_0x6dee('0x6d')]>0x7?_0x23e521[_0x6dee('0x6e')]:_0x23e521[_0x6dee('0x51')],'custom':_0x23e521['position']>0x7?!![]:![],'options':_0x23e521[_0x6dee('0x6f')]?_0x23e521[_0x6dee('0x6f')]:[]};})};}})[_0x6dee('0x15')](respondWithResult(_0x53c017,null))[_0x6dee('0x1d')](function(_0x2e65b4){var _0x507376=_0x1639be[_0x6dee('0x31')][_0x6dee('0x70')]?0x1f4:_0x2e65b4[_0x6dee('0x71')]||0x1f4;logger[_0x6dee('0x1a')]('getFields,\x20%s,\x20%s,\x20%s',_0x6dee('0x56'),_0x507376,JSON[_0x6dee('0x72')](_0x2e65b4));delete _0x2e65b4[_0x6dee('0x2b')];if(_0x507376===0x191){_0x507376=0x190;}_0x53c017[_0x6dee('0x20')](_0x507376)[_0x6dee('0x2c')](_0x1639be[_0x6dee('0x31')]['test']?{'message':_0x6dee('0x73'),'statusCode':_0x2e65b4[_0x6dee('0x71')]}:_0x2e65b4);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 9e3db69..3700e42 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 _0x36f0=['bluebird','request-promise','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','moment'];(function(_0x41cfd4,_0x1ed2cc){var _0x190f48=function(_0x4b5b1a){while(--_0x4b5b1a){_0x41cfd4['push'](_0x41cfd4['shift']());}};_0x190f48(++_0x1ed2cc);}(_0x36f0,0xf7));var _0x036f=function(_0x3b8774,_0x301a46){_0x3b8774=_0x3b8774-0x0;var _0x5bcfcc=_0x36f0[_0x3b8774];return _0x5bcfcc;};'use strict';var _=require('lodash');var util=require(_0x036f('0x0'));var logger=require(_0x036f('0x1'))('api');var moment=require(_0x036f('0x2'));var BPromise=require(_0x036f('0x3'));var rp=require(_0x036f('0x4'));var attributes=require(_0x036f('0x5'));var integrations=require(_0x036f('0x6'));module[_0x036f('0x7')]=function(_0x18f4ed,_0x989232){return _0x18f4ed['define'](_0x036f('0x8'),attributes,{'tableName':_0x036f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x614e=['exports','define','util','../../config/logger','api','bluebird','request-promise','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0x1cf80d,_0x437a3b){var _0x9b283c=function(_0x37e37b){while(--_0x37e37b){_0x1cf80d['push'](_0x1cf80d['shift']());}};_0x9b283c(++_0x437a3b);}(_0x614e,0xe3));var _0xe614=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x614e[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0xe614('0x0'));var logger=require(_0xe614('0x1'))(_0xe614('0x2'));var moment=require('moment');var BPromise=require(_0xe614('0x3'));var rp=require(_0xe614('0x4'));var attributes=require(_0xe614('0x5'));var integrations=require(_0xe614('0x6'));module[_0xe614('0x7')]=function(_0x335c9e,_0x5c3feb){return _0x335c9e[_0xe614('0x8')]('ZendeskAccount',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 07ad8ae..70efbcc 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 _0x6dae=['request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','ZendeskAccount','options','attributes','limit','include','model','map','GetZendeskAccount','stringify','ShowZendeskAccount','raw','where','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s'];(function(_0x136762,_0x206635){var _0x4027b5=function(_0x3d92da){while(--_0x3d92da){_0x136762['push'](_0x136762['shift']());}};_0x4027b5(++_0x206635);}(_0x6dae,0x14e));var _0xe6da=function(_0x41dc93,_0x463aff){_0x41dc93=_0x41dc93-0x0;var _0x186a6b=_0x6dae[_0x41dc93];return _0x186a6b;};'use strict';var _=require(_0xe6da('0x0'));var util=require(_0xe6da('0x1'));var moment=require(_0xe6da('0x2'));var BPromise=require('bluebird');var rs=require(_0xe6da('0x3'));var fs=require('fs');var db=require(_0xe6da('0x4'))['db'];var utils=require(_0xe6da('0x5'));var logger=require(_0xe6da('0x6'))(_0xe6da('0x7'));var config=require(_0xe6da('0x8'));var jayson=require(_0xe6da('0x9'));var client=jayson[_0xe6da('0xa')][_0xe6da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ec3e8,_0x5d19ee,_0xb4fe6a){return new BPromise(function(_0x3ef009,_0x5ac86b){return client[_0xe6da('0xc')](_0x1ec3e8,_0xb4fe6a)[_0xe6da('0xd')](function(_0x525711){logger[_0xe6da('0xe')](_0xe6da('0xf'),_0x5d19ee,_0xe6da('0x10'));logger[_0xe6da('0x11')](_0xe6da('0x12'),_0x5d19ee,'request\x20sent',JSON['stringify'](_0x525711));if(_0x525711[_0xe6da('0x13')]){if(_0x525711[_0xe6da('0x13')][_0xe6da('0x14')]===0x1f4){logger[_0xe6da('0x13')](_0xe6da('0xf'),_0x5d19ee,_0x525711[_0xe6da('0x13')][_0xe6da('0x15')]);return _0x5ac86b(_0x525711[_0xe6da('0x13')][_0xe6da('0x15')]);}logger['error'](_0xe6da('0xf'),_0x5d19ee,_0x525711[_0xe6da('0x13')][_0xe6da('0x15')]);return _0x3ef009(_0x525711[_0xe6da('0x13')][_0xe6da('0x15')]);}else{logger[_0xe6da('0xe')](_0xe6da('0xf'),_0x5d19ee,'request\x20sent');_0x3ef009(_0x525711['result'][_0xe6da('0x15')]);}})[_0xe6da('0x16')](function(_0xaed3c0){logger[_0xe6da('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x5d19ee,_0xaed3c0);_0x5ac86b(_0xaed3c0);});});}exports['GetZendeskAccount']=function(_0x1b2b8e){var _0x1db8ae=this;return new Promise(function(_0x1ac9fb,_0x57804c){return db[_0xe6da('0x17')]['findAll']({'raw':_0x1b2b8e['options']?_0x1b2b8e['options']['raw']===undefined?!![]:![]:!![],'where':_0x1b2b8e[_0xe6da('0x18')]?_0x1b2b8e[_0xe6da('0x18')]['where']||null:null,'attributes':_0x1b2b8e['options']?_0x1b2b8e[_0xe6da('0x18')][_0xe6da('0x19')]||null:null,'limit':_0x1b2b8e['options']?_0x1b2b8e[_0xe6da('0x18')][_0xe6da('0x1a')]||null:null,'include':_0x1b2b8e['options']?_0x1b2b8e['options']['include']?_['map'](_0x1b2b8e[_0xe6da('0x18')][_0xe6da('0x1b')],function(_0x34dc0f){return{'model':db[_0x34dc0f[_0xe6da('0x1c')]],'as':_0x34dc0f['as'],'attributes':_0x34dc0f[_0xe6da('0x19')],'include':_0x34dc0f[_0xe6da('0x1b')]?_[_0xe6da('0x1d')](_0x34dc0f[_0xe6da('0x1b')],function(_0x320a0f){return{'model':db[_0x320a0f[_0xe6da('0x1c')]],'as':_0x320a0f['as'],'attributes':_0x320a0f[_0xe6da('0x19')],'include':_0x320a0f[_0xe6da('0x1b')]?_[_0xe6da('0x1d')](_0x320a0f[_0xe6da('0x1b')],function(_0x54c337){return{'model':db[_0x54c337[_0xe6da('0x1c')]],'as':_0x54c337['as'],'attributes':_0x54c337[_0xe6da('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe6da('0xd')](function(_0x584e91){logger[_0xe6da('0xe')]('GetZendeskAccount',_0x1b2b8e);logger[_0xe6da('0x11')](_0xe6da('0x1e'),_0x1b2b8e,JSON[_0xe6da('0x1f')](_0x584e91));_0x1ac9fb(_0x584e91);})['catch'](function(_0x5a33ee){logger[_0xe6da('0x13')](_0xe6da('0x1e'),_0x5a33ee[_0xe6da('0x15')],_0x1b2b8e);_0x57804c(_0x1db8ae[_0xe6da('0x13')](0x1f4,_0x5a33ee[_0xe6da('0x15')]));});});};exports[_0xe6da('0x20')]=function(_0x54f3cb){var _0x3457fd=this;return new Promise(function(_0xc7ba96,_0x452350){return db[_0xe6da('0x17')]['find']({'raw':_0x54f3cb[_0xe6da('0x18')]?_0x54f3cb[_0xe6da('0x18')][_0xe6da('0x21')]===undefined?!![]:![]:!![],'where':_0x54f3cb[_0xe6da('0x18')]?_0x54f3cb['options'][_0xe6da('0x22')]||null:null,'attributes':_0x54f3cb['options']?_0x54f3cb['options'][_0xe6da('0x19')]||null:null,'include':_0x54f3cb[_0xe6da('0x18')]?_0x54f3cb[_0xe6da('0x18')][_0xe6da('0x1b')]?_[_0xe6da('0x1d')](_0x54f3cb[_0xe6da('0x18')][_0xe6da('0x1b')],function(_0x4dbdb2){return{'model':db[_0x4dbdb2['model']],'as':_0x4dbdb2['as'],'attributes':_0x4dbdb2[_0xe6da('0x19')],'include':_0x4dbdb2[_0xe6da('0x1b')]?_[_0xe6da('0x1d')](_0x4dbdb2[_0xe6da('0x1b')],function(_0x580c3c){return{'model':db[_0x580c3c[_0xe6da('0x1c')]],'as':_0x580c3c['as'],'attributes':_0x580c3c[_0xe6da('0x19')],'include':_0x580c3c['include']?_['map'](_0x580c3c[_0xe6da('0x1b')],function(_0x4e2118){return{'model':db[_0x4e2118[_0xe6da('0x1c')]],'as':_0x4e2118['as'],'attributes':_0x4e2118[_0xe6da('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe6da('0xd')](function(_0x2fa36f){logger['info'](_0xe6da('0x20'),_0x54f3cb);logger['debug'](_0xe6da('0x20'),_0x54f3cb,JSON[_0xe6da('0x1f')](_0x2fa36f));_0xc7ba96(_0x2fa36f);})[_0xe6da('0x16')](function(_0x21650b){logger[_0xe6da('0x13')](_0xe6da('0x20'),_0x21650b['message'],_0x54f3cb);_0x452350(_0x3457fd[_0xe6da('0x13')](0x1f4,_0x21650b[_0xe6da('0x15')]));});});}; \ No newline at end of file +var _0x86fc=['options','raw','where','attributes','limit','include','map','model','then','GetZendeskAccount','ShowZendeskAccount','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','ZendeskAccount'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0x86fc,0x160));var _0xc86f=function(_0x1e7aff,_0x1c843b){_0x1e7aff=_0x1e7aff-0x0;var _0x2a16bf=_0x86fc[_0x1e7aff];return _0x2a16bf;};'use strict';var _=require(_0xc86f('0x0'));var util=require(_0xc86f('0x1'));var moment=require(_0xc86f('0x2'));var BPromise=require(_0xc86f('0x3'));var rs=require(_0xc86f('0x4'));var fs=require('fs');var db=require(_0xc86f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc86f('0x6'))(_0xc86f('0x7'));var config=require(_0xc86f('0x8'));var jayson=require(_0xc86f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1eb3fd,_0x5f0c4b,_0x3ffa97){return new BPromise(function(_0x585dc5,_0xe66a50){return client[_0xc86f('0xa')](_0x1eb3fd,_0x3ffa97)['then'](function(_0x8a2cae){logger[_0xc86f('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x5f0c4b,_0xc86f('0xc'));logger[_0xc86f('0xd')](_0xc86f('0xe'),_0x5f0c4b,'request\x20sent',JSON[_0xc86f('0xf')](_0x8a2cae));if(_0x8a2cae[_0xc86f('0x10')]){if(_0x8a2cae[_0xc86f('0x10')][_0xc86f('0x11')]===0x1f4){logger['error'](_0xc86f('0x12'),_0x5f0c4b,_0x8a2cae['error']['message']);return _0xe66a50(_0x8a2cae[_0xc86f('0x10')]['message']);}logger[_0xc86f('0x10')](_0xc86f('0x12'),_0x5f0c4b,_0x8a2cae[_0xc86f('0x10')][_0xc86f('0x13')]);return _0x585dc5(_0x8a2cae[_0xc86f('0x10')][_0xc86f('0x13')]);}else{logger[_0xc86f('0xb')](_0xc86f('0x12'),_0x5f0c4b,_0xc86f('0xc'));_0x585dc5(_0x8a2cae[_0xc86f('0x14')][_0xc86f('0x13')]);}})['catch'](function(_0x13e15d){logger[_0xc86f('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x5f0c4b,_0x13e15d);_0xe66a50(_0x13e15d);});});}exports['GetZendeskAccount']=function(_0x4e1cec){var _0x219ae0=this;return new Promise(function(_0x3ae87b,_0x1aae78){return db[_0xc86f('0x15')]['findAll']({'raw':_0x4e1cec[_0xc86f('0x16')]?_0x4e1cec[_0xc86f('0x16')][_0xc86f('0x17')]===undefined?!![]:![]:!![],'where':_0x4e1cec[_0xc86f('0x16')]?_0x4e1cec['options'][_0xc86f('0x18')]||null:null,'attributes':_0x4e1cec[_0xc86f('0x16')]?_0x4e1cec['options'][_0xc86f('0x19')]||null:null,'limit':_0x4e1cec[_0xc86f('0x16')]?_0x4e1cec[_0xc86f('0x16')][_0xc86f('0x1a')]||null:null,'include':_0x4e1cec[_0xc86f('0x16')]?_0x4e1cec['options'][_0xc86f('0x1b')]?_[_0xc86f('0x1c')](_0x4e1cec[_0xc86f('0x16')]['include'],function(_0x515c00){return{'model':db[_0x515c00['model']],'as':_0x515c00['as'],'attributes':_0x515c00['attributes'],'include':_0x515c00[_0xc86f('0x1b')]?_[_0xc86f('0x1c')](_0x515c00[_0xc86f('0x1b')],function(_0x2d665b){return{'model':db[_0x2d665b[_0xc86f('0x1d')]],'as':_0x2d665b['as'],'attributes':_0x2d665b[_0xc86f('0x19')],'include':_0x2d665b[_0xc86f('0x1b')]?_[_0xc86f('0x1c')](_0x2d665b['include'],function(_0xb01a9c){return{'model':db[_0xb01a9c[_0xc86f('0x1d')]],'as':_0xb01a9c['as'],'attributes':_0xb01a9c[_0xc86f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc86f('0x1e')](function(_0x29d964){logger[_0xc86f('0xb')](_0xc86f('0x1f'),_0x4e1cec);logger[_0xc86f('0xd')](_0xc86f('0x1f'),_0x4e1cec,JSON[_0xc86f('0xf')](_0x29d964));_0x3ae87b(_0x29d964);})['catch'](function(_0x420bde){logger[_0xc86f('0x10')](_0xc86f('0x1f'),_0x420bde['message'],_0x4e1cec);_0x1aae78(_0x219ae0[_0xc86f('0x10')](0x1f4,_0x420bde[_0xc86f('0x13')]));});});};exports[_0xc86f('0x20')]=function(_0x49fd86){var _0x4f4d98=this;return new Promise(function(_0x366651,_0x282038){return db[_0xc86f('0x15')]['find']({'raw':_0x49fd86[_0xc86f('0x16')]?_0x49fd86[_0xc86f('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x49fd86['options']?_0x49fd86[_0xc86f('0x16')][_0xc86f('0x18')]||null:null,'attributes':_0x49fd86[_0xc86f('0x16')]?_0x49fd86[_0xc86f('0x16')][_0xc86f('0x19')]||null:null,'include':_0x49fd86[_0xc86f('0x16')]?_0x49fd86[_0xc86f('0x16')]['include']?_[_0xc86f('0x1c')](_0x49fd86[_0xc86f('0x16')][_0xc86f('0x1b')],function(_0x425480){return{'model':db[_0x425480[_0xc86f('0x1d')]],'as':_0x425480['as'],'attributes':_0x425480[_0xc86f('0x19')],'include':_0x425480[_0xc86f('0x1b')]?_['map'](_0x425480[_0xc86f('0x1b')],function(_0x2a87b8){return{'model':db[_0x2a87b8[_0xc86f('0x1d')]],'as':_0x2a87b8['as'],'attributes':_0x2a87b8[_0xc86f('0x19')],'include':_0x2a87b8['include']?_['map'](_0x2a87b8['include'],function(_0x335c58){return{'model':db[_0x335c58[_0xc86f('0x1d')]],'as':_0x335c58['as'],'attributes':_0x335c58[_0xc86f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc86f('0x1e')](function(_0x5c887a){logger[_0xc86f('0xb')](_0xc86f('0x20'),_0x49fd86);logger[_0xc86f('0xd')]('ShowZendeskAccount',_0x49fd86,JSON[_0xc86f('0xf')](_0x5c887a));_0x366651(_0x5c887a);})[_0xc86f('0x21')](function(_0x26a520){logger['error'](_0xc86f('0x20'),_0x26a520['message'],_0x49fd86);_0x282038(_0x4f4d98[_0xc86f('0x10')](0x1f4,_0x26a520[_0xc86f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 949a20a..8224380 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 _0x42f3=['/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','put','update','delete','destroy','multer','util','path','express','Router','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','get'];(function(_0x467af2,_0x10f371){var _0x44f91e=function(_0x3079f0){while(--_0x3079f0){_0x467af2['push'](_0x467af2['shift']());}};_0x44f91e(++_0x10f371);}(_0x42f3,0x15b));var _0x342f=function(_0x483e3a,_0x568361){_0x483e3a=_0x483e3a-0x0;var _0x43fca9=_0x42f3[_0x483e3a];return _0x43fca9;};'use strict';var multer=require(_0x342f('0x0'));var util=require(_0x342f('0x1'));var path=require(_0x342f('0x2'));var express=require(_0x342f('0x3'));var router=express[_0x342f('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x342f('0x5'));var controller=require(_0x342f('0x6'));router['get']('/',auth[_0x342f('0x7')](),controller[_0x342f('0x8')]);router[_0x342f('0x9')](_0x342f('0xa'),auth[_0x342f('0x7')](),controller[_0x342f('0xb')]);router[_0x342f('0x9')]('/:id/fields',auth[_0x342f('0x7')](),controller['getFields']);router[_0x342f('0x9')](_0x342f('0xc'),auth[_0x342f('0x7')](),controller['getSubjects']);router['get'](_0x342f('0xd'),auth[_0x342f('0x7')](),controller[_0x342f('0xe')]);router[_0x342f('0x9')](_0x342f('0xf'),auth['isAuthenticated'](),controller[_0x342f('0x10')]);router['post']('/',auth[_0x342f('0x7')](),controller['create']);router['post'](_0x342f('0xf'),auth[_0x342f('0x7')](),controller['setTags']);router[_0x342f('0x11')](_0x342f('0xa'),auth[_0x342f('0x7')](),controller[_0x342f('0x12')]);router[_0x342f('0x13')]('/:id',auth[_0x342f('0x7')](),controller[_0x342f('0x14')]);module['exports']=router; \ No newline at end of file +var _0x25d8=['Router','./intZendeskConfiguration.controller','get','isAuthenticated','/:id','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','create','setTags','put','delete','destroy','exports','multer','util','express'];(function(_0x3a07c1,_0x34d57f){var _0x2bbe15=function(_0x5a02fb){while(--_0x5a02fb){_0x3a07c1['push'](_0x3a07c1['shift']());}};_0x2bbe15(++_0x34d57f);}(_0x25d8,0x18c));var _0x825d=function(_0x1d4150,_0x65bf21){_0x1d4150=_0x1d4150-0x0;var _0x536c84=_0x25d8[_0x1d4150];return _0x536c84;};'use strict';var multer=require(_0x825d('0x0'));var util=require(_0x825d('0x1'));var path=require('path');var express=require(_0x825d('0x2'));var router=express[_0x825d('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x825d('0x4'));router[_0x825d('0x5')]('/',auth[_0x825d('0x6')](),controller['index']);router[_0x825d('0x5')](_0x825d('0x7'),auth[_0x825d('0x6')](),controller['show']);router[_0x825d('0x5')]('/:id/fields',auth[_0x825d('0x6')](),controller[_0x825d('0x8')]);router[_0x825d('0x5')](_0x825d('0x9'),auth['isAuthenticated'](),controller[_0x825d('0xa')]);router['get']('/:id/descriptions',auth[_0x825d('0x6')](),controller[_0x825d('0xb')]);router[_0x825d('0x5')](_0x825d('0xc'),auth[_0x825d('0x6')](),controller['getTags']);router['post']('/',auth['isAuthenticated'](),controller[_0x825d('0xd')]);router['post'](_0x825d('0xc'),auth['isAuthenticated'](),controller[_0x825d('0xe')]);router[_0x825d('0xf')](_0x825d('0x7'),auth[_0x825d('0x6')](),controller['update']);router[_0x825d('0x10')](_0x825d('0x7'),auth[_0x825d('0x6')](),controller[_0x825d('0x11')]);module[_0x825d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 419b7e0..16f6a82 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 _0x2d5c=['sequelize','exports','STRING'];(function(_0x868b7c,_0xfa438b){var _0x21683c=function(_0x21bc66){while(--_0x21bc66){_0x868b7c['push'](_0x868b7c['shift']());}};_0x21683c(++_0xfa438b);}(_0x2d5c,0x15c));var _0xc2d5=function(_0x27b67c,_0x4f8b2a){_0x27b67c=_0x27b67c-0x0;var _0x354235=_0x2d5c[_0x27b67c];return _0x354235;};'use strict';var Sequelize=require(_0xc2d5('0x0'));module[_0xc2d5('0x1')]={'name':{'type':Sequelize[_0xc2d5('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfa88=['sequelize','exports','STRING'];(function(_0x3c3982,_0x163010){var _0x66448f=function(_0x35f37f){while(--_0x35f37f){_0x3c3982['push'](_0x3c3982['shift']());}};_0x66448f(++_0x163010);}(_0xfa88,0x1da));var _0x8fa8=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xfa88[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x8fa8('0x0'));module[_0x8fa8('0x1')]={'name':{'type':Sequelize[_0x8fa8('0x2')]},'description':{'type':Sequelize[_0x8fa8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 193097f..a4cf1ff 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 _0xb688=['dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','where','add','day','merge','filter','map','options','count','includeAll','include','params','find','create','body','getFields','findOne','ZendeskField','length','order','sort','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','message','ZendeskConfiguration,\x20%s,\x20%s','catch','sendStatus','end','status','json','limit','set','apply','reject','save','update','stack','name','send','index','ZendeskConfiguration','rawAttributes','model','keys','query','dateStart'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xb688,0xcf));var _0x8b68=function(_0x23ed68,_0x22c9b0){_0x23ed68=_0x23ed68-0x0;var _0x33f998=_0xb688[_0x23ed68];return _0x33f998;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x8b68('0x0'));var moment=require(_0x8b68('0x1'));var BPromise=require(_0x8b68('0x2'));var Mustache=require(_0x8b68('0x3'));var util=require(_0x8b68('0x4'));var path=require(_0x8b68('0x5'));var sox=require('sox');var csv=require(_0x8b68('0x6'));var ejs=require(_0x8b68('0x7'));var fs=require('fs');var _=require(_0x8b68('0x8'));var squel=require(_0x8b68('0x9'));var crypto=require('crypto');var jsforce=require(_0x8b68('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8b68('0x6'));var querystring=require(_0x8b68('0xb'));var Papa=require(_0x8b68('0xc'));var qs=require(_0x8b68('0xd'));var logger=require(_0x8b68('0xe'))(_0x8b68('0xf'));var utils=require(_0x8b68('0x10'));var config=require(_0x8b68('0x11'));var db=require(_0x8b68('0x12'))['db'];var jayson=require(_0x8b68('0x13'));var client=jayson[_0x8b68('0x14')][_0x8b68('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x2a852a,_0x502727,_0x2c0f3b,_0x4426d1){return new BPromise(function(_0x5e76c,_0x2d8472){var _0x1965cf=_0x4426d1||client;return _0x1965cf[_0x8b68('0x16')](_0x2a852a,_0x2c0f3b)[_0x8b68('0x17')](function(_0x137c8e){logger[_0x8b68('0x18')]('ZendeskConfiguration,\x20%s,\x20%s',_0x502727,_0x8b68('0x19'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x502727,_0x8b68('0x19'),JSON[_0x8b68('0x1a')](_0x137c8e));if(_0x137c8e[_0x8b68('0x1b')]){if(_0x137c8e['error']['code']===0x1f4){logger[_0x8b68('0x1b')]('ZendeskConfiguration,\x20%s,\x20%s',_0x502727,_0x137c8e[_0x8b68('0x1b')][_0x8b68('0x1c')]);return _0x2d8472(_0x137c8e[_0x8b68('0x1b')][_0x8b68('0x1c')]);}logger['error'](_0x8b68('0x1d'),_0x502727,_0x137c8e[_0x8b68('0x1b')]['message']);return _0x5e76c(_0x137c8e[_0x8b68('0x1b')][_0x8b68('0x1c')]);}else{logger[_0x8b68('0x18')](_0x8b68('0x1d'),_0x502727,_0x8b68('0x19'));_0x5e76c(_0x137c8e['result'][_0x8b68('0x1c')]);}})[_0x8b68('0x1e')](function(_0x59e9b1){logger[_0x8b68('0x1b')](_0x8b68('0x1d'),_0x502727,_0x59e9b1);_0x2d8472(_0x59e9b1);});});}function respondWithStatusCode(_0x1dbc1d,_0x5603d4){_0x5603d4=_0x5603d4||0xcc;return function(_0x571adf){if(_0x571adf){return _0x1dbc1d[_0x8b68('0x1f')](_0x5603d4);}return _0x1dbc1d['status'](_0x5603d4)[_0x8b68('0x20')]();};}function respondWithResult(_0x30b6d0,_0x13aee5){_0x13aee5=_0x13aee5||0xc8;return function(_0x21ecca){if(_0x21ecca){return _0x30b6d0[_0x8b68('0x21')](_0x13aee5)[_0x8b68('0x22')](_0x21ecca);}};}function respondWithFilteredResult(_0x59bb8a,_0x1a6fe8){return function(_0x46e827){if(_0x46e827){var _0x4ca77d=_0x46e827['count'],_0x1c5808=_0x1a6fe8['offset'],_0x3cf8d2=_0x1a6fe8['offset']+_0x1a6fe8[_0x8b68('0x23')],_0x240b0b;if(_0x3cf8d2>=_0x4ca77d){_0x3cf8d2=_0x4ca77d;_0x240b0b=0xc8;}else{_0x240b0b=0xce;}_0x59bb8a[_0x8b68('0x21')](_0x240b0b);return _0x59bb8a[_0x8b68('0x24')]('Content-Range',_0x1c5808+'-'+_0x3cf8d2+'/'+_0x4ca77d)[_0x8b68('0x22')](_0x46e827);}return null;};}function patchUpdates(_0x53aaa2){return function(_0x4cf89d){try{jsonpatch[_0x8b68('0x25')](_0x4cf89d,_0x53aaa2,!![]);}catch(_0x59b3ce){return BPromise[_0x8b68('0x26')](_0x59b3ce);}return _0x4cf89d[_0x8b68('0x27')]();};}function saveUpdates(_0x48e2c8,_0x494ce4){return function(_0x357635){if(_0x357635){return _0x357635[_0x8b68('0x28')](_0x48e2c8)[_0x8b68('0x17')](function(_0xfb4f06){return _0xfb4f06;});}return null;};}function removeEntity(_0x210926,_0x2ad2df){return function(_0x460c37){if(_0x460c37){return _0x460c37['destroy']()[_0x8b68('0x17')](function(){_0x210926['status'](0xcc)[_0x8b68('0x20')]();});}};}function handleEntityNotFound(_0x133b75,_0x4c276f){return function(_0x216aa6){if(!_0x216aa6){_0x133b75[_0x8b68('0x1f')](0x194);}return _0x216aa6;};}function handleError(_0x26fe0e,_0x49ce2d){_0x49ce2d=_0x49ce2d||0x1f4;return function(_0x51f169){logger[_0x8b68('0x1b')](_0x51f169[_0x8b68('0x29')]);if(_0x51f169[_0x8b68('0x2a')]){delete _0x51f169[_0x8b68('0x2a')];}_0x26fe0e[_0x8b68('0x21')](_0x49ce2d)[_0x8b68('0x2b')](_0x51f169);};}exports[_0x8b68('0x2c')]=function(_0x3e646e,_0x12abb8){var _0x7fe301={},_0x49e2db={},_0x15027a={'count':0x0,'rows':[]};var _0x232fa9=db[_0x8b68('0x2d')][_0x8b68('0x2e')];_0x49e2db[_0x8b68('0x2f')]=_[_0x8b68('0x30')](_0x232fa9);var _0x2a7dd5={'dateStart':_0x3e646e[_0x8b68('0x31')][_0x8b68('0x32')],'dateEnd':_0x3e646e[_0x8b68('0x31')][_0x8b68('0x33')]};delete _0x3e646e['query']['dateStart'];delete _0x3e646e[_0x8b68('0x31')][_0x8b68('0x33')];_0x49e2db[_0x8b68('0x31')]=_[_0x8b68('0x30')](_0x3e646e[_0x8b68('0x31')]);_0x49e2db[_0x8b68('0x34')]=_[_0x8b68('0x35')](_0x49e2db[_0x8b68('0x2f')],_0x49e2db['query']);_0x7fe301[_0x8b68('0x36')]=_[_0x8b68('0x35')](_0x49e2db[_0x8b68('0x2f')],qs[_0x8b68('0x37')](_0x3e646e[_0x8b68('0x31')][_0x8b68('0x37')]));_0x7fe301[_0x8b68('0x36')]=_0x7fe301[_0x8b68('0x36')]['length']?_0x7fe301[_0x8b68('0x36')]:_0x49e2db[_0x8b68('0x2f')];if(!_0x3e646e[_0x8b68('0x31')][_0x8b68('0x38')](_0x8b68('0x39'))){_0x7fe301[_0x8b68('0x23')]=qs[_0x8b68('0x23')](_0x3e646e['query'][_0x8b68('0x23')]);_0x7fe301[_0x8b68('0x3a')]=qs['offset'](_0x3e646e[_0x8b68('0x31')][_0x8b68('0x3a')]);}_0x7fe301['order']=qs['sort'](_0x3e646e['query']['sort']);_0x7fe301[_0x8b68('0x3b')]=qs[_0x8b68('0x34')](_['pick'](_0x3e646e[_0x8b68('0x31')],_0x49e2db['filters']));if(_0x2a7dd5[_0x8b68('0x32')]){if(_0x2a7dd5[_0x8b68('0x33')]){_0x2a7dd5['dateEnd']=moment(_0x2a7dd5[_0x8b68('0x33')])['add'](0x1,'day');}else{_0x2a7dd5['dateEnd']=moment(_0x2a7dd5[_0x8b68('0x32')])[_0x8b68('0x3c')](0x1,_0x8b68('0x3d'));}_[_0x8b68('0x3e')](_0x7fe301['where'],{'createdAt':{'$gte':_0x2a7dd5[_0x8b68('0x32')],'$lte':_0x2a7dd5['dateEnd']}});}if(_0x3e646e[_0x8b68('0x31')][_0x8b68('0x3f')]){_0x7fe301['where']=_[_0x8b68('0x3e')](_0x7fe301[_0x8b68('0x3b')],{'$or':_[_0x8b68('0x40')](_0x7fe301[_0x8b68('0x36')],function(_0x5f136f){var _0x14fa5a={};_0x14fa5a[_0x5f136f]={'$like':'%'+_0x3e646e[_0x8b68('0x31')][_0x8b68('0x3f')]+'%'};return _0x14fa5a;})});}_0x7fe301=_[_0x8b68('0x3e')]({},_0x7fe301,_0x3e646e[_0x8b68('0x41')]);var _0x1362d3={'where':_0x7fe301[_0x8b68('0x3b')]};return db[_0x8b68('0x2d')][_0x8b68('0x42')](_0x1362d3)[_0x8b68('0x17')](function(_0x1ec2c4){_0x15027a[_0x8b68('0x42')]=_0x1ec2c4;if(_0x3e646e[_0x8b68('0x31')][_0x8b68('0x43')]){_0x7fe301[_0x8b68('0x44')]=[{'all':!![]}];}return db[_0x8b68('0x2d')]['findAll'](_0x7fe301);})[_0x8b68('0x17')](function(_0x20681a){_0x15027a['rows']=_0x20681a;return _0x15027a;})[_0x8b68('0x17')](respondWithFilteredResult(_0x12abb8,_0x7fe301))['catch'](handleError(_0x12abb8,null));};exports['show']=function(_0x59a4a6,_0x1c8a3e){var _0x35874b={'raw':![],'where':{'id':_0x59a4a6[_0x8b68('0x45')]['id']}},_0x34047c={};_0x34047c['model']=_['keys'](db[_0x8b68('0x2d')][_0x8b68('0x2e')]);_0x34047c[_0x8b68('0x31')]=_['keys'](_0x59a4a6[_0x8b68('0x31')]);_0x34047c[_0x8b68('0x34')]=_['intersection'](_0x34047c[_0x8b68('0x2f')],_0x34047c[_0x8b68('0x31')]);_0x35874b['attributes']=_[_0x8b68('0x35')](_0x34047c[_0x8b68('0x2f')],qs['fields'](_0x59a4a6[_0x8b68('0x31')][_0x8b68('0x37')]));_0x35874b['attributes']=_0x35874b['attributes']['length']?_0x35874b[_0x8b68('0x36')]:_0x34047c[_0x8b68('0x2f')];if(_0x59a4a6[_0x8b68('0x31')][_0x8b68('0x43')]){_0x35874b['include']=[{'all':!![]}];}_0x35874b=_['merge']({},_0x35874b,_0x59a4a6[_0x8b68('0x41')]);return db[_0x8b68('0x2d')][_0x8b68('0x46')](_0x35874b)['then'](handleEntityNotFound(_0x1c8a3e,null))[_0x8b68('0x17')](respondWithResult(_0x1c8a3e,null))[_0x8b68('0x1e')](handleError(_0x1c8a3e,null));};exports[_0x8b68('0x47')]=function(_0x4dda69,_0x49dc86){return db['ZendeskConfiguration'][_0x8b68('0x47')](_0x4dda69[_0x8b68('0x48')],{})['then'](respondWithResult(_0x49dc86,0xc9))[_0x8b68('0x1e')](handleError(_0x49dc86,null));};exports[_0x8b68('0x28')]=function(_0x6ac18,_0xcd88b4){if(_0x6ac18[_0x8b68('0x48')]['id']){delete _0x6ac18['body']['id'];}return db[_0x8b68('0x2d')][_0x8b68('0x46')]({'where':{'id':_0x6ac18[_0x8b68('0x45')]['id']}})[_0x8b68('0x17')](handleEntityNotFound(_0xcd88b4,null))[_0x8b68('0x17')](saveUpdates(_0x6ac18[_0x8b68('0x48')],null))[_0x8b68('0x17')](respondWithResult(_0xcd88b4,null))[_0x8b68('0x1e')](handleError(_0xcd88b4,null));};exports['destroy']=function(_0x3f423e,_0x1a85da){return db[_0x8b68('0x2d')][_0x8b68('0x46')]({'where':{'id':_0x3f423e[_0x8b68('0x45')]['id']}})[_0x8b68('0x17')](handleEntityNotFound(_0x1a85da,null))[_0x8b68('0x17')](removeEntity(_0x1a85da,null))[_0x8b68('0x1e')](handleError(_0x1a85da,null));};exports[_0x8b68('0x49')]=function(_0x271dbe,_0x368c86,_0x42871e){var _0x1019cb={};var _0x275b31={};var _0x28e7aa;var _0xd7e86d;return db[_0x8b68('0x2d')][_0x8b68('0x4a')]({'where':{'id':_0x271dbe[_0x8b68('0x45')]['id']}})[_0x8b68('0x17')](handleEntityNotFound(_0x368c86,null))['then'](function(_0xaac776){if(_0xaac776){_0x28e7aa=_0xaac776;_0x275b31['model']=_['keys'](db[_0x8b68('0x4b')]['rawAttributes']);_0x275b31[_0x8b68('0x31')]=_[_0x8b68('0x30')](_0x271dbe[_0x8b68('0x31')]);_0x275b31['filters']=_[_0x8b68('0x35')](_0x275b31[_0x8b68('0x2f')],_0x275b31[_0x8b68('0x31')]);_0x1019cb[_0x8b68('0x36')]=_[_0x8b68('0x35')](_0x275b31[_0x8b68('0x2f')],qs[_0x8b68('0x37')](_0x271dbe['query']['fields']));_0x1019cb[_0x8b68('0x36')]=_0x1019cb[_0x8b68('0x36')][_0x8b68('0x4c')]?_0x1019cb[_0x8b68('0x36')]:_0x275b31[_0x8b68('0x2f')];_0x1019cb[_0x8b68('0x4d')]=qs[_0x8b68('0x4e')](_0x271dbe[_0x8b68('0x31')][_0x8b68('0x4e')]);_0x1019cb[_0x8b68('0x3b')]=qs[_0x8b68('0x34')](_[_0x8b68('0x4f')](_0x271dbe[_0x8b68('0x31')],_0x275b31[_0x8b68('0x34')]));if(_0x271dbe[_0x8b68('0x31')][_0x8b68('0x3f')]){_0x1019cb[_0x8b68('0x3b')]=_[_0x8b68('0x3e')](_0x1019cb['where'],{'$or':_['map'](_0x1019cb[_0x8b68('0x36')],function(_0x23e01a){var _0x5bd581={};_0x5bd581[_0x23e01a]={'$like':'%'+_0x271dbe['query']['filter']+'%'};return _0x5bd581;})});}_0x1019cb=_[_0x8b68('0x3e')]({},_0x1019cb,_0x271dbe[_0x8b68('0x41')]);return _0x28e7aa[_0x8b68('0x49')](_0x1019cb);}})[_0x8b68('0x17')](function(_0xc52321){if(_0xc52321){_0xd7e86d=_0xc52321['length'];if(!_0x271dbe[_0x8b68('0x31')][_0x8b68('0x38')]('nolimit')){_0x1019cb[_0x8b68('0x23')]=qs['limit'](_0x271dbe['query']['limit']);_0x1019cb[_0x8b68('0x3a')]=qs[_0x8b68('0x3a')](_0x271dbe[_0x8b68('0x31')][_0x8b68('0x3a')]);}return _0x28e7aa[_0x8b68('0x49')](_0x1019cb);}})[_0x8b68('0x17')](function(_0x35b22b){if(_0x35b22b){return _0x35b22b?{'count':_0xd7e86d,'rows':_0x35b22b}:null;}})[_0x8b68('0x17')](respondWithResult(_0x368c86,null))[_0x8b68('0x1e')](handleError(_0x368c86,null));};exports[_0x8b68('0x50')]=function(_0x55e04f,_0x3a8d15,_0x335b3b){var _0x310ec9={};var _0x49cce6={};var _0x5deaba;var _0x1854a9;return db[_0x8b68('0x2d')]['findOne']({'where':{'id':_0x55e04f[_0x8b68('0x45')]['id']}})[_0x8b68('0x17')](handleEntityNotFound(_0x3a8d15,null))[_0x8b68('0x17')](function(_0x2c2f6d){if(_0x2c2f6d){_0x5deaba=_0x2c2f6d;_0x49cce6['model']=_[_0x8b68('0x30')](db['ZendeskField']['rawAttributes']);_0x49cce6[_0x8b68('0x31')]=_['keys'](_0x55e04f[_0x8b68('0x31')]);_0x49cce6[_0x8b68('0x34')]=_['intersection'](_0x49cce6[_0x8b68('0x2f')],_0x49cce6[_0x8b68('0x31')]);_0x310ec9[_0x8b68('0x36')]=_[_0x8b68('0x35')](_0x49cce6[_0x8b68('0x2f')],qs['fields'](_0x55e04f[_0x8b68('0x31')][_0x8b68('0x37')]));_0x310ec9[_0x8b68('0x36')]=_0x310ec9[_0x8b68('0x36')][_0x8b68('0x4c')]?_0x310ec9['attributes']:_0x49cce6['model'];_0x310ec9[_0x8b68('0x4d')]=qs['sort'](_0x55e04f[_0x8b68('0x31')][_0x8b68('0x4e')]);_0x310ec9[_0x8b68('0x3b')]=qs[_0x8b68('0x34')](_[_0x8b68('0x4f')](_0x55e04f[_0x8b68('0x31')],_0x49cce6[_0x8b68('0x34')]));if(_0x55e04f['query'][_0x8b68('0x3f')]){_0x310ec9['where']=_[_0x8b68('0x3e')](_0x310ec9[_0x8b68('0x3b')],{'$or':_[_0x8b68('0x40')](_0x310ec9['attributes'],function(_0x3141d3){var _0x50d0b9={};_0x50d0b9[_0x3141d3]={'$like':'%'+_0x55e04f[_0x8b68('0x31')]['filter']+'%'};return _0x50d0b9;})});}_0x310ec9=_[_0x8b68('0x3e')]({},_0x310ec9,_0x55e04f[_0x8b68('0x41')]);return _0x5deaba[_0x8b68('0x50')](_0x310ec9);}})['then'](function(_0x33b775){if(_0x33b775){_0x1854a9=_0x33b775[_0x8b68('0x4c')];if(!_0x55e04f[_0x8b68('0x31')][_0x8b68('0x38')](_0x8b68('0x39'))){_0x310ec9[_0x8b68('0x23')]=qs[_0x8b68('0x23')](_0x55e04f[_0x8b68('0x31')][_0x8b68('0x23')]);_0x310ec9['offset']=qs[_0x8b68('0x3a')](_0x55e04f[_0x8b68('0x31')][_0x8b68('0x3a')]);}return _0x5deaba[_0x8b68('0x50')](_0x310ec9);}})[_0x8b68('0x17')](function(_0x543468){if(_0x543468){return _0x543468?{'count':_0x1854a9,'rows':_0x543468}:null;}})[_0x8b68('0x17')](respondWithResult(_0x3a8d15,null))['catch'](handleError(_0x3a8d15,null));};exports[_0x8b68('0x51')]=function(_0x2de166,_0x524763,_0x20c8b4){var _0x75af51={};var _0xa7890f={};var _0x4c9e0f;var _0x3cca8c;return db[_0x8b68('0x2d')][_0x8b68('0x4a')]({'where':{'id':_0x2de166[_0x8b68('0x45')]['id']}})[_0x8b68('0x17')](handleEntityNotFound(_0x524763,null))[_0x8b68('0x17')](function(_0x541cf2){if(_0x541cf2){_0x4c9e0f=_0x541cf2;_0xa7890f[_0x8b68('0x2f')]=_[_0x8b68('0x30')](db[_0x8b68('0x4b')]['rawAttributes']);_0xa7890f[_0x8b68('0x31')]=_[_0x8b68('0x30')](_0x2de166[_0x8b68('0x31')]);_0xa7890f[_0x8b68('0x34')]=_[_0x8b68('0x35')](_0xa7890f[_0x8b68('0x2f')],_0xa7890f[_0x8b68('0x31')]);_0x75af51[_0x8b68('0x36')]=_[_0x8b68('0x35')](_0xa7890f[_0x8b68('0x2f')],qs[_0x8b68('0x37')](_0x2de166['query']['fields']));_0x75af51[_0x8b68('0x36')]=_0x75af51[_0x8b68('0x36')][_0x8b68('0x4c')]?_0x75af51[_0x8b68('0x36')]:_0xa7890f[_0x8b68('0x2f')];_0x75af51['order']=qs[_0x8b68('0x4e')](_0x2de166[_0x8b68('0x31')][_0x8b68('0x4e')]);_0x75af51[_0x8b68('0x3b')]=qs['filters'](_['pick'](_0x2de166[_0x8b68('0x31')],_0xa7890f[_0x8b68('0x34')]));if(_0x2de166[_0x8b68('0x31')][_0x8b68('0x3f')]){_0x75af51[_0x8b68('0x3b')]=_[_0x8b68('0x3e')](_0x75af51[_0x8b68('0x3b')],{'$or':_[_0x8b68('0x40')](_0x75af51['attributes'],function(_0x7864cf){var _0x3fa9be={};_0x3fa9be[_0x7864cf]={'$like':'%'+_0x2de166[_0x8b68('0x31')][_0x8b68('0x3f')]+'%'};return _0x3fa9be;})});}_0x75af51=_[_0x8b68('0x3e')]({},_0x75af51,_0x2de166[_0x8b68('0x41')]);return _0x4c9e0f['getDescriptions'](_0x75af51);}})[_0x8b68('0x17')](function(_0x14a888){if(_0x14a888){_0x3cca8c=_0x14a888[_0x8b68('0x4c')];if(!_0x2de166['query'][_0x8b68('0x38')]('nolimit')){_0x75af51[_0x8b68('0x23')]=qs['limit'](_0x2de166[_0x8b68('0x31')][_0x8b68('0x23')]);_0x75af51[_0x8b68('0x3a')]=qs[_0x8b68('0x3a')](_0x2de166[_0x8b68('0x31')][_0x8b68('0x3a')]);}return _0x4c9e0f['getDescriptions'](_0x75af51);}})['then'](function(_0x58e99a){if(_0x58e99a){return _0x58e99a?{'count':_0x3cca8c,'rows':_0x58e99a}:null;}})[_0x8b68('0x17')](respondWithResult(_0x524763,null))[_0x8b68('0x1e')](handleError(_0x524763,null));};exports[_0x8b68('0x52')]=function(_0x198b79,_0x30db03,_0x401229){var _0x3cbd15={};var _0x3b1644={};var _0x2846ca;var _0x60f6e5;return db[_0x8b68('0x2d')][_0x8b68('0x4a')]({'where':{'id':_0x198b79[_0x8b68('0x45')]['id']}})[_0x8b68('0x17')](handleEntityNotFound(_0x30db03,null))[_0x8b68('0x17')](function(_0x5e76ac){if(_0x5e76ac){_0x2846ca=_0x5e76ac;_0x3b1644['model']=_['keys'](db[_0x8b68('0x53')][_0x8b68('0x2e')]);_0x3b1644[_0x8b68('0x31')]=_[_0x8b68('0x30')](_0x198b79[_0x8b68('0x31')]);_0x3b1644['filters']=_[_0x8b68('0x35')](_0x3b1644['model'],_0x3b1644[_0x8b68('0x31')]);_0x3cbd15['attributes']=_[_0x8b68('0x35')](_0x3b1644['model'],qs[_0x8b68('0x37')](_0x198b79['query'][_0x8b68('0x37')]));_0x3cbd15[_0x8b68('0x36')]=_0x3cbd15['attributes'][_0x8b68('0x4c')]?_0x3cbd15[_0x8b68('0x36')]:_0x3b1644['model'];_0x3cbd15[_0x8b68('0x4d')]=qs['sort'](_0x198b79[_0x8b68('0x31')]['sort']);_0x3cbd15[_0x8b68('0x3b')]=qs[_0x8b68('0x34')](_[_0x8b68('0x4f')](_0x198b79[_0x8b68('0x31')],_0x3b1644[_0x8b68('0x34')]));if(_0x198b79[_0x8b68('0x31')][_0x8b68('0x3f')]){_0x3cbd15['where']=_[_0x8b68('0x3e')](_0x3cbd15[_0x8b68('0x3b')],{'$or':_[_0x8b68('0x40')](_0x3cbd15[_0x8b68('0x36')],function(_0x333f4f){var _0x36335f={};_0x36335f[_0x333f4f]={'$like':'%'+_0x198b79[_0x8b68('0x31')][_0x8b68('0x3f')]+'%'};return _0x36335f;})});}_0x3cbd15=_[_0x8b68('0x3e')]({},_0x3cbd15,_0x198b79[_0x8b68('0x41')]);return _0x2846ca[_0x8b68('0x52')](_0x3cbd15);}})[_0x8b68('0x17')](function(_0x255f24){if(_0x255f24){_0x60f6e5=_0x255f24[_0x8b68('0x4c')];if(!_0x198b79['query'][_0x8b68('0x38')](_0x8b68('0x39'))){_0x3cbd15[_0x8b68('0x23')]=qs[_0x8b68('0x23')](_0x198b79[_0x8b68('0x31')][_0x8b68('0x23')]);_0x3cbd15['offset']=qs[_0x8b68('0x3a')](_0x198b79[_0x8b68('0x31')][_0x8b68('0x3a')]);}return _0x2846ca[_0x8b68('0x52')](_0x3cbd15);}})[_0x8b68('0x17')](function(_0x5e2270){if(_0x5e2270){return _0x5e2270?{'count':_0x60f6e5,'rows':_0x5e2270}:null;}})[_0x8b68('0x17')](respondWithResult(_0x30db03,null))[_0x8b68('0x1e')](handleError(_0x30db03,null));};exports[_0x8b68('0x54')]=function(_0x5731ee,_0x31d70c,_0x4df181){if(_0x5731ee['body']['id']){delete _0x5731ee['body']['id'];}return db[_0x8b68('0x2d')][_0x8b68('0x4a')]({'where':{'id':_0x5731ee['params']['id']}})[_0x8b68('0x17')](handleEntityNotFound(_0x31d70c,null))[_0x8b68('0x17')](function(_0x56f8af){if(_0x56f8af){return _0x56f8af[_0x8b68('0x54')](_0x5731ee[_0x8b68('0x48')][_0x8b68('0x55')]||[]);}return null;})[_0x8b68('0x17')](respondWithResult(_0x31d70c,null))[_0x8b68('0x1e')](handleError(_0x31d70c,null));}; \ No newline at end of file +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(_0x167b49,_0x4ee63a){var _0xcae368=function(_0x3a309b){while(--_0x3a309b){_0x167b49['push'](_0x167b49['shift']());}};_0xcae368(++_0x4ee63a);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x52a2be,_0x4bd252){_0x52a2be=_0x52a2be-0x0;var _0x246f1d=_0xbdb7[_0x52a2be];return _0x246f1d;};'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 diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 65df8eb..aa1c405 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 _0x00a9=['bluebird','request-promise','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x24ce88,_0x53da68){var _0x49e044=function(_0x193c63){while(--_0x193c63){_0x24ce88['push'](_0x24ce88['shift']());}};_0x49e044(++_0x53da68);}(_0x00a9,0x1cf));var _0x900a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x00a9[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x900a('0x0'));var util=require(_0x900a('0x1'));var logger=require(_0x900a('0x2'))(_0x900a('0x3'));var moment=require(_0x900a('0x4'));var BPromise=require(_0x900a('0x5'));var rp=require(_0x900a('0x6'));var attributes=require(_0x900a('0x7'));module[_0x900a('0x8')]=function(_0x3a9b07,_0x569f92){return _0x3a9b07[_0x900a('0x9')](_0x900a('0xa'),attributes,{'tableName':_0x900a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2289=['../../config/logger','moment','bluebird','request-promise','exports','lodash','util'];(function(_0xce58df,_0x4b6850){var _0x57b86a=function(_0x4599cd){while(--_0x4599cd){_0xce58df['push'](_0xce58df['shift']());}};_0x57b86a(++_0x4b6850);}(_0x2289,0x98));var _0x9228=function(_0x127316,_0x2774a8){_0x127316=_0x127316-0x0;var _0x34d919=_0x2289[_0x127316];return _0x34d919;};'use strict';var _=require(_0x9228('0x0'));var util=require(_0x9228('0x1'));var logger=require(_0x9228('0x2'))('api');var moment=require(_0x9228('0x3'));var BPromise=require(_0x9228('0x4'));var rp=require(_0x9228('0x5'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x9228('0x6')]=function(_0xad7a5,_0x1ffb56){return _0xad7a5['define']('ZendeskConfiguration',attributes,{'tableName':'int_zendesk_configurations','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 00e9c01..11af308 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 _0x7c21=['error','code','message','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x868fc8,_0x21fd7e){var _0x5d3178=function(_0x2b082b){while(--_0x2b082b){_0x868fc8['push'](_0x868fc8['shift']());}};_0x5d3178(++_0x21fd7e);}(_0x7c21,0x1df));var _0x17c2=function(_0xca9ecb,_0x5138e8){_0xca9ecb=_0xca9ecb-0x0;var _0x35378f=_0x7c21[_0xca9ecb];return _0x35378f;};'use strict';var _=require(_0x17c2('0x0'));var util=require(_0x17c2('0x1'));var moment=require(_0x17c2('0x2'));var BPromise=require('bluebird');var rs=require(_0x17c2('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x17c2('0x4'));var logger=require(_0x17c2('0x5'))(_0x17c2('0x6'));var config=require(_0x17c2('0x7'));var jayson=require(_0x17c2('0x8'));var client=jayson['client'][_0x17c2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x385485,_0x2d2b93,_0x448703){return new BPromise(function(_0x23e53,_0x2b4d78){return client[_0x17c2('0xa')](_0x385485,_0x448703)['then'](function(_0x224de5){logger[_0x17c2('0xb')](_0x17c2('0xc'),_0x2d2b93,_0x17c2('0xd'));logger[_0x17c2('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2d2b93,_0x17c2('0xd'),JSON['stringify'](_0x224de5));if(_0x224de5['error']){if(_0x224de5[_0x17c2('0xf')][_0x17c2('0x10')]===0x1f4){logger[_0x17c2('0xf')](_0x17c2('0xc'),_0x2d2b93,_0x224de5[_0x17c2('0xf')]['message']);return _0x2b4d78(_0x224de5[_0x17c2('0xf')][_0x17c2('0x11')]);}logger[_0x17c2('0xf')](_0x17c2('0xc'),_0x2d2b93,_0x224de5[_0x17c2('0xf')][_0x17c2('0x11')]);return _0x23e53(_0x224de5['error']['message']);}else{logger[_0x17c2('0xb')](_0x17c2('0xc'),_0x2d2b93,_0x17c2('0xd'));_0x23e53(_0x224de5[_0x17c2('0x12')][_0x17c2('0x11')]);}})['catch'](function(_0x103a7b){logger[_0x17c2('0xf')](_0x17c2('0xc'),_0x2d2b93,_0x103a7b);_0x2b4d78(_0x103a7b);});});} \ No newline at end of file +var _0x73bd=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','info','result','catch'];(function(_0x220a1f,_0x5b73f1){var _0x5d041d=function(_0x550c46){while(--_0x550c46){_0x220a1f['push'](_0x220a1f['shift']());}};_0x5d041d(++_0x5b73f1);}(_0x73bd,0x170));var _0xd73b=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x73bd[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xd73b('0x0'));var moment=require(_0xd73b('0x1'));var BPromise=require(_0xd73b('0x2'));var rs=require(_0xd73b('0x3'));var fs=require('fs');var db=require(_0xd73b('0x4'))['db'];var utils=require(_0xd73b('0x5'));var logger=require(_0xd73b('0x6'))(_0xd73b('0x7'));var config=require(_0xd73b('0x8'));var jayson=require(_0xd73b('0x9'));var client=jayson[_0xd73b('0xa')][_0xd73b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x385ddd,_0x393a2b,_0x43ddfa){return new BPromise(function(_0x3b89d6,_0x279c50){return client['request'](_0x385ddd,_0x43ddfa)[_0xd73b('0xc')](function(_0x173ddc){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x393a2b,_0xd73b('0xd'));logger[_0xd73b('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x393a2b,'request\x20sent',JSON[_0xd73b('0xf')](_0x173ddc));if(_0x173ddc[_0xd73b('0x10')]){if(_0x173ddc['error'][_0xd73b('0x11')]===0x1f4){logger[_0xd73b('0x10')](_0xd73b('0x12'),_0x393a2b,_0x173ddc[_0xd73b('0x10')][_0xd73b('0x13')]);return _0x279c50(_0x173ddc[_0xd73b('0x10')][_0xd73b('0x13')]);}logger[_0xd73b('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x393a2b,_0x173ddc[_0xd73b('0x10')][_0xd73b('0x13')]);return _0x3b89d6(_0x173ddc[_0xd73b('0x10')][_0xd73b('0x13')]);}else{logger[_0xd73b('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x393a2b,'request\x20sent');_0x3b89d6(_0x173ddc[_0xd73b('0x15')][_0xd73b('0x13')]);}})[_0xd73b('0x16')](function(_0x15468f){logger[_0xd73b('0x10')](_0xd73b('0x12'),_0x393a2b,_0x15468f);_0x279c50(_0x15468f);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 9470053..129f69c 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 _0x3bc1=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','/:id','isAuthenticated','post','create','update','delete','destroy','exports','multer','util','express','Router'];(function(_0xcd5a3d,_0x3c5b33){var _0xd43207=function(_0x17d976){while(--_0x17d976){_0xcd5a3d['push'](_0xcd5a3d['shift']());}};_0xd43207(++_0x3c5b33);}(_0x3bc1,0x1d0));var _0x13bc=function(_0x18bc81,_0x4c8ba2){_0x18bc81=_0x18bc81-0x0;var _0x5293ca=_0x3bc1[_0x18bc81];return _0x5293ca;};'use strict';var multer=require(_0x13bc('0x0'));var util=require(_0x13bc('0x1'));var path=require('path');var express=require(_0x13bc('0x2'));var router=express[_0x13bc('0x3')]();var auth=require(_0x13bc('0x4'));var interaction=require(_0x13bc('0x5'));var config=require(_0x13bc('0x6'));var controller=require(_0x13bc('0x7'));router[_0x13bc('0x8')]('/',auth['isAuthenticated'](),controller[_0x13bc('0x9')]);router[_0x13bc('0x8')](_0x13bc('0xa'),auth[_0x13bc('0xb')](),controller['show']);router[_0x13bc('0xc')]('/',auth['isAuthenticated'](),controller[_0x13bc('0xd')]);router['put'](_0x13bc('0xa'),auth['isAuthenticated'](),controller[_0x13bc('0xe')]);router[_0x13bc('0xf')](_0x13bc('0xa'),auth[_0x13bc('0xb')](),controller[_0x13bc('0x10')]);module[_0x13bc('0x11')]=router; \ No newline at end of file +var _0x2b83=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','create','put','update','exports','multer','util','express','Router'];(function(_0xf24b76,_0x2bec41){var _0x20f1b9=function(_0x387a8c){while(--_0x387a8c){_0xf24b76['push'](_0xf24b76['shift']());}};_0x20f1b9(++_0x2bec41);}(_0x2b83,0x92));var _0x32b8=function(_0x1fe0f6,_0x51a999){_0x1fe0f6=_0x1fe0f6-0x0;var _0x4ffa1e=_0x2b83[_0x1fe0f6];return _0x4ffa1e;};'use strict';var multer=require(_0x32b8('0x0'));var util=require(_0x32b8('0x1'));var path=require('path');var express=require(_0x32b8('0x2'));var router=express[_0x32b8('0x3')]();var auth=require(_0x32b8('0x4'));var interaction=require(_0x32b8('0x5'));var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0x32b8('0x6')]('/',auth[_0x32b8('0x7')](),controller[_0x32b8('0x8')]);router[_0x32b8('0x6')](_0x32b8('0x9'),auth[_0x32b8('0x7')](),controller[_0x32b8('0xa')]);router['post']('/',auth[_0x32b8('0x7')](),controller[_0x32b8('0xb')]);router[_0x32b8('0xc')]('/:id',auth[_0x32b8('0x7')](),controller[_0x32b8('0xd')]);router['delete'](_0x32b8('0x9'),auth[_0x32b8('0x7')](),controller['destroy']);module[_0x32b8('0xe')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 88ce1e9..01c8d8b 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 _0x91a7=['STRING','exports','ENUM','string','customVariable'];(function(_0x4c0c6a,_0x13e50e){var _0x1652db=function(_0x4afb11){while(--_0x4afb11){_0x4c0c6a['push'](_0x4c0c6a['shift']());}};_0x1652db(++_0x13e50e);}(_0x91a7,0xe7));var _0x791a=function(_0x1c6ff6,_0x2926d6){_0x1c6ff6=_0x1c6ff6-0x0;var _0x667cca=_0x91a7[_0x1c6ff6];return _0x667cca;};'use strict';var Sequelize=require('sequelize');module[_0x791a('0x0')]={'type':{'type':Sequelize[_0x791a('0x1')](_0x791a('0x2'),'variable',_0x791a('0x3'),'keyValue'),'defaultValue':_0x791a('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x791a('0x1')](_0x791a('0x2'),'variable',_0x791a('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x791a('0x4')]},'nameField':{'type':Sequelize[_0x791a('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x791a('0x4')]}}; \ No newline at end of file +var _0x70e0=['BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','string','STRING','variable'];(function(_0x5b1806,_0xd6b55a){var _0x5864d0=function(_0x53d4ba){while(--_0x53d4ba){_0x5b1806['push'](_0x5b1806['shift']());}};_0x5864d0(++_0xd6b55a);}(_0x70e0,0x17b));var _0x070e=function(_0x50f9e6,_0x6f2199){_0x50f9e6=_0x50f9e6-0x0;var _0x424509=_0x70e0[_0x50f9e6];return _0x424509;};'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 diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index e8a576b..548f475 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 _0xfef3=['rows','catch','show','params','rawAttributes','create','body','find','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','name','index','keys','dateStart','query','dateEnd','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day','merge','filter','map','options','ZendeskField','count','includeAll','include','findAll'];(function(_0x27dba4,_0x419253){var _0x35ec9d=function(_0x2d13b2){while(--_0x2d13b2){_0x27dba4['push'](_0x27dba4['shift']());}};_0x35ec9d(++_0x419253);}(_0xfef3,0x118));var _0x3fef=function(_0x2a9f4,_0x25c14a){_0x2a9f4=_0x2a9f4-0x0;var _0x3c39e0=_0xfef3[_0x2a9f4];return _0x3c39e0;};'use strict';var jsonpatch=require(_0x3fef('0x0'));var rp=require('request-promise');var moment=require(_0x3fef('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x3fef('0x2'));var util=require(_0x3fef('0x3'));var path=require('path');var sox=require(_0x3fef('0x4'));var csv=require(_0x3fef('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3fef('0x6'));var squel=require(_0x3fef('0x7'));var crypto=require('crypto');var jsforce=require(_0x3fef('0x8'));var deskjs=require(_0x3fef('0x9'));var toCsv=require(_0x3fef('0x5'));var querystring=require(_0x3fef('0xa'));var Papa=require(_0x3fef('0xb'));var qs=require(_0x3fef('0xc'));var logger=require(_0x3fef('0xd'))(_0x3fef('0xe'));var utils=require(_0x3fef('0xf'));var config=require(_0x3fef('0x10'));var db=require(_0x3fef('0x11'))['db'];function respondWithStatusCode(_0x16252b,_0x1a7ef7){_0x1a7ef7=_0x1a7ef7||0xcc;return function(_0x7cc5b){if(_0x7cc5b){return _0x16252b['sendStatus'](_0x1a7ef7);}return _0x16252b[_0x3fef('0x12')](_0x1a7ef7)[_0x3fef('0x13')]();};}function respondWithResult(_0x11696d,_0x49d216){_0x49d216=_0x49d216||0xc8;return function(_0x1c20b3){if(_0x1c20b3){return _0x11696d['status'](_0x49d216)[_0x3fef('0x14')](_0x1c20b3);}};}function respondWithFilteredResult(_0x3d2c2d,_0x2da64b){return function(_0x5b164c){if(_0x5b164c){var _0x42c3d2=_0x5b164c['count'],_0x4be62f=_0x2da64b[_0x3fef('0x15')],_0x15b757=_0x2da64b[_0x3fef('0x15')]+_0x2da64b[_0x3fef('0x16')],_0x14c053;if(_0x15b757>=_0x42c3d2){_0x15b757=_0x42c3d2;_0x14c053=0xc8;}else{_0x14c053=0xce;}_0x3d2c2d[_0x3fef('0x12')](_0x14c053);return _0x3d2c2d[_0x3fef('0x17')](_0x3fef('0x18'),_0x4be62f+'-'+_0x15b757+'/'+_0x42c3d2)['json'](_0x5b164c);}return null;};}function patchUpdates(_0x1cbdbb){return function(_0x5b969a){try{jsonpatch[_0x3fef('0x19')](_0x5b969a,_0x1cbdbb,!![]);}catch(_0x3f2997){return BPromise[_0x3fef('0x1a')](_0x3f2997);}return _0x5b969a[_0x3fef('0x1b')]();};}function saveUpdates(_0x53d993,_0x36669d){return function(_0x3eb287){if(_0x3eb287){return _0x3eb287['update'](_0x53d993)[_0x3fef('0x1c')](function(_0x51a554){return _0x51a554;});}return null;};}function removeEntity(_0x42e095,_0x218f91){return function(_0x245332){if(_0x245332){return _0x245332[_0x3fef('0x1d')]()[_0x3fef('0x1c')](function(){_0x42e095[_0x3fef('0x12')](0xcc)[_0x3fef('0x13')]();});}};}function handleEntityNotFound(_0xd64bf4,_0x1f5aaf){return function(_0x3bb110){if(!_0x3bb110){_0xd64bf4[_0x3fef('0x1e')](0x194);}return _0x3bb110;};}function handleError(_0x39a8ea,_0x433a3e){_0x433a3e=_0x433a3e||0x1f4;return function(_0x58f6cf){logger['error'](_0x58f6cf['stack']);if(_0x58f6cf[_0x3fef('0x1f')]){delete _0x58f6cf[_0x3fef('0x1f')];}_0x39a8ea[_0x3fef('0x12')](_0x433a3e)['send'](_0x58f6cf);};}exports[_0x3fef('0x20')]=function(_0x56c542,_0x45464b){var _0x2c0848={},_0x64d3e6={},_0xf2b269={'count':0x0,'rows':[]};var _0x30e17a=db['ZendeskField']['rawAttributes'];_0x64d3e6['model']=_[_0x3fef('0x21')](_0x30e17a);var _0x3baa52={'dateStart':_0x56c542['query'][_0x3fef('0x22')],'dateEnd':_0x56c542[_0x3fef('0x23')]['dateEnd']};delete _0x56c542[_0x3fef('0x23')][_0x3fef('0x22')];delete _0x56c542[_0x3fef('0x23')][_0x3fef('0x24')];_0x64d3e6[_0x3fef('0x23')]=_[_0x3fef('0x21')](_0x56c542[_0x3fef('0x23')]);_0x64d3e6['filters']=_[_0x3fef('0x25')](_0x64d3e6[_0x3fef('0x26')],_0x64d3e6[_0x3fef('0x23')]);_0x2c0848[_0x3fef('0x27')]=_['intersection'](_0x64d3e6[_0x3fef('0x26')],qs['fields'](_0x56c542[_0x3fef('0x23')][_0x3fef('0x28')]));_0x2c0848[_0x3fef('0x27')]=_0x2c0848[_0x3fef('0x27')][_0x3fef('0x29')]?_0x2c0848[_0x3fef('0x27')]:_0x64d3e6[_0x3fef('0x26')];if(!_0x56c542[_0x3fef('0x23')][_0x3fef('0x2a')](_0x3fef('0x2b'))){_0x2c0848['limit']=qs['limit'](_0x56c542[_0x3fef('0x23')]['limit']);_0x2c0848[_0x3fef('0x15')]=qs[_0x3fef('0x15')](_0x56c542[_0x3fef('0x23')][_0x3fef('0x15')]);}_0x2c0848[_0x3fef('0x2c')]=qs[_0x3fef('0x2d')](_0x56c542[_0x3fef('0x23')][_0x3fef('0x2d')]);_0x2c0848[_0x3fef('0x2e')]=qs[_0x3fef('0x2f')](_[_0x3fef('0x30')](_0x56c542[_0x3fef('0x23')],_0x64d3e6[_0x3fef('0x2f')]));if(_0x3baa52[_0x3fef('0x22')]){if(_0x3baa52['dateEnd']){_0x3baa52[_0x3fef('0x24')]=moment(_0x3baa52[_0x3fef('0x24')])[_0x3fef('0x31')](0x1,_0x3fef('0x32'));}else{_0x3baa52[_0x3fef('0x24')]=moment(_0x3baa52[_0x3fef('0x22')])['add'](0x1,'day');}_[_0x3fef('0x33')](_0x2c0848[_0x3fef('0x2e')],{'createdAt':{'$gte':_0x3baa52[_0x3fef('0x22')],'$lte':_0x3baa52[_0x3fef('0x24')]}});}if(_0x56c542[_0x3fef('0x23')][_0x3fef('0x34')]){_0x2c0848[_0x3fef('0x2e')]=_[_0x3fef('0x33')](_0x2c0848[_0x3fef('0x2e')],{'$or':_[_0x3fef('0x35')](_0x2c0848[_0x3fef('0x27')],function(_0x560aae){var _0x9c7d86={};_0x9c7d86[_0x560aae]={'$like':'%'+_0x56c542[_0x3fef('0x23')]['filter']+'%'};return _0x9c7d86;})});}_0x2c0848=_['merge']({},_0x2c0848,_0x56c542[_0x3fef('0x36')]);var _0x3dda68={'where':_0x2c0848[_0x3fef('0x2e')]};return db[_0x3fef('0x37')][_0x3fef('0x38')](_0x3dda68)[_0x3fef('0x1c')](function(_0x17aff8){_0xf2b269[_0x3fef('0x38')]=_0x17aff8;if(_0x56c542['query'][_0x3fef('0x39')]){_0x2c0848[_0x3fef('0x3a')]=[{'all':!![]}];}return db[_0x3fef('0x37')][_0x3fef('0x3b')](_0x2c0848);})[_0x3fef('0x1c')](function(_0x2143ec){_0xf2b269[_0x3fef('0x3c')]=_0x2143ec;return _0xf2b269;})[_0x3fef('0x1c')](respondWithFilteredResult(_0x45464b,_0x2c0848))[_0x3fef('0x3d')](handleError(_0x45464b,null));};exports[_0x3fef('0x3e')]=function(_0x12867c,_0x254880){var _0x2e1d7f={'raw':!![],'where':{'id':_0x12867c[_0x3fef('0x3f')]['id']}},_0x15d2c7={};_0x15d2c7['model']=_[_0x3fef('0x21')](db[_0x3fef('0x37')][_0x3fef('0x40')]);_0x15d2c7[_0x3fef('0x23')]=_[_0x3fef('0x21')](_0x12867c[_0x3fef('0x23')]);_0x15d2c7['filters']=_[_0x3fef('0x25')](_0x15d2c7['model'],_0x15d2c7[_0x3fef('0x23')]);_0x2e1d7f[_0x3fef('0x27')]=_['intersection'](_0x15d2c7[_0x3fef('0x26')],qs['fields'](_0x12867c[_0x3fef('0x23')][_0x3fef('0x28')]));_0x2e1d7f[_0x3fef('0x27')]=_0x2e1d7f[_0x3fef('0x27')][_0x3fef('0x29')]?_0x2e1d7f[_0x3fef('0x27')]:_0x15d2c7[_0x3fef('0x26')];if(_0x12867c[_0x3fef('0x23')][_0x3fef('0x39')]){_0x2e1d7f[_0x3fef('0x3a')]=[{'all':!![]}];}_0x2e1d7f=_[_0x3fef('0x33')]({},_0x2e1d7f,_0x12867c[_0x3fef('0x36')]);return db[_0x3fef('0x37')]['find'](_0x2e1d7f)[_0x3fef('0x1c')](handleEntityNotFound(_0x254880,null))[_0x3fef('0x1c')](respondWithResult(_0x254880,null))['catch'](handleError(_0x254880,null));};exports[_0x3fef('0x41')]=function(_0x4210d6,_0x2f00c0){return db['ZendeskField'][_0x3fef('0x41')](_0x4210d6[_0x3fef('0x42')],{})['then'](respondWithResult(_0x2f00c0,0xc9))[_0x3fef('0x3d')](handleError(_0x2f00c0,null));};exports['update']=function(_0x48322c,_0x15fb2c){if(_0x48322c['body']['id']){delete _0x48322c[_0x3fef('0x42')]['id'];}return db[_0x3fef('0x37')]['find']({'where':{'id':_0x48322c[_0x3fef('0x3f')]['id']}})[_0x3fef('0x1c')](handleEntityNotFound(_0x15fb2c,null))[_0x3fef('0x1c')](saveUpdates(_0x48322c['body'],null))[_0x3fef('0x1c')](respondWithResult(_0x15fb2c,null))[_0x3fef('0x3d')](handleError(_0x15fb2c,null));};exports[_0x3fef('0x1d')]=function(_0x5b1acb,_0x324f70){return db[_0x3fef('0x37')][_0x3fef('0x43')]({'where':{'id':_0x5b1acb[_0x3fef('0x3f')]['id']}})[_0x3fef('0x1c')](handleEntityNotFound(_0x324f70,null))['then'](removeEntity(_0x324f70,null))[_0x3fef('0x3d')](handleError(_0x324f70,null));}; \ No newline at end of file +var _0xed3c=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','update','then','destroy','name','send','ZendeskField','rawAttributes','model','keys','dateStart','dateEnd','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','day','add','merge','filter','map','options','includeAll','include','findAll','rows','catch','params','find','create','body','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto','jsforce','papaparse'];(function(_0x984e97,_0x2c72e7){var _0x3630e5=function(_0x3ef0c9){while(--_0x3ef0c9){_0x984e97['push'](_0x984e97['shift']());}};_0x3630e5(++_0x2c72e7);}(_0xed3c,0x1a6));var _0xced3=function(_0x970068,_0x3e4142){_0x970068=_0x970068-0x0;var _0x51063d=_0xed3c[_0x970068];return _0x51063d;};'use strict';var jsonpatch=require(_0xced3('0x0'));var rp=require(_0xced3('0x1'));var moment=require(_0xced3('0x2'));var BPromise=require(_0xced3('0x3'));var Mustache=require('mustache');var util=require(_0xced3('0x4'));var path=require(_0xced3('0x5'));var sox=require(_0xced3('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xced3('0x7'));var squel=require(_0xced3('0x8'));var crypto=require(_0xced3('0x9'));var jsforce=require(_0xced3('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xced3('0xb'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0xced3('0xc'));var config=require(_0xced3('0xd'));var db=require(_0xced3('0xe'))['db'];function respondWithStatusCode(_0x12612f,_0x1cb639){_0x1cb639=_0x1cb639||0xcc;return function(_0x5934b2){if(_0x5934b2){return _0x12612f[_0xced3('0xf')](_0x1cb639);}return _0x12612f[_0xced3('0x10')](_0x1cb639)[_0xced3('0x11')]();};}function respondWithResult(_0x4a4e55,_0x14f61c){_0x14f61c=_0x14f61c||0xc8;return function(_0x19b8c2){if(_0x19b8c2){return _0x4a4e55[_0xced3('0x10')](_0x14f61c)[_0xced3('0x12')](_0x19b8c2);}};}function respondWithFilteredResult(_0x457caf,_0x45d9fc){return function(_0x1869d5){if(_0x1869d5){var _0x5aadb6=_0x1869d5[_0xced3('0x13')],_0x65bb58=_0x45d9fc[_0xced3('0x14')],_0x5e186e=_0x45d9fc[_0xced3('0x14')]+_0x45d9fc['limit'],_0xf2db6f;if(_0x5e186e>=_0x5aadb6){_0x5e186e=_0x5aadb6;_0xf2db6f=0xc8;}else{_0xf2db6f=0xce;}_0x457caf[_0xced3('0x10')](_0xf2db6f);return _0x457caf[_0xced3('0x15')]('Content-Range',_0x65bb58+'-'+_0x5e186e+'/'+_0x5aadb6)[_0xced3('0x12')](_0x1869d5);}return null;};}function patchUpdates(_0x37e2d5){return function(_0x43a14f){try{jsonpatch[_0xced3('0x16')](_0x43a14f,_0x37e2d5,!![]);}catch(_0x55dbd5){return BPromise[_0xced3('0x17')](_0x55dbd5);}return _0x43a14f['save']();};}function saveUpdates(_0x353580,_0x4480a6){return function(_0x32c402){if(_0x32c402){return _0x32c402[_0xced3('0x18')](_0x353580)[_0xced3('0x19')](function(_0x688c97){return _0x688c97;});}return null;};}function removeEntity(_0xe0cf2e,_0x16d30d){return function(_0x3f688c){if(_0x3f688c){return _0x3f688c[_0xced3('0x1a')]()[_0xced3('0x19')](function(){_0xe0cf2e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e8c44,_0x1e8450){return function(_0x342b9e){if(!_0x342b9e){_0x5e8c44[_0xced3('0xf')](0x194);}return _0x342b9e;};}function handleError(_0x4bf915,_0x19d15c){_0x19d15c=_0x19d15c||0x1f4;return function(_0x30d984){logger['error'](_0x30d984['stack']);if(_0x30d984[_0xced3('0x1b')]){delete _0x30d984[_0xced3('0x1b')];}_0x4bf915[_0xced3('0x10')](_0x19d15c)[_0xced3('0x1c')](_0x30d984);};}exports['index']=function(_0x1905a3,_0x23f92b){var _0x4fc285={},_0x3fb4f9={},_0x4da7ce={'count':0x0,'rows':[]};var _0x1dcc52=db[_0xced3('0x1d')][_0xced3('0x1e')];_0x3fb4f9[_0xced3('0x1f')]=_[_0xced3('0x20')](_0x1dcc52);var _0x502cf1={'dateStart':_0x1905a3['query'][_0xced3('0x21')],'dateEnd':_0x1905a3['query'][_0xced3('0x22')]};delete _0x1905a3[_0xced3('0x23')]['dateStart'];delete _0x1905a3[_0xced3('0x23')][_0xced3('0x22')];_0x3fb4f9[_0xced3('0x23')]=_[_0xced3('0x20')](_0x1905a3[_0xced3('0x23')]);_0x3fb4f9[_0xced3('0x24')]=_[_0xced3('0x25')](_0x3fb4f9[_0xced3('0x1f')],_0x3fb4f9[_0xced3('0x23')]);_0x4fc285['attributes']=_[_0xced3('0x25')](_0x3fb4f9[_0xced3('0x1f')],qs[_0xced3('0x26')](_0x1905a3[_0xced3('0x23')][_0xced3('0x26')]));_0x4fc285[_0xced3('0x27')]=_0x4fc285[_0xced3('0x27')][_0xced3('0x28')]?_0x4fc285[_0xced3('0x27')]:_0x3fb4f9[_0xced3('0x1f')];if(!_0x1905a3[_0xced3('0x23')][_0xced3('0x29')](_0xced3('0x2a'))){_0x4fc285[_0xced3('0x2b')]=qs[_0xced3('0x2b')](_0x1905a3[_0xced3('0x23')][_0xced3('0x2b')]);_0x4fc285[_0xced3('0x14')]=qs[_0xced3('0x14')](_0x1905a3[_0xced3('0x23')][_0xced3('0x14')]);}_0x4fc285['order']=qs[_0xced3('0x2c')](_0x1905a3['query'][_0xced3('0x2c')]);_0x4fc285[_0xced3('0x2d')]=qs[_0xced3('0x24')](_[_0xced3('0x2e')](_0x1905a3[_0xced3('0x23')],_0x3fb4f9[_0xced3('0x24')]));if(_0x502cf1[_0xced3('0x21')]){if(_0x502cf1[_0xced3('0x22')]){_0x502cf1[_0xced3('0x22')]=moment(_0x502cf1[_0xced3('0x22')])['add'](0x1,_0xced3('0x2f'));}else{_0x502cf1[_0xced3('0x22')]=moment(_0x502cf1['dateStart'])[_0xced3('0x30')](0x1,_0xced3('0x2f'));}_[_0xced3('0x31')](_0x4fc285['where'],{'createdAt':{'$gte':_0x502cf1['dateStart'],'$lte':_0x502cf1[_0xced3('0x22')]}});}if(_0x1905a3['query'][_0xced3('0x32')]){_0x4fc285[_0xced3('0x2d')]=_['merge'](_0x4fc285[_0xced3('0x2d')],{'$or':_[_0xced3('0x33')](_0x4fc285[_0xced3('0x27')],function(_0x58b344){var _0x21c0fa={};_0x21c0fa[_0x58b344]={'$like':'%'+_0x1905a3['query']['filter']+'%'};return _0x21c0fa;})});}_0x4fc285=_[_0xced3('0x31')]({},_0x4fc285,_0x1905a3[_0xced3('0x34')]);var _0x217bff={'where':_0x4fc285['where']};return db[_0xced3('0x1d')][_0xced3('0x13')](_0x217bff)[_0xced3('0x19')](function(_0x28626b){_0x4da7ce[_0xced3('0x13')]=_0x28626b;if(_0x1905a3[_0xced3('0x23')][_0xced3('0x35')]){_0x4fc285[_0xced3('0x36')]=[{'all':!![]}];}return db[_0xced3('0x1d')][_0xced3('0x37')](_0x4fc285);})[_0xced3('0x19')](function(_0x38855f){_0x4da7ce[_0xced3('0x38')]=_0x38855f;return _0x4da7ce;})[_0xced3('0x19')](respondWithFilteredResult(_0x23f92b,_0x4fc285))[_0xced3('0x39')](handleError(_0x23f92b,null));};exports['show']=function(_0x4279a3,_0x2ec0ad){var _0x44ff72={'raw':!![],'where':{'id':_0x4279a3[_0xced3('0x3a')]['id']}},_0x1a6c1f={};_0x1a6c1f[_0xced3('0x1f')]=_[_0xced3('0x20')](db[_0xced3('0x1d')][_0xced3('0x1e')]);_0x1a6c1f['query']=_[_0xced3('0x20')](_0x4279a3['query']);_0x1a6c1f[_0xced3('0x24')]=_[_0xced3('0x25')](_0x1a6c1f[_0xced3('0x1f')],_0x1a6c1f['query']);_0x44ff72[_0xced3('0x27')]=_[_0xced3('0x25')](_0x1a6c1f[_0xced3('0x1f')],qs[_0xced3('0x26')](_0x4279a3['query'][_0xced3('0x26')]));_0x44ff72[_0xced3('0x27')]=_0x44ff72[_0xced3('0x27')][_0xced3('0x28')]?_0x44ff72[_0xced3('0x27')]:_0x1a6c1f['model'];if(_0x4279a3[_0xced3('0x23')][_0xced3('0x35')]){_0x44ff72[_0xced3('0x36')]=[{'all':!![]}];}_0x44ff72=_[_0xced3('0x31')]({},_0x44ff72,_0x4279a3[_0xced3('0x34')]);return db[_0xced3('0x1d')][_0xced3('0x3b')](_0x44ff72)['then'](handleEntityNotFound(_0x2ec0ad,null))[_0xced3('0x19')](respondWithResult(_0x2ec0ad,null))[_0xced3('0x39')](handleError(_0x2ec0ad,null));};exports['create']=function(_0x569c3d,_0x140df2){return db['ZendeskField'][_0xced3('0x3c')](_0x569c3d[_0xced3('0x3d')],{})[_0xced3('0x19')](respondWithResult(_0x140df2,0xc9))[_0xced3('0x39')](handleError(_0x140df2,null));};exports[_0xced3('0x18')]=function(_0x1b3396,_0x3700ed){if(_0x1b3396[_0xced3('0x3d')]['id']){delete _0x1b3396[_0xced3('0x3d')]['id'];}return db['ZendeskField'][_0xced3('0x3b')]({'where':{'id':_0x1b3396[_0xced3('0x3a')]['id']}})[_0xced3('0x19')](handleEntityNotFound(_0x3700ed,null))[_0xced3('0x19')](saveUpdates(_0x1b3396[_0xced3('0x3d')],null))[_0xced3('0x19')](respondWithResult(_0x3700ed,null))['catch'](handleError(_0x3700ed,null));};exports[_0xced3('0x1a')]=function(_0x629ecf,_0x74f70){return db[_0xced3('0x1d')][_0xced3('0x3b')]({'where':{'id':_0x629ecf[_0xced3('0x3a')]['id']}})[_0xced3('0x19')](handleEntityNotFound(_0x74f70,null))[_0xced3('0x19')](removeEntity(_0x74f70,null))[_0xced3('0x39')](handleError(_0x74f70,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 966bd2e..7442cdb 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 _0xb094=['lodash','util','../../config/logger','bluebird','request-promise','./intZendeskField.attributes','int_zendesk_fields'];(function(_0x454ab7,_0x1d3745){var _0x4baa7f=function(_0x3343dd){while(--_0x3343dd){_0x454ab7['push'](_0x454ab7['shift']());}};_0x4baa7f(++_0x1d3745);}(_0xb094,0xee));var _0x4b09=function(_0x317fdc,_0x53096e){_0x317fdc=_0x317fdc-0x0;var _0x3786ea=_0xb094[_0x317fdc];return _0x3786ea;};'use strict';var _=require(_0x4b09('0x0'));var util=require(_0x4b09('0x1'));var logger=require(_0x4b09('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4b09('0x3'));var rp=require(_0x4b09('0x4'));var attributes=require(_0x4b09('0x5'));module['exports']=function(_0x45488b,_0x4e1ee3){return _0x45488b['define']('ZendeskField',attributes,{'tableName':_0x4b09('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b93=['lodash','util','api','moment','bluebird','request-promise','exports','define','ZendeskField'];(function(_0x4a6e4d,_0x194d72){var _0x13e23a=function(_0x242532){while(--_0x242532){_0x4a6e4d['push'](_0x4a6e4d['shift']());}};_0x13e23a(++_0x194d72);}(_0x2b93,0x1b0));var _0x32b9=function(_0x333fed,_0x3d2122){_0x333fed=_0x333fed-0x0;var _0x12cac2=_0x2b93[_0x333fed];return _0x12cac2;};'use strict';var _=require(_0x32b9('0x0'));var util=require(_0x32b9('0x1'));var logger=require('../../config/logger')(_0x32b9('0x2'));var moment=require(_0x32b9('0x3'));var BPromise=require(_0x32b9('0x4'));var rp=require(_0x32b9('0x5'));var attributes=require('./intZendeskField.attributes');module[_0x32b9('0x6')]=function(_0x443570,_0x493cb8){return _0x443570[_0x32b9('0x7')](_0x32b9('0x8'),attributes,{'tableName':'int_zendesk_fields','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 30b7183..07f76fd 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 _0x7a2b=['http','request','then','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','ZendeskField,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7a2b,0x189));var _0xb7a2=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7a2b[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0xb7a2('0x0'));var moment=require('moment');var BPromise=require(_0xb7a2('0x1'));var rs=require(_0xb7a2('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xb7a2('0x3'));var logger=require(_0xb7a2('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb7a2('0x5'));var client=jayson[_0xb7a2('0x6')][_0xb7a2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5dfe52,_0x3fbd79,_0x442260){return new BPromise(function(_0x570592,_0x3a8b04){return client[_0xb7a2('0x8')](_0x5dfe52,_0x442260)[_0xb7a2('0x9')](function(_0x1deb0a){logger[_0xb7a2('0xa')]('ZendeskField,\x20%s,\x20%s',_0x3fbd79,_0xb7a2('0xb'));logger[_0xb7a2('0xc')](_0xb7a2('0xd'),_0x3fbd79,_0xb7a2('0xb'),JSON['stringify'](_0x1deb0a));if(_0x1deb0a[_0xb7a2('0xe')]){if(_0x1deb0a[_0xb7a2('0xe')][_0xb7a2('0xf')]===0x1f4){logger['error'](_0xb7a2('0x10'),_0x3fbd79,_0x1deb0a['error'][_0xb7a2('0x11')]);return _0x3a8b04(_0x1deb0a[_0xb7a2('0xe')][_0xb7a2('0x11')]);}logger[_0xb7a2('0xe')](_0xb7a2('0x10'),_0x3fbd79,_0x1deb0a['error'][_0xb7a2('0x11')]);return _0x570592(_0x1deb0a[_0xb7a2('0xe')][_0xb7a2('0x11')]);}else{logger[_0xb7a2('0xa')]('ZendeskField,\x20%s,\x20%s',_0x3fbd79,_0xb7a2('0xb'));_0x570592(_0x1deb0a[_0xb7a2('0x12')]['message']);}})[_0xb7a2('0x13')](function(_0x32e7c1){logger[_0xb7a2('0xe')](_0xb7a2('0x10'),_0x3fbd79,_0x32e7c1);_0x3a8b04(_0x32e7c1);});});} \ No newline at end of file +var _0x86c6=['ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x59710f,_0x44c7f0){var _0xaae66a=function(_0x1c2397){while(--_0x1c2397){_0x59710f['push'](_0x59710f['shift']());}};_0xaae66a(++_0x44c7f0);}(_0x86c6,0x7d));var _0x686c=function(_0x5a1e77,_0x1060b2){_0x5a1e77=_0x5a1e77-0x0;var _0x1500ca=_0x86c6[_0x5a1e77];return _0x1500ca;};'use strict';var _=require(_0x686c('0x0'));var util=require('util');var moment=require(_0x686c('0x1'));var BPromise=require(_0x686c('0x2'));var rs=require(_0x686c('0x3'));var fs=require('fs');var db=require(_0x686c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x686c('0x5'))(_0x686c('0x6'));var config=require('../../config/environment');var jayson=require(_0x686c('0x7'));var client=jayson[_0x686c('0x8')][_0x686c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37a4b1,_0x50013b,_0x3e07fc){return new BPromise(function(_0xd87efd,_0x52671f){return client[_0x686c('0xa')](_0x37a4b1,_0x3e07fc)[_0x686c('0xb')](function(_0x301021){logger[_0x686c('0xc')](_0x686c('0xd'),_0x50013b,_0x686c('0xe'));logger['debug'](_0x686c('0xf'),_0x50013b,_0x686c('0xe'),JSON['stringify'](_0x301021));if(_0x301021[_0x686c('0x10')]){if(_0x301021[_0x686c('0x10')][_0x686c('0x11')]===0x1f4){logger['error'](_0x686c('0xd'),_0x50013b,_0x301021[_0x686c('0x10')][_0x686c('0x12')]);return _0x52671f(_0x301021[_0x686c('0x10')][_0x686c('0x12')]);}logger[_0x686c('0x10')](_0x686c('0xd'),_0x50013b,_0x301021[_0x686c('0x10')][_0x686c('0x12')]);return _0xd87efd(_0x301021[_0x686c('0x10')]['message']);}else{logger[_0x686c('0xc')]('ZendeskField,\x20%s,\x20%s',_0x50013b,_0x686c('0xe'));_0xd87efd(_0x301021[_0x686c('0x13')][_0x686c('0x12')]);}})['catch'](function(_0x2163bf){logger[_0x686c('0x10')]('ZendeskField,\x20%s,\x20%s',_0x50013b,_0x2163bf);_0x52671f(_0x2163bf);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 3360841..d8a2894 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 _0xcccc=['multer','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','destroy','exports'];(function(_0x1790a6,_0x5c9bfb){var _0x46c345=function(_0x3604ac){while(--_0x3604ac){_0x1790a6['push'](_0x1790a6['shift']());}};_0x46c345(++_0x5c9bfb);}(_0xcccc,0x143));var _0xcccc=function(_0x1dad92,_0x2f948c){_0x1dad92=_0x1dad92-0x0;var _0x90a9f6=_0xcccc[_0x1dad92];return _0x90a9f6;};'use strict';var multer=require(_0xcccc('0x0'));var util=require('util');var path=require('path');var express=require(_0xcccc('0x1'));var router=express[_0xcccc('0x2')]();var auth=require(_0xcccc('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xcccc('0x4'));var controller=require('./intZohoAccount.controller');router[_0xcccc('0x5')]('/',auth[_0xcccc('0x6')](),controller[_0xcccc('0x7')]);router[_0xcccc('0x5')](_0xcccc('0x8'),auth[_0xcccc('0x6')](),controller[_0xcccc('0x9')]);router[_0xcccc('0x5')](_0xcccc('0xa'),auth[_0xcccc('0x6')](),controller[_0xcccc('0xb')]);router[_0xcccc('0x5')](_0xcccc('0xc'),auth['isAuthenticated'](),controller[_0xcccc('0xd')]);router[_0xcccc('0xe')]('/',auth[_0xcccc('0x6')](),controller[_0xcccc('0xf')]);router[_0xcccc('0xe')](_0xcccc('0xa'),auth[_0xcccc('0x6')](),controller['addConfiguration']);router[_0xcccc('0x10')]('/:id',auth[_0xcccc('0x6')](),controller['update']);router['delete'](_0xcccc('0x8'),auth[_0xcccc('0x6')](),controller[_0xcccc('0x11')]);module[_0xcccc('0x12')]=router; \ No newline at end of file +var _0x3049=['post','create','addConfiguration','put','/:id','update','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x24d23f,_0x580895){var _0x2da7f5=function(_0xdf51d0){while(--_0xdf51d0){_0x24d23f['push'](_0x24d23f['shift']());}};_0x2da7f5(++_0x580895);}(_0x3049,0x99));var _0x9304=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x3049[_0xf50820];return _0x2a9b10;};'use strict';var multer=require('multer');var util=require(_0x9304('0x0'));var path=require(_0x9304('0x1'));var express=require(_0x9304('0x2'));var router=express['Router']();var auth=require(_0x9304('0x3'));var interaction=require(_0x9304('0x4'));var config=require(_0x9304('0x5'));var controller=require(_0x9304('0x6'));router[_0x9304('0x7')]('/',auth['isAuthenticated'](),controller[_0x9304('0x8')]);router[_0x9304('0x7')]('/:id',auth[_0x9304('0x9')](),controller[_0x9304('0xa')]);router[_0x9304('0x7')](_0x9304('0xb'),auth[_0x9304('0x9')](),controller[_0x9304('0xc')]);router[_0x9304('0x7')](_0x9304('0xd'),auth['isAuthenticated'](),controller[_0x9304('0xe')]);router[_0x9304('0xf')]('/',auth[_0x9304('0x9')](),controller[_0x9304('0x10')]);router[_0x9304('0xf')](_0x9304('0xb'),auth[_0x9304('0x9')](),controller[_0x9304('0x11')]);router[_0x9304('0x12')](_0x9304('0x13'),auth[_0x9304('0x9')](),controller[_0x9304('0x14')]);router[_0x9304('0x15')](_0x9304('0x13'),auth[_0x9304('0x9')](),controller[_0x9304('0x16')]);module[_0x9304('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 7008538..f558bba 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 _0x238d=['sequelize','STRING'];(function(_0x57338e,_0x49889f){var _0x3da2b7=function(_0xd32650){while(--_0xd32650){_0x57338e['push'](_0x57338e['shift']());}};_0x3da2b7(++_0x49889f);}(_0x238d,0x104));var _0xd238=function(_0x4dc7b8,_0x174337){_0x4dc7b8=_0x4dc7b8-0x0;var _0x5433df=_0x238d[_0x4dc7b8];return _0x5433df;};'use strict';var Sequelize=require(_0xd238('0x0'));module['exports']={'name':{'type':Sequelize[_0xd238('0x1')]},'description':{'type':Sequelize[_0xd238('0x1')]},'authToken':{'type':Sequelize[_0xd238('0x1')]},'host':{'type':Sequelize[_0xd238('0x1')]},'serverUrl':{'type':Sequelize[_0xd238('0x1')]}}; \ No newline at end of file +var _0xf9ce=['STRING','sequelize'];(function(_0x44c768,_0x552a5e){var _0x55daf5=function(_0x4958e8){while(--_0x4958e8){_0x44c768['push'](_0x44c768['shift']());}};_0x55daf5(++_0x552a5e);}(_0xf9ce,0x1a5));var _0xef9c=function(_0x3e6b2f,_0x1ffa07){_0x3e6b2f=_0x3e6b2f-0x0;var _0x323215=_0xf9ce[_0x3e6b2f];return _0x323215;};'use strict';var Sequelize=require(_0xef9c('0x0'));module['exports']={'name':{'type':Sequelize[_0xef9c('0x1')]},'description':{'type':Sequelize[_0xef9c('0x1')]},'authToken':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xef9c('0x1')]},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index de1d000..1a13597 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 _0x2eac=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','dateStart','day','merge','filter','map','options','includeAll','include','findAll','show','keys','find','create','body','params','getConfigurations','findOne','ZohoConfiguration','addConfiguration','getSubjects','type','Descriptions','getDescriptions','ZohoField','host','authToken','format','https://crm.%s/crm/private/json/Calls/getFields','crmapi','response','Calls','section','Call\x20Purpose','includes','push','label','customfield','Pick\x20List','val','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','ZohoAccount','rawAttributes','model','query','dateEnd'];(function(_0x404238,_0x12a383){var _0x253b29=function(_0x33ebad){while(--_0x33ebad){_0x404238['push'](_0x404238['shift']());}};_0x253b29(++_0x12a383);}(_0x2eac,0x108));var _0xc2ea=function(_0x357a32,_0x330db8){_0x357a32=_0x357a32-0x0;var _0x16233b=_0x2eac[_0x357a32];return _0x16233b;};'use strict';var jsonpatch=require(_0xc2ea('0x0'));var rp=require(_0xc2ea('0x1'));var moment=require(_0xc2ea('0x2'));var BPromise=require(_0xc2ea('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc2ea('0x4'));var sox=require(_0xc2ea('0x5'));var csv=require(_0xc2ea('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc2ea('0x7'));var crypto=require('crypto');var jsforce=require(_0xc2ea('0x8'));var deskjs=require(_0xc2ea('0x9'));var toCsv=require('to-csv');var querystring=require(_0xc2ea('0xa'));var Papa=require(_0xc2ea('0xb'));var qs=require(_0xc2ea('0xc'));var logger=require(_0xc2ea('0xd'))('api');var utils=require('../../config/utils');var config=require(_0xc2ea('0xe'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc2ea('0xf'));var jayson=require(_0xc2ea('0x10'));var client=jayson[_0xc2ea('0x11')][_0xc2ea('0x12')]({'port':0x232a});function respondWithRpcPromise(_0xb1dfb3,_0x39e3d8,_0x6794f1,_0x55802f){return new BPromise(function(_0x23e44f,_0x4ef2fe){var _0x3de153=_0x55802f||client;return _0x3de153[_0xc2ea('0x13')](_0xb1dfb3,_0x6794f1)[_0xc2ea('0x14')](function(_0x56feff){logger['info'](_0xc2ea('0x15'),_0x39e3d8,_0xc2ea('0x16'));logger[_0xc2ea('0x17')](_0xc2ea('0x18'),_0x39e3d8,'request\x20sent',JSON[_0xc2ea('0x19')](_0x56feff));if(_0x56feff[_0xc2ea('0x1a')]){if(_0x56feff[_0xc2ea('0x1a')][_0xc2ea('0x1b')]===0x1f4){logger['error'](_0xc2ea('0x15'),_0x39e3d8,_0x56feff[_0xc2ea('0x1a')][_0xc2ea('0x1c')]);return _0x4ef2fe(_0x56feff[_0xc2ea('0x1a')][_0xc2ea('0x1c')]);}logger[_0xc2ea('0x1a')](_0xc2ea('0x15'),_0x39e3d8,_0x56feff['error'][_0xc2ea('0x1c')]);return _0x23e44f(_0x56feff[_0xc2ea('0x1a')][_0xc2ea('0x1c')]);}else{logger[_0xc2ea('0x1d')](_0xc2ea('0x15'),_0x39e3d8,_0xc2ea('0x16'));_0x23e44f(_0x56feff[_0xc2ea('0x1e')][_0xc2ea('0x1c')]);}})[_0xc2ea('0x1f')](function(_0x526c02){logger[_0xc2ea('0x1a')]('ZohoAccount,\x20%s,\x20%s',_0x39e3d8,_0x526c02);_0x4ef2fe(_0x526c02);});});}function respondWithStatusCode(_0x5c415a,_0x5179b8){_0x5179b8=_0x5179b8||0xcc;return function(_0x1b31d4){if(_0x1b31d4){return _0x5c415a[_0xc2ea('0x20')](_0x5179b8);}return _0x5c415a[_0xc2ea('0x21')](_0x5179b8)[_0xc2ea('0x22')]();};}function respondWithResult(_0x18b4d1,_0x1bea47){_0x1bea47=_0x1bea47||0xc8;return function(_0x4c158d){if(_0x4c158d){return _0x18b4d1['status'](_0x1bea47)[_0xc2ea('0x23')](_0x4c158d);}};}function respondWithFilteredResult(_0x41f8d5,_0x3918df){return function(_0x1350c7){if(_0x1350c7){var _0x5c88fe=_0x1350c7[_0xc2ea('0x24')],_0x383feb=_0x3918df[_0xc2ea('0x25')],_0x11a9dd=_0x3918df[_0xc2ea('0x25')]+_0x3918df[_0xc2ea('0x26')],_0x545be9;if(_0x11a9dd>=_0x5c88fe){_0x11a9dd=_0x5c88fe;_0x545be9=0xc8;}else{_0x545be9=0xce;}_0x41f8d5['status'](_0x545be9);return _0x41f8d5[_0xc2ea('0x27')](_0xc2ea('0x28'),_0x383feb+'-'+_0x11a9dd+'/'+_0x5c88fe)[_0xc2ea('0x23')](_0x1350c7);}return null;};}function patchUpdates(_0x4b2335){return function(_0x581be1){try{jsonpatch[_0xc2ea('0x29')](_0x581be1,_0x4b2335,!![]);}catch(_0x500de6){return BPromise[_0xc2ea('0x2a')](_0x500de6);}return _0x581be1[_0xc2ea('0x2b')]();};}function saveUpdates(_0x1c4857,_0x3c1cc0){return function(_0x357c7b){if(_0x357c7b){return _0x357c7b[_0xc2ea('0x2c')](_0x1c4857)[_0xc2ea('0x14')](function(_0x34743d){return _0x34743d;});}return null;};}function removeEntity(_0x2ea9ae,_0x386fc7){return function(_0x266f02){if(_0x266f02){return _0x266f02[_0xc2ea('0x2d')]()['then'](function(){_0x2ea9ae['status'](0xcc)[_0xc2ea('0x22')]();});}};}function handleEntityNotFound(_0x97e3de,_0x312a8a){return function(_0x12e51b){if(!_0x12e51b){_0x97e3de[_0xc2ea('0x20')](0x194);}return _0x12e51b;};}function handleError(_0x55860a,_0x42a435){_0x42a435=_0x42a435||0x1f4;return function(_0x547d51){logger[_0xc2ea('0x1a')](_0x547d51[_0xc2ea('0x2e')]);if(_0x547d51['name']){delete _0x547d51[_0xc2ea('0x2f')];}_0x55860a[_0xc2ea('0x21')](_0x42a435)[_0xc2ea('0x30')](_0x547d51);};}exports['index']=function(_0x3291dc,_0x52dc8b){var _0x51da6f={},_0x485724={},_0x4ba840={'count':0x0,'rows':[]};var _0x15bc7e=db[_0xc2ea('0x31')][_0xc2ea('0x32')];_0x485724[_0xc2ea('0x33')]=_['keys'](_0x15bc7e);var _0x580ede={'dateStart':_0x3291dc[_0xc2ea('0x34')]['dateStart'],'dateEnd':_0x3291dc[_0xc2ea('0x34')][_0xc2ea('0x35')]};delete _0x3291dc[_0xc2ea('0x34')]['dateStart'];delete _0x3291dc[_0xc2ea('0x34')]['dateEnd'];_0x485724[_0xc2ea('0x34')]=_['keys'](_0x3291dc[_0xc2ea('0x34')]);_0x485724[_0xc2ea('0x36')]=_[_0xc2ea('0x37')](_0x485724['model'],_0x485724['query']);_0x51da6f[_0xc2ea('0x38')]=_[_0xc2ea('0x37')](_0x485724['model'],qs[_0xc2ea('0x39')](_0x3291dc['query'][_0xc2ea('0x39')]));_0x51da6f['attributes']=_0x51da6f[_0xc2ea('0x38')][_0xc2ea('0x3a')]?_0x51da6f['attributes']:_0x485724[_0xc2ea('0x33')];if(!_0x3291dc[_0xc2ea('0x34')][_0xc2ea('0x3b')]('nolimit')){_0x51da6f[_0xc2ea('0x26')]=qs['limit'](_0x3291dc[_0xc2ea('0x34')][_0xc2ea('0x26')]);_0x51da6f[_0xc2ea('0x25')]=qs[_0xc2ea('0x25')](_0x3291dc[_0xc2ea('0x34')][_0xc2ea('0x25')]);}_0x51da6f[_0xc2ea('0x3c')]=qs[_0xc2ea('0x3d')](_0x3291dc[_0xc2ea('0x34')][_0xc2ea('0x3d')]);_0x51da6f[_0xc2ea('0x3e')]=qs[_0xc2ea('0x36')](_['pick'](_0x3291dc[_0xc2ea('0x34')],_0x485724['filters']));if(_0x580ede[_0xc2ea('0x3f')]){if(_0x580ede[_0xc2ea('0x35')]){_0x580ede[_0xc2ea('0x35')]=moment(_0x580ede['dateEnd'])['add'](0x1,_0xc2ea('0x40'));}else{_0x580ede[_0xc2ea('0x35')]=moment(_0x580ede[_0xc2ea('0x3f')])['add'](0x1,'day');}_[_0xc2ea('0x41')](_0x51da6f['where'],{'createdAt':{'$gte':_0x580ede[_0xc2ea('0x3f')],'$lte':_0x580ede[_0xc2ea('0x35')]}});}if(_0x3291dc[_0xc2ea('0x34')][_0xc2ea('0x42')]){_0x51da6f[_0xc2ea('0x3e')]=_['merge'](_0x51da6f[_0xc2ea('0x3e')],{'$or':_[_0xc2ea('0x43')](_0x51da6f[_0xc2ea('0x38')],function(_0x3e3220){var _0xcbcea6={};_0xcbcea6[_0x3e3220]={'$like':'%'+_0x3291dc[_0xc2ea('0x34')][_0xc2ea('0x42')]+'%'};return _0xcbcea6;})});}_0x51da6f=_[_0xc2ea('0x41')]({},_0x51da6f,_0x3291dc[_0xc2ea('0x44')]);var _0x3a14da={'where':_0x51da6f[_0xc2ea('0x3e')]};return db[_0xc2ea('0x31')][_0xc2ea('0x24')](_0x3a14da)[_0xc2ea('0x14')](function(_0x4bd211){_0x4ba840[_0xc2ea('0x24')]=_0x4bd211;if(_0x3291dc[_0xc2ea('0x34')][_0xc2ea('0x45')]){_0x51da6f[_0xc2ea('0x46')]=[{'all':!![]}];}return db['ZohoAccount'][_0xc2ea('0x47')](_0x51da6f);})[_0xc2ea('0x14')](function(_0x40fd0b){_0x4ba840['rows']=_0x40fd0b;return _0x4ba840;})[_0xc2ea('0x14')](respondWithFilteredResult(_0x52dc8b,_0x51da6f))[_0xc2ea('0x1f')](handleError(_0x52dc8b,null));};exports[_0xc2ea('0x48')]=function(_0x596816,_0x17c045){var _0x18eb89={'raw':![],'where':{'id':_0x596816['params']['id']}},_0x34120e={};_0x34120e[_0xc2ea('0x33')]=_['keys'](db[_0xc2ea('0x31')]['rawAttributes']);_0x34120e[_0xc2ea('0x34')]=_[_0xc2ea('0x49')](_0x596816['query']);_0x34120e[_0xc2ea('0x36')]=_['intersection'](_0x34120e['model'],_0x34120e['query']);_0x18eb89[_0xc2ea('0x38')]=_[_0xc2ea('0x37')](_0x34120e[_0xc2ea('0x33')],qs[_0xc2ea('0x39')](_0x596816['query'][_0xc2ea('0x39')]));_0x18eb89[_0xc2ea('0x38')]=_0x18eb89['attributes'][_0xc2ea('0x3a')]?_0x18eb89[_0xc2ea('0x38')]:_0x34120e[_0xc2ea('0x33')];if(_0x596816[_0xc2ea('0x34')][_0xc2ea('0x45')]){_0x18eb89[_0xc2ea('0x46')]=[{'all':!![]}];}_0x18eb89=_[_0xc2ea('0x41')]({},_0x18eb89,_0x596816[_0xc2ea('0x44')]);return db['ZohoAccount'][_0xc2ea('0x4a')](_0x18eb89)[_0xc2ea('0x14')](handleEntityNotFound(_0x17c045,null))['then'](respondWithResult(_0x17c045,null))[_0xc2ea('0x1f')](handleError(_0x17c045,null));};exports[_0xc2ea('0x4b')]=function(_0x329d1e,_0x539ada){return db[_0xc2ea('0x31')][_0xc2ea('0x4b')](_0x329d1e['body'],{})[_0xc2ea('0x14')](respondWithResult(_0x539ada,0xc9))[_0xc2ea('0x1f')](handleError(_0x539ada,null));};exports[_0xc2ea('0x2c')]=function(_0x276d1e,_0x225e5d){if(_0x276d1e[_0xc2ea('0x4c')]['id']){delete _0x276d1e[_0xc2ea('0x4c')]['id'];}return db[_0xc2ea('0x31')][_0xc2ea('0x4a')]({'where':{'id':_0x276d1e['params']['id']}})[_0xc2ea('0x14')](handleEntityNotFound(_0x225e5d,null))[_0xc2ea('0x14')](saveUpdates(_0x276d1e[_0xc2ea('0x4c')],null))[_0xc2ea('0x14')](respondWithResult(_0x225e5d,null))['catch'](handleError(_0x225e5d,null));};exports[_0xc2ea('0x2d')]=function(_0x287f86,_0x29d3cf){return db[_0xc2ea('0x31')][_0xc2ea('0x4a')]({'where':{'id':_0x287f86[_0xc2ea('0x4d')]['id']}})['then'](handleEntityNotFound(_0x29d3cf,null))[_0xc2ea('0x14')](removeEntity(_0x29d3cf,null))['catch'](handleError(_0x29d3cf,null));};exports[_0xc2ea('0x4e')]=function(_0x4ee6cb,_0x3f6b8e,_0x56a111){var _0x181072={};var _0x1cbdac={};var _0x1af43c;var _0x5b4445;return db[_0xc2ea('0x31')][_0xc2ea('0x4f')]({'where':{'id':_0x4ee6cb[_0xc2ea('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3f6b8e,null))['then'](function(_0x566fcb){if(_0x566fcb){_0x1af43c=_0x566fcb;_0x1cbdac[_0xc2ea('0x33')]=_[_0xc2ea('0x49')](db[_0xc2ea('0x50')][_0xc2ea('0x32')]);_0x1cbdac[_0xc2ea('0x34')]=_[_0xc2ea('0x49')](_0x4ee6cb['query']);_0x1cbdac[_0xc2ea('0x36')]=_['intersection'](_0x1cbdac[_0xc2ea('0x33')],_0x1cbdac[_0xc2ea('0x34')]);_0x181072['attributes']=_[_0xc2ea('0x37')](_0x1cbdac[_0xc2ea('0x33')],qs[_0xc2ea('0x39')](_0x4ee6cb[_0xc2ea('0x34')]['fields']));_0x181072[_0xc2ea('0x38')]=_0x181072[_0xc2ea('0x38')][_0xc2ea('0x3a')]?_0x181072[_0xc2ea('0x38')]:_0x1cbdac[_0xc2ea('0x33')];_0x181072[_0xc2ea('0x3c')]=qs[_0xc2ea('0x3d')](_0x4ee6cb[_0xc2ea('0x34')][_0xc2ea('0x3d')]);_0x181072[_0xc2ea('0x3e')]=qs[_0xc2ea('0x36')](_['pick'](_0x4ee6cb['query'],_0x1cbdac['filters']));if(_0x4ee6cb[_0xc2ea('0x34')]['filter']){_0x181072[_0xc2ea('0x3e')]=_[_0xc2ea('0x41')](_0x181072[_0xc2ea('0x3e')],{'$or':_['map'](_0x181072[_0xc2ea('0x38')],function(_0x70dfa4){var _0x5c9e68={};_0x5c9e68[_0x70dfa4]={'$like':'%'+_0x4ee6cb['query'][_0xc2ea('0x42')]+'%'};return _0x5c9e68;})});}_0x181072=_[_0xc2ea('0x41')]({},_0x181072,_0x4ee6cb[_0xc2ea('0x44')]);return _0x1af43c['getConfigurations'](_0x181072);}})[_0xc2ea('0x14')](function(_0x3a8b2a){if(_0x3a8b2a){_0x5b4445=_0x3a8b2a[_0xc2ea('0x3a')];if(!_0x4ee6cb[_0xc2ea('0x34')][_0xc2ea('0x3b')]('nolimit')){_0x181072[_0xc2ea('0x26')]=qs['limit'](_0x4ee6cb['query'][_0xc2ea('0x26')]);_0x181072[_0xc2ea('0x25')]=qs[_0xc2ea('0x25')](_0x4ee6cb[_0xc2ea('0x34')][_0xc2ea('0x25')]);}return _0x1af43c['getConfigurations'](_0x181072);}})[_0xc2ea('0x14')](function(_0xda4dee){if(_0xda4dee){return _0xda4dee?{'count':_0x5b4445,'rows':_0xda4dee}:null;}})[_0xc2ea('0x14')](respondWithResult(_0x3f6b8e,null))['catch'](handleError(_0x3f6b8e,null));};exports[_0xc2ea('0x51')]=function(_0x1629b6,_0x3e018a,_0xee5918){if(_0x1629b6['body']['id']){delete _0x1629b6[_0xc2ea('0x4c')]['id'];}return db[_0xc2ea('0x31')]['findOne']({'where':{'id':_0x1629b6[_0xc2ea('0x4d')]['id']}})[_0xc2ea('0x14')](handleEntityNotFound(_0x3e018a,null))[_0xc2ea('0x14')](function(_0x1a2c09){if(_0x1a2c09){_0x1629b6[_0xc2ea('0x4c')]['AccountId']=_0x1a2c09['id'];_0x1629b6[_0xc2ea('0x4c')]['Subjects']=integrations[_0xc2ea('0x52')](_0x1629b6['body']['channel'],_0x1629b6[_0xc2ea('0x4c')][_0xc2ea('0x53')]);_0x1629b6[_0xc2ea('0x4c')][_0xc2ea('0x54')]=integrations[_0xc2ea('0x55')](_0x1629b6[_0xc2ea('0x4c')]['channel'],_0x1629b6['body'][_0xc2ea('0x53')]);return db[_0xc2ea('0x50')][_0xc2ea('0x4b')](_0x1629b6[_0xc2ea('0x4c')],{'include':[{'model':db[_0xc2ea('0x56')],'as':'Subjects'},{'model':db['ZohoField'],'as':_0xc2ea('0x54')}]});}return null;})[_0xc2ea('0x14')](respondWithResult(_0x3e018a,null))[_0xc2ea('0x1f')](handleError(_0x3e018a,null));};exports['getFields']=function(_0x5b680b,_0x4efa18,_0x58c456){return db['ZohoAccount']['findOne']({'where':{'id':_0x5b680b[_0xc2ea('0x4d')]['id']},'attributes':['id',_0xc2ea('0x57'),_0xc2ea('0x58')]})[_0xc2ea('0x14')](handleEntityNotFound(_0x4efa18,null))[_0xc2ea('0x14')](function(_0x260a35){if(_0x260a35){return rp({'method':'GET','uri':util[_0xc2ea('0x59')](_0xc2ea('0x5a'),_0x260a35[_0xc2ea('0x57')]),'qs':{'authtoken':_0x260a35[_0xc2ea('0x58')],'scope':_0xc2ea('0x5b')},'json':!![]});}})[_0xc2ea('0x14')](function(_0xf5d9){if(_0xf5d9){if(_0xf5d9[_0xc2ea('0x5c')]&&_0xf5d9[_0xc2ea('0x5c')]['error']){throw new Error(_0xf5d9['response'][_0xc2ea('0x1a')][_0xc2ea('0x1c')]);}var _0x3ecea7=[];if(_0xf5d9[_0xc2ea('0x5d')]&&_0xf5d9['Calls']['section']){if(_0xf5d9[_0xc2ea('0x5d')][_0xc2ea('0x5e')]['FL']){var _0x28b872=[_0xc2ea('0x5f')];for(var _0x49c806=0x0,_0x159cc6=_0xf5d9[_0xc2ea('0x5d')][_0xc2ea('0x5e')]['FL'][_0xc2ea('0x3a')];_0x49c806<_0x159cc6;_0x49c806++){if(_[_0xc2ea('0x60')](_0x28b872,_0xf5d9[_0xc2ea('0x5d')][_0xc2ea('0x5e')]['FL'][_0x49c806]['dv'])){_0x3ecea7[_0xc2ea('0x61')]({'id':_0xf5d9[_0xc2ea('0x5d')][_0xc2ea('0x5e')]['FL'][_0x49c806]['dv'],'name':_0xf5d9[_0xc2ea('0x5d')][_0xc2ea('0x5e')]['FL'][_0x49c806][_0xc2ea('0x62')],'custom':_0xf5d9['Calls']['section']['FL'][_0x49c806][_0xc2ea('0x63')]==='true'?!![]:![],'options':_0xf5d9['Calls'][_0xc2ea('0x5e')]['FL'][_0x49c806][_0xc2ea('0x53')]===_0xc2ea('0x64')&&_0xf5d9['Calls'][_0xc2ea('0x5e')]['FL'][_0x49c806][_0xc2ea('0x65')]?_[_0xc2ea('0x43')](_0xf5d9[_0xc2ea('0x5d')][_0xc2ea('0x5e')]['FL'][_0x49c806][_0xc2ea('0x65')],function(_0x4f4883){return{'name':_0x4f4883,'value':_0x4f4883};}):[]});}}}}return{'count':_0x3ecea7[_0xc2ea('0x3a')],'rows':_0x3ecea7};}})[_0xc2ea('0x14')](respondWithResult(_0x4efa18,null))[_0xc2ea('0x1f')](function(_0x145e01){var _0x3a273d=_0x5b680b[_0xc2ea('0x34')][_0xc2ea('0x66')]?0x1f4:_0x145e01[_0xc2ea('0x67')]||0x1f4;logger['error'](_0xc2ea('0x68'),_0xc2ea('0x69'),_0x3a273d,JSON[_0xc2ea('0x19')](_0x145e01));delete _0x145e01[_0xc2ea('0x2f')];if(_0x3a273d===0x191){_0x3a273d=0x190;}_0x4efa18[_0xc2ea('0x21')](_0x3a273d)[_0xc2ea('0x30')](_0x5b680b[_0xc2ea('0x34')][_0xc2ea('0x66')]?{'message':'Wrong\x20credentials','statusCode':_0x145e01[_0xc2ea('0x67')]}:_0x145e01);});}; \ No newline at end of file +var _0x54d2=['Calls','section','Call\x20Purpose','includes','push','label','customfield','Pick\x20List','val','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','pick','add','day','merge','filter','map','ZohoAccount','includeAll','include','findAll','show','params','options','find','create','body','getConfigurations','findOne','ZohoConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','type','ZohoField','getFields','host','authToken','GET','format','https://crm.%s/crm/private/json/Calls/getFields','crmapi','response'];(function(_0x359873,_0x5ae2fb){var _0x4a1883=function(_0x24d128){while(--_0x24d128){_0x359873['push'](_0x359873['shift']());}};_0x4a1883(++_0x5ae2fb);}(_0x54d2,0x153));var _0x254d=function(_0x404b40,_0x1f1770){_0x404b40=_0x404b40-0x0;var _0x594b6e=_0x54d2[_0x404b40];return _0x594b6e;};'use strict';var jsonpatch=require(_0x254d('0x0'));var rp=require(_0x254d('0x1'));var moment=require(_0x254d('0x2'));var BPromise=require(_0x254d('0x3'));var Mustache=require(_0x254d('0x4'));var util=require(_0x254d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x254d('0x6'));var ejs=require(_0x254d('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x254d('0x8'));var crypto=require(_0x254d('0x9'));var jsforce=require(_0x254d('0xa'));var deskjs=require(_0x254d('0xb'));var toCsv=require(_0x254d('0x6'));var querystring=require('querystring');var Papa=require(_0x254d('0xc'));var qs=require('../../components/parsers/qs');var logger=require(_0x254d('0xd'))(_0x254d('0xe'));var utils=require(_0x254d('0xf'));var config=require(_0x254d('0x10'));var db=require('../../mysqldb')['db'];var integrations=require(_0x254d('0x11'));var jayson=require(_0x254d('0x12'));var client=jayson['client'][_0x254d('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x3480ea,_0x3f3e93,_0x29535a,_0x25131f){return new BPromise(function(_0x548b2e,_0x2ac7f2){var _0x38c377=_0x25131f||client;return _0x38c377[_0x254d('0x14')](_0x3480ea,_0x29535a)[_0x254d('0x15')](function(_0x2ba1a1){logger[_0x254d('0x16')](_0x254d('0x17'),_0x3f3e93,_0x254d('0x18'));logger[_0x254d('0x19')](_0x254d('0x1a'),_0x3f3e93,_0x254d('0x18'),JSON[_0x254d('0x1b')](_0x2ba1a1));if(_0x2ba1a1[_0x254d('0x1c')]){if(_0x2ba1a1[_0x254d('0x1c')][_0x254d('0x1d')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x3f3e93,_0x2ba1a1[_0x254d('0x1c')]['message']);return _0x2ac7f2(_0x2ba1a1[_0x254d('0x1c')][_0x254d('0x1e')]);}logger['error'](_0x254d('0x17'),_0x3f3e93,_0x2ba1a1[_0x254d('0x1c')]['message']);return _0x548b2e(_0x2ba1a1[_0x254d('0x1c')]['message']);}else{logger[_0x254d('0x16')](_0x254d('0x17'),_0x3f3e93,_0x254d('0x18'));_0x548b2e(_0x2ba1a1[_0x254d('0x1f')][_0x254d('0x1e')]);}})[_0x254d('0x20')](function(_0x5549c9){logger['error'](_0x254d('0x17'),_0x3f3e93,_0x5549c9);_0x2ac7f2(_0x5549c9);});});}function respondWithStatusCode(_0x38fa7e,_0x24b4da){_0x24b4da=_0x24b4da||0xcc;return function(_0x3a36ae){if(_0x3a36ae){return _0x38fa7e[_0x254d('0x21')](_0x24b4da);}return _0x38fa7e[_0x254d('0x22')](_0x24b4da)[_0x254d('0x23')]();};}function respondWithResult(_0x3263b8,_0x577f3c){_0x577f3c=_0x577f3c||0xc8;return function(_0x548443){if(_0x548443){return _0x3263b8['status'](_0x577f3c)[_0x254d('0x24')](_0x548443);}};}function respondWithFilteredResult(_0x2e4b16,_0x224807){return function(_0x414990){if(_0x414990){var _0x50ee5b=_0x414990[_0x254d('0x25')],_0x7861e4=_0x224807['offset'],_0x18aa94=_0x224807[_0x254d('0x26')]+_0x224807['limit'],_0x183b34;if(_0x18aa94>=_0x50ee5b){_0x18aa94=_0x50ee5b;_0x183b34=0xc8;}else{_0x183b34=0xce;}_0x2e4b16[_0x254d('0x22')](_0x183b34);return _0x2e4b16[_0x254d('0x27')](_0x254d('0x28'),_0x7861e4+'-'+_0x18aa94+'/'+_0x50ee5b)[_0x254d('0x24')](_0x414990);}return null;};}function patchUpdates(_0x640f05){return function(_0x38357b){try{jsonpatch['apply'](_0x38357b,_0x640f05,!![]);}catch(_0x5baa89){return BPromise[_0x254d('0x29')](_0x5baa89);}return _0x38357b[_0x254d('0x2a')]();};}function saveUpdates(_0x4b4b2a,_0x350927){return function(_0x1c40a1){if(_0x1c40a1){return _0x1c40a1[_0x254d('0x2b')](_0x4b4b2a)[_0x254d('0x15')](function(_0x51e9e0){return _0x51e9e0;});}return null;};}function removeEntity(_0x4e5d58,_0x4b7900){return function(_0x379658){if(_0x379658){return _0x379658[_0x254d('0x2c')]()['then'](function(){_0x4e5d58[_0x254d('0x22')](0xcc)[_0x254d('0x23')]();});}};}function handleEntityNotFound(_0x34d808,_0xaacdd2){return function(_0x166f25){if(!_0x166f25){_0x34d808[_0x254d('0x21')](0x194);}return _0x166f25;};}function handleError(_0x20e609,_0x2b2125){_0x2b2125=_0x2b2125||0x1f4;return function(_0x235d19){logger[_0x254d('0x1c')](_0x235d19[_0x254d('0x2d')]);if(_0x235d19[_0x254d('0x2e')]){delete _0x235d19[_0x254d('0x2e')];}_0x20e609[_0x254d('0x22')](_0x2b2125)[_0x254d('0x2f')](_0x235d19);};}exports[_0x254d('0x30')]=function(_0x12d2da,_0x486184){var _0x5f4f4a={},_0x3ca1f0={},_0x2c70cd={'count':0x0,'rows':[]};var _0x17f64d=db['ZohoAccount'][_0x254d('0x31')];_0x3ca1f0[_0x254d('0x32')]=_[_0x254d('0x33')](_0x17f64d);var _0x16ee07={'dateStart':_0x12d2da[_0x254d('0x34')][_0x254d('0x35')],'dateEnd':_0x12d2da[_0x254d('0x34')][_0x254d('0x36')]};delete _0x12d2da[_0x254d('0x34')][_0x254d('0x35')];delete _0x12d2da['query']['dateEnd'];_0x3ca1f0[_0x254d('0x34')]=_[_0x254d('0x33')](_0x12d2da[_0x254d('0x34')]);_0x3ca1f0[_0x254d('0x37')]=_['intersection'](_0x3ca1f0[_0x254d('0x32')],_0x3ca1f0[_0x254d('0x34')]);_0x5f4f4a[_0x254d('0x38')]=_[_0x254d('0x39')](_0x3ca1f0[_0x254d('0x32')],qs[_0x254d('0x3a')](_0x12d2da[_0x254d('0x34')][_0x254d('0x3a')]));_0x5f4f4a[_0x254d('0x38')]=_0x5f4f4a[_0x254d('0x38')][_0x254d('0x3b')]?_0x5f4f4a[_0x254d('0x38')]:_0x3ca1f0['model'];if(!_0x12d2da[_0x254d('0x34')][_0x254d('0x3c')]('nolimit')){_0x5f4f4a['limit']=qs['limit'](_0x12d2da['query'][_0x254d('0x3d')]);_0x5f4f4a['offset']=qs[_0x254d('0x26')](_0x12d2da[_0x254d('0x34')][_0x254d('0x26')]);}_0x5f4f4a['order']=qs[_0x254d('0x3e')](_0x12d2da[_0x254d('0x34')]['sort']);_0x5f4f4a[_0x254d('0x3f')]=qs[_0x254d('0x37')](_[_0x254d('0x40')](_0x12d2da[_0x254d('0x34')],_0x3ca1f0[_0x254d('0x37')]));if(_0x16ee07[_0x254d('0x35')]){if(_0x16ee07[_0x254d('0x36')]){_0x16ee07['dateEnd']=moment(_0x16ee07[_0x254d('0x36')])[_0x254d('0x41')](0x1,_0x254d('0x42'));}else{_0x16ee07[_0x254d('0x36')]=moment(_0x16ee07[_0x254d('0x35')])['add'](0x1,_0x254d('0x42'));}_[_0x254d('0x43')](_0x5f4f4a[_0x254d('0x3f')],{'createdAt':{'$gte':_0x16ee07[_0x254d('0x35')],'$lte':_0x16ee07[_0x254d('0x36')]}});}if(_0x12d2da['query'][_0x254d('0x44')]){_0x5f4f4a[_0x254d('0x3f')]=_[_0x254d('0x43')](_0x5f4f4a[_0x254d('0x3f')],{'$or':_[_0x254d('0x45')](_0x5f4f4a[_0x254d('0x38')],function(_0x416b7e){var _0x5249d4={};_0x5249d4[_0x416b7e]={'$like':'%'+_0x12d2da[_0x254d('0x34')][_0x254d('0x44')]+'%'};return _0x5249d4;})});}_0x5f4f4a=_[_0x254d('0x43')]({},_0x5f4f4a,_0x12d2da['options']);var _0x449300={'where':_0x5f4f4a[_0x254d('0x3f')]};return db[_0x254d('0x46')][_0x254d('0x25')](_0x449300)[_0x254d('0x15')](function(_0x3188ab){_0x2c70cd[_0x254d('0x25')]=_0x3188ab;if(_0x12d2da[_0x254d('0x34')][_0x254d('0x47')]){_0x5f4f4a[_0x254d('0x48')]=[{'all':!![]}];}return db[_0x254d('0x46')][_0x254d('0x49')](_0x5f4f4a);})['then'](function(_0x3e915c){_0x2c70cd['rows']=_0x3e915c;return _0x2c70cd;})[_0x254d('0x15')](respondWithFilteredResult(_0x486184,_0x5f4f4a))[_0x254d('0x20')](handleError(_0x486184,null));};exports[_0x254d('0x4a')]=function(_0x416e76,_0x32728f){var _0x229b83={'raw':![],'where':{'id':_0x416e76[_0x254d('0x4b')]['id']}},_0x277baa={};_0x277baa[_0x254d('0x32')]=_[_0x254d('0x33')](db[_0x254d('0x46')]['rawAttributes']);_0x277baa['query']=_[_0x254d('0x33')](_0x416e76[_0x254d('0x34')]);_0x277baa[_0x254d('0x37')]=_[_0x254d('0x39')](_0x277baa['model'],_0x277baa[_0x254d('0x34')]);_0x229b83[_0x254d('0x38')]=_[_0x254d('0x39')](_0x277baa[_0x254d('0x32')],qs[_0x254d('0x3a')](_0x416e76[_0x254d('0x34')]['fields']));_0x229b83[_0x254d('0x38')]=_0x229b83[_0x254d('0x38')]['length']?_0x229b83[_0x254d('0x38')]:_0x277baa['model'];if(_0x416e76[_0x254d('0x34')][_0x254d('0x47')]){_0x229b83[_0x254d('0x48')]=[{'all':!![]}];}_0x229b83=_['merge']({},_0x229b83,_0x416e76[_0x254d('0x4c')]);return db[_0x254d('0x46')][_0x254d('0x4d')](_0x229b83)['then'](handleEntityNotFound(_0x32728f,null))['then'](respondWithResult(_0x32728f,null))[_0x254d('0x20')](handleError(_0x32728f,null));};exports['create']=function(_0x1fc026,_0xce384f){return db[_0x254d('0x46')][_0x254d('0x4e')](_0x1fc026[_0x254d('0x4f')],{})['then'](respondWithResult(_0xce384f,0xc9))[_0x254d('0x20')](handleError(_0xce384f,null));};exports[_0x254d('0x2b')]=function(_0x471309,_0x770f00){if(_0x471309[_0x254d('0x4f')]['id']){delete _0x471309[_0x254d('0x4f')]['id'];}return db[_0x254d('0x46')]['find']({'where':{'id':_0x471309[_0x254d('0x4b')]['id']}})[_0x254d('0x15')](handleEntityNotFound(_0x770f00,null))[_0x254d('0x15')](saveUpdates(_0x471309['body'],null))[_0x254d('0x15')](respondWithResult(_0x770f00,null))[_0x254d('0x20')](handleError(_0x770f00,null));};exports[_0x254d('0x2c')]=function(_0x3ce730,_0xbcf561){return db['ZohoAccount']['find']({'where':{'id':_0x3ce730[_0x254d('0x4b')]['id']}})[_0x254d('0x15')](handleEntityNotFound(_0xbcf561,null))[_0x254d('0x15')](removeEntity(_0xbcf561,null))[_0x254d('0x20')](handleError(_0xbcf561,null));};exports[_0x254d('0x50')]=function(_0x4fe3ce,_0x2d41e2,_0x302dc0){var _0x3bc3e7={};var _0x202faa={};var _0x7a6c91;var _0xe30407;return db['ZohoAccount'][_0x254d('0x51')]({'where':{'id':_0x4fe3ce[_0x254d('0x4b')]['id']}})[_0x254d('0x15')](handleEntityNotFound(_0x2d41e2,null))['then'](function(_0x25cfab){if(_0x25cfab){_0x7a6c91=_0x25cfab;_0x202faa[_0x254d('0x32')]=_[_0x254d('0x33')](db[_0x254d('0x52')][_0x254d('0x31')]);_0x202faa[_0x254d('0x34')]=_[_0x254d('0x33')](_0x4fe3ce[_0x254d('0x34')]);_0x202faa[_0x254d('0x37')]=_[_0x254d('0x39')](_0x202faa[_0x254d('0x32')],_0x202faa[_0x254d('0x34')]);_0x3bc3e7[_0x254d('0x38')]=_[_0x254d('0x39')](_0x202faa[_0x254d('0x32')],qs['fields'](_0x4fe3ce[_0x254d('0x34')][_0x254d('0x3a')]));_0x3bc3e7['attributes']=_0x3bc3e7[_0x254d('0x38')][_0x254d('0x3b')]?_0x3bc3e7[_0x254d('0x38')]:_0x202faa[_0x254d('0x32')];_0x3bc3e7['order']=qs[_0x254d('0x3e')](_0x4fe3ce[_0x254d('0x34')][_0x254d('0x3e')]);_0x3bc3e7['where']=qs[_0x254d('0x37')](_[_0x254d('0x40')](_0x4fe3ce['query'],_0x202faa[_0x254d('0x37')]));if(_0x4fe3ce[_0x254d('0x34')][_0x254d('0x44')]){_0x3bc3e7[_0x254d('0x3f')]=_[_0x254d('0x43')](_0x3bc3e7['where'],{'$or':_['map'](_0x3bc3e7[_0x254d('0x38')],function(_0x573515){var _0x418a0c={};_0x418a0c[_0x573515]={'$like':'%'+_0x4fe3ce[_0x254d('0x34')][_0x254d('0x44')]+'%'};return _0x418a0c;})});}_0x3bc3e7=_[_0x254d('0x43')]({},_0x3bc3e7,_0x4fe3ce[_0x254d('0x4c')]);return _0x7a6c91[_0x254d('0x50')](_0x3bc3e7);}})['then'](function(_0x1dc3a9){if(_0x1dc3a9){_0xe30407=_0x1dc3a9[_0x254d('0x3b')];if(!_0x4fe3ce[_0x254d('0x34')][_0x254d('0x3c')]('nolimit')){_0x3bc3e7[_0x254d('0x3d')]=qs[_0x254d('0x3d')](_0x4fe3ce[_0x254d('0x34')][_0x254d('0x3d')]);_0x3bc3e7[_0x254d('0x26')]=qs[_0x254d('0x26')](_0x4fe3ce[_0x254d('0x34')][_0x254d('0x26')]);}return _0x7a6c91['getConfigurations'](_0x3bc3e7);}})[_0x254d('0x15')](function(_0x40db2f){if(_0x40db2f){return _0x40db2f?{'count':_0xe30407,'rows':_0x40db2f}:null;}})[_0x254d('0x15')](respondWithResult(_0x2d41e2,null))['catch'](handleError(_0x2d41e2,null));};exports['addConfiguration']=function(_0x5e177b,_0x55b51b,_0x5cfc7a){if(_0x5e177b[_0x254d('0x4f')]['id']){delete _0x5e177b['body']['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x5e177b[_0x254d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x55b51b,null))[_0x254d('0x15')](function(_0x228682){if(_0x228682){_0x5e177b[_0x254d('0x4f')]['AccountId']=_0x228682['id'];_0x5e177b[_0x254d('0x4f')][_0x254d('0x53')]=integrations[_0x254d('0x54')](_0x5e177b[_0x254d('0x4f')]['channel'],_0x5e177b[_0x254d('0x4f')]['type']);_0x5e177b[_0x254d('0x4f')][_0x254d('0x55')]=integrations[_0x254d('0x56')](_0x5e177b[_0x254d('0x4f')]['channel'],_0x5e177b[_0x254d('0x4f')][_0x254d('0x57')]);return db[_0x254d('0x52')]['create'](_0x5e177b[_0x254d('0x4f')],{'include':[{'model':db[_0x254d('0x58')],'as':_0x254d('0x53')},{'model':db['ZohoField'],'as':_0x254d('0x55')}]});}return null;})[_0x254d('0x15')](respondWithResult(_0x55b51b,null))[_0x254d('0x20')](handleError(_0x55b51b,null));};exports[_0x254d('0x59')]=function(_0x417ee0,_0x30a5d7,_0x40ed89){return db[_0x254d('0x46')]['findOne']({'where':{'id':_0x417ee0[_0x254d('0x4b')]['id']},'attributes':['id',_0x254d('0x5a'),_0x254d('0x5b')]})[_0x254d('0x15')](handleEntityNotFound(_0x30a5d7,null))[_0x254d('0x15')](function(_0x5cb406){if(_0x5cb406){return rp({'method':_0x254d('0x5c'),'uri':util[_0x254d('0x5d')](_0x254d('0x5e'),_0x5cb406[_0x254d('0x5a')]),'qs':{'authtoken':_0x5cb406[_0x254d('0x5b')],'scope':_0x254d('0x5f')},'json':!![]});}})[_0x254d('0x15')](function(_0x31857a){if(_0x31857a){if(_0x31857a[_0x254d('0x60')]&&_0x31857a[_0x254d('0x60')][_0x254d('0x1c')]){throw new Error(_0x31857a['response'][_0x254d('0x1c')][_0x254d('0x1e')]);}var _0x2920d7=[];if(_0x31857a[_0x254d('0x61')]&&_0x31857a[_0x254d('0x61')][_0x254d('0x62')]){if(_0x31857a['Calls']['section']['FL']){var _0x479b27=[_0x254d('0x63')];for(var _0x1278bd=0x0,_0x36f582=_0x31857a[_0x254d('0x61')][_0x254d('0x62')]['FL'][_0x254d('0x3b')];_0x1278bd<_0x36f582;_0x1278bd++){if(_[_0x254d('0x64')](_0x479b27,_0x31857a[_0x254d('0x61')][_0x254d('0x62')]['FL'][_0x1278bd]['dv'])){_0x2920d7[_0x254d('0x65')]({'id':_0x31857a['Calls']['section']['FL'][_0x1278bd]['dv'],'name':_0x31857a[_0x254d('0x61')][_0x254d('0x62')]['FL'][_0x1278bd][_0x254d('0x66')],'custom':_0x31857a[_0x254d('0x61')][_0x254d('0x62')]['FL'][_0x1278bd][_0x254d('0x67')]==='true'?!![]:![],'options':_0x31857a[_0x254d('0x61')][_0x254d('0x62')]['FL'][_0x1278bd][_0x254d('0x57')]===_0x254d('0x68')&&_0x31857a['Calls']['section']['FL'][_0x1278bd][_0x254d('0x69')]?_['map'](_0x31857a[_0x254d('0x61')][_0x254d('0x62')]['FL'][_0x1278bd]['val'],function(_0x243817){return{'name':_0x243817,'value':_0x243817};}):[]});}}}}return{'count':_0x2920d7[_0x254d('0x3b')],'rows':_0x2920d7};}})['then'](respondWithResult(_0x30a5d7,null))[_0x254d('0x20')](function(_0x34226e){var _0x2d2fc0=_0x417ee0[_0x254d('0x34')][_0x254d('0x6a')]?0x1f4:_0x34226e['statusCode']||0x1f4;logger[_0x254d('0x1c')](_0x254d('0x6b'),_0x254d('0x59'),_0x2d2fc0,JSON[_0x254d('0x1b')](_0x34226e));delete _0x34226e['name'];if(_0x2d2fc0===0x191){_0x2d2fc0=0x190;}_0x30a5d7[_0x254d('0x22')](_0x2d2fc0)[_0x254d('0x2f')](_0x417ee0['query']['test']?{'message':_0x254d('0x6c'),'statusCode':_0x34226e['statusCode']}:_0x34226e);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index ceba684..2764532 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 _0xa805=['request-promise','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa805,0x19a));var _0x5a80=function(_0x5924fd,_0x54e06f){_0x5924fd=_0x5924fd-0x0;var _0x4475d0=_0xa805[_0x5924fd];return _0x4475d0;};'use strict';var _=require(_0x5a80('0x0'));var util=require(_0x5a80('0x1'));var logger=require(_0x5a80('0x2'))(_0x5a80('0x3'));var moment=require(_0x5a80('0x4'));var BPromise=require(_0x5a80('0x5'));var rp=require(_0x5a80('0x6'));var attributes=require(_0x5a80('0x7'));var integrations=require(_0x5a80('0x8'));module[_0x5a80('0x9')]=function(_0x415b5c,_0x26132f){return _0x415b5c[_0x5a80('0xa')](_0x5a80('0xb'),attributes,{'tableName':_0x5a80('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0685=['ZohoAccount','int_zoho_accounts','lodash','util','api','moment','bluebird','request-promise','./intZohoAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x14ee59,_0x236373){var _0x46dcd3=function(_0x163663){while(--_0x163663){_0x14ee59['push'](_0x14ee59['shift']());}};_0x46dcd3(++_0x236373);}(_0x0685,0x65));var _0x5068=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0685[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x5068('0x0'));var util=require(_0x5068('0x1'));var logger=require('../../config/logger')(_0x5068('0x2'));var moment=require(_0x5068('0x3'));var BPromise=require(_0x5068('0x4'));var rp=require(_0x5068('0x5'));var attributes=require(_0x5068('0x6'));var integrations=require(_0x5068('0x7'));module[_0x5068('0x8')]=function(_0x2f05df,_0x50f9e7){return _0x2f05df['define'](_0x5068('0x9'),attributes,{'tableName':_0x5068('0xa'),'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 177add6..336521f 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 _0x0592=['GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowZohoAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','ZohoAccount,\x20%s,\x20%s','message','info','result'];(function(_0x408658,_0x46bc4c){var _0x2f8e64=function(_0x361924){while(--_0x361924){_0x408658['push'](_0x408658['shift']());}};_0x2f8e64(++_0x46bc4c);}(_0x0592,0xf3));var _0x2059=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0592[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x2059('0x0'));var util=require(_0x2059('0x1'));var moment=require(_0x2059('0x2'));var BPromise=require(_0x2059('0x3'));var rs=require(_0x2059('0x4'));var fs=require('fs');var db=require(_0x2059('0x5'))['db'];var utils=require(_0x2059('0x6'));var logger=require('../../config/logger')(_0x2059('0x7'));var config=require(_0x2059('0x8'));var jayson=require(_0x2059('0x9'));var client=jayson[_0x2059('0xa')][_0x2059('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xca0d47,_0x5f226e,_0xc6e0){return new BPromise(function(_0x3de42a,_0xcf4993){return client[_0x2059('0xc')](_0xca0d47,_0xc6e0)[_0x2059('0xd')](function(_0xad5ab1){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x5f226e,_0x2059('0xe'));logger[_0x2059('0xf')](_0x2059('0x10'),_0x5f226e,_0x2059('0xe'),JSON['stringify'](_0xad5ab1));if(_0xad5ab1[_0x2059('0x11')]){if(_0xad5ab1[_0x2059('0x11')][_0x2059('0x12')]===0x1f4){logger['error'](_0x2059('0x13'),_0x5f226e,_0xad5ab1[_0x2059('0x11')][_0x2059('0x14')]);return _0xcf4993(_0xad5ab1[_0x2059('0x11')][_0x2059('0x14')]);}logger[_0x2059('0x11')](_0x2059('0x13'),_0x5f226e,_0xad5ab1[_0x2059('0x11')][_0x2059('0x14')]);return _0x3de42a(_0xad5ab1[_0x2059('0x11')][_0x2059('0x14')]);}else{logger[_0x2059('0x15')](_0x2059('0x13'),_0x5f226e,'request\x20sent');_0x3de42a(_0xad5ab1[_0x2059('0x16')][_0x2059('0x14')]);}})['catch'](function(_0x48da00){logger['error'](_0x2059('0x13'),_0x5f226e,_0x48da00);_0xcf4993(_0x48da00);});});}exports[_0x2059('0x17')]=function(_0x4c21ca){var _0x5c9171=this;return new Promise(function(_0x39a618,_0x444860){return db[_0x2059('0x18')][_0x2059('0x19')]({'raw':_0x4c21ca[_0x2059('0x1a')]?_0x4c21ca['options'][_0x2059('0x1b')]===undefined?!![]:![]:!![],'where':_0x4c21ca[_0x2059('0x1a')]?_0x4c21ca[_0x2059('0x1a')][_0x2059('0x1c')]||null:null,'attributes':_0x4c21ca[_0x2059('0x1a')]?_0x4c21ca['options'][_0x2059('0x1d')]||null:null,'limit':_0x4c21ca[_0x2059('0x1a')]?_0x4c21ca[_0x2059('0x1a')][_0x2059('0x1e')]||null:null,'include':_0x4c21ca[_0x2059('0x1a')]?_0x4c21ca['options'][_0x2059('0x1f')]?_[_0x2059('0x20')](_0x4c21ca['options'][_0x2059('0x1f')],function(_0x48bd4d){return{'model':db[_0x48bd4d['model']],'as':_0x48bd4d['as'],'attributes':_0x48bd4d[_0x2059('0x1d')],'include':_0x48bd4d[_0x2059('0x1f')]?_[_0x2059('0x20')](_0x48bd4d[_0x2059('0x1f')],function(_0x165670){return{'model':db[_0x165670['model']],'as':_0x165670['as'],'attributes':_0x165670['attributes'],'include':_0x165670[_0x2059('0x1f')]?_[_0x2059('0x20')](_0x165670[_0x2059('0x1f')],function(_0x1f0e78){return{'model':db[_0x1f0e78[_0x2059('0x21')]],'as':_0x1f0e78['as'],'attributes':_0x1f0e78[_0x2059('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2059('0xd')](function(_0x119286){logger[_0x2059('0x15')](_0x2059('0x17'),_0x4c21ca);logger['debug'](_0x2059('0x17'),_0x4c21ca,JSON[_0x2059('0x22')](_0x119286));_0x39a618(_0x119286);})[_0x2059('0x23')](function(_0x2f0456){logger[_0x2059('0x11')]('GetZohoAccount',_0x2f0456[_0x2059('0x14')],_0x4c21ca);_0x444860(_0x5c9171['error'](0x1f4,_0x2f0456[_0x2059('0x14')]));});});};exports[_0x2059('0x24')]=function(_0xb168d7){var _0x20a88b=this;return new Promise(function(_0x20b9ea,_0x27b211){return db['ZohoAccount'][_0x2059('0x25')]({'raw':_0xb168d7[_0x2059('0x1a')]?_0xb168d7[_0x2059('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xb168d7[_0x2059('0x1a')]?_0xb168d7[_0x2059('0x1a')][_0x2059('0x1c')]||null:null,'attributes':_0xb168d7[_0x2059('0x1a')]?_0xb168d7[_0x2059('0x1a')]['attributes']||null:null,'include':_0xb168d7[_0x2059('0x1a')]?_0xb168d7[_0x2059('0x1a')]['include']?_[_0x2059('0x20')](_0xb168d7['options']['include'],function(_0x39ff56){return{'model':db[_0x39ff56[_0x2059('0x21')]],'as':_0x39ff56['as'],'attributes':_0x39ff56[_0x2059('0x1d')],'include':_0x39ff56[_0x2059('0x1f')]?_['map'](_0x39ff56[_0x2059('0x1f')],function(_0x51f0b6){return{'model':db[_0x51f0b6[_0x2059('0x21')]],'as':_0x51f0b6['as'],'attributes':_0x51f0b6[_0x2059('0x1d')],'include':_0x51f0b6[_0x2059('0x1f')]?_['map'](_0x51f0b6['include'],function(_0x29a2ee){return{'model':db[_0x29a2ee['model']],'as':_0x29a2ee['as'],'attributes':_0x29a2ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x2059('0xd')](function(_0x470b9f){logger[_0x2059('0x15')](_0x2059('0x24'),_0xb168d7);logger[_0x2059('0xf')]('ShowZohoAccount',_0xb168d7,JSON[_0x2059('0x22')](_0x470b9f));_0x20b9ea(_0x470b9f);})[_0x2059('0x23')](function(_0x4e4934){logger[_0x2059('0x11')]('ShowZohoAccount',_0x4e4934['message'],_0xb168d7);_0x27b211(_0x20a88b['error'](0x1f4,_0x4e4934[_0x2059('0x14')]));});});}; \ No newline at end of file +var _0x7b96=['jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes','limit','include','map','model','ShowZohoAccount','find','where','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1a31f9,_0x2619ec){var _0x245448=function(_0x18ba77){while(--_0x18ba77){_0x1a31f9['push'](_0x1a31f9['shift']());}};_0x245448(++_0x2619ec);}(_0x7b96,0x92));var _0x67b9=function(_0x2cf4b9,_0x38a710){_0x2cf4b9=_0x2cf4b9-0x0;var _0x2bc7c8=_0x7b96[_0x2cf4b9];return _0x2bc7c8;};'use strict';var _=require(_0x67b9('0x0'));var util=require(_0x67b9('0x1'));var moment=require(_0x67b9('0x2'));var BPromise=require(_0x67b9('0x3'));var rs=require(_0x67b9('0x4'));var fs=require('fs');var db=require(_0x67b9('0x5'))['db'];var utils=require(_0x67b9('0x6'));var logger=require(_0x67b9('0x7'))(_0x67b9('0x8'));var config=require(_0x67b9('0x9'));var jayson=require(_0x67b9('0xa'));var client=jayson[_0x67b9('0xb')][_0x67b9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x8cce65,_0x1b2e74,_0x5d151e){return new BPromise(function(_0x53f895,_0x52f2c9){return client[_0x67b9('0xd')](_0x8cce65,_0x5d151e)[_0x67b9('0xe')](function(_0xdd3cec){logger[_0x67b9('0xf')](_0x67b9('0x10'),_0x1b2e74,_0x67b9('0x11'));logger[_0x67b9('0x12')](_0x67b9('0x13'),_0x1b2e74,_0x67b9('0x11'),JSON['stringify'](_0xdd3cec));if(_0xdd3cec[_0x67b9('0x14')]){if(_0xdd3cec['error'][_0x67b9('0x15')]===0x1f4){logger[_0x67b9('0x14')]('ZohoAccount,\x20%s,\x20%s',_0x1b2e74,_0xdd3cec[_0x67b9('0x14')][_0x67b9('0x16')]);return _0x52f2c9(_0xdd3cec[_0x67b9('0x14')][_0x67b9('0x16')]);}logger[_0x67b9('0x14')]('ZohoAccount,\x20%s,\x20%s',_0x1b2e74,_0xdd3cec[_0x67b9('0x14')][_0x67b9('0x16')]);return _0x53f895(_0xdd3cec[_0x67b9('0x14')][_0x67b9('0x16')]);}else{logger[_0x67b9('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x1b2e74,'request\x20sent');_0x53f895(_0xdd3cec[_0x67b9('0x17')][_0x67b9('0x16')]);}})[_0x67b9('0x18')](function(_0x482843){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x1b2e74,_0x482843);_0x52f2c9(_0x482843);});});}exports[_0x67b9('0x19')]=function(_0xffb1a6){var _0x119b92=this;return new Promise(function(_0x1884fb,_0x3e2b60){return db[_0x67b9('0x1a')][_0x67b9('0x1b')]({'raw':_0xffb1a6[_0x67b9('0x1c')]?_0xffb1a6[_0x67b9('0x1c')][_0x67b9('0x1d')]===undefined?!![]:![]:!![],'where':_0xffb1a6[_0x67b9('0x1c')]?_0xffb1a6['options']['where']||null:null,'attributes':_0xffb1a6[_0x67b9('0x1c')]?_0xffb1a6[_0x67b9('0x1c')][_0x67b9('0x1e')]||null:null,'limit':_0xffb1a6[_0x67b9('0x1c')]?_0xffb1a6[_0x67b9('0x1c')][_0x67b9('0x1f')]||null:null,'include':_0xffb1a6[_0x67b9('0x1c')]?_0xffb1a6['options'][_0x67b9('0x20')]?_[_0x67b9('0x21')](_0xffb1a6['options'][_0x67b9('0x20')],function(_0x433e77){return{'model':db[_0x433e77[_0x67b9('0x22')]],'as':_0x433e77['as'],'attributes':_0x433e77[_0x67b9('0x1e')],'include':_0x433e77[_0x67b9('0x20')]?_[_0x67b9('0x21')](_0x433e77['include'],function(_0x1675dd){return{'model':db[_0x1675dd[_0x67b9('0x22')]],'as':_0x1675dd['as'],'attributes':_0x1675dd[_0x67b9('0x1e')],'include':_0x1675dd['include']?_[_0x67b9('0x21')](_0x1675dd[_0x67b9('0x20')],function(_0x5bb3bf){return{'model':db[_0x5bb3bf[_0x67b9('0x22')]],'as':_0x5bb3bf['as'],'attributes':_0x5bb3bf[_0x67b9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x67b9('0xe')](function(_0x394254){logger[_0x67b9('0xf')](_0x67b9('0x19'),_0xffb1a6);logger[_0x67b9('0x12')](_0x67b9('0x19'),_0xffb1a6,JSON['stringify'](_0x394254));_0x1884fb(_0x394254);})[_0x67b9('0x18')](function(_0x379ee8){logger[_0x67b9('0x14')]('GetZohoAccount',_0x379ee8[_0x67b9('0x16')],_0xffb1a6);_0x3e2b60(_0x119b92[_0x67b9('0x14')](0x1f4,_0x379ee8[_0x67b9('0x16')]));});});};exports[_0x67b9('0x23')]=function(_0x25c3e8){var _0x19b535=this;return new Promise(function(_0x25c979,_0x3c0b62){return db['ZohoAccount'][_0x67b9('0x24')]({'raw':_0x25c3e8[_0x67b9('0x1c')]?_0x25c3e8['options'][_0x67b9('0x1d')]===undefined?!![]:![]:!![],'where':_0x25c3e8[_0x67b9('0x1c')]?_0x25c3e8[_0x67b9('0x1c')][_0x67b9('0x25')]||null:null,'attributes':_0x25c3e8[_0x67b9('0x1c')]?_0x25c3e8[_0x67b9('0x1c')][_0x67b9('0x1e')]||null:null,'include':_0x25c3e8[_0x67b9('0x1c')]?_0x25c3e8[_0x67b9('0x1c')][_0x67b9('0x20')]?_['map'](_0x25c3e8[_0x67b9('0x1c')][_0x67b9('0x20')],function(_0x2196e7){return{'model':db[_0x2196e7[_0x67b9('0x22')]],'as':_0x2196e7['as'],'attributes':_0x2196e7[_0x67b9('0x1e')],'include':_0x2196e7[_0x67b9('0x20')]?_[_0x67b9('0x21')](_0x2196e7[_0x67b9('0x20')],function(_0x3219a3){return{'model':db[_0x3219a3['model']],'as':_0x3219a3['as'],'attributes':_0x3219a3[_0x67b9('0x1e')],'include':_0x3219a3['include']?_[_0x67b9('0x21')](_0x3219a3[_0x67b9('0x20')],function(_0x1e75cd){return{'model':db[_0x1e75cd[_0x67b9('0x22')]],'as':_0x1e75cd['as'],'attributes':_0x1e75cd[_0x67b9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x67b9('0xe')](function(_0x129354){logger['info']('ShowZohoAccount',_0x25c3e8);logger[_0x67b9('0x12')]('ShowZohoAccount',_0x25c3e8,JSON[_0x67b9('0x26')](_0x129354));_0x25c979(_0x129354);})[_0x67b9('0x18')](function(_0x9cda7d){logger['error'](_0x67b9('0x23'),_0x9cda7d[_0x67b9('0x16')],_0x25c3e8);_0x3c0b62(_0x19b535[_0x67b9('0x14')](0x1f4,_0x9cda7d['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index dcd1538..24eb631 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 _0x53cd=['getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','/:id/subjects'];(function(_0x7600df,_0x31daf2){var _0x1b85d9=function(_0x17866e){while(--_0x17866e){_0x7600df['push'](_0x7600df['shift']());}};_0x1b85d9(++_0x31daf2);}(_0x53cd,0xca));var _0xd53c=function(_0xb2b125,_0x12b79a){_0xb2b125=_0xb2b125-0x0;var _0xa40c87=_0x53cd[_0xb2b125];return _0xa40c87;};'use strict';var multer=require(_0xd53c('0x0'));var util=require(_0xd53c('0x1'));var path=require(_0xd53c('0x2'));var express=require(_0xd53c('0x3'));var router=express[_0xd53c('0x4')]();var auth=require(_0xd53c('0x5'));var interaction=require(_0xd53c('0x6'));var config=require(_0xd53c('0x7'));var controller=require(_0xd53c('0x8'));router[_0xd53c('0x9')]('/',auth[_0xd53c('0xa')](),controller['index']);router[_0xd53c('0x9')](_0xd53c('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xd53c('0x9')](_0xd53c('0xc'),auth[_0xd53c('0xa')](),controller['getFields']);router[_0xd53c('0x9')](_0xd53c('0xd'),auth[_0xd53c('0xa')](),controller[_0xd53c('0xe')]);router[_0xd53c('0x9')](_0xd53c('0xf'),auth[_0xd53c('0xa')](),controller[_0xd53c('0x10')]);router[_0xd53c('0x11')]('/',auth[_0xd53c('0xa')](),controller[_0xd53c('0x12')]);router[_0xd53c('0x13')](_0xd53c('0xb'),auth[_0xd53c('0xa')](),controller[_0xd53c('0x14')]);router[_0xd53c('0x15')]('/:id',auth[_0xd53c('0xa')](),controller[_0xd53c('0x16')]);module[_0xd53c('0x17')]=router; \ No newline at end of file +var _0xdb4f=['Router','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update','destroy','exports','multer','path'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xdb4f,0x1d9));var _0xfdb4=function(_0x51bdda,_0x5666ca){_0x51bdda=_0x51bdda-0x0;var _0x998aab=_0xdb4f[_0x51bdda];return _0x998aab;};'use strict';var multer=require(_0xfdb4('0x0'));var util=require('util');var path=require(_0xfdb4('0x1'));var express=require('express');var router=express[_0xfdb4('0x2')]();var auth=require(_0xfdb4('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xfdb4('0x4'));var controller=require(_0xfdb4('0x5'));router[_0xfdb4('0x6')]('/',auth['isAuthenticated'](),controller[_0xfdb4('0x7')]);router[_0xfdb4('0x6')](_0xfdb4('0x8'),auth[_0xfdb4('0x9')](),controller['show']);router[_0xfdb4('0x6')](_0xfdb4('0xa'),auth[_0xfdb4('0x9')](),controller['getFields']);router[_0xfdb4('0x6')](_0xfdb4('0xb'),auth[_0xfdb4('0x9')](),controller['getSubjects']);router[_0xfdb4('0x6')](_0xfdb4('0xc'),auth[_0xfdb4('0x9')](),controller[_0xfdb4('0xd')]);router[_0xfdb4('0xe')]('/',auth[_0xfdb4('0x9')](),controller[_0xfdb4('0xf')]);router['put'](_0xfdb4('0x8'),auth[_0xfdb4('0x9')](),controller[_0xfdb4('0x10')]);router['delete']('/:id',auth[_0xfdb4('0x9')](),controller[_0xfdb4('0x11')]);module[_0xfdb4('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 6fee0fc..8c22f0b 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 _0x8343=['sequelize','exports','STRING'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x8343,0x78));var _0x3834=function(_0x3e87b3,_0x2347b8){_0x3e87b3=_0x3e87b3-0x0;var _0x1c627a=_0x8343[_0x3e87b3];return _0x1c627a;};'use strict';var Sequelize=require(_0x3834('0x0'));module[_0x3834('0x1')]={'name':{'type':Sequelize[_0x3834('0x2')]},'description':{'type':Sequelize[_0x3834('0x2')]}}; \ No newline at end of file +var _0x7ffc=['exports','STRING'];(function(_0x1d2d4c,_0x340107){var _0x58ed56=function(_0xf95ad){while(--_0xf95ad){_0x1d2d4c['push'](_0x1d2d4c['shift']());}};_0x58ed56(++_0x340107);}(_0x7ffc,0x16c));var _0xc7ff=function(_0x3d4347,_0x47f3d9){_0x3d4347=_0x3d4347-0x0;var _0x14e255=_0x7ffc[_0x3d4347];return _0x14e255;};'use strict';var Sequelize=require('sequelize');module[_0xc7ff('0x0')]={'name':{'type':Sequelize[_0xc7ff('0x1')]},'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 9bef08c..cd74fd4 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(_0x197127,_0x48bbfd){var _0x558ca6=function(_0x580faf){while(--_0x580faf){_0x197127['push'](_0x197127['shift']());}};_0x558ca6(++_0x48bbfd);}(_0xb10b,0x12a));var _0xbb10=function(_0x27332e,_0x247ad6){_0x27332e=_0x27332e-0x0;var _0x5882fc=_0xb10b[_0x27332e];return _0x5882fc;};'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(_0x20fb90,_0x4c9e4e){var _0x25cba1=function(_0x3b2f59){while(--_0x3b2f59){_0x20fb90['push'](_0x20fb90['shift']());}};_0x25cba1(++_0x4c9e4e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 66eeeba..c4a5264 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 _0x7e63=['util','../../config/logger','moment','bluebird','request-promise','exports','ZohoConfiguration','int_zoho_configurations','lodash'];(function(_0xb4e606,_0x2657e9){var _0x36efbe=function(_0x5e757b){while(--_0x5e757b){_0xb4e606['push'](_0xb4e606['shift']());}};_0x36efbe(++_0x2657e9);}(_0x7e63,0x74));var _0x37e6=function(_0x1104bd,_0x359388){_0x1104bd=_0x1104bd-0x0;var _0x5856d2=_0x7e63[_0x1104bd];return _0x5856d2;};'use strict';var _=require(_0x37e6('0x0'));var util=require(_0x37e6('0x1'));var logger=require(_0x37e6('0x2'))('api');var moment=require(_0x37e6('0x3'));var BPromise=require(_0x37e6('0x4'));var rp=require(_0x37e6('0x5'));var attributes=require('./intZohoConfiguration.attributes');module[_0x37e6('0x6')]=function(_0x44c003,_0x4ad1a9){return _0x44c003['define'](_0x37e6('0x7'),attributes,{'tableName':_0x37e6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe22=['util','moment','bluebird','request-promise','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash'];(function(_0x2cde2a,_0x4325c4){var _0x110f55=function(_0x4927f5){while(--_0x4927f5){_0x2cde2a['push'](_0x2cde2a['shift']());}};_0x110f55(++_0x4325c4);}(_0xbe22,0x1c1));var _0x2be2=function(_0x173a4d,_0x533c64){_0x173a4d=_0x173a4d-0x0;var _0x5bcc94=_0xbe22[_0x173a4d];return _0x5bcc94;};'use strict';var _=require(_0x2be2('0x0'));var util=require(_0x2be2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2be2('0x2'));var BPromise=require(_0x2be2('0x3'));var rp=require(_0x2be2('0x4'));var attributes=require(_0x2be2('0x5'));module[_0x2be2('0x6')]=function(_0x250c97,_0x3693e2){return _0x250c97[_0x2be2('0x7')](_0x2be2('0x8'),attributes,{'tableName':_0x2be2('0x9'),'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 1c74a7a..9b26f49 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 _0xadb5=['client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x230bf0,_0x2f9370){var _0x3d5812=function(_0x5ac196){while(--_0x5ac196){_0x230bf0['push'](_0x230bf0['shift']());}};_0x3d5812(++_0x2f9370);}(_0xadb5,0xad));var _0x5adb=function(_0x200427,_0x4aa670){_0x200427=_0x200427-0x0;var _0x4032cd=_0xadb5[_0x200427];return _0x4032cd;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var db=require(_0x5adb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5adb('0x4'))(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5adb('0x7')][_0x5adb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e2555,_0x3213e8,_0xdf3776){return new BPromise(function(_0x353885,_0x47228a){return client[_0x5adb('0x9')](_0x3e2555,_0xdf3776)[_0x5adb('0xa')](function(_0x7293ab){logger[_0x5adb('0xb')](_0x5adb('0xc'),_0x3213e8,_0x5adb('0xd'));logger[_0x5adb('0xe')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x3213e8,'request\x20sent',JSON[_0x5adb('0xf')](_0x7293ab));if(_0x7293ab[_0x5adb('0x10')]){if(_0x7293ab[_0x5adb('0x10')]['code']===0x1f4){logger[_0x5adb('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x3213e8,_0x7293ab[_0x5adb('0x10')]['message']);return _0x47228a(_0x7293ab[_0x5adb('0x10')][_0x5adb('0x11')]);}logger[_0x5adb('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x3213e8,_0x7293ab[_0x5adb('0x10')][_0x5adb('0x11')]);return _0x353885(_0x7293ab[_0x5adb('0x10')]['message']);}else{logger[_0x5adb('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x3213e8,_0x5adb('0xd'));_0x353885(_0x7293ab[_0x5adb('0x12')][_0x5adb('0x11')]);}})[_0x5adb('0x13')](function(_0x1c0f97){logger[_0x5adb('0x10')](_0x5adb('0xc'),_0x3213e8,_0x1c0f97);_0x47228a(_0x1c0f97);});});} \ No newline at end of file +var _0x757a=['result','catch','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x14de91,_0x18abe0){var _0x46fee0=function(_0x535e04){while(--_0x535e04){_0x14de91['push'](_0x14de91['shift']());}};_0x46fee0(++_0x18abe0);}(_0x757a,0xde));var _0xa757=function(_0x254c5a,_0x1aa5cb){_0x254c5a=_0x254c5a-0x0;var _0x19be7e=_0x757a[_0x254c5a];return _0x19be7e;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xa757('0x2'));var logger=require(_0xa757('0x3'))(_0xa757('0x4'));var config=require(_0xa757('0x5'));var jayson=require(_0xa757('0x6'));var client=jayson[_0xa757('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xae0e7c,_0x4343b6,_0x53be0e){return new BPromise(function(_0x2930fa,_0x2f7793){return client[_0xa757('0x8')](_0xae0e7c,_0x53be0e)[_0xa757('0x9')](function(_0x3a3db6){logger['info'](_0xa757('0xa'),_0x4343b6,_0xa757('0xb'));logger[_0xa757('0xc')](_0xa757('0xd'),_0x4343b6,_0xa757('0xb'),JSON[_0xa757('0xe')](_0x3a3db6));if(_0x3a3db6[_0xa757('0xf')]){if(_0x3a3db6['error']['code']===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x4343b6,_0x3a3db6['error'][_0xa757('0x10')]);return _0x2f7793(_0x3a3db6['error']['message']);}logger[_0xa757('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x4343b6,_0x3a3db6['error'][_0xa757('0x10')]);return _0x2930fa(_0x3a3db6[_0xa757('0xf')][_0xa757('0x10')]);}else{logger[_0xa757('0x11')](_0xa757('0xa'),_0x4343b6,_0xa757('0xb'));_0x2930fa(_0x3a3db6[_0xa757('0x12')][_0xa757('0x10')]);}})[_0xa757('0x13')](function(_0x3df1f9){logger['error'](_0xa757('0xa'),_0x4343b6,_0x3df1f9);_0x2f7793(_0x3df1f9);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 4a25247..169acc7 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 _0xf940=['put','update','delete','destroy','exports','multer','util','path','express','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x19fbc5,_0x267255){var _0x3836f2=function(_0x55f16b){while(--_0x55f16b){_0x19fbc5['push'](_0x19fbc5['shift']());}};_0x3836f2(++_0x267255);}(_0xf940,0x95));var _0x0f94=function(_0x57d074,_0x444670){_0x57d074=_0x57d074-0x0;var _0x1aa706=_0xf940[_0x57d074];return _0x1aa706;};'use strict';var multer=require(_0x0f94('0x0'));var util=require(_0x0f94('0x1'));var path=require(_0x0f94('0x2'));var express=require(_0x0f94('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZohoField.controller');router[_0x0f94('0x4')]('/',auth['isAuthenticated'](),controller[_0x0f94('0x5')]);router['get'](_0x0f94('0x6'),auth[_0x0f94('0x7')](),controller[_0x0f94('0x8')]);router[_0x0f94('0x9')]('/',auth[_0x0f94('0x7')](),controller[_0x0f94('0xa')]);router[_0x0f94('0xb')](_0x0f94('0x6'),auth[_0x0f94('0x7')](),controller[_0x0f94('0xc')]);router[_0x0f94('0xd')](_0x0f94('0x6'),auth[_0x0f94('0x7')](),controller[_0x0f94('0xe')]);module[_0x0f94('0xf')]=router; \ No newline at end of file +var _0x1bbe=['put','/:id','update','delete','exports','multer','util','path','express','Router','../../config/environment','./intZohoField.controller','get','isAuthenticated','index'];(function(_0x314392,_0x272da7){var _0x1589f7=function(_0x2bc9e9){while(--_0x2bc9e9){_0x314392['push'](_0x314392['shift']());}};_0x1589f7(++_0x272da7);}(_0x1bbe,0x8c));var _0xe1bb=function(_0x36f257,_0x47793b){_0x36f257=_0x36f257-0x0;var _0x381cc6=_0x1bbe[_0x36f257];return _0x381cc6;};'use strict';var multer=require(_0xe1bb('0x0'));var util=require(_0xe1bb('0x1'));var path=require(_0xe1bb('0x2'));var express=require(_0xe1bb('0x3'));var router=express[_0xe1bb('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe1bb('0x5'));var controller=require(_0xe1bb('0x6'));router[_0xe1bb('0x7')]('/',auth[_0xe1bb('0x8')](),controller[_0xe1bb('0x9')]);router[_0xe1bb('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe1bb('0xa')](_0xe1bb('0xb'),auth[_0xe1bb('0x8')](),controller[_0xe1bb('0xc')]);router[_0xe1bb('0xd')](_0xe1bb('0xb'),auth[_0xe1bb('0x8')](),controller['destroy']);module[_0xe1bb('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 6b53b69..33b6d35 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 _0xec56=['customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize','string','variable'];(function(_0x128715,_0xbad57e){var _0x5be107=function(_0xd2f07c){while(--_0xd2f07c){_0x128715['push'](_0x128715['shift']());}};_0x5be107(++_0xbad57e);}(_0xec56,0x1bd));var _0x6ec5=function(_0x5a7014,_0xa1c884){_0x5a7014=_0x5a7014-0x0;var _0x169050=_0xec56[_0x5a7014];return _0x169050;};'use strict';var Sequelize=require(_0x6ec5('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x6ec5('0x1'),_0x6ec5('0x2'),_0x6ec5('0x3'),_0x6ec5('0x4')),'defaultValue':_0x6ec5('0x1')},'content':{'type':Sequelize[_0x6ec5('0x5')]},'key':{'type':Sequelize[_0x6ec5('0x5')]},'keyType':{'type':Sequelize[_0x6ec5('0x6')](_0x6ec5('0x1'),_0x6ec5('0x2'),_0x6ec5('0x3'))},'keyContent':{'type':Sequelize[_0x6ec5('0x5')]},'idField':{'type':Sequelize[_0x6ec5('0x5')]},'nameField':{'type':Sequelize[_0x6ec5('0x5')]},'customField':{'type':Sequelize[_0x6ec5('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6ec5('0x5')]}}; \ No newline at end of file +var _0x9c00=['sequelize','exports','variable','customVariable','string','STRING','ENUM','BOOLEAN'];(function(_0x10daa5,_0x118294){var _0x3f087a=function(_0x327d36){while(--_0x327d36){_0x10daa5['push'](_0x10daa5['shift']());}};_0x3f087a(++_0x118294);}(_0x9c00,0x1a0));var _0x09c0=function(_0xa5bd84,_0x287943){_0xa5bd84=_0xa5bd84-0x0;var _0x22bcca=_0x9c00[_0xa5bd84];return _0x22bcca;};'use strict';var Sequelize=require(_0x09c0('0x0'));module[_0x09c0('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x09c0('0x2'),_0x09c0('0x3'),'keyValue'),'defaultValue':_0x09c0('0x4')},'content':{'type':Sequelize[_0x09c0('0x5')]},'key':{'type':Sequelize[_0x09c0('0x5')]},'keyType':{'type':Sequelize[_0x09c0('0x6')](_0x09c0('0x4'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x09c0('0x5')]},'idField':{'type':Sequelize[_0x09c0('0x5')]},'nameField':{'type':Sequelize[_0x09c0('0x5')]},'customField':{'type':Sequelize[_0x09c0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x09c0('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 6ff4856..dfeb6a9 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 _0x942a=['model','dateStart','query','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','ZohoField','rawAttributes'];(function(_0x5857a7,_0x3f8601){var _0x2c35e4=function(_0x1e3492){while(--_0x1e3492){_0x5857a7['push'](_0x5857a7['shift']());}};_0x2c35e4(++_0x3f8601);}(_0x942a,0xa3));var _0xa942=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x942a[_0x373dee];return _0x46798f;};'use strict';var jsonpatch=require(_0xa942('0x0'));var rp=require(_0xa942('0x1'));var moment=require('moment');var BPromise=require(_0xa942('0x2'));var Mustache=require('mustache');var util=require(_0xa942('0x3'));var path=require(_0xa942('0x4'));var sox=require('sox');var csv=require(_0xa942('0x5'));var ejs=require(_0xa942('0x6'));var fs=require('fs');var _=require(_0xa942('0x7'));var squel=require(_0xa942('0x8'));var crypto=require(_0xa942('0x9'));var jsforce=require(_0xa942('0xa'));var deskjs=require(_0xa942('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0xa942('0xc'));var logger=require('../../config/logger')(_0xa942('0xd'));var utils=require('../../config/utils');var config=require(_0xa942('0xe'));var db=require(_0xa942('0xf'))['db'];function respondWithStatusCode(_0x59b047,_0x322186){_0x322186=_0x322186||0xcc;return function(_0x380dde){if(_0x380dde){return _0x59b047[_0xa942('0x10')](_0x322186);}return _0x59b047[_0xa942('0x11')](_0x322186)['end']();};}function respondWithResult(_0x4d1715,_0xf90d00){_0xf90d00=_0xf90d00||0xc8;return function(_0xdc74ba){if(_0xdc74ba){return _0x4d1715['status'](_0xf90d00)[_0xa942('0x12')](_0xdc74ba);}};}function respondWithFilteredResult(_0x1a6145,_0x7f085){return function(_0x28651f){if(_0x28651f){var _0x5c2fa2=_0x28651f[_0xa942('0x13')],_0x59f2af=_0x7f085[_0xa942('0x14')],_0x3e3f03=_0x7f085[_0xa942('0x14')]+_0x7f085[_0xa942('0x15')],_0x4d7536;if(_0x3e3f03>=_0x5c2fa2){_0x3e3f03=_0x5c2fa2;_0x4d7536=0xc8;}else{_0x4d7536=0xce;}_0x1a6145[_0xa942('0x11')](_0x4d7536);return _0x1a6145['set'](_0xa942('0x16'),_0x59f2af+'-'+_0x3e3f03+'/'+_0x5c2fa2)[_0xa942('0x12')](_0x28651f);}return null;};}function patchUpdates(_0x1137f1){return function(_0x5547cf){try{jsonpatch[_0xa942('0x17')](_0x5547cf,_0x1137f1,!![]);}catch(_0x1a7929){return BPromise[_0xa942('0x18')](_0x1a7929);}return _0x5547cf[_0xa942('0x19')]();};}function saveUpdates(_0x2791fe,_0x2fe12c){return function(_0x3e15e8){if(_0x3e15e8){return _0x3e15e8[_0xa942('0x1a')](_0x2791fe)[_0xa942('0x1b')](function(_0x5b9a4d){return _0x5b9a4d;});}return null;};}function removeEntity(_0x138701,_0xf2a52c){return function(_0x4ada09){if(_0x4ada09){return _0x4ada09[_0xa942('0x1c')]()[_0xa942('0x1b')](function(){_0x138701[_0xa942('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d458c,_0x117d2f){return function(_0x5af3c4){if(!_0x5af3c4){_0x1d458c[_0xa942('0x10')](0x194);}return _0x5af3c4;};}function handleError(_0x546c19,_0x1df937){_0x1df937=_0x1df937||0x1f4;return function(_0x45a071){logger[_0xa942('0x1d')](_0x45a071[_0xa942('0x1e')]);if(_0x45a071[_0xa942('0x1f')]){delete _0x45a071[_0xa942('0x1f')];}_0x546c19[_0xa942('0x11')](_0x1df937)[_0xa942('0x20')](_0x45a071);};}exports['index']=function(_0x258bc1,_0xee1aa4){var _0x1e92e1={},_0x2ff5b7={},_0x58373d={'count':0x0,'rows':[]};var _0x13910c=db[_0xa942('0x21')][_0xa942('0x22')];_0x2ff5b7[_0xa942('0x23')]=_['keys'](_0x13910c);var _0x554dbd={'dateStart':_0x258bc1['query'][_0xa942('0x24')],'dateEnd':_0x258bc1[_0xa942('0x25')][_0xa942('0x26')]};delete _0x258bc1[_0xa942('0x25')]['dateStart'];delete _0x258bc1[_0xa942('0x25')][_0xa942('0x26')];_0x2ff5b7[_0xa942('0x25')]=_[_0xa942('0x27')](_0x258bc1[_0xa942('0x25')]);_0x2ff5b7[_0xa942('0x28')]=_[_0xa942('0x29')](_0x2ff5b7[_0xa942('0x23')],_0x2ff5b7[_0xa942('0x25')]);_0x1e92e1[_0xa942('0x2a')]=_['intersection'](_0x2ff5b7[_0xa942('0x23')],qs['fields'](_0x258bc1['query'][_0xa942('0x2b')]));_0x1e92e1['attributes']=_0x1e92e1[_0xa942('0x2a')][_0xa942('0x2c')]?_0x1e92e1['attributes']:_0x2ff5b7[_0xa942('0x23')];if(!_0x258bc1[_0xa942('0x25')][_0xa942('0x2d')](_0xa942('0x2e'))){_0x1e92e1['limit']=qs[_0xa942('0x15')](_0x258bc1[_0xa942('0x25')][_0xa942('0x15')]);_0x1e92e1[_0xa942('0x14')]=qs[_0xa942('0x14')](_0x258bc1['query'][_0xa942('0x14')]);}_0x1e92e1[_0xa942('0x2f')]=qs[_0xa942('0x30')](_0x258bc1[_0xa942('0x25')][_0xa942('0x30')]);_0x1e92e1[_0xa942('0x31')]=qs[_0xa942('0x28')](_[_0xa942('0x32')](_0x258bc1['query'],_0x2ff5b7['filters']));if(_0x554dbd['dateStart']){if(_0x554dbd[_0xa942('0x26')]){_0x554dbd[_0xa942('0x26')]=moment(_0x554dbd[_0xa942('0x26')])[_0xa942('0x33')](0x1,_0xa942('0x34'));}else{_0x554dbd['dateEnd']=moment(_0x554dbd[_0xa942('0x24')])[_0xa942('0x33')](0x1,_0xa942('0x34'));}_[_0xa942('0x35')](_0x1e92e1['where'],{'createdAt':{'$gte':_0x554dbd[_0xa942('0x24')],'$lte':_0x554dbd[_0xa942('0x26')]}});}if(_0x258bc1[_0xa942('0x25')]['filter']){_0x1e92e1['where']=_[_0xa942('0x35')](_0x1e92e1['where'],{'$or':_['map'](_0x1e92e1[_0xa942('0x2a')],function(_0x82db4d){var _0x4235ec={};_0x4235ec[_0x82db4d]={'$like':'%'+_0x258bc1[_0xa942('0x25')][_0xa942('0x36')]+'%'};return _0x4235ec;})});}_0x1e92e1=_[_0xa942('0x35')]({},_0x1e92e1,_0x258bc1[_0xa942('0x37')]);var _0x131e1f={'where':_0x1e92e1[_0xa942('0x31')]};return db['ZohoField']['count'](_0x131e1f)['then'](function(_0x506244){_0x58373d[_0xa942('0x13')]=_0x506244;if(_0x258bc1[_0xa942('0x25')][_0xa942('0x38')]){_0x1e92e1[_0xa942('0x39')]=[{'all':!![]}];}return db[_0xa942('0x21')][_0xa942('0x3a')](_0x1e92e1);})[_0xa942('0x1b')](function(_0x1c5701){_0x58373d[_0xa942('0x3b')]=_0x1c5701;return _0x58373d;})['then'](respondWithFilteredResult(_0xee1aa4,_0x1e92e1))['catch'](handleError(_0xee1aa4,null));};exports[_0xa942('0x3c')]=function(_0x5d61dc,_0x27bb4a){var _0x5ec056={'raw':!![],'where':{'id':_0x5d61dc[_0xa942('0x3d')]['id']}},_0x2a41ff={};_0x2a41ff[_0xa942('0x23')]=_['keys'](db['ZohoField'][_0xa942('0x22')]);_0x2a41ff[_0xa942('0x25')]=_[_0xa942('0x27')](_0x5d61dc['query']);_0x2a41ff[_0xa942('0x28')]=_[_0xa942('0x29')](_0x2a41ff['model'],_0x2a41ff[_0xa942('0x25')]);_0x5ec056[_0xa942('0x2a')]=_[_0xa942('0x29')](_0x2a41ff['model'],qs[_0xa942('0x2b')](_0x5d61dc['query'][_0xa942('0x2b')]));_0x5ec056[_0xa942('0x2a')]=_0x5ec056[_0xa942('0x2a')][_0xa942('0x2c')]?_0x5ec056[_0xa942('0x2a')]:_0x2a41ff[_0xa942('0x23')];if(_0x5d61dc[_0xa942('0x25')][_0xa942('0x38')]){_0x5ec056[_0xa942('0x39')]=[{'all':!![]}];}_0x5ec056=_[_0xa942('0x35')]({},_0x5ec056,_0x5d61dc['options']);return db[_0xa942('0x21')][_0xa942('0x3e')](_0x5ec056)[_0xa942('0x1b')](handleEntityNotFound(_0x27bb4a,null))['then'](respondWithResult(_0x27bb4a,null))[_0xa942('0x3f')](handleError(_0x27bb4a,null));};exports[_0xa942('0x40')]=function(_0x5541ac,_0x17fb2a){return db['ZohoField'][_0xa942('0x40')](_0x5541ac[_0xa942('0x41')],{})[_0xa942('0x1b')](respondWithResult(_0x17fb2a,0xc9))[_0xa942('0x3f')](handleError(_0x17fb2a,null));};exports['update']=function(_0xe04ad4,_0x4d338b){if(_0xe04ad4[_0xa942('0x41')]['id']){delete _0xe04ad4[_0xa942('0x41')]['id'];}return db[_0xa942('0x21')][_0xa942('0x3e')]({'where':{'id':_0xe04ad4[_0xa942('0x3d')]['id']}})[_0xa942('0x1b')](handleEntityNotFound(_0x4d338b,null))[_0xa942('0x1b')](saveUpdates(_0xe04ad4['body'],null))['then'](respondWithResult(_0x4d338b,null))['catch'](handleError(_0x4d338b,null));};exports['destroy']=function(_0x470720,_0x5defcb){return db[_0xa942('0x21')][_0xa942('0x3e')]({'where':{'id':_0x470720[_0xa942('0x3d')]['id']}})[_0xa942('0x1b')](handleEntityNotFound(_0x5defcb,null))[_0xa942('0x1b')](removeEntity(_0x5defcb,null))['catch'](handleError(_0x5defcb,null));}; \ No newline at end of file +var _0x045a=['where','pick','add','day','merge','filter','map','findAll','rows','catch','show','length','includeAll','include','ZohoField','find','create','body','params','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/logger','api','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','name','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','hasOwnProperty','order','sort'];(function(_0x3b3952,_0x1b2d81){var _0x3adccd=function(_0x4b4b6b){while(--_0x4b4b6b){_0x3b3952['push'](_0x3b3952['shift']());}};_0x3adccd(++_0x1b2d81);}(_0x045a,0xd6));var _0xa045=function(_0x5b8028,_0x3c8c9b){_0x5b8028=_0x5b8028-0x0;var _0x4b53ff=_0x045a[_0x5b8028];return _0x4b53ff;};'use strict';var jsonpatch=require(_0xa045('0x0'));var rp=require('request-promise');var moment=require(_0xa045('0x1'));var BPromise=require(_0xa045('0x2'));var Mustache=require('mustache');var util=require(_0xa045('0x3'));var path=require(_0xa045('0x4'));var sox=require(_0xa045('0x5'));var csv=require('to-csv');var ejs=require(_0xa045('0x6'));var fs=require('fs');var _=require(_0xa045('0x7'));var squel=require(_0xa045('0x8'));var crypto=require('crypto');var jsforce=require(_0xa045('0x9'));var deskjs=require(_0xa045('0xa'));var toCsv=require(_0xa045('0xb'));var querystring=require('querystring');var Papa=require(_0xa045('0xc'));var qs=require(_0xa045('0xd'));var logger=require(_0xa045('0xe'))(_0xa045('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x143fe3,_0x2548d8){_0x2548d8=_0x2548d8||0xcc;return function(_0x5aaa8f){if(_0x5aaa8f){return _0x143fe3[_0xa045('0x10')](_0x2548d8);}return _0x143fe3['status'](_0x2548d8)[_0xa045('0x11')]();};}function respondWithResult(_0x1808ba,_0x10fca2){_0x10fca2=_0x10fca2||0xc8;return function(_0x1c5613){if(_0x1c5613){return _0x1808ba[_0xa045('0x12')](_0x10fca2)[_0xa045('0x13')](_0x1c5613);}};}function respondWithFilteredResult(_0x298a98,_0x15ac34){return function(_0xa83688){if(_0xa83688){var _0xf78f94=_0xa83688[_0xa045('0x14')],_0x2cfc85=_0x15ac34[_0xa045('0x15')],_0x2495a4=_0x15ac34['offset']+_0x15ac34[_0xa045('0x16')],_0xe852b2;if(_0x2495a4>=_0xf78f94){_0x2495a4=_0xf78f94;_0xe852b2=0xc8;}else{_0xe852b2=0xce;}_0x298a98[_0xa045('0x12')](_0xe852b2);return _0x298a98[_0xa045('0x17')](_0xa045('0x18'),_0x2cfc85+'-'+_0x2495a4+'/'+_0xf78f94)['json'](_0xa83688);}return null;};}function patchUpdates(_0x25cc01){return function(_0x6bbb9d){try{jsonpatch[_0xa045('0x19')](_0x6bbb9d,_0x25cc01,!![]);}catch(_0x223dbd){return BPromise['reject'](_0x223dbd);}return _0x6bbb9d[_0xa045('0x1a')]();};}function saveUpdates(_0x135beb,_0x43776d){return function(_0x408ab5){if(_0x408ab5){return _0x408ab5[_0xa045('0x1b')](_0x135beb)[_0xa045('0x1c')](function(_0x1e42a7){return _0x1e42a7;});}return null;};}function removeEntity(_0x185670,_0x57ffdd){return function(_0x4459d3){if(_0x4459d3){return _0x4459d3[_0xa045('0x1d')]()['then'](function(){_0x185670[_0xa045('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x459045,_0x25e929){return function(_0x1d4e81){if(!_0x1d4e81){_0x459045['sendStatus'](0x194);}return _0x1d4e81;};}function handleError(_0x362afd,_0x3716a8){_0x3716a8=_0x3716a8||0x1f4;return function(_0x527158){logger[_0xa045('0x1e')](_0x527158['stack']);if(_0x527158[_0xa045('0x1f')]){delete _0x527158[_0xa045('0x1f')];}_0x362afd[_0xa045('0x12')](_0x3716a8)['send'](_0x527158);};}exports[_0xa045('0x20')]=function(_0x6afd5d,_0x27914d){var _0xd19dbc={},_0x385121={},_0x539105={'count':0x0,'rows':[]};var _0x2ff07f=db['ZohoField'][_0xa045('0x21')];_0x385121[_0xa045('0x22')]=_[_0xa045('0x23')](_0x2ff07f);var _0x31197a={'dateStart':_0x6afd5d[_0xa045('0x24')][_0xa045('0x25')],'dateEnd':_0x6afd5d[_0xa045('0x24')][_0xa045('0x26')]};delete _0x6afd5d[_0xa045('0x24')][_0xa045('0x25')];delete _0x6afd5d[_0xa045('0x24')][_0xa045('0x26')];_0x385121[_0xa045('0x24')]=_[_0xa045('0x23')](_0x6afd5d[_0xa045('0x24')]);_0x385121[_0xa045('0x27')]=_['intersection'](_0x385121[_0xa045('0x22')],_0x385121[_0xa045('0x24')]);_0xd19dbc['attributes']=_[_0xa045('0x28')](_0x385121['model'],qs[_0xa045('0x29')](_0x6afd5d[_0xa045('0x24')]['fields']));_0xd19dbc[_0xa045('0x2a')]=_0xd19dbc[_0xa045('0x2a')]['length']?_0xd19dbc[_0xa045('0x2a')]:_0x385121['model'];if(!_0x6afd5d['query'][_0xa045('0x2b')]('nolimit')){_0xd19dbc[_0xa045('0x16')]=qs[_0xa045('0x16')](_0x6afd5d[_0xa045('0x24')][_0xa045('0x16')]);_0xd19dbc[_0xa045('0x15')]=qs[_0xa045('0x15')](_0x6afd5d[_0xa045('0x24')][_0xa045('0x15')]);}_0xd19dbc[_0xa045('0x2c')]=qs['sort'](_0x6afd5d[_0xa045('0x24')][_0xa045('0x2d')]);_0xd19dbc[_0xa045('0x2e')]=qs[_0xa045('0x27')](_[_0xa045('0x2f')](_0x6afd5d[_0xa045('0x24')],_0x385121['filters']));if(_0x31197a[_0xa045('0x25')]){if(_0x31197a[_0xa045('0x26')]){_0x31197a[_0xa045('0x26')]=moment(_0x31197a[_0xa045('0x26')])[_0xa045('0x30')](0x1,_0xa045('0x31'));}else{_0x31197a[_0xa045('0x26')]=moment(_0x31197a['dateStart'])[_0xa045('0x30')](0x1,'day');}_[_0xa045('0x32')](_0xd19dbc[_0xa045('0x2e')],{'createdAt':{'$gte':_0x31197a[_0xa045('0x25')],'$lte':_0x31197a[_0xa045('0x26')]}});}if(_0x6afd5d[_0xa045('0x24')][_0xa045('0x33')]){_0xd19dbc[_0xa045('0x2e')]=_[_0xa045('0x32')](_0xd19dbc[_0xa045('0x2e')],{'$or':_[_0xa045('0x34')](_0xd19dbc['attributes'],function(_0x37550b){var _0x1a145e={};_0x1a145e[_0x37550b]={'$like':'%'+_0x6afd5d[_0xa045('0x24')][_0xa045('0x33')]+'%'};return _0x1a145e;})});}_0xd19dbc=_[_0xa045('0x32')]({},_0xd19dbc,_0x6afd5d['options']);var _0x3c1e56={'where':_0xd19dbc[_0xa045('0x2e')]};return db['ZohoField'][_0xa045('0x14')](_0x3c1e56)[_0xa045('0x1c')](function(_0x190c2b){_0x539105['count']=_0x190c2b;if(_0x6afd5d[_0xa045('0x24')]['includeAll']){_0xd19dbc['include']=[{'all':!![]}];}return db['ZohoField'][_0xa045('0x35')](_0xd19dbc);})[_0xa045('0x1c')](function(_0x34cf32){_0x539105[_0xa045('0x36')]=_0x34cf32;return _0x539105;})['then'](respondWithFilteredResult(_0x27914d,_0xd19dbc))[_0xa045('0x37')](handleError(_0x27914d,null));};exports[_0xa045('0x38')]=function(_0x2fa31f,_0x3b181f){var _0x4beb23={'raw':!![],'where':{'id':_0x2fa31f['params']['id']}},_0x175cff={};_0x175cff[_0xa045('0x22')]=_[_0xa045('0x23')](db['ZohoField']['rawAttributes']);_0x175cff[_0xa045('0x24')]=_[_0xa045('0x23')](_0x2fa31f[_0xa045('0x24')]);_0x175cff[_0xa045('0x27')]=_[_0xa045('0x28')](_0x175cff[_0xa045('0x22')],_0x175cff[_0xa045('0x24')]);_0x4beb23[_0xa045('0x2a')]=_[_0xa045('0x28')](_0x175cff[_0xa045('0x22')],qs[_0xa045('0x29')](_0x2fa31f[_0xa045('0x24')]['fields']));_0x4beb23['attributes']=_0x4beb23[_0xa045('0x2a')][_0xa045('0x39')]?_0x4beb23[_0xa045('0x2a')]:_0x175cff['model'];if(_0x2fa31f[_0xa045('0x24')][_0xa045('0x3a')]){_0x4beb23[_0xa045('0x3b')]=[{'all':!![]}];}_0x4beb23=_['merge']({},_0x4beb23,_0x2fa31f['options']);return db[_0xa045('0x3c')][_0xa045('0x3d')](_0x4beb23)['then'](handleEntityNotFound(_0x3b181f,null))['then'](respondWithResult(_0x3b181f,null))[_0xa045('0x37')](handleError(_0x3b181f,null));};exports[_0xa045('0x3e')]=function(_0x26ebcd,_0x4c914b){return db[_0xa045('0x3c')][_0xa045('0x3e')](_0x26ebcd['body'],{})[_0xa045('0x1c')](respondWithResult(_0x4c914b,0xc9))['catch'](handleError(_0x4c914b,null));};exports[_0xa045('0x1b')]=function(_0x17837e,_0x410a3e){if(_0x17837e['body']['id']){delete _0x17837e[_0xa045('0x3f')]['id'];}return db[_0xa045('0x3c')][_0xa045('0x3d')]({'where':{'id':_0x17837e[_0xa045('0x40')]['id']}})[_0xa045('0x1c')](handleEntityNotFound(_0x410a3e,null))[_0xa045('0x1c')](saveUpdates(_0x17837e[_0xa045('0x3f')],null))[_0xa045('0x1c')](respondWithResult(_0x410a3e,null))[_0xa045('0x37')](handleError(_0x410a3e,null));};exports[_0xa045('0x1d')]=function(_0x110fd7,_0x2f1829){return db[_0xa045('0x3c')]['find']({'where':{'id':_0x110fd7[_0xa045('0x40')]['id']}})[_0xa045('0x1c')](handleEntityNotFound(_0x2f1829,null))[_0xa045('0x1c')](removeEntity(_0x2f1829,null))[_0xa045('0x37')](handleError(_0x2f1829,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 5a5734a..8c4bfa1 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 _0x2f20=['request-promise','exports','int_zoho_fields','lodash','../../config/logger','api','moment','bluebird'];(function(_0x28c892,_0x161089){var _0x163993=function(_0x1a13af){while(--_0x1a13af){_0x28c892['push'](_0x28c892['shift']());}};_0x163993(++_0x161089);}(_0x2f20,0x103));var _0x02f2=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x2f20[_0xfa634c];return _0x73e478;};'use strict';var _=require(_0x02f2('0x0'));var util=require('util');var logger=require(_0x02f2('0x1'))(_0x02f2('0x2'));var moment=require(_0x02f2('0x3'));var BPromise=require(_0x02f2('0x4'));var rp=require(_0x02f2('0x5'));var attributes=require('./intZohoField.attributes');module[_0x02f2('0x6')]=function(_0x5c649c,_0x2c14d2){return _0x5c649c['define']('ZohoField',attributes,{'tableName':_0x02f2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x785f=['util','../../config/logger','api','moment','bluebird','request-promise','./intZohoField.attributes','define','ZohoField','int_zoho_fields','lodash'];(function(_0xa42851,_0x29dce6){var _0x59db86=function(_0x52be9b){while(--_0x52be9b){_0xa42851['push'](_0xa42851['shift']());}};_0x59db86(++_0x29dce6);}(_0x785f,0xba));var _0xf785=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x785f[_0x31ced5];return _0x10d9e5;};'use strict';var _=require(_0xf785('0x0'));var util=require(_0xf785('0x1'));var logger=require(_0xf785('0x2'))(_0xf785('0x3'));var moment=require(_0xf785('0x4'));var BPromise=require(_0xf785('0x5'));var rp=require(_0xf785('0x6'));var attributes=require(_0xf785('0x7'));module['exports']=function(_0x3a03a0,_0x1dfb29){return _0x3a03a0[_0xf785('0x8')](_0xf785('0x9'),attributes,{'tableName':_0xf785('0xa'),'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 617fb26..a933b65 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 _0xed5c=['request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ZohoField,\x20%s,\x20%s'];(function(_0x37bbfc,_0x4821cc){var _0x4417d9=function(_0x461526){while(--_0x461526){_0x37bbfc['push'](_0x37bbfc['shift']());}};_0x4417d9(++_0x4821cc);}(_0xed5c,0x81));var _0xced5=function(_0x41f818,_0x34e4ed){_0x41f818=_0x41f818-0x0;var _0x560ca8=_0xed5c[_0x41f818];return _0x560ca8;};'use strict';var _=require(_0xced5('0x0'));var util=require(_0xced5('0x1'));var moment=require(_0xced5('0x2'));var BPromise=require(_0xced5('0x3'));var rs=require(_0xced5('0x4'));var fs=require('fs');var db=require(_0xced5('0x5'))['db'];var utils=require(_0xced5('0x6'));var logger=require(_0xced5('0x7'))(_0xced5('0x8'));var config=require(_0xced5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xced5('0xa')][_0xced5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b7807,_0x5c59d1,_0x31a495){return new BPromise(function(_0xc738da,_0x2857d8){return client[_0xced5('0xc')](_0x4b7807,_0x31a495)[_0xced5('0xd')](function(_0x56d986){logger['info'](_0xced5('0xe'),_0x5c59d1,_0xced5('0xf'));logger[_0xced5('0x10')](_0xced5('0x11'),_0x5c59d1,'request\x20sent',JSON[_0xced5('0x12')](_0x56d986));if(_0x56d986['error']){if(_0x56d986[_0xced5('0x13')][_0xced5('0x14')]===0x1f4){logger['error'](_0xced5('0xe'),_0x5c59d1,_0x56d986['error'][_0xced5('0x15')]);return _0x2857d8(_0x56d986[_0xced5('0x13')][_0xced5('0x15')]);}logger[_0xced5('0x13')](_0xced5('0xe'),_0x5c59d1,_0x56d986[_0xced5('0x13')][_0xced5('0x15')]);return _0xc738da(_0x56d986['error']['message']);}else{logger[_0xced5('0x16')](_0xced5('0xe'),_0x5c59d1,_0xced5('0xf'));_0xc738da(_0x56d986['result']['message']);}})[_0xced5('0x17')](function(_0x1c8c90){logger[_0xced5('0x13')](_0xced5('0xe'),_0x5c59d1,_0x1c8c90);_0x2857d8(_0x1c8c90);});});} \ No newline at end of file +var _0x29af=['message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','info','ZohoField,\x20%s,\x20%s','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x29af,0x134));var _0xf29a=function(_0xe552c0,_0x53ad2e){_0xe552c0=_0xe552c0-0x0;var _0x5313ad=_0x29af[_0xe552c0];return _0x5313ad;};'use strict';var _=require(_0xf29a('0x0'));var util=require(_0xf29a('0x1'));var moment=require(_0xf29a('0x2'));var BPromise=require('bluebird');var rs=require(_0xf29a('0x3'));var fs=require('fs');var db=require(_0xf29a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf29a('0x5'))('rpc');var config=require(_0xf29a('0x6'));var jayson=require(_0xf29a('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e25dc,_0x2c111b,_0x47749d){return new BPromise(function(_0x33a308,_0x347d76){return client[_0xf29a('0x8')](_0x2e25dc,_0x47749d)['then'](function(_0x41d4c3){logger[_0xf29a('0x9')](_0xf29a('0xa'),_0x2c111b,'request\x20sent');logger['debug'](_0xf29a('0xb'),_0x2c111b,_0xf29a('0xc'),JSON[_0xf29a('0xd')](_0x41d4c3));if(_0x41d4c3[_0xf29a('0xe')]){if(_0x41d4c3[_0xf29a('0xe')][_0xf29a('0xf')]===0x1f4){logger[_0xf29a('0xe')]('ZohoField,\x20%s,\x20%s',_0x2c111b,_0x41d4c3[_0xf29a('0xe')][_0xf29a('0x10')]);return _0x347d76(_0x41d4c3[_0xf29a('0xe')][_0xf29a('0x10')]);}logger[_0xf29a('0xe')](_0xf29a('0xa'),_0x2c111b,_0x41d4c3[_0xf29a('0xe')]['message']);return _0x33a308(_0x41d4c3['error']['message']);}else{logger[_0xf29a('0x9')](_0xf29a('0xa'),_0x2c111b,_0xf29a('0xc'));_0x33a308(_0x41d4c3[_0xf29a('0x11')][_0xf29a('0x10')]);}})['catch'](function(_0x34cd2e){logger[_0xf29a('0xe')](_0xf29a('0xa'),_0x2c111b,_0x34cd2e);_0x347d76(_0x34cd2e);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 71042db..d5668d2 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 _0xd3cc=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd3cc,0x1d3));var _0xcd3c=function(_0x5c51df,_0x25b8a3){_0x5c51df=_0x5c51df-0x0;var _0x3dad1f=_0xd3cc[_0x5c51df];return _0x3dad1f;};'use strict';var multer=require(_0xcd3c('0x0'));var util=require(_0xcd3c('0x1'));var path=require(_0xcd3c('0x2'));var express=require(_0xcd3c('0x3'));var router=express[_0xcd3c('0x4')]();var auth=require(_0xcd3c('0x5'));var interaction=require(_0xcd3c('0x6'));var config=require(_0xcd3c('0x7'));module[_0xcd3c('0x8')]=router; \ No newline at end of file +var _0xf698=['util','path','Router','../../components/interaction/service','../../config/environment'];(function(_0xe22843,_0x36fcb4){var _0x9fff4c=function(_0x39555f){while(--_0x39555f){_0xe22843['push'](_0xe22843['shift']());}};_0x9fff4c(++_0x36fcb4);}(_0xf698,0x1e0));var _0x8f69=function(_0xb725be,_0x45bd01){_0xb725be=_0xb725be-0x0;var _0x2f2424=_0xf698[_0xb725be];return _0x2f2424;};'use strict';var multer=require('multer');var util=require(_0x8f69('0x0'));var path=require(_0x8f69('0x1'));var express=require('express');var router=express[_0x8f69('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x8f69('0x3'));var config=require(_0x8f69('0x4'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 8c9c2a4..daccf7b 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 _0x1447=['unique_name_and_version','app.js','INTEGER','BOOLEAN','state','exports','STRING'];(function(_0x590721,_0x7b78b1){var _0x380017=function(_0x4d8470){while(--_0x4d8470){_0x590721['push'](_0x590721['shift']());}};_0x380017(++_0x7b78b1);}(_0x1447,0x18d));var _0x7144=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1447[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x7144('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x7144('0x1')],'allowNull':![],'unique':_0x7144('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x7144('0x3')},'filename':{'type':Sequelize[_0x7144('0x1')]},'path':{'type':Sequelize[_0x7144('0x1')]},'type':{'type':Sequelize[_0x7144('0x1')]},'size':{'type':Sequelize[_0x7144('0x4')]},'active':{'type':Sequelize[_0x7144('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x7144('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0x7144('0x6')},'description':{'type':Sequelize[_0x7144('0x1')]},'title':{'type':Sequelize[_0x7144('0x1')]},'remoteUri':{'type':Sequelize[_0x7144('0x1')]},'link':{'type':Sequelize[_0x7144('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x743d=['unique_name_and_version','app.js','INTEGER','BOOLEAN','state','sequelize','exports','STRING'];(function(_0x3e8235,_0x12098e){var _0x526043=function(_0x4904ad){while(--_0x4904ad){_0x3e8235['push'](_0x3e8235['shift']());}};_0x526043(++_0x12098e);}(_0x743d,0x1c5));var _0xd743=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x743d[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xd743('0x0'));module[_0xd743('0x1')]={'name':{'type':Sequelize[_0xd743('0x2')],'allowNull':![],'unique':_0xd743('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xd743('0x2')],'defaultValue':_0xd743('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xd743('0x2')]},'type':{'type':Sequelize[_0xd743('0x2')]},'size':{'type':Sequelize[_0xd743('0x5')]},'active':{'type':Sequelize[_0xd743('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xd743('0x2')]},'logo':{'type':Sequelize[_0xd743('0x2')]},'state':{'type':Sequelize[_0xd743('0x2')],'unique':_0xd743('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xd743('0x2')]},'remoteUri':{'type':Sequelize[_0xd743('0x2')]},'link':{'type':Sequelize[_0xd743('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 72164dd..c04ea65 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 _0xeed1=['papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','Content-Range','json','update','then','stack','name','send','index','Integration','rawAttributes','keys','query','dateStart','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','dateEnd','add','day','merge','filter','map','includeAll','include','findAll','show','params','filters','options','find','catch','create','body','destroy','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x46451c,_0x88ddd){var _0x12dce4=function(_0x2e4087){while(--_0x2e4087){_0x46451c['push'](_0x46451c['shift']());}};_0x12dce4(++_0x88ddd);}(_0xeed1,0x17a));var _0x1eed=function(_0x1dcf37,_0x150062){_0x1dcf37=_0x1dcf37-0x0;var _0x4323ea=_0xeed1[_0x1dcf37];return _0x4323ea;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x1eed('0x0'));var moment=require(_0x1eed('0x1'));var BPromise=require(_0x1eed('0x2'));var Mustache=require(_0x1eed('0x3'));var util=require('util');var path=require(_0x1eed('0x4'));var sox=require('sox');var csv=require(_0x1eed('0x5'));var ejs=require(_0x1eed('0x6'));var fs=require('fs');var _=require(_0x1eed('0x7'));var squel=require(_0x1eed('0x8'));var crypto=require(_0x1eed('0x9'));var jsforce=require(_0x1eed('0xa'));var deskjs=require(_0x1eed('0xb'));var toCsv=require(_0x1eed('0x5'));var querystring=require('querystring');var Papa=require(_0x1eed('0xc'));var qs=require(_0x1eed('0xd'));var logger=require(_0x1eed('0xe'))(_0x1eed('0xf'));var utils=require(_0x1eed('0x10'));var config=require(_0x1eed('0x11'));var db=require(_0x1eed('0x12'))['db'];function respondWithStatusCode(_0x41b19d,_0x335736){_0x335736=_0x335736||0xcc;return function(_0xfff7cb){if(_0xfff7cb){return _0x41b19d['sendStatus'](_0x335736);}return _0x41b19d[_0x1eed('0x13')](_0x335736)[_0x1eed('0x14')]();};}function respondWithResult(_0x365d1a,_0x500f16){_0x500f16=_0x500f16||0xc8;return function(_0x2f9a61){if(_0x2f9a61){return _0x365d1a[_0x1eed('0x13')](_0x500f16)['json'](_0x2f9a61);}};}function respondWithFilteredResult(_0x479bdc,_0x12828c){return function(_0x31380d){if(_0x31380d){var _0xd1361d=_0x31380d[_0x1eed('0x15')],_0x518099=_0x12828c[_0x1eed('0x16')],_0x1e38f1=_0x12828c[_0x1eed('0x16')]+_0x12828c['limit'],_0x405562;if(_0x1e38f1>=_0xd1361d){_0x1e38f1=_0xd1361d;_0x405562=0xc8;}else{_0x405562=0xce;}_0x479bdc[_0x1eed('0x13')](_0x405562);return _0x479bdc['set'](_0x1eed('0x17'),_0x518099+'-'+_0x1e38f1+'/'+_0xd1361d)[_0x1eed('0x18')](_0x31380d);}return null;};}function patchUpdates(_0x4f1713){return function(_0x35dd79){try{jsonpatch['apply'](_0x35dd79,_0x4f1713,!![]);}catch(_0x3a73de){return BPromise['reject'](_0x3a73de);}return _0x35dd79['save']();};}function saveUpdates(_0x1feb88,_0x3b0fc){return function(_0x2dd3a6){if(_0x2dd3a6){return _0x2dd3a6[_0x1eed('0x19')](_0x1feb88)[_0x1eed('0x1a')](function(_0x2c7ac5){return _0x2c7ac5;});}return null;};}function removeEntity(_0x24d848,_0x59f31c){return function(_0x52e971){if(_0x52e971){return _0x52e971['destroy']()[_0x1eed('0x1a')](function(){_0x24d848[_0x1eed('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b525d,_0x49c1ff){return function(_0x14def6){if(!_0x14def6){_0x2b525d['sendStatus'](0x194);}return _0x14def6;};}function handleError(_0x46d7ea,_0x317b1e){_0x317b1e=_0x317b1e||0x1f4;return function(_0x74839c){logger['error'](_0x74839c[_0x1eed('0x1b')]);if(_0x74839c[_0x1eed('0x1c')]){delete _0x74839c[_0x1eed('0x1c')];}_0x46d7ea[_0x1eed('0x13')](_0x317b1e)[_0x1eed('0x1d')](_0x74839c);};}exports[_0x1eed('0x1e')]=function(_0x27f1f2,_0x2c777f){var _0x1ed8a9={},_0x282cfd={},_0x46a72b={'count':0x0,'rows':[]};var _0x27e4b1=db[_0x1eed('0x1f')][_0x1eed('0x20')];_0x282cfd['model']=_[_0x1eed('0x21')](_0x27e4b1);var _0x58ff9e={'dateStart':_0x27f1f2[_0x1eed('0x22')]['dateStart'],'dateEnd':_0x27f1f2[_0x1eed('0x22')]['dateEnd']};delete _0x27f1f2[_0x1eed('0x22')][_0x1eed('0x23')];delete _0x27f1f2[_0x1eed('0x22')]['dateEnd'];_0x282cfd['query']=_[_0x1eed('0x21')](_0x27f1f2[_0x1eed('0x22')]);_0x282cfd['filters']=_[_0x1eed('0x24')](_0x282cfd[_0x1eed('0x25')],_0x282cfd['query']);_0x1ed8a9[_0x1eed('0x26')]=_[_0x1eed('0x24')](_0x282cfd[_0x1eed('0x25')],qs['fields'](_0x27f1f2[_0x1eed('0x22')][_0x1eed('0x27')]));_0x1ed8a9[_0x1eed('0x26')]=_0x1ed8a9[_0x1eed('0x26')][_0x1eed('0x28')]?_0x1ed8a9[_0x1eed('0x26')]:_0x282cfd[_0x1eed('0x25')];if(!_0x27f1f2[_0x1eed('0x22')]['hasOwnProperty'](_0x1eed('0x29'))){_0x1ed8a9[_0x1eed('0x2a')]=qs[_0x1eed('0x2a')](_0x27f1f2[_0x1eed('0x22')][_0x1eed('0x2a')]);_0x1ed8a9[_0x1eed('0x16')]=qs['offset'](_0x27f1f2[_0x1eed('0x22')][_0x1eed('0x16')]);}_0x1ed8a9[_0x1eed('0x2b')]=qs['sort'](_0x27f1f2[_0x1eed('0x22')][_0x1eed('0x2c')]);_0x1ed8a9[_0x1eed('0x2d')]=qs['filters'](_[_0x1eed('0x2e')](_0x27f1f2[_0x1eed('0x22')],_0x282cfd['filters']));if(_0x58ff9e[_0x1eed('0x23')]){if(_0x58ff9e[_0x1eed('0x2f')]){_0x58ff9e[_0x1eed('0x2f')]=moment(_0x58ff9e[_0x1eed('0x2f')])[_0x1eed('0x30')](0x1,_0x1eed('0x31'));}else{_0x58ff9e[_0x1eed('0x2f')]=moment(_0x58ff9e[_0x1eed('0x23')])[_0x1eed('0x30')](0x1,'day');}_[_0x1eed('0x32')](_0x1ed8a9[_0x1eed('0x2d')],{'createdAt':{'$gte':_0x58ff9e['dateStart'],'$lte':_0x58ff9e[_0x1eed('0x2f')]}});}if(_0x27f1f2['query'][_0x1eed('0x33')]){_0x1ed8a9['where']=_[_0x1eed('0x32')](_0x1ed8a9['where'],{'$or':_[_0x1eed('0x34')](_0x1ed8a9[_0x1eed('0x26')],function(_0x32b8ea){var _0xf75c60={};_0xf75c60[_0x32b8ea]={'$like':'%'+_0x27f1f2[_0x1eed('0x22')][_0x1eed('0x33')]+'%'};return _0xf75c60;})});}_0x1ed8a9=_['merge']({},_0x1ed8a9,_0x27f1f2['options']);var _0x2cc3b2={'where':_0x1ed8a9[_0x1eed('0x2d')]};return db[_0x1eed('0x1f')][_0x1eed('0x15')](_0x2cc3b2)[_0x1eed('0x1a')](function(_0x563907){_0x46a72b[_0x1eed('0x15')]=_0x563907;if(_0x27f1f2[_0x1eed('0x22')][_0x1eed('0x35')]){_0x1ed8a9[_0x1eed('0x36')]=[{'all':!![]}];}return db['Integration'][_0x1eed('0x37')](_0x1ed8a9);})[_0x1eed('0x1a')](function(_0x26f325){_0x46a72b['rows']=_0x26f325;return _0x46a72b;})[_0x1eed('0x1a')](respondWithFilteredResult(_0x2c777f,_0x1ed8a9))['catch'](handleError(_0x2c777f,null));};exports[_0x1eed('0x38')]=function(_0x41b1b7,_0x45dfeb){var _0x5e0705={'raw':![],'where':{'id':_0x41b1b7[_0x1eed('0x39')]['id']}},_0x33fe14={};_0x33fe14[_0x1eed('0x25')]=_[_0x1eed('0x21')](db[_0x1eed('0x1f')][_0x1eed('0x20')]);_0x33fe14['query']=_[_0x1eed('0x21')](_0x41b1b7['query']);_0x33fe14[_0x1eed('0x3a')]=_[_0x1eed('0x24')](_0x33fe14[_0x1eed('0x25')],_0x33fe14[_0x1eed('0x22')]);_0x5e0705[_0x1eed('0x26')]=_[_0x1eed('0x24')](_0x33fe14[_0x1eed('0x25')],qs['fields'](_0x41b1b7[_0x1eed('0x22')][_0x1eed('0x27')]));_0x5e0705[_0x1eed('0x26')]=_0x5e0705[_0x1eed('0x26')]['length']?_0x5e0705[_0x1eed('0x26')]:_0x33fe14[_0x1eed('0x25')];if(_0x41b1b7[_0x1eed('0x22')]['includeAll']){_0x5e0705['include']=[{'all':!![]}];}_0x5e0705=_[_0x1eed('0x32')]({},_0x5e0705,_0x41b1b7[_0x1eed('0x3b')]);return db['Integration'][_0x1eed('0x3c')](_0x5e0705)[_0x1eed('0x1a')](handleEntityNotFound(_0x45dfeb,null))[_0x1eed('0x1a')](respondWithResult(_0x45dfeb,null))[_0x1eed('0x3d')](handleError(_0x45dfeb,null));};exports[_0x1eed('0x3e')]=function(_0x3dc625,_0x5c6cae){return db[_0x1eed('0x1f')][_0x1eed('0x3e')](_0x3dc625['body'],{})[_0x1eed('0x1a')](respondWithResult(_0x5c6cae,0xc9))[_0x1eed('0x3d')](handleError(_0x5c6cae,null));};exports[_0x1eed('0x19')]=function(_0x62af10,_0x5c81d0){if(_0x62af10[_0x1eed('0x3f')]['id']){delete _0x62af10[_0x1eed('0x3f')]['id'];}return db[_0x1eed('0x1f')][_0x1eed('0x3c')]({'where':{'id':_0x62af10[_0x1eed('0x39')]['id']}})['then'](handleEntityNotFound(_0x5c81d0,null))[_0x1eed('0x1a')](saveUpdates(_0x62af10['body'],null))[_0x1eed('0x1a')](respondWithResult(_0x5c81d0,null))[_0x1eed('0x3d')](handleError(_0x5c81d0,null));};exports[_0x1eed('0x40')]=function(_0x5174e5,_0x34f690){return db[_0x1eed('0x1f')][_0x1eed('0x3c')]({'where':{'id':_0x5174e5['params']['id']}})[_0x1eed('0x1a')](handleEntityNotFound(_0x34f690,null))['then'](removeEntity(_0x34f690,null))[_0x1eed('0x3d')](handleError(_0x34f690,null));}; \ No newline at end of file +var _0x1f81=['moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','status','set','reject','save','update','then','destroy','error','name','send','index','Integration','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','add','day','merge','where','filter','map','count','includeAll','include','findAll','rows','catch','show','options','create','body','find','params','fast-json-patch','request-promise'];(function(_0x4e8c29,_0x147d3b){var _0x3c7ccd=function(_0x14388f){while(--_0x14388f){_0x4e8c29['push'](_0x4e8c29['shift']());}};_0x3c7ccd(++_0x147d3b);}(_0x1f81,0xc7));var _0x11f8=function(_0x2d2ca2,_0x51873f){_0x2d2ca2=_0x2d2ca2-0x0;var _0x48489d=_0x1f81[_0x2d2ca2];return _0x48489d;};'use strict';var jsonpatch=require(_0x11f8('0x0'));var rp=require(_0x11f8('0x1'));var moment=require(_0x11f8('0x2'));var BPromise=require(_0x11f8('0x3'));var Mustache=require('mustache');var util=require(_0x11f8('0x4'));var path=require(_0x11f8('0x5'));var sox=require('sox');var csv=require(_0x11f8('0x6'));var ejs=require(_0x11f8('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x11f8('0x8'));var crypto=require(_0x11f8('0x9'));var jsforce=require(_0x11f8('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x11f8('0xb'));var Papa=require(_0x11f8('0xc'));var qs=require(_0x11f8('0xd'));var logger=require('../../config/logger')('api');var utils=require(_0x11f8('0xe'));var config=require(_0x11f8('0xf'));var db=require(_0x11f8('0x10'))['db'];function respondWithStatusCode(_0x4ca74b,_0x2f1230){_0x2f1230=_0x2f1230||0xcc;return function(_0x5263ef){if(_0x5263ef){return _0x4ca74b[_0x11f8('0x11')](_0x2f1230);}return _0x4ca74b['status'](_0x2f1230)[_0x11f8('0x12')]();};}function respondWithResult(_0x55ca30,_0x8ccac0){_0x8ccac0=_0x8ccac0||0xc8;return function(_0x1f7aa1){if(_0x1f7aa1){return _0x55ca30['status'](_0x8ccac0)[_0x11f8('0x13')](_0x1f7aa1);}};}function respondWithFilteredResult(_0x3aa888,_0x3d47ba){return function(_0x24658e){if(_0x24658e){var _0x145d8c=_0x24658e['count'],_0x252c82=_0x3d47ba[_0x11f8('0x14')],_0x4b17fe=_0x3d47ba[_0x11f8('0x14')]+_0x3d47ba[_0x11f8('0x15')],_0x3b855f;if(_0x4b17fe>=_0x145d8c){_0x4b17fe=_0x145d8c;_0x3b855f=0xc8;}else{_0x3b855f=0xce;}_0x3aa888[_0x11f8('0x16')](_0x3b855f);return _0x3aa888[_0x11f8('0x17')]('Content-Range',_0x252c82+'-'+_0x4b17fe+'/'+_0x145d8c)[_0x11f8('0x13')](_0x24658e);}return null;};}function patchUpdates(_0x396a9a){return function(_0x1180a7){try{jsonpatch['apply'](_0x1180a7,_0x396a9a,!![]);}catch(_0x54dcc1){return BPromise[_0x11f8('0x18')](_0x54dcc1);}return _0x1180a7[_0x11f8('0x19')]();};}function saveUpdates(_0x3c07da,_0x508a17){return function(_0x73a73b){if(_0x73a73b){return _0x73a73b[_0x11f8('0x1a')](_0x3c07da)[_0x11f8('0x1b')](function(_0x3087fd){return _0x3087fd;});}return null;};}function removeEntity(_0x156a65,_0x2b84e0){return function(_0xb84c90){if(_0xb84c90){return _0xb84c90[_0x11f8('0x1c')]()[_0x11f8('0x1b')](function(){_0x156a65[_0x11f8('0x16')](0xcc)[_0x11f8('0x12')]();});}};}function handleEntityNotFound(_0x582288,_0x2b5769){return function(_0x17b075){if(!_0x17b075){_0x582288[_0x11f8('0x11')](0x194);}return _0x17b075;};}function handleError(_0x5a9040,_0x4b8b90){_0x4b8b90=_0x4b8b90||0x1f4;return function(_0x2e6105){logger[_0x11f8('0x1d')](_0x2e6105['stack']);if(_0x2e6105[_0x11f8('0x1e')]){delete _0x2e6105[_0x11f8('0x1e')];}_0x5a9040[_0x11f8('0x16')](_0x4b8b90)[_0x11f8('0x1f')](_0x2e6105);};}exports[_0x11f8('0x20')]=function(_0x509c81,_0x164d7c){var _0xbc47eb={},_0x51b72e={},_0x334e38={'count':0x0,'rows':[]};var _0x134d34=db[_0x11f8('0x21')][_0x11f8('0x22')];_0x51b72e[_0x11f8('0x23')]=_['keys'](_0x134d34);var _0x476fe1={'dateStart':_0x509c81[_0x11f8('0x24')][_0x11f8('0x25')],'dateEnd':_0x509c81[_0x11f8('0x24')][_0x11f8('0x26')]};delete _0x509c81['query'][_0x11f8('0x25')];delete _0x509c81[_0x11f8('0x24')]['dateEnd'];_0x51b72e[_0x11f8('0x24')]=_[_0x11f8('0x27')](_0x509c81[_0x11f8('0x24')]);_0x51b72e[_0x11f8('0x28')]=_[_0x11f8('0x29')](_0x51b72e[_0x11f8('0x23')],_0x51b72e['query']);_0xbc47eb[_0x11f8('0x2a')]=_['intersection'](_0x51b72e[_0x11f8('0x23')],qs[_0x11f8('0x2b')](_0x509c81[_0x11f8('0x24')][_0x11f8('0x2b')]));_0xbc47eb['attributes']=_0xbc47eb[_0x11f8('0x2a')][_0x11f8('0x2c')]?_0xbc47eb[_0x11f8('0x2a')]:_0x51b72e[_0x11f8('0x23')];if(!_0x509c81['query'][_0x11f8('0x2d')](_0x11f8('0x2e'))){_0xbc47eb[_0x11f8('0x15')]=qs[_0x11f8('0x15')](_0x509c81['query'][_0x11f8('0x15')]);_0xbc47eb[_0x11f8('0x14')]=qs[_0x11f8('0x14')](_0x509c81[_0x11f8('0x24')][_0x11f8('0x14')]);}_0xbc47eb[_0x11f8('0x2f')]=qs[_0x11f8('0x30')](_0x509c81[_0x11f8('0x24')][_0x11f8('0x30')]);_0xbc47eb['where']=qs[_0x11f8('0x28')](_['pick'](_0x509c81[_0x11f8('0x24')],_0x51b72e['filters']));if(_0x476fe1[_0x11f8('0x25')]){if(_0x476fe1[_0x11f8('0x26')]){_0x476fe1[_0x11f8('0x26')]=moment(_0x476fe1[_0x11f8('0x26')])[_0x11f8('0x31')](0x1,_0x11f8('0x32'));}else{_0x476fe1[_0x11f8('0x26')]=moment(_0x476fe1[_0x11f8('0x25')])[_0x11f8('0x31')](0x1,_0x11f8('0x32'));}_[_0x11f8('0x33')](_0xbc47eb[_0x11f8('0x34')],{'createdAt':{'$gte':_0x476fe1['dateStart'],'$lte':_0x476fe1[_0x11f8('0x26')]}});}if(_0x509c81['query'][_0x11f8('0x35')]){_0xbc47eb[_0x11f8('0x34')]=_['merge'](_0xbc47eb[_0x11f8('0x34')],{'$or':_[_0x11f8('0x36')](_0xbc47eb[_0x11f8('0x2a')],function(_0x1d7a0a){var _0x1ba4ba={};_0x1ba4ba[_0x1d7a0a]={'$like':'%'+_0x509c81['query']['filter']+'%'};return _0x1ba4ba;})});}_0xbc47eb=_[_0x11f8('0x33')]({},_0xbc47eb,_0x509c81['options']);var _0xcc7ce8={'where':_0xbc47eb[_0x11f8('0x34')]};return db[_0x11f8('0x21')]['count'](_0xcc7ce8)['then'](function(_0x587917){_0x334e38[_0x11f8('0x37')]=_0x587917;if(_0x509c81[_0x11f8('0x24')][_0x11f8('0x38')]){_0xbc47eb[_0x11f8('0x39')]=[{'all':!![]}];}return db[_0x11f8('0x21')][_0x11f8('0x3a')](_0xbc47eb);})[_0x11f8('0x1b')](function(_0x1b54f3){_0x334e38[_0x11f8('0x3b')]=_0x1b54f3;return _0x334e38;})['then'](respondWithFilteredResult(_0x164d7c,_0xbc47eb))[_0x11f8('0x3c')](handleError(_0x164d7c,null));};exports[_0x11f8('0x3d')]=function(_0x4bdbdc,_0x2d47bc){var _0x46cace={'raw':![],'where':{'id':_0x4bdbdc['params']['id']}},_0x384b7a={};_0x384b7a[_0x11f8('0x23')]=_[_0x11f8('0x27')](db[_0x11f8('0x21')][_0x11f8('0x22')]);_0x384b7a[_0x11f8('0x24')]=_[_0x11f8('0x27')](_0x4bdbdc[_0x11f8('0x24')]);_0x384b7a[_0x11f8('0x28')]=_['intersection'](_0x384b7a[_0x11f8('0x23')],_0x384b7a[_0x11f8('0x24')]);_0x46cace[_0x11f8('0x2a')]=_[_0x11f8('0x29')](_0x384b7a[_0x11f8('0x23')],qs[_0x11f8('0x2b')](_0x4bdbdc[_0x11f8('0x24')]['fields']));_0x46cace[_0x11f8('0x2a')]=_0x46cace['attributes']['length']?_0x46cace['attributes']:_0x384b7a[_0x11f8('0x23')];if(_0x4bdbdc[_0x11f8('0x24')][_0x11f8('0x38')]){_0x46cace['include']=[{'all':!![]}];}_0x46cace=_[_0x11f8('0x33')]({},_0x46cace,_0x4bdbdc[_0x11f8('0x3e')]);return db['Integration']['find'](_0x46cace)[_0x11f8('0x1b')](handleEntityNotFound(_0x2d47bc,null))[_0x11f8('0x1b')](respondWithResult(_0x2d47bc,null))[_0x11f8('0x3c')](handleError(_0x2d47bc,null));};exports['create']=function(_0x54a5de,_0x391f9e){return db['Integration'][_0x11f8('0x3f')](_0x54a5de[_0x11f8('0x40')],{})[_0x11f8('0x1b')](respondWithResult(_0x391f9e,0xc9))[_0x11f8('0x3c')](handleError(_0x391f9e,null));};exports[_0x11f8('0x1a')]=function(_0x574742,_0x113ad2){if(_0x574742[_0x11f8('0x40')]['id']){delete _0x574742[_0x11f8('0x40')]['id'];}return db['Integration']['find']({'where':{'id':_0x574742['params']['id']}})[_0x11f8('0x1b')](handleEntityNotFound(_0x113ad2,null))[_0x11f8('0x1b')](saveUpdates(_0x574742[_0x11f8('0x40')],null))[_0x11f8('0x1b')](respondWithResult(_0x113ad2,null))[_0x11f8('0x3c')](handleError(_0x113ad2,null));};exports[_0x11f8('0x1c')]=function(_0x19199c,_0x14a523){return db[_0x11f8('0x21')][_0x11f8('0x41')]({'where':{'id':_0x19199c[_0x11f8('0x42')]['id']}})[_0x11f8('0x1b')](handleEntityNotFound(_0x14a523,null))['then'](removeEntity(_0x14a523,null))[_0x11f8('0x3c')](handleError(_0x14a523,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 6b438ea..00230a7 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 _0x1967=['integrations','util','../../config/logger','api','moment','bluebird','request-promise','./integration.attributes','exports','Integration'];(function(_0x274cfc,_0xf7e8e1){var _0x3e2e5b=function(_0x3c1767){while(--_0x3c1767){_0x274cfc['push'](_0x274cfc['shift']());}};_0x3e2e5b(++_0xf7e8e1);}(_0x1967,0x173));var _0x7196=function(_0x326d7f,_0x1813ee){_0x326d7f=_0x326d7f-0x0;var _0x4be844=_0x1967[_0x326d7f];return _0x4be844;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var attributes=require(_0x7196('0x6'));module[_0x7196('0x7')]=function(_0x458ae8,_0x3ae43f){return _0x458ae8['define'](_0x7196('0x8'),attributes,{'tableName':_0x7196('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x896e=['request-promise','./integration.attributes','exports','define','integrations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1392c4,_0x5a51c6){var _0x179f77=function(_0x14ecba){while(--_0x14ecba){_0x1392c4['push'](_0x1392c4['shift']());}};_0x179f77(++_0x5a51c6);}(_0x896e,0x1e9));var _0xe896=function(_0x5de054,_0x10bf4b){_0x5de054=_0x5de054-0x0;var _0x25ca23=_0x896e[_0x5de054];return _0x25ca23;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var logger=require(_0xe896('0x2'))(_0xe896('0x3'));var moment=require(_0xe896('0x4'));var BPromise=require(_0xe896('0x5'));var rp=require(_0xe896('0x6'));var attributes=require(_0xe896('0x7'));module[_0xe896('0x8')]=function(_0x2d3521,_0x244f68){return _0x2d3521[_0xe896('0x9')]('Integration',attributes,{'tableName':_0xe896('0xa'),'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 06ecaab..a9fbd5d 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 _0xd824=['../../config/utils','../../config/logger','rpc','../../config/environment','http','then','Integration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','randomstring','../../mysqldb'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xd824,0xc2));var _0x4d82=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd824[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d82('0x2'));var fs=require('fs');var db=require(_0x4d82('0x3'))['db'];var utils=require(_0x4d82('0x4'));var logger=require(_0x4d82('0x5'))(_0x4d82('0x6'));var config=require(_0x4d82('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4d82('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x583c7c,_0x4b842f,_0x464caf){return new BPromise(function(_0xb54db2,_0x13d624){return client['request'](_0x583c7c,_0x464caf)[_0x4d82('0x9')](function(_0x522801){logger['info'](_0x4d82('0xa'),_0x4b842f,_0x4d82('0xb'));logger[_0x4d82('0xc')]('Integration,\x20%s,\x20%s,\x20%s',_0x4b842f,_0x4d82('0xb'),JSON['stringify'](_0x522801));if(_0x522801[_0x4d82('0xd')]){if(_0x522801[_0x4d82('0xd')][_0x4d82('0xe')]===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x4b842f,_0x522801[_0x4d82('0xd')][_0x4d82('0xf')]);return _0x13d624(_0x522801[_0x4d82('0xd')][_0x4d82('0xf')]);}logger['error'](_0x4d82('0xa'),_0x4b842f,_0x522801[_0x4d82('0xd')][_0x4d82('0xf')]);return _0xb54db2(_0x522801['error'][_0x4d82('0xf')]);}else{logger['info'](_0x4d82('0xa'),_0x4b842f,'request\x20sent');_0xb54db2(_0x522801[_0x4d82('0x10')]['message']);}})[_0x4d82('0x11')](function(_0xb1640d){logger[_0x4d82('0xd')](_0x4d82('0xa'),_0x4b842f,_0xb1640d);_0x13d624(_0xb1640d);});});} \ No newline at end of file +var _0x9f0e=['Integration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x507321,_0x51fdf3){var _0x177ca3=function(_0x30f93b){while(--_0x30f93b){_0x507321['push'](_0x507321['shift']());}};_0x177ca3(++_0x51fdf3);}(_0x9f0e,0x116));var _0xe9f0=function(_0x263630,_0x170a2a){_0x263630=_0x263630-0x0;var _0x2ab596=_0x9f0e[_0x263630];return _0x2ab596;};'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')]('Integration,\x20%s,\x20%s',_0x3a17b3,_0x20d602[_0xe9f0('0x11')]['message']);return _0xe64a79(_0x20d602[_0xe9f0('0x11')][_0xe9f0('0x13')]);}else{logger[_0xe9f0('0xc')]('Integration,\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);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 00a8f6e..5ce19a4 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 _0xd510=['./integrationReport.controller','get','index','/describe','isAuthenticated','describe','show','post','update','delete','/:id','destroy','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xd510,0x198));var _0x0d51=function(_0x2833fd,_0x28c021){_0x2833fd=_0x2833fd-0x0;var _0x3331a0=_0xd510[_0x2833fd];return _0x3331a0;};'use strict';var multer=require(_0x0d51('0x0'));var util=require('util');var path=require(_0x0d51('0x1'));var express=require('express');var router=express[_0x0d51('0x2')]();var auth=require(_0x0d51('0x3'));var interaction=require(_0x0d51('0x4'));var config=require(_0x0d51('0x5'));var controller=require(_0x0d51('0x6'));router[_0x0d51('0x7')]('/',auth['isAuthenticated'](),controller[_0x0d51('0x8')]);router[_0x0d51('0x7')](_0x0d51('0x9'),auth[_0x0d51('0xa')](),controller[_0x0d51('0xb')]);router['get']('/:id',auth[_0x0d51('0xa')](),controller[_0x0d51('0xc')]);router[_0x0d51('0xd')]('/',auth[_0x0d51('0xa')](),controller['create']);router['put']('/:id',auth[_0x0d51('0xa')](),controller[_0x0d51('0xe')]);router[_0x0d51('0xf')](_0x0d51('0x10'),auth[_0x0d51('0xa')](),controller[_0x0d51('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa4c8=['express','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete','destroy','multer'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xa4c8,0x14f));var _0x8a4c=function(_0x4e9d7f,_0x383253){_0x4e9d7f=_0x4e9d7f-0x0;var _0x51f0bc=_0xa4c8[_0x4e9d7f];return _0x51f0bc;};'use strict';var multer=require(_0x8a4c('0x0'));var util=require('util');var path=require('path');var express=require(_0x8a4c('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8a4c('0x2'));var config=require(_0x8a4c('0x3'));var controller=require(_0x8a4c('0x4'));router[_0x8a4c('0x5')]('/',auth[_0x8a4c('0x6')](),controller[_0x8a4c('0x7')]);router[_0x8a4c('0x5')]('/describe',auth[_0x8a4c('0x6')](),controller[_0x8a4c('0x8')]);router['get'](_0x8a4c('0x9'),auth['isAuthenticated'](),controller[_0x8a4c('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8a4c('0xb')]);router[_0x8a4c('0xc')](_0x8a4c('0x9'),auth[_0x8a4c('0x6')](),controller[_0x8a4c('0xd')]);router[_0x8a4c('0xe')](_0x8a4c('0x9'),auth[_0x8a4c('0x6')](),controller[_0x8a4c('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 6116e0b..75409d5 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 _0xc4f1=['SENDING','RECEIVED','FAILED','STRING','INTEGER','DATE','TEXT','ENUM','SENT'];(function(_0x2f2a91,_0x228a7c){var _0x251c01=function(_0x5ab8d6){while(--_0x5ab8d6){_0x2f2a91['push'](_0x2f2a91['shift']());}};_0x251c01(++_0x228a7c);}(_0xc4f1,0xb7));var _0x1c4f=function(_0x16c2b1,_0x36a70c){_0x16c2b1=_0x16c2b1-0x0;var _0x199ac4=_0xc4f1[_0x16c2b1];return _0x199ac4;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize[_0x1c4f('0x0')]},'eventChannel':{'type':Sequelize[_0x1c4f('0x0')]},'exitStatus':{'type':Sequelize[_0x1c4f('0x0')]},'ticketId':{'type':Sequelize[_0x1c4f('0x0')]},'integrationId':{'type':Sequelize[_0x1c4f('0x1')]},'contacts':{'type':Sequelize[_0x1c4f('0x0')]},'uniqueid':{'type':Sequelize[_0x1c4f('0x0')]},'calleridnum':{'type':Sequelize[_0x1c4f('0x0')]},'calleridname':{'type':Sequelize[_0x1c4f('0x0')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x1c4f('0x0')]},'membername':{'type':Sequelize[_0x1c4f('0x0')]},'agentcalledAt':{'type':Sequelize[_0x1c4f('0x2')]},'agentconnectAt':{'type':Sequelize[_0x1c4f('0x2')]},'holdtime':{'type':Sequelize[_0x1c4f('0x1')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x1c4f('0x2')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1c4f('0x1')]},'reason':{'type':Sequelize[_0x1c4f('0x0')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x1c4f('0x0')]},'channel':{'type':Sequelize[_0x1c4f('0x0')]},'channelstate':{'type':Sequelize[_0x1c4f('0x1')]},'channelstatedesc':{'type':Sequelize[_0x1c4f('0x0')]},'connectedlinenum':{'type':Sequelize[_0x1c4f('0x0')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1c4f('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1c4f('0x0')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x1c4f('0x0')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x1c4f('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x1c4f('0x0')]},'destcalleridnum':{'type':Sequelize[_0x1c4f('0x0')]},'destcalleridname':{'type':Sequelize[_0x1c4f('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x1c4f('0x0')]},'destconnectedlinename':{'type':Sequelize[_0x1c4f('0x0')]},'destlanguage':{'type':Sequelize[_0x1c4f('0x0')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x1c4f('0x0')]},'destexten':{'type':Sequelize[_0x1c4f('0x0')]},'destpriority':{'type':Sequelize[_0x1c4f('0x0')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x1c4f('0x0')]},'inReplyTo':{'type':Sequelize[_0x1c4f('0x0')]},'subject':{'type':Sequelize[_0x1c4f('0x0')]},'from':{'type':Sequelize[_0x1c4f('0x0')]},'to':{'type':Sequelize[_0x1c4f('0x0')]},'cc':{'type':Sequelize[_0x1c4f('0x0')]},'attachment':{'type':Sequelize[_0x1c4f('0x3')]},'html':{'type':Sequelize[_0x1c4f('0x3')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x1c4f('0x4')](_0x1c4f('0x5'),_0x1c4f('0x6'),_0x1c4f('0x7'),_0x1c4f('0x8'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x1c4f('0x0')]},'projectId':{'type':Sequelize[_0x1c4f('0x1')]}}; \ No newline at end of file +var _0xd13e=['DATE','BOOLEAN','TEXT','ENUM','SENT','sequelize','exports','STRING','INTEGER'];(function(_0x2d5e70,_0x3f3483){var _0x358d8f=function(_0x303f37){while(--_0x303f37){_0x2d5e70['push'](_0x2d5e70['shift']());}};_0x358d8f(++_0x3f3483);}(_0xd13e,0x1be));var _0xed13=function(_0x5a1a39,_0xcfb21){_0x5a1a39=_0x5a1a39-0x0;var _0xe24fd3=_0xd13e[_0x5a1a39];return _0xe24fd3;};'use strict';var Sequelize=require(_0xed13('0x0'));module[_0xed13('0x1')]={'integration':{'type':Sequelize[_0xed13('0x2')]},'eventChannel':{'type':Sequelize[_0xed13('0x2')]},'exitStatus':{'type':Sequelize[_0xed13('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xed13('0x3')]},'contacts':{'type':Sequelize[_0xed13('0x2')]},'uniqueid':{'type':Sequelize[_0xed13('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xed13('0x2')]},'queue':{'type':Sequelize[_0xed13('0x2')]},'interface':{'type':Sequelize[_0xed13('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xed13('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xed13('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xed13('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xed13('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xed13('0x4')]},'agentdump':{'type':Sequelize[_0xed13('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xed13('0x4')]},'lastevent':{'type':Sequelize[_0xed13('0x2')]},'channel':{'type':Sequelize[_0xed13('0x2')]},'channelstate':{'type':Sequelize[_0xed13('0x3')]},'channelstatedesc':{'type':Sequelize[_0xed13('0x2')]},'connectedlinenum':{'type':Sequelize[_0xed13('0x2')]},'connectedlinename':{'type':Sequelize[_0xed13('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xed13('0x2')]},'context':{'type':Sequelize[_0xed13('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xed13('0x2')]},'destchannel':{'type':Sequelize[_0xed13('0x2')]},'destchannelstate':{'type':Sequelize[_0xed13('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xed13('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xed13('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xed13('0x2')]},'destlanguage':{'type':Sequelize[_0xed13('0x2')]},'destaccountcode':{'type':Sequelize[_0xed13('0x2')]},'destcontext':{'type':Sequelize[_0xed13('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xed13('0x2')]},'messageId':{'type':Sequelize[_0xed13('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xed13('0x2')]},'from':{'type':Sequelize[_0xed13('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xed13('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xed13('0x6')]},'text':{'type':Sequelize[_0xed13('0x6')]},'status':{'type':Sequelize[_0xed13('0x7')](_0xed13('0x8'),'SENDING','RECEIVED','FAILED')},'url':{'type':Sequelize[_0xed13('0x2')]},'app':{'type':Sequelize[_0xed13('0x2')]},'appdata':{'type':Sequelize[_0xed13('0x2')]},'projectId':{'type':Sequelize[_0xed13('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 7a3b77f..9e31d9f 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 _0x4fa0=['status','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','IntegrationReport','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','add','day','merge','where','includeAll','include','findAll','rows','catch','length','options','create','body','params','find','describe','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4fa0,0xbd));var _0x04fa=function(_0x2d1da8,_0x5606b9){_0x2d1da8=_0x2d1da8-0x0;var _0x53ae73=_0x4fa0[_0x2d1da8];return _0x53ae73;};'use strict';var jsonpatch=require(_0x04fa('0x0'));var rp=require(_0x04fa('0x1'));var moment=require(_0x04fa('0x2'));var BPromise=require(_0x04fa('0x3'));var Mustache=require('mustache');var util=require(_0x04fa('0x4'));var path=require(_0x04fa('0x5'));var sox=require('sox');var csv=require(_0x04fa('0x6'));var ejs=require(_0x04fa('0x7'));var fs=require('fs');var _=require(_0x04fa('0x8'));var squel=require(_0x04fa('0x9'));var crypto=require(_0x04fa('0xa'));var jsforce=require(_0x04fa('0xb'));var deskjs=require(_0x04fa('0xc'));var toCsv=require(_0x04fa('0x6'));var querystring=require(_0x04fa('0xd'));var Papa=require('papaparse');var qs=require(_0x04fa('0xe'));var logger=require(_0x04fa('0xf'))(_0x04fa('0x10'));var utils=require(_0x04fa('0x11'));var config=require(_0x04fa('0x12'));var db=require(_0x04fa('0x13'))['db'];function respondWithStatusCode(_0x1f5ff2,_0x508050){_0x508050=_0x508050||0xcc;return function(_0x32ea12){if(_0x32ea12){return _0x1f5ff2['sendStatus'](_0x508050);}return _0x1f5ff2['status'](_0x508050)[_0x04fa('0x14')]();};}function respondWithResult(_0x4798f0,_0x6d02e8){_0x6d02e8=_0x6d02e8||0xc8;return function(_0x625036){if(_0x625036){return _0x4798f0[_0x04fa('0x15')](_0x6d02e8)[_0x04fa('0x16')](_0x625036);}};}function respondWithFilteredResult(_0x40d04e,_0x13c9f8){return function(_0x451fc7){if(_0x451fc7){var _0x4ee469=_0x451fc7[_0x04fa('0x17')],_0x38ae28=_0x13c9f8[_0x04fa('0x18')],_0x72d299=_0x13c9f8[_0x04fa('0x18')]+_0x13c9f8[_0x04fa('0x19')],_0x48b3da;if(_0x72d299>=_0x4ee469){_0x72d299=_0x4ee469;_0x48b3da=0xc8;}else{_0x48b3da=0xce;}_0x40d04e[_0x04fa('0x15')](_0x48b3da);return _0x40d04e['set'](_0x04fa('0x1a'),_0x38ae28+'-'+_0x72d299+'/'+_0x4ee469)[_0x04fa('0x16')](_0x451fc7);}return null;};}function patchUpdates(_0x12fc75){return function(_0x5b0e9b){try{jsonpatch[_0x04fa('0x1b')](_0x5b0e9b,_0x12fc75,!![]);}catch(_0x37704a){return BPromise['reject'](_0x37704a);}return _0x5b0e9b[_0x04fa('0x1c')]();};}function saveUpdates(_0x2762de,_0x45da78){return function(_0x50dca8){if(_0x50dca8){return _0x50dca8[_0x04fa('0x1d')](_0x2762de)[_0x04fa('0x1e')](function(_0x324e22){return _0x324e22;});}return null;};}function removeEntity(_0x3e7dd9,_0x54eff7){return function(_0x541f89){if(_0x541f89){return _0x541f89[_0x04fa('0x1f')]()[_0x04fa('0x1e')](function(){_0x3e7dd9[_0x04fa('0x15')](0xcc)[_0x04fa('0x14')]();});}};}function handleEntityNotFound(_0x46cfb0,_0x57c7e0){return function(_0x2a17d6){if(!_0x2a17d6){_0x46cfb0[_0x04fa('0x20')](0x194);}return _0x2a17d6;};}function handleError(_0x37fb6c,_0x319990){_0x319990=_0x319990||0x1f4;return function(_0x32e4b6){logger[_0x04fa('0x21')](_0x32e4b6[_0x04fa('0x22')]);if(_0x32e4b6['name']){delete _0x32e4b6[_0x04fa('0x23')];}_0x37fb6c[_0x04fa('0x15')](_0x319990)[_0x04fa('0x24')](_0x32e4b6);};}exports[_0x04fa('0x25')]=function(_0x20ae5e,_0x47d3d7){var _0x3e5d8d={},_0x1cd7f8={},_0x339f3b={'count':0x0,'rows':[]};var _0xdb6d9d=db[_0x04fa('0x26')][_0x04fa('0x27')];_0x1cd7f8[_0x04fa('0x28')]=_[_0x04fa('0x29')](_0xdb6d9d);var _0x599061={'dateStart':_0x20ae5e['query'][_0x04fa('0x2a')],'dateEnd':_0x20ae5e[_0x04fa('0x2b')][_0x04fa('0x2c')]};delete _0x20ae5e['query'][_0x04fa('0x2a')];delete _0x20ae5e[_0x04fa('0x2b')][_0x04fa('0x2c')];_0x1cd7f8[_0x04fa('0x2b')]=_[_0x04fa('0x29')](_0x20ae5e[_0x04fa('0x2b')]);_0x1cd7f8[_0x04fa('0x2d')]=_[_0x04fa('0x2e')](_0x1cd7f8['model'],_0x1cd7f8[_0x04fa('0x2b')]);_0x3e5d8d['attributes']=_[_0x04fa('0x2e')](_0x1cd7f8[_0x04fa('0x28')],qs['fields'](_0x20ae5e['query'][_0x04fa('0x2f')]));_0x3e5d8d['attributes']=_0x3e5d8d[_0x04fa('0x30')]['length']?_0x3e5d8d['attributes']:_0x1cd7f8[_0x04fa('0x28')];if(!_0x20ae5e[_0x04fa('0x2b')][_0x04fa('0x31')](_0x04fa('0x32'))){_0x3e5d8d[_0x04fa('0x19')]=qs[_0x04fa('0x19')](_0x20ae5e['query'][_0x04fa('0x19')]);_0x3e5d8d[_0x04fa('0x18')]=qs['offset'](_0x20ae5e[_0x04fa('0x2b')][_0x04fa('0x18')]);}_0x3e5d8d[_0x04fa('0x33')]=qs['sort'](_0x20ae5e[_0x04fa('0x2b')][_0x04fa('0x34')]);_0x3e5d8d['where']=qs[_0x04fa('0x2d')](_[_0x04fa('0x35')](_0x20ae5e[_0x04fa('0x2b')],_0x1cd7f8[_0x04fa('0x2d')]));if(_0x599061[_0x04fa('0x2a')]){if(_0x599061[_0x04fa('0x2c')]){_0x599061[_0x04fa('0x2c')]=moment(_0x599061[_0x04fa('0x2c')])[_0x04fa('0x36')](0x1,'day');}else{_0x599061[_0x04fa('0x2c')]=moment(_0x599061[_0x04fa('0x2a')])['add'](0x1,_0x04fa('0x37'));}_[_0x04fa('0x38')](_0x3e5d8d[_0x04fa('0x39')],{'createdAt':{'$gte':_0x599061[_0x04fa('0x2a')],'$lte':_0x599061[_0x04fa('0x2c')]}});}if(_0x20ae5e[_0x04fa('0x2b')]['filter']){_0x3e5d8d[_0x04fa('0x39')]=_[_0x04fa('0x38')](_0x3e5d8d[_0x04fa('0x39')],{'$or':_['map'](_0x3e5d8d['attributes'],function(_0x3d2230){var _0x5e0802={};_0x5e0802[_0x3d2230]={'$like':'%'+_0x20ae5e['query']['filter']+'%'};return _0x5e0802;})});}_0x3e5d8d=_[_0x04fa('0x38')]({},_0x3e5d8d,_0x20ae5e['options']);var _0x27ccf8={'where':_0x3e5d8d[_0x04fa('0x39')]};return db[_0x04fa('0x26')][_0x04fa('0x17')](_0x27ccf8)['then'](function(_0x4c9d3e){_0x339f3b[_0x04fa('0x17')]=_0x4c9d3e;if(_0x20ae5e[_0x04fa('0x2b')][_0x04fa('0x3a')]){_0x3e5d8d[_0x04fa('0x3b')]=[{'all':!![]}];}return db[_0x04fa('0x26')][_0x04fa('0x3c')](_0x3e5d8d);})['then'](function(_0x4acd2b){_0x339f3b[_0x04fa('0x3d')]=_0x4acd2b;return _0x339f3b;})[_0x04fa('0x1e')](respondWithFilteredResult(_0x47d3d7,_0x3e5d8d))[_0x04fa('0x3e')](handleError(_0x47d3d7,null));};exports['show']=function(_0x8d12fb,_0x45559b){var _0x5a5772={'raw':![],'where':{'id':_0x8d12fb['params']['id']}},_0x589b0c={};_0x589b0c[_0x04fa('0x28')]=_[_0x04fa('0x29')](db['IntegrationReport']['rawAttributes']);_0x589b0c[_0x04fa('0x2b')]=_[_0x04fa('0x29')](_0x8d12fb['query']);_0x589b0c[_0x04fa('0x2d')]=_['intersection'](_0x589b0c[_0x04fa('0x28')],_0x589b0c['query']);_0x5a5772['attributes']=_[_0x04fa('0x2e')](_0x589b0c[_0x04fa('0x28')],qs[_0x04fa('0x2f')](_0x8d12fb[_0x04fa('0x2b')]['fields']));_0x5a5772[_0x04fa('0x30')]=_0x5a5772[_0x04fa('0x30')][_0x04fa('0x3f')]?_0x5a5772[_0x04fa('0x30')]:_0x589b0c[_0x04fa('0x28')];if(_0x8d12fb['query']['includeAll']){_0x5a5772[_0x04fa('0x3b')]=[{'all':!![]}];}_0x5a5772=_['merge']({},_0x5a5772,_0x8d12fb[_0x04fa('0x40')]);return db[_0x04fa('0x26')]['find'](_0x5a5772)[_0x04fa('0x1e')](handleEntityNotFound(_0x45559b,null))[_0x04fa('0x1e')](respondWithResult(_0x45559b,null))[_0x04fa('0x3e')](handleError(_0x45559b,null));};exports[_0x04fa('0x41')]=function(_0x2ed44e,_0x598ba7){return db[_0x04fa('0x26')]['create'](_0x2ed44e[_0x04fa('0x42')],{})[_0x04fa('0x1e')](respondWithResult(_0x598ba7,0xc9))[_0x04fa('0x3e')](handleError(_0x598ba7,null));};exports[_0x04fa('0x1d')]=function(_0x42395b,_0x3c534e){if(_0x42395b[_0x04fa('0x42')]['id']){delete _0x42395b[_0x04fa('0x42')]['id'];}return db[_0x04fa('0x26')]['find']({'where':{'id':_0x42395b[_0x04fa('0x43')]['id']}})[_0x04fa('0x1e')](handleEntityNotFound(_0x3c534e,null))[_0x04fa('0x1e')](saveUpdates(_0x42395b[_0x04fa('0x42')],null))[_0x04fa('0x1e')](respondWithResult(_0x3c534e,null))[_0x04fa('0x3e')](handleError(_0x3c534e,null));};exports[_0x04fa('0x1f')]=function(_0x22f62c,_0x4904fd){return db[_0x04fa('0x26')][_0x04fa('0x44')]({'where':{'id':_0x22f62c[_0x04fa('0x43')]['id']}})[_0x04fa('0x1e')](handleEntityNotFound(_0x4904fd,null))[_0x04fa('0x1e')](removeEntity(_0x4904fd,null))[_0x04fa('0x3e')](handleError(_0x4904fd,null));};exports[_0x04fa('0x45')]=function(_0x240340,_0x5a52ee){return db[_0x04fa('0x26')][_0x04fa('0x45')]()['then'](respondWithResult(_0x5a52ee,null))['catch'](handleError(_0x5a52ee,null));}; \ No newline at end of file +var _0xfcc3=['to-csv','ejs','squel','jsforce','desk.js','querystring','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','destroy','error','stack','name','send','index','IntegrationReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','merge','filter','map','options','then','include','rows','catch','show','params','find','create','body','update','describe','fast-json-patch','mustache','util','path','sox'];(function(_0x470543,_0x1c2a26){var _0x345a87=function(_0x30282a){while(--_0x30282a){_0x470543['push'](_0x470543['shift']());}};_0x345a87(++_0x1c2a26);}(_0xfcc3,0x10b));var _0x3fcc=function(_0x3e9c28,_0x465a7d){_0x3e9c28=_0x3e9c28-0x0;var _0x3db36f=_0xfcc3[_0x3e9c28];return _0x3db36f;};'use strict';var jsonpatch=require(_0x3fcc('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3fcc('0x1'));var util=require(_0x3fcc('0x2'));var path=require(_0x3fcc('0x3'));var sox=require(_0x3fcc('0x4'));var csv=require(_0x3fcc('0x5'));var ejs=require(_0x3fcc('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3fcc('0x7'));var crypto=require('crypto');var jsforce=require(_0x3fcc('0x8'));var deskjs=require(_0x3fcc('0x9'));var toCsv=require(_0x3fcc('0x5'));var querystring=require(_0x3fcc('0xa'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0x3fcc('0xb'))(_0x3fcc('0xc'));var utils=require(_0x3fcc('0xd'));var config=require(_0x3fcc('0xe'));var db=require(_0x3fcc('0xf'))['db'];function respondWithStatusCode(_0x56cf51,_0x2c6c31){_0x2c6c31=_0x2c6c31||0xcc;return function(_0x1729ba){if(_0x1729ba){return _0x56cf51[_0x3fcc('0x10')](_0x2c6c31);}return _0x56cf51[_0x3fcc('0x11')](_0x2c6c31)[_0x3fcc('0x12')]();};}function respondWithResult(_0x521693,_0x54bdec){_0x54bdec=_0x54bdec||0xc8;return function(_0x52b154){if(_0x52b154){return _0x521693[_0x3fcc('0x11')](_0x54bdec)['json'](_0x52b154);}};}function respondWithFilteredResult(_0x9c035f,_0x164af5){return function(_0x5e859b){if(_0x5e859b){var _0x5777a3=_0x5e859b[_0x3fcc('0x13')],_0x1d5efd=_0x164af5[_0x3fcc('0x14')],_0x4ba649=_0x164af5[_0x3fcc('0x14')]+_0x164af5['limit'],_0x1df3ff;if(_0x4ba649>=_0x5777a3){_0x4ba649=_0x5777a3;_0x1df3ff=0xc8;}else{_0x1df3ff=0xce;}_0x9c035f[_0x3fcc('0x11')](_0x1df3ff);return _0x9c035f['set'](_0x3fcc('0x15'),_0x1d5efd+'-'+_0x4ba649+'/'+_0x5777a3)[_0x3fcc('0x16')](_0x5e859b);}return null;};}function patchUpdates(_0x381c98){return function(_0x3e17de){try{jsonpatch[_0x3fcc('0x17')](_0x3e17de,_0x381c98,!![]);}catch(_0x54d8f2){return BPromise[_0x3fcc('0x18')](_0x54d8f2);}return _0x3e17de[_0x3fcc('0x19')]();};}function saveUpdates(_0x5c8d7d,_0x232583){return function(_0x508b89){if(_0x508b89){return _0x508b89['update'](_0x5c8d7d)['then'](function(_0x5a872f){return _0x5a872f;});}return null;};}function removeEntity(_0x3c92e0,_0x3009b6){return function(_0xbdfac5){if(_0xbdfac5){return _0xbdfac5[_0x3fcc('0x1a')]()['then'](function(){_0x3c92e0[_0x3fcc('0x11')](0xcc)[_0x3fcc('0x12')]();});}};}function handleEntityNotFound(_0x2b551f,_0x2f2a13){return function(_0x52740f){if(!_0x52740f){_0x2b551f['sendStatus'](0x194);}return _0x52740f;};}function handleError(_0x561566,_0x4ec450){_0x4ec450=_0x4ec450||0x1f4;return function(_0x530a52){logger[_0x3fcc('0x1b')](_0x530a52[_0x3fcc('0x1c')]);if(_0x530a52[_0x3fcc('0x1d')]){delete _0x530a52[_0x3fcc('0x1d')];}_0x561566[_0x3fcc('0x11')](_0x4ec450)[_0x3fcc('0x1e')](_0x530a52);};}exports[_0x3fcc('0x1f')]=function(_0x3d816d,_0x5062a8){var _0x593dfa={},_0x531f46={},_0x2a20dc={'count':0x0,'rows':[]};var _0x3f232c=db[_0x3fcc('0x20')][_0x3fcc('0x21')];_0x531f46[_0x3fcc('0x22')]=_[_0x3fcc('0x23')](_0x3f232c);var _0x5305e0={'dateStart':_0x3d816d[_0x3fcc('0x24')][_0x3fcc('0x25')],'dateEnd':_0x3d816d[_0x3fcc('0x24')][_0x3fcc('0x26')]};delete _0x3d816d[_0x3fcc('0x24')][_0x3fcc('0x25')];delete _0x3d816d['query']['dateEnd'];_0x531f46[_0x3fcc('0x24')]=_[_0x3fcc('0x23')](_0x3d816d[_0x3fcc('0x24')]);_0x531f46[_0x3fcc('0x27')]=_[_0x3fcc('0x28')](_0x531f46[_0x3fcc('0x22')],_0x531f46[_0x3fcc('0x24')]);_0x593dfa[_0x3fcc('0x29')]=_['intersection'](_0x531f46['model'],qs['fields'](_0x3d816d[_0x3fcc('0x24')][_0x3fcc('0x2a')]));_0x593dfa[_0x3fcc('0x29')]=_0x593dfa[_0x3fcc('0x29')][_0x3fcc('0x2b')]?_0x593dfa[_0x3fcc('0x29')]:_0x531f46[_0x3fcc('0x22')];if(!_0x3d816d[_0x3fcc('0x24')][_0x3fcc('0x2c')](_0x3fcc('0x2d'))){_0x593dfa[_0x3fcc('0x2e')]=qs[_0x3fcc('0x2e')](_0x3d816d['query'][_0x3fcc('0x2e')]);_0x593dfa[_0x3fcc('0x14')]=qs[_0x3fcc('0x14')](_0x3d816d[_0x3fcc('0x24')][_0x3fcc('0x14')]);}_0x593dfa[_0x3fcc('0x2f')]=qs[_0x3fcc('0x30')](_0x3d816d['query'][_0x3fcc('0x30')]);_0x593dfa[_0x3fcc('0x31')]=qs[_0x3fcc('0x27')](_[_0x3fcc('0x32')](_0x3d816d['query'],_0x531f46[_0x3fcc('0x27')]));if(_0x5305e0[_0x3fcc('0x25')]){if(_0x5305e0[_0x3fcc('0x26')]){_0x5305e0['dateEnd']=moment(_0x5305e0['dateEnd'])[_0x3fcc('0x33')](0x1,_0x3fcc('0x34'));}else{_0x5305e0[_0x3fcc('0x26')]=moment(_0x5305e0[_0x3fcc('0x25')])['add'](0x1,_0x3fcc('0x34'));}_[_0x3fcc('0x35')](_0x593dfa[_0x3fcc('0x31')],{'createdAt':{'$gte':_0x5305e0[_0x3fcc('0x25')],'$lte':_0x5305e0[_0x3fcc('0x26')]}});}if(_0x3d816d[_0x3fcc('0x24')][_0x3fcc('0x36')]){_0x593dfa[_0x3fcc('0x31')]=_[_0x3fcc('0x35')](_0x593dfa[_0x3fcc('0x31')],{'$or':_[_0x3fcc('0x37')](_0x593dfa[_0x3fcc('0x29')],function(_0x135297){var _0x270613={};_0x270613[_0x135297]={'$like':'%'+_0x3d816d[_0x3fcc('0x24')][_0x3fcc('0x36')]+'%'};return _0x270613;})});}_0x593dfa=_[_0x3fcc('0x35')]({},_0x593dfa,_0x3d816d[_0x3fcc('0x38')]);var _0x1fb29d={'where':_0x593dfa[_0x3fcc('0x31')]};return db[_0x3fcc('0x20')]['count'](_0x1fb29d)[_0x3fcc('0x39')](function(_0x1ea2d7){_0x2a20dc[_0x3fcc('0x13')]=_0x1ea2d7;if(_0x3d816d[_0x3fcc('0x24')]['includeAll']){_0x593dfa[_0x3fcc('0x3a')]=[{'all':!![]}];}return db[_0x3fcc('0x20')]['findAll'](_0x593dfa);})['then'](function(_0x1e640e){_0x2a20dc[_0x3fcc('0x3b')]=_0x1e640e;return _0x2a20dc;})[_0x3fcc('0x39')](respondWithFilteredResult(_0x5062a8,_0x593dfa))[_0x3fcc('0x3c')](handleError(_0x5062a8,null));};exports[_0x3fcc('0x3d')]=function(_0x410044,_0x550b39){var _0x528d7d={'raw':![],'where':{'id':_0x410044[_0x3fcc('0x3e')]['id']}},_0xbedd0b={};_0xbedd0b[_0x3fcc('0x22')]=_[_0x3fcc('0x23')](db[_0x3fcc('0x20')][_0x3fcc('0x21')]);_0xbedd0b[_0x3fcc('0x24')]=_[_0x3fcc('0x23')](_0x410044[_0x3fcc('0x24')]);_0xbedd0b[_0x3fcc('0x27')]=_[_0x3fcc('0x28')](_0xbedd0b['model'],_0xbedd0b['query']);_0x528d7d[_0x3fcc('0x29')]=_[_0x3fcc('0x28')](_0xbedd0b[_0x3fcc('0x22')],qs['fields'](_0x410044[_0x3fcc('0x24')][_0x3fcc('0x2a')]));_0x528d7d[_0x3fcc('0x29')]=_0x528d7d['attributes'][_0x3fcc('0x2b')]?_0x528d7d[_0x3fcc('0x29')]:_0xbedd0b['model'];if(_0x410044['query']['includeAll']){_0x528d7d[_0x3fcc('0x3a')]=[{'all':!![]}];}_0x528d7d=_[_0x3fcc('0x35')]({},_0x528d7d,_0x410044['options']);return db[_0x3fcc('0x20')][_0x3fcc('0x3f')](_0x528d7d)['then'](handleEntityNotFound(_0x550b39,null))[_0x3fcc('0x39')](respondWithResult(_0x550b39,null))[_0x3fcc('0x3c')](handleError(_0x550b39,null));};exports[_0x3fcc('0x40')]=function(_0x3f76f0,_0xe860f8){return db['IntegrationReport'][_0x3fcc('0x40')](_0x3f76f0[_0x3fcc('0x41')],{})[_0x3fcc('0x39')](respondWithResult(_0xe860f8,0xc9))['catch'](handleError(_0xe860f8,null));};exports[_0x3fcc('0x42')]=function(_0x3a45b2,_0x3d6522){if(_0x3a45b2[_0x3fcc('0x41')]['id']){delete _0x3a45b2['body']['id'];}return db['IntegrationReport'][_0x3fcc('0x3f')]({'where':{'id':_0x3a45b2[_0x3fcc('0x3e')]['id']}})[_0x3fcc('0x39')](handleEntityNotFound(_0x3d6522,null))[_0x3fcc('0x39')](saveUpdates(_0x3a45b2[_0x3fcc('0x41')],null))['then'](respondWithResult(_0x3d6522,null))[_0x3fcc('0x3c')](handleError(_0x3d6522,null));};exports[_0x3fcc('0x1a')]=function(_0x92198,_0x3db890){return db[_0x3fcc('0x20')][_0x3fcc('0x3f')]({'where':{'id':_0x92198[_0x3fcc('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3db890,null))[_0x3fcc('0x39')](removeEntity(_0x3db890,null))[_0x3fcc('0x3c')](handleError(_0x3db890,null));};exports[_0x3fcc('0x43')]=function(_0xc5634a,_0x43754e){return db[_0x3fcc('0x20')][_0x3fcc('0x43')]()[_0x3fcc('0x39')](respondWithResult(_0x43754e,null))[_0x3fcc('0x3c')](handleError(_0x43754e,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index f7062b3..9ba9aa8 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 _0x6050=['report_integration','lodash','util','../../config/logger','api','moment','bluebird','./integrationReport.attributes','exports'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0x6050,0x196));var _0x0605=function(_0x2dba76,_0x116116){_0x2dba76=_0x2dba76-0x0;var _0x3a5419=_0x6050[_0x2dba76];return _0x3a5419;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var logger=require(_0x0605('0x2'))(_0x0605('0x3'));var moment=require(_0x0605('0x4'));var BPromise=require(_0x0605('0x5'));var rp=require('request-promise');var attributes=require(_0x0605('0x6'));module[_0x0605('0x7')]=function(_0x43403d,_0x5797b0){return _0x43403d['define']('IntegrationReport',attributes,{'tableName':_0x0605('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['./integrationReport.attributes','IntegrationReport','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x896a11,_0x4e216f){var _0xa47862=function(_0x552ec3){while(--_0x552ec3){_0x896a11['push'](_0x896a11['shift']());}};_0xa47862(++_0x4e216f);}(_0x53ec,0x192));var _0xc53e=function(_0x57f345,_0x316929){_0x57f345=_0x57f345-0x0;var _0x255e43=_0x53ec[_0x57f345];return _0x255e43;};'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 diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 54e9338..724be68 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 _0x0dac=['bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0dac,0x151));var _0xc0da=function(_0x3f13d8,_0x4bb7b4){_0x3f13d8=_0x3f13d8-0x0;var _0x343c39=_0x0dac[_0x3f13d8];return _0x343c39;};'use strict';var _=require(_0xc0da('0x0'));var util=require(_0xc0da('0x1'));var moment=require(_0xc0da('0x2'));var BPromise=require(_0xc0da('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xc0da('0x4'));var logger=require(_0xc0da('0x5'))(_0xc0da('0x6'));var config=require(_0xc0da('0x7'));var jayson=require(_0xc0da('0x8'));var client=jayson[_0xc0da('0x9')][_0xc0da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xebf088,_0x4b1845,_0x3cb192){return new BPromise(function(_0x1ee5e9,_0x281b19){return client[_0xc0da('0xb')](_0xebf088,_0x3cb192)[_0xc0da('0xc')](function(_0x110a6c){logger['info'](_0xc0da('0xd'),_0x4b1845,_0xc0da('0xe'));logger['debug'](_0xc0da('0xf'),_0x4b1845,_0xc0da('0xe'),JSON['stringify'](_0x110a6c));if(_0x110a6c[_0xc0da('0x10')]){if(_0x110a6c[_0xc0da('0x10')][_0xc0da('0x11')]===0x1f4){logger[_0xc0da('0x10')](_0xc0da('0xd'),_0x4b1845,_0x110a6c[_0xc0da('0x10')][_0xc0da('0x12')]);return _0x281b19(_0x110a6c[_0xc0da('0x10')]['message']);}logger[_0xc0da('0x10')]('IntegrationReport,\x20%s,\x20%s',_0x4b1845,_0x110a6c['error'][_0xc0da('0x12')]);return _0x1ee5e9(_0x110a6c['error'][_0xc0da('0x12')]);}else{logger['info'](_0xc0da('0xd'),_0x4b1845,'request\x20sent');_0x1ee5e9(_0x110a6c[_0xc0da('0x13')][_0xc0da('0x12')]);}})['catch'](function(_0x52752b){logger['error'](_0xc0da('0xd'),_0x4b1845,_0x52752b);_0x281b19(_0x52752b);});});} \ No newline at end of file +var _0x489e=['../../mysqldb','../../config/utils','jayson/promise','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x489e,0x74));var _0xe489=function(_0x124fd0,_0x4e1d37){_0x124fd0=_0x124fd0-0x0;var _0x107f9c=_0x489e[_0x124fd0];return _0x107f9c;};'use strict';var _=require('lodash');var util=require(_0xe489('0x0'));var moment=require(_0xe489('0x1'));var BPromise=require(_0xe489('0x2'));var rs=require(_0xe489('0x3'));var fs=require('fs');var db=require(_0xe489('0x4'))['db'];var utils=require(_0xe489('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe489('0x6'));var client=jayson['client'][_0xe489('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xb5d925,_0x56e473,_0x56a8c6){return new BPromise(function(_0x1c584f,_0x434b67){return client[_0xe489('0x8')](_0xb5d925,_0x56a8c6)[_0xe489('0x9')](function(_0x538216){logger[_0xe489('0xa')](_0xe489('0xb'),_0x56e473,_0xe489('0xc'));logger[_0xe489('0xd')](_0xe489('0xe'),_0x56e473,_0xe489('0xc'),JSON[_0xe489('0xf')](_0x538216));if(_0x538216[_0xe489('0x10')]){if(_0x538216[_0xe489('0x10')][_0xe489('0x11')]===0x1f4){logger[_0xe489('0x10')](_0xe489('0xb'),_0x56e473,_0x538216['error']['message']);return _0x434b67(_0x538216[_0xe489('0x10')][_0xe489('0x12')]);}logger['error'](_0xe489('0xb'),_0x56e473,_0x538216[_0xe489('0x10')][_0xe489('0x12')]);return _0x1c584f(_0x538216[_0xe489('0x10')][_0xe489('0x12')]);}else{logger['info'](_0xe489('0xb'),_0x56e473,'request\x20sent');_0x1c584f(_0x538216[_0xe489('0x13')][_0xe489('0x12')]);}})['catch'](function(_0x211f35){logger[_0xe489('0x10')](_0xe489('0xb'),_0x56e473,_0x211f35);_0x434b67(_0x211f35);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 839a996..8ae8626 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 _0xdf32=['create','post','/:id/sub_intervals','/:id/sub_intervals/create_many','destroy','util','path','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getIntervals'];(function(_0x292cfd,_0x2fab3b){var _0x8fb994=function(_0x31013c){while(--_0x31013c){_0x292cfd['push'](_0x292cfd['shift']());}};_0x8fb994(++_0x2fab3b);}(_0xdf32,0x105));var _0x2df3=function(_0x171fd3,_0x448be0){_0x171fd3=_0x171fd3-0x0;var _0x487d2d=_0xdf32[_0x171fd3];return _0x487d2d;};'use strict';var multer=require('multer');var util=require(_0x2df3('0x0'));var path=require(_0x2df3('0x1'));var express=require(_0x2df3('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2df3('0x3'));var config=require(_0x2df3('0x4'));var controller=require('./interval.controller');router[_0x2df3('0x5')]('/',auth[_0x2df3('0x6')](),controller[_0x2df3('0x7')]);router[_0x2df3('0x5')](_0x2df3('0x8'),auth['isAuthenticated'](),controller[_0x2df3('0x9')]);router['get']('/:id/sub_intervals',auth[_0x2df3('0x6')](),controller[_0x2df3('0xa')]);router['post']('/',auth[_0x2df3('0x6')](),controller[_0x2df3('0xb')]);router[_0x2df3('0xc')](_0x2df3('0xd'),auth['isAuthenticated'](),controller['addInterval']);router['post'](_0x2df3('0xe'),auth[_0x2df3('0x6')](),controller['addIntervals']);router['put'](_0x2df3('0x8'),auth[_0x2df3('0x6')](),controller['update']);router['delete'](_0x2df3('0x8'),auth[_0x2df3('0x6')](),controller[_0x2df3('0xf')]);module['exports']=router; \ No newline at end of file +var _0x745f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','index','show','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','destroy','exports','util','Router'];(function(_0x4571f3,_0x5b28a3){var _0x11a343=function(_0x459fb5){while(--_0x459fb5){_0x4571f3['push'](_0x4571f3['shift']());}};_0x11a343(++_0x5b28a3);}(_0x745f,0x167));var _0xf745=function(_0xe51596,_0x314d5b){_0xe51596=_0xe51596-0x0;var _0x22c705=_0x745f[_0xe51596];return _0x22c705;};'use strict';var multer=require('multer');var util=require(_0xf745('0x0'));var path=require('path');var express=require('express');var router=express[_0xf745('0x1')]();var auth=require(_0xf745('0x2'));var interaction=require(_0xf745('0x3'));var config=require(_0xf745('0x4'));var controller=require(_0xf745('0x5'));router['get']('/',auth[_0xf745('0x6')](),controller[_0xf745('0x7')]);router['get']('/:id',auth[_0xf745('0x6')](),controller[_0xf745('0x8')]);router['get'](_0xf745('0x9'),auth[_0xf745('0x6')](),controller[_0xf745('0xa')]);router['post']('/',auth[_0xf745('0x6')](),controller['create']);router[_0xf745('0xb')](_0xf745('0x9'),auth[_0xf745('0x6')](),controller[_0xf745('0xc')]);router['post'](_0xf745('0xd'),auth[_0xf745('0x6')](),controller[_0xf745('0xe')]);router[_0xf745('0xf')](_0xf745('0x10'),auth[_0xf745('0x6')](),controller['update']);router['delete'](_0xf745('0x10'),auth[_0xf745('0x6')](),controller[_0xf745('0x11')]);module[_0xf745('0x12')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index b59d668..4191d88 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 _0xad17=['STRING','sequelize','exports'];(function(_0x5102cd,_0x53e2bd){var _0x4b4ac4=function(_0x5c18cd){while(--_0x5c18cd){_0x5102cd['push'](_0x5102cd['shift']());}};_0x4b4ac4(++_0x53e2bd);}(_0xad17,0xb8));var _0x7ad1=function(_0x45f5df,_0x3b4325){_0x45f5df=_0x45f5df-0x0;var _0x81465d=_0xad17[_0x45f5df];return _0x81465d;};'use strict';var Sequelize=require(_0x7ad1('0x0'));module[_0x7ad1('0x1')]={'name':{'type':Sequelize[_0x7ad1('0x2')]},'description':{'type':Sequelize[_0x7ad1('0x2')]},'interval':{'type':Sequelize[_0x7ad1('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x0a05=['exports','STRING','sequelize'];(function(_0x2eed3b,_0x176b7e){var _0x4d8e7c=function(_0x4d287c){while(--_0x4d287c){_0x2eed3b['push'](_0x2eed3b['shift']());}};_0x4d8e7c(++_0x176b7e);}(_0x0a05,0x9e));var _0x50a0=function(_0x130705,_0x2d266b){_0x130705=_0x130705-0x0;var _0x1fa991=_0x0a05[_0x130705];return _0x1fa991;};'use strict';var Sequelize=require(_0x50a0('0x0'));module[_0x50a0('0x1')]={'name':{'type':Sequelize[_0x50a0('0x2')]},'description':{'type':Sequelize[_0x50a0('0x2')]},'interval':{'type':Sequelize[_0x50a0('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 83d213c..a8e3e21 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 _0x5147=['util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','offset','limit','set','Content-Range','save','then','stack','name','send','index','Interval','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','add','day','merge','filter','map','count','includeAll','include','rows','catch','params','options','find','create','body','update','destroy','addInterval','IntervalId','getIntervals','findOne','sequelize','transaction','bulkCreate','findAll','fast-json-patch','mustache'];(function(_0x3e50ec,_0x1b83e7){var _0x43743e=function(_0x5dc51f){while(--_0x5dc51f){_0x3e50ec['push'](_0x3e50ec['shift']());}};_0x43743e(++_0x1b83e7);}(_0x5147,0x1b4));var _0x7514=function(_0x2b2839,_0x4f46d3){_0x2b2839=_0x2b2839-0x0;var _0x292664=_0x5147[_0x2b2839];return _0x292664;};'use strict';var jsonpatch=require(_0x7514('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7514('0x1'));var util=require(_0x7514('0x2'));var path=require('path');var sox=require('sox');var csv=require(_0x7514('0x3'));var ejs=require(_0x7514('0x4'));var fs=require('fs');var _=require(_0x7514('0x5'));var squel=require(_0x7514('0x6'));var crypto=require(_0x7514('0x7'));var jsforce=require(_0x7514('0x8'));var deskjs=require(_0x7514('0x9'));var toCsv=require(_0x7514('0x3'));var querystring=require(_0x7514('0xa'));var Papa=require(_0x7514('0xb'));var qs=require(_0x7514('0xc'));var logger=require(_0x7514('0xd'))(_0x7514('0xe'));var utils=require('../../config/utils');var config=require(_0x7514('0xf'));var db=require(_0x7514('0x10'))['db'];var extensions=require(_0x7514('0x11'));function respondWithStatusCode(_0x1e594d,_0x340f9e){_0x340f9e=_0x340f9e||0xcc;return function(_0x1cadf3){if(_0x1cadf3){return _0x1e594d[_0x7514('0x12')](_0x340f9e);}return _0x1e594d[_0x7514('0x13')](_0x340f9e)[_0x7514('0x14')]();};}function respondWithResult(_0xbb3fa7,_0xa83309){_0xa83309=_0xa83309||0xc8;return function(_0x5c7254){if(_0x5c7254){return _0xbb3fa7['status'](_0xa83309)['json'](_0x5c7254);}};}function respondWithFilteredResult(_0x4ad5cd,_0x3f4315){return function(_0x10feb8){if(_0x10feb8){var _0x4ef2bd=_0x10feb8['count'],_0x18483b=_0x3f4315[_0x7514('0x15')],_0x212b5c=_0x3f4315[_0x7514('0x15')]+_0x3f4315[_0x7514('0x16')],_0x475179;if(_0x212b5c>=_0x4ef2bd){_0x212b5c=_0x4ef2bd;_0x475179=0xc8;}else{_0x475179=0xce;}_0x4ad5cd['status'](_0x475179);return _0x4ad5cd[_0x7514('0x17')](_0x7514('0x18'),_0x18483b+'-'+_0x212b5c+'/'+_0x4ef2bd)['json'](_0x10feb8);}return null;};}function patchUpdates(_0x45fa73){return function(_0x63608a){try{jsonpatch['apply'](_0x63608a,_0x45fa73,!![]);}catch(_0x3f5cfa){return BPromise['reject'](_0x3f5cfa);}return _0x63608a[_0x7514('0x19')]();};}function saveUpdates(_0x17c260,_0x185bb2){return function(_0x344135){if(_0x344135){return _0x344135['update'](_0x17c260)[_0x7514('0x1a')](function(_0x2d71ec){return _0x2d71ec;});}return null;};}function removeEntity(_0x657904,_0x5b72f9){return function(_0x5bbca3){if(_0x5bbca3){return _0x5bbca3['destroy']()['then'](function(){_0x657904[_0x7514('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17956c,_0x4b3bb7){return function(_0x566b3e){if(!_0x566b3e){_0x17956c[_0x7514('0x12')](0x194);}return _0x566b3e;};}function handleError(_0x4252b0,_0x1a1c83){_0x1a1c83=_0x1a1c83||0x1f4;return function(_0x4627df){logger['error'](_0x4627df[_0x7514('0x1b')]);if(_0x4627df[_0x7514('0x1c')]){delete _0x4627df['name'];}_0x4252b0[_0x7514('0x13')](_0x1a1c83)[_0x7514('0x1d')](_0x4627df);};}exports[_0x7514('0x1e')]=function(_0x222a71,_0x79523a){var _0x493ee3={},_0x29ca96={},_0x5a4d24={'count':0x0,'rows':[]};var _0x42b049=db[_0x7514('0x1f')][_0x7514('0x20')];_0x29ca96['model']=_[_0x7514('0x21')](_0x42b049);var _0x2fc193={'dateStart':_0x222a71[_0x7514('0x22')][_0x7514('0x23')],'dateEnd':_0x222a71[_0x7514('0x22')][_0x7514('0x24')]};delete _0x222a71[_0x7514('0x22')]['dateStart'];delete _0x222a71['query'][_0x7514('0x24')];_0x29ca96[_0x7514('0x22')]=_[_0x7514('0x21')](_0x222a71[_0x7514('0x22')]);_0x29ca96[_0x7514('0x25')]=_[_0x7514('0x26')](_0x29ca96[_0x7514('0x27')],_0x29ca96['query']);_0x493ee3[_0x7514('0x28')]=_[_0x7514('0x26')](_0x29ca96['model'],qs[_0x7514('0x29')](_0x222a71['query'][_0x7514('0x29')]));_0x493ee3[_0x7514('0x28')]=_0x493ee3[_0x7514('0x28')][_0x7514('0x2a')]?_0x493ee3['attributes']:_0x29ca96[_0x7514('0x27')];if(!_0x222a71[_0x7514('0x22')][_0x7514('0x2b')](_0x7514('0x2c'))){_0x493ee3[_0x7514('0x16')]=qs[_0x7514('0x16')](_0x222a71[_0x7514('0x22')][_0x7514('0x16')]);_0x493ee3[_0x7514('0x15')]=qs[_0x7514('0x15')](_0x222a71[_0x7514('0x22')][_0x7514('0x15')]);}_0x493ee3[_0x7514('0x2d')]=qs[_0x7514('0x2e')](_0x222a71[_0x7514('0x22')][_0x7514('0x2e')]);_0x493ee3[_0x7514('0x2f')]=qs[_0x7514('0x25')](_['pick'](_0x222a71[_0x7514('0x22')],_0x29ca96[_0x7514('0x25')]));if(_0x2fc193[_0x7514('0x23')]){if(_0x2fc193[_0x7514('0x24')]){_0x2fc193['dateEnd']=moment(_0x2fc193['dateEnd'])['add'](0x1,'day');}else{_0x2fc193['dateEnd']=moment(_0x2fc193[_0x7514('0x23')])[_0x7514('0x30')](0x1,_0x7514('0x31'));}_[_0x7514('0x32')](_0x493ee3[_0x7514('0x2f')],{'createdAt':{'$gte':_0x2fc193[_0x7514('0x23')],'$lte':_0x2fc193[_0x7514('0x24')]}});}if(_0x222a71['query'][_0x7514('0x33')]){_0x493ee3[_0x7514('0x2f')]=_[_0x7514('0x32')](_0x493ee3[_0x7514('0x2f')],{'$or':_[_0x7514('0x34')](_0x493ee3['attributes'],function(_0x599971){var _0x58c449={};_0x58c449[_0x599971]={'$like':'%'+_0x222a71[_0x7514('0x22')][_0x7514('0x33')]+'%'};return _0x58c449;})});}_0x493ee3=_[_0x7514('0x32')]({},_0x493ee3,_0x222a71['options']);var _0x368849={'where':_0x493ee3['where']};return db['Interval'][_0x7514('0x35')](_0x368849)['then'](function(_0x49529a){_0x5a4d24['count']=_0x49529a;if(_0x222a71[_0x7514('0x22')][_0x7514('0x36')]){_0x493ee3[_0x7514('0x37')]=[{'all':!![]}];}return db['Interval']['findAll'](_0x493ee3);})[_0x7514('0x1a')](function(_0x25acf9){_0x5a4d24[_0x7514('0x38')]=_0x25acf9;return _0x5a4d24;})[_0x7514('0x1a')](respondWithFilteredResult(_0x79523a,_0x493ee3))[_0x7514('0x39')](handleError(_0x79523a,null));};exports['show']=function(_0x4099ca,_0x56b6e6){var _0x5d7315={'raw':!![],'where':{'id':_0x4099ca[_0x7514('0x3a')]['id']}},_0x5be62a={};_0x5be62a['model']=_[_0x7514('0x21')](db[_0x7514('0x1f')][_0x7514('0x20')]);_0x5be62a[_0x7514('0x22')]=_[_0x7514('0x21')](_0x4099ca[_0x7514('0x22')]);_0x5be62a['filters']=_['intersection'](_0x5be62a[_0x7514('0x27')],_0x5be62a[_0x7514('0x22')]);_0x5d7315[_0x7514('0x28')]=_[_0x7514('0x26')](_0x5be62a[_0x7514('0x27')],qs[_0x7514('0x29')](_0x4099ca[_0x7514('0x22')][_0x7514('0x29')]));_0x5d7315[_0x7514('0x28')]=_0x5d7315[_0x7514('0x28')][_0x7514('0x2a')]?_0x5d7315[_0x7514('0x28')]:_0x5be62a[_0x7514('0x27')];if(_0x4099ca['query'][_0x7514('0x36')]){_0x5d7315[_0x7514('0x37')]=[{'all':!![]}];}_0x5d7315=_[_0x7514('0x32')]({},_0x5d7315,_0x4099ca[_0x7514('0x3b')]);return db[_0x7514('0x1f')][_0x7514('0x3c')](_0x5d7315)[_0x7514('0x1a')](handleEntityNotFound(_0x56b6e6,null))[_0x7514('0x1a')](respondWithResult(_0x56b6e6,null))[_0x7514('0x39')](handleError(_0x56b6e6,null));};exports[_0x7514('0x3d')]=function(_0x1b8a0e,_0x294748){return db[_0x7514('0x1f')][_0x7514('0x3d')](_0x1b8a0e[_0x7514('0x3e')],{})[_0x7514('0x1a')](respondWithResult(_0x294748,0xc9))[_0x7514('0x39')](handleError(_0x294748,null));};exports[_0x7514('0x3f')]=function(_0x316be3,_0x1fd9e7){if(_0x316be3[_0x7514('0x3e')]['id']){delete _0x316be3[_0x7514('0x3e')]['id'];}return db['Interval'][_0x7514('0x3c')]({'where':{'id':_0x316be3['params']['id']}})[_0x7514('0x1a')](handleEntityNotFound(_0x1fd9e7,null))[_0x7514('0x1a')](saveUpdates(_0x316be3[_0x7514('0x3e')],null))[_0x7514('0x1a')](respondWithResult(_0x1fd9e7,null))[_0x7514('0x39')](handleError(_0x1fd9e7,null));};exports[_0x7514('0x40')]=function(_0x4fb80e,_0x1e1955){return db[_0x7514('0x1f')][_0x7514('0x3c')]({'where':{'id':_0x4fb80e[_0x7514('0x3a')]['id']}})[_0x7514('0x1a')](handleEntityNotFound(_0x1e1955,null))[_0x7514('0x1a')](removeEntity(_0x1e1955,null))[_0x7514('0x39')](handleError(_0x1e1955,null));};exports[_0x7514('0x41')]=function(_0xe8cdc,_0x36c21b,_0x1d36a6){if(_0xe8cdc[_0x7514('0x3e')]['id']){delete _0xe8cdc[_0x7514('0x3e')]['id'];}return db['Interval']['find']({'where':{'id':_0xe8cdc[_0x7514('0x3a')]['id']}})[_0x7514('0x1a')](handleEntityNotFound(_0x36c21b,null))[_0x7514('0x1a')](function(_0x597918){if(_0x597918){_0xe8cdc[_0x7514('0x3e')][_0x7514('0x42')]=_0x597918['id'];return db[_0x7514('0x1f')]['create'](_0xe8cdc[_0x7514('0x3e')]);}})['then'](respondWithResult(_0x36c21b,null))['catch'](handleError(_0x36c21b,null));};exports[_0x7514('0x43')]=function(_0x456600,_0x3a0016,_0xbc583a){var _0x3d8b99={};var _0x5a44ab={};var _0x12bc48;var _0x597b35;return db[_0x7514('0x1f')][_0x7514('0x44')]({'where':{'id':_0x456600[_0x7514('0x3a')]['id']}})[_0x7514('0x1a')](handleEntityNotFound(_0x3a0016,null))['then'](function(_0x4d9139){if(_0x4d9139){_0x12bc48=_0x4d9139;_0x5a44ab[_0x7514('0x27')]=_[_0x7514('0x21')](db[_0x7514('0x1f')]['rawAttributes']);_0x5a44ab['query']=_[_0x7514('0x21')](_0x456600[_0x7514('0x22')]);_0x5a44ab[_0x7514('0x25')]=_[_0x7514('0x26')](_0x5a44ab[_0x7514('0x27')],_0x5a44ab[_0x7514('0x22')]);_0x3d8b99[_0x7514('0x28')]=_[_0x7514('0x26')](_0x5a44ab[_0x7514('0x27')],qs['fields'](_0x456600['query'][_0x7514('0x29')]));_0x3d8b99[_0x7514('0x28')]=_0x3d8b99[_0x7514('0x28')][_0x7514('0x2a')]?_0x3d8b99['attributes']:_0x5a44ab[_0x7514('0x27')];_0x3d8b99[_0x7514('0x2d')]=qs[_0x7514('0x2e')](_0x456600[_0x7514('0x22')][_0x7514('0x2e')]);_0x3d8b99[_0x7514('0x2f')]=qs['filters'](_['pick'](_0x456600['query'],_0x5a44ab[_0x7514('0x25')]));if(_0x456600[_0x7514('0x22')][_0x7514('0x33')]){_0x3d8b99[_0x7514('0x2f')]=_['merge'](_0x3d8b99[_0x7514('0x2f')],{'$or':_[_0x7514('0x34')](_0x3d8b99[_0x7514('0x28')],function(_0x134a67){var _0xc7fe9a={};_0xc7fe9a[_0x134a67]={'$like':'%'+_0x456600[_0x7514('0x22')]['filter']+'%'};return _0xc7fe9a;})});}_0x3d8b99=_['merge']({},_0x3d8b99,_0x456600['options']);return _0x12bc48['getIntervals'](_0x3d8b99);}})[_0x7514('0x1a')](function(_0x4989e5){if(_0x4989e5){_0x597b35=_0x4989e5[_0x7514('0x2a')];if(!_0x456600[_0x7514('0x22')][_0x7514('0x2b')]('nolimit')){_0x3d8b99['limit']=qs[_0x7514('0x16')](_0x456600['query'][_0x7514('0x16')]);_0x3d8b99['offset']=qs['offset'](_0x456600['query']['offset']);}return _0x12bc48[_0x7514('0x43')](_0x3d8b99);}})[_0x7514('0x1a')](function(_0x33111b){if(_0x33111b){return _0x33111b?{'count':_0x597b35,'rows':_0x33111b}:null;}})[_0x7514('0x1a')](respondWithResult(_0x3a0016,null))['catch'](handleError(_0x3a0016,null));};exports['addIntervals']=function(_0xabe173,_0x5f4fe6,_0x4e58c6){return db['Interval'][_0x7514('0x44')]({'where':{'id':_0xabe173['params']['id']}})['then'](handleEntityNotFound(_0x5f4fe6,null))[_0x7514('0x1a')](function(_0x65105f){if(_0x65105f){return db[_0x7514('0x45')][_0x7514('0x46')](function(_0x561ad9){return db[_0x7514('0x1f')][_0x7514('0x40')]({'where':{'IntervalId':_0xabe173[_0x7514('0x3a')]['id']},'transaction':_0x561ad9})[_0x7514('0x1a')](function(_0x37db04){var _0xfcfcaa=_[_0x7514('0x34')](_0xabe173['body'],function(_0x566bb2){delete _0x566bb2['id'];_0x566bb2[_0x7514('0x42')]=_0xabe173['params']['id'];return _0x566bb2;});return db[_0x7514('0x1f')][_0x7514('0x47')](_0xfcfcaa,{'transaction':_0x561ad9});});})[_0x7514('0x1a')](function(){return db['Interval'][_0x7514('0x48')]({'where':{'IntervalId':_0xabe173['params']['id']}});});}})[_0x7514('0x1a')](respondWithResult(_0x5f4fe6,null))[_0x7514('0x39')](handleError(_0x5f4fe6,null));}; \ No newline at end of file +var _0x36ad=['bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','Interval','rawAttributes','model','keys','dateStart','dateEnd','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','add','day','merge','filter','map','options','count','includeAll','include','rows','catch','show','find','create','body','params','findOne','sort','nolimit','getIntervals','addIntervals','sequelize','transaction','bulkCreate','findAll','fast-json-patch','request-promise','moment'];(function(_0x12c4cd,_0xdebe29){var _0x18a029=function(_0x4c4272){while(--_0x4c4272){_0x12c4cd['push'](_0x12c4cd['shift']());}};_0x18a029(++_0xdebe29);}(_0x36ad,0x95));var _0xd36a=function(_0x38a1c2,_0x5d7081){_0x38a1c2=_0x38a1c2-0x0;var _0x22a2ce=_0x36ad[_0x38a1c2];return _0x22a2ce;};'use strict';var jsonpatch=require(_0xd36a('0x0'));var rp=require(_0xd36a('0x1'));var moment=require(_0xd36a('0x2'));var BPromise=require(_0xd36a('0x3'));var Mustache=require(_0xd36a('0x4'));var util=require(_0xd36a('0x5'));var path=require('path');var sox=require(_0xd36a('0x6'));var csv=require('to-csv');var ejs=require(_0xd36a('0x7'));var fs=require('fs');var _=require(_0xd36a('0x8'));var squel=require(_0xd36a('0x9'));var crypto=require(_0xd36a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd36a('0xb'));var toCsv=require(_0xd36a('0xc'));var querystring=require(_0xd36a('0xd'));var Papa=require('papaparse');var qs=require(_0xd36a('0xe'));var logger=require(_0xd36a('0xf'))(_0xd36a('0x10'));var utils=require(_0xd36a('0x11'));var config=require(_0xd36a('0x12'));var db=require(_0xd36a('0x13'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x257088,_0x27aded){_0x27aded=_0x27aded||0xcc;return function(_0x1e8e62){if(_0x1e8e62){return _0x257088[_0xd36a('0x14')](_0x27aded);}return _0x257088['status'](_0x27aded)[_0xd36a('0x15')]();};}function respondWithResult(_0x4e7b03,_0x1d0bd0){_0x1d0bd0=_0x1d0bd0||0xc8;return function(_0x45108e){if(_0x45108e){return _0x4e7b03[_0xd36a('0x16')](_0x1d0bd0)['json'](_0x45108e);}};}function respondWithFilteredResult(_0x2b1d72,_0x8eff28){return function(_0x4eda73){if(_0x4eda73){var _0x530b96=_0x4eda73['count'],_0xdd0d01=_0x8eff28[_0xd36a('0x17')],_0x435613=_0x8eff28[_0xd36a('0x17')]+_0x8eff28[_0xd36a('0x18')],_0x5afdef;if(_0x435613>=_0x530b96){_0x435613=_0x530b96;_0x5afdef=0xc8;}else{_0x5afdef=0xce;}_0x2b1d72[_0xd36a('0x16')](_0x5afdef);return _0x2b1d72['set'](_0xd36a('0x19'),_0xdd0d01+'-'+_0x435613+'/'+_0x530b96)[_0xd36a('0x1a')](_0x4eda73);}return null;};}function patchUpdates(_0x4f4644){return function(_0x542c8d){try{jsonpatch[_0xd36a('0x1b')](_0x542c8d,_0x4f4644,!![]);}catch(_0x307b43){return BPromise[_0xd36a('0x1c')](_0x307b43);}return _0x542c8d[_0xd36a('0x1d')]();};}function saveUpdates(_0x7c5585,_0x35016d){return function(_0x239a7f){if(_0x239a7f){return _0x239a7f[_0xd36a('0x1e')](_0x7c5585)[_0xd36a('0x1f')](function(_0x1f99ee){return _0x1f99ee;});}return null;};}function removeEntity(_0x5c82f3,_0x364a16){return function(_0x5e398b){if(_0x5e398b){return _0x5e398b[_0xd36a('0x20')]()[_0xd36a('0x1f')](function(){_0x5c82f3['status'](0xcc)[_0xd36a('0x15')]();});}};}function handleEntityNotFound(_0x5637eb,_0x1af7ad){return function(_0x16cbd7){if(!_0x16cbd7){_0x5637eb[_0xd36a('0x14')](0x194);}return _0x16cbd7;};}function handleError(_0x499185,_0x1d7ca6){_0x1d7ca6=_0x1d7ca6||0x1f4;return function(_0x4e7765){logger['error'](_0x4e7765[_0xd36a('0x21')]);if(_0x4e7765[_0xd36a('0x22')]){delete _0x4e7765[_0xd36a('0x22')];}_0x499185[_0xd36a('0x16')](_0x1d7ca6)['send'](_0x4e7765);};}exports['index']=function(_0x2b7e48,_0x2b6c62){var _0x4cef94={},_0x2e1308={},_0x5dc3a1={'count':0x0,'rows':[]};var _0x2d229c=db[_0xd36a('0x23')][_0xd36a('0x24')];_0x2e1308[_0xd36a('0x25')]=_[_0xd36a('0x26')](_0x2d229c);var _0x5e5ba8={'dateStart':_0x2b7e48['query'][_0xd36a('0x27')],'dateEnd':_0x2b7e48['query'][_0xd36a('0x28')]};delete _0x2b7e48[_0xd36a('0x29')][_0xd36a('0x27')];delete _0x2b7e48[_0xd36a('0x29')][_0xd36a('0x28')];_0x2e1308[_0xd36a('0x29')]=_[_0xd36a('0x26')](_0x2b7e48['query']);_0x2e1308[_0xd36a('0x2a')]=_[_0xd36a('0x2b')](_0x2e1308[_0xd36a('0x25')],_0x2e1308[_0xd36a('0x29')]);_0x4cef94['attributes']=_[_0xd36a('0x2b')](_0x2e1308[_0xd36a('0x25')],qs[_0xd36a('0x2c')](_0x2b7e48[_0xd36a('0x29')][_0xd36a('0x2c')]));_0x4cef94[_0xd36a('0x2d')]=_0x4cef94['attributes'][_0xd36a('0x2e')]?_0x4cef94['attributes']:_0x2e1308[_0xd36a('0x25')];if(!_0x2b7e48[_0xd36a('0x29')][_0xd36a('0x2f')]('nolimit')){_0x4cef94[_0xd36a('0x18')]=qs['limit'](_0x2b7e48[_0xd36a('0x29')][_0xd36a('0x18')]);_0x4cef94[_0xd36a('0x17')]=qs[_0xd36a('0x17')](_0x2b7e48['query'][_0xd36a('0x17')]);}_0x4cef94[_0xd36a('0x30')]=qs['sort'](_0x2b7e48[_0xd36a('0x29')]['sort']);_0x4cef94[_0xd36a('0x31')]=qs[_0xd36a('0x2a')](_[_0xd36a('0x32')](_0x2b7e48[_0xd36a('0x29')],_0x2e1308[_0xd36a('0x2a')]));if(_0x5e5ba8[_0xd36a('0x27')]){if(_0x5e5ba8[_0xd36a('0x28')]){_0x5e5ba8[_0xd36a('0x28')]=moment(_0x5e5ba8[_0xd36a('0x28')])['add'](0x1,'day');}else{_0x5e5ba8['dateEnd']=moment(_0x5e5ba8[_0xd36a('0x27')])[_0xd36a('0x33')](0x1,_0xd36a('0x34'));}_[_0xd36a('0x35')](_0x4cef94[_0xd36a('0x31')],{'createdAt':{'$gte':_0x5e5ba8[_0xd36a('0x27')],'$lte':_0x5e5ba8[_0xd36a('0x28')]}});}if(_0x2b7e48['query'][_0xd36a('0x36')]){_0x4cef94['where']=_['merge'](_0x4cef94[_0xd36a('0x31')],{'$or':_[_0xd36a('0x37')](_0x4cef94['attributes'],function(_0x2d0eca){var _0x45059f={};_0x45059f[_0x2d0eca]={'$like':'%'+_0x2b7e48[_0xd36a('0x29')][_0xd36a('0x36')]+'%'};return _0x45059f;})});}_0x4cef94=_[_0xd36a('0x35')]({},_0x4cef94,_0x2b7e48[_0xd36a('0x38')]);var _0x19506c={'where':_0x4cef94[_0xd36a('0x31')]};return db['Interval'][_0xd36a('0x39')](_0x19506c)[_0xd36a('0x1f')](function(_0x48029a){_0x5dc3a1[_0xd36a('0x39')]=_0x48029a;if(_0x2b7e48[_0xd36a('0x29')][_0xd36a('0x3a')]){_0x4cef94[_0xd36a('0x3b')]=[{'all':!![]}];}return db[_0xd36a('0x23')]['findAll'](_0x4cef94);})[_0xd36a('0x1f')](function(_0x900f3d){_0x5dc3a1[_0xd36a('0x3c')]=_0x900f3d;return _0x5dc3a1;})['then'](respondWithFilteredResult(_0x2b6c62,_0x4cef94))[_0xd36a('0x3d')](handleError(_0x2b6c62,null));};exports[_0xd36a('0x3e')]=function(_0x2cadc4,_0x1f10a5){var _0x4c8731={'raw':!![],'where':{'id':_0x2cadc4['params']['id']}},_0x6597cb={};_0x6597cb[_0xd36a('0x25')]=_[_0xd36a('0x26')](db[_0xd36a('0x23')]['rawAttributes']);_0x6597cb[_0xd36a('0x29')]=_['keys'](_0x2cadc4['query']);_0x6597cb['filters']=_['intersection'](_0x6597cb[_0xd36a('0x25')],_0x6597cb['query']);_0x4c8731['attributes']=_['intersection'](_0x6597cb['model'],qs[_0xd36a('0x2c')](_0x2cadc4[_0xd36a('0x29')]['fields']));_0x4c8731[_0xd36a('0x2d')]=_0x4c8731[_0xd36a('0x2d')]['length']?_0x4c8731[_0xd36a('0x2d')]:_0x6597cb[_0xd36a('0x25')];if(_0x2cadc4['query'][_0xd36a('0x3a')]){_0x4c8731[_0xd36a('0x3b')]=[{'all':!![]}];}_0x4c8731=_[_0xd36a('0x35')]({},_0x4c8731,_0x2cadc4[_0xd36a('0x38')]);return db[_0xd36a('0x23')][_0xd36a('0x3f')](_0x4c8731)[_0xd36a('0x1f')](handleEntityNotFound(_0x1f10a5,null))[_0xd36a('0x1f')](respondWithResult(_0x1f10a5,null))[_0xd36a('0x3d')](handleError(_0x1f10a5,null));};exports[_0xd36a('0x40')]=function(_0x5de0b0,_0x497d58){return db[_0xd36a('0x23')][_0xd36a('0x40')](_0x5de0b0[_0xd36a('0x41')],{})[_0xd36a('0x1f')](respondWithResult(_0x497d58,0xc9))[_0xd36a('0x3d')](handleError(_0x497d58,null));};exports[_0xd36a('0x1e')]=function(_0x55bb8e,_0x3f6e58){if(_0x55bb8e['body']['id']){delete _0x55bb8e['body']['id'];}return db[_0xd36a('0x23')][_0xd36a('0x3f')]({'where':{'id':_0x55bb8e[_0xd36a('0x42')]['id']}})['then'](handleEntityNotFound(_0x3f6e58,null))[_0xd36a('0x1f')](saveUpdates(_0x55bb8e[_0xd36a('0x41')],null))[_0xd36a('0x1f')](respondWithResult(_0x3f6e58,null))[_0xd36a('0x3d')](handleError(_0x3f6e58,null));};exports[_0xd36a('0x20')]=function(_0x7c9260,_0x5cd054){return db[_0xd36a('0x23')][_0xd36a('0x3f')]({'where':{'id':_0x7c9260[_0xd36a('0x42')]['id']}})[_0xd36a('0x1f')](handleEntityNotFound(_0x5cd054,null))[_0xd36a('0x1f')](removeEntity(_0x5cd054,null))['catch'](handleError(_0x5cd054,null));};exports['addInterval']=function(_0x416550,_0xb5c08f,_0x155756){if(_0x416550[_0xd36a('0x41')]['id']){delete _0x416550[_0xd36a('0x41')]['id'];}return db[_0xd36a('0x23')][_0xd36a('0x3f')]({'where':{'id':_0x416550[_0xd36a('0x42')]['id']}})[_0xd36a('0x1f')](handleEntityNotFound(_0xb5c08f,null))[_0xd36a('0x1f')](function(_0x174710){if(_0x174710){_0x416550[_0xd36a('0x41')]['IntervalId']=_0x174710['id'];return db['Interval'][_0xd36a('0x40')](_0x416550['body']);}})[_0xd36a('0x1f')](respondWithResult(_0xb5c08f,null))['catch'](handleError(_0xb5c08f,null));};exports['getIntervals']=function(_0x22ba52,_0x189393,_0x1ed27f){var _0x56e3b1={};var _0x58dfac={};var _0x4bb246;var _0x56835d;return db['Interval'][_0xd36a('0x43')]({'where':{'id':_0x22ba52['params']['id']}})[_0xd36a('0x1f')](handleEntityNotFound(_0x189393,null))[_0xd36a('0x1f')](function(_0x49ccf9){if(_0x49ccf9){_0x4bb246=_0x49ccf9;_0x58dfac[_0xd36a('0x25')]=_[_0xd36a('0x26')](db[_0xd36a('0x23')][_0xd36a('0x24')]);_0x58dfac[_0xd36a('0x29')]=_['keys'](_0x22ba52[_0xd36a('0x29')]);_0x58dfac[_0xd36a('0x2a')]=_[_0xd36a('0x2b')](_0x58dfac['model'],_0x58dfac[_0xd36a('0x29')]);_0x56e3b1[_0xd36a('0x2d')]=_[_0xd36a('0x2b')](_0x58dfac[_0xd36a('0x25')],qs['fields'](_0x22ba52[_0xd36a('0x29')][_0xd36a('0x2c')]));_0x56e3b1[_0xd36a('0x2d')]=_0x56e3b1[_0xd36a('0x2d')][_0xd36a('0x2e')]?_0x56e3b1[_0xd36a('0x2d')]:_0x58dfac[_0xd36a('0x25')];_0x56e3b1['order']=qs[_0xd36a('0x44')](_0x22ba52[_0xd36a('0x29')]['sort']);_0x56e3b1[_0xd36a('0x31')]=qs['filters'](_[_0xd36a('0x32')](_0x22ba52[_0xd36a('0x29')],_0x58dfac[_0xd36a('0x2a')]));if(_0x22ba52[_0xd36a('0x29')][_0xd36a('0x36')]){_0x56e3b1['where']=_[_0xd36a('0x35')](_0x56e3b1[_0xd36a('0x31')],{'$or':_['map'](_0x56e3b1[_0xd36a('0x2d')],function(_0x55955f){var _0x344d5e={};_0x344d5e[_0x55955f]={'$like':'%'+_0x22ba52['query'][_0xd36a('0x36')]+'%'};return _0x344d5e;})});}_0x56e3b1=_[_0xd36a('0x35')]({},_0x56e3b1,_0x22ba52[_0xd36a('0x38')]);return _0x4bb246['getIntervals'](_0x56e3b1);}})[_0xd36a('0x1f')](function(_0x21a78c){if(_0x21a78c){_0x56835d=_0x21a78c[_0xd36a('0x2e')];if(!_0x22ba52['query'][_0xd36a('0x2f')](_0xd36a('0x45'))){_0x56e3b1[_0xd36a('0x18')]=qs[_0xd36a('0x18')](_0x22ba52[_0xd36a('0x29')]['limit']);_0x56e3b1[_0xd36a('0x17')]=qs[_0xd36a('0x17')](_0x22ba52[_0xd36a('0x29')][_0xd36a('0x17')]);}return _0x4bb246[_0xd36a('0x46')](_0x56e3b1);}})[_0xd36a('0x1f')](function(_0x3393b6){if(_0x3393b6){return _0x3393b6?{'count':_0x56835d,'rows':_0x3393b6}:null;}})[_0xd36a('0x1f')](respondWithResult(_0x189393,null))[_0xd36a('0x3d')](handleError(_0x189393,null));};exports[_0xd36a('0x47')]=function(_0x3f50be,_0x5f434b,_0x84c074){return db['Interval'][_0xd36a('0x43')]({'where':{'id':_0x3f50be[_0xd36a('0x42')]['id']}})[_0xd36a('0x1f')](handleEntityNotFound(_0x5f434b,null))['then'](function(_0x478e44){if(_0x478e44){return db[_0xd36a('0x48')][_0xd36a('0x49')](function(_0x379344){return db[_0xd36a('0x23')][_0xd36a('0x20')]({'where':{'IntervalId':_0x3f50be['params']['id']},'transaction':_0x379344})[_0xd36a('0x1f')](function(_0x129b78){var _0x10a919=_['map'](_0x3f50be[_0xd36a('0x41')],function(_0x1e447e){delete _0x1e447e['id'];_0x1e447e['IntervalId']=_0x3f50be[_0xd36a('0x42')]['id'];return _0x1e447e;});return db[_0xd36a('0x23')][_0xd36a('0x4a')](_0x10a919,{'transaction':_0x379344});});})['then'](function(){return db[_0xd36a('0x23')][_0xd36a('0x4b')]({'where':{'IntervalId':_0x3f50be[_0xd36a('0x42')]['id']}});});}})[_0xd36a('0x1f')](respondWithResult(_0x5f434b,null))[_0xd36a('0x3d')](handleError(_0x5f434b,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 705c02c..bdd7e4b 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 _0x21ad=['moment','bluebird','request-promise','../../components/extensions/rewrite','exports','define','Interval','rewrite','lodash','util','../../config/logger','api'];(function(_0x5a45cc,_0x597330){var _0x149ef0=function(_0x35870e){while(--_0x35870e){_0x5a45cc['push'](_0x5a45cc['shift']());}};_0x149ef0(++_0x597330);}(_0x21ad,0x8c));var _0xd21a=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x21ad[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xd21a('0x0'));var util=require(_0xd21a('0x1'));var logger=require(_0xd21a('0x2'))(_0xd21a('0x3'));var moment=require(_0xd21a('0x4'));var BPromise=require(_0xd21a('0x5'));var rp=require(_0xd21a('0x6'));var attributes=require('./interval.attributes');var extensions=require(_0xd21a('0x7'));module[_0xd21a('0x8')]=function(_0x5210a9,_0x33b581){return _0x5210a9[_0xd21a('0x9')](_0xd21a('0xa'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ad7a3,_0x43b935){extensions[_0xd21a('0xb')](_0x5210a9,_0x3ad7a3);},'afterBulkCreate':function(_0x21f2f4,_0x2be673,_0x4d0f4b){_0x4d0f4b();extensions[_0xd21a('0xb')](_0x5210a9,_0x21f2f4[0x0]);},'afterUpdate':function(_0x406bf6,_0x4598a1){extensions[_0xd21a('0xb')](_0x5210a9,_0x406bf6);},'afterDestroy':function(_0x3e8592,_0x346701){extensions[_0xd21a('0xb')](_0x5210a9,_0x3e8592);}}});}; \ No newline at end of file +var _0x1d68=['../../components/extensions/rewrite','define','rewrite','lodash','util','api','moment','bluebird','request-promise'];(function(_0x5f1668,_0x13be47){var _0x583805=function(_0x258d77){while(--_0x258d77){_0x5f1668['push'](_0x5f1668['shift']());}};_0x583805(++_0x13be47);}(_0x1d68,0x1ce));var _0x81d6=function(_0x53f5ec,_0x34bca9){_0x53f5ec=_0x53f5ec-0x0;var _0x4e2d6a=_0x1d68[_0x53f5ec];return _0x4e2d6a;};'use strict';var _=require(_0x81d6('0x0'));var util=require(_0x81d6('0x1'));var logger=require('../../config/logger')(_0x81d6('0x2'));var moment=require(_0x81d6('0x3'));var BPromise=require(_0x81d6('0x4'));var rp=require(_0x81d6('0x5'));var attributes=require('./interval.attributes');var extensions=require(_0x81d6('0x6'));module['exports']=function(_0xec609a,_0x38e3fb){return _0xec609a[_0x81d6('0x7')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3203fa,_0x563452){extensions[_0x81d6('0x8')](_0xec609a,_0x3203fa);},'afterBulkCreate':function(_0x4ace7f,_0x2f94b3,_0x41acda){_0x41acda();extensions[_0x81d6('0x8')](_0xec609a,_0x4ace7f[0x0]);},'afterUpdate':function(_0x3868a3,_0x487eba){extensions['rewrite'](_0xec609a,_0x3868a3);},'afterDestroy':function(_0x4c4e7c,_0x6a943){extensions['rewrite'](_0xec609a,_0x4c4e7c);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 0547323..5986800 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 _0xbd9d=['model','ShowInterval','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Interval,\x20%s,\x20%s','request\x20sent','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x4aa7a1,_0x1ef969){var _0x3e0c8a=function(_0x538272){while(--_0x538272){_0x4aa7a1['push'](_0x4aa7a1['shift']());}};_0x3e0c8a(++_0x1ef969);}(_0xbd9d,0x135));var _0xdbd9=function(_0x285afc,_0x146b2e){_0x285afc=_0x285afc-0x0;var _0x2dc641=_0xbd9d[_0x285afc];return _0x2dc641;};'use strict';var _=require('lodash');var util=require(_0xdbd9('0x0'));var moment=require(_0xdbd9('0x1'));var BPromise=require(_0xdbd9('0x2'));var rs=require(_0xdbd9('0x3'));var fs=require('fs');var db=require(_0xdbd9('0x4'))['db'];var utils=require(_0xdbd9('0x5'));var logger=require(_0xdbd9('0x6'))('rpc');var config=require(_0xdbd9('0x7'));var jayson=require(_0xdbd9('0x8'));var client=jayson[_0xdbd9('0x9')][_0xdbd9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fa314,_0x527cba,_0x29ebf9){return new BPromise(function(_0x459535,_0x3fb002){return client['request'](_0x1fa314,_0x29ebf9)[_0xdbd9('0xb')](function(_0x994d40){logger[_0xdbd9('0xc')](_0xdbd9('0xd'),_0x527cba,_0xdbd9('0xe'));logger['debug'](_0xdbd9('0xf'),_0x527cba,'request\x20sent',JSON[_0xdbd9('0x10')](_0x994d40));if(_0x994d40[_0xdbd9('0x11')]){if(_0x994d40['error'][_0xdbd9('0x12')]===0x1f4){logger[_0xdbd9('0x11')](_0xdbd9('0xd'),_0x527cba,_0x994d40['error'][_0xdbd9('0x13')]);return _0x3fb002(_0x994d40[_0xdbd9('0x11')][_0xdbd9('0x13')]);}logger['error'](_0xdbd9('0xd'),_0x527cba,_0x994d40[_0xdbd9('0x11')][_0xdbd9('0x13')]);return _0x459535(_0x994d40['error'][_0xdbd9('0x13')]);}else{logger[_0xdbd9('0xc')](_0xdbd9('0xd'),_0x527cba,'request\x20sent');_0x459535(_0x994d40['result'][_0xdbd9('0x13')]);}})[_0xdbd9('0x14')](function(_0x56b737){logger[_0xdbd9('0x11')]('Interval,\x20%s,\x20%s',_0x527cba,_0x56b737);_0x3fb002(_0x56b737);});});}exports[_0xdbd9('0x15')]=function(_0xbb07dc){var _0x408284=this;return new Promise(function(_0x5ea55d,_0x196d14){return db[_0xdbd9('0x16')][_0xdbd9('0x17')]({'raw':_0xbb07dc[_0xdbd9('0x18')]?_0xbb07dc[_0xdbd9('0x18')][_0xdbd9('0x19')]===undefined?!![]:![]:!![],'where':_0xbb07dc[_0xdbd9('0x18')]?_0xbb07dc['options'][_0xdbd9('0x1a')]||null:null,'attributes':_0xbb07dc[_0xdbd9('0x18')]?_0xbb07dc[_0xdbd9('0x18')][_0xdbd9('0x1b')]||null:null,'limit':_0xbb07dc[_0xdbd9('0x18')]?_0xbb07dc[_0xdbd9('0x18')][_0xdbd9('0x1c')]||null:null,'include':_0xbb07dc[_0xdbd9('0x18')]?_0xbb07dc[_0xdbd9('0x18')][_0xdbd9('0x1d')]?_[_0xdbd9('0x1e')](_0xbb07dc[_0xdbd9('0x18')]['include'],function(_0x3cef52){return{'model':db[_0x3cef52[_0xdbd9('0x1f')]],'as':_0x3cef52['as'],'attributes':_0x3cef52['attributes'],'include':_0x3cef52['include']?_['map'](_0x3cef52['include'],function(_0x11e7a1){return{'model':db[_0x11e7a1[_0xdbd9('0x1f')]],'as':_0x11e7a1['as'],'attributes':_0x11e7a1[_0xdbd9('0x1b')],'include':_0x11e7a1[_0xdbd9('0x1d')]?_[_0xdbd9('0x1e')](_0x11e7a1[_0xdbd9('0x1d')],function(_0x33c22a){return{'model':db[_0x33c22a[_0xdbd9('0x1f')]],'as':_0x33c22a['as'],'attributes':_0x33c22a[_0xdbd9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdbd9('0xb')](function(_0x33e03d){logger['info'](_0xdbd9('0x15'),_0xbb07dc);logger['debug'](_0xdbd9('0x15'),_0xbb07dc,JSON[_0xdbd9('0x10')](_0x33e03d));_0x5ea55d(_0x33e03d);})[_0xdbd9('0x14')](function(_0x12da0a){logger['error'](_0xdbd9('0x15'),_0x12da0a['message'],_0xbb07dc);_0x196d14(_0x408284[_0xdbd9('0x11')](0x1f4,_0x12da0a['message']));});});};exports[_0xdbd9('0x20')]=function(_0x182b8f){var _0x1ff426=this;return new Promise(function(_0xb647ec,_0x5a4435){return db[_0xdbd9('0x16')][_0xdbd9('0x21')]({'raw':_0x182b8f[_0xdbd9('0x18')]?_0x182b8f['options']['raw']===undefined?!![]:![]:!![],'where':_0x182b8f[_0xdbd9('0x18')]?_0x182b8f[_0xdbd9('0x18')][_0xdbd9('0x1a')]||null:null,'attributes':_0x182b8f['options']?_0x182b8f[_0xdbd9('0x18')][_0xdbd9('0x1b')]||null:null,'include':_0x182b8f[_0xdbd9('0x18')]?_0x182b8f[_0xdbd9('0x18')][_0xdbd9('0x1d')]?_[_0xdbd9('0x1e')](_0x182b8f[_0xdbd9('0x18')][_0xdbd9('0x1d')],function(_0x2d5654){return{'model':db[_0x2d5654[_0xdbd9('0x1f')]],'as':_0x2d5654['as'],'attributes':_0x2d5654[_0xdbd9('0x1b')],'include':_0x2d5654[_0xdbd9('0x1d')]?_['map'](_0x2d5654[_0xdbd9('0x1d')],function(_0xcaa06e){return{'model':db[_0xcaa06e['model']],'as':_0xcaa06e['as'],'attributes':_0xcaa06e[_0xdbd9('0x1b')],'include':_0xcaa06e['include']?_[_0xdbd9('0x1e')](_0xcaa06e[_0xdbd9('0x1d')],function(_0x39f0f4){return{'model':db[_0x39f0f4[_0xdbd9('0x1f')]],'as':_0x39f0f4['as'],'attributes':_0x39f0f4['attributes']};}):[]};}):[]};}):[]:[]})[_0xdbd9('0xb')](function(_0x43bd6e){logger['info'](_0xdbd9('0x20'),_0x182b8f);logger['debug']('ShowInterval',_0x182b8f,JSON[_0xdbd9('0x10')](_0x43bd6e));_0xb647ec(_0x43bd6e);})['catch'](function(_0xb3e73){logger[_0xdbd9('0x11')]('ShowInterval',_0xb3e73[_0xdbd9('0x13')],_0x182b8f);_0x5a4435(_0x1ff426[_0xdbd9('0x11')](0x1f4,_0xb3e73[_0xdbd9('0x13')]));});});}; \ No newline at end of file +var _0xf7c9=['code','message','info','result','catch','findAll','options','where','attributes','include','map','model','then','GetInterval','ShowInterval','Interval','find','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3c7003,_0x5a862f){var _0x2e6af6=function(_0x44712f){while(--_0x44712f){_0x3c7003['push'](_0x3c7003['shift']());}};_0x2e6af6(++_0x5a862f);}(_0xf7c9,0x1cc));var _0x9f7c=function(_0x4bb995,_0x22d513){_0x4bb995=_0x4bb995-0x0;var _0x6b9120=_0xf7c9[_0x4bb995];return _0x6b9120;};'use strict';var _=require(_0x9f7c('0x0'));var util=require('util');var moment=require(_0x9f7c('0x1'));var BPromise=require(_0x9f7c('0x2'));var rs=require(_0x9f7c('0x3'));var fs=require('fs');var db=require(_0x9f7c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f7c('0x5'))('rpc');var config=require(_0x9f7c('0x6'));var jayson=require(_0x9f7c('0x7'));var client=jayson[_0x9f7c('0x8')][_0x9f7c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55d9b1,_0x4fcda1,_0x3d378c){return new BPromise(function(_0x16e0ee,_0x2d6bd9){return client['request'](_0x55d9b1,_0x3d378c)['then'](function(_0x4f2597){logger['info'](_0x9f7c('0xa'),_0x4fcda1,_0x9f7c('0xb'));logger[_0x9f7c('0xc')](_0x9f7c('0xd'),_0x4fcda1,'request\x20sent',JSON[_0x9f7c('0xe')](_0x4f2597));if(_0x4f2597[_0x9f7c('0xf')]){if(_0x4f2597[_0x9f7c('0xf')][_0x9f7c('0x10')]===0x1f4){logger['error'](_0x9f7c('0xa'),_0x4fcda1,_0x4f2597[_0x9f7c('0xf')][_0x9f7c('0x11')]);return _0x2d6bd9(_0x4f2597[_0x9f7c('0xf')][_0x9f7c('0x11')]);}logger[_0x9f7c('0xf')]('Interval,\x20%s,\x20%s',_0x4fcda1,_0x4f2597[_0x9f7c('0xf')]['message']);return _0x16e0ee(_0x4f2597[_0x9f7c('0xf')][_0x9f7c('0x11')]);}else{logger[_0x9f7c('0x12')](_0x9f7c('0xa'),_0x4fcda1,_0x9f7c('0xb'));_0x16e0ee(_0x4f2597[_0x9f7c('0x13')][_0x9f7c('0x11')]);}})[_0x9f7c('0x14')](function(_0x2a255c){logger[_0x9f7c('0xf')]('Interval,\x20%s,\x20%s',_0x4fcda1,_0x2a255c);_0x2d6bd9(_0x2a255c);});});}exports['GetInterval']=function(_0x5ee524){var _0x4a3818=this;return new Promise(function(_0x423554,_0x100c08){return db['Interval'][_0x9f7c('0x15')]({'raw':_0x5ee524[_0x9f7c('0x16')]?_0x5ee524['options']['raw']===undefined?!![]:![]:!![],'where':_0x5ee524[_0x9f7c('0x16')]?_0x5ee524['options'][_0x9f7c('0x17')]||null:null,'attributes':_0x5ee524[_0x9f7c('0x16')]?_0x5ee524[_0x9f7c('0x16')][_0x9f7c('0x18')]||null:null,'limit':_0x5ee524[_0x9f7c('0x16')]?_0x5ee524[_0x9f7c('0x16')]['limit']||null:null,'include':_0x5ee524[_0x9f7c('0x16')]?_0x5ee524['options'][_0x9f7c('0x19')]?_[_0x9f7c('0x1a')](_0x5ee524[_0x9f7c('0x16')][_0x9f7c('0x19')],function(_0x5e5d92){return{'model':db[_0x5e5d92['model']],'as':_0x5e5d92['as'],'attributes':_0x5e5d92['attributes'],'include':_0x5e5d92[_0x9f7c('0x19')]?_['map'](_0x5e5d92[_0x9f7c('0x19')],function(_0x4d4410){return{'model':db[_0x4d4410[_0x9f7c('0x1b')]],'as':_0x4d4410['as'],'attributes':_0x4d4410['attributes'],'include':_0x4d4410['include']?_[_0x9f7c('0x1a')](_0x4d4410[_0x9f7c('0x19')],function(_0x1fbf51){return{'model':db[_0x1fbf51[_0x9f7c('0x1b')]],'as':_0x1fbf51['as'],'attributes':_0x1fbf51[_0x9f7c('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9f7c('0x1c')](function(_0x2a2f51){logger['info']('GetInterval',_0x5ee524);logger[_0x9f7c('0xc')](_0x9f7c('0x1d'),_0x5ee524,JSON[_0x9f7c('0xe')](_0x2a2f51));_0x423554(_0x2a2f51);})[_0x9f7c('0x14')](function(_0x1899a6){logger[_0x9f7c('0xf')]('GetInterval',_0x1899a6[_0x9f7c('0x11')],_0x5ee524);_0x100c08(_0x4a3818[_0x9f7c('0xf')](0x1f4,_0x1899a6[_0x9f7c('0x11')]));});});};exports[_0x9f7c('0x1e')]=function(_0x4b3efa){var _0x4b02a2=this;return new Promise(function(_0x52ebe0,_0x5ef2ad){return db[_0x9f7c('0x1f')][_0x9f7c('0x20')]({'raw':_0x4b3efa[_0x9f7c('0x16')]?_0x4b3efa[_0x9f7c('0x16')][_0x9f7c('0x21')]===undefined?!![]:![]:!![],'where':_0x4b3efa[_0x9f7c('0x16')]?_0x4b3efa['options'][_0x9f7c('0x17')]||null:null,'attributes':_0x4b3efa[_0x9f7c('0x16')]?_0x4b3efa[_0x9f7c('0x16')][_0x9f7c('0x18')]||null:null,'include':_0x4b3efa[_0x9f7c('0x16')]?_0x4b3efa[_0x9f7c('0x16')][_0x9f7c('0x19')]?_[_0x9f7c('0x1a')](_0x4b3efa['options'][_0x9f7c('0x19')],function(_0x88eb3a){return{'model':db[_0x88eb3a[_0x9f7c('0x1b')]],'as':_0x88eb3a['as'],'attributes':_0x88eb3a[_0x9f7c('0x18')],'include':_0x88eb3a['include']?_[_0x9f7c('0x1a')](_0x88eb3a[_0x9f7c('0x19')],function(_0x2772c2){return{'model':db[_0x2772c2[_0x9f7c('0x1b')]],'as':_0x2772c2['as'],'attributes':_0x2772c2[_0x9f7c('0x18')],'include':_0x2772c2['include']?_[_0x9f7c('0x1a')](_0x2772c2['include'],function(_0x6619c){return{'model':db[_0x6619c[_0x9f7c('0x1b')]],'as':_0x6619c['as'],'attributes':_0x6619c[_0x9f7c('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9f7c('0x1c')](function(_0x1906ff){logger[_0x9f7c('0x12')](_0x9f7c('0x1e'),_0x4b3efa);logger[_0x9f7c('0xc')]('ShowInterval',_0x4b3efa,JSON[_0x9f7c('0xe')](_0x1906ff));_0x52ebe0(_0x1906ff);})[_0x9f7c('0x14')](function(_0xc27ec3){logger[_0x9f7c('0xf')](_0x9f7c('0x1e'),_0xc27ec3['message'],_0x4b3efa);_0x5ef2ad(_0x4b02a2[_0x9f7c('0xf')](0x1f4,_0xc27ec3[_0x9f7c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 3baa0dd..114314b 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 _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x18aed6,_0x10ba9a){var _0x1eef14=function(_0x13fd39){while(--_0x13fd39){_0x18aed6['push'](_0x18aed6['shift']());}};_0x1eef14(++_0x10ba9a);}(_0x2ef3,0xba));var _0x32ef=function(_0x22d71d,_0xcf35ba){_0x22d71d=_0x22d71d-0x0;var _0xdd904d=_0x2ef3[_0x22d71d];return _0xdd904d;};'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 c3f085a..18e7ebe 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(_0x173c92,_0x1215b7){var _0x5b1687=function(_0x7ffc17){while(--_0x7ffc17){_0x173c92['push'](_0x173c92['shift']());}};_0x5b1687(++_0x1215b7);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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 _0xcb91=['summary','\x20from\x20','description','issuetype','Bug','customfield_11500','customfield_11501','oldToken','fields','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','toString','base64','stringify','setEncoding','utf8','data','end','status','parse','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','x-forwarded-for','connection','remoteAddress','socket','body','../../config/logger','api','support','3eAmWpBVP0','MOTGUI'];(function(_0x2e750b,_0x270a5e){var _0x55ca65=function(_0x52ceb3){while(--_0x52ceb3){_0x2e750b['push'](_0x2e750b['shift']());}};_0x55ca65(++_0x270a5e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x239dba,_0x309e95){_0x239dba=_0x239dba-0x0;var _0x1ceb11=_0xcb91[_0x239dba];return _0x1ceb11;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var USERNAME=_0x1cb9('0x2');var PASSWORD=_0x1cb9('0x3');function openIssue(_0x4c37e8,_0x8c392f){var _0x2c17b8={'fields':{'project':{'key':_0x4c37e8['key']||_0x1cb9('0x4')},'summary':(_0x4c37e8[_0x1cb9('0x5')]||'Report')+_0x1cb9('0x6')+_0x4c37e8['ip'],'description':_0x4c37e8[_0x1cb9('0x7')]||JSON['stringify'](_0x4c37e8),'issuetype':{'name':_0x4c37e8[_0x1cb9('0x8')]||_0x1cb9('0x9')}}};_0x2c17b8['fields'][_0x1cb9('0xa')]=_0x4c37e8['email'];_0x2c17b8['fields'][_0x1cb9('0xb')]=_0x4c37e8[_0x1cb9('0xc')];_0x2c17b8[_0x1cb9('0xd')][_0x1cb9('0xe')]=_0x4c37e8[_0x1cb9('0xf')];_0x2c17b8['fields'][_0x1cb9('0x10')]=_0x4c37e8[_0x1cb9('0x11')];_0x2c17b8[_0x1cb9('0xd')][_0x1cb9('0x12')]=_0x4c37e8[_0x1cb9('0x13')];_0x2c17b8['fields']['customfield_10102']=_0x4c37e8['ip'];var _0x59dec3={'host':_0x1cb9('0x14'),'port':0x1bb,'path':_0x1cb9('0x15'),'method':_0x1cb9('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x1cb9('0x17'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x1cb9('0x18')](_0x1cb9('0x19'))}};var _0x1b3cd7=JSON[_0x1cb9('0x1a')](_0x2c17b8);var _0x3e2d11=https['request'](_0x59dec3,function(_0x5572cb){_0x5572cb[_0x1cb9('0x1b')](_0x1cb9('0x1c'));var _0x3904b7='';_0x5572cb['on'](_0x1cb9('0x1d'),function(_0x3e21e0){_0x3904b7+=_0x3e21e0;});_0x5572cb['on'](_0x1cb9('0x1e'),function(){if(_0x8c392f){return _0x8c392f[_0x1cb9('0x1f')](_0x5572cb['statusCode'])['json'](JSON[_0x1cb9('0x20')](_0x3904b7));}});});_0x3e2d11['on'](_0x1cb9('0x21'),function(_0x2b2669){if(_0x8c392f){return _0x8c392f[_0x1cb9('0x1f')](0x1f4)[_0x1cb9('0x22')]({'errors':[{'message':_0x1cb9('0x23'),'type':_0x1cb9('0x24')}]});}});_0x3e2d11['write'](_0x1b3cd7);_0x3e2d11['end']();}exports[_0x1cb9('0x25')]=openIssue;exports['send']=function(_0x4750b1,_0x2265ea){_0x4750b1['body']['ip']=_0x4750b1['headers'][_0x1cb9('0x26')]||_0x4750b1[_0x1cb9('0x27')][_0x1cb9('0x28')]||_0x4750b1[_0x1cb9('0x29')][_0x1cb9('0x28')]||_0x4750b1[_0x1cb9('0x27')]['socket']['remoteAddress'];return openIssue(_0x4750b1[_0x1cb9('0x2a')],_0x2265ea);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index eee3e9e..1e196c9 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 _0xed3e=['update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','post','put'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xed3e,0xe8));var _0xeed3=function(_0x9278f5,_0xa3afdf){_0x9278f5=_0x9278f5-0x0;var _0x486601=_0xed3e[_0x9278f5];return _0x486601;};'use strict';var multer=require(_0xeed3('0x0'));var util=require(_0xeed3('0x1'));var path=require(_0xeed3('0x2'));var express=require(_0xeed3('0x3'));var router=express[_0xeed3('0x4')]();var auth=require(_0xeed3('0x5'));var interaction=require(_0xeed3('0x6'));var config=require(_0xeed3('0x7'));var controller=require('./jscriptyAnswerReport.controller');router['get']('/',auth[_0xeed3('0x8')](),controller['index']);router[_0xeed3('0x9')](_0xeed3('0xa'),auth['isAuthenticated'](),controller[_0xeed3('0xb')]);router[_0xeed3('0x9')](_0xeed3('0xc'),auth[_0xeed3('0x8')](),controller['show']);router[_0xeed3('0xd')]('/',auth[_0xeed3('0x8')](),controller['create']);router[_0xeed3('0xe')](_0xeed3('0xc'),auth[_0xeed3('0x8')](),controller[_0xeed3('0xf')]);router[_0xeed3('0x10')](_0xeed3('0xc'),auth['isAuthenticated'](),controller[_0xeed3('0x11')]);module[_0xeed3('0x12')]=router; \ No newline at end of file +var _0xb205=['multer','path','express','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports'];(function(_0x16051a,_0x5e4326){var _0x35d20d=function(_0x52b02e){while(--_0x52b02e){_0x16051a['push'](_0x16051a['shift']());}};_0x35d20d(++_0x5e4326);}(_0xb205,0x156));var _0x5b20=function(_0x492ff3,_0x5c5be2){_0x492ff3=_0x492ff3-0x0;var _0x4d8f30=_0xb205[_0x492ff3];return _0x4d8f30;};'use strict';var multer=require(_0x5b20('0x0'));var util=require('util');var path=require(_0x5b20('0x1'));var express=require(_0x5b20('0x2'));var router=express['Router']();var auth=require(_0x5b20('0x3'));var interaction=require(_0x5b20('0x4'));var config=require('../../config/environment');var controller=require(_0x5b20('0x5'));router[_0x5b20('0x6')]('/',auth[_0x5b20('0x7')](),controller[_0x5b20('0x8')]);router[_0x5b20('0x6')](_0x5b20('0x9'),auth[_0x5b20('0x7')](),controller[_0x5b20('0xa')]);router[_0x5b20('0x6')](_0x5b20('0xb'),auth[_0x5b20('0x7')](),controller[_0x5b20('0xc')]);router[_0x5b20('0xd')]('/',auth['isAuthenticated'](),controller[_0x5b20('0xe')]);router[_0x5b20('0xf')](_0x5b20('0xb'),auth[_0x5b20('0x7')](),controller[_0x5b20('0x10')]);router[_0x5b20('0x11')](_0x5b20('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x5b20('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 060c4d0..aa6c7c9 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 _0x8aa7=['TEXT','long','exports','STRING'];(function(_0x5f3f68,_0x46967f){var _0xf03920=function(_0x2088e8){while(--_0x2088e8){_0x5f3f68['push'](_0x5f3f68['shift']());}};_0xf03920(++_0x46967f);}(_0x8aa7,0xb6));var _0x78aa=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x8aa7[_0x40bffc];return _0x3007e9;};'use strict';var Sequelize=require('sequelize');module[_0x78aa('0x0')]={'question':{'type':Sequelize[_0x78aa('0x1')]},'answer':{'type':Sequelize[_0x78aa('0x2')](_0x78aa('0x3'))},'membername':{'type':Sequelize[_0x78aa('0x1')]},'projectname':{'type':Sequelize[_0x78aa('0x1')]},'queue':{'type':Sequelize[_0x78aa('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x78aa('0x1')]},'calleridnum':{'type':Sequelize[_0x78aa('0x1')]},'questionId':{'type':Sequelize[_0x78aa('0x1')]}}; \ No newline at end of file +var _0xfc4c=['STRING','long','sequelize','exports'];(function(_0x420398,_0x3b76aa){var _0x5650a7=function(_0xeccf03){while(--_0xeccf03){_0x420398['push'](_0x420398['shift']());}};_0x5650a7(++_0x3b76aa);}(_0xfc4c,0xca));var _0xcfc4=function(_0x3173a5,_0x4c48ea){_0x3173a5=_0x3173a5-0x0;var _0x4f66a8=_0xfc4c[_0x3173a5];return _0x4f66a8;};'use strict';var Sequelize=require(_0xcfc4('0x0'));module[_0xcfc4('0x1')]={'question':{'type':Sequelize[_0xcfc4('0x2')]},'answer':{'type':Sequelize['TEXT'](_0xcfc4('0x3'))},'membername':{'type':Sequelize[_0xcfc4('0x2')]},'projectname':{'type':Sequelize[_0xcfc4('0x2')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xcfc4('0x2')]},'calleridnum':{'type':Sequelize[_0xcfc4('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index eacf7f2..72181c2 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 _0x7c4f=['apply','reject','save','update','then','sendStatus','error','stack','send','index','JscriptyAnswerReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','day','merge','where','map','options','includeAll','include','findAll','rows','show','params','find','catch','body','fast-json-patch','request-promise','moment','bluebird','ejs','lodash','squel','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','set','Content-Range'];(function(_0x5a650b,_0x3d26e7){var _0x1ad832=function(_0x31a923){while(--_0x31a923){_0x5a650b['push'](_0x5a650b['shift']());}};_0x1ad832(++_0x3d26e7);}(_0x7c4f,0x1e3));var _0xf7c4=function(_0x510250,_0x1b2593){_0x510250=_0x510250-0x0;var _0x5d39e8=_0x7c4f[_0x510250];return _0x5d39e8;};'use strict';var jsonpatch=require(_0xf7c4('0x0'));var rp=require(_0xf7c4('0x1'));var moment=require(_0xf7c4('0x2'));var BPromise=require(_0xf7c4('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf7c4('0x4'));var fs=require('fs');var _=require(_0xf7c4('0x5'));var squel=require(_0xf7c4('0x6'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf7c4('0x7'));var toCsv=require(_0xf7c4('0x8'));var querystring=require('querystring');var Papa=require(_0xf7c4('0x9'));var qs=require(_0xf7c4('0xa'));var logger=require(_0xf7c4('0xb'))(_0xf7c4('0xc'));var utils=require(_0xf7c4('0xd'));var config=require(_0xf7c4('0xe'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d5fb2,_0xaccb40){_0xaccb40=_0xaccb40||0xcc;return function(_0x2cf8de){if(_0x2cf8de){return _0x1d5fb2['sendStatus'](_0xaccb40);}return _0x1d5fb2[_0xf7c4('0xf')](_0xaccb40)[_0xf7c4('0x10')]();};}function respondWithResult(_0x2981db,_0x54286c){_0x54286c=_0x54286c||0xc8;return function(_0x3bf4e7){if(_0x3bf4e7){return _0x2981db[_0xf7c4('0xf')](_0x54286c)[_0xf7c4('0x11')](_0x3bf4e7);}};}function respondWithFilteredResult(_0x455d5c,_0x34724d){return function(_0x54dfef){if(_0x54dfef){var _0x47a70e=_0x54dfef['count'],_0x197dfd=_0x34724d['offset'],_0x5ef8af=_0x34724d[_0xf7c4('0x12')]+_0x34724d['limit'],_0xf60b3e;if(_0x5ef8af>=_0x47a70e){_0x5ef8af=_0x47a70e;_0xf60b3e=0xc8;}else{_0xf60b3e=0xce;}_0x455d5c[_0xf7c4('0xf')](_0xf60b3e);return _0x455d5c[_0xf7c4('0x13')](_0xf7c4('0x14'),_0x197dfd+'-'+_0x5ef8af+'/'+_0x47a70e)[_0xf7c4('0x11')](_0x54dfef);}return null;};}function patchUpdates(_0x3e3cd2){return function(_0x40f792){try{jsonpatch[_0xf7c4('0x15')](_0x40f792,_0x3e3cd2,!![]);}catch(_0x5da783){return BPromise[_0xf7c4('0x16')](_0x5da783);}return _0x40f792[_0xf7c4('0x17')]();};}function saveUpdates(_0x132d99,_0x3d337e){return function(_0x2cb206){if(_0x2cb206){return _0x2cb206[_0xf7c4('0x18')](_0x132d99)[_0xf7c4('0x19')](function(_0x24d37a){return _0x24d37a;});}return null;};}function removeEntity(_0x33dafd,_0x559a91){return function(_0x415bbd){if(_0x415bbd){return _0x415bbd['destroy']()['then'](function(){_0x33dafd[_0xf7c4('0xf')](0xcc)[_0xf7c4('0x10')]();});}};}function handleEntityNotFound(_0x4f3d71,_0xe70c1a){return function(_0x5b78d7){if(!_0x5b78d7){_0x4f3d71[_0xf7c4('0x1a')](0x194);}return _0x5b78d7;};}function handleError(_0x4c8b7b,_0x11140b){_0x11140b=_0x11140b||0x1f4;return function(_0x56483c){logger[_0xf7c4('0x1b')](_0x56483c[_0xf7c4('0x1c')]);if(_0x56483c['name']){delete _0x56483c['name'];}_0x4c8b7b[_0xf7c4('0xf')](_0x11140b)[_0xf7c4('0x1d')](_0x56483c);};}exports[_0xf7c4('0x1e')]=function(_0x5bef82,_0x31658f){var _0x3f253d={},_0x1ee71a={},_0x4b8eb0={'count':0x0,'rows':[]};var _0x599aa4=db[_0xf7c4('0x1f')][_0xf7c4('0x20')];_0x1ee71a[_0xf7c4('0x21')]=_[_0xf7c4('0x22')](_0x599aa4);var _0x47440a={'dateStart':_0x5bef82[_0xf7c4('0x23')][_0xf7c4('0x24')],'dateEnd':_0x5bef82[_0xf7c4('0x23')]['dateEnd']};delete _0x5bef82[_0xf7c4('0x23')]['dateStart'];delete _0x5bef82[_0xf7c4('0x23')][_0xf7c4('0x25')];_0x1ee71a['query']=_[_0xf7c4('0x22')](_0x5bef82['query']);_0x1ee71a[_0xf7c4('0x26')]=_['intersection'](_0x1ee71a[_0xf7c4('0x21')],_0x1ee71a[_0xf7c4('0x23')]);_0x3f253d[_0xf7c4('0x27')]=_[_0xf7c4('0x28')](_0x1ee71a[_0xf7c4('0x21')],qs['fields'](_0x5bef82[_0xf7c4('0x23')][_0xf7c4('0x29')]));_0x3f253d[_0xf7c4('0x27')]=_0x3f253d[_0xf7c4('0x27')][_0xf7c4('0x2a')]?_0x3f253d[_0xf7c4('0x27')]:_0x1ee71a['model'];if(!_0x5bef82[_0xf7c4('0x23')][_0xf7c4('0x2b')](_0xf7c4('0x2c'))){_0x3f253d[_0xf7c4('0x2d')]=qs[_0xf7c4('0x2d')](_0x5bef82[_0xf7c4('0x23')][_0xf7c4('0x2d')]);_0x3f253d[_0xf7c4('0x12')]=qs['offset'](_0x5bef82['query']['offset']);}_0x3f253d[_0xf7c4('0x2e')]=qs[_0xf7c4('0x2f')](_0x5bef82[_0xf7c4('0x23')]['sort']);_0x3f253d['where']=qs['filters'](_[_0xf7c4('0x30')](_0x5bef82[_0xf7c4('0x23')],_0x1ee71a[_0xf7c4('0x26')]));if(_0x47440a[_0xf7c4('0x24')]){if(_0x47440a[_0xf7c4('0x25')]){_0x47440a['dateEnd']=moment(_0x47440a[_0xf7c4('0x25')])['add'](0x1,_0xf7c4('0x31'));}else{_0x47440a[_0xf7c4('0x25')]=moment(_0x47440a[_0xf7c4('0x24')])['add'](0x1,_0xf7c4('0x31'));}_[_0xf7c4('0x32')](_0x3f253d[_0xf7c4('0x33')],{'createdAt':{'$gte':_0x47440a[_0xf7c4('0x24')],'$lte':_0x47440a[_0xf7c4('0x25')]}});}if(_0x5bef82[_0xf7c4('0x23')]['filter']){_0x3f253d['where']=_[_0xf7c4('0x32')](_0x3f253d[_0xf7c4('0x33')],{'$or':_[_0xf7c4('0x34')](_0x3f253d['attributes'],function(_0x4f708c){var _0x231895={};_0x231895[_0x4f708c]={'$like':'%'+_0x5bef82['query']['filter']+'%'};return _0x231895;})});}_0x3f253d=_['merge']({},_0x3f253d,_0x5bef82[_0xf7c4('0x35')]);var _0xf4b7bf={'where':_0x3f253d['where']};return db[_0xf7c4('0x1f')]['count'](_0xf4b7bf)[_0xf7c4('0x19')](function(_0x37abc2){_0x4b8eb0['count']=_0x37abc2;if(_0x5bef82[_0xf7c4('0x23')][_0xf7c4('0x36')]){_0x3f253d[_0xf7c4('0x37')]=[{'all':!![]}];}return db[_0xf7c4('0x1f')][_0xf7c4('0x38')](_0x3f253d);})['then'](function(_0x26bdc2){_0x4b8eb0[_0xf7c4('0x39')]=_0x26bdc2;return _0x4b8eb0;})['then'](respondWithFilteredResult(_0x31658f,_0x3f253d))['catch'](handleError(_0x31658f,null));};exports[_0xf7c4('0x3a')]=function(_0x14cfcb,_0x36076c){var _0x189208={'raw':!![],'where':{'id':_0x14cfcb[_0xf7c4('0x3b')]['id']}},_0x1d1edc={};_0x1d1edc['model']=_[_0xf7c4('0x22')](db[_0xf7c4('0x1f')][_0xf7c4('0x20')]);_0x1d1edc[_0xf7c4('0x23')]=_[_0xf7c4('0x22')](_0x14cfcb[_0xf7c4('0x23')]);_0x1d1edc[_0xf7c4('0x26')]=_[_0xf7c4('0x28')](_0x1d1edc[_0xf7c4('0x21')],_0x1d1edc[_0xf7c4('0x23')]);_0x189208[_0xf7c4('0x27')]=_[_0xf7c4('0x28')](_0x1d1edc[_0xf7c4('0x21')],qs['fields'](_0x14cfcb[_0xf7c4('0x23')]['fields']));_0x189208[_0xf7c4('0x27')]=_0x189208['attributes'][_0xf7c4('0x2a')]?_0x189208['attributes']:_0x1d1edc[_0xf7c4('0x21')];if(_0x14cfcb[_0xf7c4('0x23')][_0xf7c4('0x36')]){_0x189208[_0xf7c4('0x37')]=[{'all':!![]}];}_0x189208=_['merge']({},_0x189208,_0x14cfcb[_0xf7c4('0x35')]);return db[_0xf7c4('0x1f')][_0xf7c4('0x3c')](_0x189208)[_0xf7c4('0x19')](handleEntityNotFound(_0x36076c,null))['then'](respondWithResult(_0x36076c,null))[_0xf7c4('0x3d')](handleError(_0x36076c,null));};exports['create']=function(_0x3d73c0,_0x5357c8){return db['JscriptyAnswerReport']['create'](_0x3d73c0[_0xf7c4('0x3e')],{})[_0xf7c4('0x19')](respondWithResult(_0x5357c8,0xc9))[_0xf7c4('0x3d')](handleError(_0x5357c8,null));};exports[_0xf7c4('0x18')]=function(_0x98a6d1,_0x28ae65){if(_0x98a6d1[_0xf7c4('0x3e')]['id']){delete _0x98a6d1[_0xf7c4('0x3e')]['id'];}return db[_0xf7c4('0x1f')]['find']({'where':{'id':_0x98a6d1[_0xf7c4('0x3b')]['id']}})['then'](handleEntityNotFound(_0x28ae65,null))[_0xf7c4('0x19')](saveUpdates(_0x98a6d1['body'],null))['then'](respondWithResult(_0x28ae65,null))[_0xf7c4('0x3d')](handleError(_0x28ae65,null));};exports['destroy']=function(_0x56e649,_0x45b9ec){return db['JscriptyAnswerReport'][_0xf7c4('0x3c')]({'where':{'id':_0x56e649[_0xf7c4('0x3b')]['id']}})[_0xf7c4('0x19')](handleEntityNotFound(_0x45b9ec,null))[_0xf7c4('0x19')](removeEntity(_0x45b9ec,null))[_0xf7c4('0x3d')](handleError(_0x45b9ec,null));};exports['describe']=function(_0x132683,_0x30ee39){return db[_0xf7c4('0x1f')]['describe']()[_0xf7c4('0x19')](respondWithResult(_0x30ee39,null))[_0xf7c4('0x3d')](handleError(_0x30ee39,null));}; \ No newline at end of file +var _0xc5c4=['lodash','crypto','jsforce','desk.js','to-csv','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','update','then','destroy','error','stack','name','send','index','JscriptyAnswerReport','model','keys','query','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','dateEnd','add','day','merge','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','describe','bluebird','util','sox','ejs'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xc5c4,0x108));var _0x4c5c=function(_0x411c52,_0x5ab366){_0x411c52=_0x411c52-0x0;var _0x324dd7=_0xc5c4[_0x411c52];return _0x324dd7;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4c5c('0x0'));var Mustache=require('mustache');var util=require(_0x4c5c('0x1'));var path=require('path');var sox=require(_0x4c5c('0x2'));var csv=require('to-csv');var ejs=require(_0x4c5c('0x3'));var fs=require('fs');var _=require(_0x4c5c('0x4'));var squel=require('squel');var crypto=require(_0x4c5c('0x5'));var jsforce=require(_0x4c5c('0x6'));var deskjs=require(_0x4c5c('0x7'));var toCsv=require(_0x4c5c('0x8'));var querystring=require(_0x4c5c('0x9'));var Papa=require(_0x4c5c('0xa'));var qs=require(_0x4c5c('0xb'));var logger=require(_0x4c5c('0xc'))(_0x4c5c('0xd'));var utils=require(_0x4c5c('0xe'));var config=require(_0x4c5c('0xf'));var db=require(_0x4c5c('0x10'))['db'];function respondWithStatusCode(_0x58aadf,_0x5c610c){_0x5c610c=_0x5c610c||0xcc;return function(_0xbbd25e){if(_0xbbd25e){return _0x58aadf[_0x4c5c('0x11')](_0x5c610c);}return _0x58aadf['status'](_0x5c610c)[_0x4c5c('0x12')]();};}function respondWithResult(_0x2c2423,_0xf23c9f){_0xf23c9f=_0xf23c9f||0xc8;return function(_0x2e5b94){if(_0x2e5b94){return _0x2c2423[_0x4c5c('0x13')](_0xf23c9f)[_0x4c5c('0x14')](_0x2e5b94);}};}function respondWithFilteredResult(_0x41015c,_0x3ad474){return function(_0x10feb4){if(_0x10feb4){var _0x8e1931=_0x10feb4[_0x4c5c('0x15')],_0xe6c4e4=_0x3ad474[_0x4c5c('0x16')],_0x6dee98=_0x3ad474[_0x4c5c('0x16')]+_0x3ad474[_0x4c5c('0x17')],_0x291fc4;if(_0x6dee98>=_0x8e1931){_0x6dee98=_0x8e1931;_0x291fc4=0xc8;}else{_0x291fc4=0xce;}_0x41015c[_0x4c5c('0x13')](_0x291fc4);return _0x41015c[_0x4c5c('0x18')](_0x4c5c('0x19'),_0xe6c4e4+'-'+_0x6dee98+'/'+_0x8e1931)[_0x4c5c('0x14')](_0x10feb4);}return null;};}function patchUpdates(_0x62f860){return function(_0x2cbb68){try{jsonpatch[_0x4c5c('0x1a')](_0x2cbb68,_0x62f860,!![]);}catch(_0x203e5b){return BPromise[_0x4c5c('0x1b')](_0x203e5b);}return _0x2cbb68['save']();};}function saveUpdates(_0x33ec47,_0x211b20){return function(_0x18a04c){if(_0x18a04c){return _0x18a04c[_0x4c5c('0x1c')](_0x33ec47)[_0x4c5c('0x1d')](function(_0x39cfd7){return _0x39cfd7;});}return null;};}function removeEntity(_0x2ca1cb,_0x4ed84b){return function(_0x1ad492){if(_0x1ad492){return _0x1ad492[_0x4c5c('0x1e')]()[_0x4c5c('0x1d')](function(){_0x2ca1cb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b2fe0,_0x5ec846){return function(_0x146230){if(!_0x146230){_0x1b2fe0[_0x4c5c('0x11')](0x194);}return _0x146230;};}function handleError(_0x32a059,_0x3013e1){_0x3013e1=_0x3013e1||0x1f4;return function(_0x3aad18){logger[_0x4c5c('0x1f')](_0x3aad18[_0x4c5c('0x20')]);if(_0x3aad18[_0x4c5c('0x21')]){delete _0x3aad18[_0x4c5c('0x21')];}_0x32a059[_0x4c5c('0x13')](_0x3013e1)[_0x4c5c('0x22')](_0x3aad18);};}exports[_0x4c5c('0x23')]=function(_0x8c23d1,_0x137af7){var _0x5e02df={},_0x46f185={},_0x44f0bb={'count':0x0,'rows':[]};var _0x183c03=db[_0x4c5c('0x24')]['rawAttributes'];_0x46f185[_0x4c5c('0x25')]=_[_0x4c5c('0x26')](_0x183c03);var _0x2a7bc0={'dateStart':_0x8c23d1[_0x4c5c('0x27')][_0x4c5c('0x28')],'dateEnd':_0x8c23d1[_0x4c5c('0x27')]['dateEnd']};delete _0x8c23d1[_0x4c5c('0x27')][_0x4c5c('0x28')];delete _0x8c23d1[_0x4c5c('0x27')]['dateEnd'];_0x46f185[_0x4c5c('0x27')]=_[_0x4c5c('0x26')](_0x8c23d1[_0x4c5c('0x27')]);_0x46f185[_0x4c5c('0x29')]=_[_0x4c5c('0x2a')](_0x46f185[_0x4c5c('0x25')],_0x46f185[_0x4c5c('0x27')]);_0x5e02df[_0x4c5c('0x2b')]=_[_0x4c5c('0x2a')](_0x46f185[_0x4c5c('0x25')],qs[_0x4c5c('0x2c')](_0x8c23d1[_0x4c5c('0x27')][_0x4c5c('0x2c')]));_0x5e02df[_0x4c5c('0x2b')]=_0x5e02df[_0x4c5c('0x2b')][_0x4c5c('0x2d')]?_0x5e02df[_0x4c5c('0x2b')]:_0x46f185[_0x4c5c('0x25')];if(!_0x8c23d1[_0x4c5c('0x27')][_0x4c5c('0x2e')]('nolimit')){_0x5e02df[_0x4c5c('0x17')]=qs['limit'](_0x8c23d1[_0x4c5c('0x27')]['limit']);_0x5e02df[_0x4c5c('0x16')]=qs[_0x4c5c('0x16')](_0x8c23d1[_0x4c5c('0x27')]['offset']);}_0x5e02df[_0x4c5c('0x2f')]=qs[_0x4c5c('0x30')](_0x8c23d1['query'][_0x4c5c('0x30')]);_0x5e02df[_0x4c5c('0x31')]=qs[_0x4c5c('0x29')](_['pick'](_0x8c23d1['query'],_0x46f185['filters']));if(_0x2a7bc0[_0x4c5c('0x28')]){if(_0x2a7bc0['dateEnd']){_0x2a7bc0[_0x4c5c('0x32')]=moment(_0x2a7bc0[_0x4c5c('0x32')])[_0x4c5c('0x33')](0x1,_0x4c5c('0x34'));}else{_0x2a7bc0[_0x4c5c('0x32')]=moment(_0x2a7bc0[_0x4c5c('0x28')])[_0x4c5c('0x33')](0x1,_0x4c5c('0x34'));}_[_0x4c5c('0x35')](_0x5e02df[_0x4c5c('0x31')],{'createdAt':{'$gte':_0x2a7bc0[_0x4c5c('0x28')],'$lte':_0x2a7bc0[_0x4c5c('0x32')]}});}if(_0x8c23d1[_0x4c5c('0x27')][_0x4c5c('0x36')]){_0x5e02df[_0x4c5c('0x31')]=_[_0x4c5c('0x35')](_0x5e02df[_0x4c5c('0x31')],{'$or':_['map'](_0x5e02df['attributes'],function(_0x1db17b){var _0x26be1={};_0x26be1[_0x1db17b]={'$like':'%'+_0x8c23d1[_0x4c5c('0x27')][_0x4c5c('0x36')]+'%'};return _0x26be1;})});}_0x5e02df=_[_0x4c5c('0x35')]({},_0x5e02df,_0x8c23d1[_0x4c5c('0x37')]);var _0x357695={'where':_0x5e02df[_0x4c5c('0x31')]};return db[_0x4c5c('0x24')]['count'](_0x357695)[_0x4c5c('0x1d')](function(_0x25a295){_0x44f0bb[_0x4c5c('0x15')]=_0x25a295;if(_0x8c23d1[_0x4c5c('0x27')][_0x4c5c('0x38')]){_0x5e02df[_0x4c5c('0x39')]=[{'all':!![]}];}return db[_0x4c5c('0x24')][_0x4c5c('0x3a')](_0x5e02df);})[_0x4c5c('0x1d')](function(_0xe2e76b){_0x44f0bb[_0x4c5c('0x3b')]=_0xe2e76b;return _0x44f0bb;})[_0x4c5c('0x1d')](respondWithFilteredResult(_0x137af7,_0x5e02df))[_0x4c5c('0x3c')](handleError(_0x137af7,null));};exports['show']=function(_0x5445bb,_0x1b0ef7){var _0x508ef1={'raw':!![],'where':{'id':_0x5445bb[_0x4c5c('0x3d')]['id']}},_0x1a9ca4={};_0x1a9ca4[_0x4c5c('0x25')]=_[_0x4c5c('0x26')](db[_0x4c5c('0x24')][_0x4c5c('0x3e')]);_0x1a9ca4[_0x4c5c('0x27')]=_[_0x4c5c('0x26')](_0x5445bb[_0x4c5c('0x27')]);_0x1a9ca4['filters']=_['intersection'](_0x1a9ca4[_0x4c5c('0x25')],_0x1a9ca4['query']);_0x508ef1[_0x4c5c('0x2b')]=_[_0x4c5c('0x2a')](_0x1a9ca4[_0x4c5c('0x25')],qs['fields'](_0x5445bb[_0x4c5c('0x27')][_0x4c5c('0x2c')]));_0x508ef1['attributes']=_0x508ef1[_0x4c5c('0x2b')][_0x4c5c('0x2d')]?_0x508ef1[_0x4c5c('0x2b')]:_0x1a9ca4['model'];if(_0x5445bb[_0x4c5c('0x27')][_0x4c5c('0x38')]){_0x508ef1[_0x4c5c('0x39')]=[{'all':!![]}];}_0x508ef1=_['merge']({},_0x508ef1,_0x5445bb[_0x4c5c('0x37')]);return db[_0x4c5c('0x24')][_0x4c5c('0x3f')](_0x508ef1)['then'](handleEntityNotFound(_0x1b0ef7,null))[_0x4c5c('0x1d')](respondWithResult(_0x1b0ef7,null))[_0x4c5c('0x3c')](handleError(_0x1b0ef7,null));};exports[_0x4c5c('0x40')]=function(_0x1056f7,_0x1561cd){return db[_0x4c5c('0x24')][_0x4c5c('0x40')](_0x1056f7['body'],{})[_0x4c5c('0x1d')](respondWithResult(_0x1561cd,0xc9))[_0x4c5c('0x3c')](handleError(_0x1561cd,null));};exports[_0x4c5c('0x1c')]=function(_0x35a696,_0x3cee35){if(_0x35a696[_0x4c5c('0x41')]['id']){delete _0x35a696[_0x4c5c('0x41')]['id'];}return db['JscriptyAnswerReport'][_0x4c5c('0x3f')]({'where':{'id':_0x35a696[_0x4c5c('0x3d')]['id']}})[_0x4c5c('0x1d')](handleEntityNotFound(_0x3cee35,null))['then'](saveUpdates(_0x35a696['body'],null))[_0x4c5c('0x1d')](respondWithResult(_0x3cee35,null))['catch'](handleError(_0x3cee35,null));};exports[_0x4c5c('0x1e')]=function(_0x4d4655,_0x140207){return db['JscriptyAnswerReport'][_0x4c5c('0x3f')]({'where':{'id':_0x4d4655[_0x4c5c('0x3d')]['id']}})[_0x4c5c('0x1d')](handleEntityNotFound(_0x140207,null))[_0x4c5c('0x1d')](removeEntity(_0x140207,null))[_0x4c5c('0x3c')](handleError(_0x140207,null));};exports[_0x4c5c('0x42')]=function(_0x14ba03,_0x478972){return db[_0x4c5c('0x24')][_0x4c5c('0x42')]()[_0x4c5c('0x1d')](respondWithResult(_0x478972,null))[_0x4c5c('0x3c')](handleError(_0x478972,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 3d181f6..7291e40 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 _0x9955=['./jscriptyAnswerReport.attributes','JscriptyAnswerReport','report_jscripty_answers','api','moment','bluebird','request-promise'];(function(_0x31cea9,_0x4dbaf5){var _0x485fa2=function(_0x2851c4){while(--_0x2851c4){_0x31cea9['push'](_0x31cea9['shift']());}};_0x485fa2(++_0x4dbaf5);}(_0x9955,0x16f));var _0x5995=function(_0x5d04c1,_0x351817){_0x5d04c1=_0x5d04c1-0x0;var _0x3b1771=_0x9955[_0x5d04c1];return _0x3b1771;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5995('0x0'));var moment=require(_0x5995('0x1'));var BPromise=require(_0x5995('0x2'));var rp=require(_0x5995('0x3'));var attributes=require(_0x5995('0x4'));module['exports']=function(_0x60ed71,_0x294745){return _0x60ed71['define'](_0x5995('0x5'),attributes,{'tableName':_0x5995('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ce5=['lodash','util','api','bluebird','request-promise','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport'];(function(_0x1fb1c1,_0x4ebe69){var _0x1622df=function(_0x52b793){while(--_0x52b793){_0x1fb1c1['push'](_0x1fb1c1['shift']());}};_0x1622df(++_0x4ebe69);}(_0x5ce5,0x6c));var _0x55ce=function(_0x5c8764,_0x292efe){_0x5c8764=_0x5c8764-0x0;var _0x5e2ac2=_0x5ce5[_0x5c8764];return _0x5e2ac2;};'use strict';var _=require(_0x55ce('0x0'));var util=require(_0x55ce('0x1'));var logger=require('../../config/logger')(_0x55ce('0x2'));var moment=require('moment');var BPromise=require(_0x55ce('0x3'));var rp=require(_0x55ce('0x4'));var attributes=require(_0x55ce('0x5'));module[_0x55ce('0x6')]=function(_0x3d9633,_0x7848fa){return _0x3d9633[_0x55ce('0x7')](_0x55ce('0x8'),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 87d56a0..c4d3c6f 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 _0xe484=['then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x346e28,_0x3f22ba){var _0x23df8c=function(_0x3bed59){while(--_0x3bed59){_0x346e28['push'](_0x346e28['shift']());}};_0x23df8c(++_0x3f22ba);}(_0xe484,0x181));var _0x4e48=function(_0x52a321,_0x1916ce){_0x52a321=_0x52a321-0x0;var _0x49b178=_0xe484[_0x52a321];return _0x49b178;};'use strict';var _=require(_0x4e48('0x0'));var util=require(_0x4e48('0x1'));var moment=require(_0x4e48('0x2'));var BPromise=require(_0x4e48('0x3'));var rs=require(_0x4e48('0x4'));var fs=require('fs');var db=require(_0x4e48('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4e48('0x6'));var config=require(_0x4e48('0x7'));var jayson=require(_0x4e48('0x8'));var client=jayson['client'][_0x4e48('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27a3fe,_0x22333c,_0x4da0df){return new BPromise(function(_0x2ad51a,_0x22b2c4){return client[_0x4e48('0xa')](_0x27a3fe,_0x4da0df)[_0x4e48('0xb')](function(_0x23cef2){logger[_0x4e48('0xc')](_0x4e48('0xd'),_0x22333c,_0x4e48('0xe'));logger[_0x4e48('0xf')](_0x4e48('0x10'),_0x22333c,_0x4e48('0xe'),JSON[_0x4e48('0x11')](_0x23cef2));if(_0x23cef2[_0x4e48('0x12')]){if(_0x23cef2['error'][_0x4e48('0x13')]===0x1f4){logger[_0x4e48('0x12')](_0x4e48('0xd'),_0x22333c,_0x23cef2[_0x4e48('0x12')][_0x4e48('0x14')]);return _0x22b2c4(_0x23cef2[_0x4e48('0x12')][_0x4e48('0x14')]);}logger['error'](_0x4e48('0xd'),_0x22333c,_0x23cef2['error'][_0x4e48('0x14')]);return _0x2ad51a(_0x23cef2['error'][_0x4e48('0x14')]);}else{logger['info'](_0x4e48('0xd'),_0x22333c,_0x4e48('0xe'));_0x2ad51a(_0x23cef2[_0x4e48('0x15')][_0x4e48('0x14')]);}})['catch'](function(_0x29b49e){logger[_0x4e48('0x12')](_0x4e48('0xd'),_0x22333c,_0x29b49e);_0x22b2c4(_0x29b49e);});});} \ No newline at end of file +var _0xf8c7=['info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyAnswerReport,\x20%s,\x20%s','message'];(function(_0x4b25ea,_0x52a3b6){var _0x41e3d4=function(_0x10585b){while(--_0x10585b){_0x4b25ea['push'](_0x4b25ea['shift']());}};_0x41e3d4(++_0x52a3b6);}(_0xf8c7,0x12e));var _0x7f8c=function(_0x1499c2,_0x365ac7){_0x1499c2=_0x1499c2-0x0;var _0x54d020=_0xf8c7[_0x1499c2];return _0x54d020;};'use strict';var _=require(_0x7f8c('0x0'));var util=require(_0x7f8c('0x1'));var moment=require(_0x7f8c('0x2'));var BPromise=require(_0x7f8c('0x3'));var rs=require(_0x7f8c('0x4'));var fs=require('fs');var db=require(_0x7f8c('0x5'))['db'];var utils=require(_0x7f8c('0x6'));var logger=require(_0x7f8c('0x7'))('rpc');var config=require(_0x7f8c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7f8c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x209373,_0x13e929,_0x189072){return new BPromise(function(_0x2e3027,_0x452163){return client[_0x7f8c('0xa')](_0x209373,_0x189072)['then'](function(_0x456345){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x13e929,_0x7f8c('0xb'));logger[_0x7f8c('0xc')](_0x7f8c('0xd'),_0x13e929,_0x7f8c('0xb'),JSON[_0x7f8c('0xe')](_0x456345));if(_0x456345['error']){if(_0x456345['error']['code']===0x1f4){logger[_0x7f8c('0xf')](_0x7f8c('0x10'),_0x13e929,_0x456345[_0x7f8c('0xf')][_0x7f8c('0x11')]);return _0x452163(_0x456345[_0x7f8c('0xf')][_0x7f8c('0x11')]);}logger[_0x7f8c('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x13e929,_0x456345[_0x7f8c('0xf')]['message']);return _0x2e3027(_0x456345[_0x7f8c('0xf')]['message']);}else{logger[_0x7f8c('0x12')](_0x7f8c('0x10'),_0x13e929,_0x7f8c('0xb'));_0x2e3027(_0x456345[_0x7f8c('0x13')][_0x7f8c('0x11')]);}})['catch'](function(_0x38e6be){logger['error'](_0x7f8c('0x10'),_0x13e929,_0x38e6be);_0x452163(_0x38e6be);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 1399c02..f153b93 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 _0x6f47=['exports','util','path','Router','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','/:id/summary','post','create','/:id/clone','clone','put','update','delete'];(function(_0x428a5e,_0x37c2ef){var _0x453253=function(_0x399f1b){while(--_0x399f1b){_0x428a5e['push'](_0x428a5e['shift']());}};_0x453253(++_0x37c2ef);}(_0x6f47,0xc7));var _0x76f4=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x6f47[_0x2a6809];return _0x11c371;};'use strict';var multer=require('multer');var util=require(_0x76f4('0x0'));var path=require(_0x76f4('0x1'));var express=require('express');var router=express[_0x76f4('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x76f4('0x3'));var config=require('../../config/environment');var controller=require(_0x76f4('0x4'));router[_0x76f4('0x5')]('/',auth[_0x76f4('0x6')](),controller[_0x76f4('0x7')]);router['get'](_0x76f4('0x8'),auth[_0x76f4('0x6')](),controller[_0x76f4('0x9')]);router['get'](_0x76f4('0xa'),auth[_0x76f4('0x6')](),controller[_0x76f4('0xb')]);router[_0x76f4('0x5')](_0x76f4('0xc'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x76f4('0x5')](_0x76f4('0xd'),auth['isAuthenticated'](),controller['getSummary']);router[_0x76f4('0xe')]('/',auth[_0x76f4('0x6')](),controller[_0x76f4('0xf')]);router[_0x76f4('0xe')](_0x76f4('0x10'),auth[_0x76f4('0x6')](),controller[_0x76f4('0x11')]);router[_0x76f4('0x12')](_0x76f4('0x8'),auth['isAuthenticated'](),controller[_0x76f4('0x13')]);router[_0x76f4('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x76f4('0x15')]=router; \ No newline at end of file +var _0x31f0=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','create','/:id/clone','clone','put','/:id','update','delete','destroy','multer'];(function(_0x5ebc18,_0x25f463){var _0x1c4364=function(_0xd953ea){while(--_0xd953ea){_0x5ebc18['push'](_0x5ebc18['shift']());}};_0x1c4364(++_0x25f463);}(_0x31f0,0xb7));var _0x031f=function(_0x3ae7f7,_0x1b0be1){_0x3ae7f7=_0x3ae7f7-0x0;var _0x45058c=_0x31f0[_0x3ae7f7];return _0x45058c;};'use strict';var multer=require(_0x031f('0x0'));var util=require('util');var path=require(_0x031f('0x1'));var express=require('express');var router=express[_0x031f('0x2')]();var auth=require(_0x031f('0x3'));var interaction=require(_0x031f('0x4'));var config=require(_0x031f('0x5'));var controller=require('./jscriptyProject.controller');router[_0x031f('0x6')]('/',auth[_0x031f('0x7')](),controller['index']);router['get']('/:id',auth[_0x031f('0x7')](),controller['show']);router[_0x031f('0x6')](_0x031f('0x8'),auth[_0x031f('0x7')](),controller[_0x031f('0x9')]);router['get'](_0x031f('0xa'),auth[_0x031f('0x7')](),controller[_0x031f('0xb')]);router[_0x031f('0x6')](_0x031f('0xc'),auth[_0x031f('0x7')](),controller[_0x031f('0xd')]);router[_0x031f('0xe')]('/',auth['isAuthenticated'](),controller[_0x031f('0xf')]);router[_0x031f('0xe')](_0x031f('0x10'),auth[_0x031f('0x7')](),controller[_0x031f('0x11')]);router[_0x031f('0x12')](_0x031f('0x13'),auth['isAuthenticated'](),controller[_0x031f('0x14')]);router[_0x031f('0x15')](_0x031f('0x13'),auth[_0x031f('0x7')](),controller[_0x031f('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 e673cd5..2fdbd6e 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 _0x4797=['TEXT','isObjectLike','setDataValue','formData','isString','format','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','name'];(function(_0x2bfc39,_0x53718e){var _0x43fed3=function(_0x23845e){while(--_0x23845e){_0x2bfc39['push'](_0x2bfc39['shift']());}};_0x43fed3(++_0x53718e);}(_0x4797,0x1c9));var _0x7479=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4797[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x7479('0x0'));var _=require(_0x7479('0x1'));var util=require(_0x7479('0x2'));module[_0x7479('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0x7479('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x7479('0x5')]('long'),'set':function(_0x4b5425){if(_[_0x7479('0x6')](_0x4b5425)){this[_0x7479('0x7')](_0x7479('0x8'),JSON['stringify'](_0x4b5425));}else if(_[_0x7479('0x9')](_0x4b5425)){this[_0x7479('0x7')]('formData',_0x4b5425);}else{this[_0x7479('0x7')](_0x7479('0x8'),util[_0x7479('0xa')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x7479('0xb')]('name')||'',this[_0x7479('0xb')](_0x7479('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x7479('0xd')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc1e3=['TEXT','long','isObjectLike','setDataValue','formData','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','sequelize','lodash','util','exports','STRING'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xc1e3,0x190));var _0x3c1e=function(_0x2bf984,_0x4d4145){_0x2bf984=_0x2bf984-0x0;var _0x279bd8=_0xc1e3[_0x2bf984];return _0x279bd8;};'use strict';var Sequelize=require(_0x3c1e('0x0'));var _=require(_0x3c1e('0x1'));var util=require(_0x3c1e('0x2'));module[_0x3c1e('0x3')]={'name':{'type':Sequelize[_0x3c1e('0x4')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x3c1e('0x5')](_0x3c1e('0x6')),'set':function(_0x125e32){if(_[_0x3c1e('0x7')](_0x125e32)){this[_0x3c1e('0x8')](_0x3c1e('0x9'),JSON['stringify'](_0x125e32));}else if(_[_0x3c1e('0xa')](_0x125e32)){this[_0x3c1e('0x8')]('formData',_0x125e32);}else{this[_0x3c1e('0x8')](_0x3c1e('0x9'),util[_0x3c1e('0xb')](_0x3c1e('0xc'),this[_0x3c1e('0xd')]('name')||'',this[_0x3c1e('0xd')](_0x3c1e('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 49890a6..a00c32c 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 _0x3b9a=['filter','map','options','JscriptyProject','count','includeAll','rows','catch','show','params','rawAttributes','find','create','body','clone','omit','createdAt','updatedAt','getSessions','JscriptySessionReport','ProjectId','include','getAnswers','JscriptyAnswerReport','findAll','toString','indexOf','replace','getSummary','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','SessionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','text/csv','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','jsforce','desk.js','api','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','model','keys','query','dateStart','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','dateEnd','add','day','merge','where'];(function(_0x2d0726,_0x8b5733){var _0x5aceea=function(_0x351c70){while(--_0x351c70){_0x2d0726['push'](_0x2d0726['shift']());}};_0x5aceea(++_0x8b5733);}(_0x3b9a,0x198));var _0xa3b9=function(_0x4a6992,_0x5d52ee){_0x4a6992=_0x4a6992-0x0;var _0x4c640a=_0x3b9a[_0x4a6992];return _0x4c640a;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xa3b9('0x0'));var moment=require(_0xa3b9('0x1'));var BPromise=require(_0xa3b9('0x2'));var Mustache=require(_0xa3b9('0x3'));var util=require('util');var path=require('path');var sox=require(_0xa3b9('0x4'));var csv=require(_0xa3b9('0x5'));var ejs=require(_0xa3b9('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa3b9('0x7'));var crypto=require('crypto');var jsforce=require(_0xa3b9('0x8'));var deskjs=require(_0xa3b9('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xa3b9('0xa'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xa3b9('0xb'))['db'];function respondWithStatusCode(_0x5b3bf4,_0x566a03){_0x566a03=_0x566a03||0xcc;return function(_0x8a06e7){if(_0x8a06e7){return _0x5b3bf4[_0xa3b9('0xc')](_0x566a03);}return _0x5b3bf4[_0xa3b9('0xd')](_0x566a03)[_0xa3b9('0xe')]();};}function respondWithResult(_0x51a74b,_0x2452de){_0x2452de=_0x2452de||0xc8;return function(_0x36e8d2){if(_0x36e8d2){return _0x51a74b[_0xa3b9('0xd')](_0x2452de)[_0xa3b9('0xf')](_0x36e8d2);}};}function respondWithFilteredResult(_0x320980,_0x17b871){return function(_0x40f5e5){if(_0x40f5e5){var _0x314ba8=_0x40f5e5['count'],_0x571c30=_0x17b871[_0xa3b9('0x10')],_0x45263c=_0x17b871[_0xa3b9('0x10')]+_0x17b871[_0xa3b9('0x11')],_0x580516;if(_0x45263c>=_0x314ba8){_0x45263c=_0x314ba8;_0x580516=0xc8;}else{_0x580516=0xce;}_0x320980[_0xa3b9('0xd')](_0x580516);return _0x320980['set'](_0xa3b9('0x12'),_0x571c30+'-'+_0x45263c+'/'+_0x314ba8)[_0xa3b9('0xf')](_0x40f5e5);}return null;};}function patchUpdates(_0x54997f){return function(_0x7f5948){try{jsonpatch[_0xa3b9('0x13')](_0x7f5948,_0x54997f,!![]);}catch(_0x42f1e4){return BPromise[_0xa3b9('0x14')](_0x42f1e4);}return _0x7f5948[_0xa3b9('0x15')]();};}function saveUpdates(_0x59f460,_0x574d47){return function(_0x3cd616){if(_0x3cd616){return _0x3cd616[_0xa3b9('0x16')](_0x59f460)[_0xa3b9('0x17')](function(_0x1144fb){return _0x1144fb;});}return null;};}function removeEntity(_0x10a854,_0x3e0c55){return function(_0x2a9d46){if(_0x2a9d46){return _0x2a9d46[_0xa3b9('0x18')]()[_0xa3b9('0x17')](function(){_0x10a854[_0xa3b9('0xd')](0xcc)[_0xa3b9('0xe')]();});}};}function handleEntityNotFound(_0x351613,_0xf6f68b){return function(_0x8f8712){if(!_0x8f8712){_0x351613[_0xa3b9('0xc')](0x194);}return _0x8f8712;};}function handleError(_0x31e624,_0x5e62fa){_0x5e62fa=_0x5e62fa||0x1f4;return function(_0x2680f0){logger['error'](_0x2680f0[_0xa3b9('0x19')]);if(_0x2680f0[_0xa3b9('0x1a')]){delete _0x2680f0[_0xa3b9('0x1a')];}_0x31e624[_0xa3b9('0xd')](_0x5e62fa)['send'](_0x2680f0);};}exports[_0xa3b9('0x1b')]=function(_0x53a725,_0x35df78){var _0x5bad69={},_0x5767e2={},_0x578ab4={'count':0x0,'rows':[]};var _0xb4e701=db['JscriptyProject']['rawAttributes'];_0x5767e2[_0xa3b9('0x1c')]=_[_0xa3b9('0x1d')](_0xb4e701);var _0x151be5={'dateStart':_0x53a725[_0xa3b9('0x1e')][_0xa3b9('0x1f')],'dateEnd':_0x53a725[_0xa3b9('0x1e')]['dateEnd']};delete _0x53a725[_0xa3b9('0x1e')][_0xa3b9('0x1f')];delete _0x53a725['query']['dateEnd'];_0x5767e2[_0xa3b9('0x1e')]=_[_0xa3b9('0x1d')](_0x53a725['query']);_0x5767e2[_0xa3b9('0x20')]=_['intersection'](_0x5767e2[_0xa3b9('0x1c')],_0x5767e2['query']);_0x5bad69['attributes']=_[_0xa3b9('0x21')](_0x5767e2[_0xa3b9('0x1c')],qs[_0xa3b9('0x22')](_0x53a725[_0xa3b9('0x1e')][_0xa3b9('0x22')]));_0x5bad69[_0xa3b9('0x23')]=_0x5bad69[_0xa3b9('0x23')][_0xa3b9('0x24')]?_0x5bad69[_0xa3b9('0x23')]:_0x5767e2['model'];if(!_0x53a725[_0xa3b9('0x1e')][_0xa3b9('0x25')](_0xa3b9('0x26'))){_0x5bad69[_0xa3b9('0x11')]=qs[_0xa3b9('0x11')](_0x53a725[_0xa3b9('0x1e')][_0xa3b9('0x11')]);_0x5bad69['offset']=qs[_0xa3b9('0x10')](_0x53a725[_0xa3b9('0x1e')][_0xa3b9('0x10')]);}_0x5bad69[_0xa3b9('0x27')]=qs[_0xa3b9('0x28')](_0x53a725[_0xa3b9('0x1e')]['sort']);_0x5bad69['where']=qs[_0xa3b9('0x20')](_[_0xa3b9('0x29')](_0x53a725[_0xa3b9('0x1e')],_0x5767e2[_0xa3b9('0x20')]));if(_0x151be5[_0xa3b9('0x1f')]){if(_0x151be5[_0xa3b9('0x2a')]){_0x151be5[_0xa3b9('0x2a')]=moment(_0x151be5[_0xa3b9('0x2a')])[_0xa3b9('0x2b')](0x1,_0xa3b9('0x2c'));}else{_0x151be5[_0xa3b9('0x2a')]=moment(_0x151be5[_0xa3b9('0x1f')])[_0xa3b9('0x2b')](0x1,_0xa3b9('0x2c'));}_[_0xa3b9('0x2d')](_0x5bad69[_0xa3b9('0x2e')],{'createdAt':{'$gte':_0x151be5[_0xa3b9('0x1f')],'$lte':_0x151be5[_0xa3b9('0x2a')]}});}if(_0x53a725['query'][_0xa3b9('0x2f')]){_0x5bad69[_0xa3b9('0x2e')]=_[_0xa3b9('0x2d')](_0x5bad69['where'],{'$or':_[_0xa3b9('0x30')](_0x5bad69[_0xa3b9('0x23')],function(_0x4360ce){var _0xa22d98={};_0xa22d98[_0x4360ce]={'$like':'%'+_0x53a725[_0xa3b9('0x1e')][_0xa3b9('0x2f')]+'%'};return _0xa22d98;})});}_0x5bad69=_[_0xa3b9('0x2d')]({},_0x5bad69,_0x53a725[_0xa3b9('0x31')]);var _0x135be9={'where':_0x5bad69[_0xa3b9('0x2e')]};return db[_0xa3b9('0x32')][_0xa3b9('0x33')](_0x135be9)['then'](function(_0x42b200){_0x578ab4[_0xa3b9('0x33')]=_0x42b200;if(_0x53a725[_0xa3b9('0x1e')][_0xa3b9('0x34')]){_0x5bad69['include']=[{'all':!![]}];}return db[_0xa3b9('0x32')]['findAll'](_0x5bad69);})[_0xa3b9('0x17')](function(_0x12b773){_0x578ab4[_0xa3b9('0x35')]=_0x12b773;return _0x578ab4;})[_0xa3b9('0x17')](respondWithFilteredResult(_0x35df78,_0x5bad69))[_0xa3b9('0x36')](handleError(_0x35df78,null));};exports[_0xa3b9('0x37')]=function(_0x4dcd67,_0xee6921){var _0x531ba9={'raw':![],'where':{'id':_0x4dcd67[_0xa3b9('0x38')]['id']}},_0x105782={};_0x105782[_0xa3b9('0x1c')]=_[_0xa3b9('0x1d')](db[_0xa3b9('0x32')][_0xa3b9('0x39')]);_0x105782[_0xa3b9('0x1e')]=_[_0xa3b9('0x1d')](_0x4dcd67[_0xa3b9('0x1e')]);_0x105782[_0xa3b9('0x20')]=_[_0xa3b9('0x21')](_0x105782[_0xa3b9('0x1c')],_0x105782[_0xa3b9('0x1e')]);_0x531ba9['attributes']=_[_0xa3b9('0x21')](_0x105782['model'],qs['fields'](_0x4dcd67['query'][_0xa3b9('0x22')]));_0x531ba9[_0xa3b9('0x23')]=_0x531ba9[_0xa3b9('0x23')][_0xa3b9('0x24')]?_0x531ba9[_0xa3b9('0x23')]:_0x105782[_0xa3b9('0x1c')];if(_0x4dcd67['query'][_0xa3b9('0x34')]){_0x531ba9['include']=[{'all':!![]}];}_0x531ba9=_[_0xa3b9('0x2d')]({},_0x531ba9,_0x4dcd67[_0xa3b9('0x31')]);return db[_0xa3b9('0x32')][_0xa3b9('0x3a')](_0x531ba9)['then'](handleEntityNotFound(_0xee6921,null))[_0xa3b9('0x17')](respondWithResult(_0xee6921,null))[_0xa3b9('0x36')](handleError(_0xee6921,null));};exports['create']=function(_0x18583c,_0x32bdf1){return db['JscriptyProject'][_0xa3b9('0x3b')](_0x18583c[_0xa3b9('0x3c')],{})[_0xa3b9('0x17')](respondWithResult(_0x32bdf1,0xc9))[_0xa3b9('0x36')](handleError(_0x32bdf1,null));};exports[_0xa3b9('0x3d')]=function(_0x29a079,_0x2a102d){var _0x5b3311={'raw':![],'where':{'id':_0x29a079['params']['id']}},_0x3c68a4={};_0x3c68a4[_0xa3b9('0x1c')]=_[_0xa3b9('0x1d')](db[_0xa3b9('0x32')][_0xa3b9('0x39')]);_0x5b3311['attributes']=_[_0xa3b9('0x21')](_0x3c68a4['model'],qs[_0xa3b9('0x22')](_0x29a079[_0xa3b9('0x1e')]['fields']));_0x5b3311[_0xa3b9('0x23')]=_0x5b3311[_0xa3b9('0x23')]['length']?_0x5b3311[_0xa3b9('0x23')]:_0x3c68a4[_0xa3b9('0x1c')];if(_0x29a079[_0xa3b9('0x1e')][_0xa3b9('0x34')]){_0x5b3311['include']=[{'all':!![]}];}_0x5b3311=_[_0xa3b9('0x2d')]({},_0x5b3311,_0x29a079[_0xa3b9('0x31')]);return db[_0xa3b9('0x32')][_0xa3b9('0x3a')](_0x5b3311)['then'](handleEntityNotFound(_0x2a102d,null))[_0xa3b9('0x17')](function(_0x5f207f){if(_0x5f207f){var _0x57da37=_0x5f207f['get']({'plain':!![]});_0x57da37=qs[_0xa3b9('0x3e')](_0x57da37,['id',_0xa3b9('0x3f'),'updatedAt']);_0x29a079[_0xa3b9('0x3c')]=_['omit'](_0x29a079[_0xa3b9('0x3c')],['id','createdAt',_0xa3b9('0x40')]);return db['JscriptyProject'][_0xa3b9('0x3b')](_[_0xa3b9('0x2d')](_0x57da37,_0x29a079['body']),{'include':_0x29a079[_0xa3b9('0x1e')][_0xa3b9('0x34')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x2a102d,0xc9))[_0xa3b9('0x36')](handleError(_0x2a102d,null));};exports[_0xa3b9('0x16')]=function(_0x285843,_0x306350){if(_0x285843[_0xa3b9('0x3c')]['id']){delete _0x285843[_0xa3b9('0x3c')]['id'];}return db[_0xa3b9('0x32')][_0xa3b9('0x3a')]({'where':{'id':_0x285843[_0xa3b9('0x38')]['id']}})[_0xa3b9('0x17')](handleEntityNotFound(_0x306350,null))[_0xa3b9('0x17')](saveUpdates(_0x285843[_0xa3b9('0x3c')],null))[_0xa3b9('0x17')](respondWithResult(_0x306350,null))[_0xa3b9('0x36')](handleError(_0x306350,null));};exports['destroy']=function(_0x147d06,_0x36105f){return db[_0xa3b9('0x32')]['find']({'where':{'id':_0x147d06[_0xa3b9('0x38')]['id']}})[_0xa3b9('0x17')](handleEntityNotFound(_0x36105f,null))[_0xa3b9('0x17')](removeEntity(_0x36105f,null))[_0xa3b9('0x36')](handleError(_0x36105f,null));};exports[_0xa3b9('0x41')]=function(_0x1a56e7,_0xa4c5b8,_0x4e5d69){var _0x1bc537={'raw':!![],'where':{}};var _0x5b1d03={};var _0x3d5fca={'count':0x0,'rows':[]};return db[_0xa3b9('0x32')]['findOne']({'where':{'id':_0x1a56e7[_0xa3b9('0x38')]['id']}})[_0xa3b9('0x17')](handleEntityNotFound(_0xa4c5b8,null))[_0xa3b9('0x17')](function(_0x4701a6){if(_0x4701a6){_0x5b1d03[_0xa3b9('0x1c')]=_[_0xa3b9('0x1d')](db[_0xa3b9('0x42')]['rawAttributes']);_0x5b1d03['query']=_[_0xa3b9('0x1d')](_0x1a56e7[_0xa3b9('0x1e')]);_0x5b1d03[_0xa3b9('0x20')]=_['intersection'](_0x5b1d03[_0xa3b9('0x1c')],_0x5b1d03[_0xa3b9('0x1e')]);_0x1bc537[_0xa3b9('0x23')]=_[_0xa3b9('0x21')](_0x5b1d03[_0xa3b9('0x1c')],qs[_0xa3b9('0x22')](_0x1a56e7[_0xa3b9('0x1e')]['fields']));_0x1bc537['attributes']=_0x1bc537[_0xa3b9('0x23')][_0xa3b9('0x24')]?_0x1bc537[_0xa3b9('0x23')]:_0x5b1d03[_0xa3b9('0x1c')];if(!_0x1a56e7[_0xa3b9('0x1e')][_0xa3b9('0x25')](_0xa3b9('0x26'))){_0x1bc537['limit']=qs[_0xa3b9('0x11')](_0x1a56e7[_0xa3b9('0x1e')][_0xa3b9('0x11')]);_0x1bc537[_0xa3b9('0x10')]=qs['offset'](_0x1a56e7[_0xa3b9('0x1e')][_0xa3b9('0x10')]);}_0x1bc537[_0xa3b9('0x27')]=qs[_0xa3b9('0x28')](_0x1a56e7[_0xa3b9('0x1e')][_0xa3b9('0x28')]);_0x1bc537[_0xa3b9('0x2e')]=qs['filters'](_['pick'](_0x1a56e7[_0xa3b9('0x1e')],_0x5b1d03[_0xa3b9('0x20')]));_0x1bc537[_0xa3b9('0x2e')][_0xa3b9('0x43')]=_0x4701a6['id'];if(_0x1a56e7['query'][_0xa3b9('0x2f')]){_0x1bc537[_0xa3b9('0x2e')]=_['merge'](_0x1bc537['where'],{'$or':_[_0xa3b9('0x30')](_0x1bc537['attributes'],function(_0x8656cc){var _0x32b8fc={};_0x32b8fc[_0x8656cc]={'$like':'%'+_0x1a56e7[_0xa3b9('0x1e')][_0xa3b9('0x2f')]+'%'};return _0x32b8fc;})});}_0x1bc537=_[_0xa3b9('0x2d')]({},_0x1bc537,_0x1a56e7[_0xa3b9('0x31')]);return db[_0xa3b9('0x42')][_0xa3b9('0x33')]({'where':_0x1bc537[_0xa3b9('0x2e')]})[_0xa3b9('0x17')](function(_0xbf61ac){_0x3d5fca[_0xa3b9('0x33')]=_0xbf61ac;if(_0x1a56e7['query'][_0xa3b9('0x34')]){_0x1bc537[_0xa3b9('0x44')]=[{'all':!![]}];}return db[_0xa3b9('0x42')]['findAll'](_0x1bc537);})[_0xa3b9('0x17')](function(_0x108133){_0x3d5fca[_0xa3b9('0x35')]=_0x108133;return _0x3d5fca;});}})[_0xa3b9('0x17')](respondWithFilteredResult(_0xa4c5b8,_0x1bc537))['catch'](handleError(_0xa4c5b8,null));};exports[_0xa3b9('0x45')]=function(_0x5ca225,_0x75a32b,_0x2c053b){var _0x4684dc={'raw':!![],'where':{}};var _0x485ed6={};var _0x1e773b={'count':0x0,'rows':[]};var _0x2a766f={'dateStart':_0x5ca225[_0xa3b9('0x1e')][_0xa3b9('0x1f')],'dateEnd':_0x5ca225[_0xa3b9('0x1e')][_0xa3b9('0x2a')]};delete _0x5ca225[_0xa3b9('0x1e')][_0xa3b9('0x1f')];delete _0x5ca225['query'][_0xa3b9('0x2a')];return db[_0xa3b9('0x32')]['findOne']({'where':{'id':_0x5ca225['params']['id']}})[_0xa3b9('0x17')](handleEntityNotFound(_0x75a32b,null))['then'](function(_0x5a92e5){if(_0x5a92e5){_0x485ed6[_0xa3b9('0x1c')]=_[_0xa3b9('0x1d')](db[_0xa3b9('0x46')]['rawAttributes']);_0x485ed6[_0xa3b9('0x1e')]=_[_0xa3b9('0x1d')](_0x5ca225[_0xa3b9('0x1e')]);_0x485ed6[_0xa3b9('0x20')]=_[_0xa3b9('0x21')](_0x485ed6[_0xa3b9('0x1c')],_0x485ed6[_0xa3b9('0x1e')]);_0x4684dc['attributes']=_[_0xa3b9('0x21')](_0x485ed6[_0xa3b9('0x1c')],qs[_0xa3b9('0x22')](_0x5ca225[_0xa3b9('0x1e')][_0xa3b9('0x22')]));_0x4684dc['attributes']=_0x4684dc['attributes'][_0xa3b9('0x24')]?_0x4684dc['attributes']:_0x485ed6[_0xa3b9('0x1c')];if(!_0x5ca225[_0xa3b9('0x1e')]['hasOwnProperty'](_0xa3b9('0x26'))){_0x4684dc[_0xa3b9('0x11')]=qs[_0xa3b9('0x11')](_0x5ca225[_0xa3b9('0x1e')][_0xa3b9('0x11')]);_0x4684dc[_0xa3b9('0x10')]=qs[_0xa3b9('0x10')](_0x5ca225[_0xa3b9('0x1e')][_0xa3b9('0x10')]);}_0x4684dc[_0xa3b9('0x27')]=qs[_0xa3b9('0x28')](_0x5ca225[_0xa3b9('0x1e')]['sort']);_0x4684dc[_0xa3b9('0x2e')]=qs['filters'](_[_0xa3b9('0x29')](_0x5ca225[_0xa3b9('0x1e')],_0x485ed6[_0xa3b9('0x20')]));_0x4684dc[_0xa3b9('0x2e')]['ProjectId']=_0x5a92e5['id'];if(_0x2a766f[_0xa3b9('0x1f')]){if(_0x2a766f[_0xa3b9('0x2a')]){_0x2a766f[_0xa3b9('0x2a')]=moment(_0x2a766f['dateEnd'])[_0xa3b9('0x2b')](0x1,_0xa3b9('0x2c'));}else{_0x2a766f[_0xa3b9('0x2a')]=moment(_0x2a766f[_0xa3b9('0x1f')])[_0xa3b9('0x2b')](0x1,_0xa3b9('0x2c'));}_[_0xa3b9('0x2d')](_0x4684dc[_0xa3b9('0x2e')],{'createdAt':{'$gte':_0x2a766f['dateStart'],'$lte':_0x2a766f[_0xa3b9('0x2a')]}});}if(_0x5ca225[_0xa3b9('0x1e')]['filter']){_0x4684dc[_0xa3b9('0x2e')]=_['merge'](_0x4684dc['where'],{'$or':_[_0xa3b9('0x30')](_0x4684dc[_0xa3b9('0x23')],function(_0x569b07){var _0x4f0894={};_0x4f0894[_0x569b07]={'$like':'%'+_0x5ca225[_0xa3b9('0x1e')]['filter']+'%'};return _0x4f0894;})});}_0x4684dc=_[_0xa3b9('0x2d')]({},_0x4684dc,_0x5ca225[_0xa3b9('0x31')]);return db[_0xa3b9('0x46')][_0xa3b9('0x33')]({'where':_0x4684dc[_0xa3b9('0x2e')]})[_0xa3b9('0x17')](function(_0x5d4a74){_0x1e773b['count']=_0x5d4a74;if(_0x5ca225['query'][_0xa3b9('0x34')]){_0x4684dc['include']=[{'all':!![]}];}return db[_0xa3b9('0x46')][_0xa3b9('0x47')](_0x4684dc);})[_0xa3b9('0x17')](function(_0x138904){_0x1e773b[_0xa3b9('0x35')]=_0x138904;return _0x1e773b;});}})[_0xa3b9('0x17')](respondWithFilteredResult(_0x75a32b,_0x4684dc))['catch'](handleError(_0x75a32b,null));};function char(_0x367a58){return'number'===typeof _0x367a58?String['fromCharCode']['apply'](null,arguments):_0x367a58;}function needsEncapsulation(_0x1b52c1){return!!_0x1b52c1&&(_0x1b52c1[_0xa3b9('0x48')]()['indexOf'](char(0xd))>=0x0||_0x1b52c1[_0xa3b9('0x48')]()['indexOf'](char(0xa))>=0x0||_0x1b52c1[_0xa3b9('0x48')]()[_0xa3b9('0x49')](char(0x2c))>=0x0||_0x1b52c1[_0xa3b9('0x48')]()[_0xa3b9('0x49')](char(0x22))>=0x0);}function encapsulate(_0x4aad36){var _0x525280=char(0x22),_0x4147ba='\x5c'+char(0x22),_0x4e6999=_0x4aad36[_0xa3b9('0x48')]()[_0xa3b9('0x4a')](new RegExp(_0x525280,'g'),_0x4147ba);return _0x525280+_0x4e6999+_0x525280;}exports[_0xa3b9('0x4b')]=function(_0xb3740b,_0x346a57,_0x5197ad){var _0x459a1a,_0x58fc00;var _0x34a599={'dateStart':_0xb3740b[_0xa3b9('0x1e')][_0xa3b9('0x1f')],'dateEnd':_0xb3740b[_0xa3b9('0x1e')][_0xa3b9('0x2a')]};delete _0xb3740b[_0xa3b9('0x1e')]['dateStart'];delete _0xb3740b[_0xa3b9('0x1e')]['dateEnd'];if(_0x34a599[_0xa3b9('0x1f')]){if(_0x34a599['dateEnd']){_0x34a599[_0xa3b9('0x2a')]=moment(_0x34a599[_0xa3b9('0x2a')])['add'](0x1,_0xa3b9('0x2c'));}else{_0x34a599[_0xa3b9('0x2a')]=moment(_0x34a599[_0xa3b9('0x1f')])[_0xa3b9('0x2b')](0x1,_0xa3b9('0x2c'));}}return db[_0xa3b9('0x42')]['findAll']({'where':{'ProjectId':_0xb3740b[_0xa3b9('0x38')]['id'],'starttime':{'$gte':_0x34a599[_0xa3b9('0x1f')],'$lte':_0x34a599[_0xa3b9('0x2a')]}}})[_0xa3b9('0x17')](handleEntityNotFound(_0x346a57,null))[_0xa3b9('0x17')](function(_0x2ce5e5){if(_0x2ce5e5){_0x459a1a=_0x2ce5e5;return db[_0xa3b9('0x4c')]['findAll']({'where':{'SessionId':{'$in':_[_0xa3b9('0x30')](_0x459a1a,'id')},'ProjectId':_0xb3740b[_0xa3b9('0x38')]['id']},'order':_0xa3b9('0x4d')});}})[_0xa3b9('0x17')](handleEntityNotFound(_0x346a57,null))[_0xa3b9('0x17')](function(_0x11f012){if(_0x11f012){_0x58fc00=_0x11f012;var _0x3066b5={};for(var _0x4c091f=0x0,_0x33bbde=_0x58fc00[_0xa3b9('0x24')];_0x4c091f<_0x33bbde;_0x4c091f++){if(!_0x3066b5[_0xa3b9('0x25')](_0x58fc00[_0x4c091f]['questionId'])){_0x3066b5[_0x58fc00[_0x4c091f][_0xa3b9('0x4e')]]=needsEncapsulation(_0x58fc00[_0x4c091f][_0xa3b9('0x4f')])?encapsulate(_0x58fc00[_0x4c091f][_0xa3b9('0x4f')]):_0x58fc00[_0x4c091f]['question'];}}var _0x15681c=[],_0x7627e3={};for(var _0x8883ff=0x0,_0xad740c=_0x459a1a[_0xa3b9('0x24')];_0x8883ff<_0xad740c;_0x8883ff++){_0x7627e3={'ProjectId':_0xb3740b[_0xa3b9('0x38')]['id'],'SessionId':_0x459a1a[_0x8883ff]['id'],'StartTime':moment(_0x459a1a[_0x8883ff][_0xa3b9('0x50')])[_0xa3b9('0x51')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x970f2c=0x0,_0x3c6037=_0x58fc00[_0xa3b9('0x24')];_0x970f2c<_0x3c6037;_0x970f2c++){if(_0x58fc00[_0x970f2c][_0xa3b9('0x52')]==_0x459a1a[_0x8883ff]['id']&&_0x3066b5[_0xa3b9('0x25')](_0x58fc00[_0x970f2c][_0xa3b9('0x4e')])){_0x7627e3[_0x3066b5[_0x58fc00[_0x970f2c]['questionId']]]=_0x58fc00[_0x970f2c][_0xa3b9('0x53')];}}for(var _0x250ed3 in _0x3066b5){if(!_0x7627e3['hasOwnProperty'](_0x3066b5[_0x250ed3])){_0x7627e3[_0x3066b5[_0x250ed3]]=null;}}_0x15681c[_0xa3b9('0x54')](_0x7627e3);}return _0x15681c;}})[_0xa3b9('0x17')](function(_0x251eb4){if(!_[_0xa3b9('0x55')](_0x251eb4)){var _0x13b564=toCsv(_0x251eb4);var _0x3f484c=Date['now']();fs[_0xa3b9('0x56')](util['format'](_0xa3b9('0x57'),_0xb3740b[_0xa3b9('0x38')]['id'],_0x3f484c),_0x13b564);_0x346a57[_0xa3b9('0x58')]('Content-disposition',_0xa3b9('0x59')+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0xb3740b[_0xa3b9('0x38')]['id'],_0x3f484c));_0x346a57['setHeader']('Content-type',_0xa3b9('0x5a'));return _0x346a57['download'](util['format'](_0xa3b9('0x57'),_0xb3740b[_0xa3b9('0x38')]['id'],_0x3f484c));}else{return _0x346a57[_0xa3b9('0xc')](0xcc);}})[_0xa3b9('0x36')](handleError(_0x346a57,null));}; \ No newline at end of file +var _0xcb21=['YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','now','format','setHeader','Content-disposition','Content-type','/tmp/Jscripty_Project_%d_Summary_%s.csv','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','json','apply','save','then','destroy','sendStatus','error','name','send','JscriptyProject','rawAttributes','model','keys','query','dateEnd','filters','intersection','fields','attributes','length','nolimit','sort','where','dateStart','day','add','filter','map','merge','options','includeAll','include','catch','show','find','create','body','clone','params','omit','updatedAt','findOne','hasOwnProperty','order','ProjectId','JscriptySessionReport','findAll','getAnswers','pick','JscriptyAnswerReport','rows','fromCharCode','indexOf','toString','replace','getSummary','JscriptyQuestionReport','questionId','starttime'];(function(_0x4670c3,_0x268143){var _0x31e182=function(_0x4618d7){while(--_0x4618d7){_0x4670c3['push'](_0x4670c3['shift']());}};_0x31e182(++_0x268143);}(_0xcb21,0x18a));var _0x1cb2=function(_0x2a2c72,_0x3f5a4a){_0x2a2c72=_0x2a2c72-0x0;var _0x354f0e=_0xcb21[_0x2a2c72];return _0x354f0e;};'use strict';var jsonpatch=require(_0x1cb2('0x0'));var rp=require(_0x1cb2('0x1'));var moment=require(_0x1cb2('0x2'));var BPromise=require(_0x1cb2('0x3'));var Mustache=require(_0x1cb2('0x4'));var util=require(_0x1cb2('0x5'));var path=require(_0x1cb2('0x6'));var sox=require('sox');var csv=require(_0x1cb2('0x7'));var ejs=require(_0x1cb2('0x8'));var fs=require('fs');var _=require(_0x1cb2('0x9'));var squel=require(_0x1cb2('0xa'));var crypto=require(_0x1cb2('0xb'));var jsforce=require(_0x1cb2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1cb2('0x7'));var querystring=require(_0x1cb2('0xd'));var Papa=require(_0x1cb2('0xe'));var qs=require(_0x1cb2('0xf'));var logger=require(_0x1cb2('0x10'))(_0x1cb2('0x11'));var utils=require(_0x1cb2('0x12'));var config=require(_0x1cb2('0x13'));var db=require(_0x1cb2('0x14'))['db'];function respondWithStatusCode(_0x1e3599,_0x460d6f){_0x460d6f=_0x460d6f||0xcc;return function(_0x53ec64){if(_0x53ec64){return _0x1e3599['sendStatus'](_0x460d6f);}return _0x1e3599[_0x1cb2('0x15')](_0x460d6f)[_0x1cb2('0x16')]();};}function respondWithResult(_0x1d500c,_0x1b6c4d){_0x1b6c4d=_0x1b6c4d||0xc8;return function(_0x352367){if(_0x352367){return _0x1d500c[_0x1cb2('0x15')](_0x1b6c4d)['json'](_0x352367);}};}function respondWithFilteredResult(_0x1f61ba,_0x3fcb98){return function(_0xc881f2){if(_0xc881f2){var _0xb18d89=_0xc881f2[_0x1cb2('0x17')],_0x3e2d15=_0x3fcb98[_0x1cb2('0x18')],_0x53eb22=_0x3fcb98['offset']+_0x3fcb98[_0x1cb2('0x19')],_0xb76d83;if(_0x53eb22>=_0xb18d89){_0x53eb22=_0xb18d89;_0xb76d83=0xc8;}else{_0xb76d83=0xce;}_0x1f61ba[_0x1cb2('0x15')](_0xb76d83);return _0x1f61ba[_0x1cb2('0x1a')]('Content-Range',_0x3e2d15+'-'+_0x53eb22+'/'+_0xb18d89)[_0x1cb2('0x1b')](_0xc881f2);}return null;};}function patchUpdates(_0x273fcc){return function(_0x1693d9){try{jsonpatch[_0x1cb2('0x1c')](_0x1693d9,_0x273fcc,!![]);}catch(_0x5088a3){return BPromise['reject'](_0x5088a3);}return _0x1693d9[_0x1cb2('0x1d')]();};}function saveUpdates(_0xf211a0,_0x460e10){return function(_0x3ef5fe){if(_0x3ef5fe){return _0x3ef5fe['update'](_0xf211a0)[_0x1cb2('0x1e')](function(_0x1bf2c5){return _0x1bf2c5;});}return null;};}function removeEntity(_0xf41dff,_0x2e79f4){return function(_0x13d003){if(_0x13d003){return _0x13d003[_0x1cb2('0x1f')]()['then'](function(){_0xf41dff[_0x1cb2('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ed3f8,_0x1da9a3){return function(_0x50870e){if(!_0x50870e){_0x1ed3f8[_0x1cb2('0x20')](0x194);}return _0x50870e;};}function handleError(_0x2add0e,_0x38241e){_0x38241e=_0x38241e||0x1f4;return function(_0x1a481f){logger[_0x1cb2('0x21')](_0x1a481f['stack']);if(_0x1a481f['name']){delete _0x1a481f[_0x1cb2('0x22')];}_0x2add0e[_0x1cb2('0x15')](_0x38241e)[_0x1cb2('0x23')](_0x1a481f);};}exports['index']=function(_0x3e3f11,_0xad7709){var _0x549c95={},_0x24b18d={},_0x1e907f={'count':0x0,'rows':[]};var _0x282615=db[_0x1cb2('0x24')][_0x1cb2('0x25')];_0x24b18d[_0x1cb2('0x26')]=_[_0x1cb2('0x27')](_0x282615);var _0x51b592={'dateStart':_0x3e3f11[_0x1cb2('0x28')]['dateStart'],'dateEnd':_0x3e3f11[_0x1cb2('0x28')][_0x1cb2('0x29')]};delete _0x3e3f11[_0x1cb2('0x28')]['dateStart'];delete _0x3e3f11['query'][_0x1cb2('0x29')];_0x24b18d[_0x1cb2('0x28')]=_[_0x1cb2('0x27')](_0x3e3f11[_0x1cb2('0x28')]);_0x24b18d[_0x1cb2('0x2a')]=_[_0x1cb2('0x2b')](_0x24b18d['model'],_0x24b18d['query']);_0x549c95['attributes']=_[_0x1cb2('0x2b')](_0x24b18d[_0x1cb2('0x26')],qs[_0x1cb2('0x2c')](_0x3e3f11[_0x1cb2('0x28')][_0x1cb2('0x2c')]));_0x549c95[_0x1cb2('0x2d')]=_0x549c95[_0x1cb2('0x2d')][_0x1cb2('0x2e')]?_0x549c95[_0x1cb2('0x2d')]:_0x24b18d[_0x1cb2('0x26')];if(!_0x3e3f11['query']['hasOwnProperty'](_0x1cb2('0x2f'))){_0x549c95[_0x1cb2('0x19')]=qs[_0x1cb2('0x19')](_0x3e3f11['query']['limit']);_0x549c95[_0x1cb2('0x18')]=qs[_0x1cb2('0x18')](_0x3e3f11[_0x1cb2('0x28')][_0x1cb2('0x18')]);}_0x549c95['order']=qs['sort'](_0x3e3f11['query'][_0x1cb2('0x30')]);_0x549c95[_0x1cb2('0x31')]=qs['filters'](_['pick'](_0x3e3f11[_0x1cb2('0x28')],_0x24b18d['filters']));if(_0x51b592[_0x1cb2('0x32')]){if(_0x51b592['dateEnd']){_0x51b592['dateEnd']=moment(_0x51b592[_0x1cb2('0x29')])['add'](0x1,_0x1cb2('0x33'));}else{_0x51b592[_0x1cb2('0x29')]=moment(_0x51b592[_0x1cb2('0x32')])[_0x1cb2('0x34')](0x1,_0x1cb2('0x33'));}_['merge'](_0x549c95[_0x1cb2('0x31')],{'createdAt':{'$gte':_0x51b592['dateStart'],'$lte':_0x51b592[_0x1cb2('0x29')]}});}if(_0x3e3f11[_0x1cb2('0x28')][_0x1cb2('0x35')]){_0x549c95[_0x1cb2('0x31')]=_['merge'](_0x549c95[_0x1cb2('0x31')],{'$or':_[_0x1cb2('0x36')](_0x549c95['attributes'],function(_0x474adf){var _0x2a4037={};_0x2a4037[_0x474adf]={'$like':'%'+_0x3e3f11[_0x1cb2('0x28')]['filter']+'%'};return _0x2a4037;})});}_0x549c95=_[_0x1cb2('0x37')]({},_0x549c95,_0x3e3f11[_0x1cb2('0x38')]);var _0x1d527c={'where':_0x549c95[_0x1cb2('0x31')]};return db[_0x1cb2('0x24')][_0x1cb2('0x17')](_0x1d527c)[_0x1cb2('0x1e')](function(_0x11873d){_0x1e907f[_0x1cb2('0x17')]=_0x11873d;if(_0x3e3f11[_0x1cb2('0x28')][_0x1cb2('0x39')]){_0x549c95[_0x1cb2('0x3a')]=[{'all':!![]}];}return db[_0x1cb2('0x24')]['findAll'](_0x549c95);})[_0x1cb2('0x1e')](function(_0x2dd93f){_0x1e907f['rows']=_0x2dd93f;return _0x1e907f;})[_0x1cb2('0x1e')](respondWithFilteredResult(_0xad7709,_0x549c95))[_0x1cb2('0x3b')](handleError(_0xad7709,null));};exports[_0x1cb2('0x3c')]=function(_0x1eda0c,_0x401cf9){var _0x4a97fa={'raw':![],'where':{'id':_0x1eda0c['params']['id']}},_0x41733b={};_0x41733b[_0x1cb2('0x26')]=_['keys'](db['JscriptyProject']['rawAttributes']);_0x41733b[_0x1cb2('0x28')]=_[_0x1cb2('0x27')](_0x1eda0c[_0x1cb2('0x28')]);_0x41733b[_0x1cb2('0x2a')]=_[_0x1cb2('0x2b')](_0x41733b[_0x1cb2('0x26')],_0x41733b[_0x1cb2('0x28')]);_0x4a97fa[_0x1cb2('0x2d')]=_[_0x1cb2('0x2b')](_0x41733b[_0x1cb2('0x26')],qs['fields'](_0x1eda0c['query'][_0x1cb2('0x2c')]));_0x4a97fa[_0x1cb2('0x2d')]=_0x4a97fa[_0x1cb2('0x2d')]['length']?_0x4a97fa[_0x1cb2('0x2d')]:_0x41733b['model'];if(_0x1eda0c[_0x1cb2('0x28')][_0x1cb2('0x39')]){_0x4a97fa[_0x1cb2('0x3a')]=[{'all':!![]}];}_0x4a97fa=_['merge']({},_0x4a97fa,_0x1eda0c[_0x1cb2('0x38')]);return db['JscriptyProject'][_0x1cb2('0x3d')](_0x4a97fa)[_0x1cb2('0x1e')](handleEntityNotFound(_0x401cf9,null))[_0x1cb2('0x1e')](respondWithResult(_0x401cf9,null))[_0x1cb2('0x3b')](handleError(_0x401cf9,null));};exports[_0x1cb2('0x3e')]=function(_0x429e1f,_0x59f953){return db[_0x1cb2('0x24')]['create'](_0x429e1f[_0x1cb2('0x3f')],{})[_0x1cb2('0x1e')](respondWithResult(_0x59f953,0xc9))['catch'](handleError(_0x59f953,null));};exports[_0x1cb2('0x40')]=function(_0x31b2f6,_0x259a85){var _0x378135={'raw':![],'where':{'id':_0x31b2f6[_0x1cb2('0x41')]['id']}},_0x301df4={};_0x301df4[_0x1cb2('0x26')]=_['keys'](db[_0x1cb2('0x24')]['rawAttributes']);_0x378135[_0x1cb2('0x2d')]=_['intersection'](_0x301df4[_0x1cb2('0x26')],qs['fields'](_0x31b2f6[_0x1cb2('0x28')]['fields']));_0x378135['attributes']=_0x378135[_0x1cb2('0x2d')][_0x1cb2('0x2e')]?_0x378135['attributes']:_0x301df4['model'];if(_0x31b2f6[_0x1cb2('0x28')][_0x1cb2('0x39')]){_0x378135['include']=[{'all':!![]}];}_0x378135=_[_0x1cb2('0x37')]({},_0x378135,_0x31b2f6[_0x1cb2('0x38')]);return db[_0x1cb2('0x24')]['find'](_0x378135)['then'](handleEntityNotFound(_0x259a85,null))[_0x1cb2('0x1e')](function(_0x3b8cda){if(_0x3b8cda){var _0x47e42a=_0x3b8cda['get']({'plain':!![]});_0x47e42a=qs[_0x1cb2('0x42')](_0x47e42a,['id','createdAt','updatedAt']);_0x31b2f6[_0x1cb2('0x3f')]=_[_0x1cb2('0x42')](_0x31b2f6['body'],['id','createdAt',_0x1cb2('0x43')]);return db[_0x1cb2('0x24')][_0x1cb2('0x3e')](_['merge'](_0x47e42a,_0x31b2f6['body']),{'include':_0x31b2f6[_0x1cb2('0x28')][_0x1cb2('0x39')]?[{'all':!![]}]:undefined});}})[_0x1cb2('0x1e')](respondWithResult(_0x259a85,0xc9))[_0x1cb2('0x3b')](handleError(_0x259a85,null));};exports['update']=function(_0x448653,_0x4c1e6c){if(_0x448653['body']['id']){delete _0x448653[_0x1cb2('0x3f')]['id'];}return db[_0x1cb2('0x24')][_0x1cb2('0x3d')]({'where':{'id':_0x448653[_0x1cb2('0x41')]['id']}})['then'](handleEntityNotFound(_0x4c1e6c,null))[_0x1cb2('0x1e')](saveUpdates(_0x448653[_0x1cb2('0x3f')],null))[_0x1cb2('0x1e')](respondWithResult(_0x4c1e6c,null))[_0x1cb2('0x3b')](handleError(_0x4c1e6c,null));};exports[_0x1cb2('0x1f')]=function(_0x21106a,_0x8f83ea){return db['JscriptyProject'][_0x1cb2('0x3d')]({'where':{'id':_0x21106a[_0x1cb2('0x41')]['id']}})[_0x1cb2('0x1e')](handleEntityNotFound(_0x8f83ea,null))[_0x1cb2('0x1e')](removeEntity(_0x8f83ea,null))['catch'](handleError(_0x8f83ea,null));};exports['getSessions']=function(_0xb263fe,_0x53560f,_0x31f320){var _0x4bc837={'raw':!![],'where':{}};var _0x4f04b8={};var _0xf9e63c={'count':0x0,'rows':[]};return db[_0x1cb2('0x24')][_0x1cb2('0x44')]({'where':{'id':_0xb263fe[_0x1cb2('0x41')]['id']}})[_0x1cb2('0x1e')](handleEntityNotFound(_0x53560f,null))[_0x1cb2('0x1e')](function(_0x127836){if(_0x127836){_0x4f04b8[_0x1cb2('0x26')]=_['keys'](db['JscriptySessionReport'][_0x1cb2('0x25')]);_0x4f04b8['query']=_[_0x1cb2('0x27')](_0xb263fe[_0x1cb2('0x28')]);_0x4f04b8[_0x1cb2('0x2a')]=_[_0x1cb2('0x2b')](_0x4f04b8[_0x1cb2('0x26')],_0x4f04b8[_0x1cb2('0x28')]);_0x4bc837[_0x1cb2('0x2d')]=_[_0x1cb2('0x2b')](_0x4f04b8[_0x1cb2('0x26')],qs['fields'](_0xb263fe[_0x1cb2('0x28')][_0x1cb2('0x2c')]));_0x4bc837[_0x1cb2('0x2d')]=_0x4bc837[_0x1cb2('0x2d')][_0x1cb2('0x2e')]?_0x4bc837['attributes']:_0x4f04b8[_0x1cb2('0x26')];if(!_0xb263fe[_0x1cb2('0x28')][_0x1cb2('0x45')](_0x1cb2('0x2f'))){_0x4bc837[_0x1cb2('0x19')]=qs[_0x1cb2('0x19')](_0xb263fe[_0x1cb2('0x28')][_0x1cb2('0x19')]);_0x4bc837[_0x1cb2('0x18')]=qs['offset'](_0xb263fe[_0x1cb2('0x28')][_0x1cb2('0x18')]);}_0x4bc837[_0x1cb2('0x46')]=qs[_0x1cb2('0x30')](_0xb263fe[_0x1cb2('0x28')][_0x1cb2('0x30')]);_0x4bc837[_0x1cb2('0x31')]=qs[_0x1cb2('0x2a')](_['pick'](_0xb263fe[_0x1cb2('0x28')],_0x4f04b8[_0x1cb2('0x2a')]));_0x4bc837[_0x1cb2('0x31')][_0x1cb2('0x47')]=_0x127836['id'];if(_0xb263fe[_0x1cb2('0x28')][_0x1cb2('0x35')]){_0x4bc837[_0x1cb2('0x31')]=_[_0x1cb2('0x37')](_0x4bc837[_0x1cb2('0x31')],{'$or':_[_0x1cb2('0x36')](_0x4bc837[_0x1cb2('0x2d')],function(_0x5b710e){var _0x36e532={};_0x36e532[_0x5b710e]={'$like':'%'+_0xb263fe[_0x1cb2('0x28')][_0x1cb2('0x35')]+'%'};return _0x36e532;})});}_0x4bc837=_[_0x1cb2('0x37')]({},_0x4bc837,_0xb263fe[_0x1cb2('0x38')]);return db[_0x1cb2('0x48')]['count']({'where':_0x4bc837[_0x1cb2('0x31')]})[_0x1cb2('0x1e')](function(_0x5075f7){_0xf9e63c['count']=_0x5075f7;if(_0xb263fe['query'][_0x1cb2('0x39')]){_0x4bc837['include']=[{'all':!![]}];}return db[_0x1cb2('0x48')][_0x1cb2('0x49')](_0x4bc837);})[_0x1cb2('0x1e')](function(_0x4f53b0){_0xf9e63c['rows']=_0x4f53b0;return _0xf9e63c;});}})[_0x1cb2('0x1e')](respondWithFilteredResult(_0x53560f,_0x4bc837))['catch'](handleError(_0x53560f,null));};exports[_0x1cb2('0x4a')]=function(_0x4d860b,_0x25b747,_0x10d016){var _0x8bcd17={'raw':!![],'where':{}};var _0x10959a={};var _0x4ce510={'count':0x0,'rows':[]};var _0x254246={'dateStart':_0x4d860b[_0x1cb2('0x28')][_0x1cb2('0x32')],'dateEnd':_0x4d860b[_0x1cb2('0x28')]['dateEnd']};delete _0x4d860b['query'][_0x1cb2('0x32')];delete _0x4d860b['query'][_0x1cb2('0x29')];return db['JscriptyProject']['findOne']({'where':{'id':_0x4d860b[_0x1cb2('0x41')]['id']}})['then'](handleEntityNotFound(_0x25b747,null))[_0x1cb2('0x1e')](function(_0x3b4e3f){if(_0x3b4e3f){_0x10959a['model']=_[_0x1cb2('0x27')](db['JscriptyAnswerReport'][_0x1cb2('0x25')]);_0x10959a['query']=_[_0x1cb2('0x27')](_0x4d860b[_0x1cb2('0x28')]);_0x10959a[_0x1cb2('0x2a')]=_['intersection'](_0x10959a[_0x1cb2('0x26')],_0x10959a[_0x1cb2('0x28')]);_0x8bcd17[_0x1cb2('0x2d')]=_[_0x1cb2('0x2b')](_0x10959a[_0x1cb2('0x26')],qs[_0x1cb2('0x2c')](_0x4d860b[_0x1cb2('0x28')][_0x1cb2('0x2c')]));_0x8bcd17[_0x1cb2('0x2d')]=_0x8bcd17[_0x1cb2('0x2d')][_0x1cb2('0x2e')]?_0x8bcd17[_0x1cb2('0x2d')]:_0x10959a[_0x1cb2('0x26')];if(!_0x4d860b[_0x1cb2('0x28')][_0x1cb2('0x45')](_0x1cb2('0x2f'))){_0x8bcd17[_0x1cb2('0x19')]=qs[_0x1cb2('0x19')](_0x4d860b[_0x1cb2('0x28')]['limit']);_0x8bcd17[_0x1cb2('0x18')]=qs['offset'](_0x4d860b['query'][_0x1cb2('0x18')]);}_0x8bcd17[_0x1cb2('0x46')]=qs[_0x1cb2('0x30')](_0x4d860b[_0x1cb2('0x28')][_0x1cb2('0x30')]);_0x8bcd17[_0x1cb2('0x31')]=qs['filters'](_[_0x1cb2('0x4b')](_0x4d860b[_0x1cb2('0x28')],_0x10959a[_0x1cb2('0x2a')]));_0x8bcd17[_0x1cb2('0x31')][_0x1cb2('0x47')]=_0x3b4e3f['id'];if(_0x254246[_0x1cb2('0x32')]){if(_0x254246[_0x1cb2('0x29')]){_0x254246[_0x1cb2('0x29')]=moment(_0x254246[_0x1cb2('0x29')])[_0x1cb2('0x34')](0x1,_0x1cb2('0x33'));}else{_0x254246['dateEnd']=moment(_0x254246[_0x1cb2('0x32')])[_0x1cb2('0x34')](0x1,_0x1cb2('0x33'));}_[_0x1cb2('0x37')](_0x8bcd17[_0x1cb2('0x31')],{'createdAt':{'$gte':_0x254246[_0x1cb2('0x32')],'$lte':_0x254246[_0x1cb2('0x29')]}});}if(_0x4d860b['query']['filter']){_0x8bcd17[_0x1cb2('0x31')]=_['merge'](_0x8bcd17[_0x1cb2('0x31')],{'$or':_[_0x1cb2('0x36')](_0x8bcd17[_0x1cb2('0x2d')],function(_0x21ae45){var _0x24bf14={};_0x24bf14[_0x21ae45]={'$like':'%'+_0x4d860b[_0x1cb2('0x28')]['filter']+'%'};return _0x24bf14;})});}_0x8bcd17=_[_0x1cb2('0x37')]({},_0x8bcd17,_0x4d860b['options']);return db[_0x1cb2('0x4c')][_0x1cb2('0x17')]({'where':_0x8bcd17['where']})['then'](function(_0x193888){_0x4ce510[_0x1cb2('0x17')]=_0x193888;if(_0x4d860b[_0x1cb2('0x28')][_0x1cb2('0x39')]){_0x8bcd17[_0x1cb2('0x3a')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x1cb2('0x49')](_0x8bcd17);})[_0x1cb2('0x1e')](function(_0x32c2a0){_0x4ce510[_0x1cb2('0x4d')]=_0x32c2a0;return _0x4ce510;});}})[_0x1cb2('0x1e')](respondWithFilteredResult(_0x25b747,_0x8bcd17))[_0x1cb2('0x3b')](handleError(_0x25b747,null));};function char(_0x23efd0){return'number'===typeof _0x23efd0?String[_0x1cb2('0x4e')][_0x1cb2('0x1c')](null,arguments):_0x23efd0;}function needsEncapsulation(_0x2a5b5f){return!!_0x2a5b5f&&(_0x2a5b5f['toString']()[_0x1cb2('0x4f')](char(0xd))>=0x0||_0x2a5b5f[_0x1cb2('0x50')]()[_0x1cb2('0x4f')](char(0xa))>=0x0||_0x2a5b5f[_0x1cb2('0x50')]()[_0x1cb2('0x4f')](char(0x2c))>=0x0||_0x2a5b5f[_0x1cb2('0x50')]()[_0x1cb2('0x4f')](char(0x22))>=0x0);}function encapsulate(_0x2f6e31){var _0x4c1d12=char(0x22),_0x4834c6='\x5c'+char(0x22),_0x2d3ad3=_0x2f6e31[_0x1cb2('0x50')]()[_0x1cb2('0x51')](new RegExp(_0x4c1d12,'g'),_0x4834c6);return _0x4c1d12+_0x2d3ad3+_0x4c1d12;}exports[_0x1cb2('0x52')]=function(_0x213b72,_0x5537b6,_0x70ff0e){var _0x692d65,_0x44ace6;var _0x5e00e9={'dateStart':_0x213b72[_0x1cb2('0x28')][_0x1cb2('0x32')],'dateEnd':_0x213b72[_0x1cb2('0x28')][_0x1cb2('0x29')]};delete _0x213b72['query']['dateStart'];delete _0x213b72['query']['dateEnd'];if(_0x5e00e9[_0x1cb2('0x32')]){if(_0x5e00e9[_0x1cb2('0x29')]){_0x5e00e9['dateEnd']=moment(_0x5e00e9[_0x1cb2('0x29')])[_0x1cb2('0x34')](0x1,_0x1cb2('0x33'));}else{_0x5e00e9[_0x1cb2('0x29')]=moment(_0x5e00e9[_0x1cb2('0x32')])['add'](0x1,_0x1cb2('0x33'));}}return db['JscriptySessionReport'][_0x1cb2('0x49')]({'where':{'ProjectId':_0x213b72[_0x1cb2('0x41')]['id'],'starttime':{'$gte':_0x5e00e9['dateStart'],'$lte':_0x5e00e9[_0x1cb2('0x29')]}}})[_0x1cb2('0x1e')](handleEntityNotFound(_0x5537b6,null))[_0x1cb2('0x1e')](function(_0x5eb8cd){if(_0x5eb8cd){_0x692d65=_0x5eb8cd;return db[_0x1cb2('0x53')]['findAll']({'where':{'SessionId':{'$in':_['map'](_0x692d65,'id')},'ProjectId':_0x213b72['params']['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x5537b6,null))[_0x1cb2('0x1e')](function(_0x59c7ec){if(_0x59c7ec){_0x44ace6=_0x59c7ec;var _0x13a9f5={};for(var _0x4635b6=0x0,_0x322f8e=_0x44ace6[_0x1cb2('0x2e')];_0x4635b6<_0x322f8e;_0x4635b6++){if(!_0x13a9f5[_0x1cb2('0x45')](_0x44ace6[_0x4635b6][_0x1cb2('0x54')])){_0x13a9f5[_0x44ace6[_0x4635b6][_0x1cb2('0x54')]]=needsEncapsulation(_0x44ace6[_0x4635b6]['question'])?encapsulate(_0x44ace6[_0x4635b6]['question']):_0x44ace6[_0x4635b6]['question'];}}var _0x5177df=[],_0x4b14fb={};for(var _0x45bf42=0x0,_0x1d2f31=_0x692d65['length'];_0x45bf42<_0x1d2f31;_0x45bf42++){_0x4b14fb={'ProjectId':_0x213b72[_0x1cb2('0x41')]['id'],'SessionId':_0x692d65[_0x45bf42]['id'],'StartTime':moment(_0x692d65[_0x45bf42][_0x1cb2('0x55')])['format'](_0x1cb2('0x56'))};for(var _0x50bb2b=0x0,_0x335977=_0x44ace6['length'];_0x50bb2b<_0x335977;_0x50bb2b++){if(_0x44ace6[_0x50bb2b][_0x1cb2('0x57')]==_0x692d65[_0x45bf42]['id']&&_0x13a9f5[_0x1cb2('0x45')](_0x44ace6[_0x50bb2b][_0x1cb2('0x54')])){_0x4b14fb[_0x13a9f5[_0x44ace6[_0x50bb2b]['questionId']]]=_0x44ace6[_0x50bb2b]['answer'];}}for(var _0x14081c in _0x13a9f5){if(!_0x4b14fb[_0x1cb2('0x45')](_0x13a9f5[_0x14081c])){_0x4b14fb[_0x13a9f5[_0x14081c]]=null;}}_0x5177df[_0x1cb2('0x58')](_0x4b14fb);}return _0x5177df;}})[_0x1cb2('0x1e')](function(_0x19ceaf){if(!_[_0x1cb2('0x59')](_0x19ceaf)){var _0x53a83c=toCsv(_0x19ceaf);var _0x279354=Date[_0x1cb2('0x5a')]();fs['writeFileSync'](util[_0x1cb2('0x5b')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x213b72[_0x1cb2('0x41')]['id'],_0x279354),_0x53a83c);_0x5537b6[_0x1cb2('0x5c')](_0x1cb2('0x5d'),'attachment;\x20filename='+util[_0x1cb2('0x5b')]('Jscripty_Project_%d_Summary_%s.csv',_0x213b72[_0x1cb2('0x41')]['id'],_0x279354));_0x5537b6['setHeader'](_0x1cb2('0x5e'),'text/csv');return _0x5537b6['download'](util[_0x1cb2('0x5b')](_0x1cb2('0x5f'),_0x213b72[_0x1cb2('0x41')]['id'],_0x279354));}else{return _0x5537b6[_0x1cb2('0x20')](0xcc);}})[_0x1cb2('0x3b')](handleError(_0x5537b6,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 9ac7b66..40e40b1 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 _0xe68c=['jscripty_projects','lodash','util','api','bluebird','request-promise','./jscriptyProject.attributes','exports','JscriptyProject'];(function(_0x4c0f67,_0x4c121f){var _0x415340=function(_0x333f4e){while(--_0x333f4e){_0x4c0f67['push'](_0x4c0f67['shift']());}};_0x415340(++_0x4c121f);}(_0xe68c,0xfd));var _0xce68=function(_0x365c78,_0x23ab28){_0x365c78=_0x365c78-0x0;var _0x40d398=_0xe68c[_0x365c78];return _0x40d398;};'use strict';var _=require(_0xce68('0x0'));var util=require(_0xce68('0x1'));var logger=require('../../config/logger')(_0xce68('0x2'));var moment=require('moment');var BPromise=require(_0xce68('0x3'));var rp=require(_0xce68('0x4'));var attributes=require(_0xce68('0x5'));module[_0xce68('0x6')]=function(_0x472987,_0x3441bb){return _0x472987['define'](_0xce68('0x7'),attributes,{'tableName':_0xce68('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d7f=['bluebird','request-promise','./jscriptyProject.attributes','define','lodash','../../config/logger','moment'];(function(_0x3d7670,_0xd5dc58){var _0x3ae54f=function(_0x280bc5){while(--_0x280bc5){_0x3d7670['push'](_0x3d7670['shift']());}};_0x3ae54f(++_0xd5dc58);}(_0x3d7f,0x1a1));var _0xf3d7=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x3d7f[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xf3d7('0x0'));var util=require('util');var logger=require(_0xf3d7('0x1'))('api');var moment=require(_0xf3d7('0x2'));var BPromise=require(_0xf3d7('0x3'));var rp=require(_0xf3d7('0x4'));var attributes=require(_0xf3d7('0x5'));module['exports']=function(_0x574073,_0x433483){return _0x574073[_0xf3d7('0x6')]('JscriptyProject',attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 24367af..40e64a3 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 _0xa7a8=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','code','JscriptyProject,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa7a8,0xc0));var _0x8a7a=function(_0xd0e89,_0x3b5d2e){_0xd0e89=_0xd0e89-0x0;var _0x5bccf2=_0xa7a8[_0xd0e89];return _0x5bccf2;};'use strict';var _=require('lodash');var util=require(_0x8a7a('0x0'));var moment=require(_0x8a7a('0x1'));var BPromise=require(_0x8a7a('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x8a7a('0x3'))['db'];var utils=require(_0x8a7a('0x4'));var logger=require(_0x8a7a('0x5'))(_0x8a7a('0x6'));var config=require(_0x8a7a('0x7'));var jayson=require(_0x8a7a('0x8'));var client=jayson[_0x8a7a('0x9')][_0x8a7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d27dc,_0x146d2f,_0x3e4cc5){return new BPromise(function(_0x4c8fac,_0x504777){return client[_0x8a7a('0xb')](_0x1d27dc,_0x3e4cc5)[_0x8a7a('0xc')](function(_0x195599){logger[_0x8a7a('0xd')]('JscriptyProject,\x20%s,\x20%s',_0x146d2f,'request\x20sent');logger[_0x8a7a('0xe')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x146d2f,_0x8a7a('0xf'),JSON['stringify'](_0x195599));if(_0x195599[_0x8a7a('0x10')]){if(_0x195599[_0x8a7a('0x10')][_0x8a7a('0x11')]===0x1f4){logger['error'](_0x8a7a('0x12'),_0x146d2f,_0x195599['error'][_0x8a7a('0x13')]);return _0x504777(_0x195599[_0x8a7a('0x10')][_0x8a7a('0x13')]);}logger[_0x8a7a('0x10')](_0x8a7a('0x12'),_0x146d2f,_0x195599[_0x8a7a('0x10')][_0x8a7a('0x13')]);return _0x4c8fac(_0x195599[_0x8a7a('0x10')][_0x8a7a('0x13')]);}else{logger[_0x8a7a('0xd')](_0x8a7a('0x12'),_0x146d2f,'request\x20sent');_0x4c8fac(_0x195599[_0x8a7a('0x14')][_0x8a7a('0x13')]);}})[_0x8a7a('0x15')](function(_0x1b16d3){logger[_0x8a7a('0x10')](_0x8a7a('0x12'),_0x146d2f,_0x1b16d3);_0x504777(_0x1b16d3);});});} \ No newline at end of file +var _0xed91=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x204fd8,_0x15c007){var _0x1327a9=function(_0x484b35){while(--_0x484b35){_0x204fd8['push'](_0x204fd8['shift']());}};_0x1327a9(++_0x15c007);}(_0xed91,0x144));var _0x1ed9=function(_0x54381c,_0x5a9538){_0x54381c=_0x54381c-0x0;var _0x5d7830=_0xed91[_0x54381c];return _0x5d7830;};'use strict';var _=require(_0x1ed9('0x0'));var util=require(_0x1ed9('0x1'));var moment=require(_0x1ed9('0x2'));var BPromise=require('bluebird');var rs=require(_0x1ed9('0x3'));var fs=require('fs');var db=require(_0x1ed9('0x4'))['db'];var utils=require(_0x1ed9('0x5'));var logger=require(_0x1ed9('0x6'))(_0x1ed9('0x7'));var config=require(_0x1ed9('0x8'));var jayson=require(_0x1ed9('0x9'));var client=jayson[_0x1ed9('0xa')][_0x1ed9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c4296,_0x1fdac4,_0x3bca4c){return new BPromise(function(_0x1e5fbc,_0x58b7c7){return client['request'](_0x2c4296,_0x3bca4c)[_0x1ed9('0xc')](function(_0x19f68a){logger[_0x1ed9('0xd')](_0x1ed9('0xe'),_0x1fdac4,_0x1ed9('0xf'));logger['debug'](_0x1ed9('0x10'),_0x1fdac4,_0x1ed9('0xf'),JSON[_0x1ed9('0x11')](_0x19f68a));if(_0x19f68a[_0x1ed9('0x12')]){if(_0x19f68a[_0x1ed9('0x12')]['code']===0x1f4){logger['error'](_0x1ed9('0xe'),_0x1fdac4,_0x19f68a[_0x1ed9('0x12')][_0x1ed9('0x13')]);return _0x58b7c7(_0x19f68a['error'][_0x1ed9('0x13')]);}logger['error'](_0x1ed9('0xe'),_0x1fdac4,_0x19f68a[_0x1ed9('0x12')]['message']);return _0x1e5fbc(_0x19f68a['error']['message']);}else{logger[_0x1ed9('0xd')](_0x1ed9('0xe'),_0x1fdac4,_0x1ed9('0xf'));_0x1e5fbc(_0x19f68a[_0x1ed9('0x14')][_0x1ed9('0x13')]);}})[_0x1ed9('0x15')](function(_0x28c351){logger[_0x1ed9('0x12')](_0x1ed9('0xe'),_0x1fdac4,_0x28c351);_0x58b7c7(_0x28c351);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 3f44ff6..8315872 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 _0x4ef1=['/:id','show','post','put','update','delete','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','describe'];(function(_0x20b55b,_0x387ba6){var _0x106f72=function(_0x2c74dd){while(--_0x2c74dd){_0x20b55b['push'](_0x20b55b['shift']());}};_0x106f72(++_0x387ba6);}(_0x4ef1,0xeb));var _0x14ef=function(_0x493d76,_0xa55cc7){_0x493d76=_0x493d76-0x0;var _0x50bc2e=_0x4ef1[_0x493d76];return _0x50bc2e;};'use strict';var multer=require(_0x14ef('0x0'));var util=require(_0x14ef('0x1'));var path=require('path');var express=require(_0x14ef('0x2'));var router=express[_0x14ef('0x3')]();var auth=require(_0x14ef('0x4'));var interaction=require(_0x14ef('0x5'));var config=require(_0x14ef('0x6'));var controller=require(_0x14ef('0x7'));router[_0x14ef('0x8')]('/',auth[_0x14ef('0x9')](),controller[_0x14ef('0xa')]);router[_0x14ef('0x8')]('/describe',auth[_0x14ef('0x9')](),controller[_0x14ef('0xb')]);router['get'](_0x14ef('0xc'),auth[_0x14ef('0x9')](),controller[_0x14ef('0xd')]);router[_0x14ef('0xe')]('/',auth[_0x14ef('0x9')](),controller['create']);router[_0x14ef('0xf')]('/:id',auth[_0x14ef('0x9')](),controller[_0x14ef('0x10')]);router[_0x14ef('0x11')](_0x14ef('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x14ef('0x12')]=router; \ No newline at end of file +var _0x05a3=['describe','show','create','put','/:id','update','exports','multer','path','Router','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x304c47,_0x4e0e20){var _0x2dbd2c=function(_0x4f7049){while(--_0x4f7049){_0x304c47['push'](_0x304c47['shift']());}};_0x2dbd2c(++_0x4e0e20);}(_0x05a3,0x13b));var _0x305a=function(_0x5e45d3,_0x15e633){_0x5e45d3=_0x5e45d3-0x0;var _0x54e340=_0x05a3[_0x5e45d3];return _0x54e340;};'use strict';var multer=require(_0x305a('0x0'));var util=require('util');var path=require(_0x305a('0x1'));var express=require('express');var router=express[_0x305a('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x305a('0x3'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router[_0x305a('0x4')]('/',auth[_0x305a('0x5')](),controller[_0x305a('0x6')]);router[_0x305a('0x4')]('/describe',auth[_0x305a('0x5')](),controller[_0x305a('0x7')]);router[_0x305a('0x4')]('/:id',auth[_0x305a('0x5')](),controller[_0x305a('0x8')]);router['post']('/',auth[_0x305a('0x5')](),controller[_0x305a('0x9')]);router[_0x305a('0xa')](_0x305a('0xb'),auth[_0x305a('0x5')](),controller[_0x305a('0xc')]);router['delete'](_0x305a('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x305a('0xd')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 7676fa4..e3d8a78 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 _0xce25=['STRING'];(function(_0x368428,_0x20ad69){var _0x591467=function(_0x445e80){while(--_0x445e80){_0x368428['push'](_0x368428['shift']());}};_0x591467(++_0x20ad69);}(_0xce25,0x196));var _0x5ce2=function(_0x1e8ec7,_0x589fd4){_0x1e8ec7=_0x1e8ec7-0x0;var _0x4bd170=_0xce25[_0x1e8ec7];return _0x4bd170;};'use strict';var Sequelize=require('sequelize');module['exports']={'question':{'type':Sequelize[_0x5ce2('0x0')]},'answer':{'type':Sequelize['TEXT']('long')},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x5ce2('0x0')]},'queue':{'type':Sequelize[_0x5ce2('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5ce2('0x0')]},'calleridnum':{'type':Sequelize[_0x5ce2('0x0')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3306=['exports','STRING','TEXT','sequelize'];(function(_0x5d1044,_0x18f656){var _0x3cd90e=function(_0x3c40be){while(--_0x3c40be){_0x5d1044['push'](_0x5d1044['shift']());}};_0x3cd90e(++_0x18f656);}(_0x3306,0x107));var _0x6330=function(_0x11d085,_0x1ad11c){_0x11d085=_0x11d085-0x0;var _0x472c10=_0x3306[_0x11d085];return _0x472c10;};'use strict';var Sequelize=require(_0x6330('0x0'));module[_0x6330('0x1')]={'question':{'type':Sequelize[_0x6330('0x2')]},'answer':{'type':Sequelize[_0x6330('0x3')]('long')},'membername':{'type':Sequelize[_0x6330('0x2')]},'projectname':{'type':Sequelize[_0x6330('0x2')]},'queue':{'type':Sequelize[_0x6330('0x2')]},'uniqueid':{'type':Sequelize[_0x6330('0x2')]},'calleridname':{'type':Sequelize[_0x6330('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x6330('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 92149f5..0bf74c2 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 _0x471c=['json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','JscriptyQuestionReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','add','day','filter','map','merge','findAll','catch','show','params','length','include','options','find','create','body','describe','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','status','end'];(function(_0x4f2b79,_0x4a47e2){var _0x42c9a8=function(_0x58f843){while(--_0x58f843){_0x4f2b79['push'](_0x4f2b79['shift']());}};_0x42c9a8(++_0x4a47e2);}(_0x471c,0x136));var _0xc471=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x471c[_0x3dd15e];return _0x231fd0;};'use strict';var jsonpatch=require(_0xc471('0x0'));var rp=require(_0xc471('0x1'));var moment=require('moment');var BPromise=require(_0xc471('0x2'));var Mustache=require(_0xc471('0x3'));var util=require('util');var path=require('path');var sox=require(_0xc471('0x4'));var csv=require(_0xc471('0x5'));var ejs=require(_0xc471('0x6'));var fs=require('fs');var _=require(_0xc471('0x7'));var squel=require(_0xc471('0x8'));var crypto=require(_0xc471('0x9'));var jsforce=require(_0xc471('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc471('0x5'));var querystring=require(_0xc471('0xb'));var Papa=require(_0xc471('0xc'));var qs=require(_0xc471('0xd'));var logger=require(_0xc471('0xe'))(_0xc471('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xc471('0x10'))['db'];function respondWithStatusCode(_0x193d06,_0x12c398){_0x12c398=_0x12c398||0xcc;return function(_0x2e8142){if(_0x2e8142){return _0x193d06[_0xc471('0x11')](_0x12c398);}return _0x193d06[_0xc471('0x12')](_0x12c398)[_0xc471('0x13')]();};}function respondWithResult(_0xb6f1d5,_0x11c0cb){_0x11c0cb=_0x11c0cb||0xc8;return function(_0x2d7188){if(_0x2d7188){return _0xb6f1d5[_0xc471('0x12')](_0x11c0cb)[_0xc471('0x14')](_0x2d7188);}};}function respondWithFilteredResult(_0x2080f4,_0x2b385e){return function(_0x50826d){if(_0x50826d){var _0x564304=_0x50826d[_0xc471('0x15')],_0x4f8d8a=_0x2b385e[_0xc471('0x16')],_0x4b7635=_0x2b385e[_0xc471('0x16')]+_0x2b385e[_0xc471('0x17')],_0x4e5933;if(_0x4b7635>=_0x564304){_0x4b7635=_0x564304;_0x4e5933=0xc8;}else{_0x4e5933=0xce;}_0x2080f4[_0xc471('0x12')](_0x4e5933);return _0x2080f4[_0xc471('0x18')]('Content-Range',_0x4f8d8a+'-'+_0x4b7635+'/'+_0x564304)[_0xc471('0x14')](_0x50826d);}return null;};}function patchUpdates(_0x443e61){return function(_0x4242dd){try{jsonpatch[_0xc471('0x19')](_0x4242dd,_0x443e61,!![]);}catch(_0x1c401a){return BPromise[_0xc471('0x1a')](_0x1c401a);}return _0x4242dd[_0xc471('0x1b')]();};}function saveUpdates(_0x400de6,_0x3b6a5b){return function(_0x16cd87){if(_0x16cd87){return _0x16cd87[_0xc471('0x1c')](_0x400de6)[_0xc471('0x1d')](function(_0x156a8f){return _0x156a8f;});}return null;};}function removeEntity(_0x41b836,_0x2be26e){return function(_0x6446d0){if(_0x6446d0){return _0x6446d0[_0xc471('0x1e')]()[_0xc471('0x1d')](function(){_0x41b836[_0xc471('0x12')](0xcc)[_0xc471('0x13')]();});}};}function handleEntityNotFound(_0x45818b,_0x3232a8){return function(_0x5779b8){if(!_0x5779b8){_0x45818b[_0xc471('0x11')](0x194);}return _0x5779b8;};}function handleError(_0x1830ab,_0x376bbf){_0x376bbf=_0x376bbf||0x1f4;return function(_0x378c93){logger['error'](_0x378c93[_0xc471('0x1f')]);if(_0x378c93['name']){delete _0x378c93[_0xc471('0x20')];}_0x1830ab['status'](_0x376bbf)[_0xc471('0x21')](_0x378c93);};}exports['index']=function(_0x32e02f,_0x1c1efb){var _0x4fe59d={},_0x142305={},_0x22afff={'count':0x0,'rows':[]};var _0x3a7a9f=db[_0xc471('0x22')][_0xc471('0x23')];_0x142305[_0xc471('0x24')]=_[_0xc471('0x25')](_0x3a7a9f);var _0x3ca71c={'dateStart':_0x32e02f[_0xc471('0x26')][_0xc471('0x27')],'dateEnd':_0x32e02f[_0xc471('0x26')][_0xc471('0x28')]};delete _0x32e02f[_0xc471('0x26')][_0xc471('0x27')];delete _0x32e02f[_0xc471('0x26')]['dateEnd'];_0x142305[_0xc471('0x26')]=_[_0xc471('0x25')](_0x32e02f[_0xc471('0x26')]);_0x142305[_0xc471('0x29')]=_[_0xc471('0x2a')](_0x142305[_0xc471('0x24')],_0x142305['query']);_0x4fe59d[_0xc471('0x2b')]=_[_0xc471('0x2a')](_0x142305[_0xc471('0x24')],qs[_0xc471('0x2c')](_0x32e02f[_0xc471('0x26')][_0xc471('0x2c')]));_0x4fe59d[_0xc471('0x2b')]=_0x4fe59d['attributes']['length']?_0x4fe59d['attributes']:_0x142305[_0xc471('0x24')];if(!_0x32e02f['query'][_0xc471('0x2d')]('nolimit')){_0x4fe59d[_0xc471('0x17')]=qs[_0xc471('0x17')](_0x32e02f[_0xc471('0x26')][_0xc471('0x17')]);_0x4fe59d[_0xc471('0x16')]=qs['offset'](_0x32e02f[_0xc471('0x26')]['offset']);}_0x4fe59d[_0xc471('0x2e')]=qs[_0xc471('0x2f')](_0x32e02f[_0xc471('0x26')][_0xc471('0x2f')]);_0x4fe59d[_0xc471('0x30')]=qs[_0xc471('0x29')](_[_0xc471('0x31')](_0x32e02f[_0xc471('0x26')],_0x142305[_0xc471('0x29')]));if(_0x3ca71c['dateStart']){if(_0x3ca71c['dateEnd']){_0x3ca71c[_0xc471('0x28')]=moment(_0x3ca71c[_0xc471('0x28')])[_0xc471('0x32')](0x1,_0xc471('0x33'));}else{_0x3ca71c[_0xc471('0x28')]=moment(_0x3ca71c[_0xc471('0x27')])[_0xc471('0x32')](0x1,_0xc471('0x33'));}_['merge'](_0x4fe59d['where'],{'createdAt':{'$gte':_0x3ca71c[_0xc471('0x27')],'$lte':_0x3ca71c[_0xc471('0x28')]}});}if(_0x32e02f[_0xc471('0x26')][_0xc471('0x34')]){_0x4fe59d[_0xc471('0x30')]=_['merge'](_0x4fe59d['where'],{'$or':_[_0xc471('0x35')](_0x4fe59d[_0xc471('0x2b')],function(_0x49c1c6){var _0x58e29a={};_0x58e29a[_0x49c1c6]={'$like':'%'+_0x32e02f['query'][_0xc471('0x34')]+'%'};return _0x58e29a;})});}_0x4fe59d=_[_0xc471('0x36')]({},_0x4fe59d,_0x32e02f['options']);var _0x2065c1={'where':_0x4fe59d['where']};return db[_0xc471('0x22')][_0xc471('0x15')](_0x2065c1)['then'](function(_0x2ec528){_0x22afff[_0xc471('0x15')]=_0x2ec528;if(_0x32e02f[_0xc471('0x26')]['includeAll']){_0x4fe59d['include']=[{'all':!![]}];}return db[_0xc471('0x22')][_0xc471('0x37')](_0x4fe59d);})['then'](function(_0x5be66e){_0x22afff['rows']=_0x5be66e;return _0x22afff;})['then'](respondWithFilteredResult(_0x1c1efb,_0x4fe59d))[_0xc471('0x38')](handleError(_0x1c1efb,null));};exports[_0xc471('0x39')]=function(_0x30ac4d,_0x149b8d){var _0x34e849={'raw':!![],'where':{'id':_0x30ac4d[_0xc471('0x3a')]['id']}},_0x19df25={};_0x19df25[_0xc471('0x24')]=_[_0xc471('0x25')](db[_0xc471('0x22')][_0xc471('0x23')]);_0x19df25['query']=_['keys'](_0x30ac4d[_0xc471('0x26')]);_0x19df25[_0xc471('0x29')]=_[_0xc471('0x2a')](_0x19df25[_0xc471('0x24')],_0x19df25[_0xc471('0x26')]);_0x34e849['attributes']=_[_0xc471('0x2a')](_0x19df25[_0xc471('0x24')],qs[_0xc471('0x2c')](_0x30ac4d[_0xc471('0x26')][_0xc471('0x2c')]));_0x34e849[_0xc471('0x2b')]=_0x34e849[_0xc471('0x2b')][_0xc471('0x3b')]?_0x34e849[_0xc471('0x2b')]:_0x19df25[_0xc471('0x24')];if(_0x30ac4d['query']['includeAll']){_0x34e849[_0xc471('0x3c')]=[{'all':!![]}];}_0x34e849=_[_0xc471('0x36')]({},_0x34e849,_0x30ac4d[_0xc471('0x3d')]);return db[_0xc471('0x22')][_0xc471('0x3e')](_0x34e849)[_0xc471('0x1d')](handleEntityNotFound(_0x149b8d,null))['then'](respondWithResult(_0x149b8d,null))[_0xc471('0x38')](handleError(_0x149b8d,null));};exports[_0xc471('0x3f')]=function(_0x2abb71,_0x273f0d){return db['JscriptyQuestionReport'][_0xc471('0x3f')](_0x2abb71[_0xc471('0x40')],{})['then'](respondWithResult(_0x273f0d,0xc9))['catch'](handleError(_0x273f0d,null));};exports[_0xc471('0x1c')]=function(_0x9f213c,_0x1cec1d){if(_0x9f213c[_0xc471('0x40')]['id']){delete _0x9f213c[_0xc471('0x40')]['id'];}return db['JscriptyQuestionReport'][_0xc471('0x3e')]({'where':{'id':_0x9f213c['params']['id']}})[_0xc471('0x1d')](handleEntityNotFound(_0x1cec1d,null))[_0xc471('0x1d')](saveUpdates(_0x9f213c[_0xc471('0x40')],null))[_0xc471('0x1d')](respondWithResult(_0x1cec1d,null))[_0xc471('0x38')](handleError(_0x1cec1d,null));};exports[_0xc471('0x1e')]=function(_0x1c5fd0,_0x309159){return db[_0xc471('0x22')]['find']({'where':{'id':_0x1c5fd0[_0xc471('0x3a')]['id']}})[_0xc471('0x1d')](handleEntityNotFound(_0x309159,null))[_0xc471('0x1d')](removeEntity(_0x309159,null))[_0xc471('0x38')](handleError(_0x309159,null));};exports[_0xc471('0x41')]=function(_0x491e6f,_0x5d5c73){return db['JscriptyQuestionReport'][_0xc471('0x41')]()[_0xc471('0x1d')](respondWithResult(_0x5d5c73,null))[_0xc471('0x38')](handleError(_0x5d5c73,null));}; \ No newline at end of file +var _0x4d07=['dateStart','dateEnd','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','where','filters','pick','add','day','filter','merge','map','includeAll','findAll','rows','catch','params','length','include','options','find','create','update','body','describe','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','then','destroy','end','error','stack','name','index','JscriptyQuestionReport','rawAttributes','keys','query'];(function(_0x11e987,_0x18c082){var _0x581deb=function(_0x3b016d){while(--_0x3b016d){_0x11e987['push'](_0x11e987['shift']());}};_0x581deb(++_0x18c082);}(_0x4d07,0x17c));var _0x74d0=function(_0x502c79,_0x5b2173){_0x502c79=_0x502c79-0x0;var _0x10e412=_0x4d07[_0x502c79];return _0x10e412;};'use strict';var jsonpatch=require(_0x74d0('0x0'));var rp=require(_0x74d0('0x1'));var moment=require('moment');var BPromise=require(_0x74d0('0x2'));var Mustache=require('mustache');var util=require(_0x74d0('0x3'));var path=require(_0x74d0('0x4'));var sox=require(_0x74d0('0x5'));var csv=require(_0x74d0('0x6'));var ejs=require(_0x74d0('0x7'));var fs=require('fs');var _=require(_0x74d0('0x8'));var squel=require(_0x74d0('0x9'));var crypto=require('crypto');var jsforce=require(_0x74d0('0xa'));var deskjs=require(_0x74d0('0xb'));var toCsv=require(_0x74d0('0x6'));var querystring=require(_0x74d0('0xc'));var Papa=require('papaparse');var qs=require(_0x74d0('0xd'));var logger=require(_0x74d0('0xe'))(_0x74d0('0xf'));var utils=require(_0x74d0('0x10'));var config=require(_0x74d0('0x11'));var db=require(_0x74d0('0x12'))['db'];function respondWithStatusCode(_0x22d078,_0x2e1cef){_0x2e1cef=_0x2e1cef||0xcc;return function(_0xc3f5f1){if(_0xc3f5f1){return _0x22d078[_0x74d0('0x13')](_0x2e1cef);}return _0x22d078['status'](_0x2e1cef)['end']();};}function respondWithResult(_0x5a5269,_0x91fa70){_0x91fa70=_0x91fa70||0xc8;return function(_0x320e0a){if(_0x320e0a){return _0x5a5269[_0x74d0('0x14')](_0x91fa70)[_0x74d0('0x15')](_0x320e0a);}};}function respondWithFilteredResult(_0x74c3d6,_0x5b4126){return function(_0x343e9b){if(_0x343e9b){var _0x3ec881=_0x343e9b[_0x74d0('0x16')],_0x57e56d=_0x5b4126[_0x74d0('0x17')],_0x33eb1e=_0x5b4126[_0x74d0('0x17')]+_0x5b4126[_0x74d0('0x18')],_0x26489e;if(_0x33eb1e>=_0x3ec881){_0x33eb1e=_0x3ec881;_0x26489e=0xc8;}else{_0x26489e=0xce;}_0x74c3d6['status'](_0x26489e);return _0x74c3d6[_0x74d0('0x19')]('Content-Range',_0x57e56d+'-'+_0x33eb1e+'/'+_0x3ec881)[_0x74d0('0x15')](_0x343e9b);}return null;};}function patchUpdates(_0x3d2174){return function(_0x5338d1){try{jsonpatch[_0x74d0('0x1a')](_0x5338d1,_0x3d2174,!![]);}catch(_0x4a46e1){return BPromise[_0x74d0('0x1b')](_0x4a46e1);}return _0x5338d1[_0x74d0('0x1c')]();};}function saveUpdates(_0x354e18,_0x33b1c9){return function(_0x1692f8){if(_0x1692f8){return _0x1692f8['update'](_0x354e18)[_0x74d0('0x1d')](function(_0x17da1f){return _0x17da1f;});}return null;};}function removeEntity(_0x2ec430,_0x4306c2){return function(_0x470b31){if(_0x470b31){return _0x470b31[_0x74d0('0x1e')]()[_0x74d0('0x1d')](function(){_0x2ec430['status'](0xcc)[_0x74d0('0x1f')]();});}};}function handleEntityNotFound(_0x1e0bb4,_0x4eebfa){return function(_0x3e9bd7){if(!_0x3e9bd7){_0x1e0bb4[_0x74d0('0x13')](0x194);}return _0x3e9bd7;};}function handleError(_0x1b36fa,_0x47ec10){_0x47ec10=_0x47ec10||0x1f4;return function(_0x3ae0c2){logger[_0x74d0('0x20')](_0x3ae0c2[_0x74d0('0x21')]);if(_0x3ae0c2[_0x74d0('0x22')]){delete _0x3ae0c2[_0x74d0('0x22')];}_0x1b36fa[_0x74d0('0x14')](_0x47ec10)['send'](_0x3ae0c2);};}exports[_0x74d0('0x23')]=function(_0x19c7d3,_0x47d2b4){var _0x29de40={},_0x2439a8={},_0x1bf696={'count':0x0,'rows':[]};var _0x54e760=db[_0x74d0('0x24')][_0x74d0('0x25')];_0x2439a8['model']=_[_0x74d0('0x26')](_0x54e760);var _0x19fef2={'dateStart':_0x19c7d3[_0x74d0('0x27')][_0x74d0('0x28')],'dateEnd':_0x19c7d3[_0x74d0('0x27')][_0x74d0('0x29')]};delete _0x19c7d3[_0x74d0('0x27')][_0x74d0('0x28')];delete _0x19c7d3['query'][_0x74d0('0x29')];_0x2439a8[_0x74d0('0x27')]=_[_0x74d0('0x26')](_0x19c7d3[_0x74d0('0x27')]);_0x2439a8['filters']=_[_0x74d0('0x2a')](_0x2439a8['model'],_0x2439a8['query']);_0x29de40[_0x74d0('0x2b')]=_[_0x74d0('0x2a')](_0x2439a8[_0x74d0('0x2c')],qs[_0x74d0('0x2d')](_0x19c7d3['query'][_0x74d0('0x2d')]));_0x29de40[_0x74d0('0x2b')]=_0x29de40[_0x74d0('0x2b')]['length']?_0x29de40[_0x74d0('0x2b')]:_0x2439a8[_0x74d0('0x2c')];if(!_0x19c7d3[_0x74d0('0x27')][_0x74d0('0x2e')](_0x74d0('0x2f'))){_0x29de40['limit']=qs[_0x74d0('0x18')](_0x19c7d3[_0x74d0('0x27')][_0x74d0('0x18')]);_0x29de40[_0x74d0('0x17')]=qs[_0x74d0('0x17')](_0x19c7d3[_0x74d0('0x27')][_0x74d0('0x17')]);}_0x29de40[_0x74d0('0x30')]=qs['sort'](_0x19c7d3['query']['sort']);_0x29de40[_0x74d0('0x31')]=qs[_0x74d0('0x32')](_[_0x74d0('0x33')](_0x19c7d3['query'],_0x2439a8['filters']));if(_0x19fef2[_0x74d0('0x28')]){if(_0x19fef2[_0x74d0('0x29')]){_0x19fef2[_0x74d0('0x29')]=moment(_0x19fef2[_0x74d0('0x29')])[_0x74d0('0x34')](0x1,'day');}else{_0x19fef2['dateEnd']=moment(_0x19fef2['dateStart'])['add'](0x1,_0x74d0('0x35'));}_['merge'](_0x29de40[_0x74d0('0x31')],{'createdAt':{'$gte':_0x19fef2[_0x74d0('0x28')],'$lte':_0x19fef2[_0x74d0('0x29')]}});}if(_0x19c7d3[_0x74d0('0x27')][_0x74d0('0x36')]){_0x29de40['where']=_[_0x74d0('0x37')](_0x29de40[_0x74d0('0x31')],{'$or':_[_0x74d0('0x38')](_0x29de40[_0x74d0('0x2b')],function(_0x41a1b4){var _0x4d1771={};_0x4d1771[_0x41a1b4]={'$like':'%'+_0x19c7d3[_0x74d0('0x27')]['filter']+'%'};return _0x4d1771;})});}_0x29de40=_['merge']({},_0x29de40,_0x19c7d3['options']);var _0x1c1ca1={'where':_0x29de40[_0x74d0('0x31')]};return db[_0x74d0('0x24')]['count'](_0x1c1ca1)[_0x74d0('0x1d')](function(_0x125f97){_0x1bf696[_0x74d0('0x16')]=_0x125f97;if(_0x19c7d3['query'][_0x74d0('0x39')]){_0x29de40['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x74d0('0x3a')](_0x29de40);})[_0x74d0('0x1d')](function(_0x12b037){_0x1bf696[_0x74d0('0x3b')]=_0x12b037;return _0x1bf696;})[_0x74d0('0x1d')](respondWithFilteredResult(_0x47d2b4,_0x29de40))[_0x74d0('0x3c')](handleError(_0x47d2b4,null));};exports['show']=function(_0x45426b,_0x5adffd){var _0x54f2f5={'raw':!![],'where':{'id':_0x45426b[_0x74d0('0x3d')]['id']}},_0x395123={};_0x395123[_0x74d0('0x2c')]=_['keys'](db[_0x74d0('0x24')][_0x74d0('0x25')]);_0x395123[_0x74d0('0x27')]=_[_0x74d0('0x26')](_0x45426b[_0x74d0('0x27')]);_0x395123[_0x74d0('0x32')]=_[_0x74d0('0x2a')](_0x395123[_0x74d0('0x2c')],_0x395123[_0x74d0('0x27')]);_0x54f2f5['attributes']=_[_0x74d0('0x2a')](_0x395123[_0x74d0('0x2c')],qs[_0x74d0('0x2d')](_0x45426b['query'][_0x74d0('0x2d')]));_0x54f2f5[_0x74d0('0x2b')]=_0x54f2f5[_0x74d0('0x2b')][_0x74d0('0x3e')]?_0x54f2f5[_0x74d0('0x2b')]:_0x395123[_0x74d0('0x2c')];if(_0x45426b[_0x74d0('0x27')][_0x74d0('0x39')]){_0x54f2f5[_0x74d0('0x3f')]=[{'all':!![]}];}_0x54f2f5=_[_0x74d0('0x37')]({},_0x54f2f5,_0x45426b[_0x74d0('0x40')]);return db['JscriptyQuestionReport'][_0x74d0('0x41')](_0x54f2f5)[_0x74d0('0x1d')](handleEntityNotFound(_0x5adffd,null))[_0x74d0('0x1d')](respondWithResult(_0x5adffd,null))[_0x74d0('0x3c')](handleError(_0x5adffd,null));};exports[_0x74d0('0x42')]=function(_0x116fa4,_0x39b4ce){return db[_0x74d0('0x24')][_0x74d0('0x42')](_0x116fa4['body'],{})[_0x74d0('0x1d')](respondWithResult(_0x39b4ce,0xc9))[_0x74d0('0x3c')](handleError(_0x39b4ce,null));};exports[_0x74d0('0x43')]=function(_0x268126,_0x5d4997){if(_0x268126[_0x74d0('0x44')]['id']){delete _0x268126['body']['id'];}return db[_0x74d0('0x24')][_0x74d0('0x41')]({'where':{'id':_0x268126[_0x74d0('0x3d')]['id']}})[_0x74d0('0x1d')](handleEntityNotFound(_0x5d4997,null))[_0x74d0('0x1d')](saveUpdates(_0x268126[_0x74d0('0x44')],null))[_0x74d0('0x1d')](respondWithResult(_0x5d4997,null))['catch'](handleError(_0x5d4997,null));};exports[_0x74d0('0x1e')]=function(_0x2104d9,_0x3b142e){return db[_0x74d0('0x24')][_0x74d0('0x41')]({'where':{'id':_0x2104d9[_0x74d0('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3b142e,null))['then'](removeEntity(_0x3b142e,null))[_0x74d0('0x3c')](handleError(_0x3b142e,null));};exports[_0x74d0('0x45')]=function(_0x148f80,_0x53822e){return db['JscriptyQuestionReport'][_0x74d0('0x45')]()[_0x74d0('0x1d')](respondWithResult(_0x53822e,null))['catch'](handleError(_0x53822e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 05b7721..38214ff 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 _0x21aa=['lodash','../../config/logger','api','moment','bluebird','request-promise','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport'];(function(_0x33e152,_0x3510cf){var _0x53cbf9=function(_0x5d984b){while(--_0x5d984b){_0x33e152['push'](_0x33e152['shift']());}};_0x53cbf9(++_0x3510cf);}(_0x21aa,0x154));var _0xa21a=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x21aa[_0x9dfc10];return _0x4f938a;};'use strict';var _=require(_0xa21a('0x0'));var util=require('util');var logger=require(_0xa21a('0x1'))(_0xa21a('0x2'));var moment=require(_0xa21a('0x3'));var BPromise=require(_0xa21a('0x4'));var rp=require(_0xa21a('0x5'));var attributes=require(_0xa21a('0x6'));module[_0xa21a('0x7')]=function(_0x4f8f64,_0xd059a){return _0x4f8f64[_0xa21a('0x8')](_0xa21a('0x9'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e27=['moment','bluebird','request-promise','exports','JscriptyQuestionReport','lodash','util','api'];(function(_0x1dfd1a,_0x4c4a1a){var _0x47f357=function(_0x52b07c){while(--_0x52b07c){_0x1dfd1a['push'](_0x1dfd1a['shift']());}};_0x47f357(++_0x4c4a1a);}(_0x7e27,0xdd));var _0x77e2=function(_0x112a45,_0x53b763){_0x112a45=_0x112a45-0x0;var _0x2d0888=_0x7e27[_0x112a45];return _0x2d0888;};'use strict';var _=require(_0x77e2('0x0'));var util=require(_0x77e2('0x1'));var logger=require('../../config/logger')(_0x77e2('0x2'));var moment=require(_0x77e2('0x3'));var BPromise=require(_0x77e2('0x4'));var rp=require(_0x77e2('0x5'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x77e2('0x6')]=function(_0x21bb94,_0x20c6f0){return _0x21bb94['define'](_0x77e2('0x7'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 54e04af..c6b82e7 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 _0x7bcf=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0xc447b0,_0x171735){var _0x571a9d=function(_0x371eb6){while(--_0x371eb6){_0xc447b0['push'](_0xc447b0['shift']());}};_0x571a9d(++_0x171735);}(_0x7bcf,0x8c));var _0xf7bc=function(_0x10a11e,_0x1b5c6d){_0x10a11e=_0x10a11e-0x0;var _0x5a8609=_0x7bcf[_0x10a11e];return _0x5a8609;};'use strict';var _=require('lodash');var util=require(_0xf7bc('0x0'));var moment=require('moment');var BPromise=require(_0xf7bc('0x1'));var rs=require(_0xf7bc('0x2'));var fs=require('fs');var db=require(_0xf7bc('0x3'))['db'];var utils=require(_0xf7bc('0x4'));var logger=require(_0xf7bc('0x5'))(_0xf7bc('0x6'));var config=require(_0xf7bc('0x7'));var jayson=require(_0xf7bc('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3f6ab9,_0x2e0e1c,_0xcaf7ad){return new BPromise(function(_0x51b2fe,_0x500d7c){return client[_0xf7bc('0x9')](_0x3f6ab9,_0xcaf7ad)[_0xf7bc('0xa')](function(_0x31659e){logger[_0xf7bc('0xb')](_0xf7bc('0xc'),_0x2e0e1c,_0xf7bc('0xd'));logger[_0xf7bc('0xe')](_0xf7bc('0xf'),_0x2e0e1c,_0xf7bc('0xd'),JSON['stringify'](_0x31659e));if(_0x31659e[_0xf7bc('0x10')]){if(_0x31659e[_0xf7bc('0x10')][_0xf7bc('0x11')]===0x1f4){logger['error'](_0xf7bc('0xc'),_0x2e0e1c,_0x31659e[_0xf7bc('0x10')][_0xf7bc('0x12')]);return _0x500d7c(_0x31659e['error'][_0xf7bc('0x12')]);}logger[_0xf7bc('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2e0e1c,_0x31659e[_0xf7bc('0x10')]['message']);return _0x51b2fe(_0x31659e[_0xf7bc('0x10')][_0xf7bc('0x12')]);}else{logger[_0xf7bc('0xb')](_0xf7bc('0xc'),_0x2e0e1c,_0xf7bc('0xd'));_0x51b2fe(_0x31659e[_0xf7bc('0x13')][_0xf7bc('0x12')]);}})['catch'](function(_0x16dae5){logger[_0xf7bc('0x10')](_0xf7bc('0xc'),_0x2e0e1c,_0x16dae5);_0x500d7c(_0x16dae5);});});} \ No newline at end of file +var _0xc73d=['message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x47bc5e,_0x6fc500){var _0x323a59=function(_0x32df89){while(--_0x32df89){_0x47bc5e['push'](_0x47bc5e['shift']());}};_0x323a59(++_0x6fc500);}(_0xc73d,0x10b));var _0xdc73=function(_0x5d1e3b,_0x576d0c){_0x5d1e3b=_0x5d1e3b-0x0;var _0x33f7b0=_0xc73d[_0x5d1e3b];return _0x33f7b0;};'use strict';var _=require(_0xdc73('0x0'));var util=require('util');var moment=require(_0xdc73('0x1'));var BPromise=require(_0xdc73('0x2'));var rs=require(_0xdc73('0x3'));var fs=require('fs');var db=require(_0xdc73('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdc73('0x5'))(_0xdc73('0x6'));var config=require(_0xdc73('0x7'));var jayson=require(_0xdc73('0x8'));var client=jayson['client'][_0xdc73('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b4c7c,_0x254beb,_0xc5b8be){return new BPromise(function(_0x2a350b,_0x12c9ad){return client[_0xdc73('0xa')](_0x1b4c7c,_0xc5b8be)[_0xdc73('0xb')](function(_0x1c87cc){logger[_0xdc73('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x254beb,_0xdc73('0xd'));logger[_0xdc73('0xe')](_0xdc73('0xf'),_0x254beb,_0xdc73('0xd'),JSON['stringify'](_0x1c87cc));if(_0x1c87cc[_0xdc73('0x10')]){if(_0x1c87cc[_0xdc73('0x10')][_0xdc73('0x11')]===0x1f4){logger[_0xdc73('0x10')](_0xdc73('0x12'),_0x254beb,_0x1c87cc[_0xdc73('0x10')][_0xdc73('0x13')]);return _0x12c9ad(_0x1c87cc[_0xdc73('0x10')][_0xdc73('0x13')]);}logger[_0xdc73('0x10')](_0xdc73('0x12'),_0x254beb,_0x1c87cc['error'][_0xdc73('0x13')]);return _0x2a350b(_0x1c87cc['error'][_0xdc73('0x13')]);}else{logger[_0xdc73('0xc')](_0xdc73('0x12'),_0x254beb,_0xdc73('0xd'));_0x2a350b(_0x1c87cc[_0xdc73('0x14')][_0xdc73('0x13')]);}})[_0xdc73('0x15')](function(_0x1ae0c0){logger['error'](_0xdc73('0x12'),_0x254beb,_0x1ae0c0);_0x12c9ad(_0x1ae0c0);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index d4e63d3..b4f3c25 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 _0x6327=['update','delete','util','path','express','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','/:id/questions','getQuestions','post','create','put','/:id'];(function(_0x3a4fd8,_0x1df182){var _0x2c6580=function(_0x4893b2){while(--_0x4893b2){_0x3a4fd8['push'](_0x3a4fd8['shift']());}};_0x2c6580(++_0x1df182);}(_0x6327,0x191));var _0x7632=function(_0x2c6120,_0x1f3e60){_0x2c6120=_0x2c6120-0x0;var _0x5fb114=_0x6327[_0x2c6120];return _0x5fb114;};'use strict';var multer=require('multer');var util=require(_0x7632('0x0'));var path=require(_0x7632('0x1'));var express=require(_0x7632('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7632('0x3'));var config=require(_0x7632('0x4'));var controller=require('./jscriptySessionReport.controller');router[_0x7632('0x5')]('/',auth['isAuthenticated'](),controller[_0x7632('0x6')]);router[_0x7632('0x5')](_0x7632('0x7'),auth[_0x7632('0x8')](),controller[_0x7632('0x9')]);router[_0x7632('0x5')]('/:id',auth[_0x7632('0x8')](),controller[_0x7632('0xa')]);router['get'](_0x7632('0xb'),auth[_0x7632('0x8')](),controller[_0x7632('0xc')]);router[_0x7632('0xd')]('/',auth[_0x7632('0x8')](),controller[_0x7632('0xe')]);router[_0x7632('0xf')](_0x7632('0x10'),auth[_0x7632('0x8')](),controller[_0x7632('0x11')]);router[_0x7632('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd11b=['index','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated'];(function(_0x539a97,_0x5c2368){var _0x3ae558=function(_0x166576){while(--_0x166576){_0x539a97['push'](_0x539a97['shift']());}};_0x3ae558(++_0x5c2368);}(_0xd11b,0xdd));var _0xbd11=function(_0x1dcdc1,_0x2fdd77){_0x1dcdc1=_0x1dcdc1-0x0;var _0x24a48c=_0xd11b[_0x1dcdc1];return _0x24a48c;};'use strict';var multer=require('multer');var util=require(_0xbd11('0x0'));var path=require(_0xbd11('0x1'));var express=require(_0xbd11('0x2'));var router=express[_0xbd11('0x3')]();var auth=require(_0xbd11('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbd11('0x5'));var controller=require(_0xbd11('0x6'));router[_0xbd11('0x7')]('/',auth[_0xbd11('0x8')](),controller[_0xbd11('0x9')]);router['get'](_0xbd11('0xa'),auth[_0xbd11('0x8')](),controller[_0xbd11('0xb')]);router[_0xbd11('0x7')](_0xbd11('0xc'),auth['isAuthenticated'](),controller[_0xbd11('0xd')]);router[_0xbd11('0x7')](_0xbd11('0xe'),auth['isAuthenticated'](),controller[_0xbd11('0xf')]);router[_0xbd11('0x10')]('/',auth[_0xbd11('0x8')](),controller[_0xbd11('0x11')]);router[_0xbd11('0x12')](_0xbd11('0xc'),auth[_0xbd11('0x8')](),controller[_0xbd11('0x13')]);router[_0xbd11('0x14')](_0xbd11('0xc'),auth[_0xbd11('0x8')](),controller[_0xbd11('0x15')]);module[_0xbd11('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 9694300..f6d04b1 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 _0x1177=['endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','sequelize','exports','DATE','setDataValue','starttime'];(function(_0x5c8edb,_0x105253){var _0x5a1451=function(_0x5371f8){while(--_0x5371f8){_0x5c8edb['push'](_0x5c8edb['shift']());}};_0x5a1451(++_0x105253);}(_0x1177,0x10b));var _0x7117=function(_0x400c9d,_0x101ef1){_0x400c9d=_0x400c9d-0x0;var _0x5e4276=_0x1177[_0x400c9d];return _0x5e4276;};'use strict';var moment=require('moment');var Sequelize=require(_0x7117('0x0'));module[_0x7117('0x1')]={'starttime':{'type':Sequelize[_0x7117('0x2')],'set':function(_0x4be118){this[_0x7117('0x3')](_0x7117('0x4'),_0x4be118);this[_0x7117('0x3')](_0x7117('0x5'),moment()['format'](_0x7117('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x7117('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7117('0x7')]},'calleridname':{'type':Sequelize[_0x7117('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x4743=['BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime','endtime','format','STRING'];(function(_0x368bba,_0x1f625b){var _0x409f8f=function(_0x463373){while(--_0x463373){_0x368bba['push'](_0x368bba['shift']());}};_0x409f8f(++_0x1f625b);}(_0x4743,0x173));var _0x3474=function(_0x34df4a,_0x209d10){_0x34df4a=_0x34df4a-0x0;var _0x145c69=_0x4743[_0x34df4a];return _0x145c69;};'use strict';var moment=require(_0x3474('0x0'));var Sequelize=require(_0x3474('0x1'));module[_0x3474('0x2')]={'starttime':{'type':Sequelize[_0x3474('0x3')],'set':function(_0xd0f726){this[_0x3474('0x4')](_0x3474('0x5'),_0xd0f726);this['setDataValue'](_0x3474('0x6'),moment()[_0x3474('0x7')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x3474('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x3474('0x8')]},'queue':{'type':Sequelize[_0x3474('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3474('0x8')]},'completed':{'type':Sequelize[_0x3474('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 6c93183..260c1b3 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 _0x48ea=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','add','day','merge','filter','map','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','findOne','JscriptyQuestionReport','SessionId','rows','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','JscriptySessionReport','rawAttributes','model','keys','query','dateEnd','dateStart','filters'];(function(_0x7c493f,_0x68e442){var _0x210564=function(_0x22d574){while(--_0x22d574){_0x7c493f['push'](_0x7c493f['shift']());}};_0x210564(++_0x68e442);}(_0x48ea,0xaf));var _0xa48e=function(_0x5bd620,_0x4ab05e){_0x5bd620=_0x5bd620-0x0;var _0x55c678=_0x48ea[_0x5bd620];return _0x55c678;};'use strict';var jsonpatch=require(_0xa48e('0x0'));var rp=require(_0xa48e('0x1'));var moment=require(_0xa48e('0x2'));var BPromise=require(_0xa48e('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa48e('0x4'));var sox=require(_0xa48e('0x5'));var csv=require(_0xa48e('0x6'));var ejs=require(_0xa48e('0x7'));var fs=require('fs');var _=require(_0xa48e('0x8'));var squel=require(_0xa48e('0x9'));var crypto=require(_0xa48e('0xa'));var jsforce=require(_0xa48e('0xb'));var deskjs=require(_0xa48e('0xc'));var toCsv=require(_0xa48e('0x6'));var querystring=require('querystring');var Papa=require(_0xa48e('0xd'));var qs=require(_0xa48e('0xe'));var logger=require('../../config/logger')(_0xa48e('0xf'));var utils=require(_0xa48e('0x10'));var config=require('../../config/environment');var db=require(_0xa48e('0x11'))['db'];function respondWithStatusCode(_0x372d25,_0x1b2673){_0x1b2673=_0x1b2673||0xcc;return function(_0xceb3b5){if(_0xceb3b5){return _0x372d25[_0xa48e('0x12')](_0x1b2673);}return _0x372d25[_0xa48e('0x13')](_0x1b2673)[_0xa48e('0x14')]();};}function respondWithResult(_0x5e8bf3,_0x259696){_0x259696=_0x259696||0xc8;return function(_0x2b1476){if(_0x2b1476){return _0x5e8bf3['status'](_0x259696)[_0xa48e('0x15')](_0x2b1476);}};}function respondWithFilteredResult(_0x64195f,_0x428bcd){return function(_0x2b023a){if(_0x2b023a){var _0x449da5=_0x2b023a[_0xa48e('0x16')],_0x4a2bd7=_0x428bcd[_0xa48e('0x17')],_0x2b31fa=_0x428bcd[_0xa48e('0x17')]+_0x428bcd[_0xa48e('0x18')],_0x48abe7;if(_0x2b31fa>=_0x449da5){_0x2b31fa=_0x449da5;_0x48abe7=0xc8;}else{_0x48abe7=0xce;}_0x64195f[_0xa48e('0x13')](_0x48abe7);return _0x64195f['set'](_0xa48e('0x19'),_0x4a2bd7+'-'+_0x2b31fa+'/'+_0x449da5)[_0xa48e('0x15')](_0x2b023a);}return null;};}function patchUpdates(_0x4ff3f5){return function(_0x6feb8f){try{jsonpatch[_0xa48e('0x1a')](_0x6feb8f,_0x4ff3f5,!![]);}catch(_0x4ac335){return BPromise[_0xa48e('0x1b')](_0x4ac335);}return _0x6feb8f[_0xa48e('0x1c')]();};}function saveUpdates(_0x21b530,_0x132d5b){return function(_0x2b5131){if(_0x2b5131){return _0x2b5131[_0xa48e('0x1d')](_0x21b530)[_0xa48e('0x1e')](function(_0x58c09b){return _0x58c09b;});}return null;};}function removeEntity(_0xd74294,_0x295fba){return function(_0x217da6){if(_0x217da6){return _0x217da6[_0xa48e('0x1f')]()[_0xa48e('0x1e')](function(){_0xd74294['status'](0xcc)[_0xa48e('0x14')]();});}};}function handleEntityNotFound(_0x25e14d,_0x3eee01){return function(_0xdf44f0){if(!_0xdf44f0){_0x25e14d['sendStatus'](0x194);}return _0xdf44f0;};}function handleError(_0x4e889c,_0x11b5cf){_0x11b5cf=_0x11b5cf||0x1f4;return function(_0x257dff){logger['error'](_0x257dff[_0xa48e('0x20')]);if(_0x257dff[_0xa48e('0x21')]){delete _0x257dff[_0xa48e('0x21')];}_0x4e889c[_0xa48e('0x13')](_0x11b5cf)[_0xa48e('0x22')](_0x257dff);};}exports[_0xa48e('0x23')]=function(_0x32bc14,_0x5751bd){var _0x4f128f={},_0x1ea466={},_0x5db979={'count':0x0,'rows':[]};var _0x55c8c7=db[_0xa48e('0x24')][_0xa48e('0x25')];_0x1ea466[_0xa48e('0x26')]=_[_0xa48e('0x27')](_0x55c8c7);var _0x4c8bed={'dateStart':_0x32bc14[_0xa48e('0x28')]['dateStart'],'dateEnd':_0x32bc14['query'][_0xa48e('0x29')]};delete _0x32bc14[_0xa48e('0x28')][_0xa48e('0x2a')];delete _0x32bc14['query'][_0xa48e('0x29')];_0x1ea466[_0xa48e('0x28')]=_[_0xa48e('0x27')](_0x32bc14['query']);_0x1ea466[_0xa48e('0x2b')]=_[_0xa48e('0x2c')](_0x1ea466[_0xa48e('0x26')],_0x1ea466[_0xa48e('0x28')]);_0x4f128f[_0xa48e('0x2d')]=_['intersection'](_0x1ea466['model'],qs[_0xa48e('0x2e')](_0x32bc14[_0xa48e('0x28')][_0xa48e('0x2e')]));_0x4f128f['attributes']=_0x4f128f['attributes'][_0xa48e('0x2f')]?_0x4f128f[_0xa48e('0x2d')]:_0x1ea466['model'];if(!_0x32bc14[_0xa48e('0x28')][_0xa48e('0x30')](_0xa48e('0x31'))){_0x4f128f['limit']=qs['limit'](_0x32bc14[_0xa48e('0x28')]['limit']);_0x4f128f[_0xa48e('0x17')]=qs['offset'](_0x32bc14[_0xa48e('0x28')]['offset']);}_0x4f128f[_0xa48e('0x32')]=qs['sort'](_0x32bc14[_0xa48e('0x28')][_0xa48e('0x33')]);_0x4f128f[_0xa48e('0x34')]=qs['filters'](_['pick'](_0x32bc14[_0xa48e('0x28')],_0x1ea466['filters']));if(_0x4c8bed['dateStart']){if(_0x4c8bed[_0xa48e('0x29')]){_0x4c8bed[_0xa48e('0x29')]=moment(_0x4c8bed[_0xa48e('0x29')])['add'](0x1,'day');}else{_0x4c8bed[_0xa48e('0x29')]=moment(_0x4c8bed[_0xa48e('0x2a')])[_0xa48e('0x35')](0x1,_0xa48e('0x36'));}_[_0xa48e('0x37')](_0x4f128f[_0xa48e('0x34')],{'createdAt':{'$gte':_0x4c8bed[_0xa48e('0x2a')],'$lte':_0x4c8bed[_0xa48e('0x29')]}});}if(_0x32bc14[_0xa48e('0x28')][_0xa48e('0x38')]){_0x4f128f['where']=_[_0xa48e('0x37')](_0x4f128f[_0xa48e('0x34')],{'$or':_[_0xa48e('0x39')](_0x4f128f['attributes'],function(_0x2796b1){var _0x4d6958={};_0x4d6958[_0x2796b1]={'$like':'%'+_0x32bc14[_0xa48e('0x28')][_0xa48e('0x38')]+'%'};return _0x4d6958;})});}_0x4f128f=_['merge']({},_0x4f128f,_0x32bc14[_0xa48e('0x3a')]);var _0x1ef4ca={'where':_0x4f128f['where']};return db[_0xa48e('0x24')][_0xa48e('0x16')](_0x1ef4ca)['then'](function(_0x2cdeb9){_0x5db979[_0xa48e('0x16')]=_0x2cdeb9;if(_0x32bc14['query'][_0xa48e('0x3b')]){_0x4f128f[_0xa48e('0x3c')]=[{'all':!![]}];}return db[_0xa48e('0x24')][_0xa48e('0x3d')](_0x4f128f);})[_0xa48e('0x1e')](function(_0x4f84b6){_0x5db979['rows']=_0x4f84b6;return _0x5db979;})['then'](respondWithFilteredResult(_0x5751bd,_0x4f128f))[_0xa48e('0x3e')](handleError(_0x5751bd,null));};exports[_0xa48e('0x3f')]=function(_0x268241,_0x5e3789){var _0x2c4563={'raw':!![],'where':{'id':_0x268241[_0xa48e('0x40')]['id']}},_0x4fabb3={};_0x4fabb3[_0xa48e('0x26')]=_['keys'](db[_0xa48e('0x24')][_0xa48e('0x25')]);_0x4fabb3['query']=_[_0xa48e('0x27')](_0x268241[_0xa48e('0x28')]);_0x4fabb3[_0xa48e('0x2b')]=_[_0xa48e('0x2c')](_0x4fabb3[_0xa48e('0x26')],_0x4fabb3[_0xa48e('0x28')]);_0x2c4563[_0xa48e('0x2d')]=_[_0xa48e('0x2c')](_0x4fabb3['model'],qs[_0xa48e('0x2e')](_0x268241[_0xa48e('0x28')]['fields']));_0x2c4563[_0xa48e('0x2d')]=_0x2c4563[_0xa48e('0x2d')][_0xa48e('0x2f')]?_0x2c4563[_0xa48e('0x2d')]:_0x4fabb3[_0xa48e('0x26')];if(_0x268241[_0xa48e('0x28')][_0xa48e('0x3b')]){_0x2c4563['include']=[{'all':!![]}];}_0x2c4563=_[_0xa48e('0x37')]({},_0x2c4563,_0x268241['options']);return db['JscriptySessionReport'][_0xa48e('0x41')](_0x2c4563)[_0xa48e('0x1e')](handleEntityNotFound(_0x5e3789,null))[_0xa48e('0x1e')](respondWithResult(_0x5e3789,null))[_0xa48e('0x3e')](handleError(_0x5e3789,null));};exports[_0xa48e('0x42')]=function(_0x1c79d9,_0x495e92){return db['JscriptySessionReport'][_0xa48e('0x42')](_0x1c79d9[_0xa48e('0x43')],{})[_0xa48e('0x1e')](respondWithResult(_0x495e92,0xc9))['catch'](handleError(_0x495e92,null));};exports['update']=function(_0x2094b7,_0x33e8ca){if(_0x2094b7[_0xa48e('0x43')]['id']){delete _0x2094b7[_0xa48e('0x43')]['id'];}return db['JscriptySessionReport'][_0xa48e('0x41')]({'where':{'id':_0x2094b7[_0xa48e('0x40')]['id']}})[_0xa48e('0x1e')](handleEntityNotFound(_0x33e8ca,null))[_0xa48e('0x1e')](saveUpdates(_0x2094b7['body'],null))[_0xa48e('0x1e')](respondWithResult(_0x33e8ca,null))[_0xa48e('0x3e')](handleError(_0x33e8ca,null));};exports['destroy']=function(_0x11772e,_0x4406a0){return db[_0xa48e('0x24')][_0xa48e('0x41')]({'where':{'id':_0x11772e[_0xa48e('0x40')]['id']}})[_0xa48e('0x1e')](handleEntityNotFound(_0x4406a0,null))[_0xa48e('0x1e')](removeEntity(_0x4406a0,null))[_0xa48e('0x3e')](handleError(_0x4406a0,null));};exports[_0xa48e('0x44')]=function(_0xfc485a,_0x24c802){return db[_0xa48e('0x24')]['describe']()[_0xa48e('0x1e')](respondWithResult(_0x24c802,null))[_0xa48e('0x3e')](handleError(_0x24c802,null));};exports['getQuestions']=function(_0x4e0fd8,_0x288f11,_0x5e08b7){var _0x11d647={'raw':!![],'where':{}};var _0x14b311={};var _0x2b05bb={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xa48e('0x45')]({'where':{'id':_0x4e0fd8[_0xa48e('0x40')]['id']}})[_0xa48e('0x1e')](handleEntityNotFound(_0x288f11,null))[_0xa48e('0x1e')](function(_0x4581b6){if(_0x4581b6){_0x14b311[_0xa48e('0x26')]=_[_0xa48e('0x27')](db[_0xa48e('0x46')][_0xa48e('0x25')]);_0x14b311[_0xa48e('0x28')]=_[_0xa48e('0x27')](_0x4e0fd8[_0xa48e('0x28')]);_0x14b311['filters']=_['intersection'](_0x14b311[_0xa48e('0x26')],_0x14b311[_0xa48e('0x28')]);_0x11d647[_0xa48e('0x2d')]=_[_0xa48e('0x2c')](_0x14b311['model'],qs['fields'](_0x4e0fd8[_0xa48e('0x28')][_0xa48e('0x2e')]));_0x11d647[_0xa48e('0x2d')]=_0x11d647[_0xa48e('0x2d')][_0xa48e('0x2f')]?_0x11d647[_0xa48e('0x2d')]:_0x14b311['model'];if(!_0x4e0fd8[_0xa48e('0x28')][_0xa48e('0x30')](_0xa48e('0x31'))){_0x11d647['limit']=qs[_0xa48e('0x18')](_0x4e0fd8[_0xa48e('0x28')][_0xa48e('0x18')]);_0x11d647[_0xa48e('0x17')]=qs[_0xa48e('0x17')](_0x4e0fd8[_0xa48e('0x28')][_0xa48e('0x17')]);}_0x11d647['order']=qs[_0xa48e('0x33')](_0x4e0fd8[_0xa48e('0x28')][_0xa48e('0x33')]);_0x11d647[_0xa48e('0x34')]=qs[_0xa48e('0x2b')](_['pick'](_0x4e0fd8[_0xa48e('0x28')],_0x14b311['filters']));_0x11d647['where'][_0xa48e('0x47')]=_0x4581b6['id'];if(_0x4e0fd8[_0xa48e('0x28')]['filter']){_0x11d647[_0xa48e('0x34')]=_[_0xa48e('0x37')](_0x11d647[_0xa48e('0x34')],{'$or':_[_0xa48e('0x39')](_0x11d647['attributes'],function(_0x38b3a3){var _0x306bd6={};_0x306bd6[_0x38b3a3]={'$like':'%'+_0x4e0fd8[_0xa48e('0x28')][_0xa48e('0x38')]+'%'};return _0x306bd6;})});}_0x11d647=_[_0xa48e('0x37')]({},_0x11d647,_0x4e0fd8[_0xa48e('0x3a')]);return db[_0xa48e('0x46')][_0xa48e('0x16')]({'where':_0x11d647['where']})[_0xa48e('0x1e')](function(_0x182348){_0x2b05bb['count']=_0x182348;if(_0x4e0fd8[_0xa48e('0x28')][_0xa48e('0x3b')]){_0x11d647[_0xa48e('0x3c')]=[{'all':!![]}];}return db[_0xa48e('0x46')][_0xa48e('0x3d')](_0x11d647);})['then'](function(_0x4a053f){_0x2b05bb[_0xa48e('0x48')]=_0x4a053f;return _0x2b05bb;});}})['then'](respondWithFilteredResult(_0x288f11,_0x11d647))[_0xa48e('0x3e')](handleError(_0x288f11,null));}; \ No newline at end of file +var _0x043b=['nolimit','limit','order','sort','where','pick','day','add','merge','filter','map','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','getQuestions','JscriptyQuestionReport','SessionId','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','stack','name','send','index','JscriptySessionReport','rawAttributes','model','keys','query','dateEnd','dateStart','filters','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x043b,0x146));var _0xb043=function(_0x3cf0dc,_0x1b34c4){_0x3cf0dc=_0x3cf0dc-0x0;var _0x2f2d97=_0x043b[_0x3cf0dc];return _0x2f2d97;};'use strict';var jsonpatch=require(_0xb043('0x0'));var rp=require(_0xb043('0x1'));var moment=require(_0xb043('0x2'));var BPromise=require(_0xb043('0x3'));var Mustache=require(_0xb043('0x4'));var util=require(_0xb043('0x5'));var path=require(_0xb043('0x6'));var sox=require(_0xb043('0x7'));var csv=require(_0xb043('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb043('0x9'));var squel=require(_0xb043('0xa'));var crypto=require(_0xb043('0xb'));var jsforce=require(_0xb043('0xc'));var deskjs=require(_0xb043('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb043('0xe'));var qs=require(_0xb043('0xf'));var logger=require(_0xb043('0x10'))(_0xb043('0x11'));var utils=require(_0xb043('0x12'));var config=require(_0xb043('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0fee,_0xe4ca0d){_0xe4ca0d=_0xe4ca0d||0xcc;return function(_0x3ff6a1){if(_0x3ff6a1){return _0x2a0fee['sendStatus'](_0xe4ca0d);}return _0x2a0fee[_0xb043('0x14')](_0xe4ca0d)[_0xb043('0x15')]();};}function respondWithResult(_0x485169,_0x144f9b){_0x144f9b=_0x144f9b||0xc8;return function(_0x17d314){if(_0x17d314){return _0x485169[_0xb043('0x14')](_0x144f9b)[_0xb043('0x16')](_0x17d314);}};}function respondWithFilteredResult(_0x1d5ea3,_0x30a448){return function(_0x230aec){if(_0x230aec){var _0x5c5b62=_0x230aec[_0xb043('0x17')],_0x3736f3=_0x30a448[_0xb043('0x18')],_0x2fd52d=_0x30a448[_0xb043('0x18')]+_0x30a448['limit'],_0x229f75;if(_0x2fd52d>=_0x5c5b62){_0x2fd52d=_0x5c5b62;_0x229f75=0xc8;}else{_0x229f75=0xce;}_0x1d5ea3[_0xb043('0x14')](_0x229f75);return _0x1d5ea3[_0xb043('0x19')]('Content-Range',_0x3736f3+'-'+_0x2fd52d+'/'+_0x5c5b62)['json'](_0x230aec);}return null;};}function patchUpdates(_0x5f4f3f){return function(_0x569b80){try{jsonpatch[_0xb043('0x1a')](_0x569b80,_0x5f4f3f,!![]);}catch(_0x4610fb){return BPromise[_0xb043('0x1b')](_0x4610fb);}return _0x569b80[_0xb043('0x1c')]();};}function saveUpdates(_0x2ac102,_0x1c324c){return function(_0xb92c03){if(_0xb92c03){return _0xb92c03[_0xb043('0x1d')](_0x2ac102)[_0xb043('0x1e')](function(_0x3370d4){return _0x3370d4;});}return null;};}function removeEntity(_0x100e8e,_0x2c1335){return function(_0x3828ea){if(_0x3828ea){return _0x3828ea[_0xb043('0x1f')]()['then'](function(){_0x100e8e[_0xb043('0x14')](0xcc)[_0xb043('0x15')]();});}};}function handleEntityNotFound(_0x130899,_0x376972){return function(_0x2a07de){if(!_0x2a07de){_0x130899['sendStatus'](0x194);}return _0x2a07de;};}function handleError(_0x5a90ef,_0x40d64c){_0x40d64c=_0x40d64c||0x1f4;return function(_0x2bce58){logger['error'](_0x2bce58[_0xb043('0x20')]);if(_0x2bce58['name']){delete _0x2bce58[_0xb043('0x21')];}_0x5a90ef[_0xb043('0x14')](_0x40d64c)[_0xb043('0x22')](_0x2bce58);};}exports[_0xb043('0x23')]=function(_0x5d95b8,_0xe1dbb8){var _0x2880e4={},_0xc6ce72={},_0x45ae4d={'count':0x0,'rows':[]};var _0x4cdeed=db[_0xb043('0x24')][_0xb043('0x25')];_0xc6ce72[_0xb043('0x26')]=_[_0xb043('0x27')](_0x4cdeed);var _0x643287={'dateStart':_0x5d95b8[_0xb043('0x28')]['dateStart'],'dateEnd':_0x5d95b8[_0xb043('0x28')][_0xb043('0x29')]};delete _0x5d95b8[_0xb043('0x28')][_0xb043('0x2a')];delete _0x5d95b8['query'][_0xb043('0x29')];_0xc6ce72[_0xb043('0x28')]=_[_0xb043('0x27')](_0x5d95b8[_0xb043('0x28')]);_0xc6ce72[_0xb043('0x2b')]=_['intersection'](_0xc6ce72['model'],_0xc6ce72[_0xb043('0x28')]);_0x2880e4[_0xb043('0x2c')]=_[_0xb043('0x2d')](_0xc6ce72['model'],qs[_0xb043('0x2e')](_0x5d95b8[_0xb043('0x28')]['fields']));_0x2880e4['attributes']=_0x2880e4[_0xb043('0x2c')][_0xb043('0x2f')]?_0x2880e4[_0xb043('0x2c')]:_0xc6ce72[_0xb043('0x26')];if(!_0x5d95b8[_0xb043('0x28')][_0xb043('0x30')](_0xb043('0x31'))){_0x2880e4['limit']=qs['limit'](_0x5d95b8[_0xb043('0x28')][_0xb043('0x32')]);_0x2880e4[_0xb043('0x18')]=qs[_0xb043('0x18')](_0x5d95b8[_0xb043('0x28')][_0xb043('0x18')]);}_0x2880e4[_0xb043('0x33')]=qs[_0xb043('0x34')](_0x5d95b8['query'][_0xb043('0x34')]);_0x2880e4[_0xb043('0x35')]=qs[_0xb043('0x2b')](_[_0xb043('0x36')](_0x5d95b8[_0xb043('0x28')],_0xc6ce72[_0xb043('0x2b')]));if(_0x643287['dateStart']){if(_0x643287[_0xb043('0x29')]){_0x643287[_0xb043('0x29')]=moment(_0x643287['dateEnd'])['add'](0x1,_0xb043('0x37'));}else{_0x643287[_0xb043('0x29')]=moment(_0x643287['dateStart'])[_0xb043('0x38')](0x1,_0xb043('0x37'));}_[_0xb043('0x39')](_0x2880e4[_0xb043('0x35')],{'createdAt':{'$gte':_0x643287[_0xb043('0x2a')],'$lte':_0x643287['dateEnd']}});}if(_0x5d95b8[_0xb043('0x28')][_0xb043('0x3a')]){_0x2880e4[_0xb043('0x35')]=_[_0xb043('0x39')](_0x2880e4[_0xb043('0x35')],{'$or':_[_0xb043('0x3b')](_0x2880e4[_0xb043('0x2c')],function(_0x413d6a){var _0x1ad9f3={};_0x1ad9f3[_0x413d6a]={'$like':'%'+_0x5d95b8[_0xb043('0x28')][_0xb043('0x3a')]+'%'};return _0x1ad9f3;})});}_0x2880e4=_[_0xb043('0x39')]({},_0x2880e4,_0x5d95b8[_0xb043('0x3c')]);var _0x44ecf0={'where':_0x2880e4[_0xb043('0x35')]};return db[_0xb043('0x24')][_0xb043('0x17')](_0x44ecf0)[_0xb043('0x1e')](function(_0x45f1ee){_0x45ae4d['count']=_0x45f1ee;if(_0x5d95b8[_0xb043('0x28')]['includeAll']){_0x2880e4[_0xb043('0x3d')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xb043('0x3e')](_0x2880e4);})['then'](function(_0x42f2e5){_0x45ae4d[_0xb043('0x3f')]=_0x42f2e5;return _0x45ae4d;})[_0xb043('0x1e')](respondWithFilteredResult(_0xe1dbb8,_0x2880e4))[_0xb043('0x40')](handleError(_0xe1dbb8,null));};exports[_0xb043('0x41')]=function(_0x520f31,_0x56df79){var _0x56db5f={'raw':!![],'where':{'id':_0x520f31[_0xb043('0x42')]['id']}},_0x117043={};_0x117043['model']=_[_0xb043('0x27')](db['JscriptySessionReport'][_0xb043('0x25')]);_0x117043[_0xb043('0x28')]=_[_0xb043('0x27')](_0x520f31[_0xb043('0x28')]);_0x117043[_0xb043('0x2b')]=_[_0xb043('0x2d')](_0x117043[_0xb043('0x26')],_0x117043['query']);_0x56db5f[_0xb043('0x2c')]=_[_0xb043('0x2d')](_0x117043['model'],qs[_0xb043('0x2e')](_0x520f31[_0xb043('0x28')][_0xb043('0x2e')]));_0x56db5f[_0xb043('0x2c')]=_0x56db5f[_0xb043('0x2c')][_0xb043('0x2f')]?_0x56db5f[_0xb043('0x2c')]:_0x117043[_0xb043('0x26')];if(_0x520f31[_0xb043('0x28')][_0xb043('0x43')]){_0x56db5f[_0xb043('0x3d')]=[{'all':!![]}];}_0x56db5f=_[_0xb043('0x39')]({},_0x56db5f,_0x520f31[_0xb043('0x3c')]);return db['JscriptySessionReport'][_0xb043('0x44')](_0x56db5f)['then'](handleEntityNotFound(_0x56df79,null))[_0xb043('0x1e')](respondWithResult(_0x56df79,null))[_0xb043('0x40')](handleError(_0x56df79,null));};exports['create']=function(_0x574702,_0x2a2866){return db[_0xb043('0x24')][_0xb043('0x45')](_0x574702[_0xb043('0x46')],{})[_0xb043('0x1e')](respondWithResult(_0x2a2866,0xc9))[_0xb043('0x40')](handleError(_0x2a2866,null));};exports[_0xb043('0x1d')]=function(_0x5c77d2,_0x3cef82){if(_0x5c77d2['body']['id']){delete _0x5c77d2[_0xb043('0x46')]['id'];}return db[_0xb043('0x24')][_0xb043('0x44')]({'where':{'id':_0x5c77d2['params']['id']}})[_0xb043('0x1e')](handleEntityNotFound(_0x3cef82,null))[_0xb043('0x1e')](saveUpdates(_0x5c77d2[_0xb043('0x46')],null))[_0xb043('0x1e')](respondWithResult(_0x3cef82,null))['catch'](handleError(_0x3cef82,null));};exports[_0xb043('0x1f')]=function(_0x74ff09,_0x559dd8){return db[_0xb043('0x24')][_0xb043('0x44')]({'where':{'id':_0x74ff09[_0xb043('0x42')]['id']}})[_0xb043('0x1e')](handleEntityNotFound(_0x559dd8,null))[_0xb043('0x1e')](removeEntity(_0x559dd8,null))[_0xb043('0x40')](handleError(_0x559dd8,null));};exports[_0xb043('0x47')]=function(_0x5bfc9f,_0x15b23d){return db[_0xb043('0x24')][_0xb043('0x47')]()['then'](respondWithResult(_0x15b23d,null))['catch'](handleError(_0x15b23d,null));};exports[_0xb043('0x48')]=function(_0x580c94,_0xc71034,_0x3fbf83){var _0x95c6c2={'raw':!![],'where':{}};var _0x186e37={};var _0x304acc={'count':0x0,'rows':[]};return db[_0xb043('0x24')]['findOne']({'where':{'id':_0x580c94['params']['id']}})[_0xb043('0x1e')](handleEntityNotFound(_0xc71034,null))[_0xb043('0x1e')](function(_0x4baa7e){if(_0x4baa7e){_0x186e37[_0xb043('0x26')]=_[_0xb043('0x27')](db[_0xb043('0x49')][_0xb043('0x25')]);_0x186e37[_0xb043('0x28')]=_[_0xb043('0x27')](_0x580c94[_0xb043('0x28')]);_0x186e37[_0xb043('0x2b')]=_[_0xb043('0x2d')](_0x186e37[_0xb043('0x26')],_0x186e37['query']);_0x95c6c2['attributes']=_['intersection'](_0x186e37[_0xb043('0x26')],qs[_0xb043('0x2e')](_0x580c94[_0xb043('0x28')][_0xb043('0x2e')]));_0x95c6c2[_0xb043('0x2c')]=_0x95c6c2[_0xb043('0x2c')][_0xb043('0x2f')]?_0x95c6c2[_0xb043('0x2c')]:_0x186e37['model'];if(!_0x580c94[_0xb043('0x28')]['hasOwnProperty'](_0xb043('0x31'))){_0x95c6c2['limit']=qs['limit'](_0x580c94[_0xb043('0x28')][_0xb043('0x32')]);_0x95c6c2[_0xb043('0x18')]=qs[_0xb043('0x18')](_0x580c94[_0xb043('0x28')][_0xb043('0x18')]);}_0x95c6c2['order']=qs['sort'](_0x580c94[_0xb043('0x28')]['sort']);_0x95c6c2[_0xb043('0x35')]=qs[_0xb043('0x2b')](_[_0xb043('0x36')](_0x580c94[_0xb043('0x28')],_0x186e37[_0xb043('0x2b')]));_0x95c6c2[_0xb043('0x35')][_0xb043('0x4a')]=_0x4baa7e['id'];if(_0x580c94[_0xb043('0x28')][_0xb043('0x3a')]){_0x95c6c2[_0xb043('0x35')]=_[_0xb043('0x39')](_0x95c6c2[_0xb043('0x35')],{'$or':_['map'](_0x95c6c2['attributes'],function(_0x27b32d){var _0x24cee4={};_0x24cee4[_0x27b32d]={'$like':'%'+_0x580c94[_0xb043('0x28')][_0xb043('0x3a')]+'%'};return _0x24cee4;})});}_0x95c6c2=_['merge']({},_0x95c6c2,_0x580c94['options']);return db[_0xb043('0x49')]['count']({'where':_0x95c6c2[_0xb043('0x35')]})[_0xb043('0x1e')](function(_0x41188b){_0x304acc[_0xb043('0x17')]=_0x41188b;if(_0x580c94['query']['includeAll']){_0x95c6c2['include']=[{'all':!![]}];}return db[_0xb043('0x49')][_0xb043('0x3e')](_0x95c6c2);})['then'](function(_0x5e74f4){_0x304acc[_0xb043('0x3f')]=_0x5e74f4;return _0x304acc;});}})[_0xb043('0x1e')](respondWithFilteredResult(_0xc71034,_0x95c6c2))[_0xb043('0x40')](handleError(_0xc71034,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index cbfc69c..771cc2a 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 _0x1190=['define','../../config/logger','api','moment','request-promise','./jscriptySessionReport.attributes'];(function(_0x52e31a,_0x2da71a){var _0x20997d=function(_0xaa1fc7){while(--_0xaa1fc7){_0x52e31a['push'](_0x52e31a['shift']());}};_0x20997d(++_0x2da71a);}(_0x1190,0x145));var _0x0119=function(_0xcd9a96,_0x34bb7d){_0xcd9a96=_0xcd9a96-0x0;var _0x28002c=_0x1190[_0xcd9a96];return _0x28002c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0119('0x0'))(_0x0119('0x1'));var moment=require(_0x0119('0x2'));var BPromise=require('bluebird');var rp=require(_0x0119('0x3'));var attributes=require(_0x0119('0x4'));module['exports']=function(_0x50cbd5,_0xd49350){return _0x50cbd5[_0x0119('0x5')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b8a=['define','JscriptySessionReport','report_jscripty_sessions','util','moment','bluebird','./jscriptySessionReport.attributes'];(function(_0x42b8bc,_0x400e30){var _0x107922=function(_0x21525b){while(--_0x21525b){_0x42b8bc['push'](_0x42b8bc['shift']());}};_0x107922(++_0x400e30);}(_0x3b8a,0x1f4));var _0xa3b8=function(_0x179808,_0x1f8ac4){_0x179808=_0x179808-0x0;var _0xe34d57=_0x3b8a[_0x179808];return _0xe34d57;};'use strict';var _=require('lodash');var util=require(_0xa3b8('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa3b8('0x1'));var BPromise=require(_0xa3b8('0x2'));var rp=require('request-promise');var attributes=require(_0xa3b8('0x3'));module['exports']=function(_0x53afec,_0x5290ef){return _0x53afec[_0xa3b8('0x4')](_0xa3b8('0x5'),attributes,{'tableName':_0xa3b8('0x6'),'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 0af1eea..d7fdbd1 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 _0x0301=['then','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x40f4f6,_0x3d2d78){var _0xb3c081=function(_0x163fef){while(--_0x163fef){_0x40f4f6['push'](_0x40f4f6['shift']());}};_0xb3c081(++_0x3d2d78);}(_0x0301,0x120));var _0x1030=function(_0x3f7e37,_0x32f790){_0x3f7e37=_0x3f7e37-0x0;var _0x2a3ec7=_0x0301[_0x3f7e37];return _0x2a3ec7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1030('0x0'));var BPromise=require(_0x1030('0x1'));var rs=require(_0x1030('0x2'));var fs=require('fs');var db=require(_0x1030('0x3'))['db'];var utils=require(_0x1030('0x4'));var logger=require(_0x1030('0x5'))('rpc');var config=require(_0x1030('0x6'));var jayson=require(_0x1030('0x7'));var client=jayson[_0x1030('0x8')][_0x1030('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d3c04,_0x1e56bf,_0x2d2bfd){return new BPromise(function(_0x42d420,_0x380252){return client[_0x1030('0xa')](_0x3d3c04,_0x2d2bfd)[_0x1030('0xb')](function(_0x4f51f9){logger[_0x1030('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x1e56bf,_0x1030('0xd'));logger[_0x1030('0xe')](_0x1030('0xf'),_0x1e56bf,_0x1030('0xd'),JSON[_0x1030('0x10')](_0x4f51f9));if(_0x4f51f9[_0x1030('0x11')]){if(_0x4f51f9['error'][_0x1030('0x12')]===0x1f4){logger[_0x1030('0x11')](_0x1030('0x13'),_0x1e56bf,_0x4f51f9['error'][_0x1030('0x14')]);return _0x380252(_0x4f51f9[_0x1030('0x11')][_0x1030('0x14')]);}logger[_0x1030('0x11')](_0x1030('0x13'),_0x1e56bf,_0x4f51f9[_0x1030('0x11')]['message']);return _0x42d420(_0x4f51f9['error'][_0x1030('0x14')]);}else{logger['info'](_0x1030('0x13'),_0x1e56bf,_0x1030('0xd'));_0x42d420(_0x4f51f9[_0x1030('0x15')][_0x1030('0x14')]);}})[_0x1030('0x16')](function(_0x2e44b4){logger[_0x1030('0x11')](_0x1030('0x13'),_0x1e56bf,_0x2e44b4);_0x380252(_0x2e44b4);});});} \ No newline at end of file +var _0x0dca=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','error','code','message','JscriptySessionReport,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x324f7d,_0x3a0184){var _0x158d1e=function(_0x460f99){while(--_0x460f99){_0x324f7d['push'](_0x324f7d['shift']());}};_0x158d1e(++_0x3a0184);}(_0x0dca,0xeb));var _0xa0dc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0dca[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa0dc('0x0'));var util=require(_0xa0dc('0x1'));var moment=require('moment');var BPromise=require(_0xa0dc('0x2'));var rs=require(_0xa0dc('0x3'));var fs=require('fs');var db=require(_0xa0dc('0x4'))['db'];var utils=require(_0xa0dc('0x5'));var logger=require('../../config/logger')(_0xa0dc('0x6'));var config=require(_0xa0dc('0x7'));var jayson=require(_0xa0dc('0x8'));var client=jayson[_0xa0dc('0x9')][_0xa0dc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6ef32f,_0x2baa2c,_0x4aba44){return new BPromise(function(_0x9dcd38,_0x5694f1){return client['request'](_0x6ef32f,_0x4aba44)[_0xa0dc('0xb')](function(_0x2dcbec){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x2baa2c,_0xa0dc('0xc'));logger[_0xa0dc('0xd')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x2baa2c,_0xa0dc('0xc'),JSON['stringify'](_0x2dcbec));if(_0x2dcbec[_0xa0dc('0xe')]){if(_0x2dcbec['error'][_0xa0dc('0xf')]===0x1f4){logger[_0xa0dc('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x2baa2c,_0x2dcbec['error'][_0xa0dc('0x10')]);return _0x5694f1(_0x2dcbec[_0xa0dc('0xe')]['message']);}logger[_0xa0dc('0xe')](_0xa0dc('0x11'),_0x2baa2c,_0x2dcbec['error'][_0xa0dc('0x10')]);return _0x9dcd38(_0x2dcbec[_0xa0dc('0xe')][_0xa0dc('0x10')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x2baa2c,'request\x20sent');_0x9dcd38(_0x2dcbec[_0xa0dc('0x12')][_0xa0dc('0x10')]);}})[_0xa0dc('0x13')](function(_0x5428a9){logger['error'](_0xa0dc('0x11'),_0x2baa2c,_0x5428a9);_0x5694f1(_0x5428a9);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 6baf4d2..4381efd 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 _0x3887=['multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','put','update','exports'];(function(_0x32ccdb,_0x398aa7){var _0x546444=function(_0x593adc){while(--_0x593adc){_0x32ccdb['push'](_0x32ccdb['shift']());}};_0x546444(++_0x398aa7);}(_0x3887,0x82));var _0x7388=function(_0x52adce,_0x5fe2fe){_0x52adce=_0x52adce-0x0;var _0x1d9490=_0x3887[_0x52adce];return _0x1d9490;};'use strict';var multer=require(_0x7388('0x0'));var util=require(_0x7388('0x1'));var path=require('path');var express=require('express');var router=express['Router']();var auth=require(_0x7388('0x2'));var interaction=require(_0x7388('0x3'));var config=require(_0x7388('0x4'));var controller=require(_0x7388('0x5'));router[_0x7388('0x6')]('/',controller['index']);router[_0x7388('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7388('0x8')]);module[_0x7388('0x9')]=router; \ No newline at end of file +var _0x4aec=['put','/:id','update','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4aec,0x1a5));var _0xc4ae=function(_0x3a5297,_0x2545a2){_0x3a5297=_0x3a5297-0x0;var _0x4d4334=_0x4aec[_0x3a5297];return _0x4d4334;};'use strict';var multer=require(_0xc4ae('0x0'));var util=require(_0xc4ae('0x1'));var path=require(_0xc4ae('0x2'));var express=require(_0xc4ae('0x3'));var router=express[_0xc4ae('0x4')]();var auth=require(_0xc4ae('0x5'));var interaction=require(_0xc4ae('0x6'));var config=require('../../config/environment');var controller=require('./license.controller');router[_0xc4ae('0x7')]('/',controller['index']);router[_0xc4ae('0x8')](_0xc4ae('0x9'),auth['isAuthenticated'](),controller[_0xc4ae('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index b6b79ba..016c79a 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 _0x6320=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x103080,_0x40ac65){var _0x2d05a0=function(_0x3f844d){while(--_0x3f844d){_0x103080['push'](_0x103080['shift']());}};_0x2d05a0(++_0x40ac65);}(_0x6320,0xa8));var _0x0632=function(_0x7dbb9d,_0x262278){_0x7dbb9d=_0x7dbb9d-0x0;var _0x1adf16=_0x6320[_0x7dbb9d];return _0x1adf16;};'use strict';var Sequelize=require(_0x0632('0x0'));module[_0x0632('0x1')]={'license':{'type':Sequelize[_0x0632('0x2')]},'data1':{'type':Sequelize[_0x0632('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x0632('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x77a7=['sequelize','exports','STRING'];(function(_0x4084eb,_0x30c6ad){var _0x4c1f1c=function(_0x1ca12e){while(--_0x1ca12e){_0x4084eb['push'](_0x4084eb['shift']());}};_0x4c1f1c(++_0x30c6ad);}(_0x77a7,0xde));var _0x777a=function(_0x3181d1,_0x34dc36){_0x3181d1=_0x3181d1-0x0;var _0x21b34f=_0x77a7[_0x3181d1];return _0x21b34f;};'use strict';var Sequelize=require(_0x777a('0x0'));module[_0x777a('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x777a('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'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 126ab5a..a826c44 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 _0xd897=['end','count','offset','limit','status','set','Content-Range','json','apply','save','update','then','error','stack','name','../../config/license/util','model','keys','License','query','filters','intersection','fields','attributes','length','merge','options','getLicense','catch','body','params','get','checkLicense','key','demo','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../config/logger','../../config/utils','../../mysqldb','sendStatus'];(function(_0x37ce3e,_0xebe77f){var _0x1309d9=function(_0x14cdeb){while(--_0x14cdeb){_0x37ce3e['push'](_0x37ce3e['shift']());}};_0x1309d9(++_0xebe77f);}(_0xd897,0x127));var _0x7d89=function(_0x13a7f0,_0x458815){_0x13a7f0=_0x13a7f0-0x0;var _0x3b897d=_0xd897[_0x13a7f0];return _0x3b897d;};'use strict';var jsonpatch=require(_0x7d89('0x0'));var rp=require(_0x7d89('0x1'));var moment=require('moment');var BPromise=require(_0x7d89('0x2'));var Mustache=require('mustache');var util=require(_0x7d89('0x3'));var path=require(_0x7d89('0x4'));var sox=require('sox');var csv=require(_0x7d89('0x5'));var ejs=require(_0x7d89('0x6'));var fs=require('fs');var _=require(_0x7d89('0x7'));var squel=require(_0x7d89('0x8'));var crypto=require(_0x7d89('0x9'));var jsforce=require(_0x7d89('0xa'));var deskjs=require(_0x7d89('0xb'));var toCsv=require(_0x7d89('0x5'));var querystring=require(_0x7d89('0xc'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0x7d89('0xd'))('api');var utils=require(_0x7d89('0xe'));var config=require('../../config/environment');var db=require(_0x7d89('0xf'))['db'];function respondWithStatusCode(_0x3fa0a4,_0x44d869){_0x44d869=_0x44d869||0xcc;return function(_0x22f9e3){if(_0x22f9e3){return _0x3fa0a4[_0x7d89('0x10')](_0x44d869);}return _0x3fa0a4['status'](_0x44d869)[_0x7d89('0x11')]();};}function respondWithResult(_0x237a25,_0x333e8d){_0x333e8d=_0x333e8d||0xc8;return function(_0x3e58a3){if(_0x3e58a3){return _0x237a25['status'](_0x333e8d)['json'](_0x3e58a3);}};}function respondWithFilteredResult(_0x1a2f2b,_0x5bda9b){return function(_0x355475){if(_0x355475){var _0x7b7565=_0x355475[_0x7d89('0x12')],_0x296855=_0x5bda9b[_0x7d89('0x13')],_0x4113bb=_0x5bda9b[_0x7d89('0x13')]+_0x5bda9b[_0x7d89('0x14')],_0x5e53e9;if(_0x4113bb>=_0x7b7565){_0x4113bb=_0x7b7565;_0x5e53e9=0xc8;}else{_0x5e53e9=0xce;}_0x1a2f2b[_0x7d89('0x15')](_0x5e53e9);return _0x1a2f2b[_0x7d89('0x16')](_0x7d89('0x17'),_0x296855+'-'+_0x4113bb+'/'+_0x7b7565)[_0x7d89('0x18')](_0x355475);}return null;};}function patchUpdates(_0x485f7f){return function(_0x2842d9){try{jsonpatch[_0x7d89('0x19')](_0x2842d9,_0x485f7f,!![]);}catch(_0x4a90e7){return BPromise['reject'](_0x4a90e7);}return _0x2842d9[_0x7d89('0x1a')]();};}function saveUpdates(_0xc16703,_0x1bad44){return function(_0x4ee445){if(_0x4ee445){return _0x4ee445[_0x7d89('0x1b')](_0xc16703)[_0x7d89('0x1c')](function(_0x47d7fa){return _0x47d7fa;});}return null;};}function removeEntity(_0x7eea41,_0x58a0aa){return function(_0x302107){if(_0x302107){return _0x302107['destroy']()['then'](function(){_0x7eea41['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x166cc1,_0x555046){return function(_0x4c882e){if(!_0x4c882e){_0x166cc1[_0x7d89('0x10')](0x194);}return _0x4c882e;};}function handleError(_0x3bf663,_0xddec94){_0xddec94=_0xddec94||0x1f4;return function(_0x3696af){logger[_0x7d89('0x1d')](_0x3696af[_0x7d89('0x1e')]);if(_0x3696af[_0x7d89('0x1f')]){delete _0x3696af[_0x7d89('0x1f')];}_0x3bf663['status'](_0xddec94)['send'](_0x3696af);};}var utilLicense=require(_0x7d89('0x20'));exports['index']=function(_0x563672,_0x4e3dc6){var _0x45d573={'raw':!![],'where':{'id':0x1}},_0x517981={};_0x517981[_0x7d89('0x21')]=_[_0x7d89('0x22')](db[_0x7d89('0x23')]['rawAttributes']);_0x517981[_0x7d89('0x24')]=_['keys'](_0x563672[_0x7d89('0x24')]);_0x517981[_0x7d89('0x25')]=_[_0x7d89('0x26')](_0x517981['model'],_0x517981[_0x7d89('0x24')]);_0x45d573['attributes']=_[_0x7d89('0x26')](_0x517981[_0x7d89('0x21')],qs[_0x7d89('0x27')](_0x563672['query']['fields']));_0x45d573[_0x7d89('0x28')]=_0x45d573[_0x7d89('0x28')][_0x7d89('0x29')]?_0x45d573[_0x7d89('0x28')]:_0x517981['model'];_0x45d573=_[_0x7d89('0x2a')]({},_0x45d573,_0x563672[_0x7d89('0x2b')]);return utilLicense[_0x7d89('0x2c')](_0x45d573)['then'](respondWithResult(_0x4e3dc6,null))[_0x7d89('0x2d')](handleError(_0x4e3dc6,null));};exports[_0x7d89('0x1b')]=function(_0x3dff08,_0x2500c6){if(_0x3dff08['body']['id']){delete _0x3dff08[_0x7d89('0x2e')]['id'];}return db[_0x7d89('0x23')]['find']({'where':{'id':_0x3dff08[_0x7d89('0x2f')]['id']}})[_0x7d89('0x1c')](handleEntityNotFound(_0x2500c6,null))[_0x7d89('0x1c')](function(_0x33d409){var _0x27eb28=_0x33d409[_0x7d89('0x30')]({'plain':!![]});return utilLicense[_0x7d89('0x31')](_0x27eb28,_0x3dff08['body'][_0x7d89('0x32')]);})[_0x7d89('0x1c')](function(_0x990c){if(!_0x990c[_0x7d89('0x33')]){return saveUpdates(_0x3dff08['body'],null);}return _0x990c;})[_0x7d89('0x1c')](respondWithResult(_0x2500c6,null))[_0x7d89('0x2d')](handleError(_0x2500c6,null));}; \ No newline at end of file +var _0x88cb=['sox','to-csv','ejs','squel','jsforce','querystring','../../components/parsers/qs','../../config/logger','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','index','model','License','rawAttributes','query','filters','attributes','intersection','length','options','getLicense','catch','body','find','params','get','checkLicense','demo','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x69436b,_0x5e0cf1){var _0x42d5f8=function(_0x5208be){while(--_0x5208be){_0x69436b['push'](_0x69436b['shift']());}};_0x42d5f8(++_0x5e0cf1);}(_0x88cb,0x1bc));var _0xb88c=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x88cb[_0x432682];return _0x463d05;};'use strict';var jsonpatch=require(_0xb88c('0x0'));var rp=require(_0xb88c('0x1'));var moment=require(_0xb88c('0x2'));var BPromise=require(_0xb88c('0x3'));var Mustache=require(_0xb88c('0x4'));var util=require('util');var path=require(_0xb88c('0x5'));var sox=require(_0xb88c('0x6'));var csv=require(_0xb88c('0x7'));var ejs=require(_0xb88c('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb88c('0x9'));var crypto=require('crypto');var jsforce=require(_0xb88c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xb88c('0x7'));var querystring=require(_0xb88c('0xb'));var Papa=require('papaparse');var qs=require(_0xb88c('0xc'));var logger=require(_0xb88c('0xd'))('api');var utils=require(_0xb88c('0xe'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x479524,_0x271261){_0x271261=_0x271261||0xcc;return function(_0x5c54cc){if(_0x5c54cc){return _0x479524[_0xb88c('0xf')](_0x271261);}return _0x479524[_0xb88c('0x10')](_0x271261)[_0xb88c('0x11')]();};}function respondWithResult(_0x12670b,_0x4130e2){_0x4130e2=_0x4130e2||0xc8;return function(_0x2ed2e8){if(_0x2ed2e8){return _0x12670b[_0xb88c('0x10')](_0x4130e2)[_0xb88c('0x12')](_0x2ed2e8);}};}function respondWithFilteredResult(_0x54f24f,_0x5dda62){return function(_0x3ed42d){if(_0x3ed42d){var _0x5e7d42=_0x3ed42d[_0xb88c('0x13')],_0x372903=_0x5dda62[_0xb88c('0x14')],_0x23eb33=_0x5dda62[_0xb88c('0x14')]+_0x5dda62[_0xb88c('0x15')],_0x27c80e;if(_0x23eb33>=_0x5e7d42){_0x23eb33=_0x5e7d42;_0x27c80e=0xc8;}else{_0x27c80e=0xce;}_0x54f24f['status'](_0x27c80e);return _0x54f24f[_0xb88c('0x16')](_0xb88c('0x17'),_0x372903+'-'+_0x23eb33+'/'+_0x5e7d42)[_0xb88c('0x12')](_0x3ed42d);}return null;};}function patchUpdates(_0x626501){return function(_0x16966b){try{jsonpatch[_0xb88c('0x18')](_0x16966b,_0x626501,!![]);}catch(_0x386e80){return BPromise['reject'](_0x386e80);}return _0x16966b[_0xb88c('0x19')]();};}function saveUpdates(_0x234132,_0x5d88bf){return function(_0x42fcc3){if(_0x42fcc3){return _0x42fcc3[_0xb88c('0x1a')](_0x234132)['then'](function(_0x184339){return _0x184339;});}return null;};}function removeEntity(_0x202018,_0x3d4137){return function(_0x4bf6e8){if(_0x4bf6e8){return _0x4bf6e8['destroy']()[_0xb88c('0x1b')](function(){_0x202018[_0xb88c('0x10')](0xcc)[_0xb88c('0x11')]();});}};}function handleEntityNotFound(_0x40987f,_0x59bc77){return function(_0x5e3379){if(!_0x5e3379){_0x40987f[_0xb88c('0xf')](0x194);}return _0x5e3379;};}function handleError(_0x2b53d4,_0x5bc229){_0x5bc229=_0x5bc229||0x1f4;return function(_0x204762){logger[_0xb88c('0x1c')](_0x204762[_0xb88c('0x1d')]);if(_0x204762[_0xb88c('0x1e')]){delete _0x204762[_0xb88c('0x1e')];}_0x2b53d4[_0xb88c('0x10')](_0x5bc229)[_0xb88c('0x1f')](_0x204762);};}var utilLicense=require('../../config/license/util');exports[_0xb88c('0x20')]=function(_0x3e91a4,_0x59f8bc){var _0x2e21fd={'raw':!![],'where':{'id':0x1}},_0x280839={};_0x280839[_0xb88c('0x21')]=_['keys'](db[_0xb88c('0x22')][_0xb88c('0x23')]);_0x280839[_0xb88c('0x24')]=_['keys'](_0x3e91a4[_0xb88c('0x24')]);_0x280839[_0xb88c('0x25')]=_['intersection'](_0x280839['model'],_0x280839[_0xb88c('0x24')]);_0x2e21fd[_0xb88c('0x26')]=_[_0xb88c('0x27')](_0x280839[_0xb88c('0x21')],qs['fields'](_0x3e91a4[_0xb88c('0x24')]['fields']));_0x2e21fd[_0xb88c('0x26')]=_0x2e21fd[_0xb88c('0x26')][_0xb88c('0x28')]?_0x2e21fd['attributes']:_0x280839[_0xb88c('0x21')];_0x2e21fd=_['merge']({},_0x2e21fd,_0x3e91a4[_0xb88c('0x29')]);return utilLicense[_0xb88c('0x2a')](_0x2e21fd)['then'](respondWithResult(_0x59f8bc,null))[_0xb88c('0x2b')](handleError(_0x59f8bc,null));};exports['update']=function(_0xb66e82,_0xb173dd){if(_0xb66e82[_0xb88c('0x2c')]['id']){delete _0xb66e82[_0xb88c('0x2c')]['id'];}return db[_0xb88c('0x22')][_0xb88c('0x2d')]({'where':{'id':_0xb66e82[_0xb88c('0x2e')]['id']}})['then'](handleEntityNotFound(_0xb173dd,null))[_0xb88c('0x1b')](function(_0x2f12f9){var _0x565205=_0x2f12f9[_0xb88c('0x2f')]({'plain':!![]});return utilLicense[_0xb88c('0x30')](_0x565205,_0xb66e82['body']['key']);})['then'](function(_0x69a7cc){if(!_0x69a7cc[_0xb88c('0x31')]){return saveUpdates(_0xb66e82['body'],null);}return _0x69a7cc;})[_0xb88c('0x1b')](respondWithResult(_0xb173dd,null))['catch'](handleError(_0xb173dd,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 23057ac..de18b12 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 _0xd58c=['../../config/logger','moment','request-promise','exports','define','License','lodash','util'];(function(_0x4c2294,_0x984c5){var _0x4f9a06=function(_0x4e392c){while(--_0x4e392c){_0x4c2294['push'](_0x4c2294['shift']());}};_0x4f9a06(++_0x984c5);}(_0xd58c,0xb6));var _0xcd58=function(_0x368c56,_0x1b7db9){_0x368c56=_0x368c56-0x0;var _0x4de7cc=_0xd58c[_0x368c56];return _0x4de7cc;};'use strict';var _=require(_0xcd58('0x0'));var util=require(_0xcd58('0x1'));var logger=require(_0xcd58('0x2'))('api');var moment=require(_0xcd58('0x3'));var BPromise=require('bluebird');var rp=require(_0xcd58('0x4'));var attributes=require('./license.attributes');module[_0xcd58('0x5')]=function(_0x2a22bd,_0x2f4382){return _0x2a22bd[_0xcd58('0x6')](_0xcd58('0x7'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['moment','./license.attributes','define','License','license','lodash','../../config/logger','api'];(function(_0x57d371,_0x1cb5b8){var _0x4c7594=function(_0xe1d23c){while(--_0xe1d23c){_0x57d371['push'](_0x57d371['shift']());}};_0x4c7594(++_0x1cb5b8);}(_0x3e74,0x175));var _0x43e7=function(_0xe96586,_0x530c27){_0xe96586=_0xe96586-0x0;var _0x59c936=_0x3e74[_0xe96586];return _0x59c936;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x43e7('0x4'));module['exports']=function(_0x128b0f,_0xe838b4){return _0x128b0f[_0x43e7('0x5')](_0x43e7('0x6'),attributes,{'tableName':_0x43e7('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 5c52d9a..c7de9b2 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 _0xbcfe=['client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x263f9d,_0x3d854e){var _0x4c4efa=function(_0x48d506){while(--_0x48d506){_0x263f9d['push'](_0x263f9d['shift']());}};_0x4c4efa(++_0x3d854e);}(_0xbcfe,0x1f0));var _0xebcf=function(_0x557761,_0x5d3f43){_0x557761=_0x557761-0x0;var _0x1e88de=_0xbcfe[_0x557761];return _0x1e88de;};'use strict';var _=require(_0xebcf('0x0'));var util=require(_0xebcf('0x1'));var moment=require('moment');var BPromise=require(_0xebcf('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xebcf('0x3'))['db'];var utils=require(_0xebcf('0x4'));var logger=require(_0xebcf('0x5'))(_0xebcf('0x6'));var config=require('../../config/environment');var jayson=require(_0xebcf('0x7'));var client=jayson[_0xebcf('0x8')][_0xebcf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x78e13e,_0x3d93a2,_0x55ee77){return new BPromise(function(_0x126948,_0x5e3bac){return client[_0xebcf('0xa')](_0x78e13e,_0x55ee77)[_0xebcf('0xb')](function(_0x31f251){logger[_0xebcf('0xc')](_0xebcf('0xd'),_0x3d93a2,_0xebcf('0xe'));logger[_0xebcf('0xf')](_0xebcf('0x10'),_0x3d93a2,_0xebcf('0xe'),JSON[_0xebcf('0x11')](_0x31f251));if(_0x31f251[_0xebcf('0x12')]){if(_0x31f251[_0xebcf('0x12')][_0xebcf('0x13')]===0x1f4){logger[_0xebcf('0x12')](_0xebcf('0xd'),_0x3d93a2,_0x31f251[_0xebcf('0x12')]['message']);return _0x5e3bac(_0x31f251[_0xebcf('0x12')][_0xebcf('0x14')]);}logger[_0xebcf('0x12')](_0xebcf('0xd'),_0x3d93a2,_0x31f251[_0xebcf('0x12')][_0xebcf('0x14')]);return _0x126948(_0x31f251[_0xebcf('0x12')][_0xebcf('0x14')]);}else{logger[_0xebcf('0xc')](_0xebcf('0xd'),_0x3d93a2,_0xebcf('0xe'));_0x126948(_0x31f251['result'][_0xebcf('0x14')]);}})['catch'](function(_0x29ae25){logger['error'](_0xebcf('0xd'),_0x3d93a2,_0x29ae25);_0x5e3bac(_0x29ae25);});});} \ No newline at end of file +var _0xde67=['randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','stringify','error','License,\x20%s,\x20%s','message','info','result','util'];(function(_0x151935,_0x58df29){var _0x3c8f56=function(_0x31e2f6){while(--_0x31e2f6){_0x151935['push'](_0x151935['shift']());}};_0x3c8f56(++_0x58df29);}(_0xde67,0x10f));var _0x7de6=function(_0x18ea99,_0x5d0dc6){_0x18ea99=_0x18ea99-0x0;var _0x4e1a63=_0xde67[_0x18ea99];return _0x4e1a63;};'use strict';var _=require('lodash');var util=require(_0x7de6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7de6('0x1'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x7de6('0x2'));var logger=require(_0x7de6('0x3'))(_0x7de6('0x4'));var config=require('../../config/environment');var jayson=require(_0x7de6('0x5'));var client=jayson['client'][_0x7de6('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4572b5,_0x577871,_0x3deb12){return new BPromise(function(_0x18e4a1,_0x47123f){return client[_0x7de6('0x7')](_0x4572b5,_0x3deb12)[_0x7de6('0x8')](function(_0x78b849){logger['info']('License,\x20%s,\x20%s',_0x577871,_0x7de6('0x9'));logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x577871,_0x7de6('0x9'),JSON[_0x7de6('0xa')](_0x78b849));if(_0x78b849[_0x7de6('0xb')]){if(_0x78b849['error']['code']===0x1f4){logger[_0x7de6('0xb')](_0x7de6('0xc'),_0x577871,_0x78b849[_0x7de6('0xb')][_0x7de6('0xd')]);return _0x47123f(_0x78b849[_0x7de6('0xb')]['message']);}logger[_0x7de6('0xb')](_0x7de6('0xc'),_0x577871,_0x78b849[_0x7de6('0xb')][_0x7de6('0xd')]);return _0x18e4a1(_0x78b849[_0x7de6('0xb')][_0x7de6('0xd')]);}else{logger[_0x7de6('0xe')](_0x7de6('0xc'),_0x577871,_0x7de6('0x9'));_0x18e4a1(_0x78b849[_0x7de6('0xf')][_0x7de6('0xd')]);}})['catch'](function(_0xdeb3b3){logger['error'](_0x7de6('0xc'),_0x577871,_0xdeb3b3);_0x47123f(_0xdeb3b3);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 3efb75c..f1bd01b 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 _0xa478=['/describe','describe','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','/:id/users','post','addDisposition','addAnswer','create','addImap','/:id/out_servers','addSmtp','addApplications','send','addAgents','put','delete','removeDispositions','removeAnswers','removeImap','/:id','destroy','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa478,0x136));var _0x8a47=function(_0xd60031,_0x5efb93){_0xd60031=_0xd60031-0x0;var _0x43d00a=_0xa478[_0xd60031];return _0x43d00a;};'use strict';var multer=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var path=require(_0x8a47('0x2'));var express=require(_0x8a47('0x3'));var router=express[_0x8a47('0x4')]();var auth=require(_0x8a47('0x5'));var interaction=require(_0x8a47('0x6'));var config=require(_0x8a47('0x7'));var controller=require(_0x8a47('0x8'));router[_0x8a47('0x9')]('/',auth[_0x8a47('0xa')](),controller[_0x8a47('0xb')]);router['get'](_0x8a47('0xc'),auth[_0x8a47('0xa')](),controller[_0x8a47('0xd')]);router[_0x8a47('0x9')]('/:id',auth[_0x8a47('0xa')](),controller['show']);router[_0x8a47('0x9')](_0x8a47('0xe'),auth[_0x8a47('0xa')](),controller['getDispositions']);router[_0x8a47('0x9')](_0x8a47('0xf'),auth['isAuthenticated'](),controller[_0x8a47('0x10')]);router['get'](_0x8a47('0x11'),auth[_0x8a47('0xa')](),controller[_0x8a47('0x12')]);router['get']('/:id/out_servers',auth['isAuthenticated'](),controller[_0x8a47('0x13')]);router[_0x8a47('0x9')]('/:id/interactions',auth[_0x8a47('0xa')](),controller[_0x8a47('0x14')]);router[_0x8a47('0x9')](_0x8a47('0x15'),auth[_0x8a47('0xa')](),controller[_0x8a47('0x16')]);router[_0x8a47('0x9')](_0x8a47('0x17'),auth[_0x8a47('0xa')](),controller[_0x8a47('0x18')]);router[_0x8a47('0x9')](_0x8a47('0x19'),auth[_0x8a47('0xa')](),controller['verifySmtp']);router[_0x8a47('0x9')](_0x8a47('0x1a'),auth[_0x8a47('0xa')](),controller['getAgents']);router[_0x8a47('0x1b')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x8a47('0x1c')]);router[_0x8a47('0x1b')](_0x8a47('0xf'),auth[_0x8a47('0xa')](),controller[_0x8a47('0x1d')]);router[_0x8a47('0x1b')]('/',auth[_0x8a47('0xa')](),controller[_0x8a47('0x1e')]);router[_0x8a47('0x1b')](_0x8a47('0x11'),auth['isAuthenticated'](),controller[_0x8a47('0x1f')]);router['post'](_0x8a47('0x20'),auth[_0x8a47('0xa')](),controller[_0x8a47('0x21')]);router[_0x8a47('0x1b')]('/:id/interactions',auth[_0x8a47('0xa')](),controller['addInteraction']);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x8a47('0x22')]);router[_0x8a47('0x1b')]('/:id/send',auth[_0x8a47('0xa')](),controller[_0x8a47('0x23')]);router[_0x8a47('0x1b')](_0x8a47('0x1a'),auth[_0x8a47('0xa')](),controller[_0x8a47('0x24')]);router[_0x8a47('0x25')]('/:id',auth[_0x8a47('0xa')](),controller['update']);router[_0x8a47('0x26')](_0x8a47('0xe'),auth['isAuthenticated'](),controller[_0x8a47('0x27')]);router['delete']('/:id/canned_answers',auth[_0x8a47('0xa')](),controller[_0x8a47('0x28')]);router[_0x8a47('0x26')](_0x8a47('0x11'),auth[_0x8a47('0xa')](),controller[_0x8a47('0x29')]);router['delete'](_0x8a47('0x20'),auth['isAuthenticated'](),controller['removeSmtp']);router[_0x8a47('0x26')](_0x8a47('0x2a'),auth[_0x8a47('0xa')](),controller[_0x8a47('0x2b')]);router[_0x8a47('0x26')](_0x8a47('0x1a'),auth[_0x8a47('0xa')](),controller[_0x8a47('0x2c')]);module[_0x8a47('0x2d')]=router; \ No newline at end of file +var _0xe85c=['send','addAgents','put','update','delete','removeImap','removeSmtp','destroy','removeAgents','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','isAuthenticated','index','get','/describe','/:id','show','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/verify','/:id/users','getAgents','post','/:id/dispositions','/:id/canned_answers','addAnswer','create','addSmtp','addInteraction','/:id/applications'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xe85c,0x117));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xce85('0x0'));var util=require(_0xce85('0x1'));var path=require(_0xce85('0x2'));var express=require(_0xce85('0x3'));var router=express[_0xce85('0x4')]();var auth=require(_0xce85('0x5'));var interaction=require(_0xce85('0x6'));var config=require('../../config/environment');var controller=require(_0xce85('0x7'));router['get']('/',auth[_0xce85('0x8')](),controller[_0xce85('0x9')]);router[_0xce85('0xa')](_0xce85('0xb'),auth[_0xce85('0x8')](),controller['describe']);router[_0xce85('0xa')](_0xce85('0xc'),auth[_0xce85('0x8')](),controller[_0xce85('0xd')]);router['get']('/:id/dispositions',auth[_0xce85('0x8')](),controller[_0xce85('0xe')]);router[_0xce85('0xa')]('/:id/canned_answers',auth[_0xce85('0x8')](),controller[_0xce85('0xf')]);router[_0xce85('0xa')](_0xce85('0x10'),auth[_0xce85('0x8')](),controller[_0xce85('0x11')]);router[_0xce85('0xa')](_0xce85('0x12'),auth['isAuthenticated'](),controller[_0xce85('0x13')]);router[_0xce85('0xa')](_0xce85('0x14'),auth['isAuthenticated'](),controller[_0xce85('0x15')]);router[_0xce85('0xa')]('/:id/applications',auth[_0xce85('0x8')](),controller[_0xce85('0x16')]);router[_0xce85('0xa')](_0xce85('0x17'),auth[_0xce85('0x8')](),controller[_0xce85('0x18')]);router[_0xce85('0xa')](_0xce85('0x19'),auth[_0xce85('0x8')](),controller['verifySmtp']);router[_0xce85('0xa')](_0xce85('0x1a'),auth['isAuthenticated'](),controller[_0xce85('0x1b')]);router[_0xce85('0x1c')](_0xce85('0x1d'),auth[_0xce85('0x8')](),controller['addDisposition']);router['post'](_0xce85('0x1e'),auth[_0xce85('0x8')](),controller[_0xce85('0x1f')]);router[_0xce85('0x1c')]('/',auth[_0xce85('0x8')](),controller[_0xce85('0x20')]);router[_0xce85('0x1c')](_0xce85('0x10'),auth[_0xce85('0x8')](),controller['addImap']);router['post'](_0xce85('0x12'),auth['isAuthenticated'](),controller[_0xce85('0x21')]);router['post'](_0xce85('0x14'),auth['isAuthenticated'](),controller[_0xce85('0x22')]);router[_0xce85('0x1c')](_0xce85('0x23'),auth[_0xce85('0x8')](),controller['addApplications']);router[_0xce85('0x1c')]('/:id/send',auth[_0xce85('0x8')](),controller[_0xce85('0x24')]);router['post'](_0xce85('0x1a'),auth[_0xce85('0x8')](),controller[_0xce85('0x25')]);router[_0xce85('0x26')]('/:id',auth[_0xce85('0x8')](),controller[_0xce85('0x27')]);router['delete'](_0xce85('0x1d'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xce85('0x28')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0xce85('0x10'),auth[_0xce85('0x8')](),controller[_0xce85('0x29')]);router[_0xce85('0x28')](_0xce85('0x12'),auth[_0xce85('0x8')](),controller[_0xce85('0x2a')]);router['delete'](_0xce85('0xc'),auth[_0xce85('0x8')](),controller[_0xce85('0x2b')]);router[_0xce85('0x28')](_0xce85('0x1a'),auth[_0xce85('0x8')](),controller[_0xce85('0x2c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 2fc47af..27c99c2 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 _0x4899=['TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','sequelize','STRING','BOOLEAN'];(function(_0x4715d2,_0x3371b2){var _0x141811=function(_0x520bc6){while(--_0x520bc6){_0x4715d2['push'](_0x4715d2['shift']());}};_0x141811(++_0x3371b2);}(_0x4899,0x74));var _0x9489=function(_0x2bf8ae,_0x48ef3e){_0x2bf8ae=_0x2bf8ae-0x0;var _0x27ee6f=_0x4899[_0x2bf8ae];return _0x27ee6f;};'use strict';var Sequelize=require(_0x9489('0x0'));module['exports']={'description':{'type':Sequelize[_0x9489('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x9489('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x9489('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x9489('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x9489('0x3')]},'markAsUnread':{'type':Sequelize[_0x9489('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x9489('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x9489('0x4')](0x2)[_0x9489('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x9489('0x3')],'defaultValue':function(){return _0x9489('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9489('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9489('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9489('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c}}; \ No newline at end of file +var _0x0647=['BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','sequelize','STRING'];(function(_0x57a7f0,_0x12d744){var _0x379bde=function(_0x523c02){while(--_0x523c02){_0x57a7f0['push'](_0x57a7f0['shift']());}};_0x379bde(++_0x12d744);}(_0x0647,0xd0));var _0x7064=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x0647[_0x45b034];return _0x509cb0;};'use strict';var Sequelize=require(_0x7064('0x0'));module['exports']={'description':{'type':Sequelize[_0x7064('0x1')]},'name':{'type':Sequelize[_0x7064('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x7064('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x7064('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x7064('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x7064('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x7064('0x1')],'allowNull':![],'defaultValue':_0x7064('0x3')},'fontSize':{'type':Sequelize[_0x7064('0x4')](0x2)[_0x7064('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x7064('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7064('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7064('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7064('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7064('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7064('0x4')],'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 38795ce..6ee41a7 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 _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(_0x33db6b,_0x447f6c){var _0x4d2a24=function(_0x26def8){while(--_0x26def8){_0x33db6b['push'](_0x33db6b['shift']());}};_0x4d2a24(++_0x447f6c);}(_0x814b,0x1a2));var _0xb814=function(_0x4e6eac,_0x3f4365){_0x4e6eac=_0x4e6eac-0x0;var _0x79f963=_0x814b[_0x4e6eac];return _0x79f963;};'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 +var _0x5fc3=['lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','socket.io-emitter','localhost','register','jayson/promise','http','request','then','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','MailServerIn','Imap','Smtp','MailAccount','model','query','dateStart','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','add','day','merge','map','filter','includeAll','findAll','rows','show','params','MailServerOut','keys','rawAttributes','options','find','body','describe','MailAccountId','Disposition','create','getDispositions','hasOwnProperty','pick','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','key','email','ListId','isNil','active','cservice','cauthentication','user','cuser','password','cpassword','authentication','host','port','service','pass','getImap','findOne','addImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','color','tag','MailInteraction','transaction','MailApplication','bulkCreate','findAndCountAll','getApplications','getMessages','MailMessage','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','basename','secure','auth','SendMail','sendMail','List','Contacts','defaults','List\x20not\x20found','messageId','subject','attach','out','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','emit','getAgents','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs'];(function(_0x22cc16,_0x1f4fa2){var _0x399b70=function(_0x34d464){while(--_0x34d464){_0x22cc16['push'](_0x22cc16['shift']());}};_0x399b70(++_0x1f4fa2);}(_0x5fc3,0xa8));var _0x35fc=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0x5fc3[_0x470bfb];return _0x2f5d97;};'use strict';var jsonpatch=require(_0x35fc('0x0'));var rp=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var Mustache=require(_0x35fc('0x3'));var util=require(_0x35fc('0x4'));var path=require(_0x35fc('0x5'));var sox=require(_0x35fc('0x6'));var csv=require('to-csv');var ejs=require(_0x35fc('0x7'));var fs=require('fs');var _=require(_0x35fc('0x8'));var squel=require(_0x35fc('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x35fc('0xa'));var toCsv=require('to-csv');var querystring=require(_0x35fc('0xb'));var Papa=require(_0x35fc('0xc'));var qs=require(_0x35fc('0xd'));var logger=require(_0x35fc('0xe'))(_0x35fc('0xf'));var utils=require(_0x35fc('0x10'));var config=require(_0x35fc('0x11'));var db=require('../../mysqldb')['db'];var socket=require(_0x35fc('0x12'))({'host':_0x35fc('0x13'),'port':0x18eb});require('./mailAccount.socket')[_0x35fc('0x14')](socket);var jayson=require(_0x35fc('0x15'));var client=jayson['client'][_0x35fc('0x16')]({'port':0x232b});function respondWithRpcPromise(_0x1a9f2b,_0x5469f5,_0x4cbe74,_0x409357){return new BPromise(function(_0x5d462a,_0x397738){var _0x22055e=_0x409357||client;return _0x22055e[_0x35fc('0x17')](_0x1a9f2b,_0x4cbe74)[_0x35fc('0x18')](function(_0x38d9f2){logger['info']('MailAccount,\x20%s,\x20%s',_0x5469f5,'request\x20sent');logger['debug'](_0x35fc('0x19'),_0x5469f5,_0x35fc('0x1a'),JSON[_0x35fc('0x1b')](_0x38d9f2));if(_0x38d9f2[_0x35fc('0x1c')]){if(_0x38d9f2[_0x35fc('0x1c')][_0x35fc('0x1d')]===0x1f4){logger['error'](_0x35fc('0x1e'),_0x5469f5,_0x38d9f2[_0x35fc('0x1c')]['message']);return _0x397738(_0x38d9f2[_0x35fc('0x1c')][_0x35fc('0x1f')]);}logger[_0x35fc('0x1c')]('MailAccount,\x20%s,\x20%s',_0x5469f5,_0x38d9f2[_0x35fc('0x1c')][_0x35fc('0x1f')]);return _0x5d462a(_0x38d9f2[_0x35fc('0x1c')]['message']);}else{logger[_0x35fc('0x20')](_0x35fc('0x1e'),_0x5469f5,_0x35fc('0x1a'));_0x5d462a(_0x38d9f2[_0x35fc('0x21')][_0x35fc('0x1f')]);}})[_0x35fc('0x22')](function(_0x155016){logger[_0x35fc('0x1c')](_0x35fc('0x1e'),_0x5469f5,_0x155016);_0x397738(_0x155016);});});}function respondWithStatusCode(_0x427eae,_0x5bd2b8){_0x5bd2b8=_0x5bd2b8||0xcc;return function(_0x323aee){if(_0x323aee){return _0x427eae[_0x35fc('0x23')](_0x5bd2b8);}return _0x427eae[_0x35fc('0x24')](_0x5bd2b8)[_0x35fc('0x25')]();};}function respondWithResult(_0x3b4743,_0x55e9e7){_0x55e9e7=_0x55e9e7||0xc8;return function(_0x33f5e8){if(_0x33f5e8){return _0x3b4743[_0x35fc('0x24')](_0x55e9e7)['json'](_0x33f5e8);}};}function respondWithFilteredResult(_0x265324,_0x5a93df){return function(_0x3d4a98){if(_0x3d4a98){var _0x51cfec=_0x3d4a98[_0x35fc('0x26')],_0x4086e9=_0x5a93df['offset'],_0x598d7a=_0x5a93df['offset']+_0x5a93df[_0x35fc('0x27')],_0x1bf180;if(_0x598d7a>=_0x51cfec){_0x598d7a=_0x51cfec;_0x1bf180=0xc8;}else{_0x1bf180=0xce;}_0x265324['status'](_0x1bf180);return _0x265324[_0x35fc('0x28')](_0x35fc('0x29'),_0x4086e9+'-'+_0x598d7a+'/'+_0x51cfec)['json'](_0x3d4a98);}return null;};}function patchUpdates(_0x26b7cb){return function(_0x645eac){try{jsonpatch[_0x35fc('0x2a')](_0x645eac,_0x26b7cb,!![]);}catch(_0x9f3c8a){return BPromise[_0x35fc('0x2b')](_0x9f3c8a);}return _0x645eac[_0x35fc('0x2c')]();};}function saveUpdates(_0x11ccdb,_0x451f0c){return function(_0x54aedc){if(_0x54aedc){return _0x54aedc[_0x35fc('0x2d')](_0x11ccdb)[_0x35fc('0x18')](function(_0x22af18){return _0x22af18;});}return null;};}function removeEntity(_0x52acc5,_0xe79f52){return function(_0x16f067){if(_0x16f067){return _0x16f067[_0x35fc('0x2e')]()[_0x35fc('0x18')](function(){_0x52acc5[_0x35fc('0x24')](0xcc)[_0x35fc('0x25')]();});}};}function handleEntityNotFound(_0x222ddb,_0x37b435){return function(_0xf4dfab){if(!_0xf4dfab){_0x222ddb[_0x35fc('0x23')](0x194);}return _0xf4dfab;};}function handleError(_0x57072d,_0x5e0313){_0x5e0313=_0x5e0313||0x1f4;return function(_0x114bc1){logger['error'](_0x114bc1[_0x35fc('0x2f')]);if(_0x114bc1[_0x35fc('0x30')]){delete _0x114bc1[_0x35fc('0x30')];}_0x57072d[_0x35fc('0x24')](_0x5e0313)[_0x35fc('0x31')](_0x114bc1);};}exports[_0x35fc('0x32')]=function(_0x4e43b4,_0x3fe193){var _0x330a14={'include':[{'model':db[_0x35fc('0x33')],'as':_0x35fc('0x34')},{'model':db['MailServerOut'],'as':_0x35fc('0x35')}]},_0x46b9ef={},_0x4441d8={'count':0x0,'rows':[]};var _0x38193d=db[_0x35fc('0x36')]['rawAttributes'];_0x46b9ef[_0x35fc('0x37')]=_['keys'](_0x38193d);var _0x2ecb2e={'dateStart':_0x4e43b4[_0x35fc('0x38')][_0x35fc('0x39')],'dateEnd':_0x4e43b4[_0x35fc('0x38')]['dateEnd']};delete _0x4e43b4['query']['dateStart'];delete _0x4e43b4[_0x35fc('0x38')]['dateEnd'];_0x46b9ef[_0x35fc('0x38')]=_['keys'](_0x4e43b4[_0x35fc('0x38')]);_0x46b9ef[_0x35fc('0x3a')]=_[_0x35fc('0x3b')](_0x46b9ef[_0x35fc('0x37')],_0x46b9ef[_0x35fc('0x38')]);_0x330a14[_0x35fc('0x3c')]=_[_0x35fc('0x3b')](_0x46b9ef['model'],qs[_0x35fc('0x3d')](_0x4e43b4[_0x35fc('0x38')]['fields']));_0x330a14[_0x35fc('0x3c')]=_0x330a14[_0x35fc('0x3c')][_0x35fc('0x3e')]?_0x330a14[_0x35fc('0x3c')]:_0x46b9ef[_0x35fc('0x37')];if(!_0x4e43b4[_0x35fc('0x38')]['hasOwnProperty'](_0x35fc('0x3f'))){_0x330a14[_0x35fc('0x27')]=qs[_0x35fc('0x27')](_0x4e43b4['query'][_0x35fc('0x27')]);_0x330a14[_0x35fc('0x40')]=qs['offset'](_0x4e43b4[_0x35fc('0x38')][_0x35fc('0x40')]);}_0x330a14[_0x35fc('0x41')]=qs[_0x35fc('0x42')](_0x4e43b4[_0x35fc('0x38')][_0x35fc('0x42')]);_0x330a14[_0x35fc('0x43')]=qs[_0x35fc('0x3a')](_['pick'](_0x4e43b4['query'],_0x46b9ef[_0x35fc('0x3a')]));if(_0x2ecb2e[_0x35fc('0x39')]){if(_0x2ecb2e['dateEnd']){_0x2ecb2e['dateEnd']=moment(_0x2ecb2e['dateEnd'])[_0x35fc('0x44')](0x1,_0x35fc('0x45'));}else{_0x2ecb2e['dateEnd']=moment(_0x2ecb2e[_0x35fc('0x39')])[_0x35fc('0x44')](0x1,_0x35fc('0x45'));}_[_0x35fc('0x46')](_0x330a14['where'],{'createdAt':{'$gte':_0x2ecb2e['dateStart'],'$lte':_0x2ecb2e['dateEnd']}});}if(_0x4e43b4['query']['filter']){_0x330a14[_0x35fc('0x43')]=_[_0x35fc('0x46')](_0x330a14['where'],{'$or':_[_0x35fc('0x47')](_0x330a14['attributes'],function(_0x13d16c){var _0x40797d={};_0x40797d[_0x13d16c]={'$like':'%'+_0x4e43b4[_0x35fc('0x38')][_0x35fc('0x48')]+'%'};return _0x40797d;})});}_0x330a14=_[_0x35fc('0x46')]({},_0x330a14,_0x4e43b4['options']);var _0x64d381={'where':_0x330a14[_0x35fc('0x43')]};return db['MailAccount'][_0x35fc('0x26')](_0x64d381)[_0x35fc('0x18')](function(_0x2a8a09){_0x4441d8[_0x35fc('0x26')]=_0x2a8a09;if(_0x4e43b4['query'][_0x35fc('0x49')]){_0x330a14['include']=[{'all':!![]}];}return db['MailAccount'][_0x35fc('0x4a')](_0x330a14);})[_0x35fc('0x18')](function(_0x18dc78){_0x4441d8[_0x35fc('0x4b')]=_0x18dc78;return _0x4441d8;})[_0x35fc('0x18')](respondWithFilteredResult(_0x3fe193,_0x330a14))[_0x35fc('0x22')](handleError(_0x3fe193,null));};exports[_0x35fc('0x4c')]=function(_0x16afa6,_0x4f555f){var _0x3e2961={'raw':![],'where':{'id':_0x16afa6[_0x35fc('0x4d')]['id']},'include':[{'model':db[_0x35fc('0x33')],'as':_0x35fc('0x34')},{'model':db[_0x35fc('0x4e')],'as':_0x35fc('0x35')}]},_0x91d7c0={};_0x91d7c0[_0x35fc('0x37')]=_[_0x35fc('0x4f')](db[_0x35fc('0x36')][_0x35fc('0x50')]);_0x91d7c0[_0x35fc('0x38')]=_[_0x35fc('0x4f')](_0x16afa6[_0x35fc('0x38')]);_0x91d7c0['filters']=_['intersection'](_0x91d7c0[_0x35fc('0x37')],_0x91d7c0[_0x35fc('0x38')]);_0x3e2961[_0x35fc('0x3c')]=_[_0x35fc('0x3b')](_0x91d7c0[_0x35fc('0x37')],qs[_0x35fc('0x3d')](_0x16afa6['query']['fields']));_0x3e2961[_0x35fc('0x3c')]=_0x3e2961[_0x35fc('0x3c')][_0x35fc('0x3e')]?_0x3e2961[_0x35fc('0x3c')]:_0x91d7c0['model'];if(_0x16afa6[_0x35fc('0x38')][_0x35fc('0x49')]){_0x3e2961['include']=[{'all':!![]}];}_0x3e2961=_[_0x35fc('0x46')]({},_0x3e2961,_0x16afa6[_0x35fc('0x51')]);return db['MailAccount'][_0x35fc('0x52')](_0x3e2961)[_0x35fc('0x18')](handleEntityNotFound(_0x4f555f,null))[_0x35fc('0x18')](respondWithResult(_0x4f555f,null))[_0x35fc('0x22')](handleError(_0x4f555f,null));};exports['update']=function(_0x4de34b,_0x502a15){if(_0x4de34b[_0x35fc('0x53')]['id']){delete _0x4de34b[_0x35fc('0x53')]['id'];}return db['MailAccount'][_0x35fc('0x52')]({'where':{'id':_0x4de34b[_0x35fc('0x4d')]['id']},'include':[{'model':db[_0x35fc('0x33')],'as':_0x35fc('0x34')},{'model':db[_0x35fc('0x4e')],'as':'Smtp'}]})[_0x35fc('0x18')](handleEntityNotFound(_0x502a15,null))[_0x35fc('0x18')](saveUpdates(_0x4de34b[_0x35fc('0x53')],null))['then'](function(_0x304dba){if(_0x304dba&&_0x4de34b[_0x35fc('0x53')]['Imap']){return db[_0x35fc('0x33')][_0x35fc('0x2d')](_0x4de34b[_0x35fc('0x53')][_0x35fc('0x34')],{'where':{'MailAccountId':_0x304dba['id']}})[_0x35fc('0x18')](function(){return _0x304dba;});}return _0x304dba;})[_0x35fc('0x18')](function(_0x8501d1){if(_0x8501d1&&_0x4de34b[_0x35fc('0x53')]['Smtp']){return db[_0x35fc('0x4e')][_0x35fc('0x2d')](_0x4de34b[_0x35fc('0x53')]['Smtp'],{'where':{'MailAccountId':_0x8501d1['id']}})[_0x35fc('0x18')](function(){return _0x8501d1;});}return _0x8501d1;})['then'](respondWithResult(_0x502a15,null))['catch'](handleError(_0x502a15,null));};exports['describe']=function(_0x23b54f,_0xb1c68a){return db[_0x35fc('0x36')][_0x35fc('0x54')]()[_0x35fc('0x18')](respondWithResult(_0xb1c68a,null))['catch'](handleError(_0xb1c68a,null));};exports['addDisposition']=function(_0x5353ea,_0x4faef4,_0x51d231){if(_0x5353ea[_0x35fc('0x53')]['id']){delete _0x5353ea[_0x35fc('0x53')]['id'];}return db[_0x35fc('0x36')][_0x35fc('0x52')]({'where':{'id':_0x5353ea['params']['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x4faef4,null))[_0x35fc('0x18')](function(_0x390e16){if(_0x390e16){_0x5353ea[_0x35fc('0x53')][_0x35fc('0x55')]=_0x390e16['id'];return db[_0x35fc('0x56')][_0x35fc('0x57')](_0x5353ea[_0x35fc('0x53')]);}})[_0x35fc('0x18')](respondWithResult(_0x4faef4,null))['catch'](handleError(_0x4faef4,null));};exports[_0x35fc('0x58')]=function(_0x47c75f,_0xfbd737,_0x9029e3){var _0x2ac8e1={'raw':![],'where':{}};var _0x2bc76c={};var _0x4bdde7={'count':0x0,'rows':[]};return db[_0x35fc('0x36')]['findOne']({'where':{'id':_0x47c75f['params']['id']}})['then'](handleEntityNotFound(_0xfbd737,null))[_0x35fc('0x18')](function(_0x5dfeb7){if(_0x5dfeb7){_0x2bc76c[_0x35fc('0x37')]=_['keys'](db[_0x35fc('0x56')]['rawAttributes']);_0x2bc76c[_0x35fc('0x38')]=_[_0x35fc('0x4f')](_0x47c75f[_0x35fc('0x38')]);_0x2bc76c[_0x35fc('0x3a')]=_['intersection'](_0x2bc76c[_0x35fc('0x37')],_0x2bc76c[_0x35fc('0x38')]);_0x2ac8e1[_0x35fc('0x3c')]=_['intersection'](_0x2bc76c[_0x35fc('0x37')],qs[_0x35fc('0x3d')](_0x47c75f[_0x35fc('0x38')][_0x35fc('0x3d')]));_0x2ac8e1[_0x35fc('0x3c')]=_0x2ac8e1[_0x35fc('0x3c')][_0x35fc('0x3e')]?_0x2ac8e1[_0x35fc('0x3c')]:_0x2bc76c['model'];if(!_0x47c75f[_0x35fc('0x38')][_0x35fc('0x59')](_0x35fc('0x3f'))){_0x2ac8e1['limit']=qs[_0x35fc('0x27')](_0x47c75f[_0x35fc('0x38')]['limit']);_0x2ac8e1['offset']=qs[_0x35fc('0x40')](_0x47c75f['query'][_0x35fc('0x40')]);}_0x2ac8e1[_0x35fc('0x41')]=qs[_0x35fc('0x42')](_0x47c75f[_0x35fc('0x38')][_0x35fc('0x42')]);_0x2ac8e1[_0x35fc('0x43')]=qs[_0x35fc('0x3a')](_[_0x35fc('0x5a')](_0x47c75f[_0x35fc('0x38')],_0x2bc76c[_0x35fc('0x3a')]));_0x2ac8e1[_0x35fc('0x43')][_0x35fc('0x55')]=_0x5dfeb7['id'];if(_0x47c75f[_0x35fc('0x38')][_0x35fc('0x48')]){_0x2ac8e1[_0x35fc('0x43')]=_[_0x35fc('0x46')](_0x2ac8e1[_0x35fc('0x43')],{'$or':_[_0x35fc('0x47')](_0x2ac8e1[_0x35fc('0x3c')],function(_0x3f3f36){var _0x4ba1b0={};_0x4ba1b0[_0x3f3f36]={'$like':'%'+_0x47c75f[_0x35fc('0x38')]['filter']+'%'};return _0x4ba1b0;})});}_0x2ac8e1=_[_0x35fc('0x46')]({},_0x2ac8e1,_0x47c75f[_0x35fc('0x51')]);return db[_0x35fc('0x56')][_0x35fc('0x26')]({'where':_0x2ac8e1[_0x35fc('0x43')]})[_0x35fc('0x18')](function(_0x2913ba){_0x4bdde7[_0x35fc('0x26')]=_0x2913ba;if(_0x47c75f[_0x35fc('0x38')][_0x35fc('0x49')]){_0x2ac8e1[_0x35fc('0x5b')]=[{'all':!![]}];}return db['Disposition'][_0x35fc('0x4a')](_0x2ac8e1);})[_0x35fc('0x18')](function(_0x2c1bd2){_0x4bdde7[_0x35fc('0x4b')]=_0x2c1bd2;return _0x4bdde7;});}})[_0x35fc('0x18')](respondWithFilteredResult(_0xfbd737,_0x2ac8e1))[_0x35fc('0x22')](handleError(_0xfbd737,null));};exports['removeDispositions']=function(_0x43ef1f,_0x3353e0,_0x277514){var _0x23206d;return db[_0x35fc('0x36')][_0x35fc('0x52')]({'where':{'id':_0x43ef1f[_0x35fc('0x4d')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x3353e0,null))[_0x35fc('0x18')](function(_0x5f23d8){if(_0x5f23d8){return _0x5f23d8[_0x35fc('0x5c')](_0x43ef1f['query'][_0x35fc('0x5d')]);}})[_0x35fc('0x18')](respondWithStatusCode(_0x3353e0,null))['catch'](handleError(_0x3353e0,null));};exports[_0x35fc('0x5e')]=function(_0x41002a,_0xcaa49,_0x4274d6){if(_0x41002a[_0x35fc('0x53')]['id']){delete _0x41002a[_0x35fc('0x53')]['id'];}return db[_0x35fc('0x36')][_0x35fc('0x52')]({'where':{'id':_0x41002a[_0x35fc('0x4d')]['id']}})['then'](handleEntityNotFound(_0xcaa49,null))['then'](function(_0x4e7c7b){if(_0x4e7c7b){_0x41002a['body'][_0x35fc('0x55')]=_0x4e7c7b['id'];return db[_0x35fc('0x5f')][_0x35fc('0x57')](_0x41002a[_0x35fc('0x53')]);}})[_0x35fc('0x18')](respondWithResult(_0xcaa49,null))['catch'](handleError(_0xcaa49,null));};exports[_0x35fc('0x60')]=function(_0x19682e,_0x8e12ff,_0x169ea2){var _0x584a58={'raw':![],'where':{}};var _0x15e936={};var _0x3ddd21={'count':0x0,'rows':[]};return db[_0x35fc('0x36')]['findOne']({'where':{'id':_0x19682e[_0x35fc('0x4d')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x8e12ff,null))[_0x35fc('0x18')](function(_0x9fe765){if(_0x9fe765){_0x15e936[_0x35fc('0x37')]=_[_0x35fc('0x4f')](db[_0x35fc('0x5f')][_0x35fc('0x50')]);_0x15e936['query']=_[_0x35fc('0x4f')](_0x19682e[_0x35fc('0x38')]);_0x15e936[_0x35fc('0x3a')]=_[_0x35fc('0x3b')](_0x15e936[_0x35fc('0x37')],_0x15e936[_0x35fc('0x38')]);_0x584a58['attributes']=_[_0x35fc('0x3b')](_0x15e936['model'],qs['fields'](_0x19682e[_0x35fc('0x38')]['fields']));_0x584a58[_0x35fc('0x3c')]=_0x584a58[_0x35fc('0x3c')][_0x35fc('0x3e')]?_0x584a58['attributes']:_0x15e936[_0x35fc('0x37')];if(!_0x19682e[_0x35fc('0x38')][_0x35fc('0x59')](_0x35fc('0x3f'))){_0x584a58[_0x35fc('0x27')]=qs['limit'](_0x19682e['query']['limit']);_0x584a58[_0x35fc('0x40')]=qs['offset'](_0x19682e[_0x35fc('0x38')][_0x35fc('0x40')]);}_0x584a58[_0x35fc('0x41')]=qs[_0x35fc('0x42')](_0x19682e['query'][_0x35fc('0x42')]);_0x584a58[_0x35fc('0x43')]=qs[_0x35fc('0x3a')](_['pick'](_0x19682e[_0x35fc('0x38')],_0x15e936[_0x35fc('0x3a')]));_0x584a58[_0x35fc('0x43')]['MailAccountId']=_0x9fe765['id'];if(_0x19682e['query']['filter']){_0x584a58[_0x35fc('0x43')]=_[_0x35fc('0x46')](_0x584a58[_0x35fc('0x43')],{'$or':_[_0x35fc('0x47')](_0x584a58['attributes'],function(_0x3ead4e){var _0x1de79d={};_0x1de79d[_0x3ead4e]={'$like':'%'+_0x19682e['query']['filter']+'%'};return _0x1de79d;})});}_0x584a58=_[_0x35fc('0x46')]({},_0x584a58,_0x19682e[_0x35fc('0x51')]);return db[_0x35fc('0x5f')]['count']({'where':_0x584a58['where']})[_0x35fc('0x18')](function(_0x432ba4){_0x3ddd21['count']=_0x432ba4;if(_0x19682e[_0x35fc('0x38')][_0x35fc('0x49')]){_0x584a58[_0x35fc('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x35fc('0x4a')](_0x584a58);})[_0x35fc('0x18')](function(_0x8f61d5){_0x3ddd21[_0x35fc('0x4b')]=_0x8f61d5;return _0x3ddd21;});}})['then'](respondWithFilteredResult(_0x8e12ff,_0x584a58))[_0x35fc('0x22')](handleError(_0x8e12ff,null));};exports[_0x35fc('0x61')]=function(_0x41483f,_0x494a1d,_0x96dfc){var _0x26d242;return db[_0x35fc('0x36')]['find']({'where':{'id':_0x41483f[_0x35fc('0x4d')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x494a1d,null))['then'](function(_0x2c0348){if(_0x2c0348){return _0x2c0348[_0x35fc('0x61')](_0x41483f[_0x35fc('0x38')][_0x35fc('0x5d')]);}})[_0x35fc('0x18')](respondWithStatusCode(_0x494a1d,null))[_0x35fc('0x22')](handleError(_0x494a1d,null));};exports[_0x35fc('0x57')]=function(_0x704e1f,_0x2d1b79){var _0x5d8f81={'name':_0x704e1f[_0x35fc('0x53')][_0x35fc('0x30')],'key':_0x704e1f[_0x35fc('0x53')][_0x35fc('0x62')],'email':_0x704e1f['body'][_0x35fc('0x63')],'ListId':_0x704e1f[_0x35fc('0x53')][_0x35fc('0x64')],'active':!_[_0x35fc('0x65')](_0x704e1f[_0x35fc('0x53')][_0x35fc('0x66')])?_0x704e1f[_0x35fc('0x53')][_0x35fc('0x66')]:!![],'description':_0x704e1f['body']['description']||null,'Imap':{},'Smtp':{}};if(_[_0x35fc('0x65')](_0x704e1f[_0x35fc('0x53')][_0x35fc('0x67')])){if(_0x704e1f['body'][_0x35fc('0x68')]){_0x5d8f81[_0x35fc('0x34')][_0x35fc('0x69')]=_0x5d8f81[_0x35fc('0x35')]['user']=_0x704e1f['body'][_0x35fc('0x6a')];_0x5d8f81['Imap'][_0x35fc('0x6b')]=_0x5d8f81[_0x35fc('0x35')]['pass']=_0x704e1f['body'][_0x35fc('0x6c')];}else{_0x5d8f81[_0x35fc('0x34')][_0x35fc('0x6d')]=_0x5d8f81['Smtp'][_0x35fc('0x6d')]=![];}_0x5d8f81[_0x35fc('0x34')][_0x35fc('0x6e')]=_0x704e1f['body'][_0x35fc('0x34')][_0x35fc('0x6e')];_0x5d8f81[_0x35fc('0x34')][_0x35fc('0x6f')]=_0x704e1f['body'][_0x35fc('0x34')][_0x35fc('0x6f')];_0x5d8f81[_0x35fc('0x35')][_0x35fc('0x6e')]=_0x704e1f[_0x35fc('0x53')][_0x35fc('0x35')]['host'];_0x5d8f81[_0x35fc('0x35')][_0x35fc('0x6f')]=_0x704e1f['body'][_0x35fc('0x35')][_0x35fc('0x6f')];}else{_0x5d8f81['Imap'][_0x35fc('0x70')]=_0x5d8f81[_0x35fc('0x35')][_0x35fc('0x70')]=_0x704e1f[_0x35fc('0x53')][_0x35fc('0x67')];_0x5d8f81['Imap'][_0x35fc('0x69')]=_0x5d8f81[_0x35fc('0x35')][_0x35fc('0x69')]=_0x704e1f['body'][_0x35fc('0x6a')];_0x5d8f81['Imap']['password']=_0x5d8f81[_0x35fc('0x35')][_0x35fc('0x71')]=_0x704e1f[_0x35fc('0x53')][_0x35fc('0x6c')];}return db[_0x35fc('0x36')]['create'](_0x5d8f81,{'include':[{'model':db[_0x35fc('0x4e')],'as':_0x35fc('0x35')},{'model':db[_0x35fc('0x33')],'as':'Imap'}]})[_0x35fc('0x18')](respondWithResult(_0x2d1b79,0xc9))[_0x35fc('0x22')](handleError(_0x2d1b79,null));};exports[_0x35fc('0x72')]=function(_0x448cd5,_0x169112,_0x4ec3ba){return db[_0x35fc('0x36')][_0x35fc('0x73')]({'where':{'id':_0x448cd5['params']['id']}})['then'](handleEntityNotFound(_0x169112,null))[_0x35fc('0x18')](function(_0x44b356){if(_0x44b356){return _0x44b356[_0x35fc('0x72')]();}return null;})[_0x35fc('0x18')](respondWithResult(_0x169112,null))[_0x35fc('0x22')](handleError(_0x169112,null));};exports[_0x35fc('0x74')]=function(_0x8c80ca,_0x5059a2,_0x5dc286){if(_0x8c80ca[_0x35fc('0x53')]['id']){delete _0x8c80ca[_0x35fc('0x53')]['id'];}return db[_0x35fc('0x36')][_0x35fc('0x52')]({'where':{'id':_0x8c80ca[_0x35fc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5059a2,null))['then'](function(_0x2c213d){if(_0x2c213d){_0x8c80ca[_0x35fc('0x53')][_0x35fc('0x55')]=_0x2c213d['id'];return db[_0x35fc('0x33')]['create'](_0x8c80ca['body']);}})[_0x35fc('0x18')](respondWithResult(_0x5059a2,null))[_0x35fc('0x22')](handleError(_0x5059a2,null));};exports[_0x35fc('0x75')]=function(_0xd46d64,_0x51bd0c,_0x58a580){return db[_0x35fc('0x36')][_0x35fc('0x73')]({'where':{'id':_0xd46d64['params']['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x51bd0c,null))[_0x35fc('0x18')](function(_0x2e9097){if(_0x2e9097){return _0x2e9097[_0x35fc('0x76')](null);}return null;})[_0x35fc('0x18')](respondWithStatusCode(_0x51bd0c,null))[_0x35fc('0x22')](handleError(_0x51bd0c,null));};exports[_0x35fc('0x77')]=function(_0x285fcb,_0x42836b,_0x29ae75){return db[_0x35fc('0x36')][_0x35fc('0x73')]({'where':{'id':_0x285fcb[_0x35fc('0x4d')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x42836b,null))[_0x35fc('0x18')](function(_0x70cca3){if(_0x70cca3){return _0x70cca3['getSmtp']();}return null;})[_0x35fc('0x18')](respondWithResult(_0x42836b,null))['catch'](handleError(_0x42836b,null));};exports[_0x35fc('0x78')]=function(_0x5d677a,_0x5aa072,_0x3c96ef){if(_0x5d677a[_0x35fc('0x53')]['id']){delete _0x5d677a[_0x35fc('0x53')]['id'];}return db['MailAccount'][_0x35fc('0x52')]({'where':{'id':_0x5d677a[_0x35fc('0x4d')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x5aa072,null))[_0x35fc('0x18')](function(_0x5fc40d){if(_0x5fc40d){_0x5d677a[_0x35fc('0x53')]['MailAccountId']=_0x5fc40d['id'];return db['MailServerOut'][_0x35fc('0x57')](_0x5d677a['body']);}})['then'](respondWithResult(_0x5aa072,null))[_0x35fc('0x22')](handleError(_0x5aa072,null));};exports['removeSmtp']=function(_0x556f9a,_0x5ae83f,_0x450769){return db['MailAccount'][_0x35fc('0x73')]({'where':{'id':_0x556f9a[_0x35fc('0x4d')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x5ae83f,null))[_0x35fc('0x18')](function(_0x392212){if(_0x392212){return _0x392212[_0x35fc('0x79')](null);}return null;})['then'](respondWithStatusCode(_0x5ae83f,null))['catch'](handleError(_0x5ae83f,null));};exports[_0x35fc('0x7a')]=function(_0x5994ec,_0x233c94,_0x39d9ec){return db['MailInteraction']['find']({'where':{'id':_0x5994ec['params']['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x233c94,null))[_0x35fc('0x18')](function(_0x406548){if(_0x406548){return _0x406548[_0x35fc('0x7a')](_0x5994ec[_0x35fc('0x53')][_0x35fc('0x5d')],_[_0x35fc('0x7b')](_0x5994ec[_0x35fc('0x53')],['ids','id'])||{});}})['then'](respondWithResult(_0x233c94,null))['catch'](handleError(_0x233c94,null));};exports['getInteractions']=function(_0x718c42,_0x4c9c90,_0x1a6c51){var _0x5a801b={'raw':![],'where':{}};var _0x47387f={};var _0x31b61d={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x718c42[_0x35fc('0x4d')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x4c9c90,null))[_0x35fc('0x18')](function(_0x3e6b71){if(_0x3e6b71){_0x47387f[_0x35fc('0x37')]=_['keys'](db['MailInteraction'][_0x35fc('0x50')]);_0x47387f['query']=_[_0x35fc('0x4f')](_0x718c42['query']);_0x47387f[_0x35fc('0x3a')]=_[_0x35fc('0x3b')](_0x47387f[_0x35fc('0x37')],_0x47387f[_0x35fc('0x38')]);_0x5a801b['attributes']=_[_0x35fc('0x3b')](_0x47387f['model'],qs[_0x35fc('0x3d')](_0x718c42['query']['fields']));_0x5a801b[_0x35fc('0x3c')]=_0x5a801b['attributes'][_0x35fc('0x3e')]?_0x5a801b[_0x35fc('0x3c')]:_0x47387f[_0x35fc('0x37')];if(!_0x718c42[_0x35fc('0x38')][_0x35fc('0x59')](_0x35fc('0x3f'))){_0x5a801b[_0x35fc('0x27')]=qs[_0x35fc('0x27')](_0x718c42[_0x35fc('0x38')]['limit']);_0x5a801b[_0x35fc('0x40')]=qs[_0x35fc('0x40')](_0x718c42[_0x35fc('0x38')][_0x35fc('0x40')]);}_0x5a801b[_0x35fc('0x41')]=qs[_0x35fc('0x42')](_0x718c42[_0x35fc('0x38')][_0x35fc('0x42')]);_0x5a801b['where']=qs['filters'](_['pick'](_0x718c42['query'],_0x47387f['filters']));_0x5a801b[_0x35fc('0x43')][_0x35fc('0x55')]=_0x3e6b71['id'];if(_0x718c42[_0x35fc('0x38')][_0x35fc('0x48')]){_0x5a801b[_0x35fc('0x43')]=_['merge'](_0x5a801b[_0x35fc('0x43')],{'$or':_[_0x35fc('0x47')](_0x5a801b[_0x35fc('0x3c')],function(_0x2f450e){var _0x370e99={};_0x370e99[_0x2f450e]={'$like':'%'+_0x718c42['query'][_0x35fc('0x48')]+'%'};return _0x370e99;})});}_0x5a801b=_[_0x35fc('0x46')]({},_0x5a801b,_0x718c42[_0x35fc('0x51')]);return db['MailInteraction'][_0x35fc('0x26')]({'where':_0x5a801b[_0x35fc('0x43')]})[_0x35fc('0x18')](function(_0x336b44){_0x31b61d[_0x35fc('0x26')]=_0x336b44;if(_0x718c42[_0x35fc('0x38')][_0x35fc('0x49')]){_0x5a801b[_0x35fc('0x5b')]=[{'model':db[_0x35fc('0x7c')],'as':_0x35fc('0x7d'),'required':![]},{'model':db[_0x35fc('0x7e')],'as':_0x35fc('0x7f'),'attributes':[_0x35fc('0x30'),_0x35fc('0x80'),_0x35fc('0x81')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x35fc('0x30'),_0x35fc('0x82')],'where':_0x718c42[_0x35fc('0x38')][_0x35fc('0x83')]?{'id':_0x718c42[_0x35fc('0x38')][_0x35fc('0x83')]}:undefined,'required':_0x718c42[_0x35fc('0x38')][_0x35fc('0x83')]?!![]:![]}];}return db[_0x35fc('0x84')][_0x35fc('0x4a')](_0x5a801b);})[_0x35fc('0x18')](function(_0x25457b){_0x31b61d[_0x35fc('0x4b')]=_0x25457b;return _0x31b61d;});}})[_0x35fc('0x18')](respondWithFilteredResult(_0x4c9c90,_0x5a801b))[_0x35fc('0x22')](handleError(_0x4c9c90,null));};exports['addApplications']=function(_0x31f580,_0x2cc28e,_0x14038c){return db[_0x35fc('0x36')][_0x35fc('0x73')]({'where':{'id':_0x31f580[_0x35fc('0x4d')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x2cc28e,null))[_0x35fc('0x18')](function(_0x5e828f){if(_0x5e828f){return db['sequelize'][_0x35fc('0x85')](function(_0x2d4d10){return db['MailApplication'][_0x35fc('0x2e')]({'where':{'MailAccountId':_0x31f580[_0x35fc('0x4d')]['id']},'transaction':_0x2d4d10})[_0x35fc('0x18')](function(_0x287555){var _0x56242f=_[_0x35fc('0x47')](_0x31f580[_0x35fc('0x53')],function(_0x2d6801){_0x2d6801[_0x35fc('0x55')]=_0x31f580['params']['id'];return _0x2d6801;});return db[_0x35fc('0x86')][_0x35fc('0x87')](_0x56242f,{'transaction':_0x2d4d10});});})['then'](function(){return db[_0x35fc('0x86')][_0x35fc('0x88')]({'where':{'MailAccountId':_0x31f580[_0x35fc('0x4d')]['id']},'order':'priority'});});}})[_0x35fc('0x18')](respondWithResult(_0x2cc28e,null))['catch'](handleError(_0x2cc28e,null));};exports[_0x35fc('0x89')]=function(_0xe25a3a,_0x4b6c11,_0xa0dc64){var _0x207e42={};var _0x139065={};var _0x25aedf;var _0x316d37;return db[_0x35fc('0x36')][_0x35fc('0x73')]({'where':{'id':_0xe25a3a['params']['id']}})['then'](handleEntityNotFound(_0x4b6c11,null))[_0x35fc('0x18')](function(_0xb87e1){if(_0xb87e1){_0x25aedf=_0xb87e1;_0x139065[_0x35fc('0x37')]=_[_0x35fc('0x4f')](db[_0x35fc('0x86')][_0x35fc('0x50')]);_0x139065[_0x35fc('0x38')]=_['keys'](_0xe25a3a[_0x35fc('0x38')]);_0x139065[_0x35fc('0x3a')]=_[_0x35fc('0x3b')](_0x139065['model'],_0x139065[_0x35fc('0x38')]);_0x207e42[_0x35fc('0x3c')]=_[_0x35fc('0x3b')](_0x139065[_0x35fc('0x37')],qs[_0x35fc('0x3d')](_0xe25a3a[_0x35fc('0x38')][_0x35fc('0x3d')]));_0x207e42[_0x35fc('0x3c')]=_0x207e42[_0x35fc('0x3c')][_0x35fc('0x3e')]?_0x207e42[_0x35fc('0x3c')]:_0x139065[_0x35fc('0x37')];_0x207e42[_0x35fc('0x41')]=qs[_0x35fc('0x42')](_0xe25a3a[_0x35fc('0x38')][_0x35fc('0x42')]);_0x207e42[_0x35fc('0x43')]=qs[_0x35fc('0x3a')](_[_0x35fc('0x5a')](_0xe25a3a['query'],_0x139065[_0x35fc('0x3a')]));if(_0xe25a3a['query'][_0x35fc('0x48')]){_0x207e42[_0x35fc('0x43')]=_['merge'](_0x207e42[_0x35fc('0x43')],{'$or':_[_0x35fc('0x47')](_0x207e42[_0x35fc('0x3c')],function(_0x1171ab){var _0x426df4={};_0x426df4[_0x1171ab]={'$like':'%'+_0xe25a3a[_0x35fc('0x38')][_0x35fc('0x48')]+'%'};return _0x426df4;})});}_0x207e42=_[_0x35fc('0x46')]({},_0x207e42,_0xe25a3a['options']);return _0x25aedf[_0x35fc('0x89')](_0x207e42);}})[_0x35fc('0x18')](function(_0x1855d8){if(_0x1855d8){_0x316d37=_0x1855d8[_0x35fc('0x3e')];if(!_0xe25a3a['query']['hasOwnProperty']('nolimit')){_0x207e42['limit']=qs[_0x35fc('0x27')](_0xe25a3a['query'][_0x35fc('0x27')]);_0x207e42[_0x35fc('0x40')]=qs[_0x35fc('0x40')](_0xe25a3a[_0x35fc('0x38')][_0x35fc('0x40')]);}return _0x25aedf[_0x35fc('0x89')](_0x207e42);}})[_0x35fc('0x18')](function(_0x41cbaa){if(_0x41cbaa){return _0x41cbaa?{'count':_0x316d37,'rows':_0x41cbaa}:null;}})[_0x35fc('0x18')](respondWithResult(_0x4b6c11,null))[_0x35fc('0x22')](handleError(_0x4b6c11,null));};exports[_0x35fc('0x8a')]=function(_0xafe2d,_0xb0b8ca,_0x5ad3cb){var _0x35f09b={'raw':!![],'where':{}};var _0x3e8580={};var _0x297528={'count':0x0,'rows':[]};return db[_0x35fc('0x36')]['findOne']({'where':{'id':_0xafe2d[_0x35fc('0x4d')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0xb0b8ca,null))[_0x35fc('0x18')](function(_0xe7663b){if(_0xe7663b){_0x3e8580[_0x35fc('0x37')]=_[_0x35fc('0x4f')](db[_0x35fc('0x8b')][_0x35fc('0x50')]);_0x3e8580[_0x35fc('0x38')]=_[_0x35fc('0x4f')](_0xafe2d[_0x35fc('0x38')]);_0x3e8580[_0x35fc('0x3a')]=_[_0x35fc('0x3b')](_0x3e8580[_0x35fc('0x37')],_0x3e8580[_0x35fc('0x38')]);_0x35f09b[_0x35fc('0x3c')]=_[_0x35fc('0x3b')](_0x3e8580[_0x35fc('0x37')],qs[_0x35fc('0x3d')](_0xafe2d[_0x35fc('0x38')][_0x35fc('0x3d')]));_0x35f09b[_0x35fc('0x3c')]=_0x35f09b['attributes'][_0x35fc('0x3e')]?_0x35f09b[_0x35fc('0x3c')]:_0x3e8580[_0x35fc('0x37')];if(!_0xafe2d[_0x35fc('0x38')][_0x35fc('0x59')]('nolimit')){_0x35f09b[_0x35fc('0x27')]=qs['limit'](_0xafe2d[_0x35fc('0x38')][_0x35fc('0x27')]);_0x35f09b[_0x35fc('0x40')]=qs[_0x35fc('0x40')](_0xafe2d[_0x35fc('0x38')][_0x35fc('0x40')]);}_0x35f09b[_0x35fc('0x41')]=qs[_0x35fc('0x42')](_0xafe2d[_0x35fc('0x38')][_0x35fc('0x42')]);_0x35f09b[_0x35fc('0x43')]=qs[_0x35fc('0x3a')](_[_0x35fc('0x5a')](_0xafe2d[_0x35fc('0x38')],_0x3e8580[_0x35fc('0x3a')]));_0x35f09b[_0x35fc('0x43')][_0x35fc('0x55')]=_0xe7663b['id'];if(_0xafe2d[_0x35fc('0x38')][_0x35fc('0x48')]){_0x35f09b[_0x35fc('0x43')]=_['merge'](_0x35f09b[_0x35fc('0x43')],{'$or':_[_0x35fc('0x47')](_0x35f09b[_0x35fc('0x3c')],function(_0x47e0c7){var _0x19c803={};_0x19c803[_0x47e0c7]={'$like':'%'+_0xafe2d[_0x35fc('0x38')]['filter']+'%'};return _0x19c803;})});}if(_0xafe2d['query']['$gte']){var _0x150d69=_0xafe2d[_0x35fc('0x38')]['$gte'][_0x35fc('0x8c')](',');var _0x3babc3={};_0x3babc3[_0x150d69[0x0]]={'$gte':moment(_0x150d69[0x1])[_0x35fc('0x8d')](_0x35fc('0x8e'))};_0x35f09b[_0x35fc('0x43')]=_[_0x35fc('0x46')](_0x35f09b['where'],_0x3babc3);}_0x35f09b=_[_0x35fc('0x46')]({},_0x35f09b,_0xafe2d[_0x35fc('0x51')]);return db[_0x35fc('0x8b')][_0x35fc('0x26')]({'where':_0x35f09b[_0x35fc('0x43')]})['then'](function(_0x289429){_0x297528[_0x35fc('0x26')]=_0x289429;if(_0xafe2d['query'][_0x35fc('0x49')]){_0x35f09b[_0x35fc('0x5b')]=[{'all':!![]}];}return db[_0x35fc('0x8b')][_0x35fc('0x4a')](_0x35f09b);})[_0x35fc('0x18')](function(_0xb0ba1e){_0x297528[_0x35fc('0x4b')]=_0xb0ba1e;return _0x297528;});}})[_0x35fc('0x18')](respondWithFilteredResult(_0xb0b8ca,_0x35f09b))[_0x35fc('0x22')](handleError(_0xb0b8ca,null));};exports['send']=function(_0x44c954,_0x371e7d,_0x53f6c2){var _0x707d9,_0x4ffbf9={},_0x120e5d;if(_0x44c954[_0x35fc('0x53')]['to']){_0x120e5d=_0x44c954[_0x35fc('0x53')]['to'][_0x35fc('0x8c')](',')[0x0];}return db[_0x35fc('0x36')][_0x35fc('0x52')]({'where':{'id':_0x44c954[_0x35fc('0x4d')]['id']},'include':[{'model':db[_0x35fc('0x8f')],'as':'List','include':[{'model':db[_0x35fc('0x7c')],'as':'Contacts','where':{'email':_0x120e5d},'limit':0x1,'order':[[_0x35fc('0x90'),_0x35fc('0x91')]]}]},{'model':db[_0x35fc('0x4e')],'as':_0x35fc('0x35'),'raw':!![]}]})[_0x35fc('0x18')](handleEntityNotFound(_0x371e7d,null))[_0x35fc('0x18')](function(_0x38b8e8){if(_0x38b8e8){_0x707d9=_0x38b8e8;if(_0x38b8e8[_0x35fc('0x35')]){if(_[_0x35fc('0x65')](_0x44c954[_0x35fc('0x53')][_0x35fc('0x92')])){_0x44c954[_0x35fc('0x53')][_0x35fc('0x92')]=util[_0x35fc('0x8d')](_0x35fc('0x93'),_0x38b8e8['name'],_0x38b8e8[_0x35fc('0x63')]||_0x38b8e8[_0x35fc('0x35')][_0x35fc('0x69')]);}if(_0x44c954[_0x35fc('0x53')][_0x35fc('0x94')]&&_0x44c954[_0x35fc('0x53')][_0x35fc('0x94')]['length']){for(var _0x4a3036=0x0;_0x4a3036<_0x44c954['body']['attachments'][_0x35fc('0x3e')];_0x4a3036+=0x1){_0x44c954['body'][_0x35fc('0x94')][_0x4a3036]={'filename':_0x44c954[_0x35fc('0x53')][_0x35fc('0x94')][_0x4a3036][_0x35fc('0x30')],'path':path[_0x35fc('0x95')](config[_0x35fc('0x96')],'server/files/attachments',_0x44c954[_0x35fc('0x53')]['attachments'][_0x4a3036][_0x35fc('0x97')])};}}var _0x4cd30d={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x38b8e8[_0x35fc('0x35')][_0x35fc('0x70')])){if(_0x38b8e8[_0x35fc('0x35')]['authentication']){_0x4cd30d['auth']={'user':_0x38b8e8['Smtp']['user'],'pass':_0x38b8e8[_0x35fc('0x35')][_0x35fc('0x71')]};}_0x4cd30d[_0x35fc('0x6e')]=_0x38b8e8[_0x35fc('0x35')][_0x35fc('0x6e')];_0x4cd30d[_0x35fc('0x6f')]=_0x38b8e8[_0x35fc('0x35')][_0x35fc('0x6f')];_0x4cd30d[_0x35fc('0x98')]=_0x38b8e8['Smtp']['secure'];}else{_0x4cd30d[_0x35fc('0x70')]=_0x38b8e8[_0x35fc('0x35')][_0x35fc('0x70')];_0x4cd30d[_0x35fc('0x99')]={'user':_0x38b8e8[_0x35fc('0x35')][_0x35fc('0x69')],'pass':_0x38b8e8['Smtp'][_0x35fc('0x71')]};}return respondWithRpcPromise(_0x35fc('0x9a'),_0x35fc('0x9b'),{'account':_0x4cd30d,'message':_0x44c954['body']});}else{throw new Error('List\x20not\x20found');}}})[_0x35fc('0x18')](function(_0x26b1cb){if(_0x26b1cb){_0x4ffbf9=_0x26b1cb;if(_0x707d9[_0x35fc('0x9c')]){if(_0x707d9['List'][_0x35fc('0x9d')][_0x35fc('0x3e')]){return _0x707d9[_0x35fc('0x9c')]['Contacts'][0x0];}else{return db[_0x35fc('0x7c')]['create'](_[_0x35fc('0x9e')](_0x44c954['body'],{'firstName':_0x44c954[_0x35fc('0x53')]['to'],'email':_0x44c954[_0x35fc('0x53')]['to'],'phone':_0x44c954['body']['to'],'ListId':_0x707d9[_0x35fc('0x64')]}));}}else{throw new Error(_0x35fc('0x9f'));}}})['then'](function(_0x1aa496){if(_0x1aa496){var _0x102fc6={'UserId':_0x44c954[_0x35fc('0x69')]['id'],'ContactId':_0x1aa496['id'],'MailAccountId':_0x707d9['id'],'inReplyTo':_0x4ffbf9[_0x35fc('0xa0')],'to':_0x44c954[_0x35fc('0x53')][_0x35fc('0x92')],'cc':_0x44c954['body']['cc'],'subject':_0x44c954[_0x35fc('0x53')][_0x35fc('0xa1')],'attach':_0x44c954[_0x35fc('0x53')][_0x35fc('0xa2')],'firstMsgDirection':_0x35fc('0xa3'),'lastMsgAt':moment()['format'](_0x35fc('0x8e')),'lastMsgDirection':_0x35fc('0xa3'),'lastMsgBody':_0x44c954[_0x35fc('0x53')][_0x35fc('0x53')],'Messages':[_[_0x35fc('0x46')](_0x44c954[_0x35fc('0x53')],{'messageId':_0x4ffbf9[_0x35fc('0xa0')],'sentAt':moment()[_0x35fc('0x8d')](_0x35fc('0x8e')),'read':!![],'MailAccountId':_0x707d9['id'],'UserId':_0x44c954['user']['id'],'ContactId':_0x1aa496['id']})]};if(_0x44c954[_0x35fc('0x53')][_0x35fc('0xa4')]){_0x102fc6=_[_0x35fc('0x46')](_0x102fc6,_0x44c954['body'][_0x35fc('0xa4')]);}return db['MailInteraction'][_0x35fc('0x57')](_0x102fc6,{'include':[{'model':db[_0x35fc('0x8b')],'as':'Messages'}]});}})[_0x35fc('0x18')](respondWithResult(_0x371e7d,null))[_0x35fc('0x22')](handleError(_0x371e7d,null));};exports[_0x35fc('0xa5')]=function(_0x256958,_0x39faae,_0x14266f){return db[_0x35fc('0x36')]['find']({'where':{'id':_0x256958[_0x35fc('0x4d')]['id']},'include':[{'model':db[_0x35fc('0x4e')],'as':_0x35fc('0x35'),'raw':!![]}]})['then'](handleEntityNotFound(_0x39faae,null))['then'](function(_0x1c87bc){if(_0x1c87bc&&_0x1c87bc[_0x35fc('0x35')]){var _0x1fe94d={'id':_0x1c87bc['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1c87bc[_0x35fc('0x35')][_0x35fc('0x70')]){_0x1fe94d[_0x35fc('0x70')]=_0x1c87bc[_0x35fc('0x35')][_0x35fc('0x70')];}else{_0x1fe94d[_0x35fc('0x6e')]=_0x1c87bc[_0x35fc('0x35')][_0x35fc('0x6e')];_0x1fe94d[_0x35fc('0x6f')]=_0x1c87bc[_0x35fc('0x35')][_0x35fc('0x6f')];_0x1fe94d[_0x35fc('0x98')]=_0x1c87bc[_0x35fc('0x35')][_0x35fc('0x98')];}if(_0x1c87bc[_0x35fc('0x35')][_0x35fc('0x6d')]){_0x1fe94d['auth']={'user':_0x1c87bc[_0x35fc('0x35')]['user'],'pass':_0x1c87bc['Smtp'][_0x35fc('0x71')]};}return respondWithRpcPromise(_0x35fc('0xa6'),_0x35fc('0xa5'),{'account':_0x1fe94d});}})[_0x35fc('0x18')](respondWithResult(_0x39faae,null))[_0x35fc('0x22')](handleError(_0x39faae,null));};exports[_0x35fc('0x2e')]=function(_0x2c175a,_0x297b5f){return db[_0x35fc('0x36')][_0x35fc('0x52')]({'where':{'id':_0x2c175a[_0x35fc('0x4d')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x297b5f,null))[_0x35fc('0x18')](function(_0xbf7bf0){if(_0xbf7bf0&&_0xbf7bf0[_0x35fc('0x70')]){throw new db[(_0x35fc('0xa7'))][(_0x35fc('0xa8'))](_0x35fc('0xa9'));}return _0xbf7bf0;})[_0x35fc('0x18')](removeEntity(_0x297b5f,null))[_0x35fc('0x22')](handleError(_0x297b5f,null));};exports['addAgents']=function(_0x3084cf,_0x189550,_0x24f1a6){return db['MailAccount'][_0x35fc('0x52')]({'where':{'id':_0x3084cf[_0x35fc('0x4d')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x189550,null))['then'](function(_0x103046){if(_0x103046){return _0x103046[_0x35fc('0xaa')](_0x3084cf[_0x35fc('0x53')]['ids'],_[_0x35fc('0x7b')](_0x3084cf[_0x35fc('0x53')],['ids','id'])||{})[_0x35fc('0xab')](function(_0x1d8ab4){for(var _0x70cffd=0x0;_0x70cffd<_0x3084cf[_0x35fc('0x53')]['ids']['length'];_0x70cffd+=0x1){socket['emit'](_0x35fc('0xac'),{'UserId':_0x3084cf[_0x35fc('0x53')]['ids'][_0x70cffd],'MailAccountId':_0x3084cf[_0x35fc('0x4d')]['id']});}return _0x1d8ab4;});}})[_0x35fc('0x18')](respondWithResult(_0x189550,null))[_0x35fc('0x22')](handleError(_0x189550,null));};exports[_0x35fc('0xad')]=function(_0x2b71a5,_0x49c6e2,_0x1e1033){var _0x34cd16;return db['MailAccount'][_0x35fc('0x52')]({'where':{'id':_0x2b71a5[_0x35fc('0x4d')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x49c6e2,null))[_0x35fc('0x18')](function(_0x2848cd){if(_0x2848cd){return _0x2848cd[_0x35fc('0xad')](_0x2b71a5[_0x35fc('0x38')][_0x35fc('0x5d')])['then'](function(_0x2f29c3){if(_['isArray'](_0x2b71a5[_0x35fc('0x38')][_0x35fc('0x5d')])){for(var _0x2df283=0x0;_0x2df283<_0x2b71a5[_0x35fc('0x38')][_0x35fc('0x5d')][_0x35fc('0x3e')];_0x2df283+=0x1){socket['emit']('userMailAccount:remove',{'UserId':_0x2b71a5['query'][_0x35fc('0x5d')][_0x2df283],'MailAccountId':_0x2b71a5[_0x35fc('0x4d')]['id']});}}else{socket[_0x35fc('0xae')]('userMailAccount:remove',{'UserId':_0x2b71a5[_0x35fc('0x38')][_0x35fc('0x5d')],'MailAccountId':_0x2b71a5[_0x35fc('0x4d')]['id']});}});}})[_0x35fc('0x18')](respondWithStatusCode(_0x49c6e2,null))[_0x35fc('0x22')](handleError(_0x49c6e2,null));};exports[_0x35fc('0xaf')]=function(_0x43f039,_0x16f57f,_0x46f22d){var _0xb12d79={};var _0x2cf4ce={};var _0x5c9053;var _0x26c196;return db[_0x35fc('0x36')]['findOne']({'where':{'id':_0x43f039[_0x35fc('0x4d')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x16f57f,null))['then'](function(_0x528847){if(_0x528847){_0x5c9053=_0x528847;_0x2cf4ce[_0x35fc('0x37')]=_[_0x35fc('0x4f')](db[_0x35fc('0x7e')][_0x35fc('0x50')]);_0x2cf4ce[_0x35fc('0x38')]=_[_0x35fc('0x4f')](_0x43f039[_0x35fc('0x38')]);_0x2cf4ce[_0x35fc('0x3a')]=_['intersection'](_0x2cf4ce[_0x35fc('0x37')],_0x2cf4ce[_0x35fc('0x38')]);_0xb12d79[_0x35fc('0x3c')]=_['intersection'](_0x2cf4ce[_0x35fc('0x37')],qs['fields'](_0x43f039[_0x35fc('0x38')][_0x35fc('0x3d')]));_0xb12d79[_0x35fc('0x3c')]=_0xb12d79[_0x35fc('0x3c')][_0x35fc('0x3e')]?_0xb12d79['attributes']:_0x2cf4ce[_0x35fc('0x37')];_0xb12d79['order']=qs['sort'](_0x43f039[_0x35fc('0x38')][_0x35fc('0x42')]);_0xb12d79[_0x35fc('0x43')]=qs['filters'](_[_0x35fc('0x5a')](_0x43f039[_0x35fc('0x38')],_0x2cf4ce[_0x35fc('0x3a')]));if(_0x43f039[_0x35fc('0x38')][_0x35fc('0x48')]){_0xb12d79[_0x35fc('0x43')]=_[_0x35fc('0x46')](_0xb12d79['where'],{'$or':_['map'](_0xb12d79[_0x35fc('0x3c')],function(_0x198ed0){var _0x4bbd26={};_0x4bbd26[_0x198ed0]={'$like':'%'+_0x43f039[_0x35fc('0x38')]['filter']+'%'};return _0x4bbd26;})});}_0xb12d79=_[_0x35fc('0x46')]({},_0xb12d79,_0x43f039[_0x35fc('0x51')]);return _0x5c9053[_0x35fc('0xaf')](_0xb12d79);}})[_0x35fc('0x18')](function(_0x5895fd){if(_0x5895fd){_0x26c196=_0x5895fd[_0x35fc('0x3e')];if(!_0x43f039['query'][_0x35fc('0x59')](_0x35fc('0x3f'))){_0xb12d79[_0x35fc('0x27')]=qs['limit'](_0x43f039[_0x35fc('0x38')][_0x35fc('0x27')]);_0xb12d79[_0x35fc('0x40')]=qs[_0x35fc('0x40')](_0x43f039[_0x35fc('0x38')][_0x35fc('0x40')]);}return _0x5c9053['getAgents'](_0xb12d79);}})[_0x35fc('0x18')](function(_0x109c0c){if(_0x109c0c){return _0x109c0c?{'count':_0x26c196,'rows':_0x109c0c}:null;}})['then'](respondWithResult(_0x16f57f,null))[_0x35fc('0x22')](handleError(_0x16f57f,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 7db6306..78a5204 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 _0xfe49=['hasOwnProperty','exports','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x211087,_0x354fdd){var _0x2a581f=function(_0x2928fe){while(--_0x2928fe){_0x211087['push'](_0x211087['shift']());}};_0x2a581f(++_0x354fdd);}(_0xfe49,0x1e5));var _0x9fe4=function(_0x22b570,_0x583648){_0x22b570=_0x22b570-0x0;var _0x4739a4=_0xfe49[_0x22b570];return _0x4739a4;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x9fe4('0x0'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x9fe4('0x1')](0x0);var events={'afterCreate':_0x9fe4('0x2'),'afterUpdate':_0x9fe4('0x3'),'afterDestroy':_0x9fe4('0x4')};function emitEvent(_0x481bd6){return function(_0x3f8f9a,_0x22e534,_0x1c58b9){MailAccountEvents['emit'](_0x481bd6+':'+_0x3f8f9a['id'],_0x3f8f9a);MailAccountEvents['emit'](_0x481bd6,_0x3f8f9a);_0x1c58b9(null);};}for(var e in events){if(events[_0x9fe4('0x5')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x9fe4('0x6')]=MailAccountEvents; \ No newline at end of file +var _0xa59e=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailAccount','save'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa59e,0x17c));var _0xea59=function(_0x48ba4e,_0x1daf49){_0x48ba4e=_0x48ba4e-0x0;var _0x480d58=_0xa59e[_0x48ba4e];return _0x480d58;};'use strict';var EventEmitter=require(_0xea59('0x0'));var MailAccount=require(_0xea59('0x1'))['db'][_0xea59('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xea59('0x3'),'afterUpdate':'update','afterDestroy':_0xea59('0x4')};function emitEvent(_0x551123){return function(_0x185066,_0x29f618,_0x51cfa8){MailAccountEvents[_0xea59('0x5')](_0x551123+':'+_0x185066['id'],_0x185066);MailAccountEvents[_0xea59('0x5')](_0x551123,_0x185066);_0x51cfa8(null);};}for(var e in events){if(events[_0xea59('0x6')](e)){var event=events[e];MailAccount[_0xea59('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 7d3b46e..a12eae2 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 _0x85f1=['../../config/logger','bluebird','request-promise','define','mail_accounts','lodash'];(function(_0x2174d7,_0x32bc09){var _0x1d82c1=function(_0x1a80ea){while(--_0x1a80ea){_0x2174d7['push'](_0x2174d7['shift']());}};_0x1d82c1(++_0x32bc09);}(_0x85f1,0x107));var _0x185f=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x85f1[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x185f('0x0'));var util=require('util');var logger=require(_0x185f('0x1'))('api');var moment=require('moment');var BPromise=require(_0x185f('0x2'));var rp=require(_0x185f('0x3'));var attributes=require('./mailAccount.attributes');module['exports']=function(_0x35c3ac,_0x267ddc){return _0x35c3ac[_0x185f('0x4')]('MailAccount',attributes,{'tableName':_0x185f('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe889=['util','../../config/logger','api','moment','bluebird','request-promise','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash'];(function(_0x4fae29,_0x5a1251){var _0x1bbcd1=function(_0x3566c0){while(--_0x3566c0){_0x4fae29['push'](_0x4fae29['shift']());}};_0x1bbcd1(++_0x5a1251);}(_0xe889,0x107));var _0x9e88=function(_0x58d86a,_0x1cfd27){_0x58d86a=_0x58d86a-0x0;var _0x247207=_0xe889[_0x58d86a];return _0x247207;};'use strict';var _=require(_0x9e88('0x0'));var util=require(_0x9e88('0x1'));var logger=require(_0x9e88('0x2'))(_0x9e88('0x3'));var moment=require(_0x9e88('0x4'));var BPromise=require(_0x9e88('0x5'));var rp=require(_0x9e88('0x6'));var attributes=require(_0x9e88('0x7'));module[_0x9e88('0x8')]=function(_0x1f2359,_0x53bdc6){return _0x1f2359[_0x9e88('0x9')](_0x9e88('0xa'),attributes,{'tableName':_0x9e88('0xb'),'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 f651d5c..8894948 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 _0x2726=['info','catch','ShowMailAccount','raw','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','ListId','body','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','from','account','CmList','List','Contacts','updatedAt','DESC','Applications','MailServerOut','get','omit','list','applications','orderBy','asc','autoclose','push','length','close','*,*,*,*','defaults','List\x20not\x20found','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','find','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','spread','update','created','attachments','originCc','bcc','Attachment','Attachments','name','interaction','UserId','unshift','startRouting','Start','lodash','util','bluebird','randomstring','rpc','jayson/promise','client','http','socket.io-emitter','localhost','./mailAccount.socket','register','request','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','MailAccount,\x20%s,\x20%s','message','result','GetMailAccount','MailAccount','findAll','options','where','attributes','map','include','model'];(function(_0x1e1158,_0x233f4b){var _0x138526=function(_0x339bcf){while(--_0x339bcf){_0x1e1158['push'](_0x1e1158['shift']());}};_0x138526(++_0x233f4b);}(_0x2726,0x1d0));var _0x6272=function(_0x2118ad,_0xe8e3fd){_0x2118ad=_0x2118ad-0x0;var _0x4b5715=_0x2726[_0x2118ad];return _0x4b5715;};'use strict';var _=require(_0x6272('0x0'));var util=require(_0x6272('0x1'));var moment=require('moment');var BPromise=require(_0x6272('0x2'));var rs=require(_0x6272('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6272('0x4'));var config=require('../../config/environment');var jayson=require(_0x6272('0x5'));var client=jayson[_0x6272('0x6')][_0x6272('0x7')]({'port':0x232c});var socket=require(_0x6272('0x8'))({'host':_0x6272('0x9'),'port':0x18eb});require(_0x6272('0xa'))[_0x6272('0xb')](socket);function respondWithRpcPromise(_0x4e686e,_0x474731,_0x54849e){return new BPromise(function(_0x17dc82,_0x10e5c7){return client[_0x6272('0xc')](_0x4e686e,_0x54849e)[_0x6272('0xd')](function(_0x408267){logger['info']('MailAccount,\x20%s,\x20%s',_0x474731,_0x6272('0xe'));logger[_0x6272('0xf')](_0x6272('0x10'),_0x474731,_0x6272('0xe'),JSON[_0x6272('0x11')](_0x408267));if(_0x408267[_0x6272('0x12')]){if(_0x408267['error']['code']===0x1f4){logger[_0x6272('0x12')](_0x6272('0x13'),_0x474731,_0x408267[_0x6272('0x12')][_0x6272('0x14')]);return _0x10e5c7(_0x408267[_0x6272('0x12')]['message']);}logger[_0x6272('0x12')](_0x6272('0x13'),_0x474731,_0x408267[_0x6272('0x12')][_0x6272('0x14')]);return _0x17dc82(_0x408267['error'][_0x6272('0x14')]);}else{logger['info'](_0x6272('0x13'),_0x474731,_0x6272('0xe'));_0x17dc82(_0x408267[_0x6272('0x15')][_0x6272('0x14')]);}})['catch'](function(_0x6f209e){logger[_0x6272('0x12')](_0x6272('0x13'),_0x474731,_0x6f209e);_0x10e5c7(_0x6f209e);});});}exports[_0x6272('0x16')]=function(_0x297ee0){var _0x2731e7=this;return new Promise(function(_0x41e5b6,_0x21a862){return db[_0x6272('0x17')][_0x6272('0x18')]({'raw':_0x297ee0[_0x6272('0x19')]?_0x297ee0[_0x6272('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x297ee0[_0x6272('0x19')]?_0x297ee0[_0x6272('0x19')][_0x6272('0x1a')]||null:null,'attributes':_0x297ee0[_0x6272('0x19')]?_0x297ee0['options'][_0x6272('0x1b')]||null:null,'limit':_0x297ee0[_0x6272('0x19')]?_0x297ee0[_0x6272('0x19')]['limit']||null:null,'include':_0x297ee0['options']?_0x297ee0[_0x6272('0x19')]['include']?_[_0x6272('0x1c')](_0x297ee0[_0x6272('0x19')][_0x6272('0x1d')],function(_0xcac3ba){return{'model':db[_0xcac3ba['model']],'as':_0xcac3ba['as'],'attributes':_0xcac3ba[_0x6272('0x1b')],'include':_0xcac3ba[_0x6272('0x1d')]?_['map'](_0xcac3ba['include'],function(_0x25f545){return{'model':db[_0x25f545['model']],'as':_0x25f545['as'],'attributes':_0x25f545[_0x6272('0x1b')],'include':_0x25f545[_0x6272('0x1d')]?_['map'](_0x25f545[_0x6272('0x1d')],function(_0x3652ce){return{'model':db[_0x3652ce[_0x6272('0x1e')]],'as':_0x3652ce['as'],'attributes':_0x3652ce['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1faf44){logger[_0x6272('0x1f')](_0x6272('0x16'),_0x297ee0);logger[_0x6272('0xf')](_0x6272('0x16'),_0x297ee0,JSON[_0x6272('0x11')](_0x1faf44));_0x41e5b6(_0x1faf44);})[_0x6272('0x20')](function(_0x3204e1){logger[_0x6272('0x12')](_0x6272('0x16'),_0x3204e1['message'],_0x297ee0);_0x21a862(_0x2731e7[_0x6272('0x12')](0x1f4,_0x3204e1[_0x6272('0x14')]));});});};exports[_0x6272('0x21')]=function(_0x4723da){var _0x4b6718=this;return new Promise(function(_0x14beac,_0xb4ee0e){return db[_0x6272('0x17')]['find']({'raw':_0x4723da[_0x6272('0x19')]?_0x4723da['options'][_0x6272('0x22')]===undefined?!![]:![]:!![],'where':_0x4723da[_0x6272('0x19')]?_0x4723da[_0x6272('0x19')][_0x6272('0x1a')]||null:null,'attributes':_0x4723da['options']?_0x4723da[_0x6272('0x19')][_0x6272('0x1b')]||null:null,'include':_0x4723da['options']?_0x4723da[_0x6272('0x19')]['include']?_[_0x6272('0x1c')](_0x4723da[_0x6272('0x19')][_0x6272('0x1d')],function(_0x3f5917){return{'model':db[_0x3f5917[_0x6272('0x1e')]],'as':_0x3f5917['as'],'attributes':_0x3f5917['attributes'],'include':_0x3f5917[_0x6272('0x1d')]?_[_0x6272('0x1c')](_0x3f5917[_0x6272('0x1d')],function(_0x1d7f5c){return{'model':db[_0x1d7f5c['model']],'as':_0x1d7f5c['as'],'attributes':_0x1d7f5c[_0x6272('0x1b')],'include':_0x1d7f5c[_0x6272('0x1d')]?_['map'](_0x1d7f5c[_0x6272('0x1d')],function(_0x5b3911){return{'model':db[_0x5b3911[_0x6272('0x1e')]],'as':_0x5b3911['as'],'attributes':_0x5b3911[_0x6272('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6272('0xd')](function(_0x163f19){logger[_0x6272('0x1f')](_0x6272('0x21'),_0x4723da);logger[_0x6272('0xf')](_0x6272('0x21'),_0x4723da,JSON[_0x6272('0x11')](_0x163f19));_0x14beac(_0x163f19);})[_0x6272('0x20')](function(_0x11a2b3){logger[_0x6272('0x12')](_0x6272('0x21'),_0x11a2b3['message'],_0x4723da);_0xb4ee0e(_0x4b6718['error'](0x1f4,_0x11a2b3[_0x6272('0x14')]));});});};exports[_0x6272('0x23')]=function(_0x27bbea){var _0x345f2e=this;return new Promise(function(_0x45c2b9,_0x578069){var _0x327acb={'body':_0x27bbea['body'],'channel':_0x6272('0x24')};var _0x15c143=_[_0x6272('0x25')](_[_0x6272('0x26')](db[_0x6272('0x27')][_0x6272('0x28')]),[_0x6272('0x29'),'updatedAt','CompanyId',_0x6272('0x2a')]);var _0x4c8075=![];if(_0x27bbea[_0x6272('0x2b')]['id']){delete _0x27bbea[_0x6272('0x2b')]['id'];}if(_[_0x6272('0x2c')](_0x27bbea[_0x6272('0x2b')]['from'])){return _0x578069(_0x345f2e[_0x6272('0x12')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x6272('0x2c')](_0x27bbea[_0x6272('0x2b')][_0x6272('0x2b')])||_0x27bbea[_0x6272('0x2b')]['body']===''){return _0x578069(_0x345f2e[_0x6272('0x12')](0x1f4,_0x6272('0x2d')));}if(_[_0x6272('0x2c')](_0x27bbea[_0x6272('0x2b')][_0x6272('0x2e')])){return _0x578069(_0x345f2e[_0x6272('0x12')](0x1f4,_0x6272('0x2f')+_0x15c143));}if(!_[_0x6272('0x30')](_0x15c143,_0x27bbea[_0x6272('0x2b')][_0x6272('0x2e')])){return _0x578069(_0x345f2e[_0x6272('0x12')](0x1f4,_0x6272('0x31')+_0x15c143));}var _0x4104e5={};_0x4104e5[_0x27bbea['body']['mapKey']]=_0x27bbea[_0x6272('0x2b')][_0x6272('0x32')];return db[_0x6272('0x17')]['find']({'where':{'id':_0x27bbea[_0x6272('0x33')]['id']},'include':[{'model':db[_0x6272('0x34')],'as':_0x6272('0x35'),'include':[{'model':db[_0x6272('0x27')],'as':_0x6272('0x36'),'where':_0x4104e5,'limit':0x1,'order':[[_0x6272('0x37'),_0x6272('0x38')]]}]},{'model':db['MailApplication'],'as':_0x6272('0x39')},{'model':db[_0x6272('0x3a')],'as':'Smtp'}]})[_0x6272('0xd')](function(_0x5420e4){if(_0x5420e4&&_0x5420e4[_0x6272('0x35')]){var _0x273c07=_0x5420e4[_0x6272('0x3b')]({'plain':!![]});_0x327acb['account']=_[_0x6272('0x3c')](_0x273c07,[_0x6272('0x39'),_0x6272('0x35')]);_0x327acb['applications']=_0x273c07['Applications'];_0x327acb[_0x6272('0x3d')]=_0x273c07[_0x6272('0x35')];_0x327acb[_0x6272('0x3e')]=_[_0x6272('0x3f')](_0x327acb[_0x6272('0x3e')],['priority'],[_0x6272('0x40')]);if(_0x327acb[_0x6272('0x33')]&&_0x327acb[_0x6272('0x33')][_0x6272('0x41')]){_0x327acb[_0x6272('0x3e')][_0x6272('0x42')]({'id':0x0,'priority':_0x327acb[_0x6272('0x3e')][_0x6272('0x43')]+0x1,'app':_0x6272('0x44'),'appdata':_0x6272('0x41'),'interval':_0x6272('0x45')});}if(_0x327acb[_0x6272('0x33')][_0x6272('0x39')]){delete _0x327acb[_0x6272('0x33')][_0x6272('0x39')];}if(_0x327acb[_0x6272('0x33')]['List']){delete _0x327acb[_0x6272('0x33')][_0x6272('0x35')];}if(_0x273c07[_0x6272('0x35')][_0x6272('0x36')][_0x6272('0x43')]){return _0x273c07[_0x6272('0x35')][_0x6272('0x36')][0x0];}var _0x39b236=_[_0x6272('0x46')](_0x27bbea[_0x6272('0x2b')],{'firstName':_0x27bbea[_0x6272('0x2b')]['from'],'ListId':_0x273c07[_0x6272('0x2a')]});_0x39b236[_0x27bbea[_0x6272('0x2b')][_0x6272('0x2e')]]=_0x27bbea[_0x6272('0x2b')][_0x6272('0x32')];return db['CmContact']['create'](_0x39b236);}else{throw new Error(_0x6272('0x47'));}})['then'](function(_0x4648a7){_0x327acb[_0x6272('0x48')]=_0x4648a7;if(_0x4648a7){if(!_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')][_0x6272('0x49')]){_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')][_0x6272('0x49')]=rs['generate']()+'\x20'+_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')][_0x6272('0x32')];}var _0x1772a0={'ContactId':_0x4648a7['id'],'MailAccountId':_0x27bbea[_0x6272('0x33')]['id'],'inReplyTo':_0x27bbea[_0x6272('0x2b')]['message'][_0x6272('0x49')],'to':_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')]['from'],'cc':_0x27bbea['body'][_0x6272('0x14')]['cc'],'subject':_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')][_0x6272('0x4a')],'attach':_0x27bbea[_0x6272('0x2b')]['message'][_0x6272('0x4b')],'lastMsgAt':moment()[_0x6272('0x4c')](_0x6272('0x4d')),'lastMsgDirection':'in','lastMsgBody':_0x27bbea[_0x6272('0x2b')][_0x6272('0x2b')]};return db[_0x6272('0x4e')][_0x6272('0x4f')]({'where':{'closed':![],'MailAccountId':_0x27bbea[_0x6272('0x33')]['id']},'include':[{'model':db[_0x6272('0x50')],'as':_0x6272('0x51'),'attributes':[_0x6272('0x49')],'where':{'messageId':_0x27bbea['body'][_0x6272('0x14')][_0x6272('0x52')]}}]})[_0x6272('0xd')](function(_0x67488d){if(_0x67488d){return[_0x67488d,![]];}return db[_0x6272('0x4e')][_0x6272('0x53')](_0x1772a0)['then'](function(_0x3d350d){return[_0x3d350d,!![]];});});}else{throw new Error(_0x6272('0x54'));}})[_0x6272('0x55')](function(_0xbace65,_0x476ed6){if(_0xbace65){_0x4c8075=_0x476ed6;if(!_0x476ed6){return _0xbace65[_0x6272('0x56')]({'inReplyTo':_0x27bbea[_0x6272('0x2b')]['message'][_0x6272('0x49')],'to':_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')]['from'],'cc':_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')]['cc'],'subject':_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')][_0x6272('0x4a')],'attach':_0xbace65[_0x6272('0x4b')]?_0xbace65['attach']:_0x27bbea[_0x6272('0x2b')]['message'][_0x6272('0x4b')],'substatus':null,'substatusAt':moment()[_0x6272('0x4c')](_0x6272('0x4d')),'lastMsgAt':moment()['format'](_0x6272('0x4d')),'lastMsgDirection':'in','lastMsgBody':_0x27bbea[_0x6272('0x2b')]['body']});}else{return _0xbace65;}}})['then'](function(_0x253435){_0x327acb['interaction']=_0x253435[_0x6272('0x3b')]({'plain':!![]});_0x327acb['interaction'][_0x6272('0x57')]=_0x4c8075;return db[_0x6272('0x50')][_0x6272('0x53')]({'body':_0x27bbea['body']['body'],'MailAccountId':_0x27bbea['account']['id'],'MailInteractionId':_0x253435['id'],'direction':'in','ContactId':_0x327acb['contact']['id'],'messageId':_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')][_0x6272('0x49')],'from':_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')]['from'],'to':_0x27bbea['body'][_0x6272('0x14')]['to'],'cc':_0x27bbea[_0x6272('0x2b')]['message']['cc'],'subject':_0x27bbea[_0x6272('0x2b')]['message'][_0x6272('0x4a')],'attach':_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')]['attach'],'Attachments':_0x27bbea[_0x6272('0x2b')]['message'][_0x6272('0x58')],'originTo':_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')]['originTo'],'originCc':_0x27bbea['body'][_0x6272('0x14')][_0x6272('0x59')],'bcc':_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')][_0x6272('0x5a')]},{'include':[{'model':db[_0x6272('0x5b')],'as':_0x6272('0x5c')}]});})[_0x6272('0xd')](function(_0x26ee6d){_0x327acb['message']=_0x26ee6d;if(_0x327acb['interaction']['UserId']){return db['User'][_0x6272('0x4f')]({'attributes':['id',_0x6272('0x5d')],'where':{'id':_0x327acb[_0x6272('0x5e')][_0x6272('0x5f')]}})[_0x6272('0xd')](function(_0x57efeb){if(_0x57efeb){_0x327acb['applications'][_0x6272('0x60')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x57efeb[_0x6272('0x5d')]+','+(_0x327acb[_0x6272('0x33')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x6272('0x61'),_0x327acb);});}return respondWithRpcPromise(_0x6272('0x62'),'startRouting',_0x327acb);})['then'](function(_0x3ca624){_0x45c2b9(_0x3ca624);})[_0x6272('0x20')](function(_0x6f300e){_0x578069(_0x345f2e[_0x6272('0x12')](0x1f4,_0x6f300e[_0x6272('0x14')]));});});}; \ No newline at end of file +var _0xa538=['NotifyMailAccount','mail','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','body','from','isNil','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','CmContact','Applications','MailServerOut','Smtp','omit','applications','orderBy','priority','asc','autoclose','push','length','Contacts','create','contact','messageId','generate','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','spread','update','subject','attach','interaction','created','MailMessage','attachments','originCc','bcc','Attachment','User','UserId','unshift','name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','socket.io-emitter','localhost','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','limit','include','model','attributes','map','ShowMailAccount','find','where'];(function(_0x49e52e,_0x15f616){var _0x36a6e6=function(_0x2f7be2){while(--_0x2f7be2){_0x49e52e['push'](_0x49e52e['shift']());}};_0x36a6e6(++_0x15f616);}(_0xa538,0xfd));var _0x8a53=function(_0x3acfe9,_0x475799){_0x3acfe9=_0x3acfe9-0x0;var _0x55e76a=_0xa538[_0x3acfe9];return _0x55e76a;};'use strict';var _=require(_0x8a53('0x0'));var util=require(_0x8a53('0x1'));var moment=require(_0x8a53('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0x8a53('0x3'))['db'];var utils=require(_0x8a53('0x4'));var logger=require(_0x8a53('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8a53('0x6'));var client=jayson[_0x8a53('0x7')][_0x8a53('0x8')]({'port':0x232c});var socket=require(_0x8a53('0x9'))({'host':_0x8a53('0xa'),'port':0x18eb});require(_0x8a53('0xb'))[_0x8a53('0xc')](socket);function respondWithRpcPromise(_0x3bcc2c,_0x4f1381,_0x2e6fc5){return new BPromise(function(_0x51a9bd,_0x1f3d2a){return client[_0x8a53('0xd')](_0x3bcc2c,_0x2e6fc5)[_0x8a53('0xe')](function(_0x4b230d){logger[_0x8a53('0xf')](_0x8a53('0x10'),_0x4f1381,_0x8a53('0x11'));logger[_0x8a53('0x12')](_0x8a53('0x13'),_0x4f1381,_0x8a53('0x11'),JSON[_0x8a53('0x14')](_0x4b230d));if(_0x4b230d[_0x8a53('0x15')]){if(_0x4b230d[_0x8a53('0x15')][_0x8a53('0x16')]===0x1f4){logger[_0x8a53('0x15')](_0x8a53('0x10'),_0x4f1381,_0x4b230d[_0x8a53('0x15')][_0x8a53('0x17')]);return _0x1f3d2a(_0x4b230d[_0x8a53('0x15')]['message']);}logger['error']('MailAccount,\x20%s,\x20%s',_0x4f1381,_0x4b230d['error']['message']);return _0x51a9bd(_0x4b230d['error']['message']);}else{logger[_0x8a53('0xf')]('MailAccount,\x20%s,\x20%s',_0x4f1381,_0x8a53('0x11'));_0x51a9bd(_0x4b230d[_0x8a53('0x18')][_0x8a53('0x17')]);}})[_0x8a53('0x19')](function(_0x359048){logger['error'](_0x8a53('0x10'),_0x4f1381,_0x359048);_0x1f3d2a(_0x359048);});});}exports[_0x8a53('0x1a')]=function(_0x2b514d){var _0x2c5a00=this;return new Promise(function(_0x42f945,_0x1c55f4){return db[_0x8a53('0x1b')][_0x8a53('0x1c')]({'raw':_0x2b514d[_0x8a53('0x1d')]?_0x2b514d[_0x8a53('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2b514d['options']?_0x2b514d[_0x8a53('0x1d')]['where']||null:null,'attributes':_0x2b514d[_0x8a53('0x1d')]?_0x2b514d[_0x8a53('0x1d')]['attributes']||null:null,'limit':_0x2b514d[_0x8a53('0x1d')]?_0x2b514d[_0x8a53('0x1d')][_0x8a53('0x1e')]||null:null,'include':_0x2b514d[_0x8a53('0x1d')]?_0x2b514d[_0x8a53('0x1d')]['include']?_['map'](_0x2b514d[_0x8a53('0x1d')][_0x8a53('0x1f')],function(_0x1bc32a){return{'model':db[_0x1bc32a[_0x8a53('0x20')]],'as':_0x1bc32a['as'],'attributes':_0x1bc32a['attributes'],'include':_0x1bc32a[_0x8a53('0x1f')]?_['map'](_0x1bc32a['include'],function(_0x35e566){return{'model':db[_0x35e566[_0x8a53('0x20')]],'as':_0x35e566['as'],'attributes':_0x35e566[_0x8a53('0x21')],'include':_0x35e566['include']?_[_0x8a53('0x22')](_0x35e566[_0x8a53('0x1f')],function(_0x4749b){return{'model':db[_0x4749b[_0x8a53('0x20')]],'as':_0x4749b['as'],'attributes':_0x4749b[_0x8a53('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8a53('0xe')](function(_0x4c2e8c){logger[_0x8a53('0xf')](_0x8a53('0x1a'),_0x2b514d);logger[_0x8a53('0x12')](_0x8a53('0x1a'),_0x2b514d,JSON[_0x8a53('0x14')](_0x4c2e8c));_0x42f945(_0x4c2e8c);})[_0x8a53('0x19')](function(_0x83edaf){logger[_0x8a53('0x15')](_0x8a53('0x1a'),_0x83edaf[_0x8a53('0x17')],_0x2b514d);_0x1c55f4(_0x2c5a00[_0x8a53('0x15')](0x1f4,_0x83edaf[_0x8a53('0x17')]));});});};exports[_0x8a53('0x23')]=function(_0xdf18e7){var _0x148cd2=this;return new Promise(function(_0x910dac,_0x4c19f7){return db[_0x8a53('0x1b')][_0x8a53('0x24')]({'raw':_0xdf18e7[_0x8a53('0x1d')]?_0xdf18e7['options']['raw']===undefined?!![]:![]:!![],'where':_0xdf18e7[_0x8a53('0x1d')]?_0xdf18e7[_0x8a53('0x1d')][_0x8a53('0x25')]||null:null,'attributes':_0xdf18e7[_0x8a53('0x1d')]?_0xdf18e7[_0x8a53('0x1d')][_0x8a53('0x21')]||null:null,'include':_0xdf18e7['options']?_0xdf18e7[_0x8a53('0x1d')][_0x8a53('0x1f')]?_[_0x8a53('0x22')](_0xdf18e7[_0x8a53('0x1d')][_0x8a53('0x1f')],function(_0x15ed5d){return{'model':db[_0x15ed5d[_0x8a53('0x20')]],'as':_0x15ed5d['as'],'attributes':_0x15ed5d[_0x8a53('0x21')],'include':_0x15ed5d[_0x8a53('0x1f')]?_['map'](_0x15ed5d[_0x8a53('0x1f')],function(_0x103344){return{'model':db[_0x103344['model']],'as':_0x103344['as'],'attributes':_0x103344[_0x8a53('0x21')],'include':_0x103344[_0x8a53('0x1f')]?_[_0x8a53('0x22')](_0x103344[_0x8a53('0x1f')],function(_0x983901){return{'model':db[_0x983901['model']],'as':_0x983901['as'],'attributes':_0x983901['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a53('0xe')](function(_0x1cdfd4){logger['info']('ShowMailAccount',_0xdf18e7);logger['debug'](_0x8a53('0x23'),_0xdf18e7,JSON[_0x8a53('0x14')](_0x1cdfd4));_0x910dac(_0x1cdfd4);})['catch'](function(_0x2f8611){logger['error'](_0x8a53('0x23'),_0x2f8611[_0x8a53('0x17')],_0xdf18e7);_0x4c19f7(_0x148cd2[_0x8a53('0x15')](0x1f4,_0x2f8611[_0x8a53('0x17')]));});});};exports[_0x8a53('0x26')]=function(_0x14c2cd){var _0x1fd487=this;return new Promise(function(_0x712686,_0x341bce){var _0x543767={'body':_0x14c2cd['body'],'channel':_0x8a53('0x27')};var _0x16b242=_[_0x8a53('0x28')](_[_0x8a53('0x29')](db['CmContact'][_0x8a53('0x2a')]),[_0x8a53('0x2b'),_0x8a53('0x2c'),_0x8a53('0x2d'),_0x8a53('0x2e')]);var _0x478d72=![];if(_0x14c2cd[_0x8a53('0x2f')]['id']){delete _0x14c2cd['body']['id'];}if(_['isNil'](_0x14c2cd['body'][_0x8a53('0x30')])){return _0x341bce(_0x1fd487[_0x8a53('0x15')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x8a53('0x31')](_0x14c2cd[_0x8a53('0x2f')][_0x8a53('0x2f')])||_0x14c2cd[_0x8a53('0x2f')][_0x8a53('0x2f')]===''){return _0x341bce(_0x1fd487[_0x8a53('0x15')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x8a53('0x31')](_0x14c2cd[_0x8a53('0x2f')]['mapKey'])){return _0x341bce(_0x1fd487['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x16b242));}if(!_[_0x8a53('0x32')](_0x16b242,_0x14c2cd[_0x8a53('0x2f')][_0x8a53('0x33')])){return _0x341bce(_0x1fd487['error'](0x1f4,_0x8a53('0x34')+_0x16b242));}var _0x4d3e2b={};_0x4d3e2b[_0x14c2cd['body'][_0x8a53('0x33')]]=_0x14c2cd[_0x8a53('0x2f')][_0x8a53('0x30')];return db[_0x8a53('0x1b')][_0x8a53('0x24')]({'where':{'id':_0x14c2cd[_0x8a53('0x35')]['id']},'include':[{'model':db[_0x8a53('0x36')],'as':_0x8a53('0x37'),'include':[{'model':db[_0x8a53('0x38')],'as':'Contacts','where':_0x4d3e2b,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['MailApplication'],'as':_0x8a53('0x39')},{'model':db[_0x8a53('0x3a')],'as':_0x8a53('0x3b')}]})['then'](function(_0x3ea714){if(_0x3ea714&&_0x3ea714[_0x8a53('0x37')]){var _0x62f5bf=_0x3ea714['get']({'plain':!![]});_0x543767[_0x8a53('0x35')]=_[_0x8a53('0x3c')](_0x62f5bf,[_0x8a53('0x39'),_0x8a53('0x37')]);_0x543767[_0x8a53('0x3d')]=_0x62f5bf['Applications'];_0x543767['list']=_0x62f5bf['List'];_0x543767['applications']=_[_0x8a53('0x3e')](_0x543767[_0x8a53('0x3d')],[_0x8a53('0x3f')],[_0x8a53('0x40')]);if(_0x543767['account']&&_0x543767[_0x8a53('0x35')][_0x8a53('0x41')]){_0x543767[_0x8a53('0x3d')][_0x8a53('0x42')]({'id':0x0,'priority':_0x543767[_0x8a53('0x3d')][_0x8a53('0x43')]+0x1,'app':'close','appdata':'autoclose','interval':'*,*,*,*'});}if(_0x543767[_0x8a53('0x35')][_0x8a53('0x39')]){delete _0x543767[_0x8a53('0x35')][_0x8a53('0x39')];}if(_0x543767[_0x8a53('0x35')][_0x8a53('0x37')]){delete _0x543767['account'][_0x8a53('0x37')];}if(_0x62f5bf[_0x8a53('0x37')][_0x8a53('0x44')][_0x8a53('0x43')]){return _0x62f5bf[_0x8a53('0x37')][_0x8a53('0x44')][0x0];}var _0x3cb434=_['defaults'](_0x14c2cd['body'],{'firstName':_0x14c2cd[_0x8a53('0x2f')][_0x8a53('0x30')],'ListId':_0x62f5bf[_0x8a53('0x2e')]});_0x3cb434[_0x14c2cd['body']['mapKey']]=_0x14c2cd[_0x8a53('0x2f')]['from'];return db[_0x8a53('0x38')][_0x8a53('0x45')](_0x3cb434);}else{throw new Error('List\x20not\x20found');}})[_0x8a53('0xe')](function(_0x20763b){_0x543767[_0x8a53('0x46')]=_0x20763b;if(_0x20763b){if(!_0x14c2cd[_0x8a53('0x2f')][_0x8a53('0x17')][_0x8a53('0x47')]){_0x14c2cd[_0x8a53('0x2f')]['message'][_0x8a53('0x47')]=rs[_0x8a53('0x48')]()+'\x20'+_0x14c2cd[_0x8a53('0x2f')][_0x8a53('0x17')][_0x8a53('0x30')];}var _0x39c85b={'ContactId':_0x20763b['id'],'MailAccountId':_0x14c2cd[_0x8a53('0x35')]['id'],'inReplyTo':_0x14c2cd[_0x8a53('0x2f')][_0x8a53('0x17')][_0x8a53('0x47')],'to':_0x14c2cd[_0x8a53('0x2f')][_0x8a53('0x17')][_0x8a53('0x30')],'cc':_0x14c2cd[_0x8a53('0x2f')][_0x8a53('0x17')]['cc'],'subject':_0x14c2cd[_0x8a53('0x2f')]['message']['subject'],'attach':_0x14c2cd[_0x8a53('0x2f')][_0x8a53('0x17')]['attach'],'lastMsgAt':moment()[_0x8a53('0x49')](_0x8a53('0x4a')),'lastMsgDirection':'in','lastMsgBody':_0x14c2cd[_0x8a53('0x2f')][_0x8a53('0x2f')]};return db[_0x8a53('0x4b')][_0x8a53('0x24')]({'where':{'closed':![],'MailAccountId':_0x14c2cd['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x8a53('0x4c'),'attributes':[_0x8a53('0x47')],'where':{'messageId':_0x14c2cd[_0x8a53('0x2f')][_0x8a53('0x17')][_0x8a53('0x4d')]}}]})[_0x8a53('0xe')](function(_0x55a1fb){if(_0x55a1fb){return[_0x55a1fb,![]];}return db[_0x8a53('0x4b')][_0x8a53('0x45')](_0x39c85b)[_0x8a53('0xe')](function(_0x5278a3){return[_0x5278a3,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x8a53('0x4e')](function(_0x2cb6c4,_0x1c9710){if(_0x2cb6c4){_0x478d72=_0x1c9710;if(!_0x1c9710){return _0x2cb6c4[_0x8a53('0x4f')]({'inReplyTo':_0x14c2cd[_0x8a53('0x2f')][_0x8a53('0x17')]['messageId'],'to':_0x14c2cd['body'][_0x8a53('0x17')][_0x8a53('0x30')],'cc':_0x14c2cd[_0x8a53('0x2f')][_0x8a53('0x17')]['cc'],'subject':_0x14c2cd[_0x8a53('0x2f')][_0x8a53('0x17')][_0x8a53('0x50')],'attach':_0x2cb6c4[_0x8a53('0x51')]?_0x2cb6c4[_0x8a53('0x51')]:_0x14c2cd[_0x8a53('0x2f')][_0x8a53('0x17')][_0x8a53('0x51')],'substatus':null,'substatusAt':moment()[_0x8a53('0x49')](_0x8a53('0x4a')),'lastMsgAt':moment()[_0x8a53('0x49')](_0x8a53('0x4a')),'lastMsgDirection':'in','lastMsgBody':_0x14c2cd[_0x8a53('0x2f')][_0x8a53('0x2f')]});}else{return _0x2cb6c4;}}})['then'](function(_0x24ebe1){_0x543767[_0x8a53('0x52')]=_0x24ebe1['get']({'plain':!![]});_0x543767[_0x8a53('0x52')][_0x8a53('0x53')]=_0x478d72;return db[_0x8a53('0x54')][_0x8a53('0x45')]({'body':_0x14c2cd[_0x8a53('0x2f')][_0x8a53('0x2f')],'MailAccountId':_0x14c2cd[_0x8a53('0x35')]['id'],'MailInteractionId':_0x24ebe1['id'],'direction':'in','ContactId':_0x543767[_0x8a53('0x46')]['id'],'messageId':_0x14c2cd['body'][_0x8a53('0x17')][_0x8a53('0x47')],'from':_0x14c2cd[_0x8a53('0x2f')][_0x8a53('0x17')][_0x8a53('0x30')],'to':_0x14c2cd[_0x8a53('0x2f')][_0x8a53('0x17')]['to'],'cc':_0x14c2cd[_0x8a53('0x2f')]['message']['cc'],'subject':_0x14c2cd[_0x8a53('0x2f')][_0x8a53('0x17')][_0x8a53('0x50')],'attach':_0x14c2cd['body'][_0x8a53('0x17')][_0x8a53('0x51')],'Attachments':_0x14c2cd['body']['message'][_0x8a53('0x55')],'originTo':_0x14c2cd[_0x8a53('0x2f')][_0x8a53('0x17')]['originTo'],'originCc':_0x14c2cd[_0x8a53('0x2f')][_0x8a53('0x17')][_0x8a53('0x56')],'bcc':_0x14c2cd[_0x8a53('0x2f')][_0x8a53('0x17')][_0x8a53('0x57')]},{'include':[{'model':db[_0x8a53('0x58')],'as':'Attachments'}]});})[_0x8a53('0xe')](function(_0x2a5647){_0x543767['message']=_0x2a5647;if(_0x543767['interaction']['UserId']){return db[_0x8a53('0x59')][_0x8a53('0x24')]({'attributes':['id','name'],'where':{'id':_0x543767[_0x8a53('0x52')][_0x8a53('0x5a')]}})['then'](function(_0x264e19){if(_0x264e19){_0x543767[_0x8a53('0x3d')][_0x8a53('0x5b')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x264e19[_0x8a53('0x5c')]+','+(_0x543767[_0x8a53('0x35')][_0x8a53('0x5d')]||0xa),'interval':_0x8a53('0x5e')});}return respondWithRpcPromise(_0x8a53('0x5f'),_0x8a53('0x60'),_0x543767);});}return respondWithRpcPromise('Start',_0x8a53('0x60'),_0x543767);})[_0x8a53('0xe')](function(_0x1ffc0c){_0x712686(_0x1ffc0c);})['catch'](function(_0xbff170){_0x341bce(_0x1fd487[_0x8a53('0x15')](0x1f4,_0xbff170[_0x8a53('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index abf9031..f6913bf 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 _0xb845=['register','length','./mailAccount.events','remove','update','emit','removeListener'];(function(_0x47a3eb,_0x1d3f98){var _0x17abb6=function(_0x2d44bb){while(--_0x2d44bb){_0x47a3eb['push'](_0x47a3eb['shift']());}};_0x17abb6(++_0x1d3f98);}(_0xb845,0x1f3));var _0x5b84=function(_0x178474,_0x37d82d){_0x178474=_0x178474-0x0;var _0x35cc54=_0xb845[_0x178474];return _0x35cc54;};'use strict';var MailAccountEvents=require(_0x5b84('0x0'));var events=['save',_0x5b84('0x1'),_0x5b84('0x2')];function createListener(_0xcabdf6,_0x2c7728){return function(_0x236c18){_0x2c7728[_0x5b84('0x3')](_0xcabdf6,_0x236c18);};}function removeListener(_0x19ebb4,_0xbd2052){return function(){MailAccountEvents[_0x5b84('0x4')](_0x19ebb4,_0xbd2052);};}exports[_0x5b84('0x5')]=function(_0x219115){for(var _0x23cb57=0x0,_0x60c476=events[_0x5b84('0x6')];_0x23cb57<_0x60c476;_0x23cb57++){var _0x3c2a71=events[_0x23cb57];var _0x485552=createListener('mailAccount:'+_0x3c2a71,_0x219115);MailAccountEvents['on'](_0x3c2a71,_0x485552);}}; \ No newline at end of file +var _0x8976=['mailAccount:','save','remove','update','removeListener','register','length'];(function(_0x6abae1,_0x11a02f){var _0x14dad0=function(_0xf1fa3){while(--_0xf1fa3){_0x6abae1['push'](_0x6abae1['shift']());}};_0x14dad0(++_0x11a02f);}(_0x8976,0xa2));var _0x6897=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8976[_0x2dafbe];return _0x58a45a;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x6897('0x0'),_0x6897('0x1'),_0x6897('0x2')];function createListener(_0x1f4ab3,_0x22985c){return function(_0x17b255){_0x22985c['emit'](_0x1f4ab3,_0x17b255);};}function removeListener(_0x48b1a0,_0x487483){return function(){MailAccountEvents[_0x6897('0x3')](_0x48b1a0,_0x487483);};}exports[_0x6897('0x4')]=function(_0x2e78fe){for(var _0x2447ce=0x0,_0xed90e5=events[_0x6897('0x5')];_0x2447ce<_0xed90e5;_0x2447ce++){var _0x249aab=events[_0x2447ce];var _0x5860b7=createListener(_0x6897('0x6')+_0x249aab,_0x2e78fe);MailAccountEvents['on'](_0x249aab,_0x5860b7);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index f2ce309..d8a3acc 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 _0x3d98=['update','delete','isAuthenticated','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','put','/:id'];(function(_0x55c66e,_0x55b8a2){var _0x150ceb=function(_0x12344e){while(--_0x12344e){_0x55c66e['push'](_0x55c66e['shift']());}};_0x150ceb(++_0x55b8a2);}(_0x3d98,0xc7));var _0x83d9=function(_0x1c29ec,_0x5303c4){_0x1c29ec=_0x1c29ec-0x0;var _0x2b8d1c=_0x3d98[_0x1c29ec];return _0x2b8d1c;};'use strict';var multer=require(_0x83d9('0x0'));var util=require(_0x83d9('0x1'));var path=require(_0x83d9('0x2'));var express=require(_0x83d9('0x3'));var router=express['Router']();var auth=require(_0x83d9('0x4'));var interaction=require(_0x83d9('0x5'));var config=require('../../config/environment');var controller=require(_0x83d9('0x6'));router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x83d9('0x7')](_0x83d9('0x8'),auth['isAuthenticated'](),controller[_0x83d9('0x9')]);router[_0x83d9('0xa')](_0x83d9('0x8'),auth[_0x83d9('0xb')](),controller[_0x83d9('0xc')]);module['exports']=router; \ No newline at end of file +var _0x287c=['express','Router','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','put','delete','destroy','exports','multer','util'];(function(_0x3c13fe,_0x1f26a2){var _0x27b882=function(_0x43b3d6){while(--_0x43b3d6){_0x3c13fe['push'](_0x3c13fe['shift']());}};_0x27b882(++_0x1f26a2);}(_0x287c,0x6e));var _0xc287=function(_0x21f50a,_0x12a532){_0x21f50a=_0x21f50a-0x0;var _0x3c031d=_0x287c[_0x21f50a];return _0x3c031d;};'use strict';var multer=require(_0xc287('0x0'));var util=require(_0xc287('0x1'));var path=require('path');var express=require(_0xc287('0x2'));var router=express[_0xc287('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc287('0x4'));var config=require(_0xc287('0x5'));var controller=require(_0xc287('0x6'));router[_0xc287('0x7')](_0xc287('0x8'),auth[_0xc287('0x9')](),controller['show']);router[_0xc287('0xa')](_0xc287('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xc287('0xb')](_0xc287('0x8'),auth[_0xc287('0x9')](),controller[_0xc287('0xc')]);module[_0xc287('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 7733cdc..c886ba4 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 _0xf6b8=['*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x2d4e02,_0x2a75e0){var _0x316dba=function(_0x24524e){while(--_0x24524e){_0x2d4e02['push'](_0x2d4e02['shift']());}};_0x316dba(++_0x2a75e0);}(_0xf6b8,0x1eb));var _0x8f6b=function(_0x8065e0,_0x530006){_0x8065e0=_0x8065e0-0x0;var _0x5b0f55=_0xf6b8[_0x8065e0];return _0x5b0f55;};'use strict';var Sequelize=require(_0x8f6b('0x0'));module[_0x8f6b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x8f6b('0x2')],'allowNull':![],'defaultValue':_0x8f6b('0x3')},'appdata':{'type':Sequelize['STRING'](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x8f6b('0x2')]},'interval':{'type':Sequelize[_0x8f6b('0x2')],'defaultValue':_0x8f6b('0x4')}}; \ No newline at end of file +var _0x429d=['sequelize','exports','INTEGER','STRING','*,*,*,*'];(function(_0x1bf12f,_0x56952b){var _0x2e5ed3=function(_0x423b9e){while(--_0x423b9e){_0x1bf12f['push'](_0x1bf12f['shift']());}};_0x2e5ed3(++_0x56952b);}(_0x429d,0x1e5));var _0xd429=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x429d[_0x341e0f];return _0x59555a;};'use strict';var Sequelize=require(_0xd429('0x0'));module[_0xd429('0x1')]={'priority':{'type':Sequelize[_0xd429('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xd429('0x3')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0xd429('0x3')]},'interval':{'type':Sequelize[_0xd429('0x3')],'defaultValue':_0xd429('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 7ffc8fd..594d8fb 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 _0xb2e7=['find','catch','body','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','MailApplication','rawAttributes','keys','intersection','fields','query','length','attributes','includeAll','merge','options'];(function(_0x1a4011,_0x36ab2d){var _0x11b237=function(_0x4599c8){while(--_0x4599c8){_0x1a4011['push'](_0x1a4011['shift']());}};_0x11b237(++_0x36ab2d);}(_0xb2e7,0x111));var _0x7b2e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb2e7[_0x42cae2];return _0x5f256f;};'use strict';var jsonpatch=require(_0x7b2e('0x0'));var rp=require(_0x7b2e('0x1'));var moment=require(_0x7b2e('0x2'));var BPromise=require(_0x7b2e('0x3'));var Mustache=require(_0x7b2e('0x4'));var util=require(_0x7b2e('0x5'));var path=require('path');var sox=require(_0x7b2e('0x6'));var csv=require(_0x7b2e('0x7'));var ejs=require(_0x7b2e('0x8'));var fs=require('fs');var _=require(_0x7b2e('0x9'));var squel=require('squel');var crypto=require(_0x7b2e('0xa'));var jsforce=require(_0x7b2e('0xb'));var deskjs=require(_0x7b2e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7b2e('0xd'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0x7b2e('0xe'))(_0x7b2e('0xf'));var utils=require(_0x7b2e('0x10'));var config=require(_0x7b2e('0x11'));var db=require(_0x7b2e('0x12'))['db'];function respondWithStatusCode(_0x197273,_0x1c760d){_0x1c760d=_0x1c760d||0xcc;return function(_0x34d8d3){if(_0x34d8d3){return _0x197273[_0x7b2e('0x13')](_0x1c760d);}return _0x197273['status'](_0x1c760d)[_0x7b2e('0x14')]();};}function respondWithResult(_0x3d475e,_0x2ef443){_0x2ef443=_0x2ef443||0xc8;return function(_0x23e9e){if(_0x23e9e){return _0x3d475e[_0x7b2e('0x15')](_0x2ef443)[_0x7b2e('0x16')](_0x23e9e);}};}function respondWithFilteredResult(_0xe79216,_0x53dd0b){return function(_0x3a5554){if(_0x3a5554){var _0x214e57=_0x3a5554[_0x7b2e('0x17')],_0x1c1286=_0x53dd0b[_0x7b2e('0x18')],_0x3ceef2=_0x53dd0b['offset']+_0x53dd0b['limit'],_0x3b1440;if(_0x3ceef2>=_0x214e57){_0x3ceef2=_0x214e57;_0x3b1440=0xc8;}else{_0x3b1440=0xce;}_0xe79216['status'](_0x3b1440);return _0xe79216[_0x7b2e('0x19')](_0x7b2e('0x1a'),_0x1c1286+'-'+_0x3ceef2+'/'+_0x214e57)[_0x7b2e('0x16')](_0x3a5554);}return null;};}function patchUpdates(_0x4791e5){return function(_0x9bcbf1){try{jsonpatch[_0x7b2e('0x1b')](_0x9bcbf1,_0x4791e5,!![]);}catch(_0x28f626){return BPromise[_0x7b2e('0x1c')](_0x28f626);}return _0x9bcbf1[_0x7b2e('0x1d')]();};}function saveUpdates(_0xe38f2e,_0x230346){return function(_0x46c2fd){if(_0x46c2fd){return _0x46c2fd[_0x7b2e('0x1e')](_0xe38f2e)['then'](function(_0x57abcb){return _0x57abcb;});}return null;};}function removeEntity(_0x118292,_0x1bf0b7){return function(_0x5d10dc){if(_0x5d10dc){return _0x5d10dc[_0x7b2e('0x1f')]()[_0x7b2e('0x20')](function(){_0x118292[_0x7b2e('0x15')](0xcc)[_0x7b2e('0x14')]();});}};}function handleEntityNotFound(_0x5bd96c,_0x22865c){return function(_0x440a24){if(!_0x440a24){_0x5bd96c[_0x7b2e('0x13')](0x194);}return _0x440a24;};}function handleError(_0x12caff,_0x146765){_0x146765=_0x146765||0x1f4;return function(_0x2497d7){logger[_0x7b2e('0x21')](_0x2497d7[_0x7b2e('0x22')]);if(_0x2497d7['name']){delete _0x2497d7[_0x7b2e('0x23')];}_0x12caff[_0x7b2e('0x15')](_0x146765)[_0x7b2e('0x24')](_0x2497d7);};}exports[_0x7b2e('0x25')]=function(_0xbeaab9,_0x54017e){var _0x562cf6={'raw':!![],'where':{'id':_0xbeaab9[_0x7b2e('0x26')]['id']}},_0x443809={};_0x443809[_0x7b2e('0x27')]=_['keys'](db[_0x7b2e('0x28')][_0x7b2e('0x29')]);_0x443809['query']=_[_0x7b2e('0x2a')](_0xbeaab9['query']);_0x443809['filters']=_['intersection'](_0x443809['model'],_0x443809['query']);_0x562cf6['attributes']=_[_0x7b2e('0x2b')](_0x443809['model'],qs[_0x7b2e('0x2c')](_0xbeaab9[_0x7b2e('0x2d')]['fields']));_0x562cf6['attributes']=_0x562cf6['attributes'][_0x7b2e('0x2e')]?_0x562cf6[_0x7b2e('0x2f')]:_0x443809[_0x7b2e('0x27')];if(_0xbeaab9['query'][_0x7b2e('0x30')]){_0x562cf6['include']=[{'all':!![]}];}_0x562cf6=_[_0x7b2e('0x31')]({},_0x562cf6,_0xbeaab9[_0x7b2e('0x32')]);return db[_0x7b2e('0x28')][_0x7b2e('0x33')](_0x562cf6)['then'](handleEntityNotFound(_0x54017e,null))['then'](respondWithResult(_0x54017e,null))[_0x7b2e('0x34')](handleError(_0x54017e,null));};exports[_0x7b2e('0x1e')]=function(_0x1f879a,_0x8a74d2){if(_0x1f879a[_0x7b2e('0x35')]['id']){delete _0x1f879a[_0x7b2e('0x35')]['id'];}return db[_0x7b2e('0x28')]['find']({'where':{'id':_0x1f879a[_0x7b2e('0x26')]['id']}})[_0x7b2e('0x20')](handleEntityNotFound(_0x8a74d2,null))['then'](saveUpdates(_0x1f879a[_0x7b2e('0x35')],null))[_0x7b2e('0x20')](respondWithResult(_0x8a74d2,null))[_0x7b2e('0x34')](handleError(_0x8a74d2,null));};exports[_0x7b2e('0x1f')]=function(_0x329e11,_0x8467d1){return db['MailApplication']['find']({'where':{'id':_0x329e11[_0x7b2e('0x26')]['id']}})[_0x7b2e('0x20')](handleEntityNotFound(_0x8467d1,null))[_0x7b2e('0x20')](removeEntity(_0x8467d1,null))[_0x7b2e('0x34')](handleError(_0x8467d1,null));}; \ No newline at end of file +var _0x6c9c=['../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','model','keys','MailApplication','query','filters','intersection','fields','attributes','length','includeAll','merge','options','find','catch','body','destroy','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6c9c,0x12a));var _0xc6c9=function(_0x5e097f,_0x13f823){_0x5e097f=_0x5e097f-0x0;var _0x4f4a15=_0x6c9c[_0x5e097f];return _0x4f4a15;};'use strict';var jsonpatch=require(_0xc6c9('0x0'));var rp=require(_0xc6c9('0x1'));var moment=require('moment');var BPromise=require(_0xc6c9('0x2'));var Mustache=require(_0xc6c9('0x3'));var util=require(_0xc6c9('0x4'));var path=require(_0xc6c9('0x5'));var sox=require('sox');var csv=require(_0xc6c9('0x6'));var ejs=require(_0xc6c9('0x7'));var fs=require('fs');var _=require(_0xc6c9('0x8'));var squel=require(_0xc6c9('0x9'));var crypto=require(_0xc6c9('0xa'));var jsforce=require(_0xc6c9('0xb'));var deskjs=require(_0xc6c9('0xc'));var toCsv=require(_0xc6c9('0x6'));var querystring=require(_0xc6c9('0xd'));var Papa=require(_0xc6c9('0xe'));var qs=require(_0xc6c9('0xf'));var logger=require(_0xc6c9('0x10'))(_0xc6c9('0x11'));var utils=require(_0xc6c9('0x12'));var config=require(_0xc6c9('0x13'));var db=require(_0xc6c9('0x14'))['db'];function respondWithStatusCode(_0x190435,_0x239e72){_0x239e72=_0x239e72||0xcc;return function(_0x577848){if(_0x577848){return _0x190435[_0xc6c9('0x15')](_0x239e72);}return _0x190435['status'](_0x239e72)['end']();};}function respondWithResult(_0x56a3a1,_0x28c778){_0x28c778=_0x28c778||0xc8;return function(_0x3fbdee){if(_0x3fbdee){return _0x56a3a1[_0xc6c9('0x16')](_0x28c778)[_0xc6c9('0x17')](_0x3fbdee);}};}function respondWithFilteredResult(_0x21d910,_0x36f457){return function(_0x545cd9){if(_0x545cd9){var _0x526752=_0x545cd9[_0xc6c9('0x18')],_0x406912=_0x36f457[_0xc6c9('0x19')],_0x3a0274=_0x36f457[_0xc6c9('0x19')]+_0x36f457['limit'],_0xfa3179;if(_0x3a0274>=_0x526752){_0x3a0274=_0x526752;_0xfa3179=0xc8;}else{_0xfa3179=0xce;}_0x21d910[_0xc6c9('0x16')](_0xfa3179);return _0x21d910[_0xc6c9('0x1a')](_0xc6c9('0x1b'),_0x406912+'-'+_0x3a0274+'/'+_0x526752)[_0xc6c9('0x17')](_0x545cd9);}return null;};}function patchUpdates(_0x1f2ea9){return function(_0x35c82c){try{jsonpatch[_0xc6c9('0x1c')](_0x35c82c,_0x1f2ea9,!![]);}catch(_0x324f5f){return BPromise[_0xc6c9('0x1d')](_0x324f5f);}return _0x35c82c[_0xc6c9('0x1e')]();};}function saveUpdates(_0x44ed2e,_0x4c0de5){return function(_0x5e5dd0){if(_0x5e5dd0){return _0x5e5dd0[_0xc6c9('0x1f')](_0x44ed2e)[_0xc6c9('0x20')](function(_0x42c27f){return _0x42c27f;});}return null;};}function removeEntity(_0x5153c3,_0x49a9bd){return function(_0x5617c7){if(_0x5617c7){return _0x5617c7['destroy']()[_0xc6c9('0x20')](function(){_0x5153c3[_0xc6c9('0x16')](0xcc)[_0xc6c9('0x21')]();});}};}function handleEntityNotFound(_0x4452ae,_0x29efdd){return function(_0x59d4b0){if(!_0x59d4b0){_0x4452ae[_0xc6c9('0x15')](0x194);}return _0x59d4b0;};}function handleError(_0x44194e,_0x4b01ba){_0x4b01ba=_0x4b01ba||0x1f4;return function(_0x4f1fb6){logger['error'](_0x4f1fb6[_0xc6c9('0x22')]);if(_0x4f1fb6[_0xc6c9('0x23')]){delete _0x4f1fb6[_0xc6c9('0x23')];}_0x44194e[_0xc6c9('0x16')](_0x4b01ba)[_0xc6c9('0x24')](_0x4f1fb6);};}exports['show']=function(_0x4e2e93,_0xb432ec){var _0x1cbb4d={'raw':!![],'where':{'id':_0x4e2e93['params']['id']}},_0x3ab712={};_0x3ab712[_0xc6c9('0x25')]=_[_0xc6c9('0x26')](db[_0xc6c9('0x27')]['rawAttributes']);_0x3ab712['query']=_['keys'](_0x4e2e93[_0xc6c9('0x28')]);_0x3ab712[_0xc6c9('0x29')]=_[_0xc6c9('0x2a')](_0x3ab712[_0xc6c9('0x25')],_0x3ab712[_0xc6c9('0x28')]);_0x1cbb4d['attributes']=_[_0xc6c9('0x2a')](_0x3ab712[_0xc6c9('0x25')],qs['fields'](_0x4e2e93[_0xc6c9('0x28')][_0xc6c9('0x2b')]));_0x1cbb4d[_0xc6c9('0x2c')]=_0x1cbb4d[_0xc6c9('0x2c')][_0xc6c9('0x2d')]?_0x1cbb4d['attributes']:_0x3ab712[_0xc6c9('0x25')];if(_0x4e2e93[_0xc6c9('0x28')][_0xc6c9('0x2e')]){_0x1cbb4d['include']=[{'all':!![]}];}_0x1cbb4d=_[_0xc6c9('0x2f')]({},_0x1cbb4d,_0x4e2e93[_0xc6c9('0x30')]);return db[_0xc6c9('0x27')][_0xc6c9('0x31')](_0x1cbb4d)[_0xc6c9('0x20')](handleEntityNotFound(_0xb432ec,null))[_0xc6c9('0x20')](respondWithResult(_0xb432ec,null))[_0xc6c9('0x32')](handleError(_0xb432ec,null));};exports[_0xc6c9('0x1f')]=function(_0xa36594,_0x249177){if(_0xa36594['body']['id']){delete _0xa36594[_0xc6c9('0x33')]['id'];}return db['MailApplication'][_0xc6c9('0x31')]({'where':{'id':_0xa36594['params']['id']}})['then'](handleEntityNotFound(_0x249177,null))[_0xc6c9('0x20')](saveUpdates(_0xa36594[_0xc6c9('0x33')],null))[_0xc6c9('0x20')](respondWithResult(_0x249177,null))['catch'](handleError(_0x249177,null));};exports[_0xc6c9('0x34')]=function(_0x3a0c4f,_0x859dd8){return db[_0xc6c9('0x27')][_0xc6c9('0x31')]({'where':{'id':_0x3a0c4f['params']['id']}})[_0xc6c9('0x20')](handleEntityNotFound(_0x859dd8,null))[_0xc6c9('0x20')](removeEntity(_0x859dd8,null))[_0xc6c9('0x32')](handleError(_0x859dd8,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 8a25960..3713894 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 _0x5c63=['util','../../config/logger','moment','bluebird','./mailApplication.attributes','exports','define','MailApplication','mail_applications','lodash'];(function(_0x194e34,_0x112814){var _0x11d944=function(_0x5804fb){while(--_0x5804fb){_0x194e34['push'](_0x194e34['shift']());}};_0x11d944(++_0x112814);}(_0x5c63,0x1ad));var _0x35c6=function(_0x43ce56,_0x50de72){_0x43ce56=_0x43ce56-0x0;var _0x464e9c=_0x5c63[_0x43ce56];return _0x464e9c;};'use strict';var _=require(_0x35c6('0x0'));var util=require(_0x35c6('0x1'));var logger=require(_0x35c6('0x2'))('api');var moment=require(_0x35c6('0x3'));var BPromise=require(_0x35c6('0x4'));var rp=require('request-promise');var attributes=require(_0x35c6('0x5'));module[_0x35c6('0x6')]=function(_0x2a5d72,_0x4b28cb){return _0x2a5d72[_0x35c6('0x7')](_0x35c6('0x8'),attributes,{'tableName':_0x35c6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd781=['util','api','moment','bluebird','./mailApplication.attributes','exports','define','MailApplication'];(function(_0x393948,_0x26a850){var _0x2f6c6c=function(_0x16ca43){while(--_0x16ca43){_0x393948['push'](_0x393948['shift']());}};_0x2f6c6c(++_0x26a850);}(_0xd781,0x180));var _0x1d78=function(_0x378eeb,_0x5951cd){_0x378eeb=_0x378eeb-0x0;var _0x405fc7=_0xd781[_0x378eeb];return _0x405fc7;};'use strict';var _=require('lodash');var util=require(_0x1d78('0x0'));var logger=require('../../config/logger')(_0x1d78('0x1'));var moment=require(_0x1d78('0x2'));var BPromise=require(_0x1d78('0x3'));var rp=require('request-promise');var attributes=require(_0x1d78('0x4'));module[_0x1d78('0x5')]=function(_0x16eac7,_0x3c8a3b){return _0x16eac7[_0x1d78('0x6')](_0x1d78('0x7'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 03c0f24..0f0244d 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 _0x81e4=['then','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','MailApplication,\x20%s,\x20%s','result','MailApplication','update','body','options','raw','where','attributes','limit','UpdateMailApplication','debug','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x81e4,0x75));var _0x481e=function(_0x1e6e39,_0x3c98ed){_0x1e6e39=_0x1e6e39-0x0;var _0x2d9029=_0x81e4[_0x1e6e39];return _0x2d9029;};'use strict';var _=require(_0x481e('0x0'));var util=require(_0x481e('0x1'));var moment=require(_0x481e('0x2'));var BPromise=require(_0x481e('0x3'));var rs=require(_0x481e('0x4'));var fs=require('fs');var db=require(_0x481e('0x5'))['db'];var utils=require(_0x481e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x481e('0x7'));var jayson=require(_0x481e('0x8'));var client=jayson[_0x481e('0x9')][_0x481e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1846e5,_0x2fe2d5,_0x5911d7){return new BPromise(function(_0x95de8,_0x40a85a){return client['request'](_0x1846e5,_0x5911d7)[_0x481e('0xb')](function(_0x53c1f4){logger['info']('MailApplication,\x20%s,\x20%s',_0x2fe2d5,_0x481e('0xc'));logger['debug'](_0x481e('0xd'),_0x2fe2d5,_0x481e('0xc'),JSON[_0x481e('0xe')](_0x53c1f4));if(_0x53c1f4['error']){if(_0x53c1f4[_0x481e('0xf')][_0x481e('0x10')]===0x1f4){logger[_0x481e('0xf')]('MailApplication,\x20%s,\x20%s',_0x2fe2d5,_0x53c1f4[_0x481e('0xf')][_0x481e('0x11')]);return _0x40a85a(_0x53c1f4[_0x481e('0xf')][_0x481e('0x11')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0x2fe2d5,_0x53c1f4['error'][_0x481e('0x11')]);return _0x95de8(_0x53c1f4['error']['message']);}else{logger[_0x481e('0x12')](_0x481e('0x13'),_0x2fe2d5,_0x481e('0xc'));_0x95de8(_0x53c1f4[_0x481e('0x14')][_0x481e('0x11')]);}})['catch'](function(_0x486c8b){logger[_0x481e('0xf')](_0x481e('0x13'),_0x2fe2d5,_0x486c8b);_0x40a85a(_0x486c8b);});});}exports['UpdateMailApplication']=function(_0x2f6816){var _0x5299bd=this;return new Promise(function(_0x5cb2ca,_0x9aab49){return db[_0x481e('0x15')][_0x481e('0x16')](_0x2f6816[_0x481e('0x17')],{'raw':_0x2f6816['options']?_0x2f6816[_0x481e('0x18')][_0x481e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f6816[_0x481e('0x18')]?_0x2f6816['options'][_0x481e('0x1a')]||null:null,'attributes':_0x2f6816['options']?_0x2f6816[_0x481e('0x18')][_0x481e('0x1b')]||null:null,'limit':_0x2f6816['options']?_0x2f6816['options'][_0x481e('0x1c')]||null:null})[_0x481e('0xb')](function(_0x3202fb){logger[_0x481e('0x12')](_0x481e('0x1d'),_0x2f6816);logger[_0x481e('0x1e')](_0x481e('0x1d'),_0x2f6816,JSON[_0x481e('0xe')](_0x3202fb));_0x5cb2ca(_0x3202fb);})[_0x481e('0x1f')](function(_0x373f38){logger[_0x481e('0xf')](_0x481e('0x1d'),_0x373f38['message'],_0x2f6816);_0x9aab49(_0x5299bd[_0x481e('0xf')](0x1f4,_0x373f38[_0x481e('0x11')]));});});}; \ No newline at end of file +var _0x8d7f=['info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateMailApplication','MailApplication','update','body','raw','where','options','attributes','limit','debug','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0xf8deed,_0x18f231){var _0x2c9f3c=function(_0x32b547){while(--_0x32b547){_0xf8deed['push'](_0xf8deed['shift']());}};_0x2c9f3c(++_0x18f231);}(_0x8d7f,0x10a));var _0xf8d7=function(_0x10ab85,_0x44ae3b){_0x10ab85=_0x10ab85-0x0;var _0x28f04c=_0x8d7f[_0x10ab85];return _0x28f04c;};'use strict';var _=require(_0xf8d7('0x0'));var util=require(_0xf8d7('0x1'));var moment=require(_0xf8d7('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8d7('0x3'));var fs=require('fs');var db=require(_0xf8d7('0x4'))['db'];var utils=require(_0xf8d7('0x5'));var logger=require(_0xf8d7('0x6'))(_0xf8d7('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8d7('0x8'));var client=jayson[_0xf8d7('0x9')][_0xf8d7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x530c96,_0x536062,_0x3083f7){return new BPromise(function(_0x5b794e,_0x2675b7){return client[_0xf8d7('0xb')](_0x530c96,_0x3083f7)[_0xf8d7('0xc')](function(_0xd034fb){logger[_0xf8d7('0xd')](_0xf8d7('0xe'),_0x536062,_0xf8d7('0xf'));logger['debug'](_0xf8d7('0x10'),_0x536062,'request\x20sent',JSON[_0xf8d7('0x11')](_0xd034fb));if(_0xd034fb[_0xf8d7('0x12')]){if(_0xd034fb['error']['code']===0x1f4){logger[_0xf8d7('0x12')](_0xf8d7('0xe'),_0x536062,_0xd034fb[_0xf8d7('0x12')][_0xf8d7('0x13')]);return _0x2675b7(_0xd034fb[_0xf8d7('0x12')]['message']);}logger['error'](_0xf8d7('0xe'),_0x536062,_0xd034fb['error'][_0xf8d7('0x13')]);return _0x5b794e(_0xd034fb[_0xf8d7('0x12')]['message']);}else{logger['info'](_0xf8d7('0xe'),_0x536062,'request\x20sent');_0x5b794e(_0xd034fb[_0xf8d7('0x14')][_0xf8d7('0x13')]);}})['catch'](function(_0x7d84d2){logger[_0xf8d7('0x12')]('MailApplication,\x20%s,\x20%s',_0x536062,_0x7d84d2);_0x2675b7(_0x7d84d2);});});}exports[_0xf8d7('0x15')]=function(_0x3a873d){var _0x2a9fb5=this;return new Promise(function(_0x41208f,_0x2cdb8d){return db[_0xf8d7('0x16')][_0xf8d7('0x17')](_0x3a873d[_0xf8d7('0x18')],{'raw':_0x3a873d['options']?_0x3a873d['options'][_0xf8d7('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a873d['options']?_0x3a873d['options'][_0xf8d7('0x1a')]||null:null,'attributes':_0x3a873d[_0xf8d7('0x1b')]?_0x3a873d[_0xf8d7('0x1b')][_0xf8d7('0x1c')]||null:null,'limit':_0x3a873d[_0xf8d7('0x1b')]?_0x3a873d['options'][_0xf8d7('0x1d')]||null:null})[_0xf8d7('0xc')](function(_0x1015df){logger[_0xf8d7('0xd')](_0xf8d7('0x15'),_0x3a873d);logger[_0xf8d7('0x1e')](_0xf8d7('0x15'),_0x3a873d,JSON[_0xf8d7('0x11')](_0x1015df));_0x41208f(_0x1015df);})['catch'](function(_0xf69bd0){logger[_0xf8d7('0x12')](_0xf8d7('0x15'),_0xf69bd0[_0xf8d7('0x13')],_0x3a873d);_0x2cdb8d(_0x2a9fb5[_0xf8d7('0x12')](0x1f4,_0xf69bd0[_0xf8d7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 6514df3..8b68ed7 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 _0x6628=['delete','mailinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','addMessage','/:id/tags','mailinteraction:addtags','addTags','put','tracked','mail','mailinteraction:update','update'];(function(_0x5e4b85,_0x6cf965){var _0x5cd3cb=function(_0x589c9e){while(--_0x589c9e){_0x5e4b85['push'](_0x5e4b85['shift']());}};_0x5cd3cb(++_0x6cf965);}(_0x6628,0x11c));var _0x8662=function(_0x4c7c7a,_0x38e50){_0x4c7c7a=_0x4c7c7a-0x0;var _0x7b803f=_0x6628[_0x4c7c7a];return _0x7b803f;};'use strict';var multer=require(_0x8662('0x0'));var util=require(_0x8662('0x1'));var path=require(_0x8662('0x2'));var express=require(_0x8662('0x3'));var router=express[_0x8662('0x4')]();var auth=require(_0x8662('0x5'));var interaction=require(_0x8662('0x6'));var config=require(_0x8662('0x7'));var controller=require('./mailInteraction.controller');router[_0x8662('0x8')]('/',auth[_0x8662('0x9')](),controller[_0x8662('0xa')]);router[_0x8662('0x8')](_0x8662('0xb'),auth[_0x8662('0x9')](),controller[_0x8662('0xc')]);router[_0x8662('0x8')](_0x8662('0xd'),auth['isAuthenticated'](),controller[_0x8662('0xe')]);router[_0x8662('0x8')](_0x8662('0xf'),auth['isAuthenticated'](),controller[_0x8662('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x8662('0xf'),auth[_0x8662('0x9')](),controller[_0x8662('0x11')]);router['post'](_0x8662('0x12'),auth[_0x8662('0x9')](),interaction['tracked']('mail',_0x8662('0x13')),controller[_0x8662('0x14')]);router[_0x8662('0x15')](_0x8662('0xd'),auth[_0x8662('0x9')](),interaction[_0x8662('0x16')](_0x8662('0x17'),_0x8662('0x18')),controller[_0x8662('0x19')]);router[_0x8662('0x1a')](_0x8662('0xd'),auth['isAuthenticated'](),interaction[_0x8662('0x16')]('mail',_0x8662('0x1b')),controller[_0x8662('0x1c')]);router[_0x8662('0x1a')](_0x8662('0x12'),auth['isAuthenticated'](),controller[_0x8662('0x1d')]);module[_0x8662('0x1e')]=router; \ No newline at end of file +var _0xf787=['mailinteraction:destroy','destroy','exports','util','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','getMessages','post','create','/:id/messages','addMessage','/:id/tags','tracked','mail','addTags','mailinteraction:update','update','delete'];(function(_0x3b6a60,_0x2c2b44){var _0x36fbad=function(_0x48d298){while(--_0x48d298){_0x3b6a60['push'](_0x3b6a60['shift']());}};_0x36fbad(++_0x2c2b44);}(_0xf787,0x17a));var _0x7f78=function(_0x3f7aea,_0x1b89ee){_0x3f7aea=_0x3f7aea-0x0;var _0x34eabc=_0xf787[_0x3f7aea];return _0x34eabc;};'use strict';var multer=require('multer');var util=require(_0x7f78('0x0'));var path=require('path');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7f78('0x1'));var config=require(_0x7f78('0x2'));var controller=require('./mailInteraction.controller');router[_0x7f78('0x3')]('/',auth['isAuthenticated'](),controller[_0x7f78('0x4')]);router['get'](_0x7f78('0x5'),auth[_0x7f78('0x6')](),controller[_0x7f78('0x7')]);router['get'](_0x7f78('0x8'),auth['isAuthenticated'](),controller[_0x7f78('0x9')]);router[_0x7f78('0x3')]('/:id/messages',auth[_0x7f78('0x6')](),controller[_0x7f78('0xa')]);router[_0x7f78('0xb')]('/',auth[_0x7f78('0x6')](),controller[_0x7f78('0xc')]);router['post'](_0x7f78('0xd'),auth['isAuthenticated'](),controller[_0x7f78('0xe')]);router[_0x7f78('0xb')](_0x7f78('0xf'),auth[_0x7f78('0x6')](),interaction[_0x7f78('0x10')](_0x7f78('0x11'),'mailinteraction:addtags'),controller[_0x7f78('0x12')]);router['put'](_0x7f78('0x8'),auth[_0x7f78('0x6')](),interaction[_0x7f78('0x10')](_0x7f78('0x11'),_0x7f78('0x13')),controller[_0x7f78('0x14')]);router[_0x7f78('0x15')]('/:id',auth[_0x7f78('0x6')](),interaction[_0x7f78('0x10')]('mail',_0x7f78('0x16')),controller[_0x7f78('0x17')]);router[_0x7f78('0x15')](_0x7f78('0xf'),auth[_0x7f78('0x6')](),controller['removeTags']);module[_0x7f78('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index a01dee1..567c8d9 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 _0x2d56=['html-to-text','iconv','BOOLEAN','STRING','\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci','DATE','ENUM','out','TEXT','getDataValue','lastMsgBody','fromString','split'];(function(_0xa2f2c0,_0x1bd315){var _0x3f2623=function(_0x38ff37){while(--_0x38ff37){_0xa2f2c0['push'](_0xa2f2c0['shift']());}};_0x3f2623(++_0x1bd315);}(_0x2d56,0x193));var _0x62d5=function(_0x5c8c85,_0x24f818){_0x5c8c85=_0x5c8c85-0x0;var _0x3d9d95=_0x2d56[_0x5c8c85];return _0x3d9d95;};'use strict';var Sequelize=require('sequelize');var htmlToText=require(_0x62d5('0x0'));var iconv=require(_0x62d5('0x1'));module['exports']={'closed':{'type':Sequelize[_0x62d5('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x62d5('0x3')]},'inReplyTo':{'type':Sequelize[_0x62d5('0x3')](0xbe)},'to':{'type':Sequelize[_0x62d5('0x3')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize['TEXT']('')+_0x62d5('0x4')},'attach':{'type':Sequelize[_0x62d5('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x62d5('0x5')]},'substatus':{'type':Sequelize[_0x62d5('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x62d5('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x62d5('0x6')]('in',_0x62d5('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x62d5('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x62d5('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x62d5('0x8')]('long')+_0x62d5('0x4'),'get':function(){try{return this[_0x62d5('0x9')](_0x62d5('0xa'))?htmlToText[_0x62d5('0xb')](this[_0x62d5('0x9')](_0x62d5('0xa')),{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'ignoreImage':!![]})[_0x62d5('0xc')]('\x0a')['slice'](0x0,0x6)['join']('\x0a'):null;}catch(_0x3c550b){return null;}}}}; \ No newline at end of file +var _0xd9af=['split','slice','join','html-to-text','iconv','exports','BOOLEAN','DATE','STRING','TEXT','\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci','ENUM','out','getDataValue','lastMsgBody'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xd9af,0x1d4));var _0xfd9a=function(_0x50a286,_0x69a25b){_0x50a286=_0x50a286-0x0;var _0x5681af=_0xd9af[_0x50a286];return _0x5681af;};'use strict';var Sequelize=require('sequelize');var htmlToText=require(_0xfd9a('0x0'));var iconv=require(_0xfd9a('0x1'));module[_0xfd9a('0x2')]={'closed':{'type':Sequelize[_0xfd9a('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfd9a('0x4')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xfd9a('0x5')]},'inReplyTo':{'type':Sequelize['STRING'](0xbe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xfd9a('0x6')]('long')},'subject':{'type':Sequelize['TEXT']('')+_0xfd9a('0x7')},'attach':{'type':Sequelize[_0xfd9a('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xfd9a('0x4')]},'substatus':{'type':Sequelize[_0xfd9a('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xfd9a('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xfd9a('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xfd9a('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xfd9a('0x6')]('long')+_0xfd9a('0x7'),'get':function(){try{return this[_0xfd9a('0xa')]('lastMsgBody')?htmlToText['fromString'](this[_0xfd9a('0xa')](_0xfd9a('0xb')),{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'ignoreImage':!![]})[_0xfd9a('0xc')]('\x0a')[_0xfd9a('0xd')](0x0,0x6)[_0xfd9a('0xe')]('\x0a'):null;}catch(_0x2537c4){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 9ef9759..6a2e629 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 _0x0cfd=['order','sort','where','pick','add','day','merge','filter','map','options','include','tag','Tag','Tags','read','push','MailMessage','Messages','distinct','MailInteraction','includeAll','User','Users','CmContact','Contact','Owner','fullname','internal','MailAccount','Account','key','email','direction','createdAt','ThroughTags','color','findAll','catch','params','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','MailInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','setTags','spread','removeTags','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./mailInteraction.socket','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','save','update','destroy','then','name','send','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x1b129f,_0x6d1483){var _0x117f95=function(_0x445ad7){while(--_0x445ad7){_0x1b129f['push'](_0x1b129f['shift']());}};_0x117f95(++_0x6d1483);}(_0x0cfd,0x17c));var _0xd0cf=function(_0x4502f1,_0x5720d6){_0x4502f1=_0x4502f1-0x0;var _0x4544dc=_0x0cfd[_0x4502f1];return _0x4544dc;};'use strict';var jsonpatch=require(_0xd0cf('0x0'));var rp=require(_0xd0cf('0x1'));var moment=require(_0xd0cf('0x2'));var BPromise=require(_0xd0cf('0x3'));var Mustache=require(_0xd0cf('0x4'));var util=require(_0xd0cf('0x5'));var path=require(_0xd0cf('0x6'));var sox=require(_0xd0cf('0x7'));var csv=require(_0xd0cf('0x8'));var ejs=require(_0xd0cf('0x9'));var fs=require('fs');var _=require(_0xd0cf('0xa'));var squel=require(_0xd0cf('0xb'));var crypto=require(_0xd0cf('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd0cf('0xd'));var toCsv=require(_0xd0cf('0x8'));var querystring=require(_0xd0cf('0xe'));var Papa=require('papaparse');var qs=require(_0xd0cf('0xf'));var logger=require(_0xd0cf('0x10'))(_0xd0cf('0x11'));var utils=require(_0xd0cf('0x12'));var config=require(_0xd0cf('0x13'));var db=require(_0xd0cf('0x14'))['db'];var socket=require(_0xd0cf('0x15'))({'host':_0xd0cf('0x16'),'port':0x18eb});require(_0xd0cf('0x17'))['register'](socket);function respondWithStatusCode(_0x5d25f8,_0x5742ca){_0x5742ca=_0x5742ca||0xcc;return function(_0x28af78){if(_0x28af78){return _0x5d25f8[_0xd0cf('0x18')](_0x5742ca);}return _0x5d25f8['status'](_0x5742ca)[_0xd0cf('0x19')]();};}function respondWithResult(_0x5da299,_0x4de031){_0x4de031=_0x4de031||0xc8;return function(_0x378225){if(_0x378225){return _0x5da299[_0xd0cf('0x1a')](_0x4de031)[_0xd0cf('0x1b')](_0x378225);}};}function respondWithFilteredResult(_0x11a071,_0x2a3263){return function(_0x25688a){if(_0x25688a){var _0x420bc2=_0x25688a[_0xd0cf('0x1c')],_0x2cd2dc=_0x2a3263[_0xd0cf('0x1d')],_0xa0c983=_0x2a3263[_0xd0cf('0x1d')]+_0x2a3263[_0xd0cf('0x1e')],_0x414fb8;if(_0xa0c983>=_0x420bc2){_0xa0c983=_0x420bc2;_0x414fb8=0xc8;}else{_0x414fb8=0xce;}_0x11a071[_0xd0cf('0x1a')](_0x414fb8);return _0x11a071['set'](_0xd0cf('0x1f'),_0x2cd2dc+'-'+_0xa0c983+'/'+_0x420bc2)[_0xd0cf('0x1b')](_0x25688a);}return null;};}function patchUpdates(_0x2dc1ac){return function(_0xa51f09){try{jsonpatch['apply'](_0xa51f09,_0x2dc1ac,!![]);}catch(_0x3f23af){return BPromise[_0xd0cf('0x20')](_0x3f23af);}return _0xa51f09[_0xd0cf('0x21')]();};}function saveUpdates(_0x4373c7,_0x1df16d){return function(_0x28cd86){if(_0x28cd86){return _0x28cd86[_0xd0cf('0x22')](_0x4373c7)['then'](function(_0x4b48f3){return _0x4b48f3;});}return null;};}function removeEntity(_0x420174,_0xcade24){return function(_0x33f9aa){if(_0x33f9aa){return _0x33f9aa[_0xd0cf('0x23')]()[_0xd0cf('0x24')](function(){_0x420174['status'](0xcc)[_0xd0cf('0x19')]();});}};}function handleEntityNotFound(_0x1b0df7,_0xb0a45d){return function(_0x266480){if(!_0x266480){_0x1b0df7[_0xd0cf('0x18')](0x194);}return _0x266480;};}function handleError(_0xba689f,_0x2177d8){_0x2177d8=_0x2177d8||0x1f4;return function(_0x450c35){logger['error'](_0x450c35['stack']);if(_0x450c35[_0xd0cf('0x25')]){delete _0x450c35[_0xd0cf('0x25')];}_0xba689f[_0xd0cf('0x1a')](_0x2177d8)[_0xd0cf('0x26')](_0x450c35);};}exports['index']=function(_0x4715f3,_0x540ac1){var _0x1819ef={},_0x11f629={},_0x227341={'count':0x0,'rows':[]};var _0x2e24c1=db['MailInteraction'][_0xd0cf('0x27')];_0x11f629[_0xd0cf('0x28')]=_[_0xd0cf('0x29')](_0x2e24c1);var _0x48a756={'dateStart':_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x2b')],'dateEnd':_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x2c')]};delete _0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x2b')];delete _0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x2c')];_0x11f629[_0xd0cf('0x2a')]=_[_0xd0cf('0x29')](_0x4715f3[_0xd0cf('0x2a')]);_0x11f629[_0xd0cf('0x2d')]=_['intersection'](_0x11f629['model'],_0x11f629['query']);_0x1819ef[_0xd0cf('0x2e')]=_[_0xd0cf('0x2f')](_0x11f629[_0xd0cf('0x28')],qs[_0xd0cf('0x30')](_0x4715f3['query'][_0xd0cf('0x30')]));_0x1819ef['attributes']=_0x1819ef['attributes'][_0xd0cf('0x31')]?_0x1819ef[_0xd0cf('0x2e')]:_0x11f629[_0xd0cf('0x28')];if(!_0x4715f3['query'][_0xd0cf('0x32')](_0xd0cf('0x33'))){_0x1819ef[_0xd0cf('0x1e')]=qs[_0xd0cf('0x1e')](_0x4715f3[_0xd0cf('0x2a')]['limit']);_0x1819ef['offset']=qs['offset'](_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x1d')]);}_0x1819ef[_0xd0cf('0x34')]=qs[_0xd0cf('0x35')](_0x4715f3[_0xd0cf('0x2a')]['sort']);_0x1819ef[_0xd0cf('0x36')]=qs['filters'](_[_0xd0cf('0x37')](_0x4715f3[_0xd0cf('0x2a')],_0x11f629['filters']));if(_0x48a756['dateStart']){if(_0x48a756[_0xd0cf('0x2c')]){_0x48a756[_0xd0cf('0x2c')]=moment(_0x48a756[_0xd0cf('0x2c')])[_0xd0cf('0x38')](0x1,_0xd0cf('0x39'));}else{_0x48a756[_0xd0cf('0x2c')]=moment(_0x48a756[_0xd0cf('0x2b')])['add'](0x1,'day');}_[_0xd0cf('0x3a')](_0x1819ef[_0xd0cf('0x36')],{'createdAt':{'$gte':_0x48a756[_0xd0cf('0x2b')],'$lte':_0x48a756['dateEnd']}});}if(_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x3b')]){_0x1819ef[_0xd0cf('0x36')]=_[_0xd0cf('0x3a')](_0x1819ef['where'],{'$or':_[_0xd0cf('0x3c')](_0x1819ef[_0xd0cf('0x2e')],function(_0x4294a0){var _0x1cf34b={};_0x1cf34b[_0x4294a0]={'$like':'%'+_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x3b')]+'%'};return _0x1cf34b;})});}_0x1819ef=_[_0xd0cf('0x3a')]({},_0x1819ef,_0x4715f3[_0xd0cf('0x3d')]);var _0x4822d8={'where':_0x1819ef[_0xd0cf('0x36')]};_0x4822d8[_0xd0cf('0x3e')]=[];if(_0x4715f3['query'][_0xd0cf('0x3f')]){_0x4822d8[_0xd0cf('0x3e')]['push']({'model':db[_0xd0cf('0x40')],'as':_0xd0cf('0x41'),'attributes':['id'],'where':{'id':_0x4715f3['query'][_0xd0cf('0x3f')]},'required':!![]});_0x4822d8['distinct']=!![];}if(_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x42')]){_0x4822d8[_0xd0cf('0x3e')][_0xd0cf('0x43')]({'model':db[_0xd0cf('0x44')],'as':_0xd0cf('0x45'),'attributes':['id','direction','createdAt',_0xd0cf('0x42')],'where':{'direction':'in','read':_0x4715f3['query']['read']||![]},'required':!![]});_0x4822d8[_0xd0cf('0x46')]=!![];}return db[_0xd0cf('0x47')][_0xd0cf('0x1c')](_0x4822d8)[_0xd0cf('0x24')](function(_0x2bcac8){_0x227341[_0xd0cf('0x1c')]=_0x2bcac8;if(_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x48')]){_0x1819ef[_0xd0cf('0x3e')]=[{'model':db[_0xd0cf('0x49')],'as':_0xd0cf('0x4a'),'required':![],'attributes':['id',_0xd0cf('0x25'),'fullname']},{'model':db[_0xd0cf('0x4b')],'as':_0xd0cf('0x4c'),'required':![]},{'model':db[_0xd0cf('0x49')],'as':_0xd0cf('0x4d'),'attributes':[_0xd0cf('0x25'),_0xd0cf('0x4e'),_0xd0cf('0x4f')],'required':![]},{'model':db[_0xd0cf('0x50')],'as':_0xd0cf('0x51'),'attributes':[_0xd0cf('0x25'),_0xd0cf('0x52'),_0xd0cf('0x53')],'required':![]},{'model':db['MailMessage'],'as':_0xd0cf('0x45'),'attributes':['id',_0xd0cf('0x54'),_0xd0cf('0x55'),_0xd0cf('0x42')],'where':{'direction':'in','read':_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x42')]||![]},'required':_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x42')]||![]},{'model':db[_0xd0cf('0x40')],'as':'Tags','attributes':['id',_0xd0cf('0x25'),'color'],'required':_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x3f')]?!![]:![]},{'model':db['Tag'],'as':_0xd0cf('0x56'),'attributes':['id',_0xd0cf('0x25'),_0xd0cf('0x57')],'through':_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x3f')]?{'attributes':[],'where':{'TagId':_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x3f')]||undefined}}:{},'required':_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x3f')]?!![]:![]}];}return db[_0xd0cf('0x47')][_0xd0cf('0x58')](_0x1819ef);})[_0xd0cf('0x24')](function(_0x3d98ad){_0x227341['rows']=_0x3d98ad;return _0x227341;})[_0xd0cf('0x24')](respondWithFilteredResult(_0x540ac1,_0x1819ef))[_0xd0cf('0x59')](handleError(_0x540ac1,null));};exports['show']=function(_0x50efdb,_0x4a9112){var _0x23bc9e={'raw':![],'where':{'id':_0x50efdb[_0xd0cf('0x5a')]['id']}},_0x4ecf9={};_0x4ecf9[_0xd0cf('0x28')]=_[_0xd0cf('0x29')](db['MailInteraction']['rawAttributes']);_0x4ecf9[_0xd0cf('0x2a')]=_[_0xd0cf('0x29')](_0x50efdb[_0xd0cf('0x2a')]);_0x4ecf9[_0xd0cf('0x2d')]=_[_0xd0cf('0x2f')](_0x4ecf9['model'],_0x4ecf9['query']);_0x23bc9e[_0xd0cf('0x2e')]=_[_0xd0cf('0x2f')](_0x4ecf9['model'],qs[_0xd0cf('0x30')](_0x50efdb['query'][_0xd0cf('0x30')]));_0x23bc9e['attributes']=_0x23bc9e['attributes']['length']?_0x23bc9e[_0xd0cf('0x2e')]:_0x4ecf9['model'];if(_0x50efdb['query'][_0xd0cf('0x48')]){_0x23bc9e[_0xd0cf('0x3e')]=[{'all':!![]}];}_0x23bc9e=_[_0xd0cf('0x3a')]({},_0x23bc9e,_0x50efdb[_0xd0cf('0x3d')]);return db[_0xd0cf('0x47')][_0xd0cf('0x5b')](_0x23bc9e)[_0xd0cf('0x24')](handleEntityNotFound(_0x4a9112,null))[_0xd0cf('0x24')](respondWithResult(_0x4a9112,null))[_0xd0cf('0x59')](handleError(_0x4a9112,null));};exports[_0xd0cf('0x5c')]=function(_0x190269,_0x5d2d54){return db[_0xd0cf('0x47')][_0xd0cf('0x5c')](_0x190269[_0xd0cf('0x5d')],{})[_0xd0cf('0x24')](respondWithResult(_0x5d2d54,0xc9))['catch'](handleError(_0x5d2d54,null));};exports[_0xd0cf('0x22')]=function(_0x308147,_0x465a5a){if(_0x308147[_0xd0cf('0x5d')]['id']){delete _0x308147['body']['id'];}return db[_0xd0cf('0x47')][_0xd0cf('0x5b')]({'where':{'id':_0x308147['params']['id']}})[_0xd0cf('0x24')](handleEntityNotFound(_0x465a5a,null))['then'](saveUpdates(_0x308147['body'],null))[_0xd0cf('0x24')](respondWithResult(_0x465a5a,null))[_0xd0cf('0x59')](handleError(_0x465a5a,null));};exports['destroy']=function(_0x1851aa,_0x451972){return db[_0xd0cf('0x47')][_0xd0cf('0x5b')]({'where':{'id':_0x1851aa[_0xd0cf('0x5a')]['id']}})['then'](handleEntityNotFound(_0x451972,null))['then'](removeEntity(_0x451972,null))[_0xd0cf('0x59')](handleError(_0x451972,null));};exports[_0xd0cf('0x5e')]=function(_0x2621d7,_0x5684d9){return db[_0xd0cf('0x47')][_0xd0cf('0x5e')]()[_0xd0cf('0x24')](respondWithResult(_0x5684d9,null))['catch'](handleError(_0x5684d9,null));};exports['addMessage']=function(_0x387f4a,_0x375360,_0x25285c){return db[_0xd0cf('0x44')][_0xd0cf('0x5b')]({'where':{'id':_0x387f4a[_0xd0cf('0x5a')]['id']}})[_0xd0cf('0x24')](handleEntityNotFound(_0x375360,null))[_0xd0cf('0x24')](function(_0x45b3bd){if(_0x45b3bd){return _0x45b3bd[_0xd0cf('0x5f')](_0x387f4a[_0xd0cf('0x5d')][_0xd0cf('0x60')],_[_0xd0cf('0x61')](_0x387f4a[_0xd0cf('0x5d')],[_0xd0cf('0x60'),'id'])||{});}})[_0xd0cf('0x24')](respondWithResult(_0x375360,null))[_0xd0cf('0x59')](handleError(_0x375360,null));};exports[_0xd0cf('0x62')]=function(_0x30220a,_0x1b13e2,_0x40dba4){var _0x55049c={'raw':![],'where':{}};var _0x33974d={};var _0xf5b2ca={'count':0x0,'rows':[]};return db[_0xd0cf('0x47')][_0xd0cf('0x63')]({'where':{'id':_0x30220a[_0xd0cf('0x5a')]['id']}})[_0xd0cf('0x24')](handleEntityNotFound(_0x1b13e2,null))[_0xd0cf('0x24')](function(_0x555a53){if(_0x555a53){_0x33974d[_0xd0cf('0x28')]=_[_0xd0cf('0x29')](db['MailMessage'][_0xd0cf('0x27')]);_0x33974d[_0xd0cf('0x2a')]=_[_0xd0cf('0x29')](_0x30220a['query']);_0x33974d[_0xd0cf('0x2d')]=_[_0xd0cf('0x2f')](_0x33974d[_0xd0cf('0x28')],_0x33974d['query']);_0x55049c[_0xd0cf('0x2e')]=_['intersection'](_0x33974d[_0xd0cf('0x28')],qs[_0xd0cf('0x30')](_0x30220a['query'][_0xd0cf('0x30')]));_0x55049c[_0xd0cf('0x2e')]=_0x55049c['attributes'][_0xd0cf('0x31')]?_0x55049c[_0xd0cf('0x2e')]:_0x33974d['model'];if(!_0x30220a[_0xd0cf('0x2a')][_0xd0cf('0x32')](_0xd0cf('0x33'))){_0x55049c[_0xd0cf('0x1e')]=qs['limit'](_0x30220a[_0xd0cf('0x2a')][_0xd0cf('0x1e')]);_0x55049c[_0xd0cf('0x1d')]=qs[_0xd0cf('0x1d')](_0x30220a[_0xd0cf('0x2a')][_0xd0cf('0x1d')]);}_0x55049c[_0xd0cf('0x34')]=qs[_0xd0cf('0x35')](_0x30220a[_0xd0cf('0x2a')][_0xd0cf('0x35')]);_0x55049c[_0xd0cf('0x36')]=qs[_0xd0cf('0x2d')](_[_0xd0cf('0x37')](_0x30220a['query'],_0x33974d[_0xd0cf('0x2d')]));_0x55049c['where'][_0xd0cf('0x64')]=_0x555a53['id'];if(_0x30220a['query'][_0xd0cf('0x3b')]){_0x55049c[_0xd0cf('0x36')]=_[_0xd0cf('0x3a')](_0x55049c[_0xd0cf('0x36')],{'$or':_['map'](_0x55049c[_0xd0cf('0x2e')],function(_0x464819){var _0x2453a9={};_0x2453a9[_0x464819]={'$like':'%'+_0x30220a['query'][_0xd0cf('0x3b')]+'%'};return _0x2453a9;})});}if(_0x30220a['query'][_0xd0cf('0x65')]){var _0x3573f8=_0x30220a[_0xd0cf('0x2a')][_0xd0cf('0x65')][_0xd0cf('0x66')](',');var _0x110243={};_0x110243[_0x3573f8[0x0]]={'$gte':moment(_0x3573f8[0x1])[_0xd0cf('0x67')](_0xd0cf('0x68'))};_0x55049c[_0xd0cf('0x36')]=_['merge'](_0x55049c['where'],_0x110243);}_0x55049c=_[_0xd0cf('0x3a')]({},_0x55049c,_0x30220a[_0xd0cf('0x3d')]);return db[_0xd0cf('0x44')][_0xd0cf('0x1c')]({'where':_0x55049c['where']})[_0xd0cf('0x24')](function(_0x715cbf){_0xf5b2ca[_0xd0cf('0x1c')]=_0x715cbf;if(_0x30220a[_0xd0cf('0x2a')][_0xd0cf('0x48')]){_0x55049c[_0xd0cf('0x3e')]=[{'all':!![]}];}return db[_0xd0cf('0x44')][_0xd0cf('0x58')](_0x55049c);})['then'](function(_0x32cb57){_0xf5b2ca['rows']=_0x32cb57;return _0xf5b2ca;});}})['then'](respondWithFilteredResult(_0x1b13e2,_0x55049c))[_0xd0cf('0x59')](handleError(_0x1b13e2,null));};exports['addTags']=function(_0x1a29fc,_0x3628cb,_0x5a6e40){return db[_0xd0cf('0x47')][_0xd0cf('0x5b')]({'where':{'id':_0x1a29fc[_0xd0cf('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3628cb,null))['then'](function(_0x45b952){if(_0x45b952){return _0x45b952[_0xd0cf('0x69')](_0x1a29fc['body'][_0xd0cf('0x60')],_['omit'](_0x1a29fc[_0xd0cf('0x5d')],[_0xd0cf('0x60'),'id'])||{})[_0xd0cf('0x6a')](function(){return db[_0xd0cf('0x40')]['findAll']({'attributes':['id',_0xd0cf('0x25'),_0xd0cf('0x57')],'where':{'id':_0x1a29fc[_0xd0cf('0x5d')]['ids']}});})[_0xd0cf('0x24')](function(_0x684edb){socket['emit']('mailInteractionTags:save',{'id':Number(_0x1a29fc[_0xd0cf('0x5a')]['id']),'tags':_0x684edb||[]});return{'id':Number(_0x1a29fc[_0xd0cf('0x5a')]['id']),'tags':_0x684edb||[]};});}})[_0xd0cf('0x24')](respondWithResult(_0x3628cb,null))[_0xd0cf('0x59')](handleError(_0x3628cb,null));};exports['removeTags']=function(_0x4c9812,_0x18bf18,_0x23ff32){var _0x5e6272;return db['MailInteraction']['find']({'where':{'id':_0x4c9812[_0xd0cf('0x5a')]['id']}})[_0xd0cf('0x24')](handleEntityNotFound(_0x18bf18,null))[_0xd0cf('0x24')](function(_0x236fbc){if(_0x236fbc){return _0x236fbc[_0xd0cf('0x6b')](_0x4c9812[_0xd0cf('0x2a')][_0xd0cf('0x60')]);}})['then'](respondWithStatusCode(_0x18bf18,null))[_0xd0cf('0x59')](handleError(_0x18bf18,null));}; \ No newline at end of file +var _0xab01=['findAll','rows','show','params','length','includeAll','find','catch','create','body','describe','addMessage','ids','omit','getMessages','fields','MailInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','spread','emit','removeTags','fast-json-patch','request-promise','moment','bluebird','to-csv','lodash','squel','desk.js','querystring','papaparse','../../config/utils','../../mysqldb','socket.io-emitter','localhost','./mailInteraction.socket','register','sendStatus','end','status','json','count','limit','set','apply','reject','save','update','then','destroy','error','name','send','index','MailInteraction','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','hasOwnProperty','nolimit','offset','order','sort','where','pick','add','merge','map','filter','options','include','tag','Tags','distinct','read','push','MailMessage','Messages','direction','User','CmContact','Owner','fullname','internal','Account','email','createdAt','Tag','color'];(function(_0x41fd58,_0x39be5f){var _0x303b20=function(_0x5f3013){while(--_0x5f3013){_0x41fd58['push'](_0x41fd58['shift']());}};_0x303b20(++_0x39be5f);}(_0xab01,0x13e));var _0x1ab0=function(_0x13adc2,_0x456fac){_0x13adc2=_0x13adc2-0x0;var _0x46f01f=_0xab01[_0x13adc2];return _0x46f01f;};'use strict';var jsonpatch=require(_0x1ab0('0x0'));var rp=require(_0x1ab0('0x1'));var moment=require(_0x1ab0('0x2'));var BPromise=require(_0x1ab0('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1ab0('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1ab0('0x5'));var squel=require(_0x1ab0('0x6'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1ab0('0x7'));var toCsv=require(_0x1ab0('0x4'));var querystring=require(_0x1ab0('0x8'));var Papa=require(_0x1ab0('0x9'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0x1ab0('0xa'));var config=require('../../config/environment');var db=require(_0x1ab0('0xb'))['db'];var socket=require(_0x1ab0('0xc'))({'host':_0x1ab0('0xd'),'port':0x18eb});require(_0x1ab0('0xe'))[_0x1ab0('0xf')](socket);function respondWithStatusCode(_0x29c767,_0x210b41){_0x210b41=_0x210b41||0xcc;return function(_0xe73092){if(_0xe73092){return _0x29c767[_0x1ab0('0x10')](_0x210b41);}return _0x29c767['status'](_0x210b41)[_0x1ab0('0x11')]();};}function respondWithResult(_0x5de967,_0x52a4cf){_0x52a4cf=_0x52a4cf||0xc8;return function(_0x259aba){if(_0x259aba){return _0x5de967[_0x1ab0('0x12')](_0x52a4cf)[_0x1ab0('0x13')](_0x259aba);}};}function respondWithFilteredResult(_0xd33843,_0x38cc3f){return function(_0x4fb4c2){if(_0x4fb4c2){var _0x47e3fc=_0x4fb4c2[_0x1ab0('0x14')],_0xd0c7a1=_0x38cc3f['offset'],_0xe881f0=_0x38cc3f['offset']+_0x38cc3f[_0x1ab0('0x15')],_0x4b9e40;if(_0xe881f0>=_0x47e3fc){_0xe881f0=_0x47e3fc;_0x4b9e40=0xc8;}else{_0x4b9e40=0xce;}_0xd33843[_0x1ab0('0x12')](_0x4b9e40);return _0xd33843[_0x1ab0('0x16')]('Content-Range',_0xd0c7a1+'-'+_0xe881f0+'/'+_0x47e3fc)['json'](_0x4fb4c2);}return null;};}function patchUpdates(_0x564a9a){return function(_0x287e55){try{jsonpatch[_0x1ab0('0x17')](_0x287e55,_0x564a9a,!![]);}catch(_0xde7252){return BPromise[_0x1ab0('0x18')](_0xde7252);}return _0x287e55[_0x1ab0('0x19')]();};}function saveUpdates(_0x28fc0f,_0x461f29){return function(_0x535ff1){if(_0x535ff1){return _0x535ff1[_0x1ab0('0x1a')](_0x28fc0f)[_0x1ab0('0x1b')](function(_0x477b9f){return _0x477b9f;});}return null;};}function removeEntity(_0x25e343,_0xc48674){return function(_0x4bbfb0){if(_0x4bbfb0){return _0x4bbfb0[_0x1ab0('0x1c')]()[_0x1ab0('0x1b')](function(){_0x25e343[_0x1ab0('0x12')](0xcc)[_0x1ab0('0x11')]();});}};}function handleEntityNotFound(_0x500e3c,_0x44de97){return function(_0x247b95){if(!_0x247b95){_0x500e3c[_0x1ab0('0x10')](0x194);}return _0x247b95;};}function handleError(_0x2ccde1,_0xeb4246){_0xeb4246=_0xeb4246||0x1f4;return function(_0x338f76){logger[_0x1ab0('0x1d')](_0x338f76['stack']);if(_0x338f76[_0x1ab0('0x1e')]){delete _0x338f76[_0x1ab0('0x1e')];}_0x2ccde1[_0x1ab0('0x12')](_0xeb4246)[_0x1ab0('0x1f')](_0x338f76);};}exports[_0x1ab0('0x20')]=function(_0x429fd0,_0x64616c){var _0x2ebbad={},_0xf69526={},_0x2fda07={'count':0x0,'rows':[]};var _0x1a6b51=db[_0x1ab0('0x21')][_0x1ab0('0x22')];_0xf69526[_0x1ab0('0x23')]=_[_0x1ab0('0x24')](_0x1a6b51);var _0x5122ea={'dateStart':_0x429fd0[_0x1ab0('0x25')][_0x1ab0('0x26')],'dateEnd':_0x429fd0['query'][_0x1ab0('0x27')]};delete _0x429fd0[_0x1ab0('0x25')][_0x1ab0('0x26')];delete _0x429fd0[_0x1ab0('0x25')]['dateEnd'];_0xf69526['query']=_[_0x1ab0('0x24')](_0x429fd0['query']);_0xf69526[_0x1ab0('0x28')]=_[_0x1ab0('0x29')](_0xf69526[_0x1ab0('0x23')],_0xf69526[_0x1ab0('0x25')]);_0x2ebbad['attributes']=_[_0x1ab0('0x29')](_0xf69526[_0x1ab0('0x23')],qs['fields'](_0x429fd0[_0x1ab0('0x25')]['fields']));_0x2ebbad[_0x1ab0('0x2a')]=_0x2ebbad['attributes']['length']?_0x2ebbad['attributes']:_0xf69526[_0x1ab0('0x23')];if(!_0x429fd0[_0x1ab0('0x25')][_0x1ab0('0x2b')](_0x1ab0('0x2c'))){_0x2ebbad['limit']=qs[_0x1ab0('0x15')](_0x429fd0['query']['limit']);_0x2ebbad['offset']=qs['offset'](_0x429fd0['query'][_0x1ab0('0x2d')]);}_0x2ebbad[_0x1ab0('0x2e')]=qs['sort'](_0x429fd0['query'][_0x1ab0('0x2f')]);_0x2ebbad[_0x1ab0('0x30')]=qs['filters'](_[_0x1ab0('0x31')](_0x429fd0['query'],_0xf69526[_0x1ab0('0x28')]));if(_0x5122ea[_0x1ab0('0x26')]){if(_0x5122ea[_0x1ab0('0x27')]){_0x5122ea[_0x1ab0('0x27')]=moment(_0x5122ea['dateEnd'])[_0x1ab0('0x32')](0x1,'day');}else{_0x5122ea[_0x1ab0('0x27')]=moment(_0x5122ea['dateStart'])[_0x1ab0('0x32')](0x1,'day');}_[_0x1ab0('0x33')](_0x2ebbad[_0x1ab0('0x30')],{'createdAt':{'$gte':_0x5122ea[_0x1ab0('0x26')],'$lte':_0x5122ea[_0x1ab0('0x27')]}});}if(_0x429fd0[_0x1ab0('0x25')]['filter']){_0x2ebbad[_0x1ab0('0x30')]=_[_0x1ab0('0x33')](_0x2ebbad[_0x1ab0('0x30')],{'$or':_[_0x1ab0('0x34')](_0x2ebbad[_0x1ab0('0x2a')],function(_0x2249d0){var _0xc518ff={};_0xc518ff[_0x2249d0]={'$like':'%'+_0x429fd0[_0x1ab0('0x25')][_0x1ab0('0x35')]+'%'};return _0xc518ff;})});}_0x2ebbad=_[_0x1ab0('0x33')]({},_0x2ebbad,_0x429fd0[_0x1ab0('0x36')]);var _0x364804={'where':_0x2ebbad[_0x1ab0('0x30')]};_0x364804[_0x1ab0('0x37')]=[];if(_0x429fd0['query'][_0x1ab0('0x38')]){_0x364804[_0x1ab0('0x37')]['push']({'model':db['Tag'],'as':_0x1ab0('0x39'),'attributes':['id'],'where':{'id':_0x429fd0[_0x1ab0('0x25')][_0x1ab0('0x38')]},'required':!![]});_0x364804[_0x1ab0('0x3a')]=!![];}if(_0x429fd0['query'][_0x1ab0('0x3b')]){_0x364804[_0x1ab0('0x37')][_0x1ab0('0x3c')]({'model':db[_0x1ab0('0x3d')],'as':_0x1ab0('0x3e'),'attributes':['id',_0x1ab0('0x3f'),'createdAt',_0x1ab0('0x3b')],'where':{'direction':'in','read':_0x429fd0[_0x1ab0('0x25')][_0x1ab0('0x3b')]||![]},'required':!![]});_0x364804[_0x1ab0('0x3a')]=!![];}return db['MailInteraction'][_0x1ab0('0x14')](_0x364804)['then'](function(_0x2c2c6f){_0x2fda07[_0x1ab0('0x14')]=_0x2c2c6f;if(_0x429fd0['query']['includeAll']){_0x2ebbad[_0x1ab0('0x37')]=[{'model':db[_0x1ab0('0x40')],'as':'Users','required':![],'attributes':['id',_0x1ab0('0x1e'),'fullname']},{'model':db[_0x1ab0('0x41')],'as':'Contact','required':![]},{'model':db[_0x1ab0('0x40')],'as':_0x1ab0('0x42'),'attributes':[_0x1ab0('0x1e'),_0x1ab0('0x43'),_0x1ab0('0x44')],'required':![]},{'model':db['MailAccount'],'as':_0x1ab0('0x45'),'attributes':[_0x1ab0('0x1e'),'key',_0x1ab0('0x46')],'required':![]},{'model':db[_0x1ab0('0x3d')],'as':'Messages','attributes':['id',_0x1ab0('0x3f'),_0x1ab0('0x47'),_0x1ab0('0x3b')],'where':{'direction':'in','read':_0x429fd0[_0x1ab0('0x25')]['read']||![]},'required':_0x429fd0['query'][_0x1ab0('0x3b')]||![]},{'model':db[_0x1ab0('0x48')],'as':_0x1ab0('0x39'),'attributes':['id',_0x1ab0('0x1e'),_0x1ab0('0x49')],'required':_0x429fd0[_0x1ab0('0x25')][_0x1ab0('0x38')]?!![]:![]},{'model':db[_0x1ab0('0x48')],'as':'ThroughTags','attributes':['id',_0x1ab0('0x1e'),_0x1ab0('0x49')],'through':_0x429fd0[_0x1ab0('0x25')][_0x1ab0('0x38')]?{'attributes':[],'where':{'TagId':_0x429fd0[_0x1ab0('0x25')]['tag']||undefined}}:{},'required':_0x429fd0[_0x1ab0('0x25')]['tag']?!![]:![]}];}return db['MailInteraction'][_0x1ab0('0x4a')](_0x2ebbad);})[_0x1ab0('0x1b')](function(_0x2a8e7d){_0x2fda07[_0x1ab0('0x4b')]=_0x2a8e7d;return _0x2fda07;})[_0x1ab0('0x1b')](respondWithFilteredResult(_0x64616c,_0x2ebbad))['catch'](handleError(_0x64616c,null));};exports[_0x1ab0('0x4c')]=function(_0x4431a,_0x4c7d82){var _0x5c06bf={'raw':![],'where':{'id':_0x4431a[_0x1ab0('0x4d')]['id']}},_0x32e6d6={};_0x32e6d6['model']=_[_0x1ab0('0x24')](db['MailInteraction'][_0x1ab0('0x22')]);_0x32e6d6['query']=_['keys'](_0x4431a[_0x1ab0('0x25')]);_0x32e6d6[_0x1ab0('0x28')]=_[_0x1ab0('0x29')](_0x32e6d6[_0x1ab0('0x23')],_0x32e6d6[_0x1ab0('0x25')]);_0x5c06bf['attributes']=_[_0x1ab0('0x29')](_0x32e6d6[_0x1ab0('0x23')],qs['fields'](_0x4431a['query']['fields']));_0x5c06bf['attributes']=_0x5c06bf[_0x1ab0('0x2a')][_0x1ab0('0x4e')]?_0x5c06bf[_0x1ab0('0x2a')]:_0x32e6d6['model'];if(_0x4431a[_0x1ab0('0x25')][_0x1ab0('0x4f')]){_0x5c06bf[_0x1ab0('0x37')]=[{'all':!![]}];}_0x5c06bf=_['merge']({},_0x5c06bf,_0x4431a[_0x1ab0('0x36')]);return db[_0x1ab0('0x21')][_0x1ab0('0x50')](_0x5c06bf)[_0x1ab0('0x1b')](handleEntityNotFound(_0x4c7d82,null))[_0x1ab0('0x1b')](respondWithResult(_0x4c7d82,null))[_0x1ab0('0x51')](handleError(_0x4c7d82,null));};exports['create']=function(_0x5a30b0,_0x22e93c){return db['MailInteraction'][_0x1ab0('0x52')](_0x5a30b0[_0x1ab0('0x53')],{})[_0x1ab0('0x1b')](respondWithResult(_0x22e93c,0xc9))[_0x1ab0('0x51')](handleError(_0x22e93c,null));};exports['update']=function(_0x2a5cd,_0x1a8748){if(_0x2a5cd[_0x1ab0('0x53')]['id']){delete _0x2a5cd[_0x1ab0('0x53')]['id'];}return db[_0x1ab0('0x21')][_0x1ab0('0x50')]({'where':{'id':_0x2a5cd[_0x1ab0('0x4d')]['id']}})[_0x1ab0('0x1b')](handleEntityNotFound(_0x1a8748,null))[_0x1ab0('0x1b')](saveUpdates(_0x2a5cd['body'],null))[_0x1ab0('0x1b')](respondWithResult(_0x1a8748,null))[_0x1ab0('0x51')](handleError(_0x1a8748,null));};exports['destroy']=function(_0x197669,_0x10efa){return db[_0x1ab0('0x21')][_0x1ab0('0x50')]({'where':{'id':_0x197669[_0x1ab0('0x4d')]['id']}})[_0x1ab0('0x1b')](handleEntityNotFound(_0x10efa,null))[_0x1ab0('0x1b')](removeEntity(_0x10efa,null))['catch'](handleError(_0x10efa,null));};exports[_0x1ab0('0x54')]=function(_0x59296e,_0x4e61c1){return db[_0x1ab0('0x21')][_0x1ab0('0x54')]()[_0x1ab0('0x1b')](respondWithResult(_0x4e61c1,null))[_0x1ab0('0x51')](handleError(_0x4e61c1,null));};exports['addMessage']=function(_0x45408d,_0xe53c7e,_0x987e7c){return db[_0x1ab0('0x3d')]['find']({'where':{'id':_0x45408d['params']['id']}})[_0x1ab0('0x1b')](handleEntityNotFound(_0xe53c7e,null))['then'](function(_0x335ebf){if(_0x335ebf){return _0x335ebf[_0x1ab0('0x55')](_0x45408d[_0x1ab0('0x53')][_0x1ab0('0x56')],_[_0x1ab0('0x57')](_0x45408d[_0x1ab0('0x53')],['ids','id'])||{});}})[_0x1ab0('0x1b')](respondWithResult(_0xe53c7e,null))[_0x1ab0('0x51')](handleError(_0xe53c7e,null));};exports[_0x1ab0('0x58')]=function(_0x21f3c6,_0x5e1336,_0x59c506){var _0x474707={'raw':![],'where':{}};var _0x400cb0={};var _0x21eef9={'count':0x0,'rows':[]};return db[_0x1ab0('0x21')]['findOne']({'where':{'id':_0x21f3c6['params']['id']}})['then'](handleEntityNotFound(_0x5e1336,null))['then'](function(_0x1389c0){if(_0x1389c0){_0x400cb0['model']=_[_0x1ab0('0x24')](db[_0x1ab0('0x3d')][_0x1ab0('0x22')]);_0x400cb0['query']=_['keys'](_0x21f3c6[_0x1ab0('0x25')]);_0x400cb0['filters']=_[_0x1ab0('0x29')](_0x400cb0['model'],_0x400cb0[_0x1ab0('0x25')]);_0x474707[_0x1ab0('0x2a')]=_[_0x1ab0('0x29')](_0x400cb0[_0x1ab0('0x23')],qs[_0x1ab0('0x59')](_0x21f3c6[_0x1ab0('0x25')][_0x1ab0('0x59')]));_0x474707[_0x1ab0('0x2a')]=_0x474707[_0x1ab0('0x2a')][_0x1ab0('0x4e')]?_0x474707[_0x1ab0('0x2a')]:_0x400cb0[_0x1ab0('0x23')];if(!_0x21f3c6[_0x1ab0('0x25')][_0x1ab0('0x2b')](_0x1ab0('0x2c'))){_0x474707[_0x1ab0('0x15')]=qs[_0x1ab0('0x15')](_0x21f3c6[_0x1ab0('0x25')][_0x1ab0('0x15')]);_0x474707[_0x1ab0('0x2d')]=qs[_0x1ab0('0x2d')](_0x21f3c6[_0x1ab0('0x25')][_0x1ab0('0x2d')]);}_0x474707[_0x1ab0('0x2e')]=qs[_0x1ab0('0x2f')](_0x21f3c6['query']['sort']);_0x474707[_0x1ab0('0x30')]=qs[_0x1ab0('0x28')](_['pick'](_0x21f3c6[_0x1ab0('0x25')],_0x400cb0[_0x1ab0('0x28')]));_0x474707[_0x1ab0('0x30')][_0x1ab0('0x5a')]=_0x1389c0['id'];if(_0x21f3c6['query']['filter']){_0x474707[_0x1ab0('0x30')]=_[_0x1ab0('0x33')](_0x474707['where'],{'$or':_[_0x1ab0('0x34')](_0x474707[_0x1ab0('0x2a')],function(_0x51e9ea){var _0x476756={};_0x476756[_0x51e9ea]={'$like':'%'+_0x21f3c6['query'][_0x1ab0('0x35')]+'%'};return _0x476756;})});}if(_0x21f3c6[_0x1ab0('0x25')][_0x1ab0('0x5b')]){var _0x10d648=_0x21f3c6[_0x1ab0('0x25')][_0x1ab0('0x5b')][_0x1ab0('0x5c')](',');var _0x41f3aa={};_0x41f3aa[_0x10d648[0x0]]={'$gte':moment(_0x10d648[0x1])[_0x1ab0('0x5d')](_0x1ab0('0x5e'))};_0x474707['where']=_[_0x1ab0('0x33')](_0x474707['where'],_0x41f3aa);}_0x474707=_['merge']({},_0x474707,_0x21f3c6['options']);return db[_0x1ab0('0x3d')][_0x1ab0('0x14')]({'where':_0x474707[_0x1ab0('0x30')]})['then'](function(_0x160805){_0x21eef9[_0x1ab0('0x14')]=_0x160805;if(_0x21f3c6['query']['includeAll']){_0x474707[_0x1ab0('0x37')]=[{'all':!![]}];}return db['MailMessage'][_0x1ab0('0x4a')](_0x474707);})['then'](function(_0x4fed26){_0x21eef9['rows']=_0x4fed26;return _0x21eef9;});}})[_0x1ab0('0x1b')](respondWithFilteredResult(_0x5e1336,_0x474707))[_0x1ab0('0x51')](handleError(_0x5e1336,null));};exports['addTags']=function(_0x51c5aa,_0x43665a,_0x16e20e){return db[_0x1ab0('0x21')][_0x1ab0('0x50')]({'where':{'id':_0x51c5aa[_0x1ab0('0x4d')]['id']}})[_0x1ab0('0x1b')](handleEntityNotFound(_0x43665a,null))[_0x1ab0('0x1b')](function(_0x314e92){if(_0x314e92){return _0x314e92['setTags'](_0x51c5aa[_0x1ab0('0x53')][_0x1ab0('0x56')],_['omit'](_0x51c5aa['body'],[_0x1ab0('0x56'),'id'])||{})[_0x1ab0('0x5f')](function(){return db[_0x1ab0('0x48')][_0x1ab0('0x4a')]({'attributes':['id',_0x1ab0('0x1e'),_0x1ab0('0x49')],'where':{'id':_0x51c5aa['body'][_0x1ab0('0x56')]}});})['then'](function(_0x1eec1a){socket[_0x1ab0('0x60')]('mailInteractionTags:save',{'id':Number(_0x51c5aa[_0x1ab0('0x4d')]['id']),'tags':_0x1eec1a||[]});return{'id':Number(_0x51c5aa[_0x1ab0('0x4d')]['id']),'tags':_0x1eec1a||[]};});}})[_0x1ab0('0x1b')](respondWithResult(_0x43665a,null))[_0x1ab0('0x51')](handleError(_0x43665a,null));};exports[_0x1ab0('0x61')]=function(_0xd8f44a,_0x12350d,_0x2aa5e9){var _0x40022b;return db[_0x1ab0('0x21')][_0x1ab0('0x50')]({'where':{'id':_0xd8f44a[_0x1ab0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x12350d,null))[_0x1ab0('0x1b')](function(_0x429390){if(_0x429390){return _0x429390[_0x1ab0('0x61')](_0xd8f44a['query'][_0x1ab0('0x56')]);}})['then'](respondWithStatusCode(_0x12350d,null))[_0x1ab0('0x51')](handleError(_0x12350d,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index b93c036..baec82d 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 _0xf259=['../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty','hook','events'];(function(_0x417699,_0xd54f87){var _0x279405=function(_0x5b2cff){while(--_0x5b2cff){_0x417699['push'](_0x417699['shift']());}};_0x279405(++_0xd54f87);}(_0xf259,0x1db));var _0x9f25=function(_0x5b6526,_0x544991){_0x5b6526=_0x5b6526-0x0;var _0x2a21e9=_0xf259[_0x5b6526];return _0x2a21e9;};'use strict';var EventEmitter=require(_0x9f25('0x0'));var MailInteraction=require(_0x9f25('0x1'))['db']['MailInteraction'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x9f25('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9f25('0x3')};function emitEvent(_0xb83e45){return function(_0x14e2e4,_0xb7b499,_0x2314ef){MailInteractionEvents['emit'](_0xb83e45+':'+_0x14e2e4['id'],_0x14e2e4);MailInteractionEvents[_0x9f25('0x4')](_0xb83e45,_0x14e2e4);_0x2314ef(null);};}for(var e in events){if(events[_0x9f25('0x5')](e)){var event=events[e];MailInteraction[_0x9f25('0x6')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xe4db=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0xe4db,0x1d8));var _0xbe4d=function(_0x4f2dfa,_0x2be505){_0x4f2dfa=_0x4f2dfa-0x0;var _0x1eebd2=_0xe4db[_0x4f2dfa];return _0x1eebd2;};'use strict';var EventEmitter=require(_0xbe4d('0x0'));var MailInteraction=require(_0xbe4d('0x1'))['db']['MailInteraction'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xbe4d('0x2')](0x0);var events={'afterCreate':_0xbe4d('0x3'),'afterUpdate':_0xbe4d('0x4'),'afterDestroy':_0xbe4d('0x5')};function emitEvent(_0x622525){return function(_0x25d4d7,_0xf79ffb,_0x8e0e4d){MailInteractionEvents[_0xbe4d('0x6')](_0x622525+':'+_0x25d4d7['id'],_0x25d4d7);MailInteractionEvents['emit'](_0x622525,_0x25d4d7);_0x8e0e4d(null);};}for(var e in events){if(events[_0xbe4d('0x7')](e)){var event=events[e];MailInteraction[_0xbe4d('0x8')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 8dc007b..708e174 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 _0xea11=['api','moment','bluebird','request-promise','exports','MailInteraction','mail_interactions','lodash','util'];(function(_0x480683,_0x5683d6){var _0xea4168=function(_0xd899f5){while(--_0xd899f5){_0x480683['push'](_0x480683['shift']());}};_0xea4168(++_0x5683d6);}(_0xea11,0x10c));var _0x1ea1=function(_0x3296c0,_0x2c3a86){_0x3296c0=_0x3296c0-0x0;var _0xad5062=_0xea11[_0x3296c0];return _0xad5062;};'use strict';var _=require(_0x1ea1('0x0'));var util=require(_0x1ea1('0x1'));var logger=require('../../config/logger')(_0x1ea1('0x2'));var moment=require(_0x1ea1('0x3'));var BPromise=require(_0x1ea1('0x4'));var rp=require(_0x1ea1('0x5'));var attributes=require('./mailInteraction.attributes');module[_0x1ea1('0x6')]=function(_0x2654c6,_0x27a918){return _0x2654c6['define'](_0x1ea1('0x7'),attributes,{'tableName':_0x1ea1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea44=['../../config/logger','api','bluebird','request-promise','exports','define','mail_interactions','lodash','util'];(function(_0x567aca,_0x5b2e88){var _0x59cf3f=function(_0xca96bf){while(--_0xca96bf){_0x567aca['push'](_0x567aca['shift']());}};_0x59cf3f(++_0x5b2e88);}(_0xea44,0x1a5));var _0x4ea4=function(_0x2f0347,_0x5a389a){_0x2f0347=_0x2f0347-0x0;var _0x544d77=_0xea44[_0x2f0347];return _0x544d77;};'use strict';var _=require(_0x4ea4('0x0'));var util=require(_0x4ea4('0x1'));var logger=require(_0x4ea4('0x2'))(_0x4ea4('0x3'));var moment=require('moment');var BPromise=require(_0x4ea4('0x4'));var rp=require(_0x4ea4('0x5'));var attributes=require('./mailInteraction.attributes');module[_0x4ea4('0x6')]=function(_0xc6a4af,_0x363590){return _0xc6a4af[_0x4ea4('0x7')]('MailInteraction',attributes,{'tableName':_0x4ea4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index eb643c3..dec06d1 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 _0x1d21=['info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','UpdateMailInteraction','MailInteraction','update','options','raw','where','attributes','AddTagsToMailInteraction','find','body','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','http','localhost','./mailInteraction.socket','register','request','then'];(function(_0x47de9a,_0x40cf23){var _0x4b9d6c=function(_0x507054){while(--_0x507054){_0x47de9a['push'](_0x47de9a['shift']());}};_0x4b9d6c(++_0x40cf23);}(_0x1d21,0xb1));var _0x11d2=function(_0x48f7cf,_0x4baa04){_0x48f7cf=_0x48f7cf-0x0;var _0xc201c0=_0x1d21[_0x48f7cf];return _0xc201c0;};'use strict';var _=require('lodash');var util=require(_0x11d2('0x0'));var moment=require(_0x11d2('0x1'));var BPromise=require(_0x11d2('0x2'));var rs=require(_0x11d2('0x3'));var fs=require('fs');var db=require(_0x11d2('0x4'))['db'];var utils=require(_0x11d2('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x11d2('0x6'));var client=jayson['client'][_0x11d2('0x7')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0x11d2('0x8'),'port':0x18eb});require(_0x11d2('0x9'))[_0x11d2('0xa')](socket);function respondWithRpcPromise(_0x49a874,_0x18efc7,_0x2ead4d){return new BPromise(function(_0x2052aa,_0x43501c){return client[_0x11d2('0xb')](_0x49a874,_0x2ead4d)[_0x11d2('0xc')](function(_0x802e76){logger[_0x11d2('0xd')](_0x11d2('0xe'),_0x18efc7,'request\x20sent');logger[_0x11d2('0xf')](_0x11d2('0x10'),_0x18efc7,'request\x20sent',JSON[_0x11d2('0x11')](_0x802e76));if(_0x802e76['error']){if(_0x802e76[_0x11d2('0x12')][_0x11d2('0x13')]===0x1f4){logger[_0x11d2('0x12')](_0x11d2('0xe'),_0x18efc7,_0x802e76['error'][_0x11d2('0x14')]);return _0x43501c(_0x802e76[_0x11d2('0x12')][_0x11d2('0x14')]);}logger[_0x11d2('0x12')](_0x11d2('0xe'),_0x18efc7,_0x802e76[_0x11d2('0x12')]['message']);return _0x2052aa(_0x802e76[_0x11d2('0x12')][_0x11d2('0x14')]);}else{logger[_0x11d2('0xd')](_0x11d2('0xe'),_0x18efc7,_0x11d2('0x15'));_0x2052aa(_0x802e76[_0x11d2('0x16')][_0x11d2('0x14')]);}})[_0x11d2('0x17')](function(_0x5992aa){logger[_0x11d2('0x12')](_0x11d2('0xe'),_0x18efc7,_0x5992aa);_0x43501c(_0x5992aa);});});}exports[_0x11d2('0x18')]=function(_0x5e6a30){var _0x4a822c=this;return new Promise(function(_0x24bacd,_0xa60b20){return db[_0x11d2('0x19')][_0x11d2('0x1a')](_0x5e6a30['body'],{'raw':_0x5e6a30['options']?_0x5e6a30[_0x11d2('0x1b')][_0x11d2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e6a30['options']?_0x5e6a30['options'][_0x11d2('0x1d')]||null:null,'attributes':_0x5e6a30['options']?_0x5e6a30[_0x11d2('0x1b')][_0x11d2('0x1e')]||null:null,'limit':_0x5e6a30[_0x11d2('0x1b')]?_0x5e6a30[_0x11d2('0x1b')]['limit']||null:null})['then'](function(_0x52b870){logger[_0x11d2('0xd')](_0x11d2('0x18'),_0x5e6a30);logger['debug'](_0x11d2('0x18'),_0x5e6a30,JSON['stringify'](_0x52b870));_0x24bacd(_0x52b870);})[_0x11d2('0x17')](function(_0x7abc91){logger['error'](_0x11d2('0x18'),_0x7abc91[_0x11d2('0x14')],_0x5e6a30);_0xa60b20(_0x4a822c[_0x11d2('0x12')](0x1f4,_0x7abc91[_0x11d2('0x14')]));});});};exports[_0x11d2('0x1f')]=function(_0x460074){return new Promise(function(_0x597f34,_0x4d6a4e){return db[_0x11d2('0x19')][_0x11d2('0x20')]({'where':_0x460074[_0x11d2('0x1b')]?_0x460074['options'][_0x11d2('0x1d')]||null:null})[_0x11d2('0xc')](function(_0x49479b){if(_0x49479b){return _0x49479b['addTags'](_0x460074[_0x11d2('0x21')][_0x11d2('0x22')],_[_0x11d2('0x23')](_0x460074[_0x11d2('0x21')],[_0x11d2('0x22'),'id'])||{});}})[_0x11d2('0x24')](function(_0x4e87b8){logger[_0x11d2('0xd')](_0x11d2('0x25'),_0x460074);logger[_0x11d2('0xf')](_0x11d2('0x25'),_0x460074,JSON['stringify'](_0x4e87b8));_0x597f34(_0x4e87b8);})[_0x11d2('0x17')](function(_0x21b77f){logger[_0x11d2('0x12')]('AddTags',_0x21b77f[_0x11d2('0x14')],_0x460074);_0x4d6a4e(_this[_0x11d2('0x12')](0x1f4,_0x21b77f[_0x11d2('0x14')]));});});}; \ No newline at end of file +var _0x8d21=['raw','where','attributes','limit','debug','catch','AddTagsToMailInteraction','find','omit','ids','spread','AddTags','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','UpdateMailInteraction','MailInteraction','update','body','options'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0x8d21,0x116));var _0x18d2=function(_0x45b3ec,_0x254209){_0x45b3ec=_0x45b3ec-0x0;var _0x159e6e=_0x8d21[_0x45b3ec];return _0x159e6e;};'use strict';var _=require(_0x18d2('0x0'));var util=require('util');var moment=require(_0x18d2('0x1'));var BPromise=require('bluebird');var rs=require(_0x18d2('0x2'));var fs=require('fs');var db=require(_0x18d2('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x18d2('0x4'))(_0x18d2('0x5'));var config=require(_0x18d2('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});var socket=require(_0x18d2('0x7'))({'host':'localhost','port':0x18eb});require(_0x18d2('0x8'))[_0x18d2('0x9')](socket);function respondWithRpcPromise(_0x4f8e03,_0xdbb3d,_0x22ad31){return new BPromise(function(_0x19a03f,_0xc4b25e){return client[_0x18d2('0xa')](_0x4f8e03,_0x22ad31)[_0x18d2('0xb')](function(_0x5e7661){logger[_0x18d2('0xc')](_0x18d2('0xd'),_0xdbb3d,'request\x20sent');logger['debug'](_0x18d2('0xe'),_0xdbb3d,'request\x20sent',JSON[_0x18d2('0xf')](_0x5e7661));if(_0x5e7661[_0x18d2('0x10')]){if(_0x5e7661[_0x18d2('0x10')][_0x18d2('0x11')]===0x1f4){logger[_0x18d2('0x10')](_0x18d2('0xd'),_0xdbb3d,_0x5e7661[_0x18d2('0x10')]['message']);return _0xc4b25e(_0x5e7661[_0x18d2('0x10')]['message']);}logger[_0x18d2('0x10')](_0x18d2('0xd'),_0xdbb3d,_0x5e7661[_0x18d2('0x10')][_0x18d2('0x12')]);return _0x19a03f(_0x5e7661['error']['message']);}else{logger[_0x18d2('0xc')](_0x18d2('0xd'),_0xdbb3d,_0x18d2('0x13'));_0x19a03f(_0x5e7661[_0x18d2('0x14')]['message']);}})['catch'](function(_0x33759e){logger[_0x18d2('0x10')](_0x18d2('0xd'),_0xdbb3d,_0x33759e);_0xc4b25e(_0x33759e);});});}exports[_0x18d2('0x15')]=function(_0x568316){var _0x40857e=this;return new Promise(function(_0x41401c,_0x2ccdc3){return db[_0x18d2('0x16')][_0x18d2('0x17')](_0x568316[_0x18d2('0x18')],{'raw':_0x568316[_0x18d2('0x19')]?_0x568316[_0x18d2('0x19')][_0x18d2('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x568316[_0x18d2('0x19')]?_0x568316[_0x18d2('0x19')][_0x18d2('0x1b')]||null:null,'attributes':_0x568316[_0x18d2('0x19')]?_0x568316[_0x18d2('0x19')][_0x18d2('0x1c')]||null:null,'limit':_0x568316[_0x18d2('0x19')]?_0x568316[_0x18d2('0x19')][_0x18d2('0x1d')]||null:null})[_0x18d2('0xb')](function(_0x50a9a0){logger[_0x18d2('0xc')]('UpdateMailInteraction',_0x568316);logger[_0x18d2('0x1e')](_0x18d2('0x15'),_0x568316,JSON['stringify'](_0x50a9a0));_0x41401c(_0x50a9a0);})[_0x18d2('0x1f')](function(_0xfc3ab4){logger[_0x18d2('0x10')](_0x18d2('0x15'),_0xfc3ab4[_0x18d2('0x12')],_0x568316);_0x2ccdc3(_0x40857e[_0x18d2('0x10')](0x1f4,_0xfc3ab4[_0x18d2('0x12')]));});});};exports[_0x18d2('0x20')]=function(_0x38cb84){return new Promise(function(_0x3941d7,_0x5d472b){return db[_0x18d2('0x16')][_0x18d2('0x21')]({'where':_0x38cb84[_0x18d2('0x19')]?_0x38cb84[_0x18d2('0x19')][_0x18d2('0x1b')]||null:null})[_0x18d2('0xb')](function(_0x310bb8){if(_0x310bb8){return _0x310bb8['addTags'](_0x38cb84[_0x18d2('0x18')]['ids'],_[_0x18d2('0x22')](_0x38cb84[_0x18d2('0x18')],[_0x18d2('0x23'),'id'])||{});}})[_0x18d2('0x24')](function(_0x243f28){logger[_0x18d2('0xc')](_0x18d2('0x25'),_0x38cb84);logger[_0x18d2('0x1e')]('AddTags',_0x38cb84,JSON[_0x18d2('0xf')](_0x243f28));_0x3941d7(_0x243f28);})[_0x18d2('0x1f')](function(_0x145d5a){logger[_0x18d2('0x10')](_0x18d2('0x25'),_0x145d5a[_0x18d2('0x12')],_0x38cb84);_0x5d472b(_this['error'](0x1f4,_0x145d5a['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 3895b03..773cffb 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 _0x8f16=['update','emit','removeListener','length','./mailInteraction.events','save','remove'];(function(_0x56bbee,_0xa53b0e){var _0x2f8a3d=function(_0x4810fe){while(--_0x4810fe){_0x56bbee['push'](_0x56bbee['shift']());}};_0x2f8a3d(++_0xa53b0e);}(_0x8f16,0xcf));var _0x68f1=function(_0xfbca44,_0x1888c6){_0xfbca44=_0xfbca44-0x0;var _0x1f3b5a=_0x8f16[_0xfbca44];return _0x1f3b5a;};'use strict';var MailInteractionEvents=require(_0x68f1('0x0'));var events=[_0x68f1('0x1'),_0x68f1('0x2'),_0x68f1('0x3')];function createListener(_0x4e2b40,_0x2846c4){return function(_0x170220){_0x2846c4[_0x68f1('0x4')](_0x4e2b40,_0x170220);};}function removeListener(_0x34a2a3,_0x303ff9){return function(){MailInteractionEvents[_0x68f1('0x5')](_0x34a2a3,_0x303ff9);};}exports['register']=function(_0xfaba30){for(var _0x934e8c=0x0,_0x4e459c=events[_0x68f1('0x6')];_0x934e8c<_0x4e459c;_0x934e8c++){var _0x386211=events[_0x934e8c];var _0x429891=createListener('mailInteraction:'+_0x386211,_0xfaba30);MailInteractionEvents['on'](_0x386211,_0x429891);}}; \ No newline at end of file +var _0x61cc=['mailInteraction:','./mailInteraction.events','removeListener','register','length'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x61cc,0x132));var _0xc61c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x61cc[_0x5b644e];return _0x49c6bf;};'use strict';var MailInteractionEvents=require(_0xc61c('0x0'));var events=['save','remove','update'];function createListener(_0x18cd34,_0x28c451){return function(_0x1b5fd2){_0x28c451['emit'](_0x18cd34,_0x1b5fd2);};}function removeListener(_0x133762,_0x25de48){return function(){MailInteractionEvents[_0xc61c('0x1')](_0x133762,_0x25de48);};}exports[_0xc61c('0x2')]=function(_0x31b050){for(var _0xab6a7f=0x0,_0x4ae568=events[_0xc61c('0x3')];_0xab6a7f<_0x4ae568;_0xab6a7f++){var _0x58dd8d=events[_0xab6a7f];var _0x40c428=createListener(_0xc61c('0x4')+_0x58dd8d,_0x31b050);MailInteractionEvents['on'](_0x58dd8d,_0x40c428);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index d0cde56..5209697 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 _0x94c6=['describe','/:id','show','tracked','mail','create','update','put','accept','reject','delete','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x12c2c5,_0x3f84a6){var _0x3572d2=function(_0x4adbad){while(--_0x4adbad){_0x12c2c5['push'](_0x12c2c5['shift']());}};_0x3572d2(++_0x3f84a6);}(_0x94c6,0x12c));var _0x694c=function(_0x4e2826,_0x1495b2){_0x4e2826=_0x4e2826-0x0;var _0x47677c=_0x94c6[_0x4e2826];return _0x47677c;};'use strict';var multer=require('multer');var util=require(_0x694c('0x0'));var path=require(_0x694c('0x1'));var express=require(_0x694c('0x2'));var router=express[_0x694c('0x3')]();var auth=require(_0x694c('0x4'));var interaction=require(_0x694c('0x5'));var config=require(_0x694c('0x6'));var controller=require(_0x694c('0x7'));router[_0x694c('0x8')]('/',auth[_0x694c('0x9')](),controller[_0x694c('0xa')]);router[_0x694c('0x8')](_0x694c('0xb'),auth[_0x694c('0x9')](),controller[_0x694c('0xc')]);router[_0x694c('0x8')](_0x694c('0xd'),auth[_0x694c('0x9')](),controller[_0x694c('0xe')]);router['post']('/',auth[_0x694c('0x9')](),interaction[_0x694c('0xf')](_0x694c('0x10'),'mailmessage:create'),controller[_0x694c('0x11')]);router['put'](_0x694c('0xd'),auth[_0x694c('0x9')](),controller[_0x694c('0x12')]);router[_0x694c('0x13')]('/:id/accept',auth[_0x694c('0x9')](),controller[_0x694c('0x14')]);router[_0x694c('0x13')]('/:id/reject',auth[_0x694c('0x9')](),controller[_0x694c('0x15')]);router[_0x694c('0x16')]('/:id',auth[_0x694c('0x9')](),controller[_0x694c('0x17')]);module['exports']=router; \ No newline at end of file +var _0x0219=['delete','multer','util','path','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','show','post','tracked','mail','create','put','/:id','accept','/:id/reject','reject'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0219,0x79));var _0x9021=function(_0x22eb51,_0x2e6718){_0x22eb51=_0x22eb51-0x0;var _0x534caa=_0x0219[_0x22eb51];return _0x534caa;};'use strict';var multer=require(_0x9021('0x0'));var util=require(_0x9021('0x1'));var path=require(_0x9021('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x9021('0x3'));var interaction=require(_0x9021('0x4'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0x9021('0x5')]('/',auth[_0x9021('0x6')](),controller[_0x9021('0x7')]);router['get']('/describe',auth[_0x9021('0x6')](),controller[_0x9021('0x8')]);router[_0x9021('0x5')]('/:id',auth[_0x9021('0x6')](),controller[_0x9021('0x9')]);router[_0x9021('0xa')]('/',auth[_0x9021('0x6')](),interaction[_0x9021('0xb')](_0x9021('0xc'),'mailmessage:create'),controller[_0x9021('0xd')]);router[_0x9021('0xe')](_0x9021('0xf'),auth[_0x9021('0x6')](),controller['update']);router[_0x9021('0xe')]('/:id/accept',auth[_0x9021('0x6')](),controller[_0x9021('0x10')]);router[_0x9021('0xe')](_0x9021('0x11'),auth[_0x9021('0x6')](),controller[_0x9021('0x12')]);router[_0x9021('0x13')](_0x9021('0xf'),auth[_0x9021('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 02c8380..69576aa 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 _0x1cbb=['sequelize','lodash','exports','TEXT','BOOLEAN','ENUM','STRING','long','DATE'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x1cbb,0x105));var _0xb1cb=function(_0x3c73a8,_0x340042){_0x3c73a8=_0x3c73a8-0x0;var _0x10064e=_0x1cbb[_0x3c73a8];return _0x10064e;};'use strict';var Sequelize=require(_0xb1cb('0x0'));var _=require(_0xb1cb('0x1'));module[_0xb1cb('0x2')]={'body':{'type':Sequelize[_0xb1cb('0x3')]('long'),'allowNull':![]},'read':{'type':Sequelize[_0xb1cb('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb1cb('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xb1cb('0x6')](0xbe)},'from':{'type':Sequelize[_0xb1cb('0x6')]},'to':{'type':Sequelize[_0xb1cb('0x3')](_0xb1cb('0x7'))},'cc':{'type':Sequelize[_0xb1cb('0x3')](_0xb1cb('0x7'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0xb1cb('0x3')]},'sentAt':{'type':Sequelize[_0xb1cb('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xb1cb('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xb1cb('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0xb1cb('0x7'))},'originCc':{'type':Sequelize[_0xb1cb('0x3')](_0xb1cb('0x7'))}}; \ No newline at end of file +var _0xe4a5=['sequelize','lodash','exports','TEXT','long','BOOLEAN','out','STRING','INTEGER'];(function(_0x4af859,_0x73b4ed){var _0x85d557=function(_0xb86211){while(--_0xb86211){_0x4af859['push'](_0x4af859['shift']());}};_0x85d557(++_0x73b4ed);}(_0xe4a5,0xea));var _0x5e4a=function(_0x48f8c4,_0x4e3dba){_0x48f8c4=_0x48f8c4-0x0;var _0x118849=_0xe4a5[_0x48f8c4];return _0x118849;};'use strict';var Sequelize=require(_0x5e4a('0x0'));var _=require(_0x5e4a('0x1'));module[_0x5e4a('0x2')]={'body':{'type':Sequelize[_0x5e4a('0x3')](_0x5e4a('0x4')),'allowNull':![]},'read':{'type':Sequelize[_0x5e4a('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5e4a('0x6')),'defaultValue':_0x5e4a('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5e4a('0x7')](0xbe)},'from':{'type':Sequelize[_0x5e4a('0x7')]},'to':{'type':Sequelize[_0x5e4a('0x3')](_0x5e4a('0x4'))},'cc':{'type':Sequelize[_0x5e4a('0x3')]('long')},'bcc':{'type':Sequelize[_0x5e4a('0x3')](_0x5e4a('0x4'))},'subject':{'type':Sequelize[_0x5e4a('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x5e4a('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x5e4a('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x5e4a('0x3')]('long')},'originCc':{'type':Sequelize[_0x5e4a('0x3')](_0x5e4a('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index b144901..e9586cd 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 _0x4b8a=['fields','length','hasOwnProperty','nolimit','sort','where','pick','add','day','merge','filter','map','includeAll','rows','show','params','include','options','find','body','describe','create','direction','out','secret','MailAccount','findOne','MailAccountId','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','basename','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','UserId','CmContact','Contact','get','MailInteraction','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','mail-interactions','agent','role','RejectMessage','rejectMessage','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','end','stack','name','send','index','MailMessage','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes'];(function(_0x3fa59c,_0x2302f9){var _0x239a2c=function(_0x410d0f){while(--_0x410d0f){_0x3fa59c['push'](_0x3fa59c['shift']());}};_0x239a2c(++_0x2302f9);}(_0x4b8a,0xd3));var _0xa4b8=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4b8a[_0x3bf83f];return _0x22c4a9;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xa4b8('0x0'));var moment=require('moment');var BPromise=require(_0xa4b8('0x1'));var Mustache=require(_0xa4b8('0x2'));var util=require(_0xa4b8('0x3'));var path=require(_0xa4b8('0x4'));var sox=require(_0xa4b8('0x5'));var csv=require(_0xa4b8('0x6'));var ejs=require(_0xa4b8('0x7'));var fs=require('fs');var _=require(_0xa4b8('0x8'));var squel=require(_0xa4b8('0x9'));var crypto=require(_0xa4b8('0xa'));var jsforce=require(_0xa4b8('0xb'));var deskjs=require(_0xa4b8('0xc'));var toCsv=require(_0xa4b8('0x6'));var querystring=require(_0xa4b8('0xd'));var Papa=require('papaparse');var qs=require(_0xa4b8('0xe'));var logger=require(_0xa4b8('0xf'))(_0xa4b8('0x10'));var utils=require(_0xa4b8('0x11'));var config=require(_0xa4b8('0x12'));var db=require(_0xa4b8('0x13'))['db'];var socket=require(_0xa4b8('0x14'))({'host':_0xa4b8('0x15'),'port':0x18eb});require(_0xa4b8('0x16'))[_0xa4b8('0x17')](socket);var jayson=require(_0xa4b8('0x18'));var client=jayson[_0xa4b8('0x19')][_0xa4b8('0x1a')]({'port':0x232c});var client9003=jayson[_0xa4b8('0x19')]['http']({'port':0x232b});var client9002=jayson['client'][_0xa4b8('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x488b99,_0x1da512,_0x43481b,_0x5ab232){return new BPromise(function(_0x2f3199,_0x157d7f){var _0x1c8369=_0x5ab232||client;return _0x1c8369[_0xa4b8('0x1b')](_0x488b99,_0x43481b)[_0xa4b8('0x1c')](function(_0x3bba1b){logger[_0xa4b8('0x1d')](_0xa4b8('0x1e'),_0x1da512,_0xa4b8('0x1f'));logger['debug'](_0xa4b8('0x20'),_0x1da512,_0xa4b8('0x1f'),JSON['stringify'](_0x3bba1b));if(_0x3bba1b[_0xa4b8('0x21')]){if(_0x3bba1b[_0xa4b8('0x21')][_0xa4b8('0x22')]===0x1f4){logger[_0xa4b8('0x21')](_0xa4b8('0x1e'),_0x1da512,_0x3bba1b['error']['message']);return _0x157d7f(_0x3bba1b['error']['message']);}logger[_0xa4b8('0x21')](_0xa4b8('0x1e'),_0x1da512,_0x3bba1b[_0xa4b8('0x21')][_0xa4b8('0x23')]);return _0x2f3199(_0x3bba1b[_0xa4b8('0x21')][_0xa4b8('0x23')]);}else{logger[_0xa4b8('0x1d')](_0xa4b8('0x1e'),_0x1da512,_0xa4b8('0x1f'));_0x2f3199(_0x3bba1b[_0xa4b8('0x24')][_0xa4b8('0x23')]);}})[_0xa4b8('0x25')](function(_0x144e62){logger[_0xa4b8('0x21')](_0xa4b8('0x1e'),_0x1da512,_0x144e62);_0x157d7f(_0x144e62);});});}function respondWithStatusCode(_0xeb5ae1,_0x34f5d2){_0x34f5d2=_0x34f5d2||0xcc;return function(_0x4b28ae){if(_0x4b28ae){return _0xeb5ae1[_0xa4b8('0x26')](_0x34f5d2);}return _0xeb5ae1[_0xa4b8('0x27')](_0x34f5d2)['end']();};}function respondWithResult(_0xf5638b,_0x1f66a7){_0x1f66a7=_0x1f66a7||0xc8;return function(_0x5b0257){if(_0x5b0257){return _0xf5638b['status'](_0x1f66a7)['json'](_0x5b0257);}};}function respondWithFilteredResult(_0xc17660,_0x2adaa0){return function(_0x239b62){if(_0x239b62){var _0xa11b76=_0x239b62[_0xa4b8('0x28')],_0x5242ec=_0x2adaa0[_0xa4b8('0x29')],_0x3ff3de=_0x2adaa0['offset']+_0x2adaa0[_0xa4b8('0x2a')],_0x1508fe;if(_0x3ff3de>=_0xa11b76){_0x3ff3de=_0xa11b76;_0x1508fe=0xc8;}else{_0x1508fe=0xce;}_0xc17660[_0xa4b8('0x27')](_0x1508fe);return _0xc17660[_0xa4b8('0x2b')](_0xa4b8('0x2c'),_0x5242ec+'-'+_0x3ff3de+'/'+_0xa11b76)[_0xa4b8('0x2d')](_0x239b62);}return null;};}function patchUpdates(_0x3a6652){return function(_0x3d60ff){try{jsonpatch[_0xa4b8('0x2e')](_0x3d60ff,_0x3a6652,!![]);}catch(_0x2005c1){return BPromise[_0xa4b8('0x2f')](_0x2005c1);}return _0x3d60ff[_0xa4b8('0x30')]();};}function saveUpdates(_0x127d1d,_0x513aa8){return function(_0x218f56){if(_0x218f56){return _0x218f56[_0xa4b8('0x31')](_0x127d1d)[_0xa4b8('0x1c')](function(_0x574b6c){return _0x574b6c;});}return null;};}function removeEntity(_0x3b87b0,_0x4485af){return function(_0x50729e){if(_0x50729e){return _0x50729e['destroy']()['then'](function(){_0x3b87b0['status'](0xcc)[_0xa4b8('0x32')]();});}};}function handleEntityNotFound(_0x555c5c,_0x6ef72a){return function(_0x34f9a5){if(!_0x34f9a5){_0x555c5c[_0xa4b8('0x26')](0x194);}return _0x34f9a5;};}function handleError(_0x5abb24,_0x463797){_0x463797=_0x463797||0x1f4;return function(_0x2e9c41){logger[_0xa4b8('0x21')](_0x2e9c41[_0xa4b8('0x33')]);if(_0x2e9c41[_0xa4b8('0x34')]){delete _0x2e9c41['name'];}_0x5abb24[_0xa4b8('0x27')](_0x463797)[_0xa4b8('0x35')](_0x2e9c41);};}exports[_0xa4b8('0x36')]=function(_0xa590e,_0x32fc2a){var _0x2c11bc={},_0x3d773d={},_0x4f923c={'count':0x0,'rows':[]};var _0x395aea=db[_0xa4b8('0x37')][_0xa4b8('0x38')];_0x3d773d[_0xa4b8('0x39')]=_[_0xa4b8('0x3a')](_0x395aea);var _0x4c236c={'dateStart':_0xa590e[_0xa4b8('0x3b')][_0xa4b8('0x3c')],'dateEnd':_0xa590e[_0xa4b8('0x3b')][_0xa4b8('0x3d')]};delete _0xa590e['query']['dateStart'];delete _0xa590e[_0xa4b8('0x3b')][_0xa4b8('0x3d')];_0x3d773d[_0xa4b8('0x3b')]=_[_0xa4b8('0x3a')](_0xa590e[_0xa4b8('0x3b')]);_0x3d773d[_0xa4b8('0x3e')]=_[_0xa4b8('0x3f')](_0x3d773d[_0xa4b8('0x39')],_0x3d773d[_0xa4b8('0x3b')]);_0x2c11bc[_0xa4b8('0x40')]=_[_0xa4b8('0x3f')](_0x3d773d[_0xa4b8('0x39')],qs[_0xa4b8('0x41')](_0xa590e[_0xa4b8('0x3b')]['fields']));_0x2c11bc[_0xa4b8('0x40')]=_0x2c11bc['attributes'][_0xa4b8('0x42')]?_0x2c11bc[_0xa4b8('0x40')]:_0x3d773d['model'];if(!_0xa590e['query'][_0xa4b8('0x43')](_0xa4b8('0x44'))){_0x2c11bc[_0xa4b8('0x2a')]=qs[_0xa4b8('0x2a')](_0xa590e[_0xa4b8('0x3b')][_0xa4b8('0x2a')]);_0x2c11bc['offset']=qs[_0xa4b8('0x29')](_0xa590e[_0xa4b8('0x3b')][_0xa4b8('0x29')]);}_0x2c11bc['order']=qs[_0xa4b8('0x45')](_0xa590e[_0xa4b8('0x3b')][_0xa4b8('0x45')]);_0x2c11bc[_0xa4b8('0x46')]=qs[_0xa4b8('0x3e')](_[_0xa4b8('0x47')](_0xa590e[_0xa4b8('0x3b')],_0x3d773d[_0xa4b8('0x3e')]));if(_0x4c236c[_0xa4b8('0x3c')]){if(_0x4c236c['dateEnd']){_0x4c236c[_0xa4b8('0x3d')]=moment(_0x4c236c[_0xa4b8('0x3d')])[_0xa4b8('0x48')](0x1,_0xa4b8('0x49'));}else{_0x4c236c[_0xa4b8('0x3d')]=moment(_0x4c236c[_0xa4b8('0x3c')])[_0xa4b8('0x48')](0x1,'day');}_[_0xa4b8('0x4a')](_0x2c11bc['where'],{'createdAt':{'$gte':_0x4c236c[_0xa4b8('0x3c')],'$lte':_0x4c236c[_0xa4b8('0x3d')]}});}if(_0xa590e['query'][_0xa4b8('0x4b')]){_0x2c11bc['where']=_[_0xa4b8('0x4a')](_0x2c11bc[_0xa4b8('0x46')],{'$or':_[_0xa4b8('0x4c')](_0x2c11bc[_0xa4b8('0x40')],function(_0x1c3a2f){var _0x162854={};_0x162854[_0x1c3a2f]={'$like':'%'+_0xa590e[_0xa4b8('0x3b')][_0xa4b8('0x4b')]+'%'};return _0x162854;})});}_0x2c11bc=_[_0xa4b8('0x4a')]({},_0x2c11bc,_0xa590e['options']);var _0xae0c15={'where':_0x2c11bc['where']};return db[_0xa4b8('0x37')][_0xa4b8('0x28')](_0xae0c15)[_0xa4b8('0x1c')](function(_0x551638){_0x4f923c['count']=_0x551638;if(_0xa590e[_0xa4b8('0x3b')][_0xa4b8('0x4d')]){_0x2c11bc['include']=[{'all':!![]}];}return db[_0xa4b8('0x37')]['findAll'](_0x2c11bc);})[_0xa4b8('0x1c')](function(_0x6b9b99){_0x4f923c[_0xa4b8('0x4e')]=_0x6b9b99;return _0x4f923c;})['then'](respondWithFilteredResult(_0x32fc2a,_0x2c11bc))[_0xa4b8('0x25')](handleError(_0x32fc2a,null));};exports[_0xa4b8('0x4f')]=function(_0x396db2,_0x57f8ab){var _0x57d027={'raw':!![],'where':{'id':_0x396db2[_0xa4b8('0x50')]['id']}},_0x36a0d2={};_0x36a0d2[_0xa4b8('0x39')]=_[_0xa4b8('0x3a')](db[_0xa4b8('0x37')]['rawAttributes']);_0x36a0d2[_0xa4b8('0x3b')]=_['keys'](_0x396db2[_0xa4b8('0x3b')]);_0x36a0d2[_0xa4b8('0x3e')]=_[_0xa4b8('0x3f')](_0x36a0d2['model'],_0x36a0d2[_0xa4b8('0x3b')]);_0x57d027[_0xa4b8('0x40')]=_[_0xa4b8('0x3f')](_0x36a0d2[_0xa4b8('0x39')],qs[_0xa4b8('0x41')](_0x396db2[_0xa4b8('0x3b')][_0xa4b8('0x41')]));_0x57d027[_0xa4b8('0x40')]=_0x57d027[_0xa4b8('0x40')][_0xa4b8('0x42')]?_0x57d027[_0xa4b8('0x40')]:_0x36a0d2['model'];if(_0x396db2[_0xa4b8('0x3b')][_0xa4b8('0x4d')]){_0x57d027[_0xa4b8('0x51')]=[{'all':!![]}];}_0x57d027=_[_0xa4b8('0x4a')]({},_0x57d027,_0x396db2[_0xa4b8('0x52')]);return db[_0xa4b8('0x37')][_0xa4b8('0x53')](_0x57d027)['then'](handleEntityNotFound(_0x57f8ab,null))['then'](respondWithResult(_0x57f8ab,null))[_0xa4b8('0x25')](handleError(_0x57f8ab,null));};exports[_0xa4b8('0x31')]=function(_0x532741,_0x559403){if(_0x532741['body']['id']){delete _0x532741['body']['id'];}return db['MailMessage'][_0xa4b8('0x53')]({'where':{'id':_0x532741[_0xa4b8('0x50')]['id']}})[_0xa4b8('0x1c')](handleEntityNotFound(_0x559403,null))[_0xa4b8('0x1c')](saveUpdates(_0x532741[_0xa4b8('0x54')],null))[_0xa4b8('0x1c')](respondWithResult(_0x559403,null))['catch'](handleError(_0x559403,null));};exports['destroy']=function(_0x503cdc,_0x52f331){return db[_0xa4b8('0x37')][_0xa4b8('0x53')]({'where':{'id':_0x503cdc[_0xa4b8('0x50')]['id']}})['then'](handleEntityNotFound(_0x52f331,null))[_0xa4b8('0x1c')](removeEntity(_0x52f331,null))['catch'](handleError(_0x52f331,null));};exports[_0xa4b8('0x55')]=function(_0x53164c,_0x560a40){return db['MailMessage'][_0xa4b8('0x55')]()['then'](respondWithResult(_0x560a40,null))[_0xa4b8('0x25')](handleError(_0x560a40,null));};exports[_0xa4b8('0x56')]=function(_0x25ddb1,_0x4fb182){return db[_0xa4b8('0x37')][_0xa4b8('0x56')](_0x25ddb1[_0xa4b8('0x54')])[_0xa4b8('0x1c')](function(_0x2dd93e){if(_0x2dd93e){if(_0x2dd93e[_0xa4b8('0x57')]===_0xa4b8('0x58')&&!_0x2dd93e[_0xa4b8('0x59')]){return db[_0xa4b8('0x5a')][_0xa4b8('0x5b')]({'where':{'id':_0x2dd93e[_0xa4b8('0x5c')]},'include':[{'model':db[_0xa4b8('0x5d')],'as':_0xa4b8('0x5e'),'raw':!![]}]})[_0xa4b8('0x1c')](function(_0x24eca8){if(_0x24eca8&&_0x24eca8[_0xa4b8('0x5e')]){var _0x157850={'tls':{'rejectUnauthorized':![]}};if(_[_0xa4b8('0x5f')](_0x24eca8[_0xa4b8('0x5e')][_0xa4b8('0x60')])){_0x157850[_0xa4b8('0x61')]=_0x24eca8[_0xa4b8('0x5e')][_0xa4b8('0x61')];_0x157850['port']=_0x24eca8[_0xa4b8('0x5e')][_0xa4b8('0x62')];_0x157850['secure']=_0x24eca8[_0xa4b8('0x5e')][_0xa4b8('0x63')];if(_0x24eca8['Smtp'][_0xa4b8('0x64')]){_0x157850[_0xa4b8('0x65')]={'user':_0x24eca8[_0xa4b8('0x5e')][_0xa4b8('0x66')],'pass':_0x24eca8['Smtp'][_0xa4b8('0x67')]};}}else{_0x157850['service']=_0x24eca8['Smtp']['service'];_0x157850['auth']={'user':_0x24eca8[_0xa4b8('0x5e')][_0xa4b8('0x66')],'pass':_0x24eca8[_0xa4b8('0x5e')][_0xa4b8('0x67')]};_0x157850[_0xa4b8('0x63')]=_0x24eca8[_0xa4b8('0x5e')][_0xa4b8('0x63')];}if(_0x25ddb1['body'][_0xa4b8('0x68')]&&_0x25ddb1[_0xa4b8('0x54')][_0xa4b8('0x68')][_0xa4b8('0x42')]){for(var _0x3962e6=0x0;_0x3962e6<_0x25ddb1['body'][_0xa4b8('0x68')][_0xa4b8('0x42')];_0x3962e6+=0x1){_0x25ddb1[_0xa4b8('0x54')][_0xa4b8('0x68')][_0x3962e6]={'filename':_0x25ddb1['body']['attachments'][_0x3962e6][_0xa4b8('0x34')],'path':path[_0xa4b8('0x69')](config[_0xa4b8('0x6a')],_0xa4b8('0x6b'),_0x25ddb1['body'][_0xa4b8('0x68')][_0x3962e6][_0xa4b8('0x6c')])};}}return{'account':_0x157850,'message':_0x25ddb1[_0xa4b8('0x54')]};}})[_0xa4b8('0x1c')](function(_0x50c735){if(_0x50c735){return respondWithRpcPromise(_0xa4b8('0x6d'),'sendMail',_0x50c735,client9003)[_0xa4b8('0x1c')](function(_0x44835f){return _0x2dd93e['update']({'read':!![],'messageId':_0x44835f[_0xa4b8('0x6e')],'sentAt':moment()[_0xa4b8('0x6f')](_0xa4b8('0x70'))});})['catch'](function(_0x1a6031){logger['error']('%s',JSON['stringify'](_0x1a6031));return _0x2dd93e;});}return _0x2dd93e;});}return _0x2dd93e;}})[_0xa4b8('0x1c')](respondWithResult(_0x4fb182,0xc9))[_0xa4b8('0x25')](handleError(_0x4fb182,null));};var interaction_log=require('../../config/logger')('mail-interactions');exports[_0xa4b8('0x71')]=function(_0x43481f,_0xe07b02,_0x16064d){var _0x3551f5={'channel':_0xa4b8('0x72')};if(_0x43481f[_0xa4b8('0x54')]['id']){delete _0x43481f[_0xa4b8('0x54')]['id'];}_0x43481f['body'][_0xa4b8('0x73')]=!![];_0x43481f[_0xa4b8('0x54')]['readAt']=moment()[_0xa4b8('0x6f')]('YYYY-MM-DD\x20HH:mm:ss');_0x43481f[_0xa4b8('0x54')]['UserId']=_0x43481f[_0xa4b8('0x54')][_0xa4b8('0x74')]||_0x43481f[_0xa4b8('0x66')]['id'];return db['MailMessage'][_0xa4b8('0x53')]({'where':{'id':_0x43481f[_0xa4b8('0x50')]['id'],'UserId':null},'include':[{'model':db[_0xa4b8('0x75')],'as':_0xa4b8('0x76')}]})[_0xa4b8('0x1c')](handleEntityNotFound(_0xe07b02,null))['then'](saveUpdates(_0x43481f[_0xa4b8('0x54')],null))[_0xa4b8('0x1c')](function(_0x17b60c){if(_0x17b60c){_0x3551f5[_0xa4b8('0x23')]=_0x17b60c[_0xa4b8('0x77')]({'plain':!![]});return db[_0xa4b8('0x78')][_0xa4b8('0x53')]({'where':{'id':_0x17b60c['MailInteractionId']}});}return null;})[_0xa4b8('0x1c')](handleEntityNotFound(_0xe07b02,null))['then'](function(_0x22d0e3){if(_0x22d0e3){return _0x22d0e3[_0xa4b8('0x31')]({'UserId':_0x43481f[_0xa4b8('0x54')][_0xa4b8('0x74')],'read1stAt':_['isNil'](_0x22d0e3[_0xa4b8('0x79')])?moment()[_0xa4b8('0x6f')](_0xa4b8('0x70')):undefined});}return null;})[_0xa4b8('0x1c')](function(_0x2c9cc2){if(_0x2c9cc2){_0x3551f5[_0xa4b8('0x7a')]=_0x2c9cc2[_0xa4b8('0x77')]({'plain':!![]});interaction_log[_0xa4b8('0x1d')](_0xa4b8('0x7b'),_0x43481f[_0xa4b8('0x66')]['id'],_0x43481f[_0xa4b8('0x66')][_0xa4b8('0x34')],_0x43481f[_0xa4b8('0x66')]['role'],_0x3551f5[_0xa4b8('0x7a')]['id'],_0x43481f[_0xa4b8('0x54')]?JSON[_0xa4b8('0x7c')](_0x43481f[_0xa4b8('0x54')]):_0xa4b8('0x7d'));return respondWithRpcPromise('AcceptMessage',_0xa4b8('0x7e'),_0x3551f5);}return null;})['then'](function(_0xc3778d){if(_0xc3778d){if(_0x43481f[_0xa4b8('0x54')][_0xa4b8('0x7f')]){_0x3551f5[_0xa4b8('0x23')]['interface']=util[_0xa4b8('0x6f')](_0xa4b8('0x80'),_0x43481f['user']['name']);_0x3551f5['message'][_0xa4b8('0x81')]=_0x3551f5[_0xa4b8('0x81')];_0x3551f5[_0xa4b8('0x23')][_0xa4b8('0x82')]=_0xa4b8('0x71');return respondWithRpcPromise('EventManager',_0xa4b8('0x83'),{'event':_0xa4b8('0x84'),'message':_0x3551f5['message']},client9002)[_0xa4b8('0x1c')](function(){return _0x3551f5;});}return _0x3551f5;}return null;})[_0xa4b8('0x1c')](respondWithResult(_0xe07b02,null))['catch'](handleError(_0xe07b02,null));};var interaction_log=require(_0xa4b8('0xf'))(_0xa4b8('0x85'));exports[_0xa4b8('0x2f')]=function(_0x18a536,_0x592b63,_0x388322){var _0x14067c={'agent':{},'channel':_0xa4b8('0x72')};if(_0x18a536[_0xa4b8('0x54')]['id']){delete _0x18a536[_0xa4b8('0x54')]['id'];}_0x18a536[_0xa4b8('0x54')]['UserId']=_0x18a536[_0xa4b8('0x54')][_0xa4b8('0x74')]||_0x18a536[_0xa4b8('0x66')]['id'];_0x14067c[_0xa4b8('0x86')]['id']=_0x18a536[_0xa4b8('0x54')][_0xa4b8('0x74')];return db[_0xa4b8('0x37')][_0xa4b8('0x53')]({'where':{'id':_0x18a536[_0xa4b8('0x50')]['id'],'UserId':null}})[_0xa4b8('0x1c')](handleEntityNotFound(_0x592b63,null))[_0xa4b8('0x1c')](function(_0x1e1328){if(_0x1e1328){_0x14067c[_0xa4b8('0x23')]=_0x1e1328[_0xa4b8('0x77')]({'plain':!![]});return db['MailInteraction'][_0xa4b8('0x53')]({'where':{'id':_0x1e1328['MailInteractionId']}});}return null;})[_0xa4b8('0x1c')](handleEntityNotFound(_0x592b63,null))[_0xa4b8('0x1c')](function(_0x11c2bd){if(_0x11c2bd){_0x14067c[_0xa4b8('0x7a')]=_0x11c2bd[_0xa4b8('0x77')]({'plain':!![]});interaction_log[_0xa4b8('0x1d')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x18a536[_0xa4b8('0x66')]['id'],_0x18a536[_0xa4b8('0x66')][_0xa4b8('0x34')],_0x18a536[_0xa4b8('0x66')][_0xa4b8('0x87')],_0x14067c[_0xa4b8('0x7a')]['id'],_0x18a536[_0xa4b8('0x54')]?JSON[_0xa4b8('0x7c')](_0x18a536[_0xa4b8('0x54')]):_0xa4b8('0x7d'));return respondWithRpcPromise(_0xa4b8('0x88'),_0xa4b8('0x89'),_0x14067c);}return null;})[_0xa4b8('0x1c')](function(_0x194198){if(_0x194198){_0x194198[_0xa4b8('0x23')]['interface']=util['format'](_0xa4b8('0x80'),_0x18a536['user'][_0xa4b8('0x34')]);_0x194198[_0xa4b8('0x23')][_0xa4b8('0x81')]=_0x14067c[_0xa4b8('0x81')];_0x194198['message'][_0xa4b8('0x82')]='reject';respondWithRpcPromise(_0xa4b8('0x83'),'EventManager',{'event':'rejectmessage','message':_0x194198[_0xa4b8('0x23')]},client9002);return _0x14067c;}return null;})['then'](respondWithResult(_0x592b63,null))[_0xa4b8('0x25')](handleError(_0x592b63,null));}; \ No newline at end of file +var _0x5fc7=['attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','day','add','merge','filter','options','includeAll','include','findAll','rows','params','body','find','describe','direction','out','secret','MailAccount','MailAccountId','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','read','readAt','format','UserId','CmContact','Contact','get','MailInteraction','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','agent','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','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','../../config/utils','../../config/environment','socket.io-emitter','localhost','./mailMessage.socket','register','client','http','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','status','end','count','offset','limit','set','Content-Range','apply','save','update','destroy','sendStatus','stack','name','send','index','MailMessage','rawAttributes','model','query','dateStart','dateEnd','keys','filters'];(function(_0x9f57ca,_0xede913){var _0x171560=function(_0x5e696c){while(--_0x5e696c){_0x9f57ca['push'](_0x9f57ca['shift']());}};_0x171560(++_0xede913);}(_0x5fc7,0x1e1));var _0x75fc=function(_0x1bfe2b,_0x34856e){_0x1bfe2b=_0x1bfe2b-0x0;var _0x1477d4=_0x5fc7[_0x1bfe2b];return _0x1477d4;};'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 socket=require(_0x75fc('0x15'))({'host':_0x75fc('0x16'),'port':0x18eb});require(_0x75fc('0x17'))[_0x75fc('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0x75fc('0x19')][_0x75fc('0x1a')]({'port':0x232c});var client9003=jayson[_0x75fc('0x19')][_0x75fc('0x1a')]({'port':0x232b});var client9002=jayson[_0x75fc('0x19')][_0x75fc('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x22b73d,_0x58748e,_0x50711e,_0x52054a){return new BPromise(function(_0x195606,_0x2e0e83){var _0x2e073b=_0x52054a||client;return _0x2e073b[_0x75fc('0x1b')](_0x22b73d,_0x50711e)[_0x75fc('0x1c')](function(_0x2cd131){logger[_0x75fc('0x1d')](_0x75fc('0x1e'),_0x58748e,'request\x20sent');logger[_0x75fc('0x1f')](_0x75fc('0x20'),_0x58748e,'request\x20sent',JSON[_0x75fc('0x21')](_0x2cd131));if(_0x2cd131[_0x75fc('0x22')]){if(_0x2cd131['error']['code']===0x1f4){logger[_0x75fc('0x22')](_0x75fc('0x1e'),_0x58748e,_0x2cd131[_0x75fc('0x22')][_0x75fc('0x23')]);return _0x2e0e83(_0x2cd131[_0x75fc('0x22')][_0x75fc('0x23')]);}logger['error'](_0x75fc('0x1e'),_0x58748e,_0x2cd131['error'][_0x75fc('0x23')]);return _0x195606(_0x2cd131[_0x75fc('0x22')][_0x75fc('0x23')]);}else{logger[_0x75fc('0x1d')]('MailMessage,\x20%s,\x20%s',_0x58748e,_0x75fc('0x24'));_0x195606(_0x2cd131[_0x75fc('0x25')]['message']);}})[_0x75fc('0x26')](function(_0x3ed9d5){logger['error'](_0x75fc('0x1e'),_0x58748e,_0x3ed9d5);_0x2e0e83(_0x3ed9d5);});});}function respondWithStatusCode(_0x5a79e0,_0x14745f){_0x14745f=_0x14745f||0xcc;return function(_0x924c53){if(_0x924c53){return _0x5a79e0['sendStatus'](_0x14745f);}return _0x5a79e0[_0x75fc('0x27')](_0x14745f)[_0x75fc('0x28')]();};}function respondWithResult(_0x5a62ef,_0x3a44d1){_0x3a44d1=_0x3a44d1||0xc8;return function(_0x2418be){if(_0x2418be){return _0x5a62ef['status'](_0x3a44d1)['json'](_0x2418be);}};}function respondWithFilteredResult(_0x10a59a,_0x5a75b2){return function(_0x19a59e){if(_0x19a59e){var _0x4268ed=_0x19a59e[_0x75fc('0x29')],_0x4f70b4=_0x5a75b2[_0x75fc('0x2a')],_0x56a7a4=_0x5a75b2[_0x75fc('0x2a')]+_0x5a75b2[_0x75fc('0x2b')],_0x5dd7a9;if(_0x56a7a4>=_0x4268ed){_0x56a7a4=_0x4268ed;_0x5dd7a9=0xc8;}else{_0x5dd7a9=0xce;}_0x10a59a[_0x75fc('0x27')](_0x5dd7a9);return _0x10a59a[_0x75fc('0x2c')](_0x75fc('0x2d'),_0x4f70b4+'-'+_0x56a7a4+'/'+_0x4268ed)['json'](_0x19a59e);}return null;};}function patchUpdates(_0x23aa27){return function(_0x3e99d7){try{jsonpatch[_0x75fc('0x2e')](_0x3e99d7,_0x23aa27,!![]);}catch(_0x1be47b){return BPromise['reject'](_0x1be47b);}return _0x3e99d7[_0x75fc('0x2f')]();};}function saveUpdates(_0x486e3f,_0x12b8a1){return function(_0x337032){if(_0x337032){return _0x337032[_0x75fc('0x30')](_0x486e3f)[_0x75fc('0x1c')](function(_0x547ba8){return _0x547ba8;});}return null;};}function removeEntity(_0x26fdf0,_0x4d5981){return function(_0xaddfc9){if(_0xaddfc9){return _0xaddfc9[_0x75fc('0x31')]()['then'](function(){_0x26fdf0[_0x75fc('0x27')](0xcc)[_0x75fc('0x28')]();});}};}function handleEntityNotFound(_0x5371bc,_0x361862){return function(_0xdeacca){if(!_0xdeacca){_0x5371bc[_0x75fc('0x32')](0x194);}return _0xdeacca;};}function handleError(_0x20e435,_0x2b3edb){_0x2b3edb=_0x2b3edb||0x1f4;return function(_0x4755df){logger[_0x75fc('0x22')](_0x4755df[_0x75fc('0x33')]);if(_0x4755df['name']){delete _0x4755df[_0x75fc('0x34')];}_0x20e435[_0x75fc('0x27')](_0x2b3edb)[_0x75fc('0x35')](_0x4755df);};}exports[_0x75fc('0x36')]=function(_0x7ae3,_0x3a629c){var _0x998936={},_0x10ea7c={},_0x1ad353={'count':0x0,'rows':[]};var _0x2c7171=db[_0x75fc('0x37')][_0x75fc('0x38')];_0x10ea7c[_0x75fc('0x39')]=_['keys'](_0x2c7171);var _0x18e4f0={'dateStart':_0x7ae3[_0x75fc('0x3a')][_0x75fc('0x3b')],'dateEnd':_0x7ae3[_0x75fc('0x3a')]['dateEnd']};delete _0x7ae3[_0x75fc('0x3a')][_0x75fc('0x3b')];delete _0x7ae3[_0x75fc('0x3a')][_0x75fc('0x3c')];_0x10ea7c[_0x75fc('0x3a')]=_[_0x75fc('0x3d')](_0x7ae3[_0x75fc('0x3a')]);_0x10ea7c[_0x75fc('0x3e')]=_['intersection'](_0x10ea7c[_0x75fc('0x39')],_0x10ea7c[_0x75fc('0x3a')]);_0x998936[_0x75fc('0x3f')]=_[_0x75fc('0x40')](_0x10ea7c[_0x75fc('0x39')],qs[_0x75fc('0x41')](_0x7ae3['query'][_0x75fc('0x41')]));_0x998936[_0x75fc('0x3f')]=_0x998936['attributes'][_0x75fc('0x42')]?_0x998936[_0x75fc('0x3f')]:_0x10ea7c[_0x75fc('0x39')];if(!_0x7ae3[_0x75fc('0x3a')][_0x75fc('0x43')]('nolimit')){_0x998936[_0x75fc('0x2b')]=qs['limit'](_0x7ae3[_0x75fc('0x3a')][_0x75fc('0x2b')]);_0x998936[_0x75fc('0x2a')]=qs[_0x75fc('0x2a')](_0x7ae3[_0x75fc('0x3a')][_0x75fc('0x2a')]);}_0x998936[_0x75fc('0x44')]=qs[_0x75fc('0x45')](_0x7ae3[_0x75fc('0x3a')]['sort']);_0x998936[_0x75fc('0x46')]=qs[_0x75fc('0x3e')](_[_0x75fc('0x47')](_0x7ae3[_0x75fc('0x3a')],_0x10ea7c[_0x75fc('0x3e')]));if(_0x18e4f0['dateStart']){if(_0x18e4f0[_0x75fc('0x3c')]){_0x18e4f0[_0x75fc('0x3c')]=moment(_0x18e4f0[_0x75fc('0x3c')])['add'](0x1,_0x75fc('0x48'));}else{_0x18e4f0[_0x75fc('0x3c')]=moment(_0x18e4f0[_0x75fc('0x3b')])[_0x75fc('0x49')](0x1,_0x75fc('0x48'));}_[_0x75fc('0x4a')](_0x998936[_0x75fc('0x46')],{'createdAt':{'$gte':_0x18e4f0['dateStart'],'$lte':_0x18e4f0[_0x75fc('0x3c')]}});}if(_0x7ae3[_0x75fc('0x3a')]['filter']){_0x998936[_0x75fc('0x46')]=_[_0x75fc('0x4a')](_0x998936[_0x75fc('0x46')],{'$or':_['map'](_0x998936[_0x75fc('0x3f')],function(_0x504cd4){var _0x4de346={};_0x4de346[_0x504cd4]={'$like':'%'+_0x7ae3['query'][_0x75fc('0x4b')]+'%'};return _0x4de346;})});}_0x998936=_[_0x75fc('0x4a')]({},_0x998936,_0x7ae3[_0x75fc('0x4c')]);var _0x484a51={'where':_0x998936[_0x75fc('0x46')]};return db['MailMessage'][_0x75fc('0x29')](_0x484a51)[_0x75fc('0x1c')](function(_0x35bd3c){_0x1ad353[_0x75fc('0x29')]=_0x35bd3c;if(_0x7ae3['query'][_0x75fc('0x4d')]){_0x998936[_0x75fc('0x4e')]=[{'all':!![]}];}return db[_0x75fc('0x37')][_0x75fc('0x4f')](_0x998936);})[_0x75fc('0x1c')](function(_0x887cd4){_0x1ad353[_0x75fc('0x50')]=_0x887cd4;return _0x1ad353;})['then'](respondWithFilteredResult(_0x3a629c,_0x998936))[_0x75fc('0x26')](handleError(_0x3a629c,null));};exports['show']=function(_0x2a6191,_0x2d25c5){var _0x1da347={'raw':!![],'where':{'id':_0x2a6191[_0x75fc('0x51')]['id']}},_0x2bff37={};_0x2bff37[_0x75fc('0x39')]=_[_0x75fc('0x3d')](db[_0x75fc('0x37')][_0x75fc('0x38')]);_0x2bff37['query']=_[_0x75fc('0x3d')](_0x2a6191[_0x75fc('0x3a')]);_0x2bff37[_0x75fc('0x3e')]=_[_0x75fc('0x40')](_0x2bff37['model'],_0x2bff37['query']);_0x1da347[_0x75fc('0x3f')]=_['intersection'](_0x2bff37[_0x75fc('0x39')],qs[_0x75fc('0x41')](_0x2a6191[_0x75fc('0x3a')][_0x75fc('0x41')]));_0x1da347[_0x75fc('0x3f')]=_0x1da347[_0x75fc('0x3f')][_0x75fc('0x42')]?_0x1da347[_0x75fc('0x3f')]:_0x2bff37[_0x75fc('0x39')];if(_0x2a6191[_0x75fc('0x3a')]['includeAll']){_0x1da347[_0x75fc('0x4e')]=[{'all':!![]}];}_0x1da347=_[_0x75fc('0x4a')]({},_0x1da347,_0x2a6191[_0x75fc('0x4c')]);return db['MailMessage']['find'](_0x1da347)[_0x75fc('0x1c')](handleEntityNotFound(_0x2d25c5,null))[_0x75fc('0x1c')](respondWithResult(_0x2d25c5,null))[_0x75fc('0x26')](handleError(_0x2d25c5,null));};exports[_0x75fc('0x30')]=function(_0x4f6d63,_0x18fa7a){if(_0x4f6d63[_0x75fc('0x52')]['id']){delete _0x4f6d63['body']['id'];}return db[_0x75fc('0x37')]['find']({'where':{'id':_0x4f6d63[_0x75fc('0x51')]['id']}})[_0x75fc('0x1c')](handleEntityNotFound(_0x18fa7a,null))[_0x75fc('0x1c')](saveUpdates(_0x4f6d63['body'],null))[_0x75fc('0x1c')](respondWithResult(_0x18fa7a,null))[_0x75fc('0x26')](handleError(_0x18fa7a,null));};exports[_0x75fc('0x31')]=function(_0x3c01c0,_0x45cd82){return db[_0x75fc('0x37')][_0x75fc('0x53')]({'where':{'id':_0x3c01c0[_0x75fc('0x51')]['id']}})[_0x75fc('0x1c')](handleEntityNotFound(_0x45cd82,null))['then'](removeEntity(_0x45cd82,null))['catch'](handleError(_0x45cd82,null));};exports[_0x75fc('0x54')]=function(_0x5f0717,_0x372460){return db[_0x75fc('0x37')]['describe']()[_0x75fc('0x1c')](respondWithResult(_0x372460,null))[_0x75fc('0x26')](handleError(_0x372460,null));};exports['create']=function(_0x10fcb3,_0x3217f4){return db[_0x75fc('0x37')]['create'](_0x10fcb3[_0x75fc('0x52')])[_0x75fc('0x1c')](function(_0x11ded3){if(_0x11ded3){if(_0x11ded3[_0x75fc('0x55')]===_0x75fc('0x56')&&!_0x11ded3[_0x75fc('0x57')]){return db[_0x75fc('0x58')]['findOne']({'where':{'id':_0x11ded3[_0x75fc('0x59')]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})['then'](function(_0x3f1d6c){if(_0x3f1d6c&&_0x3f1d6c[_0x75fc('0x5a')]){var _0x1e84ed={'tls':{'rejectUnauthorized':![]}};if(_[_0x75fc('0x5b')](_0x3f1d6c['Smtp'][_0x75fc('0x5c')])){_0x1e84ed[_0x75fc('0x5d')]=_0x3f1d6c['Smtp'][_0x75fc('0x5d')];_0x1e84ed[_0x75fc('0x5e')]=_0x3f1d6c['Smtp'][_0x75fc('0x5e')];_0x1e84ed[_0x75fc('0x5f')]=_0x3f1d6c[_0x75fc('0x5a')][_0x75fc('0x5f')];if(_0x3f1d6c[_0x75fc('0x5a')][_0x75fc('0x60')]){_0x1e84ed[_0x75fc('0x61')]={'user':_0x3f1d6c[_0x75fc('0x5a')][_0x75fc('0x62')],'pass':_0x3f1d6c[_0x75fc('0x5a')]['pass']};}}else{_0x1e84ed[_0x75fc('0x5c')]=_0x3f1d6c[_0x75fc('0x5a')][_0x75fc('0x5c')];_0x1e84ed[_0x75fc('0x61')]={'user':_0x3f1d6c[_0x75fc('0x5a')]['user'],'pass':_0x3f1d6c[_0x75fc('0x5a')][_0x75fc('0x63')]};_0x1e84ed['secure']=_0x3f1d6c['Smtp']['secure'];}if(_0x10fcb3[_0x75fc('0x52')][_0x75fc('0x64')]&&_0x10fcb3[_0x75fc('0x52')][_0x75fc('0x64')][_0x75fc('0x42')]){for(var _0x1a4913=0x0;_0x1a4913<_0x10fcb3['body']['attachments'][_0x75fc('0x42')];_0x1a4913+=0x1){_0x10fcb3[_0x75fc('0x52')]['attachments'][_0x1a4913]={'filename':_0x10fcb3['body'][_0x75fc('0x64')][_0x1a4913][_0x75fc('0x34')],'path':path[_0x75fc('0x65')](config[_0x75fc('0x66')],'server/files/attachments',_0x10fcb3['body'][_0x75fc('0x64')][_0x1a4913]['basename'])};}}return{'account':_0x1e84ed,'message':_0x10fcb3[_0x75fc('0x52')]};}})[_0x75fc('0x1c')](function(_0x20259e){if(_0x20259e){return respondWithRpcPromise(_0x75fc('0x67'),_0x75fc('0x68'),_0x20259e,client9003)[_0x75fc('0x1c')](function(_0x25cdfe){return _0x11ded3[_0x75fc('0x30')]({'read':!![],'messageId':_0x25cdfe[_0x75fc('0x69')],'sentAt':moment()['format'](_0x75fc('0x6a'))});})[_0x75fc('0x26')](function(_0x3b59f8){logger[_0x75fc('0x22')]('%s',JSON[_0x75fc('0x21')](_0x3b59f8));return _0x11ded3;});}return _0x11ded3;});}return _0x11ded3;}})['then'](respondWithResult(_0x3217f4,0xc9))[_0x75fc('0x26')](handleError(_0x3217f4,null));};var interaction_log=require('../../config/logger')(_0x75fc('0x6b'));exports[_0x75fc('0x6c')]=function(_0x3d880b,_0x9cfd26,_0x2a7536){var _0x532118={'channel':_0x75fc('0x6d')};if(_0x3d880b[_0x75fc('0x52')]['id']){delete _0x3d880b[_0x75fc('0x52')]['id'];}_0x3d880b[_0x75fc('0x52')][_0x75fc('0x6e')]=!![];_0x3d880b['body'][_0x75fc('0x6f')]=moment()[_0x75fc('0x70')](_0x75fc('0x6a'));_0x3d880b[_0x75fc('0x52')][_0x75fc('0x71')]=_0x3d880b[_0x75fc('0x52')]['UserId']||_0x3d880b['user']['id'];return db[_0x75fc('0x37')][_0x75fc('0x53')]({'where':{'id':_0x3d880b[_0x75fc('0x51')]['id'],'UserId':null},'include':[{'model':db[_0x75fc('0x72')],'as':_0x75fc('0x73')}]})[_0x75fc('0x1c')](handleEntityNotFound(_0x9cfd26,null))[_0x75fc('0x1c')](saveUpdates(_0x3d880b[_0x75fc('0x52')],null))[_0x75fc('0x1c')](function(_0x55ef22){if(_0x55ef22){_0x532118[_0x75fc('0x23')]=_0x55ef22[_0x75fc('0x74')]({'plain':!![]});return db[_0x75fc('0x75')]['find']({'where':{'id':_0x55ef22['MailInteractionId']}});}return null;})[_0x75fc('0x1c')](handleEntityNotFound(_0x9cfd26,null))[_0x75fc('0x1c')](function(_0x143f99){if(_0x143f99){return _0x143f99[_0x75fc('0x30')]({'UserId':_0x3d880b[_0x75fc('0x52')][_0x75fc('0x71')],'read1stAt':_['isNil'](_0x143f99[_0x75fc('0x76')])?moment()[_0x75fc('0x70')](_0x75fc('0x6a')):undefined});}return null;})[_0x75fc('0x1c')](function(_0x48a670){if(_0x48a670){_0x532118[_0x75fc('0x77')]=_0x48a670[_0x75fc('0x74')]({'plain':!![]});interaction_log['info'](_0x75fc('0x78'),_0x3d880b[_0x75fc('0x62')]['id'],_0x3d880b[_0x75fc('0x62')][_0x75fc('0x34')],_0x3d880b[_0x75fc('0x62')][_0x75fc('0x79')],_0x532118[_0x75fc('0x77')]['id'],_0x3d880b['body']?JSON[_0x75fc('0x21')](_0x3d880b['body']):'null');return respondWithRpcPromise(_0x75fc('0x7a'),'acceptMessage',_0x532118);}return null;})[_0x75fc('0x1c')](function(_0xeac7a1){if(_0xeac7a1){if(_0x3d880b['body'][_0x75fc('0x7b')]){_0x532118[_0x75fc('0x23')][_0x75fc('0x7c')]=util['format'](_0x75fc('0x7d'),_0x3d880b[_0x75fc('0x62')][_0x75fc('0x34')]);_0x532118[_0x75fc('0x23')][_0x75fc('0x7e')]=_0x532118['channel'];_0x532118['message'][_0x75fc('0x7f')]='accept';return respondWithRpcPromise(_0x75fc('0x80'),'EventManager',{'event':_0x75fc('0x81'),'message':_0x532118[_0x75fc('0x23')]},client9002)[_0x75fc('0x1c')](function(){return _0x532118;});}return _0x532118;}return null;})['then'](respondWithResult(_0x9cfd26,null))[_0x75fc('0x26')](handleError(_0x9cfd26,null));};var interaction_log=require(_0x75fc('0x11'))(_0x75fc('0x6b'));exports[_0x75fc('0x82')]=function(_0xf949d4,_0x3b6b81,_0x3b07f0){var _0x245ae6={'agent':{},'channel':_0x75fc('0x6d')};if(_0xf949d4[_0x75fc('0x52')]['id']){delete _0xf949d4[_0x75fc('0x52')]['id'];}_0xf949d4[_0x75fc('0x52')][_0x75fc('0x71')]=_0xf949d4[_0x75fc('0x52')][_0x75fc('0x71')]||_0xf949d4[_0x75fc('0x62')]['id'];_0x245ae6[_0x75fc('0x83')]['id']=_0xf949d4['body'][_0x75fc('0x71')];return db[_0x75fc('0x37')]['find']({'where':{'id':_0xf949d4['params']['id'],'UserId':null}})[_0x75fc('0x1c')](handleEntityNotFound(_0x3b6b81,null))[_0x75fc('0x1c')](function(_0x118738){if(_0x118738){_0x245ae6[_0x75fc('0x23')]=_0x118738[_0x75fc('0x74')]({'plain':!![]});return db[_0x75fc('0x75')][_0x75fc('0x53')]({'where':{'id':_0x118738[_0x75fc('0x84')]}});}return null;})[_0x75fc('0x1c')](handleEntityNotFound(_0x3b6b81,null))[_0x75fc('0x1c')](function(_0x3ce96a){if(_0x3ce96a){_0x245ae6[_0x75fc('0x77')]=_0x3ce96a[_0x75fc('0x74')]({'plain':!![]});interaction_log['info'](_0x75fc('0x85'),_0xf949d4[_0x75fc('0x62')]['id'],_0xf949d4[_0x75fc('0x62')][_0x75fc('0x34')],_0xf949d4[_0x75fc('0x62')]['role'],_0x245ae6[_0x75fc('0x77')]['id'],_0xf949d4[_0x75fc('0x52')]?JSON[_0x75fc('0x21')](_0xf949d4['body']):'null');return respondWithRpcPromise('RejectMessage',_0x75fc('0x86'),_0x245ae6);}return null;})[_0x75fc('0x1c')](function(_0x5921f6){if(_0x5921f6){_0x5921f6[_0x75fc('0x23')][_0x75fc('0x7c')]=util[_0x75fc('0x70')](_0x75fc('0x7d'),_0xf949d4['user']['name']);_0x5921f6[_0x75fc('0x23')][_0x75fc('0x7e')]=_0x245ae6[_0x75fc('0x7e')];_0x5921f6[_0x75fc('0x23')][_0x75fc('0x7f')]=_0x75fc('0x82');respondWithRpcPromise(_0x75fc('0x80'),_0x75fc('0x80'),{'event':_0x75fc('0x87'),'message':_0x5921f6['message']},client9002);return _0x245ae6;}return null;})['then'](respondWithResult(_0x3b6b81,null))[_0x75fc('0x26')](handleError(_0x3b6b81,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 5e8da00..d497d66 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 _0x23f4=['remove','emit','hook','exports','../../mysqldb','save','update'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x23f4,0x1ee));var _0x423f=function(_0x4e78a4,_0x531083){_0x4e78a4=_0x4e78a4-0x0;var _0x13f17c=_0x23f4[_0x4e78a4];return _0x13f17c;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x423f('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x423f('0x1'),'afterUpdate':_0x423f('0x2'),'afterDestroy':_0x423f('0x3')};function emitEvent(_0x3503a0){return function(_0x1ab106,_0x129dba,_0x34bf9e){MailMessageEvents[_0x423f('0x4')](_0x3503a0+':'+_0x1ab106['id'],_0x1ab106);MailMessageEvents[_0x423f('0x4')](_0x3503a0,_0x1ab106);_0x34bf9e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x423f('0x5')](e,emitEvent(event));}}module[_0x423f('0x6')]=MailMessageEvents; \ No newline at end of file +var _0x5a93=['exports','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x33d5e1,_0x18a908){var _0x33f71e=function(_0x17c1c0){while(--_0x17c1c0){_0x33d5e1['push'](_0x33d5e1['shift']());}};_0x33f71e(++_0x18a908);}(_0x5a93,0xf6));var _0x35a9=function(_0x16699d,_0x19358a){_0x16699d=_0x16699d-0x0;var _0x10cd8d=_0x5a93[_0x16699d];return _0x10cd8d;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x35a9('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x35a9('0x1')](0x0);var events={'afterCreate':_0x35a9('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x7dc79f){return function(_0xf10dcf,_0x3a23d6,_0x4f45aa){MailMessageEvents[_0x35a9('0x3')](_0x7dc79f+':'+_0xf10dcf['id'],_0xf10dcf);MailMessageEvents[_0x35a9('0x3')](_0x7dc79f,_0xf10dcf);_0x4f45aa(null);};}for(var e in events){if(events[_0x35a9('0x4')](e)){var event=events[e];MailMessage[_0x35a9('0x5')](e,emitEvent(event));}}module[_0x35a9('0x6')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index db0796d..965ef68 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 _0x1df7=['exports','define','MailMessage','messageId','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','./mailMessage.attributes'];(function(_0x1e172a,_0x52102b){var _0x96338b=function(_0x307313){while(--_0x307313){_0x1e172a['push'](_0x1e172a['shift']());}};_0x96338b(++_0x52102b);}(_0x1df7,0x6e));var _0x71df=function(_0x442992,_0x35224c){_0x442992=_0x442992-0x0;var _0x47614c=_0x1df7[_0x442992];return _0x47614c;};'use strict';var _=require('lodash');var util=require(_0x71df('0x0'));var logger=require(_0x71df('0x1'))(_0x71df('0x2'));var moment=require(_0x71df('0x3'));var BPromise=require(_0x71df('0x4'));var rp=require(_0x71df('0x5'));var attributes=require(_0x71df('0x6'));module[_0x71df('0x7')]=function(_0x20c662,_0x2b8342){return _0x20c662[_0x71df('0x8')](_0x71df('0x9'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x71df('0xa'),'fields':['messageId']}],'timestamps':!![],'charset':_0x71df('0xb'),'collate':_0x71df('0xc')});}; \ No newline at end of file +var _0x32e7=['./mailMessage.attributes','exports','MailMessage','messageId','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise'];(function(_0x21d7cc,_0x2df63c){var _0x5ccb98=function(_0x1613e2){while(--_0x1613e2){_0x21d7cc['push'](_0x21d7cc['shift']());}};_0x5ccb98(++_0x2df63c);}(_0x32e7,0xc3));var _0x732e=function(_0x19101f,_0x525111){_0x19101f=_0x19101f-0x0;var _0x972908=_0x32e7[_0x19101f];return _0x972908;};'use strict';var _=require(_0x732e('0x0'));var util=require('util');var logger=require(_0x732e('0x1'))(_0x732e('0x2'));var moment=require(_0x732e('0x3'));var BPromise=require('bluebird');var rp=require(_0x732e('0x4'));var attributes=require(_0x732e('0x5'));module[_0x732e('0x6')]=function(_0x122e38,_0x538b2d){return _0x122e38['define'](_0x732e('0x7'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x732e('0x8'),'fields':[_0x732e('0x8')]}],'timestamps':!![],'charset':'utf8mb4','collate':_0x732e('0x9')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 1190142..f827fa8 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 _0xc3ae=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','lodash'];(function(_0x29f1c1,_0x3220ed){var _0x5a8deb=function(_0x2ec6eb){while(--_0x2ec6eb){_0x29f1c1['push'](_0x29f1c1['shift']());}};_0x5a8deb(++_0x3220ed);}(_0xc3ae,0xbf));var _0xec3a=function(_0x5ec9df,_0x565096){_0x5ec9df=_0x5ec9df-0x0;var _0x25f4ae=_0xc3ae[_0x5ec9df];return _0x25f4ae;};'use strict';var _=require(_0xec3a('0x0'));var util=require(_0xec3a('0x1'));var moment=require(_0xec3a('0x2'));var BPromise=require(_0xec3a('0x3'));var rs=require(_0xec3a('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xec3a('0x5'));var logger=require(_0xec3a('0x6'))(_0xec3a('0x7'));var config=require(_0xec3a('0x8'));var jayson=require(_0xec3a('0x9'));var client=jayson['client'][_0xec3a('0xa')]({'port':0x232a});var socket=require(_0xec3a('0xb'))({'host':'localhost','port':0x18eb});require(_0xec3a('0xc'))[_0xec3a('0xd')](socket);function respondWithRpcPromise(_0x57777f,_0x56a25c,_0x34c1e9){return new BPromise(function(_0x506566,_0x40a5aa){return client[_0xec3a('0xe')](_0x57777f,_0x34c1e9)[_0xec3a('0xf')](function(_0x534841){logger[_0xec3a('0x10')](_0xec3a('0x11'),_0x56a25c,_0xec3a('0x12'));logger[_0xec3a('0x13')](_0xec3a('0x14'),_0x56a25c,'request\x20sent',JSON['stringify'](_0x534841));if(_0x534841[_0xec3a('0x15')]){if(_0x534841[_0xec3a('0x15')][_0xec3a('0x16')]===0x1f4){logger['error'](_0xec3a('0x11'),_0x56a25c,_0x534841['error'][_0xec3a('0x17')]);return _0x40a5aa(_0x534841[_0xec3a('0x15')][_0xec3a('0x17')]);}logger[_0xec3a('0x15')]('MailMessage,\x20%s,\x20%s',_0x56a25c,_0x534841[_0xec3a('0x15')][_0xec3a('0x17')]);return _0x506566(_0x534841[_0xec3a('0x15')]['message']);}else{logger[_0xec3a('0x10')](_0xec3a('0x11'),_0x56a25c,_0xec3a('0x12'));_0x506566(_0x534841[_0xec3a('0x18')][_0xec3a('0x17')]);}})[_0xec3a('0x19')](function(_0x20ec8c){logger[_0xec3a('0x15')](_0xec3a('0x11'),_0x56a25c,_0x20ec8c);_0x40a5aa(_0x20ec8c);});});}exports[_0xec3a('0x1a')]=function(_0x1f4b71){var _0x87e1eb=this;return new Promise(function(_0x3ed1c6,_0x40e7e0){return db[_0xec3a('0x1b')][_0xec3a('0x1c')](_0x1f4b71[_0xec3a('0x1d')],{'raw':_0x1f4b71[_0xec3a('0x1e')]?_0x1f4b71[_0xec3a('0x1e')][_0xec3a('0x1f')]===undefined?!![]:![]:!![]})[_0xec3a('0xf')](function(_0x255f2e){logger['info'](_0xec3a('0x1a'),_0x1f4b71);logger[_0xec3a('0x13')](_0xec3a('0x1a'),_0x1f4b71,JSON['stringify'](_0x255f2e));_0x3ed1c6(_0x255f2e);})[_0xec3a('0x19')](function(_0x350335){logger[_0xec3a('0x15')]('CreateMailMessage',_0x350335[_0xec3a('0x17')],_0x1f4b71);_0x40e7e0(_0x87e1eb[_0xec3a('0x15')](0x1f4,_0x350335[_0xec3a('0x17')]));});});}; \ No newline at end of file +var _0x3621=['then','catch','moment','randomstring','../../config/utils','rpc','client','socket.io-emitter','localhost','./mailMessage.socket','register','request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','CreateMailMessage','MailMessage','create','options','raw'];(function(_0x3d4028,_0x5209a6){var _0x492b51=function(_0xf2399f){while(--_0xf2399f){_0x3d4028['push'](_0x3d4028['shift']());}};_0x492b51(++_0x5209a6);}(_0x3621,0x1cd));var _0x1362=function(_0x2b7b0b,_0x1ed063){_0x2b7b0b=_0x2b7b0b-0x0;var _0x3c0362=_0x3621[_0x2b7b0b];return _0x3c0362;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1362('0x0'));var BPromise=require('bluebird');var rs=require(_0x1362('0x1'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x1362('0x2'));var logger=require('../../config/logger')(_0x1362('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1362('0x4')]['http']({'port':0x232a});var socket=require(_0x1362('0x5'))({'host':_0x1362('0x6'),'port':0x18eb});require(_0x1362('0x7'))[_0x1362('0x8')](socket);function respondWithRpcPromise(_0x8a0224,_0x363d39,_0x350bd){return new BPromise(function(_0x889b0d,_0x164739){return client[_0x1362('0x9')](_0x8a0224,_0x350bd)['then'](function(_0x1aabf3){logger[_0x1362('0xa')]('MailMessage,\x20%s,\x20%s',_0x363d39,_0x1362('0xb'));logger[_0x1362('0xc')](_0x1362('0xd'),_0x363d39,_0x1362('0xb'),JSON[_0x1362('0xe')](_0x1aabf3));if(_0x1aabf3[_0x1362('0xf')]){if(_0x1aabf3[_0x1362('0xf')][_0x1362('0x10')]===0x1f4){logger['error'](_0x1362('0x11'),_0x363d39,_0x1aabf3[_0x1362('0xf')][_0x1362('0x12')]);return _0x164739(_0x1aabf3[_0x1362('0xf')][_0x1362('0x12')]);}logger[_0x1362('0xf')](_0x1362('0x11'),_0x363d39,_0x1aabf3[_0x1362('0xf')]['message']);return _0x889b0d(_0x1aabf3[_0x1362('0xf')][_0x1362('0x12')]);}else{logger[_0x1362('0xa')](_0x1362('0x11'),_0x363d39,_0x1362('0xb'));_0x889b0d(_0x1aabf3[_0x1362('0x13')]['message']);}})['catch'](function(_0x38e294){logger['error'](_0x1362('0x11'),_0x363d39,_0x38e294);_0x164739(_0x38e294);});});}exports[_0x1362('0x14')]=function(_0x3fe64c){var _0x407957=this;return new Promise(function(_0x1557a3,_0x19256c){return db[_0x1362('0x15')][_0x1362('0x16')](_0x3fe64c['body'],{'raw':_0x3fe64c[_0x1362('0x17')]?_0x3fe64c[_0x1362('0x17')][_0x1362('0x18')]===undefined?!![]:![]:!![]})[_0x1362('0x19')](function(_0x41f1df){logger['info'](_0x1362('0x14'),_0x3fe64c);logger[_0x1362('0xc')]('CreateMailMessage',_0x3fe64c,JSON[_0x1362('0xe')](_0x41f1df));_0x1557a3(_0x41f1df);})[_0x1362('0x1a')](function(_0xb8b7ce){logger[_0x1362('0xf')]('CreateMailMessage',_0xb8b7ce['message'],_0x3fe64c);_0x19256c(_0x407957[_0x1362('0xf')](0x1f4,_0xb8b7ce[_0x1362('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 9fc8669..892fb4c 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 _0xf156=['register','length','mailMessage:','save','remove','emit','removeListener'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xf156,0x137));var _0x6f15=function(_0x235b57,_0x3bf022){_0x235b57=_0x235b57-0x0;var _0x237d3e=_0xf156[_0x235b57];return _0x237d3e;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x6f15('0x0'),_0x6f15('0x1'),'update'];function createListener(_0x1a466f,_0x5a416a){return function(_0x1a6bee){_0x5a416a[_0x6f15('0x2')](_0x1a466f,_0x1a6bee);};}function removeListener(_0x15bc29,_0x247772){return function(){MailMessageEvents[_0x6f15('0x3')](_0x15bc29,_0x247772);};}exports[_0x6f15('0x4')]=function(_0x5aed1c){for(var _0x5d740f=0x0,_0x423cb5=events[_0x6f15('0x5')];_0x5d740f<_0x423cb5;_0x5d740f++){var _0x4f60ee=events[_0x5d740f];var _0x3d1ca9=createListener(_0x6f15('0x6')+_0x4f60ee,_0x5aed1c);MailMessageEvents['on'](_0x4f60ee,_0x3d1ca9);}}; \ No newline at end of file +var _0xc430=['./mailMessage.events','save','remove','update','removeListener'];(function(_0x414131,_0x336933){var _0x4c873f=function(_0x2e7d52){while(--_0x2e7d52){_0x414131['push'](_0x414131['shift']());}};_0x4c873f(++_0x336933);}(_0xc430,0x7d));var _0x0c43=function(_0x2d5c1a,_0x54767f){_0x2d5c1a=_0x2d5c1a-0x0;var _0x4b6420=_0xc430[_0x2d5c1a];return _0x4b6420;};'use strict';var MailMessageEvents=require(_0x0c43('0x0'));var events=[_0x0c43('0x1'),_0x0c43('0x2'),_0x0c43('0x3')];function createListener(_0x4d73be,_0x4d2a0f){return function(_0x446c7a){_0x4d2a0f['emit'](_0x4d73be,_0x446c7a);};}function removeListener(_0x11b190,_0x16db68){return function(){MailMessageEvents[_0x0c43('0x4')](_0x11b190,_0x16db68);};}exports['register']=function(_0x255895){for(var _0xd95b99=0x0,_0x1ed980=events['length'];_0xd95b99<_0x1ed980;_0xd95b99++){var _0x37205d=events[_0xd95b99];var _0x17416b=createListener('mailMessage:'+_0x37205d,_0x255895);MailMessageEvents['on'](_0x37205d,_0x17416b);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index bd32f7a..d658e5d 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 _0x5b00=['util','express','Router','../../components/interaction/service','../../config/environment','./mailQueue.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','exports'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x5b00,0x113));var _0x05b0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5b00[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x05b0('0x0'));var path=require('path');var express=require(_0x05b0('0x1'));var router=express[_0x05b0('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x05b0('0x3'));var config=require(_0x05b0('0x4'));var controller=require(_0x05b0('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x05b0('0x6')]);router[_0x05b0('0x7')](_0x05b0('0x8'),auth[_0x05b0('0x9')](),controller[_0x05b0('0xa')]);router[_0x05b0('0x7')](_0x05b0('0xb'),auth[_0x05b0('0x9')](),controller[_0x05b0('0xc')]);router[_0x05b0('0x7')]('/:id/members',auth[_0x05b0('0x9')](),controller['getMembers']);router[_0x05b0('0x7')](_0x05b0('0xd'),auth[_0x05b0('0x9')](),controller[_0x05b0('0xe')]);router[_0x05b0('0x7')](_0x05b0('0xf'),auth[_0x05b0('0x9')](),controller['getAgents']);router[_0x05b0('0x10')]('/',auth['isAuthenticated'](),controller[_0x05b0('0x11')]);router[_0x05b0('0x10')]('/:id/teams',auth[_0x05b0('0x9')](),controller[_0x05b0('0x12')]);router[_0x05b0('0x10')](_0x05b0('0xf'),auth['isAuthenticated'](),controller[_0x05b0('0x13')]);router['put'](_0x05b0('0xb'),auth['isAuthenticated'](),controller[_0x05b0('0x14')]);router[_0x05b0('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x05b0('0x16')]);router[_0x05b0('0x15')](_0x05b0('0xd'),auth[_0x05b0('0x9')](),controller[_0x05b0('0x17')]);router[_0x05b0('0x15')](_0x05b0('0xf'),auth[_0x05b0('0x9')](),controller['removeAgents']);module[_0x05b0('0x18')]=router; \ No newline at end of file +var _0x3a9c=['getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','/:id/teams','removeTeams','removeAgents','exports','multer','util','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/users'];(function(_0x1cff8a,_0x1537bc){var _0x1ae35d=function(_0x21dad9){while(--_0x21dad9){_0x1cff8a['push'](_0x1cff8a['shift']());}};_0x1ae35d(++_0x1537bc);}(_0x3a9c,0x1c7));var _0xc3a9=function(_0x1e5ff0,_0x46df2b){_0x1e5ff0=_0x1e5ff0-0x0;var _0x1ada2b=_0x3a9c[_0x1e5ff0];return _0x1ada2b;};'use strict';var multer=require(_0xc3a9('0x0'));var util=require(_0xc3a9('0x1'));var path=require('path');var express=require('express');var router=express['Router']();var auth=require(_0xc3a9('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xc3a9('0x3'));var controller=require('./mailQueue.controller');router[_0xc3a9('0x4')]('/',auth[_0xc3a9('0x5')](),controller['index']);router[_0xc3a9('0x4')](_0xc3a9('0x6'),auth[_0xc3a9('0x5')](),controller[_0xc3a9('0x7')]);router['get'](_0xc3a9('0x8'),auth[_0xc3a9('0x5')](),controller[_0xc3a9('0x9')]);router[_0xc3a9('0x4')](_0xc3a9('0xa'),auth[_0xc3a9('0x5')](),controller[_0xc3a9('0xb')]);router[_0xc3a9('0x4')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router['get'](_0xc3a9('0xc'),auth['isAuthenticated'](),controller[_0xc3a9('0xd')]);router[_0xc3a9('0xe')]('/',auth[_0xc3a9('0x5')](),controller[_0xc3a9('0xf')]);router[_0xc3a9('0xe')]('/:id/teams',auth[_0xc3a9('0x5')](),controller[_0xc3a9('0x10')]);router['post'](_0xc3a9('0xc'),auth[_0xc3a9('0x5')](),controller[_0xc3a9('0x11')]);router[_0xc3a9('0x12')](_0xc3a9('0x8'),auth['isAuthenticated'](),controller[_0xc3a9('0x13')]);router[_0xc3a9('0x14')](_0xc3a9('0x8'),auth[_0xc3a9('0x5')](),controller[_0xc3a9('0x15')]);router[_0xc3a9('0x14')](_0xc3a9('0x16'),auth[_0xc3a9('0x5')](),controller[_0xc3a9('0x17')]);router[_0xc3a9('0x14')](_0xc3a9('0xc'),auth[_0xc3a9('0x5')](),controller[_0xc3a9('0x18')]);module[_0xc3a9('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 6dd7fd3..7f1befa 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 _0x1324=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x10f98b,_0x3608f1){var _0xbd4035=function(_0x18cb68){while(--_0x18cb68){_0x10f98b['push'](_0x10f98b['shift']());}};_0xbd4035(++_0x3608f1);}(_0x1324,0x14c));var _0x4132=function(_0x3f5330,_0x179db7){_0x3f5330=_0x3f5330-0x0;var _0x5ce9c2=_0x1324[_0x3f5330];return _0x5ce9c2;};'use strict';var Sequelize=require(_0x4132('0x0'));module[_0x4132('0x1')]={'name':{'type':Sequelize[_0x4132('0x2')],'unique':_0x4132('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4132('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4132('0x4')](_0x4132('0x5'),_0x4132('0x6'),_0x4132('0x7'))}}; \ No newline at end of file +var _0x726a=['STRING','rrmemory','beepall','roundrobin','sequelize','exports','name'];(function(_0x20cb0a,_0x4f029c){var _0x567932=function(_0x16cf3e){while(--_0x16cf3e){_0x20cb0a['push'](_0x20cb0a['shift']());}};_0x567932(++_0x4f029c);}(_0x726a,0xba));var _0xa726=function(_0x3603ba,_0x137527){_0x3603ba=_0x3603ba-0x0;var _0x15f202=_0x726a[_0x3603ba];return _0x15f202;};'use strict';var Sequelize=require(_0xa726('0x0'));module[_0xa726('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa726('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa726('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xa726('0x4'),_0xa726('0x5'),_0xa726('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index bfa6cc2..b391031 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 _0x1a55=['params','include','create','body','destroy','find','describe','getMembers','findOne','get','UserMailQueue','pick','MailQueueId','options','findAll','findAndCountAll','UserId','mailPause','updatedAt','%s/%s','SIP','createdAt','getTeams','addTeams','Team','ids','User','Agents','union','addAgents','removeTeams','removeAgents','omit','spread','emit','userMailQueue:save','isArray','userMailQueue:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','localhost','./mailQueue.socket','end','status','json','offset','limit','set','Content-Range','reject','save','update','then','sendStatus','stack','name','send','index','MailQueue','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','add','day','merge','filter','map','count','includeAll','rows','catch','show'];(function(_0x30eb6b,_0x4ac481){var _0x39ab11=function(_0x2dc324){while(--_0x2dc324){_0x30eb6b['push'](_0x30eb6b['shift']());}};_0x39ab11(++_0x4ac481);}(_0x1a55,0x90));var _0x51a5=function(_0x198e19,_0x534a20){_0x198e19=_0x198e19-0x0;var _0x9c7e5b=_0x1a55[_0x198e19];return _0x9c7e5b;};'use strict';var jsonpatch=require(_0x51a5('0x0'));var rp=require(_0x51a5('0x1'));var moment=require(_0x51a5('0x2'));var BPromise=require(_0x51a5('0x3'));var Mustache=require(_0x51a5('0x4'));var util=require(_0x51a5('0x5'));var path=require(_0x51a5('0x6'));var sox=require(_0x51a5('0x7'));var csv=require(_0x51a5('0x8'));var ejs=require(_0x51a5('0x9'));var fs=require('fs');var _=require(_0x51a5('0xa'));var squel=require(_0x51a5('0xb'));var crypto=require(_0x51a5('0xc'));var jsforce=require(_0x51a5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x51a5('0x8'));var querystring=require(_0x51a5('0xe'));var Papa=require(_0x51a5('0xf'));var qs=require(_0x51a5('0x10'));var logger=require(_0x51a5('0x11'))('api');var utils=require(_0x51a5('0x12'));var config=require(_0x51a5('0x13'));var db=require(_0x51a5('0x14'))['db'];var socket=require('socket.io-emitter')({'host':_0x51a5('0x15'),'port':0x18eb});require(_0x51a5('0x16'))['register'](socket);function respondWithStatusCode(_0x2ec1a5,_0x371e8d){_0x371e8d=_0x371e8d||0xcc;return function(_0x45644d){if(_0x45644d){return _0x2ec1a5['sendStatus'](_0x371e8d);}return _0x2ec1a5['status'](_0x371e8d)[_0x51a5('0x17')]();};}function respondWithResult(_0x139799,_0x30eec7){_0x30eec7=_0x30eec7||0xc8;return function(_0x6fc54a){if(_0x6fc54a){return _0x139799[_0x51a5('0x18')](_0x30eec7)[_0x51a5('0x19')](_0x6fc54a);}};}function respondWithFilteredResult(_0x501342,_0x476bb2){return function(_0x29cd11){if(_0x29cd11){var _0x4f70cb=_0x29cd11['count'],_0x300f75=_0x476bb2[_0x51a5('0x1a')],_0x1ccb18=_0x476bb2[_0x51a5('0x1a')]+_0x476bb2[_0x51a5('0x1b')],_0x3b0d44;if(_0x1ccb18>=_0x4f70cb){_0x1ccb18=_0x4f70cb;_0x3b0d44=0xc8;}else{_0x3b0d44=0xce;}_0x501342[_0x51a5('0x18')](_0x3b0d44);return _0x501342[_0x51a5('0x1c')](_0x51a5('0x1d'),_0x300f75+'-'+_0x1ccb18+'/'+_0x4f70cb)[_0x51a5('0x19')](_0x29cd11);}return null;};}function patchUpdates(_0x2fe31e){return function(_0x5db1af){try{jsonpatch['apply'](_0x5db1af,_0x2fe31e,!![]);}catch(_0x12ee4b){return BPromise[_0x51a5('0x1e')](_0x12ee4b);}return _0x5db1af[_0x51a5('0x1f')]();};}function saveUpdates(_0x28a71b,_0x2ccda8){return function(_0x5d077c){if(_0x5d077c){return _0x5d077c[_0x51a5('0x20')](_0x28a71b)[_0x51a5('0x21')](function(_0x46dcbc){return _0x46dcbc;});}return null;};}function removeEntity(_0x16d082,_0x360ecb){return function(_0x55f91c){if(_0x55f91c){return _0x55f91c['destroy']()[_0x51a5('0x21')](function(){_0x16d082[_0x51a5('0x18')](0xcc)[_0x51a5('0x17')]();});}};}function handleEntityNotFound(_0x142a09,_0x4988fe){return function(_0xd2da59){if(!_0xd2da59){_0x142a09[_0x51a5('0x22')](0x194);}return _0xd2da59;};}function handleError(_0x1493c3,_0x5bc110){_0x5bc110=_0x5bc110||0x1f4;return function(_0x1de5b6){logger['error'](_0x1de5b6[_0x51a5('0x23')]);if(_0x1de5b6[_0x51a5('0x24')]){delete _0x1de5b6[_0x51a5('0x24')];}_0x1493c3[_0x51a5('0x18')](_0x5bc110)[_0x51a5('0x25')](_0x1de5b6);};}exports[_0x51a5('0x26')]=function(_0x22ec0d,_0x42eb01){var _0x47e653={},_0x3cdf45={},_0x39e5cc={'count':0x0,'rows':[]};var _0x40d4a8=db[_0x51a5('0x27')][_0x51a5('0x28')];_0x3cdf45[_0x51a5('0x29')]=_[_0x51a5('0x2a')](_0x40d4a8);var _0x1fb192={'dateStart':_0x22ec0d[_0x51a5('0x2b')][_0x51a5('0x2c')],'dateEnd':_0x22ec0d[_0x51a5('0x2b')][_0x51a5('0x2d')]};delete _0x22ec0d[_0x51a5('0x2b')][_0x51a5('0x2c')];delete _0x22ec0d['query'][_0x51a5('0x2d')];_0x3cdf45[_0x51a5('0x2b')]=_['keys'](_0x22ec0d[_0x51a5('0x2b')]);_0x3cdf45[_0x51a5('0x2e')]=_[_0x51a5('0x2f')](_0x3cdf45[_0x51a5('0x29')],_0x3cdf45[_0x51a5('0x2b')]);_0x47e653[_0x51a5('0x30')]=_[_0x51a5('0x2f')](_0x3cdf45['model'],qs[_0x51a5('0x31')](_0x22ec0d[_0x51a5('0x2b')][_0x51a5('0x31')]));_0x47e653[_0x51a5('0x30')]=_0x47e653['attributes'][_0x51a5('0x32')]?_0x47e653[_0x51a5('0x30')]:_0x3cdf45[_0x51a5('0x29')];if(!_0x22ec0d[_0x51a5('0x2b')][_0x51a5('0x33')](_0x51a5('0x34'))){_0x47e653[_0x51a5('0x1b')]=qs[_0x51a5('0x1b')](_0x22ec0d[_0x51a5('0x2b')][_0x51a5('0x1b')]);_0x47e653[_0x51a5('0x1a')]=qs[_0x51a5('0x1a')](_0x22ec0d['query']['offset']);}_0x47e653[_0x51a5('0x35')]=qs[_0x51a5('0x36')](_0x22ec0d['query'][_0x51a5('0x36')]);_0x47e653[_0x51a5('0x37')]=qs[_0x51a5('0x2e')](_['pick'](_0x22ec0d[_0x51a5('0x2b')],_0x3cdf45[_0x51a5('0x2e')]));if(_0x1fb192[_0x51a5('0x2c')]){if(_0x1fb192['dateEnd']){_0x1fb192[_0x51a5('0x2d')]=moment(_0x1fb192['dateEnd'])[_0x51a5('0x38')](0x1,_0x51a5('0x39'));}else{_0x1fb192[_0x51a5('0x2d')]=moment(_0x1fb192[_0x51a5('0x2c')])[_0x51a5('0x38')](0x1,'day');}_[_0x51a5('0x3a')](_0x47e653[_0x51a5('0x37')],{'createdAt':{'$gte':_0x1fb192[_0x51a5('0x2c')],'$lte':_0x1fb192[_0x51a5('0x2d')]}});}if(_0x22ec0d['query'][_0x51a5('0x3b')]){_0x47e653[_0x51a5('0x37')]=_['merge'](_0x47e653[_0x51a5('0x37')],{'$or':_[_0x51a5('0x3c')](_0x47e653['attributes'],function(_0x1e3c4b){var _0x2d6cfe={};_0x2d6cfe[_0x1e3c4b]={'$like':'%'+_0x22ec0d[_0x51a5('0x2b')]['filter']+'%'};return _0x2d6cfe;})});}_0x47e653=_[_0x51a5('0x3a')]({},_0x47e653,_0x22ec0d['options']);var _0x17f732={'where':_0x47e653[_0x51a5('0x37')]};return db[_0x51a5('0x27')][_0x51a5('0x3d')](_0x17f732)[_0x51a5('0x21')](function(_0x5f027d){_0x39e5cc[_0x51a5('0x3d')]=_0x5f027d;if(_0x22ec0d[_0x51a5('0x2b')][_0x51a5('0x3e')]){_0x47e653['include']=[{'all':!![]}];}return db['MailQueue']['findAll'](_0x47e653);})[_0x51a5('0x21')](function(_0x9d9232){_0x39e5cc[_0x51a5('0x3f')]=_0x9d9232;return _0x39e5cc;})[_0x51a5('0x21')](respondWithFilteredResult(_0x42eb01,_0x47e653))[_0x51a5('0x40')](handleError(_0x42eb01,null));};exports[_0x51a5('0x41')]=function(_0xbb4a1f,_0x3a81c4){var _0x1d591c={'raw':!![],'where':{'id':_0xbb4a1f[_0x51a5('0x42')]['id']}},_0x3a0bf1={};_0x3a0bf1[_0x51a5('0x29')]=_['keys'](db[_0x51a5('0x27')][_0x51a5('0x28')]);_0x3a0bf1[_0x51a5('0x2b')]=_[_0x51a5('0x2a')](_0xbb4a1f['query']);_0x3a0bf1[_0x51a5('0x2e')]=_['intersection'](_0x3a0bf1[_0x51a5('0x29')],_0x3a0bf1['query']);_0x1d591c['attributes']=_['intersection'](_0x3a0bf1[_0x51a5('0x29')],qs[_0x51a5('0x31')](_0xbb4a1f[_0x51a5('0x2b')][_0x51a5('0x31')]));_0x1d591c[_0x51a5('0x30')]=_0x1d591c['attributes']['length']?_0x1d591c[_0x51a5('0x30')]:_0x3a0bf1[_0x51a5('0x29')];if(_0xbb4a1f[_0x51a5('0x2b')][_0x51a5('0x3e')]){_0x1d591c[_0x51a5('0x43')]=[{'all':!![]}];}_0x1d591c=_[_0x51a5('0x3a')]({},_0x1d591c,_0xbb4a1f['options']);return db[_0x51a5('0x27')]['find'](_0x1d591c)[_0x51a5('0x21')](handleEntityNotFound(_0x3a81c4,null))['then'](respondWithResult(_0x3a81c4,null))[_0x51a5('0x40')](handleError(_0x3a81c4,null));};exports[_0x51a5('0x44')]=function(_0x409bbb,_0x4da4f1){return db[_0x51a5('0x27')]['create'](_0x409bbb[_0x51a5('0x45')],{})['then'](respondWithResult(_0x4da4f1,0xc9))['catch'](handleError(_0x4da4f1,null));};exports['update']=function(_0x31038a,_0x2377f1){if(_0x31038a['body']['id']){delete _0x31038a['body']['id'];}return db[_0x51a5('0x27')]['find']({'where':{'id':_0x31038a[_0x51a5('0x42')]['id']}})['then'](handleEntityNotFound(_0x2377f1,null))[_0x51a5('0x21')](saveUpdates(_0x31038a[_0x51a5('0x45')],null))[_0x51a5('0x21')](respondWithResult(_0x2377f1,null))[_0x51a5('0x40')](handleError(_0x2377f1,null));};exports[_0x51a5('0x46')]=function(_0x1b8b2a,_0x483225){return db[_0x51a5('0x27')][_0x51a5('0x47')]({'where':{'id':_0x1b8b2a['params']['id']}})['then'](handleEntityNotFound(_0x483225,null))[_0x51a5('0x21')](removeEntity(_0x483225,null))[_0x51a5('0x40')](handleError(_0x483225,null));};exports[_0x51a5('0x48')]=function(_0x93a6,_0x4b5eda){return db[_0x51a5('0x27')][_0x51a5('0x48')]()[_0x51a5('0x21')](respondWithResult(_0x4b5eda,null))['catch'](handleError(_0x4b5eda,null));};exports[_0x51a5('0x49')]=function(_0x1d3b2f,_0x52dbfd,_0x1cd6cc){var _0x4ca7ba={'raw':!![],'where':{}},_0x565f94={},_0x3d9c2b;return db[_0x51a5('0x27')][_0x51a5('0x4a')]({'where':{'id':_0x1d3b2f[_0x51a5('0x42')]['id']}})[_0x51a5('0x21')](handleEntityNotFound(_0x52dbfd,null))[_0x51a5('0x21')](function(_0x13e6af){if(_0x13e6af){_0x3d9c2b=_0x13e6af[_0x51a5('0x4b')]({'plain':!![]});_0x565f94[_0x51a5('0x29')]=_[_0x51a5('0x2a')](db[_0x51a5('0x4c')][_0x51a5('0x28')]);_0x565f94['query']=_[_0x51a5('0x2a')](_0x1d3b2f[_0x51a5('0x2b')]);_0x565f94[_0x51a5('0x2e')]=_[_0x51a5('0x2f')](_0x565f94[_0x51a5('0x29')],_0x565f94['query']);_0x4ca7ba[_0x51a5('0x30')]=_[_0x51a5('0x2f')](_0x565f94[_0x51a5('0x29')],qs[_0x51a5('0x31')](_0x1d3b2f['query'][_0x51a5('0x31')]));_0x4ca7ba[_0x51a5('0x30')]=_0x4ca7ba[_0x51a5('0x30')][_0x51a5('0x32')]?_0x4ca7ba[_0x51a5('0x30')]:_0x565f94[_0x51a5('0x29')];if(!_0x1d3b2f[_0x51a5('0x2b')]['hasOwnProperty']('nolimit')){_0x4ca7ba[_0x51a5('0x1b')]=qs['limit'](_0x1d3b2f[_0x51a5('0x2b')]['limit']);_0x4ca7ba[_0x51a5('0x1a')]=qs['offset'](_0x1d3b2f['query'][_0x51a5('0x1a')]);}_0x4ca7ba[_0x51a5('0x35')]=qs[_0x51a5('0x36')](_0x1d3b2f[_0x51a5('0x2b')][_0x51a5('0x36')]);_0x4ca7ba['where']=qs[_0x51a5('0x2e')](_[_0x51a5('0x4d')](_0x1d3b2f['query'],_0x565f94[_0x51a5('0x2e')]));_0x4ca7ba['where'][_0x51a5('0x4e')]=_0x13e6af['id'];if(_0x1d3b2f[_0x51a5('0x2b')][_0x51a5('0x3b')]){_0x4ca7ba[_0x51a5('0x37')]=_[_0x51a5('0x3a')](_0x4ca7ba[_0x51a5('0x37')],{'$or':_[_0x51a5('0x3c')](_0x4ca7ba['attributes'],function(_0x4628dd){var _0x45badf={};_0x45badf[_0x4628dd]={'$like':'%'+_0x1d3b2f['query'][_0x51a5('0x3b')]+'%'};return _0x45badf;})});}_0x4ca7ba=_['merge']({},_0x4ca7ba,_0x1d3b2f[_0x51a5('0x4f')]);return db[_0x51a5('0x4c')][_0x51a5('0x50')](_0x4ca7ba);}})[_0x51a5('0x21')](function(_0x4f5eb7){if(_0x4f5eb7){return db['User'][_0x51a5('0x51')]({'where':{'id':_['map'](_0x4f5eb7,_0x51a5('0x52')),'role':'agent'},'attributes':['id','name',_0x51a5('0x53'),_0x51a5('0x54'),'createdAt']});}})['then'](function(_0x1a6422){if(_0x1a6422){return{'count':_0x1a6422['count'],'rows':_[_0x51a5('0x3c')](_0x1a6422[_0x51a5('0x3f')],function(_0x2aa70c){return{'membername':_0x2aa70c[_0x51a5('0x24')],'UserId':_0x2aa70c['id'],'queue_name':_0x3d9c2b['name'],'MailQueueId':_0x3d9c2b['id'],'interface':util['format'](_0x51a5('0x55'),_0x51a5('0x56'),_0x2aa70c[_0x51a5('0x24')]),'penalty':0x0,'paused':_0x2aa70c[_0x51a5('0x53')],'createdAt':_0x2aa70c[_0x51a5('0x57')],'updatedAt':_0x2aa70c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x51a5('0x21')](respondWithFilteredResult(_0x52dbfd,_0x4ca7ba))['catch'](handleError(_0x52dbfd,null));};exports['getTeams']=function(_0x21bcbf,_0x179244,_0x42e952){var _0x55f5cd={};var _0x4d281f={};var _0x488977;var _0x2a2d6e;return db[_0x51a5('0x27')]['findOne']({'where':{'id':_0x21bcbf[_0x51a5('0x42')]['id']}})['then'](handleEntityNotFound(_0x179244,null))[_0x51a5('0x21')](function(_0x432615){if(_0x432615){_0x488977=_0x432615;_0x4d281f[_0x51a5('0x29')]=_[_0x51a5('0x2a')](db['Team']['rawAttributes']);_0x4d281f[_0x51a5('0x2b')]=_[_0x51a5('0x2a')](_0x21bcbf['query']);_0x4d281f[_0x51a5('0x2e')]=_[_0x51a5('0x2f')](_0x4d281f[_0x51a5('0x29')],_0x4d281f['query']);_0x55f5cd['attributes']=_['intersection'](_0x4d281f[_0x51a5('0x29')],qs[_0x51a5('0x31')](_0x21bcbf[_0x51a5('0x2b')][_0x51a5('0x31')]));_0x55f5cd[_0x51a5('0x30')]=_0x55f5cd[_0x51a5('0x30')][_0x51a5('0x32')]?_0x55f5cd[_0x51a5('0x30')]:_0x4d281f[_0x51a5('0x29')];_0x55f5cd[_0x51a5('0x35')]=qs[_0x51a5('0x36')](_0x21bcbf['query'][_0x51a5('0x36')]);_0x55f5cd['where']=qs[_0x51a5('0x2e')](_[_0x51a5('0x4d')](_0x21bcbf['query'],_0x4d281f[_0x51a5('0x2e')]));if(_0x21bcbf[_0x51a5('0x2b')][_0x51a5('0x3b')]){_0x55f5cd[_0x51a5('0x37')]=_[_0x51a5('0x3a')](_0x55f5cd[_0x51a5('0x37')],{'$or':_['map'](_0x55f5cd[_0x51a5('0x30')],function(_0x28c82a){var _0x1d33d7={};_0x1d33d7[_0x28c82a]={'$like':'%'+_0x21bcbf[_0x51a5('0x2b')]['filter']+'%'};return _0x1d33d7;})});}_0x55f5cd=_[_0x51a5('0x3a')]({},_0x55f5cd,_0x21bcbf[_0x51a5('0x4f')]);return _0x488977[_0x51a5('0x58')](_0x55f5cd);}})[_0x51a5('0x21')](function(_0x38d665){if(_0x38d665){_0x2a2d6e=_0x38d665[_0x51a5('0x32')];if(!_0x21bcbf[_0x51a5('0x2b')][_0x51a5('0x33')](_0x51a5('0x34'))){_0x55f5cd[_0x51a5('0x1b')]=qs['limit'](_0x21bcbf[_0x51a5('0x2b')][_0x51a5('0x1b')]);_0x55f5cd[_0x51a5('0x1a')]=qs[_0x51a5('0x1a')](_0x21bcbf[_0x51a5('0x2b')][_0x51a5('0x1a')]);}return _0x488977[_0x51a5('0x58')](_0x55f5cd);}})['then'](function(_0xa6ef9a){if(_0xa6ef9a){return _0xa6ef9a?{'count':_0x2a2d6e,'rows':_0xa6ef9a}:null;}})['then'](respondWithResult(_0x179244,null))[_0x51a5('0x40')](handleError(_0x179244,null));};exports[_0x51a5('0x59')]=function(_0x13cf52,_0x5f3d59,_0x3fa4bf){var _0x1fcecf=[];var _0x2701f4;return db[_0x51a5('0x5a')][_0x51a5('0x50')]({'where':{'id':_0x13cf52[_0x51a5('0x45')][_0x51a5('0x5b')]},'attributes':['id'],'include':[{'model':db[_0x51a5('0x5c')],'as':_0x51a5('0x5d'),'attributes':['id'],'raw':!![]}]})[_0x51a5('0x21')](function(_0x589e15){if(_0x589e15){for(var _0x1ec6a5=0x0;_0x1ec6a5<_0x589e15[_0x51a5('0x32')];_0x1ec6a5+=0x1){for(var _0x64cacb=0x0;_0x64cacb<_0x589e15[_0x1ec6a5][_0x51a5('0x5d')][_0x51a5('0x32')];_0x64cacb+=0x1){_0x1fcecf=_[_0x51a5('0x5e')](_0x1fcecf,[_0x589e15[_0x1ec6a5][_0x51a5('0x5d')][_0x64cacb]['id']]);}}return _0x1fcecf;}})[_0x51a5('0x21')](function(_0x45082f){if(_0x45082f){return db['MailQueue']['find']({'where':{'id':_0x13cf52[_0x51a5('0x42')]['id']}});}})[_0x51a5('0x21')](function(_0x27cf44){if(_0x27cf44){_0x2701f4=_0x27cf44;return _0x2701f4[_0x51a5('0x5f')](_0x1fcecf,{'penalty':_0x13cf52[_0x51a5('0x45')]['penalty']});}})[_0x51a5('0x21')](function(_0x24aa84){if(_0x24aa84){return _0x2701f4['addTeams'](_0x13cf52[_0x51a5('0x45')]['ids']);}})[_0x51a5('0x21')](handleEntityNotFound(_0x5f3d59,null))[_0x51a5('0x21')](respondWithStatusCode(_0x5f3d59,null))[_0x51a5('0x40')](handleError(_0x5f3d59,null));};exports[_0x51a5('0x60')]=function(_0x599da2,_0x33f126,_0x135eb6){var _0x5ddbe8=[];var _0x5bf330;return db[_0x51a5('0x5a')]['findAll']({'where':{'id':_0x599da2[_0x51a5('0x2b')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x51a5('0x5d'),'attributes':['id'],'raw':!![]}]})[_0x51a5('0x21')](function(_0x51c185){if(_0x51c185){for(var _0x1ce244=0x0;_0x1ce244<_0x51c185[_0x51a5('0x32')];_0x1ce244+=0x1){for(var _0x4affbf=0x0;_0x4affbf<_0x51c185[_0x1ce244]['Agents']['length'];_0x4affbf+=0x1){_0x5ddbe8=_[_0x51a5('0x5e')](_0x5ddbe8,[_0x51c185[_0x1ce244][_0x51a5('0x5d')][_0x4affbf]['id']]);}}return _0x5ddbe8;}})['then'](function(_0x4519ef){if(_0x4519ef){return db[_0x51a5('0x27')][_0x51a5('0x47')]({'where':{'id':_0x599da2[_0x51a5('0x42')]['id']}});}})[_0x51a5('0x21')](function(_0x2326f0){if(_0x2326f0){_0x5bf330=_0x2326f0;return _0x5bf330[_0x51a5('0x61')](_0x5ddbe8);}})[_0x51a5('0x21')](function(_0x5c78af){if(_0x5bf330){return _0x5bf330[_0x51a5('0x60')](_0x599da2[_0x51a5('0x2b')]['ids']);}})['then'](handleEntityNotFound(_0x33f126,null))['then'](respondWithStatusCode(_0x33f126,null))[_0x51a5('0x40')](handleError(_0x33f126,null));};exports[_0x51a5('0x5f')]=function(_0x50ff7d,_0x65410f,_0x986f14){return db[_0x51a5('0x27')][_0x51a5('0x47')]({'where':{'id':_0x50ff7d[_0x51a5('0x42')]['id']}})[_0x51a5('0x21')](handleEntityNotFound(_0x65410f,null))[_0x51a5('0x21')](function(_0x25ca52){if(_0x25ca52){return _0x25ca52[_0x51a5('0x5f')](_0x50ff7d[_0x51a5('0x45')][_0x51a5('0x5b')],_[_0x51a5('0x62')](_0x50ff7d[_0x51a5('0x45')],[_0x51a5('0x5b'),'id'])||{})[_0x51a5('0x63')](function(_0x231bb6){for(var _0x59e3ae=0x0;_0x59e3ae<_0x50ff7d[_0x51a5('0x45')][_0x51a5('0x5b')]['length'];_0x59e3ae+=0x1){socket[_0x51a5('0x64')](_0x51a5('0x65'),{'UserId':_0x50ff7d[_0x51a5('0x45')]['ids'][_0x59e3ae],'MailQueueId':_0x50ff7d[_0x51a5('0x42')]['id']});}return _0x231bb6;});}})[_0x51a5('0x21')](respondWithResult(_0x65410f,null))[_0x51a5('0x40')](handleError(_0x65410f,null));};exports[_0x51a5('0x61')]=function(_0x347dec,_0x464078,_0x3fa281){var _0x5b22c4;return db[_0x51a5('0x27')][_0x51a5('0x47')]({'where':{'id':_0x347dec['params']['id']}})[_0x51a5('0x21')](handleEntityNotFound(_0x464078,null))[_0x51a5('0x21')](function(_0x3c8d99){if(_0x3c8d99){return _0x3c8d99[_0x51a5('0x61')](_0x347dec['query'][_0x51a5('0x5b')])[_0x51a5('0x21')](function(_0x18da37){if(_[_0x51a5('0x66')](_0x347dec['query'][_0x51a5('0x5b')])){for(var _0x181d80=0x0;_0x181d80<_0x347dec[_0x51a5('0x2b')]['ids']['length'];_0x181d80+=0x1){socket['emit'](_0x51a5('0x67'),{'UserId':_0x347dec['query'][_0x51a5('0x5b')][_0x181d80],'MailQueueId':_0x347dec['params']['id']});}}else{socket[_0x51a5('0x64')](_0x51a5('0x67'),{'UserId':_0x347dec['query'][_0x51a5('0x5b')],'MailQueueId':_0x347dec[_0x51a5('0x42')]['id']});}});}})['then'](respondWithStatusCode(_0x464078,null))[_0x51a5('0x40')](handleError(_0x464078,null));};exports['getAgents']=function(_0x148a08,_0x25a95d,_0x547f70){var _0x26741e={};var _0x33135a={};var _0x380f72;var _0x1db989;return db['MailQueue'][_0x51a5('0x4a')]({'where':{'id':_0x148a08['params']['id']}})[_0x51a5('0x21')](handleEntityNotFound(_0x25a95d,null))['then'](function(_0x511c09){if(_0x511c09){_0x380f72=_0x511c09;_0x33135a[_0x51a5('0x29')]=_[_0x51a5('0x2a')](db[_0x51a5('0x5c')]['rawAttributes']);_0x33135a[_0x51a5('0x2b')]=_[_0x51a5('0x2a')](_0x148a08[_0x51a5('0x2b')]);_0x33135a[_0x51a5('0x2e')]=_['intersection'](_0x33135a['model'],_0x33135a[_0x51a5('0x2b')]);_0x26741e[_0x51a5('0x30')]=_['intersection'](_0x33135a[_0x51a5('0x29')],qs[_0x51a5('0x31')](_0x148a08[_0x51a5('0x2b')][_0x51a5('0x31')]));_0x26741e[_0x51a5('0x30')]=_0x26741e[_0x51a5('0x30')][_0x51a5('0x32')]?_0x26741e['attributes']:_0x33135a[_0x51a5('0x29')];_0x26741e['order']=qs[_0x51a5('0x36')](_0x148a08[_0x51a5('0x2b')][_0x51a5('0x36')]);_0x26741e[_0x51a5('0x37')]=qs['filters'](_[_0x51a5('0x4d')](_0x148a08[_0x51a5('0x2b')],_0x33135a['filters']));if(_0x148a08[_0x51a5('0x2b')][_0x51a5('0x3b')]){_0x26741e[_0x51a5('0x37')]=_[_0x51a5('0x3a')](_0x26741e[_0x51a5('0x37')],{'$or':_[_0x51a5('0x3c')](_0x26741e[_0x51a5('0x30')],function(_0x3e0fbc){var _0x1cf23e={};_0x1cf23e[_0x3e0fbc]={'$like':'%'+_0x148a08[_0x51a5('0x2b')][_0x51a5('0x3b')]+'%'};return _0x1cf23e;})});}_0x26741e=_[_0x51a5('0x3a')]({},_0x26741e,_0x148a08['options']);return _0x380f72[_0x51a5('0x68')](_0x26741e);}})[_0x51a5('0x21')](function(_0x4706f8){if(_0x4706f8){_0x1db989=_0x4706f8[_0x51a5('0x32')];if(!_0x148a08[_0x51a5('0x2b')][_0x51a5('0x33')](_0x51a5('0x34'))){_0x26741e[_0x51a5('0x1b')]=qs[_0x51a5('0x1b')](_0x148a08[_0x51a5('0x2b')][_0x51a5('0x1b')]);_0x26741e['offset']=qs[_0x51a5('0x1a')](_0x148a08[_0x51a5('0x2b')][_0x51a5('0x1a')]);}return _0x380f72[_0x51a5('0x68')](_0x26741e);}})[_0x51a5('0x21')](function(_0x5dea86){if(_0x5dea86){return _0x5dea86?{'count':_0x1db989,'rows':_0x5dea86}:null;}})[_0x51a5('0x21')](respondWithResult(_0x25a95d,null))['catch'](handleError(_0x25a95d,null));}; \ No newline at end of file +var _0x242c=['../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./mailQueue.socket','register','sendStatus','status','json','limit','apply','save','update','then','destroy','end','error','stack','name','send','index','MailQueue','rawAttributes','model','keys','query','dateStart','intersection','fields','attributes','hasOwnProperty','offset','order','sort','filters','pick','dateEnd','add','day','merge','filter','where','map','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','findOne','get','nolimit','MailQueueId','UserMailQueue','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','SIP','getTeams','Team','Agents','union','addAgents','addTeams','ids','removeTeams','removeAgents','omit','emit','userMailQueue:save','userMailQueue:remove','getAgents','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../config/logger','api'];(function(_0x4285ea,_0x728ad3){var _0x16a5b1=function(_0x4a1149){while(--_0x4a1149){_0x4285ea['push'](_0x4285ea['shift']());}};_0x16a5b1(++_0x728ad3);}(_0x242c,0x180));var _0xc242=function(_0x4d8521,_0x369f71){_0x4d8521=_0x4d8521-0x0;var _0x2dd57d=_0x242c[_0x4d8521];return _0x2dd57d;};'use strict';var jsonpatch=require(_0xc242('0x0'));var rp=require(_0xc242('0x1'));var moment=require('moment');var BPromise=require(_0xc242('0x2'));var Mustache=require(_0xc242('0x3'));var util=require(_0xc242('0x4'));var path=require(_0xc242('0x5'));var sox=require('sox');var csv=require(_0xc242('0x6'));var ejs=require(_0xc242('0x7'));var fs=require('fs');var _=require(_0xc242('0x8'));var squel=require(_0xc242('0x9'));var crypto=require(_0xc242('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc242('0x6'));var querystring=require(_0xc242('0xb'));var Papa=require(_0xc242('0xc'));var qs=require(_0xc242('0xd'));var logger=require(_0xc242('0xe'))(_0xc242('0xf'));var utils=require(_0xc242('0x10'));var config=require(_0xc242('0x11'));var db=require(_0xc242('0x12'))['db'];var socket=require(_0xc242('0x13'))({'host':_0xc242('0x14'),'port':0x18eb});require(_0xc242('0x15'))[_0xc242('0x16')](socket);function respondWithStatusCode(_0x294ac3,_0x1aa542){_0x1aa542=_0x1aa542||0xcc;return function(_0x48a3c3){if(_0x48a3c3){return _0x294ac3[_0xc242('0x17')](_0x1aa542);}return _0x294ac3[_0xc242('0x18')](_0x1aa542)['end']();};}function respondWithResult(_0x1db036,_0x227251){_0x227251=_0x227251||0xc8;return function(_0x47ddfb){if(_0x47ddfb){return _0x1db036['status'](_0x227251)[_0xc242('0x19')](_0x47ddfb);}};}function respondWithFilteredResult(_0x3b51cb,_0x381764){return function(_0x26ba7d){if(_0x26ba7d){var _0x68088a=_0x26ba7d['count'],_0x49f8db=_0x381764['offset'],_0x3b2cd8=_0x381764['offset']+_0x381764[_0xc242('0x1a')],_0x44fa7d;if(_0x3b2cd8>=_0x68088a){_0x3b2cd8=_0x68088a;_0x44fa7d=0xc8;}else{_0x44fa7d=0xce;}_0x3b51cb[_0xc242('0x18')](_0x44fa7d);return _0x3b51cb['set']('Content-Range',_0x49f8db+'-'+_0x3b2cd8+'/'+_0x68088a)['json'](_0x26ba7d);}return null;};}function patchUpdates(_0x15c3ef){return function(_0x5af8d1){try{jsonpatch[_0xc242('0x1b')](_0x5af8d1,_0x15c3ef,!![]);}catch(_0x4d0351){return BPromise['reject'](_0x4d0351);}return _0x5af8d1[_0xc242('0x1c')]();};}function saveUpdates(_0x1dfed6,_0x33f16d){return function(_0x44742f){if(_0x44742f){return _0x44742f[_0xc242('0x1d')](_0x1dfed6)[_0xc242('0x1e')](function(_0x2bb0d4){return _0x2bb0d4;});}return null;};}function removeEntity(_0x3f12a2,_0x429527){return function(_0x115e02){if(_0x115e02){return _0x115e02[_0xc242('0x1f')]()[_0xc242('0x1e')](function(){_0x3f12a2[_0xc242('0x18')](0xcc)[_0xc242('0x20')]();});}};}function handleEntityNotFound(_0x27f19f,_0x526da4){return function(_0x24b57){if(!_0x24b57){_0x27f19f['sendStatus'](0x194);}return _0x24b57;};}function handleError(_0x3d6964,_0xc04de5){_0xc04de5=_0xc04de5||0x1f4;return function(_0x18411c){logger[_0xc242('0x21')](_0x18411c[_0xc242('0x22')]);if(_0x18411c['name']){delete _0x18411c[_0xc242('0x23')];}_0x3d6964[_0xc242('0x18')](_0xc04de5)[_0xc242('0x24')](_0x18411c);};}exports[_0xc242('0x25')]=function(_0x182113,_0x199307){var _0x55830b={},_0x2b3e5d={},_0x670167={'count':0x0,'rows':[]};var _0x224f03=db[_0xc242('0x26')][_0xc242('0x27')];_0x2b3e5d[_0xc242('0x28')]=_[_0xc242('0x29')](_0x224f03);var _0x5055a7={'dateStart':_0x182113[_0xc242('0x2a')]['dateStart'],'dateEnd':_0x182113[_0xc242('0x2a')]['dateEnd']};delete _0x182113['query'][_0xc242('0x2b')];delete _0x182113[_0xc242('0x2a')]['dateEnd'];_0x2b3e5d[_0xc242('0x2a')]=_['keys'](_0x182113[_0xc242('0x2a')]);_0x2b3e5d['filters']=_[_0xc242('0x2c')](_0x2b3e5d[_0xc242('0x28')],_0x2b3e5d[_0xc242('0x2a')]);_0x55830b['attributes']=_[_0xc242('0x2c')](_0x2b3e5d['model'],qs[_0xc242('0x2d')](_0x182113[_0xc242('0x2a')][_0xc242('0x2d')]));_0x55830b['attributes']=_0x55830b[_0xc242('0x2e')]['length']?_0x55830b[_0xc242('0x2e')]:_0x2b3e5d[_0xc242('0x28')];if(!_0x182113[_0xc242('0x2a')][_0xc242('0x2f')]('nolimit')){_0x55830b[_0xc242('0x1a')]=qs['limit'](_0x182113[_0xc242('0x2a')][_0xc242('0x1a')]);_0x55830b[_0xc242('0x30')]=qs['offset'](_0x182113[_0xc242('0x2a')][_0xc242('0x30')]);}_0x55830b[_0xc242('0x31')]=qs[_0xc242('0x32')](_0x182113[_0xc242('0x2a')][_0xc242('0x32')]);_0x55830b['where']=qs[_0xc242('0x33')](_[_0xc242('0x34')](_0x182113[_0xc242('0x2a')],_0x2b3e5d['filters']));if(_0x5055a7[_0xc242('0x2b')]){if(_0x5055a7[_0xc242('0x35')]){_0x5055a7['dateEnd']=moment(_0x5055a7[_0xc242('0x35')])[_0xc242('0x36')](0x1,_0xc242('0x37'));}else{_0x5055a7['dateEnd']=moment(_0x5055a7[_0xc242('0x2b')])[_0xc242('0x36')](0x1,_0xc242('0x37'));}_[_0xc242('0x38')](_0x55830b['where'],{'createdAt':{'$gte':_0x5055a7[_0xc242('0x2b')],'$lte':_0x5055a7['dateEnd']}});}if(_0x182113[_0xc242('0x2a')][_0xc242('0x39')]){_0x55830b[_0xc242('0x3a')]=_[_0xc242('0x38')](_0x55830b[_0xc242('0x3a')],{'$or':_[_0xc242('0x3b')](_0x55830b['attributes'],function(_0x3a7e08){var _0x3d0d02={};_0x3d0d02[_0x3a7e08]={'$like':'%'+_0x182113[_0xc242('0x2a')][_0xc242('0x39')]+'%'};return _0x3d0d02;})});}_0x55830b=_[_0xc242('0x38')]({},_0x55830b,_0x182113[_0xc242('0x3c')]);var _0x2c6a98={'where':_0x55830b['where']};return db[_0xc242('0x26')][_0xc242('0x3d')](_0x2c6a98)[_0xc242('0x1e')](function(_0x4feb48){_0x670167[_0xc242('0x3d')]=_0x4feb48;if(_0x182113['query']['includeAll']){_0x55830b[_0xc242('0x3e')]=[{'all':!![]}];}return db[_0xc242('0x26')][_0xc242('0x3f')](_0x55830b);})[_0xc242('0x1e')](function(_0xe57ec0){_0x670167[_0xc242('0x40')]=_0xe57ec0;return _0x670167;})[_0xc242('0x1e')](respondWithFilteredResult(_0x199307,_0x55830b))[_0xc242('0x41')](handleError(_0x199307,null));};exports[_0xc242('0x42')]=function(_0x9b5c74,_0x49809a){var _0x585ee7={'raw':!![],'where':{'id':_0x9b5c74[_0xc242('0x43')]['id']}},_0x2dbfa7={};_0x2dbfa7[_0xc242('0x28')]=_['keys'](db[_0xc242('0x26')][_0xc242('0x27')]);_0x2dbfa7['query']=_[_0xc242('0x29')](_0x9b5c74[_0xc242('0x2a')]);_0x2dbfa7[_0xc242('0x33')]=_[_0xc242('0x2c')](_0x2dbfa7['model'],_0x2dbfa7[_0xc242('0x2a')]);_0x585ee7[_0xc242('0x2e')]=_[_0xc242('0x2c')](_0x2dbfa7[_0xc242('0x28')],qs[_0xc242('0x2d')](_0x9b5c74[_0xc242('0x2a')][_0xc242('0x2d')]));_0x585ee7['attributes']=_0x585ee7[_0xc242('0x2e')][_0xc242('0x44')]?_0x585ee7['attributes']:_0x2dbfa7[_0xc242('0x28')];if(_0x9b5c74[_0xc242('0x2a')][_0xc242('0x45')]){_0x585ee7['include']=[{'all':!![]}];}_0x585ee7=_[_0xc242('0x38')]({},_0x585ee7,_0x9b5c74['options']);return db[_0xc242('0x26')][_0xc242('0x46')](_0x585ee7)[_0xc242('0x1e')](handleEntityNotFound(_0x49809a,null))[_0xc242('0x1e')](respondWithResult(_0x49809a,null))[_0xc242('0x41')](handleError(_0x49809a,null));};exports[_0xc242('0x47')]=function(_0x12cbeb,_0x54229){return db[_0xc242('0x26')][_0xc242('0x47')](_0x12cbeb[_0xc242('0x48')],{})[_0xc242('0x1e')](respondWithResult(_0x54229,0xc9))[_0xc242('0x41')](handleError(_0x54229,null));};exports[_0xc242('0x1d')]=function(_0x55234a,_0x5a66a1){if(_0x55234a[_0xc242('0x48')]['id']){delete _0x55234a[_0xc242('0x48')]['id'];}return db[_0xc242('0x26')][_0xc242('0x46')]({'where':{'id':_0x55234a['params']['id']}})['then'](handleEntityNotFound(_0x5a66a1,null))[_0xc242('0x1e')](saveUpdates(_0x55234a[_0xc242('0x48')],null))[_0xc242('0x1e')](respondWithResult(_0x5a66a1,null))[_0xc242('0x41')](handleError(_0x5a66a1,null));};exports[_0xc242('0x1f')]=function(_0x2c7907,_0x542f33){return db['MailQueue'][_0xc242('0x46')]({'where':{'id':_0x2c7907[_0xc242('0x43')]['id']}})[_0xc242('0x1e')](handleEntityNotFound(_0x542f33,null))['then'](removeEntity(_0x542f33,null))[_0xc242('0x41')](handleError(_0x542f33,null));};exports[_0xc242('0x49')]=function(_0x5d718c,_0x815c41){return db[_0xc242('0x26')][_0xc242('0x49')]()[_0xc242('0x1e')](respondWithResult(_0x815c41,null))[_0xc242('0x41')](handleError(_0x815c41,null));};exports['getMembers']=function(_0x3243c7,_0x55fefb,_0x1bd41e){var _0x3a3a7b={'raw':!![],'where':{}},_0x229c08={},_0x3938f5;return db['MailQueue'][_0xc242('0x4a')]({'where':{'id':_0x3243c7[_0xc242('0x43')]['id']}})['then'](handleEntityNotFound(_0x55fefb,null))['then'](function(_0x265675){if(_0x265675){_0x3938f5=_0x265675[_0xc242('0x4b')]({'plain':!![]});_0x229c08[_0xc242('0x28')]=_['keys'](db['UserMailQueue'][_0xc242('0x27')]);_0x229c08[_0xc242('0x2a')]=_[_0xc242('0x29')](_0x3243c7[_0xc242('0x2a')]);_0x229c08[_0xc242('0x33')]=_[_0xc242('0x2c')](_0x229c08[_0xc242('0x28')],_0x229c08[_0xc242('0x2a')]);_0x3a3a7b['attributes']=_[_0xc242('0x2c')](_0x229c08[_0xc242('0x28')],qs[_0xc242('0x2d')](_0x3243c7[_0xc242('0x2a')][_0xc242('0x2d')]));_0x3a3a7b[_0xc242('0x2e')]=_0x3a3a7b['attributes'][_0xc242('0x44')]?_0x3a3a7b['attributes']:_0x229c08['model'];if(!_0x3243c7[_0xc242('0x2a')][_0xc242('0x2f')](_0xc242('0x4c'))){_0x3a3a7b[_0xc242('0x1a')]=qs[_0xc242('0x1a')](_0x3243c7[_0xc242('0x2a')]['limit']);_0x3a3a7b[_0xc242('0x30')]=qs['offset'](_0x3243c7['query']['offset']);}_0x3a3a7b[_0xc242('0x31')]=qs[_0xc242('0x32')](_0x3243c7[_0xc242('0x2a')][_0xc242('0x32')]);_0x3a3a7b[_0xc242('0x3a')]=qs[_0xc242('0x33')](_['pick'](_0x3243c7['query'],_0x229c08[_0xc242('0x33')]));_0x3a3a7b[_0xc242('0x3a')][_0xc242('0x4d')]=_0x265675['id'];if(_0x3243c7[_0xc242('0x2a')][_0xc242('0x39')]){_0x3a3a7b[_0xc242('0x3a')]=_[_0xc242('0x38')](_0x3a3a7b[_0xc242('0x3a')],{'$or':_[_0xc242('0x3b')](_0x3a3a7b[_0xc242('0x2e')],function(_0x49bf84){var _0xba814c={};_0xba814c[_0x49bf84]={'$like':'%'+_0x3243c7[_0xc242('0x2a')][_0xc242('0x39')]+'%'};return _0xba814c;})});}_0x3a3a7b=_[_0xc242('0x38')]({},_0x3a3a7b,_0x3243c7[_0xc242('0x3c')]);return db[_0xc242('0x4e')]['findAll'](_0x3a3a7b);}})['then'](function(_0x33442a){if(_0x33442a){return db[_0xc242('0x4f')][_0xc242('0x50')]({'where':{'id':_['map'](_0x33442a,_0xc242('0x51')),'role':'agent'},'attributes':['id','name',_0xc242('0x52'),_0xc242('0x53'),_0xc242('0x54')]});}})[_0xc242('0x1e')](function(_0x32668b){if(_0x32668b){return{'count':_0x32668b[_0xc242('0x3d')],'rows':_[_0xc242('0x3b')](_0x32668b[_0xc242('0x40')],function(_0x1690ae){return{'membername':_0x1690ae['name'],'UserId':_0x1690ae['id'],'queue_name':_0x3938f5[_0xc242('0x23')],'MailQueueId':_0x3938f5['id'],'interface':util['format']('%s/%s',_0xc242('0x55'),_0x1690ae[_0xc242('0x23')]),'penalty':0x0,'paused':_0x1690ae[_0xc242('0x52')],'createdAt':_0x1690ae[_0xc242('0x54')],'updatedAt':_0x1690ae[_0xc242('0x53')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x55fefb,_0x3a3a7b))[_0xc242('0x41')](handleError(_0x55fefb,null));};exports[_0xc242('0x56')]=function(_0x156b74,_0x49a38a,_0x11fa57){var _0x8e691d={};var _0x29089d={};var _0x28d605;var _0x57a0c8;return db['MailQueue'][_0xc242('0x4a')]({'where':{'id':_0x156b74[_0xc242('0x43')]['id']}})['then'](handleEntityNotFound(_0x49a38a,null))[_0xc242('0x1e')](function(_0x2599f0){if(_0x2599f0){_0x28d605=_0x2599f0;_0x29089d[_0xc242('0x28')]=_[_0xc242('0x29')](db[_0xc242('0x57')]['rawAttributes']);_0x29089d[_0xc242('0x2a')]=_[_0xc242('0x29')](_0x156b74[_0xc242('0x2a')]);_0x29089d[_0xc242('0x33')]=_['intersection'](_0x29089d[_0xc242('0x28')],_0x29089d[_0xc242('0x2a')]);_0x8e691d[_0xc242('0x2e')]=_[_0xc242('0x2c')](_0x29089d['model'],qs[_0xc242('0x2d')](_0x156b74[_0xc242('0x2a')][_0xc242('0x2d')]));_0x8e691d[_0xc242('0x2e')]=_0x8e691d['attributes'][_0xc242('0x44')]?_0x8e691d[_0xc242('0x2e')]:_0x29089d[_0xc242('0x28')];_0x8e691d[_0xc242('0x31')]=qs[_0xc242('0x32')](_0x156b74[_0xc242('0x2a')][_0xc242('0x32')]);_0x8e691d['where']=qs[_0xc242('0x33')](_[_0xc242('0x34')](_0x156b74[_0xc242('0x2a')],_0x29089d[_0xc242('0x33')]));if(_0x156b74[_0xc242('0x2a')][_0xc242('0x39')]){_0x8e691d[_0xc242('0x3a')]=_['merge'](_0x8e691d[_0xc242('0x3a')],{'$or':_['map'](_0x8e691d[_0xc242('0x2e')],function(_0x33d684){var _0x918586={};_0x918586[_0x33d684]={'$like':'%'+_0x156b74['query']['filter']+'%'};return _0x918586;})});}_0x8e691d=_[_0xc242('0x38')]({},_0x8e691d,_0x156b74[_0xc242('0x3c')]);return _0x28d605['getTeams'](_0x8e691d);}})['then'](function(_0x528395){if(_0x528395){_0x57a0c8=_0x528395[_0xc242('0x44')];if(!_0x156b74[_0xc242('0x2a')][_0xc242('0x2f')](_0xc242('0x4c'))){_0x8e691d[_0xc242('0x1a')]=qs[_0xc242('0x1a')](_0x156b74[_0xc242('0x2a')][_0xc242('0x1a')]);_0x8e691d['offset']=qs[_0xc242('0x30')](_0x156b74[_0xc242('0x2a')]['offset']);}return _0x28d605[_0xc242('0x56')](_0x8e691d);}})[_0xc242('0x1e')](function(_0x1453c2){if(_0x1453c2){return _0x1453c2?{'count':_0x57a0c8,'rows':_0x1453c2}:null;}})[_0xc242('0x1e')](respondWithResult(_0x49a38a,null))['catch'](handleError(_0x49a38a,null));};exports['addTeams']=function(_0x340f82,_0x436474,_0xf1129d){var _0x11384e=[];var _0x1a4c37;return db['Team'][_0xc242('0x3f')]({'where':{'id':_0x340f82[_0xc242('0x48')]['ids']},'attributes':['id'],'include':[{'model':db[_0xc242('0x4f')],'as':_0xc242('0x58'),'attributes':['id'],'raw':!![]}]})[_0xc242('0x1e')](function(_0xd9a77e){if(_0xd9a77e){for(var _0x5664eb=0x0;_0x5664eb<_0xd9a77e[_0xc242('0x44')];_0x5664eb+=0x1){for(var _0x34c8b0=0x0;_0x34c8b0<_0xd9a77e[_0x5664eb][_0xc242('0x58')][_0xc242('0x44')];_0x34c8b0+=0x1){_0x11384e=_[_0xc242('0x59')](_0x11384e,[_0xd9a77e[_0x5664eb][_0xc242('0x58')][_0x34c8b0]['id']]);}}return _0x11384e;}})['then'](function(_0x4d9240){if(_0x4d9240){return db[_0xc242('0x26')]['find']({'where':{'id':_0x340f82['params']['id']}});}})[_0xc242('0x1e')](function(_0x543cca){if(_0x543cca){_0x1a4c37=_0x543cca;return _0x1a4c37[_0xc242('0x5a')](_0x11384e,{'penalty':_0x340f82[_0xc242('0x48')]['penalty']});}})[_0xc242('0x1e')](function(_0x10ff5d){if(_0x10ff5d){return _0x1a4c37[_0xc242('0x5b')](_0x340f82[_0xc242('0x48')][_0xc242('0x5c')]);}})[_0xc242('0x1e')](handleEntityNotFound(_0x436474,null))[_0xc242('0x1e')](respondWithStatusCode(_0x436474,null))[_0xc242('0x41')](handleError(_0x436474,null));};exports[_0xc242('0x5d')]=function(_0x4b3bd7,_0x13a153,_0x535e98){var _0x5974f9=[];var _0x3e12aa;return db[_0xc242('0x57')][_0xc242('0x3f')]({'where':{'id':_0x4b3bd7[_0xc242('0x2a')][_0xc242('0x5c')]},'attributes':['id'],'include':[{'model':db[_0xc242('0x4f')],'as':_0xc242('0x58'),'attributes':['id'],'raw':!![]}]})[_0xc242('0x1e')](function(_0x45355d){if(_0x45355d){for(var _0x2b7926=0x0;_0x2b7926<_0x45355d[_0xc242('0x44')];_0x2b7926+=0x1){for(var _0x33359c=0x0;_0x33359c<_0x45355d[_0x2b7926][_0xc242('0x58')][_0xc242('0x44')];_0x33359c+=0x1){_0x5974f9=_[_0xc242('0x59')](_0x5974f9,[_0x45355d[_0x2b7926]['Agents'][_0x33359c]['id']]);}}return _0x5974f9;}})[_0xc242('0x1e')](function(_0x26a77f){if(_0x26a77f){return db[_0xc242('0x26')]['find']({'where':{'id':_0x4b3bd7[_0xc242('0x43')]['id']}});}})['then'](function(_0xd27118){if(_0xd27118){_0x3e12aa=_0xd27118;return _0x3e12aa[_0xc242('0x5e')](_0x5974f9);}})['then'](function(_0x3a4362){if(_0x3e12aa){return _0x3e12aa[_0xc242('0x5d')](_0x4b3bd7[_0xc242('0x2a')][_0xc242('0x5c')]);}})['then'](handleEntityNotFound(_0x13a153,null))[_0xc242('0x1e')](respondWithStatusCode(_0x13a153,null))['catch'](handleError(_0x13a153,null));};exports[_0xc242('0x5a')]=function(_0x3778e4,_0x3e3b2b,_0x1aa5e6){return db[_0xc242('0x26')]['find']({'where':{'id':_0x3778e4['params']['id']}})[_0xc242('0x1e')](handleEntityNotFound(_0x3e3b2b,null))[_0xc242('0x1e')](function(_0x1bd970){if(_0x1bd970){return _0x1bd970[_0xc242('0x5a')](_0x3778e4[_0xc242('0x48')]['ids'],_[_0xc242('0x5f')](_0x3778e4[_0xc242('0x48')],[_0xc242('0x5c'),'id'])||{})['spread'](function(_0xf5cd76){for(var _0x89ce81=0x0;_0x89ce81<_0x3778e4[_0xc242('0x48')][_0xc242('0x5c')][_0xc242('0x44')];_0x89ce81+=0x1){socket[_0xc242('0x60')](_0xc242('0x61'),{'UserId':_0x3778e4['body'][_0xc242('0x5c')][_0x89ce81],'MailQueueId':_0x3778e4[_0xc242('0x43')]['id']});}return _0xf5cd76;});}})[_0xc242('0x1e')](respondWithResult(_0x3e3b2b,null))[_0xc242('0x41')](handleError(_0x3e3b2b,null));};exports[_0xc242('0x5e')]=function(_0x5088a0,_0x3e8591,_0x57a608){var _0x20ccdb;return db[_0xc242('0x26')][_0xc242('0x46')]({'where':{'id':_0x5088a0[_0xc242('0x43')]['id']}})[_0xc242('0x1e')](handleEntityNotFound(_0x3e8591,null))['then'](function(_0x30ebea){if(_0x30ebea){return _0x30ebea[_0xc242('0x5e')](_0x5088a0['query']['ids'])[_0xc242('0x1e')](function(_0x4196b9){if(_['isArray'](_0x5088a0[_0xc242('0x2a')][_0xc242('0x5c')])){for(var _0x2c4955=0x0;_0x2c4955<_0x5088a0[_0xc242('0x2a')][_0xc242('0x5c')][_0xc242('0x44')];_0x2c4955+=0x1){socket[_0xc242('0x60')]('userMailQueue:remove',{'UserId':_0x5088a0[_0xc242('0x2a')][_0xc242('0x5c')][_0x2c4955],'MailQueueId':_0x5088a0[_0xc242('0x43')]['id']});}}else{socket[_0xc242('0x60')](_0xc242('0x62'),{'UserId':_0x5088a0[_0xc242('0x2a')]['ids'],'MailQueueId':_0x5088a0[_0xc242('0x43')]['id']});}});}})['then'](respondWithStatusCode(_0x3e8591,null))[_0xc242('0x41')](handleError(_0x3e8591,null));};exports['getAgents']=function(_0x15f994,_0x368ef8,_0x38b2f1){var _0x119367={};var _0x4e0927={};var _0x404fcd;var _0x50be1c;return db['MailQueue'][_0xc242('0x4a')]({'where':{'id':_0x15f994['params']['id']}})['then'](handleEntityNotFound(_0x368ef8,null))[_0xc242('0x1e')](function(_0x4b0ed9){if(_0x4b0ed9){_0x404fcd=_0x4b0ed9;_0x4e0927['model']=_[_0xc242('0x29')](db[_0xc242('0x4f')]['rawAttributes']);_0x4e0927[_0xc242('0x2a')]=_['keys'](_0x15f994[_0xc242('0x2a')]);_0x4e0927[_0xc242('0x33')]=_[_0xc242('0x2c')](_0x4e0927[_0xc242('0x28')],_0x4e0927[_0xc242('0x2a')]);_0x119367[_0xc242('0x2e')]=_[_0xc242('0x2c')](_0x4e0927[_0xc242('0x28')],qs[_0xc242('0x2d')](_0x15f994[_0xc242('0x2a')][_0xc242('0x2d')]));_0x119367[_0xc242('0x2e')]=_0x119367[_0xc242('0x2e')][_0xc242('0x44')]?_0x119367[_0xc242('0x2e')]:_0x4e0927[_0xc242('0x28')];_0x119367[_0xc242('0x31')]=qs[_0xc242('0x32')](_0x15f994['query']['sort']);_0x119367[_0xc242('0x3a')]=qs[_0xc242('0x33')](_[_0xc242('0x34')](_0x15f994[_0xc242('0x2a')],_0x4e0927[_0xc242('0x33')]));if(_0x15f994[_0xc242('0x2a')][_0xc242('0x39')]){_0x119367[_0xc242('0x3a')]=_['merge'](_0x119367['where'],{'$or':_[_0xc242('0x3b')](_0x119367[_0xc242('0x2e')],function(_0x1e0d37){var _0x933dd1={};_0x933dd1[_0x1e0d37]={'$like':'%'+_0x15f994[_0xc242('0x2a')]['filter']+'%'};return _0x933dd1;})});}_0x119367=_[_0xc242('0x38')]({},_0x119367,_0x15f994[_0xc242('0x3c')]);return _0x404fcd[_0xc242('0x63')](_0x119367);}})[_0xc242('0x1e')](function(_0x5c61da){if(_0x5c61da){_0x50be1c=_0x5c61da[_0xc242('0x44')];if(!_0x15f994['query'][_0xc242('0x2f')](_0xc242('0x4c'))){_0x119367[_0xc242('0x1a')]=qs[_0xc242('0x1a')](_0x15f994[_0xc242('0x2a')][_0xc242('0x1a')]);_0x119367[_0xc242('0x30')]=qs[_0xc242('0x30')](_0x15f994[_0xc242('0x2a')][_0xc242('0x30')]);}return _0x404fcd[_0xc242('0x63')](_0x119367);}})[_0xc242('0x1e')](function(_0x185f31){if(_0x185f31){return _0x185f31?{'count':_0x50be1c,'rows':_0x185f31}:null;}})[_0xc242('0x1e')](respondWithResult(_0x368ef8,null))[_0xc242('0x41')](handleError(_0x368ef8,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 7832152..162c01f 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 _0x1d75=['../../mysqldb','MailQueue','setMaxListeners','save','emit','hasOwnProperty','exports','events'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0x1d75,0x7f));var _0x51d7=function(_0xeffc63,_0x4acafd){_0xeffc63=_0xeffc63-0x0;var _0x175db2=_0x1d75[_0xeffc63];return _0x175db2;};'use strict';var EventEmitter=require(_0x51d7('0x0'));var MailQueue=require(_0x51d7('0x1'))['db'][_0x51d7('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x51d7('0x3')](0x0);var events={'afterCreate':_0x51d7('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1abb09){return function(_0x36fcda,_0x586558,_0x5bdcc2){MailQueueEvents['emit'](_0x1abb09+':'+_0x36fcda['id'],_0x36fcda);MailQueueEvents[_0x51d7('0x5')](_0x1abb09,_0x36fcda);_0x5bdcc2(null);};}for(var e in events){if(events[_0x51d7('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x51d7('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x8a78=['MailQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x114adc,_0x1b1c55){var _0x19199a=function(_0x2c9442){while(--_0x2c9442){_0x114adc['push'](_0x114adc['shift']());}};_0x19199a(++_0x1b1c55);}(_0x8a78,0x15c));var _0x88a7=function(_0x208961,_0x5e6cf6){_0x208961=_0x208961-0x0;var _0x4236f5=_0x8a78[_0x208961];return _0x4236f5;};'use strict';var EventEmitter=require(_0x88a7('0x0'));var MailQueue=require(_0x88a7('0x1'))['db'][_0x88a7('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x88a7('0x3')](0x0);var events={'afterCreate':_0x88a7('0x4'),'afterUpdate':'update','afterDestroy':_0x88a7('0x5')};function emitEvent(_0x32537f){return function(_0x327b60,_0x61d82f,_0x36a55a){MailQueueEvents[_0x88a7('0x6')](_0x32537f+':'+_0x327b60['id'],_0x327b60);MailQueueEvents['emit'](_0x32537f,_0x327b60);_0x36a55a(null);};}for(var e in events){if(events[_0x88a7('0x7')](e)){var event=events[e];MailQueue[_0x88a7('0x8')](e,emitEvent(event));}}module[_0x88a7('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 4ae811e..1c45395 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 _0x26b0=['api','moment','bluebird','request-promise','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger'];(function(_0xb48cde,_0x171ba0){var _0x974087=function(_0x5eb548){while(--_0x5eb548){_0xb48cde['push'](_0xb48cde['shift']());}};_0x974087(++_0x171ba0);}(_0x26b0,0x19f));var _0x026b=function(_0xe32406,_0x45e983){_0xe32406=_0xe32406-0x0;var _0x187a0b=_0x26b0[_0xe32406];return _0x187a0b;};'use strict';var _=require(_0x026b('0x0'));var util=require(_0x026b('0x1'));var logger=require(_0x026b('0x2'))(_0x026b('0x3'));var moment=require(_0x026b('0x4'));var BPromise=require(_0x026b('0x5'));var rp=require(_0x026b('0x6'));var attributes=require('./mailQueue.attributes');module[_0x026b('0x7')]=function(_0x3155e7,_0x4b7d47){return _0x3155e7[_0x026b('0x8')](_0x026b('0x9'),attributes,{'tableName':_0x026b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd19f=['exports','define','MailQueue','lodash','util','../../config/logger','api','moment','request-promise','./mailQueue.attributes'];(function(_0x59cf24,_0x287095){var _0x1f2cb1=function(_0x318aa2){while(--_0x318aa2){_0x59cf24['push'](_0x59cf24['shift']());}};_0x1f2cb1(++_0x287095);}(_0xd19f,0x1c5));var _0xfd19=function(_0x506172,_0xbc3a3){_0x506172=_0x506172-0x0;var _0x2723c0=_0xd19f[_0x506172];return _0x2723c0;};'use strict';var _=require(_0xfd19('0x0'));var util=require(_0xfd19('0x1'));var logger=require(_0xfd19('0x2'))(_0xfd19('0x3'));var moment=require(_0xfd19('0x4'));var BPromise=require('bluebird');var rp=require(_0xfd19('0x5'));var attributes=require(_0xfd19('0x6'));module[_0xfd19('0x7')]=function(_0x462ddc,_0x2a2e0e){return _0x462ddc[_0xfd19('0x8')](_0xfd19('0x9'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index b82bc54..60d74be 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 _0xb954=['findAll','options','raw','where','attributes','limit','map','include','model','debug','ShowMailQueue','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','socket.io-emitter','localhost','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailQueue','MailQueue'];(function(_0xf6e834,_0x1b8457){var _0x1ce4c8=function(_0x361787){while(--_0x361787){_0xf6e834['push'](_0xf6e834['shift']());}};_0x1ce4c8(++_0x1b8457);}(_0xb954,0x115));var _0x4b95=function(_0x55456f,_0x3f561a){_0x55456f=_0x55456f-0x0;var _0x34d223=_0xb954[_0x55456f];return _0x34d223;};'use strict';var _=require(_0x4b95('0x0'));var util=require(_0x4b95('0x1'));var moment=require(_0x4b95('0x2'));var BPromise=require(_0x4b95('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x4b95('0x4'));var logger=require('../../config/logger')(_0x4b95('0x5'));var config=require(_0x4b95('0x6'));var jayson=require(_0x4b95('0x7'));var client=jayson[_0x4b95('0x8')]['http']({'port':0x232a});var socket=require(_0x4b95('0x9'))({'host':_0x4b95('0xa'),'port':0x18eb});require(_0x4b95('0xb'))[_0x4b95('0xc')](socket);function respondWithRpcPromise(_0xe9710c,_0x2d2116,_0x3997f7){return new BPromise(function(_0x10d1ef,_0x4869a5){return client[_0x4b95('0xd')](_0xe9710c,_0x3997f7)[_0x4b95('0xe')](function(_0x293a63){logger['info'](_0x4b95('0xf'),_0x2d2116,_0x4b95('0x10'));logger['debug'](_0x4b95('0x11'),_0x2d2116,_0x4b95('0x10'),JSON[_0x4b95('0x12')](_0x293a63));if(_0x293a63[_0x4b95('0x13')]){if(_0x293a63['error'][_0x4b95('0x14')]===0x1f4){logger[_0x4b95('0x13')](_0x4b95('0xf'),_0x2d2116,_0x293a63[_0x4b95('0x13')]['message']);return _0x4869a5(_0x293a63['error'][_0x4b95('0x15')]);}logger[_0x4b95('0x13')](_0x4b95('0xf'),_0x2d2116,_0x293a63[_0x4b95('0x13')][_0x4b95('0x15')]);return _0x10d1ef(_0x293a63['error'][_0x4b95('0x15')]);}else{logger[_0x4b95('0x16')](_0x4b95('0xf'),_0x2d2116,_0x4b95('0x10'));_0x10d1ef(_0x293a63[_0x4b95('0x17')][_0x4b95('0x15')]);}})[_0x4b95('0x18')](function(_0x530676){logger[_0x4b95('0x13')](_0x4b95('0xf'),_0x2d2116,_0x530676);_0x4869a5(_0x530676);});});}exports[_0x4b95('0x19')]=function(_0x6d4313){var _0x5a4b66=this;return new Promise(function(_0x565915,_0x3c9a98){return db[_0x4b95('0x1a')][_0x4b95('0x1b')]({'raw':_0x6d4313[_0x4b95('0x1c')]?_0x6d4313[_0x4b95('0x1c')][_0x4b95('0x1d')]===undefined?!![]:![]:!![],'where':_0x6d4313['options']?_0x6d4313[_0x4b95('0x1c')][_0x4b95('0x1e')]||null:null,'attributes':_0x6d4313[_0x4b95('0x1c')]?_0x6d4313[_0x4b95('0x1c')][_0x4b95('0x1f')]||null:null,'limit':_0x6d4313[_0x4b95('0x1c')]?_0x6d4313[_0x4b95('0x1c')][_0x4b95('0x20')]||null:null,'include':_0x6d4313[_0x4b95('0x1c')]?_0x6d4313[_0x4b95('0x1c')]['include']?_[_0x4b95('0x21')](_0x6d4313[_0x4b95('0x1c')][_0x4b95('0x22')],function(_0x4e12b7){return{'model':db[_0x4e12b7[_0x4b95('0x23')]],'as':_0x4e12b7['as'],'attributes':_0x4e12b7[_0x4b95('0x1f')],'include':_0x4e12b7[_0x4b95('0x22')]?_['map'](_0x4e12b7[_0x4b95('0x22')],function(_0x1b60f9){return{'model':db[_0x1b60f9[_0x4b95('0x23')]],'as':_0x1b60f9['as'],'attributes':_0x1b60f9['attributes'],'include':_0x1b60f9[_0x4b95('0x22')]?_['map'](_0x1b60f9[_0x4b95('0x22')],function(_0x4fad1a){return{'model':db[_0x4fad1a[_0x4b95('0x23')]],'as':_0x4fad1a['as'],'attributes':_0x4fad1a[_0x4b95('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4b95('0xe')](function(_0x11ea9a){logger[_0x4b95('0x16')](_0x4b95('0x19'),_0x6d4313);logger[_0x4b95('0x24')](_0x4b95('0x19'),_0x6d4313,JSON[_0x4b95('0x12')](_0x11ea9a));_0x565915(_0x11ea9a);})['catch'](function(_0x3c2b89){logger[_0x4b95('0x13')](_0x4b95('0x19'),_0x3c2b89[_0x4b95('0x15')],_0x6d4313);_0x3c9a98(_0x5a4b66[_0x4b95('0x13')](0x1f4,_0x3c2b89['message']));});});};exports[_0x4b95('0x25')]=function(_0xc8d8ac){var _0x1e17c1=this;return new Promise(function(_0x398d3a,_0x420616){return db[_0x4b95('0x1a')]['find']({'raw':_0xc8d8ac[_0x4b95('0x1c')]?_0xc8d8ac[_0x4b95('0x1c')][_0x4b95('0x1d')]===undefined?!![]:![]:!![],'where':_0xc8d8ac[_0x4b95('0x1c')]?_0xc8d8ac[_0x4b95('0x1c')][_0x4b95('0x1e')]||null:null,'attributes':_0xc8d8ac[_0x4b95('0x1c')]?_0xc8d8ac[_0x4b95('0x1c')]['attributes']||null:null,'include':_0xc8d8ac[_0x4b95('0x1c')]?_0xc8d8ac['options']['include']?_[_0x4b95('0x21')](_0xc8d8ac[_0x4b95('0x1c')][_0x4b95('0x22')],function(_0x53c82c){return{'model':db[_0x53c82c[_0x4b95('0x23')]],'as':_0x53c82c['as'],'attributes':_0x53c82c['attributes'],'include':_0x53c82c[_0x4b95('0x22')]?_['map'](_0x53c82c[_0x4b95('0x22')],function(_0x1b0bbd){return{'model':db[_0x1b0bbd['model']],'as':_0x1b0bbd['as'],'attributes':_0x1b0bbd['attributes'],'include':_0x1b0bbd['include']?_[_0x4b95('0x21')](_0x1b0bbd['include'],function(_0x573310){return{'model':db[_0x573310[_0x4b95('0x23')]],'as':_0x573310['as'],'attributes':_0x573310['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x35eae9){logger[_0x4b95('0x16')](_0x4b95('0x25'),_0xc8d8ac);logger[_0x4b95('0x24')]('ShowMailQueue',_0xc8d8ac,JSON[_0x4b95('0x12')](_0x35eae9));_0x398d3a(_0x35eae9);})['catch'](function(_0x4cf517){logger[_0x4b95('0x13')](_0x4b95('0x25'),_0x4cf517['message'],_0xc8d8ac);_0x420616(_0x1e17c1['error'](0x1f4,_0x4cf517[_0x4b95('0x15')]));});});}; \ No newline at end of file +var _0x61e6=['ShowMailQueue','find','lodash','util','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','include','model','map','info','catch'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x61e6,0x10c));var _0x661e=function(_0x48f796,_0x49d240){_0x48f796=_0x48f796-0x0;var _0x1f94d5=_0x61e6[_0x48f796];return _0x1f94d5;};'use strict';var _=require(_0x661e('0x0'));var util=require(_0x661e('0x1'));var moment=require('moment');var BPromise=require(_0x661e('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x661e('0x3'));var logger=require('../../config/logger')(_0x661e('0x4'));var config=require(_0x661e('0x5'));var jayson=require(_0x661e('0x6'));var client=jayson[_0x661e('0x7')][_0x661e('0x8')]({'port':0x232a});var socket=require(_0x661e('0x9'))({'host':_0x661e('0xa'),'port':0x18eb});require(_0x661e('0xb'))[_0x661e('0xc')](socket);function respondWithRpcPromise(_0x1d7e1d,_0x59c244,_0x39f9dd){return new BPromise(function(_0x359d6f,_0x88238d){return client[_0x661e('0xd')](_0x1d7e1d,_0x39f9dd)[_0x661e('0xe')](function(_0x59b3a4){logger['info'](_0x661e('0xf'),_0x59c244,_0x661e('0x10'));logger[_0x661e('0x11')](_0x661e('0x12'),_0x59c244,_0x661e('0x10'),JSON[_0x661e('0x13')](_0x59b3a4));if(_0x59b3a4[_0x661e('0x14')]){if(_0x59b3a4[_0x661e('0x14')][_0x661e('0x15')]===0x1f4){logger[_0x661e('0x14')](_0x661e('0xf'),_0x59c244,_0x59b3a4['error'][_0x661e('0x16')]);return _0x88238d(_0x59b3a4['error']['message']);}logger[_0x661e('0x14')]('MailQueue,\x20%s,\x20%s',_0x59c244,_0x59b3a4[_0x661e('0x14')][_0x661e('0x16')]);return _0x359d6f(_0x59b3a4[_0x661e('0x14')]['message']);}else{logger['info'](_0x661e('0xf'),_0x59c244,_0x661e('0x10'));_0x359d6f(_0x59b3a4[_0x661e('0x17')][_0x661e('0x16')]);}})['catch'](function(_0x1b897f){logger[_0x661e('0x14')](_0x661e('0xf'),_0x59c244,_0x1b897f);_0x88238d(_0x1b897f);});});}exports[_0x661e('0x18')]=function(_0x17a8f8){var _0x4a53a9=this;return new Promise(function(_0x133340,_0x151cdc){return db[_0x661e('0x19')][_0x661e('0x1a')]({'raw':_0x17a8f8[_0x661e('0x1b')]?_0x17a8f8[_0x661e('0x1b')][_0x661e('0x1c')]===undefined?!![]:![]:!![],'where':_0x17a8f8[_0x661e('0x1b')]?_0x17a8f8[_0x661e('0x1b')][_0x661e('0x1d')]||null:null,'attributes':_0x17a8f8[_0x661e('0x1b')]?_0x17a8f8['options'][_0x661e('0x1e')]||null:null,'limit':_0x17a8f8[_0x661e('0x1b')]?_0x17a8f8['options']['limit']||null:null,'include':_0x17a8f8[_0x661e('0x1b')]?_0x17a8f8[_0x661e('0x1b')][_0x661e('0x1f')]?_['map'](_0x17a8f8[_0x661e('0x1b')][_0x661e('0x1f')],function(_0x175d08){return{'model':db[_0x175d08[_0x661e('0x20')]],'as':_0x175d08['as'],'attributes':_0x175d08[_0x661e('0x1e')],'include':_0x175d08[_0x661e('0x1f')]?_[_0x661e('0x21')](_0x175d08[_0x661e('0x1f')],function(_0x544059){return{'model':db[_0x544059['model']],'as':_0x544059['as'],'attributes':_0x544059[_0x661e('0x1e')],'include':_0x544059[_0x661e('0x1f')]?_[_0x661e('0x21')](_0x544059[_0x661e('0x1f')],function(_0x1a105e){return{'model':db[_0x1a105e[_0x661e('0x20')]],'as':_0x1a105e['as'],'attributes':_0x1a105e['attributes']};}):[]};}):[]};}):[]:[]})[_0x661e('0xe')](function(_0x40d174){logger[_0x661e('0x22')]('GetMailQueue',_0x17a8f8);logger[_0x661e('0x11')](_0x661e('0x18'),_0x17a8f8,JSON[_0x661e('0x13')](_0x40d174));_0x133340(_0x40d174);})[_0x661e('0x23')](function(_0x3339ed){logger[_0x661e('0x14')](_0x661e('0x18'),_0x3339ed[_0x661e('0x16')],_0x17a8f8);_0x151cdc(_0x4a53a9[_0x661e('0x14')](0x1f4,_0x3339ed[_0x661e('0x16')]));});});};exports[_0x661e('0x24')]=function(_0x576e2b){var _0x4da3e0=this;return new Promise(function(_0x11925c,_0x44f6d4){return db['MailQueue'][_0x661e('0x25')]({'raw':_0x576e2b[_0x661e('0x1b')]?_0x576e2b[_0x661e('0x1b')][_0x661e('0x1c')]===undefined?!![]:![]:!![],'where':_0x576e2b[_0x661e('0x1b')]?_0x576e2b[_0x661e('0x1b')]['where']||null:null,'attributes':_0x576e2b['options']?_0x576e2b[_0x661e('0x1b')]['attributes']||null:null,'include':_0x576e2b[_0x661e('0x1b')]?_0x576e2b[_0x661e('0x1b')]['include']?_[_0x661e('0x21')](_0x576e2b['options'][_0x661e('0x1f')],function(_0x3ac0e7){return{'model':db[_0x3ac0e7[_0x661e('0x20')]],'as':_0x3ac0e7['as'],'attributes':_0x3ac0e7[_0x661e('0x1e')],'include':_0x3ac0e7['include']?_[_0x661e('0x21')](_0x3ac0e7[_0x661e('0x1f')],function(_0x37fd2a){return{'model':db[_0x37fd2a[_0x661e('0x20')]],'as':_0x37fd2a['as'],'attributes':_0x37fd2a[_0x661e('0x1e')],'include':_0x37fd2a[_0x661e('0x1f')]?_[_0x661e('0x21')](_0x37fd2a[_0x661e('0x1f')],function(_0x2c685a){return{'model':db[_0x2c685a[_0x661e('0x20')]],'as':_0x2c685a['as'],'attributes':_0x2c685a[_0x661e('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b03a9){logger[_0x661e('0x22')](_0x661e('0x24'),_0x576e2b);logger[_0x661e('0x11')](_0x661e('0x24'),_0x576e2b,JSON['stringify'](_0x3b03a9));_0x11925c(_0x3b03a9);})['catch'](function(_0x4def75){logger[_0x661e('0x14')](_0x661e('0x24'),_0x4def75[_0x661e('0x16')],_0x576e2b);_0x44f6d4(_0x4da3e0[_0x661e('0x14')](0x1f4,_0x4def75[_0x661e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index fd94827..472552a 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 _0x2f33=['save','remove','emit','removeListener','register','length','mailQueue:','./mailQueue.events'];(function(_0x5254ea,_0x1af3fd){var _0x192890=function(_0x33bd22){while(--_0x33bd22){_0x5254ea['push'](_0x5254ea['shift']());}};_0x192890(++_0x1af3fd);}(_0x2f33,0xdf));var _0x32f3=function(_0x2c9f41,_0x133c52){_0x2c9f41=_0x2c9f41-0x0;var _0x19e2fa=_0x2f33[_0x2c9f41];return _0x19e2fa;};'use strict';var MailQueueEvents=require(_0x32f3('0x0'));var events=[_0x32f3('0x1'),_0x32f3('0x2'),'update'];function createListener(_0x5f24dd,_0xa0d64a){return function(_0x55d536){_0xa0d64a[_0x32f3('0x3')](_0x5f24dd,_0x55d536);};}function removeListener(_0x443e9d,_0x222516){return function(){MailQueueEvents[_0x32f3('0x4')](_0x443e9d,_0x222516);};}exports[_0x32f3('0x5')]=function(_0x311fb1){for(var _0x343890=0x0,_0x1ef5a5=events[_0x32f3('0x6')];_0x343890<_0x1ef5a5;_0x343890++){var _0xf7a85f=events[_0x343890];var _0x3c8c98=createListener(_0x32f3('0x7')+_0xf7a85f,_0x311fb1);MailQueueEvents['on'](_0xf7a85f,_0x3c8c98);}}; \ No newline at end of file +var _0xbd68=['save','remove','emit','removeListener','mailQueue:'];(function(_0x3dd5f8,_0x1cec67){var _0x514ef4=function(_0x3af714){while(--_0x3af714){_0x3dd5f8['push'](_0x3dd5f8['shift']());}};_0x514ef4(++_0x1cec67);}(_0xbd68,0x186));var _0x8bd6=function(_0x42edc4,_0x17f9a3){_0x42edc4=_0x42edc4-0x0;var _0x1bfba9=_0xbd68[_0x42edc4];return _0x1bfba9;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x8bd6('0x0'),_0x8bd6('0x1'),'update'];function createListener(_0x396320,_0x59dd85){return function(_0x3460e5){_0x59dd85[_0x8bd6('0x2')](_0x396320,_0x3460e5);};}function removeListener(_0x16d7fb,_0x4587b6){return function(){MailQueueEvents[_0x8bd6('0x3')](_0x16d7fb,_0x4587b6);};}exports['register']=function(_0x14c7ca){for(var _0x120ac0=0x0,_0x557b78=events['length'];_0x120ac0<_0x557b78;_0x120ac0++){var _0x4711ef=events[_0x120ac0];var _0x385a12=createListener(_0x8bd6('0x4')+_0x4711ef,_0x14c7ca);MailQueueEvents['on'](_0x4711ef,_0x385a12);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 470c472..3a996fb 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 _0xbcf5=['../../config/environment','./mailQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','post','create','put','update','delete','multer','path','express','../../components/interaction/service'];(function(_0xb3caf6,_0x1e0b11){var _0x241c56=function(_0x26b5f3){while(--_0x26b5f3){_0xb3caf6['push'](_0xb3caf6['shift']());}};_0x241c56(++_0x1e0b11);}(_0xbcf5,0xec));var _0x5bcf=function(_0xefa912,_0x290e4f){_0xefa912=_0xefa912-0x0;var _0x3e73c0=_0xbcf5[_0xefa912];return _0x3e73c0;};'use strict';var multer=require(_0x5bcf('0x0'));var util=require('util');var path=require(_0x5bcf('0x1'));var express=require(_0x5bcf('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5bcf('0x3'));var config=require(_0x5bcf('0x4'));var controller=require(_0x5bcf('0x5'));router['get']('/',auth[_0x5bcf('0x6')](),controller['index']);router[_0x5bcf('0x7')](_0x5bcf('0x8'),auth['isAuthenticated'](),controller[_0x5bcf('0x9')]);router[_0x5bcf('0x7')](_0x5bcf('0xa'),auth[_0x5bcf('0x6')](),controller['show']);router[_0x5bcf('0xb')]('/',auth[_0x5bcf('0x6')](),controller[_0x5bcf('0xc')]);router[_0x5bcf('0xd')]('/:id',auth[_0x5bcf('0x6')](),controller[_0x5bcf('0xe')]);router[_0x5bcf('0xf')](_0x5bcf('0xa'),auth[_0x5bcf('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa3c0=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x48e403,_0x533b50){var _0x1ef7b5=function(_0x39c8f5){while(--_0x39c8f5){_0x48e403['push'](_0x48e403['shift']());}};_0x1ef7b5(++_0x533b50);}(_0xa3c0,0xfd));var _0x0a3c=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0xa3c0[_0x6d6a66];return _0x11eb6e;};'use strict';var multer=require(_0x0a3c('0x0'));var util=require(_0x0a3c('0x1'));var path=require(_0x0a3c('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x0a3c('0x3'));var interaction=require(_0x0a3c('0x4'));var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router[_0x0a3c('0x5')]('/',auth[_0x0a3c('0x6')](),controller[_0x0a3c('0x7')]);router[_0x0a3c('0x5')](_0x0a3c('0x8'),auth[_0x0a3c('0x6')](),controller['describe']);router[_0x0a3c('0x5')](_0x0a3c('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x0a3c('0xa')]('/',auth[_0x0a3c('0x6')](),controller[_0x0a3c('0xb')]);router[_0x0a3c('0xc')](_0x0a3c('0x9'),auth[_0x0a3c('0x6')](),controller[_0x0a3c('0xd')]);router['delete']('/:id',auth[_0x0a3c('0x6')](),controller[_0x0a3c('0xe')]);module[_0x0a3c('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 97177a3..12bf07f 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 _0x1953=['moment','sequelize','STRING','DATE'];(function(_0x6de927,_0x497926){var _0x30b526=function(_0x406b9b){while(--_0x406b9b){_0x6de927['push'](_0x6de927['shift']());}};_0x30b526(++_0x497926);}(_0x1953,0x144));var _0x3195=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1953[_0x3947c9];return _0x2e7871;};'use strict';var moment=require(_0x3195('0x0'));var Sequelize=require(_0x3195('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x3195('0x2')]},'joinAt':{'type':Sequelize[_0x3195('0x3')]},'leaveAt':{'type':Sequelize[_0x3195('0x3')]},'acceptAt':{'type':Sequelize[_0x3195('0x3')]},'exitAt':{'type':Sequelize[_0x3195('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4e59=['DATE','sequelize','STRING'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4e59,0x100));var _0x94e5=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4e59[_0x57b54c];return _0x59cc19;};'use strict';var moment=require('moment');var Sequelize=require(_0x94e5('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x94e5('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x94e5('0x2')]},'acceptAt':{'type':Sequelize[_0x94e5('0x2')]},'exitAt':{'type':Sequelize[_0x94e5('0x2')]},'reason':{'type':Sequelize[_0x94e5('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 2218b03..72fa975 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 _0x7ba4=['include','findAll','catch','show','params','find','create','body','update','describe','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','querystring','../../components/parsers/qs','../../config/logger','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','MailQueueReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','add','day','merge','filter','map','options'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x7ba4,0x1ca));var _0x47ba=function(_0x55d2d1,_0x280954){_0x55d2d1=_0x55d2d1-0x0;var _0x39769d=_0x7ba4[_0x55d2d1];return _0x39769d;};'use strict';var jsonpatch=require(_0x47ba('0x0'));var rp=require('request-promise');var moment=require(_0x47ba('0x1'));var BPromise=require(_0x47ba('0x2'));var Mustache=require('mustache');var util=require(_0x47ba('0x3'));var path=require('path');var sox=require(_0x47ba('0x4'));var csv=require(_0x47ba('0x5'));var ejs=require(_0x47ba('0x6'));var fs=require('fs');var _=require(_0x47ba('0x7'));var squel=require(_0x47ba('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x47ba('0x5'));var querystring=require(_0x47ba('0x9'));var Papa=require('papaparse');var qs=require(_0x47ba('0xa'));var logger=require(_0x47ba('0xb'))('api');var utils=require(_0x47ba('0xc'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x475636,_0x461c6f){_0x461c6f=_0x461c6f||0xcc;return function(_0x5b8cb7){if(_0x5b8cb7){return _0x475636[_0x47ba('0xd')](_0x461c6f);}return _0x475636[_0x47ba('0xe')](_0x461c6f)[_0x47ba('0xf')]();};}function respondWithResult(_0x17f370,_0x3e738d){_0x3e738d=_0x3e738d||0xc8;return function(_0x3100c0){if(_0x3100c0){return _0x17f370[_0x47ba('0xe')](_0x3e738d)[_0x47ba('0x10')](_0x3100c0);}};}function respondWithFilteredResult(_0x2642f7,_0x1a55ba){return function(_0x546c92){if(_0x546c92){var _0xd823a0=_0x546c92[_0x47ba('0x11')],_0x5bfbab=_0x1a55ba[_0x47ba('0x12')],_0x567f33=_0x1a55ba['offset']+_0x1a55ba[_0x47ba('0x13')],_0x3bc254;if(_0x567f33>=_0xd823a0){_0x567f33=_0xd823a0;_0x3bc254=0xc8;}else{_0x3bc254=0xce;}_0x2642f7[_0x47ba('0xe')](_0x3bc254);return _0x2642f7[_0x47ba('0x14')](_0x47ba('0x15'),_0x5bfbab+'-'+_0x567f33+'/'+_0xd823a0)[_0x47ba('0x10')](_0x546c92);}return null;};}function patchUpdates(_0x1ea242){return function(_0x269eb3){try{jsonpatch[_0x47ba('0x16')](_0x269eb3,_0x1ea242,!![]);}catch(_0x1d4956){return BPromise[_0x47ba('0x17')](_0x1d4956);}return _0x269eb3[_0x47ba('0x18')]();};}function saveUpdates(_0x4aa3c7,_0x2d1063){return function(_0x1077a7){if(_0x1077a7){return _0x1077a7['update'](_0x4aa3c7)[_0x47ba('0x19')](function(_0x2d6ea6){return _0x2d6ea6;});}return null;};}function removeEntity(_0x64e5ca,_0x4ddbb4){return function(_0x549720){if(_0x549720){return _0x549720[_0x47ba('0x1a')]()['then'](function(){_0x64e5ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x479781,_0x56812d){return function(_0x369328){if(!_0x369328){_0x479781[_0x47ba('0xd')](0x194);}return _0x369328;};}function handleError(_0x543aff,_0x32cd88){_0x32cd88=_0x32cd88||0x1f4;return function(_0x474e2f){logger[_0x47ba('0x1b')](_0x474e2f[_0x47ba('0x1c')]);if(_0x474e2f['name']){delete _0x474e2f[_0x47ba('0x1d')];}_0x543aff[_0x47ba('0xe')](_0x32cd88)[_0x47ba('0x1e')](_0x474e2f);};}exports['index']=function(_0x4c06c7,_0x74f205){var _0x24610c={},_0x130aa1={},_0x3ff585={'count':0x0,'rows':[]};var _0x3a66cb=db[_0x47ba('0x1f')][_0x47ba('0x20')];_0x130aa1[_0x47ba('0x21')]=_[_0x47ba('0x22')](_0x3a66cb);var _0x25554a={'dateStart':_0x4c06c7[_0x47ba('0x23')][_0x47ba('0x24')],'dateEnd':_0x4c06c7['query'][_0x47ba('0x25')]};delete _0x4c06c7['query'][_0x47ba('0x24')];delete _0x4c06c7['query'][_0x47ba('0x25')];_0x130aa1['query']=_[_0x47ba('0x22')](_0x4c06c7[_0x47ba('0x23')]);_0x130aa1[_0x47ba('0x26')]=_[_0x47ba('0x27')](_0x130aa1[_0x47ba('0x21')],_0x130aa1['query']);_0x24610c[_0x47ba('0x28')]=_[_0x47ba('0x27')](_0x130aa1['model'],qs[_0x47ba('0x29')](_0x4c06c7['query'][_0x47ba('0x29')]));_0x24610c['attributes']=_0x24610c[_0x47ba('0x28')][_0x47ba('0x2a')]?_0x24610c[_0x47ba('0x28')]:_0x130aa1[_0x47ba('0x21')];if(!_0x4c06c7[_0x47ba('0x23')][_0x47ba('0x2b')](_0x47ba('0x2c'))){_0x24610c['limit']=qs['limit'](_0x4c06c7[_0x47ba('0x23')][_0x47ba('0x13')]);_0x24610c[_0x47ba('0x12')]=qs['offset'](_0x4c06c7[_0x47ba('0x23')][_0x47ba('0x12')]);}_0x24610c['order']=qs[_0x47ba('0x2d')](_0x4c06c7[_0x47ba('0x23')]['sort']);_0x24610c[_0x47ba('0x2e')]=qs[_0x47ba('0x26')](_[_0x47ba('0x2f')](_0x4c06c7['query'],_0x130aa1[_0x47ba('0x26')]));if(_0x25554a['dateStart']){if(_0x25554a[_0x47ba('0x25')]){_0x25554a[_0x47ba('0x25')]=moment(_0x25554a['dateEnd'])[_0x47ba('0x30')](0x1,_0x47ba('0x31'));}else{_0x25554a[_0x47ba('0x25')]=moment(_0x25554a[_0x47ba('0x24')])['add'](0x1,_0x47ba('0x31'));}_[_0x47ba('0x32')](_0x24610c['where'],{'createdAt':{'$gte':_0x25554a[_0x47ba('0x24')],'$lte':_0x25554a[_0x47ba('0x25')]}});}if(_0x4c06c7[_0x47ba('0x23')][_0x47ba('0x33')]){_0x24610c[_0x47ba('0x2e')]=_[_0x47ba('0x32')](_0x24610c[_0x47ba('0x2e')],{'$or':_[_0x47ba('0x34')](_0x24610c[_0x47ba('0x28')],function(_0x384bff){var _0x334142={};_0x334142[_0x384bff]={'$like':'%'+_0x4c06c7[_0x47ba('0x23')][_0x47ba('0x33')]+'%'};return _0x334142;})});}_0x24610c=_[_0x47ba('0x32')]({},_0x24610c,_0x4c06c7[_0x47ba('0x35')]);var _0x344ee7={'where':_0x24610c['where']};return db[_0x47ba('0x1f')]['count'](_0x344ee7)[_0x47ba('0x19')](function(_0xa30aa0){_0x3ff585[_0x47ba('0x11')]=_0xa30aa0;if(_0x4c06c7[_0x47ba('0x23')]['includeAll']){_0x24610c[_0x47ba('0x36')]=[{'all':!![]}];}return db['MailQueueReport'][_0x47ba('0x37')](_0x24610c);})['then'](function(_0xb90c02){_0x3ff585['rows']=_0xb90c02;return _0x3ff585;})[_0x47ba('0x19')](respondWithFilteredResult(_0x74f205,_0x24610c))[_0x47ba('0x38')](handleError(_0x74f205,null));};exports[_0x47ba('0x39')]=function(_0x923aaf,_0x564ff9){var _0x7bee4c={'raw':!![],'where':{'id':_0x923aaf[_0x47ba('0x3a')]['id']}},_0x2ca811={};_0x2ca811['model']=_[_0x47ba('0x22')](db[_0x47ba('0x1f')][_0x47ba('0x20')]);_0x2ca811[_0x47ba('0x23')]=_[_0x47ba('0x22')](_0x923aaf[_0x47ba('0x23')]);_0x2ca811[_0x47ba('0x26')]=_[_0x47ba('0x27')](_0x2ca811['model'],_0x2ca811['query']);_0x7bee4c[_0x47ba('0x28')]=_[_0x47ba('0x27')](_0x2ca811[_0x47ba('0x21')],qs[_0x47ba('0x29')](_0x923aaf[_0x47ba('0x23')][_0x47ba('0x29')]));_0x7bee4c['attributes']=_0x7bee4c[_0x47ba('0x28')][_0x47ba('0x2a')]?_0x7bee4c[_0x47ba('0x28')]:_0x2ca811[_0x47ba('0x21')];if(_0x923aaf[_0x47ba('0x23')]['includeAll']){_0x7bee4c[_0x47ba('0x36')]=[{'all':!![]}];}_0x7bee4c=_[_0x47ba('0x32')]({},_0x7bee4c,_0x923aaf[_0x47ba('0x35')]);return db['MailQueueReport'][_0x47ba('0x3b')](_0x7bee4c)[_0x47ba('0x19')](handleEntityNotFound(_0x564ff9,null))['then'](respondWithResult(_0x564ff9,null))[_0x47ba('0x38')](handleError(_0x564ff9,null));};exports[_0x47ba('0x3c')]=function(_0x1b3cef,_0x58f5f6){return db[_0x47ba('0x1f')][_0x47ba('0x3c')](_0x1b3cef[_0x47ba('0x3d')],{})[_0x47ba('0x19')](respondWithResult(_0x58f5f6,0xc9))['catch'](handleError(_0x58f5f6,null));};exports[_0x47ba('0x3e')]=function(_0x20348d,_0x54487d){if(_0x20348d[_0x47ba('0x3d')]['id']){delete _0x20348d[_0x47ba('0x3d')]['id'];}return db[_0x47ba('0x1f')][_0x47ba('0x3b')]({'where':{'id':_0x20348d[_0x47ba('0x3a')]['id']}})[_0x47ba('0x19')](handleEntityNotFound(_0x54487d,null))[_0x47ba('0x19')](saveUpdates(_0x20348d[_0x47ba('0x3d')],null))[_0x47ba('0x19')](respondWithResult(_0x54487d,null))[_0x47ba('0x38')](handleError(_0x54487d,null));};exports[_0x47ba('0x1a')]=function(_0x10afb5,_0x12e170){return db[_0x47ba('0x1f')][_0x47ba('0x3b')]({'where':{'id':_0x10afb5['params']['id']}})[_0x47ba('0x19')](handleEntityNotFound(_0x12e170,null))[_0x47ba('0x19')](removeEntity(_0x12e170,null))[_0x47ba('0x38')](handleError(_0x12e170,null));};exports[_0x47ba('0x3f')]=function(_0x5123c1,_0x20b719){return db['MailQueueReport']['describe']()[_0x47ba('0x19')](respondWithResult(_0x20b719,null))[_0x47ba('0x38')](handleError(_0x20b719,null));}; \ No newline at end of file +var _0x762f=['Content-Range','apply','save','update','then','error','stack','name','send','index','MailQueueReport','rawAttributes','keys','query','dateStart','dateEnd','intersection','model','attributes','fields','hasOwnProperty','nolimit','where','pick','add','day','filter','map','merge','options','includeAll','include','rows','catch','show','params','filters','length','find','create','body','destroy','describe','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit'];(function(_0x40710f,_0x3f145e){var _0x591385=function(_0x1615e4){while(--_0x1615e4){_0x40710f['push'](_0x40710f['shift']());}};_0x591385(++_0x3f145e);}(_0x762f,0x70));var _0xf762=function(_0x568bde,_0x11c1f9){_0x568bde=_0x568bde-0x0;var _0x47f444=_0x762f[_0x568bde];return _0x47f444;};'use strict';var jsonpatch=require(_0xf762('0x0'));var rp=require('request-promise');var moment=require(_0xf762('0x1'));var BPromise=require(_0xf762('0x2'));var Mustache=require(_0xf762('0x3'));var util=require(_0xf762('0x4'));var path=require(_0xf762('0x5'));var sox=require(_0xf762('0x6'));var csv=require(_0xf762('0x7'));var ejs=require(_0xf762('0x8'));var fs=require('fs');var _=require(_0xf762('0x9'));var squel=require(_0xf762('0xa'));var crypto=require('crypto');var jsforce=require(_0xf762('0xb'));var deskjs=require(_0xf762('0xc'));var toCsv=require(_0xf762('0x7'));var querystring=require(_0xf762('0xd'));var Papa=require(_0xf762('0xe'));var qs=require(_0xf762('0xf'));var logger=require('../../config/logger')(_0xf762('0x10'));var utils=require(_0xf762('0x11'));var config=require(_0xf762('0x12'));var db=require(_0xf762('0x13'))['db'];function respondWithStatusCode(_0xc4c02a,_0x47d4c5){_0x47d4c5=_0x47d4c5||0xcc;return function(_0x5518a1){if(_0x5518a1){return _0xc4c02a[_0xf762('0x14')](_0x47d4c5);}return _0xc4c02a[_0xf762('0x15')](_0x47d4c5)[_0xf762('0x16')]();};}function respondWithResult(_0x3b7407,_0x30522d){_0x30522d=_0x30522d||0xc8;return function(_0x151d82){if(_0x151d82){return _0x3b7407[_0xf762('0x15')](_0x30522d)['json'](_0x151d82);}};}function respondWithFilteredResult(_0xe65adf,_0xac5db7){return function(_0x5f588c){if(_0x5f588c){var _0x506b45=_0x5f588c[_0xf762('0x17')],_0x3d73bb=_0xac5db7[_0xf762('0x18')],_0x4ed6ec=_0xac5db7[_0xf762('0x18')]+_0xac5db7[_0xf762('0x19')],_0x540cf2;if(_0x4ed6ec>=_0x506b45){_0x4ed6ec=_0x506b45;_0x540cf2=0xc8;}else{_0x540cf2=0xce;}_0xe65adf['status'](_0x540cf2);return _0xe65adf['set'](_0xf762('0x1a'),_0x3d73bb+'-'+_0x4ed6ec+'/'+_0x506b45)['json'](_0x5f588c);}return null;};}function patchUpdates(_0x8a0d03){return function(_0xb9a3b0){try{jsonpatch[_0xf762('0x1b')](_0xb9a3b0,_0x8a0d03,!![]);}catch(_0x2bcf0d){return BPromise['reject'](_0x2bcf0d);}return _0xb9a3b0[_0xf762('0x1c')]();};}function saveUpdates(_0x48901b,_0x2196ff){return function(_0x39966d){if(_0x39966d){return _0x39966d[_0xf762('0x1d')](_0x48901b)[_0xf762('0x1e')](function(_0x149697){return _0x149697;});}return null;};}function removeEntity(_0x161daf,_0x4ebd46){return function(_0x17417d){if(_0x17417d){return _0x17417d['destroy']()[_0xf762('0x1e')](function(){_0x161daf[_0xf762('0x15')](0xcc)[_0xf762('0x16')]();});}};}function handleEntityNotFound(_0x4ac7e0,_0x2bf68b){return function(_0x136f66){if(!_0x136f66){_0x4ac7e0[_0xf762('0x14')](0x194);}return _0x136f66;};}function handleError(_0x569287,_0x3ab493){_0x3ab493=_0x3ab493||0x1f4;return function(_0xa894e){logger[_0xf762('0x1f')](_0xa894e[_0xf762('0x20')]);if(_0xa894e[_0xf762('0x21')]){delete _0xa894e[_0xf762('0x21')];}_0x569287[_0xf762('0x15')](_0x3ab493)[_0xf762('0x22')](_0xa894e);};}exports[_0xf762('0x23')]=function(_0x3714aa,_0x401c31){var _0x5eb5be={},_0x502e65={},_0x5c291b={'count':0x0,'rows':[]};var _0x303a4d=db[_0xf762('0x24')][_0xf762('0x25')];_0x502e65['model']=_[_0xf762('0x26')](_0x303a4d);var _0x5b2344={'dateStart':_0x3714aa[_0xf762('0x27')][_0xf762('0x28')],'dateEnd':_0x3714aa[_0xf762('0x27')][_0xf762('0x29')]};delete _0x3714aa[_0xf762('0x27')][_0xf762('0x28')];delete _0x3714aa[_0xf762('0x27')][_0xf762('0x29')];_0x502e65[_0xf762('0x27')]=_['keys'](_0x3714aa[_0xf762('0x27')]);_0x502e65['filters']=_[_0xf762('0x2a')](_0x502e65[_0xf762('0x2b')],_0x502e65[_0xf762('0x27')]);_0x5eb5be[_0xf762('0x2c')]=_[_0xf762('0x2a')](_0x502e65['model'],qs[_0xf762('0x2d')](_0x3714aa[_0xf762('0x27')][_0xf762('0x2d')]));_0x5eb5be[_0xf762('0x2c')]=_0x5eb5be['attributes']['length']?_0x5eb5be['attributes']:_0x502e65[_0xf762('0x2b')];if(!_0x3714aa[_0xf762('0x27')][_0xf762('0x2e')](_0xf762('0x2f'))){_0x5eb5be['limit']=qs[_0xf762('0x19')](_0x3714aa[_0xf762('0x27')][_0xf762('0x19')]);_0x5eb5be['offset']=qs[_0xf762('0x18')](_0x3714aa[_0xf762('0x27')][_0xf762('0x18')]);}_0x5eb5be['order']=qs['sort'](_0x3714aa[_0xf762('0x27')]['sort']);_0x5eb5be[_0xf762('0x30')]=qs['filters'](_[_0xf762('0x31')](_0x3714aa[_0xf762('0x27')],_0x502e65['filters']));if(_0x5b2344['dateStart']){if(_0x5b2344['dateEnd']){_0x5b2344[_0xf762('0x29')]=moment(_0x5b2344['dateEnd'])[_0xf762('0x32')](0x1,_0xf762('0x33'));}else{_0x5b2344[_0xf762('0x29')]=moment(_0x5b2344[_0xf762('0x28')])[_0xf762('0x32')](0x1,_0xf762('0x33'));}_['merge'](_0x5eb5be['where'],{'createdAt':{'$gte':_0x5b2344[_0xf762('0x28')],'$lte':_0x5b2344[_0xf762('0x29')]}});}if(_0x3714aa[_0xf762('0x27')][_0xf762('0x34')]){_0x5eb5be['where']=_['merge'](_0x5eb5be[_0xf762('0x30')],{'$or':_[_0xf762('0x35')](_0x5eb5be['attributes'],function(_0x1b8a40){var _0x6b0748={};_0x6b0748[_0x1b8a40]={'$like':'%'+_0x3714aa['query']['filter']+'%'};return _0x6b0748;})});}_0x5eb5be=_[_0xf762('0x36')]({},_0x5eb5be,_0x3714aa[_0xf762('0x37')]);var _0x4d7c05={'where':_0x5eb5be['where']};return db['MailQueueReport']['count'](_0x4d7c05)[_0xf762('0x1e')](function(_0x429520){_0x5c291b[_0xf762('0x17')]=_0x429520;if(_0x3714aa[_0xf762('0x27')][_0xf762('0x38')]){_0x5eb5be[_0xf762('0x39')]=[{'all':!![]}];}return db[_0xf762('0x24')]['findAll'](_0x5eb5be);})[_0xf762('0x1e')](function(_0x299861){_0x5c291b[_0xf762('0x3a')]=_0x299861;return _0x5c291b;})['then'](respondWithFilteredResult(_0x401c31,_0x5eb5be))[_0xf762('0x3b')](handleError(_0x401c31,null));};exports[_0xf762('0x3c')]=function(_0x27c037,_0x1030ac){var _0x3f4672={'raw':!![],'where':{'id':_0x27c037[_0xf762('0x3d')]['id']}},_0x12d3dd={};_0x12d3dd[_0xf762('0x2b')]=_[_0xf762('0x26')](db['MailQueueReport'][_0xf762('0x25')]);_0x12d3dd['query']=_['keys'](_0x27c037['query']);_0x12d3dd[_0xf762('0x3e')]=_['intersection'](_0x12d3dd[_0xf762('0x2b')],_0x12d3dd[_0xf762('0x27')]);_0x3f4672['attributes']=_[_0xf762('0x2a')](_0x12d3dd[_0xf762('0x2b')],qs[_0xf762('0x2d')](_0x27c037[_0xf762('0x27')]['fields']));_0x3f4672[_0xf762('0x2c')]=_0x3f4672[_0xf762('0x2c')][_0xf762('0x3f')]?_0x3f4672[_0xf762('0x2c')]:_0x12d3dd['model'];if(_0x27c037[_0xf762('0x27')][_0xf762('0x38')]){_0x3f4672[_0xf762('0x39')]=[{'all':!![]}];}_0x3f4672=_[_0xf762('0x36')]({},_0x3f4672,_0x27c037[_0xf762('0x37')]);return db[_0xf762('0x24')][_0xf762('0x40')](_0x3f4672)[_0xf762('0x1e')](handleEntityNotFound(_0x1030ac,null))[_0xf762('0x1e')](respondWithResult(_0x1030ac,null))['catch'](handleError(_0x1030ac,null));};exports[_0xf762('0x41')]=function(_0x4aca00,_0x121852){return db[_0xf762('0x24')][_0xf762('0x41')](_0x4aca00['body'],{})[_0xf762('0x1e')](respondWithResult(_0x121852,0xc9))['catch'](handleError(_0x121852,null));};exports[_0xf762('0x1d')]=function(_0x673f1,_0x35362b){if(_0x673f1['body']['id']){delete _0x673f1['body']['id'];}return db[_0xf762('0x24')][_0xf762('0x40')]({'where':{'id':_0x673f1[_0xf762('0x3d')]['id']}})['then'](handleEntityNotFound(_0x35362b,null))[_0xf762('0x1e')](saveUpdates(_0x673f1[_0xf762('0x42')],null))[_0xf762('0x1e')](respondWithResult(_0x35362b,null))[_0xf762('0x3b')](handleError(_0x35362b,null));};exports[_0xf762('0x43')]=function(_0x434ed4,_0x3dbccf){return db[_0xf762('0x24')]['find']({'where':{'id':_0x434ed4[_0xf762('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3dbccf,null))['then'](removeEntity(_0x3dbccf,null))[_0xf762('0x3b')](handleError(_0x3dbccf,null));};exports[_0xf762('0x44')]=function(_0x3915ab,_0x1f31b2){return db['MailQueueReport'][_0xf762('0x44')]()['then'](respondWithResult(_0x1f31b2,null))[_0xf762('0x3b')](handleError(_0x1f31b2,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 51f55ae..d5263e2 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 _0x9b9c=['lodash','util','../../config/logger','api','moment','bluebird','exports','define','MailQueueReport','uniqueid'];(function(_0x391ddf,_0x1baaed){var _0x8fe7b0=function(_0x204aa9){while(--_0x204aa9){_0x391ddf['push'](_0x391ddf['shift']());}};_0x8fe7b0(++_0x1baaed);}(_0x9b9c,0xf0));var _0xc9b9=function(_0x23827e,_0x31b0e0){_0x23827e=_0x23827e-0x0;var _0x9acf45=_0x9b9c[_0x23827e];return _0x9acf45;};'use strict';var _=require(_0xc9b9('0x0'));var util=require(_0xc9b9('0x1'));var logger=require(_0xc9b9('0x2'))(_0xc9b9('0x3'));var moment=require(_0xc9b9('0x4'));var BPromise=require(_0xc9b9('0x5'));var rp=require('request-promise');var attributes=require('./mailQueueReport.attributes');module[_0xc9b9('0x6')]=function(_0x5dc3a1,_0x436401){return _0x5dc3a1[_0xc9b9('0x7')](_0xc9b9('0x8'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc9b9('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaddc=['uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','./mailQueueReport.attributes','exports','define','report_mail_queue'];(function(_0x44cad0,_0x229ce2){var _0x360e6f=function(_0x5a185e){while(--_0x5a185e){_0x44cad0['push'](_0x44cad0['shift']());}};_0x360e6f(++_0x229ce2);}(_0xaddc,0x1ae));var _0xcadd=function(_0x1f3bba,_0xab0860){_0x1f3bba=_0x1f3bba-0x0;var _0x408d48=_0xaddc[_0x1f3bba];return _0x408d48;};'use strict';var _=require('lodash');var util=require(_0xcadd('0x0'));var logger=require(_0xcadd('0x1'))(_0xcadd('0x2'));var moment=require(_0xcadd('0x3'));var BPromise=require(_0xcadd('0x4'));var rp=require(_0xcadd('0x5'));var attributes=require(_0xcadd('0x6'));module[_0xcadd('0x7')]=function(_0x1c10a2,_0x59ebfc){return _0x1c10a2[_0xcadd('0x8')]('MailQueueReport',attributes,{'tableName':_0xcadd('0x9'),'paranoid':![],'indexes':[{'name':_0xcadd('0xa'),'fields':[_0xcadd('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 5397b9d..4113e35 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 _0xd999=['MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateMailQueueReport','MailQueueReport','body','options','raw','then','debug','update','attributes','limit','UpdateMailQueueReport','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','request','info'];(function(_0x51d35b,_0x24294f){var _0x1471b7=function(_0x482fb9){while(--_0x482fb9){_0x51d35b['push'](_0x51d35b['shift']());}};_0x1471b7(++_0x24294f);}(_0xd999,0x122));var _0x9d99=function(_0x34b71e,_0x58f44d){_0x34b71e=_0x34b71e-0x0;var _0x2cb29b=_0xd999[_0x34b71e];return _0x2cb29b;};'use strict';var _=require(_0x9d99('0x0'));var util=require(_0x9d99('0x1'));var moment=require(_0x9d99('0x2'));var BPromise=require(_0x9d99('0x3'));var rs=require(_0x9d99('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x9d99('0x5'));var logger=require(_0x9d99('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9d99('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3d2378,_0x395b57,_0x42a72c){return new BPromise(function(_0x41f224,_0x5c74dc){return client[_0x9d99('0x8')](_0x3d2378,_0x42a72c)['then'](function(_0x50a3ed){logger[_0x9d99('0x9')](_0x9d99('0xa'),_0x395b57,_0x9d99('0xb'));logger['debug'](_0x9d99('0xc'),_0x395b57,_0x9d99('0xb'),JSON[_0x9d99('0xd')](_0x50a3ed));if(_0x50a3ed[_0x9d99('0xe')]){if(_0x50a3ed[_0x9d99('0xe')][_0x9d99('0xf')]===0x1f4){logger[_0x9d99('0xe')](_0x9d99('0xa'),_0x395b57,_0x50a3ed[_0x9d99('0xe')][_0x9d99('0x10')]);return _0x5c74dc(_0x50a3ed[_0x9d99('0xe')][_0x9d99('0x10')]);}logger[_0x9d99('0xe')](_0x9d99('0xa'),_0x395b57,_0x50a3ed[_0x9d99('0xe')][_0x9d99('0x10')]);return _0x41f224(_0x50a3ed[_0x9d99('0xe')][_0x9d99('0x10')]);}else{logger[_0x9d99('0x9')]('MailQueueReport,\x20%s,\x20%s',_0x395b57,'request\x20sent');_0x41f224(_0x50a3ed[_0x9d99('0x11')]['message']);}})['catch'](function(_0x589d14){logger[_0x9d99('0xe')](_0x9d99('0xa'),_0x395b57,_0x589d14);_0x5c74dc(_0x589d14);});});}exports[_0x9d99('0x12')]=function(_0x2378a9){var _0x3b2b49=this;return new Promise(function(_0x4cfebd,_0x303b31){return db[_0x9d99('0x13')]['create'](_0x2378a9[_0x9d99('0x14')],{'raw':_0x2378a9['options']?_0x2378a9[_0x9d99('0x15')][_0x9d99('0x16')]===undefined?!![]:![]:!![]})[_0x9d99('0x17')](function(_0x4f23a6){logger['info'](_0x9d99('0x12'),_0x2378a9);logger[_0x9d99('0x18')](_0x9d99('0x12'),_0x2378a9,JSON[_0x9d99('0xd')](_0x4f23a6));_0x4cfebd(_0x4f23a6);})['catch'](function(_0x16fd64){logger[_0x9d99('0xe')](_0x9d99('0x12'),_0x16fd64[_0x9d99('0x10')],_0x2378a9);_0x303b31(_0x3b2b49['error'](0x1f4,_0x16fd64[_0x9d99('0x10')]));});});};exports['UpdateMailQueueReport']=function(_0x266040){var _0x360294=this;return new Promise(function(_0x2f9c49,_0x3a72e1){return db[_0x9d99('0x13')][_0x9d99('0x19')](_0x266040[_0x9d99('0x14')],{'raw':_0x266040['options']?_0x266040[_0x9d99('0x15')][_0x9d99('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x266040[_0x9d99('0x15')]?_0x266040[_0x9d99('0x15')]['where']||null:null,'attributes':_0x266040[_0x9d99('0x15')]?_0x266040[_0x9d99('0x15')][_0x9d99('0x1a')]||null:null,'limit':_0x266040[_0x9d99('0x15')]?_0x266040[_0x9d99('0x15')][_0x9d99('0x1b')]||null:null})[_0x9d99('0x17')](function(_0x356d34){logger[_0x9d99('0x9')](_0x9d99('0x1c'),_0x266040);logger[_0x9d99('0x18')](_0x9d99('0x1c'),_0x266040,JSON[_0x9d99('0xd')](_0x356d34));_0x2f9c49(_0x356d34);})[_0x9d99('0x1d')](function(_0x41b8e7){logger[_0x9d99('0xe')](_0x9d99('0x1c'),_0x41b8e7['message'],_0x266040);_0x3a72e1(_0x360294[_0x9d99('0xe')](0x1f4,_0x41b8e7[_0x9d99('0x10')]));});});}; \ No newline at end of file +var _0x3be1=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','then','info','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueueReport,\x20%s,\x20%s','message','result','CreateMailQueueReport','MailQueueReport','create','body','options','raw','catch','UpdateMailQueueReport','where','limit','debug','util','moment'];(function(_0x4defd6,_0x37bbd3){var _0x4c9276=function(_0x1d7a3d){while(--_0x1d7a3d){_0x4defd6['push'](_0x4defd6['shift']());}};_0x4c9276(++_0x37bbd3);}(_0x3be1,0x72));var _0x13be=function(_0x241372,_0xe3841c){_0x241372=_0x241372-0x0;var _0x58c356=_0x3be1[_0x241372];return _0x58c356;};'use strict';var _=require('lodash');var util=require(_0x13be('0x0'));var moment=require(_0x13be('0x1'));var BPromise=require(_0x13be('0x2'));var rs=require(_0x13be('0x3'));var fs=require('fs');var db=require(_0x13be('0x4'))['db'];var utils=require(_0x13be('0x5'));var logger=require('../../config/logger')(_0x13be('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x13be('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5dbe29,_0x1e78c6,_0x28a2e1){return new BPromise(function(_0xd2cb03,_0x2738e6){return client['request'](_0x5dbe29,_0x28a2e1)[_0x13be('0x8')](function(_0x59f05c){logger[_0x13be('0x9')]('MailQueueReport,\x20%s,\x20%s',_0x1e78c6,_0x13be('0xa'));logger['debug'](_0x13be('0xb'),_0x1e78c6,_0x13be('0xa'),JSON[_0x13be('0xc')](_0x59f05c));if(_0x59f05c['error']){if(_0x59f05c[_0x13be('0xd')][_0x13be('0xe')]===0x1f4){logger[_0x13be('0xd')](_0x13be('0xf'),_0x1e78c6,_0x59f05c[_0x13be('0xd')][_0x13be('0x10')]);return _0x2738e6(_0x59f05c['error'][_0x13be('0x10')]);}logger[_0x13be('0xd')](_0x13be('0xf'),_0x1e78c6,_0x59f05c['error'][_0x13be('0x10')]);return _0xd2cb03(_0x59f05c[_0x13be('0xd')][_0x13be('0x10')]);}else{logger[_0x13be('0x9')](_0x13be('0xf'),_0x1e78c6,_0x13be('0xa'));_0xd2cb03(_0x59f05c[_0x13be('0x11')][_0x13be('0x10')]);}})['catch'](function(_0x19e217){logger[_0x13be('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x1e78c6,_0x19e217);_0x2738e6(_0x19e217);});});}exports[_0x13be('0x12')]=function(_0x4e2850){var _0x31ab6a=this;return new Promise(function(_0x8d5d61,_0x19a9a4){return db[_0x13be('0x13')][_0x13be('0x14')](_0x4e2850[_0x13be('0x15')],{'raw':_0x4e2850[_0x13be('0x16')]?_0x4e2850[_0x13be('0x16')][_0x13be('0x17')]===undefined?!![]:![]:!![]})[_0x13be('0x8')](function(_0x4016d4){logger[_0x13be('0x9')](_0x13be('0x12'),_0x4e2850);logger['debug'](_0x13be('0x12'),_0x4e2850,JSON['stringify'](_0x4016d4));_0x8d5d61(_0x4016d4);})[_0x13be('0x18')](function(_0x37c2a7){logger[_0x13be('0xd')](_0x13be('0x12'),_0x37c2a7[_0x13be('0x10')],_0x4e2850);_0x19a9a4(_0x31ab6a[_0x13be('0xd')](0x1f4,_0x37c2a7['message']));});});};exports[_0x13be('0x19')]=function(_0x45a1d5){var _0x49c5bd=this;return new Promise(function(_0xaf9c00,_0x5f2d3c){return db['MailQueueReport']['update'](_0x45a1d5[_0x13be('0x15')],{'raw':_0x45a1d5[_0x13be('0x16')]?_0x45a1d5[_0x13be('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45a1d5[_0x13be('0x16')]?_0x45a1d5[_0x13be('0x16')][_0x13be('0x1a')]||null:null,'attributes':_0x45a1d5['options']?_0x45a1d5['options']['attributes']||null:null,'limit':_0x45a1d5[_0x13be('0x16')]?_0x45a1d5[_0x13be('0x16')][_0x13be('0x1b')]||null:null})[_0x13be('0x8')](function(_0x39403d){logger[_0x13be('0x9')](_0x13be('0x19'),_0x45a1d5);logger[_0x13be('0x1c')](_0x13be('0x19'),_0x45a1d5,JSON[_0x13be('0xc')](_0x39403d));_0xaf9c00(_0x39403d);})['catch'](function(_0x2292a0){logger[_0x13be('0xd')]('UpdateMailQueueReport',_0x2292a0[_0x13be('0x10')],_0x45a1d5);_0x5f2d3c(_0x49c5bd['error'](0x1f4,_0x2292a0[_0x13be('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index f296d5b..36d1bc8 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 _0xe2e4=['util','path','express','Router','../../config/environment','exports','multer'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0xe2e4,0x6f));var _0x4e2e=function(_0x4a71b6,_0x23120f){_0x4a71b6=_0x4a71b6-0x0;var _0x290de9=_0xe2e4[_0x4a71b6];return _0x290de9;};'use strict';var multer=require(_0x4e2e('0x0'));var util=require(_0x4e2e('0x1'));var path=require(_0x4e2e('0x2'));var express=require(_0x4e2e('0x3'));var router=express[_0x4e2e('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4e2e('0x5'));module[_0x4e2e('0x6')]=router; \ No newline at end of file +var _0x1ed9=['express','Router','../../config/environment','exports','multer','util','path'];(function(_0x295358,_0x1a7920){var _0x54a7cf=function(_0x21c2f9){while(--_0x21c2f9){_0x295358['push'](_0x295358['shift']());}};_0x54a7cf(++_0x1a7920);}(_0x1ed9,0xc8));var _0x91ed=function(_0x162e92,_0x12abde){_0x162e92=_0x162e92-0x0;var _0x1e4cd8=_0x1ed9[_0x162e92];return _0x1e4cd8;};'use strict';var multer=require(_0x91ed('0x0'));var util=require(_0x91ed('0x1'));var path=require(_0x91ed('0x2'));var express=require(_0x91ed('0x3'));var router=express[_0x91ed('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x91ed('0x5'));module[_0x91ed('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 4004cb5..dbfe78a 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 _0xaaa2=['STRING','BOOLEAN','INBOX','INTEGER','sequelize','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xaaa2,0xac));var _0x2aaa=function(_0x1fb7ff,_0x1b68a6){_0x1fb7ff=_0x1fb7ff-0x0;var _0x23f338=_0xaaa2[_0x1fb7ff];return _0x23f338;};'use strict';var Sequelize=require(_0x2aaa('0x0'));module[_0x2aaa('0x1')]={'description':{'type':Sequelize[_0x2aaa('0x2')]},'host':{'type':Sequelize[_0x2aaa('0x2')]},'authentication':{'type':Sequelize[_0x2aaa('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x2aaa('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x2aaa('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x2aaa('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x2aaa('0x2')],'defaultValue':_0x2aaa('0x4')},'connTimeout':{'type':Sequelize[_0x2aaa('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x2aaa('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0x2aaa('0x2')]}}; \ No newline at end of file +var _0x70e0=['exports','STRING','username','INTEGER','sequelize'];(function(_0x431a6d,_0x2d9cba){var _0x1092c5=function(_0x9bf4c1){while(--_0x9bf4c1){_0x431a6d['push'](_0x431a6d['shift']());}};_0x1092c5(++_0x2d9cba);}(_0x70e0,0x17b));var _0x070e=function(_0x4cfe4d,_0x3bb2e4){_0x4cfe4d=_0x4cfe4d-0x0;var _0x4c6822=_0x70e0[_0x4cfe4d];return _0x4c6822;};'use strict';var Sequelize=require(_0x070e('0x0'));module[_0x070e('0x1')]={'description':{'type':Sequelize[_0x070e('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x070e('0x2')],'unique':_0x070e('0x3')},'password':{'type':Sequelize[_0x070e('0x2')]},'port':{'type':Sequelize[_0x070e('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x070e('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x070e('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 957af38..f4c1ec0 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 _0x0102=['api','moment','define','MailServerIn','mail_servers_in','util','../../config/logger'];(function(_0xc66fe6,_0x4f3d4c){var _0xa7587d=function(_0x560902){while(--_0x560902){_0xc66fe6['push'](_0xc66fe6['shift']());}};_0xa7587d(++_0x4f3d4c);}(_0x0102,0x186));var _0x2010=function(_0x32bfb0,_0x1efb65){_0x32bfb0=_0x32bfb0-0x0;var _0x7a5b6a=_0x0102[_0x32bfb0];return _0x7a5b6a;};'use strict';var _=require('lodash');var util=require(_0x2010('0x0'));var logger=require(_0x2010('0x1'))(_0x2010('0x2'));var moment=require(_0x2010('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x59082d,_0x22e49f){return _0x59082d[_0x2010('0x4')](_0x2010('0x5'),attributes,{'tableName':_0x2010('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33a4=['define','MailServerIn','mail_servers_in','util','api','moment','bluebird'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x33a4,0x88));var _0x433a=function(_0x128602,_0x19afb9){_0x128602=_0x128602-0x0;var _0x35aafa=_0x33a4[_0x128602];return _0x35aafa;};'use strict';var _=require('lodash');var util=require(_0x433a('0x0'));var logger=require('../../config/logger')(_0x433a('0x1'));var moment=require(_0x433a('0x2'));var BPromise=require(_0x433a('0x3'));var rp=require('request-promise');var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x19166b,_0x12121b){return _0x19166b[_0x433a('0x4')](_0x433a('0x5'),attributes,{'tableName':_0x433a('0x6'),'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 e57d2ea..32f9ee5 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 _0x3ef0=['model','then','debug','stringify','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','client','http','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','attributes','include','map'];(function(_0x25a163,_0x197e56){var _0x5449fd=function(_0x1fac08){while(--_0x1fac08){_0x25a163['push'](_0x25a163['shift']());}};_0x5449fd(++_0x197e56);}(_0x3ef0,0x19a));var _0x03ef=function(_0x307779,_0x3ec328){_0x307779=_0x307779-0x0;var _0x4f6c86=_0x3ef0[_0x307779];return _0x4f6c86;};'use strict';var _=require(_0x03ef('0x0'));var util=require('util');var moment=require(_0x03ef('0x1'));var BPromise=require('bluebird');var rs=require(_0x03ef('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x03ef('0x3'));var logger=require(_0x03ef('0x4'))(_0x03ef('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x03ef('0x6')][_0x03ef('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ea0f9,_0x47e561,_0x357971){return new BPromise(function(_0x3c06ee,_0x2d54e7){return client[_0x03ef('0x8')](_0x1ea0f9,_0x357971)['then'](function(_0x5eb527){logger[_0x03ef('0x9')](_0x03ef('0xa'),_0x47e561,_0x03ef('0xb'));logger['debug'](_0x03ef('0xc'),_0x47e561,_0x03ef('0xb'),JSON['stringify'](_0x5eb527));if(_0x5eb527[_0x03ef('0xd')]){if(_0x5eb527[_0x03ef('0xd')][_0x03ef('0xe')]===0x1f4){logger['error'](_0x03ef('0xa'),_0x47e561,_0x5eb527[_0x03ef('0xd')][_0x03ef('0xf')]);return _0x2d54e7(_0x5eb527[_0x03ef('0xd')][_0x03ef('0xf')]);}logger[_0x03ef('0xd')](_0x03ef('0xa'),_0x47e561,_0x5eb527[_0x03ef('0xd')][_0x03ef('0xf')]);return _0x3c06ee(_0x5eb527[_0x03ef('0xd')][_0x03ef('0xf')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x47e561,_0x03ef('0xb'));_0x3c06ee(_0x5eb527[_0x03ef('0x10')][_0x03ef('0xf')]);}})[_0x03ef('0x11')](function(_0x12169c){logger['error']('MailServerIn,\x20%s,\x20%s',_0x47e561,_0x12169c);_0x2d54e7(_0x12169c);});});}exports[_0x03ef('0x12')]=function(_0x1f412c){var _0x501d87=this;return new Promise(function(_0x4a4e96,_0x277f0d){return db[_0x03ef('0x13')][_0x03ef('0x14')]({'raw':_0x1f412c[_0x03ef('0x15')]?_0x1f412c[_0x03ef('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1f412c[_0x03ef('0x15')]?_0x1f412c[_0x03ef('0x15')]['where']||null:null,'attributes':_0x1f412c[_0x03ef('0x15')]?_0x1f412c[_0x03ef('0x15')][_0x03ef('0x16')]||null:null,'limit':_0x1f412c[_0x03ef('0x15')]?_0x1f412c[_0x03ef('0x15')]['limit']||null:null,'include':_0x1f412c['options']?_0x1f412c[_0x03ef('0x15')][_0x03ef('0x17')]?_[_0x03ef('0x18')](_0x1f412c['options']['include'],function(_0x13b033){return{'model':db[_0x13b033[_0x03ef('0x19')]],'as':_0x13b033['as'],'attributes':_0x13b033['attributes'],'include':_0x13b033['include']?_[_0x03ef('0x18')](_0x13b033[_0x03ef('0x17')],function(_0x4fb37f){return{'model':db[_0x4fb37f[_0x03ef('0x19')]],'as':_0x4fb37f['as'],'attributes':_0x4fb37f[_0x03ef('0x16')],'include':_0x4fb37f[_0x03ef('0x17')]?_['map'](_0x4fb37f[_0x03ef('0x17')],function(_0x3dd14f){return{'model':db[_0x3dd14f[_0x03ef('0x19')]],'as':_0x3dd14f['as'],'attributes':_0x3dd14f[_0x03ef('0x16')]};}):[]};}):[]};}):[]:[]})[_0x03ef('0x1a')](function(_0x1b766b){logger['info']('GetMailServerIn',_0x1f412c);logger[_0x03ef('0x1b')]('GetMailServerIn',_0x1f412c,JSON[_0x03ef('0x1c')](_0x1b766b));_0x4a4e96(_0x1b766b);})[_0x03ef('0x11')](function(_0x391f82){logger['error'](_0x03ef('0x12'),_0x391f82[_0x03ef('0xf')],_0x1f412c);_0x277f0d(_0x501d87[_0x03ef('0xd')](0x1f4,_0x391f82[_0x03ef('0xf')]));});});}; \ No newline at end of file +var _0x54ef=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetMailServerIn','MailServerIn','findAll','options','attributes','limit','include','map','model','catch','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x42c3ea,_0x2cae04){var _0x294a04=function(_0x265626){while(--_0x265626){_0x42c3ea['push'](_0x42c3ea['shift']());}};_0x294a04(++_0x2cae04);}(_0x54ef,0x112));var _0xf54e=function(_0x467c78,_0x25d5dc){_0x467c78=_0x467c78-0x0;var _0x14983e=_0x54ef[_0x467c78];return _0x14983e;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var db=require(_0xf54e('0x4'))['db'];var utils=require(_0xf54e('0x5'));var logger=require(_0xf54e('0x6'))(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var jayson=require(_0xf54e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x18e84e,_0x99cf9,_0x2464ae){return new BPromise(function(_0x561870,_0x27e69b){return client['request'](_0x18e84e,_0x2464ae)[_0xf54e('0xa')](function(_0x289755){logger['info'](_0xf54e('0xb'),_0x99cf9,_0xf54e('0xc'));logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x99cf9,'request\x20sent',JSON[_0xf54e('0xf')](_0x289755));if(_0x289755[_0xf54e('0x10')]){if(_0x289755[_0xf54e('0x10')][_0xf54e('0x11')]===0x1f4){logger['error'](_0xf54e('0xb'),_0x99cf9,_0x289755['error']['message']);return _0x27e69b(_0x289755[_0xf54e('0x10')][_0xf54e('0x12')]);}logger[_0xf54e('0x10')](_0xf54e('0xb'),_0x99cf9,_0x289755['error'][_0xf54e('0x12')]);return _0x561870(_0x289755[_0xf54e('0x10')][_0xf54e('0x12')]);}else{logger[_0xf54e('0x13')]('MailServerIn,\x20%s,\x20%s',_0x99cf9,_0xf54e('0xc'));_0x561870(_0x289755[_0xf54e('0x14')][_0xf54e('0x12')]);}})['catch'](function(_0x4af633){logger[_0xf54e('0x10')](_0xf54e('0xb'),_0x99cf9,_0x4af633);_0x27e69b(_0x4af633);});});}exports[_0xf54e('0x15')]=function(_0x9647f){var _0x15cc48=this;return new Promise(function(_0x3e7d96,_0x2e27b6){return db[_0xf54e('0x16')][_0xf54e('0x17')]({'raw':_0x9647f[_0xf54e('0x18')]?_0x9647f[_0xf54e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x9647f['options']?_0x9647f[_0xf54e('0x18')]['where']||null:null,'attributes':_0x9647f[_0xf54e('0x18')]?_0x9647f[_0xf54e('0x18')][_0xf54e('0x19')]||null:null,'limit':_0x9647f[_0xf54e('0x18')]?_0x9647f[_0xf54e('0x18')][_0xf54e('0x1a')]||null:null,'include':_0x9647f[_0xf54e('0x18')]?_0x9647f[_0xf54e('0x18')][_0xf54e('0x1b')]?_[_0xf54e('0x1c')](_0x9647f[_0xf54e('0x18')]['include'],function(_0x6f6d29){return{'model':db[_0x6f6d29['model']],'as':_0x6f6d29['as'],'attributes':_0x6f6d29[_0xf54e('0x19')],'include':_0x6f6d29[_0xf54e('0x1b')]?_[_0xf54e('0x1c')](_0x6f6d29[_0xf54e('0x1b')],function(_0x3805a7){return{'model':db[_0x3805a7[_0xf54e('0x1d')]],'as':_0x3805a7['as'],'attributes':_0x3805a7[_0xf54e('0x19')],'include':_0x3805a7[_0xf54e('0x1b')]?_[_0xf54e('0x1c')](_0x3805a7[_0xf54e('0x1b')],function(_0xf6cdd7){return{'model':db[_0xf6cdd7[_0xf54e('0x1d')]],'as':_0xf6cdd7['as'],'attributes':_0xf6cdd7[_0xf54e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb3706e){logger['info'](_0xf54e('0x15'),_0x9647f);logger['debug'](_0xf54e('0x15'),_0x9647f,JSON[_0xf54e('0xf')](_0xb3706e));_0x3e7d96(_0xb3706e);})[_0xf54e('0x1e')](function(_0xa13cd0){logger[_0xf54e('0x10')](_0xf54e('0x15'),_0xa13cd0[_0xf54e('0x12')],_0x9647f);_0x2e27b6(_0x15cc48['error'](0x1f4,_0xa13cd0['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 7c1bd4d..b555c4f 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(_0x121bb4,_0x672e51){var _0x147f90=function(_0x180224){while(--_0x180224){_0x121bb4['push'](_0x121bb4['shift']());}};_0x147f90(++_0x672e51);}(_0x814b,0x1a2));var _0xb814=function(_0x4aa838,_0x4aa14f){_0x4aa838=_0x4aa838-0x0;var _0x3abff0=_0x814b[_0x4aa838];return _0x3abff0;};'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 _0x7a54=['/:id','show','post','create','update','delete','multer','util','path','Router','../../components/auth/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index'];(function(_0x296f9b,_0x40d594){var _0x479e0e=function(_0x8181ad){while(--_0x8181ad){_0x296f9b['push'](_0x296f9b['shift']());}};_0x479e0e(++_0x40d594);}(_0x7a54,0x106));var _0x47a5=function(_0x53868,_0x201c58){_0x53868=_0x53868-0x0;var _0x1e12a5=_0x7a54[_0x53868];return _0x1e12a5;};'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('0xc')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router[_0x47a5('0xf')]('/:id',auth[_0x47a5('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 5eb666d..d269907 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 _0xc7c4=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x13bcb7,_0x69f1c5){var _0x4ac418=function(_0x3801e9){while(--_0x3801e9){_0x13bcb7['push'](_0x13bcb7['shift']());}};_0x4ac418(++_0x69f1c5);}(_0xc7c4,0x102));var _0x4c7c=function(_0x2b9b90,_0x3bb97e){_0x2b9b90=_0x2b9b90-0x0;var _0x2a14d1=_0xc7c4[_0x2b9b90];return _0x2a14d1;};'use strict';var Sequelize=require(_0x4c7c('0x0'));module[_0x4c7c('0x1')]={'description':{'type':Sequelize[_0x4c7c('0x2')]},'host':{'type':Sequelize[_0x4c7c('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x4c7c('0x2')]},'port':{'type':Sequelize[_0x4c7c('0x3')]},'secure':{'type':Sequelize[_0x4c7c('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x13e9=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0x189c9e,_0x1c3b55){var _0x3f38ca=function(_0x4c05ec){while(--_0x4c05ec){_0x189c9e['push'](_0x189c9e['shift']());}};_0x3f38ca(++_0x1c3b55);}(_0x13e9,0x128));var _0x913e=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x13e9[_0x273c39];return _0x46d6b5;};'use strict';var Sequelize=require(_0x913e('0x0'));module['exports']={'description':{'type':Sequelize[_0x913e('0x1')]},'host':{'type':Sequelize[_0x913e('0x1')]},'user':{'type':Sequelize[_0x913e('0x1')]},'pass':{'type':Sequelize[_0x913e('0x1')]},'port':{'type':Sequelize[_0x913e('0x2')]},'secure':{'type':Sequelize[_0x913e('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x913e('0x1')]},'authentication':{'type':Sequelize[_0x913e('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 82d2153..fc75fc5 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 _0xac9e=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','MailServerOut','rawAttributes','query','dateStart','dateEnd','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','day','add','merge','filter','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','update','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x5e980d,_0x316987){var _0x347477=function(_0x5566a8){while(--_0x5566a8){_0x5e980d['push'](_0x5e980d['shift']());}};_0x347477(++_0x316987);}(_0xac9e,0x19a));var _0xeac9=function(_0x524870,_0x2bf621){_0x524870=_0x524870-0x0;var _0x48f07d=_0xac9e[_0x524870];return _0x48f07d;};'use strict';var jsonpatch=require(_0xeac9('0x0'));var rp=require(_0xeac9('0x1'));var moment=require(_0xeac9('0x2'));var BPromise=require(_0xeac9('0x3'));var Mustache=require(_0xeac9('0x4'));var util=require(_0xeac9('0x5'));var path=require(_0xeac9('0x6'));var sox=require(_0xeac9('0x7'));var csv=require(_0xeac9('0x8'));var ejs=require(_0xeac9('0x9'));var fs=require('fs');var _=require(_0xeac9('0xa'));var squel=require(_0xeac9('0xb'));var crypto=require(_0xeac9('0xc'));var jsforce=require(_0xeac9('0xd'));var deskjs=require(_0xeac9('0xe'));var toCsv=require(_0xeac9('0x8'));var querystring=require(_0xeac9('0xf'));var Papa=require(_0xeac9('0x10'));var qs=require(_0xeac9('0x11'));var logger=require(_0xeac9('0x12'))(_0xeac9('0x13'));var utils=require('../../config/utils');var config=require(_0xeac9('0x14'));var db=require(_0xeac9('0x15'))['db'];function respondWithStatusCode(_0x428c47,_0x1c2e62){_0x1c2e62=_0x1c2e62||0xcc;return function(_0x390548){if(_0x390548){return _0x428c47[_0xeac9('0x16')](_0x1c2e62);}return _0x428c47['status'](_0x1c2e62)['end']();};}function respondWithResult(_0x33f93b,_0x465808){_0x465808=_0x465808||0xc8;return function(_0xbcd6b4){if(_0xbcd6b4){return _0x33f93b['status'](_0x465808)[_0xeac9('0x17')](_0xbcd6b4);}};}function respondWithFilteredResult(_0x5af357,_0x1a44b1){return function(_0x4f6da2){if(_0x4f6da2){var _0x129451=_0x4f6da2[_0xeac9('0x18')],_0x4ace63=_0x1a44b1[_0xeac9('0x19')],_0x37e019=_0x1a44b1[_0xeac9('0x19')]+_0x1a44b1[_0xeac9('0x1a')],_0x293be0;if(_0x37e019>=_0x129451){_0x37e019=_0x129451;_0x293be0=0xc8;}else{_0x293be0=0xce;}_0x5af357['status'](_0x293be0);return _0x5af357[_0xeac9('0x1b')](_0xeac9('0x1c'),_0x4ace63+'-'+_0x37e019+'/'+_0x129451)[_0xeac9('0x17')](_0x4f6da2);}return null;};}function patchUpdates(_0x335723){return function(_0x46d9b2){try{jsonpatch[_0xeac9('0x1d')](_0x46d9b2,_0x335723,!![]);}catch(_0x427d9a){return BPromise[_0xeac9('0x1e')](_0x427d9a);}return _0x46d9b2[_0xeac9('0x1f')]();};}function saveUpdates(_0x13c959,_0xaf928){return function(_0x5ab902){if(_0x5ab902){return _0x5ab902['update'](_0x13c959)[_0xeac9('0x20')](function(_0x572a0f){return _0x572a0f;});}return null;};}function removeEntity(_0x478511,_0x187575){return function(_0x5a06f){if(_0x5a06f){return _0x5a06f[_0xeac9('0x21')]()[_0xeac9('0x20')](function(){_0x478511['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19504d,_0x346d13){return function(_0x572cd1){if(!_0x572cd1){_0x19504d[_0xeac9('0x16')](0x194);}return _0x572cd1;};}function handleError(_0x2255c3,_0x3a4d57){_0x3a4d57=_0x3a4d57||0x1f4;return function(_0x125bc2){logger['error'](_0x125bc2[_0xeac9('0x22')]);if(_0x125bc2[_0xeac9('0x23')]){delete _0x125bc2[_0xeac9('0x23')];}_0x2255c3['status'](_0x3a4d57)[_0xeac9('0x24')](_0x125bc2);};}exports[_0xeac9('0x25')]=function(_0x31397c,_0x33bce7){var _0x38e7aa={},_0x24c648={},_0x3d4f86={'count':0x0,'rows':[]};var _0x365eab=db[_0xeac9('0x26')][_0xeac9('0x27')];_0x24c648['model']=_['keys'](_0x365eab);var _0x28699e={'dateStart':_0x31397c[_0xeac9('0x28')][_0xeac9('0x29')],'dateEnd':_0x31397c['query']['dateEnd']};delete _0x31397c[_0xeac9('0x28')][_0xeac9('0x29')];delete _0x31397c[_0xeac9('0x28')][_0xeac9('0x2a')];_0x24c648['query']=_[_0xeac9('0x2b')](_0x31397c[_0xeac9('0x28')]);_0x24c648[_0xeac9('0x2c')]=_[_0xeac9('0x2d')](_0x24c648[_0xeac9('0x2e')],_0x24c648[_0xeac9('0x28')]);_0x38e7aa[_0xeac9('0x2f')]=_[_0xeac9('0x2d')](_0x24c648['model'],qs['fields'](_0x31397c[_0xeac9('0x28')][_0xeac9('0x30')]));_0x38e7aa[_0xeac9('0x2f')]=_0x38e7aa[_0xeac9('0x2f')]['length']?_0x38e7aa[_0xeac9('0x2f')]:_0x24c648[_0xeac9('0x2e')];if(!_0x31397c[_0xeac9('0x28')][_0xeac9('0x31')]('nolimit')){_0x38e7aa['limit']=qs['limit'](_0x31397c[_0xeac9('0x28')][_0xeac9('0x1a')]);_0x38e7aa[_0xeac9('0x19')]=qs['offset'](_0x31397c['query']['offset']);}_0x38e7aa['order']=qs[_0xeac9('0x32')](_0x31397c[_0xeac9('0x28')][_0xeac9('0x32')]);_0x38e7aa[_0xeac9('0x33')]=qs['filters'](_[_0xeac9('0x34')](_0x31397c[_0xeac9('0x28')],_0x24c648['filters']));if(_0x28699e[_0xeac9('0x29')]){if(_0x28699e['dateEnd']){_0x28699e[_0xeac9('0x2a')]=moment(_0x28699e[_0xeac9('0x2a')])['add'](0x1,_0xeac9('0x35'));}else{_0x28699e[_0xeac9('0x2a')]=moment(_0x28699e['dateStart'])[_0xeac9('0x36')](0x1,_0xeac9('0x35'));}_[_0xeac9('0x37')](_0x38e7aa['where'],{'createdAt':{'$gte':_0x28699e[_0xeac9('0x29')],'$lte':_0x28699e[_0xeac9('0x2a')]}});}if(_0x31397c[_0xeac9('0x28')][_0xeac9('0x38')]){_0x38e7aa[_0xeac9('0x33')]=_['merge'](_0x38e7aa[_0xeac9('0x33')],{'$or':_['map'](_0x38e7aa[_0xeac9('0x2f')],function(_0x108620){var _0x4aa31a={};_0x4aa31a[_0x108620]={'$like':'%'+_0x31397c['query']['filter']+'%'};return _0x4aa31a;})});}_0x38e7aa=_['merge']({},_0x38e7aa,_0x31397c[_0xeac9('0x39')]);var _0x419d3d={'where':_0x38e7aa[_0xeac9('0x33')]};return db['MailServerOut'][_0xeac9('0x18')](_0x419d3d)['then'](function(_0x5578c8){_0x3d4f86['count']=_0x5578c8;if(_0x31397c[_0xeac9('0x28')][_0xeac9('0x3a')]){_0x38e7aa['include']=[{'all':!![]}];}return db[_0xeac9('0x26')][_0xeac9('0x3b')](_0x38e7aa);})[_0xeac9('0x20')](function(_0x5801f4){_0x3d4f86[_0xeac9('0x3c')]=_0x5801f4;return _0x3d4f86;})[_0xeac9('0x20')](respondWithFilteredResult(_0x33bce7,_0x38e7aa))[_0xeac9('0x3d')](handleError(_0x33bce7,null));};exports[_0xeac9('0x3e')]=function(_0x4abe6a,_0x110ec6){var _0x50a83b={'raw':!![],'where':{'id':_0x4abe6a[_0xeac9('0x3f')]['id']}},_0x3378fe={};_0x3378fe[_0xeac9('0x2e')]=_[_0xeac9('0x2b')](db['MailServerOut'][_0xeac9('0x27')]);_0x3378fe['query']=_[_0xeac9('0x2b')](_0x4abe6a[_0xeac9('0x28')]);_0x3378fe[_0xeac9('0x2c')]=_[_0xeac9('0x2d')](_0x3378fe[_0xeac9('0x2e')],_0x3378fe[_0xeac9('0x28')]);_0x50a83b[_0xeac9('0x2f')]=_[_0xeac9('0x2d')](_0x3378fe[_0xeac9('0x2e')],qs[_0xeac9('0x30')](_0x4abe6a[_0xeac9('0x28')][_0xeac9('0x30')]));_0x50a83b[_0xeac9('0x2f')]=_0x50a83b['attributes'][_0xeac9('0x40')]?_0x50a83b[_0xeac9('0x2f')]:_0x3378fe[_0xeac9('0x2e')];if(_0x4abe6a['query']['includeAll']){_0x50a83b[_0xeac9('0x41')]=[{'all':!![]}];}_0x50a83b=_[_0xeac9('0x37')]({},_0x50a83b,_0x4abe6a[_0xeac9('0x39')]);return db['MailServerOut'][_0xeac9('0x42')](_0x50a83b)[_0xeac9('0x20')](handleEntityNotFound(_0x110ec6,null))[_0xeac9('0x20')](respondWithResult(_0x110ec6,null))['catch'](handleError(_0x110ec6,null));};exports['create']=function(_0x3473a4,_0x21b89e){return db[_0xeac9('0x26')][_0xeac9('0x43')](_0x3473a4[_0xeac9('0x44')],{})[_0xeac9('0x20')](respondWithResult(_0x21b89e,0xc9))['catch'](handleError(_0x21b89e,null));};exports[_0xeac9('0x45')]=function(_0x42a5ac,_0x24158e){if(_0x42a5ac['body']['id']){delete _0x42a5ac[_0xeac9('0x44')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0x42a5ac[_0xeac9('0x3f')]['id']}})[_0xeac9('0x20')](handleEntityNotFound(_0x24158e,null))['then'](saveUpdates(_0x42a5ac['body'],null))[_0xeac9('0x20')](respondWithResult(_0x24158e,null))[_0xeac9('0x3d')](handleError(_0x24158e,null));};exports['destroy']=function(_0x17f593,_0x1bc7d9){return db['MailServerOut'][_0xeac9('0x42')]({'where':{'id':_0x17f593[_0xeac9('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1bc7d9,null))[_0xeac9('0x20')](removeEntity(_0x1bc7d9,null))[_0xeac9('0x3d')](handleError(_0x1bc7d9,null));}; \ No newline at end of file +var _0xfd26=['api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','add','day','merge','where','map','filter','options','MailServerOut','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','find','params','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger'];(function(_0x3c4d78,_0x3cf1ef){var _0x5d4ca4=function(_0x1f8c05){while(--_0x1f8c05){_0x3c4d78['push'](_0x3c4d78['shift']());}};_0x5d4ca4(++_0x3cf1ef);}(_0xfd26,0x18f));var _0x6fd2=function(_0x2979d3,_0x54ff61){_0x2979d3=_0x2979d3-0x0;var _0x2a9a36=_0xfd26[_0x2979d3];return _0x2a9a36;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6fd2('0x0'));var Mustache=require(_0x6fd2('0x1'));var util=require(_0x6fd2('0x2'));var path=require(_0x6fd2('0x3'));var sox=require(_0x6fd2('0x4'));var csv=require(_0x6fd2('0x5'));var ejs=require(_0x6fd2('0x6'));var fs=require('fs');var _=require(_0x6fd2('0x7'));var squel=require(_0x6fd2('0x8'));var crypto=require(_0x6fd2('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x6fd2('0xa'));var toCsv=require(_0x6fd2('0x5'));var querystring=require(_0x6fd2('0xb'));var Papa=require(_0x6fd2('0xc'));var qs=require(_0x6fd2('0xd'));var logger=require(_0x6fd2('0xe'))(_0x6fd2('0xf'));var utils=require('../../config/utils');var config=require(_0x6fd2('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3abbc6,_0x44146a){_0x44146a=_0x44146a||0xcc;return function(_0x2e887d){if(_0x2e887d){return _0x3abbc6[_0x6fd2('0x11')](_0x44146a);}return _0x3abbc6[_0x6fd2('0x12')](_0x44146a)[_0x6fd2('0x13')]();};}function respondWithResult(_0x312f91,_0x16c128){_0x16c128=_0x16c128||0xc8;return function(_0x40a713){if(_0x40a713){return _0x312f91[_0x6fd2('0x12')](_0x16c128)[_0x6fd2('0x14')](_0x40a713);}};}function respondWithFilteredResult(_0x3e7f87,_0x5f2504){return function(_0x42ef75){if(_0x42ef75){var _0x18b170=_0x42ef75[_0x6fd2('0x15')],_0x5f54d3=_0x5f2504[_0x6fd2('0x16')],_0x5b8a29=_0x5f2504['offset']+_0x5f2504[_0x6fd2('0x17')],_0x44efec;if(_0x5b8a29>=_0x18b170){_0x5b8a29=_0x18b170;_0x44efec=0xc8;}else{_0x44efec=0xce;}_0x3e7f87[_0x6fd2('0x12')](_0x44efec);return _0x3e7f87[_0x6fd2('0x18')](_0x6fd2('0x19'),_0x5f54d3+'-'+_0x5b8a29+'/'+_0x18b170)[_0x6fd2('0x14')](_0x42ef75);}return null;};}function patchUpdates(_0x5f2491){return function(_0x46072d){try{jsonpatch['apply'](_0x46072d,_0x5f2491,!![]);}catch(_0x233e19){return BPromise[_0x6fd2('0x1a')](_0x233e19);}return _0x46072d[_0x6fd2('0x1b')]();};}function saveUpdates(_0x54b81e,_0x5d9b95){return function(_0x1e7c69){if(_0x1e7c69){return _0x1e7c69[_0x6fd2('0x1c')](_0x54b81e)[_0x6fd2('0x1d')](function(_0x1fb4b3){return _0x1fb4b3;});}return null;};}function removeEntity(_0xe02c71,_0x57c1bd){return function(_0xd40158){if(_0xd40158){return _0xd40158[_0x6fd2('0x1e')]()['then'](function(){_0xe02c71['status'](0xcc)[_0x6fd2('0x13')]();});}};}function handleEntityNotFound(_0x3a5c41,_0x1dcc37){return function(_0x4fee57){if(!_0x4fee57){_0x3a5c41['sendStatus'](0x194);}return _0x4fee57;};}function handleError(_0x324db7,_0xa57e64){_0xa57e64=_0xa57e64||0x1f4;return function(_0x5a1f8e){logger[_0x6fd2('0x1f')](_0x5a1f8e[_0x6fd2('0x20')]);if(_0x5a1f8e[_0x6fd2('0x21')]){delete _0x5a1f8e[_0x6fd2('0x21')];}_0x324db7[_0x6fd2('0x12')](_0xa57e64)[_0x6fd2('0x22')](_0x5a1f8e);};}exports[_0x6fd2('0x23')]=function(_0x467f89,_0x202583){var _0x38a6a3={},_0x69116f={},_0x579838={'count':0x0,'rows':[]};var _0xc14382=db['MailServerOut']['rawAttributes'];_0x69116f['model']=_[_0x6fd2('0x24')](_0xc14382);var _0x2de406={'dateStart':_0x467f89[_0x6fd2('0x25')][_0x6fd2('0x26')],'dateEnd':_0x467f89['query'][_0x6fd2('0x27')]};delete _0x467f89['query'][_0x6fd2('0x26')];delete _0x467f89['query']['dateEnd'];_0x69116f['query']=_[_0x6fd2('0x24')](_0x467f89[_0x6fd2('0x25')]);_0x69116f[_0x6fd2('0x28')]=_[_0x6fd2('0x29')](_0x69116f[_0x6fd2('0x2a')],_0x69116f['query']);_0x38a6a3[_0x6fd2('0x2b')]=_[_0x6fd2('0x29')](_0x69116f[_0x6fd2('0x2a')],qs[_0x6fd2('0x2c')](_0x467f89[_0x6fd2('0x25')]['fields']));_0x38a6a3[_0x6fd2('0x2b')]=_0x38a6a3['attributes'][_0x6fd2('0x2d')]?_0x38a6a3['attributes']:_0x69116f[_0x6fd2('0x2a')];if(!_0x467f89[_0x6fd2('0x25')][_0x6fd2('0x2e')](_0x6fd2('0x2f'))){_0x38a6a3[_0x6fd2('0x17')]=qs[_0x6fd2('0x17')](_0x467f89[_0x6fd2('0x25')][_0x6fd2('0x17')]);_0x38a6a3[_0x6fd2('0x16')]=qs[_0x6fd2('0x16')](_0x467f89[_0x6fd2('0x25')][_0x6fd2('0x16')]);}_0x38a6a3[_0x6fd2('0x30')]=qs['sort'](_0x467f89[_0x6fd2('0x25')]['sort']);_0x38a6a3['where']=qs[_0x6fd2('0x28')](_[_0x6fd2('0x31')](_0x467f89['query'],_0x69116f['filters']));if(_0x2de406[_0x6fd2('0x26')]){if(_0x2de406[_0x6fd2('0x27')]){_0x2de406[_0x6fd2('0x27')]=moment(_0x2de406[_0x6fd2('0x27')])[_0x6fd2('0x32')](0x1,_0x6fd2('0x33'));}else{_0x2de406[_0x6fd2('0x27')]=moment(_0x2de406['dateStart'])[_0x6fd2('0x32')](0x1,_0x6fd2('0x33'));}_[_0x6fd2('0x34')](_0x38a6a3[_0x6fd2('0x35')],{'createdAt':{'$gte':_0x2de406['dateStart'],'$lte':_0x2de406[_0x6fd2('0x27')]}});}if(_0x467f89['query']['filter']){_0x38a6a3[_0x6fd2('0x35')]=_['merge'](_0x38a6a3['where'],{'$or':_[_0x6fd2('0x36')](_0x38a6a3[_0x6fd2('0x2b')],function(_0x2b204d){var _0x382e45={};_0x382e45[_0x2b204d]={'$like':'%'+_0x467f89[_0x6fd2('0x25')][_0x6fd2('0x37')]+'%'};return _0x382e45;})});}_0x38a6a3=_[_0x6fd2('0x34')]({},_0x38a6a3,_0x467f89[_0x6fd2('0x38')]);var _0x208587={'where':_0x38a6a3[_0x6fd2('0x35')]};return db[_0x6fd2('0x39')][_0x6fd2('0x15')](_0x208587)[_0x6fd2('0x1d')](function(_0x10d366){_0x579838[_0x6fd2('0x15')]=_0x10d366;if(_0x467f89[_0x6fd2('0x25')][_0x6fd2('0x3a')]){_0x38a6a3[_0x6fd2('0x3b')]=[{'all':!![]}];}return db['MailServerOut'][_0x6fd2('0x3c')](_0x38a6a3);})[_0x6fd2('0x1d')](function(_0x30eaba){_0x579838[_0x6fd2('0x3d')]=_0x30eaba;return _0x579838;})[_0x6fd2('0x1d')](respondWithFilteredResult(_0x202583,_0x38a6a3))[_0x6fd2('0x3e')](handleError(_0x202583,null));};exports[_0x6fd2('0x3f')]=function(_0x54cfda,_0xe28316){var _0xeea7f2={'raw':!![],'where':{'id':_0x54cfda['params']['id']}},_0x1a3b3d={};_0x1a3b3d[_0x6fd2('0x2a')]=_[_0x6fd2('0x24')](db['MailServerOut'][_0x6fd2('0x40')]);_0x1a3b3d[_0x6fd2('0x25')]=_[_0x6fd2('0x24')](_0x54cfda[_0x6fd2('0x25')]);_0x1a3b3d[_0x6fd2('0x28')]=_['intersection'](_0x1a3b3d[_0x6fd2('0x2a')],_0x1a3b3d[_0x6fd2('0x25')]);_0xeea7f2[_0x6fd2('0x2b')]=_['intersection'](_0x1a3b3d[_0x6fd2('0x2a')],qs['fields'](_0x54cfda['query'][_0x6fd2('0x2c')]));_0xeea7f2[_0x6fd2('0x2b')]=_0xeea7f2[_0x6fd2('0x2b')][_0x6fd2('0x2d')]?_0xeea7f2[_0x6fd2('0x2b')]:_0x1a3b3d[_0x6fd2('0x2a')];if(_0x54cfda[_0x6fd2('0x25')][_0x6fd2('0x3a')]){_0xeea7f2[_0x6fd2('0x3b')]=[{'all':!![]}];}_0xeea7f2=_[_0x6fd2('0x34')]({},_0xeea7f2,_0x54cfda[_0x6fd2('0x38')]);return db['MailServerOut']['find'](_0xeea7f2)[_0x6fd2('0x1d')](handleEntityNotFound(_0xe28316,null))['then'](respondWithResult(_0xe28316,null))[_0x6fd2('0x3e')](handleError(_0xe28316,null));};exports[_0x6fd2('0x41')]=function(_0x348c4d,_0x4b21ab){return db[_0x6fd2('0x39')][_0x6fd2('0x41')](_0x348c4d[_0x6fd2('0x42')],{})[_0x6fd2('0x1d')](respondWithResult(_0x4b21ab,0xc9))[_0x6fd2('0x3e')](handleError(_0x4b21ab,null));};exports['update']=function(_0x2351be,_0x2ca6bc){if(_0x2351be[_0x6fd2('0x42')]['id']){delete _0x2351be[_0x6fd2('0x42')]['id'];}return db[_0x6fd2('0x39')][_0x6fd2('0x43')]({'where':{'id':_0x2351be['params']['id']}})[_0x6fd2('0x1d')](handleEntityNotFound(_0x2ca6bc,null))[_0x6fd2('0x1d')](saveUpdates(_0x2351be[_0x6fd2('0x42')],null))['then'](respondWithResult(_0x2ca6bc,null))['catch'](handleError(_0x2ca6bc,null));};exports[_0x6fd2('0x1e')]=function(_0x1ffaa9,_0x151b64){return db['MailServerOut'][_0x6fd2('0x43')]({'where':{'id':_0x1ffaa9[_0x6fd2('0x44')]['id']}})[_0x6fd2('0x1d')](handleEntityNotFound(_0x151b64,null))[_0x6fd2('0x1d')](removeEntity(_0x151b64,null))[_0x6fd2('0x3e')](handleError(_0x151b64,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 7e97da1..c53bda1 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 _0xba18=['bluebird','request-promise','./mailServerOut.attributes','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment'];(function(_0x2e8dc1,_0xacba6a){var _0xea5a76=function(_0x1b9a2f){while(--_0x1b9a2f){_0x2e8dc1['push'](_0x2e8dc1['shift']());}};_0xea5a76(++_0xacba6a);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8ba1('0x0'));var util=require(_0x8ba1('0x1'));var logger=require(_0x8ba1('0x2'))(_0x8ba1('0x3'));var moment=require(_0x8ba1('0x4'));var BPromise=require(_0x8ba1('0x5'));var rp=require(_0x8ba1('0x6'));var attributes=require(_0x8ba1('0x7'));module['exports']=function(_0xe3bc16,_0x3136d7){return _0xe3bc16[_0x8ba1('0x8')](_0x8ba1('0x9'),attributes,{'tableName':_0x8ba1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3fa4=['lodash','moment','bluebird','request-promise','./mailServerOut.attributes','exports','MailServerOut','mail_servers_out'];(function(_0x413c9d,_0xf2d738){var _0x61a820=function(_0x797f24){while(--_0x797f24){_0x413c9d['push'](_0x413c9d['shift']());}};_0x61a820(++_0xf2d738);}(_0x3fa4,0xf0));var _0x43fa=function(_0x347368,_0x4990d0){_0x347368=_0x347368-0x0;var _0x332ccd=_0x3fa4[_0x347368];return _0x332ccd;};'use strict';var _=require(_0x43fa('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x43fa('0x1'));var BPromise=require(_0x43fa('0x2'));var rp=require(_0x43fa('0x3'));var attributes=require(_0x43fa('0x4'));module[_0x43fa('0x5')]=function(_0x6b36ce,_0x41ded6){return _0x6b36ce['define'](_0x43fa('0x6'),attributes,{'tableName':_0x43fa('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 68bda61..cd343bd 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 _0x3b59=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','debug','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x38fb0d,_0x52b5db){var _0x30a5d6=function(_0x31eba6){while(--_0x31eba6){_0x38fb0d['push'](_0x38fb0d['shift']());}};_0x30a5d6(++_0x52b5db);}(_0x3b59,0x9c));var _0x93b5=function(_0x550c07,_0x5b70c0){_0x550c07=_0x550c07-0x0;var _0x5eabb7=_0x3b59[_0x550c07];return _0x5eabb7;};'use strict';var _=require(_0x93b5('0x0'));var util=require(_0x93b5('0x1'));var moment=require(_0x93b5('0x2'));var BPromise=require(_0x93b5('0x3'));var rs=require(_0x93b5('0x4'));var fs=require('fs');var db=require(_0x93b5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x93b5('0x6'))('rpc');var config=require(_0x93b5('0x7'));var jayson=require(_0x93b5('0x8'));var client=jayson[_0x93b5('0x9')][_0x93b5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5665a9,_0x3ecbe3,_0x34650d){return new BPromise(function(_0x4485b6,_0x484849){return client[_0x93b5('0xb')](_0x5665a9,_0x34650d)[_0x93b5('0xc')](function(_0x395ee1){logger[_0x93b5('0xd')](_0x93b5('0xe'),_0x3ecbe3,'request\x20sent');logger[_0x93b5('0xf')](_0x93b5('0x10'),_0x3ecbe3,_0x93b5('0x11'),JSON[_0x93b5('0x12')](_0x395ee1));if(_0x395ee1[_0x93b5('0x13')]){if(_0x395ee1['error'][_0x93b5('0x14')]===0x1f4){logger[_0x93b5('0x13')]('MailServerOut,\x20%s,\x20%s',_0x3ecbe3,_0x395ee1[_0x93b5('0x13')][_0x93b5('0x15')]);return _0x484849(_0x395ee1[_0x93b5('0x13')][_0x93b5('0x15')]);}logger[_0x93b5('0x13')]('MailServerOut,\x20%s,\x20%s',_0x3ecbe3,_0x395ee1[_0x93b5('0x13')][_0x93b5('0x15')]);return _0x4485b6(_0x395ee1['error'][_0x93b5('0x15')]);}else{logger[_0x93b5('0xd')](_0x93b5('0xe'),_0x3ecbe3,'request\x20sent');_0x4485b6(_0x395ee1[_0x93b5('0x16')]['message']);}})['catch'](function(_0x2bb397){logger['error'](_0x93b5('0xe'),_0x3ecbe3,_0x2bb397);_0x484849(_0x2bb397);});});} \ No newline at end of file +var _0x0820=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb'];(function(_0x27d529,_0x118a19){var _0x11074d=function(_0x5d907a){while(--_0x5d907a){_0x27d529['push'](_0x27d529['shift']());}};_0x11074d(++_0x118a19);}(_0x0820,0x1c8));var _0x0082=function(_0x1fbfd5,_0x4018cc){_0x1fbfd5=_0x1fbfd5-0x0;var _0xf4a988=_0x0820[_0x1fbfd5];return _0xf4a988;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0082('0x0'));var BPromise=require(_0x0082('0x1'));var rs=require(_0x0082('0x2'));var fs=require('fs');var db=require(_0x0082('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0082('0x4'))(_0x0082('0x5'));var config=require(_0x0082('0x6'));var jayson=require(_0x0082('0x7'));var client=jayson[_0x0082('0x8')][_0x0082('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a70e1,_0x5d0db8,_0x15e111){return new BPromise(function(_0x189d59,_0x76348a){return client[_0x0082('0xa')](_0x3a70e1,_0x15e111)[_0x0082('0xb')](function(_0x4cd5db){logger[_0x0082('0xc')](_0x0082('0xd'),_0x5d0db8,_0x0082('0xe'));logger[_0x0082('0xf')](_0x0082('0x10'),_0x5d0db8,_0x0082('0xe'),JSON[_0x0082('0x11')](_0x4cd5db));if(_0x4cd5db[_0x0082('0x12')]){if(_0x4cd5db[_0x0082('0x12')][_0x0082('0x13')]===0x1f4){logger[_0x0082('0x12')](_0x0082('0xd'),_0x5d0db8,_0x4cd5db['error'][_0x0082('0x14')]);return _0x76348a(_0x4cd5db[_0x0082('0x12')][_0x0082('0x14')]);}logger[_0x0082('0x12')]('MailServerOut,\x20%s,\x20%s',_0x5d0db8,_0x4cd5db[_0x0082('0x12')][_0x0082('0x14')]);return _0x189d59(_0x4cd5db['error'][_0x0082('0x14')]);}else{logger['info'](_0x0082('0xd'),_0x5d0db8,_0x0082('0xe'));_0x189d59(_0x4cd5db[_0x0082('0x15')][_0x0082('0x14')]);}})[_0x0082('0x16')](function(_0x432b68){logger[_0x0082('0x12')](_0x0082('0xd'),_0x5d0db8,_0x432b68);_0x76348a(_0x432b68);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index d66c451..0053efa 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 _0x131e=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','/describe','show','post','create','/:id','update','delete','destroy','express'];(function(_0x1d6fda,_0x38b3dd){var _0x14dc96=function(_0x517573){while(--_0x517573){_0x1d6fda['push'](_0x1d6fda['shift']());}};_0x14dc96(++_0x38b3dd);}(_0x131e,0x1ec));var _0xe131=function(_0x51bf2a,_0x5cd025){_0x51bf2a=_0x51bf2a-0x0;var _0x394621=_0x131e[_0x51bf2a];return _0x394621;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0xe131('0x0'));var router=express[_0xe131('0x1')]();var auth=require(_0xe131('0x2'));var interaction=require(_0xe131('0x3'));var config=require(_0xe131('0x4'));var controller=require(_0xe131('0x5'));router['get']('/',auth[_0xe131('0x6')](),controller[_0xe131('0x7')]);router[_0xe131('0x8')](_0xe131('0x9'),auth[_0xe131('0x6')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe131('0xa')]);router[_0xe131('0xb')]('/',auth['isAuthenticated'](),controller[_0xe131('0xc')]);router['put'](_0xe131('0xd'),auth[_0xe131('0x6')](),controller[_0xe131('0xe')]);router[_0xe131('0xf')](_0xe131('0xd'),auth[_0xe131('0x6')](),controller[_0xe131('0x10')]);module['exports']=router; \ No newline at end of file +var _0xd8b0=['update','destroy','exports','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','/describe','isAuthenticated','/:id','show','post','create','put'];(function(_0x4b095c,_0x266c55){var _0x4495e2=function(_0x556701){while(--_0x556701){_0x4b095c['push'](_0x4b095c['shift']());}};_0x4495e2(++_0x266c55);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var express=require('express');var router=express['Router']();var auth=require(_0x0d8b('0x2'));var interaction=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var controller=require(_0x0d8b('0x5'));router[_0x0d8b('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0d8b('0x6')](_0x0d8b('0x7'),auth[_0x0d8b('0x8')](),controller['describe']);router[_0x0d8b('0x6')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0xb')]('/',auth[_0x0d8b('0x8')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')](_0x0d8b('0x9'),auth[_0x0d8b('0x8')](),controller[_0x0d8b('0xe')]);router['delete'](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xf')]);module[_0x0d8b('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index eee4db9..17233d5 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 _0x02a7=['STRING','name','exports'];(function(_0x44585b,_0x5c43fc){var _0x173bf9=function(_0x21787c){while(--_0x21787c){_0x44585b['push'](_0x44585b['shift']());}};_0x173bf9(++_0x5c43fc);}(_0x02a7,0x1a6));var _0x702a=function(_0x4694dd,_0xc7d3ff){_0x4694dd=_0x4694dd-0x0;var _0x330af3=_0x02a7[_0x4694dd];return _0x330af3;};'use strict';var Sequelize=require('sequelize');module[_0x702a('0x0')]={'name':{'type':Sequelize[_0x702a('0x1')],'unique':_0x702a('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x702a('0x1')]}}; \ No newline at end of file +var _0x0bb4=['exports','name','STRING','sequelize'];(function(_0x5f588b,_0x5d312b){var _0x83e041=function(_0x202577){while(--_0x202577){_0x5f588b['push'](_0x5f588b['shift']());}};_0x83e041(++_0x5d312b);}(_0x0bb4,0x77));var _0x40bb=function(_0x33de66,_0x1c0b2f){_0x33de66=_0x33de66-0x0;var _0x51cc23=_0x0bb4[_0x33de66];return _0x51cc23;};'use strict';var Sequelize=require(_0x40bb('0x0'));module[_0x40bb('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x40bb('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x40bb('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 43f715c..3ffd6ee 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 _0x32bc=['path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','status','json','count','offset','set','apply','reject','save','update','then','end','error','stack','name','send','index','MailSubstatus','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','add','day','merge','where','filter','map','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','describe','fast-json-patch','request-promise','moment'];(function(_0x3df246,_0x489654){var _0x4c639f=function(_0x28c83){while(--_0x28c83){_0x3df246['push'](_0x3df246['shift']());}};_0x4c639f(++_0x489654);}(_0x32bc,0x195));var _0xc32b=function(_0x387056,_0x5550a5){_0x387056=_0x387056-0x0;var _0x3b276d=_0x32bc[_0x387056];return _0x3b276d;};'use strict';var jsonpatch=require(_0xc32b('0x0'));var rp=require(_0xc32b('0x1'));var moment=require(_0xc32b('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc32b('0x3'));var sox=require(_0xc32b('0x4'));var csv=require('to-csv');var ejs=require(_0xc32b('0x5'));var fs=require('fs');var _=require(_0xc32b('0x6'));var squel=require('squel');var crypto=require(_0xc32b('0x7'));var jsforce=require(_0xc32b('0x8'));var deskjs=require(_0xc32b('0x9'));var toCsv=require('to-csv');var querystring=require(_0xc32b('0xa'));var Papa=require(_0xc32b('0xb'));var qs=require(_0xc32b('0xc'));var logger=require(_0xc32b('0xd'))('api');var utils=require(_0xc32b('0xe'));var config=require(_0xc32b('0xf'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1319a7,_0x58f58e){_0x58f58e=_0x58f58e||0xcc;return function(_0x22a5ea){if(_0x22a5ea){return _0x1319a7['sendStatus'](_0x58f58e);}return _0x1319a7[_0xc32b('0x10')](_0x58f58e)['end']();};}function respondWithResult(_0x2181a1,_0x5b2c65){_0x5b2c65=_0x5b2c65||0xc8;return function(_0x458865){if(_0x458865){return _0x2181a1[_0xc32b('0x10')](_0x5b2c65)[_0xc32b('0x11')](_0x458865);}};}function respondWithFilteredResult(_0x53d3c2,_0x5eada8){return function(_0x44194f){if(_0x44194f){var _0x3da2de=_0x44194f[_0xc32b('0x12')],_0x339308=_0x5eada8['offset'],_0x26a449=_0x5eada8[_0xc32b('0x13')]+_0x5eada8['limit'],_0x45774f;if(_0x26a449>=_0x3da2de){_0x26a449=_0x3da2de;_0x45774f=0xc8;}else{_0x45774f=0xce;}_0x53d3c2['status'](_0x45774f);return _0x53d3c2[_0xc32b('0x14')]('Content-Range',_0x339308+'-'+_0x26a449+'/'+_0x3da2de)[_0xc32b('0x11')](_0x44194f);}return null;};}function patchUpdates(_0x20e636){return function(_0x128efe){try{jsonpatch[_0xc32b('0x15')](_0x128efe,_0x20e636,!![]);}catch(_0x285100){return BPromise[_0xc32b('0x16')](_0x285100);}return _0x128efe[_0xc32b('0x17')]();};}function saveUpdates(_0x3a9f06,_0x4566ab){return function(_0x363786){if(_0x363786){return _0x363786[_0xc32b('0x18')](_0x3a9f06)[_0xc32b('0x19')](function(_0x1b5c32){return _0x1b5c32;});}return null;};}function removeEntity(_0x2a1fa5,_0x21ff9e){return function(_0x3d49ae){if(_0x3d49ae){return _0x3d49ae['destroy']()['then'](function(){_0x2a1fa5[_0xc32b('0x10')](0xcc)[_0xc32b('0x1a')]();});}};}function handleEntityNotFound(_0x8a1827,_0x353267){return function(_0x20e1c4){if(!_0x20e1c4){_0x8a1827['sendStatus'](0x194);}return _0x20e1c4;};}function handleError(_0x2522e1,_0x43a246){_0x43a246=_0x43a246||0x1f4;return function(_0x55ce80){logger[_0xc32b('0x1b')](_0x55ce80[_0xc32b('0x1c')]);if(_0x55ce80[_0xc32b('0x1d')]){delete _0x55ce80[_0xc32b('0x1d')];}_0x2522e1[_0xc32b('0x10')](_0x43a246)[_0xc32b('0x1e')](_0x55ce80);};}exports[_0xc32b('0x1f')]=function(_0x12d28d,_0x4a1224){var _0x6ce7e={},_0xe76758={},_0x147342={'count':0x0,'rows':[]};var _0x21d626=db[_0xc32b('0x20')][_0xc32b('0x21')];_0xe76758[_0xc32b('0x22')]=_[_0xc32b('0x23')](_0x21d626);var _0x3a014d={'dateStart':_0x12d28d[_0xc32b('0x24')][_0xc32b('0x25')],'dateEnd':_0x12d28d[_0xc32b('0x24')][_0xc32b('0x26')]};delete _0x12d28d[_0xc32b('0x24')]['dateStart'];delete _0x12d28d[_0xc32b('0x24')][_0xc32b('0x26')];_0xe76758['query']=_[_0xc32b('0x23')](_0x12d28d[_0xc32b('0x24')]);_0xe76758['filters']=_[_0xc32b('0x27')](_0xe76758[_0xc32b('0x22')],_0xe76758['query']);_0x6ce7e[_0xc32b('0x28')]=_['intersection'](_0xe76758[_0xc32b('0x22')],qs[_0xc32b('0x29')](_0x12d28d[_0xc32b('0x24')][_0xc32b('0x29')]));_0x6ce7e['attributes']=_0x6ce7e[_0xc32b('0x28')][_0xc32b('0x2a')]?_0x6ce7e[_0xc32b('0x28')]:_0xe76758[_0xc32b('0x22')];if(!_0x12d28d[_0xc32b('0x24')][_0xc32b('0x2b')](_0xc32b('0x2c'))){_0x6ce7e[_0xc32b('0x2d')]=qs[_0xc32b('0x2d')](_0x12d28d[_0xc32b('0x24')]['limit']);_0x6ce7e[_0xc32b('0x13')]=qs['offset'](_0x12d28d['query'][_0xc32b('0x13')]);}_0x6ce7e[_0xc32b('0x2e')]=qs['sort'](_0x12d28d[_0xc32b('0x24')][_0xc32b('0x2f')]);_0x6ce7e['where']=qs[_0xc32b('0x30')](_['pick'](_0x12d28d[_0xc32b('0x24')],_0xe76758[_0xc32b('0x30')]));if(_0x3a014d[_0xc32b('0x25')]){if(_0x3a014d[_0xc32b('0x26')]){_0x3a014d[_0xc32b('0x26')]=moment(_0x3a014d['dateEnd'])[_0xc32b('0x31')](0x1,_0xc32b('0x32'));}else{_0x3a014d[_0xc32b('0x26')]=moment(_0x3a014d['dateStart'])['add'](0x1,'day');}_[_0xc32b('0x33')](_0x6ce7e[_0xc32b('0x34')],{'createdAt':{'$gte':_0x3a014d[_0xc32b('0x25')],'$lte':_0x3a014d['dateEnd']}});}if(_0x12d28d[_0xc32b('0x24')][_0xc32b('0x35')]){_0x6ce7e[_0xc32b('0x34')]=_[_0xc32b('0x33')](_0x6ce7e[_0xc32b('0x34')],{'$or':_[_0xc32b('0x36')](_0x6ce7e[_0xc32b('0x28')],function(_0x34c781){var _0x46c4b8={};_0x46c4b8[_0x34c781]={'$like':'%'+_0x12d28d[_0xc32b('0x24')][_0xc32b('0x35')]+'%'};return _0x46c4b8;})});}_0x6ce7e=_['merge']({},_0x6ce7e,_0x12d28d[_0xc32b('0x37')]);var _0xe20add={'where':_0x6ce7e[_0xc32b('0x34')]};return db[_0xc32b('0x20')][_0xc32b('0x12')](_0xe20add)[_0xc32b('0x19')](function(_0x193bfb){_0x147342[_0xc32b('0x12')]=_0x193bfb;if(_0x12d28d[_0xc32b('0x24')][_0xc32b('0x38')]){_0x6ce7e[_0xc32b('0x39')]=[{'all':!![]}];}return db[_0xc32b('0x20')][_0xc32b('0x3a')](_0x6ce7e);})[_0xc32b('0x19')](function(_0x3b54df){_0x147342[_0xc32b('0x3b')]=_0x3b54df;return _0x147342;})[_0xc32b('0x19')](respondWithFilteredResult(_0x4a1224,_0x6ce7e))['catch'](handleError(_0x4a1224,null));};exports[_0xc32b('0x3c')]=function(_0x58901f,_0x12883b){var _0x3508e9={'raw':!![],'where':{'id':_0x58901f[_0xc32b('0x3d')]['id']}},_0x861ca6={};_0x861ca6[_0xc32b('0x22')]=_[_0xc32b('0x23')](db['MailSubstatus']['rawAttributes']);_0x861ca6[_0xc32b('0x24')]=_[_0xc32b('0x23')](_0x58901f[_0xc32b('0x24')]);_0x861ca6[_0xc32b('0x30')]=_[_0xc32b('0x27')](_0x861ca6['model'],_0x861ca6[_0xc32b('0x24')]);_0x3508e9[_0xc32b('0x28')]=_[_0xc32b('0x27')](_0x861ca6[_0xc32b('0x22')],qs[_0xc32b('0x29')](_0x58901f[_0xc32b('0x24')]['fields']));_0x3508e9[_0xc32b('0x28')]=_0x3508e9[_0xc32b('0x28')]['length']?_0x3508e9['attributes']:_0x861ca6[_0xc32b('0x22')];if(_0x58901f[_0xc32b('0x24')]['includeAll']){_0x3508e9['include']=[{'all':!![]}];}_0x3508e9=_[_0xc32b('0x33')]({},_0x3508e9,_0x58901f[_0xc32b('0x37')]);return db[_0xc32b('0x20')][_0xc32b('0x3e')](_0x3508e9)[_0xc32b('0x19')](handleEntityNotFound(_0x12883b,null))['then'](respondWithResult(_0x12883b,null))[_0xc32b('0x3f')](handleError(_0x12883b,null));};exports[_0xc32b('0x40')]=function(_0x2cf31c,_0xdd5b04){return db[_0xc32b('0x20')][_0xc32b('0x40')](_0x2cf31c[_0xc32b('0x41')],{})[_0xc32b('0x19')](respondWithResult(_0xdd5b04,0xc9))['catch'](handleError(_0xdd5b04,null));};exports[_0xc32b('0x18')]=function(_0x163ddf,_0x1c74f2){if(_0x163ddf['body']['id']){delete _0x163ddf[_0xc32b('0x41')]['id'];}return db[_0xc32b('0x20')][_0xc32b('0x3e')]({'where':{'id':_0x163ddf[_0xc32b('0x3d')]['id']}})[_0xc32b('0x19')](handleEntityNotFound(_0x1c74f2,null))['then'](saveUpdates(_0x163ddf[_0xc32b('0x41')],null))[_0xc32b('0x19')](respondWithResult(_0x1c74f2,null))[_0xc32b('0x3f')](handleError(_0x1c74f2,null));};exports[_0xc32b('0x42')]=function(_0x1eecad,_0x5b7a7d){return db[_0xc32b('0x20')][_0xc32b('0x3e')]({'where':{'id':_0x1eecad[_0xc32b('0x3d')]['id']}})[_0xc32b('0x19')](handleEntityNotFound(_0x5b7a7d,null))[_0xc32b('0x19')](removeEntity(_0x5b7a7d,null))[_0xc32b('0x3f')](handleError(_0x5b7a7d,null));};exports[_0xc32b('0x43')]=function(_0xa0ac06,_0x2c3ea1){return db[_0xc32b('0x20')][_0xc32b('0x43')]()[_0xc32b('0x19')](respondWithResult(_0x2c3ea1,null))[_0xc32b('0x3f')](handleError(_0x2c3ea1,null));}; \ No newline at end of file +var _0x18d9=['status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','MailSubstatus','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','options','include','findAll','rows','catch','params','includeAll','find','create','body','describe','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x4cc6e6,_0x4c290e){var _0x2242c9=function(_0x29dc92){while(--_0x29dc92){_0x4cc6e6['push'](_0x4cc6e6['shift']());}};_0x2242c9(++_0x4c290e);}(_0x18d9,0x1dd));var _0x918d=function(_0x5e7ebf,_0x21d7fa){_0x5e7ebf=_0x5e7ebf-0x0;var _0x4338df=_0x18d9[_0x5e7ebf];return _0x4338df;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x918d('0x0'));var moment=require(_0x918d('0x1'));var BPromise=require(_0x918d('0x2'));var Mustache=require(_0x918d('0x3'));var util=require(_0x918d('0x4'));var path=require(_0x918d('0x5'));var sox=require(_0x918d('0x6'));var csv=require(_0x918d('0x7'));var ejs=require(_0x918d('0x8'));var fs=require('fs');var _=require(_0x918d('0x9'));var squel=require(_0x918d('0xa'));var crypto=require(_0x918d('0xb'));var jsforce=require(_0x918d('0xc'));var deskjs=require(_0x918d('0xd'));var toCsv=require(_0x918d('0x7'));var querystring=require(_0x918d('0xe'));var Papa=require('papaparse');var qs=require(_0x918d('0xf'));var logger=require(_0x918d('0x10'))(_0x918d('0x11'));var utils=require(_0x918d('0x12'));var config=require(_0x918d('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58bbdf,_0x2b167f){_0x2b167f=_0x2b167f||0xcc;return function(_0x18c802){if(_0x18c802){return _0x58bbdf['sendStatus'](_0x2b167f);}return _0x58bbdf[_0x918d('0x14')](_0x2b167f)['end']();};}function respondWithResult(_0x2bbfc5,_0x4bf684){_0x4bf684=_0x4bf684||0xc8;return function(_0x369ea1){if(_0x369ea1){return _0x2bbfc5['status'](_0x4bf684)[_0x918d('0x15')](_0x369ea1);}};}function respondWithFilteredResult(_0xf0d0ef,_0x473f40){return function(_0x5d59fc){if(_0x5d59fc){var _0x5e890e=_0x5d59fc[_0x918d('0x16')],_0x24ec86=_0x473f40[_0x918d('0x17')],_0x2536bc=_0x473f40[_0x918d('0x17')]+_0x473f40[_0x918d('0x18')],_0x17f4bc;if(_0x2536bc>=_0x5e890e){_0x2536bc=_0x5e890e;_0x17f4bc=0xc8;}else{_0x17f4bc=0xce;}_0xf0d0ef[_0x918d('0x14')](_0x17f4bc);return _0xf0d0ef[_0x918d('0x19')]('Content-Range',_0x24ec86+'-'+_0x2536bc+'/'+_0x5e890e)[_0x918d('0x15')](_0x5d59fc);}return null;};}function patchUpdates(_0x24f6a0){return function(_0x22b59d){try{jsonpatch[_0x918d('0x1a')](_0x22b59d,_0x24f6a0,!![]);}catch(_0x141cad){return BPromise[_0x918d('0x1b')](_0x141cad);}return _0x22b59d[_0x918d('0x1c')]();};}function saveUpdates(_0x15a5bc,_0x380219){return function(_0x307e2f){if(_0x307e2f){return _0x307e2f[_0x918d('0x1d')](_0x15a5bc)[_0x918d('0x1e')](function(_0x470350){return _0x470350;});}return null;};}function removeEntity(_0x3155b3,_0x26e454){return function(_0x28211b){if(_0x28211b){return _0x28211b[_0x918d('0x1f')]()[_0x918d('0x1e')](function(){_0x3155b3[_0x918d('0x14')](0xcc)[_0x918d('0x20')]();});}};}function handleEntityNotFound(_0x2e95d4,_0x2fb143){return function(_0x5a6743){if(!_0x5a6743){_0x2e95d4[_0x918d('0x21')](0x194);}return _0x5a6743;};}function handleError(_0x3709b7,_0x2b37b8){_0x2b37b8=_0x2b37b8||0x1f4;return function(_0x964a38){logger[_0x918d('0x22')](_0x964a38['stack']);if(_0x964a38[_0x918d('0x23')]){delete _0x964a38[_0x918d('0x23')];}_0x3709b7[_0x918d('0x14')](_0x2b37b8)[_0x918d('0x24')](_0x964a38);};}exports[_0x918d('0x25')]=function(_0x2bcbcb,_0x74ed84){var _0x3d310a={},_0x433a56={},_0x5f22fe={'count':0x0,'rows':[]};var _0x31aed8=db[_0x918d('0x26')][_0x918d('0x27')];_0x433a56[_0x918d('0x28')]=_['keys'](_0x31aed8);var _0x9e205={'dateStart':_0x2bcbcb[_0x918d('0x29')][_0x918d('0x2a')],'dateEnd':_0x2bcbcb[_0x918d('0x29')][_0x918d('0x2b')]};delete _0x2bcbcb[_0x918d('0x29')][_0x918d('0x2a')];delete _0x2bcbcb[_0x918d('0x29')][_0x918d('0x2b')];_0x433a56['query']=_[_0x918d('0x2c')](_0x2bcbcb[_0x918d('0x29')]);_0x433a56[_0x918d('0x2d')]=_['intersection'](_0x433a56[_0x918d('0x28')],_0x433a56[_0x918d('0x29')]);_0x3d310a['attributes']=_[_0x918d('0x2e')](_0x433a56[_0x918d('0x28')],qs['fields'](_0x2bcbcb['query'][_0x918d('0x2f')]));_0x3d310a['attributes']=_0x3d310a[_0x918d('0x30')][_0x918d('0x31')]?_0x3d310a[_0x918d('0x30')]:_0x433a56[_0x918d('0x28')];if(!_0x2bcbcb[_0x918d('0x29')][_0x918d('0x32')](_0x918d('0x33'))){_0x3d310a[_0x918d('0x18')]=qs['limit'](_0x2bcbcb['query'][_0x918d('0x18')]);_0x3d310a[_0x918d('0x17')]=qs['offset'](_0x2bcbcb[_0x918d('0x29')][_0x918d('0x17')]);}_0x3d310a[_0x918d('0x34')]=qs[_0x918d('0x35')](_0x2bcbcb[_0x918d('0x29')]['sort']);_0x3d310a[_0x918d('0x36')]=qs[_0x918d('0x2d')](_[_0x918d('0x37')](_0x2bcbcb[_0x918d('0x29')],_0x433a56['filters']));if(_0x9e205[_0x918d('0x2a')]){if(_0x9e205['dateEnd']){_0x9e205[_0x918d('0x2b')]=moment(_0x9e205[_0x918d('0x2b')])[_0x918d('0x38')](0x1,'day');}else{_0x9e205['dateEnd']=moment(_0x9e205[_0x918d('0x2a')])[_0x918d('0x38')](0x1,_0x918d('0x39'));}_[_0x918d('0x3a')](_0x3d310a[_0x918d('0x36')],{'createdAt':{'$gte':_0x9e205[_0x918d('0x2a')],'$lte':_0x9e205[_0x918d('0x2b')]}});}if(_0x2bcbcb[_0x918d('0x29')][_0x918d('0x3b')]){_0x3d310a[_0x918d('0x36')]=_[_0x918d('0x3a')](_0x3d310a[_0x918d('0x36')],{'$or':_['map'](_0x3d310a['attributes'],function(_0x374064){var _0x247d70={};_0x247d70[_0x374064]={'$like':'%'+_0x2bcbcb[_0x918d('0x29')][_0x918d('0x3b')]+'%'};return _0x247d70;})});}_0x3d310a=_[_0x918d('0x3a')]({},_0x3d310a,_0x2bcbcb[_0x918d('0x3c')]);var _0x1af2f4={'where':_0x3d310a['where']};return db[_0x918d('0x26')][_0x918d('0x16')](_0x1af2f4)[_0x918d('0x1e')](function(_0x2a9936){_0x5f22fe[_0x918d('0x16')]=_0x2a9936;if(_0x2bcbcb[_0x918d('0x29')]['includeAll']){_0x3d310a[_0x918d('0x3d')]=[{'all':!![]}];}return db[_0x918d('0x26')][_0x918d('0x3e')](_0x3d310a);})[_0x918d('0x1e')](function(_0x1c0a50){_0x5f22fe[_0x918d('0x3f')]=_0x1c0a50;return _0x5f22fe;})[_0x918d('0x1e')](respondWithFilteredResult(_0x74ed84,_0x3d310a))[_0x918d('0x40')](handleError(_0x74ed84,null));};exports['show']=function(_0x206f50,_0x2011e9){var _0x408bc8={'raw':!![],'where':{'id':_0x206f50[_0x918d('0x41')]['id']}},_0x435e7f={};_0x435e7f[_0x918d('0x28')]=_[_0x918d('0x2c')](db[_0x918d('0x26')][_0x918d('0x27')]);_0x435e7f[_0x918d('0x29')]=_[_0x918d('0x2c')](_0x206f50[_0x918d('0x29')]);_0x435e7f[_0x918d('0x2d')]=_[_0x918d('0x2e')](_0x435e7f[_0x918d('0x28')],_0x435e7f['query']);_0x408bc8[_0x918d('0x30')]=_[_0x918d('0x2e')](_0x435e7f[_0x918d('0x28')],qs[_0x918d('0x2f')](_0x206f50['query']['fields']));_0x408bc8['attributes']=_0x408bc8[_0x918d('0x30')][_0x918d('0x31')]?_0x408bc8[_0x918d('0x30')]:_0x435e7f[_0x918d('0x28')];if(_0x206f50[_0x918d('0x29')][_0x918d('0x42')]){_0x408bc8[_0x918d('0x3d')]=[{'all':!![]}];}_0x408bc8=_[_0x918d('0x3a')]({},_0x408bc8,_0x206f50['options']);return db['MailSubstatus'][_0x918d('0x43')](_0x408bc8)[_0x918d('0x1e')](handleEntityNotFound(_0x2011e9,null))['then'](respondWithResult(_0x2011e9,null))[_0x918d('0x40')](handleError(_0x2011e9,null));};exports[_0x918d('0x44')]=function(_0x3d0a4d,_0x47b4e4){return db[_0x918d('0x26')]['create'](_0x3d0a4d[_0x918d('0x45')],{})[_0x918d('0x1e')](respondWithResult(_0x47b4e4,0xc9))[_0x918d('0x40')](handleError(_0x47b4e4,null));};exports['update']=function(_0x53b4f9,_0x16d283){if(_0x53b4f9[_0x918d('0x45')]['id']){delete _0x53b4f9['body']['id'];}return db['MailSubstatus'][_0x918d('0x43')]({'where':{'id':_0x53b4f9[_0x918d('0x41')]['id']}})['then'](handleEntityNotFound(_0x16d283,null))[_0x918d('0x1e')](saveUpdates(_0x53b4f9[_0x918d('0x45')],null))[_0x918d('0x1e')](respondWithResult(_0x16d283,null))[_0x918d('0x40')](handleError(_0x16d283,null));};exports[_0x918d('0x1f')]=function(_0x291f60,_0x217d4b){return db['MailSubstatus']['find']({'where':{'id':_0x291f60[_0x918d('0x41')]['id']}})['then'](handleEntityNotFound(_0x217d4b,null))[_0x918d('0x1e')](removeEntity(_0x217d4b,null))[_0x918d('0x40')](handleError(_0x217d4b,null));};exports[_0x918d('0x46')]=function(_0x5783a6,_0x5c8b74){return db[_0x918d('0x26')]['describe']()[_0x918d('0x1e')](respondWithResult(_0x5c8b74,null))[_0x918d('0x40')](handleError(_0x5c8b74,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 380b3e0..56a8345 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 _0x28b1=['../../config/logger','api','./mailSubstatus.attributes','exports','MailSubstatus','lodash','util'];(function(_0x5602d4,_0x5a74f9){var _0x55e5ae=function(_0x184a4b){while(--_0x184a4b){_0x5602d4['push'](_0x5602d4['shift']());}};_0x55e5ae(++_0x5a74f9);}(_0x28b1,0x1a2));var _0x128b=function(_0x4ebe59,_0x734c2){_0x4ebe59=_0x4ebe59-0x0;var _0x3242b=_0x28b1[_0x4ebe59];return _0x3242b;};'use strict';var _=require(_0x128b('0x0'));var util=require(_0x128b('0x1'));var logger=require(_0x128b('0x2'))(_0x128b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x128b('0x4'));module[_0x128b('0x5')]=function(_0x541024,_0x3a80c9){return _0x541024['define'](_0x128b('0x6'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf96=['mail_substatuses','lodash','util','api','moment','bluebird','request-promise','./mailSubstatus.attributes','exports','define'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xbf96,0x15f));var _0x6bf9=function(_0x800d81,_0xba8530){_0x800d81=_0x800d81-0x0;var _0x5693e6=_0xbf96[_0x800d81];return _0x5693e6;};'use strict';var _=require(_0x6bf9('0x0'));var util=require(_0x6bf9('0x1'));var logger=require('../../config/logger')(_0x6bf9('0x2'));var moment=require(_0x6bf9('0x3'));var BPromise=require(_0x6bf9('0x4'));var rp=require(_0x6bf9('0x5'));var attributes=require(_0x6bf9('0x6'));module[_0x6bf9('0x7')]=function(_0x2c7f48,_0x2ac60b){return _0x2c7f48[_0x6bf9('0x8')]('MailSubstatus',attributes,{'tableName':_0x6bf9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index ac7842c..7cb7825 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 _0xdb81=['request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailSubstatus,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x378eb1,_0x97b24b){var _0x2b9291=function(_0x444cec){while(--_0x444cec){_0x378eb1['push'](_0x378eb1['shift']());}};_0x2b9291(++_0x97b24b);}(_0xdb81,0x191));var _0x1db8=function(_0x28da79,_0x54d56b){_0x28da79=_0x28da79-0x0;var _0x477817=_0xdb81[_0x28da79];return _0x477817;};'use strict';var _=require(_0x1db8('0x0'));var util=require(_0x1db8('0x1'));var moment=require(_0x1db8('0x2'));var BPromise=require('bluebird');var rs=require(_0x1db8('0x3'));var fs=require('fs');var db=require(_0x1db8('0x4'))['db'];var utils=require(_0x1db8('0x5'));var logger=require('../../config/logger')(_0x1db8('0x6'));var config=require(_0x1db8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1db8('0x8')][_0x1db8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35c4b9,_0x94bea2,_0x5b84e9){return new BPromise(function(_0x57c053,_0x37f05c){return client[_0x1db8('0xa')](_0x35c4b9,_0x5b84e9)[_0x1db8('0xb')](function(_0xcc9db7){logger[_0x1db8('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x94bea2,_0x1db8('0xd'));logger[_0x1db8('0xe')](_0x1db8('0xf'),_0x94bea2,_0x1db8('0xd'),JSON[_0x1db8('0x10')](_0xcc9db7));if(_0xcc9db7[_0x1db8('0x11')]){if(_0xcc9db7[_0x1db8('0x11')][_0x1db8('0x12')]===0x1f4){logger[_0x1db8('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x94bea2,_0xcc9db7[_0x1db8('0x11')]['message']);return _0x37f05c(_0xcc9db7[_0x1db8('0x11')][_0x1db8('0x13')]);}logger[_0x1db8('0x11')](_0x1db8('0x14'),_0x94bea2,_0xcc9db7[_0x1db8('0x11')][_0x1db8('0x13')]);return _0x57c053(_0xcc9db7['error'][_0x1db8('0x13')]);}else{logger[_0x1db8('0xc')](_0x1db8('0x14'),_0x94bea2,'request\x20sent');_0x57c053(_0xcc9db7[_0x1db8('0x15')][_0x1db8('0x13')]);}})[_0x1db8('0x16')](function(_0x13ecc7){logger[_0x1db8('0x11')](_0x1db8('0x14'),_0x94bea2,_0x13ecc7);_0x37f05c(_0x13ecc7);});});} \ No newline at end of file +var _0x241b=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2892d9,_0x4ca615){var _0x15218d=function(_0xfc5d4c){while(--_0xfc5d4c){_0x2892d9['push'](_0x2892d9['shift']());}};_0x15218d(++_0x4ca615);}(_0x241b,0x176));var _0xb241=function(_0x40258a,_0x3d6d5d){_0x40258a=_0x40258a-0x0;var _0x330336=_0x241b[_0x40258a];return _0x330336;};'use strict';var _=require(_0xb241('0x0'));var util=require(_0xb241('0x1'));var moment=require(_0xb241('0x2'));var BPromise=require(_0xb241('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xb241('0x4'))['db'];var utils=require(_0xb241('0x5'));var logger=require(_0xb241('0x6'))(_0xb241('0x7'));var config=require('../../config/environment');var jayson=require(_0xb241('0x8'));var client=jayson[_0xb241('0x9')][_0xb241('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x244d30,_0x5be233,_0x4935ff){return new BPromise(function(_0x4e8125,_0x49cc00){return client[_0xb241('0xb')](_0x244d30,_0x4935ff)['then'](function(_0x5d18cf){logger[_0xb241('0xc')](_0xb241('0xd'),_0x5be233,_0xb241('0xe'));logger[_0xb241('0xf')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x5be233,'request\x20sent',JSON['stringify'](_0x5d18cf));if(_0x5d18cf[_0xb241('0x10')]){if(_0x5d18cf[_0xb241('0x10')][_0xb241('0x11')]===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x5be233,_0x5d18cf[_0xb241('0x10')]['message']);return _0x49cc00(_0x5d18cf[_0xb241('0x10')][_0xb241('0x12')]);}logger[_0xb241('0x10')](_0xb241('0xd'),_0x5be233,_0x5d18cf[_0xb241('0x10')][_0xb241('0x12')]);return _0x4e8125(_0x5d18cf[_0xb241('0x10')]['message']);}else{logger[_0xb241('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x5be233,_0xb241('0xe'));_0x4e8125(_0x5d18cf[_0xb241('0x13')][_0xb241('0x12')]);}})[_0xb241('0x14')](function(_0x2f6696){logger[_0xb241('0x10')](_0xb241('0xd'),_0x5be233,_0x2f6696);_0x49cc00(_0x2f6696);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index fdc9c66..c0f634c 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 _0x4a5c=['index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports','express','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x4a5c,0x150));var _0xc4a5=function(_0x4a3acd,_0x4bf641){_0x4a3acd=_0x4a3acd-0x0;var _0x3efdaa=_0x4a5c[_0x4a3acd];return _0x3efdaa;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0xc4a5('0x0'));var router=express['Router']();var auth=require(_0xc4a5('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0xc4a5('0x2'));var controller=require(_0xc4a5('0x3'));router[_0xc4a5('0x4')]('/',auth[_0xc4a5('0x5')](),controller[_0xc4a5('0x6')]);router[_0xc4a5('0x4')](_0xc4a5('0x7'),auth[_0xc4a5('0x5')](),controller[_0xc4a5('0x8')]);router['get']('/:id',auth[_0xc4a5('0x5')](),controller[_0xc4a5('0x9')]);router[_0xc4a5('0xa')]('/',auth[_0xc4a5('0x5')](),controller[_0xc4a5('0xb')]);router[_0xc4a5('0xc')](_0xc4a5('0xd'),auth['isAuthenticated'](),controller[_0xc4a5('0xe')]);router[_0xc4a5('0xf')](_0xc4a5('0xd'),auth[_0xc4a5('0x5')](),controller[_0xc4a5('0x10')]);module[_0xc4a5('0x11')]=router; \ No newline at end of file +var _0xeb37=['../../components/interaction/service','./mailTransferReport.controller','get','index','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','util','path','Router','../../components/auth/service'];(function(_0x2d857e,_0xfc94af){var _0x5ecc47=function(_0x4cdfc7){while(--_0x4cdfc7){_0x2d857e['push'](_0x2d857e['shift']());}};_0x5ecc47(++_0xfc94af);}(_0xeb37,0x84));var _0x7eb3=function(_0x32b80a,_0x30a953){_0x32b80a=_0x32b80a-0x0;var _0x44768a=_0xeb37[_0x32b80a];return _0x44768a;};'use strict';var multer=require('multer');var util=require(_0x7eb3('0x0'));var path=require(_0x7eb3('0x1'));var express=require('express');var router=express[_0x7eb3('0x2')]();var auth=require(_0x7eb3('0x3'));var interaction=require(_0x7eb3('0x4'));var config=require('../../config/environment');var controller=require(_0x7eb3('0x5'));router[_0x7eb3('0x6')]('/',auth['isAuthenticated'](),controller[_0x7eb3('0x7')]);router['get']('/describe',auth[_0x7eb3('0x8')](),controller['describe']);router[_0x7eb3('0x6')](_0x7eb3('0x9'),auth[_0x7eb3('0x8')](),controller['show']);router[_0x7eb3('0xa')]('/',auth[_0x7eb3('0x8')](),controller[_0x7eb3('0xb')]);router[_0x7eb3('0xc')]('/:id',auth[_0x7eb3('0x8')](),controller[_0x7eb3('0xd')]);router[_0x7eb3('0xe')](_0x7eb3('0x9'),auth['isAuthenticated'](),controller[_0x7eb3('0xf')]);module[_0x7eb3('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 276e763..d9daabc 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 _0xa679=['queue','DATE','NOW','moment','exports','STRING','ENUM','account','agent'];(function(_0x44f085,_0x2324b1){var _0x1917f0=function(_0x2417b0){while(--_0x2417b0){_0x44f085['push'](_0x44f085['shift']());}};_0x1917f0(++_0x2324b1);}(_0xa679,0x93));var _0x9a67=function(_0x1c3c8f,_0x3c21ab){_0x1c3c8f=_0x1c3c8f-0x0;var _0x49a449=_0xa679[_0x1c3c8f];return _0x49a449;};'use strict';var moment=require(_0x9a67('0x0'));var Sequelize=require('sequelize');module[_0x9a67('0x1')]={'uniqueid':{'type':Sequelize[_0x9a67('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9a67('0x3')](_0x9a67('0x4'),_0x9a67('0x5'),_0x9a67('0x6')),'allowNull':![],'defaultValue':_0x9a67('0x6')},'transferredAt':{'type':Sequelize[_0x9a67('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x9a67('0x8')]}}; \ No newline at end of file +var _0xb92d=['sequelize','exports','STRING','ENUM','agent','queue','DATE','moment'];(function(_0x25015c,_0x42d77a){var _0x9fa00f=function(_0x2fc287){while(--_0x2fc287){_0x25015c['push'](_0x25015c['shift']());}};_0x9fa00f(++_0x42d77a);}(_0xb92d,0x13f));var _0xdb92=function(_0x43b21d,_0x5d5677){_0x43b21d=_0x43b21d-0x0;var _0x1de400=_0xb92d[_0x43b21d];return _0x1de400;};'use strict';var moment=require(_0xdb92('0x0'));var Sequelize=require(_0xdb92('0x1'));module[_0xdb92('0x2')]={'uniqueid':{'type':Sequelize[_0xdb92('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdb92('0x4')]('account',_0xdb92('0x5'),_0xdb92('0x6')),'allowNull':![],'defaultValue':_0xdb92('0x6')},'transferredAt':{'type':Sequelize[_0xdb92('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 9d93ed1..fa2aa6e 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 _0xa7fa=['ejs','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','json','reject','update','stack','name','send','index','MailTransferReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','add','day','merge','filter','options','then','includeAll','include','findAll','rows','find','catch','create','body','params','destroy','describe','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x1b9be2,_0x5b71c0){var _0x401557=function(_0x210f0e){while(--_0x210f0e){_0x1b9be2['push'](_0x1b9be2['shift']());}};_0x401557(++_0x5b71c0);}(_0xa7fa,0x143));var _0xaa7f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7fa[_0x20a584];return _0x4b41a8;};'use strict';var jsonpatch=require(_0xaa7f('0x0'));var rp=require('request-promise');var moment=require(_0xaa7f('0x1'));var BPromise=require(_0xaa7f('0x2'));var Mustache=require(_0xaa7f('0x3'));var util=require('util');var path=require(_0xaa7f('0x4'));var sox=require(_0xaa7f('0x5'));var csv=require(_0xaa7f('0x6'));var ejs=require(_0xaa7f('0x7'));var fs=require('fs');var _=require(_0xaa7f('0x8'));var squel=require(_0xaa7f('0x9'));var crypto=require(_0xaa7f('0xa'));var jsforce=require(_0xaa7f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xaa7f('0x6'));var querystring=require(_0xaa7f('0xc'));var Papa=require('papaparse');var qs=require(_0xaa7f('0xd'));var logger=require(_0xaa7f('0xe'))(_0xaa7f('0xf'));var utils=require(_0xaa7f('0x10'));var config=require(_0xaa7f('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27f233,_0x560a35){_0x560a35=_0x560a35||0xcc;return function(_0x2586ce){if(_0x2586ce){return _0x27f233[_0xaa7f('0x12')](_0x560a35);}return _0x27f233[_0xaa7f('0x13')](_0x560a35)[_0xaa7f('0x14')]();};}function respondWithResult(_0x3df1ac,_0x5ba95f){_0x5ba95f=_0x5ba95f||0xc8;return function(_0x1c6581){if(_0x1c6581){return _0x3df1ac[_0xaa7f('0x13')](_0x5ba95f)['json'](_0x1c6581);}};}function respondWithFilteredResult(_0x148893,_0x321678){return function(_0x41b11d){if(_0x41b11d){var _0x28e510=_0x41b11d[_0xaa7f('0x15')],_0xcbd0c7=_0x321678[_0xaa7f('0x16')],_0x315574=_0x321678[_0xaa7f('0x16')]+_0x321678[_0xaa7f('0x17')],_0x10bdbd;if(_0x315574>=_0x28e510){_0x315574=_0x28e510;_0x10bdbd=0xc8;}else{_0x10bdbd=0xce;}_0x148893[_0xaa7f('0x13')](_0x10bdbd);return _0x148893[_0xaa7f('0x18')]('Content-Range',_0xcbd0c7+'-'+_0x315574+'/'+_0x28e510)[_0xaa7f('0x19')](_0x41b11d);}return null;};}function patchUpdates(_0x14580c){return function(_0xece51e){try{jsonpatch['apply'](_0xece51e,_0x14580c,!![]);}catch(_0x197d05){return BPromise[_0xaa7f('0x1a')](_0x197d05);}return _0xece51e['save']();};}function saveUpdates(_0x48872d,_0x5c0ce5){return function(_0x1ba1ee){if(_0x1ba1ee){return _0x1ba1ee[_0xaa7f('0x1b')](_0x48872d)['then'](function(_0x2d2ede){return _0x2d2ede;});}return null;};}function removeEntity(_0x8ab65d,_0x5117e6){return function(_0x56d943){if(_0x56d943){return _0x56d943['destroy']()['then'](function(){_0x8ab65d[_0xaa7f('0x13')](0xcc)[_0xaa7f('0x14')]();});}};}function handleEntityNotFound(_0x261a13,_0x131b38){return function(_0x31b2d3){if(!_0x31b2d3){_0x261a13[_0xaa7f('0x12')](0x194);}return _0x31b2d3;};}function handleError(_0x2cf2e7,_0x361e7e){_0x361e7e=_0x361e7e||0x1f4;return function(_0x22e099){logger['error'](_0x22e099[_0xaa7f('0x1c')]);if(_0x22e099[_0xaa7f('0x1d')]){delete _0x22e099[_0xaa7f('0x1d')];}_0x2cf2e7[_0xaa7f('0x13')](_0x361e7e)[_0xaa7f('0x1e')](_0x22e099);};}exports[_0xaa7f('0x1f')]=function(_0x1f048b,_0x11fd31){var _0x1a700f={},_0x177704={},_0x9dcd4f={'count':0x0,'rows':[]};var _0x2b8881=db[_0xaa7f('0x20')][_0xaa7f('0x21')];_0x177704[_0xaa7f('0x22')]=_[_0xaa7f('0x23')](_0x2b8881);var _0x1c9c5b={'dateStart':_0x1f048b[_0xaa7f('0x24')][_0xaa7f('0x25')],'dateEnd':_0x1f048b[_0xaa7f('0x24')]['dateEnd']};delete _0x1f048b[_0xaa7f('0x24')][_0xaa7f('0x25')];delete _0x1f048b[_0xaa7f('0x24')][_0xaa7f('0x26')];_0x177704[_0xaa7f('0x24')]=_[_0xaa7f('0x23')](_0x1f048b['query']);_0x177704[_0xaa7f('0x27')]=_['intersection'](_0x177704['model'],_0x177704[_0xaa7f('0x24')]);_0x1a700f[_0xaa7f('0x28')]=_[_0xaa7f('0x29')](_0x177704[_0xaa7f('0x22')],qs['fields'](_0x1f048b['query'][_0xaa7f('0x2a')]));_0x1a700f[_0xaa7f('0x28')]=_0x1a700f[_0xaa7f('0x28')][_0xaa7f('0x2b')]?_0x1a700f[_0xaa7f('0x28')]:_0x177704[_0xaa7f('0x22')];if(!_0x1f048b['query'][_0xaa7f('0x2c')]('nolimit')){_0x1a700f[_0xaa7f('0x17')]=qs[_0xaa7f('0x17')](_0x1f048b[_0xaa7f('0x24')][_0xaa7f('0x17')]);_0x1a700f[_0xaa7f('0x16')]=qs[_0xaa7f('0x16')](_0x1f048b[_0xaa7f('0x24')]['offset']);}_0x1a700f[_0xaa7f('0x2d')]=qs[_0xaa7f('0x2e')](_0x1f048b[_0xaa7f('0x24')][_0xaa7f('0x2e')]);_0x1a700f[_0xaa7f('0x2f')]=qs[_0xaa7f('0x27')](_[_0xaa7f('0x30')](_0x1f048b['query'],_0x177704[_0xaa7f('0x27')]));if(_0x1c9c5b['dateStart']){if(_0x1c9c5b[_0xaa7f('0x26')]){_0x1c9c5b[_0xaa7f('0x26')]=moment(_0x1c9c5b[_0xaa7f('0x26')])[_0xaa7f('0x31')](0x1,_0xaa7f('0x32'));}else{_0x1c9c5b[_0xaa7f('0x26')]=moment(_0x1c9c5b[_0xaa7f('0x25')])[_0xaa7f('0x31')](0x1,_0xaa7f('0x32'));}_[_0xaa7f('0x33')](_0x1a700f['where'],{'createdAt':{'$gte':_0x1c9c5b[_0xaa7f('0x25')],'$lte':_0x1c9c5b[_0xaa7f('0x26')]}});}if(_0x1f048b[_0xaa7f('0x24')][_0xaa7f('0x34')]){_0x1a700f['where']=_[_0xaa7f('0x33')](_0x1a700f[_0xaa7f('0x2f')],{'$or':_['map'](_0x1a700f[_0xaa7f('0x28')],function(_0x5f0cb6){var _0x575aa2={};_0x575aa2[_0x5f0cb6]={'$like':'%'+_0x1f048b[_0xaa7f('0x24')][_0xaa7f('0x34')]+'%'};return _0x575aa2;})});}_0x1a700f=_['merge']({},_0x1a700f,_0x1f048b[_0xaa7f('0x35')]);var _0x21390d={'where':_0x1a700f[_0xaa7f('0x2f')]};return db[_0xaa7f('0x20')]['count'](_0x21390d)[_0xaa7f('0x36')](function(_0x25fbbf){_0x9dcd4f[_0xaa7f('0x15')]=_0x25fbbf;if(_0x1f048b[_0xaa7f('0x24')][_0xaa7f('0x37')]){_0x1a700f[_0xaa7f('0x38')]=[{'all':!![]}];}return db[_0xaa7f('0x20')][_0xaa7f('0x39')](_0x1a700f);})[_0xaa7f('0x36')](function(_0x431e12){_0x9dcd4f[_0xaa7f('0x3a')]=_0x431e12;return _0x9dcd4f;})[_0xaa7f('0x36')](respondWithFilteredResult(_0x11fd31,_0x1a700f))['catch'](handleError(_0x11fd31,null));};exports['show']=function(_0x4e7473,_0x46cf22){var _0x5843bb={'raw':!![],'where':{'id':_0x4e7473['params']['id']}},_0x12ce9a={};_0x12ce9a[_0xaa7f('0x22')]=_[_0xaa7f('0x23')](db[_0xaa7f('0x20')][_0xaa7f('0x21')]);_0x12ce9a[_0xaa7f('0x24')]=_[_0xaa7f('0x23')](_0x4e7473[_0xaa7f('0x24')]);_0x12ce9a['filters']=_['intersection'](_0x12ce9a[_0xaa7f('0x22')],_0x12ce9a[_0xaa7f('0x24')]);_0x5843bb[_0xaa7f('0x28')]=_[_0xaa7f('0x29')](_0x12ce9a[_0xaa7f('0x22')],qs[_0xaa7f('0x2a')](_0x4e7473[_0xaa7f('0x24')]['fields']));_0x5843bb[_0xaa7f('0x28')]=_0x5843bb[_0xaa7f('0x28')][_0xaa7f('0x2b')]?_0x5843bb['attributes']:_0x12ce9a[_0xaa7f('0x22')];if(_0x4e7473[_0xaa7f('0x24')][_0xaa7f('0x37')]){_0x5843bb['include']=[{'all':!![]}];}_0x5843bb=_['merge']({},_0x5843bb,_0x4e7473['options']);return db[_0xaa7f('0x20')][_0xaa7f('0x3b')](_0x5843bb)['then'](handleEntityNotFound(_0x46cf22,null))[_0xaa7f('0x36')](respondWithResult(_0x46cf22,null))[_0xaa7f('0x3c')](handleError(_0x46cf22,null));};exports[_0xaa7f('0x3d')]=function(_0x203a55,_0x27b031){return db[_0xaa7f('0x20')]['create'](_0x203a55[_0xaa7f('0x3e')],{})[_0xaa7f('0x36')](respondWithResult(_0x27b031,0xc9))['catch'](handleError(_0x27b031,null));};exports['update']=function(_0x502a9a,_0x5336dc){if(_0x502a9a['body']['id']){delete _0x502a9a[_0xaa7f('0x3e')]['id'];}return db['MailTransferReport'][_0xaa7f('0x3b')]({'where':{'id':_0x502a9a[_0xaa7f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5336dc,null))[_0xaa7f('0x36')](saveUpdates(_0x502a9a['body'],null))[_0xaa7f('0x36')](respondWithResult(_0x5336dc,null))[_0xaa7f('0x3c')](handleError(_0x5336dc,null));};exports[_0xaa7f('0x40')]=function(_0x143ef7,_0x4b53b5){return db['MailTransferReport'][_0xaa7f('0x3b')]({'where':{'id':_0x143ef7[_0xaa7f('0x3f')]['id']}})[_0xaa7f('0x36')](handleEntityNotFound(_0x4b53b5,null))[_0xaa7f('0x36')](removeEntity(_0x4b53b5,null))[_0xaa7f('0x3c')](handleError(_0x4b53b5,null));};exports[_0xaa7f('0x41')]=function(_0xeeac50,_0x159015){return db[_0xaa7f('0x20')][_0xaa7f('0x41')]()['then'](respondWithResult(_0x159015,null))[_0xaa7f('0x3c')](handleError(_0x159015,null));}; \ No newline at end of file +var _0x638d=['map','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','MailTransferReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','filter','merge'];(function(_0x3df871,_0xda2e11){var _0x570f7b=function(_0xfaac78){while(--_0xfaac78){_0x3df871['push'](_0x3df871['shift']());}};_0x570f7b(++_0xda2e11);}(_0x638d,0x126));var _0xd638=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x638d[_0x3dd15e];return _0x231fd0;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xd638('0x0'));var moment=require(_0xd638('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xd638('0x2'));var util=require(_0xd638('0x3'));var path=require('path');var sox=require(_0xd638('0x4'));var csv=require(_0xd638('0x5'));var ejs=require(_0xd638('0x6'));var fs=require('fs');var _=require(_0xd638('0x7'));var squel=require(_0xd638('0x8'));var crypto=require('crypto');var jsforce=require(_0xd638('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xd638('0x5'));var querystring=require(_0xd638('0xa'));var Papa=require(_0xd638('0xb'));var qs=require(_0xd638('0xc'));var logger=require(_0xd638('0xd'))(_0xd638('0xe'));var utils=require('../../config/utils');var config=require(_0xd638('0xf'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b1e82,_0xb95741){_0xb95741=_0xb95741||0xcc;return function(_0x337890){if(_0x337890){return _0x1b1e82[_0xd638('0x10')](_0xb95741);}return _0x1b1e82[_0xd638('0x11')](_0xb95741)[_0xd638('0x12')]();};}function respondWithResult(_0x26da1e,_0x4248ce){_0x4248ce=_0x4248ce||0xc8;return function(_0x397abc){if(_0x397abc){return _0x26da1e[_0xd638('0x11')](_0x4248ce)[_0xd638('0x13')](_0x397abc);}};}function respondWithFilteredResult(_0x326612,_0x3bc14d){return function(_0x2577c8){if(_0x2577c8){var _0x12a5c8=_0x2577c8['count'],_0x477a5f=_0x3bc14d[_0xd638('0x14')],_0x5a55fa=_0x3bc14d[_0xd638('0x14')]+_0x3bc14d[_0xd638('0x15')],_0x224f45;if(_0x5a55fa>=_0x12a5c8){_0x5a55fa=_0x12a5c8;_0x224f45=0xc8;}else{_0x224f45=0xce;}_0x326612['status'](_0x224f45);return _0x326612[_0xd638('0x16')](_0xd638('0x17'),_0x477a5f+'-'+_0x5a55fa+'/'+_0x12a5c8)[_0xd638('0x13')](_0x2577c8);}return null;};}function patchUpdates(_0x1676f6){return function(_0x1349bf){try{jsonpatch[_0xd638('0x18')](_0x1349bf,_0x1676f6,!![]);}catch(_0x5dd24d){return BPromise[_0xd638('0x19')](_0x5dd24d);}return _0x1349bf[_0xd638('0x1a')]();};}function saveUpdates(_0x40c23a,_0x1b6b3e){return function(_0x29aaac){if(_0x29aaac){return _0x29aaac[_0xd638('0x1b')](_0x40c23a)[_0xd638('0x1c')](function(_0x185828){return _0x185828;});}return null;};}function removeEntity(_0x6a663d,_0x1a1959){return function(_0xcb3427){if(_0xcb3427){return _0xcb3427[_0xd638('0x1d')]()[_0xd638('0x1c')](function(){_0x6a663d[_0xd638('0x11')](0xcc)[_0xd638('0x12')]();});}};}function handleEntityNotFound(_0x3497d1,_0x1bbcf7){return function(_0x2093b6){if(!_0x2093b6){_0x3497d1['sendStatus'](0x194);}return _0x2093b6;};}function handleError(_0x222b4e,_0x52b553){_0x52b553=_0x52b553||0x1f4;return function(_0x20ceca){logger[_0xd638('0x1e')](_0x20ceca[_0xd638('0x1f')]);if(_0x20ceca[_0xd638('0x20')]){delete _0x20ceca[_0xd638('0x20')];}_0x222b4e[_0xd638('0x11')](_0x52b553)['send'](_0x20ceca);};}exports[_0xd638('0x21')]=function(_0x5b724c,_0x241a85){var _0x46deff={},_0x1c72a3={},_0x3d7ae3={'count':0x0,'rows':[]};var _0x22d2cd=db[_0xd638('0x22')][_0xd638('0x23')];_0x1c72a3[_0xd638('0x24')]=_[_0xd638('0x25')](_0x22d2cd);var _0x1d3def={'dateStart':_0x5b724c[_0xd638('0x26')][_0xd638('0x27')],'dateEnd':_0x5b724c[_0xd638('0x26')][_0xd638('0x28')]};delete _0x5b724c[_0xd638('0x26')][_0xd638('0x27')];delete _0x5b724c[_0xd638('0x26')][_0xd638('0x28')];_0x1c72a3[_0xd638('0x26')]=_[_0xd638('0x25')](_0x5b724c[_0xd638('0x26')]);_0x1c72a3[_0xd638('0x29')]=_['intersection'](_0x1c72a3[_0xd638('0x24')],_0x1c72a3[_0xd638('0x26')]);_0x46deff[_0xd638('0x2a')]=_[_0xd638('0x2b')](_0x1c72a3[_0xd638('0x24')],qs['fields'](_0x5b724c[_0xd638('0x26')][_0xd638('0x2c')]));_0x46deff[_0xd638('0x2a')]=_0x46deff[_0xd638('0x2a')][_0xd638('0x2d')]?_0x46deff[_0xd638('0x2a')]:_0x1c72a3['model'];if(!_0x5b724c[_0xd638('0x26')][_0xd638('0x2e')](_0xd638('0x2f'))){_0x46deff[_0xd638('0x15')]=qs[_0xd638('0x15')](_0x5b724c['query']['limit']);_0x46deff[_0xd638('0x14')]=qs[_0xd638('0x14')](_0x5b724c[_0xd638('0x26')][_0xd638('0x14')]);}_0x46deff[_0xd638('0x30')]=qs[_0xd638('0x31')](_0x5b724c['query'][_0xd638('0x31')]);_0x46deff[_0xd638('0x32')]=qs['filters'](_[_0xd638('0x33')](_0x5b724c[_0xd638('0x26')],_0x1c72a3['filters']));if(_0x1d3def['dateStart']){if(_0x1d3def[_0xd638('0x28')]){_0x1d3def[_0xd638('0x28')]=moment(_0x1d3def[_0xd638('0x28')])[_0xd638('0x34')](0x1,'day');}else{_0x1d3def[_0xd638('0x28')]=moment(_0x1d3def[_0xd638('0x27')])[_0xd638('0x34')](0x1,_0xd638('0x35'));}_['merge'](_0x46deff[_0xd638('0x32')],{'createdAt':{'$gte':_0x1d3def[_0xd638('0x27')],'$lte':_0x1d3def['dateEnd']}});}if(_0x5b724c['query'][_0xd638('0x36')]){_0x46deff[_0xd638('0x32')]=_[_0xd638('0x37')](_0x46deff[_0xd638('0x32')],{'$or':_[_0xd638('0x38')](_0x46deff['attributes'],function(_0x36f3a2){var _0x3da402={};_0x3da402[_0x36f3a2]={'$like':'%'+_0x5b724c[_0xd638('0x26')][_0xd638('0x36')]+'%'};return _0x3da402;})});}_0x46deff=_[_0xd638('0x37')]({},_0x46deff,_0x5b724c[_0xd638('0x39')]);var _0x2ba99b={'where':_0x46deff[_0xd638('0x32')]};return db[_0xd638('0x22')][_0xd638('0x3a')](_0x2ba99b)[_0xd638('0x1c')](function(_0x16f514){_0x3d7ae3['count']=_0x16f514;if(_0x5b724c[_0xd638('0x26')][_0xd638('0x3b')]){_0x46deff[_0xd638('0x3c')]=[{'all':!![]}];}return db['MailTransferReport'][_0xd638('0x3d')](_0x46deff);})[_0xd638('0x1c')](function(_0x1e4149){_0x3d7ae3[_0xd638('0x3e')]=_0x1e4149;return _0x3d7ae3;})['then'](respondWithFilteredResult(_0x241a85,_0x46deff))[_0xd638('0x3f')](handleError(_0x241a85,null));};exports[_0xd638('0x40')]=function(_0x4a3018,_0x31da5f){var _0xb4d01={'raw':!![],'where':{'id':_0x4a3018[_0xd638('0x41')]['id']}},_0x101a3b={};_0x101a3b[_0xd638('0x24')]=_['keys'](db[_0xd638('0x22')]['rawAttributes']);_0x101a3b[_0xd638('0x26')]=_['keys'](_0x4a3018['query']);_0x101a3b[_0xd638('0x29')]=_[_0xd638('0x2b')](_0x101a3b['model'],_0x101a3b[_0xd638('0x26')]);_0xb4d01[_0xd638('0x2a')]=_[_0xd638('0x2b')](_0x101a3b[_0xd638('0x24')],qs['fields'](_0x4a3018['query'][_0xd638('0x2c')]));_0xb4d01['attributes']=_0xb4d01[_0xd638('0x2a')][_0xd638('0x2d')]?_0xb4d01[_0xd638('0x2a')]:_0x101a3b[_0xd638('0x24')];if(_0x4a3018[_0xd638('0x26')][_0xd638('0x3b')]){_0xb4d01[_0xd638('0x3c')]=[{'all':!![]}];}_0xb4d01=_[_0xd638('0x37')]({},_0xb4d01,_0x4a3018['options']);return db[_0xd638('0x22')][_0xd638('0x42')](_0xb4d01)['then'](handleEntityNotFound(_0x31da5f,null))[_0xd638('0x1c')](respondWithResult(_0x31da5f,null))[_0xd638('0x3f')](handleError(_0x31da5f,null));};exports[_0xd638('0x43')]=function(_0x2a73b0,_0x315f4b){return db[_0xd638('0x22')]['create'](_0x2a73b0[_0xd638('0x44')],{})[_0xd638('0x1c')](respondWithResult(_0x315f4b,0xc9))['catch'](handleError(_0x315f4b,null));};exports[_0xd638('0x1b')]=function(_0x41ea60,_0x554ea2){if(_0x41ea60[_0xd638('0x44')]['id']){delete _0x41ea60[_0xd638('0x44')]['id'];}return db['MailTransferReport'][_0xd638('0x42')]({'where':{'id':_0x41ea60[_0xd638('0x41')]['id']}})['then'](handleEntityNotFound(_0x554ea2,null))[_0xd638('0x1c')](saveUpdates(_0x41ea60[_0xd638('0x44')],null))[_0xd638('0x1c')](respondWithResult(_0x554ea2,null))[_0xd638('0x3f')](handleError(_0x554ea2,null));};exports['destroy']=function(_0x5f5ce5,_0x4bf94f){return db['MailTransferReport'][_0xd638('0x42')]({'where':{'id':_0x5f5ce5[_0xd638('0x41')]['id']}})[_0xd638('0x1c')](handleEntityNotFound(_0x4bf94f,null))['then'](removeEntity(_0x4bf94f,null))[_0xd638('0x3f')](handleError(_0x4bf94f,null));};exports[_0xd638('0x45')]=function(_0x2c398e,_0x1f5edf){return db['MailTransferReport'][_0xd638('0x45')]()[_0xd638('0x1c')](respondWithResult(_0x1f5edf,null))['catch'](handleError(_0x1f5edf,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index c734999..280b450 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 _0x689b=['report_mail_transfer','lodash','util','../../config/logger','api','moment','bluebird','exports','MailTransferReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x689b,0xeb));var _0xb689=function(_0x4ce85e,_0x25c6d7){_0x4ce85e=_0x4ce85e-0x0;var _0x58b8e6=_0x689b[_0x4ce85e];return _0x58b8e6;};'use strict';var _=require(_0xb689('0x0'));var util=require(_0xb689('0x1'));var logger=require(_0xb689('0x2'))(_0xb689('0x3'));var moment=require(_0xb689('0x4'));var BPromise=require(_0xb689('0x5'));var rp=require('request-promise');var attributes=require('./mailTransferReport.attributes');module[_0xb689('0x6')]=function(_0x20f77c,_0x416068){return _0x20f77c['define'](_0xb689('0x7'),attributes,{'tableName':_0xb689('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd677=['uniqueid','api','bluebird','request-promise','./mailTransferReport.attributes','define','report_mail_transfer'];(function(_0x1aade9,_0x2cc816){var _0x240d84=function(_0x25d74b){while(--_0x25d74b){_0x1aade9['push'](_0x1aade9['shift']());}};_0x240d84(++_0x2cc816);}(_0xd677,0x94));var _0x7d67=function(_0x3dca5f,_0x3bf609){_0x3dca5f=_0x3dca5f-0x0;var _0x2ad290=_0xd677[_0x3dca5f];return _0x2ad290;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7d67('0x0'));var moment=require('moment');var BPromise=require(_0x7d67('0x1'));var rp=require(_0x7d67('0x2'));var attributes=require(_0x7d67('0x3'));module['exports']=function(_0x1c79a2,_0x18efd0){return _0x1c79a2[_0x7d67('0x4')]('MailTransferReport',attributes,{'tableName':_0x7d67('0x5'),'paranoid':![],'indexes':[{'name':_0x7d67('0x6'),'fields':[_0x7d67('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 7b9c695..bae131a 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 _0xb77a=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','MailTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x345587,_0x1f2483){var _0x1c0a7e=function(_0x34e277){while(--_0x34e277){_0x345587['push'](_0x345587['shift']());}};_0x1c0a7e(++_0x1f2483);}(_0xb77a,0xd7));var _0xab77=function(_0x282c65,_0x25e173){_0x282c65=_0x282c65-0x0;var _0x1b389f=_0xb77a[_0x282c65];return _0x1b389f;};'use strict';var _=require(_0xab77('0x0'));var util=require(_0xab77('0x1'));var moment=require(_0xab77('0x2'));var BPromise=require(_0xab77('0x3'));var rs=require(_0xab77('0x4'));var fs=require('fs');var db=require(_0xab77('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xab77('0x6'))('rpc');var config=require(_0xab77('0x7'));var jayson=require(_0xab77('0x8'));var client=jayson[_0xab77('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15cf68,_0x3c5aac,_0x13492d){return new BPromise(function(_0x3e4358,_0x2de5fa){return client[_0xab77('0xa')](_0x15cf68,_0x13492d)[_0xab77('0xb')](function(_0x369724){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x3c5aac,_0xab77('0xc'));logger[_0xab77('0xd')](_0xab77('0xe'),_0x3c5aac,_0xab77('0xc'),JSON[_0xab77('0xf')](_0x369724));if(_0x369724['error']){if(_0x369724[_0xab77('0x10')]['code']===0x1f4){logger[_0xab77('0x10')](_0xab77('0x11'),_0x3c5aac,_0x369724[_0xab77('0x10')][_0xab77('0x12')]);return _0x2de5fa(_0x369724['error'][_0xab77('0x12')]);}logger[_0xab77('0x10')](_0xab77('0x11'),_0x3c5aac,_0x369724[_0xab77('0x10')][_0xab77('0x12')]);return _0x3e4358(_0x369724[_0xab77('0x10')][_0xab77('0x12')]);}else{logger[_0xab77('0x13')](_0xab77('0x11'),_0x3c5aac,_0xab77('0xc'));_0x3e4358(_0x369724[_0xab77('0x14')]['message']);}})[_0xab77('0x15')](function(_0x525c3b){logger['error'](_0xab77('0x11'),_0x3c5aac,_0x525c3b);_0x2de5fa(_0x525c3b);});});} \ No newline at end of file +var _0x3080=['request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5eb180,_0x127912){var _0xc5f79c=function(_0x28398a){while(--_0x28398a){_0x5eb180['push'](_0x5eb180['shift']());}};_0xc5f79c(++_0x127912);}(_0x3080,0x14e));var _0x0308=function(_0x202cd8,_0x1bb39b){_0x202cd8=_0x202cd8-0x0;var _0xb77aa7=_0x3080[_0x202cd8];return _0xb77aa7;};'use strict';var _=require(_0x0308('0x0'));var util=require(_0x0308('0x1'));var moment=require(_0x0308('0x2'));var BPromise=require('bluebird');var rs=require(_0x0308('0x3'));var fs=require('fs');var db=require(_0x0308('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0308('0x5'))(_0x0308('0x6'));var config=require(_0x0308('0x7'));var jayson=require(_0x0308('0x8'));var client=jayson[_0x0308('0x9')][_0x0308('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x559017,_0x868d9,_0x3ebacc){return new BPromise(function(_0x52b41d,_0x4658ca){return client[_0x0308('0xb')](_0x559017,_0x3ebacc)[_0x0308('0xc')](function(_0x46a43d){logger[_0x0308('0xd')](_0x0308('0xe'),_0x868d9,_0x0308('0xf'));logger[_0x0308('0x10')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x868d9,_0x0308('0xf'),JSON[_0x0308('0x11')](_0x46a43d));if(_0x46a43d[_0x0308('0x12')]){if(_0x46a43d['error'][_0x0308('0x13')]===0x1f4){logger[_0x0308('0x12')](_0x0308('0xe'),_0x868d9,_0x46a43d[_0x0308('0x12')]['message']);return _0x4658ca(_0x46a43d[_0x0308('0x12')][_0x0308('0x14')]);}logger[_0x0308('0x12')](_0x0308('0xe'),_0x868d9,_0x46a43d['error'][_0x0308('0x14')]);return _0x52b41d(_0x46a43d['error'][_0x0308('0x14')]);}else{logger[_0x0308('0xd')](_0x0308('0xe'),_0x868d9,_0x0308('0xf'));_0x52b41d(_0x46a43d[_0x0308('0x15')][_0x0308('0x14')]);}})[_0x0308('0x16')](function(_0x8fdf85){logger[_0x0308('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x868d9,_0x8fdf85);_0x4658ca(_0x8fdf85);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 0818326..329484d 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 _0x629a=['./memberReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2fd7da,_0x33e2a3){var _0x1eef62=function(_0x3a57b9){while(--_0x3a57b9){_0x2fd7da['push'](_0x2fd7da['shift']());}};_0x1eef62(++_0x33e2a3);}(_0x629a,0x13d));var _0xa629=function(_0x3df9eb,_0x5d1f59){_0x3df9eb=_0x3df9eb-0x0;var _0x41aa0e=_0x629a[_0x3df9eb];return _0x41aa0e;};'use strict';var multer=require(_0xa629('0x0'));var util=require(_0xa629('0x1'));var path=require('path');var express=require(_0xa629('0x2'));var router=express[_0xa629('0x3')]();var auth=require(_0xa629('0x4'));var interaction=require(_0xa629('0x5'));var config=require('../../config/environment');var controller=require(_0xa629('0x6'));router[_0xa629('0x7')]('/',auth[_0xa629('0x8')](),controller[_0xa629('0x9')]);router[_0xa629('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xa629('0xa')]);router[_0xa629('0x7')](_0xa629('0xb'),auth[_0xa629('0x8')](),controller[_0xa629('0xc')]);router[_0xa629('0xd')]('/',auth['isAuthenticated'](),controller[_0xa629('0xe')]);router[_0xa629('0xf')]('/:id',auth[_0xa629('0x8')](),controller[_0xa629('0x10')]);router[_0xa629('0x11')](_0xa629('0xb'),auth[_0xa629('0x8')](),controller['destroy']);module[_0xa629('0x12')]=router; \ No newline at end of file +var _0x1524=['express','../../components/auth/service','./memberReport.controller','get','isAuthenticated','index','/describe','describe','show','put','/:id','delete','destroy','exports','multer','path'];(function(_0x1d266e,_0x2e381e){var _0x1dd4dd=function(_0x156c7e){while(--_0x156c7e){_0x1d266e['push'](_0x1d266e['shift']());}};_0x1dd4dd(++_0x2e381e);}(_0x1524,0x17e));var _0x4152=function(_0x128fcd,_0x59568f){_0x128fcd=_0x128fcd-0x0;var _0x4811ad=_0x1524[_0x128fcd];return _0x4811ad;};'use strict';var multer=require(_0x4152('0x0'));var util=require('util');var path=require(_0x4152('0x1'));var express=require(_0x4152('0x2'));var router=express['Router']();var auth=require(_0x4152('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4152('0x4'));router[_0x4152('0x5')]('/',auth[_0x4152('0x6')](),controller[_0x4152('0x7')]);router[_0x4152('0x5')](_0x4152('0x8'),auth[_0x4152('0x6')](),controller[_0x4152('0x9')]);router['get']('/:id',auth[_0x4152('0x6')](),controller[_0x4152('0xa')]);router['post']('/',auth[_0x4152('0x6')](),controller['create']);router[_0x4152('0xb')](_0x4152('0xc'),auth[_0x4152('0x6')](),controller['update']);router[_0x4152('0xd')](_0x4152('0xc'),auth[_0x4152('0x6')](),controller[_0x4152('0xe')]);module[_0x4152('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 140e450..240dc61 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 _0x25f1=['sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]'];(function(_0x2f63fb,_0x5a9e65){var _0x6e1cae=function(_0x128da3){while(--_0x128da3){_0x2f63fb['push'](_0x2f63fb['shift']());}};_0x6e1cae(++_0x5a9e65);}(_0x25f1,0x132));var _0x125f=function(_0x5380cd,_0x1ea634){_0x5380cd=_0x5380cd-0x0;var _0x25dd61=_0x25f1[_0x5380cd];return _0x25dd61;};'use strict';var Sequelize=require(_0x125f('0x0'));var moment=require(_0x125f('0x1'));module[_0x125f('0x2')]={'channel':{'type':Sequelize[_0x125f('0x3')]},'membername':{'type':Sequelize[_0x125f('0x3')]},'interface':{'type':Sequelize[_0x125f('0x3')]},'type':{'type':Sequelize[_0x125f('0x3')],'defaultValue':_0x125f('0x4'),'comment':_0x125f('0x5')},'duration':{'type':Sequelize[_0x125f('0x6')]},'enterAt':{'type':Sequelize[_0x125f('0x7')]},'exitAt':{'type':Sequelize[_0x125f('0x7')],'set':function(_0x5e2a64){var _0x159c07=moment(_0x5e2a64);var _0x27c9ff=moment(this[_0x125f('0x8')](_0x125f('0x9')));var _0x32a8e8=_0x159c07[_0x125f('0xa')](_0x27c9ff,_0x125f('0xb'));this['setDataValue'](_0x125f('0xc'),_0x5e2a64);this['setDataValue']('duration',_0x32a8e8||null);}},'data1':{'type':Sequelize[_0x125f('0x3')],'comment':_0x125f('0xd')},'data2':{'type':Sequelize[_0x125f('0x3')],'comment':_0x125f('0xe')},'data3':{'type':Sequelize[_0x125f('0x3')],'comment':_0x125f('0xf')},'data4':{'type':Sequelize[_0x125f('0x3')],'comment':_0x125f('0x10')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x125f('0x6')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbe62=['enterAt','diff','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE','DATE'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xbe62,0x163));var _0x2be6=function(_0x132ed2,_0x194515){_0x132ed2=_0x132ed2-0x0;var _0x4e1fee=_0xbe62[_0x132ed2];return _0x4e1fee;};'use strict';var Sequelize=require(_0x2be6('0x0'));var moment=require('moment');module[_0x2be6('0x1')]={'channel':{'type':Sequelize[_0x2be6('0x2')]},'membername':{'type':Sequelize[_0x2be6('0x2')]},'interface':{'type':Sequelize[_0x2be6('0x2')]},'type':{'type':Sequelize[_0x2be6('0x2')],'defaultValue':_0x2be6('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x2be6('0x4')]},'exitAt':{'type':Sequelize[_0x2be6('0x4')],'set':function(_0x13442c){var _0x4d28f8=moment(_0x13442c);var _0x2071bb=moment(this['getDataValue'](_0x2be6('0x5')));var _0x48fbd7=_0x4d28f8[_0x2be6('0x6')](_0x2071bb,'seconds');this[_0x2be6('0x7')](_0x2be6('0x8'),_0x13442c);this['setDataValue'](_0x2be6('0x9'),_0x48fbd7||null);}},'data1':{'type':Sequelize[_0x2be6('0x2')],'comment':_0x2be6('0xa')},'data2':{'type':Sequelize[_0x2be6('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x2be6('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x2be6('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x2be6('0x2')],'comment':_0x2be6('0xb')},'role':{'type':Sequelize[_0x2be6('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 52166f6..7cd8d1e 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 _0x648a=['papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','apply','reject','save','update','then','destroy','error','stack','name','send','MemberReport','rawAttributes','model','query','dateEnd','dateStart','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','pick','add','day','where','merge','map','filter','count','include','findAll','catch','show','params','includeAll','create','body','find','describe','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring'];(function(_0x5e3f72,_0x4f82d7){var _0x105186=function(_0x585b28){while(--_0x585b28){_0x5e3f72['push'](_0x5e3f72['shift']());}};_0x105186(++_0x4f82d7);}(_0x648a,0x13d));var _0xa648=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x648a[_0x4f9b18];return _0x29f20c;};'use strict';var jsonpatch=require(_0xa648('0x0'));var rp=require(_0xa648('0x1'));var moment=require(_0xa648('0x2'));var BPromise=require(_0xa648('0x3'));var Mustache=require('mustache');var util=require(_0xa648('0x4'));var path=require(_0xa648('0x5'));var sox=require(_0xa648('0x6'));var csv=require(_0xa648('0x7'));var ejs=require(_0xa648('0x8'));var fs=require('fs');var _=require(_0xa648('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa648('0xa'));var deskjs=require(_0xa648('0xb'));var toCsv=require(_0xa648('0x7'));var querystring=require(_0xa648('0xc'));var Papa=require(_0xa648('0xd'));var qs=require(_0xa648('0xe'));var logger=require(_0xa648('0xf'))(_0xa648('0x10'));var utils=require(_0xa648('0x11'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21fc11,_0x576c14){_0x576c14=_0x576c14||0xcc;return function(_0x48aa27){if(_0x48aa27){return _0x21fc11[_0xa648('0x12')](_0x576c14);}return _0x21fc11[_0xa648('0x13')](_0x576c14)[_0xa648('0x14')]();};}function respondWithResult(_0xa04163,_0x1161eb){_0x1161eb=_0x1161eb||0xc8;return function(_0x50339c){if(_0x50339c){return _0xa04163[_0xa648('0x13')](_0x1161eb)[_0xa648('0x15')](_0x50339c);}};}function respondWithFilteredResult(_0x944830,_0x5bc636){return function(_0x3ddf00){if(_0x3ddf00){var _0x370395=_0x3ddf00['count'],_0x1801d4=_0x5bc636[_0xa648('0x16')],_0xcb09f=_0x5bc636['offset']+_0x5bc636['limit'],_0x5197bb;if(_0xcb09f>=_0x370395){_0xcb09f=_0x370395;_0x5197bb=0xc8;}else{_0x5197bb=0xce;}_0x944830['status'](_0x5197bb);return _0x944830['set']('Content-Range',_0x1801d4+'-'+_0xcb09f+'/'+_0x370395)[_0xa648('0x15')](_0x3ddf00);}return null;};}function patchUpdates(_0x324cc9){return function(_0x1aa45e){try{jsonpatch[_0xa648('0x17')](_0x1aa45e,_0x324cc9,!![]);}catch(_0x2c2d17){return BPromise[_0xa648('0x18')](_0x2c2d17);}return _0x1aa45e[_0xa648('0x19')]();};}function saveUpdates(_0x532748,_0x2f3a9d){return function(_0x4825d2){if(_0x4825d2){return _0x4825d2[_0xa648('0x1a')](_0x532748)[_0xa648('0x1b')](function(_0x19fde7){return _0x19fde7;});}return null;};}function removeEntity(_0x431c78,_0x12e955){return function(_0x29faae){if(_0x29faae){return _0x29faae[_0xa648('0x1c')]()[_0xa648('0x1b')](function(){_0x431c78[_0xa648('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ed9fa,_0x1e738d){return function(_0x393698){if(!_0x393698){_0x5ed9fa['sendStatus'](0x194);}return _0x393698;};}function handleError(_0x1a6571,_0x2d60ea){_0x2d60ea=_0x2d60ea||0x1f4;return function(_0x1e1f9d){logger[_0xa648('0x1d')](_0x1e1f9d[_0xa648('0x1e')]);if(_0x1e1f9d['name']){delete _0x1e1f9d[_0xa648('0x1f')];}_0x1a6571['status'](_0x2d60ea)[_0xa648('0x20')](_0x1e1f9d);};}exports['index']=function(_0x4f887c,_0x296407){var _0x3c0692={},_0x8fa2db={},_0x2796e2={'count':0x0,'rows':[]};var _0x330172=db[_0xa648('0x21')][_0xa648('0x22')];_0x8fa2db[_0xa648('0x23')]=_['keys'](_0x330172);var _0xa0d8f8={'dateStart':_0x4f887c[_0xa648('0x24')]['dateStart'],'dateEnd':_0x4f887c[_0xa648('0x24')][_0xa648('0x25')]};delete _0x4f887c['query'][_0xa648('0x26')];delete _0x4f887c[_0xa648('0x24')][_0xa648('0x25')];_0x8fa2db[_0xa648('0x24')]=_[_0xa648('0x27')](_0x4f887c[_0xa648('0x24')]);_0x8fa2db[_0xa648('0x28')]=_[_0xa648('0x29')](_0x8fa2db[_0xa648('0x23')],_0x8fa2db['query']);_0x3c0692[_0xa648('0x2a')]=_['intersection'](_0x8fa2db[_0xa648('0x23')],qs['fields'](_0x4f887c[_0xa648('0x24')][_0xa648('0x2b')]));_0x3c0692[_0xa648('0x2a')]=_0x3c0692[_0xa648('0x2a')]['length']?_0x3c0692[_0xa648('0x2a')]:_0x8fa2db[_0xa648('0x23')];if(!_0x4f887c[_0xa648('0x24')][_0xa648('0x2c')](_0xa648('0x2d'))){_0x3c0692[_0xa648('0x2e')]=qs[_0xa648('0x2e')](_0x4f887c[_0xa648('0x24')]['limit']);_0x3c0692['offset']=qs[_0xa648('0x16')](_0x4f887c[_0xa648('0x24')][_0xa648('0x16')]);}_0x3c0692['order']=qs[_0xa648('0x2f')](_0x4f887c[_0xa648('0x24')][_0xa648('0x2f')]);_0x3c0692['where']=qs[_0xa648('0x28')](_[_0xa648('0x30')](_0x4f887c[_0xa648('0x24')],_0x8fa2db[_0xa648('0x28')]));if(_0xa0d8f8[_0xa648('0x26')]){if(_0xa0d8f8['dateEnd']){_0xa0d8f8['dateEnd']=moment(_0xa0d8f8['dateEnd'])[_0xa648('0x31')](0x1,'day');}else{_0xa0d8f8['dateEnd']=moment(_0xa0d8f8[_0xa648('0x26')])['add'](0x1,_0xa648('0x32'));}_['merge'](_0x3c0692[_0xa648('0x33')],{'createdAt':{'$gte':_0xa0d8f8[_0xa648('0x26')],'$lte':_0xa0d8f8['dateEnd']}});}if(_0x4f887c[_0xa648('0x24')]['filter']){_0x3c0692[_0xa648('0x33')]=_[_0xa648('0x34')](_0x3c0692['where'],{'$or':_[_0xa648('0x35')](_0x3c0692[_0xa648('0x2a')],function(_0x493b8e){var _0x35acda={};_0x35acda[_0x493b8e]={'$like':'%'+_0x4f887c[_0xa648('0x24')][_0xa648('0x36')]+'%'};return _0x35acda;})});}_0x3c0692=_[_0xa648('0x34')]({},_0x3c0692,_0x4f887c['options']);var _0x256430={'where':_0x3c0692[_0xa648('0x33')]};return db[_0xa648('0x21')][_0xa648('0x37')](_0x256430)[_0xa648('0x1b')](function(_0x2cf8de){_0x2796e2['count']=_0x2cf8de;if(_0x4f887c[_0xa648('0x24')]['includeAll']){_0x3c0692[_0xa648('0x38')]=[{'all':!![]}];}return db[_0xa648('0x21')][_0xa648('0x39')](_0x3c0692);})[_0xa648('0x1b')](function(_0x14b936){_0x2796e2['rows']=_0x14b936;return _0x2796e2;})[_0xa648('0x1b')](respondWithFilteredResult(_0x296407,_0x3c0692))[_0xa648('0x3a')](handleError(_0x296407,null));};exports[_0xa648('0x3b')]=function(_0x498cd4,_0x156a63){var _0x596a72={'raw':!![],'where':{'id':_0x498cd4[_0xa648('0x3c')]['id']}},_0x2bdf93={};_0x2bdf93[_0xa648('0x23')]=_[_0xa648('0x27')](db['MemberReport']['rawAttributes']);_0x2bdf93[_0xa648('0x24')]=_[_0xa648('0x27')](_0x498cd4[_0xa648('0x24')]);_0x2bdf93['filters']=_[_0xa648('0x29')](_0x2bdf93[_0xa648('0x23')],_0x2bdf93['query']);_0x596a72[_0xa648('0x2a')]=_[_0xa648('0x29')](_0x2bdf93['model'],qs['fields'](_0x498cd4[_0xa648('0x24')]['fields']));_0x596a72[_0xa648('0x2a')]=_0x596a72[_0xa648('0x2a')]['length']?_0x596a72[_0xa648('0x2a')]:_0x2bdf93[_0xa648('0x23')];if(_0x498cd4[_0xa648('0x24')][_0xa648('0x3d')]){_0x596a72[_0xa648('0x38')]=[{'all':!![]}];}_0x596a72=_[_0xa648('0x34')]({},_0x596a72,_0x498cd4['options']);return db[_0xa648('0x21')]['find'](_0x596a72)[_0xa648('0x1b')](handleEntityNotFound(_0x156a63,null))[_0xa648('0x1b')](respondWithResult(_0x156a63,null))[_0xa648('0x3a')](handleError(_0x156a63,null));};exports[_0xa648('0x3e')]=function(_0x3afc20,_0x5e7956){return db[_0xa648('0x21')][_0xa648('0x3e')](_0x3afc20['body'],{})['then'](respondWithResult(_0x5e7956,0xc9))[_0xa648('0x3a')](handleError(_0x5e7956,null));};exports[_0xa648('0x1a')]=function(_0x3eb719,_0x5cb31e){if(_0x3eb719[_0xa648('0x3f')]['id']){delete _0x3eb719['body']['id'];}return db[_0xa648('0x21')][_0xa648('0x40')]({'where':{'id':_0x3eb719[_0xa648('0x3c')]['id']}})[_0xa648('0x1b')](handleEntityNotFound(_0x5cb31e,null))['then'](saveUpdates(_0x3eb719[_0xa648('0x3f')],null))[_0xa648('0x1b')](respondWithResult(_0x5cb31e,null))[_0xa648('0x3a')](handleError(_0x5cb31e,null));};exports['destroy']=function(_0x227af1,_0x38452e){return db[_0xa648('0x21')][_0xa648('0x40')]({'where':{'id':_0x227af1[_0xa648('0x3c')]['id']}})[_0xa648('0x1b')](handleEntityNotFound(_0x38452e,null))[_0xa648('0x1b')](removeEntity(_0x38452e,null))['catch'](handleError(_0x38452e,null));};exports[_0xa648('0x41')]=function(_0x24e6f9,_0x2bf136){return db[_0xa648('0x21')][_0xa648('0x41')]()[_0xa648('0x1b')](respondWithResult(_0x2bf136,null))[_0xa648('0x3a')](handleError(_0x2bf136,null));}; \ No newline at end of file +var _0x3141=['map','options','count','includeAll','include','findAll','rows','catch','params','create','body','find','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','MemberReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3141,0x1b7));var _0x1314=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x3141[_0x2c91e9];return _0x13f0ff;};'use strict';var jsonpatch=require(_0x1314('0x0'));var rp=require(_0x1314('0x1'));var moment=require(_0x1314('0x2'));var BPromise=require(_0x1314('0x3'));var Mustache=require(_0x1314('0x4'));var util=require(_0x1314('0x5'));var path=require(_0x1314('0x6'));var sox=require(_0x1314('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1314('0x8'));var crypto=require(_0x1314('0x9'));var jsforce=require(_0x1314('0xa'));var deskjs=require(_0x1314('0xb'));var toCsv=require(_0x1314('0xc'));var querystring=require(_0x1314('0xd'));var Papa=require(_0x1314('0xe'));var qs=require(_0x1314('0xf'));var logger=require(_0x1314('0x10'))(_0x1314('0x11'));var utils=require('../../config/utils');var config=require(_0x1314('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6dd8be,_0x171f51){_0x171f51=_0x171f51||0xcc;return function(_0x2405c4){if(_0x2405c4){return _0x6dd8be[_0x1314('0x13')](_0x171f51);}return _0x6dd8be[_0x1314('0x14')](_0x171f51)[_0x1314('0x15')]();};}function respondWithResult(_0x449b95,_0x20820f){_0x20820f=_0x20820f||0xc8;return function(_0x3a9979){if(_0x3a9979){return _0x449b95[_0x1314('0x14')](_0x20820f)[_0x1314('0x16')](_0x3a9979);}};}function respondWithFilteredResult(_0x2f1635,_0x25fe4d){return function(_0x32e7e0){if(_0x32e7e0){var _0x32b57b=_0x32e7e0['count'],_0x1808e7=_0x25fe4d[_0x1314('0x17')],_0x41fc27=_0x25fe4d[_0x1314('0x17')]+_0x25fe4d[_0x1314('0x18')],_0x64a258;if(_0x41fc27>=_0x32b57b){_0x41fc27=_0x32b57b;_0x64a258=0xc8;}else{_0x64a258=0xce;}_0x2f1635['status'](_0x64a258);return _0x2f1635[_0x1314('0x19')]('Content-Range',_0x1808e7+'-'+_0x41fc27+'/'+_0x32b57b)[_0x1314('0x16')](_0x32e7e0);}return null;};}function patchUpdates(_0x27b2e8){return function(_0x3af281){try{jsonpatch[_0x1314('0x1a')](_0x3af281,_0x27b2e8,!![]);}catch(_0x2916e0){return BPromise[_0x1314('0x1b')](_0x2916e0);}return _0x3af281[_0x1314('0x1c')]();};}function saveUpdates(_0x595a6f,_0x2e6524){return function(_0x47be1b){if(_0x47be1b){return _0x47be1b[_0x1314('0x1d')](_0x595a6f)[_0x1314('0x1e')](function(_0x5e3f1d){return _0x5e3f1d;});}return null;};}function removeEntity(_0x3537ac,_0x4bd1dd){return function(_0x5e4639){if(_0x5e4639){return _0x5e4639[_0x1314('0x1f')]()[_0x1314('0x1e')](function(){_0x3537ac[_0x1314('0x14')](0xcc)[_0x1314('0x15')]();});}};}function handleEntityNotFound(_0x2b3dba,_0x3f03e4){return function(_0x110e6b){if(!_0x110e6b){_0x2b3dba[_0x1314('0x13')](0x194);}return _0x110e6b;};}function handleError(_0x51e259,_0x1e981f){_0x1e981f=_0x1e981f||0x1f4;return function(_0x6f703e){logger['error'](_0x6f703e[_0x1314('0x20')]);if(_0x6f703e[_0x1314('0x21')]){delete _0x6f703e['name'];}_0x51e259[_0x1314('0x14')](_0x1e981f)[_0x1314('0x22')](_0x6f703e);};}exports[_0x1314('0x23')]=function(_0x2f9165,_0x2f7145){var _0x3e8241={},_0x1e3df2={},_0x2ad15b={'count':0x0,'rows':[]};var _0x52a449=db[_0x1314('0x24')][_0x1314('0x25')];_0x1e3df2[_0x1314('0x26')]=_[_0x1314('0x27')](_0x52a449);var _0xe69da3={'dateStart':_0x2f9165[_0x1314('0x28')][_0x1314('0x29')],'dateEnd':_0x2f9165[_0x1314('0x28')][_0x1314('0x2a')]};delete _0x2f9165['query'][_0x1314('0x29')];delete _0x2f9165['query'][_0x1314('0x2a')];_0x1e3df2[_0x1314('0x28')]=_[_0x1314('0x27')](_0x2f9165[_0x1314('0x28')]);_0x1e3df2[_0x1314('0x2b')]=_[_0x1314('0x2c')](_0x1e3df2['model'],_0x1e3df2['query']);_0x3e8241[_0x1314('0x2d')]=_[_0x1314('0x2c')](_0x1e3df2[_0x1314('0x26')],qs[_0x1314('0x2e')](_0x2f9165[_0x1314('0x28')][_0x1314('0x2e')]));_0x3e8241[_0x1314('0x2d')]=_0x3e8241['attributes'][_0x1314('0x2f')]?_0x3e8241[_0x1314('0x2d')]:_0x1e3df2['model'];if(!_0x2f9165[_0x1314('0x28')][_0x1314('0x30')](_0x1314('0x31'))){_0x3e8241['limit']=qs[_0x1314('0x18')](_0x2f9165[_0x1314('0x28')][_0x1314('0x18')]);_0x3e8241[_0x1314('0x17')]=qs[_0x1314('0x17')](_0x2f9165[_0x1314('0x28')][_0x1314('0x17')]);}_0x3e8241[_0x1314('0x32')]=qs[_0x1314('0x33')](_0x2f9165[_0x1314('0x28')][_0x1314('0x33')]);_0x3e8241[_0x1314('0x34')]=qs[_0x1314('0x2b')](_[_0x1314('0x35')](_0x2f9165['query'],_0x1e3df2[_0x1314('0x2b')]));if(_0xe69da3[_0x1314('0x29')]){if(_0xe69da3[_0x1314('0x2a')]){_0xe69da3[_0x1314('0x2a')]=moment(_0xe69da3[_0x1314('0x2a')])[_0x1314('0x36')](0x1,'day');}else{_0xe69da3['dateEnd']=moment(_0xe69da3[_0x1314('0x29')])[_0x1314('0x36')](0x1,_0x1314('0x37'));}_[_0x1314('0x38')](_0x3e8241[_0x1314('0x34')],{'createdAt':{'$gte':_0xe69da3[_0x1314('0x29')],'$lte':_0xe69da3['dateEnd']}});}if(_0x2f9165[_0x1314('0x28')][_0x1314('0x39')]){_0x3e8241[_0x1314('0x34')]=_['merge'](_0x3e8241[_0x1314('0x34')],{'$or':_[_0x1314('0x3a')](_0x3e8241[_0x1314('0x2d')],function(_0x57fada){var _0x2446a7={};_0x2446a7[_0x57fada]={'$like':'%'+_0x2f9165[_0x1314('0x28')][_0x1314('0x39')]+'%'};return _0x2446a7;})});}_0x3e8241=_['merge']({},_0x3e8241,_0x2f9165[_0x1314('0x3b')]);var _0x1a3eb6={'where':_0x3e8241[_0x1314('0x34')]};return db[_0x1314('0x24')]['count'](_0x1a3eb6)[_0x1314('0x1e')](function(_0x2cd70d){_0x2ad15b[_0x1314('0x3c')]=_0x2cd70d;if(_0x2f9165[_0x1314('0x28')][_0x1314('0x3d')]){_0x3e8241[_0x1314('0x3e')]=[{'all':!![]}];}return db[_0x1314('0x24')][_0x1314('0x3f')](_0x3e8241);})[_0x1314('0x1e')](function(_0x19481a){_0x2ad15b[_0x1314('0x40')]=_0x19481a;return _0x2ad15b;})[_0x1314('0x1e')](respondWithFilteredResult(_0x2f7145,_0x3e8241))[_0x1314('0x41')](handleError(_0x2f7145,null));};exports['show']=function(_0x1feddf,_0x47bada){var _0x59870b={'raw':!![],'where':{'id':_0x1feddf[_0x1314('0x42')]['id']}},_0x14b6e6={};_0x14b6e6['model']=_[_0x1314('0x27')](db[_0x1314('0x24')][_0x1314('0x25')]);_0x14b6e6[_0x1314('0x28')]=_[_0x1314('0x27')](_0x1feddf[_0x1314('0x28')]);_0x14b6e6[_0x1314('0x2b')]=_[_0x1314('0x2c')](_0x14b6e6['model'],_0x14b6e6['query']);_0x59870b[_0x1314('0x2d')]=_['intersection'](_0x14b6e6[_0x1314('0x26')],qs[_0x1314('0x2e')](_0x1feddf['query'][_0x1314('0x2e')]));_0x59870b[_0x1314('0x2d')]=_0x59870b[_0x1314('0x2d')][_0x1314('0x2f')]?_0x59870b[_0x1314('0x2d')]:_0x14b6e6[_0x1314('0x26')];if(_0x1feddf[_0x1314('0x28')][_0x1314('0x3d')]){_0x59870b[_0x1314('0x3e')]=[{'all':!![]}];}_0x59870b=_[_0x1314('0x38')]({},_0x59870b,_0x1feddf[_0x1314('0x3b')]);return db['MemberReport']['find'](_0x59870b)[_0x1314('0x1e')](handleEntityNotFound(_0x47bada,null))[_0x1314('0x1e')](respondWithResult(_0x47bada,null))[_0x1314('0x41')](handleError(_0x47bada,null));};exports[_0x1314('0x43')]=function(_0x38d646,_0x21e9b4){return db[_0x1314('0x24')]['create'](_0x38d646['body'],{})[_0x1314('0x1e')](respondWithResult(_0x21e9b4,0xc9))['catch'](handleError(_0x21e9b4,null));};exports['update']=function(_0xcd1b04,_0x1e4f70){if(_0xcd1b04[_0x1314('0x44')]['id']){delete _0xcd1b04[_0x1314('0x44')]['id'];}return db[_0x1314('0x24')]['find']({'where':{'id':_0xcd1b04[_0x1314('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e4f70,null))['then'](saveUpdates(_0xcd1b04[_0x1314('0x44')],null))['then'](respondWithResult(_0x1e4f70,null))[_0x1314('0x41')](handleError(_0x1e4f70,null));};exports[_0x1314('0x1f')]=function(_0x45ed55,_0x3018a0){return db[_0x1314('0x24')][_0x1314('0x45')]({'where':{'id':_0x45ed55[_0x1314('0x42')]['id']}})[_0x1314('0x1e')](handleEntityNotFound(_0x3018a0,null))[_0x1314('0x1e')](removeEntity(_0x3018a0,null))[_0x1314('0x41')](handleError(_0x3018a0,null));};exports[_0x1314('0x46')]=function(_0x1572ce,_0x26cc44){return db[_0x1314('0x24')][_0x1314('0x46')]()[_0x1314('0x1e')](respondWithResult(_0x26cc44,null))[_0x1314('0x41')](handleError(_0x26cc44,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 7be027a..c69d769 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 _0xd9f5=['../../config/logger','api','bluebird','request-promise','./memberReport.attributes','exports','MemberReport','membername_interface','membername','interface','util'];(function(_0x2b92cb,_0x551063){var _0x49a836=function(_0x2f1977){while(--_0x2f1977){_0x2b92cb['push'](_0x2b92cb['shift']());}};_0x49a836(++_0x551063);}(_0xd9f5,0x1e3));var _0x5d9f=function(_0x25fded,_0x34216e){_0x25fded=_0x25fded-0x0;var _0x269156=_0xd9f5[_0x25fded];return _0x269156;};'use strict';var _=require('lodash');var util=require(_0x5d9f('0x0'));var logger=require(_0x5d9f('0x1'))(_0x5d9f('0x2'));var moment=require('moment');var BPromise=require(_0x5d9f('0x3'));var rp=require(_0x5d9f('0x4'));var attributes=require(_0x5d9f('0x5'));module[_0x5d9f('0x6')]=function(_0x1991d9,_0x29677f){return _0x1991d9['define'](_0x5d9f('0x7'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x5d9f('0x8'),'fields':[_0x5d9f('0x9'),_0x5d9f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3382=['membername_interface','membername','interface','util','../../config/logger','api','moment','bluebird','request-promise','./memberReport.attributes','exports','define','report_member'];(function(_0x12ac41,_0x416f99){var _0x41f4f2=function(_0x2bfc5b){while(--_0x2bfc5b){_0x12ac41['push'](_0x12ac41['shift']());}};_0x41f4f2(++_0x416f99);}(_0x3382,0x162));var _0x2338=function(_0x3e7471,_0x3b8286){_0x3e7471=_0x3e7471-0x0;var _0x16d829=_0x3382[_0x3e7471];return _0x16d829;};'use strict';var _=require('lodash');var util=require(_0x2338('0x0'));var logger=require(_0x2338('0x1'))(_0x2338('0x2'));var moment=require(_0x2338('0x3'));var BPromise=require(_0x2338('0x4'));var rp=require(_0x2338('0x5'));var attributes=require(_0x2338('0x6'));module[_0x2338('0x7')]=function(_0x15b272,_0x2ba915){return _0x15b272[_0x2338('0x8')]('MemberReport',attributes,{'tableName':_0x2338('0x9'),'paranoid':![],'indexes':[{'name':_0x2338('0xa'),'fields':[_0x2338('0xb'),_0x2338('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 1c236d4..b1b0e48 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 _0xa6be=['error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','map','include','model','CreateMemberReport','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4c466d,_0x11ee15){var _0x580ca5=function(_0x176110){while(--_0x176110){_0x4c466d['push'](_0x4c466d['shift']());}};_0x580ca5(++_0x11ee15);}(_0xa6be,0xab));var _0xea6b=function(_0x7cb569,_0x5e872f){_0x7cb569=_0x7cb569-0x0;var _0x7d6da7=_0xa6be[_0x7cb569];return _0x7d6da7;};'use strict';var _=require(_0xea6b('0x0'));var util=require(_0xea6b('0x1'));var moment=require(_0xea6b('0x2'));var BPromise=require(_0xea6b('0x3'));var rs=require(_0xea6b('0x4'));var fs=require('fs');var db=require(_0xea6b('0x5'))['db'];var utils=require(_0xea6b('0x6'));var logger=require(_0xea6b('0x7'))(_0xea6b('0x8'));var config=require(_0xea6b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xea6b('0xa')][_0xea6b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x75b2e,_0x52de9e,_0x36c621){return new BPromise(function(_0x38f84f,_0x291f0a){return client['request'](_0x75b2e,_0x36c621)[_0xea6b('0xc')](function(_0xb19431){logger[_0xea6b('0xd')](_0xea6b('0xe'),_0x52de9e,_0xea6b('0xf'));logger[_0xea6b('0x10')](_0xea6b('0x11'),_0x52de9e,_0xea6b('0xf'),JSON[_0xea6b('0x12')](_0xb19431));if(_0xb19431[_0xea6b('0x13')]){if(_0xb19431[_0xea6b('0x13')][_0xea6b('0x14')]===0x1f4){logger[_0xea6b('0x13')](_0xea6b('0xe'),_0x52de9e,_0xb19431['error']['message']);return _0x291f0a(_0xb19431[_0xea6b('0x13')]['message']);}logger['error'](_0xea6b('0xe'),_0x52de9e,_0xb19431[_0xea6b('0x13')][_0xea6b('0x15')]);return _0x38f84f(_0xb19431[_0xea6b('0x13')]['message']);}else{logger[_0xea6b('0xd')](_0xea6b('0xe'),_0x52de9e,_0xea6b('0xf'));_0x38f84f(_0xb19431[_0xea6b('0x16')]['message']);}})[_0xea6b('0x17')](function(_0x107877){logger['error'](_0xea6b('0xe'),_0x52de9e,_0x107877);_0x291f0a(_0x107877);});});}exports[_0xea6b('0x18')]=function(_0x2e53cc){var _0x5eedb6=this;return new Promise(function(_0xa2789f,_0x53aec1){return db[_0xea6b('0x19')][_0xea6b('0x1a')]({'raw':_0x2e53cc[_0xea6b('0x1b')]?_0x2e53cc[_0xea6b('0x1b')][_0xea6b('0x1c')]===undefined?!![]:![]:!![],'where':_0x2e53cc[_0xea6b('0x1b')]?_0x2e53cc[_0xea6b('0x1b')][_0xea6b('0x1d')]||null:null,'attributes':_0x2e53cc[_0xea6b('0x1b')]?_0x2e53cc['options'][_0xea6b('0x1e')]||null:null,'limit':_0x2e53cc[_0xea6b('0x1b')]?_0x2e53cc[_0xea6b('0x1b')][_0xea6b('0x1f')]||null:null,'include':_0x2e53cc[_0xea6b('0x1b')]?_0x2e53cc['options']['include']?_[_0xea6b('0x20')](_0x2e53cc[_0xea6b('0x1b')][_0xea6b('0x21')],function(_0x1ea965){return{'model':db[_0x1ea965[_0xea6b('0x22')]],'as':_0x1ea965['as'],'attributes':_0x1ea965[_0xea6b('0x1e')],'include':_0x1ea965['include']?_[_0xea6b('0x20')](_0x1ea965[_0xea6b('0x21')],function(_0x4b33db){return{'model':db[_0x4b33db[_0xea6b('0x22')]],'as':_0x4b33db['as'],'attributes':_0x4b33db[_0xea6b('0x1e')],'include':_0x4b33db[_0xea6b('0x21')]?_['map'](_0x4b33db[_0xea6b('0x21')],function(_0x516ba8){return{'model':db[_0x516ba8[_0xea6b('0x22')]],'as':_0x516ba8['as'],'attributes':_0x516ba8[_0xea6b('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x58ddd8){logger[_0xea6b('0xd')](_0xea6b('0x18'),_0x2e53cc);logger[_0xea6b('0x10')](_0xea6b('0x18'),_0x2e53cc,JSON['stringify'](_0x58ddd8));_0xa2789f(_0x58ddd8);})['catch'](function(_0x3a9a5c){logger[_0xea6b('0x13')](_0xea6b('0x18'),_0x3a9a5c[_0xea6b('0x15')],_0x2e53cc);_0x53aec1(_0x5eedb6[_0xea6b('0x13')](0x1f4,_0x3a9a5c[_0xea6b('0x15')]));});});};exports[_0xea6b('0x23')]=function(_0x47d301){var _0x846d21=this;return new Promise(function(_0x5dacd4,_0x3feb71){return db[_0xea6b('0x19')]['create'](_0x47d301['body'],{'raw':_0x47d301[_0xea6b('0x1b')]?_0x47d301['options'][_0xea6b('0x1c')]===undefined?!![]:![]:!![]})[_0xea6b('0xc')](function(_0x2f6f13){logger[_0xea6b('0xd')](_0xea6b('0x23'),_0x47d301);logger[_0xea6b('0x10')](_0xea6b('0x23'),_0x47d301,JSON[_0xea6b('0x12')](_0x2f6f13));_0x5dacd4(_0x2f6f13);})[_0xea6b('0x17')](function(_0x29d7b4){logger['error'](_0xea6b('0x23'),_0x29d7b4[_0xea6b('0x15')],_0x47d301);_0x3feb71(_0x846d21[_0xea6b('0x13')](0x1f4,_0x29d7b4[_0xea6b('0x15')]));});});};exports[_0xea6b('0x24')]=function(_0x47b911){var _0x2e1137=this;return new Promise(function(_0x5d84d9,_0x565fa2){return db[_0xea6b('0x19')][_0xea6b('0x25')](_0x47b911['body'],{'raw':_0x47b911[_0xea6b('0x1b')]?_0x47b911[_0xea6b('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47b911['options']?_0x47b911[_0xea6b('0x1b')][_0xea6b('0x1d')]||null:null,'attributes':_0x47b911[_0xea6b('0x1b')]?_0x47b911['options'][_0xea6b('0x1e')]||null:null,'limit':_0x47b911[_0xea6b('0x1b')]?_0x47b911[_0xea6b('0x1b')][_0xea6b('0x1f')]||null:null})[_0xea6b('0xc')](function(_0x20977d){logger[_0xea6b('0xd')](_0xea6b('0x24'),_0x47b911);logger[_0xea6b('0x10')](_0xea6b('0x24'),_0x47b911,JSON['stringify'](_0x20977d));_0x5d84d9(_0x20977d);})['catch'](function(_0x5099fa){logger['error']('UpdateMemberReport',_0x5099fa['message'],_0x47b911);_0x565fa2(_0x2e1137['error'](0x1f4,_0x5099fa[_0xea6b('0x15')]));});});}; \ No newline at end of file +var _0xa553=['rpc','../../config/environment','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMemberReport','findAll','options','raw','attributes','limit','include','map','model','debug','CreateMemberReport','MemberReport','create','body','UpdateMemberReport','update','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x23a51b,_0x49f2b0){var _0x9e31c=function(_0x573151){while(--_0x573151){_0x23a51b['push'](_0x23a51b['shift']());}};_0x9e31c(++_0x49f2b0);}(_0xa553,0x158));var _0x3a55=function(_0x3b2ff2,_0x4033af){_0x3b2ff2=_0x3b2ff2-0x0;var _0x396e7a=_0xa553[_0x3b2ff2];return _0x396e7a;};'use strict';var _=require(_0x3a55('0x0'));var util=require(_0x3a55('0x1'));var moment=require(_0x3a55('0x2'));var BPromise=require(_0x3a55('0x3'));var rs=require(_0x3a55('0x4'));var fs=require('fs');var db=require(_0x3a55('0x5'))['db'];var utils=require(_0x3a55('0x6'));var logger=require('../../config/logger')(_0x3a55('0x7'));var config=require(_0x3a55('0x8'));var jayson=require(_0x3a55('0x9'));var client=jayson[_0x3a55('0xa')][_0x3a55('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x488937,_0x4fd97a,_0x657a8c){return new BPromise(function(_0x17a451,_0x218ccb){return client[_0x3a55('0xc')](_0x488937,_0x657a8c)['then'](function(_0x54585e){logger[_0x3a55('0xd')](_0x3a55('0xe'),_0x4fd97a,_0x3a55('0xf'));logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x4fd97a,'request\x20sent',JSON[_0x3a55('0x10')](_0x54585e));if(_0x54585e[_0x3a55('0x11')]){if(_0x54585e[_0x3a55('0x11')][_0x3a55('0x12')]===0x1f4){logger[_0x3a55('0x11')](_0x3a55('0xe'),_0x4fd97a,_0x54585e[_0x3a55('0x11')][_0x3a55('0x13')]);return _0x218ccb(_0x54585e[_0x3a55('0x11')][_0x3a55('0x13')]);}logger[_0x3a55('0x11')](_0x3a55('0xe'),_0x4fd97a,_0x54585e['error']['message']);return _0x17a451(_0x54585e[_0x3a55('0x11')][_0x3a55('0x13')]);}else{logger[_0x3a55('0xd')](_0x3a55('0xe'),_0x4fd97a,_0x3a55('0xf'));_0x17a451(_0x54585e[_0x3a55('0x14')][_0x3a55('0x13')]);}})[_0x3a55('0x15')](function(_0x300d3a){logger[_0x3a55('0x11')](_0x3a55('0xe'),_0x4fd97a,_0x300d3a);_0x218ccb(_0x300d3a);});});}exports[_0x3a55('0x16')]=function(_0x31c871){var _0x335747=this;return new Promise(function(_0x3914cf,_0x510702){return db['MemberReport'][_0x3a55('0x17')]({'raw':_0x31c871[_0x3a55('0x18')]?_0x31c871['options'][_0x3a55('0x19')]===undefined?!![]:![]:!![],'where':_0x31c871[_0x3a55('0x18')]?_0x31c871[_0x3a55('0x18')]['where']||null:null,'attributes':_0x31c871['options']?_0x31c871[_0x3a55('0x18')][_0x3a55('0x1a')]||null:null,'limit':_0x31c871[_0x3a55('0x18')]?_0x31c871[_0x3a55('0x18')][_0x3a55('0x1b')]||null:null,'include':_0x31c871[_0x3a55('0x18')]?_0x31c871[_0x3a55('0x18')][_0x3a55('0x1c')]?_[_0x3a55('0x1d')](_0x31c871['options'][_0x3a55('0x1c')],function(_0x4687d9){return{'model':db[_0x4687d9[_0x3a55('0x1e')]],'as':_0x4687d9['as'],'attributes':_0x4687d9[_0x3a55('0x1a')],'include':_0x4687d9['include']?_['map'](_0x4687d9['include'],function(_0x102596){return{'model':db[_0x102596[_0x3a55('0x1e')]],'as':_0x102596['as'],'attributes':_0x102596[_0x3a55('0x1a')],'include':_0x102596[_0x3a55('0x1c')]?_[_0x3a55('0x1d')](_0x102596[_0x3a55('0x1c')],function(_0x4a74c7){return{'model':db[_0x4a74c7['model']],'as':_0x4a74c7['as'],'attributes':_0x4a74c7[_0x3a55('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb1097){logger[_0x3a55('0xd')]('GetMemberReport',_0x31c871);logger[_0x3a55('0x1f')](_0x3a55('0x16'),_0x31c871,JSON[_0x3a55('0x10')](_0xb1097));_0x3914cf(_0xb1097);})[_0x3a55('0x15')](function(_0x119792){logger[_0x3a55('0x11')](_0x3a55('0x16'),_0x119792[_0x3a55('0x13')],_0x31c871);_0x510702(_0x335747[_0x3a55('0x11')](0x1f4,_0x119792[_0x3a55('0x13')]));});});};exports[_0x3a55('0x20')]=function(_0x262aab){var _0x41d8bc=this;return new Promise(function(_0x8f9ac0,_0x4168a9){return db[_0x3a55('0x21')][_0x3a55('0x22')](_0x262aab[_0x3a55('0x23')],{'raw':_0x262aab[_0x3a55('0x18')]?_0x262aab[_0x3a55('0x18')][_0x3a55('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x42001b){logger['info']('CreateMemberReport',_0x262aab);logger[_0x3a55('0x1f')](_0x3a55('0x20'),_0x262aab,JSON[_0x3a55('0x10')](_0x42001b));_0x8f9ac0(_0x42001b);})[_0x3a55('0x15')](function(_0x963d8c){logger['error'](_0x3a55('0x20'),_0x963d8c[_0x3a55('0x13')],_0x262aab);_0x4168a9(_0x41d8bc[_0x3a55('0x11')](0x1f4,_0x963d8c[_0x3a55('0x13')]));});});};exports[_0x3a55('0x24')]=function(_0x23f73d){var _0x22cda4=this;return new Promise(function(_0x1e32bf,_0xb2cfa1){return db[_0x3a55('0x21')][_0x3a55('0x25')](_0x23f73d['body'],{'raw':_0x23f73d[_0x3a55('0x18')]?_0x23f73d[_0x3a55('0x18')][_0x3a55('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23f73d[_0x3a55('0x18')]?_0x23f73d[_0x3a55('0x18')][_0x3a55('0x26')]||null:null,'attributes':_0x23f73d[_0x3a55('0x18')]?_0x23f73d[_0x3a55('0x18')][_0x3a55('0x1a')]||null:null,'limit':_0x23f73d[_0x3a55('0x18')]?_0x23f73d[_0x3a55('0x18')][_0x3a55('0x1b')]||null:null})['then'](function(_0x402e07){logger['info'](_0x3a55('0x24'),_0x23f73d);logger[_0x3a55('0x1f')](_0x3a55('0x24'),_0x23f73d,JSON[_0x3a55('0x10')](_0x402e07));_0x1e32bf(_0x402e07);})[_0x3a55('0x15')](function(_0x1ee2c1){logger[_0x3a55('0x11')](_0x3a55('0x24'),_0x1ee2c1[_0x3a55('0x13')],_0x23f73d);_0xb2cfa1(_0x22cda4[_0x3a55('0x11')](0x1f4,_0x1ee2c1[_0x3a55('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 49001b8..3852f10 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 _0x6317=['../../components/interaction/service','../../config/environment','./migration.controller','get','multer','util','express','Router','../../components/auth/service'];(function(_0x3d43aa,_0xc0892){var _0x38dd59=function(_0xa10673){while(--_0xa10673){_0x3d43aa['push'](_0x3d43aa['shift']());}};_0x38dd59(++_0xc0892);}(_0x6317,0xf7));var _0x7631=function(_0x58f5aa,_0x2278fb){_0x58f5aa=_0x58f5aa-0x0;var _0x1129e3=_0x6317[_0x58f5aa];return _0x1129e3;};'use strict';var multer=require(_0x7631('0x0'));var util=require(_0x7631('0x1'));var path=require('path');var express=require(_0x7631('0x2'));var router=express[_0x7631('0x3')]();var auth=require(_0x7631('0x4'));var interaction=require(_0x7631('0x5'));var config=require(_0x7631('0x6'));var controller=require(_0x7631('0x7'));router[_0x7631('0x8')]('/',controller['index']);module['exports']=router; \ No newline at end of file +var _0xd498=['multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./migration.controller','get','index'];(function(_0x36b381,_0x374c5c){var _0x1d32fc=function(_0x40ca61){while(--_0x40ca61){_0x36b381['push'](_0x36b381['shift']());}};_0x1d32fc(++_0x374c5c);}(_0xd498,0xaa));var _0x8d49=function(_0x3bf925,_0x4dd8e4){_0x3bf925=_0x3bf925-0x0;var _0x2128a1=_0xd498[_0x3bf925];return _0x2128a1;};'use strict';var multer=require(_0x8d49('0x0'));var util=require(_0x8d49('0x1'));var path=require(_0x8d49('0x2'));var express=require(_0x8d49('0x3'));var router=express[_0x8d49('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8d49('0x5'));var config=require(_0x8d49('0x6'));var controller=require(_0x8d49('0x7'));router[_0x8d49('0x8')]('/',controller[_0x8d49('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 7b5b02d..8e897a5 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 _0x6acc=['exports','STRING','sequelize'];(function(_0x51171b,_0x452147){var _0xcc8a63=function(_0x923eb6){while(--_0x923eb6){_0x51171b['push'](_0x51171b['shift']());}};_0xcc8a63(++_0x452147);}(_0x6acc,0x167));var _0xc6ac=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x6acc[_0x39c734];return _0xb2a2f9;};'use strict';var Sequelize=require(_0xc6ac('0x0'));module[_0xc6ac('0x1')]={'version':{'type':Sequelize[_0xc6ac('0x2')],'primaryKey':!![],'autoIncrement':![]}}; \ No newline at end of file +var _0xcf9f=['sequelize','exports'];(function(_0x11de5c,_0x2f639f){var _0x12ed01=function(_0x49e3c9){while(--_0x49e3c9){_0x11de5c['push'](_0x11de5c['shift']());}};_0x12ed01(++_0x2f639f);}(_0xcf9f,0x178));var _0xfcf9=function(_0x918eb4,_0x1e2eca){_0x918eb4=_0x918eb4-0x0;var _0x5b07db=_0xcf9f[_0x918eb4];return _0x5b07db;};'use strict';var Sequelize=require(_0xfcf9('0x0'));module[_0xfcf9('0x1')]={'version':{'type':Sequelize['STRING'],'primaryKey':!![],'autoIncrement':![]}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index ca3b52b..3da51ef 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 _0xf198=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','set','json','apply','reject','save','update','then','error','stack','name','index','Migration','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','day','add','merge','filter','options','count','includeAll','include','findAll','catch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x15be66,_0x3a86c1){var _0x1d5d87=function(_0x4dd8d0){while(--_0x4dd8d0){_0x15be66['push'](_0x15be66['shift']());}};_0x1d5d87(++_0x3a86c1);}(_0xf198,0x126));var _0x8f19=function(_0xff84e0,_0x140f53){_0xff84e0=_0xff84e0-0x0;var _0x52973a=_0xf198[_0xff84e0];return _0x52973a;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x8f19('0x0'));var moment=require(_0x8f19('0x1'));var BPromise=require(_0x8f19('0x2'));var Mustache=require(_0x8f19('0x3'));var util=require(_0x8f19('0x4'));var path=require(_0x8f19('0x5'));var sox=require(_0x8f19('0x6'));var csv=require('to-csv');var ejs=require(_0x8f19('0x7'));var fs=require('fs');var _=require(_0x8f19('0x8'));var squel=require(_0x8f19('0x9'));var crypto=require(_0x8f19('0xa'));var jsforce=require(_0x8f19('0xb'));var deskjs=require(_0x8f19('0xc'));var toCsv=require(_0x8f19('0xd'));var querystring=require(_0x8f19('0xe'));var Papa=require(_0x8f19('0xf'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0x8f19('0x10'));var config=require(_0x8f19('0x11'));var db=require(_0x8f19('0x12'))['db'];function respondWithStatusCode(_0x39aa6b,_0x4f62a6){_0x4f62a6=_0x4f62a6||0xcc;return function(_0x4bc1dd){if(_0x4bc1dd){return _0x39aa6b[_0x8f19('0x13')](_0x4f62a6);}return _0x39aa6b[_0x8f19('0x14')](_0x4f62a6)[_0x8f19('0x15')]();};}function respondWithResult(_0x584f08,_0x54dd1e){_0x54dd1e=_0x54dd1e||0xc8;return function(_0x2d5f22){if(_0x2d5f22){return _0x584f08['status'](_0x54dd1e)['json'](_0x2d5f22);}};}function respondWithFilteredResult(_0x43214e,_0x3da188){return function(_0x205a02){if(_0x205a02){var _0x5eaff9=_0x205a02['count'],_0xa23246=_0x3da188[_0x8f19('0x16')],_0x2c170c=_0x3da188[_0x8f19('0x16')]+_0x3da188['limit'],_0x3ce4f7;if(_0x2c170c>=_0x5eaff9){_0x2c170c=_0x5eaff9;_0x3ce4f7=0xc8;}else{_0x3ce4f7=0xce;}_0x43214e[_0x8f19('0x14')](_0x3ce4f7);return _0x43214e[_0x8f19('0x17')]('Content-Range',_0xa23246+'-'+_0x2c170c+'/'+_0x5eaff9)[_0x8f19('0x18')](_0x205a02);}return null;};}function patchUpdates(_0x3f3bbb){return function(_0x27a744){try{jsonpatch[_0x8f19('0x19')](_0x27a744,_0x3f3bbb,!![]);}catch(_0x4fabad){return BPromise[_0x8f19('0x1a')](_0x4fabad);}return _0x27a744[_0x8f19('0x1b')]();};}function saveUpdates(_0x200da7,_0x41bf37){return function(_0x3b3f69){if(_0x3b3f69){return _0x3b3f69[_0x8f19('0x1c')](_0x200da7)[_0x8f19('0x1d')](function(_0x4d66ac){return _0x4d66ac;});}return null;};}function removeEntity(_0x4211a3,_0x6e48e4){return function(_0xb60787){if(_0xb60787){return _0xb60787['destroy']()[_0x8f19('0x1d')](function(){_0x4211a3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x465d98,_0x4cac9d){return function(_0x3fc4b8){if(!_0x3fc4b8){_0x465d98[_0x8f19('0x13')](0x194);}return _0x3fc4b8;};}function handleError(_0x35f417,_0x3d8d15){_0x3d8d15=_0x3d8d15||0x1f4;return function(_0x40b49){logger[_0x8f19('0x1e')](_0x40b49[_0x8f19('0x1f')]);if(_0x40b49['name']){delete _0x40b49[_0x8f19('0x20')];}_0x35f417[_0x8f19('0x14')](_0x3d8d15)['send'](_0x40b49);};}exports[_0x8f19('0x21')]=function(_0x41fd2f,_0x544864){var _0x950600={},_0x3bf475={},_0x3f9e8b={'count':0x0,'rows':[]};var _0x276b89=db[_0x8f19('0x22')][_0x8f19('0x23')];_0x3bf475[_0x8f19('0x24')]=_[_0x8f19('0x25')](_0x276b89);var _0x35196e={'dateStart':_0x41fd2f[_0x8f19('0x26')][_0x8f19('0x27')],'dateEnd':_0x41fd2f[_0x8f19('0x26')][_0x8f19('0x28')]};delete _0x41fd2f[_0x8f19('0x26')][_0x8f19('0x27')];delete _0x41fd2f[_0x8f19('0x26')]['dateEnd'];_0x3bf475[_0x8f19('0x26')]=_[_0x8f19('0x25')](_0x41fd2f['query']);_0x3bf475[_0x8f19('0x29')]=_[_0x8f19('0x2a')](_0x3bf475[_0x8f19('0x24')],_0x3bf475[_0x8f19('0x26')]);_0x950600[_0x8f19('0x2b')]=_[_0x8f19('0x2a')](_0x3bf475['model'],qs[_0x8f19('0x2c')](_0x41fd2f[_0x8f19('0x26')][_0x8f19('0x2c')]));_0x950600[_0x8f19('0x2b')]=_0x950600[_0x8f19('0x2b')][_0x8f19('0x2d')]?_0x950600[_0x8f19('0x2b')]:_0x3bf475[_0x8f19('0x24')];if(!_0x41fd2f[_0x8f19('0x26')][_0x8f19('0x2e')]('nolimit')){_0x950600[_0x8f19('0x2f')]=qs[_0x8f19('0x2f')](_0x41fd2f['query'][_0x8f19('0x2f')]);_0x950600[_0x8f19('0x16')]=qs['offset'](_0x41fd2f[_0x8f19('0x26')][_0x8f19('0x16')]);}_0x950600[_0x8f19('0x30')]=qs[_0x8f19('0x31')](_0x41fd2f[_0x8f19('0x26')][_0x8f19('0x31')]);_0x950600[_0x8f19('0x32')]=qs[_0x8f19('0x29')](_[_0x8f19('0x33')](_0x41fd2f['query'],_0x3bf475[_0x8f19('0x29')]));if(_0x35196e[_0x8f19('0x27')]){if(_0x35196e['dateEnd']){_0x35196e[_0x8f19('0x28')]=moment(_0x35196e[_0x8f19('0x28')])['add'](0x1,_0x8f19('0x34'));}else{_0x35196e[_0x8f19('0x28')]=moment(_0x35196e[_0x8f19('0x27')])[_0x8f19('0x35')](0x1,_0x8f19('0x34'));}_[_0x8f19('0x36')](_0x950600['where'],{'createdAt':{'$gte':_0x35196e[_0x8f19('0x27')],'$lte':_0x35196e[_0x8f19('0x28')]}});}if(_0x41fd2f['query'][_0x8f19('0x37')]){_0x950600[_0x8f19('0x32')]=_[_0x8f19('0x36')](_0x950600[_0x8f19('0x32')],{'$or':_['map'](_0x950600[_0x8f19('0x2b')],function(_0x8ca734){var _0xae74d5={};_0xae74d5[_0x8ca734]={'$like':'%'+_0x41fd2f[_0x8f19('0x26')][_0x8f19('0x37')]+'%'};return _0xae74d5;})});}_0x950600=_[_0x8f19('0x36')]({},_0x950600,_0x41fd2f[_0x8f19('0x38')]);var _0x1ce4e1={'where':_0x950600[_0x8f19('0x32')]};return db['Migration']['count'](_0x1ce4e1)['then'](function(_0x5ecd04){_0x3f9e8b[_0x8f19('0x39')]=_0x5ecd04;if(_0x41fd2f[_0x8f19('0x26')][_0x8f19('0x3a')]){_0x950600[_0x8f19('0x3b')]=[{'all':!![]}];}return db[_0x8f19('0x22')][_0x8f19('0x3c')](_0x950600);})[_0x8f19('0x1d')](function(_0x40819e){_0x3f9e8b['rows']=_0x40819e;return _0x3f9e8b;})[_0x8f19('0x1d')](respondWithFilteredResult(_0x544864,_0x950600))[_0x8f19('0x3d')](handleError(_0x544864,null));}; \ No newline at end of file +var _0xa92a=['add','day','filter','merge','map','options','includeAll','include','findAll','rows','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','end','error','stack','name','send','index','Migration','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','sort','where','pick'];(function(_0xe5987c,_0x3bdc36){var _0x236017=function(_0x288d67){while(--_0x288d67){_0xe5987c['push'](_0xe5987c['shift']());}};_0x236017(++_0x3bdc36);}(_0xa92a,0x184));var _0xaa92=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa92a[_0x3c2a69];return _0x596bc8;};'use strict';var jsonpatch=require(_0xaa92('0x0'));var rp=require(_0xaa92('0x1'));var moment=require('moment');var BPromise=require(_0xaa92('0x2'));var Mustache=require(_0xaa92('0x3'));var util=require(_0xaa92('0x4'));var path=require(_0xaa92('0x5'));var sox=require(_0xaa92('0x6'));var csv=require('to-csv');var ejs=require(_0xaa92('0x7'));var fs=require('fs');var _=require(_0xaa92('0x8'));var squel=require(_0xaa92('0x9'));var crypto=require(_0xaa92('0xa'));var jsforce=require(_0xaa92('0xb'));var deskjs=require(_0xaa92('0xc'));var toCsv=require(_0xaa92('0xd'));var querystring=require(_0xaa92('0xe'));var Papa=require(_0xaa92('0xf'));var qs=require(_0xaa92('0x10'));var logger=require('../../config/logger')(_0xaa92('0x11'));var utils=require('../../config/utils');var config=require(_0xaa92('0x12'));var db=require(_0xaa92('0x13'))['db'];function respondWithStatusCode(_0x2c0acb,_0x117be3){_0x117be3=_0x117be3||0xcc;return function(_0x4aee6b){if(_0x4aee6b){return _0x2c0acb[_0xaa92('0x14')](_0x117be3);}return _0x2c0acb[_0xaa92('0x15')](_0x117be3)['end']();};}function respondWithResult(_0x574a70,_0x5cfe54){_0x5cfe54=_0x5cfe54||0xc8;return function(_0x13e62e){if(_0x13e62e){return _0x574a70[_0xaa92('0x15')](_0x5cfe54)['json'](_0x13e62e);}};}function respondWithFilteredResult(_0x4f3593,_0x25f92c){return function(_0x21aa1c){if(_0x21aa1c){var _0x6c5b56=_0x21aa1c[_0xaa92('0x16')],_0x51584c=_0x25f92c[_0xaa92('0x17')],_0x307e5c=_0x25f92c[_0xaa92('0x17')]+_0x25f92c[_0xaa92('0x18')],_0x2a5526;if(_0x307e5c>=_0x6c5b56){_0x307e5c=_0x6c5b56;_0x2a5526=0xc8;}else{_0x2a5526=0xce;}_0x4f3593[_0xaa92('0x15')](_0x2a5526);return _0x4f3593[_0xaa92('0x19')](_0xaa92('0x1a'),_0x51584c+'-'+_0x307e5c+'/'+_0x6c5b56)[_0xaa92('0x1b')](_0x21aa1c);}return null;};}function patchUpdates(_0x3283d1){return function(_0x51e8d0){try{jsonpatch['apply'](_0x51e8d0,_0x3283d1,!![]);}catch(_0x29463b){return BPromise[_0xaa92('0x1c')](_0x29463b);}return _0x51e8d0[_0xaa92('0x1d')]();};}function saveUpdates(_0x23e58e,_0x30333b){return function(_0x7bdab9){if(_0x7bdab9){return _0x7bdab9[_0xaa92('0x1e')](_0x23e58e)[_0xaa92('0x1f')](function(_0x2d4e50){return _0x2d4e50;});}return null;};}function removeEntity(_0x8565d8,_0x1fada9){return function(_0xf6652b){if(_0xf6652b){return _0xf6652b[_0xaa92('0x20')]()[_0xaa92('0x1f')](function(){_0x8565d8[_0xaa92('0x15')](0xcc)[_0xaa92('0x21')]();});}};}function handleEntityNotFound(_0x3cbb03,_0xd4fd3c){return function(_0x258176){if(!_0x258176){_0x3cbb03['sendStatus'](0x194);}return _0x258176;};}function handleError(_0x5c5514,_0x3c98fc){_0x3c98fc=_0x3c98fc||0x1f4;return function(_0x634d13){logger[_0xaa92('0x22')](_0x634d13[_0xaa92('0x23')]);if(_0x634d13[_0xaa92('0x24')]){delete _0x634d13[_0xaa92('0x24')];}_0x5c5514['status'](_0x3c98fc)[_0xaa92('0x25')](_0x634d13);};}exports[_0xaa92('0x26')]=function(_0x196bf8,_0x2ee652){var _0x928607={},_0x4580be={},_0x408e17={'count':0x0,'rows':[]};var _0x394bfc=db[_0xaa92('0x27')]['rawAttributes'];_0x4580be[_0xaa92('0x28')]=_[_0xaa92('0x29')](_0x394bfc);var _0x56b243={'dateStart':_0x196bf8[_0xaa92('0x2a')]['dateStart'],'dateEnd':_0x196bf8[_0xaa92('0x2a')]['dateEnd']};delete _0x196bf8['query'][_0xaa92('0x2b')];delete _0x196bf8[_0xaa92('0x2a')][_0xaa92('0x2c')];_0x4580be[_0xaa92('0x2a')]=_[_0xaa92('0x29')](_0x196bf8[_0xaa92('0x2a')]);_0x4580be[_0xaa92('0x2d')]=_[_0xaa92('0x2e')](_0x4580be[_0xaa92('0x28')],_0x4580be[_0xaa92('0x2a')]);_0x928607[_0xaa92('0x2f')]=_[_0xaa92('0x2e')](_0x4580be[_0xaa92('0x28')],qs[_0xaa92('0x30')](_0x196bf8['query'][_0xaa92('0x30')]));_0x928607[_0xaa92('0x2f')]=_0x928607['attributes'][_0xaa92('0x31')]?_0x928607['attributes']:_0x4580be['model'];if(!_0x196bf8[_0xaa92('0x2a')]['hasOwnProperty']('nolimit')){_0x928607[_0xaa92('0x18')]=qs[_0xaa92('0x18')](_0x196bf8['query'][_0xaa92('0x18')]);_0x928607[_0xaa92('0x17')]=qs[_0xaa92('0x17')](_0x196bf8[_0xaa92('0x2a')][_0xaa92('0x17')]);}_0x928607['order']=qs[_0xaa92('0x32')](_0x196bf8[_0xaa92('0x2a')][_0xaa92('0x32')]);_0x928607[_0xaa92('0x33')]=qs[_0xaa92('0x2d')](_[_0xaa92('0x34')](_0x196bf8['query'],_0x4580be[_0xaa92('0x2d')]));if(_0x56b243[_0xaa92('0x2b')]){if(_0x56b243[_0xaa92('0x2c')]){_0x56b243[_0xaa92('0x2c')]=moment(_0x56b243[_0xaa92('0x2c')])[_0xaa92('0x35')](0x1,_0xaa92('0x36'));}else{_0x56b243[_0xaa92('0x2c')]=moment(_0x56b243['dateStart'])['add'](0x1,_0xaa92('0x36'));}_['merge'](_0x928607[_0xaa92('0x33')],{'createdAt':{'$gte':_0x56b243['dateStart'],'$lte':_0x56b243[_0xaa92('0x2c')]}});}if(_0x196bf8[_0xaa92('0x2a')][_0xaa92('0x37')]){_0x928607[_0xaa92('0x33')]=_[_0xaa92('0x38')](_0x928607[_0xaa92('0x33')],{'$or':_[_0xaa92('0x39')](_0x928607[_0xaa92('0x2f')],function(_0x595070){var _0x4ca274={};_0x4ca274[_0x595070]={'$like':'%'+_0x196bf8['query'][_0xaa92('0x37')]+'%'};return _0x4ca274;})});}_0x928607=_[_0xaa92('0x38')]({},_0x928607,_0x196bf8[_0xaa92('0x3a')]);var _0x53f5ef={'where':_0x928607[_0xaa92('0x33')]};return db['Migration'][_0xaa92('0x16')](_0x53f5ef)[_0xaa92('0x1f')](function(_0x3d588f){_0x408e17[_0xaa92('0x16')]=_0x3d588f;if(_0x196bf8[_0xaa92('0x2a')][_0xaa92('0x3b')]){_0x928607[_0xaa92('0x3c')]=[{'all':!![]}];}return db[_0xaa92('0x27')][_0xaa92('0x3d')](_0x928607);})[_0xaa92('0x1f')](function(_0xdcfc6d){_0x408e17[_0xaa92('0x3e')]=_0xdcfc6d;return _0x408e17;})['then'](respondWithFilteredResult(_0x2ee652,_0x928607))['catch'](handleError(_0x2ee652,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 3662b66..ea66fed 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 _0x002d=['Migration','migrations','lodash','util','../../config/logger','bluebird','request-promise','./migration.attributes','exports','define'];(function(_0x1b5947,_0x14b999){var _0x158c24=function(_0x5d9b2a){while(--_0x5d9b2a){_0x1b5947['push'](_0x1b5947['shift']());}};_0x158c24(++_0x14b999);}(_0x002d,0xca));var _0xd002=function(_0x3a1f55,_0x515cb5){_0x3a1f55=_0x3a1f55-0x0;var _0x4ab364=_0x002d[_0x3a1f55];return _0x4ab364;};'use strict';var _=require(_0xd002('0x0'));var util=require(_0xd002('0x1'));var logger=require(_0xd002('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd002('0x3'));var rp=require(_0xd002('0x4'));var attributes=require(_0xd002('0x5'));module[_0xd002('0x6')]=function(_0x1323f0,_0x179915){return _0x1323f0[_0xd002('0x7')](_0xd002('0x8'),attributes,{'tableName':_0xd002('0x9'),'paranoid':![],'indexes':[],'timestamps':![]});}; \ No newline at end of file +var _0x8506=['util','api','bluebird','./migration.attributes','exports','define','Migration','migrations'];(function(_0x24c0c1,_0x5036f5){var _0x38a926=function(_0x4c1d4e){while(--_0x4c1d4e){_0x24c0c1['push'](_0x24c0c1['shift']());}};_0x38a926(++_0x5036f5);}(_0x8506,0xe8));var _0x6850=function(_0x8b5bd9,_0x203046){_0x8b5bd9=_0x8b5bd9-0x0;var _0x185548=_0x8506[_0x8b5bd9];return _0x185548;};'use strict';var _=require('lodash');var util=require(_0x6850('0x0'));var logger=require('../../config/logger')(_0x6850('0x1'));var moment=require('moment');var BPromise=require(_0x6850('0x2'));var rp=require('request-promise');var attributes=require(_0x6850('0x3'));module[_0x6850('0x4')]=function(_0x321eff,_0x5e9ff2){return _0x321eff[_0x6850('0x5')](_0x6850('0x6'),attributes,{'tableName':_0x6850('0x7'),'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 99ef84b..1aab7ca 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 _0x06f7=['Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','debug'];(function(_0x1074ff,_0x549c4c){var _0x2cd9df=function(_0x18d160){while(--_0x18d160){_0x1074ff['push'](_0x1074ff['shift']());}};_0x2cd9df(++_0x549c4c);}(_0x06f7,0xce));var _0x706f=function(_0x57966a,_0x477964){_0x57966a=_0x57966a-0x0;var _0x191765=_0x06f7[_0x57966a];return _0x191765;};'use strict';var _=require('lodash');var util=require(_0x706f('0x0'));var moment=require('moment');var BPromise=require(_0x706f('0x1'));var rs=require(_0x706f('0x2'));var fs=require('fs');var db=require(_0x706f('0x3'))['db'];var utils=require(_0x706f('0x4'));var logger=require('../../config/logger')(_0x706f('0x5'));var config=require('../../config/environment');var jayson=require(_0x706f('0x6'));var client=jayson[_0x706f('0x7')][_0x706f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20ca84,_0x2e3c73,_0x2906b8){return new BPromise(function(_0x3fee18,_0x3d1352){return client[_0x706f('0x9')](_0x20ca84,_0x2906b8)[_0x706f('0xa')](function(_0x294b75){logger[_0x706f('0xb')](_0x706f('0xc'),_0x2e3c73,'request\x20sent');logger[_0x706f('0xd')](_0x706f('0xe'),_0x2e3c73,'request\x20sent',JSON[_0x706f('0xf')](_0x294b75));if(_0x294b75[_0x706f('0x10')]){if(_0x294b75[_0x706f('0x10')][_0x706f('0x11')]===0x1f4){logger[_0x706f('0x10')](_0x706f('0xc'),_0x2e3c73,_0x294b75[_0x706f('0x10')][_0x706f('0x12')]);return _0x3d1352(_0x294b75[_0x706f('0x10')][_0x706f('0x12')]);}logger[_0x706f('0x10')](_0x706f('0xc'),_0x2e3c73,_0x294b75[_0x706f('0x10')][_0x706f('0x12')]);return _0x3fee18(_0x294b75['error']['message']);}else{logger[_0x706f('0xb')](_0x706f('0xc'),_0x2e3c73,_0x706f('0x13'));_0x3fee18(_0x294b75[_0x706f('0x14')][_0x706f('0x12')]);}})[_0x706f('0x15')](function(_0x586715){logger[_0x706f('0x10')](_0x706f('0xc'),_0x2e3c73,_0x586715);_0x3d1352(_0x586715);});});} \ No newline at end of file +var _0x745a=['info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','http','request','then','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x5479a9,_0x50acb5){var _0x1e23cb=function(_0x172f40){while(--_0x172f40){_0x5479a9['push'](_0x5479a9['shift']());}};_0x1e23cb(++_0x50acb5);}(_0x745a,0x67));var _0xa745=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x745a[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0xa745('0x0'));var util=require('util');var moment=require(_0xa745('0x1'));var BPromise=require(_0xa745('0x2'));var rs=require(_0xa745('0x3'));var fs=require('fs');var db=require(_0xa745('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa745('0x5'))(_0xa745('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa745('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cc4a3,_0x516869,_0x19ff12){return new BPromise(function(_0x2f1887,_0x14f61e){return client[_0xa745('0x8')](_0x5cc4a3,_0x19ff12)[_0xa745('0x9')](function(_0x2b8d90){logger['info'](_0xa745('0xa'),_0x516869,'request\x20sent');logger[_0xa745('0xb')](_0xa745('0xc'),_0x516869,_0xa745('0xd'),JSON['stringify'](_0x2b8d90));if(_0x2b8d90[_0xa745('0xe')]){if(_0x2b8d90[_0xa745('0xe')][_0xa745('0xf')]===0x1f4){logger[_0xa745('0xe')](_0xa745('0xa'),_0x516869,_0x2b8d90['error'][_0xa745('0x10')]);return _0x14f61e(_0x2b8d90['error'][_0xa745('0x10')]);}logger[_0xa745('0xe')](_0xa745('0xa'),_0x516869,_0x2b8d90[_0xa745('0xe')][_0xa745('0x10')]);return _0x2f1887(_0x2b8d90[_0xa745('0xe')][_0xa745('0x10')]);}else{logger[_0xa745('0x11')](_0xa745('0xa'),_0x516869,'request\x20sent');_0x2f1887(_0x2b8d90[_0xa745('0x12')][_0xa745('0x10')]);}})[_0xa745('0x13')](function(_0x5c7857){logger[_0xa745('0xe')](_0xa745('0xa'),_0x516869,_0x5c7857);_0x14f61e(_0x5c7857);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 08297da..9110209 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 _0x326f=['exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','show','post','update','delete','/:id'];(function(_0xd765af,_0x176212){var _0x3b9421=function(_0x59e038){while(--_0x59e038){_0xd765af['push'](_0xd765af['shift']());}};_0x3b9421(++_0x176212);}(_0x326f,0xd1));var _0xf326=function(_0x175ad5,_0xc7b14e){_0x175ad5=_0x175ad5-0x0;var _0x4e0aea=_0x326f[_0x175ad5];return _0x4e0aea;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var express=require(_0xf326('0x1'));var router=express[_0xf326('0x2')]();var auth=require(_0xf326('0x3'));var interaction=require(_0xf326('0x4'));var config=require(_0xf326('0x5'));var controller=require(_0xf326('0x6'));router[_0xf326('0x7')]('/',auth[_0xf326('0x8')](),controller[_0xf326('0x9')]);router[_0xf326('0x7')]('/:id',auth[_0xf326('0x8')](),controller[_0xf326('0xa')]);router[_0xf326('0xb')]('/',auth[_0xf326('0x8')](),controller['create']);router['put']('/:id',auth[_0xf326('0x8')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')](_0xf326('0xe'),auth[_0xf326('0x8')](),controller['destroy']);module[_0xf326('0xf')]=router; \ No newline at end of file +var _0xadb5=['update','delete','exports','util','express','Router','../../components/auth/service','../../config/environment','./network.controller','get','index','/:id','isAuthenticated','show','post','create','put'];(function(_0x364a36,_0x1e2677){var _0x5cd6fa=function(_0x58d692){while(--_0x58d692){_0x364a36['push'](_0x364a36['shift']());}};_0x5cd6fa(++_0x1e2677);}(_0xadb5,0xad));var _0x5adb=function(_0x3da224,_0x4ace14){_0x3da224=_0x3da224-0x0;var _0x7dca70=_0xadb5[_0x3da224];return _0x7dca70;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var express=require(_0x5adb('0x1'));var router=express[_0x5adb('0x2')]();var auth=require(_0x5adb('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x5adb('0x4'));var controller=require(_0x5adb('0x5'));router[_0x5adb('0x6')]('/',auth['isAuthenticated'](),controller[_0x5adb('0x7')]);router[_0x5adb('0x6')](_0x5adb('0x8'),auth[_0x5adb('0x9')](),controller[_0x5adb('0xa')]);router[_0x5adb('0xb')]('/',auth[_0x5adb('0x9')](),controller[_0x5adb('0xc')]);router[_0x5adb('0xd')](_0x5adb('0x8'),auth[_0x5adb('0x9')](),controller[_0x5adb('0xe')]);router[_0x5adb('0xf')](_0x5adb('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x5adb('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 1535b0b..4970658 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 _0x7a75=['ENUM','externip','sequelize'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x7a75,0x1e8));var _0x57a7=function(_0x4624d9,_0x2fb5a4){_0x4624d9=_0x4624d9-0x0;var _0x4471fe=_0x7a75[_0x4624d9];return _0x4471fe;};'use strict';var Sequelize=require(_0x57a7('0x0'));module['exports']={'type':{'type':Sequelize[_0x57a7('0x1')]('localnet',_0x57a7('0x2'))},'value':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xef26=['ENUM','localnet','externip','STRING','sequelize','exports'];(function(_0x4f6309,_0xe71e00){var _0x1c43af=function(_0x1be001){while(--_0x1be001){_0x4f6309['push'](_0x4f6309['shift']());}};_0x1c43af(++_0xe71e00);}(_0xef26,0x190));var _0x6ef2=function(_0x3f1014,_0x329108){_0x3f1014=_0x3f1014-0x0;var _0xa4172d=_0xef26[_0x3f1014];return _0xa4172d;};'use strict';var Sequelize=require(_0x6ef2('0x0'));module[_0x6ef2('0x1')]={'type':{'type':Sequelize[_0x6ef2('0x2')](_0x6ef2('0x3'),_0x6ef2('0x4'))},'value':{'type':Sequelize[_0x6ef2('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 34e5b74..adafc8a 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 _0xd101=['chan_sip.so','format','destroy','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','status','json','count','offset','limit','set','Content-Range','apply','reject','update','end','sendStatus','name','send','Network','keys','query','dateEnd','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','dateStart','day','add','merge','where','filter','options','includeAll','include','rows','catch','show','params','find','sequelize','transaction','body','findAll','readFileSync','join','root','server/files/templates/network.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_%s.conf','type','toLowerCase','Reload','create'];(function(_0x294084,_0x5a0b9){var _0x38abee=function(_0x586adb){while(--_0x586adb){_0x294084['push'](_0x294084['shift']());}};_0x38abee(++_0x5a0b9);}(_0xd101,0xc1));var _0x1d10=function(_0x402cb1,_0x108082){_0x402cb1=_0x402cb1-0x0;var _0xa0d002=_0xd101[_0x402cb1];return _0xa0d002;};'use strict';var jsonpatch=require(_0x1d10('0x0'));var rp=require('request-promise');var moment=require(_0x1d10('0x1'));var BPromise=require(_0x1d10('0x2'));var Mustache=require(_0x1d10('0x3'));var util=require(_0x1d10('0x4'));var path=require(_0x1d10('0x5'));var sox=require(_0x1d10('0x6'));var csv=require(_0x1d10('0x7'));var ejs=require(_0x1d10('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1d10('0x9'));var crypto=require(_0x1d10('0xa'));var jsforce=require(_0x1d10('0xb'));var deskjs=require(_0x1d10('0xc'));var toCsv=require(_0x1d10('0x7'));var querystring=require(_0x1d10('0xd'));var Papa=require(_0x1d10('0xe'));var qs=require(_0x1d10('0xf'));var logger=require(_0x1d10('0x10'))(_0x1d10('0x11'));var utils=require(_0x1d10('0x12'));var config=require(_0x1d10('0x13'));var db=require(_0x1d10('0x14'))['db'];var jayson=require(_0x1d10('0x15'));var client=jayson[_0x1d10('0x16')][_0x1d10('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x450b22,_0x54face,_0x3a2050,_0x93cb59){return new BPromise(function(_0x322bf4,_0x190d4c){var _0x268506=_0x93cb59||client;return _0x268506['request'](_0x450b22,_0x3a2050)[_0x1d10('0x18')](function(_0x1f6f83){logger[_0x1d10('0x19')](_0x1d10('0x1a'),_0x54face,_0x1d10('0x1b'));logger[_0x1d10('0x1c')]('Network,\x20%s,\x20%s,\x20%s',_0x54face,_0x1d10('0x1b'),JSON[_0x1d10('0x1d')](_0x1f6f83));if(_0x1f6f83[_0x1d10('0x1e')]){if(_0x1f6f83[_0x1d10('0x1e')]['code']===0x1f4){logger[_0x1d10('0x1e')](_0x1d10('0x1a'),_0x54face,_0x1f6f83[_0x1d10('0x1e')][_0x1d10('0x1f')]);return _0x190d4c(_0x1f6f83[_0x1d10('0x1e')][_0x1d10('0x1f')]);}logger[_0x1d10('0x1e')]('Network,\x20%s,\x20%s',_0x54face,_0x1f6f83[_0x1d10('0x1e')][_0x1d10('0x1f')]);return _0x322bf4(_0x1f6f83[_0x1d10('0x1e')][_0x1d10('0x1f')]);}else{logger[_0x1d10('0x19')]('Network,\x20%s,\x20%s',_0x54face,'request\x20sent');_0x322bf4(_0x1f6f83[_0x1d10('0x20')]['message']);}})['catch'](function(_0x5774f9){logger[_0x1d10('0x1e')](_0x1d10('0x1a'),_0x54face,_0x5774f9);_0x190d4c(_0x5774f9);});});}function respondWithStatusCode(_0x24717c,_0x250395){_0x250395=_0x250395||0xcc;return function(_0x4ce84a){if(_0x4ce84a){return _0x24717c['sendStatus'](_0x250395);}return _0x24717c[_0x1d10('0x21')](_0x250395)['end']();};}function respondWithResult(_0x68b09,_0x474321){_0x474321=_0x474321||0xc8;return function(_0x160802){if(_0x160802){return _0x68b09[_0x1d10('0x21')](_0x474321)[_0x1d10('0x22')](_0x160802);}};}function respondWithFilteredResult(_0x3601ba,_0x2305c8){return function(_0x3af06d){if(_0x3af06d){var _0x4168e=_0x3af06d[_0x1d10('0x23')],_0x84055f=_0x2305c8[_0x1d10('0x24')],_0xf1e4c8=_0x2305c8[_0x1d10('0x24')]+_0x2305c8[_0x1d10('0x25')],_0x5abc58;if(_0xf1e4c8>=_0x4168e){_0xf1e4c8=_0x4168e;_0x5abc58=0xc8;}else{_0x5abc58=0xce;}_0x3601ba[_0x1d10('0x21')](_0x5abc58);return _0x3601ba[_0x1d10('0x26')](_0x1d10('0x27'),_0x84055f+'-'+_0xf1e4c8+'/'+_0x4168e)[_0x1d10('0x22')](_0x3af06d);}return null;};}function patchUpdates(_0x4f7837){return function(_0x355e10){try{jsonpatch[_0x1d10('0x28')](_0x355e10,_0x4f7837,!![]);}catch(_0x59b5eb){return BPromise[_0x1d10('0x29')](_0x59b5eb);}return _0x355e10['save']();};}function saveUpdates(_0x4db221,_0x41b5b8){return function(_0x597aea){if(_0x597aea){return _0x597aea[_0x1d10('0x2a')](_0x4db221)[_0x1d10('0x18')](function(_0x453737){return _0x453737;});}return null;};}function removeEntity(_0x15fdac,_0x1a43fd){return function(_0x9c6cb9){if(_0x9c6cb9){return _0x9c6cb9['destroy']()['then'](function(){_0x15fdac[_0x1d10('0x21')](0xcc)[_0x1d10('0x2b')]();});}};}function handleEntityNotFound(_0x96756b,_0x2e870f){return function(_0xe89535){if(!_0xe89535){_0x96756b[_0x1d10('0x2c')](0x194);}return _0xe89535;};}function handleError(_0x2c9c59,_0x1c6cad){_0x1c6cad=_0x1c6cad||0x1f4;return function(_0x8f4818){logger[_0x1d10('0x1e')](_0x8f4818['stack']);if(_0x8f4818[_0x1d10('0x2d')]){delete _0x8f4818['name'];}_0x2c9c59[_0x1d10('0x21')](_0x1c6cad)[_0x1d10('0x2e')](_0x8f4818);};}exports['index']=function(_0x339bb2,_0x47cd79){var _0x336f4f={},_0x2d4121={},_0x32ada3={'count':0x0,'rows':[]};var _0x2f8530=db[_0x1d10('0x2f')]['rawAttributes'];_0x2d4121['model']=_[_0x1d10('0x30')](_0x2f8530);var _0x1e3a6b={'dateStart':_0x339bb2[_0x1d10('0x31')]['dateStart'],'dateEnd':_0x339bb2['query']['dateEnd']};delete _0x339bb2[_0x1d10('0x31')]['dateStart'];delete _0x339bb2[_0x1d10('0x31')][_0x1d10('0x32')];_0x2d4121[_0x1d10('0x31')]=_[_0x1d10('0x30')](_0x339bb2['query']);_0x2d4121['filters']=_[_0x1d10('0x33')](_0x2d4121[_0x1d10('0x34')],_0x2d4121[_0x1d10('0x31')]);_0x336f4f[_0x1d10('0x35')]=_['intersection'](_0x2d4121[_0x1d10('0x34')],qs['fields'](_0x339bb2[_0x1d10('0x31')][_0x1d10('0x36')]));_0x336f4f[_0x1d10('0x35')]=_0x336f4f[_0x1d10('0x35')][_0x1d10('0x37')]?_0x336f4f[_0x1d10('0x35')]:_0x2d4121[_0x1d10('0x34')];if(!_0x339bb2[_0x1d10('0x31')][_0x1d10('0x38')](_0x1d10('0x39'))){_0x336f4f[_0x1d10('0x25')]=qs[_0x1d10('0x25')](_0x339bb2[_0x1d10('0x31')]['limit']);_0x336f4f['offset']=qs[_0x1d10('0x24')](_0x339bb2[_0x1d10('0x31')][_0x1d10('0x24')]);}_0x336f4f[_0x1d10('0x3a')]=qs[_0x1d10('0x3b')](_0x339bb2[_0x1d10('0x31')][_0x1d10('0x3b')]);_0x336f4f['where']=qs[_0x1d10('0x3c')](_[_0x1d10('0x3d')](_0x339bb2[_0x1d10('0x31')],_0x2d4121['filters']));if(_0x1e3a6b[_0x1d10('0x3e')]){if(_0x1e3a6b[_0x1d10('0x32')]){_0x1e3a6b[_0x1d10('0x32')]=moment(_0x1e3a6b['dateEnd'])['add'](0x1,_0x1d10('0x3f'));}else{_0x1e3a6b[_0x1d10('0x32')]=moment(_0x1e3a6b[_0x1d10('0x3e')])[_0x1d10('0x40')](0x1,_0x1d10('0x3f'));}_[_0x1d10('0x41')](_0x336f4f[_0x1d10('0x42')],{'createdAt':{'$gte':_0x1e3a6b['dateStart'],'$lte':_0x1e3a6b[_0x1d10('0x32')]}});}if(_0x339bb2[_0x1d10('0x31')]['filter']){_0x336f4f[_0x1d10('0x42')]=_['merge'](_0x336f4f[_0x1d10('0x42')],{'$or':_['map'](_0x336f4f['attributes'],function(_0x11f446){var _0x3183b4={};_0x3183b4[_0x11f446]={'$like':'%'+_0x339bb2[_0x1d10('0x31')][_0x1d10('0x43')]+'%'};return _0x3183b4;})});}_0x336f4f=_[_0x1d10('0x41')]({},_0x336f4f,_0x339bb2[_0x1d10('0x44')]);var _0x4490a5={'where':_0x336f4f[_0x1d10('0x42')]};return db[_0x1d10('0x2f')]['count'](_0x4490a5)['then'](function(_0x1ce4e9){_0x32ada3[_0x1d10('0x23')]=_0x1ce4e9;if(_0x339bb2[_0x1d10('0x31')][_0x1d10('0x45')]){_0x336f4f[_0x1d10('0x46')]=[{'all':!![]}];}return db[_0x1d10('0x2f')]['findAll'](_0x336f4f);})[_0x1d10('0x18')](function(_0x1b8513){_0x32ada3[_0x1d10('0x47')]=_0x1b8513;return _0x32ada3;})[_0x1d10('0x18')](respondWithFilteredResult(_0x47cd79,_0x336f4f))[_0x1d10('0x48')](handleError(_0x47cd79,null));};exports[_0x1d10('0x49')]=function(_0x8226b4,_0x2c036e){var _0x39bf64={'raw':!![],'where':{'id':_0x8226b4[_0x1d10('0x4a')]['id']}},_0x32a9a9={};_0x32a9a9[_0x1d10('0x34')]=_[_0x1d10('0x30')](db[_0x1d10('0x2f')]['rawAttributes']);_0x32a9a9['query']=_[_0x1d10('0x30')](_0x8226b4['query']);_0x32a9a9['filters']=_[_0x1d10('0x33')](_0x32a9a9[_0x1d10('0x34')],_0x32a9a9[_0x1d10('0x31')]);_0x39bf64[_0x1d10('0x35')]=_[_0x1d10('0x33')](_0x32a9a9['model'],qs['fields'](_0x8226b4['query']['fields']));_0x39bf64[_0x1d10('0x35')]=_0x39bf64[_0x1d10('0x35')][_0x1d10('0x37')]?_0x39bf64[_0x1d10('0x35')]:_0x32a9a9['model'];if(_0x8226b4[_0x1d10('0x31')][_0x1d10('0x45')]){_0x39bf64[_0x1d10('0x46')]=[{'all':!![]}];}_0x39bf64=_['merge']({},_0x39bf64,_0x8226b4[_0x1d10('0x44')]);return db['Network'][_0x1d10('0x4b')](_0x39bf64)[_0x1d10('0x18')](handleEntityNotFound(_0x2c036e,null))[_0x1d10('0x18')](respondWithResult(_0x2c036e,null))[_0x1d10('0x48')](handleError(_0x2c036e,null));};exports['create']=function(_0x27f665,_0x10d724,_0xcf775){var _0x46dc9a;return db[_0x1d10('0x4c')][_0x1d10('0x4d')](function(_0x50910c){return db[_0x1d10('0x2f')]['create'](_0x27f665[_0x1d10('0x4e')],{'raw':!![]})['then'](function(_0x387291){_0x46dc9a=_0x387291;return db[_0x1d10('0x2f')][_0x1d10('0x4f')]({'where':{'type':_0x27f665[_0x1d10('0x4e')]['type']},'raw':!![]});})[_0x1d10('0x18')](function(_0x88812c){var _0x2c9fb0=fs[_0x1d10('0x50')](path[_0x1d10('0x51')](config[_0x1d10('0x52')],_0x1d10('0x53')),_0x1d10('0x54'));var _0x3f41f2=ejs[_0x1d10('0x55')](_0x2c9fb0,{'networks':_0x88812c||[]});fs[_0x1d10('0x56')](util['format'](_0x1d10('0x57'),_0x27f665['body'][_0x1d10('0x58')][_0x1d10('0x59')]()),_0x3f41f2);})[_0x1d10('0x18')](function(){return respondWithRpcPromise(_0x1d10('0x5a'),_0x1d10('0x5b'),{'module':_0x1d10('0x5c')});})[_0x1d10('0x18')](function(){return _0x46dc9a;});})[_0x1d10('0x18')](respondWithResult(_0x10d724,0xc9))[_0x1d10('0x48')](handleError(_0x10d724,null));};exports[_0x1d10('0x2a')]=function(_0x440028,_0x471d5c,_0x7ad59f){var _0x223c3c;return db[_0x1d10('0x4c')]['transaction'](function(_0xdf0879){return db[_0x1d10('0x2f')][_0x1d10('0x4b')]({'where':{'id':_0x440028['params']['id']}})[_0x1d10('0x18')](handleEntityNotFound(_0x471d5c,null))[_0x1d10('0x18')](saveUpdates(_0x440028[_0x1d10('0x4e')],null))[_0x1d10('0x18')](function(_0x27a29c){if(_0x27a29c){_0x223c3c=_0x27a29c;return db[_0x1d10('0x2f')][_0x1d10('0x4f')]({'where':{'type':_0x223c3c[_0x1d10('0x58')]},'raw':!![]});}return null;})[_0x1d10('0x18')](function(_0x57e582){if(_0x57e582){var _0x426397=fs[_0x1d10('0x50')](path[_0x1d10('0x51')](config[_0x1d10('0x52')],_0x1d10('0x53')),_0x1d10('0x54'));var _0x7c500c=ejs['render'](_0x426397,{'networks':_0x57e582||[]});fs[_0x1d10('0x56')](util['format'](_0x1d10('0x57'),_0x223c3c[_0x1d10('0x58')][_0x1d10('0x59')]()),_0x7c500c);return respondWithRpcPromise(_0x1d10('0x5a'),_0x1d10('0x2a'),{'module':_0x1d10('0x5c')});}return null;})[_0x1d10('0x18')](function(_0x4dded6){if(_0x4dded6){return _0x223c3c;}return null;});})['then'](respondWithResult(_0x471d5c,null))[_0x1d10('0x48')](handleError(_0x471d5c,null));};exports['destroy']=function(_0xcc062d,_0x3da7d0,_0x2e9db3){var _0x1a2efd;return db['Network'][_0x1d10('0x4b')]({'where':{'id':_0xcc062d['params']['id']}})[_0x1d10('0x18')](function(_0x4745ee){_0x1a2efd=_0x4745ee;return _0x4745ee;})[_0x1d10('0x18')](handleEntityNotFound(_0x3da7d0,null))[_0x1d10('0x18')](removeEntity(_0x3da7d0,null))['then'](function(){if(_0x1a2efd){return db['Network']['findAll']({'where':{'type':_0x1a2efd['type']},'raw':!![]});}})[_0x1d10('0x18')](function(_0x37de2a){if(_0x37de2a){var _0x527e0b=fs['readFileSync'](path['join'](config[_0x1d10('0x52')],'server/files/templates/network.ejs'),_0x1d10('0x54'));var _0xd41420=ejs['render'](_0x527e0b,{'networks':_0x37de2a||[]});fs[_0x1d10('0x56')](util[_0x1d10('0x5d')](_0x1d10('0x57'),_0x1a2efd[_0x1d10('0x58')][_0x1d10('0x59')]()),_0xd41420);return respondWithRpcPromise(_0x1d10('0x5a'),_0x1d10('0x5e'),{'module':'chan_sip.so'});}})['catch'](handleError(_0x3da7d0,null));}; \ No newline at end of file +var _0x06ae=['create','sequelize','transaction','body','readFileSync','join','root','server/files/templates/network.ejs','utf8','render','writeFileSync','format','/etc/asterisk/sip_xcally_%s.conf','type','Reload','find','toLowerCase','chan_sip.so','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../config/logger','../../config/environment','jayson/promise','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','reject','save','update','destroy','stack','name','index','rawAttributes','keys','query','dateStart','dateEnd','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filters','add','day','where','map','merge','options','Network','count','includeAll','findAll','catch','show','params','include'];(function(_0x5f2ed6,_0x3af2f8){var _0x4ab360=function(_0x2da56c){while(--_0x2da56c){_0x5f2ed6['push'](_0x5f2ed6['shift']());}};_0x4ab360(++_0x3af2f8);}(_0x06ae,0x16e));var _0xe06a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06ae[_0x14add3];return _0x4a174f;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xe06a('0x0'));var moment=require(_0xe06a('0x1'));var BPromise=require(_0xe06a('0x2'));var Mustache=require(_0xe06a('0x3'));var util=require(_0xe06a('0x4'));var path=require(_0xe06a('0x5'));var sox=require(_0xe06a('0x6'));var csv=require(_0xe06a('0x7'));var ejs=require(_0xe06a('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe06a('0x9'));var deskjs=require(_0xe06a('0xa'));var toCsv=require(_0xe06a('0x7'));var querystring=require(_0xe06a('0xb'));var Papa=require(_0xe06a('0xc'));var qs=require('../../components/parsers/qs');var logger=require(_0xe06a('0xd'))('api');var utils=require('../../config/utils');var config=require(_0xe06a('0xe'));var db=require('../../mysqldb')['db'];var jayson=require(_0xe06a('0xf'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xb420d2,_0x14a682,_0x574fd0,_0x316167){return new BPromise(function(_0x11afc9,_0x4997ac){var _0xb402c7=_0x316167||client;return _0xb402c7[_0xe06a('0x10')](_0xb420d2,_0x574fd0)[_0xe06a('0x11')](function(_0x4b3501){logger[_0xe06a('0x12')](_0xe06a('0x13'),_0x14a682,_0xe06a('0x14'));logger[_0xe06a('0x15')](_0xe06a('0x16'),_0x14a682,'request\x20sent',JSON[_0xe06a('0x17')](_0x4b3501));if(_0x4b3501[_0xe06a('0x18')]){if(_0x4b3501[_0xe06a('0x18')][_0xe06a('0x19')]===0x1f4){logger[_0xe06a('0x18')](_0xe06a('0x13'),_0x14a682,_0x4b3501['error'][_0xe06a('0x1a')]);return _0x4997ac(_0x4b3501['error']['message']);}logger['error'](_0xe06a('0x13'),_0x14a682,_0x4b3501[_0xe06a('0x18')][_0xe06a('0x1a')]);return _0x11afc9(_0x4b3501['error'][_0xe06a('0x1a')]);}else{logger[_0xe06a('0x12')]('Network,\x20%s,\x20%s',_0x14a682,_0xe06a('0x14'));_0x11afc9(_0x4b3501['result'][_0xe06a('0x1a')]);}})['catch'](function(_0x550ff8){logger[_0xe06a('0x18')](_0xe06a('0x13'),_0x14a682,_0x550ff8);_0x4997ac(_0x550ff8);});});}function respondWithStatusCode(_0x1e7f25,_0x216fda){_0x216fda=_0x216fda||0xcc;return function(_0xf8921e){if(_0xf8921e){return _0x1e7f25[_0xe06a('0x1b')](_0x216fda);}return _0x1e7f25[_0xe06a('0x1c')](_0x216fda)[_0xe06a('0x1d')]();};}function respondWithResult(_0x275668,_0x5c0bce){_0x5c0bce=_0x5c0bce||0xc8;return function(_0x5970d9){if(_0x5970d9){return _0x275668[_0xe06a('0x1c')](_0x5c0bce)[_0xe06a('0x1e')](_0x5970d9);}};}function respondWithFilteredResult(_0xf13325,_0x82ba72){return function(_0x352434){if(_0x352434){var _0x2c96bd=_0x352434['count'],_0x3f468e=_0x82ba72['offset'],_0x19a7e0=_0x82ba72[_0xe06a('0x1f')]+_0x82ba72['limit'],_0x456d2d;if(_0x19a7e0>=_0x2c96bd){_0x19a7e0=_0x2c96bd;_0x456d2d=0xc8;}else{_0x456d2d=0xce;}_0xf13325[_0xe06a('0x1c')](_0x456d2d);return _0xf13325['set']('Content-Range',_0x3f468e+'-'+_0x19a7e0+'/'+_0x2c96bd)['json'](_0x352434);}return null;};}function patchUpdates(_0x37ff49){return function(_0x4316bb){try{jsonpatch['apply'](_0x4316bb,_0x37ff49,!![]);}catch(_0x217f24){return BPromise[_0xe06a('0x20')](_0x217f24);}return _0x4316bb[_0xe06a('0x21')]();};}function saveUpdates(_0x1c5964,_0x15cf61){return function(_0x3a3568){if(_0x3a3568){return _0x3a3568[_0xe06a('0x22')](_0x1c5964)[_0xe06a('0x11')](function(_0x1ce29f){return _0x1ce29f;});}return null;};}function removeEntity(_0x50aded,_0x4bee48){return function(_0x177d3e){if(_0x177d3e){return _0x177d3e[_0xe06a('0x23')]()[_0xe06a('0x11')](function(){_0x50aded[_0xe06a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5fd6c4,_0x4e6741){return function(_0x26cbef){if(!_0x26cbef){_0x5fd6c4[_0xe06a('0x1b')](0x194);}return _0x26cbef;};}function handleError(_0x470dd3,_0x3011f1){_0x3011f1=_0x3011f1||0x1f4;return function(_0x492919){logger[_0xe06a('0x18')](_0x492919[_0xe06a('0x24')]);if(_0x492919[_0xe06a('0x25')]){delete _0x492919[_0xe06a('0x25')];}_0x470dd3['status'](_0x3011f1)['send'](_0x492919);};}exports[_0xe06a('0x26')]=function(_0x18d92c,_0x1ba980){var _0x1a0800={},_0x117b07={},_0x17c345={'count':0x0,'rows':[]};var _0x5a193c=db['Network'][_0xe06a('0x27')];_0x117b07['model']=_[_0xe06a('0x28')](_0x5a193c);var _0x563c2f={'dateStart':_0x18d92c[_0xe06a('0x29')][_0xe06a('0x2a')],'dateEnd':_0x18d92c[_0xe06a('0x29')]['dateEnd']};delete _0x18d92c['query'][_0xe06a('0x2a')];delete _0x18d92c[_0xe06a('0x29')][_0xe06a('0x2b')];_0x117b07[_0xe06a('0x29')]=_[_0xe06a('0x28')](_0x18d92c[_0xe06a('0x29')]);_0x117b07['filters']=_['intersection'](_0x117b07['model'],_0x117b07['query']);_0x1a0800[_0xe06a('0x2c')]=_[_0xe06a('0x2d')](_0x117b07[_0xe06a('0x2e')],qs[_0xe06a('0x2f')](_0x18d92c[_0xe06a('0x29')]['fields']));_0x1a0800[_0xe06a('0x2c')]=_0x1a0800[_0xe06a('0x2c')][_0xe06a('0x30')]?_0x1a0800['attributes']:_0x117b07[_0xe06a('0x2e')];if(!_0x18d92c[_0xe06a('0x29')][_0xe06a('0x31')](_0xe06a('0x32'))){_0x1a0800[_0xe06a('0x33')]=qs[_0xe06a('0x33')](_0x18d92c[_0xe06a('0x29')][_0xe06a('0x33')]);_0x1a0800['offset']=qs['offset'](_0x18d92c[_0xe06a('0x29')]['offset']);}_0x1a0800['order']=qs[_0xe06a('0x34')](_0x18d92c[_0xe06a('0x29')][_0xe06a('0x34')]);_0x1a0800['where']=qs['filters'](_[_0xe06a('0x35')](_0x18d92c[_0xe06a('0x29')],_0x117b07[_0xe06a('0x36')]));if(_0x563c2f[_0xe06a('0x2a')]){if(_0x563c2f['dateEnd']){_0x563c2f[_0xe06a('0x2b')]=moment(_0x563c2f['dateEnd'])[_0xe06a('0x37')](0x1,_0xe06a('0x38'));}else{_0x563c2f['dateEnd']=moment(_0x563c2f[_0xe06a('0x2a')])[_0xe06a('0x37')](0x1,'day');}_['merge'](_0x1a0800['where'],{'createdAt':{'$gte':_0x563c2f['dateStart'],'$lte':_0x563c2f[_0xe06a('0x2b')]}});}if(_0x18d92c['query']['filter']){_0x1a0800['where']=_['merge'](_0x1a0800[_0xe06a('0x39')],{'$or':_[_0xe06a('0x3a')](_0x1a0800[_0xe06a('0x2c')],function(_0xd11c2){var _0x82354a={};_0x82354a[_0xd11c2]={'$like':'%'+_0x18d92c[_0xe06a('0x29')]['filter']+'%'};return _0x82354a;})});}_0x1a0800=_[_0xe06a('0x3b')]({},_0x1a0800,_0x18d92c[_0xe06a('0x3c')]);var _0x128b4c={'where':_0x1a0800[_0xe06a('0x39')]};return db[_0xe06a('0x3d')]['count'](_0x128b4c)['then'](function(_0x36d0c7){_0x17c345[_0xe06a('0x3e')]=_0x36d0c7;if(_0x18d92c[_0xe06a('0x29')][_0xe06a('0x3f')]){_0x1a0800['include']=[{'all':!![]}];}return db[_0xe06a('0x3d')][_0xe06a('0x40')](_0x1a0800);})[_0xe06a('0x11')](function(_0x5b1e09){_0x17c345['rows']=_0x5b1e09;return _0x17c345;})['then'](respondWithFilteredResult(_0x1ba980,_0x1a0800))[_0xe06a('0x41')](handleError(_0x1ba980,null));};exports[_0xe06a('0x42')]=function(_0x8b0c6c,_0x37269c){var _0x5923f2={'raw':!![],'where':{'id':_0x8b0c6c[_0xe06a('0x43')]['id']}},_0x1bf7af={};_0x1bf7af[_0xe06a('0x2e')]=_[_0xe06a('0x28')](db[_0xe06a('0x3d')]['rawAttributes']);_0x1bf7af[_0xe06a('0x29')]=_[_0xe06a('0x28')](_0x8b0c6c[_0xe06a('0x29')]);_0x1bf7af[_0xe06a('0x36')]=_['intersection'](_0x1bf7af['model'],_0x1bf7af[_0xe06a('0x29')]);_0x5923f2[_0xe06a('0x2c')]=_[_0xe06a('0x2d')](_0x1bf7af['model'],qs[_0xe06a('0x2f')](_0x8b0c6c['query'][_0xe06a('0x2f')]));_0x5923f2['attributes']=_0x5923f2['attributes']['length']?_0x5923f2['attributes']:_0x1bf7af[_0xe06a('0x2e')];if(_0x8b0c6c['query'][_0xe06a('0x3f')]){_0x5923f2[_0xe06a('0x44')]=[{'all':!![]}];}_0x5923f2=_[_0xe06a('0x3b')]({},_0x5923f2,_0x8b0c6c[_0xe06a('0x3c')]);return db[_0xe06a('0x3d')]['find'](_0x5923f2)[_0xe06a('0x11')](handleEntityNotFound(_0x37269c,null))[_0xe06a('0x11')](respondWithResult(_0x37269c,null))[_0xe06a('0x41')](handleError(_0x37269c,null));};exports[_0xe06a('0x45')]=function(_0x5d6722,_0x108ff4,_0x13cd61){var _0x277a42;return db[_0xe06a('0x46')][_0xe06a('0x47')](function(_0x162b4b){return db[_0xe06a('0x3d')][_0xe06a('0x45')](_0x5d6722[_0xe06a('0x48')],{'raw':!![]})[_0xe06a('0x11')](function(_0x19ffe7){_0x277a42=_0x19ffe7;return db[_0xe06a('0x3d')][_0xe06a('0x40')]({'where':{'type':_0x5d6722[_0xe06a('0x48')]['type']},'raw':!![]});})['then'](function(_0x186ed3){var _0x4e6f03=fs[_0xe06a('0x49')](path[_0xe06a('0x4a')](config[_0xe06a('0x4b')],_0xe06a('0x4c')),_0xe06a('0x4d'));var _0x210b30=ejs[_0xe06a('0x4e')](_0x4e6f03,{'networks':_0x186ed3||[]});fs[_0xe06a('0x4f')](util[_0xe06a('0x50')](_0xe06a('0x51'),_0x5d6722[_0xe06a('0x48')][_0xe06a('0x52')]['toLowerCase']()),_0x210b30);})[_0xe06a('0x11')](function(){return respondWithRpcPromise(_0xe06a('0x53'),'create',{'module':'chan_sip.so'});})[_0xe06a('0x11')](function(){return _0x277a42;});})['then'](respondWithResult(_0x108ff4,0xc9))[_0xe06a('0x41')](handleError(_0x108ff4,null));};exports[_0xe06a('0x22')]=function(_0x494569,_0x1878ff,_0x10c615){var _0x4df697;return db[_0xe06a('0x46')][_0xe06a('0x47')](function(_0x2f7a4a){return db[_0xe06a('0x3d')][_0xe06a('0x54')]({'where':{'id':_0x494569[_0xe06a('0x43')]['id']}})[_0xe06a('0x11')](handleEntityNotFound(_0x1878ff,null))[_0xe06a('0x11')](saveUpdates(_0x494569[_0xe06a('0x48')],null))[_0xe06a('0x11')](function(_0x3404e5){if(_0x3404e5){_0x4df697=_0x3404e5;return db[_0xe06a('0x3d')][_0xe06a('0x40')]({'where':{'type':_0x4df697[_0xe06a('0x52')]},'raw':!![]});}return null;})[_0xe06a('0x11')](function(_0x48bbe7){if(_0x48bbe7){var _0x254197=fs[_0xe06a('0x49')](path['join'](config[_0xe06a('0x4b')],_0xe06a('0x4c')),_0xe06a('0x4d'));var _0x1c2f9c=ejs[_0xe06a('0x4e')](_0x254197,{'networks':_0x48bbe7||[]});fs[_0xe06a('0x4f')](util['format'](_0xe06a('0x51'),_0x4df697[_0xe06a('0x52')][_0xe06a('0x55')]()),_0x1c2f9c);return respondWithRpcPromise(_0xe06a('0x53'),_0xe06a('0x22'),{'module':_0xe06a('0x56')});}return null;})[_0xe06a('0x11')](function(_0x1f8327){if(_0x1f8327){return _0x4df697;}return null;});})['then'](respondWithResult(_0x1878ff,null))[_0xe06a('0x41')](handleError(_0x1878ff,null));};exports[_0xe06a('0x23')]=function(_0x154af1,_0xb9d96b,_0x234b14){var _0x2a4b8f;return db[_0xe06a('0x3d')][_0xe06a('0x54')]({'where':{'id':_0x154af1[_0xe06a('0x43')]['id']}})[_0xe06a('0x11')](function(_0x1ceeb9){_0x2a4b8f=_0x1ceeb9;return _0x1ceeb9;})['then'](handleEntityNotFound(_0xb9d96b,null))[_0xe06a('0x11')](removeEntity(_0xb9d96b,null))[_0xe06a('0x11')](function(){if(_0x2a4b8f){return db[_0xe06a('0x3d')][_0xe06a('0x40')]({'where':{'type':_0x2a4b8f[_0xe06a('0x52')]},'raw':!![]});}})[_0xe06a('0x11')](function(_0x3cd94c){if(_0x3cd94c){var _0x3cb869=fs[_0xe06a('0x49')](path[_0xe06a('0x4a')](config[_0xe06a('0x4b')],_0xe06a('0x4c')),_0xe06a('0x4d'));var _0x10a3fa=ejs['render'](_0x3cb869,{'networks':_0x3cd94c||[]});fs[_0xe06a('0x4f')](util[_0xe06a('0x50')](_0xe06a('0x51'),_0x2a4b8f[_0xe06a('0x52')][_0xe06a('0x55')]()),_0x10a3fa);return respondWithRpcPromise(_0xe06a('0x53'),'destroy',{'module':_0xe06a('0x56')});}})[_0xe06a('0x41')](handleError(_0xb9d96b,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index c8a3097..9d5c2d5 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 _0xdcfb=['api','moment','bluebird','exports','define','network'];(function(_0x349e84,_0x50a497){var _0x51df08=function(_0x2b2f8e){while(--_0x2b2f8e){_0x349e84['push'](_0x349e84['shift']());}};_0x51df08(++_0x50a497);}(_0xdcfb,0x1b6));var _0xbdcf=function(_0x4659b5,_0xd07142){_0x4659b5=_0x4659b5-0x0;var _0x2cd685=_0xdcfb[_0x4659b5];return _0x2cd685;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xbdcf('0x0'));var moment=require(_0xbdcf('0x1'));var BPromise=require(_0xbdcf('0x2'));var rp=require('request-promise');var attributes=require('./network.attributes');module[_0xbdcf('0x3')]=function(_0x11aec2,_0x298417){return _0x11aec2[_0xbdcf('0x4')]('Network',attributes,{'tableName':_0xbdcf('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc011=['util','api','moment','bluebird','exports','define','Network','lodash'];(function(_0x466b8c,_0x492ed0){var _0x3f461d=function(_0x1bb52c){while(--_0x1bb52c){_0x466b8c['push'](_0x466b8c['shift']());}};_0x3f461d(++_0x492ed0);}(_0xc011,0x67));var _0x1c01=function(_0x40b981,_0x48b308){_0x40b981=_0x40b981-0x0;var _0x58696b=_0xc011[_0x40b981];return _0x58696b;};'use strict';var _=require(_0x1c01('0x0'));var util=require(_0x1c01('0x1'));var logger=require('../../config/logger')(_0x1c01('0x2'));var moment=require(_0x1c01('0x3'));var BPromise=require(_0x1c01('0x4'));var rp=require('request-promise');var attributes=require('./network.attributes');module[_0x1c01('0x5')]=function(_0x290186,_0x52596f){return _0x290186[_0x1c01('0x6')](_0x1c01('0x7'),attributes,{'tableName':'network','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 5ec7a8f..d98a2f8 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 _0xa581=['Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info'];(function(_0x291c2d,_0x4b4a9d){var _0x422f9d=function(_0x34d166){while(--_0x34d166){_0x291c2d['push'](_0x291c2d['shift']());}};_0x422f9d(++_0x4b4a9d);}(_0xa581,0x171));var _0x1a58=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa581[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x1a58('0x0'));var moment=require(_0x1a58('0x1'));var BPromise=require(_0x1a58('0x2'));var rs=require(_0x1a58('0x3'));var fs=require('fs');var db=require(_0x1a58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a58('0x5'))(_0x1a58('0x6'));var config=require(_0x1a58('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1a58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1120c9,_0x43f0a4,_0x15fcfc){return new BPromise(function(_0x37cef7,_0x5d122c){return client['request'](_0x1120c9,_0x15fcfc)[_0x1a58('0x9')](function(_0x4b8672){logger[_0x1a58('0xa')](_0x1a58('0xb'),_0x43f0a4,_0x1a58('0xc'));logger[_0x1a58('0xd')](_0x1a58('0xe'),_0x43f0a4,_0x1a58('0xc'),JSON[_0x1a58('0xf')](_0x4b8672));if(_0x4b8672[_0x1a58('0x10')]){if(_0x4b8672[_0x1a58('0x10')][_0x1a58('0x11')]===0x1f4){logger['error'](_0x1a58('0xb'),_0x43f0a4,_0x4b8672[_0x1a58('0x10')][_0x1a58('0x12')]);return _0x5d122c(_0x4b8672[_0x1a58('0x10')]['message']);}logger[_0x1a58('0x10')](_0x1a58('0xb'),_0x43f0a4,_0x4b8672['error'][_0x1a58('0x12')]);return _0x37cef7(_0x4b8672['error'][_0x1a58('0x12')]);}else{logger['info'](_0x1a58('0xb'),_0x43f0a4,_0x1a58('0xc'));_0x37cef7(_0x4b8672[_0x1a58('0x13')][_0x1a58('0x12')]);}})['catch'](function(_0x1e9f4e){logger[_0x1a58('0x10')](_0x1a58('0xb'),_0x43f0a4,_0x1e9f4e);_0x5d122c(_0x1e9f4e);});});} \ No newline at end of file +var _0xac49=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code','Network,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x44b54f,_0xe07a57){var _0x396a5c=function(_0x3c866d){while(--_0x3c866d){_0x44b54f['push'](_0x44b54f['shift']());}};_0x396a5c(++_0xe07a57);}(_0xac49,0xed));var _0x9ac4=function(_0x5b0bc8,_0x5908ee){_0x5b0bc8=_0x5b0bc8-0x0;var _0x49154c=_0xac49[_0x5b0bc8];return _0x49154c;};'use strict';var _=require('lodash');var util=require(_0x9ac4('0x0'));var moment=require(_0x9ac4('0x1'));var BPromise=require(_0x9ac4('0x2'));var rs=require(_0x9ac4('0x3'));var fs=require('fs');var db=require(_0x9ac4('0x4'))['db'];var utils=require(_0x9ac4('0x5'));var logger=require(_0x9ac4('0x6'))(_0x9ac4('0x7'));var config=require(_0x9ac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9ac4('0x9')][_0x9ac4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c9b2b,_0x3d35d2,_0x2d20cb){return new BPromise(function(_0x31d2c6,_0xa6cdd){return client[_0x9ac4('0xb')](_0x5c9b2b,_0x2d20cb)[_0x9ac4('0xc')](function(_0x5ecbf4){logger[_0x9ac4('0xd')]('Network,\x20%s,\x20%s',_0x3d35d2,_0x9ac4('0xe'));logger['debug'](_0x9ac4('0xf'),_0x3d35d2,_0x9ac4('0xe'),JSON['stringify'](_0x5ecbf4));if(_0x5ecbf4[_0x9ac4('0x10')]){if(_0x5ecbf4[_0x9ac4('0x10')][_0x9ac4('0x11')]===0x1f4){logger['error'](_0x9ac4('0x12'),_0x3d35d2,_0x5ecbf4[_0x9ac4('0x10')][_0x9ac4('0x13')]);return _0xa6cdd(_0x5ecbf4['error'][_0x9ac4('0x13')]);}logger[_0x9ac4('0x10')]('Network,\x20%s,\x20%s',_0x3d35d2,_0x5ecbf4[_0x9ac4('0x10')][_0x9ac4('0x13')]);return _0x31d2c6(_0x5ecbf4[_0x9ac4('0x10')][_0x9ac4('0x13')]);}else{logger[_0x9ac4('0xd')](_0x9ac4('0x12'),_0x3d35d2,_0x9ac4('0xe'));_0x31d2c6(_0x5ecbf4[_0x9ac4('0x14')][_0x9ac4('0x13')]);}})[_0x9ac4('0x15')](function(_0x4f6053){logger[_0x9ac4('0x10')](_0x9ac4('0x12'),_0x3d35d2,_0x4f6053);_0xa6cdd(_0x4f6053);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index ea23e46..2901395 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 _0xe309=['update','delete','destroy','removeDispositions','removeAgents','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getInteractions','getAgents','post','create','addDisposition','addAnswer','/:id/notify','addApplications','/:id/users','addAgents','send'];(function(_0x53d172,_0x46611b){var _0x1bd0a2=function(_0x19fb52){while(--_0x19fb52){_0x53d172['push'](_0x53d172['shift']());}};_0x1bd0a2(++_0x46611b);}(_0xe309,0x1f4));var _0x9e30=function(_0x2fbe6a,_0x327090){_0x2fbe6a=_0x2fbe6a-0x0;var _0x3ce1c1=_0xe309[_0x2fbe6a];return _0x3ce1c1;};'use strict';var multer=require(_0x9e30('0x0'));var util=require('util');var path=require(_0x9e30('0x1'));var express=require('express');var router=express[_0x9e30('0x2')]();var auth=require(_0x9e30('0x3'));var interaction=require(_0x9e30('0x4'));var config=require(_0x9e30('0x5'));var controller=require('./openchannelAccount.controller');router[_0x9e30('0x6')]('/',auth[_0x9e30('0x7')](),controller[_0x9e30('0x8')]);router[_0x9e30('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x9e30('0x9')]);router[_0x9e30('0x6')](_0x9e30('0xa'),auth[_0x9e30('0x7')](),controller[_0x9e30('0xb')]);router[_0x9e30('0x6')](_0x9e30('0xc'),auth[_0x9e30('0x7')](),controller[_0x9e30('0xd')]);router[_0x9e30('0x6')](_0x9e30('0xe'),auth[_0x9e30('0x7')](),controller[_0x9e30('0xf')]);router[_0x9e30('0x6')](_0x9e30('0x10'),auth[_0x9e30('0x7')](),controller['getApplications']);router['get']('/:id/interactions',auth[_0x9e30('0x7')](),controller[_0x9e30('0x11')]);router[_0x9e30('0x6')]('/:id/users',auth[_0x9e30('0x7')](),controller[_0x9e30('0x12')]);router[_0x9e30('0x13')]('/',auth[_0x9e30('0x7')](),controller[_0x9e30('0x14')]);router[_0x9e30('0x13')](_0x9e30('0xc'),auth['isAuthenticated'](),controller[_0x9e30('0x15')]);router[_0x9e30('0x13')](_0x9e30('0xe'),auth[_0x9e30('0x7')](),controller[_0x9e30('0x16')]);router[_0x9e30('0x13')](_0x9e30('0x17'),controller['notify']);router[_0x9e30('0x13')](_0x9e30('0x10'),auth[_0x9e30('0x7')](),controller[_0x9e30('0x18')]);router['post'](_0x9e30('0x19'),auth[_0x9e30('0x7')](),controller[_0x9e30('0x1a')]);router[_0x9e30('0x13')]('/:id/send',auth[_0x9e30('0x7')](),controller[_0x9e30('0x1b')]);router['put'](_0x9e30('0xa'),auth['isAuthenticated'](),controller[_0x9e30('0x1c')]);router[_0x9e30('0x1d')]('/:id',auth[_0x9e30('0x7')](),controller[_0x9e30('0x1e')]);router['delete'](_0x9e30('0xc'),auth[_0x9e30('0x7')](),controller[_0x9e30('0x1f')]);router['delete'](_0x9e30('0xe'),auth[_0x9e30('0x7')](),controller['removeAnswers']);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x9e30('0x20')]);module['exports']=router; \ No newline at end of file +var _0xf2e5=['../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','addDisposition','addAnswer','notify','addApplications','addAgents','/:id/send','put','/:id','destroy','delete','removeAnswers','removeAgents','exports','multer','util','path','express','Router'];(function(_0x532f94,_0x3cdfc0){var _0x145da5=function(_0x28b97d){while(--_0x28b97d){_0x532f94['push'](_0x532f94['shift']());}};_0x145da5(++_0x3cdfc0);}(_0xf2e5,0x1e5));var _0x5f2e=function(_0x31826c,_0x1995c5){_0x31826c=_0x31826c-0x0;var _0x20bbd7=_0xf2e5[_0x31826c];return _0x20bbd7;};'use strict';var multer=require(_0x5f2e('0x0'));var util=require(_0x5f2e('0x1'));var path=require(_0x5f2e('0x2'));var express=require(_0x5f2e('0x3'));var router=express[_0x5f2e('0x4')]();var auth=require(_0x5f2e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5f2e('0x6'));var controller=require(_0x5f2e('0x7'));router[_0x5f2e('0x8')]('/',auth[_0x5f2e('0x9')](),controller['index']);router[_0x5f2e('0x8')]('/describe',auth[_0x5f2e('0x9')](),controller[_0x5f2e('0xa')]);router[_0x5f2e('0x8')]('/:id',auth[_0x5f2e('0x9')](),controller[_0x5f2e('0xb')]);router['get'](_0x5f2e('0xc'),auth[_0x5f2e('0x9')](),controller['getDispositions']);router['get'](_0x5f2e('0xd'),auth[_0x5f2e('0x9')](),controller[_0x5f2e('0xe')]);router['get'](_0x5f2e('0xf'),auth['isAuthenticated'](),controller[_0x5f2e('0x10')]);router[_0x5f2e('0x8')](_0x5f2e('0x11'),auth[_0x5f2e('0x9')](),controller[_0x5f2e('0x12')]);router[_0x5f2e('0x8')](_0x5f2e('0x13'),auth[_0x5f2e('0x9')](),controller['getAgents']);router[_0x5f2e('0x14')]('/',auth[_0x5f2e('0x9')](),controller[_0x5f2e('0x15')]);router[_0x5f2e('0x14')](_0x5f2e('0xc'),auth[_0x5f2e('0x9')](),controller[_0x5f2e('0x16')]);router[_0x5f2e('0x14')](_0x5f2e('0xd'),auth[_0x5f2e('0x9')](),controller[_0x5f2e('0x17')]);router[_0x5f2e('0x14')]('/:id/notify',controller[_0x5f2e('0x18')]);router['post'](_0x5f2e('0xf'),auth[_0x5f2e('0x9')](),controller[_0x5f2e('0x19')]);router[_0x5f2e('0x14')]('/:id/users',auth[_0x5f2e('0x9')](),controller[_0x5f2e('0x1a')]);router[_0x5f2e('0x14')](_0x5f2e('0x1b'),auth['isAuthenticated'](),controller['send']);router[_0x5f2e('0x1c')](_0x5f2e('0x1d'),auth[_0x5f2e('0x9')](),controller['update']);router['delete'](_0x5f2e('0x1d'),auth[_0x5f2e('0x9')](),controller[_0x5f2e('0x1e')]);router[_0x5f2e('0x1f')](_0x5f2e('0xc'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x5f2e('0x1f')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x5f2e('0x20')]);router['delete'](_0x5f2e('0x13'),auth[_0x5f2e('0x9')](),controller[_0x5f2e('0x21')]);module[_0x5f2e('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 50cd1a6..2ee17af 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 _0x3e74=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','sequelize','exports','STRING','name','generate'];(function(_0x38312b,_0xbddfbc){var _0x3df78a=function(_0x179424){while(--_0x179424){_0x38312b['push'](_0x38312b['shift']());}};_0x3df78a(++_0xbddfbc);}(_0x3e74,0x175));var _0x43e7=function(_0x360d39,_0x23b57b){_0x360d39=_0x360d39-0x0;var _0x106998=_0x3e74[_0x360d39];return _0x106998;};'use strict';var Sequelize=require(_0x43e7('0x0'));var rs=require('randomstring');module[_0x43e7('0x1')]={'name':{'type':Sequelize[_0x43e7('0x2')],'unique':_0x43e7('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x43e7('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x43e7('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x43e7('0x5')],'defaultValue':function(){return _0x43e7('0x6');}},'notificationSound':{'type':Sequelize[_0x43e7('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x43e7('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x43e7('0x2')]},'queueTransfer':{'type':Sequelize[_0x43e7('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x43e7('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x43e7('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x43e7('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c}}; \ No newline at end of file +var _0x00bb=['generate','TEXT','INTEGER','BOOLEAN','sequelize','randomstring','exports','name','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x00bb[_0x4baae2];return _0x1a2285;};'use strict';var Sequelize=require(_0xb00b('0x0'));var rs=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xb00b('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xb00b('0x4')],'defaultValue':function(){return rs[_0xb00b('0x5')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xb00b('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb00b('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb00b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xb00b('0x4')]},'queueTransfer':{'type':Sequelize[_0xb00b('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb00b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb00b('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb00b('0x7')],'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 e1f2b70..6eafa3b 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 _0xa5fa=['EventManager','addApplications','transaction','OpenchannelApplication','bulkCreate','priority','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','DESC','user','OpenchannelMessage','Messages','dataValues','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','localhost','jayson/promise','http','client','request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','offset','limit','set','apply','update','destroy','end','stack','name','send','index','OpenchannelAccount','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','filter','map','options','count','includeAll','include','findAll','rows','show','params','merge','find','create','body','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','findOne','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','createdAt','updatedAt','ListId','from','ValidationError','from\x20is\x20mandatory','isNil','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','Applications','applications','list','asc','account','defaults','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','get','created','interaction','push','close','unmanaged','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting'];(function(_0x3c4453,_0x47f08d){var _0x1791e5=function(_0x144921){while(--_0x144921){_0x3c4453['push'](_0x3c4453['shift']());}};_0x1791e5(++_0x47f08d);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x3765e2,_0x4e1fba){_0x3765e2=_0x3765e2-0x0;var _0x144efb=_0xa5fa[_0x3765e2];return _0x144efb;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xaa5f('0x0'));var moment=require(_0xaa5f('0x1'));var BPromise=require(_0xaa5f('0x2'));var Mustache=require(_0xaa5f('0x3'));var util=require('util');var path=require(_0xaa5f('0x4'));var sox=require(_0xaa5f('0x5'));var csv=require('to-csv');var ejs=require(_0xaa5f('0x6'));var fs=require('fs');var _=require(_0xaa5f('0x7'));var squel=require(_0xaa5f('0x8'));var crypto=require(_0xaa5f('0x9'));var jsforce=require(_0xaa5f('0xa'));var deskjs=require(_0xaa5f('0xb'));var toCsv=require(_0xaa5f('0xc'));var querystring=require(_0xaa5f('0xd'));var Papa=require(_0xaa5f('0xe'));var qs=require(_0xaa5f('0xf'));var logger=require(_0xaa5f('0x10'))('api');var utils=require(_0xaa5f('0x11'));var config=require(_0xaa5f('0x12'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')({'host':_0xaa5f('0x13'),'port':0x18eb});require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0xaa5f('0x14'));var client=jayson['client'][_0xaa5f('0x15')]({'port':0x232c});var client9002=jayson[_0xaa5f('0x16')][_0xaa5f('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x9aeae9,_0x252ae0,_0x48d1d3,_0xbd4e10){return new BPromise(function(_0x552c53,_0x372881){var _0x23f872=_0xbd4e10||client;return _0x23f872[_0xaa5f('0x17')](_0x9aeae9,_0x48d1d3)[_0xaa5f('0x18')](function(_0x2e1ca5){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x252ae0,_0xaa5f('0x19'));logger[_0xaa5f('0x1a')](_0xaa5f('0x1b'),_0x252ae0,_0xaa5f('0x19'),JSON[_0xaa5f('0x1c')](_0x2e1ca5));if(_0x2e1ca5[_0xaa5f('0x1d')]){if(_0x2e1ca5[_0xaa5f('0x1d')][_0xaa5f('0x1e')]===0x1f4){logger[_0xaa5f('0x1d')](_0xaa5f('0x1f'),_0x252ae0,_0x2e1ca5[_0xaa5f('0x1d')][_0xaa5f('0x20')]);return _0x372881(_0x2e1ca5['error'][_0xaa5f('0x20')]);}logger[_0xaa5f('0x1d')](_0xaa5f('0x1f'),_0x252ae0,_0x2e1ca5[_0xaa5f('0x1d')][_0xaa5f('0x20')]);return _0x552c53(_0x2e1ca5[_0xaa5f('0x1d')][_0xaa5f('0x20')]);}else{logger[_0xaa5f('0x21')](_0xaa5f('0x1f'),_0x252ae0,_0xaa5f('0x19'));_0x552c53(_0x2e1ca5[_0xaa5f('0x22')][_0xaa5f('0x20')]);}})[_0xaa5f('0x23')](function(_0x5238a8){logger[_0xaa5f('0x1d')]('OpenchannelAccount,\x20%s,\x20%s',_0x252ae0,_0x5238a8);_0x372881(_0x5238a8);});});}function respondWithStatusCode(_0x2e04e6,_0x34ca72){_0x34ca72=_0x34ca72||0xcc;return function(_0x561381){if(_0x561381){return _0x2e04e6[_0xaa5f('0x24')](_0x34ca72);}return _0x2e04e6[_0xaa5f('0x25')](_0x34ca72)['end']();};}function respondWithResult(_0xf6a8c3,_0x15f70b){_0x15f70b=_0x15f70b||0xc8;return function(_0x32cd16){if(_0x32cd16){return _0xf6a8c3[_0xaa5f('0x25')](_0x15f70b)[_0xaa5f('0x26')](_0x32cd16);}};}function respondWithFilteredResult(_0xacbded,_0x3d7bca){return function(_0x2fba7d){if(_0x2fba7d){var _0x51eb55=_0x2fba7d['count'],_0x2445a6=_0x3d7bca[_0xaa5f('0x27')],_0x3a66e8=_0x3d7bca[_0xaa5f('0x27')]+_0x3d7bca[_0xaa5f('0x28')],_0x1ed8eb;if(_0x3a66e8>=_0x51eb55){_0x3a66e8=_0x51eb55;_0x1ed8eb=0xc8;}else{_0x1ed8eb=0xce;}_0xacbded['status'](_0x1ed8eb);return _0xacbded[_0xaa5f('0x29')]('Content-Range',_0x2445a6+'-'+_0x3a66e8+'/'+_0x51eb55)['json'](_0x2fba7d);}return null;};}function patchUpdates(_0x27d1a4){return function(_0x50998f){try{jsonpatch[_0xaa5f('0x2a')](_0x50998f,_0x27d1a4,!![]);}catch(_0x4e0ec9){return BPromise['reject'](_0x4e0ec9);}return _0x50998f['save']();};}function saveUpdates(_0x26a90d,_0x4ddebd){return function(_0x310828){if(_0x310828){return _0x310828[_0xaa5f('0x2b')](_0x26a90d)['then'](function(_0x58f608){return _0x58f608;});}return null;};}function removeEntity(_0x169637,_0x5e858a){return function(_0x13e1bb){if(_0x13e1bb){return _0x13e1bb[_0xaa5f('0x2c')]()['then'](function(){_0x169637[_0xaa5f('0x25')](0xcc)[_0xaa5f('0x2d')]();});}};}function handleEntityNotFound(_0x9c733b,_0x5d3f84){return function(_0xecaac7){if(!_0xecaac7){_0x9c733b[_0xaa5f('0x24')](0x194);}return _0xecaac7;};}function handleError(_0x527866,_0x57591f){_0x57591f=_0x57591f||0x1f4;return function(_0x586210){logger['error'](_0x586210[_0xaa5f('0x2e')]);if(_0x586210[_0xaa5f('0x2f')]){delete _0x586210[_0xaa5f('0x2f')];}_0x527866[_0xaa5f('0x25')](_0x57591f)[_0xaa5f('0x30')](_0x586210);};}exports[_0xaa5f('0x31')]=function(_0x3887dd,_0x501dc3){var _0x1ab07f={},_0x32a678={},_0x440845={'count':0x0,'rows':[]};var _0x1f3268=db[_0xaa5f('0x32')][_0xaa5f('0x33')];_0x32a678['model']=_[_0xaa5f('0x34')](_0x1f3268);var _0x3131c2={'dateStart':_0x3887dd[_0xaa5f('0x35')][_0xaa5f('0x36')],'dateEnd':_0x3887dd[_0xaa5f('0x35')]['dateEnd']};delete _0x3887dd['query'][_0xaa5f('0x36')];delete _0x3887dd[_0xaa5f('0x35')][_0xaa5f('0x37')];_0x32a678[_0xaa5f('0x35')]=_['keys'](_0x3887dd[_0xaa5f('0x35')]);_0x32a678[_0xaa5f('0x38')]=_[_0xaa5f('0x39')](_0x32a678[_0xaa5f('0x3a')],_0x32a678[_0xaa5f('0x35')]);_0x1ab07f[_0xaa5f('0x3b')]=_[_0xaa5f('0x39')](_0x32a678[_0xaa5f('0x3a')],qs[_0xaa5f('0x3c')](_0x3887dd[_0xaa5f('0x35')][_0xaa5f('0x3c')]));_0x1ab07f['attributes']=_0x1ab07f[_0xaa5f('0x3b')][_0xaa5f('0x3d')]?_0x1ab07f[_0xaa5f('0x3b')]:_0x32a678[_0xaa5f('0x3a')];if(!_0x3887dd[_0xaa5f('0x35')][_0xaa5f('0x3e')](_0xaa5f('0x3f'))){_0x1ab07f[_0xaa5f('0x28')]=qs[_0xaa5f('0x28')](_0x3887dd[_0xaa5f('0x35')]['limit']);_0x1ab07f[_0xaa5f('0x27')]=qs['offset'](_0x3887dd[_0xaa5f('0x35')][_0xaa5f('0x27')]);}_0x1ab07f[_0xaa5f('0x40')]=qs['sort'](_0x3887dd[_0xaa5f('0x35')][_0xaa5f('0x41')]);_0x1ab07f[_0xaa5f('0x42')]=qs['filters'](_[_0xaa5f('0x43')](_0x3887dd[_0xaa5f('0x35')],_0x32a678[_0xaa5f('0x38')]));if(_0x3131c2[_0xaa5f('0x36')]){if(_0x3131c2['dateEnd']){_0x3131c2[_0xaa5f('0x37')]=moment(_0x3131c2[_0xaa5f('0x37')])[_0xaa5f('0x44')](0x1,_0xaa5f('0x45'));}else{_0x3131c2[_0xaa5f('0x37')]=moment(_0x3131c2[_0xaa5f('0x36')])[_0xaa5f('0x44')](0x1,_0xaa5f('0x45'));}_['merge'](_0x1ab07f[_0xaa5f('0x42')],{'createdAt':{'$gte':_0x3131c2['dateStart'],'$lte':_0x3131c2[_0xaa5f('0x37')]}});}if(_0x3887dd['query'][_0xaa5f('0x46')]){_0x1ab07f[_0xaa5f('0x42')]=_['merge'](_0x1ab07f[_0xaa5f('0x42')],{'$or':_[_0xaa5f('0x47')](_0x1ab07f[_0xaa5f('0x3b')],function(_0x5151ce){var _0x53343a={};_0x53343a[_0x5151ce]={'$like':'%'+_0x3887dd['query'][_0xaa5f('0x46')]+'%'};return _0x53343a;})});}_0x1ab07f=_['merge']({},_0x1ab07f,_0x3887dd[_0xaa5f('0x48')]);var _0x44600c={'where':_0x1ab07f[_0xaa5f('0x42')]};return db[_0xaa5f('0x32')]['count'](_0x44600c)[_0xaa5f('0x18')](function(_0x187542){_0x440845[_0xaa5f('0x49')]=_0x187542;if(_0x3887dd[_0xaa5f('0x35')][_0xaa5f('0x4a')]){_0x1ab07f[_0xaa5f('0x4b')]=[{'all':!![]}];}return db[_0xaa5f('0x32')][_0xaa5f('0x4c')](_0x1ab07f);})[_0xaa5f('0x18')](function(_0x16f8bf){_0x440845[_0xaa5f('0x4d')]=_0x16f8bf;return _0x440845;})[_0xaa5f('0x18')](respondWithFilteredResult(_0x501dc3,_0x1ab07f))[_0xaa5f('0x23')](handleError(_0x501dc3,null));};exports[_0xaa5f('0x4e')]=function(_0x690fcc,_0x803c2d){var _0x554e6d={'raw':![],'where':{'id':_0x690fcc[_0xaa5f('0x4f')]['id']}},_0x3412f8={};_0x3412f8[_0xaa5f('0x3a')]=_[_0xaa5f('0x34')](db[_0xaa5f('0x32')][_0xaa5f('0x33')]);_0x3412f8[_0xaa5f('0x35')]=_['keys'](_0x690fcc[_0xaa5f('0x35')]);_0x3412f8[_0xaa5f('0x38')]=_[_0xaa5f('0x39')](_0x3412f8[_0xaa5f('0x3a')],_0x3412f8['query']);_0x554e6d[_0xaa5f('0x3b')]=_[_0xaa5f('0x39')](_0x3412f8[_0xaa5f('0x3a')],qs['fields'](_0x690fcc['query']['fields']));_0x554e6d['attributes']=_0x554e6d['attributes']['length']?_0x554e6d[_0xaa5f('0x3b')]:_0x3412f8[_0xaa5f('0x3a')];if(_0x690fcc[_0xaa5f('0x35')][_0xaa5f('0x4a')]){_0x554e6d[_0xaa5f('0x4b')]=[{'all':!![]}];}_0x554e6d=_[_0xaa5f('0x50')]({},_0x554e6d,_0x690fcc['options']);return db['OpenchannelAccount'][_0xaa5f('0x51')](_0x554e6d)[_0xaa5f('0x18')](handleEntityNotFound(_0x803c2d,null))['then'](respondWithResult(_0x803c2d,null))[_0xaa5f('0x23')](handleError(_0x803c2d,null));};exports[_0xaa5f('0x52')]=function(_0x2b815d,_0x294657){return db[_0xaa5f('0x32')][_0xaa5f('0x52')](_0x2b815d[_0xaa5f('0x53')],{})['then'](respondWithResult(_0x294657,0xc9))['catch'](handleError(_0x294657,null));};exports[_0xaa5f('0x2b')]=function(_0x2ba3e6,_0x5da797){if(_0x2ba3e6['body']['id']){delete _0x2ba3e6['body']['id'];}return db[_0xaa5f('0x32')]['find']({'where':{'id':_0x2ba3e6[_0xaa5f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5da797,null))['then'](saveUpdates(_0x2ba3e6[_0xaa5f('0x53')],null))[_0xaa5f('0x18')](respondWithResult(_0x5da797,null))[_0xaa5f('0x23')](handleError(_0x5da797,null));};exports['destroy']=function(_0x3630c2,_0x239e51){return db[_0xaa5f('0x32')]['find']({'where':{'id':_0x3630c2[_0xaa5f('0x4f')]['id']}})[_0xaa5f('0x18')](handleEntityNotFound(_0x239e51,null))['then'](removeEntity(_0x239e51,null))[_0xaa5f('0x23')](handleError(_0x239e51,null));};exports[_0xaa5f('0x54')]=function(_0x455702,_0x3fdc46){return db[_0xaa5f('0x32')][_0xaa5f('0x54')]()[_0xaa5f('0x18')](respondWithResult(_0x3fdc46,null))[_0xaa5f('0x23')](handleError(_0x3fdc46,null));};exports[_0xaa5f('0x55')]=function(_0x5ed3b8,_0x7e4313,_0x199360){if(_0x5ed3b8[_0xaa5f('0x53')]['id']){delete _0x5ed3b8[_0xaa5f('0x53')]['id'];}return db[_0xaa5f('0x32')][_0xaa5f('0x51')]({'where':{'id':_0x5ed3b8[_0xaa5f('0x4f')]['id']}})[_0xaa5f('0x18')](handleEntityNotFound(_0x7e4313,null))['then'](function(_0x436b9e){if(_0x436b9e){_0x5ed3b8['body'][_0xaa5f('0x56')]=_0x436b9e['id'];return db[_0xaa5f('0x57')][_0xaa5f('0x52')](_0x5ed3b8[_0xaa5f('0x53')]);}})['then'](respondWithResult(_0x7e4313,null))[_0xaa5f('0x23')](handleError(_0x7e4313,null));};exports[_0xaa5f('0x58')]=function(_0x36384b,_0x4cb590,_0x2c5b30){var _0x524f42={'raw':![],'where':{}};var _0x42ea3b={};var _0x5e7a74={'count':0x0,'rows':[]};return db[_0xaa5f('0x32')][_0xaa5f('0x59')]({'where':{'id':_0x36384b[_0xaa5f('0x4f')]['id']}})[_0xaa5f('0x18')](handleEntityNotFound(_0x4cb590,null))['then'](function(_0x3f5ced){if(_0x3f5ced){_0x42ea3b[_0xaa5f('0x3a')]=_['keys'](db['Disposition'][_0xaa5f('0x33')]);_0x42ea3b[_0xaa5f('0x35')]=_['keys'](_0x36384b[_0xaa5f('0x35')]);_0x42ea3b[_0xaa5f('0x38')]=_[_0xaa5f('0x39')](_0x42ea3b['model'],_0x42ea3b[_0xaa5f('0x35')]);_0x524f42[_0xaa5f('0x3b')]=_['intersection'](_0x42ea3b[_0xaa5f('0x3a')],qs[_0xaa5f('0x3c')](_0x36384b[_0xaa5f('0x35')]['fields']));_0x524f42[_0xaa5f('0x3b')]=_0x524f42[_0xaa5f('0x3b')]['length']?_0x524f42[_0xaa5f('0x3b')]:_0x42ea3b[_0xaa5f('0x3a')];if(!_0x36384b[_0xaa5f('0x35')][_0xaa5f('0x3e')](_0xaa5f('0x3f'))){_0x524f42['limit']=qs[_0xaa5f('0x28')](_0x36384b[_0xaa5f('0x35')][_0xaa5f('0x28')]);_0x524f42[_0xaa5f('0x27')]=qs[_0xaa5f('0x27')](_0x36384b['query'][_0xaa5f('0x27')]);}_0x524f42['order']=qs[_0xaa5f('0x41')](_0x36384b[_0xaa5f('0x35')][_0xaa5f('0x41')]);_0x524f42[_0xaa5f('0x42')]=qs['filters'](_[_0xaa5f('0x43')](_0x36384b[_0xaa5f('0x35')],_0x42ea3b[_0xaa5f('0x38')]));_0x524f42[_0xaa5f('0x42')][_0xaa5f('0x5a')]=_0x3f5ced['id'];if(_0x36384b[_0xaa5f('0x35')]['filter']){_0x524f42['where']=_[_0xaa5f('0x50')](_0x524f42[_0xaa5f('0x42')],{'$or':_[_0xaa5f('0x47')](_0x524f42[_0xaa5f('0x3b')],function(_0x461cab){var _0x5dc6df={};_0x5dc6df[_0x461cab]={'$like':'%'+_0x36384b['query'][_0xaa5f('0x46')]+'%'};return _0x5dc6df;})});}_0x524f42=_[_0xaa5f('0x50')]({},_0x524f42,_0x36384b['options']);return db[_0xaa5f('0x57')]['count']({'where':_0x524f42[_0xaa5f('0x42')]})[_0xaa5f('0x18')](function(_0x49fd15){_0x5e7a74[_0xaa5f('0x49')]=_0x49fd15;if(_0x36384b[_0xaa5f('0x35')][_0xaa5f('0x4a')]){_0x524f42[_0xaa5f('0x4b')]=[{'all':!![]}];}return db[_0xaa5f('0x57')][_0xaa5f('0x4c')](_0x524f42);})[_0xaa5f('0x18')](function(_0x59e2be){_0x5e7a74[_0xaa5f('0x4d')]=_0x59e2be;return _0x5e7a74;});}})[_0xaa5f('0x18')](respondWithFilteredResult(_0x4cb590,_0x524f42))[_0xaa5f('0x23')](handleError(_0x4cb590,null));};exports['removeDispositions']=function(_0x12fedd,_0x1376e1,_0x3c11c7){var _0xf30b84;return db[_0xaa5f('0x32')]['find']({'where':{'id':_0x12fedd[_0xaa5f('0x4f')]['id']}})[_0xaa5f('0x18')](handleEntityNotFound(_0x1376e1,null))[_0xaa5f('0x18')](function(_0x23cccb){if(_0x23cccb){return _0x23cccb[_0xaa5f('0x5b')](_0x12fedd[_0xaa5f('0x35')][_0xaa5f('0x5c')]);}})[_0xaa5f('0x18')](respondWithStatusCode(_0x1376e1,null))[_0xaa5f('0x23')](handleError(_0x1376e1,null));};exports[_0xaa5f('0x5d')]=function(_0x47bf08,_0x4f24f9,_0xb7292d){if(_0x47bf08[_0xaa5f('0x53')]['id']){delete _0x47bf08[_0xaa5f('0x53')]['id'];}return db[_0xaa5f('0x32')][_0xaa5f('0x51')]({'where':{'id':_0x47bf08[_0xaa5f('0x4f')]['id']}})[_0xaa5f('0x18')](handleEntityNotFound(_0x4f24f9,null))[_0xaa5f('0x18')](function(_0x59c314){if(_0x59c314){_0x47bf08[_0xaa5f('0x53')][_0xaa5f('0x5a')]=_0x59c314['id'];return db[_0xaa5f('0x5e')]['create'](_0x47bf08['body']);}})[_0xaa5f('0x18')](respondWithResult(_0x4f24f9,null))[_0xaa5f('0x23')](handleError(_0x4f24f9,null));};exports[_0xaa5f('0x5f')]=function(_0x2ccb31,_0x31e252,_0x46d08b){var _0x47786e={'raw':![],'where':{}};var _0x284194={};var _0x39c2d5={'count':0x0,'rows':[]};return db[_0xaa5f('0x32')]['findOne']({'where':{'id':_0x2ccb31[_0xaa5f('0x4f')]['id']}})[_0xaa5f('0x18')](handleEntityNotFound(_0x31e252,null))[_0xaa5f('0x18')](function(_0x46ab86){if(_0x46ab86){_0x284194[_0xaa5f('0x3a')]=_['keys'](db[_0xaa5f('0x5e')][_0xaa5f('0x33')]);_0x284194[_0xaa5f('0x35')]=_['keys'](_0x2ccb31['query']);_0x284194['filters']=_[_0xaa5f('0x39')](_0x284194[_0xaa5f('0x3a')],_0x284194[_0xaa5f('0x35')]);_0x47786e[_0xaa5f('0x3b')]=_['intersection'](_0x284194[_0xaa5f('0x3a')],qs[_0xaa5f('0x3c')](_0x2ccb31[_0xaa5f('0x35')][_0xaa5f('0x3c')]));_0x47786e[_0xaa5f('0x3b')]=_0x47786e[_0xaa5f('0x3b')][_0xaa5f('0x3d')]?_0x47786e[_0xaa5f('0x3b')]:_0x284194[_0xaa5f('0x3a')];if(!_0x2ccb31[_0xaa5f('0x35')][_0xaa5f('0x3e')](_0xaa5f('0x3f'))){_0x47786e[_0xaa5f('0x28')]=qs[_0xaa5f('0x28')](_0x2ccb31[_0xaa5f('0x35')][_0xaa5f('0x28')]);_0x47786e[_0xaa5f('0x27')]=qs[_0xaa5f('0x27')](_0x2ccb31[_0xaa5f('0x35')]['offset']);}_0x47786e[_0xaa5f('0x40')]=qs[_0xaa5f('0x41')](_0x2ccb31[_0xaa5f('0x35')][_0xaa5f('0x41')]);_0x47786e[_0xaa5f('0x42')]=qs['filters'](_[_0xaa5f('0x43')](_0x2ccb31['query'],_0x284194[_0xaa5f('0x38')]));_0x47786e[_0xaa5f('0x42')][_0xaa5f('0x5a')]=_0x46ab86['id'];if(_0x2ccb31[_0xaa5f('0x35')][_0xaa5f('0x46')]){_0x47786e[_0xaa5f('0x42')]=_[_0xaa5f('0x50')](_0x47786e['where'],{'$or':_[_0xaa5f('0x47')](_0x47786e['attributes'],function(_0x9f4d9d){var _0x40f2fa={};_0x40f2fa[_0x9f4d9d]={'$like':'%'+_0x2ccb31[_0xaa5f('0x35')][_0xaa5f('0x46')]+'%'};return _0x40f2fa;})});}_0x47786e=_['merge']({},_0x47786e,_0x2ccb31[_0xaa5f('0x48')]);return db['CannedAnswer'][_0xaa5f('0x49')]({'where':_0x47786e['where']})[_0xaa5f('0x18')](function(_0x517b5b){_0x39c2d5[_0xaa5f('0x49')]=_0x517b5b;if(_0x2ccb31[_0xaa5f('0x35')][_0xaa5f('0x4a')]){_0x47786e[_0xaa5f('0x4b')]=[{'all':!![]}];}return db['CannedAnswer'][_0xaa5f('0x4c')](_0x47786e);})['then'](function(_0x21d7b5){_0x39c2d5[_0xaa5f('0x4d')]=_0x21d7b5;return _0x39c2d5;});}})[_0xaa5f('0x18')](respondWithFilteredResult(_0x31e252,_0x47786e))[_0xaa5f('0x23')](handleError(_0x31e252,null));};exports[_0xaa5f('0x60')]=function(_0x59196a,_0x25f710,_0x1e74dc){var _0x226e45;return db[_0xaa5f('0x32')][_0xaa5f('0x51')]({'where':{'id':_0x59196a[_0xaa5f('0x4f')]['id']}})[_0xaa5f('0x18')](handleEntityNotFound(_0x25f710,null))[_0xaa5f('0x18')](function(_0x46b920){if(_0x46b920){return _0x46b920['removeAnswers'](_0x59196a[_0xaa5f('0x35')][_0xaa5f('0x5c')]);}})[_0xaa5f('0x18')](respondWithStatusCode(_0x25f710,null))[_0xaa5f('0x23')](handleError(_0x25f710,null));};exports[_0xaa5f('0x61')]=function(_0x4acc9c,_0xf707e6,_0x17e27c){var _0x4d368d={'body':_0x4acc9c[_0xaa5f('0x53')],'channel':_0xaa5f('0x62')};var _0x476a2b=[];var _0x4c4378=[];var _0x4b10ac={};var _0x130c6b=![];return db['CmContact']['describe']()['then'](function(_0x599a7c){if(!_0x599a7c){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x476a2b=_['difference'](_[_0xaa5f('0x34')](_0x599a7c),[_0xaa5f('0x63'),_0xaa5f('0x64')]);_0x4c4378=_['difference'](_[_0xaa5f('0x34')](_0x599a7c),[_0xaa5f('0x63'),_0xaa5f('0x64'),'CompanyId',_0xaa5f('0x65')]);if(_0x4acc9c[_0xaa5f('0x53')]['id']){delete _0x4acc9c[_0xaa5f('0x53')]['id'];}if(_['isNil'](_0x4acc9c[_0xaa5f('0x53')][_0xaa5f('0x66')])){throw new db['Sequelize'][(_0xaa5f('0x67'))](_0xaa5f('0x68'));}if(_[_0xaa5f('0x69')](_0x4acc9c[_0xaa5f('0x53')][_0xaa5f('0x53')])||_0x4acc9c[_0xaa5f('0x53')][_0xaa5f('0x53')]===''){throw new db[(_0xaa5f('0x6a'))][(_0xaa5f('0x67'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xaa5f('0x69')](_0x4acc9c[_0xaa5f('0x53')]['mapKey'])){throw new db[(_0xaa5f('0x6a'))][(_0xaa5f('0x67'))](_0xaa5f('0x6b')+_0x4c4378);}if(!_[_0xaa5f('0x6c')](_0x4c4378,_0x4acc9c['body'][_0xaa5f('0x6d')])){throw new db[(_0xaa5f('0x6a'))][(_0xaa5f('0x67'))](_0xaa5f('0x6e')+_0x4c4378);}_0x4b10ac[_0x4acc9c[_0xaa5f('0x53')][_0xaa5f('0x6d')]]=_0x4acc9c[_0xaa5f('0x53')]['from'];})['then'](function(){return db[_0xaa5f('0x32')][_0xaa5f('0x51')]({'where':{'id':_0x4acc9c[_0xaa5f('0x4f')]['id']},'include':[{'model':db[_0xaa5f('0x6f')],'as':_0xaa5f('0x70'),'include':[{'model':db[_0xaa5f('0x71')],'as':_0xaa5f('0x72'),'where':_0x4b10ac,'limit':0x1,'order':[[_0xaa5f('0x64'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0xaa5f('0x73')}]});})[_0xaa5f('0x18')](handleEntityNotFound(_0xf707e6,null))['then'](function(_0x2303ef){if(_0x2303ef&&_0x2303ef[_0xaa5f('0x70')]){_0x4d368d['account']=_0x2303ef;_0x4d368d[_0xaa5f('0x74')]=_0x2303ef[_0xaa5f('0x73')];_0x4d368d[_0xaa5f('0x75')]=_0x2303ef[_0xaa5f('0x70')];_0x4d368d[_0xaa5f('0x74')]=_['orderBy'](_0x4d368d[_0xaa5f('0x74')],['priority'],[_0xaa5f('0x76')]);if(_0x4d368d[_0xaa5f('0x77')][_0xaa5f('0x73')]){delete _0x4d368d['account'][_0xaa5f('0x73')];}if(_0x4d368d[_0xaa5f('0x77')][_0xaa5f('0x70')]&&_0x4d368d[_0xaa5f('0x77')][_0xaa5f('0x70')][_0xaa5f('0x72')][_0xaa5f('0x3d')]){return _0x4d368d[_0xaa5f('0x77')][_0xaa5f('0x70')][_0xaa5f('0x72')][0x0];}var _0x51757b=_[_0xaa5f('0x78')](_0x4acc9c[_0xaa5f('0x53')],{'firstName':_0x4acc9c[_0xaa5f('0x53')][_0xaa5f('0x66')],'ListId':_0x2303ef['ListId']});_0x51757b[_0x4acc9c[_0xaa5f('0x53')][_0xaa5f('0x6d')]]=_0x4acc9c[_0xaa5f('0x53')][_0xaa5f('0x66')];return db['CmContact']['create'](_0x51757b,{'fields':_0x476a2b,'raw':!![]});}})[_0xaa5f('0x18')](handleEntityNotFound(_0xf707e6,null))[_0xaa5f('0x18')](function(_0x513a69){_0x4d368d['contact']=_0x513a69;if(_0x513a69){var _0xcc51f5={'ContactId':_0x513a69['id'],'OpenchannelAccountId':_0x4acc9c['params']['id'],'from':(_0x513a69[_0xaa5f('0x79')]||'')+'\x20'+(_0x513a69[_0xaa5f('0x7a')]||'')};var _0x11fc30={'OpenchannelAccountId':_0x4acc9c[_0xaa5f('0x4f')]['id'],'closed':![]};if(_0x4acc9c[_0xaa5f('0x53')][_0xaa5f('0x7b')]){_0x11fc30[_0xaa5f('0x7b')]=_0x4acc9c[_0xaa5f('0x53')][_0xaa5f('0x7b')];return db[_0xaa5f('0x7c')]['find']({'where':_0x11fc30})[_0xaa5f('0x18')](function(_0x23a565){if(_0x23a565){return[_0x23a565,![]];}_0xcc51f5['threadId']=_0x4acc9c[_0xaa5f('0x53')]['threadId'];_0xcc51f5['externalUrl']=_0x4acc9c[_0xaa5f('0x53')][_0xaa5f('0x7d')];return db[_0xaa5f('0x7c')][_0xaa5f('0x52')](_0xcc51f5)[_0xaa5f('0x18')](function(_0x316e19){return[_0x316e19,!![]];});});}else{_0x11fc30[_0xaa5f('0x7b')]=null;}_0x11fc30['ContactId']=_0x513a69['id'];return db[_0xaa5f('0x7c')][_0xaa5f('0x51')]({'where':_0x11fc30})['then'](function(_0x3c4e40){if(_0x3c4e40){return[_0x3c4e40,![]];}return db[_0xaa5f('0x7c')][_0xaa5f('0x52')](_0xcc51f5)[_0xaa5f('0x18')](function(_0xf4bae){return[_0xf4bae,!![]];});});}})[_0xaa5f('0x7e')](function(_0x1f06f6,_0x4859fe){if(_0x1f06f6){_0x130c6b=_0x4859fe;if(!_0x4859fe){return _0x1f06f6[_0xaa5f('0x2b')]({'from':(_0x4d368d['contact'][_0xaa5f('0x79')]||'')+'\x20'+(_0x4d368d['contact'][_0xaa5f('0x7a')]||'')});}else{return _0x1f06f6;}}})[_0xaa5f('0x18')](function(_0x5943b7){_0x4d368d['interaction']=_0x5943b7[_0xaa5f('0x7f')]({'plain':!![]});_0x4d368d['interaction'][_0xaa5f('0x80')]=_0x130c6b;if(_0x4d368d[_0xaa5f('0x81')][_0xaa5f('0x80')]){if(_0x4d368d[_0xaa5f('0x77')]['autoclose']){_0x4d368d[_0xaa5f('0x74')][_0xaa5f('0x82')]({'id':0x0,'priority':_0x4d368d[_0xaa5f('0x74')][_0xaa5f('0x3d')]+0x1,'app':_0xaa5f('0x83'),'appdata':_0xaa5f('0x84'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0xaa5f('0x52')]({'body':_0x4acc9c[_0xaa5f('0x53')][_0xaa5f('0x53')],'OpenchannelAccountId':_0x4acc9c[_0xaa5f('0x4f')]['id'],'OpenchannelInteractionId':_0x5943b7['id'],'direction':'in','ContactId':_0x4d368d['contact']['id'],'AttachmentId':_0x4acc9c['body'][_0xaa5f('0x85')]});})[_0xaa5f('0x18')](function(_0x4b7ca0){_0x4d368d[_0xaa5f('0x20')]=_0x4b7ca0;if(_0x4d368d[_0xaa5f('0x81')][_0xaa5f('0x86')]){return db[_0xaa5f('0x87')]['find']({'attributes':['id',_0xaa5f('0x2f')],'where':{'id':_0x4d368d[_0xaa5f('0x81')]['UserId']}})[_0xaa5f('0x18')](function(_0x252685){if(_0x252685){_0x4d368d[_0xaa5f('0x74')][_0xaa5f('0x88')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x252685['name']+','+(_0x4d368d[_0xaa5f('0x77')][_0xaa5f('0x89')]||0xa),'interval':_0xaa5f('0x8a')});_0x4d368d[_0xaa5f('0x8b')]=![];}return respondWithRpcPromise(_0xaa5f('0x8c'),'startRouting',_0x4d368d);});}return respondWithRpcPromise('Start',_0xaa5f('0x8d'),_0x4d368d);})['then'](function(_0x421a7b){respondWithRpcPromise(_0xaa5f('0x8e'),_0xaa5f('0x8e'),{'event':_0xaa5f('0x61'),'message':_0x421a7b},client9002);return _0x421a7b;})['then'](respondWithResult(_0xf707e6,null))['catch'](handleError(_0xf707e6,null));};exports[_0xaa5f('0x8f')]=function(_0x4a9839,_0x58e77e,_0x3688b5){return db[_0xaa5f('0x32')][_0xaa5f('0x59')]({'where':{'id':_0x4a9839[_0xaa5f('0x4f')]['id']}})[_0xaa5f('0x18')](handleEntityNotFound(_0x58e77e,null))['then'](function(_0x59fa62){if(_0x59fa62){return db['sequelize'][_0xaa5f('0x90')](function(_0xf7c2fd){return db[_0xaa5f('0x91')][_0xaa5f('0x2c')]({'where':{'OpenchannelAccountId':_0x4a9839[_0xaa5f('0x4f')]['id']},'transaction':_0xf7c2fd})[_0xaa5f('0x18')](function(_0x2b1757){var _0x2eb534=_['map'](_0x4a9839[_0xaa5f('0x53')],function(_0x181385){_0x181385[_0xaa5f('0x5a')]=_0x4a9839[_0xaa5f('0x4f')]['id'];return _0x181385;});return db[_0xaa5f('0x91')][_0xaa5f('0x92')](_0x2eb534,{'transaction':_0xf7c2fd});});})[_0xaa5f('0x18')](function(){return db[_0xaa5f('0x91')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x4a9839[_0xaa5f('0x4f')]['id']},'order':_0xaa5f('0x93')});});}})[_0xaa5f('0x18')](respondWithResult(_0x58e77e,null))['catch'](handleError(_0x58e77e,null));};exports[_0xaa5f('0x94')]=function(_0x34ca25,_0x743731,_0x12a749){var _0x5440c7={};var _0x14ee5f={};var _0x32566a;var _0x520063;return db['OpenchannelAccount'][_0xaa5f('0x59')]({'where':{'id':_0x34ca25[_0xaa5f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x743731,null))[_0xaa5f('0x18')](function(_0x21f370){if(_0x21f370){_0x32566a=_0x21f370;_0x14ee5f[_0xaa5f('0x3a')]=_['keys'](db[_0xaa5f('0x91')]['rawAttributes']);_0x14ee5f[_0xaa5f('0x35')]=_['keys'](_0x34ca25[_0xaa5f('0x35')]);_0x14ee5f['filters']=_[_0xaa5f('0x39')](_0x14ee5f['model'],_0x14ee5f[_0xaa5f('0x35')]);_0x5440c7[_0xaa5f('0x3b')]=_[_0xaa5f('0x39')](_0x14ee5f['model'],qs[_0xaa5f('0x3c')](_0x34ca25['query']['fields']));_0x5440c7[_0xaa5f('0x3b')]=_0x5440c7[_0xaa5f('0x3b')][_0xaa5f('0x3d')]?_0x5440c7['attributes']:_0x14ee5f[_0xaa5f('0x3a')];_0x5440c7[_0xaa5f('0x40')]=qs[_0xaa5f('0x41')](_0x34ca25[_0xaa5f('0x35')][_0xaa5f('0x41')]);_0x5440c7[_0xaa5f('0x42')]=qs[_0xaa5f('0x38')](_[_0xaa5f('0x43')](_0x34ca25[_0xaa5f('0x35')],_0x14ee5f[_0xaa5f('0x38')]));if(_0x34ca25[_0xaa5f('0x35')]['filter']){_0x5440c7[_0xaa5f('0x42')]=_[_0xaa5f('0x50')](_0x5440c7[_0xaa5f('0x42')],{'$or':_[_0xaa5f('0x47')](_0x5440c7[_0xaa5f('0x3b')],function(_0x495252){var _0xa182b7={};_0xa182b7[_0x495252]={'$like':'%'+_0x34ca25['query'][_0xaa5f('0x46')]+'%'};return _0xa182b7;})});}_0x5440c7=_['merge']({},_0x5440c7,_0x34ca25[_0xaa5f('0x48')]);return _0x32566a['getApplications'](_0x5440c7);}})[_0xaa5f('0x18')](function(_0x18eeb5){if(_0x18eeb5){_0x520063=_0x18eeb5[_0xaa5f('0x3d')];if(!_0x34ca25[_0xaa5f('0x35')]['hasOwnProperty']('nolimit')){_0x5440c7[_0xaa5f('0x28')]=qs[_0xaa5f('0x28')](_0x34ca25['query'][_0xaa5f('0x28')]);_0x5440c7[_0xaa5f('0x27')]=qs[_0xaa5f('0x27')](_0x34ca25[_0xaa5f('0x35')][_0xaa5f('0x27')]);}return _0x32566a[_0xaa5f('0x94')](_0x5440c7);}})[_0xaa5f('0x18')](function(_0x1914d9){if(_0x1914d9){return _0x1914d9?{'count':_0x520063,'rows':_0x1914d9}:null;}})[_0xaa5f('0x18')](respondWithResult(_0x743731,null))[_0xaa5f('0x23')](handleError(_0x743731,null));};exports[_0xaa5f('0x95')]=function(_0x280edc,_0x4f81b4,_0x5564d5){var _0x478c82={'raw':![],'where':{}};var _0x2b5c02={};var _0x443fcb={'count':0x0,'rows':[]};return db[_0xaa5f('0x32')][_0xaa5f('0x59')]({'where':{'id':_0x280edc['params']['id']}})[_0xaa5f('0x18')](handleEntityNotFound(_0x4f81b4,null))[_0xaa5f('0x18')](function(_0x3a989d){if(_0x3a989d){_0x2b5c02['model']=_['keys'](db[_0xaa5f('0x7c')]['rawAttributes']);_0x2b5c02['query']=_['keys'](_0x280edc[_0xaa5f('0x35')]);_0x2b5c02['filters']=_[_0xaa5f('0x39')](_0x2b5c02[_0xaa5f('0x3a')],_0x2b5c02[_0xaa5f('0x35')]);_0x478c82[_0xaa5f('0x3b')]=_[_0xaa5f('0x39')](_0x2b5c02[_0xaa5f('0x3a')],qs[_0xaa5f('0x3c')](_0x280edc[_0xaa5f('0x35')][_0xaa5f('0x3c')]));_0x478c82[_0xaa5f('0x3b')]=_0x478c82['attributes'][_0xaa5f('0x3d')]?_0x478c82[_0xaa5f('0x3b')]:_0x2b5c02[_0xaa5f('0x3a')];if(!_0x280edc[_0xaa5f('0x35')]['hasOwnProperty'](_0xaa5f('0x3f'))){_0x478c82[_0xaa5f('0x28')]=qs['limit'](_0x280edc[_0xaa5f('0x35')][_0xaa5f('0x28')]);_0x478c82[_0xaa5f('0x27')]=qs[_0xaa5f('0x27')](_0x280edc[_0xaa5f('0x35')][_0xaa5f('0x27')]);}_0x478c82[_0xaa5f('0x40')]=qs[_0xaa5f('0x41')](_0x280edc[_0xaa5f('0x35')][_0xaa5f('0x41')]);_0x478c82['where']=qs['filters'](_[_0xaa5f('0x43')](_0x280edc[_0xaa5f('0x35')],_0x2b5c02[_0xaa5f('0x38')]));_0x478c82[_0xaa5f('0x42')][_0xaa5f('0x5a')]=_0x3a989d['id'];if(_0x280edc[_0xaa5f('0x35')][_0xaa5f('0x46')]){_0x478c82[_0xaa5f('0x42')]=_[_0xaa5f('0x50')](_0x478c82['where'],{'$or':_[_0xaa5f('0x47')](_0x478c82[_0xaa5f('0x3b')],function(_0x4bc495){var _0x1d02c8={};_0x1d02c8[_0x4bc495]={'$like':'%'+_0x280edc[_0xaa5f('0x35')][_0xaa5f('0x46')]+'%'};return _0x1d02c8;})});}_0x478c82=_[_0xaa5f('0x50')]({},_0x478c82,_0x280edc[_0xaa5f('0x48')]);return db[_0xaa5f('0x7c')][_0xaa5f('0x49')]({'where':_0x478c82['where']})[_0xaa5f('0x18')](function(_0x460ac8){_0x443fcb[_0xaa5f('0x49')]=_0x460ac8;if(_0x280edc[_0xaa5f('0x35')][_0xaa5f('0x4a')]){_0x478c82[_0xaa5f('0x4b')]=[{'model':db[_0xaa5f('0x71')],'as':_0xaa5f('0x96'),'required':![]},{'model':db['User'],'as':_0xaa5f('0x97'),'attributes':['name',_0xaa5f('0x98'),'internal'],'required':![]},{'model':db[_0xaa5f('0x99')],'as':_0xaa5f('0x9a'),'attributes':['id',_0xaa5f('0x2f'),'color'],'where':_0x280edc[_0xaa5f('0x35')][_0xaa5f('0x9b')]?{'id':_0x280edc['query'][_0xaa5f('0x9b')]}:undefined,'required':_0x280edc[_0xaa5f('0x35')][_0xaa5f('0x9b')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xaa5f('0x4c')](_0x478c82);})['then'](function(_0x391eda){_0x443fcb['rows']=_0x391eda;return _0x443fcb;});}})[_0xaa5f('0x18')](respondWithFilteredResult(_0x4f81b4,_0x478c82))['catch'](handleError(_0x4f81b4,null));};exports['addAgents']=function(_0x286cc1,_0x35bb9a,_0x1786aa){return db['OpenchannelAccount'][_0xaa5f('0x51')]({'where':{'id':_0x286cc1['params']['id']}})['then'](handleEntityNotFound(_0x35bb9a,null))[_0xaa5f('0x18')](function(_0x3d9bb7){if(_0x3d9bb7){return _0x3d9bb7[_0xaa5f('0x9c')](_0x286cc1[_0xaa5f('0x53')][_0xaa5f('0x5c')],_[_0xaa5f('0x9d')](_0x286cc1['body'],[_0xaa5f('0x5c'),'id'])||{})['spread'](function(_0x371b3b){for(var _0x1e04f2=0x0;_0x1e04f2<_0x286cc1[_0xaa5f('0x53')][_0xaa5f('0x5c')][_0xaa5f('0x3d')];_0x1e04f2+=0x1){socket[_0xaa5f('0x9e')](_0xaa5f('0x9f'),{'UserId':_0x286cc1[_0xaa5f('0x53')]['ids'][_0x1e04f2],'OpenchannelAccountId':_0x286cc1[_0xaa5f('0x4f')]['id']});}return _0x371b3b;});}})[_0xaa5f('0x18')](respondWithResult(_0x35bb9a,null))['catch'](handleError(_0x35bb9a,null));};exports[_0xaa5f('0xa0')]=function(_0x47330c,_0x1ed576,_0x4ad337){var _0xbf76b6;return db[_0xaa5f('0x32')][_0xaa5f('0x51')]({'where':{'id':_0x47330c[_0xaa5f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1ed576,null))['then'](function(_0x448a2d){if(_0x448a2d){return _0x448a2d[_0xaa5f('0xa0')](_0x47330c[_0xaa5f('0x35')]['ids'])[_0xaa5f('0x18')](function(_0x3562d0){if(_['isArray'](_0x47330c[_0xaa5f('0x35')][_0xaa5f('0x5c')])){for(var _0x3e8ad1=0x0;_0x3e8ad1<_0x47330c[_0xaa5f('0x35')][_0xaa5f('0x5c')][_0xaa5f('0x3d')];_0x3e8ad1+=0x1){socket[_0xaa5f('0x9e')](_0xaa5f('0xa1'),{'UserId':_0x47330c['query'][_0xaa5f('0x5c')][_0x3e8ad1],'OpenchannelAccountId':_0x47330c[_0xaa5f('0x4f')]['id']});}}else{socket[_0xaa5f('0x9e')](_0xaa5f('0xa1'),{'UserId':_0x47330c[_0xaa5f('0x35')]['ids'],'OpenchannelAccountId':_0x47330c[_0xaa5f('0x4f')]['id']});}});}})[_0xaa5f('0x18')](respondWithStatusCode(_0x1ed576,null))[_0xaa5f('0x23')](handleError(_0x1ed576,null));};exports[_0xaa5f('0xa2')]=function(_0x5a7eae,_0x406f9f,_0x3d6848){var _0x3252fd={};var _0x56a6eb={};var _0x34bef5;var _0x36a092;return db['OpenchannelAccount'][_0xaa5f('0x59')]({'where':{'id':_0x5a7eae[_0xaa5f('0x4f')]['id']}})[_0xaa5f('0x18')](handleEntityNotFound(_0x406f9f,null))[_0xaa5f('0x18')](function(_0x49304e){if(_0x49304e){_0x34bef5=_0x49304e;_0x56a6eb[_0xaa5f('0x3a')]=_[_0xaa5f('0x34')](db['User']['rawAttributes']);_0x56a6eb[_0xaa5f('0x35')]=_[_0xaa5f('0x34')](_0x5a7eae[_0xaa5f('0x35')]);_0x56a6eb['filters']=_[_0xaa5f('0x39')](_0x56a6eb[_0xaa5f('0x3a')],_0x56a6eb['query']);_0x3252fd[_0xaa5f('0x3b')]=_[_0xaa5f('0x39')](_0x56a6eb[_0xaa5f('0x3a')],qs[_0xaa5f('0x3c')](_0x5a7eae[_0xaa5f('0x35')][_0xaa5f('0x3c')]));_0x3252fd['attributes']=_0x3252fd[_0xaa5f('0x3b')]['length']?_0x3252fd[_0xaa5f('0x3b')]:_0x56a6eb['model'];_0x3252fd[_0xaa5f('0x40')]=qs['sort'](_0x5a7eae[_0xaa5f('0x35')]['sort']);_0x3252fd[_0xaa5f('0x42')]=qs[_0xaa5f('0x38')](_[_0xaa5f('0x43')](_0x5a7eae[_0xaa5f('0x35')],_0x56a6eb[_0xaa5f('0x38')]));if(_0x5a7eae[_0xaa5f('0x35')]['filter']){_0x3252fd[_0xaa5f('0x42')]=_['merge'](_0x3252fd['where'],{'$or':_[_0xaa5f('0x47')](_0x3252fd[_0xaa5f('0x3b')],function(_0x50c3ef){var _0x5f6900={};_0x5f6900[_0x50c3ef]={'$like':'%'+_0x5a7eae['query'][_0xaa5f('0x46')]+'%'};return _0x5f6900;})});}_0x3252fd=_[_0xaa5f('0x50')]({},_0x3252fd,_0x5a7eae[_0xaa5f('0x48')]);return _0x34bef5['getAgents'](_0x3252fd);}})['then'](function(_0x489ad1){if(_0x489ad1){_0x36a092=_0x489ad1['length'];if(!_0x5a7eae[_0xaa5f('0x35')]['hasOwnProperty'](_0xaa5f('0x3f'))){_0x3252fd[_0xaa5f('0x28')]=qs['limit'](_0x5a7eae[_0xaa5f('0x35')]['limit']);_0x3252fd[_0xaa5f('0x27')]=qs['offset'](_0x5a7eae['query']['offset']);}return _0x34bef5[_0xaa5f('0xa2')](_0x3252fd);}})[_0xaa5f('0x18')](function(_0x3655de){if(_0x3655de){return _0x3655de?{'count':_0x36a092,'rows':_0x3655de}:null;}})[_0xaa5f('0x18')](respondWithResult(_0x406f9f,null))[_0xaa5f('0x23')](handleError(_0x406f9f,null));};exports[_0xaa5f('0x30')]=function(_0x4117cc,_0x138b9d,_0x749d19){var _0xf3f12d,_0x4f12a6,_0x1c1495;if(_['isNil'](_0x4117cc[_0xaa5f('0x53')][_0xaa5f('0x53')])||_0x4117cc[_0xaa5f('0x53')][_0xaa5f('0x53')]===''){throw new db['Sequelize'][(_0xaa5f('0x67'))](_0xaa5f('0xa3'));}if(_[_0xaa5f('0x69')](_0x4117cc[_0xaa5f('0x53')]['to'])){}_0xf3f12d=_0x4117cc[_0xaa5f('0x53')]['to'];return db[_0xaa5f('0x32')][_0xaa5f('0x59')]({'where':{'id':_0x4117cc[_0xaa5f('0x4f')]['id']}})[_0xaa5f('0x18')](handleEntityNotFound(_0x138b9d,null))[_0xaa5f('0x18')](function(_0x484172){if(_0x484172){return db[_0xaa5f('0x32')]['find']({'where':{'id':_0x484172['id']},'include':[{'model':db['CmList'],'as':_0xaa5f('0x70'),'include':[{'model':db[_0xaa5f('0x71')],'as':'Contacts','where':{[_0x484172[_0xaa5f('0x6d')]]:_0xf3f12d},'limit':0x1,'order':[[_0xaa5f('0x64'),_0xaa5f('0xa4')]]}]}]})[_0xaa5f('0x18')](handleEntityNotFound(_0x138b9d,null))[_0xaa5f('0x18')](function(_0x9dc8ff){if(_0x9dc8ff&&_0x9dc8ff['List']){_0x4f12a6=_0x9dc8ff[_0xaa5f('0x7f')]({'plain':!![]});if(_0x4f12a6[_0xaa5f('0x70')]&&_0x4f12a6[_0xaa5f('0x70')]['Contacts'][_0xaa5f('0x3d')]){return _0x4f12a6[_0xaa5f('0x70')][_0xaa5f('0x72')][0x0];}return db[_0xaa5f('0x71')]['create'](_['defaults'](_0x4117cc[_0xaa5f('0x53')],{'firstName':_0xf3f12d,[_0x9dc8ff[_0xaa5f('0x6d')]]:_0xf3f12d,'phone':_0xf3f12d,'ListId':_0x4f12a6[_0xaa5f('0x65')]}));}})[_0xaa5f('0x18')](handleEntityNotFound(_0x138b9d,null))['then'](function(_0x2f79c1){if(_0x2f79c1){_0x1c1495=_0x2f79c1;return db['OpenchannelInteraction'][_0xaa5f('0x51')]({'where':{'ContactId':_0x1c1495['id'],'closed':![],'OpenchannelAccountId':_0x4f12a6['id']}})[_0xaa5f('0x18')](function(_0x5b7e9c){if(_0x5b7e9c){return[_0x5b7e9c,![]];}return db['OpenchannelInteraction'][_0xaa5f('0x52')]({'UserId':_0x4117cc[_0xaa5f('0xa5')]['id'],'ContactId':_0x1c1495['id'],'OpenchannelAccountId':_0x4f12a6['id'],'lastMsgDirection':'out','Messages':[_[_0xaa5f('0x50')](_0x4117cc[_0xaa5f('0x53')],{'read':![],'body':_0x4117cc[_0xaa5f('0x53')][_0xaa5f('0x53')],'OpenchannelAccountId':_0x4f12a6['id'],'UserId':_0x4117cc['user']['id'],'ContactId':_0x1c1495['id']})]},{'include':[{'model':db[_0xaa5f('0xa6')],'as':_0xaa5f('0xa7')}]})[_0xaa5f('0x18')](function(_0xcc3b77){return[_0xcc3b77,!![]];});});}})[_0xaa5f('0x7e')](function(_0x32b547,_0x33703a){if(_0x33703a){return _0x32b547;}return db['OpenchannelMessage'][_0xaa5f('0x52')](_[_0xaa5f('0x50')](_0x4117cc['body'],{'read':![],'body':_0x4117cc[_0xaa5f('0x53')][_0xaa5f('0x53')],'OpenchannelAccountId':_0x4f12a6['id'],'OpenchannelInteractionId':_0x32b547['id'],'UserId':_0x4117cc['user']['id'],'ContactId':_0x1c1495['id']}))[_0xaa5f('0x18')](function(_0x4f0619){_0x32b547[_0xaa5f('0xa8')]['Messages']=[];_0x32b547[_0xaa5f('0xa8')][_0xaa5f('0xa7')]['push'](_0x4f0619['dataValues']);return _0x32b547;});});}})[_0xaa5f('0x18')](respondWithResult(_0x138b9d,null))[_0xaa5f('0x23')](handleError(_0x138b9d,null));}; \ No newline at end of file +var _0x36ee=['CmList','Contacts','DESC','OpenchannelApplication','List','account','applications','list','orderBy','priority','asc','Applications','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','interaction','get','created','push','unmanaged','*,*,*,*','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tags','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','defaults','user','out','OpenchannelMessage','Messages','dataValues','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/logger','api','../../config/utils','../../mysqldb','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','end','status','json','count','offset','Content-Range','save','update','then','sendStatus','stack','name','send','OpenchannelAccount','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','day','add','merge','filter','map','options','include','rows','show','params','rawAttributes','length','find','create','body','destroy','describe','addDisposition','OpnechannelAccountId','getDispositions','findOne','OpenchannelAccountId','Disposition','includeAll','findAll','removeDispositions','ids','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0x36ee,0xe8));var _0xe36e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x36ee[_0x3b380d];return _0x54502b;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe36e('0x0'));var BPromise=require('bluebird');var Mustache=require(_0xe36e('0x1'));var util=require(_0xe36e('0x2'));var path=require(_0xe36e('0x3'));var sox=require(_0xe36e('0x4'));var csv=require(_0xe36e('0x5'));var ejs=require(_0xe36e('0x6'));var fs=require('fs');var _=require(_0xe36e('0x7'));var squel=require(_0xe36e('0x8'));var crypto=require(_0xe36e('0x9'));var jsforce=require(_0xe36e('0xa'));var deskjs=require(_0xe36e('0xb'));var toCsv=require(_0xe36e('0x5'));var querystring=require('querystring');var Papa=require(_0xe36e('0xc'));var qs=require('../../components/parsers/qs');var logger=require(_0xe36e('0xd'))(_0xe36e('0xe'));var utils=require(_0xe36e('0xf'));var config=require('../../config/environment');var db=require(_0xe36e('0x10'))['db'];var socket=require('socket.io-emitter')({'host':_0xe36e('0x11'),'port':0x18eb});require(_0xe36e('0x12'))[_0xe36e('0x13')](socket);var jayson=require(_0xe36e('0x14'));var client=jayson[_0xe36e('0x15')][_0xe36e('0x16')]({'port':0x232c});var client9002=jayson[_0xe36e('0x15')][_0xe36e('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x4fbdb2,_0x32981d,_0x27841e,_0x23abfb){return new BPromise(function(_0x1fdea2,_0x5c3f3c){var _0x3e264a=_0x23abfb||client;return _0x3e264a['request'](_0x4fbdb2,_0x27841e)['then'](function(_0x27ff47){logger[_0xe36e('0x17')](_0xe36e('0x18'),_0x32981d,_0xe36e('0x19'));logger[_0xe36e('0x1a')](_0xe36e('0x1b'),_0x32981d,_0xe36e('0x19'),JSON[_0xe36e('0x1c')](_0x27ff47));if(_0x27ff47[_0xe36e('0x1d')]){if(_0x27ff47[_0xe36e('0x1d')]['code']===0x1f4){logger[_0xe36e('0x1d')](_0xe36e('0x18'),_0x32981d,_0x27ff47['error'][_0xe36e('0x1e')]);return _0x5c3f3c(_0x27ff47['error'][_0xe36e('0x1e')]);}logger[_0xe36e('0x1d')]('OpenchannelAccount,\x20%s,\x20%s',_0x32981d,_0x27ff47[_0xe36e('0x1d')][_0xe36e('0x1e')]);return _0x1fdea2(_0x27ff47[_0xe36e('0x1d')]['message']);}else{logger[_0xe36e('0x17')](_0xe36e('0x18'),_0x32981d,_0xe36e('0x19'));_0x1fdea2(_0x27ff47[_0xe36e('0x1f')][_0xe36e('0x1e')]);}})[_0xe36e('0x20')](function(_0x4f438a){logger[_0xe36e('0x1d')](_0xe36e('0x18'),_0x32981d,_0x4f438a);_0x5c3f3c(_0x4f438a);});});}function respondWithStatusCode(_0x23bcf3,_0x333197){_0x333197=_0x333197||0xcc;return function(_0x437f3f){if(_0x437f3f){return _0x23bcf3['sendStatus'](_0x333197);}return _0x23bcf3['status'](_0x333197)[_0xe36e('0x21')]();};}function respondWithResult(_0x10818d,_0xb0cd85){_0xb0cd85=_0xb0cd85||0xc8;return function(_0xb32195){if(_0xb32195){return _0x10818d[_0xe36e('0x22')](_0xb0cd85)[_0xe36e('0x23')](_0xb32195);}};}function respondWithFilteredResult(_0x1a045c,_0x5ac484){return function(_0x3cafbf){if(_0x3cafbf){var _0x35f9e7=_0x3cafbf[_0xe36e('0x24')],_0x10597f=_0x5ac484['offset'],_0x262caa=_0x5ac484[_0xe36e('0x25')]+_0x5ac484['limit'],_0x5e58d8;if(_0x262caa>=_0x35f9e7){_0x262caa=_0x35f9e7;_0x5e58d8=0xc8;}else{_0x5e58d8=0xce;}_0x1a045c[_0xe36e('0x22')](_0x5e58d8);return _0x1a045c['set'](_0xe36e('0x26'),_0x10597f+'-'+_0x262caa+'/'+_0x35f9e7)['json'](_0x3cafbf);}return null;};}function patchUpdates(_0x3b1045){return function(_0x59548b){try{jsonpatch['apply'](_0x59548b,_0x3b1045,!![]);}catch(_0x5d8fd8){return BPromise['reject'](_0x5d8fd8);}return _0x59548b[_0xe36e('0x27')]();};}function saveUpdates(_0x1fc639,_0x4cf185){return function(_0x4ac819){if(_0x4ac819){return _0x4ac819[_0xe36e('0x28')](_0x1fc639)[_0xe36e('0x29')](function(_0x259e19){return _0x259e19;});}return null;};}function removeEntity(_0x1b18aa,_0x3d826e){return function(_0x4759b4){if(_0x4759b4){return _0x4759b4['destroy']()[_0xe36e('0x29')](function(){_0x1b18aa[_0xe36e('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x87e595,_0xa06f61){return function(_0xba4869){if(!_0xba4869){_0x87e595[_0xe36e('0x2a')](0x194);}return _0xba4869;};}function handleError(_0x21623e,_0x253cdc){_0x253cdc=_0x253cdc||0x1f4;return function(_0xfe4ee8){logger[_0xe36e('0x1d')](_0xfe4ee8[_0xe36e('0x2b')]);if(_0xfe4ee8[_0xe36e('0x2c')]){delete _0xfe4ee8[_0xe36e('0x2c')];}_0x21623e['status'](_0x253cdc)[_0xe36e('0x2d')](_0xfe4ee8);};}exports['index']=function(_0x4a717e,_0x81cf9a){var _0x4f620d={},_0x3b1299={},_0x248f39={'count':0x0,'rows':[]};var _0x38bdbc=db[_0xe36e('0x2e')]['rawAttributes'];_0x3b1299['model']=_[_0xe36e('0x2f')](_0x38bdbc);var _0x222c65={'dateStart':_0x4a717e[_0xe36e('0x30')][_0xe36e('0x31')],'dateEnd':_0x4a717e['query'][_0xe36e('0x32')]};delete _0x4a717e[_0xe36e('0x30')][_0xe36e('0x31')];delete _0x4a717e['query'][_0xe36e('0x32')];_0x3b1299[_0xe36e('0x30')]=_['keys'](_0x4a717e[_0xe36e('0x30')]);_0x3b1299[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x3b1299[_0xe36e('0x35')],_0x3b1299[_0xe36e('0x30')]);_0x4f620d[_0xe36e('0x36')]=_[_0xe36e('0x34')](_0x3b1299[_0xe36e('0x35')],qs[_0xe36e('0x37')](_0x4a717e[_0xe36e('0x30')][_0xe36e('0x37')]));_0x4f620d[_0xe36e('0x36')]=_0x4f620d[_0xe36e('0x36')]['length']?_0x4f620d[_0xe36e('0x36')]:_0x3b1299[_0xe36e('0x35')];if(!_0x4a717e[_0xe36e('0x30')][_0xe36e('0x38')](_0xe36e('0x39'))){_0x4f620d['limit']=qs['limit'](_0x4a717e[_0xe36e('0x30')][_0xe36e('0x3a')]);_0x4f620d[_0xe36e('0x25')]=qs[_0xe36e('0x25')](_0x4a717e[_0xe36e('0x30')][_0xe36e('0x25')]);}_0x4f620d[_0xe36e('0x3b')]=qs[_0xe36e('0x3c')](_0x4a717e['query'][_0xe36e('0x3c')]);_0x4f620d[_0xe36e('0x3d')]=qs['filters'](_[_0xe36e('0x3e')](_0x4a717e['query'],_0x3b1299[_0xe36e('0x33')]));if(_0x222c65[_0xe36e('0x31')]){if(_0x222c65[_0xe36e('0x32')]){_0x222c65[_0xe36e('0x32')]=moment(_0x222c65[_0xe36e('0x32')])['add'](0x1,_0xe36e('0x3f'));}else{_0x222c65[_0xe36e('0x32')]=moment(_0x222c65[_0xe36e('0x31')])[_0xe36e('0x40')](0x1,_0xe36e('0x3f'));}_[_0xe36e('0x41')](_0x4f620d['where'],{'createdAt':{'$gte':_0x222c65[_0xe36e('0x31')],'$lte':_0x222c65[_0xe36e('0x32')]}});}if(_0x4a717e[_0xe36e('0x30')][_0xe36e('0x42')]){_0x4f620d[_0xe36e('0x3d')]=_['merge'](_0x4f620d[_0xe36e('0x3d')],{'$or':_[_0xe36e('0x43')](_0x4f620d[_0xe36e('0x36')],function(_0x9debd7){var _0x11d6b2={};_0x11d6b2[_0x9debd7]={'$like':'%'+_0x4a717e[_0xe36e('0x30')][_0xe36e('0x42')]+'%'};return _0x11d6b2;})});}_0x4f620d=_[_0xe36e('0x41')]({},_0x4f620d,_0x4a717e[_0xe36e('0x44')]);var _0x52e744={'where':_0x4f620d['where']};return db[_0xe36e('0x2e')]['count'](_0x52e744)[_0xe36e('0x29')](function(_0x3d322c){_0x248f39[_0xe36e('0x24')]=_0x3d322c;if(_0x4a717e[_0xe36e('0x30')]['includeAll']){_0x4f620d[_0xe36e('0x45')]=[{'all':!![]}];}return db[_0xe36e('0x2e')]['findAll'](_0x4f620d);})[_0xe36e('0x29')](function(_0x40634a){_0x248f39[_0xe36e('0x46')]=_0x40634a;return _0x248f39;})[_0xe36e('0x29')](respondWithFilteredResult(_0x81cf9a,_0x4f620d))[_0xe36e('0x20')](handleError(_0x81cf9a,null));};exports[_0xe36e('0x47')]=function(_0x436a12,_0xaf917c){var _0x17555e={'raw':![],'where':{'id':_0x436a12[_0xe36e('0x48')]['id']}},_0x3a99aa={};_0x3a99aa[_0xe36e('0x35')]=_[_0xe36e('0x2f')](db[_0xe36e('0x2e')][_0xe36e('0x49')]);_0x3a99aa['query']=_[_0xe36e('0x2f')](_0x436a12['query']);_0x3a99aa['filters']=_[_0xe36e('0x34')](_0x3a99aa[_0xe36e('0x35')],_0x3a99aa['query']);_0x17555e[_0xe36e('0x36')]=_[_0xe36e('0x34')](_0x3a99aa[_0xe36e('0x35')],qs[_0xe36e('0x37')](_0x436a12[_0xe36e('0x30')][_0xe36e('0x37')]));_0x17555e[_0xe36e('0x36')]=_0x17555e[_0xe36e('0x36')][_0xe36e('0x4a')]?_0x17555e['attributes']:_0x3a99aa[_0xe36e('0x35')];if(_0x436a12[_0xe36e('0x30')]['includeAll']){_0x17555e[_0xe36e('0x45')]=[{'all':!![]}];}_0x17555e=_[_0xe36e('0x41')]({},_0x17555e,_0x436a12[_0xe36e('0x44')]);return db[_0xe36e('0x2e')][_0xe36e('0x4b')](_0x17555e)['then'](handleEntityNotFound(_0xaf917c,null))['then'](respondWithResult(_0xaf917c,null))['catch'](handleError(_0xaf917c,null));};exports['create']=function(_0x47605d,_0x2fab4c){return db[_0xe36e('0x2e')][_0xe36e('0x4c')](_0x47605d[_0xe36e('0x4d')],{})[_0xe36e('0x29')](respondWithResult(_0x2fab4c,0xc9))[_0xe36e('0x20')](handleError(_0x2fab4c,null));};exports[_0xe36e('0x28')]=function(_0x2493c3,_0x5045e6){if(_0x2493c3[_0xe36e('0x4d')]['id']){delete _0x2493c3[_0xe36e('0x4d')]['id'];}return db['OpenchannelAccount'][_0xe36e('0x4b')]({'where':{'id':_0x2493c3[_0xe36e('0x48')]['id']}})[_0xe36e('0x29')](handleEntityNotFound(_0x5045e6,null))[_0xe36e('0x29')](saveUpdates(_0x2493c3[_0xe36e('0x4d')],null))[_0xe36e('0x29')](respondWithResult(_0x5045e6,null))[_0xe36e('0x20')](handleError(_0x5045e6,null));};exports[_0xe36e('0x4e')]=function(_0x1fe174,_0x374032){return db[_0xe36e('0x2e')][_0xe36e('0x4b')]({'where':{'id':_0x1fe174[_0xe36e('0x48')]['id']}})[_0xe36e('0x29')](handleEntityNotFound(_0x374032,null))[_0xe36e('0x29')](removeEntity(_0x374032,null))[_0xe36e('0x20')](handleError(_0x374032,null));};exports[_0xe36e('0x4f')]=function(_0x275142,_0x14738a){return db[_0xe36e('0x2e')][_0xe36e('0x4f')]()[_0xe36e('0x29')](respondWithResult(_0x14738a,null))[_0xe36e('0x20')](handleError(_0x14738a,null));};exports[_0xe36e('0x50')]=function(_0x40604f,_0x5a8795,_0x429a01){if(_0x40604f[_0xe36e('0x4d')]['id']){delete _0x40604f['body']['id'];}return db[_0xe36e('0x2e')][_0xe36e('0x4b')]({'where':{'id':_0x40604f[_0xe36e('0x48')]['id']}})[_0xe36e('0x29')](handleEntityNotFound(_0x5a8795,null))[_0xe36e('0x29')](function(_0x34a2c3){if(_0x34a2c3){_0x40604f['body'][_0xe36e('0x51')]=_0x34a2c3['id'];return db['Disposition'][_0xe36e('0x4c')](_0x40604f[_0xe36e('0x4d')]);}})[_0xe36e('0x29')](respondWithResult(_0x5a8795,null))[_0xe36e('0x20')](handleError(_0x5a8795,null));};exports[_0xe36e('0x52')]=function(_0x109def,_0x2ab6aa,_0xfea627){var _0x4c8d2b={'raw':![],'where':{}};var _0x34c7a5={};var _0xcafb87={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xe36e('0x53')]({'where':{'id':_0x109def[_0xe36e('0x48')]['id']}})[_0xe36e('0x29')](handleEntityNotFound(_0x2ab6aa,null))[_0xe36e('0x29')](function(_0x30786a){if(_0x30786a){_0x34c7a5[_0xe36e('0x35')]=_[_0xe36e('0x2f')](db['Disposition'][_0xe36e('0x49')]);_0x34c7a5[_0xe36e('0x30')]=_[_0xe36e('0x2f')](_0x109def[_0xe36e('0x30')]);_0x34c7a5[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x34c7a5[_0xe36e('0x35')],_0x34c7a5[_0xe36e('0x30')]);_0x4c8d2b[_0xe36e('0x36')]=_[_0xe36e('0x34')](_0x34c7a5[_0xe36e('0x35')],qs['fields'](_0x109def[_0xe36e('0x30')][_0xe36e('0x37')]));_0x4c8d2b[_0xe36e('0x36')]=_0x4c8d2b[_0xe36e('0x36')]['length']?_0x4c8d2b['attributes']:_0x34c7a5[_0xe36e('0x35')];if(!_0x109def['query']['hasOwnProperty']('nolimit')){_0x4c8d2b[_0xe36e('0x3a')]=qs['limit'](_0x109def[_0xe36e('0x30')][_0xe36e('0x3a')]);_0x4c8d2b[_0xe36e('0x25')]=qs[_0xe36e('0x25')](_0x109def[_0xe36e('0x30')][_0xe36e('0x25')]);}_0x4c8d2b[_0xe36e('0x3b')]=qs[_0xe36e('0x3c')](_0x109def[_0xe36e('0x30')]['sort']);_0x4c8d2b[_0xe36e('0x3d')]=qs['filters'](_[_0xe36e('0x3e')](_0x109def['query'],_0x34c7a5[_0xe36e('0x33')]));_0x4c8d2b[_0xe36e('0x3d')][_0xe36e('0x54')]=_0x30786a['id'];if(_0x109def[_0xe36e('0x30')]['filter']){_0x4c8d2b['where']=_[_0xe36e('0x41')](_0x4c8d2b[_0xe36e('0x3d')],{'$or':_[_0xe36e('0x43')](_0x4c8d2b[_0xe36e('0x36')],function(_0x3be728){var _0x300f3f={};_0x300f3f[_0x3be728]={'$like':'%'+_0x109def['query'][_0xe36e('0x42')]+'%'};return _0x300f3f;})});}_0x4c8d2b=_[_0xe36e('0x41')]({},_0x4c8d2b,_0x109def['options']);return db[_0xe36e('0x55')]['count']({'where':_0x4c8d2b[_0xe36e('0x3d')]})[_0xe36e('0x29')](function(_0x1cb052){_0xcafb87[_0xe36e('0x24')]=_0x1cb052;if(_0x109def['query'][_0xe36e('0x56')]){_0x4c8d2b['include']=[{'all':!![]}];}return db['Disposition'][_0xe36e('0x57')](_0x4c8d2b);})[_0xe36e('0x29')](function(_0x5554ab){_0xcafb87['rows']=_0x5554ab;return _0xcafb87;});}})[_0xe36e('0x29')](respondWithFilteredResult(_0x2ab6aa,_0x4c8d2b))['catch'](handleError(_0x2ab6aa,null));};exports[_0xe36e('0x58')]=function(_0x36ddc0,_0x2c0ed5,_0x276533){var _0x11d232;return db[_0xe36e('0x2e')]['find']({'where':{'id':_0x36ddc0[_0xe36e('0x48')]['id']}})[_0xe36e('0x29')](handleEntityNotFound(_0x2c0ed5,null))[_0xe36e('0x29')](function(_0x1ba428){if(_0x1ba428){return _0x1ba428['removeDispositions'](_0x36ddc0[_0xe36e('0x30')][_0xe36e('0x59')]);}})[_0xe36e('0x29')](respondWithStatusCode(_0x2c0ed5,null))[_0xe36e('0x20')](handleError(_0x2c0ed5,null));};exports['addAnswer']=function(_0x38be05,_0x5d28f3,_0x1dae76){if(_0x38be05['body']['id']){delete _0x38be05[_0xe36e('0x4d')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x38be05[_0xe36e('0x48')]['id']}})[_0xe36e('0x29')](handleEntityNotFound(_0x5d28f3,null))[_0xe36e('0x29')](function(_0x4f18bf){if(_0x4f18bf){_0x38be05[_0xe36e('0x4d')][_0xe36e('0x54')]=_0x4f18bf['id'];return db['CannedAnswer'][_0xe36e('0x4c')](_0x38be05[_0xe36e('0x4d')]);}})[_0xe36e('0x29')](respondWithResult(_0x5d28f3,null))['catch'](handleError(_0x5d28f3,null));};exports['getAnswers']=function(_0x72fcc,_0x2ba37a,_0x3bd3c2){var _0x327506={'raw':![],'where':{}};var _0x411305={};var _0x51bc99={'count':0x0,'rows':[]};return db[_0xe36e('0x2e')][_0xe36e('0x53')]({'where':{'id':_0x72fcc[_0xe36e('0x48')]['id']}})[_0xe36e('0x29')](handleEntityNotFound(_0x2ba37a,null))[_0xe36e('0x29')](function(_0x5bdeea){if(_0x5bdeea){_0x411305[_0xe36e('0x35')]=_[_0xe36e('0x2f')](db[_0xe36e('0x5a')]['rawAttributes']);_0x411305[_0xe36e('0x30')]=_['keys'](_0x72fcc[_0xe36e('0x30')]);_0x411305['filters']=_[_0xe36e('0x34')](_0x411305[_0xe36e('0x35')],_0x411305['query']);_0x327506[_0xe36e('0x36')]=_['intersection'](_0x411305[_0xe36e('0x35')],qs[_0xe36e('0x37')](_0x72fcc[_0xe36e('0x30')][_0xe36e('0x37')]));_0x327506[_0xe36e('0x36')]=_0x327506['attributes'][_0xe36e('0x4a')]?_0x327506['attributes']:_0x411305[_0xe36e('0x35')];if(!_0x72fcc[_0xe36e('0x30')][_0xe36e('0x38')](_0xe36e('0x39'))){_0x327506[_0xe36e('0x3a')]=qs[_0xe36e('0x3a')](_0x72fcc['query'][_0xe36e('0x3a')]);_0x327506[_0xe36e('0x25')]=qs[_0xe36e('0x25')](_0x72fcc['query'][_0xe36e('0x25')]);}_0x327506[_0xe36e('0x3b')]=qs[_0xe36e('0x3c')](_0x72fcc[_0xe36e('0x30')]['sort']);_0x327506[_0xe36e('0x3d')]=qs['filters'](_[_0xe36e('0x3e')](_0x72fcc['query'],_0x411305[_0xe36e('0x33')]));_0x327506[_0xe36e('0x3d')][_0xe36e('0x54')]=_0x5bdeea['id'];if(_0x72fcc['query'][_0xe36e('0x42')]){_0x327506[_0xe36e('0x3d')]=_['merge'](_0x327506[_0xe36e('0x3d')],{'$or':_[_0xe36e('0x43')](_0x327506[_0xe36e('0x36')],function(_0x531eac){var _0x4acaa4={};_0x4acaa4[_0x531eac]={'$like':'%'+_0x72fcc[_0xe36e('0x30')][_0xe36e('0x42')]+'%'};return _0x4acaa4;})});}_0x327506=_[_0xe36e('0x41')]({},_0x327506,_0x72fcc[_0xe36e('0x44')]);return db[_0xe36e('0x5a')]['count']({'where':_0x327506[_0xe36e('0x3d')]})[_0xe36e('0x29')](function(_0x2c923b){_0x51bc99[_0xe36e('0x24')]=_0x2c923b;if(_0x72fcc['query'][_0xe36e('0x56')]){_0x327506[_0xe36e('0x45')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x327506);})['then'](function(_0x1acffb){_0x51bc99['rows']=_0x1acffb;return _0x51bc99;});}})['then'](respondWithFilteredResult(_0x2ba37a,_0x327506))[_0xe36e('0x20')](handleError(_0x2ba37a,null));};exports[_0xe36e('0x5b')]=function(_0x116f20,_0x266a5f,_0x295495){var _0x378126;return db['OpenchannelAccount'][_0xe36e('0x4b')]({'where':{'id':_0x116f20['params']['id']}})['then'](handleEntityNotFound(_0x266a5f,null))[_0xe36e('0x29')](function(_0x21644d){if(_0x21644d){return _0x21644d[_0xe36e('0x5b')](_0x116f20[_0xe36e('0x30')]['ids']);}})[_0xe36e('0x29')](respondWithStatusCode(_0x266a5f,null))[_0xe36e('0x20')](handleError(_0x266a5f,null));};exports[_0xe36e('0x5c')]=function(_0x1f5214,_0x4d0a75,_0xaa9dea){var _0x4b620a={'body':_0x1f5214[_0xe36e('0x4d')],'channel':_0xe36e('0x5d')};var _0x40a117=[];var _0x8789e8=[];var _0x149905={};var _0x4c51b3=![];return db[_0xe36e('0x5e')][_0xe36e('0x4f')]()[_0xe36e('0x29')](function(_0x31197b){if(!_0x31197b){throw new db[(_0xe36e('0x5f'))][(_0xe36e('0x60'))](_0xe36e('0x61'));}_0x40a117=_[_0xe36e('0x62')](_[_0xe36e('0x2f')](_0x31197b),[_0xe36e('0x63'),_0xe36e('0x64')]);_0x8789e8=_[_0xe36e('0x62')](_[_0xe36e('0x2f')](_0x31197b),['createdAt','updatedAt','CompanyId',_0xe36e('0x65')]);if(_0x1f5214[_0xe36e('0x4d')]['id']){delete _0x1f5214[_0xe36e('0x4d')]['id'];}if(_[_0xe36e('0x66')](_0x1f5214['body'][_0xe36e('0x67')])){throw new db[(_0xe36e('0x5f'))][(_0xe36e('0x60'))](_0xe36e('0x68'));}if(_['isNil'](_0x1f5214[_0xe36e('0x4d')][_0xe36e('0x4d')])||_0x1f5214[_0xe36e('0x4d')][_0xe36e('0x4d')]===''){throw new db['Sequelize']['ValidationError'](_0xe36e('0x69'));}if(_[_0xe36e('0x66')](_0x1f5214['body']['mapKey'])){throw new db['Sequelize'][(_0xe36e('0x60'))](_0xe36e('0x6a')+_0x8789e8);}if(!_[_0xe36e('0x6b')](_0x8789e8,_0x1f5214['body'][_0xe36e('0x6c')])){throw new db[(_0xe36e('0x5f'))][(_0xe36e('0x60'))](_0xe36e('0x6d')+_0x8789e8);}_0x149905[_0x1f5214['body'][_0xe36e('0x6c')]]=_0x1f5214[_0xe36e('0x4d')][_0xe36e('0x67')];})[_0xe36e('0x29')](function(){return db['OpenchannelAccount'][_0xe36e('0x4b')]({'where':{'id':_0x1f5214['params']['id']},'include':[{'model':db[_0xe36e('0x6e')],'as':'List','include':[{'model':db[_0xe36e('0x5e')],'as':_0xe36e('0x6f'),'where':_0x149905,'limit':0x1,'order':[['updatedAt',_0xe36e('0x70')]]}]},{'model':db[_0xe36e('0x71')],'as':'Applications'}]});})[_0xe36e('0x29')](handleEntityNotFound(_0x4d0a75,null))[_0xe36e('0x29')](function(_0x3bfb4c){if(_0x3bfb4c&&_0x3bfb4c[_0xe36e('0x72')]){_0x4b620a[_0xe36e('0x73')]=_0x3bfb4c;_0x4b620a[_0xe36e('0x74')]=_0x3bfb4c['Applications'];_0x4b620a[_0xe36e('0x75')]=_0x3bfb4c[_0xe36e('0x72')];_0x4b620a['applications']=_[_0xe36e('0x76')](_0x4b620a['applications'],[_0xe36e('0x77')],[_0xe36e('0x78')]);if(_0x4b620a[_0xe36e('0x73')][_0xe36e('0x79')]){delete _0x4b620a['account'][_0xe36e('0x79')];}if(_0x4b620a[_0xe36e('0x73')][_0xe36e('0x72')]&&_0x4b620a[_0xe36e('0x73')][_0xe36e('0x72')]['Contacts'][_0xe36e('0x4a')]){return _0x4b620a[_0xe36e('0x73')]['List']['Contacts'][0x0];}var _0xe232ef=_['defaults'](_0x1f5214[_0xe36e('0x4d')],{'firstName':_0x1f5214[_0xe36e('0x4d')][_0xe36e('0x67')],'ListId':_0x3bfb4c[_0xe36e('0x65')]});_0xe232ef[_0x1f5214[_0xe36e('0x4d')][_0xe36e('0x6c')]]=_0x1f5214[_0xe36e('0x4d')][_0xe36e('0x67')];return db[_0xe36e('0x5e')][_0xe36e('0x4c')](_0xe232ef,{'fields':_0x40a117,'raw':!![]});}})['then'](handleEntityNotFound(_0x4d0a75,null))[_0xe36e('0x29')](function(_0x51c4f5){_0x4b620a[_0xe36e('0x7a')]=_0x51c4f5;if(_0x51c4f5){var _0x1be378={'ContactId':_0x51c4f5['id'],'OpenchannelAccountId':_0x1f5214[_0xe36e('0x48')]['id'],'from':(_0x51c4f5['firstName']||'')+'\x20'+(_0x51c4f5[_0xe36e('0x7b')]||'')};var _0x947053={'OpenchannelAccountId':_0x1f5214['params']['id'],'closed':![]};if(_0x1f5214[_0xe36e('0x4d')]['threadId']){_0x947053[_0xe36e('0x7c')]=_0x1f5214[_0xe36e('0x4d')][_0xe36e('0x7c')];return db[_0xe36e('0x7d')][_0xe36e('0x4b')]({'where':_0x947053})[_0xe36e('0x29')](function(_0x257b00){if(_0x257b00){return[_0x257b00,![]];}_0x1be378[_0xe36e('0x7c')]=_0x1f5214[_0xe36e('0x4d')][_0xe36e('0x7c')];_0x1be378[_0xe36e('0x7e')]=_0x1f5214['body']['externalUrl'];return db[_0xe36e('0x7d')][_0xe36e('0x4c')](_0x1be378)[_0xe36e('0x29')](function(_0x2b5a1d){return[_0x2b5a1d,!![]];});});}else{_0x947053['threadId']=null;}_0x947053[_0xe36e('0x7f')]=_0x51c4f5['id'];return db[_0xe36e('0x7d')]['find']({'where':_0x947053})[_0xe36e('0x29')](function(_0x4d12f6){if(_0x4d12f6){return[_0x4d12f6,![]];}return db[_0xe36e('0x7d')][_0xe36e('0x4c')](_0x1be378)[_0xe36e('0x29')](function(_0x5bc8b1){return[_0x5bc8b1,!![]];});});}})[_0xe36e('0x80')](function(_0x3d9682,_0x2e0e12){if(_0x3d9682){_0x4c51b3=_0x2e0e12;if(!_0x2e0e12){return _0x3d9682[_0xe36e('0x28')]({'from':(_0x4b620a[_0xe36e('0x7a')][_0xe36e('0x81')]||'')+'\x20'+(_0x4b620a[_0xe36e('0x7a')]['lastName']||'')});}else{return _0x3d9682;}}})[_0xe36e('0x29')](function(_0x2e796e){_0x4b620a[_0xe36e('0x82')]=_0x2e796e[_0xe36e('0x83')]({'plain':!![]});_0x4b620a[_0xe36e('0x82')][_0xe36e('0x84')]=_0x4c51b3;if(_0x4b620a[_0xe36e('0x82')][_0xe36e('0x84')]){if(_0x4b620a[_0xe36e('0x73')]['autoclose']){_0x4b620a[_0xe36e('0x74')][_0xe36e('0x85')]({'id':0x0,'priority':_0x4b620a['applications']['length']+0x1,'app':'close','appdata':_0xe36e('0x86'),'interval':_0xe36e('0x87')});}}return db['OpenchannelMessage'][_0xe36e('0x4c')]({'body':_0x1f5214['body']['body'],'OpenchannelAccountId':_0x1f5214['params']['id'],'OpenchannelInteractionId':_0x2e796e['id'],'direction':'in','ContactId':_0x4b620a[_0xe36e('0x7a')]['id'],'AttachmentId':_0x1f5214[_0xe36e('0x4d')]['AttachmentId']});})[_0xe36e('0x29')](function(_0x2c9191){_0x4b620a['message']=_0x2c9191;if(_0x4b620a[_0xe36e('0x82')][_0xe36e('0x88')]){return db['User'][_0xe36e('0x4b')]({'attributes':['id',_0xe36e('0x2c')],'where':{'id':_0x4b620a['interaction']['UserId']}})[_0xe36e('0x29')](function(_0x1e018b){if(_0x1e018b){_0x4b620a[_0xe36e('0x74')][_0xe36e('0x89')]({'id':0x0,'priority':0x0,'app':_0xe36e('0x8a'),'appdata':_0x1e018b[_0xe36e('0x2c')]+','+(_0x4b620a[_0xe36e('0x73')][_0xe36e('0x8b')]||0xa),'interval':'*,*,*,*'});_0x4b620a[_0xe36e('0x8c')]=![];}return respondWithRpcPromise(_0xe36e('0x8d'),_0xe36e('0x8e'),_0x4b620a);});}return respondWithRpcPromise('Start',_0xe36e('0x8e'),_0x4b620a);})[_0xe36e('0x29')](function(_0x45724e){respondWithRpcPromise(_0xe36e('0x8f'),_0xe36e('0x8f'),{'event':_0xe36e('0x5c'),'message':_0x45724e},client9002);return _0x45724e;})['then'](respondWithResult(_0x4d0a75,null))[_0xe36e('0x20')](handleError(_0x4d0a75,null));};exports[_0xe36e('0x90')]=function(_0x4c1cbc,_0x57eedc,_0x33f382){return db['OpenchannelAccount'][_0xe36e('0x53')]({'where':{'id':_0x4c1cbc[_0xe36e('0x48')]['id']}})['then'](handleEntityNotFound(_0x57eedc,null))[_0xe36e('0x29')](function(_0x2bff1b){if(_0x2bff1b){return db[_0xe36e('0x91')][_0xe36e('0x92')](function(_0x4b7d87){return db['OpenchannelApplication'][_0xe36e('0x4e')]({'where':{'OpenchannelAccountId':_0x4c1cbc[_0xe36e('0x48')]['id']},'transaction':_0x4b7d87})[_0xe36e('0x29')](function(_0x630101){var _0x15bf65=_[_0xe36e('0x43')](_0x4c1cbc[_0xe36e('0x4d')],function(_0x50ea2f){_0x50ea2f[_0xe36e('0x54')]=_0x4c1cbc[_0xe36e('0x48')]['id'];return _0x50ea2f;});return db[_0xe36e('0x71')][_0xe36e('0x93')](_0x15bf65,{'transaction':_0x4b7d87});});})[_0xe36e('0x29')](function(){return db[_0xe36e('0x71')][_0xe36e('0x94')]({'where':{'OpenchannelAccountId':_0x4c1cbc[_0xe36e('0x48')]['id']},'order':_0xe36e('0x77')});});}})[_0xe36e('0x29')](respondWithResult(_0x57eedc,null))[_0xe36e('0x20')](handleError(_0x57eedc,null));};exports['getApplications']=function(_0x2c2e49,_0x27102b,_0x701a82){var _0x233d87={};var _0x478cc9={};var _0x59619f;var _0x37f186;return db['OpenchannelAccount'][_0xe36e('0x53')]({'where':{'id':_0x2c2e49['params']['id']}})[_0xe36e('0x29')](handleEntityNotFound(_0x27102b,null))['then'](function(_0xa1f235){if(_0xa1f235){_0x59619f=_0xa1f235;_0x478cc9[_0xe36e('0x35')]=_[_0xe36e('0x2f')](db[_0xe36e('0x71')][_0xe36e('0x49')]);_0x478cc9['query']=_[_0xe36e('0x2f')](_0x2c2e49[_0xe36e('0x30')]);_0x478cc9[_0xe36e('0x33')]=_['intersection'](_0x478cc9['model'],_0x478cc9[_0xe36e('0x30')]);_0x233d87[_0xe36e('0x36')]=_['intersection'](_0x478cc9[_0xe36e('0x35')],qs['fields'](_0x2c2e49[_0xe36e('0x30')][_0xe36e('0x37')]));_0x233d87[_0xe36e('0x36')]=_0x233d87[_0xe36e('0x36')][_0xe36e('0x4a')]?_0x233d87[_0xe36e('0x36')]:_0x478cc9[_0xe36e('0x35')];_0x233d87[_0xe36e('0x3b')]=qs[_0xe36e('0x3c')](_0x2c2e49[_0xe36e('0x30')][_0xe36e('0x3c')]);_0x233d87[_0xe36e('0x3d')]=qs[_0xe36e('0x33')](_['pick'](_0x2c2e49[_0xe36e('0x30')],_0x478cc9['filters']));if(_0x2c2e49[_0xe36e('0x30')][_0xe36e('0x42')]){_0x233d87[_0xe36e('0x3d')]=_[_0xe36e('0x41')](_0x233d87[_0xe36e('0x3d')],{'$or':_['map'](_0x233d87[_0xe36e('0x36')],function(_0xd57487){var _0x211cd8={};_0x211cd8[_0xd57487]={'$like':'%'+_0x2c2e49[_0xe36e('0x30')][_0xe36e('0x42')]+'%'};return _0x211cd8;})});}_0x233d87=_[_0xe36e('0x41')]({},_0x233d87,_0x2c2e49[_0xe36e('0x44')]);return _0x59619f[_0xe36e('0x95')](_0x233d87);}})[_0xe36e('0x29')](function(_0x9566f8){if(_0x9566f8){_0x37f186=_0x9566f8[_0xe36e('0x4a')];if(!_0x2c2e49[_0xe36e('0x30')][_0xe36e('0x38')](_0xe36e('0x39'))){_0x233d87['limit']=qs[_0xe36e('0x3a')](_0x2c2e49[_0xe36e('0x30')]['limit']);_0x233d87[_0xe36e('0x25')]=qs['offset'](_0x2c2e49[_0xe36e('0x30')]['offset']);}return _0x59619f[_0xe36e('0x95')](_0x233d87);}})[_0xe36e('0x29')](function(_0x1feacf){if(_0x1feacf){return _0x1feacf?{'count':_0x37f186,'rows':_0x1feacf}:null;}})[_0xe36e('0x29')](respondWithResult(_0x27102b,null))['catch'](handleError(_0x27102b,null));};exports[_0xe36e('0x96')]=function(_0x67afa3,_0x2e0f59,_0x2644c7){var _0x39dc34={'raw':![],'where':{}};var _0x442c90={};var _0x53b4b4={'count':0x0,'rows':[]};return db[_0xe36e('0x2e')][_0xe36e('0x53')]({'where':{'id':_0x67afa3[_0xe36e('0x48')]['id']}})['then'](handleEntityNotFound(_0x2e0f59,null))['then'](function(_0x261ca9){if(_0x261ca9){_0x442c90['model']=_[_0xe36e('0x2f')](db['OpenchannelInteraction'][_0xe36e('0x49')]);_0x442c90['query']=_[_0xe36e('0x2f')](_0x67afa3[_0xe36e('0x30')]);_0x442c90[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x442c90[_0xe36e('0x35')],_0x442c90[_0xe36e('0x30')]);_0x39dc34['attributes']=_['intersection'](_0x442c90[_0xe36e('0x35')],qs[_0xe36e('0x37')](_0x67afa3[_0xe36e('0x30')]['fields']));_0x39dc34[_0xe36e('0x36')]=_0x39dc34[_0xe36e('0x36')][_0xe36e('0x4a')]?_0x39dc34[_0xe36e('0x36')]:_0x442c90[_0xe36e('0x35')];if(!_0x67afa3[_0xe36e('0x30')][_0xe36e('0x38')]('nolimit')){_0x39dc34[_0xe36e('0x3a')]=qs[_0xe36e('0x3a')](_0x67afa3[_0xe36e('0x30')]['limit']);_0x39dc34[_0xe36e('0x25')]=qs[_0xe36e('0x25')](_0x67afa3['query'][_0xe36e('0x25')]);}_0x39dc34['order']=qs['sort'](_0x67afa3[_0xe36e('0x30')]['sort']);_0x39dc34[_0xe36e('0x3d')]=qs[_0xe36e('0x33')](_[_0xe36e('0x3e')](_0x67afa3['query'],_0x442c90[_0xe36e('0x33')]));_0x39dc34[_0xe36e('0x3d')][_0xe36e('0x54')]=_0x261ca9['id'];if(_0x67afa3[_0xe36e('0x30')][_0xe36e('0x42')]){_0x39dc34[_0xe36e('0x3d')]=_[_0xe36e('0x41')](_0x39dc34[_0xe36e('0x3d')],{'$or':_[_0xe36e('0x43')](_0x39dc34[_0xe36e('0x36')],function(_0x23667a){var _0x318e90={};_0x318e90[_0x23667a]={'$like':'%'+_0x67afa3['query'][_0xe36e('0x42')]+'%'};return _0x318e90;})});}_0x39dc34=_[_0xe36e('0x41')]({},_0x39dc34,_0x67afa3['options']);return db[_0xe36e('0x7d')][_0xe36e('0x24')]({'where':_0x39dc34['where']})[_0xe36e('0x29')](function(_0x527b4d){_0x53b4b4['count']=_0x527b4d;if(_0x67afa3[_0xe36e('0x30')][_0xe36e('0x56')]){_0x39dc34[_0xe36e('0x45')]=[{'model':db[_0xe36e('0x5e')],'as':_0xe36e('0x97'),'required':![]},{'model':db[_0xe36e('0x98')],'as':_0xe36e('0x99'),'attributes':[_0xe36e('0x2c'),_0xe36e('0x9a'),_0xe36e('0x9b')],'required':![]},{'model':db['Tag'],'as':_0xe36e('0x9c'),'attributes':['id',_0xe36e('0x2c'),'color'],'where':_0x67afa3[_0xe36e('0x30')]['tag']?{'id':_0x67afa3['query']['tag']}:undefined,'required':_0x67afa3[_0xe36e('0x30')][_0xe36e('0x9d')]?!![]:![]}];}return db[_0xe36e('0x7d')][_0xe36e('0x57')](_0x39dc34);})[_0xe36e('0x29')](function(_0x5e2b98){_0x53b4b4[_0xe36e('0x46')]=_0x5e2b98;return _0x53b4b4;});}})[_0xe36e('0x29')](respondWithFilteredResult(_0x2e0f59,_0x39dc34))['catch'](handleError(_0x2e0f59,null));};exports['addAgents']=function(_0x142a16,_0x1594d9,_0x9696e9){return db[_0xe36e('0x2e')]['find']({'where':{'id':_0x142a16[_0xe36e('0x48')]['id']}})['then'](handleEntityNotFound(_0x1594d9,null))[_0xe36e('0x29')](function(_0xe37fec){if(_0xe37fec){return _0xe37fec[_0xe36e('0x9e')](_0x142a16['body'][_0xe36e('0x59')],_['omit'](_0x142a16[_0xe36e('0x4d')],[_0xe36e('0x59'),'id'])||{})[_0xe36e('0x80')](function(_0x356dcb){for(var _0x1f215a=0x0;_0x1f215a<_0x142a16[_0xe36e('0x4d')][_0xe36e('0x59')]['length'];_0x1f215a+=0x1){socket[_0xe36e('0x9f')](_0xe36e('0xa0'),{'UserId':_0x142a16['body'][_0xe36e('0x59')][_0x1f215a],'OpenchannelAccountId':_0x142a16['params']['id']});}return _0x356dcb;});}})[_0xe36e('0x29')](respondWithResult(_0x1594d9,null))['catch'](handleError(_0x1594d9,null));};exports[_0xe36e('0xa1')]=function(_0x52e98c,_0x5de20c,_0x4e50aa){var _0x47f6b8;return db[_0xe36e('0x2e')][_0xe36e('0x4b')]({'where':{'id':_0x52e98c[_0xe36e('0x48')]['id']}})[_0xe36e('0x29')](handleEntityNotFound(_0x5de20c,null))[_0xe36e('0x29')](function(_0x143ef6){if(_0x143ef6){return _0x143ef6[_0xe36e('0xa1')](_0x52e98c[_0xe36e('0x30')]['ids'])[_0xe36e('0x29')](function(_0x29883e){if(_[_0xe36e('0xa2')](_0x52e98c[_0xe36e('0x30')][_0xe36e('0x59')])){for(var _0x380c2a=0x0;_0x380c2a<_0x52e98c[_0xe36e('0x30')][_0xe36e('0x59')][_0xe36e('0x4a')];_0x380c2a+=0x1){socket[_0xe36e('0x9f')]('userOpenchannelAccount:remove',{'UserId':_0x52e98c[_0xe36e('0x30')]['ids'][_0x380c2a],'OpenchannelAccountId':_0x52e98c[_0xe36e('0x48')]['id']});}}else{socket[_0xe36e('0x9f')](_0xe36e('0xa3'),{'UserId':_0x52e98c[_0xe36e('0x30')][_0xe36e('0x59')],'OpenchannelAccountId':_0x52e98c['params']['id']});}});}})[_0xe36e('0x29')](respondWithStatusCode(_0x5de20c,null))['catch'](handleError(_0x5de20c,null));};exports['getAgents']=function(_0x2291e7,_0x136bf7,_0x4a6cc1){var _0x38175b={};var _0x56e6b9={};var _0x56832f;var _0x12e580;return db['OpenchannelAccount'][_0xe36e('0x53')]({'where':{'id':_0x2291e7[_0xe36e('0x48')]['id']}})['then'](handleEntityNotFound(_0x136bf7,null))[_0xe36e('0x29')](function(_0x2fcb86){if(_0x2fcb86){_0x56832f=_0x2fcb86;_0x56e6b9['model']=_[_0xe36e('0x2f')](db[_0xe36e('0x98')][_0xe36e('0x49')]);_0x56e6b9[_0xe36e('0x30')]=_[_0xe36e('0x2f')](_0x2291e7[_0xe36e('0x30')]);_0x56e6b9[_0xe36e('0x33')]=_['intersection'](_0x56e6b9[_0xe36e('0x35')],_0x56e6b9[_0xe36e('0x30')]);_0x38175b['attributes']=_['intersection'](_0x56e6b9[_0xe36e('0x35')],qs[_0xe36e('0x37')](_0x2291e7['query'][_0xe36e('0x37')]));_0x38175b[_0xe36e('0x36')]=_0x38175b[_0xe36e('0x36')][_0xe36e('0x4a')]?_0x38175b[_0xe36e('0x36')]:_0x56e6b9[_0xe36e('0x35')];_0x38175b['order']=qs['sort'](_0x2291e7['query'][_0xe36e('0x3c')]);_0x38175b[_0xe36e('0x3d')]=qs['filters'](_[_0xe36e('0x3e')](_0x2291e7['query'],_0x56e6b9[_0xe36e('0x33')]));if(_0x2291e7[_0xe36e('0x30')]['filter']){_0x38175b[_0xe36e('0x3d')]=_[_0xe36e('0x41')](_0x38175b[_0xe36e('0x3d')],{'$or':_[_0xe36e('0x43')](_0x38175b['attributes'],function(_0x513d27){var _0x14bf30={};_0x14bf30[_0x513d27]={'$like':'%'+_0x2291e7[_0xe36e('0x30')][_0xe36e('0x42')]+'%'};return _0x14bf30;})});}_0x38175b=_[_0xe36e('0x41')]({},_0x38175b,_0x2291e7['options']);return _0x56832f['getAgents'](_0x38175b);}})[_0xe36e('0x29')](function(_0x584f19){if(_0x584f19){_0x12e580=_0x584f19['length'];if(!_0x2291e7[_0xe36e('0x30')][_0xe36e('0x38')](_0xe36e('0x39'))){_0x38175b[_0xe36e('0x3a')]=qs[_0xe36e('0x3a')](_0x2291e7[_0xe36e('0x30')][_0xe36e('0x3a')]);_0x38175b[_0xe36e('0x25')]=qs[_0xe36e('0x25')](_0x2291e7['query'][_0xe36e('0x25')]);}return _0x56832f[_0xe36e('0xa4')](_0x38175b);}})[_0xe36e('0x29')](function(_0x4204a6){if(_0x4204a6){return _0x4204a6?{'count':_0x12e580,'rows':_0x4204a6}:null;}})[_0xe36e('0x29')](respondWithResult(_0x136bf7,null))[_0xe36e('0x20')](handleError(_0x136bf7,null));};exports[_0xe36e('0x2d')]=function(_0x5b7dcf,_0x19d78f,_0x3f0fd2){var _0x33761c,_0x58138f,_0x29f1a6;if(_[_0xe36e('0x66')](_0x5b7dcf[_0xe36e('0x4d')][_0xe36e('0x4d')])||_0x5b7dcf[_0xe36e('0x4d')][_0xe36e('0x4d')]===''){throw new db[(_0xe36e('0x5f'))][(_0xe36e('0x60'))](_0xe36e('0x69'));}if(_[_0xe36e('0x66')](_0x5b7dcf['body']['to'])){}_0x33761c=_0x5b7dcf[_0xe36e('0x4d')]['to'];return db[_0xe36e('0x2e')][_0xe36e('0x53')]({'where':{'id':_0x5b7dcf[_0xe36e('0x48')]['id']}})['then'](handleEntityNotFound(_0x19d78f,null))['then'](function(_0x3d2c55){if(_0x3d2c55){return db['OpenchannelAccount'][_0xe36e('0x4b')]({'where':{'id':_0x3d2c55['id']},'include':[{'model':db['CmList'],'as':_0xe36e('0x72'),'include':[{'model':db[_0xe36e('0x5e')],'as':'Contacts','where':{[_0x3d2c55[_0xe36e('0x6c')]]:_0x33761c},'limit':0x1,'order':[[_0xe36e('0x64'),_0xe36e('0x70')]]}]}]})['then'](handleEntityNotFound(_0x19d78f,null))[_0xe36e('0x29')](function(_0x3aecc1){if(_0x3aecc1&&_0x3aecc1[_0xe36e('0x72')]){_0x58138f=_0x3aecc1[_0xe36e('0x83')]({'plain':!![]});if(_0x58138f[_0xe36e('0x72')]&&_0x58138f['List'][_0xe36e('0x6f')][_0xe36e('0x4a')]){return _0x58138f[_0xe36e('0x72')][_0xe36e('0x6f')][0x0];}return db[_0xe36e('0x5e')]['create'](_[_0xe36e('0xa5')](_0x5b7dcf[_0xe36e('0x4d')],{'firstName':_0x33761c,[_0x3aecc1[_0xe36e('0x6c')]]:_0x33761c,'phone':_0x33761c,'ListId':_0x58138f[_0xe36e('0x65')]}));}})[_0xe36e('0x29')](handleEntityNotFound(_0x19d78f,null))['then'](function(_0x1c0a98){if(_0x1c0a98){_0x29f1a6=_0x1c0a98;return db['OpenchannelInteraction'][_0xe36e('0x4b')]({'where':{'ContactId':_0x29f1a6['id'],'closed':![],'OpenchannelAccountId':_0x58138f['id']}})['then'](function(_0xe07fc2){if(_0xe07fc2){return[_0xe07fc2,![]];}return db[_0xe36e('0x7d')][_0xe36e('0x4c')]({'UserId':_0x5b7dcf[_0xe36e('0xa6')]['id'],'ContactId':_0x29f1a6['id'],'OpenchannelAccountId':_0x58138f['id'],'lastMsgDirection':_0xe36e('0xa7'),'Messages':[_[_0xe36e('0x41')](_0x5b7dcf[_0xe36e('0x4d')],{'read':![],'body':_0x5b7dcf[_0xe36e('0x4d')][_0xe36e('0x4d')],'OpenchannelAccountId':_0x58138f['id'],'UserId':_0x5b7dcf[_0xe36e('0xa6')]['id'],'ContactId':_0x29f1a6['id']})]},{'include':[{'model':db[_0xe36e('0xa8')],'as':_0xe36e('0xa9')}]})[_0xe36e('0x29')](function(_0x4ec5b6){return[_0x4ec5b6,!![]];});});}})['spread'](function(_0x25b1f8,_0x3d7bdf){if(_0x3d7bdf){return _0x25b1f8;}return db[_0xe36e('0xa8')][_0xe36e('0x4c')](_[_0xe36e('0x41')](_0x5b7dcf[_0xe36e('0x4d')],{'read':![],'body':_0x5b7dcf[_0xe36e('0x4d')][_0xe36e('0x4d')],'OpenchannelAccountId':_0x58138f['id'],'OpenchannelInteractionId':_0x25b1f8['id'],'UserId':_0x5b7dcf[_0xe36e('0xa6')]['id'],'ContactId':_0x29f1a6['id']}))['then'](function(_0x9c6ea1){_0x25b1f8[_0xe36e('0xaa')]['Messages']=[];_0x25b1f8['dataValues'][_0xe36e('0xa9')][_0xe36e('0x85')](_0x9c6ea1[_0xe36e('0xaa')]);return _0x25b1f8;});});}})[_0xe36e('0x29')](respondWithResult(_0x19d78f,null))['catch'](handleError(_0x19d78f,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index d67ee56..f901e7e 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 _0xdccc=['remove','emit','hasOwnProperty','hook','events','OpenchannelAccount','setMaxListeners','update'];(function(_0x1e54a7,_0x4e7ea3){var _0x41d78e=function(_0xbf0801){while(--_0xbf0801){_0x1e54a7['push'](_0x1e54a7['shift']());}};_0x41d78e(++_0x4e7ea3);}(_0xdccc,0x144));var _0xcdcc=function(_0x4df16c,_0x540635){_0x4df16c=_0x4df16c-0x0;var _0x165da9=_0xdccc[_0x4df16c];return _0x165da9;};'use strict';var EventEmitter=require(_0xcdcc('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xcdcc('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xcdcc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcdcc('0x3'),'afterDestroy':_0xcdcc('0x4')};function emitEvent(_0x1668a5){return function(_0x134271,_0xda9134,_0x39fa2e){OpenchannelAccountEvents[_0xcdcc('0x5')](_0x1668a5+':'+_0x134271['id'],_0x134271);OpenchannelAccountEvents[_0xcdcc('0x5')](_0x1668a5,_0x134271);_0x39fa2e(null);};}for(var e in events){if(events[_0xcdcc('0x6')](e)){var event=events[e];OpenchannelAccount[_0xcdcc('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xe9c5=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','OpenchannelAccount'];(function(_0x1b1948,_0x49f451){var _0x3cbd38=function(_0x2ca4f2){while(--_0x2ca4f2){_0x1b1948['push'](_0x1b1948['shift']());}};_0x3cbd38(++_0x49f451);}(_0xe9c5,0xdf));var _0x5e9c=function(_0x105de4,_0x123f46){_0x105de4=_0x105de4-0x0;var _0x37abd1=_0xe9c5[_0x105de4];return _0x37abd1;};'use strict';var EventEmitter=require(_0x5e9c('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x5e9c('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x5e9c('0x2')](0x0);var events={'afterCreate':_0x5e9c('0x3'),'afterUpdate':'update','afterDestroy':_0x5e9c('0x4')};function emitEvent(_0x7dcc3){return function(_0x1d402a,_0x45ab68,_0x335b78){OpenchannelAccountEvents[_0x5e9c('0x5')](_0x7dcc3+':'+_0x1d402a['id'],_0x1d402a);OpenchannelAccountEvents[_0x5e9c('0x5')](_0x7dcc3,_0x1d402a);_0x335b78(null);};}for(var e in events){if(events[_0x5e9c('0x6')](e)){var event=events[e];OpenchannelAccount[_0x5e9c('0x7')](e,emitEvent(event));}}module[_0x5e9c('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index d49b60b..3fd5969 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 _0x0713=['openchannel_accounts','../../config/logger','api','moment','bluebird','request-promise','exports','define','OpenchannelAccount'];(function(_0x492535,_0x46524a){var _0x256620=function(_0x3015f8){while(--_0x3015f8){_0x492535['push'](_0x492535['shift']());}};_0x256620(++_0x46524a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var attributes=require('./openchannelAccount.attributes');module[_0x3071('0x5')]=function(_0x7b18a4,_0x33a70c){return _0x7b18a4[_0x3071('0x6')](_0x3071('0x7'),attributes,{'tableName':_0x3071('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['openchannel_accounts','lodash','../../config/logger','moment','request-promise','exports'];(function(_0x5d5b74,_0x3f1a90){var _0x5c3ea4=function(_0x280310){while(--_0x280310){_0x5d5b74['push'](_0x5d5b74['shift']());}};_0x5c3ea4(++_0x3f1a90);}(_0xb7e7,0x121));var _0x7b7e=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0xb7e7[_0x47a349];return _0x18ab75;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var attributes=require('./openchannelAccount.attributes');module[_0x7b7e('0x4')]=function(_0x118577,_0x1d9384){return _0x118577['define']('OpenchannelAccount',attributes,{'tableName':_0x7b7e('0x5'),'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 9f1f9f4..f621559 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 _0x3c94=['client','socket.io-emitter','localhost','./openchannelAccount.socket','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x16c00b,_0x32497e){var _0x421981=function(_0x31b218){while(--_0x31b218){_0x16c00b['push'](_0x16c00b['shift']());}};_0x421981(++_0x32497e);}(_0x3c94,0xcd));var _0x43c9=function(_0x3977dc,_0x18499a){_0x3977dc=_0x3977dc-0x0;var _0x40e46e=_0x3c94[_0x3977dc];return _0x40e46e;};'use strict';var _=require(_0x43c9('0x0'));var util=require(_0x43c9('0x1'));var moment=require(_0x43c9('0x2'));var BPromise=require(_0x43c9('0x3'));var rs=require(_0x43c9('0x4'));var fs=require('fs');var db=require(_0x43c9('0x5'))['db'];var utils=require(_0x43c9('0x6'));var logger=require(_0x43c9('0x7'))(_0x43c9('0x8'));var config=require(_0x43c9('0x9'));var jayson=require(_0x43c9('0xa'));var client=jayson[_0x43c9('0xb')]['http']({'port':0x232a});var socket=require(_0x43c9('0xc'))({'host':_0x43c9('0xd'),'port':0x18eb});require(_0x43c9('0xe'))[_0x43c9('0xf')](socket);function respondWithRpcPromise(_0x383adb,_0x7a0f6b,_0x28aa11){return new BPromise(function(_0x4725aa,_0x45f3a1){return client['request'](_0x383adb,_0x28aa11)[_0x43c9('0x10')](function(_0x18a5c9){logger[_0x43c9('0x11')](_0x43c9('0x12'),_0x7a0f6b,_0x43c9('0x13'));logger[_0x43c9('0x14')](_0x43c9('0x15'),_0x7a0f6b,_0x43c9('0x13'),JSON[_0x43c9('0x16')](_0x18a5c9));if(_0x18a5c9[_0x43c9('0x17')]){if(_0x18a5c9[_0x43c9('0x17')][_0x43c9('0x18')]===0x1f4){logger[_0x43c9('0x17')](_0x43c9('0x12'),_0x7a0f6b,_0x18a5c9[_0x43c9('0x17')][_0x43c9('0x19')]);return _0x45f3a1(_0x18a5c9[_0x43c9('0x17')]['message']);}logger[_0x43c9('0x17')](_0x43c9('0x12'),_0x7a0f6b,_0x18a5c9[_0x43c9('0x17')][_0x43c9('0x19')]);return _0x4725aa(_0x18a5c9[_0x43c9('0x17')]['message']);}else{logger['info'](_0x43c9('0x12'),_0x7a0f6b,_0x43c9('0x13'));_0x4725aa(_0x18a5c9[_0x43c9('0x1a')][_0x43c9('0x19')]);}})['catch'](function(_0x1d63cf){logger[_0x43c9('0x17')](_0x43c9('0x12'),_0x7a0f6b,_0x1d63cf);_0x45f3a1(_0x1d63cf);});});} \ No newline at end of file +var _0xe181=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','socket.io-emitter','localhost','./openchannelAccount.socket','register','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe181,0x68));var _0x1e18=function(_0x544099,_0x372b30){_0x544099=_0x544099-0x0;var _0x20ab09=_0xe181[_0x544099];return _0x20ab09;};'use strict';var _=require(_0x1e18('0x0'));var util=require('util');var moment=require(_0x1e18('0x1'));var BPromise=require(_0x1e18('0x2'));var rs=require(_0x1e18('0x3'));var fs=require('fs');var db=require(_0x1e18('0x4'))['db'];var utils=require(_0x1e18('0x5'));var logger=require(_0x1e18('0x6'))(_0x1e18('0x7'));var config=require('../../config/environment');var jayson=require(_0x1e18('0x8'));var client=jayson['client']['http']({'port':0x232a});var socket=require(_0x1e18('0x9'))({'host':_0x1e18('0xa'),'port':0x18eb});require(_0x1e18('0xb'))[_0x1e18('0xc')](socket);function respondWithRpcPromise(_0x9f9541,_0x398f77,_0x5e6cd3){return new BPromise(function(_0x2c95a2,_0x40fda9){return client[_0x1e18('0xd')](_0x9f9541,_0x5e6cd3)[_0x1e18('0xe')](function(_0x19d0bc){logger[_0x1e18('0xf')]('OpenchannelAccount,\x20%s,\x20%s',_0x398f77,_0x1e18('0x10'));logger[_0x1e18('0x11')](_0x1e18('0x12'),_0x398f77,_0x1e18('0x10'),JSON[_0x1e18('0x13')](_0x19d0bc));if(_0x19d0bc[_0x1e18('0x14')]){if(_0x19d0bc[_0x1e18('0x14')][_0x1e18('0x15')]===0x1f4){logger['error'](_0x1e18('0x16'),_0x398f77,_0x19d0bc['error'][_0x1e18('0x17')]);return _0x40fda9(_0x19d0bc['error'][_0x1e18('0x17')]);}logger[_0x1e18('0x14')](_0x1e18('0x16'),_0x398f77,_0x19d0bc[_0x1e18('0x14')][_0x1e18('0x17')]);return _0x2c95a2(_0x19d0bc[_0x1e18('0x14')][_0x1e18('0x17')]);}else{logger[_0x1e18('0xf')](_0x1e18('0x16'),_0x398f77,_0x1e18('0x10'));_0x2c95a2(_0x19d0bc[_0x1e18('0x18')][_0x1e18('0x17')]);}})[_0x1e18('0x19')](function(_0x4033da){logger[_0x1e18('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x398f77,_0x4033da);_0x40fda9(_0x4033da);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 4d5e456..4dca219 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 _0xf510=['remove','removeListener','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x40174f,_0x3a6751){var _0x40717c=function(_0x5ae03d){while(--_0x5ae03d){_0x40174f['push'](_0x40174f['shift']());}};_0x40717c(++_0x3a6751);}(_0xf510,0x191));var _0x0f51=function(_0x2e83e9,_0x308711){_0x2e83e9=_0x2e83e9-0x0;var _0x33208a=_0xf510[_0x2e83e9];return _0x33208a;};'use strict';var OpenchannelAccountEvents=require(_0x0f51('0x0'));var events=['save',_0x0f51('0x1'),'update'];function createListener(_0x27df24,_0x1f7c73){return function(_0x199ee1){_0x1f7c73['emit'](_0x27df24,_0x199ee1);};}function removeListener(_0x399a7b,_0x49821e){return function(){OpenchannelAccountEvents[_0x0f51('0x2')](_0x399a7b,_0x49821e);};}exports[_0x0f51('0x3')]=function(_0x3c8749){for(var _0x2d8cd3=0x0,_0x82413b=events[_0x0f51('0x4')];_0x2d8cd3<_0x82413b;_0x2d8cd3++){var _0x2eb32f=events[_0x2d8cd3];var _0x597db3=createListener(_0x0f51('0x5')+_0x2eb32f,_0x3c8749);OpenchannelAccountEvents['on'](_0x2eb32f,_0x597db3);}}; \ No newline at end of file +var _0x7d78=['openchannelAccount:','./openchannelAccount.events','save','remove','update','emit','register'];(function(_0xdeea17,_0x2d08b7){var _0x467a89=function(_0x2d76e9){while(--_0x2d76e9){_0xdeea17['push'](_0xdeea17['shift']());}};_0x467a89(++_0x2d08b7);}(_0x7d78,0x1b3));var _0x87d7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7d78[_0xa464c9];return _0x3d73c4;};'use strict';var OpenchannelAccountEvents=require(_0x87d7('0x0'));var events=[_0x87d7('0x1'),_0x87d7('0x2'),_0x87d7('0x3')];function createListener(_0x15a0f5,_0x21a009){return function(_0x508b9b){_0x21a009[_0x87d7('0x4')](_0x15a0f5,_0x508b9b);};}function removeListener(_0x44e528,_0x1dacca){return function(){OpenchannelAccountEvents['removeListener'](_0x44e528,_0x1dacca);};}exports[_0x87d7('0x5')]=function(_0x5ef645){for(var _0x3b1853=0x0,_0x236c47=events['length'];_0x3b1853<_0x236c47;_0x3b1853++){var _0x58c4e3=events[_0x3b1853];var _0x1cccba=createListener(_0x87d7('0x6')+_0x58c4e3,_0x5ef645);OpenchannelAccountEvents['on'](_0x58c4e3,_0x1cccba);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 95c4757..0d388cd 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 _0xa9e0=['/:id','show','create','update','delete','destroy','multer','util','path','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index'];(function(_0x41e3db,_0x2243c5){var _0x2f549c=function(_0x305e17){while(--_0x305e17){_0x41e3db['push'](_0x41e3db['shift']());}};_0x2f549c(++_0x2243c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 _0x70e0=['../../config/environment','./openchannelApplication.controller','isAuthenticated','get','post','create','put','/:id','update','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service'];(function(_0x585ee5,_0x1c9dba){var _0x470808=function(_0x35c90d){while(--_0x35c90d){_0x585ee5['push'](_0x585ee5['shift']());}};_0x470808(++_0x1c9dba);}(_0x70e0,0x17b));var _0x070e=function(_0x26b24a,_0x35138b){_0x26b24a=_0x26b24a-0x0;var _0x1dc822=_0x70e0[_0x26b24a];return _0x1dc822;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x070e('0x3'));var interaction=require(_0x070e('0x4'));var config=require(_0x070e('0x5'));var controller=require(_0x070e('0x6'));router['get']('/',auth[_0x070e('0x7')](),controller['index']);router[_0x070e('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x070e('0x9')]('/',auth[_0x070e('0x7')](),controller[_0x070e('0xa')]);router[_0x070e('0xb')](_0x070e('0xc'),auth[_0x070e('0x7')](),controller[_0x070e('0xd')]);router['delete']('/:id',auth[_0x070e('0x7')](),controller[_0x070e('0xe')]);module[_0x070e('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index b0c720a..0e5950b 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 _0x589f=['INTEGER','STRING','*,*,*,*','sequelize','exports'];(function(_0x121cce,_0x3d7e2e){var _0x10a17f=function(_0xd2053){while(--_0xd2053){_0x121cce['push'](_0x121cce['shift']());}};_0x10a17f(++_0x3d7e2e);}(_0x589f,0xc6));var _0xf589=function(_0x4ec3ab,_0x50a5de){_0x4ec3ab=_0x4ec3ab-0x0;var _0x229613=_0x589f[_0x4ec3ab];return _0x229613;};'use strict';var Sequelize=require(_0xf589('0x0'));module[_0xf589('0x1')]={'priority':{'type':Sequelize[_0xf589('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf589('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf589('0x3')](0x1000),'defaultValue':''},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xf589('0x4')}}; \ No newline at end of file +var _0x8c06=['INTEGER','STRING','noop','sequelize'];(function(_0x3aa732,_0x127ce7){var _0x1f99f7=function(_0x145337){while(--_0x145337){_0x3aa732['push'](_0x3aa732['shift']());}};_0x1f99f7(++_0x127ce7);}(_0x8c06,0x1db));var _0x68c0=function(_0xc286dc,_0x17944b){_0xc286dc=_0xc286dc-0x0;var _0x38a64b=_0x8c06[_0xc286dc];return _0x38a64b;};'use strict';var Sequelize=require(_0x68c0('0x0'));module['exports']={'priority':{'type':Sequelize[_0x68c0('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x68c0('0x2')],'allowNull':![],'defaultValue':_0x68c0('0x3')},'appdata':{'type':Sequelize[_0x68c0('0x2')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x68c0('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index f83d8c7..7ef30a7 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 _0x8005=['filters','include','create','find','body','destroy','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','end','error','stack','name','OpenchannelApplication','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','findAll','rows','catch','show','params'];(function(_0x1cce04,_0x515fef){var _0x3deb5e=function(_0x4e839a){while(--_0x4e839a){_0x1cce04['push'](_0x1cce04['shift']());}};_0x3deb5e(++_0x515fef);}(_0x8005,0x11a));var _0x5800=function(_0x72895a,_0x433607){_0x72895a=_0x72895a-0x0;var _0x5226d5=_0x8005[_0x72895a];return _0x5226d5;};'use strict';var jsonpatch=require(_0x5800('0x0'));var rp=require(_0x5800('0x1'));var moment=require(_0x5800('0x2'));var BPromise=require(_0x5800('0x3'));var Mustache=require('mustache');var util=require(_0x5800('0x4'));var path=require(_0x5800('0x5'));var sox=require('sox');var csv=require(_0x5800('0x6'));var ejs=require(_0x5800('0x7'));var fs=require('fs');var _=require(_0x5800('0x8'));var squel=require(_0x5800('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5800('0xa'));var toCsv=require(_0x5800('0x6'));var querystring=require(_0x5800('0xb'));var Papa=require(_0x5800('0xc'));var qs=require(_0x5800('0xd'));var logger=require(_0x5800('0xe'))(_0x5800('0xf'));var utils=require(_0x5800('0x10'));var config=require(_0x5800('0x11'));var db=require(_0x5800('0x12'))['db'];function respondWithStatusCode(_0x3eac8e,_0x562c67){_0x562c67=_0x562c67||0xcc;return function(_0x49a334){if(_0x49a334){return _0x3eac8e[_0x5800('0x13')](_0x562c67);}return _0x3eac8e[_0x5800('0x14')](_0x562c67)['end']();};}function respondWithResult(_0x9f6d90,_0x13a677){_0x13a677=_0x13a677||0xc8;return function(_0x58f1c6){if(_0x58f1c6){return _0x9f6d90[_0x5800('0x14')](_0x13a677)[_0x5800('0x15')](_0x58f1c6);}};}function respondWithFilteredResult(_0x19e133,_0xf1e087){return function(_0x1bdcbf){if(_0x1bdcbf){var _0x2aed78=_0x1bdcbf[_0x5800('0x16')],_0x1d330a=_0xf1e087[_0x5800('0x17')],_0x559663=_0xf1e087[_0x5800('0x17')]+_0xf1e087[_0x5800('0x18')],_0x29c729;if(_0x559663>=_0x2aed78){_0x559663=_0x2aed78;_0x29c729=0xc8;}else{_0x29c729=0xce;}_0x19e133[_0x5800('0x14')](_0x29c729);return _0x19e133[_0x5800('0x19')](_0x5800('0x1a'),_0x1d330a+'-'+_0x559663+'/'+_0x2aed78)['json'](_0x1bdcbf);}return null;};}function patchUpdates(_0x18651a){return function(_0x4f4141){try{jsonpatch['apply'](_0x4f4141,_0x18651a,!![]);}catch(_0x531ecb){return BPromise[_0x5800('0x1b')](_0x531ecb);}return _0x4f4141[_0x5800('0x1c')]();};}function saveUpdates(_0x13a6b8,_0x39d660){return function(_0x3ad76f){if(_0x3ad76f){return _0x3ad76f[_0x5800('0x1d')](_0x13a6b8)[_0x5800('0x1e')](function(_0x3a2374){return _0x3a2374;});}return null;};}function removeEntity(_0x3efb25,_0x157332){return function(_0x1aa12e){if(_0x1aa12e){return _0x1aa12e['destroy']()['then'](function(){_0x3efb25['status'](0xcc)[_0x5800('0x1f')]();});}};}function handleEntityNotFound(_0xaa11ea,_0x188c53){return function(_0x11c936){if(!_0x11c936){_0xaa11ea[_0x5800('0x13')](0x194);}return _0x11c936;};}function handleError(_0x24db06,_0x7c7aef){_0x7c7aef=_0x7c7aef||0x1f4;return function(_0x44b91e){logger[_0x5800('0x20')](_0x44b91e[_0x5800('0x21')]);if(_0x44b91e[_0x5800('0x22')]){delete _0x44b91e[_0x5800('0x22')];}_0x24db06['status'](_0x7c7aef)['send'](_0x44b91e);};}exports['index']=function(_0x1f1080,_0x5a2ae1){var _0x57d0eb={},_0x4cfd8b={},_0x24018d={'count':0x0,'rows':[]};var _0xecbca9=db[_0x5800('0x23')][_0x5800('0x24')];_0x4cfd8b[_0x5800('0x25')]=_[_0x5800('0x26')](_0xecbca9);var _0x583ac8={'dateStart':_0x1f1080[_0x5800('0x27')][_0x5800('0x28')],'dateEnd':_0x1f1080[_0x5800('0x27')]['dateEnd']};delete _0x1f1080[_0x5800('0x27')]['dateStart'];delete _0x1f1080[_0x5800('0x27')][_0x5800('0x29')];_0x4cfd8b[_0x5800('0x27')]=_[_0x5800('0x26')](_0x1f1080[_0x5800('0x27')]);_0x4cfd8b['filters']=_[_0x5800('0x2a')](_0x4cfd8b['model'],_0x4cfd8b[_0x5800('0x27')]);_0x57d0eb[_0x5800('0x2b')]=_[_0x5800('0x2a')](_0x4cfd8b[_0x5800('0x25')],qs[_0x5800('0x2c')](_0x1f1080[_0x5800('0x27')][_0x5800('0x2c')]));_0x57d0eb['attributes']=_0x57d0eb[_0x5800('0x2b')][_0x5800('0x2d')]?_0x57d0eb[_0x5800('0x2b')]:_0x4cfd8b[_0x5800('0x25')];if(!_0x1f1080[_0x5800('0x27')]['hasOwnProperty'](_0x5800('0x2e'))){_0x57d0eb['limit']=qs[_0x5800('0x18')](_0x1f1080['query'][_0x5800('0x18')]);_0x57d0eb[_0x5800('0x17')]=qs[_0x5800('0x17')](_0x1f1080[_0x5800('0x27')][_0x5800('0x17')]);}_0x57d0eb[_0x5800('0x2f')]=qs['sort'](_0x1f1080[_0x5800('0x27')][_0x5800('0x30')]);_0x57d0eb[_0x5800('0x31')]=qs['filters'](_[_0x5800('0x32')](_0x1f1080['query'],_0x4cfd8b['filters']));if(_0x583ac8[_0x5800('0x28')]){if(_0x583ac8[_0x5800('0x29')]){_0x583ac8[_0x5800('0x29')]=moment(_0x583ac8['dateEnd'])[_0x5800('0x33')](0x1,'day');}else{_0x583ac8[_0x5800('0x29')]=moment(_0x583ac8[_0x5800('0x28')])[_0x5800('0x33')](0x1,_0x5800('0x34'));}_[_0x5800('0x35')](_0x57d0eb[_0x5800('0x31')],{'createdAt':{'$gte':_0x583ac8['dateStart'],'$lte':_0x583ac8[_0x5800('0x29')]}});}if(_0x1f1080[_0x5800('0x27')][_0x5800('0x36')]){_0x57d0eb[_0x5800('0x31')]=_[_0x5800('0x35')](_0x57d0eb[_0x5800('0x31')],{'$or':_[_0x5800('0x37')](_0x57d0eb[_0x5800('0x2b')],function(_0x378d5f){var _0x2d3359={};_0x2d3359[_0x378d5f]={'$like':'%'+_0x1f1080['query'][_0x5800('0x36')]+'%'};return _0x2d3359;})});}_0x57d0eb=_[_0x5800('0x35')]({},_0x57d0eb,_0x1f1080[_0x5800('0x38')]);var _0x11b156={'where':_0x57d0eb[_0x5800('0x31')]};return db[_0x5800('0x23')][_0x5800('0x16')](_0x11b156)[_0x5800('0x1e')](function(_0x2e1924){_0x24018d['count']=_0x2e1924;if(_0x1f1080[_0x5800('0x27')][_0x5800('0x39')]){_0x57d0eb['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x5800('0x3a')](_0x57d0eb);})[_0x5800('0x1e')](function(_0xcf6fb8){_0x24018d[_0x5800('0x3b')]=_0xcf6fb8;return _0x24018d;})[_0x5800('0x1e')](respondWithFilteredResult(_0x5a2ae1,_0x57d0eb))[_0x5800('0x3c')](handleError(_0x5a2ae1,null));};exports[_0x5800('0x3d')]=function(_0x598149,_0x3da0a1){var _0x41578c={'raw':!![],'where':{'id':_0x598149[_0x5800('0x3e')]['id']}},_0x47bfd4={};_0x47bfd4[_0x5800('0x25')]=_[_0x5800('0x26')](db[_0x5800('0x23')][_0x5800('0x24')]);_0x47bfd4[_0x5800('0x27')]=_[_0x5800('0x26')](_0x598149[_0x5800('0x27')]);_0x47bfd4[_0x5800('0x3f')]=_[_0x5800('0x2a')](_0x47bfd4['model'],_0x47bfd4[_0x5800('0x27')]);_0x41578c['attributes']=_[_0x5800('0x2a')](_0x47bfd4[_0x5800('0x25')],qs[_0x5800('0x2c')](_0x598149[_0x5800('0x27')][_0x5800('0x2c')]));_0x41578c['attributes']=_0x41578c['attributes']['length']?_0x41578c[_0x5800('0x2b')]:_0x47bfd4['model'];if(_0x598149[_0x5800('0x27')][_0x5800('0x39')]){_0x41578c[_0x5800('0x40')]=[{'all':!![]}];}_0x41578c=_[_0x5800('0x35')]({},_0x41578c,_0x598149['options']);return db[_0x5800('0x23')]['find'](_0x41578c)[_0x5800('0x1e')](handleEntityNotFound(_0x3da0a1,null))['then'](respondWithResult(_0x3da0a1,null))[_0x5800('0x3c')](handleError(_0x3da0a1,null));};exports[_0x5800('0x41')]=function(_0x2645a2,_0x383bc2){return db[_0x5800('0x23')]['create'](_0x2645a2['body'],{})[_0x5800('0x1e')](respondWithResult(_0x383bc2,0xc9))[_0x5800('0x3c')](handleError(_0x383bc2,null));};exports[_0x5800('0x1d')]=function(_0xd9a035,_0x16f777){if(_0xd9a035['body']['id']){delete _0xd9a035['body']['id'];}return db[_0x5800('0x23')][_0x5800('0x42')]({'where':{'id':_0xd9a035[_0x5800('0x3e')]['id']}})[_0x5800('0x1e')](handleEntityNotFound(_0x16f777,null))[_0x5800('0x1e')](saveUpdates(_0xd9a035[_0x5800('0x43')],null))['then'](respondWithResult(_0x16f777,null))['catch'](handleError(_0x16f777,null));};exports[_0x5800('0x44')]=function(_0x29c5d9,_0x3af670){return db['OpenchannelApplication'][_0x5800('0x42')]({'where':{'id':_0x29c5d9[_0x5800('0x3e')]['id']}})[_0x5800('0x1e')](handleEntityNotFound(_0x3af670,null))[_0x5800('0x1e')](removeEntity(_0x3af670,null))[_0x5800('0x3c')](handleError(_0x3af670,null));}; \ No newline at end of file +var _0x11dd=['index','rawAttributes','model','keys','query','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','dateStart','day','add','merge','filter','map','OpenchannelApplication','includeAll','include','rows','catch','show','params','options','create','update','body','find','destroy','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','save','then','sendStatus','error','stack','name','send'];(function(_0x5cc4aa,_0x509689){var _0xe36f6=function(_0x11578b){while(--_0x11578b){_0x5cc4aa['push'](_0x5cc4aa['shift']());}};_0xe36f6(++_0x509689);}(_0x11dd,0x18c));var _0xd11d=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x11dd[_0xaa0309];return _0x5de7ce;};'use strict';var jsonpatch=require(_0xd11d('0x0'));var rp=require(_0xd11d('0x1'));var moment=require(_0xd11d('0x2'));var BPromise=require(_0xd11d('0x3'));var Mustache=require('mustache');var util=require(_0xd11d('0x4'));var path=require(_0xd11d('0x5'));var sox=require(_0xd11d('0x6'));var csv=require('to-csv');var ejs=require(_0xd11d('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd11d('0x8'));var crypto=require(_0xd11d('0x9'));var jsforce=require(_0xd11d('0xa'));var deskjs=require(_0xd11d('0xb'));var toCsv=require(_0xd11d('0xc'));var querystring=require(_0xd11d('0xd'));var Papa=require(_0xd11d('0xe'));var qs=require(_0xd11d('0xf'));var logger=require(_0xd11d('0x10'))(_0xd11d('0x11'));var utils=require(_0xd11d('0x12'));var config=require(_0xd11d('0x13'));var db=require(_0xd11d('0x14'))['db'];function respondWithStatusCode(_0x296c9c,_0x44c7ad){_0x44c7ad=_0x44c7ad||0xcc;return function(_0x172e3f){if(_0x172e3f){return _0x296c9c['sendStatus'](_0x44c7ad);}return _0x296c9c[_0xd11d('0x15')](_0x44c7ad)[_0xd11d('0x16')]();};}function respondWithResult(_0x55f07e,_0x212a1e){_0x212a1e=_0x212a1e||0xc8;return function(_0x26a4c8){if(_0x26a4c8){return _0x55f07e[_0xd11d('0x15')](_0x212a1e)[_0xd11d('0x17')](_0x26a4c8);}};}function respondWithFilteredResult(_0x46c539,_0x1d66b7){return function(_0x3d3c6f){if(_0x3d3c6f){var _0xd6bc69=_0x3d3c6f[_0xd11d('0x18')],_0x599722=_0x1d66b7[_0xd11d('0x19')],_0x364db0=_0x1d66b7['offset']+_0x1d66b7[_0xd11d('0x1a')],_0x25a7b8;if(_0x364db0>=_0xd6bc69){_0x364db0=_0xd6bc69;_0x25a7b8=0xc8;}else{_0x25a7b8=0xce;}_0x46c539[_0xd11d('0x15')](_0x25a7b8);return _0x46c539[_0xd11d('0x1b')]('Content-Range',_0x599722+'-'+_0x364db0+'/'+_0xd6bc69)[_0xd11d('0x17')](_0x3d3c6f);}return null;};}function patchUpdates(_0x4cb36c){return function(_0x4cf364){try{jsonpatch[_0xd11d('0x1c')](_0x4cf364,_0x4cb36c,!![]);}catch(_0x11f4b9){return BPromise['reject'](_0x11f4b9);}return _0x4cf364[_0xd11d('0x1d')]();};}function saveUpdates(_0x3f588d,_0xb62995){return function(_0x495fde){if(_0x495fde){return _0x495fde['update'](_0x3f588d)[_0xd11d('0x1e')](function(_0x1684eb){return _0x1684eb;});}return null;};}function removeEntity(_0xd7e3a,_0x8c3bc1){return function(_0x4e989f){if(_0x4e989f){return _0x4e989f['destroy']()[_0xd11d('0x1e')](function(){_0xd7e3a[_0xd11d('0x15')](0xcc)[_0xd11d('0x16')]();});}};}function handleEntityNotFound(_0x2cf5c0,_0x69d174){return function(_0x26eac3){if(!_0x26eac3){_0x2cf5c0[_0xd11d('0x1f')](0x194);}return _0x26eac3;};}function handleError(_0x748a58,_0x3d0350){_0x3d0350=_0x3d0350||0x1f4;return function(_0x112ed9){logger[_0xd11d('0x20')](_0x112ed9[_0xd11d('0x21')]);if(_0x112ed9[_0xd11d('0x22')]){delete _0x112ed9['name'];}_0x748a58[_0xd11d('0x15')](_0x3d0350)[_0xd11d('0x23')](_0x112ed9);};}exports[_0xd11d('0x24')]=function(_0x1c1068,_0x30f6cc){var _0x500e3c={},_0xf35a7d={},_0x357f2d={'count':0x0,'rows':[]};var _0x498ce4=db['OpenchannelApplication'][_0xd11d('0x25')];_0xf35a7d[_0xd11d('0x26')]=_[_0xd11d('0x27')](_0x498ce4);var _0x4e22e2={'dateStart':_0x1c1068[_0xd11d('0x28')]['dateStart'],'dateEnd':_0x1c1068[_0xd11d('0x28')]['dateEnd']};delete _0x1c1068[_0xd11d('0x28')]['dateStart'];delete _0x1c1068['query'][_0xd11d('0x29')];_0xf35a7d[_0xd11d('0x28')]=_['keys'](_0x1c1068[_0xd11d('0x28')]);_0xf35a7d[_0xd11d('0x2a')]=_[_0xd11d('0x2b')](_0xf35a7d[_0xd11d('0x26')],_0xf35a7d[_0xd11d('0x28')]);_0x500e3c['attributes']=_['intersection'](_0xf35a7d[_0xd11d('0x26')],qs[_0xd11d('0x2c')](_0x1c1068[_0xd11d('0x28')]['fields']));_0x500e3c[_0xd11d('0x2d')]=_0x500e3c[_0xd11d('0x2d')][_0xd11d('0x2e')]?_0x500e3c[_0xd11d('0x2d')]:_0xf35a7d[_0xd11d('0x26')];if(!_0x1c1068[_0xd11d('0x28')][_0xd11d('0x2f')](_0xd11d('0x30'))){_0x500e3c['limit']=qs['limit'](_0x1c1068[_0xd11d('0x28')]['limit']);_0x500e3c[_0xd11d('0x19')]=qs[_0xd11d('0x19')](_0x1c1068[_0xd11d('0x28')][_0xd11d('0x19')]);}_0x500e3c[_0xd11d('0x31')]=qs[_0xd11d('0x32')](_0x1c1068[_0xd11d('0x28')][_0xd11d('0x32')]);_0x500e3c[_0xd11d('0x33')]=qs[_0xd11d('0x2a')](_[_0xd11d('0x34')](_0x1c1068[_0xd11d('0x28')],_0xf35a7d[_0xd11d('0x2a')]));if(_0x4e22e2[_0xd11d('0x35')]){if(_0x4e22e2[_0xd11d('0x29')]){_0x4e22e2['dateEnd']=moment(_0x4e22e2['dateEnd'])['add'](0x1,_0xd11d('0x36'));}else{_0x4e22e2[_0xd11d('0x29')]=moment(_0x4e22e2['dateStart'])[_0xd11d('0x37')](0x1,_0xd11d('0x36'));}_[_0xd11d('0x38')](_0x500e3c[_0xd11d('0x33')],{'createdAt':{'$gte':_0x4e22e2[_0xd11d('0x35')],'$lte':_0x4e22e2[_0xd11d('0x29')]}});}if(_0x1c1068[_0xd11d('0x28')][_0xd11d('0x39')]){_0x500e3c[_0xd11d('0x33')]=_[_0xd11d('0x38')](_0x500e3c[_0xd11d('0x33')],{'$or':_[_0xd11d('0x3a')](_0x500e3c[_0xd11d('0x2d')],function(_0x45baa1){var _0x29045={};_0x29045[_0x45baa1]={'$like':'%'+_0x1c1068[_0xd11d('0x28')][_0xd11d('0x39')]+'%'};return _0x29045;})});}_0x500e3c=_[_0xd11d('0x38')]({},_0x500e3c,_0x1c1068['options']);var _0x5e07f3={'where':_0x500e3c[_0xd11d('0x33')]};return db[_0xd11d('0x3b')][_0xd11d('0x18')](_0x5e07f3)[_0xd11d('0x1e')](function(_0x2fd516){_0x357f2d['count']=_0x2fd516;if(_0x1c1068[_0xd11d('0x28')][_0xd11d('0x3c')]){_0x500e3c[_0xd11d('0x3d')]=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x500e3c);})[_0xd11d('0x1e')](function(_0x313dbc){_0x357f2d[_0xd11d('0x3e')]=_0x313dbc;return _0x357f2d;})[_0xd11d('0x1e')](respondWithFilteredResult(_0x30f6cc,_0x500e3c))[_0xd11d('0x3f')](handleError(_0x30f6cc,null));};exports[_0xd11d('0x40')]=function(_0x9f842b,_0x6c8a7f){var _0x158e4a={'raw':!![],'where':{'id':_0x9f842b[_0xd11d('0x41')]['id']}},_0x24329a={};_0x24329a[_0xd11d('0x26')]=_[_0xd11d('0x27')](db['OpenchannelApplication']['rawAttributes']);_0x24329a[_0xd11d('0x28')]=_['keys'](_0x9f842b[_0xd11d('0x28')]);_0x24329a['filters']=_['intersection'](_0x24329a['model'],_0x24329a['query']);_0x158e4a['attributes']=_['intersection'](_0x24329a[_0xd11d('0x26')],qs[_0xd11d('0x2c')](_0x9f842b['query'][_0xd11d('0x2c')]));_0x158e4a[_0xd11d('0x2d')]=_0x158e4a[_0xd11d('0x2d')][_0xd11d('0x2e')]?_0x158e4a[_0xd11d('0x2d')]:_0x24329a[_0xd11d('0x26')];if(_0x9f842b[_0xd11d('0x28')][_0xd11d('0x3c')]){_0x158e4a[_0xd11d('0x3d')]=[{'all':!![]}];}_0x158e4a=_[_0xd11d('0x38')]({},_0x158e4a,_0x9f842b[_0xd11d('0x42')]);return db['OpenchannelApplication']['find'](_0x158e4a)['then'](handleEntityNotFound(_0x6c8a7f,null))['then'](respondWithResult(_0x6c8a7f,null))[_0xd11d('0x3f')](handleError(_0x6c8a7f,null));};exports[_0xd11d('0x43')]=function(_0x317bde,_0x45c047){return db[_0xd11d('0x3b')]['create'](_0x317bde['body'],{})['then'](respondWithResult(_0x45c047,0xc9))[_0xd11d('0x3f')](handleError(_0x45c047,null));};exports[_0xd11d('0x44')]=function(_0x271c6e,_0x4c9784){if(_0x271c6e[_0xd11d('0x45')]['id']){delete _0x271c6e['body']['id'];}return db['OpenchannelApplication'][_0xd11d('0x46')]({'where':{'id':_0x271c6e[_0xd11d('0x41')]['id']}})[_0xd11d('0x1e')](handleEntityNotFound(_0x4c9784,null))[_0xd11d('0x1e')](saveUpdates(_0x271c6e[_0xd11d('0x45')],null))[_0xd11d('0x1e')](respondWithResult(_0x4c9784,null))[_0xd11d('0x3f')](handleError(_0x4c9784,null));};exports[_0xd11d('0x47')]=function(_0x1dacce,_0x509ca2){return db[_0xd11d('0x3b')][_0xd11d('0x46')]({'where':{'id':_0x1dacce['params']['id']}})[_0xd11d('0x1e')](handleEntityNotFound(_0x509ca2,null))[_0xd11d('0x1e')](removeEntity(_0x509ca2,null))[_0xd11d('0x3f')](handleError(_0x509ca2,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 5d54f50..1a015bc 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 _0x3c6a=['exports','openchannel_applications','../../config/logger','moment','bluebird','request-promise'];(function(_0x1dd82f,_0x52acb7){var _0x353ca4=function(_0x5ee4c9){while(--_0x5ee4c9){_0x1dd82f['push'](_0x1dd82f['shift']());}};_0x353ca4(++_0x52acb7);}(_0x3c6a,0x13a));var _0xa3c6=function(_0xab9f3d,_0xb336fa){_0xab9f3d=_0xab9f3d-0x0;var _0x5283bf=_0x3c6a[_0xab9f3d];return _0x5283bf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa3c6('0x0'))('api');var moment=require(_0xa3c6('0x1'));var BPromise=require(_0xa3c6('0x2'));var rp=require(_0xa3c6('0x3'));var attributes=require('./openchannelApplication.attributes');module[_0xa3c6('0x4')]=function(_0x11e738,_0x1e3139){return _0x11e738['define']('OpenchannelApplication',attributes,{'tableName':_0xa3c6('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9d9=['request-promise','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3b5e63,_0xd6e24e){var _0x410e7f=function(_0x3469bc){while(--_0x3469bc){_0x3b5e63['push'](_0x3b5e63['shift']());}};_0x410e7f(++_0xd6e24e);}(_0xc9d9,0xa2));var _0x9c9d=function(_0x3ca22b,_0x20a10d){_0x3ca22b=_0x3ca22b-0x0;var _0x5d40d0=_0xc9d9[_0x3ca22b];return _0x5d40d0;};'use strict';var _=require(_0x9c9d('0x0'));var util=require(_0x9c9d('0x1'));var logger=require(_0x9c9d('0x2'))(_0x9c9d('0x3'));var moment=require(_0x9c9d('0x4'));var BPromise=require(_0x9c9d('0x5'));var rp=require(_0x9c9d('0x6'));var attributes=require(_0x9c9d('0x7'));module[_0x9c9d('0x8')]=function(_0x6e8342,_0x5556a0){return _0x6e8342[_0x9c9d('0x9')](_0x9c9d('0xa'),attributes,{'tableName':_0x9c9d('0xb'),'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 06b7956..5b6d166 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 _0xbd10=['raw','options','where','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateOpenchannelApplication','update','body'];(function(_0x3d2227,_0x3d7cc1){var _0xdddd19=function(_0x3add88){while(--_0x3add88){_0x3d2227['push'](_0x3d2227['shift']());}};_0xdddd19(++_0x3d7cc1);}(_0xbd10,0x85));var _0x0bd1=function(_0xb9a03a,_0x4d9ea2){_0xb9a03a=_0xb9a03a-0x0;var _0x567724=_0xbd10[_0xb9a03a];return _0x567724;};'use strict';var _=require(_0x0bd1('0x0'));var util=require(_0x0bd1('0x1'));var moment=require(_0x0bd1('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bd1('0x3'));var fs=require('fs');var db=require(_0x0bd1('0x4'))['db'];var utils=require(_0x0bd1('0x5'));var logger=require('../../config/logger')(_0x0bd1('0x6'));var config=require(_0x0bd1('0x7'));var jayson=require(_0x0bd1('0x8'));var client=jayson[_0x0bd1('0x9')][_0x0bd1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46c432,_0x4c129c,_0x143a85){return new BPromise(function(_0x4dbb43,_0x639350){return client[_0x0bd1('0xb')](_0x46c432,_0x143a85)[_0x0bd1('0xc')](function(_0x468e7c){logger['info'](_0x0bd1('0xd'),_0x4c129c,_0x0bd1('0xe'));logger[_0x0bd1('0xf')](_0x0bd1('0x10'),_0x4c129c,_0x0bd1('0xe'),JSON[_0x0bd1('0x11')](_0x468e7c));if(_0x468e7c['error']){if(_0x468e7c[_0x0bd1('0x12')][_0x0bd1('0x13')]===0x1f4){logger[_0x0bd1('0x12')](_0x0bd1('0xd'),_0x4c129c,_0x468e7c[_0x0bd1('0x12')][_0x0bd1('0x14')]);return _0x639350(_0x468e7c['error'][_0x0bd1('0x14')]);}logger[_0x0bd1('0x12')](_0x0bd1('0xd'),_0x4c129c,_0x468e7c['error']['message']);return _0x4dbb43(_0x468e7c[_0x0bd1('0x12')][_0x0bd1('0x14')]);}else{logger[_0x0bd1('0x15')]('OpenchannelApplication,\x20%s,\x20%s',_0x4c129c,'request\x20sent');_0x4dbb43(_0x468e7c[_0x0bd1('0x16')][_0x0bd1('0x14')]);}})[_0x0bd1('0x17')](function(_0x5ab359){logger[_0x0bd1('0x12')](_0x0bd1('0xd'),_0x4c129c,_0x5ab359);_0x639350(_0x5ab359);});});}exports[_0x0bd1('0x18')]=function(_0x3042c6){var _0x4790eb=this;return new Promise(function(_0x11479e,_0x3d1170){return db['OpenchannelApplication'][_0x0bd1('0x19')](_0x3042c6[_0x0bd1('0x1a')],{'raw':_0x3042c6['options']?_0x3042c6['options'][_0x0bd1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3042c6[_0x0bd1('0x1c')]?_0x3042c6[_0x0bd1('0x1c')][_0x0bd1('0x1d')]||null:null,'attributes':_0x3042c6[_0x0bd1('0x1c')]?_0x3042c6[_0x0bd1('0x1c')][_0x0bd1('0x1e')]||null:null,'limit':_0x3042c6[_0x0bd1('0x1c')]?_0x3042c6['options'][_0x0bd1('0x1f')]||null:null})[_0x0bd1('0xc')](function(_0x31eaf5){logger[_0x0bd1('0x15')](_0x0bd1('0x18'),_0x3042c6);logger['debug'](_0x0bd1('0x18'),_0x3042c6,JSON['stringify'](_0x31eaf5));_0x11479e(_0x31eaf5);})['catch'](function(_0x9bb815){logger[_0x0bd1('0x12')](_0x0bd1('0x18'),_0x9bb815[_0x0bd1('0x14')],_0x3042c6);_0x3d1170(_0x4790eb[_0x0bd1('0x12')](0x1f4,_0x9bb815[_0x0bd1('0x14')]));});});}; \ No newline at end of file +var _0x8958=['OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','where','attributes','limit','util','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x479a5c,_0x2f26c7){var _0x4209ed=function(_0x10455b){while(--_0x10455b){_0x479a5c['push'](_0x479a5c['shift']());}};_0x4209ed(++_0x2f26c7);}(_0x8958,0x93));var _0x8895=function(_0x248e45,_0x3c527c){_0x248e45=_0x248e45-0x0;var _0x11583e=_0x8958[_0x248e45];return _0x11583e;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x8895('0x1'));var logger=require('../../config/logger')(_0x8895('0x2'));var config=require(_0x8895('0x3'));var jayson=require(_0x8895('0x4'));var client=jayson['client'][_0x8895('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x2f03ad,_0x124e1e,_0x40cec6){return new BPromise(function(_0x33013a,_0x51376b){return client[_0x8895('0x6')](_0x2f03ad,_0x40cec6)[_0x8895('0x7')](function(_0x408d4b){logger[_0x8895('0x8')](_0x8895('0x9'),_0x124e1e,_0x8895('0xa'));logger[_0x8895('0xb')](_0x8895('0xc'),_0x124e1e,_0x8895('0xa'),JSON[_0x8895('0xd')](_0x408d4b));if(_0x408d4b['error']){if(_0x408d4b[_0x8895('0xe')][_0x8895('0xf')]===0x1f4){logger[_0x8895('0xe')](_0x8895('0x9'),_0x124e1e,_0x408d4b[_0x8895('0xe')][_0x8895('0x10')]);return _0x51376b(_0x408d4b['error'][_0x8895('0x10')]);}logger[_0x8895('0xe')](_0x8895('0x9'),_0x124e1e,_0x408d4b['error']['message']);return _0x33013a(_0x408d4b[_0x8895('0xe')]['message']);}else{logger[_0x8895('0x8')](_0x8895('0x9'),_0x124e1e,_0x8895('0xa'));_0x33013a(_0x408d4b[_0x8895('0x11')][_0x8895('0x10')]);}})['catch'](function(_0x4128e2){logger[_0x8895('0xe')](_0x8895('0x9'),_0x124e1e,_0x4128e2);_0x51376b(_0x4128e2);});});}exports[_0x8895('0x12')]=function(_0x2848b7){var _0x1b5c82=this;return new Promise(function(_0x304be6,_0x26cee0){return db[_0x8895('0x13')][_0x8895('0x14')](_0x2848b7[_0x8895('0x15')],{'raw':_0x2848b7[_0x8895('0x16')]?_0x2848b7[_0x8895('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2848b7['options']?_0x2848b7['options'][_0x8895('0x17')]||null:null,'attributes':_0x2848b7[_0x8895('0x16')]?_0x2848b7[_0x8895('0x16')][_0x8895('0x18')]||null:null,'limit':_0x2848b7[_0x8895('0x16')]?_0x2848b7[_0x8895('0x16')][_0x8895('0x19')]||null:null})[_0x8895('0x7')](function(_0x5219ca){logger[_0x8895('0x8')](_0x8895('0x12'),_0x2848b7);logger[_0x8895('0xb')](_0x8895('0x12'),_0x2848b7,JSON[_0x8895('0xd')](_0x5219ca));_0x304be6(_0x5219ca);})['catch'](function(_0x5d354a){logger[_0x8895('0xe')](_0x8895('0x12'),_0x5d354a[_0x8895('0x10')],_0x2848b7);_0x26cee0(_0x1b5c82[_0x8895('0xe')](0x1f4,_0x5d354a['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 7f21527..aed32f6 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 _0xf61f=['multer','util','path','express','Router','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','create','addMessage','post','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy'];(function(_0x98ec03,_0x177ec5){var _0x37f874=function(_0x5f1c0f){while(--_0x5f1c0f){_0x98ec03['push'](_0x98ec03['shift']());}};_0x37f874(++_0x177ec5);}(_0xf61f,0xb6));var _0xff61=function(_0x2f8d56,_0x376c64){_0x2f8d56=_0x2f8d56-0x0;var _0x36081d=_0xf61f[_0x2f8d56];return _0x36081d;};'use strict';var multer=require(_0xff61('0x0'));var util=require(_0xff61('0x1'));var path=require(_0xff61('0x2'));var express=require(_0xff61('0x3'));var router=express[_0xff61('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0xff61('0x5')]('/',auth[_0xff61('0x6')](),controller[_0xff61('0x7')]);router[_0xff61('0x5')](_0xff61('0x8'),auth[_0xff61('0x6')](),controller[_0xff61('0x9')]);router['get'](_0xff61('0xa'),auth[_0xff61('0x6')](),controller['show']);router[_0xff61('0x5')](_0xff61('0xb'),auth[_0xff61('0x6')](),controller[_0xff61('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xff61('0xd')]);router['post'](_0xff61('0xb'),auth[_0xff61('0x6')](),controller[_0xff61('0xe')]);router[_0xff61('0xf')](_0xff61('0x10'),auth[_0xff61('0x6')](),interaction[_0xff61('0x11')](_0xff61('0x12'),_0xff61('0x13')),controller['addTags']);router[_0xff61('0x14')](_0xff61('0xa'),auth[_0xff61('0x6')](),interaction[_0xff61('0x11')](_0xff61('0x12'),_0xff61('0x15')),controller[_0xff61('0x16')]);router[_0xff61('0x17')](_0xff61('0xa'),auth[_0xff61('0x6')](),interaction[_0xff61('0x11')]('openchannel',_0xff61('0x18')),controller[_0xff61('0x19')]);router['delete'](_0xff61('0x10'),auth[_0xff61('0x6')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xc2d2=['exports','multer','util','express','Router','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','/:id','show','/:id/messages','getMessages','create','post','addMessage','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2d2,0x160));var _0x2c2d=function(_0x53ddab,_0x4ada9d){_0x53ddab=_0x53ddab-0x0;var _0x5819ac=_0xc2d2[_0x53ddab];return _0x5819ac;};'use strict';var multer=require(_0x2c2d('0x0'));var util=require(_0x2c2d('0x1'));var path=require('path');var express=require(_0x2c2d('0x2'));var router=express[_0x2c2d('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x2c2d('0x4'));var config=require('../../config/environment');var controller=require(_0x2c2d('0x5'));router[_0x2c2d('0x6')]('/',auth[_0x2c2d('0x7')](),controller['index']);router[_0x2c2d('0x6')]('/describe',auth[_0x2c2d('0x7')](),controller['describe']);router[_0x2c2d('0x6')](_0x2c2d('0x8'),auth[_0x2c2d('0x7')](),controller[_0x2c2d('0x9')]);router[_0x2c2d('0x6')](_0x2c2d('0xa'),auth[_0x2c2d('0x7')](),controller[_0x2c2d('0xb')]);router['post']('/',auth[_0x2c2d('0x7')](),controller[_0x2c2d('0xc')]);router[_0x2c2d('0xd')](_0x2c2d('0xa'),auth[_0x2c2d('0x7')](),controller[_0x2c2d('0xe')]);router['post']('/:id/tags',auth[_0x2c2d('0x7')](),interaction[_0x2c2d('0xf')](_0x2c2d('0x10'),_0x2c2d('0x11')),controller[_0x2c2d('0x12')]);router[_0x2c2d('0x13')](_0x2c2d('0x8'),auth[_0x2c2d('0x7')](),interaction[_0x2c2d('0xf')](_0x2c2d('0x10'),_0x2c2d('0x14')),controller[_0x2c2d('0x15')]);router['delete'](_0x2c2d('0x8'),auth[_0x2c2d('0x7')](),interaction[_0x2c2d('0xf')]('openchannel',_0x2c2d('0x16')),controller[_0x2c2d('0x17')]);router[_0x2c2d('0x18')]('/:id/tags',auth[_0x2c2d('0x7')](),controller[_0x2c2d('0x19')]);module[_0x2c2d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 721c1a7..99db136 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 _0xcea5=['DATE','STRING','out','sequelize','exports','BOOLEAN'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xcea5,0xed));var _0x5cea=function(_0x581a72,_0x40c56f){_0x581a72=_0x581a72-0x0;var _0x15483f=_0xcea5[_0x581a72];return _0x15483f;};'use strict';var Sequelize=require(_0x5cea('0x0'));module[_0x5cea('0x1')]={'closed':{'type':Sequelize[_0x5cea('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5cea('0x3')]},'disposition':{'type':Sequelize[_0x5cea('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x5cea('0x3')]},'threadId':{'type':Sequelize[_0x5cea('0x4')]},'externalUrl':{'type':Sequelize[_0x5cea('0x4')]},'lastMsgAt':{'type':Sequelize[_0x5cea('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x5cea('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x5cea('0x4')]}}; \ No newline at end of file +var _0x7fec=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x2f1561,_0x49890c){var _0x3242fb=function(_0x4bdae1){while(--_0x4bdae1){_0x2f1561['push'](_0x2f1561['shift']());}};_0x3242fb(++_0x49890c);}(_0x7fec,0x6e));var _0xc7fe=function(_0xdb516,_0x2d2fae){_0xdb516=_0xdb516-0x0;var _0x14d00a=_0x7fec[_0xdb516];return _0x14d00a;};'use strict';var Sequelize=require(_0xc7fe('0x0'));module[_0xc7fe('0x1')]={'closed':{'type':Sequelize[_0xc7fe('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc7fe('0x3')]},'disposition':{'type':Sequelize[_0xc7fe('0x4')]},'note':{'type':Sequelize[_0xc7fe('0x4')]},'read1stAt':{'type':Sequelize[_0xc7fe('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xc7fe('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xc7fe('0x5')]('in',_0xc7fe('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xc7fe('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 8688059..4754168 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 _0xc7e3=['add','day','merge','map','filter','options','tag','include','Tag','Tags','distinct','push','OpenchannelMessage','Messages','direction','createdAt','read','includeAll','Users','CmContact','Contact','User','Owner','fullname','OpenchannelAccount','Account','key','ThroughTags','color','findAll','catch','params','keys','find','create','body','describe','addMessage','ids','hasOwnProperty','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','emit','openchannelInteractionTags:save','removeTags','fast-json-patch','moment','mustache','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','OpenchannelInteraction','rawAttributes','model','query','dateEnd','dateStart','attributes','intersection','fields','length','nolimit','offset','order','sort','where','filters','pick'];(function(_0x392dff,_0x128a59){var _0x453041=function(_0x5c9fec){while(--_0x5c9fec){_0x392dff['push'](_0x392dff['shift']());}};_0x453041(++_0x128a59);}(_0xc7e3,0xfc));var _0x3c7e=function(_0x1d397b,_0x29ffdf){_0x1d397b=_0x1d397b-0x0;var _0x482905=_0xc7e3[_0x1d397b];return _0x482905;};'use strict';var jsonpatch=require(_0x3c7e('0x0'));var rp=require('request-promise');var moment=require(_0x3c7e('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x3c7e('0x2'));var util=require('util');var path=require('path');var sox=require(_0x3c7e('0x3'));var csv=require('to-csv');var ejs=require(_0x3c7e('0x4'));var fs=require('fs');var _=require(_0x3c7e('0x5'));var squel=require(_0x3c7e('0x6'));var crypto=require('crypto');var jsforce=require(_0x3c7e('0x7'));var deskjs=require(_0x3c7e('0x8'));var toCsv=require('to-csv');var querystring=require(_0x3c7e('0x9'));var Papa=require(_0x3c7e('0xa'));var qs=require(_0x3c7e('0xb'));var logger=require(_0x3c7e('0xc'))('api');var utils=require(_0x3c7e('0xd'));var config=require('../../config/environment');var db=require(_0x3c7e('0xe'))['db'];var socket=require(_0x3c7e('0xf'))({'host':'localhost','port':0x18eb});require(_0x3c7e('0x10'))[_0x3c7e('0x11')](socket);function respondWithStatusCode(_0x3b2f73,_0x99ae51){_0x99ae51=_0x99ae51||0xcc;return function(_0x55d2fc){if(_0x55d2fc){return _0x3b2f73[_0x3c7e('0x12')](_0x99ae51);}return _0x3b2f73[_0x3c7e('0x13')](_0x99ae51)['end']();};}function respondWithResult(_0x3a1516,_0x19298c){_0x19298c=_0x19298c||0xc8;return function(_0x5197e6){if(_0x5197e6){return _0x3a1516[_0x3c7e('0x13')](_0x19298c)[_0x3c7e('0x14')](_0x5197e6);}};}function respondWithFilteredResult(_0x256e18,_0x539234){return function(_0x8979b){if(_0x8979b){var _0x30b2d2=_0x8979b[_0x3c7e('0x15')],_0x581551=_0x539234['offset'],_0x345829=_0x539234['offset']+_0x539234[_0x3c7e('0x16')],_0x286daa;if(_0x345829>=_0x30b2d2){_0x345829=_0x30b2d2;_0x286daa=0xc8;}else{_0x286daa=0xce;}_0x256e18['status'](_0x286daa);return _0x256e18[_0x3c7e('0x17')](_0x3c7e('0x18'),_0x581551+'-'+_0x345829+'/'+_0x30b2d2)['json'](_0x8979b);}return null;};}function patchUpdates(_0x5c1b1f){return function(_0x53bb1f){try{jsonpatch[_0x3c7e('0x19')](_0x53bb1f,_0x5c1b1f,!![]);}catch(_0x1578a9){return BPromise[_0x3c7e('0x1a')](_0x1578a9);}return _0x53bb1f['save']();};}function saveUpdates(_0x60f5ca,_0x350fc7){return function(_0x31e707){if(_0x31e707){return _0x31e707[_0x3c7e('0x1b')](_0x60f5ca)[_0x3c7e('0x1c')](function(_0x34ebff){return _0x34ebff;});}return null;};}function removeEntity(_0x250f70,_0x4c3f56){return function(_0x2eedab){if(_0x2eedab){return _0x2eedab[_0x3c7e('0x1d')]()[_0x3c7e('0x1c')](function(){_0x250f70['status'](0xcc)[_0x3c7e('0x1e')]();});}};}function handleEntityNotFound(_0x243cff,_0x4f5240){return function(_0x15f38b){if(!_0x15f38b){_0x243cff[_0x3c7e('0x12')](0x194);}return _0x15f38b;};}function handleError(_0x4fafdc,_0x5be5bd){_0x5be5bd=_0x5be5bd||0x1f4;return function(_0x24b757){logger[_0x3c7e('0x1f')](_0x24b757[_0x3c7e('0x20')]);if(_0x24b757[_0x3c7e('0x21')]){delete _0x24b757[_0x3c7e('0x21')];}_0x4fafdc[_0x3c7e('0x13')](_0x5be5bd)['send'](_0x24b757);};}exports['index']=function(_0x2d8274,_0x3e7e19){var _0x1fe23c={},_0x4750dd={},_0x351c75={'count':0x0,'rows':[]};var _0x1764ac=db[_0x3c7e('0x22')][_0x3c7e('0x23')];_0x4750dd[_0x3c7e('0x24')]=_['keys'](_0x1764ac);var _0x5e4387={'dateStart':_0x2d8274['query']['dateStart'],'dateEnd':_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x26')]};delete _0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x27')];delete _0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x26')];_0x4750dd[_0x3c7e('0x25')]=_['keys'](_0x2d8274['query']);_0x4750dd['filters']=_['intersection'](_0x4750dd[_0x3c7e('0x24')],_0x4750dd[_0x3c7e('0x25')]);_0x1fe23c[_0x3c7e('0x28')]=_[_0x3c7e('0x29')](_0x4750dd['model'],qs[_0x3c7e('0x2a')](_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x2a')]));_0x1fe23c[_0x3c7e('0x28')]=_0x1fe23c[_0x3c7e('0x28')][_0x3c7e('0x2b')]?_0x1fe23c[_0x3c7e('0x28')]:_0x4750dd['model'];if(!_0x2d8274[_0x3c7e('0x25')]['hasOwnProperty'](_0x3c7e('0x2c'))){_0x1fe23c[_0x3c7e('0x16')]=qs[_0x3c7e('0x16')](_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x16')]);_0x1fe23c[_0x3c7e('0x2d')]=qs['offset'](_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x2d')]);}_0x1fe23c[_0x3c7e('0x2e')]=qs['sort'](_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x2f')]);_0x1fe23c[_0x3c7e('0x30')]=qs[_0x3c7e('0x31')](_[_0x3c7e('0x32')](_0x2d8274[_0x3c7e('0x25')],_0x4750dd[_0x3c7e('0x31')]));if(_0x5e4387[_0x3c7e('0x27')]){if(_0x5e4387['dateEnd']){_0x5e4387[_0x3c7e('0x26')]=moment(_0x5e4387[_0x3c7e('0x26')])[_0x3c7e('0x33')](0x1,_0x3c7e('0x34'));}else{_0x5e4387['dateEnd']=moment(_0x5e4387[_0x3c7e('0x27')])[_0x3c7e('0x33')](0x1,_0x3c7e('0x34'));}_[_0x3c7e('0x35')](_0x1fe23c['where'],{'createdAt':{'$gte':_0x5e4387[_0x3c7e('0x27')],'$lte':_0x5e4387[_0x3c7e('0x26')]}});}if(_0x2d8274['query']['filter']){_0x1fe23c[_0x3c7e('0x30')]=_[_0x3c7e('0x35')](_0x1fe23c['where'],{'$or':_[_0x3c7e('0x36')](_0x1fe23c['attributes'],function(_0x14f539){var _0x4846b2={};_0x4846b2[_0x14f539]={'$like':'%'+_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x37')]+'%'};return _0x4846b2;})});}_0x1fe23c=_[_0x3c7e('0x35')]({},_0x1fe23c,_0x2d8274[_0x3c7e('0x38')]);var _0x44afc9={'where':_0x1fe23c['where']};_0x44afc9['include']=[];if(_0x2d8274['query'][_0x3c7e('0x39')]){_0x44afc9[_0x3c7e('0x3a')]['push']({'model':db[_0x3c7e('0x3b')],'as':_0x3c7e('0x3c'),'attributes':['id'],'where':{'id':_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x39')]},'required':!![]});_0x44afc9[_0x3c7e('0x3d')]=!![];}if(_0x2d8274[_0x3c7e('0x25')]['read']){_0x44afc9[_0x3c7e('0x3a')][_0x3c7e('0x3e')]({'model':db[_0x3c7e('0x3f')],'as':_0x3c7e('0x40'),'attributes':['id',_0x3c7e('0x41'),_0x3c7e('0x42'),_0x3c7e('0x43')],'where':{'direction':'in','read':_0x2d8274['query'][_0x3c7e('0x43')]||![]},'required':!![]});_0x44afc9[_0x3c7e('0x3d')]=!![];}return db[_0x3c7e('0x22')][_0x3c7e('0x15')](_0x44afc9)[_0x3c7e('0x1c')](function(_0x560800){_0x351c75['count']=_0x560800;if(_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x44')]){_0x1fe23c[_0x3c7e('0x3a')]=[{'model':db['User'],'as':_0x3c7e('0x45'),'required':![],'attributes':['id',_0x3c7e('0x21'),'fullname']},{'model':db[_0x3c7e('0x46')],'as':_0x3c7e('0x47'),'required':![]},{'model':db[_0x3c7e('0x48')],'as':_0x3c7e('0x49'),'attributes':[_0x3c7e('0x21'),_0x3c7e('0x4a'),'internal'],'required':![]},{'model':db[_0x3c7e('0x4b')],'as':_0x3c7e('0x4c'),'attributes':[_0x3c7e('0x21'),_0x3c7e('0x4d')],'required':![]},{'model':db[_0x3c7e('0x3f')],'as':'Messages','attributes':['id',_0x3c7e('0x41'),_0x3c7e('0x42'),'read'],'where':{'direction':'in','read':_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x43')]||![]},'required':_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x43')]||![]},{'model':db[_0x3c7e('0x3b')],'as':_0x3c7e('0x3c'),'attributes':['id',_0x3c7e('0x21'),'color'],'required':_0x2d8274['query']['tag']?!![]:![]},{'model':db['Tag'],'as':_0x3c7e('0x4e'),'attributes':['id',_0x3c7e('0x21'),_0x3c7e('0x4f')],'through':_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x39')]?{'attributes':[],'where':{'TagId':_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x39')]||undefined}}:{},'required':_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x39')]?!![]:![]}];}return db[_0x3c7e('0x22')][_0x3c7e('0x50')](_0x1fe23c);})[_0x3c7e('0x1c')](function(_0x57f2dd){_0x351c75['rows']=_0x57f2dd;return _0x351c75;})['then'](respondWithFilteredResult(_0x3e7e19,_0x1fe23c))[_0x3c7e('0x51')](handleError(_0x3e7e19,null));};exports['show']=function(_0x5c337a,_0x378a5e){var _0x3664d0={'raw':![],'where':{'id':_0x5c337a[_0x3c7e('0x52')]['id']}},_0x25aa7c={};_0x25aa7c[_0x3c7e('0x24')]=_['keys'](db[_0x3c7e('0x22')][_0x3c7e('0x23')]);_0x25aa7c[_0x3c7e('0x25')]=_[_0x3c7e('0x53')](_0x5c337a[_0x3c7e('0x25')]);_0x25aa7c['filters']=_[_0x3c7e('0x29')](_0x25aa7c['model'],_0x25aa7c[_0x3c7e('0x25')]);_0x3664d0['attributes']=_[_0x3c7e('0x29')](_0x25aa7c[_0x3c7e('0x24')],qs[_0x3c7e('0x2a')](_0x5c337a[_0x3c7e('0x25')][_0x3c7e('0x2a')]));_0x3664d0[_0x3c7e('0x28')]=_0x3664d0[_0x3c7e('0x28')]['length']?_0x3664d0[_0x3c7e('0x28')]:_0x25aa7c[_0x3c7e('0x24')];if(_0x5c337a[_0x3c7e('0x25')][_0x3c7e('0x44')]){_0x3664d0['include']=[{'all':!![]}];}_0x3664d0=_[_0x3c7e('0x35')]({},_0x3664d0,_0x5c337a[_0x3c7e('0x38')]);return db[_0x3c7e('0x22')][_0x3c7e('0x54')](_0x3664d0)['then'](handleEntityNotFound(_0x378a5e,null))[_0x3c7e('0x1c')](respondWithResult(_0x378a5e,null))[_0x3c7e('0x51')](handleError(_0x378a5e,null));};exports[_0x3c7e('0x55')]=function(_0x21984d,_0x23dd25){return db[_0x3c7e('0x22')]['create'](_0x21984d[_0x3c7e('0x56')],{})[_0x3c7e('0x1c')](respondWithResult(_0x23dd25,0xc9))[_0x3c7e('0x51')](handleError(_0x23dd25,null));};exports[_0x3c7e('0x1b')]=function(_0x14e118,_0x34c3a4){if(_0x14e118['body']['id']){delete _0x14e118[_0x3c7e('0x56')]['id'];}return db[_0x3c7e('0x22')][_0x3c7e('0x54')]({'where':{'id':_0x14e118[_0x3c7e('0x52')]['id']}})[_0x3c7e('0x1c')](handleEntityNotFound(_0x34c3a4,null))[_0x3c7e('0x1c')](saveUpdates(_0x14e118[_0x3c7e('0x56')],null))[_0x3c7e('0x1c')](respondWithResult(_0x34c3a4,null))['catch'](handleError(_0x34c3a4,null));};exports['destroy']=function(_0x366660,_0x81e157){return db['OpenchannelInteraction']['find']({'where':{'id':_0x366660[_0x3c7e('0x52')]['id']}})[_0x3c7e('0x1c')](handleEntityNotFound(_0x81e157,null))['then'](removeEntity(_0x81e157,null))[_0x3c7e('0x51')](handleError(_0x81e157,null));};exports[_0x3c7e('0x57')]=function(_0x2acdd6,_0x690340){return db[_0x3c7e('0x22')][_0x3c7e('0x57')]()[_0x3c7e('0x1c')](respondWithResult(_0x690340,null))['catch'](handleError(_0x690340,null));};exports['addMessage']=function(_0xe23583,_0x5c4100,_0x231434){return db[_0x3c7e('0x3f')][_0x3c7e('0x54')]({'where':{'id':_0xe23583[_0x3c7e('0x52')]['id']}})[_0x3c7e('0x1c')](handleEntityNotFound(_0x5c4100,null))[_0x3c7e('0x1c')](function(_0x10e7d7){if(_0x10e7d7){return _0x10e7d7[_0x3c7e('0x58')](_0xe23583[_0x3c7e('0x56')][_0x3c7e('0x59')],_['omit'](_0xe23583['body'],[_0x3c7e('0x59'),'id'])||{});}})['then'](respondWithResult(_0x5c4100,null))['catch'](handleError(_0x5c4100,null));};exports['getMessages']=function(_0x59260d,_0x27635d,_0x62238d){var _0x206fa0={'raw':![],'where':{}};var _0x7b47a4={};var _0x12709a={'count':0x0,'rows':[]};return db[_0x3c7e('0x22')]['findOne']({'where':{'id':_0x59260d['params']['id']}})[_0x3c7e('0x1c')](handleEntityNotFound(_0x27635d,null))[_0x3c7e('0x1c')](function(_0x318b1f){if(_0x318b1f){_0x7b47a4[_0x3c7e('0x24')]=_[_0x3c7e('0x53')](db['OpenchannelMessage'][_0x3c7e('0x23')]);_0x7b47a4['query']=_[_0x3c7e('0x53')](_0x59260d[_0x3c7e('0x25')]);_0x7b47a4[_0x3c7e('0x31')]=_[_0x3c7e('0x29')](_0x7b47a4[_0x3c7e('0x24')],_0x7b47a4['query']);_0x206fa0[_0x3c7e('0x28')]=_[_0x3c7e('0x29')](_0x7b47a4['model'],qs[_0x3c7e('0x2a')](_0x59260d[_0x3c7e('0x25')]['fields']));_0x206fa0[_0x3c7e('0x28')]=_0x206fa0[_0x3c7e('0x28')]['length']?_0x206fa0['attributes']:_0x7b47a4['model'];if(!_0x59260d[_0x3c7e('0x25')][_0x3c7e('0x5a')](_0x3c7e('0x2c'))){_0x206fa0[_0x3c7e('0x16')]=qs[_0x3c7e('0x16')](_0x59260d[_0x3c7e('0x25')]['limit']);_0x206fa0[_0x3c7e('0x2d')]=qs[_0x3c7e('0x2d')](_0x59260d[_0x3c7e('0x25')][_0x3c7e('0x2d')]);}_0x206fa0['order']=qs[_0x3c7e('0x2f')](_0x59260d[_0x3c7e('0x25')][_0x3c7e('0x2f')]);_0x206fa0['where']=qs[_0x3c7e('0x31')](_[_0x3c7e('0x32')](_0x59260d[_0x3c7e('0x25')],_0x7b47a4[_0x3c7e('0x31')]));_0x206fa0[_0x3c7e('0x30')]['OpenchannelInteractionId']=_0x318b1f['id'];if(_0x59260d[_0x3c7e('0x25')][_0x3c7e('0x37')]){_0x206fa0['where']=_[_0x3c7e('0x35')](_0x206fa0['where'],{'$or':_[_0x3c7e('0x36')](_0x206fa0[_0x3c7e('0x28')],function(_0x23908f){var _0x13a66b={};_0x13a66b[_0x23908f]={'$like':'%'+_0x59260d[_0x3c7e('0x25')][_0x3c7e('0x37')]+'%'};return _0x13a66b;})});}if(_0x59260d[_0x3c7e('0x25')]['$gte']){var _0x150be5=_0x59260d[_0x3c7e('0x25')][_0x3c7e('0x5b')][_0x3c7e('0x5c')](',');var _0x452805={};_0x452805[_0x150be5[0x0]]={'$gte':moment(_0x150be5[0x1])[_0x3c7e('0x5d')](_0x3c7e('0x5e'))};_0x206fa0[_0x3c7e('0x30')]=_[_0x3c7e('0x35')](_0x206fa0['where'],_0x452805);}_0x206fa0=_[_0x3c7e('0x35')]({},_0x206fa0,_0x59260d[_0x3c7e('0x38')]);return db[_0x3c7e('0x3f')][_0x3c7e('0x15')]({'where':_0x206fa0[_0x3c7e('0x30')]})[_0x3c7e('0x1c')](function(_0x4ac871){_0x12709a['count']=_0x4ac871;if(_0x59260d[_0x3c7e('0x25')]['includeAll']){_0x206fa0[_0x3c7e('0x3a')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x3c7e('0x50')](_0x206fa0);})['then'](function(_0x565af1){_0x12709a[_0x3c7e('0x5f')]=_0x565af1;return _0x12709a;});}})[_0x3c7e('0x1c')](respondWithFilteredResult(_0x27635d,_0x206fa0))[_0x3c7e('0x51')](handleError(_0x27635d,null));};exports[_0x3c7e('0x60')]=function(_0x165aa7,_0x835b8e,_0x9ff3e7){return db[_0x3c7e('0x22')][_0x3c7e('0x54')]({'where':{'id':_0x165aa7['params']['id']}})[_0x3c7e('0x1c')](handleEntityNotFound(_0x835b8e,null))['then'](function(_0x4654c7){if(_0x4654c7){return _0x4654c7['setTags'](_0x165aa7[_0x3c7e('0x56')][_0x3c7e('0x59')],_['omit'](_0x165aa7['body'],[_0x3c7e('0x59'),'id'])||{})[_0x3c7e('0x61')](function(){return db[_0x3c7e('0x3b')][_0x3c7e('0x50')]({'attributes':['id',_0x3c7e('0x21'),'color'],'where':{'id':_0x165aa7['body'][_0x3c7e('0x59')]}});})[_0x3c7e('0x1c')](function(_0x288368){socket[_0x3c7e('0x62')](_0x3c7e('0x63'),{'id':Number(_0x165aa7[_0x3c7e('0x52')]['id']),'tags':_0x288368||[]});return{'id':Number(_0x165aa7[_0x3c7e('0x52')]['id']),'tags':_0x288368||[]};});}})[_0x3c7e('0x1c')](respondWithResult(_0x835b8e,null))['catch'](handleError(_0x835b8e,null));};exports[_0x3c7e('0x64')]=function(_0x4a4294,_0xe54315,_0xa7f327){var _0x3a5d48;return db[_0x3c7e('0x22')][_0x3c7e('0x54')]({'where':{'id':_0x4a4294['params']['id']}})[_0x3c7e('0x1c')](handleEntityNotFound(_0xe54315,null))[_0x3c7e('0x1c')](function(_0x361bab){if(_0x361bab){return _0x361bab['removeTags'](_0x4a4294[_0x3c7e('0x25')]['ids']);}})['then'](respondWithStatusCode(_0xe54315,null))[_0x3c7e('0x51')](handleError(_0xe54315,null));}; \ No newline at end of file +var _0x4db0=['dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','tag','include','push','Tag','Tags','read','OpenchannelMessage','direction','createdAt','distinct','includeAll','fullname','Contact','Owner','OpenchannelAccount','key','Messages','color','ThroughTags','rows','catch','params','keys','rawAttributes','length','find','create','body','destroy','describe','addMessage','ids','omit','getMessages','OpenchannelInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','spread','findAll','emit','removeTags','fast-json-patch','request-promise','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','OpenchannelInteraction','model','query'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x4db0,0x109));var _0x04db=function(_0x21f931,_0x598b2d){_0x21f931=_0x21f931-0x0;var _0x3f083c=_0x4db0[_0x21f931];return _0x3f083c;};'use strict';var jsonpatch=require(_0x04db('0x0'));var rp=require(_0x04db('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x04db('0x2'));var path=require(_0x04db('0x3'));var sox=require(_0x04db('0x4'));var csv=require(_0x04db('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x04db('0x6'));var crypto=require(_0x04db('0x7'));var jsforce=require(_0x04db('0x8'));var deskjs=require(_0x04db('0x9'));var toCsv=require(_0x04db('0x5'));var querystring=require(_0x04db('0xa'));var Papa=require(_0x04db('0xb'));var qs=require(_0x04db('0xc'));var logger=require(_0x04db('0xd'))(_0x04db('0xe'));var utils=require(_0x04db('0xf'));var config=require(_0x04db('0x10'));var db=require(_0x04db('0x11'))['db'];var socket=require('socket.io-emitter')({'host':_0x04db('0x12'),'port':0x18eb});require(_0x04db('0x13'))[_0x04db('0x14')](socket);function respondWithStatusCode(_0x139bb2,_0xc9756b){_0xc9756b=_0xc9756b||0xcc;return function(_0xd7d10c){if(_0xd7d10c){return _0x139bb2[_0x04db('0x15')](_0xc9756b);}return _0x139bb2[_0x04db('0x16')](_0xc9756b)[_0x04db('0x17')]();};}function respondWithResult(_0x1bd67c,_0x4846f1){_0x4846f1=_0x4846f1||0xc8;return function(_0x37be85){if(_0x37be85){return _0x1bd67c[_0x04db('0x16')](_0x4846f1)[_0x04db('0x18')](_0x37be85);}};}function respondWithFilteredResult(_0x2cad6d,_0x3bc4f4){return function(_0x3d6410){if(_0x3d6410){var _0xf94d44=_0x3d6410[_0x04db('0x19')],_0x23d3e7=_0x3bc4f4[_0x04db('0x1a')],_0x46cd9a=_0x3bc4f4[_0x04db('0x1a')]+_0x3bc4f4[_0x04db('0x1b')],_0x50d8e7;if(_0x46cd9a>=_0xf94d44){_0x46cd9a=_0xf94d44;_0x50d8e7=0xc8;}else{_0x50d8e7=0xce;}_0x2cad6d['status'](_0x50d8e7);return _0x2cad6d[_0x04db('0x1c')](_0x04db('0x1d'),_0x23d3e7+'-'+_0x46cd9a+'/'+_0xf94d44)['json'](_0x3d6410);}return null;};}function patchUpdates(_0x210d62){return function(_0x24ec0f){try{jsonpatch[_0x04db('0x1e')](_0x24ec0f,_0x210d62,!![]);}catch(_0x36c322){return BPromise['reject'](_0x36c322);}return _0x24ec0f[_0x04db('0x1f')]();};}function saveUpdates(_0xa8e48,_0x15170a){return function(_0x5bfe7e){if(_0x5bfe7e){return _0x5bfe7e[_0x04db('0x20')](_0xa8e48)['then'](function(_0x2742ac){return _0x2742ac;});}return null;};}function removeEntity(_0x217ebe,_0x1dd7f2){return function(_0x3026d6){if(_0x3026d6){return _0x3026d6['destroy']()[_0x04db('0x21')](function(){_0x217ebe[_0x04db('0x16')](0xcc)[_0x04db('0x17')]();});}};}function handleEntityNotFound(_0x222eb0,_0x13780d){return function(_0x1b6772){if(!_0x1b6772){_0x222eb0[_0x04db('0x15')](0x194);}return _0x1b6772;};}function handleError(_0x2a1cab,_0x424ba1){_0x424ba1=_0x424ba1||0x1f4;return function(_0x35dacf){logger[_0x04db('0x22')](_0x35dacf[_0x04db('0x23')]);if(_0x35dacf[_0x04db('0x24')]){delete _0x35dacf[_0x04db('0x24')];}_0x2a1cab[_0x04db('0x16')](_0x424ba1)[_0x04db('0x25')](_0x35dacf);};}exports['index']=function(_0x5cbb03,_0x5f299d){var _0x482797={},_0xc43e2={},_0x268ff9={'count':0x0,'rows':[]};var _0x4507e4=db[_0x04db('0x26')]['rawAttributes'];_0xc43e2[_0x04db('0x27')]=_['keys'](_0x4507e4);var _0x4f71a5={'dateStart':_0x5cbb03[_0x04db('0x28')][_0x04db('0x29')],'dateEnd':_0x5cbb03['query'][_0x04db('0x2a')]};delete _0x5cbb03[_0x04db('0x28')][_0x04db('0x29')];delete _0x5cbb03['query'][_0x04db('0x2a')];_0xc43e2[_0x04db('0x28')]=_['keys'](_0x5cbb03[_0x04db('0x28')]);_0xc43e2[_0x04db('0x2b')]=_[_0x04db('0x2c')](_0xc43e2[_0x04db('0x27')],_0xc43e2[_0x04db('0x28')]);_0x482797[_0x04db('0x2d')]=_[_0x04db('0x2c')](_0xc43e2['model'],qs[_0x04db('0x2e')](_0x5cbb03[_0x04db('0x28')][_0x04db('0x2e')]));_0x482797['attributes']=_0x482797[_0x04db('0x2d')]['length']?_0x482797['attributes']:_0xc43e2[_0x04db('0x27')];if(!_0x5cbb03['query'][_0x04db('0x2f')](_0x04db('0x30'))){_0x482797[_0x04db('0x1b')]=qs[_0x04db('0x1b')](_0x5cbb03[_0x04db('0x28')][_0x04db('0x1b')]);_0x482797[_0x04db('0x1a')]=qs[_0x04db('0x1a')](_0x5cbb03[_0x04db('0x28')]['offset']);}_0x482797[_0x04db('0x31')]=qs[_0x04db('0x32')](_0x5cbb03[_0x04db('0x28')][_0x04db('0x32')]);_0x482797[_0x04db('0x33')]=qs[_0x04db('0x2b')](_[_0x04db('0x34')](_0x5cbb03[_0x04db('0x28')],_0xc43e2[_0x04db('0x2b')]));if(_0x4f71a5['dateStart']){if(_0x4f71a5[_0x04db('0x2a')]){_0x4f71a5[_0x04db('0x2a')]=moment(_0x4f71a5[_0x04db('0x2a')])[_0x04db('0x35')](0x1,_0x04db('0x36'));}else{_0x4f71a5[_0x04db('0x2a')]=moment(_0x4f71a5[_0x04db('0x29')])['add'](0x1,_0x04db('0x36'));}_[_0x04db('0x37')](_0x482797[_0x04db('0x33')],{'createdAt':{'$gte':_0x4f71a5[_0x04db('0x29')],'$lte':_0x4f71a5[_0x04db('0x2a')]}});}if(_0x5cbb03[_0x04db('0x28')][_0x04db('0x38')]){_0x482797[_0x04db('0x33')]=_['merge'](_0x482797['where'],{'$or':_[_0x04db('0x39')](_0x482797[_0x04db('0x2d')],function(_0x1f3ef6){var _0x5b926c={};_0x5b926c[_0x1f3ef6]={'$like':'%'+_0x5cbb03['query'][_0x04db('0x38')]+'%'};return _0x5b926c;})});}_0x482797=_[_0x04db('0x37')]({},_0x482797,_0x5cbb03[_0x04db('0x3a')]);var _0x313cce={'where':_0x482797[_0x04db('0x33')]};_0x313cce['include']=[];if(_0x5cbb03[_0x04db('0x28')][_0x04db('0x3b')]){_0x313cce[_0x04db('0x3c')][_0x04db('0x3d')]({'model':db[_0x04db('0x3e')],'as':_0x04db('0x3f'),'attributes':['id'],'where':{'id':_0x5cbb03[_0x04db('0x28')][_0x04db('0x3b')]},'required':!![]});_0x313cce['distinct']=!![];}if(_0x5cbb03[_0x04db('0x28')][_0x04db('0x40')]){_0x313cce[_0x04db('0x3c')][_0x04db('0x3d')]({'model':db[_0x04db('0x41')],'as':'Messages','attributes':['id',_0x04db('0x42'),_0x04db('0x43'),_0x04db('0x40')],'where':{'direction':'in','read':_0x5cbb03[_0x04db('0x28')][_0x04db('0x40')]||![]},'required':!![]});_0x313cce[_0x04db('0x44')]=!![];}return db['OpenchannelInteraction'][_0x04db('0x19')](_0x313cce)[_0x04db('0x21')](function(_0x5ad115){_0x268ff9[_0x04db('0x19')]=_0x5ad115;if(_0x5cbb03['query'][_0x04db('0x45')]){_0x482797['include']=[{'model':db['User'],'as':'Users','required':![],'attributes':['id','name',_0x04db('0x46')]},{'model':db['CmContact'],'as':_0x04db('0x47'),'required':![]},{'model':db['User'],'as':_0x04db('0x48'),'attributes':[_0x04db('0x24'),_0x04db('0x46'),'internal'],'required':![]},{'model':db[_0x04db('0x49')],'as':'Account','attributes':['name',_0x04db('0x4a')],'required':![]},{'model':db[_0x04db('0x41')],'as':_0x04db('0x4b'),'attributes':['id','direction',_0x04db('0x43'),_0x04db('0x40')],'where':{'direction':'in','read':_0x5cbb03['query'][_0x04db('0x40')]||![]},'required':_0x5cbb03[_0x04db('0x28')][_0x04db('0x40')]||![]},{'model':db[_0x04db('0x3e')],'as':_0x04db('0x3f'),'attributes':['id',_0x04db('0x24'),_0x04db('0x4c')],'required':_0x5cbb03['query'][_0x04db('0x3b')]?!![]:![]},{'model':db[_0x04db('0x3e')],'as':_0x04db('0x4d'),'attributes':['id',_0x04db('0x24'),_0x04db('0x4c')],'through':_0x5cbb03[_0x04db('0x28')]['tag']?{'attributes':[],'where':{'TagId':_0x5cbb03[_0x04db('0x28')][_0x04db('0x3b')]||undefined}}:{},'required':_0x5cbb03[_0x04db('0x28')][_0x04db('0x3b')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x482797);})['then'](function(_0x1d5c80){_0x268ff9[_0x04db('0x4e')]=_0x1d5c80;return _0x268ff9;})[_0x04db('0x21')](respondWithFilteredResult(_0x5f299d,_0x482797))[_0x04db('0x4f')](handleError(_0x5f299d,null));};exports['show']=function(_0x534e05,_0x1392e9){var _0x22e029={'raw':![],'where':{'id':_0x534e05[_0x04db('0x50')]['id']}},_0x2b6d14={};_0x2b6d14[_0x04db('0x27')]=_[_0x04db('0x51')](db[_0x04db('0x26')][_0x04db('0x52')]);_0x2b6d14['query']=_[_0x04db('0x51')](_0x534e05[_0x04db('0x28')]);_0x2b6d14[_0x04db('0x2b')]=_[_0x04db('0x2c')](_0x2b6d14[_0x04db('0x27')],_0x2b6d14[_0x04db('0x28')]);_0x22e029[_0x04db('0x2d')]=_['intersection'](_0x2b6d14[_0x04db('0x27')],qs[_0x04db('0x2e')](_0x534e05[_0x04db('0x28')][_0x04db('0x2e')]));_0x22e029[_0x04db('0x2d')]=_0x22e029[_0x04db('0x2d')][_0x04db('0x53')]?_0x22e029[_0x04db('0x2d')]:_0x2b6d14[_0x04db('0x27')];if(_0x534e05['query'][_0x04db('0x45')]){_0x22e029['include']=[{'all':!![]}];}_0x22e029=_[_0x04db('0x37')]({},_0x22e029,_0x534e05[_0x04db('0x3a')]);return db['OpenchannelInteraction'][_0x04db('0x54')](_0x22e029)[_0x04db('0x21')](handleEntityNotFound(_0x1392e9,null))[_0x04db('0x21')](respondWithResult(_0x1392e9,null))[_0x04db('0x4f')](handleError(_0x1392e9,null));};exports[_0x04db('0x55')]=function(_0x1bb6a4,_0x40688c){return db[_0x04db('0x26')][_0x04db('0x55')](_0x1bb6a4['body'],{})[_0x04db('0x21')](respondWithResult(_0x40688c,0xc9))[_0x04db('0x4f')](handleError(_0x40688c,null));};exports['update']=function(_0x184135,_0x3ba7dc){if(_0x184135[_0x04db('0x56')]['id']){delete _0x184135[_0x04db('0x56')]['id'];}return db[_0x04db('0x26')][_0x04db('0x54')]({'where':{'id':_0x184135[_0x04db('0x50')]['id']}})['then'](handleEntityNotFound(_0x3ba7dc,null))[_0x04db('0x21')](saveUpdates(_0x184135[_0x04db('0x56')],null))[_0x04db('0x21')](respondWithResult(_0x3ba7dc,null))[_0x04db('0x4f')](handleError(_0x3ba7dc,null));};exports[_0x04db('0x57')]=function(_0x3256c8,_0x35c03d){return db[_0x04db('0x26')][_0x04db('0x54')]({'where':{'id':_0x3256c8[_0x04db('0x50')]['id']}})[_0x04db('0x21')](handleEntityNotFound(_0x35c03d,null))[_0x04db('0x21')](removeEntity(_0x35c03d,null))['catch'](handleError(_0x35c03d,null));};exports[_0x04db('0x58')]=function(_0x4a879c,_0x29fd0b){return db[_0x04db('0x26')]['describe']()[_0x04db('0x21')](respondWithResult(_0x29fd0b,null))[_0x04db('0x4f')](handleError(_0x29fd0b,null));};exports[_0x04db('0x59')]=function(_0x3ae18e,_0x1093c8,_0x3b8910){return db[_0x04db('0x41')][_0x04db('0x54')]({'where':{'id':_0x3ae18e[_0x04db('0x50')]['id']}})[_0x04db('0x21')](handleEntityNotFound(_0x1093c8,null))[_0x04db('0x21')](function(_0x1b215e){if(_0x1b215e){return _0x1b215e['addMessage'](_0x3ae18e[_0x04db('0x56')][_0x04db('0x5a')],_[_0x04db('0x5b')](_0x3ae18e[_0x04db('0x56')],[_0x04db('0x5a'),'id'])||{});}})[_0x04db('0x21')](respondWithResult(_0x1093c8,null))[_0x04db('0x4f')](handleError(_0x1093c8,null));};exports[_0x04db('0x5c')]=function(_0x262bb4,_0x4ac62f,_0x1ff0c4){var _0x4f39ed={'raw':![],'where':{}};var _0x252121={};var _0xbe0e58={'count':0x0,'rows':[]};return db[_0x04db('0x26')]['findOne']({'where':{'id':_0x262bb4[_0x04db('0x50')]['id']}})[_0x04db('0x21')](handleEntityNotFound(_0x4ac62f,null))[_0x04db('0x21')](function(_0x47d276){if(_0x47d276){_0x252121[_0x04db('0x27')]=_[_0x04db('0x51')](db[_0x04db('0x41')][_0x04db('0x52')]);_0x252121[_0x04db('0x28')]=_['keys'](_0x262bb4[_0x04db('0x28')]);_0x252121[_0x04db('0x2b')]=_[_0x04db('0x2c')](_0x252121[_0x04db('0x27')],_0x252121[_0x04db('0x28')]);_0x4f39ed['attributes']=_['intersection'](_0x252121[_0x04db('0x27')],qs[_0x04db('0x2e')](_0x262bb4['query'][_0x04db('0x2e')]));_0x4f39ed['attributes']=_0x4f39ed[_0x04db('0x2d')][_0x04db('0x53')]?_0x4f39ed[_0x04db('0x2d')]:_0x252121['model'];if(!_0x262bb4[_0x04db('0x28')][_0x04db('0x2f')](_0x04db('0x30'))){_0x4f39ed[_0x04db('0x1b')]=qs['limit'](_0x262bb4[_0x04db('0x28')][_0x04db('0x1b')]);_0x4f39ed[_0x04db('0x1a')]=qs['offset'](_0x262bb4[_0x04db('0x28')][_0x04db('0x1a')]);}_0x4f39ed[_0x04db('0x31')]=qs[_0x04db('0x32')](_0x262bb4[_0x04db('0x28')][_0x04db('0x32')]);_0x4f39ed[_0x04db('0x33')]=qs[_0x04db('0x2b')](_[_0x04db('0x34')](_0x262bb4[_0x04db('0x28')],_0x252121[_0x04db('0x2b')]));_0x4f39ed['where'][_0x04db('0x5d')]=_0x47d276['id'];if(_0x262bb4['query']['filter']){_0x4f39ed[_0x04db('0x33')]=_['merge'](_0x4f39ed['where'],{'$or':_[_0x04db('0x39')](_0x4f39ed[_0x04db('0x2d')],function(_0xd1fd6){var _0xe3e7dc={};_0xe3e7dc[_0xd1fd6]={'$like':'%'+_0x262bb4[_0x04db('0x28')]['filter']+'%'};return _0xe3e7dc;})});}if(_0x262bb4['query'][_0x04db('0x5e')]){var _0x49a98c=_0x262bb4[_0x04db('0x28')][_0x04db('0x5e')][_0x04db('0x5f')](',');var _0x1f44fe={};_0x1f44fe[_0x49a98c[0x0]]={'$gte':moment(_0x49a98c[0x1])[_0x04db('0x60')](_0x04db('0x61'))};_0x4f39ed['where']=_[_0x04db('0x37')](_0x4f39ed[_0x04db('0x33')],_0x1f44fe);}_0x4f39ed=_[_0x04db('0x37')]({},_0x4f39ed,_0x262bb4[_0x04db('0x3a')]);return db['OpenchannelMessage']['count']({'where':_0x4f39ed[_0x04db('0x33')]})[_0x04db('0x21')](function(_0x23ec29){_0xbe0e58['count']=_0x23ec29;if(_0x262bb4['query'][_0x04db('0x45')]){_0x4f39ed[_0x04db('0x3c')]=[{'all':!![]}];}return db[_0x04db('0x41')]['findAll'](_0x4f39ed);})[_0x04db('0x21')](function(_0x569850){_0xbe0e58['rows']=_0x569850;return _0xbe0e58;});}})[_0x04db('0x21')](respondWithFilteredResult(_0x4ac62f,_0x4f39ed))['catch'](handleError(_0x4ac62f,null));};exports['addTags']=function(_0x2d0bb5,_0x42532b,_0x5024a6){return db[_0x04db('0x26')][_0x04db('0x54')]({'where':{'id':_0x2d0bb5['params']['id']}})[_0x04db('0x21')](handleEntityNotFound(_0x42532b,null))[_0x04db('0x21')](function(_0x16878e){if(_0x16878e){return _0x16878e['setTags'](_0x2d0bb5[_0x04db('0x56')][_0x04db('0x5a')],_[_0x04db('0x5b')](_0x2d0bb5[_0x04db('0x56')],[_0x04db('0x5a'),'id'])||{})[_0x04db('0x62')](function(){return db[_0x04db('0x3e')][_0x04db('0x63')]({'attributes':['id',_0x04db('0x24'),'color'],'where':{'id':_0x2d0bb5[_0x04db('0x56')][_0x04db('0x5a')]}});})['then'](function(_0x2b0a03){socket[_0x04db('0x64')]('openchannelInteractionTags:save',{'id':Number(_0x2d0bb5[_0x04db('0x50')]['id']),'tags':_0x2b0a03||[]});return{'id':Number(_0x2d0bb5[_0x04db('0x50')]['id']),'tags':_0x2b0a03||[]};});}})[_0x04db('0x21')](respondWithResult(_0x42532b,null))[_0x04db('0x4f')](handleError(_0x42532b,null));};exports[_0x04db('0x65')]=function(_0xe072ab,_0x4ac1f8,_0x87d534){var _0xe71ac0;return db[_0x04db('0x26')][_0x04db('0x54')]({'where':{'id':_0xe072ab['params']['id']}})[_0x04db('0x21')](handleEntityNotFound(_0x4ac1f8,null))[_0x04db('0x21')](function(_0x3c7282){if(_0x3c7282){return _0x3c7282[_0x04db('0x65')](_0xe072ab[_0x04db('0x28')][_0x04db('0x5a')]);}})[_0x04db('0x21')](respondWithStatusCode(_0x4ac1f8,null))['catch'](handleError(_0x4ac1f8,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 5caa514..7553562 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 _0xb19e=['setMaxListeners','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x267029,_0x5bee38){var _0x1c979a=function(_0x2a9dc1){while(--_0x2a9dc1){_0x267029['push'](_0x267029['shift']());}};_0x1c979a(++_0x5bee38);}(_0xb19e,0xd0));var _0xeb19=function(_0x29d2d2,_0x3344){_0x29d2d2=_0x29d2d2-0x0;var _0x3f6476=_0xb19e[_0x29d2d2];return _0x3f6476;};'use strict';var EventEmitter=require(_0xeb19('0x0'));var OpenchannelInteraction=require(_0xeb19('0x1'))['db']['OpenchannelInteraction'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xeb19('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x33f6c3){return function(_0x42433d,_0x468288,_0x2f6e3a){OpenchannelInteractionEvents[_0xeb19('0x3')](_0x33f6c3+':'+_0x42433d['id'],_0x42433d);OpenchannelInteractionEvents[_0xeb19('0x3')](_0x33f6c3,_0x42433d);_0x2f6e3a(null);};}for(var e in events){if(events[_0xeb19('0x4')](e)){var event=events[e];OpenchannelInteraction[_0xeb19('0x5')](e,emitEvent(event));}}module[_0xeb19('0x6')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x354b=['../../mysqldb','OpenchannelInteraction','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xb6a2af,_0x401e9e){var _0x483cdc=function(_0x3fd099){while(--_0x3fd099){_0xb6a2af['push'](_0xb6a2af['shift']());}};_0x483cdc(++_0x401e9e);}(_0x354b,0xdb));var _0xb354=function(_0x4b1b3a,_0x239438){_0x4b1b3a=_0x4b1b3a-0x0;var _0x203002=_0x354b[_0x4b1b3a];return _0x203002;};'use strict';var EventEmitter=require(_0xb354('0x0'));var OpenchannelInteraction=require(_0xb354('0x1'))['db'][_0xb354('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xb354('0x3')](0x0);var events={'afterCreate':_0xb354('0x4'),'afterUpdate':_0xb354('0x5'),'afterDestroy':_0xb354('0x6')};function emitEvent(_0x36ebda){return function(_0x1d0c6f,_0x4451c0,_0x5ea8e9){OpenchannelInteractionEvents['emit'](_0x36ebda+':'+_0x1d0c6f['id'],_0x1d0c6f);OpenchannelInteractionEvents[_0xb354('0x7')](_0x36ebda,_0x1d0c6f);_0x5ea8e9(null);};}for(var e in events){if(events[_0xb354('0x8')](e)){var event=events[e];OpenchannelInteraction[_0xb354('0x9')](e,emitEvent(event));}}module[_0xb354('0xa')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 4118597..4693be1 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 _0x7067=['util','api','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','lodash'];(function(_0x3bf747,_0x20352d){var _0x425334=function(_0x11b0e8){while(--_0x11b0e8){_0x3bf747['push'](_0x3bf747['shift']());}};_0x425334(++_0x20352d);}(_0x7067,0x87));var _0x7706=function(_0x29ea19,_0x3f842e){_0x29ea19=_0x29ea19-0x0;var _0x152d89=_0x7067[_0x29ea19];return _0x152d89;};'use strict';var _=require(_0x7706('0x0'));var util=require(_0x7706('0x1'));var logger=require('../../config/logger')(_0x7706('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x7706('0x3'));module[_0x7706('0x4')]=function(_0x2b5c7d,_0x173d72){return _0x2b5c7d[_0x7706('0x5')](_0x7706('0x6'),attributes,{'tableName':_0x7706('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f2a=['exports','define','OpenchannelInteraction','lodash','api','moment','bluebird','request-promise'];(function(_0x2bc4ae,_0x1c556d){var _0xb70b79=function(_0x15a6ff){while(--_0x15a6ff){_0x2bc4ae['push'](_0x2bc4ae['shift']());}};_0xb70b79(++_0x1c556d);}(_0x0f2a,0x6b));var _0xa0f2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0f2a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xa0f2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa0f2('0x1'));var moment=require(_0xa0f2('0x2'));var BPromise=require(_0xa0f2('0x3'));var rp=require(_0xa0f2('0x4'));var attributes=require('./openchannelInteraction.attributes');module[_0xa0f2('0x5')]=function(_0x5cdb8c,_0x57a762){return _0x5cdb8c[_0xa0f2('0x6')](_0xa0f2('0x7'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 8487c40..5d18ad0 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 _0x9d1f=['find','addTags','ids','spread','AddTags','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','socket.io-emitter','./openchannelInteraction.socket','register','info','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelInteraction,\x20%s,\x20%s','message','catch','body','options','raw','where','limit','then','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','OpenchannelInteraction'];(function(_0x5637f4,_0x28bb07){var _0xdd68c0=function(_0x1c465b){while(--_0x1c465b){_0x5637f4['push'](_0x5637f4['shift']());}};_0xdd68c0(++_0x28bb07);}(_0x9d1f,0x1a9));var _0xf9d1=function(_0x48326a,_0x8cfa0c){_0x48326a=_0x48326a-0x0;var _0x466709=_0x9d1f[_0x48326a];return _0x466709;};'use strict';var _=require(_0xf9d1('0x0'));var util=require('util');var moment=require(_0xf9d1('0x1'));var BPromise=require(_0xf9d1('0x2'));var rs=require(_0xf9d1('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xf9d1('0x4'));var logger=require('../../config/logger')(_0xf9d1('0x5'));var config=require(_0xf9d1('0x6'));var jayson=require(_0xf9d1('0x7'));var client=jayson['client'][_0xf9d1('0x8')]({'port':0x232a});var socket=require(_0xf9d1('0x9'))({'host':'localhost','port':0x18eb});require(_0xf9d1('0xa'))[_0xf9d1('0xb')](socket);function respondWithRpcPromise(_0x41c1bc,_0x582512,_0x354715){return new BPromise(function(_0xe42be1,_0x9a36f){return client['request'](_0x41c1bc,_0x354715)['then'](function(_0x22f7c1){logger[_0xf9d1('0xc')]('OpenchannelInteraction,\x20%s,\x20%s',_0x582512,'request\x20sent');logger[_0xf9d1('0xd')](_0xf9d1('0xe'),_0x582512,_0xf9d1('0xf'),JSON[_0xf9d1('0x10')](_0x22f7c1));if(_0x22f7c1['error']){if(_0x22f7c1[_0xf9d1('0x11')]['code']===0x1f4){logger[_0xf9d1('0x11')](_0xf9d1('0x12'),_0x582512,_0x22f7c1['error'][_0xf9d1('0x13')]);return _0x9a36f(_0x22f7c1[_0xf9d1('0x11')][_0xf9d1('0x13')]);}logger[_0xf9d1('0x11')](_0xf9d1('0x12'),_0x582512,_0x22f7c1[_0xf9d1('0x11')]['message']);return _0xe42be1(_0x22f7c1[_0xf9d1('0x11')][_0xf9d1('0x13')]);}else{logger[_0xf9d1('0xc')](_0xf9d1('0x12'),_0x582512,_0xf9d1('0xf'));_0xe42be1(_0x22f7c1['result'][_0xf9d1('0x13')]);}})[_0xf9d1('0x14')](function(_0x3b68c4){logger[_0xf9d1('0x11')](_0xf9d1('0x12'),_0x582512,_0x3b68c4);_0x9a36f(_0x3b68c4);});});}exports['UpdateOpenchannelInteraction']=function(_0x396f6b){var _0x41c146=this;return new Promise(function(_0x4f66b6,_0x22307d){return db['OpenchannelInteraction']['update'](_0x396f6b[_0xf9d1('0x15')],{'raw':_0x396f6b[_0xf9d1('0x16')]?_0x396f6b[_0xf9d1('0x16')][_0xf9d1('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x396f6b[_0xf9d1('0x16')]?_0x396f6b[_0xf9d1('0x16')][_0xf9d1('0x18')]||null:null,'attributes':_0x396f6b[_0xf9d1('0x16')]?_0x396f6b[_0xf9d1('0x16')]['attributes']||null:null,'limit':_0x396f6b[_0xf9d1('0x16')]?_0x396f6b[_0xf9d1('0x16')][_0xf9d1('0x19')]||null:null})[_0xf9d1('0x1a')](function(_0x34416c){logger['info'](_0xf9d1('0x1b'),_0x396f6b);logger['debug'](_0xf9d1('0x1b'),_0x396f6b,JSON[_0xf9d1('0x10')](_0x34416c));_0x4f66b6(_0x34416c);})[_0xf9d1('0x14')](function(_0x31db63){logger[_0xf9d1('0x11')](_0xf9d1('0x1b'),_0x31db63[_0xf9d1('0x13')],_0x396f6b);_0x22307d(_0x41c146['error'](0x1f4,_0x31db63['message']));});});};exports[_0xf9d1('0x1c')]=function(_0x4c884a){return new Promise(function(_0x34cdfc,_0x549075){return db[_0xf9d1('0x1d')][_0xf9d1('0x1e')]({'where':_0x4c884a['options']?_0x4c884a[_0xf9d1('0x16')]['where']||null:null})['then'](function(_0x191e57){if(_0x191e57){return _0x191e57[_0xf9d1('0x1f')](_0x4c884a['body'][_0xf9d1('0x20')],_['omit'](_0x4c884a['body'],['ids','id'])||{});}})[_0xf9d1('0x21')](function(_0x48d875){logger[_0xf9d1('0xc')](_0xf9d1('0x22'),_0x4c884a);logger[_0xf9d1('0xd')](_0xf9d1('0x22'),_0x4c884a,JSON[_0xf9d1('0x10')](_0x48d875));_0x34cdfc(_0x48d875);})[_0xf9d1('0x14')](function(_0x2194bd){logger[_0xf9d1('0x11')](_0xf9d1('0x22'),_0x2194bd['message'],_0x4c884a);_0x549075(_this[_0xf9d1('0x11')](0x1f4,_0x2194bd['message']));});});}; \ No newline at end of file +var _0x0f88=['../../config/logger','../../config/environment','client','http','socket.io-emitter','localhost','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','limit','find','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x4d337e,_0x2f7eed){var _0x247963=function(_0x3d6564){while(--_0x3d6564){_0x4d337e['push'](_0x4d337e['shift']());}};_0x247963(++_0x2f7eed);}(_0x0f88,0x1d9));var _0x80f8=function(_0x836465,_0x5442ae){_0x836465=_0x836465-0x0;var _0x2150ea=_0x0f88[_0x836465];return _0x2150ea;};'use strict';var _=require(_0x80f8('0x0'));var util=require(_0x80f8('0x1'));var moment=require(_0x80f8('0x2'));var BPromise=require(_0x80f8('0x3'));var rs=require(_0x80f8('0x4'));var fs=require('fs');var db=require(_0x80f8('0x5'))['db'];var utils=require(_0x80f8('0x6'));var logger=require(_0x80f8('0x7'))('rpc');var config=require(_0x80f8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x80f8('0x9')][_0x80f8('0xa')]({'port':0x232a});var socket=require(_0x80f8('0xb'))({'host':_0x80f8('0xc'),'port':0x18eb});require(_0x80f8('0xd'))[_0x80f8('0xe')](socket);function respondWithRpcPromise(_0x3d6ad3,_0x2bb7aa,_0x1acf75){return new BPromise(function(_0xa44ee0,_0x26c259){return client[_0x80f8('0xf')](_0x3d6ad3,_0x1acf75)[_0x80f8('0x10')](function(_0x44a34e){logger[_0x80f8('0x11')](_0x80f8('0x12'),_0x2bb7aa,_0x80f8('0x13'));logger[_0x80f8('0x14')](_0x80f8('0x15'),_0x2bb7aa,_0x80f8('0x13'),JSON['stringify'](_0x44a34e));if(_0x44a34e[_0x80f8('0x16')]){if(_0x44a34e[_0x80f8('0x16')][_0x80f8('0x17')]===0x1f4){logger['error'](_0x80f8('0x12'),_0x2bb7aa,_0x44a34e[_0x80f8('0x16')][_0x80f8('0x18')]);return _0x26c259(_0x44a34e['error']['message']);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x2bb7aa,_0x44a34e[_0x80f8('0x16')]['message']);return _0xa44ee0(_0x44a34e[_0x80f8('0x16')][_0x80f8('0x18')]);}else{logger[_0x80f8('0x11')](_0x80f8('0x12'),_0x2bb7aa,_0x80f8('0x13'));_0xa44ee0(_0x44a34e[_0x80f8('0x19')][_0x80f8('0x18')]);}})[_0x80f8('0x1a')](function(_0x375f42){logger[_0x80f8('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2bb7aa,_0x375f42);_0x26c259(_0x375f42);});});}exports[_0x80f8('0x1b')]=function(_0x981e13){var _0x1fe500=this;return new Promise(function(_0x1e2ae6,_0xa88a03){return db['OpenchannelInteraction'][_0x80f8('0x1c')](_0x981e13[_0x80f8('0x1d')],{'raw':_0x981e13['options']?_0x981e13[_0x80f8('0x1e')][_0x80f8('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x981e13['options']?_0x981e13[_0x80f8('0x1e')][_0x80f8('0x20')]||null:null,'attributes':_0x981e13[_0x80f8('0x1e')]?_0x981e13[_0x80f8('0x1e')][_0x80f8('0x21')]||null:null,'limit':_0x981e13[_0x80f8('0x1e')]?_0x981e13[_0x80f8('0x1e')][_0x80f8('0x22')]||null:null})['then'](function(_0x26c62a){logger['info'](_0x80f8('0x1b'),_0x981e13);logger['debug'](_0x80f8('0x1b'),_0x981e13,JSON['stringify'](_0x26c62a));_0x1e2ae6(_0x26c62a);})[_0x80f8('0x1a')](function(_0x34c126){logger[_0x80f8('0x16')]('UpdateOpenchannelInteraction',_0x34c126['message'],_0x981e13);_0xa88a03(_0x1fe500[_0x80f8('0x16')](0x1f4,_0x34c126[_0x80f8('0x18')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x40ed3e){return new Promise(function(_0x4a11c1,_0x241cb6){return db['OpenchannelInteraction'][_0x80f8('0x23')]({'where':_0x40ed3e['options']?_0x40ed3e[_0x80f8('0x1e')][_0x80f8('0x20')]||null:null})[_0x80f8('0x10')](function(_0x46d379){if(_0x46d379){return _0x46d379[_0x80f8('0x24')](_0x40ed3e[_0x80f8('0x1d')][_0x80f8('0x25')],_[_0x80f8('0x26')](_0x40ed3e[_0x80f8('0x1d')],[_0x80f8('0x25'),'id'])||{});}})['spread'](function(_0x545f3c){logger[_0x80f8('0x11')](_0x80f8('0x27'),_0x40ed3e);logger[_0x80f8('0x14')](_0x80f8('0x27'),_0x40ed3e,JSON['stringify'](_0x545f3c));_0x4a11c1(_0x545f3c);})[_0x80f8('0x1a')](function(_0x2d4aa8){logger['error'](_0x80f8('0x27'),_0x2d4aa8['message'],_0x40ed3e);_0x241cb6(_this[_0x80f8('0x16')](0x1f4,_0x2d4aa8['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index a0e13de..f3c18f9 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 _0x0f96=['register','length','./openchannelInteraction.events','save','remove','emit','removeListener'];(function(_0x11b739,_0x261e1b){var _0x384b18=function(_0x54be27){while(--_0x54be27){_0x11b739['push'](_0x11b739['shift']());}};_0x384b18(++_0x261e1b);}(_0x0f96,0x10c));var _0x60f9=function(_0x174cc0,_0x3c2b04){_0x174cc0=_0x174cc0-0x0;var _0x3e931b=_0x0f96[_0x174cc0];return _0x3e931b;};'use strict';var OpenchannelInteractionEvents=require(_0x60f9('0x0'));var events=[_0x60f9('0x1'),_0x60f9('0x2'),'update'];function createListener(_0x2f483b,_0x5ed6c2){return function(_0x19a99d){_0x5ed6c2[_0x60f9('0x3')](_0x2f483b,_0x19a99d);};}function removeListener(_0xe628d,_0x19e966){return function(){OpenchannelInteractionEvents[_0x60f9('0x4')](_0xe628d,_0x19e966);};}exports[_0x60f9('0x5')]=function(_0x24c5de){for(var _0x1c8f3b=0x0,_0xb9357b=events[_0x60f9('0x6')];_0x1c8f3b<_0xb9357b;_0x1c8f3b++){var _0x54487d=events[_0x1c8f3b];var _0x5b6614=createListener('openchannelInteraction:'+_0x54487d,_0x24c5de);OpenchannelInteractionEvents['on'](_0x54487d,_0x5b6614);}}; \ No newline at end of file +var _0x4b38=['save','remove','update','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x3158de,_0x3c7a71){var _0x591964=function(_0x11c450){while(--_0x11c450){_0x3158de['push'](_0x3158de['shift']());}};_0x591964(++_0x3c7a71);}(_0x4b38,0xce));var _0x84b3=function(_0x11e94d,_0x55420c){_0x11e94d=_0x11e94d-0x0;var _0x7dcbfa=_0x4b38[_0x11e94d];return _0x7dcbfa;};'use strict';var OpenchannelInteractionEvents=require(_0x84b3('0x0'));var events=[_0x84b3('0x1'),_0x84b3('0x2'),_0x84b3('0x3')];function createListener(_0x5c0d9a,_0x513658){return function(_0x104845){_0x513658[_0x84b3('0x4')](_0x5c0d9a,_0x104845);};}function removeListener(_0x2aea20,_0x5dae70){return function(){OpenchannelInteractionEvents[_0x84b3('0x5')](_0x2aea20,_0x5dae70);};}exports[_0x84b3('0x6')]=function(_0x53e9b2){for(var _0x5c0610=0x0,_0xa3a173=events[_0x84b3('0x7')];_0x5c0610<_0xa3a173;_0x5c0610++){var _0x523d9c=events[_0x5c0610];var _0x280cd1=createListener(_0x84b3('0x8')+_0x523d9c,_0x53e9b2);OpenchannelInteractionEvents['on'](_0x523d9c,_0x280cd1);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 9972319..0894c0c 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 _0x4297=['multer','util','path','express','Router','../../components/auth/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','create','put','update','/:id/accept','/:id/reject','reject','delete','exports'];(function(_0x1c35b1,_0x52a6ad){var _0x1bd1d4=function(_0x1a4760){while(--_0x1a4760){_0x1c35b1['push'](_0x1c35b1['shift']());}};_0x1bd1d4(++_0x52a6ad);}(_0x4297,0x96));var _0x7429=function(_0x15bd45,_0x49f738){_0x15bd45=_0x15bd45-0x0;var _0x3a9660=_0x4297[_0x15bd45];return _0x3a9660;};'use strict';var multer=require(_0x7429('0x0'));var util=require(_0x7429('0x1'));var path=require(_0x7429('0x2'));var express=require(_0x7429('0x3'));var router=express[_0x7429('0x4')]();var auth=require(_0x7429('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7429('0x6'));var controller=require(_0x7429('0x7'));router[_0x7429('0x8')]('/',auth[_0x7429('0x9')](),controller[_0x7429('0xa')]);router[_0x7429('0x8')](_0x7429('0xb'),auth[_0x7429('0x9')](),controller[_0x7429('0xc')]);router[_0x7429('0x8')](_0x7429('0xd'),auth[_0x7429('0x9')](),controller[_0x7429('0xe')]);router[_0x7429('0xf')]('/',auth['isAuthenticated'](),interaction[_0x7429('0x10')]('openchannel','openchannelmessage:create'),controller[_0x7429('0x11')]);router[_0x7429('0x12')](_0x7429('0xd'),auth[_0x7429('0x9')](),controller[_0x7429('0x13')]);router['put'](_0x7429('0x14'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x7429('0x15'),auth[_0x7429('0x9')](),controller[_0x7429('0x16')]);router[_0x7429('0x17')](_0x7429('0xd'),auth[_0x7429('0x9')](),controller['destroy']);module[_0x7429('0x18')]=router; \ No newline at end of file +var _0xae5d=['accept','/:id/reject','reject','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','openchannel','create','put','/:id/accept'];(function(_0x5104fe,_0x34c3b1){var _0x14548d=function(_0x2962ae){while(--_0x2962ae){_0x5104fe['push'](_0x5104fe['shift']());}};_0x14548d(++_0x34c3b1);}(_0xae5d,0x1c6));var _0xdae5=function(_0x4d9bb2,_0x3db50d){_0x4d9bb2=_0x4d9bb2-0x0;var _0x3179fe=_0xae5d[_0x4d9bb2];return _0x3179fe;};'use strict';var multer=require(_0xdae5('0x0'));var util=require(_0xdae5('0x1'));var path=require(_0xdae5('0x2'));var express=require(_0xdae5('0x3'));var router=express[_0xdae5('0x4')]();var auth=require(_0xdae5('0x5'));var interaction=require(_0xdae5('0x6'));var config=require(_0xdae5('0x7'));var controller=require(_0xdae5('0x8'));router[_0xdae5('0x9')]('/',auth[_0xdae5('0xa')](),controller['index']);router[_0xdae5('0x9')](_0xdae5('0xb'),auth[_0xdae5('0xa')](),controller[_0xdae5('0xc')]);router['get'](_0xdae5('0xd'),auth['isAuthenticated'](),controller[_0xdae5('0xe')]);router[_0xdae5('0xf')]('/',auth[_0xdae5('0xa')](),interaction[_0xdae5('0x10')](_0xdae5('0x11'),'openchannelmessage:create'),controller[_0xdae5('0x12')]);router[_0xdae5('0x13')](_0xdae5('0xd'),auth[_0xdae5('0xa')](),controller['update']);router[_0xdae5('0x13')](_0xdae5('0x14'),auth['isAuthenticated'](),controller[_0xdae5('0x15')]);router[_0xdae5('0x13')](_0xdae5('0x16'),auth[_0xdae5('0xa')](),controller[_0xdae5('0x17')]);router[_0xdae5('0x18')](_0xdae5('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 748edde..9fa9dbc 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 _0x6fc1=['DATE','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0xf7f8ae,_0x516795){var _0x2b957f=function(_0x5c7f0f){while(--_0x5c7f0f){_0xf7f8ae['push'](_0xf7f8ae['shift']());}};_0x2b957f(++_0x516795);}(_0x6fc1,0x14a));var _0x16fc=function(_0x29392f,_0x48bcd0){_0x29392f=_0x29392f-0x0;var _0x5b9110=_0x6fc1[_0x29392f];return _0x5b9110;};'use strict';var Sequelize=require('sequelize');module[_0x16fc('0x0')]={'body':{'type':Sequelize[_0x16fc('0x1')](_0x16fc('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x16fc('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x16fc('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x16fc('0x4')]('in',_0x16fc('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x16fc('0x6')]}}; \ No newline at end of file +var _0x1ae0=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x1ae0,0x171));var _0x01ae=function(_0x293fae,_0x3179a1){_0x293fae=_0x293fae-0x0;var _0x349d2f=_0x1ae0[_0x293fae];return _0x349d2f;};'use strict';var Sequelize=require(_0x01ae('0x0'));module[_0x01ae('0x1')]={'body':{'type':Sequelize[_0x01ae('0x2')](_0x01ae('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x01ae('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x01ae('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x01ae('0x5')]('in',_0x01ae('0x6')),'defaultValue':_0x01ae('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x01ae('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 66d54e2..2fb8283 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 _0x966e=['merge','filter','options','rows','params','includeAll','include','find','create','body','destroy','describe','openchannel','readAt','format','UserId','user','CmContact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','interface','SIP/%s','channel','EventManager','acceptmessage','openchannel-interactions','agent','RejectMessage','event','rejectmessage','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','localhost','jayson/promise','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','name','OpenchannelMessage','rawAttributes','model','keys','query','dateStart','dateEnd','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','day','add'];(function(_0x4e2336,_0x542e26){var _0x256261=function(_0x1b24bb){while(--_0x1b24bb){_0x4e2336['push'](_0x4e2336['shift']());}};_0x256261(++_0x542e26);}(_0x966e,0xf4));var _0xe966=function(_0x1f0ca7,_0x403fe9){_0x1f0ca7=_0x1f0ca7-0x0;var _0x107ec2=_0x966e[_0x1f0ca7];return _0x107ec2;};'use strict';var jsonpatch=require(_0xe966('0x0'));var rp=require(_0xe966('0x1'));var moment=require(_0xe966('0x2'));var BPromise=require(_0xe966('0x3'));var Mustache=require('mustache');var util=require(_0xe966('0x4'));var path=require(_0xe966('0x5'));var sox=require(_0xe966('0x6'));var csv=require(_0xe966('0x7'));var ejs=require(_0xe966('0x8'));var fs=require('fs');var _=require(_0xe966('0x9'));var squel=require(_0xe966('0xa'));var crypto=require('crypto');var jsforce=require(_0xe966('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe966('0x7'));var querystring=require(_0xe966('0xc'));var Papa=require(_0xe966('0xd'));var qs=require(_0xe966('0xe'));var logger=require(_0xe966('0xf'))(_0xe966('0x10'));var utils=require(_0xe966('0x11'));var config=require(_0xe966('0x12'));var db=require(_0xe966('0x13'))['db'];var socket=require('socket.io-emitter')({'host':_0xe966('0x14'),'port':0x18eb});require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0xe966('0x15'));var client=jayson['client'][_0xe966('0x16')]({'port':0x232c});var client9002=jayson['client'][_0xe966('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x3ca8e4,_0x382ddc,_0x4aefe2,_0x5a1623){return new BPromise(function(_0x306c79,_0x4e8c0e){var _0x149bf1=_0x5a1623||client;return _0x149bf1[_0xe966('0x17')](_0x3ca8e4,_0x4aefe2)[_0xe966('0x18')](function(_0x12e0fb){logger[_0xe966('0x19')](_0xe966('0x1a'),_0x382ddc,'request\x20sent');logger[_0xe966('0x1b')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x382ddc,_0xe966('0x1c'),JSON[_0xe966('0x1d')](_0x12e0fb));if(_0x12e0fb[_0xe966('0x1e')]){if(_0x12e0fb[_0xe966('0x1e')][_0xe966('0x1f')]===0x1f4){logger[_0xe966('0x1e')](_0xe966('0x1a'),_0x382ddc,_0x12e0fb[_0xe966('0x1e')][_0xe966('0x20')]);return _0x4e8c0e(_0x12e0fb[_0xe966('0x1e')][_0xe966('0x20')]);}logger[_0xe966('0x1e')]('OpenchannelMessage,\x20%s,\x20%s',_0x382ddc,_0x12e0fb['error'][_0xe966('0x20')]);return _0x306c79(_0x12e0fb[_0xe966('0x1e')][_0xe966('0x20')]);}else{logger[_0xe966('0x19')](_0xe966('0x1a'),_0x382ddc,_0xe966('0x1c'));_0x306c79(_0x12e0fb['result']['message']);}})[_0xe966('0x21')](function(_0x5aff82){logger[_0xe966('0x1e')](_0xe966('0x1a'),_0x382ddc,_0x5aff82);_0x4e8c0e(_0x5aff82);});});}function respondWithStatusCode(_0x29a752,_0x42dd51){_0x42dd51=_0x42dd51||0xcc;return function(_0x5df350){if(_0x5df350){return _0x29a752[_0xe966('0x22')](_0x42dd51);}return _0x29a752[_0xe966('0x23')](_0x42dd51)[_0xe966('0x24')]();};}function respondWithResult(_0x5694db,_0x3b64e8){_0x3b64e8=_0x3b64e8||0xc8;return function(_0x1a7dbd){if(_0x1a7dbd){return _0x5694db[_0xe966('0x23')](_0x3b64e8)['json'](_0x1a7dbd);}};}function respondWithFilteredResult(_0x2455c4,_0x9c4049){return function(_0xd2dbb9){if(_0xd2dbb9){var _0x3dbefa=_0xd2dbb9[_0xe966('0x25')],_0x5687c5=_0x9c4049['offset'],_0x574584=_0x9c4049[_0xe966('0x26')]+_0x9c4049[_0xe966('0x27')],_0x40a4d5;if(_0x574584>=_0x3dbefa){_0x574584=_0x3dbefa;_0x40a4d5=0xc8;}else{_0x40a4d5=0xce;}_0x2455c4[_0xe966('0x23')](_0x40a4d5);return _0x2455c4[_0xe966('0x28')]('Content-Range',_0x5687c5+'-'+_0x574584+'/'+_0x3dbefa)[_0xe966('0x29')](_0xd2dbb9);}return null;};}function patchUpdates(_0x24714f){return function(_0x296179){try{jsonpatch[_0xe966('0x2a')](_0x296179,_0x24714f,!![]);}catch(_0x462dbf){return BPromise[_0xe966('0x2b')](_0x462dbf);}return _0x296179['save']();};}function saveUpdates(_0x1e6e30,_0x49ffc3){return function(_0x547d62){if(_0x547d62){return _0x547d62[_0xe966('0x2c')](_0x1e6e30)[_0xe966('0x18')](function(_0xa24896){return _0xa24896;});}return null;};}function removeEntity(_0x37a931,_0x146851){return function(_0xb24cad){if(_0xb24cad){return _0xb24cad['destroy']()[_0xe966('0x18')](function(){_0x37a931[_0xe966('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2544e8,_0x592dab){return function(_0x49f54d){if(!_0x49f54d){_0x2544e8['sendStatus'](0x194);}return _0x49f54d;};}function handleError(_0x6bf101,_0x3994b1){_0x3994b1=_0x3994b1||0x1f4;return function(_0x96b213){logger['error'](_0x96b213['stack']);if(_0x96b213[_0xe966('0x2d')]){delete _0x96b213[_0xe966('0x2d')];}_0x6bf101[_0xe966('0x23')](_0x3994b1)['send'](_0x96b213);};}exports['index']=function(_0x511021,_0xcf5fe4){var _0x45ad52={},_0x28dcc5={},_0x2437d0={'count':0x0,'rows':[]};var _0x51834e=db[_0xe966('0x2e')][_0xe966('0x2f')];_0x28dcc5[_0xe966('0x30')]=_[_0xe966('0x31')](_0x51834e);var _0x10ccf7={'dateStart':_0x511021[_0xe966('0x32')][_0xe966('0x33')],'dateEnd':_0x511021['query'][_0xe966('0x34')]};delete _0x511021['query'][_0xe966('0x33')];delete _0x511021[_0xe966('0x32')][_0xe966('0x34')];_0x28dcc5[_0xe966('0x32')]=_['keys'](_0x511021[_0xe966('0x32')]);_0x28dcc5['filters']=_['intersection'](_0x28dcc5[_0xe966('0x30')],_0x28dcc5[_0xe966('0x32')]);_0x45ad52[_0xe966('0x35')]=_[_0xe966('0x36')](_0x28dcc5[_0xe966('0x30')],qs[_0xe966('0x37')](_0x511021[_0xe966('0x32')][_0xe966('0x37')]));_0x45ad52[_0xe966('0x35')]=_0x45ad52[_0xe966('0x35')][_0xe966('0x38')]?_0x45ad52['attributes']:_0x28dcc5[_0xe966('0x30')];if(!_0x511021[_0xe966('0x32')][_0xe966('0x39')](_0xe966('0x3a'))){_0x45ad52[_0xe966('0x27')]=qs['limit'](_0x511021['query'][_0xe966('0x27')]);_0x45ad52[_0xe966('0x26')]=qs['offset'](_0x511021[_0xe966('0x32')][_0xe966('0x26')]);}_0x45ad52['order']=qs[_0xe966('0x3b')](_0x511021[_0xe966('0x32')]['sort']);_0x45ad52[_0xe966('0x3c')]=qs[_0xe966('0x3d')](_[_0xe966('0x3e')](_0x511021[_0xe966('0x32')],_0x28dcc5['filters']));if(_0x10ccf7[_0xe966('0x33')]){if(_0x10ccf7[_0xe966('0x34')]){_0x10ccf7['dateEnd']=moment(_0x10ccf7[_0xe966('0x34')])['add'](0x1,_0xe966('0x3f'));}else{_0x10ccf7[_0xe966('0x34')]=moment(_0x10ccf7['dateStart'])[_0xe966('0x40')](0x1,'day');}_[_0xe966('0x41')](_0x45ad52[_0xe966('0x3c')],{'createdAt':{'$gte':_0x10ccf7[_0xe966('0x33')],'$lte':_0x10ccf7['dateEnd']}});}if(_0x511021[_0xe966('0x32')][_0xe966('0x42')]){_0x45ad52[_0xe966('0x3c')]=_[_0xe966('0x41')](_0x45ad52[_0xe966('0x3c')],{'$or':_['map'](_0x45ad52['attributes'],function(_0x304795){var _0x198974={};_0x198974[_0x304795]={'$like':'%'+_0x511021['query'][_0xe966('0x42')]+'%'};return _0x198974;})});}_0x45ad52=_[_0xe966('0x41')]({},_0x45ad52,_0x511021[_0xe966('0x43')]);var _0x32d819={'where':_0x45ad52[_0xe966('0x3c')]};return db[_0xe966('0x2e')]['count'](_0x32d819)[_0xe966('0x18')](function(_0x4d5b3c){_0x2437d0[_0xe966('0x25')]=_0x4d5b3c;if(_0x511021[_0xe966('0x32')]['includeAll']){_0x45ad52['include']=[{'all':!![]}];}return db[_0xe966('0x2e')]['findAll'](_0x45ad52);})[_0xe966('0x18')](function(_0x1a8c17){_0x2437d0[_0xe966('0x44')]=_0x1a8c17;return _0x2437d0;})['then'](respondWithFilteredResult(_0xcf5fe4,_0x45ad52))[_0xe966('0x21')](handleError(_0xcf5fe4,null));};exports['show']=function(_0x8cbbe2,_0x21bac8){var _0x5e7e27={'raw':!![],'where':{'id':_0x8cbbe2[_0xe966('0x45')]['id']}},_0x1cfb1f={};_0x1cfb1f['model']=_['keys'](db[_0xe966('0x2e')]['rawAttributes']);_0x1cfb1f[_0xe966('0x32')]=_[_0xe966('0x31')](_0x8cbbe2[_0xe966('0x32')]);_0x1cfb1f[_0xe966('0x3d')]=_[_0xe966('0x36')](_0x1cfb1f[_0xe966('0x30')],_0x1cfb1f[_0xe966('0x32')]);_0x5e7e27[_0xe966('0x35')]=_[_0xe966('0x36')](_0x1cfb1f[_0xe966('0x30')],qs['fields'](_0x8cbbe2[_0xe966('0x32')][_0xe966('0x37')]));_0x5e7e27[_0xe966('0x35')]=_0x5e7e27[_0xe966('0x35')][_0xe966('0x38')]?_0x5e7e27[_0xe966('0x35')]:_0x1cfb1f[_0xe966('0x30')];if(_0x8cbbe2['query'][_0xe966('0x46')]){_0x5e7e27[_0xe966('0x47')]=[{'all':!![]}];}_0x5e7e27=_['merge']({},_0x5e7e27,_0x8cbbe2[_0xe966('0x43')]);return db[_0xe966('0x2e')][_0xe966('0x48')](_0x5e7e27)['then'](handleEntityNotFound(_0x21bac8,null))['then'](respondWithResult(_0x21bac8,null))[_0xe966('0x21')](handleError(_0x21bac8,null));};exports['create']=function(_0x451867,_0x2759b6){return db['OpenchannelMessage'][_0xe966('0x49')](_0x451867[_0xe966('0x4a')],{})['then'](respondWithResult(_0x2759b6,0xc9))[_0xe966('0x21')](handleError(_0x2759b6,null));};exports[_0xe966('0x2c')]=function(_0x55f3db,_0x20c002){if(_0x55f3db[_0xe966('0x4a')]['id']){delete _0x55f3db[_0xe966('0x4a')]['id'];}return db[_0xe966('0x2e')]['find']({'where':{'id':_0x55f3db['params']['id']}})[_0xe966('0x18')](handleEntityNotFound(_0x20c002,null))[_0xe966('0x18')](saveUpdates(_0x55f3db['body'],null))[_0xe966('0x18')](respondWithResult(_0x20c002,null))[_0xe966('0x21')](handleError(_0x20c002,null));};exports[_0xe966('0x4b')]=function(_0x2633a0,_0x332b07){return db[_0xe966('0x2e')]['find']({'where':{'id':_0x2633a0[_0xe966('0x45')]['id']}})['then'](handleEntityNotFound(_0x332b07,null))['then'](removeEntity(_0x332b07,null))[_0xe966('0x21')](handleError(_0x332b07,null));};exports[_0xe966('0x4c')]=function(_0x315bae,_0x9baf51){return db['OpenchannelMessage'][_0xe966('0x4c')]()[_0xe966('0x18')](respondWithResult(_0x9baf51,null))[_0xe966('0x21')](handleError(_0x9baf51,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports['accept']=function(_0x209727,_0x34525c,_0x5846d2){var _0x1b0eb8={'channel':_0xe966('0x4d')};if(_0x209727[_0xe966('0x4a')]['id']){delete _0x209727[_0xe966('0x4a')]['id'];}_0x209727[_0xe966('0x4a')]['read']=!![];_0x209727['body'][_0xe966('0x4e')]=moment()[_0xe966('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x209727[_0xe966('0x4a')][_0xe966('0x50')]=_0x209727[_0xe966('0x4a')][_0xe966('0x50')]||_0x209727[_0xe966('0x51')]['id'];return db[_0xe966('0x2e')][_0xe966('0x48')]({'where':{'id':_0x209727[_0xe966('0x45')]['id'],'UserId':null},'include':[{'model':db[_0xe966('0x52')],'as':'Contact'}]})[_0xe966('0x18')](handleEntityNotFound(_0x34525c,null))[_0xe966('0x18')](saveUpdates(_0x209727['body'],null))['then'](function(_0x20549c){if(_0x20549c){_0x1b0eb8[_0xe966('0x20')]=_0x20549c[_0xe966('0x53')]({'plain':!![]});return db[_0xe966('0x54')]['find']({'where':{'id':_0x20549c[_0xe966('0x55')]}});}return null;})[_0xe966('0x18')](handleEntityNotFound(_0x34525c,null))[_0xe966('0x18')](function(_0x48cb54){if(_0x48cb54){return _0x48cb54[_0xe966('0x2c')]({'UserId':_0x209727[_0xe966('0x4a')]['UserId'],'read1stAt':_[_0xe966('0x56')](_0x48cb54[_0xe966('0x57')])?moment()[_0xe966('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xe966('0x18')](function(_0x324049){if(_0x324049){_0x1b0eb8[_0xe966('0x58')]=_0x324049[_0xe966('0x53')]({'plain':!![]});interaction_log['info'](_0xe966('0x59'),_0x209727[_0xe966('0x51')]['id'],_0x209727['user'][_0xe966('0x2d')],_0x209727[_0xe966('0x51')][_0xe966('0x5a')],_0x1b0eb8[_0xe966('0x58')]['id'],_0x209727[_0xe966('0x4a')]?JSON['stringify'](_0x209727['body']):_0xe966('0x5b'));return respondWithRpcPromise(_0xe966('0x5c'),'acceptMessage',_0x1b0eb8);}return null;})[_0xe966('0x18')](function(_0x1bd532){if(_0x1bd532){if(_0x209727[_0xe966('0x4a')]['manual']){_0x1b0eb8[_0xe966('0x20')][_0xe966('0x5d')]=util['format'](_0xe966('0x5e'),_0x209727[_0xe966('0x51')][_0xe966('0x2d')]);_0x1b0eb8[_0xe966('0x20')][_0xe966('0x5f')]=_0x1b0eb8[_0xe966('0x5f')];_0x1b0eb8[_0xe966('0x20')]['event']='accept';return respondWithRpcPromise(_0xe966('0x60'),'EventManager',{'event':_0xe966('0x61'),'message':_0x1b0eb8[_0xe966('0x20')]},client9002)[_0xe966('0x18')](function(){return _0x1b0eb8;});}return _0x1b0eb8;}return null;})[_0xe966('0x18')](respondWithResult(_0x34525c,null))[_0xe966('0x21')](handleError(_0x34525c,null));};var interaction_log=require(_0xe966('0xf'))(_0xe966('0x62'));exports[_0xe966('0x2b')]=function(_0x285614,_0x2cec91,_0x349fbd){var _0x4f3d8e={'agent':{},'channel':_0xe966('0x4d')};if(_0x285614[_0xe966('0x4a')]['id']){delete _0x285614[_0xe966('0x4a')]['id'];}_0x285614[_0xe966('0x4a')][_0xe966('0x50')]=_0x285614[_0xe966('0x4a')][_0xe966('0x50')]||_0x285614[_0xe966('0x51')]['id'];_0x4f3d8e[_0xe966('0x63')]['id']=_0x285614[_0xe966('0x4a')][_0xe966('0x50')];return db['OpenchannelMessage'][_0xe966('0x48')]({'where':{'id':_0x285614[_0xe966('0x45')]['id'],'UserId':null}})[_0xe966('0x18')](handleEntityNotFound(_0x2cec91,null))[_0xe966('0x18')](function(_0x2c230a){if(_0x2c230a){_0x4f3d8e[_0xe966('0x20')]=_0x2c230a[_0xe966('0x53')]({'plain':!![]});return db[_0xe966('0x54')][_0xe966('0x48')]({'where':{'id':_0x2c230a[_0xe966('0x55')]}});}return null;})[_0xe966('0x18')](handleEntityNotFound(_0x2cec91,null))[_0xe966('0x18')](function(_0x441e63){if(_0x441e63){_0x4f3d8e['interaction']=_0x441e63[_0xe966('0x53')]({'plain':!![]});interaction_log[_0xe966('0x19')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x285614[_0xe966('0x51')]['id'],_0x285614[_0xe966('0x51')]['name'],_0x285614[_0xe966('0x51')][_0xe966('0x5a')],_0x4f3d8e[_0xe966('0x58')]['id'],_0x285614['body']?JSON[_0xe966('0x1d')](_0x285614[_0xe966('0x4a')]):'null');return respondWithRpcPromise(_0xe966('0x64'),'rejectMessage',_0x4f3d8e);}return null;})[_0xe966('0x18')](function(_0x258451){if(_0x258451){_0x258451[_0xe966('0x20')][_0xe966('0x5d')]=util['format'](_0xe966('0x5e'),_0x285614['user']['name']);_0x258451['message'][_0xe966('0x5f')]=_0x4f3d8e['channel'];_0x258451[_0xe966('0x20')][_0xe966('0x65')]=_0xe966('0x2b');respondWithRpcPromise(_0xe966('0x60'),_0xe966('0x60'),{'event':_0xe966('0x66'),'message':_0x258451[_0xe966('0x20')]},client9002);return _0x4f3d8e;}return null;})[_0xe966('0x18')](respondWithResult(_0x2cec91,null))[_0xe966('0x21')](handleError(_0x2cec91,null));}; \ No newline at end of file +var _0x20fd=['body','update','params','describe','openchannel-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','manual','channel','event','EventManager','reject','openchannel','agent','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','interface','SIP/%s','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','socket.io-emitter','localhost','./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','result','catch','sendStatus','status','end','json','offset','limit','Content-Range','apply','save','destroy','name','send','index','OpenchannelMessage','keys','dateStart','query','dateEnd','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','add','day','filter','map','merge','options','count','includeAll','include','rows','show','find','create'];(function(_0x225b04,_0x183366){var _0x5744d8=function(_0x3f6896){while(--_0x3f6896){_0x225b04['push'](_0x225b04['shift']());}};_0x5744d8(++_0x183366);}(_0x20fd,0x16e));var _0xd20f=function(_0xd69054,_0x2b7a7d){_0xd69054=_0xd69054-0x0;var _0x18610f=_0x20fd[_0xd69054];return _0x18610f;};'use strict';var jsonpatch=require(_0xd20f('0x0'));var rp=require(_0xd20f('0x1'));var moment=require(_0xd20f('0x2'));var BPromise=require(_0xd20f('0x3'));var Mustache=require(_0xd20f('0x4'));var util=require(_0xd20f('0x5'));var path=require('path');var sox=require(_0xd20f('0x6'));var csv=require(_0xd20f('0x7'));var ejs=require(_0xd20f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd20f('0x9'));var crypto=require('crypto');var jsforce=require(_0xd20f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd20f('0x7'));var querystring=require(_0xd20f('0xb'));var Papa=require('papaparse');var qs=require(_0xd20f('0xc'));var logger=require(_0xd20f('0xd'))(_0xd20f('0xe'));var utils=require(_0xd20f('0xf'));var config=require(_0xd20f('0x10'));var db=require('../../mysqldb')['db'];var socket=require(_0xd20f('0x11'))({'host':_0xd20f('0x12'),'port':0x18eb});require(_0xd20f('0x13'))[_0xd20f('0x14')](socket);var jayson=require(_0xd20f('0x15'));var client=jayson[_0xd20f('0x16')][_0xd20f('0x17')]({'port':0x232c});var client9002=jayson[_0xd20f('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32f2f8,_0x2f6c71,_0x3fdca5,_0x4b8779){return new BPromise(function(_0x5f31e2,_0x3ce678){var _0x39b57f=_0x4b8779||client;return _0x39b57f[_0xd20f('0x18')](_0x32f2f8,_0x3fdca5)[_0xd20f('0x19')](function(_0x426274){logger[_0xd20f('0x1a')](_0xd20f('0x1b'),_0x2f6c71,_0xd20f('0x1c'));logger[_0xd20f('0x1d')](_0xd20f('0x1e'),_0x2f6c71,_0xd20f('0x1c'),JSON[_0xd20f('0x1f')](_0x426274));if(_0x426274[_0xd20f('0x20')]){if(_0x426274['error']['code']===0x1f4){logger[_0xd20f('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x2f6c71,_0x426274[_0xd20f('0x20')][_0xd20f('0x21')]);return _0x3ce678(_0x426274[_0xd20f('0x20')][_0xd20f('0x21')]);}logger[_0xd20f('0x20')](_0xd20f('0x1b'),_0x2f6c71,_0x426274[_0xd20f('0x20')]['message']);return _0x5f31e2(_0x426274[_0xd20f('0x20')]['message']);}else{logger[_0xd20f('0x1a')](_0xd20f('0x1b'),_0x2f6c71,_0xd20f('0x1c'));_0x5f31e2(_0x426274[_0xd20f('0x22')][_0xd20f('0x21')]);}})[_0xd20f('0x23')](function(_0x4339e1){logger[_0xd20f('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x2f6c71,_0x4339e1);_0x3ce678(_0x4339e1);});});}function respondWithStatusCode(_0x297e5b,_0x2140a9){_0x2140a9=_0x2140a9||0xcc;return function(_0x15d7d4){if(_0x15d7d4){return _0x297e5b[_0xd20f('0x24')](_0x2140a9);}return _0x297e5b[_0xd20f('0x25')](_0x2140a9)[_0xd20f('0x26')]();};}function respondWithResult(_0x36cea2,_0x103322){_0x103322=_0x103322||0xc8;return function(_0xbc55d){if(_0xbc55d){return _0x36cea2[_0xd20f('0x25')](_0x103322)[_0xd20f('0x27')](_0xbc55d);}};}function respondWithFilteredResult(_0x11d01e,_0x59c742){return function(_0x24e87f){if(_0x24e87f){var _0x98f6fb=_0x24e87f['count'],_0x269574=_0x59c742[_0xd20f('0x28')],_0x13e6e1=_0x59c742['offset']+_0x59c742[_0xd20f('0x29')],_0x5bcdc4;if(_0x13e6e1>=_0x98f6fb){_0x13e6e1=_0x98f6fb;_0x5bcdc4=0xc8;}else{_0x5bcdc4=0xce;}_0x11d01e[_0xd20f('0x25')](_0x5bcdc4);return _0x11d01e['set'](_0xd20f('0x2a'),_0x269574+'-'+_0x13e6e1+'/'+_0x98f6fb)[_0xd20f('0x27')](_0x24e87f);}return null;};}function patchUpdates(_0x18985e){return function(_0x54e3b9){try{jsonpatch[_0xd20f('0x2b')](_0x54e3b9,_0x18985e,!![]);}catch(_0x45de7b){return BPromise['reject'](_0x45de7b);}return _0x54e3b9[_0xd20f('0x2c')]();};}function saveUpdates(_0x42a0df,_0x43fa8c){return function(_0x45e320){if(_0x45e320){return _0x45e320['update'](_0x42a0df)['then'](function(_0x1ec11b){return _0x1ec11b;});}return null;};}function removeEntity(_0x2a9e46,_0x19e769){return function(_0x3b2742){if(_0x3b2742){return _0x3b2742[_0xd20f('0x2d')]()[_0xd20f('0x19')](function(){_0x2a9e46[_0xd20f('0x25')](0xcc)[_0xd20f('0x26')]();});}};}function handleEntityNotFound(_0x870e2e,_0x5088c3){return function(_0x1103dd){if(!_0x1103dd){_0x870e2e[_0xd20f('0x24')](0x194);}return _0x1103dd;};}function handleError(_0x112774,_0x376c51){_0x376c51=_0x376c51||0x1f4;return function(_0x32b172){logger[_0xd20f('0x20')](_0x32b172['stack']);if(_0x32b172[_0xd20f('0x2e')]){delete _0x32b172[_0xd20f('0x2e')];}_0x112774[_0xd20f('0x25')](_0x376c51)[_0xd20f('0x2f')](_0x32b172);};}exports[_0xd20f('0x30')]=function(_0x4c2437,_0x3159c7){var _0x183e53={},_0x4a5a18={},_0x330728={'count':0x0,'rows':[]};var _0x1b0190=db[_0xd20f('0x31')]['rawAttributes'];_0x4a5a18['model']=_[_0xd20f('0x32')](_0x1b0190);var _0x7ac46f={'dateStart':_0x4c2437['query'][_0xd20f('0x33')],'dateEnd':_0x4c2437[_0xd20f('0x34')][_0xd20f('0x35')]};delete _0x4c2437['query'][_0xd20f('0x33')];delete _0x4c2437[_0xd20f('0x34')]['dateEnd'];_0x4a5a18[_0xd20f('0x34')]=_['keys'](_0x4c2437['query']);_0x4a5a18[_0xd20f('0x36')]=_[_0xd20f('0x37')](_0x4a5a18[_0xd20f('0x38')],_0x4a5a18[_0xd20f('0x34')]);_0x183e53['attributes']=_[_0xd20f('0x37')](_0x4a5a18[_0xd20f('0x38')],qs['fields'](_0x4c2437[_0xd20f('0x34')][_0xd20f('0x39')]));_0x183e53[_0xd20f('0x3a')]=_0x183e53[_0xd20f('0x3a')][_0xd20f('0x3b')]?_0x183e53[_0xd20f('0x3a')]:_0x4a5a18[_0xd20f('0x38')];if(!_0x4c2437[_0xd20f('0x34')][_0xd20f('0x3c')](_0xd20f('0x3d'))){_0x183e53[_0xd20f('0x29')]=qs[_0xd20f('0x29')](_0x4c2437[_0xd20f('0x34')][_0xd20f('0x29')]);_0x183e53[_0xd20f('0x28')]=qs[_0xd20f('0x28')](_0x4c2437[_0xd20f('0x34')]['offset']);}_0x183e53['order']=qs['sort'](_0x4c2437[_0xd20f('0x34')][_0xd20f('0x3e')]);_0x183e53[_0xd20f('0x3f')]=qs[_0xd20f('0x36')](_[_0xd20f('0x40')](_0x4c2437[_0xd20f('0x34')],_0x4a5a18[_0xd20f('0x36')]));if(_0x7ac46f[_0xd20f('0x33')]){if(_0x7ac46f[_0xd20f('0x35')]){_0x7ac46f[_0xd20f('0x35')]=moment(_0x7ac46f[_0xd20f('0x35')])[_0xd20f('0x41')](0x1,_0xd20f('0x42'));}else{_0x7ac46f[_0xd20f('0x35')]=moment(_0x7ac46f[_0xd20f('0x33')])[_0xd20f('0x41')](0x1,'day');}_['merge'](_0x183e53['where'],{'createdAt':{'$gte':_0x7ac46f[_0xd20f('0x33')],'$lte':_0x7ac46f[_0xd20f('0x35')]}});}if(_0x4c2437[_0xd20f('0x34')][_0xd20f('0x43')]){_0x183e53[_0xd20f('0x3f')]=_['merge'](_0x183e53['where'],{'$or':_[_0xd20f('0x44')](_0x183e53['attributes'],function(_0x39cbc6){var _0x31dd55={};_0x31dd55[_0x39cbc6]={'$like':'%'+_0x4c2437[_0xd20f('0x34')][_0xd20f('0x43')]+'%'};return _0x31dd55;})});}_0x183e53=_[_0xd20f('0x45')]({},_0x183e53,_0x4c2437[_0xd20f('0x46')]);var _0x365fae={'where':_0x183e53[_0xd20f('0x3f')]};return db[_0xd20f('0x31')]['count'](_0x365fae)[_0xd20f('0x19')](function(_0x14e688){_0x330728[_0xd20f('0x47')]=_0x14e688;if(_0x4c2437[_0xd20f('0x34')][_0xd20f('0x48')]){_0x183e53[_0xd20f('0x49')]=[{'all':!![]}];}return db[_0xd20f('0x31')]['findAll'](_0x183e53);})[_0xd20f('0x19')](function(_0x311307){_0x330728[_0xd20f('0x4a')]=_0x311307;return _0x330728;})[_0xd20f('0x19')](respondWithFilteredResult(_0x3159c7,_0x183e53))['catch'](handleError(_0x3159c7,null));};exports[_0xd20f('0x4b')]=function(_0x2f4910,_0x20ddc1){var _0x4ef7a4={'raw':!![],'where':{'id':_0x2f4910['params']['id']}},_0x5e83f5={};_0x5e83f5['model']=_[_0xd20f('0x32')](db['OpenchannelMessage']['rawAttributes']);_0x5e83f5[_0xd20f('0x34')]=_['keys'](_0x2f4910[_0xd20f('0x34')]);_0x5e83f5[_0xd20f('0x36')]=_['intersection'](_0x5e83f5[_0xd20f('0x38')],_0x5e83f5[_0xd20f('0x34')]);_0x4ef7a4[_0xd20f('0x3a')]=_[_0xd20f('0x37')](_0x5e83f5[_0xd20f('0x38')],qs[_0xd20f('0x39')](_0x2f4910['query'][_0xd20f('0x39')]));_0x4ef7a4[_0xd20f('0x3a')]=_0x4ef7a4[_0xd20f('0x3a')][_0xd20f('0x3b')]?_0x4ef7a4[_0xd20f('0x3a')]:_0x5e83f5[_0xd20f('0x38')];if(_0x2f4910['query'][_0xd20f('0x48')]){_0x4ef7a4[_0xd20f('0x49')]=[{'all':!![]}];}_0x4ef7a4=_['merge']({},_0x4ef7a4,_0x2f4910[_0xd20f('0x46')]);return db['OpenchannelMessage'][_0xd20f('0x4c')](_0x4ef7a4)[_0xd20f('0x19')](handleEntityNotFound(_0x20ddc1,null))['then'](respondWithResult(_0x20ddc1,null))[_0xd20f('0x23')](handleError(_0x20ddc1,null));};exports[_0xd20f('0x4d')]=function(_0x37558c,_0x47e3e3){return db['OpenchannelMessage'][_0xd20f('0x4d')](_0x37558c[_0xd20f('0x4e')],{})[_0xd20f('0x19')](respondWithResult(_0x47e3e3,0xc9))[_0xd20f('0x23')](handleError(_0x47e3e3,null));};exports[_0xd20f('0x4f')]=function(_0x3f9817,_0x4a6670){if(_0x3f9817['body']['id']){delete _0x3f9817[_0xd20f('0x4e')]['id'];}return db[_0xd20f('0x31')][_0xd20f('0x4c')]({'where':{'id':_0x3f9817[_0xd20f('0x50')]['id']}})[_0xd20f('0x19')](handleEntityNotFound(_0x4a6670,null))[_0xd20f('0x19')](saveUpdates(_0x3f9817[_0xd20f('0x4e')],null))[_0xd20f('0x19')](respondWithResult(_0x4a6670,null))[_0xd20f('0x23')](handleError(_0x4a6670,null));};exports[_0xd20f('0x2d')]=function(_0x478507,_0x21a194){return db[_0xd20f('0x31')][_0xd20f('0x4c')]({'where':{'id':_0x478507['params']['id']}})[_0xd20f('0x19')](handleEntityNotFound(_0x21a194,null))[_0xd20f('0x19')](removeEntity(_0x21a194,null))[_0xd20f('0x23')](handleError(_0x21a194,null));};exports[_0xd20f('0x51')]=function(_0x423c37,_0x147c28){return db[_0xd20f('0x31')][_0xd20f('0x51')]()[_0xd20f('0x19')](respondWithResult(_0x147c28,null))[_0xd20f('0x23')](handleError(_0x147c28,null));};var interaction_log=require(_0xd20f('0xd'))(_0xd20f('0x52'));exports[_0xd20f('0x53')]=function(_0x1f1b16,_0x5cea6f,_0x20ac8b){var _0x17d921={'channel':'openchannel'};if(_0x1f1b16[_0xd20f('0x4e')]['id']){delete _0x1f1b16['body']['id'];}_0x1f1b16['body']['read']=!![];_0x1f1b16[_0xd20f('0x4e')][_0xd20f('0x54')]=moment()[_0xd20f('0x55')](_0xd20f('0x56'));_0x1f1b16[_0xd20f('0x4e')]['UserId']=_0x1f1b16['body'][_0xd20f('0x57')]||_0x1f1b16[_0xd20f('0x58')]['id'];return db['OpenchannelMessage']['find']({'where':{'id':_0x1f1b16[_0xd20f('0x50')]['id'],'UserId':null},'include':[{'model':db[_0xd20f('0x59')],'as':_0xd20f('0x5a')}]})[_0xd20f('0x19')](handleEntityNotFound(_0x5cea6f,null))[_0xd20f('0x19')](saveUpdates(_0x1f1b16[_0xd20f('0x4e')],null))['then'](function(_0x19038c){if(_0x19038c){_0x17d921[_0xd20f('0x21')]=_0x19038c[_0xd20f('0x5b')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x19038c[_0xd20f('0x5c')]}});}return null;})[_0xd20f('0x19')](handleEntityNotFound(_0x5cea6f,null))[_0xd20f('0x19')](function(_0x3425ee){if(_0x3425ee){return _0x3425ee[_0xd20f('0x4f')]({'UserId':_0x1f1b16[_0xd20f('0x4e')]['UserId'],'read1stAt':_['isNil'](_0x3425ee['read1stAt'])?moment()['format'](_0xd20f('0x56')):undefined});}return null;})[_0xd20f('0x19')](function(_0x47d3e8){if(_0x47d3e8){_0x17d921[_0xd20f('0x5d')]=_0x47d3e8[_0xd20f('0x5b')]({'plain':!![]});interaction_log[_0xd20f('0x1a')](_0xd20f('0x5e'),_0x1f1b16['user']['id'],_0x1f1b16[_0xd20f('0x58')][_0xd20f('0x2e')],_0x1f1b16[_0xd20f('0x58')][_0xd20f('0x5f')],_0x17d921[_0xd20f('0x5d')]['id'],_0x1f1b16[_0xd20f('0x4e')]?JSON['stringify'](_0x1f1b16[_0xd20f('0x4e')]):'null');return respondWithRpcPromise(_0xd20f('0x60'),_0xd20f('0x61'),_0x17d921);}return null;})[_0xd20f('0x19')](function(_0x30a2ea){if(_0x30a2ea){if(_0x1f1b16[_0xd20f('0x4e')][_0xd20f('0x62')]){_0x17d921[_0xd20f('0x21')]['interface']=util[_0xd20f('0x55')]('SIP/%s',_0x1f1b16[_0xd20f('0x58')][_0xd20f('0x2e')]);_0x17d921[_0xd20f('0x21')]['channel']=_0x17d921[_0xd20f('0x63')];_0x17d921[_0xd20f('0x21')][_0xd20f('0x64')]=_0xd20f('0x53');return respondWithRpcPromise(_0xd20f('0x65'),_0xd20f('0x65'),{'event':'acceptmessage','message':_0x17d921[_0xd20f('0x21')]},client9002)['then'](function(){return _0x17d921;});}return _0x17d921;}return null;})[_0xd20f('0x19')](respondWithResult(_0x5cea6f,null))['catch'](handleError(_0x5cea6f,null));};var interaction_log=require(_0xd20f('0xd'))(_0xd20f('0x52'));exports[_0xd20f('0x66')]=function(_0x57b02c,_0x21ef6f,_0x1228b8){var _0x52603e={'agent':{},'channel':_0xd20f('0x67')};if(_0x57b02c[_0xd20f('0x4e')]['id']){delete _0x57b02c[_0xd20f('0x4e')]['id'];}_0x57b02c[_0xd20f('0x4e')][_0xd20f('0x57')]=_0x57b02c[_0xd20f('0x4e')][_0xd20f('0x57')]||_0x57b02c['user']['id'];_0x52603e[_0xd20f('0x68')]['id']=_0x57b02c[_0xd20f('0x4e')][_0xd20f('0x57')];return db['OpenchannelMessage'][_0xd20f('0x4c')]({'where':{'id':_0x57b02c[_0xd20f('0x50')]['id'],'UserId':null}})[_0xd20f('0x19')](handleEntityNotFound(_0x21ef6f,null))['then'](function(_0x3b24f2){if(_0x3b24f2){_0x52603e[_0xd20f('0x21')]=_0x3b24f2[_0xd20f('0x5b')]({'plain':!![]});return db[_0xd20f('0x69')][_0xd20f('0x4c')]({'where':{'id':_0x3b24f2['OpenchannelInteractionId']}});}return null;})[_0xd20f('0x19')](handleEntityNotFound(_0x21ef6f,null))[_0xd20f('0x19')](function(_0x542bd0){if(_0x542bd0){_0x52603e['interaction']=_0x542bd0['get']({'plain':!![]});interaction_log[_0xd20f('0x1a')](_0xd20f('0x6a'),_0x57b02c['user']['id'],_0x57b02c[_0xd20f('0x58')][_0xd20f('0x2e')],_0x57b02c[_0xd20f('0x58')][_0xd20f('0x5f')],_0x52603e['interaction']['id'],_0x57b02c[_0xd20f('0x4e')]?JSON[_0xd20f('0x1f')](_0x57b02c[_0xd20f('0x4e')]):_0xd20f('0x6b'));return respondWithRpcPromise(_0xd20f('0x6c'),'rejectMessage',_0x52603e);}return null;})[_0xd20f('0x19')](function(_0x18507a){if(_0x18507a){_0x18507a[_0xd20f('0x21')][_0xd20f('0x6d')]=util[_0xd20f('0x55')](_0xd20f('0x6e'),_0x57b02c['user']['name']);_0x18507a['message'][_0xd20f('0x63')]=_0x52603e['channel'];_0x18507a[_0xd20f('0x21')][_0xd20f('0x64')]=_0xd20f('0x66');respondWithRpcPromise(_0xd20f('0x65'),'EventManager',{'event':'rejectmessage','message':_0x18507a[_0xd20f('0x21')]},client9002);return _0x52603e;}return null;})['then'](respondWithResult(_0x21ef6f,null))[_0xd20f('0x23')](handleError(_0x21ef6f,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 7a430f4..592cb0e 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 _0xbb1e=['update','remove','emit','hasOwnProperty','exports','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb1e,0x1bd));var _0xebb1=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbb1e[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xebb1('0x0'))['db'][_0xebb1('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xebb1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xebb1('0x3'),'afterDestroy':_0xebb1('0x4')};function emitEvent(_0x13490a){return function(_0x414a02,_0x2d2a7d,_0x446d6c){OpenchannelMessageEvents[_0xebb1('0x5')](_0x13490a+':'+_0x414a02['id'],_0x414a02);OpenchannelMessageEvents[_0xebb1('0x5')](_0x13490a,_0x414a02);_0x446d6c(null);};}for(var e in events){if(events[_0xebb1('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xebb1('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x62f9=['OpenchannelMessage','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x19e407,_0x4a237e){var _0x41ae43=function(_0x439d3c){while(--_0x439d3c){_0x19e407['push'](_0x19e407['shift']());}};_0x41ae43(++_0x4a237e);}(_0x62f9,0x196));var _0x962f=function(_0x2136d5,_0x4b0479){_0x2136d5=_0x2136d5-0x0;var _0x3bee2e=_0x62f9[_0x2136d5];return _0x3bee2e;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require('../../mysqldb')['db'][_0x962f('0x0')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x962f('0x1'),'afterUpdate':_0x962f('0x2'),'afterDestroy':_0x962f('0x3')};function emitEvent(_0x175a7d){return function(_0x5e8885,_0x55fd26,_0xf6002b){OpenchannelMessageEvents[_0x962f('0x4')](_0x175a7d+':'+_0x5e8885['id'],_0x5e8885);OpenchannelMessageEvents[_0x962f('0x4')](_0x175a7d,_0x5e8885);_0xf6002b(null);};}for(var e in events){if(events[_0x962f('0x5')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x962f('0x6')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index fa3a926..563874e 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 _0x073e=['../../config/logger','api','./openchannelMessage.attributes','exports','openchannel_messages','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','then','update','body','catch','error','CmContact','describe','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','POST','Message\x20%d\x20forwarded\x20to\x20%s','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x27eb79,_0xeea111){var _0x51e1c4=function(_0x2c63ad){while(--_0x2c63ad){_0x27eb79['push'](_0x27eb79['shift']());}};_0x51e1c4(++_0xeea111);}(_0x073e,0x181));var _0xe073=function(_0x381476,_0x1c520f){_0x381476=_0x381476-0x0;var _0x5b20fb=_0x073e[_0x381476];return _0x5b20fb;};'use strict';var _=require(_0xe073('0x0'));var util=require(_0xe073('0x1'));var logger=require(_0xe073('0x2'))(_0xe073('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xe073('0x4'));module[_0xe073('0x5')]=function(_0x29444b,_0x5ce161){return _0x29444b['define']('OpenchannelMessage',attributes,{'tableName':_0xe073('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x44092d,_0x1bcaae,_0x3b4fc7){var _0x373bf6=_0x29444b[_0xe073('0x7')];var _0x483f85=_0x44092d[_0xe073('0x8')]({'plain':!![]});if(_0x483f85[_0xe073('0x9')][_0xe073('0xa')]()==='in'||_0x483f85[_0xe073('0x9')]['toLowerCase']()===_0xe073('0xb')&&!_0x483f85[_0xe073('0xc')]&&!_[_0xe073('0xd')](_0x483f85[_0xe073('0xe')])){_0x373bf6[_0xe073('0xf')][_0xe073('0x10')]({'where':{'id':_0x483f85['OpenchannelInteractionId']}})[_0xe073('0x11')](function(_0x56e3f5){if(_0x56e3f5){_0x56e3f5[_0xe073('0x12')]({'lastMsgAt':_0x483f85['createdAt'],'lastMsgDirection':_0x483f85[_0xe073('0x9')]['toLowerCase'](),'lastMsgBody':_0x483f85[_0xe073('0x13')]});}})[_0xe073('0x14')](function(_0x47828d){console[_0xe073('0x15')](_0x47828d);});}if(_0x483f85[_0xe073('0x9')]===_0xe073('0xb')&&!_0x483f85[_0xe073('0xc')]){var _0xfb28f5;_0x373bf6[_0xe073('0x16')][_0xe073('0x17')]()[_0xe073('0x11')](function(_0x512fe8){return _0x373bf6['OpenchannelAccount']['find']({'where':{'id':_0x483f85[_0xe073('0x18')]},'include':[{'model':_0x373bf6[_0xe073('0xf')],'as':_0xe073('0x19'),'where':{'id':_0x483f85[_0xe073('0x1a')]},'limit':0x1,'include':[{'model':_0x373bf6['CmContact'],'as':_0xe073('0x1b'),'attributes':_[_0xe073('0x1c')](_0x512fe8)}]}]});})[_0xe073('0x11')](function(_0x54c10e){_0xfb28f5=_0x54c10e[_0xe073('0x8')]({'plain':!![]});if(_0xfb28f5&&_0xfb28f5[_0xe073('0x1d')]){logger[_0xe073('0x1e')](_0xe073('0x1f'),_0xe073('0x20'),util[_0xe073('0x21')](_0xe073('0x22'),_0x483f85['id'],_0xfb28f5[_0xe073('0x1d')]));if(_0xfb28f5[_0xe073('0x19')]&&_0xfb28f5[_0xe073('0x19')]['length']){_0x483f85[_0xe073('0x23')]=_[_0xe073('0x24')](_0xfb28f5[_0xe073('0x19')][0x0],_0xe073('0x1b'));_0x483f85[_0xe073('0x1b')]=_0xfb28f5[_0xe073('0x19')][0x0]['Contact'];}var _0x1bcaae={'method':_0xe073('0x25'),'uri':encodeURI(_0xfb28f5['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1bcaae['method']){case'GET':_0x1bcaae['qs']=_0x483f85;break;case'POST':_0x1bcaae['body']=_0x483f85;break;}return rp(_0x1bcaae)['then'](function(_0x23537f){logger[_0xe073('0x1e')]('OpenchannelMessage,\x20%s,\x20%s',_0xe073('0x20'),util[_0xe073('0x21')](_0xe073('0x26'),_0x483f85['id'],_0xfb28f5['replyUri']));return _0x44092d[_0xe073('0x12')]({'read':!![]});})['catch'](function(_0x255d91){logger[_0xe073('0x15')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xe073('0x27')](_0x255d91,{'showHidden':![],'depth':null}));_0x3b4fc7();});}else{_0x3b4fc7();}})[_0xe073('0x28')](function(){_0x3b4fc7();});}else{_0x3b4fc7();}}},'charset':_0xe073('0x29'),'collate':_0xe073('0x2a')});}; \ No newline at end of file +var _0x76a3=['openchannel_messages','models','get','direction','toLowerCase','secret','isNil','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','body','error','out','CmContact','describe','OpenchannelAccount','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','omit','method','POST','catch','inspect','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./openchannelMessage.attributes','exports','OpenchannelMessage'];(function(_0x1eda18,_0x2ec45d){var _0x4f6b41=function(_0x5f3cbe){while(--_0x5f3cbe){_0x1eda18['push'](_0x1eda18['shift']());}};_0x4f6b41(++_0x2ec45d);}(_0x76a3,0xf8));var _0x376a=function(_0x54d49e,_0x5d9911){_0x54d49e=_0x54d49e-0x0;var _0x4af0f1=_0x76a3[_0x54d49e];return _0x4af0f1;};'use strict';var _=require(_0x376a('0x0'));var util=require(_0x376a('0x1'));var logger=require(_0x376a('0x2'))(_0x376a('0x3'));var moment=require(_0x376a('0x4'));var BPromise=require(_0x376a('0x5'));var rp=require(_0x376a('0x6'));var attributes=require(_0x376a('0x7'));module[_0x376a('0x8')]=function(_0x17f183,_0x5b2249){return _0x17f183['define'](_0x376a('0x9'),attributes,{'tableName':_0x376a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x139dbc,_0x3cb57e,_0x548516){var _0x3e2261=_0x17f183[_0x376a('0xb')];var _0x249623=_0x139dbc[_0x376a('0xc')]({'plain':!![]});if(_0x249623[_0x376a('0xd')][_0x376a('0xe')]()==='in'||_0x249623['direction']['toLowerCase']()==='out'&&!_0x249623[_0x376a('0xf')]&&!_[_0x376a('0x10')](_0x249623['UserId'])){_0x3e2261[_0x376a('0x11')]['findOne']({'where':{'id':_0x249623[_0x376a('0x12')]}})[_0x376a('0x13')](function(_0x4c643c){if(_0x4c643c){_0x4c643c[_0x376a('0x14')]({'lastMsgAt':_0x249623[_0x376a('0x15')],'lastMsgDirection':_0x249623[_0x376a('0xd')]['toLowerCase'](),'lastMsgBody':_0x249623[_0x376a('0x16')]});}})['catch'](function(_0x33ad40){console[_0x376a('0x17')](_0x33ad40);});}if(_0x249623[_0x376a('0xd')]===_0x376a('0x18')&&!_0x249623[_0x376a('0xf')]){var _0x1747f2;_0x3e2261[_0x376a('0x19')][_0x376a('0x1a')]()['then'](function(_0x4508d8){return _0x3e2261[_0x376a('0x1b')]['find']({'where':{'id':_0x249623[_0x376a('0x1c')]},'include':[{'model':_0x3e2261[_0x376a('0x11')],'as':_0x376a('0x1d'),'where':{'id':_0x249623[_0x376a('0x12')]},'limit':0x1,'include':[{'model':_0x3e2261[_0x376a('0x19')],'as':_0x376a('0x1e'),'attributes':_[_0x376a('0x1f')](_0x4508d8)}]}]});})['then'](function(_0x3ed990){_0x1747f2=_0x3ed990['get']({'plain':!![]});if(_0x1747f2&&_0x1747f2[_0x376a('0x20')]){logger[_0x376a('0x21')](_0x376a('0x22'),_0x376a('0x23'),util[_0x376a('0x24')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x249623['id'],_0x1747f2[_0x376a('0x20')]));if(_0x1747f2[_0x376a('0x1d')]&&_0x1747f2[_0x376a('0x1d')]['length']){_0x249623['Interaction']=_[_0x376a('0x25')](_0x1747f2[_0x376a('0x1d')][0x0],'Contact');_0x249623[_0x376a('0x1e')]=_0x1747f2[_0x376a('0x1d')][0x0][_0x376a('0x1e')];}var _0x3cb57e={'method':'POST','uri':encodeURI(_0x1747f2[_0x376a('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3cb57e[_0x376a('0x26')]){case'GET':_0x3cb57e['qs']=_0x249623;break;case _0x376a('0x27'):_0x3cb57e[_0x376a('0x16')]=_0x249623;break;}return rp(_0x3cb57e)[_0x376a('0x13')](function(_0x1e7116){logger[_0x376a('0x21')](_0x376a('0x22'),'afterCreate',util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x249623['id'],_0x1747f2[_0x376a('0x20')]));return _0x139dbc[_0x376a('0x14')]({'read':!![]});})[_0x376a('0x28')](function(_0x1ace02){logger[_0x376a('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0x376a('0x23'),util[_0x376a('0x29')](_0x1ace02,{'showHidden':![],'depth':null}));_0x548516();});}else{_0x548516();}})['finally'](function(){_0x548516();});}else{_0x548516();}}},'charset':'utf8mb4','collate':_0x376a('0x2a')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index ebee954..e59fe45 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 _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(_0x4b02d5,_0x4d87ed){var _0x3d1bfb=function(_0x30774d){while(--_0x30774d){_0x4b02d5['push'](_0x4b02d5['shift']());}};_0x3d1bfb(++_0x4d87ed);}(_0x55ca,0x126));var _0xa55c=function(_0x17791f,_0x1d16d8){_0x17791f=_0x17791f-0x0;var _0x332dc4=_0x55ca[_0x17791f];return _0x332dc4;};'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 +var _0x3e74=['../../config/logger','../../config/environment','jayson/promise','client','http','socket.io-emitter','./openchannelMessage.socket','register','info','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','OpenchannelMessage,\x20%s,\x20%s','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','then','debug','stringify','catch','lodash','moment','bluebird','randomstring'];(function(_0xf016bc,_0x1aac0e){var _0x94a7de=function(_0x48e704){while(--_0x48e704){_0xf016bc['push'](_0xf016bc['shift']());}};_0x94a7de(++_0x1aac0e);}(_0x3e74,0x175));var _0x43e7=function(_0x5d113a,_0x3d3a51){_0x5d113a=_0x5d113a-0x0;var _0x426c3e=_0x3e74[_0x5d113a];return _0x426c3e;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x43e7('0x4'))('rpc');var config=require(_0x43e7('0x5'));var jayson=require(_0x43e7('0x6'));var client=jayson[_0x43e7('0x7')][_0x43e7('0x8')]({'port':0x232a});var socket=require(_0x43e7('0x9'))({'host':'localhost','port':0x18eb});require(_0x43e7('0xa'))[_0x43e7('0xb')](socket);function respondWithRpcPromise(_0x2ede2d,_0x8528fc,_0x21f491){return new BPromise(function(_0x516b4d,_0x212c6c){return client['request'](_0x2ede2d,_0x21f491)['then'](function(_0x39c8bd){logger[_0x43e7('0xc')]('OpenchannelMessage,\x20%s,\x20%s',_0x8528fc,_0x43e7('0xd'));logger['debug'](_0x43e7('0xe'),_0x8528fc,_0x43e7('0xd'),JSON['stringify'](_0x39c8bd));if(_0x39c8bd[_0x43e7('0xf')]){if(_0x39c8bd[_0x43e7('0xf')][_0x43e7('0x10')]===0x1f4){logger[_0x43e7('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x8528fc,_0x39c8bd['error'][_0x43e7('0x11')]);return _0x212c6c(_0x39c8bd[_0x43e7('0xf')][_0x43e7('0x11')]);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x8528fc,_0x39c8bd[_0x43e7('0xf')][_0x43e7('0x11')]);return _0x516b4d(_0x39c8bd[_0x43e7('0xf')][_0x43e7('0x11')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x8528fc,_0x43e7('0xd'));_0x516b4d(_0x39c8bd[_0x43e7('0x12')][_0x43e7('0x11')]);}})['catch'](function(_0x4b5a6b){logger[_0x43e7('0xf')](_0x43e7('0x13'),_0x8528fc,_0x4b5a6b);_0x212c6c(_0x4b5a6b);});});}exports[_0x43e7('0x14')]=function(_0x140657){var _0x3776f5=this;return new Promise(function(_0x1f24fb,_0x619236){return db[_0x43e7('0x15')][_0x43e7('0x16')](_0x140657[_0x43e7('0x17')],{'raw':_0x140657[_0x43e7('0x18')]?_0x140657[_0x43e7('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x43e7('0x19')](function(_0x3c6625){logger['info'](_0x43e7('0x14'),_0x140657);logger[_0x43e7('0x1a')](_0x43e7('0x14'),_0x140657,JSON[_0x43e7('0x1b')](_0x3c6625));_0x1f24fb(_0x3c6625);})[_0x43e7('0x1c')](function(_0x2f4cb4){logger['error'](_0x43e7('0x14'),_0x2f4cb4['message'],_0x140657);_0x619236(_0x3776f5['error'](0x1f4,_0x2f4cb4[_0x43e7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 9560f58..cad09b5 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 _0xe14b=['removeListener','register','length','./openchannelMessage.events','save','emit'];(function(_0x5a5337,_0x20e15f){var _0x5af3b3=function(_0x542634){while(--_0x542634){_0x5a5337['push'](_0x5a5337['shift']());}};_0x5af3b3(++_0x20e15f);}(_0xe14b,0x93));var _0xbe14=function(_0x3c4c00,_0x25a6ea){_0x3c4c00=_0x3c4c00-0x0;var _0xad1fdb=_0xe14b[_0x3c4c00];return _0xad1fdb;};'use strict';var OpenchannelMessageEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){OpenchannelMessageEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('openchannelMessage:'+_0x196fca,_0x1fe204);OpenchannelMessageEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file +var _0x7579=['save','remove','update','emit','removeListener','openchannelMessage:','./openchannelMessage.events'];(function(_0x57c67d,_0x3b43ff){var _0x216995=function(_0x5a0ae7){while(--_0x5a0ae7){_0x57c67d['push'](_0x57c67d['shift']());}};_0x216995(++_0x3b43ff);}(_0x7579,0x1e2));var _0x9757=function(_0x113ca9,_0xc2e307){_0x113ca9=_0x113ca9-0x0;var _0x109956=_0x7579[_0x113ca9];return _0x109956;};'use strict';var OpenchannelMessageEvents=require(_0x9757('0x0'));var events=[_0x9757('0x1'),_0x9757('0x2'),_0x9757('0x3')];function createListener(_0x2e6afa,_0x304b14){return function(_0x5a7bc9){_0x304b14[_0x9757('0x4')](_0x2e6afa,_0x5a7bc9);};}function removeListener(_0x231ca6,_0xcffaa0){return function(){OpenchannelMessageEvents[_0x9757('0x5')](_0x231ca6,_0xcffaa0);};}exports['register']=function(_0x2aede4){for(var _0x80e411=0x0,_0x4757e9=events['length'];_0x80e411<_0x4757e9;_0x80e411++){var _0x28a14a=events[_0x80e411];var _0x51a1c8=createListener(_0x9757('0x6')+_0x28a14a,_0x2aede4);OpenchannelMessageEvents['on'](_0x28a14a,_0x51a1c8);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index fa84edd..1e6a4df 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 _0x057b=['post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x4358e1,_0x3dc825){var _0xb759a1=function(_0x2055ff){while(--_0x2055ff){_0x4358e1['push'](_0x4358e1['shift']());}};_0xb759a1(++_0x3dc825);}(_0x057b,0x140));var _0xb057=function(_0x1eba2c,_0x43896a){_0x1eba2c=_0x1eba2c-0x0;var _0xa955ca=_0x057b[_0x1eba2c];return _0xa955ca;};'use strict';var multer=require(_0xb057('0x0'));var util=require(_0xb057('0x1'));var path=require(_0xb057('0x2'));var express=require(_0xb057('0x3'));var router=express[_0xb057('0x4')]();var auth=require(_0xb057('0x5'));var interaction=require(_0xb057('0x6'));var config=require(_0xb057('0x7'));var controller=require(_0xb057('0x8'));router[_0xb057('0x9')]('/',auth[_0xb057('0xa')](),controller[_0xb057('0xb')]);router[_0xb057('0x9')](_0xb057('0xc'),auth[_0xb057('0xa')](),controller[_0xb057('0xd')]);router[_0xb057('0x9')](_0xb057('0xe'),auth['isAuthenticated'](),controller[_0xb057('0xf')]);router[_0xb057('0x9')](_0xb057('0x10'),auth['isAuthenticated'](),controller[_0xb057('0x11')]);router[_0xb057('0x9')](_0xb057('0x12'),auth[_0xb057('0xa')](),controller[_0xb057('0x13')]);router['get'](_0xb057('0x14'),auth[_0xb057('0xa')](),controller['getAgents']);router['post']('/',auth[_0xb057('0xa')](),controller['create']);router[_0xb057('0x15')]('/:id/teams',auth[_0xb057('0xa')](),controller[_0xb057('0x16')]);router[_0xb057('0x15')](_0xb057('0x14'),auth[_0xb057('0xa')](),controller[_0xb057('0x17')]);router[_0xb057('0x18')](_0xb057('0xe'),auth[_0xb057('0xa')](),controller[_0xb057('0x19')]);router[_0xb057('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0xb057('0x1b')]);router[_0xb057('0x1a')](_0xb057('0x12'),auth[_0xb057('0xa')](),controller[_0xb057('0x1c')]);router[_0xb057('0x1a')]('/:id/users',auth[_0xb057('0xa')](),controller[_0xb057('0x1d')]);module[_0xb057('0x1e')]=router; \ No newline at end of file +var _0xa3e9=['util','path','Router','../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa3e9,0x194));var _0x9a3e=function(_0xdb9d7,_0x138db2){_0xdb9d7=_0xdb9d7-0x0;var _0x11d81f=_0xa3e9[_0xdb9d7];return _0x11d81f;};'use strict';var multer=require(_0x9a3e('0x0'));var util=require(_0x9a3e('0x1'));var path=require(_0x9a3e('0x2'));var express=require('express');var router=express[_0x9a3e('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9a3e('0x4'));var controller=require(_0x9a3e('0x5'));router[_0x9a3e('0x6')]('/',auth['isAuthenticated'](),controller[_0x9a3e('0x7')]);router[_0x9a3e('0x6')](_0x9a3e('0x8'),auth[_0x9a3e('0x9')](),controller[_0x9a3e('0xa')]);router[_0x9a3e('0x6')](_0x9a3e('0xb'),auth['isAuthenticated'](),controller[_0x9a3e('0xc')]);router[_0x9a3e('0x6')](_0x9a3e('0xd'),auth[_0x9a3e('0x9')](),controller['getMembers']);router[_0x9a3e('0x6')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0x9a3e('0x6')](_0x9a3e('0xe'),auth[_0x9a3e('0x9')](),controller[_0x9a3e('0xf')]);router[_0x9a3e('0x10')]('/',auth['isAuthenticated'](),controller[_0x9a3e('0x11')]);router[_0x9a3e('0x10')](_0x9a3e('0x12'),auth[_0x9a3e('0x9')](),controller[_0x9a3e('0x13')]);router[_0x9a3e('0x10')]('/:id/users',auth[_0x9a3e('0x9')](),controller[_0x9a3e('0x14')]);router[_0x9a3e('0x15')](_0x9a3e('0xb'),auth[_0x9a3e('0x9')](),controller[_0x9a3e('0x16')]);router[_0x9a3e('0x17')]('/:id',auth[_0x9a3e('0x9')](),controller[_0x9a3e('0x18')]);router['delete']('/:id/teams',auth[_0x9a3e('0x9')](),controller['removeTeams']);router[_0x9a3e('0x17')](_0x9a3e('0xe'),auth[_0x9a3e('0x9')](),controller[_0x9a3e('0x19')]);module[_0x9a3e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 5e85d39..a90fc06 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 _0xefef=['beepall','roundrobin','sequelize','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x57ed06,_0x589749){var _0x2e1d10=function(_0x208f2a){while(--_0x208f2a){_0x57ed06['push'](_0x57ed06['shift']());}};_0x2e1d10(++_0x589749);}(_0xefef,0x8a));var _0xfefe=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0xefef[_0x1e2321];return _0x1d346d;};'use strict';var Sequelize=require(_0xfefe('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xfefe('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfefe('0x2')]},'timeout':{'type':Sequelize[_0xfefe('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfefe('0x4')](_0xfefe('0x5'),_0xfefe('0x6'),_0xfefe('0x7'))}}; \ No newline at end of file +var _0x557d=['exports','STRING','name','INTEGER','rrmemory','beepall','roundrobin','sequelize'];(function(_0x52c399,_0x30bc7c){var _0x3a53a0=function(_0x59dbdf){while(--_0x59dbdf){_0x52c399['push'](_0x52c399['shift']());}};_0x3a53a0(++_0x30bc7c);}(_0x557d,0x117));var _0xd557=function(_0x5b09c3,_0x468a95){_0x5b09c3=_0x5b09c3-0x0;var _0x263073=_0x557d[_0x5b09c3];return _0x263073;};'use strict';var Sequelize=require(_0xd557('0x0'));module[_0xd557('0x1')]={'name':{'type':Sequelize[_0xd557('0x2')],'unique':_0xd557('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd557('0x2')]},'timeout':{'type':Sequelize[_0xd557('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xd557('0x5'),_0xd557('0x6'),_0xd557('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 388b432..dbfe28b 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 _0xf67f=['show','params','options','find','create','body','describe','getMembers','findOne','get','UserOpenchannelQueue','nolimit','pick','OpenchannelQueueId','User','findAndCountAll','UserId','agent','createdAt','format','openchannelPause','Team','order','getTeams','addTeams','Agents','union','penalty','removeTeams','ids','removeAgents','addAgents','omit','spread','userOpenchannelQueue:save','emit','userOpenchannelQueue:remove','getAgents','request-promise','moment','bluebird','util','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','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','OpenchannelQueue','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','sort','add','day','merge','filter','where','map','includeAll','include','findAll','rows','catch'];(function(_0x4c67a0,_0xd23c09){var _0x22c2f0=function(_0x754326){while(--_0x754326){_0x4c67a0['push'](_0x4c67a0['shift']());}};_0x22c2f0(++_0xd23c09);}(_0xf67f,0x8d));var _0xff67=function(_0x55e059,_0x2df2c5){_0x55e059=_0x55e059-0x0;var _0x1e6bb7=_0xf67f[_0x55e059];return _0x1e6bb7;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xff67('0x0'));var moment=require(_0xff67('0x1'));var BPromise=require(_0xff67('0x2'));var Mustache=require('mustache');var util=require(_0xff67('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xff67('0x4'));var ejs=require(_0xff67('0x5'));var fs=require('fs');var _=require(_0xff67('0x6'));var squel=require(_0xff67('0x7'));var crypto=require(_0xff67('0x8'));var jsforce=require(_0xff67('0x9'));var deskjs=require(_0xff67('0xa'));var toCsv=require(_0xff67('0x4'));var querystring=require('querystring');var Papa=require(_0xff67('0xb'));var qs=require(_0xff67('0xc'));var logger=require(_0xff67('0xd'))(_0xff67('0xe'));var utils=require(_0xff67('0xf'));var config=require(_0xff67('0x10'));var db=require(_0xff67('0x11'))['db'];var socket=require(_0xff67('0x12'))({'host':_0xff67('0x13'),'port':0x18eb});require('./openchannelQueue.socket')[_0xff67('0x14')](socket);function respondWithStatusCode(_0x2ff777,_0x5bb8f5){_0x5bb8f5=_0x5bb8f5||0xcc;return function(_0x2676fb){if(_0x2676fb){return _0x2ff777['sendStatus'](_0x5bb8f5);}return _0x2ff777[_0xff67('0x15')](_0x5bb8f5)[_0xff67('0x16')]();};}function respondWithResult(_0x31d0c3,_0x476caa){_0x476caa=_0x476caa||0xc8;return function(_0x17d7fe){if(_0x17d7fe){return _0x31d0c3[_0xff67('0x15')](_0x476caa)['json'](_0x17d7fe);}};}function respondWithFilteredResult(_0x542af9,_0xd111e5){return function(_0x4378ea){if(_0x4378ea){var _0x471576=_0x4378ea[_0xff67('0x17')],_0x17fe1a=_0xd111e5['offset'],_0x34c8c9=_0xd111e5[_0xff67('0x18')]+_0xd111e5[_0xff67('0x19')],_0x59ff9c;if(_0x34c8c9>=_0x471576){_0x34c8c9=_0x471576;_0x59ff9c=0xc8;}else{_0x59ff9c=0xce;}_0x542af9[_0xff67('0x15')](_0x59ff9c);return _0x542af9[_0xff67('0x1a')](_0xff67('0x1b'),_0x17fe1a+'-'+_0x34c8c9+'/'+_0x471576)[_0xff67('0x1c')](_0x4378ea);}return null;};}function patchUpdates(_0xc99647){return function(_0x596a93){try{jsonpatch[_0xff67('0x1d')](_0x596a93,_0xc99647,!![]);}catch(_0x282cf3){return BPromise[_0xff67('0x1e')](_0x282cf3);}return _0x596a93[_0xff67('0x1f')]();};}function saveUpdates(_0x178308,_0x2cf95b){return function(_0x57f299){if(_0x57f299){return _0x57f299[_0xff67('0x20')](_0x178308)[_0xff67('0x21')](function(_0x4a7db2){return _0x4a7db2;});}return null;};}function removeEntity(_0x518ee7,_0x30cdcf){return function(_0x44d37f){if(_0x44d37f){return _0x44d37f[_0xff67('0x22')]()[_0xff67('0x21')](function(){_0x518ee7[_0xff67('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16594b,_0x25dd92){return function(_0x5959ce){if(!_0x5959ce){_0x16594b[_0xff67('0x23')](0x194);}return _0x5959ce;};}function handleError(_0x5c2db2,_0x3a3460){_0x3a3460=_0x3a3460||0x1f4;return function(_0x469a1a){logger[_0xff67('0x24')](_0x469a1a['stack']);if(_0x469a1a[_0xff67('0x25')]){delete _0x469a1a['name'];}_0x5c2db2[_0xff67('0x15')](_0x3a3460)[_0xff67('0x26')](_0x469a1a);};}exports[_0xff67('0x27')]=function(_0x4d1b59,_0x1b4f8b){var _0x151bef={},_0x1b5bc1={},_0x4d4a7e={'count':0x0,'rows':[]};var _0x1002bb=db[_0xff67('0x28')][_0xff67('0x29')];_0x1b5bc1[_0xff67('0x2a')]=_[_0xff67('0x2b')](_0x1002bb);var _0x291326={'dateStart':_0x4d1b59[_0xff67('0x2c')][_0xff67('0x2d')],'dateEnd':_0x4d1b59[_0xff67('0x2c')][_0xff67('0x2e')]};delete _0x4d1b59[_0xff67('0x2c')][_0xff67('0x2d')];delete _0x4d1b59[_0xff67('0x2c')][_0xff67('0x2e')];_0x1b5bc1[_0xff67('0x2c')]=_[_0xff67('0x2b')](_0x4d1b59['query']);_0x1b5bc1[_0xff67('0x2f')]=_['intersection'](_0x1b5bc1[_0xff67('0x2a')],_0x1b5bc1[_0xff67('0x2c')]);_0x151bef['attributes']=_[_0xff67('0x30')](_0x1b5bc1[_0xff67('0x2a')],qs[_0xff67('0x31')](_0x4d1b59[_0xff67('0x2c')][_0xff67('0x31')]));_0x151bef[_0xff67('0x32')]=_0x151bef[_0xff67('0x32')][_0xff67('0x33')]?_0x151bef[_0xff67('0x32')]:_0x1b5bc1[_0xff67('0x2a')];if(!_0x4d1b59[_0xff67('0x2c')][_0xff67('0x34')]('nolimit')){_0x151bef['limit']=qs[_0xff67('0x19')](_0x4d1b59[_0xff67('0x2c')][_0xff67('0x19')]);_0x151bef[_0xff67('0x18')]=qs[_0xff67('0x18')](_0x4d1b59[_0xff67('0x2c')][_0xff67('0x18')]);}_0x151bef['order']=qs[_0xff67('0x35')](_0x4d1b59[_0xff67('0x2c')][_0xff67('0x35')]);_0x151bef['where']=qs[_0xff67('0x2f')](_['pick'](_0x4d1b59[_0xff67('0x2c')],_0x1b5bc1['filters']));if(_0x291326['dateStart']){if(_0x291326[_0xff67('0x2e')]){_0x291326['dateEnd']=moment(_0x291326['dateEnd'])['add'](0x1,'day');}else{_0x291326[_0xff67('0x2e')]=moment(_0x291326[_0xff67('0x2d')])[_0xff67('0x36')](0x1,_0xff67('0x37'));}_[_0xff67('0x38')](_0x151bef['where'],{'createdAt':{'$gte':_0x291326[_0xff67('0x2d')],'$lte':_0x291326['dateEnd']}});}if(_0x4d1b59['query'][_0xff67('0x39')]){_0x151bef[_0xff67('0x3a')]=_[_0xff67('0x38')](_0x151bef['where'],{'$or':_[_0xff67('0x3b')](_0x151bef[_0xff67('0x32')],function(_0x5757d0){var _0x3c32db={};_0x3c32db[_0x5757d0]={'$like':'%'+_0x4d1b59['query'][_0xff67('0x39')]+'%'};return _0x3c32db;})});}_0x151bef=_[_0xff67('0x38')]({},_0x151bef,_0x4d1b59['options']);var _0x433e1c={'where':_0x151bef[_0xff67('0x3a')]};return db['OpenchannelQueue'][_0xff67('0x17')](_0x433e1c)[_0xff67('0x21')](function(_0x2b47b4){_0x4d4a7e[_0xff67('0x17')]=_0x2b47b4;if(_0x4d1b59[_0xff67('0x2c')][_0xff67('0x3c')]){_0x151bef[_0xff67('0x3d')]=[{'all':!![]}];}return db[_0xff67('0x28')][_0xff67('0x3e')](_0x151bef);})[_0xff67('0x21')](function(_0x44e3e6){_0x4d4a7e[_0xff67('0x3f')]=_0x44e3e6;return _0x4d4a7e;})[_0xff67('0x21')](respondWithFilteredResult(_0x1b4f8b,_0x151bef))[_0xff67('0x40')](handleError(_0x1b4f8b,null));};exports[_0xff67('0x41')]=function(_0x1d51a6,_0x5eb379){var _0x47d976={'raw':!![],'where':{'id':_0x1d51a6[_0xff67('0x42')]['id']}},_0x12e8e9={};_0x12e8e9[_0xff67('0x2a')]=_[_0xff67('0x2b')](db[_0xff67('0x28')][_0xff67('0x29')]);_0x12e8e9[_0xff67('0x2c')]=_[_0xff67('0x2b')](_0x1d51a6[_0xff67('0x2c')]);_0x12e8e9[_0xff67('0x2f')]=_[_0xff67('0x30')](_0x12e8e9['model'],_0x12e8e9[_0xff67('0x2c')]);_0x47d976[_0xff67('0x32')]=_['intersection'](_0x12e8e9[_0xff67('0x2a')],qs[_0xff67('0x31')](_0x1d51a6[_0xff67('0x2c')][_0xff67('0x31')]));_0x47d976[_0xff67('0x32')]=_0x47d976['attributes'][_0xff67('0x33')]?_0x47d976[_0xff67('0x32')]:_0x12e8e9[_0xff67('0x2a')];if(_0x1d51a6[_0xff67('0x2c')]['includeAll']){_0x47d976[_0xff67('0x3d')]=[{'all':!![]}];}_0x47d976=_[_0xff67('0x38')]({},_0x47d976,_0x1d51a6[_0xff67('0x43')]);return db[_0xff67('0x28')][_0xff67('0x44')](_0x47d976)['then'](handleEntityNotFound(_0x5eb379,null))[_0xff67('0x21')](respondWithResult(_0x5eb379,null))[_0xff67('0x40')](handleError(_0x5eb379,null));};exports[_0xff67('0x45')]=function(_0x41ed56,_0x58a21d){return db['OpenchannelQueue'][_0xff67('0x45')](_0x41ed56[_0xff67('0x46')],{})[_0xff67('0x21')](respondWithResult(_0x58a21d,0xc9))[_0xff67('0x40')](handleError(_0x58a21d,null));};exports[_0xff67('0x20')]=function(_0x4eb99d,_0x1f3ffd){if(_0x4eb99d[_0xff67('0x46')]['id']){delete _0x4eb99d[_0xff67('0x46')]['id'];}return db['OpenchannelQueue'][_0xff67('0x44')]({'where':{'id':_0x4eb99d[_0xff67('0x42')]['id']}})[_0xff67('0x21')](handleEntityNotFound(_0x1f3ffd,null))[_0xff67('0x21')](saveUpdates(_0x4eb99d['body'],null))[_0xff67('0x21')](respondWithResult(_0x1f3ffd,null))[_0xff67('0x40')](handleError(_0x1f3ffd,null));};exports['destroy']=function(_0x1e913a,_0x1eddbc){return db[_0xff67('0x28')]['find']({'where':{'id':_0x1e913a['params']['id']}})[_0xff67('0x21')](handleEntityNotFound(_0x1eddbc,null))[_0xff67('0x21')](removeEntity(_0x1eddbc,null))[_0xff67('0x40')](handleError(_0x1eddbc,null));};exports[_0xff67('0x47')]=function(_0x27b76a,_0x34b40c){return db[_0xff67('0x28')]['describe']()[_0xff67('0x21')](respondWithResult(_0x34b40c,null))[_0xff67('0x40')](handleError(_0x34b40c,null));};exports[_0xff67('0x48')]=function(_0x4fc72a,_0xe6d6ef,_0x2741c9){var _0xeeed17={'raw':!![],'where':{}},_0x190e51={},_0x216256;return db['OpenchannelQueue'][_0xff67('0x49')]({'where':{'id':_0x4fc72a[_0xff67('0x42')]['id']}})['then'](handleEntityNotFound(_0xe6d6ef,null))['then'](function(_0xcbbb3f){if(_0xcbbb3f){_0x216256=_0xcbbb3f[_0xff67('0x4a')]({'plain':!![]});_0x190e51[_0xff67('0x2a')]=_[_0xff67('0x2b')](db[_0xff67('0x4b')][_0xff67('0x29')]);_0x190e51[_0xff67('0x2c')]=_[_0xff67('0x2b')](_0x4fc72a[_0xff67('0x2c')]);_0x190e51['filters']=_[_0xff67('0x30')](_0x190e51['model'],_0x190e51[_0xff67('0x2c')]);_0xeeed17[_0xff67('0x32')]=_[_0xff67('0x30')](_0x190e51[_0xff67('0x2a')],qs['fields'](_0x4fc72a[_0xff67('0x2c')]['fields']));_0xeeed17['attributes']=_0xeeed17[_0xff67('0x32')][_0xff67('0x33')]?_0xeeed17[_0xff67('0x32')]:_0x190e51[_0xff67('0x2a')];if(!_0x4fc72a[_0xff67('0x2c')][_0xff67('0x34')](_0xff67('0x4c'))){_0xeeed17[_0xff67('0x19')]=qs['limit'](_0x4fc72a[_0xff67('0x2c')]['limit']);_0xeeed17[_0xff67('0x18')]=qs[_0xff67('0x18')](_0x4fc72a[_0xff67('0x2c')]['offset']);}_0xeeed17['order']=qs[_0xff67('0x35')](_0x4fc72a[_0xff67('0x2c')]['sort']);_0xeeed17['where']=qs[_0xff67('0x2f')](_[_0xff67('0x4d')](_0x4fc72a['query'],_0x190e51[_0xff67('0x2f')]));_0xeeed17[_0xff67('0x3a')][_0xff67('0x4e')]=_0xcbbb3f['id'];if(_0x4fc72a[_0xff67('0x2c')][_0xff67('0x39')]){_0xeeed17[_0xff67('0x3a')]=_['merge'](_0xeeed17[_0xff67('0x3a')],{'$or':_[_0xff67('0x3b')](_0xeeed17[_0xff67('0x32')],function(_0x11ecd2){var _0x1a6f71={};_0x1a6f71[_0x11ecd2]={'$like':'%'+_0x4fc72a[_0xff67('0x2c')][_0xff67('0x39')]+'%'};return _0x1a6f71;})});}_0xeeed17=_[_0xff67('0x38')]({},_0xeeed17,_0x4fc72a[_0xff67('0x43')]);return db[_0xff67('0x4b')]['findAll'](_0xeeed17);}})['then'](function(_0x201c47){if(_0x201c47){return db[_0xff67('0x4f')][_0xff67('0x50')]({'where':{'id':_[_0xff67('0x3b')](_0x201c47,_0xff67('0x51')),'role':_0xff67('0x52')},'attributes':['id',_0xff67('0x25'),'openchannelPause','updatedAt',_0xff67('0x53')]});}})[_0xff67('0x21')](function(_0x231888){if(_0x231888){return{'count':_0x231888[_0xff67('0x17')],'rows':_[_0xff67('0x3b')](_0x231888[_0xff67('0x3f')],function(_0x24287c){return{'membername':_0x24287c[_0xff67('0x25')],'UserId':_0x24287c['id'],'queue_name':_0x216256[_0xff67('0x25')],'OpenchannelQueueId':_0x216256['id'],'interface':util[_0xff67('0x54')]('%s/%s','SIP',_0x24287c[_0xff67('0x25')]),'penalty':0x0,'paused':_0x24287c[_0xff67('0x55')],'createdAt':_0x24287c['createdAt'],'updatedAt':_0x24287c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xff67('0x21')](respondWithFilteredResult(_0xe6d6ef,_0xeeed17))[_0xff67('0x40')](handleError(_0xe6d6ef,null));};exports['getTeams']=function(_0x4a45ac,_0x1be698,_0x4dab47){var _0x4eef57={};var _0x4280fb={};var _0x262066;var _0x20276d;return db[_0xff67('0x28')]['findOne']({'where':{'id':_0x4a45ac['params']['id']}})['then'](handleEntityNotFound(_0x1be698,null))['then'](function(_0x4e44d8){if(_0x4e44d8){_0x262066=_0x4e44d8;_0x4280fb[_0xff67('0x2a')]=_[_0xff67('0x2b')](db[_0xff67('0x56')][_0xff67('0x29')]);_0x4280fb[_0xff67('0x2c')]=_[_0xff67('0x2b')](_0x4a45ac['query']);_0x4280fb[_0xff67('0x2f')]=_['intersection'](_0x4280fb[_0xff67('0x2a')],_0x4280fb[_0xff67('0x2c')]);_0x4eef57[_0xff67('0x32')]=_[_0xff67('0x30')](_0x4280fb[_0xff67('0x2a')],qs[_0xff67('0x31')](_0x4a45ac[_0xff67('0x2c')][_0xff67('0x31')]));_0x4eef57['attributes']=_0x4eef57[_0xff67('0x32')][_0xff67('0x33')]?_0x4eef57[_0xff67('0x32')]:_0x4280fb['model'];_0x4eef57[_0xff67('0x57')]=qs[_0xff67('0x35')](_0x4a45ac['query'][_0xff67('0x35')]);_0x4eef57[_0xff67('0x3a')]=qs[_0xff67('0x2f')](_['pick'](_0x4a45ac['query'],_0x4280fb[_0xff67('0x2f')]));if(_0x4a45ac[_0xff67('0x2c')][_0xff67('0x39')]){_0x4eef57[_0xff67('0x3a')]=_['merge'](_0x4eef57[_0xff67('0x3a')],{'$or':_[_0xff67('0x3b')](_0x4eef57[_0xff67('0x32')],function(_0x1bd4bd){var _0xd001b2={};_0xd001b2[_0x1bd4bd]={'$like':'%'+_0x4a45ac[_0xff67('0x2c')]['filter']+'%'};return _0xd001b2;})});}_0x4eef57=_[_0xff67('0x38')]({},_0x4eef57,_0x4a45ac['options']);return _0x262066[_0xff67('0x58')](_0x4eef57);}})[_0xff67('0x21')](function(_0x27e5fd){if(_0x27e5fd){_0x20276d=_0x27e5fd[_0xff67('0x33')];if(!_0x4a45ac[_0xff67('0x2c')]['hasOwnProperty'](_0xff67('0x4c'))){_0x4eef57[_0xff67('0x19')]=qs[_0xff67('0x19')](_0x4a45ac[_0xff67('0x2c')][_0xff67('0x19')]);_0x4eef57[_0xff67('0x18')]=qs[_0xff67('0x18')](_0x4a45ac[_0xff67('0x2c')]['offset']);}return _0x262066[_0xff67('0x58')](_0x4eef57);}})['then'](function(_0x3d3a6d){if(_0x3d3a6d){return _0x3d3a6d?{'count':_0x20276d,'rows':_0x3d3a6d}:null;}})['then'](respondWithResult(_0x1be698,null))[_0xff67('0x40')](handleError(_0x1be698,null));};exports[_0xff67('0x59')]=function(_0x137fab,_0x236bdc,_0x3a96d5){var _0x2d94de=[];var _0x26acf5;return db[_0xff67('0x56')][_0xff67('0x3e')]({'where':{'id':_0x137fab[_0xff67('0x46')]['ids']},'attributes':['id'],'include':[{'model':db[_0xff67('0x4f')],'as':_0xff67('0x5a'),'attributes':['id'],'raw':!![]}]})[_0xff67('0x21')](function(_0x2206eb){if(_0x2206eb){for(var _0x373a91=0x0;_0x373a91<_0x2206eb['length'];_0x373a91+=0x1){for(var _0x1b8d8b=0x0;_0x1b8d8b<_0x2206eb[_0x373a91]['Agents']['length'];_0x1b8d8b+=0x1){_0x2d94de=_[_0xff67('0x5b')](_0x2d94de,[_0x2206eb[_0x373a91][_0xff67('0x5a')][_0x1b8d8b]['id']]);}}return _0x2d94de;}})[_0xff67('0x21')](function(_0xe9dea3){if(_0xe9dea3){return db['OpenchannelQueue'][_0xff67('0x44')]({'where':{'id':_0x137fab[_0xff67('0x42')]['id']}});}})[_0xff67('0x21')](function(_0x5bfff7){if(_0x5bfff7){_0x26acf5=_0x5bfff7;return _0x26acf5['addAgents'](_0x2d94de,{'penalty':_0x137fab[_0xff67('0x46')][_0xff67('0x5c')]});}})[_0xff67('0x21')](function(_0x59d76b){if(_0x59d76b){return _0x26acf5[_0xff67('0x59')](_0x137fab[_0xff67('0x46')]['ids']);}})[_0xff67('0x21')](handleEntityNotFound(_0x236bdc,null))[_0xff67('0x21')](respondWithStatusCode(_0x236bdc,null))[_0xff67('0x40')](handleError(_0x236bdc,null));};exports[_0xff67('0x5d')]=function(_0x290633,_0x284395,_0x1f4b38){var _0x12a2ae=[];var _0x5ebb4a;return db[_0xff67('0x56')][_0xff67('0x3e')]({'where':{'id':_0x290633[_0xff67('0x2c')][_0xff67('0x5e')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xff67('0x5a'),'attributes':['id'],'raw':!![]}]})[_0xff67('0x21')](function(_0x5c8399){if(_0x5c8399){for(var _0x2df2b5=0x0;_0x2df2b5<_0x5c8399['length'];_0x2df2b5+=0x1){for(var _0x1c4e1b=0x0;_0x1c4e1b<_0x5c8399[_0x2df2b5][_0xff67('0x5a')][_0xff67('0x33')];_0x1c4e1b+=0x1){_0x12a2ae=_[_0xff67('0x5b')](_0x12a2ae,[_0x5c8399[_0x2df2b5]['Agents'][_0x1c4e1b]['id']]);}}return _0x12a2ae;}})[_0xff67('0x21')](function(_0x485627){if(_0x485627){return db[_0xff67('0x28')][_0xff67('0x44')]({'where':{'id':_0x290633[_0xff67('0x42')]['id']}});}})[_0xff67('0x21')](function(_0x58a99f){if(_0x58a99f){_0x5ebb4a=_0x58a99f;return _0x5ebb4a[_0xff67('0x5f')](_0x12a2ae);}})[_0xff67('0x21')](function(_0x191dbd){if(_0x5ebb4a){return _0x5ebb4a[_0xff67('0x5d')](_0x290633[_0xff67('0x2c')][_0xff67('0x5e')]);}})['then'](handleEntityNotFound(_0x284395,null))[_0xff67('0x21')](respondWithStatusCode(_0x284395,null))['catch'](handleError(_0x284395,null));};exports[_0xff67('0x60')]=function(_0x1570e2,_0x20b435,_0xe24e2b){return db['OpenchannelQueue'][_0xff67('0x44')]({'where':{'id':_0x1570e2[_0xff67('0x42')]['id']}})[_0xff67('0x21')](handleEntityNotFound(_0x20b435,null))[_0xff67('0x21')](function(_0x3678f1){if(_0x3678f1){return _0x3678f1[_0xff67('0x60')](_0x1570e2[_0xff67('0x46')][_0xff67('0x5e')],_[_0xff67('0x61')](_0x1570e2[_0xff67('0x46')],[_0xff67('0x5e'),'id'])||{})[_0xff67('0x62')](function(_0x5a2fbf){for(var _0x35d245=0x0;_0x35d245<_0x1570e2['body']['ids']['length'];_0x35d245+=0x1){socket['emit'](_0xff67('0x63'),{'UserId':_0x1570e2['body'][_0xff67('0x5e')][_0x35d245],'OpenchannelQueueId':_0x1570e2[_0xff67('0x42')]['id']});}return _0x5a2fbf;});}})[_0xff67('0x21')](respondWithResult(_0x20b435,null))[_0xff67('0x40')](handleError(_0x20b435,null));};exports[_0xff67('0x5f')]=function(_0x4b8154,_0x5d5635,_0x534d8c){var _0x5152f6;return db[_0xff67('0x28')][_0xff67('0x44')]({'where':{'id':_0x4b8154[_0xff67('0x42')]['id']}})[_0xff67('0x21')](handleEntityNotFound(_0x5d5635,null))['then'](function(_0x50051a){if(_0x50051a){return _0x50051a[_0xff67('0x5f')](_0x4b8154[_0xff67('0x2c')]['ids'])[_0xff67('0x21')](function(_0x126229){if(_['isArray'](_0x4b8154[_0xff67('0x2c')][_0xff67('0x5e')])){for(var _0x163615=0x0;_0x163615<_0x4b8154[_0xff67('0x2c')][_0xff67('0x5e')]['length'];_0x163615+=0x1){socket[_0xff67('0x64')](_0xff67('0x65'),{'UserId':_0x4b8154[_0xff67('0x2c')]['ids'][_0x163615],'OpenchannelQueueId':_0x4b8154['params']['id']});}}else{socket['emit'](_0xff67('0x65'),{'UserId':_0x4b8154[_0xff67('0x2c')][_0xff67('0x5e')],'OpenchannelQueueId':_0x4b8154['params']['id']});}});}})[_0xff67('0x21')](respondWithStatusCode(_0x5d5635,null))[_0xff67('0x40')](handleError(_0x5d5635,null));};exports['getAgents']=function(_0x435d6f,_0xf82d3e,_0x2e5d34){var _0x23297a={};var _0x27a65f={};var _0x524a1f;var _0x506ab5;return db[_0xff67('0x28')][_0xff67('0x49')]({'where':{'id':_0x435d6f[_0xff67('0x42')]['id']}})[_0xff67('0x21')](handleEntityNotFound(_0xf82d3e,null))[_0xff67('0x21')](function(_0x34a865){if(_0x34a865){_0x524a1f=_0x34a865;_0x27a65f['model']=_['keys'](db[_0xff67('0x4f')][_0xff67('0x29')]);_0x27a65f[_0xff67('0x2c')]=_[_0xff67('0x2b')](_0x435d6f['query']);_0x27a65f[_0xff67('0x2f')]=_['intersection'](_0x27a65f[_0xff67('0x2a')],_0x27a65f[_0xff67('0x2c')]);_0x23297a[_0xff67('0x32')]=_[_0xff67('0x30')](_0x27a65f[_0xff67('0x2a')],qs[_0xff67('0x31')](_0x435d6f[_0xff67('0x2c')]['fields']));_0x23297a['attributes']=_0x23297a[_0xff67('0x32')][_0xff67('0x33')]?_0x23297a[_0xff67('0x32')]:_0x27a65f['model'];_0x23297a[_0xff67('0x57')]=qs[_0xff67('0x35')](_0x435d6f[_0xff67('0x2c')][_0xff67('0x35')]);_0x23297a[_0xff67('0x3a')]=qs['filters'](_[_0xff67('0x4d')](_0x435d6f[_0xff67('0x2c')],_0x27a65f[_0xff67('0x2f')]));if(_0x435d6f[_0xff67('0x2c')][_0xff67('0x39')]){_0x23297a[_0xff67('0x3a')]=_['merge'](_0x23297a[_0xff67('0x3a')],{'$or':_[_0xff67('0x3b')](_0x23297a[_0xff67('0x32')],function(_0x328719){var _0x1bb7de={};_0x1bb7de[_0x328719]={'$like':'%'+_0x435d6f[_0xff67('0x2c')][_0xff67('0x39')]+'%'};return _0x1bb7de;})});}_0x23297a=_['merge']({},_0x23297a,_0x435d6f[_0xff67('0x43')]);return _0x524a1f[_0xff67('0x66')](_0x23297a);}})[_0xff67('0x21')](function(_0x4e670b){if(_0x4e670b){_0x506ab5=_0x4e670b[_0xff67('0x33')];if(!_0x435d6f[_0xff67('0x2c')]['hasOwnProperty'](_0xff67('0x4c'))){_0x23297a[_0xff67('0x19')]=qs[_0xff67('0x19')](_0x435d6f[_0xff67('0x2c')]['limit']);_0x23297a[_0xff67('0x18')]=qs['offset'](_0x435d6f[_0xff67('0x2c')][_0xff67('0x18')]);}return _0x524a1f[_0xff67('0x66')](_0x23297a);}})[_0xff67('0x21')](function(_0x1a9544){if(_0x1a9544){return _0x1a9544?{'count':_0x506ab5,'rows':_0x1a9544}:null;}})[_0xff67('0x21')](respondWithResult(_0xf82d3e,null))[_0xff67('0x40')](handleError(_0xf82d3e,null));}; \ No newline at end of file +var _0xdf25=['sort','where','add','day','filter','merge','map','options','OpenchannelQueue','include','findAll','catch','params','find','create','body','describe','getMembers','get','UserOpenchannelQueue','nolimit','order','pick','findAndCountAll','UserId','openchannelPause','updatedAt','format','%s/%s','SIP','getTeams','findOne','Team','ids','User','Agents','union','penalty','addTeams','removeAgents','removeTeams','addAgents','omit','spread','emit','userOpenchannelQueue:save','isArray','userOpenchannelQueue:remove','getAgents','fast-json-patch','request-promise','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','socket.io-emitter','localhost','./openchannelQueue.socket','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x195c38,_0x1d9c15){var _0x4fea5f=function(_0xa5114d){while(--_0xa5114d){_0x195c38['push'](_0x195c38['shift']());}};_0x4fea5f(++_0x1d9c15);}(_0xdf25,0x1c5));var _0x5df2=function(_0x12afd8,_0x5355c2){_0x12afd8=_0x12afd8-0x0;var _0xa255c8=_0xdf25[_0x12afd8];return _0xa255c8;};'use strict';var jsonpatch=require(_0x5df2('0x0'));var rp=require(_0x5df2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5df2('0x2'));var util=require(_0x5df2('0x3'));var path=require(_0x5df2('0x4'));var sox=require(_0x5df2('0x5'));var csv=require(_0x5df2('0x6'));var ejs=require(_0x5df2('0x7'));var fs=require('fs');var _=require(_0x5df2('0x8'));var squel=require(_0x5df2('0x9'));var crypto=require('crypto');var jsforce=require(_0x5df2('0xa'));var deskjs=require(_0x5df2('0xb'));var toCsv=require(_0x5df2('0x6'));var querystring=require(_0x5df2('0xc'));var Papa=require(_0x5df2('0xd'));var qs=require(_0x5df2('0xe'));var logger=require(_0x5df2('0xf'))(_0x5df2('0x10'));var utils=require(_0x5df2('0x11'));var config=require(_0x5df2('0x12'));var db=require(_0x5df2('0x13'))['db'];var socket=require(_0x5df2('0x14'))({'host':_0x5df2('0x15'),'port':0x18eb});require(_0x5df2('0x16'))['register'](socket);function respondWithStatusCode(_0x5dedda,_0x99b9f4){_0x99b9f4=_0x99b9f4||0xcc;return function(_0x2edf3a){if(_0x2edf3a){return _0x5dedda['sendStatus'](_0x99b9f4);}return _0x5dedda['status'](_0x99b9f4)[_0x5df2('0x17')]();};}function respondWithResult(_0x1ecc56,_0x14140c){_0x14140c=_0x14140c||0xc8;return function(_0x249fb8){if(_0x249fb8){return _0x1ecc56[_0x5df2('0x18')](_0x14140c)[_0x5df2('0x19')](_0x249fb8);}};}function respondWithFilteredResult(_0x4e9933,_0x4fc93b){return function(_0x489c95){if(_0x489c95){var _0x1f95c1=_0x489c95[_0x5df2('0x1a')],_0x486d57=_0x4fc93b[_0x5df2('0x1b')],_0x4197a2=_0x4fc93b['offset']+_0x4fc93b[_0x5df2('0x1c')],_0x20eb09;if(_0x4197a2>=_0x1f95c1){_0x4197a2=_0x1f95c1;_0x20eb09=0xc8;}else{_0x20eb09=0xce;}_0x4e9933[_0x5df2('0x18')](_0x20eb09);return _0x4e9933['set'](_0x5df2('0x1d'),_0x486d57+'-'+_0x4197a2+'/'+_0x1f95c1)['json'](_0x489c95);}return null;};}function patchUpdates(_0x38fb1c){return function(_0xeb7394){try{jsonpatch[_0x5df2('0x1e')](_0xeb7394,_0x38fb1c,!![]);}catch(_0xa9b2da){return BPromise[_0x5df2('0x1f')](_0xa9b2da);}return _0xeb7394[_0x5df2('0x20')]();};}function saveUpdates(_0x1566c5,_0x47b981){return function(_0x74e0e8){if(_0x74e0e8){return _0x74e0e8[_0x5df2('0x21')](_0x1566c5)[_0x5df2('0x22')](function(_0x9db63d){return _0x9db63d;});}return null;};}function removeEntity(_0x477ee5,_0x43c241){return function(_0xbcd59a){if(_0xbcd59a){return _0xbcd59a[_0x5df2('0x23')]()[_0x5df2('0x22')](function(){_0x477ee5[_0x5df2('0x18')](0xcc)[_0x5df2('0x17')]();});}};}function handleEntityNotFound(_0x3e0255,_0x42b968){return function(_0x30ab06){if(!_0x30ab06){_0x3e0255['sendStatus'](0x194);}return _0x30ab06;};}function handleError(_0x2baada,_0x3ccacf){_0x3ccacf=_0x3ccacf||0x1f4;return function(_0x5b4c91){logger[_0x5df2('0x24')](_0x5b4c91[_0x5df2('0x25')]);if(_0x5b4c91[_0x5df2('0x26')]){delete _0x5b4c91[_0x5df2('0x26')];}_0x2baada[_0x5df2('0x18')](_0x3ccacf)[_0x5df2('0x27')](_0x5b4c91);};}exports['index']=function(_0x48c013,_0x50de39){var _0x34ae07={},_0x33eaee={},_0x495987={'count':0x0,'rows':[]};var _0x1fbbe2=db['OpenchannelQueue'][_0x5df2('0x28')];_0x33eaee[_0x5df2('0x29')]=_[_0x5df2('0x2a')](_0x1fbbe2);var _0x56e9e1={'dateStart':_0x48c013[_0x5df2('0x2b')][_0x5df2('0x2c')],'dateEnd':_0x48c013[_0x5df2('0x2b')][_0x5df2('0x2d')]};delete _0x48c013['query']['dateStart'];delete _0x48c013[_0x5df2('0x2b')]['dateEnd'];_0x33eaee[_0x5df2('0x2b')]=_[_0x5df2('0x2a')](_0x48c013[_0x5df2('0x2b')]);_0x33eaee[_0x5df2('0x2e')]=_['intersection'](_0x33eaee['model'],_0x33eaee['query']);_0x34ae07[_0x5df2('0x2f')]=_[_0x5df2('0x30')](_0x33eaee[_0x5df2('0x29')],qs[_0x5df2('0x31')](_0x48c013['query']['fields']));_0x34ae07[_0x5df2('0x2f')]=_0x34ae07[_0x5df2('0x2f')][_0x5df2('0x32')]?_0x34ae07[_0x5df2('0x2f')]:_0x33eaee[_0x5df2('0x29')];if(!_0x48c013[_0x5df2('0x2b')][_0x5df2('0x33')]('nolimit')){_0x34ae07[_0x5df2('0x1c')]=qs[_0x5df2('0x1c')](_0x48c013['query'][_0x5df2('0x1c')]);_0x34ae07[_0x5df2('0x1b')]=qs[_0x5df2('0x1b')](_0x48c013[_0x5df2('0x2b')][_0x5df2('0x1b')]);}_0x34ae07['order']=qs['sort'](_0x48c013[_0x5df2('0x2b')][_0x5df2('0x34')]);_0x34ae07[_0x5df2('0x35')]=qs[_0x5df2('0x2e')](_['pick'](_0x48c013[_0x5df2('0x2b')],_0x33eaee['filters']));if(_0x56e9e1[_0x5df2('0x2c')]){if(_0x56e9e1[_0x5df2('0x2d')]){_0x56e9e1['dateEnd']=moment(_0x56e9e1['dateEnd'])[_0x5df2('0x36')](0x1,'day');}else{_0x56e9e1[_0x5df2('0x2d')]=moment(_0x56e9e1[_0x5df2('0x2c')])[_0x5df2('0x36')](0x1,_0x5df2('0x37'));}_['merge'](_0x34ae07[_0x5df2('0x35')],{'createdAt':{'$gte':_0x56e9e1['dateStart'],'$lte':_0x56e9e1[_0x5df2('0x2d')]}});}if(_0x48c013[_0x5df2('0x2b')][_0x5df2('0x38')]){_0x34ae07[_0x5df2('0x35')]=_[_0x5df2('0x39')](_0x34ae07[_0x5df2('0x35')],{'$or':_[_0x5df2('0x3a')](_0x34ae07['attributes'],function(_0x2c0be5){var _0x250c30={};_0x250c30[_0x2c0be5]={'$like':'%'+_0x48c013['query'][_0x5df2('0x38')]+'%'};return _0x250c30;})});}_0x34ae07=_[_0x5df2('0x39')]({},_0x34ae07,_0x48c013[_0x5df2('0x3b')]);var _0x549941={'where':_0x34ae07[_0x5df2('0x35')]};return db[_0x5df2('0x3c')][_0x5df2('0x1a')](_0x549941)[_0x5df2('0x22')](function(_0x2595fc){_0x495987[_0x5df2('0x1a')]=_0x2595fc;if(_0x48c013['query']['includeAll']){_0x34ae07[_0x5df2('0x3d')]=[{'all':!![]}];}return db[_0x5df2('0x3c')][_0x5df2('0x3e')](_0x34ae07);})[_0x5df2('0x22')](function(_0x1a7403){_0x495987['rows']=_0x1a7403;return _0x495987;})[_0x5df2('0x22')](respondWithFilteredResult(_0x50de39,_0x34ae07))[_0x5df2('0x3f')](handleError(_0x50de39,null));};exports['show']=function(_0x55f0ae,_0x5b859d){var _0x39232c={'raw':!![],'where':{'id':_0x55f0ae[_0x5df2('0x40')]['id']}},_0xedf1db={};_0xedf1db[_0x5df2('0x29')]=_[_0x5df2('0x2a')](db['OpenchannelQueue'][_0x5df2('0x28')]);_0xedf1db[_0x5df2('0x2b')]=_[_0x5df2('0x2a')](_0x55f0ae[_0x5df2('0x2b')]);_0xedf1db[_0x5df2('0x2e')]=_['intersection'](_0xedf1db[_0x5df2('0x29')],_0xedf1db['query']);_0x39232c[_0x5df2('0x2f')]=_[_0x5df2('0x30')](_0xedf1db['model'],qs[_0x5df2('0x31')](_0x55f0ae[_0x5df2('0x2b')]['fields']));_0x39232c[_0x5df2('0x2f')]=_0x39232c[_0x5df2('0x2f')][_0x5df2('0x32')]?_0x39232c['attributes']:_0xedf1db[_0x5df2('0x29')];if(_0x55f0ae[_0x5df2('0x2b')]['includeAll']){_0x39232c['include']=[{'all':!![]}];}_0x39232c=_[_0x5df2('0x39')]({},_0x39232c,_0x55f0ae[_0x5df2('0x3b')]);return db[_0x5df2('0x3c')][_0x5df2('0x41')](_0x39232c)[_0x5df2('0x22')](handleEntityNotFound(_0x5b859d,null))[_0x5df2('0x22')](respondWithResult(_0x5b859d,null))[_0x5df2('0x3f')](handleError(_0x5b859d,null));};exports[_0x5df2('0x42')]=function(_0x4d821b,_0x1f45c8){return db[_0x5df2('0x3c')][_0x5df2('0x42')](_0x4d821b[_0x5df2('0x43')],{})['then'](respondWithResult(_0x1f45c8,0xc9))['catch'](handleError(_0x1f45c8,null));};exports[_0x5df2('0x21')]=function(_0x22dad3,_0x6f7126){if(_0x22dad3[_0x5df2('0x43')]['id']){delete _0x22dad3['body']['id'];}return db['OpenchannelQueue'][_0x5df2('0x41')]({'where':{'id':_0x22dad3[_0x5df2('0x40')]['id']}})[_0x5df2('0x22')](handleEntityNotFound(_0x6f7126,null))['then'](saveUpdates(_0x22dad3[_0x5df2('0x43')],null))[_0x5df2('0x22')](respondWithResult(_0x6f7126,null))['catch'](handleError(_0x6f7126,null));};exports[_0x5df2('0x23')]=function(_0x11d091,_0x4d9385){return db['OpenchannelQueue'][_0x5df2('0x41')]({'where':{'id':_0x11d091[_0x5df2('0x40')]['id']}})[_0x5df2('0x22')](handleEntityNotFound(_0x4d9385,null))[_0x5df2('0x22')](removeEntity(_0x4d9385,null))[_0x5df2('0x3f')](handleError(_0x4d9385,null));};exports[_0x5df2('0x44')]=function(_0x212c9f,_0x1f6af4){return db[_0x5df2('0x3c')]['describe']()[_0x5df2('0x22')](respondWithResult(_0x1f6af4,null))['catch'](handleError(_0x1f6af4,null));};exports[_0x5df2('0x45')]=function(_0x58882e,_0x2f4cb6,_0x5df1e2){var _0x534392={'raw':!![],'where':{}},_0x1c43f2={},_0x380430;return db[_0x5df2('0x3c')]['findOne']({'where':{'id':_0x58882e[_0x5df2('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f4cb6,null))[_0x5df2('0x22')](function(_0x5dc5d3){if(_0x5dc5d3){_0x380430=_0x5dc5d3[_0x5df2('0x46')]({'plain':!![]});_0x1c43f2[_0x5df2('0x29')]=_[_0x5df2('0x2a')](db[_0x5df2('0x47')]['rawAttributes']);_0x1c43f2[_0x5df2('0x2b')]=_[_0x5df2('0x2a')](_0x58882e[_0x5df2('0x2b')]);_0x1c43f2[_0x5df2('0x2e')]=_['intersection'](_0x1c43f2['model'],_0x1c43f2[_0x5df2('0x2b')]);_0x534392[_0x5df2('0x2f')]=_[_0x5df2('0x30')](_0x1c43f2[_0x5df2('0x29')],qs['fields'](_0x58882e[_0x5df2('0x2b')][_0x5df2('0x31')]));_0x534392[_0x5df2('0x2f')]=_0x534392['attributes']['length']?_0x534392['attributes']:_0x1c43f2[_0x5df2('0x29')];if(!_0x58882e[_0x5df2('0x2b')][_0x5df2('0x33')](_0x5df2('0x48'))){_0x534392[_0x5df2('0x1c')]=qs[_0x5df2('0x1c')](_0x58882e[_0x5df2('0x2b')][_0x5df2('0x1c')]);_0x534392[_0x5df2('0x1b')]=qs[_0x5df2('0x1b')](_0x58882e['query'][_0x5df2('0x1b')]);}_0x534392[_0x5df2('0x49')]=qs[_0x5df2('0x34')](_0x58882e['query'][_0x5df2('0x34')]);_0x534392[_0x5df2('0x35')]=qs['filters'](_[_0x5df2('0x4a')](_0x58882e[_0x5df2('0x2b')],_0x1c43f2[_0x5df2('0x2e')]));_0x534392['where']['OpenchannelQueueId']=_0x5dc5d3['id'];if(_0x58882e[_0x5df2('0x2b')]['filter']){_0x534392[_0x5df2('0x35')]=_[_0x5df2('0x39')](_0x534392[_0x5df2('0x35')],{'$or':_[_0x5df2('0x3a')](_0x534392[_0x5df2('0x2f')],function(_0x4902d5){var _0x390775={};_0x390775[_0x4902d5]={'$like':'%'+_0x58882e['query']['filter']+'%'};return _0x390775;})});}_0x534392=_[_0x5df2('0x39')]({},_0x534392,_0x58882e[_0x5df2('0x3b')]);return db[_0x5df2('0x47')][_0x5df2('0x3e')](_0x534392);}})[_0x5df2('0x22')](function(_0x59fa03){if(_0x59fa03){return db['User'][_0x5df2('0x4b')]({'where':{'id':_[_0x5df2('0x3a')](_0x59fa03,_0x5df2('0x4c')),'role':'agent'},'attributes':['id',_0x5df2('0x26'),_0x5df2('0x4d'),_0x5df2('0x4e'),'createdAt']});}})[_0x5df2('0x22')](function(_0x190fa3){if(_0x190fa3){return{'count':_0x190fa3[_0x5df2('0x1a')],'rows':_[_0x5df2('0x3a')](_0x190fa3['rows'],function(_0x376208){return{'membername':_0x376208[_0x5df2('0x26')],'UserId':_0x376208['id'],'queue_name':_0x380430[_0x5df2('0x26')],'OpenchannelQueueId':_0x380430['id'],'interface':util[_0x5df2('0x4f')](_0x5df2('0x50'),_0x5df2('0x51'),_0x376208[_0x5df2('0x26')]),'penalty':0x0,'paused':_0x376208[_0x5df2('0x4d')],'createdAt':_0x376208['createdAt'],'updatedAt':_0x376208[_0x5df2('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5df2('0x22')](respondWithFilteredResult(_0x2f4cb6,_0x534392))['catch'](handleError(_0x2f4cb6,null));};exports[_0x5df2('0x52')]=function(_0x547fbe,_0x3b4aef,_0xf49ea6){var _0x39a85e={};var _0x5f072b={};var _0x551869;var _0x4cc6b2;return db[_0x5df2('0x3c')][_0x5df2('0x53')]({'where':{'id':_0x547fbe[_0x5df2('0x40')]['id']}})[_0x5df2('0x22')](handleEntityNotFound(_0x3b4aef,null))[_0x5df2('0x22')](function(_0x4454ec){if(_0x4454ec){_0x551869=_0x4454ec;_0x5f072b[_0x5df2('0x29')]=_[_0x5df2('0x2a')](db[_0x5df2('0x54')]['rawAttributes']);_0x5f072b[_0x5df2('0x2b')]=_[_0x5df2('0x2a')](_0x547fbe[_0x5df2('0x2b')]);_0x5f072b[_0x5df2('0x2e')]=_[_0x5df2('0x30')](_0x5f072b[_0x5df2('0x29')],_0x5f072b[_0x5df2('0x2b')]);_0x39a85e[_0x5df2('0x2f')]=_[_0x5df2('0x30')](_0x5f072b['model'],qs['fields'](_0x547fbe[_0x5df2('0x2b')][_0x5df2('0x31')]));_0x39a85e['attributes']=_0x39a85e['attributes'][_0x5df2('0x32')]?_0x39a85e[_0x5df2('0x2f')]:_0x5f072b['model'];_0x39a85e['order']=qs['sort'](_0x547fbe[_0x5df2('0x2b')]['sort']);_0x39a85e['where']=qs[_0x5df2('0x2e')](_[_0x5df2('0x4a')](_0x547fbe['query'],_0x5f072b['filters']));if(_0x547fbe[_0x5df2('0x2b')]['filter']){_0x39a85e[_0x5df2('0x35')]=_[_0x5df2('0x39')](_0x39a85e[_0x5df2('0x35')],{'$or':_[_0x5df2('0x3a')](_0x39a85e[_0x5df2('0x2f')],function(_0x2ead34){var _0x44a803={};_0x44a803[_0x2ead34]={'$like':'%'+_0x547fbe[_0x5df2('0x2b')][_0x5df2('0x38')]+'%'};return _0x44a803;})});}_0x39a85e=_[_0x5df2('0x39')]({},_0x39a85e,_0x547fbe[_0x5df2('0x3b')]);return _0x551869[_0x5df2('0x52')](_0x39a85e);}})[_0x5df2('0x22')](function(_0x1d0f1d){if(_0x1d0f1d){_0x4cc6b2=_0x1d0f1d[_0x5df2('0x32')];if(!_0x547fbe[_0x5df2('0x2b')][_0x5df2('0x33')](_0x5df2('0x48'))){_0x39a85e[_0x5df2('0x1c')]=qs['limit'](_0x547fbe[_0x5df2('0x2b')][_0x5df2('0x1c')]);_0x39a85e[_0x5df2('0x1b')]=qs[_0x5df2('0x1b')](_0x547fbe[_0x5df2('0x2b')][_0x5df2('0x1b')]);}return _0x551869[_0x5df2('0x52')](_0x39a85e);}})[_0x5df2('0x22')](function(_0xf0376d){if(_0xf0376d){return _0xf0376d?{'count':_0x4cc6b2,'rows':_0xf0376d}:null;}})[_0x5df2('0x22')](respondWithResult(_0x3b4aef,null))[_0x5df2('0x3f')](handleError(_0x3b4aef,null));};exports['addTeams']=function(_0x22d070,_0x1d3a23,_0x40303a){var _0x108e36=[];var _0x294b4b;return db[_0x5df2('0x54')][_0x5df2('0x3e')]({'where':{'id':_0x22d070['body'][_0x5df2('0x55')]},'attributes':['id'],'include':[{'model':db[_0x5df2('0x56')],'as':_0x5df2('0x57'),'attributes':['id'],'raw':!![]}]})[_0x5df2('0x22')](function(_0x87c1c9){if(_0x87c1c9){for(var _0x1f1c67=0x0;_0x1f1c67<_0x87c1c9[_0x5df2('0x32')];_0x1f1c67+=0x1){for(var _0x43fafb=0x0;_0x43fafb<_0x87c1c9[_0x1f1c67][_0x5df2('0x57')][_0x5df2('0x32')];_0x43fafb+=0x1){_0x108e36=_[_0x5df2('0x58')](_0x108e36,[_0x87c1c9[_0x1f1c67][_0x5df2('0x57')][_0x43fafb]['id']]);}}return _0x108e36;}})[_0x5df2('0x22')](function(_0x5d6162){if(_0x5d6162){return db[_0x5df2('0x3c')][_0x5df2('0x41')]({'where':{'id':_0x22d070[_0x5df2('0x40')]['id']}});}})['then'](function(_0x531d21){if(_0x531d21){_0x294b4b=_0x531d21;return _0x294b4b['addAgents'](_0x108e36,{'penalty':_0x22d070['body'][_0x5df2('0x59')]});}})['then'](function(_0x2d3926){if(_0x2d3926){return _0x294b4b[_0x5df2('0x5a')](_0x22d070[_0x5df2('0x43')][_0x5df2('0x55')]);}})[_0x5df2('0x22')](handleEntityNotFound(_0x1d3a23,null))['then'](respondWithStatusCode(_0x1d3a23,null))[_0x5df2('0x3f')](handleError(_0x1d3a23,null));};exports['removeTeams']=function(_0x52d9e5,_0x249873,_0xecc618){var _0x124979=[];var _0x528027;return db[_0x5df2('0x54')]['findAll']({'where':{'id':_0x52d9e5[_0x5df2('0x2b')][_0x5df2('0x55')]},'attributes':['id'],'include':[{'model':db[_0x5df2('0x56')],'as':_0x5df2('0x57'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x47f03e){if(_0x47f03e){for(var _0x53858a=0x0;_0x53858a<_0x47f03e[_0x5df2('0x32')];_0x53858a+=0x1){for(var _0x16586e=0x0;_0x16586e<_0x47f03e[_0x53858a][_0x5df2('0x57')][_0x5df2('0x32')];_0x16586e+=0x1){_0x124979=_[_0x5df2('0x58')](_0x124979,[_0x47f03e[_0x53858a]['Agents'][_0x16586e]['id']]);}}return _0x124979;}})[_0x5df2('0x22')](function(_0x107ad1){if(_0x107ad1){return db[_0x5df2('0x3c')]['find']({'where':{'id':_0x52d9e5[_0x5df2('0x40')]['id']}});}})[_0x5df2('0x22')](function(_0x3a3932){if(_0x3a3932){_0x528027=_0x3a3932;return _0x528027[_0x5df2('0x5b')](_0x124979);}})['then'](function(_0xb61631){if(_0x528027){return _0x528027[_0x5df2('0x5c')](_0x52d9e5['query'][_0x5df2('0x55')]);}})[_0x5df2('0x22')](handleEntityNotFound(_0x249873,null))['then'](respondWithStatusCode(_0x249873,null))[_0x5df2('0x3f')](handleError(_0x249873,null));};exports[_0x5df2('0x5d')]=function(_0x4fba27,_0x2b9f72,_0x554978){return db['OpenchannelQueue']['find']({'where':{'id':_0x4fba27['params']['id']}})[_0x5df2('0x22')](handleEntityNotFound(_0x2b9f72,null))[_0x5df2('0x22')](function(_0x5cc540){if(_0x5cc540){return _0x5cc540[_0x5df2('0x5d')](_0x4fba27[_0x5df2('0x43')][_0x5df2('0x55')],_[_0x5df2('0x5e')](_0x4fba27[_0x5df2('0x43')],[_0x5df2('0x55'),'id'])||{})[_0x5df2('0x5f')](function(_0x56b702){for(var _0x47137f=0x0;_0x47137f<_0x4fba27[_0x5df2('0x43')]['ids']['length'];_0x47137f+=0x1){socket[_0x5df2('0x60')](_0x5df2('0x61'),{'UserId':_0x4fba27[_0x5df2('0x43')]['ids'][_0x47137f],'OpenchannelQueueId':_0x4fba27[_0x5df2('0x40')]['id']});}return _0x56b702;});}})[_0x5df2('0x22')](respondWithResult(_0x2b9f72,null))[_0x5df2('0x3f')](handleError(_0x2b9f72,null));};exports['removeAgents']=function(_0xd2c828,_0x59f51a,_0x4d8403){var _0x37cbeb;return db['OpenchannelQueue'][_0x5df2('0x41')]({'where':{'id':_0xd2c828[_0x5df2('0x40')]['id']}})[_0x5df2('0x22')](handleEntityNotFound(_0x59f51a,null))[_0x5df2('0x22')](function(_0x7e449){if(_0x7e449){return _0x7e449[_0x5df2('0x5b')](_0xd2c828[_0x5df2('0x2b')][_0x5df2('0x55')])[_0x5df2('0x22')](function(_0x51f44b){if(_[_0x5df2('0x62')](_0xd2c828[_0x5df2('0x2b')]['ids'])){for(var _0x50a516=0x0;_0x50a516<_0xd2c828[_0x5df2('0x2b')][_0x5df2('0x55')]['length'];_0x50a516+=0x1){socket[_0x5df2('0x60')]('userOpenchannelQueue:remove',{'UserId':_0xd2c828['query'][_0x5df2('0x55')][_0x50a516],'OpenchannelQueueId':_0xd2c828[_0x5df2('0x40')]['id']});}}else{socket[_0x5df2('0x60')](_0x5df2('0x63'),{'UserId':_0xd2c828[_0x5df2('0x2b')][_0x5df2('0x55')],'OpenchannelQueueId':_0xd2c828['params']['id']});}});}})['then'](respondWithStatusCode(_0x59f51a,null))['catch'](handleError(_0x59f51a,null));};exports[_0x5df2('0x64')]=function(_0x5196f0,_0x31e170,_0x4a237a){var _0x58953e={};var _0x5dc253={};var _0x33e526;var _0x387203;return db['OpenchannelQueue'][_0x5df2('0x53')]({'where':{'id':_0x5196f0['params']['id']}})['then'](handleEntityNotFound(_0x31e170,null))[_0x5df2('0x22')](function(_0x49ba76){if(_0x49ba76){_0x33e526=_0x49ba76;_0x5dc253[_0x5df2('0x29')]=_[_0x5df2('0x2a')](db[_0x5df2('0x56')]['rawAttributes']);_0x5dc253[_0x5df2('0x2b')]=_[_0x5df2('0x2a')](_0x5196f0[_0x5df2('0x2b')]);_0x5dc253[_0x5df2('0x2e')]=_['intersection'](_0x5dc253[_0x5df2('0x29')],_0x5dc253[_0x5df2('0x2b')]);_0x58953e[_0x5df2('0x2f')]=_[_0x5df2('0x30')](_0x5dc253[_0x5df2('0x29')],qs[_0x5df2('0x31')](_0x5196f0[_0x5df2('0x2b')][_0x5df2('0x31')]));_0x58953e[_0x5df2('0x2f')]=_0x58953e[_0x5df2('0x2f')][_0x5df2('0x32')]?_0x58953e[_0x5df2('0x2f')]:_0x5dc253[_0x5df2('0x29')];_0x58953e[_0x5df2('0x49')]=qs[_0x5df2('0x34')](_0x5196f0[_0x5df2('0x2b')][_0x5df2('0x34')]);_0x58953e['where']=qs[_0x5df2('0x2e')](_[_0x5df2('0x4a')](_0x5196f0[_0x5df2('0x2b')],_0x5dc253[_0x5df2('0x2e')]));if(_0x5196f0[_0x5df2('0x2b')][_0x5df2('0x38')]){_0x58953e[_0x5df2('0x35')]=_[_0x5df2('0x39')](_0x58953e['where'],{'$or':_[_0x5df2('0x3a')](_0x58953e[_0x5df2('0x2f')],function(_0x5c079b){var _0x438076={};_0x438076[_0x5c079b]={'$like':'%'+_0x5196f0[_0x5df2('0x2b')]['filter']+'%'};return _0x438076;})});}_0x58953e=_[_0x5df2('0x39')]({},_0x58953e,_0x5196f0[_0x5df2('0x3b')]);return _0x33e526[_0x5df2('0x64')](_0x58953e);}})['then'](function(_0x3fc7fd){if(_0x3fc7fd){_0x387203=_0x3fc7fd[_0x5df2('0x32')];if(!_0x5196f0[_0x5df2('0x2b')][_0x5df2('0x33')](_0x5df2('0x48'))){_0x58953e[_0x5df2('0x1c')]=qs[_0x5df2('0x1c')](_0x5196f0[_0x5df2('0x2b')][_0x5df2('0x1c')]);_0x58953e[_0x5df2('0x1b')]=qs[_0x5df2('0x1b')](_0x5196f0[_0x5df2('0x2b')][_0x5df2('0x1b')]);}return _0x33e526['getAgents'](_0x58953e);}})[_0x5df2('0x22')](function(_0x591f4d){if(_0x591f4d){return _0x591f4d?{'count':_0x387203,'rows':_0x591f4d}:null;}})[_0x5df2('0x22')](respondWithResult(_0x31e170,null))[_0x5df2('0x3f')](handleError(_0x31e170,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 33252ca..fbc057b 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 _0x8784=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3c938b,_0x50aca4){var _0x2077c0=function(_0x412dbb){while(--_0x412dbb){_0x3c938b['push'](_0x3c938b['shift']());}};_0x2077c0(++_0x50aca4);}(_0x8784,0x1c8));var _0x4878=function(_0x33593e,_0x22ddd3){_0x33593e=_0x33593e-0x0;var _0x53db1a=_0x8784[_0x33593e];return _0x53db1a;};'use strict';var EventEmitter=require(_0x4878('0x0'));var OpenchannelQueue=require(_0x4878('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4878('0x2'),'afterDestroy':_0x4878('0x3')};function emitEvent(_0x48fa63){return function(_0x50faf9,_0x18a6e6,_0x2ecd00){OpenchannelQueueEvents[_0x4878('0x4')](_0x48fa63+':'+_0x50faf9['id'],_0x50faf9);OpenchannelQueueEvents['emit'](_0x48fa63,_0x50faf9);_0x2ecd00(null);};}for(var e in events){if(events[_0x4878('0x5')](e)){var event=events[e];OpenchannelQueue[_0x4878('0x6')](e,emitEvent(event));}}module[_0x4878('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x672a=['save','update','remove','emit','hasOwnProperty','hook','exports','setMaxListeners'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x672a,0x9f));var _0xa672=function(_0x1c5a8a,_0xa47002){_0x1c5a8a=_0x1c5a8a-0x0;var _0xcb29ae=_0x672a[_0x1c5a8a];return _0xcb29ae;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xa672('0x0')](0x0);var events={'afterCreate':_0xa672('0x1'),'afterUpdate':_0xa672('0x2'),'afterDestroy':_0xa672('0x3')};function emitEvent(_0x3c86ea){return function(_0x3d7eaa,_0x13140a,_0x123e48){OpenchannelQueueEvents[_0xa672('0x4')](_0x3c86ea+':'+_0x3d7eaa['id'],_0x3d7eaa);OpenchannelQueueEvents[_0xa672('0x4')](_0x3c86ea,_0x3d7eaa);_0x123e48(null);};}for(var e in events){if(events[_0xa672('0x5')](e)){var event=events[e];OpenchannelQueue[_0xa672('0x6')](e,emitEvent(event));}}module[_0xa672('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 0e1fa99..d2e2432 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 _0x6f7a=['openchannel_queues','lodash','util','../../config/logger','api','bluebird','request-promise','./openchannelQueue.attributes','exports','define','OpenchannelQueue'];(function(_0x115551,_0x50f4fe){var _0x170d93=function(_0x1318b5){while(--_0x1318b5){_0x115551['push'](_0x115551['shift']());}};_0x170d93(++_0x50f4fe);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x3539e0,_0x627f0e){_0x3539e0=_0x3539e0-0x0;var _0x48942f=_0x6f7a[_0x3539e0];return _0x48942f;};'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 +var _0x68fc=['bluebird','./openchannelQueue.attributes','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x68fc,0xa5));var _0xc68f=function(_0x578521,_0x1283fb){_0x578521=_0x578521-0x0;var _0x53d7af=_0x68fc[_0x578521];return _0x53d7af;};'use strict';var _=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var logger=require(_0xc68f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc68f('0x3'));var rp=require('request-promise');var attributes=require(_0xc68f('0x4'));module['exports']=function(_0x5899ea,_0x3b2744){return _0x5899ea[_0xc68f('0x5')](_0xc68f('0x6'),attributes,{'tableName':_0xc68f('0x7'),'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 dfde790..a7d5142 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 _0x094a=['where','attributes','include','map','model','then','GetOpenchannelQueue','debug','catch','find','ShowOpenchannelQueue','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','socket.io-emitter','localhost','./openchannelQueue.socket','request','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','OpenchannelQueue','findAll','options','raw'];(function(_0x53263b,_0x299c08){var _0x3fd94b=function(_0x489939){while(--_0x489939){_0x53263b['push'](_0x53263b['shift']());}};_0x3fd94b(++_0x299c08);}(_0x094a,0x1a2));var _0xa094=function(_0x2adec5,_0x2e1b2d){_0x2adec5=_0x2adec5-0x0;var _0x175fc8=_0x094a[_0x2adec5];return _0x175fc8;};'use strict';var _=require(_0xa094('0x0'));var util=require('util');var moment=require(_0xa094('0x1'));var BPromise=require(_0xa094('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xa094('0x3'));var logger=require(_0xa094('0x4'))(_0xa094('0x5'));var config=require(_0xa094('0x6'));var jayson=require(_0xa094('0x7'));var client=jayson[_0xa094('0x8')]['http']({'port':0x232a});var socket=require(_0xa094('0x9'))({'host':_0xa094('0xa'),'port':0x18eb});require(_0xa094('0xb'))['register'](socket);function respondWithRpcPromise(_0x2bc2a6,_0x133f5e,_0x204961){return new BPromise(function(_0x1b8222,_0x116453){return client[_0xa094('0xc')](_0x2bc2a6,_0x204961)['then'](function(_0x36a6b8){logger['info'](_0xa094('0xd'),_0x133f5e,_0xa094('0xe'));logger['debug'](_0xa094('0xf'),_0x133f5e,_0xa094('0xe'),JSON[_0xa094('0x10')](_0x36a6b8));if(_0x36a6b8[_0xa094('0x11')]){if(_0x36a6b8[_0xa094('0x11')][_0xa094('0x12')]===0x1f4){logger[_0xa094('0x11')](_0xa094('0xd'),_0x133f5e,_0x36a6b8[_0xa094('0x11')]['message']);return _0x116453(_0x36a6b8[_0xa094('0x11')][_0xa094('0x13')]);}logger[_0xa094('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x133f5e,_0x36a6b8[_0xa094('0x11')][_0xa094('0x13')]);return _0x1b8222(_0x36a6b8[_0xa094('0x11')]['message']);}else{logger[_0xa094('0x14')](_0xa094('0xd'),_0x133f5e,_0xa094('0xe'));_0x1b8222(_0x36a6b8[_0xa094('0x15')][_0xa094('0x13')]);}})['catch'](function(_0xb6a62a){logger[_0xa094('0x11')](_0xa094('0xd'),_0x133f5e,_0xb6a62a);_0x116453(_0xb6a62a);});});}exports['GetOpenchannelQueue']=function(_0x3e5829){var _0x589f91=this;return new Promise(function(_0x27eed9,_0x2849d6){return db[_0xa094('0x16')][_0xa094('0x17')]({'raw':_0x3e5829[_0xa094('0x18')]?_0x3e5829[_0xa094('0x18')][_0xa094('0x19')]===undefined?!![]:![]:!![],'where':_0x3e5829[_0xa094('0x18')]?_0x3e5829[_0xa094('0x18')][_0xa094('0x1a')]||null:null,'attributes':_0x3e5829[_0xa094('0x18')]?_0x3e5829[_0xa094('0x18')][_0xa094('0x1b')]||null:null,'limit':_0x3e5829['options']?_0x3e5829['options']['limit']||null:null,'include':_0x3e5829[_0xa094('0x18')]?_0x3e5829[_0xa094('0x18')][_0xa094('0x1c')]?_[_0xa094('0x1d')](_0x3e5829[_0xa094('0x18')][_0xa094('0x1c')],function(_0x1363ad){return{'model':db[_0x1363ad[_0xa094('0x1e')]],'as':_0x1363ad['as'],'attributes':_0x1363ad[_0xa094('0x1b')],'include':_0x1363ad[_0xa094('0x1c')]?_[_0xa094('0x1d')](_0x1363ad[_0xa094('0x1c')],function(_0x245feb){return{'model':db[_0x245feb[_0xa094('0x1e')]],'as':_0x245feb['as'],'attributes':_0x245feb[_0xa094('0x1b')],'include':_0x245feb[_0xa094('0x1c')]?_[_0xa094('0x1d')](_0x245feb[_0xa094('0x1c')],function(_0x323518){return{'model':db[_0x323518[_0xa094('0x1e')]],'as':_0x323518['as'],'attributes':_0x323518[_0xa094('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa094('0x1f')](function(_0x10056f){logger[_0xa094('0x14')](_0xa094('0x20'),_0x3e5829);logger[_0xa094('0x21')](_0xa094('0x20'),_0x3e5829,JSON[_0xa094('0x10')](_0x10056f));_0x27eed9(_0x10056f);})[_0xa094('0x22')](function(_0x2aee11){logger['error'](_0xa094('0x20'),_0x2aee11[_0xa094('0x13')],_0x3e5829);_0x2849d6(_0x589f91['error'](0x1f4,_0x2aee11[_0xa094('0x13')]));});});};exports['ShowOpenchannelQueue']=function(_0x31ee21){var _0x14cb9a=this;return new Promise(function(_0x34d0aa,_0x16ec18){return db[_0xa094('0x16')][_0xa094('0x23')]({'raw':_0x31ee21[_0xa094('0x18')]?_0x31ee21[_0xa094('0x18')][_0xa094('0x19')]===undefined?!![]:![]:!![],'where':_0x31ee21[_0xa094('0x18')]?_0x31ee21[_0xa094('0x18')][_0xa094('0x1a')]||null:null,'attributes':_0x31ee21['options']?_0x31ee21[_0xa094('0x18')][_0xa094('0x1b')]||null:null,'include':_0x31ee21[_0xa094('0x18')]?_0x31ee21['options'][_0xa094('0x1c')]?_[_0xa094('0x1d')](_0x31ee21['options'][_0xa094('0x1c')],function(_0x205f2b){return{'model':db[_0x205f2b[_0xa094('0x1e')]],'as':_0x205f2b['as'],'attributes':_0x205f2b['attributes'],'include':_0x205f2b[_0xa094('0x1c')]?_['map'](_0x205f2b[_0xa094('0x1c')],function(_0x4ecd71){return{'model':db[_0x4ecd71[_0xa094('0x1e')]],'as':_0x4ecd71['as'],'attributes':_0x4ecd71[_0xa094('0x1b')],'include':_0x4ecd71[_0xa094('0x1c')]?_[_0xa094('0x1d')](_0x4ecd71['include'],function(_0x3a1d56){return{'model':db[_0x3a1d56['model']],'as':_0x3a1d56['as'],'attributes':_0x3a1d56['attributes']};}):[]};}):[]};}):[]:[]})[_0xa094('0x1f')](function(_0x35a270){logger[_0xa094('0x14')](_0xa094('0x24'),_0x31ee21);logger['debug'](_0xa094('0x24'),_0x31ee21,JSON[_0xa094('0x10')](_0x35a270));_0x34d0aa(_0x35a270);})[_0xa094('0x22')](function(_0x6ec019){logger['error'](_0xa094('0x24'),_0x6ec019[_0xa094('0x13')],_0x31ee21);_0x16ec18(_0x14cb9a[_0xa094('0x11')](0x1f4,_0x6ec019['message']));});});}; \ No newline at end of file +var _0xfd2b=['register','then','OpenchannelQueue,\x20%s,\x20%s','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowOpenchannelQueue','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','localhost','./openchannelQueue.socket'];(function(_0x28a408,_0x4f755a){var _0x4e99a6=function(_0x450233){while(--_0x450233){_0x28a408['push'](_0x28a408['shift']());}};_0x4e99a6(++_0x4f755a);}(_0xfd2b,0x68));var _0xbfd2=function(_0xec3602,_0x1b6b9c){_0xec3602=_0xec3602-0x0;var _0x4e6da4=_0xfd2b[_0xec3602];return _0x4e6da4;};'use strict';var _=require(_0xbfd2('0x0'));var util=require(_0xbfd2('0x1'));var moment=require(_0xbfd2('0x2'));var BPromise=require(_0xbfd2('0x3'));var rs=require(_0xbfd2('0x4'));var fs=require('fs');var db=require(_0xbfd2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbfd2('0x6'));var config=require(_0xbfd2('0x7'));var jayson=require(_0xbfd2('0x8'));var client=jayson[_0xbfd2('0x9')][_0xbfd2('0xa')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0xbfd2('0xb'),'port':0x18eb});require(_0xbfd2('0xc'))[_0xbfd2('0xd')](socket);function respondWithRpcPromise(_0x53cabf,_0x1c84e5,_0x9c9a5c){return new BPromise(function(_0x2c1612,_0x4f51a9){return client['request'](_0x53cabf,_0x9c9a5c)[_0xbfd2('0xe')](function(_0x12381c){logger['info'](_0xbfd2('0xf'),_0x1c84e5,'request\x20sent');logger['debug'](_0xbfd2('0x10'),_0x1c84e5,_0xbfd2('0x11'),JSON[_0xbfd2('0x12')](_0x12381c));if(_0x12381c[_0xbfd2('0x13')]){if(_0x12381c['error'][_0xbfd2('0x14')]===0x1f4){logger[_0xbfd2('0x13')](_0xbfd2('0xf'),_0x1c84e5,_0x12381c[_0xbfd2('0x13')][_0xbfd2('0x15')]);return _0x4f51a9(_0x12381c[_0xbfd2('0x13')][_0xbfd2('0x15')]);}logger[_0xbfd2('0x13')](_0xbfd2('0xf'),_0x1c84e5,_0x12381c['error']['message']);return _0x2c1612(_0x12381c[_0xbfd2('0x13')]['message']);}else{logger[_0xbfd2('0x16')](_0xbfd2('0xf'),_0x1c84e5,_0xbfd2('0x11'));_0x2c1612(_0x12381c[_0xbfd2('0x17')][_0xbfd2('0x15')]);}})[_0xbfd2('0x18')](function(_0x1ad72a){logger[_0xbfd2('0x13')](_0xbfd2('0xf'),_0x1c84e5,_0x1ad72a);_0x4f51a9(_0x1ad72a);});});}exports[_0xbfd2('0x19')]=function(_0x127106){var _0x57eb05=this;return new Promise(function(_0x52a820,_0x22c328){return db[_0xbfd2('0x1a')][_0xbfd2('0x1b')]({'raw':_0x127106[_0xbfd2('0x1c')]?_0x127106['options'][_0xbfd2('0x1d')]===undefined?!![]:![]:!![],'where':_0x127106[_0xbfd2('0x1c')]?_0x127106[_0xbfd2('0x1c')][_0xbfd2('0x1e')]||null:null,'attributes':_0x127106[_0xbfd2('0x1c')]?_0x127106[_0xbfd2('0x1c')][_0xbfd2('0x1f')]||null:null,'limit':_0x127106[_0xbfd2('0x1c')]?_0x127106['options'][_0xbfd2('0x20')]||null:null,'include':_0x127106['options']?_0x127106[_0xbfd2('0x1c')][_0xbfd2('0x21')]?_[_0xbfd2('0x22')](_0x127106[_0xbfd2('0x1c')][_0xbfd2('0x21')],function(_0x2312f5){return{'model':db[_0x2312f5[_0xbfd2('0x23')]],'as':_0x2312f5['as'],'attributes':_0x2312f5[_0xbfd2('0x1f')],'include':_0x2312f5[_0xbfd2('0x21')]?_['map'](_0x2312f5[_0xbfd2('0x21')],function(_0x3a1be8){return{'model':db[_0x3a1be8[_0xbfd2('0x23')]],'as':_0x3a1be8['as'],'attributes':_0x3a1be8[_0xbfd2('0x1f')],'include':_0x3a1be8[_0xbfd2('0x21')]?_[_0xbfd2('0x22')](_0x3a1be8[_0xbfd2('0x21')],function(_0x673b20){return{'model':db[_0x673b20[_0xbfd2('0x23')]],'as':_0x673b20['as'],'attributes':_0x673b20[_0xbfd2('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21be21){logger[_0xbfd2('0x16')]('GetOpenchannelQueue',_0x127106);logger['debug'](_0xbfd2('0x19'),_0x127106,JSON[_0xbfd2('0x12')](_0x21be21));_0x52a820(_0x21be21);})[_0xbfd2('0x18')](function(_0x27e892){logger[_0xbfd2('0x13')](_0xbfd2('0x19'),_0x27e892['message'],_0x127106);_0x22c328(_0x57eb05[_0xbfd2('0x13')](0x1f4,_0x27e892[_0xbfd2('0x15')]));});});};exports['ShowOpenchannelQueue']=function(_0x2d62e0){var _0x1deed8=this;return new Promise(function(_0x458d0e,_0x5a88b2){return db['OpenchannelQueue'][_0xbfd2('0x24')]({'raw':_0x2d62e0['options']?_0x2d62e0[_0xbfd2('0x1c')][_0xbfd2('0x1d')]===undefined?!![]:![]:!![],'where':_0x2d62e0[_0xbfd2('0x1c')]?_0x2d62e0[_0xbfd2('0x1c')]['where']||null:null,'attributes':_0x2d62e0['options']?_0x2d62e0[_0xbfd2('0x1c')][_0xbfd2('0x1f')]||null:null,'include':_0x2d62e0[_0xbfd2('0x1c')]?_0x2d62e0[_0xbfd2('0x1c')][_0xbfd2('0x21')]?_['map'](_0x2d62e0[_0xbfd2('0x1c')][_0xbfd2('0x21')],function(_0x7b75ea){return{'model':db[_0x7b75ea[_0xbfd2('0x23')]],'as':_0x7b75ea['as'],'attributes':_0x7b75ea[_0xbfd2('0x1f')],'include':_0x7b75ea['include']?_[_0xbfd2('0x22')](_0x7b75ea[_0xbfd2('0x21')],function(_0x59a172){return{'model':db[_0x59a172[_0xbfd2('0x23')]],'as':_0x59a172['as'],'attributes':_0x59a172[_0xbfd2('0x1f')],'include':_0x59a172[_0xbfd2('0x21')]?_['map'](_0x59a172[_0xbfd2('0x21')],function(_0x43488e){return{'model':db[_0x43488e[_0xbfd2('0x23')]],'as':_0x43488e['as'],'attributes':_0x43488e[_0xbfd2('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbfd2('0xe')](function(_0x781335){logger[_0xbfd2('0x16')](_0xbfd2('0x25'),_0x2d62e0);logger[_0xbfd2('0x26')]('ShowOpenchannelQueue',_0x2d62e0,JSON[_0xbfd2('0x12')](_0x781335));_0x458d0e(_0x781335);})[_0xbfd2('0x18')](function(_0x1de6c1){logger['error'](_0xbfd2('0x25'),_0x1de6c1['message'],_0x2d62e0);_0x5a88b2(_0x1deed8['error'](0x1f4,_0x1de6c1[_0xbfd2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index e92196b..b1dffad 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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 28197af..38a9e64 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 _0xa8b0=['update','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','create','put'];(function(_0x51715b,_0xe852a9){var _0x3ba2e2=function(_0x565694){while(--_0x565694){_0x51715b['push'](_0x51715b['shift']());}};_0x3ba2e2(++_0xe852a9);}(_0xa8b0,0x1bc));var _0x0a8b=function(_0x1c9cfb,_0x4efc3b){_0x1c9cfb=_0x1c9cfb-0x0;var _0x32436a=_0xa8b0[_0x1c9cfb];return _0x32436a;};'use strict';var multer=require(_0x0a8b('0x0'));var util=require('util');var path=require(_0x0a8b('0x1'));var express=require(_0x0a8b('0x2'));var router=express[_0x0a8b('0x3')]();var auth=require(_0x0a8b('0x4'));var interaction=require(_0x0a8b('0x5'));var config=require('../../config/environment');var controller=require(_0x0a8b('0x6'));router[_0x0a8b('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a8b('0x8')]);router['get'](_0x0a8b('0x9'),auth[_0x0a8b('0xa')](),controller[_0x0a8b('0xb')]);router['get'](_0x0a8b('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x0a8b('0xa')](),controller[_0x0a8b('0xd')]);router[_0x0a8b('0xe')]('/:id',auth[_0x0a8b('0xa')](),controller[_0x0a8b('0xf')]);router['delete'](_0x0a8b('0xc'),auth[_0x0a8b('0xa')](),controller[_0x0a8b('0x10')]);module['exports']=router; \ No newline at end of file +var _0xfd0a=['create','put','update','delete','destroy','exports','util','path','express','Router','../../components/interaction/service','get','/describe','isAuthenticated','/:id','show','post'];(function(_0x59e249,_0x3c6ea6){var _0x1ebb2d=function(_0x99acd0){while(--_0x99acd0){_0x59e249['push'](_0x59e249['shift']());}};_0x1ebb2d(++_0x3c6ea6);}(_0xfd0a,0x138));var _0xafd0=function(_0x4e479b,_0x2478e7){_0x4e479b=_0x4e479b-0x0;var _0x32c31a=_0xfd0a[_0x4e479b];return _0x32c31a;};'use strict';var multer=require('multer');var util=require(_0xafd0('0x0'));var path=require(_0xafd0('0x1'));var express=require(_0xafd0('0x2'));var router=express[_0xafd0('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xafd0('0x4'));var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router[_0xafd0('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xafd0('0x5')](_0xafd0('0x6'),auth[_0xafd0('0x7')](),controller['describe']);router['get'](_0xafd0('0x8'),auth['isAuthenticated'](),controller[_0xafd0('0x9')]);router[_0xafd0('0xa')]('/',auth[_0xafd0('0x7')](),controller[_0xafd0('0xb')]);router[_0xafd0('0xc')](_0xafd0('0x8'),auth[_0xafd0('0x7')](),controller[_0xafd0('0xd')]);router[_0xafd0('0xe')](_0xafd0('0x8'),auth[_0xafd0('0x7')](),controller[_0xafd0('0xf')]);module[_0xafd0('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 4d6c333..b4eaec7 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 _0x5445=['sequelize','exports','STRING','DATE'];(function(_0x91d019,_0x5223c4){var _0x19de1f=function(_0x3e1311){while(--_0x3e1311){_0x91d019['push'](_0x91d019['shift']());}};_0x19de1f(++_0x5223c4);}(_0x5445,0x11c));var _0x5544=function(_0x2f23dc,_0x583e49){_0x2f23dc=_0x2f23dc-0x0;var _0x1fcac7=_0x5445[_0x2f23dc];return _0x1fcac7;};'use strict';var moment=require('moment');var Sequelize=require(_0x5544('0x0'));module[_0x5544('0x1')]={'uniqueid':{'type':Sequelize[_0x5544('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x5544('0x2')]},'joinAt':{'type':Sequelize[_0x5544('0x3')]},'leaveAt':{'type':Sequelize[_0x5544('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x5544('0x3')]},'reason':{'type':Sequelize[_0x5544('0x2')]}}; \ No newline at end of file +var _0x65f7=['DATE','moment','exports','STRING'];(function(_0x4c9289,_0x4b4b6d){var _0x1cf1c5=function(_0x2cce70){while(--_0x2cce70){_0x4c9289['push'](_0x4c9289['shift']());}};_0x1cf1c5(++_0x4b4b6d);}(_0x65f7,0x159));var _0x765f=function(_0x263299,_0x34204c){_0x263299=_0x263299-0x0;var _0xbff391=_0x65f7[_0x263299];return _0xbff391;};'use strict';var moment=require(_0x765f('0x0'));var Sequelize=require('sequelize');module[_0x765f('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x765f('0x2')]},'joinAt':{'type':Sequelize[_0x765f('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x765f('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x765f('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 2c7b58b..2dd5ad0 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 _0x47c5=['bluebird','mustache','util','sox','to-csv','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','set','Content-Range','reject','save','update','then','error','stack','name','send','index','rawAttributes','keys','query','dateEnd','dateStart','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','add','day','merge','map','filter','OpenchannelQueueReport','includeAll','include','findAll','show','params','options','find','catch','create','body','destroy','describe','fast-json-patch','request-promise','moment'];(function(_0x538c62,_0x3399d6){var _0x445bf5=function(_0x167018){while(--_0x167018){_0x538c62['push'](_0x538c62['shift']());}};_0x445bf5(++_0x3399d6);}(_0x47c5,0x165));var _0x547c=function(_0x1e7600,_0x11348d){_0x1e7600=_0x1e7600-0x0;var _0x80b052=_0x47c5[_0x1e7600];return _0x80b052;};'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'];function respondWithStatusCode(_0x2c54e,_0x111457){_0x111457=_0x111457||0xcc;return function(_0x2455e9){if(_0x2455e9){return _0x2c54e[_0x547c('0x14')](_0x111457);}return _0x2c54e[_0x547c('0x15')](_0x111457)[_0x547c('0x16')]();};}function respondWithResult(_0x549bf0,_0x13a103){_0x13a103=_0x13a103||0xc8;return function(_0x39dce7){if(_0x39dce7){return _0x549bf0['status'](_0x13a103)[_0x547c('0x17')](_0x39dce7);}};}function respondWithFilteredResult(_0x201d95,_0x171ae4){return function(_0x5016e9){if(_0x5016e9){var _0x392a35=_0x5016e9[_0x547c('0x18')],_0x150317=_0x171ae4[_0x547c('0x19')],_0x2bc289=_0x171ae4[_0x547c('0x19')]+_0x171ae4[_0x547c('0x1a')],_0xa3c7b0;if(_0x2bc289>=_0x392a35){_0x2bc289=_0x392a35;_0xa3c7b0=0xc8;}else{_0xa3c7b0=0xce;}_0x201d95[_0x547c('0x15')](_0xa3c7b0);return _0x201d95[_0x547c('0x1b')](_0x547c('0x1c'),_0x150317+'-'+_0x2bc289+'/'+_0x392a35)[_0x547c('0x17')](_0x5016e9);}return null;};}function patchUpdates(_0x39498d){return function(_0x19d3dd){try{jsonpatch['apply'](_0x19d3dd,_0x39498d,!![]);}catch(_0x4a6c57){return BPromise[_0x547c('0x1d')](_0x4a6c57);}return _0x19d3dd[_0x547c('0x1e')]();};}function saveUpdates(_0xeb059e,_0x4a8901){return function(_0x248aca){if(_0x248aca){return _0x248aca[_0x547c('0x1f')](_0xeb059e)[_0x547c('0x20')](function(_0x58ddc9){return _0x58ddc9;});}return null;};}function removeEntity(_0x4511d3,_0x41149f){return function(_0x496c38){if(_0x496c38){return _0x496c38['destroy']()[_0x547c('0x20')](function(){_0x4511d3[_0x547c('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11e709,_0x16a3a6){return function(_0x592e46){if(!_0x592e46){_0x11e709[_0x547c('0x14')](0x194);}return _0x592e46;};}function handleError(_0x17fd97,_0x436e67){_0x436e67=_0x436e67||0x1f4;return function(_0x4c718c){logger[_0x547c('0x21')](_0x4c718c[_0x547c('0x22')]);if(_0x4c718c[_0x547c('0x23')]){delete _0x4c718c[_0x547c('0x23')];}_0x17fd97[_0x547c('0x15')](_0x436e67)[_0x547c('0x24')](_0x4c718c);};}exports[_0x547c('0x25')]=function(_0x17fa33,_0x507895){var _0x39c5f9={},_0x4c66b9={},_0x5b05f2={'count':0x0,'rows':[]};var _0x4855fd=db['OpenchannelQueueReport'][_0x547c('0x26')];_0x4c66b9['model']=_[_0x547c('0x27')](_0x4855fd);var _0x5729b0={'dateStart':_0x17fa33[_0x547c('0x28')]['dateStart'],'dateEnd':_0x17fa33[_0x547c('0x28')][_0x547c('0x29')]};delete _0x17fa33[_0x547c('0x28')][_0x547c('0x2a')];delete _0x17fa33[_0x547c('0x28')]['dateEnd'];_0x4c66b9['query']=_[_0x547c('0x27')](_0x17fa33['query']);_0x4c66b9[_0x547c('0x2b')]=_[_0x547c('0x2c')](_0x4c66b9[_0x547c('0x2d')],_0x4c66b9[_0x547c('0x28')]);_0x39c5f9[_0x547c('0x2e')]=_[_0x547c('0x2c')](_0x4c66b9[_0x547c('0x2d')],qs['fields'](_0x17fa33['query'][_0x547c('0x2f')]));_0x39c5f9[_0x547c('0x2e')]=_0x39c5f9[_0x547c('0x2e')][_0x547c('0x30')]?_0x39c5f9[_0x547c('0x2e')]:_0x4c66b9[_0x547c('0x2d')];if(!_0x17fa33[_0x547c('0x28')][_0x547c('0x31')](_0x547c('0x32'))){_0x39c5f9[_0x547c('0x1a')]=qs[_0x547c('0x1a')](_0x17fa33[_0x547c('0x28')][_0x547c('0x1a')]);_0x39c5f9[_0x547c('0x19')]=qs['offset'](_0x17fa33[_0x547c('0x28')]['offset']);}_0x39c5f9['order']=qs['sort'](_0x17fa33[_0x547c('0x28')][_0x547c('0x33')]);_0x39c5f9[_0x547c('0x34')]=qs[_0x547c('0x2b')](_[_0x547c('0x35')](_0x17fa33[_0x547c('0x28')],_0x4c66b9['filters']));if(_0x5729b0['dateStart']){if(_0x5729b0['dateEnd']){_0x5729b0[_0x547c('0x29')]=moment(_0x5729b0[_0x547c('0x29')])[_0x547c('0x36')](0x1,_0x547c('0x37'));}else{_0x5729b0[_0x547c('0x29')]=moment(_0x5729b0[_0x547c('0x2a')])['add'](0x1,_0x547c('0x37'));}_['merge'](_0x39c5f9[_0x547c('0x34')],{'createdAt':{'$gte':_0x5729b0[_0x547c('0x2a')],'$lte':_0x5729b0['dateEnd']}});}if(_0x17fa33[_0x547c('0x28')]['filter']){_0x39c5f9['where']=_[_0x547c('0x38')](_0x39c5f9[_0x547c('0x34')],{'$or':_[_0x547c('0x39')](_0x39c5f9[_0x547c('0x2e')],function(_0x4c36b9){var _0x52b962={};_0x52b962[_0x4c36b9]={'$like':'%'+_0x17fa33[_0x547c('0x28')][_0x547c('0x3a')]+'%'};return _0x52b962;})});}_0x39c5f9=_[_0x547c('0x38')]({},_0x39c5f9,_0x17fa33['options']);var _0x3886ae={'where':_0x39c5f9[_0x547c('0x34')]};return db[_0x547c('0x3b')]['count'](_0x3886ae)[_0x547c('0x20')](function(_0x3a6a0a){_0x5b05f2[_0x547c('0x18')]=_0x3a6a0a;if(_0x17fa33['query'][_0x547c('0x3c')]){_0x39c5f9[_0x547c('0x3d')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x547c('0x3e')](_0x39c5f9);})[_0x547c('0x20')](function(_0x9c3cb2){_0x5b05f2['rows']=_0x9c3cb2;return _0x5b05f2;})[_0x547c('0x20')](respondWithFilteredResult(_0x507895,_0x39c5f9))['catch'](handleError(_0x507895,null));};exports[_0x547c('0x3f')]=function(_0x5393a2,_0xb86f5f){var _0x414b9d={'raw':!![],'where':{'id':_0x5393a2[_0x547c('0x40')]['id']}},_0x3d37d7={};_0x3d37d7[_0x547c('0x2d')]=_[_0x547c('0x27')](db['OpenchannelQueueReport']['rawAttributes']);_0x3d37d7[_0x547c('0x28')]=_[_0x547c('0x27')](_0x5393a2[_0x547c('0x28')]);_0x3d37d7['filters']=_[_0x547c('0x2c')](_0x3d37d7[_0x547c('0x2d')],_0x3d37d7[_0x547c('0x28')]);_0x414b9d[_0x547c('0x2e')]=_[_0x547c('0x2c')](_0x3d37d7[_0x547c('0x2d')],qs['fields'](_0x5393a2[_0x547c('0x28')][_0x547c('0x2f')]));_0x414b9d[_0x547c('0x2e')]=_0x414b9d['attributes'][_0x547c('0x30')]?_0x414b9d[_0x547c('0x2e')]:_0x3d37d7[_0x547c('0x2d')];if(_0x5393a2[_0x547c('0x28')]['includeAll']){_0x414b9d[_0x547c('0x3d')]=[{'all':!![]}];}_0x414b9d=_['merge']({},_0x414b9d,_0x5393a2[_0x547c('0x41')]);return db['OpenchannelQueueReport'][_0x547c('0x42')](_0x414b9d)[_0x547c('0x20')](handleEntityNotFound(_0xb86f5f,null))['then'](respondWithResult(_0xb86f5f,null))[_0x547c('0x43')](handleError(_0xb86f5f,null));};exports[_0x547c('0x44')]=function(_0xa005cc,_0x1ddf30){return db['OpenchannelQueueReport'][_0x547c('0x44')](_0xa005cc['body'],{})['then'](respondWithResult(_0x1ddf30,0xc9))[_0x547c('0x43')](handleError(_0x1ddf30,null));};exports[_0x547c('0x1f')]=function(_0x3e3f52,_0x11a878){if(_0x3e3f52[_0x547c('0x45')]['id']){delete _0x3e3f52[_0x547c('0x45')]['id'];}return db[_0x547c('0x3b')][_0x547c('0x42')]({'where':{'id':_0x3e3f52[_0x547c('0x40')]['id']}})[_0x547c('0x20')](handleEntityNotFound(_0x11a878,null))[_0x547c('0x20')](saveUpdates(_0x3e3f52[_0x547c('0x45')],null))['then'](respondWithResult(_0x11a878,null))['catch'](handleError(_0x11a878,null));};exports[_0x547c('0x46')]=function(_0x21ea26,_0x48de6e){return db[_0x547c('0x3b')][_0x547c('0x42')]({'where':{'id':_0x21ea26[_0x547c('0x40')]['id']}})[_0x547c('0x20')](handleEntityNotFound(_0x48de6e,null))[_0x547c('0x20')](removeEntity(_0x48de6e,null))[_0x547c('0x43')](handleError(_0x48de6e,null));};exports['describe']=function(_0x152982,_0x5258cf){return db[_0x547c('0x3b')][_0x547c('0x47')]()[_0x547c('0x20')](respondWithResult(_0x5258cf,null))['catch'](handleError(_0x5258cf,null));}; \ No newline at end of file +var _0xe2cf=['order','sort','where','pick','add','day','merge','map','filter','options','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','show','params','body','destroy','describe','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','desk.js','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit'];(function(_0x2e8dd7,_0x2d334e){var _0x164ddb=function(_0xb129c1){while(--_0xb129c1){_0x2e8dd7['push'](_0x2e8dd7['shift']());}};_0x164ddb(++_0x2d334e);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x3fcc20,_0x57c31b){_0x3fcc20=_0x3fcc20-0x0;var _0x15d3ce=_0xe2cf[_0x3fcc20];return _0x15d3ce;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xfe2c('0x0'));var moment=require('moment');var BPromise=require(_0xfe2c('0x1'));var Mustache=require('mustache');var util=require(_0xfe2c('0x2'));var path=require(_0xfe2c('0x3'));var sox=require(_0xfe2c('0x4'));var csv=require(_0xfe2c('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfe2c('0x6'));var squel=require(_0xfe2c('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfe2c('0x8'));var toCsv=require(_0xfe2c('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0xfe2c('0x9'));var logger=require(_0xfe2c('0xa'))(_0xfe2c('0xb'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xfe2c('0xc'))['db'];function respondWithStatusCode(_0x15421e,_0x495513){_0x495513=_0x495513||0xcc;return function(_0x22278c){if(_0x22278c){return _0x15421e[_0xfe2c('0xd')](_0x495513);}return _0x15421e[_0xfe2c('0xe')](_0x495513)[_0xfe2c('0xf')]();};}function respondWithResult(_0x325608,_0x45aa82){_0x45aa82=_0x45aa82||0xc8;return function(_0x39ce22){if(_0x39ce22){return _0x325608['status'](_0x45aa82)['json'](_0x39ce22);}};}function respondWithFilteredResult(_0x59ecf8,_0x48ddcc){return function(_0x11eb5e){if(_0x11eb5e){var _0x54d2d4=_0x11eb5e[_0xfe2c('0x10')],_0x5a6ad5=_0x48ddcc[_0xfe2c('0x11')],_0x38ba2c=_0x48ddcc['offset']+_0x48ddcc['limit'],_0x4d0a10;if(_0x38ba2c>=_0x54d2d4){_0x38ba2c=_0x54d2d4;_0x4d0a10=0xc8;}else{_0x4d0a10=0xce;}_0x59ecf8[_0xfe2c('0xe')](_0x4d0a10);return _0x59ecf8[_0xfe2c('0x12')](_0xfe2c('0x13'),_0x5a6ad5+'-'+_0x38ba2c+'/'+_0x54d2d4)[_0xfe2c('0x14')](_0x11eb5e);}return null;};}function patchUpdates(_0x565f40){return function(_0x199075){try{jsonpatch[_0xfe2c('0x15')](_0x199075,_0x565f40,!![]);}catch(_0x135436){return BPromise[_0xfe2c('0x16')](_0x135436);}return _0x199075[_0xfe2c('0x17')]();};}function saveUpdates(_0x13f233,_0x4afea3){return function(_0x22481a){if(_0x22481a){return _0x22481a[_0xfe2c('0x18')](_0x13f233)[_0xfe2c('0x19')](function(_0x51086d){return _0x51086d;});}return null;};}function removeEntity(_0x55f751,_0x1139fe){return function(_0x59bdeb){if(_0x59bdeb){return _0x59bdeb['destroy']()[_0xfe2c('0x19')](function(){_0x55f751[_0xfe2c('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc42d82,_0x1e2519){return function(_0x5e609f){if(!_0x5e609f){_0xc42d82[_0xfe2c('0xd')](0x194);}return _0x5e609f;};}function handleError(_0x5dd54b,_0x4481ff){_0x4481ff=_0x4481ff||0x1f4;return function(_0x466bcd){logger[_0xfe2c('0x1a')](_0x466bcd[_0xfe2c('0x1b')]);if(_0x466bcd[_0xfe2c('0x1c')]){delete _0x466bcd[_0xfe2c('0x1c')];}_0x5dd54b['status'](_0x4481ff)[_0xfe2c('0x1d')](_0x466bcd);};}exports[_0xfe2c('0x1e')]=function(_0xe74ca1,_0x26448c){var _0x3486b5={},_0x10afde={},_0x53bab0={'count':0x0,'rows':[]};var _0x205da8=db['OpenchannelQueueReport'][_0xfe2c('0x1f')];_0x10afde[_0xfe2c('0x20')]=_[_0xfe2c('0x21')](_0x205da8);var _0x54e356={'dateStart':_0xe74ca1[_0xfe2c('0x22')][_0xfe2c('0x23')],'dateEnd':_0xe74ca1['query'][_0xfe2c('0x24')]};delete _0xe74ca1[_0xfe2c('0x22')][_0xfe2c('0x23')];delete _0xe74ca1[_0xfe2c('0x22')][_0xfe2c('0x24')];_0x10afde[_0xfe2c('0x22')]=_['keys'](_0xe74ca1['query']);_0x10afde[_0xfe2c('0x25')]=_[_0xfe2c('0x26')](_0x10afde[_0xfe2c('0x20')],_0x10afde[_0xfe2c('0x22')]);_0x3486b5[_0xfe2c('0x27')]=_['intersection'](_0x10afde[_0xfe2c('0x20')],qs[_0xfe2c('0x28')](_0xe74ca1[_0xfe2c('0x22')][_0xfe2c('0x28')]));_0x3486b5[_0xfe2c('0x27')]=_0x3486b5[_0xfe2c('0x27')][_0xfe2c('0x29')]?_0x3486b5[_0xfe2c('0x27')]:_0x10afde[_0xfe2c('0x20')];if(!_0xe74ca1[_0xfe2c('0x22')][_0xfe2c('0x2a')](_0xfe2c('0x2b'))){_0x3486b5['limit']=qs[_0xfe2c('0x2c')](_0xe74ca1[_0xfe2c('0x22')][_0xfe2c('0x2c')]);_0x3486b5['offset']=qs[_0xfe2c('0x11')](_0xe74ca1[_0xfe2c('0x22')]['offset']);}_0x3486b5[_0xfe2c('0x2d')]=qs[_0xfe2c('0x2e')](_0xe74ca1[_0xfe2c('0x22')]['sort']);_0x3486b5[_0xfe2c('0x2f')]=qs[_0xfe2c('0x25')](_[_0xfe2c('0x30')](_0xe74ca1[_0xfe2c('0x22')],_0x10afde[_0xfe2c('0x25')]));if(_0x54e356[_0xfe2c('0x23')]){if(_0x54e356[_0xfe2c('0x24')]){_0x54e356['dateEnd']=moment(_0x54e356['dateEnd'])[_0xfe2c('0x31')](0x1,_0xfe2c('0x32'));}else{_0x54e356[_0xfe2c('0x24')]=moment(_0x54e356[_0xfe2c('0x23')])['add'](0x1,_0xfe2c('0x32'));}_['merge'](_0x3486b5[_0xfe2c('0x2f')],{'createdAt':{'$gte':_0x54e356[_0xfe2c('0x23')],'$lte':_0x54e356['dateEnd']}});}if(_0xe74ca1[_0xfe2c('0x22')]['filter']){_0x3486b5['where']=_[_0xfe2c('0x33')](_0x3486b5[_0xfe2c('0x2f')],{'$or':_[_0xfe2c('0x34')](_0x3486b5[_0xfe2c('0x27')],function(_0xae2808){var _0x38d2be={};_0x38d2be[_0xae2808]={'$like':'%'+_0xe74ca1[_0xfe2c('0x22')][_0xfe2c('0x35')]+'%'};return _0x38d2be;})});}_0x3486b5=_[_0xfe2c('0x33')]({},_0x3486b5,_0xe74ca1[_0xfe2c('0x36')]);var _0x222335={'where':_0x3486b5['where']};return db[_0xfe2c('0x37')][_0xfe2c('0x10')](_0x222335)[_0xfe2c('0x19')](function(_0x55ea45){_0x53bab0['count']=_0x55ea45;if(_0xe74ca1['query'][_0xfe2c('0x38')]){_0x3486b5[_0xfe2c('0x39')]=[{'all':!![]}];}return db[_0xfe2c('0x37')][_0xfe2c('0x3a')](_0x3486b5);})['then'](function(_0x1ed30b){_0x53bab0[_0xfe2c('0x3b')]=_0x1ed30b;return _0x53bab0;})[_0xfe2c('0x19')](respondWithFilteredResult(_0x26448c,_0x3486b5))[_0xfe2c('0x3c')](handleError(_0x26448c,null));};exports[_0xfe2c('0x3d')]=function(_0x48e361,_0x5a8d4e){var _0xeb04b9={'raw':!![],'where':{'id':_0x48e361[_0xfe2c('0x3e')]['id']}},_0x6055dd={};_0x6055dd['model']=_['keys'](db[_0xfe2c('0x37')][_0xfe2c('0x1f')]);_0x6055dd['query']=_[_0xfe2c('0x21')](_0x48e361[_0xfe2c('0x22')]);_0x6055dd[_0xfe2c('0x25')]=_[_0xfe2c('0x26')](_0x6055dd['model'],_0x6055dd[_0xfe2c('0x22')]);_0xeb04b9[_0xfe2c('0x27')]=_[_0xfe2c('0x26')](_0x6055dd[_0xfe2c('0x20')],qs[_0xfe2c('0x28')](_0x48e361[_0xfe2c('0x22')][_0xfe2c('0x28')]));_0xeb04b9[_0xfe2c('0x27')]=_0xeb04b9['attributes'][_0xfe2c('0x29')]?_0xeb04b9['attributes']:_0x6055dd[_0xfe2c('0x20')];if(_0x48e361[_0xfe2c('0x22')][_0xfe2c('0x38')]){_0xeb04b9[_0xfe2c('0x39')]=[{'all':!![]}];}_0xeb04b9=_['merge']({},_0xeb04b9,_0x48e361['options']);return db['OpenchannelQueueReport']['find'](_0xeb04b9)['then'](handleEntityNotFound(_0x5a8d4e,null))[_0xfe2c('0x19')](respondWithResult(_0x5a8d4e,null))['catch'](handleError(_0x5a8d4e,null));};exports['create']=function(_0x22adee,_0x5d76be){return db[_0xfe2c('0x37')]['create'](_0x22adee[_0xfe2c('0x3f')],{})[_0xfe2c('0x19')](respondWithResult(_0x5d76be,0xc9))[_0xfe2c('0x3c')](handleError(_0x5d76be,null));};exports[_0xfe2c('0x18')]=function(_0x3cfda2,_0x57ad76){if(_0x3cfda2[_0xfe2c('0x3f')]['id']){delete _0x3cfda2[_0xfe2c('0x3f')]['id'];}return db[_0xfe2c('0x37')]['find']({'where':{'id':_0x3cfda2[_0xfe2c('0x3e')]['id']}})[_0xfe2c('0x19')](handleEntityNotFound(_0x57ad76,null))['then'](saveUpdates(_0x3cfda2['body'],null))['then'](respondWithResult(_0x57ad76,null))[_0xfe2c('0x3c')](handleError(_0x57ad76,null));};exports[_0xfe2c('0x40')]=function(_0x47023e,_0x2e0012){return db[_0xfe2c('0x37')]['find']({'where':{'id':_0x47023e[_0xfe2c('0x3e')]['id']}})[_0xfe2c('0x19')](handleEntityNotFound(_0x2e0012,null))[_0xfe2c('0x19')](removeEntity(_0x2e0012,null))['catch'](handleError(_0x2e0012,null));};exports['describe']=function(_0x3e7c9f,_0xa711b0){return db[_0xfe2c('0x37')][_0xfe2c('0x41')]()[_0xfe2c('0x19')](respondWithResult(_0xa711b0,null))[_0xfe2c('0x3c')](handleError(_0xa711b0,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index ce9b789..3e4eb6e 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 _0xe8eb=['moment','bluebird','request-promise','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util','../../config/logger'];(function(_0x41caac,_0x50c421){var _0x28d2ba=function(_0x2a2e12){while(--_0x2a2e12){_0x41caac['push'](_0x41caac['shift']());}};_0x28d2ba(++_0x50c421);}(_0xe8eb,0xce));var _0xbe8e=function(_0x1f1b89,_0x21f436){_0x1f1b89=_0x1f1b89-0x0;var _0x5ef63a=_0xe8eb[_0x1f1b89];return _0x5ef63a;};'use strict';var _=require(_0xbe8e('0x0'));var util=require(_0xbe8e('0x1'));var logger=require(_0xbe8e('0x2'))('api');var moment=require(_0xbe8e('0x3'));var BPromise=require(_0xbe8e('0x4'));var rp=require(_0xbe8e('0x5'));var attributes=require(_0xbe8e('0x6'));module[_0xbe8e('0x7')]=function(_0x3e8c47,_0x48fbfa){return _0x3e8c47[_0xbe8e('0x8')](_0xbe8e('0x9'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xbe8e('0xa'),'fields':[_0xbe8e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5900=['define','OpenchannelQueueReport','uniqueid','util','../../config/logger','moment','bluebird','request-promise','exports'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x5900,0xd2));var _0x0590=function(_0x3e37b3,_0x570305){_0x3e37b3=_0x3e37b3-0x0;var _0x47e724=_0x5900[_0x3e37b3];return _0x47e724;};'use strict';var _=require('lodash');var util=require(_0x0590('0x0'));var logger=require(_0x0590('0x1'))('api');var moment=require(_0x0590('0x2'));var BPromise=require(_0x0590('0x3'));var rp=require(_0x0590('0x4'));var attributes=require('./openchannelQueueReport.attributes');module[_0x0590('0x5')]=function(_0x37f641,_0x5d5690){return _0x37f641[_0x0590('0x6')](_0x0590('0x7'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0x0590('0x8'),'fields':[_0x0590('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 908d11c..599b6f2 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 _0xa3c0=['error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','options','raw','debug','UpdateOpenchannelQueueReport','where','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xe891e2,_0xff02ea){var _0x20d382=function(_0x3e3f6f){while(--_0x3e3f6f){_0xe891e2['push'](_0xe891e2['shift']());}};_0x20d382(++_0xff02ea);}(_0xa3c0,0x11f));var _0x0a3c=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0xa3c0[_0x236d24];return _0x1574cf;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0a3c('0x0'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x0a3c('0x1'));var logger=require('../../config/logger')(_0x0a3c('0x2'));var config=require(_0x0a3c('0x3'));var jayson=require(_0x0a3c('0x4'));var client=jayson['client'][_0x0a3c('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x2af764,_0x2ae708,_0x44b2a6){return new BPromise(function(_0x2b118c,_0x4dd56e){return client[_0x0a3c('0x6')](_0x2af764,_0x44b2a6)[_0x0a3c('0x7')](function(_0x4fa4d3){logger[_0x0a3c('0x8')](_0x0a3c('0x9'),_0x2ae708,_0x0a3c('0xa'));logger['debug'](_0x0a3c('0xb'),_0x2ae708,_0x0a3c('0xa'),JSON[_0x0a3c('0xc')](_0x4fa4d3));if(_0x4fa4d3[_0x0a3c('0xd')]){if(_0x4fa4d3[_0x0a3c('0xd')][_0x0a3c('0xe')]===0x1f4){logger['error'](_0x0a3c('0x9'),_0x2ae708,_0x4fa4d3[_0x0a3c('0xd')][_0x0a3c('0xf')]);return _0x4dd56e(_0x4fa4d3[_0x0a3c('0xd')][_0x0a3c('0xf')]);}logger[_0x0a3c('0xd')](_0x0a3c('0x9'),_0x2ae708,_0x4fa4d3[_0x0a3c('0xd')][_0x0a3c('0xf')]);return _0x2b118c(_0x4fa4d3[_0x0a3c('0xd')]['message']);}else{logger[_0x0a3c('0x8')](_0x0a3c('0x9'),_0x2ae708,_0x0a3c('0xa'));_0x2b118c(_0x4fa4d3[_0x0a3c('0x10')][_0x0a3c('0xf')]);}})[_0x0a3c('0x11')](function(_0x1b6a67){logger[_0x0a3c('0xd')](_0x0a3c('0x9'),_0x2ae708,_0x1b6a67);_0x4dd56e(_0x1b6a67);});});}exports[_0x0a3c('0x12')]=function(_0x1dc1cb){var _0x50a02d=this;return new Promise(function(_0x3c2dd2,_0x12fbe6){return db[_0x0a3c('0x13')]['create'](_0x1dc1cb['body'],{'raw':_0x1dc1cb[_0x0a3c('0x14')]?_0x1dc1cb[_0x0a3c('0x14')][_0x0a3c('0x15')]===undefined?!![]:![]:!![]})[_0x0a3c('0x7')](function(_0x185867){logger[_0x0a3c('0x8')](_0x0a3c('0x12'),_0x1dc1cb);logger[_0x0a3c('0x16')](_0x0a3c('0x12'),_0x1dc1cb,JSON[_0x0a3c('0xc')](_0x185867));_0x3c2dd2(_0x185867);})[_0x0a3c('0x11')](function(_0x128509){logger[_0x0a3c('0xd')](_0x0a3c('0x12'),_0x128509[_0x0a3c('0xf')],_0x1dc1cb);_0x12fbe6(_0x50a02d[_0x0a3c('0xd')](0x1f4,_0x128509['message']));});});};exports[_0x0a3c('0x17')]=function(_0x14da60){var _0x59a837=this;return new Promise(function(_0x4264b4,_0x5242f4){return db['OpenchannelQueueReport']['update'](_0x14da60['body'],{'raw':_0x14da60['options']?_0x14da60[_0x0a3c('0x14')][_0x0a3c('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14da60[_0x0a3c('0x14')]?_0x14da60[_0x0a3c('0x14')][_0x0a3c('0x18')]||null:null,'attributes':_0x14da60['options']?_0x14da60['options']['attributes']||null:null,'limit':_0x14da60[_0x0a3c('0x14')]?_0x14da60[_0x0a3c('0x14')]['limit']||null:null})['then'](function(_0x3cf249){logger['info'](_0x0a3c('0x17'),_0x14da60);logger['debug'](_0x0a3c('0x17'),_0x14da60,JSON['stringify'](_0x3cf249));_0x4264b4(_0x3cf249);})['catch'](function(_0x391c1a){logger['error']('UpdateOpenchannelQueueReport',_0x391c1a[_0x0a3c('0xf')],_0x14da60);_0x5242f4(_0x59a837[_0x0a3c('0xd')](0x1f4,_0x391c1a['message']));});});}; \ No newline at end of file +var _0x4cf9=['message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','attributes','limit','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x19c0ea,_0x5973a8){var _0x3700e8=function(_0x2b6fbb){while(--_0x2b6fbb){_0x19c0ea['push'](_0x19c0ea['shift']());}};_0x3700e8(++_0x5973a8);}(_0x4cf9,0x105));var _0x94cf=function(_0x465f08,_0x3ead4d){_0x465f08=_0x465f08-0x0;var _0x12a0d9=_0x4cf9[_0x465f08];return _0x12a0d9;};'use strict';var _=require('lodash');var util=require(_0x94cf('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x94cf('0x1'));var fs=require('fs');var db=require(_0x94cf('0x2'))['db'];var utils=require(_0x94cf('0x3'));var logger=require(_0x94cf('0x4'))(_0x94cf('0x5'));var config=require(_0x94cf('0x6'));var jayson=require(_0x94cf('0x7'));var client=jayson[_0x94cf('0x8')][_0x94cf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f3378,_0x2f740a,_0x8260d9){return new BPromise(function(_0x8d5222,_0x1a89d4){return client[_0x94cf('0xa')](_0x2f3378,_0x8260d9)[_0x94cf('0xb')](function(_0x568d79){logger['info'](_0x94cf('0xc'),_0x2f740a,_0x94cf('0xd'));logger[_0x94cf('0xe')](_0x94cf('0xf'),_0x2f740a,_0x94cf('0xd'),JSON[_0x94cf('0x10')](_0x568d79));if(_0x568d79[_0x94cf('0x11')]){if(_0x568d79[_0x94cf('0x11')]['code']===0x1f4){logger['error'](_0x94cf('0xc'),_0x2f740a,_0x568d79['error'][_0x94cf('0x12')]);return _0x1a89d4(_0x568d79['error'][_0x94cf('0x12')]);}logger[_0x94cf('0x11')](_0x94cf('0xc'),_0x2f740a,_0x568d79['error'][_0x94cf('0x12')]);return _0x8d5222(_0x568d79['error'][_0x94cf('0x12')]);}else{logger[_0x94cf('0x13')](_0x94cf('0xc'),_0x2f740a,_0x94cf('0xd'));_0x8d5222(_0x568d79[_0x94cf('0x14')][_0x94cf('0x12')]);}})[_0x94cf('0x15')](function(_0x326ad0){logger[_0x94cf('0x11')](_0x94cf('0xc'),_0x2f740a,_0x326ad0);_0x1a89d4(_0x326ad0);});});}exports[_0x94cf('0x16')]=function(_0xfc13be){var _0x4543d6=this;return new Promise(function(_0x9e6e4b,_0x2c6a6f){return db[_0x94cf('0x17')][_0x94cf('0x18')](_0xfc13be[_0x94cf('0x19')],{'raw':_0xfc13be[_0x94cf('0x1a')]?_0xfc13be[_0x94cf('0x1a')][_0x94cf('0x1b')]===undefined?!![]:![]:!![]})[_0x94cf('0xb')](function(_0x196983){logger['info'](_0x94cf('0x16'),_0xfc13be);logger[_0x94cf('0xe')](_0x94cf('0x16'),_0xfc13be,JSON[_0x94cf('0x10')](_0x196983));_0x9e6e4b(_0x196983);})[_0x94cf('0x15')](function(_0x43be2d){logger[_0x94cf('0x11')](_0x94cf('0x16'),_0x43be2d[_0x94cf('0x12')],_0xfc13be);_0x2c6a6f(_0x4543d6[_0x94cf('0x11')](0x1f4,_0x43be2d['message']));});});};exports[_0x94cf('0x1c')]=function(_0x30ae85){var _0x56a96e=this;return new Promise(function(_0x2931e8,_0x37c87b){return db[_0x94cf('0x17')]['update'](_0x30ae85[_0x94cf('0x19')],{'raw':_0x30ae85[_0x94cf('0x1a')]?_0x30ae85[_0x94cf('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30ae85[_0x94cf('0x1a')]?_0x30ae85['options']['where']||null:null,'attributes':_0x30ae85[_0x94cf('0x1a')]?_0x30ae85[_0x94cf('0x1a')][_0x94cf('0x1d')]||null:null,'limit':_0x30ae85[_0x94cf('0x1a')]?_0x30ae85[_0x94cf('0x1a')][_0x94cf('0x1e')]||null:null})[_0x94cf('0xb')](function(_0x467c3d){logger[_0x94cf('0x13')]('UpdateOpenchannelQueueReport',_0x30ae85);logger[_0x94cf('0xe')](_0x94cf('0x1c'),_0x30ae85,JSON[_0x94cf('0x10')](_0x467c3d));_0x2931e8(_0x467c3d);})[_0x94cf('0x15')](function(_0x2dff46){logger[_0x94cf('0x11')](_0x94cf('0x1c'),_0x2dff46['message'],_0x30ae85);_0x37c87b(_0x56a96e[_0x94cf('0x11')](0x1f4,_0x2dff46[_0x94cf('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 1d6efad..6636d8a 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 _0x9387=['isAuthenticated','show','put','update','delete','destroy','multer','util','path','express','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','index','/describe','/:id'];(function(_0x211f6a,_0x1a2e20){var _0x3aaff0=function(_0x1c866d){while(--_0x1c866d){_0x211f6a['push'](_0x211f6a['shift']());}};_0x3aaff0(++_0x1a2e20);}(_0x9387,0x8e));var _0x7938=function(_0x2442ba,_0xc22da){_0x2442ba=_0x2442ba-0x0;var _0x2913d0=_0x9387[_0x2442ba];return _0x2913d0;};'use strict';var multer=require(_0x7938('0x0'));var util=require(_0x7938('0x1'));var path=require(_0x7938('0x2'));var express=require(_0x7938('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7938('0x4'));var config=require(_0x7938('0x5'));var controller=require(_0x7938('0x6'));router[_0x7938('0x7')]('/',auth['isAuthenticated'](),controller[_0x7938('0x8')]);router[_0x7938('0x7')](_0x7938('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x7938('0x7')](_0x7938('0xa'),auth[_0x7938('0xb')](),controller[_0x7938('0xc')]);router['post']('/',auth[_0x7938('0xb')](),controller['create']);router[_0x7938('0xd')](_0x7938('0xa'),auth[_0x7938('0xb')](),controller[_0x7938('0xe')]);router[_0x7938('0xf')]('/:id',auth[_0x7938('0xb')](),controller[_0x7938('0x10')]);module['exports']=router; \ No newline at end of file +var _0x05e2=['post','create','put','update','delete','destroy','exports','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x17dbfc,_0x8a72ec){var _0x4dd598=function(_0x17405a){while(--_0x17405a){_0x17dbfc['push'](_0x17dbfc['shift']());}};_0x4dd598(++_0x8a72ec);}(_0x05e2,0x115));var _0x205e=function(_0x5b89a0,_0x315a2a){_0x5b89a0=_0x5b89a0-0x0;var _0x44d81a=_0x05e2[_0x5b89a0];return _0x44d81a;};'use strict';var multer=require(_0x205e('0x0'));var util=require(_0x205e('0x1'));var path=require('path');var express=require('express');var router=express['Router']();var auth=require(_0x205e('0x2'));var interaction=require(_0x205e('0x3'));var config=require(_0x205e('0x4'));var controller=require(_0x205e('0x5'));router[_0x205e('0x6')]('/',auth[_0x205e('0x7')](),controller[_0x205e('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x205e('0x6')](_0x205e('0x9'),auth['isAuthenticated'](),controller[_0x205e('0xa')]);router[_0x205e('0xb')]('/',auth[_0x205e('0x7')](),controller[_0x205e('0xc')]);router[_0x205e('0xd')]('/:id',auth[_0x205e('0x7')](),controller[_0x205e('0xe')]);router[_0x205e('0xf')](_0x205e('0x9'),auth[_0x205e('0x7')](),controller[_0x205e('0x10')]);module[_0x205e('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index f99518d..64826e3 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 _0xfe06=['STRING','ENUM','account','queue','DATE','NOW','sequelize','exports'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0xfe06,0x18e));var _0x6fe0=function(_0x7ca275,_0x598d24){_0x7ca275=_0x7ca275-0x0;var _0x20bd00=_0xfe06[_0x7ca275];return _0x20bd00;};'use strict';var moment=require('moment');var Sequelize=require(_0x6fe0('0x0'));module[_0x6fe0('0x1')]={'uniqueid':{'type':Sequelize[_0x6fe0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6fe0('0x3')](_0x6fe0('0x4'),'agent',_0x6fe0('0x5')),'allowNull':![],'defaultValue':_0x6fe0('0x5')},'transferredAt':{'type':Sequelize[_0x6fe0('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x6fe0('0x7')]}}; \ No newline at end of file +var _0x918d=['DATE','NOW','STRING','account','agent','queue'];(function(_0x123564,_0x5d63fb){var _0x3f7484=function(_0x41bbe5){while(--_0x41bbe5){_0x123564['push'](_0x123564['shift']());}};_0x3f7484(++_0x5d63fb);}(_0x918d,0xf8));var _0xd918=function(_0x74f979,_0x3f5b22){_0x74f979=_0x74f979-0x0;var _0x546238=_0x918d[_0x74f979];return _0x546238;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xd918('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xd918('0x1'),_0xd918('0x2'),_0xd918('0x3')),'allowNull':![],'defaultValue':_0xd918('0x3')},'transferredAt':{'type':Sequelize[_0xd918('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xd918('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 1402e20..16ae99d 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 _0x033e=['findAll','rows','show','find','create','update','body','catch','describe','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','api','../../mysqldb','end','json','count','offset','limit','status','set','Content-Range','apply','destroy','then','sendStatus','error','name','index','OpenchannelTransferReport','rawAttributes','model','keys','dateStart','query','dateEnd','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','add','day','where','filter','map','merge','options','includeAll','include'];(function(_0x2db629,_0x316c51){var _0x474ccc=function(_0xcb9c12){while(--_0xcb9c12){_0x2db629['push'](_0x2db629['shift']());}};_0x474ccc(++_0x316c51);}(_0x033e,0x87));var _0xe033=function(_0x96b6a,_0x12471d){_0x96b6a=_0x96b6a-0x0;var _0x3e16f3=_0x033e[_0x96b6a];return _0x3e16f3;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xe033('0x0'));var moment=require(_0xe033('0x1'));var BPromise=require(_0xe033('0x2'));var Mustache=require(_0xe033('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe033('0x4'));var ejs=require(_0xe033('0x5'));var fs=require('fs');var _=require(_0xe033('0x6'));var squel=require(_0xe033('0x7'));var crypto=require('crypto');var jsforce=require(_0xe033('0x8'));var deskjs=require(_0xe033('0x9'));var toCsv=require('to-csv');var querystring=require(_0xe033('0xa'));var Papa=require('papaparse');var qs=require(_0xe033('0xb'));var logger=require('../../config/logger')(_0xe033('0xc'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xe033('0xd'))['db'];function respondWithStatusCode(_0x37d65a,_0x39a78d){_0x39a78d=_0x39a78d||0xcc;return function(_0x2eee42){if(_0x2eee42){return _0x37d65a['sendStatus'](_0x39a78d);}return _0x37d65a['status'](_0x39a78d)[_0xe033('0xe')]();};}function respondWithResult(_0x1b3de5,_0x19c61c){_0x19c61c=_0x19c61c||0xc8;return function(_0x5b8e65){if(_0x5b8e65){return _0x1b3de5['status'](_0x19c61c)[_0xe033('0xf')](_0x5b8e65);}};}function respondWithFilteredResult(_0xdbdfc8,_0x355f2a){return function(_0x574d29){if(_0x574d29){var _0x353d1b=_0x574d29[_0xe033('0x10')],_0x1e7494=_0x355f2a[_0xe033('0x11')],_0x2cb37d=_0x355f2a[_0xe033('0x11')]+_0x355f2a[_0xe033('0x12')],_0x260124;if(_0x2cb37d>=_0x353d1b){_0x2cb37d=_0x353d1b;_0x260124=0xc8;}else{_0x260124=0xce;}_0xdbdfc8[_0xe033('0x13')](_0x260124);return _0xdbdfc8[_0xe033('0x14')](_0xe033('0x15'),_0x1e7494+'-'+_0x2cb37d+'/'+_0x353d1b)['json'](_0x574d29);}return null;};}function patchUpdates(_0x5ab505){return function(_0x7745b1){try{jsonpatch[_0xe033('0x16')](_0x7745b1,_0x5ab505,!![]);}catch(_0x306259){return BPromise['reject'](_0x306259);}return _0x7745b1['save']();};}function saveUpdates(_0x28329b,_0x1f3d29){return function(_0x44fc23){if(_0x44fc23){return _0x44fc23['update'](_0x28329b)['then'](function(_0x27f4e7){return _0x27f4e7;});}return null;};}function removeEntity(_0x578b8c,_0xb3d182){return function(_0x1fae53){if(_0x1fae53){return _0x1fae53[_0xe033('0x17')]()[_0xe033('0x18')](function(){_0x578b8c[_0xe033('0x13')](0xcc)[_0xe033('0xe')]();});}};}function handleEntityNotFound(_0x21fb57,_0x134f93){return function(_0x3bd381){if(!_0x3bd381){_0x21fb57[_0xe033('0x19')](0x194);}return _0x3bd381;};}function handleError(_0x3ef474,_0x2603c5){_0x2603c5=_0x2603c5||0x1f4;return function(_0x36ee92){logger[_0xe033('0x1a')](_0x36ee92['stack']);if(_0x36ee92[_0xe033('0x1b')]){delete _0x36ee92[_0xe033('0x1b')];}_0x3ef474[_0xe033('0x13')](_0x2603c5)['send'](_0x36ee92);};}exports[_0xe033('0x1c')]=function(_0x357ccb,_0x16dd5e){var _0x24e8f5={},_0x1197be={},_0x235003={'count':0x0,'rows':[]};var _0x53dd26=db[_0xe033('0x1d')][_0xe033('0x1e')];_0x1197be[_0xe033('0x1f')]=_[_0xe033('0x20')](_0x53dd26);var _0x5638a3={'dateStart':_0x357ccb['query'][_0xe033('0x21')],'dateEnd':_0x357ccb[_0xe033('0x22')][_0xe033('0x23')]};delete _0x357ccb['query']['dateStart'];delete _0x357ccb[_0xe033('0x22')][_0xe033('0x23')];_0x1197be['query']=_['keys'](_0x357ccb['query']);_0x1197be['filters']=_[_0xe033('0x24')](_0x1197be[_0xe033('0x1f')],_0x1197be[_0xe033('0x22')]);_0x24e8f5[_0xe033('0x25')]=_[_0xe033('0x24')](_0x1197be['model'],qs[_0xe033('0x26')](_0x357ccb[_0xe033('0x22')]['fields']));_0x24e8f5[_0xe033('0x25')]=_0x24e8f5[_0xe033('0x25')][_0xe033('0x27')]?_0x24e8f5[_0xe033('0x25')]:_0x1197be[_0xe033('0x1f')];if(!_0x357ccb[_0xe033('0x22')]['hasOwnProperty'](_0xe033('0x28'))){_0x24e8f5[_0xe033('0x12')]=qs[_0xe033('0x12')](_0x357ccb[_0xe033('0x22')][_0xe033('0x12')]);_0x24e8f5['offset']=qs[_0xe033('0x11')](_0x357ccb[_0xe033('0x22')][_0xe033('0x11')]);}_0x24e8f5[_0xe033('0x29')]=qs[_0xe033('0x2a')](_0x357ccb[_0xe033('0x22')][_0xe033('0x2a')]);_0x24e8f5['where']=qs[_0xe033('0x2b')](_[_0xe033('0x2c')](_0x357ccb[_0xe033('0x22')],_0x1197be[_0xe033('0x2b')]));if(_0x5638a3[_0xe033('0x21')]){if(_0x5638a3['dateEnd']){_0x5638a3[_0xe033('0x23')]=moment(_0x5638a3[_0xe033('0x23')])[_0xe033('0x2d')](0x1,'day');}else{_0x5638a3[_0xe033('0x23')]=moment(_0x5638a3[_0xe033('0x21')])[_0xe033('0x2d')](0x1,_0xe033('0x2e'));}_['merge'](_0x24e8f5[_0xe033('0x2f')],{'createdAt':{'$gte':_0x5638a3[_0xe033('0x21')],'$lte':_0x5638a3['dateEnd']}});}if(_0x357ccb[_0xe033('0x22')][_0xe033('0x30')]){_0x24e8f5[_0xe033('0x2f')]=_['merge'](_0x24e8f5[_0xe033('0x2f')],{'$or':_[_0xe033('0x31')](_0x24e8f5['attributes'],function(_0x52dde6){var _0xa45af0={};_0xa45af0[_0x52dde6]={'$like':'%'+_0x357ccb[_0xe033('0x22')][_0xe033('0x30')]+'%'};return _0xa45af0;})});}_0x24e8f5=_[_0xe033('0x32')]({},_0x24e8f5,_0x357ccb[_0xe033('0x33')]);var _0x323873={'where':_0x24e8f5[_0xe033('0x2f')]};return db[_0xe033('0x1d')][_0xe033('0x10')](_0x323873)['then'](function(_0x3daa9c){_0x235003['count']=_0x3daa9c;if(_0x357ccb[_0xe033('0x22')][_0xe033('0x34')]){_0x24e8f5[_0xe033('0x35')]=[{'all':!![]}];}return db[_0xe033('0x1d')][_0xe033('0x36')](_0x24e8f5);})[_0xe033('0x18')](function(_0x336cb7){_0x235003[_0xe033('0x37')]=_0x336cb7;return _0x235003;})[_0xe033('0x18')](respondWithFilteredResult(_0x16dd5e,_0x24e8f5))['catch'](handleError(_0x16dd5e,null));};exports[_0xe033('0x38')]=function(_0x5df62b,_0x223066){var _0x10c64b={'raw':!![],'where':{'id':_0x5df62b['params']['id']}},_0x4a4d1d={};_0x4a4d1d[_0xe033('0x1f')]=_['keys'](db[_0xe033('0x1d')][_0xe033('0x1e')]);_0x4a4d1d['query']=_[_0xe033('0x20')](_0x5df62b[_0xe033('0x22')]);_0x4a4d1d[_0xe033('0x2b')]=_['intersection'](_0x4a4d1d['model'],_0x4a4d1d['query']);_0x10c64b['attributes']=_['intersection'](_0x4a4d1d[_0xe033('0x1f')],qs[_0xe033('0x26')](_0x5df62b[_0xe033('0x22')][_0xe033('0x26')]));_0x10c64b['attributes']=_0x10c64b[_0xe033('0x25')][_0xe033('0x27')]?_0x10c64b[_0xe033('0x25')]:_0x4a4d1d['model'];if(_0x5df62b[_0xe033('0x22')][_0xe033('0x34')]){_0x10c64b[_0xe033('0x35')]=[{'all':!![]}];}_0x10c64b=_[_0xe033('0x32')]({},_0x10c64b,_0x5df62b[_0xe033('0x33')]);return db[_0xe033('0x1d')][_0xe033('0x39')](_0x10c64b)[_0xe033('0x18')](handleEntityNotFound(_0x223066,null))[_0xe033('0x18')](respondWithResult(_0x223066,null))['catch'](handleError(_0x223066,null));};exports[_0xe033('0x3a')]=function(_0x1113a8,_0x1716c9){return db[_0xe033('0x1d')]['create'](_0x1113a8['body'],{})[_0xe033('0x18')](respondWithResult(_0x1716c9,0xc9))['catch'](handleError(_0x1716c9,null));};exports[_0xe033('0x3b')]=function(_0x2e41ed,_0x5228c5){if(_0x2e41ed[_0xe033('0x3c')]['id']){delete _0x2e41ed[_0xe033('0x3c')]['id'];}return db[_0xe033('0x1d')]['find']({'where':{'id':_0x2e41ed['params']['id']}})[_0xe033('0x18')](handleEntityNotFound(_0x5228c5,null))[_0xe033('0x18')](saveUpdates(_0x2e41ed[_0xe033('0x3c')],null))[_0xe033('0x18')](respondWithResult(_0x5228c5,null))[_0xe033('0x3d')](handleError(_0x5228c5,null));};exports[_0xe033('0x17')]=function(_0x5dee2c,_0x258701){return db[_0xe033('0x1d')][_0xe033('0x39')]({'where':{'id':_0x5dee2c['params']['id']}})[_0xe033('0x18')](handleEntityNotFound(_0x258701,null))[_0xe033('0x18')](removeEntity(_0x258701,null))[_0xe033('0x3d')](handleError(_0x258701,null));};exports['describe']=function(_0x54ce89,_0x3bbe94){return db[_0xe033('0x1d')][_0xe033('0x3e')]()['then'](respondWithResult(_0x3bbe94,null))[_0xe033('0x3d')](handleError(_0x3bbe94,null));}; \ No newline at end of file +var _0xfe5c=['Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','OpenchannelTransferReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','order','sort','pick','add','day','where','filter','merge','map','includeAll','include','findAll','rows','show','params','length','options','find','catch','create','body','describe','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set'];(function(_0x3bbcb5,_0x27b897){var _0x2d63be=function(_0x5c1e35){while(--_0x5c1e35){_0x3bbcb5['push'](_0x3bbcb5['shift']());}};_0x2d63be(++_0x27b897);}(_0xfe5c,0xb8));var _0xcfe5=function(_0x118e8c,_0x47b98d){_0x118e8c=_0x118e8c-0x0;var _0x31c9dd=_0xfe5c[_0x118e8c];return _0x31c9dd;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xcfe5('0x0'));var moment=require(_0xcfe5('0x1'));var BPromise=require(_0xcfe5('0x2'));var Mustache=require('mustache');var util=require(_0xcfe5('0x3'));var path=require(_0xcfe5('0x4'));var sox=require(_0xcfe5('0x5'));var csv=require(_0xcfe5('0x6'));var ejs=require(_0xcfe5('0x7'));var fs=require('fs');var _=require(_0xcfe5('0x8'));var squel=require(_0xcfe5('0x9'));var crypto=require(_0xcfe5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xcfe5('0xb'));var toCsv=require('to-csv');var querystring=require(_0xcfe5('0xc'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0xcfe5('0xd'))(_0xcfe5('0xe'));var utils=require(_0xcfe5('0xf'));var config=require(_0xcfe5('0x10'));var db=require(_0xcfe5('0x11'))['db'];function respondWithStatusCode(_0x3bafbe,_0x12ff4d){_0x12ff4d=_0x12ff4d||0xcc;return function(_0x83e085){if(_0x83e085){return _0x3bafbe[_0xcfe5('0x12')](_0x12ff4d);}return _0x3bafbe['status'](_0x12ff4d)[_0xcfe5('0x13')]();};}function respondWithResult(_0x3cc276,_0xec66c6){_0xec66c6=_0xec66c6||0xc8;return function(_0x32fec9){if(_0x32fec9){return _0x3cc276[_0xcfe5('0x14')](_0xec66c6)[_0xcfe5('0x15')](_0x32fec9);}};}function respondWithFilteredResult(_0x771066,_0x41485f){return function(_0x39fa65){if(_0x39fa65){var _0x28a67c=_0x39fa65[_0xcfe5('0x16')],_0x26fc69=_0x41485f[_0xcfe5('0x17')],_0x177c1a=_0x41485f[_0xcfe5('0x17')]+_0x41485f[_0xcfe5('0x18')],_0x418c9d;if(_0x177c1a>=_0x28a67c){_0x177c1a=_0x28a67c;_0x418c9d=0xc8;}else{_0x418c9d=0xce;}_0x771066[_0xcfe5('0x14')](_0x418c9d);return _0x771066[_0xcfe5('0x19')](_0xcfe5('0x1a'),_0x26fc69+'-'+_0x177c1a+'/'+_0x28a67c)['json'](_0x39fa65);}return null;};}function patchUpdates(_0xb2f4ad){return function(_0xcd82a5){try{jsonpatch['apply'](_0xcd82a5,_0xb2f4ad,!![]);}catch(_0x22711f){return BPromise[_0xcfe5('0x1b')](_0x22711f);}return _0xcd82a5[_0xcfe5('0x1c')]();};}function saveUpdates(_0x2302dd,_0x4924ab){return function(_0x31dbff){if(_0x31dbff){return _0x31dbff[_0xcfe5('0x1d')](_0x2302dd)[_0xcfe5('0x1e')](function(_0x4520e9){return _0x4520e9;});}return null;};}function removeEntity(_0x47ab13,_0x438343){return function(_0x2390f5){if(_0x2390f5){return _0x2390f5[_0xcfe5('0x1f')]()[_0xcfe5('0x1e')](function(){_0x47ab13[_0xcfe5('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4362d6,_0x4805d3){return function(_0x3a64be){if(!_0x3a64be){_0x4362d6['sendStatus'](0x194);}return _0x3a64be;};}function handleError(_0x30f150,_0x462a0c){_0x462a0c=_0x462a0c||0x1f4;return function(_0x18ce6b){logger[_0xcfe5('0x20')](_0x18ce6b[_0xcfe5('0x21')]);if(_0x18ce6b[_0xcfe5('0x22')]){delete _0x18ce6b['name'];}_0x30f150['status'](_0x462a0c)[_0xcfe5('0x23')](_0x18ce6b);};}exports[_0xcfe5('0x24')]=function(_0x93bb47,_0x555a4f){var _0x1e5992={},_0x4a87b7={},_0x3cfb39={'count':0x0,'rows':[]};var _0x3bef8d=db[_0xcfe5('0x25')][_0xcfe5('0x26')];_0x4a87b7[_0xcfe5('0x27')]=_[_0xcfe5('0x28')](_0x3bef8d);var _0x11f213={'dateStart':_0x93bb47[_0xcfe5('0x29')][_0xcfe5('0x2a')],'dateEnd':_0x93bb47[_0xcfe5('0x29')][_0xcfe5('0x2b')]};delete _0x93bb47[_0xcfe5('0x29')][_0xcfe5('0x2a')];delete _0x93bb47[_0xcfe5('0x29')][_0xcfe5('0x2b')];_0x4a87b7[_0xcfe5('0x29')]=_['keys'](_0x93bb47[_0xcfe5('0x29')]);_0x4a87b7[_0xcfe5('0x2c')]=_[_0xcfe5('0x2d')](_0x4a87b7[_0xcfe5('0x27')],_0x4a87b7[_0xcfe5('0x29')]);_0x1e5992['attributes']=_['intersection'](_0x4a87b7[_0xcfe5('0x27')],qs[_0xcfe5('0x2e')](_0x93bb47[_0xcfe5('0x29')]['fields']));_0x1e5992[_0xcfe5('0x2f')]=_0x1e5992[_0xcfe5('0x2f')]['length']?_0x1e5992[_0xcfe5('0x2f')]:_0x4a87b7[_0xcfe5('0x27')];if(!_0x93bb47[_0xcfe5('0x29')]['hasOwnProperty']('nolimit')){_0x1e5992[_0xcfe5('0x18')]=qs['limit'](_0x93bb47[_0xcfe5('0x29')][_0xcfe5('0x18')]);_0x1e5992['offset']=qs['offset'](_0x93bb47[_0xcfe5('0x29')][_0xcfe5('0x17')]);}_0x1e5992[_0xcfe5('0x30')]=qs[_0xcfe5('0x31')](_0x93bb47['query'][_0xcfe5('0x31')]);_0x1e5992['where']=qs[_0xcfe5('0x2c')](_[_0xcfe5('0x32')](_0x93bb47['query'],_0x4a87b7[_0xcfe5('0x2c')]));if(_0x11f213[_0xcfe5('0x2a')]){if(_0x11f213[_0xcfe5('0x2b')]){_0x11f213[_0xcfe5('0x2b')]=moment(_0x11f213[_0xcfe5('0x2b')])[_0xcfe5('0x33')](0x1,_0xcfe5('0x34'));}else{_0x11f213[_0xcfe5('0x2b')]=moment(_0x11f213['dateStart'])[_0xcfe5('0x33')](0x1,_0xcfe5('0x34'));}_['merge'](_0x1e5992[_0xcfe5('0x35')],{'createdAt':{'$gte':_0x11f213['dateStart'],'$lte':_0x11f213[_0xcfe5('0x2b')]}});}if(_0x93bb47[_0xcfe5('0x29')][_0xcfe5('0x36')]){_0x1e5992[_0xcfe5('0x35')]=_[_0xcfe5('0x37')](_0x1e5992[_0xcfe5('0x35')],{'$or':_[_0xcfe5('0x38')](_0x1e5992[_0xcfe5('0x2f')],function(_0x269595){var _0x639390={};_0x639390[_0x269595]={'$like':'%'+_0x93bb47[_0xcfe5('0x29')]['filter']+'%'};return _0x639390;})});}_0x1e5992=_[_0xcfe5('0x37')]({},_0x1e5992,_0x93bb47['options']);var _0x49f367={'where':_0x1e5992[_0xcfe5('0x35')]};return db[_0xcfe5('0x25')][_0xcfe5('0x16')](_0x49f367)['then'](function(_0x5a3622){_0x3cfb39[_0xcfe5('0x16')]=_0x5a3622;if(_0x93bb47['query'][_0xcfe5('0x39')]){_0x1e5992[_0xcfe5('0x3a')]=[{'all':!![]}];}return db[_0xcfe5('0x25')][_0xcfe5('0x3b')](_0x1e5992);})[_0xcfe5('0x1e')](function(_0x5c8f1b){_0x3cfb39[_0xcfe5('0x3c')]=_0x5c8f1b;return _0x3cfb39;})['then'](respondWithFilteredResult(_0x555a4f,_0x1e5992))['catch'](handleError(_0x555a4f,null));};exports[_0xcfe5('0x3d')]=function(_0x481ac4,_0x29221b){var _0x38b6ad={'raw':!![],'where':{'id':_0x481ac4[_0xcfe5('0x3e')]['id']}},_0x219936={};_0x219936[_0xcfe5('0x27')]=_[_0xcfe5('0x28')](db[_0xcfe5('0x25')][_0xcfe5('0x26')]);_0x219936[_0xcfe5('0x29')]=_['keys'](_0x481ac4[_0xcfe5('0x29')]);_0x219936[_0xcfe5('0x2c')]=_[_0xcfe5('0x2d')](_0x219936[_0xcfe5('0x27')],_0x219936[_0xcfe5('0x29')]);_0x38b6ad[_0xcfe5('0x2f')]=_[_0xcfe5('0x2d')](_0x219936[_0xcfe5('0x27')],qs[_0xcfe5('0x2e')](_0x481ac4['query'][_0xcfe5('0x2e')]));_0x38b6ad['attributes']=_0x38b6ad[_0xcfe5('0x2f')][_0xcfe5('0x3f')]?_0x38b6ad[_0xcfe5('0x2f')]:_0x219936['model'];if(_0x481ac4['query'][_0xcfe5('0x39')]){_0x38b6ad['include']=[{'all':!![]}];}_0x38b6ad=_[_0xcfe5('0x37')]({},_0x38b6ad,_0x481ac4[_0xcfe5('0x40')]);return db['OpenchannelTransferReport'][_0xcfe5('0x41')](_0x38b6ad)['then'](handleEntityNotFound(_0x29221b,null))[_0xcfe5('0x1e')](respondWithResult(_0x29221b,null))[_0xcfe5('0x42')](handleError(_0x29221b,null));};exports[_0xcfe5('0x43')]=function(_0xb6cea3,_0x34407b){return db[_0xcfe5('0x25')]['create'](_0xb6cea3['body'],{})[_0xcfe5('0x1e')](respondWithResult(_0x34407b,0xc9))[_0xcfe5('0x42')](handleError(_0x34407b,null));};exports[_0xcfe5('0x1d')]=function(_0x3a9e9a,_0x595e8c){if(_0x3a9e9a[_0xcfe5('0x44')]['id']){delete _0x3a9e9a[_0xcfe5('0x44')]['id'];}return db[_0xcfe5('0x25')]['find']({'where':{'id':_0x3a9e9a[_0xcfe5('0x3e')]['id']}})[_0xcfe5('0x1e')](handleEntityNotFound(_0x595e8c,null))[_0xcfe5('0x1e')](saveUpdates(_0x3a9e9a[_0xcfe5('0x44')],null))['then'](respondWithResult(_0x595e8c,null))['catch'](handleError(_0x595e8c,null));};exports['destroy']=function(_0x29dd8d,_0x49c8af){return db['OpenchannelTransferReport'][_0xcfe5('0x41')]({'where':{'id':_0x29dd8d[_0xcfe5('0x3e')]['id']}})[_0xcfe5('0x1e')](handleEntityNotFound(_0x49c8af,null))[_0xcfe5('0x1e')](removeEntity(_0x49c8af,null))[_0xcfe5('0x42')](handleError(_0x49c8af,null));};exports[_0xcfe5('0x45')]=function(_0x6f75a3,_0x263986){return db[_0xcfe5('0x25')][_0xcfe5('0x45')]()[_0xcfe5('0x1e')](respondWithResult(_0x263986,null))[_0xcfe5('0x42')](handleError(_0x263986,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index b0bf243..1f6b5c1 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(_0x367bf2,_0x313a29){var _0x109455=function(_0x3eaedd){while(--_0x3eaedd){_0x367bf2['push'](_0x367bf2['shift']());}};_0x109455(++_0x313a29);}(_0x7a54,0x106));var _0x47a5=function(_0x9c55f8,_0x3ccfbc){_0x9c55f8=_0x9c55f8-0x0;var _0x58a1d4=_0x7a54[_0x9c55f8];return _0x58a1d4;};'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(_0xc95e22,_0x3bcf55){var _0x178835=function(_0xcba7e){while(--_0xcba7e){_0xc95e22['push'](_0xc95e22['shift']());}};_0x178835(++_0x3bcf55);}(_0x7a54,0x106));var _0x47a5=function(_0x5a4e71,_0x2b8887){_0x5a4e71=_0x5a4e71-0x0;var _0x490fb1=_0x7a54[_0x5a4e71];return _0x490fb1;};'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 9a7bac7..26d1aef 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 _0xab61=['lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x2f9046,_0x241fb3){var _0x276175=function(_0x29a7ed){while(--_0x29a7ed){_0x2f9046['push'](_0x2f9046['shift']());}};_0x276175(++_0x241fb3);}(_0xab61,0x134));var _0x1ab6=function(_0x282594,_0x59d96c){_0x282594=_0x282594-0x0;var _0x6a619=_0xab61[_0x282594];return _0x6a619;};'use strict';var _=require(_0x1ab6('0x0'));var util=require('util');var moment=require(_0x1ab6('0x1'));var BPromise=require(_0x1ab6('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x1ab6('0x3'));var logger=require(_0x1ab6('0x4'))(_0x1ab6('0x5'));var config=require(_0x1ab6('0x6'));var jayson=require(_0x1ab6('0x7'));var client=jayson[_0x1ab6('0x8')][_0x1ab6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d5ac1,_0x331cdb,_0x264cfb){return new BPromise(function(_0x525755,_0x311fc8){return client['request'](_0x2d5ac1,_0x264cfb)[_0x1ab6('0xa')](function(_0x1a6c13){logger[_0x1ab6('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x331cdb,_0x1ab6('0xc'));logger[_0x1ab6('0xd')](_0x1ab6('0xe'),_0x331cdb,_0x1ab6('0xc'),JSON[_0x1ab6('0xf')](_0x1a6c13));if(_0x1a6c13[_0x1ab6('0x10')]){if(_0x1a6c13['error'][_0x1ab6('0x11')]===0x1f4){logger[_0x1ab6('0x10')](_0x1ab6('0x12'),_0x331cdb,_0x1a6c13[_0x1ab6('0x10')]['message']);return _0x311fc8(_0x1a6c13[_0x1ab6('0x10')][_0x1ab6('0x13')]);}logger[_0x1ab6('0x10')](_0x1ab6('0x12'),_0x331cdb,_0x1a6c13['error'][_0x1ab6('0x13')]);return _0x525755(_0x1a6c13[_0x1ab6('0x10')]['message']);}else{logger[_0x1ab6('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x331cdb,_0x1ab6('0xc'));_0x525755(_0x1a6c13[_0x1ab6('0x14')][_0x1ab6('0x13')]);}})[_0x1ab6('0x15')](function(_0x1bae1a){logger[_0x1ab6('0x10')](_0x1ab6('0x12'),_0x331cdb,_0x1bae1a);_0x311fc8(_0x1bae1a);});});} \ No newline at end of file +var _0xddd1=['client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x1f3ee8,_0x38ee26){var _0x11ff83=function(_0x2ddf47){while(--_0x2ddf47){_0x1f3ee8['push'](_0x1f3ee8['shift']());}};_0x11ff83(++_0x38ee26);}(_0xddd1,0x1ec));var _0x1ddd=function(_0xdc12bf,_0x18d009){_0xdc12bf=_0xdc12bf-0x0;var _0x2e85cb=_0xddd1[_0xdc12bf];return _0x2e85cb;};'use strict';var _=require(_0x1ddd('0x0'));var util=require(_0x1ddd('0x1'));var moment=require(_0x1ddd('0x2'));var BPromise=require('bluebird');var rs=require(_0x1ddd('0x3'));var fs=require('fs');var db=require(_0x1ddd('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1ddd('0x5'));var config=require(_0x1ddd('0x6'));var jayson=require(_0x1ddd('0x7'));var client=jayson[_0x1ddd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a4acb,_0x26d485,_0x2fa575){return new BPromise(function(_0x492288,_0x650a69){return client[_0x1ddd('0x9')](_0x4a4acb,_0x2fa575)[_0x1ddd('0xa')](function(_0x27e85a){logger[_0x1ddd('0xb')](_0x1ddd('0xc'),_0x26d485,'request\x20sent');logger['debug'](_0x1ddd('0xd'),_0x26d485,'request\x20sent',JSON[_0x1ddd('0xe')](_0x27e85a));if(_0x27e85a['error']){if(_0x27e85a[_0x1ddd('0xf')][_0x1ddd('0x10')]===0x1f4){logger[_0x1ddd('0xf')](_0x1ddd('0xc'),_0x26d485,_0x27e85a[_0x1ddd('0xf')][_0x1ddd('0x11')]);return _0x650a69(_0x27e85a[_0x1ddd('0xf')][_0x1ddd('0x11')]);}logger['error'](_0x1ddd('0xc'),_0x26d485,_0x27e85a[_0x1ddd('0xf')]['message']);return _0x492288(_0x27e85a[_0x1ddd('0xf')][_0x1ddd('0x11')]);}else{logger[_0x1ddd('0xb')](_0x1ddd('0xc'),_0x26d485,'request\x20sent');_0x492288(_0x27e85a[_0x1ddd('0x12')][_0x1ddd('0x11')]);}})[_0x1ddd('0x13')](function(_0x1fea02){logger['error'](_0x1ddd('0xc'),_0x26d485,_0x1fea02);_0x650a69(_0x1fea02);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index c7301a4..8cb860d 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 _0x7cc5=['../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer','util','path','express','Router'];(function(_0x21e834,_0x29609a){var _0x238b7b=function(_0x107fd0){while(--_0x107fd0){_0x21e834['push'](_0x21e834['shift']());}};_0x238b7b(++_0x29609a);}(_0x7cc5,0x199));var _0x57cc=function(_0x28006d,_0x892ccd){_0x28006d=_0x28006d-0x0;var _0x25a2bc=_0x7cc5[_0x28006d];return _0x25a2bc;};'use strict';var multer=require(_0x57cc('0x0'));var util=require(_0x57cc('0x1'));var path=require(_0x57cc('0x2'));var express=require(_0x57cc('0x3'));var router=express[_0x57cc('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x57cc('0x5'));var config=require(_0x57cc('0x6'));var controller=require(_0x57cc('0x7'));router[_0x57cc('0x8')]('/',auth[_0x57cc('0x9')](),controller[_0x57cc('0xa')]);router[_0x57cc('0x8')](_0x57cc('0xb'),auth[_0x57cc('0x9')](),controller[_0x57cc('0xc')]);router['post']('/',auth[_0x57cc('0x9')](),controller[_0x57cc('0xd')]);router[_0x57cc('0xe')]('/:id',auth[_0x57cc('0x9')](),controller[_0x57cc('0xf')]);router['delete'](_0x57cc('0xb'),auth[_0x57cc('0x9')](),controller[_0x57cc('0x10')]);module[_0x57cc('0x11')]=router; \ No newline at end of file +var _0x8331=['../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','exports','multer','path'];(function(_0x3611ef,_0x4fbb05){var _0x246a54=function(_0x2bbd56){while(--_0x2bbd56){_0x3611ef['push'](_0x3611ef['shift']());}};_0x246a54(++_0x4fbb05);}(_0x8331,0x196));var _0x1833=function(_0x354164,_0x4c30de){_0x354164=_0x354164-0x0;var _0x5db9a8=_0x8331[_0x354164];return _0x5db9a8;};'use strict';var multer=require(_0x1833('0x0'));var util=require('util');var path=require(_0x1833('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x1833('0x2'));var interaction=require(_0x1833('0x3'));var config=require(_0x1833('0x4'));var controller=require(_0x1833('0x5'));router['get']('/',auth[_0x1833('0x6')](),controller[_0x1833('0x7')]);router[_0x1833('0x8')](_0x1833('0x9'),auth[_0x1833('0x6')](),controller[_0x1833('0xa')]);router[_0x1833('0xb')]('/',auth[_0x1833('0x6')](),controller['create']);router[_0x1833('0xc')](_0x1833('0x9'),auth[_0x1833('0x6')](),controller[_0x1833('0xd')]);router[_0x1833('0xe')](_0x1833('0x9'),auth['isAuthenticated'](),controller[_0x1833('0xf')]);module[_0x1833('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index ca1c752..4ef7844 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 _0xfc67=['name','STRING'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xfc67,0x1ce));var _0x7fc6=function(_0x36de4f,_0x350d30){_0x36de4f=_0x36de4f-0x0;var _0x1a91c2=_0xfc67[_0x36de4f];return _0x1a91c2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x7fc6('0x0'),'allowNull':![]},'description':{'type':Sequelize[_0x7fc6('0x1')]}}; \ No newline at end of file +var _0x74bc=['exports','STRING','sequelize'];(function(_0x261038,_0x2fab28){var _0x2fd230=function(_0x429660){while(--_0x429660){_0x261038['push'](_0x261038['shift']());}};_0x2fd230(++_0x2fab28);}(_0x74bc,0x18e));var _0xc74b=function(_0x414775,_0x3fc26f){_0x414775=_0x414775-0x0;var _0x1df01d=_0x74bc[_0x414775];return _0x1df01d;};'use strict';var Sequelize=require(_0xc74b('0x0'));module[_0xc74b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xc74b('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index a165ee6..3e1a62e 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 _0x3fa4=['sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','index','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','add','day','merge','filter','where','map','options','includeAll','include','Pause','catch','find','create','body','params','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils'];(function(_0x50ee2b,_0x1c3e94){var _0x188f2f=function(_0x29ca57){while(--_0x29ca57){_0x50ee2b['push'](_0x50ee2b['shift']());}};_0x188f2f(++_0x1c3e94);}(_0x3fa4,0xf0));var _0x43fa=function(_0x58f6b4,_0x2e6835){_0x58f6b4=_0x58f6b4-0x0;var _0xc263d7=_0x3fa4[_0x58f6b4];return _0xc263d7;};'use strict';var jsonpatch=require(_0x43fa('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43fa('0x1'));var util=require(_0x43fa('0x2'));var path=require(_0x43fa('0x3'));var sox=require(_0x43fa('0x4'));var csv=require(_0x43fa('0x5'));var ejs=require(_0x43fa('0x6'));var fs=require('fs');var _=require(_0x43fa('0x7'));var squel=require('squel');var crypto=require(_0x43fa('0x8'));var jsforce=require(_0x43fa('0x9'));var deskjs=require(_0x43fa('0xa'));var toCsv=require('to-csv');var querystring=require(_0x43fa('0xb'));var Papa=require(_0x43fa('0xc'));var qs=require(_0x43fa('0xd'));var logger=require('../../config/logger')(_0x43fa('0xe'));var utils=require(_0x43fa('0xf'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe0c8cd,_0x388c29){_0x388c29=_0x388c29||0xcc;return function(_0x136821){if(_0x136821){return _0xe0c8cd[_0x43fa('0x10')](_0x388c29);}return _0xe0c8cd[_0x43fa('0x11')](_0x388c29)['end']();};}function respondWithResult(_0x464e7b,_0x1b50ee){_0x1b50ee=_0x1b50ee||0xc8;return function(_0x13df33){if(_0x13df33){return _0x464e7b['status'](_0x1b50ee)[_0x43fa('0x12')](_0x13df33);}};}function respondWithFilteredResult(_0x4353c1,_0x4665c1){return function(_0x529c85){if(_0x529c85){var _0x24fb1e=_0x529c85[_0x43fa('0x13')],_0x4bb4b0=_0x4665c1['offset'],_0x5bc292=_0x4665c1[_0x43fa('0x14')]+_0x4665c1[_0x43fa('0x15')],_0x4fba54;if(_0x5bc292>=_0x24fb1e){_0x5bc292=_0x24fb1e;_0x4fba54=0xc8;}else{_0x4fba54=0xce;}_0x4353c1['status'](_0x4fba54);return _0x4353c1[_0x43fa('0x16')](_0x43fa('0x17'),_0x4bb4b0+'-'+_0x5bc292+'/'+_0x24fb1e)[_0x43fa('0x12')](_0x529c85);}return null;};}function patchUpdates(_0x2439d4){return function(_0x2c68e0){try{jsonpatch[_0x43fa('0x18')](_0x2c68e0,_0x2439d4,!![]);}catch(_0x5d12ac){return BPromise['reject'](_0x5d12ac);}return _0x2c68e0[_0x43fa('0x19')]();};}function saveUpdates(_0x29b8aa,_0x1c2463){return function(_0x1d7adc){if(_0x1d7adc){return _0x1d7adc[_0x43fa('0x1a')](_0x29b8aa)[_0x43fa('0x1b')](function(_0xdf68a6){return _0xdf68a6;});}return null;};}function removeEntity(_0x2d8594,_0x3e39b7){return function(_0x4f8492){if(_0x4f8492){return _0x4f8492[_0x43fa('0x1c')]()[_0x43fa('0x1b')](function(){_0x2d8594[_0x43fa('0x11')](0xcc)[_0x43fa('0x1d')]();});}};}function handleEntityNotFound(_0x38c162,_0x4a98bb){return function(_0x2c6075){if(!_0x2c6075){_0x38c162[_0x43fa('0x10')](0x194);}return _0x2c6075;};}function handleError(_0x2db3dd,_0xa34fc6){_0xa34fc6=_0xa34fc6||0x1f4;return function(_0x194936){logger[_0x43fa('0x1e')](_0x194936[_0x43fa('0x1f')]);if(_0x194936[_0x43fa('0x20')]){delete _0x194936[_0x43fa('0x20')];}_0x2db3dd['status'](_0xa34fc6)['send'](_0x194936);};}exports[_0x43fa('0x21')]=function(_0x197eac,_0x28f695){var _0x78f105={},_0x40969a={},_0x243dda={'count':0x0,'rows':[]};var _0x5014fb=db['Pause'][_0x43fa('0x22')];_0x40969a[_0x43fa('0x23')]=_[_0x43fa('0x24')](_0x5014fb);var _0x4d88b1={'dateStart':_0x197eac['query'][_0x43fa('0x25')],'dateEnd':_0x197eac[_0x43fa('0x26')][_0x43fa('0x27')]};delete _0x197eac[_0x43fa('0x26')]['dateStart'];delete _0x197eac[_0x43fa('0x26')][_0x43fa('0x27')];_0x40969a[_0x43fa('0x26')]=_[_0x43fa('0x24')](_0x197eac[_0x43fa('0x26')]);_0x40969a[_0x43fa('0x28')]=_[_0x43fa('0x29')](_0x40969a[_0x43fa('0x23')],_0x40969a[_0x43fa('0x26')]);_0x78f105[_0x43fa('0x2a')]=_[_0x43fa('0x29')](_0x40969a[_0x43fa('0x23')],qs['fields'](_0x197eac['query'][_0x43fa('0x2b')]));_0x78f105[_0x43fa('0x2a')]=_0x78f105[_0x43fa('0x2a')][_0x43fa('0x2c')]?_0x78f105['attributes']:_0x40969a[_0x43fa('0x23')];if(!_0x197eac[_0x43fa('0x26')][_0x43fa('0x2d')]('nolimit')){_0x78f105[_0x43fa('0x15')]=qs[_0x43fa('0x15')](_0x197eac[_0x43fa('0x26')][_0x43fa('0x15')]);_0x78f105['offset']=qs[_0x43fa('0x14')](_0x197eac['query'][_0x43fa('0x14')]);}_0x78f105[_0x43fa('0x2e')]=qs[_0x43fa('0x2f')](_0x197eac['query'][_0x43fa('0x2f')]);_0x78f105['where']=qs['filters'](_[_0x43fa('0x30')](_0x197eac[_0x43fa('0x26')],_0x40969a[_0x43fa('0x28')]));if(_0x4d88b1['dateStart']){if(_0x4d88b1[_0x43fa('0x27')]){_0x4d88b1[_0x43fa('0x27')]=moment(_0x4d88b1[_0x43fa('0x27')])[_0x43fa('0x31')](0x1,_0x43fa('0x32'));}else{_0x4d88b1['dateEnd']=moment(_0x4d88b1[_0x43fa('0x25')])[_0x43fa('0x31')](0x1,_0x43fa('0x32'));}_[_0x43fa('0x33')](_0x78f105['where'],{'createdAt':{'$gte':_0x4d88b1['dateStart'],'$lte':_0x4d88b1[_0x43fa('0x27')]}});}if(_0x197eac[_0x43fa('0x26')][_0x43fa('0x34')]){_0x78f105[_0x43fa('0x35')]=_[_0x43fa('0x33')](_0x78f105['where'],{'$or':_[_0x43fa('0x36')](_0x78f105['attributes'],function(_0x4cb1bd){var _0x236332={};_0x236332[_0x4cb1bd]={'$like':'%'+_0x197eac['query'][_0x43fa('0x34')]+'%'};return _0x236332;})});}_0x78f105=_[_0x43fa('0x33')]({},_0x78f105,_0x197eac[_0x43fa('0x37')]);var _0x17403c={'where':_0x78f105['where']};return db['Pause']['count'](_0x17403c)[_0x43fa('0x1b')](function(_0x15ef49){_0x243dda['count']=_0x15ef49;if(_0x197eac[_0x43fa('0x26')][_0x43fa('0x38')]){_0x78f105[_0x43fa('0x39')]=[{'all':!![]}];}return db[_0x43fa('0x3a')]['findAll'](_0x78f105);})[_0x43fa('0x1b')](function(_0x23e156){_0x243dda['rows']=_0x23e156;return _0x243dda;})['then'](respondWithFilteredResult(_0x28f695,_0x78f105))[_0x43fa('0x3b')](handleError(_0x28f695,null));};exports['show']=function(_0x3a6d39,_0x137ef){var _0x5cef1e={'raw':!![],'where':{'id':_0x3a6d39['params']['id']}},_0x4735d1={};_0x4735d1[_0x43fa('0x23')]=_[_0x43fa('0x24')](db[_0x43fa('0x3a')]['rawAttributes']);_0x4735d1[_0x43fa('0x26')]=_[_0x43fa('0x24')](_0x3a6d39[_0x43fa('0x26')]);_0x4735d1[_0x43fa('0x28')]=_[_0x43fa('0x29')](_0x4735d1[_0x43fa('0x23')],_0x4735d1['query']);_0x5cef1e[_0x43fa('0x2a')]=_['intersection'](_0x4735d1[_0x43fa('0x23')],qs['fields'](_0x3a6d39[_0x43fa('0x26')][_0x43fa('0x2b')]));_0x5cef1e[_0x43fa('0x2a')]=_0x5cef1e[_0x43fa('0x2a')][_0x43fa('0x2c')]?_0x5cef1e['attributes']:_0x4735d1[_0x43fa('0x23')];if(_0x3a6d39['query']['includeAll']){_0x5cef1e['include']=[{'all':!![]}];}_0x5cef1e=_[_0x43fa('0x33')]({},_0x5cef1e,_0x3a6d39[_0x43fa('0x37')]);return db[_0x43fa('0x3a')][_0x43fa('0x3c')](_0x5cef1e)[_0x43fa('0x1b')](handleEntityNotFound(_0x137ef,null))['then'](respondWithResult(_0x137ef,null))[_0x43fa('0x3b')](handleError(_0x137ef,null));};exports[_0x43fa('0x3d')]=function(_0x305e90,_0x19b0f0){return db[_0x43fa('0x3a')][_0x43fa('0x3d')](_0x305e90[_0x43fa('0x3e')],{})[_0x43fa('0x1b')](respondWithResult(_0x19b0f0,0xc9))[_0x43fa('0x3b')](handleError(_0x19b0f0,null));};exports[_0x43fa('0x1a')]=function(_0x1ae6e0,_0x52d66f){if(_0x1ae6e0[_0x43fa('0x3e')]['id']){delete _0x1ae6e0[_0x43fa('0x3e')]['id'];}return db['Pause'][_0x43fa('0x3c')]({'where':{'id':_0x1ae6e0['params']['id']}})[_0x43fa('0x1b')](handleEntityNotFound(_0x52d66f,null))[_0x43fa('0x1b')](saveUpdates(_0x1ae6e0[_0x43fa('0x3e')],null))[_0x43fa('0x1b')](respondWithResult(_0x52d66f,null))[_0x43fa('0x3b')](handleError(_0x52d66f,null));};exports['destroy']=function(_0x1bbae4,_0x4a24f1){return db[_0x43fa('0x3a')][_0x43fa('0x3c')]({'where':{'id':_0x1bbae4[_0x43fa('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4a24f1,null))['then'](removeEntity(_0x4a24f1,null))[_0x43fa('0x3b')](handleError(_0x4a24f1,null));}; \ No newline at end of file +var _0x207c=['sort','pick','add','day','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','request-promise','moment','bluebird','mustache','util','path','sox','ejs','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','Content-Range','json','reject','save','update','then','destroy','end','error','stack','name','send','index','Pause','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x207c,0x1e8));var _0xc207=function(_0x545dd8,_0x404f75){_0x545dd8=_0x545dd8-0x0;var _0x44cd80=_0x207c[_0x545dd8];return _0x44cd80;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xc207('0x0'));var moment=require(_0xc207('0x1'));var BPromise=require(_0xc207('0x2'));var Mustache=require(_0xc207('0x3'));var util=require(_0xc207('0x4'));var path=require(_0xc207('0x5'));var sox=require(_0xc207('0x6'));var csv=require('to-csv');var ejs=require(_0xc207('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc207('0x8'));var deskjs=require(_0xc207('0x9'));var toCsv=require(_0xc207('0xa'));var querystring=require('querystring');var Papa=require(_0xc207('0xb'));var qs=require(_0xc207('0xc'));var logger=require(_0xc207('0xd'))('api');var utils=require(_0xc207('0xe'));var config=require(_0xc207('0xf'));var db=require(_0xc207('0x10'))['db'];function respondWithStatusCode(_0x13ec41,_0x201162){_0x201162=_0x201162||0xcc;return function(_0x347549){if(_0x347549){return _0x13ec41['sendStatus'](_0x201162);}return _0x13ec41['status'](_0x201162)['end']();};}function respondWithResult(_0x19b297,_0x491062){_0x491062=_0x491062||0xc8;return function(_0x2741f3){if(_0x2741f3){return _0x19b297[_0xc207('0x11')](_0x491062)['json'](_0x2741f3);}};}function respondWithFilteredResult(_0x3e1108,_0xb86b06){return function(_0x3062f5){if(_0x3062f5){var _0x32acbf=_0x3062f5[_0xc207('0x12')],_0xe993a0=_0xb86b06[_0xc207('0x13')],_0x51e967=_0xb86b06[_0xc207('0x13')]+_0xb86b06['limit'],_0xc62672;if(_0x51e967>=_0x32acbf){_0x51e967=_0x32acbf;_0xc62672=0xc8;}else{_0xc62672=0xce;}_0x3e1108['status'](_0xc62672);return _0x3e1108['set'](_0xc207('0x14'),_0xe993a0+'-'+_0x51e967+'/'+_0x32acbf)[_0xc207('0x15')](_0x3062f5);}return null;};}function patchUpdates(_0x3d9c7b){return function(_0x65f539){try{jsonpatch['apply'](_0x65f539,_0x3d9c7b,!![]);}catch(_0x1bc70c){return BPromise[_0xc207('0x16')](_0x1bc70c);}return _0x65f539[_0xc207('0x17')]();};}function saveUpdates(_0x5f288e,_0x4129b8){return function(_0x488cc0){if(_0x488cc0){return _0x488cc0[_0xc207('0x18')](_0x5f288e)[_0xc207('0x19')](function(_0x131dc8){return _0x131dc8;});}return null;};}function removeEntity(_0x461f6a,_0xce0770){return function(_0x2caec5){if(_0x2caec5){return _0x2caec5[_0xc207('0x1a')]()[_0xc207('0x19')](function(){_0x461f6a[_0xc207('0x11')](0xcc)[_0xc207('0x1b')]();});}};}function handleEntityNotFound(_0x3112ff,_0xe227a){return function(_0x40de25){if(!_0x40de25){_0x3112ff['sendStatus'](0x194);}return _0x40de25;};}function handleError(_0x163b36,_0x5cda23){_0x5cda23=_0x5cda23||0x1f4;return function(_0x2e89c5){logger[_0xc207('0x1c')](_0x2e89c5[_0xc207('0x1d')]);if(_0x2e89c5[_0xc207('0x1e')]){delete _0x2e89c5[_0xc207('0x1e')];}_0x163b36[_0xc207('0x11')](_0x5cda23)[_0xc207('0x1f')](_0x2e89c5);};}exports[_0xc207('0x20')]=function(_0xa52138,_0x2385f7){var _0x25c91e={},_0x27df03={},_0x3f738e={'count':0x0,'rows':[]};var _0x138970=db[_0xc207('0x21')]['rawAttributes'];_0x27df03[_0xc207('0x22')]=_['keys'](_0x138970);var _0x4cb3af={'dateStart':_0xa52138[_0xc207('0x23')][_0xc207('0x24')],'dateEnd':_0xa52138[_0xc207('0x23')][_0xc207('0x25')]};delete _0xa52138[_0xc207('0x23')]['dateStart'];delete _0xa52138[_0xc207('0x23')][_0xc207('0x25')];_0x27df03[_0xc207('0x23')]=_[_0xc207('0x26')](_0xa52138[_0xc207('0x23')]);_0x27df03[_0xc207('0x27')]=_[_0xc207('0x28')](_0x27df03[_0xc207('0x22')],_0x27df03[_0xc207('0x23')]);_0x25c91e[_0xc207('0x29')]=_[_0xc207('0x28')](_0x27df03[_0xc207('0x22')],qs[_0xc207('0x2a')](_0xa52138['query'][_0xc207('0x2a')]));_0x25c91e[_0xc207('0x29')]=_0x25c91e[_0xc207('0x29')][_0xc207('0x2b')]?_0x25c91e[_0xc207('0x29')]:_0x27df03[_0xc207('0x22')];if(!_0xa52138['query'][_0xc207('0x2c')](_0xc207('0x2d'))){_0x25c91e[_0xc207('0x2e')]=qs[_0xc207('0x2e')](_0xa52138['query'][_0xc207('0x2e')]);_0x25c91e[_0xc207('0x13')]=qs[_0xc207('0x13')](_0xa52138[_0xc207('0x23')][_0xc207('0x13')]);}_0x25c91e[_0xc207('0x2f')]=qs[_0xc207('0x30')](_0xa52138[_0xc207('0x23')][_0xc207('0x30')]);_0x25c91e['where']=qs['filters'](_[_0xc207('0x31')](_0xa52138[_0xc207('0x23')],_0x27df03[_0xc207('0x27')]));if(_0x4cb3af[_0xc207('0x24')]){if(_0x4cb3af['dateEnd']){_0x4cb3af[_0xc207('0x25')]=moment(_0x4cb3af[_0xc207('0x25')])[_0xc207('0x32')](0x1,_0xc207('0x33'));}else{_0x4cb3af[_0xc207('0x25')]=moment(_0x4cb3af['dateStart'])[_0xc207('0x32')](0x1,_0xc207('0x33'));}_['merge'](_0x25c91e[_0xc207('0x34')],{'createdAt':{'$gte':_0x4cb3af['dateStart'],'$lte':_0x4cb3af[_0xc207('0x25')]}});}if(_0xa52138[_0xc207('0x23')]['filter']){_0x25c91e[_0xc207('0x34')]=_[_0xc207('0x35')](_0x25c91e[_0xc207('0x34')],{'$or':_['map'](_0x25c91e['attributes'],function(_0x37cc19){var _0x347d57={};_0x347d57[_0x37cc19]={'$like':'%'+_0xa52138[_0xc207('0x23')][_0xc207('0x36')]+'%'};return _0x347d57;})});}_0x25c91e=_['merge']({},_0x25c91e,_0xa52138[_0xc207('0x37')]);var _0x47cdc4={'where':_0x25c91e['where']};return db['Pause']['count'](_0x47cdc4)[_0xc207('0x19')](function(_0x370d0d){_0x3f738e[_0xc207('0x12')]=_0x370d0d;if(_0xa52138['query'][_0xc207('0x38')]){_0x25c91e[_0xc207('0x39')]=[{'all':!![]}];}return db[_0xc207('0x21')][_0xc207('0x3a')](_0x25c91e);})['then'](function(_0x47d43a){_0x3f738e[_0xc207('0x3b')]=_0x47d43a;return _0x3f738e;})[_0xc207('0x19')](respondWithFilteredResult(_0x2385f7,_0x25c91e))[_0xc207('0x3c')](handleError(_0x2385f7,null));};exports[_0xc207('0x3d')]=function(_0x58537e,_0x122883){var _0x19a67d={'raw':!![],'where':{'id':_0x58537e[_0xc207('0x3e')]['id']}},_0x3a935a={};_0x3a935a[_0xc207('0x22')]=_[_0xc207('0x26')](db[_0xc207('0x21')][_0xc207('0x3f')]);_0x3a935a[_0xc207('0x23')]=_['keys'](_0x58537e[_0xc207('0x23')]);_0x3a935a[_0xc207('0x27')]=_['intersection'](_0x3a935a[_0xc207('0x22')],_0x3a935a[_0xc207('0x23')]);_0x19a67d[_0xc207('0x29')]=_[_0xc207('0x28')](_0x3a935a[_0xc207('0x22')],qs['fields'](_0x58537e[_0xc207('0x23')][_0xc207('0x2a')]));_0x19a67d[_0xc207('0x29')]=_0x19a67d['attributes'][_0xc207('0x2b')]?_0x19a67d[_0xc207('0x29')]:_0x3a935a[_0xc207('0x22')];if(_0x58537e[_0xc207('0x23')]['includeAll']){_0x19a67d['include']=[{'all':!![]}];}_0x19a67d=_[_0xc207('0x35')]({},_0x19a67d,_0x58537e[_0xc207('0x37')]);return db[_0xc207('0x21')][_0xc207('0x40')](_0x19a67d)[_0xc207('0x19')](handleEntityNotFound(_0x122883,null))[_0xc207('0x19')](respondWithResult(_0x122883,null))[_0xc207('0x3c')](handleError(_0x122883,null));};exports[_0xc207('0x41')]=function(_0x20edff,_0x212552){return db[_0xc207('0x21')][_0xc207('0x41')](_0x20edff['body'],{})['then'](respondWithResult(_0x212552,0xc9))[_0xc207('0x3c')](handleError(_0x212552,null));};exports[_0xc207('0x18')]=function(_0x2468d0,_0x480f12){if(_0x2468d0[_0xc207('0x42')]['id']){delete _0x2468d0[_0xc207('0x42')]['id'];}return db[_0xc207('0x21')][_0xc207('0x40')]({'where':{'id':_0x2468d0['params']['id']}})[_0xc207('0x19')](handleEntityNotFound(_0x480f12,null))['then'](saveUpdates(_0x2468d0[_0xc207('0x42')],null))['then'](respondWithResult(_0x480f12,null))['catch'](handleError(_0x480f12,null));};exports[_0xc207('0x1a')]=function(_0x30f02e,_0x4eeb63){return db['Pause']['find']({'where':{'id':_0x30f02e[_0xc207('0x3e')]['id']}})[_0xc207('0x19')](handleEntityNotFound(_0x4eeb63,null))[_0xc207('0x19')](removeEntity(_0x4eeb63,null))[_0xc207('0x3c')](handleError(_0x4eeb63,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 55f91a5..b0a214f 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 _0xde3e=['request-promise','./pause.attributes','exports','define','Pause','tools_pauses','util','../../config/logger','moment','bluebird'];(function(_0x54691d,_0x391ae4){var _0x4636bd=function(_0x4972a7){while(--_0x4972a7){_0x54691d['push'](_0x54691d['shift']());}};_0x4636bd(++_0x391ae4);}(_0xde3e,0xf6));var _0xede3=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xde3e[_0x5d4607];return _0x5e4a86;};'use strict';var _=require('lodash');var util=require(_0xede3('0x0'));var logger=require(_0xede3('0x1'))('api');var moment=require(_0xede3('0x2'));var BPromise=require(_0xede3('0x3'));var rp=require(_0xede3('0x4'));var attributes=require(_0xede3('0x5'));module[_0xede3('0x6')]=function(_0x3e84b7,_0xef77ef){return _0x3e84b7[_0xede3('0x7')](_0xede3('0x8'),attributes,{'tableName':_0xede3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x555b=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','./pause.attributes'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x555b,0x117));var _0xb555=function(_0x45dd0d,_0x3f3624){_0x45dd0d=_0x45dd0d-0x0;var _0x4ef2a0=_0x555b[_0x45dd0d];return _0x4ef2a0;};'use strict';var _=require(_0xb555('0x0'));var util=require(_0xb555('0x1'));var logger=require(_0xb555('0x2'))(_0xb555('0x3'));var moment=require(_0xb555('0x4'));var BPromise=require(_0xb555('0x5'));var rp=require('request-promise');var attributes=require(_0xb555('0x6'));module[_0xb555('0x7')]=function(_0x387a65,_0xa6d23){return _0x387a65[_0xb555('0x8')](_0xb555('0x9'),attributes,{'tableName':_0xb555('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 29f627a..059f293 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 _0x75e4=['message','result','ShowPause','find','options','raw','where','attributes','include','model','map','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','request','then','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x569caa,_0x5174ce){var _0x44cb5a=function(_0x456df4){while(--_0x456df4){_0x569caa['push'](_0x569caa['shift']());}};_0x44cb5a(++_0x5174ce);}(_0x75e4,0x105));var _0x475e=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x75e4[_0x12f688];return _0x59c3de;};'use strict';var _=require(_0x475e('0x0'));var util=require(_0x475e('0x1'));var moment=require(_0x475e('0x2'));var BPromise=require(_0x475e('0x3'));var rs=require(_0x475e('0x4'));var fs=require('fs');var db=require(_0x475e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x475e('0x6'))(_0x475e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x475e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x533139,_0x27c446,_0x47a194){return new BPromise(function(_0xf2b6b4,_0x43f5ff){return client[_0x475e('0x9')](_0x533139,_0x47a194)[_0x475e('0xa')](function(_0x5bf385){logger['info'](_0x475e('0xb'),_0x27c446,_0x475e('0xc'));logger[_0x475e('0xd')](_0x475e('0xe'),_0x27c446,_0x475e('0xc'),JSON[_0x475e('0xf')](_0x5bf385));if(_0x5bf385[_0x475e('0x10')]){if(_0x5bf385[_0x475e('0x10')][_0x475e('0x11')]===0x1f4){logger[_0x475e('0x10')](_0x475e('0xb'),_0x27c446,_0x5bf385['error']['message']);return _0x43f5ff(_0x5bf385[_0x475e('0x10')][_0x475e('0x12')]);}logger[_0x475e('0x10')](_0x475e('0xb'),_0x27c446,_0x5bf385['error'][_0x475e('0x12')]);return _0xf2b6b4(_0x5bf385[_0x475e('0x10')]['message']);}else{logger['info'](_0x475e('0xb'),_0x27c446,_0x475e('0xc'));_0xf2b6b4(_0x5bf385[_0x475e('0x13')][_0x475e('0x12')]);}})['catch'](function(_0x377466){logger['error'](_0x475e('0xb'),_0x27c446,_0x377466);_0x43f5ff(_0x377466);});});}exports[_0x475e('0x14')]=function(_0x4ca488){var _0x44128b=this;return new Promise(function(_0x589263,_0x2c7ef0){return db['Pause'][_0x475e('0x15')]({'raw':_0x4ca488[_0x475e('0x16')]?_0x4ca488[_0x475e('0x16')][_0x475e('0x17')]===undefined?!![]:![]:!![],'where':_0x4ca488['options']?_0x4ca488[_0x475e('0x16')][_0x475e('0x18')]||null:null,'attributes':_0x4ca488[_0x475e('0x16')]?_0x4ca488[_0x475e('0x16')][_0x475e('0x19')]||null:null,'include':_0x4ca488['options']?_0x4ca488[_0x475e('0x16')][_0x475e('0x1a')]?_['map'](_0x4ca488[_0x475e('0x16')][_0x475e('0x1a')],function(_0x2af8d9){return{'model':db[_0x2af8d9[_0x475e('0x1b')]],'as':_0x2af8d9['as'],'attributes':_0x2af8d9[_0x475e('0x19')],'include':_0x2af8d9['include']?_['map'](_0x2af8d9[_0x475e('0x1a')],function(_0x27b36b){return{'model':db[_0x27b36b[_0x475e('0x1b')]],'as':_0x27b36b['as'],'attributes':_0x27b36b[_0x475e('0x19')],'include':_0x27b36b[_0x475e('0x1a')]?_[_0x475e('0x1c')](_0x27b36b[_0x475e('0x1a')],function(_0x2972b3){return{'model':db[_0x2972b3[_0x475e('0x1b')]],'as':_0x2972b3['as'],'attributes':_0x2972b3[_0x475e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x475e('0xa')](function(_0x510c2c){logger[_0x475e('0x1d')](_0x475e('0x14'),_0x4ca488);logger['debug'](_0x475e('0x14'),_0x4ca488,JSON['stringify'](_0x510c2c));_0x589263(_0x510c2c);})[_0x475e('0x1e')](function(_0x41a116){logger[_0x475e('0x10')](_0x475e('0x14'),_0x41a116[_0x475e('0x12')],_0x4ca488);_0x2c7ef0(_0x44128b['error'](0x1f4,_0x41a116[_0x475e('0x12')]));});});}; \ No newline at end of file +var _0x5e8d=['request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','error','code','message','result','find','options','raw','where','attributes','include','map','model','ShowPause','stringify','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Pause,\x20%s,\x20%s'];(function(_0x4723c1,_0x1748cf){var _0x556edd=function(_0x3fff7b){while(--_0x3fff7b){_0x4723c1['push'](_0x4723c1['shift']());}};_0x556edd(++_0x1748cf);}(_0x5e8d,0x152));var _0xd5e8=function(_0x2d9686,_0x179efe){_0x2d9686=_0x2d9686-0x0;var _0x7abbdb=_0x5e8d[_0x2d9686];return _0x7abbdb;};'use strict';var _=require(_0xd5e8('0x0'));var util=require(_0xd5e8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd5e8('0x2'));var fs=require('fs');var db=require(_0xd5e8('0x3'))['db'];var utils=require(_0xd5e8('0x4'));var logger=require(_0xd5e8('0x5'))(_0xd5e8('0x6'));var config=require(_0xd5e8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd5e8('0x8')][_0xd5e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34405c,_0x3819cb,_0x2f6bd3){return new BPromise(function(_0x58bb24,_0x27ca47){return client[_0xd5e8('0xa')](_0x34405c,_0x2f6bd3)[_0xd5e8('0xb')](function(_0x5315a6){logger[_0xd5e8('0xc')](_0xd5e8('0xd'),_0x3819cb,_0xd5e8('0xe'));logger[_0xd5e8('0xf')](_0xd5e8('0x10'),_0x3819cb,_0xd5e8('0xe'),JSON['stringify'](_0x5315a6));if(_0x5315a6[_0xd5e8('0x11')]){if(_0x5315a6[_0xd5e8('0x11')][_0xd5e8('0x12')]===0x1f4){logger['error'](_0xd5e8('0xd'),_0x3819cb,_0x5315a6['error']['message']);return _0x27ca47(_0x5315a6['error'][_0xd5e8('0x13')]);}logger[_0xd5e8('0x11')](_0xd5e8('0xd'),_0x3819cb,_0x5315a6['error']['message']);return _0x58bb24(_0x5315a6[_0xd5e8('0x11')]['message']);}else{logger[_0xd5e8('0xc')](_0xd5e8('0xd'),_0x3819cb,_0xd5e8('0xe'));_0x58bb24(_0x5315a6[_0xd5e8('0x14')]['message']);}})['catch'](function(_0x5126e8){logger[_0xd5e8('0x11')](_0xd5e8('0xd'),_0x3819cb,_0x5126e8);_0x27ca47(_0x5126e8);});});}exports['ShowPause']=function(_0x576f38){var _0x3c0d8a=this;return new Promise(function(_0x18a307,_0x1766b1){return db['Pause'][_0xd5e8('0x15')]({'raw':_0x576f38[_0xd5e8('0x16')]?_0x576f38['options'][_0xd5e8('0x17')]===undefined?!![]:![]:!![],'where':_0x576f38['options']?_0x576f38[_0xd5e8('0x16')][_0xd5e8('0x18')]||null:null,'attributes':_0x576f38[_0xd5e8('0x16')]?_0x576f38[_0xd5e8('0x16')][_0xd5e8('0x19')]||null:null,'include':_0x576f38['options']?_0x576f38[_0xd5e8('0x16')][_0xd5e8('0x1a')]?_[_0xd5e8('0x1b')](_0x576f38['options'][_0xd5e8('0x1a')],function(_0x278541){return{'model':db[_0x278541[_0xd5e8('0x1c')]],'as':_0x278541['as'],'attributes':_0x278541[_0xd5e8('0x19')],'include':_0x278541['include']?_[_0xd5e8('0x1b')](_0x278541[_0xd5e8('0x1a')],function(_0x2e2bbe){return{'model':db[_0x2e2bbe[_0xd5e8('0x1c')]],'as':_0x2e2bbe['as'],'attributes':_0x2e2bbe['attributes'],'include':_0x2e2bbe[_0xd5e8('0x1a')]?_[_0xd5e8('0x1b')](_0x2e2bbe['include'],function(_0x4feac0){return{'model':db[_0x4feac0[_0xd5e8('0x1c')]],'as':_0x4feac0['as'],'attributes':_0x4feac0[_0xd5e8('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x6afecf){logger[_0xd5e8('0xc')](_0xd5e8('0x1d'),_0x576f38);logger[_0xd5e8('0xf')](_0xd5e8('0x1d'),_0x576f38,JSON[_0xd5e8('0x1e')](_0x6afecf));_0x18a307(_0x6afecf);})[_0xd5e8('0x1f')](function(_0x244762){logger['error'](_0xd5e8('0x1d'),_0x244762[_0xd5e8('0x13')],_0x576f38);_0x1766b1(_0x3c0d8a[_0xd5e8('0x11')](0x1f4,_0x244762[_0xd5e8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 9d4950e..66875d5 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 _0xe8ea=['basename','extname','now','file','upload','post','webhookPost','put','/:id','update','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','webhookGet','show','/:id/download','download','join','root','originalname','replace','format'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xe8ea,0xbf));var _0xae8e=function(_0x156c41,_0x171054){_0x156c41=_0x156c41-0x0;var _0x410adf=_0xe8ea[_0x156c41];return _0x410adf;};'use strict';var multer=require('multer');var util=require(_0xae8e('0x0'));var path=require(_0xae8e('0x1'));var express=require('express');var router=express[_0xae8e('0x2')]();var auth=require(_0xae8e('0x3'));var interaction=require(_0xae8e('0x4'));var config=require(_0xae8e('0x5'));var controller=require(_0xae8e('0x6'));router[_0xae8e('0x7')]('/',auth[_0xae8e('0x8')](),controller[_0xae8e('0x9')]);router[_0xae8e('0x7')]('/webhook',controller[_0xae8e('0xa')]);router[_0xae8e('0x7')]('/:id',auth[_0xae8e('0x8')](),controller[_0xae8e('0xb')]);router[_0xae8e('0x7')](_0xae8e('0xc'),auth['isAuthenticated'](),controller[_0xae8e('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x582c50,_0xcec17e,_0x245017){_0x245017(null,path[_0xae8e('0xe')](config[_0xae8e('0xf')],'server/files/plugins'));},'filename':function(_0x7e198a,_0x3f772e,_0x135685){_0x3f772e[_0xae8e('0x10')]=_0x3f772e[_0xae8e('0x10')][_0xae8e('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x135685(null,util[_0xae8e('0x12')]('%s-%s%s',path[_0xae8e('0x13')](_0x3f772e[_0xae8e('0x10')],path[_0xae8e('0x14')](_0x3f772e['originalname'])),Date[_0xae8e('0x15')](),path[_0xae8e('0x14')](_0x3f772e['originalname'])));}})});router['post']('/',upload['single'](_0xae8e('0x16')),controller[_0xae8e('0x17')]);router[_0xae8e('0x18')]('/webhook',controller[_0xae8e('0x19')]);router[_0xae8e('0x1a')](_0xae8e('0x1b'),auth[_0xae8e('0x8')](),controller[_0xae8e('0x1c')]);router['delete'](_0xae8e('0x1b'),auth['isAuthenticated'](),controller['delete']);module[_0xae8e('0x1d')]=router; \ No newline at end of file +var _0xd06c=['extname','now','post','file','upload','webhookPost','put','update','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','get','/webhook','show','/:id/download','download','diskStorage','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xd06c,0x9e));var _0xcd06=function(_0x4e26b6,_0x317575){_0x4e26b6=_0x4e26b6-0x0;var _0x4c2cca=_0xd06c[_0x4e26b6];return _0x4c2cca;};'use strict';var multer=require(_0xcd06('0x0'));var util=require(_0xcd06('0x1'));var path=require(_0xcd06('0x2'));var express=require('express');var router=express[_0xcd06('0x3')]();var auth=require(_0xcd06('0x4'));var interaction=require(_0xcd06('0x5'));var config=require(_0xcd06('0x6'));var controller=require(_0xcd06('0x7'));router['get']('/',auth[_0xcd06('0x8')](),controller['index']);router[_0xcd06('0x9')](_0xcd06('0xa'),controller['webhookGet']);router[_0xcd06('0x9')]('/:id',auth[_0xcd06('0x8')](),controller[_0xcd06('0xb')]);router[_0xcd06('0x9')](_0xcd06('0xc'),auth['isAuthenticated'](),controller[_0xcd06('0xd')]);var upload=multer({'storage':multer[_0xcd06('0xe')]({'destination':function(_0x2d5271,_0x50833e,_0x205989){_0x205989(null,path['join'](config[_0xcd06('0xf')],_0xcd06('0x10')));},'filename':function(_0x361d03,_0xb76714,_0x3a0d21){_0xb76714[_0xcd06('0x11')]=_0xb76714['originalname'][_0xcd06('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3a0d21(null,util[_0xcd06('0x13')](_0xcd06('0x14'),path[_0xcd06('0x15')](_0xb76714[_0xcd06('0x11')],path[_0xcd06('0x16')](_0xb76714['originalname'])),Date[_0xcd06('0x17')](),path['extname'](_0xb76714['originalname'])));}})});router[_0xcd06('0x18')]('/',upload['single'](_0xcd06('0x19')),controller[_0xcd06('0x1a')]);router[_0xcd06('0x18')](_0xcd06('0xa'),controller[_0xcd06('0x1b')]);router[_0xcd06('0x1c')]('/:id',auth[_0xcd06('0x8')](),controller[_0xcd06('0x1d')]);router['delete']('/:id',auth['isAuthenticated'](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 29690d7..1140bbd 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 _0x826f=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','never','always','sequelize','exports','STRING','ENUM','script','TEXT','BOOLEAN'];(function(_0x120f6b,_0x18933a){var _0x2275bc=function(_0x231fad){while(--_0x231fad){_0x120f6b['push'](_0x120f6b['shift']());}};_0x2275bc(++_0x18933a);}(_0x826f,0x143));var _0xf826=function(_0x3d734c,_0x4b30f8){_0x3d734c=_0x3d734c-0x0;var _0x3cad96=_0x826f[_0x3d734c];return _0x3cad96;};'use strict';var Sequelize=require(_0xf826('0x0'));module[_0xf826('0x1')]={'name':{'type':Sequelize[_0xf826('0x2')]},'type':{'type':Sequelize[_0xf826('0x3')]('html',_0xf826('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xf826('0x5')]},'path':{'type':Sequelize[_0xf826('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xf826('0x6')],'defaultValue':0x0,'comment':_0xf826('0x7')},'sidebar':{'type':Sequelize[_0xf826('0x3')](_0xf826('0x8'),'agentOnly','always',_0xf826('0x9')),'defaultValue':_0xf826('0xa'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xf826('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xf826('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcbfa=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','TEXT'];(function(_0x4a5ade,_0x3307f2){var _0x3d462f=function(_0x18a19a){while(--_0x18a19a){_0x4a5ade['push'](_0x4a5ade['shift']());}};_0x3d462f(++_0x3307f2);}(_0xcbfa,0x18d));var _0xacbf=function(_0x3b9d79,_0x42f721){_0x3b9d79=_0x3b9d79-0x0;var _0x16d93e=_0xcbfa[_0x3b9d79];return _0x16d93e;};'use strict';var Sequelize=require(_0xacbf('0x0'));module[_0xacbf('0x1')]={'name':{'type':Sequelize[_0xacbf('0x2')]},'type':{'type':Sequelize[_0xacbf('0x3')](_0xacbf('0x4'),'script')},'description':{'type':Sequelize[_0xacbf('0x5')]},'version':{'type':Sequelize[_0xacbf('0x5')]},'path':{'type':Sequelize[_0xacbf('0x2')],'comment':_0xacbf('0x6')},'active':{'type':Sequelize[_0xacbf('0x7')],'defaultValue':0x0,'comment':_0xacbf('0x8')},'sidebar':{'type':Sequelize[_0xacbf('0x3')](_0xacbf('0x9'),_0xacbf('0xa'),_0xacbf('0xb'),'never'),'defaultValue':_0xacbf('0xb'),'comment':_0xacbf('0xc')},'icon':{'type':Sequelize[_0xacbf('0x2')]},'adminUrl':{'type':Sequelize[_0xacbf('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xacbf('0x2')]},'scriptPath':{'type':Sequelize[_0xacbf('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index e6c0cc0..1d26a8c 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 _0x6e9f=['Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','root','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','download','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','type','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','parameters','admin','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','unlinkSync','update','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','json','encoding','method','%s%s','headers','statusCode','body','webhookPost','resolve','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','rimraf','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','localhost','register','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','save','then','destroy','name','send','index','rawAttributes','query','dateStart','dateEnd','keys','filters','intersection','model','fields','attributes','hasOwnProperty','sort','where','pick','add','day','merge','map','filter','Plugin','include','findAll','rows','catch','show','params','length','find','join','server/files/plugins','format','%s.zip','basename','zip','code','error'];(function(_0x114fed,_0x11f20f){var _0x5a53f4=function(_0x35e3cf){while(--_0x35e3cf){_0x114fed['push'](_0x114fed['shift']());}};_0x5a53f4(++_0x11f20f);}(_0x6e9f,0x179));var _0xf6e9=function(_0x29600e,_0x1b6712){_0x29600e=_0x29600e-0x0;var _0x455f48=_0x6e9f[_0x29600e];return _0x455f48;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf6e9('0x0'));var BPromise=require(_0xf6e9('0x1'));var Mustache=require(_0xf6e9('0x2'));var util=require(_0xf6e9('0x3'));var path=require(_0xf6e9('0x4'));var sox=require(_0xf6e9('0x5'));var csv=require(_0xf6e9('0x6'));var ejs=require(_0xf6e9('0x7'));var fs=require('fs');var _=require(_0xf6e9('0x8'));var squel=require(_0xf6e9('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf6e9('0xa'));var toCsv=require(_0xf6e9('0x6'));var querystring=require(_0xf6e9('0xb'));var Papa=require(_0xf6e9('0xc'));var extract=require('extract-zip');var rimraf=require(_0xf6e9('0xd'));var archiver=require('archiver');var qs=require(_0xf6e9('0xe'));var logger=require(_0xf6e9('0xf'))(_0xf6e9('0x10'));var utils=require('../../config/utils');var config=require(_0xf6e9('0x11'));var db=require(_0xf6e9('0x12'))['db'];var socket=require(_0xf6e9('0x13'))({'host':_0xf6e9('0x14'),'port':0x18eb});require('./plugin.socket')[_0xf6e9('0x15')](socket);function respondWithStatusCode(_0x42843f,_0x348e48){_0x348e48=_0x348e48||0xcc;return function(_0x7f06ff){if(_0x7f06ff){return _0x42843f[_0xf6e9('0x16')](_0x348e48);}return _0x42843f[_0xf6e9('0x17')](_0x348e48)[_0xf6e9('0x18')]();};}function respondWithResult(_0x2ae4ab,_0x3905b6){_0x3905b6=_0x3905b6||0xc8;return function(_0x545548){if(_0x545548){return _0x2ae4ab['status'](_0x3905b6)['json'](_0x545548);}};}function respondWithFilteredResult(_0x6b854e,_0x58fc73){return function(_0x339fcf){if(_0x339fcf){var _0x3b3563=_0x339fcf[_0xf6e9('0x19')],_0xf34ce2=_0x58fc73['offset'],_0x343d2a=_0x58fc73[_0xf6e9('0x1a')]+_0x58fc73[_0xf6e9('0x1b')],_0x119d76;if(_0x343d2a>=_0x3b3563){_0x343d2a=_0x3b3563;_0x119d76=0xc8;}else{_0x119d76=0xce;}_0x6b854e['status'](_0x119d76);return _0x6b854e[_0xf6e9('0x1c')](_0xf6e9('0x1d'),_0xf34ce2+'-'+_0x343d2a+'/'+_0x3b3563)['json'](_0x339fcf);}return null;};}function patchUpdates(_0x45ac7d){return function(_0x1c3a6f){try{jsonpatch[_0xf6e9('0x1e')](_0x1c3a6f,_0x45ac7d,!![]);}catch(_0x4adce6){return BPromise['reject'](_0x4adce6);}return _0x1c3a6f[_0xf6e9('0x1f')]();};}function saveUpdates(_0x5a9047,_0x27c091){return function(_0x26b82a){if(_0x26b82a){return _0x26b82a['update'](_0x5a9047)[_0xf6e9('0x20')](function(_0x19fc9b){return _0x19fc9b;});}return null;};}function removeEntity(_0x24cd53,_0x597a84){return function(_0xc154a9){if(_0xc154a9){return _0xc154a9[_0xf6e9('0x21')]()[_0xf6e9('0x20')](function(){_0x24cd53[_0xf6e9('0x17')](0xcc)[_0xf6e9('0x18')]();});}};}function handleEntityNotFound(_0x170567,_0x1b3af6){return function(_0x3fb88e){if(!_0x3fb88e){_0x170567[_0xf6e9('0x16')](0x194);}return _0x3fb88e;};}function handleError(_0x22810a,_0x4d647f){_0x4d647f=_0x4d647f||0x1f4;return function(_0x316aa5){logger['error'](_0x316aa5['stack']);if(_0x316aa5[_0xf6e9('0x22')]){delete _0x316aa5['name'];}_0x22810a[_0xf6e9('0x17')](_0x4d647f)[_0xf6e9('0x23')](_0x316aa5);};}exports[_0xf6e9('0x24')]=function(_0x3fdbb4,_0xa89a1f){var _0x3bdeb8={},_0x1877f1={},_0x7123b4={'count':0x0,'rows':[]};var _0x5ed954=db['Plugin'][_0xf6e9('0x25')];_0x1877f1['model']=_['keys'](_0x5ed954);var _0x571c7c={'dateStart':_0x3fdbb4[_0xf6e9('0x26')][_0xf6e9('0x27')],'dateEnd':_0x3fdbb4['query'][_0xf6e9('0x28')]};delete _0x3fdbb4[_0xf6e9('0x26')][_0xf6e9('0x27')];delete _0x3fdbb4[_0xf6e9('0x26')][_0xf6e9('0x28')];_0x1877f1[_0xf6e9('0x26')]=_[_0xf6e9('0x29')](_0x3fdbb4[_0xf6e9('0x26')]);_0x1877f1[_0xf6e9('0x2a')]=_[_0xf6e9('0x2b')](_0x1877f1['model'],_0x1877f1[_0xf6e9('0x26')]);_0x3bdeb8['attributes']=_[_0xf6e9('0x2b')](_0x1877f1[_0xf6e9('0x2c')],qs[_0xf6e9('0x2d')](_0x3fdbb4[_0xf6e9('0x26')][_0xf6e9('0x2d')]));_0x3bdeb8[_0xf6e9('0x2e')]=_0x3bdeb8[_0xf6e9('0x2e')]['length']?_0x3bdeb8['attributes']:_0x1877f1[_0xf6e9('0x2c')];if(!_0x3fdbb4[_0xf6e9('0x26')][_0xf6e9('0x2f')]('nolimit')){_0x3bdeb8['limit']=qs[_0xf6e9('0x1b')](_0x3fdbb4[_0xf6e9('0x26')][_0xf6e9('0x1b')]);_0x3bdeb8[_0xf6e9('0x1a')]=qs[_0xf6e9('0x1a')](_0x3fdbb4['query'][_0xf6e9('0x1a')]);}_0x3bdeb8['order']=qs[_0xf6e9('0x30')](_0x3fdbb4['query']['sort']);_0x3bdeb8[_0xf6e9('0x31')]=qs[_0xf6e9('0x2a')](_[_0xf6e9('0x32')](_0x3fdbb4['query'],_0x1877f1['filters']));if(_0x571c7c['dateStart']){if(_0x571c7c[_0xf6e9('0x28')]){_0x571c7c[_0xf6e9('0x28')]=moment(_0x571c7c['dateEnd'])['add'](0x1,'day');}else{_0x571c7c[_0xf6e9('0x28')]=moment(_0x571c7c[_0xf6e9('0x27')])[_0xf6e9('0x33')](0x1,_0xf6e9('0x34'));}_[_0xf6e9('0x35')](_0x3bdeb8[_0xf6e9('0x31')],{'createdAt':{'$gte':_0x571c7c[_0xf6e9('0x27')],'$lte':_0x571c7c[_0xf6e9('0x28')]}});}if(_0x3fdbb4[_0xf6e9('0x26')]['filter']){_0x3bdeb8[_0xf6e9('0x31')]=_['merge'](_0x3bdeb8[_0xf6e9('0x31')],{'$or':_[_0xf6e9('0x36')](_0x3bdeb8[_0xf6e9('0x2e')],function(_0x1e5b5d){var _0x4bc547={};_0x4bc547[_0x1e5b5d]={'$like':'%'+_0x3fdbb4[_0xf6e9('0x26')][_0xf6e9('0x37')]+'%'};return _0x4bc547;})});}_0x3bdeb8=_[_0xf6e9('0x35')]({},_0x3bdeb8,_0x3fdbb4['options']);var _0x68a25a={'where':_0x3bdeb8[_0xf6e9('0x31')]};return db[_0xf6e9('0x38')][_0xf6e9('0x19')](_0x68a25a)[_0xf6e9('0x20')](function(_0x40e2da){_0x7123b4[_0xf6e9('0x19')]=_0x40e2da;if(_0x3fdbb4[_0xf6e9('0x26')]['includeAll']){_0x3bdeb8[_0xf6e9('0x39')]=[{'all':!![]}];}return db[_0xf6e9('0x38')][_0xf6e9('0x3a')](_0x3bdeb8);})[_0xf6e9('0x20')](function(_0x18d97f){_0x7123b4[_0xf6e9('0x3b')]=_0x18d97f;return _0x7123b4;})[_0xf6e9('0x20')](respondWithFilteredResult(_0xa89a1f,_0x3bdeb8))[_0xf6e9('0x3c')](handleError(_0xa89a1f,null));};exports[_0xf6e9('0x3d')]=function(_0x1a415f,_0xe13bdd){var _0x4ca93f={'raw':!![],'where':{'id':_0x1a415f[_0xf6e9('0x3e')]['id']}},_0x198273={};_0x198273['model']=_[_0xf6e9('0x29')](db[_0xf6e9('0x38')]['rawAttributes']);_0x198273[_0xf6e9('0x26')]=_[_0xf6e9('0x29')](_0x1a415f['query']);_0x198273[_0xf6e9('0x2a')]=_[_0xf6e9('0x2b')](_0x198273[_0xf6e9('0x2c')],_0x198273[_0xf6e9('0x26')]);_0x4ca93f[_0xf6e9('0x2e')]=_[_0xf6e9('0x2b')](_0x198273[_0xf6e9('0x2c')],qs['fields'](_0x1a415f[_0xf6e9('0x26')][_0xf6e9('0x2d')]));_0x4ca93f[_0xf6e9('0x2e')]=_0x4ca93f[_0xf6e9('0x2e')][_0xf6e9('0x3f')]?_0x4ca93f['attributes']:_0x198273[_0xf6e9('0x2c')];if(_0x1a415f[_0xf6e9('0x26')]['includeAll']){_0x4ca93f[_0xf6e9('0x39')]=[{'all':!![]}];}_0x4ca93f=_[_0xf6e9('0x35')]({},_0x4ca93f,_0x1a415f['options']);return db['Plugin'][_0xf6e9('0x40')](_0x4ca93f)[_0xf6e9('0x20')](handleEntityNotFound(_0xe13bdd,null))[_0xf6e9('0x20')](respondWithResult(_0xe13bdd,null))[_0xf6e9('0x3c')](handleError(_0xe13bdd,null));};exports['download']=function(_0x37a9a2,_0x7b43bb,_0x1f0d90){return db[_0xf6e9('0x38')][_0xf6e9('0x40')]({'where':{'id':_0x37a9a2[_0xf6e9('0x3e')]['id']},'attributes':[_0xf6e9('0x22'),_0xf6e9('0x4')],'raw':!![]})['then'](handleEntityNotFound(_0x7b43bb,null))['then'](function(_0x1bf0c3){if(_0x1bf0c3){var _0x56264c=path[_0xf6e9('0x41')](config['root'],_0xf6e9('0x42'),util[_0xf6e9('0x43')](_0xf6e9('0x44'),path[_0xf6e9('0x45')](_0x1bf0c3[_0xf6e9('0x4')])));var _0x5ea2e3=fs['createWriteStream'](_0x56264c);var _0x55bb76=archiver(_0xf6e9('0x46'),{'zlib':{'level':0x9}});_0x55bb76['on']('warning',function(_0x4a45f6){if(_0x4a45f6[_0xf6e9('0x47')]==='ENOENT'){logger[_0xf6e9('0x48')](_0x4a45f6);}else{throw new db[(_0xf6e9('0x49'))][(_0xf6e9('0x4a'))](_0xf6e9('0x4b'));}});_0x55bb76['on']('error',function(_0x2800ca){throw new db[(_0xf6e9('0x49'))][(_0xf6e9('0x4a'))](_0xf6e9('0x4b'));});_0x55bb76[_0xf6e9('0x4c')](_0x5ea2e3);_0x55bb76[_0xf6e9('0x4d')](_0xf6e9('0x4e'),{'cwd':path[_0xf6e9('0x41')](config[_0xf6e9('0x4f')],'server/files/plugins',path[_0xf6e9('0x50')](_0x1bf0c3['path'])),'ignore':[path[_0xf6e9('0x41')](path[_0xf6e9('0x45')](_0x1bf0c3[_0xf6e9('0x4')]),_0xf6e9('0x51')),path[_0xf6e9('0x41')](path[_0xf6e9('0x45')](_0x1bf0c3[_0xf6e9('0x4')]),_0xf6e9('0x52'))],'nodir':!![]})[_0xf6e9('0x53')]();_0x5ea2e3['on'](_0xf6e9('0x54'),function(){if(!fs[_0xf6e9('0x55')](_0x56264c)){throw new db['Sequelize']['Error']('Plugin\x20not\x20found');}return _0x7b43bb[_0xf6e9('0x56')](_0x56264c,util[_0xf6e9('0x43')](_0xf6e9('0x44'),path[_0xf6e9('0x45')](_0x1bf0c3[_0xf6e9('0x4')])),function(_0x141c89){if(_0x141c89){throw new db[(_0xf6e9('0x49'))][(_0xf6e9('0x4a'))](_0xf6e9('0x57'));}fs['unlinkSync'](_0x56264c);logger[_0xf6e9('0x58')](_0xf6e9('0x59'));logger[_0xf6e9('0x58')]('Temporary\x20file\x20removed');});});}return null;})[_0xf6e9('0x3c')](handleError(_0x7b43bb,null));};exports[_0xf6e9('0x5a')]=function(_0x93705c,_0x241361,_0x13aca7){var _0x4923a0=path[_0xf6e9('0x45')](_0x93705c[_0xf6e9('0x5b')][_0xf6e9('0x5c')],path[_0xf6e9('0x5d')](_0x93705c[_0xf6e9('0x5b')][_0xf6e9('0x5c')]));var _0x5ac63b=path[_0xf6e9('0x41')](config[_0xf6e9('0x4f')],_0xf6e9('0x42'),_0x93705c[_0xf6e9('0x5b')][_0xf6e9('0x5c')]);var _0x49a40e=path[_0xf6e9('0x41')](config[_0xf6e9('0x4f')],'server/files/plugins',_0x4923a0);logger[_0xf6e9('0x58')](_0xf6e9('0x5e'),_0x5ac63b);logger[_0xf6e9('0x58')](_0xf6e9('0x5f'),_0x49a40e);try{fs[_0xf6e9('0x60')](_0x5ac63b,parseInt(_0xf6e9('0x61'),0x8));extract(_0x5ac63b,{'dir':_0x49a40e},function(_0x56b454){if(_0x56b454){logger[_0xf6e9('0x48')](_0x56b454);handleError(_0x56b454,!![]);};var _0x4b22cd=fs[_0xf6e9('0x62')](_0x49a40e);if(_0x4b22cd[_0xf6e9('0x3f')]>0x1){removeReferences(_0x5ac63b,_0x49a40e);logger[_0xf6e9('0x48')](_0xf6e9('0x63'));return _0x13aca7(new Error(_0xf6e9('0x63')));}var _0x48500d=fs[_0xf6e9('0x64')](path[_0xf6e9('0x41')](_0x49a40e,_0x4b22cd[0x0]));if(_0x48500d[_0xf6e9('0x65')]()){removeReferences(_0x5ac63b,_0x49a40e);logger[_0xf6e9('0x48')]('Invalid\x20plugin\x20structure');return _0x13aca7(new Error(_0xf6e9('0x63')));}if(_0x48500d[_0xf6e9('0x66')]()){var _0x12dcde=fs['readdirSync'](path[_0xf6e9('0x41')](_0x49a40e,_0x4b22cd[0x0]));if(_0x12dcde[_0xf6e9('0x3f')]===0x0){removeReferences(_0x5ac63b,_0x49a40e);logger[_0xf6e9('0x48')](_0xf6e9('0x63'));return _0x13aca7(new Error('Invalid\x20plugin\x20structure'));}var _0x56375b=_0x12dcde[_0xf6e9('0x67')](function(_0x128d72){return _0x128d72===_0xf6e9('0x68');});if(!_0x56375b){return _0x13aca7(new Error(_0xf6e9('0x69')));}var _0x580477=fs[_0xf6e9('0x6a')](path[_0xf6e9('0x41')](_0x49a40e,_0x4b22cd[0x0],_0xf6e9('0x68')));var _0x4cbf2d=JSON[_0xf6e9('0x6b')](_0x580477);if(_0xf6e9('0x6c')==typeof _0x4cbf2d[_0xf6e9('0x22')]){return _0x13aca7(new Error(_0xf6e9('0x6d')));}if(_0xf6e9('0x6c')==typeof _0x4cbf2d[_0xf6e9('0x6e')]){return _0x13aca7(new Error(_0xf6e9('0x6f')));}if(_0xf6e9('0x6c')==typeof _0x4cbf2d[_0xf6e9('0x70')]){return _0x13aca7(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xf6e9('0x6c')==typeof _0x4cbf2d['parameters']){return _0x13aca7(new Error(_0xf6e9('0x71')));}if(_0x4cbf2d[_0xf6e9('0x6e')]===_0xf6e9('0x72')){if(_0xf6e9('0x6c')==typeof _0x4cbf2d['parameters']['views']){return _0x13aca7(new Error(_0xf6e9('0x73')));}if(_0xf6e9('0x6c')==typeof _0x4cbf2d[_0xf6e9('0x74')]['views'][_0xf6e9('0x75')]&&_0xf6e9('0x6c')==typeof _0x4cbf2d[_0xf6e9('0x74')][_0xf6e9('0x76')][_0xf6e9('0x77')]){return _0x13aca7(new Error(_0xf6e9('0x78')));}}else if(_0x4cbf2d['type']===_0xf6e9('0x79')){if('undefined'==typeof _0x4cbf2d[_0xf6e9('0x74')][_0xf6e9('0x7a')]){return _0x13aca7(new Error(_0xf6e9('0x7b')));}if(_0xf6e9('0x6c')==typeof _0x4cbf2d['parameters'][_0xf6e9('0x7c')]){return _0x13aca7(new Error(_0xf6e9('0x7d')));}}else{return _0x13aca7(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x47dd7b=_0x4cbf2d[_0xf6e9('0x22')];var _0x2a0675=_0x4cbf2d['description'];var _0x7510f7=_0x4cbf2d[_0xf6e9('0x6e')];var _0x3b91e2=_0x4cbf2d[_0xf6e9('0x7e')]?_0x4cbf2d[_0xf6e9('0x7e')]:'always';var _0x180f50=_0x4cbf2d[_0xf6e9('0x7f')]?_0x4cbf2d['icon']:'icon-apps';var _0x1c05ef='';var _0x1eed5a='';var _0x461131='';var _0x11c5e4='';var _0xd4b565=_0x4cbf2d[_0xf6e9('0x70')];if(_0x7510f7===_0xf6e9('0x72')){if(_0xf6e9('0x6c')!=typeof _0x4cbf2d[_0xf6e9('0x74')][_0xf6e9('0x76')][_0xf6e9('0x75')]){var _0x10142a=_0x4cbf2d['parameters'][_0xf6e9('0x76')][_0xf6e9('0x75')];if(!/^(f|ht)tps?:\/\//i[_0xf6e9('0x80')](_0x10142a)){_0x1c05ef=path[_0xf6e9('0x41')](_0xf6e9('0x81'),_0x4923a0,_0x4b22cd[0x0],_0x10142a);}else{_0x1c05ef=_0x10142a;}}else{logger[_0xf6e9('0x58')](_0xf6e9('0x82'));}if(_0xf6e9('0x6c')!=typeof _0x4cbf2d[_0xf6e9('0x74')][_0xf6e9('0x76')][_0xf6e9('0x77')]){var _0x276d0c=_0x4cbf2d['parameters'][_0xf6e9('0x76')][_0xf6e9('0x77')];if(!/^(f|ht)tps?:\/\//i[_0xf6e9('0x80')](_0x276d0c)){_0x1eed5a=path[_0xf6e9('0x41')](_0xf6e9('0x81'),_0x4923a0,_0x4b22cd[0x0],_0x276d0c);}else{_0x1eed5a=_0x276d0c;}}else{logger[_0xf6e9('0x58')](_0xf6e9('0x83'));}}else if(_0x7510f7===_0xf6e9('0x79')){_0x461131=_0x4cbf2d[_0xf6e9('0x74')]['scriptName'];_0x11c5e4=_0x4cbf2d[_0xf6e9('0x74')][_0xf6e9('0x7c')];if(_0xf6e9('0x6c')!=typeof _0x4cbf2d[_0xf6e9('0x74')]['views']){if('undefined'!=typeof _0x4cbf2d[_0xf6e9('0x74')][_0xf6e9('0x76')]['admin']){var _0x10142a=_0x4cbf2d[_0xf6e9('0x74')][_0xf6e9('0x76')][_0xf6e9('0x75')];if(!/^(f|ht)tps?:\/\//i[_0xf6e9('0x80')](_0x10142a)){_0x1c05ef=path['join']('plugins',_0x4923a0,_0x4b22cd[0x0],_0x10142a);}else{_0x1c05ef=_0x10142a;}}if('undefined'!=typeof _0x4cbf2d[_0xf6e9('0x74')][_0xf6e9('0x76')]['agent']){var _0x276d0c=_0x4cbf2d[_0xf6e9('0x74')][_0xf6e9('0x76')][_0xf6e9('0x77')];if(!/^(f|ht)tps?:\/\//i[_0xf6e9('0x80')](_0x276d0c)){_0x1eed5a=path[_0xf6e9('0x41')](_0xf6e9('0x81'),_0x4923a0,_0x4b22cd[0x0],_0x276d0c);}else{_0x1eed5a=_0x276d0c;}}}}var _0x639822={'name':_0x47dd7b,'description':_0x2a0675,'path':path['join'](_0x4923a0,_0x4b22cd[0x0]),'type':_0x7510f7,'sidebar':_0x3b91e2,'icon':_0x180f50,'adminUrl':_0x1c05ef,'agentUrl':_0x1eed5a,'scriptName':_0x461131,'scriptPath':_0x11c5e4,'version':_0xd4b565};removeReferences(_0x5ac63b,null);return db[_0xf6e9('0x38')]['create'](_0x639822)[_0xf6e9('0x20')](respondWithResult(_0x241361,null))['catch'](handleError(_0x241361,null));}});}catch(_0x41a07f){_0x241361[_0xf6e9('0x17')](0x1f4)['send'](_0x41a07f);}};function removeReferences(_0x37c634,_0x390581){try{if(_0x37c634){fs[_0xf6e9('0x84')](_0x37c634);logger[_0xf6e9('0x58')]('Zip\x20archive\x20removed');}if(_0x390581){rimraf(_0x390581,function(){});logger[_0xf6e9('0x58')]('Extracted\x20folder\x20removed');}}catch(_0x4031eb){logger[_0xf6e9('0x48')](_0x4031eb);}}exports[_0xf6e9('0x85')]=function(_0x25a4f6,_0x49cdb9,_0x2239c2){return db[_0xf6e9('0x38')][_0xf6e9('0x40')]({'where':{'id':_0x25a4f6['params']['id']}})[_0xf6e9('0x20')](handleEntityNotFound(_0x49cdb9,null))[_0xf6e9('0x20')](saveUpdates(_0x25a4f6['body'],null))[_0xf6e9('0x20')](respondWithResult(_0x49cdb9,null))[_0xf6e9('0x3c')](handleError(_0x49cdb9,null));};exports[_0xf6e9('0x86')]=function(_0x3e6ed9,_0x5adbf4,_0x3ef77e){return db[_0xf6e9('0x38')]['find']({'where':{'id':_0x3e6ed9[_0xf6e9('0x3e')]['id']}})[_0xf6e9('0x20')](function(_0x2698de){if(_0x2698de){return _0x2698de[_0xf6e9('0x21')]();}})[_0xf6e9('0x20')](function(_0x4201be){rimraf(path['join'](config[_0xf6e9('0x4f')],_0xf6e9('0x42'),path[_0xf6e9('0x50')](_0x4201be['path'])),function(){});return _0x4201be;})['then'](handleEntityNotFound(_0x5adbf4,null))[_0xf6e9('0x20')](respondWithStatusCode(_0x5adbf4,null))[_0xf6e9('0x3c')](handleError(_0x5adbf4,null));};exports[_0xf6e9('0x87')]=function(_0x21592e,_0x5db7e5,_0x33b844){return BPromise['resolve']()[_0xf6e9('0x20')](function(){if(!_0x21592e['query']['path']){throw new Error(_0xf6e9('0x88'));}if(!_0x21592e[_0xf6e9('0x26')][_0xf6e9('0x89')]){throw new Error(_0xf6e9('0x8a'));}var _0x726c5e=_0x21592e[_0xf6e9('0x26')][_0xf6e9('0x8b')]?_0x21592e[_0xf6e9('0x26')]['hostname']+':'+_0x21592e[_0xf6e9('0x26')][_0xf6e9('0x89')]:_0xf6e9('0x8c')+_0x21592e[_0xf6e9('0x26')][_0xf6e9('0x89')];var _0xf0071f=_0x21592e[_0xf6e9('0x26')][_0xf6e9('0x8d')]?_0x21592e['query'][_0xf6e9('0x8d')]:!![];var _0x429352=_0x21592e[_0xf6e9('0x26')][_0xf6e9('0x8e')]?_0x21592e['query'][_0xf6e9('0x8e')]:null;var _0x50e51a={'method':_0x21592e[_0xf6e9('0x8f')],'uri':util[_0xf6e9('0x43')](_0xf6e9('0x90'),_0x726c5e,_0x21592e['query'][_0xf6e9('0x4')]),'json':_0xf0071f,'resolveWithFullResponse':!![],'encoding':_0x429352,'qs':_0x21592e[_0xf6e9('0x26')]};if(_0x21592e['query'][_0xf6e9('0x91')]){_0x50e51a[_0xf6e9('0x91')]=_0x21592e[_0xf6e9('0x91')];}return rp(_0x50e51a);})[_0xf6e9('0x20')](function(_0x4d5354){if(_0x4d5354){_0x5db7e5['set'](_0x4d5354[_0xf6e9('0x91')]);logger[_0xf6e9('0x58')](_0x4d5354['body']);if(_['endsWith'](_0x21592e[_0xf6e9('0x26')][_0xf6e9('0x4')],_0xf6e9('0x56'))&&_0x4d5354[_0xf6e9('0x92')]==0x1f4){return _0x5db7e5['sendStatus'](_0x4d5354[_0xf6e9('0x92')]);}else{return _0x5db7e5[_0xf6e9('0x17')](_0x4d5354[_0xf6e9('0x92')])[_0xf6e9('0x23')](_0x4d5354[_0xf6e9('0x93')]);}}else{return _0x5db7e5[_0xf6e9('0x16')](0xc8);}})[_0xf6e9('0x3c')](handleError(_0x5db7e5,null));};exports[_0xf6e9('0x94')]=function(_0x1b2e27,_0x3a54d9,_0x19e9b2){return BPromise[_0xf6e9('0x95')]()[_0xf6e9('0x20')](function(){if(!_0x1b2e27[_0xf6e9('0x26')]['path']){throw new Error(_0xf6e9('0x88'));}if(!_0x1b2e27['query'][_0xf6e9('0x89')]){throw new Error(_0xf6e9('0x8a'));}var _0x26e09b=_0x1b2e27[_0xf6e9('0x26')]['hostname']?_0x1b2e27[_0xf6e9('0x26')][_0xf6e9('0x8b')]+':'+_0x1b2e27['query'][_0xf6e9('0x89')]:_0xf6e9('0x8c')+_0x1b2e27[_0xf6e9('0x26')][_0xf6e9('0x89')];var _0x41c906=_0x1b2e27['query'][_0xf6e9('0x8d')]?_0x1b2e27[_0xf6e9('0x26')]['json']:!![];var _0x170f36=_0x1b2e27[_0xf6e9('0x26')]['encoding']?_0x1b2e27['query']['encoding']:null;var _0x2766bf={'method':_0x1b2e27[_0xf6e9('0x8f')],'uri':util[_0xf6e9('0x43')]('%s%s',_0x26e09b,_0x1b2e27[_0xf6e9('0x26')][_0xf6e9('0x4')]),'json':_0x41c906,'resolveWithFullResponse':!![],'encoding':_0x170f36,'body':_0x1b2e27[_0xf6e9('0x93')]};if(_0x1b2e27[_0xf6e9('0x26')][_0xf6e9('0x91')]){_0x2766bf[_0xf6e9('0x91')]=_0x1b2e27[_0xf6e9('0x91')];}return rp(_0x2766bf);})['then'](function(_0x1fef26){if(_0x1fef26){_0x3a54d9[_0xf6e9('0x1c')](_0x1fef26['headers']);logger['info'](_0x1fef26[_0xf6e9('0x93')]);return _0x3a54d9[_0xf6e9('0x17')](_0x1fef26['statusCode'])['send'](_0x1fef26[_0xf6e9('0x93')]);}else{return _0x3a54d9['sendStatus'](0xc8);}})[_0xf6e9('0x3c')](handleError(_0x3a54d9,null));}; \ No newline at end of file +var _0x8913=['register','sendStatus','status','end','json','count','limit','Content-Range','apply','reject','update','then','error','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','nolimit','offset','order','sort','pick','add','day','merge','where','filter','map','options','Plugin','includeAll','findAll','rows','show','params','include','find','download','join','root','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','dirname','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','basename','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','catch','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','type','html','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','body','delete','destroy','webhookGet','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','set','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','rimraf','archiver','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','./plugin.socket'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x8913,0x1ce));var _0x3891=function(_0x2f1c86,_0x2e2b18){_0x2f1c86=_0x2f1c86-0x0;var _0x2de688=_0x8913[_0x2f1c86];return _0x2de688;};'use strict';var jsonpatch=require(_0x3891('0x0'));var rp=require('request-promise');var moment=require(_0x3891('0x1'));var BPromise=require(_0x3891('0x2'));var Mustache=require('mustache');var util=require(_0x3891('0x3'));var path=require(_0x3891('0x4'));var sox=require(_0x3891('0x5'));var csv=require(_0x3891('0x6'));var ejs=require(_0x3891('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3891('0x8'));var jsforce=require(_0x3891('0x9'));var deskjs=require(_0x3891('0xa'));var toCsv=require('to-csv');var querystring=require(_0x3891('0xb'));var Papa=require(_0x3891('0xc'));var extract=require('extract-zip');var rimraf=require(_0x3891('0xd'));var archiver=require(_0x3891('0xe'));var qs=require(_0x3891('0xf'));var logger=require('../../config/logger')(_0x3891('0x10'));var utils=require(_0x3891('0x11'));var config=require(_0x3891('0x12'));var db=require(_0x3891('0x13'))['db'];var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0x3891('0x14'))[_0x3891('0x15')](socket);function respondWithStatusCode(_0x3aff2a,_0x451e50){_0x451e50=_0x451e50||0xcc;return function(_0x4da187){if(_0x4da187){return _0x3aff2a[_0x3891('0x16')](_0x451e50);}return _0x3aff2a[_0x3891('0x17')](_0x451e50)[_0x3891('0x18')]();};}function respondWithResult(_0x213fcb,_0x48d3ab){_0x48d3ab=_0x48d3ab||0xc8;return function(_0x1b7e5d){if(_0x1b7e5d){return _0x213fcb[_0x3891('0x17')](_0x48d3ab)[_0x3891('0x19')](_0x1b7e5d);}};}function respondWithFilteredResult(_0x34b491,_0x358cd9){return function(_0x37fb0d){if(_0x37fb0d){var _0x4eaedc=_0x37fb0d[_0x3891('0x1a')],_0x1b54b4=_0x358cd9['offset'],_0x4b4a10=_0x358cd9['offset']+_0x358cd9[_0x3891('0x1b')],_0x305149;if(_0x4b4a10>=_0x4eaedc){_0x4b4a10=_0x4eaedc;_0x305149=0xc8;}else{_0x305149=0xce;}_0x34b491[_0x3891('0x17')](_0x305149);return _0x34b491['set'](_0x3891('0x1c'),_0x1b54b4+'-'+_0x4b4a10+'/'+_0x4eaedc)[_0x3891('0x19')](_0x37fb0d);}return null;};}function patchUpdates(_0x167e77){return function(_0x5a4386){try{jsonpatch[_0x3891('0x1d')](_0x5a4386,_0x167e77,!![]);}catch(_0x3d9131){return BPromise[_0x3891('0x1e')](_0x3d9131);}return _0x5a4386['save']();};}function saveUpdates(_0x23fdbf,_0xa6e154){return function(_0xa2c380){if(_0xa2c380){return _0xa2c380[_0x3891('0x1f')](_0x23fdbf)['then'](function(_0x585a67){return _0x585a67;});}return null;};}function removeEntity(_0x43e6e3,_0x3de8e9){return function(_0x1f2c98){if(_0x1f2c98){return _0x1f2c98['destroy']()[_0x3891('0x20')](function(){_0x43e6e3[_0x3891('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35e667,_0x3ddefb){return function(_0x4f835a){if(!_0x4f835a){_0x35e667[_0x3891('0x16')](0x194);}return _0x4f835a;};}function handleError(_0x59f142,_0xdcc8b6){_0xdcc8b6=_0xdcc8b6||0x1f4;return function(_0x6c7513){logger[_0x3891('0x21')](_0x6c7513[_0x3891('0x22')]);if(_0x6c7513[_0x3891('0x23')]){delete _0x6c7513[_0x3891('0x23')];}_0x59f142[_0x3891('0x17')](_0xdcc8b6)[_0x3891('0x24')](_0x6c7513);};}exports[_0x3891('0x25')]=function(_0x38ef49,_0x5d48d9){var _0xc80cfd={},_0x3af1f1={},_0xfe5ab6={'count':0x0,'rows':[]};var _0x1e782f=db['Plugin'][_0x3891('0x26')];_0x3af1f1[_0x3891('0x27')]=_[_0x3891('0x28')](_0x1e782f);var _0x515447={'dateStart':_0x38ef49[_0x3891('0x29')][_0x3891('0x2a')],'dateEnd':_0x38ef49[_0x3891('0x29')]['dateEnd']};delete _0x38ef49[_0x3891('0x29')][_0x3891('0x2a')];delete _0x38ef49[_0x3891('0x29')][_0x3891('0x2b')];_0x3af1f1[_0x3891('0x29')]=_[_0x3891('0x28')](_0x38ef49[_0x3891('0x29')]);_0x3af1f1[_0x3891('0x2c')]=_['intersection'](_0x3af1f1['model'],_0x3af1f1[_0x3891('0x29')]);_0xc80cfd[_0x3891('0x2d')]=_[_0x3891('0x2e')](_0x3af1f1[_0x3891('0x27')],qs[_0x3891('0x2f')](_0x38ef49['query'][_0x3891('0x2f')]));_0xc80cfd[_0x3891('0x2d')]=_0xc80cfd[_0x3891('0x2d')][_0x3891('0x30')]?_0xc80cfd['attributes']:_0x3af1f1[_0x3891('0x27')];if(!_0x38ef49['query']['hasOwnProperty'](_0x3891('0x31'))){_0xc80cfd[_0x3891('0x1b')]=qs['limit'](_0x38ef49[_0x3891('0x29')]['limit']);_0xc80cfd[_0x3891('0x32')]=qs[_0x3891('0x32')](_0x38ef49[_0x3891('0x29')][_0x3891('0x32')]);}_0xc80cfd[_0x3891('0x33')]=qs[_0x3891('0x34')](_0x38ef49[_0x3891('0x29')]['sort']);_0xc80cfd['where']=qs['filters'](_[_0x3891('0x35')](_0x38ef49[_0x3891('0x29')],_0x3af1f1['filters']));if(_0x515447[_0x3891('0x2a')]){if(_0x515447['dateEnd']){_0x515447[_0x3891('0x2b')]=moment(_0x515447[_0x3891('0x2b')])[_0x3891('0x36')](0x1,_0x3891('0x37'));}else{_0x515447[_0x3891('0x2b')]=moment(_0x515447['dateStart'])['add'](0x1,_0x3891('0x37'));}_[_0x3891('0x38')](_0xc80cfd[_0x3891('0x39')],{'createdAt':{'$gte':_0x515447[_0x3891('0x2a')],'$lte':_0x515447['dateEnd']}});}if(_0x38ef49[_0x3891('0x29')][_0x3891('0x3a')]){_0xc80cfd['where']=_['merge'](_0xc80cfd[_0x3891('0x39')],{'$or':_[_0x3891('0x3b')](_0xc80cfd['attributes'],function(_0x554373){var _0x5e0b18={};_0x5e0b18[_0x554373]={'$like':'%'+_0x38ef49[_0x3891('0x29')][_0x3891('0x3a')]+'%'};return _0x5e0b18;})});}_0xc80cfd=_[_0x3891('0x38')]({},_0xc80cfd,_0x38ef49[_0x3891('0x3c')]);var _0x17beb7={'where':_0xc80cfd[_0x3891('0x39')]};return db[_0x3891('0x3d')]['count'](_0x17beb7)[_0x3891('0x20')](function(_0x4944cd){_0xfe5ab6[_0x3891('0x1a')]=_0x4944cd;if(_0x38ef49['query'][_0x3891('0x3e')]){_0xc80cfd['include']=[{'all':!![]}];}return db['Plugin'][_0x3891('0x3f')](_0xc80cfd);})[_0x3891('0x20')](function(_0x29430e){_0xfe5ab6[_0x3891('0x40')]=_0x29430e;return _0xfe5ab6;})['then'](respondWithFilteredResult(_0x5d48d9,_0xc80cfd))['catch'](handleError(_0x5d48d9,null));};exports[_0x3891('0x41')]=function(_0x26b69e,_0x514c3b){var _0xc40dce={'raw':!![],'where':{'id':_0x26b69e[_0x3891('0x42')]['id']}},_0x1093a5={};_0x1093a5[_0x3891('0x27')]=_[_0x3891('0x28')](db[_0x3891('0x3d')][_0x3891('0x26')]);_0x1093a5[_0x3891('0x29')]=_[_0x3891('0x28')](_0x26b69e[_0x3891('0x29')]);_0x1093a5[_0x3891('0x2c')]=_[_0x3891('0x2e')](_0x1093a5[_0x3891('0x27')],_0x1093a5['query']);_0xc40dce[_0x3891('0x2d')]=_[_0x3891('0x2e')](_0x1093a5[_0x3891('0x27')],qs['fields'](_0x26b69e[_0x3891('0x29')][_0x3891('0x2f')]));_0xc40dce[_0x3891('0x2d')]=_0xc40dce[_0x3891('0x2d')]['length']?_0xc40dce[_0x3891('0x2d')]:_0x1093a5[_0x3891('0x27')];if(_0x26b69e[_0x3891('0x29')][_0x3891('0x3e')]){_0xc40dce[_0x3891('0x43')]=[{'all':!![]}];}_0xc40dce=_[_0x3891('0x38')]({},_0xc40dce,_0x26b69e[_0x3891('0x3c')]);return db[_0x3891('0x3d')][_0x3891('0x44')](_0xc40dce)['then'](handleEntityNotFound(_0x514c3b,null))[_0x3891('0x20')](respondWithResult(_0x514c3b,null))['catch'](handleError(_0x514c3b,null));};exports[_0x3891('0x45')]=function(_0x314bd1,_0x4abf00,_0x305615){return db[_0x3891('0x3d')][_0x3891('0x44')]({'where':{'id':_0x314bd1[_0x3891('0x42')]['id']},'attributes':[_0x3891('0x23'),'path'],'raw':!![]})[_0x3891('0x20')](handleEntityNotFound(_0x4abf00,null))[_0x3891('0x20')](function(_0x4a8d8e){if(_0x4a8d8e){var _0x6c570f=path[_0x3891('0x46')](config[_0x3891('0x47')],_0x3891('0x48'),util[_0x3891('0x49')](_0x3891('0x4a'),path['basename'](_0x4a8d8e[_0x3891('0x4')])));var _0x2c9369=fs[_0x3891('0x4b')](_0x6c570f);var _0xd6b60a=archiver(_0x3891('0x4c'),{'zlib':{'level':0x9}});_0xd6b60a['on'](_0x3891('0x4d'),function(_0x40820b){if(_0x40820b[_0x3891('0x4e')]===_0x3891('0x4f')){logger[_0x3891('0x21')](_0x40820b);}else{throw new db[(_0x3891('0x50'))][(_0x3891('0x51'))](_0x3891('0x52'));}});_0xd6b60a['on'](_0x3891('0x21'),function(_0x505f83){throw new db['Sequelize'][(_0x3891('0x51'))](_0x3891('0x52'));});_0xd6b60a[_0x3891('0x53')](_0x2c9369);_0xd6b60a[_0x3891('0x54')]('**/*',{'cwd':path['join'](config[_0x3891('0x47')],_0x3891('0x48'),path[_0x3891('0x55')](_0x4a8d8e[_0x3891('0x4')])),'ignore':[path['join'](path['basename'](_0x4a8d8e[_0x3891('0x4')]),_0x3891('0x56')),path[_0x3891('0x46')](path['basename'](_0x4a8d8e[_0x3891('0x4')]),_0x3891('0x57'))],'nodir':!![]})[_0x3891('0x58')]();_0x2c9369['on']('close',function(){if(!fs[_0x3891('0x59')](_0x6c570f)){throw new db['Sequelize'][(_0x3891('0x51'))](_0x3891('0x5a'));}return _0x4abf00['download'](_0x6c570f,util[_0x3891('0x49')](_0x3891('0x4a'),path[_0x3891('0x5b')](_0x4a8d8e[_0x3891('0x4')])),function(_0x524819){if(_0x524819){throw new db[(_0x3891('0x50'))][(_0x3891('0x51'))](_0x3891('0x5c'));}fs[_0x3891('0x5d')](_0x6c570f);logger[_0x3891('0x5e')]('Download\x20completed');logger['info'](_0x3891('0x5f'));});});}return null;})[_0x3891('0x60')](handleError(_0x4abf00,null));};exports[_0x3891('0x61')]=function(_0x322f39,_0x3446dd,_0xe50b8e){var _0x2ea15b=path[_0x3891('0x5b')](_0x322f39[_0x3891('0x62')]['filename'],path[_0x3891('0x63')](_0x322f39[_0x3891('0x62')][_0x3891('0x64')]));var _0x29964b=path[_0x3891('0x46')](config['root'],_0x3891('0x48'),_0x322f39['file'][_0x3891('0x64')]);var _0x39f039=path[_0x3891('0x46')](config[_0x3891('0x47')],_0x3891('0x48'),_0x2ea15b);logger[_0x3891('0x5e')](_0x3891('0x65'),_0x29964b);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x39f039);try{fs[_0x3891('0x66')](_0x29964b,parseInt(_0x3891('0x67'),0x8));extract(_0x29964b,{'dir':_0x39f039},function(_0x1dd680){if(_0x1dd680){logger[_0x3891('0x21')](_0x1dd680);handleError(_0x1dd680,!![]);};var _0x225aaa=fs['readdirSync'](_0x39f039);if(_0x225aaa[_0x3891('0x30')]>0x1){removeReferences(_0x29964b,_0x39f039);logger[_0x3891('0x21')](_0x3891('0x68'));return _0xe50b8e(new Error(_0x3891('0x68')));}var _0x41f83f=fs[_0x3891('0x69')](path[_0x3891('0x46')](_0x39f039,_0x225aaa[0x0]));if(_0x41f83f[_0x3891('0x6a')]()){removeReferences(_0x29964b,_0x39f039);logger[_0x3891('0x21')](_0x3891('0x68'));return _0xe50b8e(new Error(_0x3891('0x68')));}if(_0x41f83f[_0x3891('0x6b')]()){var _0x185e91=fs[_0x3891('0x6c')](path[_0x3891('0x46')](_0x39f039,_0x225aaa[0x0]));if(_0x185e91[_0x3891('0x30')]===0x0){removeReferences(_0x29964b,_0x39f039);logger['error'](_0x3891('0x68'));return _0xe50b8e(new Error(_0x3891('0x68')));}var _0x325151=_0x185e91[_0x3891('0x6d')](function(_0x37ce58){return _0x37ce58===_0x3891('0x6e');});if(!_0x325151){return _0xe50b8e(new Error(_0x3891('0x6f')));}var _0x923c7=fs[_0x3891('0x70')](path[_0x3891('0x46')](_0x39f039,_0x225aaa[0x0],_0x3891('0x6e')));var _0x38bd14=JSON[_0x3891('0x71')](_0x923c7);if('undefined'==typeof _0x38bd14[_0x3891('0x23')]){return _0xe50b8e(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x3891('0x72')==typeof _0x38bd14['type']){return _0xe50b8e(new Error(_0x3891('0x73')));}if(_0x3891('0x72')==typeof _0x38bd14[_0x3891('0x74')]){return _0xe50b8e(new Error(_0x3891('0x75')));}if(_0x3891('0x72')==typeof _0x38bd14[_0x3891('0x76')]){return _0xe50b8e(new Error(_0x3891('0x77')));}if(_0x38bd14[_0x3891('0x78')]===_0x3891('0x79')){if(_0x3891('0x72')==typeof _0x38bd14['parameters']['views']){return _0xe50b8e(new Error(_0x3891('0x7a')));}if(_0x3891('0x72')==typeof _0x38bd14[_0x3891('0x76')][_0x3891('0x7b')][_0x3891('0x7c')]&&_0x3891('0x72')==typeof _0x38bd14[_0x3891('0x76')][_0x3891('0x7b')][_0x3891('0x7d')]){return _0xe50b8e(new Error(_0x3891('0x7e')));}}else if(_0x38bd14[_0x3891('0x78')]===_0x3891('0x7f')){if(_0x3891('0x72')==typeof _0x38bd14[_0x3891('0x76')][_0x3891('0x80')]){return _0xe50b8e(new Error(_0x3891('0x81')));}if(_0x3891('0x72')==typeof _0x38bd14[_0x3891('0x76')]['scriptPath']){return _0xe50b8e(new Error(_0x3891('0x82')));}}else{return _0xe50b8e(new Error(_0x3891('0x83')));}var _0x1a3a86=_0x38bd14[_0x3891('0x23')];var _0x1b4945=_0x38bd14[_0x3891('0x84')];var _0x200294=_0x38bd14[_0x3891('0x78')];var _0xae4d79=_0x38bd14[_0x3891('0x85')]?_0x38bd14[_0x3891('0x85')]:_0x3891('0x86');var _0x51d652=_0x38bd14[_0x3891('0x87')]?_0x38bd14[_0x3891('0x87')]:_0x3891('0x88');var _0x1f3e15='';var _0x14de35='';var _0x56f0ed='';var _0x32e48f='';var _0x2e5b41=_0x38bd14[_0x3891('0x74')];if(_0x200294===_0x3891('0x79')){if(_0x3891('0x72')!=typeof _0x38bd14[_0x3891('0x76')][_0x3891('0x7b')][_0x3891('0x7c')]){var _0x2ffeb4=_0x38bd14[_0x3891('0x76')][_0x3891('0x7b')][_0x3891('0x7c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2ffeb4)){_0x1f3e15=path[_0x3891('0x46')](_0x3891('0x89'),_0x2ea15b,_0x225aaa[0x0],_0x2ffeb4);}else{_0x1f3e15=_0x2ffeb4;}}else{logger[_0x3891('0x5e')](_0x3891('0x8a'));}if('undefined'!=typeof _0x38bd14['parameters'][_0x3891('0x7b')][_0x3891('0x7d')]){var _0x4d24ed=_0x38bd14[_0x3891('0x76')][_0x3891('0x7b')][_0x3891('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x3891('0x8b')](_0x4d24ed)){_0x14de35=path[_0x3891('0x46')](_0x3891('0x89'),_0x2ea15b,_0x225aaa[0x0],_0x4d24ed);}else{_0x14de35=_0x4d24ed;}}else{logger[_0x3891('0x5e')](_0x3891('0x8c'));}}else if(_0x200294==='script'){_0x56f0ed=_0x38bd14[_0x3891('0x76')][_0x3891('0x80')];_0x32e48f=_0x38bd14['parameters'][_0x3891('0x8d')];if('undefined'!=typeof _0x38bd14['parameters'][_0x3891('0x7b')]){if(_0x3891('0x72')!=typeof _0x38bd14[_0x3891('0x76')][_0x3891('0x7b')]['admin']){var _0x2ffeb4=_0x38bd14['parameters'][_0x3891('0x7b')][_0x3891('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x3891('0x8b')](_0x2ffeb4)){_0x1f3e15=path[_0x3891('0x46')](_0x3891('0x89'),_0x2ea15b,_0x225aaa[0x0],_0x2ffeb4);}else{_0x1f3e15=_0x2ffeb4;}}if(_0x3891('0x72')!=typeof _0x38bd14[_0x3891('0x76')][_0x3891('0x7b')][_0x3891('0x7d')]){var _0x4d24ed=_0x38bd14[_0x3891('0x76')][_0x3891('0x7b')][_0x3891('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x3891('0x8b')](_0x4d24ed)){_0x14de35=path[_0x3891('0x46')](_0x3891('0x89'),_0x2ea15b,_0x225aaa[0x0],_0x4d24ed);}else{_0x14de35=_0x4d24ed;}}}}var _0x262297={'name':_0x1a3a86,'description':_0x1b4945,'path':path[_0x3891('0x46')](_0x2ea15b,_0x225aaa[0x0]),'type':_0x200294,'sidebar':_0xae4d79,'icon':_0x51d652,'adminUrl':_0x1f3e15,'agentUrl':_0x14de35,'scriptName':_0x56f0ed,'scriptPath':_0x32e48f,'version':_0x2e5b41};removeReferences(_0x29964b,null);return db['Plugin'][_0x3891('0x8e')](_0x262297)['then'](respondWithResult(_0x3446dd,null))[_0x3891('0x60')](handleError(_0x3446dd,null));}});}catch(_0x226467){_0x3446dd[_0x3891('0x17')](0x1f4)[_0x3891('0x24')](_0x226467);}};function removeReferences(_0x1720c7,_0x4be733){try{if(_0x1720c7){fs[_0x3891('0x5d')](_0x1720c7);logger[_0x3891('0x5e')](_0x3891('0x8f'));}if(_0x4be733){rimraf(_0x4be733,function(){});logger[_0x3891('0x5e')](_0x3891('0x90'));}}catch(_0x5cd334){logger[_0x3891('0x21')](_0x5cd334);}}exports['update']=function(_0x9599bf,_0x41433e,_0x215352){return db['Plugin'][_0x3891('0x44')]({'where':{'id':_0x9599bf[_0x3891('0x42')]['id']}})[_0x3891('0x20')](handleEntityNotFound(_0x41433e,null))[_0x3891('0x20')](saveUpdates(_0x9599bf[_0x3891('0x91')],null))[_0x3891('0x20')](respondWithResult(_0x41433e,null))[_0x3891('0x60')](handleError(_0x41433e,null));};exports[_0x3891('0x92')]=function(_0x58e7ca,_0x3cce3e,_0x14673b){return db[_0x3891('0x3d')][_0x3891('0x44')]({'where':{'id':_0x58e7ca[_0x3891('0x42')]['id']}})[_0x3891('0x20')](function(_0x3030b0){if(_0x3030b0){return _0x3030b0[_0x3891('0x93')]();}})[_0x3891('0x20')](function(_0x1771d4){rimraf(path[_0x3891('0x46')](config['root'],'server/files/plugins',path[_0x3891('0x55')](_0x1771d4['path'])),function(){});return _0x1771d4;})[_0x3891('0x20')](handleEntityNotFound(_0x3cce3e,null))[_0x3891('0x20')](respondWithStatusCode(_0x3cce3e,null))[_0x3891('0x60')](handleError(_0x3cce3e,null));};exports[_0x3891('0x94')]=function(_0x290cf2,_0x139c73,_0x2ed6e2){return BPromise['resolve']()[_0x3891('0x20')](function(){if(!_0x290cf2[_0x3891('0x29')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x290cf2['query'][_0x3891('0x95')]){throw new Error(_0x3891('0x96'));}var _0x15a2f2=_0x290cf2[_0x3891('0x29')][_0x3891('0x97')]?_0x290cf2[_0x3891('0x29')][_0x3891('0x97')]+':'+_0x290cf2[_0x3891('0x29')][_0x3891('0x95')]:_0x3891('0x98')+_0x290cf2['query'][_0x3891('0x95')];var _0x4a2d0c=_0x290cf2[_0x3891('0x29')]['json']?_0x290cf2[_0x3891('0x29')][_0x3891('0x19')]:!![];var _0x19642f=_0x290cf2[_0x3891('0x29')][_0x3891('0x99')]?_0x290cf2[_0x3891('0x29')][_0x3891('0x99')]:null;var _0x1ddddf={'method':_0x290cf2[_0x3891('0x9a')],'uri':util[_0x3891('0x49')](_0x3891('0x9b'),_0x15a2f2,_0x290cf2[_0x3891('0x29')][_0x3891('0x4')]),'json':_0x4a2d0c,'resolveWithFullResponse':!![],'encoding':_0x19642f,'qs':_0x290cf2[_0x3891('0x29')]};if(_0x290cf2[_0x3891('0x29')][_0x3891('0x9c')]){_0x1ddddf['headers']=_0x290cf2['headers'];}return rp(_0x1ddddf);})['then'](function(_0x5d0748){if(_0x5d0748){_0x139c73[_0x3891('0x9d')](_0x5d0748['headers']);logger[_0x3891('0x5e')](_0x5d0748[_0x3891('0x91')]);if(_['endsWith'](_0x290cf2[_0x3891('0x29')][_0x3891('0x4')],_0x3891('0x45'))&&_0x5d0748[_0x3891('0x9e')]==0x1f4){return _0x139c73[_0x3891('0x16')](_0x5d0748['statusCode']);}else{return _0x139c73[_0x3891('0x17')](_0x5d0748[_0x3891('0x9e')])[_0x3891('0x24')](_0x5d0748[_0x3891('0x91')]);}}else{return _0x139c73[_0x3891('0x16')](0xc8);}})['catch'](handleError(_0x139c73,null));};exports[_0x3891('0x9f')]=function(_0x129623,_0x425a76,_0x3eaa4c){return BPromise['resolve']()['then'](function(){if(!_0x129623[_0x3891('0x29')]['path']){throw new Error(_0x3891('0xa0'));}if(!_0x129623['query'][_0x3891('0x95')]){throw new Error(_0x3891('0x96'));}var _0xd3902e=_0x129623[_0x3891('0x29')][_0x3891('0x97')]?_0x129623[_0x3891('0x29')][_0x3891('0x97')]+':'+_0x129623[_0x3891('0x29')][_0x3891('0x95')]:'http://localhost:'+_0x129623[_0x3891('0x29')][_0x3891('0x95')];var _0x5af6dd=_0x129623[_0x3891('0x29')][_0x3891('0x19')]?_0x129623[_0x3891('0x29')][_0x3891('0x19')]:!![];var _0x300e54=_0x129623[_0x3891('0x29')][_0x3891('0x99')]?_0x129623['query']['encoding']:null;var _0x51f4ca={'method':_0x129623[_0x3891('0x9a')],'uri':util[_0x3891('0x49')](_0x3891('0x9b'),_0xd3902e,_0x129623[_0x3891('0x29')][_0x3891('0x4')]),'json':_0x5af6dd,'resolveWithFullResponse':!![],'encoding':_0x300e54,'body':_0x129623[_0x3891('0x91')]};if(_0x129623['query'][_0x3891('0x9c')]){_0x51f4ca[_0x3891('0x9c')]=_0x129623[_0x3891('0x9c')];}return rp(_0x51f4ca);})['then'](function(_0x129dcc){if(_0x129dcc){_0x425a76[_0x3891('0x9d')](_0x129dcc['headers']);logger['info'](_0x129dcc[_0x3891('0x91')]);return _0x425a76['status'](_0x129dcc['statusCode'])[_0x3891('0x24')](_0x129dcc[_0x3891('0x91')]);}else{return _0x425a76[_0x3891('0x16')](0xc8);}})[_0x3891('0x60')](handleError(_0x425a76,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 642db0f..4cef8d3 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(_0x368831,_0x541da9){var _0x30d271=function(_0x205168){while(--_0x205168){_0x368831['push'](_0x368831['shift']());}};_0x30d271(++_0x541da9);}(_0x7a54,0x106));var _0x47a5=function(_0x168512,_0x2f8793){_0x168512=_0x168512-0x0;var _0x3f060f=_0x7a54[_0x168512];return _0x3f060f;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var Plugin=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){PluginEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);PluginEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=PluginEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','Plugin','setMaxListeners','save','remove','emit'];(function(_0x50d27,_0x335698){var _0x35aa3a=function(_0xb4ab54){while(--_0xb4ab54){_0x50d27['push'](_0x50d27['shift']());}};_0x35aa3a(++_0x335698);}(_0xb10b,0x12a));var _0xbb10=function(_0x18a529,_0x2bea53){_0x18a529=_0x18a529-0x0;var _0x216fb8=_0xb10b[_0x18a529];return _0x216fb8;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var Plugin=require('../../mysqldb')['db'][_0xbb10('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){PluginEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);PluginEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];Plugin[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 2cc3cc7..8d74980 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 _0x0cdf=['exports','define','Plugin','plugins','../../config/logger','moment','bluebird','request-promise','./plugin.attributes'];(function(_0x3c989f,_0x4a0d20){var _0x240960=function(_0x531460){while(--_0x531460){_0x3c989f['push'](_0x3c989f['shift']());}};_0x240960(++_0x4a0d20);}(_0x0cdf,0x67));var _0xf0cd=function(_0x2ff8ae,_0x459670){_0x2ff8ae=_0x2ff8ae-0x0;var _0x52d112=_0x0cdf[_0x2ff8ae];return _0x52d112;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf0cd('0x0'))('api');var moment=require(_0xf0cd('0x1'));var BPromise=require(_0xf0cd('0x2'));var rp=require(_0xf0cd('0x3'));var attributes=require(_0xf0cd('0x4'));module[_0xf0cd('0x5')]=function(_0x25ae14,_0x39c98e){return _0x25ae14[_0xf0cd('0x6')](_0xf0cd('0x7'),attributes,{'tableName':_0xf0cd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7cc7=['util','api','moment','bluebird','request-promise','exports','define','Plugin','plugins','lodash'];(function(_0x2b8481,_0x4522af){var _0x5a7ac7=function(_0xa16572){while(--_0xa16572){_0x2b8481['push'](_0x2b8481['shift']());}};_0x5a7ac7(++_0x4522af);}(_0x7cc7,0xef));var _0x77cc=function(_0x432ea8,_0x4809af){_0x432ea8=_0x432ea8-0x0;var _0x2335d3=_0x7cc7[_0x432ea8];return _0x2335d3;};'use strict';var _=require(_0x77cc('0x0'));var util=require(_0x77cc('0x1'));var logger=require('../../config/logger')(_0x77cc('0x2'));var moment=require(_0x77cc('0x3'));var BPromise=require(_0x77cc('0x4'));var rp=require(_0x77cc('0x5'));var attributes=require('./plugin.attributes');module[_0x77cc('0x6')]=function(_0x9cae45,_0x1f8a28){return _0x9cae45[_0x77cc('0x7')](_0x77cc('0x8'),attributes,{'tableName':_0x77cc('0x9'),'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 c811291..ff70cf3 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 _0x6f6d=['info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','CreatePlugin','create','options','raw','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','client','http','socket.io-emitter','localhost','./plugin.socket','register','request','then'];(function(_0x349123,_0x5410c3){var _0x3f6170=function(_0x129730){while(--_0x129730){_0x349123['push'](_0x349123['shift']());}};_0x3f6170(++_0x5410c3);}(_0x6f6d,0x141));var _0xd6f6=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x6f6d[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xd6f6('0x0'));var util=require(_0xd6f6('0x1'));var moment=require(_0xd6f6('0x2'));var BPromise=require(_0xd6f6('0x3'));var rs=require(_0xd6f6('0x4'));var fs=require('fs');var db=require(_0xd6f6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd6f6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd6f6('0x7')][_0xd6f6('0x8')]({'port':0x232a});var socket=require(_0xd6f6('0x9'))({'host':_0xd6f6('0xa'),'port':0x18eb});require(_0xd6f6('0xb'))[_0xd6f6('0xc')](socket);function respondWithRpcPromise(_0x5a2a00,_0x430c24,_0x54fc15){return new BPromise(function(_0x25b189,_0x4bf5af){return client[_0xd6f6('0xd')](_0x5a2a00,_0x54fc15)[_0xd6f6('0xe')](function(_0x6d8eb8){logger[_0xd6f6('0xf')](_0xd6f6('0x10'),_0x430c24,_0xd6f6('0x11'));logger[_0xd6f6('0x12')](_0xd6f6('0x13'),_0x430c24,_0xd6f6('0x11'),JSON['stringify'](_0x6d8eb8));if(_0x6d8eb8['error']){if(_0x6d8eb8[_0xd6f6('0x14')][_0xd6f6('0x15')]===0x1f4){logger[_0xd6f6('0x14')](_0xd6f6('0x10'),_0x430c24,_0x6d8eb8[_0xd6f6('0x14')][_0xd6f6('0x16')]);return _0x4bf5af(_0x6d8eb8['error']['message']);}logger[_0xd6f6('0x14')](_0xd6f6('0x10'),_0x430c24,_0x6d8eb8[_0xd6f6('0x14')][_0xd6f6('0x16')]);return _0x25b189(_0x6d8eb8[_0xd6f6('0x14')][_0xd6f6('0x16')]);}else{logger[_0xd6f6('0xf')](_0xd6f6('0x10'),_0x430c24,_0xd6f6('0x11'));_0x25b189(_0x6d8eb8['result']['message']);}})['catch'](function(_0x3ff757){logger[_0xd6f6('0x14')]('Plugin,\x20%s,\x20%s',_0x430c24,_0x3ff757);_0x4bf5af(_0x3ff757);});});}exports[_0xd6f6('0x17')]=function(_0x1a0fdd){var _0x259523=this;return new Promise(function(_0x359f3d,_0x270c48){return db['Plugin'][_0xd6f6('0x18')](_0x1a0fdd['body'],{'raw':_0x1a0fdd[_0xd6f6('0x19')]?_0x1a0fdd['options'][_0xd6f6('0x1a')]===undefined?!![]:![]:!![]})[_0xd6f6('0xe')](function(_0x1f17d0){logger['info'](_0xd6f6('0x17'),_0x1a0fdd);logger[_0xd6f6('0x12')](_0xd6f6('0x17'),_0x1a0fdd,JSON[_0xd6f6('0x1b')](_0x1f17d0));_0x359f3d(_0x1f17d0);})['catch'](function(_0x467102){logger[_0xd6f6('0x14')](_0xd6f6('0x17'),_0x467102[_0xd6f6('0x16')],_0x1a0fdd);_0x270c48(_0x259523[_0xd6f6('0x14')](0x1f4,_0x467102[_0xd6f6('0x16')]));});});}; \ No newline at end of file +var _0x5757=['register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreatePlugin','Plugin','create','body','options','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','./plugin.socket'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5757,0x6c));var _0x7575=function(_0x46399d,_0x35dd9a){_0x46399d=_0x46399d-0x0;var _0x19e63b=_0x5757[_0x46399d];return _0x19e63b;};'use strict';var _=require('lodash');var util=require(_0x7575('0x0'));var moment=require(_0x7575('0x1'));var BPromise=require(_0x7575('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x7575('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7575('0x4'))(_0x7575('0x5'));var config=require(_0x7575('0x6'));var jayson=require(_0x7575('0x7'));var client=jayson[_0x7575('0x8')][_0x7575('0x9')]({'port':0x232a});var socket=require(_0x7575('0xa'))({'host':'localhost','port':0x18eb});require(_0x7575('0xb'))[_0x7575('0xc')](socket);function respondWithRpcPromise(_0x354d21,_0x28608a,_0x35be5d){return new BPromise(function(_0x29ff2c,_0x1f17f7){return client[_0x7575('0xd')](_0x354d21,_0x35be5d)[_0x7575('0xe')](function(_0x199639){logger[_0x7575('0xf')](_0x7575('0x10'),_0x28608a,_0x7575('0x11'));logger[_0x7575('0x12')](_0x7575('0x13'),_0x28608a,'request\x20sent',JSON[_0x7575('0x14')](_0x199639));if(_0x199639[_0x7575('0x15')]){if(_0x199639[_0x7575('0x15')]['code']===0x1f4){logger[_0x7575('0x15')](_0x7575('0x10'),_0x28608a,_0x199639[_0x7575('0x15')]['message']);return _0x1f17f7(_0x199639['error']['message']);}logger[_0x7575('0x15')](_0x7575('0x10'),_0x28608a,_0x199639[_0x7575('0x15')][_0x7575('0x16')]);return _0x29ff2c(_0x199639[_0x7575('0x15')][_0x7575('0x16')]);}else{logger[_0x7575('0xf')](_0x7575('0x10'),_0x28608a,_0x7575('0x11'));_0x29ff2c(_0x199639[_0x7575('0x17')][_0x7575('0x16')]);}})[_0x7575('0x18')](function(_0x3f1957){logger['error'](_0x7575('0x10'),_0x28608a,_0x3f1957);_0x1f17f7(_0x3f1957);});});}exports[_0x7575('0x19')]=function(_0x595437){var _0x5601fd=this;return new Promise(function(_0x14a351,_0x49c2e8){return db[_0x7575('0x1a')][_0x7575('0x1b')](_0x595437[_0x7575('0x1c')],{'raw':_0x595437[_0x7575('0x1d')]?_0x595437[_0x7575('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x7575('0xe')](function(_0x2e4a47){logger[_0x7575('0xf')](_0x7575('0x19'),_0x595437);logger[_0x7575('0x12')]('CreatePlugin',_0x595437,JSON['stringify'](_0x2e4a47));_0x14a351(_0x2e4a47);})[_0x7575('0x18')](function(_0x6ea2a8){logger[_0x7575('0x15')](_0x7575('0x19'),_0x6ea2a8[_0x7575('0x16')],_0x595437);_0x49c2e8(_0x5601fd['error'](0x1f4,_0x6ea2a8[_0x7575('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 2ca4e23..5191102 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 _0x93ea=['length','plugin:','update','emit','removeListener','register'];(function(_0x2a275e,_0x5aa79b){var _0x2287fe=function(_0x2f2a70){while(--_0x2f2a70){_0x2a275e['push'](_0x2a275e['shift']());}};_0x2287fe(++_0x5aa79b);}(_0x93ea,0x1e2));var _0xa93e=function(_0x142ec2,_0x5bb03d){_0x142ec2=_0x142ec2-0x0;var _0x45ef4e=_0x93ea[_0x142ec2];return _0x45ef4e;};'use strict';var PluginEvents=require('./plugin.events');var events=['save','remove',_0xa93e('0x0')];function createListener(_0x25d6b0,_0x4911f1){return function(_0x4f3dd3){_0x4911f1[_0xa93e('0x1')](_0x25d6b0,_0x4f3dd3);};}function removeListener(_0x228dd4,_0x23ab98){return function(){PluginEvents[_0xa93e('0x2')](_0x228dd4,_0x23ab98);};}exports[_0xa93e('0x3')]=function(_0x18e590){for(var _0x33e25f=0x0,_0xf78a14=events[_0xa93e('0x4')];_0x33e25f<_0xf78a14;_0x33e25f++){var _0x5a11fc=events[_0x33e25f];var _0x24daa6=createListener(_0xa93e('0x5')+_0x5a11fc,_0x18e590);PluginEvents['on'](_0x5a11fc,_0x24daa6);}}; \ No newline at end of file +var _0x63e0=['emit','removeListener','length','plugin:','./plugin.events','save','remove','update'];(function(_0x1235e3,_0x1c56f7){var _0x248afe=function(_0x424069){while(--_0x424069){_0x1235e3['push'](_0x1235e3['shift']());}};_0x248afe(++_0x1c56f7);}(_0x63e0,0x144));var _0x063e=function(_0x2998db,_0x3424f1){_0x2998db=_0x2998db-0x0;var _0x115fea=_0x63e0[_0x2998db];return _0x115fea;};'use strict';var PluginEvents=require(_0x063e('0x0'));var events=[_0x063e('0x1'),_0x063e('0x2'),_0x063e('0x3')];function createListener(_0x1b03cc,_0x23726a){return function(_0x4de95f){_0x23726a[_0x063e('0x4')](_0x1b03cc,_0x4de95f);};}function removeListener(_0x1ddd5e,_0x2c3b17){return function(){PluginEvents[_0x063e('0x5')](_0x1ddd5e,_0x2c3b17);};}exports['register']=function(_0x3bdbbf){for(var _0xbe8003=0x0,_0x57b644=events[_0x063e('0x6')];_0xbe8003<_0x57b644;_0xbe8003++){var _0x55af5c=events[_0xbe8003];var _0x4e4a23=createListener(_0x063e('0x7')+_0x55af5c,_0x3bdbbf);PluginEvents['on'](_0x55af5c,_0x4e4a23);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 0e6eacd..c8ee1b1 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(_0x56e77f,_0x4bdd35){var _0xaa20f7=function(_0xe3cb63){while(--_0xe3cb63){_0x56e77f['push'](_0x56e77f['shift']());}};_0xaa20f7(++_0x4bdd35);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0x3470ae,_0x58ed12){var _0x1078ac=function(_0x22675d){while(--_0x22675d){_0x3470ae['push'](_0x3470ae['shift']());}};_0x1078ac(++_0x58ed12);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 29ae358..2a5ca13 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 _0x7711=['update','restart','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','child_process','exec','bluebird','sendStatus','status','error','stack','name','send','info','index','list','then','reject','express','motion2','length','catch','show','params','body','script','join','../../files/plugins','cwd','dirname','chdir','start','dump','Missing\x20name\x20and/or\x20path'];(function(_0x467ca6,_0x58d1a6){var _0x43bd50=function(_0x3f76a4){while(--_0x3f76a4){_0x467ca6['push'](_0x467ca6['shift']());}};_0x43bd50(++_0x58d1a6);}(_0x7711,0xf7));var _0x1771=function(_0x7c2d18,_0x1ebdd6){_0x7c2d18=_0x7c2d18-0x0;var _0x1d3053=_0x7711[_0x7c2d18];return _0x1d3053;};'use strict';var _=require(_0x1771('0x0'));var pm2=require(_0x1771('0x1'));var logger=require(_0x1771('0x2'))('api');var path=require('path');var exec=require(_0x1771('0x3'))[_0x1771('0x4')];var BPromise=require(_0x1771('0x5'));function handleEntityNotFound(_0x3a7b2c,_0x5de408){return function(_0x222275){if(!_0x222275){_0x3a7b2c[_0x1771('0x6')](0x194);;}return _0x222275;};}function respondWithResult(_0x509859,_0x5eef6f){_0x5eef6f=_0x5eef6f||0xc8;return function(_0x1178a5){if(_0x1178a5){return _0x509859[_0x1771('0x7')](_0x5eef6f)['json'](_0x1178a5);}return null;};}function handleError(_0x561123,_0x4f080e){_0x4f080e=_0x4f080e||0x1f4;return function(_0x39b33f){logger[_0x1771('0x8')](_0x39b33f[_0x1771('0x9')]);if(_0x39b33f[_0x1771('0xa')]){delete _0x39b33f[_0x1771('0xa')];}_0x561123[_0x1771('0x7')](_0x4f080e)[_0x1771('0xb')](_0x39b33f);};}function execChildProcess(){return new BPromise(function(_0x248fe6,_0x382e5f){exec('npm\x20install',function(_0x430c89,_0x2b9d61,_0x3a2d06){logger[_0x1771('0xc')](_0x2b9d61);logger['info'](_0x3a2d06);if(_0x430c89){logger[_0x1771('0x8')](_0x430c89);return _0x382e5f(_0x430c89);}return _0x248fe6(_0x2b9d61);});});}exports[_0x1771('0xd')]=function(_0x2cbbc4,_0x178ef9){return pm2[_0x1771('0xe')]()[_0x1771('0xf')](function(_0x4a3937){if(_0x4a3937){var _0x41c504=_[_0x1771('0x10')](_0x4a3937,function(_0x1f6005){return _0x1f6005[_0x1771('0xa')]===_0x1771('0x11')||_0x1f6005[_0x1771('0xa')]===_0x1771('0x12');});return{'rows':_0x41c504,'count':_0x41c504[_0x1771('0x13')]};}return null;})[_0x1771('0xf')](respondWithResult(_0x178ef9,null))[_0x1771('0x14')](handleError(_0x178ef9,null));};exports[_0x1771('0x15')]=function(_0x5ad23,_0xf67b9d){return pm2['describe'](_0x5ad23[_0x1771('0x16')]['id'])[_0x1771('0xf')](respondWithResult(_0xf67b9d,null))[_0x1771('0xf')](handleEntityNotFound(_0xf67b9d,null))['catch'](handleError(_0xf67b9d,null));};exports['create']=function(_0x211b7a,_0xe9963a){if(_0x211b7a[_0x1771('0x17')]['name']&&_0x211b7a[_0x1771('0x17')][_0x1771('0x18')]){var _0x1162c1=path[_0x1771('0x19')](__dirname,_0x1771('0x1a'),_0x211b7a['body'][_0x1771('0x18')]);var _0x4f70cc=process[_0x1771('0x1b')]();process['chdir'](path[_0x1771('0x1c')](_0x1162c1));return execChildProcess()['then'](function(_0x3db27a){process[_0x1771('0x1d')](_0x4f70cc);return pm2[_0x1771('0x1e')]({'name':_0x211b7a[_0x1771('0x17')][_0x1771('0xa')],'script':_0x1162c1});})[_0x1771('0xf')](function(_0x4ed06f){pm2[_0x1771('0x1f')]();return _0x4ed06f[0x0];})['then'](respondWithResult(_0xe9963a,0xc9))['catch'](handleError(_0xe9963a,null));}else{return _0xe9963a[_0x1771('0x7')](0x1f4)[_0x1771('0xb')]({'message':_0x1771('0x20')});}};exports[_0x1771('0x21')]=function(_0x16ed6f,_0x506c96){if(_0x16ed6f[_0x1771('0x17')]['id']){delete _0x16ed6f[_0x1771('0x17')]['id'];}var _0x127f72={'online':_0x1771('0x22'),'stopped':'stop'};if(_0x127f72[_0x1771('0x23')](_0x16ed6f['body'][_0x1771('0x7')])){return pm2[_0x127f72[_0x16ed6f[_0x1771('0x17')]['status']]](_0x16ed6f['params']['id'])[_0x1771('0xf')](respondWithResult(_0x506c96,0xc8))['catch'](handleError(_0x506c96,null));}else{return _0x506c96[_0x1771('0x7')](0x1f4)[_0x1771('0xb')]({'message':_0x1771('0x24')});}};exports[_0x1771('0x25')]=function(_0x3978b1,_0x1e0c81){if(_0x3978b1[_0x1771('0x17')]['id']){delete _0x3978b1[_0x1771('0x17')]['id'];}if(_0x3978b1[_0x1771('0x16')]['id']){return pm2[_0x1771('0x26')](_0x3978b1['params']['id'])[_0x1771('0xf')](function(_0x500f32){pm2['dump']();return _0x500f32[0x0];})[_0x1771('0xf')](respondWithResult(_0x1e0c81,null))['catch'](handleError(_0x1e0c81,null));}else{return _0x1e0c81['status'](0x1f4)[_0x1771('0xb')]({'message':_0x1771('0x27')});}}; \ No newline at end of file +var _0x99d2=['lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','error','stack','name','send','npm\x20install','info','index','list','then','reject','express','motion2','catch','show','describe','create','body','join','../../files/plugins','script','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','restart','Unknown\x20status','destroy','delete','params','Unknown\x20id'];(function(_0x154e10,_0x2f9260){var _0x79b389=function(_0x4840e9){while(--_0x4840e9){_0x154e10['push'](_0x154e10['shift']());}};_0x79b389(++_0x2f9260);}(_0x99d2,0xcd));var _0x299d=function(_0x40c2f3,_0x416bf0){_0x40c2f3=_0x40c2f3-0x0;var _0x2fa075=_0x99d2[_0x40c2f3];return _0x2fa075;};'use strict';var _=require(_0x299d('0x0'));var pm2=require(_0x299d('0x1'));var logger=require(_0x299d('0x2'))(_0x299d('0x3'));var path=require(_0x299d('0x4'));var exec=require(_0x299d('0x5'))[_0x299d('0x6')];var BPromise=require(_0x299d('0x7'));function handleEntityNotFound(_0x39d0a2,_0x3b3471){return function(_0x319016){if(!_0x319016){_0x39d0a2[_0x299d('0x8')](0x194);;}return _0x319016;};}function respondWithResult(_0x163632,_0x48ad65){_0x48ad65=_0x48ad65||0xc8;return function(_0x5f56be){if(_0x5f56be){return _0x163632[_0x299d('0x9')](_0x48ad65)['json'](_0x5f56be);}return null;};}function handleError(_0x1b39d4,_0x29d6fa){_0x29d6fa=_0x29d6fa||0x1f4;return function(_0x1f9ada){logger[_0x299d('0xa')](_0x1f9ada[_0x299d('0xb')]);if(_0x1f9ada[_0x299d('0xc')]){delete _0x1f9ada[_0x299d('0xc')];}_0x1b39d4[_0x299d('0x9')](_0x29d6fa)[_0x299d('0xd')](_0x1f9ada);};}function execChildProcess(){return new BPromise(function(_0x5cf2e2,_0x1ac937){exec(_0x299d('0xe'),function(_0xf3c69e,_0x13a572,_0x3017d8){logger[_0x299d('0xf')](_0x13a572);logger[_0x299d('0xf')](_0x3017d8);if(_0xf3c69e){logger[_0x299d('0xa')](_0xf3c69e);return _0x1ac937(_0xf3c69e);}return _0x5cf2e2(_0x13a572);});});}exports[_0x299d('0x10')]=function(_0x41cd5a,_0xae146b){return pm2[_0x299d('0x11')]()[_0x299d('0x12')](function(_0x550c1e){if(_0x550c1e){var _0x564448=_[_0x299d('0x13')](_0x550c1e,function(_0x527897){return _0x527897[_0x299d('0xc')]===_0x299d('0x14')||_0x527897[_0x299d('0xc')]===_0x299d('0x15');});return{'rows':_0x564448,'count':_0x564448['length']};}return null;})[_0x299d('0x12')](respondWithResult(_0xae146b,null))[_0x299d('0x16')](handleError(_0xae146b,null));};exports[_0x299d('0x17')]=function(_0xeeb079,_0x27c6e8){return pm2[_0x299d('0x18')](_0xeeb079['params']['id'])[_0x299d('0x12')](respondWithResult(_0x27c6e8,null))[_0x299d('0x12')](handleEntityNotFound(_0x27c6e8,null))['catch'](handleError(_0x27c6e8,null));};exports[_0x299d('0x19')]=function(_0x1d8b8b,_0x1532ea){if(_0x1d8b8b[_0x299d('0x1a')][_0x299d('0xc')]&&_0x1d8b8b[_0x299d('0x1a')]['script']){var _0xa4912a=path[_0x299d('0x1b')](__dirname,_0x299d('0x1c'),_0x1d8b8b['body'][_0x299d('0x1d')]);var _0x3bf61c=process['cwd']();process[_0x299d('0x1e')](path[_0x299d('0x1f')](_0xa4912a));return execChildProcess()['then'](function(_0x501521){process[_0x299d('0x1e')](_0x3bf61c);return pm2[_0x299d('0x20')]({'name':_0x1d8b8b[_0x299d('0x1a')][_0x299d('0xc')],'script':_0xa4912a});})[_0x299d('0x12')](function(_0x1fe56b){pm2[_0x299d('0x21')]();return _0x1fe56b[0x0];})[_0x299d('0x12')](respondWithResult(_0x1532ea,0xc9))['catch'](handleError(_0x1532ea,null));}else{return _0x1532ea['status'](0x1f4)[_0x299d('0xd')]({'message':_0x299d('0x22')});}};exports['update']=function(_0xf6115d,_0x1583c9){if(_0xf6115d[_0x299d('0x1a')]['id']){delete _0xf6115d[_0x299d('0x1a')]['id'];}var _0x13c4f5={'online':_0x299d('0x23'),'stopped':'stop'};if(_0x13c4f5['hasOwnProperty'](_0xf6115d[_0x299d('0x1a')]['status'])){return pm2[_0x13c4f5[_0xf6115d[_0x299d('0x1a')][_0x299d('0x9')]]](_0xf6115d['params']['id'])[_0x299d('0x12')](respondWithResult(_0x1583c9,0xc8))[_0x299d('0x16')](handleError(_0x1583c9,null));}else{return _0x1583c9[_0x299d('0x9')](0x1f4)[_0x299d('0xd')]({'message':_0x299d('0x24')});}};exports[_0x299d('0x25')]=function(_0x30c4c5,_0x40c5f3){if(_0x30c4c5[_0x299d('0x1a')]['id']){delete _0x30c4c5[_0x299d('0x1a')]['id'];}if(_0x30c4c5['params']['id']){return pm2[_0x299d('0x26')](_0x30c4c5[_0x299d('0x27')]['id'])[_0x299d('0x12')](function(_0xfb4ca4){pm2[_0x299d('0x21')]();return _0xfb4ca4[0x0];})['then'](respondWithResult(_0x40c5f3,null))['catch'](handleError(_0x40c5f3,null));}else{return _0x40c5f3[_0x299d('0x9')](0x1f4)[_0x299d('0xd')]({'message':_0x299d('0x28')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index cde39d4..5e15b62 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 _0x67ba=['../../components/interaction/service','exports','util','express','Router'];(function(_0x29e0bf,_0x23412f){var _0x218ae8=function(_0xfb3163){while(--_0xfb3163){_0x29e0bf['push'](_0x29e0bf['shift']());}};_0x218ae8(++_0x23412f);}(_0x67ba,0x1d3));var _0xa67b=function(_0x580688,_0x3570b6){_0x580688=_0x580688-0x0;var _0x177d1f=_0x67ba[_0x580688];return _0x177d1f;};'use strict';var multer=require('multer');var util=require(_0xa67b('0x0'));var path=require('path');var express=require(_0xa67b('0x1'));var router=express[_0xa67b('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xa67b('0x3'));var config=require('../../config/environment');module[_0xa67b('0x4')]=router; \ No newline at end of file +var _0x3e7b=['util','path','express','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x2b3999,_0x56871e){var _0x1f4dfe=function(_0x3cdf45){while(--_0x3cdf45){_0x2b3999['push'](_0x2b3999['shift']());}};_0x1f4dfe(++_0x56871e);}(_0x3e7b,0x14f));var _0xb3e7=function(_0x214000,_0x1b7dd6){_0x214000=_0x214000-0x0;var _0x296b61=_0x3e7b[_0x214000];return _0x296b61;};'use strict';var multer=require(_0xb3e7('0x0'));var util=require(_0xb3e7('0x1'));var path=require(_0xb3e7('0x2'));var express=require(_0xb3e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xb3e7('0x4'));var config=require(_0xb3e7('0x5'));module[_0xb3e7('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 8d9d9df..35afbef 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 _0xd305=['exports','DATE','STRING','sequelize'];(function(_0x5ba50f,_0x24eff3){var _0x40a881=function(_0x1258af){while(--_0x1258af){_0x5ba50f['push'](_0x5ba50f['shift']());}};_0x40a881(++_0x24eff3);}(_0xd305,0x1ab));var _0x5d30=function(_0x443b1e,_0xf7ffe9){_0x443b1e=_0x443b1e-0x0;var _0x3beb6f=_0xd305[_0x443b1e];return _0x3beb6f;};'use strict';var Sequelize=require(_0x5d30('0x0'));module[_0x5d30('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x5d30('0x2')]},'uniqueid':{'type':Sequelize[_0x5d30('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x5d30('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x5d30('0x3')]},'campaigntype':{'type':Sequelize[_0x5d30('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x35e5=['sequelize','exports','STRING','DATE','INTEGER'];(function(_0x13acdd,_0x882d78){var _0x178f2c=function(_0x285b26){while(--_0x285b26){_0x13acdd['push'](_0x13acdd['shift']());}};_0x178f2c(++_0x882d78);}(_0x35e5,0x8c));var _0x535e=function(_0x1d0572,_0x10d904){_0x1d0572=_0x1d0572-0x0;var _0x5a8f4f=_0x35e5[_0x1d0572];return _0x5a8f4f;};'use strict';var Sequelize=require(_0x535e('0x0'));module[_0x535e('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x535e('0x2')]},'scheduledat':{'type':Sequelize[_0x535e('0x3')]},'uniqueid':{'type':Sequelize[_0x535e('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x535e('0x3')]},'ringtime':{'type':Sequelize[_0x535e('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x535e('0x2')]},'campaigntype':{'type':Sequelize[_0x535e('0x2')]},'membername':{'type':Sequelize[_0x535e('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 217ed60..fa84b9e 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 _0xbec4=['request-promise','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger'];(function(_0x20d54d,_0x1adc8e){var _0x516e8b=function(_0x2754e1){while(--_0x2754e1){_0x20d54d['push'](_0x20d54d['shift']());}};_0x516e8b(++_0x1adc8e);}(_0xbec4,0x153));var _0x4bec=function(_0x4bb84e,_0x589e36){_0x4bb84e=_0x4bb84e-0x0;var _0x13225c=_0xbec4[_0x4bb84e];return _0x13225c;};'use strict';var _=require(_0x4bec('0x0'));var util=require(_0x4bec('0x1'));var logger=require(_0x4bec('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4bec('0x3'));var attributes=require(_0x4bec('0x4'));module[_0x4bec('0x5')]=function(_0x419f71,_0x55b05b){return _0x419f71[_0x4bec('0x6')](_0x4bec('0x7'),attributes,{'tableName':_0x4bec('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x518f=['util','api','moment','bluebird','./reportAgentPreview.attributes','exports','report_agent_preview','lodash'];(function(_0x2853d2,_0x1ea552){var _0x28272d=function(_0x447bd6){while(--_0x447bd6){_0x2853d2['push'](_0x2853d2['shift']());}};_0x28272d(++_0x1ea552);}(_0x518f,0x77));var _0xf518=function(_0x4bb2b9,_0x459c78){_0x4bb2b9=_0x4bb2b9-0x0;var _0x40e2a2=_0x518f[_0x4bb2b9];return _0x40e2a2;};'use strict';var _=require(_0xf518('0x0'));var util=require(_0xf518('0x1'));var logger=require('../../config/logger')(_0xf518('0x2'));var moment=require(_0xf518('0x3'));var BPromise=require(_0xf518('0x4'));var rp=require('request-promise');var attributes=require(_0xf518('0x5'));module[_0xf518('0x6')]=function(_0x833efe,_0x4b941c){return _0x833efe['define']('ReportAgentPreview',attributes,{'tableName':_0xf518('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 2a0ecc9..7dc05d1 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 _0xaba6=['jayson/promise','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateReportAgentPreview','create','options','lodash','util','../../config/utils','../../config/logger','../../config/environment'];(function(_0x324034,_0x51e4ca){var _0x208777=function(_0x2a535d){while(--_0x2a535d){_0x324034['push'](_0x324034['shift']());}};_0x208777(++_0x51e4ca);}(_0xaba6,0xe2));var _0x6aba=function(_0x44e4a1,_0x3d053a){_0x44e4a1=_0x44e4a1-0x0;var _0x546ad3=_0xaba6[_0x44e4a1];return _0x546ad3;};'use strict';var _=require(_0x6aba('0x0'));var util=require(_0x6aba('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x6aba('0x2'));var logger=require(_0x6aba('0x3'))('rpc');var config=require(_0x6aba('0x4'));var jayson=require(_0x6aba('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ae14c,_0x39c32a,_0x54416a){return new BPromise(function(_0x3766d4,_0x1a4fbc){return client['request'](_0x5ae14c,_0x54416a)[_0x6aba('0x6')](function(_0x27c8ba){logger['info'](_0x6aba('0x7'),_0x39c32a,_0x6aba('0x8'));logger[_0x6aba('0x9')](_0x6aba('0xa'),_0x39c32a,_0x6aba('0x8'),JSON[_0x6aba('0xb')](_0x27c8ba));if(_0x27c8ba[_0x6aba('0xc')]){if(_0x27c8ba['error'][_0x6aba('0xd')]===0x1f4){logger[_0x6aba('0xc')](_0x6aba('0x7'),_0x39c32a,_0x27c8ba[_0x6aba('0xc')]['message']);return _0x1a4fbc(_0x27c8ba[_0x6aba('0xc')][_0x6aba('0xe')]);}logger['error'](_0x6aba('0x7'),_0x39c32a,_0x27c8ba[_0x6aba('0xc')][_0x6aba('0xe')]);return _0x3766d4(_0x27c8ba['error'][_0x6aba('0xe')]);}else{logger[_0x6aba('0xf')](_0x6aba('0x7'),_0x39c32a,'request\x20sent');_0x3766d4(_0x27c8ba[_0x6aba('0x10')][_0x6aba('0xe')]);}})[_0x6aba('0x11')](function(_0x21921d){logger[_0x6aba('0xc')](_0x6aba('0x7'),_0x39c32a,_0x21921d);_0x1a4fbc(_0x21921d);});});}exports[_0x6aba('0x12')]=function(_0x564827){var _0x2291d7=this;return new Promise(function(_0x448f29,_0x1c2efe){return db['ReportAgentPreview'][_0x6aba('0x13')](_0x564827['body'],{'raw':_0x564827['options']?_0x564827[_0x6aba('0x14')]['raw']===undefined?!![]:![]:!![]})[_0x6aba('0x6')](function(_0x1881ae){logger[_0x6aba('0xf')](_0x6aba('0x12'),_0x564827);logger[_0x6aba('0x9')](_0x6aba('0x12'),_0x564827,JSON[_0x6aba('0xb')](_0x1881ae));_0x448f29(_0x1881ae);})['catch'](function(_0x2e5f65){logger[_0x6aba('0xc')](_0x6aba('0x12'),_0x2e5f65[_0x6aba('0xe')],_0x564827);_0x1c2efe(_0x2291d7[_0x6aba('0xc')](0x1f4,_0x2e5f65[_0x6aba('0xe')]));});});}; \ No newline at end of file +var _0x0faf=['error','message','info','result','catch','CreateReportAgentPreview','body','options','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3195ce,_0x577665){var _0xfb76f7=function(_0x5a5677){while(--_0x5a5677){_0x3195ce['push'](_0x3195ce['shift']());}};_0xfb76f7(++_0x577665);}(_0x0faf,0x132));var _0xf0fa=function(_0x552352,_0x51e3b0){_0x552352=_0x552352-0x0;var _0x1e0d71=_0x0faf[_0x552352];return _0x1e0d71;};'use strict';var _=require(_0xf0fa('0x0'));var util=require('util');var moment=require(_0xf0fa('0x1'));var BPromise=require(_0xf0fa('0x2'));var rs=require(_0xf0fa('0x3'));var fs=require('fs');var db=require(_0xf0fa('0x4'))['db'];var utils=require(_0xf0fa('0x5'));var logger=require(_0xf0fa('0x6'))(_0xf0fa('0x7'));var config=require(_0xf0fa('0x8'));var jayson=require(_0xf0fa('0x9'));var client=jayson['client'][_0xf0fa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44ffa0,_0x25b5c4,_0x3a703b){return new BPromise(function(_0x2db1d9,_0x587865){return client[_0xf0fa('0xb')](_0x44ffa0,_0x3a703b)[_0xf0fa('0xc')](function(_0x481a42){logger['info'](_0xf0fa('0xd'),_0x25b5c4,_0xf0fa('0xe'));logger[_0xf0fa('0xf')](_0xf0fa('0x10'),_0x25b5c4,_0xf0fa('0xe'),JSON[_0xf0fa('0x11')](_0x481a42));if(_0x481a42[_0xf0fa('0x12')]){if(_0x481a42[_0xf0fa('0x12')]['code']===0x1f4){logger[_0xf0fa('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x25b5c4,_0x481a42[_0xf0fa('0x12')]['message']);return _0x587865(_0x481a42[_0xf0fa('0x12')][_0xf0fa('0x13')]);}logger[_0xf0fa('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x25b5c4,_0x481a42['error'][_0xf0fa('0x13')]);return _0x2db1d9(_0x481a42['error'][_0xf0fa('0x13')]);}else{logger[_0xf0fa('0x14')](_0xf0fa('0xd'),_0x25b5c4,_0xf0fa('0xe'));_0x2db1d9(_0x481a42[_0xf0fa('0x15')][_0xf0fa('0x13')]);}})[_0xf0fa('0x16')](function(_0x3f3bb7){logger['error'](_0xf0fa('0xd'),_0x25b5c4,_0x3f3bb7);_0x587865(_0x3f3bb7);});});}exports[_0xf0fa('0x17')]=function(_0x30ce17){var _0x1d3c22=this;return new Promise(function(_0x2bdf82,_0x386e5f){return db['ReportAgentPreview']['create'](_0x30ce17[_0xf0fa('0x18')],{'raw':_0x30ce17[_0xf0fa('0x19')]?_0x30ce17[_0xf0fa('0x19')][_0xf0fa('0x1a')]===undefined?!![]:![]:!![]})[_0xf0fa('0xc')](function(_0x403e7d){logger[_0xf0fa('0x14')](_0xf0fa('0x17'),_0x30ce17);logger[_0xf0fa('0xf')](_0xf0fa('0x17'),_0x30ce17,JSON[_0xf0fa('0x11')](_0x403e7d));_0x2bdf82(_0x403e7d);})['catch'](function(_0x10c93e){logger[_0xf0fa('0x12')](_0xf0fa('0x17'),_0x10c93e[_0xf0fa('0x13')],_0x30ce17);_0x386e5f(_0x1d3c22[_0xf0fa('0x12')](0x1f4,_0x10c93e[_0xf0fa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index d3b44ca..abd13aa 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 _0xfaee=['/sms/queues/:id','showSmsQueues','agentNotify','exports','multer','util','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','smsQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelRedirect','/outbound','outbound','outboundChannels','agents','/agents/:id/capacity','agentCapacity','/trunks','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','/sms/queues/waitinginteractions','/fax/queues/waitinginteractions','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','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms'];(function(_0x17be50,_0xd2e24d){var _0x204d0f=function(_0x231688){while(--_0x231688){_0x17be50['push'](_0x17be50['shift']());}};_0x204d0f(++_0xd2e24d);}(_0xfaee,0x15d));var _0xefae=function(_0x5b5947,_0x11623c){_0x5b5947=_0x5b5947-0x0;var _0x7623e0=_0xfaee[_0x5b5947];return _0x7623e0;};'use strict';var multer=require(_0xefae('0x0'));var util=require(_0xefae('0x1'));var path=require('path');var express=require(_0xefae('0x2'));var router=express[_0xefae('0x3')]();var auth=require(_0xefae('0x4'));var controller=require(_0xefae('0x5'));router[_0xefae('0x6')](_0xefae('0x7'),auth[_0xefae('0x8')](),controller[_0xefae('0x9')]);router[_0xefae('0x6')](_0xefae('0xa'),auth['isAuthenticated'](),controller[_0xefae('0xb')]);router[_0xefae('0x6')](_0xefae('0xc'),auth[_0xefae('0x8')](),controller[_0xefae('0xd')]);router['get'](_0xefae('0xe'),auth[_0xefae('0x8')](),controller[_0xefae('0xf')]);router[_0xefae('0x6')]('/chat/queues',auth['isAuthenticated'](),controller[_0xefae('0x10')]);router[_0xefae('0x6')](_0xefae('0x11'),auth[_0xefae('0x8')](),controller[_0xefae('0x12')]);router['get'](_0xefae('0x13'),auth[_0xefae('0x8')](),controller[_0xefae('0x14')]);router[_0xefae('0x6')]('/openchannel/queues',auth[_0xefae('0x8')](),controller[_0xefae('0x15')]);router[_0xefae('0x6')]('/sms/queues',auth[_0xefae('0x8')](),controller[_0xefae('0x16')]);router[_0xefae('0x6')](_0xefae('0x17'),auth[_0xefae('0x8')](),controller[_0xefae('0x18')]);router[_0xefae('0x6')]('/voice/queues/preview/:id',auth[_0xefae('0x8')](),controller[_0xefae('0x19')]);router['get'](_0xefae('0x1a'),auth[_0xefae('0x8')](),controller[_0xefae('0x1b')]);router['get'](_0xefae('0x1c'),auth[_0xefae('0x8')](),controller[_0xefae('0x1d')]);router[_0xefae('0x6')](_0xefae('0x1e'),auth[_0xefae('0x8')](),controller['voiceQueuesChannelHangup']);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xefae('0x8')](),controller[_0xefae('0x1f')]);router[_0xefae('0x6')]('/voice/queues/:id',auth[_0xefae('0x8')](),controller['showVoiceQueues']);router['get'](_0xefae('0x20'),auth[_0xefae('0x8')](),controller[_0xefae('0x21')]);router[_0xefae('0x6')]('/outbound/channels',auth[_0xefae('0x8')](),controller[_0xefae('0x22')]);router[_0xefae('0x6')]('/agents',auth[_0xefae('0x8')](),controller[_0xefae('0x23')]);router['put'](_0xefae('0x24'),auth[_0xefae('0x8')](),controller[_0xefae('0x25')]);router[_0xefae('0x6')]('/telephones',auth[_0xefae('0x8')](),controller['telephones']);router[_0xefae('0x6')](_0xefae('0x26'),auth[_0xefae('0x8')](),controller['trunks']);router[_0xefae('0x6')]('/campaigns',auth[_0xefae('0x8')](),controller[_0xefae('0x27')]);router[_0xefae('0x6')](_0xefae('0x28'),auth['isAuthenticated'](),controller[_0xefae('0x29')]);router[_0xefae('0x6')]('/chat/queues/waitinginteractions',auth[_0xefae('0x8')](),controller[_0xefae('0x2a')]);router['get'](_0xefae('0x2b'),auth[_0xefae('0x8')](),controller['mailQueuesWaitingInteractions']);router[_0xefae('0x6')](_0xefae('0x2c'),auth[_0xefae('0x8')](),controller['openchannelQueuesWaitingInteractions']);router[_0xefae('0x6')](_0xefae('0x2d'),auth[_0xefae('0x8')](),controller['smsQueuesWaitingInteractions']);router[_0xefae('0x6')](_0xefae('0x2e'),auth[_0xefae('0x8')](),controller['faxQueuesWaitingInteractions']);router[_0xefae('0x2f')](_0xefae('0x30'),auth[_0xefae('0x8')](),controller[_0xefae('0x31')](_0xefae('0x32')));router[_0xefae('0x6')](_0xefae('0x33'),auth[_0xefae('0x8')](),controller[_0xefae('0x34')]);router[_0xefae('0x2f')](_0xefae('0x35'),auth[_0xefae('0x8')](),controller[_0xefae('0x31')](_0xefae('0x36')));router[_0xefae('0x6')](_0xefae('0x37'),auth['isAuthenticated'](),controller[_0xefae('0x38')]);router[_0xefae('0x2f')](_0xefae('0x39'),auth[_0xefae('0x8')](),controller[_0xefae('0x31')](_0xefae('0x3a')));router[_0xefae('0x6')](_0xefae('0x3b'),auth[_0xefae('0x8')](),controller['showFaxQueues']);router[_0xefae('0x2f')](_0xefae('0x3c'),auth[_0xefae('0x8')](),controller['queueNotify'](_0xefae('0x3d')));router['get'](_0xefae('0x3e'),auth[_0xefae('0x8')](),controller[_0xefae('0x3f')]);router[_0xefae('0x2f')]('/sms/queues/:id/notify',auth[_0xefae('0x8')](),controller[_0xefae('0x31')](_0xefae('0x40')));router['get'](_0xefae('0x41'),auth[_0xefae('0x8')](),controller[_0xefae('0x42')]);router[_0xefae('0x2f')]('/agents/:id/notify',auth['isAuthenticated'](),controller[_0xefae('0x43')]);module[_0xefae('0x44')]=router; \ No newline at end of file +var _0xaa71=['openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/sms/queues/:id','/agents/:id/notify','agentNotify','exports','util','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','/outbound','/outbound/channels','outboundChannels','/agents','agents','put','agentCapacity','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','queueNotify','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify'];(function(_0x39f929,_0x424083){var _0x219672=function(_0x379aa2){while(--_0x379aa2){_0x39f929['push'](_0x39f929['shift']());}};_0x219672(++_0x424083);}(_0xaa71,0x17f));var _0x1aa7=function(_0x3b4146,_0x50f8fa){_0x3b4146=_0x3b4146-0x0;var _0x2d08f2=_0xaa71[_0x3b4146];return _0x2d08f2;};'use strict';var multer=require('multer');var util=require(_0x1aa7('0x0'));var path=require('path');var express=require(_0x1aa7('0x1'));var router=express[_0x1aa7('0x2')]();var auth=require(_0x1aa7('0x3'));var controller=require(_0x1aa7('0x4'));router[_0x1aa7('0x5')](_0x1aa7('0x6'),auth[_0x1aa7('0x7')](),controller[_0x1aa7('0x8')]);router[_0x1aa7('0x5')](_0x1aa7('0x9'),auth['isAuthenticated'](),controller[_0x1aa7('0xa')]);router[_0x1aa7('0x5')](_0x1aa7('0xb'),auth[_0x1aa7('0x7')](),controller[_0x1aa7('0xc')]);router[_0x1aa7('0x5')]('/voice/queues',auth[_0x1aa7('0x7')](),controller[_0x1aa7('0xd')]);router[_0x1aa7('0x5')](_0x1aa7('0xe'),auth[_0x1aa7('0x7')](),controller['chatQueues']);router['get'](_0x1aa7('0xf'),auth[_0x1aa7('0x7')](),controller[_0x1aa7('0x10')]);router['get'](_0x1aa7('0x11'),auth[_0x1aa7('0x7')](),controller[_0x1aa7('0x12')]);router[_0x1aa7('0x5')](_0x1aa7('0x13'),auth[_0x1aa7('0x7')](),controller[_0x1aa7('0x14')]);router[_0x1aa7('0x5')](_0x1aa7('0x15'),auth['isAuthenticated'](),controller[_0x1aa7('0x16')]);router[_0x1aa7('0x5')](_0x1aa7('0x17'),auth[_0x1aa7('0x7')](),controller[_0x1aa7('0x18')]);router[_0x1aa7('0x5')](_0x1aa7('0x19'),auth[_0x1aa7('0x7')](),controller[_0x1aa7('0x1a')]);router[_0x1aa7('0x5')](_0x1aa7('0x1b'),auth['isAuthenticated'](),controller[_0x1aa7('0x1c')]);router[_0x1aa7('0x5')](_0x1aa7('0x1d'),auth[_0x1aa7('0x7')](),controller[_0x1aa7('0x1e')]);router[_0x1aa7('0x5')](_0x1aa7('0x1f'),auth[_0x1aa7('0x7')](),controller['voiceQueuesChannelHangup']);router[_0x1aa7('0x5')](_0x1aa7('0x20'),auth[_0x1aa7('0x7')](),controller['voiceQueuesChannelRedirect']);router[_0x1aa7('0x5')](_0x1aa7('0x21'),auth['isAuthenticated'](),controller[_0x1aa7('0x22')]);router[_0x1aa7('0x5')](_0x1aa7('0x23'),auth[_0x1aa7('0x7')](),controller['outbound']);router[_0x1aa7('0x5')](_0x1aa7('0x24'),auth[_0x1aa7('0x7')](),controller[_0x1aa7('0x25')]);router[_0x1aa7('0x5')](_0x1aa7('0x26'),auth['isAuthenticated'](),controller[_0x1aa7('0x27')]);router[_0x1aa7('0x28')]('/agents/:id/capacity',auth[_0x1aa7('0x7')](),controller[_0x1aa7('0x29')]);router[_0x1aa7('0x5')]('/telephones',auth[_0x1aa7('0x7')](),controller[_0x1aa7('0x2a')]);router[_0x1aa7('0x5')](_0x1aa7('0x2b'),auth[_0x1aa7('0x7')](),controller[_0x1aa7('0x2c')]);router[_0x1aa7('0x5')](_0x1aa7('0x2d'),auth[_0x1aa7('0x7')](),controller[_0x1aa7('0x2e')]);router[_0x1aa7('0x5')](_0x1aa7('0x2f'),auth[_0x1aa7('0x7')](),controller['faxAccounts']);router[_0x1aa7('0x5')]('/chat/queues/waitinginteractions',auth[_0x1aa7('0x7')](),controller[_0x1aa7('0x30')]);router[_0x1aa7('0x5')](_0x1aa7('0x31'),auth[_0x1aa7('0x7')](),controller[_0x1aa7('0x32')]);router['get'](_0x1aa7('0x33'),auth[_0x1aa7('0x7')](),controller['openchannelQueuesWaitingInteractions']);router[_0x1aa7('0x5')](_0x1aa7('0x34'),auth['isAuthenticated'](),controller[_0x1aa7('0x35')]);router[_0x1aa7('0x5')](_0x1aa7('0x36'),auth[_0x1aa7('0x7')](),controller[_0x1aa7('0x37')]);router['post']('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0x1aa7('0x38')]('mail'));router[_0x1aa7('0x5')](_0x1aa7('0x39'),auth[_0x1aa7('0x7')](),controller[_0x1aa7('0x3a')]);router[_0x1aa7('0x3b')](_0x1aa7('0x3c'),auth[_0x1aa7('0x7')](),controller[_0x1aa7('0x38')]('chat'));router[_0x1aa7('0x5')]('/chat/queues/:id',auth[_0x1aa7('0x7')](),controller[_0x1aa7('0x3d')]);router[_0x1aa7('0x3b')](_0x1aa7('0x3e'),auth[_0x1aa7('0x7')](),controller[_0x1aa7('0x38')](_0x1aa7('0x3f')));router[_0x1aa7('0x5')](_0x1aa7('0x40'),auth[_0x1aa7('0x7')](),controller[_0x1aa7('0x41')]);router['post'](_0x1aa7('0x42'),auth[_0x1aa7('0x7')](),controller['queueNotify'](_0x1aa7('0x43')));router[_0x1aa7('0x5')](_0x1aa7('0x44'),auth[_0x1aa7('0x7')](),controller[_0x1aa7('0x45')]);router[_0x1aa7('0x3b')](_0x1aa7('0x46'),auth[_0x1aa7('0x7')](),controller[_0x1aa7('0x38')]('sms'));router['get'](_0x1aa7('0x47'),auth['isAuthenticated'](),controller['showSmsQueues']);router['post'](_0x1aa7('0x48'),auth[_0x1aa7('0x7')](),controller[_0x1aa7('0x49')]);module[_0x1aa7('0x4a')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 6710091..12a4141 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 _0x0faf=['agent','bluebird','moment','../../mysqldb','api','jayson/promise','client','http','request','then','error','code','message','result','catch','json','sendStatus','stack','name','status','send','isNil','find','rows','voiceChannels','VoiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','query','voiceQueues','VoiceQueues','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','findAll','length','format','MemberReport','findOrCreate','INTERACTION','SIP/','YYYY-MM-DD\x20HH:mm:ss','capacity','Telephones','trunks','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','From','QueueId','TransferReport','create','Start','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','messageId','InteractionId'];(function(_0x3314aa,_0x40cdb5){var _0x34ed53=function(_0x59862c){while(--_0x59862c){_0x3314aa['push'](_0x3314aa['shift']());}};_0x34ed53(++_0x40cdb5);}(_0x0faf,0xdf));var _0xf0fa=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0x0faf[_0x2601b4];return _0x3e3661;};'use strict';var BPromise=require(_0xf0fa('0x0'));var moment=require(_0xf0fa('0x1'));var _=require('lodash');var db=require(_0xf0fa('0x2'))['db'];var logger=require('../../config/logger')(_0xf0fa('0x3'));var jayson=require(_0xf0fa('0x4'));var amiClient=jayson['client']['http']({'port':0x232a});var mailClient=jayson[_0xf0fa('0x5')][_0xf0fa('0x6')]({'port':0x232b});var routingClient=jayson[_0xf0fa('0x5')][_0xf0fa('0x6')]({'port':0x232c});function respondWithRpcPromise(_0xe7ec0,_0x110595,_0x3dc765){return new BPromise(function(_0x3f352f,_0x12c05b){var _0x4eef59=_0x3dc765?_0x3dc765:amiClient;return _0x4eef59[_0xf0fa('0x7')](_0xe7ec0,_0x110595)[_0xf0fa('0x8')](function(_0x96d1b5){if(_0x96d1b5[_0xf0fa('0x9')]){if(_0x96d1b5[_0xf0fa('0x9')][_0xf0fa('0xa')]===0x1f4){return _0x12c05b(_0x96d1b5[_0xf0fa('0x9')][_0xf0fa('0xb')]);}return _0x3f352f(_0x96d1b5[_0xf0fa('0x9')][_0xf0fa('0xb')]);}else{_0x3f352f(_0x96d1b5[_0xf0fa('0xc')]);}})[_0xf0fa('0xd')](function(_0x43f049){_0x12c05b(_0x43f049);});});}function respondWithResult(_0x4181c4,_0x5099b0){_0x5099b0=_0x5099b0||0xc8;return function(_0x3fa72d){if(_0x3fa72d){return _0x4181c4['status'](_0x5099b0)[_0xf0fa('0xe')](_0x3fa72d);}return _0x4181c4[_0xf0fa('0xf')](0x194);};}function handleError(_0x291f39,_0x5e1a6c){_0x5e1a6c=_0x5e1a6c||0x1f4;return function(_0x458437){logger[_0xf0fa('0x9')](_0x458437[_0xf0fa('0x10')]);if(_0x458437[_0xf0fa('0x11')]){delete _0x458437[_0xf0fa('0x11')];}_0x291f39[_0xf0fa('0x12')](_0x5e1a6c)[_0xf0fa('0x13')](_0x458437);};}function findById(_0x223ed9){return function(_0x5a9aae){if(!_[_0xf0fa('0x14')](_0x223ed9)&&!_[_0xf0fa('0x14')](_0x5a9aae)&&!_[_0xf0fa('0x14')](_0x5a9aae['rows'])){return _[_0xf0fa('0x15')](_0x5a9aae[_0xf0fa('0x16')],function(_0x58b4ae){return _0x58b4ae['id']==_0x223ed9;});}return null;};}exports[_0xf0fa('0x17')]=function(_0x58d37b,_0x427fb0){return respondWithRpcPromise(_0xf0fa('0x18'),_0x58d37b['query'])['then'](respondWithResult(_0x427fb0,null))['catch'](handleError(_0x427fb0,null));};exports[_0xf0fa('0x19')]=function(_0x407d8c,_0x3885a6){return respondWithRpcPromise(_0xf0fa('0x1a'),_[_0xf0fa('0x1b')](_0x407d8c['query'],_0x407d8c[_0xf0fa('0x1c')]))[_0xf0fa('0x8')](respondWithResult(_0x3885a6,null))[_0xf0fa('0xd')](handleError(_0x3885a6,null));};exports[_0xf0fa('0x1d')]=function(_0x61c5c2,_0x387dbe){return respondWithRpcPromise(_0xf0fa('0x1e'),_[_0xf0fa('0x1b')](_0x61c5c2[_0xf0fa('0x1f')],_0x61c5c2['params']))[_0xf0fa('0x8')](respondWithResult(_0x387dbe,null))[_0xf0fa('0xd')](handleError(_0x387dbe,null));};exports[_0xf0fa('0x20')]=function(_0x57eccd,_0x5c8833){return respondWithRpcPromise('VoiceQueues',_0x57eccd[_0xf0fa('0x1f')])[_0xf0fa('0x8')](respondWithResult(_0x5c8833,null))[_0xf0fa('0xd')](handleError(_0x5c8833,null));};exports['showVoiceQueues']=function(_0x209ffd,_0x2f109f){return respondWithRpcPromise(_0xf0fa('0x21'),_0x209ffd[_0xf0fa('0x1f')])[_0xf0fa('0x8')](findById(_0x209ffd['params']['id']))[_0xf0fa('0x8')](respondWithResult(_0x2f109f,null))[_0xf0fa('0xd')](handleError(_0x2f109f,null));};exports[_0xf0fa('0x22')]=function(_0x256561,_0x588820){return respondWithRpcPromise('VoiceQueuesPreview',_[_0xf0fa('0x1b')](_0x256561[_0xf0fa('0x1f')],_0x256561[_0xf0fa('0x1c')]))['then'](respondWithResult(_0x588820,null))['catch'](handleError(_0x588820,null));};exports[_0xf0fa('0x23')]=function(_0xf3242f,_0x262344){return respondWithRpcPromise(_0xf0fa('0x24'),_0xf3242f[_0xf0fa('0x1f')])[_0xf0fa('0x8')](respondWithResult(_0x262344,null))[_0xf0fa('0xd')](handleError(_0x262344,null));};exports[_0xf0fa('0x25')]=function(_0x3f5fd0,_0x4e91dc){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x3f5fd0[_0xf0fa('0x1f')],_0x3f5fd0[_0xf0fa('0x1c')]))[_0xf0fa('0x8')](respondWithResult(_0x4e91dc,null))[_0xf0fa('0xd')](handleError(_0x4e91dc,null));};exports[_0xf0fa('0x26')]=function(_0x502df9,_0x556110){return respondWithRpcPromise(_0xf0fa('0x27'),_[_0xf0fa('0x1b')](_0x502df9[_0xf0fa('0x1f')],_0x502df9[_0xf0fa('0x1c')]))['then'](respondWithResult(_0x556110,null))[_0xf0fa('0xd')](handleError(_0x556110,null));};exports[_0xf0fa('0x28')]=function(_0x5d4716,_0x1a8d1d){return respondWithRpcPromise(_0xf0fa('0x29'),_['merge'](_0x5d4716['query'],_0x5d4716[_0xf0fa('0x1c')]))[_0xf0fa('0x8')](respondWithResult(_0x1a8d1d,null))[_0xf0fa('0xd')](handleError(_0x1a8d1d,null));};exports['outbound']=function(_0x48cd14,_0x52616f){return respondWithRpcPromise(_0xf0fa('0x2a'),_0x48cd14[_0xf0fa('0x1f')])[_0xf0fa('0x8')](respondWithResult(_0x52616f,null))[_0xf0fa('0xd')](handleError(_0x52616f,null));};exports[_0xf0fa('0x2b')]=function(_0x598ca2,_0x5b4b85){return respondWithRpcPromise('OutboundChannels',_0x598ca2[_0xf0fa('0x1f')])[_0xf0fa('0x8')](respondWithResult(_0x5b4b85,null))[_0xf0fa('0xd')](handleError(_0x5b4b85,null));};exports[_0xf0fa('0x2c')]=function(_0x32cebd,_0xf8f944){var _0x457e6d;return respondWithRpcPromise('Agents',_0x32cebd[_0xf0fa('0x1f')])['then'](function(_0x3c333c){_0x457e6d=_0x3c333c;return respondWithRpcPromise(_0xf0fa('0x2d'),_0x32cebd[_0xf0fa('0x1f')],routingClient);})['then'](function(_0x1ec881){return _[_0xf0fa('0x1b')]({},_0x1ec881,_0x457e6d);})['then'](respondWithResult(_0xf8f944,null))[_0xf0fa('0xd')](handleError(_0xf8f944,null));};exports[_0xf0fa('0x2e')]=function(_0x449cf7,_0xb9fbba){if(_0x449cf7['body']&&_0x449cf7[_0xf0fa('0x2f')]['interaction']&&_0x449cf7[_0xf0fa('0x30')]&&_0x449cf7['user'][_0xf0fa('0x11')]){for(var _0x24c54d in _0x449cf7[_0xf0fa('0x2f')]['interaction']){if(_0x449cf7['body'][_0xf0fa('0x31')][_0xf0fa('0x32')](_0x24c54d)){db['MemberReport'][_0xf0fa('0x33')]({'where':{'channel':_0x24c54d,'membername':_0x449cf7['user'][_0xf0fa('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x449cf7['body']['interaction'][_0x24c54d]&&_0x449cf7[_0xf0fa('0x2f')][_0xf0fa('0x31')][_0x24c54d][_0xf0fa('0x34')]?{'$notIn':_0x449cf7[_0xf0fa('0x2f')][_0xf0fa('0x31')][_0x24c54d]}:{'$ne':null}}})[_0xf0fa('0x8')](function(_0x24fc49){var _0x5deb08=moment()[_0xf0fa('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x574576=0x0,_0x1cc716=_0x24fc49[_0xf0fa('0x34')];_0x574576<_0x1cc716;_0x574576+=0x1){_0x24fc49[_0x574576]['updateAttributes']({'exitAt':_0x5deb08});}});for(var _0x32b728=0x0;_0x32b728<_0x449cf7[_0xf0fa('0x2f')][_0xf0fa('0x31')][_0x24c54d][_0xf0fa('0x34')];_0x32b728+=0x1){db[_0xf0fa('0x36')][_0xf0fa('0x37')]({'where':{'channel':_0x24c54d,'membername':_0x449cf7[_0xf0fa('0x30')][_0xf0fa('0x11')],'type':_0xf0fa('0x38'),'uniqueid':_0x449cf7['body']['interaction'][_0x24c54d][_0x32b728],'exitAt':null},'defaults':{'channel':_0x24c54d,'membername':_0x449cf7['user']['name'],'interface':_0xf0fa('0x39')+_0x449cf7[_0xf0fa('0x30')][_0xf0fa('0x11')],'type':'INTERACTION','enterAt':moment()[_0xf0fa('0x35')](_0xf0fa('0x3a')),'role':'agent','internal':_0x449cf7[_0xf0fa('0x30')]['internal'],'uniqueid':_0x449cf7[_0xf0fa('0x2f')][_0xf0fa('0x31')][_0x24c54d][_0x32b728]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x449cf7['params']['id'],'capacity':_0x449cf7[_0xf0fa('0x2f')][_0xf0fa('0x3b')]},routingClient)[_0xf0fa('0x8')](respondWithResult(_0xb9fbba,null))[_0xf0fa('0xd')](handleError(_0xb9fbba,null));};exports['telephones']=function(_0x284d41,_0x5b4935){return respondWithRpcPromise(_0xf0fa('0x3c'),_0x284d41[_0xf0fa('0x1f')])[_0xf0fa('0x8')](respondWithResult(_0x5b4935,null))[_0xf0fa('0xd')](handleError(_0x5b4935,null));};exports[_0xf0fa('0x3d')]=function(_0x1ca984,_0x1ed2c8){return respondWithRpcPromise('Trunks',_0x1ca984[_0xf0fa('0x1f')])['then'](respondWithResult(_0x1ed2c8,null))[_0xf0fa('0xd')](handleError(_0x1ed2c8,null));};exports['campaigns']=function(_0x1c0712,_0x4dfad6){return respondWithRpcPromise(_0xf0fa('0x3e'),_0x1c0712[_0xf0fa('0x1f')])[_0xf0fa('0x8')](respondWithResult(_0x4dfad6,null))[_0xf0fa('0xd')](handleError(_0x4dfad6,null));};exports[_0xf0fa('0x3f')]=function(_0x176f21,_0x24bb20){return respondWithRpcPromise('ChatQueues',_0x176f21[_0xf0fa('0x1f')],routingClient)['then'](respondWithResult(_0x24bb20,null))['catch'](handleError(_0x24bb20,null));};exports['showChatQueues']=function(_0x59f4f1,_0xa189e6){return respondWithRpcPromise(_0xf0fa('0x40'),_0x59f4f1[_0xf0fa('0x1f')],routingClient)[_0xf0fa('0x8')](findById(_0x59f4f1['params']['id']))[_0xf0fa('0x8')](respondWithResult(_0xa189e6,null))['catch'](handleError(_0xa189e6,null));};exports[_0xf0fa('0x41')]=function(_0x5c72f0,_0x78fdb6){return respondWithRpcPromise(_0xf0fa('0x42'),_0x5c72f0[_0xf0fa('0x1f')],routingClient)['then'](respondWithResult(_0x78fdb6,null))[_0xf0fa('0xd')](handleError(_0x78fdb6,null));};exports[_0xf0fa('0x43')]=function(_0x10366c,_0x54ac7b){return respondWithRpcPromise(_0xf0fa('0x42'),_0x10366c[_0xf0fa('0x1f')],routingClient)['then'](findById(_0x10366c[_0xf0fa('0x1c')]['id']))[_0xf0fa('0x8')](respondWithResult(_0x54ac7b,null))[_0xf0fa('0xd')](handleError(_0x54ac7b,null));};exports[_0xf0fa('0x44')]=function(_0x4da702,_0x2431ad){return respondWithRpcPromise('MailAccounts',_0x4da702['query'],mailClient)[_0xf0fa('0x8')](respondWithResult(_0x2431ad,null))['catch'](handleError(_0x2431ad,null));};exports[_0xf0fa('0x45')]=function(_0x32b81b,_0x6f9662){return respondWithRpcPromise(_0xf0fa('0x46'),_0x32b81b['query'],routingClient)[_0xf0fa('0x8')](respondWithResult(_0x6f9662,null))[_0xf0fa('0xd')](handleError(_0x6f9662,null));};exports[_0xf0fa('0x47')]=function(_0x3ef9f0,_0x1199aa){return respondWithRpcPromise(_0xf0fa('0x46'),_0x3ef9f0[_0xf0fa('0x1f')],routingClient)['then'](findById(_0x3ef9f0[_0xf0fa('0x1c')]['id']))['then'](respondWithResult(_0x1199aa,null))[_0xf0fa('0xd')](handleError(_0x1199aa,null));};exports[_0xf0fa('0x48')]=function(_0x5cabc0,_0x81498){return respondWithRpcPromise('SmsQueues',_0x5cabc0[_0xf0fa('0x1f')],routingClient)[_0xf0fa('0x8')](respondWithResult(_0x81498,null))['catch'](handleError(_0x81498,null));};exports[_0xf0fa('0x49')]=function(_0x32a15e,_0x108716){return respondWithRpcPromise(_0xf0fa('0x4a'),_0x32a15e[_0xf0fa('0x1f')],routingClient)[_0xf0fa('0x8')](findById(_0x32a15e['params']['id']))[_0xf0fa('0x8')](respondWithResult(_0x108716,null))[_0xf0fa('0xd')](handleError(_0x108716,null));};exports[_0xf0fa('0x4b')]=function(_0x2bb6b6,_0x42b2de){return respondWithRpcPromise(_0xf0fa('0x4c'),_0x2bb6b6[_0xf0fa('0x1f')],routingClient)['then'](respondWithResult(_0x42b2de,null))[_0xf0fa('0xd')](handleError(_0x42b2de,null));};exports['showFaxQueues']=function(_0x153317,_0x5cc28d){return respondWithRpcPromise(_0xf0fa('0x4c'),_0x153317[_0xf0fa('0x1f')],routingClient)['then'](findById(_0x153317[_0xf0fa('0x1c')]['id']))[_0xf0fa('0x8')](respondWithResult(_0x5cc28d,null))[_0xf0fa('0xd')](handleError(_0x5cc28d,null));};exports[_0xf0fa('0x4d')]=function(_0x1d510f,_0x30a636){return respondWithRpcPromise(_0xf0fa('0x4e'),_0x1d510f[_0xf0fa('0x1f')])['then'](respondWithResult(_0x30a636,null))[_0xf0fa('0xd')](handleError(_0x30a636,null));};exports[_0xf0fa('0x4f')]=function(_0x3e4891,_0xb642f7){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x3e4891['query'],routingClient)[_0xf0fa('0x8')](respondWithResult(_0xb642f7,null))[_0xf0fa('0xd')](handleError(_0xb642f7,null));};exports[_0xf0fa('0x50')]=function(_0x24a5e9,_0x4fafaf){return respondWithRpcPromise(_0xf0fa('0x51'),_0x24a5e9[_0xf0fa('0x1f')],routingClient)[_0xf0fa('0x8')](respondWithResult(_0x4fafaf,null))[_0xf0fa('0xd')](handleError(_0x4fafaf,null));};exports[_0xf0fa('0x52')]=function(_0x54bc5d,_0x184201){return respondWithRpcPromise(_0xf0fa('0x53'),_0x54bc5d['query'],routingClient)['then'](respondWithResult(_0x184201,null))[_0xf0fa('0xd')](handleError(_0x184201,null));};exports['smsQueuesWaitingInteractions']=function(_0x234d8a,_0x356739){return respondWithRpcPromise(_0xf0fa('0x54'),_0x234d8a[_0xf0fa('0x1f')],routingClient)[_0xf0fa('0x8')](respondWithResult(_0x356739,null))[_0xf0fa('0xd')](handleError(_0x356739,null));};exports[_0xf0fa('0x55')]=function(_0x157a2f,_0x18f8bf){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x157a2f[_0xf0fa('0x1f')],routingClient)[_0xf0fa('0x8')](respondWithResult(_0x18f8bf,null))['catch'](handleError(_0x18f8bf,null));};exports['queueNotify']=function(_0x19b0fb){return function(_0x36064d,_0x161abd){var _0x4f096f,_0x2bd6b7;var _0x1c6b80=_[_0xf0fa('0x56')](_0x19b0fb);var _0x1dab6e=_0x19b0fb===_0xf0fa('0x57')?_0xf0fa('0x58'):_0xf0fa('0x59');return db[_0x1c6b80+_0xf0fa('0x5a')][_0xf0fa('0x5b')]({'raw':!![],'where':{'id':_0x36064d['params']['id']}})[_0xf0fa('0x8')](function(_0x1bb175){if(_[_0xf0fa('0x14')](_0x1bb175)){throw new Error(_0x1c6b80+_0xf0fa('0x5c'));}_0x4f096f=_0x1bb175;return db[_0x1c6b80+_0xf0fa('0x5d')][_0xf0fa('0x5b')]({'where':{'id':_0x36064d[_0xf0fa('0x2f')]['messageId']},'include':[{'model':db[_0x1c6b80+'Interaction'],'as':_0xf0fa('0x5e')},{'model':db[_0x1c6b80+_0x1dab6e],'as':_0xf0fa('0x59')}]});})[_0xf0fa('0x8')](function(_0x63af3f){if(_[_0xf0fa('0x14')](_0x63af3f)){throw new Error(_0x1c6b80+_0xf0fa('0x5f'));}_0x2bd6b7=_0x63af3f;return _0x63af3f[_0xf0fa('0x60')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x57e063={'uniqueid':_0x19b0fb+'.'+_0x2bd6b7['id']+'.'+_0x2bd6b7[_0xf0fa('0x5e')]['id'],'FromUserId':_0x36064d[_0xf0fa('0x30')]['id'],'type':_0xf0fa('0x61')};_0x57e063[_0x1c6b80+_0xf0fa('0x62')]=_0x2bd6b7['id'];_0x57e063[_0x1c6b80+'InteractionId']=_0x2bd6b7[_0xf0fa('0x5e')]['id'];_0x57e063[_0xf0fa('0x63')+_0x1c6b80+_0x1dab6e+'Id']=_0x2bd6b7[_0xf0fa('0x59')]['id'];_0x57e063['To'+_0x1c6b80+_0xf0fa('0x64')]=_0x4f096f['id'];return db[_0x1c6b80+_0xf0fa('0x65')][_0xf0fa('0x66')](_0x57e063);})[_0xf0fa('0x8')](function(){return respondWithRpcPromise(_0xf0fa('0x67'),{'channel':_0x19b0fb,'interaction':_0x2bd6b7[_0xf0fa('0x5e')],'message':_0x2bd6b7,'account':_0x2bd6b7['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xf0fa('0x61'),'appdata':_0x4f096f[_0xf0fa('0x11')]+','+(_0x2bd6b7[_0xf0fa('0x59')]['queueTransferTimeout']||0x12c),'interval':_0xf0fa('0x68')}]},routingClient);})[_0xf0fa('0x8')](respondWithResult(_0x161abd,null))[_0xf0fa('0xd')](handleError(_0x161abd,null));};};exports[_0xf0fa('0x69')]=function(_0x131cdf,_0x4d95ec){var _0x2e1e67,_0x544cac;if(_[_0xf0fa('0x14')](_0x131cdf['body'][_0xf0fa('0x6a')])){throw new Error(_0xf0fa('0x6b'));}var _0x584b4a=_0x131cdf[_0xf0fa('0x2f')]['channel'];var _0x300d69=_[_0xf0fa('0x56')](_0x584b4a);var _0x5d8283=_0x584b4a===_0xf0fa('0x57')?_0xf0fa('0x58'):'Account';return db['User'][_0xf0fa('0x5b')]({'raw':!![],'where':{'id':_0x131cdf[_0xf0fa('0x1c')]['id'],'role':'agent'}})['then'](function(_0x67ce13){if(_[_0xf0fa('0x14')](_0x67ce13)){throw new Error('Agent\x20not\x20found');}_0x2e1e67=_0x67ce13;return db[_0x300d69+_0xf0fa('0x5d')][_0xf0fa('0x5b')]({'where':{'id':_0x131cdf[_0xf0fa('0x2f')][_0xf0fa('0x6c')]},'include':[{'model':db[_0x300d69+_0xf0fa('0x5e')],'as':_0xf0fa('0x5e')},{'model':db[_0x300d69+_0x5d8283],'as':_0xf0fa('0x59')}]});})[_0xf0fa('0x8')](function(_0x3af630){if(_['isNil'](_0x3af630)){throw new Error(_0x300d69+_0xf0fa('0x5f'));}_0x544cac=_0x3af630;return _0x3af630[_0xf0fa('0x60')]({'read':0x0,'readAt':null,'UserId':null});})[_0xf0fa('0x8')](function(){var _0x15ad5a={'uniqueid':_0x584b4a+'.'+_0x544cac['id']+'.'+_0x544cac[_0xf0fa('0x5e')]['id'],'FromUserId':_0x131cdf[_0xf0fa('0x30')]['id'],'type':'queue','ToUserId':_0x2e1e67['id']};_0x15ad5a[_0x300d69+_0xf0fa('0x62')]=_0x544cac['id'];_0x15ad5a[_0x300d69+_0xf0fa('0x6d')]=_0x544cac['Interaction']['id'];_0x15ad5a[_0xf0fa('0x63')+_0x300d69+_0x5d8283+'Id']=_0x544cac[_0xf0fa('0x59')]['id'];return db[_0x300d69+_0xf0fa('0x65')][_0xf0fa('0x66')](_0x15ad5a);})['then'](function(){return respondWithRpcPromise(_0xf0fa('0x67'),{'channel':_0x584b4a,'interaction':_0x544cac[_0xf0fa('0x5e')],'message':_0x544cac,'account':_0x544cac[_0xf0fa('0x59')],'applications':[{'id':0x0,'priority':0x1,'app':_0xf0fa('0x6e'),'appdata':_0x2e1e67[_0xf0fa('0x11')]+','+(_0x544cac['Account']['agentTransferTimeout']||0x12c),'interval':_0xf0fa('0x68')}]},routingClient);})[_0xf0fa('0x8')](respondWithResult(_0x4d95ec,null))[_0xf0fa('0xd')](handleError(_0x4d95ec,null));}; \ No newline at end of file +var _0x6fdb=['Message','create','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','jayson/promise','client','http','request','then','error','message','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','catch','voiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','Agents','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','SIP/','agent','AgentCapacity','trunks','Trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','queueNotify','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','Start','queue','*,*,*,*','Channel\x20field\x20is\x20mandatory','channel','capitalize','chat','User','Agent\x20not\x20found'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x6fdb,0x14d));var _0xb6fd=function(_0x3e8c4d,_0x18d01a){_0x3e8c4d=_0x3e8c4d-0x0;var _0x205fb5=_0x6fdb[_0x3e8c4d];return _0x205fb5;};'use strict';var BPromise=require(_0xb6fd('0x0'));var moment=require(_0xb6fd('0x1'));var _=require(_0xb6fd('0x2'));var db=require(_0xb6fd('0x3'))['db'];var logger=require('../../config/logger')('api');var jayson=require(_0xb6fd('0x4'));var amiClient=jayson[_0xb6fd('0x5')][_0xb6fd('0x6')]({'port':0x232a});var mailClient=jayson['client'][_0xb6fd('0x6')]({'port':0x232b});var routingClient=jayson[_0xb6fd('0x5')]['http']({'port':0x232c});function respondWithRpcPromise(_0x1bfdfa,_0x1d2f10,_0x555da3){return new BPromise(function(_0x321e7c,_0x9305e4){var _0x5842bc=_0x555da3?_0x555da3:amiClient;return _0x5842bc[_0xb6fd('0x7')](_0x1bfdfa,_0x1d2f10)[_0xb6fd('0x8')](function(_0x4acd8c){if(_0x4acd8c[_0xb6fd('0x9')]){if(_0x4acd8c[_0xb6fd('0x9')]['code']===0x1f4){return _0x9305e4(_0x4acd8c[_0xb6fd('0x9')][_0xb6fd('0xa')]);}return _0x321e7c(_0x4acd8c[_0xb6fd('0x9')][_0xb6fd('0xa')]);}else{_0x321e7c(_0x4acd8c['result']);}})['catch'](function(_0x41fc3){_0x9305e4(_0x41fc3);});});}function respondWithResult(_0x318226,_0x19f369){_0x19f369=_0x19f369||0xc8;return function(_0x5f4be1){if(_0x5f4be1){return _0x318226[_0xb6fd('0xb')](_0x19f369)[_0xb6fd('0xc')](_0x5f4be1);}return _0x318226[_0xb6fd('0xd')](0x194);};}function handleError(_0x5675c9,_0x40f387){_0x40f387=_0x40f387||0x1f4;return function(_0x357f6e){logger[_0xb6fd('0x9')](_0x357f6e[_0xb6fd('0xe')]);if(_0x357f6e['name']){delete _0x357f6e[_0xb6fd('0xf')];}_0x5675c9[_0xb6fd('0xb')](_0x40f387)[_0xb6fd('0x10')](_0x357f6e);};}function findById(_0x3a2b0b){return function(_0x248a55){if(!_[_0xb6fd('0x11')](_0x3a2b0b)&&!_[_0xb6fd('0x11')](_0x248a55)&&!_['isNil'](_0x248a55[_0xb6fd('0x12')])){return _[_0xb6fd('0x13')](_0x248a55[_0xb6fd('0x12')],function(_0x5617f4){return _0x5617f4['id']==_0x3a2b0b;});}return null;};}exports[_0xb6fd('0x14')]=function(_0x6975ec,_0x4e8397){return respondWithRpcPromise('VoiceChannels',_0x6975ec[_0xb6fd('0x15')])[_0xb6fd('0x8')](respondWithResult(_0x4e8397,null))['catch'](handleError(_0x4e8397,null));};exports[_0xb6fd('0x16')]=function(_0x1c3d78,_0x43eff8){return respondWithRpcPromise(_0xb6fd('0x17'),_['merge'](_0x1c3d78['query'],_0x1c3d78[_0xb6fd('0x18')]))[_0xb6fd('0x8')](respondWithResult(_0x43eff8,null))['catch'](handleError(_0x43eff8,null));};exports['voiceChannelStopMixMonitor']=function(_0x15df57,_0xa88709){return respondWithRpcPromise(_0xb6fd('0x19'),_[_0xb6fd('0x1a')](_0x15df57['query'],_0x15df57[_0xb6fd('0x18')]))['then'](respondWithResult(_0xa88709,null))[_0xb6fd('0x1b')](handleError(_0xa88709,null));};exports[_0xb6fd('0x1c')]=function(_0x514b3b,_0x1faa7c){return respondWithRpcPromise('VoiceQueues',_0x514b3b[_0xb6fd('0x15')])[_0xb6fd('0x8')](respondWithResult(_0x1faa7c,null))[_0xb6fd('0x1b')](handleError(_0x1faa7c,null));};exports['showVoiceQueues']=function(_0x68fc01,_0x17d6ac){return respondWithRpcPromise('VoiceQueues',_0x68fc01[_0xb6fd('0x15')])[_0xb6fd('0x8')](findById(_0x68fc01['params']['id']))['then'](respondWithResult(_0x17d6ac,null))[_0xb6fd('0x1b')](handleError(_0x17d6ac,null));};exports[_0xb6fd('0x1d')]=function(_0x2210f1,_0x5dddfc){return respondWithRpcPromise(_0xb6fd('0x1e'),_[_0xb6fd('0x1a')](_0x2210f1[_0xb6fd('0x15')],_0x2210f1[_0xb6fd('0x18')]))[_0xb6fd('0x8')](respondWithResult(_0x5dddfc,null))['catch'](handleError(_0x5dddfc,null));};exports[_0xb6fd('0x1f')]=function(_0x5450ef,_0x583db8){return respondWithRpcPromise(_0xb6fd('0x20'),_0x5450ef[_0xb6fd('0x15')])['then'](respondWithResult(_0x583db8,null))['catch'](handleError(_0x583db8,null));};exports[_0xb6fd('0x21')]=function(_0x337590,_0x27bdbe){return respondWithRpcPromise(_0xb6fd('0x22'),_[_0xb6fd('0x1a')](_0x337590[_0xb6fd('0x15')],_0x337590[_0xb6fd('0x18')]))[_0xb6fd('0x8')](respondWithResult(_0x27bdbe,null))[_0xb6fd('0x1b')](handleError(_0x27bdbe,null));};exports[_0xb6fd('0x23')]=function(_0x3e1f18,_0x467975){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xb6fd('0x1a')](_0x3e1f18[_0xb6fd('0x15')],_0x3e1f18[_0xb6fd('0x18')]))[_0xb6fd('0x8')](respondWithResult(_0x467975,null))['catch'](handleError(_0x467975,null));};exports[_0xb6fd('0x24')]=function(_0x15c6d5,_0x29bc5c){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xb6fd('0x1a')](_0x15c6d5['query'],_0x15c6d5[_0xb6fd('0x18')]))[_0xb6fd('0x8')](respondWithResult(_0x29bc5c,null))[_0xb6fd('0x1b')](handleError(_0x29bc5c,null));};exports[_0xb6fd('0x25')]=function(_0x169d8b,_0x31e616){return respondWithRpcPromise('Outbound',_0x169d8b['query'])[_0xb6fd('0x8')](respondWithResult(_0x31e616,null))['catch'](handleError(_0x31e616,null));};exports[_0xb6fd('0x26')]=function(_0x69701d,_0x5c37a3){return respondWithRpcPromise(_0xb6fd('0x27'),_0x69701d[_0xb6fd('0x15')])['then'](respondWithResult(_0x5c37a3,null))['catch'](handleError(_0x5c37a3,null));};exports['agents']=function(_0x272ccf,_0x3a0a81){var _0x5b4cfe;return respondWithRpcPromise('Agents',_0x272ccf[_0xb6fd('0x15')])[_0xb6fd('0x8')](function(_0x18fcf4){_0x5b4cfe=_0x18fcf4;return respondWithRpcPromise(_0xb6fd('0x28'),_0x272ccf[_0xb6fd('0x15')],routingClient);})['then'](function(_0x1b1585){return _[_0xb6fd('0x1a')]({},_0x1b1585,_0x5b4cfe);})[_0xb6fd('0x8')](respondWithResult(_0x3a0a81,null))['catch'](handleError(_0x3a0a81,null));};exports['agentCapacity']=function(_0xbdf5ef,_0xf8600b){if(_0xbdf5ef[_0xb6fd('0x29')]&&_0xbdf5ef[_0xb6fd('0x29')][_0xb6fd('0x2a')]&&_0xbdf5ef[_0xb6fd('0x2b')]&&_0xbdf5ef[_0xb6fd('0x2b')][_0xb6fd('0xf')]){for(var _0x48a43f in _0xbdf5ef['body'][_0xb6fd('0x2a')]){if(_0xbdf5ef[_0xb6fd('0x29')]['interaction'][_0xb6fd('0x2c')](_0x48a43f)){db[_0xb6fd('0x2d')][_0xb6fd('0x2e')]({'where':{'channel':_0x48a43f,'membername':_0xbdf5ef[_0xb6fd('0x2b')]['name'],'type':_0xb6fd('0x2f'),'exitAt':null,'uniqueid':_0xbdf5ef['body'][_0xb6fd('0x2a')][_0x48a43f]&&_0xbdf5ef[_0xb6fd('0x29')][_0xb6fd('0x2a')][_0x48a43f][_0xb6fd('0x30')]?{'$notIn':_0xbdf5ef[_0xb6fd('0x29')][_0xb6fd('0x2a')][_0x48a43f]}:{'$ne':null}}})[_0xb6fd('0x8')](function(_0x3b4b34){var _0x5118fd=moment()[_0xb6fd('0x31')](_0xb6fd('0x32'));for(var _0x53c619=0x0,_0x21fab7=_0x3b4b34['length'];_0x53c619<_0x21fab7;_0x53c619+=0x1){_0x3b4b34[_0x53c619][_0xb6fd('0x33')]({'exitAt':_0x5118fd});}});for(var _0x2af7a5=0x0;_0x2af7a5<_0xbdf5ef['body']['interaction'][_0x48a43f]['length'];_0x2af7a5+=0x1){db[_0xb6fd('0x2d')][_0xb6fd('0x34')]({'where':{'channel':_0x48a43f,'membername':_0xbdf5ef[_0xb6fd('0x2b')][_0xb6fd('0xf')],'type':_0xb6fd('0x2f'),'uniqueid':_0xbdf5ef[_0xb6fd('0x29')][_0xb6fd('0x2a')][_0x48a43f][_0x2af7a5],'exitAt':null},'defaults':{'channel':_0x48a43f,'membername':_0xbdf5ef[_0xb6fd('0x2b')][_0xb6fd('0xf')],'interface':_0xb6fd('0x35')+_0xbdf5ef[_0xb6fd('0x2b')]['name'],'type':'INTERACTION','enterAt':moment()[_0xb6fd('0x31')](_0xb6fd('0x32')),'role':_0xb6fd('0x36'),'internal':_0xbdf5ef[_0xb6fd('0x2b')]['internal'],'uniqueid':_0xbdf5ef[_0xb6fd('0x29')][_0xb6fd('0x2a')][_0x48a43f][_0x2af7a5]}});}}}}return respondWithRpcPromise(_0xb6fd('0x37'),{'id':_0xbdf5ef['params']['id'],'capacity':_0xbdf5ef[_0xb6fd('0x29')]['capacity']},routingClient)[_0xb6fd('0x8')](respondWithResult(_0xf8600b,null))[_0xb6fd('0x1b')](handleError(_0xf8600b,null));};exports['telephones']=function(_0x4336b8,_0x4b7172){return respondWithRpcPromise('Telephones',_0x4336b8['query'])['then'](respondWithResult(_0x4b7172,null))[_0xb6fd('0x1b')](handleError(_0x4b7172,null));};exports[_0xb6fd('0x38')]=function(_0x47768a,_0x2405b5){return respondWithRpcPromise(_0xb6fd('0x39'),_0x47768a[_0xb6fd('0x15')])['then'](respondWithResult(_0x2405b5,null))[_0xb6fd('0x1b')](handleError(_0x2405b5,null));};exports['campaigns']=function(_0x107f9a,_0x1dc427){return respondWithRpcPromise(_0xb6fd('0x3a'),_0x107f9a['query'])[_0xb6fd('0x8')](respondWithResult(_0x1dc427,null))[_0xb6fd('0x1b')](handleError(_0x1dc427,null));};exports[_0xb6fd('0x3b')]=function(_0x3e8939,_0x4b6034){return respondWithRpcPromise(_0xb6fd('0x3c'),_0x3e8939['query'],routingClient)[_0xb6fd('0x8')](respondWithResult(_0x4b6034,null))[_0xb6fd('0x1b')](handleError(_0x4b6034,null));};exports[_0xb6fd('0x3d')]=function(_0x24497e,_0xea03eb){return respondWithRpcPromise('ChatQueues',_0x24497e['query'],routingClient)[_0xb6fd('0x8')](findById(_0x24497e[_0xb6fd('0x18')]['id']))[_0xb6fd('0x8')](respondWithResult(_0xea03eb,null))[_0xb6fd('0x1b')](handleError(_0xea03eb,null));};exports[_0xb6fd('0x3e')]=function(_0x47af22,_0x246bb2){return respondWithRpcPromise(_0xb6fd('0x3f'),_0x47af22[_0xb6fd('0x15')],routingClient)[_0xb6fd('0x8')](respondWithResult(_0x246bb2,null))[_0xb6fd('0x1b')](handleError(_0x246bb2,null));};exports[_0xb6fd('0x40')]=function(_0x563c0b,_0x424f95){return respondWithRpcPromise('MailQueues',_0x563c0b['query'],routingClient)[_0xb6fd('0x8')](findById(_0x563c0b[_0xb6fd('0x18')]['id']))[_0xb6fd('0x8')](respondWithResult(_0x424f95,null))[_0xb6fd('0x1b')](handleError(_0x424f95,null));};exports[_0xb6fd('0x41')]=function(_0xe8a46e,_0x9df5d0){return respondWithRpcPromise(_0xb6fd('0x42'),_0xe8a46e[_0xb6fd('0x15')],mailClient)[_0xb6fd('0x8')](respondWithResult(_0x9df5d0,null))['catch'](handleError(_0x9df5d0,null));};exports['openchannelQueues']=function(_0x34c15d,_0x42fa5c){return respondWithRpcPromise('OpenchannelQueues',_0x34c15d[_0xb6fd('0x15')],routingClient)['then'](respondWithResult(_0x42fa5c,null))[_0xb6fd('0x1b')](handleError(_0x42fa5c,null));};exports[_0xb6fd('0x43')]=function(_0x15d5a0,_0x3acb17){return respondWithRpcPromise('OpenchannelQueues',_0x15d5a0[_0xb6fd('0x15')],routingClient)[_0xb6fd('0x8')](findById(_0x15d5a0[_0xb6fd('0x18')]['id']))[_0xb6fd('0x8')](respondWithResult(_0x3acb17,null))[_0xb6fd('0x1b')](handleError(_0x3acb17,null));};exports[_0xb6fd('0x44')]=function(_0x37f500,_0x33d580){return respondWithRpcPromise(_0xb6fd('0x45'),_0x37f500[_0xb6fd('0x15')],routingClient)[_0xb6fd('0x8')](respondWithResult(_0x33d580,null))[_0xb6fd('0x1b')](handleError(_0x33d580,null));};exports[_0xb6fd('0x46')]=function(_0x87d75b,_0x1d171e){return respondWithRpcPromise(_0xb6fd('0x45'),_0x87d75b[_0xb6fd('0x15')],routingClient)['then'](findById(_0x87d75b[_0xb6fd('0x18')]['id']))[_0xb6fd('0x8')](respondWithResult(_0x1d171e,null))[_0xb6fd('0x1b')](handleError(_0x1d171e,null));};exports[_0xb6fd('0x47')]=function(_0x3ba564,_0x63e261){return respondWithRpcPromise(_0xb6fd('0x48'),_0x3ba564[_0xb6fd('0x15')],routingClient)[_0xb6fd('0x8')](respondWithResult(_0x63e261,null))[_0xb6fd('0x1b')](handleError(_0x63e261,null));};exports[_0xb6fd('0x49')]=function(_0x2b8fcc,_0x445306){return respondWithRpcPromise('FaxQueues',_0x2b8fcc[_0xb6fd('0x15')],routingClient)[_0xb6fd('0x8')](findById(_0x2b8fcc[_0xb6fd('0x18')]['id']))[_0xb6fd('0x8')](respondWithResult(_0x445306,null))['catch'](handleError(_0x445306,null));};exports[_0xb6fd('0x4a')]=function(_0x2893b7,_0x89e46a){return respondWithRpcPromise(_0xb6fd('0x4b'),_0x2893b7[_0xb6fd('0x15')])['then'](respondWithResult(_0x89e46a,null))[_0xb6fd('0x1b')](handleError(_0x89e46a,null));};exports[_0xb6fd('0x4c')]=function(_0x2cf2e5,_0x190ffc){return respondWithRpcPromise(_0xb6fd('0x4d'),_0x2cf2e5[_0xb6fd('0x15')],routingClient)['then'](respondWithResult(_0x190ffc,null))['catch'](handleError(_0x190ffc,null));};exports[_0xb6fd('0x4e')]=function(_0x3581da,_0xd068){return respondWithRpcPromise(_0xb6fd('0x4f'),_0x3581da[_0xb6fd('0x15')],routingClient)[_0xb6fd('0x8')](respondWithResult(_0xd068,null))[_0xb6fd('0x1b')](handleError(_0xd068,null));};exports[_0xb6fd('0x50')]=function(_0x5c7e35,_0x37823c){return respondWithRpcPromise(_0xb6fd('0x51'),_0x5c7e35[_0xb6fd('0x15')],routingClient)[_0xb6fd('0x8')](respondWithResult(_0x37823c,null))['catch'](handleError(_0x37823c,null));};exports[_0xb6fd('0x52')]=function(_0x2b7228,_0x4467c2){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2b7228[_0xb6fd('0x15')],routingClient)[_0xb6fd('0x8')](respondWithResult(_0x4467c2,null))[_0xb6fd('0x1b')](handleError(_0x4467c2,null));};exports['faxQueuesWaitingInteractions']=function(_0x10716c,_0x5f3e27){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x10716c[_0xb6fd('0x15')],routingClient)[_0xb6fd('0x8')](respondWithResult(_0x5f3e27,null))[_0xb6fd('0x1b')](handleError(_0x5f3e27,null));};exports[_0xb6fd('0x53')]=function(_0xf25650){return function(_0x3ff6ac,_0x26773c){var _0x1aed36,_0x3e207a;var _0x2eb06c=_['capitalize'](_0xf25650);var _0x491fc3=_0xf25650==='chat'?_0xb6fd('0x54'):_0xb6fd('0x55');return db[_0x2eb06c+_0xb6fd('0x56')][_0xb6fd('0x57')]({'raw':!![],'where':{'id':_0x3ff6ac[_0xb6fd('0x18')]['id']}})[_0xb6fd('0x8')](function(_0x5738a1){if(_[_0xb6fd('0x11')](_0x5738a1)){throw new Error(_0x2eb06c+_0xb6fd('0x58'));}_0x1aed36=_0x5738a1;return db[_0x2eb06c+'Message'][_0xb6fd('0x57')]({'where':{'id':_0x3ff6ac[_0xb6fd('0x29')][_0xb6fd('0x59')]},'include':[{'model':db[_0x2eb06c+_0xb6fd('0x5a')],'as':_0xb6fd('0x5a')},{'model':db[_0x2eb06c+_0x491fc3],'as':_0xb6fd('0x55')}]});})['then'](function(_0x13c47e){if(_[_0xb6fd('0x11')](_0x13c47e)){throw new Error(_0x2eb06c+_0xb6fd('0x5b'));}_0x3e207a=_0x13c47e;return _0x13c47e[_0xb6fd('0x5c')]({'read':0x0,'readAt':null,'UserId':null});})[_0xb6fd('0x8')](function(){var _0x24e992={'uniqueid':_0xf25650+'.'+_0x3e207a['id']+'.'+_0x3e207a[_0xb6fd('0x5a')]['id'],'FromUserId':_0x3ff6ac[_0xb6fd('0x2b')]['id'],'type':'queue'};_0x24e992[_0x2eb06c+_0xb6fd('0x5d')]=_0x3e207a['id'];_0x24e992[_0x2eb06c+_0xb6fd('0x5e')]=_0x3e207a[_0xb6fd('0x5a')]['id'];_0x24e992[_0xb6fd('0x5f')+_0x2eb06c+_0x491fc3+'Id']=_0x3e207a[_0xb6fd('0x55')]['id'];_0x24e992['To'+_0x2eb06c+_0xb6fd('0x60')]=_0x1aed36['id'];return db[_0x2eb06c+_0xb6fd('0x61')]['create'](_0x24e992);})[_0xb6fd('0x8')](function(){return respondWithRpcPromise(_0xb6fd('0x62'),{'channel':_0xf25650,'interaction':_0x3e207a[_0xb6fd('0x5a')],'message':_0x3e207a,'account':_0x3e207a[_0xb6fd('0x55')],'applications':[{'id':0x0,'priority':0x1,'app':_0xb6fd('0x63'),'appdata':_0x1aed36[_0xb6fd('0xf')]+','+(_0x3e207a[_0xb6fd('0x55')]['queueTransferTimeout']||0x12c),'interval':_0xb6fd('0x64')}]},routingClient);})[_0xb6fd('0x8')](respondWithResult(_0x26773c,null))[_0xb6fd('0x1b')](handleError(_0x26773c,null));};};exports['agentNotify']=function(_0x4e587d,_0x1d9c5f){var _0x142854,_0x4534fa;if(_[_0xb6fd('0x11')](_0x4e587d[_0xb6fd('0x29')]['channel'])){throw new Error(_0xb6fd('0x65'));}var _0x2a7474=_0x4e587d[_0xb6fd('0x29')][_0xb6fd('0x66')];var _0xc57642=_[_0xb6fd('0x67')](_0x2a7474);var _0x467c3f=_0x2a7474===_0xb6fd('0x68')?_0xb6fd('0x54'):'Account';return db[_0xb6fd('0x69')][_0xb6fd('0x57')]({'raw':!![],'where':{'id':_0x4e587d['params']['id'],'role':_0xb6fd('0x36')}})[_0xb6fd('0x8')](function(_0x141328){if(_[_0xb6fd('0x11')](_0x141328)){throw new Error(_0xb6fd('0x6a'));}_0x142854=_0x141328;return db[_0xc57642+_0xb6fd('0x6b')][_0xb6fd('0x57')]({'where':{'id':_0x4e587d[_0xb6fd('0x29')][_0xb6fd('0x59')]},'include':[{'model':db[_0xc57642+'Interaction'],'as':_0xb6fd('0x5a')},{'model':db[_0xc57642+_0x467c3f],'as':'Account'}]});})[_0xb6fd('0x8')](function(_0x48fc6b){if(_[_0xb6fd('0x11')](_0x48fc6b)){throw new Error(_0xc57642+_0xb6fd('0x5b'));}_0x4534fa=_0x48fc6b;return _0x48fc6b[_0xb6fd('0x5c')]({'read':0x0,'readAt':null,'UserId':null});})[_0xb6fd('0x8')](function(){var _0x41b68d={'uniqueid':_0x2a7474+'.'+_0x4534fa['id']+'.'+_0x4534fa[_0xb6fd('0x5a')]['id'],'FromUserId':_0x4e587d[_0xb6fd('0x2b')]['id'],'type':_0xb6fd('0x63'),'ToUserId':_0x142854['id']};_0x41b68d[_0xc57642+_0xb6fd('0x5d')]=_0x4534fa['id'];_0x41b68d[_0xc57642+_0xb6fd('0x5e')]=_0x4534fa[_0xb6fd('0x5a')]['id'];_0x41b68d[_0xb6fd('0x5f')+_0xc57642+_0x467c3f+'Id']=_0x4534fa['Account']['id'];return db[_0xc57642+_0xb6fd('0x61')][_0xb6fd('0x6c')](_0x41b68d);})[_0xb6fd('0x8')](function(){return respondWithRpcPromise(_0xb6fd('0x62'),{'channel':_0x2a7474,'interaction':_0x4534fa[_0xb6fd('0x5a')],'message':_0x4534fa,'account':_0x4534fa['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x142854[_0xb6fd('0xf')]+','+(_0x4534fa['Account'][_0xb6fd('0x6d')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xb6fd('0x8')](respondWithResult(_0x1d9c5f,null))[_0xb6fd('0x1b')](handleError(_0x1d9c5f,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index f70fc65..c555364 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 _0x1aa9=['put','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','./schedule.controller','get','index','/:id','isAuthenticated','post','create'];(function(_0x362ac5,_0x57cc65){var _0x204885=function(_0x317437){while(--_0x317437){_0x362ac5['push'](_0x362ac5['shift']());}};_0x204885(++_0x57cc65);}(_0x1aa9,0x1a3));var _0x91aa=function(_0x8f0275,_0x13edb0){_0x8f0275=_0x8f0275-0x0;var _0x24302b=_0x1aa9[_0x8f0275];return _0x24302b;};'use strict';var multer=require(_0x91aa('0x0'));var util=require(_0x91aa('0x1'));var path=require(_0x91aa('0x2'));var express=require(_0x91aa('0x3'));var router=express[_0x91aa('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x91aa('0x5'));var config=require('../../config/environment');var controller=require(_0x91aa('0x6'));router[_0x91aa('0x7')]('/',auth['isAuthenticated'](),controller[_0x91aa('0x8')]);router['get'](_0x91aa('0x9'),auth[_0x91aa('0xa')](),controller['show']);router[_0x91aa('0x7')]('/:id/run',auth[_0x91aa('0xa')](),controller['run']);router[_0x91aa('0xb')]('/',auth[_0x91aa('0xa')](),controller[_0x91aa('0xc')]);router[_0x91aa('0xd')](_0x91aa('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x91aa('0x9'),auth[_0x91aa('0xa')](),controller[_0x91aa('0xe')]);module[_0x91aa('0xf')]=router; \ No newline at end of file +var _0xb49b=['update','delete','destroy','exports','util','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x24b53b,_0x57c20d){var _0x3b5c00=function(_0xed1211){while(--_0xed1211){_0x24b53b['push'](_0x24b53b['shift']());}};_0x3b5c00(++_0x57c20d);}(_0xb49b,0x194));var _0xbb49=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb49b[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0xbb49('0x0'));var path=require('path');var express=require(_0xbb49('0x1'));var router=express[_0xbb49('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xbb49('0x3'));var config=require(_0xbb49('0x4'));var controller=require('./schedule.controller');router[_0xbb49('0x5')]('/',auth[_0xbb49('0x6')](),controller[_0xbb49('0x7')]);router[_0xbb49('0x5')](_0xbb49('0x8'),auth[_0xbb49('0x6')](),controller[_0xbb49('0x9')]);router[_0xbb49('0x5')]('/:id/run',auth['isAuthenticated'](),controller['run']);router[_0xbb49('0xa')]('/',auth[_0xbb49('0x6')](),controller[_0xbb49('0xb')]);router['put'](_0xbb49('0x8'),auth[_0xbb49('0x6')](),controller[_0xbb49('0xc')]);router[_0xbb49('0xd')](_0xbb49('0x8'),auth['isAuthenticated'](),controller[_0xbb49('0xe')]);module[_0xbb49('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 bc4aab9..4bfba44 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 _0x5a6f=['pdf','xlsx','csv','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','INTEGER','ENUM','years','weeks','hours','minutes'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5a6f,0x136));var _0xf5a6=function(_0xd5edf7,_0x43c249){_0xd5edf7=_0xd5edf7-0x0;var _0x5cb898=_0x5a6f[_0xd5edf7];return _0x5cb898;};'use strict';var Sequelize=require(_0xf5a6('0x0'));module[_0xf5a6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf5a6('0x2')]},'active':{'type':Sequelize[_0xf5a6('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xf5a6('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xf5a6('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xf5a6('0x5')](_0xf5a6('0x6'),'quarters','months',_0xf5a6('0x7'),'days',_0xf5a6('0x8'),_0xf5a6('0x9')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xf5a6('0x5')]('csv',_0xf5a6('0xa'),_0xf5a6('0xb')),'allowNull':![],'defaultValue':_0xf5a6('0xc')},'type':{'type':Sequelize[_0xf5a6('0x5')](_0xf5a6('0xd'),_0xf5a6('0xe')),'allowNull':![],'defaultValue':_0xf5a6('0xd')},'sendMail':{'type':Sequelize[_0xf5a6('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xf5a6('0x2')]},'cc':{'type':Sequelize[_0xf5a6('0xf')]},'bcc':{'type':Sequelize[_0xf5a6('0xf')]},'sendIfEmpty':{'type':Sequelize[_0xf5a6('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd7c0=['TEXT','sequelize','exports','STRING','INTEGER','ENUM','years','weeks','days','csv','pdf','xlsx','custom','BOOLEAN'];(function(_0x43abfb,_0x74683c){var _0x4d5953=function(_0x5aa2b0){while(--_0x5aa2b0){_0x43abfb['push'](_0x43abfb['shift']());}};_0x4d5953(++_0x74683c);}(_0xd7c0,0x8d));var _0x0d7c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xd7c0[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x0d7c('0x0'));module[_0x0d7c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x0d7c('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x0d7c('0x3')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x0d7c('0x4')](_0x0d7c('0x5'),'quarters','months',_0x0d7c('0x6'),'days','hours','minutes'),'allowNull':![],'defaultValue':_0x0d7c('0x7')},'output':{'type':Sequelize['ENUM'](_0x0d7c('0x8'),_0x0d7c('0x9'),_0x0d7c('0xa')),'allowNull':![],'defaultValue':_0x0d7c('0x8')},'type':{'type':Sequelize[_0x0d7c('0x4')](_0x0d7c('0xb'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x0d7c('0xc')],'defaultValue':![]},'email':{'type':Sequelize[_0x0d7c('0x2')]},'cc':{'type':Sequelize[_0x0d7c('0xd')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x0d7c('0xc')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index c399ab3..71c601d 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(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_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'];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(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 45f45a3..ecbd1d5 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 _0x3be1=['moment','bluebird','request-promise','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api'];(function(_0x162c7c,_0x1df9f1){var _0x4917dc=function(_0x580131){while(--_0x580131){_0x162c7c['push'](_0x162c7c['shift']());}};_0x4917dc(++_0x1df9f1);}(_0x3be1,0x1ac));var _0x13be=function(_0x33f7d6,_0x37ea1b){_0x33f7d6=_0x33f7d6-0x0;var _0x2ca34f=_0x3be1[_0x33f7d6];return _0x2ca34f;};'use strict';var _=require(_0x13be('0x0'));var util=require(_0x13be('0x1'));var logger=require(_0x13be('0x2'))(_0x13be('0x3'));var moment=require(_0x13be('0x4'));var BPromise=require(_0x13be('0x5'));var rp=require(_0x13be('0x6'));var attributes=require(_0x13be('0x7'));module[_0x13be('0x8')]=function(_0x539ff6,_0x6a3385){return _0x539ff6[_0x13be('0x9')](_0x13be('0xa'),attributes,{'tableName':_0x13be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7cfa=['define','Schedule','lodash','../../config/logger','api','moment','request-promise','exports'];(function(_0x5effbd,_0x66db29){var _0xa0509b=function(_0x521996){while(--_0x521996){_0x5effbd['push'](_0x5effbd['shift']());}};_0xa0509b(++_0x66db29);}(_0x7cfa,0xc2));var _0xa7cf=function(_0x41d16b,_0x3c4cc2){_0x41d16b=_0x41d16b-0x0;var _0x1b0a7c=_0x7cfa[_0x41d16b];return _0x1b0a7c;};'use strict';var _=require(_0xa7cf('0x0'));var util=require('util');var logger=require(_0xa7cf('0x1'))(_0xa7cf('0x2'));var moment=require(_0xa7cf('0x3'));var BPromise=require('bluebird');var rp=require(_0xa7cf('0x4'));var attributes=require('./schedule.attributes');module[_0xa7cf('0x5')]=function(_0x5f51ff,_0x1bc643){return _0x5f51ff[_0xa7cf('0x6')](_0xa7cf('0x7'),attributes,{'tableName':'tools_schedules','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 e39ec50..11477ae 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 _0x3940=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','randomstring'];(function(_0x54a40d,_0x210ac4){var _0x18e84f=function(_0x843057){while(--_0x843057){_0x54a40d['push'](_0x54a40d['shift']());}};_0x18e84f(++_0x210ac4);}(_0x3940,0x13c));var _0x0394=function(_0xadd1c2,_0x31eaa1){_0xadd1c2=_0xadd1c2-0x0;var _0x9b2e45=_0x3940[_0xadd1c2];return _0x9b2e45;};'use strict';var _=require(_0x0394('0x0'));var util=require(_0x0394('0x1'));var moment=require(_0x0394('0x2'));var BPromise=require('bluebird');var rs=require(_0x0394('0x3'));var fs=require('fs');var db=require(_0x0394('0x4'))['db'];var utils=require(_0x0394('0x5'));var logger=require(_0x0394('0x6'))(_0x0394('0x7'));var config=require(_0x0394('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0394('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2bdf9d,_0x1f31ed,_0x117d8c){return new BPromise(function(_0x55d221,_0x19f0e5){return client[_0x0394('0xa')](_0x2bdf9d,_0x117d8c)[_0x0394('0xb')](function(_0x39767c){logger[_0x0394('0xc')](_0x0394('0xd'),_0x1f31ed,_0x0394('0xe'));logger[_0x0394('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x1f31ed,_0x0394('0xe'),JSON[_0x0394('0x10')](_0x39767c));if(_0x39767c[_0x0394('0x11')]){if(_0x39767c[_0x0394('0x11')]['code']===0x1f4){logger['error'](_0x0394('0xd'),_0x1f31ed,_0x39767c['error'][_0x0394('0x12')]);return _0x19f0e5(_0x39767c[_0x0394('0x11')]['message']);}logger[_0x0394('0x11')](_0x0394('0xd'),_0x1f31ed,_0x39767c['error'][_0x0394('0x12')]);return _0x55d221(_0x39767c[_0x0394('0x11')][_0x0394('0x12')]);}else{logger[_0x0394('0xc')]('Schedule,\x20%s,\x20%s',_0x1f31ed,_0x0394('0xe'));_0x55d221(_0x39767c['result'][_0x0394('0x12')]);}})[_0x0394('0x13')](function(_0x260678){logger[_0x0394('0x11')](_0x0394('0xd'),_0x1f31ed,_0x260678);_0x19f0e5(_0x260678);});});} \ No newline at end of file +var _0xde58=['debug','Schedule,\x20%s,\x20%s,\x20%s','error','Schedule,\x20%s,\x20%s','message','info','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','request\x20sent'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xde58,0xc6));var _0x8de5=function(_0xee8a44,_0x5bc189){_0xee8a44=_0xee8a44-0x0;var _0x1a4d46=_0xde58[_0xee8a44];return _0x1a4d46;};'use strict';var _=require(_0x8de5('0x0'));var util=require('util');var moment=require(_0x8de5('0x1'));var BPromise=require('bluebird');var rs=require(_0x8de5('0x2'));var fs=require('fs');var db=require(_0x8de5('0x3'))['db'];var utils=require(_0x8de5('0x4'));var logger=require(_0x8de5('0x5'))(_0x8de5('0x6'));var config=require(_0x8de5('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8de5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x323cc0,_0x43a9d2,_0x285e6b){return new BPromise(function(_0x2573c9,_0x53d8cd){return client['request'](_0x323cc0,_0x285e6b)[_0x8de5('0x9')](function(_0x4ba239){logger['info']('Schedule,\x20%s,\x20%s',_0x43a9d2,_0x8de5('0xa'));logger[_0x8de5('0xb')](_0x8de5('0xc'),_0x43a9d2,_0x8de5('0xa'),JSON['stringify'](_0x4ba239));if(_0x4ba239['error']){if(_0x4ba239['error']['code']===0x1f4){logger[_0x8de5('0xd')](_0x8de5('0xe'),_0x43a9d2,_0x4ba239[_0x8de5('0xd')][_0x8de5('0xf')]);return _0x53d8cd(_0x4ba239[_0x8de5('0xd')][_0x8de5('0xf')]);}logger['error'](_0x8de5('0xe'),_0x43a9d2,_0x4ba239[_0x8de5('0xd')][_0x8de5('0xf')]);return _0x2573c9(_0x4ba239[_0x8de5('0xd')][_0x8de5('0xf')]);}else{logger[_0x8de5('0x10')](_0x8de5('0xe'),_0x43a9d2,_0x8de5('0xa'));_0x2573c9(_0x4ba239[_0x8de5('0x11')][_0x8de5('0xf')]);}})[_0x8de5('0x12')](function(_0x586c19){logger[_0x8de5('0xd')](_0x8de5('0xe'),_0x43a9d2,_0x586c19);_0x53d8cd(_0x586c19);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 30fc360..9cc4517 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 _0xf1c6=['/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','gdpr','diskStorage','root','server/files/images/logos/','%s%s','logo','post','single','file','addLogo','format','extname','originalname','addLogoLogin','/:id','update','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./setting.controller','get','isAuthenticated','index','show'];(function(_0x41b8e1,_0x4b7d60){var _0x3b3de5=function(_0x4d8318){while(--_0x4d8318){_0x41b8e1['push'](_0x41b8e1['shift']());}};_0x3b3de5(++_0x4b7d60);}(_0xf1c6,0xf4));var _0x6f1c=function(_0xb5a86,_0x57eb47){_0xb5a86=_0xb5a86-0x0;var _0x5a863e=_0xf1c6[_0xb5a86];return _0x5a863e;};'use strict';var multer=require(_0x6f1c('0x0'));var util=require(_0x6f1c('0x1'));var path=require(_0x6f1c('0x2'));var express=require(_0x6f1c('0x3'));var router=express[_0x6f1c('0x4')]();var auth=require(_0x6f1c('0x5'));var interaction=require(_0x6f1c('0x6'));var config=require('../../config/environment');var controller=require(_0x6f1c('0x7'));router[_0x6f1c('0x8')]('/',auth[_0x6f1c('0x9')](),controller[_0x6f1c('0xa')]);router['get']('/:id',controller[_0x6f1c('0xb')]);router[_0x6f1c('0x8')](_0x6f1c('0xc'),controller[_0x6f1c('0xd')]);router[_0x6f1c('0x8')](_0x6f1c('0xe'),controller['getLogoLogin']);router['get'](_0x6f1c('0xf'),controller[_0x6f1c('0x10')]);var upload=multer({'storage':multer[_0x6f1c('0x11')]({'destination':function(_0x1d6a01,_0x1421aa,_0x2e4fa9){_0x2e4fa9(null,path['join'](config[_0x6f1c('0x12')],_0x6f1c('0x13')));},'filename':function(_0x5cc3de,_0x3886ad,_0x5b3e91){_0x5b3e91(null,util['format'](_0x6f1c('0x14'),_0x6f1c('0x15'),path['extname'](_0x3886ad['originalname'])));}})});router[_0x6f1c('0x16')]('/:id/logo',upload[_0x6f1c('0x17')](_0x6f1c('0x18')),controller[_0x6f1c('0x19')]);var upload=multer({'storage':multer[_0x6f1c('0x11')]({'destination':function(_0xa3cc6e,_0x229e31,_0xbac2ee){_0xbac2ee(null,path['join'](config[_0x6f1c('0x12')],'server/files/images/logos/'));},'filename':function(_0x20a8cf,_0x5a0a2d,_0x1d968f){_0x1d968f(null,util[_0x6f1c('0x1a')]('%s%s','logologin',path[_0x6f1c('0x1b')](_0x5a0a2d[_0x6f1c('0x1c')])));}})});router[_0x6f1c('0x16')]('/:id/logo_login',upload[_0x6f1c('0x17')](_0x6f1c('0x18')),controller[_0x6f1c('0x1d')]);router['put'](_0x6f1c('0x1e'),auth[_0x6f1c('0x9')](),controller[_0x6f1c('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x0763=['path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/:id','show','/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','gdpr','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','file','addLogo','diskStorage','logologin','single','put','update','exports','multer'];(function(_0x5a8665,_0x38b2ba){var _0x173093=function(_0x340da2){while(--_0x340da2){_0x5a8665['push'](_0x5a8665['shift']());}};_0x173093(++_0x38b2ba);}(_0x0763,0x87));var _0x3076=function(_0x5178fb,_0x121e19){_0x5178fb=_0x5178fb-0x0;var _0x348183=_0x0763[_0x5178fb];return _0x348183;};'use strict';var multer=require(_0x3076('0x0'));var util=require('util');var path=require(_0x3076('0x1'));var express=require(_0x3076('0x2'));var router=express['Router']();var auth=require(_0x3076('0x3'));var interaction=require(_0x3076('0x4'));var config=require(_0x3076('0x5'));var controller=require(_0x3076('0x6'));router['get']('/',auth[_0x3076('0x7')](),controller[_0x3076('0x8')]);router[_0x3076('0x9')](_0x3076('0xa'),controller[_0x3076('0xb')]);router[_0x3076('0x9')](_0x3076('0xc'),controller[_0x3076('0xd')]);router[_0x3076('0x9')](_0x3076('0xe'),controller['getLogoLogin']);router[_0x3076('0x9')](_0x3076('0xf'),controller[_0x3076('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5e4a5e,_0x366eb6,_0xbc0375){_0xbc0375(null,path[_0x3076('0x11')](config[_0x3076('0x12')],_0x3076('0x13')));},'filename':function(_0x50f630,_0x203d0,_0x209fc0){_0x209fc0(null,util[_0x3076('0x14')](_0x3076('0x15'),_0x3076('0x16'),path[_0x3076('0x17')](_0x203d0[_0x3076('0x18')])));}})});router[_0x3076('0x19')]('/:id/logo',upload['single'](_0x3076('0x1a')),controller[_0x3076('0x1b')]);var upload=multer({'storage':multer[_0x3076('0x1c')]({'destination':function(_0x1b2256,_0x5a2088,_0x5bf9ec){_0x5bf9ec(null,path[_0x3076('0x11')](config[_0x3076('0x12')],_0x3076('0x13')));},'filename':function(_0x1036c1,_0x3d56fe,_0x3b21bc){_0x3b21bc(null,util[_0x3076('0x14')](_0x3076('0x15'),_0x3076('0x1d'),path[_0x3076('0x17')](_0x3d56fe[_0x3076('0x18')])));}})});router[_0x3076('0x19')]('/:id/logo_login',upload[_0x3076('0x1e')](_0x3076('0x1a')),controller['addLogoLogin']);router[_0x3076('0x1f')]('/:id',auth[_0x3076('0x7')](),controller[_0x3076('0x20')]);module[_0x3076('0x21')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index c3f2fbc..a329d44 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 _0x73bd=['BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x73bd,0x1e0));var _0xd73b=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x73bd[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xd73b('0x0'));module[_0xd73b('0x1')]={'min_internal':{'type':Sequelize[_0xd73b('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0xd73b('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xd73b('0x4')],'defaultValue':_0xd73b('0x5')},'logo':{'type':Sequelize[_0xd73b('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xd73b('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0xd73b('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xd73b('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xd73b('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xd73b('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0xd73b('0x4')]},'turnusername':{'type':Sequelize[_0xd73b('0x4')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xd73b('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xd73b('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xd73b('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xd73b('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xd73b('0x7')},'enableEmailPreview':{'type':Sequelize[_0xd73b('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xd73b('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xd73b('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xd73b('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xd73b('0x8')},'chatTimeout':{'type':Sequelize[_0xd73b('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xd73b('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa9f3=['STRING','BOOLEAN','alternate','sequelize','exports','min_internal','INTEGER','min_mailbox'];(function(_0x5db726,_0x34620a){var _0x1e452d=function(_0x4db252){while(--_0x4db252){_0x5db726['push'](_0x5db726['shift']());}};_0x1e452d(++_0x34620a);}(_0xa9f3,0x1db));var _0x3a9f=function(_0x2497c7,_0x5858f5){_0x2497c7=_0x2497c7-0x0;var _0x1198cd=_0xa9f3[_0x2497c7];return _0x1198cd;};'use strict';var Sequelize=require(_0x3a9f('0x0'));module[_0x3a9f('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x3a9f('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x3a9f('0x3')](0xb),'unique':_0x3a9f('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x3a9f('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x3a9f('0x5')]},'defaultLogo':{'type':Sequelize[_0x3a9f('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x3a9f('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x3a9f('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x3a9f('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x3a9f('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x3a9f('0x5')]},'turnusername':{'type':Sequelize[_0x3a9f('0x5')]},'turnpassword':{'type':Sequelize[_0x3a9f('0x5')]},'pageTitle':{'type':Sequelize[_0x3a9f('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x3a9f('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x3a9f('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x3a9f('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x3a9f('0x5')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x3a9f('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x3a9f('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x3a9f('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x3a9f('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x3a9f('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x3a9f('0x5')],'defaultValue':_0x3a9f('0x7')},'chatTimeout':{'type':Sequelize[_0x3a9f('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index ea0a278..70527e9 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 _0x976f=['Setting','model','keys','dateStart','query','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','day','add','merge','filter','map','includeAll','include','findAll','rows','catch','options','find','params','get','join','root','utf8','render','readFileSync','server/files/templates/turn.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','res_rtp_asterisk.so','addLogo','file','filename','body','logo','addLogoLogin','../../config/license/util','getLogo','server/files/images/logos','getLicense','defaultLogo','defaultLoginLogo','existsSync','toLower','default_logo.png','upperFirst','custom','ValidationError','Logo\x20not\x20found','getLogoLogin','loginLogo','default_loginLogo.png','Sequelize','download','gdpr','securePassword','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','squel','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x976f,0x121));var _0xf976=function(_0x18da58,_0x46f2cf){_0x18da58=_0x18da58-0x0;var _0x37e602=_0x976f[_0x18da58];return _0x37e602;};'use strict';var jsonpatch=require(_0xf976('0x0'));var rp=require(_0xf976('0x1'));var moment=require(_0xf976('0x2'));var BPromise=require(_0xf976('0x3'));var Mustache=require('mustache');var util=require(_0xf976('0x4'));var path=require('path');var sox=require(_0xf976('0x5'));var csv=require('to-csv');var ejs=require(_0xf976('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf976('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf976('0x8'));var toCsv=require(_0xf976('0x9'));var querystring=require(_0xf976('0xa'));var Papa=require(_0xf976('0xb'));var qs=require(_0xf976('0xc'));var logger=require(_0xf976('0xd'))(_0xf976('0xe'));var utils=require(_0xf976('0xf'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x327f97,_0x23d112,_0x18a56e,_0x27bc90){return new BPromise(function(_0x4c2d51,_0x4dbf75){var _0x22c6b0=_0x27bc90||client;return _0x22c6b0[_0xf976('0x10')](_0x327f97,_0x18a56e)[_0xf976('0x11')](function(_0x4e0d97){logger[_0xf976('0x12')](_0xf976('0x13'),_0x23d112,_0xf976('0x14'));logger[_0xf976('0x15')]('Setting,\x20%s,\x20%s,\x20%s',_0x23d112,'request\x20sent',JSON[_0xf976('0x16')](_0x4e0d97));if(_0x4e0d97[_0xf976('0x17')]){if(_0x4e0d97[_0xf976('0x17')][_0xf976('0x18')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x23d112,_0x4e0d97['error'][_0xf976('0x19')]);return _0x4dbf75(_0x4e0d97['error'][_0xf976('0x19')]);}logger['error'](_0xf976('0x13'),_0x23d112,_0x4e0d97[_0xf976('0x17')][_0xf976('0x19')]);return _0x4c2d51(_0x4e0d97[_0xf976('0x17')][_0xf976('0x19')]);}else{logger[_0xf976('0x12')](_0xf976('0x13'),_0x23d112,_0xf976('0x14'));_0x4c2d51(_0x4e0d97['result'][_0xf976('0x19')]);}})['catch'](function(_0x46aaeb){logger[_0xf976('0x17')](_0xf976('0x13'),_0x23d112,_0x46aaeb);_0x4dbf75(_0x46aaeb);});});}function respondWithStatusCode(_0x2df469,_0x2ee38c){_0x2ee38c=_0x2ee38c||0xcc;return function(_0xeef397){if(_0xeef397){return _0x2df469['sendStatus'](_0x2ee38c);}return _0x2df469[_0xf976('0x1a')](_0x2ee38c)[_0xf976('0x1b')]();};}function respondWithResult(_0x526cca,_0x556662){_0x556662=_0x556662||0xc8;return function(_0x441a7c){if(_0x441a7c){return _0x526cca[_0xf976('0x1a')](_0x556662)[_0xf976('0x1c')](_0x441a7c);}};}function respondWithFilteredResult(_0x3c6cef,_0x7765a){return function(_0x25a09c){if(_0x25a09c){var _0x37ca5b=_0x25a09c[_0xf976('0x1d')],_0x1035d8=_0x7765a['offset'],_0x1a5db1=_0x7765a[_0xf976('0x1e')]+_0x7765a[_0xf976('0x1f')],_0x36bdf5;if(_0x1a5db1>=_0x37ca5b){_0x1a5db1=_0x37ca5b;_0x36bdf5=0xc8;}else{_0x36bdf5=0xce;}_0x3c6cef[_0xf976('0x1a')](_0x36bdf5);return _0x3c6cef[_0xf976('0x20')](_0xf976('0x21'),_0x1035d8+'-'+_0x1a5db1+'/'+_0x37ca5b)[_0xf976('0x1c')](_0x25a09c);}return null;};}function patchUpdates(_0x42d539){return function(_0x2bf0ec){try{jsonpatch[_0xf976('0x22')](_0x2bf0ec,_0x42d539,!![]);}catch(_0x34f47b){return BPromise[_0xf976('0x23')](_0x34f47b);}return _0x2bf0ec[_0xf976('0x24')]();};}function saveUpdates(_0x18dfef,_0x1d31a1){return function(_0x2ceb78){if(_0x2ceb78){return _0x2ceb78[_0xf976('0x25')](_0x18dfef)[_0xf976('0x11')](function(_0x521ab2){return _0x521ab2;});}return null;};}function removeEntity(_0x11c21a,_0x2a34ea){return function(_0x537c9b){if(_0x537c9b){return _0x537c9b[_0xf976('0x26')]()[_0xf976('0x11')](function(){_0x11c21a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x352e4e,_0x20c65f){return function(_0x120df5){if(!_0x120df5){_0x352e4e[_0xf976('0x27')](0x194);}return _0x120df5;};}function handleError(_0x19ec89,_0x135b16){_0x135b16=_0x135b16||0x1f4;return function(_0x7e7a45){logger['error'](_0x7e7a45[_0xf976('0x28')]);if(_0x7e7a45[_0xf976('0x29')]){delete _0x7e7a45[_0xf976('0x29')];}_0x19ec89[_0xf976('0x1a')](_0x135b16)[_0xf976('0x2a')](_0x7e7a45);};}exports[_0xf976('0x2b')]=function(_0x2155da,_0x462fd9){var _0x13de3f={},_0x55ec10={},_0x35af19={'count':0x0,'rows':[]};var _0x1c6126=db[_0xf976('0x2c')]['rawAttributes'];_0x55ec10[_0xf976('0x2d')]=_[_0xf976('0x2e')](_0x1c6126);var _0x35c751={'dateStart':_0x2155da['query'][_0xf976('0x2f')],'dateEnd':_0x2155da[_0xf976('0x30')][_0xf976('0x31')]};delete _0x2155da['query'][_0xf976('0x2f')];delete _0x2155da[_0xf976('0x30')][_0xf976('0x31')];_0x55ec10[_0xf976('0x30')]=_['keys'](_0x2155da[_0xf976('0x30')]);_0x55ec10[_0xf976('0x32')]=_[_0xf976('0x33')](_0x55ec10[_0xf976('0x2d')],_0x55ec10[_0xf976('0x30')]);_0x13de3f['attributes']=_['intersection'](_0x55ec10[_0xf976('0x2d')],qs['fields'](_0x2155da[_0xf976('0x30')][_0xf976('0x34')]));_0x13de3f[_0xf976('0x35')]=_0x13de3f[_0xf976('0x35')][_0xf976('0x36')]?_0x13de3f[_0xf976('0x35')]:_0x55ec10['model'];if(!_0x2155da['query'][_0xf976('0x37')](_0xf976('0x38'))){_0x13de3f[_0xf976('0x1f')]=qs[_0xf976('0x1f')](_0x2155da[_0xf976('0x30')][_0xf976('0x1f')]);_0x13de3f[_0xf976('0x1e')]=qs[_0xf976('0x1e')](_0x2155da[_0xf976('0x30')][_0xf976('0x1e')]);}_0x13de3f[_0xf976('0x39')]=qs[_0xf976('0x3a')](_0x2155da[_0xf976('0x30')][_0xf976('0x3a')]);_0x13de3f[_0xf976('0x3b')]=qs[_0xf976('0x32')](_[_0xf976('0x3c')](_0x2155da[_0xf976('0x30')],_0x55ec10[_0xf976('0x32')]));if(_0x35c751[_0xf976('0x2f')]){if(_0x35c751[_0xf976('0x31')]){_0x35c751[_0xf976('0x31')]=moment(_0x35c751[_0xf976('0x31')])['add'](0x1,_0xf976('0x3d'));}else{_0x35c751[_0xf976('0x31')]=moment(_0x35c751['dateStart'])[_0xf976('0x3e')](0x1,_0xf976('0x3d'));}_[_0xf976('0x3f')](_0x13de3f[_0xf976('0x3b')],{'createdAt':{'$gte':_0x35c751['dateStart'],'$lte':_0x35c751[_0xf976('0x31')]}});}if(_0x2155da['query'][_0xf976('0x40')]){_0x13de3f['where']=_[_0xf976('0x3f')](_0x13de3f['where'],{'$or':_[_0xf976('0x41')](_0x13de3f[_0xf976('0x35')],function(_0x35a76e){var _0x49b766={};_0x49b766[_0x35a76e]={'$like':'%'+_0x2155da[_0xf976('0x30')][_0xf976('0x40')]+'%'};return _0x49b766;})});}_0x13de3f=_[_0xf976('0x3f')]({},_0x13de3f,_0x2155da['options']);var _0x172377={'where':_0x13de3f[_0xf976('0x3b')]};return db[_0xf976('0x2c')]['count'](_0x172377)[_0xf976('0x11')](function(_0x1b1145){_0x35af19['count']=_0x1b1145;if(_0x2155da[_0xf976('0x30')][_0xf976('0x42')]){_0x13de3f[_0xf976('0x43')]=[{'all':!![]}];}return db[_0xf976('0x2c')][_0xf976('0x44')](_0x13de3f);})[_0xf976('0x11')](function(_0x3ef305){_0x35af19[_0xf976('0x45')]=_0x3ef305;return _0x35af19;})[_0xf976('0x11')](respondWithFilteredResult(_0x462fd9,_0x13de3f))[_0xf976('0x46')](handleError(_0x462fd9,null));};exports['show']=function(_0x4dcac1,_0x1719e9){var _0x3456bd={'raw':![],'where':{'id':_0x4dcac1['params']['id']}},_0x2912ea={};_0x2912ea[_0xf976('0x2d')]=_[_0xf976('0x2e')](db[_0xf976('0x2c')]['rawAttributes']);_0x2912ea[_0xf976('0x30')]=_['keys'](_0x4dcac1[_0xf976('0x30')]);_0x2912ea[_0xf976('0x32')]=_[_0xf976('0x33')](_0x2912ea['model'],_0x2912ea[_0xf976('0x30')]);_0x3456bd['attributes']=_['intersection'](_0x2912ea[_0xf976('0x2d')],qs[_0xf976('0x34')](_0x4dcac1[_0xf976('0x30')]['fields']));_0x3456bd[_0xf976('0x35')]=_0x3456bd[_0xf976('0x35')]['length']?_0x3456bd['attributes']:_0x2912ea[_0xf976('0x2d')];if(_0x4dcac1[_0xf976('0x30')]['includeAll']){_0x3456bd[_0xf976('0x43')]=[{'all':!![]}];}_0x3456bd=_['merge']({},_0x3456bd,_0x4dcac1[_0xf976('0x47')]);return db[_0xf976('0x2c')][_0xf976('0x48')](_0x3456bd)['then'](handleEntityNotFound(_0x1719e9,null))[_0xf976('0x11')](respondWithResult(_0x1719e9,null))['catch'](handleError(_0x1719e9,null));};exports[_0xf976('0x25')]=function(_0x5d6d16,_0x5bfed4,_0x3e5ec2){var _0x4e092e;return db['Setting'][_0xf976('0x48')]({'where':{'id':_0x5d6d16[_0xf976('0x49')]['id']}})[_0xf976('0x11')](handleEntityNotFound(_0x5bfed4,null))[_0xf976('0x11')](saveUpdates(_0x5d6d16['body'],null))[_0xf976('0x11')](function(_0x29e41d){if(_0x29e41d){_0x4e092e=_0x29e41d[_0xf976('0x4a')]({'plain':!![]});var _0x273fa4=fs['readFileSync'](path[_0xf976('0x4b')](config[_0xf976('0x4c')],'server/files/templates/stun.ejs'),_0xf976('0x4d'));var _0x44bc06=ejs[_0xf976('0x4e')](_0x273fa4,_0x4e092e);var _0x588cb2=fs[_0xf976('0x4f')](path[_0xf976('0x4b')](config[_0xf976('0x4c')],_0xf976('0x50')),'utf8');var _0x2de55c=ejs['render'](_0x588cb2,_0x4e092e);fs[_0xf976('0x51')]('/etc/asterisk/stun_xcally.conf',_0x44bc06);fs[_0xf976('0x51')](_0xf976('0x52'),_0x2de55c);return respondWithRpcPromise('Reload',_0xf976('0x25'),{'module':_0xf976('0x53')});}})[_0xf976('0x11')](function(){return respondWithRpcPromise('Reload',_0xf976('0x25'),{'module':_0xf976('0x54')});})[_0xf976('0x11')](function(){return _0x4e092e||null;})[_0xf976('0x11')](respondWithResult(_0x5bfed4,null))[_0xf976('0x46')](handleError(_0x5bfed4,null));};exports[_0xf976('0x55')]=function(_0xff27fb,_0x147b41,_0x2484f3){if(_0xff27fb[_0xf976('0x56')]&&_0xff27fb[_0xf976('0x56')][_0xf976('0x57')]){_0xff27fb[_0xf976('0x58')][_0xf976('0x59')]=_0xff27fb[_0xf976('0x56')][_0xf976('0x57')];}return db[_0xf976('0x2c')][_0xf976('0x48')]({'where':{'id':_0xff27fb[_0xf976('0x49')]['id']}})['then'](handleEntityNotFound(_0x147b41,null))[_0xf976('0x11')](saveUpdates(_0xff27fb['body'],null))[_0xf976('0x11')](respondWithResult(_0x147b41,null))[_0xf976('0x46')](handleError(_0x147b41,null));};exports[_0xf976('0x5a')]=function(_0x1db2dc,_0x59d634,_0xd8329a){if(_0x1db2dc[_0xf976('0x56')]&&_0x1db2dc[_0xf976('0x56')][_0xf976('0x57')]){_0x1db2dc[_0xf976('0x58')]['loginLogo']=_0x1db2dc['file'][_0xf976('0x57')];}return db['Setting'][_0xf976('0x48')]({'where':{'id':_0x1db2dc[_0xf976('0x49')]['id']}})[_0xf976('0x11')](handleEntityNotFound(_0x59d634,null))[_0xf976('0x11')](saveUpdates(_0x1db2dc['body'],null))['then'](respondWithResult(_0x59d634,null))[_0xf976('0x46')](handleError(_0x59d634,null));};var utilLicense=require(_0xf976('0x5b'));exports[_0xf976('0x5c')]=function(_0x18980a,_0x3b075e,_0x30416f){var _0x2adda3=_0xf976('0x5d');var _0x1d0b99={'custom':![]};return utilLicense[_0xf976('0x5e')]()['then'](function(_0x5c256c){if(_0x5c256c){_0x1d0b99=_0x5c256c;}return db[_0xf976('0x2c')][_0xf976('0x48')]({'where':{'id':_0x18980a[_0xf976('0x49')]['id']},'attributes':['logo','loginLogo',_0xf976('0x5f'),_0xf976('0x60')],'raw':!![]});})[_0xf976('0x11')](handleEntityNotFound(_0x3b075e,null))[_0xf976('0x11')](function(_0x13bb49){if(_0x13bb49){var _0x221d93=_0x13bb49[_0xf976('0x59')]&&fs[_0xf976('0x61')](path[_0xf976('0x4b')](config['root'],_0x2adda3,_[_0xf976('0x62')](_0x13bb49[_0xf976('0x59')])))?path[_0xf976('0x4b')](config['root'],_0x2adda3,_['toLower'](_0x13bb49[_0xf976('0x59')])):path[_0xf976('0x4b')](config[_0xf976('0x4c')],_0x2adda3,_[_0xf976('0x62')](_0xf976('0x63')));var _0x5ef288='default'+_[_0xf976('0x64')](_0xf976('0x59'));if(_0x13bb49[_0x5ef288]||!_0x1d0b99[_0xf976('0x65')]){_0x221d93=path['join'](config[_0xf976('0x4c')],_0x2adda3,_['toLower'](_0xf976('0x63')));}if(!fs[_0xf976('0x61')](_0x221d93)){throw new db['Sequelize'][(_0xf976('0x66'))](_0xf976('0x67'));}return _0x3b075e['download'](_0x221d93);}})[_0xf976('0x46')](handleError(_0x3b075e,null));};var utilLicense=require('../../config/license/util');exports[_0xf976('0x68')]=function(_0x335709,_0x4efabe,_0xf95397){var _0x58ad96='server/files/images/logos';var _0x5377d6={'custom':![]};return utilLicense[_0xf976('0x5e')]()['then'](function(_0x114eed){if(_0x114eed){_0x5377d6=_0x114eed;}return db['Setting']['find']({'where':{'id':_0x335709[_0xf976('0x49')]['id']},'attributes':[_0xf976('0x59'),_0xf976('0x69'),'defaultLogo',_0xf976('0x60')],'raw':!![]});})[_0xf976('0x11')](handleEntityNotFound(_0x4efabe,null))[_0xf976('0x11')](function(_0x30770c){if(_0x30770c){var _0x3ab6cb=_0x30770c['loginLogo']&&fs[_0xf976('0x61')](path[_0xf976('0x4b')](config[_0xf976('0x4c')],_0x58ad96,_['toLower'](_0x30770c[_0xf976('0x69')])))?path[_0xf976('0x4b')](config[_0xf976('0x4c')],_0x58ad96,_[_0xf976('0x62')](_0x30770c['loginLogo'])):path[_0xf976('0x4b')](config[_0xf976('0x4c')],_0x58ad96,_[_0xf976('0x62')](_0xf976('0x6a')));var _0x4fb011='default'+_['upperFirst'](_0xf976('0x69'));if(_0x30770c[_0x4fb011]||!_0x5377d6['custom']){_0x3ab6cb=path[_0xf976('0x4b')](config[_0xf976('0x4c')],_0x58ad96,_[_0xf976('0x62')](_0xf976('0x6a')));}if(!fs[_0xf976('0x61')](_0x3ab6cb)){throw new db[(_0xf976('0x6b'))][(_0xf976('0x66'))](_0xf976('0x67'));}return _0x4efabe[_0xf976('0x6c')](_0x3ab6cb);}})[_0xf976('0x46')](handleError(_0x4efabe,null));};exports[_0xf976('0x6d')]=function(_0xfaa83d,_0x5216c1){return db[_0xf976('0x2c')][_0xf976('0x48')]({'where':{'id':_0xfaa83d[_0xf976('0x49')]['id']},'attributes':[_0xf976('0x6e')]})[_0xf976('0x11')](respondWithResult(_0x5216c1,null))[_0xf976('0x46')](handleError(_0x5216c1,null));}; \ No newline at end of file +var _0x2141=['message','request\x20sent','result','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','end','name','send','index','keys','query','dateStart','dateEnd','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','add','day','filter','merge','options','Setting','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','body','get','readFileSync','join','root','server/files/templates/stun.ejs','utf8','server/files/templates/turn.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','/etc/asterisk/turn_xcally.conf','Reload','res_stun_monitor.so','res_rtp_asterisk.so','addLogo','file','filename','logo','addLogoLogin','getLogo','server/files/images/logos','getLicense','loginLogo','defaultLogo','defaultLoginLogo','existsSync','toLower','default_logo.png','default','upperFirst','custom','ValidationError','Logo\x20not\x20found','download','../../config/license/util','getLogoLogin','default_loginLogo.png','gdpr','securePassword','fast-json-patch','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','api','../../mysqldb','client','http','request','info','Setting,\x20%s,\x20%s','error'];(function(_0x5795e7,_0x6bd236){var _0x4dc3bd=function(_0x56eaf9){while(--_0x56eaf9){_0x5795e7['push'](_0x5795e7['shift']());}};_0x4dc3bd(++_0x6bd236);}(_0x2141,0x138));var _0x1214=function(_0x14175d,_0x32f82a){_0x14175d=_0x14175d-0x0;var _0x4dbaf5=_0x2141[_0x14175d];return _0x4dbaf5;};'use strict';var jsonpatch=require(_0x1214('0x0'));var rp=require('request-promise');var moment=require(_0x1214('0x1'));var BPromise=require(_0x1214('0x2'));var Mustache=require(_0x1214('0x3'));var util=require(_0x1214('0x4'));var path=require(_0x1214('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1214('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1214('0x7'));var crypto=require(_0x1214('0x8'));var jsforce=require(_0x1214('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1214('0xa'));var Papa=require(_0x1214('0xb'));var qs=require(_0x1214('0xc'));var logger=require('../../config/logger')(_0x1214('0xd'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x1214('0xe'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x1214('0xf')][_0x1214('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x5c90e1,_0xf0b135,_0x4d7f62,_0x51cdad){return new BPromise(function(_0x540f26,_0x5bbb5b){var _0x4b1dd9=_0x51cdad||client;return _0x4b1dd9[_0x1214('0x11')](_0x5c90e1,_0x4d7f62)['then'](function(_0x172612){logger[_0x1214('0x12')](_0x1214('0x13'),_0xf0b135,'request\x20sent');logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0xf0b135,'request\x20sent',JSON['stringify'](_0x172612));if(_0x172612[_0x1214('0x14')]){if(_0x172612['error']['code']===0x1f4){logger[_0x1214('0x14')](_0x1214('0x13'),_0xf0b135,_0x172612[_0x1214('0x14')][_0x1214('0x15')]);return _0x5bbb5b(_0x172612[_0x1214('0x14')][_0x1214('0x15')]);}logger[_0x1214('0x14')](_0x1214('0x13'),_0xf0b135,_0x172612[_0x1214('0x14')][_0x1214('0x15')]);return _0x540f26(_0x172612[_0x1214('0x14')][_0x1214('0x15')]);}else{logger[_0x1214('0x12')](_0x1214('0x13'),_0xf0b135,_0x1214('0x16'));_0x540f26(_0x172612[_0x1214('0x17')][_0x1214('0x15')]);}})[_0x1214('0x18')](function(_0x4c9bbe){logger[_0x1214('0x14')](_0x1214('0x13'),_0xf0b135,_0x4c9bbe);_0x5bbb5b(_0x4c9bbe);});});}function respondWithStatusCode(_0x4b6e72,_0xc13e98){_0xc13e98=_0xc13e98||0xcc;return function(_0x370a6a){if(_0x370a6a){return _0x4b6e72[_0x1214('0x19')](_0xc13e98);}return _0x4b6e72[_0x1214('0x1a')](_0xc13e98)['end']();};}function respondWithResult(_0x5588ce,_0x4ad114){_0x4ad114=_0x4ad114||0xc8;return function(_0x41a324){if(_0x41a324){return _0x5588ce[_0x1214('0x1a')](_0x4ad114)[_0x1214('0x1b')](_0x41a324);}};}function respondWithFilteredResult(_0x3e58d2,_0x3d17c7){return function(_0x2ccc42){if(_0x2ccc42){var _0x5a654a=_0x2ccc42[_0x1214('0x1c')],_0x1bf6a9=_0x3d17c7[_0x1214('0x1d')],_0x2c43bb=_0x3d17c7[_0x1214('0x1d')]+_0x3d17c7[_0x1214('0x1e')],_0xbabb09;if(_0x2c43bb>=_0x5a654a){_0x2c43bb=_0x5a654a;_0xbabb09=0xc8;}else{_0xbabb09=0xce;}_0x3e58d2[_0x1214('0x1a')](_0xbabb09);return _0x3e58d2[_0x1214('0x1f')]('Content-Range',_0x1bf6a9+'-'+_0x2c43bb+'/'+_0x5a654a)[_0x1214('0x1b')](_0x2ccc42);}return null;};}function patchUpdates(_0x1dc26c){return function(_0x224d77){try{jsonpatch[_0x1214('0x20')](_0x224d77,_0x1dc26c,!![]);}catch(_0x298928){return BPromise[_0x1214('0x21')](_0x298928);}return _0x224d77[_0x1214('0x22')]();};}function saveUpdates(_0xbba0e3,_0x2e5d16){return function(_0x22bd52){if(_0x22bd52){return _0x22bd52[_0x1214('0x23')](_0xbba0e3)[_0x1214('0x24')](function(_0x2fe69e){return _0x2fe69e;});}return null;};}function removeEntity(_0x44101a,_0x49201c){return function(_0x95075f){if(_0x95075f){return _0x95075f['destroy']()[_0x1214('0x24')](function(){_0x44101a['status'](0xcc)[_0x1214('0x25')]();});}};}function handleEntityNotFound(_0x208760,_0x33d24e){return function(_0x4e27ea){if(!_0x4e27ea){_0x208760[_0x1214('0x19')](0x194);}return _0x4e27ea;};}function handleError(_0x372ea5,_0x5650da){_0x5650da=_0x5650da||0x1f4;return function(_0xdb3437){logger[_0x1214('0x14')](_0xdb3437['stack']);if(_0xdb3437[_0x1214('0x26')]){delete _0xdb3437[_0x1214('0x26')];}_0x372ea5['status'](_0x5650da)[_0x1214('0x27')](_0xdb3437);};}exports[_0x1214('0x28')]=function(_0x61bdaa,_0xdf3ab){var _0x3537cb={},_0x1c819f={},_0x152744={'count':0x0,'rows':[]};var _0x58e62e=db['Setting']['rawAttributes'];_0x1c819f['model']=_[_0x1214('0x29')](_0x58e62e);var _0x13e4fb={'dateStart':_0x61bdaa[_0x1214('0x2a')][_0x1214('0x2b')],'dateEnd':_0x61bdaa[_0x1214('0x2a')][_0x1214('0x2c')]};delete _0x61bdaa[_0x1214('0x2a')][_0x1214('0x2b')];delete _0x61bdaa[_0x1214('0x2a')]['dateEnd'];_0x1c819f[_0x1214('0x2a')]=_['keys'](_0x61bdaa[_0x1214('0x2a')]);_0x1c819f[_0x1214('0x2d')]=_[_0x1214('0x2e')](_0x1c819f[_0x1214('0x2f')],_0x1c819f['query']);_0x3537cb['attributes']=_['intersection'](_0x1c819f[_0x1214('0x2f')],qs['fields'](_0x61bdaa['query'][_0x1214('0x30')]));_0x3537cb[_0x1214('0x31')]=_0x3537cb[_0x1214('0x31')]['length']?_0x3537cb[_0x1214('0x31')]:_0x1c819f[_0x1214('0x2f')];if(!_0x61bdaa[_0x1214('0x2a')][_0x1214('0x32')](_0x1214('0x33'))){_0x3537cb[_0x1214('0x1e')]=qs['limit'](_0x61bdaa[_0x1214('0x2a')]['limit']);_0x3537cb[_0x1214('0x1d')]=qs[_0x1214('0x1d')](_0x61bdaa[_0x1214('0x2a')][_0x1214('0x1d')]);}_0x3537cb[_0x1214('0x34')]=qs[_0x1214('0x35')](_0x61bdaa[_0x1214('0x2a')][_0x1214('0x35')]);_0x3537cb[_0x1214('0x36')]=qs[_0x1214('0x2d')](_[_0x1214('0x37')](_0x61bdaa[_0x1214('0x2a')],_0x1c819f[_0x1214('0x2d')]));if(_0x13e4fb['dateStart']){if(_0x13e4fb[_0x1214('0x2c')]){_0x13e4fb[_0x1214('0x2c')]=moment(_0x13e4fb[_0x1214('0x2c')])[_0x1214('0x38')](0x1,_0x1214('0x39'));}else{_0x13e4fb['dateEnd']=moment(_0x13e4fb[_0x1214('0x2b')])[_0x1214('0x38')](0x1,_0x1214('0x39'));}_['merge'](_0x3537cb[_0x1214('0x36')],{'createdAt':{'$gte':_0x13e4fb[_0x1214('0x2b')],'$lte':_0x13e4fb[_0x1214('0x2c')]}});}if(_0x61bdaa['query'][_0x1214('0x3a')]){_0x3537cb[_0x1214('0x36')]=_[_0x1214('0x3b')](_0x3537cb[_0x1214('0x36')],{'$or':_['map'](_0x3537cb[_0x1214('0x31')],function(_0x22539a){var _0x45969f={};_0x45969f[_0x22539a]={'$like':'%'+_0x61bdaa[_0x1214('0x2a')][_0x1214('0x3a')]+'%'};return _0x45969f;})});}_0x3537cb=_[_0x1214('0x3b')]({},_0x3537cb,_0x61bdaa[_0x1214('0x3c')]);var _0x41b906={'where':_0x3537cb['where']};return db[_0x1214('0x3d')][_0x1214('0x1c')](_0x41b906)[_0x1214('0x24')](function(_0x284dcb){_0x152744[_0x1214('0x1c')]=_0x284dcb;if(_0x61bdaa[_0x1214('0x2a')][_0x1214('0x3e')]){_0x3537cb[_0x1214('0x3f')]=[{'all':!![]}];}return db['Setting'][_0x1214('0x40')](_0x3537cb);})[_0x1214('0x24')](function(_0x560edb){_0x152744[_0x1214('0x41')]=_0x560edb;return _0x152744;})[_0x1214('0x24')](respondWithFilteredResult(_0xdf3ab,_0x3537cb))[_0x1214('0x18')](handleError(_0xdf3ab,null));};exports[_0x1214('0x42')]=function(_0x23949d,_0x4d3519){var _0x192a3b={'raw':![],'where':{'id':_0x23949d[_0x1214('0x43')]['id']}},_0x366183={};_0x366183[_0x1214('0x2f')]=_[_0x1214('0x29')](db[_0x1214('0x3d')][_0x1214('0x44')]);_0x366183[_0x1214('0x2a')]=_[_0x1214('0x29')](_0x23949d[_0x1214('0x2a')]);_0x366183['filters']=_[_0x1214('0x2e')](_0x366183[_0x1214('0x2f')],_0x366183[_0x1214('0x2a')]);_0x192a3b[_0x1214('0x31')]=_[_0x1214('0x2e')](_0x366183[_0x1214('0x2f')],qs[_0x1214('0x30')](_0x23949d[_0x1214('0x2a')]['fields']));_0x192a3b[_0x1214('0x31')]=_0x192a3b[_0x1214('0x31')][_0x1214('0x45')]?_0x192a3b['attributes']:_0x366183[_0x1214('0x2f')];if(_0x23949d[_0x1214('0x2a')][_0x1214('0x3e')]){_0x192a3b[_0x1214('0x3f')]=[{'all':!![]}];}_0x192a3b=_[_0x1214('0x3b')]({},_0x192a3b,_0x23949d[_0x1214('0x3c')]);return db[_0x1214('0x3d')][_0x1214('0x46')](_0x192a3b)[_0x1214('0x24')](handleEntityNotFound(_0x4d3519,null))[_0x1214('0x24')](respondWithResult(_0x4d3519,null))[_0x1214('0x18')](handleError(_0x4d3519,null));};exports['update']=function(_0x584b1e,_0xb9df4e,_0x24fd24){var _0x165e8d;return db[_0x1214('0x3d')]['find']({'where':{'id':_0x584b1e[_0x1214('0x43')]['id']}})['then'](handleEntityNotFound(_0xb9df4e,null))['then'](saveUpdates(_0x584b1e[_0x1214('0x47')],null))[_0x1214('0x24')](function(_0x331a7d){if(_0x331a7d){_0x165e8d=_0x331a7d[_0x1214('0x48')]({'plain':!![]});var _0x1919f=fs[_0x1214('0x49')](path[_0x1214('0x4a')](config[_0x1214('0x4b')],_0x1214('0x4c')),_0x1214('0x4d'));var _0x31669f=ejs['render'](_0x1919f,_0x165e8d);var _0x1bd67a=fs[_0x1214('0x49')](path[_0x1214('0x4a')](config['root'],_0x1214('0x4e')),'utf8');var _0x3ce803=ejs[_0x1214('0x4f')](_0x1bd67a,_0x165e8d);fs[_0x1214('0x50')](_0x1214('0x51'),_0x31669f);fs['writeFileSync'](_0x1214('0x52'),_0x3ce803);return respondWithRpcPromise(_0x1214('0x53'),_0x1214('0x23'),{'module':_0x1214('0x54')});}})['then'](function(){return respondWithRpcPromise(_0x1214('0x53'),_0x1214('0x23'),{'module':_0x1214('0x55')});})[_0x1214('0x24')](function(){return _0x165e8d||null;})['then'](respondWithResult(_0xb9df4e,null))['catch'](handleError(_0xb9df4e,null));};exports[_0x1214('0x56')]=function(_0x3f3096,_0x30c2b7,_0xd26b39){if(_0x3f3096[_0x1214('0x57')]&&_0x3f3096[_0x1214('0x57')][_0x1214('0x58')]){_0x3f3096[_0x1214('0x47')][_0x1214('0x59')]=_0x3f3096[_0x1214('0x57')]['filename'];}return db[_0x1214('0x3d')][_0x1214('0x46')]({'where':{'id':_0x3f3096['params']['id']}})[_0x1214('0x24')](handleEntityNotFound(_0x30c2b7,null))['then'](saveUpdates(_0x3f3096[_0x1214('0x47')],null))['then'](respondWithResult(_0x30c2b7,null))['catch'](handleError(_0x30c2b7,null));};exports[_0x1214('0x5a')]=function(_0x4a4377,_0x19afdf,_0x119a6d){if(_0x4a4377[_0x1214('0x57')]&&_0x4a4377[_0x1214('0x57')][_0x1214('0x58')]){_0x4a4377['body']['loginLogo']=_0x4a4377[_0x1214('0x57')]['filename'];}return db[_0x1214('0x3d')][_0x1214('0x46')]({'where':{'id':_0x4a4377[_0x1214('0x43')]['id']}})['then'](handleEntityNotFound(_0x19afdf,null))[_0x1214('0x24')](saveUpdates(_0x4a4377[_0x1214('0x47')],null))[_0x1214('0x24')](respondWithResult(_0x19afdf,null))[_0x1214('0x18')](handleError(_0x19afdf,null));};var utilLicense=require('../../config/license/util');exports[_0x1214('0x5b')]=function(_0x400295,_0x125e21,_0x1a3198){var _0x2c46f0=_0x1214('0x5c');var _0x501b0c={'custom':![]};return utilLicense[_0x1214('0x5d')]()[_0x1214('0x24')](function(_0x5832c5){if(_0x5832c5){_0x501b0c=_0x5832c5;}return db['Setting'][_0x1214('0x46')]({'where':{'id':_0x400295['params']['id']},'attributes':[_0x1214('0x59'),_0x1214('0x5e'),_0x1214('0x5f'),_0x1214('0x60')],'raw':!![]});})[_0x1214('0x24')](handleEntityNotFound(_0x125e21,null))[_0x1214('0x24')](function(_0x576a40){if(_0x576a40){var _0x5d2c27=_0x576a40[_0x1214('0x59')]&&fs[_0x1214('0x61')](path['join'](config[_0x1214('0x4b')],_0x2c46f0,_[_0x1214('0x62')](_0x576a40[_0x1214('0x59')])))?path[_0x1214('0x4a')](config[_0x1214('0x4b')],_0x2c46f0,_[_0x1214('0x62')](_0x576a40[_0x1214('0x59')])):path['join'](config[_0x1214('0x4b')],_0x2c46f0,_[_0x1214('0x62')](_0x1214('0x63')));var _0x39552a=_0x1214('0x64')+_[_0x1214('0x65')]('logo');if(_0x576a40[_0x39552a]||!_0x501b0c[_0x1214('0x66')]){_0x5d2c27=path[_0x1214('0x4a')](config[_0x1214('0x4b')],_0x2c46f0,_['toLower']('default_logo.png'));}if(!fs[_0x1214('0x61')](_0x5d2c27)){throw new db['Sequelize'][(_0x1214('0x67'))](_0x1214('0x68'));}return _0x125e21[_0x1214('0x69')](_0x5d2c27);}})[_0x1214('0x18')](handleError(_0x125e21,null));};var utilLicense=require(_0x1214('0x6a'));exports[_0x1214('0x6b')]=function(_0x1409d0,_0x4c57be,_0x2d605d){var _0x482c0d=_0x1214('0x5c');var _0x24fd15={'custom':![]};return utilLicense[_0x1214('0x5d')]()['then'](function(_0x575bf0){if(_0x575bf0){_0x24fd15=_0x575bf0;}return db[_0x1214('0x3d')][_0x1214('0x46')]({'where':{'id':_0x1409d0[_0x1214('0x43')]['id']},'attributes':[_0x1214('0x59'),_0x1214('0x5e'),'defaultLogo',_0x1214('0x60')],'raw':!![]});})[_0x1214('0x24')](handleEntityNotFound(_0x4c57be,null))[_0x1214('0x24')](function(_0x4ef276){if(_0x4ef276){var _0x266b62=_0x4ef276[_0x1214('0x5e')]&&fs[_0x1214('0x61')](path[_0x1214('0x4a')](config[_0x1214('0x4b')],_0x482c0d,_['toLower'](_0x4ef276[_0x1214('0x5e')])))?path[_0x1214('0x4a')](config[_0x1214('0x4b')],_0x482c0d,_['toLower'](_0x4ef276[_0x1214('0x5e')])):path[_0x1214('0x4a')](config[_0x1214('0x4b')],_0x482c0d,_['toLower'](_0x1214('0x6c')));var _0x2c8caf=_0x1214('0x64')+_[_0x1214('0x65')]('loginLogo');if(_0x4ef276[_0x2c8caf]||!_0x24fd15[_0x1214('0x66')]){_0x266b62=path['join'](config[_0x1214('0x4b')],_0x482c0d,_['toLower']('default_loginLogo.png'));}if(!fs['existsSync'](_0x266b62)){throw new db['Sequelize'][(_0x1214('0x67'))](_0x1214('0x68'));}return _0x4c57be[_0x1214('0x69')](_0x266b62);}})[_0x1214('0x18')](handleError(_0x4c57be,null));};exports[_0x1214('0x6d')]=function(_0x189b23,_0x53e678){return db[_0x1214('0x3d')][_0x1214('0x46')]({'where':{'id':_0x189b23[_0x1214('0x43')]['id']},'attributes':[_0x1214('0x6e')]})[_0x1214('0x24')](respondWithResult(_0x53e678,null))[_0x1214('0x18')](handleError(_0x53e678,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 8bea8ff..295045a 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 _0x7f0e=['./setting.attributes','exports','define','Setting','settings','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3de4f8,_0x336c7d){var _0x3d81fc=function(_0x53b9f9){while(--_0x53b9f9){_0x3de4f8['push'](_0x3de4f8['shift']());}};_0x3d81fc(++_0x336c7d);}(_0x7f0e,0xd1));var _0xe7f0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7f0e[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xe7f0('0x0'));var util=require(_0xe7f0('0x1'));var logger=require(_0xe7f0('0x2'))(_0xe7f0('0x3'));var moment=require(_0xe7f0('0x4'));var BPromise=require(_0xe7f0('0x5'));var rp=require(_0xe7f0('0x6'));var attributes=require(_0xe7f0('0x7'));module[_0xe7f0('0x8')]=function(_0x527be5,_0x16f305){return _0x527be5[_0xe7f0('0x9')](_0xe7f0('0xa'),attributes,{'tableName':_0xe7f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x08b0=['bluebird','request-promise','./setting.attributes','exports','define','Setting','settings','lodash','util','api','moment'];(function(_0x1667df,_0x266940){var _0x341abf=function(_0x123c3f){while(--_0x123c3f){_0x1667df['push'](_0x1667df['shift']());}};_0x341abf(++_0x266940);}(_0x08b0,0x167));var _0x008b=function(_0x404eed,_0x5390c5){_0x404eed=_0x404eed-0x0;var _0xd45887=_0x08b0[_0x404eed];return _0xd45887;};'use strict';var _=require(_0x008b('0x0'));var util=require(_0x008b('0x1'));var logger=require('../../config/logger')(_0x008b('0x2'));var moment=require(_0x008b('0x3'));var BPromise=require(_0x008b('0x4'));var rp=require(_0x008b('0x5'));var attributes=require(_0x008b('0x6'));module[_0x008b('0x7')]=function(_0x267d8a,_0x3a753d){return _0x267d8a[_0x008b('0x8')](_0x008b('0x9'),attributes,{'tableName':_0x008b('0xa'),'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 3d53590..8c34ad1 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 _0x65e5=['request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x65e5,0x1bd));var _0x565e=function(_0x4d67a3,_0xc2783d){_0x4d67a3=_0x4d67a3-0x0;var _0x41a734=_0x65e5[_0x4d67a3];return _0x41a734;};'use strict';var _=require(_0x565e('0x0'));var util=require(_0x565e('0x1'));var moment=require(_0x565e('0x2'));var BPromise=require('bluebird');var rs=require(_0x565e('0x3'));var fs=require('fs');var db=require(_0x565e('0x4'))['db'];var utils=require(_0x565e('0x5'));var logger=require(_0x565e('0x6'))('rpc');var config=require(_0x565e('0x7'));var jayson=require(_0x565e('0x8'));var client=jayson[_0x565e('0x9')][_0x565e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42ac34,_0x1b7cc3,_0x25e306){return new BPromise(function(_0x17f150,_0x2b5209){return client[_0x565e('0xb')](_0x42ac34,_0x25e306)[_0x565e('0xc')](function(_0x1d71c1){logger[_0x565e('0xd')](_0x565e('0xe'),_0x1b7cc3,_0x565e('0xf'));logger['debug'](_0x565e('0x10'),_0x1b7cc3,_0x565e('0xf'),JSON[_0x565e('0x11')](_0x1d71c1));if(_0x1d71c1[_0x565e('0x12')]){if(_0x1d71c1[_0x565e('0x12')][_0x565e('0x13')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x1b7cc3,_0x1d71c1[_0x565e('0x12')][_0x565e('0x14')]);return _0x2b5209(_0x1d71c1['error']['message']);}logger[_0x565e('0x12')](_0x565e('0xe'),_0x1b7cc3,_0x1d71c1[_0x565e('0x12')]['message']);return _0x17f150(_0x1d71c1[_0x565e('0x12')][_0x565e('0x14')]);}else{logger[_0x565e('0xd')](_0x565e('0xe'),_0x1b7cc3,_0x565e('0xf'));_0x17f150(_0x1d71c1[_0x565e('0x15')][_0x565e('0x14')]);}})[_0x565e('0x16')](function(_0x562728){logger[_0x565e('0x12')](_0x565e('0xe'),_0x1b7cc3,_0x562728);_0x2b5209(_0x562728);});});} \ No newline at end of file +var _0xf210=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util'];(function(_0x103dff,_0x553816){var _0x3fedc6=function(_0x14debe){while(--_0x14debe){_0x103dff['push'](_0x103dff['shift']());}};_0x3fedc6(++_0x553816);}(_0xf210,0x11c));var _0x0f21=function(_0x3b2d23,_0x54caaf){_0x3b2d23=_0x3b2d23-0x0;var _0x38fb95=_0xf210[_0x3b2d23];return _0x38fb95;};'use strict';var _=require('lodash');var util=require(_0x0f21('0x0'));var moment=require('moment');var BPromise=require(_0x0f21('0x1'));var rs=require(_0x0f21('0x2'));var fs=require('fs');var db=require(_0x0f21('0x3'))['db'];var utils=require(_0x0f21('0x4'));var logger=require(_0x0f21('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0f21('0x6'));var client=jayson[_0x0f21('0x7')][_0x0f21('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x38ee22,_0xf87d16,_0x4dc55f){return new BPromise(function(_0x2866c3,_0x13c8fe){return client['request'](_0x38ee22,_0x4dc55f)[_0x0f21('0x9')](function(_0x46f798){logger[_0x0f21('0xa')](_0x0f21('0xb'),_0xf87d16,_0x0f21('0xc'));logger['debug'](_0x0f21('0xd'),_0xf87d16,_0x0f21('0xc'),JSON[_0x0f21('0xe')](_0x46f798));if(_0x46f798[_0x0f21('0xf')]){if(_0x46f798[_0x0f21('0xf')][_0x0f21('0x10')]===0x1f4){logger['error'](_0x0f21('0xb'),_0xf87d16,_0x46f798[_0x0f21('0xf')][_0x0f21('0x11')]);return _0x13c8fe(_0x46f798[_0x0f21('0xf')][_0x0f21('0x11')]);}logger[_0x0f21('0xf')](_0x0f21('0xb'),_0xf87d16,_0x46f798[_0x0f21('0xf')][_0x0f21('0x11')]);return _0x2866c3(_0x46f798[_0x0f21('0xf')]['message']);}else{logger[_0x0f21('0xa')]('Setting,\x20%s,\x20%s',_0xf87d16,_0x0f21('0xc'));_0x2866c3(_0x46f798[_0x0f21('0x12')][_0x0f21('0x11')]);}})['catch'](function(_0x51fe0f){logger[_0x0f21('0xf')](_0x0f21('0xb'),_0xf87d16,_0x51fe0f);_0x13c8fe(_0x51fe0f);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 22659f9..90695f8 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 _0x3cfb=['/:id/status','status','addAgents','put','update','destroy','delete','removeDispositions','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/users','post','addAnswer','/:id/notify','notify','/:id/send','send'];(function(_0x491f99,_0x178cd0){var _0xb10264=function(_0x63a0cf){while(--_0x63a0cf){_0x491f99['push'](_0x491f99['shift']());}};_0xb10264(++_0x178cd0);}(_0x3cfb,0x1b8));var _0xb3cf=function(_0x40a2ec,_0x53a4a2){_0x40a2ec=_0x40a2ec-0x0;var _0x1a35d9=_0x3cfb[_0x40a2ec];return _0x1a35d9;};'use strict';var multer=require(_0xb3cf('0x0'));var util=require(_0xb3cf('0x1'));var path=require(_0xb3cf('0x2'));var express=require(_0xb3cf('0x3'));var router=express[_0xb3cf('0x4')]();var auth=require(_0xb3cf('0x5'));var interaction=require(_0xb3cf('0x6'));var config=require(_0xb3cf('0x7'));var controller=require('./smsAccount.controller');router[_0xb3cf('0x8')]('/',auth[_0xb3cf('0x9')](),controller[_0xb3cf('0xa')]);router['get'](_0xb3cf('0xb'),auth[_0xb3cf('0x9')](),controller[_0xb3cf('0xc')]);router['get'](_0xb3cf('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xb3cf('0x8')](_0xb3cf('0xe'),auth[_0xb3cf('0x9')](),controller[_0xb3cf('0xf')]);router[_0xb3cf('0x8')](_0xb3cf('0x10'),auth[_0xb3cf('0x9')](),controller[_0xb3cf('0x11')]);router[_0xb3cf('0x8')](_0xb3cf('0x12'),auth[_0xb3cf('0x9')](),controller[_0xb3cf('0x13')]);router[_0xb3cf('0x8')](_0xb3cf('0x14'),auth[_0xb3cf('0x9')](),controller['getInteractions']);router['get'](_0xb3cf('0x15'),auth[_0xb3cf('0x9')](),controller['getAgents']);router[_0xb3cf('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb3cf('0x16')](_0xb3cf('0xe'),auth[_0xb3cf('0x9')](),controller['addDisposition']);router[_0xb3cf('0x16')](_0xb3cf('0x10'),auth[_0xb3cf('0x9')](),controller[_0xb3cf('0x17')]);router[_0xb3cf('0x16')](_0xb3cf('0x18'),controller[_0xb3cf('0x19')]);router[_0xb3cf('0x16')](_0xb3cf('0x12'),auth[_0xb3cf('0x9')](),controller['addApplications']);router[_0xb3cf('0x16')](_0xb3cf('0x1a'),auth[_0xb3cf('0x9')](),controller[_0xb3cf('0x1b')]);router['post'](_0xb3cf('0x1c'),controller[_0xb3cf('0x1d')]);router[_0xb3cf('0x16')](_0xb3cf('0x15'),auth[_0xb3cf('0x9')](),controller[_0xb3cf('0x1e')]);router[_0xb3cf('0x1f')](_0xb3cf('0xd'),auth[_0xb3cf('0x9')](),controller[_0xb3cf('0x20')]);router['delete'](_0xb3cf('0xd'),auth[_0xb3cf('0x9')](),controller[_0xb3cf('0x21')]);router[_0xb3cf('0x22')](_0xb3cf('0xe'),auth[_0xb3cf('0x9')](),controller[_0xb3cf('0x23')]);router[_0xb3cf('0x22')](_0xb3cf('0x10'),auth[_0xb3cf('0x9')](),controller['removeAnswers']);router[_0xb3cf('0x22')](_0xb3cf('0x15'),auth[_0xb3cf('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x26c2=['create','post','/:id/canned_answers','addAnswer','addApplications','send','/:id/status','status','addAgents','put','destroy','removeDispositions','delete','removeAnswers','removeAgents','exports','express','Router','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/users','getAgents'];(function(_0x38ec9b,_0x30d00e){var _0x209616=function(_0x316a17){while(--_0x316a17){_0x38ec9b['push'](_0x38ec9b['shift']());}};_0x209616(++_0x30d00e);}(_0x26c2,0x130));var _0x226c=function(_0x48fdab,_0x572359){_0x48fdab=_0x48fdab-0x0;var _0x3dd561=_0x26c2[_0x48fdab];return _0x3dd561;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0x226c('0x0'));var router=express[_0x226c('0x1')]();var auth=require(_0x226c('0x2'));var interaction=require(_0x226c('0x3'));var config=require('../../config/environment');var controller=require(_0x226c('0x4'));router[_0x226c('0x5')]('/',auth['isAuthenticated'](),controller[_0x226c('0x6')]);router[_0x226c('0x5')](_0x226c('0x7'),auth[_0x226c('0x8')](),controller[_0x226c('0x9')]);router['get'](_0x226c('0xa'),auth[_0x226c('0x8')](),controller[_0x226c('0xb')]);router[_0x226c('0x5')](_0x226c('0xc'),auth['isAuthenticated'](),controller[_0x226c('0xd')]);router[_0x226c('0x5')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x226c('0xe')]);router[_0x226c('0x5')](_0x226c('0xf'),auth[_0x226c('0x8')](),controller[_0x226c('0x10')]);router[_0x226c('0x5')](_0x226c('0x11'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x226c('0x5')](_0x226c('0x12'),auth[_0x226c('0x8')](),controller[_0x226c('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0x226c('0x14')]);router[_0x226c('0x15')](_0x226c('0xc'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x226c('0x15')](_0x226c('0x16'),auth[_0x226c('0x8')](),controller[_0x226c('0x17')]);router[_0x226c('0x15')]('/:id/notify',controller['notify']);router['post'](_0x226c('0xf'),auth[_0x226c('0x8')](),controller[_0x226c('0x18')]);router[_0x226c('0x15')]('/:id/send',auth[_0x226c('0x8')](),controller[_0x226c('0x19')]);router[_0x226c('0x15')](_0x226c('0x1a'),controller[_0x226c('0x1b')]);router[_0x226c('0x15')]('/:id/users',auth[_0x226c('0x8')](),controller[_0x226c('0x1c')]);router[_0x226c('0x1d')](_0x226c('0xa'),auth[_0x226c('0x8')](),controller['update']);router['delete']('/:id',auth[_0x226c('0x8')](),controller[_0x226c('0x1e')]);router['delete'](_0x226c('0xc'),auth[_0x226c('0x8')](),controller[_0x226c('0x1f')]);router[_0x226c('0x20')](_0x226c('0x16'),auth['isAuthenticated'](),controller[_0x226c('0x21')]);router['delete'](_0x226c('0x12'),auth['isAuthenticated'](),controller[_0x226c('0x22')]);module[_0x226c('0x23')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 696f4c6..22cbbf4 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 _0x5d34=['name','STRING','generate','ENUM','twilio','skebby','connectel','plivo','basic','classic','classic+','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','sequelize','randomstring','exports'];(function(_0x11d9b,_0x5d9d4b){var _0xa42641=function(_0x57ac64){while(--_0x57ac64){_0x11d9b['push'](_0x11d9b['shift']());}};_0xa42641(++_0x5d9d4b);}(_0x5d34,0x140));var _0x45d3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5d34[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x45d3('0x0'));var rs=require(_0x45d3('0x1'));module[_0x45d3('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x45d3('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x45d3('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x45d3('0x4')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x45d3('0x5')]();}},'phone':{'type':Sequelize[_0x45d3('0x4')]},'type':{'type':Sequelize[_0x45d3('0x6')](_0x45d3('0x7'),_0x45d3('0x8'),_0x45d3('0x9'),'clicksend',_0x45d3('0xa'))},'accountSid':{'type':Sequelize[_0x45d3('0x4')]},'authId':{'type':Sequelize[_0x45d3('0x4')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x45d3('0x6')](_0x45d3('0xb'),_0x45d3('0xc'),_0x45d3('0xd'))},'username':{'type':Sequelize[_0x45d3('0x4')]},'password':{'type':Sequelize[_0x45d3('0x4')]},'senderString':{'type':Sequelize[_0x45d3('0x4')]},'deliveryReport':{'type':Sequelize[_0x45d3('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x45d3('0x4')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x45d3('0xf');}},'notificationSound':{'type':Sequelize[_0x45d3('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x45d3('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x45d3('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x45d3('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x45d3('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x45d3('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x45d3('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c}}; \ No newline at end of file +var _0x073c=['sequelize','exports','STRING','generate','twilio','skebby','connectel','plivo','ENUM','basic','classic','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x073c,0xa5));var _0xc073=function(_0x57bec6,_0x6ba951){_0x57bec6=_0x57bec6-0x0;var _0x2103f8=_0x073c[_0x57bec6];return _0x2103f8;};'use strict';var Sequelize=require(_0xc073('0x0'));var rs=require('randomstring');module[_0xc073('0x1')]={'name':{'type':Sequelize[_0xc073('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xc073('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xc073('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xc073('0x3')]();}},'phone':{'type':Sequelize[_0xc073('0x2')]},'type':{'type':Sequelize['ENUM'](_0xc073('0x4'),_0xc073('0x5'),_0xc073('0x6'),'clicksend',_0xc073('0x7'))},'accountSid':{'type':Sequelize[_0xc073('0x2')]},'authId':{'type':Sequelize[_0xc073('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xc073('0x8')](_0xc073('0x9'),_0xc073('0xa'),'classic+')},'username':{'type':Sequelize[_0xc073('0x2')]},'password':{'type':Sequelize[_0xc073('0x2')]},'senderString':{'type':Sequelize[_0xc073('0x2')]},'deliveryReport':{'type':Sequelize[_0xc073('0xb')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xc073('0xc')],'defaultValue':function(){return _0xc073('0xd');}},'notificationSound':{'type':Sequelize[_0xc073('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc073('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc073('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc073('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc073('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc073('0xe')],'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 5b4f322..78574b6 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 _0xe665=['dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','DELIVERED','connectel','error_code','addAgents','spread','removeAgents','emit','userSmsAccount:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','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','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','sendStatus','name','SmsAccount','rawAttributes','model','dateStart','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','dateEnd','add','day','merge','filter','map','options','includeAll','include','findAll','rows','show','fields','find','create','body','params','describe','addDisposition','getDispositions','findOne','Disposition','SmsAccountId','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','mobile','type','from','From','messageId','skebby','sender','clicksend','message_id','plivo','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','Contacts','omit','defaults','CmContact','contact','SmsInteraction','interaction','created','push','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','send','sequelize','transaction','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','CmList','List','user','Messages'];(function(_0x5f2c9d,_0x15e841){var _0x47fdba=function(_0x140ba6){while(--_0x140ba6){_0x5f2c9d['push'](_0x5f2c9d['shift']());}};_0x47fdba(++_0x15e841);}(_0xe665,0xcd));var _0x5e66=function(_0x427037,_0x1bc0d6){_0x427037=_0x427037-0x0;var _0x2cb6a1=_0xe665[_0x427037];return _0x2cb6a1;};'use strict';var jsonpatch=require(_0x5e66('0x0'));var rp=require(_0x5e66('0x1'));var moment=require(_0x5e66('0x2'));var BPromise=require(_0x5e66('0x3'));var Mustache=require('mustache');var util=require(_0x5e66('0x4'));var path=require(_0x5e66('0x5'));var sox=require(_0x5e66('0x6'));var csv=require(_0x5e66('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5e66('0x8'));var squel=require(_0x5e66('0x9'));var crypto=require('crypto');var jsforce=require(_0x5e66('0xa'));var deskjs=require(_0x5e66('0xb'));var toCsv=require(_0x5e66('0x7'));var querystring=require(_0x5e66('0xc'));var Papa=require(_0x5e66('0xd'));var qs=require(_0x5e66('0xe'));var logger=require(_0x5e66('0xf'))(_0x5e66('0x10'));var utils=require('../../config/utils');var config=require(_0x5e66('0x11'));var db=require(_0x5e66('0x12'))['db'];var socket=require(_0x5e66('0x13'))({'host':_0x5e66('0x14'),'port':0x18eb});require(_0x5e66('0x15'))[_0x5e66('0x16')](socket);var jayson=require(_0x5e66('0x17'));var client=jayson[_0x5e66('0x18')][_0x5e66('0x19')]({'port':0x232c});function respondWithRpcPromise(_0x252461,_0x40a86b,_0x1c6ee4,_0x176a9f){return new BPromise(function(_0x5cd1a2,_0x35f312){var _0x43fe17=_0x176a9f||client;return _0x43fe17[_0x5e66('0x1a')](_0x252461,_0x1c6ee4)[_0x5e66('0x1b')](function(_0x56007e){logger[_0x5e66('0x1c')](_0x5e66('0x1d'),_0x40a86b,_0x5e66('0x1e'));logger[_0x5e66('0x1f')](_0x5e66('0x20'),_0x40a86b,'request\x20sent',JSON[_0x5e66('0x21')](_0x56007e));if(_0x56007e['error']){if(_0x56007e[_0x5e66('0x22')][_0x5e66('0x23')]===0x1f4){logger['error'](_0x5e66('0x1d'),_0x40a86b,_0x56007e['error'][_0x5e66('0x24')]);return _0x35f312(_0x56007e['error'][_0x5e66('0x24')]);}logger[_0x5e66('0x22')](_0x5e66('0x1d'),_0x40a86b,_0x56007e[_0x5e66('0x22')][_0x5e66('0x24')]);return _0x5cd1a2(_0x56007e[_0x5e66('0x22')][_0x5e66('0x24')]);}else{logger[_0x5e66('0x1c')](_0x5e66('0x1d'),_0x40a86b,_0x5e66('0x1e'));_0x5cd1a2(_0x56007e['result']['message']);}})[_0x5e66('0x25')](function(_0xdd810e){logger['error'](_0x5e66('0x1d'),_0x40a86b,_0xdd810e);_0x35f312(_0xdd810e);});});}function respondWithStatusCode(_0x4f1f39,_0x12221a){_0x12221a=_0x12221a||0xcc;return function(_0x1fc0c1){if(_0x1fc0c1){return _0x4f1f39['sendStatus'](_0x12221a);}return _0x4f1f39[_0x5e66('0x26')](_0x12221a)[_0x5e66('0x27')]();};}function respondWithResult(_0x4976d5,_0x50d06f){_0x50d06f=_0x50d06f||0xc8;return function(_0x2f5456){if(_0x2f5456){return _0x4976d5['status'](_0x50d06f)['json'](_0x2f5456);}};}function respondWithFilteredResult(_0x37f14b,_0x45a0cc){return function(_0x21b4b6){if(_0x21b4b6){var _0x4ecad4=_0x21b4b6[_0x5e66('0x28')],_0x3c3e04=_0x45a0cc[_0x5e66('0x29')],_0x385b29=_0x45a0cc[_0x5e66('0x29')]+_0x45a0cc[_0x5e66('0x2a')],_0x90c37b;if(_0x385b29>=_0x4ecad4){_0x385b29=_0x4ecad4;_0x90c37b=0xc8;}else{_0x90c37b=0xce;}_0x37f14b['status'](_0x90c37b);return _0x37f14b[_0x5e66('0x2b')](_0x5e66('0x2c'),_0x3c3e04+'-'+_0x385b29+'/'+_0x4ecad4)[_0x5e66('0x2d')](_0x21b4b6);}return null;};}function patchUpdates(_0x4eed59){return function(_0x3d48be){try{jsonpatch[_0x5e66('0x2e')](_0x3d48be,_0x4eed59,!![]);}catch(_0x3436ed){return BPromise['reject'](_0x3436ed);}return _0x3d48be[_0x5e66('0x2f')]();};}function saveUpdates(_0x130003,_0x299165){return function(_0x21bc17){if(_0x21bc17){return _0x21bc17[_0x5e66('0x30')](_0x130003)[_0x5e66('0x1b')](function(_0x3feb9f){return _0x3feb9f;});}return null;};}function removeEntity(_0x4c8f47,_0x30e87a){return function(_0x5725b4){if(_0x5725b4){return _0x5725b4[_0x5e66('0x31')]()['then'](function(){_0x4c8f47[_0x5e66('0x26')](0xcc)[_0x5e66('0x27')]();});}};}function handleEntityNotFound(_0x53d9dc,_0x36a9c3){return function(_0x3191fd){if(!_0x3191fd){_0x53d9dc[_0x5e66('0x32')](0x194);}return _0x3191fd;};}function handleError(_0x421d61,_0x1465c8){_0x1465c8=_0x1465c8||0x1f4;return function(_0x37d2c7){logger[_0x5e66('0x22')](_0x37d2c7['stack']);if(_0x37d2c7[_0x5e66('0x33')]){delete _0x37d2c7[_0x5e66('0x33')];}_0x421d61['status'](_0x1465c8)['send'](_0x37d2c7);};}exports['index']=function(_0x39cbce,_0x32421b){var _0xaffc04={},_0x350fba={},_0x21ad3f={'count':0x0,'rows':[]};var _0x158a8d=db[_0x5e66('0x34')][_0x5e66('0x35')];_0x350fba[_0x5e66('0x36')]=_['keys'](_0x158a8d);var _0x171289={'dateStart':_0x39cbce['query'][_0x5e66('0x37')],'dateEnd':_0x39cbce['query']['dateEnd']};delete _0x39cbce[_0x5e66('0x38')]['dateStart'];delete _0x39cbce[_0x5e66('0x38')]['dateEnd'];_0x350fba['query']=_[_0x5e66('0x39')](_0x39cbce[_0x5e66('0x38')]);_0x350fba['filters']=_[_0x5e66('0x3a')](_0x350fba[_0x5e66('0x36')],_0x350fba[_0x5e66('0x38')]);_0xaffc04['attributes']=_[_0x5e66('0x3a')](_0x350fba[_0x5e66('0x36')],qs['fields'](_0x39cbce[_0x5e66('0x38')]['fields']));_0xaffc04[_0x5e66('0x3b')]=_0xaffc04['attributes'][_0x5e66('0x3c')]?_0xaffc04[_0x5e66('0x3b')]:_0x350fba[_0x5e66('0x36')];if(!_0x39cbce[_0x5e66('0x38')][_0x5e66('0x3d')](_0x5e66('0x3e'))){_0xaffc04[_0x5e66('0x2a')]=qs[_0x5e66('0x2a')](_0x39cbce[_0x5e66('0x38')][_0x5e66('0x2a')]);_0xaffc04[_0x5e66('0x29')]=qs[_0x5e66('0x29')](_0x39cbce['query'][_0x5e66('0x29')]);}_0xaffc04[_0x5e66('0x3f')]=qs[_0x5e66('0x40')](_0x39cbce[_0x5e66('0x38')]['sort']);_0xaffc04[_0x5e66('0x41')]=qs['filters'](_[_0x5e66('0x42')](_0x39cbce['query'],_0x350fba[_0x5e66('0x43')]));if(_0x171289[_0x5e66('0x37')]){if(_0x171289['dateEnd']){_0x171289[_0x5e66('0x44')]=moment(_0x171289[_0x5e66('0x44')])[_0x5e66('0x45')](0x1,_0x5e66('0x46'));}else{_0x171289[_0x5e66('0x44')]=moment(_0x171289[_0x5e66('0x37')])[_0x5e66('0x45')](0x1,_0x5e66('0x46'));}_[_0x5e66('0x47')](_0xaffc04[_0x5e66('0x41')],{'createdAt':{'$gte':_0x171289['dateStart'],'$lte':_0x171289[_0x5e66('0x44')]}});}if(_0x39cbce[_0x5e66('0x38')][_0x5e66('0x48')]){_0xaffc04[_0x5e66('0x41')]=_[_0x5e66('0x47')](_0xaffc04[_0x5e66('0x41')],{'$or':_[_0x5e66('0x49')](_0xaffc04[_0x5e66('0x3b')],function(_0x59724b){var _0xecbc4e={};_0xecbc4e[_0x59724b]={'$like':'%'+_0x39cbce[_0x5e66('0x38')][_0x5e66('0x48')]+'%'};return _0xecbc4e;})});}_0xaffc04=_[_0x5e66('0x47')]({},_0xaffc04,_0x39cbce[_0x5e66('0x4a')]);var _0x36b488={'where':_0xaffc04[_0x5e66('0x41')]};return db[_0x5e66('0x34')][_0x5e66('0x28')](_0x36b488)[_0x5e66('0x1b')](function(_0x13c7fd){_0x21ad3f[_0x5e66('0x28')]=_0x13c7fd;if(_0x39cbce[_0x5e66('0x38')][_0x5e66('0x4b')]){_0xaffc04[_0x5e66('0x4c')]=[{'all':!![]}];}return db[_0x5e66('0x34')][_0x5e66('0x4d')](_0xaffc04);})[_0x5e66('0x1b')](function(_0x688609){_0x21ad3f[_0x5e66('0x4e')]=_0x688609;return _0x21ad3f;})[_0x5e66('0x1b')](respondWithFilteredResult(_0x32421b,_0xaffc04))[_0x5e66('0x25')](handleError(_0x32421b,null));};exports[_0x5e66('0x4f')]=function(_0xea88e5,_0x5a86d8){var _0x276cb5={'raw':![],'where':{'id':_0xea88e5['params']['id']}},_0x5a95dd={};_0x5a95dd['model']=_[_0x5e66('0x39')](db[_0x5e66('0x34')][_0x5e66('0x35')]);_0x5a95dd[_0x5e66('0x38')]=_[_0x5e66('0x39')](_0xea88e5[_0x5e66('0x38')]);_0x5a95dd['filters']=_[_0x5e66('0x3a')](_0x5a95dd[_0x5e66('0x36')],_0x5a95dd[_0x5e66('0x38')]);_0x276cb5[_0x5e66('0x3b')]=_[_0x5e66('0x3a')](_0x5a95dd[_0x5e66('0x36')],qs[_0x5e66('0x50')](_0xea88e5[_0x5e66('0x38')][_0x5e66('0x50')]));_0x276cb5['attributes']=_0x276cb5[_0x5e66('0x3b')][_0x5e66('0x3c')]?_0x276cb5['attributes']:_0x5a95dd['model'];if(_0xea88e5[_0x5e66('0x38')][_0x5e66('0x4b')]){_0x276cb5[_0x5e66('0x4c')]=[{'all':!![]}];}_0x276cb5=_['merge']({},_0x276cb5,_0xea88e5[_0x5e66('0x4a')]);return db[_0x5e66('0x34')][_0x5e66('0x51')](_0x276cb5)[_0x5e66('0x1b')](handleEntityNotFound(_0x5a86d8,null))[_0x5e66('0x1b')](respondWithResult(_0x5a86d8,null))[_0x5e66('0x25')](handleError(_0x5a86d8,null));};exports[_0x5e66('0x52')]=function(_0x48b80a,_0xe2f644){return db['SmsAccount'][_0x5e66('0x52')](_0x48b80a[_0x5e66('0x53')],{})[_0x5e66('0x1b')](respondWithResult(_0xe2f644,0xc9))['catch'](handleError(_0xe2f644,null));};exports[_0x5e66('0x30')]=function(_0x9eb41a,_0x171e64){if(_0x9eb41a[_0x5e66('0x53')]['id']){delete _0x9eb41a['body']['id'];}return db[_0x5e66('0x34')][_0x5e66('0x51')]({'where':{'id':_0x9eb41a[_0x5e66('0x54')]['id']}})[_0x5e66('0x1b')](handleEntityNotFound(_0x171e64,null))[_0x5e66('0x1b')](saveUpdates(_0x9eb41a[_0x5e66('0x53')],null))[_0x5e66('0x1b')](respondWithResult(_0x171e64,null))[_0x5e66('0x25')](handleError(_0x171e64,null));};exports[_0x5e66('0x31')]=function(_0x573090,_0x398e64){return db['SmsAccount'][_0x5e66('0x51')]({'where':{'id':_0x573090[_0x5e66('0x54')]['id']}})[_0x5e66('0x1b')](handleEntityNotFound(_0x398e64,null))[_0x5e66('0x1b')](removeEntity(_0x398e64,null))[_0x5e66('0x25')](handleError(_0x398e64,null));};exports[_0x5e66('0x55')]=function(_0x4c171f,_0x552b00){return db['SmsAccount']['describe']()[_0x5e66('0x1b')](respondWithResult(_0x552b00,null))[_0x5e66('0x25')](handleError(_0x552b00,null));};exports[_0x5e66('0x56')]=function(_0x539a55,_0x12066b,_0x2bd8a8){if(_0x539a55[_0x5e66('0x53')]['id']){delete _0x539a55[_0x5e66('0x53')]['id'];}return db[_0x5e66('0x34')][_0x5e66('0x51')]({'where':{'id':_0x539a55[_0x5e66('0x54')]['id']}})[_0x5e66('0x1b')](handleEntityNotFound(_0x12066b,null))['then'](function(_0x9cc7f9){if(_0x9cc7f9){_0x539a55[_0x5e66('0x53')]['SmsAccountId']=_0x9cc7f9['id'];return db['Disposition'][_0x5e66('0x52')](_0x539a55[_0x5e66('0x53')]);}})['then'](respondWithResult(_0x12066b,null))[_0x5e66('0x25')](handleError(_0x12066b,null));};exports[_0x5e66('0x57')]=function(_0x54c2c2,_0x532a92,_0x12e324){var _0x25e54e={'raw':![],'where':{}};var _0x286360={};var _0x5a80ba={'count':0x0,'rows':[]};return db['SmsAccount'][_0x5e66('0x58')]({'where':{'id':_0x54c2c2[_0x5e66('0x54')]['id']}})[_0x5e66('0x1b')](handleEntityNotFound(_0x532a92,null))[_0x5e66('0x1b')](function(_0x514f36){if(_0x514f36){_0x286360[_0x5e66('0x36')]=_[_0x5e66('0x39')](db[_0x5e66('0x59')][_0x5e66('0x35')]);_0x286360['query']=_['keys'](_0x54c2c2['query']);_0x286360[_0x5e66('0x43')]=_[_0x5e66('0x3a')](_0x286360[_0x5e66('0x36')],_0x286360[_0x5e66('0x38')]);_0x25e54e[_0x5e66('0x3b')]=_['intersection'](_0x286360[_0x5e66('0x36')],qs['fields'](_0x54c2c2[_0x5e66('0x38')][_0x5e66('0x50')]));_0x25e54e[_0x5e66('0x3b')]=_0x25e54e[_0x5e66('0x3b')][_0x5e66('0x3c')]?_0x25e54e[_0x5e66('0x3b')]:_0x286360[_0x5e66('0x36')];if(!_0x54c2c2[_0x5e66('0x38')][_0x5e66('0x3d')](_0x5e66('0x3e'))){_0x25e54e['limit']=qs[_0x5e66('0x2a')](_0x54c2c2[_0x5e66('0x38')][_0x5e66('0x2a')]);_0x25e54e['offset']=qs[_0x5e66('0x29')](_0x54c2c2[_0x5e66('0x38')][_0x5e66('0x29')]);}_0x25e54e[_0x5e66('0x3f')]=qs[_0x5e66('0x40')](_0x54c2c2[_0x5e66('0x38')]['sort']);_0x25e54e[_0x5e66('0x41')]=qs[_0x5e66('0x43')](_[_0x5e66('0x42')](_0x54c2c2[_0x5e66('0x38')],_0x286360[_0x5e66('0x43')]));_0x25e54e[_0x5e66('0x41')][_0x5e66('0x5a')]=_0x514f36['id'];if(_0x54c2c2['query'][_0x5e66('0x48')]){_0x25e54e[_0x5e66('0x41')]=_['merge'](_0x25e54e[_0x5e66('0x41')],{'$or':_[_0x5e66('0x49')](_0x25e54e[_0x5e66('0x3b')],function(_0x170070){var _0x30ffe8={};_0x30ffe8[_0x170070]={'$like':'%'+_0x54c2c2[_0x5e66('0x38')][_0x5e66('0x48')]+'%'};return _0x30ffe8;})});}_0x25e54e=_[_0x5e66('0x47')]({},_0x25e54e,_0x54c2c2['options']);return db['Disposition']['count']({'where':_0x25e54e[_0x5e66('0x41')]})[_0x5e66('0x1b')](function(_0x350b27){_0x5a80ba['count']=_0x350b27;if(_0x54c2c2['query'][_0x5e66('0x4b')]){_0x25e54e[_0x5e66('0x4c')]=[{'all':!![]}];}return db[_0x5e66('0x59')]['findAll'](_0x25e54e);})[_0x5e66('0x1b')](function(_0x221d52){_0x5a80ba[_0x5e66('0x4e')]=_0x221d52;return _0x5a80ba;});}})[_0x5e66('0x1b')](respondWithFilteredResult(_0x532a92,_0x25e54e))[_0x5e66('0x25')](handleError(_0x532a92,null));};exports[_0x5e66('0x5b')]=function(_0x13684b,_0x5a4e80,_0x3777a5){var _0x327946;return db[_0x5e66('0x34')][_0x5e66('0x51')]({'where':{'id':_0x13684b[_0x5e66('0x54')]['id']}})[_0x5e66('0x1b')](handleEntityNotFound(_0x5a4e80,null))[_0x5e66('0x1b')](function(_0x2eee2e){if(_0x2eee2e){return _0x2eee2e['removeDispositions'](_0x13684b[_0x5e66('0x38')][_0x5e66('0x5c')]);}})[_0x5e66('0x1b')](respondWithStatusCode(_0x5a4e80,null))[_0x5e66('0x25')](handleError(_0x5a4e80,null));};exports['addAnswer']=function(_0x118ecf,_0x591684,_0x43b8df){if(_0x118ecf['body']['id']){delete _0x118ecf['body']['id'];}return db[_0x5e66('0x34')]['find']({'where':{'id':_0x118ecf[_0x5e66('0x54')]['id']}})[_0x5e66('0x1b')](handleEntityNotFound(_0x591684,null))['then'](function(_0x21b9af){if(_0x21b9af){_0x118ecf[_0x5e66('0x53')][_0x5e66('0x5a')]=_0x21b9af['id'];return db[_0x5e66('0x5d')][_0x5e66('0x52')](_0x118ecf[_0x5e66('0x53')]);}})['then'](respondWithResult(_0x591684,null))[_0x5e66('0x25')](handleError(_0x591684,null));};exports[_0x5e66('0x5e')]=function(_0x1847a6,_0x4b271e,_0x39e066){var _0x45238c={'raw':![],'where':{}};var _0x4c8714={};var _0x1e700e={'count':0x0,'rows':[]};return db[_0x5e66('0x34')][_0x5e66('0x58')]({'where':{'id':_0x1847a6[_0x5e66('0x54')]['id']}})[_0x5e66('0x1b')](handleEntityNotFound(_0x4b271e,null))[_0x5e66('0x1b')](function(_0x19becf){if(_0x19becf){_0x4c8714[_0x5e66('0x36')]=_['keys'](db['CannedAnswer'][_0x5e66('0x35')]);_0x4c8714[_0x5e66('0x38')]=_[_0x5e66('0x39')](_0x1847a6[_0x5e66('0x38')]);_0x4c8714[_0x5e66('0x43')]=_[_0x5e66('0x3a')](_0x4c8714[_0x5e66('0x36')],_0x4c8714[_0x5e66('0x38')]);_0x45238c[_0x5e66('0x3b')]=_['intersection'](_0x4c8714[_0x5e66('0x36')],qs[_0x5e66('0x50')](_0x1847a6[_0x5e66('0x38')]['fields']));_0x45238c['attributes']=_0x45238c[_0x5e66('0x3b')][_0x5e66('0x3c')]?_0x45238c[_0x5e66('0x3b')]:_0x4c8714[_0x5e66('0x36')];if(!_0x1847a6[_0x5e66('0x38')][_0x5e66('0x3d')](_0x5e66('0x3e'))){_0x45238c['limit']=qs[_0x5e66('0x2a')](_0x1847a6[_0x5e66('0x38')][_0x5e66('0x2a')]);_0x45238c[_0x5e66('0x29')]=qs['offset'](_0x1847a6[_0x5e66('0x38')]['offset']);}_0x45238c[_0x5e66('0x3f')]=qs[_0x5e66('0x40')](_0x1847a6[_0x5e66('0x38')]['sort']);_0x45238c['where']=qs[_0x5e66('0x43')](_[_0x5e66('0x42')](_0x1847a6[_0x5e66('0x38')],_0x4c8714[_0x5e66('0x43')]));_0x45238c[_0x5e66('0x41')][_0x5e66('0x5a')]=_0x19becf['id'];if(_0x1847a6[_0x5e66('0x38')]['filter']){_0x45238c[_0x5e66('0x41')]=_[_0x5e66('0x47')](_0x45238c[_0x5e66('0x41')],{'$or':_[_0x5e66('0x49')](_0x45238c[_0x5e66('0x3b')],function(_0x1ec810){var _0x347c4b={};_0x347c4b[_0x1ec810]={'$like':'%'+_0x1847a6[_0x5e66('0x38')][_0x5e66('0x48')]+'%'};return _0x347c4b;})});}_0x45238c=_[_0x5e66('0x47')]({},_0x45238c,_0x1847a6['options']);return db[_0x5e66('0x5d')]['count']({'where':_0x45238c[_0x5e66('0x41')]})['then'](function(_0x5d4299){_0x1e700e[_0x5e66('0x28')]=_0x5d4299;if(_0x1847a6[_0x5e66('0x38')][_0x5e66('0x4b')]){_0x45238c[_0x5e66('0x4c')]=[{'all':!![]}];}return db[_0x5e66('0x5d')][_0x5e66('0x4d')](_0x45238c);})[_0x5e66('0x1b')](function(_0xc4c13f){_0x1e700e['rows']=_0xc4c13f;return _0x1e700e;});}})[_0x5e66('0x1b')](respondWithFilteredResult(_0x4b271e,_0x45238c))[_0x5e66('0x25')](handleError(_0x4b271e,null));};exports[_0x5e66('0x5f')]=function(_0x14e581,_0x3538b9,_0x32faa0){var _0x22fc0f;return db['SmsAccount'][_0x5e66('0x51')]({'where':{'id':_0x14e581[_0x5e66('0x54')]['id']}})['then'](handleEntityNotFound(_0x3538b9,null))[_0x5e66('0x1b')](function(_0x3a5cfe){if(_0x3a5cfe){return _0x3a5cfe['removeAnswers'](_0x14e581[_0x5e66('0x38')][_0x5e66('0x5c')]);}})['then'](respondWithStatusCode(_0x3538b9,null))[_0x5e66('0x25')](handleError(_0x3538b9,null));};exports[_0x5e66('0x60')]=function(_0x47884c,_0x87ac2e,_0x4771ae){var _0x2f8dc5={'channel':_0x5e66('0x61')};var _0x48afb0=[];var _0x581aff=[];var _0x46acd4={};return db[_0x5e66('0x34')][_0x5e66('0x51')]({'where':{'id':_0x47884c[_0x5e66('0x54')]['id']},'include':[{'model':db[_0x5e66('0x62')],'as':_0x5e66('0x63')}]})['then'](handleEntityNotFound(_0x87ac2e,null))[_0x5e66('0x1b')](function(_0x4447a5){_0x2f8dc5[_0x5e66('0x64')]=_0x4447a5;_0x2f8dc5[_0x5e66('0x65')]=_[_0x5e66('0x66')](_0x4447a5[_0x5e66('0x63')],['priority'],[_0x5e66('0x67')]);if(_0x2f8dc5[_0x5e66('0x64')]['Applications']){delete _0x2f8dc5['account'][_0x5e66('0x63')];}return db['CmContact'][_0x5e66('0x55')]();})[_0x5e66('0x1b')](function(_0x258108){if(!_0x258108){throw new db[(_0x5e66('0x68'))][(_0x5e66('0x69'))](_0x5e66('0x6a'));}_0x48afb0=_[_0x5e66('0x6b')](_['keys'](_0x258108),[_0x5e66('0x6c'),'updatedAt']);_0x581aff=_[_0x5e66('0x6b')](_[_0x5e66('0x39')](_0x258108),[_0x5e66('0x6c'),_0x5e66('0x6d'),'CompanyId','ListId']);_0x2f8dc5[_0x5e66('0x53')]={'mapKey':_0x5e66('0x6e')};if(_0x2f8dc5['account'][_0x5e66('0x6f')]){switch(_0x2f8dc5[_0x5e66('0x64')][_0x5e66('0x6f')]){case'twilio':_0x2f8dc5[_0x5e66('0x53')][_0x5e66('0x70')]=_0x47884c[_0x5e66('0x53')][_0x5e66('0x71')];_0x2f8dc5['body']['body']=_0x47884c['body']['Body'];_0x2f8dc5[_0x5e66('0x53')][_0x5e66('0x72')]=_0x47884c['body']['MessageSid'];break;case _0x5e66('0x73'):_0x2f8dc5[_0x5e66('0x53')][_0x5e66('0x70')]=_0x47884c[_0x5e66('0x53')][_0x5e66('0x74')];_0x2f8dc5['body']['body']=_0x47884c[_0x5e66('0x53')]['text'];break;case'connectel':_0x2f8dc5[_0x5e66('0x53')][_0x5e66('0x70')]=_0x47884c[_0x5e66('0x53')]['from'];_0x2f8dc5[_0x5e66('0x53')]['body']=_0x47884c['body'][_0x5e66('0x24')];break;case _0x5e66('0x75'):_0x2f8dc5[_0x5e66('0x53')][_0x5e66('0x70')]=_0x47884c[_0x5e66('0x53')][_0x5e66('0x70')];_0x2f8dc5[_0x5e66('0x53')][_0x5e66('0x53')]=_0x47884c[_0x5e66('0x53')]['body'];_0x2f8dc5[_0x5e66('0x53')][_0x5e66('0x72')]=_0x47884c[_0x5e66('0x53')][_0x5e66('0x76')];break;case _0x5e66('0x77'):_0x2f8dc5[_0x5e66('0x53')][_0x5e66('0x70')]=_0x47884c[_0x5e66('0x53')][_0x5e66('0x71')];_0x2f8dc5[_0x5e66('0x53')]['body']=_0x47884c[_0x5e66('0x53')]['Text'];_0x2f8dc5[_0x5e66('0x53')][_0x5e66('0x72')]=_0x47884c[_0x5e66('0x53')]['MessageUUID'];break;}}if(_0x2f8dc5[_0x5e66('0x53')]['id']){delete _0x2f8dc5[_0x5e66('0x53')]['id'];}if(_[_0x5e66('0x78')](_0x2f8dc5[_0x5e66('0x53')][_0x5e66('0x70')])){throw new db[(_0x5e66('0x68'))][(_0x5e66('0x69'))](_0x5e66('0x79'));}if(_[_0x5e66('0x78')](_0x2f8dc5[_0x5e66('0x53')]['body'])||_0x2f8dc5[_0x5e66('0x53')][_0x5e66('0x53')]===''){throw new db['Sequelize'][(_0x5e66('0x69'))](_0x5e66('0x7a'));}if(_[_0x5e66('0x78')](_0x2f8dc5[_0x5e66('0x53')]['mapKey'])){throw new db['Sequelize'][(_0x5e66('0x69'))](_0x5e66('0x7b')+_0x581aff);}if(!_[_0x5e66('0x7c')](_0x581aff,_0x2f8dc5['body'][_0x5e66('0x7d')])){throw new db[(_0x5e66('0x68'))][(_0x5e66('0x69'))](_0x5e66('0x7e')+_0x581aff);}_0x46acd4[_0x2f8dc5['body']['mapKey']]=_0x2f8dc5[_0x5e66('0x53')][_0x5e66('0x70')];return db['CmList']['find']({'where':{'id':_0x2f8dc5[_0x5e66('0x64')][_0x5e66('0x7f')]},'include':[{'model':db['CmContact'],'as':_0x5e66('0x80'),'where':_0x46acd4,'limit':0x1,'order':[[_0x5e66('0x6d'),'DESC']]}]});})[_0x5e66('0x1b')](handleEntityNotFound(_0x87ac2e,null))[_0x5e66('0x1b')](function(_0x5d2ce1){if(_0x5d2ce1){_0x2f8dc5['list']=_[_0x5e66('0x81')](_0x5d2ce1,[_0x5e66('0x80')]);if(_0x5d2ce1[_0x5e66('0x80')]['length']){return _0x5d2ce1[_0x5e66('0x80')][0x0];}var _0x142f13=_[_0x5e66('0x82')](_0x2f8dc5[_0x5e66('0x53')],{'firstName':_0x2f8dc5[_0x5e66('0x53')]['from'],'ListId':_0x5d2ce1['id']});_0x142f13[_0x2f8dc5[_0x5e66('0x53')]['mapKey']]=_0x2f8dc5['body'][_0x5e66('0x70')];return db[_0x5e66('0x83')]['create'](_0x142f13,{'fields':_0x48afb0,'raw':!![]});}})['then'](handleEntityNotFound(_0x87ac2e,null))[_0x5e66('0x1b')](function(_0x9306c7){if(_0x9306c7){_0x2f8dc5[_0x5e66('0x84')]=_0x9306c7;var _0xd3d203={'ContactId':_0x9306c7['id'],'phone':_0x2f8dc5[_0x5e66('0x53')]['from'],'SmsAccountId':_0x47884c['params']['id']};var _0x2fe79b={'ContactId':_0x9306c7['id'],'SmsAccountId':_0x47884c[_0x5e66('0x54')]['id'],'closed':![]};return db[_0x5e66('0x85')][_0x5e66('0x51')]({'where':_0x2fe79b})[_0x5e66('0x1b')](function(_0x5b05c8){if(_0x5b05c8){return[_0x5b05c8,![]];}return db['SmsInteraction'][_0x5e66('0x52')](_0xd3d203)[_0x5e66('0x1b')](function(_0x1ba2ec){return[_0x1ba2ec,!![]];});});}})['spread'](function(_0x2684f0,_0x4013c5){_0x2f8dc5['interaction']=_0x2684f0['get']({'plain':!![]});_0x2f8dc5[_0x5e66('0x86')][_0x5e66('0x87')]=![];if(_0x4013c5){if(_0x2f8dc5[_0x5e66('0x64')]['autoclose']){_0x2f8dc5[_0x5e66('0x65')][_0x5e66('0x88')]({'id':0x0,'priority':_0x2f8dc5['applications'][_0x5e66('0x3c')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x5e66('0x89')});}_0x2f8dc5[_0x5e66('0x86')]['created']=!![];}return db[_0x5e66('0x8a')]['create']({'phone':_0x2f8dc5[_0x5e66('0x53')]['from'],'messageId':_0x2f8dc5['body'][_0x5e66('0x72')],'body':_0x2f8dc5[_0x5e66('0x53')]['body'],'SmsAccountId':_0x47884c[_0x5e66('0x54')]['id'],'SmsInteractionId':_0x2684f0['id'],'direction':'in','ContactId':_0x2684f0[_0x5e66('0x8b')],'AttachmentId':_0x2f8dc5['body'][_0x5e66('0x8c')]});})[_0x5e66('0x1b')](function(_0x545dcb){_0x2f8dc5[_0x5e66('0x24')]=_0x545dcb;if(_0x2f8dc5[_0x5e66('0x86')][_0x5e66('0x8d')]){return db['User'][_0x5e66('0x51')]({'attributes':['id','name'],'where':{'id':_0x2f8dc5['interaction'][_0x5e66('0x8d')]}})[_0x5e66('0x1b')](function(_0x4576c6){if(_0x4576c6){_0x2f8dc5['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x5e66('0x8e'),'appdata':_0x4576c6[_0x5e66('0x33')]+','+(_0x2f8dc5[_0x5e66('0x64')][_0x5e66('0x8f')]||0xa),'interval':_0x5e66('0x89')});}return respondWithRpcPromise(_0x5e66('0x90'),'startRouting',_0x2f8dc5);});}return respondWithRpcPromise(_0x5e66('0x90'),_0x5e66('0x91'),_0x2f8dc5);})['then'](function(_0x34291b){if(_0x34291b){var _0x39b41e=0xc8;var _0x4ae6d6=_0x5e66('0x92');logger[_0x5e66('0x1c')](_0x5e66('0x20'),_0x4ae6d6,_0x39b41e,_0x5e66('0x93'));logger[_0x5e66('0x1f')](_0x5e66('0x94'),_0x4ae6d6,_0x39b41e,_0x5e66('0x93'),JSON[_0x5e66('0x21')](_0x34291b));if(_0x2f8dc5[_0x5e66('0x64')][_0x5e66('0x6f')]===_0x5e66('0x95')){return _0x87ac2e[_0x5e66('0x26')](_0x39b41e)[_0x5e66('0x2b')](_0x5e66('0x96'),_0x5e66('0x97'))[_0x5e66('0x98')]('\x0a');}else{return _0x87ac2e[_0x5e66('0x26')](_0x39b41e)[_0x5e66('0x2d')](_0x34291b);}}})[_0x5e66('0x25')](handleError(_0x87ac2e,null));};exports['addApplications']=function(_0x3d080d,_0x37e0ae,_0x3b67ec){return db[_0x5e66('0x34')][_0x5e66('0x58')]({'where':{'id':_0x3d080d[_0x5e66('0x54')]['id']}})['then'](handleEntityNotFound(_0x37e0ae,null))[_0x5e66('0x1b')](function(_0x20117d){if(_0x20117d){return db[_0x5e66('0x99')][_0x5e66('0x9a')](function(_0x325d09){return db[_0x5e66('0x62')][_0x5e66('0x31')]({'where':{'SmsAccountId':_0x3d080d[_0x5e66('0x54')]['id']},'transaction':_0x325d09})[_0x5e66('0x1b')](function(_0x59343a){var _0x114a3a=_[_0x5e66('0x49')](_0x3d080d[_0x5e66('0x53')],function(_0x3b6080){_0x3b6080[_0x5e66('0x5a')]=_0x3d080d[_0x5e66('0x54')]['id'];return _0x3b6080;});return db[_0x5e66('0x62')][_0x5e66('0x9b')](_0x114a3a,{'transaction':_0x325d09});});})[_0x5e66('0x1b')](function(){return db[_0x5e66('0x62')][_0x5e66('0x9c')]({'where':{'SmsAccountId':_0x3d080d[_0x5e66('0x54')]['id']},'order':_0x5e66('0x9d')});});}})['then'](respondWithResult(_0x37e0ae,null))[_0x5e66('0x25')](handleError(_0x37e0ae,null));};exports[_0x5e66('0x9e')]=function(_0x42e130,_0x47ce3a,_0x24ff9b){var _0x39d512={};var _0x41a42a={};var _0x11a03e;var _0x34a232;return db[_0x5e66('0x34')][_0x5e66('0x58')]({'where':{'id':_0x42e130[_0x5e66('0x54')]['id']}})[_0x5e66('0x1b')](handleEntityNotFound(_0x47ce3a,null))[_0x5e66('0x1b')](function(_0x4725bc){if(_0x4725bc){_0x11a03e=_0x4725bc;_0x41a42a[_0x5e66('0x36')]=_[_0x5e66('0x39')](db[_0x5e66('0x62')][_0x5e66('0x35')]);_0x41a42a[_0x5e66('0x38')]=_[_0x5e66('0x39')](_0x42e130[_0x5e66('0x38')]);_0x41a42a[_0x5e66('0x43')]=_[_0x5e66('0x3a')](_0x41a42a[_0x5e66('0x36')],_0x41a42a[_0x5e66('0x38')]);_0x39d512[_0x5e66('0x3b')]=_['intersection'](_0x41a42a[_0x5e66('0x36')],qs[_0x5e66('0x50')](_0x42e130[_0x5e66('0x38')][_0x5e66('0x50')]));_0x39d512[_0x5e66('0x3b')]=_0x39d512[_0x5e66('0x3b')][_0x5e66('0x3c')]?_0x39d512[_0x5e66('0x3b')]:_0x41a42a[_0x5e66('0x36')];_0x39d512[_0x5e66('0x3f')]=qs[_0x5e66('0x40')](_0x42e130['query']['sort']);_0x39d512[_0x5e66('0x41')]=qs[_0x5e66('0x43')](_[_0x5e66('0x42')](_0x42e130[_0x5e66('0x38')],_0x41a42a['filters']));if(_0x42e130[_0x5e66('0x38')]['filter']){_0x39d512[_0x5e66('0x41')]=_['merge'](_0x39d512[_0x5e66('0x41')],{'$or':_[_0x5e66('0x49')](_0x39d512[_0x5e66('0x3b')],function(_0x5b7fe0){var _0x761582={};_0x761582[_0x5b7fe0]={'$like':'%'+_0x42e130[_0x5e66('0x38')][_0x5e66('0x48')]+'%'};return _0x761582;})});}_0x39d512=_[_0x5e66('0x47')]({},_0x39d512,_0x42e130['options']);return _0x11a03e[_0x5e66('0x9e')](_0x39d512);}})[_0x5e66('0x1b')](function(_0x1f6f72){if(_0x1f6f72){_0x34a232=_0x1f6f72[_0x5e66('0x3c')];if(!_0x42e130[_0x5e66('0x38')][_0x5e66('0x3d')](_0x5e66('0x3e'))){_0x39d512[_0x5e66('0x2a')]=qs['limit'](_0x42e130[_0x5e66('0x38')][_0x5e66('0x2a')]);_0x39d512[_0x5e66('0x29')]=qs[_0x5e66('0x29')](_0x42e130['query'][_0x5e66('0x29')]);}return _0x11a03e['getApplications'](_0x39d512);}})[_0x5e66('0x1b')](function(_0x1c1b6c){if(_0x1c1b6c){return _0x1c1b6c?{'count':_0x34a232,'rows':_0x1c1b6c}:null;}})[_0x5e66('0x1b')](respondWithResult(_0x47ce3a,null))[_0x5e66('0x25')](handleError(_0x47ce3a,null));};exports[_0x5e66('0x9f')]=function(_0x4988e7,_0x3efd24,_0x1d43ae){var _0x1f937f={'raw':![],'where':{}};var _0x41d460={};var _0x19e10a={'count':0x0,'rows':[]};return db[_0x5e66('0x34')][_0x5e66('0x58')]({'where':{'id':_0x4988e7[_0x5e66('0x54')]['id']}})['then'](handleEntityNotFound(_0x3efd24,null))['then'](function(_0x3a579f){if(_0x3a579f){_0x41d460[_0x5e66('0x36')]=_[_0x5e66('0x39')](db['SmsInteraction'][_0x5e66('0x35')]);_0x41d460['query']=_['keys'](_0x4988e7[_0x5e66('0x38')]);_0x41d460['filters']=_['intersection'](_0x41d460[_0x5e66('0x36')],_0x41d460[_0x5e66('0x38')]);_0x1f937f[_0x5e66('0x3b')]=_['intersection'](_0x41d460[_0x5e66('0x36')],qs[_0x5e66('0x50')](_0x4988e7[_0x5e66('0x38')]['fields']));_0x1f937f[_0x5e66('0x3b')]=_0x1f937f[_0x5e66('0x3b')][_0x5e66('0x3c')]?_0x1f937f[_0x5e66('0x3b')]:_0x41d460[_0x5e66('0x36')];if(!_0x4988e7[_0x5e66('0x38')][_0x5e66('0x3d')](_0x5e66('0x3e'))){_0x1f937f[_0x5e66('0x2a')]=qs['limit'](_0x4988e7[_0x5e66('0x38')][_0x5e66('0x2a')]);_0x1f937f[_0x5e66('0x29')]=qs[_0x5e66('0x29')](_0x4988e7[_0x5e66('0x38')][_0x5e66('0x29')]);}_0x1f937f[_0x5e66('0x3f')]=qs[_0x5e66('0x40')](_0x4988e7['query'][_0x5e66('0x40')]);_0x1f937f[_0x5e66('0x41')]=qs[_0x5e66('0x43')](_['pick'](_0x4988e7['query'],_0x41d460[_0x5e66('0x43')]));_0x1f937f[_0x5e66('0x41')]['SmsAccountId']=_0x3a579f['id'];if(_0x4988e7[_0x5e66('0x38')]['filter']){_0x1f937f[_0x5e66('0x41')]=_['merge'](_0x1f937f['where'],{'$or':_['map'](_0x1f937f['attributes'],function(_0x289c9e){var _0x524a1f={};_0x524a1f[_0x289c9e]={'$like':'%'+_0x4988e7[_0x5e66('0x38')]['filter']+'%'};return _0x524a1f;})});}_0x1f937f=_[_0x5e66('0x47')]({},_0x1f937f,_0x4988e7[_0x5e66('0x4a')]);return db[_0x5e66('0x85')]['count']({'where':_0x1f937f[_0x5e66('0x41')]})[_0x5e66('0x1b')](function(_0x239919){_0x19e10a[_0x5e66('0x28')]=_0x239919;if(_0x4988e7['query'][_0x5e66('0x4b')]){_0x1f937f['include']=[{'model':db[_0x5e66('0x83')],'as':_0x5e66('0xa0'),'required':![]},{'model':db[_0x5e66('0xa1')],'as':_0x5e66('0xa2'),'attributes':[_0x5e66('0x33'),_0x5e66('0xa3'),_0x5e66('0xa4')],'required':![]},{'model':db[_0x5e66('0xa5')],'as':'Tags','attributes':['id',_0x5e66('0x33'),_0x5e66('0xa6')],'where':_0x4988e7[_0x5e66('0x38')][_0x5e66('0xa7')]?{'id':_0x4988e7[_0x5e66('0x38')][_0x5e66('0xa7')]}:undefined,'required':_0x4988e7[_0x5e66('0x38')]['tag']?!![]:![]}];}return db[_0x5e66('0x85')][_0x5e66('0x4d')](_0x1f937f);})[_0x5e66('0x1b')](function(_0x4d6883){_0x19e10a[_0x5e66('0x4e')]=_0x4d6883;return _0x19e10a;});}})[_0x5e66('0x1b')](respondWithFilteredResult(_0x3efd24,_0x1f937f))[_0x5e66('0x25')](handleError(_0x3efd24,null));};exports[_0x5e66('0x98')]=function(_0x43f6b4,_0x1ae70c,_0xcf5d52){var _0x19e077,_0xbf2172,_0x746a9e;if(_[_0x5e66('0x78')](_0x43f6b4[_0x5e66('0x53')][_0x5e66('0x53')])||_0x43f6b4[_0x5e66('0x53')][_0x5e66('0x53')]===''){throw new db['Sequelize'][(_0x5e66('0x69'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5e66('0x78')](_0x43f6b4['body']['to'])){throw new db[(_0x5e66('0x68'))][(_0x5e66('0x69'))](_0x5e66('0xa8'));}_0x19e077=_0x43f6b4['body']['to'];return db['SmsAccount']['find']({'where':{'id':_0x43f6b4[_0x5e66('0x54')]['id']},'include':[{'model':db[_0x5e66('0xa9')],'as':'List','include':[{'model':db['CmContact'],'as':_0x5e66('0x80'),'where':{'mobile':_0x19e077},'limit':0x1,'order':[[_0x5e66('0x6d'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x1ae70c,null))[_0x5e66('0x1b')](function(_0x1f0386){if(_0x1f0386&&_0x1f0386[_0x5e66('0xaa')]){_0xbf2172=_0x1f0386['get']({'plain':!![]});if(_0xbf2172[_0x5e66('0xaa')]&&_0xbf2172[_0x5e66('0xaa')]['Contacts'][_0x5e66('0x3c')]){return _0xbf2172['List']['Contacts'][0x0];}return db['CmContact'][_0x5e66('0x52')](_['defaults'](_0x43f6b4[_0x5e66('0x53')],{'firstName':_0x19e077,'mobile':_0x19e077,'phone':_0x19e077,'ListId':_0xbf2172['ListId']}));}})[_0x5e66('0x1b')](handleEntityNotFound(_0x1ae70c,null))[_0x5e66('0x1b')](function(_0x3da66b){if(_0x3da66b){_0x746a9e=_0x3da66b;return db[_0x5e66('0x85')][_0x5e66('0x51')]({'where':{'ContactId':_0x746a9e['id'],'closed':![],'SmsAccountId':_0xbf2172['id']}})[_0x5e66('0x1b')](function(_0x185a25){if(_0x185a25){return[_0x185a25,![]];}return db[_0x5e66('0x85')]['create']({'UserId':_0x43f6b4['user']['id'],'ContactId':_0x746a9e['id'],'SmsAccountId':_0xbf2172['id'],'phone':_0x19e077,'firstMsgDirection':'out','Messages':[_[_0x5e66('0x47')](_0x43f6b4[_0x5e66('0x53')],{'read':![],'body':_0x43f6b4['body'][_0x5e66('0x53')],'phone':_0x19e077,'SmsAccountId':_0xbf2172['id'],'UserId':_0x43f6b4[_0x5e66('0xab')]['id'],'ContactId':_0x746a9e['id']})]},{'include':[{'model':db[_0x5e66('0x8a')],'as':_0x5e66('0xac')}]})[_0x5e66('0x1b')](function(_0x249c2b){return[_0x249c2b,!![]];});});}})['spread'](function(_0x587f70,_0x313d9f){if(_0x313d9f){return _0x587f70;}return db[_0x5e66('0x8a')][_0x5e66('0x52')](_[_0x5e66('0x47')](_0x43f6b4[_0x5e66('0x53')],{'read':![],'body':_0x43f6b4[_0x5e66('0x53')][_0x5e66('0x53')],'phone':_0x19e077,'SmsAccountId':_0xbf2172['id'],'SmsInteractionId':_0x587f70['id'],'UserId':_0x43f6b4['user']['id'],'ContactId':_0x746a9e['id']}))[_0x5e66('0x1b')](function(_0x220e62){_0x587f70[_0x5e66('0xad')]['Messages']=[];_0x587f70['dataValues'][_0x5e66('0xac')][_0x5e66('0x88')](_0x220e62['dataValues']);return _0x587f70;});})[_0x5e66('0x1b')](respondWithResult(_0x1ae70c,null))[_0x5e66('0x25')](handleError(_0x1ae70c,null));};exports['status']=function(_0x155ee3,_0x273b1a,_0x1190f4){if(_0x155ee3[_0x5e66('0x53')]['id']){delete _0x155ee3['body']['id'];}var _0x17b891,_0x2c3cc3,_0x400cfc;return db['SmsAccount'][_0x5e66('0x51')]({'where':{'id':_0x155ee3['params']['id']}})['then'](handleEntityNotFound(_0x273b1a,null))[_0x5e66('0x1b')](function(_0x478018){if(_0x478018){_0x400cfc=_0x478018;logger[_0x5e66('0x1f')](_0x5e66('0x20'),_0x5e66('0x26'),_0x5e66('0xae'),_0x478018[_0x5e66('0x6f')],util[_0x5e66('0xaf')](_0x155ee3[_0x5e66('0x53')],{'showHidden':![],'depth':null}));switch(_0x478018['type']){case'skebby':if(_0x155ee3[_0x5e66('0x53')][_0x5e66('0xb0')]&&_0x155ee3[_0x5e66('0x53')][_0x5e66('0x26')]){_0x2c3cc3=_0x155ee3[_0x5e66('0x53')]['status'];return db[_0x5e66('0x8a')][_0x5e66('0x51')]({'where':{'messageId':_0x155ee3[_0x5e66('0x53')][_0x5e66('0xb0')]}});}break;case'connectel':if(_0x155ee3[_0x5e66('0x53')][_0x5e66('0xb1')]&&_0x155ee3[_0x5e66('0x53')][_0x5e66('0xb2')]){_0x2c3cc3=_0x155ee3['body'][_0x5e66('0xb2')];return db['SmsMessage'][_0x5e66('0x51')]({'where':{'messageId':_0x155ee3[_0x5e66('0x53')]['requestid']}});}break;case _0x5e66('0x75'):if(_0x155ee3[_0x5e66('0x53')][_0x5e66('0x76')]&&_0x155ee3[_0x5e66('0x53')][_0x5e66('0xb3')]){_0x2c3cc3=_0x155ee3[_0x5e66('0x53')]['status_code'];return db['SmsMessage'][_0x5e66('0x51')]({'where':{'messageId':_0x155ee3[_0x5e66('0x53')][_0x5e66('0x76')]}});}break;}}})['then'](handleEntityNotFound(_0x273b1a,null))[_0x5e66('0x1b')](function(_0x5c7b1f){if(_0x5c7b1f){_0x17b891=_0x5c7b1f;switch(_0x400cfc[_0x5e66('0x6f')]){case _0x5e66('0x73'):if(_0x2c3cc3===_0x5e66('0xb4')){return _0x17b891[_0x5e66('0x30')]({'read':!![]});}else{logger['error'](_0x5e66('0x20'),'status',_0x5e66('0x73'),util[_0x5e66('0xaf')](_0x155ee3[_0x5e66('0x53')],{'showHidden':![],'depth':null}));}break;case _0x5e66('0xb5'):if(_0x2c3cc3==='1'){return _0x17b891[_0x5e66('0x30')]({'read':!![]});}else{logger[_0x5e66('0x22')](_0x5e66('0x20'),_0x5e66('0x26'),_0x5e66('0x73'),util[_0x5e66('0xaf')](_0x155ee3[_0x5e66('0x53')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x155ee3[_0x5e66('0x53')][_0x5e66('0xb6')]&&_0x2c3cc3>=0xc8&&_0x2c3cc3<=0xce){return _0x17b891[_0x5e66('0x30')]({'read':!![]});}else{logger[_0x5e66('0x22')](_0x5e66('0x20'),_0x5e66('0x26'),_0x5e66('0x75'),util['inspect'](_0x155ee3['body'],{'showHidden':![],'depth':null}));}break;}return _0x17b891;}})[_0x5e66('0x1b')](respondWithResult(_0x273b1a,null))[_0x5e66('0x25')](handleError(_0x273b1a,null));};exports[_0x5e66('0xb7')]=function(_0x531d0a,_0x587fea,_0x5ab71c){return db[_0x5e66('0x34')][_0x5e66('0x51')]({'where':{'id':_0x531d0a['params']['id']}})[_0x5e66('0x1b')](handleEntityNotFound(_0x587fea,null))[_0x5e66('0x1b')](function(_0x5d85ca){if(_0x5d85ca){return _0x5d85ca[_0x5e66('0xb7')](_0x531d0a['body'][_0x5e66('0x5c')],_[_0x5e66('0x81')](_0x531d0a[_0x5e66('0x53')],[_0x5e66('0x5c'),'id'])||{})[_0x5e66('0xb8')](function(_0x53049f){for(var _0x537aa7=0x0;_0x537aa7<_0x531d0a['body'][_0x5e66('0x5c')][_0x5e66('0x3c')];_0x537aa7+=0x1){socket['emit']('userSmsAccount:save',{'UserId':_0x531d0a['body'][_0x5e66('0x5c')][_0x537aa7],'SmsAccountId':_0x531d0a[_0x5e66('0x54')]['id']});}return _0x53049f;});}})['then'](respondWithResult(_0x587fea,null))[_0x5e66('0x25')](handleError(_0x587fea,null));};exports['removeAgents']=function(_0x4d9fa5,_0x11088a,_0x1d53b3){var _0x2036a6;return db[_0x5e66('0x34')][_0x5e66('0x51')]({'where':{'id':_0x4d9fa5['params']['id']}})[_0x5e66('0x1b')](handleEntityNotFound(_0x11088a,null))[_0x5e66('0x1b')](function(_0x4e94c3){if(_0x4e94c3){return _0x4e94c3[_0x5e66('0xb9')](_0x4d9fa5[_0x5e66('0x38')][_0x5e66('0x5c')])[_0x5e66('0x1b')](function(_0x575da2){if(_['isArray'](_0x4d9fa5[_0x5e66('0x38')][_0x5e66('0x5c')])){for(var _0x5135f7=0x0;_0x5135f7<_0x4d9fa5[_0x5e66('0x38')][_0x5e66('0x5c')][_0x5e66('0x3c')];_0x5135f7+=0x1){socket[_0x5e66('0xba')](_0x5e66('0xbb'),{'UserId':_0x4d9fa5[_0x5e66('0x38')]['ids'][_0x5135f7],'SmsAccountId':_0x4d9fa5[_0x5e66('0x54')]['id']});}}else{socket[_0x5e66('0xba')]('userSmsAccount:remove',{'UserId':_0x4d9fa5[_0x5e66('0x38')][_0x5e66('0x5c')],'SmsAccountId':_0x4d9fa5['params']['id']});}});}})['then'](respondWithStatusCode(_0x11088a,null))[_0x5e66('0x25')](handleError(_0x11088a,null));};exports[_0x5e66('0xbc')]=function(_0x518d48,_0x4aea9d,_0x527329){var _0x52779f={};var _0x3f3918={};var _0x45295f;var _0x484557;return db[_0x5e66('0x34')][_0x5e66('0x58')]({'where':{'id':_0x518d48[_0x5e66('0x54')]['id']}})['then'](handleEntityNotFound(_0x4aea9d,null))[_0x5e66('0x1b')](function(_0x34e11e){if(_0x34e11e){_0x45295f=_0x34e11e;_0x3f3918[_0x5e66('0x36')]=_[_0x5e66('0x39')](db[_0x5e66('0xa1')]['rawAttributes']);_0x3f3918[_0x5e66('0x38')]=_[_0x5e66('0x39')](_0x518d48[_0x5e66('0x38')]);_0x3f3918[_0x5e66('0x43')]=_['intersection'](_0x3f3918[_0x5e66('0x36')],_0x3f3918['query']);_0x52779f[_0x5e66('0x3b')]=_[_0x5e66('0x3a')](_0x3f3918[_0x5e66('0x36')],qs[_0x5e66('0x50')](_0x518d48[_0x5e66('0x38')]['fields']));_0x52779f['attributes']=_0x52779f[_0x5e66('0x3b')][_0x5e66('0x3c')]?_0x52779f[_0x5e66('0x3b')]:_0x3f3918['model'];_0x52779f['order']=qs[_0x5e66('0x40')](_0x518d48[_0x5e66('0x38')]['sort']);_0x52779f[_0x5e66('0x41')]=qs['filters'](_[_0x5e66('0x42')](_0x518d48[_0x5e66('0x38')],_0x3f3918[_0x5e66('0x43')]));if(_0x518d48[_0x5e66('0x38')][_0x5e66('0x48')]){_0x52779f[_0x5e66('0x41')]=_[_0x5e66('0x47')](_0x52779f[_0x5e66('0x41')],{'$or':_['map'](_0x52779f[_0x5e66('0x3b')],function(_0x2f1d48){var _0x38b539={};_0x38b539[_0x2f1d48]={'$like':'%'+_0x518d48[_0x5e66('0x38')][_0x5e66('0x48')]+'%'};return _0x38b539;})});}_0x52779f=_[_0x5e66('0x47')]({},_0x52779f,_0x518d48[_0x5e66('0x4a')]);return _0x45295f[_0x5e66('0xbc')](_0x52779f);}})['then'](function(_0x54d88a){if(_0x54d88a){_0x484557=_0x54d88a[_0x5e66('0x3c')];if(!_0x518d48[_0x5e66('0x38')][_0x5e66('0x3d')](_0x5e66('0x3e'))){_0x52779f[_0x5e66('0x2a')]=qs['limit'](_0x518d48[_0x5e66('0x38')][_0x5e66('0x2a')]);_0x52779f[_0x5e66('0x29')]=qs[_0x5e66('0x29')](_0x518d48[_0x5e66('0x38')][_0x5e66('0x29')]);}return _0x45295f['getAgents'](_0x52779f);}})[_0x5e66('0x1b')](function(_0x1f8155){if(_0x1f8155){return _0x1f8155?{'count':_0x484557,'rows':_0x1f8155}:null;}})[_0x5e66('0x1b')](respondWithResult(_0x4aea9d,null))[_0x5e66('0x25')](handleError(_0x4aea9d,null));}; \ No newline at end of file +var _0x3697=['removeAgents','isArray','userSmsAccount:remove','getAgents','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','end','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','index','rawAttributes','keys','dateStart','query','dateEnd','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','add','day','merge','where','map','filter','options','SmsAccount','count','includeAll','include','rows','show','filters','create','body','find','params','describe','addDisposition','Disposition','getDispositions','findAll','removeDispositions','ids','addAnswer','SmsAccountId','getAnswers','CannedAnswer','pick','removeAnswers','notify','sms','Applications','account','orderBy','priority','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','mobile','type','twilio','From','messageId','MessageSid','skebby','from','sender','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','isNil','from\x20is\x20mandatory','ValidationError','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','ListId','Contacts','DESC','list','omit','defaults','contact','SmsInteraction','spread','interaction','get','autoclose','applications','push','close','unmanaged','*,*,*,*','SmsMessage','AttachmentId','UserId','User','agent','Start','startRouting','debug','entity\x20found','text/xml','send','\x0a','addApplications','findOne','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','Owner','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','CmList','List','Messages','user','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','DELIVERED','inspect','error_code','addAgents','emit','userSmsAccount:save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3697,0x190));var _0x7369=function(_0x26863f,_0x155ce8){_0x26863f=_0x26863f-0x0;var _0x37e522=_0x3697[_0x26863f];return _0x37e522;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x7369('0x0'));var moment=require(_0x7369('0x1'));var BPromise=require(_0x7369('0x2'));var Mustache=require(_0x7369('0x3'));var util=require(_0x7369('0x4'));var path=require(_0x7369('0x5'));var sox=require('sox');var csv=require(_0x7369('0x6'));var ejs=require(_0x7369('0x7'));var fs=require('fs');var _=require(_0x7369('0x8'));var squel=require('squel');var crypto=require(_0x7369('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7369('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7369('0xb'));var Papa=require(_0x7369('0xc'));var qs=require(_0x7369('0xd'));var logger=require('../../config/logger')(_0x7369('0xe'));var utils=require('../../config/utils');var config=require(_0x7369('0xf'));var db=require(_0x7369('0x10'))['db'];var socket=require(_0x7369('0x11'))({'host':_0x7369('0x12'),'port':0x18eb});require(_0x7369('0x13'))[_0x7369('0x14')](socket);var jayson=require(_0x7369('0x15'));var client=jayson[_0x7369('0x16')][_0x7369('0x17')]({'port':0x232c});function respondWithRpcPromise(_0xc6270b,_0x58f1c1,_0x12384e,_0x1cf50e){return new BPromise(function(_0x48bd75,_0x254860){var _0x5d7896=_0x1cf50e||client;return _0x5d7896[_0x7369('0x18')](_0xc6270b,_0x12384e)[_0x7369('0x19')](function(_0x4e25da){logger[_0x7369('0x1a')](_0x7369('0x1b'),_0x58f1c1,'request\x20sent');logger['debug'](_0x7369('0x1c'),_0x58f1c1,_0x7369('0x1d'),JSON[_0x7369('0x1e')](_0x4e25da));if(_0x4e25da['error']){if(_0x4e25da[_0x7369('0x1f')][_0x7369('0x20')]===0x1f4){logger[_0x7369('0x1f')](_0x7369('0x1b'),_0x58f1c1,_0x4e25da[_0x7369('0x1f')][_0x7369('0x21')]);return _0x254860(_0x4e25da[_0x7369('0x1f')]['message']);}logger[_0x7369('0x1f')](_0x7369('0x1b'),_0x58f1c1,_0x4e25da[_0x7369('0x1f')][_0x7369('0x21')]);return _0x48bd75(_0x4e25da['error']['message']);}else{logger[_0x7369('0x1a')](_0x7369('0x1b'),_0x58f1c1,_0x7369('0x1d'));_0x48bd75(_0x4e25da[_0x7369('0x22')]['message']);}})[_0x7369('0x23')](function(_0x5d2250){logger[_0x7369('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x58f1c1,_0x5d2250);_0x254860(_0x5d2250);});});}function respondWithStatusCode(_0x82448e,_0x390f2d){_0x390f2d=_0x390f2d||0xcc;return function(_0x38683e){if(_0x38683e){return _0x82448e['sendStatus'](_0x390f2d);}return _0x82448e['status'](_0x390f2d)[_0x7369('0x24')]();};}function respondWithResult(_0x1f7d95,_0x2e3484){_0x2e3484=_0x2e3484||0xc8;return function(_0x1cd968){if(_0x1cd968){return _0x1f7d95[_0x7369('0x25')](_0x2e3484)[_0x7369('0x26')](_0x1cd968);}};}function respondWithFilteredResult(_0x16eaab,_0x3c2886){return function(_0x382f45){if(_0x382f45){var _0x48e5e8=_0x382f45['count'],_0x24e4d7=_0x3c2886[_0x7369('0x27')],_0x1d498c=_0x3c2886['offset']+_0x3c2886[_0x7369('0x28')],_0x22eb7a;if(_0x1d498c>=_0x48e5e8){_0x1d498c=_0x48e5e8;_0x22eb7a=0xc8;}else{_0x22eb7a=0xce;}_0x16eaab['status'](_0x22eb7a);return _0x16eaab[_0x7369('0x29')](_0x7369('0x2a'),_0x24e4d7+'-'+_0x1d498c+'/'+_0x48e5e8)['json'](_0x382f45);}return null;};}function patchUpdates(_0x25fbf2){return function(_0x35b25f){try{jsonpatch[_0x7369('0x2b')](_0x35b25f,_0x25fbf2,!![]);}catch(_0x2c5bf9){return BPromise[_0x7369('0x2c')](_0x2c5bf9);}return _0x35b25f['save']();};}function saveUpdates(_0xc960da,_0x2dd12f){return function(_0xb7b235){if(_0xb7b235){return _0xb7b235[_0x7369('0x2d')](_0xc960da)['then'](function(_0x20381f){return _0x20381f;});}return null;};}function removeEntity(_0x168385,_0x3c4e5d){return function(_0x102126){if(_0x102126){return _0x102126[_0x7369('0x2e')]()[_0x7369('0x19')](function(){_0x168385[_0x7369('0x25')](0xcc)[_0x7369('0x24')]();});}};}function handleEntityNotFound(_0x1b9369,_0x24aada){return function(_0x490bf7){if(!_0x490bf7){_0x1b9369[_0x7369('0x2f')](0x194);}return _0x490bf7;};}function handleError(_0x33a790,_0x35fc81){_0x35fc81=_0x35fc81||0x1f4;return function(_0x237384){logger[_0x7369('0x1f')](_0x237384[_0x7369('0x30')]);if(_0x237384[_0x7369('0x31')]){delete _0x237384['name'];}_0x33a790[_0x7369('0x25')](_0x35fc81)['send'](_0x237384);};}exports[_0x7369('0x32')]=function(_0x434311,_0x439aaf){var _0x4a6106={},_0x356cf1={},_0x291ad4={'count':0x0,'rows':[]};var _0xa3e172=db['SmsAccount'][_0x7369('0x33')];_0x356cf1['model']=_[_0x7369('0x34')](_0xa3e172);var _0x1e0e1a={'dateStart':_0x434311['query'][_0x7369('0x35')],'dateEnd':_0x434311[_0x7369('0x36')][_0x7369('0x37')]};delete _0x434311[_0x7369('0x36')][_0x7369('0x35')];delete _0x434311['query']['dateEnd'];_0x356cf1[_0x7369('0x36')]=_['keys'](_0x434311[_0x7369('0x36')]);_0x356cf1['filters']=_[_0x7369('0x38')](_0x356cf1[_0x7369('0x39')],_0x356cf1[_0x7369('0x36')]);_0x4a6106[_0x7369('0x3a')]=_[_0x7369('0x38')](_0x356cf1[_0x7369('0x39')],qs[_0x7369('0x3b')](_0x434311[_0x7369('0x36')][_0x7369('0x3b')]));_0x4a6106[_0x7369('0x3a')]=_0x4a6106[_0x7369('0x3a')][_0x7369('0x3c')]?_0x4a6106[_0x7369('0x3a')]:_0x356cf1['model'];if(!_0x434311[_0x7369('0x36')][_0x7369('0x3d')](_0x7369('0x3e'))){_0x4a6106['limit']=qs[_0x7369('0x28')](_0x434311[_0x7369('0x36')][_0x7369('0x28')]);_0x4a6106['offset']=qs[_0x7369('0x27')](_0x434311[_0x7369('0x36')]['offset']);}_0x4a6106[_0x7369('0x3f')]=qs[_0x7369('0x40')](_0x434311['query'][_0x7369('0x40')]);_0x4a6106['where']=qs['filters'](_['pick'](_0x434311[_0x7369('0x36')],_0x356cf1['filters']));if(_0x1e0e1a[_0x7369('0x35')]){if(_0x1e0e1a[_0x7369('0x37')]){_0x1e0e1a[_0x7369('0x37')]=moment(_0x1e0e1a[_0x7369('0x37')])[_0x7369('0x41')](0x1,_0x7369('0x42'));}else{_0x1e0e1a[_0x7369('0x37')]=moment(_0x1e0e1a[_0x7369('0x35')])[_0x7369('0x41')](0x1,'day');}_[_0x7369('0x43')](_0x4a6106[_0x7369('0x44')],{'createdAt':{'$gte':_0x1e0e1a[_0x7369('0x35')],'$lte':_0x1e0e1a[_0x7369('0x37')]}});}if(_0x434311[_0x7369('0x36')]['filter']){_0x4a6106[_0x7369('0x44')]=_[_0x7369('0x43')](_0x4a6106[_0x7369('0x44')],{'$or':_[_0x7369('0x45')](_0x4a6106[_0x7369('0x3a')],function(_0x22fb24){var _0x4a5582={};_0x4a5582[_0x22fb24]={'$like':'%'+_0x434311[_0x7369('0x36')][_0x7369('0x46')]+'%'};return _0x4a5582;})});}_0x4a6106=_[_0x7369('0x43')]({},_0x4a6106,_0x434311[_0x7369('0x47')]);var _0x4eb7df={'where':_0x4a6106[_0x7369('0x44')]};return db[_0x7369('0x48')][_0x7369('0x49')](_0x4eb7df)[_0x7369('0x19')](function(_0x31cfe5){_0x291ad4[_0x7369('0x49')]=_0x31cfe5;if(_0x434311[_0x7369('0x36')][_0x7369('0x4a')]){_0x4a6106[_0x7369('0x4b')]=[{'all':!![]}];}return db[_0x7369('0x48')]['findAll'](_0x4a6106);})['then'](function(_0x407f6d){_0x291ad4[_0x7369('0x4c')]=_0x407f6d;return _0x291ad4;})['then'](respondWithFilteredResult(_0x439aaf,_0x4a6106))['catch'](handleError(_0x439aaf,null));};exports[_0x7369('0x4d')]=function(_0x4eca67,_0x47a06e){var _0x253826={'raw':![],'where':{'id':_0x4eca67['params']['id']}},_0x1b5a42={};_0x1b5a42[_0x7369('0x39')]=_[_0x7369('0x34')](db[_0x7369('0x48')][_0x7369('0x33')]);_0x1b5a42[_0x7369('0x36')]=_[_0x7369('0x34')](_0x4eca67[_0x7369('0x36')]);_0x1b5a42[_0x7369('0x4e')]=_[_0x7369('0x38')](_0x1b5a42['model'],_0x1b5a42[_0x7369('0x36')]);_0x253826[_0x7369('0x3a')]=_['intersection'](_0x1b5a42['model'],qs[_0x7369('0x3b')](_0x4eca67['query'][_0x7369('0x3b')]));_0x253826[_0x7369('0x3a')]=_0x253826[_0x7369('0x3a')]['length']?_0x253826[_0x7369('0x3a')]:_0x1b5a42[_0x7369('0x39')];if(_0x4eca67[_0x7369('0x36')][_0x7369('0x4a')]){_0x253826['include']=[{'all':!![]}];}_0x253826=_[_0x7369('0x43')]({},_0x253826,_0x4eca67[_0x7369('0x47')]);return db[_0x7369('0x48')]['find'](_0x253826)['then'](handleEntityNotFound(_0x47a06e,null))[_0x7369('0x19')](respondWithResult(_0x47a06e,null))[_0x7369('0x23')](handleError(_0x47a06e,null));};exports[_0x7369('0x4f')]=function(_0x98f6c8,_0x1ea848){return db[_0x7369('0x48')][_0x7369('0x4f')](_0x98f6c8[_0x7369('0x50')],{})[_0x7369('0x19')](respondWithResult(_0x1ea848,0xc9))[_0x7369('0x23')](handleError(_0x1ea848,null));};exports[_0x7369('0x2d')]=function(_0x4862af,_0x1aac77){if(_0x4862af[_0x7369('0x50')]['id']){delete _0x4862af['body']['id'];}return db[_0x7369('0x48')][_0x7369('0x51')]({'where':{'id':_0x4862af[_0x7369('0x52')]['id']}})[_0x7369('0x19')](handleEntityNotFound(_0x1aac77,null))['then'](saveUpdates(_0x4862af[_0x7369('0x50')],null))[_0x7369('0x19')](respondWithResult(_0x1aac77,null))[_0x7369('0x23')](handleError(_0x1aac77,null));};exports[_0x7369('0x2e')]=function(_0x44285d,_0x2c57f4){return db['SmsAccount'][_0x7369('0x51')]({'where':{'id':_0x44285d[_0x7369('0x52')]['id']}})['then'](handleEntityNotFound(_0x2c57f4,null))['then'](removeEntity(_0x2c57f4,null))[_0x7369('0x23')](handleError(_0x2c57f4,null));};exports[_0x7369('0x53')]=function(_0x3fb528,_0x477cfe){return db['SmsAccount'][_0x7369('0x53')]()[_0x7369('0x19')](respondWithResult(_0x477cfe,null))[_0x7369('0x23')](handleError(_0x477cfe,null));};exports[_0x7369('0x54')]=function(_0x3b36e8,_0x37bc2f,_0x10bae1){if(_0x3b36e8[_0x7369('0x50')]['id']){delete _0x3b36e8[_0x7369('0x50')]['id'];}return db[_0x7369('0x48')]['find']({'where':{'id':_0x3b36e8[_0x7369('0x52')]['id']}})['then'](handleEntityNotFound(_0x37bc2f,null))['then'](function(_0x44869a){if(_0x44869a){_0x3b36e8[_0x7369('0x50')]['SmsAccountId']=_0x44869a['id'];return db[_0x7369('0x55')]['create'](_0x3b36e8['body']);}})[_0x7369('0x19')](respondWithResult(_0x37bc2f,null))[_0x7369('0x23')](handleError(_0x37bc2f,null));};exports[_0x7369('0x56')]=function(_0x3014ac,_0x3ded23,_0x2529b3){var _0x1b58a6={'raw':![],'where':{}};var _0x325bbe={};var _0x327b6c={'count':0x0,'rows':[]};return db[_0x7369('0x48')]['findOne']({'where':{'id':_0x3014ac['params']['id']}})[_0x7369('0x19')](handleEntityNotFound(_0x3ded23,null))[_0x7369('0x19')](function(_0x4413dd){if(_0x4413dd){_0x325bbe[_0x7369('0x39')]=_[_0x7369('0x34')](db['Disposition'][_0x7369('0x33')]);_0x325bbe['query']=_['keys'](_0x3014ac[_0x7369('0x36')]);_0x325bbe[_0x7369('0x4e')]=_[_0x7369('0x38')](_0x325bbe[_0x7369('0x39')],_0x325bbe[_0x7369('0x36')]);_0x1b58a6[_0x7369('0x3a')]=_[_0x7369('0x38')](_0x325bbe[_0x7369('0x39')],qs[_0x7369('0x3b')](_0x3014ac[_0x7369('0x36')][_0x7369('0x3b')]));_0x1b58a6['attributes']=_0x1b58a6[_0x7369('0x3a')][_0x7369('0x3c')]?_0x1b58a6[_0x7369('0x3a')]:_0x325bbe[_0x7369('0x39')];if(!_0x3014ac[_0x7369('0x36')][_0x7369('0x3d')]('nolimit')){_0x1b58a6[_0x7369('0x28')]=qs[_0x7369('0x28')](_0x3014ac[_0x7369('0x36')]['limit']);_0x1b58a6[_0x7369('0x27')]=qs['offset'](_0x3014ac['query']['offset']);}_0x1b58a6['order']=qs['sort'](_0x3014ac[_0x7369('0x36')]['sort']);_0x1b58a6[_0x7369('0x44')]=qs['filters'](_['pick'](_0x3014ac[_0x7369('0x36')],_0x325bbe[_0x7369('0x4e')]));_0x1b58a6['where']['SmsAccountId']=_0x4413dd['id'];if(_0x3014ac[_0x7369('0x36')][_0x7369('0x46')]){_0x1b58a6[_0x7369('0x44')]=_['merge'](_0x1b58a6[_0x7369('0x44')],{'$or':_['map'](_0x1b58a6[_0x7369('0x3a')],function(_0x4fd805){var _0x3dc89c={};_0x3dc89c[_0x4fd805]={'$like':'%'+_0x3014ac['query'][_0x7369('0x46')]+'%'};return _0x3dc89c;})});}_0x1b58a6=_[_0x7369('0x43')]({},_0x1b58a6,_0x3014ac[_0x7369('0x47')]);return db[_0x7369('0x55')][_0x7369('0x49')]({'where':_0x1b58a6[_0x7369('0x44')]})[_0x7369('0x19')](function(_0x163247){_0x327b6c['count']=_0x163247;if(_0x3014ac['query'][_0x7369('0x4a')]){_0x1b58a6['include']=[{'all':!![]}];}return db[_0x7369('0x55')][_0x7369('0x57')](_0x1b58a6);})[_0x7369('0x19')](function(_0x19b417){_0x327b6c[_0x7369('0x4c')]=_0x19b417;return _0x327b6c;});}})['then'](respondWithFilteredResult(_0x3ded23,_0x1b58a6))[_0x7369('0x23')](handleError(_0x3ded23,null));};exports[_0x7369('0x58')]=function(_0x42e947,_0x4e7be8,_0x1e2e37){var _0x28f73d;return db[_0x7369('0x48')][_0x7369('0x51')]({'where':{'id':_0x42e947[_0x7369('0x52')]['id']}})[_0x7369('0x19')](handleEntityNotFound(_0x4e7be8,null))[_0x7369('0x19')](function(_0x4294a0){if(_0x4294a0){return _0x4294a0[_0x7369('0x58')](_0x42e947[_0x7369('0x36')][_0x7369('0x59')]);}})[_0x7369('0x19')](respondWithStatusCode(_0x4e7be8,null))['catch'](handleError(_0x4e7be8,null));};exports[_0x7369('0x5a')]=function(_0x19460e,_0x427629,_0x351ed6){if(_0x19460e['body']['id']){delete _0x19460e[_0x7369('0x50')]['id'];}return db['SmsAccount'][_0x7369('0x51')]({'where':{'id':_0x19460e[_0x7369('0x52')]['id']}})[_0x7369('0x19')](handleEntityNotFound(_0x427629,null))[_0x7369('0x19')](function(_0x2d7a2a){if(_0x2d7a2a){_0x19460e['body'][_0x7369('0x5b')]=_0x2d7a2a['id'];return db['CannedAnswer'][_0x7369('0x4f')](_0x19460e[_0x7369('0x50')]);}})[_0x7369('0x19')](respondWithResult(_0x427629,null))[_0x7369('0x23')](handleError(_0x427629,null));};exports[_0x7369('0x5c')]=function(_0x22dec1,_0x5e98f6,_0x30784d){var _0x1a5afd={'raw':![],'where':{}};var _0x13cab={};var _0x21c73c={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x22dec1[_0x7369('0x52')]['id']}})[_0x7369('0x19')](handleEntityNotFound(_0x5e98f6,null))[_0x7369('0x19')](function(_0x3a596d){if(_0x3a596d){_0x13cab[_0x7369('0x39')]=_['keys'](db[_0x7369('0x5d')][_0x7369('0x33')]);_0x13cab[_0x7369('0x36')]=_[_0x7369('0x34')](_0x22dec1[_0x7369('0x36')]);_0x13cab[_0x7369('0x4e')]=_[_0x7369('0x38')](_0x13cab[_0x7369('0x39')],_0x13cab[_0x7369('0x36')]);_0x1a5afd[_0x7369('0x3a')]=_[_0x7369('0x38')](_0x13cab[_0x7369('0x39')],qs[_0x7369('0x3b')](_0x22dec1['query'][_0x7369('0x3b')]));_0x1a5afd[_0x7369('0x3a')]=_0x1a5afd[_0x7369('0x3a')][_0x7369('0x3c')]?_0x1a5afd[_0x7369('0x3a')]:_0x13cab['model'];if(!_0x22dec1[_0x7369('0x36')][_0x7369('0x3d')](_0x7369('0x3e'))){_0x1a5afd['limit']=qs[_0x7369('0x28')](_0x22dec1[_0x7369('0x36')][_0x7369('0x28')]);_0x1a5afd[_0x7369('0x27')]=qs[_0x7369('0x27')](_0x22dec1['query']['offset']);}_0x1a5afd[_0x7369('0x3f')]=qs['sort'](_0x22dec1[_0x7369('0x36')][_0x7369('0x40')]);_0x1a5afd[_0x7369('0x44')]=qs[_0x7369('0x4e')](_[_0x7369('0x5e')](_0x22dec1['query'],_0x13cab[_0x7369('0x4e')]));_0x1a5afd['where'][_0x7369('0x5b')]=_0x3a596d['id'];if(_0x22dec1[_0x7369('0x36')][_0x7369('0x46')]){_0x1a5afd[_0x7369('0x44')]=_['merge'](_0x1a5afd['where'],{'$or':_[_0x7369('0x45')](_0x1a5afd['attributes'],function(_0x4d93ea){var _0x2c134a={};_0x2c134a[_0x4d93ea]={'$like':'%'+_0x22dec1[_0x7369('0x36')][_0x7369('0x46')]+'%'};return _0x2c134a;})});}_0x1a5afd=_['merge']({},_0x1a5afd,_0x22dec1[_0x7369('0x47')]);return db[_0x7369('0x5d')][_0x7369('0x49')]({'where':_0x1a5afd[_0x7369('0x44')]})[_0x7369('0x19')](function(_0x5a35b9){_0x21c73c['count']=_0x5a35b9;if(_0x22dec1['query'][_0x7369('0x4a')]){_0x1a5afd[_0x7369('0x4b')]=[{'all':!![]}];}return db[_0x7369('0x5d')][_0x7369('0x57')](_0x1a5afd);})[_0x7369('0x19')](function(_0x3fc026){_0x21c73c[_0x7369('0x4c')]=_0x3fc026;return _0x21c73c;});}})[_0x7369('0x19')](respondWithFilteredResult(_0x5e98f6,_0x1a5afd))[_0x7369('0x23')](handleError(_0x5e98f6,null));};exports['removeAnswers']=function(_0x1ea713,_0x439d3a,_0x1e9f7f){var _0x3f80fe;return db[_0x7369('0x48')][_0x7369('0x51')]({'where':{'id':_0x1ea713[_0x7369('0x52')]['id']}})[_0x7369('0x19')](handleEntityNotFound(_0x439d3a,null))[_0x7369('0x19')](function(_0x52007a){if(_0x52007a){return _0x52007a[_0x7369('0x5f')](_0x1ea713[_0x7369('0x36')][_0x7369('0x59')]);}})['then'](respondWithStatusCode(_0x439d3a,null))[_0x7369('0x23')](handleError(_0x439d3a,null));};exports[_0x7369('0x60')]=function(_0x42a0f4,_0x1743eb,_0x442f3b){var _0x3a1e1b={'channel':_0x7369('0x61')};var _0x9b522a=[];var _0x813ee7=[];var _0x57b368={};return db[_0x7369('0x48')][_0x7369('0x51')]({'where':{'id':_0x42a0f4[_0x7369('0x52')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x7369('0x62')}]})[_0x7369('0x19')](handleEntityNotFound(_0x1743eb,null))['then'](function(_0x4514e3){_0x3a1e1b[_0x7369('0x63')]=_0x4514e3;_0x3a1e1b['applications']=_[_0x7369('0x64')](_0x4514e3[_0x7369('0x62')],[_0x7369('0x65')],[_0x7369('0x66')]);if(_0x3a1e1b[_0x7369('0x63')][_0x7369('0x62')]){delete _0x3a1e1b[_0x7369('0x63')][_0x7369('0x62')];}return db[_0x7369('0x67')][_0x7369('0x53')]();})['then'](function(_0xa9663d){if(!_0xa9663d){throw new db[(_0x7369('0x68'))]['ValidationError'](_0x7369('0x69'));}_0x9b522a=_[_0x7369('0x6a')](_[_0x7369('0x34')](_0xa9663d),[_0x7369('0x6b'),_0x7369('0x6c')]);_0x813ee7=_[_0x7369('0x6a')](_['keys'](_0xa9663d),[_0x7369('0x6b'),_0x7369('0x6c'),'CompanyId','ListId']);_0x3a1e1b[_0x7369('0x50')]={'mapKey':_0x7369('0x6d')};if(_0x3a1e1b[_0x7369('0x63')][_0x7369('0x6e')]){switch(_0x3a1e1b[_0x7369('0x63')][_0x7369('0x6e')]){case _0x7369('0x6f'):_0x3a1e1b[_0x7369('0x50')]['from']=_0x42a0f4['body'][_0x7369('0x70')];_0x3a1e1b['body'][_0x7369('0x50')]=_0x42a0f4[_0x7369('0x50')]['Body'];_0x3a1e1b['body'][_0x7369('0x71')]=_0x42a0f4[_0x7369('0x50')][_0x7369('0x72')];break;case _0x7369('0x73'):_0x3a1e1b[_0x7369('0x50')][_0x7369('0x74')]=_0x42a0f4[_0x7369('0x50')][_0x7369('0x75')];_0x3a1e1b[_0x7369('0x50')][_0x7369('0x50')]=_0x42a0f4[_0x7369('0x50')][_0x7369('0x76')];break;case _0x7369('0x77'):_0x3a1e1b[_0x7369('0x50')][_0x7369('0x74')]=_0x42a0f4[_0x7369('0x50')][_0x7369('0x74')];_0x3a1e1b[_0x7369('0x50')][_0x7369('0x50')]=_0x42a0f4[_0x7369('0x50')]['message'];break;case _0x7369('0x78'):_0x3a1e1b[_0x7369('0x50')][_0x7369('0x74')]=_0x42a0f4[_0x7369('0x50')][_0x7369('0x74')];_0x3a1e1b[_0x7369('0x50')][_0x7369('0x50')]=_0x42a0f4[_0x7369('0x50')][_0x7369('0x50')];_0x3a1e1b['body']['messageId']=_0x42a0f4['body'][_0x7369('0x79')];break;case _0x7369('0x7a'):_0x3a1e1b[_0x7369('0x50')][_0x7369('0x74')]=_0x42a0f4[_0x7369('0x50')][_0x7369('0x70')];_0x3a1e1b[_0x7369('0x50')][_0x7369('0x50')]=_0x42a0f4[_0x7369('0x50')][_0x7369('0x7b')];_0x3a1e1b[_0x7369('0x50')]['messageId']=_0x42a0f4[_0x7369('0x50')][_0x7369('0x7c')];break;}}if(_0x3a1e1b[_0x7369('0x50')]['id']){delete _0x3a1e1b[_0x7369('0x50')]['id'];}if(_[_0x7369('0x7d')](_0x3a1e1b[_0x7369('0x50')][_0x7369('0x74')])){throw new db[(_0x7369('0x68'))]['ValidationError'](_0x7369('0x7e'));}if(_[_0x7369('0x7d')](_0x3a1e1b['body'][_0x7369('0x50')])||_0x3a1e1b[_0x7369('0x50')][_0x7369('0x50')]===''){throw new db[(_0x7369('0x68'))][(_0x7369('0x7f'))](_0x7369('0x80'));}if(_['isNil'](_0x3a1e1b[_0x7369('0x50')][_0x7369('0x81')])){throw new db[(_0x7369('0x68'))]['ValidationError'](_0x7369('0x82')+_0x813ee7);}if(!_[_0x7369('0x83')](_0x813ee7,_0x3a1e1b[_0x7369('0x50')][_0x7369('0x81')])){throw new db[(_0x7369('0x68'))][(_0x7369('0x7f'))](_0x7369('0x84')+_0x813ee7);}_0x57b368[_0x3a1e1b[_0x7369('0x50')][_0x7369('0x81')]]=_0x3a1e1b[_0x7369('0x50')][_0x7369('0x74')];return db['CmList'][_0x7369('0x51')]({'where':{'id':_0x3a1e1b[_0x7369('0x63')][_0x7369('0x85')]},'include':[{'model':db[_0x7369('0x67')],'as':_0x7369('0x86'),'where':_0x57b368,'limit':0x1,'order':[[_0x7369('0x6c'),_0x7369('0x87')]]}]});})['then'](handleEntityNotFound(_0x1743eb,null))[_0x7369('0x19')](function(_0x25695c){if(_0x25695c){_0x3a1e1b[_0x7369('0x88')]=_[_0x7369('0x89')](_0x25695c,[_0x7369('0x86')]);if(_0x25695c[_0x7369('0x86')]['length']){return _0x25695c[_0x7369('0x86')][0x0];}var _0x123f8a=_[_0x7369('0x8a')](_0x3a1e1b['body'],{'firstName':_0x3a1e1b[_0x7369('0x50')]['from'],'ListId':_0x25695c['id']});_0x123f8a[_0x3a1e1b[_0x7369('0x50')][_0x7369('0x81')]]=_0x3a1e1b[_0x7369('0x50')]['from'];return db[_0x7369('0x67')][_0x7369('0x4f')](_0x123f8a,{'fields':_0x9b522a,'raw':!![]});}})[_0x7369('0x19')](handleEntityNotFound(_0x1743eb,null))[_0x7369('0x19')](function(_0x629417){if(_0x629417){_0x3a1e1b[_0x7369('0x8b')]=_0x629417;var _0x5a46c2={'ContactId':_0x629417['id'],'phone':_0x3a1e1b[_0x7369('0x50')][_0x7369('0x74')],'SmsAccountId':_0x42a0f4['params']['id']};var _0x2d1026={'ContactId':_0x629417['id'],'SmsAccountId':_0x42a0f4[_0x7369('0x52')]['id'],'closed':![]};return db[_0x7369('0x8c')][_0x7369('0x51')]({'where':_0x2d1026})['then'](function(_0x2df25f){if(_0x2df25f){return[_0x2df25f,![]];}return db['SmsInteraction'][_0x7369('0x4f')](_0x5a46c2)['then'](function(_0x1444b9){return[_0x1444b9,!![]];});});}})[_0x7369('0x8d')](function(_0x26e7d0,_0x302d5b){_0x3a1e1b[_0x7369('0x8e')]=_0x26e7d0[_0x7369('0x8f')]({'plain':!![]});_0x3a1e1b[_0x7369('0x8e')]['created']=![];if(_0x302d5b){if(_0x3a1e1b[_0x7369('0x63')][_0x7369('0x90')]){_0x3a1e1b[_0x7369('0x91')][_0x7369('0x92')]({'id':0x0,'priority':_0x3a1e1b[_0x7369('0x91')][_0x7369('0x3c')]+0x1,'app':_0x7369('0x93'),'appdata':_0x7369('0x94'),'interval':_0x7369('0x95')});}_0x3a1e1b[_0x7369('0x8e')]['created']=!![];}return db[_0x7369('0x96')]['create']({'phone':_0x3a1e1b[_0x7369('0x50')][_0x7369('0x74')],'messageId':_0x3a1e1b[_0x7369('0x50')][_0x7369('0x71')],'body':_0x3a1e1b[_0x7369('0x50')]['body'],'SmsAccountId':_0x42a0f4[_0x7369('0x52')]['id'],'SmsInteractionId':_0x26e7d0['id'],'direction':'in','ContactId':_0x26e7d0['ContactId'],'AttachmentId':_0x3a1e1b[_0x7369('0x50')][_0x7369('0x97')]});})['then'](function(_0x424acc){_0x3a1e1b['message']=_0x424acc;if(_0x3a1e1b['interaction'][_0x7369('0x98')]){return db[_0x7369('0x99')][_0x7369('0x51')]({'attributes':['id',_0x7369('0x31')],'where':{'id':_0x3a1e1b[_0x7369('0x8e')][_0x7369('0x98')]}})[_0x7369('0x19')](function(_0x16260c){if(_0x16260c){_0x3a1e1b[_0x7369('0x91')]['unshift']({'id':0x0,'priority':0x0,'app':_0x7369('0x9a'),'appdata':_0x16260c[_0x7369('0x31')]+','+(_0x3a1e1b[_0x7369('0x63')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x7369('0x9b'),_0x7369('0x9c'),_0x3a1e1b);});}return respondWithRpcPromise(_0x7369('0x9b'),_0x7369('0x9c'),_0x3a1e1b);})[_0x7369('0x19')](function(_0x19569a){if(_0x19569a){var _0x46c3f5=0xc8;var _0x1baf4c='receiveMessage';logger[_0x7369('0x1a')](_0x7369('0x1c'),_0x1baf4c,_0x46c3f5,'entity\x20found');logger[_0x7369('0x9d')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1baf4c,_0x46c3f5,_0x7369('0x9e'),JSON[_0x7369('0x1e')](_0x19569a));if(_0x3a1e1b['account'][_0x7369('0x6e')]===_0x7369('0x6f')){return _0x1743eb[_0x7369('0x25')](_0x46c3f5)[_0x7369('0x29')]('Content-Type',_0x7369('0x9f'))[_0x7369('0xa0')](_0x7369('0xa1'));}else{return _0x1743eb[_0x7369('0x25')](_0x46c3f5)[_0x7369('0x26')](_0x19569a);}}})[_0x7369('0x23')](handleError(_0x1743eb,null));};exports[_0x7369('0xa2')]=function(_0x1db493,_0x20b47c,_0x3198fa){return db[_0x7369('0x48')][_0x7369('0xa3')]({'where':{'id':_0x1db493[_0x7369('0x52')]['id']}})[_0x7369('0x19')](handleEntityNotFound(_0x20b47c,null))[_0x7369('0x19')](function(_0x342d88){if(_0x342d88){return db[_0x7369('0xa4')][_0x7369('0xa5')](function(_0x39fd72){return db['SmsApplication'][_0x7369('0x2e')]({'where':{'SmsAccountId':_0x1db493[_0x7369('0x52')]['id']},'transaction':_0x39fd72})[_0x7369('0x19')](function(_0x497e15){var _0x14cdf9=_[_0x7369('0x45')](_0x1db493['body'],function(_0x2d8f4a){_0x2d8f4a[_0x7369('0x5b')]=_0x1db493[_0x7369('0x52')]['id'];return _0x2d8f4a;});return db[_0x7369('0xa6')][_0x7369('0xa7')](_0x14cdf9,{'transaction':_0x39fd72});});})[_0x7369('0x19')](function(){return db[_0x7369('0xa6')][_0x7369('0xa8')]({'where':{'SmsAccountId':_0x1db493[_0x7369('0x52')]['id']},'order':_0x7369('0x65')});});}})[_0x7369('0x19')](respondWithResult(_0x20b47c,null))['catch'](handleError(_0x20b47c,null));};exports[_0x7369('0xa9')]=function(_0x40230c,_0x1f31c8,_0x218e89){var _0x25b483={};var _0x162a41={};var _0x2a821d;var _0x5c617d;return db[_0x7369('0x48')][_0x7369('0xa3')]({'where':{'id':_0x40230c[_0x7369('0x52')]['id']}})['then'](handleEntityNotFound(_0x1f31c8,null))['then'](function(_0x332e25){if(_0x332e25){_0x2a821d=_0x332e25;_0x162a41['model']=_[_0x7369('0x34')](db[_0x7369('0xa6')][_0x7369('0x33')]);_0x162a41[_0x7369('0x36')]=_['keys'](_0x40230c['query']);_0x162a41[_0x7369('0x4e')]=_['intersection'](_0x162a41[_0x7369('0x39')],_0x162a41['query']);_0x25b483[_0x7369('0x3a')]=_[_0x7369('0x38')](_0x162a41[_0x7369('0x39')],qs[_0x7369('0x3b')](_0x40230c['query'][_0x7369('0x3b')]));_0x25b483[_0x7369('0x3a')]=_0x25b483[_0x7369('0x3a')][_0x7369('0x3c')]?_0x25b483['attributes']:_0x162a41[_0x7369('0x39')];_0x25b483['order']=qs[_0x7369('0x40')](_0x40230c[_0x7369('0x36')]['sort']);_0x25b483['where']=qs['filters'](_[_0x7369('0x5e')](_0x40230c[_0x7369('0x36')],_0x162a41[_0x7369('0x4e')]));if(_0x40230c[_0x7369('0x36')][_0x7369('0x46')]){_0x25b483[_0x7369('0x44')]=_['merge'](_0x25b483[_0x7369('0x44')],{'$or':_['map'](_0x25b483[_0x7369('0x3a')],function(_0x205d24){var _0x86a569={};_0x86a569[_0x205d24]={'$like':'%'+_0x40230c[_0x7369('0x36')][_0x7369('0x46')]+'%'};return _0x86a569;})});}_0x25b483=_[_0x7369('0x43')]({},_0x25b483,_0x40230c[_0x7369('0x47')]);return _0x2a821d[_0x7369('0xa9')](_0x25b483);}})[_0x7369('0x19')](function(_0x9da60c){if(_0x9da60c){_0x5c617d=_0x9da60c[_0x7369('0x3c')];if(!_0x40230c['query']['hasOwnProperty']('nolimit')){_0x25b483[_0x7369('0x28')]=qs['limit'](_0x40230c[_0x7369('0x36')]['limit']);_0x25b483[_0x7369('0x27')]=qs[_0x7369('0x27')](_0x40230c['query']['offset']);}return _0x2a821d['getApplications'](_0x25b483);}})['then'](function(_0xb9300c){if(_0xb9300c){return _0xb9300c?{'count':_0x5c617d,'rows':_0xb9300c}:null;}})['then'](respondWithResult(_0x1f31c8,null))[_0x7369('0x23')](handleError(_0x1f31c8,null));};exports[_0x7369('0xaa')]=function(_0x578398,_0x522bee,_0x7d3eb5){var _0x50d02d={'raw':![],'where':{}};var _0x8ead6a={};var _0x194d7c={'count':0x0,'rows':[]};return db['SmsAccount'][_0x7369('0xa3')]({'where':{'id':_0x578398[_0x7369('0x52')]['id']}})[_0x7369('0x19')](handleEntityNotFound(_0x522bee,null))['then'](function(_0x291a1f){if(_0x291a1f){_0x8ead6a[_0x7369('0x39')]=_[_0x7369('0x34')](db[_0x7369('0x8c')]['rawAttributes']);_0x8ead6a[_0x7369('0x36')]=_['keys'](_0x578398[_0x7369('0x36')]);_0x8ead6a[_0x7369('0x4e')]=_[_0x7369('0x38')](_0x8ead6a[_0x7369('0x39')],_0x8ead6a[_0x7369('0x36')]);_0x50d02d[_0x7369('0x3a')]=_['intersection'](_0x8ead6a['model'],qs[_0x7369('0x3b')](_0x578398[_0x7369('0x36')][_0x7369('0x3b')]));_0x50d02d[_0x7369('0x3a')]=_0x50d02d[_0x7369('0x3a')]['length']?_0x50d02d['attributes']:_0x8ead6a[_0x7369('0x39')];if(!_0x578398[_0x7369('0x36')][_0x7369('0x3d')](_0x7369('0x3e'))){_0x50d02d[_0x7369('0x28')]=qs['limit'](_0x578398[_0x7369('0x36')]['limit']);_0x50d02d[_0x7369('0x27')]=qs[_0x7369('0x27')](_0x578398[_0x7369('0x36')][_0x7369('0x27')]);}_0x50d02d[_0x7369('0x3f')]=qs['sort'](_0x578398[_0x7369('0x36')][_0x7369('0x40')]);_0x50d02d[_0x7369('0x44')]=qs[_0x7369('0x4e')](_[_0x7369('0x5e')](_0x578398['query'],_0x8ead6a[_0x7369('0x4e')]));_0x50d02d['where'][_0x7369('0x5b')]=_0x291a1f['id'];if(_0x578398[_0x7369('0x36')][_0x7369('0x46')]){_0x50d02d[_0x7369('0x44')]=_['merge'](_0x50d02d['where'],{'$or':_[_0x7369('0x45')](_0x50d02d['attributes'],function(_0xacce03){var _0x1e45a7={};_0x1e45a7[_0xacce03]={'$like':'%'+_0x578398[_0x7369('0x36')]['filter']+'%'};return _0x1e45a7;})});}_0x50d02d=_[_0x7369('0x43')]({},_0x50d02d,_0x578398[_0x7369('0x47')]);return db[_0x7369('0x8c')][_0x7369('0x49')]({'where':_0x50d02d[_0x7369('0x44')]})[_0x7369('0x19')](function(_0x3d1514){_0x194d7c[_0x7369('0x49')]=_0x3d1514;if(_0x578398[_0x7369('0x36')][_0x7369('0x4a')]){_0x50d02d['include']=[{'model':db[_0x7369('0x67')],'as':'Contact','required':![]},{'model':db[_0x7369('0x99')],'as':_0x7369('0xab'),'attributes':[_0x7369('0x31'),'fullname',_0x7369('0xac')],'required':![]},{'model':db[_0x7369('0xad')],'as':_0x7369('0xae'),'attributes':['id',_0x7369('0x31'),_0x7369('0xaf')],'where':_0x578398[_0x7369('0x36')][_0x7369('0xb0')]?{'id':_0x578398['query'][_0x7369('0xb0')]}:undefined,'required':_0x578398[_0x7369('0x36')][_0x7369('0xb0')]?!![]:![]}];}return db[_0x7369('0x8c')][_0x7369('0x57')](_0x50d02d);})[_0x7369('0x19')](function(_0x3ff6d){_0x194d7c['rows']=_0x3ff6d;return _0x194d7c;});}})['then'](respondWithFilteredResult(_0x522bee,_0x50d02d))['catch'](handleError(_0x522bee,null));};exports[_0x7369('0xa0')]=function(_0x1b508a,_0x20aabd,_0x5b6564){var _0x2475a7,_0xdda15c,_0x3c6cd5;if(_[_0x7369('0x7d')](_0x1b508a[_0x7369('0x50')][_0x7369('0x50')])||_0x1b508a[_0x7369('0x50')][_0x7369('0x50')]===''){throw new db[(_0x7369('0x68'))][(_0x7369('0x7f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7369('0x7d')](_0x1b508a[_0x7369('0x50')]['to'])){throw new db[(_0x7369('0x68'))][(_0x7369('0x7f'))](_0x7369('0xb1'));}_0x2475a7=_0x1b508a[_0x7369('0x50')]['to'];return db[_0x7369('0x48')]['find']({'where':{'id':_0x1b508a['params']['id']},'include':[{'model':db[_0x7369('0xb2')],'as':'List','include':[{'model':db['CmContact'],'as':_0x7369('0x86'),'where':{'mobile':_0x2475a7},'limit':0x1,'order':[[_0x7369('0x6c'),_0x7369('0x87')]]}]}]})[_0x7369('0x19')](handleEntityNotFound(_0x20aabd,null))[_0x7369('0x19')](function(_0x39cbbd){if(_0x39cbbd&&_0x39cbbd[_0x7369('0xb3')]){_0xdda15c=_0x39cbbd[_0x7369('0x8f')]({'plain':!![]});if(_0xdda15c[_0x7369('0xb3')]&&_0xdda15c['List']['Contacts'][_0x7369('0x3c')]){return _0xdda15c['List'][_0x7369('0x86')][0x0];}return db[_0x7369('0x67')]['create'](_[_0x7369('0x8a')](_0x1b508a[_0x7369('0x50')],{'firstName':_0x2475a7,'mobile':_0x2475a7,'phone':_0x2475a7,'ListId':_0xdda15c[_0x7369('0x85')]}));}})[_0x7369('0x19')](handleEntityNotFound(_0x20aabd,null))[_0x7369('0x19')](function(_0xf36e9){if(_0xf36e9){_0x3c6cd5=_0xf36e9;return db[_0x7369('0x8c')][_0x7369('0x51')]({'where':{'ContactId':_0x3c6cd5['id'],'closed':![],'SmsAccountId':_0xdda15c['id']}})[_0x7369('0x19')](function(_0x3f4e55){if(_0x3f4e55){return[_0x3f4e55,![]];}return db[_0x7369('0x8c')][_0x7369('0x4f')]({'UserId':_0x1b508a['user']['id'],'ContactId':_0x3c6cd5['id'],'SmsAccountId':_0xdda15c['id'],'phone':_0x2475a7,'firstMsgDirection':'out','Messages':[_[_0x7369('0x43')](_0x1b508a[_0x7369('0x50')],{'read':![],'body':_0x1b508a[_0x7369('0x50')][_0x7369('0x50')],'phone':_0x2475a7,'SmsAccountId':_0xdda15c['id'],'UserId':_0x1b508a['user']['id'],'ContactId':_0x3c6cd5['id']})]},{'include':[{'model':db[_0x7369('0x96')],'as':_0x7369('0xb4')}]})[_0x7369('0x19')](function(_0x574c56){return[_0x574c56,!![]];});});}})[_0x7369('0x8d')](function(_0x2f3cf7,_0x17d59a){if(_0x17d59a){return _0x2f3cf7;}return db['SmsMessage'][_0x7369('0x4f')](_[_0x7369('0x43')](_0x1b508a['body'],{'read':![],'body':_0x1b508a['body']['body'],'phone':_0x2475a7,'SmsAccountId':_0xdda15c['id'],'SmsInteractionId':_0x2f3cf7['id'],'UserId':_0x1b508a[_0x7369('0xb5')]['id'],'ContactId':_0x3c6cd5['id']}))[_0x7369('0x19')](function(_0x14fed8){_0x2f3cf7[_0x7369('0xb6')][_0x7369('0xb4')]=[];_0x2f3cf7[_0x7369('0xb6')][_0x7369('0xb4')][_0x7369('0x92')](_0x14fed8[_0x7369('0xb6')]);return _0x2f3cf7;});})[_0x7369('0x19')](respondWithResult(_0x20aabd,null))[_0x7369('0x23')](handleError(_0x20aabd,null));};exports[_0x7369('0x25')]=function(_0x51ff47,_0x3d0130,_0x32d118){if(_0x51ff47[_0x7369('0x50')]['id']){delete _0x51ff47[_0x7369('0x50')]['id'];}var _0x4141b9,_0xbc6584,_0x3ea781;return db[_0x7369('0x48')][_0x7369('0x51')]({'where':{'id':_0x51ff47['params']['id']}})['then'](handleEntityNotFound(_0x3d0130,null))['then'](function(_0x29ebed){if(_0x29ebed){_0x3ea781=_0x29ebed;logger[_0x7369('0x9d')](_0x7369('0x1c'),'status',_0x7369('0xb7'),_0x29ebed[_0x7369('0x6e')],util['inspect'](_0x51ff47[_0x7369('0x50')],{'showHidden':![],'depth':null}));switch(_0x29ebed['type']){case _0x7369('0x73'):if(_0x51ff47[_0x7369('0x50')][_0x7369('0xb8')]&&_0x51ff47[_0x7369('0x50')][_0x7369('0x25')]){_0xbc6584=_0x51ff47[_0x7369('0x50')][_0x7369('0x25')];return db[_0x7369('0x96')][_0x7369('0x51')]({'where':{'messageId':_0x51ff47[_0x7369('0x50')][_0x7369('0xb8')]}});}break;case _0x7369('0x77'):if(_0x51ff47[_0x7369('0x50')][_0x7369('0xb9')]&&_0x51ff47[_0x7369('0x50')][_0x7369('0xba')]){_0xbc6584=_0x51ff47[_0x7369('0x50')]['statusInt'];return db[_0x7369('0x96')][_0x7369('0x51')]({'where':{'messageId':_0x51ff47[_0x7369('0x50')]['requestid']}});}break;case _0x7369('0x78'):if(_0x51ff47['body']['message_id']&&_0x51ff47['body'][_0x7369('0xbb')]){_0xbc6584=_0x51ff47['body'][_0x7369('0xbb')];return db[_0x7369('0x96')][_0x7369('0x51')]({'where':{'messageId':_0x51ff47[_0x7369('0x50')][_0x7369('0x79')]}});}break;}}})[_0x7369('0x19')](handleEntityNotFound(_0x3d0130,null))[_0x7369('0x19')](function(_0x182131){if(_0x182131){_0x4141b9=_0x182131;switch(_0x3ea781[_0x7369('0x6e')]){case _0x7369('0x73'):if(_0xbc6584===_0x7369('0xbc')){return _0x4141b9['update']({'read':!![]});}else{logger[_0x7369('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','skebby',util[_0x7369('0xbd')](_0x51ff47[_0x7369('0x50')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0xbc6584==='1'){return _0x4141b9[_0x7369('0x2d')]({'read':!![]});}else{logger[_0x7369('0x1f')](_0x7369('0x1c'),_0x7369('0x25'),_0x7369('0x73'),util[_0x7369('0xbd')](_0x51ff47[_0x7369('0x50')],{'showHidden':![],'depth':null}));}break;case _0x7369('0x78'):if(!_0x51ff47[_0x7369('0x50')][_0x7369('0xbe')]&&_0xbc6584>=0xc8&&_0xbc6584<=0xce){return _0x4141b9[_0x7369('0x2d')]({'read':!![]});}else{logger[_0x7369('0x1f')](_0x7369('0x1c'),_0x7369('0x25'),_0x7369('0x78'),util[_0x7369('0xbd')](_0x51ff47['body'],{'showHidden':![],'depth':null}));}break;}return _0x4141b9;}})['then'](respondWithResult(_0x3d0130,null))[_0x7369('0x23')](handleError(_0x3d0130,null));};exports[_0x7369('0xbf')]=function(_0xbd7ecc,_0x45725e,_0xecff01){return db['SmsAccount'][_0x7369('0x51')]({'where':{'id':_0xbd7ecc[_0x7369('0x52')]['id']}})[_0x7369('0x19')](handleEntityNotFound(_0x45725e,null))[_0x7369('0x19')](function(_0x37509d){if(_0x37509d){return _0x37509d[_0x7369('0xbf')](_0xbd7ecc[_0x7369('0x50')][_0x7369('0x59')],_[_0x7369('0x89')](_0xbd7ecc[_0x7369('0x50')],['ids','id'])||{})['spread'](function(_0x19964a){for(var _0xef2b7f=0x0;_0xef2b7f<_0xbd7ecc[_0x7369('0x50')][_0x7369('0x59')][_0x7369('0x3c')];_0xef2b7f+=0x1){socket[_0x7369('0xc0')](_0x7369('0xc1'),{'UserId':_0xbd7ecc['body'][_0x7369('0x59')][_0xef2b7f],'SmsAccountId':_0xbd7ecc[_0x7369('0x52')]['id']});}return _0x19964a;});}})['then'](respondWithResult(_0x45725e,null))[_0x7369('0x23')](handleError(_0x45725e,null));};exports[_0x7369('0xc2')]=function(_0x232240,_0x2d7a76,_0x5c1a0d){var _0x22da69;return db['SmsAccount'][_0x7369('0x51')]({'where':{'id':_0x232240[_0x7369('0x52')]['id']}})[_0x7369('0x19')](handleEntityNotFound(_0x2d7a76,null))[_0x7369('0x19')](function(_0x3a7e63){if(_0x3a7e63){return _0x3a7e63['removeAgents'](_0x232240[_0x7369('0x36')][_0x7369('0x59')])[_0x7369('0x19')](function(_0x410ab6){if(_[_0x7369('0xc3')](_0x232240[_0x7369('0x36')][_0x7369('0x59')])){for(var _0x5da1a4=0x0;_0x5da1a4<_0x232240[_0x7369('0x36')][_0x7369('0x59')][_0x7369('0x3c')];_0x5da1a4+=0x1){socket[_0x7369('0xc0')]('userSmsAccount:remove',{'UserId':_0x232240[_0x7369('0x36')]['ids'][_0x5da1a4],'SmsAccountId':_0x232240[_0x7369('0x52')]['id']});}}else{socket[_0x7369('0xc0')](_0x7369('0xc4'),{'UserId':_0x232240['query']['ids'],'SmsAccountId':_0x232240[_0x7369('0x52')]['id']});}});}})[_0x7369('0x19')](respondWithStatusCode(_0x2d7a76,null))[_0x7369('0x23')](handleError(_0x2d7a76,null));};exports[_0x7369('0xc5')]=function(_0x4ba96c,_0x15df0e,_0x2a310d){var _0x114b6e={};var _0x71c91d={};var _0x53f986;var _0x16312f;return db['SmsAccount'][_0x7369('0xa3')]({'where':{'id':_0x4ba96c[_0x7369('0x52')]['id']}})[_0x7369('0x19')](handleEntityNotFound(_0x15df0e,null))[_0x7369('0x19')](function(_0x528f68){if(_0x528f68){_0x53f986=_0x528f68;_0x71c91d['model']=_['keys'](db[_0x7369('0x99')]['rawAttributes']);_0x71c91d[_0x7369('0x36')]=_[_0x7369('0x34')](_0x4ba96c[_0x7369('0x36')]);_0x71c91d[_0x7369('0x4e')]=_[_0x7369('0x38')](_0x71c91d[_0x7369('0x39')],_0x71c91d[_0x7369('0x36')]);_0x114b6e[_0x7369('0x3a')]=_[_0x7369('0x38')](_0x71c91d['model'],qs[_0x7369('0x3b')](_0x4ba96c['query']['fields']));_0x114b6e[_0x7369('0x3a')]=_0x114b6e[_0x7369('0x3a')][_0x7369('0x3c')]?_0x114b6e['attributes']:_0x71c91d[_0x7369('0x39')];_0x114b6e[_0x7369('0x3f')]=qs[_0x7369('0x40')](_0x4ba96c[_0x7369('0x36')][_0x7369('0x40')]);_0x114b6e['where']=qs[_0x7369('0x4e')](_[_0x7369('0x5e')](_0x4ba96c[_0x7369('0x36')],_0x71c91d[_0x7369('0x4e')]));if(_0x4ba96c['query'][_0x7369('0x46')]){_0x114b6e['where']=_[_0x7369('0x43')](_0x114b6e['where'],{'$or':_[_0x7369('0x45')](_0x114b6e['attributes'],function(_0xd9993c){var _0x40736c={};_0x40736c[_0xd9993c]={'$like':'%'+_0x4ba96c['query'][_0x7369('0x46')]+'%'};return _0x40736c;})});}_0x114b6e=_['merge']({},_0x114b6e,_0x4ba96c[_0x7369('0x47')]);return _0x53f986['getAgents'](_0x114b6e);}})[_0x7369('0x19')](function(_0x428167){if(_0x428167){_0x16312f=_0x428167[_0x7369('0x3c')];if(!_0x4ba96c[_0x7369('0x36')][_0x7369('0x3d')]('nolimit')){_0x114b6e[_0x7369('0x28')]=qs['limit'](_0x4ba96c['query'][_0x7369('0x28')]);_0x114b6e[_0x7369('0x27')]=qs[_0x7369('0x27')](_0x4ba96c[_0x7369('0x36')][_0x7369('0x27')]);}return _0x53f986[_0x7369('0xc5')](_0x114b6e);}})[_0x7369('0x19')](function(_0x77a8c1){if(_0x77a8c1){return _0x77a8c1?{'count':_0x16312f,'rows':_0x77a8c1}:null;}})[_0x7369('0x19')](respondWithResult(_0x15df0e,null))[_0x7369('0x23')](handleError(_0x15df0e,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 3e810ce..07b00b9 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 _0x2c81=['hook','exports','SmsAccount','save','update','emit','hasOwnProperty'];(function(_0x5a051b,_0x13d2aa){var _0x16f3c9=function(_0x2df679){while(--_0x2df679){_0x5a051b['push'](_0x5a051b['shift']());}};_0x16f3c9(++_0x13d2aa);}(_0x2c81,0xbf));var _0x12c8=function(_0x2e38c9,_0x54109b){_0x2e38c9=_0x2e38c9-0x0;var _0x7c3dc0=_0x2c81[_0x2e38c9];return _0x7c3dc0;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db'][_0x12c8('0x0')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x12c8('0x1'),'afterUpdate':_0x12c8('0x2'),'afterDestroy':'remove'};function emitEvent(_0xa9fc9c){return function(_0x1858cf,_0x48383c,_0x2abe4e){SmsAccountEvents[_0x12c8('0x3')](_0xa9fc9c+':'+_0x1858cf['id'],_0x1858cf);SmsAccountEvents['emit'](_0xa9fc9c,_0x1858cf);_0x2abe4e(null);};}for(var e in events){if(events[_0x12c8('0x4')](e)){var event=events[e];SmsAccount[_0x12c8('0x5')](e,emitEvent(event));}}module[_0x12c8('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0x2d69=['events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x1b97f6,_0x114c33){var _0x415b27=function(_0x316363){while(--_0x316363){_0x1b97f6['push'](_0x1b97f6['shift']());}};_0x415b27(++_0x114c33);}(_0x2d69,0xaa));var _0x92d6=function(_0x38d1ae,_0x5d2459){_0x38d1ae=_0x38d1ae-0x0;var _0x371fe3=_0x2d69[_0x38d1ae];return _0x371fe3;};'use strict';var EventEmitter=require(_0x92d6('0x0'));var SmsAccount=require(_0x92d6('0x1'))['db'][_0x92d6('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x92d6('0x3')](0x0);var events={'afterCreate':_0x92d6('0x4'),'afterUpdate':_0x92d6('0x5'),'afterDestroy':_0x92d6('0x6')};function emitEvent(_0x68a9a7){return function(_0xa0a91b,_0x31ede9,_0x5e2f89){SmsAccountEvents['emit'](_0x68a9a7+':'+_0xa0a91b['id'],_0xa0a91b);SmsAccountEvents[_0x92d6('0x7')](_0x68a9a7,_0xa0a91b);_0x5e2f89(null);};}for(var e in events){if(events[_0x92d6('0x8')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x92d6('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 56f790c..5031482 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 _0x380a=['lodash','util','../../config/logger','moment','./smsAccount.attributes','define','SmsAccount'];(function(_0x336972,_0x1a4f73){var _0x39e226=function(_0x1a016c){while(--_0x1a016c){_0x336972['push'](_0x336972['shift']());}};_0x39e226(++_0x1a4f73);}(_0x380a,0x16c));var _0xa380=function(_0x22cb5f,_0x2cdd63){_0x22cb5f=_0x22cb5f-0x0;var _0x274d36=_0x380a[_0x22cb5f];return _0x274d36;};'use strict';var _=require(_0xa380('0x0'));var util=require(_0xa380('0x1'));var logger=require(_0xa380('0x2'))('api');var moment=require(_0xa380('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xa380('0x4'));module['exports']=function(_0x57953d,_0xf00c9a){return _0x57953d[_0xa380('0x5')](_0xa380('0x6'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cf6=['util','../../config/logger','api','moment','bluebird','request-promise','exports','define','SmsAccount','sms_accounts'];(function(_0x5f1cf7,_0x47d9a9){var _0x2ab77b=function(_0x3b8a33){while(--_0x3b8a33){_0x5f1cf7['push'](_0x5f1cf7['shift']());}};_0x2ab77b(++_0x47d9a9);}(_0x1cf6,0x1a4));var _0x61cf=function(_0x4d011e,_0xf0ff0c){_0x4d011e=_0x4d011e-0x0;var _0x3adb56=_0x1cf6[_0x4d011e];return _0x3adb56;};'use strict';var _=require('lodash');var util=require(_0x61cf('0x0'));var logger=require(_0x61cf('0x1'))(_0x61cf('0x2'));var moment=require(_0x61cf('0x3'));var BPromise=require(_0x61cf('0x4'));var rp=require(_0x61cf('0x5'));var attributes=require('./smsAccount.attributes');module[_0x61cf('0x6')]=function(_0x2c3db1,_0x2dbca1){return _0x2c3db1[_0x61cf('0x7')](_0x61cf('0x8'),attributes,{'tableName':_0x61cf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 68decc7..1cdad9e 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 _0xd3f5=['SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','where','include','model','attributes','map','lodash','util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','localhost','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xd3f5,0xd0));var _0x5d3f=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xd3f5[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x5d3f('0x0'));var util=require(_0x5d3f('0x1'));var moment=require(_0x5d3f('0x2'));var BPromise=require(_0x5d3f('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5d3f('0x4'))(_0x5d3f('0x5'));var config=require(_0x5d3f('0x6'));var jayson=require(_0x5d3f('0x7'));var client=jayson['client']['http']({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0x5d3f('0x8'),'port':0x18eb});require('./smsAccount.socket')[_0x5d3f('0x9')](socket);function respondWithRpcPromise(_0xaa0b8,_0x3fa4a1,_0x2ed9b2){return new BPromise(function(_0x4d67c8,_0x286085){return client[_0x5d3f('0xa')](_0xaa0b8,_0x2ed9b2)[_0x5d3f('0xb')](function(_0xa8499c){logger[_0x5d3f('0xc')](_0x5d3f('0xd'),_0x3fa4a1,_0x5d3f('0xe'));logger[_0x5d3f('0xf')](_0x5d3f('0x10'),_0x3fa4a1,'request\x20sent',JSON[_0x5d3f('0x11')](_0xa8499c));if(_0xa8499c[_0x5d3f('0x12')]){if(_0xa8499c[_0x5d3f('0x12')][_0x5d3f('0x13')]===0x1f4){logger[_0x5d3f('0x12')]('SmsAccount,\x20%s,\x20%s',_0x3fa4a1,_0xa8499c[_0x5d3f('0x12')][_0x5d3f('0x14')]);return _0x286085(_0xa8499c[_0x5d3f('0x12')][_0x5d3f('0x14')]);}logger[_0x5d3f('0x12')](_0x5d3f('0xd'),_0x3fa4a1,_0xa8499c['error']['message']);return _0x4d67c8(_0xa8499c['error'][_0x5d3f('0x14')]);}else{logger[_0x5d3f('0xc')](_0x5d3f('0xd'),_0x3fa4a1,'request\x20sent');_0x4d67c8(_0xa8499c[_0x5d3f('0x15')][_0x5d3f('0x14')]);}})[_0x5d3f('0x16')](function(_0x1ea782){logger[_0x5d3f('0x12')](_0x5d3f('0xd'),_0x3fa4a1,_0x1ea782);_0x286085(_0x1ea782);});});}exports[_0x5d3f('0x17')]=function(_0x35d9ed){var _0x46f2cb=this;return new Promise(function(_0x3fb2d6,_0x5ac12a){return db[_0x5d3f('0x18')][_0x5d3f('0x19')]({'raw':_0x35d9ed[_0x5d3f('0x1a')]?_0x35d9ed[_0x5d3f('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x35d9ed[_0x5d3f('0x1a')]?_0x35d9ed[_0x5d3f('0x1a')][_0x5d3f('0x1b')]||null:null,'attributes':_0x35d9ed[_0x5d3f('0x1a')]?_0x35d9ed[_0x5d3f('0x1a')]['attributes']||null:null,'include':_0x35d9ed[_0x5d3f('0x1a')]?_0x35d9ed['options'][_0x5d3f('0x1c')]?_['map'](_0x35d9ed[_0x5d3f('0x1a')]['include'],function(_0x1eed39){return{'model':db[_0x1eed39[_0x5d3f('0x1d')]],'as':_0x1eed39['as'],'attributes':_0x1eed39[_0x5d3f('0x1e')],'include':_0x1eed39['include']?_[_0x5d3f('0x1f')](_0x1eed39['include'],function(_0x235571){return{'model':db[_0x235571[_0x5d3f('0x1d')]],'as':_0x235571['as'],'attributes':_0x235571[_0x5d3f('0x1e')],'include':_0x235571[_0x5d3f('0x1c')]?_[_0x5d3f('0x1f')](_0x235571[_0x5d3f('0x1c')],function(_0x1bb051){return{'model':db[_0x1bb051[_0x5d3f('0x1d')]],'as':_0x1bb051['as'],'attributes':_0x1bb051[_0x5d3f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5d3f('0xb')](function(_0x359109){logger['info'](_0x5d3f('0x17'),_0x35d9ed);logger[_0x5d3f('0xf')]('ShowSmsAccount',_0x35d9ed,JSON['stringify'](_0x359109));_0x3fb2d6(_0x359109);})[_0x5d3f('0x16')](function(_0x5e35f3){logger[_0x5d3f('0x12')](_0x5d3f('0x17'),_0x5e35f3[_0x5d3f('0x14')],_0x35d9ed);_0x5ac12a(_0x46f2cb[_0x5d3f('0x12')](0x1f4,_0x5e35f3[_0x5d3f('0x14')]));});});}; \ No newline at end of file +var _0xddbe=['error','code','message','result','catch','ShowSmsAccount','SmsAccount','options','raw','where','attributes','include','model','then','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','./smsAccount.socket','register','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x35c177,_0x5a4d53){var _0x4fb743=function(_0x51eed7){while(--_0x51eed7){_0x35c177['push'](_0x35c177['shift']());}};_0x4fb743(++_0x5a4d53);}(_0xddbe,0x1c0));var _0xeddb=function(_0x39fc9e,_0x4fa269){_0x39fc9e=_0x39fc9e-0x0;var _0x541236=_0xddbe[_0x39fc9e];return _0x541236;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xeddb('0x0'));var BPromise=require('bluebird');var rs=require(_0xeddb('0x1'));var fs=require('fs');var db=require(_0xeddb('0x2'))['db'];var utils=require(_0xeddb('0x3'));var logger=require(_0xeddb('0x4'))(_0xeddb('0x5'));var config=require(_0xeddb('0x6'));var jayson=require(_0xeddb('0x7'));var client=jayson[_0xeddb('0x8')][_0xeddb('0x9')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0xeddb('0xa'),'port':0x18eb});require(_0xeddb('0xb'))[_0xeddb('0xc')](socket);function respondWithRpcPromise(_0x18739f,_0x5ab34b,_0x7849e0){return new BPromise(function(_0x3dbe56,_0x34486a){return client['request'](_0x18739f,_0x7849e0)['then'](function(_0x43644d){logger[_0xeddb('0xd')](_0xeddb('0xe'),_0x5ab34b,'request\x20sent');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5ab34b,_0xeddb('0xf'),JSON[_0xeddb('0x10')](_0x43644d));if(_0x43644d[_0xeddb('0x11')]){if(_0x43644d[_0xeddb('0x11')][_0xeddb('0x12')]===0x1f4){logger['error'](_0xeddb('0xe'),_0x5ab34b,_0x43644d[_0xeddb('0x11')]['message']);return _0x34486a(_0x43644d[_0xeddb('0x11')][_0xeddb('0x13')]);}logger['error'](_0xeddb('0xe'),_0x5ab34b,_0x43644d['error'][_0xeddb('0x13')]);return _0x3dbe56(_0x43644d[_0xeddb('0x11')][_0xeddb('0x13')]);}else{logger['info'](_0xeddb('0xe'),_0x5ab34b,'request\x20sent');_0x3dbe56(_0x43644d[_0xeddb('0x14')][_0xeddb('0x13')]);}})[_0xeddb('0x15')](function(_0x54925d){logger[_0xeddb('0x11')](_0xeddb('0xe'),_0x5ab34b,_0x54925d);_0x34486a(_0x54925d);});});}exports[_0xeddb('0x16')]=function(_0x5efe19){var _0x3f10c1=this;return new Promise(function(_0x3c802b,_0x10e254){return db[_0xeddb('0x17')]['find']({'raw':_0x5efe19[_0xeddb('0x18')]?_0x5efe19[_0xeddb('0x18')][_0xeddb('0x19')]===undefined?!![]:![]:!![],'where':_0x5efe19['options']?_0x5efe19[_0xeddb('0x18')][_0xeddb('0x1a')]||null:null,'attributes':_0x5efe19[_0xeddb('0x18')]?_0x5efe19['options'][_0xeddb('0x1b')]||null:null,'include':_0x5efe19[_0xeddb('0x18')]?_0x5efe19['options']['include']?_['map'](_0x5efe19['options']['include'],function(_0x51891c){return{'model':db[_0x51891c['model']],'as':_0x51891c['as'],'attributes':_0x51891c[_0xeddb('0x1b')],'include':_0x51891c[_0xeddb('0x1c')]?_['map'](_0x51891c[_0xeddb('0x1c')],function(_0x3f8b6d){return{'model':db[_0x3f8b6d[_0xeddb('0x1d')]],'as':_0x3f8b6d['as'],'attributes':_0x3f8b6d['attributes'],'include':_0x3f8b6d[_0xeddb('0x1c')]?_['map'](_0x3f8b6d[_0xeddb('0x1c')],function(_0x4a2009){return{'model':db[_0x4a2009[_0xeddb('0x1d')]],'as':_0x4a2009['as'],'attributes':_0x4a2009[_0xeddb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xeddb('0x1e')](function(_0x3c04a5){logger[_0xeddb('0xd')](_0xeddb('0x16'),_0x5efe19);logger['debug'](_0xeddb('0x16'),_0x5efe19,JSON['stringify'](_0x3c04a5));_0x3c802b(_0x3c04a5);})[_0xeddb('0x15')](function(_0x18329c){logger[_0xeddb('0x11')](_0xeddb('0x16'),_0x18329c['message'],_0x5efe19);_0x10e254(_0x3f10c1[_0xeddb('0x11')](0x1f4,_0x18329c['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index b3506e7..583bdb6 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 _0x8c66=['./smsAccount.events','save','update','removeListener','register','smsAccount:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c66,0x78));var _0x68c6=function(_0x312428,_0x458f28){_0x312428=_0x312428-0x0;var _0x583514=_0x8c66[_0x312428];return _0x583514;};'use strict';var SmsAccountEvents=require(_0x68c6('0x0'));var events=[_0x68c6('0x1'),'remove',_0x68c6('0x2')];function createListener(_0x3a0e1f,_0x1de682){return function(_0x3f8076){_0x1de682['emit'](_0x3a0e1f,_0x3f8076);};}function removeListener(_0x5a99ae,_0x3e074a){return function(){SmsAccountEvents[_0x68c6('0x3')](_0x5a99ae,_0x3e074a);};}exports[_0x68c6('0x4')]=function(_0x2e06aa){for(var _0x7db558=0x0,_0x32b3ca=events['length'];_0x7db558<_0x32b3ca;_0x7db558++){var _0x2d3484=events[_0x7db558];var _0x1182ca=createListener(_0x68c6('0x5')+_0x2d3484,_0x2e06aa);SmsAccountEvents['on'](_0x2d3484,_0x1182ca);}}; \ No newline at end of file +var _0xed71=['length','./smsAccount.events','save','remove','update','emit','register'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xed71,0x1ba));var _0x1ed7=function(_0x3817a9,_0x29e215){_0x3817a9=_0x3817a9-0x0;var _0x443f30=_0xed71[_0x3817a9];return _0x443f30;};'use strict';var SmsAccountEvents=require(_0x1ed7('0x0'));var events=[_0x1ed7('0x1'),_0x1ed7('0x2'),_0x1ed7('0x3')];function createListener(_0x340617,_0x12c760){return function(_0x2accc1){_0x12c760[_0x1ed7('0x4')](_0x340617,_0x2accc1);};}function removeListener(_0x1dffeb,_0x2790aa){return function(){SmsAccountEvents['removeListener'](_0x1dffeb,_0x2790aa);};}exports[_0x1ed7('0x5')]=function(_0x981d67){for(var _0x49de84=0x0,_0x5013c9=events[_0x1ed7('0x6')];_0x49de84<_0x5013c9;_0x49de84++){var _0xeaa978=events[_0x49de84];var _0x4c3a3d=createListener('smsAccount:'+_0xeaa978,_0x981d67);SmsAccountEvents['on'](_0xeaa978,_0x4c3a3d);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index b8d74ee..62f146c 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 _0xda66=['./smsApplication.controller','isAuthenticated','get','/:id','show','post','create','put','delete','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4c0e5c,_0x32eb6a){var _0x5eceb3=function(_0x2a9bcf){while(--_0x2a9bcf){_0x4c0e5c['push'](_0x4c0e5c['shift']());}};_0x5eceb3(++_0x32eb6a);}(_0xda66,0xfa));var _0x6da6=function(_0x54b2b0,_0x55f332){_0x54b2b0=_0x54b2b0-0x0;var _0x1a0d6b=_0xda66[_0x54b2b0];return _0x1a0d6b;};'use strict';var multer=require('multer');var util=require(_0x6da6('0x0'));var path=require(_0x6da6('0x1'));var express=require('express');var router=express[_0x6da6('0x2')]();var auth=require(_0x6da6('0x3'));var interaction=require(_0x6da6('0x4'));var config=require(_0x6da6('0x5'));var controller=require(_0x6da6('0x6'));router['get']('/',auth[_0x6da6('0x7')](),controller['index']);router[_0x6da6('0x8')](_0x6da6('0x9'),auth[_0x6da6('0x7')](),controller[_0x6da6('0xa')]);router[_0x6da6('0xb')]('/',auth['isAuthenticated'](),controller[_0x6da6('0xc')]);router[_0x6da6('0xd')](_0x6da6('0x9'),auth[_0x6da6('0x7')](),controller['update']);router[_0x6da6('0xe')](_0x6da6('0x9'),auth[_0x6da6('0x7')](),controller['destroy']);module[_0x6da6('0xf')]=router; \ No newline at end of file +var _0x584d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get'];(function(_0x539d8c,_0x4beefe){var _0x133d1d=function(_0x3e1831){while(--_0x3e1831){_0x539d8c['push'](_0x539d8c['shift']());}};_0x133d1d(++_0x4beefe);}(_0x584d,0x1b9));var _0xd584=function(_0x43fbab,_0x29ecd2){_0x43fbab=_0x43fbab-0x0;var _0x258459=_0x584d[_0x43fbab];return _0x258459;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0xd584('0x0'));var router=express[_0xd584('0x1')]();var auth=require(_0xd584('0x2'));var interaction=require(_0xd584('0x3'));var config=require(_0xd584('0x4'));var controller=require(_0xd584('0x5'));router[_0xd584('0x6')]('/',auth[_0xd584('0x7')](),controller[_0xd584('0x8')]);router[_0xd584('0x6')](_0xd584('0x9'),auth[_0xd584('0x7')](),controller[_0xd584('0xa')]);router[_0xd584('0xb')]('/',auth[_0xd584('0x7')](),controller[_0xd584('0xc')]);router[_0xd584('0xd')](_0xd584('0x9'),auth[_0xd584('0x7')](),controller[_0xd584('0xe')]);router[_0xd584('0xf')](_0xd584('0x9'),auth[_0xd584('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 dc980f6..09a8280 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 _0xca27=['noop','*,*,*,*','exports','STRING'];(function(_0x5e4b85,_0x6cf965){var _0x5cd3cb=function(_0x589c9e){while(--_0x589c9e){_0x5e4b85['push'](_0x5e4b85['shift']());}};_0x5cd3cb(++_0x6cf965);}(_0xca27,0xde));var _0x7ca2=function(_0x58f7a9,_0x1a759f){_0x58f7a9=_0x58f7a9-0x0;var _0x270bee=_0xca27[_0x58f7a9];return _0x270bee;};'use strict';var Sequelize=require('sequelize');module[_0x7ca2('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x7ca2('0x1')],'allowNull':![],'defaultValue':_0x7ca2('0x2')},'appdata':{'type':Sequelize[_0x7ca2('0x1')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x7ca2('0x1')]},'interval':{'type':Sequelize[_0x7ca2('0x1')],'defaultValue':_0x7ca2('0x3')}}; \ No newline at end of file +var _0x24ce=['INTEGER','noop','STRING','sequelize'];(function(_0x490aa1,_0x3a23f7){var _0x1d1fd1=function(_0x5a6904){while(--_0x5a6904){_0x490aa1['push'](_0x490aa1['shift']());}};_0x1d1fd1(++_0x3a23f7);}(_0x24ce,0x1e7));var _0xe24c=function(_0x5c0f70,_0x6181b0){_0x5c0f70=_0x5c0f70-0x0;var _0x83b5ed=_0x24ce[_0x5c0f70];return _0x83b5ed;};'use strict';var Sequelize=require(_0xe24c('0x0'));module['exports']={'priority':{'type':Sequelize[_0xe24c('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe24c('0x2')},'appdata':{'type':Sequelize[_0xe24c('0x3')](0x1000),'defaultValue':''},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe24c('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index b519f5f..c31555a 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 _0xc164=['reject','save','update','then','destroy','error','name','send','index','SmsApplication','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','day','add','merge','map','filter','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','apply'];(function(_0x34933a,_0x327378){var _0x36abb4=function(_0x2d6814){while(--_0x2d6814){_0x34933a['push'](_0x34933a['shift']());}};_0x36abb4(++_0x327378);}(_0xc164,0x18e));var _0x4c16=function(_0x21948a,_0x4e8ac5){_0x21948a=_0x21948a-0x0;var _0x284a05=_0xc164[_0x21948a];return _0x284a05;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x4c16('0x0'));var moment=require(_0x4c16('0x1'));var BPromise=require(_0x4c16('0x2'));var Mustache=require(_0x4c16('0x3'));var util=require(_0x4c16('0x4'));var path=require(_0x4c16('0x5'));var sox=require(_0x4c16('0x6'));var csv=require(_0x4c16('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4c16('0x8'));var squel=require(_0x4c16('0x9'));var crypto=require(_0x4c16('0xa'));var jsforce=require(_0x4c16('0xb'));var deskjs=require(_0x4c16('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4c16('0xd'));var Papa=require(_0x4c16('0xe'));var qs=require(_0x4c16('0xf'));var logger=require(_0x4c16('0x10'))('api');var utils=require(_0x4c16('0x11'));var config=require(_0x4c16('0x12'));var db=require(_0x4c16('0x13'))['db'];function respondWithStatusCode(_0xeeae8f,_0x118889){_0x118889=_0x118889||0xcc;return function(_0x9849b6){if(_0x9849b6){return _0xeeae8f[_0x4c16('0x14')](_0x118889);}return _0xeeae8f[_0x4c16('0x15')](_0x118889)[_0x4c16('0x16')]();};}function respondWithResult(_0x5961bb,_0x4d24ca){_0x4d24ca=_0x4d24ca||0xc8;return function(_0x1be7a3){if(_0x1be7a3){return _0x5961bb[_0x4c16('0x15')](_0x4d24ca)['json'](_0x1be7a3);}};}function respondWithFilteredResult(_0x444bf3,_0x3b6de4){return function(_0x42df39){if(_0x42df39){var _0x4d32bb=_0x42df39[_0x4c16('0x17')],_0x57fd65=_0x3b6de4[_0x4c16('0x18')],_0x35eff4=_0x3b6de4['offset']+_0x3b6de4['limit'],_0x3e7455;if(_0x35eff4>=_0x4d32bb){_0x35eff4=_0x4d32bb;_0x3e7455=0xc8;}else{_0x3e7455=0xce;}_0x444bf3[_0x4c16('0x15')](_0x3e7455);return _0x444bf3[_0x4c16('0x19')](_0x4c16('0x1a'),_0x57fd65+'-'+_0x35eff4+'/'+_0x4d32bb)['json'](_0x42df39);}return null;};}function patchUpdates(_0x3aa010){return function(_0x5b235d){try{jsonpatch[_0x4c16('0x1b')](_0x5b235d,_0x3aa010,!![]);}catch(_0x4a205d){return BPromise[_0x4c16('0x1c')](_0x4a205d);}return _0x5b235d[_0x4c16('0x1d')]();};}function saveUpdates(_0xa191e1,_0x2b8641){return function(_0x3b326b){if(_0x3b326b){return _0x3b326b[_0x4c16('0x1e')](_0xa191e1)[_0x4c16('0x1f')](function(_0x2df15d){return _0x2df15d;});}return null;};}function removeEntity(_0x1345e1,_0xb480b6){return function(_0x5c9473){if(_0x5c9473){return _0x5c9473[_0x4c16('0x20')]()['then'](function(){_0x1345e1[_0x4c16('0x15')](0xcc)[_0x4c16('0x16')]();});}};}function handleEntityNotFound(_0x423b0e,_0x3c9265){return function(_0x1f3e94){if(!_0x1f3e94){_0x423b0e[_0x4c16('0x14')](0x194);}return _0x1f3e94;};}function handleError(_0x5c7f24,_0x122af7){_0x122af7=_0x122af7||0x1f4;return function(_0x47061e){logger[_0x4c16('0x21')](_0x47061e['stack']);if(_0x47061e[_0x4c16('0x22')]){delete _0x47061e['name'];}_0x5c7f24['status'](_0x122af7)[_0x4c16('0x23')](_0x47061e);};}exports[_0x4c16('0x24')]=function(_0x162dda,_0x51f527){var _0x1548a9={},_0x14d2d7={},_0x44fa47={'count':0x0,'rows':[]};var _0x321fbd=db[_0x4c16('0x25')][_0x4c16('0x26')];_0x14d2d7[_0x4c16('0x27')]=_[_0x4c16('0x28')](_0x321fbd);var _0x5f4ea2={'dateStart':_0x162dda[_0x4c16('0x29')][_0x4c16('0x2a')],'dateEnd':_0x162dda[_0x4c16('0x29')][_0x4c16('0x2b')]};delete _0x162dda[_0x4c16('0x29')][_0x4c16('0x2a')];delete _0x162dda[_0x4c16('0x29')][_0x4c16('0x2b')];_0x14d2d7[_0x4c16('0x29')]=_[_0x4c16('0x28')](_0x162dda[_0x4c16('0x29')]);_0x14d2d7[_0x4c16('0x2c')]=_[_0x4c16('0x2d')](_0x14d2d7[_0x4c16('0x27')],_0x14d2d7['query']);_0x1548a9['attributes']=_[_0x4c16('0x2d')](_0x14d2d7[_0x4c16('0x27')],qs[_0x4c16('0x2e')](_0x162dda[_0x4c16('0x29')][_0x4c16('0x2e')]));_0x1548a9['attributes']=_0x1548a9[_0x4c16('0x2f')]['length']?_0x1548a9[_0x4c16('0x2f')]:_0x14d2d7['model'];if(!_0x162dda[_0x4c16('0x29')][_0x4c16('0x30')](_0x4c16('0x31'))){_0x1548a9['limit']=qs[_0x4c16('0x32')](_0x162dda['query'][_0x4c16('0x32')]);_0x1548a9[_0x4c16('0x18')]=qs[_0x4c16('0x18')](_0x162dda[_0x4c16('0x29')][_0x4c16('0x18')]);}_0x1548a9[_0x4c16('0x33')]=qs[_0x4c16('0x34')](_0x162dda[_0x4c16('0x29')][_0x4c16('0x34')]);_0x1548a9[_0x4c16('0x35')]=qs['filters'](_[_0x4c16('0x36')](_0x162dda['query'],_0x14d2d7[_0x4c16('0x2c')]));if(_0x5f4ea2[_0x4c16('0x2a')]){if(_0x5f4ea2['dateEnd']){_0x5f4ea2[_0x4c16('0x2b')]=moment(_0x5f4ea2[_0x4c16('0x2b')])['add'](0x1,_0x4c16('0x37'));}else{_0x5f4ea2[_0x4c16('0x2b')]=moment(_0x5f4ea2[_0x4c16('0x2a')])[_0x4c16('0x38')](0x1,_0x4c16('0x37'));}_[_0x4c16('0x39')](_0x1548a9[_0x4c16('0x35')],{'createdAt':{'$gte':_0x5f4ea2['dateStart'],'$lte':_0x5f4ea2[_0x4c16('0x2b')]}});}if(_0x162dda['query']['filter']){_0x1548a9[_0x4c16('0x35')]=_[_0x4c16('0x39')](_0x1548a9[_0x4c16('0x35')],{'$or':_[_0x4c16('0x3a')](_0x1548a9[_0x4c16('0x2f')],function(_0x5b90e7){var _0x946454={};_0x946454[_0x5b90e7]={'$like':'%'+_0x162dda[_0x4c16('0x29')][_0x4c16('0x3b')]+'%'};return _0x946454;})});}_0x1548a9=_[_0x4c16('0x39')]({},_0x1548a9,_0x162dda['options']);var _0x30e87c={'where':_0x1548a9[_0x4c16('0x35')]};return db[_0x4c16('0x25')][_0x4c16('0x17')](_0x30e87c)[_0x4c16('0x1f')](function(_0x585639){_0x44fa47[_0x4c16('0x17')]=_0x585639;if(_0x162dda[_0x4c16('0x29')][_0x4c16('0x3c')]){_0x1548a9[_0x4c16('0x3d')]=[{'all':!![]}];}return db[_0x4c16('0x25')][_0x4c16('0x3e')](_0x1548a9);})['then'](function(_0x33b9a9){_0x44fa47[_0x4c16('0x3f')]=_0x33b9a9;return _0x44fa47;})[_0x4c16('0x1f')](respondWithFilteredResult(_0x51f527,_0x1548a9))[_0x4c16('0x40')](handleError(_0x51f527,null));};exports[_0x4c16('0x41')]=function(_0x16671e,_0x34970c){var _0x154055={'raw':!![],'where':{'id':_0x16671e[_0x4c16('0x42')]['id']}},_0x2a8d00={};_0x2a8d00['model']=_[_0x4c16('0x28')](db[_0x4c16('0x25')]['rawAttributes']);_0x2a8d00[_0x4c16('0x29')]=_['keys'](_0x16671e[_0x4c16('0x29')]);_0x2a8d00[_0x4c16('0x2c')]=_[_0x4c16('0x2d')](_0x2a8d00['model'],_0x2a8d00[_0x4c16('0x29')]);_0x154055[_0x4c16('0x2f')]=_['intersection'](_0x2a8d00['model'],qs[_0x4c16('0x2e')](_0x16671e[_0x4c16('0x29')][_0x4c16('0x2e')]));_0x154055['attributes']=_0x154055['attributes'][_0x4c16('0x43')]?_0x154055[_0x4c16('0x2f')]:_0x2a8d00[_0x4c16('0x27')];if(_0x16671e['query']['includeAll']){_0x154055[_0x4c16('0x3d')]=[{'all':!![]}];}_0x154055=_[_0x4c16('0x39')]({},_0x154055,_0x16671e['options']);return db[_0x4c16('0x25')]['find'](_0x154055)[_0x4c16('0x1f')](handleEntityNotFound(_0x34970c,null))[_0x4c16('0x1f')](respondWithResult(_0x34970c,null))[_0x4c16('0x40')](handleError(_0x34970c,null));};exports[_0x4c16('0x44')]=function(_0xba5483,_0x3489e1){return db[_0x4c16('0x25')][_0x4c16('0x44')](_0xba5483[_0x4c16('0x45')],{})[_0x4c16('0x1f')](respondWithResult(_0x3489e1,0xc9))[_0x4c16('0x40')](handleError(_0x3489e1,null));};exports[_0x4c16('0x1e')]=function(_0x576ffb,_0x680ec4){if(_0x576ffb[_0x4c16('0x45')]['id']){delete _0x576ffb[_0x4c16('0x45')]['id'];}return db[_0x4c16('0x25')][_0x4c16('0x46')]({'where':{'id':_0x576ffb[_0x4c16('0x42')]['id']}})[_0x4c16('0x1f')](handleEntityNotFound(_0x680ec4,null))[_0x4c16('0x1f')](saveUpdates(_0x576ffb[_0x4c16('0x45')],null))['then'](respondWithResult(_0x680ec4,null))[_0x4c16('0x40')](handleError(_0x680ec4,null));};exports[_0x4c16('0x20')]=function(_0x470cc2,_0x408e8b){return db[_0x4c16('0x25')][_0x4c16('0x46')]({'where':{'id':_0x470cc2[_0x4c16('0x42')]['id']}})[_0x4c16('0x1f')](handleEntityNotFound(_0x408e8b,null))['then'](removeEntity(_0x408e8b,null))['catch'](handleError(_0x408e8b,null));}; \ No newline at end of file +var _0x2e3d=['create','body','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','limit','set','Content-Range','apply','save','update','destroy','stack','name','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','pick','add','day','merge','filter','map','SmsApplication','then','includeAll','include','findAll','rows','catch','show','params','length','options','find'];(function(_0x807b32,_0x1d4546){var _0x1c57db=function(_0x126695){while(--_0x126695){_0x807b32['push'](_0x807b32['shift']());}};_0x1c57db(++_0x1d4546);}(_0x2e3d,0x8c));var _0xd2e3=function(_0x2a9c59,_0x595215){_0x2a9c59=_0x2a9c59-0x0;var _0x1e387f=_0x2e3d[_0x2a9c59];return _0x1e387f;};'use strict';var jsonpatch=require(_0xd2e3('0x0'));var rp=require(_0xd2e3('0x1'));var moment=require(_0xd2e3('0x2'));var BPromise=require(_0xd2e3('0x3'));var Mustache=require(_0xd2e3('0x4'));var util=require(_0xd2e3('0x5'));var path=require(_0xd2e3('0x6'));var sox=require(_0xd2e3('0x7'));var csv=require(_0xd2e3('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd2e3('0x9'));var squel=require(_0xd2e3('0xa'));var crypto=require(_0xd2e3('0xb'));var jsforce=require(_0xd2e3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd2e3('0x8'));var querystring=require('querystring');var Papa=require(_0xd2e3('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0xd2e3('0xe'))(_0xd2e3('0xf'));var utils=require(_0xd2e3('0x10'));var config=require(_0xd2e3('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419159,_0xd49f9a){_0xd49f9a=_0xd49f9a||0xcc;return function(_0x53de2d){if(_0x53de2d){return _0x419159[_0xd2e3('0x12')](_0xd49f9a);}return _0x419159[_0xd2e3('0x13')](_0xd49f9a)[_0xd2e3('0x14')]();};}function respondWithResult(_0x574032,_0xf7c2fe){_0xf7c2fe=_0xf7c2fe||0xc8;return function(_0x9797e7){if(_0x9797e7){return _0x574032[_0xd2e3('0x13')](_0xf7c2fe)[_0xd2e3('0x15')](_0x9797e7);}};}function respondWithFilteredResult(_0x3ba86d,_0x1d41b1){return function(_0x54f285){if(_0x54f285){var _0x2a1d67=_0x54f285[_0xd2e3('0x16')],_0x41eff8=_0x1d41b1['offset'],_0x7905bf=_0x1d41b1['offset']+_0x1d41b1[_0xd2e3('0x17')],_0x24c5b6;if(_0x7905bf>=_0x2a1d67){_0x7905bf=_0x2a1d67;_0x24c5b6=0xc8;}else{_0x24c5b6=0xce;}_0x3ba86d[_0xd2e3('0x13')](_0x24c5b6);return _0x3ba86d[_0xd2e3('0x18')](_0xd2e3('0x19'),_0x41eff8+'-'+_0x7905bf+'/'+_0x2a1d67)[_0xd2e3('0x15')](_0x54f285);}return null;};}function patchUpdates(_0x42e147){return function(_0x24ad34){try{jsonpatch[_0xd2e3('0x1a')](_0x24ad34,_0x42e147,!![]);}catch(_0x17240c){return BPromise['reject'](_0x17240c);}return _0x24ad34[_0xd2e3('0x1b')]();};}function saveUpdates(_0x4d7ec3,_0x597e9b){return function(_0x47f856){if(_0x47f856){return _0x47f856[_0xd2e3('0x1c')](_0x4d7ec3)['then'](function(_0x105fde){return _0x105fde;});}return null;};}function removeEntity(_0x5d6186,_0xcbe6c8){return function(_0x5a82ff){if(_0x5a82ff){return _0x5a82ff[_0xd2e3('0x1d')]()['then'](function(){_0x5d6186[_0xd2e3('0x13')](0xcc)[_0xd2e3('0x14')]();});}};}function handleEntityNotFound(_0x144b20,_0x541671){return function(_0x541028){if(!_0x541028){_0x144b20[_0xd2e3('0x12')](0x194);}return _0x541028;};}function handleError(_0x40d098,_0x509398){_0x509398=_0x509398||0x1f4;return function(_0x5d78e7){logger['error'](_0x5d78e7[_0xd2e3('0x1e')]);if(_0x5d78e7[_0xd2e3('0x1f')]){delete _0x5d78e7[_0xd2e3('0x1f')];}_0x40d098[_0xd2e3('0x13')](_0x509398)['send'](_0x5d78e7);};}exports[_0xd2e3('0x20')]=function(_0x4a484e,_0x7df1a3){var _0x4a29e5={},_0x3361b9={},_0x4c5bf5={'count':0x0,'rows':[]};var _0xe0c8d2=db['SmsApplication'][_0xd2e3('0x21')];_0x3361b9[_0xd2e3('0x22')]=_[_0xd2e3('0x23')](_0xe0c8d2);var _0x3da8f7={'dateStart':_0x4a484e[_0xd2e3('0x24')][_0xd2e3('0x25')],'dateEnd':_0x4a484e[_0xd2e3('0x24')][_0xd2e3('0x26')]};delete _0x4a484e[_0xd2e3('0x24')][_0xd2e3('0x25')];delete _0x4a484e[_0xd2e3('0x24')]['dateEnd'];_0x3361b9[_0xd2e3('0x24')]=_[_0xd2e3('0x23')](_0x4a484e[_0xd2e3('0x24')]);_0x3361b9[_0xd2e3('0x27')]=_[_0xd2e3('0x28')](_0x3361b9[_0xd2e3('0x22')],_0x3361b9['query']);_0x4a29e5['attributes']=_[_0xd2e3('0x28')](_0x3361b9[_0xd2e3('0x22')],qs['fields'](_0x4a484e[_0xd2e3('0x24')][_0xd2e3('0x29')]));_0x4a29e5[_0xd2e3('0x2a')]=_0x4a29e5[_0xd2e3('0x2a')]['length']?_0x4a29e5['attributes']:_0x3361b9[_0xd2e3('0x22')];if(!_0x4a484e['query'][_0xd2e3('0x2b')](_0xd2e3('0x2c'))){_0x4a29e5[_0xd2e3('0x17')]=qs[_0xd2e3('0x17')](_0x4a484e['query'][_0xd2e3('0x17')]);_0x4a29e5[_0xd2e3('0x2d')]=qs['offset'](_0x4a484e[_0xd2e3('0x24')][_0xd2e3('0x2d')]);}_0x4a29e5[_0xd2e3('0x2e')]=qs[_0xd2e3('0x2f')](_0x4a484e[_0xd2e3('0x24')]['sort']);_0x4a29e5[_0xd2e3('0x30')]=qs['filters'](_[_0xd2e3('0x31')](_0x4a484e[_0xd2e3('0x24')],_0x3361b9[_0xd2e3('0x27')]));if(_0x3da8f7[_0xd2e3('0x25')]){if(_0x3da8f7[_0xd2e3('0x26')]){_0x3da8f7[_0xd2e3('0x26')]=moment(_0x3da8f7[_0xd2e3('0x26')])[_0xd2e3('0x32')](0x1,'day');}else{_0x3da8f7[_0xd2e3('0x26')]=moment(_0x3da8f7[_0xd2e3('0x25')])['add'](0x1,_0xd2e3('0x33'));}_[_0xd2e3('0x34')](_0x4a29e5['where'],{'createdAt':{'$gte':_0x3da8f7[_0xd2e3('0x25')],'$lte':_0x3da8f7[_0xd2e3('0x26')]}});}if(_0x4a484e[_0xd2e3('0x24')][_0xd2e3('0x35')]){_0x4a29e5[_0xd2e3('0x30')]=_[_0xd2e3('0x34')](_0x4a29e5[_0xd2e3('0x30')],{'$or':_[_0xd2e3('0x36')](_0x4a29e5['attributes'],function(_0x303039){var _0x2ccf1a={};_0x2ccf1a[_0x303039]={'$like':'%'+_0x4a484e[_0xd2e3('0x24')][_0xd2e3('0x35')]+'%'};return _0x2ccf1a;})});}_0x4a29e5=_['merge']({},_0x4a29e5,_0x4a484e['options']);var _0x3dc4b0={'where':_0x4a29e5[_0xd2e3('0x30')]};return db[_0xd2e3('0x37')]['count'](_0x3dc4b0)[_0xd2e3('0x38')](function(_0x320ac0){_0x4c5bf5['count']=_0x320ac0;if(_0x4a484e[_0xd2e3('0x24')][_0xd2e3('0x39')]){_0x4a29e5[_0xd2e3('0x3a')]=[{'all':!![]}];}return db[_0xd2e3('0x37')][_0xd2e3('0x3b')](_0x4a29e5);})[_0xd2e3('0x38')](function(_0x4ac155){_0x4c5bf5[_0xd2e3('0x3c')]=_0x4ac155;return _0x4c5bf5;})['then'](respondWithFilteredResult(_0x7df1a3,_0x4a29e5))[_0xd2e3('0x3d')](handleError(_0x7df1a3,null));};exports[_0xd2e3('0x3e')]=function(_0x5bdb18,_0x207b00){var _0x367bfb={'raw':!![],'where':{'id':_0x5bdb18[_0xd2e3('0x3f')]['id']}},_0x4891a6={};_0x4891a6[_0xd2e3('0x22')]=_[_0xd2e3('0x23')](db[_0xd2e3('0x37')][_0xd2e3('0x21')]);_0x4891a6[_0xd2e3('0x24')]=_['keys'](_0x5bdb18[_0xd2e3('0x24')]);_0x4891a6[_0xd2e3('0x27')]=_[_0xd2e3('0x28')](_0x4891a6[_0xd2e3('0x22')],_0x4891a6[_0xd2e3('0x24')]);_0x367bfb[_0xd2e3('0x2a')]=_[_0xd2e3('0x28')](_0x4891a6[_0xd2e3('0x22')],qs[_0xd2e3('0x29')](_0x5bdb18[_0xd2e3('0x24')][_0xd2e3('0x29')]));_0x367bfb[_0xd2e3('0x2a')]=_0x367bfb[_0xd2e3('0x2a')][_0xd2e3('0x40')]?_0x367bfb[_0xd2e3('0x2a')]:_0x4891a6[_0xd2e3('0x22')];if(_0x5bdb18[_0xd2e3('0x24')][_0xd2e3('0x39')]){_0x367bfb[_0xd2e3('0x3a')]=[{'all':!![]}];}_0x367bfb=_[_0xd2e3('0x34')]({},_0x367bfb,_0x5bdb18[_0xd2e3('0x41')]);return db[_0xd2e3('0x37')][_0xd2e3('0x42')](_0x367bfb)[_0xd2e3('0x38')](handleEntityNotFound(_0x207b00,null))['then'](respondWithResult(_0x207b00,null))[_0xd2e3('0x3d')](handleError(_0x207b00,null));};exports['create']=function(_0x265fc1,_0x63bf7d){return db[_0xd2e3('0x37')][_0xd2e3('0x43')](_0x265fc1[_0xd2e3('0x44')],{})['then'](respondWithResult(_0x63bf7d,0xc9))[_0xd2e3('0x3d')](handleError(_0x63bf7d,null));};exports[_0xd2e3('0x1c')]=function(_0x51fc06,_0x119449){if(_0x51fc06[_0xd2e3('0x44')]['id']){delete _0x51fc06[_0xd2e3('0x44')]['id'];}return db[_0xd2e3('0x37')]['find']({'where':{'id':_0x51fc06[_0xd2e3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x119449,null))['then'](saveUpdates(_0x51fc06[_0xd2e3('0x44')],null))[_0xd2e3('0x38')](respondWithResult(_0x119449,null))['catch'](handleError(_0x119449,null));};exports[_0xd2e3('0x1d')]=function(_0x30b978,_0x174de9){return db[_0xd2e3('0x37')][_0xd2e3('0x42')]({'where':{'id':_0x30b978['params']['id']}})[_0xd2e3('0x38')](handleEntityNotFound(_0x174de9,null))['then'](removeEntity(_0x174de9,null))[_0xd2e3('0x3d')](handleError(_0x174de9,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 365a1c7..081c56d 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 _0x7903=['api','moment','request-promise','exports','SmsApplication','sms_applications','lodash','util'];(function(_0xdeb0b8,_0x4b9186){var _0x335714=function(_0x295235){while(--_0x295235){_0xdeb0b8['push'](_0xdeb0b8['shift']());}};_0x335714(++_0x4b9186);}(_0x7903,0xbe));var _0x3790=function(_0x4acfa1,_0x5ec5ac){_0x4acfa1=_0x4acfa1-0x0;var _0x257c54=_0x7903[_0x4acfa1];return _0x257c54;};'use strict';var _=require(_0x3790('0x0'));var util=require(_0x3790('0x1'));var logger=require('../../config/logger')(_0x3790('0x2'));var moment=require(_0x3790('0x3'));var BPromise=require('bluebird');var rp=require(_0x3790('0x4'));var attributes=require('./smsApplication.attributes');module[_0x3790('0x5')]=function(_0x50e785,_0x3aab87){return _0x50e785['define'](_0x3790('0x6'),attributes,{'tableName':_0x3790('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3495=['define','SmsApplication','sms_applications','util','../../config/logger','api','moment','bluebird','request-promise','./smsApplication.attributes','exports'];(function(_0x3c21a0,_0x4171b5){var _0x363b8b=function(_0x14d3e0){while(--_0x14d3e0){_0x3c21a0['push'](_0x3c21a0['shift']());}};_0x363b8b(++_0x4171b5);}(_0x3495,0x121));var _0x5349=function(_0x933170,_0x35f4b7){_0x933170=_0x933170-0x0;var _0x2767fa=_0x3495[_0x933170];return _0x2767fa;};'use strict';var _=require('lodash');var util=require(_0x5349('0x0'));var logger=require(_0x5349('0x1'))(_0x5349('0x2'));var moment=require(_0x5349('0x3'));var BPromise=require(_0x5349('0x4'));var rp=require(_0x5349('0x5'));var attributes=require(_0x5349('0x6'));module[_0x5349('0x7')]=function(_0xd7dc90,_0x31aae5){return _0xd7dc90[_0x5349('0x8')](_0x5349('0x9'),attributes,{'tableName':_0x5349('0xa'),'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 9b42d6e..a018f0a 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 _0xeaa0=['info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x1cf1c2,_0x394feb){var _0x57b1f8=function(_0x4fedbf){while(--_0x4fedbf){_0x1cf1c2['push'](_0x1cf1c2['shift']());}};_0x57b1f8(++_0x394feb);}(_0xeaa0,0x16e));var _0x0eaa=function(_0x3a4a66,_0x5afde4){_0x3a4a66=_0x3a4a66-0x0;var _0x2bd136=_0xeaa0[_0x3a4a66];return _0x2bd136;};'use strict';var _=require(_0x0eaa('0x0'));var util=require(_0x0eaa('0x1'));var moment=require(_0x0eaa('0x2'));var BPromise=require(_0x0eaa('0x3'));var rs=require(_0x0eaa('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x0eaa('0x5'));var logger=require(_0x0eaa('0x6'))('rpc');var config=require(_0x0eaa('0x7'));var jayson=require(_0x0eaa('0x8'));var client=jayson[_0x0eaa('0x9')][_0x0eaa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e7484,_0x4bbbc5,_0x41d4d7){return new BPromise(function(_0x9fdc9a,_0x3493b7){return client[_0x0eaa('0xb')](_0x2e7484,_0x41d4d7)['then'](function(_0x152ec6){logger[_0x0eaa('0xc')](_0x0eaa('0xd'),_0x4bbbc5,_0x0eaa('0xe'));logger['debug'](_0x0eaa('0xf'),_0x4bbbc5,_0x0eaa('0xe'),JSON[_0x0eaa('0x10')](_0x152ec6));if(_0x152ec6['error']){if(_0x152ec6[_0x0eaa('0x11')]['code']===0x1f4){logger[_0x0eaa('0x11')](_0x0eaa('0xd'),_0x4bbbc5,_0x152ec6['error'][_0x0eaa('0x12')]);return _0x3493b7(_0x152ec6[_0x0eaa('0x11')][_0x0eaa('0x12')]);}logger['error'](_0x0eaa('0xd'),_0x4bbbc5,_0x152ec6[_0x0eaa('0x11')][_0x0eaa('0x12')]);return _0x9fdc9a(_0x152ec6[_0x0eaa('0x11')][_0x0eaa('0x12')]);}else{logger[_0x0eaa('0xc')](_0x0eaa('0xd'),_0x4bbbc5,_0x0eaa('0xe'));_0x9fdc9a(_0x152ec6[_0x0eaa('0x13')][_0x0eaa('0x12')]);}})[_0x0eaa('0x14')](function(_0x46b2bb){logger[_0x0eaa('0x11')](_0x0eaa('0xd'),_0x4bbbc5,_0x46b2bb);_0x3493b7(_0x46b2bb);});});} \ No newline at end of file +var _0x3c1f=['result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0x3c1f,0x1ce));var _0xf3c1=function(_0x41ea54,_0x3289d0){_0x41ea54=_0x41ea54-0x0;var _0x3cf1bb=_0x3c1f[_0x41ea54];return _0x3cf1bb;};'use strict';var _=require(_0xf3c1('0x0'));var util=require('util');var moment=require(_0xf3c1('0x1'));var BPromise=require(_0xf3c1('0x2'));var rs=require(_0xf3c1('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xf3c1('0x4'));var logger=require(_0xf3c1('0x5'))(_0xf3c1('0x6'));var config=require(_0xf3c1('0x7'));var jayson=require(_0xf3c1('0x8'));var client=jayson[_0xf3c1('0x9')][_0xf3c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1944d9,_0x1bdf83,_0x1b5885){return new BPromise(function(_0x4e225e,_0x29475a){return client[_0xf3c1('0xb')](_0x1944d9,_0x1b5885)[_0xf3c1('0xc')](function(_0x40fc37){logger[_0xf3c1('0xd')](_0xf3c1('0xe'),_0x1bdf83,_0xf3c1('0xf'));logger[_0xf3c1('0x10')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x1bdf83,_0xf3c1('0xf'),JSON[_0xf3c1('0x11')](_0x40fc37));if(_0x40fc37[_0xf3c1('0x12')]){if(_0x40fc37[_0xf3c1('0x12')][_0xf3c1('0x13')]===0x1f4){logger[_0xf3c1('0x12')](_0xf3c1('0xe'),_0x1bdf83,_0x40fc37['error'][_0xf3c1('0x14')]);return _0x29475a(_0x40fc37[_0xf3c1('0x12')][_0xf3c1('0x14')]);}logger[_0xf3c1('0x12')](_0xf3c1('0xe'),_0x1bdf83,_0x40fc37[_0xf3c1('0x12')]['message']);return _0x4e225e(_0x40fc37[_0xf3c1('0x12')][_0xf3c1('0x14')]);}else{logger[_0xf3c1('0xd')](_0xf3c1('0xe'),_0x1bdf83,_0xf3c1('0xf'));_0x4e225e(_0x40fc37[_0xf3c1('0x15')][_0xf3c1('0x14')]);}})[_0xf3c1('0x16')](function(_0x410706){logger[_0xf3c1('0x12')](_0xf3c1('0xe'),_0x1bdf83,_0x410706);_0x29475a(_0x410706);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index d4e2a1c..c94a6b1 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 _0xb59c=['put','tracked','delete','sms','destroy','removeTags','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/messages','post','create','/:id/tags','smsinteraction:addtags','addTags'];(function(_0x5297ff,_0x447541){var _0x2280e0=function(_0x49c3fa){while(--_0x49c3fa){_0x5297ff['push'](_0x5297ff['shift']());}};_0x2280e0(++_0x447541);}(_0xb59c,0x10b));var _0xcb59=function(_0x30ff44,_0x143800){_0x30ff44=_0x30ff44-0x0;var _0x126c3c=_0xb59c[_0x30ff44];return _0x126c3c;};'use strict';var multer=require(_0xcb59('0x0'));var util=require(_0xcb59('0x1'));var path=require(_0xcb59('0x2'));var express=require('express');var router=express[_0xcb59('0x3')]();var auth=require(_0xcb59('0x4'));var interaction=require(_0xcb59('0x5'));var config=require(_0xcb59('0x6'));var controller=require('./smsInteraction.controller');router[_0xcb59('0x7')]('/',auth[_0xcb59('0x8')](),controller[_0xcb59('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xcb59('0xa')]);router[_0xcb59('0x7')](_0xcb59('0xb'),auth[_0xcb59('0x8')](),controller[_0xcb59('0xc')]);router[_0xcb59('0x7')](_0xcb59('0xd'),auth[_0xcb59('0x8')](),controller['getMessages']);router[_0xcb59('0xe')]('/',auth[_0xcb59('0x8')](),controller[_0xcb59('0xf')]);router[_0xcb59('0xe')]('/:id/messages',auth[_0xcb59('0x8')](),controller['addMessage']);router[_0xcb59('0xe')](_0xcb59('0x10'),auth[_0xcb59('0x8')](),interaction['tracked']('sms',_0xcb59('0x11')),controller[_0xcb59('0x12')]);router[_0xcb59('0x13')]('/:id',auth['isAuthenticated'](),interaction[_0xcb59('0x14')]('sms','smsinteraction:update'),controller['update']);router[_0xcb59('0x15')]('/:id',auth[_0xcb59('0x8')](),interaction[_0xcb59('0x14')](_0xcb59('0x16'),'smsinteraction:destroy'),controller[_0xcb59('0x17')]);router['delete'](_0xcb59('0x10'),auth['isAuthenticated'](),controller[_0xcb59('0x18')]);module[_0xcb59('0x19')]=router; \ No newline at end of file +var _0xa62c=['describe','/:id','show','/:id/messages','getMessages','create','post','addMessage','/:id/tags','sms','smsinteraction:addtags','addTags','tracked','smsinteraction:update','update','destroy','delete','removeTags','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0x425541,_0x5dec0e){var _0x455616=function(_0x28e721){while(--_0x28e721){_0x425541['push'](_0x425541['shift']());}};_0x455616(++_0x5dec0e);}(_0xa62c,0x70));var _0xca62=function(_0x4d35f3,_0x19ba66){_0x4d35f3=_0x4d35f3-0x0;var _0x382fea=_0xa62c[_0x4d35f3];return _0x382fea;};'use strict';var multer=require(_0xca62('0x0'));var util=require(_0xca62('0x1'));var path=require(_0xca62('0x2'));var express=require(_0xca62('0x3'));var router=express[_0xca62('0x4')]();var auth=require(_0xca62('0x5'));var interaction=require(_0xca62('0x6'));var config=require('../../config/environment');var controller=require(_0xca62('0x7'));router[_0xca62('0x8')]('/',auth[_0xca62('0x9')](),controller[_0xca62('0xa')]);router[_0xca62('0x8')](_0xca62('0xb'),auth[_0xca62('0x9')](),controller[_0xca62('0xc')]);router['get'](_0xca62('0xd'),auth[_0xca62('0x9')](),controller[_0xca62('0xe')]);router['get'](_0xca62('0xf'),auth[_0xca62('0x9')](),controller[_0xca62('0x10')]);router['post']('/',auth[_0xca62('0x9')](),controller[_0xca62('0x11')]);router[_0xca62('0x12')](_0xca62('0xf'),auth[_0xca62('0x9')](),controller[_0xca62('0x13')]);router[_0xca62('0x12')](_0xca62('0x14'),auth[_0xca62('0x9')](),interaction['tracked'](_0xca62('0x15'),_0xca62('0x16')),controller[_0xca62('0x17')]);router['put']('/:id',auth['isAuthenticated'](),interaction[_0xca62('0x18')]('sms',_0xca62('0x19')),controller[_0xca62('0x1a')]);router['delete']('/:id',auth[_0xca62('0x9')](),interaction[_0xca62('0x18')](_0xca62('0x15'),'smsinteraction:destroy'),controller[_0xca62('0x1b')]);router[_0xca62('0x1c')](_0xca62('0x14'),auth['isAuthenticated'](),controller[_0xca62('0x1d')]);module[_0xca62('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index e4d27c8..314ddb2 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 _0xd32f=['sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x21545f,_0x54239a){var _0x4bc946=function(_0x2b9abc){while(--_0x2b9abc){_0x21545f['push'](_0x21545f['shift']());}};_0x4bc946(++_0x54239a);}(_0xd32f,0x68));var _0xfd32=function(_0x2f42ea,_0x4228bb){_0x2f42ea=_0x2f42ea-0x0;var _0x43e6a6=_0xd32f[_0x2f42ea];return _0x43e6a6;};'use strict';var Sequelize=require(_0xfd32('0x0'));var moment=require(_0xfd32('0x1'));module[_0xfd32('0x2')]={'closed':{'type':Sequelize[_0xfd32('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfd32('0x4')]},'disposition':{'type':Sequelize[_0xfd32('0x5')]},'note':{'type':Sequelize[_0xfd32('0x5')]},'phone':{'type':Sequelize[_0xfd32('0x5')]},'read1stAt':{'type':Sequelize[_0xfd32('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xfd32('0x6')]('in',_0xfd32('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfd32('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xfd32('0x6')]('in',_0xfd32('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x7c35=['ENUM','out','sequelize','moment','exports','DATE','STRING'];(function(_0x1e1bb5,_0x23b4e9){var _0x413b4c=function(_0x1483c1){while(--_0x1483c1){_0x1e1bb5['push'](_0x1e1bb5['shift']());}};_0x413b4c(++_0x23b4e9);}(_0x7c35,0x1d7));var _0x57c3=function(_0x2ff520,_0x3babe4){_0x2ff520=_0x2ff520-0x0;var _0x50aeb3=_0x7c35[_0x2ff520];return _0x50aeb3;};'use strict';var Sequelize=require(_0x57c3('0x0'));var moment=require(_0x57c3('0x1'));module[_0x57c3('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x57c3('0x3')]},'disposition':{'type':Sequelize[_0x57c3('0x4')]},'note':{'type':Sequelize[_0x57c3('0x4')]},'phone':{'type':Sequelize[_0x57c3('0x4')]},'read1stAt':{'type':Sequelize[_0x57c3('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x57c3('0x5')]('in',_0x57c3('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x57c3('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index cacbd31..d3b3d4e 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 _0x9f6c=['rows','catch','show','params','find','create','body','ids','getMessages','SmsInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','omit','spread','emit','smsInteractionTags:save','removeTags','fast-json-patch','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./smsInteraction.socket','register','status','end','count','limit','set','json','reject','save','update','destroy','sendStatus','error','stack','name','send','index','SmsInteraction','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','day','merge','filter','map','options','include','tag','Tag','Tags','distinct','read','push','SmsMessage','Messages','createdAt','then','includeAll','User','Users','CmContact','Contact','Owner','fullname','SmsAccount','Account','key','direction','ThroughTags','findAll'];(function(_0x301efe,_0x338d14){var _0x5d44c3=function(_0x10a315){while(--_0x10a315){_0x301efe['push'](_0x301efe['shift']());}};_0x5d44c3(++_0x338d14);}(_0x9f6c,0x150));var _0xc9f6=function(_0x5d70ae,_0x5b8c4c){_0x5d70ae=_0x5d70ae-0x0;var _0x104e9b=_0x9f6c[_0x5d70ae];return _0x104e9b;};'use strict';var jsonpatch=require(_0xc9f6('0x0'));var rp=require('request-promise');var moment=require(_0xc9f6('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xc9f6('0x2'));var util=require(_0xc9f6('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xc9f6('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc9f6('0x5'));var squel=require(_0xc9f6('0x6'));var crypto=require(_0xc9f6('0x7'));var jsforce=require(_0xc9f6('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xc9f6('0x4'));var querystring=require(_0xc9f6('0x9'));var Papa=require(_0xc9f6('0xa'));var qs=require(_0xc9f6('0xb'));var logger=require(_0xc9f6('0xc'))('api');var utils=require(_0xc9f6('0xd'));var config=require(_0xc9f6('0xe'));var db=require(_0xc9f6('0xf'))['db'];var socket=require(_0xc9f6('0x10'))({'host':_0xc9f6('0x11'),'port':0x18eb});require(_0xc9f6('0x12'))[_0xc9f6('0x13')](socket);function respondWithStatusCode(_0x585f87,_0x47c4d4){_0x47c4d4=_0x47c4d4||0xcc;return function(_0x5803e4){if(_0x5803e4){return _0x585f87['sendStatus'](_0x47c4d4);}return _0x585f87[_0xc9f6('0x14')](_0x47c4d4)[_0xc9f6('0x15')]();};}function respondWithResult(_0x11552f,_0x3b7e3d){_0x3b7e3d=_0x3b7e3d||0xc8;return function(_0x5a1bc0){if(_0x5a1bc0){return _0x11552f[_0xc9f6('0x14')](_0x3b7e3d)['json'](_0x5a1bc0);}};}function respondWithFilteredResult(_0xb9aaf0,_0x1191c8){return function(_0x3f6b05){if(_0x3f6b05){var _0x1caba5=_0x3f6b05[_0xc9f6('0x16')],_0x616e94=_0x1191c8['offset'],_0x3486b9=_0x1191c8['offset']+_0x1191c8[_0xc9f6('0x17')],_0x2bf2fe;if(_0x3486b9>=_0x1caba5){_0x3486b9=_0x1caba5;_0x2bf2fe=0xc8;}else{_0x2bf2fe=0xce;}_0xb9aaf0[_0xc9f6('0x14')](_0x2bf2fe);return _0xb9aaf0[_0xc9f6('0x18')]('Content-Range',_0x616e94+'-'+_0x3486b9+'/'+_0x1caba5)[_0xc9f6('0x19')](_0x3f6b05);}return null;};}function patchUpdates(_0x69056e){return function(_0x38cd05){try{jsonpatch['apply'](_0x38cd05,_0x69056e,!![]);}catch(_0x370c13){return BPromise[_0xc9f6('0x1a')](_0x370c13);}return _0x38cd05[_0xc9f6('0x1b')]();};}function saveUpdates(_0x2797aa,_0x4f5688){return function(_0x5d36e7){if(_0x5d36e7){return _0x5d36e7[_0xc9f6('0x1c')](_0x2797aa)['then'](function(_0x302602){return _0x302602;});}return null;};}function removeEntity(_0x384f7a,_0x1ac03a){return function(_0x20420f){if(_0x20420f){return _0x20420f[_0xc9f6('0x1d')]()['then'](function(){_0x384f7a[_0xc9f6('0x14')](0xcc)[_0xc9f6('0x15')]();});}};}function handleEntityNotFound(_0x1c8955,_0x43c216){return function(_0x2861c7){if(!_0x2861c7){_0x1c8955[_0xc9f6('0x1e')](0x194);}return _0x2861c7;};}function handleError(_0x32643b,_0x2bf164){_0x2bf164=_0x2bf164||0x1f4;return function(_0x554e5a){logger[_0xc9f6('0x1f')](_0x554e5a[_0xc9f6('0x20')]);if(_0x554e5a[_0xc9f6('0x21')]){delete _0x554e5a['name'];}_0x32643b[_0xc9f6('0x14')](_0x2bf164)[_0xc9f6('0x22')](_0x554e5a);};}exports[_0xc9f6('0x23')]=function(_0x5775cf,_0x4c4393){var _0x21f9f5={},_0xe827c7={},_0x1b07ef={'count':0x0,'rows':[]};var _0x5a6d21=db[_0xc9f6('0x24')][_0xc9f6('0x25')];_0xe827c7[_0xc9f6('0x26')]=_[_0xc9f6('0x27')](_0x5a6d21);var _0x1ed2da={'dateStart':_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x29')],'dateEnd':_0x5775cf['query'][_0xc9f6('0x2a')]};delete _0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x29')];delete _0x5775cf[_0xc9f6('0x28')]['dateEnd'];_0xe827c7[_0xc9f6('0x28')]=_[_0xc9f6('0x27')](_0x5775cf[_0xc9f6('0x28')]);_0xe827c7[_0xc9f6('0x2b')]=_['intersection'](_0xe827c7[_0xc9f6('0x26')],_0xe827c7[_0xc9f6('0x28')]);_0x21f9f5[_0xc9f6('0x2c')]=_[_0xc9f6('0x2d')](_0xe827c7[_0xc9f6('0x26')],qs[_0xc9f6('0x2e')](_0x5775cf['query']['fields']));_0x21f9f5['attributes']=_0x21f9f5[_0xc9f6('0x2c')][_0xc9f6('0x2f')]?_0x21f9f5[_0xc9f6('0x2c')]:_0xe827c7[_0xc9f6('0x26')];if(!_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x30')](_0xc9f6('0x31'))){_0x21f9f5[_0xc9f6('0x17')]=qs[_0xc9f6('0x17')](_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x17')]);_0x21f9f5['offset']=qs[_0xc9f6('0x32')](_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x32')]);}_0x21f9f5[_0xc9f6('0x33')]=qs[_0xc9f6('0x34')](_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x34')]);_0x21f9f5[_0xc9f6('0x35')]=qs[_0xc9f6('0x2b')](_[_0xc9f6('0x36')](_0x5775cf[_0xc9f6('0x28')],_0xe827c7[_0xc9f6('0x2b')]));if(_0x1ed2da[_0xc9f6('0x29')]){if(_0x1ed2da[_0xc9f6('0x2a')]){_0x1ed2da['dateEnd']=moment(_0x1ed2da[_0xc9f6('0x2a')])['add'](0x1,_0xc9f6('0x37'));}else{_0x1ed2da[_0xc9f6('0x2a')]=moment(_0x1ed2da[_0xc9f6('0x29')])['add'](0x1,_0xc9f6('0x37'));}_[_0xc9f6('0x38')](_0x21f9f5[_0xc9f6('0x35')],{'createdAt':{'$gte':_0x1ed2da['dateStart'],'$lte':_0x1ed2da[_0xc9f6('0x2a')]}});}if(_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x39')]){_0x21f9f5[_0xc9f6('0x35')]=_[_0xc9f6('0x38')](_0x21f9f5[_0xc9f6('0x35')],{'$or':_[_0xc9f6('0x3a')](_0x21f9f5[_0xc9f6('0x2c')],function(_0x102b11){var _0x46c242={};_0x46c242[_0x102b11]={'$like':'%'+_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x39')]+'%'};return _0x46c242;})});}_0x21f9f5=_['merge']({},_0x21f9f5,_0x5775cf[_0xc9f6('0x3b')]);var _0x3dc695={'where':_0x21f9f5[_0xc9f6('0x35')]};_0x3dc695[_0xc9f6('0x3c')]=[];if(_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x3d')]){_0x3dc695[_0xc9f6('0x3c')]['push']({'model':db[_0xc9f6('0x3e')],'as':_0xc9f6('0x3f'),'attributes':['id'],'where':{'id':_0x5775cf[_0xc9f6('0x28')]['tag']},'required':!![]});_0x3dc695[_0xc9f6('0x40')]=!![];}if(_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x41')]){_0x3dc695[_0xc9f6('0x3c')][_0xc9f6('0x42')]({'model':db[_0xc9f6('0x43')],'as':_0xc9f6('0x44'),'attributes':['id','direction',_0xc9f6('0x45'),_0xc9f6('0x41')],'where':{'direction':'in','read':_0x5775cf[_0xc9f6('0x28')]['read']||![]},'required':!![]});_0x3dc695[_0xc9f6('0x40')]=!![];}return db[_0xc9f6('0x24')][_0xc9f6('0x16')](_0x3dc695)[_0xc9f6('0x46')](function(_0x114cf6){_0x1b07ef['count']=_0x114cf6;if(_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x47')]){_0x21f9f5[_0xc9f6('0x3c')]=[{'model':db[_0xc9f6('0x48')],'as':_0xc9f6('0x49'),'required':![],'attributes':['id',_0xc9f6('0x21'),'fullname']},{'model':db[_0xc9f6('0x4a')],'as':_0xc9f6('0x4b'),'required':![]},{'model':db['User'],'as':_0xc9f6('0x4c'),'attributes':[_0xc9f6('0x21'),_0xc9f6('0x4d'),'internal'],'required':![]},{'model':db[_0xc9f6('0x4e')],'as':_0xc9f6('0x4f'),'attributes':[_0xc9f6('0x21'),_0xc9f6('0x50')],'required':![]},{'model':db[_0xc9f6('0x43')],'as':'Messages','attributes':['id',_0xc9f6('0x51'),_0xc9f6('0x45'),_0xc9f6('0x41')],'where':{'direction':'in','read':_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x41')]||![]},'required':_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x41')]||![]},{'model':db[_0xc9f6('0x3e')],'as':_0xc9f6('0x3f'),'attributes':['id',_0xc9f6('0x21'),'color'],'required':_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x3d')]?!![]:![]},{'model':db['Tag'],'as':_0xc9f6('0x52'),'attributes':['id','name','color'],'through':_0x5775cf['query'][_0xc9f6('0x3d')]?{'attributes':[],'where':{'TagId':_0x5775cf['query'][_0xc9f6('0x3d')]||undefined}}:{},'required':_0x5775cf['query'][_0xc9f6('0x3d')]?!![]:![]}];}return db[_0xc9f6('0x24')][_0xc9f6('0x53')](_0x21f9f5);})[_0xc9f6('0x46')](function(_0x362bf2){_0x1b07ef[_0xc9f6('0x54')]=_0x362bf2;return _0x1b07ef;})[_0xc9f6('0x46')](respondWithFilteredResult(_0x4c4393,_0x21f9f5))[_0xc9f6('0x55')](handleError(_0x4c4393,null));};exports[_0xc9f6('0x56')]=function(_0x57df38,_0x58ea32){var _0x4d4253={'raw':![],'where':{'id':_0x57df38[_0xc9f6('0x57')]['id']}},_0x438602={};_0x438602['model']=_['keys'](db[_0xc9f6('0x24')][_0xc9f6('0x25')]);_0x438602[_0xc9f6('0x28')]=_[_0xc9f6('0x27')](_0x57df38[_0xc9f6('0x28')]);_0x438602[_0xc9f6('0x2b')]=_[_0xc9f6('0x2d')](_0x438602[_0xc9f6('0x26')],_0x438602[_0xc9f6('0x28')]);_0x4d4253[_0xc9f6('0x2c')]=_[_0xc9f6('0x2d')](_0x438602[_0xc9f6('0x26')],qs[_0xc9f6('0x2e')](_0x57df38[_0xc9f6('0x28')][_0xc9f6('0x2e')]));_0x4d4253[_0xc9f6('0x2c')]=_0x4d4253[_0xc9f6('0x2c')][_0xc9f6('0x2f')]?_0x4d4253[_0xc9f6('0x2c')]:_0x438602[_0xc9f6('0x26')];if(_0x57df38[_0xc9f6('0x28')]['includeAll']){_0x4d4253[_0xc9f6('0x3c')]=[{'all':!![]}];}_0x4d4253=_[_0xc9f6('0x38')]({},_0x4d4253,_0x57df38[_0xc9f6('0x3b')]);return db[_0xc9f6('0x24')][_0xc9f6('0x58')](_0x4d4253)[_0xc9f6('0x46')](handleEntityNotFound(_0x58ea32,null))['then'](respondWithResult(_0x58ea32,null))[_0xc9f6('0x55')](handleError(_0x58ea32,null));};exports['create']=function(_0x4288c3,_0x24439a){return db[_0xc9f6('0x24')][_0xc9f6('0x59')](_0x4288c3['body'],{})['then'](respondWithResult(_0x24439a,0xc9))[_0xc9f6('0x55')](handleError(_0x24439a,null));};exports[_0xc9f6('0x1c')]=function(_0x2acb5d,_0x513a8b){if(_0x2acb5d[_0xc9f6('0x5a')]['id']){delete _0x2acb5d[_0xc9f6('0x5a')]['id'];}return db[_0xc9f6('0x24')][_0xc9f6('0x58')]({'where':{'id':_0x2acb5d[_0xc9f6('0x57')]['id']}})[_0xc9f6('0x46')](handleEntityNotFound(_0x513a8b,null))[_0xc9f6('0x46')](saveUpdates(_0x2acb5d[_0xc9f6('0x5a')],null))[_0xc9f6('0x46')](respondWithResult(_0x513a8b,null))[_0xc9f6('0x55')](handleError(_0x513a8b,null));};exports['destroy']=function(_0x5043d4,_0x3a6ecb){return db[_0xc9f6('0x24')][_0xc9f6('0x58')]({'where':{'id':_0x5043d4[_0xc9f6('0x57')]['id']}})[_0xc9f6('0x46')](handleEntityNotFound(_0x3a6ecb,null))[_0xc9f6('0x46')](removeEntity(_0x3a6ecb,null))['catch'](handleError(_0x3a6ecb,null));};exports['describe']=function(_0x573794,_0xb7ea15){return db[_0xc9f6('0x24')]['describe']()[_0xc9f6('0x46')](respondWithResult(_0xb7ea15,null))['catch'](handleError(_0xb7ea15,null));};exports['addMessage']=function(_0x5d5cb2,_0x27bdb6,_0x1dce9c){return db[_0xc9f6('0x43')]['find']({'where':{'id':_0x5d5cb2[_0xc9f6('0x57')]['id']}})[_0xc9f6('0x46')](handleEntityNotFound(_0x27bdb6,null))[_0xc9f6('0x46')](function(_0x465309){if(_0x465309){return _0x465309['addMessage'](_0x5d5cb2[_0xc9f6('0x5a')][_0xc9f6('0x5b')],_['omit'](_0x5d5cb2[_0xc9f6('0x5a')],[_0xc9f6('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x27bdb6,null))[_0xc9f6('0x55')](handleError(_0x27bdb6,null));};exports[_0xc9f6('0x5c')]=function(_0x31791e,_0x33d288,_0x4d302f){var _0xaf916b={'raw':![],'where':{}};var _0x2838da={};var _0xddf559={'count':0x0,'rows':[]};return db[_0xc9f6('0x24')]['findOne']({'where':{'id':_0x31791e[_0xc9f6('0x57')]['id']}})[_0xc9f6('0x46')](handleEntityNotFound(_0x33d288,null))['then'](function(_0xd3ed2f){if(_0xd3ed2f){_0x2838da[_0xc9f6('0x26')]=_['keys'](db[_0xc9f6('0x43')]['rawAttributes']);_0x2838da[_0xc9f6('0x28')]=_[_0xc9f6('0x27')](_0x31791e[_0xc9f6('0x28')]);_0x2838da[_0xc9f6('0x2b')]=_[_0xc9f6('0x2d')](_0x2838da['model'],_0x2838da[_0xc9f6('0x28')]);_0xaf916b[_0xc9f6('0x2c')]=_[_0xc9f6('0x2d')](_0x2838da[_0xc9f6('0x26')],qs[_0xc9f6('0x2e')](_0x31791e[_0xc9f6('0x28')][_0xc9f6('0x2e')]));_0xaf916b[_0xc9f6('0x2c')]=_0xaf916b[_0xc9f6('0x2c')][_0xc9f6('0x2f')]?_0xaf916b['attributes']:_0x2838da[_0xc9f6('0x26')];if(!_0x31791e[_0xc9f6('0x28')][_0xc9f6('0x30')](_0xc9f6('0x31'))){_0xaf916b[_0xc9f6('0x17')]=qs['limit'](_0x31791e[_0xc9f6('0x28')][_0xc9f6('0x17')]);_0xaf916b['offset']=qs['offset'](_0x31791e[_0xc9f6('0x28')][_0xc9f6('0x32')]);}_0xaf916b['order']=qs[_0xc9f6('0x34')](_0x31791e['query']['sort']);_0xaf916b[_0xc9f6('0x35')]=qs[_0xc9f6('0x2b')](_[_0xc9f6('0x36')](_0x31791e['query'],_0x2838da[_0xc9f6('0x2b')]));_0xaf916b[_0xc9f6('0x35')][_0xc9f6('0x5d')]=_0xd3ed2f['id'];if(_0x31791e[_0xc9f6('0x28')]['filter']){_0xaf916b[_0xc9f6('0x35')]=_[_0xc9f6('0x38')](_0xaf916b[_0xc9f6('0x35')],{'$or':_['map'](_0xaf916b[_0xc9f6('0x2c')],function(_0x385883){var _0x5859f8={};_0x5859f8[_0x385883]={'$like':'%'+_0x31791e[_0xc9f6('0x28')]['filter']+'%'};return _0x5859f8;})});}if(_0x31791e[_0xc9f6('0x28')][_0xc9f6('0x5e')]){var _0x2b1483=_0x31791e['query'][_0xc9f6('0x5e')][_0xc9f6('0x5f')](',');var _0x1eaeda={};_0x1eaeda[_0x2b1483[0x0]]={'$gte':moment(_0x2b1483[0x1])[_0xc9f6('0x60')](_0xc9f6('0x61'))};_0xaf916b[_0xc9f6('0x35')]=_['merge'](_0xaf916b[_0xc9f6('0x35')],_0x1eaeda);}_0xaf916b=_[_0xc9f6('0x38')]({},_0xaf916b,_0x31791e[_0xc9f6('0x3b')]);return db[_0xc9f6('0x43')][_0xc9f6('0x16')]({'where':_0xaf916b[_0xc9f6('0x35')]})[_0xc9f6('0x46')](function(_0x139231){_0xddf559[_0xc9f6('0x16')]=_0x139231;if(_0x31791e['query'][_0xc9f6('0x47')]){_0xaf916b[_0xc9f6('0x3c')]=[{'all':!![]}];}return db[_0xc9f6('0x43')][_0xc9f6('0x53')](_0xaf916b);})[_0xc9f6('0x46')](function(_0x2b6c8e){_0xddf559[_0xc9f6('0x54')]=_0x2b6c8e;return _0xddf559;});}})['then'](respondWithFilteredResult(_0x33d288,_0xaf916b))[_0xc9f6('0x55')](handleError(_0x33d288,null));};exports[_0xc9f6('0x62')]=function(_0x300dc1,_0x5e896b,_0x52de8f){return db[_0xc9f6('0x24')][_0xc9f6('0x58')]({'where':{'id':_0x300dc1[_0xc9f6('0x57')]['id']}})[_0xc9f6('0x46')](handleEntityNotFound(_0x5e896b,null))[_0xc9f6('0x46')](function(_0x4d140f){if(_0x4d140f){return _0x4d140f[_0xc9f6('0x63')](_0x300dc1[_0xc9f6('0x5a')][_0xc9f6('0x5b')],_[_0xc9f6('0x64')](_0x300dc1['body'],['ids','id'])||{})[_0xc9f6('0x65')](function(){return db[_0xc9f6('0x3e')][_0xc9f6('0x53')]({'attributes':['id',_0xc9f6('0x21'),'color'],'where':{'id':_0x300dc1[_0xc9f6('0x5a')][_0xc9f6('0x5b')]}});})[_0xc9f6('0x46')](function(_0x4cd190){socket[_0xc9f6('0x66')](_0xc9f6('0x67'),{'id':Number(_0x300dc1[_0xc9f6('0x57')]['id']),'tags':_0x4cd190||[]});return{'id':Number(_0x300dc1[_0xc9f6('0x57')]['id']),'tags':_0x4cd190||[]};});}})[_0xc9f6('0x46')](respondWithResult(_0x5e896b,null))['catch'](handleError(_0x5e896b,null));};exports[_0xc9f6('0x68')]=function(_0x1f8a71,_0x4031f6,_0x3b5791){var _0x2c6711;return db['SmsInteraction'][_0xc9f6('0x58')]({'where':{'id':_0x1f8a71['params']['id']}})[_0xc9f6('0x46')](handleEntityNotFound(_0x4031f6,null))['then'](function(_0x286b92){if(_0x286b92){return _0x286b92['removeTags'](_0x1f8a71[_0xc9f6('0x28')][_0xc9f6('0x5b')]);}})[_0xc9f6('0x46')](respondWithStatusCode(_0x4031f6,null))[_0xc9f6('0x55')](handleError(_0x4031f6,null));}; \ No newline at end of file +var _0x1b0d=['emit','smsInteractionTags:save','removeTags','fast-json-patch','request-promise','moment','util','path','to-csv','squel','crypto','jsforce','querystring','papaparse','../../config/logger','api','../../config/environment','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','count','offset','limit','apply','reject','save','update','then','destroy','end','send','index','SmsInteraction','keys','query','dateStart','dateEnd','filters','intersection','model','fields','attributes','length','nolimit','order','sort','add','day','merge','where','filter','map','options','include','tag','push','Tag','distinct','read','SmsMessage','Messages','direction','createdAt','includeAll','User','Users','name','fullname','CmContact','Contact','Owner','internal','SmsAccount','key','Tags','ThroughTags','color','findAll','rows','catch','show','rawAttributes','find','create','body','params','describe','ids','omit','getMessages','findOne','hasOwnProperty','pick','SmsInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b0d,0x138));var _0xd1b0=function(_0x290356,_0x2edb2f){_0x290356=_0x290356-0x0;var _0x52394f=_0x1b0d[_0x290356];return _0x52394f;};'use strict';var jsonpatch=require(_0xd1b0('0x0'));var rp=require(_0xd1b0('0x1'));var moment=require(_0xd1b0('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd1b0('0x3'));var path=require(_0xd1b0('0x4'));var sox=require('sox');var csv=require(_0xd1b0('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd1b0('0x6'));var crypto=require(_0xd1b0('0x7'));var jsforce=require(_0xd1b0('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xd1b0('0x5'));var querystring=require(_0xd1b0('0x9'));var Papa=require(_0xd1b0('0xa'));var qs=require('../../components/parsers/qs');var logger=require(_0xd1b0('0xb'))(_0xd1b0('0xc'));var utils=require('../../config/utils');var config=require(_0xd1b0('0xd'));var db=require('../../mysqldb')['db'];var socket=require(_0xd1b0('0xe'))({'host':'localhost','port':0x18eb});require(_0xd1b0('0xf'))[_0xd1b0('0x10')](socket);function respondWithStatusCode(_0x434469,_0x364f05){_0x364f05=_0x364f05||0xcc;return function(_0x2b54ca){if(_0x2b54ca){return _0x434469[_0xd1b0('0x11')](_0x364f05);}return _0x434469[_0xd1b0('0x12')](_0x364f05)['end']();};}function respondWithResult(_0x3a94f0,_0x33f917){_0x33f917=_0x33f917||0xc8;return function(_0x1ca070){if(_0x1ca070){return _0x3a94f0[_0xd1b0('0x12')](_0x33f917)[_0xd1b0('0x13')](_0x1ca070);}};}function respondWithFilteredResult(_0x391962,_0x2e4fbe){return function(_0x496f1b){if(_0x496f1b){var _0x215109=_0x496f1b[_0xd1b0('0x14')],_0x995d48=_0x2e4fbe[_0xd1b0('0x15')],_0x19630f=_0x2e4fbe[_0xd1b0('0x15')]+_0x2e4fbe[_0xd1b0('0x16')],_0x492c48;if(_0x19630f>=_0x215109){_0x19630f=_0x215109;_0x492c48=0xc8;}else{_0x492c48=0xce;}_0x391962[_0xd1b0('0x12')](_0x492c48);return _0x391962['set']('Content-Range',_0x995d48+'-'+_0x19630f+'/'+_0x215109)[_0xd1b0('0x13')](_0x496f1b);}return null;};}function patchUpdates(_0x5093bb){return function(_0x433868){try{jsonpatch[_0xd1b0('0x17')](_0x433868,_0x5093bb,!![]);}catch(_0x4a8702){return BPromise[_0xd1b0('0x18')](_0x4a8702);}return _0x433868[_0xd1b0('0x19')]();};}function saveUpdates(_0x49626e,_0x2b18db){return function(_0x12e0f7){if(_0x12e0f7){return _0x12e0f7[_0xd1b0('0x1a')](_0x49626e)[_0xd1b0('0x1b')](function(_0x4f6afc){return _0x4f6afc;});}return null;};}function removeEntity(_0x246d58,_0x5f5681){return function(_0x46c6b0){if(_0x46c6b0){return _0x46c6b0[_0xd1b0('0x1c')]()[_0xd1b0('0x1b')](function(){_0x246d58[_0xd1b0('0x12')](0xcc)[_0xd1b0('0x1d')]();});}};}function handleEntityNotFound(_0x3eca41,_0x57a2eb){return function(_0xe7b82c){if(!_0xe7b82c){_0x3eca41[_0xd1b0('0x11')](0x194);}return _0xe7b82c;};}function handleError(_0x242eda,_0x1f6a77){_0x1f6a77=_0x1f6a77||0x1f4;return function(_0x36ffff){logger['error'](_0x36ffff['stack']);if(_0x36ffff['name']){delete _0x36ffff['name'];}_0x242eda[_0xd1b0('0x12')](_0x1f6a77)[_0xd1b0('0x1e')](_0x36ffff);};}exports[_0xd1b0('0x1f')]=function(_0x368f56,_0x1c9330){var _0x2730b0={},_0x4d9cdc={},_0x118f40={'count':0x0,'rows':[]};var _0x1eebdf=db[_0xd1b0('0x20')]['rawAttributes'];_0x4d9cdc['model']=_[_0xd1b0('0x21')](_0x1eebdf);var _0x253953={'dateStart':_0x368f56[_0xd1b0('0x22')][_0xd1b0('0x23')],'dateEnd':_0x368f56[_0xd1b0('0x22')][_0xd1b0('0x24')]};delete _0x368f56[_0xd1b0('0x22')][_0xd1b0('0x23')];delete _0x368f56[_0xd1b0('0x22')][_0xd1b0('0x24')];_0x4d9cdc[_0xd1b0('0x22')]=_['keys'](_0x368f56[_0xd1b0('0x22')]);_0x4d9cdc[_0xd1b0('0x25')]=_[_0xd1b0('0x26')](_0x4d9cdc[_0xd1b0('0x27')],_0x4d9cdc[_0xd1b0('0x22')]);_0x2730b0['attributes']=_[_0xd1b0('0x26')](_0x4d9cdc[_0xd1b0('0x27')],qs[_0xd1b0('0x28')](_0x368f56[_0xd1b0('0x22')][_0xd1b0('0x28')]));_0x2730b0[_0xd1b0('0x29')]=_0x2730b0['attributes'][_0xd1b0('0x2a')]?_0x2730b0[_0xd1b0('0x29')]:_0x4d9cdc['model'];if(!_0x368f56[_0xd1b0('0x22')]['hasOwnProperty'](_0xd1b0('0x2b'))){_0x2730b0[_0xd1b0('0x16')]=qs[_0xd1b0('0x16')](_0x368f56[_0xd1b0('0x22')][_0xd1b0('0x16')]);_0x2730b0[_0xd1b0('0x15')]=qs[_0xd1b0('0x15')](_0x368f56[_0xd1b0('0x22')][_0xd1b0('0x15')]);}_0x2730b0[_0xd1b0('0x2c')]=qs['sort'](_0x368f56[_0xd1b0('0x22')][_0xd1b0('0x2d')]);_0x2730b0['where']=qs[_0xd1b0('0x25')](_['pick'](_0x368f56[_0xd1b0('0x22')],_0x4d9cdc['filters']));if(_0x253953[_0xd1b0('0x23')]){if(_0x253953['dateEnd']){_0x253953[_0xd1b0('0x24')]=moment(_0x253953['dateEnd'])[_0xd1b0('0x2e')](0x1,_0xd1b0('0x2f'));}else{_0x253953[_0xd1b0('0x24')]=moment(_0x253953[_0xd1b0('0x23')])[_0xd1b0('0x2e')](0x1,'day');}_[_0xd1b0('0x30')](_0x2730b0[_0xd1b0('0x31')],{'createdAt':{'$gte':_0x253953[_0xd1b0('0x23')],'$lte':_0x253953[_0xd1b0('0x24')]}});}if(_0x368f56[_0xd1b0('0x22')][_0xd1b0('0x32')]){_0x2730b0['where']=_[_0xd1b0('0x30')](_0x2730b0['where'],{'$or':_[_0xd1b0('0x33')](_0x2730b0['attributes'],function(_0x4e1d38){var _0x1bf680={};_0x1bf680[_0x4e1d38]={'$like':'%'+_0x368f56[_0xd1b0('0x22')]['filter']+'%'};return _0x1bf680;})});}_0x2730b0=_[_0xd1b0('0x30')]({},_0x2730b0,_0x368f56[_0xd1b0('0x34')]);var _0x54eca9={'where':_0x2730b0[_0xd1b0('0x31')]};_0x54eca9[_0xd1b0('0x35')]=[];if(_0x368f56[_0xd1b0('0x22')][_0xd1b0('0x36')]){_0x54eca9[_0xd1b0('0x35')][_0xd1b0('0x37')]({'model':db[_0xd1b0('0x38')],'as':'Tags','attributes':['id'],'where':{'id':_0x368f56[_0xd1b0('0x22')]['tag']},'required':!![]});_0x54eca9[_0xd1b0('0x39')]=!![];}if(_0x368f56[_0xd1b0('0x22')][_0xd1b0('0x3a')]){_0x54eca9[_0xd1b0('0x35')][_0xd1b0('0x37')]({'model':db[_0xd1b0('0x3b')],'as':_0xd1b0('0x3c'),'attributes':['id',_0xd1b0('0x3d'),_0xd1b0('0x3e'),_0xd1b0('0x3a')],'where':{'direction':'in','read':_0x368f56[_0xd1b0('0x22')][_0xd1b0('0x3a')]||![]},'required':!![]});_0x54eca9[_0xd1b0('0x39')]=!![];}return db[_0xd1b0('0x20')][_0xd1b0('0x14')](_0x54eca9)[_0xd1b0('0x1b')](function(_0x1012a3){_0x118f40[_0xd1b0('0x14')]=_0x1012a3;if(_0x368f56[_0xd1b0('0x22')][_0xd1b0('0x3f')]){_0x2730b0['include']=[{'model':db[_0xd1b0('0x40')],'as':_0xd1b0('0x41'),'required':![],'attributes':['id',_0xd1b0('0x42'),_0xd1b0('0x43')]},{'model':db[_0xd1b0('0x44')],'as':_0xd1b0('0x45'),'required':![]},{'model':db[_0xd1b0('0x40')],'as':_0xd1b0('0x46'),'attributes':['name',_0xd1b0('0x43'),_0xd1b0('0x47')],'required':![]},{'model':db[_0xd1b0('0x48')],'as':'Account','attributes':[_0xd1b0('0x42'),_0xd1b0('0x49')],'required':![]},{'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0xd1b0('0x3d'),'createdAt',_0xd1b0('0x3a')],'where':{'direction':'in','read':_0x368f56[_0xd1b0('0x22')][_0xd1b0('0x3a')]||![]},'required':_0x368f56['query'][_0xd1b0('0x3a')]||![]},{'model':db[_0xd1b0('0x38')],'as':_0xd1b0('0x4a'),'attributes':['id',_0xd1b0('0x42'),'color'],'required':_0x368f56['query'][_0xd1b0('0x36')]?!![]:![]},{'model':db['Tag'],'as':_0xd1b0('0x4b'),'attributes':['id','name',_0xd1b0('0x4c')],'through':_0x368f56[_0xd1b0('0x22')]['tag']?{'attributes':[],'where':{'TagId':_0x368f56[_0xd1b0('0x22')][_0xd1b0('0x36')]||undefined}}:{},'required':_0x368f56[_0xd1b0('0x22')][_0xd1b0('0x36')]?!![]:![]}];}return db[_0xd1b0('0x20')][_0xd1b0('0x4d')](_0x2730b0);})['then'](function(_0x529ce9){_0x118f40[_0xd1b0('0x4e')]=_0x529ce9;return _0x118f40;})[_0xd1b0('0x1b')](respondWithFilteredResult(_0x1c9330,_0x2730b0))[_0xd1b0('0x4f')](handleError(_0x1c9330,null));};exports[_0xd1b0('0x50')]=function(_0x234907,_0x2caeef){var _0x6942da={'raw':![],'where':{'id':_0x234907['params']['id']}},_0x411043={};_0x411043[_0xd1b0('0x27')]=_[_0xd1b0('0x21')](db['SmsInteraction'][_0xd1b0('0x51')]);_0x411043[_0xd1b0('0x22')]=_['keys'](_0x234907[_0xd1b0('0x22')]);_0x411043[_0xd1b0('0x25')]=_[_0xd1b0('0x26')](_0x411043[_0xd1b0('0x27')],_0x411043[_0xd1b0('0x22')]);_0x6942da[_0xd1b0('0x29')]=_[_0xd1b0('0x26')](_0x411043[_0xd1b0('0x27')],qs[_0xd1b0('0x28')](_0x234907['query'][_0xd1b0('0x28')]));_0x6942da[_0xd1b0('0x29')]=_0x6942da[_0xd1b0('0x29')][_0xd1b0('0x2a')]?_0x6942da[_0xd1b0('0x29')]:_0x411043[_0xd1b0('0x27')];if(_0x234907[_0xd1b0('0x22')][_0xd1b0('0x3f')]){_0x6942da[_0xd1b0('0x35')]=[{'all':!![]}];}_0x6942da=_[_0xd1b0('0x30')]({},_0x6942da,_0x234907[_0xd1b0('0x34')]);return db[_0xd1b0('0x20')][_0xd1b0('0x52')](_0x6942da)[_0xd1b0('0x1b')](handleEntityNotFound(_0x2caeef,null))[_0xd1b0('0x1b')](respondWithResult(_0x2caeef,null))[_0xd1b0('0x4f')](handleError(_0x2caeef,null));};exports[_0xd1b0('0x53')]=function(_0x371e30,_0x27da21){return db[_0xd1b0('0x20')][_0xd1b0('0x53')](_0x371e30[_0xd1b0('0x54')],{})[_0xd1b0('0x1b')](respondWithResult(_0x27da21,0xc9))[_0xd1b0('0x4f')](handleError(_0x27da21,null));};exports[_0xd1b0('0x1a')]=function(_0x2b2f04,_0x33a63b){if(_0x2b2f04['body']['id']){delete _0x2b2f04[_0xd1b0('0x54')]['id'];}return db[_0xd1b0('0x20')]['find']({'where':{'id':_0x2b2f04[_0xd1b0('0x55')]['id']}})[_0xd1b0('0x1b')](handleEntityNotFound(_0x33a63b,null))[_0xd1b0('0x1b')](saveUpdates(_0x2b2f04[_0xd1b0('0x54')],null))['then'](respondWithResult(_0x33a63b,null))['catch'](handleError(_0x33a63b,null));};exports[_0xd1b0('0x1c')]=function(_0x2c98cc,_0x5d57b9){return db[_0xd1b0('0x20')][_0xd1b0('0x52')]({'where':{'id':_0x2c98cc[_0xd1b0('0x55')]['id']}})[_0xd1b0('0x1b')](handleEntityNotFound(_0x5d57b9,null))[_0xd1b0('0x1b')](removeEntity(_0x5d57b9,null))[_0xd1b0('0x4f')](handleError(_0x5d57b9,null));};exports[_0xd1b0('0x56')]=function(_0x32b92c,_0x1f3e72){return db[_0xd1b0('0x20')]['describe']()[_0xd1b0('0x1b')](respondWithResult(_0x1f3e72,null))[_0xd1b0('0x4f')](handleError(_0x1f3e72,null));};exports['addMessage']=function(_0x3b92d8,_0x2c350b,_0x5d7d64){return db[_0xd1b0('0x3b')][_0xd1b0('0x52')]({'where':{'id':_0x3b92d8[_0xd1b0('0x55')]['id']}})[_0xd1b0('0x1b')](handleEntityNotFound(_0x2c350b,null))[_0xd1b0('0x1b')](function(_0x19eacb){if(_0x19eacb){return _0x19eacb['addMessage'](_0x3b92d8['body'][_0xd1b0('0x57')],_[_0xd1b0('0x58')](_0x3b92d8[_0xd1b0('0x54')],[_0xd1b0('0x57'),'id'])||{});}})[_0xd1b0('0x1b')](respondWithResult(_0x2c350b,null))['catch'](handleError(_0x2c350b,null));};exports[_0xd1b0('0x59')]=function(_0x5cd483,_0x168ad6,_0x447894){var _0x50e437={'raw':![],'where':{}};var _0x553479={};var _0x51454f={'count':0x0,'rows':[]};return db[_0xd1b0('0x20')][_0xd1b0('0x5a')]({'where':{'id':_0x5cd483['params']['id']}})['then'](handleEntityNotFound(_0x168ad6,null))['then'](function(_0x4f0fa1){if(_0x4f0fa1){_0x553479[_0xd1b0('0x27')]=_['keys'](db['SmsMessage'][_0xd1b0('0x51')]);_0x553479[_0xd1b0('0x22')]=_[_0xd1b0('0x21')](_0x5cd483['query']);_0x553479[_0xd1b0('0x25')]=_[_0xd1b0('0x26')](_0x553479['model'],_0x553479['query']);_0x50e437[_0xd1b0('0x29')]=_[_0xd1b0('0x26')](_0x553479[_0xd1b0('0x27')],qs[_0xd1b0('0x28')](_0x5cd483[_0xd1b0('0x22')][_0xd1b0('0x28')]));_0x50e437[_0xd1b0('0x29')]=_0x50e437['attributes'][_0xd1b0('0x2a')]?_0x50e437[_0xd1b0('0x29')]:_0x553479[_0xd1b0('0x27')];if(!_0x5cd483[_0xd1b0('0x22')][_0xd1b0('0x5b')]('nolimit')){_0x50e437['limit']=qs[_0xd1b0('0x16')](_0x5cd483[_0xd1b0('0x22')][_0xd1b0('0x16')]);_0x50e437[_0xd1b0('0x15')]=qs[_0xd1b0('0x15')](_0x5cd483[_0xd1b0('0x22')][_0xd1b0('0x15')]);}_0x50e437[_0xd1b0('0x2c')]=qs['sort'](_0x5cd483[_0xd1b0('0x22')]['sort']);_0x50e437[_0xd1b0('0x31')]=qs['filters'](_[_0xd1b0('0x5c')](_0x5cd483[_0xd1b0('0x22')],_0x553479[_0xd1b0('0x25')]));_0x50e437['where'][_0xd1b0('0x5d')]=_0x4f0fa1['id'];if(_0x5cd483['query'][_0xd1b0('0x32')]){_0x50e437[_0xd1b0('0x31')]=_[_0xd1b0('0x30')](_0x50e437[_0xd1b0('0x31')],{'$or':_[_0xd1b0('0x33')](_0x50e437['attributes'],function(_0x2a7556){var _0x14e54a={};_0x14e54a[_0x2a7556]={'$like':'%'+_0x5cd483[_0xd1b0('0x22')][_0xd1b0('0x32')]+'%'};return _0x14e54a;})});}if(_0x5cd483[_0xd1b0('0x22')]['$gte']){var _0x36c72a=_0x5cd483[_0xd1b0('0x22')][_0xd1b0('0x5e')][_0xd1b0('0x5f')](',');var _0x35b751={};_0x35b751[_0x36c72a[0x0]]={'$gte':moment(_0x36c72a[0x1])[_0xd1b0('0x60')](_0xd1b0('0x61'))};_0x50e437[_0xd1b0('0x31')]=_['merge'](_0x50e437[_0xd1b0('0x31')],_0x35b751);}_0x50e437=_[_0xd1b0('0x30')]({},_0x50e437,_0x5cd483['options']);return db[_0xd1b0('0x3b')][_0xd1b0('0x14')]({'where':_0x50e437['where']})[_0xd1b0('0x1b')](function(_0x49c95a){_0x51454f[_0xd1b0('0x14')]=_0x49c95a;if(_0x5cd483[_0xd1b0('0x22')]['includeAll']){_0x50e437[_0xd1b0('0x35')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x50e437);})['then'](function(_0x1dbf21){_0x51454f[_0xd1b0('0x4e')]=_0x1dbf21;return _0x51454f;});}})[_0xd1b0('0x1b')](respondWithFilteredResult(_0x168ad6,_0x50e437))[_0xd1b0('0x4f')](handleError(_0x168ad6,null));};exports[_0xd1b0('0x62')]=function(_0x5759ec,_0x3d479b,_0x33bf38){return db[_0xd1b0('0x20')][_0xd1b0('0x52')]({'where':{'id':_0x5759ec[_0xd1b0('0x55')]['id']}})[_0xd1b0('0x1b')](handleEntityNotFound(_0x3d479b,null))[_0xd1b0('0x1b')](function(_0x2576b4){if(_0x2576b4){return _0x2576b4[_0xd1b0('0x63')](_0x5759ec['body'][_0xd1b0('0x57')],_[_0xd1b0('0x58')](_0x5759ec[_0xd1b0('0x54')],['ids','id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0xd1b0('0x42'),_0xd1b0('0x4c')],'where':{'id':_0x5759ec[_0xd1b0('0x54')][_0xd1b0('0x57')]}});})['then'](function(_0x555ce1){socket[_0xd1b0('0x64')](_0xd1b0('0x65'),{'id':Number(_0x5759ec[_0xd1b0('0x55')]['id']),'tags':_0x555ce1||[]});return{'id':Number(_0x5759ec[_0xd1b0('0x55')]['id']),'tags':_0x555ce1||[]};});}})[_0xd1b0('0x1b')](respondWithResult(_0x3d479b,null))[_0xd1b0('0x4f')](handleError(_0x3d479b,null));};exports[_0xd1b0('0x66')]=function(_0xaabf72,_0x17476a,_0xe1eae1){var _0x33c3fa;return db[_0xd1b0('0x20')][_0xd1b0('0x52')]({'where':{'id':_0xaabf72[_0xd1b0('0x55')]['id']}})[_0xd1b0('0x1b')](handleEntityNotFound(_0x17476a,null))[_0xd1b0('0x1b')](function(_0x381952){if(_0x381952){return _0x381952['removeTags'](_0xaabf72[_0xd1b0('0x22')][_0xd1b0('0x57')]);}})[_0xd1b0('0x1b')](respondWithStatusCode(_0x17476a,null))[_0xd1b0('0x4f')](handleError(_0x17476a,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 1fb7f61..2a0dcd6 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 _0x0b56=['hasOwnProperty','hook','exports','events','setMaxListeners','save','update','emit'];(function(_0x3110e2,_0x3a1b12){var _0x315c40=function(_0x58f5a6){while(--_0x58f5a6){_0x3110e2['push'](_0x3110e2['shift']());}};_0x315c40(++_0x3a1b12);}(_0x0b56,0x1bb));var _0x60b5=function(_0x5bb39e,_0x53f22a){_0x5bb39e=_0x5bb39e-0x0;var _0x438f88=_0x0b56[_0x5bb39e];return _0x438f88;};'use strict';var EventEmitter=require(_0x60b5('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x60b5('0x1')](0x0);var events={'afterCreate':_0x60b5('0x2'),'afterUpdate':_0x60b5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1c107a){return function(_0x1f9e2a,_0x1ea89c,_0x2f7cf1){SmsInteractionEvents[_0x60b5('0x4')](_0x1c107a+':'+_0x1f9e2a['id'],_0x1f9e2a);SmsInteractionEvents['emit'](_0x1c107a,_0x1f9e2a);_0x2f7cf1(null);};}for(var e in events){if(events[_0x60b5('0x5')](e)){var event=events[e];SmsInteraction[_0x60b5('0x6')](e,emitEvent(event));}}module[_0x60b5('0x7')]=SmsInteractionEvents; \ No newline at end of file +var _0x5dbb=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x5dbb,0x1a4));var _0xb5db=function(_0x5930cd,_0x422a74){_0x5930cd=_0x5930cd-0x0;var _0x436c54=_0x5dbb[_0x5930cd];return _0x436c54;};'use strict';var EventEmitter=require(_0xb5db('0x0'));var SmsInteraction=require(_0xb5db('0x1'))['db']['SmsInteraction'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xb5db('0x2')](0x0);var events={'afterCreate':_0xb5db('0x3'),'afterUpdate':_0xb5db('0x4'),'afterDestroy':_0xb5db('0x5')};function emitEvent(_0x2a7001){return function(_0x506eda,_0x10f472,_0x1e7733){SmsInteractionEvents[_0xb5db('0x6')](_0x2a7001+':'+_0x506eda['id'],_0x506eda);SmsInteractionEvents[_0xb5db('0x6')](_0x2a7001,_0x506eda);_0x1e7733(null);};}for(var e in events){if(events[_0xb5db('0x7')](e)){var event=events[e];SmsInteraction[_0xb5db('0x8')](e,emitEvent(event));}}module[_0xb5db('0x9')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 5204120..e58d4b4 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 _0xfbc7=['moment','bluebird','request-promise','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','util','../../config/logger'];(function(_0x528bb5,_0x119c5b){var _0x58e8ca=function(_0x5a8077){while(--_0x5a8077){_0x528bb5['push'](_0x528bb5['shift']());}};_0x58e8ca(++_0x119c5b);}(_0xfbc7,0x134));var _0x7fbc=function(_0x1e379d,_0x2feab6){_0x1e379d=_0x1e379d-0x0;var _0x301e5c=_0xfbc7[_0x1e379d];return _0x301e5c;};'use strict';var _=require('lodash');var util=require(_0x7fbc('0x0'));var logger=require(_0x7fbc('0x1'))('api');var moment=require(_0x7fbc('0x2'));var BPromise=require(_0x7fbc('0x3'));var rp=require(_0x7fbc('0x4'));var attributes=require(_0x7fbc('0x5'));module[_0x7fbc('0x6')]=function(_0x2abe67,_0x5cb54b){return _0x2abe67[_0x7fbc('0x7')](_0x7fbc('0x8'),attributes,{'tableName':_0x7fbc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98ae=['../../config/logger','api','bluebird','request-promise','./smsInteraction.attributes','SmsInteraction','sms_interactions','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x98ae,0x142));var _0xe98a=function(_0x43ab99,_0x1c83a5){_0x43ab99=_0x43ab99-0x0;var _0x16bfab=_0x98ae[_0x43ab99];return _0x16bfab;};'use strict';var _=require(_0xe98a('0x0'));var util=require(_0xe98a('0x1'));var logger=require(_0xe98a('0x2'))(_0xe98a('0x3'));var moment=require('moment');var BPromise=require(_0xe98a('0x4'));var rp=require(_0xe98a('0x5'));var attributes=require(_0xe98a('0x6'));module['exports']=function(_0x3ed189,_0x439532){return _0x3ed189['define'](_0xe98a('0x7'),attributes,{'tableName':_0xe98a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 91b33b5..7f95909 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 _0x0d13=['where','limit','UpdateSmsInteraction','catch','find','addTags','body','ids','omit','spread','AddTags','util','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','localhost','./smsInteraction.socket','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','update','options','raw'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x0d13,0x71));var _0x30d1=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x0d13[_0x75f869];return _0x10af8b;};'use strict';var _=require('lodash');var util=require(_0x30d1('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0x30d1('0x1'))['db'];var utils=require(_0x30d1('0x2'));var logger=require(_0x30d1('0x3'))(_0x30d1('0x4'));var config=require('../../config/environment');var jayson=require(_0x30d1('0x5'));var client=jayson[_0x30d1('0x6')][_0x30d1('0x7')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0x30d1('0x8'),'port':0x18eb});require(_0x30d1('0x9'))['register'](socket);function respondWithRpcPromise(_0x441fa3,_0x536e4d,_0x1dfb87){return new BPromise(function(_0x4b225c,_0x30e1b1){return client['request'](_0x441fa3,_0x1dfb87)[_0x30d1('0xa')](function(_0x42312d){logger[_0x30d1('0xb')](_0x30d1('0xc'),_0x536e4d,'request\x20sent');logger[_0x30d1('0xd')](_0x30d1('0xe'),_0x536e4d,'request\x20sent',JSON[_0x30d1('0xf')](_0x42312d));if(_0x42312d[_0x30d1('0x10')]){if(_0x42312d['error'][_0x30d1('0x11')]===0x1f4){logger[_0x30d1('0x10')](_0x30d1('0xc'),_0x536e4d,_0x42312d[_0x30d1('0x10')][_0x30d1('0x12')]);return _0x30e1b1(_0x42312d[_0x30d1('0x10')][_0x30d1('0x12')]);}logger[_0x30d1('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x536e4d,_0x42312d['error'][_0x30d1('0x12')]);return _0x4b225c(_0x42312d[_0x30d1('0x10')][_0x30d1('0x12')]);}else{logger[_0x30d1('0xb')](_0x30d1('0xc'),_0x536e4d,_0x30d1('0x13'));_0x4b225c(_0x42312d['result'][_0x30d1('0x12')]);}})['catch'](function(_0x5860f8){logger[_0x30d1('0x10')](_0x30d1('0xc'),_0x536e4d,_0x5860f8);_0x30e1b1(_0x5860f8);});});}exports['UpdateSmsInteraction']=function(_0x8a4149){var _0x116734=this;return new Promise(function(_0x552157,_0x1bdcab){return db['SmsInteraction'][_0x30d1('0x14')](_0x8a4149['body'],{'raw':_0x8a4149[_0x30d1('0x15')]?_0x8a4149[_0x30d1('0x15')][_0x30d1('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8a4149[_0x30d1('0x15')]?_0x8a4149['options'][_0x30d1('0x17')]||null:null,'attributes':_0x8a4149[_0x30d1('0x15')]?_0x8a4149['options']['attributes']||null:null,'limit':_0x8a4149[_0x30d1('0x15')]?_0x8a4149[_0x30d1('0x15')][_0x30d1('0x18')]||null:null})[_0x30d1('0xa')](function(_0x5cad9b){logger[_0x30d1('0xb')](_0x30d1('0x19'),_0x8a4149);logger[_0x30d1('0xd')](_0x30d1('0x19'),_0x8a4149,JSON[_0x30d1('0xf')](_0x5cad9b));_0x552157(_0x5cad9b);})[_0x30d1('0x1a')](function(_0x1a53c7){logger[_0x30d1('0x10')](_0x30d1('0x19'),_0x1a53c7[_0x30d1('0x12')],_0x8a4149);_0x1bdcab(_0x116734[_0x30d1('0x10')](0x1f4,_0x1a53c7[_0x30d1('0x12')]));});});};exports['AddTagsToSmsInteraction']=function(_0x3d4dcc){return new Promise(function(_0x3e2a7b,_0x497018){return db['SmsInteraction'][_0x30d1('0x1b')]({'where':_0x3d4dcc['options']?_0x3d4dcc['options'][_0x30d1('0x17')]||null:null})[_0x30d1('0xa')](function(_0x22ab38){if(_0x22ab38){return _0x22ab38[_0x30d1('0x1c')](_0x3d4dcc[_0x30d1('0x1d')][_0x30d1('0x1e')],_[_0x30d1('0x1f')](_0x3d4dcc[_0x30d1('0x1d')],[_0x30d1('0x1e'),'id'])||{});}})[_0x30d1('0x20')](function(_0xc06889){logger[_0x30d1('0xb')](_0x30d1('0x21'),_0x3d4dcc);logger['debug'](_0x30d1('0x21'),_0x3d4dcc,JSON[_0x30d1('0xf')](_0xc06889));_0x3e2a7b(_0xc06889);})['catch'](function(_0x1fef67){logger[_0x30d1('0x10')](_0x30d1('0x21'),_0x1fef67['message'],_0x3d4dcc);_0x497018(_this[_0x30d1('0x10')](0x1f4,_0x1fef67[_0x30d1('0x12')]));});});}; \ No newline at end of file +var _0xd013=['options','raw','attributes','limit','UpdateSmsInteraction','catch','AddTagsToSmsInteraction','find','addTags','body','ids','omit','spread','AddTags','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','socket.io-emitter','./smsInteraction.socket','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','SmsInteraction','update'];(function(_0x6f24f9,_0x14049c){var _0x3d36d7=function(_0x4c54bd){while(--_0x4c54bd){_0x6f24f9['push'](_0x6f24f9['shift']());}};_0x3d36d7(++_0x14049c);}(_0xd013,0x146));var _0x3d01=function(_0x4e4f0e,_0x1c3892){_0x4e4f0e=_0x4e4f0e-0x0;var _0x1a7219=_0xd013[_0x4e4f0e];return _0x1a7219;};'use strict';var _=require('lodash');var util=require(_0x3d01('0x0'));var moment=require('moment');var BPromise=require(_0x3d01('0x1'));var rs=require(_0x3d01('0x2'));var fs=require('fs');var db=require(_0x3d01('0x3'))['db'];var utils=require(_0x3d01('0x4'));var logger=require(_0x3d01('0x5'))('rpc');var config=require(_0x3d01('0x6'));var jayson=require(_0x3d01('0x7'));var client=jayson[_0x3d01('0x8')][_0x3d01('0x9')]({'port':0x232a});var socket=require(_0x3d01('0xa'))({'host':'localhost','port':0x18eb});require(_0x3d01('0xb'))['register'](socket);function respondWithRpcPromise(_0x4ce4a6,_0x36c4fd,_0x3dc793){return new BPromise(function(_0x356c5b,_0xa16a36){return client['request'](_0x4ce4a6,_0x3dc793)[_0x3d01('0xc')](function(_0x1de713){logger[_0x3d01('0xd')](_0x3d01('0xe'),_0x36c4fd,'request\x20sent');logger[_0x3d01('0xf')](_0x3d01('0x10'),_0x36c4fd,_0x3d01('0x11'),JSON[_0x3d01('0x12')](_0x1de713));if(_0x1de713[_0x3d01('0x13')]){if(_0x1de713[_0x3d01('0x13')][_0x3d01('0x14')]===0x1f4){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x36c4fd,_0x1de713[_0x3d01('0x13')][_0x3d01('0x15')]);return _0xa16a36(_0x1de713['error']['message']);}logger[_0x3d01('0x13')](_0x3d01('0xe'),_0x36c4fd,_0x1de713[_0x3d01('0x13')][_0x3d01('0x15')]);return _0x356c5b(_0x1de713[_0x3d01('0x13')][_0x3d01('0x15')]);}else{logger[_0x3d01('0xd')](_0x3d01('0xe'),_0x36c4fd,_0x3d01('0x11'));_0x356c5b(_0x1de713[_0x3d01('0x16')][_0x3d01('0x15')]);}})['catch'](function(_0x6014e3){logger['error'](_0x3d01('0xe'),_0x36c4fd,_0x6014e3);_0xa16a36(_0x6014e3);});});}exports['UpdateSmsInteraction']=function(_0x3a338e){var _0x468ad9=this;return new Promise(function(_0x262d4e,_0x41cf20){return db[_0x3d01('0x17')][_0x3d01('0x18')](_0x3a338e['body'],{'raw':_0x3a338e['options']?_0x3a338e[_0x3d01('0x19')][_0x3d01('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a338e[_0x3d01('0x19')]?_0x3a338e[_0x3d01('0x19')]['where']||null:null,'attributes':_0x3a338e[_0x3d01('0x19')]?_0x3a338e[_0x3d01('0x19')][_0x3d01('0x1b')]||null:null,'limit':_0x3a338e[_0x3d01('0x19')]?_0x3a338e[_0x3d01('0x19')][_0x3d01('0x1c')]||null:null})['then'](function(_0x29a8a7){logger[_0x3d01('0xd')](_0x3d01('0x1d'),_0x3a338e);logger[_0x3d01('0xf')](_0x3d01('0x1d'),_0x3a338e,JSON[_0x3d01('0x12')](_0x29a8a7));_0x262d4e(_0x29a8a7);})[_0x3d01('0x1e')](function(_0x5d7551){logger[_0x3d01('0x13')](_0x3d01('0x1d'),_0x5d7551['message'],_0x3a338e);_0x41cf20(_0x468ad9[_0x3d01('0x13')](0x1f4,_0x5d7551[_0x3d01('0x15')]));});});};exports[_0x3d01('0x1f')]=function(_0x25f967){return new Promise(function(_0xd3a8cb,_0x5131d6){return db['SmsInteraction'][_0x3d01('0x20')]({'where':_0x25f967[_0x3d01('0x19')]?_0x25f967[_0x3d01('0x19')]['where']||null:null})[_0x3d01('0xc')](function(_0x446838){if(_0x446838){return _0x446838[_0x3d01('0x21')](_0x25f967[_0x3d01('0x22')][_0x3d01('0x23')],_[_0x3d01('0x24')](_0x25f967['body'],[_0x3d01('0x23'),'id'])||{});}})[_0x3d01('0x25')](function(_0x456ab0){logger[_0x3d01('0xd')](_0x3d01('0x26'),_0x25f967);logger[_0x3d01('0xf')](_0x3d01('0x26'),_0x25f967,JSON[_0x3d01('0x12')](_0x456ab0));_0xd3a8cb(_0x456ab0);})[_0x3d01('0x1e')](function(_0x37b706){logger[_0x3d01('0x13')]('AddTags',_0x37b706[_0x3d01('0x15')],_0x25f967);_0x5131d6(_this[_0x3d01('0x13')](0x1f4,_0x37b706[_0x3d01('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index e36b799..578ebd9 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 _0xe469=['./smsInteraction.events','save','remove','update','emit'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xe469,0x1d6));var _0x9e46=function(_0x129a9a,_0x42d62f){_0x129a9a=_0x129a9a-0x0;var _0x3a1ac2=_0xe469[_0x129a9a];return _0x3a1ac2;};'use strict';var SmsInteractionEvents=require(_0x9e46('0x0'));var events=[_0x9e46('0x1'),_0x9e46('0x2'),_0x9e46('0x3')];function createListener(_0x521d2b,_0x1fb2fd){return function(_0x3ef21e){_0x1fb2fd[_0x9e46('0x4')](_0x521d2b,_0x3ef21e);};}function removeListener(_0x4bbf89,_0x2d2c93){return function(){SmsInteractionEvents['removeListener'](_0x4bbf89,_0x2d2c93);};}exports['register']=function(_0x577af8){for(var _0x1be16e=0x0,_0x278971=events['length'];_0x1be16e<_0x278971;_0x1be16e++){var _0x5c3eaa=events[_0x1be16e];var _0x130488=createListener('smsInteraction:'+_0x5c3eaa,_0x577af8);SmsInteractionEvents['on'](_0x5c3eaa,_0x130488);}}; \ No newline at end of file +var _0x7035=['save','update','emit','removeListener','smsInteraction:'];(function(_0x180fa4,_0x1da0db){var _0x5103af=function(_0x4570f1){while(--_0x4570f1){_0x180fa4['push'](_0x180fa4['shift']());}};_0x5103af(++_0x1da0db);}(_0x7035,0xf5));var _0x5703=function(_0x608756,_0x38af0d){_0x608756=_0x608756-0x0;var _0xfb588e=_0x7035[_0x608756];return _0xfb588e;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x5703('0x0'),'remove',_0x5703('0x1')];function createListener(_0x50e0bb,_0x274b37){return function(_0x218a01){_0x274b37[_0x5703('0x2')](_0x50e0bb,_0x218a01);};}function removeListener(_0x19762e,_0x399296){return function(){SmsInteractionEvents[_0x5703('0x3')](_0x19762e,_0x399296);};}exports['register']=function(_0x1a19b1){for(var _0x34c0b0=0x0,_0x59422d=events['length'];_0x34c0b0<_0x59422d;_0x34c0b0++){var _0x4eff3c=events[_0x34c0b0];var _0x47a728=createListener(_0x5703('0x4')+_0x4eff3c,_0x1a19b1);SmsInteractionEvents['on'](_0x4eff3c,_0x47a728);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 53228c1..e6aff60 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 _0xaa63=['update','/:id/accept','/:id/reject','reject','delete','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','sms','create','status','put'];(function(_0x2f7e77,_0x3a4c36){var _0x243cab=function(_0x59c8ed){while(--_0x59c8ed){_0x2f7e77['push'](_0x2f7e77['shift']());}};_0x243cab(++_0x3a4c36);}(_0xaa63,0x127));var _0x3aa6=function(_0x240e6c,_0x456ccc){_0x240e6c=_0x240e6c-0x0;var _0x1aae46=_0xaa63[_0x240e6c];return _0x1aae46;};'use strict';var multer=require('multer');var util=require(_0x3aa6('0x0'));var path=require(_0x3aa6('0x1'));var express=require('express');var router=express[_0x3aa6('0x2')]();var auth=require(_0x3aa6('0x3'));var interaction=require(_0x3aa6('0x4'));var config=require('../../config/environment');var controller=require('./smsMessage.controller');router[_0x3aa6('0x5')]('/',auth[_0x3aa6('0x6')](),controller[_0x3aa6('0x7')]);router[_0x3aa6('0x5')](_0x3aa6('0x8'),auth[_0x3aa6('0x6')](),controller[_0x3aa6('0x9')]);router[_0x3aa6('0x5')](_0x3aa6('0xa'),auth[_0x3aa6('0x6')](),controller['show']);router[_0x3aa6('0xb')]('/',auth[_0x3aa6('0x6')](),interaction[_0x3aa6('0xc')](_0x3aa6('0xd'),'smsmessage:create'),controller[_0x3aa6('0xe')]);router[_0x3aa6('0xb')]('/:id/status',controller[_0x3aa6('0xf')]);router[_0x3aa6('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x3aa6('0x11')]);router[_0x3aa6('0x10')](_0x3aa6('0x12'),auth[_0x3aa6('0x6')](),controller['accept']);router['put'](_0x3aa6('0x13'),auth[_0x3aa6('0x6')](),controller[_0x3aa6('0x14')]);router[_0x3aa6('0x15')](_0x3aa6('0xa'),auth['isAuthenticated'](),controller[_0x3aa6('0x16')]);module[_0x3aa6('0x17')]=router; \ No newline at end of file +var _0x780d=['util','path','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','/describe','isAuthenticated','describe','/:id','sms','create','post','status','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer'];(function(_0x5e2cb4,_0x592c64){var _0x282902=function(_0x1c1836){while(--_0x1c1836){_0x5e2cb4['push'](_0x5e2cb4['shift']());}};_0x282902(++_0x592c64);}(_0x780d,0x89));var _0xd780=function(_0x5d4742,_0x47ca1a){_0x5d4742=_0x5d4742-0x0;var _0x4c3c23=_0x780d[_0x5d4742];return _0x4c3c23;};'use strict';var multer=require(_0xd780('0x0'));var util=require(_0xd780('0x1'));var path=require(_0xd780('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xd780('0x3'));var interaction=require(_0xd780('0x4'));var config=require('../../config/environment');var controller=require(_0xd780('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd780('0x6')](_0xd780('0x7'),auth[_0xd780('0x8')](),controller[_0xd780('0x9')]);router[_0xd780('0x6')](_0xd780('0xa'),auth[_0xd780('0x8')](),controller['show']);router['post']('/',auth[_0xd780('0x8')](),interaction['tracked'](_0xd780('0xb'),'smsmessage:create'),controller[_0xd780('0xc')]);router[_0xd780('0xd')]('/:id/status',controller[_0xd780('0xe')]);router[_0xd780('0xf')](_0xd780('0xa'),auth[_0xd780('0x8')](),controller[_0xd780('0x10')]);router['put'](_0xd780('0x11'),auth[_0xd780('0x8')](),controller[_0xd780('0x12')]);router[_0xd780('0xf')](_0xd780('0x13'),auth['isAuthenticated'](),controller[_0xd780('0x14')]);router['delete'](_0xd780('0xa'),auth['isAuthenticated'](),controller[_0xd780('0x15')]);module[_0xd780('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 6a7b38e..fa45fc1 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 _0x6bac=['BOOLEAN','ENUM','STRING','DATE','sequelize','TEXT','medium'];(function(_0x13cafd,_0x30c87f){var _0x29e346=function(_0x2ccf54){while(--_0x2ccf54){_0x13cafd['push'](_0x13cafd['shift']());}};_0x29e346(++_0x30c87f);}(_0x6bac,0xa5));var _0xc6ba=function(_0x3851d1,_0x4dab08){_0x3851d1=_0x3851d1-0x0;var _0x13180f=_0x6bac[_0x3851d1];return _0x13180f;};'use strict';var Sequelize=require(_0xc6ba('0x0'));module['exports']={'body':{'type':Sequelize[_0xc6ba('0x1')](_0xc6ba('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc6ba('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc6ba('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xc6ba('0x5')]},'readAt':{'type':Sequelize[_0xc6ba('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x83d0=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x33eecd,_0xc19811){var _0x33bb0d=function(_0x1d6c69){while(--_0x1d6c69){_0x33eecd['push'](_0x33eecd['shift']());}};_0x33bb0d(++_0xc19811);}(_0x83d0,0xb7));var _0x083d=function(_0x4bcf55,_0x52271c){_0x4bcf55=_0x4bcf55-0x0;var _0x355791=_0x83d0[_0x4bcf55];return _0x355791;};'use strict';var Sequelize=require(_0x083d('0x0'));module[_0x083d('0x1')]={'body':{'type':Sequelize[_0x083d('0x2')](_0x083d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x083d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x083d('0x5')]('in','out'),'defaultValue':_0x083d('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x083d('0x7')]},'secret':{'type':Sequelize[_0x083d('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 9121ebd..2641f3f 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 _0x1fed=['./smsMessage.socket','register','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','count','set','Content-Range','save','update','stack','send','SmsMessage','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','offset','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','rows','params','find','create','body','destroy','describe','sms-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','sms','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','type','inspect','twilio','messageId','plivo','MessageUUID','indexOf','sent','fast-json-patch','moment','bluebird','mustache','util','path','ejs','squel','crypto','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','socket.io-emitter','localhost'];(function(_0x32f26d,_0x2c0b5d){var _0x5d9ddc=function(_0x1f0e26){while(--_0x1f0e26){_0x32f26d['push'](_0x32f26d['shift']());}};_0x5d9ddc(++_0x2c0b5d);}(_0x1fed,0x1d3));var _0xd1fe=function(_0x330cc5,_0x147150){_0x330cc5=_0x330cc5-0x0;var _0x5b3ad9=_0x1fed[_0x330cc5];return _0x5b3ad9;};'use strict';var jsonpatch=require(_0xd1fe('0x0'));var rp=require('request-promise');var moment=require(_0xd1fe('0x1'));var BPromise=require(_0xd1fe('0x2'));var Mustache=require(_0xd1fe('0x3'));var util=require(_0xd1fe('0x4'));var path=require(_0xd1fe('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd1fe('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd1fe('0x7'));var crypto=require(_0xd1fe('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd1fe('0x9'));var qs=require(_0xd1fe('0xa'));var logger=require(_0xd1fe('0xb'))(_0xd1fe('0xc'));var utils=require(_0xd1fe('0xd'));var config=require('../../config/environment');var db=require(_0xd1fe('0xe'))['db'];var socket=require(_0xd1fe('0xf'))({'host':_0xd1fe('0x10'),'port':0x18eb});require(_0xd1fe('0x11'))[_0xd1fe('0x12')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd1fe('0x13')][_0xd1fe('0x14')]({'port':0x232c});var client9002=jayson[_0xd1fe('0x13')][_0xd1fe('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x2225bb,_0x50a4de,_0x380a81,_0x445e19){return new BPromise(function(_0x542b17,_0x1d3fdb){var _0x597075=_0x445e19||client;return _0x597075[_0xd1fe('0x15')](_0x2225bb,_0x380a81)[_0xd1fe('0x16')](function(_0x37c88e){logger[_0xd1fe('0x17')](_0xd1fe('0x18'),_0x50a4de,'request\x20sent');logger[_0xd1fe('0x19')](_0xd1fe('0x1a'),_0x50a4de,'request\x20sent',JSON['stringify'](_0x37c88e));if(_0x37c88e[_0xd1fe('0x1b')]){if(_0x37c88e['error'][_0xd1fe('0x1c')]===0x1f4){logger[_0xd1fe('0x1b')](_0xd1fe('0x18'),_0x50a4de,_0x37c88e[_0xd1fe('0x1b')][_0xd1fe('0x1d')]);return _0x1d3fdb(_0x37c88e[_0xd1fe('0x1b')][_0xd1fe('0x1d')]);}logger[_0xd1fe('0x1b')]('SmsMessage,\x20%s,\x20%s',_0x50a4de,_0x37c88e['error']['message']);return _0x542b17(_0x37c88e[_0xd1fe('0x1b')][_0xd1fe('0x1d')]);}else{logger[_0xd1fe('0x17')](_0xd1fe('0x18'),_0x50a4de,_0xd1fe('0x1e'));_0x542b17(_0x37c88e[_0xd1fe('0x1f')][_0xd1fe('0x1d')]);}})[_0xd1fe('0x20')](function(_0x18d109){logger[_0xd1fe('0x1b')]('SmsMessage,\x20%s,\x20%s',_0x50a4de,_0x18d109);_0x1d3fdb(_0x18d109);});});}function respondWithStatusCode(_0xc1d101,_0x5c1033){_0x5c1033=_0x5c1033||0xcc;return function(_0x5cd548){if(_0x5cd548){return _0xc1d101[_0xd1fe('0x21')](_0x5c1033);}return _0xc1d101[_0xd1fe('0x22')](_0x5c1033)[_0xd1fe('0x23')]();};}function respondWithResult(_0x297ba6,_0x412a0b){_0x412a0b=_0x412a0b||0xc8;return function(_0x50ddd5){if(_0x50ddd5){return _0x297ba6['status'](_0x412a0b)[_0xd1fe('0x24')](_0x50ddd5);}};}function respondWithFilteredResult(_0xe77dfa,_0x4a2c8f){return function(_0x2d7ab5){if(_0x2d7ab5){var _0x364413=_0x2d7ab5[_0xd1fe('0x25')],_0x3a0610=_0x4a2c8f['offset'],_0x5c5782=_0x4a2c8f['offset']+_0x4a2c8f['limit'],_0x124d78;if(_0x5c5782>=_0x364413){_0x5c5782=_0x364413;_0x124d78=0xc8;}else{_0x124d78=0xce;}_0xe77dfa['status'](_0x124d78);return _0xe77dfa[_0xd1fe('0x26')](_0xd1fe('0x27'),_0x3a0610+'-'+_0x5c5782+'/'+_0x364413)[_0xd1fe('0x24')](_0x2d7ab5);}return null;};}function patchUpdates(_0x56510c){return function(_0x4f366d){try{jsonpatch['apply'](_0x4f366d,_0x56510c,!![]);}catch(_0x890b58){return BPromise['reject'](_0x890b58);}return _0x4f366d[_0xd1fe('0x28')]();};}function saveUpdates(_0x526caa,_0x30460c){return function(_0x449c7f){if(_0x449c7f){return _0x449c7f[_0xd1fe('0x29')](_0x526caa)[_0xd1fe('0x16')](function(_0x30fb5f){return _0x30fb5f;});}return null;};}function removeEntity(_0x1db865,_0x15a9ea){return function(_0x30972a){if(_0x30972a){return _0x30972a['destroy']()[_0xd1fe('0x16')](function(){_0x1db865[_0xd1fe('0x22')](0xcc)[_0xd1fe('0x23')]();});}};}function handleEntityNotFound(_0x39f588,_0x450bc9){return function(_0x546e09){if(!_0x546e09){_0x39f588['sendStatus'](0x194);}return _0x546e09;};}function handleError(_0xe7715d,_0x3c2ae2){_0x3c2ae2=_0x3c2ae2||0x1f4;return function(_0x338f34){logger['error'](_0x338f34[_0xd1fe('0x2a')]);if(_0x338f34['name']){delete _0x338f34['name'];}_0xe7715d[_0xd1fe('0x22')](_0x3c2ae2)[_0xd1fe('0x2b')](_0x338f34);};}exports['index']=function(_0x557e7b,_0x3770e8){var _0x517ab5={},_0x52f953={},_0x4e8adb={'count':0x0,'rows':[]};var _0x2236a8=db[_0xd1fe('0x2c')][_0xd1fe('0x2d')];_0x52f953['model']=_[_0xd1fe('0x2e')](_0x2236a8);var _0x1bea67={'dateStart':_0x557e7b[_0xd1fe('0x2f')][_0xd1fe('0x30')],'dateEnd':_0x557e7b[_0xd1fe('0x2f')][_0xd1fe('0x31')]};delete _0x557e7b['query'][_0xd1fe('0x30')];delete _0x557e7b[_0xd1fe('0x2f')]['dateEnd'];_0x52f953['query']=_[_0xd1fe('0x2e')](_0x557e7b[_0xd1fe('0x2f')]);_0x52f953[_0xd1fe('0x32')]=_[_0xd1fe('0x33')](_0x52f953[_0xd1fe('0x34')],_0x52f953[_0xd1fe('0x2f')]);_0x517ab5[_0xd1fe('0x35')]=_[_0xd1fe('0x33')](_0x52f953[_0xd1fe('0x34')],qs[_0xd1fe('0x36')](_0x557e7b[_0xd1fe('0x2f')][_0xd1fe('0x36')]));_0x517ab5['attributes']=_0x517ab5[_0xd1fe('0x35')][_0xd1fe('0x37')]?_0x517ab5[_0xd1fe('0x35')]:_0x52f953['model'];if(!_0x557e7b[_0xd1fe('0x2f')][_0xd1fe('0x38')]('nolimit')){_0x517ab5[_0xd1fe('0x39')]=qs[_0xd1fe('0x39')](_0x557e7b[_0xd1fe('0x2f')][_0xd1fe('0x39')]);_0x517ab5[_0xd1fe('0x3a')]=qs[_0xd1fe('0x3a')](_0x557e7b[_0xd1fe('0x2f')][_0xd1fe('0x3a')]);}_0x517ab5['order']=qs[_0xd1fe('0x3b')](_0x557e7b['query'][_0xd1fe('0x3b')]);_0x517ab5[_0xd1fe('0x3c')]=qs[_0xd1fe('0x32')](_[_0xd1fe('0x3d')](_0x557e7b[_0xd1fe('0x2f')],_0x52f953[_0xd1fe('0x32')]));if(_0x1bea67['dateStart']){if(_0x1bea67[_0xd1fe('0x31')]){_0x1bea67[_0xd1fe('0x31')]=moment(_0x1bea67[_0xd1fe('0x31')])[_0xd1fe('0x3e')](0x1,_0xd1fe('0x3f'));}else{_0x1bea67[_0xd1fe('0x31')]=moment(_0x1bea67[_0xd1fe('0x30')])[_0xd1fe('0x3e')](0x1,_0xd1fe('0x3f'));}_[_0xd1fe('0x40')](_0x517ab5[_0xd1fe('0x3c')],{'createdAt':{'$gte':_0x1bea67[_0xd1fe('0x30')],'$lte':_0x1bea67['dateEnd']}});}if(_0x557e7b[_0xd1fe('0x2f')][_0xd1fe('0x41')]){_0x517ab5['where']=_[_0xd1fe('0x40')](_0x517ab5['where'],{'$or':_[_0xd1fe('0x42')](_0x517ab5[_0xd1fe('0x35')],function(_0x526932){var _0x4bdc91={};_0x4bdc91[_0x526932]={'$like':'%'+_0x557e7b['query'][_0xd1fe('0x41')]+'%'};return _0x4bdc91;})});}_0x517ab5=_[_0xd1fe('0x40')]({},_0x517ab5,_0x557e7b[_0xd1fe('0x43')]);var _0x4960cb={'where':_0x517ab5['where']};return db['SmsMessage'][_0xd1fe('0x25')](_0x4960cb)['then'](function(_0x357cc0){_0x4e8adb[_0xd1fe('0x25')]=_0x357cc0;if(_0x557e7b[_0xd1fe('0x2f')][_0xd1fe('0x44')]){_0x517ab5[_0xd1fe('0x45')]=[{'all':!![]}];}return db[_0xd1fe('0x2c')][_0xd1fe('0x46')](_0x517ab5);})[_0xd1fe('0x16')](function(_0x546866){_0x4e8adb[_0xd1fe('0x47')]=_0x546866;return _0x4e8adb;})[_0xd1fe('0x16')](respondWithFilteredResult(_0x3770e8,_0x517ab5))[_0xd1fe('0x20')](handleError(_0x3770e8,null));};exports['show']=function(_0x161972,_0x6716ba){var _0x31f55d={'raw':!![],'where':{'id':_0x161972[_0xd1fe('0x48')]['id']}},_0x44892b={};_0x44892b['model']=_[_0xd1fe('0x2e')](db[_0xd1fe('0x2c')][_0xd1fe('0x2d')]);_0x44892b[_0xd1fe('0x2f')]=_[_0xd1fe('0x2e')](_0x161972['query']);_0x44892b[_0xd1fe('0x32')]=_['intersection'](_0x44892b['model'],_0x44892b[_0xd1fe('0x2f')]);_0x31f55d[_0xd1fe('0x35')]=_[_0xd1fe('0x33')](_0x44892b['model'],qs[_0xd1fe('0x36')](_0x161972[_0xd1fe('0x2f')][_0xd1fe('0x36')]));_0x31f55d[_0xd1fe('0x35')]=_0x31f55d[_0xd1fe('0x35')][_0xd1fe('0x37')]?_0x31f55d[_0xd1fe('0x35')]:_0x44892b[_0xd1fe('0x34')];if(_0x161972[_0xd1fe('0x2f')][_0xd1fe('0x44')]){_0x31f55d[_0xd1fe('0x45')]=[{'all':!![]}];}_0x31f55d=_[_0xd1fe('0x40')]({},_0x31f55d,_0x161972[_0xd1fe('0x43')]);return db[_0xd1fe('0x2c')][_0xd1fe('0x49')](_0x31f55d)[_0xd1fe('0x16')](handleEntityNotFound(_0x6716ba,null))[_0xd1fe('0x16')](respondWithResult(_0x6716ba,null))[_0xd1fe('0x20')](handleError(_0x6716ba,null));};exports[_0xd1fe('0x4a')]=function(_0x395dd4,_0x38b65b){return db[_0xd1fe('0x2c')][_0xd1fe('0x4a')](_0x395dd4[_0xd1fe('0x4b')],{})['then'](respondWithResult(_0x38b65b,0xc9))[_0xd1fe('0x20')](handleError(_0x38b65b,null));};exports['update']=function(_0x22dd8c,_0xaeeeab){if(_0x22dd8c[_0xd1fe('0x4b')]['id']){delete _0x22dd8c['body']['id'];}return db[_0xd1fe('0x2c')][_0xd1fe('0x49')]({'where':{'id':_0x22dd8c[_0xd1fe('0x48')]['id']}})[_0xd1fe('0x16')](handleEntityNotFound(_0xaeeeab,null))[_0xd1fe('0x16')](saveUpdates(_0x22dd8c['body'],null))[_0xd1fe('0x16')](respondWithResult(_0xaeeeab,null))['catch'](handleError(_0xaeeeab,null));};exports[_0xd1fe('0x4c')]=function(_0x4dba71,_0x2c4fec){return db['SmsMessage']['find']({'where':{'id':_0x4dba71[_0xd1fe('0x48')]['id']}})['then'](handleEntityNotFound(_0x2c4fec,null))[_0xd1fe('0x16')](removeEntity(_0x2c4fec,null))[_0xd1fe('0x20')](handleError(_0x2c4fec,null));};exports['describe']=function(_0x1f2bf2,_0xb9f54a){return db['SmsMessage'][_0xd1fe('0x4d')]()[_0xd1fe('0x16')](respondWithResult(_0xb9f54a,null))['catch'](handleError(_0xb9f54a,null));};var interaction_log=require('../../config/logger')(_0xd1fe('0x4e'));exports[_0xd1fe('0x4f')]=function(_0x2683e5,_0x580c43,_0x3a9120){var _0x21b144={'channel':'sms'};if(_0x2683e5[_0xd1fe('0x4b')]['id']){delete _0x2683e5[_0xd1fe('0x4b')]['id'];}_0x2683e5[_0xd1fe('0x4b')]['read']=!![];_0x2683e5['body'][_0xd1fe('0x50')]=moment()[_0xd1fe('0x51')](_0xd1fe('0x52'));_0x2683e5[_0xd1fe('0x4b')][_0xd1fe('0x53')]=_0x2683e5[_0xd1fe('0x4b')]['UserId']||_0x2683e5[_0xd1fe('0x54')]['id'];return db['SmsMessage'][_0xd1fe('0x49')]({'where':{'id':_0x2683e5[_0xd1fe('0x48')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xd1fe('0x55')}]})[_0xd1fe('0x16')](handleEntityNotFound(_0x580c43,null))[_0xd1fe('0x16')](saveUpdates(_0x2683e5[_0xd1fe('0x4b')],null))[_0xd1fe('0x16')](function(_0x341dd5){if(_0x341dd5){_0x21b144[_0xd1fe('0x1d')]=_0x341dd5[_0xd1fe('0x56')]({'plain':!![]});return db[_0xd1fe('0x57')][_0xd1fe('0x49')]({'where':{'id':_0x341dd5[_0xd1fe('0x58')]}});}return null;})[_0xd1fe('0x16')](handleEntityNotFound(_0x580c43,null))[_0xd1fe('0x16')](function(_0x57dce1){if(_0x57dce1){return _0x57dce1['update']({'UserId':_0x2683e5[_0xd1fe('0x4b')][_0xd1fe('0x53')],'read1stAt':_[_0xd1fe('0x59')](_0x57dce1[_0xd1fe('0x5a')])?moment()[_0xd1fe('0x51')](_0xd1fe('0x52')):undefined});}return null;})['then'](function(_0x4e0489){if(_0x4e0489){_0x21b144[_0xd1fe('0x5b')]=_0x4e0489[_0xd1fe('0x56')]({'plain':!![]});interaction_log['info'](_0xd1fe('0x5c'),_0x2683e5[_0xd1fe('0x54')]['id'],_0x2683e5[_0xd1fe('0x54')][_0xd1fe('0x5d')],_0x2683e5[_0xd1fe('0x54')][_0xd1fe('0x5e')],_0x21b144['interaction']['id'],_0x2683e5[_0xd1fe('0x4b')]?JSON[_0xd1fe('0x5f')](_0x2683e5[_0xd1fe('0x4b')]):_0xd1fe('0x60'));return respondWithRpcPromise(_0xd1fe('0x61'),_0xd1fe('0x62'),_0x21b144);}return null;})['then'](function(_0x1b298f){if(_0x1b298f){if(_0x2683e5[_0xd1fe('0x4b')][_0xd1fe('0x63')]){_0x21b144[_0xd1fe('0x1d')][_0xd1fe('0x64')]=util['format'](_0xd1fe('0x65'),_0x2683e5[_0xd1fe('0x54')][_0xd1fe('0x5d')]);_0x21b144['message'][_0xd1fe('0x66')]=_0x21b144['channel'];_0x21b144['message'][_0xd1fe('0x67')]='accept';return respondWithRpcPromise(_0xd1fe('0x68'),_0xd1fe('0x68'),{'event':_0xd1fe('0x69'),'message':_0x21b144[_0xd1fe('0x1d')]},client9002)[_0xd1fe('0x16')](function(){return _0x21b144;});}return _0x21b144;}return null;})[_0xd1fe('0x16')](respondWithResult(_0x580c43,null))['catch'](handleError(_0x580c43,null));};var interaction_log=require(_0xd1fe('0xb'))(_0xd1fe('0x4e'));exports[_0xd1fe('0x6a')]=function(_0x26992b,_0x3e34ba,_0x191b5d){var _0x5816dd={'agent':{},'channel':_0xd1fe('0x6b')};if(_0x26992b[_0xd1fe('0x4b')]['id']){delete _0x26992b[_0xd1fe('0x4b')]['id'];}_0x26992b['body'][_0xd1fe('0x53')]=_0x26992b[_0xd1fe('0x4b')][_0xd1fe('0x53')]||_0x26992b[_0xd1fe('0x54')]['id'];_0x5816dd[_0xd1fe('0x6c')]['id']=_0x26992b[_0xd1fe('0x4b')]['UserId'];return db[_0xd1fe('0x2c')]['find']({'where':{'id':_0x26992b[_0xd1fe('0x48')]['id'],'UserId':null}})[_0xd1fe('0x16')](handleEntityNotFound(_0x3e34ba,null))[_0xd1fe('0x16')](function(_0x5dab5a){if(_0x5dab5a){_0x5816dd[_0xd1fe('0x1d')]=_0x5dab5a['get']({'plain':!![]});return db['SmsInteraction'][_0xd1fe('0x49')]({'where':{'id':_0x5dab5a[_0xd1fe('0x58')]}});}return null;})[_0xd1fe('0x16')](handleEntityNotFound(_0x3e34ba,null))[_0xd1fe('0x16')](function(_0x2d8a42){if(_0x2d8a42){_0x5816dd[_0xd1fe('0x5b')]=_0x2d8a42[_0xd1fe('0x56')]({'plain':!![]});interaction_log[_0xd1fe('0x17')](_0xd1fe('0x6d'),_0x26992b[_0xd1fe('0x54')]['id'],_0x26992b[_0xd1fe('0x54')]['name'],_0x26992b[_0xd1fe('0x54')][_0xd1fe('0x5e')],_0x5816dd[_0xd1fe('0x5b')]['id'],_0x26992b[_0xd1fe('0x4b')]?JSON['stringify'](_0x26992b['body']):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x5816dd);}return null;})[_0xd1fe('0x16')](function(_0x22f85a){if(_0x22f85a){_0x22f85a[_0xd1fe('0x1d')]['interface']=util['format'](_0xd1fe('0x65'),_0x26992b[_0xd1fe('0x54')][_0xd1fe('0x5d')]);_0x22f85a[_0xd1fe('0x1d')]['channel']=_0x5816dd[_0xd1fe('0x66')];_0x22f85a[_0xd1fe('0x1d')][_0xd1fe('0x67')]=_0xd1fe('0x6a');respondWithRpcPromise(_0xd1fe('0x68'),_0xd1fe('0x68'),{'event':_0xd1fe('0x6e'),'message':_0x22f85a['message']},client9002);return _0x5816dd;}return null;})[_0xd1fe('0x16')](respondWithResult(_0x3e34ba,null))[_0xd1fe('0x20')](handleError(_0x3e34ba,null));};exports['status']=function(_0x23c751,_0xf2f103,_0xd56f60){if(_0x23c751['body']['id']){delete _0x23c751[_0xd1fe('0x4b')]['id'];}var _0xcc9578;return db[_0xd1fe('0x2c')][_0xd1fe('0x49')]({'where':{'id':_0x23c751[_0xd1fe('0x48')]['id']}})['then'](handleEntityNotFound(_0xf2f103,null))[_0xd1fe('0x16')](function(_0x41f9ec){if(_0x41f9ec){_0xcc9578=_0x41f9ec;return db[_0xd1fe('0x6f')][_0xd1fe('0x49')]({'where':{'id':_0x41f9ec['SmsAccountId']}});}})[_0xd1fe('0x16')](handleEntityNotFound(_0xf2f103,null))['then'](function(_0x1a35bb){if(_0x1a35bb){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0xd1fe('0x70'),_0x1a35bb[_0xd1fe('0x71')],util[_0xd1fe('0x72')](_0x23c751['body'],{'showHidden':![],'depth':null}));switch(_0x1a35bb[_0xd1fe('0x71')]){case _0xd1fe('0x73'):if(_0x23c751['body']['MessageSid']&&_0x23c751[_0xd1fe('0x4b')]['MessageSid']===_0xcc9578[_0xd1fe('0x74')]){return _0xcc9578[_0xd1fe('0x29')]({'read':!![]});}break;case _0xd1fe('0x75'):if(_0x23c751['body'][_0xd1fe('0x76')]&&_0x23c751[_0xd1fe('0x4b')][_0xd1fe('0x76')]===_0xcc9578['messageId']&&_[_0xd1fe('0x77')]([_0xd1fe('0x78'),'delivered'],_0x23c751[_0xd1fe('0x4b')]['Status'])>=0x0){return _0xcc9578['update']({'read':!![]});}break;}return _0xcc9578;}})[_0xd1fe('0x16')](respondWithResult(_0xf2f103,null))[_0xd1fe('0x20')](handleError(_0xf2f103,null));}; \ No newline at end of file +var _0x326b=['name','send','index','SmsMessage','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','day','filter','merge','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','describe','sms-interactions','sms','read','readAt','UserId','user','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','manual','interface','channel','event','accept','acceptmessage','reject','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','SIP/%s','EventManager','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','sent','delivered','Status','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./smsMessage.socket','register','jayson/promise','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','count','offset','limit','set','Content-Range','update','destroy','stack'];(function(_0x4326ae,_0x32b109){var _0x44ec32=function(_0x350999){while(--_0x350999){_0x4326ae['push'](_0x4326ae['shift']());}};_0x44ec32(++_0x32b109);}(_0x326b,0x1dc));var _0xb326=function(_0x39479f,_0x822ae4){_0x39479f=_0x39479f-0x0;var _0x4a6d96=_0x326b[_0x39479f];return _0x4a6d96;};'use strict';var jsonpatch=require(_0xb326('0x0'));var rp=require(_0xb326('0x1'));var moment=require(_0xb326('0x2'));var BPromise=require(_0xb326('0x3'));var Mustache=require(_0xb326('0x4'));var util=require(_0xb326('0x5'));var path=require('path');var sox=require(_0xb326('0x6'));var csv=require('to-csv');var ejs=require(_0xb326('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb326('0x8'));var crypto=require('crypto');var jsforce=require(_0xb326('0x9'));var deskjs=require(_0xb326('0xa'));var toCsv=require(_0xb326('0xb'));var querystring=require(_0xb326('0xc'));var Papa=require(_0xb326('0xd'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xb326('0xe'));var utils=require(_0xb326('0xf'));var config=require(_0xb326('0x10'));var db=require(_0xb326('0x11'))['db'];var socket=require(_0xb326('0x12'))({'host':_0xb326('0x13'),'port':0x18eb});require(_0xb326('0x14'))[_0xb326('0x15')](socket);var jayson=require(_0xb326('0x16'));var client=jayson['client'][_0xb326('0x17')]({'port':0x232c});var client9002=jayson[_0xb326('0x18')][_0xb326('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xc98b7,_0x595910,_0x264c28,_0x75711e){return new BPromise(function(_0x4557cb,_0x8ad882){var _0x366d6f=_0x75711e||client;return _0x366d6f[_0xb326('0x19')](_0xc98b7,_0x264c28)[_0xb326('0x1a')](function(_0x20f307){logger[_0xb326('0x1b')](_0xb326('0x1c'),_0x595910,_0xb326('0x1d'));logger[_0xb326('0x1e')](_0xb326('0x1f'),_0x595910,'request\x20sent',JSON[_0xb326('0x20')](_0x20f307));if(_0x20f307[_0xb326('0x21')]){if(_0x20f307['error'][_0xb326('0x22')]===0x1f4){logger[_0xb326('0x21')](_0xb326('0x1c'),_0x595910,_0x20f307[_0xb326('0x21')][_0xb326('0x23')]);return _0x8ad882(_0x20f307[_0xb326('0x21')][_0xb326('0x23')]);}logger['error'](_0xb326('0x1c'),_0x595910,_0x20f307[_0xb326('0x21')]['message']);return _0x4557cb(_0x20f307['error'][_0xb326('0x23')]);}else{logger[_0xb326('0x1b')](_0xb326('0x1c'),_0x595910,'request\x20sent');_0x4557cb(_0x20f307[_0xb326('0x24')]['message']);}})['catch'](function(_0xc359aa){logger['error'](_0xb326('0x1c'),_0x595910,_0xc359aa);_0x8ad882(_0xc359aa);});});}function respondWithStatusCode(_0x1f33ab,_0x3a1e73){_0x3a1e73=_0x3a1e73||0xcc;return function(_0xea91a7){if(_0xea91a7){return _0x1f33ab['sendStatus'](_0x3a1e73);}return _0x1f33ab[_0xb326('0x25')](_0x3a1e73)[_0xb326('0x26')]();};}function respondWithResult(_0x322d9a,_0x9023e3){_0x9023e3=_0x9023e3||0xc8;return function(_0x230cd0){if(_0x230cd0){return _0x322d9a['status'](_0x9023e3)[_0xb326('0x27')](_0x230cd0);}};}function respondWithFilteredResult(_0x547ceb,_0x3ccc75){return function(_0x5bba99){if(_0x5bba99){var _0x2309e9=_0x5bba99[_0xb326('0x28')],_0xfce6f5=_0x3ccc75['offset'],_0x1cafff=_0x3ccc75[_0xb326('0x29')]+_0x3ccc75[_0xb326('0x2a')],_0x2218f7;if(_0x1cafff>=_0x2309e9){_0x1cafff=_0x2309e9;_0x2218f7=0xc8;}else{_0x2218f7=0xce;}_0x547ceb[_0xb326('0x25')](_0x2218f7);return _0x547ceb[_0xb326('0x2b')](_0xb326('0x2c'),_0xfce6f5+'-'+_0x1cafff+'/'+_0x2309e9)[_0xb326('0x27')](_0x5bba99);}return null;};}function patchUpdates(_0x5ccdba){return function(_0x4e4b68){try{jsonpatch['apply'](_0x4e4b68,_0x5ccdba,!![]);}catch(_0x5069a0){return BPromise['reject'](_0x5069a0);}return _0x4e4b68['save']();};}function saveUpdates(_0x1150a0,_0x57ef1b){return function(_0xbf2869){if(_0xbf2869){return _0xbf2869[_0xb326('0x2d')](_0x1150a0)['then'](function(_0x32750f){return _0x32750f;});}return null;};}function removeEntity(_0x184882,_0x53c70d){return function(_0x1d5463){if(_0x1d5463){return _0x1d5463[_0xb326('0x2e')]()[_0xb326('0x1a')](function(){_0x184882[_0xb326('0x25')](0xcc)[_0xb326('0x26')]();});}};}function handleEntityNotFound(_0x1e6ca8,_0x2e91b8){return function(_0x579722){if(!_0x579722){_0x1e6ca8['sendStatus'](0x194);}return _0x579722;};}function handleError(_0x240cb6,_0x5b4e51){_0x5b4e51=_0x5b4e51||0x1f4;return function(_0x1d50d4){logger[_0xb326('0x21')](_0x1d50d4[_0xb326('0x2f')]);if(_0x1d50d4[_0xb326('0x30')]){delete _0x1d50d4[_0xb326('0x30')];}_0x240cb6[_0xb326('0x25')](_0x5b4e51)[_0xb326('0x31')](_0x1d50d4);};}exports[_0xb326('0x32')]=function(_0x3e6fb9,_0x4a1746){var _0x1a693c={},_0x341c13={},_0x33cb0d={'count':0x0,'rows':[]};var _0x44bbfd=db[_0xb326('0x33')][_0xb326('0x34')];_0x341c13[_0xb326('0x35')]=_[_0xb326('0x36')](_0x44bbfd);var _0x4df372={'dateStart':_0x3e6fb9[_0xb326('0x37')][_0xb326('0x38')],'dateEnd':_0x3e6fb9[_0xb326('0x37')][_0xb326('0x39')]};delete _0x3e6fb9[_0xb326('0x37')][_0xb326('0x38')];delete _0x3e6fb9['query'][_0xb326('0x39')];_0x341c13[_0xb326('0x37')]=_[_0xb326('0x36')](_0x3e6fb9['query']);_0x341c13[_0xb326('0x3a')]=_[_0xb326('0x3b')](_0x341c13[_0xb326('0x35')],_0x341c13[_0xb326('0x37')]);_0x1a693c['attributes']=_[_0xb326('0x3b')](_0x341c13['model'],qs[_0xb326('0x3c')](_0x3e6fb9['query'][_0xb326('0x3c')]));_0x1a693c[_0xb326('0x3d')]=_0x1a693c[_0xb326('0x3d')]['length']?_0x1a693c[_0xb326('0x3d')]:_0x341c13['model'];if(!_0x3e6fb9[_0xb326('0x37')][_0xb326('0x3e')](_0xb326('0x3f'))){_0x1a693c[_0xb326('0x2a')]=qs[_0xb326('0x2a')](_0x3e6fb9['query'][_0xb326('0x2a')]);_0x1a693c['offset']=qs[_0xb326('0x29')](_0x3e6fb9[_0xb326('0x37')][_0xb326('0x29')]);}_0x1a693c[_0xb326('0x40')]=qs['sort'](_0x3e6fb9[_0xb326('0x37')]['sort']);_0x1a693c[_0xb326('0x41')]=qs[_0xb326('0x3a')](_[_0xb326('0x42')](_0x3e6fb9['query'],_0x341c13[_0xb326('0x3a')]));if(_0x4df372[_0xb326('0x38')]){if(_0x4df372['dateEnd']){_0x4df372['dateEnd']=moment(_0x4df372[_0xb326('0x39')])['add'](0x1,_0xb326('0x43'));}else{_0x4df372[_0xb326('0x39')]=moment(_0x4df372['dateStart'])['add'](0x1,'day');}_['merge'](_0x1a693c[_0xb326('0x41')],{'createdAt':{'$gte':_0x4df372[_0xb326('0x38')],'$lte':_0x4df372[_0xb326('0x39')]}});}if(_0x3e6fb9['query'][_0xb326('0x44')]){_0x1a693c[_0xb326('0x41')]=_[_0xb326('0x45')](_0x1a693c[_0xb326('0x41')],{'$or':_['map'](_0x1a693c[_0xb326('0x3d')],function(_0x37632e){var _0x50877b={};_0x50877b[_0x37632e]={'$like':'%'+_0x3e6fb9[_0xb326('0x37')][_0xb326('0x44')]+'%'};return _0x50877b;})});}_0x1a693c=_[_0xb326('0x45')]({},_0x1a693c,_0x3e6fb9[_0xb326('0x46')]);var _0x131358={'where':_0x1a693c[_0xb326('0x41')]};return db[_0xb326('0x33')][_0xb326('0x28')](_0x131358)['then'](function(_0x14e7a0){_0x33cb0d[_0xb326('0x28')]=_0x14e7a0;if(_0x3e6fb9[_0xb326('0x37')][_0xb326('0x47')]){_0x1a693c['include']=[{'all':!![]}];}return db[_0xb326('0x33')][_0xb326('0x48')](_0x1a693c);})[_0xb326('0x1a')](function(_0x4060e7){_0x33cb0d[_0xb326('0x49')]=_0x4060e7;return _0x33cb0d;})['then'](respondWithFilteredResult(_0x4a1746,_0x1a693c))[_0xb326('0x4a')](handleError(_0x4a1746,null));};exports[_0xb326('0x4b')]=function(_0x1cf1fa,_0x5a4af1){var _0x292baf={'raw':!![],'where':{'id':_0x1cf1fa[_0xb326('0x4c')]['id']}},_0x2949ec={};_0x2949ec['model']=_[_0xb326('0x36')](db[_0xb326('0x33')]['rawAttributes']);_0x2949ec[_0xb326('0x37')]=_[_0xb326('0x36')](_0x1cf1fa['query']);_0x2949ec[_0xb326('0x3a')]=_[_0xb326('0x3b')](_0x2949ec['model'],_0x2949ec['query']);_0x292baf[_0xb326('0x3d')]=_[_0xb326('0x3b')](_0x2949ec[_0xb326('0x35')],qs['fields'](_0x1cf1fa['query'][_0xb326('0x3c')]));_0x292baf['attributes']=_0x292baf['attributes'][_0xb326('0x4d')]?_0x292baf[_0xb326('0x3d')]:_0x2949ec[_0xb326('0x35')];if(_0x1cf1fa[_0xb326('0x37')][_0xb326('0x47')]){_0x292baf[_0xb326('0x4e')]=[{'all':!![]}];}_0x292baf=_['merge']({},_0x292baf,_0x1cf1fa['options']);return db[_0xb326('0x33')][_0xb326('0x4f')](_0x292baf)[_0xb326('0x1a')](handleEntityNotFound(_0x5a4af1,null))[_0xb326('0x1a')](respondWithResult(_0x5a4af1,null))[_0xb326('0x4a')](handleError(_0x5a4af1,null));};exports[_0xb326('0x50')]=function(_0xb9b6c7,_0x7e26e){return db[_0xb326('0x33')]['create'](_0xb9b6c7['body'],{})[_0xb326('0x1a')](respondWithResult(_0x7e26e,0xc9))['catch'](handleError(_0x7e26e,null));};exports[_0xb326('0x2d')]=function(_0x44a5a5,_0x415917){if(_0x44a5a5[_0xb326('0x51')]['id']){delete _0x44a5a5[_0xb326('0x51')]['id'];}return db['SmsMessage'][_0xb326('0x4f')]({'where':{'id':_0x44a5a5[_0xb326('0x4c')]['id']}})[_0xb326('0x1a')](handleEntityNotFound(_0x415917,null))[_0xb326('0x1a')](saveUpdates(_0x44a5a5[_0xb326('0x51')],null))['then'](respondWithResult(_0x415917,null))[_0xb326('0x4a')](handleError(_0x415917,null));};exports[_0xb326('0x2e')]=function(_0x47920e,_0x52ca7f){return db['SmsMessage'][_0xb326('0x4f')]({'where':{'id':_0x47920e[_0xb326('0x4c')]['id']}})[_0xb326('0x1a')](handleEntityNotFound(_0x52ca7f,null))[_0xb326('0x1a')](removeEntity(_0x52ca7f,null))['catch'](handleError(_0x52ca7f,null));};exports[_0xb326('0x52')]=function(_0x139611,_0x1dad34){return db[_0xb326('0x33')][_0xb326('0x52')]()[_0xb326('0x1a')](respondWithResult(_0x1dad34,null))[_0xb326('0x4a')](handleError(_0x1dad34,null));};var interaction_log=require('../../config/logger')(_0xb326('0x53'));exports['accept']=function(_0x4f6aa4,_0x2d638f,_0x11f1c6){var _0x32a8e9={'channel':_0xb326('0x54')};if(_0x4f6aa4[_0xb326('0x51')]['id']){delete _0x4f6aa4[_0xb326('0x51')]['id'];}_0x4f6aa4[_0xb326('0x51')][_0xb326('0x55')]=!![];_0x4f6aa4['body'][_0xb326('0x56')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4f6aa4['body'][_0xb326('0x57')]=_0x4f6aa4[_0xb326('0x51')][_0xb326('0x57')]||_0x4f6aa4[_0xb326('0x58')]['id'];return db[_0xb326('0x33')]['find']({'where':{'id':_0x4f6aa4[_0xb326('0x4c')]['id'],'UserId':null},'include':[{'model':db[_0xb326('0x59')],'as':_0xb326('0x5a')}]})[_0xb326('0x1a')](handleEntityNotFound(_0x2d638f,null))[_0xb326('0x1a')](saveUpdates(_0x4f6aa4[_0xb326('0x51')],null))[_0xb326('0x1a')](function(_0x4e2947){if(_0x4e2947){_0x32a8e9['message']=_0x4e2947[_0xb326('0x5b')]({'plain':!![]});return db[_0xb326('0x5c')][_0xb326('0x4f')]({'where':{'id':_0x4e2947[_0xb326('0x5d')]}});}return null;})[_0xb326('0x1a')](handleEntityNotFound(_0x2d638f,null))[_0xb326('0x1a')](function(_0x58a4bf){if(_0x58a4bf){return _0x58a4bf[_0xb326('0x2d')]({'UserId':_0x4f6aa4[_0xb326('0x51')][_0xb326('0x57')],'read1stAt':_[_0xb326('0x5e')](_0x58a4bf[_0xb326('0x5f')])?moment()[_0xb326('0x60')](_0xb326('0x61')):undefined});}return null;})['then'](function(_0x45d8ab){if(_0x45d8ab){_0x32a8e9[_0xb326('0x62')]=_0x45d8ab[_0xb326('0x5b')]({'plain':!![]});interaction_log['info'](_0xb326('0x63'),_0x4f6aa4['user']['id'],_0x4f6aa4['user'][_0xb326('0x30')],_0x4f6aa4[_0xb326('0x58')]['role'],_0x32a8e9['interaction']['id'],_0x4f6aa4[_0xb326('0x51')]?JSON[_0xb326('0x20')](_0x4f6aa4[_0xb326('0x51')]):'null');return respondWithRpcPromise(_0xb326('0x64'),'acceptMessage',_0x32a8e9);}return null;})[_0xb326('0x1a')](function(_0x4f45c5){if(_0x4f45c5){if(_0x4f6aa4['body'][_0xb326('0x65')]){_0x32a8e9['message'][_0xb326('0x66')]=util[_0xb326('0x60')]('SIP/%s',_0x4f6aa4['user'][_0xb326('0x30')]);_0x32a8e9[_0xb326('0x23')][_0xb326('0x67')]=_0x32a8e9[_0xb326('0x67')];_0x32a8e9[_0xb326('0x23')][_0xb326('0x68')]=_0xb326('0x69');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xb326('0x6a'),'message':_0x32a8e9[_0xb326('0x23')]},client9002)[_0xb326('0x1a')](function(){return _0x32a8e9;});}return _0x32a8e9;}return null;})[_0xb326('0x1a')](respondWithResult(_0x2d638f,null))['catch'](handleError(_0x2d638f,null));};var interaction_log=require('../../config/logger')(_0xb326('0x53'));exports[_0xb326('0x6b')]=function(_0x2e32ec,_0x39c44f,_0x5b7e13){var _0x5610b6={'agent':{},'channel':_0xb326('0x54')};if(_0x2e32ec[_0xb326('0x51')]['id']){delete _0x2e32ec['body']['id'];}_0x2e32ec['body'][_0xb326('0x57')]=_0x2e32ec[_0xb326('0x51')]['UserId']||_0x2e32ec[_0xb326('0x58')]['id'];_0x5610b6[_0xb326('0x6c')]['id']=_0x2e32ec[_0xb326('0x51')][_0xb326('0x57')];return db[_0xb326('0x33')]['find']({'where':{'id':_0x2e32ec[_0xb326('0x4c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x39c44f,null))[_0xb326('0x1a')](function(_0x3df571){if(_0x3df571){_0x5610b6[_0xb326('0x23')]=_0x3df571['get']({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x3df571[_0xb326('0x5d')]}});}return null;})[_0xb326('0x1a')](handleEntityNotFound(_0x39c44f,null))[_0xb326('0x1a')](function(_0x1cb7c5){if(_0x1cb7c5){_0x5610b6[_0xb326('0x62')]=_0x1cb7c5[_0xb326('0x5b')]({'plain':!![]});interaction_log[_0xb326('0x1b')](_0xb326('0x6d'),_0x2e32ec[_0xb326('0x58')]['id'],_0x2e32ec[_0xb326('0x58')][_0xb326('0x30')],_0x2e32ec[_0xb326('0x58')][_0xb326('0x6e')],_0x5610b6[_0xb326('0x62')]['id'],_0x2e32ec[_0xb326('0x51')]?JSON[_0xb326('0x20')](_0x2e32ec[_0xb326('0x51')]):_0xb326('0x6f'));return respondWithRpcPromise(_0xb326('0x70'),_0xb326('0x71'),_0x5610b6);}return null;})[_0xb326('0x1a')](function(_0x2d9af3){if(_0x2d9af3){_0x2d9af3[_0xb326('0x23')]['interface']=util['format'](_0xb326('0x72'),_0x2e32ec[_0xb326('0x58')]['name']);_0x2d9af3[_0xb326('0x23')][_0xb326('0x67')]=_0x5610b6[_0xb326('0x67')];_0x2d9af3[_0xb326('0x23')][_0xb326('0x68')]=_0xb326('0x6b');respondWithRpcPromise(_0xb326('0x73'),_0xb326('0x73'),{'event':_0xb326('0x74'),'message':_0x2d9af3[_0xb326('0x23')]},client9002);return _0x5610b6;}return null;})[_0xb326('0x1a')](respondWithResult(_0x39c44f,null))[_0xb326('0x4a')](handleError(_0x39c44f,null));};exports[_0xb326('0x25')]=function(_0x41e10b,_0x1039fd,_0x45899d){if(_0x41e10b[_0xb326('0x51')]['id']){delete _0x41e10b[_0xb326('0x51')]['id'];}var _0x7d5601;return db[_0xb326('0x33')]['find']({'where':{'id':_0x41e10b[_0xb326('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1039fd,null))[_0xb326('0x1a')](function(_0x345e9a){if(_0x345e9a){_0x7d5601=_0x345e9a;return db[_0xb326('0x75')]['find']({'where':{'id':_0x345e9a[_0xb326('0x76')]}});}})['then'](handleEntityNotFound(_0x1039fd,null))['then'](function(_0x3976a9){if(_0x3976a9){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb326('0x25'),_0xb326('0x77'),_0x3976a9[_0xb326('0x78')],util[_0xb326('0x79')](_0x41e10b[_0xb326('0x51')],{'showHidden':![],'depth':null}));switch(_0x3976a9['type']){case _0xb326('0x7a'):if(_0x41e10b[_0xb326('0x51')][_0xb326('0x7b')]&&_0x41e10b[_0xb326('0x51')][_0xb326('0x7b')]===_0x7d5601[_0xb326('0x7c')]){return _0x7d5601[_0xb326('0x2d')]({'read':!![]});}break;case _0xb326('0x7d'):if(_0x41e10b[_0xb326('0x51')][_0xb326('0x7e')]&&_0x41e10b[_0xb326('0x51')][_0xb326('0x7e')]===_0x7d5601[_0xb326('0x7c')]&&_[_0xb326('0x7f')]([_0xb326('0x80'),_0xb326('0x81')],_0x41e10b[_0xb326('0x51')][_0xb326('0x82')])>=0x0){return _0x7d5601['update']({'read':!![]});}break;}return _0x7d5601;}})[_0xb326('0x1a')](respondWithResult(_0x1039fd,null))[_0xb326('0x4a')](handleError(_0x1039fd,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index ea5fe6a..eb07a2f 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 _0x9c83=['SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x1b8d1c,_0x395b3b){var _0x159a0b=function(_0x564655){while(--_0x564655){_0x1b8d1c['push'](_0x1b8d1c['shift']());}};_0x159a0b(++_0x395b3b);}(_0x9c83,0x8e));var _0x39c8=function(_0x366e49,_0x3b9642){_0x366e49=_0x366e49-0x0;var _0x2ba62d=_0x9c83[_0x366e49];return _0x2ba62d;};'use strict';var EventEmitter=require(_0x39c8('0x0'));var SmsMessage=require(_0x39c8('0x1'))['db'][_0x39c8('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x39c8('0x3')](0x0);var events={'afterCreate':_0x39c8('0x4'),'afterUpdate':_0x39c8('0x5'),'afterDestroy':_0x39c8('0x6')};function emitEvent(_0x2eb61c){return function(_0x590611,_0xceb2ac,_0x244471){SmsMessageEvents[_0x39c8('0x7')](_0x2eb61c+':'+_0x590611['id'],_0x590611);SmsMessageEvents[_0x39c8('0x7')](_0x2eb61c,_0x590611);_0x244471(null);};}for(var e in events){if(events[_0x39c8('0x8')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x8551=['emit','events','save'];(function(_0x11f901,_0xab12b1){var _0x32b295=function(_0x59991a){while(--_0x59991a){_0x11f901['push'](_0x11f901['shift']());}};_0x32b295(++_0xab12b1);}(_0x8551,0x97));var _0x1855=function(_0x5dca17,_0x43cdb8){_0x5dca17=_0x5dca17-0x0;var _0xcc7f0c=_0x8551[_0x5dca17];return _0xcc7f0c;};'use strict';var EventEmitter=require(_0x1855('0x0'));var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1855('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5f1894){return function(_0x3db9b1,_0x50158f,_0x364852){SmsMessageEvents[_0x1855('0x2')](_0x5f1894+':'+_0x3db9b1['id'],_0x3db9b1);SmsMessageEvents[_0x1855('0x2')](_0x5f1894,_0x3db9b1);_0x364852(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 4154463..019475d 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 _0xbfc3=['/api/sms/messages/','/status?token=','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','querystring','username','password','UTF-8','smsMethod','basic','send_sms_basic','sender_number','senderString','sender_string','classic+','stringify','POST','https://gateway.skebby.it/api/send/smseasy/advanced/http.php','deliveryReport','Missing\x20parameters:\x20username,\x20password','connectel','requestid','Missing\x20parameters:\x20authToken','clicksend','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','head','message_id','read','clickSend','token','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','models','get','direction','toLowerCase','isNil','UserId','SmsInteraction','then','update','createdAt','body','catch','error','out','SmsAccount','find','type','twilio','accountSid','authToken','phone','messages','remote'];(function(_0x1dfd2c,_0x4e598e){var _0x51a7a5=function(_0x3010ac){while(--_0x3010ac){_0x1dfd2c['push'](_0x1dfd2c['shift']());}};_0x51a7a5(++_0x4e598e);}(_0xbfc3,0x1c9));var _0x3bfc=function(_0x40c5fc,_0x253172){_0x40c5fc=_0x40c5fc-0x0;var _0x61daff=_0xbfc3[_0x40c5fc];return _0x61daff;};'use strict';var _=require(_0x3bfc('0x0'));var util=require(_0x3bfc('0x1'));var logger=require(_0x3bfc('0x2'))(_0x3bfc('0x3'));var moment=require(_0x3bfc('0x4'));var BPromise=require(_0x3bfc('0x5'));var rp=require(_0x3bfc('0x6'));var attributes=require(_0x3bfc('0x7'));module[_0x3bfc('0x8')]=function(_0x105657,_0x588ce6){return _0x105657[_0x3bfc('0x9')](_0x3bfc('0xa'),attributes,{'tableName':_0x3bfc('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']}],'timestamps':!![],'hooks':{'afterCreate':function(_0xfb7643,_0x61315,_0x1d0d80){var _0x483e4d=_0x105657[_0x3bfc('0xc')];var _0xa1b907=_0xfb7643[_0x3bfc('0xd')]({'plain':!![]});if(_0xa1b907[_0x3bfc('0xe')][_0x3bfc('0xf')]()==='in'||_0xa1b907[_0x3bfc('0xe')][_0x3bfc('0xf')]()==='out'&&!_0xa1b907['secret']&&!_[_0x3bfc('0x10')](_0xa1b907[_0x3bfc('0x11')])){_0x483e4d[_0x3bfc('0x12')]['findOne']({'where':{'id':_0xa1b907['SmsInteractionId']}})[_0x3bfc('0x13')](function(_0x5be301){if(_0x5be301){_0x5be301[_0x3bfc('0x14')]({'lastMsgAt':_0xa1b907[_0x3bfc('0x15')],'lastMsgDirection':_0xa1b907[_0x3bfc('0xe')][_0x3bfc('0xf')](),'lastMsgBody':_0xa1b907[_0x3bfc('0x16')]});}})[_0x3bfc('0x17')](function(_0x707e14){console[_0x3bfc('0x18')](_0x707e14);});}if(_0xa1b907[_0x3bfc('0xe')]===_0x3bfc('0x19')&&!_0xa1b907['secret']){var _0x5cb3cc;_0x483e4d[_0x3bfc('0x1a')][_0x3bfc('0x1b')]({'where':{'id':_0xa1b907['SmsAccountId']},'raw':!![]})[_0x3bfc('0x13')](function(_0x5421a9){_0x5cb3cc=_0x5421a9;if(_0x5cb3cc&&_0x5cb3cc[_0x3bfc('0x1c')]){switch(_0x5cb3cc[_0x3bfc('0x1c')]){case _0x3bfc('0x1d'):var _0x27d0e6=require('twilio');if(_0x5cb3cc[_0x3bfc('0x1e')]&&_0x5cb3cc[_0x3bfc('0x1f')]&&_0x5cb3cc[_0x3bfc('0x20')]){var _0x35fe8e=new _0x27d0e6(_0x5cb3cc[_0x3bfc('0x1e')],_0x5cb3cc[_0x3bfc('0x1f')]);_0x35fe8e[_0x3bfc('0x21')]['create']({'body':_0xa1b907['body'],'to':_0xa1b907[_0x3bfc('0x20')],'from':_0x5cb3cc['phone'],'statusCallback':_0x5cb3cc[_0x3bfc('0x22')]+_0x3bfc('0x23')+_0xa1b907['id']+_0x3bfc('0x24')+_0x5cb3cc['token']})[_0x3bfc('0x13')](function(_0x3bb913){if(_0x3bb913['sid']){return _0xfb7643[_0x3bfc('0x14')]({'messageId':_0x3bb913[_0x3bfc('0x25')]});}})[_0x3bfc('0x17')](function(_0x108e20){logger[_0x3bfc('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3bfc('0x26'),'twilio',util[_0x3bfc('0x27')](_0x108e20,{'showHidden':![],'depth':null}));});}else{logger[_0x3bfc('0x18')](_0x3bfc('0x28'),'afterCreate',_0x3bfc('0x1d'),_0x3bfc('0x29'));}break;case _0x3bfc('0x2a'):var _0x4a4e12=require(_0x3bfc('0x2b'));if(_0x5cb3cc[_0x3bfc('0x2c')]&&_0x5cb3cc[_0x3bfc('0x2d')]){var _0x282d20={'username':_0x5cb3cc['username'],'password':_0x5cb3cc[_0x3bfc('0x2d')],'recipients[]':[_0xa1b907[_0x3bfc('0x20')]],'text':_0xa1b907['body'],'charset':_0x3bfc('0x2e')};switch(_0x5cb3cc[_0x3bfc('0x2f')]){case _0x3bfc('0x30'):_0x282d20['method']=_0x3bfc('0x31');break;case'classic':_0x282d20['method']='send_sms_classic';_0x282d20[_0x3bfc('0x32')]=_0x5cb3cc[_0x3bfc('0x20')];if(_0x5cb3cc[_0x3bfc('0x33')]){_0x282d20[_0x3bfc('0x34')]=_0x5cb3cc[_0x3bfc('0x33')];}else if(_0x5cb3cc[_0x3bfc('0x20')]){_0x282d20[_0x3bfc('0x32')]=_0x5cb3cc[_0x3bfc('0x20')];}break;case _0x3bfc('0x35'):_0x282d20['method']='send_sms_classic_report';_0x282d20['sender_number']=_0x5cb3cc[_0x3bfc('0x20')];if(_0x5cb3cc[_0x3bfc('0x33')]){_0x282d20[_0x3bfc('0x34')]=_0x5cb3cc[_0x3bfc('0x33')];}else if(_0x5cb3cc[_0x3bfc('0x20')]){_0x282d20[_0x3bfc('0x32')]=_0x5cb3cc[_0x3bfc('0x20')];}break;}var _0x13c21a=_0x4a4e12[_0x3bfc('0x36')](_0x282d20);var _0x61315={'method':_0x3bfc('0x37'),'uri':_0x3bfc('0x38'),'body':_0x13c21a,'headers':{'Content-Type':'application/x-www-form-urlencoded','Content-Length':_0x13c21a['length'],'Content-Encoding':'utf8'}};rp(_0x61315)['then'](function(_0x542706){var _0x577ccf=_0x4a4e12['parse'](_0x542706);if(_0x577ccf['status']=='success'){var _0x3eb239={'messageId':_0x577ccf['id']};if(_0x5cb3cc[_0x3bfc('0x2f')]!=='classic+'||!_0x5cb3cc[_0x3bfc('0x39')]){_0x3eb239['read']=!![];}return _0xfb7643['update'](_0x3eb239);}else{logger[_0x3bfc('0x18')](_0x3bfc('0x28'),_0x3bfc('0x26'),_0x3bfc('0x2a'),util[_0x3bfc('0x27')](_0x577ccf,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1eca47){logger[_0x3bfc('0x18')](_0x3bfc('0x28'),_0x3bfc('0x26'),_0x3bfc('0x2a'),util[_0x3bfc('0x27')](_0x1eca47,{'showHidden':![],'depth':null}));});}else{logger[_0x3bfc('0x18')](_0x3bfc('0x28'),_0x3bfc('0x26'),_0x3bfc('0x2a'),_0x3bfc('0x3a'));}break;case _0x3bfc('0x3b'):if(_0x5cb3cc[_0x3bfc('0x1f')]){var _0x282d20={'recipient':_0xa1b907[_0x3bfc('0x20')],'message':_0xa1b907['body'],'sender':_0x5cb3cc['senderString']||_0x5cb3cc['phone'],'authorization':_0x5cb3cc[_0x3bfc('0x1f')]};var _0x61315={'method':_0x3bfc('0x37'),'uri':'https://smsapi.connectel.se/api/send/','body':_0x282d20,'json':!![]};rp(_0x61315)[_0x3bfc('0x13')](function(_0x3c1980){var _0x1f860f={'messageId':_0x3c1980[_0x3bfc('0x3c')]};if(!_0x5cb3cc[_0x3bfc('0x39')]){_0x1f860f['read']=!![];}return _0xfb7643[_0x3bfc('0x14')](_0x1f860f);})['catch'](function(_0x2e9e07){logger[_0x3bfc('0x18')](_0x3bfc('0x28'),_0x3bfc('0x26'),_0x3bfc('0x3b'),util['inspect'](_0x2e9e07,{'showHidden':![],'depth':null}));});}else{logger[_0x3bfc('0x18')](_0x3bfc('0x28'),_0x3bfc('0x26'),_0x3bfc('0x3b'),_0x3bfc('0x3d'));}break;case _0x3bfc('0x3e'):if(_0x5cb3cc[_0x3bfc('0x2c')]&&_0x5cb3cc[_0x3bfc('0x2d')]){var _0x282d20={'messages':[{'source':'xCALLY\x20Motion','to':_0xa1b907[_0x3bfc('0x20')],'body':_0xa1b907[_0x3bfc('0x16')],'from':_0x5cb3cc[_0x3bfc('0x33')]||_0x5cb3cc[_0x3bfc('0x20')]}]};var _0x3ecc55=util[_0x3bfc('0x3f')]('%s:%s',_0x5cb3cc[_0x3bfc('0x2c')],_0x5cb3cc[_0x3bfc('0x2d')]);var _0x61315={'method':_0x3bfc('0x37'),'uri':_0x3bfc('0x40'),'body':_0x282d20,'headers':{'Authorization':util['format'](_0x3bfc('0x41'),new Buffer(_0x3ecc55)[_0x3bfc('0x42')](_0x3bfc('0x43')))},'json':!![]};rp(_0x61315)[_0x3bfc('0x13')](function(_0x422f69){if(_0x422f69[_0x3bfc('0x44')]>=0xc8&&_0x422f69[_0x3bfc('0x44')]<=0xce){if(_0x422f69['data']&&_0x422f69[_0x3bfc('0x45')]['queued_count']>0x0){var _0x12c59a=_[_0x3bfc('0x46')](_0x422f69[_0x3bfc('0x45')][_0x3bfc('0x21')]);var _0x5aafb7={'messageId':_0x12c59a[_0x3bfc('0x47')]};if(!_0x5cb3cc[_0x3bfc('0x39')]){_0x5aafb7[_0x3bfc('0x48')]=!![];}return _0xfb7643[_0x3bfc('0x14')](_0x5aafb7);}else{logger[_0x3bfc('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x3bfc('0x49'),util[_0x3bfc('0x27')](_0x422f69,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x3bfc('0x28'),_0x3bfc('0x26'),_0x3bfc('0x49'),util['inspect'](_0x422f69,{'showHidden':![],'depth':null}));}})[_0x3bfc('0x17')](function(_0x1e84c1){logger[_0x3bfc('0x18')](_0x3bfc('0x28'),'afterCreate','clickSend',util[_0x3bfc('0x27')](_0x1e84c1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3bfc('0x28'),'afterCreate',_0x3bfc('0x49'),_0x3bfc('0x3a'));}break;case'plivo':if(_0x5cb3cc['authId']&&_0x5cb3cc[_0x3bfc('0x1f')]){var _0x282d20={'dst':_0xa1b907[_0x3bfc('0x20')],'text':_0xa1b907[_0x3bfc('0x16')],'src':_0x5cb3cc['senderString']||_0x5cb3cc[_0x3bfc('0x20')],'url':_0x5cb3cc['remote']+'/api/sms/messages/'+_0xa1b907['id']+'/status?token='+_0x5cb3cc[_0x3bfc('0x4a')]};var _0x3ecc55=util[_0x3bfc('0x3f')](_0x3bfc('0x4b'),_0x5cb3cc['authId'],_0x5cb3cc[_0x3bfc('0x1f')]);var _0x61315={'method':_0x3bfc('0x37'),'uri':util[_0x3bfc('0x3f')](_0x3bfc('0x4c'),_0x5cb3cc['authId']),'body':_0x282d20,'headers':{'Authorization':util[_0x3bfc('0x3f')]('Basic\x20%s',new Buffer(_0x3ecc55)['toString'](_0x3bfc('0x43')))},'json':!![]};rp(_0x61315)[_0x3bfc('0x13')](function(_0x45bec9){var _0x10d848={'messageId':_0x45bec9[_0x3bfc('0x4d')][0x0]};return _0xfb7643['update'](_0x10d848);})[_0x3bfc('0x17')](function(_0x4f3d7f){logger[_0x3bfc('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3bfc('0x26'),_0x3bfc('0x4e'),util[_0x3bfc('0x27')](_0x4f3d7f,{'showHidden':![],'depth':null}));});}else{logger[_0x3bfc('0x18')](_0x3bfc('0x28'),_0x3bfc('0x26'),'plivo',_0x3bfc('0x4f'));}break;}}})[_0x3bfc('0x50')](function(){_0x1d0d80();});}else{_0x1d0d80();}}},'charset':'utf8mb4','collate':_0x3bfc('0x51')});}; \ No newline at end of file +var _0xfe08=['stringify','POST','length','utf8','parse','status','success','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','https://smsapi.connectel.se/api/send/','requestid','connectel','clicksend','xCALLY\x20Motion','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','base64','http_code','data','head','clickSend','plivo','authId','/status?token=','token','%s:%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','lodash','../../config/logger','moment','request-promise','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','models','get','direction','toLowerCase','out','secret','isNil','SmsInteraction','SmsInteractionId','then','update','createdAt','body','catch','error','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','remote','/api/sms/messages/','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','querystring','username','password','UTF-8','smsMethod','basic','method','send_sms_basic','classic','send_sms_classic','sender_number','senderString','classic+','send_sms_classic_report'];(function(_0x33155c,_0x3fdde1){var _0x5becf7=function(_0x2f7a2f){while(--_0x2f7a2f){_0x33155c['push'](_0x33155c['shift']());}};_0x5becf7(++_0x3fdde1);}(_0xfe08,0x177));var _0x8fe0=function(_0xaf8f29,_0x5754cf){_0xaf8f29=_0xaf8f29-0x0;var _0x391fed=_0xfe08[_0xaf8f29];return _0x391fed;};'use strict';var _=require(_0x8fe0('0x0'));var util=require('util');var logger=require(_0x8fe0('0x1'))('api');var moment=require(_0x8fe0('0x2'));var BPromise=require('bluebird');var rp=require(_0x8fe0('0x3'));var attributes=require(_0x8fe0('0x4'));module[_0x8fe0('0x5')]=function(_0x1cb819,_0x1a9880){return _0x1cb819[_0x8fe0('0x6')](_0x8fe0('0x7'),attributes,{'tableName':_0x8fe0('0x8'),'paranoid':![],'indexes':[{'name':_0x8fe0('0x9'),'fields':['messageId']}],'timestamps':!![],'hooks':{'afterCreate':function(_0x35ed40,_0xc1e3e6,_0x1ece8c){var _0x13aa9d=_0x1cb819[_0x8fe0('0xa')];var _0x507b22=_0x35ed40[_0x8fe0('0xb')]({'plain':!![]});if(_0x507b22[_0x8fe0('0xc')][_0x8fe0('0xd')]()==='in'||_0x507b22[_0x8fe0('0xc')]['toLowerCase']()===_0x8fe0('0xe')&&!_0x507b22[_0x8fe0('0xf')]&&!_[_0x8fe0('0x10')](_0x507b22['UserId'])){_0x13aa9d[_0x8fe0('0x11')]['findOne']({'where':{'id':_0x507b22[_0x8fe0('0x12')]}})[_0x8fe0('0x13')](function(_0x152133){if(_0x152133){_0x152133[_0x8fe0('0x14')]({'lastMsgAt':_0x507b22[_0x8fe0('0x15')],'lastMsgDirection':_0x507b22[_0x8fe0('0xc')][_0x8fe0('0xd')](),'lastMsgBody':_0x507b22[_0x8fe0('0x16')]});}})[_0x8fe0('0x17')](function(_0x53b206){console[_0x8fe0('0x18')](_0x53b206);});}if(_0x507b22[_0x8fe0('0xc')]===_0x8fe0('0xe')&&!_0x507b22['secret']){var _0xa5690f;_0x13aa9d[_0x8fe0('0x19')]['find']({'where':{'id':_0x507b22[_0x8fe0('0x1a')]},'raw':!![]})[_0x8fe0('0x13')](function(_0x3db306){_0xa5690f=_0x3db306;if(_0xa5690f&&_0xa5690f['type']){switch(_0xa5690f[_0x8fe0('0x1b')]){case _0x8fe0('0x1c'):var _0x717eea=require(_0x8fe0('0x1c'));if(_0xa5690f[_0x8fe0('0x1d')]&&_0xa5690f[_0x8fe0('0x1e')]&&_0xa5690f[_0x8fe0('0x1f')]){var _0x2dcb4d=new _0x717eea(_0xa5690f['accountSid'],_0xa5690f['authToken']);_0x2dcb4d[_0x8fe0('0x20')]['create']({'body':_0x507b22[_0x8fe0('0x16')],'to':_0x507b22['phone'],'from':_0xa5690f[_0x8fe0('0x1f')],'statusCallback':_0xa5690f[_0x8fe0('0x21')]+_0x8fe0('0x22')+_0x507b22['id']+'/status?token='+_0xa5690f['token']})['then'](function(_0x1255e7){if(_0x1255e7[_0x8fe0('0x23')]){return _0x35ed40[_0x8fe0('0x14')]({'messageId':_0x1255e7['sid']});}})['catch'](function(_0x123811){logger[_0x8fe0('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8fe0('0x24'),_0x8fe0('0x1c'),util[_0x8fe0('0x25')](_0x123811,{'showHidden':![],'depth':null}));});}else{logger[_0x8fe0('0x18')](_0x8fe0('0x26'),_0x8fe0('0x24'),_0x8fe0('0x1c'),_0x8fe0('0x27'));}break;case _0x8fe0('0x28'):var _0x181094=require(_0x8fe0('0x29'));if(_0xa5690f[_0x8fe0('0x2a')]&&_0xa5690f[_0x8fe0('0x2b')]){var _0x44ae63={'username':_0xa5690f[_0x8fe0('0x2a')],'password':_0xa5690f[_0x8fe0('0x2b')],'recipients[]':[_0x507b22[_0x8fe0('0x1f')]],'text':_0x507b22['body'],'charset':_0x8fe0('0x2c')};switch(_0xa5690f[_0x8fe0('0x2d')]){case _0x8fe0('0x2e'):_0x44ae63[_0x8fe0('0x2f')]=_0x8fe0('0x30');break;case _0x8fe0('0x31'):_0x44ae63['method']=_0x8fe0('0x32');_0x44ae63[_0x8fe0('0x33')]=_0xa5690f['phone'];if(_0xa5690f[_0x8fe0('0x34')]){_0x44ae63['sender_string']=_0xa5690f[_0x8fe0('0x34')];}else if(_0xa5690f['phone']){_0x44ae63[_0x8fe0('0x33')]=_0xa5690f[_0x8fe0('0x1f')];}break;case _0x8fe0('0x35'):_0x44ae63[_0x8fe0('0x2f')]=_0x8fe0('0x36');_0x44ae63[_0x8fe0('0x33')]=_0xa5690f['phone'];if(_0xa5690f['senderString']){_0x44ae63['sender_string']=_0xa5690f['senderString'];}else if(_0xa5690f[_0x8fe0('0x1f')]){_0x44ae63[_0x8fe0('0x33')]=_0xa5690f[_0x8fe0('0x1f')];}break;}var _0x42710d=_0x181094[_0x8fe0('0x37')](_0x44ae63);var _0xc1e3e6={'method':_0x8fe0('0x38'),'uri':'https://gateway.skebby.it/api/send/smseasy/advanced/http.php','body':_0x42710d,'headers':{'Content-Type':'application/x-www-form-urlencoded','Content-Length':_0x42710d[_0x8fe0('0x39')],'Content-Encoding':_0x8fe0('0x3a')}};rp(_0xc1e3e6)[_0x8fe0('0x13')](function(_0x215b59){var _0x39c567=_0x181094[_0x8fe0('0x3b')](_0x215b59);if(_0x39c567[_0x8fe0('0x3c')]==_0x8fe0('0x3d')){var _0x1ef8b1={'messageId':_0x39c567['id']};if(_0xa5690f[_0x8fe0('0x2d')]!==_0x8fe0('0x35')||!_0xa5690f[_0x8fe0('0x3e')]){_0x1ef8b1[_0x8fe0('0x3f')]=!![];}return _0x35ed40['update'](_0x1ef8b1);}else{logger['error'](_0x8fe0('0x26'),_0x8fe0('0x24'),'skebby',util[_0x8fe0('0x25')](_0x39c567,{'showHidden':![],'depth':null}));}})[_0x8fe0('0x17')](function(_0x46bc95){logger[_0x8fe0('0x18')](_0x8fe0('0x26'),_0x8fe0('0x24'),'skebby',util[_0x8fe0('0x25')](_0x46bc95,{'showHidden':![],'depth':null}));});}else{logger[_0x8fe0('0x18')](_0x8fe0('0x26'),_0x8fe0('0x24'),'skebby',_0x8fe0('0x40'));}break;case'connectel':if(_0xa5690f[_0x8fe0('0x1e')]){var _0x44ae63={'recipient':_0x507b22[_0x8fe0('0x1f')],'message':_0x507b22[_0x8fe0('0x16')],'sender':_0xa5690f['senderString']||_0xa5690f[_0x8fe0('0x1f')],'authorization':_0xa5690f[_0x8fe0('0x1e')]};var _0xc1e3e6={'method':'POST','uri':_0x8fe0('0x41'),'body':_0x44ae63,'json':!![]};rp(_0xc1e3e6)[_0x8fe0('0x13')](function(_0x2d1383){var _0x248605={'messageId':_0x2d1383[_0x8fe0('0x42')]};if(!_0xa5690f[_0x8fe0('0x3e')]){_0x248605[_0x8fe0('0x3f')]=!![];}return _0x35ed40[_0x8fe0('0x14')](_0x248605);})[_0x8fe0('0x17')](function(_0x2a8c63){logger[_0x8fe0('0x18')](_0x8fe0('0x26'),_0x8fe0('0x24'),_0x8fe0('0x43'),util[_0x8fe0('0x25')](_0x2a8c63,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8fe0('0x24'),'connectel','Missing\x20parameters:\x20authToken');}break;case _0x8fe0('0x44'):if(_0xa5690f['username']&&_0xa5690f[_0x8fe0('0x2b')]){var _0x44ae63={'messages':[{'source':_0x8fe0('0x45'),'to':_0x507b22[_0x8fe0('0x1f')],'body':_0x507b22[_0x8fe0('0x16')],'from':_0xa5690f[_0x8fe0('0x34')]||_0xa5690f[_0x8fe0('0x1f')]}]};var _0x36be3a=util['format']('%s:%s',_0xa5690f[_0x8fe0('0x2a')],_0xa5690f[_0x8fe0('0x2b')]);var _0xc1e3e6={'method':'POST','uri':_0x8fe0('0x46'),'body':_0x44ae63,'headers':{'Authorization':util[_0x8fe0('0x47')](_0x8fe0('0x48'),new Buffer(_0x36be3a)[_0x8fe0('0x49')](_0x8fe0('0x4a')))},'json':!![]};rp(_0xc1e3e6)[_0x8fe0('0x13')](function(_0x28c33b){if(_0x28c33b[_0x8fe0('0x4b')]>=0xc8&&_0x28c33b[_0x8fe0('0x4b')]<=0xce){if(_0x28c33b[_0x8fe0('0x4c')]&&_0x28c33b[_0x8fe0('0x4c')]['queued_count']>0x0){var _0x279798=_[_0x8fe0('0x4d')](_0x28c33b[_0x8fe0('0x4c')][_0x8fe0('0x20')]);var _0x434578={'messageId':_0x279798['message_id']};if(!_0xa5690f[_0x8fe0('0x3e')]){_0x434578['read']=!![];}return _0x35ed40[_0x8fe0('0x14')](_0x434578);}else{logger[_0x8fe0('0x18')](_0x8fe0('0x26'),_0x8fe0('0x24'),_0x8fe0('0x4e'),util['inspect'](_0x28c33b,{'showHidden':![],'depth':null}));}}else{logger[_0x8fe0('0x18')](_0x8fe0('0x26'),_0x8fe0('0x24'),_0x8fe0('0x4e'),util[_0x8fe0('0x25')](_0x28c33b,{'showHidden':![],'depth':null}));}})['catch'](function(_0x15bb7d){logger[_0x8fe0('0x18')](_0x8fe0('0x26'),_0x8fe0('0x24'),_0x8fe0('0x4e'),util[_0x8fe0('0x25')](_0x15bb7d,{'showHidden':![],'depth':null}));});}else{logger[_0x8fe0('0x18')](_0x8fe0('0x26'),_0x8fe0('0x24'),_0x8fe0('0x4e'),_0x8fe0('0x40'));}break;case _0x8fe0('0x4f'):if(_0xa5690f[_0x8fe0('0x50')]&&_0xa5690f[_0x8fe0('0x1e')]){var _0x44ae63={'dst':_0x507b22[_0x8fe0('0x1f')],'text':_0x507b22['body'],'src':_0xa5690f['senderString']||_0xa5690f[_0x8fe0('0x1f')],'url':_0xa5690f[_0x8fe0('0x21')]+'/api/sms/messages/'+_0x507b22['id']+_0x8fe0('0x51')+_0xa5690f[_0x8fe0('0x52')]};var _0x36be3a=util[_0x8fe0('0x47')](_0x8fe0('0x53'),_0xa5690f[_0x8fe0('0x50')],_0xa5690f[_0x8fe0('0x1e')]);var _0xc1e3e6={'method':'POST','uri':util[_0x8fe0('0x47')]('https://api.plivo.com/v1/Account/%s/Message/',_0xa5690f[_0x8fe0('0x50')]),'body':_0x44ae63,'headers':{'Authorization':util[_0x8fe0('0x47')]('Basic\x20%s',new Buffer(_0x36be3a)[_0x8fe0('0x49')](_0x8fe0('0x4a')))},'json':!![]};rp(_0xc1e3e6)[_0x8fe0('0x13')](function(_0xcddd60){var _0x219c82={'messageId':_0xcddd60[_0x8fe0('0x54')][0x0]};return _0x35ed40['update'](_0x219c82);})[_0x8fe0('0x17')](function(_0xfbe7de){logger[_0x8fe0('0x18')](_0x8fe0('0x26'),'afterCreate',_0x8fe0('0x4f'),util['inspect'](_0xfbe7de,{'showHidden':![],'depth':null}));});}else{logger[_0x8fe0('0x18')](_0x8fe0('0x26'),_0x8fe0('0x24'),'plivo',_0x8fe0('0x55'));}break;}}})['finally'](function(){_0x1ece8c();});}else{_0x1ece8c();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index d814f25..1f2ff53 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 _0x8cf9=['error','code','message','info','result','catch','CreateSmsMessage','SmsMessage','create','body','options','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','socket.io-emitter','localhost','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x43762c,_0x48ff0f){var _0x4a85e0=function(_0x452e89){while(--_0x452e89){_0x43762c['push'](_0x43762c['shift']());}};_0x4a85e0(++_0x48ff0f);}(_0x8cf9,0x1cd));var _0x98cf=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x8cf9[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0x98cf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x98cf('0x1'));var rs=require(_0x98cf('0x2'));var fs=require('fs');var db=require(_0x98cf('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x98cf('0x4'))(_0x98cf('0x5'));var config=require(_0x98cf('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x98cf('0x7')][_0x98cf('0x8')]({'port':0x232a});var socket=require(_0x98cf('0x9'))({'host':_0x98cf('0xa'),'port':0x18eb});require('./smsMessage.socket')[_0x98cf('0xb')](socket);function respondWithRpcPromise(_0x473d57,_0x303db5,_0x2b219b){return new BPromise(function(_0x321dd3,_0x2a05b3){return client[_0x98cf('0xc')](_0x473d57,_0x2b219b)[_0x98cf('0xd')](function(_0x3a3e4c){logger['info'](_0x98cf('0xe'),_0x303db5,_0x98cf('0xf'));logger[_0x98cf('0x10')](_0x98cf('0x11'),_0x303db5,_0x98cf('0xf'),JSON[_0x98cf('0x12')](_0x3a3e4c));if(_0x3a3e4c['error']){if(_0x3a3e4c[_0x98cf('0x13')][_0x98cf('0x14')]===0x1f4){logger[_0x98cf('0x13')]('SmsMessage,\x20%s,\x20%s',_0x303db5,_0x3a3e4c[_0x98cf('0x13')][_0x98cf('0x15')]);return _0x2a05b3(_0x3a3e4c[_0x98cf('0x13')][_0x98cf('0x15')]);}logger[_0x98cf('0x13')](_0x98cf('0xe'),_0x303db5,_0x3a3e4c[_0x98cf('0x13')][_0x98cf('0x15')]);return _0x321dd3(_0x3a3e4c['error']['message']);}else{logger[_0x98cf('0x16')](_0x98cf('0xe'),_0x303db5,_0x98cf('0xf'));_0x321dd3(_0x3a3e4c[_0x98cf('0x17')][_0x98cf('0x15')]);}})[_0x98cf('0x18')](function(_0x3de31e){logger[_0x98cf('0x13')](_0x98cf('0xe'),_0x303db5,_0x3de31e);_0x2a05b3(_0x3de31e);});});}exports[_0x98cf('0x19')]=function(_0x58cb3e){var _0x124666=this;return new Promise(function(_0x2cd0be,_0x16a606){return db[_0x98cf('0x1a')][_0x98cf('0x1b')](_0x58cb3e[_0x98cf('0x1c')],{'raw':_0x58cb3e[_0x98cf('0x1d')]?_0x58cb3e['options']['raw']===undefined?!![]:![]:!![]})[_0x98cf('0xd')](function(_0x4f98ec){logger[_0x98cf('0x16')](_0x98cf('0x19'),_0x58cb3e);logger[_0x98cf('0x10')](_0x98cf('0x19'),_0x58cb3e,JSON[_0x98cf('0x12')](_0x4f98ec));_0x2cd0be(_0x4f98ec);})[_0x98cf('0x18')](function(_0x4b2ba4){logger[_0x98cf('0x13')]('CreateSmsMessage',_0x4b2ba4[_0x98cf('0x15')],_0x58cb3e);_0x16a606(_0x124666[_0x98cf('0x13')](0x1f4,_0x4b2ba4['message']));});});}; \ No newline at end of file +var _0x7cfc=['debug','stringify','catch','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','socket.io-emitter','localhost','./smsMessage.socket','then','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','SmsMessage,\x20%s,\x20%s','message','result','CreateSmsMessage','SmsMessage','create','body','options','raw'];(function(_0x3e438f,_0x4439e7){var _0x35f7ff=function(_0x5c643a){while(--_0x5c643a){_0x3e438f['push'](_0x3e438f['shift']());}};_0x35f7ff(++_0x4439e7);}(_0x7cfc,0x1b3));var _0xc7cf=function(_0x26d158,_0x537afd){_0x26d158=_0x26d158-0x0;var _0x4d6b6f=_0x7cfc[_0x26d158];return _0x4d6b6f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xc7cf('0x0'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xc7cf('0x1'))['db'];var utils=require(_0xc7cf('0x2'));var logger=require(_0xc7cf('0x3'))(_0xc7cf('0x4'));var config=require(_0xc7cf('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc7cf('0x6')]({'port':0x232a});var socket=require(_0xc7cf('0x7'))({'host':_0xc7cf('0x8'),'port':0x18eb});require(_0xc7cf('0x9'))['register'](socket);function respondWithRpcPromise(_0x5e6355,_0x167d45,_0x535855){return new BPromise(function(_0xc52558,_0x316763){return client['request'](_0x5e6355,_0x535855)[_0xc7cf('0xa')](function(_0x5b1014){logger[_0xc7cf('0xb')]('SmsMessage,\x20%s,\x20%s',_0x167d45,_0xc7cf('0xc'));logger['debug'](_0xc7cf('0xd'),_0x167d45,_0xc7cf('0xc'),JSON['stringify'](_0x5b1014));if(_0x5b1014[_0xc7cf('0xe')]){if(_0x5b1014['error']['code']===0x1f4){logger[_0xc7cf('0xe')](_0xc7cf('0xf'),_0x167d45,_0x5b1014[_0xc7cf('0xe')]['message']);return _0x316763(_0x5b1014[_0xc7cf('0xe')][_0xc7cf('0x10')]);}logger[_0xc7cf('0xe')]('SmsMessage,\x20%s,\x20%s',_0x167d45,_0x5b1014[_0xc7cf('0xe')][_0xc7cf('0x10')]);return _0xc52558(_0x5b1014[_0xc7cf('0xe')][_0xc7cf('0x10')]);}else{logger[_0xc7cf('0xb')](_0xc7cf('0xf'),_0x167d45,_0xc7cf('0xc'));_0xc52558(_0x5b1014[_0xc7cf('0x11')]['message']);}})['catch'](function(_0x26c901){logger[_0xc7cf('0xe')](_0xc7cf('0xf'),_0x167d45,_0x26c901);_0x316763(_0x26c901);});});}exports[_0xc7cf('0x12')]=function(_0x2212c1){var _0x24b11c=this;return new Promise(function(_0x60cb34,_0x3b9ccd){return db[_0xc7cf('0x13')][_0xc7cf('0x14')](_0x2212c1[_0xc7cf('0x15')],{'raw':_0x2212c1[_0xc7cf('0x16')]?_0x2212c1['options'][_0xc7cf('0x17')]===undefined?!![]:![]:!![]})[_0xc7cf('0xa')](function(_0x3affca){logger[_0xc7cf('0xb')](_0xc7cf('0x12'),_0x2212c1);logger[_0xc7cf('0x18')](_0xc7cf('0x12'),_0x2212c1,JSON[_0xc7cf('0x19')](_0x3affca));_0x60cb34(_0x3affca);})[_0xc7cf('0x1a')](function(_0x30b3b8){logger[_0xc7cf('0xe')](_0xc7cf('0x12'),_0x30b3b8[_0xc7cf('0x10')],_0x2212c1);_0x3b9ccd(_0x24b11c[_0xc7cf('0xe')](0x1f4,_0x30b3b8['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 89401c1..14c5e9e 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 _0xb48c=['remove','update','emit','register'];(function(_0x1abbf4,_0x2f199d){var _0x4c28d9=function(_0x1c5316){while(--_0x1c5316){_0x1abbf4['push'](_0x1abbf4['shift']());}};_0x4c28d9(++_0x2f199d);}(_0xb48c,0xdc));var _0xcb48=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb48c[_0x397e5f];return _0x5302b8;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save',_0xcb48('0x0'),_0xcb48('0x1')];function createListener(_0x38aee7,_0xd1931e){return function(_0x24947b){_0xd1931e[_0xcb48('0x2')](_0x38aee7,_0x24947b);};}function removeListener(_0x3e33b5,_0x108e7e){return function(){SmsMessageEvents['removeListener'](_0x3e33b5,_0x108e7e);};}exports[_0xcb48('0x3')]=function(_0xa96b04){for(var _0x2ec260=0x0,_0xd40cd7=events['length'];_0x2ec260<_0xd40cd7;_0x2ec260++){var _0x2a53b5=events[_0x2ec260];var _0x4dc617=createListener('smsMessage:'+_0x2a53b5,_0xa96b04);SmsMessageEvents['on'](_0x2a53b5,_0x4dc617);}}; \ No newline at end of file +var _0x8fe9=['register','length','smsMessage:','./smsMessage.events','save','remove','update','emit','removeListener'];(function(_0x318dda,_0x1aa800){var _0x3f97ca=function(_0x1dc61a){while(--_0x1dc61a){_0x318dda['push'](_0x318dda['shift']());}};_0x3f97ca(++_0x1aa800);}(_0x8fe9,0xd2));var _0x98fe=function(_0x207811,_0x3420a6){_0x207811=_0x207811-0x0;var _0x170d56=_0x8fe9[_0x207811];return _0x170d56;};'use strict';var SmsMessageEvents=require(_0x98fe('0x0'));var events=[_0x98fe('0x1'),_0x98fe('0x2'),_0x98fe('0x3')];function createListener(_0x6972f2,_0x315d5d){return function(_0xee4573){_0x315d5d[_0x98fe('0x4')](_0x6972f2,_0xee4573);};}function removeListener(_0x3b3d35,_0x536a38){return function(){SmsMessageEvents[_0x98fe('0x5')](_0x3b3d35,_0x536a38);};}exports[_0x98fe('0x6')]=function(_0xf94060){for(var _0x21e920=0x0,_0x4d3b26=events[_0x98fe('0x7')];_0x21e920<_0x4d3b26;_0x21e920++){var _0x1a77be=events[_0x21e920];var _0xb250a0=createListener(_0x98fe('0x8')+_0x1a77be,_0xf94060);SmsMessageEvents['on'](_0x1a77be,_0xb250a0);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index dc01956..2228134 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 _0x5b3d=['/:id/users','getAgents','post','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','express','Router','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams'];(function(_0x26730f,_0xedac84){var _0x3a7899=function(_0x39ce1e){while(--_0x39ce1e){_0x26730f['push'](_0x26730f['shift']());}};_0x3a7899(++_0xedac84);}(_0x5b3d,0xc7));var _0xd5b3=function(_0x104662,_0x53a7a7){_0x104662=_0x104662-0x0;var _0x19cba7=_0x5b3d[_0x104662];return _0x19cba7;};'use strict';var multer=require(_0xd5b3('0x0'));var util=require('util');var path=require(_0xd5b3('0x1'));var express=require(_0xd5b3('0x2'));var router=express[_0xd5b3('0x3')]();var auth=require(_0xd5b3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd5b3('0x5'));var controller=require(_0xd5b3('0x6'));router[_0xd5b3('0x7')]('/',auth[_0xd5b3('0x8')](),controller[_0xd5b3('0x9')]);router[_0xd5b3('0x7')](_0xd5b3('0xa'),auth['isAuthenticated'](),controller[_0xd5b3('0xb')]);router[_0xd5b3('0x7')](_0xd5b3('0xc'),auth[_0xd5b3('0x8')](),controller['show']);router[_0xd5b3('0x7')](_0xd5b3('0xd'),auth[_0xd5b3('0x8')](),controller[_0xd5b3('0xe')]);router['get'](_0xd5b3('0xf'),auth[_0xd5b3('0x8')](),controller[_0xd5b3('0x10')]);router[_0xd5b3('0x7')](_0xd5b3('0x11'),auth['isAuthenticated'](),controller[_0xd5b3('0x12')]);router[_0xd5b3('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd5b3('0x13')](_0xd5b3('0xf'),auth['isAuthenticated'](),controller['addTeams']);router[_0xd5b3('0x13')](_0xd5b3('0x11'),auth[_0xd5b3('0x8')](),controller[_0xd5b3('0x14')]);router[_0xd5b3('0x15')](_0xd5b3('0xc'),auth[_0xd5b3('0x8')](),controller[_0xd5b3('0x16')]);router[_0xd5b3('0x17')](_0xd5b3('0xc'),auth[_0xd5b3('0x8')](),controller[_0xd5b3('0x18')]);router[_0xd5b3('0x17')](_0xd5b3('0xf'),auth['isAuthenticated'](),controller[_0xd5b3('0x19')]);router[_0xd5b3('0x17')]('/:id/users',auth[_0xd5b3('0x8')](),controller[_0xd5b3('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x35b0=['update','destroy','delete','removeAgents','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/describe','isAuthenticated','/:id','show','get','/:id/members','getMembers','/:id/teams','getTeams','getAgents','create','post','addTeams','/:id/users','addAgents','put'];(function(_0x22e004,_0x271218){var _0x261e6f=function(_0x5b3a5b){while(--_0x5b3a5b){_0x22e004['push'](_0x22e004['shift']());}};_0x261e6f(++_0x271218);}(_0x35b0,0xb3));var _0x035b=function(_0x5900fb,_0x3b9d03){_0x5900fb=_0x5900fb-0x0;var _0x52aef2=_0x35b0[_0x5900fb];return _0x52aef2;};'use strict';var multer=require(_0x035b('0x0'));var util=require(_0x035b('0x1'));var path=require(_0x035b('0x2'));var express=require(_0x035b('0x3'));var router=express['Router']();var auth=require(_0x035b('0x4'));var interaction=require(_0x035b('0x5'));var config=require(_0x035b('0x6'));var controller=require('./smsQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x035b('0x7')]);router['get'](_0x035b('0x8'),auth[_0x035b('0x9')](),controller['describe']);router['get'](_0x035b('0xa'),auth['isAuthenticated'](),controller[_0x035b('0xb')]);router[_0x035b('0xc')](_0x035b('0xd'),auth[_0x035b('0x9')](),controller[_0x035b('0xe')]);router[_0x035b('0xc')](_0x035b('0xf'),auth['isAuthenticated'](),controller[_0x035b('0x10')]);router[_0x035b('0xc')]('/:id/users',auth[_0x035b('0x9')](),controller[_0x035b('0x11')]);router['post']('/',auth[_0x035b('0x9')](),controller[_0x035b('0x12')]);router[_0x035b('0x13')](_0x035b('0xf'),auth[_0x035b('0x9')](),controller[_0x035b('0x14')]);router[_0x035b('0x13')](_0x035b('0x15'),auth[_0x035b('0x9')](),controller[_0x035b('0x16')]);router[_0x035b('0x17')](_0x035b('0xa'),auth['isAuthenticated'](),controller[_0x035b('0x18')]);router['delete'](_0x035b('0xa'),auth[_0x035b('0x9')](),controller[_0x035b('0x19')]);router['delete'](_0x035b('0xf'),auth[_0x035b('0x9')](),controller['removeTeams']);router[_0x035b('0x1a')](_0x035b('0x15'),auth[_0x035b('0x9')](),controller[_0x035b('0x1b')]);module[_0x035b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 9eeea97..55dfaf8 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 _0xacd0=['rrmemory','roundrobin','sequelize','name','STRING'];(function(_0x4d3c17,_0x317c47){var _0xe81017=function(_0x498f4a){while(--_0x498f4a){_0x4d3c17['push'](_0x4d3c17['shift']());}};_0xe81017(++_0x317c47);}(_0xacd0,0x75));var _0x0acd=function(_0x207a02,_0x278c56){_0x207a02=_0x207a02-0x0;var _0xd995c3=_0xacd0[_0x207a02];return _0xd995c3;};'use strict';var Sequelize=require(_0x0acd('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x0acd('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0acd('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0acd('0x3'),'beepall',_0x0acd('0x4'))}}; \ No newline at end of file +var _0x33a3=['name','beepall','sequelize','STRING'];(function(_0x5b35db,_0x2abb6e){var _0x3de908=function(_0x4d593b){while(--_0x4d593b){_0x5b35db['push'](_0x5b35db['shift']());}};_0x3de908(++_0x2abb6e);}(_0x33a3,0xde));var _0x333a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x33a3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x333a('0x0'));module['exports']={'name':{'type':Sequelize[_0x333a('0x1')],'unique':_0x333a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x333a('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x333a('0x3'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 5100726..2d30552 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 _0x2372=['papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','socket.io-emitter','localhost','./smsQueue.socket','end','status','json','offset','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','name','send','index','SmsQueue','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','day','add','merge','filter','map','count','includeAll','include','rows','catch','show','params','options','create','body','find','describe','getMembers','findOne','get','UserSmsQueue','sort','pick','findAll','User','findAndCountAll','agent','smsPause','format','%s/%s','SIP','updatedAt','getTeams','Team','ids','Agents','addAgents','penalty','addTeams','removeTeams','removeAgents','omit','emit','userSmsQueue:save','isArray','userSmsQueue:remove','getAgents','fast-json-patch','moment','bluebird','path','ejs','lodash','squel','crypto','desk.js'];(function(_0x19158f,_0x52de63){var _0x526e39=function(_0x5ce78c){while(--_0x5ce78c){_0x19158f['push'](_0x19158f['shift']());}};_0x526e39(++_0x52de63);}(_0x2372,0x1e6));var _0x2237=function(_0x547274,_0x41c28b){_0x547274=_0x547274-0x0;var _0x7a2f5b=_0x2372[_0x547274];return _0x7a2f5b;};'use strict';var jsonpatch=require(_0x2237('0x0'));var rp=require('request-promise');var moment=require(_0x2237('0x1'));var BPromise=require(_0x2237('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2237('0x3'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2237('0x4'));var fs=require('fs');var _=require(_0x2237('0x5'));var squel=require(_0x2237('0x6'));var crypto=require(_0x2237('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x2237('0x8'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2237('0x9'));var qs=require(_0x2237('0xa'));var logger=require(_0x2237('0xb'))(_0x2237('0xc'));var utils=require(_0x2237('0xd'));var config=require(_0x2237('0xe'));var db=require('../../mysqldb')['db'];var socket=require(_0x2237('0xf'))({'host':_0x2237('0x10'),'port':0x18eb});require(_0x2237('0x11'))['register'](socket);function respondWithStatusCode(_0x4aab67,_0x1d5976){_0x1d5976=_0x1d5976||0xcc;return function(_0x3811b8){if(_0x3811b8){return _0x4aab67['sendStatus'](_0x1d5976);}return _0x4aab67['status'](_0x1d5976)[_0x2237('0x12')]();};}function respondWithResult(_0x651ede,_0x45c8e5){_0x45c8e5=_0x45c8e5||0xc8;return function(_0x4efebf){if(_0x4efebf){return _0x651ede[_0x2237('0x13')](_0x45c8e5)[_0x2237('0x14')](_0x4efebf);}};}function respondWithFilteredResult(_0x1ea2b9,_0xa7cb99){return function(_0xda96c8){if(_0xda96c8){var _0x409d1c=_0xda96c8['count'],_0x57597c=_0xa7cb99[_0x2237('0x15')],_0x2d11f8=_0xa7cb99[_0x2237('0x15')]+_0xa7cb99['limit'],_0x52ae97;if(_0x2d11f8>=_0x409d1c){_0x2d11f8=_0x409d1c;_0x52ae97=0xc8;}else{_0x52ae97=0xce;}_0x1ea2b9[_0x2237('0x13')](_0x52ae97);return _0x1ea2b9[_0x2237('0x16')](_0x2237('0x17'),_0x57597c+'-'+_0x2d11f8+'/'+_0x409d1c)[_0x2237('0x14')](_0xda96c8);}return null;};}function patchUpdates(_0x264c1a){return function(_0xd94fd){try{jsonpatch[_0x2237('0x18')](_0xd94fd,_0x264c1a,!![]);}catch(_0x2b0111){return BPromise[_0x2237('0x19')](_0x2b0111);}return _0xd94fd[_0x2237('0x1a')]();};}function saveUpdates(_0x2e4a58,_0x491119){return function(_0x4c5913){if(_0x4c5913){return _0x4c5913[_0x2237('0x1b')](_0x2e4a58)['then'](function(_0x1e8ffb){return _0x1e8ffb;});}return null;};}function removeEntity(_0x572416,_0x4b5b02){return function(_0x40ed66){if(_0x40ed66){return _0x40ed66[_0x2237('0x1c')]()[_0x2237('0x1d')](function(){_0x572416[_0x2237('0x13')](0xcc)[_0x2237('0x12')]();});}};}function handleEntityNotFound(_0x1765dc,_0x37c7d8){return function(_0x3b14c7){if(!_0x3b14c7){_0x1765dc[_0x2237('0x1e')](0x194);}return _0x3b14c7;};}function handleError(_0x41fd2c,_0x1f8f12){_0x1f8f12=_0x1f8f12||0x1f4;return function(_0x2834c8){logger[_0x2237('0x1f')](_0x2834c8['stack']);if(_0x2834c8[_0x2237('0x20')]){delete _0x2834c8[_0x2237('0x20')];}_0x41fd2c[_0x2237('0x13')](_0x1f8f12)[_0x2237('0x21')](_0x2834c8);};}exports[_0x2237('0x22')]=function(_0x489106,_0x1a3b9e){var _0x4a3674={},_0x2835f1={},_0x294210={'count':0x0,'rows':[]};var _0x34ef2e=db[_0x2237('0x23')][_0x2237('0x24')];_0x2835f1[_0x2237('0x25')]=_[_0x2237('0x26')](_0x34ef2e);var _0x25ce6e={'dateStart':_0x489106[_0x2237('0x27')][_0x2237('0x28')],'dateEnd':_0x489106[_0x2237('0x27')][_0x2237('0x29')]};delete _0x489106[_0x2237('0x27')][_0x2237('0x28')];delete _0x489106[_0x2237('0x27')][_0x2237('0x29')];_0x2835f1[_0x2237('0x27')]=_['keys'](_0x489106[_0x2237('0x27')]);_0x2835f1[_0x2237('0x2a')]=_[_0x2237('0x2b')](_0x2835f1[_0x2237('0x25')],_0x2835f1['query']);_0x4a3674['attributes']=_[_0x2237('0x2b')](_0x2835f1[_0x2237('0x25')],qs[_0x2237('0x2c')](_0x489106[_0x2237('0x27')][_0x2237('0x2c')]));_0x4a3674['attributes']=_0x4a3674[_0x2237('0x2d')][_0x2237('0x2e')]?_0x4a3674[_0x2237('0x2d')]:_0x2835f1[_0x2237('0x25')];if(!_0x489106[_0x2237('0x27')][_0x2237('0x2f')](_0x2237('0x30'))){_0x4a3674[_0x2237('0x31')]=qs[_0x2237('0x31')](_0x489106[_0x2237('0x27')][_0x2237('0x31')]);_0x4a3674[_0x2237('0x15')]=qs[_0x2237('0x15')](_0x489106[_0x2237('0x27')][_0x2237('0x15')]);}_0x4a3674[_0x2237('0x32')]=qs['sort'](_0x489106[_0x2237('0x27')]['sort']);_0x4a3674[_0x2237('0x33')]=qs[_0x2237('0x2a')](_['pick'](_0x489106[_0x2237('0x27')],_0x2835f1['filters']));if(_0x25ce6e['dateStart']){if(_0x25ce6e[_0x2237('0x29')]){_0x25ce6e[_0x2237('0x29')]=moment(_0x25ce6e[_0x2237('0x29')])['add'](0x1,_0x2237('0x34'));}else{_0x25ce6e[_0x2237('0x29')]=moment(_0x25ce6e['dateStart'])[_0x2237('0x35')](0x1,_0x2237('0x34'));}_[_0x2237('0x36')](_0x4a3674[_0x2237('0x33')],{'createdAt':{'$gte':_0x25ce6e[_0x2237('0x28')],'$lte':_0x25ce6e[_0x2237('0x29')]}});}if(_0x489106[_0x2237('0x27')][_0x2237('0x37')]){_0x4a3674[_0x2237('0x33')]=_[_0x2237('0x36')](_0x4a3674[_0x2237('0x33')],{'$or':_[_0x2237('0x38')](_0x4a3674[_0x2237('0x2d')],function(_0x53c161){var _0x3e97af={};_0x3e97af[_0x53c161]={'$like':'%'+_0x489106[_0x2237('0x27')][_0x2237('0x37')]+'%'};return _0x3e97af;})});}_0x4a3674=_['merge']({},_0x4a3674,_0x489106['options']);var _0x1def07={'where':_0x4a3674[_0x2237('0x33')]};return db[_0x2237('0x23')][_0x2237('0x39')](_0x1def07)[_0x2237('0x1d')](function(_0x305150){_0x294210['count']=_0x305150;if(_0x489106['query'][_0x2237('0x3a')]){_0x4a3674[_0x2237('0x3b')]=[{'all':!![]}];}return db[_0x2237('0x23')]['findAll'](_0x4a3674);})['then'](function(_0x3aaa56){_0x294210[_0x2237('0x3c')]=_0x3aaa56;return _0x294210;})[_0x2237('0x1d')](respondWithFilteredResult(_0x1a3b9e,_0x4a3674))[_0x2237('0x3d')](handleError(_0x1a3b9e,null));};exports[_0x2237('0x3e')]=function(_0x49e017,_0x1fb238){var _0x47b183={'raw':!![],'where':{'id':_0x49e017[_0x2237('0x3f')]['id']}},_0x259ee8={};_0x259ee8[_0x2237('0x25')]=_[_0x2237('0x26')](db[_0x2237('0x23')]['rawAttributes']);_0x259ee8['query']=_[_0x2237('0x26')](_0x49e017[_0x2237('0x27')]);_0x259ee8['filters']=_[_0x2237('0x2b')](_0x259ee8[_0x2237('0x25')],_0x259ee8[_0x2237('0x27')]);_0x47b183[_0x2237('0x2d')]=_[_0x2237('0x2b')](_0x259ee8['model'],qs['fields'](_0x49e017[_0x2237('0x27')][_0x2237('0x2c')]));_0x47b183['attributes']=_0x47b183['attributes']['length']?_0x47b183[_0x2237('0x2d')]:_0x259ee8[_0x2237('0x25')];if(_0x49e017[_0x2237('0x27')][_0x2237('0x3a')]){_0x47b183[_0x2237('0x3b')]=[{'all':!![]}];}_0x47b183=_[_0x2237('0x36')]({},_0x47b183,_0x49e017[_0x2237('0x40')]);return db[_0x2237('0x23')]['find'](_0x47b183)[_0x2237('0x1d')](handleEntityNotFound(_0x1fb238,null))[_0x2237('0x1d')](respondWithResult(_0x1fb238,null))[_0x2237('0x3d')](handleError(_0x1fb238,null));};exports[_0x2237('0x41')]=function(_0x2dcb57,_0x10d675){return db['SmsQueue']['create'](_0x2dcb57['body'],{})['then'](respondWithResult(_0x10d675,0xc9))[_0x2237('0x3d')](handleError(_0x10d675,null));};exports['update']=function(_0x2bdba3,_0x4a1cee){if(_0x2bdba3[_0x2237('0x42')]['id']){delete _0x2bdba3[_0x2237('0x42')]['id'];}return db[_0x2237('0x23')]['find']({'where':{'id':_0x2bdba3['params']['id']}})['then'](handleEntityNotFound(_0x4a1cee,null))['then'](saveUpdates(_0x2bdba3[_0x2237('0x42')],null))['then'](respondWithResult(_0x4a1cee,null))['catch'](handleError(_0x4a1cee,null));};exports[_0x2237('0x1c')]=function(_0x531487,_0xbfc999){return db[_0x2237('0x23')][_0x2237('0x43')]({'where':{'id':_0x531487['params']['id']}})[_0x2237('0x1d')](handleEntityNotFound(_0xbfc999,null))[_0x2237('0x1d')](removeEntity(_0xbfc999,null))[_0x2237('0x3d')](handleError(_0xbfc999,null));};exports[_0x2237('0x44')]=function(_0x211069,_0x3d778d){return db[_0x2237('0x23')][_0x2237('0x44')]()[_0x2237('0x1d')](respondWithResult(_0x3d778d,null))[_0x2237('0x3d')](handleError(_0x3d778d,null));};exports[_0x2237('0x45')]=function(_0x35fc5f,_0x1ce1cb,_0x3852b9){var _0xf33161={'raw':!![],'where':{}},_0x4f0d79={},_0x560ee1;return db[_0x2237('0x23')][_0x2237('0x46')]({'where':{'id':_0x35fc5f['params']['id']}})[_0x2237('0x1d')](handleEntityNotFound(_0x1ce1cb,null))[_0x2237('0x1d')](function(_0x2d103c){if(_0x2d103c){_0x560ee1=_0x2d103c[_0x2237('0x47')]({'plain':!![]});_0x4f0d79[_0x2237('0x25')]=_['keys'](db[_0x2237('0x48')][_0x2237('0x24')]);_0x4f0d79['query']=_['keys'](_0x35fc5f['query']);_0x4f0d79[_0x2237('0x2a')]=_[_0x2237('0x2b')](_0x4f0d79[_0x2237('0x25')],_0x4f0d79[_0x2237('0x27')]);_0xf33161[_0x2237('0x2d')]=_[_0x2237('0x2b')](_0x4f0d79[_0x2237('0x25')],qs[_0x2237('0x2c')](_0x35fc5f[_0x2237('0x27')][_0x2237('0x2c')]));_0xf33161['attributes']=_0xf33161['attributes'][_0x2237('0x2e')]?_0xf33161[_0x2237('0x2d')]:_0x4f0d79[_0x2237('0x25')];if(!_0x35fc5f['query'][_0x2237('0x2f')](_0x2237('0x30'))){_0xf33161[_0x2237('0x31')]=qs['limit'](_0x35fc5f['query'][_0x2237('0x31')]);_0xf33161['offset']=qs['offset'](_0x35fc5f['query'][_0x2237('0x15')]);}_0xf33161[_0x2237('0x32')]=qs[_0x2237('0x49')](_0x35fc5f['query'][_0x2237('0x49')]);_0xf33161[_0x2237('0x33')]=qs[_0x2237('0x2a')](_[_0x2237('0x4a')](_0x35fc5f[_0x2237('0x27')],_0x4f0d79[_0x2237('0x2a')]));_0xf33161[_0x2237('0x33')]['SmsQueueId']=_0x2d103c['id'];if(_0x35fc5f[_0x2237('0x27')][_0x2237('0x37')]){_0xf33161['where']=_[_0x2237('0x36')](_0xf33161[_0x2237('0x33')],{'$or':_['map'](_0xf33161[_0x2237('0x2d')],function(_0x5d732d){var _0x3d12af={};_0x3d12af[_0x5d732d]={'$like':'%'+_0x35fc5f['query'][_0x2237('0x37')]+'%'};return _0x3d12af;})});}_0xf33161=_[_0x2237('0x36')]({},_0xf33161,_0x35fc5f[_0x2237('0x40')]);return db[_0x2237('0x48')][_0x2237('0x4b')](_0xf33161);}})[_0x2237('0x1d')](function(_0x465940){if(_0x465940){return db[_0x2237('0x4c')][_0x2237('0x4d')]({'where':{'id':_[_0x2237('0x38')](_0x465940,'UserId'),'role':_0x2237('0x4e')},'attributes':['id',_0x2237('0x20'),_0x2237('0x4f'),'updatedAt','createdAt']});}})[_0x2237('0x1d')](function(_0x14dc78){if(_0x14dc78){return{'count':_0x14dc78[_0x2237('0x39')],'rows':_['map'](_0x14dc78[_0x2237('0x3c')],function(_0x3891c0){return{'membername':_0x3891c0[_0x2237('0x20')],'UserId':_0x3891c0['id'],'queue_name':_0x560ee1['name'],'SmsQueueId':_0x560ee1['id'],'interface':util[_0x2237('0x50')](_0x2237('0x51'),_0x2237('0x52'),_0x3891c0[_0x2237('0x20')]),'penalty':0x0,'paused':_0x3891c0['smsPause'],'createdAt':_0x3891c0['createdAt'],'updatedAt':_0x3891c0[_0x2237('0x53')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2237('0x1d')](respondWithFilteredResult(_0x1ce1cb,_0xf33161))['catch'](handleError(_0x1ce1cb,null));};exports[_0x2237('0x54')]=function(_0x23d8c4,_0x138056,_0x9b15ea){var _0x363ef7={};var _0x334642={};var _0x764eb3;var _0x32e27d;return db[_0x2237('0x23')][_0x2237('0x46')]({'where':{'id':_0x23d8c4[_0x2237('0x3f')]['id']}})[_0x2237('0x1d')](handleEntityNotFound(_0x138056,null))[_0x2237('0x1d')](function(_0x374910){if(_0x374910){_0x764eb3=_0x374910;_0x334642[_0x2237('0x25')]=_['keys'](db[_0x2237('0x55')][_0x2237('0x24')]);_0x334642['query']=_[_0x2237('0x26')](_0x23d8c4['query']);_0x334642['filters']=_[_0x2237('0x2b')](_0x334642[_0x2237('0x25')],_0x334642['query']);_0x363ef7[_0x2237('0x2d')]=_[_0x2237('0x2b')](_0x334642[_0x2237('0x25')],qs[_0x2237('0x2c')](_0x23d8c4[_0x2237('0x27')][_0x2237('0x2c')]));_0x363ef7[_0x2237('0x2d')]=_0x363ef7[_0x2237('0x2d')]['length']?_0x363ef7[_0x2237('0x2d')]:_0x334642[_0x2237('0x25')];_0x363ef7['order']=qs[_0x2237('0x49')](_0x23d8c4[_0x2237('0x27')][_0x2237('0x49')]);_0x363ef7[_0x2237('0x33')]=qs['filters'](_[_0x2237('0x4a')](_0x23d8c4[_0x2237('0x27')],_0x334642[_0x2237('0x2a')]));if(_0x23d8c4[_0x2237('0x27')][_0x2237('0x37')]){_0x363ef7[_0x2237('0x33')]=_['merge'](_0x363ef7[_0x2237('0x33')],{'$or':_[_0x2237('0x38')](_0x363ef7['attributes'],function(_0x15b1bb){var _0x2ec32e={};_0x2ec32e[_0x15b1bb]={'$like':'%'+_0x23d8c4[_0x2237('0x27')][_0x2237('0x37')]+'%'};return _0x2ec32e;})});}_0x363ef7=_[_0x2237('0x36')]({},_0x363ef7,_0x23d8c4[_0x2237('0x40')]);return _0x764eb3[_0x2237('0x54')](_0x363ef7);}})[_0x2237('0x1d')](function(_0x5c3405){if(_0x5c3405){_0x32e27d=_0x5c3405['length'];if(!_0x23d8c4[_0x2237('0x27')]['hasOwnProperty']('nolimit')){_0x363ef7[_0x2237('0x31')]=qs[_0x2237('0x31')](_0x23d8c4[_0x2237('0x27')][_0x2237('0x31')]);_0x363ef7[_0x2237('0x15')]=qs['offset'](_0x23d8c4[_0x2237('0x27')][_0x2237('0x15')]);}return _0x764eb3[_0x2237('0x54')](_0x363ef7);}})['then'](function(_0x584305){if(_0x584305){return _0x584305?{'count':_0x32e27d,'rows':_0x584305}:null;}})[_0x2237('0x1d')](respondWithResult(_0x138056,null))[_0x2237('0x3d')](handleError(_0x138056,null));};exports['addTeams']=function(_0x574fee,_0x1352ba,_0x62e4f5){var _0xd412e1=[];var _0x55d799;return db[_0x2237('0x55')]['findAll']({'where':{'id':_0x574fee['body'][_0x2237('0x56')]},'attributes':['id'],'include':[{'model':db[_0x2237('0x4c')],'as':_0x2237('0x57'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x5a2284){if(_0x5a2284){for(var _0xae9b81=0x0;_0xae9b81<_0x5a2284['length'];_0xae9b81+=0x1){for(var _0x45e115=0x0;_0x45e115<_0x5a2284[_0xae9b81][_0x2237('0x57')][_0x2237('0x2e')];_0x45e115+=0x1){_0xd412e1=_['union'](_0xd412e1,[_0x5a2284[_0xae9b81][_0x2237('0x57')][_0x45e115]['id']]);}}return _0xd412e1;}})[_0x2237('0x1d')](function(_0x11ffa3){if(_0x11ffa3){return db[_0x2237('0x23')]['find']({'where':{'id':_0x574fee[_0x2237('0x3f')]['id']}});}})[_0x2237('0x1d')](function(_0x36f165){if(_0x36f165){_0x55d799=_0x36f165;return _0x55d799[_0x2237('0x58')](_0xd412e1,{'penalty':_0x574fee[_0x2237('0x42')][_0x2237('0x59')]});}})[_0x2237('0x1d')](function(_0x14b873){if(_0x14b873){return _0x55d799[_0x2237('0x5a')](_0x574fee[_0x2237('0x42')]['ids']);}})[_0x2237('0x1d')](handleEntityNotFound(_0x1352ba,null))['then'](respondWithStatusCode(_0x1352ba,null))[_0x2237('0x3d')](handleError(_0x1352ba,null));};exports[_0x2237('0x5b')]=function(_0x48cdbe,_0x3a7c29,_0x1f05ce){var _0x216063=[];var _0x1bb893;return db[_0x2237('0x55')][_0x2237('0x4b')]({'where':{'id':_0x48cdbe['query'][_0x2237('0x56')]},'attributes':['id'],'include':[{'model':db[_0x2237('0x4c')],'as':_0x2237('0x57'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x232f31){if(_0x232f31){for(var _0x51aff4=0x0;_0x51aff4<_0x232f31[_0x2237('0x2e')];_0x51aff4+=0x1){for(var _0x59f7a1=0x0;_0x59f7a1<_0x232f31[_0x51aff4][_0x2237('0x57')]['length'];_0x59f7a1+=0x1){_0x216063=_['union'](_0x216063,[_0x232f31[_0x51aff4][_0x2237('0x57')][_0x59f7a1]['id']]);}}return _0x216063;}})[_0x2237('0x1d')](function(_0x2dfdfe){if(_0x2dfdfe){return db['SmsQueue'][_0x2237('0x43')]({'where':{'id':_0x48cdbe['params']['id']}});}})['then'](function(_0x403aa4){if(_0x403aa4){_0x1bb893=_0x403aa4;return _0x1bb893[_0x2237('0x5c')](_0x216063);}})[_0x2237('0x1d')](function(_0xa85646){if(_0x1bb893){return _0x1bb893[_0x2237('0x5b')](_0x48cdbe['query'][_0x2237('0x56')]);}})['then'](handleEntityNotFound(_0x3a7c29,null))[_0x2237('0x1d')](respondWithStatusCode(_0x3a7c29,null))[_0x2237('0x3d')](handleError(_0x3a7c29,null));};exports[_0x2237('0x58')]=function(_0x218005,_0x9f02c,_0x5138ea){return db[_0x2237('0x23')][_0x2237('0x43')]({'where':{'id':_0x218005[_0x2237('0x3f')]['id']}})['then'](handleEntityNotFound(_0x9f02c,null))['then'](function(_0x22c881){if(_0x22c881){return _0x22c881[_0x2237('0x58')](_0x218005['body']['ids'],_[_0x2237('0x5d')](_0x218005[_0x2237('0x42')],[_0x2237('0x56'),'id'])||{})['spread'](function(_0x2b7403){for(var _0x3d8a81=0x0;_0x3d8a81<_0x218005[_0x2237('0x42')][_0x2237('0x56')][_0x2237('0x2e')];_0x3d8a81+=0x1){socket[_0x2237('0x5e')](_0x2237('0x5f'),{'UserId':_0x218005['body'][_0x2237('0x56')][_0x3d8a81],'SmsQueueId':_0x218005[_0x2237('0x3f')]['id']});}return _0x2b7403;});}})['then'](respondWithResult(_0x9f02c,null))[_0x2237('0x3d')](handleError(_0x9f02c,null));};exports['removeAgents']=function(_0x594fdd,_0x47589d,_0x50f116){var _0x42193e;return db['SmsQueue']['find']({'where':{'id':_0x594fdd[_0x2237('0x3f')]['id']}})[_0x2237('0x1d')](handleEntityNotFound(_0x47589d,null))[_0x2237('0x1d')](function(_0x402b66){if(_0x402b66){return _0x402b66['removeAgents'](_0x594fdd[_0x2237('0x27')][_0x2237('0x56')])[_0x2237('0x1d')](function(_0x2fce13){if(_[_0x2237('0x60')](_0x594fdd['query']['ids'])){for(var _0x143bae=0x0;_0x143bae<_0x594fdd[_0x2237('0x27')][_0x2237('0x56')][_0x2237('0x2e')];_0x143bae+=0x1){socket[_0x2237('0x5e')](_0x2237('0x61'),{'UserId':_0x594fdd[_0x2237('0x27')][_0x2237('0x56')][_0x143bae],'SmsQueueId':_0x594fdd[_0x2237('0x3f')]['id']});}}else{socket[_0x2237('0x5e')](_0x2237('0x61'),{'UserId':_0x594fdd[_0x2237('0x27')][_0x2237('0x56')],'SmsQueueId':_0x594fdd['params']['id']});}});}})[_0x2237('0x1d')](respondWithStatusCode(_0x47589d,null))['catch'](handleError(_0x47589d,null));};exports[_0x2237('0x62')]=function(_0x4a5fd2,_0x40fc3f,_0x42730a){var _0x1f2d33={};var _0x2c454e={};var _0x3ebce2;var _0x588a43;return db['SmsQueue']['findOne']({'where':{'id':_0x4a5fd2[_0x2237('0x3f')]['id']}})[_0x2237('0x1d')](handleEntityNotFound(_0x40fc3f,null))['then'](function(_0x2c581d){if(_0x2c581d){_0x3ebce2=_0x2c581d;_0x2c454e['model']=_[_0x2237('0x26')](db[_0x2237('0x4c')][_0x2237('0x24')]);_0x2c454e[_0x2237('0x27')]=_[_0x2237('0x26')](_0x4a5fd2['query']);_0x2c454e[_0x2237('0x2a')]=_['intersection'](_0x2c454e[_0x2237('0x25')],_0x2c454e[_0x2237('0x27')]);_0x1f2d33[_0x2237('0x2d')]=_[_0x2237('0x2b')](_0x2c454e[_0x2237('0x25')],qs[_0x2237('0x2c')](_0x4a5fd2['query']['fields']));_0x1f2d33['attributes']=_0x1f2d33[_0x2237('0x2d')][_0x2237('0x2e')]?_0x1f2d33[_0x2237('0x2d')]:_0x2c454e['model'];_0x1f2d33[_0x2237('0x32')]=qs[_0x2237('0x49')](_0x4a5fd2[_0x2237('0x27')][_0x2237('0x49')]);_0x1f2d33[_0x2237('0x33')]=qs[_0x2237('0x2a')](_['pick'](_0x4a5fd2[_0x2237('0x27')],_0x2c454e[_0x2237('0x2a')]));if(_0x4a5fd2[_0x2237('0x27')][_0x2237('0x37')]){_0x1f2d33['where']=_[_0x2237('0x36')](_0x1f2d33['where'],{'$or':_[_0x2237('0x38')](_0x1f2d33[_0x2237('0x2d')],function(_0x316839){var _0x354a44={};_0x354a44[_0x316839]={'$like':'%'+_0x4a5fd2[_0x2237('0x27')][_0x2237('0x37')]+'%'};return _0x354a44;})});}_0x1f2d33=_[_0x2237('0x36')]({},_0x1f2d33,_0x4a5fd2[_0x2237('0x40')]);return _0x3ebce2[_0x2237('0x62')](_0x1f2d33);}})['then'](function(_0x1c60cd){if(_0x1c60cd){_0x588a43=_0x1c60cd[_0x2237('0x2e')];if(!_0x4a5fd2[_0x2237('0x27')]['hasOwnProperty'](_0x2237('0x30'))){_0x1f2d33[_0x2237('0x31')]=qs['limit'](_0x4a5fd2[_0x2237('0x27')]['limit']);_0x1f2d33[_0x2237('0x15')]=qs[_0x2237('0x15')](_0x4a5fd2[_0x2237('0x27')][_0x2237('0x15')]);}return _0x3ebce2[_0x2237('0x62')](_0x1f2d33);}})[_0x2237('0x1d')](function(_0x3d3736){if(_0x3d3736){return _0x3d3736?{'count':_0x588a43,'rows':_0x3d3736}:null;}})[_0x2237('0x1d')](respondWithResult(_0x40fc3f,null))[_0x2237('0x3d')](handleError(_0x40fc3f,null));}; \ No newline at end of file +var _0xab2a=['apply','reject','then','destroy','end','send','index','SmsQueue','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','add','where','filter','map','merge','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','get','UserSmsQueue','User','smsPause','name','format','%s/%s','SIP','createdAt','updatedAt','getTeams','findOne','Team','order','addTeams','ids','Agents','union','penalty','removeTeams','removeAgents','addAgents','omit','spread','userSmsQueue:save','isArray','emit','userSmsQueue:remove','getAgents','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','squel','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./smsQueue.socket','sendStatus','status','json','offset','limit','set'];(function(_0x1ed179,_0x3c0c52){var _0x5ad8c3=function(_0x2fd99b){while(--_0x2fd99b){_0x1ed179['push'](_0x1ed179['shift']());}};_0x5ad8c3(++_0x3c0c52);}(_0xab2a,0xa3));var _0xaab2=function(_0x2bc2dc,_0x5e211f){_0x2bc2dc=_0x2bc2dc-0x0;var _0xcc7be0=_0xab2a[_0x2bc2dc];return _0xcc7be0;};'use strict';var jsonpatch=require(_0xaab2('0x0'));var rp=require(_0xaab2('0x1'));var moment=require(_0xaab2('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaab2('0x3'));var path=require(_0xaab2('0x4'));var sox=require('sox');var csv=require(_0xaab2('0x5'));var ejs=require(_0xaab2('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xaab2('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaab2('0x8'));var Papa=require(_0xaab2('0x9'));var qs=require(_0xaab2('0xa'));var logger=require(_0xaab2('0xb'))('api');var utils=require('../../config/utils');var config=require(_0xaab2('0xc'));var db=require(_0xaab2('0xd'))['db'];var socket=require(_0xaab2('0xe'))({'host':_0xaab2('0xf'),'port':0x18eb});require(_0xaab2('0x10'))['register'](socket);function respondWithStatusCode(_0x2a6eb7,_0x207400){_0x207400=_0x207400||0xcc;return function(_0x240f04){if(_0x240f04){return _0x2a6eb7[_0xaab2('0x11')](_0x207400);}return _0x2a6eb7[_0xaab2('0x12')](_0x207400)['end']();};}function respondWithResult(_0x22e6b7,_0x4c4e80){_0x4c4e80=_0x4c4e80||0xc8;return function(_0x1e5d30){if(_0x1e5d30){return _0x22e6b7[_0xaab2('0x12')](_0x4c4e80)[_0xaab2('0x13')](_0x1e5d30);}};}function respondWithFilteredResult(_0x5377b9,_0x120e1e){return function(_0x25c925){if(_0x25c925){var _0x337a1b=_0x25c925['count'],_0x3711d2=_0x120e1e[_0xaab2('0x14')],_0x28f215=_0x120e1e[_0xaab2('0x14')]+_0x120e1e[_0xaab2('0x15')],_0x1e3216;if(_0x28f215>=_0x337a1b){_0x28f215=_0x337a1b;_0x1e3216=0xc8;}else{_0x1e3216=0xce;}_0x5377b9[_0xaab2('0x12')](_0x1e3216);return _0x5377b9[_0xaab2('0x16')]('Content-Range',_0x3711d2+'-'+_0x28f215+'/'+_0x337a1b)[_0xaab2('0x13')](_0x25c925);}return null;};}function patchUpdates(_0x41a502){return function(_0x566436){try{jsonpatch[_0xaab2('0x17')](_0x566436,_0x41a502,!![]);}catch(_0x5ef813){return BPromise[_0xaab2('0x18')](_0x5ef813);}return _0x566436['save']();};}function saveUpdates(_0x40ae43,_0x83ddcb){return function(_0x4e4f54){if(_0x4e4f54){return _0x4e4f54['update'](_0x40ae43)[_0xaab2('0x19')](function(_0x1b5c88){return _0x1b5c88;});}return null;};}function removeEntity(_0x2540e0,_0x24aee9){return function(_0x43d2c9){if(_0x43d2c9){return _0x43d2c9[_0xaab2('0x1a')]()[_0xaab2('0x19')](function(){_0x2540e0[_0xaab2('0x12')](0xcc)[_0xaab2('0x1b')]();});}};}function handleEntityNotFound(_0x31b696,_0x517660){return function(_0x55a297){if(!_0x55a297){_0x31b696[_0xaab2('0x11')](0x194);}return _0x55a297;};}function handleError(_0x3a5da5,_0x49bf4d){_0x49bf4d=_0x49bf4d||0x1f4;return function(_0xdb3256){logger['error'](_0xdb3256['stack']);if(_0xdb3256['name']){delete _0xdb3256['name'];}_0x3a5da5[_0xaab2('0x12')](_0x49bf4d)[_0xaab2('0x1c')](_0xdb3256);};}exports[_0xaab2('0x1d')]=function(_0x301fbd,_0x106b3a){var _0x25de81={},_0x32fd23={},_0x4df9ff={'count':0x0,'rows':[]};var _0x2c037f=db[_0xaab2('0x1e')]['rawAttributes'];_0x32fd23[_0xaab2('0x1f')]=_[_0xaab2('0x20')](_0x2c037f);var _0x51f8a7={'dateStart':_0x301fbd[_0xaab2('0x21')][_0xaab2('0x22')],'dateEnd':_0x301fbd[_0xaab2('0x21')]['dateEnd']};delete _0x301fbd['query'][_0xaab2('0x22')];delete _0x301fbd[_0xaab2('0x21')][_0xaab2('0x23')];_0x32fd23['query']=_['keys'](_0x301fbd['query']);_0x32fd23[_0xaab2('0x24')]=_[_0xaab2('0x25')](_0x32fd23[_0xaab2('0x1f')],_0x32fd23[_0xaab2('0x21')]);_0x25de81[_0xaab2('0x26')]=_[_0xaab2('0x25')](_0x32fd23[_0xaab2('0x1f')],qs[_0xaab2('0x27')](_0x301fbd[_0xaab2('0x21')]['fields']));_0x25de81[_0xaab2('0x26')]=_0x25de81['attributes'][_0xaab2('0x28')]?_0x25de81[_0xaab2('0x26')]:_0x32fd23['model'];if(!_0x301fbd['query'][_0xaab2('0x29')](_0xaab2('0x2a'))){_0x25de81[_0xaab2('0x15')]=qs[_0xaab2('0x15')](_0x301fbd[_0xaab2('0x21')][_0xaab2('0x15')]);_0x25de81[_0xaab2('0x14')]=qs['offset'](_0x301fbd['query'][_0xaab2('0x14')]);}_0x25de81['order']=qs['sort'](_0x301fbd[_0xaab2('0x21')][_0xaab2('0x2b')]);_0x25de81['where']=qs['filters'](_[_0xaab2('0x2c')](_0x301fbd[_0xaab2('0x21')],_0x32fd23[_0xaab2('0x24')]));if(_0x51f8a7[_0xaab2('0x22')]){if(_0x51f8a7[_0xaab2('0x23')]){_0x51f8a7[_0xaab2('0x23')]=moment(_0x51f8a7['dateEnd'])['add'](0x1,'day');}else{_0x51f8a7['dateEnd']=moment(_0x51f8a7['dateStart'])[_0xaab2('0x2d')](0x1,'day');}_['merge'](_0x25de81[_0xaab2('0x2e')],{'createdAt':{'$gte':_0x51f8a7[_0xaab2('0x22')],'$lte':_0x51f8a7[_0xaab2('0x23')]}});}if(_0x301fbd[_0xaab2('0x21')][_0xaab2('0x2f')]){_0x25de81['where']=_['merge'](_0x25de81[_0xaab2('0x2e')],{'$or':_[_0xaab2('0x30')](_0x25de81[_0xaab2('0x26')],function(_0x2eeae9){var _0x3bd55f={};_0x3bd55f[_0x2eeae9]={'$like':'%'+_0x301fbd[_0xaab2('0x21')][_0xaab2('0x2f')]+'%'};return _0x3bd55f;})});}_0x25de81=_[_0xaab2('0x31')]({},_0x25de81,_0x301fbd[_0xaab2('0x32')]);var _0x4a3d94={'where':_0x25de81[_0xaab2('0x2e')]};return db[_0xaab2('0x1e')]['count'](_0x4a3d94)[_0xaab2('0x19')](function(_0x4d21b9){_0x4df9ff[_0xaab2('0x33')]=_0x4d21b9;if(_0x301fbd[_0xaab2('0x21')][_0xaab2('0x34')]){_0x25de81[_0xaab2('0x35')]=[{'all':!![]}];}return db[_0xaab2('0x1e')][_0xaab2('0x36')](_0x25de81);})['then'](function(_0x252193){_0x4df9ff[_0xaab2('0x37')]=_0x252193;return _0x4df9ff;})[_0xaab2('0x19')](respondWithFilteredResult(_0x106b3a,_0x25de81))[_0xaab2('0x38')](handleError(_0x106b3a,null));};exports[_0xaab2('0x39')]=function(_0x1f0dc7,_0x1c392c){var _0x2055f={'raw':!![],'where':{'id':_0x1f0dc7[_0xaab2('0x3a')]['id']}},_0x41717f={};_0x41717f[_0xaab2('0x1f')]=_['keys'](db['SmsQueue'][_0xaab2('0x3b')]);_0x41717f['query']=_[_0xaab2('0x20')](_0x1f0dc7[_0xaab2('0x21')]);_0x41717f['filters']=_['intersection'](_0x41717f['model'],_0x41717f['query']);_0x2055f[_0xaab2('0x26')]=_[_0xaab2('0x25')](_0x41717f[_0xaab2('0x1f')],qs['fields'](_0x1f0dc7[_0xaab2('0x21')][_0xaab2('0x27')]));_0x2055f[_0xaab2('0x26')]=_0x2055f[_0xaab2('0x26')]['length']?_0x2055f[_0xaab2('0x26')]:_0x41717f[_0xaab2('0x1f')];if(_0x1f0dc7[_0xaab2('0x21')]['includeAll']){_0x2055f[_0xaab2('0x35')]=[{'all':!![]}];}_0x2055f=_[_0xaab2('0x31')]({},_0x2055f,_0x1f0dc7[_0xaab2('0x32')]);return db[_0xaab2('0x1e')][_0xaab2('0x3c')](_0x2055f)[_0xaab2('0x19')](handleEntityNotFound(_0x1c392c,null))[_0xaab2('0x19')](respondWithResult(_0x1c392c,null))[_0xaab2('0x38')](handleError(_0x1c392c,null));};exports[_0xaab2('0x3d')]=function(_0x3af6cb,_0x10104e){return db[_0xaab2('0x1e')][_0xaab2('0x3d')](_0x3af6cb[_0xaab2('0x3e')],{})[_0xaab2('0x19')](respondWithResult(_0x10104e,0xc9))[_0xaab2('0x38')](handleError(_0x10104e,null));};exports['update']=function(_0x2302cd,_0x43d08a){if(_0x2302cd[_0xaab2('0x3e')]['id']){delete _0x2302cd[_0xaab2('0x3e')]['id'];}return db[_0xaab2('0x1e')][_0xaab2('0x3c')]({'where':{'id':_0x2302cd['params']['id']}})[_0xaab2('0x19')](handleEntityNotFound(_0x43d08a,null))[_0xaab2('0x19')](saveUpdates(_0x2302cd[_0xaab2('0x3e')],null))[_0xaab2('0x19')](respondWithResult(_0x43d08a,null))[_0xaab2('0x38')](handleError(_0x43d08a,null));};exports[_0xaab2('0x1a')]=function(_0x3aeb34,_0x10569c){return db['SmsQueue'][_0xaab2('0x3c')]({'where':{'id':_0x3aeb34[_0xaab2('0x3a')]['id']}})[_0xaab2('0x19')](handleEntityNotFound(_0x10569c,null))['then'](removeEntity(_0x10569c,null))[_0xaab2('0x38')](handleError(_0x10569c,null));};exports[_0xaab2('0x3f')]=function(_0x1a0bee,_0x2ea498){return db[_0xaab2('0x1e')][_0xaab2('0x3f')]()[_0xaab2('0x19')](respondWithResult(_0x2ea498,null))[_0xaab2('0x38')](handleError(_0x2ea498,null));};exports['getMembers']=function(_0x329593,_0x4746f5,_0x1b539a){var _0x3c621d={'raw':!![],'where':{}},_0x49df60={},_0x13b2e9;return db[_0xaab2('0x1e')]['findOne']({'where':{'id':_0x329593[_0xaab2('0x3a')]['id']}})[_0xaab2('0x19')](handleEntityNotFound(_0x4746f5,null))[_0xaab2('0x19')](function(_0x5a1632){if(_0x5a1632){_0x13b2e9=_0x5a1632[_0xaab2('0x40')]({'plain':!![]});_0x49df60[_0xaab2('0x1f')]=_[_0xaab2('0x20')](db['UserSmsQueue'][_0xaab2('0x3b')]);_0x49df60['query']=_['keys'](_0x329593['query']);_0x49df60[_0xaab2('0x24')]=_['intersection'](_0x49df60['model'],_0x49df60[_0xaab2('0x21')]);_0x3c621d['attributes']=_[_0xaab2('0x25')](_0x49df60[_0xaab2('0x1f')],qs[_0xaab2('0x27')](_0x329593[_0xaab2('0x21')]['fields']));_0x3c621d[_0xaab2('0x26')]=_0x3c621d[_0xaab2('0x26')][_0xaab2('0x28')]?_0x3c621d[_0xaab2('0x26')]:_0x49df60[_0xaab2('0x1f')];if(!_0x329593['query'][_0xaab2('0x29')]('nolimit')){_0x3c621d[_0xaab2('0x15')]=qs[_0xaab2('0x15')](_0x329593[_0xaab2('0x21')]['limit']);_0x3c621d['offset']=qs['offset'](_0x329593[_0xaab2('0x21')]['offset']);}_0x3c621d['order']=qs[_0xaab2('0x2b')](_0x329593[_0xaab2('0x21')][_0xaab2('0x2b')]);_0x3c621d[_0xaab2('0x2e')]=qs[_0xaab2('0x24')](_[_0xaab2('0x2c')](_0x329593[_0xaab2('0x21')],_0x49df60[_0xaab2('0x24')]));_0x3c621d[_0xaab2('0x2e')]['SmsQueueId']=_0x5a1632['id'];if(_0x329593[_0xaab2('0x21')]['filter']){_0x3c621d['where']=_[_0xaab2('0x31')](_0x3c621d['where'],{'$or':_[_0xaab2('0x30')](_0x3c621d['attributes'],function(_0xc5231e){var _0x438074={};_0x438074[_0xc5231e]={'$like':'%'+_0x329593[_0xaab2('0x21')][_0xaab2('0x2f')]+'%'};return _0x438074;})});}_0x3c621d=_[_0xaab2('0x31')]({},_0x3c621d,_0x329593['options']);return db[_0xaab2('0x41')]['findAll'](_0x3c621d);}})[_0xaab2('0x19')](function(_0x2d83bc){if(_0x2d83bc){return db[_0xaab2('0x42')]['findAndCountAll']({'where':{'id':_[_0xaab2('0x30')](_0x2d83bc,'UserId'),'role':'agent'},'attributes':['id','name',_0xaab2('0x43'),'updatedAt','createdAt']});}})[_0xaab2('0x19')](function(_0x4d2c3e){if(_0x4d2c3e){return{'count':_0x4d2c3e[_0xaab2('0x33')],'rows':_[_0xaab2('0x30')](_0x4d2c3e[_0xaab2('0x37')],function(_0x414aff){return{'membername':_0x414aff[_0xaab2('0x44')],'UserId':_0x414aff['id'],'queue_name':_0x13b2e9[_0xaab2('0x44')],'SmsQueueId':_0x13b2e9['id'],'interface':util[_0xaab2('0x45')](_0xaab2('0x46'),_0xaab2('0x47'),_0x414aff[_0xaab2('0x44')]),'penalty':0x0,'paused':_0x414aff[_0xaab2('0x43')],'createdAt':_0x414aff[_0xaab2('0x48')],'updatedAt':_0x414aff[_0xaab2('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4746f5,_0x3c621d))['catch'](handleError(_0x4746f5,null));};exports[_0xaab2('0x4a')]=function(_0x11e69f,_0x59c594,_0x245ce5){var _0x4dac02={};var _0x561295={};var _0x3b149d;var _0x484350;return db[_0xaab2('0x1e')][_0xaab2('0x4b')]({'where':{'id':_0x11e69f[_0xaab2('0x3a')]['id']}})['then'](handleEntityNotFound(_0x59c594,null))[_0xaab2('0x19')](function(_0x1a3463){if(_0x1a3463){_0x3b149d=_0x1a3463;_0x561295[_0xaab2('0x1f')]=_[_0xaab2('0x20')](db[_0xaab2('0x4c')][_0xaab2('0x3b')]);_0x561295[_0xaab2('0x21')]=_[_0xaab2('0x20')](_0x11e69f[_0xaab2('0x21')]);_0x561295[_0xaab2('0x24')]=_[_0xaab2('0x25')](_0x561295['model'],_0x561295[_0xaab2('0x21')]);_0x4dac02[_0xaab2('0x26')]=_[_0xaab2('0x25')](_0x561295[_0xaab2('0x1f')],qs[_0xaab2('0x27')](_0x11e69f[_0xaab2('0x21')][_0xaab2('0x27')]));_0x4dac02[_0xaab2('0x26')]=_0x4dac02[_0xaab2('0x26')][_0xaab2('0x28')]?_0x4dac02[_0xaab2('0x26')]:_0x561295[_0xaab2('0x1f')];_0x4dac02[_0xaab2('0x4d')]=qs[_0xaab2('0x2b')](_0x11e69f[_0xaab2('0x21')][_0xaab2('0x2b')]);_0x4dac02['where']=qs[_0xaab2('0x24')](_[_0xaab2('0x2c')](_0x11e69f[_0xaab2('0x21')],_0x561295[_0xaab2('0x24')]));if(_0x11e69f[_0xaab2('0x21')][_0xaab2('0x2f')]){_0x4dac02[_0xaab2('0x2e')]=_[_0xaab2('0x31')](_0x4dac02['where'],{'$or':_['map'](_0x4dac02['attributes'],function(_0x3fcf61){var _0x1f923a={};_0x1f923a[_0x3fcf61]={'$like':'%'+_0x11e69f[_0xaab2('0x21')][_0xaab2('0x2f')]+'%'};return _0x1f923a;})});}_0x4dac02=_[_0xaab2('0x31')]({},_0x4dac02,_0x11e69f[_0xaab2('0x32')]);return _0x3b149d[_0xaab2('0x4a')](_0x4dac02);}})[_0xaab2('0x19')](function(_0x39404e){if(_0x39404e){_0x484350=_0x39404e[_0xaab2('0x28')];if(!_0x11e69f[_0xaab2('0x21')]['hasOwnProperty'](_0xaab2('0x2a'))){_0x4dac02[_0xaab2('0x15')]=qs[_0xaab2('0x15')](_0x11e69f[_0xaab2('0x21')][_0xaab2('0x15')]);_0x4dac02[_0xaab2('0x14')]=qs[_0xaab2('0x14')](_0x11e69f[_0xaab2('0x21')][_0xaab2('0x14')]);}return _0x3b149d[_0xaab2('0x4a')](_0x4dac02);}})[_0xaab2('0x19')](function(_0x4ef94b){if(_0x4ef94b){return _0x4ef94b?{'count':_0x484350,'rows':_0x4ef94b}:null;}})['then'](respondWithResult(_0x59c594,null))[_0xaab2('0x38')](handleError(_0x59c594,null));};exports[_0xaab2('0x4e')]=function(_0x162968,_0x44423f,_0x13bcee){var _0xc35f7=[];var _0x32bfc4;return db[_0xaab2('0x4c')]['findAll']({'where':{'id':_0x162968[_0xaab2('0x3e')][_0xaab2('0x4f')]},'attributes':['id'],'include':[{'model':db[_0xaab2('0x42')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xaab2('0x19')](function(_0x3be9c2){if(_0x3be9c2){for(var _0x1a007d=0x0;_0x1a007d<_0x3be9c2[_0xaab2('0x28')];_0x1a007d+=0x1){for(var _0x5d9609=0x0;_0x5d9609<_0x3be9c2[_0x1a007d][_0xaab2('0x50')][_0xaab2('0x28')];_0x5d9609+=0x1){_0xc35f7=_[_0xaab2('0x51')](_0xc35f7,[_0x3be9c2[_0x1a007d][_0xaab2('0x50')][_0x5d9609]['id']]);}}return _0xc35f7;}})[_0xaab2('0x19')](function(_0x5d6ad5){if(_0x5d6ad5){return db[_0xaab2('0x1e')][_0xaab2('0x3c')]({'where':{'id':_0x162968[_0xaab2('0x3a')]['id']}});}})[_0xaab2('0x19')](function(_0x316831){if(_0x316831){_0x32bfc4=_0x316831;return _0x32bfc4['addAgents'](_0xc35f7,{'penalty':_0x162968[_0xaab2('0x3e')][_0xaab2('0x52')]});}})[_0xaab2('0x19')](function(_0x4fb997){if(_0x4fb997){return _0x32bfc4[_0xaab2('0x4e')](_0x162968[_0xaab2('0x3e')]['ids']);}})[_0xaab2('0x19')](handleEntityNotFound(_0x44423f,null))[_0xaab2('0x19')](respondWithStatusCode(_0x44423f,null))[_0xaab2('0x38')](handleError(_0x44423f,null));};exports[_0xaab2('0x53')]=function(_0x487d24,_0x336cdd,_0x5d1c3d){var _0x3b0327=[];var _0x43cb0b;return db[_0xaab2('0x4c')]['findAll']({'where':{'id':_0x487d24[_0xaab2('0x21')][_0xaab2('0x4f')]},'attributes':['id'],'include':[{'model':db[_0xaab2('0x42')],'as':_0xaab2('0x50'),'attributes':['id'],'raw':!![]}]})[_0xaab2('0x19')](function(_0x4e95ae){if(_0x4e95ae){for(var _0x584129=0x0;_0x584129<_0x4e95ae[_0xaab2('0x28')];_0x584129+=0x1){for(var _0x5011ec=0x0;_0x5011ec<_0x4e95ae[_0x584129]['Agents'][_0xaab2('0x28')];_0x5011ec+=0x1){_0x3b0327=_[_0xaab2('0x51')](_0x3b0327,[_0x4e95ae[_0x584129][_0xaab2('0x50')][_0x5011ec]['id']]);}}return _0x3b0327;}})[_0xaab2('0x19')](function(_0x77ee3){if(_0x77ee3){return db[_0xaab2('0x1e')][_0xaab2('0x3c')]({'where':{'id':_0x487d24[_0xaab2('0x3a')]['id']}});}})['then'](function(_0x5243c5){if(_0x5243c5){_0x43cb0b=_0x5243c5;return _0x43cb0b[_0xaab2('0x54')](_0x3b0327);}})[_0xaab2('0x19')](function(_0x282784){if(_0x43cb0b){return _0x43cb0b[_0xaab2('0x53')](_0x487d24[_0xaab2('0x21')][_0xaab2('0x4f')]);}})[_0xaab2('0x19')](handleEntityNotFound(_0x336cdd,null))[_0xaab2('0x19')](respondWithStatusCode(_0x336cdd,null))[_0xaab2('0x38')](handleError(_0x336cdd,null));};exports[_0xaab2('0x55')]=function(_0x267221,_0x5004b5,_0x4d2411){return db[_0xaab2('0x1e')][_0xaab2('0x3c')]({'where':{'id':_0x267221[_0xaab2('0x3a')]['id']}})['then'](handleEntityNotFound(_0x5004b5,null))[_0xaab2('0x19')](function(_0x9ff840){if(_0x9ff840){return _0x9ff840[_0xaab2('0x55')](_0x267221[_0xaab2('0x3e')][_0xaab2('0x4f')],_[_0xaab2('0x56')](_0x267221['body'],[_0xaab2('0x4f'),'id'])||{})[_0xaab2('0x57')](function(_0x43d655){for(var _0x155dbe=0x0;_0x155dbe<_0x267221[_0xaab2('0x3e')][_0xaab2('0x4f')]['length'];_0x155dbe+=0x1){socket['emit'](_0xaab2('0x58'),{'UserId':_0x267221[_0xaab2('0x3e')][_0xaab2('0x4f')][_0x155dbe],'SmsQueueId':_0x267221[_0xaab2('0x3a')]['id']});}return _0x43d655;});}})[_0xaab2('0x19')](respondWithResult(_0x5004b5,null))[_0xaab2('0x38')](handleError(_0x5004b5,null));};exports['removeAgents']=function(_0x55b7e6,_0x108cff,_0x33204f){var _0x182dc4;return db['SmsQueue']['find']({'where':{'id':_0x55b7e6[_0xaab2('0x3a')]['id']}})[_0xaab2('0x19')](handleEntityNotFound(_0x108cff,null))[_0xaab2('0x19')](function(_0x3edd34){if(_0x3edd34){return _0x3edd34['removeAgents'](_0x55b7e6['query'][_0xaab2('0x4f')])['then'](function(_0x59afad){if(_[_0xaab2('0x59')](_0x55b7e6['query'][_0xaab2('0x4f')])){for(var _0x24dd5a=0x0;_0x24dd5a<_0x55b7e6['query']['ids'][_0xaab2('0x28')];_0x24dd5a+=0x1){socket[_0xaab2('0x5a')](_0xaab2('0x5b'),{'UserId':_0x55b7e6[_0xaab2('0x21')][_0xaab2('0x4f')][_0x24dd5a],'SmsQueueId':_0x55b7e6[_0xaab2('0x3a')]['id']});}}else{socket[_0xaab2('0x5a')](_0xaab2('0x5b'),{'UserId':_0x55b7e6['query'][_0xaab2('0x4f')],'SmsQueueId':_0x55b7e6[_0xaab2('0x3a')]['id']});}});}})['then'](respondWithStatusCode(_0x108cff,null))['catch'](handleError(_0x108cff,null));};exports['getAgents']=function(_0x561181,_0x1534ce,_0x531da2){var _0x583fb7={};var _0x504a58={};var _0xed789d;var _0x4880ac;return db['SmsQueue'][_0xaab2('0x4b')]({'where':{'id':_0x561181[_0xaab2('0x3a')]['id']}})[_0xaab2('0x19')](handleEntityNotFound(_0x1534ce,null))[_0xaab2('0x19')](function(_0x1d8feb){if(_0x1d8feb){_0xed789d=_0x1d8feb;_0x504a58[_0xaab2('0x1f')]=_[_0xaab2('0x20')](db[_0xaab2('0x42')]['rawAttributes']);_0x504a58[_0xaab2('0x21')]=_['keys'](_0x561181['query']);_0x504a58['filters']=_['intersection'](_0x504a58['model'],_0x504a58[_0xaab2('0x21')]);_0x583fb7[_0xaab2('0x26')]=_[_0xaab2('0x25')](_0x504a58[_0xaab2('0x1f')],qs[_0xaab2('0x27')](_0x561181[_0xaab2('0x21')][_0xaab2('0x27')]));_0x583fb7[_0xaab2('0x26')]=_0x583fb7['attributes'][_0xaab2('0x28')]?_0x583fb7['attributes']:_0x504a58[_0xaab2('0x1f')];_0x583fb7[_0xaab2('0x4d')]=qs[_0xaab2('0x2b')](_0x561181[_0xaab2('0x21')][_0xaab2('0x2b')]);_0x583fb7['where']=qs['filters'](_[_0xaab2('0x2c')](_0x561181[_0xaab2('0x21')],_0x504a58[_0xaab2('0x24')]));if(_0x561181[_0xaab2('0x21')][_0xaab2('0x2f')]){_0x583fb7[_0xaab2('0x2e')]=_[_0xaab2('0x31')](_0x583fb7[_0xaab2('0x2e')],{'$or':_['map'](_0x583fb7[_0xaab2('0x26')],function(_0x56111a){var _0x398b52={};_0x398b52[_0x56111a]={'$like':'%'+_0x561181[_0xaab2('0x21')][_0xaab2('0x2f')]+'%'};return _0x398b52;})});}_0x583fb7=_[_0xaab2('0x31')]({},_0x583fb7,_0x561181[_0xaab2('0x32')]);return _0xed789d[_0xaab2('0x5c')](_0x583fb7);}})[_0xaab2('0x19')](function(_0xd98478){if(_0xd98478){_0x4880ac=_0xd98478[_0xaab2('0x28')];if(!_0x561181[_0xaab2('0x21')]['hasOwnProperty'](_0xaab2('0x2a'))){_0x583fb7[_0xaab2('0x15')]=qs[_0xaab2('0x15')](_0x561181['query']['limit']);_0x583fb7[_0xaab2('0x14')]=qs['offset'](_0x561181[_0xaab2('0x21')][_0xaab2('0x14')]);}return _0xed789d[_0xaab2('0x5c')](_0x583fb7);}})['then'](function(_0x32590e){if(_0x32590e){return _0x32590e?{'count':_0x4880ac,'rows':_0x32590e}:null;}})[_0xaab2('0x19')](respondWithResult(_0x1534ce,null))[_0xaab2('0x38')](handleError(_0x1534ce,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 19fe877..4cba88c 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 _0x7344=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xb39e3b,_0x2be5df){var _0x40515c=function(_0x58e386){while(--_0x58e386){_0xb39e3b['push'](_0xb39e3b['shift']());}};_0x40515c(++_0x2be5df);}(_0x7344,0xa9));var _0x4734=function(_0x100ee1,_0x15902f){_0x100ee1=_0x100ee1-0x0;var _0x299059=_0x7344[_0x100ee1];return _0x299059;};'use strict';var EventEmitter=require(_0x4734('0x0'));var SmsQueue=require(_0x4734('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x4734('0x2')](0x0);var events={'afterCreate':_0x4734('0x3'),'afterUpdate':_0x4734('0x4'),'afterDestroy':_0x4734('0x5')};function emitEvent(_0x215247){return function(_0x4fd288,_0x453455,_0x1b906d){SmsQueueEvents['emit'](_0x215247+':'+_0x4fd288['id'],_0x4fd288);SmsQueueEvents[_0x4734('0x6')](_0x215247,_0x4fd288);_0x1b906d(null);};}for(var e in events){if(events[_0x4734('0x7')](e)){var event=events[e];SmsQueue[_0x4734('0x8')](e,emitEvent(event));}}module[_0x4734('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x23a3=['exports','events','../../mysqldb','SmsQueue','update','remove','emit','hasOwnProperty'];(function(_0x134cf1,_0xfbac51){var _0x664486=function(_0xeabdd3){while(--_0xeabdd3){_0x134cf1['push'](_0x134cf1['shift']());}};_0x664486(++_0xfbac51);}(_0x23a3,0x159));var _0x323a=function(_0x404064,_0x5382a8){_0x404064=_0x404064-0x0;var _0x5e2835=_0x23a3[_0x404064];return _0x5e2835;};'use strict';var EventEmitter=require(_0x323a('0x0'));var SmsQueue=require(_0x323a('0x1'))['db'][_0x323a('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x323a('0x3'),'afterDestroy':_0x323a('0x4')};function emitEvent(_0x5a095a){return function(_0x40f357,_0x2db5e4,_0x5b81){SmsQueueEvents[_0x323a('0x5')](_0x5a095a+':'+_0x40f357['id'],_0x40f357);SmsQueueEvents[_0x323a('0x5')](_0x5a095a,_0x40f357);_0x5b81(null);};}for(var e in events){if(events[_0x323a('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x323a('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 9e9e678..8bb9bdf 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 _0xaa46=['util','../../config/logger','moment','bluebird','request-promise','./smsQueue.attributes','define','SmsQueue','lodash'];(function(_0x4cae10,_0x1598f4){var _0x20527a=function(_0x35737f){while(--_0x35737f){_0x4cae10['push'](_0x4cae10['shift']());}};_0x20527a(++_0x1598f4);}(_0xaa46,0x86));var _0x6aa4=function(_0x2ae9ab,_0x54da0a){_0x2ae9ab=_0x2ae9ab-0x0;var _0x5579e1=_0xaa46[_0x2ae9ab];return _0x5579e1;};'use strict';var _=require(_0x6aa4('0x0'));var util=require(_0x6aa4('0x1'));var logger=require(_0x6aa4('0x2'))('api');var moment=require(_0x6aa4('0x3'));var BPromise=require(_0x6aa4('0x4'));var rp=require(_0x6aa4('0x5'));var attributes=require(_0x6aa4('0x6'));module['exports']=function(_0x565db6,_0x4d5dc8){return _0x565db6[_0x6aa4('0x7')](_0x6aa4('0x8'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9822=['define','util','../../config/logger','api','moment','bluebird','request-promise','./smsQueue.attributes','exports'];(function(_0x366353,_0x3d484){var _0x30e267=function(_0xa2b3ca){while(--_0xa2b3ca){_0x366353['push'](_0x366353['shift']());}};_0x30e267(++_0x3d484);}(_0x9822,0x1de));var _0x2982=function(_0x3fce02,_0x472e6a){_0x3fce02=_0x3fce02-0x0;var _0x14e517=_0x9822[_0x3fce02];return _0x14e517;};'use strict';var _=require('lodash');var util=require(_0x2982('0x0'));var logger=require(_0x2982('0x1'))(_0x2982('0x2'));var moment=require(_0x2982('0x3'));var BPromise=require(_0x2982('0x4'));var rp=require(_0x2982('0x5'));var attributes=require(_0x2982('0x6'));module[_0x2982('0x7')]=function(_0x48891b,_0x5d6342){return _0x48891b[_0x2982('0x8')]('SmsQueue',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 fbbda0a..b2bdd67 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 _0xe8f3=['attributes','info','GetSmsQueue','ShowSmsQueue','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','socket.io-emitter','localhost','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsQueue','raw','options','where','limit','include','map','model'];(function(_0x21c550,_0x4e6312){var _0x32a419=function(_0x442d71){while(--_0x442d71){_0x21c550['push'](_0x21c550['shift']());}};_0x32a419(++_0x4e6312);}(_0xe8f3,0x185));var _0x3e8f=function(_0x236d0d,_0x285c99){_0x236d0d=_0x236d0d-0x0;var _0x443710=_0xe8f3[_0x236d0d];return _0x443710;};'use strict';var _=require('lodash');var util=require(_0x3e8f('0x0'));var moment=require(_0x3e8f('0x1'));var BPromise=require(_0x3e8f('0x2'));var rs=require(_0x3e8f('0x3'));var fs=require('fs');var db=require(_0x3e8f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e8f('0x5'))(_0x3e8f('0x6'));var config=require(_0x3e8f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3e8f('0x8')]({'port':0x232a});var socket=require(_0x3e8f('0x9'))({'host':_0x3e8f('0xa'),'port':0x18eb});require('./smsQueue.socket')['register'](socket);function respondWithRpcPromise(_0x51baba,_0x296726,_0x16b62b){return new BPromise(function(_0x5a19b6,_0x3141b5){return client[_0x3e8f('0xb')](_0x51baba,_0x16b62b)[_0x3e8f('0xc')](function(_0x36fd10){logger['info'](_0x3e8f('0xd'),_0x296726,_0x3e8f('0xe'));logger[_0x3e8f('0xf')](_0x3e8f('0x10'),_0x296726,_0x3e8f('0xe'),JSON[_0x3e8f('0x11')](_0x36fd10));if(_0x36fd10[_0x3e8f('0x12')]){if(_0x36fd10['error'][_0x3e8f('0x13')]===0x1f4){logger[_0x3e8f('0x12')]('SmsQueue,\x20%s,\x20%s',_0x296726,_0x36fd10[_0x3e8f('0x12')][_0x3e8f('0x14')]);return _0x3141b5(_0x36fd10['error'][_0x3e8f('0x14')]);}logger['error'](_0x3e8f('0xd'),_0x296726,_0x36fd10['error'][_0x3e8f('0x14')]);return _0x5a19b6(_0x36fd10[_0x3e8f('0x12')][_0x3e8f('0x14')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x296726,_0x3e8f('0xe'));_0x5a19b6(_0x36fd10[_0x3e8f('0x15')][_0x3e8f('0x14')]);}})[_0x3e8f('0x16')](function(_0x10942a){logger[_0x3e8f('0x12')](_0x3e8f('0xd'),_0x296726,_0x10942a);_0x3141b5(_0x10942a);});});}exports['GetSmsQueue']=function(_0x1630a1){var _0x3395ad=this;return new Promise(function(_0x5ec6fa,_0xb4306e){return db[_0x3e8f('0x17')]['findAll']({'raw':_0x1630a1['options']?_0x1630a1['options'][_0x3e8f('0x18')]===undefined?!![]:![]:!![],'where':_0x1630a1['options']?_0x1630a1[_0x3e8f('0x19')][_0x3e8f('0x1a')]||null:null,'attributes':_0x1630a1[_0x3e8f('0x19')]?_0x1630a1[_0x3e8f('0x19')]['attributes']||null:null,'limit':_0x1630a1[_0x3e8f('0x19')]?_0x1630a1[_0x3e8f('0x19')][_0x3e8f('0x1b')]||null:null,'include':_0x1630a1[_0x3e8f('0x19')]?_0x1630a1[_0x3e8f('0x19')][_0x3e8f('0x1c')]?_[_0x3e8f('0x1d')](_0x1630a1['options']['include'],function(_0x2ef1a6){return{'model':db[_0x2ef1a6[_0x3e8f('0x1e')]],'as':_0x2ef1a6['as'],'attributes':_0x2ef1a6[_0x3e8f('0x1f')],'include':_0x2ef1a6[_0x3e8f('0x1c')]?_['map'](_0x2ef1a6[_0x3e8f('0x1c')],function(_0x3b6e17){return{'model':db[_0x3b6e17[_0x3e8f('0x1e')]],'as':_0x3b6e17['as'],'attributes':_0x3b6e17[_0x3e8f('0x1f')],'include':_0x3b6e17[_0x3e8f('0x1c')]?_[_0x3e8f('0x1d')](_0x3b6e17[_0x3e8f('0x1c')],function(_0x1c494e){return{'model':db[_0x1c494e[_0x3e8f('0x1e')]],'as':_0x1c494e['as'],'attributes':_0x1c494e[_0x3e8f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3e8f('0xc')](function(_0x53f0e1){logger[_0x3e8f('0x20')](_0x3e8f('0x21'),_0x1630a1);logger[_0x3e8f('0xf')](_0x3e8f('0x21'),_0x1630a1,JSON[_0x3e8f('0x11')](_0x53f0e1));_0x5ec6fa(_0x53f0e1);})[_0x3e8f('0x16')](function(_0x2a0214){logger[_0x3e8f('0x12')](_0x3e8f('0x21'),_0x2a0214[_0x3e8f('0x14')],_0x1630a1);_0xb4306e(_0x3395ad['error'](0x1f4,_0x2a0214['message']));});});};exports[_0x3e8f('0x22')]=function(_0x4a3971){var _0x3c7a02=this;return new Promise(function(_0x3120be,_0x189b72){return db[_0x3e8f('0x17')]['find']({'raw':_0x4a3971[_0x3e8f('0x19')]?_0x4a3971['options'][_0x3e8f('0x18')]===undefined?!![]:![]:!![],'where':_0x4a3971[_0x3e8f('0x19')]?_0x4a3971[_0x3e8f('0x19')][_0x3e8f('0x1a')]||null:null,'attributes':_0x4a3971[_0x3e8f('0x19')]?_0x4a3971[_0x3e8f('0x19')][_0x3e8f('0x1f')]||null:null,'include':_0x4a3971[_0x3e8f('0x19')]?_0x4a3971['options'][_0x3e8f('0x1c')]?_[_0x3e8f('0x1d')](_0x4a3971[_0x3e8f('0x19')][_0x3e8f('0x1c')],function(_0x31349e){return{'model':db[_0x31349e[_0x3e8f('0x1e')]],'as':_0x31349e['as'],'attributes':_0x31349e[_0x3e8f('0x1f')],'include':_0x31349e[_0x3e8f('0x1c')]?_[_0x3e8f('0x1d')](_0x31349e[_0x3e8f('0x1c')],function(_0x1b0117){return{'model':db[_0x1b0117[_0x3e8f('0x1e')]],'as':_0x1b0117['as'],'attributes':_0x1b0117[_0x3e8f('0x1f')],'include':_0x1b0117['include']?_[_0x3e8f('0x1d')](_0x1b0117[_0x3e8f('0x1c')],function(_0x173108){return{'model':db[_0x173108[_0x3e8f('0x1e')]],'as':_0x173108['as'],'attributes':_0x173108[_0x3e8f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3e8f('0xc')](function(_0x5f5e0c){logger[_0x3e8f('0x20')](_0x3e8f('0x22'),_0x4a3971);logger[_0x3e8f('0xf')](_0x3e8f('0x22'),_0x4a3971,JSON['stringify'](_0x5f5e0c));_0x3120be(_0x5f5e0c);})[_0x3e8f('0x16')](function(_0x30ce99){logger[_0x3e8f('0x12')](_0x3e8f('0x22'),_0x30ce99[_0x3e8f('0x14')],_0x4a3971);_0x189b72(_0x3c7a02[_0x3e8f('0x12')](0x1f4,_0x30ce99[_0x3e8f('0x14')]));});});}; \ No newline at end of file +var _0x9599=['result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','find','ShowSmsQueue','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','./smsQueue.socket','then','info','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','SmsQueue,\x20%s,\x20%s','message'];(function(_0x4998ca,_0x4e69f0){var _0x4ac979=function(_0x930d4e){while(--_0x930d4e){_0x4998ca['push'](_0x4998ca['shift']());}};_0x4ac979(++_0x4e69f0);}(_0x9599,0x1cc));var _0x9959=function(_0x522ea3,_0x2384bd){_0x522ea3=_0x522ea3-0x0;var _0x4eb4cb=_0x9599[_0x522ea3];return _0x4eb4cb;};'use strict';var _=require(_0x9959('0x0'));var util=require(_0x9959('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0x9959('0x2'))['db'];var utils=require(_0x9959('0x3'));var logger=require(_0x9959('0x4'))(_0x9959('0x5'));var config=require(_0x9959('0x6'));var jayson=require(_0x9959('0x7'));var client=jayson[_0x9959('0x8')][_0x9959('0x9')]({'port':0x232a});var socket=require(_0x9959('0xa'))({'host':'localhost','port':0x18eb});require(_0x9959('0xb'))['register'](socket);function respondWithRpcPromise(_0x5ac05f,_0x3bde45,_0xa5db91){return new BPromise(function(_0x5477c8,_0x40bc6a){return client['request'](_0x5ac05f,_0xa5db91)[_0x9959('0xc')](function(_0x2f5362){logger[_0x9959('0xd')]('SmsQueue,\x20%s,\x20%s',_0x3bde45,_0x9959('0xe'));logger['debug'](_0x9959('0xf'),_0x3bde45,_0x9959('0xe'),JSON[_0x9959('0x10')](_0x2f5362));if(_0x2f5362['error']){if(_0x2f5362['error'][_0x9959('0x11')]===0x1f4){logger[_0x9959('0x12')](_0x9959('0x13'),_0x3bde45,_0x2f5362[_0x9959('0x12')][_0x9959('0x14')]);return _0x40bc6a(_0x2f5362[_0x9959('0x12')][_0x9959('0x14')]);}logger[_0x9959('0x12')]('SmsQueue,\x20%s,\x20%s',_0x3bde45,_0x2f5362['error'][_0x9959('0x14')]);return _0x5477c8(_0x2f5362[_0x9959('0x12')]['message']);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x3bde45,'request\x20sent');_0x5477c8(_0x2f5362[_0x9959('0x15')][_0x9959('0x14')]);}})[_0x9959('0x16')](function(_0x55b5d1){logger[_0x9959('0x12')](_0x9959('0x13'),_0x3bde45,_0x55b5d1);_0x40bc6a(_0x55b5d1);});});}exports[_0x9959('0x17')]=function(_0x1d3d73){var _0x1aeb6c=this;return new Promise(function(_0x3725f2,_0x226002){return db[_0x9959('0x18')][_0x9959('0x19')]({'raw':_0x1d3d73['options']?_0x1d3d73[_0x9959('0x1a')][_0x9959('0x1b')]===undefined?!![]:![]:!![],'where':_0x1d3d73[_0x9959('0x1a')]?_0x1d3d73[_0x9959('0x1a')][_0x9959('0x1c')]||null:null,'attributes':_0x1d3d73[_0x9959('0x1a')]?_0x1d3d73[_0x9959('0x1a')][_0x9959('0x1d')]||null:null,'limit':_0x1d3d73[_0x9959('0x1a')]?_0x1d3d73[_0x9959('0x1a')][_0x9959('0x1e')]||null:null,'include':_0x1d3d73[_0x9959('0x1a')]?_0x1d3d73['options'][_0x9959('0x1f')]?_[_0x9959('0x20')](_0x1d3d73[_0x9959('0x1a')]['include'],function(_0x1ec506){return{'model':db[_0x1ec506[_0x9959('0x21')]],'as':_0x1ec506['as'],'attributes':_0x1ec506[_0x9959('0x1d')],'include':_0x1ec506[_0x9959('0x1f')]?_[_0x9959('0x20')](_0x1ec506[_0x9959('0x1f')],function(_0x2e4194){return{'model':db[_0x2e4194[_0x9959('0x21')]],'as':_0x2e4194['as'],'attributes':_0x2e4194['attributes'],'include':_0x2e4194[_0x9959('0x1f')]?_['map'](_0x2e4194[_0x9959('0x1f')],function(_0x11cadd){return{'model':db[_0x11cadd[_0x9959('0x21')]],'as':_0x11cadd['as'],'attributes':_0x11cadd[_0x9959('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9959('0xc')](function(_0x5d0d43){logger['info'](_0x9959('0x17'),_0x1d3d73);logger[_0x9959('0x22')]('GetSmsQueue',_0x1d3d73,JSON[_0x9959('0x10')](_0x5d0d43));_0x3725f2(_0x5d0d43);})['catch'](function(_0x202f59){logger[_0x9959('0x12')]('GetSmsQueue',_0x202f59['message'],_0x1d3d73);_0x226002(_0x1aeb6c[_0x9959('0x12')](0x1f4,_0x202f59[_0x9959('0x14')]));});});};exports['ShowSmsQueue']=function(_0x1f06d6){var _0x507d79=this;return new Promise(function(_0x451fdc,_0x10f97f){return db[_0x9959('0x18')][_0x9959('0x23')]({'raw':_0x1f06d6['options']?_0x1f06d6[_0x9959('0x1a')][_0x9959('0x1b')]===undefined?!![]:![]:!![],'where':_0x1f06d6[_0x9959('0x1a')]?_0x1f06d6[_0x9959('0x1a')][_0x9959('0x1c')]||null:null,'attributes':_0x1f06d6['options']?_0x1f06d6[_0x9959('0x1a')][_0x9959('0x1d')]||null:null,'include':_0x1f06d6[_0x9959('0x1a')]?_0x1f06d6[_0x9959('0x1a')][_0x9959('0x1f')]?_[_0x9959('0x20')](_0x1f06d6[_0x9959('0x1a')][_0x9959('0x1f')],function(_0x278c9c){return{'model':db[_0x278c9c[_0x9959('0x21')]],'as':_0x278c9c['as'],'attributes':_0x278c9c[_0x9959('0x1d')],'include':_0x278c9c['include']?_[_0x9959('0x20')](_0x278c9c[_0x9959('0x1f')],function(_0x207cf8){return{'model':db[_0x207cf8[_0x9959('0x21')]],'as':_0x207cf8['as'],'attributes':_0x207cf8['attributes'],'include':_0x207cf8[_0x9959('0x1f')]?_[_0x9959('0x20')](_0x207cf8[_0x9959('0x1f')],function(_0x5d5dbf){return{'model':db[_0x5d5dbf[_0x9959('0x21')]],'as':_0x5d5dbf['as'],'attributes':_0x5d5dbf[_0x9959('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30e9cf){logger[_0x9959('0xd')](_0x9959('0x24'),_0x1f06d6);logger[_0x9959('0x22')]('ShowSmsQueue',_0x1f06d6,JSON['stringify'](_0x30e9cf));_0x451fdc(_0x30e9cf);})[_0x9959('0x16')](function(_0x2c4444){logger['error']('ShowSmsQueue',_0x2c4444[_0x9959('0x14')],_0x1f06d6);_0x10f97f(_0x507d79[_0x9959('0x12')](0x1f4,_0x2c4444[_0x9959('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index f7e7e00..c76a923 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 _0xb6c9=['emit','removeListener','register','./smsQueue.events','update'];(function(_0x1f3f99,_0x183ac7){var _0x195f46=function(_0xd47f3c){while(--_0xd47f3c){_0x1f3f99['push'](_0x1f3f99['shift']());}};_0x195f46(++_0x183ac7);}(_0xb6c9,0x152));var _0x9b6c=function(_0x572644,_0x543d79){_0x572644=_0x572644-0x0;var _0x17efa9=_0xb6c9[_0x572644];return _0x17efa9;};'use strict';var SmsQueueEvents=require(_0x9b6c('0x0'));var events=['save','remove',_0x9b6c('0x1')];function createListener(_0x59cf40,_0x17bb1d){return function(_0x20ee3d){_0x17bb1d[_0x9b6c('0x2')](_0x59cf40,_0x20ee3d);};}function removeListener(_0x510296,_0x5dc26d){return function(){SmsQueueEvents[_0x9b6c('0x3')](_0x510296,_0x5dc26d);};}exports[_0x9b6c('0x4')]=function(_0x20897f){for(var _0x20dbc7=0x0,_0x584f4d=events['length'];_0x20dbc7<_0x584f4d;_0x20dbc7++){var _0x578073=events[_0x20dbc7];var _0x52bc9d=createListener('smsQueue:'+_0x578073,_0x20897f);SmsQueueEvents['on'](_0x578073,_0x52bc9d);}}; \ No newline at end of file +var _0xb41d=['remove','update','emit','removeListener','save'];(function(_0x5bf2a6,_0x96d3b8){var _0x284505=function(_0x55febe){while(--_0x55febe){_0x5bf2a6['push'](_0x5bf2a6['shift']());}};_0x284505(++_0x96d3b8);}(_0xb41d,0xb8));var _0xdb41=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xb41d[_0x33032e];return _0x13316b;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xdb41('0x0'),_0xdb41('0x1'),_0xdb41('0x2')];function createListener(_0x35c17e,_0x33a072){return function(_0x352b61){_0x33a072[_0xdb41('0x3')](_0x35c17e,_0x352b61);};}function removeListener(_0x36b605,_0x50dc3c){return function(){SmsQueueEvents[_0xdb41('0x4')](_0x36b605,_0x50dc3c);};}exports['register']=function(_0x227752){for(var _0x35e2e5=0x0,_0x2c1748=events['length'];_0x35e2e5<_0x2c1748;_0x35e2e5++){var _0x34bcd3=events[_0x35e2e5];var _0x4bc001=createListener('smsQueue:'+_0x34bcd3,_0x227752);SmsQueueEvents['on'](_0x34bcd3,_0x4bc001);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 6d9d22f..d35da4c 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 _0x01fe=['show','post','create','delete','destroy','exports','multer','path','express','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x12b42b,_0x5cf262){var _0x162296=function(_0x4dc1df){while(--_0x4dc1df){_0x12b42b['push'](_0x12b42b['shift']());}};_0x162296(++_0x5cf262);}(_0x01fe,0x102));var _0xe01f=function(_0x33ab11,_0x3bdb60){_0x33ab11=_0x33ab11-0x0;var _0x595951=_0x01fe[_0x33ab11];return _0x595951;};'use strict';var multer=require(_0xe01f('0x0'));var util=require('util');var path=require(_0xe01f('0x1'));var express=require(_0xe01f('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe01f('0x3'));var config=require(_0xe01f('0x4'));var controller=require(_0xe01f('0x5'));router[_0xe01f('0x6')]('/',auth['isAuthenticated'](),controller[_0xe01f('0x7')]);router['get'](_0xe01f('0x8'),auth[_0xe01f('0x9')](),controller[_0xe01f('0xa')]);router[_0xe01f('0x6')](_0xe01f('0xb'),auth['isAuthenticated'](),controller[_0xe01f('0xc')]);router[_0xe01f('0xd')]('/',auth['isAuthenticated'](),controller[_0xe01f('0xe')]);router['put'](_0xe01f('0xb'),auth[_0xe01f('0x9')](),controller['update']);router[_0xe01f('0xf')]('/:id',auth[_0xe01f('0x9')](),controller[_0xe01f('0x10')]);module[_0xe01f('0x11')]=router; \ No newline at end of file +var _0x80df=['update','delete','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put'];(function(_0x4659e9,_0xe7ae45){var _0x2580e3=function(_0x52b36f){while(--_0x52b36f){_0x4659e9['push'](_0x4659e9['shift']());}};_0x2580e3(++_0xe7ae45);}(_0x80df,0x17e));var _0xf80d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x80df[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xf80d('0x0'));var util=require(_0xf80d('0x1'));var path=require(_0xf80d('0x2'));var express=require(_0xf80d('0x3'));var router=express['Router']();var auth=require(_0xf80d('0x4'));var interaction=require(_0xf80d('0x5'));var config=require(_0xf80d('0x6'));var controller=require(_0xf80d('0x7'));router[_0xf80d('0x8')]('/',auth[_0xf80d('0x9')](),controller[_0xf80d('0xa')]);router[_0xf80d('0x8')](_0xf80d('0xb'),auth[_0xf80d('0x9')](),controller['describe']);router[_0xf80d('0x8')](_0xf80d('0xc'),auth[_0xf80d('0x9')](),controller[_0xf80d('0xd')]);router[_0xf80d('0xe')]('/',auth[_0xf80d('0x9')](),controller[_0xf80d('0xf')]);router[_0xf80d('0x10')](_0xf80d('0xc'),auth[_0xf80d('0x9')](),controller[_0xf80d('0x11')]);router[_0xf80d('0x12')](_0xf80d('0xc'),auth[_0xf80d('0x9')](),controller['destroy']);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 85fe5b4..7e4c379 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 _0xa34e=['moment','sequelize','exports','STRING','DATE'];(function(_0x3a4639,_0x42370a){var _0x17f851=function(_0x210a54){while(--_0x210a54){_0x3a4639['push'](_0x3a4639['shift']());}};_0x17f851(++_0x42370a);}(_0xa34e,0x145));var _0xea34=function(_0x3ce3bc,_0x3530af){_0x3ce3bc=_0x3ce3bc-0x0;var _0x31100b=_0xa34e[_0x3ce3bc];return _0x31100b;};'use strict';var moment=require(_0xea34('0x0'));var Sequelize=require(_0xea34('0x1'));module[_0xea34('0x2')]={'uniqueid':{'type':Sequelize[_0xea34('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xea34('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xea34('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xea34('0x4')]},'reason':{'type':Sequelize[_0xea34('0x3')]}}; \ No newline at end of file +var _0x99c4=['sequelize','exports','STRING','DATE'];(function(_0x1efed4,_0x3e803b){var _0x2e76e9=function(_0x1305e1){while(--_0x1305e1){_0x1efed4['push'](_0x1efed4['shift']());}};_0x2e76e9(++_0x3e803b);}(_0x99c4,0x6c));var _0x499c=function(_0x53461c,_0x3ff04c){_0x53461c=_0x53461c-0x0;var _0x5c0f46=_0x99c4[_0x53461c];return _0x5c0f46;};'use strict';var moment=require('moment');var Sequelize=require(_0x499c('0x0'));module[_0x499c('0x1')]={'uniqueid':{'type':Sequelize[_0x499c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x499c('0x2')]},'joinAt':{'type':Sequelize[_0x499c('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x499c('0x3')]},'exitAt':{'type':Sequelize[_0x499c('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 2f9965a..f56b7e4 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 _0x9537=['util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','apply','reject','save','update','end','name','send','index','model','keys','query','dateEnd','dateStart','filters','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','add','day','merge','filter','options','then','includeAll','include','SmsQueueReport','findAll','catch','params','rawAttributes','intersection','find','create','body','destroy','describe','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x27656c,_0x66f769){var _0x28aa2f=function(_0x5e1768){while(--_0x5e1768){_0x27656c['push'](_0x27656c['shift']());}};_0x28aa2f(++_0x66f769);}(_0x9537,0xbe));var _0x7953=function(_0x4f4a4c,_0x1b44dd){_0x4f4a4c=_0x4f4a4c-0x0;var _0xd2eb35=_0x9537[_0x4f4a4c];return _0xd2eb35;};'use strict';var jsonpatch=require(_0x7953('0x0'));var rp=require(_0x7953('0x1'));var moment=require(_0x7953('0x2'));var BPromise=require(_0x7953('0x3'));var Mustache=require(_0x7953('0x4'));var util=require(_0x7953('0x5'));var path=require('path');var sox=require(_0x7953('0x6'));var csv=require(_0x7953('0x7'));var ejs=require(_0x7953('0x8'));var fs=require('fs');var _=require(_0x7953('0x9'));var squel=require(_0x7953('0xa'));var crypto=require(_0x7953('0xb'));var jsforce=require(_0x7953('0xc'));var deskjs=require(_0x7953('0xd'));var toCsv=require(_0x7953('0x7'));var querystring=require(_0x7953('0xe'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x7953('0xf'));var utils=require(_0x7953('0x10'));var config=require(_0x7953('0x11'));var db=require(_0x7953('0x12'))['db'];function respondWithStatusCode(_0x493431,_0x2673d0){_0x2673d0=_0x2673d0||0xcc;return function(_0x7945ad){if(_0x7945ad){return _0x493431[_0x7953('0x13')](_0x2673d0);}return _0x493431['status'](_0x2673d0)['end']();};}function respondWithResult(_0x5c3f9d,_0x379794){_0x379794=_0x379794||0xc8;return function(_0x185961){if(_0x185961){return _0x5c3f9d[_0x7953('0x14')](_0x379794)[_0x7953('0x15')](_0x185961);}};}function respondWithFilteredResult(_0x1f2d12,_0x5dddc8){return function(_0x5719d6){if(_0x5719d6){var _0x29e43e=_0x5719d6[_0x7953('0x16')],_0x33470f=_0x5dddc8[_0x7953('0x17')],_0x328791=_0x5dddc8[_0x7953('0x17')]+_0x5dddc8['limit'],_0x2a516e;if(_0x328791>=_0x29e43e){_0x328791=_0x29e43e;_0x2a516e=0xc8;}else{_0x2a516e=0xce;}_0x1f2d12[_0x7953('0x14')](_0x2a516e);return _0x1f2d12[_0x7953('0x18')]('Content-Range',_0x33470f+'-'+_0x328791+'/'+_0x29e43e)[_0x7953('0x15')](_0x5719d6);}return null;};}function patchUpdates(_0x410f10){return function(_0x4211f8){try{jsonpatch[_0x7953('0x19')](_0x4211f8,_0x410f10,!![]);}catch(_0x370af3){return BPromise[_0x7953('0x1a')](_0x370af3);}return _0x4211f8[_0x7953('0x1b')]();};}function saveUpdates(_0x1f47bd,_0xfa7be7){return function(_0x245d6a){if(_0x245d6a){return _0x245d6a[_0x7953('0x1c')](_0x1f47bd)['then'](function(_0x5dc2a1){return _0x5dc2a1;});}return null;};}function removeEntity(_0x4cec91,_0x3b4155){return function(_0x35d422){if(_0x35d422){return _0x35d422['destroy']()['then'](function(){_0x4cec91['status'](0xcc)[_0x7953('0x1d')]();});}};}function handleEntityNotFound(_0x16348a,_0x38da58){return function(_0x15e4d9){if(!_0x15e4d9){_0x16348a['sendStatus'](0x194);}return _0x15e4d9;};}function handleError(_0x5369c4,_0x554b4c){_0x554b4c=_0x554b4c||0x1f4;return function(_0x513c8a){logger['error'](_0x513c8a['stack']);if(_0x513c8a[_0x7953('0x1e')]){delete _0x513c8a[_0x7953('0x1e')];}_0x5369c4[_0x7953('0x14')](_0x554b4c)[_0x7953('0x1f')](_0x513c8a);};}exports[_0x7953('0x20')]=function(_0x27025b,_0x175b10){var _0x34f743={},_0x37a54d={},_0x2c31a1={'count':0x0,'rows':[]};var _0x2d9d69=db['SmsQueueReport']['rawAttributes'];_0x37a54d[_0x7953('0x21')]=_[_0x7953('0x22')](_0x2d9d69);var _0xc01363={'dateStart':_0x27025b[_0x7953('0x23')]['dateStart'],'dateEnd':_0x27025b[_0x7953('0x23')][_0x7953('0x24')]};delete _0x27025b[_0x7953('0x23')][_0x7953('0x25')];delete _0x27025b[_0x7953('0x23')][_0x7953('0x24')];_0x37a54d['query']=_[_0x7953('0x22')](_0x27025b[_0x7953('0x23')]);_0x37a54d[_0x7953('0x26')]=_['intersection'](_0x37a54d[_0x7953('0x21')],_0x37a54d[_0x7953('0x23')]);_0x34f743['attributes']=_['intersection'](_0x37a54d[_0x7953('0x21')],qs['fields'](_0x27025b['query'][_0x7953('0x27')]));_0x34f743[_0x7953('0x28')]=_0x34f743['attributes']['length']?_0x34f743[_0x7953('0x28')]:_0x37a54d[_0x7953('0x21')];if(!_0x27025b['query'][_0x7953('0x29')](_0x7953('0x2a'))){_0x34f743[_0x7953('0x2b')]=qs[_0x7953('0x2b')](_0x27025b[_0x7953('0x23')][_0x7953('0x2b')]);_0x34f743[_0x7953('0x17')]=qs[_0x7953('0x17')](_0x27025b['query']['offset']);}_0x34f743['order']=qs['sort'](_0x27025b[_0x7953('0x23')][_0x7953('0x2c')]);_0x34f743[_0x7953('0x2d')]=qs['filters'](_['pick'](_0x27025b[_0x7953('0x23')],_0x37a54d[_0x7953('0x26')]));if(_0xc01363['dateStart']){if(_0xc01363[_0x7953('0x24')]){_0xc01363[_0x7953('0x24')]=moment(_0xc01363[_0x7953('0x24')])[_0x7953('0x2e')](0x1,_0x7953('0x2f'));}else{_0xc01363['dateEnd']=moment(_0xc01363['dateStart'])['add'](0x1,_0x7953('0x2f'));}_[_0x7953('0x30')](_0x34f743['where'],{'createdAt':{'$gte':_0xc01363[_0x7953('0x25')],'$lte':_0xc01363['dateEnd']}});}if(_0x27025b[_0x7953('0x23')][_0x7953('0x31')]){_0x34f743[_0x7953('0x2d')]=_[_0x7953('0x30')](_0x34f743[_0x7953('0x2d')],{'$or':_['map'](_0x34f743[_0x7953('0x28')],function(_0x571fa3){var _0x316bb1={};_0x316bb1[_0x571fa3]={'$like':'%'+_0x27025b[_0x7953('0x23')]['filter']+'%'};return _0x316bb1;})});}_0x34f743=_['merge']({},_0x34f743,_0x27025b[_0x7953('0x32')]);var _0x4ad9de={'where':_0x34f743['where']};return db['SmsQueueReport'][_0x7953('0x16')](_0x4ad9de)[_0x7953('0x33')](function(_0x311a84){_0x2c31a1[_0x7953('0x16')]=_0x311a84;if(_0x27025b[_0x7953('0x23')][_0x7953('0x34')]){_0x34f743[_0x7953('0x35')]=[{'all':!![]}];}return db[_0x7953('0x36')][_0x7953('0x37')](_0x34f743);})[_0x7953('0x33')](function(_0xece185){_0x2c31a1['rows']=_0xece185;return _0x2c31a1;})[_0x7953('0x33')](respondWithFilteredResult(_0x175b10,_0x34f743))[_0x7953('0x38')](handleError(_0x175b10,null));};exports['show']=function(_0x38bf63,_0x43cfa2){var _0x25173e={'raw':!![],'where':{'id':_0x38bf63[_0x7953('0x39')]['id']}},_0x4efd59={};_0x4efd59[_0x7953('0x21')]=_[_0x7953('0x22')](db['SmsQueueReport'][_0x7953('0x3a')]);_0x4efd59['query']=_[_0x7953('0x22')](_0x38bf63[_0x7953('0x23')]);_0x4efd59[_0x7953('0x26')]=_['intersection'](_0x4efd59['model'],_0x4efd59[_0x7953('0x23')]);_0x25173e[_0x7953('0x28')]=_[_0x7953('0x3b')](_0x4efd59['model'],qs[_0x7953('0x27')](_0x38bf63['query'][_0x7953('0x27')]));_0x25173e[_0x7953('0x28')]=_0x25173e[_0x7953('0x28')]['length']?_0x25173e['attributes']:_0x4efd59['model'];if(_0x38bf63['query'][_0x7953('0x34')]){_0x25173e[_0x7953('0x35')]=[{'all':!![]}];}_0x25173e=_['merge']({},_0x25173e,_0x38bf63[_0x7953('0x32')]);return db[_0x7953('0x36')][_0x7953('0x3c')](_0x25173e)[_0x7953('0x33')](handleEntityNotFound(_0x43cfa2,null))[_0x7953('0x33')](respondWithResult(_0x43cfa2,null))[_0x7953('0x38')](handleError(_0x43cfa2,null));};exports[_0x7953('0x3d')]=function(_0x5de034,_0x4c9851){return db[_0x7953('0x36')][_0x7953('0x3d')](_0x5de034['body'],{})[_0x7953('0x33')](respondWithResult(_0x4c9851,0xc9))[_0x7953('0x38')](handleError(_0x4c9851,null));};exports[_0x7953('0x1c')]=function(_0x4fb704,_0x163f8){if(_0x4fb704[_0x7953('0x3e')]['id']){delete _0x4fb704['body']['id'];}return db[_0x7953('0x36')]['find']({'where':{'id':_0x4fb704['params']['id']}})[_0x7953('0x33')](handleEntityNotFound(_0x163f8,null))['then'](saveUpdates(_0x4fb704[_0x7953('0x3e')],null))[_0x7953('0x33')](respondWithResult(_0x163f8,null))[_0x7953('0x38')](handleError(_0x163f8,null));};exports[_0x7953('0x3f')]=function(_0x1f7ffd,_0x189352){return db['SmsQueueReport'][_0x7953('0x3c')]({'where':{'id':_0x1f7ffd['params']['id']}})[_0x7953('0x33')](handleEntityNotFound(_0x189352,null))[_0x7953('0x33')](removeEntity(_0x189352,null))[_0x7953('0x38')](handleError(_0x189352,null));};exports[_0x7953('0x40')]=function(_0x356df,_0x156157){return db[_0x7953('0x36')][_0x7953('0x40')]()[_0x7953('0x33')](respondWithResult(_0x156157,null))['catch'](handleError(_0x156157,null));}; \ No newline at end of file +var _0x7ddf=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','SmsQueueReport','count','includeAll','include','findAll','catch','params','length','options','create','body','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger'];(function(_0x29eadf,_0x2a2f9b){var _0x39784b=function(_0x28c0a9){while(--_0x28c0a9){_0x29eadf['push'](_0x29eadf['shift']());}};_0x39784b(++_0x2a2f9b);}(_0x7ddf,0x104));var _0xf7dd=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x7ddf[_0x1e7b16];return _0x37fadc;};'use strict';var jsonpatch=require(_0xf7dd('0x0'));var rp=require(_0xf7dd('0x1'));var moment=require(_0xf7dd('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf7dd('0x3'));var util=require('util');var path=require(_0xf7dd('0x4'));var sox=require(_0xf7dd('0x5'));var csv=require('to-csv');var ejs=require(_0xf7dd('0x6'));var fs=require('fs');var _=require(_0xf7dd('0x7'));var squel=require(_0xf7dd('0x8'));var crypto=require(_0xf7dd('0x9'));var jsforce=require(_0xf7dd('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf7dd('0xb'));var querystring=require(_0xf7dd('0xc'));var Papa=require(_0xf7dd('0xd'));var qs=require(_0xf7dd('0xe'));var logger=require(_0xf7dd('0xf'))(_0xf7dd('0x10'));var utils=require(_0xf7dd('0x11'));var config=require(_0xf7dd('0x12'));var db=require(_0xf7dd('0x13'))['db'];function respondWithStatusCode(_0x42af4b,_0x3e863e){_0x3e863e=_0x3e863e||0xcc;return function(_0x5e6897){if(_0x5e6897){return _0x42af4b[_0xf7dd('0x14')](_0x3e863e);}return _0x42af4b[_0xf7dd('0x15')](_0x3e863e)[_0xf7dd('0x16')]();};}function respondWithResult(_0x23bb5b,_0x161b29){_0x161b29=_0x161b29||0xc8;return function(_0x551f6f){if(_0x551f6f){return _0x23bb5b[_0xf7dd('0x15')](_0x161b29)[_0xf7dd('0x17')](_0x551f6f);}};}function respondWithFilteredResult(_0x3ef3be,_0x22934c){return function(_0x189236){if(_0x189236){var _0x170784=_0x189236['count'],_0x31d259=_0x22934c[_0xf7dd('0x18')],_0x5249ed=_0x22934c[_0xf7dd('0x18')]+_0x22934c[_0xf7dd('0x19')],_0x49220a;if(_0x5249ed>=_0x170784){_0x5249ed=_0x170784;_0x49220a=0xc8;}else{_0x49220a=0xce;}_0x3ef3be[_0xf7dd('0x15')](_0x49220a);return _0x3ef3be[_0xf7dd('0x1a')](_0xf7dd('0x1b'),_0x31d259+'-'+_0x5249ed+'/'+_0x170784)[_0xf7dd('0x17')](_0x189236);}return null;};}function patchUpdates(_0x2b6e0e){return function(_0x35ad14){try{jsonpatch[_0xf7dd('0x1c')](_0x35ad14,_0x2b6e0e,!![]);}catch(_0xa1b497){return BPromise['reject'](_0xa1b497);}return _0x35ad14[_0xf7dd('0x1d')]();};}function saveUpdates(_0x402f90,_0x4ddf31){return function(_0x4cf7b6){if(_0x4cf7b6){return _0x4cf7b6[_0xf7dd('0x1e')](_0x402f90)[_0xf7dd('0x1f')](function(_0x25c608){return _0x25c608;});}return null;};}function removeEntity(_0x3df8c2,_0xe728c9){return function(_0x41259b){if(_0x41259b){return _0x41259b[_0xf7dd('0x20')]()['then'](function(){_0x3df8c2[_0xf7dd('0x15')](0xcc)[_0xf7dd('0x16')]();});}};}function handleEntityNotFound(_0x3e5e21,_0x5ece8a){return function(_0x416f56){if(!_0x416f56){_0x3e5e21['sendStatus'](0x194);}return _0x416f56;};}function handleError(_0x1ec6f5,_0x139dfd){_0x139dfd=_0x139dfd||0x1f4;return function(_0x3b6c21){logger[_0xf7dd('0x21')](_0x3b6c21[_0xf7dd('0x22')]);if(_0x3b6c21[_0xf7dd('0x23')]){delete _0x3b6c21[_0xf7dd('0x23')];}_0x1ec6f5[_0xf7dd('0x15')](_0x139dfd)[_0xf7dd('0x24')](_0x3b6c21);};}exports[_0xf7dd('0x25')]=function(_0x56504f,_0x3a8de3){var _0x56c8f4={},_0x10dff6={},_0x3a4ac2={'count':0x0,'rows':[]};var _0x236edf=db['SmsQueueReport'][_0xf7dd('0x26')];_0x10dff6[_0xf7dd('0x27')]=_[_0xf7dd('0x28')](_0x236edf);var _0x29d8be={'dateStart':_0x56504f[_0xf7dd('0x29')][_0xf7dd('0x2a')],'dateEnd':_0x56504f['query']['dateEnd']};delete _0x56504f[_0xf7dd('0x29')]['dateStart'];delete _0x56504f['query'][_0xf7dd('0x2b')];_0x10dff6['query']=_[_0xf7dd('0x28')](_0x56504f[_0xf7dd('0x29')]);_0x10dff6[_0xf7dd('0x2c')]=_[_0xf7dd('0x2d')](_0x10dff6[_0xf7dd('0x27')],_0x10dff6[_0xf7dd('0x29')]);_0x56c8f4[_0xf7dd('0x2e')]=_[_0xf7dd('0x2d')](_0x10dff6[_0xf7dd('0x27')],qs['fields'](_0x56504f[_0xf7dd('0x29')][_0xf7dd('0x2f')]));_0x56c8f4['attributes']=_0x56c8f4['attributes']['length']?_0x56c8f4[_0xf7dd('0x2e')]:_0x10dff6[_0xf7dd('0x27')];if(!_0x56504f[_0xf7dd('0x29')][_0xf7dd('0x30')](_0xf7dd('0x31'))){_0x56c8f4[_0xf7dd('0x19')]=qs[_0xf7dd('0x19')](_0x56504f[_0xf7dd('0x29')][_0xf7dd('0x19')]);_0x56c8f4[_0xf7dd('0x18')]=qs[_0xf7dd('0x18')](_0x56504f[_0xf7dd('0x29')][_0xf7dd('0x18')]);}_0x56c8f4[_0xf7dd('0x32')]=qs[_0xf7dd('0x33')](_0x56504f[_0xf7dd('0x29')][_0xf7dd('0x33')]);_0x56c8f4[_0xf7dd('0x34')]=qs[_0xf7dd('0x2c')](_[_0xf7dd('0x35')](_0x56504f[_0xf7dd('0x29')],_0x10dff6[_0xf7dd('0x2c')]));if(_0x29d8be[_0xf7dd('0x2a')]){if(_0x29d8be[_0xf7dd('0x2b')]){_0x29d8be[_0xf7dd('0x2b')]=moment(_0x29d8be[_0xf7dd('0x2b')])[_0xf7dd('0x36')](0x1,_0xf7dd('0x37'));}else{_0x29d8be[_0xf7dd('0x2b')]=moment(_0x29d8be['dateStart'])['add'](0x1,_0xf7dd('0x37'));}_[_0xf7dd('0x38')](_0x56c8f4[_0xf7dd('0x34')],{'createdAt':{'$gte':_0x29d8be[_0xf7dd('0x2a')],'$lte':_0x29d8be[_0xf7dd('0x2b')]}});}if(_0x56504f[_0xf7dd('0x29')][_0xf7dd('0x39')]){_0x56c8f4[_0xf7dd('0x34')]=_['merge'](_0x56c8f4[_0xf7dd('0x34')],{'$or':_['map'](_0x56c8f4[_0xf7dd('0x2e')],function(_0x1c5365){var _0x5b3056={};_0x5b3056[_0x1c5365]={'$like':'%'+_0x56504f[_0xf7dd('0x29')][_0xf7dd('0x39')]+'%'};return _0x5b3056;})});}_0x56c8f4=_[_0xf7dd('0x38')]({},_0x56c8f4,_0x56504f['options']);var _0x62cb39={'where':_0x56c8f4[_0xf7dd('0x34')]};return db[_0xf7dd('0x3a')][_0xf7dd('0x3b')](_0x62cb39)[_0xf7dd('0x1f')](function(_0x1695c2){_0x3a4ac2[_0xf7dd('0x3b')]=_0x1695c2;if(_0x56504f['query'][_0xf7dd('0x3c')]){_0x56c8f4[_0xf7dd('0x3d')]=[{'all':!![]}];}return db[_0xf7dd('0x3a')][_0xf7dd('0x3e')](_0x56c8f4);})[_0xf7dd('0x1f')](function(_0x3e8e8a){_0x3a4ac2['rows']=_0x3e8e8a;return _0x3a4ac2;})[_0xf7dd('0x1f')](respondWithFilteredResult(_0x3a8de3,_0x56c8f4))[_0xf7dd('0x3f')](handleError(_0x3a8de3,null));};exports['show']=function(_0x30461e,_0x3fff41){var _0x542866={'raw':!![],'where':{'id':_0x30461e[_0xf7dd('0x40')]['id']}},_0x12570f={};_0x12570f[_0xf7dd('0x27')]=_['keys'](db[_0xf7dd('0x3a')][_0xf7dd('0x26')]);_0x12570f['query']=_[_0xf7dd('0x28')](_0x30461e[_0xf7dd('0x29')]);_0x12570f[_0xf7dd('0x2c')]=_[_0xf7dd('0x2d')](_0x12570f[_0xf7dd('0x27')],_0x12570f[_0xf7dd('0x29')]);_0x542866[_0xf7dd('0x2e')]=_[_0xf7dd('0x2d')](_0x12570f[_0xf7dd('0x27')],qs[_0xf7dd('0x2f')](_0x30461e[_0xf7dd('0x29')][_0xf7dd('0x2f')]));_0x542866[_0xf7dd('0x2e')]=_0x542866[_0xf7dd('0x2e')][_0xf7dd('0x41')]?_0x542866[_0xf7dd('0x2e')]:_0x12570f[_0xf7dd('0x27')];if(_0x30461e[_0xf7dd('0x29')]['includeAll']){_0x542866[_0xf7dd('0x3d')]=[{'all':!![]}];}_0x542866=_[_0xf7dd('0x38')]({},_0x542866,_0x30461e[_0xf7dd('0x42')]);return db[_0xf7dd('0x3a')]['find'](_0x542866)[_0xf7dd('0x1f')](handleEntityNotFound(_0x3fff41,null))[_0xf7dd('0x1f')](respondWithResult(_0x3fff41,null))[_0xf7dd('0x3f')](handleError(_0x3fff41,null));};exports[_0xf7dd('0x43')]=function(_0x358304,_0x5b73d3){return db['SmsQueueReport']['create'](_0x358304[_0xf7dd('0x44')],{})[_0xf7dd('0x1f')](respondWithResult(_0x5b73d3,0xc9))[_0xf7dd('0x3f')](handleError(_0x5b73d3,null));};exports[_0xf7dd('0x1e')]=function(_0x2d4f80,_0xf31911){if(_0x2d4f80[_0xf7dd('0x44')]['id']){delete _0x2d4f80['body']['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x2d4f80[_0xf7dd('0x40')]['id']}})['then'](handleEntityNotFound(_0xf31911,null))['then'](saveUpdates(_0x2d4f80[_0xf7dd('0x44')],null))[_0xf7dd('0x1f')](respondWithResult(_0xf31911,null))['catch'](handleError(_0xf31911,null));};exports[_0xf7dd('0x20')]=function(_0x50ec1d,_0x4aedbf){return db['SmsQueueReport']['find']({'where':{'id':_0x50ec1d['params']['id']}})['then'](handleEntityNotFound(_0x4aedbf,null))[_0xf7dd('0x1f')](removeEntity(_0x4aedbf,null))[_0xf7dd('0x3f')](handleError(_0x4aedbf,null));};exports['describe']=function(_0x47e2fc,_0x1eb6ba){return db[_0xf7dd('0x3a')]['describe']()['then'](respondWithResult(_0x1eb6ba,null))[_0xf7dd('0x3f')](handleError(_0x1eb6ba,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index e43fa1f..79e9b4a 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 _0x8f45=['api','request-promise','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x249d99,_0x16b584){var _0x5bfb05=function(_0x4f4d67){while(--_0x4f4d67){_0x249d99['push'](_0x249d99['shift']());}};_0x5bfb05(++_0x16b584);}(_0x8f45,0x13e));var _0x58f4=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x8f45[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x58f4('0x0'));var util=require(_0x58f4('0x1'));var logger=require('../../config/logger')(_0x58f4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x58f4('0x3'));var attributes=require(_0x58f4('0x4'));module[_0x58f4('0x5')]=function(_0x546b1a,_0x3146ba){return _0x546b1a[_0x58f4('0x6')](_0x58f4('0x7'),attributes,{'tableName':_0x58f4('0x8'),'paranoid':![],'indexes':[{'name':_0x58f4('0x9'),'fields':[_0x58f4('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2d05=['moment','bluebird','request-promise','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','../../config/logger','api'];(function(_0x47d12e,_0x2d0ada){var _0x1250dc=function(_0x21a5e8){while(--_0x21a5e8){_0x47d12e['push'](_0x47d12e['shift']());}};_0x1250dc(++_0x2d0ada);}(_0x2d05,0x1ed));var _0x52d0=function(_0x5789b5,_0x377992){_0x5789b5=_0x5789b5-0x0;var _0x58bb46=_0x2d05[_0x5789b5];return _0x58bb46;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x52d0('0x0'))(_0x52d0('0x1'));var moment=require(_0x52d0('0x2'));var BPromise=require(_0x52d0('0x3'));var rp=require(_0x52d0('0x4'));var attributes=require(_0x52d0('0x5'));module[_0x52d0('0x6')]=function(_0x34d61c,_0x46fd5d){return _0x34d61c[_0x52d0('0x7')](_0x52d0('0x8'),attributes,{'tableName':_0x52d0('0x9'),'paranoid':![],'indexes':[{'name':_0x52d0('0xa'),'fields':[_0x52d0('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 462049f..bb1807e 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 _0xd3f5=['options','raw','CreateSmsQueueReport','UpdateSmsQueueReport','update','body','where','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','catch','SmsQueueReport','create'];(function(_0x14f7fe,_0x5132c4){var _0x3d8309=function(_0x22f5c7){while(--_0x22f5c7){_0x14f7fe['push'](_0x14f7fe['shift']());}};_0x3d8309(++_0x5132c4);}(_0xd3f5,0x147));var _0x5d3f=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd3f5[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x5d3f('0x0'));var util=require(_0x5d3f('0x1'));var moment=require('moment');var BPromise=require(_0x5d3f('0x2'));var rs=require(_0x5d3f('0x3'));var fs=require('fs');var db=require(_0x5d3f('0x4'))['db'];var utils=require(_0x5d3f('0x5'));var logger=require(_0x5d3f('0x6'))(_0x5d3f('0x7'));var config=require(_0x5d3f('0x8'));var jayson=require(_0x5d3f('0x9'));var client=jayson['client'][_0x5d3f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b7986,_0x2e0ad6,_0x432033){return new BPromise(function(_0x5791d4,_0x1b18bb){return client['request'](_0x4b7986,_0x432033)[_0x5d3f('0xb')](function(_0x5c01b2){logger[_0x5d3f('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x2e0ad6,_0x5d3f('0xd'));logger[_0x5d3f('0xe')](_0x5d3f('0xf'),_0x2e0ad6,_0x5d3f('0xd'),JSON[_0x5d3f('0x10')](_0x5c01b2));if(_0x5c01b2[_0x5d3f('0x11')]){if(_0x5c01b2[_0x5d3f('0x11')][_0x5d3f('0x12')]===0x1f4){logger[_0x5d3f('0x11')](_0x5d3f('0x13'),_0x2e0ad6,_0x5c01b2[_0x5d3f('0x11')]['message']);return _0x1b18bb(_0x5c01b2[_0x5d3f('0x11')][_0x5d3f('0x14')]);}logger[_0x5d3f('0x11')](_0x5d3f('0x13'),_0x2e0ad6,_0x5c01b2['error'][_0x5d3f('0x14')]);return _0x5791d4(_0x5c01b2[_0x5d3f('0x11')]['message']);}else{logger[_0x5d3f('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x2e0ad6,_0x5d3f('0xd'));_0x5791d4(_0x5c01b2[_0x5d3f('0x15')][_0x5d3f('0x14')]);}})[_0x5d3f('0x16')](function(_0x3ac7d5){logger[_0x5d3f('0x11')](_0x5d3f('0x13'),_0x2e0ad6,_0x3ac7d5);_0x1b18bb(_0x3ac7d5);});});}exports['CreateSmsQueueReport']=function(_0x770aa8){var _0x4cdf5e=this;return new Promise(function(_0x4201b9,_0x31f573){return db[_0x5d3f('0x17')][_0x5d3f('0x18')](_0x770aa8['body'],{'raw':_0x770aa8[_0x5d3f('0x19')]?_0x770aa8['options'][_0x5d3f('0x1a')]===undefined?!![]:![]:!![]})[_0x5d3f('0xb')](function(_0x58127d){logger['info'](_0x5d3f('0x1b'),_0x770aa8);logger[_0x5d3f('0xe')](_0x5d3f('0x1b'),_0x770aa8,JSON[_0x5d3f('0x10')](_0x58127d));_0x4201b9(_0x58127d);})['catch'](function(_0x4b0a35){logger[_0x5d3f('0x11')](_0x5d3f('0x1b'),_0x4b0a35[_0x5d3f('0x14')],_0x770aa8);_0x31f573(_0x4cdf5e['error'](0x1f4,_0x4b0a35[_0x5d3f('0x14')]));});});};exports[_0x5d3f('0x1c')]=function(_0x59620d){var _0x345514=this;return new Promise(function(_0x56ea48,_0x14a8f0){return db['SmsQueueReport'][_0x5d3f('0x1d')](_0x59620d[_0x5d3f('0x1e')],{'raw':_0x59620d[_0x5d3f('0x19')]?_0x59620d[_0x5d3f('0x19')][_0x5d3f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59620d[_0x5d3f('0x19')]?_0x59620d['options'][_0x5d3f('0x1f')]||null:null,'attributes':_0x59620d[_0x5d3f('0x19')]?_0x59620d[_0x5d3f('0x19')]['attributes']||null:null,'limit':_0x59620d[_0x5d3f('0x19')]?_0x59620d['options']['limit']||null:null})['then'](function(_0x2f2c74){logger[_0x5d3f('0xc')](_0x5d3f('0x1c'),_0x59620d);logger['debug'](_0x5d3f('0x1c'),_0x59620d,JSON[_0x5d3f('0x10')](_0x2f2c74));_0x56ea48(_0x2f2c74);})[_0x5d3f('0x16')](function(_0x41a1f0){logger['error']('UpdateSmsQueueReport',_0x41a1f0[_0x5d3f('0x14')],_0x59620d);_0x14a8f0(_0x345514[_0x5d3f('0x11')](0x1f4,_0x41a1f0['message']));});});}; \ No newline at end of file +var _0x081e=['SmsQueueReport','create','body','options','raw','then','CreateSmsQueueReport','UpdateSmsQueueReport','update','where','limit','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch'];(function(_0x3ed054,_0x4d4f16){var _0x16dd95=function(_0xc0c19c){while(--_0xc0c19c){_0x3ed054['push'](_0x3ed054['shift']());}};_0x16dd95(++_0x4d4f16);}(_0x081e,0xc5));var _0xe081=function(_0x11f0a6,_0x1ce59d){_0x11f0a6=_0x11f0a6-0x0;var _0xa5ab4b=_0x081e[_0x11f0a6];return _0xa5ab4b;};'use strict';var _=require(_0xe081('0x0'));var util=require(_0xe081('0x1'));var moment=require('moment');var BPromise=require(_0xe081('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xe081('0x3'))['db'];var utils=require(_0xe081('0x4'));var logger=require(_0xe081('0x5'))(_0xe081('0x6'));var config=require(_0xe081('0x7'));var jayson=require(_0xe081('0x8'));var client=jayson[_0xe081('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2271b4,_0x47ac69,_0x558952){return new BPromise(function(_0x4c8fa2,_0x505aaa){return client[_0xe081('0xa')](_0x2271b4,_0x558952)['then'](function(_0x4106a9){logger['info'](_0xe081('0xb'),_0x47ac69,_0xe081('0xc'));logger[_0xe081('0xd')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x47ac69,'request\x20sent',JSON[_0xe081('0xe')](_0x4106a9));if(_0x4106a9['error']){if(_0x4106a9[_0xe081('0xf')][_0xe081('0x10')]===0x1f4){logger[_0xe081('0xf')](_0xe081('0xb'),_0x47ac69,_0x4106a9[_0xe081('0xf')][_0xe081('0x11')]);return _0x505aaa(_0x4106a9['error'][_0xe081('0x11')]);}logger[_0xe081('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x47ac69,_0x4106a9[_0xe081('0xf')][_0xe081('0x11')]);return _0x4c8fa2(_0x4106a9[_0xe081('0xf')]['message']);}else{logger[_0xe081('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x47ac69,'request\x20sent');_0x4c8fa2(_0x4106a9['result']['message']);}})[_0xe081('0x13')](function(_0x47026f){logger[_0xe081('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x47ac69,_0x47026f);_0x505aaa(_0x47026f);});});}exports['CreateSmsQueueReport']=function(_0x3e4d25){var _0x3a1fe2=this;return new Promise(function(_0xae7683,_0x55e36b){return db[_0xe081('0x14')][_0xe081('0x15')](_0x3e4d25[_0xe081('0x16')],{'raw':_0x3e4d25[_0xe081('0x17')]?_0x3e4d25[_0xe081('0x17')][_0xe081('0x18')]===undefined?!![]:![]:!![]})[_0xe081('0x19')](function(_0x3963bd){logger[_0xe081('0x12')]('CreateSmsQueueReport',_0x3e4d25);logger[_0xe081('0xd')](_0xe081('0x1a'),_0x3e4d25,JSON[_0xe081('0xe')](_0x3963bd));_0xae7683(_0x3963bd);})['catch'](function(_0x4af0a9){logger[_0xe081('0xf')](_0xe081('0x1a'),_0x4af0a9[_0xe081('0x11')],_0x3e4d25);_0x55e36b(_0x3a1fe2[_0xe081('0xf')](0x1f4,_0x4af0a9[_0xe081('0x11')]));});});};exports[_0xe081('0x1b')]=function(_0x52f72e){var _0x3cbd9c=this;return new Promise(function(_0x462700,_0x2b4cef){return db[_0xe081('0x14')][_0xe081('0x1c')](_0x52f72e[_0xe081('0x16')],{'raw':_0x52f72e[_0xe081('0x17')]?_0x52f72e[_0xe081('0x17')][_0xe081('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52f72e[_0xe081('0x17')]?_0x52f72e['options'][_0xe081('0x1d')]||null:null,'attributes':_0x52f72e[_0xe081('0x17')]?_0x52f72e[_0xe081('0x17')]['attributes']||null:null,'limit':_0x52f72e[_0xe081('0x17')]?_0x52f72e['options'][_0xe081('0x1e')]||null:null})[_0xe081('0x19')](function(_0xd4d01e){logger[_0xe081('0x12')](_0xe081('0x1b'),_0x52f72e);logger['debug'](_0xe081('0x1b'),_0x52f72e,JSON[_0xe081('0xe')](_0xd4d01e));_0x462700(_0xd4d01e);})[_0xe081('0x13')](function(_0x2096c7){logger[_0xe081('0xf')](_0xe081('0x1b'),_0x2096c7[_0xe081('0x11')],_0x52f72e);_0x2b4cef(_0x3cbd9c[_0xe081('0xf')](0x1f4,_0x2096c7['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index a699cb7..62e7e0b 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 _0x26c2=['../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','delete','destroy','exports','express','Router'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x26c2,0x130));var _0x226c=function(_0x3a1fb5,_0x34d9d9){_0x3a1fb5=_0x3a1fb5-0x0;var _0x2f647b=_0x26c2[_0x3a1fb5];return _0x2f647b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0x226c('0x0'));var router=express[_0x226c('0x1')]();var auth=require(_0x226c('0x2'));var interaction=require(_0x226c('0x3'));var config=require('../../config/environment');var controller=require(_0x226c('0x4'));router[_0x226c('0x5')]('/',auth['isAuthenticated'](),controller[_0x226c('0x6')]);router[_0x226c('0x5')](_0x226c('0x7'),auth[_0x226c('0x8')](),controller[_0x226c('0x9')]);router['get'](_0x226c('0xa'),auth[_0x226c('0x8')](),controller[_0x226c('0xb')]);router[_0x226c('0xc')]('/',auth[_0x226c('0x8')](),controller['create']);router[_0x226c('0xd')](_0x226c('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x226c('0xe')](_0x226c('0xa'),auth[_0x226c('0x8')](),controller[_0x226c('0xf')]);module[_0x226c('0x10')]=router; \ No newline at end of file +var _0xfe60=['./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','create','/:id','update','delete','destroy','util','express','Router','../../components/auth/service','../../config/environment'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xfe60,0x1cb));var _0x0fe6=function(_0x5e5fec,_0x29ffc6){_0x5e5fec=_0x5e5fec-0x0;var _0x91bb59=_0xfe60[_0x5e5fec];return _0x91bb59;};'use strict';var multer=require('multer');var util=require(_0x0fe6('0x0'));var path=require('path');var express=require(_0x0fe6('0x1'));var router=express[_0x0fe6('0x2')]();var auth=require(_0x0fe6('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0fe6('0x4'));var controller=require(_0x0fe6('0x5'));router[_0x0fe6('0x6')]('/',auth[_0x0fe6('0x7')](),controller[_0x0fe6('0x8')]);router[_0x0fe6('0x6')](_0x0fe6('0x9'),auth[_0x0fe6('0x7')](),controller[_0x0fe6('0xa')]);router[_0x0fe6('0x6')]('/:id',auth[_0x0fe6('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x0fe6('0xb')]);router['put'](_0x0fe6('0xc'),auth[_0x0fe6('0x7')](),controller[_0x0fe6('0xd')]);router[_0x0fe6('0xe')](_0x0fe6('0xc'),auth[_0x0fe6('0x7')](),controller[_0x0fe6('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 8affa82..fc466bc 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 _0xb40c=['DATE','NOW','sequelize','ENUM','account','queue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb40c,0x68));var _0xcb40=function(_0x1fd566,_0x140fd1){_0x1fd566=_0x1fd566-0x0;var _0x24697b=_0xb40c[_0x1fd566];return _0x24697b;};'use strict';var moment=require('moment');var Sequelize=require(_0xcb40('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xcb40('0x1')](_0xcb40('0x2'),'agent',_0xcb40('0x3')),'allowNull':![],'defaultValue':_0xcb40('0x3')},'transferredAt':{'type':Sequelize[_0xcb40('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xcb40('0x5')]}}; \ No newline at end of file +var _0x9f96=['exports','STRING','account','agent','queue','DATE','NOW','sequelize'];(function(_0x4687df,_0x12099c){var _0x32eaef=function(_0x2387db){while(--_0x2387db){_0x4687df['push'](_0x4687df['shift']());}};_0x32eaef(++_0x12099c);}(_0x9f96,0x1d7));var _0x69f9=function(_0x43a695,_0x1448d1){_0x43a695=_0x43a695-0x0;var _0x488708=_0x9f96[_0x43a695];return _0x488708;};'use strict';var moment=require('moment');var Sequelize=require(_0x69f9('0x0'));module[_0x69f9('0x1')]={'uniqueid':{'type':Sequelize[_0x69f9('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x69f9('0x3'),_0x69f9('0x4'),_0x69f9('0x5')),'allowNull':![],'defaultValue':_0x69f9('0x5')},'transferredAt':{'type':Sequelize[_0x69f9('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x69f9('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index a194692..f11ffa1 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 _0x2a18=['hasOwnProperty','nolimit','order','sort','filters','pick','add','day','merge','where','filter','map','includeAll','include','rows','catch','show','options','find','create','body','params','describe','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','SmsTransferReport','rawAttributes','keys','query','dateStart','dateEnd','intersection','model','attributes','fields','length'];(function(_0x153857,_0x1fa7e5){var _0x2ee31=function(_0x432d58){while(--_0x432d58){_0x153857['push'](_0x153857['shift']());}};_0x2ee31(++_0x1fa7e5);}(_0x2a18,0x166));var _0x82a1=function(_0x269094,_0x4701b3){_0x269094=_0x269094-0x0;var _0x10344f=_0x2a18[_0x269094];return _0x10344f;};'use strict';var jsonpatch=require(_0x82a1('0x0'));var rp=require(_0x82a1('0x1'));var moment=require(_0x82a1('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x82a1('0x3'));var util=require(_0x82a1('0x4'));var path=require('path');var sox=require(_0x82a1('0x5'));var csv=require(_0x82a1('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x82a1('0x7'));var squel=require(_0x82a1('0x8'));var crypto=require('crypto');var jsforce=require(_0x82a1('0x9'));var deskjs=require(_0x82a1('0xa'));var toCsv=require('to-csv');var querystring=require(_0x82a1('0xb'));var Papa=require(_0x82a1('0xc'));var qs=require('../../components/parsers/qs');var logger=require(_0x82a1('0xd'))('api');var utils=require(_0x82a1('0xe'));var config=require(_0x82a1('0xf'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31e95f,_0x291fd7){_0x291fd7=_0x291fd7||0xcc;return function(_0x2b897d){if(_0x2b897d){return _0x31e95f[_0x82a1('0x10')](_0x291fd7);}return _0x31e95f[_0x82a1('0x11')](_0x291fd7)[_0x82a1('0x12')]();};}function respondWithResult(_0x5078f5,_0x1be5d2){_0x1be5d2=_0x1be5d2||0xc8;return function(_0x384974){if(_0x384974){return _0x5078f5['status'](_0x1be5d2)[_0x82a1('0x13')](_0x384974);}};}function respondWithFilteredResult(_0x37b00b,_0x16671f){return function(_0x5e6d0d){if(_0x5e6d0d){var _0x4943e1=_0x5e6d0d[_0x82a1('0x14')],_0x486779=_0x16671f[_0x82a1('0x15')],_0x33cf38=_0x16671f[_0x82a1('0x15')]+_0x16671f[_0x82a1('0x16')],_0x7a2a00;if(_0x33cf38>=_0x4943e1){_0x33cf38=_0x4943e1;_0x7a2a00=0xc8;}else{_0x7a2a00=0xce;}_0x37b00b['status'](_0x7a2a00);return _0x37b00b[_0x82a1('0x17')](_0x82a1('0x18'),_0x486779+'-'+_0x33cf38+'/'+_0x4943e1)['json'](_0x5e6d0d);}return null;};}function patchUpdates(_0x45acd0){return function(_0x11c67a){try{jsonpatch[_0x82a1('0x19')](_0x11c67a,_0x45acd0,!![]);}catch(_0x419cd9){return BPromise[_0x82a1('0x1a')](_0x419cd9);}return _0x11c67a['save']();};}function saveUpdates(_0x12f80a,_0x4906cb){return function(_0x30124b){if(_0x30124b){return _0x30124b[_0x82a1('0x1b')](_0x12f80a)[_0x82a1('0x1c')](function(_0x10e3fa){return _0x10e3fa;});}return null;};}function removeEntity(_0xae685c,_0x3e4d34){return function(_0x53abdc){if(_0x53abdc){return _0x53abdc[_0x82a1('0x1d')]()[_0x82a1('0x1c')](function(){_0xae685c[_0x82a1('0x11')](0xcc)[_0x82a1('0x12')]();});}};}function handleEntityNotFound(_0x32ff50,_0x3d2257){return function(_0x49619e){if(!_0x49619e){_0x32ff50[_0x82a1('0x10')](0x194);}return _0x49619e;};}function handleError(_0x36961e,_0x33d998){_0x33d998=_0x33d998||0x1f4;return function(_0x511749){logger['error'](_0x511749[_0x82a1('0x1e')]);if(_0x511749['name']){delete _0x511749[_0x82a1('0x1f')];}_0x36961e[_0x82a1('0x11')](_0x33d998)[_0x82a1('0x20')](_0x511749);};}exports['index']=function(_0x3eaab7,_0x1f9afb){var _0x25806d={},_0x124914={},_0x11b050={'count':0x0,'rows':[]};var _0x1b3813=db[_0x82a1('0x21')][_0x82a1('0x22')];_0x124914['model']=_[_0x82a1('0x23')](_0x1b3813);var _0xd0ce4c={'dateStart':_0x3eaab7[_0x82a1('0x24')][_0x82a1('0x25')],'dateEnd':_0x3eaab7[_0x82a1('0x24')][_0x82a1('0x26')]};delete _0x3eaab7[_0x82a1('0x24')]['dateStart'];delete _0x3eaab7['query']['dateEnd'];_0x124914[_0x82a1('0x24')]=_[_0x82a1('0x23')](_0x3eaab7[_0x82a1('0x24')]);_0x124914['filters']=_[_0x82a1('0x27')](_0x124914[_0x82a1('0x28')],_0x124914[_0x82a1('0x24')]);_0x25806d[_0x82a1('0x29')]=_[_0x82a1('0x27')](_0x124914[_0x82a1('0x28')],qs['fields'](_0x3eaab7[_0x82a1('0x24')][_0x82a1('0x2a')]));_0x25806d[_0x82a1('0x29')]=_0x25806d[_0x82a1('0x29')][_0x82a1('0x2b')]?_0x25806d['attributes']:_0x124914[_0x82a1('0x28')];if(!_0x3eaab7['query'][_0x82a1('0x2c')](_0x82a1('0x2d'))){_0x25806d[_0x82a1('0x16')]=qs[_0x82a1('0x16')](_0x3eaab7[_0x82a1('0x24')][_0x82a1('0x16')]);_0x25806d[_0x82a1('0x15')]=qs[_0x82a1('0x15')](_0x3eaab7['query'][_0x82a1('0x15')]);}_0x25806d[_0x82a1('0x2e')]=qs['sort'](_0x3eaab7[_0x82a1('0x24')][_0x82a1('0x2f')]);_0x25806d['where']=qs[_0x82a1('0x30')](_[_0x82a1('0x31')](_0x3eaab7[_0x82a1('0x24')],_0x124914[_0x82a1('0x30')]));if(_0xd0ce4c[_0x82a1('0x25')]){if(_0xd0ce4c[_0x82a1('0x26')]){_0xd0ce4c['dateEnd']=moment(_0xd0ce4c[_0x82a1('0x26')])[_0x82a1('0x32')](0x1,'day');}else{_0xd0ce4c[_0x82a1('0x26')]=moment(_0xd0ce4c['dateStart'])['add'](0x1,_0x82a1('0x33'));}_[_0x82a1('0x34')](_0x25806d[_0x82a1('0x35')],{'createdAt':{'$gte':_0xd0ce4c['dateStart'],'$lte':_0xd0ce4c[_0x82a1('0x26')]}});}if(_0x3eaab7[_0x82a1('0x24')][_0x82a1('0x36')]){_0x25806d['where']=_['merge'](_0x25806d['where'],{'$or':_[_0x82a1('0x37')](_0x25806d[_0x82a1('0x29')],function(_0x872b94){var _0x36bdbf={};_0x36bdbf[_0x872b94]={'$like':'%'+_0x3eaab7[_0x82a1('0x24')][_0x82a1('0x36')]+'%'};return _0x36bdbf;})});}_0x25806d=_[_0x82a1('0x34')]({},_0x25806d,_0x3eaab7['options']);var _0x4ffd31={'where':_0x25806d[_0x82a1('0x35')]};return db['SmsTransferReport'][_0x82a1('0x14')](_0x4ffd31)[_0x82a1('0x1c')](function(_0x57c98a){_0x11b050['count']=_0x57c98a;if(_0x3eaab7[_0x82a1('0x24')][_0x82a1('0x38')]){_0x25806d[_0x82a1('0x39')]=[{'all':!![]}];}return db[_0x82a1('0x21')]['findAll'](_0x25806d);})[_0x82a1('0x1c')](function(_0x352896){_0x11b050[_0x82a1('0x3a')]=_0x352896;return _0x11b050;})[_0x82a1('0x1c')](respondWithFilteredResult(_0x1f9afb,_0x25806d))[_0x82a1('0x3b')](handleError(_0x1f9afb,null));};exports[_0x82a1('0x3c')]=function(_0x342cea,_0xc61765){var _0xa3d1bf={'raw':!![],'where':{'id':_0x342cea['params']['id']}},_0x355ebe={};_0x355ebe[_0x82a1('0x28')]=_['keys'](db[_0x82a1('0x21')][_0x82a1('0x22')]);_0x355ebe[_0x82a1('0x24')]=_['keys'](_0x342cea['query']);_0x355ebe['filters']=_[_0x82a1('0x27')](_0x355ebe[_0x82a1('0x28')],_0x355ebe[_0x82a1('0x24')]);_0xa3d1bf['attributes']=_['intersection'](_0x355ebe[_0x82a1('0x28')],qs[_0x82a1('0x2a')](_0x342cea['query'][_0x82a1('0x2a')]));_0xa3d1bf[_0x82a1('0x29')]=_0xa3d1bf[_0x82a1('0x29')][_0x82a1('0x2b')]?_0xa3d1bf['attributes']:_0x355ebe['model'];if(_0x342cea['query'][_0x82a1('0x38')]){_0xa3d1bf[_0x82a1('0x39')]=[{'all':!![]}];}_0xa3d1bf=_['merge']({},_0xa3d1bf,_0x342cea[_0x82a1('0x3d')]);return db['SmsTransferReport'][_0x82a1('0x3e')](_0xa3d1bf)[_0x82a1('0x1c')](handleEntityNotFound(_0xc61765,null))[_0x82a1('0x1c')](respondWithResult(_0xc61765,null))[_0x82a1('0x3b')](handleError(_0xc61765,null));};exports[_0x82a1('0x3f')]=function(_0x31131a,_0x50df5a){return db[_0x82a1('0x21')][_0x82a1('0x3f')](_0x31131a[_0x82a1('0x40')],{})[_0x82a1('0x1c')](respondWithResult(_0x50df5a,0xc9))[_0x82a1('0x3b')](handleError(_0x50df5a,null));};exports['update']=function(_0x39b25c,_0x42974f){if(_0x39b25c[_0x82a1('0x40')]['id']){delete _0x39b25c['body']['id'];}return db[_0x82a1('0x21')]['find']({'where':{'id':_0x39b25c['params']['id']}})['then'](handleEntityNotFound(_0x42974f,null))[_0x82a1('0x1c')](saveUpdates(_0x39b25c['body'],null))['then'](respondWithResult(_0x42974f,null))[_0x82a1('0x3b')](handleError(_0x42974f,null));};exports['destroy']=function(_0x3d0a08,_0x28c8c4){return db[_0x82a1('0x21')][_0x82a1('0x3e')]({'where':{'id':_0x3d0a08[_0x82a1('0x41')]['id']}})[_0x82a1('0x1c')](handleEntityNotFound(_0x28c8c4,null))[_0x82a1('0x1c')](removeEntity(_0x28c8c4,null))['catch'](handleError(_0x28c8c4,null));};exports[_0x82a1('0x42')]=function(_0x425a33,_0x116445){return db[_0x82a1('0x21')][_0x82a1('0x42')]()['then'](respondWithResult(_0x116445,null))[_0x82a1('0x3b')](handleError(_0x116445,null));}; \ No newline at end of file +var _0x3928=['rows','catch','show','params','include','find','create','body','describe','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','day','add','merge','filter','options','SmsTransferReport','includeAll'];(function(_0x89de57,_0x42069e){var _0x399662=function(_0x33deed){while(--_0x33deed){_0x89de57['push'](_0x89de57['shift']());}};_0x399662(++_0x42069e);}(_0x3928,0x8f));var _0x8392=function(_0x3f251f,_0x4d682e){_0x3f251f=_0x3f251f-0x0;var _0x476e0c=_0x3928[_0x3f251f];return _0x476e0c;};'use strict';var jsonpatch=require(_0x8392('0x0'));var rp=require(_0x8392('0x1'));var moment=require('moment');var BPromise=require(_0x8392('0x2'));var Mustache=require(_0x8392('0x3'));var util=require(_0x8392('0x4'));var path=require(_0x8392('0x5'));var sox=require('sox');var csv=require(_0x8392('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8392('0x7'));var squel=require('squel');var crypto=require(_0x8392('0x8'));var jsforce=require(_0x8392('0x9'));var deskjs=require(_0x8392('0xa'));var toCsv=require('to-csv');var querystring=require(_0x8392('0xb'));var Papa=require(_0x8392('0xc'));var qs=require(_0x8392('0xd'));var logger=require(_0x8392('0xe'))(_0x8392('0xf'));var utils=require(_0x8392('0x10'));var config=require(_0x8392('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x175a5f,_0x27a44d){_0x27a44d=_0x27a44d||0xcc;return function(_0x123d3d){if(_0x123d3d){return _0x175a5f[_0x8392('0x12')](_0x27a44d);}return _0x175a5f[_0x8392('0x13')](_0x27a44d)[_0x8392('0x14')]();};}function respondWithResult(_0x58f875,_0x3e1127){_0x3e1127=_0x3e1127||0xc8;return function(_0x380624){if(_0x380624){return _0x58f875[_0x8392('0x13')](_0x3e1127)[_0x8392('0x15')](_0x380624);}};}function respondWithFilteredResult(_0x28f7df,_0x393f5a){return function(_0x2643e9){if(_0x2643e9){var _0x1788a5=_0x2643e9[_0x8392('0x16')],_0xcab5ff=_0x393f5a[_0x8392('0x17')],_0x3927bd=_0x393f5a['offset']+_0x393f5a['limit'],_0x289dae;if(_0x3927bd>=_0x1788a5){_0x3927bd=_0x1788a5;_0x289dae=0xc8;}else{_0x289dae=0xce;}_0x28f7df[_0x8392('0x13')](_0x289dae);return _0x28f7df['set'](_0x8392('0x18'),_0xcab5ff+'-'+_0x3927bd+'/'+_0x1788a5)['json'](_0x2643e9);}return null;};}function patchUpdates(_0x2f777){return function(_0x2fccb0){try{jsonpatch[_0x8392('0x19')](_0x2fccb0,_0x2f777,!![]);}catch(_0x50ab44){return BPromise[_0x8392('0x1a')](_0x50ab44);}return _0x2fccb0[_0x8392('0x1b')]();};}function saveUpdates(_0x53e946,_0x411f58){return function(_0x1eb376){if(_0x1eb376){return _0x1eb376['update'](_0x53e946)['then'](function(_0xba8b33){return _0xba8b33;});}return null;};}function removeEntity(_0x5d19b7,_0x4aa9e0){return function(_0x4c8d0d){if(_0x4c8d0d){return _0x4c8d0d[_0x8392('0x1c')]()[_0x8392('0x1d')](function(){_0x5d19b7[_0x8392('0x13')](0xcc)[_0x8392('0x14')]();});}};}function handleEntityNotFound(_0x26a8e2,_0x41d0be){return function(_0x5f2516){if(!_0x5f2516){_0x26a8e2['sendStatus'](0x194);}return _0x5f2516;};}function handleError(_0x106220,_0x3d6563){_0x3d6563=_0x3d6563||0x1f4;return function(_0x483fd2){logger[_0x8392('0x1e')](_0x483fd2['stack']);if(_0x483fd2[_0x8392('0x1f')]){delete _0x483fd2[_0x8392('0x1f')];}_0x106220[_0x8392('0x13')](_0x3d6563)[_0x8392('0x20')](_0x483fd2);};}exports[_0x8392('0x21')]=function(_0x301e8a,_0x35517b){var _0xe43308={},_0x4cc260={},_0x2e8dc1={'count':0x0,'rows':[]};var _0x253703=db['SmsTransferReport'][_0x8392('0x22')];_0x4cc260[_0x8392('0x23')]=_[_0x8392('0x24')](_0x253703);var _0xe0d92c={'dateStart':_0x301e8a[_0x8392('0x25')][_0x8392('0x26')],'dateEnd':_0x301e8a[_0x8392('0x25')][_0x8392('0x27')]};delete _0x301e8a['query'][_0x8392('0x26')];delete _0x301e8a['query'][_0x8392('0x27')];_0x4cc260['query']=_[_0x8392('0x24')](_0x301e8a['query']);_0x4cc260[_0x8392('0x28')]=_[_0x8392('0x29')](_0x4cc260[_0x8392('0x23')],_0x4cc260[_0x8392('0x25')]);_0xe43308[_0x8392('0x2a')]=_['intersection'](_0x4cc260[_0x8392('0x23')],qs[_0x8392('0x2b')](_0x301e8a[_0x8392('0x25')][_0x8392('0x2b')]));_0xe43308['attributes']=_0xe43308[_0x8392('0x2a')][_0x8392('0x2c')]?_0xe43308[_0x8392('0x2a')]:_0x4cc260['model'];if(!_0x301e8a[_0x8392('0x25')]['hasOwnProperty'](_0x8392('0x2d'))){_0xe43308[_0x8392('0x2e')]=qs['limit'](_0x301e8a[_0x8392('0x25')][_0x8392('0x2e')]);_0xe43308['offset']=qs['offset'](_0x301e8a[_0x8392('0x25')][_0x8392('0x17')]);}_0xe43308[_0x8392('0x2f')]=qs[_0x8392('0x30')](_0x301e8a[_0x8392('0x25')][_0x8392('0x30')]);_0xe43308[_0x8392('0x31')]=qs[_0x8392('0x28')](_[_0x8392('0x32')](_0x301e8a['query'],_0x4cc260[_0x8392('0x28')]));if(_0xe0d92c[_0x8392('0x26')]){if(_0xe0d92c[_0x8392('0x27')]){_0xe0d92c[_0x8392('0x27')]=moment(_0xe0d92c['dateEnd'])['add'](0x1,_0x8392('0x33'));}else{_0xe0d92c[_0x8392('0x27')]=moment(_0xe0d92c[_0x8392('0x26')])[_0x8392('0x34')](0x1,'day');}_[_0x8392('0x35')](_0xe43308[_0x8392('0x31')],{'createdAt':{'$gte':_0xe0d92c['dateStart'],'$lte':_0xe0d92c[_0x8392('0x27')]}});}if(_0x301e8a[_0x8392('0x25')][_0x8392('0x36')]){_0xe43308[_0x8392('0x31')]=_[_0x8392('0x35')](_0xe43308[_0x8392('0x31')],{'$or':_['map'](_0xe43308[_0x8392('0x2a')],function(_0x18b850){var _0x161c56={};_0x161c56[_0x18b850]={'$like':'%'+_0x301e8a[_0x8392('0x25')]['filter']+'%'};return _0x161c56;})});}_0xe43308=_[_0x8392('0x35')]({},_0xe43308,_0x301e8a[_0x8392('0x37')]);var _0x63a046={'where':_0xe43308[_0x8392('0x31')]};return db[_0x8392('0x38')]['count'](_0x63a046)[_0x8392('0x1d')](function(_0x4f0f5f){_0x2e8dc1['count']=_0x4f0f5f;if(_0x301e8a[_0x8392('0x25')][_0x8392('0x39')]){_0xe43308['include']=[{'all':!![]}];}return db[_0x8392('0x38')]['findAll'](_0xe43308);})[_0x8392('0x1d')](function(_0x47257c){_0x2e8dc1[_0x8392('0x3a')]=_0x47257c;return _0x2e8dc1;})['then'](respondWithFilteredResult(_0x35517b,_0xe43308))[_0x8392('0x3b')](handleError(_0x35517b,null));};exports[_0x8392('0x3c')]=function(_0x32a9e7,_0x31aa34){var _0x17f547={'raw':!![],'where':{'id':_0x32a9e7[_0x8392('0x3d')]['id']}},_0x5c0bcd={};_0x5c0bcd[_0x8392('0x23')]=_[_0x8392('0x24')](db['SmsTransferReport'][_0x8392('0x22')]);_0x5c0bcd[_0x8392('0x25')]=_[_0x8392('0x24')](_0x32a9e7[_0x8392('0x25')]);_0x5c0bcd[_0x8392('0x28')]=_[_0x8392('0x29')](_0x5c0bcd[_0x8392('0x23')],_0x5c0bcd['query']);_0x17f547['attributes']=_[_0x8392('0x29')](_0x5c0bcd[_0x8392('0x23')],qs[_0x8392('0x2b')](_0x32a9e7[_0x8392('0x25')][_0x8392('0x2b')]));_0x17f547['attributes']=_0x17f547['attributes'][_0x8392('0x2c')]?_0x17f547[_0x8392('0x2a')]:_0x5c0bcd['model'];if(_0x32a9e7[_0x8392('0x25')][_0x8392('0x39')]){_0x17f547[_0x8392('0x3e')]=[{'all':!![]}];}_0x17f547=_[_0x8392('0x35')]({},_0x17f547,_0x32a9e7[_0x8392('0x37')]);return db[_0x8392('0x38')][_0x8392('0x3f')](_0x17f547)[_0x8392('0x1d')](handleEntityNotFound(_0x31aa34,null))[_0x8392('0x1d')](respondWithResult(_0x31aa34,null))[_0x8392('0x3b')](handleError(_0x31aa34,null));};exports[_0x8392('0x40')]=function(_0x164153,_0x5314ad){return db[_0x8392('0x38')][_0x8392('0x40')](_0x164153[_0x8392('0x41')],{})[_0x8392('0x1d')](respondWithResult(_0x5314ad,0xc9))[_0x8392('0x3b')](handleError(_0x5314ad,null));};exports['update']=function(_0x5394d5,_0x2a80bd){if(_0x5394d5[_0x8392('0x41')]['id']){delete _0x5394d5[_0x8392('0x41')]['id'];}return db[_0x8392('0x38')][_0x8392('0x3f')]({'where':{'id':_0x5394d5[_0x8392('0x3d')]['id']}})[_0x8392('0x1d')](handleEntityNotFound(_0x2a80bd,null))[_0x8392('0x1d')](saveUpdates(_0x5394d5[_0x8392('0x41')],null))['then'](respondWithResult(_0x2a80bd,null))[_0x8392('0x3b')](handleError(_0x2a80bd,null));};exports[_0x8392('0x1c')]=function(_0x2b18a8,_0x18c471){return db[_0x8392('0x38')][_0x8392('0x3f')]({'where':{'id':_0x2b18a8[_0x8392('0x3d')]['id']}})[_0x8392('0x1d')](handleEntityNotFound(_0x18c471,null))['then'](removeEntity(_0x18c471,null))[_0x8392('0x3b')](handleError(_0x18c471,null));};exports[_0x8392('0x42')]=function(_0x1e56fa,_0x279bb3){return db[_0x8392('0x38')]['describe']()[_0x8392('0x1d')](respondWithResult(_0x279bb3,null))['catch'](handleError(_0x279bb3,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 53a08bd..5bf9cb0 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 _0x9f62=['exports','define','report_sms_transfer','uniqueid','util','api','moment','bluebird'];(function(_0x857aa4,_0x5608f6){var _0x313d1e=function(_0x3937d6){while(--_0x3937d6){_0x857aa4['push'](_0x857aa4['shift']());}};_0x313d1e(++_0x5608f6);}(_0x9f62,0x154));var _0x29f6=function(_0x31bb2c,_0x58a715){_0x31bb2c=_0x31bb2c-0x0;var _0x22afa0=_0x9f62[_0x31bb2c];return _0x22afa0;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var attributes=require('./smsTransferReport.attributes');module[_0x29f6('0x4')]=function(_0x2f0420,_0xefa26c){return _0x2f0420[_0x29f6('0x5')]('SmsTransferReport',attributes,{'tableName':_0x29f6('0x6'),'paranoid':![],'indexes':[{'name':_0x29f6('0x7'),'fields':[_0x29f6('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['util','../../config/logger','api','moment','bluebird','request-promise','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xedd9,0xfc));var _0x9edd=function(_0x764c9,_0x3b04b7){_0x764c9=_0x764c9-0x0;var _0x537c82=_0xedd9[_0x764c9];return _0x537c82;};'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':[{'name':'uniqueid','fields':[_0x9edd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index f417659..9cf2ebe 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 _0x759e=['lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','catch'];(function(_0x37d1f1,_0x4303bc){var _0x5dba02=function(_0xafcd3c){while(--_0xafcd3c){_0x37d1f1['push'](_0x37d1f1['shift']());}};_0x5dba02(++_0x4303bc);}(_0x759e,0x176));var _0xe759=function(_0x3f9c29,_0x50a7cd){_0x3f9c29=_0x3f9c29-0x0;var _0x575ae2=_0x759e[_0x3f9c29];return _0x575ae2;};'use strict';var _=require(_0xe759('0x0'));var util=require('util');var moment=require(_0xe759('0x1'));var BPromise=require(_0xe759('0x2'));var rs=require(_0xe759('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xe759('0x4'));var logger=require(_0xe759('0x5'))(_0xe759('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe759('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42c446,_0x350463,_0x858a8c){return new BPromise(function(_0x3532b3,_0x14a578){return client['request'](_0x42c446,_0x858a8c)[_0xe759('0x8')](function(_0x6348fa){logger['info'](_0xe759('0x9'),_0x350463,'request\x20sent');logger[_0xe759('0xa')](_0xe759('0xb'),_0x350463,'request\x20sent',JSON['stringify'](_0x6348fa));if(_0x6348fa[_0xe759('0xc')]){if(_0x6348fa[_0xe759('0xc')]['code']===0x1f4){logger[_0xe759('0xc')](_0xe759('0x9'),_0x350463,_0x6348fa[_0xe759('0xc')][_0xe759('0xd')]);return _0x14a578(_0x6348fa[_0xe759('0xc')][_0xe759('0xd')]);}logger['error'](_0xe759('0x9'),_0x350463,_0x6348fa[_0xe759('0xc')][_0xe759('0xd')]);return _0x3532b3(_0x6348fa[_0xe759('0xc')][_0xe759('0xd')]);}else{logger[_0xe759('0xe')](_0xe759('0x9'),_0x350463,_0xe759('0xf'));_0x3532b3(_0x6348fa['result'][_0xe759('0xd')]);}})[_0xe759('0x10')](function(_0x3f1a14){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x350463,_0x3f1a14);_0x14a578(_0x3f1a14);});});} \ No newline at end of file +var _0x329e=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch'];(function(_0x40576b,_0x280b79){var _0x39d545=function(_0x3d6c28){while(--_0x3d6c28){_0x40576b['push'](_0x40576b['shift']());}};_0x39d545(++_0x280b79);}(_0x329e,0x114));var _0xe329=function(_0x5d9c53,_0x16e654){_0x5d9c53=_0x5d9c53-0x0;var _0x4f6aef=_0x329e[_0x5d9c53];return _0x4f6aef;};'use strict';var _=require(_0xe329('0x0'));var util=require(_0xe329('0x1'));var moment=require(_0xe329('0x2'));var BPromise=require(_0xe329('0x3'));var rs=require(_0xe329('0x4'));var fs=require('fs');var db=require(_0xe329('0x5'))['db'];var utils=require(_0xe329('0x6'));var logger=require(_0xe329('0x7'))(_0xe329('0x8'));var config=require(_0xe329('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe329('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b9e16,_0x4d8be2,_0x2c5e62){return new BPromise(function(_0x3e2d4b,_0x444b33){return client[_0xe329('0xb')](_0x1b9e16,_0x2c5e62)[_0xe329('0xc')](function(_0x1b2e3b){logger['info'](_0xe329('0xd'),_0x4d8be2,'request\x20sent');logger[_0xe329('0xe')](_0xe329('0xf'),_0x4d8be2,_0xe329('0x10'),JSON['stringify'](_0x1b2e3b));if(_0x1b2e3b[_0xe329('0x11')]){if(_0x1b2e3b[_0xe329('0x11')][_0xe329('0x12')]===0x1f4){logger['error'](_0xe329('0xd'),_0x4d8be2,_0x1b2e3b[_0xe329('0x11')][_0xe329('0x13')]);return _0x444b33(_0x1b2e3b['error'][_0xe329('0x13')]);}logger[_0xe329('0x11')](_0xe329('0xd'),_0x4d8be2,_0x1b2e3b[_0xe329('0x11')][_0xe329('0x13')]);return _0x3e2d4b(_0x1b2e3b[_0xe329('0x11')][_0xe329('0x13')]);}else{logger[_0xe329('0x14')](_0xe329('0xd'),_0x4d8be2,'request\x20sent');_0x3e2d4b(_0x1b2e3b[_0xe329('0x15')][_0xe329('0x13')]);}})[_0xe329('0x16')](function(_0x33873d){logger[_0xe329('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x4d8be2,_0x33873d);_0x444b33(_0x33873d);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 0df0d4b..acb24cd 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 _0xebfc=['get','isAuthenticated','index','show','/:id/download','diskStorage','join','root','originalname','replace','%s-%s%s','basename','extname','now','post','file','put','/:id','update','delete','exports','multer','util','Router','../../components/auth/service','../../config/environment','./sound.controller'];(function(_0x166aa3,_0x263bd0){var _0x15550b=function(_0x2e9484){while(--_0x2e9484){_0x166aa3['push'](_0x166aa3['shift']());}};_0x15550b(++_0x263bd0);}(_0xebfc,0x108));var _0xcebf=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0xebfc[_0x5b7788];return _0x573871;};'use strict';var multer=require(_0xcebf('0x0'));var util=require(_0xcebf('0x1'));var path=require('path');var express=require('express');var router=express[_0xcebf('0x2')]();var auth=require(_0xcebf('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xcebf('0x4'));var controller=require(_0xcebf('0x5'));router[_0xcebf('0x6')]('/',auth[_0xcebf('0x7')](),controller[_0xcebf('0x8')]);router[_0xcebf('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xcebf('0x9')]);router[_0xcebf('0x6')](_0xcebf('0xa'),auth[_0xcebf('0x7')](),controller['download']);var upload=multer({'storage':multer[_0xcebf('0xb')]({'destination':function(_0x20d01d,_0x2d6576,_0x38a6e8){_0x38a6e8(null,path[_0xcebf('0xc')](config[_0xcebf('0xd')],'server/files/sounds/original/'));},'filename':function(_0xc6f89a,_0x330256,_0x580490){_0x330256[_0xcebf('0xe')]=_0x330256[_0xcebf('0xe')][_0xcebf('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x580490(null,util['format'](_0xcebf('0x10'),path[_0xcebf('0x11')](_0x330256[_0xcebf('0xe')],path[_0xcebf('0x12')](_0x330256[_0xcebf('0xe')])),Date[_0xcebf('0x13')](),path[_0xcebf('0x12')](_0x330256[_0xcebf('0xe')])));}})});router[_0xcebf('0x14')]('/',upload['single'](_0xcebf('0x15')),controller['create']);router[_0xcebf('0x16')](_0xcebf('0x17'),auth[_0xcebf('0x7')](),controller[_0xcebf('0x18')]);router[_0xcebf('0x19')](_0xcebf('0x17'),auth['isAuthenticated'](),controller[_0xcebf('0x19')]);module[_0xcebf('0x1a')]=router; \ No newline at end of file +var _0x656d=['delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./sound.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','post','single','file'];(function(_0x1ac2e3,_0x2ccb21){var _0x4ee56b=function(_0x5272e2){while(--_0x5272e2){_0x1ac2e3['push'](_0x1ac2e3['shift']());}};_0x4ee56b(++_0x2ccb21);}(_0x656d,0x16e));var _0xd656=function(_0x210a96,_0x530cae){_0x210a96=_0x210a96-0x0;var _0x3020c0=_0x656d[_0x210a96];return _0x3020c0;};'use strict';var multer=require(_0xd656('0x0'));var util=require(_0xd656('0x1'));var path=require(_0xd656('0x2'));var express=require('express');var router=express[_0xd656('0x3')]();var auth=require(_0xd656('0x4'));var interaction=require(_0xd656('0x5'));var config=require('../../config/environment');var controller=require(_0xd656('0x6'));router[_0xd656('0x7')]('/',auth['isAuthenticated'](),controller[_0xd656('0x8')]);router[_0xd656('0x7')](_0xd656('0x9'),auth[_0xd656('0xa')](),controller[_0xd656('0xb')]);router[_0xd656('0x7')](_0xd656('0xc'),auth[_0xd656('0xa')](),controller[_0xd656('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x190a80,_0xa7d1ed,_0x2bffd0){_0x2bffd0(null,path[_0xd656('0xe')](config[_0xd656('0xf')],_0xd656('0x10')));},'filename':function(_0x1ea623,_0x4e6488,_0x376cd3){_0x4e6488[_0xd656('0x11')]=_0x4e6488[_0xd656('0x11')][_0xd656('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x376cd3(null,util[_0xd656('0x13')](_0xd656('0x14'),path[_0xd656('0x15')](_0x4e6488[_0xd656('0x11')],path[_0xd656('0x16')](_0x4e6488[_0xd656('0x11')])),Date['now'](),path['extname'](_0x4e6488['originalname'])));}})});router[_0xd656('0x17')]('/',upload[_0xd656('0x18')](_0xd656('0x19')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd656('0x1a')]('/:id',auth[_0xd656('0xa')](),controller[_0xd656('0x1a')]);module[_0xd656('0x1b')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index e126049..1be92f3 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 _0x8779=['FLOAT','BIGINT','INTEGER','exports','STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8779,0x1ef));var _0x9877=function(_0x42a29b,_0x5af12c){_0x42a29b=_0x42a29b-0x0;var _0x2e3f4b=_0x8779[_0x42a29b];return _0x2e3f4b;};'use strict';var Sequelize=require('sequelize');module[_0x9877('0x0')]={'name':{'type':Sequelize[_0x9877('0x1')],'unique':_0x9877('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x9877('0x1')]},'display_name':{'type':Sequelize[_0x9877('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x9877('0x1')]},'original_duration':{'type':Sequelize[_0x9877('0x3')]},'original_sampleCount':{'type':Sequelize[_0x9877('0x4')]},'original_channelCount':{'type':Sequelize[_0x9877('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x9877('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x9877('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x9877('0x4')]},'converted_channelCount':{'type':Sequelize[_0x9877('0x5')]},'converted_bitRate':{'type':Sequelize[_0x9877('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x9877('0x5')]}}; \ No newline at end of file +var _0x904a=['BIGINT','INTEGER','sequelize','name','STRING','FLOAT'];(function(_0x1fd622,_0x96bedc){var _0x490623=function(_0x54627f){while(--_0x54627f){_0x1fd622['push'](_0x1fd622['shift']());}};_0x490623(++_0x96bedc);}(_0x904a,0x1d0));var _0xa904=function(_0x55b2c4,_0x2f06f9){_0x55b2c4=_0x55b2c4-0x0;var _0x5d35c9=_0x904a[_0x55b2c4];return _0x5d35c9;};'use strict';var Sequelize=require(_0xa904('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xa904('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0xa904('0x2')]},'display_name':{'type':Sequelize[_0xa904('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xa904('0x2')]},'original_duration':{'type':Sequelize[_0xa904('0x3')]},'original_sampleCount':{'type':Sequelize[_0xa904('0x4')]},'original_channelCount':{'type':Sequelize[_0xa904('0x5')]},'original_bitRate':{'type':Sequelize[_0xa904('0x4')]},'original_sampleRate':{'type':Sequelize[_0xa904('0x5')]},'converted_format':{'type':Sequelize[_0xa904('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xa904('0x4')]},'converted_channelCount':{'type':Sequelize[_0xa904('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xa904('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 0741c30..1fda523 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 _0x8162=['duration','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','send','update','pick','description','original_format','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','count','offset','status','Content-Range','save','then','destroy','end','error','name','index','Sound','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','length','nolimit','limit','order','sort','where','add','day','merge','filter','options','include','rows','catch','show','params','fields','includeAll','find','download','save_name','converted_format','join','server/files/sounds/converted','Sequelize','ValidationError','root','format','%s.%s','create','file','originalname','extname','basename','filename','substring','wav','server/files/sounds/original','info','chmodSync','0777','transcode','unlinkSync','src','original_duration'];(function(_0xfd8dcd,_0x537966){var _0x2283b4=function(_0x57fdbb){while(--_0x57fdbb){_0xfd8dcd['push'](_0xfd8dcd['shift']());}};_0x2283b4(++_0x537966);}(_0x8162,0x139));var _0x2816=function(_0x10d618,_0x1f1c82){_0x10d618=_0x10d618-0x0;var _0x57d044=_0x8162[_0x10d618];return _0x57d044;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2816('0x0'));var BPromise=require(_0x2816('0x1'));var Mustache=require('mustache');var util=require(_0x2816('0x2'));var path=require(_0x2816('0x3'));var sox=require(_0x2816('0x4'));var csv=require(_0x2816('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2816('0x6'));var crypto=require(_0x2816('0x7'));var jsforce=require(_0x2816('0x8'));var deskjs=require(_0x2816('0x9'));var toCsv=require(_0x2816('0x5'));var querystring=require('querystring');var Papa=require(_0x2816('0xa'));var qs=require('../../components/parsers/qs');var logger=require(_0x2816('0xb'))('api');var utils=require(_0x2816('0xc'));var config=require(_0x2816('0xd'));var db=require(_0x2816('0xe'))['db'];function respondWithStatusCode(_0x560761,_0x3b882a){_0x3b882a=_0x3b882a||0xcc;return function(_0x41b939){if(_0x41b939){return _0x560761[_0x2816('0xf')](_0x3b882a);}return _0x560761['status'](_0x3b882a)['end']();};}function respondWithResult(_0x53b290,_0xefedba){_0xefedba=_0xefedba||0xc8;return function(_0x33488e){if(_0x33488e){return _0x53b290['status'](_0xefedba)[_0x2816('0x10')](_0x33488e);}};}function respondWithFilteredResult(_0x1d1e56,_0x428286){return function(_0x79b9c){if(_0x79b9c){var _0x9a8a38=_0x79b9c[_0x2816('0x11')],_0x2d21ed=_0x428286['offset'],_0x3a7061=_0x428286[_0x2816('0x12')]+_0x428286['limit'],_0x4ccfdf;if(_0x3a7061>=_0x9a8a38){_0x3a7061=_0x9a8a38;_0x4ccfdf=0xc8;}else{_0x4ccfdf=0xce;}_0x1d1e56[_0x2816('0x13')](_0x4ccfdf);return _0x1d1e56['set'](_0x2816('0x14'),_0x2d21ed+'-'+_0x3a7061+'/'+_0x9a8a38)[_0x2816('0x10')](_0x79b9c);}return null;};}function patchUpdates(_0x1fe591){return function(_0x4e935d){try{jsonpatch['apply'](_0x4e935d,_0x1fe591,!![]);}catch(_0x587e8f){return BPromise['reject'](_0x587e8f);}return _0x4e935d[_0x2816('0x15')]();};}function saveUpdates(_0x19d746,_0x1b7ec1){return function(_0x4d3a63){if(_0x4d3a63){return _0x4d3a63['update'](_0x19d746)[_0x2816('0x16')](function(_0x3ed68c){return _0x3ed68c;});}return null;};}function removeEntity(_0x5f2485,_0x463c61){return function(_0x2a0575){if(_0x2a0575){return _0x2a0575[_0x2816('0x17')]()[_0x2816('0x16')](function(){_0x5f2485[_0x2816('0x13')](0xcc)[_0x2816('0x18')]();});}};}function handleEntityNotFound(_0x768b6d,_0x1cb208){return function(_0x1e84c3){if(!_0x1e84c3){_0x768b6d[_0x2816('0xf')](0x194);}return _0x1e84c3;};}function handleError(_0x316c95,_0x2c894e){_0x2c894e=_0x2c894e||0x1f4;return function(_0x26c63e){logger[_0x2816('0x19')](_0x26c63e['stack']);if(_0x26c63e[_0x2816('0x1a')]){delete _0x26c63e[_0x2816('0x1a')];}_0x316c95[_0x2816('0x13')](_0x2c894e)['send'](_0x26c63e);};}exports[_0x2816('0x1b')]=function(_0x7b8f4a,_0x531b15){var _0x12ec22={},_0x9e5943={},_0x5da99f={'count':0x0,'rows':[]};var _0x1d3bd4=db[_0x2816('0x1c')][_0x2816('0x1d')];_0x9e5943[_0x2816('0x1e')]=_[_0x2816('0x1f')](_0x1d3bd4);var _0x113d72={'dateStart':_0x7b8f4a[_0x2816('0x20')]['dateStart'],'dateEnd':_0x7b8f4a[_0x2816('0x20')][_0x2816('0x21')]};delete _0x7b8f4a[_0x2816('0x20')][_0x2816('0x22')];delete _0x7b8f4a[_0x2816('0x20')][_0x2816('0x21')];_0x9e5943[_0x2816('0x20')]=_[_0x2816('0x1f')](_0x7b8f4a['query']);_0x9e5943[_0x2816('0x23')]=_[_0x2816('0x24')](_0x9e5943[_0x2816('0x1e')],_0x9e5943['query']);_0x12ec22[_0x2816('0x25')]=_[_0x2816('0x24')](_0x9e5943[_0x2816('0x1e')],qs['fields'](_0x7b8f4a[_0x2816('0x20')]['fields']));_0x12ec22[_0x2816('0x25')]=_0x12ec22[_0x2816('0x25')][_0x2816('0x26')]?_0x12ec22[_0x2816('0x25')]:_0x9e5943[_0x2816('0x1e')];if(!_0x7b8f4a[_0x2816('0x20')]['hasOwnProperty'](_0x2816('0x27'))){_0x12ec22[_0x2816('0x28')]=qs[_0x2816('0x28')](_0x7b8f4a[_0x2816('0x20')][_0x2816('0x28')]);_0x12ec22[_0x2816('0x12')]=qs[_0x2816('0x12')](_0x7b8f4a[_0x2816('0x20')][_0x2816('0x12')]);}_0x12ec22[_0x2816('0x29')]=qs[_0x2816('0x2a')](_0x7b8f4a[_0x2816('0x20')]['sort']);_0x12ec22[_0x2816('0x2b')]=qs[_0x2816('0x23')](_['pick'](_0x7b8f4a[_0x2816('0x20')],_0x9e5943[_0x2816('0x23')]));if(_0x113d72[_0x2816('0x22')]){if(_0x113d72[_0x2816('0x21')]){_0x113d72[_0x2816('0x21')]=moment(_0x113d72[_0x2816('0x21')])[_0x2816('0x2c')](0x1,_0x2816('0x2d'));}else{_0x113d72[_0x2816('0x21')]=moment(_0x113d72['dateStart'])[_0x2816('0x2c')](0x1,'day');}_[_0x2816('0x2e')](_0x12ec22[_0x2816('0x2b')],{'createdAt':{'$gte':_0x113d72[_0x2816('0x22')],'$lte':_0x113d72['dateEnd']}});}if(_0x7b8f4a[_0x2816('0x20')][_0x2816('0x2f')]){_0x12ec22[_0x2816('0x2b')]=_[_0x2816('0x2e')](_0x12ec22['where'],{'$or':_['map'](_0x12ec22[_0x2816('0x25')],function(_0x13b655){var _0x1d235c={};_0x1d235c[_0x13b655]={'$like':'%'+_0x7b8f4a[_0x2816('0x20')][_0x2816('0x2f')]+'%'};return _0x1d235c;})});}_0x12ec22=_['merge']({},_0x12ec22,_0x7b8f4a[_0x2816('0x30')]);var _0x31f799={'where':_0x12ec22[_0x2816('0x2b')]};return db['Sound']['count'](_0x31f799)['then'](function(_0x26b51c){_0x5da99f[_0x2816('0x11')]=_0x26b51c;if(_0x7b8f4a['query']['includeAll']){_0x12ec22[_0x2816('0x31')]=[{'all':!![]}];}return db['Sound']['findAll'](_0x12ec22);})[_0x2816('0x16')](function(_0x2250bc){_0x5da99f[_0x2816('0x32')]=_0x2250bc;return _0x5da99f;})[_0x2816('0x16')](respondWithFilteredResult(_0x531b15,_0x12ec22))[_0x2816('0x33')](handleError(_0x531b15,null));};exports[_0x2816('0x34')]=function(_0x1c9f78,_0x3e9581){var _0x127045={'raw':!![],'where':{'id':_0x1c9f78[_0x2816('0x35')]['id']}},_0x20c679={};_0x20c679[_0x2816('0x1e')]=_[_0x2816('0x1f')](db[_0x2816('0x1c')][_0x2816('0x1d')]);_0x20c679[_0x2816('0x20')]=_[_0x2816('0x1f')](_0x1c9f78['query']);_0x20c679[_0x2816('0x23')]=_['intersection'](_0x20c679[_0x2816('0x1e')],_0x20c679[_0x2816('0x20')]);_0x127045[_0x2816('0x25')]=_['intersection'](_0x20c679['model'],qs[_0x2816('0x36')](_0x1c9f78[_0x2816('0x20')][_0x2816('0x36')]));_0x127045[_0x2816('0x25')]=_0x127045[_0x2816('0x25')][_0x2816('0x26')]?_0x127045[_0x2816('0x25')]:_0x20c679[_0x2816('0x1e')];if(_0x1c9f78['query'][_0x2816('0x37')]){_0x127045[_0x2816('0x31')]=[{'all':!![]}];}_0x127045=_[_0x2816('0x2e')]({},_0x127045,_0x1c9f78[_0x2816('0x30')]);return db[_0x2816('0x1c')][_0x2816('0x38')](_0x127045)[_0x2816('0x16')](handleEntityNotFound(_0x3e9581,null))[_0x2816('0x16')](respondWithResult(_0x3e9581,null))[_0x2816('0x33')](handleError(_0x3e9581,null));};exports[_0x2816('0x39')]=function(_0x237615,_0x124625,_0x46ba12){return db[_0x2816('0x1c')]['find']({'where':{'id':_0x237615[_0x2816('0x35')]['id']},'attributes':[_0x2816('0x1a'),_0x2816('0x3a'),_0x2816('0x3b')],'raw':!![]})['then'](handleEntityNotFound(_0x124625,null))[_0x2816('0x16')](function(_0x28fac4){if(_0x28fac4){if(!fs['existsSync'](path[_0x2816('0x3c')](config['root'],_0x2816('0x3d'),_0x28fac4[_0x2816('0x3a')]+'.'+_0x28fac4['converted_format']))){throw new db[(_0x2816('0x3e'))][(_0x2816('0x3f'))]('Sound\x20not\x20found');}return _0x124625[_0x2816('0x39')](path[_0x2816('0x3c')](config[_0x2816('0x40')],_0x2816('0x3d'),util[_0x2816('0x41')](_0x2816('0x42'),_0x28fac4[_0x2816('0x3a')],_0x28fac4[_0x2816('0x3b')])),util['format'](_0x2816('0x42'),_0x28fac4[_0x2816('0x1a')],_0x28fac4['converted_format']));}return null;})[_0x2816('0x33')](handleError(_0x124625,null));};exports[_0x2816('0x43')]=function(_0x174e19,_0x1debb2,_0x45b735){var _0x4b434c={'name':path['basename'](_0x174e19[_0x2816('0x44')][_0x2816('0x45')],path[_0x2816('0x46')](_0x174e19['file'][_0x2816('0x45')])),'save_name':path[_0x2816('0x47')](_0x174e19[_0x2816('0x44')][_0x2816('0x48')],path['extname'](_0x174e19[_0x2816('0x44')][_0x2816('0x48')])),'original_format':path[_0x2816('0x46')](_0x174e19[_0x2816('0x44')]['originalname'])[_0x2816('0x49')](0x1),'converted_format':_0x2816('0x4a')};var _0x8d15a9=path[_0x2816('0x3c')](config[_0x2816('0x40')],_0x2816('0x4b'),_0x174e19[_0x2816('0x44')][_0x2816('0x48')]);var _0x2d4958=path['join'](config[_0x2816('0x40')],'server/files/sounds/converted',util['format']('%s.%s',path[_0x2816('0x47')](_0x174e19[_0x2816('0x44')][_0x2816('0x48')],path[_0x2816('0x46')](_0x174e19[_0x2816('0x44')][_0x2816('0x48')])),_0x4b434c['converted_format']));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x8d15a9);logger[_0x2816('0x4c')]('Sound\x20upload\x20destination:\x20%s',_0x2d4958);try{fs[_0x2816('0x4d')](_0x8d15a9,parseInt(_0x2816('0x4e'),0x8));var _0x36a2fd=sox[_0x2816('0x4f')](_0x8d15a9,_0x2d4958,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x36a2fd['on']('error',function(_0x4667e9){fs[_0x2816('0x50')](_0x8d15a9);_0x1debb2[_0x2816('0x13')](0x1f4)['send'](_0x4667e9);});_0x36a2fd['on'](_0x2816('0x51'),function(_0x338470){_0x4b434c[_0x2816('0x52')]=isNaN(_0x338470['duration'])?null:_0x338470[_0x2816('0x53')]*0x3e8;_0x4b434c['original_sampleCount']=isNaN(_0x338470[_0x2816('0x54')])?null:_0x338470['sampleCount'];_0x4b434c['original_channelCount']=isNaN(_0x338470[_0x2816('0x55')])?null:_0x338470['channelCount'];_0x4b434c[_0x2816('0x56')]=isNaN(_0x338470['bitRate'])?null:_0x338470[_0x2816('0x57')];_0x4b434c[_0x2816('0x58')]=isNaN(_0x338470[_0x2816('0x59')])?null:_0x338470['sampleRate'];});_0x36a2fd['on']('dest',function(_0x228255){_0x4b434c[_0x2816('0x5a')]=isNaN(_0x228255['duration'])?null:_0x228255[_0x2816('0x53')]*0x3e8;_0x4b434c['converted_sampleCount']=isNaN(_0x228255[_0x2816('0x54')])?null:_0x228255[_0x2816('0x54')];_0x4b434c[_0x2816('0x5b')]=isNaN(_0x228255[_0x2816('0x55')])?null:_0x228255[_0x2816('0x55')];_0x4b434c[_0x2816('0x5c')]=isNaN(_0x228255[_0x2816('0x57')])?null:_0x228255[_0x2816('0x57')];_0x4b434c[_0x2816('0x5d')]=isNaN(_0x228255[_0x2816('0x59')])?null:_0x228255['sampleRate'];});_0x36a2fd['on'](_0x2816('0x18'),function(){fs[_0x2816('0x4d')](_0x2d4958,parseInt(_0x2816('0x4e'),0x8));return db['Sound'][_0x2816('0x43')](_0x4b434c)[_0x2816('0x16')](respondWithResult(_0x1debb2,null))[_0x2816('0x33')](handleError(_0x1debb2,null));});_0x36a2fd['start']();}catch(_0x3f8209){_0x1debb2[_0x2816('0x13')](0x1f4)[_0x2816('0x5e')](_0x3f8209);}};exports[_0x2816('0x5f')]=function(_0x42e469,_0x5c332f,_0xf22fb0){return db['Sound'][_0x2816('0x38')]({'where':{'id':_0x42e469[_0x2816('0x35')]['id']}})['then'](handleEntityNotFound(_0x5c332f,null))['then'](saveUpdates(_[_0x2816('0x60')](_0x42e469['body'],[_0x2816('0x1a'),_0x2816('0x61')]),null))['then'](respondWithResult(_0x5c332f,null))[_0x2816('0x33')](handleError(_0x5c332f,null));};exports['delete']=function(_0x1bd4cc,_0x13605c,_0x522852){return db[_0x2816('0x1c')][_0x2816('0x38')]({'where':{'id':_0x1bd4cc['params']['id']}})[_0x2816('0x16')](function(_0x2d7c7a){if(_0x2d7c7a){return _0x2d7c7a[_0x2816('0x17')]();}})[_0x2816('0x16')](function(_0x1e76f4){var _0x207e10=path[_0x2816('0x3c')](config[_0x2816('0x40')],'server/files/sounds/original',util[_0x2816('0x41')]('%s.%s',_0x1e76f4[_0x2816('0x3a')],_0x1e76f4[_0x2816('0x62')]));var _0x331f6e=path[_0x2816('0x3c')](config['root'],'server/files/sounds/converted',util[_0x2816('0x41')](_0x2816('0x42'),_0x1e76f4[_0x2816('0x3a')],_0x1e76f4[_0x2816('0x3b')]));fs[_0x2816('0x50')](_0x207e10);fs[_0x2816('0x50')](_0x331f6e);return _0x1e76f4;})[_0x2816('0x16')](function(_0x1dac13){if(_0x1dac13){return _0x13605c['status'](0xcc)['end']();}})[_0x2816('0x16')](handleEntityNotFound(_0x13605c,null))['catch'](handleError(_0x13605c,null));}; \ No newline at end of file +var _0x6c80=['findAll','rows','catch','include','options','find','download','params','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','format','save_name','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','%s.%s','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','0777','transcode','error','unlinkSync','src','original_duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','original_sampleRate','sampleRate','dest','converted_duration','duration','converted_sampleCount','converted_channelCount','converted_bitRate','bitRate','converted_sampleRate','chmodSync','start','body','delete','original_format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','end','stack','name','send','Sound','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','add','day','merge','filter','map','includeAll'];(function(_0x568de8,_0x45eab3){var _0xe1734b=function(_0x58f089){while(--_0x58f089){_0x568de8['push'](_0x568de8['shift']());}};_0xe1734b(++_0x45eab3);}(_0x6c80,0x18e));var _0x06c8=function(_0x2b742c,_0x8867c5){_0x2b742c=_0x2b742c-0x0;var _0x54c654=_0x6c80[_0x2b742c];return _0x54c654;};'use strict';var jsonpatch=require(_0x06c8('0x0'));var rp=require(_0x06c8('0x1'));var moment=require(_0x06c8('0x2'));var BPromise=require(_0x06c8('0x3'));var Mustache=require(_0x06c8('0x4'));var util=require(_0x06c8('0x5'));var path=require(_0x06c8('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x06c8('0x7'));var fs=require('fs');var _=require(_0x06c8('0x8'));var squel=require(_0x06c8('0x9'));var crypto=require('crypto');var jsforce=require(_0x06c8('0xa'));var deskjs=require(_0x06c8('0xb'));var toCsv=require('to-csv');var querystring=require(_0x06c8('0xc'));var Papa=require(_0x06c8('0xd'));var qs=require(_0x06c8('0xe'));var logger=require(_0x06c8('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x06c8('0x10'));var db=require(_0x06c8('0x11'))['db'];function respondWithStatusCode(_0x3e55fa,_0x39bce2){_0x39bce2=_0x39bce2||0xcc;return function(_0xc30ef3){if(_0xc30ef3){return _0x3e55fa[_0x06c8('0x12')](_0x39bce2);}return _0x3e55fa[_0x06c8('0x13')](_0x39bce2)['end']();};}function respondWithResult(_0x3a86fd,_0x4557f5){_0x4557f5=_0x4557f5||0xc8;return function(_0x53ec4b){if(_0x53ec4b){return _0x3a86fd[_0x06c8('0x13')](_0x4557f5)['json'](_0x53ec4b);}};}function respondWithFilteredResult(_0x37144e,_0x78747a){return function(_0x9dddd5){if(_0x9dddd5){var _0x541491=_0x9dddd5[_0x06c8('0x14')],_0x14a203=_0x78747a[_0x06c8('0x15')],_0x356189=_0x78747a['offset']+_0x78747a[_0x06c8('0x16')],_0x11b468;if(_0x356189>=_0x541491){_0x356189=_0x541491;_0x11b468=0xc8;}else{_0x11b468=0xce;}_0x37144e[_0x06c8('0x13')](_0x11b468);return _0x37144e[_0x06c8('0x17')](_0x06c8('0x18'),_0x14a203+'-'+_0x356189+'/'+_0x541491)[_0x06c8('0x19')](_0x9dddd5);}return null;};}function patchUpdates(_0x4283c1){return function(_0x488d69){try{jsonpatch['apply'](_0x488d69,_0x4283c1,!![]);}catch(_0x4017c5){return BPromise[_0x06c8('0x1a')](_0x4017c5);}return _0x488d69[_0x06c8('0x1b')]();};}function saveUpdates(_0x145ee3,_0x2fbd2c){return function(_0x278832){if(_0x278832){return _0x278832[_0x06c8('0x1c')](_0x145ee3)[_0x06c8('0x1d')](function(_0x50dc95){return _0x50dc95;});}return null;};}function removeEntity(_0x4aa8bb,_0x517da4){return function(_0x574a8d){if(_0x574a8d){return _0x574a8d[_0x06c8('0x1e')]()[_0x06c8('0x1d')](function(){_0x4aa8bb['status'](0xcc)[_0x06c8('0x1f')]();});}};}function handleEntityNotFound(_0x4c4691,_0x3b0f10){return function(_0x4aa3cc){if(!_0x4aa3cc){_0x4c4691[_0x06c8('0x12')](0x194);}return _0x4aa3cc;};}function handleError(_0x3bc57c,_0x5aeb62){_0x5aeb62=_0x5aeb62||0x1f4;return function(_0x236175){logger['error'](_0x236175[_0x06c8('0x20')]);if(_0x236175['name']){delete _0x236175[_0x06c8('0x21')];}_0x3bc57c[_0x06c8('0x13')](_0x5aeb62)[_0x06c8('0x22')](_0x236175);};}exports['index']=function(_0x540418,_0x24e3f4){var _0x624366={},_0x95efb={},_0x13ef31={'count':0x0,'rows':[]};var _0x443a2a=db[_0x06c8('0x23')][_0x06c8('0x24')];_0x95efb[_0x06c8('0x25')]=_[_0x06c8('0x26')](_0x443a2a);var _0x19e163={'dateStart':_0x540418['query']['dateStart'],'dateEnd':_0x540418[_0x06c8('0x27')][_0x06c8('0x28')]};delete _0x540418['query'][_0x06c8('0x29')];delete _0x540418['query'][_0x06c8('0x28')];_0x95efb[_0x06c8('0x27')]=_[_0x06c8('0x26')](_0x540418['query']);_0x95efb[_0x06c8('0x2a')]=_[_0x06c8('0x2b')](_0x95efb[_0x06c8('0x25')],_0x95efb[_0x06c8('0x27')]);_0x624366['attributes']=_[_0x06c8('0x2b')](_0x95efb[_0x06c8('0x25')],qs['fields'](_0x540418[_0x06c8('0x27')][_0x06c8('0x2c')]));_0x624366[_0x06c8('0x2d')]=_0x624366[_0x06c8('0x2d')][_0x06c8('0x2e')]?_0x624366[_0x06c8('0x2d')]:_0x95efb['model'];if(!_0x540418[_0x06c8('0x27')][_0x06c8('0x2f')]('nolimit')){_0x624366['limit']=qs[_0x06c8('0x16')](_0x540418[_0x06c8('0x27')][_0x06c8('0x16')]);_0x624366['offset']=qs[_0x06c8('0x15')](_0x540418[_0x06c8('0x27')]['offset']);}_0x624366[_0x06c8('0x30')]=qs[_0x06c8('0x31')](_0x540418['query']['sort']);_0x624366[_0x06c8('0x32')]=qs[_0x06c8('0x2a')](_[_0x06c8('0x33')](_0x540418['query'],_0x95efb[_0x06c8('0x2a')]));if(_0x19e163[_0x06c8('0x29')]){if(_0x19e163[_0x06c8('0x28')]){_0x19e163['dateEnd']=moment(_0x19e163[_0x06c8('0x28')])[_0x06c8('0x34')](0x1,_0x06c8('0x35'));}else{_0x19e163[_0x06c8('0x28')]=moment(_0x19e163['dateStart'])['add'](0x1,'day');}_[_0x06c8('0x36')](_0x624366[_0x06c8('0x32')],{'createdAt':{'$gte':_0x19e163[_0x06c8('0x29')],'$lte':_0x19e163['dateEnd']}});}if(_0x540418['query'][_0x06c8('0x37')]){_0x624366[_0x06c8('0x32')]=_['merge'](_0x624366[_0x06c8('0x32')],{'$or':_[_0x06c8('0x38')](_0x624366[_0x06c8('0x2d')],function(_0x4f4065){var _0x1e027={};_0x1e027[_0x4f4065]={'$like':'%'+_0x540418['query'][_0x06c8('0x37')]+'%'};return _0x1e027;})});}_0x624366=_[_0x06c8('0x36')]({},_0x624366,_0x540418['options']);var _0x38c201={'where':_0x624366[_0x06c8('0x32')]};return db[_0x06c8('0x23')]['count'](_0x38c201)['then'](function(_0x4abb32){_0x13ef31['count']=_0x4abb32;if(_0x540418[_0x06c8('0x27')][_0x06c8('0x39')]){_0x624366['include']=[{'all':!![]}];}return db[_0x06c8('0x23')][_0x06c8('0x3a')](_0x624366);})[_0x06c8('0x1d')](function(_0x369f92){_0x13ef31[_0x06c8('0x3b')]=_0x369f92;return _0x13ef31;})['then'](respondWithFilteredResult(_0x24e3f4,_0x624366))[_0x06c8('0x3c')](handleError(_0x24e3f4,null));};exports['show']=function(_0x136cdd,_0xe5f439){var _0x57b3ad={'raw':!![],'where':{'id':_0x136cdd['params']['id']}},_0x3fd151={};_0x3fd151[_0x06c8('0x25')]=_['keys'](db[_0x06c8('0x23')][_0x06c8('0x24')]);_0x3fd151[_0x06c8('0x27')]=_['keys'](_0x136cdd['query']);_0x3fd151['filters']=_[_0x06c8('0x2b')](_0x3fd151[_0x06c8('0x25')],_0x3fd151[_0x06c8('0x27')]);_0x57b3ad[_0x06c8('0x2d')]=_[_0x06c8('0x2b')](_0x3fd151['model'],qs[_0x06c8('0x2c')](_0x136cdd[_0x06c8('0x27')][_0x06c8('0x2c')]));_0x57b3ad[_0x06c8('0x2d')]=_0x57b3ad[_0x06c8('0x2d')][_0x06c8('0x2e')]?_0x57b3ad[_0x06c8('0x2d')]:_0x3fd151[_0x06c8('0x25')];if(_0x136cdd[_0x06c8('0x27')][_0x06c8('0x39')]){_0x57b3ad[_0x06c8('0x3d')]=[{'all':!![]}];}_0x57b3ad=_['merge']({},_0x57b3ad,_0x136cdd[_0x06c8('0x3e')]);return db[_0x06c8('0x23')][_0x06c8('0x3f')](_0x57b3ad)[_0x06c8('0x1d')](handleEntityNotFound(_0xe5f439,null))[_0x06c8('0x1d')](respondWithResult(_0xe5f439,null))[_0x06c8('0x3c')](handleError(_0xe5f439,null));};exports[_0x06c8('0x40')]=function(_0x5e62cb,_0x103364,_0x3c33a8){return db[_0x06c8('0x23')][_0x06c8('0x3f')]({'where':{'id':_0x5e62cb[_0x06c8('0x41')]['id']},'attributes':[_0x06c8('0x21'),'save_name',_0x06c8('0x42')],'raw':!![]})[_0x06c8('0x1d')](handleEntityNotFound(_0x103364,null))['then'](function(_0x5d5e54){if(_0x5d5e54){if(!fs[_0x06c8('0x43')](path[_0x06c8('0x44')](config[_0x06c8('0x45')],_0x06c8('0x46'),_0x5d5e54['save_name']+'.'+_0x5d5e54[_0x06c8('0x42')]))){throw new db[(_0x06c8('0x47'))]['ValidationError'](_0x06c8('0x48'));}return _0x103364['download'](path[_0x06c8('0x44')](config['root'],_0x06c8('0x46'),util[_0x06c8('0x49')]('%s.%s',_0x5d5e54[_0x06c8('0x4a')],_0x5d5e54[_0x06c8('0x42')])),util['format']('%s.%s',_0x5d5e54[_0x06c8('0x21')],_0x5d5e54[_0x06c8('0x42')]));}return null;})['catch'](handleError(_0x103364,null));};exports[_0x06c8('0x4b')]=function(_0x32d882,_0x436dda,_0x3955cf){var _0x5f347e={'name':path[_0x06c8('0x4c')](_0x32d882[_0x06c8('0x4d')][_0x06c8('0x4e')],path[_0x06c8('0x4f')](_0x32d882[_0x06c8('0x4d')][_0x06c8('0x4e')])),'save_name':path['basename'](_0x32d882[_0x06c8('0x4d')][_0x06c8('0x50')],path['extname'](_0x32d882[_0x06c8('0x4d')][_0x06c8('0x50')])),'original_format':path[_0x06c8('0x4f')](_0x32d882[_0x06c8('0x4d')][_0x06c8('0x4e')])[_0x06c8('0x51')](0x1),'converted_format':_0x06c8('0x52')};var _0x207ec5=path[_0x06c8('0x44')](config[_0x06c8('0x45')],_0x06c8('0x53'),_0x32d882['file'][_0x06c8('0x50')]);var _0x2cc8aa=path[_0x06c8('0x44')](config[_0x06c8('0x45')],_0x06c8('0x46'),util['format'](_0x06c8('0x54'),path[_0x06c8('0x4c')](_0x32d882[_0x06c8('0x4d')]['filename'],path[_0x06c8('0x4f')](_0x32d882['file'][_0x06c8('0x50')])),_0x5f347e[_0x06c8('0x42')]));logger['info'](_0x06c8('0x55'),_0x207ec5);logger[_0x06c8('0x56')](_0x06c8('0x57'),_0x2cc8aa);try{fs['chmodSync'](_0x207ec5,parseInt(_0x06c8('0x58'),0x8));var _0x491728=sox[_0x06c8('0x59')](_0x207ec5,_0x2cc8aa,{'sampleRate':0x1f40,'format':_0x06c8('0x52'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x491728['on'](_0x06c8('0x5a'),function(_0x5bfee8){fs[_0x06c8('0x5b')](_0x207ec5);_0x436dda[_0x06c8('0x13')](0x1f4)[_0x06c8('0x22')](_0x5bfee8);});_0x491728['on'](_0x06c8('0x5c'),function(_0x2a0df1){_0x5f347e[_0x06c8('0x5d')]=isNaN(_0x2a0df1['duration'])?null:_0x2a0df1['duration']*0x3e8;_0x5f347e[_0x06c8('0x5e')]=isNaN(_0x2a0df1[_0x06c8('0x5f')])?null:_0x2a0df1['sampleCount'];_0x5f347e[_0x06c8('0x60')]=isNaN(_0x2a0df1[_0x06c8('0x61')])?null:_0x2a0df1[_0x06c8('0x61')];_0x5f347e[_0x06c8('0x62')]=isNaN(_0x2a0df1['bitRate'])?null:_0x2a0df1['bitRate'];_0x5f347e[_0x06c8('0x63')]=isNaN(_0x2a0df1[_0x06c8('0x64')])?null:_0x2a0df1['sampleRate'];});_0x491728['on'](_0x06c8('0x65'),function(_0x3b0685){_0x5f347e[_0x06c8('0x66')]=isNaN(_0x3b0685['duration'])?null:_0x3b0685[_0x06c8('0x67')]*0x3e8;_0x5f347e[_0x06c8('0x68')]=isNaN(_0x3b0685[_0x06c8('0x5f')])?null:_0x3b0685['sampleCount'];_0x5f347e[_0x06c8('0x69')]=isNaN(_0x3b0685[_0x06c8('0x61')])?null:_0x3b0685[_0x06c8('0x61')];_0x5f347e[_0x06c8('0x6a')]=isNaN(_0x3b0685[_0x06c8('0x6b')])?null:_0x3b0685['bitRate'];_0x5f347e[_0x06c8('0x6c')]=isNaN(_0x3b0685[_0x06c8('0x64')])?null:_0x3b0685[_0x06c8('0x64')];});_0x491728['on']('end',function(){fs[_0x06c8('0x6d')](_0x2cc8aa,parseInt(_0x06c8('0x58'),0x8));return db[_0x06c8('0x23')]['create'](_0x5f347e)[_0x06c8('0x1d')](respondWithResult(_0x436dda,null))[_0x06c8('0x3c')](handleError(_0x436dda,null));});_0x491728[_0x06c8('0x6e')]();}catch(_0x5c9880){_0x436dda['status'](0x1f4)[_0x06c8('0x22')](_0x5c9880);}};exports[_0x06c8('0x1c')]=function(_0x5c5f84,_0x250e5c,_0x12074d){return db[_0x06c8('0x23')][_0x06c8('0x3f')]({'where':{'id':_0x5c5f84[_0x06c8('0x41')]['id']}})[_0x06c8('0x1d')](handleEntityNotFound(_0x250e5c,null))['then'](saveUpdates(_['pick'](_0x5c5f84[_0x06c8('0x6f')],[_0x06c8('0x21'),'description']),null))['then'](respondWithResult(_0x250e5c,null))['catch'](handleError(_0x250e5c,null));};exports[_0x06c8('0x70')]=function(_0x1ae8c9,_0x2babfa,_0x47c698){return db[_0x06c8('0x23')]['find']({'where':{'id':_0x1ae8c9[_0x06c8('0x41')]['id']}})[_0x06c8('0x1d')](function(_0x19b40e){if(_0x19b40e){return _0x19b40e[_0x06c8('0x1e')]();}})[_0x06c8('0x1d')](function(_0xc5995e){var _0x3a3098=path[_0x06c8('0x44')](config[_0x06c8('0x45')],_0x06c8('0x53'),util[_0x06c8('0x49')](_0x06c8('0x54'),_0xc5995e[_0x06c8('0x4a')],_0xc5995e[_0x06c8('0x71')]));var _0x285ad8=path[_0x06c8('0x44')](config[_0x06c8('0x45')],_0x06c8('0x46'),util[_0x06c8('0x49')]('%s.%s',_0xc5995e['save_name'],_0xc5995e[_0x06c8('0x42')]));fs[_0x06c8('0x5b')](_0x3a3098);fs[_0x06c8('0x5b')](_0x285ad8);return _0xc5995e;})[_0x06c8('0x1d')](function(_0x5f06a3){if(_0x5f06a3){return _0x2babfa[_0x06c8('0x13')](0xcc)[_0x06c8('0x1f')]();}})[_0x06c8('0x1d')](handleEntityNotFound(_0x2babfa,null))[_0x06c8('0x3c')](handleError(_0x2babfa,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 8e6c811..fcf2701 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 _0x895b=['./sound.attributes','exports','define','Sound','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x22aaeb,_0x404725){var _0x5d42ee=function(_0x589c95){while(--_0x589c95){_0x22aaeb['push'](_0x22aaeb['shift']());}};_0x5d42ee(++_0x404725);}(_0x895b,0x9a));var _0xb895=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x895b[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xb895('0x0'));var util=require(_0xb895('0x1'));var logger=require(_0xb895('0x2'))(_0xb895('0x3'));var moment=require(_0xb895('0x4'));var BPromise=require('bluebird');var rp=require(_0xb895('0x5'));var attributes=require(_0xb895('0x6'));module[_0xb895('0x7')]=function(_0x40dc41,_0x1efd5c){return _0x40dc41[_0xb895('0x8')](_0xb895('0x9'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b7a=['util','../../config/logger','moment','bluebird','request-promise','./sound.attributes','exports','Sound','tools_sounds','lodash'];(function(_0x28e963,_0x4441a3){var _0x6329f5=function(_0x450e1d){while(--_0x450e1d){_0x28e963['push'](_0x28e963['shift']());}};_0x6329f5(++_0x4441a3);}(_0x4b7a,0x1cb));var _0xa4b7=function(_0x305105,_0x45af4e){_0x305105=_0x305105-0x0;var _0x19f5c7=_0x4b7a[_0x305105];return _0x19f5c7;};'use strict';var _=require(_0xa4b7('0x0'));var util=require(_0xa4b7('0x1'));var logger=require(_0xa4b7('0x2'))('api');var moment=require(_0xa4b7('0x3'));var BPromise=require(_0xa4b7('0x4'));var rp=require(_0xa4b7('0x5'));var attributes=require(_0xa4b7('0x6'));module[_0xa4b7('0x7')]=function(_0x35c0cc,_0x52ecfa){return _0x35c0cc['define'](_0xa4b7('0x8'),attributes,{'tableName':_0xa4b7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 9956fd1..ae8a9c1 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 _0xaa2c=['catch','options','raw','where','attributes','include','map','model','then','ShowSound','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x1f0ca7,_0x403fe9){var _0x107ec2=function(_0x12f7af){while(--_0x12f7af){_0x1f0ca7['push'](_0x1f0ca7['shift']());}};_0x107ec2(++_0x403fe9);}(_0xaa2c,0x106));var _0xcaa2=function(_0xd4627b,_0xff27fe){_0xd4627b=_0xd4627b-0x0;var _0x30e307=_0xaa2c[_0xd4627b];return _0x30e307;};'use strict';var _=require(_0xcaa2('0x0'));var util=require('util');var moment=require(_0xcaa2('0x1'));var BPromise=require('bluebird');var rs=require(_0xcaa2('0x2'));var fs=require('fs');var db=require(_0xcaa2('0x3'))['db'];var utils=require(_0xcaa2('0x4'));var logger=require(_0xcaa2('0x5'))('rpc');var config=require(_0xcaa2('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x105529,_0x2dbde4,_0x552f31){return new BPromise(function(_0x27e51d,_0x46f2af){return client[_0xcaa2('0x7')](_0x105529,_0x552f31)['then'](function(_0x2792ba){logger[_0xcaa2('0x8')](_0xcaa2('0x9'),_0x2dbde4,'request\x20sent');logger[_0xcaa2('0xa')](_0xcaa2('0xb'),_0x2dbde4,_0xcaa2('0xc'),JSON[_0xcaa2('0xd')](_0x2792ba));if(_0x2792ba[_0xcaa2('0xe')]){if(_0x2792ba[_0xcaa2('0xe')][_0xcaa2('0xf')]===0x1f4){logger[_0xcaa2('0xe')](_0xcaa2('0x9'),_0x2dbde4,_0x2792ba[_0xcaa2('0xe')][_0xcaa2('0x10')]);return _0x46f2af(_0x2792ba[_0xcaa2('0xe')]['message']);}logger[_0xcaa2('0xe')](_0xcaa2('0x9'),_0x2dbde4,_0x2792ba[_0xcaa2('0xe')][_0xcaa2('0x10')]);return _0x27e51d(_0x2792ba[_0xcaa2('0xe')][_0xcaa2('0x10')]);}else{logger[_0xcaa2('0x8')]('Sound,\x20%s,\x20%s',_0x2dbde4,_0xcaa2('0xc'));_0x27e51d(_0x2792ba[_0xcaa2('0x11')][_0xcaa2('0x10')]);}})[_0xcaa2('0x12')](function(_0x2eccdf){logger[_0xcaa2('0xe')](_0xcaa2('0x9'),_0x2dbde4,_0x2eccdf);_0x46f2af(_0x2eccdf);});});}exports['ShowSound']=function(_0x2fb229){var _0x30c023=this;return new Promise(function(_0x4dbc53,_0x461dfc){return db['Sound']['find']({'raw':_0x2fb229['options']?_0x2fb229[_0xcaa2('0x13')][_0xcaa2('0x14')]===undefined?!![]:![]:!![],'where':_0x2fb229[_0xcaa2('0x13')]?_0x2fb229[_0xcaa2('0x13')][_0xcaa2('0x15')]||null:null,'attributes':_0x2fb229[_0xcaa2('0x13')]?_0x2fb229[_0xcaa2('0x13')][_0xcaa2('0x16')]||null:null,'include':_0x2fb229['options']?_0x2fb229[_0xcaa2('0x13')][_0xcaa2('0x17')]?_[_0xcaa2('0x18')](_0x2fb229[_0xcaa2('0x13')][_0xcaa2('0x17')],function(_0x2ba2d7){return{'model':db[_0x2ba2d7['model']],'as':_0x2ba2d7['as'],'attributes':_0x2ba2d7[_0xcaa2('0x16')],'include':_0x2ba2d7[_0xcaa2('0x17')]?_['map'](_0x2ba2d7[_0xcaa2('0x17')],function(_0x1093c5){return{'model':db[_0x1093c5[_0xcaa2('0x19')]],'as':_0x1093c5['as'],'attributes':_0x1093c5[_0xcaa2('0x16')],'include':_0x1093c5[_0xcaa2('0x17')]?_['map'](_0x1093c5['include'],function(_0x5e884b){return{'model':db[_0x5e884b[_0xcaa2('0x19')]],'as':_0x5e884b['as'],'attributes':_0x5e884b['attributes']};}):[]};}):[]};}):[]:[]})[_0xcaa2('0x1a')](function(_0x4ef70f){logger['info'](_0xcaa2('0x1b'),_0x2fb229);logger['debug'](_0xcaa2('0x1b'),_0x2fb229,JSON[_0xcaa2('0xd')](_0x4ef70f));_0x4dbc53(_0x4ef70f);})[_0xcaa2('0x12')](function(_0x3e9f6d){logger[_0xcaa2('0xe')]('ShowSound',_0x3e9f6d[_0xcaa2('0x10')],_0x2fb229);_0x461dfc(_0x30c023[_0xcaa2('0xe')](0x1f4,_0x3e9f6d[_0xcaa2('0x10')]));});});}; \ No newline at end of file +var _0x9752=['map','include','model','stringify','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','info','result','ShowSound','Sound','options','raw','attributes'];(function(_0x2f05bd,_0x214586){var _0x1fd406=function(_0x398600){while(--_0x398600){_0x2f05bd['push'](_0x2f05bd['shift']());}};_0x1fd406(++_0x214586);}(_0x9752,0x1a8));var _0x2975=function(_0x2235ae,_0x3bd036){_0x2235ae=_0x2235ae-0x0;var _0x513718=_0x9752[_0x2235ae];return _0x513718;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2975('0x0'));var BPromise=require(_0x2975('0x1'));var rs=require(_0x2975('0x2'));var fs=require('fs');var db=require(_0x2975('0x3'))['db'];var utils=require(_0x2975('0x4'));var logger=require('../../config/logger')(_0x2975('0x5'));var config=require(_0x2975('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2975('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1abe69,_0x2d42b9,_0x42380b){return new BPromise(function(_0x54fe77,_0xc11b7d){return client[_0x2975('0x8')](_0x1abe69,_0x42380b)[_0x2975('0x9')](function(_0x32c2f2){logger['info'](_0x2975('0xa'),_0x2d42b9,_0x2975('0xb'));logger[_0x2975('0xc')](_0x2975('0xd'),_0x2d42b9,_0x2975('0xb'),JSON['stringify'](_0x32c2f2));if(_0x32c2f2[_0x2975('0xe')]){if(_0x32c2f2['error'][_0x2975('0xf')]===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0x2d42b9,_0x32c2f2[_0x2975('0xe')][_0x2975('0x10')]);return _0xc11b7d(_0x32c2f2[_0x2975('0xe')][_0x2975('0x10')]);}logger[_0x2975('0xe')]('Sound,\x20%s,\x20%s',_0x2d42b9,_0x32c2f2[_0x2975('0xe')][_0x2975('0x10')]);return _0x54fe77(_0x32c2f2[_0x2975('0xe')]['message']);}else{logger[_0x2975('0x11')](_0x2975('0xa'),_0x2d42b9,'request\x20sent');_0x54fe77(_0x32c2f2[_0x2975('0x12')][_0x2975('0x10')]);}})['catch'](function(_0x27cab7){logger[_0x2975('0xe')](_0x2975('0xa'),_0x2d42b9,_0x27cab7);_0xc11b7d(_0x27cab7);});});}exports[_0x2975('0x13')]=function(_0x4e1ceb){var _0x39a1f7=this;return new Promise(function(_0x4bc81b,_0x40349e){return db[_0x2975('0x14')]['find']({'raw':_0x4e1ceb[_0x2975('0x15')]?_0x4e1ceb['options'][_0x2975('0x16')]===undefined?!![]:![]:!![],'where':_0x4e1ceb[_0x2975('0x15')]?_0x4e1ceb[_0x2975('0x15')]['where']||null:null,'attributes':_0x4e1ceb[_0x2975('0x15')]?_0x4e1ceb['options'][_0x2975('0x17')]||null:null,'include':_0x4e1ceb[_0x2975('0x15')]?_0x4e1ceb[_0x2975('0x15')]['include']?_[_0x2975('0x18')](_0x4e1ceb[_0x2975('0x15')][_0x2975('0x19')],function(_0x5106e6){return{'model':db[_0x5106e6[_0x2975('0x1a')]],'as':_0x5106e6['as'],'attributes':_0x5106e6[_0x2975('0x17')],'include':_0x5106e6[_0x2975('0x19')]?_['map'](_0x5106e6[_0x2975('0x19')],function(_0x3d3f43){return{'model':db[_0x3d3f43[_0x2975('0x1a')]],'as':_0x3d3f43['as'],'attributes':_0x3d3f43[_0x2975('0x17')],'include':_0x3d3f43[_0x2975('0x19')]?_[_0x2975('0x18')](_0x3d3f43['include'],function(_0x2da7ad){return{'model':db[_0x2da7ad[_0x2975('0x1a')]],'as':_0x2da7ad['as'],'attributes':_0x2da7ad[_0x2975('0x17')]};}):[]};}):[]};}):[]:[]})[_0x2975('0x9')](function(_0xbc78ca){logger[_0x2975('0x11')](_0x2975('0x13'),_0x4e1ceb);logger['debug'](_0x2975('0x13'),_0x4e1ceb,JSON[_0x2975('0x1b')](_0xbc78ca));_0x4bc81b(_0xbc78ca);})['catch'](function(_0x11700f){logger[_0x2975('0xe')](_0x2975('0x13'),_0x11700f[_0x2975('0x10')],_0x4e1ceb);_0x40349e(_0x39a1f7['error'](0x1f4,_0x11700f[_0x2975('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index eb614ba..c53fd83 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 _0x2bd8=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','show','/:id/test','test','put','update','destroy','multer','path'];(function(_0x3050b5,_0x182c6a){var _0x37cceb=function(_0x49b797){while(--_0x49b797){_0x3050b5['push'](_0x3050b5['shift']());}};_0x37cceb(++_0x182c6a);}(_0x2bd8,0x130));var _0x82bd=function(_0x2c9cf1,_0x27a659){_0x2c9cf1=_0x2c9cf1-0x0;var _0x8976c8=_0x2bd8[_0x2c9cf1];return _0x8976c8;};'use strict';var multer=require(_0x82bd('0x0'));var util=require('util');var path=require(_0x82bd('0x1'));var express=require(_0x82bd('0x2'));var router=express[_0x82bd('0x3')]();var auth=require(_0x82bd('0x4'));var interaction=require(_0x82bd('0x5'));var config=require(_0x82bd('0x6'));var controller=require(_0x82bd('0x7'));router['get']('/',auth[_0x82bd('0x8')](),controller[_0x82bd('0x9')]);router[_0x82bd('0xa')]('/:id',auth[_0x82bd('0x8')](),controller[_0x82bd('0xb')]);router[_0x82bd('0xa')](_0x82bd('0xc'),auth['isAuthenticated'](),controller[_0x82bd('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x82bd('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x82bd('0xf')]);router['delete']('/:id',auth[_0x82bd('0x8')](),controller[_0x82bd('0x10')]);module['exports']=router; \ No newline at end of file +var _0x31f0=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id/test','test','create','put','/:id','update','delete','destroy','exports','multer','path','Router','../../components/auth/service'];(function(_0x221888,_0x1d2891){var _0x18bc6c=function(_0x485060){while(--_0x485060){_0x221888['push'](_0x221888['shift']());}};_0x18bc6c(++_0x1d2891);}(_0x31f0,0xb7));var _0x031f=function(_0x3033d2,_0x58d14d){_0x3033d2=_0x3033d2-0x0;var _0x2d40ba=_0x31f0[_0x3033d2];return _0x2d40ba;};'use strict';var multer=require(_0x031f('0x0'));var util=require('util');var path=require(_0x031f('0x1'));var express=require('express');var router=express[_0x031f('0x2')]();var auth=require(_0x031f('0x3'));var interaction=require(_0x031f('0x4'));var config=require(_0x031f('0x5'));var controller=require('./squareOdbc.controller');router[_0x031f('0x6')]('/',auth[_0x031f('0x7')](),controller['index']);router['get']('/:id',auth[_0x031f('0x7')](),controller['show']);router[_0x031f('0x6')](_0x031f('0x8'),auth[_0x031f('0x7')](),controller[_0x031f('0x9')]);router['post']('/',auth[_0x031f('0x7')](),controller[_0x031f('0xa')]);router[_0x031f('0xb')](_0x031f('0xc'),auth[_0x031f('0x7')](),controller[_0x031f('0xd')]);router[_0x031f('0xe')](_0x031f('0xc'),auth['isAuthenticated'](),controller[_0x031f('0xf')]);module[_0x031f('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 86f8d2b..3b52ea4 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 _0x464b=['sequelize','exports','name','STRING'];(function(_0x9bde81,_0x3f7c44){var _0x493a5a=function(_0x4841c0){while(--_0x4841c0){_0x9bde81['push'](_0x9bde81['shift']());}};_0x493a5a(++_0x3f7c44);}(_0x464b,0x144));var _0xb464=function(_0x1aa0a0,_0x500078){_0x1aa0a0=_0x1aa0a0-0x0;var _0x17d8a1=_0x464b[_0x1aa0a0];return _0x17d8a1;};'use strict';var Sequelize=require(_0xb464('0x0'));module[_0xb464('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb464('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xb464('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcf27=['STRING','sequelize','exports','name'];(function(_0x15e99d,_0x234768){var _0x5bd347=function(_0x26da4b){while(--_0x26da4b){_0x15e99d['push'](_0x15e99d['shift']());}};_0x5bd347(++_0x234768);}(_0xcf27,0x105));var _0x7cf2=function(_0x1bfb64,_0x7beb29){_0x1bfb64=_0x1bfb64-0x0;var _0x240268=_0xcf27[_0x1bfb64];return _0x240268;};'use strict';var Sequelize=require(_0x7cf2('0x0'));module[_0x7cf2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7cf2('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x7cf2('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 5fbd439..04f7dc2 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 _0xaf2e=['jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','index','SquareOdbc','rawAttributes','keys','query','dateEnd','dateStart','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','day','add','merge','filter','map','options','include','findAll','rows','catch','show','params','find','create','body','test','dsn','odbc','openSync','closeSync','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel'];(function(_0x1a87a8,_0x127bc9){var _0x51b8b7=function(_0x2b4752){while(--_0x2b4752){_0x1a87a8['push'](_0x1a87a8['shift']());}};_0x51b8b7(++_0x127bc9);}(_0xaf2e,0x83));var _0xeaf2=function(_0x558201,_0xeab2e2){_0x558201=_0x558201-0x0;var _0x220c4d=_0xaf2e[_0x558201];return _0x220c4d;};'use strict';var jsonpatch=require(_0xeaf2('0x0'));var rp=require('request-promise');var moment=require(_0xeaf2('0x1'));var BPromise=require(_0xeaf2('0x2'));var Mustache=require(_0xeaf2('0x3'));var util=require('util');var path=require(_0xeaf2('0x4'));var sox=require('sox');var csv=require(_0xeaf2('0x5'));var ejs=require(_0xeaf2('0x6'));var fs=require('fs');var _=require(_0xeaf2('0x7'));var squel=require(_0xeaf2('0x8'));var crypto=require('crypto');var jsforce=require(_0xeaf2('0x9'));var deskjs=require(_0xeaf2('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xeaf2('0xb'));var qs=require(_0xeaf2('0xc'));var logger=require(_0xeaf2('0xd'))(_0xeaf2('0xe'));var utils=require(_0xeaf2('0xf'));var config=require('../../config/environment');var db=require(_0xeaf2('0x10'))['db'];function respondWithStatusCode(_0x448f6f,_0x55035b){_0x55035b=_0x55035b||0xcc;return function(_0x5d6d26){if(_0x5d6d26){return _0x448f6f[_0xeaf2('0x11')](_0x55035b);}return _0x448f6f[_0xeaf2('0x12')](_0x55035b)['end']();};}function respondWithResult(_0x2d0a49,_0x15e4c2){_0x15e4c2=_0x15e4c2||0xc8;return function(_0x5e1a9b){if(_0x5e1a9b){return _0x2d0a49[_0xeaf2('0x12')](_0x15e4c2)['json'](_0x5e1a9b);}};}function respondWithFilteredResult(_0x31be10,_0x885076){return function(_0x55fefc){if(_0x55fefc){var _0x2dbd8b=_0x55fefc['count'],_0x2b1a56=_0x885076[_0xeaf2('0x13')],_0x2e4034=_0x885076[_0xeaf2('0x13')]+_0x885076[_0xeaf2('0x14')],_0x27369e;if(_0x2e4034>=_0x2dbd8b){_0x2e4034=_0x2dbd8b;_0x27369e=0xc8;}else{_0x27369e=0xce;}_0x31be10[_0xeaf2('0x12')](_0x27369e);return _0x31be10['set'](_0xeaf2('0x15'),_0x2b1a56+'-'+_0x2e4034+'/'+_0x2dbd8b)[_0xeaf2('0x16')](_0x55fefc);}return null;};}function patchUpdates(_0x2e24b6){return function(_0x2536f6){try{jsonpatch[_0xeaf2('0x17')](_0x2536f6,_0x2e24b6,!![]);}catch(_0x595c54){return BPromise[_0xeaf2('0x18')](_0x595c54);}return _0x2536f6[_0xeaf2('0x19')]();};}function saveUpdates(_0x8f62af,_0x3759b0){return function(_0x3bc950){if(_0x3bc950){return _0x3bc950[_0xeaf2('0x1a')](_0x8f62af)[_0xeaf2('0x1b')](function(_0x1a6735){return _0x1a6735;});}return null;};}function removeEntity(_0xafabb,_0x411bc3){return function(_0x790aa9){if(_0x790aa9){return _0x790aa9[_0xeaf2('0x1c')]()[_0xeaf2('0x1b')](function(){_0xafabb[_0xeaf2('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fb94b,_0x434d6f){return function(_0x3c1646){if(!_0x3c1646){_0x3fb94b[_0xeaf2('0x11')](0x194);}return _0x3c1646;};}function handleError(_0x223d24,_0x275901){_0x275901=_0x275901||0x1f4;return function(_0xcc32dc){logger['error'](_0xcc32dc[_0xeaf2('0x1d')]);if(_0xcc32dc[_0xeaf2('0x1e')]){delete _0xcc32dc[_0xeaf2('0x1e')];}_0x223d24[_0xeaf2('0x12')](_0x275901)['send'](_0xcc32dc);};}exports[_0xeaf2('0x1f')]=function(_0x298826,_0x1d2dc6){var _0x127d11={},_0xbf026f={},_0x18728b={'count':0x0,'rows':[]};var _0x42173d=db[_0xeaf2('0x20')][_0xeaf2('0x21')];_0xbf026f['model']=_[_0xeaf2('0x22')](_0x42173d);var _0x30b07f={'dateStart':_0x298826[_0xeaf2('0x23')]['dateStart'],'dateEnd':_0x298826['query'][_0xeaf2('0x24')]};delete _0x298826[_0xeaf2('0x23')][_0xeaf2('0x25')];delete _0x298826[_0xeaf2('0x23')][_0xeaf2('0x24')];_0xbf026f[_0xeaf2('0x23')]=_[_0xeaf2('0x22')](_0x298826[_0xeaf2('0x23')]);_0xbf026f['filters']=_[_0xeaf2('0x26')](_0xbf026f[_0xeaf2('0x27')],_0xbf026f[_0xeaf2('0x23')]);_0x127d11[_0xeaf2('0x28')]=_[_0xeaf2('0x26')](_0xbf026f[_0xeaf2('0x27')],qs[_0xeaf2('0x29')](_0x298826[_0xeaf2('0x23')][_0xeaf2('0x29')]));_0x127d11['attributes']=_0x127d11['attributes'][_0xeaf2('0x2a')]?_0x127d11[_0xeaf2('0x28')]:_0xbf026f[_0xeaf2('0x27')];if(!_0x298826['query'][_0xeaf2('0x2b')](_0xeaf2('0x2c'))){_0x127d11['limit']=qs['limit'](_0x298826[_0xeaf2('0x23')]['limit']);_0x127d11['offset']=qs[_0xeaf2('0x13')](_0x298826['query'][_0xeaf2('0x13')]);}_0x127d11[_0xeaf2('0x2d')]=qs[_0xeaf2('0x2e')](_0x298826[_0xeaf2('0x23')]['sort']);_0x127d11[_0xeaf2('0x2f')]=qs[_0xeaf2('0x30')](_[_0xeaf2('0x31')](_0x298826[_0xeaf2('0x23')],_0xbf026f['filters']));if(_0x30b07f[_0xeaf2('0x25')]){if(_0x30b07f[_0xeaf2('0x24')]){_0x30b07f[_0xeaf2('0x24')]=moment(_0x30b07f['dateEnd'])['add'](0x1,_0xeaf2('0x32'));}else{_0x30b07f[_0xeaf2('0x24')]=moment(_0x30b07f[_0xeaf2('0x25')])[_0xeaf2('0x33')](0x1,_0xeaf2('0x32'));}_[_0xeaf2('0x34')](_0x127d11[_0xeaf2('0x2f')],{'createdAt':{'$gte':_0x30b07f[_0xeaf2('0x25')],'$lte':_0x30b07f['dateEnd']}});}if(_0x298826[_0xeaf2('0x23')][_0xeaf2('0x35')]){_0x127d11[_0xeaf2('0x2f')]=_[_0xeaf2('0x34')](_0x127d11['where'],{'$or':_[_0xeaf2('0x36')](_0x127d11[_0xeaf2('0x28')],function(_0x1bf75e){var _0x55ce8a={};_0x55ce8a[_0x1bf75e]={'$like':'%'+_0x298826[_0xeaf2('0x23')][_0xeaf2('0x35')]+'%'};return _0x55ce8a;})});}_0x127d11=_[_0xeaf2('0x34')]({},_0x127d11,_0x298826[_0xeaf2('0x37')]);var _0x589456={'where':_0x127d11[_0xeaf2('0x2f')]};return db[_0xeaf2('0x20')]['count'](_0x589456)[_0xeaf2('0x1b')](function(_0x5e9372){_0x18728b['count']=_0x5e9372;if(_0x298826[_0xeaf2('0x23')]['includeAll']){_0x127d11[_0xeaf2('0x38')]=[{'all':!![]}];}return db[_0xeaf2('0x20')][_0xeaf2('0x39')](_0x127d11);})[_0xeaf2('0x1b')](function(_0xf21077){_0x18728b[_0xeaf2('0x3a')]=_0xf21077;return _0x18728b;})[_0xeaf2('0x1b')](respondWithFilteredResult(_0x1d2dc6,_0x127d11))[_0xeaf2('0x3b')](handleError(_0x1d2dc6,null));};exports[_0xeaf2('0x3c')]=function(_0x3f4bf1,_0x312ba6){var _0x4e17fe={'raw':!![],'where':{'id':_0x3f4bf1[_0xeaf2('0x3d')]['id']}},_0x16d128={};_0x16d128[_0xeaf2('0x27')]=_['keys'](db[_0xeaf2('0x20')][_0xeaf2('0x21')]);_0x16d128[_0xeaf2('0x23')]=_[_0xeaf2('0x22')](_0x3f4bf1[_0xeaf2('0x23')]);_0x16d128[_0xeaf2('0x30')]=_['intersection'](_0x16d128['model'],_0x16d128['query']);_0x4e17fe[_0xeaf2('0x28')]=_[_0xeaf2('0x26')](_0x16d128[_0xeaf2('0x27')],qs[_0xeaf2('0x29')](_0x3f4bf1[_0xeaf2('0x23')][_0xeaf2('0x29')]));_0x4e17fe[_0xeaf2('0x28')]=_0x4e17fe[_0xeaf2('0x28')][_0xeaf2('0x2a')]?_0x4e17fe[_0xeaf2('0x28')]:_0x16d128['model'];if(_0x3f4bf1[_0xeaf2('0x23')]['includeAll']){_0x4e17fe[_0xeaf2('0x38')]=[{'all':!![]}];}_0x4e17fe=_[_0xeaf2('0x34')]({},_0x4e17fe,_0x3f4bf1[_0xeaf2('0x37')]);return db[_0xeaf2('0x20')][_0xeaf2('0x3e')](_0x4e17fe)['then'](handleEntityNotFound(_0x312ba6,null))['then'](respondWithResult(_0x312ba6,null))['catch'](handleError(_0x312ba6,null));};exports[_0xeaf2('0x3f')]=function(_0xa82e79,_0x27424d){return db[_0xeaf2('0x20')][_0xeaf2('0x3f')](_0xa82e79[_0xeaf2('0x40')],{})[_0xeaf2('0x1b')](respondWithResult(_0x27424d,0xc9))[_0xeaf2('0x3b')](handleError(_0x27424d,null));};exports[_0xeaf2('0x1a')]=function(_0x52b7cf,_0x484b67){if(_0x52b7cf[_0xeaf2('0x40')]['id']){delete _0x52b7cf['body']['id'];}return db[_0xeaf2('0x20')][_0xeaf2('0x3e')]({'where':{'id':_0x52b7cf[_0xeaf2('0x3d')]['id']}})[_0xeaf2('0x1b')](handleEntityNotFound(_0x484b67,null))[_0xeaf2('0x1b')](saveUpdates(_0x52b7cf[_0xeaf2('0x40')],null))[_0xeaf2('0x1b')](respondWithResult(_0x484b67,null))[_0xeaf2('0x3b')](handleError(_0x484b67,null));};exports[_0xeaf2('0x1c')]=function(_0x2afc6f,_0x10a7dc){return db['SquareOdbc'][_0xeaf2('0x3e')]({'where':{'id':_0x2afc6f[_0xeaf2('0x3d')]['id']}})['then'](handleEntityNotFound(_0x10a7dc,null))[_0xeaf2('0x1b')](removeEntity(_0x10a7dc,null))['catch'](handleError(_0x10a7dc,null));};exports[_0xeaf2('0x41')]=function(_0x3d4a9c,_0x517c96,_0x4e0fe4){var _0x267cf3;return db[_0xeaf2('0x20')][_0xeaf2('0x3e')]({'where':{'id':_0x3d4a9c[_0xeaf2('0x3d')]['id']},'attributes':['id',_0xeaf2('0x42')]})[_0xeaf2('0x1b')](handleEntityNotFound(_0x517c96,null))['then'](function(_0x4badd0){if(_0x4badd0){var _0x14471e=require(_0xeaf2('0x43'))();_0x14471e[_0xeaf2('0x44')](_0x4badd0[_0xeaf2('0x42')]);_0x14471e[_0xeaf2('0x45')]();return _0x4badd0;}})[_0xeaf2('0x1b')](respondWithResult(_0x517c96,null))[_0xeaf2('0x3b')](handleError(_0x517c96,null));}; \ No newline at end of file +var _0xdbb3=['options','includeAll','include','findAll','show','params','catch','create','body','find','test','odbc','openSync','dsn','closeSync','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','destroy','then','stack','name','send','SquareOdbc','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','limit','sort','pick','add','day','merge','where','filter','map'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0xdbb3,0x1a7));var _0x3dbb=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xdbb3[_0x5bd426];return _0x23a7eb;};'use strict';var jsonpatch=require(_0x3dbb('0x0'));var rp=require(_0x3dbb('0x1'));var moment=require(_0x3dbb('0x2'));var BPromise=require(_0x3dbb('0x3'));var Mustache=require('mustache');var util=require(_0x3dbb('0x4'));var path=require('path');var sox=require(_0x3dbb('0x5'));var csv=require(_0x3dbb('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3dbb('0x7'));var squel=require('squel');var crypto=require(_0x3dbb('0x8'));var jsforce=require(_0x3dbb('0x9'));var deskjs=require(_0x3dbb('0xa'));var toCsv=require(_0x3dbb('0x6'));var querystring=require(_0x3dbb('0xb'));var Papa=require(_0x3dbb('0xc'));var qs=require(_0x3dbb('0xd'));var logger=require(_0x3dbb('0xe'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x3dbb('0xf'))['db'];function respondWithStatusCode(_0x13cb5f,_0x363a68){_0x363a68=_0x363a68||0xcc;return function(_0x34425b){if(_0x34425b){return _0x13cb5f[_0x3dbb('0x10')](_0x363a68);}return _0x13cb5f[_0x3dbb('0x11')](_0x363a68)[_0x3dbb('0x12')]();};}function respondWithResult(_0x2fc9f9,_0x4c7db8){_0x4c7db8=_0x4c7db8||0xc8;return function(_0x1eb8d2){if(_0x1eb8d2){return _0x2fc9f9[_0x3dbb('0x11')](_0x4c7db8)[_0x3dbb('0x13')](_0x1eb8d2);}};}function respondWithFilteredResult(_0x56b373,_0x2612c3){return function(_0x466797){if(_0x466797){var _0x2b8c57=_0x466797[_0x3dbb('0x14')],_0x22caa0=_0x2612c3[_0x3dbb('0x15')],_0x400f87=_0x2612c3[_0x3dbb('0x15')]+_0x2612c3['limit'],_0x21d6ae;if(_0x400f87>=_0x2b8c57){_0x400f87=_0x2b8c57;_0x21d6ae=0xc8;}else{_0x21d6ae=0xce;}_0x56b373['status'](_0x21d6ae);return _0x56b373[_0x3dbb('0x16')]('Content-Range',_0x22caa0+'-'+_0x400f87+'/'+_0x2b8c57)[_0x3dbb('0x13')](_0x466797);}return null;};}function patchUpdates(_0x1b6bc7){return function(_0x5b61f6){try{jsonpatch[_0x3dbb('0x17')](_0x5b61f6,_0x1b6bc7,!![]);}catch(_0x777e57){return BPromise[_0x3dbb('0x18')](_0x777e57);}return _0x5b61f6[_0x3dbb('0x19')]();};}function saveUpdates(_0x3219a8,_0x49baf5){return function(_0x324eee){if(_0x324eee){return _0x324eee[_0x3dbb('0x1a')](_0x3219a8)['then'](function(_0x33386d){return _0x33386d;});}return null;};}function removeEntity(_0x498851,_0x4298ba){return function(_0x317537){if(_0x317537){return _0x317537[_0x3dbb('0x1b')]()[_0x3dbb('0x1c')](function(){_0x498851['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f1f51,_0x1cb69b){return function(_0x13f8ec){if(!_0x13f8ec){_0x3f1f51['sendStatus'](0x194);}return _0x13f8ec;};}function handleError(_0x2be889,_0x226d7f){_0x226d7f=_0x226d7f||0x1f4;return function(_0x829235){logger['error'](_0x829235[_0x3dbb('0x1d')]);if(_0x829235[_0x3dbb('0x1e')]){delete _0x829235['name'];}_0x2be889['status'](_0x226d7f)[_0x3dbb('0x1f')](_0x829235);};}exports['index']=function(_0x408b50,_0x19ade3){var _0x39f0f5={},_0xe6d1df={},_0x998927={'count':0x0,'rows':[]};var _0xf6b0e6=db[_0x3dbb('0x20')][_0x3dbb('0x21')];_0xe6d1df[_0x3dbb('0x22')]=_['keys'](_0xf6b0e6);var _0x390769={'dateStart':_0x408b50[_0x3dbb('0x23')][_0x3dbb('0x24')],'dateEnd':_0x408b50['query'][_0x3dbb('0x25')]};delete _0x408b50[_0x3dbb('0x23')][_0x3dbb('0x24')];delete _0x408b50[_0x3dbb('0x23')][_0x3dbb('0x25')];_0xe6d1df[_0x3dbb('0x23')]=_[_0x3dbb('0x26')](_0x408b50[_0x3dbb('0x23')]);_0xe6d1df[_0x3dbb('0x27')]=_[_0x3dbb('0x28')](_0xe6d1df['model'],_0xe6d1df[_0x3dbb('0x23')]);_0x39f0f5[_0x3dbb('0x29')]=_[_0x3dbb('0x28')](_0xe6d1df[_0x3dbb('0x22')],qs[_0x3dbb('0x2a')](_0x408b50[_0x3dbb('0x23')][_0x3dbb('0x2a')]));_0x39f0f5[_0x3dbb('0x29')]=_0x39f0f5[_0x3dbb('0x29')][_0x3dbb('0x2b')]?_0x39f0f5[_0x3dbb('0x29')]:_0xe6d1df['model'];if(!_0x408b50[_0x3dbb('0x23')]['hasOwnProperty']('nolimit')){_0x39f0f5['limit']=qs['limit'](_0x408b50['query'][_0x3dbb('0x2c')]);_0x39f0f5['offset']=qs[_0x3dbb('0x15')](_0x408b50['query'][_0x3dbb('0x15')]);}_0x39f0f5['order']=qs['sort'](_0x408b50['query'][_0x3dbb('0x2d')]);_0x39f0f5['where']=qs[_0x3dbb('0x27')](_[_0x3dbb('0x2e')](_0x408b50[_0x3dbb('0x23')],_0xe6d1df['filters']));if(_0x390769[_0x3dbb('0x24')]){if(_0x390769['dateEnd']){_0x390769[_0x3dbb('0x25')]=moment(_0x390769[_0x3dbb('0x25')])[_0x3dbb('0x2f')](0x1,_0x3dbb('0x30'));}else{_0x390769[_0x3dbb('0x25')]=moment(_0x390769[_0x3dbb('0x24')])[_0x3dbb('0x2f')](0x1,_0x3dbb('0x30'));}_[_0x3dbb('0x31')](_0x39f0f5[_0x3dbb('0x32')],{'createdAt':{'$gte':_0x390769[_0x3dbb('0x24')],'$lte':_0x390769[_0x3dbb('0x25')]}});}if(_0x408b50[_0x3dbb('0x23')][_0x3dbb('0x33')]){_0x39f0f5[_0x3dbb('0x32')]=_[_0x3dbb('0x31')](_0x39f0f5[_0x3dbb('0x32')],{'$or':_[_0x3dbb('0x34')](_0x39f0f5['attributes'],function(_0x937471){var _0xc44ade={};_0xc44ade[_0x937471]={'$like':'%'+_0x408b50[_0x3dbb('0x23')][_0x3dbb('0x33')]+'%'};return _0xc44ade;})});}_0x39f0f5=_['merge']({},_0x39f0f5,_0x408b50[_0x3dbb('0x35')]);var _0xd09a8c={'where':_0x39f0f5[_0x3dbb('0x32')]};return db[_0x3dbb('0x20')][_0x3dbb('0x14')](_0xd09a8c)['then'](function(_0x19f35c){_0x998927[_0x3dbb('0x14')]=_0x19f35c;if(_0x408b50[_0x3dbb('0x23')][_0x3dbb('0x36')]){_0x39f0f5[_0x3dbb('0x37')]=[{'all':!![]}];}return db[_0x3dbb('0x20')][_0x3dbb('0x38')](_0x39f0f5);})[_0x3dbb('0x1c')](function(_0x1470a8){_0x998927['rows']=_0x1470a8;return _0x998927;})[_0x3dbb('0x1c')](respondWithFilteredResult(_0x19ade3,_0x39f0f5))['catch'](handleError(_0x19ade3,null));};exports[_0x3dbb('0x39')]=function(_0xb312b3,_0x446472){var _0x4128f4={'raw':!![],'where':{'id':_0xb312b3[_0x3dbb('0x3a')]['id']}},_0x3d81ec={};_0x3d81ec[_0x3dbb('0x22')]=_[_0x3dbb('0x26')](db['SquareOdbc']['rawAttributes']);_0x3d81ec[_0x3dbb('0x23')]=_[_0x3dbb('0x26')](_0xb312b3[_0x3dbb('0x23')]);_0x3d81ec['filters']=_['intersection'](_0x3d81ec[_0x3dbb('0x22')],_0x3d81ec[_0x3dbb('0x23')]);_0x4128f4[_0x3dbb('0x29')]=_[_0x3dbb('0x28')](_0x3d81ec[_0x3dbb('0x22')],qs[_0x3dbb('0x2a')](_0xb312b3[_0x3dbb('0x23')][_0x3dbb('0x2a')]));_0x4128f4[_0x3dbb('0x29')]=_0x4128f4['attributes'][_0x3dbb('0x2b')]?_0x4128f4[_0x3dbb('0x29')]:_0x3d81ec[_0x3dbb('0x22')];if(_0xb312b3[_0x3dbb('0x23')][_0x3dbb('0x36')]){_0x4128f4['include']=[{'all':!![]}];}_0x4128f4=_[_0x3dbb('0x31')]({},_0x4128f4,_0xb312b3[_0x3dbb('0x35')]);return db[_0x3dbb('0x20')]['find'](_0x4128f4)[_0x3dbb('0x1c')](handleEntityNotFound(_0x446472,null))['then'](respondWithResult(_0x446472,null))[_0x3dbb('0x3b')](handleError(_0x446472,null));};exports[_0x3dbb('0x3c')]=function(_0x33ed2d,_0x50fddd){return db[_0x3dbb('0x20')][_0x3dbb('0x3c')](_0x33ed2d['body'],{})[_0x3dbb('0x1c')](respondWithResult(_0x50fddd,0xc9))['catch'](handleError(_0x50fddd,null));};exports[_0x3dbb('0x1a')]=function(_0x5340dd,_0x98d4d2){if(_0x5340dd['body']['id']){delete _0x5340dd[_0x3dbb('0x3d')]['id'];}return db['SquareOdbc'][_0x3dbb('0x3e')]({'where':{'id':_0x5340dd['params']['id']}})[_0x3dbb('0x1c')](handleEntityNotFound(_0x98d4d2,null))[_0x3dbb('0x1c')](saveUpdates(_0x5340dd[_0x3dbb('0x3d')],null))[_0x3dbb('0x1c')](respondWithResult(_0x98d4d2,null))[_0x3dbb('0x3b')](handleError(_0x98d4d2,null));};exports[_0x3dbb('0x1b')]=function(_0x45c123,_0x9888c4){return db[_0x3dbb('0x20')][_0x3dbb('0x3e')]({'where':{'id':_0x45c123['params']['id']}})['then'](handleEntityNotFound(_0x9888c4,null))[_0x3dbb('0x1c')](removeEntity(_0x9888c4,null))[_0x3dbb('0x3b')](handleError(_0x9888c4,null));};exports[_0x3dbb('0x3f')]=function(_0x4515ac,_0x54de62,_0x5df26e){var _0x5db747;return db[_0x3dbb('0x20')][_0x3dbb('0x3e')]({'where':{'id':_0x4515ac['params']['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x54de62,null))[_0x3dbb('0x1c')](function(_0x48cd79){if(_0x48cd79){var _0x220c19=require(_0x3dbb('0x40'))();_0x220c19[_0x3dbb('0x41')](_0x48cd79[_0x3dbb('0x42')]);_0x220c19[_0x3dbb('0x43')]();return _0x48cd79;}})['then'](respondWithResult(_0x54de62,null))['catch'](handleError(_0x54de62,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index a47089a..38ca764 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 _0x9c44=['../../config/logger','api','moment','bluebird','request-promise','./squareOdbc.attributes','SquareOdbc','square_odbc'];(function(_0x343947,_0x3bf7ee){var _0x576764=function(_0x1e5aec){while(--_0x1e5aec){_0x343947['push'](_0x343947['shift']());}};_0x576764(++_0x3bf7ee);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var attributes=require(_0x49c4('0x5'));module['exports']=function(_0x4941f1,_0x41a183){return _0x4941f1['define'](_0x49c4('0x6'),attributes,{'tableName':_0x49c4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ff3=['define','SquareOdbc','square_odbc','util','api','bluebird','request-promise','./squareOdbc.attributes','exports'];(function(_0x161a29,_0x262336){var _0x1b3f86=function(_0x57ed22){while(--_0x57ed22){_0x161a29['push'](_0x161a29['shift']());}};_0x1b3f86(++_0x262336);}(_0x5ff3,0x17d));var _0x35ff=function(_0x16f0c6,_0x33f67b){_0x16f0c6=_0x16f0c6-0x0;var _0x114f36=_0x5ff3[_0x16f0c6];return _0x114f36;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var logger=require('../../config/logger')(_0x35ff('0x1'));var moment=require('moment');var BPromise=require(_0x35ff('0x2'));var rp=require(_0x35ff('0x3'));var attributes=require(_0x35ff('0x4'));module[_0x35ff('0x5')]=function(_0x551514,_0x2fcb74){return _0x551514[_0x35ff('0x6')](_0x35ff('0x7'),attributes,{'tableName':_0x35ff('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 16b3dec..4271bdd 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 _0xe070=['where','attributes','include','map','model','ShowSquareOdbc','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','then','info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','SquareOdbc','find','options'];(function(_0x301efe,_0x338d14){var _0x5d44c3=function(_0x10a315){while(--_0x10a315){_0x301efe['push'](_0x301efe['shift']());}};_0x5d44c3(++_0x338d14);}(_0xe070,0x1c6));var _0x0e07=function(_0x21e71a,_0xf0b818){_0x21e71a=_0x21e71a-0x0;var _0x174f46=_0xe070[_0x21e71a];return _0x174f46;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0e07('0x0'));var BPromise=require(_0x0e07('0x1'));var rs=require(_0x0e07('0x2'));var fs=require('fs');var db=require(_0x0e07('0x3'))['db'];var utils=require(_0x0e07('0x4'));var logger=require(_0x0e07('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0e07('0x6')][_0x0e07('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3041a8,_0xe53a36,_0x21307b){return new BPromise(function(_0x55e25c,_0x1fe45d){return client['request'](_0x3041a8,_0x21307b)[_0x0e07('0x8')](function(_0x930956){logger[_0x0e07('0x9')]('SquareOdbc,\x20%s,\x20%s',_0xe53a36,_0x0e07('0xa'));logger[_0x0e07('0xb')](_0x0e07('0xc'),_0xe53a36,'request\x20sent',JSON[_0x0e07('0xd')](_0x930956));if(_0x930956[_0x0e07('0xe')]){if(_0x930956[_0x0e07('0xe')][_0x0e07('0xf')]===0x1f4){logger[_0x0e07('0xe')](_0x0e07('0x10'),_0xe53a36,_0x930956['error'][_0x0e07('0x11')]);return _0x1fe45d(_0x930956[_0x0e07('0xe')][_0x0e07('0x11')]);}logger[_0x0e07('0xe')](_0x0e07('0x10'),_0xe53a36,_0x930956['error'][_0x0e07('0x11')]);return _0x55e25c(_0x930956[_0x0e07('0xe')][_0x0e07('0x11')]);}else{logger[_0x0e07('0x9')](_0x0e07('0x10'),_0xe53a36,_0x0e07('0xa'));_0x55e25c(_0x930956['result'][_0x0e07('0x11')]);}})[_0x0e07('0x12')](function(_0x275e16){logger['error']('SquareOdbc,\x20%s,\x20%s',_0xe53a36,_0x275e16);_0x1fe45d(_0x275e16);});});}exports['ShowSquareOdbc']=function(_0x36d25f){var _0x4bb754=this;return new Promise(function(_0x11e2e4,_0x1b699f){return db[_0x0e07('0x13')][_0x0e07('0x14')]({'raw':_0x36d25f[_0x0e07('0x15')]?_0x36d25f[_0x0e07('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x36d25f[_0x0e07('0x15')]?_0x36d25f[_0x0e07('0x15')][_0x0e07('0x16')]||null:null,'attributes':_0x36d25f[_0x0e07('0x15')]?_0x36d25f[_0x0e07('0x15')][_0x0e07('0x17')]||null:null,'include':_0x36d25f[_0x0e07('0x15')]?_0x36d25f[_0x0e07('0x15')][_0x0e07('0x18')]?_[_0x0e07('0x19')](_0x36d25f[_0x0e07('0x15')][_0x0e07('0x18')],function(_0x5e46d4){return{'model':db[_0x5e46d4[_0x0e07('0x1a')]],'as':_0x5e46d4['as'],'attributes':_0x5e46d4[_0x0e07('0x17')],'include':_0x5e46d4[_0x0e07('0x18')]?_[_0x0e07('0x19')](_0x5e46d4['include'],function(_0x444550){return{'model':db[_0x444550['model']],'as':_0x444550['as'],'attributes':_0x444550['attributes'],'include':_0x444550[_0x0e07('0x18')]?_['map'](_0x444550[_0x0e07('0x18')],function(_0x247226){return{'model':db[_0x247226['model']],'as':_0x247226['as'],'attributes':_0x247226[_0x0e07('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47738e){logger[_0x0e07('0x9')](_0x0e07('0x1b'),_0x36d25f);logger[_0x0e07('0xb')](_0x0e07('0x1b'),_0x36d25f,JSON[_0x0e07('0xd')](_0x47738e));_0x11e2e4(_0x47738e);})[_0x0e07('0x12')](function(_0x2c57c7){logger[_0x0e07('0xe')](_0x0e07('0x1b'),_0x2c57c7[_0x0e07('0x11')],_0x36d25f);_0x1b699f(_0x4bb754[_0x0e07('0xe')](0x1f4,_0x2c57c7[_0x0e07('0x11')]));});});}; \ No newline at end of file +var _0xaf4e=['find','options','where','attributes','include','map','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x1a8bbc,_0x17a086){var _0x212fc2=function(_0x55c718){while(--_0x55c718){_0x1a8bbc['push'](_0x1a8bbc['shift']());}};_0x212fc2(++_0x17a086);}(_0xaf4e,0xbd));var _0xeaf4=function(_0x1d6560,_0x9a0c98){_0x1d6560=_0x1d6560-0x0;var _0x23e060=_0xaf4e[_0x1d6560];return _0x23e060;};'use strict';var _=require(_0xeaf4('0x0'));var util=require(_0xeaf4('0x1'));var moment=require(_0xeaf4('0x2'));var BPromise=require(_0xeaf4('0x3'));var rs=require(_0xeaf4('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xeaf4('0x5'));var logger=require('../../config/logger')(_0xeaf4('0x6'));var config=require(_0xeaf4('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1846ad,_0x30eda7,_0x162ab6){return new BPromise(function(_0xb925a7,_0x85209f){return client[_0xeaf4('0x8')](_0x1846ad,_0x162ab6)[_0xeaf4('0x9')](function(_0x57f898){logger[_0xeaf4('0xa')](_0xeaf4('0xb'),_0x30eda7,'request\x20sent');logger[_0xeaf4('0xc')](_0xeaf4('0xd'),_0x30eda7,_0xeaf4('0xe'),JSON[_0xeaf4('0xf')](_0x57f898));if(_0x57f898[_0xeaf4('0x10')]){if(_0x57f898[_0xeaf4('0x10')]['code']===0x1f4){logger[_0xeaf4('0x10')](_0xeaf4('0xb'),_0x30eda7,_0x57f898['error'][_0xeaf4('0x11')]);return _0x85209f(_0x57f898[_0xeaf4('0x10')][_0xeaf4('0x11')]);}logger[_0xeaf4('0x10')](_0xeaf4('0xb'),_0x30eda7,_0x57f898[_0xeaf4('0x10')][_0xeaf4('0x11')]);return _0xb925a7(_0x57f898['error'][_0xeaf4('0x11')]);}else{logger[_0xeaf4('0xa')](_0xeaf4('0xb'),_0x30eda7,_0xeaf4('0xe'));_0xb925a7(_0x57f898[_0xeaf4('0x12')]['message']);}})['catch'](function(_0x4e4daf){logger[_0xeaf4('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x30eda7,_0x4e4daf);_0x85209f(_0x4e4daf);});});}exports['ShowSquareOdbc']=function(_0x4648f6){var _0x4782b4=this;return new Promise(function(_0x19fb11,_0x1b074a){return db['SquareOdbc'][_0xeaf4('0x13')]({'raw':_0x4648f6[_0xeaf4('0x14')]?_0x4648f6[_0xeaf4('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x4648f6['options']?_0x4648f6[_0xeaf4('0x14')][_0xeaf4('0x15')]||null:null,'attributes':_0x4648f6[_0xeaf4('0x14')]?_0x4648f6[_0xeaf4('0x14')][_0xeaf4('0x16')]||null:null,'include':_0x4648f6['options']?_0x4648f6[_0xeaf4('0x14')][_0xeaf4('0x17')]?_['map'](_0x4648f6[_0xeaf4('0x14')][_0xeaf4('0x17')],function(_0x4625f5){return{'model':db[_0x4625f5['model']],'as':_0x4625f5['as'],'attributes':_0x4625f5['attributes'],'include':_0x4625f5['include']?_[_0xeaf4('0x18')](_0x4625f5['include'],function(_0x21a34c){return{'model':db[_0x21a34c['model']],'as':_0x21a34c['as'],'attributes':_0x21a34c[_0xeaf4('0x16')],'include':_0x21a34c[_0xeaf4('0x17')]?_[_0xeaf4('0x18')](_0x21a34c[_0xeaf4('0x17')],function(_0x4f163c){return{'model':db[_0x4f163c['model']],'as':_0x4f163c['as'],'attributes':_0x4f163c[_0xeaf4('0x16')]};}):[]};}):[]};}):[]:[]})[_0xeaf4('0x9')](function(_0x50a33a){logger['info'](_0xeaf4('0x19'),_0x4648f6);logger[_0xeaf4('0xc')]('ShowSquareOdbc',_0x4648f6,JSON['stringify'](_0x50a33a));_0x19fb11(_0x50a33a);})['catch'](function(_0x5ae731){logger[_0xeaf4('0x10')](_0xeaf4('0x19'),_0x5ae731[_0xeaf4('0x11')],_0x4648f6);_0x1b074a(_0x4782b4[_0xeaf4('0x10')](0x1f4,_0x5ae731[_0xeaf4('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 2c319fa..25b9482 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 _0x5caf=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','index','/:id','get','/:id/users','isAuthenticated','getUsers','create','post','addUsers','put','update','delete','removeUsers','exports','multer'];(function(_0x3c8bc1,_0x237ad4){var _0x22b568=function(_0x3a6f46){while(--_0x3a6f46){_0x3c8bc1['push'](_0x3c8bc1['shift']());}};_0x22b568(++_0x237ad4);}(_0x5caf,0x149));var _0xf5ca=function(_0x519936,_0x2e5fdb){_0x519936=_0x519936-0x0;var _0x31ff2a=_0x5caf[_0x519936];return _0x31ff2a;};'use strict';var multer=require(_0xf5ca('0x0'));var util=require(_0xf5ca('0x1'));var path=require(_0xf5ca('0x2'));var express=require('express');var router=express[_0xf5ca('0x3')]();var auth=require(_0xf5ca('0x4'));var interaction=require(_0xf5ca('0x5'));var config=require(_0xf5ca('0x6'));var controller=require(_0xf5ca('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xf5ca('0x8')]);router['get'](_0xf5ca('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xf5ca('0xa')](_0xf5ca('0xb'),auth[_0xf5ca('0xc')](),controller[_0xf5ca('0xd')]);router['post']('/',auth[_0xf5ca('0xc')](),controller[_0xf5ca('0xe')]);router[_0xf5ca('0xf')](_0xf5ca('0xb'),auth[_0xf5ca('0xc')](),controller[_0xf5ca('0x10')]);router[_0xf5ca('0x11')](_0xf5ca('0x9'),auth[_0xf5ca('0xc')](),controller[_0xf5ca('0x12')]);router[_0xf5ca('0x13')]('/:id',auth[_0xf5ca('0xc')](),controller['destroy']);router['delete'](_0xf5ca('0xb'),auth[_0xf5ca('0xc')](),controller[_0xf5ca('0x14')]);module[_0xf5ca('0x15')]=router; \ No newline at end of file +var _0xef43=['get','/:id/users','getUsers','post','create','addUsers','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','/:id','show'];(function(_0x218af7,_0x415008){var _0x1a1829=function(_0x5dbf65){while(--_0x5dbf65){_0x218af7['push'](_0x218af7['shift']());}};_0x1a1829(++_0x415008);}(_0xef43,0x135));var _0x3ef4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xef43[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x3ef4('0x0'));var util=require(_0x3ef4('0x1'));var path=require(_0x3ef4('0x2'));var express=require(_0x3ef4('0x3'));var router=express[_0x3ef4('0x4')]();var auth=require(_0x3ef4('0x5'));var interaction=require(_0x3ef4('0x6'));var config=require(_0x3ef4('0x7'));var controller=require(_0x3ef4('0x8'));router['get']('/',auth[_0x3ef4('0x9')](),controller[_0x3ef4('0xa')]);router['get'](_0x3ef4('0xb'),auth[_0x3ef4('0x9')](),controller[_0x3ef4('0xc')]);router[_0x3ef4('0xd')](_0x3ef4('0xe'),auth[_0x3ef4('0x9')](),controller[_0x3ef4('0xf')]);router[_0x3ef4('0x10')]('/',auth[_0x3ef4('0x9')](),controller[_0x3ef4('0x11')]);router[_0x3ef4('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0x3ef4('0x12')]);router['put'](_0x3ef4('0xb'),auth[_0x3ef4('0x9')](),controller[_0x3ef4('0x13')]);router[_0x3ef4('0x14')](_0x3ef4('0xb'),auth['isAuthenticated'](),controller[_0x3ef4('0x15')]);router['delete'](_0x3ef4('0xe'),auth[_0x3ef4('0x9')](),controller['removeUsers']);module[_0x3ef4('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 36f9434..1b123d6 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 _0x176c=['TEXT','BLOB','getDataValue','preproduction','toString','utf8','long','production','sequelize','exports','STRING','name'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x176c,0x134));var _0xc176=function(_0x28015a,_0x294621){_0x28015a=_0x28015a-0x0;var _0x57d888=_0x176c[_0x28015a];return _0x57d888;};'use strict';var Sequelize=require(_0xc176('0x0'));module[_0xc176('0x1')]={'name':{'type':Sequelize[_0xc176('0x2')],'unique':_0xc176('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xc176('0x2')]},'notes':{'type':Sequelize[_0xc176('0x4')]},'preproduction':{'type':Sequelize[_0xc176('0x5')]('long'),'get':function(){if(this[_0xc176('0x6')](_0xc176('0x7'))){return this['getDataValue'](_0xc176('0x7'))[_0xc176('0x8')](_0xc176('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0xc176('0xa')),'get':function(){if(this[_0xc176('0x6')](_0xc176('0xb'))){return this[_0xc176('0x6')](_0xc176('0xb'))['toString'](_0xc176('0x9'));}}}}; \ No newline at end of file +var _0x1a28=['getDataValue','preproduction','toString','utf8','long','production','sequelize','exports','STRING','name','TEXT'];(function(_0x4fadbe,_0x3a981d){var _0xbb14e6=function(_0x3cb4dd){while(--_0x3cb4dd){_0x4fadbe['push'](_0x4fadbe['shift']());}};_0xbb14e6(++_0x3a981d);}(_0x1a28,0x10e));var _0x81a2=function(_0x4f08dd,_0x3784ec){_0x4f08dd=_0x4f08dd-0x0;var _0x3017ee=_0x1a28[_0x4f08dd];return _0x3017ee;};'use strict';var Sequelize=require(_0x81a2('0x0'));module[_0x81a2('0x1')]={'name':{'type':Sequelize[_0x81a2('0x2')],'unique':_0x81a2('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x81a2('0x2')]},'notes':{'type':Sequelize[_0x81a2('0x4')]},'preproduction':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x81a2('0x5')](_0x81a2('0x6'))){return this[_0x81a2('0x5')]('preproduction')[_0x81a2('0x7')](_0x81a2('0x8'));}}},'production':{'type':Sequelize['BLOB'](_0x81a2('0x9')),'get':function(){if(this[_0x81a2('0x5')](_0x81a2('0xa'))){return this[_0x81a2('0x5')](_0x81a2('0xa'))[_0x81a2('0x7')](_0x81a2('0x8'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 9087b41..5e653e2 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 _0x650d=['emit','getUsers','findOne','User','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','./squareProject.socket','register','sendStatus','end','json','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SquareProject','rawAttributes','keys','dateEnd','query','dateStart','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','add','day','merge','filter','where','map','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','addUsers','ids','removeUsers','isArray'];(function(_0x284e95,_0xede207){var _0x5cefd5=function(_0x5a5801){while(--_0x5a5801){_0x284e95['push'](_0x284e95['shift']());}};_0x5cefd5(++_0xede207);}(_0x650d,0xfd));var _0xd650=function(_0x4fae14,_0x4ef118){_0x4fae14=_0x4fae14-0x0;var _0x305e46=_0x650d[_0x4fae14];return _0x305e46;};'use strict';var jsonpatch=require(_0xd650('0x0'));var rp=require(_0xd650('0x1'));var moment=require(_0xd650('0x2'));var BPromise=require(_0xd650('0x3'));var Mustache=require(_0xd650('0x4'));var util=require(_0xd650('0x5'));var path=require(_0xd650('0x6'));var sox=require(_0xd650('0x7'));var csv=require('to-csv');var ejs=require(_0xd650('0x8'));var fs=require('fs');var _=require(_0xd650('0x9'));var squel=require(_0xd650('0xa'));var crypto=require(_0xd650('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd650('0xc'));var toCsv=require(_0xd650('0xd'));var querystring=require(_0xd650('0xe'));var Papa=require('papaparse');var qs=require(_0xd650('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xd650('0x10'));var config=require(_0xd650('0x11'));var db=require(_0xd650('0x12'))['db'];var socket=require(_0xd650('0x13'))({'host':'localhost','port':0x18eb});require(_0xd650('0x14'))[_0xd650('0x15')](socket);function respondWithStatusCode(_0x59ba2b,_0x5d61e2){_0x5d61e2=_0x5d61e2||0xcc;return function(_0x3d8d51){if(_0x3d8d51){return _0x59ba2b[_0xd650('0x16')](_0x5d61e2);}return _0x59ba2b['status'](_0x5d61e2)[_0xd650('0x17')]();};}function respondWithResult(_0x510d8e,_0x20c1b1){_0x20c1b1=_0x20c1b1||0xc8;return function(_0x4db392){if(_0x4db392){return _0x510d8e['status'](_0x20c1b1)[_0xd650('0x18')](_0x4db392);}};}function respondWithFilteredResult(_0x3e4b67,_0x124b0b){return function(_0x199739){if(_0x199739){var _0x57e82c=_0x199739[_0xd650('0x19')],_0x2638e1=_0x124b0b[_0xd650('0x1a')],_0x30c897=_0x124b0b[_0xd650('0x1a')]+_0x124b0b['limit'],_0x2407f1;if(_0x30c897>=_0x57e82c){_0x30c897=_0x57e82c;_0x2407f1=0xc8;}else{_0x2407f1=0xce;}_0x3e4b67[_0xd650('0x1b')](_0x2407f1);return _0x3e4b67[_0xd650('0x1c')](_0xd650('0x1d'),_0x2638e1+'-'+_0x30c897+'/'+_0x57e82c)[_0xd650('0x18')](_0x199739);}return null;};}function patchUpdates(_0x178d4c){return function(_0x33990d){try{jsonpatch[_0xd650('0x1e')](_0x33990d,_0x178d4c,!![]);}catch(_0x50db6e){return BPromise[_0xd650('0x1f')](_0x50db6e);}return _0x33990d[_0xd650('0x20')]();};}function saveUpdates(_0x4689e0,_0x838c68){return function(_0x27d25c){if(_0x27d25c){return _0x27d25c[_0xd650('0x21')](_0x4689e0)[_0xd650('0x22')](function(_0x2b2c6d){return _0x2b2c6d;});}return null;};}function removeEntity(_0x789aaa,_0x455432){return function(_0x42ae56){if(_0x42ae56){return _0x42ae56[_0xd650('0x23')]()[_0xd650('0x22')](function(){_0x789aaa[_0xd650('0x1b')](0xcc)[_0xd650('0x17')]();});}};}function handleEntityNotFound(_0x2d64b3,_0x484b8e){return function(_0x259330){if(!_0x259330){_0x2d64b3[_0xd650('0x16')](0x194);}return _0x259330;};}function handleError(_0x2ddea3,_0x5702af){_0x5702af=_0x5702af||0x1f4;return function(_0x2d9b7e){logger[_0xd650('0x24')](_0x2d9b7e[_0xd650('0x25')]);if(_0x2d9b7e[_0xd650('0x26')]){delete _0x2d9b7e['name'];}_0x2ddea3[_0xd650('0x1b')](_0x5702af)[_0xd650('0x27')](_0x2d9b7e);};}exports[_0xd650('0x28')]=function(_0x2f9593,_0x4e392b){var _0x3c5730={},_0x45e9f9={},_0x1a4c5d={'count':0x0,'rows':[]};var _0x27bd3b=db[_0xd650('0x29')][_0xd650('0x2a')];_0x45e9f9['model']=_[_0xd650('0x2b')](_0x27bd3b);var _0x76f198={'dateStart':_0x2f9593['query']['dateStart'],'dateEnd':_0x2f9593['query'][_0xd650('0x2c')]};delete _0x2f9593[_0xd650('0x2d')][_0xd650('0x2e')];delete _0x2f9593[_0xd650('0x2d')][_0xd650('0x2c')];_0x45e9f9[_0xd650('0x2d')]=_[_0xd650('0x2b')](_0x2f9593[_0xd650('0x2d')]);_0x45e9f9[_0xd650('0x2f')]=_[_0xd650('0x30')](_0x45e9f9[_0xd650('0x31')],_0x45e9f9[_0xd650('0x2d')]);_0x3c5730['attributes']=_[_0xd650('0x30')](_0x45e9f9[_0xd650('0x31')],qs[_0xd650('0x32')](_0x2f9593['query'][_0xd650('0x32')]));_0x3c5730[_0xd650('0x33')]=_0x3c5730['attributes'][_0xd650('0x34')]?_0x3c5730[_0xd650('0x33')]:_0x45e9f9[_0xd650('0x31')];if(!_0x2f9593[_0xd650('0x2d')][_0xd650('0x35')]('nolimit')){_0x3c5730[_0xd650('0x36')]=qs['limit'](_0x2f9593['query'][_0xd650('0x36')]);_0x3c5730[_0xd650('0x1a')]=qs[_0xd650('0x1a')](_0x2f9593[_0xd650('0x2d')]['offset']);}_0x3c5730[_0xd650('0x37')]=qs['sort'](_0x2f9593[_0xd650('0x2d')][_0xd650('0x38')]);_0x3c5730['where']=qs[_0xd650('0x2f')](_[_0xd650('0x39')](_0x2f9593[_0xd650('0x2d')],_0x45e9f9['filters']));if(_0x76f198['dateStart']){if(_0x76f198[_0xd650('0x2c')]){_0x76f198[_0xd650('0x2c')]=moment(_0x76f198['dateEnd'])[_0xd650('0x3a')](0x1,_0xd650('0x3b'));}else{_0x76f198[_0xd650('0x2c')]=moment(_0x76f198['dateStart'])['add'](0x1,_0xd650('0x3b'));}_[_0xd650('0x3c')](_0x3c5730['where'],{'createdAt':{'$gte':_0x76f198['dateStart'],'$lte':_0x76f198[_0xd650('0x2c')]}});}if(_0x2f9593[_0xd650('0x2d')][_0xd650('0x3d')]){_0x3c5730[_0xd650('0x3e')]=_['merge'](_0x3c5730['where'],{'$or':_[_0xd650('0x3f')](_0x3c5730[_0xd650('0x33')],function(_0xbbdb2e){var _0x257e2a={};_0x257e2a[_0xbbdb2e]={'$like':'%'+_0x2f9593[_0xd650('0x2d')][_0xd650('0x3d')]+'%'};return _0x257e2a;})});}_0x3c5730=_[_0xd650('0x3c')]({},_0x3c5730,_0x2f9593[_0xd650('0x40')]);var _0x1b749b={'where':_0x3c5730[_0xd650('0x3e')]};return db[_0xd650('0x29')][_0xd650('0x19')](_0x1b749b)[_0xd650('0x22')](function(_0x6690b6){_0x1a4c5d[_0xd650('0x19')]=_0x6690b6;if(_0x2f9593[_0xd650('0x2d')][_0xd650('0x41')]){_0x3c5730[_0xd650('0x42')]=[{'all':!![]}];}return db[_0xd650('0x29')][_0xd650('0x43')](_0x3c5730);})[_0xd650('0x22')](function(_0x40d771){_0x1a4c5d[_0xd650('0x44')]=_0x40d771;return _0x1a4c5d;})[_0xd650('0x22')](respondWithFilteredResult(_0x4e392b,_0x3c5730))[_0xd650('0x45')](handleError(_0x4e392b,null));};exports[_0xd650('0x46')]=function(_0x34e076,_0x3d685b){var _0x5c6da5={'raw':![],'where':{'id':_0x34e076[_0xd650('0x47')]['id']}},_0x3e9b12={};_0x3e9b12['model']=_[_0xd650('0x2b')](db[_0xd650('0x29')]['rawAttributes']);_0x3e9b12[_0xd650('0x2d')]=_['keys'](_0x34e076['query']);_0x3e9b12[_0xd650('0x2f')]=_['intersection'](_0x3e9b12[_0xd650('0x31')],_0x3e9b12[_0xd650('0x2d')]);_0x5c6da5[_0xd650('0x33')]=_[_0xd650('0x30')](_0x3e9b12[_0xd650('0x31')],qs['fields'](_0x34e076[_0xd650('0x2d')][_0xd650('0x32')]));_0x5c6da5[_0xd650('0x33')]=_0x5c6da5['attributes'][_0xd650('0x34')]?_0x5c6da5[_0xd650('0x33')]:_0x3e9b12[_0xd650('0x31')];if(_0x34e076['query'][_0xd650('0x41')]){_0x5c6da5['include']=[{'all':!![]}];}_0x5c6da5=_[_0xd650('0x3c')]({},_0x5c6da5,_0x34e076['options']);return db[_0xd650('0x29')]['find'](_0x5c6da5)[_0xd650('0x22')](handleEntityNotFound(_0x3d685b,null))[_0xd650('0x22')](respondWithResult(_0x3d685b,null))[_0xd650('0x45')](handleError(_0x3d685b,null));};exports[_0xd650('0x48')]=function(_0x548030,_0x594ecc){return db[_0xd650('0x29')]['create'](_0x548030['body'],{})[_0xd650('0x22')](respondWithResult(_0x594ecc,0xc9))[_0xd650('0x45')](handleError(_0x594ecc,null));};exports[_0xd650('0x21')]=function(_0xb88d2,_0x46e1bc){if(_0xb88d2[_0xd650('0x49')]['id']){delete _0xb88d2[_0xd650('0x49')]['id'];}return db[_0xd650('0x29')][_0xd650('0x4a')]({'where':{'id':_0xb88d2[_0xd650('0x47')]['id']}})['then'](handleEntityNotFound(_0x46e1bc,null))[_0xd650('0x22')](saveUpdates(_0xb88d2['body'],null))[_0xd650('0x22')](respondWithResult(_0x46e1bc,null))[_0xd650('0x45')](handleError(_0x46e1bc,null));};exports[_0xd650('0x23')]=function(_0x29b657,_0x583d68){return db[_0xd650('0x29')][_0xd650('0x4a')]({'where':{'id':_0x29b657['params']['id']}})['then'](handleEntityNotFound(_0x583d68,null))[_0xd650('0x22')](removeEntity(_0x583d68,null))[_0xd650('0x45')](handleError(_0x583d68,null));};exports[_0xd650('0x4b')]=function(_0x52feba,_0xf75a53,_0x5bc89e){return db[_0xd650('0x29')][_0xd650('0x4a')]({'where':{'id':_0x52feba['params']['id']}})[_0xd650('0x22')](handleEntityNotFound(_0xf75a53,null))['then'](function(_0x4eee3c){if(_0x4eee3c){return _0x4eee3c[_0xd650('0x4b')](_0x52feba[_0xd650('0x49')]['ids'],_['omit'](_0x52feba[_0xd650('0x49')],[_0xd650('0x4c'),'id'])||{});}})[_0xd650('0x22')](respondWithResult(_0xf75a53,null))['catch'](handleError(_0xf75a53,null));};exports[_0xd650('0x4d')]=function(_0x22dd3f,_0x2fe696,_0x291cc2){var _0x5d9e88;return db['SquareProject'][_0xd650('0x4a')]({'where':{'id':_0x22dd3f[_0xd650('0x47')]['id']}})['then'](handleEntityNotFound(_0x2fe696,null))['then'](function(_0x53aaf2){if(_0x53aaf2){return _0x53aaf2[_0xd650('0x4d')](_0x22dd3f[_0xd650('0x2d')][_0xd650('0x4c')])[_0xd650('0x22')](function(_0x40d2da){if(_[_0xd650('0x4e')](_0x22dd3f[_0xd650('0x2d')][_0xd650('0x4c')])){for(var _0x5a7b9a=0x0;_0x5a7b9a<_0x22dd3f['query'][_0xd650('0x4c')][_0xd650('0x34')];_0x5a7b9a+=0x1){socket[_0xd650('0x4f')]('userSquareProject:remove',{'UserId':_0x22dd3f[_0xd650('0x2d')][_0xd650('0x4c')][_0x5a7b9a],'SquareProjectId':_0x22dd3f[_0xd650('0x47')]['id']});}}else{socket[_0xd650('0x4f')]('userSquareProject:remove',{'UserId':_0x22dd3f['query']['ids'],'SquareProjectId':_0x22dd3f[_0xd650('0x47')]['id']});}});}})[_0xd650('0x22')](respondWithStatusCode(_0x2fe696,null))[_0xd650('0x45')](handleError(_0x2fe696,null));};exports[_0xd650('0x50')]=function(_0x545b0d,_0x175a84,_0x2846b8){var _0x5e4c01={};var _0x321288={};var _0x55032e;var _0xfcb742;return db['SquareProject'][_0xd650('0x51')]({'where':{'id':_0x545b0d[_0xd650('0x47')]['id']}})[_0xd650('0x22')](handleEntityNotFound(_0x175a84,null))[_0xd650('0x22')](function(_0x169fb6){if(_0x169fb6){_0x55032e=_0x169fb6;_0x321288[_0xd650('0x31')]=_[_0xd650('0x2b')](db[_0xd650('0x52')]['rawAttributes']);_0x321288[_0xd650('0x2d')]=_['keys'](_0x545b0d['query']);_0x321288['filters']=_['intersection'](_0x321288[_0xd650('0x31')],_0x321288[_0xd650('0x2d')]);_0x5e4c01[_0xd650('0x33')]=_[_0xd650('0x30')](_0x321288[_0xd650('0x31')],qs['fields'](_0x545b0d[_0xd650('0x2d')][_0xd650('0x32')]));_0x5e4c01[_0xd650('0x33')]=_0x5e4c01[_0xd650('0x33')][_0xd650('0x34')]?_0x5e4c01['attributes']:_0x321288['model'];_0x5e4c01[_0xd650('0x37')]=qs[_0xd650('0x38')](_0x545b0d[_0xd650('0x2d')][_0xd650('0x38')]);_0x5e4c01['where']=qs[_0xd650('0x2f')](_[_0xd650('0x39')](_0x545b0d[_0xd650('0x2d')],_0x321288[_0xd650('0x2f')]));if(_0x545b0d[_0xd650('0x2d')][_0xd650('0x3d')]){_0x5e4c01[_0xd650('0x3e')]=_[_0xd650('0x3c')](_0x5e4c01['where'],{'$or':_[_0xd650('0x3f')](_0x5e4c01[_0xd650('0x33')],function(_0x3427aa){var _0x5133a0={};_0x5133a0[_0x3427aa]={'$like':'%'+_0x545b0d['query'][_0xd650('0x3d')]+'%'};return _0x5133a0;})});}_0x5e4c01=_['merge']({},_0x5e4c01,_0x545b0d[_0xd650('0x40')]);return _0x55032e[_0xd650('0x50')](_0x5e4c01);}})[_0xd650('0x22')](function(_0x10a585){if(_0x10a585){_0xfcb742=_0x10a585[_0xd650('0x34')];if(!_0x545b0d[_0xd650('0x2d')][_0xd650('0x35')]('nolimit')){_0x5e4c01[_0xd650('0x36')]=qs[_0xd650('0x36')](_0x545b0d[_0xd650('0x2d')][_0xd650('0x36')]);_0x5e4c01[_0xd650('0x1a')]=qs['offset'](_0x545b0d[_0xd650('0x2d')][_0xd650('0x1a')]);}return _0x55032e[_0xd650('0x50')](_0x5e4c01);}})['then'](function(_0x2405c8){if(_0x2405c8){return _0x2405c8?{'count':_0xfcb742,'rows':_0x2405c8}:null;}})['then'](respondWithResult(_0x175a84,null))[_0xd650('0x45')](handleError(_0x175a84,null));}; \ No newline at end of file +var _0xe15d=['name','send','SquareProject','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','add','day','merge','where','map','filter','options','includeAll','include','findAll','rows','params','find','catch','create','update','body','addUsers','omit','removeUsers','ids','emit','userSquareProject:remove','User','getUsers','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','../../components/parsers/qs','../../config/logger','api','../../config/utils','socket.io-emitter','localhost','./squareProject.socket','register','sendStatus','end','status','json','count','offset','limit','apply','save','then','destroy','error'];(function(_0x1cc1fd,_0x33f9f1){var _0x5e3d41=function(_0x356881){while(--_0x356881){_0x1cc1fd['push'](_0x1cc1fd['shift']());}};_0x5e3d41(++_0x33f9f1);}(_0xe15d,0x15c));var _0xde15=function(_0x9cb238,_0x43e22e){_0x9cb238=_0x9cb238-0x0;var _0x36acba=_0xe15d[_0x9cb238];return _0x36acba;};'use strict';var jsonpatch=require(_0xde15('0x0'));var rp=require(_0xde15('0x1'));var moment=require('moment');var BPromise=require(_0xde15('0x2'));var Mustache=require(_0xde15('0x3'));var util=require(_0xde15('0x4'));var path=require(_0xde15('0x5'));var sox=require(_0xde15('0x6'));var csv=require(_0xde15('0x7'));var ejs=require(_0xde15('0x8'));var fs=require('fs');var _=require(_0xde15('0x9'));var squel=require(_0xde15('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xde15('0xb'));var toCsv=require(_0xde15('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0xde15('0xc'));var logger=require(_0xde15('0xd'))(_0xde15('0xe'));var utils=require(_0xde15('0xf'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0xde15('0x10'))({'host':_0xde15('0x11'),'port':0x18eb});require(_0xde15('0x12'))[_0xde15('0x13')](socket);function respondWithStatusCode(_0xcf3619,_0x4142b4){_0x4142b4=_0x4142b4||0xcc;return function(_0x685a2a){if(_0x685a2a){return _0xcf3619[_0xde15('0x14')](_0x4142b4);}return _0xcf3619['status'](_0x4142b4)[_0xde15('0x15')]();};}function respondWithResult(_0x44f30c,_0x54d901){_0x54d901=_0x54d901||0xc8;return function(_0x324468){if(_0x324468){return _0x44f30c[_0xde15('0x16')](_0x54d901)[_0xde15('0x17')](_0x324468);}};}function respondWithFilteredResult(_0x22a19c,_0xe53f2){return function(_0x540ccb){if(_0x540ccb){var _0x373761=_0x540ccb[_0xde15('0x18')],_0x5135b5=_0xe53f2['offset'],_0x2538f7=_0xe53f2[_0xde15('0x19')]+_0xe53f2[_0xde15('0x1a')],_0x253b5d;if(_0x2538f7>=_0x373761){_0x2538f7=_0x373761;_0x253b5d=0xc8;}else{_0x253b5d=0xce;}_0x22a19c[_0xde15('0x16')](_0x253b5d);return _0x22a19c['set']('Content-Range',_0x5135b5+'-'+_0x2538f7+'/'+_0x373761)[_0xde15('0x17')](_0x540ccb);}return null;};}function patchUpdates(_0x294c35){return function(_0x901a93){try{jsonpatch[_0xde15('0x1b')](_0x901a93,_0x294c35,!![]);}catch(_0x278f66){return BPromise['reject'](_0x278f66);}return _0x901a93[_0xde15('0x1c')]();};}function saveUpdates(_0x3b3486,_0x5374d3){return function(_0x409005){if(_0x409005){return _0x409005['update'](_0x3b3486)[_0xde15('0x1d')](function(_0x41834e){return _0x41834e;});}return null;};}function removeEntity(_0x360da6,_0x3e4418){return function(_0x52cc35){if(_0x52cc35){return _0x52cc35[_0xde15('0x1e')]()[_0xde15('0x1d')](function(){_0x360da6[_0xde15('0x16')](0xcc)[_0xde15('0x15')]();});}};}function handleEntityNotFound(_0xab7b2a,_0x631c1b){return function(_0xdb5f76){if(!_0xdb5f76){_0xab7b2a[_0xde15('0x14')](0x194);}return _0xdb5f76;};}function handleError(_0x40b88d,_0x3faa51){_0x3faa51=_0x3faa51||0x1f4;return function(_0x11ec3f){logger[_0xde15('0x1f')](_0x11ec3f['stack']);if(_0x11ec3f['name']){delete _0x11ec3f[_0xde15('0x20')];}_0x40b88d[_0xde15('0x16')](_0x3faa51)[_0xde15('0x21')](_0x11ec3f);};}exports['index']=function(_0xc06f5,_0x5868ca){var _0x3084a9={},_0x4fdf8b={},_0x21254f={'count':0x0,'rows':[]};var _0x2b1694=db[_0xde15('0x22')][_0xde15('0x23')];_0x4fdf8b[_0xde15('0x24')]=_[_0xde15('0x25')](_0x2b1694);var _0x2580d4={'dateStart':_0xc06f5[_0xde15('0x26')][_0xde15('0x27')],'dateEnd':_0xc06f5[_0xde15('0x26')][_0xde15('0x28')]};delete _0xc06f5['query'][_0xde15('0x27')];delete _0xc06f5[_0xde15('0x26')][_0xde15('0x28')];_0x4fdf8b[_0xde15('0x26')]=_[_0xde15('0x25')](_0xc06f5[_0xde15('0x26')]);_0x4fdf8b[_0xde15('0x29')]=_[_0xde15('0x2a')](_0x4fdf8b['model'],_0x4fdf8b[_0xde15('0x26')]);_0x3084a9[_0xde15('0x2b')]=_['intersection'](_0x4fdf8b['model'],qs['fields'](_0xc06f5['query'][_0xde15('0x2c')]));_0x3084a9['attributes']=_0x3084a9[_0xde15('0x2b')][_0xde15('0x2d')]?_0x3084a9[_0xde15('0x2b')]:_0x4fdf8b['model'];if(!_0xc06f5[_0xde15('0x26')][_0xde15('0x2e')](_0xde15('0x2f'))){_0x3084a9[_0xde15('0x1a')]=qs[_0xde15('0x1a')](_0xc06f5[_0xde15('0x26')][_0xde15('0x1a')]);_0x3084a9[_0xde15('0x19')]=qs[_0xde15('0x19')](_0xc06f5[_0xde15('0x26')][_0xde15('0x19')]);}_0x3084a9[_0xde15('0x30')]=qs['sort'](_0xc06f5[_0xde15('0x26')][_0xde15('0x31')]);_0x3084a9['where']=qs[_0xde15('0x29')](_[_0xde15('0x32')](_0xc06f5[_0xde15('0x26')],_0x4fdf8b[_0xde15('0x29')]));if(_0x2580d4['dateStart']){if(_0x2580d4[_0xde15('0x28')]){_0x2580d4[_0xde15('0x28')]=moment(_0x2580d4[_0xde15('0x28')])[_0xde15('0x33')](0x1,_0xde15('0x34'));}else{_0x2580d4[_0xde15('0x28')]=moment(_0x2580d4['dateStart'])[_0xde15('0x33')](0x1,_0xde15('0x34'));}_[_0xde15('0x35')](_0x3084a9[_0xde15('0x36')],{'createdAt':{'$gte':_0x2580d4['dateStart'],'$lte':_0x2580d4[_0xde15('0x28')]}});}if(_0xc06f5[_0xde15('0x26')]['filter']){_0x3084a9['where']=_[_0xde15('0x35')](_0x3084a9[_0xde15('0x36')],{'$or':_[_0xde15('0x37')](_0x3084a9[_0xde15('0x2b')],function(_0x14f5dc){var _0x17270d={};_0x17270d[_0x14f5dc]={'$like':'%'+_0xc06f5['query'][_0xde15('0x38')]+'%'};return _0x17270d;})});}_0x3084a9=_[_0xde15('0x35')]({},_0x3084a9,_0xc06f5[_0xde15('0x39')]);var _0x429168={'where':_0x3084a9[_0xde15('0x36')]};return db[_0xde15('0x22')][_0xde15('0x18')](_0x429168)[_0xde15('0x1d')](function(_0x4cbae8){_0x21254f['count']=_0x4cbae8;if(_0xc06f5[_0xde15('0x26')][_0xde15('0x3a')]){_0x3084a9[_0xde15('0x3b')]=[{'all':!![]}];}return db['SquareProject'][_0xde15('0x3c')](_0x3084a9);})[_0xde15('0x1d')](function(_0x113af1){_0x21254f[_0xde15('0x3d')]=_0x113af1;return _0x21254f;})[_0xde15('0x1d')](respondWithFilteredResult(_0x5868ca,_0x3084a9))['catch'](handleError(_0x5868ca,null));};exports['show']=function(_0x132cbe,_0x582690){var _0x205537={'raw':![],'where':{'id':_0x132cbe[_0xde15('0x3e')]['id']}},_0x582dd6={};_0x582dd6[_0xde15('0x24')]=_[_0xde15('0x25')](db[_0xde15('0x22')][_0xde15('0x23')]);_0x582dd6[_0xde15('0x26')]=_[_0xde15('0x25')](_0x132cbe[_0xde15('0x26')]);_0x582dd6[_0xde15('0x29')]=_[_0xde15('0x2a')](_0x582dd6[_0xde15('0x24')],_0x582dd6['query']);_0x205537['attributes']=_['intersection'](_0x582dd6['model'],qs[_0xde15('0x2c')](_0x132cbe[_0xde15('0x26')][_0xde15('0x2c')]));_0x205537[_0xde15('0x2b')]=_0x205537['attributes'][_0xde15('0x2d')]?_0x205537[_0xde15('0x2b')]:_0x582dd6['model'];if(_0x132cbe[_0xde15('0x26')][_0xde15('0x3a')]){_0x205537[_0xde15('0x3b')]=[{'all':!![]}];}_0x205537=_['merge']({},_0x205537,_0x132cbe['options']);return db[_0xde15('0x22')][_0xde15('0x3f')](_0x205537)['then'](handleEntityNotFound(_0x582690,null))[_0xde15('0x1d')](respondWithResult(_0x582690,null))[_0xde15('0x40')](handleError(_0x582690,null));};exports[_0xde15('0x41')]=function(_0x244d96,_0x48cb27){return db[_0xde15('0x22')][_0xde15('0x41')](_0x244d96['body'],{})[_0xde15('0x1d')](respondWithResult(_0x48cb27,0xc9))['catch'](handleError(_0x48cb27,null));};exports[_0xde15('0x42')]=function(_0x56b9a1,_0x279ed0){if(_0x56b9a1['body']['id']){delete _0x56b9a1[_0xde15('0x43')]['id'];}return db[_0xde15('0x22')][_0xde15('0x3f')]({'where':{'id':_0x56b9a1['params']['id']}})[_0xde15('0x1d')](handleEntityNotFound(_0x279ed0,null))[_0xde15('0x1d')](saveUpdates(_0x56b9a1[_0xde15('0x43')],null))['then'](respondWithResult(_0x279ed0,null))[_0xde15('0x40')](handleError(_0x279ed0,null));};exports[_0xde15('0x1e')]=function(_0x322f51,_0x40856f){return db[_0xde15('0x22')]['find']({'where':{'id':_0x322f51[_0xde15('0x3e')]['id']}})[_0xde15('0x1d')](handleEntityNotFound(_0x40856f,null))[_0xde15('0x1d')](removeEntity(_0x40856f,null))[_0xde15('0x40')](handleError(_0x40856f,null));};exports[_0xde15('0x44')]=function(_0xd3be37,_0x22a59b,_0x26de33){return db[_0xde15('0x22')][_0xde15('0x3f')]({'where':{'id':_0xd3be37[_0xde15('0x3e')]['id']}})['then'](handleEntityNotFound(_0x22a59b,null))[_0xde15('0x1d')](function(_0x58e6b8){if(_0x58e6b8){return _0x58e6b8['addUsers'](_0xd3be37['body']['ids'],_[_0xde15('0x45')](_0xd3be37[_0xde15('0x43')],['ids','id'])||{});}})[_0xde15('0x1d')](respondWithResult(_0x22a59b,null))[_0xde15('0x40')](handleError(_0x22a59b,null));};exports[_0xde15('0x46')]=function(_0x5ad907,_0xd583af,_0x48d3aa){var _0x503d9b;return db['SquareProject'][_0xde15('0x3f')]({'where':{'id':_0x5ad907[_0xde15('0x3e')]['id']}})[_0xde15('0x1d')](handleEntityNotFound(_0xd583af,null))[_0xde15('0x1d')](function(_0x63cb26){if(_0x63cb26){return _0x63cb26[_0xde15('0x46')](_0x5ad907[_0xde15('0x26')]['ids'])[_0xde15('0x1d')](function(_0x1081ef){if(_['isArray'](_0x5ad907[_0xde15('0x26')][_0xde15('0x47')])){for(var _0x2b195a=0x0;_0x2b195a<_0x5ad907[_0xde15('0x26')]['ids'][_0xde15('0x2d')];_0x2b195a+=0x1){socket[_0xde15('0x48')](_0xde15('0x49'),{'UserId':_0x5ad907[_0xde15('0x26')][_0xde15('0x47')][_0x2b195a],'SquareProjectId':_0x5ad907['params']['id']});}}else{socket[_0xde15('0x48')]('userSquareProject:remove',{'UserId':_0x5ad907[_0xde15('0x26')][_0xde15('0x47')],'SquareProjectId':_0x5ad907[_0xde15('0x3e')]['id']});}});}})['then'](respondWithStatusCode(_0xd583af,null))[_0xde15('0x40')](handleError(_0xd583af,null));};exports['getUsers']=function(_0x10c110,_0x4d052d,_0x497b41){var _0x4670ae={};var _0xb992b1={};var _0x4e4010;var _0x4106ef;return db[_0xde15('0x22')]['findOne']({'where':{'id':_0x10c110[_0xde15('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4d052d,null))['then'](function(_0x5db673){if(_0x5db673){_0x4e4010=_0x5db673;_0xb992b1[_0xde15('0x24')]=_[_0xde15('0x25')](db[_0xde15('0x4a')][_0xde15('0x23')]);_0xb992b1[_0xde15('0x26')]=_[_0xde15('0x25')](_0x10c110[_0xde15('0x26')]);_0xb992b1['filters']=_[_0xde15('0x2a')](_0xb992b1['model'],_0xb992b1[_0xde15('0x26')]);_0x4670ae[_0xde15('0x2b')]=_[_0xde15('0x2a')](_0xb992b1[_0xde15('0x24')],qs[_0xde15('0x2c')](_0x10c110[_0xde15('0x26')][_0xde15('0x2c')]));_0x4670ae[_0xde15('0x2b')]=_0x4670ae['attributes'][_0xde15('0x2d')]?_0x4670ae[_0xde15('0x2b')]:_0xb992b1[_0xde15('0x24')];_0x4670ae['order']=qs[_0xde15('0x31')](_0x10c110[_0xde15('0x26')]['sort']);_0x4670ae[_0xde15('0x36')]=qs[_0xde15('0x29')](_['pick'](_0x10c110['query'],_0xb992b1[_0xde15('0x29')]));if(_0x10c110[_0xde15('0x26')][_0xde15('0x38')]){_0x4670ae[_0xde15('0x36')]=_[_0xde15('0x35')](_0x4670ae['where'],{'$or':_['map'](_0x4670ae[_0xde15('0x2b')],function(_0x5f29ba){var _0x1f33c5={};_0x1f33c5[_0x5f29ba]={'$like':'%'+_0x10c110['query']['filter']+'%'};return _0x1f33c5;})});}_0x4670ae=_['merge']({},_0x4670ae,_0x10c110[_0xde15('0x39')]);return _0x4e4010[_0xde15('0x4b')](_0x4670ae);}})[_0xde15('0x1d')](function(_0x53f1c6){if(_0x53f1c6){_0x4106ef=_0x53f1c6[_0xde15('0x2d')];if(!_0x10c110[_0xde15('0x26')][_0xde15('0x2e')](_0xde15('0x2f'))){_0x4670ae['limit']=qs[_0xde15('0x1a')](_0x10c110[_0xde15('0x26')][_0xde15('0x1a')]);_0x4670ae[_0xde15('0x19')]=qs[_0xde15('0x19')](_0x10c110[_0xde15('0x26')][_0xde15('0x19')]);}return _0x4e4010['getUsers'](_0x4670ae);}})[_0xde15('0x1d')](function(_0x4fc733){if(_0x4fc733){return _0x4fc733?{'count':_0x4106ef,'rows':_0x4fc733}:null;}})[_0xde15('0x1d')](respondWithResult(_0x4d052d,null))['catch'](handleError(_0x4d052d,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index e371281..933cb86 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 _0x9e3a=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','SquareProject'];(function(_0x3fe04c,_0x10960){var _0x3c243a=function(_0xf921ea){while(--_0xf921ea){_0x3fe04c['push'](_0x3fe04c['shift']());}};_0x3c243a(++_0x10960);}(_0x9e3a,0x179));var _0xa9e3=function(_0x22911c,_0x52ebdb){_0x22911c=_0x22911c-0x0;var _0x5b68a4=_0x9e3a[_0x22911c];return _0x5b68a4;};'use strict';var EventEmitter=require(_0xa9e3('0x0'));var SquareProject=require(_0xa9e3('0x1'))['db'][_0xa9e3('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa9e3('0x3')](0x0);var events={'afterCreate':_0xa9e3('0x4'),'afterUpdate':_0xa9e3('0x5'),'afterDestroy':_0xa9e3('0x6')};function emitEvent(_0x1bdbb3){return function(_0x186b69,_0x24059f,_0x3cf697){SquareProjectEvents[_0xa9e3('0x7')](_0x1bdbb3+':'+_0x186b69['id'],_0x186b69);SquareProjectEvents['emit'](_0x1bdbb3,_0x186b69);_0x3cf697(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xa9e3('0x8')](e,emitEvent(event));}}module[_0xa9e3('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0xd80d=['SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x65d748,_0x35e146){var _0x52e055=function(_0x115a19){while(--_0x115a19){_0x65d748['push'](_0x65d748['shift']());}};_0x52e055(++_0x35e146);}(_0xd80d,0x1c1));var _0xdd80=function(_0x4c6598,_0x25e7fe){_0x4c6598=_0x4c6598-0x0;var _0x193df6=_0xd80d[_0x4c6598];return _0x193df6;};'use strict';var EventEmitter=require(_0xdd80('0x0'));var SquareProject=require(_0xdd80('0x1'))['db'][_0xdd80('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xdd80('0x3')](0x0);var events={'afterCreate':_0xdd80('0x4'),'afterUpdate':_0xdd80('0x5'),'afterDestroy':_0xdd80('0x6')};function emitEvent(_0x6148b2){return function(_0x165753,_0x22b6a6,_0x33f1d3){SquareProjectEvents[_0xdd80('0x7')](_0x6148b2+':'+_0x165753['id'],_0x165753);SquareProjectEvents['emit'](_0x6148b2,_0x165753);_0x33f1d3(null);};}for(var e in events){if(events[_0xdd80('0x8')](e)){var event=events[e];SquareProject[_0xdd80('0x9')](e,emitEvent(event));}}module[_0xdd80('0xa')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index eb73d01..cf66ac5 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 _0xffaa=['exports','define','SquareProject','square_projects','lodash','util','../../config/logger','bluebird','request-promise','./squareProject.attributes'];(function(_0x1947d1,_0x1c249b){var _0x515012=function(_0x4eda75){while(--_0x4eda75){_0x1947d1['push'](_0x1947d1['shift']());}};_0x515012(++_0x1c249b);}(_0xffaa,0x130));var _0xaffa=function(_0x1eef64,_0x5b1fb9){_0x1eef64=_0x1eef64-0x0;var _0x38fa49=_0xffaa[_0x1eef64];return _0x38fa49;};'use strict';var _=require(_0xaffa('0x0'));var util=require(_0xaffa('0x1'));var logger=require(_0xaffa('0x2'))('api');var moment=require('moment');var BPromise=require(_0xaffa('0x3'));var rp=require(_0xaffa('0x4'));var attributes=require(_0xaffa('0x5'));module[_0xaffa('0x6')]=function(_0x444eef,_0x46692a){return _0x444eef[_0xaffa('0x7')](_0xaffa('0x8'),attributes,{'tableName':_0xaffa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc97b=['SquareProject','util','../../config/logger','moment','bluebird','request-promise','exports','define'];(function(_0x422563,_0x3ebb1f){var _0x4544ad=function(_0x589194){while(--_0x589194){_0x422563['push'](_0x422563['shift']());}};_0x4544ad(++_0x3ebb1f);}(_0xc97b,0xb1));var _0xbc97=function(_0x4d7707,_0x9784ca){_0x4d7707=_0x4d7707-0x0;var _0x5d3421=_0xc97b[_0x4d7707];return _0x5d3421;};'use strict';var _=require('lodash');var util=require(_0xbc97('0x0'));var logger=require(_0xbc97('0x1'))('api');var moment=require(_0xbc97('0x2'));var BPromise=require(_0xbc97('0x3'));var rp=require(_0xbc97('0x4'));var attributes=require('./squareProject.attributes');module[_0xbc97('0x5')]=function(_0x325005,_0x1b5f9d){return _0x325005[_0xbc97('0x6')](_0xbc97('0x7'),attributes,{'tableName':'square_projects','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 1099b96..57da0b3 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 _0x45b1=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','socket.io-emitter','localhost','register','request','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','find','options','where','include','map','attributes','model','then','ShowSquareProject','stringify','lodash','moment','bluebird'];(function(_0x4b9273,_0x3ae0ea){var _0x363f36=function(_0x9b3d8f){while(--_0x9b3d8f){_0x4b9273['push'](_0x4b9273['shift']());}};_0x363f36(++_0x3ae0ea);}(_0x45b1,0xfd));var _0x145b=function(_0x29f170,_0x5ce657){_0x29f170=_0x29f170-0x0;var _0x4dc3a3=_0x45b1[_0x29f170];return _0x4dc3a3;};'use strict';var _=require(_0x145b('0x0'));var util=require('util');var moment=require(_0x145b('0x1'));var BPromise=require(_0x145b('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x145b('0x3'));var logger=require(_0x145b('0x4'))('rpc');var config=require(_0x145b('0x5'));var jayson=require(_0x145b('0x6'));var client=jayson[_0x145b('0x7')]['http']({'port':0x232a});var socket=require(_0x145b('0x8'))({'host':_0x145b('0x9'),'port':0x18eb});require('./squareProject.socket')[_0x145b('0xa')](socket);function respondWithRpcPromise(_0x3bb37a,_0xb1e57d,_0x4a68ed){return new BPromise(function(_0x2f9fda,_0x4cace8){return client[_0x145b('0xb')](_0x3bb37a,_0x4a68ed)['then'](function(_0xa4e4dd){logger[_0x145b('0xc')](_0x145b('0xd'),_0xb1e57d,_0x145b('0xe'));logger[_0x145b('0xf')](_0x145b('0x10'),_0xb1e57d,_0x145b('0xe'),JSON['stringify'](_0xa4e4dd));if(_0xa4e4dd[_0x145b('0x11')]){if(_0xa4e4dd[_0x145b('0x11')][_0x145b('0x12')]===0x1f4){logger[_0x145b('0x11')](_0x145b('0xd'),_0xb1e57d,_0xa4e4dd[_0x145b('0x11')]['message']);return _0x4cace8(_0xa4e4dd['error'][_0x145b('0x13')]);}logger['error'](_0x145b('0xd'),_0xb1e57d,_0xa4e4dd[_0x145b('0x11')][_0x145b('0x13')]);return _0x2f9fda(_0xa4e4dd[_0x145b('0x11')][_0x145b('0x13')]);}else{logger[_0x145b('0xc')]('SquareProject,\x20%s,\x20%s',_0xb1e57d,_0x145b('0xe'));_0x2f9fda(_0xa4e4dd[_0x145b('0x14')]['message']);}})[_0x145b('0x15')](function(_0x2a6765){logger[_0x145b('0x11')]('SquareProject,\x20%s,\x20%s',_0xb1e57d,_0x2a6765);_0x4cace8(_0x2a6765);});});}exports['ShowSquareProject']=function(_0x1e0eef){var _0xdd3743=this;return new Promise(function(_0x55d022,_0x183039){return db['SquareProject'][_0x145b('0x16')]({'raw':_0x1e0eef[_0x145b('0x17')]?_0x1e0eef[_0x145b('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1e0eef['options']?_0x1e0eef[_0x145b('0x17')][_0x145b('0x18')]||null:null,'attributes':_0x1e0eef['options']?_0x1e0eef[_0x145b('0x17')]['attributes']||null:null,'include':_0x1e0eef[_0x145b('0x17')]?_0x1e0eef[_0x145b('0x17')][_0x145b('0x19')]?_[_0x145b('0x1a')](_0x1e0eef['options'][_0x145b('0x19')],function(_0x190b0c){return{'model':db[_0x190b0c['model']],'as':_0x190b0c['as'],'attributes':_0x190b0c[_0x145b('0x1b')],'include':_0x190b0c[_0x145b('0x19')]?_[_0x145b('0x1a')](_0x190b0c[_0x145b('0x19')],function(_0x872409){return{'model':db[_0x872409[_0x145b('0x1c')]],'as':_0x872409['as'],'attributes':_0x872409[_0x145b('0x1b')],'include':_0x872409[_0x145b('0x19')]?_[_0x145b('0x1a')](_0x872409[_0x145b('0x19')],function(_0x4d9ee9){return{'model':db[_0x4d9ee9[_0x145b('0x1c')]],'as':_0x4d9ee9['as'],'attributes':_0x4d9ee9['attributes']};}):[]};}):[]};}):[]:[]})[_0x145b('0x1d')](function(_0x31132c){logger['info'](_0x145b('0x1e'),_0x1e0eef);logger[_0x145b('0xf')](_0x145b('0x1e'),_0x1e0eef,JSON[_0x145b('0x1f')](_0x31132c));_0x55d022(_0x31132c);})[_0x145b('0x15')](function(_0x1ceea3){logger[_0x145b('0x11')]('ShowSquareProject',_0x1ceea3[_0x145b('0x13')],_0x1e0eef);_0x183039(_0xdd3743[_0x145b('0x11')](0x1f4,_0x1ceea3[_0x145b('0x13')]));});});}; \ No newline at end of file +var _0x1f19=['map','model','debug','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','http','socket.io-emitter','register','request','then','info','SquareProject,\x20%s,\x20%s','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSquareProject','find','options','attributes','include'];(function(_0x17558f,_0x42f9f5){var _0x4a81a5=function(_0x14ec0a){while(--_0x14ec0a){_0x17558f['push'](_0x17558f['shift']());}};_0x4a81a5(++_0x42f9f5);}(_0x1f19,0xb7));var _0x91f1=function(_0x21f977,_0x3949e9){_0x21f977=_0x21f977-0x0;var _0x1e0b83=_0x1f19[_0x21f977];return _0x1e0b83;};'use strict';var _=require('lodash');var util=require(_0x91f1('0x0'));var moment=require(_0x91f1('0x1'));var BPromise=require(_0x91f1('0x2'));var rs=require(_0x91f1('0x3'));var fs=require('fs');var db=require(_0x91f1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x91f1('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x91f1('0x6'));var client=jayson['client'][_0x91f1('0x7')]({'port':0x232a});var socket=require(_0x91f1('0x8'))({'host':'localhost','port':0x18eb});require('./squareProject.socket')[_0x91f1('0x9')](socket);function respondWithRpcPromise(_0x20d811,_0x1ea494,_0x2ca580){return new BPromise(function(_0x140382,_0x351b9b){return client[_0x91f1('0xa')](_0x20d811,_0x2ca580)[_0x91f1('0xb')](function(_0x12ab91){logger[_0x91f1('0xc')](_0x91f1('0xd'),_0x1ea494,'request\x20sent');logger['debug'](_0x91f1('0xe'),_0x1ea494,_0x91f1('0xf'),JSON[_0x91f1('0x10')](_0x12ab91));if(_0x12ab91[_0x91f1('0x11')]){if(_0x12ab91[_0x91f1('0x11')][_0x91f1('0x12')]===0x1f4){logger[_0x91f1('0x11')](_0x91f1('0xd'),_0x1ea494,_0x12ab91[_0x91f1('0x11')][_0x91f1('0x13')]);return _0x351b9b(_0x12ab91['error'][_0x91f1('0x13')]);}logger[_0x91f1('0x11')](_0x91f1('0xd'),_0x1ea494,_0x12ab91[_0x91f1('0x11')][_0x91f1('0x13')]);return _0x140382(_0x12ab91['error']['message']);}else{logger['info']('SquareProject,\x20%s,\x20%s',_0x1ea494,_0x91f1('0xf'));_0x140382(_0x12ab91[_0x91f1('0x14')]['message']);}})[_0x91f1('0x15')](function(_0x2f7205){logger['error'](_0x91f1('0xd'),_0x1ea494,_0x2f7205);_0x351b9b(_0x2f7205);});});}exports[_0x91f1('0x16')]=function(_0x263e2e){var _0x5aa258=this;return new Promise(function(_0x54567a,_0x566aaa){return db['SquareProject'][_0x91f1('0x17')]({'raw':_0x263e2e[_0x91f1('0x18')]?_0x263e2e[_0x91f1('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x263e2e[_0x91f1('0x18')]?_0x263e2e['options']['where']||null:null,'attributes':_0x263e2e['options']?_0x263e2e[_0x91f1('0x18')][_0x91f1('0x19')]||null:null,'include':_0x263e2e[_0x91f1('0x18')]?_0x263e2e['options'][_0x91f1('0x1a')]?_[_0x91f1('0x1b')](_0x263e2e[_0x91f1('0x18')][_0x91f1('0x1a')],function(_0x105a31){return{'model':db[_0x105a31[_0x91f1('0x1c')]],'as':_0x105a31['as'],'attributes':_0x105a31[_0x91f1('0x19')],'include':_0x105a31['include']?_[_0x91f1('0x1b')](_0x105a31[_0x91f1('0x1a')],function(_0x19148e){return{'model':db[_0x19148e[_0x91f1('0x1c')]],'as':_0x19148e['as'],'attributes':_0x19148e[_0x91f1('0x19')],'include':_0x19148e[_0x91f1('0x1a')]?_[_0x91f1('0x1b')](_0x19148e[_0x91f1('0x1a')],function(_0x204d4d){return{'model':db[_0x204d4d[_0x91f1('0x1c')]],'as':_0x204d4d['as'],'attributes':_0x204d4d[_0x91f1('0x19')]};}):[]};}):[]};}):[]:[]})[_0x91f1('0xb')](function(_0x123136){logger['info'](_0x91f1('0x16'),_0x263e2e);logger[_0x91f1('0x1d')]('ShowSquareProject',_0x263e2e,JSON[_0x91f1('0x10')](_0x123136));_0x54567a(_0x123136);})[_0x91f1('0x15')](function(_0x41067e){logger[_0x91f1('0x11')](_0x91f1('0x16'),_0x41067e[_0x91f1('0x13')],_0x263e2e);_0x566aaa(_0x5aa258[_0x91f1('0x11')](0x1f4,_0x41067e['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 8fd03b8..e50fc83 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 _0xaf9b=['removeListener','register','squareProject:','./squareProject.events','remove','emit'];(function(_0x34567e,_0x589de6){var _0x48b765=function(_0x3fab65){while(--_0x3fab65){_0x34567e['push'](_0x34567e['shift']());}};_0x48b765(++_0x589de6);}(_0xaf9b,0x1d7));var _0xbaf9=function(_0x106205,_0x5484ff){_0x106205=_0x106205-0x0;var _0x44cbd0=_0xaf9b[_0x106205];return _0x44cbd0;};'use strict';var SquareProjectEvents=require(_0xbaf9('0x0'));var events=['save',_0xbaf9('0x1'),'update'];function createListener(_0x1f2f6e,_0x353aad){return function(_0x46312a){_0x353aad[_0xbaf9('0x2')](_0x1f2f6e,_0x46312a);};}function removeListener(_0x512b7c,_0x64585f){return function(){SquareProjectEvents[_0xbaf9('0x3')](_0x512b7c,_0x64585f);};}exports[_0xbaf9('0x4')]=function(_0x4b443e){for(var _0x40b949=0x0,_0x3578fd=events['length'];_0x40b949<_0x3578fd;_0x40b949++){var _0x4a8f38=events[_0x40b949];var _0x1168ed=createListener(_0xbaf9('0x5')+_0x4a8f38,_0x4b443e);SquareProjectEvents['on'](_0x4a8f38,_0x1168ed);}}; \ No newline at end of file +var _0x9099=['length','./squareProject.events','remove','update','emit','removeListener','register'];(function(_0x5f17cb,_0x26ca1f){var _0x5e5d2d=function(_0x37381f){while(--_0x37381f){_0x5f17cb['push'](_0x5f17cb['shift']());}};_0x5e5d2d(++_0x26ca1f);}(_0x9099,0x1ac));var _0x9909=function(_0xa98302,_0x844f27){_0xa98302=_0xa98302-0x0;var _0x1ad8e3=_0x9099[_0xa98302];return _0x1ad8e3;};'use strict';var SquareProjectEvents=require(_0x9909('0x0'));var events=['save',_0x9909('0x1'),_0x9909('0x2')];function createListener(_0x38e636,_0x2524d3){return function(_0x3fd4b4){_0x2524d3[_0x9909('0x3')](_0x38e636,_0x3fd4b4);};}function removeListener(_0x2168ff,_0x6eb0ac){return function(){SquareProjectEvents[_0x9909('0x4')](_0x2168ff,_0x6eb0ac);};}exports[_0x9909('0x5')]=function(_0x3947ed){for(var _0x41c07e=0x0,_0x3b7391=events[_0x9909('0x6')];_0x41c07e<_0x3b7391;_0x41c07e++){var _0x54011f=events[_0x41c07e];var _0x6d755a=createListener('squareProject:'+_0x54011f,_0x3947ed);SquareProjectEvents['on'](_0x54011f,_0x6d755a);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index b197cbc..ab41902 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 _0x43c8=['/:id','/:id/download','download','create','put','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x43c8,0x107));var _0x843c=function(_0x2e5cea,_0x2e3db9){_0x2e5cea=_0x2e5cea-0x0;var _0x2f29a4=_0x43c8[_0x2e5cea];return _0x2f29a4;};'use strict';var multer=require(_0x843c('0x0'));var util=require(_0x843c('0x1'));var path=require(_0x843c('0x2'));var express=require(_0x843c('0x3'));var router=express['Router']();var auth=require(_0x843c('0x4'));var interaction=require(_0x843c('0x5'));var config=require('../../config/environment');var controller=require('./squareRecording.controller');router[_0x843c('0x6')]('/',auth[_0x843c('0x7')](),controller[_0x843c('0x8')]);router['get'](_0x843c('0x9'),auth[_0x843c('0x7')](),controller['show']);router[_0x843c('0x6')](_0x843c('0xa'),auth[_0x843c('0x7')](),controller[_0x843c('0xb')]);router['post']('/',auth[_0x843c('0x7')](),controller[_0x843c('0xc')]);router[_0x843c('0xd')](_0x843c('0x9'),auth[_0x843c('0x7')](),controller['update']);router[_0x843c('0xe')](_0x843c('0x9'),auth['isAuthenticated'](),controller[_0x843c('0xf')]);module[_0x843c('0x10')]=router; \ No newline at end of file +var _0xab39=['show','post','put','update','destroy','exports','multer','path','express','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id'];(function(_0x10f7f7,_0x457207){var _0x4ca615=function(_0x3db9aa){while(--_0x3db9aa){_0x10f7f7['push'](_0x10f7f7['shift']());}};_0x4ca615(++_0x457207);}(_0xab39,0x1e6));var _0x9ab3=function(_0x28aa92,_0x232a66){_0x28aa92=_0x28aa92-0x0;var _0x29dc2b=_0xab39[_0x28aa92];return _0x29dc2b;};'use strict';var multer=require(_0x9ab3('0x0'));var util=require('util');var path=require(_0x9ab3('0x1'));var express=require(_0x9ab3('0x2'));var router=express['Router']();var auth=require(_0x9ab3('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9ab3('0x4'));var controller=require(_0x9ab3('0x5'));router[_0x9ab3('0x6')]('/',auth[_0x9ab3('0x7')](),controller[_0x9ab3('0x8')]);router[_0x9ab3('0x6')](_0x9ab3('0x9'),auth[_0x9ab3('0x7')](),controller[_0x9ab3('0xa')]);router[_0x9ab3('0x6')]('/:id/download',auth[_0x9ab3('0x7')](),controller['download']);router[_0x9ab3('0xb')]('/',auth[_0x9ab3('0x7')](),controller['create']);router[_0x9ab3('0xc')](_0x9ab3('0x9'),auth['isAuthenticated'](),controller[_0x9ab3('0xd')]);router['delete'](_0x9ab3('0x9'),auth[_0x9ab3('0x7')](),controller[_0x9ab3('0xe')]);module[_0x9ab3('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index ca0e016..9e3b697 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 _0x8fa7=['STRING'];(function(_0x2f0157,_0x1b4373){var _0xcc899d=function(_0x51c203){while(--_0x51c203){_0x2f0157['push'](_0x2f0157['shift']());}};_0xcc899d(++_0x1b4373);}(_0x8fa7,0x7b));var _0x78fa=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x8fa7[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x78fa('0x0')]},'callerid':{'type':Sequelize[_0x78fa('0x0')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x78fa('0x0')]},'extension':{'type':Sequelize[_0x78fa('0x0')]},'priority':{'type':Sequelize[_0x78fa('0x0')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x78fa('0x0')]},'projectName':{'type':Sequelize[_0x78fa('0x0')]},'saveName':{'type':Sequelize[_0x78fa('0x0')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x78fa('0x0')]}}; \ No newline at end of file +var _0xd037=['STRING','sequelize','exports'];(function(_0x41227c,_0x5485f2){var _0x47f3a8=function(_0x342222){while(--_0x342222){_0x41227c['push'](_0x41227c['shift']());}};_0x47f3a8(++_0x5485f2);}(_0xd037,0xa6));var _0x7d03=function(_0x5b0a4a,_0xfc43c2){_0x5b0a4a=_0x5b0a4a-0x0;var _0x14d0bd=_0xd037[_0x5b0a4a];return _0x14d0bd;};'use strict';var Sequelize=require(_0x7d03('0x0'));module[_0x7d03('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x7d03('0x2')]},'calleridname':{'type':Sequelize[_0x7d03('0x2')]},'context':{'type':Sequelize[_0x7d03('0x2')]},'extension':{'type':Sequelize[_0x7d03('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7d03('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x7d03('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x7d03('0x2')]},'savePath':{'type':Sequelize[_0x7d03('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 171b342..dd4bf19 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 _0xac9d=['jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','SquareRecording','model','keys','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','dateStart','day','add','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','download','../../components/encryptor','type','uniqueid','savePath','filename','format','%s.cypher','value','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','extname','unlink','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto'];(function(_0x1ff26f,_0x2688e1){var _0x12ab8c=function(_0x186660){while(--_0x186660){_0x1ff26f['push'](_0x1ff26f['shift']());}};_0x12ab8c(++_0x2688e1);}(_0xac9d,0x14d));var _0xdac9=function(_0x31dde9,_0x12e816){_0x31dde9=_0x31dde9-0x0;var _0x1fbf2d=_0xac9d[_0x31dde9];return _0x1fbf2d;};'use strict';var jsonpatch=require(_0xdac9('0x0'));var rp=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var Mustache=require(_0xdac9('0x4'));var util=require(_0xdac9('0x5'));var path=require(_0xdac9('0x6'));var sox=require(_0xdac9('0x7'));var csv=require('to-csv');var ejs=require(_0xdac9('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdac9('0x9'));var crypto=require(_0xdac9('0xa'));var jsforce=require(_0xdac9('0xb'));var deskjs=require(_0xdac9('0xc'));var toCsv=require(_0xdac9('0xd'));var querystring=require(_0xdac9('0xe'));var Papa=require('papaparse');var qs=require(_0xdac9('0xf'));var logger=require('../../config/logger')(_0xdac9('0x10'));var utils=require(_0xdac9('0x11'));var config=require(_0xdac9('0x12'));var db=require(_0xdac9('0x13'))['db'];function respondWithStatusCode(_0x23ec14,_0x2859bf){_0x2859bf=_0x2859bf||0xcc;return function(_0x255627){if(_0x255627){return _0x23ec14[_0xdac9('0x14')](_0x2859bf);}return _0x23ec14[_0xdac9('0x15')](_0x2859bf)['end']();};}function respondWithResult(_0x37b316,_0x43e0a5){_0x43e0a5=_0x43e0a5||0xc8;return function(_0x5a9bde){if(_0x5a9bde){return _0x37b316[_0xdac9('0x15')](_0x43e0a5)[_0xdac9('0x16')](_0x5a9bde);}};}function respondWithFilteredResult(_0xbfe6d8,_0x4b2436){return function(_0x16063f){if(_0x16063f){var _0x33ba20=_0x16063f[_0xdac9('0x17')],_0x9e1bf6=_0x4b2436[_0xdac9('0x18')],_0x5f0bbd=_0x4b2436['offset']+_0x4b2436[_0xdac9('0x19')],_0x5dd536;if(_0x5f0bbd>=_0x33ba20){_0x5f0bbd=_0x33ba20;_0x5dd536=0xc8;}else{_0x5dd536=0xce;}_0xbfe6d8[_0xdac9('0x15')](_0x5dd536);return _0xbfe6d8[_0xdac9('0x1a')](_0xdac9('0x1b'),_0x9e1bf6+'-'+_0x5f0bbd+'/'+_0x33ba20)[_0xdac9('0x16')](_0x16063f);}return null;};}function patchUpdates(_0x393acc){return function(_0x34a85a){try{jsonpatch[_0xdac9('0x1c')](_0x34a85a,_0x393acc,!![]);}catch(_0x4fa7c4){return BPromise[_0xdac9('0x1d')](_0x4fa7c4);}return _0x34a85a[_0xdac9('0x1e')]();};}function saveUpdates(_0x571e07,_0x1cd239){return function(_0xa57f2d){if(_0xa57f2d){return _0xa57f2d[_0xdac9('0x1f')](_0x571e07)[_0xdac9('0x20')](function(_0x522dc3){return _0x522dc3;});}return null;};}function removeEntity(_0x520369,_0x4029fc){return function(_0x20ece3){if(_0x20ece3){return _0x20ece3[_0xdac9('0x21')]()[_0xdac9('0x20')](function(){_0x520369['status'](0xcc)[_0xdac9('0x22')]();});}};}function handleEntityNotFound(_0x33cb7d,_0x27f473){return function(_0xae680a){if(!_0xae680a){_0x33cb7d[_0xdac9('0x14')](0x194);}return _0xae680a;};}function handleError(_0x42317c,_0x41335a){_0x41335a=_0x41335a||0x1f4;return function(_0xa1f726){logger[_0xdac9('0x23')](_0xa1f726[_0xdac9('0x24')]);if(_0xa1f726['name']){delete _0xa1f726[_0xdac9('0x25')];}_0x42317c[_0xdac9('0x15')](_0x41335a)[_0xdac9('0x26')](_0xa1f726);};}exports[_0xdac9('0x27')]=function(_0x5ca076,_0x1e631a){var _0x5686db={},_0x3ce475={},_0x2fce71={'count':0x0,'rows':[]};var _0x566d8c=db[_0xdac9('0x28')]['rawAttributes'];_0x3ce475[_0xdac9('0x29')]=_[_0xdac9('0x2a')](_0x566d8c);var _0xeff4b2={'dateStart':_0x5ca076[_0xdac9('0x2b')]['dateStart'],'dateEnd':_0x5ca076['query'][_0xdac9('0x2c')]};delete _0x5ca076[_0xdac9('0x2b')]['dateStart'];delete _0x5ca076['query'][_0xdac9('0x2c')];_0x3ce475[_0xdac9('0x2b')]=_[_0xdac9('0x2a')](_0x5ca076[_0xdac9('0x2b')]);_0x3ce475[_0xdac9('0x2d')]=_[_0xdac9('0x2e')](_0x3ce475[_0xdac9('0x29')],_0x3ce475[_0xdac9('0x2b')]);_0x5686db[_0xdac9('0x2f')]=_[_0xdac9('0x2e')](_0x3ce475[_0xdac9('0x29')],qs[_0xdac9('0x30')](_0x5ca076[_0xdac9('0x2b')][_0xdac9('0x30')]));_0x5686db[_0xdac9('0x2f')]=_0x5686db[_0xdac9('0x2f')][_0xdac9('0x31')]?_0x5686db[_0xdac9('0x2f')]:_0x3ce475[_0xdac9('0x29')];if(!_0x5ca076[_0xdac9('0x2b')][_0xdac9('0x32')]('nolimit')){_0x5686db['limit']=qs[_0xdac9('0x19')](_0x5ca076[_0xdac9('0x2b')][_0xdac9('0x19')]);_0x5686db[_0xdac9('0x18')]=qs[_0xdac9('0x18')](_0x5ca076['query'][_0xdac9('0x18')]);}_0x5686db['order']=qs[_0xdac9('0x33')](_0x5ca076[_0xdac9('0x2b')]['sort']);_0x5686db[_0xdac9('0x34')]=qs['filters'](_['pick'](_0x5ca076[_0xdac9('0x2b')],_0x3ce475[_0xdac9('0x2d')]));if(_0xeff4b2[_0xdac9('0x35')]){if(_0xeff4b2[_0xdac9('0x2c')]){_0xeff4b2[_0xdac9('0x2c')]=moment(_0xeff4b2[_0xdac9('0x2c')])['add'](0x1,_0xdac9('0x36'));}else{_0xeff4b2[_0xdac9('0x2c')]=moment(_0xeff4b2['dateStart'])[_0xdac9('0x37')](0x1,_0xdac9('0x36'));}_[_0xdac9('0x38')](_0x5686db[_0xdac9('0x34')],{'createdAt':{'$gte':_0xeff4b2[_0xdac9('0x35')],'$lte':_0xeff4b2[_0xdac9('0x2c')]}});}if(_0x5ca076[_0xdac9('0x2b')]['filter']){_0x5686db[_0xdac9('0x34')]=_[_0xdac9('0x38')](_0x5686db[_0xdac9('0x34')],{'$or':_['map'](_0x5686db[_0xdac9('0x2f')],function(_0x338e4a){var _0x26ba56={};_0x26ba56[_0x338e4a]={'$like':'%'+_0x5ca076[_0xdac9('0x2b')]['filter']+'%'};return _0x26ba56;})});}_0x5686db=_['merge']({},_0x5686db,_0x5ca076[_0xdac9('0x39')]);var _0xe47a3c={'where':_0x5686db[_0xdac9('0x34')]};return db[_0xdac9('0x28')][_0xdac9('0x17')](_0xe47a3c)['then'](function(_0x8435e8){_0x2fce71['count']=_0x8435e8;if(_0x5ca076[_0xdac9('0x2b')][_0xdac9('0x3a')]){_0x5686db[_0xdac9('0x3b')]=[{'all':!![]}];}return db[_0xdac9('0x28')][_0xdac9('0x3c')](_0x5686db);})[_0xdac9('0x20')](function(_0x413fb1){_0x2fce71[_0xdac9('0x3d')]=_0x413fb1;return _0x2fce71;})[_0xdac9('0x20')](respondWithFilteredResult(_0x1e631a,_0x5686db))[_0xdac9('0x3e')](handleError(_0x1e631a,null));};exports[_0xdac9('0x3f')]=function(_0x24b570,_0x278826){var _0x441676={'raw':!![],'where':{'id':_0x24b570[_0xdac9('0x40')]['id']}},_0x5335ae={};_0x5335ae[_0xdac9('0x29')]=_['keys'](db[_0xdac9('0x28')][_0xdac9('0x41')]);_0x5335ae[_0xdac9('0x2b')]=_[_0xdac9('0x2a')](_0x24b570[_0xdac9('0x2b')]);_0x5335ae[_0xdac9('0x2d')]=_['intersection'](_0x5335ae[_0xdac9('0x29')],_0x5335ae['query']);_0x441676[_0xdac9('0x2f')]=_[_0xdac9('0x2e')](_0x5335ae[_0xdac9('0x29')],qs[_0xdac9('0x30')](_0x24b570['query']['fields']));_0x441676['attributes']=_0x441676[_0xdac9('0x2f')]['length']?_0x441676['attributes']:_0x5335ae[_0xdac9('0x29')];if(_0x24b570[_0xdac9('0x2b')]['includeAll']){_0x441676['include']=[{'all':!![]}];}_0x441676=_[_0xdac9('0x38')]({},_0x441676,_0x24b570[_0xdac9('0x39')]);return db[_0xdac9('0x28')][_0xdac9('0x42')](_0x441676)[_0xdac9('0x20')](handleEntityNotFound(_0x278826,null))[_0xdac9('0x20')](respondWithResult(_0x278826,null))[_0xdac9('0x3e')](handleError(_0x278826,null));};exports[_0xdac9('0x43')]=function(_0x5c008b,_0x621cf){return db[_0xdac9('0x28')][_0xdac9('0x43')](_0x5c008b[_0xdac9('0x44')],{})[_0xdac9('0x20')](respondWithResult(_0x621cf,0xc9))[_0xdac9('0x3e')](handleError(_0x621cf,null));};exports[_0xdac9('0x1f')]=function(_0x37b498,_0x140dc5){if(_0x37b498[_0xdac9('0x44')]['id']){delete _0x37b498[_0xdac9('0x44')]['id'];}return db[_0xdac9('0x28')][_0xdac9('0x42')]({'where':{'id':_0x37b498[_0xdac9('0x40')]['id']}})['then'](handleEntityNotFound(_0x140dc5,null))['then'](saveUpdates(_0x37b498['body'],null))[_0xdac9('0x20')](respondWithResult(_0x140dc5,null))[_0xdac9('0x3e')](handleError(_0x140dc5,null));};exports['destroy']=function(_0x2a60bd,_0x2843f2){return db[_0xdac9('0x28')]['find']({'where':{'id':_0x2a60bd[_0xdac9('0x40')]['id']}})[_0xdac9('0x20')](handleEntityNotFound(_0x2843f2,null))['then'](removeEntity(_0x2843f2,null))['catch'](handleError(_0x2843f2,null));};exports[_0xdac9('0x45')]=function(_0x4469d8,_0x222de9,_0x370532){var _0x39df88=require(_0xdac9('0x46'));var _0x7a40ac=![];var _0x3a77e3={};if(_0x4469d8[_0xdac9('0x2b')][_0xdac9('0x47')]&&_0x4469d8[_0xdac9('0x2b')][_0xdac9('0x47')]===_0xdac9('0x48')){_0x3a77e3[_0xdac9('0x48')]=_0x4469d8[_0xdac9('0x40')]['id'];}else{_0x3a77e3['id']=_0x4469d8['params']['id'];}return db[_0xdac9('0x28')][_0xdac9('0x42')]({'where':_0x3a77e3,'attributes':['id',_0xdac9('0x49'),_0xdac9('0x4a')],'raw':!![]})[_0xdac9('0x20')](handleEntityNotFound(_0x222de9,null))[_0xdac9('0x20')](function(_0x4b118e){if(_0x4b118e){var _0x3ecdf7=util[_0xdac9('0x4b')](_0xdac9('0x4c'),_0x4b118e[_0xdac9('0x4d')]);if(fs[_0xdac9('0x4e')](_0x3ecdf7)){_0x7a40ac=!![];return _0x39df88[_0xdac9('0x4f')](_0x3ecdf7,_0x4b118e[_0xdac9('0x49')],config[_0xdac9('0x50')][_0xdac9('0x51')])['then'](function(){return _0x4b118e;});}return _0x4b118e;}})[_0xdac9('0x20')](function(_0x2c8411){if(_0x2c8411){if(!fs[_0xdac9('0x4e')](_0x2c8411[_0xdac9('0x49')])){throw new db[(_0xdac9('0x52'))][(_0xdac9('0x53'))]('SquareRecording\x20not\x20found');}if(_0x2c8411['filename']){return _0x222de9[_0xdac9('0x45')](_0x2c8411[_0xdac9('0x49')],_0x2c8411[_0xdac9('0x4a')]+path[_0xdac9('0x54')](_0x2c8411[_0xdac9('0x49')]),function(){if(_0x7a40ac){fs[_0xdac9('0x55')](_0x2c8411['savePath']);}});}else{return _0x222de9['download'](_0x2c8411['savePath'],function(_0xec5f49){if(_0x7a40ac){fs[_0xdac9('0x55')](_0x2c8411[_0xdac9('0x49')]);}});}}})[_0xdac9('0x3e')](handleError(_0x222de9,null));}; \ No newline at end of file +var _0x54ef=['attributes','fields','hasOwnProperty','nolimit','order','sort','pick','day','add','merge','where','filter','options','findAll','rows','catch','params','filters','includeAll','include','find','create','body','download','../../components/encryptor','type','uniqueid','filename','%s.cypher','value','existsSync','savePath','secrets','recording','ValidationError','SquareRecording\x20not\x20found','unlink','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','SquareRecording','rawAttributes','model','dateStart','dateEnd','query','keys','intersection'];(function(_0x59b1d7,_0x5abc0a){var _0x279b8=function(_0xadaf81){while(--_0xadaf81){_0x59b1d7['push'](_0x59b1d7['shift']());}};_0x279b8(++_0x5abc0a);}(_0x54ef,0x112));var _0xf54e=function(_0x38dc78,_0x1c7db2){_0x38dc78=_0x38dc78-0x0;var _0x34d0bb=_0x54ef[_0x38dc78];return _0x34d0bb;};'use strict';var jsonpatch=require(_0xf54e('0x0'));var rp=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf54e('0x3'));var util=require(_0xf54e('0x4'));var path=require(_0xf54e('0x5'));var sox=require(_0xf54e('0x6'));var csv=require(_0xf54e('0x7'));var ejs=require(_0xf54e('0x8'));var fs=require('fs');var _=require(_0xf54e('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf54e('0xa'));var deskjs=require(_0xf54e('0xb'));var toCsv=require(_0xf54e('0x7'));var querystring=require('querystring');var Papa=require(_0xf54e('0xc'));var qs=require('../../components/parsers/qs');var logger=require(_0xf54e('0xd'))(_0xf54e('0xe'));var utils=require('../../config/utils');var config=require(_0xf54e('0xf'));var db=require(_0xf54e('0x10'))['db'];function respondWithStatusCode(_0x6b9e61,_0x3ecfb3){_0x3ecfb3=_0x3ecfb3||0xcc;return function(_0x5f232a){if(_0x5f232a){return _0x6b9e61[_0xf54e('0x11')](_0x3ecfb3);}return _0x6b9e61[_0xf54e('0x12')](_0x3ecfb3)[_0xf54e('0x13')]();};}function respondWithResult(_0x326eef,_0x553759){_0x553759=_0x553759||0xc8;return function(_0x358c88){if(_0x358c88){return _0x326eef['status'](_0x553759)['json'](_0x358c88);}};}function respondWithFilteredResult(_0x15a9d4,_0x2033e9){return function(_0x28f776){if(_0x28f776){var _0x380f26=_0x28f776[_0xf54e('0x14')],_0x5644aa=_0x2033e9[_0xf54e('0x15')],_0x331732=_0x2033e9['offset']+_0x2033e9[_0xf54e('0x16')],_0x1bbeaa;if(_0x331732>=_0x380f26){_0x331732=_0x380f26;_0x1bbeaa=0xc8;}else{_0x1bbeaa=0xce;}_0x15a9d4[_0xf54e('0x12')](_0x1bbeaa);return _0x15a9d4[_0xf54e('0x17')]('Content-Range',_0x5644aa+'-'+_0x331732+'/'+_0x380f26)['json'](_0x28f776);}return null;};}function patchUpdates(_0xd87020){return function(_0x41fb35){try{jsonpatch[_0xf54e('0x18')](_0x41fb35,_0xd87020,!![]);}catch(_0x9647f){return BPromise[_0xf54e('0x19')](_0x9647f);}return _0x41fb35[_0xf54e('0x1a')]();};}function saveUpdates(_0x2e27b6,_0x1ef06e){return function(_0x1dcc04){if(_0x1dcc04){return _0x1dcc04[_0xf54e('0x1b')](_0x2e27b6)[_0xf54e('0x1c')](function(_0x50fc66){return _0x50fc66;});}return null;};}function removeEntity(_0x48a7e1,_0x23e14){return function(_0x59f338){if(_0x59f338){return _0x59f338[_0xf54e('0x1d')]()[_0xf54e('0x1c')](function(){_0x48a7e1[_0xf54e('0x12')](0xcc)[_0xf54e('0x13')]();});}};}function handleEntityNotFound(_0xf64f12,_0x3887b0){return function(_0x388aa0){if(!_0x388aa0){_0xf64f12[_0xf54e('0x11')](0x194);}return _0x388aa0;};}function handleError(_0x3c0169,_0x5f9eea){_0x5f9eea=_0x5f9eea||0x1f4;return function(_0x1c58bd){logger['error'](_0x1c58bd[_0xf54e('0x1e')]);if(_0x1c58bd['name']){delete _0x1c58bd[_0xf54e('0x1f')];}_0x3c0169[_0xf54e('0x12')](_0x5f9eea)[_0xf54e('0x20')](_0x1c58bd);};}exports[_0xf54e('0x21')]=function(_0x3805a7,_0x160160){var _0x1e08d1={},_0x43488d={},_0x2342a9={'count':0x0,'rows':[]};var _0x33457f=db[_0xf54e('0x22')][_0xf54e('0x23')];_0x43488d[_0xf54e('0x24')]=_['keys'](_0x33457f);var _0xb3706e={'dateStart':_0x3805a7['query'][_0xf54e('0x25')],'dateEnd':_0x3805a7['query'][_0xf54e('0x26')]};delete _0x3805a7[_0xf54e('0x27')][_0xf54e('0x25')];delete _0x3805a7[_0xf54e('0x27')][_0xf54e('0x26')];_0x43488d[_0xf54e('0x27')]=_[_0xf54e('0x28')](_0x3805a7['query']);_0x43488d['filters']=_[_0xf54e('0x29')](_0x43488d[_0xf54e('0x24')],_0x43488d[_0xf54e('0x27')]);_0x1e08d1[_0xf54e('0x2a')]=_[_0xf54e('0x29')](_0x43488d[_0xf54e('0x24')],qs[_0xf54e('0x2b')](_0x3805a7[_0xf54e('0x27')][_0xf54e('0x2b')]));_0x1e08d1[_0xf54e('0x2a')]=_0x1e08d1['attributes']['length']?_0x1e08d1[_0xf54e('0x2a')]:_0x43488d[_0xf54e('0x24')];if(!_0x3805a7['query'][_0xf54e('0x2c')](_0xf54e('0x2d'))){_0x1e08d1[_0xf54e('0x16')]=qs[_0xf54e('0x16')](_0x3805a7['query']['limit']);_0x1e08d1['offset']=qs[_0xf54e('0x15')](_0x3805a7[_0xf54e('0x27')][_0xf54e('0x15')]);}_0x1e08d1[_0xf54e('0x2e')]=qs[_0xf54e('0x2f')](_0x3805a7[_0xf54e('0x27')]['sort']);_0x1e08d1['where']=qs['filters'](_[_0xf54e('0x30')](_0x3805a7[_0xf54e('0x27')],_0x43488d['filters']));if(_0xb3706e['dateStart']){if(_0xb3706e[_0xf54e('0x26')]){_0xb3706e[_0xf54e('0x26')]=moment(_0xb3706e[_0xf54e('0x26')])['add'](0x1,_0xf54e('0x31'));}else{_0xb3706e[_0xf54e('0x26')]=moment(_0xb3706e['dateStart'])[_0xf54e('0x32')](0x1,_0xf54e('0x31'));}_[_0xf54e('0x33')](_0x1e08d1[_0xf54e('0x34')],{'createdAt':{'$gte':_0xb3706e[_0xf54e('0x25')],'$lte':_0xb3706e[_0xf54e('0x26')]}});}if(_0x3805a7['query']['filter']){_0x1e08d1[_0xf54e('0x34')]=_[_0xf54e('0x33')](_0x1e08d1[_0xf54e('0x34')],{'$or':_['map'](_0x1e08d1[_0xf54e('0x2a')],function(_0x22fa6f){var _0x448054={};_0x448054[_0x22fa6f]={'$like':'%'+_0x3805a7[_0xf54e('0x27')][_0xf54e('0x35')]+'%'};return _0x448054;})});}_0x1e08d1=_[_0xf54e('0x33')]({},_0x1e08d1,_0x3805a7[_0xf54e('0x36')]);var _0x1345b0={'where':_0x1e08d1[_0xf54e('0x34')]};return db[_0xf54e('0x22')][_0xf54e('0x14')](_0x1345b0)[_0xf54e('0x1c')](function(_0x3dfd4e){_0x2342a9[_0xf54e('0x14')]=_0x3dfd4e;if(_0x3805a7[_0xf54e('0x27')]['includeAll']){_0x1e08d1['include']=[{'all':!![]}];}return db['SquareRecording'][_0xf54e('0x37')](_0x1e08d1);})[_0xf54e('0x1c')](function(_0x5398b2){_0x2342a9[_0xf54e('0x38')]=_0x5398b2;return _0x2342a9;})[_0xf54e('0x1c')](respondWithFilteredResult(_0x160160,_0x1e08d1))[_0xf54e('0x39')](handleError(_0x160160,null));};exports['show']=function(_0x40675f,_0x13d145){var _0x1e016e={'raw':!![],'where':{'id':_0x40675f[_0xf54e('0x3a')]['id']}},_0x794be7={};_0x794be7[_0xf54e('0x24')]=_[_0xf54e('0x28')](db[_0xf54e('0x22')][_0xf54e('0x23')]);_0x794be7['query']=_[_0xf54e('0x28')](_0x40675f[_0xf54e('0x27')]);_0x794be7[_0xf54e('0x3b')]=_[_0xf54e('0x29')](_0x794be7[_0xf54e('0x24')],_0x794be7[_0xf54e('0x27')]);_0x1e016e['attributes']=_[_0xf54e('0x29')](_0x794be7['model'],qs[_0xf54e('0x2b')](_0x40675f['query'][_0xf54e('0x2b')]));_0x1e016e[_0xf54e('0x2a')]=_0x1e016e[_0xf54e('0x2a')]['length']?_0x1e016e[_0xf54e('0x2a')]:_0x794be7[_0xf54e('0x24')];if(_0x40675f[_0xf54e('0x27')][_0xf54e('0x3c')]){_0x1e016e[_0xf54e('0x3d')]=[{'all':!![]}];}_0x1e016e=_['merge']({},_0x1e016e,_0x40675f[_0xf54e('0x36')]);return db[_0xf54e('0x22')][_0xf54e('0x3e')](_0x1e016e)[_0xf54e('0x1c')](handleEntityNotFound(_0x13d145,null))['then'](respondWithResult(_0x13d145,null))[_0xf54e('0x39')](handleError(_0x13d145,null));};exports[_0xf54e('0x3f')]=function(_0x554c1f,_0x22c842){return db[_0xf54e('0x22')][_0xf54e('0x3f')](_0x554c1f[_0xf54e('0x40')],{})['then'](respondWithResult(_0x22c842,0xc9))[_0xf54e('0x39')](handleError(_0x22c842,null));};exports[_0xf54e('0x1b')]=function(_0x2527f6,_0xb4654f){if(_0x2527f6[_0xf54e('0x40')]['id']){delete _0x2527f6[_0xf54e('0x40')]['id'];}return db[_0xf54e('0x22')][_0xf54e('0x3e')]({'where':{'id':_0x2527f6[_0xf54e('0x3a')]['id']}})[_0xf54e('0x1c')](handleEntityNotFound(_0xb4654f,null))[_0xf54e('0x1c')](saveUpdates(_0x2527f6[_0xf54e('0x40')],null))[_0xf54e('0x1c')](respondWithResult(_0xb4654f,null))[_0xf54e('0x39')](handleError(_0xb4654f,null));};exports[_0xf54e('0x1d')]=function(_0xa6c305,_0x40d8ab){return db[_0xf54e('0x22')][_0xf54e('0x3e')]({'where':{'id':_0xa6c305[_0xf54e('0x3a')]['id']}})['then'](handleEntityNotFound(_0x40d8ab,null))['then'](removeEntity(_0x40d8ab,null))[_0xf54e('0x39')](handleError(_0x40d8ab,null));};exports[_0xf54e('0x41')]=function(_0x45861b,_0x40557d,_0xba297c){var _0x3b7f40=require(_0xf54e('0x42'));var _0x149d0b=![];var _0x89b811={};if(_0x45861b[_0xf54e('0x27')][_0xf54e('0x43')]&&_0x45861b['query'][_0xf54e('0x43')]===_0xf54e('0x44')){_0x89b811[_0xf54e('0x44')]=_0x45861b[_0xf54e('0x3a')]['id'];}else{_0x89b811['id']=_0x45861b[_0xf54e('0x3a')]['id'];}return db[_0xf54e('0x22')][_0xf54e('0x3e')]({'where':_0x89b811,'attributes':['id','savePath',_0xf54e('0x45')],'raw':!![]})[_0xf54e('0x1c')](handleEntityNotFound(_0x40557d,null))[_0xf54e('0x1c')](function(_0x48a5c8){if(_0x48a5c8){var _0x3ce832=util['format'](_0xf54e('0x46'),_0x48a5c8[_0xf54e('0x47')]);if(fs[_0xf54e('0x48')](_0x3ce832)){_0x149d0b=!![];return _0x3b7f40['decryptFile'](_0x3ce832,_0x48a5c8[_0xf54e('0x49')],config[_0xf54e('0x4a')][_0xf54e('0x4b')])[_0xf54e('0x1c')](function(){return _0x48a5c8;});}return _0x48a5c8;}})[_0xf54e('0x1c')](function(_0x2ec72a){if(_0x2ec72a){if(!fs[_0xf54e('0x48')](_0x2ec72a['savePath'])){throw new db['Sequelize'][(_0xf54e('0x4c'))](_0xf54e('0x4d'));}if(_0x2ec72a['filename']){return _0x40557d[_0xf54e('0x41')](_0x2ec72a['savePath'],_0x2ec72a[_0xf54e('0x45')]+path['extname'](_0x2ec72a[_0xf54e('0x49')]),function(){if(_0x149d0b){fs[_0xf54e('0x4e')](_0x2ec72a[_0xf54e('0x49')]);}});}else{return _0x40557d[_0xf54e('0x41')](_0x2ec72a[_0xf54e('0x49')],function(_0x1530c9){if(_0x149d0b){fs['unlink'](_0x2ec72a['savePath']);}});}}})[_0xf54e('0x39')](handleError(_0x40557d,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 98f4f14..fa3377c 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 _0x20d7=['square_recordings','../../config/logger','api','moment','exports'];(function(_0x278480,_0x2632dd){var _0x1cfb03=function(_0x359f80){while(--_0x359f80){_0x278480['push'](_0x278480['shift']());}};_0x1cfb03(++_0x2632dd);}(_0x20d7,0x146));var _0x720d=function(_0x43f60d,_0x56ae9e){_0x43f60d=_0x43f60d-0x0;var _0x202121=_0x20d7[_0x43f60d];return _0x202121;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x720d('0x0'))(_0x720d('0x1'));var moment=require(_0x720d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./squareRecording.attributes');module[_0x720d('0x3')]=function(_0x241e8d,_0x4cb8df){return _0x241e8d['define']('SquareRecording',attributes,{'tableName':_0x720d('0x4'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadf0=['util','../../config/logger','api','moment','bluebird','request-promise','./squareRecording.attributes'];(function(_0xd49336,_0x22d48b){var _0x23a647=function(_0x1ab4b5){while(--_0x1ab4b5){_0xd49336['push'](_0xd49336['shift']());}};_0x23a647(++_0x22d48b);}(_0xadf0,0x12d));var _0x0adf=function(_0x33e19a,_0x1e791e){_0x33e19a=_0x33e19a-0x0;var _0x571132=_0xadf0[_0x33e19a];return _0x571132;};'use strict';var _=require('lodash');var util=require(_0x0adf('0x0'));var logger=require(_0x0adf('0x1'))(_0x0adf('0x2'));var moment=require(_0x0adf('0x3'));var BPromise=require(_0x0adf('0x4'));var rp=require(_0x0adf('0x5'));var attributes=require(_0x0adf('0x6'));module['exports']=function(_0xb48987,_0x567ca2){return _0xb48987['define']('SquareRecording',attributes,{'tableName':'square_recordings','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 c885e5f..f34a8d8 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 _0xfe85=['catch','CreateSquareRecording','body','options','raw','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','client','request','then','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareRecording,\x20%s,\x20%s','result'];(function(_0x5b1509,_0x16b638){var _0x3fa970=function(_0x3bbfe8){while(--_0x3bbfe8){_0x5b1509['push'](_0x5b1509['shift']());}};_0x3fa970(++_0x16b638);}(_0xfe85,0x13d));var _0x5fe8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfe85[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x5fe8('0x0'));var moment=require(_0x5fe8('0x1'));var BPromise=require(_0x5fe8('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x5fe8('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5fe8('0x4'))(_0x5fe8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5fe8('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x321eb0,_0x33206f,_0x270ea4){return new BPromise(function(_0x3f7355,_0x1dd0e8){return client[_0x5fe8('0x7')](_0x321eb0,_0x270ea4)[_0x5fe8('0x8')](function(_0x4d3725){logger[_0x5fe8('0x9')]('SquareRecording,\x20%s,\x20%s',_0x33206f,_0x5fe8('0xa'));logger[_0x5fe8('0xb')](_0x5fe8('0xc'),_0x33206f,'request\x20sent',JSON[_0x5fe8('0xd')](_0x4d3725));if(_0x4d3725[_0x5fe8('0xe')]){if(_0x4d3725[_0x5fe8('0xe')][_0x5fe8('0xf')]===0x1f4){logger[_0x5fe8('0xe')]('SquareRecording,\x20%s,\x20%s',_0x33206f,_0x4d3725[_0x5fe8('0xe')]['message']);return _0x1dd0e8(_0x4d3725[_0x5fe8('0xe')][_0x5fe8('0x10')]);}logger[_0x5fe8('0xe')](_0x5fe8('0x11'),_0x33206f,_0x4d3725[_0x5fe8('0xe')]['message']);return _0x3f7355(_0x4d3725[_0x5fe8('0xe')]['message']);}else{logger[_0x5fe8('0x9')](_0x5fe8('0x11'),_0x33206f,_0x5fe8('0xa'));_0x3f7355(_0x4d3725[_0x5fe8('0x12')][_0x5fe8('0x10')]);}})[_0x5fe8('0x13')](function(_0x483c5f){logger[_0x5fe8('0xe')]('SquareRecording,\x20%s,\x20%s',_0x33206f,_0x483c5f);_0x1dd0e8(_0x483c5f);});});}exports[_0x5fe8('0x14')]=function(_0x1ce170){var _0x21ec40=this;return new Promise(function(_0x2d64cd,_0x38dfeb){return db['SquareRecording']['create'](_0x1ce170[_0x5fe8('0x15')],{'raw':_0x1ce170[_0x5fe8('0x16')]?_0x1ce170['options'][_0x5fe8('0x17')]===undefined?!![]:![]:!![]})[_0x5fe8('0x8')](function(_0x380e23){logger[_0x5fe8('0x9')](_0x5fe8('0x14'),_0x1ce170);logger['debug'](_0x5fe8('0x14'),_0x1ce170,JSON['stringify'](_0x380e23));_0x2d64cd(_0x380e23);})[_0x5fe8('0x13')](function(_0xc5f5fb){logger[_0x5fe8('0xe')]('CreateSquareRecording',_0xc5f5fb[_0x5fe8('0x10')],_0x1ce170);_0x38dfeb(_0x21ec40[_0x5fe8('0xe')](0x1f4,_0xc5f5fb[_0x5fe8('0x10')]));});});}; \ No newline at end of file +var _0x2dd8=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','SquareRecording','create','body','options','raw','info','debug','CreateSquareRecording','lodash','util','moment','bluebird','randomstring'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x2dd8,0xd3));var _0x82dd=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2dd8[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x82dd('0x0'));var util=require(_0x82dd('0x1'));var moment=require(_0x82dd('0x2'));var BPromise=require(_0x82dd('0x3'));var rs=require(_0x82dd('0x4'));var fs=require('fs');var db=require(_0x82dd('0x5'))['db'];var utils=require(_0x82dd('0x6'));var logger=require(_0x82dd('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x82dd('0x8'));var client=jayson['client'][_0x82dd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x368479,_0x33e7e9,_0x1cebe2){return new BPromise(function(_0x5f33f9,_0x1ca11c){return client[_0x82dd('0xa')](_0x368479,_0x1cebe2)[_0x82dd('0xb')](function(_0x5f38de){logger['info'](_0x82dd('0xc'),_0x33e7e9,'request\x20sent');logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x33e7e9,_0x82dd('0xd'),JSON[_0x82dd('0xe')](_0x5f38de));if(_0x5f38de[_0x82dd('0xf')]){if(_0x5f38de[_0x82dd('0xf')]['code']===0x1f4){logger[_0x82dd('0xf')](_0x82dd('0xc'),_0x33e7e9,_0x5f38de[_0x82dd('0xf')][_0x82dd('0x10')]);return _0x1ca11c(_0x5f38de[_0x82dd('0xf')]['message']);}logger[_0x82dd('0xf')](_0x82dd('0xc'),_0x33e7e9,_0x5f38de[_0x82dd('0xf')][_0x82dd('0x10')]);return _0x5f33f9(_0x5f38de[_0x82dd('0xf')][_0x82dd('0x10')]);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x33e7e9,_0x82dd('0xd'));_0x5f33f9(_0x5f38de[_0x82dd('0x11')]['message']);}})[_0x82dd('0x12')](function(_0x459162){logger['error'](_0x82dd('0xc'),_0x33e7e9,_0x459162);_0x1ca11c(_0x459162);});});}exports['CreateSquareRecording']=function(_0x4768b0){var _0x40e160=this;return new Promise(function(_0x3aa9f9,_0x3fcfff){return db[_0x82dd('0x13')][_0x82dd('0x14')](_0x4768b0[_0x82dd('0x15')],{'raw':_0x4768b0[_0x82dd('0x16')]?_0x4768b0[_0x82dd('0x16')][_0x82dd('0x17')]===undefined?!![]:![]:!![]})[_0x82dd('0xb')](function(_0x5f2478){logger[_0x82dd('0x18')]('CreateSquareRecording',_0x4768b0);logger[_0x82dd('0x19')](_0x82dd('0x1a'),_0x4768b0,JSON[_0x82dd('0xe')](_0x5f2478));_0x3aa9f9(_0x5f2478);})[_0x82dd('0x12')](function(_0x51d5d8){logger[_0x82dd('0xf')](_0x82dd('0x1a'),_0x51d5d8[_0x82dd('0x10')],_0x4768b0);_0x3fcfff(_0x40e160[_0x82dd('0xf')](0x1f4,_0x51d5d8[_0x82dd('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 4d4ae94..7f4c061 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 _0x14c3=['exports','util','path','express','Router','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','/:id','show','post','put','update','delete','destroy'];(function(_0x48ec91,_0x212edc){var _0x22766c=function(_0x136751){while(--_0x136751){_0x48ec91['push'](_0x48ec91['shift']());}};_0x22766c(++_0x212edc);}(_0x14c3,0xeb));var _0x314c=function(_0x57c5f8,_0x27c6ab){_0x57c5f8=_0x57c5f8-0x0;var _0x2aeca8=_0x14c3[_0x57c5f8];return _0x2aeca8;};'use strict';var multer=require('multer');var util=require(_0x314c('0x0'));var path=require(_0x314c('0x1'));var express=require(_0x314c('0x2'));var router=express[_0x314c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x314c('0x4'));var config=require(_0x314c('0x5'));var controller=require('./squareReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x314c('0x6')]);router[_0x314c('0x7')](_0x314c('0x8'),auth[_0x314c('0x9')](),controller['describe']);router[_0x314c('0x7')](_0x314c('0xa'),auth['isAuthenticated'](),controller[_0x314c('0xb')]);router[_0x314c('0xc')]('/',auth[_0x314c('0x9')](),controller['create']);router[_0x314c('0xd')](_0x314c('0xa'),auth[_0x314c('0x9')](),controller[_0x314c('0xe')]);router[_0x314c('0xf')]('/:id',auth[_0x314c('0x9')](),controller[_0x314c('0x10')]);module[_0x314c('0x11')]=router; \ No newline at end of file +var _0xf791=['get','index','describe','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xf791,0x16e));var _0x1f79=function(_0x5ad67c,_0x144860){_0x5ad67c=_0x5ad67c-0x0;var _0xccce2e=_0xf791[_0x5ad67c];return _0xccce2e;};'use strict';var multer=require(_0x1f79('0x0'));var util=require(_0x1f79('0x1'));var path=require(_0x1f79('0x2'));var express=require(_0x1f79('0x3'));var router=express['Router']();var auth=require(_0x1f79('0x4'));var interaction=require(_0x1f79('0x5'));var config=require(_0x1f79('0x6'));var controller=require(_0x1f79('0x7'));router[_0x1f79('0x8')]('/',auth['isAuthenticated'](),controller[_0x1f79('0x9')]);router[_0x1f79('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x1f79('0xa')]);router['get'](_0x1f79('0xb'),auth[_0x1f79('0xc')](),controller['show']);router['post']('/',auth[_0x1f79('0xc')](),controller['create']);router['put'](_0x1f79('0xb'),auth[_0x1f79('0xc')](),controller[_0x1f79('0xd')]);router[_0x1f79('0xe')](_0x1f79('0xb'),auth[_0x1f79('0xc')](),controller[_0x1f79('0xf')]);module[_0x1f79('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index c7e8606..466dedd 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 _0x0fc1=['sequelize','exports','STRING','DATE'];(function(_0x5ccca6,_0x4e6957){var _0x22afba=function(_0x3fc204){while(--_0x3fc204){_0x5ccca6['push'](_0x5ccca6['shift']());}};_0x22afba(++_0x4e6957);}(_0x0fc1,0x1d0));var _0x10fc=function(_0x27919b,_0x47449e){_0x27919b=_0x27919b-0x0;var _0x594fc8=_0x0fc1[_0x27919b];return _0x594fc8;};'use strict';var Sequelize=require(_0x10fc('0x0'));module[_0x10fc('0x1')]={'network':{'type':Sequelize[_0x10fc('0x2')]},'network_script':{'type':Sequelize[_0x10fc('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x10fc('0x2')]},'language':{'type':Sequelize[_0x10fc('0x2')]},'type':{'type':Sequelize[_0x10fc('0x2')]},'uniqueid':{'type':Sequelize[_0x10fc('0x2')]},'version':{'type':Sequelize[_0x10fc('0x2')]},'callerid':{'type':Sequelize[_0x10fc('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x10fc('0x2')]},'callingani2':{'type':Sequelize[_0x10fc('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x10fc('0x2')]},'dnid':{'type':Sequelize[_0x10fc('0x2')]},'rdnis':{'type':Sequelize[_0x10fc('0x2')]},'context':{'type':Sequelize[_0x10fc('0x2')]},'extension':{'type':Sequelize[_0x10fc('0x2')]},'priority':{'type':Sequelize[_0x10fc('0x2')]},'enhanced':{'type':Sequelize[_0x10fc('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x10fc('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x10fc('0x3')]}}; \ No newline at end of file +var _0xa263=['sequelize','STRING','DATE'];(function(_0x33bb07,_0x5b1849){var _0x481c81=function(_0x1709f0){while(--_0x1709f0){_0x33bb07['push'](_0x33bb07['shift']());}};_0x481c81(++_0x5b1849);}(_0xa263,0x19b));var _0x3a26=function(_0x3fa501,_0x36997b){_0x3fa501=_0x3fa501-0x0;var _0x101c73=_0xa263[_0x3fa501];return _0x101c73;};'use strict';var Sequelize=require(_0x3a26('0x0'));module['exports']={'network':{'type':Sequelize[_0x3a26('0x1')]},'network_script':{'type':Sequelize[_0x3a26('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3a26('0x1')]},'uniqueid':{'type':Sequelize[_0x3a26('0x1')]},'version':{'type':Sequelize[_0x3a26('0x1')]},'callerid':{'type':Sequelize[_0x3a26('0x1')]},'calleridname':{'type':Sequelize[_0x3a26('0x1')]},'callingpres':{'type':Sequelize[_0x3a26('0x1')]},'callingani2':{'type':Sequelize[_0x3a26('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x3a26('0x1')]},'dnid':{'type':Sequelize[_0x3a26('0x1')]},'rdnis':{'type':Sequelize[_0x3a26('0x1')]},'context':{'type':Sequelize[_0x3a26('0x1')]},'extension':{'type':Sequelize[_0x3a26('0x1')]},'priority':{'type':Sequelize[_0x3a26('0x1')]},'enhanced':{'type':Sequelize[_0x3a26('0x1')]},'accountcode':{'type':Sequelize[_0x3a26('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3a26('0x2')]},'leaveAt':{'type':Sequelize[_0x3a26('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index fa84fd5..7c6a2eb 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 _0x54ef=['rows','catch','params','filters','includeAll','include','find','create','body','describe','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','SquareReport','rawAttributes','model','dateStart','dateEnd','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','day','add','merge','where','filter','options','findAll'];(function(_0xe8129c,_0x2fb03c){var _0x709fc5=function(_0xb8e0c6){while(--_0xb8e0c6){_0xe8129c['push'](_0xe8129c['shift']());}};_0x709fc5(++_0x2fb03c);}(_0x54ef,0x112));var _0xf54e=function(_0x333d9d,_0x599648){_0x333d9d=_0x333d9d-0x0;var _0x64746a=_0x54ef[_0x333d9d];return _0x64746a;};'use strict';var jsonpatch=require(_0xf54e('0x0'));var rp=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf54e('0x3'));var util=require(_0xf54e('0x4'));var path=require(_0xf54e('0x5'));var sox=require(_0xf54e('0x6'));var csv=require(_0xf54e('0x7'));var ejs=require(_0xf54e('0x8'));var fs=require('fs');var _=require(_0xf54e('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf54e('0xa'));var deskjs=require(_0xf54e('0xb'));var toCsv=require(_0xf54e('0x7'));var querystring=require('querystring');var Papa=require(_0xf54e('0xc'));var qs=require('../../components/parsers/qs');var logger=require(_0xf54e('0xd'))(_0xf54e('0xe'));var utils=require('../../config/utils');var config=require(_0xf54e('0xf'));var db=require(_0xf54e('0x10'))['db'];function respondWithStatusCode(_0x6b9e61,_0x3ecfb3){_0x3ecfb3=_0x3ecfb3||0xcc;return function(_0x5f232a){if(_0x5f232a){return _0x6b9e61[_0xf54e('0x11')](_0x3ecfb3);}return _0x6b9e61[_0xf54e('0x12')](_0x3ecfb3)[_0xf54e('0x13')]();};}function respondWithResult(_0x326eef,_0x553759){_0x553759=_0x553759||0xc8;return function(_0x358c88){if(_0x358c88){return _0x326eef['status'](_0x553759)['json'](_0x358c88);}};}function respondWithFilteredResult(_0x15a9d4,_0x2033e9){return function(_0x28f776){if(_0x28f776){var _0x380f26=_0x28f776[_0xf54e('0x14')],_0x5644aa=_0x2033e9[_0xf54e('0x15')],_0x331732=_0x2033e9['offset']+_0x2033e9[_0xf54e('0x16')],_0x1bbeaa;if(_0x331732>=_0x380f26){_0x331732=_0x380f26;_0x1bbeaa=0xc8;}else{_0x1bbeaa=0xce;}_0x15a9d4[_0xf54e('0x12')](_0x1bbeaa);return _0x15a9d4[_0xf54e('0x17')]('Content-Range',_0x5644aa+'-'+_0x331732+'/'+_0x380f26)['json'](_0x28f776);}return null;};}function patchUpdates(_0xd87020){return function(_0x41fb35){try{jsonpatch[_0xf54e('0x18')](_0x41fb35,_0xd87020,!![]);}catch(_0x9647f){return BPromise[_0xf54e('0x19')](_0x9647f);}return _0x41fb35[_0xf54e('0x1a')]();};}function saveUpdates(_0x2e27b6,_0x1ef06e){return function(_0x1dcc04){if(_0x1dcc04){return _0x1dcc04[_0xf54e('0x1b')](_0x2e27b6)[_0xf54e('0x1c')](function(_0x50fc66){return _0x50fc66;});}return null;};}function removeEntity(_0x48a7e1,_0x23e14){return function(_0x59f338){if(_0x59f338){return _0x59f338[_0xf54e('0x1d')]()[_0xf54e('0x1c')](function(){_0x48a7e1[_0xf54e('0x12')](0xcc)[_0xf54e('0x13')]();});}};}function handleEntityNotFound(_0xf64f12,_0x3887b0){return function(_0x388aa0){if(!_0x388aa0){_0xf64f12[_0xf54e('0x11')](0x194);}return _0x388aa0;};}function handleError(_0x3c0169,_0x5f9eea){_0x5f9eea=_0x5f9eea||0x1f4;return function(_0x1c58bd){logger['error'](_0x1c58bd[_0xf54e('0x1e')]);if(_0x1c58bd['name']){delete _0x1c58bd[_0xf54e('0x1f')];}_0x3c0169[_0xf54e('0x12')](_0x5f9eea)[_0xf54e('0x20')](_0x1c58bd);};}exports[_0xf54e('0x21')]=function(_0x3805a7,_0x160160){var _0x1e08d1={},_0x43488d={},_0x2342a9={'count':0x0,'rows':[]};var _0x33457f=db[_0xf54e('0x22')][_0xf54e('0x23')];_0x43488d[_0xf54e('0x24')]=_['keys'](_0x33457f);var _0xb3706e={'dateStart':_0x3805a7['query'][_0xf54e('0x25')],'dateEnd':_0x3805a7['query'][_0xf54e('0x26')]};delete _0x3805a7[_0xf54e('0x27')][_0xf54e('0x25')];delete _0x3805a7[_0xf54e('0x27')][_0xf54e('0x26')];_0x43488d[_0xf54e('0x27')]=_[_0xf54e('0x28')](_0x3805a7['query']);_0x43488d['filters']=_[_0xf54e('0x29')](_0x43488d[_0xf54e('0x24')],_0x43488d[_0xf54e('0x27')]);_0x1e08d1[_0xf54e('0x2a')]=_[_0xf54e('0x29')](_0x43488d[_0xf54e('0x24')],qs[_0xf54e('0x2b')](_0x3805a7[_0xf54e('0x27')][_0xf54e('0x2b')]));_0x1e08d1[_0xf54e('0x2a')]=_0x1e08d1['attributes']['length']?_0x1e08d1[_0xf54e('0x2a')]:_0x43488d[_0xf54e('0x24')];if(!_0x3805a7['query'][_0xf54e('0x2c')](_0xf54e('0x2d'))){_0x1e08d1[_0xf54e('0x16')]=qs[_0xf54e('0x16')](_0x3805a7['query']['limit']);_0x1e08d1['offset']=qs[_0xf54e('0x15')](_0x3805a7[_0xf54e('0x27')][_0xf54e('0x15')]);}_0x1e08d1[_0xf54e('0x2e')]=qs[_0xf54e('0x2f')](_0x3805a7[_0xf54e('0x27')]['sort']);_0x1e08d1['where']=qs['filters'](_[_0xf54e('0x30')](_0x3805a7[_0xf54e('0x27')],_0x43488d['filters']));if(_0xb3706e['dateStart']){if(_0xb3706e[_0xf54e('0x26')]){_0xb3706e[_0xf54e('0x26')]=moment(_0xb3706e[_0xf54e('0x26')])['add'](0x1,_0xf54e('0x31'));}else{_0xb3706e[_0xf54e('0x26')]=moment(_0xb3706e['dateStart'])[_0xf54e('0x32')](0x1,_0xf54e('0x31'));}_[_0xf54e('0x33')](_0x1e08d1[_0xf54e('0x34')],{'createdAt':{'$gte':_0xb3706e[_0xf54e('0x25')],'$lte':_0xb3706e[_0xf54e('0x26')]}});}if(_0x3805a7['query']['filter']){_0x1e08d1[_0xf54e('0x34')]=_[_0xf54e('0x33')](_0x1e08d1[_0xf54e('0x34')],{'$or':_['map'](_0x1e08d1[_0xf54e('0x2a')],function(_0x22fa6f){var _0x448054={};_0x448054[_0x22fa6f]={'$like':'%'+_0x3805a7[_0xf54e('0x27')][_0xf54e('0x35')]+'%'};return _0x448054;})});}_0x1e08d1=_[_0xf54e('0x33')]({},_0x1e08d1,_0x3805a7[_0xf54e('0x36')]);var _0x1345b0={'where':_0x1e08d1[_0xf54e('0x34')]};return db[_0xf54e('0x22')][_0xf54e('0x14')](_0x1345b0)[_0xf54e('0x1c')](function(_0x3dfd4e){_0x2342a9[_0xf54e('0x14')]=_0x3dfd4e;if(_0x3805a7[_0xf54e('0x27')]['includeAll']){_0x1e08d1['include']=[{'all':!![]}];}return db['SquareReport'][_0xf54e('0x37')](_0x1e08d1);})[_0xf54e('0x1c')](function(_0x5398b2){_0x2342a9[_0xf54e('0x38')]=_0x5398b2;return _0x2342a9;})[_0xf54e('0x1c')](respondWithFilteredResult(_0x160160,_0x1e08d1))[_0xf54e('0x39')](handleError(_0x160160,null));};exports['show']=function(_0x40675f,_0x13d145){var _0x1e016e={'raw':!![],'where':{'id':_0x40675f[_0xf54e('0x3a')]['id']}},_0x794be7={};_0x794be7[_0xf54e('0x24')]=_[_0xf54e('0x28')](db[_0xf54e('0x22')][_0xf54e('0x23')]);_0x794be7['query']=_[_0xf54e('0x28')](_0x40675f[_0xf54e('0x27')]);_0x794be7[_0xf54e('0x3b')]=_[_0xf54e('0x29')](_0x794be7[_0xf54e('0x24')],_0x794be7[_0xf54e('0x27')]);_0x1e016e['attributes']=_[_0xf54e('0x29')](_0x794be7['model'],qs[_0xf54e('0x2b')](_0x40675f['query'][_0xf54e('0x2b')]));_0x1e016e[_0xf54e('0x2a')]=_0x1e016e[_0xf54e('0x2a')]['length']?_0x1e016e[_0xf54e('0x2a')]:_0x794be7[_0xf54e('0x24')];if(_0x40675f[_0xf54e('0x27')][_0xf54e('0x3c')]){_0x1e016e[_0xf54e('0x3d')]=[{'all':!![]}];}_0x1e016e=_['merge']({},_0x1e016e,_0x40675f[_0xf54e('0x36')]);return db[_0xf54e('0x22')][_0xf54e('0x3e')](_0x1e016e)[_0xf54e('0x1c')](handleEntityNotFound(_0x13d145,null))['then'](respondWithResult(_0x13d145,null))[_0xf54e('0x39')](handleError(_0x13d145,null));};exports[_0xf54e('0x3f')]=function(_0x554c1f,_0x22c842){return db[_0xf54e('0x22')][_0xf54e('0x3f')](_0x554c1f[_0xf54e('0x40')],{})['then'](respondWithResult(_0x22c842,0xc9))[_0xf54e('0x39')](handleError(_0x22c842,null));};exports[_0xf54e('0x1b')]=function(_0x2527f6,_0xb4654f){if(_0x2527f6[_0xf54e('0x40')]['id']){delete _0x2527f6[_0xf54e('0x40')]['id'];}return db[_0xf54e('0x22')][_0xf54e('0x3e')]({'where':{'id':_0x2527f6[_0xf54e('0x3a')]['id']}})[_0xf54e('0x1c')](handleEntityNotFound(_0xb4654f,null))[_0xf54e('0x1c')](saveUpdates(_0x2527f6[_0xf54e('0x40')],null))[_0xf54e('0x1c')](respondWithResult(_0xb4654f,null))[_0xf54e('0x39')](handleError(_0xb4654f,null));};exports[_0xf54e('0x1d')]=function(_0xa6c305,_0x40d8ab){return db[_0xf54e('0x22')][_0xf54e('0x3e')]({'where':{'id':_0xa6c305[_0xf54e('0x3a')]['id']}})['then'](handleEntityNotFound(_0x40d8ab,null))['then'](removeEntity(_0x40d8ab,null))[_0xf54e('0x39')](handleError(_0x40d8ab,null));};exports[_0xf54e('0x41')]=function(_0x45861b,_0x40557d){return db[_0xf54e('0x22')][_0xf54e('0x41')]()[_0xf54e('0x1c')](respondWithResult(_0x40557d,null))[_0xf54e('0x39')](handleError(_0x40557d,null));}; \ No newline at end of file +var _0xb43b=['fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','limit','json','apply','reject','update','destroy','error','name','SquareReport','rawAttributes','query','dateStart','dateEnd','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','day','add','merge','filter','map','options','count','includeAll','findAll','then','catch','params','keys','fields','find','create','body','describe'];(function(_0x4af780,_0x2ef5f9){var _0x715034=function(_0x526ac3){while(--_0x526ac3){_0x4af780['push'](_0x4af780['shift']());}};_0x715034(++_0x2ef5f9);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1af65d,_0x191155){_0x1af65d=_0x1af65d-0x0;var _0xe651c=_0xb43b[_0x1af65d];return _0xe651c;};'use strict';var jsonpatch=require(_0xbb43('0x0'));var rp=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var Mustache=require(_0xbb43('0x3'));var util=require(_0xbb43('0x4'));var path=require('path');var sox=require(_0xbb43('0x5'));var csv=require(_0xbb43('0x6'));var ejs=require(_0xbb43('0x7'));var fs=require('fs');var _=require(_0xbb43('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbb43('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xbb43('0x6'));var querystring=require(_0xbb43('0xa'));var Papa=require(_0xbb43('0xb'));var qs=require(_0xbb43('0xc'));var logger=require(_0xbb43('0xd'))('api');var utils=require(_0xbb43('0xe'));var config=require(_0xbb43('0xf'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7e0fc2,_0x41908c){_0x41908c=_0x41908c||0xcc;return function(_0xd37cdf){if(_0xd37cdf){return _0x7e0fc2[_0xbb43('0x10')](_0x41908c);}return _0x7e0fc2[_0xbb43('0x11')](_0x41908c)[_0xbb43('0x12')]();};}function respondWithResult(_0x480cc2,_0x36a473){_0x36a473=_0x36a473||0xc8;return function(_0x2a5a4d){if(_0x2a5a4d){return _0x480cc2['status'](_0x36a473)['json'](_0x2a5a4d);}};}function respondWithFilteredResult(_0x41e7e5,_0x4a3714){return function(_0x593d0b){if(_0x593d0b){var _0x438591=_0x593d0b['count'],_0x5a509f=_0x4a3714['offset'],_0x68d45d=_0x4a3714['offset']+_0x4a3714[_0xbb43('0x13')],_0x43021d;if(_0x68d45d>=_0x438591){_0x68d45d=_0x438591;_0x43021d=0xc8;}else{_0x43021d=0xce;}_0x41e7e5[_0xbb43('0x11')](_0x43021d);return _0x41e7e5['set']('Content-Range',_0x5a509f+'-'+_0x68d45d+'/'+_0x438591)[_0xbb43('0x14')](_0x593d0b);}return null;};}function patchUpdates(_0x563ce1){return function(_0x5923dc){try{jsonpatch[_0xbb43('0x15')](_0x5923dc,_0x563ce1,!![]);}catch(_0x8242ab){return BPromise[_0xbb43('0x16')](_0x8242ab);}return _0x5923dc['save']();};}function saveUpdates(_0x1c16d7,_0x4f28b8){return function(_0x3bb57d){if(_0x3bb57d){return _0x3bb57d[_0xbb43('0x17')](_0x1c16d7)['then'](function(_0x5d765b){return _0x5d765b;});}return null;};}function removeEntity(_0xf8f3ef,_0x1b6e69){return function(_0xdb7f2e){if(_0xdb7f2e){return _0xdb7f2e[_0xbb43('0x18')]()['then'](function(){_0xf8f3ef[_0xbb43('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a257d,_0x4bfaca){return function(_0x2f5e31){if(!_0x2f5e31){_0x3a257d['sendStatus'](0x194);}return _0x2f5e31;};}function handleError(_0x3f323e,_0x451cbd){_0x451cbd=_0x451cbd||0x1f4;return function(_0x577ddd){logger[_0xbb43('0x19')](_0x577ddd['stack']);if(_0x577ddd[_0xbb43('0x1a')]){delete _0x577ddd[_0xbb43('0x1a')];}_0x3f323e[_0xbb43('0x11')](_0x451cbd)['send'](_0x577ddd);};}exports['index']=function(_0x59a24d,_0x269ca5){var _0x32d7f0={},_0x5d8310={},_0x3b3083={'count':0x0,'rows':[]};var _0x2da653=db[_0xbb43('0x1b')][_0xbb43('0x1c')];_0x5d8310['model']=_['keys'](_0x2da653);var _0x27fd7a={'dateStart':_0x59a24d[_0xbb43('0x1d')][_0xbb43('0x1e')],'dateEnd':_0x59a24d[_0xbb43('0x1d')][_0xbb43('0x1f')]};delete _0x59a24d[_0xbb43('0x1d')][_0xbb43('0x1e')];delete _0x59a24d[_0xbb43('0x1d')]['dateEnd'];_0x5d8310[_0xbb43('0x1d')]=_['keys'](_0x59a24d[_0xbb43('0x1d')]);_0x5d8310[_0xbb43('0x20')]=_[_0xbb43('0x21')](_0x5d8310[_0xbb43('0x22')],_0x5d8310['query']);_0x32d7f0[_0xbb43('0x23')]=_['intersection'](_0x5d8310['model'],qs['fields'](_0x59a24d[_0xbb43('0x1d')]['fields']));_0x32d7f0[_0xbb43('0x23')]=_0x32d7f0[_0xbb43('0x23')][_0xbb43('0x24')]?_0x32d7f0['attributes']:_0x5d8310[_0xbb43('0x22')];if(!_0x59a24d[_0xbb43('0x1d')][_0xbb43('0x25')](_0xbb43('0x26'))){_0x32d7f0[_0xbb43('0x13')]=qs[_0xbb43('0x13')](_0x59a24d[_0xbb43('0x1d')][_0xbb43('0x13')]);_0x32d7f0['offset']=qs[_0xbb43('0x27')](_0x59a24d[_0xbb43('0x1d')][_0xbb43('0x27')]);}_0x32d7f0[_0xbb43('0x28')]=qs[_0xbb43('0x29')](_0x59a24d[_0xbb43('0x1d')][_0xbb43('0x29')]);_0x32d7f0[_0xbb43('0x2a')]=qs[_0xbb43('0x20')](_[_0xbb43('0x2b')](_0x59a24d[_0xbb43('0x1d')],_0x5d8310[_0xbb43('0x20')]));if(_0x27fd7a[_0xbb43('0x1e')]){if(_0x27fd7a[_0xbb43('0x1f')]){_0x27fd7a[_0xbb43('0x1f')]=moment(_0x27fd7a[_0xbb43('0x1f')])['add'](0x1,_0xbb43('0x2c'));}else{_0x27fd7a[_0xbb43('0x1f')]=moment(_0x27fd7a['dateStart'])[_0xbb43('0x2d')](0x1,_0xbb43('0x2c'));}_[_0xbb43('0x2e')](_0x32d7f0['where'],{'createdAt':{'$gte':_0x27fd7a['dateStart'],'$lte':_0x27fd7a['dateEnd']}});}if(_0x59a24d[_0xbb43('0x1d')][_0xbb43('0x2f')]){_0x32d7f0['where']=_['merge'](_0x32d7f0[_0xbb43('0x2a')],{'$or':_[_0xbb43('0x30')](_0x32d7f0[_0xbb43('0x23')],function(_0x37afbb){var _0x3f9e7f={};_0x3f9e7f[_0x37afbb]={'$like':'%'+_0x59a24d['query'][_0xbb43('0x2f')]+'%'};return _0x3f9e7f;})});}_0x32d7f0=_[_0xbb43('0x2e')]({},_0x32d7f0,_0x59a24d[_0xbb43('0x31')]);var _0x3340aa={'where':_0x32d7f0[_0xbb43('0x2a')]};return db['SquareReport'][_0xbb43('0x32')](_0x3340aa)['then'](function(_0x1c076f){_0x3b3083[_0xbb43('0x32')]=_0x1c076f;if(_0x59a24d['query'][_0xbb43('0x33')]){_0x32d7f0['include']=[{'all':!![]}];}return db[_0xbb43('0x1b')][_0xbb43('0x34')](_0x32d7f0);})[_0xbb43('0x35')](function(_0xb84ece){_0x3b3083['rows']=_0xb84ece;return _0x3b3083;})[_0xbb43('0x35')](respondWithFilteredResult(_0x269ca5,_0x32d7f0))[_0xbb43('0x36')](handleError(_0x269ca5,null));};exports['show']=function(_0x3443f8,_0x5198a2){var _0x42b965={'raw':!![],'where':{'id':_0x3443f8[_0xbb43('0x37')]['id']}},_0x14285d={};_0x14285d[_0xbb43('0x22')]=_[_0xbb43('0x38')](db[_0xbb43('0x1b')]['rawAttributes']);_0x14285d[_0xbb43('0x1d')]=_['keys'](_0x3443f8[_0xbb43('0x1d')]);_0x14285d[_0xbb43('0x20')]=_[_0xbb43('0x21')](_0x14285d[_0xbb43('0x22')],_0x14285d['query']);_0x42b965[_0xbb43('0x23')]=_[_0xbb43('0x21')](_0x14285d[_0xbb43('0x22')],qs[_0xbb43('0x39')](_0x3443f8[_0xbb43('0x1d')][_0xbb43('0x39')]));_0x42b965[_0xbb43('0x23')]=_0x42b965[_0xbb43('0x23')]['length']?_0x42b965[_0xbb43('0x23')]:_0x14285d[_0xbb43('0x22')];if(_0x3443f8['query'][_0xbb43('0x33')]){_0x42b965['include']=[{'all':!![]}];}_0x42b965=_['merge']({},_0x42b965,_0x3443f8['options']);return db['SquareReport'][_0xbb43('0x3a')](_0x42b965)['then'](handleEntityNotFound(_0x5198a2,null))[_0xbb43('0x35')](respondWithResult(_0x5198a2,null))['catch'](handleError(_0x5198a2,null));};exports[_0xbb43('0x3b')]=function(_0x39b6ae,_0x1f3fb4){return db['SquareReport'][_0xbb43('0x3b')](_0x39b6ae['body'],{})[_0xbb43('0x35')](respondWithResult(_0x1f3fb4,0xc9))[_0xbb43('0x36')](handleError(_0x1f3fb4,null));};exports[_0xbb43('0x17')]=function(_0x29840e,_0x417ad9){if(_0x29840e[_0xbb43('0x3c')]['id']){delete _0x29840e[_0xbb43('0x3c')]['id'];}return db['SquareReport'][_0xbb43('0x3a')]({'where':{'id':_0x29840e[_0xbb43('0x37')]['id']}})[_0xbb43('0x35')](handleEntityNotFound(_0x417ad9,null))[_0xbb43('0x35')](saveUpdates(_0x29840e['body'],null))[_0xbb43('0x35')](respondWithResult(_0x417ad9,null))[_0xbb43('0x36')](handleError(_0x417ad9,null));};exports[_0xbb43('0x18')]=function(_0xb1883e,_0x4b7712){return db[_0xbb43('0x1b')][_0xbb43('0x3a')]({'where':{'id':_0xb1883e[_0xbb43('0x37')]['id']}})['then'](handleEntityNotFound(_0x4b7712,null))[_0xbb43('0x35')](removeEntity(_0x4b7712,null))[_0xbb43('0x36')](handleError(_0x4b7712,null));};exports[_0xbb43('0x3d')]=function(_0x1dc40a,_0x3402f2){return db['SquareReport']['describe']()[_0xbb43('0x35')](respondWithResult(_0x3402f2,null))['catch'](handleError(_0x3402f2,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 9f23dc5..42a01c9 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 _0x9107=['api','moment','bluebird','./squareReport.attributes','exports','uniqueid','project_name','leaveAt','lodash','util','../../config/logger'];(function(_0xd520e,_0x42d39c){var _0x48973e=function(_0x533543){while(--_0x533543){_0xd520e['push'](_0xd520e['shift']());}};_0x48973e(++_0x42d39c);}(_0x9107,0xef));var _0x7910=function(_0x239340,_0x361e19){_0x239340=_0x239340-0x0;var _0x2cd5b3=_0x9107[_0x239340];return _0x2cd5b3;};'use strict';var _=require(_0x7910('0x0'));var util=require(_0x7910('0x1'));var logger=require(_0x7910('0x2'))(_0x7910('0x3'));var moment=require(_0x7910('0x4'));var BPromise=require(_0x7910('0x5'));var rp=require('request-promise');var attributes=require(_0x7910('0x6'));module[_0x7910('0x7')]=function(_0x2c3621,_0x27d1ce){return _0x2c3621['define']('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x7910('0x8'),_0x7910('0x9')]},{'name':_0x7910('0xa'),'fields':[_0x7910('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x934e=['uid_pname','uniqueid','leaveAt','../../config/logger','moment','request-promise','./squareReport.attributes','SquareReport','report_square'];(function(_0xebf34b,_0xe15e30){var _0xeec546=function(_0xf7af54){while(--_0xf7af54){_0xebf34b['push'](_0xebf34b['shift']());}};_0xeec546(++_0xe15e30);}(_0x934e,0xae));var _0xe934=function(_0x1106a4,_0x533a49){_0x1106a4=_0x1106a4-0x0;var _0x357957=_0x934e[_0x1106a4];return _0x357957;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe934('0x0'))('api');var moment=require(_0xe934('0x1'));var BPromise=require('bluebird');var rp=require(_0xe934('0x2'));var attributes=require(_0xe934('0x3'));module['exports']=function(_0x2c5a65,_0x2ba336){return _0x2c5a65['define'](_0xe934('0x4'),attributes,{'tableName':_0xe934('0x5'),'paranoid':![],'indexes':[{'name':_0xe934('0x6'),'fields':[_0xe934('0x7'),'project_name']},{'name':_0xe934('0x8'),'fields':[_0xe934('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index f6f93c5..d4d5794 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 _0xd298=['attributes','limit','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareReport','SquareReport','create','UpdateSquareReport','update','body','options','raw','where'];(function(_0x24994d,_0x5dd114){var _0x1a3545=function(_0x49c6c9){while(--_0x49c6c9){_0x24994d['push'](_0x24994d['shift']());}};_0x1a3545(++_0x5dd114);}(_0xd298,0x162));var _0x8d29=function(_0x3342e8,_0x401082){_0x3342e8=_0x3342e8-0x0;var _0x28c7b9=_0xd298[_0x3342e8];return _0x28c7b9;};'use strict';var _=require(_0x8d29('0x0'));var util=require(_0x8d29('0x1'));var moment=require(_0x8d29('0x2'));var BPromise=require(_0x8d29('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x8d29('0x4'));var logger=require(_0x8d29('0x5'))(_0x8d29('0x6'));var config=require('../../config/environment');var jayson=require(_0x8d29('0x7'));var client=jayson['client'][_0x8d29('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x218303,_0x13a8f7,_0x1294ae){return new BPromise(function(_0x34d002,_0x30a310){return client[_0x8d29('0x9')](_0x218303,_0x1294ae)[_0x8d29('0xa')](function(_0x5d6d3e){logger[_0x8d29('0xb')](_0x8d29('0xc'),_0x13a8f7,_0x8d29('0xd'));logger[_0x8d29('0xe')](_0x8d29('0xf'),_0x13a8f7,'request\x20sent',JSON['stringify'](_0x5d6d3e));if(_0x5d6d3e[_0x8d29('0x10')]){if(_0x5d6d3e[_0x8d29('0x10')][_0x8d29('0x11')]===0x1f4){logger['error'](_0x8d29('0xc'),_0x13a8f7,_0x5d6d3e[_0x8d29('0x10')]['message']);return _0x30a310(_0x5d6d3e[_0x8d29('0x10')]['message']);}logger['error']('SquareReport,\x20%s,\x20%s',_0x13a8f7,_0x5d6d3e[_0x8d29('0x10')][_0x8d29('0x12')]);return _0x34d002(_0x5d6d3e['error'][_0x8d29('0x12')]);}else{logger[_0x8d29('0xb')](_0x8d29('0xc'),_0x13a8f7,_0x8d29('0xd'));_0x34d002(_0x5d6d3e[_0x8d29('0x13')][_0x8d29('0x12')]);}})[_0x8d29('0x14')](function(_0x4c1a67){logger['error'](_0x8d29('0xc'),_0x13a8f7,_0x4c1a67);_0x30a310(_0x4c1a67);});});}exports[_0x8d29('0x15')]=function(_0x24c24e){var _0x1511a8=this;return new Promise(function(_0x3f517f,_0x4a5b49){return db[_0x8d29('0x16')][_0x8d29('0x17')](_0x24c24e['body'],{'raw':_0x24c24e['options']?_0x24c24e['options']['raw']===undefined?!![]:![]:!![]})[_0x8d29('0xa')](function(_0xebfed5){logger[_0x8d29('0xb')](_0x8d29('0x15'),_0x24c24e);logger['debug'](_0x8d29('0x15'),_0x24c24e,JSON['stringify'](_0xebfed5));_0x3f517f(_0xebfed5);})[_0x8d29('0x14')](function(_0x3f3f12){logger['error'](_0x8d29('0x15'),_0x3f3f12[_0x8d29('0x12')],_0x24c24e);_0x4a5b49(_0x1511a8[_0x8d29('0x10')](0x1f4,_0x3f3f12[_0x8d29('0x12')]));});});};exports[_0x8d29('0x18')]=function(_0x9123cf){var _0x405d5e=this;return new Promise(function(_0x5527ee,_0x1ee7dc){return db[_0x8d29('0x16')][_0x8d29('0x19')](_0x9123cf[_0x8d29('0x1a')],{'raw':_0x9123cf[_0x8d29('0x1b')]?_0x9123cf['options'][_0x8d29('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9123cf[_0x8d29('0x1b')]?_0x9123cf[_0x8d29('0x1b')][_0x8d29('0x1d')]||null:null,'attributes':_0x9123cf[_0x8d29('0x1b')]?_0x9123cf['options'][_0x8d29('0x1e')]||null:null,'limit':_0x9123cf[_0x8d29('0x1b')]?_0x9123cf[_0x8d29('0x1b')][_0x8d29('0x1f')]||null:null})[_0x8d29('0xa')](function(_0x594efa){logger[_0x8d29('0xb')](_0x8d29('0x18'),_0x9123cf);logger[_0x8d29('0xe')]('UpdateSquareReport',_0x9123cf,JSON['stringify'](_0x594efa));_0x5527ee(_0x594efa);})['catch'](function(_0x134686){logger[_0x8d29('0x10')](_0x8d29('0x18'),_0x134686[_0x8d29('0x12')],_0x9123cf);_0x1ee7dc(_0x405d5e[_0x8d29('0x10')](0x1f4,_0x134686['message']));});});}; \ No newline at end of file +var _0x1cf4=['debug','CreateSquareReport','update','where','limit','UpdateSquareReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','body','options','raw'];(function(_0x155c64,_0x26ff95){var _0x1f154a=function(_0xbc46e4){while(--_0xbc46e4){_0x155c64['push'](_0x155c64['shift']());}};_0x1f154a(++_0x26ff95);}(_0x1cf4,0xed));var _0x41cf=function(_0x347e5c,_0x38496a){_0x347e5c=_0x347e5c-0x0;var _0x234da5=_0x1cf4[_0x347e5c];return _0x234da5;};'use strict';var _=require(_0x41cf('0x0'));var util=require(_0x41cf('0x1'));var moment=require(_0x41cf('0x2'));var BPromise=require(_0x41cf('0x3'));var rs=require(_0x41cf('0x4'));var fs=require('fs');var db=require(_0x41cf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x41cf('0x6'))(_0x41cf('0x7'));var config=require(_0x41cf('0x8'));var jayson=require(_0x41cf('0x9'));var client=jayson[_0x41cf('0xa')][_0x41cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5504d4,_0x260a69,_0x152584){return new BPromise(function(_0x3943f6,_0x4154e4){return client[_0x41cf('0xc')](_0x5504d4,_0x152584)[_0x41cf('0xd')](function(_0x5bc6cf){logger[_0x41cf('0xe')]('SquareReport,\x20%s,\x20%s',_0x260a69,_0x41cf('0xf'));logger['debug'](_0x41cf('0x10'),_0x260a69,_0x41cf('0xf'),JSON[_0x41cf('0x11')](_0x5bc6cf));if(_0x5bc6cf[_0x41cf('0x12')]){if(_0x5bc6cf[_0x41cf('0x12')][_0x41cf('0x13')]===0x1f4){logger['error'](_0x41cf('0x14'),_0x260a69,_0x5bc6cf[_0x41cf('0x12')][_0x41cf('0x15')]);return _0x4154e4(_0x5bc6cf[_0x41cf('0x12')][_0x41cf('0x15')]);}logger[_0x41cf('0x12')](_0x41cf('0x14'),_0x260a69,_0x5bc6cf[_0x41cf('0x12')][_0x41cf('0x15')]);return _0x3943f6(_0x5bc6cf[_0x41cf('0x12')]['message']);}else{logger[_0x41cf('0xe')](_0x41cf('0x14'),_0x260a69,_0x41cf('0xf'));_0x3943f6(_0x5bc6cf[_0x41cf('0x16')][_0x41cf('0x15')]);}})[_0x41cf('0x17')](function(_0x17de84){logger[_0x41cf('0x12')](_0x41cf('0x14'),_0x260a69,_0x17de84);_0x4154e4(_0x17de84);});});}exports['CreateSquareReport']=function(_0x558262){var _0x2e2dc0=this;return new Promise(function(_0xca3b64,_0x5f38dd){return db['SquareReport']['create'](_0x558262[_0x41cf('0x18')],{'raw':_0x558262[_0x41cf('0x19')]?_0x558262[_0x41cf('0x19')][_0x41cf('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3b9f4c){logger[_0x41cf('0xe')]('CreateSquareReport',_0x558262);logger[_0x41cf('0x1b')](_0x41cf('0x1c'),_0x558262,JSON[_0x41cf('0x11')](_0x3b9f4c));_0xca3b64(_0x3b9f4c);})[_0x41cf('0x17')](function(_0x3ed8af){logger['error']('CreateSquareReport',_0x3ed8af[_0x41cf('0x15')],_0x558262);_0x5f38dd(_0x2e2dc0[_0x41cf('0x12')](0x1f4,_0x3ed8af[_0x41cf('0x15')]));});});};exports['UpdateSquareReport']=function(_0x46d54d){var _0x912648=this;return new Promise(function(_0x52364b,_0x1e84c5){return db['SquareReport'][_0x41cf('0x1d')](_0x46d54d[_0x41cf('0x18')],{'raw':_0x46d54d['options']?_0x46d54d[_0x41cf('0x19')][_0x41cf('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46d54d[_0x41cf('0x19')]?_0x46d54d['options'][_0x41cf('0x1e')]||null:null,'attributes':_0x46d54d[_0x41cf('0x19')]?_0x46d54d['options']['attributes']||null:null,'limit':_0x46d54d[_0x41cf('0x19')]?_0x46d54d[_0x41cf('0x19')][_0x41cf('0x1f')]||null:null})[_0x41cf('0xd')](function(_0x42af94){logger[_0x41cf('0xe')](_0x41cf('0x20'),_0x46d54d);logger[_0x41cf('0x1b')]('UpdateSquareReport',_0x46d54d,JSON[_0x41cf('0x11')](_0x42af94));_0x52364b(_0x42af94);})[_0x41cf('0x17')](function(_0x5a35cd){logger[_0x41cf('0x12')](_0x41cf('0x20'),_0x5a35cd[_0x41cf('0x15')],_0x46d54d);_0x1e84c5(_0x912648[_0x41cf('0x12')](0x1f4,_0x5a35cd['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 74b2509..96f6681 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 _0x6658=['describe','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe'];(function(_0x3e7332,_0x47f81d){var _0x2977d6=function(_0x28c7f2){while(--_0x28c7f2){_0x3e7332['push'](_0x3e7332['shift']());}};_0x2977d6(++_0x47f81d);}(_0x6658,0x1ec));var _0x8665=function(_0x3766f4,_0x5880a9){_0x3766f4=_0x3766f4-0x0;var _0x5179a4=_0x6658[_0x3766f4];return _0x5179a4;};'use strict';var multer=require(_0x8665('0x0'));var util=require(_0x8665('0x1'));var path=require(_0x8665('0x2'));var express=require(_0x8665('0x3'));var router=express[_0x8665('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8665('0x5'));var config=require(_0x8665('0x6'));var controller=require(_0x8665('0x7'));router[_0x8665('0x8')]('/',auth[_0x8665('0x9')](),controller[_0x8665('0xa')]);router['get'](_0x8665('0xb'),auth[_0x8665('0x9')](),controller[_0x8665('0xc')]);router['get']('/:id',auth[_0x8665('0x9')](),controller[_0x8665('0xd')]);router[_0x8665('0xe')]('/',auth[_0x8665('0x9')](),controller['create']);router[_0x8665('0xf')](_0x8665('0x10'),auth[_0x8665('0x9')](),controller[_0x8665('0x11')]);router[_0x8665('0x12')]('/:id',auth[_0x8665('0x9')](),controller[_0x8665('0x13')]);module[_0x8665('0x14')]=router; \ No newline at end of file +var _0x36f7=['./squareReportDetail.controller','get','isAuthenticated','describe','/:id','show','create','put','update','delete','exports','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x5584e0,_0x561225){var _0x3bec24=function(_0x5ded8a){while(--_0x5ded8a){_0x5584e0['push'](_0x5584e0['shift']());}};_0x3bec24(++_0x561225);}(_0x36f7,0xdb));var _0x736f=function(_0x5df32a,_0x48e4a5){_0x5df32a=_0x5df32a-0x0;var _0x321a27=_0x36f7[_0x5df32a];return _0x321a27;};'use strict';var multer=require('multer');var util=require(_0x736f('0x0'));var path=require(_0x736f('0x1'));var express=require(_0x736f('0x2'));var router=express['Router']();var auth=require(_0x736f('0x3'));var interaction=require(_0x736f('0x4'));var config=require('../../config/environment');var controller=require(_0x736f('0x5'));router[_0x736f('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x736f('0x7')](),controller[_0x736f('0x8')]);router['get'](_0x736f('0x9'),auth[_0x736f('0x7')](),controller[_0x736f('0xa')]);router['post']('/',auth[_0x736f('0x7')](),controller[_0x736f('0xb')]);router[_0x736f('0xc')](_0x736f('0x9'),auth[_0x736f('0x7')](),controller[_0x736f('0xd')]);router[_0x736f('0xe')](_0x736f('0x9'),auth[_0x736f('0x7')](),controller['destroy']);module[_0x736f('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 5587d6e..af6f778 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 _0xdc49=['exports','STRING','TEXT','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc49,0x1db));var _0x9dc4=function(_0x2acf77,_0x47c010){_0x2acf77=_0x2acf77-0x0;var _0x56bd7a=_0xdc49[_0x2acf77];return _0x56bd7a;};'use strict';var Sequelize=require(_0x9dc4('0x0'));module[_0x9dc4('0x1')]={'uniqueid':{'type':Sequelize[_0x9dc4('0x2')]},'node':{'type':Sequelize[_0x9dc4('0x2')]},'application':{'type':Sequelize[_0x9dc4('0x2')]},'data':{'type':Sequelize[_0x9dc4('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xef25=['sequelize','exports','STRING','TEXT'];(function(_0x2ffae6,_0x1c7453){var _0x2ce28c=function(_0x8ea0d4){while(--_0x8ea0d4){_0x2ffae6['push'](_0x2ffae6['shift']());}};_0x2ce28c(++_0x1c7453);}(_0xef25,0x1d4));var _0x5ef2=function(_0x555b2f,_0x43b622){_0x555b2f=_0x555b2f-0x0;var _0x81c0a6=_0xef25[_0x555b2f];return _0x81c0a6;};'use strict';var Sequelize=require(_0x5ef2('0x0'));module[_0x5ef2('0x1')]={'uniqueid':{'type':Sequelize[_0x5ef2('0x2')]},'node':{'type':Sequelize[_0x5ef2('0x2')]},'application':{'type':Sequelize[_0x5ef2('0x2')]},'data':{'type':Sequelize[_0x5ef2('0x3')]},'project_name':{'type':Sequelize[_0x5ef2('0x2')]},'callerid':{'type':Sequelize[_0x5ef2('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index a01a193..822ee05 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 _0x046d=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','reject','save','update','then','destroy','end','error','name','SquareDetailsReport','rawAttributes','model','keys','dateStart','query','dateEnd','attributes','intersection','fields','length','nolimit','offset','order','sort','where','filters','add','day','merge','map','filter','options','includeAll','include','findAll','show','params','find','catch','create','body','describe','fast-json-patch','moment','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api'];(function(_0x3cc006,_0x4dca9a){var _0x9c02b6=function(_0x5920cd){while(--_0x5920cd){_0x3cc006['push'](_0x3cc006['shift']());}};_0x9c02b6(++_0x4dca9a);}(_0x046d,0x13b));var _0xd046=function(_0x337d3a,_0x297363){_0x337d3a=_0x337d3a-0x0;var _0x3bc3be=_0x046d[_0x337d3a];return _0x3bc3be;};'use strict';var jsonpatch=require(_0xd046('0x0'));var rp=require('request-promise');var moment=require(_0xd046('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xd046('0x2'));var util=require(_0xd046('0x3'));var path=require(_0xd046('0x4'));var sox=require('sox');var csv=require(_0xd046('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd046('0x6'));var squel=require('squel');var crypto=require(_0xd046('0x7'));var jsforce=require(_0xd046('0x8'));var deskjs=require(_0xd046('0x9'));var toCsv=require(_0xd046('0x5'));var querystring=require(_0xd046('0xa'));var Papa=require(_0xd046('0xb'));var qs=require(_0xd046('0xc'));var logger=require(_0xd046('0xd'))(_0xd046('0xe'));var utils=require(_0xd046('0xf'));var config=require(_0xd046('0x10'));var db=require(_0xd046('0x11'))['db'];function respondWithStatusCode(_0x5252fe,_0x35e22e){_0x35e22e=_0x35e22e||0xcc;return function(_0x441133){if(_0x441133){return _0x5252fe[_0xd046('0x12')](_0x35e22e);}return _0x5252fe['status'](_0x35e22e)['end']();};}function respondWithResult(_0x3e03e3,_0x3b8ed4){_0x3b8ed4=_0x3b8ed4||0xc8;return function(_0x470975){if(_0x470975){return _0x3e03e3[_0xd046('0x13')](_0x3b8ed4)[_0xd046('0x14')](_0x470975);}};}function respondWithFilteredResult(_0x573f71,_0x549efd){return function(_0x318637){if(_0x318637){var _0xff641e=_0x318637[_0xd046('0x15')],_0x5b1f17=_0x549efd['offset'],_0xd8aae3=_0x549efd['offset']+_0x549efd[_0xd046('0x16')],_0x13000a;if(_0xd8aae3>=_0xff641e){_0xd8aae3=_0xff641e;_0x13000a=0xc8;}else{_0x13000a=0xce;}_0x573f71['status'](_0x13000a);return _0x573f71[_0xd046('0x17')](_0xd046('0x18'),_0x5b1f17+'-'+_0xd8aae3+'/'+_0xff641e)[_0xd046('0x14')](_0x318637);}return null;};}function patchUpdates(_0x2986e5){return function(_0x11e265){try{jsonpatch['apply'](_0x11e265,_0x2986e5,!![]);}catch(_0x3c0ceb){return BPromise[_0xd046('0x19')](_0x3c0ceb);}return _0x11e265[_0xd046('0x1a')]();};}function saveUpdates(_0x555cc7,_0x345d72){return function(_0x9beed8){if(_0x9beed8){return _0x9beed8[_0xd046('0x1b')](_0x555cc7)[_0xd046('0x1c')](function(_0x295cd6){return _0x295cd6;});}return null;};}function removeEntity(_0x359e45,_0x5b7e05){return function(_0x46ffef){if(_0x46ffef){return _0x46ffef[_0xd046('0x1d')]()[_0xd046('0x1c')](function(){_0x359e45[_0xd046('0x13')](0xcc)[_0xd046('0x1e')]();});}};}function handleEntityNotFound(_0x356bda,_0x5f2621){return function(_0x4cd019){if(!_0x4cd019){_0x356bda[_0xd046('0x12')](0x194);}return _0x4cd019;};}function handleError(_0x1a3284,_0x12d7c0){_0x12d7c0=_0x12d7c0||0x1f4;return function(_0x3343cb){logger[_0xd046('0x1f')](_0x3343cb['stack']);if(_0x3343cb['name']){delete _0x3343cb[_0xd046('0x20')];}_0x1a3284[_0xd046('0x13')](_0x12d7c0)['send'](_0x3343cb);};}exports['index']=function(_0x5a35e8,_0x41138c){var _0x340457={},_0x7523b7={},_0xbb155={'count':0x0,'rows':[]};var _0x1735fa=db[_0xd046('0x21')][_0xd046('0x22')];_0x7523b7[_0xd046('0x23')]=_[_0xd046('0x24')](_0x1735fa);var _0x4cbdf8={'dateStart':_0x5a35e8['query'][_0xd046('0x25')],'dateEnd':_0x5a35e8[_0xd046('0x26')][_0xd046('0x27')]};delete _0x5a35e8[_0xd046('0x26')][_0xd046('0x25')];delete _0x5a35e8[_0xd046('0x26')]['dateEnd'];_0x7523b7['query']=_[_0xd046('0x24')](_0x5a35e8[_0xd046('0x26')]);_0x7523b7['filters']=_['intersection'](_0x7523b7[_0xd046('0x23')],_0x7523b7[_0xd046('0x26')]);_0x340457[_0xd046('0x28')]=_[_0xd046('0x29')](_0x7523b7[_0xd046('0x23')],qs[_0xd046('0x2a')](_0x5a35e8[_0xd046('0x26')][_0xd046('0x2a')]));_0x340457['attributes']=_0x340457['attributes'][_0xd046('0x2b')]?_0x340457[_0xd046('0x28')]:_0x7523b7[_0xd046('0x23')];if(!_0x5a35e8[_0xd046('0x26')]['hasOwnProperty'](_0xd046('0x2c'))){_0x340457[_0xd046('0x16')]=qs['limit'](_0x5a35e8[_0xd046('0x26')]['limit']);_0x340457[_0xd046('0x2d')]=qs[_0xd046('0x2d')](_0x5a35e8[_0xd046('0x26')]['offset']);}_0x340457[_0xd046('0x2e')]=qs[_0xd046('0x2f')](_0x5a35e8[_0xd046('0x26')][_0xd046('0x2f')]);_0x340457[_0xd046('0x30')]=qs[_0xd046('0x31')](_['pick'](_0x5a35e8[_0xd046('0x26')],_0x7523b7[_0xd046('0x31')]));if(_0x4cbdf8[_0xd046('0x25')]){if(_0x4cbdf8[_0xd046('0x27')]){_0x4cbdf8[_0xd046('0x27')]=moment(_0x4cbdf8[_0xd046('0x27')])[_0xd046('0x32')](0x1,_0xd046('0x33'));}else{_0x4cbdf8['dateEnd']=moment(_0x4cbdf8[_0xd046('0x25')])[_0xd046('0x32')](0x1,_0xd046('0x33'));}_[_0xd046('0x34')](_0x340457[_0xd046('0x30')],{'createdAt':{'$gte':_0x4cbdf8[_0xd046('0x25')],'$lte':_0x4cbdf8['dateEnd']}});}if(_0x5a35e8[_0xd046('0x26')]['filter']){_0x340457[_0xd046('0x30')]=_[_0xd046('0x34')](_0x340457[_0xd046('0x30')],{'$or':_[_0xd046('0x35')](_0x340457['attributes'],function(_0x268c30){var _0x1d00d3={};_0x1d00d3[_0x268c30]={'$like':'%'+_0x5a35e8[_0xd046('0x26')][_0xd046('0x36')]+'%'};return _0x1d00d3;})});}_0x340457=_[_0xd046('0x34')]({},_0x340457,_0x5a35e8[_0xd046('0x37')]);var _0x538aac={'where':_0x340457[_0xd046('0x30')]};return db[_0xd046('0x21')][_0xd046('0x15')](_0x538aac)[_0xd046('0x1c')](function(_0x242b6c){_0xbb155[_0xd046('0x15')]=_0x242b6c;if(_0x5a35e8[_0xd046('0x26')][_0xd046('0x38')]){_0x340457[_0xd046('0x39')]=[{'all':!![]}];}return db[_0xd046('0x21')][_0xd046('0x3a')](_0x340457);})[_0xd046('0x1c')](function(_0x5df1d8){_0xbb155['rows']=_0x5df1d8;return _0xbb155;})[_0xd046('0x1c')](respondWithFilteredResult(_0x41138c,_0x340457))['catch'](handleError(_0x41138c,null));};exports[_0xd046('0x3b')]=function(_0x151d27,_0xbb2fcb){var _0x29180d={'raw':!![],'where':{'id':_0x151d27[_0xd046('0x3c')]['id']}},_0x5500fd={};_0x5500fd['model']=_[_0xd046('0x24')](db[_0xd046('0x21')][_0xd046('0x22')]);_0x5500fd[_0xd046('0x26')]=_[_0xd046('0x24')](_0x151d27[_0xd046('0x26')]);_0x5500fd[_0xd046('0x31')]=_[_0xd046('0x29')](_0x5500fd[_0xd046('0x23')],_0x5500fd[_0xd046('0x26')]);_0x29180d[_0xd046('0x28')]=_[_0xd046('0x29')](_0x5500fd[_0xd046('0x23')],qs['fields'](_0x151d27[_0xd046('0x26')][_0xd046('0x2a')]));_0x29180d[_0xd046('0x28')]=_0x29180d[_0xd046('0x28')]['length']?_0x29180d['attributes']:_0x5500fd[_0xd046('0x23')];if(_0x151d27['query'][_0xd046('0x38')]){_0x29180d['include']=[{'all':!![]}];}_0x29180d=_[_0xd046('0x34')]({},_0x29180d,_0x151d27['options']);return db[_0xd046('0x21')][_0xd046('0x3d')](_0x29180d)['then'](handleEntityNotFound(_0xbb2fcb,null))['then'](respondWithResult(_0xbb2fcb,null))[_0xd046('0x3e')](handleError(_0xbb2fcb,null));};exports[_0xd046('0x3f')]=function(_0x12fd34,_0xcf96ed){return db[_0xd046('0x21')][_0xd046('0x3f')](_0x12fd34['body'],{})[_0xd046('0x1c')](respondWithResult(_0xcf96ed,0xc9))[_0xd046('0x3e')](handleError(_0xcf96ed,null));};exports['update']=function(_0x254f44,_0x156d12){if(_0x254f44[_0xd046('0x40')]['id']){delete _0x254f44[_0xd046('0x40')]['id'];}return db['SquareDetailsReport'][_0xd046('0x3d')]({'where':{'id':_0x254f44['params']['id']}})[_0xd046('0x1c')](handleEntityNotFound(_0x156d12,null))['then'](saveUpdates(_0x254f44[_0xd046('0x40')],null))[_0xd046('0x1c')](respondWithResult(_0x156d12,null))[_0xd046('0x3e')](handleError(_0x156d12,null));};exports['destroy']=function(_0x317412,_0x522595){return db[_0xd046('0x21')][_0xd046('0x3d')]({'where':{'id':_0x317412[_0xd046('0x3c')]['id']}})['then'](handleEntityNotFound(_0x522595,null))['then'](removeEntity(_0x522595,null))[_0xd046('0x3e')](handleError(_0x522595,null));};exports[_0xd046('0x41')]=function(_0x2cc7f3,_0x470948){return db[_0xd046('0x21')][_0xd046('0x41')]()[_0xd046('0x1c')](respondWithResult(_0x470948,null))[_0xd046('0x3e')](handleError(_0x470948,null));}; \ No newline at end of file +var _0x49e2=['include','options','find','create','body','describe','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','stack','send','SquareDetailsReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','add','day','merge','filter','where','map','includeAll','rows','catch','params','length'];(function(_0x33bc64,_0x4d1e92){var _0x3fdd34=function(_0x4b40a4){while(--_0x4b40a4){_0x33bc64['push'](_0x33bc64['shift']());}};_0x3fdd34(++_0x4d1e92);}(_0x49e2,0x1db));var _0x249e=function(_0x1281b0,_0x60cb3e){_0x1281b0=_0x1281b0-0x0;var _0xbfc7e1=_0x49e2[_0x1281b0];return _0xbfc7e1;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x249e('0x0'));var moment=require(_0x249e('0x1'));var BPromise=require(_0x249e('0x2'));var Mustache=require(_0x249e('0x3'));var util=require('util');var path=require(_0x249e('0x4'));var sox=require(_0x249e('0x5'));var csv=require(_0x249e('0x6'));var ejs=require(_0x249e('0x7'));var fs=require('fs');var _=require(_0x249e('0x8'));var squel=require(_0x249e('0x9'));var crypto=require(_0x249e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x249e('0xb'));var toCsv=require(_0x249e('0x6'));var querystring=require(_0x249e('0xc'));var Papa=require(_0x249e('0xd'));var qs=require(_0x249e('0xe'));var logger=require('../../config/logger')(_0x249e('0xf'));var utils=require(_0x249e('0x10'));var config=require(_0x249e('0x11'));var db=require(_0x249e('0x12'))['db'];function respondWithStatusCode(_0xcc044d,_0xb44468){_0xb44468=_0xb44468||0xcc;return function(_0xc83a57){if(_0xc83a57){return _0xcc044d[_0x249e('0x13')](_0xb44468);}return _0xcc044d[_0x249e('0x14')](_0xb44468)[_0x249e('0x15')]();};}function respondWithResult(_0x438274,_0x121b21){_0x121b21=_0x121b21||0xc8;return function(_0x4bf243){if(_0x4bf243){return _0x438274['status'](_0x121b21)[_0x249e('0x16')](_0x4bf243);}};}function respondWithFilteredResult(_0x16bfe8,_0x5cd8dc){return function(_0xc9984b){if(_0xc9984b){var _0xbbc885=_0xc9984b[_0x249e('0x17')],_0x3dbce6=_0x5cd8dc[_0x249e('0x18')],_0x537b46=_0x5cd8dc[_0x249e('0x18')]+_0x5cd8dc[_0x249e('0x19')],_0x41542;if(_0x537b46>=_0xbbc885){_0x537b46=_0xbbc885;_0x41542=0xc8;}else{_0x41542=0xce;}_0x16bfe8[_0x249e('0x14')](_0x41542);return _0x16bfe8[_0x249e('0x1a')](_0x249e('0x1b'),_0x3dbce6+'-'+_0x537b46+'/'+_0xbbc885)[_0x249e('0x16')](_0xc9984b);}return null;};}function patchUpdates(_0x41f906){return function(_0x5d7295){try{jsonpatch[_0x249e('0x1c')](_0x5d7295,_0x41f906,!![]);}catch(_0x4c9f2e){return BPromise['reject'](_0x4c9f2e);}return _0x5d7295['save']();};}function saveUpdates(_0x4099e8,_0x8153a8){return function(_0x16588c){if(_0x16588c){return _0x16588c[_0x249e('0x1d')](_0x4099e8)[_0x249e('0x1e')](function(_0x2411af){return _0x2411af;});}return null;};}function removeEntity(_0x558868,_0x201a52){return function(_0x3416d4){if(_0x3416d4){return _0x3416d4[_0x249e('0x1f')]()[_0x249e('0x1e')](function(){_0x558868[_0x249e('0x14')](0xcc)[_0x249e('0x15')]();});}};}function handleEntityNotFound(_0x6c2380,_0x4401a5){return function(_0xef60d9){if(!_0xef60d9){_0x6c2380['sendStatus'](0x194);}return _0xef60d9;};}function handleError(_0x2ab3ee,_0x29d2bd){_0x29d2bd=_0x29d2bd||0x1f4;return function(_0x17c780){logger['error'](_0x17c780[_0x249e('0x20')]);if(_0x17c780['name']){delete _0x17c780['name'];}_0x2ab3ee[_0x249e('0x14')](_0x29d2bd)[_0x249e('0x21')](_0x17c780);};}exports['index']=function(_0x2a3381,_0x460ea3){var _0x407dd1={},_0x495ad9={},_0x649a33={'count':0x0,'rows':[]};var _0x292509=db[_0x249e('0x22')][_0x249e('0x23')];_0x495ad9[_0x249e('0x24')]=_[_0x249e('0x25')](_0x292509);var _0x45cc89={'dateStart':_0x2a3381[_0x249e('0x26')][_0x249e('0x27')],'dateEnd':_0x2a3381[_0x249e('0x26')]['dateEnd']};delete _0x2a3381['query']['dateStart'];delete _0x2a3381[_0x249e('0x26')][_0x249e('0x28')];_0x495ad9[_0x249e('0x26')]=_['keys'](_0x2a3381[_0x249e('0x26')]);_0x495ad9[_0x249e('0x29')]=_[_0x249e('0x2a')](_0x495ad9['model'],_0x495ad9[_0x249e('0x26')]);_0x407dd1[_0x249e('0x2b')]=_['intersection'](_0x495ad9['model'],qs[_0x249e('0x2c')](_0x2a3381[_0x249e('0x26')][_0x249e('0x2c')]));_0x407dd1[_0x249e('0x2b')]=_0x407dd1[_0x249e('0x2b')]['length']?_0x407dd1[_0x249e('0x2b')]:_0x495ad9[_0x249e('0x24')];if(!_0x2a3381[_0x249e('0x26')][_0x249e('0x2d')](_0x249e('0x2e'))){_0x407dd1[_0x249e('0x19')]=qs[_0x249e('0x19')](_0x2a3381['query'][_0x249e('0x19')]);_0x407dd1['offset']=qs['offset'](_0x2a3381['query'][_0x249e('0x18')]);}_0x407dd1[_0x249e('0x2f')]=qs[_0x249e('0x30')](_0x2a3381[_0x249e('0x26')][_0x249e('0x30')]);_0x407dd1['where']=qs[_0x249e('0x29')](_[_0x249e('0x31')](_0x2a3381['query'],_0x495ad9[_0x249e('0x29')]));if(_0x45cc89[_0x249e('0x27')]){if(_0x45cc89[_0x249e('0x28')]){_0x45cc89[_0x249e('0x28')]=moment(_0x45cc89[_0x249e('0x28')])[_0x249e('0x32')](0x1,_0x249e('0x33'));}else{_0x45cc89[_0x249e('0x28')]=moment(_0x45cc89[_0x249e('0x27')])[_0x249e('0x32')](0x1,_0x249e('0x33'));}_[_0x249e('0x34')](_0x407dd1['where'],{'createdAt':{'$gte':_0x45cc89['dateStart'],'$lte':_0x45cc89[_0x249e('0x28')]}});}if(_0x2a3381['query'][_0x249e('0x35')]){_0x407dd1[_0x249e('0x36')]=_[_0x249e('0x34')](_0x407dd1[_0x249e('0x36')],{'$or':_[_0x249e('0x37')](_0x407dd1[_0x249e('0x2b')],function(_0x785583){var _0x244745={};_0x244745[_0x785583]={'$like':'%'+_0x2a3381[_0x249e('0x26')][_0x249e('0x35')]+'%'};return _0x244745;})});}_0x407dd1=_['merge']({},_0x407dd1,_0x2a3381['options']);var _0x4a3275={'where':_0x407dd1['where']};return db[_0x249e('0x22')][_0x249e('0x17')](_0x4a3275)[_0x249e('0x1e')](function(_0x3ef6be){_0x649a33[_0x249e('0x17')]=_0x3ef6be;if(_0x2a3381[_0x249e('0x26')][_0x249e('0x38')]){_0x407dd1['include']=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x407dd1);})[_0x249e('0x1e')](function(_0x26772b){_0x649a33[_0x249e('0x39')]=_0x26772b;return _0x649a33;})[_0x249e('0x1e')](respondWithFilteredResult(_0x460ea3,_0x407dd1))[_0x249e('0x3a')](handleError(_0x460ea3,null));};exports['show']=function(_0x186833,_0x3cbff4){var _0x37f60e={'raw':!![],'where':{'id':_0x186833[_0x249e('0x3b')]['id']}},_0x53b217={};_0x53b217[_0x249e('0x24')]=_['keys'](db['SquareDetailsReport'][_0x249e('0x23')]);_0x53b217[_0x249e('0x26')]=_['keys'](_0x186833[_0x249e('0x26')]);_0x53b217['filters']=_[_0x249e('0x2a')](_0x53b217[_0x249e('0x24')],_0x53b217[_0x249e('0x26')]);_0x37f60e[_0x249e('0x2b')]=_[_0x249e('0x2a')](_0x53b217['model'],qs['fields'](_0x186833[_0x249e('0x26')][_0x249e('0x2c')]));_0x37f60e['attributes']=_0x37f60e[_0x249e('0x2b')][_0x249e('0x3c')]?_0x37f60e[_0x249e('0x2b')]:_0x53b217[_0x249e('0x24')];if(_0x186833[_0x249e('0x26')][_0x249e('0x38')]){_0x37f60e[_0x249e('0x3d')]=[{'all':!![]}];}_0x37f60e=_[_0x249e('0x34')]({},_0x37f60e,_0x186833[_0x249e('0x3e')]);return db[_0x249e('0x22')][_0x249e('0x3f')](_0x37f60e)[_0x249e('0x1e')](handleEntityNotFound(_0x3cbff4,null))[_0x249e('0x1e')](respondWithResult(_0x3cbff4,null))[_0x249e('0x3a')](handleError(_0x3cbff4,null));};exports[_0x249e('0x40')]=function(_0x2bcfc1,_0x1ad809){return db['SquareDetailsReport'][_0x249e('0x40')](_0x2bcfc1['body'],{})[_0x249e('0x1e')](respondWithResult(_0x1ad809,0xc9))[_0x249e('0x3a')](handleError(_0x1ad809,null));};exports['update']=function(_0x3e58ff,_0x588c36){if(_0x3e58ff['body']['id']){delete _0x3e58ff['body']['id'];}return db[_0x249e('0x22')][_0x249e('0x3f')]({'where':{'id':_0x3e58ff[_0x249e('0x3b')]['id']}})[_0x249e('0x1e')](handleEntityNotFound(_0x588c36,null))[_0x249e('0x1e')](saveUpdates(_0x3e58ff[_0x249e('0x41')],null))[_0x249e('0x1e')](respondWithResult(_0x588c36,null))[_0x249e('0x3a')](handleError(_0x588c36,null));};exports[_0x249e('0x1f')]=function(_0x322f06,_0x5b9674){return db[_0x249e('0x22')]['find']({'where':{'id':_0x322f06['params']['id']}})[_0x249e('0x1e')](handleEntityNotFound(_0x5b9674,null))[_0x249e('0x1e')](removeEntity(_0x5b9674,null))[_0x249e('0x3a')](handleError(_0x5b9674,null));};exports[_0x249e('0x42')]=function(_0x1d3a2a,_0xf987a3){return db[_0x249e('0x22')][_0x249e('0x42')]()[_0x249e('0x1e')](respondWithResult(_0xf987a3,null))[_0x249e('0x3a')](handleError(_0xf987a3,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index c0ff732..1c81ae8 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 _0x82dc=['bluebird','exports','define','SquareDetailsReport','report_square_details','lodash','util','api','moment'];(function(_0xf3b6b3,_0x4148df){var _0x225c1c=function(_0x554f09){while(--_0x554f09){_0xf3b6b3['push'](_0xf3b6b3['shift']());}};_0x225c1c(++_0x4148df);}(_0x82dc,0x1c7));var _0xc82d=function(_0x3774f8,_0x579746){_0x3774f8=_0x3774f8-0x0;var _0x3aed2b=_0x82dc[_0x3774f8];return _0x3aed2b;};'use strict';var _=require(_0xc82d('0x0'));var util=require(_0xc82d('0x1'));var logger=require('../../config/logger')(_0xc82d('0x2'));var moment=require(_0xc82d('0x3'));var BPromise=require(_0xc82d('0x4'));var rp=require('request-promise');var attributes=require('./squareReportDetail.attributes');module[_0xc82d('0x5')]=function(_0x4091c9,_0x367560){return _0x4091c9[_0xc82d('0x6')](_0xc82d('0x7'),attributes,{'tableName':_0xc82d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1731=['./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1bf8f5,_0x28f62c){var _0x36a54e=function(_0x43ba61){while(--_0x43ba61){_0x1bf8f5['push'](_0x1bf8f5['shift']());}};_0x36a54e(++_0x28f62c);}(_0x1731,0xec));var _0x1173=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1731[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1173('0x0'));var util=require(_0x1173('0x1'));var logger=require(_0x1173('0x2'))(_0x1173('0x3'));var moment=require(_0x1173('0x4'));var BPromise=require(_0x1173('0x5'));var rp=require('request-promise');var attributes=require(_0x1173('0x6'));module[_0x1173('0x7')]=function(_0xa2b6a6,_0x1a3cd8){return _0xa2b6a6[_0x1173('0x8')](_0x1173('0x9'),attributes,{'tableName':_0x1173('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index fca84cb..828ccd6 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(_0x2d2820,_0x272af9){var _0x3be500=function(_0x3b0a28){while(--_0x3b0a28){_0x2d2820['push'](_0x2d2820['shift']());}};_0x3be500(++_0x272af9);}(_0x7a54,0x106));var _0x47a5=function(_0x154b21,_0x305abd){_0x154b21=_0x154b21-0x0;var _0x3f83c0=_0x7a54[_0x154b21];return _0x3f83c0;};'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(_0x3e2c1e,_0x1e8d40){var _0x1c6666=function(_0x190b73){while(--_0x190b73){_0x3e2c1e['push'](_0x3e2c1e['shift']());}};_0x1c6666(++_0x1e8d40);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var 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 12b4c2e..8655b81 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 _0x0d69=['../../components/auth/service','./system.controller','isAuthenticated','index','/process/:pid/kill','exports','express','Router'];(function(_0x466326,_0x5a69ea){var _0x3db288=function(_0x55218e){while(--_0x55218e){_0x466326['push'](_0x466326['shift']());}};_0x3db288(++_0x5a69ea);}(_0x0d69,0x106));var _0x90d6=function(_0x46a8dd,_0x54305a){_0x46a8dd=_0x46a8dd-0x0;var _0x522b7f=_0x0d69[_0x46a8dd];return _0x522b7f;};'use strict';var express=require(_0x90d6('0x0'));var router=express[_0x90d6('0x1')]();var auth=require(_0x90d6('0x2'));var controller=require(_0x90d6('0x3'));router['get']('/',auth[_0x90d6('0x4')](),controller[_0x90d6('0x5')]);router['get'](_0x90d6('0x6'),auth[_0x90d6('0x4')](),controller['killProcess']);module[_0x90d6('0x7')]=router; \ No newline at end of file +var _0x85cb=['./system.controller','get','/process/:pid/kill','isAuthenticated','killProcess','exports','Router'];(function(_0x1bb2dc,_0x17aea9){var _0x26c05f=function(_0x5b3086){while(--_0x5b3086){_0x1bb2dc['push'](_0x1bb2dc['shift']());}};_0x26c05f(++_0x17aea9);}(_0x85cb,0x1d4));var _0xb85c=function(_0x224a9a,_0x4339e3){_0x224a9a=_0x224a9a-0x0;var _0x1c892e=_0x85cb[_0x224a9a];return _0x1c892e;};'use strict';var express=require('express');var router=express[_0xb85c('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xb85c('0x1'));router[_0xb85c('0x2')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb85c('0x2')](_0xb85c('0x3'),auth[_0xb85c('0x4')](),controller[_0xb85c('0x5')]);module[_0xb85c('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 02ed5c4..cd91dae 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 _0xa3ba=['index','getAllData','then','status','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','exec','../../config/logger','util','bluebird','lodash','error','name','send'];(function(_0x3ab379,_0x456f38){var _0x445342=function(_0x1a8bdf){while(--_0x1a8bdf){_0x3ab379['push'](_0x3ab379['shift']());}};_0x445342(++_0x456f38);}(_0xa3ba,0x198));var _0xaa3b=function(_0x203d64,_0x1ec79c){_0x203d64=_0x203d64-0x0;var _0x462ab3=_0xa3ba[_0x203d64];return _0x462ab3;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0xaa3b('0x0')];var logger=require(_0xaa3b('0x1'))('api');var util=require(_0xaa3b('0x2'));var BPromise=require(_0xaa3b('0x3'));var _=require(_0xaa3b('0x4'));function handleError(_0x34546f,_0x160043,_0x3540f1){_0x160043=_0x160043||0x1f4;return function(_0x1c9a08){logger[_0xaa3b('0x5')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x3540f1,_0x160043,util['inspect'](_0x1c9a08,{'showHidden':![],'depth':null}));delete _0x1c9a08[_0xaa3b('0x6')];_0x34546f['status'](_0x160043)[_0xaa3b('0x7')](_0x1c9a08);};}exports[_0xaa3b('0x8')]=function(_0x711bac,_0x5841fd){return info[_0xaa3b('0x9')]()[_0xaa3b('0xa')](function(_0x1dd288){return _0x5841fd[_0xaa3b('0xb')](0xc8)[_0xaa3b('0xc')](_0x1dd288);})[_0xaa3b('0xd')](function(_0x2b7cff){return _0x5841fd['status'](0x1f4)[_0xaa3b('0xc')](_0x2b7cff);});};exports['killProcess']=function(_0x19ddce,_0xc2af5){var _0x4196c9=[_0xaa3b('0xe')];return new BPromise(function(_0x2a5b38,_0x56199a){return exec(util[_0xaa3b('0xf')](_0xaa3b('0x10'),_0x19ddce['params'][_0xaa3b('0x11')]),function(_0x12a93b,_0x4cb289,_0x12afd1){if(_0x12a93b){return _0x56199a(_0x12a93b);}return _0x2a5b38(_0x4cb289);});})[_0xaa3b('0xa')](function(_0x45d805){var _0x17a2e9=![];var _0x140784=_0x45d805['split'](/\n/);for(var _0x594e86=0x0,_0xfc028b=_0x4196c9[_0xaa3b('0x12')];_0x594e86<_0xfc028b,_0x17a2e9===![];_0x594e86+=0x1){if(_0x45d805[_0xaa3b('0x13')](_0x4196c9[_0x594e86])>=0x0){_0x17a2e9=!![];}}if(!_0x17a2e9){throw new Error(util['format'](_0xaa3b('0x14'),_0x19ddce[_0xaa3b('0x15')][_0xaa3b('0x11')]));}process[_0xaa3b('0x16')](_0x19ddce['params'][_0xaa3b('0x11')],_0xaa3b('0x17'));return _0xc2af5[_0xaa3b('0xb')](0xc8)[_0xaa3b('0xc')]({'message':util[_0xaa3b('0xf')](_0xaa3b('0x18'),_0x19ddce[_0xaa3b('0x15')][_0xaa3b('0x11')])});})['catch'](handleError(_0xc2af5,null,_0xaa3b('0x19')));}; \ No newline at end of file +var _0x3d99=['bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','then','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','killProcess','systeminformation','child_process','api','util'];(function(_0x1349b7,_0x1fb603){var _0x5a7543=function(_0x17c0a9){while(--_0x17c0a9){_0x1349b7['push'](_0x1349b7['shift']());}};_0x5a7543(++_0x1fb603);}(_0x3d99,0x9d));var _0x93d9=function(_0x25382b,_0x5b53f1){_0x25382b=_0x25382b-0x0;var _0x36f674=_0x3d99[_0x25382b];return _0x36f674;};'use strict';var info=require(_0x93d9('0x0'));var exec=require(_0x93d9('0x1'))['exec'];var logger=require('../../config/logger')(_0x93d9('0x2'));var util=require(_0x93d9('0x3'));var BPromise=require(_0x93d9('0x4'));var _=require(_0x93d9('0x5'));function handleError(_0x275363,_0x5a2c90,_0x1e2d6a){_0x5a2c90=_0x5a2c90||0x1f4;return function(_0x4faa13){logger[_0x93d9('0x6')](_0x93d9('0x7'),_0x1e2d6a,_0x5a2c90,util['inspect'](_0x4faa13,{'showHidden':![],'depth':null}));delete _0x4faa13[_0x93d9('0x8')];_0x275363[_0x93d9('0x9')](_0x5a2c90)['send'](_0x4faa13);};}exports['index']=function(_0xbdc6af,_0x2379c0){return info['getAllData']()[_0x93d9('0xa')](function(_0x2f016f){return _0x2379c0[_0x93d9('0x9')](0xc8)[_0x93d9('0xb')](_0x2f016f);})[_0x93d9('0xc')](function(_0x5ddb6f){return _0x2379c0['status'](0x1f4)[_0x93d9('0xb')](_0x5ddb6f);});};exports['killProcess']=function(_0xddbfdb,_0xa9f0e){var _0x20ee69=[_0x93d9('0xd')];return new BPromise(function(_0x298171,_0x49d0ee){return exec(util[_0x93d9('0xe')](_0x93d9('0xf'),_0xddbfdb[_0x93d9('0x10')][_0x93d9('0x11')]),function(_0x7cef4b,_0x91a797,_0x59803b){if(_0x7cef4b){return _0x49d0ee(_0x7cef4b);}return _0x298171(_0x91a797);});})[_0x93d9('0xa')](function(_0x3f32b3){var _0x398db0=![];var _0x595c6e=_0x3f32b3[_0x93d9('0x12')](/\n/);for(var _0x3e344d=0x0,_0x8e4dde=_0x20ee69['length'];_0x3e344d<_0x8e4dde,_0x398db0===![];_0x3e344d+=0x1){if(_0x3f32b3[_0x93d9('0x13')](_0x20ee69[_0x3e344d])>=0x0){_0x398db0=!![];}}if(!_0x398db0){throw new Error(util[_0x93d9('0xe')](_0x93d9('0x14'),_0xddbfdb[_0x93d9('0x10')]['pid']));}process[_0x93d9('0x15')](_0xddbfdb[_0x93d9('0x10')][_0x93d9('0x11')],'SIGINT');return _0xa9f0e[_0x93d9('0x9')](0xc8)[_0x93d9('0xb')]({'message':util[_0x93d9('0xe')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0xddbfdb[_0x93d9('0x10')][_0x93d9('0x11')])});})[_0x93d9('0xc')](handleError(_0xa9f0e,null,_0x93d9('0x16')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 6b53fbf..9d5ab42 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 _0xf496=['put','delete','destroy','exports','multer','util','path','../../components/auth/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x14e405,_0x387732){var _0x34822a=function(_0x29c0ab){while(--_0x29c0ab){_0x14e405['push'](_0x14e405['shift']());}};_0x34822a(++_0x387732);}(_0xf496,0x114));var _0x6f49=function(_0x4c2982,_0x3589e7){_0x4c2982=_0x4c2982-0x0;var _0x3ac10b=_0xf496[_0x4c2982];return _0x3ac10b;};'use strict';var multer=require(_0x6f49('0x0'));var util=require(_0x6f49('0x1'));var path=require(_0x6f49('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x6f49('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6f49('0x4'));var controller=require(_0x6f49('0x5'));router[_0x6f49('0x6')]('/',auth[_0x6f49('0x7')](),controller[_0x6f49('0x8')]);router[_0x6f49('0x6')](_0x6f49('0x9'),auth['isAuthenticated'](),controller[_0x6f49('0xa')]);router[_0x6f49('0xb')]('/',auth[_0x6f49('0x7')](),controller[_0x6f49('0xc')]);router[_0x6f49('0xd')]('/:id',auth[_0x6f49('0x7')](),controller['update']);router[_0x6f49('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x6f49('0xf')]);module[_0x6f49('0x10')]=router; \ No newline at end of file +var _0xa923=['./tag.controller','get','index','/:id','isAuthenticated','post','create','put','delete','destroy','exports','multer','util','express','Router','../../components/interaction/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa923,0xcb));var _0x3a92=function(_0x54b479,_0x31fd08){_0x54b479=_0x54b479-0x0;var _0x3be3da=_0xa923[_0x54b479];return _0x3be3da;};'use strict';var multer=require(_0x3a92('0x0'));var util=require(_0x3a92('0x1'));var path=require('path');var express=require(_0x3a92('0x2'));var router=express[_0x3a92('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3a92('0x4'));var config=require('../../config/environment');var controller=require(_0x3a92('0x5'));router[_0x3a92('0x6')]('/',auth['isAuthenticated'](),controller[_0x3a92('0x7')]);router[_0x3a92('0x6')](_0x3a92('0x8'),auth[_0x3a92('0x9')](),controller['show']);router[_0x3a92('0xa')]('/',auth['isAuthenticated'](),controller[_0x3a92('0xb')]);router[_0x3a92('0xc')](_0x3a92('0x8'),auth[_0x3a92('0x9')](),controller['update']);router[_0x3a92('0xd')](_0x3a92('0x8'),auth[_0x3a92('0x9')](),controller[_0x3a92('0xe')]);module[_0x3a92('0xf')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index ede5f13..fe0a766 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 _0x83d0=['STRING','sequelize','exports','name'];(function(_0x46391f,_0xf59ecb){var _0x1a7d35=function(_0x10b406){while(--_0x10b406){_0x46391f['push'](_0x46391f['shift']());}};_0x1a7d35(++_0xf59ecb);}(_0x83d0,0x1f1));var _0x083d=function(_0x3e7a81,_0x1764f9){_0x3e7a81=_0x3e7a81-0x0;var _0x4db107=_0x83d0[_0x3e7a81];return _0x4db107;};'use strict';var Sequelize=require(_0x083d('0x0'));module[_0x083d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x083d('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x083d('0x3')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x083d('0x3')]}}; \ No newline at end of file +var _0xa79a=['sequelize','exports','STRING','name'];(function(_0x4dea23,_0x3ea3b6){var _0x340631=function(_0x3bb28e){while(--_0x3bb28e){_0x4dea23['push'](_0x4dea23['shift']());}};_0x340631(++_0x3ea3b6);}(_0xa79a,0x1f4));var _0xaa79=function(_0x514fc0,_0x1032a0){_0x514fc0=_0x514fc0-0x0;var _0x26f8ee=_0xa79a[_0x514fc0];return _0x26f8ee;};'use strict';var Sequelize=require(_0xaa79('0x0'));module[_0xaa79('0x1')]={'name':{'type':Sequelize[_0xaa79('0x2')],'unique':_0xaa79('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xaa79('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xaa79('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 7a60e7d..d4d93cd 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 _0x4325=['filters','pick','add','day','merge','where','map','options','includeAll','Tag','findAll','catch','show','params','rawAttributes','include','find','create','body','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','end','error','name','index','model','keys','query','dateStart','dateEnd','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x389c94,_0x2a93d9){var _0x1455cb=function(_0x5903d6){while(--_0x5903d6){_0x389c94['push'](_0x389c94['shift']());}};_0x1455cb(++_0x2a93d9);}(_0x4325,0x1da));var _0x5432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4325[_0x3dd15e];return _0x231fd0;};'use strict';var jsonpatch=require(_0x5432('0x0'));var rp=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var Mustache=require(_0x5432('0x3'));var util=require(_0x5432('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x5432('0x5'));var ejs=require(_0x5432('0x6'));var fs=require('fs');var _=require(_0x5432('0x7'));var squel=require('squel');var crypto=require(_0x5432('0x8'));var jsforce=require(_0x5432('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x5432('0x5'));var querystring=require('querystring');var Papa=require(_0x5432('0xa'));var qs=require(_0x5432('0xb'));var logger=require(_0x5432('0xc'))(_0x5432('0xd'));var utils=require(_0x5432('0xe'));var config=require('../../config/environment');var db=require(_0x5432('0xf'))['db'];function respondWithStatusCode(_0x58348a,_0x28ff19){_0x28ff19=_0x28ff19||0xcc;return function(_0x35faac){if(_0x35faac){return _0x58348a[_0x5432('0x10')](_0x28ff19);}return _0x58348a[_0x5432('0x11')](_0x28ff19)['end']();};}function respondWithResult(_0x5a5952,_0x11b25c){_0x11b25c=_0x11b25c||0xc8;return function(_0x24fb02){if(_0x24fb02){return _0x5a5952['status'](_0x11b25c)[_0x5432('0x12')](_0x24fb02);}};}function respondWithFilteredResult(_0x111c54,_0x3b1127){return function(_0x424b8f){if(_0x424b8f){var _0xb39d36=_0x424b8f[_0x5432('0x13')],_0x1a084d=_0x3b1127[_0x5432('0x14')],_0x54f41a=_0x3b1127[_0x5432('0x14')]+_0x3b1127[_0x5432('0x15')],_0x5617ce;if(_0x54f41a>=_0xb39d36){_0x54f41a=_0xb39d36;_0x5617ce=0xc8;}else{_0x5617ce=0xce;}_0x111c54[_0x5432('0x11')](_0x5617ce);return _0x111c54[_0x5432('0x16')]('Content-Range',_0x1a084d+'-'+_0x54f41a+'/'+_0xb39d36)[_0x5432('0x12')](_0x424b8f);}return null;};}function patchUpdates(_0x49e8fd){return function(_0x20aa50){try{jsonpatch[_0x5432('0x17')](_0x20aa50,_0x49e8fd,!![]);}catch(_0x333152){return BPromise[_0x5432('0x18')](_0x333152);}return _0x20aa50[_0x5432('0x19')]();};}function saveUpdates(_0x5f011f,_0x3f3873){return function(_0x22f030){if(_0x22f030){return _0x22f030[_0x5432('0x1a')](_0x5f011f)[_0x5432('0x1b')](function(_0x1cf960){return _0x1cf960;});}return null;};}function removeEntity(_0x451de4,_0x29e699){return function(_0x5da6ea){if(_0x5da6ea){return _0x5da6ea[_0x5432('0x1c')]()[_0x5432('0x1b')](function(){_0x451de4[_0x5432('0x11')](0xcc)[_0x5432('0x1d')]();});}};}function handleEntityNotFound(_0x44c1cb,_0x5dcb7b){return function(_0x5901e2){if(!_0x5901e2){_0x44c1cb['sendStatus'](0x194);}return _0x5901e2;};}function handleError(_0x61827e,_0xb900f2){_0xb900f2=_0xb900f2||0x1f4;return function(_0x19bdab){logger[_0x5432('0x1e')](_0x19bdab['stack']);if(_0x19bdab['name']){delete _0x19bdab[_0x5432('0x1f')];}_0x61827e[_0x5432('0x11')](_0xb900f2)['send'](_0x19bdab);};}exports[_0x5432('0x20')]=function(_0x375afe,_0x637582){var _0x4b6ea5={},_0xd9928a={},_0xccefeb={'count':0x0,'rows':[]};var _0xe7eda2=db['Tag']['rawAttributes'];_0xd9928a[_0x5432('0x21')]=_[_0x5432('0x22')](_0xe7eda2);var _0x589f79={'dateStart':_0x375afe[_0x5432('0x23')][_0x5432('0x24')],'dateEnd':_0x375afe[_0x5432('0x23')]['dateEnd']};delete _0x375afe[_0x5432('0x23')]['dateStart'];delete _0x375afe['query'][_0x5432('0x25')];_0xd9928a['query']=_[_0x5432('0x22')](_0x375afe['query']);_0xd9928a['filters']=_[_0x5432('0x26')](_0xd9928a[_0x5432('0x21')],_0xd9928a[_0x5432('0x23')]);_0x4b6ea5['attributes']=_[_0x5432('0x26')](_0xd9928a[_0x5432('0x21')],qs[_0x5432('0x27')](_0x375afe[_0x5432('0x23')][_0x5432('0x27')]));_0x4b6ea5[_0x5432('0x28')]=_0x4b6ea5[_0x5432('0x28')][_0x5432('0x29')]?_0x4b6ea5[_0x5432('0x28')]:_0xd9928a['model'];if(!_0x375afe['query'][_0x5432('0x2a')](_0x5432('0x2b'))){_0x4b6ea5[_0x5432('0x15')]=qs[_0x5432('0x15')](_0x375afe[_0x5432('0x23')]['limit']);_0x4b6ea5[_0x5432('0x14')]=qs['offset'](_0x375afe[_0x5432('0x23')][_0x5432('0x14')]);}_0x4b6ea5[_0x5432('0x2c')]=qs[_0x5432('0x2d')](_0x375afe[_0x5432('0x23')][_0x5432('0x2d')]);_0x4b6ea5['where']=qs[_0x5432('0x2e')](_[_0x5432('0x2f')](_0x375afe[_0x5432('0x23')],_0xd9928a[_0x5432('0x2e')]));if(_0x589f79['dateStart']){if(_0x589f79[_0x5432('0x25')]){_0x589f79[_0x5432('0x25')]=moment(_0x589f79[_0x5432('0x25')])[_0x5432('0x30')](0x1,_0x5432('0x31'));}else{_0x589f79[_0x5432('0x25')]=moment(_0x589f79[_0x5432('0x24')])[_0x5432('0x30')](0x1,_0x5432('0x31'));}_[_0x5432('0x32')](_0x4b6ea5[_0x5432('0x33')],{'createdAt':{'$gte':_0x589f79[_0x5432('0x24')],'$lte':_0x589f79[_0x5432('0x25')]}});}if(_0x375afe[_0x5432('0x23')]['filter']){_0x4b6ea5[_0x5432('0x33')]=_['merge'](_0x4b6ea5[_0x5432('0x33')],{'$or':_[_0x5432('0x34')](_0x4b6ea5[_0x5432('0x28')],function(_0x1a5561){var _0x4dc00e={};_0x4dc00e[_0x1a5561]={'$like':'%'+_0x375afe['query']['filter']+'%'};return _0x4dc00e;})});}_0x4b6ea5=_[_0x5432('0x32')]({},_0x4b6ea5,_0x375afe[_0x5432('0x35')]);var _0x139d0a={'where':_0x4b6ea5[_0x5432('0x33')]};return db['Tag'][_0x5432('0x13')](_0x139d0a)[_0x5432('0x1b')](function(_0x3cd343){_0xccefeb['count']=_0x3cd343;if(_0x375afe[_0x5432('0x23')][_0x5432('0x36')]){_0x4b6ea5['include']=[{'all':!![]}];}return db[_0x5432('0x37')][_0x5432('0x38')](_0x4b6ea5);})['then'](function(_0x23f8f4){_0xccefeb['rows']=_0x23f8f4;return _0xccefeb;})[_0x5432('0x1b')](respondWithFilteredResult(_0x637582,_0x4b6ea5))[_0x5432('0x39')](handleError(_0x637582,null));};exports[_0x5432('0x3a')]=function(_0x11c7f2,_0x5cf59a){var _0x9cfb8b={'raw':!![],'where':{'id':_0x11c7f2[_0x5432('0x3b')]['id']}},_0x4b93b4={};_0x4b93b4[_0x5432('0x21')]=_[_0x5432('0x22')](db[_0x5432('0x37')][_0x5432('0x3c')]);_0x4b93b4[_0x5432('0x23')]=_[_0x5432('0x22')](_0x11c7f2['query']);_0x4b93b4[_0x5432('0x2e')]=_[_0x5432('0x26')](_0x4b93b4[_0x5432('0x21')],_0x4b93b4[_0x5432('0x23')]);_0x9cfb8b[_0x5432('0x28')]=_[_0x5432('0x26')](_0x4b93b4[_0x5432('0x21')],qs['fields'](_0x11c7f2[_0x5432('0x23')][_0x5432('0x27')]));_0x9cfb8b[_0x5432('0x28')]=_0x9cfb8b[_0x5432('0x28')][_0x5432('0x29')]?_0x9cfb8b['attributes']:_0x4b93b4[_0x5432('0x21')];if(_0x11c7f2['query'][_0x5432('0x36')]){_0x9cfb8b[_0x5432('0x3d')]=[{'all':!![]}];}_0x9cfb8b=_['merge']({},_0x9cfb8b,_0x11c7f2[_0x5432('0x35')]);return db['Tag'][_0x5432('0x3e')](_0x9cfb8b)[_0x5432('0x1b')](handleEntityNotFound(_0x5cf59a,null))['then'](respondWithResult(_0x5cf59a,null))['catch'](handleError(_0x5cf59a,null));};exports[_0x5432('0x3f')]=function(_0xa971bd,_0x3718be){return db[_0x5432('0x37')][_0x5432('0x3f')](_0xa971bd[_0x5432('0x40')],{})[_0x5432('0x1b')](respondWithResult(_0x3718be,0xc9))['catch'](handleError(_0x3718be,null));};exports[_0x5432('0x1a')]=function(_0x14763c,_0x429da8){if(_0x14763c['body']['id']){delete _0x14763c['body']['id'];}return db['Tag']['find']({'where':{'id':_0x14763c[_0x5432('0x3b')]['id']}})[_0x5432('0x1b')](handleEntityNotFound(_0x429da8,null))[_0x5432('0x1b')](saveUpdates(_0x14763c[_0x5432('0x40')],null))[_0x5432('0x1b')](respondWithResult(_0x429da8,null))['catch'](handleError(_0x429da8,null));};exports[_0x5432('0x1c')]=function(_0xce691b,_0x7937f9){return db['Tag'][_0x5432('0x3e')]({'where':{'id':_0xce691b[_0x5432('0x3b')]['id']}})[_0x5432('0x1b')](handleEntityNotFound(_0x7937f9,null))[_0x5432('0x1b')](removeEntity(_0x7937f9,null))[_0x5432('0x39')](handleError(_0x7937f9,null));}; \ No newline at end of file +var _0x7046=['jsforce','to-csv','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','name','send','index','Tag','rawAttributes','query','dateStart','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','dateEnd','day','add','merge','filter','map','options','count','includeAll','include','rows','show','params','keys','intersection','find','catch','create','body','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto'];(function(_0x13ac10,_0x46e79e){var _0x28eda2=function(_0x169ef0){while(--_0x169ef0){_0x13ac10['push'](_0x13ac10['shift']());}};_0x28eda2(++_0x46e79e);}(_0x7046,0x144));var _0x6704=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x7046[_0x42cae2];return _0x5f256f;};'use strict';var jsonpatch=require(_0x6704('0x0'));var rp=require(_0x6704('0x1'));var moment=require(_0x6704('0x2'));var BPromise=require(_0x6704('0x3'));var Mustache=require('mustache');var util=require(_0x6704('0x4'));var path=require(_0x6704('0x5'));var sox=require(_0x6704('0x6'));var csv=require('to-csv');var ejs=require(_0x6704('0x7'));var fs=require('fs');var _=require(_0x6704('0x8'));var squel=require(_0x6704('0x9'));var crypto=require(_0x6704('0xa'));var jsforce=require(_0x6704('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6704('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x6704('0xd'));var logger=require('../../config/logger')('api');var utils=require(_0x6704('0xe'));var config=require(_0x6704('0xf'));var db=require(_0x6704('0x10'))['db'];function respondWithStatusCode(_0x454bd5,_0x356687){_0x356687=_0x356687||0xcc;return function(_0x40d57d){if(_0x40d57d){return _0x454bd5[_0x6704('0x11')](_0x356687);}return _0x454bd5[_0x6704('0x12')](_0x356687)['end']();};}function respondWithResult(_0x2c8b0f,_0x29e6f7){_0x29e6f7=_0x29e6f7||0xc8;return function(_0x575aa6){if(_0x575aa6){return _0x2c8b0f[_0x6704('0x12')](_0x29e6f7)[_0x6704('0x13')](_0x575aa6);}};}function respondWithFilteredResult(_0x327e03,_0x13b8f4){return function(_0x34a538){if(_0x34a538){var _0x1ec91e=_0x34a538['count'],_0x17b9bc=_0x13b8f4[_0x6704('0x14')],_0x2da4df=_0x13b8f4[_0x6704('0x14')]+_0x13b8f4[_0x6704('0x15')],_0x24ece3;if(_0x2da4df>=_0x1ec91e){_0x2da4df=_0x1ec91e;_0x24ece3=0xc8;}else{_0x24ece3=0xce;}_0x327e03['status'](_0x24ece3);return _0x327e03[_0x6704('0x16')](_0x6704('0x17'),_0x17b9bc+'-'+_0x2da4df+'/'+_0x1ec91e)[_0x6704('0x13')](_0x34a538);}return null;};}function patchUpdates(_0x29fa46){return function(_0x37fa47){try{jsonpatch['apply'](_0x37fa47,_0x29fa46,!![]);}catch(_0x1e5f6e){return BPromise[_0x6704('0x18')](_0x1e5f6e);}return _0x37fa47[_0x6704('0x19')]();};}function saveUpdates(_0xe49450,_0x344ed9){return function(_0x5df2df){if(_0x5df2df){return _0x5df2df[_0x6704('0x1a')](_0xe49450)[_0x6704('0x1b')](function(_0x13e0c7){return _0x13e0c7;});}return null;};}function removeEntity(_0x156106,_0x35eb99){return function(_0x301fea){if(_0x301fea){return _0x301fea[_0x6704('0x1c')]()['then'](function(){_0x156106[_0x6704('0x12')](0xcc)[_0x6704('0x1d')]();});}};}function handleEntityNotFound(_0x318e2c,_0x59dc43){return function(_0x4dca58){if(!_0x4dca58){_0x318e2c[_0x6704('0x11')](0x194);}return _0x4dca58;};}function handleError(_0x3e183b,_0x3cd12e){_0x3cd12e=_0x3cd12e||0x1f4;return function(_0x4ecf4c){logger[_0x6704('0x1e')](_0x4ecf4c['stack']);if(_0x4ecf4c[_0x6704('0x1f')]){delete _0x4ecf4c[_0x6704('0x1f')];}_0x3e183b[_0x6704('0x12')](_0x3cd12e)[_0x6704('0x20')](_0x4ecf4c);};}exports[_0x6704('0x21')]=function(_0x2476d6,_0x2acafd){var _0x5d50ff={},_0x896227={},_0x1587c5={'count':0x0,'rows':[]};var _0x36bea4=db[_0x6704('0x22')][_0x6704('0x23')];_0x896227['model']=_['keys'](_0x36bea4);var _0x167312={'dateStart':_0x2476d6[_0x6704('0x24')][_0x6704('0x25')],'dateEnd':_0x2476d6[_0x6704('0x24')]['dateEnd']};delete _0x2476d6[_0x6704('0x24')][_0x6704('0x25')];delete _0x2476d6['query']['dateEnd'];_0x896227[_0x6704('0x24')]=_['keys'](_0x2476d6[_0x6704('0x24')]);_0x896227['filters']=_['intersection'](_0x896227[_0x6704('0x26')],_0x896227[_0x6704('0x24')]);_0x5d50ff[_0x6704('0x27')]=_['intersection'](_0x896227[_0x6704('0x26')],qs[_0x6704('0x28')](_0x2476d6[_0x6704('0x24')][_0x6704('0x28')]));_0x5d50ff[_0x6704('0x27')]=_0x5d50ff[_0x6704('0x27')][_0x6704('0x29')]?_0x5d50ff[_0x6704('0x27')]:_0x896227[_0x6704('0x26')];if(!_0x2476d6[_0x6704('0x24')][_0x6704('0x2a')](_0x6704('0x2b'))){_0x5d50ff[_0x6704('0x15')]=qs[_0x6704('0x15')](_0x2476d6[_0x6704('0x24')][_0x6704('0x15')]);_0x5d50ff[_0x6704('0x14')]=qs[_0x6704('0x14')](_0x2476d6[_0x6704('0x24')][_0x6704('0x14')]);}_0x5d50ff[_0x6704('0x2c')]=qs[_0x6704('0x2d')](_0x2476d6[_0x6704('0x24')][_0x6704('0x2d')]);_0x5d50ff[_0x6704('0x2e')]=qs['filters'](_['pick'](_0x2476d6['query'],_0x896227[_0x6704('0x2f')]));if(_0x167312[_0x6704('0x25')]){if(_0x167312[_0x6704('0x30')]){_0x167312['dateEnd']=moment(_0x167312[_0x6704('0x30')])['add'](0x1,_0x6704('0x31'));}else{_0x167312[_0x6704('0x30')]=moment(_0x167312[_0x6704('0x25')])[_0x6704('0x32')](0x1,_0x6704('0x31'));}_[_0x6704('0x33')](_0x5d50ff[_0x6704('0x2e')],{'createdAt':{'$gte':_0x167312[_0x6704('0x25')],'$lte':_0x167312['dateEnd']}});}if(_0x2476d6['query'][_0x6704('0x34')]){_0x5d50ff[_0x6704('0x2e')]=_['merge'](_0x5d50ff['where'],{'$or':_[_0x6704('0x35')](_0x5d50ff['attributes'],function(_0xd7e27b){var _0x126e54={};_0x126e54[_0xd7e27b]={'$like':'%'+_0x2476d6[_0x6704('0x24')][_0x6704('0x34')]+'%'};return _0x126e54;})});}_0x5d50ff=_['merge']({},_0x5d50ff,_0x2476d6[_0x6704('0x36')]);var _0x1ee017={'where':_0x5d50ff['where']};return db[_0x6704('0x22')]['count'](_0x1ee017)[_0x6704('0x1b')](function(_0x714c83){_0x1587c5[_0x6704('0x37')]=_0x714c83;if(_0x2476d6['query'][_0x6704('0x38')]){_0x5d50ff[_0x6704('0x39')]=[{'all':!![]}];}return db[_0x6704('0x22')]['findAll'](_0x5d50ff);})[_0x6704('0x1b')](function(_0x444d36){_0x1587c5[_0x6704('0x3a')]=_0x444d36;return _0x1587c5;})[_0x6704('0x1b')](respondWithFilteredResult(_0x2acafd,_0x5d50ff))['catch'](handleError(_0x2acafd,null));};exports[_0x6704('0x3b')]=function(_0x50cc74,_0x2defda){var _0x45a217={'raw':!![],'where':{'id':_0x50cc74[_0x6704('0x3c')]['id']}},_0x10fc26={};_0x10fc26['model']=_['keys'](db['Tag'][_0x6704('0x23')]);_0x10fc26['query']=_[_0x6704('0x3d')](_0x50cc74['query']);_0x10fc26[_0x6704('0x2f')]=_[_0x6704('0x3e')](_0x10fc26['model'],_0x10fc26[_0x6704('0x24')]);_0x45a217[_0x6704('0x27')]=_[_0x6704('0x3e')](_0x10fc26[_0x6704('0x26')],qs[_0x6704('0x28')](_0x50cc74['query'][_0x6704('0x28')]));_0x45a217[_0x6704('0x27')]=_0x45a217[_0x6704('0x27')][_0x6704('0x29')]?_0x45a217[_0x6704('0x27')]:_0x10fc26['model'];if(_0x50cc74[_0x6704('0x24')]['includeAll']){_0x45a217[_0x6704('0x39')]=[{'all':!![]}];}_0x45a217=_[_0x6704('0x33')]({},_0x45a217,_0x50cc74[_0x6704('0x36')]);return db[_0x6704('0x22')][_0x6704('0x3f')](_0x45a217)['then'](handleEntityNotFound(_0x2defda,null))[_0x6704('0x1b')](respondWithResult(_0x2defda,null))[_0x6704('0x40')](handleError(_0x2defda,null));};exports['create']=function(_0x1b9d36,_0x17a98a){return db[_0x6704('0x22')][_0x6704('0x41')](_0x1b9d36[_0x6704('0x42')],{})[_0x6704('0x1b')](respondWithResult(_0x17a98a,0xc9))['catch'](handleError(_0x17a98a,null));};exports[_0x6704('0x1a')]=function(_0x5b0713,_0xb73442){if(_0x5b0713['body']['id']){delete _0x5b0713[_0x6704('0x42')]['id'];}return db['Tag']['find']({'where':{'id':_0x5b0713[_0x6704('0x3c')]['id']}})[_0x6704('0x1b')](handleEntityNotFound(_0xb73442,null))[_0x6704('0x1b')](saveUpdates(_0x5b0713[_0x6704('0x42')],null))[_0x6704('0x1b')](respondWithResult(_0xb73442,null))[_0x6704('0x40')](handleError(_0xb73442,null));};exports['destroy']=function(_0x5b9e28,_0x254cf7){return db[_0x6704('0x22')][_0x6704('0x3f')]({'where':{'id':_0x5b9e28[_0x6704('0x3c')]['id']}})[_0x6704('0x1b')](handleEntityNotFound(_0x254cf7,null))[_0x6704('0x1b')](removeEntity(_0x254cf7,null))[_0x6704('0x40')](handleError(_0x254cf7,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index cd8c133..a4af4ad 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 _0xe944=['util','../../config/logger','api','moment','./tag.attributes','tools_tags','lodash'];(function(_0x24ddd5,_0x4933ec){var _0x35e166=function(_0x6868ca){while(--_0x6868ca){_0x24ddd5['push'](_0x24ddd5['shift']());}};_0x35e166(++_0x4933ec);}(_0xe944,0x117));var _0x4e94=function(_0x3e706d,_0x2c7ccb){_0x3e706d=_0x3e706d-0x0;var _0x525b87=_0xe944[_0x3e706d];return _0x525b87;};'use strict';var _=require(_0x4e94('0x0'));var util=require(_0x4e94('0x1'));var logger=require(_0x4e94('0x2'))(_0x4e94('0x3'));var moment=require(_0x4e94('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x4e94('0x5'));module['exports']=function(_0xcedacf,_0xc560d5){return _0xcedacf['define']('Tag',attributes,{'tableName':_0x4e94('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd91d=['exports','define','Tag','tools_tags','lodash','util','../../config/logger','api','request-promise','./tag.attributes'];(function(_0x21be3c,_0x1a999d){var _0x4df067=function(_0x4885a1){while(--_0x4885a1){_0x21be3c['push'](_0x21be3c['shift']());}};_0x4df067(++_0x1a999d);}(_0xd91d,0x1e4));var _0xdd91=function(_0x2e1ae2,_0xea6bd8){_0x2e1ae2=_0x2e1ae2-0x0;var _0x4e199b=_0xd91d[_0x2e1ae2];return _0x4e199b;};'use strict';var _=require(_0xdd91('0x0'));var util=require(_0xdd91('0x1'));var logger=require(_0xdd91('0x2'))(_0xdd91('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdd91('0x4'));var attributes=require(_0xdd91('0x5'));module[_0xdd91('0x6')]=function(_0x2803ad,_0x1bf950){return _0x2803ad[_0xdd91('0x7')](_0xdd91('0x8'),attributes,{'tableName':_0xdd91('0x9'),'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 09cef8e..7bde94e 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 _0xe7c5=['error','code','message','result','lodash','util','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','Tag,\x20%s,\x20%s','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4efe4b,_0x2af93c){var _0x63e206=function(_0x2d2844){while(--_0x2d2844){_0x4efe4b['push'](_0x4efe4b['shift']());}};_0x63e206(++_0x2af93c);}(_0xe7c5,0xbf));var _0x5e7c=function(_0x43026b,_0x928d8c){_0x43026b=_0x43026b-0x0;var _0x4a96cd=_0xe7c5[_0x43026b];return _0x4a96cd;};'use strict';var _=require(_0x5e7c('0x0'));var util=require(_0x5e7c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x5e7c('0x2'));var logger=require(_0x5e7c('0x3'))(_0x5e7c('0x4'));var config=require('../../config/environment');var jayson=require(_0x5e7c('0x5'));var client=jayson[_0x5e7c('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24f1dc,_0x4d75da,_0x12cb6c){return new BPromise(function(_0x726f89,_0xe147f){return client['request'](_0x24f1dc,_0x12cb6c)[_0x5e7c('0x7')](function(_0x4d8303){logger[_0x5e7c('0x8')](_0x5e7c('0x9'),_0x4d75da,'request\x20sent');logger['debug'](_0x5e7c('0xa'),_0x4d75da,_0x5e7c('0xb'),JSON[_0x5e7c('0xc')](_0x4d8303));if(_0x4d8303['error']){if(_0x4d8303[_0x5e7c('0xd')][_0x5e7c('0xe')]===0x1f4){logger['error'](_0x5e7c('0x9'),_0x4d75da,_0x4d8303[_0x5e7c('0xd')]['message']);return _0xe147f(_0x4d8303['error']['message']);}logger[_0x5e7c('0xd')](_0x5e7c('0x9'),_0x4d75da,_0x4d8303[_0x5e7c('0xd')]['message']);return _0x726f89(_0x4d8303[_0x5e7c('0xd')][_0x5e7c('0xf')]);}else{logger['info'](_0x5e7c('0x9'),_0x4d75da,_0x5e7c('0xb'));_0x726f89(_0x4d8303[_0x5e7c('0x10')][_0x5e7c('0xf')]);}})['catch'](function(_0x186f10){logger[_0x5e7c('0xd')](_0x5e7c('0x9'),_0x4d75da,_0x186f10);_0xe147f(_0x186f10);});});} \ No newline at end of file +var _0x4e78=['randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message','info','catch','util','moment'];(function(_0x1ceb79,_0x2a6e04){var _0x4854e4=function(_0x32b571){while(--_0x32b571){_0x1ceb79['push'](_0x1ceb79['shift']());}};_0x4854e4(++_0x2a6e04);}(_0x4e78,0x1cc));var _0x84e7=function(_0x22ee1e,_0x3eff80){_0x22ee1e=_0x22ee1e-0x0;var _0x49a5c9=_0x4e78[_0x22ee1e];return _0x49a5c9;};'use strict';var _=require('lodash');var util=require(_0x84e7('0x0'));var moment=require(_0x84e7('0x1'));var BPromise=require('bluebird');var rs=require(_0x84e7('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x84e7('0x3'));var logger=require('../../config/logger')(_0x84e7('0x4'));var config=require(_0x84e7('0x5'));var jayson=require(_0x84e7('0x6'));var client=jayson[_0x84e7('0x7')][_0x84e7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xdac0b3,_0x59f554,_0x1c0ff2){return new BPromise(function(_0x5d044d,_0x1875cd){return client[_0x84e7('0x9')](_0xdac0b3,_0x1c0ff2)[_0x84e7('0xa')](function(_0xf49b58){logger['info']('Tag,\x20%s,\x20%s',_0x59f554,_0x84e7('0xb'));logger[_0x84e7('0xc')](_0x84e7('0xd'),_0x59f554,_0x84e7('0xb'),JSON[_0x84e7('0xe')](_0xf49b58));if(_0xf49b58[_0x84e7('0xf')]){if(_0xf49b58[_0x84e7('0xf')][_0x84e7('0x10')]===0x1f4){logger[_0x84e7('0xf')](_0x84e7('0x11'),_0x59f554,_0xf49b58[_0x84e7('0xf')][_0x84e7('0x12')]);return _0x1875cd(_0xf49b58[_0x84e7('0xf')][_0x84e7('0x12')]);}logger[_0x84e7('0xf')](_0x84e7('0x11'),_0x59f554,_0xf49b58[_0x84e7('0xf')]['message']);return _0x5d044d(_0xf49b58[_0x84e7('0xf')][_0x84e7('0x12')]);}else{logger[_0x84e7('0x13')](_0x84e7('0x11'),_0x59f554,_0x84e7('0xb'));_0x5d044d(_0xf49b58['result'][_0x84e7('0x12')]);}})[_0x84e7('0x14')](function(_0x5cbeeb){logger[_0x84e7('0xf')](_0x84e7('0x11'),_0x59f554,_0x5cbeeb);_0x1875cd(_0x5cbeeb);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index ed3bcde..02f74c0 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 _0xd8a6=['../../config/environment','./team.controller','get','isAuthenticated','index','/:id/queues','/:id/users','getAgents','post','create','addQueues','addAgents','/:id','update','delete','destroy','removeAgents','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd8a6,0x71));var _0x6d8a=function(_0x59b907,_0x33de40){_0x59b907=_0x59b907-0x0;var _0x13fab4=_0xd8a6[_0x59b907];return _0x13fab4;};'use strict';var multer=require(_0x6d8a('0x0'));var util=require(_0x6d8a('0x1'));var path=require(_0x6d8a('0x2'));var express=require(_0x6d8a('0x3'));var router=express[_0x6d8a('0x4')]();var auth=require(_0x6d8a('0x5'));var interaction=require(_0x6d8a('0x6'));var config=require(_0x6d8a('0x7'));var controller=require(_0x6d8a('0x8'));router[_0x6d8a('0x9')]('/',auth[_0x6d8a('0xa')](),controller[_0x6d8a('0xb')]);router['get']('/:id',auth[_0x6d8a('0xa')](),controller['show']);router['get'](_0x6d8a('0xc'),auth[_0x6d8a('0xa')](),controller['getQueues']);router[_0x6d8a('0x9')](_0x6d8a('0xd'),auth[_0x6d8a('0xa')](),controller[_0x6d8a('0xe')]);router[_0x6d8a('0xf')]('/',auth[_0x6d8a('0xa')](),controller[_0x6d8a('0x10')]);router[_0x6d8a('0xf')](_0x6d8a('0xc'),auth[_0x6d8a('0xa')](),controller[_0x6d8a('0x11')]);router['post'](_0x6d8a('0xd'),auth['isAuthenticated'](),controller[_0x6d8a('0x12')]);router['put'](_0x6d8a('0x13'),auth['isAuthenticated'](),controller[_0x6d8a('0x14')]);router[_0x6d8a('0x15')]('/:id',auth[_0x6d8a('0xa')](),controller[_0x6d8a('0x16')]);router[_0x6d8a('0x15')](_0x6d8a('0xc'),auth[_0x6d8a('0xa')](),controller['removeQueues']);router[_0x6d8a('0x15')](_0x6d8a('0xd'),auth['isAuthenticated'](),controller[_0x6d8a('0x17')]);module['exports']=router; \ No newline at end of file +var _0xe2a3=['./team.controller','get','/:id','isAuthenticated','show','/:id/queues','getQueues','/:id/users','getAgents','post','addAgents','put','update','delete','removeQueues','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x351019,_0x5ab650){var _0x339c4e=function(_0x505787){while(--_0x505787){_0x351019['push'](_0x351019['shift']());}};_0x339c4e(++_0x5ab650);}(_0xe2a3,0x8e));var _0x3e2a=function(_0x16a344,_0x43dc6c){_0x16a344=_0x16a344-0x0;var _0x24f848=_0xe2a3[_0x16a344];return _0x24f848;};'use strict';var multer=require(_0x3e2a('0x0'));var util=require(_0x3e2a('0x1'));var path=require(_0x3e2a('0x2'));var express=require(_0x3e2a('0x3'));var router=express[_0x3e2a('0x4')]();var auth=require(_0x3e2a('0x5'));var interaction=require(_0x3e2a('0x6'));var config=require(_0x3e2a('0x7'));var controller=require(_0x3e2a('0x8'));router[_0x3e2a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3e2a('0x9')](_0x3e2a('0xa'),auth[_0x3e2a('0xb')](),controller[_0x3e2a('0xc')]);router[_0x3e2a('0x9')](_0x3e2a('0xd'),auth[_0x3e2a('0xb')](),controller[_0x3e2a('0xe')]);router[_0x3e2a('0x9')](_0x3e2a('0xf'),auth[_0x3e2a('0xb')](),controller[_0x3e2a('0x10')]);router['post']('/',auth[_0x3e2a('0xb')](),controller['create']);router[_0x3e2a('0x11')]('/:id/queues',auth[_0x3e2a('0xb')](),controller['addQueues']);router[_0x3e2a('0x11')](_0x3e2a('0xf'),auth[_0x3e2a('0xb')](),controller[_0x3e2a('0x12')]);router[_0x3e2a('0x13')](_0x3e2a('0xa'),auth['isAuthenticated'](),controller[_0x3e2a('0x14')]);router[_0x3e2a('0x15')](_0x3e2a('0xa'),auth[_0x3e2a('0xb')](),controller['destroy']);router[_0x3e2a('0x15')](_0x3e2a('0xd'),auth['isAuthenticated'](),controller[_0x3e2a('0x16')]);router[_0x3e2a('0x15')](_0x3e2a('0xf'),auth[_0x3e2a('0xb')](),controller[_0x3e2a('0x17')]);module[_0x3e2a('0x18')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index e9af85a..0aa7532 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 _0x3838=['STRING'];(function(_0xe51964,_0x433b90){var _0x2c2366=function(_0x1bc95c){while(--_0x1bc95c){_0xe51964['push'](_0xe51964['shift']());}};_0x2c2366(++_0x433b90);}(_0x3838,0xdf));var _0x8383=function(_0x4d9f6a,_0x51d38b){_0x4d9f6a=_0x4d9f6a-0x0;var _0x6d44ab=_0x3838[_0x4d9f6a];return _0x6d44ab;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8383('0x0')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x8383('0x0')]}}; \ No newline at end of file +var _0xf079=['sequelize','STRING'];(function(_0x521278,_0x1128f1){var _0x48e36e=function(_0x5ba32f){while(--_0x5ba32f){_0x521278['push'](_0x521278['shift']());}};_0x48e36e(++_0x1128f1);}(_0xf079,0x92));var _0x9f07=function(_0x2e5069,_0x3d595e){_0x2e5069=_0x2e5069-0x0;var _0x4512ec=_0xf079[_0x2e5069];return _0x4512ec;};'use strict';var Sequelize=require(_0x9f07('0x0'));module['exports']={'name':{'type':Sequelize[_0x9f07('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x9f07('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 87bc70d..44d62af 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 _0x1fcc=['register','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','sendStatus','error','name','send','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','add','day','merge','filter','Team','includeAll','include','rows','catch','show','params','options','find','create','body','getQueues','findOne','isValidChannel','Sequelize','Unknown\x20channel','capitalize','channel','toLowerCase','Queue','get','Queues','addQueues','ValidationError','ids','removeQueues','remove','addAgents','each','voice','chat','mail','fax','openchannel','User','findAll','loginInPause','voicePause','UserVoiceQueueRt','%s/%s','SIP','spread','userTeam:save','removeAgents','isArray','userTeam:remove','getAgents','map','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','socket.io-emitter','./team.socket'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1fcc,0x125));var _0xc1fc=function(_0x2aefb6,_0x1bd384){_0x2aefb6=_0x2aefb6-0x0;var _0x202772=_0x1fcc[_0x2aefb6];return _0x202772;};'use strict';var jsonpatch=require(_0xc1fc('0x0'));var rp=require(_0xc1fc('0x1'));var moment=require('moment');var BPromise=require(_0xc1fc('0x2'));var Mustache=require(_0xc1fc('0x3'));var util=require(_0xc1fc('0x4'));var path=require(_0xc1fc('0x5'));var sox=require(_0xc1fc('0x6'));var csv=require(_0xc1fc('0x7'));var ejs=require(_0xc1fc('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc1fc('0x9'));var crypto=require(_0xc1fc('0xa'));var jsforce=require(_0xc1fc('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc1fc('0x7'));var querystring=require(_0xc1fc('0xc'));var Papa=require('papaparse');var qs=require(_0xc1fc('0xd'));var logger=require(_0xc1fc('0xe'))('api');var utils=require(_0xc1fc('0xf'));var config=require('../../config/environment');var db=require(_0xc1fc('0x10'))['db'];var socket=require(_0xc1fc('0x11'))({'host':'localhost','port':0x18eb});require(_0xc1fc('0x12'))[_0xc1fc('0x13')](socket);function respondWithStatusCode(_0x2a1426,_0x119d27){_0x119d27=_0x119d27||0xcc;return function(_0x62369d){if(_0x62369d){return _0x2a1426['sendStatus'](_0x119d27);}return _0x2a1426[_0xc1fc('0x14')](_0x119d27)[_0xc1fc('0x15')]();};}function respondWithResult(_0x354393,_0x55c62b){_0x55c62b=_0x55c62b||0xc8;return function(_0x159158){if(_0x159158){return _0x354393[_0xc1fc('0x14')](_0x55c62b)[_0xc1fc('0x16')](_0x159158);}};}function respondWithFilteredResult(_0x52b0bb,_0x2a8519){return function(_0x338ca8){if(_0x338ca8){var _0x2c5d9b=_0x338ca8[_0xc1fc('0x17')],_0x201115=_0x2a8519[_0xc1fc('0x18')],_0x232bc2=_0x2a8519[_0xc1fc('0x18')]+_0x2a8519[_0xc1fc('0x19')],_0xd04a31;if(_0x232bc2>=_0x2c5d9b){_0x232bc2=_0x2c5d9b;_0xd04a31=0xc8;}else{_0xd04a31=0xce;}_0x52b0bb['status'](_0xd04a31);return _0x52b0bb[_0xc1fc('0x1a')]('Content-Range',_0x201115+'-'+_0x232bc2+'/'+_0x2c5d9b)['json'](_0x338ca8);}return null;};}function patchUpdates(_0x6c0e26){return function(_0x20f4ec){try{jsonpatch[_0xc1fc('0x1b')](_0x20f4ec,_0x6c0e26,!![]);}catch(_0x8f5528){return BPromise[_0xc1fc('0x1c')](_0x8f5528);}return _0x20f4ec[_0xc1fc('0x1d')]();};}function saveUpdates(_0x28e2d2,_0x1ae5b6){return function(_0x2042b8){if(_0x2042b8){return _0x2042b8['update'](_0x28e2d2)[_0xc1fc('0x1e')](function(_0x36122b){return _0x36122b;});}return null;};}function removeEntity(_0x56b0f3,_0x5f41b7){return function(_0x36345c){if(_0x36345c){return _0x36345c[_0xc1fc('0x1f')]()[_0xc1fc('0x1e')](function(){_0x56b0f3['status'](0xcc)[_0xc1fc('0x15')]();});}};}function handleEntityNotFound(_0x54d500,_0x5ae947){return function(_0x2fe4bc){if(!_0x2fe4bc){_0x54d500[_0xc1fc('0x20')](0x194);}return _0x2fe4bc;};}function handleError(_0x34aaa4,_0x3aacf2){_0x3aacf2=_0x3aacf2||0x1f4;return function(_0x214ddd){logger[_0xc1fc('0x21')](_0x214ddd['stack']);if(_0x214ddd[_0xc1fc('0x22')]){delete _0x214ddd['name'];}_0x34aaa4[_0xc1fc('0x14')](_0x3aacf2)[_0xc1fc('0x23')](_0x214ddd);};}exports['index']=function(_0xcb3f32,_0x2d6f4a){var _0x281d16={},_0x23594f={},_0x41810e={'count':0x0,'rows':[]};var _0x9644db=db['Team'][_0xc1fc('0x24')];_0x23594f[_0xc1fc('0x25')]=_[_0xc1fc('0x26')](_0x9644db);var _0x5b5551={'dateStart':_0xcb3f32[_0xc1fc('0x27')]['dateStart'],'dateEnd':_0xcb3f32[_0xc1fc('0x27')][_0xc1fc('0x28')]};delete _0xcb3f32[_0xc1fc('0x27')][_0xc1fc('0x29')];delete _0xcb3f32[_0xc1fc('0x27')][_0xc1fc('0x28')];_0x23594f['query']=_[_0xc1fc('0x26')](_0xcb3f32['query']);_0x23594f[_0xc1fc('0x2a')]=_[_0xc1fc('0x2b')](_0x23594f['model'],_0x23594f['query']);_0x281d16[_0xc1fc('0x2c')]=_['intersection'](_0x23594f[_0xc1fc('0x25')],qs[_0xc1fc('0x2d')](_0xcb3f32['query'][_0xc1fc('0x2d')]));_0x281d16['attributes']=_0x281d16[_0xc1fc('0x2c')][_0xc1fc('0x2e')]?_0x281d16['attributes']:_0x23594f[_0xc1fc('0x25')];if(!_0xcb3f32[_0xc1fc('0x27')]['hasOwnProperty'](_0xc1fc('0x2f'))){_0x281d16[_0xc1fc('0x19')]=qs['limit'](_0xcb3f32[_0xc1fc('0x27')]['limit']);_0x281d16['offset']=qs[_0xc1fc('0x18')](_0xcb3f32[_0xc1fc('0x27')]['offset']);}_0x281d16[_0xc1fc('0x30')]=qs[_0xc1fc('0x31')](_0xcb3f32[_0xc1fc('0x27')][_0xc1fc('0x31')]);_0x281d16[_0xc1fc('0x32')]=qs[_0xc1fc('0x2a')](_[_0xc1fc('0x33')](_0xcb3f32[_0xc1fc('0x27')],_0x23594f[_0xc1fc('0x2a')]));if(_0x5b5551['dateStart']){if(_0x5b5551['dateEnd']){_0x5b5551[_0xc1fc('0x28')]=moment(_0x5b5551['dateEnd'])[_0xc1fc('0x34')](0x1,_0xc1fc('0x35'));}else{_0x5b5551[_0xc1fc('0x28')]=moment(_0x5b5551[_0xc1fc('0x29')])['add'](0x1,'day');}_[_0xc1fc('0x36')](_0x281d16[_0xc1fc('0x32')],{'createdAt':{'$gte':_0x5b5551[_0xc1fc('0x29')],'$lte':_0x5b5551[_0xc1fc('0x28')]}});}if(_0xcb3f32[_0xc1fc('0x27')][_0xc1fc('0x37')]){_0x281d16[_0xc1fc('0x32')]=_[_0xc1fc('0x36')](_0x281d16['where'],{'$or':_['map'](_0x281d16[_0xc1fc('0x2c')],function(_0x4da591){var _0x24bb75={};_0x24bb75[_0x4da591]={'$like':'%'+_0xcb3f32['query'][_0xc1fc('0x37')]+'%'};return _0x24bb75;})});}_0x281d16=_['merge']({},_0x281d16,_0xcb3f32['options']);var _0x1f29b6={'where':_0x281d16[_0xc1fc('0x32')]};return db[_0xc1fc('0x38')]['count'](_0x1f29b6)['then'](function(_0x248ea9){_0x41810e['count']=_0x248ea9;if(_0xcb3f32['query'][_0xc1fc('0x39')]){_0x281d16[_0xc1fc('0x3a')]=[{'all':!![]}];}return db[_0xc1fc('0x38')]['findAll'](_0x281d16);})['then'](function(_0x24730c){_0x41810e[_0xc1fc('0x3b')]=_0x24730c;return _0x41810e;})[_0xc1fc('0x1e')](respondWithFilteredResult(_0x2d6f4a,_0x281d16))[_0xc1fc('0x3c')](handleError(_0x2d6f4a,null));};exports[_0xc1fc('0x3d')]=function(_0x15315e,_0x1532fe){var _0x22f5ed={'raw':![],'where':{'id':_0x15315e[_0xc1fc('0x3e')]['id']}},_0x2330ce={};_0x2330ce[_0xc1fc('0x25')]=_['keys'](db[_0xc1fc('0x38')][_0xc1fc('0x24')]);_0x2330ce[_0xc1fc('0x27')]=_[_0xc1fc('0x26')](_0x15315e[_0xc1fc('0x27')]);_0x2330ce[_0xc1fc('0x2a')]=_[_0xc1fc('0x2b')](_0x2330ce['model'],_0x2330ce[_0xc1fc('0x27')]);_0x22f5ed[_0xc1fc('0x2c')]=_[_0xc1fc('0x2b')](_0x2330ce[_0xc1fc('0x25')],qs[_0xc1fc('0x2d')](_0x15315e[_0xc1fc('0x27')][_0xc1fc('0x2d')]));_0x22f5ed[_0xc1fc('0x2c')]=_0x22f5ed['attributes'][_0xc1fc('0x2e')]?_0x22f5ed[_0xc1fc('0x2c')]:_0x2330ce[_0xc1fc('0x25')];if(_0x15315e[_0xc1fc('0x27')]['includeAll']){_0x22f5ed[_0xc1fc('0x3a')]=[{'all':!![]}];}_0x22f5ed=_[_0xc1fc('0x36')]({},_0x22f5ed,_0x15315e[_0xc1fc('0x3f')]);return db[_0xc1fc('0x38')][_0xc1fc('0x40')](_0x22f5ed)[_0xc1fc('0x1e')](handleEntityNotFound(_0x1532fe,null))[_0xc1fc('0x1e')](respondWithResult(_0x1532fe,null))[_0xc1fc('0x3c')](handleError(_0x1532fe,null));};exports[_0xc1fc('0x41')]=function(_0x246e37,_0x34bbae){return db['Team'][_0xc1fc('0x41')](_0x246e37[_0xc1fc('0x42')],{})[_0xc1fc('0x1e')](respondWithResult(_0x34bbae,0xc9))[_0xc1fc('0x3c')](handleError(_0x34bbae,null));};exports['update']=function(_0x51842e,_0x84fd31){if(_0x51842e['body']['id']){delete _0x51842e['body']['id'];}return db[_0xc1fc('0x38')]['find']({'where':{'id':_0x51842e[_0xc1fc('0x3e')]['id']}})[_0xc1fc('0x1e')](handleEntityNotFound(_0x84fd31,null))['then'](saveUpdates(_0x51842e[_0xc1fc('0x42')],null))[_0xc1fc('0x1e')](respondWithResult(_0x84fd31,null))[_0xc1fc('0x3c')](handleError(_0x84fd31,null));};exports['destroy']=function(_0x3f1987,_0x22ee4a){return db[_0xc1fc('0x38')][_0xc1fc('0x40')]({'where':{'id':_0x3f1987[_0xc1fc('0x3e')]['id']}})[_0xc1fc('0x1e')](handleEntityNotFound(_0x22ee4a,null))[_0xc1fc('0x1e')](removeEntity(_0x22ee4a,null))[_0xc1fc('0x3c')](handleError(_0x22ee4a,null));};exports[_0xc1fc('0x43')]=function(_0x5b1b0e,_0x2fc45d,_0x53cb2f){return db['Team'][_0xc1fc('0x44')]({'where':{'id':_0x5b1b0e[_0xc1fc('0x3e')]['id']}})[_0xc1fc('0x1e')](handleEntityNotFound(_0x2fc45d,null))[_0xc1fc('0x1e')](function(_0x58b591){if(!_0x5b1b0e[_0xc1fc('0x27')]['channel']||!utils[_0xc1fc('0x45')](_0x5b1b0e[_0xc1fc('0x27')]['channel'])){throw new db[(_0xc1fc('0x46'))]['ValidationError'](_0xc1fc('0x47'));}var _0x5cae52={};var _0x40078b={};_0x40078b['model']=_['keys'](db[_[_0xc1fc('0x48')](_0x5b1b0e[_0xc1fc('0x27')][_0xc1fc('0x49')][_0xc1fc('0x4a')]())+_0xc1fc('0x4b')][_0xc1fc('0x24')]);_0x40078b['query']=_[_0xc1fc('0x26')](_0x5b1b0e['query']);_0x40078b[_0xc1fc('0x2a')]=_[_0xc1fc('0x2b')](_0x40078b[_0xc1fc('0x25')],_0x40078b[_0xc1fc('0x27')]);_0x5cae52[_0xc1fc('0x2c')]=_[_0xc1fc('0x2b')](_0x40078b[_0xc1fc('0x25')],qs[_0xc1fc('0x2d')](_0x5b1b0e[_0xc1fc('0x27')][_0xc1fc('0x2d')]));_0x5cae52[_0xc1fc('0x2c')]=_0x5cae52[_0xc1fc('0x2c')][_0xc1fc('0x2e')]?_0x5cae52[_0xc1fc('0x2c')]:_0x40078b[_0xc1fc('0x25')];_0x5cae52[_0xc1fc('0x19')]=qs[_0xc1fc('0x19')](_0x5b1b0e[_0xc1fc('0x27')][_0xc1fc('0x19')]);_0x5cae52[_0xc1fc('0x18')]=qs['offset'](_0x5b1b0e[_0xc1fc('0x27')][_0xc1fc('0x18')]);_0x5cae52[_0xc1fc('0x30')]=qs[_0xc1fc('0x31')](_0x5b1b0e[_0xc1fc('0x27')][_0xc1fc('0x31')]);_0x5cae52[_0xc1fc('0x32')]=qs[_0xc1fc('0x2a')](_[_0xc1fc('0x33')](_0x5b1b0e['query'],_0x40078b[_0xc1fc('0x2a')]));_0x5cae52=_[_0xc1fc('0x36')]({},_0x5cae52,_0x5b1b0e[_0xc1fc('0x3f')]);return _0x58b591[_0xc1fc('0x4c')+_[_0xc1fc('0x48')](_0x5b1b0e[_0xc1fc('0x27')][_0xc1fc('0x49')][_0xc1fc('0x4a')]())+_0xc1fc('0x4d')](_0x5cae52);})[_0xc1fc('0x1e')](respondWithResult(_0x2fc45d,null))['catch'](handleError(_0x2fc45d,null));};exports[_0xc1fc('0x4e')]=function(_0x6b5711,_0x48b290,_0x2d1c79){return db[_0xc1fc('0x38')]['findOne']({'where':{'id':_0x6b5711[_0xc1fc('0x3e')]['id']}})[_0xc1fc('0x1e')](function(_0x18e060){if(_0x18e060){if(!_0x6b5711['body']['channel']||!utils[_0xc1fc('0x45')](_0x6b5711['body']['channel'])){throw new db[(_0xc1fc('0x46'))][(_0xc1fc('0x4f'))](_0xc1fc('0x47'));}return _0x18e060['add'+_[_0xc1fc('0x48')](_0x6b5711[_0xc1fc('0x42')][_0xc1fc('0x49')][_0xc1fc('0x4a')]())+_0xc1fc('0x4d')](_0x6b5711[_0xc1fc('0x42')][_0xc1fc('0x50')]);}return null;})[_0xc1fc('0x1e')](handleEntityNotFound(_0x48b290,null))[_0xc1fc('0x1e')](respondWithStatusCode(_0x48b290,null))[_0xc1fc('0x3c')](handleError(_0x48b290,null));};exports[_0xc1fc('0x51')]=function(_0x3640b2,_0x5a6656,_0x409937){return db[_0xc1fc('0x38')][_0xc1fc('0x44')]({'where':{'id':_0x3640b2[_0xc1fc('0x3e')]['id']}})['then'](function(_0x5b2078){if(_0x5b2078){if(!_0x3640b2[_0xc1fc('0x27')][_0xc1fc('0x49')]||!utils[_0xc1fc('0x45')](_0x3640b2['query']['channel'])){throw new db[(_0xc1fc('0x46'))]['ValidationError'](_0xc1fc('0x47'));}return _0x5b2078[_0xc1fc('0x52')+_[_0xc1fc('0x48')](_0x3640b2[_0xc1fc('0x27')][_0xc1fc('0x49')][_0xc1fc('0x4a')]())+_0xc1fc('0x4d')](_0x3640b2[_0xc1fc('0x27')]['ids']);}return null;})[_0xc1fc('0x1e')](handleEntityNotFound(_0x5a6656,null))['then'](respondWithStatusCode(_0x5a6656,null))[_0xc1fc('0x3c')](handleError(_0x5a6656,null));};exports[_0xc1fc('0x53')]=function(_0x23517d,_0x5e73ec,_0xfc1dac){return db[_0xc1fc('0x38')]['find']({'where':{'id':_0x23517d[_0xc1fc('0x3e')]['id']}})[_0xc1fc('0x1e')](handleEntityNotFound(_0x5e73ec,null))[_0xc1fc('0x1e')](function(_0xa37472){if(_0xa37472){return BPromise[_0xc1fc('0x54')]([_0xc1fc('0x55'),_0xc1fc('0x56'),_0xc1fc('0x57'),'sms',_0xc1fc('0x58'),_0xc1fc('0x59')],function(_0x29e6b2){return _0xa37472[_0xc1fc('0x4c')+_[_0xc1fc('0x48')](_0x29e6b2)+_0xc1fc('0x4d')]({'attributes':['id',_0xc1fc('0x22')]})[_0xc1fc('0x1e')](function(_0x449b86){return BPromise[_0xc1fc('0x54')](_0x449b86,function(_0x1bf138){return _0x1bf138[_0xc1fc('0x53')](_0x23517d[_0xc1fc('0x42')][_0xc1fc('0x50')])[_0xc1fc('0x1e')](function(){if(_0x29e6b2===_0xc1fc('0x55')){return db[_0xc1fc('0x5a')][_0xc1fc('0x5b')]({'where':{'id':_0x23517d['body'][_0xc1fc('0x50')]},'attributes':['id','name',_0xc1fc('0x5c'),_0xc1fc('0x5d')],'raw':!![]});}})[_0xc1fc('0x1e')](function(_0x3865d3){if(_0x29e6b2===_0xc1fc('0x55')){return BPromise[_0xc1fc('0x54')](_0x3865d3,function(_0x10d947){return db[_0xc1fc('0x5e')]['upsert']({'membername':_0x10d947[_0xc1fc('0x22')],'UserId':_0x10d947['id'],'queue_name':_0x1bf138[_0xc1fc('0x22')],'VoiceQueueId':_0x1bf138['id'],'interface':util['format'](_0xc1fc('0x5f'),_0xc1fc('0x60'),_0x10d947[_0xc1fc('0x22')]),'paused':_0x10d947[_0xc1fc('0x5d')]||![],'penalty':0x0});});}});});})['then'](function(){return _0xa37472;});})['then'](function(){return _0xa37472;});}})['then'](function(_0x43e4de){if(_0x43e4de){return _0x43e4de[_0xc1fc('0x53')](_0x23517d[_0xc1fc('0x42')][_0xc1fc('0x50')],_['omit'](_0x23517d[_0xc1fc('0x42')],['ids','id'])||{})[_0xc1fc('0x61')](function(_0x2903b9){for(var _0x40f81d=0x0;_0x40f81d<_0x23517d[_0xc1fc('0x42')][_0xc1fc('0x50')]['length'];_0x40f81d+=0x1){socket['emit'](_0xc1fc('0x62'),{'UserId':_0x23517d[_0xc1fc('0x42')][_0xc1fc('0x50')][_0x40f81d],'TeamId':_0x23517d[_0xc1fc('0x3e')]['id']});}return _0x2903b9;});}})[_0xc1fc('0x1e')](respondWithResult(_0x5e73ec,null))['catch'](handleError(_0x5e73ec,null));};exports[_0xc1fc('0x63')]=function(_0x250acc,_0x330fe8,_0x59abd7){var _0x22225d;return db[_0xc1fc('0x38')][_0xc1fc('0x40')]({'where':{'id':_0x250acc[_0xc1fc('0x3e')]['id']}})[_0xc1fc('0x1e')](handleEntityNotFound(_0x330fe8,null))[_0xc1fc('0x1e')](function(_0x399435){if(_0x399435){return BPromise[_0xc1fc('0x54')]([_0xc1fc('0x55'),_0xc1fc('0x56'),_0xc1fc('0x57'),'sms',_0xc1fc('0x58'),_0xc1fc('0x59')],function(_0x15630c){return _0x399435[_0xc1fc('0x4c')+_[_0xc1fc('0x48')](_0x15630c)+'Queues']({'attributes':['id','name']})['then'](function(_0x3714ba){return BPromise[_0xc1fc('0x54')](_0x3714ba,function(_0x4ac2a3){return _0x4ac2a3['removeAgents'](_0x250acc['query'][_0xc1fc('0x50')])['then'](function(){if(_0x15630c==='voice'){return db[_0xc1fc('0x5e')][_0xc1fc('0x1f')]({'where':{'VoiceQueueId':_0x4ac2a3['id'],'UserId':_0x250acc['query'][_0xc1fc('0x50')]}});}});});})[_0xc1fc('0x1e')](function(){return _0x399435;});})[_0xc1fc('0x1e')](function(){return _0x399435;});}})['then'](function(_0x3280c8){if(_0x3280c8){return _0x3280c8['removeAgents'](_0x250acc[_0xc1fc('0x27')][_0xc1fc('0x50')])[_0xc1fc('0x1e')](function(_0x2b368b){if(_[_0xc1fc('0x64')](_0x250acc[_0xc1fc('0x27')][_0xc1fc('0x50')])){for(var _0x1a780a=0x0;_0x1a780a<_0x250acc[_0xc1fc('0x27')][_0xc1fc('0x50')][_0xc1fc('0x2e')];_0x1a780a+=0x1){socket['emit'](_0xc1fc('0x65'),{'UserId':_0x250acc['query'][_0xc1fc('0x50')][_0x1a780a],'TeamId':_0x250acc[_0xc1fc('0x3e')]['id']});}}else{socket['emit'](_0xc1fc('0x65'),{'UserId':_0x250acc[_0xc1fc('0x27')][_0xc1fc('0x50')],'TeamId':_0x250acc[_0xc1fc('0x3e')]['id']});}});}})[_0xc1fc('0x1e')](respondWithStatusCode(_0x330fe8,null))[_0xc1fc('0x3c')](handleError(_0x330fe8,null));};exports[_0xc1fc('0x66')]=function(_0x48d1ca,_0x24595f,_0x43ce88){var _0x3a252e={};var _0x1c9069={};var _0x5aac40;var _0x4355da;return db['Team'][_0xc1fc('0x44')]({'where':{'id':_0x48d1ca[_0xc1fc('0x3e')]['id']}})[_0xc1fc('0x1e')](handleEntityNotFound(_0x24595f,null))[_0xc1fc('0x1e')](function(_0x4052e6){if(_0x4052e6){_0x5aac40=_0x4052e6;_0x1c9069['model']=_[_0xc1fc('0x26')](db[_0xc1fc('0x5a')][_0xc1fc('0x24')]);_0x1c9069[_0xc1fc('0x27')]=_[_0xc1fc('0x26')](_0x48d1ca['query']);_0x1c9069[_0xc1fc('0x2a')]=_['intersection'](_0x1c9069['model'],_0x1c9069[_0xc1fc('0x27')]);_0x3a252e[_0xc1fc('0x2c')]=_['intersection'](_0x1c9069['model'],qs[_0xc1fc('0x2d')](_0x48d1ca[_0xc1fc('0x27')][_0xc1fc('0x2d')]));_0x3a252e[_0xc1fc('0x2c')]=_0x3a252e[_0xc1fc('0x2c')][_0xc1fc('0x2e')]?_0x3a252e[_0xc1fc('0x2c')]:_0x1c9069[_0xc1fc('0x25')];_0x3a252e[_0xc1fc('0x30')]=qs[_0xc1fc('0x31')](_0x48d1ca[_0xc1fc('0x27')][_0xc1fc('0x31')]);_0x3a252e[_0xc1fc('0x32')]=qs['filters'](_[_0xc1fc('0x33')](_0x48d1ca['query'],_0x1c9069[_0xc1fc('0x2a')]));if(_0x48d1ca[_0xc1fc('0x27')][_0xc1fc('0x37')]){_0x3a252e[_0xc1fc('0x32')]=_[_0xc1fc('0x36')](_0x3a252e['where'],{'$or':_[_0xc1fc('0x67')](_0x3a252e[_0xc1fc('0x2c')],function(_0x2a4e4a){var _0x4cfe27={};_0x4cfe27[_0x2a4e4a]={'$like':'%'+_0x48d1ca[_0xc1fc('0x27')][_0xc1fc('0x37')]+'%'};return _0x4cfe27;})});}_0x3a252e=_[_0xc1fc('0x36')]({},_0x3a252e,_0x48d1ca[_0xc1fc('0x3f')]);return _0x5aac40[_0xc1fc('0x66')](_0x3a252e);}})[_0xc1fc('0x1e')](function(_0x4139d4){if(_0x4139d4){_0x4355da=_0x4139d4['length'];if(!_0x48d1ca[_0xc1fc('0x27')]['hasOwnProperty'](_0xc1fc('0x2f'))){_0x3a252e[_0xc1fc('0x19')]=qs[_0xc1fc('0x19')](_0x48d1ca['query'][_0xc1fc('0x19')]);_0x3a252e[_0xc1fc('0x18')]=qs[_0xc1fc('0x18')](_0x48d1ca[_0xc1fc('0x27')]['offset']);}return _0x5aac40[_0xc1fc('0x66')](_0x3a252e);}})['then'](function(_0x4e31ec){if(_0x4e31ec){return _0x4e31ec?{'count':_0x4355da,'rows':_0x4e31ec}:null;}})[_0xc1fc('0x1e')](respondWithResult(_0x24595f,null))[_0xc1fc('0x3c')](handleError(_0x24595f,null));}; \ No newline at end of file +var _0xaa37=['channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','toLowerCase','Queue','rawAttributes','order','capitalize','findOne','ids','addAgents','voice','chat','mail','fax','openchannel','Queues','each','User','loginInPause','voicePause','UserVoiceQueueRt','format','%s/%s','SIP','omit','emit','userTeam:save','get','removeAgents','isArray','userTeam:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','sendStatus','end','json','count','offset','status','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','Team','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','params','find','create','body'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xaa37[_0x53ccf2];return _0x5a2964;};'use strict';var jsonpatch=require(_0x7aa3('0x0'));var rp=require(_0x7aa3('0x1'));var moment=require(_0x7aa3('0x2'));var BPromise=require(_0x7aa3('0x3'));var Mustache=require('mustache');var util=require(_0x7aa3('0x4'));var path=require(_0x7aa3('0x5'));var sox=require(_0x7aa3('0x6'));var csv=require(_0x7aa3('0x7'));var ejs=require(_0x7aa3('0x8'));var fs=require('fs');var _=require(_0x7aa3('0x9'));var squel=require(_0x7aa3('0xa'));var crypto=require('crypto');var jsforce=require(_0x7aa3('0xb'));var deskjs=require(_0x7aa3('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7aa3('0xd'));var Papa=require(_0x7aa3('0xe'));var qs=require(_0x7aa3('0xf'));var logger=require('../../config/logger')(_0x7aa3('0x10'));var utils=require(_0x7aa3('0x11'));var config=require(_0x7aa3('0x12'));var db=require(_0x7aa3('0x13'))['db'];var socket=require(_0x7aa3('0x14'))({'host':_0x7aa3('0x15'),'port':0x18eb});require('./team.socket')['register'](socket);function respondWithStatusCode(_0x3356b9,_0x509eb9){_0x509eb9=_0x509eb9||0xcc;return function(_0x1a4198){if(_0x1a4198){return _0x3356b9[_0x7aa3('0x16')](_0x509eb9);}return _0x3356b9['status'](_0x509eb9)[_0x7aa3('0x17')]();};}function respondWithResult(_0xc11cd3,_0x552ec9){_0x552ec9=_0x552ec9||0xc8;return function(_0x5a6751){if(_0x5a6751){return _0xc11cd3['status'](_0x552ec9)[_0x7aa3('0x18')](_0x5a6751);}};}function respondWithFilteredResult(_0x20f370,_0x1c53a9){return function(_0x451fe4){if(_0x451fe4){var _0xd0a441=_0x451fe4[_0x7aa3('0x19')],_0x4c051e=_0x1c53a9[_0x7aa3('0x1a')],_0x235040=_0x1c53a9['offset']+_0x1c53a9['limit'],_0x3df7e8;if(_0x235040>=_0xd0a441){_0x235040=_0xd0a441;_0x3df7e8=0xc8;}else{_0x3df7e8=0xce;}_0x20f370[_0x7aa3('0x1b')](_0x3df7e8);return _0x20f370['set'](_0x7aa3('0x1c'),_0x4c051e+'-'+_0x235040+'/'+_0xd0a441)[_0x7aa3('0x18')](_0x451fe4);}return null;};}function patchUpdates(_0x4dcefa){return function(_0x11ded1){try{jsonpatch[_0x7aa3('0x1d')](_0x11ded1,_0x4dcefa,!![]);}catch(_0x1a4f95){return BPromise[_0x7aa3('0x1e')](_0x1a4f95);}return _0x11ded1[_0x7aa3('0x1f')]();};}function saveUpdates(_0x5994b6,_0x22e93b){return function(_0x266529){if(_0x266529){return _0x266529[_0x7aa3('0x20')](_0x5994b6)[_0x7aa3('0x21')](function(_0x2360d1){return _0x2360d1;});}return null;};}function removeEntity(_0xa57443,_0x5a7c65){return function(_0x329d81){if(_0x329d81){return _0x329d81[_0x7aa3('0x22')]()[_0x7aa3('0x21')](function(){_0xa57443[_0x7aa3('0x1b')](0xcc)[_0x7aa3('0x17')]();});}};}function handleEntityNotFound(_0x49a566,_0x41a7b4){return function(_0x473160){if(!_0x473160){_0x49a566[_0x7aa3('0x16')](0x194);}return _0x473160;};}function handleError(_0x3e5653,_0x3b382d){_0x3b382d=_0x3b382d||0x1f4;return function(_0x10887d){logger[_0x7aa3('0x23')](_0x10887d[_0x7aa3('0x24')]);if(_0x10887d[_0x7aa3('0x25')]){delete _0x10887d[_0x7aa3('0x25')];}_0x3e5653[_0x7aa3('0x1b')](_0x3b382d)[_0x7aa3('0x26')](_0x10887d);};}exports[_0x7aa3('0x27')]=function(_0x49b7b0,_0x43396f){var _0x2e0ee3={},_0x3c1422={},_0x32e551={'count':0x0,'rows':[]};var _0x183ffc=db[_0x7aa3('0x28')]['rawAttributes'];_0x3c1422[_0x7aa3('0x29')]=_[_0x7aa3('0x2a')](_0x183ffc);var _0x447c9f={'dateStart':_0x49b7b0['query'][_0x7aa3('0x2b')],'dateEnd':_0x49b7b0[_0x7aa3('0x2c')]['dateEnd']};delete _0x49b7b0[_0x7aa3('0x2c')][_0x7aa3('0x2b')];delete _0x49b7b0[_0x7aa3('0x2c')][_0x7aa3('0x2d')];_0x3c1422[_0x7aa3('0x2c')]=_[_0x7aa3('0x2a')](_0x49b7b0[_0x7aa3('0x2c')]);_0x3c1422[_0x7aa3('0x2e')]=_[_0x7aa3('0x2f')](_0x3c1422[_0x7aa3('0x29')],_0x3c1422[_0x7aa3('0x2c')]);_0x2e0ee3[_0x7aa3('0x30')]=_[_0x7aa3('0x2f')](_0x3c1422[_0x7aa3('0x29')],qs[_0x7aa3('0x31')](_0x49b7b0[_0x7aa3('0x2c')][_0x7aa3('0x31')]));_0x2e0ee3[_0x7aa3('0x30')]=_0x2e0ee3[_0x7aa3('0x30')][_0x7aa3('0x32')]?_0x2e0ee3[_0x7aa3('0x30')]:_0x3c1422['model'];if(!_0x49b7b0[_0x7aa3('0x2c')][_0x7aa3('0x33')](_0x7aa3('0x34'))){_0x2e0ee3[_0x7aa3('0x35')]=qs[_0x7aa3('0x35')](_0x49b7b0[_0x7aa3('0x2c')][_0x7aa3('0x35')]);_0x2e0ee3[_0x7aa3('0x1a')]=qs[_0x7aa3('0x1a')](_0x49b7b0[_0x7aa3('0x2c')][_0x7aa3('0x1a')]);}_0x2e0ee3['order']=qs[_0x7aa3('0x36')](_0x49b7b0[_0x7aa3('0x2c')][_0x7aa3('0x36')]);_0x2e0ee3[_0x7aa3('0x37')]=qs[_0x7aa3('0x2e')](_[_0x7aa3('0x38')](_0x49b7b0[_0x7aa3('0x2c')],_0x3c1422[_0x7aa3('0x2e')]));if(_0x447c9f[_0x7aa3('0x2b')]){if(_0x447c9f[_0x7aa3('0x2d')]){_0x447c9f[_0x7aa3('0x2d')]=moment(_0x447c9f[_0x7aa3('0x2d')])[_0x7aa3('0x39')](0x1,_0x7aa3('0x3a'));}else{_0x447c9f['dateEnd']=moment(_0x447c9f[_0x7aa3('0x2b')])[_0x7aa3('0x39')](0x1,_0x7aa3('0x3a'));}_[_0x7aa3('0x3b')](_0x2e0ee3['where'],{'createdAt':{'$gte':_0x447c9f[_0x7aa3('0x2b')],'$lte':_0x447c9f['dateEnd']}});}if(_0x49b7b0[_0x7aa3('0x2c')][_0x7aa3('0x3c')]){_0x2e0ee3[_0x7aa3('0x37')]=_[_0x7aa3('0x3b')](_0x2e0ee3[_0x7aa3('0x37')],{'$or':_[_0x7aa3('0x3d')](_0x2e0ee3[_0x7aa3('0x30')],function(_0x421a4f){var _0x839ecf={};_0x839ecf[_0x421a4f]={'$like':'%'+_0x49b7b0[_0x7aa3('0x2c')]['filter']+'%'};return _0x839ecf;})});}_0x2e0ee3=_[_0x7aa3('0x3b')]({},_0x2e0ee3,_0x49b7b0[_0x7aa3('0x3e')]);var _0x119098={'where':_0x2e0ee3[_0x7aa3('0x37')]};return db[_0x7aa3('0x28')][_0x7aa3('0x19')](_0x119098)[_0x7aa3('0x21')](function(_0x3f0fcf){_0x32e551[_0x7aa3('0x19')]=_0x3f0fcf;if(_0x49b7b0[_0x7aa3('0x2c')][_0x7aa3('0x3f')]){_0x2e0ee3[_0x7aa3('0x40')]=[{'all':!![]}];}return db[_0x7aa3('0x28')][_0x7aa3('0x41')](_0x2e0ee3);})['then'](function(_0x297d9f){_0x32e551[_0x7aa3('0x42')]=_0x297d9f;return _0x32e551;})['then'](respondWithFilteredResult(_0x43396f,_0x2e0ee3))[_0x7aa3('0x43')](handleError(_0x43396f,null));};exports[_0x7aa3('0x44')]=function(_0x4f8a98,_0x7ee164){var _0x341c85={'raw':![],'where':{'id':_0x4f8a98[_0x7aa3('0x45')]['id']}},_0x24b42e={};_0x24b42e['model']=_['keys'](db[_0x7aa3('0x28')]['rawAttributes']);_0x24b42e[_0x7aa3('0x2c')]=_['keys'](_0x4f8a98['query']);_0x24b42e[_0x7aa3('0x2e')]=_[_0x7aa3('0x2f')](_0x24b42e[_0x7aa3('0x29')],_0x24b42e[_0x7aa3('0x2c')]);_0x341c85[_0x7aa3('0x30')]=_['intersection'](_0x24b42e[_0x7aa3('0x29')],qs[_0x7aa3('0x31')](_0x4f8a98['query'][_0x7aa3('0x31')]));_0x341c85[_0x7aa3('0x30')]=_0x341c85[_0x7aa3('0x30')]['length']?_0x341c85[_0x7aa3('0x30')]:_0x24b42e[_0x7aa3('0x29')];if(_0x4f8a98['query'][_0x7aa3('0x3f')]){_0x341c85[_0x7aa3('0x40')]=[{'all':!![]}];}_0x341c85=_['merge']({},_0x341c85,_0x4f8a98['options']);return db[_0x7aa3('0x28')][_0x7aa3('0x46')](_0x341c85)[_0x7aa3('0x21')](handleEntityNotFound(_0x7ee164,null))[_0x7aa3('0x21')](respondWithResult(_0x7ee164,null))['catch'](handleError(_0x7ee164,null));};exports['create']=function(_0x41cbac,_0x1d9ace){return db[_0x7aa3('0x28')][_0x7aa3('0x47')](_0x41cbac['body'],{})['then'](respondWithResult(_0x1d9ace,0xc9))['catch'](handleError(_0x1d9ace,null));};exports[_0x7aa3('0x20')]=function(_0x2a3527,_0x2bfab8){if(_0x2a3527['body']['id']){delete _0x2a3527[_0x7aa3('0x48')]['id'];}return db[_0x7aa3('0x28')][_0x7aa3('0x46')]({'where':{'id':_0x2a3527[_0x7aa3('0x45')]['id']}})[_0x7aa3('0x21')](handleEntityNotFound(_0x2bfab8,null))[_0x7aa3('0x21')](saveUpdates(_0x2a3527['body'],null))[_0x7aa3('0x21')](respondWithResult(_0x2bfab8,null))['catch'](handleError(_0x2bfab8,null));};exports['destroy']=function(_0x5089c7,_0x58a8ca){return db[_0x7aa3('0x28')][_0x7aa3('0x46')]({'where':{'id':_0x5089c7['params']['id']}})[_0x7aa3('0x21')](handleEntityNotFound(_0x58a8ca,null))[_0x7aa3('0x21')](removeEntity(_0x58a8ca,null))[_0x7aa3('0x43')](handleError(_0x58a8ca,null));};exports['getQueues']=function(_0x49d4ed,_0x439bb1,_0x5a09dd){return db[_0x7aa3('0x28')]['findOne']({'where':{'id':_0x49d4ed['params']['id']}})['then'](handleEntityNotFound(_0x439bb1,null))['then'](function(_0x267dfc){if(!_0x49d4ed[_0x7aa3('0x2c')][_0x7aa3('0x49')]||!utils[_0x7aa3('0x4a')](_0x49d4ed['query'][_0x7aa3('0x49')])){throw new db[(_0x7aa3('0x4b'))][(_0x7aa3('0x4c'))](_0x7aa3('0x4d'));}var _0x2ac633={};var _0x572f97={};_0x572f97[_0x7aa3('0x29')]=_[_0x7aa3('0x2a')](db[_['capitalize'](_0x49d4ed[_0x7aa3('0x2c')][_0x7aa3('0x49')][_0x7aa3('0x4e')]())+_0x7aa3('0x4f')][_0x7aa3('0x50')]);_0x572f97[_0x7aa3('0x2c')]=_[_0x7aa3('0x2a')](_0x49d4ed[_0x7aa3('0x2c')]);_0x572f97['filters']=_[_0x7aa3('0x2f')](_0x572f97[_0x7aa3('0x29')],_0x572f97['query']);_0x2ac633[_0x7aa3('0x30')]=_[_0x7aa3('0x2f')](_0x572f97[_0x7aa3('0x29')],qs[_0x7aa3('0x31')](_0x49d4ed[_0x7aa3('0x2c')][_0x7aa3('0x31')]));_0x2ac633[_0x7aa3('0x30')]=_0x2ac633[_0x7aa3('0x30')]['length']?_0x2ac633[_0x7aa3('0x30')]:_0x572f97[_0x7aa3('0x29')];_0x2ac633[_0x7aa3('0x35')]=qs[_0x7aa3('0x35')](_0x49d4ed[_0x7aa3('0x2c')][_0x7aa3('0x35')]);_0x2ac633[_0x7aa3('0x1a')]=qs[_0x7aa3('0x1a')](_0x49d4ed[_0x7aa3('0x2c')][_0x7aa3('0x1a')]);_0x2ac633[_0x7aa3('0x51')]=qs[_0x7aa3('0x36')](_0x49d4ed[_0x7aa3('0x2c')][_0x7aa3('0x36')]);_0x2ac633['where']=qs['filters'](_[_0x7aa3('0x38')](_0x49d4ed['query'],_0x572f97[_0x7aa3('0x2e')]));_0x2ac633=_['merge']({},_0x2ac633,_0x49d4ed['options']);return _0x267dfc['get'+_[_0x7aa3('0x52')](_0x49d4ed[_0x7aa3('0x2c')][_0x7aa3('0x49')][_0x7aa3('0x4e')]())+'Queues'](_0x2ac633);})[_0x7aa3('0x21')](respondWithResult(_0x439bb1,null))['catch'](handleError(_0x439bb1,null));};exports['addQueues']=function(_0x3bfbdd,_0x22db63,_0x3fbc24){return db[_0x7aa3('0x28')][_0x7aa3('0x53')]({'where':{'id':_0x3bfbdd[_0x7aa3('0x45')]['id']}})[_0x7aa3('0x21')](function(_0x16724c){if(_0x16724c){if(!_0x3bfbdd[_0x7aa3('0x48')]['channel']||!utils[_0x7aa3('0x4a')](_0x3bfbdd[_0x7aa3('0x48')][_0x7aa3('0x49')])){throw new db[(_0x7aa3('0x4b'))][(_0x7aa3('0x4c'))]('Unknown\x20channel');}return _0x16724c[_0x7aa3('0x39')+_['capitalize'](_0x3bfbdd['body'][_0x7aa3('0x49')][_0x7aa3('0x4e')]())+'Queues'](_0x3bfbdd[_0x7aa3('0x48')][_0x7aa3('0x54')]);}return null;})[_0x7aa3('0x21')](handleEntityNotFound(_0x22db63,null))['then'](respondWithStatusCode(_0x22db63,null))[_0x7aa3('0x43')](handleError(_0x22db63,null));};exports['removeQueues']=function(_0x2307ee,_0x412324,_0x48d2f0){return db[_0x7aa3('0x28')][_0x7aa3('0x53')]({'where':{'id':_0x2307ee[_0x7aa3('0x45')]['id']}})[_0x7aa3('0x21')](function(_0x584832){if(_0x584832){if(!_0x2307ee[_0x7aa3('0x2c')][_0x7aa3('0x49')]||!utils[_0x7aa3('0x4a')](_0x2307ee[_0x7aa3('0x2c')]['channel'])){throw new db[(_0x7aa3('0x4b'))]['ValidationError'](_0x7aa3('0x4d'));}return _0x584832['remove'+_[_0x7aa3('0x52')](_0x2307ee[_0x7aa3('0x2c')][_0x7aa3('0x49')][_0x7aa3('0x4e')]())+'Queues'](_0x2307ee['query']['ids']);}return null;})['then'](handleEntityNotFound(_0x412324,null))[_0x7aa3('0x21')](respondWithStatusCode(_0x412324,null))[_0x7aa3('0x43')](handleError(_0x412324,null));};exports[_0x7aa3('0x55')]=function(_0x27d5de,_0x177273,_0x187959){return db[_0x7aa3('0x28')][_0x7aa3('0x46')]({'where':{'id':_0x27d5de[_0x7aa3('0x45')]['id']}})['then'](handleEntityNotFound(_0x177273,null))['then'](function(_0x675395){if(_0x675395){return BPromise['each']([_0x7aa3('0x56'),_0x7aa3('0x57'),_0x7aa3('0x58'),'sms',_0x7aa3('0x59'),_0x7aa3('0x5a')],function(_0x490800){return _0x675395['get'+_[_0x7aa3('0x52')](_0x490800)+_0x7aa3('0x5b')]({'attributes':['id',_0x7aa3('0x25')]})[_0x7aa3('0x21')](function(_0x34aa41){return BPromise[_0x7aa3('0x5c')](_0x34aa41,function(_0x1e2e4f){return _0x1e2e4f[_0x7aa3('0x55')](_0x27d5de[_0x7aa3('0x48')][_0x7aa3('0x54')])[_0x7aa3('0x21')](function(){if(_0x490800===_0x7aa3('0x56')){return db[_0x7aa3('0x5d')][_0x7aa3('0x41')]({'where':{'id':_0x27d5de[_0x7aa3('0x48')]['ids']},'attributes':['id',_0x7aa3('0x25'),_0x7aa3('0x5e'),_0x7aa3('0x5f')],'raw':!![]});}})[_0x7aa3('0x21')](function(_0x1e0db2){if(_0x490800==='voice'){return BPromise[_0x7aa3('0x5c')](_0x1e0db2,function(_0x4313cb){return db[_0x7aa3('0x60')]['upsert']({'membername':_0x4313cb[_0x7aa3('0x25')],'UserId':_0x4313cb['id'],'queue_name':_0x1e2e4f['name'],'VoiceQueueId':_0x1e2e4f['id'],'interface':util[_0x7aa3('0x61')](_0x7aa3('0x62'),_0x7aa3('0x63'),_0x4313cb[_0x7aa3('0x25')]),'paused':_0x4313cb[_0x7aa3('0x5f')]||![],'penalty':0x0});});}});});})[_0x7aa3('0x21')](function(){return _0x675395;});})[_0x7aa3('0x21')](function(){return _0x675395;});}})[_0x7aa3('0x21')](function(_0xa0b103){if(_0xa0b103){return _0xa0b103[_0x7aa3('0x55')](_0x27d5de['body'][_0x7aa3('0x54')],_[_0x7aa3('0x64')](_0x27d5de[_0x7aa3('0x48')],[_0x7aa3('0x54'),'id'])||{})['spread'](function(_0x41f0f4){for(var _0x419d70=0x0;_0x419d70<_0x27d5de[_0x7aa3('0x48')][_0x7aa3('0x54')][_0x7aa3('0x32')];_0x419d70+=0x1){socket[_0x7aa3('0x65')](_0x7aa3('0x66'),{'UserId':_0x27d5de[_0x7aa3('0x48')][_0x7aa3('0x54')][_0x419d70],'TeamId':_0x27d5de[_0x7aa3('0x45')]['id']});}return _0x41f0f4;});}})[_0x7aa3('0x21')](respondWithResult(_0x177273,null))[_0x7aa3('0x43')](handleError(_0x177273,null));};exports['removeAgents']=function(_0x75ad3a,_0x22623e,_0x48dcce){var _0x1d8a57;return db['Team'][_0x7aa3('0x46')]({'where':{'id':_0x75ad3a[_0x7aa3('0x45')]['id']}})[_0x7aa3('0x21')](handleEntityNotFound(_0x22623e,null))[_0x7aa3('0x21')](function(_0x517a99){if(_0x517a99){return BPromise[_0x7aa3('0x5c')]([_0x7aa3('0x56'),'chat','mail','sms',_0x7aa3('0x59'),'openchannel'],function(_0x310a67){return _0x517a99[_0x7aa3('0x67')+_[_0x7aa3('0x52')](_0x310a67)+_0x7aa3('0x5b')]({'attributes':['id','name']})['then'](function(_0x2e7d5e){return BPromise[_0x7aa3('0x5c')](_0x2e7d5e,function(_0x285c34){return _0x285c34[_0x7aa3('0x68')](_0x75ad3a[_0x7aa3('0x2c')]['ids'])[_0x7aa3('0x21')](function(){if(_0x310a67===_0x7aa3('0x56')){return db['UserVoiceQueueRt'][_0x7aa3('0x22')]({'where':{'VoiceQueueId':_0x285c34['id'],'UserId':_0x75ad3a[_0x7aa3('0x2c')][_0x7aa3('0x54')]}});}});});})[_0x7aa3('0x21')](function(){return _0x517a99;});})[_0x7aa3('0x21')](function(){return _0x517a99;});}})['then'](function(_0x5288c6){if(_0x5288c6){return _0x5288c6['removeAgents'](_0x75ad3a[_0x7aa3('0x2c')]['ids'])['then'](function(_0x5089fa){if(_[_0x7aa3('0x69')](_0x75ad3a[_0x7aa3('0x2c')][_0x7aa3('0x54')])){for(var _0x5a5a88=0x0;_0x5a5a88<_0x75ad3a[_0x7aa3('0x2c')][_0x7aa3('0x54')][_0x7aa3('0x32')];_0x5a5a88+=0x1){socket[_0x7aa3('0x65')](_0x7aa3('0x6a'),{'UserId':_0x75ad3a['query'][_0x7aa3('0x54')][_0x5a5a88],'TeamId':_0x75ad3a[_0x7aa3('0x45')]['id']});}}else{socket[_0x7aa3('0x65')](_0x7aa3('0x6a'),{'UserId':_0x75ad3a[_0x7aa3('0x2c')][_0x7aa3('0x54')],'TeamId':_0x75ad3a[_0x7aa3('0x45')]['id']});}});}})[_0x7aa3('0x21')](respondWithStatusCode(_0x22623e,null))[_0x7aa3('0x43')](handleError(_0x22623e,null));};exports['getAgents']=function(_0x4e67d5,_0xb15dc0,_0x1ed982){var _0x229d40={};var _0x2755e2={};var _0x2bc37a;var _0xed3159;return db[_0x7aa3('0x28')][_0x7aa3('0x53')]({'where':{'id':_0x4e67d5[_0x7aa3('0x45')]['id']}})[_0x7aa3('0x21')](handleEntityNotFound(_0xb15dc0,null))[_0x7aa3('0x21')](function(_0x50f320){if(_0x50f320){_0x2bc37a=_0x50f320;_0x2755e2[_0x7aa3('0x29')]=_[_0x7aa3('0x2a')](db['User'][_0x7aa3('0x50')]);_0x2755e2[_0x7aa3('0x2c')]=_[_0x7aa3('0x2a')](_0x4e67d5[_0x7aa3('0x2c')]);_0x2755e2[_0x7aa3('0x2e')]=_[_0x7aa3('0x2f')](_0x2755e2['model'],_0x2755e2['query']);_0x229d40['attributes']=_[_0x7aa3('0x2f')](_0x2755e2[_0x7aa3('0x29')],qs[_0x7aa3('0x31')](_0x4e67d5[_0x7aa3('0x2c')][_0x7aa3('0x31')]));_0x229d40[_0x7aa3('0x30')]=_0x229d40[_0x7aa3('0x30')][_0x7aa3('0x32')]?_0x229d40[_0x7aa3('0x30')]:_0x2755e2[_0x7aa3('0x29')];_0x229d40[_0x7aa3('0x51')]=qs[_0x7aa3('0x36')](_0x4e67d5[_0x7aa3('0x2c')][_0x7aa3('0x36')]);_0x229d40['where']=qs[_0x7aa3('0x2e')](_['pick'](_0x4e67d5['query'],_0x2755e2['filters']));if(_0x4e67d5[_0x7aa3('0x2c')]['filter']){_0x229d40[_0x7aa3('0x37')]=_[_0x7aa3('0x3b')](_0x229d40[_0x7aa3('0x37')],{'$or':_[_0x7aa3('0x3d')](_0x229d40[_0x7aa3('0x30')],function(_0xee793d){var _0xdb9897={};_0xdb9897[_0xee793d]={'$like':'%'+_0x4e67d5['query'][_0x7aa3('0x3c')]+'%'};return _0xdb9897;})});}_0x229d40=_[_0x7aa3('0x3b')]({},_0x229d40,_0x4e67d5[_0x7aa3('0x3e')]);return _0x2bc37a[_0x7aa3('0x6b')](_0x229d40);}})[_0x7aa3('0x21')](function(_0x1e2c88){if(_0x1e2c88){_0xed3159=_0x1e2c88[_0x7aa3('0x32')];if(!_0x4e67d5[_0x7aa3('0x2c')][_0x7aa3('0x33')](_0x7aa3('0x34'))){_0x229d40[_0x7aa3('0x35')]=qs['limit'](_0x4e67d5[_0x7aa3('0x2c')][_0x7aa3('0x35')]);_0x229d40[_0x7aa3('0x1a')]=qs['offset'](_0x4e67d5[_0x7aa3('0x2c')][_0x7aa3('0x1a')]);}return _0x2bc37a[_0x7aa3('0x6b')](_0x229d40);}})['then'](function(_0x35718f){if(_0x35718f){return _0x35718f?{'count':_0xed3159,'rows':_0x35718f}:null;}})[_0x7aa3('0x21')](respondWithResult(_0xb15dc0,null))[_0x7aa3('0x43')](handleError(_0xb15dc0,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index d9f6615..a248c23 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 _0x5fcf=['hook','exports','save','update','remove','emit','hasOwnProperty'];(function(_0xac0657,_0x181242){var _0x436796=function(_0xc9ce7c){while(--_0xc9ce7c){_0xac0657['push'](_0xac0657['shift']());}};_0x436796(++_0x181242);}(_0x5fcf,0x159));var _0xf5fc=function(_0x47b229,_0x2ac804){_0x47b229=_0x47b229-0x0;var _0x144b64=_0x5fcf[_0x47b229];return _0x144b64;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf5fc('0x0'),'afterUpdate':_0xf5fc('0x1'),'afterDestroy':_0xf5fc('0x2')};function emitEvent(_0x1842ed){return function(_0x1c61bc,_0x21e8d0,_0x44ca22){TeamEvents[_0xf5fc('0x3')](_0x1842ed+':'+_0x1c61bc['id'],_0x1c61bc);TeamEvents[_0xf5fc('0x3')](_0x1842ed,_0x1c61bc);_0x44ca22(null);};}for(var e in events){if(events[_0xf5fc('0x4')](e)){var event=events[e];Team[_0xf5fc('0x5')](e,emitEvent(event));}}module[_0xf5fc('0x6')]=TeamEvents; \ No newline at end of file +var _0xf26b=['emit','hasOwnProperty','hook','events','../../mysqldb','save','update','remove'];(function(_0x3e17ac,_0x14984e){var _0x1c299b=function(_0x529e87){while(--_0x529e87){_0x3e17ac['push'](_0x3e17ac['shift']());}};_0x1c299b(++_0x14984e);}(_0xf26b,0x133));var _0xbf26=function(_0x53d8e6,_0x30de3e){_0x53d8e6=_0x53d8e6-0x0;var _0x8b5fe2=_0xf26b[_0x53d8e6];return _0x8b5fe2;};'use strict';var EventEmitter=require(_0xbf26('0x0'));var Team=require(_0xbf26('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbf26('0x2'),'afterUpdate':_0xbf26('0x3'),'afterDestroy':_0xbf26('0x4')};function emitEvent(_0x7f9b76){return function(_0x29dd15,_0x4133f9,_0xb3ef5b){TeamEvents[_0xbf26('0x5')](_0x7f9b76+':'+_0x29dd15['id'],_0x29dd15);TeamEvents['emit'](_0x7f9b76,_0x29dd15);_0xb3ef5b(null);};}for(var e in events){if(events[_0xbf26('0x6')](e)){var event=events[e];Team[_0xbf26('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index b87bd83..97a3d06 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 _0x70e0=['./team.attributes','exports','Team','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x46555d,_0x283c2b){var _0xb78fde=function(_0xa7335a){while(--_0xa7335a){_0x46555d['push'](_0x46555d['shift']());}};_0xb78fde(++_0x283c2b);}(_0x70e0,0x17b));var _0x070e=function(_0x36ceb3,_0x361237){_0x36ceb3=_0x36ceb3-0x0;var _0x5726db=_0x70e0[_0x36ceb3];return _0x5726db;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var attributes=require(_0x070e('0x5'));module[_0x070e('0x6')]=function(_0x5c90fc,_0x7bce9b){return _0x5c90fc['define'](_0x070e('0x7'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['./team.attributes','exports','Team','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x77a595,_0x2378cf){var _0x4a5031=function(_0x1497e5){while(--_0x1497e5){_0x77a595['push'](_0x77a595['shift']());}};_0x4a5031(++_0x2378cf);}(_0x70e0,0x17b));var _0x070e=function(_0x415050,_0x13083a){_0x415050=_0x415050-0x0;var _0x394de3=_0x70e0[_0x415050];return _0x394de3;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var attributes=require(_0x070e('0x5'));module[_0x070e('0x6')]=function(_0x5c90fc,_0x7bce9b){return _0x5c90fc['define'](_0x070e('0x7'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index e708de3..a623b90 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 _0x107e=['request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','info','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','./team.socket','register'];(function(_0x41c64f,_0x571aef){var _0x11e337=function(_0x3926bf){while(--_0x3926bf){_0x41c64f['push'](_0x41c64f['shift']());}};_0x11e337(++_0x571aef);}(_0x107e,0x1ba));var _0xe107=function(_0x11cffe,_0x430250){_0x11cffe=_0x11cffe-0x0;var _0x5248f9=_0x107e[_0x11cffe];return _0x5248f9;};'use strict';var _=require('lodash');var util=require(_0xe107('0x0'));var moment=require('moment');var BPromise=require(_0xe107('0x1'));var rs=require(_0xe107('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xe107('0x3'));var logger=require(_0xe107('0x4'))(_0xe107('0x5'));var config=require(_0xe107('0x6'));var jayson=require(_0xe107('0x7'));var client=jayson[_0xe107('0x8')][_0xe107('0x9')]({'port':0x232a});var socket=require(_0xe107('0xa'))({'host':_0xe107('0xb'),'port':0x18eb});require(_0xe107('0xc'))[_0xe107('0xd')](socket);function respondWithRpcPromise(_0x19021c,_0x59f8cb,_0x56eb2e){return new BPromise(function(_0x37064c,_0x54a0d0){return client[_0xe107('0xe')](_0x19021c,_0x56eb2e)[_0xe107('0xf')](function(_0x469a93){logger['info'](_0xe107('0x10'),_0x59f8cb,_0xe107('0x11'));logger[_0xe107('0x12')](_0xe107('0x13'),_0x59f8cb,_0xe107('0x11'),JSON['stringify'](_0x469a93));if(_0x469a93[_0xe107('0x14')]){if(_0x469a93['error'][_0xe107('0x15')]===0x1f4){logger[_0xe107('0x14')](_0xe107('0x10'),_0x59f8cb,_0x469a93['error']['message']);return _0x54a0d0(_0x469a93[_0xe107('0x14')]['message']);}logger[_0xe107('0x14')](_0xe107('0x10'),_0x59f8cb,_0x469a93[_0xe107('0x14')][_0xe107('0x16')]);return _0x37064c(_0x469a93[_0xe107('0x14')][_0xe107('0x16')]);}else{logger[_0xe107('0x17')](_0xe107('0x10'),_0x59f8cb,_0xe107('0x11'));_0x37064c(_0x469a93['result']['message']);}})['catch'](function(_0xa46601){logger[_0xe107('0x14')]('Team,\x20%s,\x20%s',_0x59f8cb,_0xa46601);_0x54a0d0(_0xa46601);});});} \ No newline at end of file +var _0x4d57=['info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','socket.io-emitter','localhost','./team.socket','register','request','then'];(function(_0x12e682,_0x33f3a3){var _0x26e600=function(_0x4d79dc){while(--_0x4d79dc){_0x12e682['push'](_0x12e682['shift']());}};_0x26e600(++_0x33f3a3);}(_0x4d57,0x15c));var _0x74d5=function(_0x1c6fec,_0x2b9a4e){_0x1c6fec=_0x1c6fec-0x0;var _0x2f7322=_0x4d57[_0x1c6fec];return _0x2f7322;};'use strict';var _=require(_0x74d5('0x0'));var util=require(_0x74d5('0x1'));var moment=require('moment');var BPromise=require(_0x74d5('0x2'));var rs=require(_0x74d5('0x3'));var fs=require('fs');var db=require(_0x74d5('0x4'))['db'];var utils=require(_0x74d5('0x5'));var logger=require(_0x74d5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x74d5('0x7'));var client=jayson[_0x74d5('0x8')][_0x74d5('0x9')]({'port':0x232a});var socket=require(_0x74d5('0xa'))({'host':_0x74d5('0xb'),'port':0x18eb});require(_0x74d5('0xc'))[_0x74d5('0xd')](socket);function respondWithRpcPromise(_0x3d553a,_0x5ca0cd,_0x5c3bde){return new BPromise(function(_0x581d61,_0xb8b73c){return client[_0x74d5('0xe')](_0x3d553a,_0x5c3bde)[_0x74d5('0xf')](function(_0x123f23){logger[_0x74d5('0x10')](_0x74d5('0x11'),_0x5ca0cd,_0x74d5('0x12'));logger['debug'](_0x74d5('0x13'),_0x5ca0cd,_0x74d5('0x12'),JSON[_0x74d5('0x14')](_0x123f23));if(_0x123f23['error']){if(_0x123f23['error'][_0x74d5('0x15')]===0x1f4){logger[_0x74d5('0x16')](_0x74d5('0x11'),_0x5ca0cd,_0x123f23[_0x74d5('0x16')][_0x74d5('0x17')]);return _0xb8b73c(_0x123f23[_0x74d5('0x16')][_0x74d5('0x17')]);}logger[_0x74d5('0x16')](_0x74d5('0x11'),_0x5ca0cd,_0x123f23[_0x74d5('0x16')][_0x74d5('0x17')]);return _0x581d61(_0x123f23[_0x74d5('0x16')]['message']);}else{logger[_0x74d5('0x10')](_0x74d5('0x11'),_0x5ca0cd,_0x74d5('0x12'));_0x581d61(_0x123f23[_0x74d5('0x18')][_0x74d5('0x17')]);}})[_0x74d5('0x19')](function(_0x3f2d2a){logger[_0x74d5('0x16')](_0x74d5('0x11'),_0x5ca0cd,_0x3f2d2a);_0xb8b73c(_0x3f2d2a);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index a6b6027..e39cdfc 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 _0xaffb=['removeListener','./team.events','remove','update','emit'];(function(_0x3cd91d,_0x163516){var _0x3b4fab=function(_0x1b3319){while(--_0x1b3319){_0x3cd91d['push'](_0x3cd91d['shift']());}};_0x3b4fab(++_0x163516);}(_0xaffb,0x173));var _0xbaff=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0xaffb[_0x1f71d8];return _0x10b045;};'use strict';var TeamEvents=require(_0xbaff('0x0'));var events=['save',_0xbaff('0x1'),_0xbaff('0x2')];function createListener(_0x1a85fe,_0x22e2fd){return function(_0x2e02ac){_0x22e2fd[_0xbaff('0x3')](_0x1a85fe,_0x2e02ac);};}function removeListener(_0x5a531b,_0x312a2f){return function(){TeamEvents[_0xbaff('0x4')](_0x5a531b,_0x312a2f);};}exports['register']=function(_0x4d93c0){for(var _0x4c04ca=0x0,_0x11fe88=events['length'];_0x4c04ca<_0x11fe88;_0x4c04ca++){var _0x13990c=events[_0x4c04ca];var _0x4c4048=createListener('team:'+_0x13990c,_0x4d93c0);TeamEvents['on'](_0x13990c,_0x4c4048);}}; \ No newline at end of file +var _0x946c=['update','emit','length','team:','remove'];(function(_0x26a031,_0x197045){var _0x41315b=function(_0x1263e5){while(--_0x1263e5){_0x26a031['push'](_0x26a031['shift']());}};_0x41315b(++_0x197045);}(_0x946c,0x81));var _0xc946=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x946c[_0x4fde08];return _0x12e725;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0xc946('0x0'),_0xc946('0x1')];function createListener(_0xf3ebbb,_0x277e7a){return function(_0x5e8ca5){_0x277e7a[_0xc946('0x2')](_0xf3ebbb,_0x5e8ca5);};}function removeListener(_0x425651,_0x460fd7){return function(){TeamEvents['removeListener'](_0x425651,_0x460fd7);};}exports['register']=function(_0x39f29f){for(var _0x1fe199=0x0,_0x148e43=events[_0xc946('0x3')];_0x1fe199<_0x148e43;_0x1fe199++){var _0x52cf00=events[_0x1fe199];var _0x1f0718=createListener(_0xc946('0x4')+_0x52cf00,_0x39f29f);TeamEvents['on'](_0x52cf00,_0x1f0718);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 0a3e9ce..5069eca 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 _0xc86d=['index','show','post','create','update','delete','/:id','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated'];(function(_0x4920f2,_0xa4bfbf){var _0x1f27cf=function(_0x4d94ad){while(--_0x4d94ad){_0x4920f2['push'](_0x4920f2['shift']());}};_0x1f27cf(++_0xa4bfbf);}(_0xc86d,0x105));var _0xdc86=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xc86d[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0xdc86('0x0'));var util=require('util');var path=require('path');var express=require(_0xdc86('0x1'));var router=express[_0xdc86('0x2')]();var auth=require(_0xdc86('0x3'));var interaction=require(_0xdc86('0x4'));var config=require(_0xdc86('0x5'));var controller=require(_0xdc86('0x6'));router[_0xdc86('0x7')]('/',auth[_0xdc86('0x8')](),controller[_0xdc86('0x9')]);router[_0xdc86('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xdc86('0xa')]);router[_0xdc86('0xb')]('/',auth[_0xdc86('0x8')](),controller[_0xdc86('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xdc86('0xd')]);router[_0xdc86('0xe')](_0xdc86('0xf'),auth['isAuthenticated'](),controller[_0xdc86('0x10')]);module[_0xdc86('0x11')]=router; \ No newline at end of file +var _0xe1fd=['./template.controller','isAuthenticated','index','get','/:id','show','create','put','update','destroy','exports','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1c1d07,_0x539d7a){var _0x65b963=function(_0x496507){while(--_0x496507){_0x1c1d07['push'](_0x1c1d07['shift']());}};_0x65b963(++_0x539d7a);}(_0xe1fd,0x164));var _0xde1f=function(_0xb1cbae,_0x5b80e6){_0xb1cbae=_0xb1cbae-0x0;var _0x3f156c=_0xe1fd[_0xb1cbae];return _0x3f156c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0xde1f('0x0'));var router=express['Router']();var auth=require(_0xde1f('0x1'));var interaction=require(_0xde1f('0x2'));var config=require(_0xde1f('0x3'));var controller=require(_0xde1f('0x4'));router['get']('/',auth[_0xde1f('0x5')](),controller[_0xde1f('0x6')]);router[_0xde1f('0x7')](_0xde1f('0x8'),auth[_0xde1f('0x5')](),controller[_0xde1f('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0xde1f('0xa')]);router[_0xde1f('0xb')](_0xde1f('0x8'),auth[_0xde1f('0x5')](),controller[_0xde1f('0xc')]);router['delete']('/:id',auth[_0xde1f('0x5')](),controller[_0xde1f('0xd')]);module[_0xde1f('0xe')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 8da9530..84482f9 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 _0x92c4=['exports','STRING','TEXT','sequelize'];(function(_0x4ad451,_0x58139f){var _0xd31fef=function(_0x4ef47e){while(--_0x4ef47e){_0x4ad451['push'](_0x4ad451['shift']());}};_0xd31fef(++_0x58139f);}(_0x92c4,0xcf));var _0x492c=function(_0x12e3c9,_0x4ff7b4){_0x12e3c9=_0x12e3c9-0x0;var _0x284d5d=_0x92c4[_0x12e3c9];return _0x284d5d;};'use strict';var Sequelize=require(_0x492c('0x0'));module[_0x492c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x492c('0x2')]},'html':{'type':Sequelize[_0x492c('0x3')]}}; \ No newline at end of file +var _0x08be=['sequelize','exports','STRING'];(function(_0x3a8ec5,_0x378f44){var _0x483caf=function(_0x559670){while(--_0x559670){_0x3a8ec5['push'](_0x3a8ec5['shift']());}};_0x483caf(++_0x378f44);}(_0x08be,0x6c));var _0xe08b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x08be[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xe08b('0x0'));module[_0xe08b('0x1')]={'name':{'type':Sequelize[_0xe08b('0x2')]},'description':{'type':Sequelize[_0xe08b('0x2')]},'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 6c992ca..bfc8d6a 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 _0x1713=['dateEnd','dateStart','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','pick','add','day','merge','where','filter','map','options','includeAll','include','findAll','params','rawAttributes','length','find','catch','create','body','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','Template','model','keys','query'];(function(_0x34aed1,_0x26dda4){var _0x374733=function(_0x249252){while(--_0x249252){_0x34aed1['push'](_0x34aed1['shift']());}};_0x374733(++_0x26dda4);}(_0x1713,0xa3));var _0x3171=function(_0x54af58,_0x230016){_0x54af58=_0x54af58-0x0;var _0x53ff34=_0x1713[_0x54af58];return _0x53ff34;};'use strict';var jsonpatch=require(_0x3171('0x0'));var rp=require(_0x3171('0x1'));var moment=require(_0x3171('0x2'));var BPromise=require(_0x3171('0x3'));var Mustache=require(_0x3171('0x4'));var util=require(_0x3171('0x5'));var path=require(_0x3171('0x6'));var sox=require('sox');var csv=require(_0x3171('0x7'));var ejs=require(_0x3171('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3171('0x9'));var crypto=require(_0x3171('0xa'));var jsforce=require(_0x3171('0xb'));var deskjs=require(_0x3171('0xc'));var toCsv=require(_0x3171('0x7'));var querystring=require(_0x3171('0xd'));var Papa=require(_0x3171('0xe'));var qs=require(_0x3171('0xf'));var logger=require(_0x3171('0x10'))(_0x3171('0x11'));var utils=require('../../config/utils');var config=require(_0x3171('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x391754,_0x3f1db8){_0x3f1db8=_0x3f1db8||0xcc;return function(_0x19d51f){if(_0x19d51f){return _0x391754['sendStatus'](_0x3f1db8);}return _0x391754[_0x3171('0x13')](_0x3f1db8)['end']();};}function respondWithResult(_0x5d23b4,_0x148f3d){_0x148f3d=_0x148f3d||0xc8;return function(_0x5ced1a){if(_0x5ced1a){return _0x5d23b4[_0x3171('0x13')](_0x148f3d)[_0x3171('0x14')](_0x5ced1a);}};}function respondWithFilteredResult(_0x37d169,_0x1e1893){return function(_0x31d792){if(_0x31d792){var _0x438a86=_0x31d792[_0x3171('0x15')],_0xa31519=_0x1e1893[_0x3171('0x16')],_0x16c9b4=_0x1e1893[_0x3171('0x16')]+_0x1e1893[_0x3171('0x17')],_0x418162;if(_0x16c9b4>=_0x438a86){_0x16c9b4=_0x438a86;_0x418162=0xc8;}else{_0x418162=0xce;}_0x37d169[_0x3171('0x13')](_0x418162);return _0x37d169[_0x3171('0x18')](_0x3171('0x19'),_0xa31519+'-'+_0x16c9b4+'/'+_0x438a86)[_0x3171('0x14')](_0x31d792);}return null;};}function patchUpdates(_0x145d60){return function(_0x40a0eb){try{jsonpatch['apply'](_0x40a0eb,_0x145d60,!![]);}catch(_0x2f28e5){return BPromise[_0x3171('0x1a')](_0x2f28e5);}return _0x40a0eb[_0x3171('0x1b')]();};}function saveUpdates(_0x5871e0,_0xf861ae){return function(_0xe82b3b){if(_0xe82b3b){return _0xe82b3b[_0x3171('0x1c')](_0x5871e0)[_0x3171('0x1d')](function(_0x5d74de){return _0x5d74de;});}return null;};}function removeEntity(_0x4bc17f,_0x26e7b1){return function(_0x34cec1){if(_0x34cec1){return _0x34cec1[_0x3171('0x1e')]()[_0x3171('0x1d')](function(){_0x4bc17f['status'](0xcc)[_0x3171('0x1f')]();});}};}function handleEntityNotFound(_0x2f7ed3,_0x453c38){return function(_0xbcef25){if(!_0xbcef25){_0x2f7ed3[_0x3171('0x20')](0x194);}return _0xbcef25;};}function handleError(_0x447c9b,_0x167144){_0x167144=_0x167144||0x1f4;return function(_0x3c2632){logger[_0x3171('0x21')](_0x3c2632[_0x3171('0x22')]);if(_0x3c2632[_0x3171('0x23')]){delete _0x3c2632[_0x3171('0x23')];}_0x447c9b[_0x3171('0x13')](_0x167144)[_0x3171('0x24')](_0x3c2632);};}exports['index']=function(_0x1ac5d0,_0x38dea4){var _0x330ece={},_0x401a8a={},_0x116cef={'count':0x0,'rows':[]};var _0x2086c7=db[_0x3171('0x25')]['rawAttributes'];_0x401a8a[_0x3171('0x26')]=_[_0x3171('0x27')](_0x2086c7);var _0x50568a={'dateStart':_0x1ac5d0[_0x3171('0x28')]['dateStart'],'dateEnd':_0x1ac5d0[_0x3171('0x28')][_0x3171('0x29')]};delete _0x1ac5d0[_0x3171('0x28')][_0x3171('0x2a')];delete _0x1ac5d0[_0x3171('0x28')]['dateEnd'];_0x401a8a['query']=_[_0x3171('0x27')](_0x1ac5d0['query']);_0x401a8a[_0x3171('0x2b')]=_['intersection'](_0x401a8a[_0x3171('0x26')],_0x401a8a[_0x3171('0x28')]);_0x330ece[_0x3171('0x2c')]=_[_0x3171('0x2d')](_0x401a8a[_0x3171('0x26')],qs[_0x3171('0x2e')](_0x1ac5d0[_0x3171('0x28')]['fields']));_0x330ece[_0x3171('0x2c')]=_0x330ece[_0x3171('0x2c')]['length']?_0x330ece[_0x3171('0x2c')]:_0x401a8a[_0x3171('0x26')];if(!_0x1ac5d0[_0x3171('0x28')][_0x3171('0x2f')](_0x3171('0x30'))){_0x330ece['limit']=qs['limit'](_0x1ac5d0[_0x3171('0x28')][_0x3171('0x17')]);_0x330ece[_0x3171('0x16')]=qs[_0x3171('0x16')](_0x1ac5d0[_0x3171('0x28')][_0x3171('0x16')]);}_0x330ece[_0x3171('0x31')]=qs['sort'](_0x1ac5d0[_0x3171('0x28')]['sort']);_0x330ece['where']=qs[_0x3171('0x2b')](_[_0x3171('0x32')](_0x1ac5d0[_0x3171('0x28')],_0x401a8a['filters']));if(_0x50568a[_0x3171('0x2a')]){if(_0x50568a['dateEnd']){_0x50568a[_0x3171('0x29')]=moment(_0x50568a[_0x3171('0x29')])[_0x3171('0x33')](0x1,_0x3171('0x34'));}else{_0x50568a[_0x3171('0x29')]=moment(_0x50568a[_0x3171('0x2a')])['add'](0x1,_0x3171('0x34'));}_[_0x3171('0x35')](_0x330ece[_0x3171('0x36')],{'createdAt':{'$gte':_0x50568a[_0x3171('0x2a')],'$lte':_0x50568a[_0x3171('0x29')]}});}if(_0x1ac5d0[_0x3171('0x28')][_0x3171('0x37')]){_0x330ece['where']=_[_0x3171('0x35')](_0x330ece[_0x3171('0x36')],{'$or':_[_0x3171('0x38')](_0x330ece[_0x3171('0x2c')],function(_0x39ed36){var _0x2f7c60={};_0x2f7c60[_0x39ed36]={'$like':'%'+_0x1ac5d0['query']['filter']+'%'};return _0x2f7c60;})});}_0x330ece=_[_0x3171('0x35')]({},_0x330ece,_0x1ac5d0[_0x3171('0x39')]);var _0x18935b={'where':_0x330ece[_0x3171('0x36')]};return db[_0x3171('0x25')][_0x3171('0x15')](_0x18935b)['then'](function(_0x26092a){_0x116cef[_0x3171('0x15')]=_0x26092a;if(_0x1ac5d0[_0x3171('0x28')][_0x3171('0x3a')]){_0x330ece[_0x3171('0x3b')]=[{'all':!![]}];}return db[_0x3171('0x25')][_0x3171('0x3c')](_0x330ece);})['then'](function(_0x371e66){_0x116cef['rows']=_0x371e66;return _0x116cef;})['then'](respondWithFilteredResult(_0x38dea4,_0x330ece))['catch'](handleError(_0x38dea4,null));};exports['show']=function(_0x20a54f,_0x473020){var _0x4c609a={'raw':!![],'where':{'id':_0x20a54f[_0x3171('0x3d')]['id']}},_0xb7893={};_0xb7893['model']=_[_0x3171('0x27')](db[_0x3171('0x25')][_0x3171('0x3e')]);_0xb7893[_0x3171('0x28')]=_[_0x3171('0x27')](_0x20a54f[_0x3171('0x28')]);_0xb7893[_0x3171('0x2b')]=_[_0x3171('0x2d')](_0xb7893[_0x3171('0x26')],_0xb7893['query']);_0x4c609a[_0x3171('0x2c')]=_['intersection'](_0xb7893[_0x3171('0x26')],qs[_0x3171('0x2e')](_0x20a54f[_0x3171('0x28')][_0x3171('0x2e')]));_0x4c609a['attributes']=_0x4c609a[_0x3171('0x2c')][_0x3171('0x3f')]?_0x4c609a[_0x3171('0x2c')]:_0xb7893[_0x3171('0x26')];if(_0x20a54f[_0x3171('0x28')]['includeAll']){_0x4c609a['include']=[{'all':!![]}];}_0x4c609a=_[_0x3171('0x35')]({},_0x4c609a,_0x20a54f[_0x3171('0x39')]);return db['Template'][_0x3171('0x40')](_0x4c609a)[_0x3171('0x1d')](handleEntityNotFound(_0x473020,null))['then'](respondWithResult(_0x473020,null))[_0x3171('0x41')](handleError(_0x473020,null));};exports[_0x3171('0x42')]=function(_0x2f672d,_0x2c38b0){return db[_0x3171('0x25')][_0x3171('0x42')](_0x2f672d[_0x3171('0x43')],{})[_0x3171('0x1d')](respondWithResult(_0x2c38b0,0xc9))[_0x3171('0x41')](handleError(_0x2c38b0,null));};exports[_0x3171('0x1c')]=function(_0xce6a57,_0x3bc3d6){if(_0xce6a57[_0x3171('0x43')]['id']){delete _0xce6a57[_0x3171('0x43')]['id'];}return db[_0x3171('0x25')][_0x3171('0x40')]({'where':{'id':_0xce6a57[_0x3171('0x3d')]['id']}})[_0x3171('0x1d')](handleEntityNotFound(_0x3bc3d6,null))[_0x3171('0x1d')](saveUpdates(_0xce6a57[_0x3171('0x43')],null))[_0x3171('0x1d')](respondWithResult(_0x3bc3d6,null))['catch'](handleError(_0x3bc3d6,null));};exports[_0x3171('0x1e')]=function(_0x3f63ae,_0x24179c){return db['Template'][_0x3171('0x40')]({'where':{'id':_0x3f63ae['params']['id']}})[_0x3171('0x1d')](handleEntityNotFound(_0x24179c,null))[_0x3171('0x1d')](removeEntity(_0x24179c,null))[_0x3171('0x41')](handleError(_0x24179c,null));}; \ No newline at end of file +var _0xe078=['dateStart','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','add','day','merge','filter','map','options','include','findAll','rows','includeAll','catch','create','body','find','params','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/logger','../../config/environment','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','index','Template','rawAttributes','model','query','dateEnd'];(function(_0x15b71c,_0x25708f){var _0x35c8c8=function(_0x36b4d6){while(--_0x36b4d6){_0x15b71c['push'](_0x15b71c['shift']());}};_0x35c8c8(++_0x25708f);}(_0xe078,0x1cc));var _0x8e07=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xe078[_0x5d6456];return _0x4d66c1;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x8e07('0x0'));var moment=require(_0x8e07('0x1'));var BPromise=require(_0x8e07('0x2'));var Mustache=require(_0x8e07('0x3'));var util=require('util');var path=require(_0x8e07('0x4'));var sox=require('sox');var csv=require(_0x8e07('0x5'));var ejs=require(_0x8e07('0x6'));var fs=require('fs');var _=require(_0x8e07('0x7'));var squel=require(_0x8e07('0x8'));var crypto=require(_0x8e07('0x9'));var jsforce=require(_0x8e07('0xa'));var deskjs=require(_0x8e07('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8e07('0xc'));var qs=require('../../components/parsers/qs');var logger=require(_0x8e07('0xd'))('api');var utils=require('../../config/utils');var config=require(_0x8e07('0xe'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38b6a4,_0xab2872){_0xab2872=_0xab2872||0xcc;return function(_0x14ded8){if(_0x14ded8){return _0x38b6a4['sendStatus'](_0xab2872);}return _0x38b6a4[_0x8e07('0xf')](_0xab2872)[_0x8e07('0x10')]();};}function respondWithResult(_0x4809f5,_0x19f8cb){_0x19f8cb=_0x19f8cb||0xc8;return function(_0xe975f5){if(_0xe975f5){return _0x4809f5[_0x8e07('0xf')](_0x19f8cb)['json'](_0xe975f5);}};}function respondWithFilteredResult(_0x271af9,_0x34f185){return function(_0x163c44){if(_0x163c44){var _0x53be2c=_0x163c44[_0x8e07('0x11')],_0x27847e=_0x34f185[_0x8e07('0x12')],_0x56070f=_0x34f185[_0x8e07('0x12')]+_0x34f185[_0x8e07('0x13')],_0x44af18;if(_0x56070f>=_0x53be2c){_0x56070f=_0x53be2c;_0x44af18=0xc8;}else{_0x44af18=0xce;}_0x271af9['status'](_0x44af18);return _0x271af9[_0x8e07('0x14')](_0x8e07('0x15'),_0x27847e+'-'+_0x56070f+'/'+_0x53be2c)['json'](_0x163c44);}return null;};}function patchUpdates(_0x667c45){return function(_0x2ba122){try{jsonpatch[_0x8e07('0x16')](_0x2ba122,_0x667c45,!![]);}catch(_0x36a1fe){return BPromise[_0x8e07('0x17')](_0x36a1fe);}return _0x2ba122[_0x8e07('0x18')]();};}function saveUpdates(_0x27ded1,_0x3c0c15){return function(_0x561d5f){if(_0x561d5f){return _0x561d5f[_0x8e07('0x19')](_0x27ded1)[_0x8e07('0x1a')](function(_0x3966b9){return _0x3966b9;});}return null;};}function removeEntity(_0x3fd4ae,_0x13afa9){return function(_0x1b068c){if(_0x1b068c){return _0x1b068c[_0x8e07('0x1b')]()['then'](function(){_0x3fd4ae['status'](0xcc)[_0x8e07('0x10')]();});}};}function handleEntityNotFound(_0x33b082,_0x1d4645){return function(_0x4975a2){if(!_0x4975a2){_0x33b082[_0x8e07('0x1c')](0x194);}return _0x4975a2;};}function handleError(_0x3fb1fd,_0x13d62e){_0x13d62e=_0x13d62e||0x1f4;return function(_0x8c6036){logger['error'](_0x8c6036['stack']);if(_0x8c6036[_0x8e07('0x1d')]){delete _0x8c6036[_0x8e07('0x1d')];}_0x3fb1fd['status'](_0x13d62e)['send'](_0x8c6036);};}exports[_0x8e07('0x1e')]=function(_0x59d438,_0xa209ef){var _0x27611e={},_0x5133ce={},_0x44e1ca={'count':0x0,'rows':[]};var _0x1e4be6=db[_0x8e07('0x1f')][_0x8e07('0x20')];_0x5133ce[_0x8e07('0x21')]=_['keys'](_0x1e4be6);var _0x128283={'dateStart':_0x59d438[_0x8e07('0x22')]['dateStart'],'dateEnd':_0x59d438[_0x8e07('0x22')][_0x8e07('0x23')]};delete _0x59d438[_0x8e07('0x22')][_0x8e07('0x24')];delete _0x59d438[_0x8e07('0x22')][_0x8e07('0x23')];_0x5133ce[_0x8e07('0x22')]=_[_0x8e07('0x25')](_0x59d438[_0x8e07('0x22')]);_0x5133ce[_0x8e07('0x26')]=_[_0x8e07('0x27')](_0x5133ce[_0x8e07('0x21')],_0x5133ce[_0x8e07('0x22')]);_0x27611e[_0x8e07('0x28')]=_[_0x8e07('0x27')](_0x5133ce['model'],qs[_0x8e07('0x29')](_0x59d438[_0x8e07('0x22')][_0x8e07('0x29')]));_0x27611e[_0x8e07('0x28')]=_0x27611e[_0x8e07('0x28')][_0x8e07('0x2a')]?_0x27611e[_0x8e07('0x28')]:_0x5133ce[_0x8e07('0x21')];if(!_0x59d438['query'][_0x8e07('0x2b')]('nolimit')){_0x27611e[_0x8e07('0x13')]=qs[_0x8e07('0x13')](_0x59d438[_0x8e07('0x22')][_0x8e07('0x13')]);_0x27611e[_0x8e07('0x12')]=qs[_0x8e07('0x12')](_0x59d438['query']['offset']);}_0x27611e['order']=qs['sort'](_0x59d438[_0x8e07('0x22')][_0x8e07('0x2c')]);_0x27611e[_0x8e07('0x2d')]=qs[_0x8e07('0x26')](_[_0x8e07('0x2e')](_0x59d438[_0x8e07('0x22')],_0x5133ce['filters']));if(_0x128283['dateStart']){if(_0x128283[_0x8e07('0x23')]){_0x128283[_0x8e07('0x23')]=moment(_0x128283['dateEnd'])['add'](0x1,'day');}else{_0x128283['dateEnd']=moment(_0x128283[_0x8e07('0x24')])[_0x8e07('0x2f')](0x1,_0x8e07('0x30'));}_[_0x8e07('0x31')](_0x27611e[_0x8e07('0x2d')],{'createdAt':{'$gte':_0x128283['dateStart'],'$lte':_0x128283[_0x8e07('0x23')]}});}if(_0x59d438['query'][_0x8e07('0x32')]){_0x27611e['where']=_[_0x8e07('0x31')](_0x27611e['where'],{'$or':_[_0x8e07('0x33')](_0x27611e[_0x8e07('0x28')],function(_0x3f1b55){var _0x480ef1={};_0x480ef1[_0x3f1b55]={'$like':'%'+_0x59d438['query'][_0x8e07('0x32')]+'%'};return _0x480ef1;})});}_0x27611e=_[_0x8e07('0x31')]({},_0x27611e,_0x59d438[_0x8e07('0x34')]);var _0x1f3aee={'where':_0x27611e[_0x8e07('0x2d')]};return db['Template'][_0x8e07('0x11')](_0x1f3aee)[_0x8e07('0x1a')](function(_0x5212d4){_0x44e1ca[_0x8e07('0x11')]=_0x5212d4;if(_0x59d438[_0x8e07('0x22')]['includeAll']){_0x27611e[_0x8e07('0x35')]=[{'all':!![]}];}return db[_0x8e07('0x1f')][_0x8e07('0x36')](_0x27611e);})[_0x8e07('0x1a')](function(_0x4f43bc){_0x44e1ca[_0x8e07('0x37')]=_0x4f43bc;return _0x44e1ca;})[_0x8e07('0x1a')](respondWithFilteredResult(_0xa209ef,_0x27611e))['catch'](handleError(_0xa209ef,null));};exports['show']=function(_0x388a91,_0x3be634){var _0x42556e={'raw':!![],'where':{'id':_0x388a91['params']['id']}},_0xe5835f={};_0xe5835f[_0x8e07('0x21')]=_[_0x8e07('0x25')](db[_0x8e07('0x1f')][_0x8e07('0x20')]);_0xe5835f['query']=_[_0x8e07('0x25')](_0x388a91[_0x8e07('0x22')]);_0xe5835f[_0x8e07('0x26')]=_[_0x8e07('0x27')](_0xe5835f[_0x8e07('0x21')],_0xe5835f[_0x8e07('0x22')]);_0x42556e[_0x8e07('0x28')]=_[_0x8e07('0x27')](_0xe5835f[_0x8e07('0x21')],qs['fields'](_0x388a91[_0x8e07('0x22')][_0x8e07('0x29')]));_0x42556e[_0x8e07('0x28')]=_0x42556e[_0x8e07('0x28')]['length']?_0x42556e['attributes']:_0xe5835f[_0x8e07('0x21')];if(_0x388a91['query'][_0x8e07('0x38')]){_0x42556e[_0x8e07('0x35')]=[{'all':!![]}];}_0x42556e=_[_0x8e07('0x31')]({},_0x42556e,_0x388a91['options']);return db[_0x8e07('0x1f')]['find'](_0x42556e)[_0x8e07('0x1a')](handleEntityNotFound(_0x3be634,null))[_0x8e07('0x1a')](respondWithResult(_0x3be634,null))[_0x8e07('0x39')](handleError(_0x3be634,null));};exports['create']=function(_0x455bf9,_0x40120c){return db[_0x8e07('0x1f')][_0x8e07('0x3a')](_0x455bf9[_0x8e07('0x3b')],{})[_0x8e07('0x1a')](respondWithResult(_0x40120c,0xc9))[_0x8e07('0x39')](handleError(_0x40120c,null));};exports[_0x8e07('0x19')]=function(_0x29fc86,_0x21a863){if(_0x29fc86[_0x8e07('0x3b')]['id']){delete _0x29fc86[_0x8e07('0x3b')]['id'];}return db[_0x8e07('0x1f')][_0x8e07('0x3c')]({'where':{'id':_0x29fc86[_0x8e07('0x3d')]['id']}})[_0x8e07('0x1a')](handleEntityNotFound(_0x21a863,null))[_0x8e07('0x1a')](saveUpdates(_0x29fc86[_0x8e07('0x3b')],null))[_0x8e07('0x1a')](respondWithResult(_0x21a863,null))[_0x8e07('0x39')](handleError(_0x21a863,null));};exports[_0x8e07('0x1b')]=function(_0x21ee15,_0x2d199a){return db[_0x8e07('0x1f')][_0x8e07('0x3c')]({'where':{'id':_0x21ee15['params']['id']}})['then'](handleEntityNotFound(_0x2d199a,null))[_0x8e07('0x1a')](removeEntity(_0x2d199a,null))[_0x8e07('0x39')](handleError(_0x2d199a,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 9f1b1ea..18c4907 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 _0xf2e2=['define','Template','tools_templates','lodash','api','moment','request-promise','./template.attributes'];(function(_0x1ac6ec,_0x1f81fc){var _0x48a489=function(_0xf38b04){while(--_0xf38b04){_0x1ac6ec['push'](_0x1ac6ec['shift']());}};_0x48a489(++_0x1f81fc);}(_0xf2e2,0x163));var _0x2f2e=function(_0x3c0d47,_0x36bb78){_0x3c0d47=_0x3c0d47-0x0;var _0x5c4552=_0xf2e2[_0x3c0d47];return _0x5c4552;};'use strict';var _=require(_0x2f2e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2f2e('0x1'));var moment=require(_0x2f2e('0x2'));var BPromise=require('bluebird');var rp=require(_0x2f2e('0x3'));var attributes=require(_0x2f2e('0x4'));module['exports']=function(_0x1f4699,_0x4d2c9c){return _0x1f4699[_0x2f2e('0x5')](_0x2f2e('0x6'),attributes,{'tableName':_0x2f2e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3578=['request-promise','./template.attributes','exports','define','Template','lodash','../../config/logger','moment','bluebird'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0x3578,0x9e));var _0x8357=function(_0x548af0,_0x2f9fd8){_0x548af0=_0x548af0-0x0;var _0x595aeb=_0x3578[_0x548af0];return _0x595aeb;};'use strict';var _=require(_0x8357('0x0'));var util=require('util');var logger=require(_0x8357('0x1'))('api');var moment=require(_0x8357('0x2'));var BPromise=require(_0x8357('0x3'));var rp=require(_0x8357('0x4'));var attributes=require(_0x8357('0x5'));module[_0x8357('0x6')]=function(_0x4af7cd,_0x4059ba){return _0x4af7cd[_0x8357('0x7')](_0x8357('0x8'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 9e82176..4e58b89 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 _0xb383=['attributes','limit','include','map','model','catch','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','Template,\x20%s,\x20%s','GetTemplate','Template','findAll','options','raw'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xb383,0x114));var _0x3b38=function(_0x30bfed,_0x3a303a){_0x30bfed=_0x30bfed-0x0;var _0x2221e3=_0xb383[_0x30bfed];return _0x2221e3;};'use strict';var _=require('lodash');var util=require(_0x3b38('0x0'));var moment=require(_0x3b38('0x1'));var BPromise=require(_0x3b38('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x3b38('0x3'))['db'];var utils=require(_0x3b38('0x4'));var logger=require('../../config/logger')(_0x3b38('0x5'));var config=require(_0x3b38('0x6'));var jayson=require(_0x3b38('0x7'));var client=jayson[_0x3b38('0x8')][_0x3b38('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x999ebb,_0x12f8e6,_0x17c6e3){return new BPromise(function(_0xbc6ce6,_0x2116f2){return client['request'](_0x999ebb,_0x17c6e3)[_0x3b38('0xa')](function(_0x1c2cd1){logger[_0x3b38('0xb')]('Template,\x20%s,\x20%s',_0x12f8e6,_0x3b38('0xc'));logger[_0x3b38('0xd')](_0x3b38('0xe'),_0x12f8e6,_0x3b38('0xc'),JSON[_0x3b38('0xf')](_0x1c2cd1));if(_0x1c2cd1['error']){if(_0x1c2cd1[_0x3b38('0x10')]['code']===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x12f8e6,_0x1c2cd1['error'][_0x3b38('0x11')]);return _0x2116f2(_0x1c2cd1[_0x3b38('0x10')]['message']);}logger['error'](_0x3b38('0x12'),_0x12f8e6,_0x1c2cd1[_0x3b38('0x10')][_0x3b38('0x11')]);return _0xbc6ce6(_0x1c2cd1[_0x3b38('0x10')]['message']);}else{logger[_0x3b38('0xb')](_0x3b38('0x12'),_0x12f8e6,_0x3b38('0xc'));_0xbc6ce6(_0x1c2cd1['result'][_0x3b38('0x11')]);}})['catch'](function(_0x30cbd6){logger['error'](_0x3b38('0x12'),_0x12f8e6,_0x30cbd6);_0x2116f2(_0x30cbd6);});});}exports[_0x3b38('0x13')]=function(_0x5ce732){var _0x2e3354=this;return new Promise(function(_0x1c3d2b,_0x1aa245){return db[_0x3b38('0x14')][_0x3b38('0x15')]({'raw':_0x5ce732[_0x3b38('0x16')]?_0x5ce732[_0x3b38('0x16')][_0x3b38('0x17')]===undefined?!![]:![]:!![],'where':_0x5ce732['options']?_0x5ce732['options']['where']||null:null,'attributes':_0x5ce732['options']?_0x5ce732[_0x3b38('0x16')][_0x3b38('0x18')]||null:null,'limit':_0x5ce732[_0x3b38('0x16')]?_0x5ce732[_0x3b38('0x16')][_0x3b38('0x19')]||null:null,'include':_0x5ce732[_0x3b38('0x16')]?_0x5ce732[_0x3b38('0x16')][_0x3b38('0x1a')]?_[_0x3b38('0x1b')](_0x5ce732[_0x3b38('0x16')][_0x3b38('0x1a')],function(_0x494bb3){return{'model':db[_0x494bb3[_0x3b38('0x1c')]],'as':_0x494bb3['as'],'attributes':_0x494bb3[_0x3b38('0x18')],'include':_0x494bb3[_0x3b38('0x1a')]?_[_0x3b38('0x1b')](_0x494bb3['include'],function(_0x5da537){return{'model':db[_0x5da537[_0x3b38('0x1c')]],'as':_0x5da537['as'],'attributes':_0x5da537[_0x3b38('0x18')],'include':_0x5da537['include']?_[_0x3b38('0x1b')](_0x5da537[_0x3b38('0x1a')],function(_0x37af39){return{'model':db[_0x37af39[_0x3b38('0x1c')]],'as':_0x37af39['as'],'attributes':_0x37af39[_0x3b38('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3b38('0xa')](function(_0x58cad1){logger[_0x3b38('0xb')](_0x3b38('0x13'),_0x5ce732);logger[_0x3b38('0xd')]('GetTemplate',_0x5ce732,JSON[_0x3b38('0xf')](_0x58cad1));_0x1c3d2b(_0x58cad1);})[_0x3b38('0x1d')](function(_0x475993){logger[_0x3b38('0x10')](_0x3b38('0x13'),_0x475993[_0x3b38('0x11')],_0x5ce732);_0x1aa245(_0x2e3354[_0x3b38('0x10')](0x1f4,_0x475993['message']));});});}; \ No newline at end of file +var _0x8ebc=['request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTemplate','options','raw','attributes','include','map','model','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x8ebc,0x18c));var _0xc8eb=function(_0x5df735,_0x4aa901){_0x5df735=_0x5df735-0x0;var _0x426a45=_0x8ebc[_0x5df735];return _0x426a45;};'use strict';var _=require(_0xc8eb('0x0'));var util=require('util');var moment=require(_0xc8eb('0x1'));var BPromise=require(_0xc8eb('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xc8eb('0x3'))['db'];var utils=require(_0xc8eb('0x4'));var logger=require(_0xc8eb('0x5'))(_0xc8eb('0x6'));var config=require('../../config/environment');var jayson=require(_0xc8eb('0x7'));var client=jayson['client'][_0xc8eb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3061ec,_0x5c42ad,_0x1b2eb7){return new BPromise(function(_0xd97dc2,_0x1e5071){return client[_0xc8eb('0x9')](_0x3061ec,_0x1b2eb7)[_0xc8eb('0xa')](function(_0x4968f8){logger[_0xc8eb('0xb')](_0xc8eb('0xc'),_0x5c42ad,_0xc8eb('0xd'));logger[_0xc8eb('0xe')](_0xc8eb('0xf'),_0x5c42ad,'request\x20sent',JSON[_0xc8eb('0x10')](_0x4968f8));if(_0x4968f8['error']){if(_0x4968f8[_0xc8eb('0x11')]['code']===0x1f4){logger[_0xc8eb('0x11')](_0xc8eb('0xc'),_0x5c42ad,_0x4968f8[_0xc8eb('0x11')][_0xc8eb('0x12')]);return _0x1e5071(_0x4968f8[_0xc8eb('0x11')][_0xc8eb('0x12')]);}logger[_0xc8eb('0x11')](_0xc8eb('0xc'),_0x5c42ad,_0x4968f8['error']['message']);return _0xd97dc2(_0x4968f8[_0xc8eb('0x11')][_0xc8eb('0x12')]);}else{logger[_0xc8eb('0xb')](_0xc8eb('0xc'),_0x5c42ad,_0xc8eb('0xd'));_0xd97dc2(_0x4968f8['result'][_0xc8eb('0x12')]);}})[_0xc8eb('0x13')](function(_0x203c5b){logger['error']('Template,\x20%s,\x20%s',_0x5c42ad,_0x203c5b);_0x1e5071(_0x203c5b);});});}exports[_0xc8eb('0x14')]=function(_0x2bdc15){var _0x1c5210=this;return new Promise(function(_0x311ed6,_0x5108ba){return db['Template']['findAll']({'raw':_0x2bdc15['options']?_0x2bdc15[_0xc8eb('0x15')][_0xc8eb('0x16')]===undefined?!![]:![]:!![],'where':_0x2bdc15[_0xc8eb('0x15')]?_0x2bdc15['options']['where']||null:null,'attributes':_0x2bdc15[_0xc8eb('0x15')]?_0x2bdc15[_0xc8eb('0x15')][_0xc8eb('0x17')]||null:null,'limit':_0x2bdc15[_0xc8eb('0x15')]?_0x2bdc15[_0xc8eb('0x15')]['limit']||null:null,'include':_0x2bdc15[_0xc8eb('0x15')]?_0x2bdc15['options'][_0xc8eb('0x18')]?_[_0xc8eb('0x19')](_0x2bdc15[_0xc8eb('0x15')]['include'],function(_0x1968c6){return{'model':db[_0x1968c6[_0xc8eb('0x1a')]],'as':_0x1968c6['as'],'attributes':_0x1968c6[_0xc8eb('0x17')],'include':_0x1968c6[_0xc8eb('0x18')]?_['map'](_0x1968c6[_0xc8eb('0x18')],function(_0x58ac8e){return{'model':db[_0x58ac8e[_0xc8eb('0x1a')]],'as':_0x58ac8e['as'],'attributes':_0x58ac8e[_0xc8eb('0x17')],'include':_0x58ac8e[_0xc8eb('0x18')]?_[_0xc8eb('0x19')](_0x58ac8e[_0xc8eb('0x18')],function(_0x7783fe){return{'model':db[_0x7783fe['model']],'as':_0x7783fe['as'],'attributes':_0x7783fe[_0xc8eb('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc8eb('0xa')](function(_0xef3789){logger[_0xc8eb('0xb')](_0xc8eb('0x14'),_0x2bdc15);logger[_0xc8eb('0xe')]('GetTemplate',_0x2bdc15,JSON['stringify'](_0xef3789));_0x311ed6(_0xef3789);})[_0xc8eb('0x13')](function(_0x4969ee){logger['error']('GetTemplate',_0x4969ee[_0xc8eb('0x12')],_0x2bdc15);_0x5108ba(_0x1c5210[_0xc8eb('0x11')](0x1f4,_0x4969ee[_0xc8eb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index a35d9f8..9684508 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 _0x0853=['post','addAllCondition','/:id/actions','update','delete','/:id','destroy','exports','path','Router','../../components/auth/service','./trigger.controller','get','isAuthenticated','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','getActions'];(function(_0x5eab9b,_0x113241){var _0x16bbc5=function(_0x523fae){while(--_0x523fae){_0x5eab9b['push'](_0x5eab9b['shift']());}};_0x16bbc5(++_0x113241);}(_0x0853,0x8d));var _0x3085=function(_0x35aa49,_0x1e3090){_0x35aa49=_0x35aa49-0x0;var _0x181883=_0x0853[_0x35aa49];return _0x181883;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3085('0x0'));var express=require('express');var router=express[_0x3085('0x1')]();var auth=require(_0x3085('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3085('0x3'));router[_0x3085('0x4')]('/',auth[_0x3085('0x5')](),controller['index']);router['get']('/:id',auth[_0x3085('0x5')](),controller[_0x3085('0x6')]);router[_0x3085('0x4')](_0x3085('0x7'),auth[_0x3085('0x5')](),controller['getAllConditions']);router[_0x3085('0x4')](_0x3085('0x8'),auth[_0x3085('0x5')](),controller[_0x3085('0x9')]);router[_0x3085('0x4')]('/:id/actions',auth['isAuthenticated'](),controller[_0x3085('0xa')]);router[_0x3085('0xb')]('/',auth[_0x3085('0x5')](),controller['create']);router['post']('/:id/all_conditions',auth[_0x3085('0x5')](),controller[_0x3085('0xc')]);router[_0x3085('0xb')](_0x3085('0x8'),auth[_0x3085('0x5')](),controller['addAnyCondition']);router[_0x3085('0xb')](_0x3085('0xd'),auth[_0x3085('0x5')](),controller['addAction']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3085('0xe')]);router[_0x3085('0xf')](_0x3085('0x10'),auth[_0x3085('0x5')](),controller[_0x3085('0x11')]);module[_0x3085('0x12')]=router; \ No newline at end of file +var _0x605d=['update','util','path','express','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAction','put'];(function(_0x3e3a51,_0x2f0449){var _0x2a711c=function(_0x53e36e){while(--_0x53e36e){_0x3e3a51['push'](_0x3e3a51['shift']());}};_0x2a711c(++_0x2f0449);}(_0x605d,0xe8));var _0xd605=function(_0x2e14bf,_0x3af516){_0x2e14bf=_0x2e14bf-0x0;var _0x1f7d7b=_0x605d[_0x2e14bf];return _0x1f7d7b;};'use strict';var multer=require('multer');var util=require(_0xd605('0x0'));var path=require(_0xd605('0x1'));var express=require(_0xd605('0x2'));var router=express['Router']();var auth=require(_0xd605('0x3'));var interaction=require(_0xd605('0x4'));var config=require('../../config/environment');var controller=require(_0xd605('0x5'));router[_0xd605('0x6')]('/',auth[_0xd605('0x7')](),controller[_0xd605('0x8')]);router[_0xd605('0x6')](_0xd605('0x9'),auth[_0xd605('0x7')](),controller['show']);router['get'](_0xd605('0xa'),auth['isAuthenticated'](),controller[_0xd605('0xb')]);router['get'](_0xd605('0xc'),auth[_0xd605('0x7')](),controller[_0xd605('0xd')]);router['get'](_0xd605('0xe'),auth[_0xd605('0x7')](),controller[_0xd605('0xf')]);router[_0xd605('0x10')]('/',auth['isAuthenticated'](),controller[_0xd605('0x11')]);router[_0xd605('0x10')]('/:id/all_conditions',auth[_0xd605('0x7')](),controller['addAllCondition']);router[_0xd605('0x10')](_0xd605('0xc'),auth[_0xd605('0x7')](),controller['addAnyCondition']);router['post'](_0xd605('0xe'),auth[_0xd605('0x7')](),controller[_0xd605('0x12')]);router[_0xd605('0x13')](_0xd605('0x9'),auth['isAuthenticated'](),controller[_0xd605('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index efdbb8d..fcb0fa4 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 _0x68f7=['BOOLEAN','sequelize','exports','STRING'];(function(_0x21836b,_0x2823b5){var _0x4a3107=function(_0x36fce4){while(--_0x36fce4){_0x21836b['push'](_0x21836b['shift']());}};_0x4a3107(++_0x2823b5);}(_0x68f7,0x119));var _0x768f=function(_0x1ed368,_0x5b0b79){_0x1ed368=_0x1ed368-0x0;var _0x4199fd=_0x68f7[_0x1ed368];return _0x4199fd;};'use strict';var Sequelize=require(_0x768f('0x0'));module[_0x768f('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x768f('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x768f('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xae3f=['STRING','BOOLEAN'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xae3f,0x11e));var _0xfae3=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xae3f[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xfae3('0x0')]},'description':{'type':Sequelize[_0xfae3('0x0')]},'status':{'type':Sequelize[_0xfae3('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index d19d4c9..616d03b 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 _0x1b1c=['pick','add','day','merge','filter','map','options','findAll','rows','catch','length','includeAll','include','create','body','params','find','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','getAnyConditions','findOne','order','addAction','TriggerId','getActions','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','Trigger','rawAttributes','model','keys','dateStart','dateEnd','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','sort','where'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x1b1c,0x15c));var _0xc1b1=function(_0x3c36fb,_0x388539){_0x3c36fb=_0x3c36fb-0x0;var _0x4a47eb=_0x1b1c[_0x3c36fb];return _0x4a47eb;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xc1b1('0x0'));var moment=require('moment');var BPromise=require(_0xc1b1('0x1'));var Mustache=require('mustache');var util=require(_0xc1b1('0x2'));var path=require(_0xc1b1('0x3'));var sox=require(_0xc1b1('0x4'));var csv=require(_0xc1b1('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc1b1('0x6'));var squel=require(_0xc1b1('0x7'));var crypto=require('crypto');var jsforce=require(_0xc1b1('0x8'));var deskjs=require(_0xc1b1('0x9'));var toCsv=require('to-csv');var querystring=require(_0xc1b1('0xa'));var Papa=require(_0xc1b1('0xb'));var qs=require(_0xc1b1('0xc'));var logger=require(_0xc1b1('0xd'))(_0xc1b1('0xe'));var utils=require(_0xc1b1('0xf'));var config=require(_0xc1b1('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31fff4,_0xbaff6d){_0xbaff6d=_0xbaff6d||0xcc;return function(_0x4c9923){if(_0x4c9923){return _0x31fff4[_0xc1b1('0x11')](_0xbaff6d);}return _0x31fff4[_0xc1b1('0x12')](_0xbaff6d)[_0xc1b1('0x13')]();};}function respondWithResult(_0x58dec7,_0x44131b){_0x44131b=_0x44131b||0xc8;return function(_0x24793a){if(_0x24793a){return _0x58dec7[_0xc1b1('0x12')](_0x44131b)[_0xc1b1('0x14')](_0x24793a);}};}function respondWithFilteredResult(_0x444fc6,_0x3b3d0c){return function(_0x3a3e2b){if(_0x3a3e2b){var _0x15a1b1=_0x3a3e2b[_0xc1b1('0x15')],_0x191af5=_0x3b3d0c['offset'],_0x1309c8=_0x3b3d0c['offset']+_0x3b3d0c[_0xc1b1('0x16')],_0x5e8229;if(_0x1309c8>=_0x15a1b1){_0x1309c8=_0x15a1b1;_0x5e8229=0xc8;}else{_0x5e8229=0xce;}_0x444fc6['status'](_0x5e8229);return _0x444fc6[_0xc1b1('0x17')](_0xc1b1('0x18'),_0x191af5+'-'+_0x1309c8+'/'+_0x15a1b1)[_0xc1b1('0x14')](_0x3a3e2b);}return null;};}function patchUpdates(_0x5679c4){return function(_0x214350){try{jsonpatch[_0xc1b1('0x19')](_0x214350,_0x5679c4,!![]);}catch(_0x5ea852){return BPromise[_0xc1b1('0x1a')](_0x5ea852);}return _0x214350[_0xc1b1('0x1b')]();};}function saveUpdates(_0x2db9bd,_0xa84adb){return function(_0x58bd85){if(_0x58bd85){return _0x58bd85[_0xc1b1('0x1c')](_0x2db9bd)['then'](function(_0x22429d){return _0x22429d;});}return null;};}function removeEntity(_0x537857,_0x462079){return function(_0x40fd61){if(_0x40fd61){return _0x40fd61[_0xc1b1('0x1d')]()[_0xc1b1('0x1e')](function(){_0x537857[_0xc1b1('0x12')](0xcc)[_0xc1b1('0x13')]();});}};}function handleEntityNotFound(_0xed21a8,_0x1ca3f1){return function(_0x157597){if(!_0x157597){_0xed21a8[_0xc1b1('0x11')](0x194);}return _0x157597;};}function handleError(_0x595432,_0x453598){_0x453598=_0x453598||0x1f4;return function(_0x44743f){logger[_0xc1b1('0x1f')](_0x44743f[_0xc1b1('0x20')]);if(_0x44743f[_0xc1b1('0x21')]){delete _0x44743f['name'];}_0x595432[_0xc1b1('0x12')](_0x453598)[_0xc1b1('0x22')](_0x44743f);};}exports[_0xc1b1('0x23')]=function(_0x7e5a53,_0xa674c1){var _0x6ff044={},_0x593f2d={},_0x4bc5bf={'count':0x0,'rows':[]};var _0x35d89c=db[_0xc1b1('0x24')][_0xc1b1('0x25')];_0x593f2d[_0xc1b1('0x26')]=_[_0xc1b1('0x27')](_0x35d89c);var _0x4bd2d4={'dateStart':_0x7e5a53['query'][_0xc1b1('0x28')],'dateEnd':_0x7e5a53['query'][_0xc1b1('0x29')]};delete _0x7e5a53['query'][_0xc1b1('0x28')];delete _0x7e5a53[_0xc1b1('0x2a')][_0xc1b1('0x29')];_0x593f2d[_0xc1b1('0x2a')]=_[_0xc1b1('0x27')](_0x7e5a53[_0xc1b1('0x2a')]);_0x593f2d[_0xc1b1('0x2b')]=_[_0xc1b1('0x2c')](_0x593f2d['model'],_0x593f2d[_0xc1b1('0x2a')]);_0x6ff044[_0xc1b1('0x2d')]=_[_0xc1b1('0x2c')](_0x593f2d[_0xc1b1('0x26')],qs[_0xc1b1('0x2e')](_0x7e5a53['query'][_0xc1b1('0x2e')]));_0x6ff044[_0xc1b1('0x2d')]=_0x6ff044['attributes']['length']?_0x6ff044[_0xc1b1('0x2d')]:_0x593f2d[_0xc1b1('0x26')];if(!_0x7e5a53[_0xc1b1('0x2a')][_0xc1b1('0x2f')](_0xc1b1('0x30'))){_0x6ff044[_0xc1b1('0x16')]=qs[_0xc1b1('0x16')](_0x7e5a53['query'][_0xc1b1('0x16')]);_0x6ff044[_0xc1b1('0x31')]=qs['offset'](_0x7e5a53[_0xc1b1('0x2a')][_0xc1b1('0x31')]);}_0x6ff044['order']=qs[_0xc1b1('0x32')](_0x7e5a53[_0xc1b1('0x2a')]['sort']);_0x6ff044[_0xc1b1('0x33')]=qs[_0xc1b1('0x2b')](_[_0xc1b1('0x34')](_0x7e5a53[_0xc1b1('0x2a')],_0x593f2d['filters']));if(_0x4bd2d4[_0xc1b1('0x28')]){if(_0x4bd2d4['dateEnd']){_0x4bd2d4[_0xc1b1('0x29')]=moment(_0x4bd2d4[_0xc1b1('0x29')])[_0xc1b1('0x35')](0x1,_0xc1b1('0x36'));}else{_0x4bd2d4['dateEnd']=moment(_0x4bd2d4[_0xc1b1('0x28')])[_0xc1b1('0x35')](0x1,_0xc1b1('0x36'));}_[_0xc1b1('0x37')](_0x6ff044[_0xc1b1('0x33')],{'createdAt':{'$gte':_0x4bd2d4[_0xc1b1('0x28')],'$lte':_0x4bd2d4[_0xc1b1('0x29')]}});}if(_0x7e5a53[_0xc1b1('0x2a')][_0xc1b1('0x38')]){_0x6ff044[_0xc1b1('0x33')]=_[_0xc1b1('0x37')](_0x6ff044[_0xc1b1('0x33')],{'$or':_[_0xc1b1('0x39')](_0x6ff044[_0xc1b1('0x2d')],function(_0x410c6d){var _0x26676b={};_0x26676b[_0x410c6d]={'$like':'%'+_0x7e5a53[_0xc1b1('0x2a')]['filter']+'%'};return _0x26676b;})});}_0x6ff044=_[_0xc1b1('0x37')]({},_0x6ff044,_0x7e5a53[_0xc1b1('0x3a')]);var _0x3c5a0c={'where':_0x6ff044['where']};return db[_0xc1b1('0x24')][_0xc1b1('0x15')](_0x3c5a0c)[_0xc1b1('0x1e')](function(_0x4e9e94){_0x4bc5bf[_0xc1b1('0x15')]=_0x4e9e94;if(_0x7e5a53[_0xc1b1('0x2a')]['includeAll']){_0x6ff044['include']=[{'all':!![]}];}return db[_0xc1b1('0x24')][_0xc1b1('0x3b')](_0x6ff044);})['then'](function(_0x215946){_0x4bc5bf[_0xc1b1('0x3c')]=_0x215946;return _0x4bc5bf;})['then'](respondWithFilteredResult(_0xa674c1,_0x6ff044))[_0xc1b1('0x3d')](handleError(_0xa674c1,null));};exports['show']=function(_0x53925d,_0x5df0d8){var _0x140d1={'raw':![],'where':{'id':_0x53925d['params']['id']}},_0x21679f={};_0x21679f[_0xc1b1('0x26')]=_[_0xc1b1('0x27')](db[_0xc1b1('0x24')][_0xc1b1('0x25')]);_0x21679f[_0xc1b1('0x2a')]=_[_0xc1b1('0x27')](_0x53925d['query']);_0x21679f['filters']=_[_0xc1b1('0x2c')](_0x21679f[_0xc1b1('0x26')],_0x21679f[_0xc1b1('0x2a')]);_0x140d1[_0xc1b1('0x2d')]=_[_0xc1b1('0x2c')](_0x21679f[_0xc1b1('0x26')],qs[_0xc1b1('0x2e')](_0x53925d[_0xc1b1('0x2a')][_0xc1b1('0x2e')]));_0x140d1['attributes']=_0x140d1[_0xc1b1('0x2d')][_0xc1b1('0x3e')]?_0x140d1[_0xc1b1('0x2d')]:_0x21679f['model'];if(_0x53925d[_0xc1b1('0x2a')][_0xc1b1('0x3f')]){_0x140d1[_0xc1b1('0x40')]=[{'all':!![]}];}_0x140d1=_[_0xc1b1('0x37')]({},_0x140d1,_0x53925d['options']);return db[_0xc1b1('0x24')]['find'](_0x140d1)[_0xc1b1('0x1e')](handleEntityNotFound(_0x5df0d8,null))['then'](respondWithResult(_0x5df0d8,null))[_0xc1b1('0x3d')](handleError(_0x5df0d8,null));};exports[_0xc1b1('0x41')]=function(_0x2e5e4a,_0x3eb754){return db[_0xc1b1('0x24')][_0xc1b1('0x41')](_0x2e5e4a['body'],{})[_0xc1b1('0x1e')](respondWithResult(_0x3eb754,0xc9))[_0xc1b1('0x3d')](handleError(_0x3eb754,null));};exports[_0xc1b1('0x1c')]=function(_0x3e784f,_0xd67c06){if(_0x3e784f[_0xc1b1('0x42')]['id']){delete _0x3e784f[_0xc1b1('0x42')]['id'];}return db['Trigger']['find']({'where':{'id':_0x3e784f[_0xc1b1('0x43')]['id']}})[_0xc1b1('0x1e')](handleEntityNotFound(_0xd67c06,null))[_0xc1b1('0x1e')](saveUpdates(_0x3e784f[_0xc1b1('0x42')],null))[_0xc1b1('0x1e')](respondWithResult(_0xd67c06,null))['catch'](handleError(_0xd67c06,null));};exports[_0xc1b1('0x1d')]=function(_0x40d844,_0x366999){return db[_0xc1b1('0x24')][_0xc1b1('0x44')]({'where':{'id':_0x40d844[_0xc1b1('0x43')]['id']}})[_0xc1b1('0x1e')](handleEntityNotFound(_0x366999,null))['then'](removeEntity(_0x366999,null))[_0xc1b1('0x3d')](handleError(_0x366999,null));};exports[_0xc1b1('0x45')]=function(_0x4729c5,_0x110d20,_0x528914){if(_0x4729c5[_0xc1b1('0x42')]['id']){delete _0x4729c5[_0xc1b1('0x42')]['id'];}return db['Trigger'][_0xc1b1('0x44')]({'where':{'id':_0x4729c5[_0xc1b1('0x43')]['id']}})[_0xc1b1('0x1e')](handleEntityNotFound(_0x110d20,null))['then'](function(_0xe8294){if(_0xe8294){_0x4729c5['body'][_0xc1b1('0x46')]=_0xe8294['id'];return db[_0xc1b1('0x47')]['create'](_0x4729c5['body']);}})[_0xc1b1('0x1e')](respondWithResult(_0x110d20,null))[_0xc1b1('0x3d')](handleError(_0x110d20,null));};exports[_0xc1b1('0x48')]=function(_0x289ac3,_0x4ad9b7,_0x4dde13){if(_0x289ac3['body']['id']){delete _0x289ac3[_0xc1b1('0x42')]['id'];}return db['Trigger'][_0xc1b1('0x44')]({'where':{'id':_0x289ac3[_0xc1b1('0x43')]['id']}})[_0xc1b1('0x1e')](handleEntityNotFound(_0x4ad9b7,null))[_0xc1b1('0x1e')](function(_0x1499d8){if(_0x1499d8){_0x289ac3[_0xc1b1('0x42')]['TriggerAnyId']=_0x1499d8['id'];return db[_0xc1b1('0x47')]['create'](_0x289ac3[_0xc1b1('0x42')]);}})[_0xc1b1('0x1e')](respondWithResult(_0x4ad9b7,null))[_0xc1b1('0x3d')](handleError(_0x4ad9b7,null));};exports[_0xc1b1('0x49')]=function(_0x2ab701,_0x486ee6,_0x579e56){var _0x5375af={};var _0x148f69={};var _0x3fd4a3;var _0x5d3b58;return db['Trigger']['findOne']({'where':{'id':_0x2ab701['params']['id']}})[_0xc1b1('0x1e')](handleEntityNotFound(_0x486ee6,null))[_0xc1b1('0x1e')](function(_0x110eef){if(_0x110eef){_0x3fd4a3=_0x110eef;_0x148f69['model']=_[_0xc1b1('0x27')](db[_0xc1b1('0x47')][_0xc1b1('0x25')]);_0x148f69[_0xc1b1('0x2a')]=_[_0xc1b1('0x27')](_0x2ab701[_0xc1b1('0x2a')]);_0x148f69[_0xc1b1('0x2b')]=_[_0xc1b1('0x2c')](_0x148f69[_0xc1b1('0x26')],_0x148f69['query']);_0x5375af[_0xc1b1('0x2d')]=_[_0xc1b1('0x2c')](_0x148f69[_0xc1b1('0x26')],qs[_0xc1b1('0x2e')](_0x2ab701['query'][_0xc1b1('0x2e')]));_0x5375af[_0xc1b1('0x2d')]=_0x5375af['attributes'][_0xc1b1('0x3e')]?_0x5375af['attributes']:_0x148f69[_0xc1b1('0x26')];_0x5375af['order']=qs[_0xc1b1('0x32')](_0x2ab701[_0xc1b1('0x2a')][_0xc1b1('0x32')]);_0x5375af[_0xc1b1('0x33')]=qs[_0xc1b1('0x2b')](_['pick'](_0x2ab701[_0xc1b1('0x2a')],_0x148f69[_0xc1b1('0x2b')]));if(_0x2ab701['query']['filter']){_0x5375af[_0xc1b1('0x33')]=_[_0xc1b1('0x37')](_0x5375af[_0xc1b1('0x33')],{'$or':_[_0xc1b1('0x39')](_0x5375af[_0xc1b1('0x2d')],function(_0x5298a0){var _0x2d30b4={};_0x2d30b4[_0x5298a0]={'$like':'%'+_0x2ab701[_0xc1b1('0x2a')]['filter']+'%'};return _0x2d30b4;})});}_0x5375af=_[_0xc1b1('0x37')]({},_0x5375af,_0x2ab701['options']);return _0x3fd4a3['getAllConditions'](_0x5375af);}})[_0xc1b1('0x1e')](function(_0x4caab4){if(_0x4caab4){_0x5d3b58=_0x4caab4[_0xc1b1('0x3e')];if(!_0x2ab701['query'][_0xc1b1('0x2f')](_0xc1b1('0x30'))){_0x5375af[_0xc1b1('0x16')]=qs['limit'](_0x2ab701[_0xc1b1('0x2a')][_0xc1b1('0x16')]);_0x5375af[_0xc1b1('0x31')]=qs['offset'](_0x2ab701['query'][_0xc1b1('0x31')]);}return _0x3fd4a3[_0xc1b1('0x49')](_0x5375af);}})[_0xc1b1('0x1e')](function(_0x16dcdb){if(_0x16dcdb){return _0x16dcdb?{'count':_0x5d3b58,'rows':_0x16dcdb}:null;}})['then'](respondWithResult(_0x486ee6,null))[_0xc1b1('0x3d')](handleError(_0x486ee6,null));};exports[_0xc1b1('0x4a')]=function(_0x30fe11,_0x4459c0,_0x5ad8d7){var _0x4d9371={};var _0x54ec56={};var _0x5220d4;var _0x29fc33;return db[_0xc1b1('0x24')][_0xc1b1('0x4b')]({'where':{'id':_0x30fe11[_0xc1b1('0x43')]['id']}})[_0xc1b1('0x1e')](handleEntityNotFound(_0x4459c0,null))[_0xc1b1('0x1e')](function(_0x458643){if(_0x458643){_0x5220d4=_0x458643;_0x54ec56['model']=_[_0xc1b1('0x27')](db[_0xc1b1('0x47')]['rawAttributes']);_0x54ec56['query']=_['keys'](_0x30fe11[_0xc1b1('0x2a')]);_0x54ec56[_0xc1b1('0x2b')]=_[_0xc1b1('0x2c')](_0x54ec56[_0xc1b1('0x26')],_0x54ec56[_0xc1b1('0x2a')]);_0x4d9371[_0xc1b1('0x2d')]=_[_0xc1b1('0x2c')](_0x54ec56[_0xc1b1('0x26')],qs['fields'](_0x30fe11[_0xc1b1('0x2a')][_0xc1b1('0x2e')]));_0x4d9371[_0xc1b1('0x2d')]=_0x4d9371['attributes'][_0xc1b1('0x3e')]?_0x4d9371['attributes']:_0x54ec56[_0xc1b1('0x26')];_0x4d9371[_0xc1b1('0x4c')]=qs[_0xc1b1('0x32')](_0x30fe11[_0xc1b1('0x2a')][_0xc1b1('0x32')]);_0x4d9371[_0xc1b1('0x33')]=qs['filters'](_['pick'](_0x30fe11[_0xc1b1('0x2a')],_0x54ec56[_0xc1b1('0x2b')]));if(_0x30fe11[_0xc1b1('0x2a')][_0xc1b1('0x38')]){_0x4d9371['where']=_[_0xc1b1('0x37')](_0x4d9371['where'],{'$or':_[_0xc1b1('0x39')](_0x4d9371[_0xc1b1('0x2d')],function(_0x2065d0){var _0x2a5b1b={};_0x2a5b1b[_0x2065d0]={'$like':'%'+_0x30fe11[_0xc1b1('0x2a')][_0xc1b1('0x38')]+'%'};return _0x2a5b1b;})});}_0x4d9371=_['merge']({},_0x4d9371,_0x30fe11['options']);return _0x5220d4[_0xc1b1('0x4a')](_0x4d9371);}})[_0xc1b1('0x1e')](function(_0x430cc4){if(_0x430cc4){_0x29fc33=_0x430cc4['length'];if(!_0x30fe11[_0xc1b1('0x2a')]['hasOwnProperty']('nolimit')){_0x4d9371[_0xc1b1('0x16')]=qs[_0xc1b1('0x16')](_0x30fe11[_0xc1b1('0x2a')]['limit']);_0x4d9371[_0xc1b1('0x31')]=qs['offset'](_0x30fe11[_0xc1b1('0x2a')][_0xc1b1('0x31')]);}return _0x5220d4['getAnyConditions'](_0x4d9371);}})['then'](function(_0x1172c3){if(_0x1172c3){return _0x1172c3?{'count':_0x29fc33,'rows':_0x1172c3}:null;}})[_0xc1b1('0x1e')](respondWithResult(_0x4459c0,null))[_0xc1b1('0x3d')](handleError(_0x4459c0,null));};exports[_0xc1b1('0x4d')]=function(_0x185a11,_0x1ffd37,_0x4d3617){if(_0x185a11[_0xc1b1('0x42')]['id']){delete _0x185a11[_0xc1b1('0x42')]['id'];}return db[_0xc1b1('0x24')][_0xc1b1('0x44')]({'where':{'id':_0x185a11[_0xc1b1('0x43')]['id']}})[_0xc1b1('0x1e')](handleEntityNotFound(_0x1ffd37,null))[_0xc1b1('0x1e')](function(_0x5d40a9){if(_0x5d40a9){_0x185a11[_0xc1b1('0x42')][_0xc1b1('0x4e')]=_0x5d40a9['id'];return db['Action'][_0xc1b1('0x41')](_0x185a11[_0xc1b1('0x42')]);}})[_0xc1b1('0x1e')](respondWithResult(_0x1ffd37,null))[_0xc1b1('0x3d')](handleError(_0x1ffd37,null));};exports[_0xc1b1('0x4f')]=function(_0x120563,_0x3525bf,_0x5ce70c){var _0x252f79={};var _0x1ec762={};var _0x567b0a;var _0x3c8fee;return db[_0xc1b1('0x24')][_0xc1b1('0x4b')]({'where':{'id':_0x120563['params']['id']}})[_0xc1b1('0x1e')](handleEntityNotFound(_0x3525bf,null))['then'](function(_0xbf3747){if(_0xbf3747){_0x567b0a=_0xbf3747;_0x1ec762[_0xc1b1('0x26')]=_[_0xc1b1('0x27')](db['Action'][_0xc1b1('0x25')]);_0x1ec762[_0xc1b1('0x2a')]=_[_0xc1b1('0x27')](_0x120563[_0xc1b1('0x2a')]);_0x1ec762[_0xc1b1('0x2b')]=_[_0xc1b1('0x2c')](_0x1ec762['model'],_0x1ec762[_0xc1b1('0x2a')]);_0x252f79[_0xc1b1('0x2d')]=_[_0xc1b1('0x2c')](_0x1ec762['model'],qs[_0xc1b1('0x2e')](_0x120563[_0xc1b1('0x2a')][_0xc1b1('0x2e')]));_0x252f79[_0xc1b1('0x2d')]=_0x252f79['attributes'][_0xc1b1('0x3e')]?_0x252f79[_0xc1b1('0x2d')]:_0x1ec762[_0xc1b1('0x26')];_0x252f79[_0xc1b1('0x4c')]=qs[_0xc1b1('0x32')](_0x120563[_0xc1b1('0x2a')][_0xc1b1('0x32')]);_0x252f79[_0xc1b1('0x33')]=qs[_0xc1b1('0x2b')](_[_0xc1b1('0x34')](_0x120563[_0xc1b1('0x2a')],_0x1ec762[_0xc1b1('0x2b')]));if(_0x120563['query'][_0xc1b1('0x38')]){_0x252f79[_0xc1b1('0x33')]=_[_0xc1b1('0x37')](_0x252f79[_0xc1b1('0x33')],{'$or':_[_0xc1b1('0x39')](_0x252f79[_0xc1b1('0x2d')],function(_0x35b2df){var _0x4b1385={};_0x4b1385[_0x35b2df]={'$like':'%'+_0x120563[_0xc1b1('0x2a')][_0xc1b1('0x38')]+'%'};return _0x4b1385;})});}_0x252f79=_[_0xc1b1('0x37')]({},_0x252f79,_0x120563['options']);return _0x567b0a[_0xc1b1('0x4f')](_0x252f79);}})[_0xc1b1('0x1e')](function(_0x133bcf){if(_0x133bcf){_0x3c8fee=_0x133bcf['length'];if(!_0x120563[_0xc1b1('0x2a')][_0xc1b1('0x2f')](_0xc1b1('0x30'))){_0x252f79[_0xc1b1('0x16')]=qs[_0xc1b1('0x16')](_0x120563[_0xc1b1('0x2a')][_0xc1b1('0x16')]);_0x252f79[_0xc1b1('0x31')]=qs[_0xc1b1('0x31')](_0x120563[_0xc1b1('0x2a')][_0xc1b1('0x31')]);}return _0x567b0a['getActions'](_0x252f79);}})[_0xc1b1('0x1e')](function(_0x28bede){if(_0x28bede){return _0x28bede?{'count':_0x3c8fee,'rows':_0x28bede}:null;}})[_0xc1b1('0x1e')](respondWithResult(_0x3525bf,null))[_0xc1b1('0x3d')](handleError(_0x3525bf,null));}; \ No newline at end of file +var _0x59cf=['model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','includeAll','include','params','options','find','catch','create','body','destroy','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','getAnyConditions','findOne','addAction','TriggerId','Action','getActions','fast-json-patch','request-promise','moment','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','reject','save','update','then','end','error','stack','name','send','index','Trigger','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection'];(function(_0x153a08,_0x8d956d){var _0x334eaf=function(_0x55f4ec){while(--_0x55f4ec){_0x153a08['push'](_0x153a08['shift']());}};_0x334eaf(++_0x8d956d);}(_0x59cf,0x158));var _0xf59c=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x59cf[_0x3ff085];return _0x2b68c3;};'use strict';var jsonpatch=require(_0xf59c('0x0'));var rp=require(_0xf59c('0x1'));var moment=require(_0xf59c('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf59c('0x3'));var csv=require(_0xf59c('0x4'));var ejs=require(_0xf59c('0x5'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf59c('0x6'));var crypto=require('crypto');var jsforce=require(_0xf59c('0x7'));var deskjs=require(_0xf59c('0x8'));var toCsv=require('to-csv');var querystring=require(_0xf59c('0x9'));var Papa=require(_0xf59c('0xa'));var qs=require('../../components/parsers/qs');var logger=require(_0xf59c('0xb'))(_0xf59c('0xc'));var utils=require(_0xf59c('0xd'));var config=require(_0xf59c('0xe'));var db=require(_0xf59c('0xf'))['db'];function respondWithStatusCode(_0x4b2e03,_0x4679fc){_0x4679fc=_0x4679fc||0xcc;return function(_0xd37639){if(_0xd37639){return _0x4b2e03[_0xf59c('0x10')](_0x4679fc);}return _0x4b2e03[_0xf59c('0x11')](_0x4679fc)['end']();};}function respondWithResult(_0x176cc8,_0x5691fc){_0x5691fc=_0x5691fc||0xc8;return function(_0x5598ef){if(_0x5598ef){return _0x176cc8[_0xf59c('0x11')](_0x5691fc)[_0xf59c('0x12')](_0x5598ef);}};}function respondWithFilteredResult(_0x2f9189,_0x3fb1fe){return function(_0x228e57){if(_0x228e57){var _0x14ad6e=_0x228e57[_0xf59c('0x13')],_0x23e363=_0x3fb1fe[_0xf59c('0x14')],_0x16620e=_0x3fb1fe['offset']+_0x3fb1fe[_0xf59c('0x15')],_0x3322f2;if(_0x16620e>=_0x14ad6e){_0x16620e=_0x14ad6e;_0x3322f2=0xc8;}else{_0x3322f2=0xce;}_0x2f9189[_0xf59c('0x11')](_0x3322f2);return _0x2f9189[_0xf59c('0x16')]('Content-Range',_0x23e363+'-'+_0x16620e+'/'+_0x14ad6e)[_0xf59c('0x12')](_0x228e57);}return null;};}function patchUpdates(_0x767e83){return function(_0x12cb1d){try{jsonpatch['apply'](_0x12cb1d,_0x767e83,!![]);}catch(_0x36abb9){return BPromise[_0xf59c('0x17')](_0x36abb9);}return _0x12cb1d[_0xf59c('0x18')]();};}function saveUpdates(_0x4ca790,_0x37b227){return function(_0x395e18){if(_0x395e18){return _0x395e18[_0xf59c('0x19')](_0x4ca790)[_0xf59c('0x1a')](function(_0x3f1ce6){return _0x3f1ce6;});}return null;};}function removeEntity(_0x2cae21,_0x5d0cc7){return function(_0x5ada38){if(_0x5ada38){return _0x5ada38['destroy']()[_0xf59c('0x1a')](function(){_0x2cae21['status'](0xcc)[_0xf59c('0x1b')]();});}};}function handleEntityNotFound(_0x55cf10,_0x3c3103){return function(_0x5a91c7){if(!_0x5a91c7){_0x55cf10[_0xf59c('0x10')](0x194);}return _0x5a91c7;};}function handleError(_0x37965d,_0x20c22e){_0x20c22e=_0x20c22e||0x1f4;return function(_0x372c11){logger[_0xf59c('0x1c')](_0x372c11[_0xf59c('0x1d')]);if(_0x372c11['name']){delete _0x372c11[_0xf59c('0x1e')];}_0x37965d[_0xf59c('0x11')](_0x20c22e)[_0xf59c('0x1f')](_0x372c11);};}exports[_0xf59c('0x20')]=function(_0x1651fd,_0x1db0ba){var _0x445daa={},_0x181665={},_0x303757={'count':0x0,'rows':[]};var _0x14cef6=db[_0xf59c('0x21')][_0xf59c('0x22')];_0x181665['model']=_[_0xf59c('0x23')](_0x14cef6);var _0x1958fe={'dateStart':_0x1651fd[_0xf59c('0x24')][_0xf59c('0x25')],'dateEnd':_0x1651fd[_0xf59c('0x24')]['dateEnd']};delete _0x1651fd[_0xf59c('0x24')][_0xf59c('0x25')];delete _0x1651fd[_0xf59c('0x24')][_0xf59c('0x26')];_0x181665['query']=_['keys'](_0x1651fd[_0xf59c('0x24')]);_0x181665[_0xf59c('0x27')]=_[_0xf59c('0x28')](_0x181665[_0xf59c('0x29')],_0x181665[_0xf59c('0x24')]);_0x445daa[_0xf59c('0x2a')]=_[_0xf59c('0x28')](_0x181665[_0xf59c('0x29')],qs['fields'](_0x1651fd['query'][_0xf59c('0x2b')]));_0x445daa[_0xf59c('0x2a')]=_0x445daa['attributes'][_0xf59c('0x2c')]?_0x445daa[_0xf59c('0x2a')]:_0x181665[_0xf59c('0x29')];if(!_0x1651fd['query'][_0xf59c('0x2d')](_0xf59c('0x2e'))){_0x445daa['limit']=qs['limit'](_0x1651fd[_0xf59c('0x24')][_0xf59c('0x15')]);_0x445daa['offset']=qs[_0xf59c('0x14')](_0x1651fd[_0xf59c('0x24')]['offset']);}_0x445daa[_0xf59c('0x2f')]=qs[_0xf59c('0x30')](_0x1651fd[_0xf59c('0x24')][_0xf59c('0x30')]);_0x445daa[_0xf59c('0x31')]=qs[_0xf59c('0x27')](_[_0xf59c('0x32')](_0x1651fd[_0xf59c('0x24')],_0x181665[_0xf59c('0x27')]));if(_0x1958fe[_0xf59c('0x25')]){if(_0x1958fe[_0xf59c('0x26')]){_0x1958fe['dateEnd']=moment(_0x1958fe[_0xf59c('0x26')])[_0xf59c('0x33')](0x1,_0xf59c('0x34'));}else{_0x1958fe['dateEnd']=moment(_0x1958fe['dateStart'])[_0xf59c('0x33')](0x1,_0xf59c('0x34'));}_[_0xf59c('0x35')](_0x445daa[_0xf59c('0x31')],{'createdAt':{'$gte':_0x1958fe[_0xf59c('0x25')],'$lte':_0x1958fe[_0xf59c('0x26')]}});}if(_0x1651fd[_0xf59c('0x24')][_0xf59c('0x36')]){_0x445daa[_0xf59c('0x31')]=_[_0xf59c('0x35')](_0x445daa[_0xf59c('0x31')],{'$or':_[_0xf59c('0x37')](_0x445daa[_0xf59c('0x2a')],function(_0x574bc6){var _0x5576d0={};_0x5576d0[_0x574bc6]={'$like':'%'+_0x1651fd[_0xf59c('0x24')][_0xf59c('0x36')]+'%'};return _0x5576d0;})});}_0x445daa=_[_0xf59c('0x35')]({},_0x445daa,_0x1651fd['options']);var _0x5b3cde={'where':_0x445daa[_0xf59c('0x31')]};return db[_0xf59c('0x21')][_0xf59c('0x13')](_0x5b3cde)[_0xf59c('0x1a')](function(_0x83a43f){_0x303757[_0xf59c('0x13')]=_0x83a43f;if(_0x1651fd['query'][_0xf59c('0x38')]){_0x445daa[_0xf59c('0x39')]=[{'all':!![]}];}return db[_0xf59c('0x21')]['findAll'](_0x445daa);})[_0xf59c('0x1a')](function(_0x244e0b){_0x303757['rows']=_0x244e0b;return _0x303757;})['then'](respondWithFilteredResult(_0x1db0ba,_0x445daa))['catch'](handleError(_0x1db0ba,null));};exports['show']=function(_0x458eb8,_0x3634d0){var _0x5edd5b={'raw':![],'where':{'id':_0x458eb8[_0xf59c('0x3a')]['id']}},_0x4265d4={};_0x4265d4[_0xf59c('0x29')]=_['keys'](db['Trigger'][_0xf59c('0x22')]);_0x4265d4['query']=_[_0xf59c('0x23')](_0x458eb8['query']);_0x4265d4['filters']=_[_0xf59c('0x28')](_0x4265d4[_0xf59c('0x29')],_0x4265d4['query']);_0x5edd5b['attributes']=_['intersection'](_0x4265d4[_0xf59c('0x29')],qs[_0xf59c('0x2b')](_0x458eb8[_0xf59c('0x24')]['fields']));_0x5edd5b[_0xf59c('0x2a')]=_0x5edd5b[_0xf59c('0x2a')][_0xf59c('0x2c')]?_0x5edd5b[_0xf59c('0x2a')]:_0x4265d4[_0xf59c('0x29')];if(_0x458eb8[_0xf59c('0x24')][_0xf59c('0x38')]){_0x5edd5b['include']=[{'all':!![]}];}_0x5edd5b=_[_0xf59c('0x35')]({},_0x5edd5b,_0x458eb8[_0xf59c('0x3b')]);return db['Trigger'][_0xf59c('0x3c')](_0x5edd5b)[_0xf59c('0x1a')](handleEntityNotFound(_0x3634d0,null))[_0xf59c('0x1a')](respondWithResult(_0x3634d0,null))[_0xf59c('0x3d')](handleError(_0x3634d0,null));};exports[_0xf59c('0x3e')]=function(_0x1a6a80,_0x1a0fa5){return db[_0xf59c('0x21')]['create'](_0x1a6a80[_0xf59c('0x3f')],{})['then'](respondWithResult(_0x1a0fa5,0xc9))[_0xf59c('0x3d')](handleError(_0x1a0fa5,null));};exports[_0xf59c('0x19')]=function(_0xe6d54f,_0x13e515){if(_0xe6d54f['body']['id']){delete _0xe6d54f['body']['id'];}return db['Trigger'][_0xf59c('0x3c')]({'where':{'id':_0xe6d54f[_0xf59c('0x3a')]['id']}})[_0xf59c('0x1a')](handleEntityNotFound(_0x13e515,null))['then'](saveUpdates(_0xe6d54f[_0xf59c('0x3f')],null))['then'](respondWithResult(_0x13e515,null))[_0xf59c('0x3d')](handleError(_0x13e515,null));};exports[_0xf59c('0x40')]=function(_0x51bf3a,_0x47e86b){return db[_0xf59c('0x21')][_0xf59c('0x3c')]({'where':{'id':_0x51bf3a[_0xf59c('0x3a')]['id']}})['then'](handleEntityNotFound(_0x47e86b,null))[_0xf59c('0x1a')](removeEntity(_0x47e86b,null))[_0xf59c('0x3d')](handleError(_0x47e86b,null));};exports[_0xf59c('0x41')]=function(_0x29fc5a,_0x3b3176,_0x5b7709){if(_0x29fc5a['body']['id']){delete _0x29fc5a[_0xf59c('0x3f')]['id'];}return db[_0xf59c('0x21')][_0xf59c('0x3c')]({'where':{'id':_0x29fc5a['params']['id']}})[_0xf59c('0x1a')](handleEntityNotFound(_0x3b3176,null))['then'](function(_0x5e20d8){if(_0x5e20d8){_0x29fc5a[_0xf59c('0x3f')][_0xf59c('0x42')]=_0x5e20d8['id'];return db[_0xf59c('0x43')][_0xf59c('0x3e')](_0x29fc5a[_0xf59c('0x3f')]);}})[_0xf59c('0x1a')](respondWithResult(_0x3b3176,null))[_0xf59c('0x3d')](handleError(_0x3b3176,null));};exports[_0xf59c('0x44')]=function(_0x311f,_0x4d7e4a,_0x357916){if(_0x311f[_0xf59c('0x3f')]['id']){delete _0x311f[_0xf59c('0x3f')]['id'];}return db['Trigger'][_0xf59c('0x3c')]({'where':{'id':_0x311f[_0xf59c('0x3a')]['id']}})[_0xf59c('0x1a')](handleEntityNotFound(_0x4d7e4a,null))[_0xf59c('0x1a')](function(_0x451253){if(_0x451253){_0x311f[_0xf59c('0x3f')][_0xf59c('0x45')]=_0x451253['id'];return db[_0xf59c('0x43')][_0xf59c('0x3e')](_0x311f[_0xf59c('0x3f')]);}})[_0xf59c('0x1a')](respondWithResult(_0x4d7e4a,null))[_0xf59c('0x3d')](handleError(_0x4d7e4a,null));};exports[_0xf59c('0x46')]=function(_0x408fc9,_0x664a6d,_0xf86dda){var _0x3ba27a={};var _0x16aa39={};var _0x394f17;var _0x154d84;return db['Trigger']['findOne']({'where':{'id':_0x408fc9[_0xf59c('0x3a')]['id']}})[_0xf59c('0x1a')](handleEntityNotFound(_0x664a6d,null))['then'](function(_0x1dcbc0){if(_0x1dcbc0){_0x394f17=_0x1dcbc0;_0x16aa39['model']=_[_0xf59c('0x23')](db[_0xf59c('0x43')][_0xf59c('0x22')]);_0x16aa39[_0xf59c('0x24')]=_['keys'](_0x408fc9[_0xf59c('0x24')]);_0x16aa39[_0xf59c('0x27')]=_[_0xf59c('0x28')](_0x16aa39[_0xf59c('0x29')],_0x16aa39[_0xf59c('0x24')]);_0x3ba27a[_0xf59c('0x2a')]=_[_0xf59c('0x28')](_0x16aa39[_0xf59c('0x29')],qs[_0xf59c('0x2b')](_0x408fc9[_0xf59c('0x24')][_0xf59c('0x2b')]));_0x3ba27a[_0xf59c('0x2a')]=_0x3ba27a['attributes'][_0xf59c('0x2c')]?_0x3ba27a[_0xf59c('0x2a')]:_0x16aa39[_0xf59c('0x29')];_0x3ba27a[_0xf59c('0x2f')]=qs[_0xf59c('0x30')](_0x408fc9['query']['sort']);_0x3ba27a[_0xf59c('0x31')]=qs['filters'](_['pick'](_0x408fc9[_0xf59c('0x24')],_0x16aa39[_0xf59c('0x27')]));if(_0x408fc9[_0xf59c('0x24')][_0xf59c('0x36')]){_0x3ba27a[_0xf59c('0x31')]=_['merge'](_0x3ba27a[_0xf59c('0x31')],{'$or':_[_0xf59c('0x37')](_0x3ba27a[_0xf59c('0x2a')],function(_0x2115ad){var _0x376297={};_0x376297[_0x2115ad]={'$like':'%'+_0x408fc9[_0xf59c('0x24')]['filter']+'%'};return _0x376297;})});}_0x3ba27a=_[_0xf59c('0x35')]({},_0x3ba27a,_0x408fc9[_0xf59c('0x3b')]);return _0x394f17['getAllConditions'](_0x3ba27a);}})[_0xf59c('0x1a')](function(_0xc3f7b7){if(_0xc3f7b7){_0x154d84=_0xc3f7b7['length'];if(!_0x408fc9[_0xf59c('0x24')][_0xf59c('0x2d')](_0xf59c('0x2e'))){_0x3ba27a[_0xf59c('0x15')]=qs['limit'](_0x408fc9['query'][_0xf59c('0x15')]);_0x3ba27a[_0xf59c('0x14')]=qs[_0xf59c('0x14')](_0x408fc9[_0xf59c('0x24')][_0xf59c('0x14')]);}return _0x394f17[_0xf59c('0x46')](_0x3ba27a);}})[_0xf59c('0x1a')](function(_0x125b08){if(_0x125b08){return _0x125b08?{'count':_0x154d84,'rows':_0x125b08}:null;}})[_0xf59c('0x1a')](respondWithResult(_0x664a6d,null))['catch'](handleError(_0x664a6d,null));};exports[_0xf59c('0x47')]=function(_0x53beac,_0x2bdfd3,_0x2d1d3e){var _0x53b683={};var _0x68ea73={};var _0x126d8b;var _0x4360a5;return db['Trigger'][_0xf59c('0x48')]({'where':{'id':_0x53beac[_0xf59c('0x3a')]['id']}})[_0xf59c('0x1a')](handleEntityNotFound(_0x2bdfd3,null))[_0xf59c('0x1a')](function(_0x196ab0){if(_0x196ab0){_0x126d8b=_0x196ab0;_0x68ea73['model']=_[_0xf59c('0x23')](db['Condition'][_0xf59c('0x22')]);_0x68ea73[_0xf59c('0x24')]=_[_0xf59c('0x23')](_0x53beac[_0xf59c('0x24')]);_0x68ea73[_0xf59c('0x27')]=_['intersection'](_0x68ea73[_0xf59c('0x29')],_0x68ea73[_0xf59c('0x24')]);_0x53b683[_0xf59c('0x2a')]=_[_0xf59c('0x28')](_0x68ea73[_0xf59c('0x29')],qs[_0xf59c('0x2b')](_0x53beac[_0xf59c('0x24')][_0xf59c('0x2b')]));_0x53b683[_0xf59c('0x2a')]=_0x53b683[_0xf59c('0x2a')][_0xf59c('0x2c')]?_0x53b683[_0xf59c('0x2a')]:_0x68ea73[_0xf59c('0x29')];_0x53b683[_0xf59c('0x2f')]=qs[_0xf59c('0x30')](_0x53beac[_0xf59c('0x24')][_0xf59c('0x30')]);_0x53b683['where']=qs[_0xf59c('0x27')](_[_0xf59c('0x32')](_0x53beac[_0xf59c('0x24')],_0x68ea73[_0xf59c('0x27')]));if(_0x53beac[_0xf59c('0x24')][_0xf59c('0x36')]){_0x53b683['where']=_[_0xf59c('0x35')](_0x53b683[_0xf59c('0x31')],{'$or':_[_0xf59c('0x37')](_0x53b683['attributes'],function(_0x59ffad){var _0x1b2a2a={};_0x1b2a2a[_0x59ffad]={'$like':'%'+_0x53beac['query'][_0xf59c('0x36')]+'%'};return _0x1b2a2a;})});}_0x53b683=_[_0xf59c('0x35')]({},_0x53b683,_0x53beac[_0xf59c('0x3b')]);return _0x126d8b[_0xf59c('0x47')](_0x53b683);}})[_0xf59c('0x1a')](function(_0x24af51){if(_0x24af51){_0x4360a5=_0x24af51['length'];if(!_0x53beac['query'][_0xf59c('0x2d')](_0xf59c('0x2e'))){_0x53b683[_0xf59c('0x15')]=qs[_0xf59c('0x15')](_0x53beac[_0xf59c('0x24')][_0xf59c('0x15')]);_0x53b683[_0xf59c('0x14')]=qs[_0xf59c('0x14')](_0x53beac[_0xf59c('0x24')][_0xf59c('0x14')]);}return _0x126d8b[_0xf59c('0x47')](_0x53b683);}})['then'](function(_0x3c1506){if(_0x3c1506){return _0x3c1506?{'count':_0x4360a5,'rows':_0x3c1506}:null;}})[_0xf59c('0x1a')](respondWithResult(_0x2bdfd3,null))['catch'](handleError(_0x2bdfd3,null));};exports[_0xf59c('0x49')]=function(_0x3893aa,_0x42ed08,_0x11600e){if(_0x3893aa[_0xf59c('0x3f')]['id']){delete _0x3893aa[_0xf59c('0x3f')]['id'];}return db[_0xf59c('0x21')][_0xf59c('0x3c')]({'where':{'id':_0x3893aa[_0xf59c('0x3a')]['id']}})[_0xf59c('0x1a')](handleEntityNotFound(_0x42ed08,null))[_0xf59c('0x1a')](function(_0x3d5785){if(_0x3d5785){_0x3893aa[_0xf59c('0x3f')][_0xf59c('0x4a')]=_0x3d5785['id'];return db[_0xf59c('0x4b')]['create'](_0x3893aa['body']);}})[_0xf59c('0x1a')](respondWithResult(_0x42ed08,null))[_0xf59c('0x3d')](handleError(_0x42ed08,null));};exports[_0xf59c('0x4c')]=function(_0x3758d4,_0x44903c,_0x15d545){var _0x5f5827={};var _0x1d6b3f={};var _0xa9d076;var _0x239b90;return db['Trigger'][_0xf59c('0x48')]({'where':{'id':_0x3758d4[_0xf59c('0x3a')]['id']}})[_0xf59c('0x1a')](handleEntityNotFound(_0x44903c,null))[_0xf59c('0x1a')](function(_0x244773){if(_0x244773){_0xa9d076=_0x244773;_0x1d6b3f[_0xf59c('0x29')]=_[_0xf59c('0x23')](db[_0xf59c('0x4b')][_0xf59c('0x22')]);_0x1d6b3f[_0xf59c('0x24')]=_[_0xf59c('0x23')](_0x3758d4['query']);_0x1d6b3f['filters']=_[_0xf59c('0x28')](_0x1d6b3f['model'],_0x1d6b3f[_0xf59c('0x24')]);_0x5f5827['attributes']=_[_0xf59c('0x28')](_0x1d6b3f[_0xf59c('0x29')],qs[_0xf59c('0x2b')](_0x3758d4[_0xf59c('0x24')][_0xf59c('0x2b')]));_0x5f5827[_0xf59c('0x2a')]=_0x5f5827[_0xf59c('0x2a')]['length']?_0x5f5827[_0xf59c('0x2a')]:_0x1d6b3f['model'];_0x5f5827[_0xf59c('0x2f')]=qs[_0xf59c('0x30')](_0x3758d4[_0xf59c('0x24')][_0xf59c('0x30')]);_0x5f5827['where']=qs[_0xf59c('0x27')](_[_0xf59c('0x32')](_0x3758d4['query'],_0x1d6b3f[_0xf59c('0x27')]));if(_0x3758d4['query'][_0xf59c('0x36')]){_0x5f5827[_0xf59c('0x31')]=_['merge'](_0x5f5827[_0xf59c('0x31')],{'$or':_[_0xf59c('0x37')](_0x5f5827['attributes'],function(_0x3d1aa0){var _0x4bc6ef={};_0x4bc6ef[_0x3d1aa0]={'$like':'%'+_0x3758d4[_0xf59c('0x24')][_0xf59c('0x36')]+'%'};return _0x4bc6ef;})});}_0x5f5827=_[_0xf59c('0x35')]({},_0x5f5827,_0x3758d4[_0xf59c('0x3b')]);return _0xa9d076[_0xf59c('0x4c')](_0x5f5827);}})[_0xf59c('0x1a')](function(_0x62c7f7){if(_0x62c7f7){_0x239b90=_0x62c7f7[_0xf59c('0x2c')];if(!_0x3758d4[_0xf59c('0x24')][_0xf59c('0x2d')]('nolimit')){_0x5f5827[_0xf59c('0x15')]=qs['limit'](_0x3758d4[_0xf59c('0x24')][_0xf59c('0x15')]);_0x5f5827[_0xf59c('0x14')]=qs[_0xf59c('0x14')](_0x3758d4[_0xf59c('0x24')]['offset']);}return _0xa9d076[_0xf59c('0x4c')](_0x5f5827);}})[_0xf59c('0x1a')](function(_0x2e2e96){if(_0x2e2e96){return _0x2e2e96?{'count':_0x239b90,'rows':_0x2e2e96}:null;}})['then'](respondWithResult(_0x44903c,null))['catch'](handleError(_0x44903c,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 4a86a96..29074c6 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 _0x87a3=['../../config/logger','exports','Trigger','lodash','util'];(function(_0x5f28b3,_0x5df4e2){var _0x25672f=function(_0xc99c65){while(--_0xc99c65){_0x5f28b3['push'](_0x5f28b3['shift']());}};_0x25672f(++_0x5df4e2);}(_0x87a3,0x18e));var _0x387a=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x87a3[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x387a('0x0'));var util=require(_0x387a('0x1'));var logger=require(_0x387a('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./trigger.attributes');module[_0x387a('0x3')]=function(_0x559cbc,_0x7fe2c6){return _0x559cbc['define'](_0x387a('0x4'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fdb=['exports','define','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x387675,_0x5be857){var _0x6bd67d=function(_0x5c9f95){while(--_0x5c9f95){_0x387675['push'](_0x387675['shift']());}};_0x6bd67d(++_0x5be857);}(_0x4fdb,0x1aa));var _0xb4fd=function(_0x74ea5d,_0x31c038){_0x74ea5d=_0x74ea5d-0x0;var _0x13b3c1=_0x4fdb[_0x74ea5d];return _0x13b3c1;};'use strict';var _=require('lodash');var util=require(_0xb4fd('0x0'));var logger=require(_0xb4fd('0x1'))(_0xb4fd('0x2'));var moment=require(_0xb4fd('0x3'));var BPromise=require(_0xb4fd('0x4'));var rp=require(_0xb4fd('0x5'));var attributes=require('./trigger.attributes');module[_0xb4fd('0x6')]=function(_0x357235,_0x167d6c){return _0x357235[_0xb4fd('0x7')]('Trigger',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 244df78..bb861cd 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 _0xfce2=['result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','map','include','model','stringify','ShowTrigger','find','debug','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x12e821,_0x6c5bd5){var _0x18a885=function(_0x4ae8ee){while(--_0x4ae8ee){_0x12e821['push'](_0x12e821['shift']());}};_0x18a885(++_0x6c5bd5);}(_0xfce2,0xf7));var _0x2fce=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfce2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2fce('0x0'));var util=require('util');var moment=require(_0x2fce('0x1'));var BPromise=require('bluebird');var rs=require(_0x2fce('0x2'));var fs=require('fs');var db=require(_0x2fce('0x3'))['db'];var utils=require(_0x2fce('0x4'));var logger=require(_0x2fce('0x5'))(_0x2fce('0x6'));var config=require('../../config/environment');var jayson=require(_0x2fce('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x219cb6,_0x5f201e,_0x2f607e){return new BPromise(function(_0x57121e,_0x1bff28){return client[_0x2fce('0x8')](_0x219cb6,_0x2f607e)[_0x2fce('0x9')](function(_0x351a11){logger['info'](_0x2fce('0xa'),_0x5f201e,_0x2fce('0xb'));logger['debug'](_0x2fce('0xc'),_0x5f201e,_0x2fce('0xb'),JSON['stringify'](_0x351a11));if(_0x351a11[_0x2fce('0xd')]){if(_0x351a11[_0x2fce('0xd')][_0x2fce('0xe')]===0x1f4){logger[_0x2fce('0xd')](_0x2fce('0xa'),_0x5f201e,_0x351a11[_0x2fce('0xd')]['message']);return _0x1bff28(_0x351a11[_0x2fce('0xd')]['message']);}logger['error'](_0x2fce('0xa'),_0x5f201e,_0x351a11['error'][_0x2fce('0xf')]);return _0x57121e(_0x351a11['error'][_0x2fce('0xf')]);}else{logger[_0x2fce('0x10')](_0x2fce('0xa'),_0x5f201e,_0x2fce('0xb'));_0x57121e(_0x351a11[_0x2fce('0x11')][_0x2fce('0xf')]);}})[_0x2fce('0x12')](function(_0x6c0016){logger[_0x2fce('0xd')](_0x2fce('0xa'),_0x5f201e,_0x6c0016);_0x1bff28(_0x6c0016);});});}exports[_0x2fce('0x13')]=function(_0x32b2cd){var _0x5025a3=this;return new Promise(function(_0x797ca9,_0x441319){return db[_0x2fce('0x14')][_0x2fce('0x15')]({'raw':_0x32b2cd[_0x2fce('0x16')]?_0x32b2cd['options'][_0x2fce('0x17')]===undefined?!![]:![]:!![],'where':_0x32b2cd[_0x2fce('0x16')]?_0x32b2cd[_0x2fce('0x16')][_0x2fce('0x18')]||null:null,'attributes':_0x32b2cd['options']?_0x32b2cd[_0x2fce('0x16')][_0x2fce('0x19')]||null:null,'limit':_0x32b2cd[_0x2fce('0x16')]?_0x32b2cd[_0x2fce('0x16')]['limit']||null:null,'include':_0x32b2cd['options']?_0x32b2cd[_0x2fce('0x16')]['include']?_[_0x2fce('0x1a')](_0x32b2cd[_0x2fce('0x16')][_0x2fce('0x1b')],function(_0x2a33c3){return{'model':db[_0x2a33c3[_0x2fce('0x1c')]],'as':_0x2a33c3['as'],'attributes':_0x2a33c3[_0x2fce('0x19')],'include':_0x2a33c3[_0x2fce('0x1b')]?_[_0x2fce('0x1a')](_0x2a33c3['include'],function(_0x2d61f3){return{'model':db[_0x2d61f3[_0x2fce('0x1c')]],'as':_0x2d61f3['as'],'attributes':_0x2d61f3[_0x2fce('0x19')],'include':_0x2d61f3['include']?_['map'](_0x2d61f3[_0x2fce('0x1b')],function(_0x35a781){return{'model':db[_0x35a781[_0x2fce('0x1c')]],'as':_0x35a781['as'],'attributes':_0x35a781[_0x2fce('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x312cb3){logger[_0x2fce('0x10')]('GetTrigger',_0x32b2cd);logger['debug'](_0x2fce('0x13'),_0x32b2cd,JSON[_0x2fce('0x1d')](_0x312cb3));_0x797ca9(_0x312cb3);})[_0x2fce('0x12')](function(_0x7f0093){logger['error'](_0x2fce('0x13'),_0x7f0093[_0x2fce('0xf')],_0x32b2cd);_0x441319(_0x5025a3['error'](0x1f4,_0x7f0093[_0x2fce('0xf')]));});});};exports[_0x2fce('0x1e')]=function(_0x1c5b0b){var _0x35e435=this;return new Promise(function(_0x3bd3d7,_0x1cd69e){return db[_0x2fce('0x14')][_0x2fce('0x1f')]({'raw':_0x1c5b0b[_0x2fce('0x16')]?_0x1c5b0b['options'][_0x2fce('0x17')]===undefined?!![]:![]:!![],'where':_0x1c5b0b[_0x2fce('0x16')]?_0x1c5b0b[_0x2fce('0x16')][_0x2fce('0x18')]||null:null,'attributes':_0x1c5b0b[_0x2fce('0x16')]?_0x1c5b0b[_0x2fce('0x16')]['attributes']||null:null,'include':_0x1c5b0b[_0x2fce('0x16')]?_0x1c5b0b[_0x2fce('0x16')]['include']?_[_0x2fce('0x1a')](_0x1c5b0b[_0x2fce('0x16')]['include'],function(_0x217e62){return{'model':db[_0x217e62[_0x2fce('0x1c')]],'as':_0x217e62['as'],'attributes':_0x217e62[_0x2fce('0x19')],'include':_0x217e62[_0x2fce('0x1b')]?_[_0x2fce('0x1a')](_0x217e62[_0x2fce('0x1b')],function(_0x59122f){return{'model':db[_0x59122f[_0x2fce('0x1c')]],'as':_0x59122f['as'],'attributes':_0x59122f['attributes'],'include':_0x59122f[_0x2fce('0x1b')]?_[_0x2fce('0x1a')](_0x59122f[_0x2fce('0x1b')],function(_0x5449d5){return{'model':db[_0x5449d5[_0x2fce('0x1c')]],'as':_0x5449d5['as'],'attributes':_0x5449d5[_0x2fce('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2fce('0x9')](function(_0x402c90){logger['info'](_0x2fce('0x1e'),_0x1c5b0b);logger[_0x2fce('0x20')]('ShowTrigger',_0x1c5b0b,JSON['stringify'](_0x402c90));_0x3bd3d7(_0x402c90);})[_0x2fce('0x12')](function(_0x1cd006){logger[_0x2fce('0xd')]('ShowTrigger',_0x1cd006[_0x2fce('0xf')],_0x1c5b0b);_0x1cd69e(_0x35e435[_0x2fce('0xd')](0x1f4,_0x1cd006[_0x2fce('0xf')]));});});}; \ No newline at end of file +var _0x897c=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','GetTrigger','Trigger','options','raw','where','include','map','model','attributes','ShowTrigger','catch','lodash','util','moment'];(function(_0x1a466a,_0x3916fd){var _0x2628e9=function(_0x5b6ac9){while(--_0x5b6ac9){_0x1a466a['push'](_0x1a466a['shift']());}};_0x2628e9(++_0x3916fd);}(_0x897c,0x15d));var _0xc897=function(_0x15ff12,_0x157e68){_0x15ff12=_0x15ff12-0x0;var _0x2f86fa=_0x897c[_0x15ff12];return _0x2f86fa;};'use strict';var _=require(_0xc897('0x0'));var util=require(_0xc897('0x1'));var moment=require(_0xc897('0x2'));var BPromise=require(_0xc897('0x3'));var rs=require(_0xc897('0x4'));var fs=require('fs');var db=require(_0xc897('0x5'))['db'];var utils=require(_0xc897('0x6'));var logger=require(_0xc897('0x7'))(_0xc897('0x8'));var config=require(_0xc897('0x9'));var jayson=require(_0xc897('0xa'));var client=jayson[_0xc897('0xb')][_0xc897('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5b002c,_0x182380,_0x42fcee){return new BPromise(function(_0x5022a4,_0x4a7847){return client['request'](_0x5b002c,_0x42fcee)[_0xc897('0xd')](function(_0x2da7cf){logger[_0xc897('0xe')](_0xc897('0xf'),_0x182380,_0xc897('0x10'));logger[_0xc897('0x11')]('Trigger,\x20%s,\x20%s,\x20%s',_0x182380,_0xc897('0x10'),JSON[_0xc897('0x12')](_0x2da7cf));if(_0x2da7cf[_0xc897('0x13')]){if(_0x2da7cf['error']['code']===0x1f4){logger[_0xc897('0x13')](_0xc897('0xf'),_0x182380,_0x2da7cf[_0xc897('0x13')][_0xc897('0x14')]);return _0x4a7847(_0x2da7cf[_0xc897('0x13')]['message']);}logger['error']('Trigger,\x20%s,\x20%s',_0x182380,_0x2da7cf[_0xc897('0x13')][_0xc897('0x14')]);return _0x5022a4(_0x2da7cf['error'][_0xc897('0x14')]);}else{logger['info'](_0xc897('0xf'),_0x182380,'request\x20sent');_0x5022a4(_0x2da7cf['result']['message']);}})['catch'](function(_0x2a854b){logger[_0xc897('0x13')]('Trigger,\x20%s,\x20%s',_0x182380,_0x2a854b);_0x4a7847(_0x2a854b);});});}exports[_0xc897('0x15')]=function(_0x7ba9df){var _0x2cbeb5=this;return new Promise(function(_0x84b634,_0x291670){return db[_0xc897('0x16')]['findAll']({'raw':_0x7ba9df[_0xc897('0x17')]?_0x7ba9df[_0xc897('0x17')][_0xc897('0x18')]===undefined?!![]:![]:!![],'where':_0x7ba9df[_0xc897('0x17')]?_0x7ba9df[_0xc897('0x17')][_0xc897('0x19')]||null:null,'attributes':_0x7ba9df[_0xc897('0x17')]?_0x7ba9df[_0xc897('0x17')]['attributes']||null:null,'limit':_0x7ba9df[_0xc897('0x17')]?_0x7ba9df[_0xc897('0x17')]['limit']||null:null,'include':_0x7ba9df['options']?_0x7ba9df[_0xc897('0x17')][_0xc897('0x1a')]?_[_0xc897('0x1b')](_0x7ba9df[_0xc897('0x17')][_0xc897('0x1a')],function(_0x46b88f){return{'model':db[_0x46b88f[_0xc897('0x1c')]],'as':_0x46b88f['as'],'attributes':_0x46b88f[_0xc897('0x1d')],'include':_0x46b88f['include']?_[_0xc897('0x1b')](_0x46b88f['include'],function(_0x4bd606){return{'model':db[_0x4bd606[_0xc897('0x1c')]],'as':_0x4bd606['as'],'attributes':_0x4bd606[_0xc897('0x1d')],'include':_0x4bd606[_0xc897('0x1a')]?_[_0xc897('0x1b')](_0x4bd606[_0xc897('0x1a')],function(_0x3e99f2){return{'model':db[_0x3e99f2[_0xc897('0x1c')]],'as':_0x3e99f2['as'],'attributes':_0x3e99f2[_0xc897('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc897('0xd')](function(_0x5c290c){logger[_0xc897('0xe')](_0xc897('0x15'),_0x7ba9df);logger[_0xc897('0x11')](_0xc897('0x15'),_0x7ba9df,JSON['stringify'](_0x5c290c));_0x84b634(_0x5c290c);})['catch'](function(_0x2e0ee9){logger[_0xc897('0x13')]('GetTrigger',_0x2e0ee9[_0xc897('0x14')],_0x7ba9df);_0x291670(_0x2cbeb5[_0xc897('0x13')](0x1f4,_0x2e0ee9['message']));});});};exports[_0xc897('0x1e')]=function(_0x388ce0){var _0x3e46b6=this;return new Promise(function(_0x13042a,_0x5b81cf){return db[_0xc897('0x16')]['find']({'raw':_0x388ce0['options']?_0x388ce0[_0xc897('0x17')][_0xc897('0x18')]===undefined?!![]:![]:!![],'where':_0x388ce0['options']?_0x388ce0[_0xc897('0x17')][_0xc897('0x19')]||null:null,'attributes':_0x388ce0[_0xc897('0x17')]?_0x388ce0[_0xc897('0x17')][_0xc897('0x1d')]||null:null,'include':_0x388ce0[_0xc897('0x17')]?_0x388ce0[_0xc897('0x17')]['include']?_[_0xc897('0x1b')](_0x388ce0[_0xc897('0x17')][_0xc897('0x1a')],function(_0x14f734){return{'model':db[_0x14f734[_0xc897('0x1c')]],'as':_0x14f734['as'],'attributes':_0x14f734[_0xc897('0x1d')],'include':_0x14f734[_0xc897('0x1a')]?_[_0xc897('0x1b')](_0x14f734[_0xc897('0x1a')],function(_0x38bcf9){return{'model':db[_0x38bcf9['model']],'as':_0x38bcf9['as'],'attributes':_0x38bcf9[_0xc897('0x1d')],'include':_0x38bcf9[_0xc897('0x1a')]?_['map'](_0x38bcf9['include'],function(_0x4692b1){return{'model':db[_0x4692b1[_0xc897('0x1c')]],'as':_0x4692b1['as'],'attributes':_0x4692b1[_0xc897('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4fc2fd){logger[_0xc897('0xe')](_0xc897('0x1e'),_0x388ce0);logger[_0xc897('0x11')](_0xc897('0x1e'),_0x388ce0,JSON[_0xc897('0x12')](_0x4fc2fd));_0x13042a(_0x4fc2fd);})[_0xc897('0x1f')](function(_0x52c2ad){logger['error'](_0xc897('0x1e'),_0x52c2ad[_0xc897('0x14')],_0x388ce0);_0x5b81cf(_0x3e46b6['error'](0x1f4,_0x52c2ad['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index e4bf7ac..296e93f 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 _0x4a2b=['exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','clone','create','put','/:id','update'];(function(_0x5292c6,_0x1ed701){var _0x325c37=function(_0x4f3d68){while(--_0x4f3d68){_0x5292c6['push'](_0x5292c6['shift']());}};_0x325c37(++_0x1ed701);}(_0x4a2b,0xa1));var _0xb4a2=function(_0x51571c,_0x319c1b){_0x51571c=_0x51571c-0x0;var _0x47b024=_0x4a2b[_0x51571c];return _0x47b024;};'use strict';var multer=require('multer');var util=require(_0xb4a2('0x0'));var path=require('path');var express=require('express');var router=express[_0xb4a2('0x1')]();var auth=require(_0xb4a2('0x2'));var interaction=require(_0xb4a2('0x3'));var config=require(_0xb4a2('0x4'));var controller=require('./trunk.controller');router[_0xb4a2('0x5')]('/',auth[_0xb4a2('0x6')](),controller[_0xb4a2('0x7')]);router[_0xb4a2('0x5')]('/:id',auth[_0xb4a2('0x6')](),controller[_0xb4a2('0x8')]);router[_0xb4a2('0x9')]('/:id/clone',auth[_0xb4a2('0x6')](),controller[_0xb4a2('0xa')]);router[_0xb4a2('0x9')]('/',auth['isAuthenticated'](),controller[_0xb4a2('0xb')]);router[_0xb4a2('0xc')](_0xb4a2('0xd'),auth[_0xb4a2('0x6')](),controller[_0xb4a2('0xe')]);router['delete'](_0xb4a2('0xd'),auth[_0xb4a2('0x6')](),controller['destroy']);module[_0xb4a2('0xf')]=router; \ No newline at end of file +var _0x318f=['multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','/:id/clone','clone','create','put','delete','destroy','exports'];(function(_0x36a5c2,_0x1674d5){var _0x4692e9=function(_0x1877e5){while(--_0x1877e5){_0x36a5c2['push'](_0x36a5c2['shift']());}};_0x4692e9(++_0x1674d5);}(_0x318f,0xe4));var _0xf318=function(_0x2a7d66,_0x3f2955){_0x2a7d66=_0x2a7d66-0x0;var _0x42f9bb=_0x318f[_0x2a7d66];return _0x42f9bb;};'use strict';var multer=require(_0xf318('0x0'));var util=require(_0xf318('0x1'));var path=require(_0xf318('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xf318('0x3'));var interaction=require(_0xf318('0x4'));var config=require(_0xf318('0x5'));var controller=require('./trunk.controller');router['get']('/',auth[_0xf318('0x6')](),controller[_0xf318('0x7')]);router[_0xf318('0x8')](_0xf318('0x9'),auth[_0xf318('0x6')](),controller[_0xf318('0xa')]);router[_0xf318('0xb')](_0xf318('0xc'),auth['isAuthenticated'](),controller[_0xf318('0xd')]);router[_0xf318('0xb')]('/',auth[_0xf318('0x6')](),controller[_0xf318('0xe')]);router[_0xf318('0xf')](_0xf318('0x9'),auth[_0xf318('0x6')](),controller['update']);router[_0xf318('0x10')](_0xf318('0x9'),auth[_0xf318('0x6')](),controller[_0xf318('0x11')]);module[_0xf318('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 530f0d4..df48f59 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 _0x2032=['all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','always','accept','refuse','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','exports','STRING','name','friend','user','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','transport','getDataValue','rfc2833','inband','auto','yes','nonat','update','outgoing','setDataValue','join','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'];(function(_0x1fc053,_0xbf2b58){var _0xc5c4d9=function(_0x46c2db){while(--_0x46c2db){_0x1fc053['push'](_0x1fc053['shift']());}};_0xc5c4d9(++_0xbf2b58);}(_0x2032,0xd9));var _0x2203=function(_0x4e2e86,_0x42be8f){_0x4e2e86=_0x4e2e86-0x0;var _0x11b307=_0x2032[_0x4e2e86];return _0x11b307;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x2203('0x3'),_0x2203('0x4'),'peer'),'allowNull':![],'defaultValue':_0x2203('0x3')},'context':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'defaultValue':_0x2203('0x5')},'callingpres':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x7'),_0x2203('0x8'),_0x2203('0x9'),_0x2203('0xa'),_0x2203('0xb'),_0x2203('0xc'),_0x2203('0xd'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x2203('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x2203('0x1')]},'remotesecret':{'type':Sequelize[_0x2203('0x1')]},'transport':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'udp','set':function(_0x849049){this['setDataValue'](_0x2203('0xe'),_0x849049?_0x849049['join'](','):null);},'get':function(){return this[_0x2203('0xf')](_0x2203('0xe'))?this['getDataValue']('transport')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x2203('0x10'),'info','shortinfo',_0x2203('0x11'),_0x2203('0x12')),'defaultValue':_0x2203('0x10')},'directmedia':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no',_0x2203('0x14'),_0x2203('0x15'),_0x2203('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x2203('0x1')]},'nat':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x3f9ef6){this[_0x2203('0x17')]('nat',_0x3f9ef6?_0x3f9ef6[_0x2203('0x18')](','):null);},'get':function(){return this['getDataValue'](_0x2203('0x19'))?this[_0x2203('0xf')](_0x2203('0x19'))[_0x2203('0x1a')](','):null;},'comment':_0x2203('0x1b')},'callgroup':{'type':Sequelize[_0x2203('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x2203('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2203('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x2203('0x1c')},'allow':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x3ee25b){this['setDataValue']('allow',_0x3ee25b?_0x3ee25b[_0x2203('0x18')](';'):_0x2203('0x1d'));},'get':function(){return this[_0x2203('0xf')](_0x2203('0x1e'))?this[_0x2203('0xf')](_0x2203('0x1e'))[_0x2203('0x1a')](';'):null;},'comment':_0x2203('0x1f')},'autoframing':{'type':Sequelize['ENUM'](_0x2203('0x13'),'no')},'insecure':{'type':Sequelize[_0x2203('0x1')],'defaultValue':_0x2203('0x20'),'set':function(_0x5f11bf){this[_0x2203('0x17')](_0x2203('0x21'),_0x5f11bf?_0x5f11bf['join'](','):null);},'get':function(){return this[_0x2203('0xf')](_0x2203('0x21'))?this[_0x2203('0xf')](_0x2203('0x21'))[_0x2203('0x1a')](','):null;},'comment':_0x2203('0x22')},'trustrpid':{'type':Sequelize[_0x2203('0x6')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no','never')},'promiscredir':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'useclientcode':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x2203('0x1')]},'callerid':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x2203('0x6')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x2203('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'allowsubscribe':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x2203('0x13'),'no')},'ignoresdpversion':{'type':Sequelize[_0x2203('0x6')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x2203('0x1')]},'template':{'type':Sequelize[_0x2203('0x1')]},'videosupport':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no',_0x2203('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2203('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'mailbox':{'type':Sequelize[_0x2203('0x1')]},'session_timers':{'type':Sequelize['ENUM'](_0x2203('0x25'),_0x2203('0x26'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x2203('0x23')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x2203('0x27'),_0x2203('0x28')),'defaultValue':_0x2203('0x28')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x2203('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x2203('0x23')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x2203('0x13'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x2203('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x2203('0x1')]},'defaultuser':{'type':Sequelize[_0x2203('0x1')]},'rtptimeout':{'type':Sequelize[_0x2203('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2203('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no',_0x2203('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2203('0x1')]},'callbackextension':{'type':Sequelize[_0x2203('0x1')]},'timert1':{'type':Sequelize[_0x2203('0x23')](0xb)},'timerb':{'type':Sequelize[_0x2203('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x2203('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x2203('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x2203('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x2203('0x1')]},'use_q850_reason':{'type':Sequelize[_0x2203('0x1')]},'maxforwards':{'type':Sequelize[_0x2203('0x23')](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2203('0x6')]('yes','no')},'force_avp':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'icesupport':{'type':Sequelize[_0x2203('0x6')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x2203('0x13'),'no')},'dtlsverify':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no',_0x2203('0x2a'),_0x2203('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x2203('0x23')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x2203('0x1')]},'dtlscipher':{'type':Sequelize[_0x2203('0x1')]},'dtlscafile':{'type':Sequelize[_0x2203('0x1')]},'dtlscapath':{'type':Sequelize[_0x2203('0x1')]},'dtlssetup':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x2c'),_0x2203('0x2d'),_0x2203('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2203('0x1')]},'usereqphone':{'type':Sequelize[_0x2203('0x6')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2203('0x1')]},'recordofffeature':{'type':Sequelize[_0x2203('0x1')]},'call_limit':{'type':Sequelize[_0x2203('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2203('0x6')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x2203('0x13'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x2203('0x1')]},'mohsuggest':{'type':Sequelize[_0x2203('0x1')]},'parkinglot':{'type':Sequelize[_0x2203('0x1')]},'description':{'type':Sequelize[_0x2203('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x2203('0x2f')},'canreinvite':{'type':Sequelize[_0x2203('0x6')]('yes','no',_0x2203('0x14'),_0x2203('0x15'),_0x2203('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2203('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'no'}}; \ No newline at end of file +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(_0x3950b6,_0x1c9933){var _0x4e0fd6=function(_0x5c1910){while(--_0x5c1910){_0x3950b6['push'](_0x3950b6['shift']());}};_0x4e0fd6(++_0x1c9933);}(_0x757a,0xde));var _0xa757=function(_0x1d748d,_0x44ba93){_0x1d748d=_0x1d748d-0x0;var _0x513062=_0x757a[_0x1d748d];return _0x513062;};'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 160cf99..f2a0f94 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 _0x6e59=['sort','where','pick','add','day','merge','filter','map','options','includeAll','include','rows','show','params','rawAttributes','find','clone','createdAt','updatedAt','body','omit','create','findAll','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','Trunk','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x4c0ac9,_0x540ed1){var _0x507a30=function(_0x11422a){while(--_0x11422a){_0x4c0ac9['push'](_0x4c0ac9['shift']());}};_0x507a30(++_0x540ed1);}(_0x6e59,0xe8));var _0x96e5=function(_0x280932,_0x38cad5){_0x280932=_0x280932-0x0;var _0x3ce8bb=_0x6e59[_0x280932];return _0x3ce8bb;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x96e5('0x0'));var moment=require(_0x96e5('0x1'));var BPromise=require(_0x96e5('0x2'));var Mustache=require(_0x96e5('0x3'));var util=require(_0x96e5('0x4'));var path=require(_0x96e5('0x5'));var sox=require(_0x96e5('0x6'));var csv=require('to-csv');var ejs=require(_0x96e5('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x96e5('0x8'));var crypto=require(_0x96e5('0x9'));var jsforce=require(_0x96e5('0xa'));var deskjs=require(_0x96e5('0xb'));var toCsv=require('to-csv');var querystring=require(_0x96e5('0xc'));var Papa=require(_0x96e5('0xd'));var qs=require(_0x96e5('0xe'));var logger=require(_0x96e5('0xf'))(_0x96e5('0x10'));var utils=require(_0x96e5('0x11'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x96e5('0x12'));var client=jayson[_0x96e5('0x13')][_0x96e5('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x53d95b,_0x137ee0,_0x3be2a2,_0x3fea72){return new BPromise(function(_0x18bb93,_0x20ff29){var _0x3ba7b3=_0x3fea72||client;return _0x3ba7b3[_0x96e5('0x15')](_0x53d95b,_0x3be2a2)[_0x96e5('0x16')](function(_0x11b2c3){logger[_0x96e5('0x17')](_0x96e5('0x18'),_0x137ee0,_0x96e5('0x19'));logger['debug'](_0x96e5('0x1a'),_0x137ee0,_0x96e5('0x19'),JSON[_0x96e5('0x1b')](_0x11b2c3));if(_0x11b2c3[_0x96e5('0x1c')]){if(_0x11b2c3[_0x96e5('0x1c')][_0x96e5('0x1d')]===0x1f4){logger[_0x96e5('0x1c')](_0x96e5('0x18'),_0x137ee0,_0x11b2c3['error'][_0x96e5('0x1e')]);return _0x20ff29(_0x11b2c3[_0x96e5('0x1c')]['message']);}logger['error'](_0x96e5('0x18'),_0x137ee0,_0x11b2c3[_0x96e5('0x1c')][_0x96e5('0x1e')]);return _0x18bb93(_0x11b2c3[_0x96e5('0x1c')][_0x96e5('0x1e')]);}else{logger[_0x96e5('0x17')](_0x96e5('0x18'),_0x137ee0,_0x96e5('0x19'));_0x18bb93(_0x11b2c3[_0x96e5('0x1f')][_0x96e5('0x1e')]);}})[_0x96e5('0x20')](function(_0x357b56){logger[_0x96e5('0x1c')](_0x96e5('0x18'),_0x137ee0,_0x357b56);_0x20ff29(_0x357b56);});});}function respondWithStatusCode(_0xed9044,_0x1a989c){_0x1a989c=_0x1a989c||0xcc;return function(_0xfffc2d){if(_0xfffc2d){return _0xed9044[_0x96e5('0x21')](_0x1a989c);}return _0xed9044[_0x96e5('0x22')](_0x1a989c)['end']();};}function respondWithResult(_0x16bb7d,_0x67bef1){_0x67bef1=_0x67bef1||0xc8;return function(_0x817891){if(_0x817891){return _0x16bb7d['status'](_0x67bef1)['json'](_0x817891);}};}function respondWithFilteredResult(_0x2e3712,_0x7addf0){return function(_0x50c834){if(_0x50c834){var _0x5273f2=_0x50c834[_0x96e5('0x23')],_0x352647=_0x7addf0[_0x96e5('0x24')],_0x10bc86=_0x7addf0[_0x96e5('0x24')]+_0x7addf0[_0x96e5('0x25')],_0x4b4c9c;if(_0x10bc86>=_0x5273f2){_0x10bc86=_0x5273f2;_0x4b4c9c=0xc8;}else{_0x4b4c9c=0xce;}_0x2e3712[_0x96e5('0x22')](_0x4b4c9c);return _0x2e3712['set'](_0x96e5('0x26'),_0x352647+'-'+_0x10bc86+'/'+_0x5273f2)['json'](_0x50c834);}return null;};}function patchUpdates(_0x24b5f6){return function(_0x22ada7){try{jsonpatch[_0x96e5('0x27')](_0x22ada7,_0x24b5f6,!![]);}catch(_0x469058){return BPromise[_0x96e5('0x28')](_0x469058);}return _0x22ada7[_0x96e5('0x29')]();};}function saveUpdates(_0x12aa3a,_0x5b3b21){return function(_0x1e4fdb){if(_0x1e4fdb){return _0x1e4fdb[_0x96e5('0x2a')](_0x12aa3a)[_0x96e5('0x16')](function(_0xc264ab){return _0xc264ab;});}return null;};}function removeEntity(_0x58a3a1,_0x4ff609){return function(_0x531a4d){if(_0x531a4d){return _0x531a4d[_0x96e5('0x2b')]()[_0x96e5('0x16')](function(){_0x58a3a1[_0x96e5('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x466fd3,_0x53aab7){return function(_0x3fad61){if(!_0x3fad61){_0x466fd3[_0x96e5('0x21')](0x194);}return _0x3fad61;};}function handleError(_0x300bfc,_0x5e52aa){_0x5e52aa=_0x5e52aa||0x1f4;return function(_0x17e68a){logger[_0x96e5('0x1c')](_0x17e68a[_0x96e5('0x2c')]);if(_0x17e68a[_0x96e5('0x2d')]){delete _0x17e68a[_0x96e5('0x2d')];}_0x300bfc['status'](_0x5e52aa)[_0x96e5('0x2e')](_0x17e68a);};}exports[_0x96e5('0x2f')]=function(_0x4c58c1,_0x33f9f7){var _0x329c2d={},_0x21a38b={},_0xf81755={'count':0x0,'rows':[]};var _0x20389b=db[_0x96e5('0x30')]['rawAttributes'];_0x21a38b[_0x96e5('0x31')]=_[_0x96e5('0x32')](_0x20389b);var _0x2ccd16={'dateStart':_0x4c58c1['query']['dateStart'],'dateEnd':_0x4c58c1[_0x96e5('0x33')][_0x96e5('0x34')]};delete _0x4c58c1[_0x96e5('0x33')][_0x96e5('0x35')];delete _0x4c58c1[_0x96e5('0x33')]['dateEnd'];_0x21a38b[_0x96e5('0x33')]=_[_0x96e5('0x32')](_0x4c58c1[_0x96e5('0x33')]);_0x21a38b[_0x96e5('0x36')]=_[_0x96e5('0x37')](_0x21a38b[_0x96e5('0x31')],_0x21a38b['query']);_0x329c2d[_0x96e5('0x38')]=_['intersection'](_0x21a38b['model'],qs[_0x96e5('0x39')](_0x4c58c1[_0x96e5('0x33')]['fields']));_0x329c2d['attributes']=_0x329c2d[_0x96e5('0x38')][_0x96e5('0x3a')]?_0x329c2d['attributes']:_0x21a38b[_0x96e5('0x31')];if(!_0x4c58c1[_0x96e5('0x33')][_0x96e5('0x3b')](_0x96e5('0x3c'))){_0x329c2d[_0x96e5('0x25')]=qs['limit'](_0x4c58c1[_0x96e5('0x33')][_0x96e5('0x25')]);_0x329c2d[_0x96e5('0x24')]=qs[_0x96e5('0x24')](_0x4c58c1[_0x96e5('0x33')][_0x96e5('0x24')]);}_0x329c2d[_0x96e5('0x3d')]=qs['sort'](_0x4c58c1[_0x96e5('0x33')][_0x96e5('0x3e')]);_0x329c2d[_0x96e5('0x3f')]=qs[_0x96e5('0x36')](_[_0x96e5('0x40')](_0x4c58c1['query'],_0x21a38b[_0x96e5('0x36')]));if(_0x2ccd16[_0x96e5('0x35')]){if(_0x2ccd16[_0x96e5('0x34')]){_0x2ccd16[_0x96e5('0x34')]=moment(_0x2ccd16[_0x96e5('0x34')])[_0x96e5('0x41')](0x1,_0x96e5('0x42'));}else{_0x2ccd16[_0x96e5('0x34')]=moment(_0x2ccd16[_0x96e5('0x35')])[_0x96e5('0x41')](0x1,'day');}_[_0x96e5('0x43')](_0x329c2d[_0x96e5('0x3f')],{'createdAt':{'$gte':_0x2ccd16[_0x96e5('0x35')],'$lte':_0x2ccd16[_0x96e5('0x34')]}});}if(_0x4c58c1[_0x96e5('0x33')][_0x96e5('0x44')]){_0x329c2d[_0x96e5('0x3f')]=_['merge'](_0x329c2d['where'],{'$or':_[_0x96e5('0x45')](_0x329c2d[_0x96e5('0x38')],function(_0x53e16a){var _0x3c4844={};_0x3c4844[_0x53e16a]={'$like':'%'+_0x4c58c1[_0x96e5('0x33')][_0x96e5('0x44')]+'%'};return _0x3c4844;})});}_0x329c2d=_[_0x96e5('0x43')]({},_0x329c2d,_0x4c58c1[_0x96e5('0x46')]);var _0x528a0e={'where':_0x329c2d['where']};return db[_0x96e5('0x30')][_0x96e5('0x23')](_0x528a0e)[_0x96e5('0x16')](function(_0x3c4bf9){_0xf81755[_0x96e5('0x23')]=_0x3c4bf9;if(_0x4c58c1[_0x96e5('0x33')][_0x96e5('0x47')]){_0x329c2d[_0x96e5('0x48')]=[{'all':!![]}];}return db[_0x96e5('0x30')]['findAll'](_0x329c2d);})['then'](function(_0x4d172b){_0xf81755[_0x96e5('0x49')]=_0x4d172b;return _0xf81755;})[_0x96e5('0x16')](respondWithFilteredResult(_0x33f9f7,_0x329c2d))[_0x96e5('0x20')](handleError(_0x33f9f7,null));};exports[_0x96e5('0x4a')]=function(_0x2921ae,_0x39c767){var _0x1d2873={'raw':![],'where':{'id':_0x2921ae[_0x96e5('0x4b')]['id']}},_0x449d3e={};_0x449d3e['model']=_[_0x96e5('0x32')](db[_0x96e5('0x30')][_0x96e5('0x4c')]);_0x449d3e[_0x96e5('0x33')]=_[_0x96e5('0x32')](_0x2921ae[_0x96e5('0x33')]);_0x449d3e[_0x96e5('0x36')]=_['intersection'](_0x449d3e['model'],_0x449d3e[_0x96e5('0x33')]);_0x1d2873[_0x96e5('0x38')]=_[_0x96e5('0x37')](_0x449d3e[_0x96e5('0x31')],qs[_0x96e5('0x39')](_0x2921ae[_0x96e5('0x33')]['fields']));_0x1d2873['attributes']=_0x1d2873[_0x96e5('0x38')]['length']?_0x1d2873[_0x96e5('0x38')]:_0x449d3e['model'];if(_0x2921ae[_0x96e5('0x33')][_0x96e5('0x47')]){_0x1d2873[_0x96e5('0x48')]=[{'all':!![]}];}_0x1d2873=_[_0x96e5('0x43')]({},_0x1d2873,_0x2921ae['options']);return db[_0x96e5('0x30')][_0x96e5('0x4d')](_0x1d2873)[_0x96e5('0x16')](handleEntityNotFound(_0x39c767,null))['then'](respondWithResult(_0x39c767,null))[_0x96e5('0x20')](handleError(_0x39c767,null));};exports[_0x96e5('0x4e')]=function(_0x1cb04a,_0x13391f){var _0x5b6116={'raw':![],'where':{'id':_0x1cb04a[_0x96e5('0x4b')]['id']}},_0x24a76d={};_0x24a76d[_0x96e5('0x31')]=_[_0x96e5('0x32')](db[_0x96e5('0x30')][_0x96e5('0x4c')]);_0x5b6116[_0x96e5('0x38')]=_[_0x96e5('0x37')](_0x24a76d[_0x96e5('0x31')],qs[_0x96e5('0x39')](_0x1cb04a['query'][_0x96e5('0x39')]));_0x5b6116[_0x96e5('0x38')]=_0x5b6116[_0x96e5('0x38')][_0x96e5('0x3a')]?_0x5b6116[_0x96e5('0x38')]:_0x24a76d[_0x96e5('0x31')];if(_0x1cb04a[_0x96e5('0x33')][_0x96e5('0x47')]){_0x5b6116[_0x96e5('0x48')]=[{'all':!![]}];}_0x5b6116=_['merge']({},_0x5b6116,_0x1cb04a[_0x96e5('0x46')]);return db['Trunk'][_0x96e5('0x4d')](_0x5b6116)[_0x96e5('0x16')](handleEntityNotFound(_0x13391f,null))[_0x96e5('0x16')](function(_0x4524d0){if(_0x4524d0){var _0x24d60d=_0x4524d0['get']({'plain':!![]});_0x24d60d=qs['omit'](_0x24d60d,['id',_0x96e5('0x4f'),_0x96e5('0x50')]);_0x1cb04a[_0x96e5('0x51')]=_[_0x96e5('0x52')](_0x1cb04a[_0x96e5('0x51')],['id','createdAt',_0x96e5('0x50')]);return db['Trunk'][_0x96e5('0x53')](_['merge'](_0x24d60d,_0x1cb04a[_0x96e5('0x51')]),{'include':_0x1cb04a[_0x96e5('0x33')][_0x96e5('0x47')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x13391f,0xc9))['catch'](handleError(_0x13391f,null));};exports[_0x96e5('0x53')]=function(_0x19e861,_0x7590f4,_0x47481b){var _0x5a906c;return db[_0x96e5('0x30')][_0x96e5('0x53')](_0x19e861[_0x96e5('0x51')],{'raw':!![]})[_0x96e5('0x16')](function(_0x4a426c){_0x5a906c=_0x4a426c;return db['Trunk'][_0x96e5('0x54')]({'raw':!![]});})[_0x96e5('0x16')](function(_0x41d2a6){var _0xb48c3=fs[_0x96e5('0x55')](path[_0x96e5('0x56')](config[_0x96e5('0x57')],_0x96e5('0x58')),_0x96e5('0x59'));var _0x19ddfe=fs[_0x96e5('0x55')](path[_0x96e5('0x56')](config[_0x96e5('0x57')],_0x96e5('0x5a')),'utf8');var _0x5343fc=ejs[_0x96e5('0x5b')](_0xb48c3,{'trunks':_0x41d2a6||[]});fs[_0x96e5('0x5c')](_0x96e5('0x5d'),_0x5343fc);if(_0x5a906c[_0x96e5('0x5e')]){var _0x4886d4=ejs[_0x96e5('0x5b')](_0x19ddfe,{'trunks':_0x41d2a6||[]});fs[_0x96e5('0x5c')](_0x96e5('0x5f'),_0x4886d4);}})[_0x96e5('0x16')](function(){return respondWithRpcPromise(_0x96e5('0x60'),_0x96e5('0x53'),{'module':_0x96e5('0x61')});})[_0x96e5('0x16')](function(){return _0x5a906c;})['then'](respondWithResult(_0x7590f4,0xc9))[_0x96e5('0x20')](handleError(_0x7590f4,null));};exports[_0x96e5('0x2a')]=function(_0x1d60fd,_0x4c2b0e,_0x3c1680){var _0x32d984;return db['Trunk'][_0x96e5('0x4d')]({'where':{'id':_0x1d60fd['params']['id']}})[_0x96e5('0x16')](handleEntityNotFound(_0x4c2b0e,null))[_0x96e5('0x16')](saveUpdates(_0x1d60fd[_0x96e5('0x51')],null))[_0x96e5('0x16')](function(_0x4a474a){if(_0x4a474a){_0x32d984=_0x4a474a;return db[_0x96e5('0x30')][_0x96e5('0x54')]({'raw':!![]});}})[_0x96e5('0x16')](function(_0x32579a){if(_0x32579a){var _0x3f50c2=fs[_0x96e5('0x55')](path[_0x96e5('0x56')](config[_0x96e5('0x57')],'server/files/templates/trunk.ejs'),_0x96e5('0x59'));var _0x2906fc=fs['readFileSync'](path[_0x96e5('0x56')](config[_0x96e5('0x57')],'server/files/templates/registry.ejs'),'utf8');var _0x144183=ejs['render'](_0x3f50c2,{'trunks':_0x32579a||[]});fs[_0x96e5('0x5c')](_0x96e5('0x5d'),_0x144183);var _0x1924e9=ejs['render'](_0x2906fc,{'trunks':_0x32579a||[]});fs[_0x96e5('0x5c')](_0x96e5('0x5f'),_0x1924e9);return respondWithRpcPromise(_0x96e5('0x60'),_0x96e5('0x2a'),{'module':_0x96e5('0x61')});}return null;})['then'](function(_0x421f4e){if(_0x421f4e){return _0x32d984;}})['then'](respondWithResult(_0x4c2b0e,null))['catch'](handleError(_0x4c2b0e,null));};exports['destroy']=function(_0x3ca9dc,_0x47be36,_0x353960){var _0x2d7d9a;return db[_0x96e5('0x30')][_0x96e5('0x4d')]({'where':{'id':_0x3ca9dc[_0x96e5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x47be36,null))[_0x96e5('0x16')](removeEntity(_0x47be36,null))[_0x96e5('0x16')](function(){return db[_0x96e5('0x30')][_0x96e5('0x54')]({'raw':!![]});})[_0x96e5('0x16')](function(_0x443963){var _0x2385ec=fs['readFileSync'](path['join'](config['root'],_0x96e5('0x58')),_0x96e5('0x59'));var _0x265dd6=fs[_0x96e5('0x55')](path[_0x96e5('0x56')](config[_0x96e5('0x57')],_0x96e5('0x5a')),'utf8');var _0x24952c=ejs['render'](_0x2385ec,{'trunks':_0x443963});var _0x9b80f9=ejs[_0x96e5('0x5b')](_0x265dd6,{'trunks':_0x443963});fs[_0x96e5('0x5c')](_0x96e5('0x5d'),_0x24952c);fs['writeFileSync'](_0x96e5('0x5f'),_0x9b80f9);return respondWithRpcPromise(_0x96e5('0x60'),_0x96e5('0x2b'),{'module':_0x96e5('0x61')});})[_0x96e5('0x20')](handleError(_0x47be36,null));}; \ No newline at end of file +var _0xc585=['ejs','lodash','squel','jsforce','to-csv','querystring','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','destroy','name','index','Trunk','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','day','merge','where','filter','options','count','includeAll','findAll','rows','show','params','include','clone','find','get','omit','createdAt','updatedAt','body','create','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','server/files/templates/registry.ejs','render','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','/etc/asterisk/sip_xcally_trunks.conf','chan_sip.so','fast-json-patch','request-promise','moment','mustache','path','sox'];(function(_0x38e3f4,_0x5284e4){var _0x517dd6=function(_0x26408e){while(--_0x26408e){_0x38e3f4['push'](_0x38e3f4['shift']());}};_0x517dd6(++_0x5284e4);}(_0xc585,0x166));var _0x5c58=function(_0x3e2a7d,_0x74066){_0x3e2a7d=_0x3e2a7d-0x0;var _0x442013=_0xc585[_0x3e2a7d];return _0x442013;};'use strict';var jsonpatch=require(_0x5c58('0x0'));var rp=require(_0x5c58('0x1'));var moment=require(_0x5c58('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5c58('0x3'));var util=require('util');var path=require(_0x5c58('0x4'));var sox=require(_0x5c58('0x5'));var csv=require('to-csv');var ejs=require(_0x5c58('0x6'));var fs=require('fs');var _=require(_0x5c58('0x7'));var squel=require(_0x5c58('0x8'));var crypto=require('crypto');var jsforce=require(_0x5c58('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x5c58('0xa'));var querystring=require(_0x5c58('0xb'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0x5c58('0xc'))('api');var utils=require(_0x5c58('0xd'));var config=require(_0x5c58('0xe'));var db=require(_0x5c58('0xf'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x5c58('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x3d13a9,_0x3ccf2a,_0x31191f,_0x363993){return new BPromise(function(_0x133b35,_0x55c10c){var _0x279c7a=_0x363993||client;return _0x279c7a[_0x5c58('0x11')](_0x3d13a9,_0x31191f)[_0x5c58('0x12')](function(_0x5d2680){logger[_0x5c58('0x13')](_0x5c58('0x14'),_0x3ccf2a,_0x5c58('0x15'));logger['debug'](_0x5c58('0x16'),_0x3ccf2a,_0x5c58('0x15'),JSON[_0x5c58('0x17')](_0x5d2680));if(_0x5d2680[_0x5c58('0x18')]){if(_0x5d2680[_0x5c58('0x18')][_0x5c58('0x19')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x3ccf2a,_0x5d2680[_0x5c58('0x18')][_0x5c58('0x1a')]);return _0x55c10c(_0x5d2680['error'][_0x5c58('0x1a')]);}logger['error'](_0x5c58('0x14'),_0x3ccf2a,_0x5d2680[_0x5c58('0x18')][_0x5c58('0x1a')]);return _0x133b35(_0x5d2680[_0x5c58('0x18')][_0x5c58('0x1a')]);}else{logger[_0x5c58('0x13')](_0x5c58('0x14'),_0x3ccf2a,'request\x20sent');_0x133b35(_0x5d2680['result'][_0x5c58('0x1a')]);}})[_0x5c58('0x1b')](function(_0x540b19){logger[_0x5c58('0x18')](_0x5c58('0x14'),_0x3ccf2a,_0x540b19);_0x55c10c(_0x540b19);});});}function respondWithStatusCode(_0xdbc188,_0x4de8f5){_0x4de8f5=_0x4de8f5||0xcc;return function(_0x115ef1){if(_0x115ef1){return _0xdbc188[_0x5c58('0x1c')](_0x4de8f5);}return _0xdbc188[_0x5c58('0x1d')](_0x4de8f5)[_0x5c58('0x1e')]();};}function respondWithResult(_0x1e969a,_0x4ba124){_0x4ba124=_0x4ba124||0xc8;return function(_0x25916f){if(_0x25916f){return _0x1e969a[_0x5c58('0x1d')](_0x4ba124)[_0x5c58('0x1f')](_0x25916f);}};}function respondWithFilteredResult(_0x3b8978,_0x54991e){return function(_0x506168){if(_0x506168){var _0x4514f2=_0x506168['count'],_0x42576a=_0x54991e[_0x5c58('0x20')],_0x38c901=_0x54991e[_0x5c58('0x20')]+_0x54991e['limit'],_0x2646a3;if(_0x38c901>=_0x4514f2){_0x38c901=_0x4514f2;_0x2646a3=0xc8;}else{_0x2646a3=0xce;}_0x3b8978[_0x5c58('0x1d')](_0x2646a3);return _0x3b8978[_0x5c58('0x21')](_0x5c58('0x22'),_0x42576a+'-'+_0x38c901+'/'+_0x4514f2)[_0x5c58('0x1f')](_0x506168);}return null;};}function patchUpdates(_0x973304){return function(_0x2751c2){try{jsonpatch['apply'](_0x2751c2,_0x973304,!![]);}catch(_0x25dd1b){return BPromise[_0x5c58('0x23')](_0x25dd1b);}return _0x2751c2[_0x5c58('0x24')]();};}function saveUpdates(_0x42f59f,_0x3d17df){return function(_0x53da32){if(_0x53da32){return _0x53da32[_0x5c58('0x25')](_0x42f59f)[_0x5c58('0x12')](function(_0x8cf57f){return _0x8cf57f;});}return null;};}function removeEntity(_0x122fec,_0x277510){return function(_0x1d1250){if(_0x1d1250){return _0x1d1250[_0x5c58('0x26')]()['then'](function(){_0x122fec[_0x5c58('0x1d')](0xcc)[_0x5c58('0x1e')]();});}};}function handleEntityNotFound(_0x3b7de6,_0x4769f5){return function(_0x47d53e){if(!_0x47d53e){_0x3b7de6[_0x5c58('0x1c')](0x194);}return _0x47d53e;};}function handleError(_0x4b5e86,_0x43229a){_0x43229a=_0x43229a||0x1f4;return function(_0x1b0112){logger['error'](_0x1b0112['stack']);if(_0x1b0112[_0x5c58('0x27')]){delete _0x1b0112['name'];}_0x4b5e86[_0x5c58('0x1d')](_0x43229a)['send'](_0x1b0112);};}exports[_0x5c58('0x28')]=function(_0x36eada,_0x509d4){var _0x25f2b2={},_0xc5eb10={},_0xbd94d8={'count':0x0,'rows':[]};var _0x316cd4=db[_0x5c58('0x29')][_0x5c58('0x2a')];_0xc5eb10[_0x5c58('0x2b')]=_[_0x5c58('0x2c')](_0x316cd4);var _0x104448={'dateStart':_0x36eada[_0x5c58('0x2d')][_0x5c58('0x2e')],'dateEnd':_0x36eada[_0x5c58('0x2d')][_0x5c58('0x2f')]};delete _0x36eada['query'][_0x5c58('0x2e')];delete _0x36eada[_0x5c58('0x2d')][_0x5c58('0x2f')];_0xc5eb10[_0x5c58('0x2d')]=_[_0x5c58('0x2c')](_0x36eada[_0x5c58('0x2d')]);_0xc5eb10[_0x5c58('0x30')]=_[_0x5c58('0x31')](_0xc5eb10[_0x5c58('0x2b')],_0xc5eb10[_0x5c58('0x2d')]);_0x25f2b2[_0x5c58('0x32')]=_['intersection'](_0xc5eb10[_0x5c58('0x2b')],qs['fields'](_0x36eada[_0x5c58('0x2d')][_0x5c58('0x33')]));_0x25f2b2['attributes']=_0x25f2b2[_0x5c58('0x32')][_0x5c58('0x34')]?_0x25f2b2['attributes']:_0xc5eb10['model'];if(!_0x36eada[_0x5c58('0x2d')]['hasOwnProperty'](_0x5c58('0x35'))){_0x25f2b2[_0x5c58('0x36')]=qs[_0x5c58('0x36')](_0x36eada['query'][_0x5c58('0x36')]);_0x25f2b2[_0x5c58('0x20')]=qs[_0x5c58('0x20')](_0x36eada[_0x5c58('0x2d')][_0x5c58('0x20')]);}_0x25f2b2[_0x5c58('0x37')]=qs['sort'](_0x36eada[_0x5c58('0x2d')][_0x5c58('0x38')]);_0x25f2b2['where']=qs[_0x5c58('0x30')](_[_0x5c58('0x39')](_0x36eada[_0x5c58('0x2d')],_0xc5eb10['filters']));if(_0x104448[_0x5c58('0x2e')]){if(_0x104448[_0x5c58('0x2f')]){_0x104448['dateEnd']=moment(_0x104448[_0x5c58('0x2f')])['add'](0x1,'day');}else{_0x104448[_0x5c58('0x2f')]=moment(_0x104448[_0x5c58('0x2e')])['add'](0x1,_0x5c58('0x3a'));}_[_0x5c58('0x3b')](_0x25f2b2[_0x5c58('0x3c')],{'createdAt':{'$gte':_0x104448[_0x5c58('0x2e')],'$lte':_0x104448[_0x5c58('0x2f')]}});}if(_0x36eada[_0x5c58('0x2d')][_0x5c58('0x3d')]){_0x25f2b2[_0x5c58('0x3c')]=_['merge'](_0x25f2b2[_0x5c58('0x3c')],{'$or':_['map'](_0x25f2b2['attributes'],function(_0x3688c3){var _0x5e72f9={};_0x5e72f9[_0x3688c3]={'$like':'%'+_0x36eada[_0x5c58('0x2d')][_0x5c58('0x3d')]+'%'};return _0x5e72f9;})});}_0x25f2b2=_[_0x5c58('0x3b')]({},_0x25f2b2,_0x36eada[_0x5c58('0x3e')]);var _0x36e13a={'where':_0x25f2b2['where']};return db[_0x5c58('0x29')]['count'](_0x36e13a)[_0x5c58('0x12')](function(_0x57c707){_0xbd94d8[_0x5c58('0x3f')]=_0x57c707;if(_0x36eada[_0x5c58('0x2d')][_0x5c58('0x40')]){_0x25f2b2['include']=[{'all':!![]}];}return db[_0x5c58('0x29')][_0x5c58('0x41')](_0x25f2b2);})[_0x5c58('0x12')](function(_0x44372c){_0xbd94d8[_0x5c58('0x42')]=_0x44372c;return _0xbd94d8;})[_0x5c58('0x12')](respondWithFilteredResult(_0x509d4,_0x25f2b2))[_0x5c58('0x1b')](handleError(_0x509d4,null));};exports[_0x5c58('0x43')]=function(_0x1a09a3,_0x451b3e){var _0x10983a={'raw':![],'where':{'id':_0x1a09a3[_0x5c58('0x44')]['id']}},_0x4cf7ac={};_0x4cf7ac[_0x5c58('0x2b')]=_['keys'](db[_0x5c58('0x29')][_0x5c58('0x2a')]);_0x4cf7ac['query']=_['keys'](_0x1a09a3[_0x5c58('0x2d')]);_0x4cf7ac[_0x5c58('0x30')]=_[_0x5c58('0x31')](_0x4cf7ac[_0x5c58('0x2b')],_0x4cf7ac['query']);_0x10983a[_0x5c58('0x32')]=_[_0x5c58('0x31')](_0x4cf7ac[_0x5c58('0x2b')],qs['fields'](_0x1a09a3[_0x5c58('0x2d')][_0x5c58('0x33')]));_0x10983a['attributes']=_0x10983a['attributes']['length']?_0x10983a[_0x5c58('0x32')]:_0x4cf7ac['model'];if(_0x1a09a3[_0x5c58('0x2d')][_0x5c58('0x40')]){_0x10983a[_0x5c58('0x45')]=[{'all':!![]}];}_0x10983a=_['merge']({},_0x10983a,_0x1a09a3[_0x5c58('0x3e')]);return db['Trunk']['find'](_0x10983a)[_0x5c58('0x12')](handleEntityNotFound(_0x451b3e,null))[_0x5c58('0x12')](respondWithResult(_0x451b3e,null))[_0x5c58('0x1b')](handleError(_0x451b3e,null));};exports[_0x5c58('0x46')]=function(_0x41151e,_0x4a2e07){var _0x42e23c={'raw':![],'where':{'id':_0x41151e[_0x5c58('0x44')]['id']}},_0x488469={};_0x488469[_0x5c58('0x2b')]=_['keys'](db[_0x5c58('0x29')][_0x5c58('0x2a')]);_0x42e23c[_0x5c58('0x32')]=_['intersection'](_0x488469[_0x5c58('0x2b')],qs[_0x5c58('0x33')](_0x41151e[_0x5c58('0x2d')][_0x5c58('0x33')]));_0x42e23c[_0x5c58('0x32')]=_0x42e23c['attributes'][_0x5c58('0x34')]?_0x42e23c[_0x5c58('0x32')]:_0x488469[_0x5c58('0x2b')];if(_0x41151e[_0x5c58('0x2d')][_0x5c58('0x40')]){_0x42e23c[_0x5c58('0x45')]=[{'all':!![]}];}_0x42e23c=_[_0x5c58('0x3b')]({},_0x42e23c,_0x41151e[_0x5c58('0x3e')]);return db['Trunk'][_0x5c58('0x47')](_0x42e23c)[_0x5c58('0x12')](handleEntityNotFound(_0x4a2e07,null))['then'](function(_0x825b9b){if(_0x825b9b){var _0x18c236=_0x825b9b[_0x5c58('0x48')]({'plain':!![]});_0x18c236=qs[_0x5c58('0x49')](_0x18c236,['id',_0x5c58('0x4a'),_0x5c58('0x4b')]);_0x41151e[_0x5c58('0x4c')]=_[_0x5c58('0x49')](_0x41151e['body'],['id',_0x5c58('0x4a'),_0x5c58('0x4b')]);return db[_0x5c58('0x29')][_0x5c58('0x4d')](_[_0x5c58('0x3b')](_0x18c236,_0x41151e[_0x5c58('0x4c')]),{'include':_0x41151e['query'][_0x5c58('0x40')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x4a2e07,0xc9))[_0x5c58('0x1b')](handleError(_0x4a2e07,null));};exports[_0x5c58('0x4d')]=function(_0x28431f,_0x1ff349,_0x28d09f){var _0x197bf1;return db[_0x5c58('0x29')][_0x5c58('0x4d')](_0x28431f['body'],{'raw':!![]})[_0x5c58('0x12')](function(_0x587ed4){_0x197bf1=_0x587ed4;return db[_0x5c58('0x29')][_0x5c58('0x41')]({'raw':!![]});})['then'](function(_0x59034e){var _0x362ef2=fs['readFileSync'](path[_0x5c58('0x4e')](config[_0x5c58('0x4f')],_0x5c58('0x50')),_0x5c58('0x51'));var _0x2ca0c9=fs[_0x5c58('0x52')](path[_0x5c58('0x4e')](config[_0x5c58('0x4f')],_0x5c58('0x53')),'utf8');var _0x30d2f1=ejs[_0x5c58('0x54')](_0x362ef2,{'trunks':_0x59034e||[]});fs[_0x5c58('0x55')]('/etc/asterisk/sip_xcally_trunks.conf',_0x30d2f1);if(_0x197bf1[_0x5c58('0x56')]){var _0x4f28e7=ejs[_0x5c58('0x54')](_0x2ca0c9,{'trunks':_0x59034e||[]});fs[_0x5c58('0x55')](_0x5c58('0x57'),_0x4f28e7);}})[_0x5c58('0x12')](function(){return respondWithRpcPromise(_0x5c58('0x58'),_0x5c58('0x4d'),{'module':'chan_sip.so'});})['then'](function(){return _0x197bf1;})['then'](respondWithResult(_0x1ff349,0xc9))[_0x5c58('0x1b')](handleError(_0x1ff349,null));};exports['update']=function(_0x3631c2,_0x4a8bfc,_0x2560ab){var _0x1537d6;return db['Trunk'][_0x5c58('0x47')]({'where':{'id':_0x3631c2[_0x5c58('0x44')]['id']}})[_0x5c58('0x12')](handleEntityNotFound(_0x4a8bfc,null))[_0x5c58('0x12')](saveUpdates(_0x3631c2['body'],null))[_0x5c58('0x12')](function(_0x3b3794){if(_0x3b3794){_0x1537d6=_0x3b3794;return db[_0x5c58('0x29')][_0x5c58('0x41')]({'raw':!![]});}})[_0x5c58('0x12')](function(_0x478c3e){if(_0x478c3e){var _0x8795ba=fs[_0x5c58('0x52')](path[_0x5c58('0x4e')](config[_0x5c58('0x4f')],_0x5c58('0x50')),_0x5c58('0x51'));var _0xcc0b04=fs[_0x5c58('0x52')](path['join'](config[_0x5c58('0x4f')],_0x5c58('0x53')),'utf8');var _0x34283d=ejs[_0x5c58('0x54')](_0x8795ba,{'trunks':_0x478c3e||[]});fs['writeFileSync'](_0x5c58('0x59'),_0x34283d);var _0x435031=ejs[_0x5c58('0x54')](_0xcc0b04,{'trunks':_0x478c3e||[]});fs['writeFileSync'](_0x5c58('0x57'),_0x435031);return respondWithRpcPromise(_0x5c58('0x58'),_0x5c58('0x25'),{'module':_0x5c58('0x5a')});}return null;})['then'](function(_0x3d8913){if(_0x3d8913){return _0x1537d6;}})[_0x5c58('0x12')](respondWithResult(_0x4a8bfc,null))[_0x5c58('0x1b')](handleError(_0x4a8bfc,null));};exports[_0x5c58('0x26')]=function(_0x1780f1,_0x45df08,_0xdfa87c){var _0x59b269;return db['Trunk']['find']({'where':{'id':_0x1780f1[_0x5c58('0x44')]['id']}})['then'](handleEntityNotFound(_0x45df08,null))['then'](removeEntity(_0x45df08,null))['then'](function(){return db[_0x5c58('0x29')][_0x5c58('0x41')]({'raw':!![]});})[_0x5c58('0x12')](function(_0x13ebe3){var _0x3218a7=fs[_0x5c58('0x52')](path[_0x5c58('0x4e')](config[_0x5c58('0x4f')],_0x5c58('0x50')),_0x5c58('0x51'));var _0x2c38ac=fs[_0x5c58('0x52')](path[_0x5c58('0x4e')](config[_0x5c58('0x4f')],_0x5c58('0x53')),'utf8');var _0x18d23b=ejs[_0x5c58('0x54')](_0x3218a7,{'trunks':_0x13ebe3});var _0x16b6ee=ejs[_0x5c58('0x54')](_0x2c38ac,{'trunks':_0x13ebe3});fs[_0x5c58('0x55')]('/etc/asterisk/sip_xcally_trunks.conf',_0x18d23b);fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x16b6ee);return respondWithRpcPromise('Reload',_0x5c58('0x26'),{'module':'chan_sip.so'});})[_0x5c58('0x1b')](handleError(_0x45df08,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index eec86bc..c82145a 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 _0x105f=['api','request-promise','./trunk.attributes','exports','define','tools_trunks','lodash','util'];(function(_0x52bbc9,_0xb342e0){var _0x5909d0=function(_0x24370d){while(--_0x24370d){_0x52bbc9['push'](_0x52bbc9['shift']());}};_0x5909d0(++_0xb342e0);}(_0x105f,0x14e));var _0xf105=function(_0x3e7f20,_0x453143){_0x3e7f20=_0x3e7f20-0x0;var _0x56399a=_0x105f[_0x3e7f20];return _0x56399a;};'use strict';var _=require(_0xf105('0x0'));var util=require(_0xf105('0x1'));var logger=require('../../config/logger')(_0xf105('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf105('0x3'));var attributes=require(_0xf105('0x4'));module[_0xf105('0x5')]=function(_0x30c8ae,_0x60d78b){return _0x30c8ae[_0xf105('0x6')]('Trunk',attributes,{'tableName':_0xf105('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a24=['api','moment','request-promise','./trunk.attributes','exports','define','Trunk','tools_trunks','util','../../config/logger'];(function(_0x4eda71,_0x1eec3d){var _0x4ddfcb=function(_0x254c29){while(--_0x254c29){_0x4eda71['push'](_0x4eda71['shift']());}};_0x4ddfcb(++_0x1eec3d);}(_0x7a24,0x80));var _0x47a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a24[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x47a2('0x0'));var logger=require(_0x47a2('0x1'))(_0x47a2('0x2'));var moment=require(_0x47a2('0x3'));var BPromise=require('bluebird');var rp=require(_0x47a2('0x4'));var attributes=require(_0x47a2('0x5'));module[_0x47a2('0x6')]=function(_0x5320ef,_0x3c0a21){return _0x5320ef[_0x47a2('0x7')](_0x47a2('0x8'),attributes,{'tableName':_0x47a2('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 e98fb51..a5efaeb 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 _0x5862=['debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','info','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','map','model','then','find','raw','ShowTrunk','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','http','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5862,0x182));var _0x2586=function(_0x299970,_0x25c56e){_0x299970=_0x299970-0x0;var _0x1feecb=_0x5862[_0x299970];return _0x1feecb;};'use strict';var _=require(_0x2586('0x0'));var util=require(_0x2586('0x1'));var moment=require(_0x2586('0x2'));var BPromise=require(_0x2586('0x3'));var rs=require(_0x2586('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x2586('0x5'));var logger=require(_0x2586('0x6'))(_0x2586('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2586('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d9926,_0x19badd,_0x47da35){return new BPromise(function(_0x74920f,_0x4727f6){return client['request'](_0x5d9926,_0x47da35)['then'](function(_0x4f0ea8){logger['info']('Trunk,\x20%s,\x20%s',_0x19badd,_0x2586('0x9'));logger[_0x2586('0xa')](_0x2586('0xb'),_0x19badd,'request\x20sent',JSON[_0x2586('0xc')](_0x4f0ea8));if(_0x4f0ea8[_0x2586('0xd')]){if(_0x4f0ea8['error'][_0x2586('0xe')]===0x1f4){logger['error'](_0x2586('0xf'),_0x19badd,_0x4f0ea8[_0x2586('0xd')][_0x2586('0x10')]);return _0x4727f6(_0x4f0ea8['error'][_0x2586('0x10')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x19badd,_0x4f0ea8[_0x2586('0xd')][_0x2586('0x10')]);return _0x74920f(_0x4f0ea8[_0x2586('0xd')]['message']);}else{logger[_0x2586('0x11')]('Trunk,\x20%s,\x20%s',_0x19badd,_0x2586('0x9'));_0x74920f(_0x4f0ea8['result']['message']);}})[_0x2586('0x12')](function(_0x4e1f66){logger[_0x2586('0xd')](_0x2586('0xf'),_0x19badd,_0x4e1f66);_0x4727f6(_0x4e1f66);});});}exports[_0x2586('0x13')]=function(_0x4a62bd){var _0x2e0590=this;return new Promise(function(_0x3eadef,_0x1e48cb){return db[_0x2586('0x14')][_0x2586('0x15')]({'raw':_0x4a62bd[_0x2586('0x16')]?_0x4a62bd['options']['raw']===undefined?!![]:![]:!![],'where':_0x4a62bd[_0x2586('0x16')]?_0x4a62bd[_0x2586('0x16')][_0x2586('0x17')]||null:null,'attributes':_0x4a62bd[_0x2586('0x16')]?_0x4a62bd[_0x2586('0x16')][_0x2586('0x18')]||null:null,'limit':_0x4a62bd[_0x2586('0x16')]?_0x4a62bd[_0x2586('0x16')][_0x2586('0x19')]||null:null,'include':_0x4a62bd[_0x2586('0x16')]?_0x4a62bd[_0x2586('0x16')][_0x2586('0x1a')]?_[_0x2586('0x1b')](_0x4a62bd['options']['include'],function(_0xe26170){return{'model':db[_0xe26170[_0x2586('0x1c')]],'as':_0xe26170['as'],'attributes':_0xe26170[_0x2586('0x18')],'include':_0xe26170[_0x2586('0x1a')]?_[_0x2586('0x1b')](_0xe26170[_0x2586('0x1a')],function(_0x50fa05){return{'model':db[_0x50fa05[_0x2586('0x1c')]],'as':_0x50fa05['as'],'attributes':_0x50fa05[_0x2586('0x18')],'include':_0x50fa05[_0x2586('0x1a')]?_[_0x2586('0x1b')](_0x50fa05[_0x2586('0x1a')],function(_0x97a186){return{'model':db[_0x97a186[_0x2586('0x1c')]],'as':_0x97a186['as'],'attributes':_0x97a186[_0x2586('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2586('0x1d')](function(_0x38c776){logger[_0x2586('0x11')](_0x2586('0x13'),_0x4a62bd);logger['debug'](_0x2586('0x13'),_0x4a62bd,JSON[_0x2586('0xc')](_0x38c776));_0x3eadef(_0x38c776);})['catch'](function(_0x5b9687){logger[_0x2586('0xd')](_0x2586('0x13'),_0x5b9687['message'],_0x4a62bd);_0x1e48cb(_0x2e0590[_0x2586('0xd')](0x1f4,_0x5b9687['message']));});});};exports['ShowTrunk']=function(_0x4795f7){var _0x5b54a0=this;return new Promise(function(_0x49b7b5,_0x12e12c){return db[_0x2586('0x14')][_0x2586('0x1e')]({'raw':_0x4795f7[_0x2586('0x16')]?_0x4795f7[_0x2586('0x16')][_0x2586('0x1f')]===undefined?!![]:![]:!![],'where':_0x4795f7['options']?_0x4795f7[_0x2586('0x16')][_0x2586('0x17')]||null:null,'attributes':_0x4795f7[_0x2586('0x16')]?_0x4795f7['options'][_0x2586('0x18')]||null:null,'include':_0x4795f7[_0x2586('0x16')]?_0x4795f7[_0x2586('0x16')][_0x2586('0x1a')]?_[_0x2586('0x1b')](_0x4795f7['options'][_0x2586('0x1a')],function(_0x2d0332){return{'model':db[_0x2d0332[_0x2586('0x1c')]],'as':_0x2d0332['as'],'attributes':_0x2d0332[_0x2586('0x18')],'include':_0x2d0332[_0x2586('0x1a')]?_[_0x2586('0x1b')](_0x2d0332['include'],function(_0x4617da){return{'model':db[_0x4617da['model']],'as':_0x4617da['as'],'attributes':_0x4617da[_0x2586('0x18')],'include':_0x4617da[_0x2586('0x1a')]?_['map'](_0x4617da[_0x2586('0x1a')],function(_0x52270d){return{'model':db[_0x52270d['model']],'as':_0x52270d['as'],'attributes':_0x52270d[_0x2586('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2586('0x1d')](function(_0x599663){logger[_0x2586('0x11')](_0x2586('0x20'),_0x4795f7);logger[_0x2586('0xa')](_0x2586('0x20'),_0x4795f7,JSON[_0x2586('0xc')](_0x599663));_0x49b7b5(_0x599663);})[_0x2586('0x12')](function(_0x313b11){logger[_0x2586('0xd')](_0x2586('0x20'),_0x313b11[_0x2586('0x10')],_0x4795f7);_0x12e12c(_0x5b54a0[_0x2586('0xd')](0x1f4,_0x313b11[_0x2586('0x10')]));});});}; \ No newline at end of file +var _0x7420=['catch','GetTrunk','options','raw','where','attributes','limit','include','map','model','debug','ShowTrunk','Trunk','find','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result'];(function(_0x493d4a,_0xfe65e2){var _0x314bc7=function(_0x1c3bdf){while(--_0x1c3bdf){_0x493d4a['push'](_0x493d4a['shift']());}};_0x314bc7(++_0xfe65e2);}(_0x7420,0x137));var _0x0742=function(_0x5e2217,_0x597085){_0x5e2217=_0x5e2217-0x0;var _0x146245=_0x7420[_0x5e2217];return _0x146245;};'use strict';var _=require(_0x0742('0x0'));var util=require('util');var moment=require(_0x0742('0x1'));var BPromise=require(_0x0742('0x2'));var rs=require(_0x0742('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x0742('0x4'));var logger=require(_0x0742('0x5'))(_0x0742('0x6'));var config=require(_0x0742('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0742('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x101ce7,_0x11cd24,_0x388597){return new BPromise(function(_0x13bfea,_0x368a2c){return client[_0x0742('0x9')](_0x101ce7,_0x388597)['then'](function(_0x19b6ff){logger[_0x0742('0xa')]('Trunk,\x20%s,\x20%s',_0x11cd24,'request\x20sent');logger['debug'](_0x0742('0xb'),_0x11cd24,'request\x20sent',JSON[_0x0742('0xc')](_0x19b6ff));if(_0x19b6ff[_0x0742('0xd')]){if(_0x19b6ff[_0x0742('0xd')][_0x0742('0xe')]===0x1f4){logger[_0x0742('0xd')]('Trunk,\x20%s,\x20%s',_0x11cd24,_0x19b6ff['error'][_0x0742('0xf')]);return _0x368a2c(_0x19b6ff['error'][_0x0742('0xf')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x11cd24,_0x19b6ff['error'][_0x0742('0xf')]);return _0x13bfea(_0x19b6ff[_0x0742('0xd')]['message']);}else{logger['info'](_0x0742('0x10'),_0x11cd24,_0x0742('0x11'));_0x13bfea(_0x19b6ff[_0x0742('0x12')][_0x0742('0xf')]);}})[_0x0742('0x13')](function(_0x33c329){logger[_0x0742('0xd')]('Trunk,\x20%s,\x20%s',_0x11cd24,_0x33c329);_0x368a2c(_0x33c329);});});}exports[_0x0742('0x14')]=function(_0x36893e){var _0x1cd238=this;return new Promise(function(_0x49bd19,_0x2d3118){return db['Trunk']['findAll']({'raw':_0x36893e[_0x0742('0x15')]?_0x36893e['options'][_0x0742('0x16')]===undefined?!![]:![]:!![],'where':_0x36893e['options']?_0x36893e[_0x0742('0x15')][_0x0742('0x17')]||null:null,'attributes':_0x36893e['options']?_0x36893e[_0x0742('0x15')][_0x0742('0x18')]||null:null,'limit':_0x36893e[_0x0742('0x15')]?_0x36893e[_0x0742('0x15')][_0x0742('0x19')]||null:null,'include':_0x36893e['options']?_0x36893e['options'][_0x0742('0x1a')]?_[_0x0742('0x1b')](_0x36893e['options'][_0x0742('0x1a')],function(_0x820dfc){return{'model':db[_0x820dfc[_0x0742('0x1c')]],'as':_0x820dfc['as'],'attributes':_0x820dfc[_0x0742('0x18')],'include':_0x820dfc['include']?_[_0x0742('0x1b')](_0x820dfc[_0x0742('0x1a')],function(_0x5d8039){return{'model':db[_0x5d8039[_0x0742('0x1c')]],'as':_0x5d8039['as'],'attributes':_0x5d8039['attributes'],'include':_0x5d8039[_0x0742('0x1a')]?_[_0x0742('0x1b')](_0x5d8039[_0x0742('0x1a')],function(_0xd29af3){return{'model':db[_0xd29af3['model']],'as':_0xd29af3['as'],'attributes':_0xd29af3[_0x0742('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x554d2f){logger[_0x0742('0xa')](_0x0742('0x14'),_0x36893e);logger[_0x0742('0x1d')](_0x0742('0x14'),_0x36893e,JSON[_0x0742('0xc')](_0x554d2f));_0x49bd19(_0x554d2f);})[_0x0742('0x13')](function(_0x474f7a){logger[_0x0742('0xd')](_0x0742('0x14'),_0x474f7a[_0x0742('0xf')],_0x36893e);_0x2d3118(_0x1cd238[_0x0742('0xd')](0x1f4,_0x474f7a[_0x0742('0xf')]));});});};exports[_0x0742('0x1e')]=function(_0x48c2a5){var _0x512484=this;return new Promise(function(_0x3b9244,_0x23b87d){return db[_0x0742('0x1f')][_0x0742('0x20')]({'raw':_0x48c2a5[_0x0742('0x15')]?_0x48c2a5[_0x0742('0x15')][_0x0742('0x16')]===undefined?!![]:![]:!![],'where':_0x48c2a5[_0x0742('0x15')]?_0x48c2a5[_0x0742('0x15')][_0x0742('0x17')]||null:null,'attributes':_0x48c2a5[_0x0742('0x15')]?_0x48c2a5['options'][_0x0742('0x18')]||null:null,'include':_0x48c2a5['options']?_0x48c2a5[_0x0742('0x15')][_0x0742('0x1a')]?_['map'](_0x48c2a5[_0x0742('0x15')][_0x0742('0x1a')],function(_0x390254){return{'model':db[_0x390254[_0x0742('0x1c')]],'as':_0x390254['as'],'attributes':_0x390254[_0x0742('0x18')],'include':_0x390254[_0x0742('0x1a')]?_[_0x0742('0x1b')](_0x390254[_0x0742('0x1a')],function(_0x3b24e9){return{'model':db[_0x3b24e9['model']],'as':_0x3b24e9['as'],'attributes':_0x3b24e9[_0x0742('0x18')],'include':_0x3b24e9[_0x0742('0x1a')]?_[_0x0742('0x1b')](_0x3b24e9[_0x0742('0x1a')],function(_0x64ff4){return{'model':db[_0x64ff4[_0x0742('0x1c')]],'as':_0x64ff4['as'],'attributes':_0x64ff4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4cd3bb){logger[_0x0742('0xa')](_0x0742('0x1e'),_0x48c2a5);logger['debug'](_0x0742('0x1e'),_0x48c2a5,JSON[_0x0742('0xc')](_0x4cd3bb));_0x3b9244(_0x4cd3bb);})[_0x0742('0x13')](function(_0x4c8d90){logger[_0x0742('0xd')](_0x0742('0x1e'),_0x4c8d90[_0x0742('0xf')],_0x48c2a5);_0x23b87d(_0x512484[_0x0742('0xd')](0x1f4,_0x4c8d90[_0x0742('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index b32cdc8..ef675ca 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 _0x98e9=['login','/:id/logout','logout','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addSquareProjects','update','put','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/avatar','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','getFaxInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','getSquareProjects','post','addContacts','/:id/queues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','file','addAvatar','/:id/login'];(function(_0x17e174,_0x4991f8){var _0x3f26f1=function(_0x169012){while(--_0x169012){_0x17e174['push'](_0x17e174['shift']());}};_0x3f26f1(++_0x4991f8);}(_0x98e9,0x14f));var _0x998e=function(_0x244808,_0x314eae){_0x244808=_0x244808-0x0;var _0x454f38=_0x98e9[_0x244808];return _0x454f38;};'use strict';var multer=require(_0x998e('0x0'));var util=require(_0x998e('0x1'));var path=require(_0x998e('0x2'));var express=require(_0x998e('0x3'));var router=express['Router']();var auth=require(_0x998e('0x4'));var interaction=require(_0x998e('0x5'));var config=require(_0x998e('0x6'));var controller=require('./user.controller');router[_0x998e('0x7')]('/',auth[_0x998e('0x8')](),controller['index']);router[_0x998e('0x7')]('/describe',auth[_0x998e('0x8')](),controller[_0x998e('0x9')]);router[_0x998e('0x7')](_0x998e('0xa'),auth[_0x998e('0x8')](),controller[_0x998e('0xb')]);router[_0x998e('0x7')](_0x998e('0xc'),controller['getAvatar']);router[_0x998e('0x7')](_0x998e('0xd'),auth[_0x998e('0x8')](),controller[_0x998e('0xe')]);router[_0x998e('0x7')]('/:id/queues',auth['isAuthenticated'](),controller[_0x998e('0xf')]);router['get'](_0x998e('0x10'),auth[_0x998e('0x8')](),controller[_0x998e('0x11')]);router[_0x998e('0x7')](_0x998e('0x12'),auth[_0x998e('0x8')](),controller[_0x998e('0x13')]);router[_0x998e('0x7')](_0x998e('0x14'),auth[_0x998e('0x8')](),controller[_0x998e('0x15')]);router[_0x998e('0x7')](_0x998e('0x16'),auth['isAuthenticated'](),controller[_0x998e('0x17')]);router[_0x998e('0x7')](_0x998e('0x18'),auth['isAuthenticated'](),controller[_0x998e('0x19')]);router[_0x998e('0x7')](_0x998e('0x1a'),auth[_0x998e('0x8')](),controller[_0x998e('0x1b')]);router[_0x998e('0x7')]('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0x998e('0x1c')]);router['get']('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0x998e('0x1d')]);router[_0x998e('0x7')](_0x998e('0x1e'),auth[_0x998e('0x8')](),controller[_0x998e('0x1f')]);router[_0x998e('0x7')](_0x998e('0x20'),auth['isAuthenticated'](),controller[_0x998e('0x21')]);router[_0x998e('0x7')]('/:id/agents',auth[_0x998e('0x8')](),controller[_0x998e('0x22')]);router[_0x998e('0x7')](_0x998e('0x23'),auth[_0x998e('0x8')](),controller['getVoicePrefixes']);router[_0x998e('0x7')](_0x998e('0x24'),auth[_0x998e('0x8')](),controller[_0x998e('0x25')]);router[_0x998e('0x7')](_0x998e('0x26'),auth[_0x998e('0x8')](),controller[_0x998e('0x27')]);router[_0x998e('0x7')]('/:id/openchannel_accounts',auth[_0x998e('0x8')](),controller[_0x998e('0x28')]);router['get'](_0x998e('0x29'),auth['isAuthenticated'](),controller[_0x998e('0x2a')]);router['get'](_0x998e('0x2b'),auth['isAuthenticated'](),controller[_0x998e('0x2c')]);router[_0x998e('0x7')](_0x998e('0x2d'),auth[_0x998e('0x8')](),controller[_0x998e('0x2e')]);router[_0x998e('0x2f')]('/create_many',auth[_0x998e('0x8')](),controller['bulkCreate']);router[_0x998e('0x2f')](_0x998e('0xd'),auth[_0x998e('0x8')](),controller[_0x998e('0x30')]);router[_0x998e('0x2f')]('/',auth[_0x998e('0x8')](),controller['create']);router[_0x998e('0x2f')](_0x998e('0x31'),auth[_0x998e('0x8')](),controller['addQueues']);var upload=multer({'storage':multer[_0x998e('0x32')]({'destination':function(_0x64cb55,_0x367cfd,_0x3ace1d){_0x3ace1d(null,path[_0x998e('0x33')](config[_0x998e('0x34')],_0x998e('0x35')));},'filename':function(_0x57a54f,_0x439e3c,_0x17f417){_0x17f417(null,util[_0x998e('0x36')](_0x998e('0x37'),Date[_0x998e('0x38')](),_0x439e3c[_0x998e('0x39')]));}})});router[_0x998e('0x2f')](_0x998e('0xc'),upload['single'](_0x998e('0x3a')),controller[_0x998e('0x3b')]);router['post'](_0x998e('0x3c'),auth[_0x998e('0x8')](),controller[_0x998e('0x3d')]);router[_0x998e('0x2f')](_0x998e('0x3e'),auth['isAuthenticated'](),controller[_0x998e('0x3f')]);router[_0x998e('0x2f')]('/:id/pause',auth[_0x998e('0x8')](),controller[_0x998e('0x40')]);router[_0x998e('0x2f')](_0x998e('0x41'),auth['isAuthenticated'](),controller['unpause']);router[_0x998e('0x2f')](_0x998e('0x1e'),auth[_0x998e('0x8')](),controller[_0x998e('0x42')]);router[_0x998e('0x2f')](_0x998e('0x43'),auth[_0x998e('0x8')](),controller[_0x998e('0x44')]);router[_0x998e('0x2f')](_0x998e('0x45'),auth[_0x998e('0x8')](),controller[_0x998e('0x46')]);router[_0x998e('0x2f')](_0x998e('0x47'),auth[_0x998e('0x8')](),controller[_0x998e('0x48')]);router['post'](_0x998e('0x49'),auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0x998e('0x2f')](_0x998e('0x4a'),auth[_0x998e('0x8')](),controller[_0x998e('0x4b')]);router[_0x998e('0x2f')](_0x998e('0x24'),auth['isAuthenticated'](),controller[_0x998e('0x4c')]);router[_0x998e('0x2f')](_0x998e('0x26'),auth['isAuthenticated'](),controller[_0x998e('0x4d')]);router[_0x998e('0x2f')](_0x998e('0x4e'),auth[_0x998e('0x8')](),controller[_0x998e('0x4f')]);router['post'](_0x998e('0x29'),auth[_0x998e('0x8')](),controller[_0x998e('0x50')]);router[_0x998e('0x2f')]('/:id/chat_websites',auth[_0x998e('0x8')](),controller[_0x998e('0x51')]);router[_0x998e('0x2f')](_0x998e('0x2d'),auth['isAuthenticated'](),controller[_0x998e('0x52')]);router['put']('/:id',auth[_0x998e('0x8')](),controller[_0x998e('0x53')]);router[_0x998e('0x54')]('/:id/password',auth[_0x998e('0x8')](),controller[_0x998e('0x55')]);router[_0x998e('0x56')]('/:id/queues',auth[_0x998e('0x8')](),controller[_0x998e('0x57')]);router[_0x998e('0x56')]('/:id/teams',auth[_0x998e('0x8')](),controller[_0x998e('0x58')]);router[_0x998e('0x56')](_0x998e('0xa'),auth[_0x998e('0x8')](),controller['destroy']);router[_0x998e('0x56')](_0x998e('0x43'),auth[_0x998e('0x8')](),controller[_0x998e('0x59')]);router['delete']('/:id/mail_interactions',auth[_0x998e('0x8')](),controller[_0x998e('0x5a')]);router[_0x998e('0x56')]('/:id/fax_interactions',auth[_0x998e('0x8')](),controller[_0x998e('0x5b')]);router[_0x998e('0x56')]('/:id/sms_interactions',auth[_0x998e('0x8')](),controller[_0x998e('0x5c')]);router[_0x998e('0x56')](_0x998e('0x4a'),auth['isAuthenticated'](),controller[_0x998e('0x5d')]);router['delete']('/:id/fax_accounts',auth[_0x998e('0x8')](),controller[_0x998e('0x5e')]);router[_0x998e('0x56')](_0x998e('0x26'),auth[_0x998e('0x8')](),controller[_0x998e('0x5f')]);router[_0x998e('0x56')](_0x998e('0x4e'),auth[_0x998e('0x8')](),controller[_0x998e('0x60')]);router[_0x998e('0x56')](_0x998e('0x29'),auth[_0x998e('0x8')](),controller[_0x998e('0x61')]);router['delete'](_0x998e('0x2b'),auth[_0x998e('0x8')](),controller['removeChatWebsites']);router[_0x998e('0x56')]('/:id/square_projects',auth['isAuthenticated'](),controller['removeSquareProjects']);module[_0x998e('0x62')]=router; \ No newline at end of file +var _0x9ff9=['/:id/unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','/:id/sms_accounts','addSquareProjects','put','/:id/password','changePassword','delete','removeTeams','destroy','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','multer','util','path','express','Router','./user.controller','index','get','/describe','isAuthenticated','/:id','/:id/avatar','getAvatar','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','getGroups','getRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getTeams','getLists','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/chat_websites','/:id/square_projects','getSquareProjects','post','/create_many','create','addQueues','diskStorage','root','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','pause'];(function(_0x2578e7,_0x30c9b9){var _0x365568=function(_0x38fb98){while(--_0x38fb98){_0x2578e7['push'](_0x2578e7['shift']());}};_0x365568(++_0x30c9b9);}(_0x9ff9,0x1de));var _0x99ff=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9ff9[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x99ff('0x0'));var util=require(_0x99ff('0x1'));var path=require(_0x99ff('0x2'));var express=require(_0x99ff('0x3'));var router=express[_0x99ff('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x99ff('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x99ff('0x6')]);router[_0x99ff('0x7')](_0x99ff('0x8'),auth[_0x99ff('0x9')](),controller['describe']);router[_0x99ff('0x7')](_0x99ff('0xa'),auth[_0x99ff('0x9')](),controller['show']);router[_0x99ff('0x7')](_0x99ff('0xb'),controller[_0x99ff('0xc')]);router[_0x99ff('0x7')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x99ff('0xd')]);router[_0x99ff('0x7')](_0x99ff('0xe'),auth[_0x99ff('0x9')](),controller[_0x99ff('0xf')]);router['get'](_0x99ff('0x10'),auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0x99ff('0x7')](_0x99ff('0x11'),auth[_0x99ff('0x9')](),controller[_0x99ff('0x12')]);router[_0x99ff('0x7')]('/:id/recordings',auth[_0x99ff('0x9')](),controller[_0x99ff('0x13')]);router['get'](_0x99ff('0x14'),auth[_0x99ff('0x9')](),controller[_0x99ff('0x15')]);router[_0x99ff('0x7')](_0x99ff('0x16'),auth['isAuthenticated'](),controller[_0x99ff('0x17')]);router[_0x99ff('0x7')](_0x99ff('0x18'),auth[_0x99ff('0x9')](),controller['getMailInteractions']);router[_0x99ff('0x7')]('/:id/sms/interactions',auth[_0x99ff('0x9')](),controller[_0x99ff('0x19')]);router['get'](_0x99ff('0x1a'),auth[_0x99ff('0x9')](),controller[_0x99ff('0x1b')]);router[_0x99ff('0x7')]('/:id/teams',auth[_0x99ff('0x9')](),controller[_0x99ff('0x1c')]);router[_0x99ff('0x7')]('/:id/lists',auth[_0x99ff('0x9')](),controller[_0x99ff('0x1d')]);router[_0x99ff('0x7')]('/:id/agents',auth[_0x99ff('0x9')](),controller['getAgents']);router[_0x99ff('0x7')](_0x99ff('0x1e'),auth['isAuthenticated'](),controller[_0x99ff('0x1f')]);router[_0x99ff('0x7')](_0x99ff('0x20'),auth[_0x99ff('0x9')](),controller[_0x99ff('0x21')]);router[_0x99ff('0x7')](_0x99ff('0x22'),auth[_0x99ff('0x9')](),controller[_0x99ff('0x23')]);router[_0x99ff('0x7')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x99ff('0x24')]);router[_0x99ff('0x7')]('/:id/sms_accounts',auth[_0x99ff('0x9')](),controller['getSmsAccounts']);router[_0x99ff('0x7')](_0x99ff('0x25'),auth[_0x99ff('0x9')](),controller['getChatWebsites']);router[_0x99ff('0x7')](_0x99ff('0x26'),auth[_0x99ff('0x9')](),controller[_0x99ff('0x27')]);router[_0x99ff('0x28')](_0x99ff('0x29'),auth['isAuthenticated'](),controller['bulkCreate']);router['post']('/:id/contacts',auth[_0x99ff('0x9')](),controller['addContacts']);router[_0x99ff('0x28')]('/',auth[_0x99ff('0x9')](),controller[_0x99ff('0x2a')]);router[_0x99ff('0x28')](_0x99ff('0xe'),auth['isAuthenticated'](),controller[_0x99ff('0x2b')]);var upload=multer({'storage':multer[_0x99ff('0x2c')]({'destination':function(_0x40796b,_0x41a24d,_0x27bd62){_0x27bd62(null,path['join'](config[_0x99ff('0x2d')],'server/files/images/'));},'filename':function(_0x5cecd4,_0x4b832a,_0x447a99){_0x447a99(null,util['format'](_0x99ff('0x2e'),Date[_0x99ff('0x2f')](),_0x4b832a[_0x99ff('0x30')]));}})});router[_0x99ff('0x28')](_0x99ff('0xb'),upload[_0x99ff('0x31')](_0x99ff('0x32')),controller[_0x99ff('0x33')]);router[_0x99ff('0x28')](_0x99ff('0x34'),auth[_0x99ff('0x9')](),controller[_0x99ff('0x35')]);router[_0x99ff('0x28')](_0x99ff('0x36'),auth[_0x99ff('0x9')](),controller['logout']);router['post']('/:id/pause',auth['isAuthenticated'](),controller[_0x99ff('0x37')]);router[_0x99ff('0x28')](_0x99ff('0x38'),auth['isAuthenticated'](),controller['unpause']);router['post'](_0x99ff('0x39'),auth[_0x99ff('0x9')](),controller[_0x99ff('0x3a')]);router[_0x99ff('0x28')](_0x99ff('0x3b'),auth['isAuthenticated'](),controller[_0x99ff('0x3c')]);router[_0x99ff('0x28')](_0x99ff('0x3d'),auth[_0x99ff('0x9')](),controller[_0x99ff('0x3e')]);router[_0x99ff('0x28')](_0x99ff('0x3f'),auth[_0x99ff('0x9')](),controller[_0x99ff('0x40')]);router['post'](_0x99ff('0x41'),auth[_0x99ff('0x9')](),controller[_0x99ff('0x42')]);router[_0x99ff('0x28')](_0x99ff('0x43'),auth[_0x99ff('0x9')](),controller[_0x99ff('0x44')]);router[_0x99ff('0x28')]('/:id/fax_accounts',auth[_0x99ff('0x9')](),controller[_0x99ff('0x45')]);router['post'](_0x99ff('0x22'),auth[_0x99ff('0x9')](),controller['addMailAccounts']);router[_0x99ff('0x28')](_0x99ff('0x46'),auth['isAuthenticated'](),controller[_0x99ff('0x47')]);router[_0x99ff('0x28')](_0x99ff('0x48'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0x99ff('0x28')]('/:id/chat_websites',auth[_0x99ff('0x9')](),controller['addChatWebsites']);router['post'](_0x99ff('0x26'),auth['isAuthenticated'](),controller[_0x99ff('0x49')]);router['put'](_0x99ff('0xa'),auth[_0x99ff('0x9')](),controller['update']);router[_0x99ff('0x4a')](_0x99ff('0x4b'),auth[_0x99ff('0x9')](),controller[_0x99ff('0x4c')]);router[_0x99ff('0x4d')](_0x99ff('0xe'),auth[_0x99ff('0x9')](),controller['removeQueues']);router[_0x99ff('0x4d')](_0x99ff('0x39'),auth[_0x99ff('0x9')](),controller[_0x99ff('0x4e')]);router[_0x99ff('0x4d')](_0x99ff('0xa'),auth[_0x99ff('0x9')](),controller[_0x99ff('0x4f')]);router[_0x99ff('0x4d')](_0x99ff('0x3b'),auth[_0x99ff('0x9')](),controller['removeChatInteractions']);router[_0x99ff('0x4d')](_0x99ff('0x3d'),auth[_0x99ff('0x9')](),controller[_0x99ff('0x50')]);router['delete']('/:id/fax_interactions',auth[_0x99ff('0x9')](),controller[_0x99ff('0x51')]);router[_0x99ff('0x4d')]('/:id/sms_interactions',auth[_0x99ff('0x9')](),controller[_0x99ff('0x52')]);router[_0x99ff('0x4d')](_0x99ff('0x43'),auth[_0x99ff('0x9')](),controller[_0x99ff('0x53')]);router[_0x99ff('0x4d')](_0x99ff('0x20'),auth[_0x99ff('0x9')](),controller[_0x99ff('0x54')]);router['delete'](_0x99ff('0x22'),auth[_0x99ff('0x9')](),controller[_0x99ff('0x55')]);router['delete'](_0x99ff('0x46'),auth[_0x99ff('0x9')](),controller['removeOpenchannelAccounts']);router[_0x99ff('0x4d')](_0x99ff('0x48'),auth[_0x99ff('0x9')](),controller[_0x99ff('0x56')]);router['delete']('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x99ff('0x57')]);router['delete'](_0x99ff('0x26'),auth['isAuthenticated'](),controller[_0x99ff('0x58')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 61970bf..eb3213a 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 _0x54ad=['auto','nonat','outgoing','yes','force_rport,comedia','nat','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','active','actpass','update','showWebBar','get','isArray','wss','avpf','force_avp','icesupport','dtlssetup','dtlscertfile','dtlsenable','dtlsverify','dtlsprivatekey','/etc/pki/tls/private/motion.key','rtcp_mux','TEXT','permissions','map','sequelize','moment','util','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','getDataValue','internal','STRING','email','toLowerCase','user','agent','telephone','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','fullname','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','udp','transport','join','split','rfc2833','shortinfo','inband'];(function(_0x4d22af,_0x2da329){var _0x1aa3f4=function(_0x58538c){while(--_0x58538c){_0x4d22af['push'](_0x4d22af['shift']());}};_0x1aa3f4(++_0x2da329);}(_0x54ad,0x11d));var _0xd54a=function(_0x1f6610,_0x37b34d){_0x1f6610=_0x1f6610-0x0;var _0x35af1d=_0x54ad[_0x1f6610];return _0x35af1d;};'use strict';var Sequelize=require(_0xd54a('0x0'));var moment=require(_0xd54a('0x1'));var util=require(_0xd54a('0x2'));var _=require(_0xd54a('0x3'));module[_0xd54a('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd54a('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2c8b62){this[_0xd54a('0x6')](_0xd54a('0x5'),_0x2c8b62);this[_0xd54a('0x6')](_0xd54a('0x7'),_0x2c8b62);},'comment':_0xd54a('0x8')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x511781){this[_0xd54a('0x6')]('fullname',_0x511781);this[_0xd54a('0x6')](_0xd54a('0x9'),util['format']('\x22%s\x22\x20<%s>',_0x511781,this[_0xd54a('0xa')](_0xd54a('0xb'))));}},'alias':{'type':Sequelize[_0xd54a('0xc')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd54a('0xd'),'validate':{'isEmail':!![]},'set':function(_0x10d77c){if(_0x10d77c){this[_0xd54a('0x6')]('email',_0x10d77c[_0xd54a('0xe')]());}}},'role':{'type':Sequelize['ENUM']('admin',_0xd54a('0xf'),_0xd54a('0x10'),_0xd54a('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0xd54a('0xc')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xd54a('0xc')],'defaultValue':_0xd54a('0x12')},'internal':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':![],'unique':_0xd54a('0xb'),'set':function(_0x3f3e85){this[_0xd54a('0x6')](_0xd54a('0xb'),_0x3f3e85);this[_0xd54a('0x6')](_0xd54a('0x14'),_0x3f3e85);this[_0xd54a('0x6')](_0xd54a('0x9'),util['format'](_0xd54a('0x15'),this['getDataValue'](_0xd54a('0x16')),_0x3f3e85));}},'salt':{'type':Sequelize[_0xd54a('0xc')]},'phone':{'type':Sequelize[_0xd54a('0xc')]},'mobile':{'type':Sequelize[_0xd54a('0xc')]},'address':{'type':Sequelize[_0xd54a('0xc')]},'zipcode':{'type':Sequelize[_0xd54a('0xc')]},'userpic':{'type':Sequelize[_0xd54a('0xc')]},'city':{'type':Sequelize[_0xd54a('0xc')]},'country':{'type':Sequelize[_0xd54a('0xc')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xd54a('0x17')]},'voicePause':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xd54a('0x19')},'lastPauseAt':{'type':Sequelize[_0xd54a('0x17')]},'chatCapacity':{'type':Sequelize[_0xd54a('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xd54a('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xd54a('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xd54a('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xd54a('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xd54a('0x13')](0x5),'defaultValue':0x13c4},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xd54a('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![],'defaultValue':_0xd54a('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xd54a('0x1b')]('friend',_0xd54a('0xf'),_0xd54a('0x1c')),'allowNull':!![],'defaultValue':_0xd54a('0x1d')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xd54a('0x1e')},'callingpres':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x1f'),_0xd54a('0x20'),_0xd54a('0x21'),_0xd54a('0x22'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xd54a('0x23'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'secret':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![],'defaultValue':_0xd54a('0x24'),'set':function(_0x177d56){this['setDataValue'](_0xd54a('0x25'),_0x177d56?_0x177d56[_0xd54a('0x26')](','):null);},'get':function(){return this['getDataValue'](_0xd54a('0x25'))?this[_0xd54a('0xa')]('transport')[_0xd54a('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x28'),'info',_0xd54a('0x29'),_0xd54a('0x2a'),_0xd54a('0x2b')),'allowNull':!![],'defaultValue':_0xd54a('0x28')},'directmedia':{'type':Sequelize[_0xd54a('0x1b')]('yes','no',_0xd54a('0x2c'),'update',_0xd54a('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'nat':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![],'defaultValue':_0xd54a('0x2f'),'set':function(_0x2eb17b){this[_0xd54a('0x6')](_0xd54a('0x30'),_0x2eb17b?_0x2eb17b[_0xd54a('0x26')](','):null);},'get':function(){return this[_0xd54a('0xa')](_0xd54a('0x30'))?this[_0xd54a('0xa')]('nat')[_0xd54a('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xd54a('0xc')]},'namedcallgroup':{'type':Sequelize[_0xd54a('0xc')]},'pickupgroup':{'type':Sequelize[_0xd54a('0xc')]},'namedpickupgroup':{'type':Sequelize[_0xd54a('0xc')]},'language':{'type':Sequelize[_0xd54a('0xc')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xd54a('0xc')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xd54a('0xc')],'allowNull':![],'defaultValue':_0xd54a('0x31'),'set':function(_0x2f16bc){this[_0xd54a('0x6')](_0xd54a('0x32'),_0x2f16bc?_0x2f16bc[_0xd54a('0x26')](';'):_0xd54a('0x31'));},'get':function(){return this[_0xd54a('0xa')]('allow')?this[_0xd54a('0xa')](_0xd54a('0x32'))['split'](';'):null;},'comment':_0xd54a('0x33')},'autoframing':{'type':Sequelize['ENUM'](_0xd54a('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![],'set':function(_0x45af93){this['setDataValue'](_0xd54a('0x34'),_0x45af93?_0x45af93['join'](','):null);},'get':function(){return this[_0xd54a('0xa')](_0xd54a('0x34'))?this[_0xd54a('0xa')](_0xd54a('0x34'))[_0xd54a('0x27')](','):null;},'comment':_0xd54a('0x35')},'trustrpid':{'type':Sequelize['ENUM'](_0xd54a('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xd54a('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd54a('0x1b')]('yes','no',_0xd54a('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x2e'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xd54a('0x1b')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![],'defaultValue':_0xd54a('0x37')},'amaflags':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x2e'),'no'),'allowNull':!![],'defaultValue':_0xd54a('0x2e')},'busylevel':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x2e'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xd54a('0x1b')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xd54a('0x1b')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0xd54a('0x2e'),'no',_0xd54a('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xd54a('0x1b')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xd54a('0x39'),_0xd54a('0x3a'),_0xd54a('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x3c'),_0xd54a('0x3d')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xd54a('0x1b')]('yes','no'),'allowNull':!![],'defaultValue':_0xd54a('0x2e')},'keepalive':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xd54a('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xd54a('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x2e'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x2e'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xd54a('0x2e'),'no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x3e'),'passive',_0xd54a('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xd54a('0x1b')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xd54a('0x1b')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xd54a('0x2e'),'no',_0xd54a('0x2c'),_0xd54a('0x40'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xd54a('0xc')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'showWebBar':{'type':Sequelize[_0xd54a('0x13')],'defaultValue':0x0,'set':function(_0xd0f1c4){this[_0xd54a('0x6')](_0xd54a('0x41'),_0xd0f1c4);var _0x229e4e=this[_0xd54a('0x42')]({'plain':!![]});switch(_0xd0f1c4){case 0x0:case 0x1:var _0x3311b1=_0x229e4e['transport']?_[_0xd54a('0x43')](_0x229e4e['transport'])?_0x229e4e[_0xd54a('0x25')][_0xd54a('0x26')]():_0x229e4e[_0xd54a('0x25')]:_0xd54a('0x24');if(_0x3311b1===_0xd54a('0x44')){_0x3311b1=_0xd54a('0x24');}this['setDataValue'](_0xd54a('0x25'),_0x3311b1);this[_0xd54a('0x6')]('encryption','no');this['setDataValue'](_0xd54a('0x45'),null);this[_0xd54a('0x6')](_0xd54a('0x46'),null);this[_0xd54a('0x6')](_0xd54a('0x47'),null);this['setDataValue']('dtlsenable',null);this[_0xd54a('0x6')]('dtlsverify',null);this['setDataValue'](_0xd54a('0x48'),null);this[_0xd54a('0x6')](_0xd54a('0x49'),null);this[_0xd54a('0x6')]('dtlsprivatekey',null);this[_0xd54a('0x6')]('rtcp_mux','no');break;case 0x2:this[_0xd54a('0x6')](_0xd54a('0x25'),'wss');this['setDataValue']('encryption',_0xd54a('0x2e'));this['setDataValue'](_0xd54a('0x45'),'yes');this['setDataValue'](_0xd54a('0x46'),_0xd54a('0x2e'));this[_0xd54a('0x6')](_0xd54a('0x47'),_0xd54a('0x2e'));this['setDataValue'](_0xd54a('0x4a'),_0xd54a('0x2e'));this[_0xd54a('0x6')](_0xd54a('0x4b'),'no');this[_0xd54a('0x6')](_0xd54a('0x48'),_0xd54a('0x3f'));this['setDataValue']('dtlscertfile',_0x229e4e[_0xd54a('0x49')]||'/etc/pki/tls/certs/motion.crt');this[_0xd54a('0x6')](_0xd54a('0x4c'),_0x229e4e[_0xd54a('0x4c')]||_0xd54a('0x4d'));this[_0xd54a('0x6')](_0xd54a('0x4e'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xd54a('0x4f')],'set':function(_0x4feebc){this[_0xd54a('0x6')](_0xd54a('0x50'),_0x4feebc?_0x4feebc[_0xd54a('0x26')](','):[]);},'get':function(){return this[_0xd54a('0xa')](_0xd54a('0x50'))?_[_0xd54a('0x51')](this[_0xd54a('0xa')]('permissions')[_0xd54a('0x27')](','),function(_0x242d0c){return parseInt(_0x242d0c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xd54a('0xc')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xd54a('0xc')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xd54a('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xd54a('0xc')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xd54a('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x2e'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xf7d6=['from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','showWebBar','get','isArray','udp','wss','encryption','avpf','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','icesupport','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','sequelize','moment','util','lodash','exports','STRING','name','defaultuser','The\x20name\x20of\x20the\x20user','fullname','setDataValue','callerid','format','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','local','INTEGER','\x22%s\x22\x20<%s>','BOOLEAN','DATE','dynamic','friend','peer'];(function(_0x19d980,_0x5490a8){var _0x4f0713=function(_0x27042a){while(--_0x27042a){_0x19d980['push'](_0x19d980['shift']());}};_0x4f0713(++_0x5490a8);}(_0xf7d6,0x93));var _0x6f7d=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xf7d6[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0x6f7d('0x0'));var moment=require(_0x6f7d('0x1'));var util=require(_0x6f7d('0x2'));var _=require(_0x6f7d('0x3'));module[_0x6f7d('0x4')]={'name':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':![],'unique':_0x6f7d('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x25a3d1){this['setDataValue'](_0x6f7d('0x6'),_0x25a3d1);this['setDataValue'](_0x6f7d('0x7'),_0x25a3d1);},'comment':_0x6f7d('0x8')},'fullname':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':![],'set':function(_0x4b94c4){this['setDataValue'](_0x6f7d('0x9'),_0x4b94c4);this[_0x6f7d('0xa')](_0x6f7d('0xb'),util[_0x6f7d('0xc')]('\x22%s\x22\x20<%s>',_0x4b94c4,this[_0x6f7d('0xd')](_0x6f7d('0xe'))));}},'alias':{'type':Sequelize[_0x6f7d('0x5')]},'email':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':![],'unique':_0x6f7d('0xf'),'validate':{'isEmail':!![]},'set':function(_0x9c026c){if(_0x9c026c){this[_0x6f7d('0xa')](_0x6f7d('0xf'),_0x9c026c[_0x6f7d('0x10')]());}}},'role':{'type':Sequelize[_0x6f7d('0x11')](_0x6f7d('0x12'),_0x6f7d('0x13'),_0x6f7d('0x14'),'telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x6f7d('0x5')],'defaultValue':_0x6f7d('0x15')},'internal':{'type':Sequelize[_0x6f7d('0x16')](0xb),'allowNull':![],'unique':_0x6f7d('0xe'),'set':function(_0x111868){this[_0x6f7d('0xa')](_0x6f7d('0xe'),_0x111868);this[_0x6f7d('0xa')]('accountcode',_0x111868);this[_0x6f7d('0xa')](_0x6f7d('0xb'),util[_0x6f7d('0xc')](_0x6f7d('0x17'),this[_0x6f7d('0xd')](_0x6f7d('0x9')),_0x111868));}},'salt':{'type':Sequelize[_0x6f7d('0x5')]},'phone':{'type':Sequelize[_0x6f7d('0x5')]},'mobile':{'type':Sequelize[_0x6f7d('0x5')]},'address':{'type':Sequelize[_0x6f7d('0x5')]},'zipcode':{'type':Sequelize[_0x6f7d('0x5')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x6f7d('0x5')]},'country':{'type':Sequelize[_0x6f7d('0x5')]},'online':{'type':Sequelize[_0x6f7d('0x18')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x6f7d('0x19')]},'voicePause':{'type':Sequelize[_0x6f7d('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x6f7d('0x18')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x6f7d('0x18')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x6f7d('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x6f7d('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x6f7d('0x19')]},'chatCapacity':{'type':Sequelize[_0x6f7d('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x6f7d('0x16')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x6f7d('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x6f7d('0x16')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x6f7d('0x16')](0x5),'defaultValue':0x13c4},'phoneBarExpires':{'type':Sequelize[_0x6f7d('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x6f7d('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x6f7d('0x18')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x6f7d('0x18')],'defaultValue':![]},'description':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![],'defaultValue':_0x6f7d('0x1a')},'ipaddr':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x6f7d('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x6f7d('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x6f7d('0x1b'),'user',_0x6f7d('0x1c')),'allowNull':!![],'defaultValue':_0x6f7d('0x1b')},'context':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![],'defaultValue':_0x6f7d('0x1d')},'callingpres':{'type':Sequelize[_0x6f7d('0x11')]('ALLOWED_NOT_SCREENED',_0x6f7d('0x1e'),_0x6f7d('0x1f'),_0x6f7d('0x20'),_0x6f7d('0x21'),_0x6f7d('0x22'),_0x6f7d('0x23'),_0x6f7d('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0xe6849e){this[_0x6f7d('0xa')]('transport',_0xe6849e?_0xe6849e[_0x6f7d('0x25')](','):null);},'get':function(){return this[_0x6f7d('0xd')](_0x6f7d('0x26'))?this[_0x6f7d('0xd')](_0x6f7d('0x26'))[_0x6f7d('0x27')](','):null;},'comment':_0x6f7d('0x28')},'dtmfmode':{'type':Sequelize[_0x6f7d('0x11')](_0x6f7d('0x29'),_0x6f7d('0x2a'),_0x6f7d('0x2b'),'inband','auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x6f7d('0x11')](_0x6f7d('0x2c'),'no',_0x6f7d('0x2d'),_0x6f7d('0x2e'),_0x6f7d('0x2f')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6f7d('0x11')](_0x6f7d('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![],'defaultValue':_0x6f7d('0x30'),'set':function(_0x2cf366){this['setDataValue'](_0x6f7d('0x31'),_0x2cf366?_0x2cf366[_0x6f7d('0x25')](','):null);},'get':function(){return this['getDataValue'](_0x6f7d('0x31'))?this['getDataValue'](_0x6f7d('0x31'))[_0x6f7d('0x27')](','):null;},'comment':_0x6f7d('0x32')},'callgroup':{'type':Sequelize[_0x6f7d('0x5')]},'namedcallgroup':{'type':Sequelize[_0x6f7d('0x5')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x6f7d('0x5')]},'language':{'type':Sequelize[_0x6f7d('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6f7d('0x5')]},'disallow':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':![],'defaultValue':_0x6f7d('0x33')},'allow':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':![],'defaultValue':_0x6f7d('0x34'),'set':function(_0x3d03a8){this[_0x6f7d('0xa')](_0x6f7d('0x35'),_0x3d03a8?_0x3d03a8[_0x6f7d('0x25')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x6f7d('0xd')](_0x6f7d('0x35'))?this[_0x6f7d('0xd')]('allow')[_0x6f7d('0x27')](';'):null;},'comment':_0x6f7d('0x36')},'autoframing':{'type':Sequelize['ENUM'](_0x6f7d('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![],'set':function(_0x5bd3a2){this['setDataValue'](_0x6f7d('0x37'),_0x5bd3a2?_0x5bd3a2[_0x6f7d('0x25')](','):null);},'get':function(){return this['getDataValue'](_0x6f7d('0x37'))?this[_0x6f7d('0xd')]('insecure')[_0x6f7d('0x27')](','):null;},'comment':_0x6f7d('0x38')},'trustrpid':{'type':Sequelize[_0x6f7d('0x11')](_0x6f7d('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6f7d('0x11')](_0x6f7d('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6f7d('0x11')](_0x6f7d('0x2c'),'no',_0x6f7d('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x6f7d('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x6f7d('0x11')](_0x6f7d('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x6f7d('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x6f7d('0x11')](_0x6f7d('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x6f7d('0x2c')},'busylevel':{'type':Sequelize[_0x6f7d('0x16')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x6f7d('0x11')](_0x6f7d('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x6f7d('0x11')](_0x6f7d('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x6f7d('0x11')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x6f7d('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x6f7d('0x2c'),'no',_0x6f7d('0x3a')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6f7d('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x6f7d('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x6f7d('0x11')](_0x6f7d('0x3b'),'refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x6f7d('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x6f7d('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x6f7d('0x11')](_0x6f7d('0x3c'),_0x6f7d('0x3d')),'allowNull':!![],'defaultValue':_0x6f7d('0x3d')},'t38pt_usertpsource':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x6f7d('0x11')]('yes','no'),'allowNull':!![],'defaultValue':_0x6f7d('0x2c')},'keepalive':{'type':Sequelize[_0x6f7d('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x6f7d('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x6f7d('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x6f7d('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x6f7d('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x6f7d('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x6f7d('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x6f7d('0x11')](_0x6f7d('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6f7d('0x11')](_0x6f7d('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x6f7d('0x11')](_0x6f7d('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x6f7d('0x11')](_0x6f7d('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x6f7d('0x11')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x6f7d('0x2c'),'no',_0x6f7d('0x3e'),_0x6f7d('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x6f7d('0x40'),_0x6f7d('0x41'),_0x6f7d('0x42')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x6f7d('0x11')](_0x6f7d('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x6f7d('0x16')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x6f7d('0x11')](_0x6f7d('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x6f7d('0x11')](_0x6f7d('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x6f7d('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM']('yes','no','nonat','update',_0x6f7d('0x43')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x6f7d('0x5')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'showWebBar':{'type':Sequelize[_0x6f7d('0x16')],'defaultValue':0x0,'set':function(_0x39db62){this[_0x6f7d('0xa')](_0x6f7d('0x44'),_0x39db62);var _0x2bd577=this[_0x6f7d('0x45')]({'plain':!![]});switch(_0x39db62){case 0x0:case 0x1:var _0xbe52dc=_0x2bd577[_0x6f7d('0x26')]?_[_0x6f7d('0x46')](_0x2bd577[_0x6f7d('0x26')])?_0x2bd577['transport'][_0x6f7d('0x25')]():_0x2bd577[_0x6f7d('0x26')]:_0x6f7d('0x47');if(_0xbe52dc===_0x6f7d('0x48')){_0xbe52dc=_0x6f7d('0x47');}this[_0x6f7d('0xa')](_0x6f7d('0x26'),_0xbe52dc);this[_0x6f7d('0xa')](_0x6f7d('0x49'),'no');this[_0x6f7d('0xa')](_0x6f7d('0x4a'),null);this[_0x6f7d('0xa')]('force_avp',null);this[_0x6f7d('0xa')]('icesupport',null);this[_0x6f7d('0xa')](_0x6f7d('0x4b'),null);this[_0x6f7d('0xa')](_0x6f7d('0x4c'),null);this[_0x6f7d('0xa')](_0x6f7d('0x4d'),null);this[_0x6f7d('0xa')](_0x6f7d('0x4e'),null);this['setDataValue'](_0x6f7d('0x4f'),null);this[_0x6f7d('0xa')](_0x6f7d('0x50'),'no');break;case 0x2:this[_0x6f7d('0xa')](_0x6f7d('0x26'),_0x6f7d('0x48'));this[_0x6f7d('0xa')]('encryption',_0x6f7d('0x2c'));this[_0x6f7d('0xa')](_0x6f7d('0x4a'),_0x6f7d('0x2c'));this[_0x6f7d('0xa')](_0x6f7d('0x51'),'yes');this[_0x6f7d('0xa')](_0x6f7d('0x52'),_0x6f7d('0x2c'));this[_0x6f7d('0xa')]('dtlsenable',_0x6f7d('0x2c'));this['setDataValue'](_0x6f7d('0x4c'),'no');this['setDataValue'](_0x6f7d('0x4d'),_0x6f7d('0x42'));this['setDataValue'](_0x6f7d('0x4e'),_0x2bd577['dtlscertfile']||_0x6f7d('0x53'));this[_0x6f7d('0xa')](_0x6f7d('0x4f'),_0x2bd577['dtlsprivatekey']||_0x6f7d('0x54'));this[_0x6f7d('0xa')](_0x6f7d('0x50'),_0x6f7d('0x2c'));break;default:}}},'permissions':{'type':Sequelize[_0x6f7d('0x55')],'set':function(_0x1d814e){this[_0x6f7d('0xa')](_0x6f7d('0x56'),_0x1d814e?_0x1d814e['join'](','):[]);},'get':function(){return this['getDataValue'](_0x6f7d('0x56'))?_[_0x6f7d('0x57')](this[_0x6f7d('0xd')](_0x6f7d('0x56'))['split'](','),function(_0x49f12f){return parseInt(_0x49f12f,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x6f7d('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0x6f7d('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0x6f7d('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x6f7d('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x6f7d('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x6f7d('0x18')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x6f7d('0x16')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x6f7d('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x6f7d('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x6f7d('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x6f7d('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x6f7d('0x5')]},'passwordResetAt':{'type':Sequelize[_0x6f7d('0x19')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x6f7d('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x6f7d('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index adbd5ca..8a21860 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 _0xd68a=['ids','agent','agent\x20role','role','telephone','admin','user','getLicense','telephones','users','isNil','License\x20limit\x20reached','format','count\x20%s:\x20%s','create','Setting','findById','max','internal','SELECT','from','email','permissions','101','102','103','104','106','107','109','100','111','VoiceMail','changePassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','oldPassword','Sequelize','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','loginInPause','voicePause','isValidChannel','channel','Unknown\x20channel','capitalize','toLowerCase','Queues','penalty','voice','VoiceQueue','%s/%s','SIP','each','UserVoiceQueueRt','upsert','removeQueues','remove','userpic','file','filename','join','root','download','existsSync','server/files/images/','getContacts','findOne','CmContact','filter','Queue','get','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','UserId','VoiceRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','login','phone','mobile','interface','LOCAL/%s@from-sip/n','user:%s','emit','headers','x-forwarded-for','connection','remoteAddress','socket','push','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','all','getChannels','forEach','LOGIN','device','PAUSE','LOGININPAUSE','concat','QueuePause','pause','updateAttributes','type','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','pauseType','manual','mail','chat','fax','sms','set','%s%s','getTeams','addTeams','omit','removeTeams','CmList','getLists','getAgents','getVoiceQueues','Agents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','getVoicePrefixes','getFaxAccounts','FaxAccount','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getSquareProjects','addSquareProjects','removeSquareProjects','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','desk.js','querystring','papaparse','api','../../mysqldb','socket.io-emitter','./user.socket','register','jayson/promise','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','catch','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','User','rawAttributes','model','differenceBy','keys','password','salt','query','dateStart','dateEnd','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','pick','add','day','merge','where','map','sequelize','lower','col','options','includeAll','include','findAll','rows','show','params','length','bulkCreate','body','find','describe','addContacts'];(function(_0x1a1072,_0x84a807){var _0x415142=function(_0x3c20d6){while(--_0x3c20d6){_0x1a1072['push'](_0x1a1072['shift']());}};_0x415142(++_0x84a807);}(_0xd68a,0xba));var _0xad68=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xd68a[_0x37bd26];return _0xe83dc4;};'use strict';var jsonpatch=require(_0xad68('0x0'));var rp=require('request-promise');var moment=require(_0xad68('0x1'));var BPromise=require(_0xad68('0x2'));var Mustache=require(_0xad68('0x3'));var util=require(_0xad68('0x4'));var path=require(_0xad68('0x5'));var sox=require('sox');var csv=require(_0xad68('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xad68('0x7'));var squel=require(_0xad68('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xad68('0x9'));var toCsv=require('to-csv');var querystring=require(_0xad68('0xa'));var Papa=require(_0xad68('0xb'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xad68('0xc'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xad68('0xd'))['db'];var socket=require(_0xad68('0xe'))({'host':'localhost','port':0x18eb});require(_0xad68('0xf'))[_0xad68('0x10')](socket);var jayson=require(_0xad68('0x11'));var client=jayson[_0xad68('0x12')][_0xad68('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x397f35,_0x4b14e4,_0x1283c0,_0x16b904){return new BPromise(function(_0x2e30a6,_0xc884d2){var _0x6e4a5b=_0x16b904||client;return _0x6e4a5b[_0xad68('0x14')](_0x397f35,_0x1283c0)[_0xad68('0x15')](function(_0x21e701){logger[_0xad68('0x16')](_0xad68('0x17'),_0x4b14e4,_0xad68('0x18'));logger[_0xad68('0x19')](_0xad68('0x1a'),_0x4b14e4,_0xad68('0x18'),JSON[_0xad68('0x1b')](_0x21e701));if(_0x21e701[_0xad68('0x1c')]){if(_0x21e701[_0xad68('0x1c')][_0xad68('0x1d')]===0x1f4){logger[_0xad68('0x1c')](_0xad68('0x17'),_0x4b14e4,_0x21e701[_0xad68('0x1c')][_0xad68('0x1e')]);return _0xc884d2(_0x21e701[_0xad68('0x1c')][_0xad68('0x1e')]);}logger[_0xad68('0x1c')](_0xad68('0x17'),_0x4b14e4,_0x21e701[_0xad68('0x1c')][_0xad68('0x1e')]);return _0x2e30a6(_0x21e701['error'][_0xad68('0x1e')]);}else{logger[_0xad68('0x16')](_0xad68('0x17'),_0x4b14e4,_0xad68('0x18'));_0x2e30a6(_0x21e701[_0xad68('0x1f')][_0xad68('0x1e')]);}})[_0xad68('0x20')](function(_0x4efb78){logger[_0xad68('0x1c')](_0xad68('0x17'),_0x4b14e4,_0x4efb78);_0xc884d2(_0x4efb78);});});}function respondWithStatusCode(_0x27c2f0,_0x26c41b){_0x26c41b=_0x26c41b||0xcc;return function(_0x350aa3){if(_0x350aa3){return _0x27c2f0[_0xad68('0x21')](_0x26c41b);}return _0x27c2f0[_0xad68('0x22')](_0x26c41b)[_0xad68('0x23')]();};}function respondWithResult(_0x1d8de2,_0x4d6ebf){_0x4d6ebf=_0x4d6ebf||0xc8;return function(_0xf51997){if(_0xf51997){return _0x1d8de2[_0xad68('0x22')](_0x4d6ebf)['json'](_0xf51997);}};}function respondWithFilteredResult(_0x124d39,_0x5d4998){return function(_0x419f88){if(_0x419f88){var _0xb12ba3=_0x419f88[_0xad68('0x24')],_0x4b1e67=_0x5d4998[_0xad68('0x25')],_0x43b023=_0x5d4998[_0xad68('0x25')]+_0x5d4998['limit'],_0x275de1;if(_0x43b023>=_0xb12ba3){_0x43b023=_0xb12ba3;_0x275de1=0xc8;}else{_0x275de1=0xce;}_0x124d39[_0xad68('0x22')](_0x275de1);return _0x124d39['set'](_0xad68('0x26'),_0x4b1e67+'-'+_0x43b023+'/'+_0xb12ba3)[_0xad68('0x27')](_0x419f88);}return null;};}function patchUpdates(_0x46248d){return function(_0x395134){try{jsonpatch[_0xad68('0x28')](_0x395134,_0x46248d,!![]);}catch(_0x535cef){return BPromise[_0xad68('0x29')](_0x535cef);}return _0x395134[_0xad68('0x2a')]();};}function saveUpdates(_0x495604,_0x29ba53){return function(_0x284ccd){if(_0x284ccd){return _0x284ccd[_0xad68('0x2b')](_0x495604)[_0xad68('0x15')](function(_0xac592e){return _0xac592e;});}return null;};}function removeEntity(_0x4a562d,_0x2cca90){return function(_0x98c488){if(_0x98c488){return _0x98c488[_0xad68('0x2c')]()[_0xad68('0x15')](function(){_0x4a562d[_0xad68('0x22')](0xcc)[_0xad68('0x23')]();});}};}function handleEntityNotFound(_0x40b6bc,_0x3c1170){return function(_0x2aa36f){if(!_0x2aa36f){_0x40b6bc[_0xad68('0x21')](0x194);}return _0x2aa36f;};}function handleError(_0x592513,_0x4e6950){_0x4e6950=_0x4e6950||0x1f4;return function(_0x215cd5){logger[_0xad68('0x1c')](_0x215cd5[_0xad68('0x2d')]);if(_0x215cd5[_0xad68('0x2e')]){delete _0x215cd5['name'];}_0x592513[_0xad68('0x22')](_0x4e6950)[_0xad68('0x2f')](_0x215cd5);};}exports[_0xad68('0x30')]=function(_0x2b6be0,_0x201b30){var _0x1b9b8f={},_0x1dada8={},_0x4689c5={'count':0x0,'rows':[]};var _0x148096=db[_0xad68('0x31')][_0xad68('0x32')];_0x1dada8[_0xad68('0x33')]=_[_0xad68('0x34')](_[_0xad68('0x35')](_0x148096),[_0xad68('0x36'),_0xad68('0x37')]);var _0x2ba769={'dateStart':_0x2b6be0[_0xad68('0x38')][_0xad68('0x39')],'dateEnd':_0x2b6be0[_0xad68('0x38')][_0xad68('0x3a')]};delete _0x2b6be0['query'][_0xad68('0x39')];delete _0x2b6be0['query'][_0xad68('0x3a')];_0x1dada8[_0xad68('0x38')]=_[_0xad68('0x35')](_0x2b6be0[_0xad68('0x38')]);_0x1dada8[_0xad68('0x3b')]=_['intersection'](_0x1dada8[_0xad68('0x33')],_0x1dada8[_0xad68('0x38')]);_0x1b9b8f[_0xad68('0x3c')]=_[_0xad68('0x3d')](_0x1dada8[_0xad68('0x33')],qs[_0xad68('0x3e')](_0x2b6be0[_0xad68('0x38')][_0xad68('0x3e')]));_0x1b9b8f[_0xad68('0x3c')]=_0x1b9b8f[_0xad68('0x3c')]['length']?_0x1b9b8f['attributes']:_0x1dada8[_0xad68('0x33')];if(!_0x2b6be0[_0xad68('0x38')][_0xad68('0x3f')](_0xad68('0x40'))){_0x1b9b8f[_0xad68('0x41')]=qs['limit'](_0x2b6be0['query'][_0xad68('0x41')]);_0x1b9b8f['offset']=qs[_0xad68('0x25')](_0x2b6be0[_0xad68('0x38')][_0xad68('0x25')]);}_0x1b9b8f[_0xad68('0x42')]=qs[_0xad68('0x43')](_0x2b6be0[_0xad68('0x38')][_0xad68('0x43')]);_0x1b9b8f['where']=qs[_0xad68('0x3b')](_[_0xad68('0x44')](_0x2b6be0[_0xad68('0x38')],_0x1dada8['filters']));if(_0x2ba769[_0xad68('0x39')]){if(_0x2ba769[_0xad68('0x3a')]){_0x2ba769[_0xad68('0x3a')]=moment(_0x2ba769[_0xad68('0x3a')])[_0xad68('0x45')](0x1,_0xad68('0x46'));}else{_0x2ba769[_0xad68('0x3a')]=moment(_0x2ba769[_0xad68('0x39')])['add'](0x1,_0xad68('0x46'));}_[_0xad68('0x47')](_0x1b9b8f[_0xad68('0x48')],{'createdAt':{'$gte':_0x2ba769['dateStart'],'$lte':_0x2ba769['dateEnd']}});}if(_0x2b6be0[_0xad68('0x38')]['filter']){_0x1b9b8f[_0xad68('0x48')]=_['merge'](_0x1b9b8f[_0xad68('0x48')],{'$or':_[_0xad68('0x49')](_0x1b9b8f[_0xad68('0x3c')],function(_0x51253b){return db[_0xad68('0x4a')][_0xad68('0x48')](db['sequelize']['fn'](_0xad68('0x4b'),db['sequelize'][_0xad68('0x4c')](_0x51253b)),{'$like':db[_0xad68('0x4a')]['fn'](_0xad68('0x4b'),'%'+_0x2b6be0[_0xad68('0x38')]['filter']+'%')});})});}_0x1b9b8f=_[_0xad68('0x47')]({},_0x1b9b8f,_0x2b6be0[_0xad68('0x4d')]);var _0x1eb884={'where':_0x1b9b8f[_0xad68('0x48')]};return db[_0xad68('0x31')]['count'](_0x1eb884)['then'](function(_0x1b5336){_0x4689c5['count']=_0x1b5336;if(_0x2b6be0[_0xad68('0x38')][_0xad68('0x4e')]){_0x1b9b8f[_0xad68('0x4f')]=[{'all':!![]}];}return db[_0xad68('0x31')][_0xad68('0x50')](_0x1b9b8f);})[_0xad68('0x15')](function(_0x587a05){_0x4689c5[_0xad68('0x51')]=_0x587a05;return _0x4689c5;})[_0xad68('0x15')](respondWithFilteredResult(_0x201b30,_0x1b9b8f))['catch'](handleError(_0x201b30,null));};exports[_0xad68('0x52')]=function(_0x1565bd,_0x4b02d3){var _0x32eec1={'raw':![],'where':{'id':_0x1565bd[_0xad68('0x53')]['id']}},_0x2f1de0={};_0x2f1de0[_0xad68('0x33')]=_[_0xad68('0x34')](_[_0xad68('0x35')](db[_0xad68('0x31')][_0xad68('0x32')]),[_0xad68('0x36'),_0xad68('0x37')]);_0x2f1de0[_0xad68('0x38')]=_['keys'](_0x1565bd[_0xad68('0x38')]);_0x2f1de0[_0xad68('0x3b')]=_[_0xad68('0x3d')](_0x2f1de0[_0xad68('0x33')],_0x2f1de0[_0xad68('0x38')]);_0x32eec1[_0xad68('0x3c')]=_[_0xad68('0x3d')](_0x2f1de0['model'],qs[_0xad68('0x3e')](_0x1565bd[_0xad68('0x38')]['fields']));_0x32eec1['attributes']=_0x32eec1[_0xad68('0x3c')][_0xad68('0x54')]?_0x32eec1['attributes']:_0x2f1de0['model'];if(_0x1565bd[_0xad68('0x38')][_0xad68('0x4e')]){_0x32eec1[_0xad68('0x4f')]=[{'all':!![]}];}_0x32eec1=_['merge']({},_0x32eec1,_0x1565bd['options']);return db[_0xad68('0x31')]['find'](_0x32eec1)[_0xad68('0x15')](handleEntityNotFound(_0x4b02d3,null))[_0xad68('0x15')](respondWithResult(_0x4b02d3,null))[_0xad68('0x20')](handleError(_0x4b02d3,null));};exports[_0xad68('0x55')]=function(_0xcef0d0,_0x138400){return db[_0xad68('0x31')]['bulkCreate'](_0xcef0d0['body'],{'raw':![],'individualHooks':!![]})[_0xad68('0x15')](respondWithResult(_0x138400,0xc9))[_0xad68('0x20')](handleError(_0x138400,null));};exports[_0xad68('0x2b')]=function(_0x328e3c,_0x3fd7d2){if(_0x328e3c[_0xad68('0x56')]['id']){delete _0x328e3c['body']['id'];}return db[_0xad68('0x31')][_0xad68('0x57')]({'where':{'id':_0x328e3c[_0xad68('0x53')]['id']}})[_0xad68('0x15')](handleEntityNotFound(_0x3fd7d2,null))[_0xad68('0x15')](saveUpdates(_0x328e3c[_0xad68('0x56')],null))[_0xad68('0x15')](respondWithResult(_0x3fd7d2,null))[_0xad68('0x20')](handleError(_0x3fd7d2,null));};exports[_0xad68('0x58')]=function(_0x1e36f3,_0x311283){return db['User'][_0xad68('0x58')]()[_0xad68('0x15')](respondWithResult(_0x311283,null))['catch'](handleError(_0x311283,null));};exports[_0xad68('0x59')]=function(_0x3273ba,_0x1debfb,_0x4d9727){return db[_0xad68('0x31')]['find']({'where':{'id':_0x3273ba[_0xad68('0x53')]['id']}})[_0xad68('0x15')](handleEntityNotFound(_0x1debfb,null))[_0xad68('0x15')](function(_0x38c2e7){if(_0x38c2e7){return _0x38c2e7[_0xad68('0x59')](_0x3273ba[_0xad68('0x56')][_0xad68('0x5a')],_['omit'](_0x3273ba[_0xad68('0x56')],[_0xad68('0x5a'),'id'])||{});}})[_0xad68('0x15')](respondWithResult(_0x1debfb,null))[_0xad68('0x20')](handleError(_0x1debfb,null));};var getLicense=function(_0x41d12d){return new BPromise(function(_0x3d4ee5,_0x1e8496){var _0x5c3850=0x0;_0x41d12d[_0xad68('0x56')]['role']===_0xad68('0x5b')&&_0x3d4ee5(_0xad68('0x5c'));return db[_0xad68('0x31')][_0xad68('0x24')]({'where':{'$or':[{'role':_0x41d12d[_0xad68('0x56')][_0xad68('0x5d')]===_0xad68('0x5e')?'telephone':[_0xad68('0x5f'),_0xad68('0x60')]}]}})[_0xad68('0x15')](function(_0x930dc){_0x5c3850=_0x930dc;return require('../../config/license/util')[_0xad68('0x61')]();})[_0xad68('0x15')](function(_0x5413fd){var _0x92854e=_0x41d12d[_0xad68('0x56')]['role']===_0xad68('0x5e')?_0xad68('0x62'):_0xad68('0x63');if(!_[_0xad68('0x64')](_0x5413fd[_0x92854e])&&_0x5c3850>=_0x5413fd[_0x92854e]){return _0x1e8496({'message':_0xad68('0x65')});}return _0x3d4ee5(util[_0xad68('0x66')](_0xad68('0x67'),_0x92854e,_0x5c3850));})[_0xad68('0x20')](function(_0x430654){return _0x1e8496(_0x430654);});});};exports[_0xad68('0x68')]=function(_0x2a08b6,_0x280515){return getLicense(_0x2a08b6)[_0xad68('0x15')](function(_0x421705){if(!_0x2a08b6['body']['internal']){var _0x1b18c4;return db[_0xad68('0x69')][_0xad68('0x6a')](0x1)[_0xad68('0x15')](function(_0x118536){_0x1b18c4=_0x118536['min_internal'];return db[_0xad68('0x31')][_0xad68('0x6b')](_0xad68('0x6c'));})['then'](function(_0x26b8ff){if(_[_0xad68('0x64')](_0x26b8ff)){if(_0x1b18c4){_0x2a08b6['body']['internal']=_0x1b18c4;}else{_0x2a08b6[_0xad68('0x56')][_0xad68('0x6c')]=0x1;}}else{if(_[_0xad68('0x64')](_0x1b18c4)||_0x1b18c4==_0x26b8ff){_0x2a08b6['body'][_0xad68('0x6c')]=_0x26b8ff+0x1;}else if(_0x1b18c4>_0x26b8ff){_0x2a08b6[_0xad68('0x56')][_0xad68('0x6c')]=_0x1b18c4;}else{return db[_0xad68('0x4a')]['query']('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)',{'type':db[_0xad68('0x4a')]['QueryTypes'][_0xad68('0x6d')]})['then'](function(_0x2e4192){if(_0x2e4192&&_0x2e4192[_0xad68('0x54')]){for(var _0x10531b=0x0,_0x2d2013=_0x2e4192[_0xad68('0x54')];_0x10531b<_0x2d2013&&_[_0xad68('0x64')](_0x2a08b6['body']['internal']);_0x10531b++){if(_0x1b18c4<=_0x2e4192[_0x10531b][_0xad68('0x6e')]){_0x2a08b6[_0xad68('0x56')][_0xad68('0x6c')]=_0x2e4192[_0x10531b][_0xad68('0x6e')];}else if(_0x1b18c4>_0x2e4192[_0x10531b][_0xad68('0x6e')]&&_0x1b18c4<=_0x2e4192[_0x10531b]['to']){_0x2a08b6['body']['internal']=_0x1b18c4;}}}if(_['isNil'](_0x2a08b6[_0xad68('0x56')][_0xad68('0x6c')])){_0x2a08b6[_0xad68('0x56')][_0xad68('0x6c')]=_0x26b8ff+0x1;}});}}});}})[_0xad68('0x15')](function(){if(_0x2a08b6[_0xad68('0x56')]['voicemail']){_0x2a08b6[_0xad68('0x56')]['mailbox']=_0x2a08b6[_0xad68('0x56')]['internal'];_0x2a08b6[_0xad68('0x56')]['VoiceMail']={'mailbox':_0x2a08b6[_0xad68('0x56')][_0xad68('0x6c')],'password':_0x2a08b6['body'][_0xad68('0x36')],'fullname':_0x2a08b6[_0xad68('0x56')]['fullname'],'email':_0x2a08b6['body'][_0xad68('0x6f')]};}if(_0x2a08b6[_0xad68('0x56')]&&_0x2a08b6['body'][_0xad68('0x5d')]==='agent'){_0x2a08b6['body'][_0xad68('0x70')]=[_0xad68('0x71'),_0xad68('0x72'),_0xad68('0x73'),'110',_0xad68('0x74'),'105',_0xad68('0x75'),_0xad68('0x76'),'108',_0xad68('0x77'),_0xad68('0x78'),_0xad68('0x79')];}return db[_0xad68('0x31')][_0xad68('0x68')](_0x2a08b6[_0xad68('0x56')],{'include':[{'model':db[_0xad68('0x7a')],'as':'VoiceMail'}]});})[_0xad68('0x15')](respondWithResult(_0x280515,0xc9))[_0xad68('0x20')](handleError(_0x280515,null));};exports[_0xad68('0x7b')]=function(_0x270d28,_0x2af571,_0x44d54d){if(_0x270d28[_0xad68('0x56')]['id']){delete _0x270d28[_0xad68('0x56')]['id'];}return db[_0xad68('0x31')][_0xad68('0x57')]({'where':{'id':_0x270d28[_0xad68('0x53')]['id']}})[_0xad68('0x15')](function(_0x15a238){if(_0x15a238){if(_0x15a238['id']==_0x270d28[_0xad68('0x60')]['id']){if(!_0x270d28[_0xad68('0x56')]['oldPassword']||!_0x270d28[_0xad68('0x56')][_0xad68('0x7c')]){throw new db['Sequelize'][(_0xad68('0x7d'))](_0xad68('0x7e'));}if(!_0x15a238['authenticate'](_0x270d28[_0xad68('0x56')][_0xad68('0x7f')])){throw new db[(_0xad68('0x80'))][(_0xad68('0x7d'))](_0xad68('0x81'));}if(_0x270d28['body'][_0xad68('0x7f')]==_0x270d28['body']['newPassword']){throw new db['Sequelize']['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x15a238;}else if(_0x270d28[_0xad68('0x60')]['role']==_0xad68('0x5f')){if(!_0x270d28[_0xad68('0x56')][_0xad68('0x7c')]){throw new db[(_0xad68('0x80'))]['ValidationError'](_0xad68('0x82'));}return _0x15a238;}else if(_0x270d28[_0xad68('0x60')][_0xad68('0x5d')]==_0xad68('0x60')){if(!_0x270d28[_0xad68('0x56')][_0xad68('0x7c')]){throw new db[(_0xad68('0x80'))][(_0xad68('0x7d'))](_0xad68('0x82'));}if(_0x15a238[_0xad68('0x5d')]!='agent'){throw new db['Sequelize'][(_0xad68('0x7d'))](_0xad68('0x83'));}return _0x15a238;}else{throw new db[(_0xad68('0x80'))]['ValidationError'](_0xad68('0x83'));}}return null;})[_0xad68('0x15')](handleEntityNotFound(_0x2af571,null))[_0xad68('0x15')](saveUpdates({'password':_0x270d28[_0xad68('0x56')]['newPassword'],'passwordResetAt':_0x270d28['user']['id']==_0x270d28['params']['id']?moment():null},null))[_0xad68('0x15')](respondWithResult(_0x2af571,null))[_0xad68('0x20')](handleError(_0x2af571,null));};exports[_0xad68('0x84')]=function(_0x338b3e,_0x158091,_0x4a2340){var _0x51070e;return db[_0xad68('0x31')][_0xad68('0x57')]({'where':{'id':_0x338b3e[_0xad68('0x53')]['id']},'attributes':['id','name',_0xad68('0x5d'),_0xad68('0x85'),_0xad68('0x86')]})[_0xad68('0x15')](handleEntityNotFound(_0x158091,null))[_0xad68('0x15')](function(_0x3129d2){if(_0x3129d2){_0x51070e=_0x3129d2;if(!utils[_0xad68('0x87')](_0x338b3e[_0xad68('0x56')][_0xad68('0x88')])){throw new db['Sequelize']['ValidationError'](_0xad68('0x89'));}return _0x3129d2[_0xad68('0x45')+_[_0xad68('0x8a')](_0x338b3e['body'][_0xad68('0x88')][_0xad68('0x8b')]())+_0xad68('0x8c')](_0x338b3e[_0xad68('0x56')]['ids'],{'penalty':_0x338b3e[_0xad68('0x56')][_0xad68('0x8d')]||0x0});}})[_0xad68('0x15')](function(){if(_0x338b3e['body'][_0xad68('0x88')]===_0xad68('0x8e')){return db[_0xad68('0x8f')]['findAll']({'where':{'id':_0x338b3e[_0xad68('0x56')][_0xad68('0x5a')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xad68('0x15')](function(_0x68ad19){var _0x21354f=[];if(_0x338b3e['body'][_0xad68('0x88')]===_0xad68('0x8e')&&_0x51070e[_0xad68('0x5d')]==='agent'){for(var _0x2ba218=0x0;_0x2ba218<_0x68ad19['length'];_0x2ba218+=0x1){_0x21354f['push']({'membername':_0x51070e[_0xad68('0x2e')],'UserId':_0x51070e['id'],'queue_name':_0x68ad19[_0x2ba218][_0xad68('0x2e')],'VoiceQueueId':_0x68ad19[_0x2ba218]['id'],'interface':util['format'](_0xad68('0x90'),_0xad68('0x91'),_0x51070e[_0xad68('0x2e')]),'paused':_0x51070e[_0xad68('0x86')]||![],'penalty':_0x338b3e['body']['penalty']||0x0});}return BPromise[_0xad68('0x92')](_0x21354f,function(_0x10f645){return db[_0xad68('0x93')][_0xad68('0x94')](_0x10f645);});}return _0x51070e;})['then'](respondWithStatusCode(_0x158091,null))['catch'](handleError(_0x158091,null));};exports[_0xad68('0x95')]=function(_0x1542e9,_0x35bd7b,_0x1f655c){var _0x5d6323;return db[_0xad68('0x31')][_0xad68('0x57')]({'where':{'id':_0x1542e9[_0xad68('0x53')]['id']},'attributes':['id',_0xad68('0x2e'),_0xad68('0x5d')]})[_0xad68('0x15')](handleEntityNotFound(_0x35bd7b,null))[_0xad68('0x15')](function(_0x23f251){if(_0x23f251){_0x5d6323=_0x23f251;if(!_0x1542e9[_0xad68('0x38')]['channel']||!utils[_0xad68('0x87')](_0x1542e9[_0xad68('0x38')][_0xad68('0x88')])){throw new db[(_0xad68('0x80'))][(_0xad68('0x7d'))]('Unknown\x20channel');}return _0x23f251[_0xad68('0x96')+_[_0xad68('0x8a')](_0x1542e9[_0xad68('0x38')][_0xad68('0x88')][_0xad68('0x8b')]())+'Queues'](_0x1542e9[_0xad68('0x38')][_0xad68('0x5a')]);}})['then'](function(_0x2fb539){if(_0x1542e9[_0xad68('0x38')]['channel']===_0xad68('0x8e')){return db[_0xad68('0x93')]['destroy']({'where':{'UserId':_0x1542e9['params']['id'],'VoiceQueueId':_0x1542e9[_0xad68('0x38')][_0xad68('0x5a')]},'individualHooks':!![]})[_0xad68('0x15')](function(){return _0x5d6323;});}return _0x5d6323;})[_0xad68('0x15')](respondWithStatusCode(_0x35bd7b,null))[_0xad68('0x20')](handleError(_0x35bd7b,null));};exports['addAvatar']=function(_0x9ef3b6,_0x3aa09e,_0x258e59){_0x9ef3b6[_0xad68('0x56')][_0xad68('0x97')]=_0x9ef3b6[_0xad68('0x98')][_0xad68('0x99')];return db[_0xad68('0x31')][_0xad68('0x57')]({'where':{'id':_0x9ef3b6[_0xad68('0x53')]['id']}})[_0xad68('0x15')](handleEntityNotFound(_0x3aa09e,null))['then'](saveUpdates(_0x9ef3b6['body'],null))[_0xad68('0x15')](respondWithResult(_0x3aa09e,null))[_0xad68('0x20')](handleError(_0x3aa09e,null));};exports['getAvatar']=function(_0x1a43c1,_0x51c7b9,_0x406802){var _0x3f3a42=path[_0xad68('0x9a')](config[_0xad68('0x9b')],'server/files/images/logos/default_profile.png');return db['User'][_0xad68('0x57')]({'where':{'id':_0x1a43c1[_0xad68('0x53')]['id']},'attributes':['id',_0xad68('0x97')],'raw':!![]})[_0xad68('0x15')](handleEntityNotFound(_0x51c7b9,null))[_0xad68('0x15')](function(_0xaf5463){if(_0xaf5463){if(_[_0xad68('0x64')](_0xaf5463['userpic'])){return _0x51c7b9[_0xad68('0x9c')](_0x3f3a42);}else{if(!fs[_0xad68('0x9d')](path[_0xad68('0x9a')](config[_0xad68('0x9b')],_0xad68('0x9e'),_0xaf5463[_0xad68('0x97')]))){return _0x51c7b9[_0xad68('0x9c')](_0x3f3a42);}return _0x51c7b9[_0xad68('0x9c')](path[_0xad68('0x9a')](config[_0xad68('0x9b')],'server/files/images/',_0xaf5463['userpic']));}}})['catch'](handleError(_0x51c7b9,null));};exports[_0xad68('0x9f')]=function(_0x3fb3c0,_0xb54962,_0x2e87bc){var _0x367775;var _0x2bd40f={'where':{}},_0x385908={},_0x553c0c={'count':0x0,'rows':[]};return db[_0xad68('0x31')][_0xad68('0xa0')]({'where':{'id':_0x3fb3c0[_0xad68('0x53')]['id']}})[_0xad68('0x15')](handleEntityNotFound(_0xb54962,null))[_0xad68('0x15')](function(_0x363d1b){if(_0x363d1b){_0x367775=_0x363d1b;_0x2bd40f[_0xad68('0x48')]['UserId']=_0x363d1b['id'];return db[_0xad68('0xa1')][_0xad68('0x58')]();}})[_0xad68('0x15')](function(_0x336baf){if(_0x336baf){_0x385908['model']=_[_0xad68('0x35')](_0x336baf);_0x385908[_0xad68('0x38')]=_[_0xad68('0x35')](_0x3fb3c0['query']);_0x385908['filters']=_[_0xad68('0x3d')](_0x385908[_0xad68('0x33')],_0x385908[_0xad68('0x38')]);_0x2bd40f['attributes']=_[_0xad68('0x3d')](_0x385908[_0xad68('0x33')],qs[_0xad68('0x3e')](_0x3fb3c0['query'][_0xad68('0x3e')]));_0x2bd40f[_0xad68('0x3c')]=_0x2bd40f[_0xad68('0x3c')][_0xad68('0x54')]?_0x2bd40f[_0xad68('0x3c')]:_0x385908[_0xad68('0x33')];if(!_0x3fb3c0['query'][_0xad68('0x3f')](_0xad68('0x40'))){_0x2bd40f[_0xad68('0x41')]=qs[_0xad68('0x41')](_0x3fb3c0[_0xad68('0x38')][_0xad68('0x41')]);_0x2bd40f[_0xad68('0x25')]=qs[_0xad68('0x25')](_0x3fb3c0[_0xad68('0x38')][_0xad68('0x25')]);}_0x2bd40f[_0xad68('0x42')]=qs[_0xad68('0x43')](_0x3fb3c0[_0xad68('0x38')][_0xad68('0x43')]);_0x2bd40f[_0xad68('0x48')]=qs[_0xad68('0x3b')](_[_0xad68('0x44')](_0x3fb3c0[_0xad68('0x38')],_0x385908[_0xad68('0x3b')]));if(_0x3fb3c0[_0xad68('0x38')][_0xad68('0xa2')]){_0x2bd40f['where']=_[_0xad68('0x47')](_0x2bd40f['where'],{'$or':_[_0xad68('0x49')](_0x2bd40f['attributes'],function(_0x4070c6){var _0x50af16={};_0x50af16[_0x4070c6]={'$like':'%'+_0x3fb3c0['query'][_0xad68('0xa2')]+'%'};return _0x50af16;})});}_0x2bd40f=_['merge']({},_0x2bd40f,_0x3fb3c0['options']);return _0x367775['getContacts'](_[_0xad68('0x44')](_0x2bd40f,[_0xad68('0x48')]))['then'](function(_0x14039a){_0x553c0c[_0xad68('0x24')]=_0x14039a[_0xad68('0x54')]||0x0;if(_0x3fb3c0['query'][_0xad68('0x4e')]){_0x2bd40f[_0xad68('0x4f')]=[{'all':!![]}];}return _0x367775['getContacts'](_0x2bd40f);})[_0xad68('0x15')](function(_0x1bbb35){_0x553c0c['rows']=_0x1bbb35;return _0x553c0c;});}})['then'](respondWithFilteredResult(_0xb54962,_0x2bd40f))[_0xad68('0x20')](handleError(_0xb54962,null));};exports['getQueues']=function(_0x4eab2a,_0x5073d9,_0x129c6e){var _0x1df53c;var _0x105120;var _0x97d47={};var _0x1997c5;return db['User']['findOne']({'where':{'id':_0x4eab2a['params']['id']},'attributes':['id',_0xad68('0x2e'),_0xad68('0x5d')]})[_0xad68('0x15')](handleEntityNotFound(_0x5073d9,null))[_0xad68('0x15')](function(_0x22a089){if(!utils[_0xad68('0x87')](_0x4eab2a[_0xad68('0x38')][_0xad68('0x88')])){throw new db[(_0xad68('0x80'))]['ValidationError'](_0xad68('0x89'));}_0x1df53c=_0x22a089;var _0x4ecef3={};_0x4ecef3[_0xad68('0x33')]=_[_0xad68('0x35')](db[_['capitalize'](_0x4eab2a[_0xad68('0x38')][_0xad68('0x88')])+_0xad68('0xa3')][_0xad68('0x32')]);_0x4ecef3['query']=_['keys'](_0x4eab2a[_0xad68('0x38')]);_0x4ecef3[_0xad68('0x3b')]=_['intersection'](_0x4ecef3[_0xad68('0x33')],_0x4ecef3[_0xad68('0x38')]);_0x97d47[_0xad68('0x3c')]=_[_0xad68('0x3d')](_0x4ecef3['model'],qs['fields'](_0x4eab2a[_0xad68('0x38')][_0xad68('0x3e')]));_0x97d47[_0xad68('0x3c')]=_0x97d47['attributes']['length']?_0x97d47[_0xad68('0x3c')]:_0x4ecef3[_0xad68('0x33')];_0x97d47['order']=qs[_0xad68('0x43')](_0x4eab2a[_0xad68('0x38')][_0xad68('0x43')]);_0x97d47[_0xad68('0x48')]=qs['filters'](_['pick'](_0x4eab2a[_0xad68('0x38')],_0x4ecef3[_0xad68('0x3b')]));if(_0x4eab2a['query'][_0xad68('0xa2')]){_0x97d47[_0xad68('0x48')]=_[_0xad68('0x47')](_0x97d47[_0xad68('0x48')],{'$or':_['map'](_0x97d47[_0xad68('0x3c')],function(_0x4d390b){var _0x3b6685={};_0x3b6685[_0x4d390b]={'$like':'%'+_0x4eab2a[_0xad68('0x38')][_0xad68('0xa2')]+'%'};return _0x3b6685;})});}_0x97d47=_[_0xad68('0x47')]({},_0x97d47,_0x4eab2a[_0xad68('0x4d')]);switch(_0x1df53c[_0xad68('0x5d')]){case _0xad68('0x5f'):return db[_[_0xad68('0x8a')](_0x4eab2a[_0xad68('0x38')][_0xad68('0x88')])+_0xad68('0xa3')][_0xad68('0x50')](_0x97d47);case _0xad68('0x60'):case _0xad68('0x5b'):return _0x1df53c[_0xad68('0xa4')+_[_0xad68('0x8a')](_0x4eab2a[_0xad68('0x38')][_0xad68('0x88')])+_0xad68('0x8c')](_0x97d47);default:throw new db['Sequelize']['ValidationError']('Unknown\x20role');}})['then'](function(_0x3ec4ba){_0x1997c5=_0x3ec4ba['length'];if(!_0x4eab2a[_0xad68('0x38')][_0xad68('0x3f')](_0xad68('0x40'))){_0x97d47[_0xad68('0x41')]=qs[_0xad68('0x41')](_0x4eab2a[_0xad68('0x38')][_0xad68('0x41')]);_0x97d47['offset']=qs[_0xad68('0x25')](_0x4eab2a[_0xad68('0x38')][_0xad68('0x25')]);}switch(_0x1df53c[_0xad68('0x5d')]){case'admin':return db[_['capitalize'](_0x4eab2a[_0xad68('0x38')][_0xad68('0x88')])+'Queue'][_0xad68('0x50')](_0x97d47);case'user':case'agent':return _0x1df53c[_0xad68('0xa4')+_[_0xad68('0x8a')](_0x4eab2a[_0xad68('0x38')]['channel'])+_0xad68('0x8c')](_0x97d47);}})['then'](function(_0x12d11e){return{'count':_0x1997c5,'rows':_0x12d11e};})[_0xad68('0x15')](respondWithResult(_0x5073d9,null))['catch'](handleError(_0x5073d9,null));};exports[_0xad68('0xa5')]=function(_0x827e2b,_0xc61626,_0x397c0f){var _0x208585={};var _0x4f9916={};var _0x452505;var _0x56d5a0;return db[_0xad68('0x31')]['findOne']({'where':{'id':_0x827e2b['params']['id']}})[_0xad68('0x15')](handleEntityNotFound(_0xc61626,null))[_0xad68('0x15')](function(_0xcd33){if(_0xcd33){_0x452505=_0xcd33;_0x4f9916[_0xad68('0x33')]=_[_0xad68('0x35')](db[_0xad68('0x93')][_0xad68('0x32')]);_0x4f9916['query']=_[_0xad68('0x35')](_0x827e2b[_0xad68('0x38')]);_0x4f9916['filters']=_[_0xad68('0x3d')](_0x4f9916['model'],_0x4f9916[_0xad68('0x38')]);_0x208585['attributes']=_[_0xad68('0x3d')](_0x4f9916[_0xad68('0x33')],qs[_0xad68('0x3e')](_0x827e2b[_0xad68('0x38')]['fields']));_0x208585[_0xad68('0x3c')]=_0x208585[_0xad68('0x3c')][_0xad68('0x54')]?_0x208585[_0xad68('0x3c')]:_0x4f9916[_0xad68('0x33')];_0x208585[_0xad68('0x42')]=qs['sort'](_0x827e2b[_0xad68('0x38')][_0xad68('0x43')]);_0x208585[_0xad68('0x48')]=qs[_0xad68('0x3b')](_[_0xad68('0x44')](_0x827e2b['query'],_0x4f9916[_0xad68('0x3b')]));if(_0x827e2b[_0xad68('0x38')][_0xad68('0xa2')]){_0x208585[_0xad68('0x48')]=_[_0xad68('0x47')](_0x208585['where'],{'$or':_[_0xad68('0x49')](_0x208585[_0xad68('0x3c')],function(_0x2bd713){var _0x4b4652={};_0x4b4652[_0x2bd713]={'$like':'%'+_0x827e2b[_0xad68('0x38')][_0xad68('0xa2')]+'%'};return _0x4b4652;})});}_0x208585=_[_0xad68('0x47')]({},_0x208585,_0x827e2b[_0xad68('0x4d')]);return _0x452505[_0xad68('0xa5')](_0x208585);}})[_0xad68('0x15')](function(_0x364e51){if(_0x364e51){_0x56d5a0=_0x364e51[_0xad68('0x54')];if(!_0x827e2b[_0xad68('0x38')]['hasOwnProperty']('nolimit')){_0x208585[_0xad68('0x41')]=qs[_0xad68('0x41')](_0x827e2b[_0xad68('0x38')][_0xad68('0x41')]);_0x208585[_0xad68('0x25')]=qs[_0xad68('0x25')](_0x827e2b[_0xad68('0x38')][_0xad68('0x25')]);}return _0x452505[_0xad68('0xa5')](_0x208585);}})['then'](function(_0xb4e547){if(_0xb4e547){return _0xb4e547?{'count':_0x56d5a0,'rows':_0xb4e547}:null;}})[_0xad68('0x15')](respondWithResult(_0xc61626,null))[_0xad68('0x20')](handleError(_0xc61626,null));};exports[_0xad68('0xa6')]=function(_0x40d3e8,_0x53953c,_0x35bc24){var _0x54f0e4={};var _0x4b2070={};var _0x1813dd;var _0xb1cfa4;return db['User'][_0xad68('0xa0')]({'where':{'id':_0x40d3e8[_0xad68('0x53')]['id']}})[_0xad68('0x15')](handleEntityNotFound(_0x53953c,null))[_0xad68('0x15')](function(_0x55a0fc){if(_0x55a0fc){_0x1813dd=_0x55a0fc;_0x4b2070['model']=_[_0xad68('0x35')](db[_0xad68('0xa7')][_0xad68('0x32')]);_0x4b2070['query']=_[_0xad68('0x35')](_0x40d3e8['query']);_0x4b2070['filters']=_['intersection'](_0x4b2070[_0xad68('0x33')],_0x4b2070[_0xad68('0x38')]);_0x54f0e4[_0xad68('0x3c')]=_['intersection'](_0x4b2070['model'],qs[_0xad68('0x3e')](_0x40d3e8[_0xad68('0x38')][_0xad68('0x3e')]));_0x54f0e4[_0xad68('0x3c')]=_0x54f0e4[_0xad68('0x3c')][_0xad68('0x54')]?_0x54f0e4['attributes']:_0x4b2070[_0xad68('0x33')];_0x54f0e4['order']=qs[_0xad68('0x43')](_0x40d3e8[_0xad68('0x38')][_0xad68('0x43')]);_0x54f0e4['where']=qs[_0xad68('0x3b')](_[_0xad68('0x44')](_0x40d3e8[_0xad68('0x38')],_0x4b2070[_0xad68('0x3b')]));if(_0x40d3e8['query'][_0xad68('0xa2')]){_0x54f0e4[_0xad68('0x48')]=_[_0xad68('0x47')](_0x54f0e4['where'],{'$or':_[_0xad68('0x49')](_0x54f0e4[_0xad68('0x3c')],function(_0x5a1af9){var _0x1d8012={};_0x1d8012[_0x5a1af9]={'$like':'%'+_0x40d3e8[_0xad68('0x38')][_0xad68('0xa2')]+'%'};return _0x1d8012;})});}_0x54f0e4=_['merge']({},_0x54f0e4,_0x40d3e8[_0xad68('0x4d')]);return _0x1813dd['getGroups'](_0x54f0e4);}})[_0xad68('0x15')](function(_0x5b621e){if(_0x5b621e){_0xb1cfa4=_0x5b621e[_0xad68('0x54')];if(!_0x40d3e8[_0xad68('0x38')][_0xad68('0x3f')](_0xad68('0x40'))){_0x54f0e4[_0xad68('0x41')]=qs[_0xad68('0x41')](_0x40d3e8['query']['limit']);_0x54f0e4['offset']=qs[_0xad68('0x25')](_0x40d3e8[_0xad68('0x38')][_0xad68('0x25')]);}return _0x1813dd[_0xad68('0xa6')](_0x54f0e4);}})['then'](function(_0x1c5073){if(_0x1c5073){return _0x1c5073?{'count':_0xb1cfa4,'rows':_0x1c5073}:null;}})[_0xad68('0x15')](respondWithResult(_0x53953c,null))[_0xad68('0x20')](handleError(_0x53953c,null));};exports[_0xad68('0xa8')]=function(_0xb4f35f,_0x2c50d2,_0x1249df){var _0x1f8085={'raw':!![],'where':{}};var _0x1bd2f8={};var _0x4f00e6={'count':0x0,'rows':[]};return db[_0xad68('0x31')][_0xad68('0xa0')]({'where':{'id':_0xb4f35f['params']['id']}})['then'](handleEntityNotFound(_0x2c50d2,null))[_0xad68('0x15')](function(_0x24bcab){if(_0x24bcab){_0x1bd2f8[_0xad68('0x33')]=_[_0xad68('0x35')](db['VoiceRecording'][_0xad68('0x32')]);_0x1bd2f8[_0xad68('0x38')]=_['keys'](_0xb4f35f[_0xad68('0x38')]);_0x1bd2f8[_0xad68('0x3b')]=_[_0xad68('0x3d')](_0x1bd2f8[_0xad68('0x33')],_0x1bd2f8[_0xad68('0x38')]);_0x1f8085[_0xad68('0x3c')]=_[_0xad68('0x3d')](_0x1bd2f8[_0xad68('0x33')],qs[_0xad68('0x3e')](_0xb4f35f['query']['fields']));_0x1f8085[_0xad68('0x3c')]=_0x1f8085[_0xad68('0x3c')][_0xad68('0x54')]?_0x1f8085[_0xad68('0x3c')]:_0x1bd2f8[_0xad68('0x33')];if(!_0xb4f35f[_0xad68('0x38')][_0xad68('0x3f')]('nolimit')){_0x1f8085['limit']=qs[_0xad68('0x41')](_0xb4f35f[_0xad68('0x38')][_0xad68('0x41')]);_0x1f8085[_0xad68('0x25')]=qs[_0xad68('0x25')](_0xb4f35f[_0xad68('0x38')]['offset']);}_0x1f8085[_0xad68('0x42')]=qs[_0xad68('0x43')](_0xb4f35f['query'][_0xad68('0x43')]);_0x1f8085[_0xad68('0x48')]=qs[_0xad68('0x3b')](_[_0xad68('0x44')](_0xb4f35f[_0xad68('0x38')],_0x1bd2f8[_0xad68('0x3b')]));_0x1f8085[_0xad68('0x48')][_0xad68('0xa9')]=_0x24bcab['id'];if(_0xb4f35f[_0xad68('0x38')][_0xad68('0xa2')]){_0x1f8085[_0xad68('0x48')]=_['merge'](_0x1f8085[_0xad68('0x48')],{'$or':_[_0xad68('0x49')](_0x1f8085[_0xad68('0x3c')],function(_0x7bb4a5){var _0x4ffd01={};_0x4ffd01[_0x7bb4a5]={'$like':'%'+_0xb4f35f[_0xad68('0x38')][_0xad68('0xa2')]+'%'};return _0x4ffd01;})});}_0x1f8085=_['merge']({},_0x1f8085,_0xb4f35f[_0xad68('0x4d')]);return db[_0xad68('0xaa')][_0xad68('0x24')]({'where':_0x1f8085['where']})[_0xad68('0x15')](function(_0x27d21d){_0x4f00e6[_0xad68('0x24')]=_0x27d21d;if(_0xb4f35f['query'][_0xad68('0x4e')]){_0x1f8085[_0xad68('0x4f')]=[{'all':!![]}];}return db[_0xad68('0xaa')][_0xad68('0x50')](_0x1f8085);})[_0xad68('0x15')](function(_0x475984){_0x4f00e6[_0xad68('0x51')]=_0x475984;return _0x4f00e6;});}})[_0xad68('0x15')](respondWithFilteredResult(_0x2c50d2,_0x1f8085))[_0xad68('0x20')](handleError(_0x2c50d2,null));};exports[_0xad68('0xab')]=function(_0x27bf0a,_0x2c30c2,_0x5429c2){var _0x119ef2={};var _0x149454={};var _0x21415d;var _0x188484;return db[_0xad68('0x31')][_0xad68('0xa0')]({'where':{'id':_0x27bf0a[_0xad68('0x53')]['id']}})[_0xad68('0x15')](handleEntityNotFound(_0x2c30c2,null))[_0xad68('0x15')](function(_0x4616a7){if(_0x4616a7){_0x21415d=_0x4616a7;_0x149454[_0xad68('0x33')]=_[_0xad68('0x35')](db[_0xad68('0xac')][_0xad68('0x32')]);_0x149454['query']=_[_0xad68('0x35')](_0x27bf0a[_0xad68('0x38')]);_0x149454[_0xad68('0x3b')]=_['intersection'](_0x149454[_0xad68('0x33')],_0x149454[_0xad68('0x38')]);_0x119ef2[_0xad68('0x3c')]=_[_0xad68('0x3d')](_0x149454[_0xad68('0x33')],qs[_0xad68('0x3e')](_0x27bf0a[_0xad68('0x38')][_0xad68('0x3e')]));_0x119ef2['attributes']=_0x119ef2['attributes'][_0xad68('0x54')]?_0x119ef2[_0xad68('0x3c')]:_0x149454['model'];_0x119ef2[_0xad68('0x42')]=qs[_0xad68('0x43')](_0x27bf0a[_0xad68('0x38')][_0xad68('0x43')]);_0x119ef2[_0xad68('0x48')]=qs[_0xad68('0x3b')](_[_0xad68('0x44')](_0x27bf0a[_0xad68('0x38')],_0x149454[_0xad68('0x3b')]));if(_0x27bf0a[_0xad68('0x38')]['filter']){_0x119ef2['where']=_[_0xad68('0x47')](_0x119ef2[_0xad68('0x48')],{'$or':_[_0xad68('0x49')](_0x119ef2[_0xad68('0x3c')],function(_0x4f3ca6){var _0x48b9e5={};_0x48b9e5[_0x4f3ca6]={'$like':'%'+_0x27bf0a[_0xad68('0x38')]['filter']+'%'};return _0x48b9e5;})});}_0x119ef2=_[_0xad68('0x47')]({},_0x119ef2,_0x27bf0a[_0xad68('0x4d')]);return _0x21415d[_0xad68('0xab')](_0x119ef2);}})[_0xad68('0x15')](function(_0x35c779){if(_0x35c779){_0x188484=_0x35c779[_0xad68('0x54')];if(!_0x27bf0a['query'][_0xad68('0x3f')](_0xad68('0x40'))){_0x119ef2[_0xad68('0x41')]=qs[_0xad68('0x41')](_0x27bf0a[_0xad68('0x38')][_0xad68('0x41')]);_0x119ef2['offset']=qs[_0xad68('0x25')](_0x27bf0a[_0xad68('0x38')][_0xad68('0x25')]);}return _0x21415d[_0xad68('0xab')](_0x119ef2);}})[_0xad68('0x15')](function(_0x52fbb7){if(_0x52fbb7){return _0x52fbb7?{'count':_0x188484,'rows':_0x52fbb7}:null;}})[_0xad68('0x15')](respondWithResult(_0x2c30c2,null))[_0xad68('0x20')](handleError(_0x2c30c2,null));};exports[_0xad68('0xad')]=function(_0xd69a4a,_0x350ba4,_0x27a731){var _0x43dd47={};var _0x148ff1={};var _0x7df5fa;var _0x2368f9;return db[_0xad68('0x31')][_0xad68('0xa0')]({'where':{'id':_0xd69a4a[_0xad68('0x53')]['id']}})['then'](handleEntityNotFound(_0x350ba4,null))[_0xad68('0x15')](function(_0x5b808c){if(_0x5b808c){_0x7df5fa=_0x5b808c;_0x148ff1['model']=_[_0xad68('0x35')](db[_0xad68('0xae')][_0xad68('0x32')]);_0x148ff1[_0xad68('0x38')]=_[_0xad68('0x35')](_0xd69a4a[_0xad68('0x38')]);_0x148ff1['filters']=_['intersection'](_0x148ff1[_0xad68('0x33')],_0x148ff1[_0xad68('0x38')]);_0x43dd47['attributes']=_[_0xad68('0x3d')](_0x148ff1[_0xad68('0x33')],qs[_0xad68('0x3e')](_0xd69a4a[_0xad68('0x38')][_0xad68('0x3e')]));_0x43dd47[_0xad68('0x3c')]=_0x43dd47[_0xad68('0x3c')]['length']?_0x43dd47[_0xad68('0x3c')]:_0x148ff1['model'];_0x43dd47[_0xad68('0x42')]=qs[_0xad68('0x43')](_0xd69a4a[_0xad68('0x38')][_0xad68('0x43')]);_0x43dd47['where']=qs['filters'](_['pick'](_0xd69a4a[_0xad68('0x38')],_0x148ff1['filters']));if(_0xd69a4a['query'][_0xad68('0xa2')]){_0x43dd47[_0xad68('0x48')]=_[_0xad68('0x47')](_0x43dd47[_0xad68('0x48')],{'$or':_[_0xad68('0x49')](_0x43dd47[_0xad68('0x3c')],function(_0x58d78e){var _0x5b5804={};_0x5b5804[_0x58d78e]={'$like':'%'+_0xd69a4a[_0xad68('0x38')]['filter']+'%'};return _0x5b5804;})});}_0x43dd47=_[_0xad68('0x47')]({},_0x43dd47,_0xd69a4a[_0xad68('0x4d')]);return _0x7df5fa[_0xad68('0xad')](_0x43dd47);}})[_0xad68('0x15')](function(_0x92baad){if(_0x92baad){_0x2368f9=_0x92baad[_0xad68('0x54')];if(!_0xd69a4a[_0xad68('0x38')][_0xad68('0x3f')](_0xad68('0x40'))){_0x43dd47[_0xad68('0x41')]=qs['limit'](_0xd69a4a[_0xad68('0x38')][_0xad68('0x41')]);_0x43dd47[_0xad68('0x25')]=qs['offset'](_0xd69a4a[_0xad68('0x38')][_0xad68('0x25')]);}return _0x7df5fa[_0xad68('0xad')](_0x43dd47);}})[_0xad68('0x15')](function(_0x2c8c5d){if(_0x2c8c5d){return _0x2c8c5d?{'count':_0x2368f9,'rows':_0x2c8c5d}:null;}})[_0xad68('0x15')](respondWithResult(_0x350ba4,null))['catch'](handleError(_0x350ba4,null));};exports[_0xad68('0xaf')]=function(_0x55defe,_0x571066,_0x553b88){var _0x53da8c={'raw':!![],'where':{}};var _0x16a70f={};var _0x37264e={'count':0x0,'rows':[]};return db[_0xad68('0x31')][_0xad68('0xa0')]({'where':{'id':_0x55defe[_0xad68('0x53')]['id']}})[_0xad68('0x15')](handleEntityNotFound(_0x571066,null))[_0xad68('0x15')](function(_0x1b7ec0){if(_0x1b7ec0){_0x16a70f['model']=_[_0xad68('0x35')](db[_0xad68('0xb0')][_0xad68('0x32')]);_0x16a70f['query']=_[_0xad68('0x35')](_0x55defe[_0xad68('0x38')]);_0x16a70f[_0xad68('0x3b')]=_[_0xad68('0x3d')](_0x16a70f[_0xad68('0x33')],_0x16a70f[_0xad68('0x38')]);_0x53da8c[_0xad68('0x3c')]=_['intersection'](_0x16a70f[_0xad68('0x33')],qs[_0xad68('0x3e')](_0x55defe[_0xad68('0x38')][_0xad68('0x3e')]));_0x53da8c['attributes']=_0x53da8c[_0xad68('0x3c')][_0xad68('0x54')]?_0x53da8c['attributes']:_0x16a70f[_0xad68('0x33')];if(!_0x55defe['query']['hasOwnProperty'](_0xad68('0x40'))){_0x53da8c[_0xad68('0x41')]=qs[_0xad68('0x41')](_0x55defe[_0xad68('0x38')][_0xad68('0x41')]);_0x53da8c[_0xad68('0x25')]=qs[_0xad68('0x25')](_0x55defe[_0xad68('0x38')][_0xad68('0x25')]);}_0x53da8c['order']=qs['sort'](_0x55defe[_0xad68('0x38')]['sort']);_0x53da8c['where']=qs[_0xad68('0x3b')](_[_0xad68('0x44')](_0x55defe['query'],_0x16a70f[_0xad68('0x3b')]));_0x53da8c[_0xad68('0x48')][_0xad68('0xa9')]=_0x1b7ec0['id'];if(_0x55defe[_0xad68('0x38')][_0xad68('0xa2')]){_0x53da8c[_0xad68('0x48')]=_[_0xad68('0x47')](_0x53da8c[_0xad68('0x48')],{'$or':_['map'](_0x53da8c['attributes'],function(_0xd8100e){var _0x32c7e0={};_0x32c7e0[_0xd8100e]={'$like':'%'+_0x55defe['query'][_0xad68('0xa2')]+'%'};return _0x32c7e0;})});}_0x53da8c=_['merge']({},_0x53da8c,_0x55defe[_0xad68('0x4d')]);return db[_0xad68('0xb0')][_0xad68('0x24')]({'where':_0x53da8c['where']})[_0xad68('0x15')](function(_0x1289e5){_0x37264e[_0xad68('0x24')]=_0x1289e5;if(_0x55defe[_0xad68('0x38')]['includeAll']){_0x53da8c[_0xad68('0x4f')]=[{'all':!![]}];}return db[_0xad68('0xb0')]['findAll'](_0x53da8c);})['then'](function(_0x10169f){_0x37264e[_0xad68('0x51')]=_0x10169f;return _0x37264e;});}})[_0xad68('0x15')](respondWithFilteredResult(_0x571066,_0x53da8c))[_0xad68('0x20')](handleError(_0x571066,null));};exports[_0xad68('0xb1')]=function(_0x2edb0b,_0x3d4d05,_0x34e779){var _0x4f2a1b={};var _0xf0720a={};var _0x5bac6a;var _0x23f317;return db[_0xad68('0x31')][_0xad68('0xa0')]({'where':{'id':_0x2edb0b['params']['id']}})[_0xad68('0x15')](handleEntityNotFound(_0x3d4d05,null))[_0xad68('0x15')](function(_0x277d9b){if(_0x277d9b){_0x5bac6a=_0x277d9b;_0xf0720a[_0xad68('0x33')]=_[_0xad68('0x35')](db[_0xad68('0xb2')][_0xad68('0x32')]);_0xf0720a[_0xad68('0x38')]=_['keys'](_0x2edb0b['query']);_0xf0720a[_0xad68('0x3b')]=_['intersection'](_0xf0720a[_0xad68('0x33')],_0xf0720a[_0xad68('0x38')]);_0x4f2a1b['attributes']=_['intersection'](_0xf0720a['model'],qs['fields'](_0x2edb0b[_0xad68('0x38')]['fields']));_0x4f2a1b['attributes']=_0x4f2a1b[_0xad68('0x3c')][_0xad68('0x54')]?_0x4f2a1b[_0xad68('0x3c')]:_0xf0720a[_0xad68('0x33')];_0x4f2a1b[_0xad68('0x42')]=qs[_0xad68('0x43')](_0x2edb0b[_0xad68('0x38')]['sort']);_0x4f2a1b['where']=qs[_0xad68('0x3b')](_[_0xad68('0x44')](_0x2edb0b['query'],_0xf0720a[_0xad68('0x3b')]));if(_0x2edb0b[_0xad68('0x38')][_0xad68('0xa2')]){_0x4f2a1b[_0xad68('0x48')]=_[_0xad68('0x47')](_0x4f2a1b[_0xad68('0x48')],{'$or':_[_0xad68('0x49')](_0x4f2a1b[_0xad68('0x3c')],function(_0x307fdc){var _0x7e57fb={};_0x7e57fb[_0x307fdc]={'$like':'%'+_0x2edb0b[_0xad68('0x38')][_0xad68('0xa2')]+'%'};return _0x7e57fb;})});}_0x4f2a1b=_[_0xad68('0x47')]({},_0x4f2a1b,_0x2edb0b[_0xad68('0x4d')]);return _0x5bac6a[_0xad68('0xb1')](_0x4f2a1b);}})[_0xad68('0x15')](function(_0x27b25c){if(_0x27b25c){_0x23f317=_0x27b25c[_0xad68('0x54')];if(!_0x2edb0b[_0xad68('0x38')]['hasOwnProperty'](_0xad68('0x40'))){_0x4f2a1b['limit']=qs[_0xad68('0x41')](_0x2edb0b[_0xad68('0x38')][_0xad68('0x41')]);_0x4f2a1b['offset']=qs['offset'](_0x2edb0b['query'][_0xad68('0x25')]);}return _0x5bac6a[_0xad68('0xb1')](_0x4f2a1b);}})[_0xad68('0x15')](function(_0x512bbd){if(_0x512bbd){return _0x512bbd?{'count':_0x23f317,'rows':_0x512bbd}:null;}})['then'](respondWithResult(_0x3d4d05,null))[_0xad68('0x20')](handleError(_0x3d4d05,null));};exports[_0xad68('0xb3')]=function(_0x27b59e,_0x2e9ff9,_0x1b19cb){var _0x4d3857={};var _0x3b07d1={};var _0x34827f;var _0x493877;return db['User'][_0xad68('0xa0')]({'where':{'id':_0x27b59e[_0xad68('0x53')]['id']}})[_0xad68('0x15')](handleEntityNotFound(_0x2e9ff9,null))['then'](function(_0x566fee){if(_0x566fee){_0x34827f=_0x566fee;_0x3b07d1['model']=_[_0xad68('0x35')](db[_0xad68('0xb4')][_0xad68('0x32')]);_0x3b07d1[_0xad68('0x38')]=_[_0xad68('0x35')](_0x27b59e['query']);_0x3b07d1['filters']=_['intersection'](_0x3b07d1[_0xad68('0x33')],_0x3b07d1['query']);_0x4d3857[_0xad68('0x3c')]=_[_0xad68('0x3d')](_0x3b07d1[_0xad68('0x33')],qs[_0xad68('0x3e')](_0x27b59e[_0xad68('0x38')][_0xad68('0x3e')]));_0x4d3857[_0xad68('0x3c')]=_0x4d3857[_0xad68('0x3c')][_0xad68('0x54')]?_0x4d3857[_0xad68('0x3c')]:_0x3b07d1['model'];_0x4d3857['order']=qs[_0xad68('0x43')](_0x27b59e[_0xad68('0x38')][_0xad68('0x43')]);_0x4d3857[_0xad68('0x48')]=qs[_0xad68('0x3b')](_[_0xad68('0x44')](_0x27b59e['query'],_0x3b07d1[_0xad68('0x3b')]));if(_0x27b59e[_0xad68('0x38')][_0xad68('0xa2')]){_0x4d3857[_0xad68('0x48')]=_[_0xad68('0x47')](_0x4d3857[_0xad68('0x48')],{'$or':_['map'](_0x4d3857['attributes'],function(_0xd1d4d1){var _0xcd1927={};_0xcd1927[_0xd1d4d1]={'$like':'%'+_0x27b59e[_0xad68('0x38')][_0xad68('0xa2')]+'%'};return _0xcd1927;})});}_0x4d3857=_['merge']({},_0x4d3857,_0x27b59e[_0xad68('0x4d')]);return _0x34827f[_0xad68('0xb3')](_0x4d3857);}})[_0xad68('0x15')](function(_0x43858a){if(_0x43858a){_0x493877=_0x43858a['length'];if(!_0x27b59e['query'][_0xad68('0x3f')](_0xad68('0x40'))){_0x4d3857['limit']=qs[_0xad68('0x41')](_0x27b59e[_0xad68('0x38')][_0xad68('0x41')]);_0x4d3857[_0xad68('0x25')]=qs[_0xad68('0x25')](_0x27b59e[_0xad68('0x38')]['offset']);}return _0x34827f['getFaxInteractions'](_0x4d3857);}})[_0xad68('0x15')](function(_0xba4af4){if(_0xba4af4){return _0xba4af4?{'count':_0x493877,'rows':_0xba4af4}:null;}})[_0xad68('0x15')](respondWithResult(_0x2e9ff9,null))[_0xad68('0x20')](handleError(_0x2e9ff9,null));};exports[_0xad68('0xb5')]=function(_0x37b2cd,_0x4b4687,_0x87120){var _0x3b0a9f;var _0x59f055;var _0x3d3df4;return db[_0xad68('0x31')][_0xad68('0x57')]({'where':{'id':_0x37b2cd[_0xad68('0x53')]['id'],'role':_0xad68('0x5b')},'attributes':['id','name',_0xad68('0xb6'),_0xad68('0xb7'),_0xad68('0x5d'),_0xad68('0x6c'),_0xad68('0x85')]})['then'](handleEntityNotFound(_0x4b4687,null))[_0xad68('0x15')](function(_0x4e628e){if(_0x4e628e){_0x3b0a9f=_0x4e628e;_0x3d3df4=_0x37b2cd[_0xad68('0x56')][_0xad68('0xb8')]&&_0x3b0a9f[_0x37b2cd['body'][_0xad68('0xb8')]]?util['format'](_0xad68('0xb9'),_0x3b0a9f[_0x37b2cd[_0xad68('0x56')][_0xad68('0xb8')]]):util[_0xad68('0x66')]('SIP/%s',_0x3b0a9f[_0xad68('0x2e')]);socket['to'](util[_0xad68('0x66')](_0xad68('0xba'),_0x3b0a9f[_0xad68('0x2e')]))[_0xad68('0xbb')]('user:forcelogout',{'ip':_0x37b2cd[_0xad68('0xbc')][_0xad68('0xbd')]||_0x37b2cd[_0xad68('0xbe')][_0xad68('0xbf')]||_0x37b2cd[_0xad68('0xc0')][_0xad68('0xbf')]||_0x37b2cd[_0xad68('0xbe')][_0xad68('0xc0')][_0xad68('0xbf')]});return db[_0xad68('0x93')][_0xad68('0x2c')]({'where':{'membername':_0x3b0a9f[_0xad68('0x2e')]},'individualHooks':!![]});}})['then'](function(_0x421d67){if(_0x3b0a9f){return _0x3b0a9f['getVoiceQueues']({'raw':!![]});}})[_0xad68('0x15')](function(_0x1afb5b){var _0x794d9a=[];if(_0x1afb5b){_0x59f055=_0x1afb5b;if(_0x59f055['length']){for(var _0x3df01b=0x0;_0x3df01b<_0x59f055['length'];_0x3df01b++){_0x794d9a[_0xad68('0xc1')]({'membername':_0x3b0a9f[_0xad68('0x2e')],'UserId':_0x3b0a9f['id'],'queue_name':_0x59f055[_0x3df01b]['name'],'VoiceQueueId':_0x59f055[_0x3df01b]['id'],'interface':_0x3d3df4||util[_0xad68('0x66')](_0xad68('0x90'),_0xad68('0x91'),_0x3b0a9f[_0xad68('0x2e')]),'paused':_0x3b0a9f[_0xad68('0x85')]||![],'penalty':_0x59f055[_0x3df01b][_0xad68('0xc2')]||0x0});}return BPromise[_0xad68('0x92')](_0x794d9a,function(_0xd44aa5){return db[_0xad68('0x93')][_0xad68('0x94')](_0xd44aa5);});}}})[_0xad68('0x15')](function(){return db[_0xad68('0xc3')][_0xad68('0x50')]({'where':{'membername':_0x3b0a9f[_0xad68('0x2e')],'interface':util[_0xad68('0x66')]('%s/%s',_0xad68('0x91'),_0x3b0a9f['name']),'exitAt':null}});})[_0xad68('0x15')](function(_0x42d6df){var _0x551adc=[];_0x42d6df['forEach'](function(_0xbb95fc){_0x551adc[_0xad68('0xc1')](_0xbb95fc[_0xad68('0x2b')]({'exitAt':moment()[_0xad68('0x66')](_0xad68('0xc4'))}));});return BPromise[_0xad68('0xc5')](_0x551adc);})[_0xad68('0x15')](function(){var _0x228d02=[];var _0x30d39=[];var _0x258c33=utils[_0xad68('0xc6')]();var _0x5a769a={'membername':_0x3b0a9f[_0xad68('0x2e')],'interface':util['format'](_0xad68('0x90'),_0xad68('0x91'),_0x3b0a9f[_0xad68('0x2e')]),'enterAt':moment()[_0xad68('0x66')](_0xad68('0xc4')),'role':_0x3b0a9f['role'],'internal':_0x3b0a9f[_0xad68('0x6c')]};_0x258c33[_0xad68('0xc7')](function(_0x37724c){_0x228d02[_0xad68('0xc1')](_['merge']({'channel':_0x37724c,'type':_0xad68('0xc8'),'data1':_0x37b2cd['body'][_0xad68('0xc9')],'data2':_0x3d3df4},_0x5a769a));if(_0x3b0a9f['loginInPause']){_0x30d39[_0xad68('0xc1')](_['merge']({'channel':_0x37724c,'type':_0xad68('0xca'),'data1':_0xad68('0xcb')},_0x5a769a));}});return db[_0xad68('0xc3')][_0xad68('0x55')](_0x228d02[_0xad68('0xcc')](_0x30d39),{'individualHooks':!![]});})[_0xad68('0x15')](function(){return _0x3b0a9f[_0xad68('0x2b')]({'online':!![],'lastLoginAt':moment()[_0xad68('0x66')](_0xad68('0xc4')),'voicePause':_0x3b0a9f[_0xad68('0x85')]||![],'mailPause':_0x3b0a9f[_0xad68('0x85')]||![],'chatPause':_0x3b0a9f[_0xad68('0x85')]||![],'faxPause':_0x3b0a9f[_0xad68('0x85')]||![],'smsPause':_0x3b0a9f['loginInPause']||![],'openchannelPause':_0x3b0a9f['loginInPause']||![],'pauseType':_0x3b0a9f['loginInPause']?_0xad68('0xcb'):null,'lastPauseAt':moment()[_0xad68('0x66')](_0xad68('0xc4'))});})[_0xad68('0x15')](respondWithResult(_0x4b4687,null))[_0xad68('0x20')](handleError(_0x4b4687,null));};exports['logout']=function(_0x2be781,_0x5dc750,_0x25575f){var _0x49079b;return db[_0xad68('0x31')][_0xad68('0x57')]({'where':{'id':_0x2be781['params']['id'],'role':_0xad68('0x5b')},'attributes':['id',_0xad68('0x2e'),_0xad68('0x5d')]})[_0xad68('0x15')](handleEntityNotFound(_0x5dc750,null))[_0xad68('0x15')](function(_0x3c97bb){if(_0x3c97bb){_0x49079b=_0x3c97bb;return db[_0xad68('0x93')]['destroy']({'where':{'membername':_0x49079b[_0xad68('0x2e')]},'individualHooks':!![]});}})['then'](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x49079b[_0xad68('0x2e')],'interface':util[_0xad68('0x66')](_0xad68('0x90'),_0xad68('0x91'),_0x49079b[_0xad68('0x2e')]),'exitAt':null}});})[_0xad68('0x15')](function(_0x4c88a8){var _0x1c1951=[];_0x4c88a8[_0xad68('0xc7')](function(_0x42fa52){_0x1c1951[_0xad68('0xc1')](_0x42fa52[_0xad68('0x2b')]({'exitAt':moment()['format'](_0xad68('0xc4'))}));});return BPromise[_0xad68('0xc5')](_0x1c1951);})[_0xad68('0x15')](function(){return _0x49079b[_0xad68('0x2b')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});})['then'](respondWithResult(_0x5dc750,null))[_0xad68('0x20')](handleError(_0x5dc750,null));};exports['pause']=function(_0x4d0e7b,_0x5e7e5d,_0xc6aaa1){var _0x34f1f7;return db[_0xad68('0x93')][_0xad68('0x2b')]({'paused':0x1},{'where':{'UserId':_0x4d0e7b[_0xad68('0x53')]['id']},'individualHooks':!![]})[_0xad68('0x15')](function(){return db[_0xad68('0x31')][_0xad68('0x57')]({'where':{'id':_0x4d0e7b[_0xad68('0x53')]['id'],'role':_0xad68('0x5b')},'attributes':['id','name',_0xad68('0x5d'),_0xad68('0x6c')]});})[_0xad68('0x15')](handleEntityNotFound(_0x5e7e5d,null))[_0xad68('0x15')](function(_0x89a9fd){if(_0x89a9fd){_0x34f1f7=_0x89a9fd;return respondWithRpcPromise(_0xad68('0xcd'),_0xad68('0xce'),{'id':_0x34f1f7['id'],'name':_0x34f1f7[_0xad68('0x2e')],'pause':!![]});}})[_0xad68('0x15')](function(){if(_0x34f1f7){return db[_0xad68('0xc3')][_0xad68('0x50')]({'where':{'membername':_0x34f1f7[_0xad68('0x2e')],'interface':util[_0xad68('0x66')]('%s/%s',_0xad68('0x91'),_0x34f1f7[_0xad68('0x2e')]),'type':'PAUSE','exitAt':null}});}})[_0xad68('0x15')](function(_0x1b1a17){if(_0x1b1a17[_0xad68('0x54')]){var _0xd6cc76=moment()[_0xad68('0x66')](_0xad68('0xc4'));for(var _0x1f89c9=0x0,_0x32215a=_0x1b1a17['length'];_0x1f89c9<_0x32215a;_0x1f89c9++){_0x1b1a17[_0x1f89c9][_0xad68('0xcf')]({'exitAt':_0xd6cc76});}}})[_0xad68('0x15')](function(){var _0x8232b3=[];var _0x915de7=utils[_0xad68('0xc6')]();_0x915de7[_0xad68('0xc7')](function(_0xf152f1){_0x8232b3[_0xad68('0xc1')]({'channel':_0xf152f1,'membername':_0x34f1f7[_0xad68('0x2e')],'interface':util[_0xad68('0x66')](_0xad68('0x90'),_0xad68('0x91'),_0x34f1f7[_0xad68('0x2e')]),'type':_0xad68('0xca'),'enterAt':moment()[_0xad68('0x66')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x4d0e7b['body'][_0xad68('0xd0')]||_0xad68('0xd1'),'role':_0x34f1f7[_0xad68('0x5d')],'internal':_0x34f1f7[_0xad68('0x6c')]});});return db['MemberReport'][_0xad68('0x55')](_0x8232b3,{'individualHooks':!![]});})[_0xad68('0x15')](function(){return _0x34f1f7[_0xad68('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x4d0e7b[_0xad68('0x56')][_0xad68('0xd0')]||_0xad68('0xd1'),'lastPauseAt':moment()['format'](_0xad68('0xc4'))});})[_0xad68('0x15')](respondWithResult(_0x5e7e5d,null))[_0xad68('0x20')](handleError(_0x5e7e5d,null));};exports[_0xad68('0xd2')]=function(_0x201168,_0x34f6c0,_0x5ea1bf){var _0x1fce9e;return db[_0xad68('0x31')][_0xad68('0x57')]({'where':{'id':_0x201168['params']['id']},'attributes':['id',_0xad68('0x2e'),_0xad68('0x5d'),_0xad68('0x86'),_0xad68('0xd3'),_0xad68('0xd4'),_0xad68('0xd5'),_0xad68('0xd6'),_0xad68('0xd7'),_0xad68('0xd8'),'lastPauseAt']})[_0xad68('0x15')](handleEntityNotFound(_0x34f6c0,null))[_0xad68('0x15')](function(_0x647fc7){if(_0x647fc7){_0x1fce9e=_0x647fc7;if(_0x201168[_0xad68('0x56')][_0xad68('0x88')]&&!utils[_0xad68('0x87')](_0x201168['body'][_0xad68('0x88')])){throw new db[(_0xad68('0x80'))][(_0xad68('0x7d'))](_0xad68('0x89'));}switch(_0x201168[_0xad68('0x56')][_0xad68('0x88')]){case'voice':return respondWithRpcPromise(_0xad68('0xcd'),_0xad68('0xd2'),{'id':_0x1fce9e['id'],'name':_0x1fce9e['name'],'pause':![]})[_0xad68('0x15')](function(){return db[_0xad68('0x93')][_0xad68('0x2b')]({'paused':0x0},{'where':{'UserId':_0x1fce9e['id']},'individualHooks':!![]});})['then'](function(){return db[_0xad68('0xc3')][_0xad68('0x57')]({'where':{'channel':_0x201168[_0xad68('0x56')][_0xad68('0x88')],'membername':_0x1fce9e[_0xad68('0x2e')],'interface':util[_0xad68('0x66')](_0xad68('0x90'),_0xad68('0x91'),_0x1fce9e[_0xad68('0x2e')]),'type':_0xad68('0xca'),'exitAt':null}});})[_0xad68('0x15')](function(_0x71d0c){if(_0x71d0c){return _0x71d0c[_0xad68('0x2b')]({'exitAt':moment()[_0xad68('0x66')](_0xad68('0xc4')),'data2':_0xad68('0xd9')},{'individualHooks':!![]});}return null;})[_0xad68('0x15')](function(){return _0x1fce9e[_0xad68('0x2b')]({'voicePause':![]});});case _0xad68('0xda'):case _0xad68('0xdb'):case _0xad68('0xdc'):case _0xad68('0xdd'):case'openchannel':return db[_0xad68('0xc3')][_0xad68('0x57')]({'where':{'channel':_0x201168['body'][_0xad68('0x88')],'membername':_0x1fce9e[_0xad68('0x2e')],'interface':util[_0xad68('0x66')](_0xad68('0x90'),'SIP',_0x1fce9e['name']),'type':'PAUSE','exitAt':null}})['then'](function(_0x163a14){if(_0x163a14){return _0x163a14[_0xad68('0x2b')]({'exitAt':moment()[_0xad68('0x66')](_0xad68('0xc4')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xad68('0x15')](function(){var _0x3f74ba={};_[_0xad68('0xde')](_0x3f74ba,util[_0xad68('0x66')](_0xad68('0xdf'),_0x201168[_0xad68('0x56')]['channel'],'Pause'),![]);return _0x1fce9e[_0xad68('0x2b')](_0x3f74ba);});default:return respondWithRpcPromise(_0xad68('0xcd'),_0xad68('0xd2'),{'id':_0x1fce9e['id'],'name':_0x1fce9e['name'],'pause':![]})[_0xad68('0x15')](function(){return db[_0xad68('0x93')][_0xad68('0x2b')]({'paused':0x0},{'where':{'UserId':_0x1fce9e['id']}});})[_0xad68('0x15')](function(){return db[_0xad68('0xc3')][_0xad68('0x50')]({'where':{'membername':_0x1fce9e[_0xad68('0x2e')],'interface':util[_0xad68('0x66')]('%s/%s',_0xad68('0x91'),_0x1fce9e[_0xad68('0x2e')]),'type':_0xad68('0xca'),'exitAt':null}});})[_0xad68('0x15')](function(_0x4f3a01){var _0x3ba7f9=[];_0x4f3a01[_0xad68('0xc7')](function(_0x5104e5){_0x3ba7f9[_0xad68('0xc1')](_0x5104e5[_0xad68('0x2b')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xad68('0xd9')}));});return BPromise[_0xad68('0xc5')](_0x3ba7f9);})[_0xad68('0x15')](function(){return _0x1fce9e['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xad68('0x15')](respondWithResult(_0x34f6c0,null))[_0xad68('0x20')](handleError(_0x34f6c0,null));};exports['getTeams']=function(_0x337787,_0x202532,_0x8fcbc5){var _0x24403b={};var _0x59dafd={};var _0x252ca6;var _0x2a933c;return db[_0xad68('0x31')][_0xad68('0xa0')]({'where':{'id':_0x337787[_0xad68('0x53')]['id']}})[_0xad68('0x15')](handleEntityNotFound(_0x202532,null))[_0xad68('0x15')](function(_0x53b257){if(_0x53b257){_0x252ca6=_0x53b257;_0x59dafd['model']=_['keys'](db['Team'][_0xad68('0x32')]);_0x59dafd[_0xad68('0x38')]=_[_0xad68('0x35')](_0x337787[_0xad68('0x38')]);_0x59dafd['filters']=_[_0xad68('0x3d')](_0x59dafd['model'],_0x59dafd[_0xad68('0x38')]);_0x24403b['attributes']=_[_0xad68('0x3d')](_0x59dafd['model'],qs[_0xad68('0x3e')](_0x337787['query']['fields']));_0x24403b['attributes']=_0x24403b[_0xad68('0x3c')]['length']?_0x24403b['attributes']:_0x59dafd['model'];_0x24403b[_0xad68('0x42')]=qs[_0xad68('0x43')](_0x337787['query'][_0xad68('0x43')]);_0x24403b['where']=qs['filters'](_['pick'](_0x337787['query'],_0x59dafd['filters']));if(_0x337787[_0xad68('0x38')][_0xad68('0xa2')]){_0x24403b['where']=_[_0xad68('0x47')](_0x24403b[_0xad68('0x48')],{'$or':_[_0xad68('0x49')](_0x24403b[_0xad68('0x3c')],function(_0x3bffb6){var _0x52d8f9={};_0x52d8f9[_0x3bffb6]={'$like':'%'+_0x337787[_0xad68('0x38')]['filter']+'%'};return _0x52d8f9;})});}_0x24403b=_[_0xad68('0x47')]({},_0x24403b,_0x337787[_0xad68('0x4d')]);return _0x252ca6[_0xad68('0xe0')](_0x24403b);}})[_0xad68('0x15')](function(_0x3c8efa){if(_0x3c8efa){_0x2a933c=_0x3c8efa[_0xad68('0x54')];if(!_0x337787[_0xad68('0x38')][_0xad68('0x3f')](_0xad68('0x40'))){_0x24403b['limit']=qs['limit'](_0x337787[_0xad68('0x38')][_0xad68('0x41')]);_0x24403b[_0xad68('0x25')]=qs[_0xad68('0x25')](_0x337787['query']['offset']);}return _0x252ca6[_0xad68('0xe0')](_0x24403b);}})[_0xad68('0x15')](function(_0x135b31){if(_0x135b31){return _0x135b31?{'count':_0x2a933c,'rows':_0x135b31}:null;}})[_0xad68('0x15')](respondWithResult(_0x202532,null))[_0xad68('0x20')](handleError(_0x202532,null));};exports[_0xad68('0xe1')]=function(_0x3dcb7d,_0x274414,_0x9f12e0){return db[_0xad68('0x31')][_0xad68('0x57')]({'where':{'id':_0x3dcb7d[_0xad68('0x53')]['id']}})['then'](handleEntityNotFound(_0x274414,null))[_0xad68('0x15')](function(_0x38c27f){if(_0x38c27f){return _0x38c27f[_0xad68('0xe1')](_0x3dcb7d[_0xad68('0x56')][_0xad68('0x5a')],_[_0xad68('0xe2')](_0x3dcb7d[_0xad68('0x56')],[_0xad68('0x5a'),'id'])||{});}})[_0xad68('0x15')](respondWithResult(_0x274414,null))[_0xad68('0x20')](handleError(_0x274414,null));};exports[_0xad68('0xe3')]=function(_0x349c10,_0x513f06,_0x2917ec){var _0x572621;return db[_0xad68('0x31')][_0xad68('0x57')]({'where':{'id':_0x349c10['params']['id']}})['then'](handleEntityNotFound(_0x513f06,null))[_0xad68('0x15')](function(_0x480da6){if(_0x480da6){return _0x480da6[_0xad68('0xe3')](_0x349c10[_0xad68('0x38')][_0xad68('0x5a')]);}})[_0xad68('0x15')](respondWithStatusCode(_0x513f06,null))['catch'](handleError(_0x513f06,null));};exports['getLists']=function(_0x138d51,_0x519908,_0x473afa){var _0x1f4b93={};var _0x438f7a={};var _0x34720b;var _0x2f910d;return db[_0xad68('0x31')][_0xad68('0xa0')]({'where':{'id':_0x138d51['params']['id']}})['then'](handleEntityNotFound(_0x519908,null))[_0xad68('0x15')](function(_0x41b7fa){if(_0x41b7fa){_0x34720b=_0x41b7fa;_0x438f7a[_0xad68('0x33')]=_[_0xad68('0x35')](db[_0xad68('0xe4')]['rawAttributes']);_0x438f7a[_0xad68('0x38')]=_[_0xad68('0x35')](_0x138d51[_0xad68('0x38')]);_0x438f7a[_0xad68('0x3b')]=_[_0xad68('0x3d')](_0x438f7a['model'],_0x438f7a[_0xad68('0x38')]);_0x1f4b93[_0xad68('0x3c')]=_[_0xad68('0x3d')](_0x438f7a['model'],qs['fields'](_0x138d51[_0xad68('0x38')]['fields']));_0x1f4b93['attributes']=_0x1f4b93[_0xad68('0x3c')][_0xad68('0x54')]?_0x1f4b93[_0xad68('0x3c')]:_0x438f7a[_0xad68('0x33')];_0x1f4b93['order']=qs[_0xad68('0x43')](_0x138d51[_0xad68('0x38')][_0xad68('0x43')]);_0x1f4b93[_0xad68('0x48')]=qs[_0xad68('0x3b')](_[_0xad68('0x44')](_0x138d51[_0xad68('0x38')],_0x438f7a[_0xad68('0x3b')]));if(_0x138d51[_0xad68('0x38')][_0xad68('0xa2')]){_0x1f4b93[_0xad68('0x48')]=_[_0xad68('0x47')](_0x1f4b93[_0xad68('0x48')],{'$or':_[_0xad68('0x49')](_0x1f4b93['attributes'],function(_0x29a453){var _0x2ca455={};_0x2ca455[_0x29a453]={'$like':'%'+_0x138d51[_0xad68('0x38')][_0xad68('0xa2')]+'%'};return _0x2ca455;})});}_0x1f4b93=_[_0xad68('0x47')]({},_0x1f4b93,_0x138d51[_0xad68('0x4d')]);return _0x34720b[_0xad68('0xe5')](_0x1f4b93);}})[_0xad68('0x15')](function(_0x21fbf5){if(_0x21fbf5){_0x2f910d=_0x21fbf5[_0xad68('0x54')];if(!_0x138d51[_0xad68('0x38')][_0xad68('0x3f')]('nolimit')){_0x1f4b93[_0xad68('0x41')]=qs[_0xad68('0x41')](_0x138d51[_0xad68('0x38')][_0xad68('0x41')]);_0x1f4b93['offset']=qs[_0xad68('0x25')](_0x138d51['query'][_0xad68('0x25')]);}return _0x34720b[_0xad68('0xe5')](_0x1f4b93);}})['then'](function(_0x376831){if(_0x376831){return _0x376831?{'count':_0x2f910d,'rows':_0x376831}:null;}})[_0xad68('0x15')](respondWithResult(_0x519908,null))['catch'](handleError(_0x519908,null));};exports[_0xad68('0xe6')]=function(_0x5bbafd,_0x400a29,_0x23edff){var _0x24ff17={};var _0x124fc7={};var _0x174d19;var _0x371da0;return db['User'][_0xad68('0xa0')]({'where':{'id':_0x5bbafd['params']['id']}})[_0xad68('0x15')](handleEntityNotFound(_0x400a29,null))[_0xad68('0x15')](function(_0x36a1db){if(_0x36a1db){_0x174d19=_0x36a1db;_0x124fc7[_0xad68('0x33')]=_['keys'](db[_0xad68('0x31')][_0xad68('0x32')]);_0x124fc7[_0xad68('0x38')]=_['keys'](_0x5bbafd[_0xad68('0x38')]);_0x124fc7[_0xad68('0x3b')]=_[_0xad68('0x3d')](_0x124fc7[_0xad68('0x33')],_0x124fc7['query']);_0x24ff17['attributes']=_[_0xad68('0x3d')](_0x124fc7['model'],qs[_0xad68('0x3e')](_0x5bbafd[_0xad68('0x38')][_0xad68('0x3e')]));_0x24ff17[_0xad68('0x3c')]=_0x24ff17['attributes'][_0xad68('0x54')]?_0x24ff17[_0xad68('0x3c')]:_0x124fc7[_0xad68('0x33')];_0x24ff17[_0xad68('0x42')]=qs['sort'](_0x5bbafd[_0xad68('0x38')][_0xad68('0x43')]);_0x24ff17['where']=qs['filters'](_[_0xad68('0x44')](_0x5bbafd['query'],_0x124fc7[_0xad68('0x3b')]));if(_0x5bbafd['query'][_0xad68('0xa2')]){_0x24ff17[_0xad68('0x48')]=_[_0xad68('0x47')](_0x24ff17[_0xad68('0x48')],{'$or':_[_0xad68('0x49')](_0x24ff17[_0xad68('0x3c')],function(_0x18dd87){var _0x252053={};_0x252053[_0x18dd87]={'$like':'%'+_0x5bbafd[_0xad68('0x38')]['filter']+'%'};return _0x252053;})});}_0x24ff17['model']=db[_0xad68('0x31')];_0x24ff17['as']='Agents';_0x24ff17=_[_0xad68('0x47')]({},_0x24ff17,_0x5bbafd[_0xad68('0x4d')]);return _0x174d19[_0xad68('0xe7')]({'include':[_0x24ff17]});}})['then'](function(_0x545f76){if(_0x545f76){var _0x144666={},_0x2c052b=[],_0xbb6529=0x0;for(var _0x277659=0x0;_0x277659<_0x545f76[_0xad68('0x54')];_0x277659+=0x1){for(var _0x4b800a=0x0,_0x4ab37c;_0x4b800a<_0x545f76[_0x277659]['Agents']['length'];_0x4b800a+=0x1){_0x4ab37c=_0x545f76[_0x277659][_0xad68('0xe8')][_0x4b800a][_0xad68('0xa4')]({'plain':!![]});_0x144666[_0x4ab37c['id']]=_0x4ab37c;}}_0x144666=_[_0xad68('0xe9')](_0x144666);for(var _0x508569=qs[_0xad68('0x25')](_0x5bbafd[_0xad68('0x38')][_0xad68('0x25')]);_0x508569<_0x144666[_0xad68('0x54')]&&_0x2c052b[_0xad68('0x54')]=_0x4f6ab9){_0x28fa97=_0x4f6ab9;_0x759d1a=0xc8;}else{_0x759d1a=0xce;}_0x1c4509['status'](_0x759d1a);return _0x1c4509['set'](_0xc176('0x29'),_0x50a968+'-'+_0x28fa97+'/'+_0x4f6ab9)[_0xc176('0x2a')](_0x38984d);}return null;};}function patchUpdates(_0x201745){return function(_0x2c809d){try{jsonpatch[_0xc176('0x2b')](_0x2c809d,_0x201745,!![]);}catch(_0x2137c2){return BPromise['reject'](_0x2137c2);}return _0x2c809d['save']();};}function saveUpdates(_0x2730be,_0x496c1f){return function(_0x1dceed){if(_0x1dceed){return _0x1dceed[_0xc176('0x2c')](_0x2730be)[_0xc176('0x19')](function(_0x512053){return _0x512053;});}return null;};}function removeEntity(_0x155a8b,_0x139d1c){return function(_0x13f23e){if(_0x13f23e){return _0x13f23e[_0xc176('0x2d')]()[_0xc176('0x19')](function(){_0x155a8b[_0xc176('0x24')](0xcc)[_0xc176('0x25')]();});}};}function handleEntityNotFound(_0x19a259,_0x12d169){return function(_0x3af280){if(!_0x3af280){_0x19a259[_0xc176('0x2e')](0x194);}return _0x3af280;};}function handleError(_0x2d6410,_0x1cc5f0){_0x1cc5f0=_0x1cc5f0||0x1f4;return function(_0x1feab6){logger[_0xc176('0x1f')](_0x1feab6[_0xc176('0x2f')]);if(_0x1feab6[_0xc176('0x30')]){delete _0x1feab6['name'];}_0x2d6410[_0xc176('0x24')](_0x1cc5f0)[_0xc176('0x31')](_0x1feab6);};}exports['index']=function(_0x488193,_0x39e037){var _0x3f959d={},_0x1059e0={},_0x2016ed={'count':0x0,'rows':[]};var _0x313a66=db[_0xc176('0x32')][_0xc176('0x33')];_0x1059e0[_0xc176('0x34')]=_[_0xc176('0x35')](_[_0xc176('0x36')](_0x313a66),[_0xc176('0x37'),_0xc176('0x38')]);var _0x327c75={'dateStart':_0x488193[_0xc176('0x39')][_0xc176('0x3a')],'dateEnd':_0x488193[_0xc176('0x39')]['dateEnd']};delete _0x488193[_0xc176('0x39')][_0xc176('0x3a')];delete _0x488193[_0xc176('0x39')][_0xc176('0x3b')];_0x1059e0['query']=_[_0xc176('0x36')](_0x488193[_0xc176('0x39')]);_0x1059e0[_0xc176('0x3c')]=_[_0xc176('0x3d')](_0x1059e0[_0xc176('0x34')],_0x1059e0['query']);_0x3f959d[_0xc176('0x3e')]=_[_0xc176('0x3d')](_0x1059e0[_0xc176('0x34')],qs[_0xc176('0x3f')](_0x488193[_0xc176('0x39')][_0xc176('0x3f')]));_0x3f959d[_0xc176('0x3e')]=_0x3f959d[_0xc176('0x3e')][_0xc176('0x40')]?_0x3f959d[_0xc176('0x3e')]:_0x1059e0[_0xc176('0x34')];if(!_0x488193[_0xc176('0x39')][_0xc176('0x41')](_0xc176('0x42'))){_0x3f959d[_0xc176('0x28')]=qs[_0xc176('0x28')](_0x488193[_0xc176('0x39')]['limit']);_0x3f959d[_0xc176('0x27')]=qs[_0xc176('0x27')](_0x488193[_0xc176('0x39')][_0xc176('0x27')]);}_0x3f959d[_0xc176('0x43')]=qs[_0xc176('0x44')](_0x488193[_0xc176('0x39')]['sort']);_0x3f959d[_0xc176('0x45')]=qs[_0xc176('0x3c')](_['pick'](_0x488193[_0xc176('0x39')],_0x1059e0[_0xc176('0x3c')]));if(_0x327c75[_0xc176('0x3a')]){if(_0x327c75[_0xc176('0x3b')]){_0x327c75[_0xc176('0x3b')]=moment(_0x327c75[_0xc176('0x3b')])[_0xc176('0x46')](0x1,_0xc176('0x47'));}else{_0x327c75[_0xc176('0x3b')]=moment(_0x327c75[_0xc176('0x3a')])[_0xc176('0x46')](0x1,_0xc176('0x47'));}_[_0xc176('0x48')](_0x3f959d[_0xc176('0x45')],{'createdAt':{'$gte':_0x327c75[_0xc176('0x3a')],'$lte':_0x327c75[_0xc176('0x3b')]}});}if(_0x488193[_0xc176('0x39')][_0xc176('0x49')]){_0x3f959d['where']=_[_0xc176('0x48')](_0x3f959d[_0xc176('0x45')],{'$or':_[_0xc176('0x4a')](_0x3f959d[_0xc176('0x3e')],function(_0x13f6b5){return db[_0xc176('0x4b')][_0xc176('0x45')](db[_0xc176('0x4b')]['fn'](_0xc176('0x4c'),db[_0xc176('0x4b')][_0xc176('0x4d')](_0x13f6b5)),{'$like':db[_0xc176('0x4b')]['fn'](_0xc176('0x4c'),'%'+_0x488193[_0xc176('0x39')][_0xc176('0x49')]+'%')});})});}_0x3f959d=_[_0xc176('0x48')]({},_0x3f959d,_0x488193[_0xc176('0x4e')]);var _0x494360={'where':_0x3f959d[_0xc176('0x45')]};return db['User'][_0xc176('0x26')](_0x494360)[_0xc176('0x19')](function(_0x1f46b6){_0x2016ed[_0xc176('0x26')]=_0x1f46b6;if(_0x488193[_0xc176('0x39')][_0xc176('0x4f')]){_0x3f959d['include']=[{'all':!![]}];}return db[_0xc176('0x32')][_0xc176('0x50')](_0x3f959d);})[_0xc176('0x19')](function(_0x40fdb7){_0x2016ed[_0xc176('0x51')]=_0x40fdb7;return _0x2016ed;})['then'](respondWithFilteredResult(_0x39e037,_0x3f959d))[_0xc176('0x52')](handleError(_0x39e037,null));};exports[_0xc176('0x53')]=function(_0xb458b,_0x205b0b){var _0x62cd7={'raw':![],'where':{'id':_0xb458b[_0xc176('0x54')]['id']}},_0x56671d={};_0x56671d[_0xc176('0x34')]=_[_0xc176('0x35')](_[_0xc176('0x36')](db[_0xc176('0x32')]['rawAttributes']),[_0xc176('0x37'),_0xc176('0x38')]);_0x56671d[_0xc176('0x39')]=_[_0xc176('0x36')](_0xb458b['query']);_0x56671d['filters']=_[_0xc176('0x3d')](_0x56671d[_0xc176('0x34')],_0x56671d[_0xc176('0x39')]);_0x62cd7['attributes']=_[_0xc176('0x3d')](_0x56671d['model'],qs[_0xc176('0x3f')](_0xb458b[_0xc176('0x39')][_0xc176('0x3f')]));_0x62cd7[_0xc176('0x3e')]=_0x62cd7[_0xc176('0x3e')][_0xc176('0x40')]?_0x62cd7[_0xc176('0x3e')]:_0x56671d[_0xc176('0x34')];if(_0xb458b[_0xc176('0x39')][_0xc176('0x4f')]){_0x62cd7[_0xc176('0x55')]=[{'all':!![]}];}_0x62cd7=_[_0xc176('0x48')]({},_0x62cd7,_0xb458b[_0xc176('0x4e')]);return db[_0xc176('0x32')][_0xc176('0x56')](_0x62cd7)['then'](handleEntityNotFound(_0x205b0b,null))[_0xc176('0x19')](respondWithResult(_0x205b0b,null))[_0xc176('0x52')](handleError(_0x205b0b,null));};exports[_0xc176('0x57')]=function(_0x571959,_0x7124ce){return db[_0xc176('0x32')][_0xc176('0x57')](_0x571959[_0xc176('0x58')],{'raw':![],'individualHooks':!![]})[_0xc176('0x19')](respondWithResult(_0x7124ce,0xc9))[_0xc176('0x52')](handleError(_0x7124ce,null));};exports['update']=function(_0x3cc48f,_0x3a3b76){if(_0x3cc48f[_0xc176('0x58')]['id']){delete _0x3cc48f[_0xc176('0x58')]['id'];}return db[_0xc176('0x32')][_0xc176('0x56')]({'where':{'id':_0x3cc48f[_0xc176('0x54')]['id']}})['then'](handleEntityNotFound(_0x3a3b76,null))['then'](saveUpdates(_0x3cc48f['body'],null))[_0xc176('0x19')](respondWithResult(_0x3a3b76,null))[_0xc176('0x52')](handleError(_0x3a3b76,null));};exports['describe']=function(_0x280a48,_0x33981e){return db['User'][_0xc176('0x59')]()[_0xc176('0x19')](respondWithResult(_0x33981e,null))[_0xc176('0x52')](handleError(_0x33981e,null));};exports[_0xc176('0x5a')]=function(_0x1d748e,_0x5a91ff,_0x24c8b8){return db[_0xc176('0x32')][_0xc176('0x56')]({'where':{'id':_0x1d748e[_0xc176('0x54')]['id']}})[_0xc176('0x19')](handleEntityNotFound(_0x5a91ff,null))[_0xc176('0x19')](function(_0x50947d){if(_0x50947d){return _0x50947d[_0xc176('0x5a')](_0x1d748e[_0xc176('0x58')][_0xc176('0x5b')],_['omit'](_0x1d748e['body'],[_0xc176('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x5a91ff,null))[_0xc176('0x52')](handleError(_0x5a91ff,null));};var getLicense=function(_0xbbd424){return new BPromise(function(_0x574592,_0xf0b717){var _0x2972d7=0x0;_0xbbd424[_0xc176('0x58')][_0xc176('0x5c')]==='agent'&&_0x574592(_0xc176('0x5d'));return db[_0xc176('0x32')][_0xc176('0x26')]({'where':{'$or':[{'role':_0xbbd424[_0xc176('0x58')][_0xc176('0x5c')]===_0xc176('0x5e')?_0xc176('0x5e'):[_0xc176('0x5f'),_0xc176('0x60')]}]}})[_0xc176('0x19')](function(_0x425893){_0x2972d7=_0x425893;return require(_0xc176('0x61'))['getLicense']();})['then'](function(_0x62fdd9){var _0x473370=_0xbbd424[_0xc176('0x58')]['role']===_0xc176('0x5e')?_0xc176('0x62'):'users';if(!_[_0xc176('0x63')](_0x62fdd9[_0x473370])&&_0x2972d7>=_0x62fdd9[_0x473370]){return _0xf0b717({'message':_0xc176('0x64')});}return _0x574592(util[_0xc176('0x65')](_0xc176('0x66'),_0x473370,_0x2972d7));})[_0xc176('0x52')](function(_0x2d2b52){return _0xf0b717(_0x2d2b52);});});};exports[_0xc176('0x67')]=function(_0x7d2b65,_0x5208ff){return getLicense(_0x7d2b65)['then'](function(_0x1d5385){if(!_0x7d2b65[_0xc176('0x58')][_0xc176('0x68')]){var _0x4650bb;return db[_0xc176('0x69')][_0xc176('0x6a')](0x1)[_0xc176('0x19')](function(_0x2a1e4a){_0x4650bb=_0x2a1e4a[_0xc176('0x6b')];return db[_0xc176('0x32')][_0xc176('0x6c')](_0xc176('0x68'));})[_0xc176('0x19')](function(_0x559ca4){if(_[_0xc176('0x63')](_0x559ca4)){if(_0x4650bb){_0x7d2b65[_0xc176('0x58')]['internal']=_0x4650bb;}else{_0x7d2b65[_0xc176('0x58')][_0xc176('0x68')]=0x1;}}else{if(_[_0xc176('0x63')](_0x4650bb)||_0x4650bb==_0x559ca4){_0x7d2b65[_0xc176('0x58')][_0xc176('0x68')]=_0x559ca4+0x1;}else if(_0x4650bb>_0x559ca4){_0x7d2b65[_0xc176('0x58')][_0xc176('0x68')]=_0x4650bb;}else{return db['sequelize'][_0xc176('0x39')](_0xc176('0x6d'),{'type':db[_0xc176('0x4b')][_0xc176('0x6e')][_0xc176('0x6f')]})[_0xc176('0x19')](function(_0x4263a6){if(_0x4263a6&&_0x4263a6[_0xc176('0x40')]){for(var _0x5b85ff=0x0,_0x3bc09f=_0x4263a6[_0xc176('0x40')];_0x5b85ff<_0x3bc09f&&_[_0xc176('0x63')](_0x7d2b65[_0xc176('0x58')][_0xc176('0x68')]);_0x5b85ff++){if(_0x4650bb<=_0x4263a6[_0x5b85ff][_0xc176('0x70')]){_0x7d2b65[_0xc176('0x58')][_0xc176('0x68')]=_0x4263a6[_0x5b85ff][_0xc176('0x70')];}else if(_0x4650bb>_0x4263a6[_0x5b85ff][_0xc176('0x70')]&&_0x4650bb<=_0x4263a6[_0x5b85ff]['to']){_0x7d2b65[_0xc176('0x58')][_0xc176('0x68')]=_0x4650bb;}}}if(_[_0xc176('0x63')](_0x7d2b65[_0xc176('0x58')][_0xc176('0x68')])){_0x7d2b65[_0xc176('0x58')][_0xc176('0x68')]=_0x559ca4+0x1;}});}}});}})[_0xc176('0x19')](function(){if(_0x7d2b65[_0xc176('0x58')][_0xc176('0x71')]){_0x7d2b65[_0xc176('0x58')]['mailbox']=_0x7d2b65[_0xc176('0x58')]['internal'];_0x7d2b65[_0xc176('0x58')][_0xc176('0x72')]={'mailbox':_0x7d2b65[_0xc176('0x58')][_0xc176('0x68')],'password':_0x7d2b65['body'][_0xc176('0x37')],'fullname':_0x7d2b65[_0xc176('0x58')][_0xc176('0x73')],'email':_0x7d2b65[_0xc176('0x58')][_0xc176('0x74')]};}if(_0x7d2b65[_0xc176('0x58')]&&_0x7d2b65[_0xc176('0x58')][_0xc176('0x5c')]==='agent'){_0x7d2b65[_0xc176('0x58')][_0xc176('0x75')]=['101','102',_0xc176('0x76'),_0xc176('0x77'),_0xc176('0x78'),_0xc176('0x79'),_0xc176('0x7a'),_0xc176('0x7b'),_0xc176('0x7c'),_0xc176('0x7d'),'100',_0xc176('0x7e')];}return db[_0xc176('0x32')][_0xc176('0x67')](_0x7d2b65['body'],{'include':[{'model':db[_0xc176('0x72')],'as':_0xc176('0x72')}]});})['then'](respondWithResult(_0x5208ff,0xc9))[_0xc176('0x52')](handleError(_0x5208ff,null));};exports[_0xc176('0x7f')]=function(_0x4997b3,_0x3b63f2,_0x871663){if(_0x4997b3[_0xc176('0x58')]['id']){delete _0x4997b3['body']['id'];}return db['User'][_0xc176('0x56')]({'where':{'id':_0x4997b3[_0xc176('0x54')]['id']}})[_0xc176('0x19')](function(_0x3a6959){if(_0x3a6959){if(_0x3a6959['id']==_0x4997b3['user']['id']){if(!_0x4997b3[_0xc176('0x58')][_0xc176('0x80')]||!_0x4997b3[_0xc176('0x58')][_0xc176('0x81')]){throw new db['Sequelize']['ValidationError'](_0xc176('0x82'));}if(!_0x3a6959['authenticate'](_0x4997b3[_0xc176('0x58')][_0xc176('0x80')])){throw new db['Sequelize'][(_0xc176('0x83'))]('Wrong\x20credentials');}if(_0x4997b3[_0xc176('0x58')][_0xc176('0x80')]==_0x4997b3[_0xc176('0x58')]['newPassword']){throw new db[(_0xc176('0x84'))]['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x3a6959;}else if(_0x4997b3[_0xc176('0x60')][_0xc176('0x5c')]==_0xc176('0x5f')){if(!_0x4997b3[_0xc176('0x58')][_0xc176('0x81')]){throw new db[(_0xc176('0x84'))][(_0xc176('0x83'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}return _0x3a6959;}else if(_0x4997b3['user'][_0xc176('0x5c')]=='user'){if(!_0x4997b3[_0xc176('0x58')]['newPassword']){throw new db[(_0xc176('0x84'))][(_0xc176('0x83'))](_0xc176('0x85'));}if(_0x3a6959[_0xc176('0x5c')]!='agent'){throw new db[(_0xc176('0x84'))][(_0xc176('0x83'))](_0xc176('0x86'));}return _0x3a6959;}else{throw new db[(_0xc176('0x84'))]['ValidationError'](_0xc176('0x86'));}}return null;})[_0xc176('0x19')](handleEntityNotFound(_0x3b63f2,null))[_0xc176('0x19')](saveUpdates({'password':_0x4997b3[_0xc176('0x58')][_0xc176('0x81')],'passwordResetAt':_0x4997b3[_0xc176('0x60')]['id']==_0x4997b3['params']['id']?moment():null},null))[_0xc176('0x19')](respondWithResult(_0x3b63f2,null))[_0xc176('0x52')](handleError(_0x3b63f2,null));};exports[_0xc176('0x87')]=function(_0x20073d,_0x4dfba5,_0xa21185){var _0x1f5422;return db[_0xc176('0x32')][_0xc176('0x56')]({'where':{'id':_0x20073d[_0xc176('0x54')]['id']},'attributes':['id',_0xc176('0x30'),_0xc176('0x5c'),_0xc176('0x88'),_0xc176('0x89')]})[_0xc176('0x19')](handleEntityNotFound(_0x4dfba5,null))[_0xc176('0x19')](function(_0x1ba3da){if(_0x1ba3da){_0x1f5422=_0x1ba3da;if(!utils[_0xc176('0x8a')](_0x20073d[_0xc176('0x58')]['channel'])){throw new db[(_0xc176('0x84'))][(_0xc176('0x83'))]('Unknown\x20channel');}return _0x1ba3da[_0xc176('0x46')+_[_0xc176('0x8b')](_0x20073d[_0xc176('0x58')][_0xc176('0x8c')][_0xc176('0x8d')]())+_0xc176('0x8e')](_0x20073d[_0xc176('0x58')]['ids'],{'penalty':_0x20073d[_0xc176('0x58')][_0xc176('0x8f')]||0x0});}})[_0xc176('0x19')](function(){if(_0x20073d['body'][_0xc176('0x8c')]===_0xc176('0x90')){return db[_0xc176('0x91')][_0xc176('0x50')]({'where':{'id':_0x20073d[_0xc176('0x58')][_0xc176('0x5b')]||[]},'raw':!![],'attributes':['id',_0xc176('0x30')]});}})['then'](function(_0x4bea95){var _0x39e4b8=[];if(_0x20073d['body']['channel']===_0xc176('0x90')&&_0x1f5422['role']===_0xc176('0x92')){for(var _0x18e4fc=0x0;_0x18e4fc<_0x4bea95['length'];_0x18e4fc+=0x1){_0x39e4b8['push']({'membername':_0x1f5422[_0xc176('0x30')],'UserId':_0x1f5422['id'],'queue_name':_0x4bea95[_0x18e4fc][_0xc176('0x30')],'VoiceQueueId':_0x4bea95[_0x18e4fc]['id'],'interface':util[_0xc176('0x65')](_0xc176('0x93'),'SIP',_0x1f5422[_0xc176('0x30')]),'paused':_0x1f5422['voicePause']||![],'penalty':_0x20073d[_0xc176('0x58')][_0xc176('0x8f')]||0x0});}return BPromise[_0xc176('0x94')](_0x39e4b8,function(_0x17edc4){return db[_0xc176('0x95')]['upsert'](_0x17edc4);});}return _0x1f5422;})[_0xc176('0x19')](respondWithStatusCode(_0x4dfba5,null))[_0xc176('0x52')](handleError(_0x4dfba5,null));};exports[_0xc176('0x96')]=function(_0x3f3244,_0x1746a8,_0x3449e6){var _0xd7f26e;return db[_0xc176('0x32')][_0xc176('0x56')]({'where':{'id':_0x3f3244['params']['id']},'attributes':['id',_0xc176('0x30'),_0xc176('0x5c')]})[_0xc176('0x19')](handleEntityNotFound(_0x1746a8,null))[_0xc176('0x19')](function(_0x4702b8){if(_0x4702b8){_0xd7f26e=_0x4702b8;if(!_0x3f3244['query']['channel']||!utils[_0xc176('0x8a')](_0x3f3244[_0xc176('0x39')][_0xc176('0x8c')])){throw new db[(_0xc176('0x84'))]['ValidationError'](_0xc176('0x97'));}return _0x4702b8[_0xc176('0x98')+_['capitalize'](_0x3f3244[_0xc176('0x39')]['channel'][_0xc176('0x8d')]())+_0xc176('0x8e')](_0x3f3244[_0xc176('0x39')][_0xc176('0x5b')]);}})[_0xc176('0x19')](function(_0x5de6e3){if(_0x3f3244[_0xc176('0x39')][_0xc176('0x8c')]===_0xc176('0x90')){return db[_0xc176('0x95')]['destroy']({'where':{'UserId':_0x3f3244[_0xc176('0x54')]['id'],'VoiceQueueId':_0x3f3244[_0xc176('0x39')][_0xc176('0x5b')]},'individualHooks':!![]})['then'](function(){return _0xd7f26e;});}return _0xd7f26e;})[_0xc176('0x19')](respondWithStatusCode(_0x1746a8,null))[_0xc176('0x52')](handleError(_0x1746a8,null));};exports[_0xc176('0x99')]=function(_0x3d579d,_0x4dbf9f,_0x3d7a29){_0x3d579d[_0xc176('0x58')][_0xc176('0x9a')]=_0x3d579d[_0xc176('0x9b')][_0xc176('0x9c')];return db[_0xc176('0x32')][_0xc176('0x56')]({'where':{'id':_0x3d579d[_0xc176('0x54')]['id']}})['then'](handleEntityNotFound(_0x4dbf9f,null))[_0xc176('0x19')](saveUpdates(_0x3d579d[_0xc176('0x58')],null))[_0xc176('0x19')](respondWithResult(_0x4dbf9f,null))[_0xc176('0x52')](handleError(_0x4dbf9f,null));};exports[_0xc176('0x9d')]=function(_0x510bdf,_0x5a2da8,_0x420397){var _0x1e8d18=path[_0xc176('0x9e')](config['root'],'server/files/images/logos/default_profile.png');return db[_0xc176('0x32')][_0xc176('0x56')]({'where':{'id':_0x510bdf[_0xc176('0x54')]['id']},'attributes':['id',_0xc176('0x9a')],'raw':!![]})[_0xc176('0x19')](handleEntityNotFound(_0x5a2da8,null))[_0xc176('0x19')](function(_0x5f1059){if(_0x5f1059){if(_[_0xc176('0x63')](_0x5f1059[_0xc176('0x9a')])){return _0x5a2da8[_0xc176('0x9f')](_0x1e8d18);}else{if(!fs['existsSync'](path[_0xc176('0x9e')](config[_0xc176('0xa0')],_0xc176('0xa1'),_0x5f1059['userpic']))){return _0x5a2da8[_0xc176('0x9f')](_0x1e8d18);}return _0x5a2da8[_0xc176('0x9f')](path[_0xc176('0x9e')](config['root'],_0xc176('0xa1'),_0x5f1059[_0xc176('0x9a')]));}}})[_0xc176('0x52')](handleError(_0x5a2da8,null));};exports[_0xc176('0xa2')]=function(_0x16d258,_0xc36ccb,_0x18189f){var _0x4f1e5b;var _0x337657={'where':{}},_0x4ac24={},_0x3bca2c={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x16d258['params']['id']}})[_0xc176('0x19')](handleEntityNotFound(_0xc36ccb,null))[_0xc176('0x19')](function(_0x3d80d7){if(_0x3d80d7){_0x4f1e5b=_0x3d80d7;_0x337657[_0xc176('0x45')][_0xc176('0xa3')]=_0x3d80d7['id'];return db[_0xc176('0xa4')][_0xc176('0x59')]();}})[_0xc176('0x19')](function(_0x18a87c){if(_0x18a87c){_0x4ac24[_0xc176('0x34')]=_[_0xc176('0x36')](_0x18a87c);_0x4ac24[_0xc176('0x39')]=_[_0xc176('0x36')](_0x16d258[_0xc176('0x39')]);_0x4ac24[_0xc176('0x3c')]=_[_0xc176('0x3d')](_0x4ac24['model'],_0x4ac24['query']);_0x337657['attributes']=_[_0xc176('0x3d')](_0x4ac24[_0xc176('0x34')],qs[_0xc176('0x3f')](_0x16d258[_0xc176('0x39')][_0xc176('0x3f')]));_0x337657[_0xc176('0x3e')]=_0x337657['attributes'][_0xc176('0x40')]?_0x337657[_0xc176('0x3e')]:_0x4ac24[_0xc176('0x34')];if(!_0x16d258[_0xc176('0x39')]['hasOwnProperty'](_0xc176('0x42'))){_0x337657[_0xc176('0x28')]=qs[_0xc176('0x28')](_0x16d258[_0xc176('0x39')][_0xc176('0x28')]);_0x337657['offset']=qs[_0xc176('0x27')](_0x16d258['query'][_0xc176('0x27')]);}_0x337657[_0xc176('0x43')]=qs[_0xc176('0x44')](_0x16d258[_0xc176('0x39')]['sort']);_0x337657[_0xc176('0x45')]=qs[_0xc176('0x3c')](_[_0xc176('0xa5')](_0x16d258['query'],_0x4ac24[_0xc176('0x3c')]));if(_0x16d258[_0xc176('0x39')][_0xc176('0x49')]){_0x337657['where']=_[_0xc176('0x48')](_0x337657[_0xc176('0x45')],{'$or':_[_0xc176('0x4a')](_0x337657[_0xc176('0x3e')],function(_0x3e0712){var _0x409371={};_0x409371[_0x3e0712]={'$like':'%'+_0x16d258[_0xc176('0x39')]['filter']+'%'};return _0x409371;})});}_0x337657=_[_0xc176('0x48')]({},_0x337657,_0x16d258['options']);return _0x4f1e5b[_0xc176('0xa2')](_['pick'](_0x337657,['where']))[_0xc176('0x19')](function(_0x4833f6){_0x3bca2c[_0xc176('0x26')]=_0x4833f6[_0xc176('0x40')]||0x0;if(_0x16d258[_0xc176('0x39')][_0xc176('0x4f')]){_0x337657['include']=[{'all':!![]}];}return _0x4f1e5b[_0xc176('0xa2')](_0x337657);})[_0xc176('0x19')](function(_0x311c2f){_0x3bca2c[_0xc176('0x51')]=_0x311c2f;return _0x3bca2c;});}})[_0xc176('0x19')](respondWithFilteredResult(_0xc36ccb,_0x337657))[_0xc176('0x52')](handleError(_0xc36ccb,null));};exports['getQueues']=function(_0x5c32a3,_0x545b2f,_0x160715){var _0x3a7424;var _0x4fa568;var _0x30451e={};var _0xad91ea;return db['User'][_0xc176('0xa6')]({'where':{'id':_0x5c32a3[_0xc176('0x54')]['id']},'attributes':['id',_0xc176('0x30'),_0xc176('0x5c')]})['then'](handleEntityNotFound(_0x545b2f,null))[_0xc176('0x19')](function(_0x3bf324){if(!utils[_0xc176('0x8a')](_0x5c32a3[_0xc176('0x39')][_0xc176('0x8c')])){throw new db[(_0xc176('0x84'))]['ValidationError'](_0xc176('0x97'));}_0x3a7424=_0x3bf324;var _0x16ce2f={};_0x16ce2f[_0xc176('0x34')]=_['keys'](db[_[_0xc176('0x8b')](_0x5c32a3['query'][_0xc176('0x8c')])+'Queue'][_0xc176('0x33')]);_0x16ce2f[_0xc176('0x39')]=_[_0xc176('0x36')](_0x5c32a3[_0xc176('0x39')]);_0x16ce2f[_0xc176('0x3c')]=_[_0xc176('0x3d')](_0x16ce2f['model'],_0x16ce2f[_0xc176('0x39')]);_0x30451e[_0xc176('0x3e')]=_[_0xc176('0x3d')](_0x16ce2f[_0xc176('0x34')],qs['fields'](_0x5c32a3[_0xc176('0x39')][_0xc176('0x3f')]));_0x30451e[_0xc176('0x3e')]=_0x30451e[_0xc176('0x3e')][_0xc176('0x40')]?_0x30451e[_0xc176('0x3e')]:_0x16ce2f[_0xc176('0x34')];_0x30451e[_0xc176('0x43')]=qs[_0xc176('0x44')](_0x5c32a3[_0xc176('0x39')][_0xc176('0x44')]);_0x30451e['where']=qs[_0xc176('0x3c')](_[_0xc176('0xa5')](_0x5c32a3[_0xc176('0x39')],_0x16ce2f[_0xc176('0x3c')]));if(_0x5c32a3[_0xc176('0x39')][_0xc176('0x49')]){_0x30451e[_0xc176('0x45')]=_[_0xc176('0x48')](_0x30451e['where'],{'$or':_[_0xc176('0x4a')](_0x30451e[_0xc176('0x3e')],function(_0x5e0e87){var _0x9fa9f8={};_0x9fa9f8[_0x5e0e87]={'$like':'%'+_0x5c32a3[_0xc176('0x39')]['filter']+'%'};return _0x9fa9f8;})});}_0x30451e=_[_0xc176('0x48')]({},_0x30451e,_0x5c32a3[_0xc176('0x4e')]);switch(_0x3a7424[_0xc176('0x5c')]){case _0xc176('0x5f'):return db[_[_0xc176('0x8b')](_0x5c32a3['query'][_0xc176('0x8c')])+_0xc176('0xa7')][_0xc176('0x50')](_0x30451e);case _0xc176('0x60'):case _0xc176('0x92'):return _0x3a7424[_0xc176('0xa8')+_[_0xc176('0x8b')](_0x5c32a3[_0xc176('0x39')][_0xc176('0x8c')])+_0xc176('0x8e')](_0x30451e);default:throw new db['Sequelize']['ValidationError']('Unknown\x20role');}})['then'](function(_0x598998){_0xad91ea=_0x598998['length'];if(!_0x5c32a3[_0xc176('0x39')]['hasOwnProperty'](_0xc176('0x42'))){_0x30451e['limit']=qs[_0xc176('0x28')](_0x5c32a3[_0xc176('0x39')]['limit']);_0x30451e[_0xc176('0x27')]=qs[_0xc176('0x27')](_0x5c32a3['query']['offset']);}switch(_0x3a7424['role']){case _0xc176('0x5f'):return db[_[_0xc176('0x8b')](_0x5c32a3[_0xc176('0x39')]['channel'])+_0xc176('0xa7')][_0xc176('0x50')](_0x30451e);case _0xc176('0x60'):case _0xc176('0x92'):return _0x3a7424[_0xc176('0xa8')+_[_0xc176('0x8b')](_0x5c32a3[_0xc176('0x39')][_0xc176('0x8c')])+'Queues'](_0x30451e);}})[_0xc176('0x19')](function(_0x7175f6){return{'count':_0xad91ea,'rows':_0x7175f6};})[_0xc176('0x19')](respondWithResult(_0x545b2f,null))[_0xc176('0x52')](handleError(_0x545b2f,null));};exports[_0xc176('0xa9')]=function(_0x1d6212,_0x105db0,_0x321121){var _0x9d6100={};var _0x3708a4={};var _0x277732;var _0x2f7336;return db[_0xc176('0x32')][_0xc176('0xa6')]({'where':{'id':_0x1d6212[_0xc176('0x54')]['id']}})['then'](handleEntityNotFound(_0x105db0,null))[_0xc176('0x19')](function(_0x21fb27){if(_0x21fb27){_0x277732=_0x21fb27;_0x3708a4[_0xc176('0x34')]=_[_0xc176('0x36')](db[_0xc176('0x95')][_0xc176('0x33')]);_0x3708a4[_0xc176('0x39')]=_['keys'](_0x1d6212[_0xc176('0x39')]);_0x3708a4[_0xc176('0x3c')]=_[_0xc176('0x3d')](_0x3708a4[_0xc176('0x34')],_0x3708a4['query']);_0x9d6100[_0xc176('0x3e')]=_[_0xc176('0x3d')](_0x3708a4[_0xc176('0x34')],qs[_0xc176('0x3f')](_0x1d6212[_0xc176('0x39')]['fields']));_0x9d6100[_0xc176('0x3e')]=_0x9d6100[_0xc176('0x3e')]['length']?_0x9d6100[_0xc176('0x3e')]:_0x3708a4[_0xc176('0x34')];_0x9d6100[_0xc176('0x43')]=qs[_0xc176('0x44')](_0x1d6212[_0xc176('0x39')]['sort']);_0x9d6100[_0xc176('0x45')]=qs[_0xc176('0x3c')](_[_0xc176('0xa5')](_0x1d6212[_0xc176('0x39')],_0x3708a4['filters']));if(_0x1d6212['query']['filter']){_0x9d6100[_0xc176('0x45')]=_[_0xc176('0x48')](_0x9d6100['where'],{'$or':_[_0xc176('0x4a')](_0x9d6100[_0xc176('0x3e')],function(_0x250880){var _0x49e190={};_0x49e190[_0x250880]={'$like':'%'+_0x1d6212[_0xc176('0x39')][_0xc176('0x49')]+'%'};return _0x49e190;})});}_0x9d6100=_[_0xc176('0x48')]({},_0x9d6100,_0x1d6212[_0xc176('0x4e')]);return _0x277732['getVoiceQueuesRt'](_0x9d6100);}})['then'](function(_0x19a31c){if(_0x19a31c){_0x2f7336=_0x19a31c['length'];if(!_0x1d6212[_0xc176('0x39')][_0xc176('0x41')](_0xc176('0x42'))){_0x9d6100['limit']=qs['limit'](_0x1d6212[_0xc176('0x39')]['limit']);_0x9d6100[_0xc176('0x27')]=qs['offset'](_0x1d6212[_0xc176('0x39')][_0xc176('0x27')]);}return _0x277732[_0xc176('0xa9')](_0x9d6100);}})[_0xc176('0x19')](function(_0x5a9cdc){if(_0x5a9cdc){return _0x5a9cdc?{'count':_0x2f7336,'rows':_0x5a9cdc}:null;}})[_0xc176('0x19')](respondWithResult(_0x105db0,null))[_0xc176('0x52')](handleError(_0x105db0,null));};exports['getGroups']=function(_0x5d8480,_0x1a0b71,_0x4b6156){var _0x5a3f30={};var _0x19737d={};var _0x10c57c;var _0x4083f8;return db[_0xc176('0x32')][_0xc176('0xa6')]({'where':{'id':_0x5d8480[_0xc176('0x54')]['id']}})[_0xc176('0x19')](handleEntityNotFound(_0x1a0b71,null))[_0xc176('0x19')](function(_0x14b13c){if(_0x14b13c){_0x10c57c=_0x14b13c;_0x19737d[_0xc176('0x34')]=_[_0xc176('0x36')](db[_0xc176('0xaa')][_0xc176('0x33')]);_0x19737d[_0xc176('0x39')]=_[_0xc176('0x36')](_0x5d8480[_0xc176('0x39')]);_0x19737d[_0xc176('0x3c')]=_[_0xc176('0x3d')](_0x19737d[_0xc176('0x34')],_0x19737d[_0xc176('0x39')]);_0x5a3f30[_0xc176('0x3e')]=_[_0xc176('0x3d')](_0x19737d['model'],qs[_0xc176('0x3f')](_0x5d8480[_0xc176('0x39')]['fields']));_0x5a3f30[_0xc176('0x3e')]=_0x5a3f30[_0xc176('0x3e')]['length']?_0x5a3f30[_0xc176('0x3e')]:_0x19737d['model'];_0x5a3f30['order']=qs['sort'](_0x5d8480[_0xc176('0x39')][_0xc176('0x44')]);_0x5a3f30[_0xc176('0x45')]=qs[_0xc176('0x3c')](_[_0xc176('0xa5')](_0x5d8480[_0xc176('0x39')],_0x19737d[_0xc176('0x3c')]));if(_0x5d8480['query'][_0xc176('0x49')]){_0x5a3f30['where']=_[_0xc176('0x48')](_0x5a3f30[_0xc176('0x45')],{'$or':_[_0xc176('0x4a')](_0x5a3f30[_0xc176('0x3e')],function(_0x20e28f){var _0x4664ef={};_0x4664ef[_0x20e28f]={'$like':'%'+_0x5d8480[_0xc176('0x39')][_0xc176('0x49')]+'%'};return _0x4664ef;})});}_0x5a3f30=_[_0xc176('0x48')]({},_0x5a3f30,_0x5d8480[_0xc176('0x4e')]);return _0x10c57c[_0xc176('0xab')](_0x5a3f30);}})[_0xc176('0x19')](function(_0x4a1087){if(_0x4a1087){_0x4083f8=_0x4a1087[_0xc176('0x40')];if(!_0x5d8480['query'][_0xc176('0x41')](_0xc176('0x42'))){_0x5a3f30[_0xc176('0x28')]=qs[_0xc176('0x28')](_0x5d8480[_0xc176('0x39')]['limit']);_0x5a3f30[_0xc176('0x27')]=qs['offset'](_0x5d8480[_0xc176('0x39')]['offset']);}return _0x10c57c[_0xc176('0xab')](_0x5a3f30);}})[_0xc176('0x19')](function(_0x39b003){if(_0x39b003){return _0x39b003?{'count':_0x4083f8,'rows':_0x39b003}:null;}})['then'](respondWithResult(_0x1a0b71,null))['catch'](handleError(_0x1a0b71,null));};exports[_0xc176('0xac')]=function(_0x34d533,_0x26cfd6,_0x545486){var _0x102f8b={'raw':!![],'where':{}};var _0x251406={};var _0x278109={'count':0x0,'rows':[]};return db[_0xc176('0x32')]['findOne']({'where':{'id':_0x34d533[_0xc176('0x54')]['id']}})[_0xc176('0x19')](handleEntityNotFound(_0x26cfd6,null))[_0xc176('0x19')](function(_0x5aaef4){if(_0x5aaef4){_0x251406['model']=_['keys'](db[_0xc176('0xad')][_0xc176('0x33')]);_0x251406[_0xc176('0x39')]=_['keys'](_0x34d533[_0xc176('0x39')]);_0x251406[_0xc176('0x3c')]=_[_0xc176('0x3d')](_0x251406[_0xc176('0x34')],_0x251406[_0xc176('0x39')]);_0x102f8b[_0xc176('0x3e')]=_[_0xc176('0x3d')](_0x251406[_0xc176('0x34')],qs[_0xc176('0x3f')](_0x34d533['query'][_0xc176('0x3f')]));_0x102f8b[_0xc176('0x3e')]=_0x102f8b[_0xc176('0x3e')][_0xc176('0x40')]?_0x102f8b[_0xc176('0x3e')]:_0x251406[_0xc176('0x34')];if(!_0x34d533['query'][_0xc176('0x41')](_0xc176('0x42'))){_0x102f8b[_0xc176('0x28')]=qs[_0xc176('0x28')](_0x34d533[_0xc176('0x39')][_0xc176('0x28')]);_0x102f8b[_0xc176('0x27')]=qs['offset'](_0x34d533[_0xc176('0x39')]['offset']);}_0x102f8b[_0xc176('0x43')]=qs[_0xc176('0x44')](_0x34d533['query'][_0xc176('0x44')]);_0x102f8b[_0xc176('0x45')]=qs[_0xc176('0x3c')](_[_0xc176('0xa5')](_0x34d533[_0xc176('0x39')],_0x251406[_0xc176('0x3c')]));_0x102f8b[_0xc176('0x45')]['UserId']=_0x5aaef4['id'];if(_0x34d533[_0xc176('0x39')][_0xc176('0x49')]){_0x102f8b[_0xc176('0x45')]=_[_0xc176('0x48')](_0x102f8b[_0xc176('0x45')],{'$or':_['map'](_0x102f8b[_0xc176('0x3e')],function(_0x1e296b){var _0x4522a0={};_0x4522a0[_0x1e296b]={'$like':'%'+_0x34d533[_0xc176('0x39')][_0xc176('0x49')]+'%'};return _0x4522a0;})});}_0x102f8b=_['merge']({},_0x102f8b,_0x34d533[_0xc176('0x4e')]);return db[_0xc176('0xad')][_0xc176('0x26')]({'where':_0x102f8b[_0xc176('0x45')]})[_0xc176('0x19')](function(_0x23c338){_0x278109['count']=_0x23c338;if(_0x34d533[_0xc176('0x39')][_0xc176('0x4f')]){_0x102f8b[_0xc176('0x55')]=[{'all':!![]}];}return db[_0xc176('0xad')]['findAll'](_0x102f8b);})['then'](function(_0x555899){_0x278109[_0xc176('0x51')]=_0x555899;return _0x278109;});}})[_0xc176('0x19')](respondWithFilteredResult(_0x26cfd6,_0x102f8b))[_0xc176('0x52')](handleError(_0x26cfd6,null));};exports[_0xc176('0xae')]=function(_0x22abef,_0x11080c,_0x578993){var _0x5556af={};var _0x1f2060={};var _0x5131af;var _0x3b784a;return db[_0xc176('0x32')][_0xc176('0xa6')]({'where':{'id':_0x22abef[_0xc176('0x54')]['id']}})[_0xc176('0x19')](handleEntityNotFound(_0x11080c,null))[_0xc176('0x19')](function(_0x425317){if(_0x425317){_0x5131af=_0x425317;_0x1f2060[_0xc176('0x34')]=_[_0xc176('0x36')](db[_0xc176('0xaf')][_0xc176('0x33')]);_0x1f2060['query']=_[_0xc176('0x36')](_0x22abef[_0xc176('0x39')]);_0x1f2060['filters']=_[_0xc176('0x3d')](_0x1f2060[_0xc176('0x34')],_0x1f2060[_0xc176('0x39')]);_0x5556af['attributes']=_[_0xc176('0x3d')](_0x1f2060['model'],qs[_0xc176('0x3f')](_0x22abef[_0xc176('0x39')][_0xc176('0x3f')]));_0x5556af[_0xc176('0x3e')]=_0x5556af['attributes']['length']?_0x5556af[_0xc176('0x3e')]:_0x1f2060[_0xc176('0x34')];_0x5556af[_0xc176('0x43')]=qs['sort'](_0x22abef[_0xc176('0x39')][_0xc176('0x44')]);_0x5556af['where']=qs[_0xc176('0x3c')](_[_0xc176('0xa5')](_0x22abef[_0xc176('0x39')],_0x1f2060[_0xc176('0x3c')]));if(_0x22abef[_0xc176('0x39')]['filter']){_0x5556af['where']=_[_0xc176('0x48')](_0x5556af[_0xc176('0x45')],{'$or':_[_0xc176('0x4a')](_0x5556af[_0xc176('0x3e')],function(_0x3a3522){var _0x49ffc9={};_0x49ffc9[_0x3a3522]={'$like':'%'+_0x22abef['query'][_0xc176('0x49')]+'%'};return _0x49ffc9;})});}_0x5556af=_[_0xc176('0x48')]({},_0x5556af,_0x22abef['options']);return _0x5131af[_0xc176('0xae')](_0x5556af);}})[_0xc176('0x19')](function(_0x1d8c41){if(_0x1d8c41){_0x3b784a=_0x1d8c41[_0xc176('0x40')];if(!_0x22abef[_0xc176('0x39')][_0xc176('0x41')]('nolimit')){_0x5556af['limit']=qs[_0xc176('0x28')](_0x22abef[_0xc176('0x39')][_0xc176('0x28')]);_0x5556af['offset']=qs[_0xc176('0x27')](_0x22abef[_0xc176('0x39')]['offset']);}return _0x5131af[_0xc176('0xae')](_0x5556af);}})[_0xc176('0x19')](function(_0x463925){if(_0x463925){return _0x463925?{'count':_0x3b784a,'rows':_0x463925}:null;}})[_0xc176('0x19')](respondWithResult(_0x11080c,null))[_0xc176('0x52')](handleError(_0x11080c,null));};exports[_0xc176('0xb0')]=function(_0x29707f,_0x1c7368,_0x21d276){var _0x188656={};var _0x3061af={};var _0x3c35ec;var _0x1b216d;return db[_0xc176('0x32')]['findOne']({'where':{'id':_0x29707f[_0xc176('0x54')]['id']}})[_0xc176('0x19')](handleEntityNotFound(_0x1c7368,null))[_0xc176('0x19')](function(_0x16c0fa){if(_0x16c0fa){_0x3c35ec=_0x16c0fa;_0x3061af[_0xc176('0x34')]=_[_0xc176('0x36')](db[_0xc176('0xb1')][_0xc176('0x33')]);_0x3061af[_0xc176('0x39')]=_[_0xc176('0x36')](_0x29707f[_0xc176('0x39')]);_0x3061af[_0xc176('0x3c')]=_['intersection'](_0x3061af[_0xc176('0x34')],_0x3061af['query']);_0x188656['attributes']=_['intersection'](_0x3061af[_0xc176('0x34')],qs[_0xc176('0x3f')](_0x29707f[_0xc176('0x39')][_0xc176('0x3f')]));_0x188656['attributes']=_0x188656[_0xc176('0x3e')]['length']?_0x188656['attributes']:_0x3061af['model'];_0x188656['order']=qs[_0xc176('0x44')](_0x29707f[_0xc176('0x39')]['sort']);_0x188656[_0xc176('0x45')]=qs[_0xc176('0x3c')](_[_0xc176('0xa5')](_0x29707f['query'],_0x3061af[_0xc176('0x3c')]));if(_0x29707f[_0xc176('0x39')][_0xc176('0x49')]){_0x188656['where']=_[_0xc176('0x48')](_0x188656[_0xc176('0x45')],{'$or':_[_0xc176('0x4a')](_0x188656[_0xc176('0x3e')],function(_0x4e0306){var _0xeae983={};_0xeae983[_0x4e0306]={'$like':'%'+_0x29707f[_0xc176('0x39')][_0xc176('0x49')]+'%'};return _0xeae983;})});}_0x188656=_[_0xc176('0x48')]({},_0x188656,_0x29707f[_0xc176('0x4e')]);return _0x3c35ec['getOpenchannelInteractions'](_0x188656);}})[_0xc176('0x19')](function(_0x2db83b){if(_0x2db83b){_0x1b216d=_0x2db83b[_0xc176('0x40')];if(!_0x29707f[_0xc176('0x39')][_0xc176('0x41')](_0xc176('0x42'))){_0x188656[_0xc176('0x28')]=qs[_0xc176('0x28')](_0x29707f[_0xc176('0x39')][_0xc176('0x28')]);_0x188656[_0xc176('0x27')]=qs[_0xc176('0x27')](_0x29707f[_0xc176('0x39')][_0xc176('0x27')]);}return _0x3c35ec[_0xc176('0xb0')](_0x188656);}})[_0xc176('0x19')](function(_0x4731b5){if(_0x4731b5){return _0x4731b5?{'count':_0x1b216d,'rows':_0x4731b5}:null;}})[_0xc176('0x19')](respondWithResult(_0x1c7368,null))[_0xc176('0x52')](handleError(_0x1c7368,null));};exports['getMailInteractions']=function(_0x5efc2f,_0x52632f,_0x5ecab8){var _0x3c0709={'raw':!![],'where':{}};var _0x51c569={};var _0x3ff072={'count':0x0,'rows':[]};return db[_0xc176('0x32')][_0xc176('0xa6')]({'where':{'id':_0x5efc2f['params']['id']}})[_0xc176('0x19')](handleEntityNotFound(_0x52632f,null))[_0xc176('0x19')](function(_0x531f2b){if(_0x531f2b){_0x51c569['model']=_[_0xc176('0x36')](db[_0xc176('0xb2')][_0xc176('0x33')]);_0x51c569[_0xc176('0x39')]=_[_0xc176('0x36')](_0x5efc2f[_0xc176('0x39')]);_0x51c569[_0xc176('0x3c')]=_['intersection'](_0x51c569[_0xc176('0x34')],_0x51c569[_0xc176('0x39')]);_0x3c0709[_0xc176('0x3e')]=_['intersection'](_0x51c569[_0xc176('0x34')],qs[_0xc176('0x3f')](_0x5efc2f[_0xc176('0x39')][_0xc176('0x3f')]));_0x3c0709[_0xc176('0x3e')]=_0x3c0709[_0xc176('0x3e')][_0xc176('0x40')]?_0x3c0709[_0xc176('0x3e')]:_0x51c569['model'];if(!_0x5efc2f[_0xc176('0x39')]['hasOwnProperty']('nolimit')){_0x3c0709[_0xc176('0x28')]=qs['limit'](_0x5efc2f['query'][_0xc176('0x28')]);_0x3c0709[_0xc176('0x27')]=qs[_0xc176('0x27')](_0x5efc2f['query']['offset']);}_0x3c0709[_0xc176('0x43')]=qs[_0xc176('0x44')](_0x5efc2f[_0xc176('0x39')][_0xc176('0x44')]);_0x3c0709[_0xc176('0x45')]=qs[_0xc176('0x3c')](_[_0xc176('0xa5')](_0x5efc2f[_0xc176('0x39')],_0x51c569['filters']));_0x3c0709[_0xc176('0x45')][_0xc176('0xa3')]=_0x531f2b['id'];if(_0x5efc2f['query']['filter']){_0x3c0709[_0xc176('0x45')]=_[_0xc176('0x48')](_0x3c0709[_0xc176('0x45')],{'$or':_[_0xc176('0x4a')](_0x3c0709[_0xc176('0x3e')],function(_0x473545){var _0xb62499={};_0xb62499[_0x473545]={'$like':'%'+_0x5efc2f[_0xc176('0x39')][_0xc176('0x49')]+'%'};return _0xb62499;})});}_0x3c0709=_[_0xc176('0x48')]({},_0x3c0709,_0x5efc2f[_0xc176('0x4e')]);return db[_0xc176('0xb2')][_0xc176('0x26')]({'where':_0x3c0709['where']})[_0xc176('0x19')](function(_0x59626f){_0x3ff072['count']=_0x59626f;if(_0x5efc2f[_0xc176('0x39')][_0xc176('0x4f')]){_0x3c0709[_0xc176('0x55')]=[{'all':!![]}];}return db[_0xc176('0xb2')][_0xc176('0x50')](_0x3c0709);})[_0xc176('0x19')](function(_0xa95325){_0x3ff072[_0xc176('0x51')]=_0xa95325;return _0x3ff072;});}})[_0xc176('0x19')](respondWithFilteredResult(_0x52632f,_0x3c0709))['catch'](handleError(_0x52632f,null));};exports[_0xc176('0xb3')]=function(_0x35d152,_0x9aa3fa,_0x341b55){var _0x12fe1b={};var _0x4f9fbe={};var _0xe9223a;var _0x411ef9;return db['User']['findOne']({'where':{'id':_0x35d152[_0xc176('0x54')]['id']}})['then'](handleEntityNotFound(_0x9aa3fa,null))['then'](function(_0x15b3e4){if(_0x15b3e4){_0xe9223a=_0x15b3e4;_0x4f9fbe['model']=_['keys'](db[_0xc176('0xb4')]['rawAttributes']);_0x4f9fbe[_0xc176('0x39')]=_[_0xc176('0x36')](_0x35d152['query']);_0x4f9fbe[_0xc176('0x3c')]=_[_0xc176('0x3d')](_0x4f9fbe[_0xc176('0x34')],_0x4f9fbe[_0xc176('0x39')]);_0x12fe1b[_0xc176('0x3e')]=_['intersection'](_0x4f9fbe['model'],qs[_0xc176('0x3f')](_0x35d152[_0xc176('0x39')][_0xc176('0x3f')]));_0x12fe1b[_0xc176('0x3e')]=_0x12fe1b[_0xc176('0x3e')]['length']?_0x12fe1b['attributes']:_0x4f9fbe[_0xc176('0x34')];_0x12fe1b[_0xc176('0x43')]=qs[_0xc176('0x44')](_0x35d152['query'][_0xc176('0x44')]);_0x12fe1b[_0xc176('0x45')]=qs[_0xc176('0x3c')](_['pick'](_0x35d152[_0xc176('0x39')],_0x4f9fbe[_0xc176('0x3c')]));if(_0x35d152[_0xc176('0x39')][_0xc176('0x49')]){_0x12fe1b[_0xc176('0x45')]=_['merge'](_0x12fe1b[_0xc176('0x45')],{'$or':_['map'](_0x12fe1b[_0xc176('0x3e')],function(_0x5a250c){var _0x2f787e={};_0x2f787e[_0x5a250c]={'$like':'%'+_0x35d152[_0xc176('0x39')][_0xc176('0x49')]+'%'};return _0x2f787e;})});}_0x12fe1b=_['merge']({},_0x12fe1b,_0x35d152['options']);return _0xe9223a[_0xc176('0xb3')](_0x12fe1b);}})['then'](function(_0x1543c5){if(_0x1543c5){_0x411ef9=_0x1543c5[_0xc176('0x40')];if(!_0x35d152['query'][_0xc176('0x41')](_0xc176('0x42'))){_0x12fe1b[_0xc176('0x28')]=qs['limit'](_0x35d152[_0xc176('0x39')]['limit']);_0x12fe1b[_0xc176('0x27')]=qs[_0xc176('0x27')](_0x35d152['query']['offset']);}return _0xe9223a[_0xc176('0xb3')](_0x12fe1b);}})[_0xc176('0x19')](function(_0x50fe84){if(_0x50fe84){return _0x50fe84?{'count':_0x411ef9,'rows':_0x50fe84}:null;}})['then'](respondWithResult(_0x9aa3fa,null))['catch'](handleError(_0x9aa3fa,null));};exports['getFaxInteractions']=function(_0x4eecb0,_0x5ae468,_0x22f831){var _0x581c54={};var _0x57d51f={};var _0x49ee23;var _0x204581;return db[_0xc176('0x32')][_0xc176('0xa6')]({'where':{'id':_0x4eecb0[_0xc176('0x54')]['id']}})[_0xc176('0x19')](handleEntityNotFound(_0x5ae468,null))[_0xc176('0x19')](function(_0x16c9cd){if(_0x16c9cd){_0x49ee23=_0x16c9cd;_0x57d51f[_0xc176('0x34')]=_['keys'](db[_0xc176('0xb5')]['rawAttributes']);_0x57d51f[_0xc176('0x39')]=_[_0xc176('0x36')](_0x4eecb0[_0xc176('0x39')]);_0x57d51f[_0xc176('0x3c')]=_['intersection'](_0x57d51f[_0xc176('0x34')],_0x57d51f[_0xc176('0x39')]);_0x581c54['attributes']=_[_0xc176('0x3d')](_0x57d51f['model'],qs[_0xc176('0x3f')](_0x4eecb0[_0xc176('0x39')][_0xc176('0x3f')]));_0x581c54[_0xc176('0x3e')]=_0x581c54['attributes'][_0xc176('0x40')]?_0x581c54['attributes']:_0x57d51f[_0xc176('0x34')];_0x581c54[_0xc176('0x43')]=qs[_0xc176('0x44')](_0x4eecb0[_0xc176('0x39')]['sort']);_0x581c54[_0xc176('0x45')]=qs[_0xc176('0x3c')](_[_0xc176('0xa5')](_0x4eecb0[_0xc176('0x39')],_0x57d51f['filters']));if(_0x4eecb0[_0xc176('0x39')][_0xc176('0x49')]){_0x581c54[_0xc176('0x45')]=_[_0xc176('0x48')](_0x581c54[_0xc176('0x45')],{'$or':_['map'](_0x581c54[_0xc176('0x3e')],function(_0x1cbc0d){var _0x1add54={};_0x1add54[_0x1cbc0d]={'$like':'%'+_0x4eecb0[_0xc176('0x39')][_0xc176('0x49')]+'%'};return _0x1add54;})});}_0x581c54=_['merge']({},_0x581c54,_0x4eecb0[_0xc176('0x4e')]);return _0x49ee23[_0xc176('0xb6')](_0x581c54);}})[_0xc176('0x19')](function(_0x4d105e){if(_0x4d105e){_0x204581=_0x4d105e[_0xc176('0x40')];if(!_0x4eecb0['query'][_0xc176('0x41')](_0xc176('0x42'))){_0x581c54[_0xc176('0x28')]=qs[_0xc176('0x28')](_0x4eecb0[_0xc176('0x39')][_0xc176('0x28')]);_0x581c54['offset']=qs[_0xc176('0x27')](_0x4eecb0[_0xc176('0x39')][_0xc176('0x27')]);}return _0x49ee23[_0xc176('0xb6')](_0x581c54);}})[_0xc176('0x19')](function(_0x4464c2){if(_0x4464c2){return _0x4464c2?{'count':_0x204581,'rows':_0x4464c2}:null;}})['then'](respondWithResult(_0x5ae468,null))[_0xc176('0x52')](handleError(_0x5ae468,null));};exports['login']=function(_0x7711ac,_0xf47b1a,_0x1f1373){var _0x1597c9;var _0x2eb187;var _0x50b72f;return db[_0xc176('0x32')][_0xc176('0x56')]({'where':{'id':_0x7711ac['params']['id'],'role':'agent'},'attributes':['id',_0xc176('0x30'),'phone','mobile','role',_0xc176('0x68'),_0xc176('0x88')]})[_0xc176('0x19')](handleEntityNotFound(_0xf47b1a,null))[_0xc176('0x19')](function(_0x461ec8){if(_0x461ec8){_0x1597c9=_0x461ec8;_0x50b72f=_0x7711ac['body'][_0xc176('0xb7')]&&_0x1597c9[_0x7711ac[_0xc176('0x58')][_0xc176('0xb7')]]?util[_0xc176('0x65')](_0xc176('0xb8'),_0x1597c9[_0x7711ac[_0xc176('0x58')][_0xc176('0xb7')]]):util[_0xc176('0x65')]('SIP/%s',_0x1597c9[_0xc176('0x30')]);socket['to'](util[_0xc176('0x65')](_0xc176('0xb9'),_0x1597c9[_0xc176('0x30')]))[_0xc176('0xba')](_0xc176('0xbb'),{'ip':_0x7711ac[_0xc176('0xbc')][_0xc176('0xbd')]||_0x7711ac[_0xc176('0xbe')][_0xc176('0xbf')]||_0x7711ac[_0xc176('0xc0')][_0xc176('0xbf')]||_0x7711ac[_0xc176('0xbe')][_0xc176('0xc0')][_0xc176('0xbf')]});return db['UserVoiceQueueRt'][_0xc176('0x2d')]({'where':{'membername':_0x1597c9[_0xc176('0x30')]},'individualHooks':!![]});}})[_0xc176('0x19')](function(_0x381a42){if(_0x1597c9){return _0x1597c9[_0xc176('0xc1')]({'raw':!![]});}})['then'](function(_0x5a2748){var _0x33ef09=[];if(_0x5a2748){_0x2eb187=_0x5a2748;if(_0x2eb187[_0xc176('0x40')]){for(var _0x387ade=0x0;_0x387ade<_0x2eb187[_0xc176('0x40')];_0x387ade++){_0x33ef09[_0xc176('0xc2')]({'membername':_0x1597c9[_0xc176('0x30')],'UserId':_0x1597c9['id'],'queue_name':_0x2eb187[_0x387ade][_0xc176('0x30')],'VoiceQueueId':_0x2eb187[_0x387ade]['id'],'interface':_0x50b72f||util[_0xc176('0x65')]('%s/%s',_0xc176('0xc3'),_0x1597c9[_0xc176('0x30')]),'paused':_0x1597c9['loginInPause']||![],'penalty':_0x2eb187[_0x387ade][_0xc176('0xc4')]||0x0});}return BPromise['each'](_0x33ef09,function(_0x9ff03f){return db[_0xc176('0x95')][_0xc176('0xc5')](_0x9ff03f);});}}})[_0xc176('0x19')](function(){return db[_0xc176('0xc6')][_0xc176('0x50')]({'where':{'membername':_0x1597c9[_0xc176('0x30')],'interface':util['format']('%s/%s',_0xc176('0xc3'),_0x1597c9[_0xc176('0x30')]),'exitAt':null}});})[_0xc176('0x19')](function(_0x3ebcf5){var _0x1c7f61=[];_0x3ebcf5['forEach'](function(_0x5da32e){_0x1c7f61[_0xc176('0xc2')](_0x5da32e['update']({'exitAt':moment()[_0xc176('0x65')](_0xc176('0xc7'))}));});return BPromise[_0xc176('0xc8')](_0x1c7f61);})['then'](function(){var _0x5c819e=[];var _0xa83288=[];var _0x575658=utils['getChannels']();var _0x27cc11={'membername':_0x1597c9[_0xc176('0x30')],'interface':util['format'](_0xc176('0x93'),_0xc176('0xc3'),_0x1597c9['name']),'enterAt':moment()[_0xc176('0x65')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x1597c9['role'],'internal':_0x1597c9[_0xc176('0x68')]};_0x575658['forEach'](function(_0x2406fd){_0x5c819e[_0xc176('0xc2')](_[_0xc176('0x48')]({'channel':_0x2406fd,'type':_0xc176('0xc9'),'data1':_0x7711ac['body']['device'],'data2':_0x50b72f},_0x27cc11));if(_0x1597c9[_0xc176('0x88')]){_0xa83288[_0xc176('0xc2')](_[_0xc176('0x48')]({'channel':_0x2406fd,'type':_0xc176('0xca'),'data1':_0xc176('0xcb')},_0x27cc11));}});return db[_0xc176('0xc6')][_0xc176('0x57')](_0x5c819e[_0xc176('0xcc')](_0xa83288),{'individualHooks':!![]});})[_0xc176('0x19')](function(){return _0x1597c9[_0xc176('0x2c')]({'online':!![],'lastLoginAt':moment()[_0xc176('0x65')](_0xc176('0xc7')),'voicePause':_0x1597c9[_0xc176('0x88')]||![],'mailPause':_0x1597c9[_0xc176('0x88')]||![],'chatPause':_0x1597c9[_0xc176('0x88')]||![],'faxPause':_0x1597c9[_0xc176('0x88')]||![],'smsPause':_0x1597c9[_0xc176('0x88')]||![],'openchannelPause':_0x1597c9[_0xc176('0x88')]||![],'pauseType':_0x1597c9[_0xc176('0x88')]?_0xc176('0xcb'):null,'lastPauseAt':moment()[_0xc176('0x65')](_0xc176('0xc7'))});})['then'](respondWithResult(_0xf47b1a,null))[_0xc176('0x52')](handleError(_0xf47b1a,null));};exports[_0xc176('0xcd')]=function(_0xe89266,_0x47bf07,_0x294b3b){var _0x2e5fba;return db[_0xc176('0x32')][_0xc176('0x56')]({'where':{'id':_0xe89266[_0xc176('0x54')]['id'],'role':_0xc176('0x92')},'attributes':['id',_0xc176('0x30'),'role']})['then'](handleEntityNotFound(_0x47bf07,null))['then'](function(_0x152a1a){if(_0x152a1a){_0x2e5fba=_0x152a1a;return db[_0xc176('0x95')][_0xc176('0x2d')]({'where':{'membername':_0x2e5fba['name']},'individualHooks':!![]});}})[_0xc176('0x19')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x2e5fba['name'],'interface':util[_0xc176('0x65')](_0xc176('0x93'),_0xc176('0xc3'),_0x2e5fba[_0xc176('0x30')]),'exitAt':null}});})[_0xc176('0x19')](function(_0x18acd0){var _0x2ed8dc=[];_0x18acd0[_0xc176('0xce')](function(_0x5c1f50){_0x2ed8dc[_0xc176('0xc2')](_0x5c1f50['update']({'exitAt':moment()[_0xc176('0x65')](_0xc176('0xc7'))}));});return BPromise[_0xc176('0xc8')](_0x2ed8dc);})[_0xc176('0x19')](function(){return _0x2e5fba['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});})[_0xc176('0x19')](respondWithResult(_0x47bf07,null))['catch'](handleError(_0x47bf07,null));};exports[_0xc176('0xcf')]=function(_0x253a4d,_0x171f3b,_0x101156){var _0x1a69c1;return db[_0xc176('0x95')][_0xc176('0x2c')]({'paused':0x1},{'where':{'UserId':_0x253a4d[_0xc176('0x54')]['id']},'individualHooks':!![]})[_0xc176('0x19')](function(){return db[_0xc176('0x32')][_0xc176('0x56')]({'where':{'id':_0x253a4d['params']['id'],'role':_0xc176('0x92')},'attributes':['id','name',_0xc176('0x5c'),'internal']});})[_0xc176('0x19')](handleEntityNotFound(_0x171f3b,null))[_0xc176('0x19')](function(_0x39d627){if(_0x39d627){_0x1a69c1=_0x39d627;return respondWithRpcPromise(_0xc176('0xd0'),'pause',{'id':_0x1a69c1['id'],'name':_0x1a69c1[_0xc176('0x30')],'pause':!![]});}})['then'](function(){if(_0x1a69c1){return db[_0xc176('0xc6')][_0xc176('0x50')]({'where':{'membername':_0x1a69c1[_0xc176('0x30')],'interface':util['format'](_0xc176('0x93'),_0xc176('0xc3'),_0x1a69c1[_0xc176('0x30')]),'type':'PAUSE','exitAt':null}});}})[_0xc176('0x19')](function(_0x1138cd){if(_0x1138cd['length']){var _0x1d4284=moment()[_0xc176('0x65')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0xef4630=0x0,_0x35bfc0=_0x1138cd[_0xc176('0x40')];_0xef4630<_0x35bfc0;_0xef4630++){_0x1138cd[_0xef4630][_0xc176('0xd1')]({'exitAt':_0x1d4284});}}})[_0xc176('0x19')](function(){var _0x10cf5e=[];var _0x32410b=utils[_0xc176('0xd2')]();_0x32410b[_0xc176('0xce')](function(_0x26fc7f){_0x10cf5e[_0xc176('0xc2')]({'channel':_0x26fc7f,'membername':_0x1a69c1[_0xc176('0x30')],'interface':util['format'](_0xc176('0x93'),_0xc176('0xc3'),_0x1a69c1[_0xc176('0x30')]),'type':'PAUSE','enterAt':moment()[_0xc176('0x65')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x253a4d[_0xc176('0x58')][_0xc176('0xd3')]||_0xc176('0xd4'),'role':_0x1a69c1['role'],'internal':_0x1a69c1[_0xc176('0x68')]});});return db[_0xc176('0xc6')][_0xc176('0x57')](_0x10cf5e,{'individualHooks':!![]});})[_0xc176('0x19')](function(){return _0x1a69c1[_0xc176('0x2c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x253a4d['body'][_0xc176('0xd3')]||_0xc176('0xd4'),'lastPauseAt':moment()[_0xc176('0x65')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xc176('0x19')](respondWithResult(_0x171f3b,null))[_0xc176('0x52')](handleError(_0x171f3b,null));};exports[_0xc176('0xd5')]=function(_0x40a090,_0x48646,_0x4a1b16){var _0x33f18b;return db['User'][_0xc176('0x56')]({'where':{'id':_0x40a090[_0xc176('0x54')]['id']},'attributes':['id',_0xc176('0x30'),'role',_0xc176('0x89'),'mailPause','chatPause',_0xc176('0xd6'),'openchannelPause',_0xc176('0xd7'),_0xc176('0xd8'),_0xc176('0xd9')]})[_0xc176('0x19')](handleEntityNotFound(_0x48646,null))[_0xc176('0x19')](function(_0x446d0e){if(_0x446d0e){_0x33f18b=_0x446d0e;if(_0x40a090[_0xc176('0x58')][_0xc176('0x8c')]&&!utils[_0xc176('0x8a')](_0x40a090[_0xc176('0x58')][_0xc176('0x8c')])){throw new db[(_0xc176('0x84'))][(_0xc176('0x83'))](_0xc176('0x97'));}switch(_0x40a090[_0xc176('0x58')]['channel']){case _0xc176('0x90'):return respondWithRpcPromise(_0xc176('0xd0'),_0xc176('0xd5'),{'id':_0x33f18b['id'],'name':_0x33f18b['name'],'pause':![]})[_0xc176('0x19')](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x33f18b['id']},'individualHooks':!![]});})[_0xc176('0x19')](function(){return db[_0xc176('0xc6')][_0xc176('0x56')]({'where':{'channel':_0x40a090[_0xc176('0x58')][_0xc176('0x8c')],'membername':_0x33f18b[_0xc176('0x30')],'interface':util[_0xc176('0x65')](_0xc176('0x93'),'SIP',_0x33f18b[_0xc176('0x30')]),'type':_0xc176('0xca'),'exitAt':null}});})[_0xc176('0x19')](function(_0x23eb1e){if(_0x23eb1e){return _0x23eb1e[_0xc176('0x2c')]({'exitAt':moment()['format'](_0xc176('0xc7')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xc176('0x19')](function(){return _0x33f18b[_0xc176('0x2c')]({'voicePause':![]});});case _0xc176('0xda'):case _0xc176('0xdb'):case _0xc176('0xdc'):case'sms':case'openchannel':return db['MemberReport'][_0xc176('0x56')]({'where':{'channel':_0x40a090[_0xc176('0x58')][_0xc176('0x8c')],'membername':_0x33f18b[_0xc176('0x30')],'interface':util[_0xc176('0x65')]('%s/%s',_0xc176('0xc3'),_0x33f18b['name']),'type':'PAUSE','exitAt':null}})[_0xc176('0x19')](function(_0x502827){if(_0x502827){return _0x502827[_0xc176('0x2c')]({'exitAt':moment()['format'](_0xc176('0xc7')),'data2':_0xc176('0xdd')},{'individualHooks':!![]});}return null;})[_0xc176('0x19')](function(){var _0x3ac5c0={};_[_0xc176('0xde')](_0x3ac5c0,util[_0xc176('0x65')](_0xc176('0xdf'),_0x40a090[_0xc176('0x58')][_0xc176('0x8c')],_0xc176('0xe0')),![]);return _0x33f18b['update'](_0x3ac5c0);});default:return respondWithRpcPromise(_0xc176('0xd0'),_0xc176('0xd5'),{'id':_0x33f18b['id'],'name':_0x33f18b[_0xc176('0x30')],'pause':![]})[_0xc176('0x19')](function(){return db[_0xc176('0x95')]['update']({'paused':0x0},{'where':{'UserId':_0x33f18b['id']}});})[_0xc176('0x19')](function(){return db['MemberReport'][_0xc176('0x50')]({'where':{'membername':_0x33f18b[_0xc176('0x30')],'interface':util[_0xc176('0x65')](_0xc176('0x93'),_0xc176('0xc3'),_0x33f18b[_0xc176('0x30')]),'type':_0xc176('0xca'),'exitAt':null}});})[_0xc176('0x19')](function(_0x2aaf6f){var _0xa52c9a=[];_0x2aaf6f['forEach'](function(_0x3a229a){_0xa52c9a['push'](_0x3a229a[_0xc176('0x2c')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'}));});return BPromise[_0xc176('0xc8')](_0xa52c9a);})[_0xc176('0x19')](function(){return _0x33f18b[_0xc176('0x2c')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xc176('0x19')](respondWithResult(_0x48646,null))[_0xc176('0x52')](handleError(_0x48646,null));};exports['getTeams']=function(_0x5b61ad,_0x4eb245,_0x5a8fcf){var _0x4af289={};var _0x25aabc={};var _0x622335;var _0xc4af4d;return db[_0xc176('0x32')][_0xc176('0xa6')]({'where':{'id':_0x5b61ad[_0xc176('0x54')]['id']}})[_0xc176('0x19')](handleEntityNotFound(_0x4eb245,null))[_0xc176('0x19')](function(_0x8329dd){if(_0x8329dd){_0x622335=_0x8329dd;_0x25aabc[_0xc176('0x34')]=_[_0xc176('0x36')](db[_0xc176('0xe1')]['rawAttributes']);_0x25aabc[_0xc176('0x39')]=_[_0xc176('0x36')](_0x5b61ad[_0xc176('0x39')]);_0x25aabc['filters']=_['intersection'](_0x25aabc[_0xc176('0x34')],_0x25aabc['query']);_0x4af289[_0xc176('0x3e')]=_[_0xc176('0x3d')](_0x25aabc[_0xc176('0x34')],qs['fields'](_0x5b61ad[_0xc176('0x39')]['fields']));_0x4af289[_0xc176('0x3e')]=_0x4af289[_0xc176('0x3e')]['length']?_0x4af289[_0xc176('0x3e')]:_0x25aabc['model'];_0x4af289[_0xc176('0x43')]=qs[_0xc176('0x44')](_0x5b61ad[_0xc176('0x39')]['sort']);_0x4af289[_0xc176('0x45')]=qs[_0xc176('0x3c')](_['pick'](_0x5b61ad[_0xc176('0x39')],_0x25aabc[_0xc176('0x3c')]));if(_0x5b61ad[_0xc176('0x39')]['filter']){_0x4af289[_0xc176('0x45')]=_[_0xc176('0x48')](_0x4af289[_0xc176('0x45')],{'$or':_[_0xc176('0x4a')](_0x4af289['attributes'],function(_0x76f85f){var _0x346b99={};_0x346b99[_0x76f85f]={'$like':'%'+_0x5b61ad['query'][_0xc176('0x49')]+'%'};return _0x346b99;})});}_0x4af289=_[_0xc176('0x48')]({},_0x4af289,_0x5b61ad[_0xc176('0x4e')]);return _0x622335[_0xc176('0xe2')](_0x4af289);}})['then'](function(_0x590227){if(_0x590227){_0xc4af4d=_0x590227['length'];if(!_0x5b61ad[_0xc176('0x39')]['hasOwnProperty'](_0xc176('0x42'))){_0x4af289['limit']=qs[_0xc176('0x28')](_0x5b61ad[_0xc176('0x39')][_0xc176('0x28')]);_0x4af289[_0xc176('0x27')]=qs[_0xc176('0x27')](_0x5b61ad['query'][_0xc176('0x27')]);}return _0x622335['getTeams'](_0x4af289);}})['then'](function(_0xd32c30){if(_0xd32c30){return _0xd32c30?{'count':_0xc4af4d,'rows':_0xd32c30}:null;}})[_0xc176('0x19')](respondWithResult(_0x4eb245,null))[_0xc176('0x52')](handleError(_0x4eb245,null));};exports[_0xc176('0xe3')]=function(_0x127466,_0x399bd6,_0x15d7e2){return db['User'][_0xc176('0x56')]({'where':{'id':_0x127466[_0xc176('0x54')]['id']}})[_0xc176('0x19')](handleEntityNotFound(_0x399bd6,null))['then'](function(_0x44b3c9){if(_0x44b3c9){return _0x44b3c9[_0xc176('0xe3')](_0x127466['body'][_0xc176('0x5b')],_[_0xc176('0xe4')](_0x127466[_0xc176('0x58')],[_0xc176('0x5b'),'id'])||{});}})[_0xc176('0x19')](respondWithResult(_0x399bd6,null))['catch'](handleError(_0x399bd6,null));};exports[_0xc176('0xe5')]=function(_0x1d85e0,_0x5915e4,_0x4d3646){var _0x5cb45f;return db[_0xc176('0x32')][_0xc176('0x56')]({'where':{'id':_0x1d85e0[_0xc176('0x54')]['id']}})[_0xc176('0x19')](handleEntityNotFound(_0x5915e4,null))[_0xc176('0x19')](function(_0x94431a){if(_0x94431a){return _0x94431a[_0xc176('0xe5')](_0x1d85e0[_0xc176('0x39')][_0xc176('0x5b')]);}})[_0xc176('0x19')](respondWithStatusCode(_0x5915e4,null))[_0xc176('0x52')](handleError(_0x5915e4,null));};exports[_0xc176('0xe6')]=function(_0x4b1313,_0x4fc051,_0x46b080){var _0x480ea3={};var _0x289eb3={};var _0x5abc36;var _0x48fd0e;return db[_0xc176('0x32')][_0xc176('0xa6')]({'where':{'id':_0x4b1313[_0xc176('0x54')]['id']}})[_0xc176('0x19')](handleEntityNotFound(_0x4fc051,null))[_0xc176('0x19')](function(_0x58215c){if(_0x58215c){_0x5abc36=_0x58215c;_0x289eb3[_0xc176('0x34')]=_[_0xc176('0x36')](db[_0xc176('0xe7')][_0xc176('0x33')]);_0x289eb3[_0xc176('0x39')]=_['keys'](_0x4b1313['query']);_0x289eb3[_0xc176('0x3c')]=_['intersection'](_0x289eb3[_0xc176('0x34')],_0x289eb3[_0xc176('0x39')]);_0x480ea3['attributes']=_['intersection'](_0x289eb3['model'],qs[_0xc176('0x3f')](_0x4b1313[_0xc176('0x39')][_0xc176('0x3f')]));_0x480ea3['attributes']=_0x480ea3[_0xc176('0x3e')]['length']?_0x480ea3[_0xc176('0x3e')]:_0x289eb3['model'];_0x480ea3[_0xc176('0x43')]=qs[_0xc176('0x44')](_0x4b1313[_0xc176('0x39')][_0xc176('0x44')]);_0x480ea3[_0xc176('0x45')]=qs[_0xc176('0x3c')](_[_0xc176('0xa5')](_0x4b1313[_0xc176('0x39')],_0x289eb3['filters']));if(_0x4b1313['query'][_0xc176('0x49')]){_0x480ea3[_0xc176('0x45')]=_['merge'](_0x480ea3['where'],{'$or':_[_0xc176('0x4a')](_0x480ea3[_0xc176('0x3e')],function(_0x110523){var _0x13604f={};_0x13604f[_0x110523]={'$like':'%'+_0x4b1313[_0xc176('0x39')]['filter']+'%'};return _0x13604f;})});}_0x480ea3=_[_0xc176('0x48')]({},_0x480ea3,_0x4b1313[_0xc176('0x4e')]);return _0x5abc36['getLists'](_0x480ea3);}})[_0xc176('0x19')](function(_0x3e4128){if(_0x3e4128){_0x48fd0e=_0x3e4128[_0xc176('0x40')];if(!_0x4b1313['query'][_0xc176('0x41')](_0xc176('0x42'))){_0x480ea3[_0xc176('0x28')]=qs['limit'](_0x4b1313['query'][_0xc176('0x28')]);_0x480ea3[_0xc176('0x27')]=qs[_0xc176('0x27')](_0x4b1313[_0xc176('0x39')]['offset']);}return _0x5abc36[_0xc176('0xe6')](_0x480ea3);}})[_0xc176('0x19')](function(_0x3c6040){if(_0x3c6040){return _0x3c6040?{'count':_0x48fd0e,'rows':_0x3c6040}:null;}})[_0xc176('0x19')](respondWithResult(_0x4fc051,null))['catch'](handleError(_0x4fc051,null));};exports[_0xc176('0xe8')]=function(_0x9c7fe1,_0x2cd112,_0x2e273f){var _0x501167={};var _0x2b2e8d={};var _0x1c12c5;var _0x29c5eb;return db[_0xc176('0x32')][_0xc176('0xa6')]({'where':{'id':_0x9c7fe1[_0xc176('0x54')]['id']}})[_0xc176('0x19')](handleEntityNotFound(_0x2cd112,null))['then'](function(_0x3fcb61){if(_0x3fcb61){_0x1c12c5=_0x3fcb61;_0x2b2e8d[_0xc176('0x34')]=_[_0xc176('0x36')](db[_0xc176('0x32')]['rawAttributes']);_0x2b2e8d[_0xc176('0x39')]=_['keys'](_0x9c7fe1[_0xc176('0x39')]);_0x2b2e8d['filters']=_[_0xc176('0x3d')](_0x2b2e8d['model'],_0x2b2e8d[_0xc176('0x39')]);_0x501167['attributes']=_[_0xc176('0x3d')](_0x2b2e8d[_0xc176('0x34')],qs['fields'](_0x9c7fe1[_0xc176('0x39')][_0xc176('0x3f')]));_0x501167[_0xc176('0x3e')]=_0x501167[_0xc176('0x3e')][_0xc176('0x40')]?_0x501167[_0xc176('0x3e')]:_0x2b2e8d[_0xc176('0x34')];_0x501167[_0xc176('0x43')]=qs[_0xc176('0x44')](_0x9c7fe1[_0xc176('0x39')][_0xc176('0x44')]);_0x501167[_0xc176('0x45')]=qs[_0xc176('0x3c')](_[_0xc176('0xa5')](_0x9c7fe1[_0xc176('0x39')],_0x2b2e8d[_0xc176('0x3c')]));if(_0x9c7fe1[_0xc176('0x39')][_0xc176('0x49')]){_0x501167[_0xc176('0x45')]=_[_0xc176('0x48')](_0x501167[_0xc176('0x45')],{'$or':_[_0xc176('0x4a')](_0x501167[_0xc176('0x3e')],function(_0x291416){var _0x16ccd9={};_0x16ccd9[_0x291416]={'$like':'%'+_0x9c7fe1[_0xc176('0x39')]['filter']+'%'};return _0x16ccd9;})});}_0x501167[_0xc176('0x34')]=db['User'];_0x501167['as']=_0xc176('0xe9');_0x501167=_['merge']({},_0x501167,_0x9c7fe1['options']);return _0x1c12c5[_0xc176('0xc1')]({'include':[_0x501167]});}})[_0xc176('0x19')](function(_0x1ca5fa){if(_0x1ca5fa){var _0x3bd1dd={},_0x2ec275=[],_0x5e2e70=0x0;for(var _0x31e8d9=0x0;_0x31e8d9<_0x1ca5fa[_0xc176('0x40')];_0x31e8d9+=0x1){for(var _0x13af83=0x0,_0x1f7b49;_0x13af83<_0x1ca5fa[_0x31e8d9][_0xc176('0xe9')][_0xc176('0x40')];_0x13af83+=0x1){_0x1f7b49=_0x1ca5fa[_0x31e8d9][_0xc176('0xe9')][_0x13af83]['get']({'plain':!![]});_0x3bd1dd[_0x1f7b49['id']]=_0x1f7b49;}}_0x3bd1dd=_['values'](_0x3bd1dd);for(var _0x8eb840=qs[_0xc176('0x27')](_0x9c7fe1[_0xc176('0x39')][_0xc176('0x27')]);_0x8eb840<_0x3bd1dd[_0xc176('0x40')]&&_0x2ec275[_0xc176('0x40')]=_0x4faf25[_0xe6ef('0x4d')]){throw new Error(_0xe6ef('0x4e'));}})['then'](function(){if(_0x2e0356){return db[_0xe6ef('0x2a')]['destroy']({'where':{'membername':_0x2e0356['name']},'individualHooks':!![]});}})[_0xe6ef('0x22')](function(){if(_0x2e0356){return _0x2e0356[_0xe6ef('0x4f')]({'raw':!![]});}})[_0xe6ef('0x22')](function(_0x5985de){if(_0x2e0356){if(_0x5985de){var _0x45f914=[];_0x3f36cb=_0x5985de;if(_0x3f36cb['length']){for(var _0x113953=0x0;_0x113953<_0x3f36cb[_0xe6ef('0x30')];_0x113953++){_0x45f914['push'](db[_0xe6ef('0x2a')][_0xe6ef('0x50')]({'membername':_0x2e0356['name'],'UserId':_0x2e0356['id'],'queue_name':_0x3f36cb[_0x113953][_0xe6ef('0x27')],'VoiceQueueId':_0x3f36cb[_0x113953]['id'],'interface':_0x212533[_0xe6ef('0x35')][_0xe6ef('0x51')]||util[_0xe6ef('0x2c')](_0xe6ef('0x2d'),_0xe6ef('0x2e'),_0x2e0356[_0xe6ef('0x27')]),'paused':_0x2e0356['loginInPause']||![],'penalty':_0x3f36cb[_0x113953][_0xe6ef('0x52')]||0x0}));}return BPromise[_0xe6ef('0x46')](_0x45f914);}}}})[_0xe6ef('0x22')](function(){if(_0x2e0356){return db[_0xe6ef('0x3f')][_0xe6ef('0x1a')]({'where':{'membername':_0x2e0356['name'],'interface':util['format'](_0xe6ef('0x2d'),_0xe6ef('0x2e'),_0x2e0356[_0xe6ef('0x27')]),'exitAt':null}});}})[_0xe6ef('0x22')](function(_0x1225e6){if(_0x2e0356){if(_0x1225e6&&_0x1225e6['length']){var _0x1e9bce=[];_0x1225e6['forEach'](function(_0x47bdca){_0x1e9bce[_0xe6ef('0x33')](_0x47bdca[_0xe6ef('0x2b')]({'exitAt':moment()[_0xe6ef('0x2c')](_0xe6ef('0x34'))}));});return BPromise[_0xe6ef('0x46')](_0x1e9bce);}}})['then'](function(_0x252e0f){if(_0x2e0356){var _0x5ca0eb=[];var _0x270899=[];var _0x70404c=utils[_0xe6ef('0x31')]();var _0x267b0f={'membername':_0x2e0356['name'],'interface':util[_0xe6ef('0x2c')]('%s/%s',_0xe6ef('0x2e'),_0x2e0356[_0xe6ef('0x27')]),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2e0356[_0xe6ef('0x28')],'internal':_0x2e0356[_0xe6ef('0x29')]};_0x70404c['forEach'](function(_0x19fedb){_0x5ca0eb['push'](_[_0xe6ef('0x53')]({'channel':_0x19fedb,'type':_0xe6ef('0x54'),'data1':_0xe6ef('0x55'),'data2':_0x212533['body'][_0xe6ef('0x51')]||util['format']('%s/%s','SIP',_0x2e0356['name'])},_0x267b0f));if(_0x2e0356[_0xe6ef('0x56')]){_0x270899[_0xe6ef('0x33')](_[_0xe6ef('0x53')]({'channel':_0x19fedb,'type':'PAUSE','data1':'LOGININPAUSE'},_0x267b0f));}});return db[_0xe6ef('0x3f')][_0xe6ef('0x57')](_0x5ca0eb[_0xe6ef('0x58')](_0x270899),{'individualHooks':!![]});}})[_0xe6ef('0x22')](function(){if(_0x2e0356){return _0x2e0356[_0xe6ef('0x2b')]({'online':!![],'lastLoginAt':moment()[_0xe6ef('0x2c')](_0xe6ef('0x34')),'voicePause':_0x2e0356[_0xe6ef('0x56')]||![],'mailPause':_0x2e0356['loginInPause']||![],'chatPause':_0x2e0356[_0xe6ef('0x56')]||![],'faxPause':_0x2e0356[_0xe6ef('0x56')]||![],'smsPause':_0x2e0356[_0xe6ef('0x56')]||![],'openchannelPause':_0x2e0356[_0xe6ef('0x56')]||![],'pauseType':_0x2e0356['loginInPause']?_0xe6ef('0x59'):null,'lastPauseAt':moment()[_0xe6ef('0x2c')](_0xe6ef('0x34'))});}})[_0xe6ef('0x22')](function(_0x5e4b44){_0x3af171(_0x5e4b44);})['catch'](function(_0x191e5f){_0x5e3683(_0x57a3ee['error'](0x1f4,_0x191e5f[_0xe6ef('0x15')]));});});}; \ No newline at end of file +var _0x6faf=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','socket.io-emitter','localhost','./user.socket','register','then','info','User,\x20%s,\x20%s','debug','request\x20sent','code','error','message','result','GetUser','User','findAll','options','raw','where','attributes','include','map','model','catch','find','ShowUser','stringify','name','role','internal','UserVoiceQueueRt','format','%s/%s','SIP','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','push','body','type','uniqueid','MemberReport','bulkCreate','update','DEFAULT\x20PAUSE','channel','Unknown\x20channel','voice','mail','fax','openchannel','system','%s%s','Pause','all','destroy','LoginUser','findOne','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','loginInPause','UserVoiceQueue.penalty','merge','LOGIN','interface','LOGININPAUSE','concat'];(function(_0x25c3ab,_0x54619b){var _0x5d8458=function(_0x3aff53){while(--_0x3aff53){_0x25c3ab['push'](_0x25c3ab['shift']());}};_0x5d8458(++_0x54619b);}(_0x6faf,0xf9));var _0xf6fa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6faf[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xf6fa('0x0'));var moment=require(_0xf6fa('0x1'));var BPromise=require(_0xf6fa('0x2'));var rs=require(_0xf6fa('0x3'));var fs=require('fs');var db=require(_0xf6fa('0x4'))['db'];var utils=require(_0xf6fa('0x5'));var logger=require('../../config/logger')(_0xf6fa('0x6'));var config=require('../../config/environment');var jayson=require(_0xf6fa('0x7'));var client=jayson['client'][_0xf6fa('0x8')]({'port':0x232a});var socket=require(_0xf6fa('0x9'))({'host':_0xf6fa('0xa'),'port':0x18eb});require(_0xf6fa('0xb'))[_0xf6fa('0xc')](socket);function respondWithRpcPromise(_0x4e1b3c,_0x3f4d3f,_0x103616){return new BPromise(function(_0xb63b9e,_0x585633){return client['request'](_0x4e1b3c,_0x103616)[_0xf6fa('0xd')](function(_0x535fbc){logger[_0xf6fa('0xe')](_0xf6fa('0xf'),_0x3f4d3f,'request\x20sent');logger[_0xf6fa('0x10')]('User,\x20%s,\x20%s,\x20%s',_0x3f4d3f,_0xf6fa('0x11'),JSON['stringify'](_0x535fbc));if(_0x535fbc['error']){if(_0x535fbc['error'][_0xf6fa('0x12')]===0x1f4){logger[_0xf6fa('0x13')](_0xf6fa('0xf'),_0x3f4d3f,_0x535fbc[_0xf6fa('0x13')][_0xf6fa('0x14')]);return _0x585633(_0x535fbc[_0xf6fa('0x13')][_0xf6fa('0x14')]);}logger[_0xf6fa('0x13')](_0xf6fa('0xf'),_0x3f4d3f,_0x535fbc[_0xf6fa('0x13')][_0xf6fa('0x14')]);return _0xb63b9e(_0x535fbc['error'][_0xf6fa('0x14')]);}else{logger[_0xf6fa('0xe')]('User,\x20%s,\x20%s',_0x3f4d3f,_0xf6fa('0x11'));_0xb63b9e(_0x535fbc[_0xf6fa('0x15')][_0xf6fa('0x14')]);}})['catch'](function(_0x357261){logger[_0xf6fa('0x13')](_0xf6fa('0xf'),_0x3f4d3f,_0x357261);_0x585633(_0x357261);});});}exports[_0xf6fa('0x16')]=function(_0x3cb498){var _0x553daa=this;return new Promise(function(_0x3986e9,_0x58fc12){return db[_0xf6fa('0x17')][_0xf6fa('0x18')]({'raw':_0x3cb498[_0xf6fa('0x19')]?_0x3cb498['options'][_0xf6fa('0x1a')]===undefined?!![]:![]:!![],'where':_0x3cb498[_0xf6fa('0x19')]?_0x3cb498[_0xf6fa('0x19')][_0xf6fa('0x1b')]||null:null,'attributes':_0x3cb498[_0xf6fa('0x19')]?_0x3cb498[_0xf6fa('0x19')][_0xf6fa('0x1c')]||null:null,'limit':_0x3cb498[_0xf6fa('0x19')]?_0x3cb498['options']['limit']||null:null,'include':_0x3cb498[_0xf6fa('0x19')]?_0x3cb498['options'][_0xf6fa('0x1d')]?_['map'](_0x3cb498['options']['include'],function(_0x4bfc7b){return{'model':db[_0x4bfc7b['model']],'as':_0x4bfc7b['as'],'attributes':_0x4bfc7b[_0xf6fa('0x1c')],'include':_0x4bfc7b[_0xf6fa('0x1d')]?_[_0xf6fa('0x1e')](_0x4bfc7b[_0xf6fa('0x1d')],function(_0x2d38cb){return{'model':db[_0x2d38cb[_0xf6fa('0x1f')]],'as':_0x2d38cb['as'],'attributes':_0x2d38cb[_0xf6fa('0x1c')],'include':_0x2d38cb['include']?_[_0xf6fa('0x1e')](_0x2d38cb[_0xf6fa('0x1d')],function(_0x101103){return{'model':db[_0x101103['model']],'as':_0x101103['as'],'attributes':_0x101103[_0xf6fa('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf6fa('0xd')](function(_0x1d2090){logger[_0xf6fa('0xe')](_0xf6fa('0x16'),_0x3cb498);logger[_0xf6fa('0x10')](_0xf6fa('0x16'),_0x3cb498,JSON['stringify'](_0x1d2090));_0x3986e9(_0x1d2090);})[_0xf6fa('0x20')](function(_0xad99cb){logger[_0xf6fa('0x13')]('GetUser',_0xad99cb[_0xf6fa('0x14')],_0x3cb498);_0x58fc12(_0x553daa[_0xf6fa('0x13')](0x1f4,_0xad99cb[_0xf6fa('0x14')]));});});};exports['ShowUser']=function(_0x3a9ec2){var _0x133e39=this;return new Promise(function(_0x1e50b7,_0x598ee3){return db['User'][_0xf6fa('0x21')]({'raw':_0x3a9ec2[_0xf6fa('0x19')]?_0x3a9ec2[_0xf6fa('0x19')][_0xf6fa('0x1a')]===undefined?!![]:![]:!![],'where':_0x3a9ec2[_0xf6fa('0x19')]?_0x3a9ec2[_0xf6fa('0x19')][_0xf6fa('0x1b')]||null:null,'attributes':_0x3a9ec2[_0xf6fa('0x19')]?_0x3a9ec2[_0xf6fa('0x19')]['attributes']||null:null,'include':_0x3a9ec2[_0xf6fa('0x19')]?_0x3a9ec2[_0xf6fa('0x19')][_0xf6fa('0x1d')]?_['map'](_0x3a9ec2[_0xf6fa('0x19')][_0xf6fa('0x1d')],function(_0x4ae415){return{'model':db[_0x4ae415[_0xf6fa('0x1f')]],'as':_0x4ae415['as'],'attributes':_0x4ae415[_0xf6fa('0x1c')],'include':_0x4ae415[_0xf6fa('0x1d')]?_[_0xf6fa('0x1e')](_0x4ae415[_0xf6fa('0x1d')],function(_0x1dff32){return{'model':db[_0x1dff32[_0xf6fa('0x1f')]],'as':_0x1dff32['as'],'attributes':_0x1dff32['attributes'],'include':_0x1dff32[_0xf6fa('0x1d')]?_[_0xf6fa('0x1e')](_0x1dff32[_0xf6fa('0x1d')],function(_0x80b99f){return{'model':db[_0x80b99f[_0xf6fa('0x1f')]],'as':_0x80b99f['as'],'attributes':_0x80b99f[_0xf6fa('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf6fa('0xd')](function(_0x35fe46){logger[_0xf6fa('0xe')](_0xf6fa('0x22'),_0x3a9ec2);logger[_0xf6fa('0x10')](_0xf6fa('0x22'),_0x3a9ec2,JSON[_0xf6fa('0x23')](_0x35fe46));_0x1e50b7(_0x35fe46);})['catch'](function(_0x48bd2d){logger[_0xf6fa('0x13')]('ShowUser',_0x48bd2d['message'],_0x3a9ec2);_0x598ee3(_0x133e39['error'](0x1f4,_0x48bd2d[_0xf6fa('0x14')]));});});};exports['PauseUser']=function(_0x4df578){var _0x3fa969=this;return new Promise(function(_0x562f10,_0x4bbd8a){var _0x53127e;return db[_0xf6fa('0x17')][_0xf6fa('0x21')]({'where':_0x4df578[_0xf6fa('0x19')][_0xf6fa('0x1b')]||{},'attributes':['id',_0xf6fa('0x24'),_0xf6fa('0x25'),_0xf6fa('0x26')]})[_0xf6fa('0xd')](function(_0x39a4e1){if(_0x39a4e1){_0x53127e=_0x39a4e1;return db[_0xf6fa('0x27')]['update']({'paused':0x1},{'where':{'UserId':_0x53127e['id']},'individualHooks':!![]});}})[_0xf6fa('0xd')](function(){if(_0x53127e){return db['MemberReport']['findAll']({'where':{'membername':_0x53127e[_0xf6fa('0x24')],'interface':util[_0xf6fa('0x28')](_0xf6fa('0x29'),_0xf6fa('0x2a'),_0x53127e[_0xf6fa('0x24')]),'type':_0xf6fa('0x2b'),'exitAt':null}});}})[_0xf6fa('0xd')](function(_0x29151c){if(_0x53127e){if(_0x29151c&&_0x29151c[_0xf6fa('0x2c')]){var _0x5abb25=moment()[_0xf6fa('0x28')](_0xf6fa('0x2d'));for(var _0x3773f0=0x0,_0x5a9073=_0x29151c[_0xf6fa('0x2c')];_0x3773f0<_0x5a9073;_0x3773f0++){_0x29151c[_0x3773f0]['updateAttributes']({'exitAt':_0x5abb25});}}}})[_0xf6fa('0xd')](function(){if(_0x53127e){var _0x49be14=[];var _0x14ab00=utils[_0xf6fa('0x2e')]();_0x14ab00[_0xf6fa('0x2f')](function(_0x18ccdf){_0x49be14[_0xf6fa('0x30')]({'channel':_0x18ccdf,'membername':_0x53127e['name'],'interface':util[_0xf6fa('0x28')](_0xf6fa('0x29'),'SIP',_0x53127e[_0xf6fa('0x24')]),'type':_0xf6fa('0x2b'),'enterAt':moment()['format'](_0xf6fa('0x2d')),'data1':_0x4df578[_0xf6fa('0x31')][_0xf6fa('0x32')]||'DEFAULT\x20PAUSE','role':_0x53127e['role'],'internal':_0x53127e[_0xf6fa('0x26')],'uniqueid':_0x4df578[_0xf6fa('0x31')][_0xf6fa('0x33')]||null});});return db[_0xf6fa('0x34')][_0xf6fa('0x35')](_0x49be14,{'individualHooks':!![]});}})[_0xf6fa('0xd')](function(){if(_0x53127e){return _0x53127e[_0xf6fa('0x36')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x4df578['body'][_0xf6fa('0x32')]||_0xf6fa('0x37'),'lastPauseAt':moment()['format'](_0xf6fa('0x2d'))});}})[_0xf6fa('0xd')](function(_0xb0f608){_0x562f10(_0xb0f608);})[_0xf6fa('0x20')](function(_0xdfc714){_0x4bbd8a(_0x3fa969[_0xf6fa('0x13')](0x1f4,_0xdfc714['message']));});});};exports['UnpauseUser']=function(_0x1e4562){var _0x573407=this;return new Promise(function(_0x1d1961,_0x2d354c){var _0x5c4bd7;return db[_0xf6fa('0x17')]['findOne']({'where':_0x1e4562[_0xf6fa('0x19')][_0xf6fa('0x1b')]||{},'attributes':['id',_0xf6fa('0x24')]})[_0xf6fa('0xd')](function(_0xa58df7){if(_0xa58df7){_0x5c4bd7=_0xa58df7;if(_0x1e4562[_0xf6fa('0x31')][_0xf6fa('0x38')]&&!utils['isValidChannel'](_0x1e4562['body'][_0xf6fa('0x38')])){throw new Error(_0xf6fa('0x39'));}switch(_0x1e4562[_0xf6fa('0x31')][_0xf6fa('0x38')]){case _0xf6fa('0x3a'):return db[_0xf6fa('0x27')][_0xf6fa('0x36')]({'paused':0x0},{'where':{'UserId':_0x5c4bd7['id']}})['then'](function(){return db[_0xf6fa('0x34')][_0xf6fa('0x21')]({'where':{'channel':_0x1e4562['body'][_0xf6fa('0x38')],'membername':_0x5c4bd7[_0xf6fa('0x24')],'interface':util['format'](_0xf6fa('0x29'),_0xf6fa('0x2a'),_0x5c4bd7[_0xf6fa('0x24')]),'type':_0xf6fa('0x2b'),'exitAt':null}});})['then'](function(_0x5f00c7){if(_0x5f00c7){return _0x5f00c7['update']({'exitAt':moment()[_0xf6fa('0x28')](_0xf6fa('0x2d')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0xf6fa('0xd')](function(){return _0x5c4bd7['update']({'voicePause':![]});});case _0xf6fa('0x3b'):case'chat':case _0xf6fa('0x3c'):case'sms':case _0xf6fa('0x3d'):return db['MemberReport'][_0xf6fa('0x21')]({'where':{'channel':_0x1e4562[_0xf6fa('0x31')][_0xf6fa('0x38')],'membername':_0x5c4bd7[_0xf6fa('0x24')],'interface':util[_0xf6fa('0x28')]('%s/%s',_0xf6fa('0x2a'),_0x5c4bd7[_0xf6fa('0x24')]),'type':'PAUSE','exitAt':null}})[_0xf6fa('0xd')](function(_0x5eb9bc){return _0x5eb9bc[_0xf6fa('0x36')]({'exitAt':moment()[_0xf6fa('0x28')](_0xf6fa('0x2d')),'data2':_0xf6fa('0x3e')},{'individualHooks':!![]});})[_0xf6fa('0xd')](function(){var _0x10a246={};_['set'](_0x10a246,util['format'](_0xf6fa('0x3f'),_0x1e4562['body'][_0xf6fa('0x38')],_0xf6fa('0x40')),![]);return _0x5c4bd7[_0xf6fa('0x36')](_0x10a246);});default:return db['UserVoiceQueueRt'][_0xf6fa('0x36')]({'paused':0x0},{'where':{'UserId':_0x5c4bd7['id']}})[_0xf6fa('0xd')](function(){return db[_0xf6fa('0x34')][_0xf6fa('0x18')]({'where':{'membername':_0x5c4bd7[_0xf6fa('0x24')],'interface':util[_0xf6fa('0x28')]('%s/%s','SIP',_0x5c4bd7[_0xf6fa('0x24')]),'type':_0xf6fa('0x2b'),'exitAt':null}});})[_0xf6fa('0xd')](function(_0x39435a){var _0x579d0b=[];_0x39435a[_0xf6fa('0x2f')](function(_0x47da7){_0x579d0b['push'](_0x47da7[_0xf6fa('0x36')]({'exitAt':moment()[_0xf6fa('0x28')](_0xf6fa('0x2d')),'data2':_0xf6fa('0x3e')}));});return BPromise[_0xf6fa('0x41')](_0x579d0b);})[_0xf6fa('0xd')](function(){return _0x5c4bd7[_0xf6fa('0x36')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})['then'](function(_0x265e87){_0x1d1961(_0x265e87);})[_0xf6fa('0x20')](function(_0x55d7b1){_0x2d354c(_0x573407[_0xf6fa('0x13')](0x1f4,_0x55d7b1['message']));});});};exports['LogoutUser']=function(_0x54d037){var _0x531e51=this;return new Promise(function(_0x3d6c51,_0x1a1bc7){var _0x10f7eb;return db[_0xf6fa('0x17')]['findOne']({'where':_0x54d037[_0xf6fa('0x19')][_0xf6fa('0x1b')]||{},'attributes':['id',_0xf6fa('0x24')]})['then'](function(_0x4e260c){if(_0x4e260c){_0x10f7eb=_0x4e260c;return db[_0xf6fa('0x27')][_0xf6fa('0x42')]({'where':{'membername':_0x10f7eb['name']},'individualHooks':!![]});}})[_0xf6fa('0xd')](function(){if(_0x10f7eb){return db[_0xf6fa('0x34')][_0xf6fa('0x18')]({'where':{'membername':_0x10f7eb[_0xf6fa('0x24')],'interface':util[_0xf6fa('0x28')]('%s/%s',_0xf6fa('0x2a'),_0x10f7eb[_0xf6fa('0x24')]),'exitAt':null}});}})[_0xf6fa('0xd')](function(_0x1cebc9){if(_0x10f7eb){if(_0x1cebc9&&_0x1cebc9[_0xf6fa('0x2c')]){var _0x5b7664=[];_0x1cebc9['forEach'](function(_0x3faad1){_0x5b7664[_0xf6fa('0x30')](_0x3faad1[_0xf6fa('0x36')]({'exitAt':moment()[_0xf6fa('0x28')](_0xf6fa('0x2d'))}));});return BPromise[_0xf6fa('0x41')](_0x5b7664);}}})[_0xf6fa('0xd')](function(){if(_0x10f7eb){return _0x10f7eb[_0xf6fa('0x36')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xf6fa('0xd')](function(_0x1f3a9a){_0x3d6c51(_0x1f3a9a);})[_0xf6fa('0x20')](function(_0x852c00){_0x1a1bc7(_0x531e51[_0xf6fa('0x13')](0x1f4,_0x852c00[_0xf6fa('0x14')]));});});};exports[_0xf6fa('0x43')]=function(_0x437e28){var _0x2841ec=this;return new Promise(function(_0x593119,_0x54fcd8){var _0x4b6061;var _0xd31bc9;var _0xdbbf83;return db[_0xf6fa('0x17')][_0xf6fa('0x44')]({'where':_0x437e28[_0xf6fa('0x19')]['where']||{},'attributes':['id',_0xf6fa('0x24'),'role','internal','loginInPause']})[_0xf6fa('0xd')](function(_0x2e7238){if(_0x2e7238){_0x4b6061=_0x2e7238;return db[_0xf6fa('0x17')][_0xf6fa('0x45')]({'where':{'role':_0xf6fa('0x46'),'online':!![],'id':{'$ne':_0x4b6061['id']}}});}})[_0xf6fa('0xd')](function(_0x3eac53){if(_0x3eac53){_0xdbbf83=_0x3eac53;return require(_0xf6fa('0x47'))[_0xf6fa('0x48')]();}})[_0xf6fa('0xd')](function(_0x3c04b2){if(_0x3c04b2&&_0x3c04b2[_0xf6fa('0x49')]&&_0xdbbf83>=_0x3c04b2[_0xf6fa('0x49')]){throw new Error(_0xf6fa('0x4a'));}})[_0xf6fa('0xd')](function(){if(_0x4b6061){return db[_0xf6fa('0x27')]['destroy']({'where':{'membername':_0x4b6061[_0xf6fa('0x24')]},'individualHooks':!![]});}})[_0xf6fa('0xd')](function(){if(_0x4b6061){return _0x4b6061['getVoiceQueues']({'raw':!![]});}})[_0xf6fa('0xd')](function(_0x4b3ad){if(_0x4b6061){if(_0x4b3ad){var _0x40b703=[];_0xd31bc9=_0x4b3ad;if(_0xd31bc9[_0xf6fa('0x2c')]){for(var _0x20b822=0x0;_0x20b822<_0xd31bc9['length'];_0x20b822++){_0x40b703['push'](db[_0xf6fa('0x27')][_0xf6fa('0x4b')]({'membername':_0x4b6061[_0xf6fa('0x24')],'UserId':_0x4b6061['id'],'queue_name':_0xd31bc9[_0x20b822]['name'],'VoiceQueueId':_0xd31bc9[_0x20b822]['id'],'interface':_0x437e28[_0xf6fa('0x31')]['interface']||util['format'](_0xf6fa('0x29'),_0xf6fa('0x2a'),_0x4b6061[_0xf6fa('0x24')]),'paused':_0x4b6061[_0xf6fa('0x4c')]||![],'penalty':_0xd31bc9[_0x20b822][_0xf6fa('0x4d')]||0x0}));}return BPromise[_0xf6fa('0x41')](_0x40b703);}}}})[_0xf6fa('0xd')](function(){if(_0x4b6061){return db[_0xf6fa('0x34')][_0xf6fa('0x18')]({'where':{'membername':_0x4b6061[_0xf6fa('0x24')],'interface':util[_0xf6fa('0x28')](_0xf6fa('0x29'),_0xf6fa('0x2a'),_0x4b6061['name']),'exitAt':null}});}})[_0xf6fa('0xd')](function(_0x324999){if(_0x4b6061){if(_0x324999&&_0x324999[_0xf6fa('0x2c')]){var _0x568b1e=[];_0x324999['forEach'](function(_0x2141b3){_0x568b1e[_0xf6fa('0x30')](_0x2141b3['update']({'exitAt':moment()['format'](_0xf6fa('0x2d'))}));});return BPromise[_0xf6fa('0x41')](_0x568b1e);}}})[_0xf6fa('0xd')](function(_0x3277d9){if(_0x4b6061){var _0x3c0cba=[];var _0x17f1de=[];var _0x4dc03c=utils[_0xf6fa('0x2e')]();var _0x4a25fc={'membername':_0x4b6061[_0xf6fa('0x24')],'interface':util[_0xf6fa('0x28')](_0xf6fa('0x29'),'SIP',_0x4b6061[_0xf6fa('0x24')]),'enterAt':moment()['format'](_0xf6fa('0x2d')),'role':_0x4b6061[_0xf6fa('0x25')],'internal':_0x4b6061[_0xf6fa('0x26')]};_0x4dc03c[_0xf6fa('0x2f')](function(_0x125b97){_0x3c0cba['push'](_[_0xf6fa('0x4e')]({'channel':_0x125b97,'type':_0xf6fa('0x4f'),'data1':'callysquare','data2':_0x437e28[_0xf6fa('0x31')][_0xf6fa('0x50')]||util['format'](_0xf6fa('0x29'),_0xf6fa('0x2a'),_0x4b6061[_0xf6fa('0x24')])},_0x4a25fc));if(_0x4b6061[_0xf6fa('0x4c')]){_0x17f1de[_0xf6fa('0x30')](_['merge']({'channel':_0x125b97,'type':_0xf6fa('0x2b'),'data1':_0xf6fa('0x51')},_0x4a25fc));}});return db['MemberReport'][_0xf6fa('0x35')](_0x3c0cba[_0xf6fa('0x52')](_0x17f1de),{'individualHooks':!![]});}})[_0xf6fa('0xd')](function(){if(_0x4b6061){return _0x4b6061[_0xf6fa('0x36')]({'online':!![],'lastLoginAt':moment()[_0xf6fa('0x28')](_0xf6fa('0x2d')),'voicePause':_0x4b6061[_0xf6fa('0x4c')]||![],'mailPause':_0x4b6061['loginInPause']||![],'chatPause':_0x4b6061[_0xf6fa('0x4c')]||![],'faxPause':_0x4b6061[_0xf6fa('0x4c')]||![],'smsPause':_0x4b6061['loginInPause']||![],'openchannelPause':_0x4b6061[_0xf6fa('0x4c')]||![],'pauseType':_0x4b6061[_0xf6fa('0x4c')]?_0xf6fa('0x51'):null,'lastPauseAt':moment()[_0xf6fa('0x28')](_0xf6fa('0x2d'))});}})[_0xf6fa('0xd')](function(_0x416330){_0x593119(_0x416330);})[_0xf6fa('0x20')](function(_0x2ddd89){_0x54fcd8(_0x2841ec[_0xf6fa('0x13')](0x1f4,_0x2ddd89[_0xf6fa('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 7552e6a..a0b8f6c 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 _0xa533=['./user.events','remove','update','emit','removeListener','register','length','user:'];(function(_0x301ef5,_0x1ea20a){var _0x35ea95=function(_0x87020d){while(--_0x87020d){_0x301ef5['push'](_0x301ef5['shift']());}};_0x35ea95(++_0x1ea20a);}(_0xa533,0x90));var _0x3a53=function(_0x45174f,_0x22995d){_0x45174f=_0x45174f-0x0;var _0x2add9e=_0xa533[_0x45174f];return _0x2add9e;};'use strict';var UserEvents=require(_0x3a53('0x0'));var events=['save',_0x3a53('0x1'),_0x3a53('0x2')];function createListener(_0x1d7cd0,_0x3a1dab){return function(_0x7a6e2){_0x3a1dab[_0x3a53('0x3')](_0x1d7cd0,_0x7a6e2);};}function removeListener(_0x3d47d4,_0x30c56c){return function(){UserEvents[_0x3a53('0x4')](_0x3d47d4,_0x30c56c);};}exports[_0x3a53('0x5')]=function(_0x91f2b6){for(var _0x294e02=0x0,_0x1fd83f=events[_0x3a53('0x6')];_0x294e02<_0x1fd83f;_0x294e02++){var _0x180102=events[_0x294e02];var _0x399d1b=createListener(_0x3a53('0x7')+_0x180102,_0x91f2b6);UserEvents['on'](_0x180102,_0x399d1b);}}; \ No newline at end of file +var _0x34a4=['removeListener','register','length','./user.events','save','update','emit'];(function(_0x569e98,_0x4f0367){var _0x453382=function(_0x7b23c){while(--_0x7b23c){_0x569e98['push'](_0x569e98['shift']());}};_0x453382(++_0x4f0367);}(_0x34a4,0xb2));var _0x434a=function(_0x16a7d8,_0x326d5c){_0x16a7d8=_0x16a7d8-0x0;var _0xa4b589=_0x34a4[_0x16a7d8];return _0xa4b589;};'use strict';var UserEvents=require(_0x434a('0x0'));var events=[_0x434a('0x1'),'remove',_0x434a('0x2')];function createListener(_0x398ff9,_0x153ca9){return function(_0x2feca7){_0x153ca9[_0x434a('0x3')](_0x398ff9,_0x2feca7);};}function removeListener(_0x5b0d3d,_0x4d30bc){return function(){UserEvents[_0x434a('0x4')](_0x5b0d3d,_0x4d30bc);};}exports[_0x434a('0x5')]=function(_0x5a470c){for(var _0x3a2c47=0x0,_0x14f5aa=events[_0x434a('0x6')];_0x3a2c47<_0x14f5aa;_0x3a2c47++){var _0xa84a59=events[_0x3a2c47];var _0x11ae86=createListener('user:'+_0xa84a59,_0x5a470c);UserEvents['on'](_0xa84a59,_0x11ae86);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index b74f388..7b6d57e 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 _0x9b60=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router'];(function(_0x277f0a,_0x1ff552){var _0x173a99=function(_0x603e32){while(--_0x603e32){_0x277f0a['push'](_0x277f0a['shift']());}};_0x173a99(++_0x1ff552);}(_0x9b60,0xc1));var _0x09b6=function(_0x20ecd5,_0x4b955d){_0x20ecd5=_0x20ecd5-0x0;var _0x201547=_0x9b60[_0x20ecd5];return _0x201547;};'use strict';var multer=require(_0x09b6('0x0'));var util=require(_0x09b6('0x1'));var path=require(_0x09b6('0x2'));var express=require(_0x09b6('0x3'));var router=express[_0x09b6('0x4')]();var auth=require(_0x09b6('0x5'));var interaction=require(_0x09b6('0x6'));var config=require(_0x09b6('0x7'));module[_0x09b6('0x8')]=router; \ No newline at end of file +var _0x284b=['../../components/interaction/service','../../config/environment','exports','multer','Router','../../components/auth/service'];(function(_0x5dc93a,_0x4a672d){var _0x44ffa6=function(_0x5bb27){while(--_0x5bb27){_0x5dc93a['push'](_0x5dc93a['shift']());}};_0x44ffa6(++_0x4a672d);}(_0x284b,0x1b3));var _0xb284=function(_0xe0cd6d,_0x421d4f){_0xe0cd6d=_0xe0cd6d-0x0;var _0x3f0e22=_0x284b[_0xe0cd6d];return _0x3f0e22;};'use strict';var multer=require(_0xb284('0x0'));var util=require('util');var path=require('path');var express=require('express');var router=express[_0xb284('0x1')]();var auth=require(_0xb284('0x2'));var interaction=require(_0xb284('0x3'));var config=require(_0xb284('0x4'));module[_0xb284('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 c552ca2..135b7bb 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 _0x8611=['sequelize','INTEGER'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8611,0xd8));var _0x1861=function(_0x434de1,_0x5edede){_0x434de1=_0x434de1-0x0;var _0x17e8a2=_0x8611[_0x434de1];return _0x17e8a2;};'use strict';var Sequelize=require(_0x1861('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x1861('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5d05=['INTEGER'];(function(_0x55e6cf,_0x303356){var _0x1c2470=function(_0x505c24){while(--_0x505c24){_0x55e6cf['push'](_0x55e6cf['shift']());}};_0x1c2470(++_0x303356);}(_0x5d05,0x1cc));var _0x55d0=function(_0x8a565b,_0x49df9f){_0x8a565b=_0x8a565b-0x0;var _0x231c1d=_0x5d05[_0x8a565b];return _0x231c1d;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x55d0('0x0')],'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 64d3a53..02b7fae 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 _0x3495=['request-promise','./userChatQueue.attributes','exports','define','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x303a35,_0x26b4a9){var _0x2f8882=function(_0x8134a3){while(--_0x8134a3){_0x303a35['push'](_0x303a35['shift']());}};_0x2f8882(++_0x26b4a9);}(_0x3495,0x1de));var _0x5349=function(_0x2d3087,_0x254ae7){_0x2d3087=_0x2d3087-0x0;var _0x5d2d2d=_0x3495[_0x2d3087];return _0x5d2d2d;};'use strict';var _=require(_0x5349('0x0'));var util=require(_0x5349('0x1'));var logger=require(_0x5349('0x2'))(_0x5349('0x3'));var moment=require(_0x5349('0x4'));var BPromise=require(_0x5349('0x5'));var rp=require(_0x5349('0x6'));var attributes=require(_0x5349('0x7'));module[_0x5349('0x8')]=function(_0x5912ac,_0x4034ba){return _0x5912ac[_0x5349('0x9')]('UserChatQueue',attributes,{'tableName':_0x5349('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcbb=['util','../../config/logger','bluebird','request-promise','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','lodash'];(function(_0x507ac5,_0x33aaee){var _0x12c1bc=function(_0x5c953c){while(--_0x5c953c){_0x507ac5['push'](_0x507ac5['shift']());}};_0x12c1bc(++_0x33aaee);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x1efd3d,_0x1d7cef){_0x1efd3d=_0x1efd3d-0x0;var _0xa2fae8=_0xfcbb[_0x1efd3d];return _0xa2fae8;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var logger=require(_0xbfcb('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbfcb('0x3'));var rp=require(_0xbfcb('0x4'));var attributes=require(_0xbfcb('0x5'));module[_0xbfcb('0x6')]=function(_0x1d8b50,_0x5c5a1a){return _0x1d8b50['define'](_0xbfcb('0x7'),attributes,{'tableName':_0xbfcb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index b56c76e..b08ba29 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 _0x048f=['../../config/environment','jayson/promise','client','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x34c78a,_0x4b227f){var _0x498e41=function(_0x3e3810){while(--_0x3e3810){_0x34c78a['push'](_0x34c78a['shift']());}};_0x498e41(++_0x4b227f);}(_0x048f,0x1ae));var _0xf048=function(_0x1b3f7a,_0x5a6361){_0x1b3f7a=_0x1b3f7a-0x0;var _0x1a6a68=_0x048f[_0x1b3f7a];return _0x1a6a68;};'use strict';var _=require('lodash');var util=require(_0xf048('0x0'));var moment=require(_0xf048('0x1'));var BPromise=require('bluebird');var rs=require(_0xf048('0x2'));var fs=require('fs');var db=require(_0xf048('0x3'))['db'];var utils=require(_0xf048('0x4'));var logger=require(_0xf048('0x5'))(_0xf048('0x6'));var config=require(_0xf048('0x7'));var jayson=require(_0xf048('0x8'));var client=jayson[_0xf048('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48e135,_0x366d9a,_0x31f3fe){return new BPromise(function(_0x26ab09,_0x1dcd10){return client[_0xf048('0xa')](_0x48e135,_0x31f3fe)[_0xf048('0xb')](function(_0x16611c){logger['info'](_0xf048('0xc'),_0x366d9a,_0xf048('0xd'));logger[_0xf048('0xe')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x366d9a,'request\x20sent',JSON['stringify'](_0x16611c));if(_0x16611c[_0xf048('0xf')]){if(_0x16611c['error'][_0xf048('0x10')]===0x1f4){logger['error'](_0xf048('0xc'),_0x366d9a,_0x16611c[_0xf048('0xf')][_0xf048('0x11')]);return _0x1dcd10(_0x16611c[_0xf048('0xf')]['message']);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x366d9a,_0x16611c[_0xf048('0xf')][_0xf048('0x11')]);return _0x26ab09(_0x16611c[_0xf048('0xf')][_0xf048('0x11')]);}else{logger[_0xf048('0x12')](_0xf048('0xc'),_0x366d9a,'request\x20sent');_0x26ab09(_0x16611c['result'][_0xf048('0x11')]);}})['catch'](function(_0x9b57ae){logger[_0xf048('0xf')](_0xf048('0xc'),_0x366d9a,_0x9b57ae);_0x1dcd10(_0x9b57ae);});});} \ No newline at end of file +var _0x3f1d=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x22cf0f,_0x3bd6ff){var _0x3df4a9=function(_0x1f5a78){while(--_0x1f5a78){_0x22cf0f['push'](_0x22cf0f['shift']());}};_0x3df4a9(++_0x3bd6ff);}(_0x3f1d,0x9f));var _0xd3f1=function(_0x17fea7,_0x102927){_0x17fea7=_0x17fea7-0x0;var _0x3150c3=_0x3f1d[_0x17fea7];return _0x3150c3;};'use strict';var _=require(_0xd3f1('0x0'));var util=require(_0xd3f1('0x1'));var moment=require(_0xd3f1('0x2'));var BPromise=require(_0xd3f1('0x3'));var rs=require(_0xd3f1('0x4'));var fs=require('fs');var db=require(_0xd3f1('0x5'))['db'];var utils=require(_0xd3f1('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd3f1('0x7'));var jayson=require(_0xd3f1('0x8'));var client=jayson[_0xd3f1('0x9')][_0xd3f1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x315580,_0x5acf01,_0x5b830c){return new BPromise(function(_0x4a1a84,_0x243bcf){return client['request'](_0x315580,_0x5b830c)[_0xd3f1('0xb')](function(_0x553b78){logger[_0xd3f1('0xc')](_0xd3f1('0xd'),_0x5acf01,_0xd3f1('0xe'));logger[_0xd3f1('0xf')](_0xd3f1('0x10'),_0x5acf01,_0xd3f1('0xe'),JSON[_0xd3f1('0x11')](_0x553b78));if(_0x553b78[_0xd3f1('0x12')]){if(_0x553b78['error'][_0xd3f1('0x13')]===0x1f4){logger[_0xd3f1('0x12')](_0xd3f1('0xd'),_0x5acf01,_0x553b78[_0xd3f1('0x12')]['message']);return _0x243bcf(_0x553b78[_0xd3f1('0x12')][_0xd3f1('0x14')]);}logger[_0xd3f1('0x12')](_0xd3f1('0xd'),_0x5acf01,_0x553b78['error'][_0xd3f1('0x14')]);return _0x4a1a84(_0x553b78[_0xd3f1('0x12')][_0xd3f1('0x14')]);}else{logger[_0xd3f1('0xc')](_0xd3f1('0xd'),_0x5acf01,'request\x20sent');_0x4a1a84(_0x553b78[_0xd3f1('0x15')][_0xd3f1('0x14')]);}})[_0xd3f1('0x16')](function(_0x39f571){logger[_0xd3f1('0x12')](_0xd3f1('0xd'),_0x5acf01,_0x39f571);_0x243bcf(_0x39f571);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 6c4ddbd..b1d4bd2 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 _0x13e4=['multer','util','path','Router','../../components/auth/service'];(function(_0x186612,_0x116fe0){var _0x277b85=function(_0x29870c){while(--_0x29870c){_0x186612['push'](_0x186612['shift']());}};_0x277b85(++_0x116fe0);}(_0x13e4,0x127));var _0x413e=function(_0x433b73,_0x2c5b9c){_0x433b73=_0x433b73-0x0;var _0x398401=_0x13e4[_0x433b73];return _0x398401;};'use strict';var multer=require(_0x413e('0x0'));var util=require(_0x413e('0x1'));var path=require(_0x413e('0x2'));var express=require('express');var router=express[_0x413e('0x3')]();var auth=require(_0x413e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x57c0=['Router','../../components/auth/service','../../components/interaction/service','exports','multer','path'];(function(_0x3c2bd2,_0x42bbef){var _0x576b74=function(_0x196c1c){while(--_0x196c1c){_0x3c2bd2['push'](_0x3c2bd2['shift']());}};_0x576b74(++_0x42bbef);}(_0x57c0,0x1d8));var _0x057c=function(_0x98f6c3,_0x28639f){_0x98f6c3=_0x98f6c3-0x0;var _0x29238c=_0x57c0[_0x98f6c3];return _0x29238c;};'use strict';var multer=require(_0x057c('0x0'));var util=require('util');var path=require(_0x057c('0x1'));var express=require('express');var router=express[_0x057c('0x2')]();var auth=require(_0x057c('0x3'));var interaction=require(_0x057c('0x4'));var config=require('../../config/environment');module[_0x057c('0x5')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 7f13497..8769a8c 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 _0x626f=['sequelize','exports','INTEGER'];(function(_0x2c8a5b,_0x1d47b6){var _0x48dc70=function(_0x2041fe){while(--_0x2041fe){_0x2c8a5b['push'](_0x2c8a5b['shift']());}};_0x48dc70(++_0x1d47b6);}(_0x626f,0xdb));var _0xf626=function(_0x116c47,_0x55a5e6){_0x116c47=_0x116c47-0x0;var _0x2796c4=_0x626f[_0x116c47];return _0x2796c4;};'use strict';var Sequelize=require(_0xf626('0x0'));module[_0xf626('0x1')]={'penalty':{'type':Sequelize[_0xf626('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf626('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb45e=['exports','INTEGER','sequelize'];(function(_0x3b3700,_0x340bfb){var _0x20874c=function(_0x1d0d4d){while(--_0x1d0d4d){_0x3b3700['push'](_0x3b3700['shift']());}};_0x20874c(++_0x340bfb);}(_0xb45e,0x158));var _0xeb45=function(_0x458e35,_0x4af9f9){_0x458e35=_0x458e35-0x0;var _0x4c6030=_0xb45e[_0x458e35];return _0x4c6030;};'use strict';var Sequelize=require(_0xeb45('0x0'));module[_0xeb45('0x1')]={'penalty':{'type':Sequelize[_0xeb45('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 6208120..5f63c48 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 _0x50a6=['./userFaxQueue.attributes','exports','user_has_fax_queues','lodash','util','moment','request-promise'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x50a6,0xa4));var _0x650a=function(_0x248f6b,_0x401324){_0x248f6b=_0x248f6b-0x0;var _0x54b829=_0x50a6[_0x248f6b];return _0x54b829;};'use strict';var _=require(_0x650a('0x0'));var util=require(_0x650a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x650a('0x2'));var BPromise=require('bluebird');var rp=require(_0x650a('0x3'));var attributes=require(_0x650a('0x4'));module[_0x650a('0x5')]=function(_0x4a0147,_0xa3311){return _0x4a0147['define']('UserFaxQueue',attributes,{'tableName':_0x650a('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x425d=['bluebird','request-promise','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','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(_0x102996,_0x2f6efd){_0x102996=_0x102996-0x0;var _0x1d0db3=_0x425d[_0x102996];return _0x1d0db3;};'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/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index bbfcd93..8206c97 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 _0x7462=['rpc','jayson/promise','client','http','request','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','lodash','util','randomstring','../../config/logger'];(function(_0x225d2f,_0x37eed7){var _0x136a1b=function(_0x77d21f){while(--_0x77d21f){_0x225d2f['push'](_0x225d2f['shift']());}};_0x136a1b(++_0x37eed7);}(_0x7462,0x165));var _0x2746=function(_0x3e69ae,_0x366e8d){_0x3e69ae=_0x3e69ae-0x0;var _0x3d7f42=_0x7462[_0x3e69ae];return _0x3d7f42;};'use strict';var _=require(_0x2746('0x0'));var util=require(_0x2746('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2746('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2746('0x3'))(_0x2746('0x4'));var config=require('../../config/environment');var jayson=require(_0x2746('0x5'));var client=jayson[_0x2746('0x6')][_0x2746('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x280dfb,_0x2a2f42,_0x2940d8){return new BPromise(function(_0x1447bc,_0x40ad2b){return client[_0x2746('0x8')](_0x280dfb,_0x2940d8)['then'](function(_0x2b908c){logger[_0x2746('0x9')]('UserFaxQueue,\x20%s,\x20%s',_0x2a2f42,_0x2746('0xa'));logger[_0x2746('0xb')](_0x2746('0xc'),_0x2a2f42,'request\x20sent',JSON[_0x2746('0xd')](_0x2b908c));if(_0x2b908c[_0x2746('0xe')]){if(_0x2b908c[_0x2746('0xe')][_0x2746('0xf')]===0x1f4){logger[_0x2746('0xe')](_0x2746('0x10'),_0x2a2f42,_0x2b908c[_0x2746('0xe')][_0x2746('0x11')]);return _0x40ad2b(_0x2b908c[_0x2746('0xe')][_0x2746('0x11')]);}logger[_0x2746('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x2a2f42,_0x2b908c['error'][_0x2746('0x11')]);return _0x1447bc(_0x2b908c[_0x2746('0xe')][_0x2746('0x11')]);}else{logger[_0x2746('0x9')]('UserFaxQueue,\x20%s,\x20%s',_0x2a2f42,_0x2746('0xa'));_0x1447bc(_0x2b908c[_0x2746('0x12')]['message']);}})['catch'](function(_0x314075){logger[_0x2746('0xe')](_0x2746('0x10'),_0x2a2f42,_0x314075);_0x40ad2b(_0x314075);});});} \ No newline at end of file +var _0x96f2=['../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x96f2,0xb0));var _0x296f=function(_0x343d38,_0x4a88f1){_0x343d38=_0x343d38-0x0;var _0x4f6add=_0x96f2[_0x343d38];return _0x4f6add;};'use strict';var _=require(_0x296f('0x0'));var util=require('util');var moment=require(_0x296f('0x1'));var BPromise=require(_0x296f('0x2'));var rs=require(_0x296f('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x296f('0x4'));var logger=require(_0x296f('0x5'))(_0x296f('0x6'));var config=require('../../config/environment');var jayson=require(_0x296f('0x7'));var client=jayson[_0x296f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c55c7,_0x164031,_0x1d019f){return new BPromise(function(_0x2dc0ca,_0x28f708){return client[_0x296f('0x9')](_0x4c55c7,_0x1d019f)[_0x296f('0xa')](function(_0x29e904){logger[_0x296f('0xb')](_0x296f('0xc'),_0x164031,_0x296f('0xd'));logger['debug'](_0x296f('0xe'),_0x164031,_0x296f('0xd'),JSON[_0x296f('0xf')](_0x29e904));if(_0x29e904['error']){if(_0x29e904[_0x296f('0x10')][_0x296f('0x11')]===0x1f4){logger[_0x296f('0x10')](_0x296f('0xc'),_0x164031,_0x29e904['error']['message']);return _0x28f708(_0x29e904['error'][_0x296f('0x12')]);}logger[_0x296f('0x10')](_0x296f('0xc'),_0x164031,_0x29e904[_0x296f('0x10')]['message']);return _0x2dc0ca(_0x29e904[_0x296f('0x10')]['message']);}else{logger['info'](_0x296f('0xc'),_0x164031,_0x296f('0xd'));_0x2dc0ca(_0x29e904[_0x296f('0x13')][_0x296f('0x12')]);}})['catch'](function(_0x4a2aaa){logger[_0x296f('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x164031,_0x4a2aaa);_0x28f708(_0x4a2aaa);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 7154e04..d0a517e 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 _0xd114=['Router','../../components/auth/service','../../config/environment','exports','multer','util','path','express'];(function(_0x375aab,_0x597a8d){var _0x42c688=function(_0x4055a7){while(--_0x4055a7){_0x375aab['push'](_0x375aab['shift']());}};_0x42c688(++_0x597a8d);}(_0xd114,0x1e4));var _0x4d11=function(_0xd2a1d9,_0x54b2ff){_0xd2a1d9=_0xd2a1d9-0x0;var _0x15d898=_0xd114[_0xd2a1d9];return _0x15d898;};'use strict';var multer=require(_0x4d11('0x0'));var util=require(_0x4d11('0x1'));var path=require(_0x4d11('0x2'));var express=require(_0x4d11('0x3'));var router=express[_0x4d11('0x4')]();var auth=require(_0x4d11('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4d11('0x6'));module[_0x4d11('0x7')]=router; \ No newline at end of file +var _0xd62c=['../../components/interaction/service','exports','multer','util','express','../../components/auth/service'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xd62c,0x134));var _0xcd62=function(_0x46f5fe,_0x27e938){_0x46f5fe=_0x46f5fe-0x0;var _0x14ca51=_0xd62c[_0x46f5fe];return _0x14ca51;};'use strict';var multer=require(_0xcd62('0x0'));var util=require(_0xcd62('0x1'));var path=require('path');var express=require(_0xcd62('0x2'));var router=express['Router']();var auth=require(_0xcd62('0x3'));var interaction=require(_0xcd62('0x4'));var config=require('../../config/environment');module[_0xcd62('0x5')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index c47bd11..8bd8a58 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 _0x9012=['sequelize'];(function(_0x3ecd8d,_0x4a3783){var _0x3706cc=function(_0x2a452e){while(--_0x2a452e){_0x3ecd8d['push'](_0x3ecd8d['shift']());}};_0x3706cc(++_0x4a3783);}(_0x9012,0x1cf));var _0x2901=function(_0x547ff4,_0x416fa1){_0x547ff4=_0x547ff4-0x0;var _0xe41057=_0x9012[_0x547ff4];return _0xe41057;};'use strict';var Sequelize=require(_0x2901('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x365e=['INTEGER'];(function(_0x37dfdb,_0x51140f){var _0x1f1715=function(_0x88d974){while(--_0x88d974){_0x37dfdb['push'](_0x37dfdb['shift']());}};_0x1f1715(++_0x51140f);}(_0x365e,0xdd));var _0xe365=function(_0x1e5f77,_0x50ef9b){_0x1e5f77=_0x1e5f77-0x0;var _0xbeb30c=_0x365e[_0x1e5f77];return _0xbeb30c;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xe365('0x0')],'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 824b9bd..89ef1dc 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 _0x7e22=['UserMailQueue','user_has_mail_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','./userMailQueue.attributes','define'];(function(_0x243efe,_0x1b3b6b){var _0x51549b=function(_0x2c8cca){while(--_0x2c8cca){_0x243efe['push'](_0x243efe['shift']());}};_0x51549b(++_0x1b3b6b);}(_0x7e22,0x1d8));var _0x27e2=function(_0x346be5,_0xbbd413){_0x346be5=_0x346be5-0x0;var _0x2f27e5=_0x7e22[_0x346be5];return _0x2f27e5;};'use strict';var _=require(_0x27e2('0x0'));var util=require('util');var logger=require(_0x27e2('0x1'))(_0x27e2('0x2'));var moment=require(_0x27e2('0x3'));var BPromise=require(_0x27e2('0x4'));var rp=require(_0x27e2('0x5'));var attributes=require(_0x27e2('0x6'));module['exports']=function(_0x43868c,_0x4b2588){return _0x43868c[_0x27e2('0x7')](_0x27e2('0x8'),attributes,{'tableName':_0x27e2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb94c=['api','moment','request-promise','exports','define','UserMailQueue','lodash','util'];(function(_0x5a7f03,_0x1ece58){var _0x320b12=function(_0x4319e0){while(--_0x4319e0){_0x5a7f03['push'](_0x5a7f03['shift']());}};_0x320b12(++_0x1ece58);}(_0xb94c,0x176));var _0xcb94=function(_0x3fe57d,_0x5b84db){_0x3fe57d=_0x3fe57d-0x0;var _0x1e2725=_0xb94c[_0x3fe57d];return _0x1e2725;};'use strict';var _=require(_0xcb94('0x0'));var util=require(_0xcb94('0x1'));var logger=require('../../config/logger')(_0xcb94('0x2'));var moment=require(_0xcb94('0x3'));var BPromise=require('bluebird');var rp=require(_0xcb94('0x4'));var attributes=require('./userMailQueue.attributes');module[_0xcb94('0x5')]=function(_0xbbe00c,_0x2cf8a9){return _0xbbe00c[_0xcb94('0x6')](_0xcb94('0x7'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index b36ed68..23ac56a 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 _0xf185=['code','message','info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','UserMailQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x5ce3c8,_0x2503bd){var _0xa76867=function(_0x52815e){while(--_0x52815e){_0x5ce3c8['push'](_0x5ce3c8['shift']());}};_0xa76867(++_0x2503bd);}(_0xf185,0x1be));var _0x5f18=function(_0x2eda9e,_0x4899b6){_0x2eda9e=_0x2eda9e-0x0;var _0x53553c=_0xf185[_0x2eda9e];return _0x53553c;};'use strict';var _=require(_0x5f18('0x0'));var util=require('util');var moment=require(_0x5f18('0x1'));var BPromise=require(_0x5f18('0x2'));var rs=require(_0x5f18('0x3'));var fs=require('fs');var db=require(_0x5f18('0x4'))['db'];var utils=require(_0x5f18('0x5'));var logger=require(_0x5f18('0x6'))('rpc');var config=require(_0x5f18('0x7'));var jayson=require(_0x5f18('0x8'));var client=jayson[_0x5f18('0x9')][_0x5f18('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b7cc5,_0x2982d6,_0x3c69ee){return new BPromise(function(_0x47e05a,_0x15b931){return client['request'](_0x5b7cc5,_0x3c69ee)[_0x5f18('0xb')](function(_0x2b19b1){logger['info'](_0x5f18('0xc'),_0x2982d6,_0x5f18('0xd'));logger['debug'](_0x5f18('0xe'),_0x2982d6,_0x5f18('0xd'),JSON['stringify'](_0x2b19b1));if(_0x2b19b1['error']){if(_0x2b19b1[_0x5f18('0xf')][_0x5f18('0x10')]===0x1f4){logger[_0x5f18('0xf')]('UserMailQueue,\x20%s,\x20%s',_0x2982d6,_0x2b19b1[_0x5f18('0xf')][_0x5f18('0x11')]);return _0x15b931(_0x2b19b1[_0x5f18('0xf')][_0x5f18('0x11')]);}logger[_0x5f18('0xf')](_0x5f18('0xc'),_0x2982d6,_0x2b19b1[_0x5f18('0xf')][_0x5f18('0x11')]);return _0x47e05a(_0x2b19b1[_0x5f18('0xf')]['message']);}else{logger[_0x5f18('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x2982d6,'request\x20sent');_0x47e05a(_0x2b19b1[_0x5f18('0x13')][_0x5f18('0x11')]);}})[_0x5f18('0x14')](function(_0x418048){logger[_0x5f18('0xf')]('UserMailQueue,\x20%s,\x20%s',_0x2982d6,_0x418048);_0x15b931(_0x418048);});});} \ No newline at end of file +var _0xcc8d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment'];(function(_0x2ad11a,_0x5a83f1){var _0x399e62=function(_0x210fcf){while(--_0x210fcf){_0x2ad11a['push'](_0x2ad11a['shift']());}};_0x399e62(++_0x5a83f1);}(_0xcc8d,0xbb));var _0xdcc8=function(_0x5e6d65,_0x5db89c){_0x5e6d65=_0x5e6d65-0x0;var _0x5e1f75=_0xcc8d[_0x5e6d65];return _0x5e1f75;};'use strict';var _=require('lodash');var util=require(_0xdcc8('0x0'));var moment=require(_0xdcc8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0xdcc8('0x2'))['db'];var utils=require(_0xdcc8('0x3'));var logger=require(_0xdcc8('0x4'))(_0xdcc8('0x5'));var config=require(_0xdcc8('0x6'));var jayson=require(_0xdcc8('0x7'));var client=jayson[_0xdcc8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44e0b0,_0xfeebba,_0x10dd63){return new BPromise(function(_0x237528,_0x11c497){return client['request'](_0x44e0b0,_0x10dd63)[_0xdcc8('0x9')](function(_0xa991a1){logger[_0xdcc8('0xa')](_0xdcc8('0xb'),_0xfeebba,_0xdcc8('0xc'));logger[_0xdcc8('0xd')](_0xdcc8('0xe'),_0xfeebba,_0xdcc8('0xc'),JSON[_0xdcc8('0xf')](_0xa991a1));if(_0xa991a1[_0xdcc8('0x10')]){if(_0xa991a1[_0xdcc8('0x10')][_0xdcc8('0x11')]===0x1f4){logger['error'](_0xdcc8('0xb'),_0xfeebba,_0xa991a1[_0xdcc8('0x10')]['message']);return _0x11c497(_0xa991a1[_0xdcc8('0x10')][_0xdcc8('0x12')]);}logger[_0xdcc8('0x10')](_0xdcc8('0xb'),_0xfeebba,_0xa991a1['error'][_0xdcc8('0x12')]);return _0x237528(_0xa991a1[_0xdcc8('0x10')]['message']);}else{logger[_0xdcc8('0xa')]('UserMailQueue,\x20%s,\x20%s',_0xfeebba,_0xdcc8('0xc'));_0x237528(_0xa991a1[_0xdcc8('0x13')][_0xdcc8('0x12')]);}})[_0xdcc8('0x14')](function(_0xb28298){logger[_0xdcc8('0x10')](_0xdcc8('0xb'),_0xfeebba,_0xb28298);_0x11c497(_0xb28298);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 413c4e9..d876375 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 _0xc74c=['../../config/environment','exports','multer','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x4d2a6e,_0x185f42){var _0x2fa8bf=function(_0x48f9d4){while(--_0x48f9d4){_0x4d2a6e['push'](_0x4d2a6e['shift']());}};_0x2fa8bf(++_0x185f42);}(_0xc74c,0xcd));var _0xcc74=function(_0x2b8cc4,_0x5ae5f5){_0x2b8cc4=_0x2b8cc4-0x0;var _0x2c504d=_0xc74c[_0x2b8cc4];return _0x2c504d;};'use strict';var multer=require(_0xcc74('0x0'));var util=require('util');var path=require(_0xcc74('0x1'));var express=require(_0xcc74('0x2'));var router=express['Router']();var auth=require(_0xcc74('0x3'));var interaction=require(_0xcc74('0x4'));var config=require(_0xcc74('0x5'));module[_0xcc74('0x6')]=router; \ No newline at end of file +var _0x06ad=['../../components/interaction/service','exports','util','path','express','Router','../../components/auth/service'];(function(_0x878183,_0x113967){var _0xe1ca39=function(_0x12264e){while(--_0x12264e){_0x878183['push'](_0x878183['shift']());}};_0xe1ca39(++_0x113967);}(_0x06ad,0x1e5));var _0xd06a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x06ad[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xd06a('0x0'));var path=require(_0xd06a('0x1'));var express=require(_0xd06a('0x2'));var router=express[_0xd06a('0x3')]();var auth=require(_0xd06a('0x4'));var interaction=require(_0xd06a('0x5'));var config=require('../../config/environment');module[_0xd06a('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 e5e1d70..c6dfbea 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 _0x2826=['exports','INTEGER','sequelize'];(function(_0x2236fe,_0x4ef9e1){var _0x54ec9b=function(_0x5a1f37){while(--_0x5a1f37){_0x2236fe['push'](_0x2236fe['shift']());}};_0x54ec9b(++_0x4ef9e1);}(_0x2826,0x7d));var _0x6282=function(_0x29246a,_0x4b102b){_0x29246a=_0x29246a-0x0;var _0x29643e=_0x2826[_0x29246a];return _0x29643e;};'use strict';var Sequelize=require(_0x6282('0x0'));module[_0x6282('0x1')]={'penalty':{'type':Sequelize[_0x6282('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6064=['exports','INTEGER','sequelize'];(function(_0x379c5e,_0x65e869){var _0x5f32ab=function(_0x5247af){while(--_0x5247af){_0x379c5e['push'](_0x379c5e['shift']());}};_0x5f32ab(++_0x65e869);}(_0x6064,0x1d9));var _0x4606=function(_0x58c0b0,_0x3a127b){_0x58c0b0=_0x58c0b0-0x0;var _0x4b7ab1=_0x6064[_0x58c0b0];return _0x4b7ab1;};'use strict';var Sequelize=require(_0x4606('0x0'));module[_0x4606('0x1')]={'penalty':{'type':Sequelize[_0x4606('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 779c452..0148f9d 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 _0x415f=['exports','define','user_has_openchannel_queues','lodash','api','moment','bluebird','request-promise','./userOpenchannelQueue.attributes'];(function(_0x703ebd,_0x2674f3){var _0x4f0971=function(_0x2bb5c5){while(--_0x2bb5c5){_0x703ebd['push'](_0x703ebd['shift']());}};_0x4f0971(++_0x2674f3);}(_0x415f,0x81));var _0xf415=function(_0x49d03c,_0xd7bc2b){_0x49d03c=_0x49d03c-0x0;var _0x64411=_0x415f[_0x49d03c];return _0x64411;};'use strict';var _=require(_0xf415('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf415('0x1'));var moment=require(_0xf415('0x2'));var BPromise=require(_0xf415('0x3'));var rp=require(_0xf415('0x4'));var attributes=require(_0xf415('0x5'));module[_0xf415('0x6')]=function(_0x50b204,_0x103102){return _0x50b204[_0xf415('0x7')]('UserOpenchannelQueue',attributes,{'tableName':_0xf415('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16e8=['api','bluebird','request-promise','./userOpenchannelQueue.attributes','define','user_has_openchannel_queues','util','../../config/logger'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0x16e8,0x106));var _0x816e=function(_0x276869,_0x1c6366){_0x276869=_0x276869-0x0;var _0x2cd917=_0x16e8[_0x276869];return _0x2cd917;};'use strict';var _=require('lodash');var util=require(_0x816e('0x0'));var logger=require(_0x816e('0x1'))(_0x816e('0x2'));var moment=require('moment');var BPromise=require(_0x816e('0x3'));var rp=require(_0x816e('0x4'));var attributes=require(_0x816e('0x5'));module['exports']=function(_0x21b012,_0x51674f){return _0x21b012[_0x816e('0x6')]('UserOpenchannelQueue',attributes,{'tableName':_0x816e('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 b1c67e8..4ca481e 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 _0xc8ff=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0xc1389,_0xbced76){var _0x3583f3=function(_0x42a34c){while(--_0x42a34c){_0xc1389['push'](_0xc1389['shift']());}};_0x3583f3(++_0xbced76);}(_0xc8ff,0x16c));var _0xfc8f=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xc8ff[_0x2064e5];return _0x21a233;};'use strict';var _=require(_0xfc8f('0x0'));var util=require(_0xfc8f('0x1'));var moment=require(_0xfc8f('0x2'));var BPromise=require(_0xfc8f('0x3'));var rs=require(_0xfc8f('0x4'));var fs=require('fs');var db=require(_0xfc8f('0x5'))['db'];var utils=require(_0xfc8f('0x6'));var logger=require(_0xfc8f('0x7'))('rpc');var config=require(_0xfc8f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfc8f('0x9')][_0xfc8f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a0ba8,_0x1cc150,_0x3c9047){return new BPromise(function(_0x4059a7,_0x41e10f){return client['request'](_0x1a0ba8,_0x3c9047)['then'](function(_0x5ccd18){logger[_0xfc8f('0xb')](_0xfc8f('0xc'),_0x1cc150,_0xfc8f('0xd'));logger['debug'](_0xfc8f('0xe'),_0x1cc150,_0xfc8f('0xd'),JSON['stringify'](_0x5ccd18));if(_0x5ccd18['error']){if(_0x5ccd18[_0xfc8f('0xf')][_0xfc8f('0x10')]===0x1f4){logger[_0xfc8f('0xf')](_0xfc8f('0xc'),_0x1cc150,_0x5ccd18[_0xfc8f('0xf')]['message']);return _0x41e10f(_0x5ccd18['error']['message']);}logger[_0xfc8f('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1cc150,_0x5ccd18[_0xfc8f('0xf')][_0xfc8f('0x11')]);return _0x4059a7(_0x5ccd18['error'][_0xfc8f('0x11')]);}else{logger[_0xfc8f('0xb')](_0xfc8f('0xc'),_0x1cc150,_0xfc8f('0xd'));_0x4059a7(_0x5ccd18[_0xfc8f('0x12')][_0xfc8f('0x11')]);}})[_0xfc8f('0x13')](function(_0x2562f3){logger['error'](_0xfc8f('0xc'),_0x1cc150,_0x2562f3);_0x41e10f(_0x2562f3);});});} \ No newline at end of file +var _0x7dc3=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x8f398c,_0x189cc6){var _0x22450c=function(_0x4cf097){while(--_0x4cf097){_0x8f398c['push'](_0x8f398c['shift']());}};_0x22450c(++_0x189cc6);}(_0x7dc3,0xf3));var _0x37dc=function(_0x382eee,_0x112003){_0x382eee=_0x382eee-0x0;var _0x2c2289=_0x7dc3[_0x382eee];return _0x2c2289;};'use strict';var _=require(_0x37dc('0x0'));var util=require(_0x37dc('0x1'));var moment=require(_0x37dc('0x2'));var BPromise=require(_0x37dc('0x3'));var rs=require(_0x37dc('0x4'));var fs=require('fs');var db=require(_0x37dc('0x5'))['db'];var utils=require(_0x37dc('0x6'));var logger=require('../../config/logger')(_0x37dc('0x7'));var config=require(_0x37dc('0x8'));var jayson=require(_0x37dc('0x9'));var client=jayson[_0x37dc('0xa')][_0x37dc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3db4e0,_0x61cccc,_0x5a50ad){return new BPromise(function(_0x39f060,_0x55e997){return client[_0x37dc('0xc')](_0x3db4e0,_0x5a50ad)[_0x37dc('0xd')](function(_0x39315d){logger[_0x37dc('0xe')](_0x37dc('0xf'),_0x61cccc,_0x37dc('0x10'));logger[_0x37dc('0x11')](_0x37dc('0x12'),_0x61cccc,'request\x20sent',JSON[_0x37dc('0x13')](_0x39315d));if(_0x39315d['error']){if(_0x39315d[_0x37dc('0x14')][_0x37dc('0x15')]===0x1f4){logger[_0x37dc('0x14')](_0x37dc('0xf'),_0x61cccc,_0x39315d[_0x37dc('0x14')][_0x37dc('0x16')]);return _0x55e997(_0x39315d[_0x37dc('0x14')]['message']);}logger[_0x37dc('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x61cccc,_0x39315d['error'][_0x37dc('0x16')]);return _0x39f060(_0x39315d['error'][_0x37dc('0x16')]);}else{logger[_0x37dc('0xe')](_0x37dc('0xf'),_0x61cccc,_0x37dc('0x10'));_0x39f060(_0x39315d[_0x37dc('0x17')]['message']);}})[_0x37dc('0x18')](function(_0x51569f){logger[_0x37dc('0x14')](_0x37dc('0xf'),_0x61cccc,_0x51569f);_0x55e997(_0x51569f);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 1201cfd..34254b6 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 _0x451c=['multer','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x336f47,_0xe423ca){var _0xa87668=function(_0x3bf1e5){while(--_0x3bf1e5){_0x336f47['push'](_0x336f47['shift']());}};_0xa87668(++_0xe423ca);}(_0x451c,0x78));var _0xc451=function(_0x5b0128,_0x411925){_0x5b0128=_0x5b0128-0x0;var _0x507086=_0x451c[_0x5b0128];return _0x507086;};'use strict';var multer=require(_0xc451('0x0'));var util=require('util');var path=require('path');var express=require(_0xc451('0x1'));var router=express[_0xc451('0x2')]();var auth=require(_0xc451('0x3'));var interaction=require(_0xc451('0x4'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0xf079=['../../config/environment','exports','util','express','../../components/auth/service','../../components/interaction/service'];(function(_0x54e15b,_0x234bf3){var _0xb9713f=function(_0x5643fe){while(--_0x5643fe){_0x54e15b['push'](_0x54e15b['shift']());}};_0xb9713f(++_0x234bf3);}(_0xf079,0x12e));var _0x9f07=function(_0x54eb72,_0x3e9cf6){_0x54eb72=_0x54eb72-0x0;var _0x16adc8=_0xf079[_0x54eb72];return _0x16adc8;};'use strict';var multer=require('multer');var util=require(_0x9f07('0x0'));var path=require('path');var express=require(_0x9f07('0x1'));var router=express['Router']();var auth=require(_0x9f07('0x2'));var interaction=require(_0x9f07('0x3'));var config=require(_0x9f07('0x4'));module[_0x9f07('0x5')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index a74339d..f1af89c 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 _0x3f72=['INTEGER','sequelize'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x3f72,0x115));var _0x23f7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3f72[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x23f7('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x23f7('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe41c=['exports'];(function(_0x39ba30,_0x4c6f17){var _0x504f5c=function(_0x3ae9d6){while(--_0x3ae9d6){_0x39ba30['push'](_0x39ba30['shift']());}};_0x504f5c(++_0x4c6f17);}(_0xe41c,0x16f));var _0xce41=function(_0x1c3ea8,_0x155bc4){_0x1c3ea8=_0x1c3ea8-0x0;var _0x1277dd=_0xe41c[_0x1c3ea8];return _0x1277dd;};'use strict';var Sequelize=require('sequelize');module[_0xce41('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'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 d265d11..6c5f19a 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 _0xc57a=['lodash','../../config/logger','request-promise','./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc57a,0x142));var _0xac57=function(_0x1bfd18,_0x3ba1ab){_0x1bfd18=_0x1bfd18-0x0;var _0x17c907=_0xc57a[_0x1bfd18];return _0x17c907;};'use strict';var _=require(_0xac57('0x0'));var util=require('util');var logger=require(_0xac57('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xac57('0x2'));var attributes=require(_0xac57('0x3'));module['exports']=function(_0x1e1dbc,_0x20d0e7){return _0x1e1dbc[_0xac57('0x4')](_0xac57('0x5'),attributes,{'tableName':_0xac57('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6014=['./userSmsQueue.attributes','exports','define','lodash','util','moment','bluebird','request-promise'];(function(_0x3494ba,_0x531872){var _0x2a63fb=function(_0x3f4aa6){while(--_0x3f4aa6){_0x3494ba['push'](_0x3494ba['shift']());}};_0x2a63fb(++_0x531872);}(_0x6014,0xb3));var _0x4601=function(_0x258fb5,_0x47c7f5){_0x258fb5=_0x258fb5-0x0;var _0x124437=_0x6014[_0x258fb5];return _0x124437;};'use strict';var _=require(_0x4601('0x0'));var util=require(_0x4601('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4601('0x2'));var BPromise=require(_0x4601('0x3'));var rp=require(_0x4601('0x4'));var attributes=require(_0x4601('0x5'));module[_0x4601('0x6')]=function(_0x137094,_0x3cc054){return _0x137094[_0x4601('0x7')]('UserSmsQueue',attributes,{'tableName':'user_has_sms_queues','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 9342bcf..d476211 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 _0xa8b1=['UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4563b5,_0x2ceee2){var _0x698853=function(_0x2a2ea){while(--_0x2a2ea){_0x4563b5['push'](_0x4563b5['shift']());}};_0x698853(++_0x2ceee2);}(_0xa8b1,0xae));var _0x1a8b=function(_0x20b6d0,_0x6f4145){_0x20b6d0=_0x20b6d0-0x0;var _0x4700e1=_0xa8b1[_0x20b6d0];return _0x4700e1;};'use strict';var _=require(_0x1a8b('0x0'));var util=require('util');var moment=require(_0x1a8b('0x1'));var BPromise=require(_0x1a8b('0x2'));var rs=require(_0x1a8b('0x3'));var fs=require('fs');var db=require(_0x1a8b('0x4'))['db'];var utils=require(_0x1a8b('0x5'));var logger=require(_0x1a8b('0x6'))(_0x1a8b('0x7'));var config=require('../../config/environment');var jayson=require(_0x1a8b('0x8'));var client=jayson['client'][_0x1a8b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40055a,_0x468b20,_0x140cf5){return new BPromise(function(_0x4490ab,_0x189e6b){return client[_0x1a8b('0xa')](_0x40055a,_0x140cf5)['then'](function(_0x22f832){logger[_0x1a8b('0xb')](_0x1a8b('0xc'),_0x468b20,_0x1a8b('0xd'));logger[_0x1a8b('0xe')](_0x1a8b('0xf'),_0x468b20,_0x1a8b('0xd'),JSON['stringify'](_0x22f832));if(_0x22f832[_0x1a8b('0x10')]){if(_0x22f832[_0x1a8b('0x10')][_0x1a8b('0x11')]===0x1f4){logger[_0x1a8b('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x468b20,_0x22f832['error'][_0x1a8b('0x12')]);return _0x189e6b(_0x22f832[_0x1a8b('0x10')]['message']);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x468b20,_0x22f832[_0x1a8b('0x10')]['message']);return _0x4490ab(_0x22f832[_0x1a8b('0x10')][_0x1a8b('0x12')]);}else{logger[_0x1a8b('0xb')](_0x1a8b('0xc'),_0x468b20,_0x1a8b('0xd'));_0x4490ab(_0x22f832[_0x1a8b('0x13')][_0x1a8b('0x12')]);}})[_0x1a8b('0x14')](function(_0x4b0d39){logger[_0x1a8b('0x10')](_0x1a8b('0xc'),_0x468b20,_0x4b0d39);_0x189e6b(_0x4b0d39);});});} \ No newline at end of file +var _0x4971=['message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x1a2d1c,_0x4a1873){var _0x56eb67=function(_0x295a7d){while(--_0x295a7d){_0x1a2d1c['push'](_0x1a2d1c['shift']());}};_0x56eb67(++_0x4a1873);}(_0x4971,0xa4));var _0x1497=function(_0x147003,_0x36e2e3){_0x147003=_0x147003-0x0;var _0x5167b2=_0x4971[_0x147003];return _0x5167b2;};'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')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x29f1c4,'request\x20sent',JSON[_0x1497('0xe')](_0x365e74));if(_0x365e74['error']){if(_0x365e74['error']['code']===0x1f4){logger[_0x1497('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x29f1c4,_0x365e74[_0x1497('0xf')][_0x1497('0x10')]);return _0x48dabc(_0x365e74['error'][_0x1497('0x10')]);}logger['error']('UserSmsQueue,\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);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 9323a5a..98c0443 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 _0xa8e6=['../../config/environment','exports','multer','util','Router'];(function(_0x38850c,_0x4c20a3){var _0x41f7e9=function(_0x497331){while(--_0x497331){_0x38850c['push'](_0x38850c['shift']());}};_0x41f7e9(++_0x4c20a3);}(_0xa8e6,0x18d));var _0x6a8e=function(_0x2856f3,_0x644eac){_0x2856f3=_0x2856f3-0x0;var _0x51de75=_0xa8e6[_0x2856f3];return _0x51de75;};'use strict';var multer=require(_0x6a8e('0x0'));var util=require(_0x6a8e('0x1'));var path=require('path');var express=require('express');var router=express[_0x6a8e('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6a8e('0x3'));module[_0x6a8e('0x4')]=router; \ No newline at end of file +var _0x215c=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','Router'];(function(_0x4d2a2e,_0x3ae2d3){var _0x2c755f=function(_0x3fcb43){while(--_0x3fcb43){_0x4d2a2e['push'](_0x4d2a2e['shift']());}};_0x2c755f(++_0x3ae2d3);}(_0x215c,0x123));var _0xc215=function(_0x145016,_0x40ba0b){_0x145016=_0x145016-0x0;var _0x4a57e8=_0x215c[_0x145016];return _0x4a57e8;};'use strict';var multer=require(_0xc215('0x0'));var util=require(_0xc215('0x1'));var path=require('path');var express=require('express');var router=express[_0xc215('0x2')]();var auth=require(_0xc215('0x3'));var interaction=require(_0xc215('0x4'));var config=require(_0xc215('0x5'));module[_0xc215('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 4729ea3..e3d5bcd 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 _0x8689=['INTEGER','sequelize','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8689,0xd6));var _0x9868=function(_0x28556e,_0x297344){_0x28556e=_0x28556e-0x0;var _0x5f18a2=_0x8689[_0x28556e];return _0x5f18a2;};'use strict';var Sequelize=require(_0x9868('0x0'));module[_0x9868('0x1')]={'penalty':{'type':Sequelize[_0x9868('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbc1c=['exports','INTEGER','sequelize'];(function(_0x37475d,_0x4aaec3){var _0x2e67c0=function(_0x550c75){while(--_0x550c75){_0x37475d['push'](_0x37475d['shift']());}};_0x2e67c0(++_0x4aaec3);}(_0xbc1c,0x170));var _0xcbc1=function(_0xa599e2,_0x3046be){_0xa599e2=_0xa599e2-0x0;var _0x122f49=_0xbc1c[_0xa599e2];return _0x122f49;};'use strict';var Sequelize=require(_0xcbc1('0x0'));module[_0xcbc1('0x1')]={'penalty':{'type':Sequelize[_0xcbc1('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 3ce0f5a..ef080eb 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 _0x4742=['user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports','define'];(function(_0x3ecd50,_0x5c86c8){var _0x2c8f6f=function(_0xba4e45){while(--_0xba4e45){_0x3ecd50['push'](_0x3ecd50['shift']());}};_0x2c8f6f(++_0x5c86c8);}(_0x4742,0xfb));var _0x2474=function(_0x1c4d77,_0x4382aa){_0x1c4d77=_0x1c4d77-0x0;var _0x4782be=_0x4742[_0x1c4d77];return _0x4782be;};'use strict';var _=require(_0x2474('0x0'));var util=require(_0x2474('0x1'));var logger=require(_0x2474('0x2'))(_0x2474('0x3'));var moment=require(_0x2474('0x4'));var BPromise=require(_0x2474('0x5'));var rp=require(_0x2474('0x6'));var attributes=require('./userVoiceQueue.attributes');module[_0x2474('0x7')]=function(_0x3fc6e4,_0x80959){return _0x3fc6e4[_0x2474('0x8')]('UserVoiceQueue',attributes,{'tableName':_0x2474('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a2d=['util','../../config/logger','api','moment','bluebird','request-promise','./userVoiceQueue.attributes','exports','define','user_has_voice_queues','lodash'];(function(_0x3fba2,_0x5b23be){var _0x3e5558=function(_0x28f290){while(--_0x28f290){_0x3fba2['push'](_0x3fba2['shift']());}};_0x3e5558(++_0x5b23be);}(_0x3a2d,0x83));var _0xd3a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a2d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd3a2('0x0'));var util=require(_0xd3a2('0x1'));var logger=require(_0xd3a2('0x2'))(_0xd3a2('0x3'));var moment=require(_0xd3a2('0x4'));var BPromise=require(_0xd3a2('0x5'));var rp=require(_0xd3a2('0x6'));var attributes=require(_0xd3a2('0x7'));module[_0xd3a2('0x8')]=function(_0x443aa0,_0x303d87){return _0x443aa0[_0xd3a2('0x9')]('UserVoiceQueue',attributes,{'tableName':_0xd3a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 1e1f556..a34f026 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 _0xb3a1=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x115d5b,_0x26aff2){var _0x6cfc50=function(_0x39a786){while(--_0x39a786){_0x115d5b['push'](_0x115d5b['shift']());}};_0x6cfc50(++_0x26aff2);}(_0xb3a1,0xf9));var _0x1b3a=function(_0x2c32bd,_0x297d3b){_0x2c32bd=_0x2c32bd-0x0;var _0x4ae220=_0xb3a1[_0x2c32bd];return _0x4ae220;};'use strict';var _=require(_0x1b3a('0x0'));var util=require(_0x1b3a('0x1'));var moment=require(_0x1b3a('0x2'));var BPromise=require(_0x1b3a('0x3'));var rs=require(_0x1b3a('0x4'));var fs=require('fs');var db=require(_0x1b3a('0x5'))['db'];var utils=require(_0x1b3a('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1b3a('0x7')][_0x1b3a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x122a3a,_0x4341b0,_0x3e3bf0){return new BPromise(function(_0x3a22c2,_0x4f554d){return client[_0x1b3a('0x9')](_0x122a3a,_0x3e3bf0)[_0x1b3a('0xa')](function(_0x571745){logger['info'](_0x1b3a('0xb'),_0x4341b0,_0x1b3a('0xc'));logger['debug'](_0x1b3a('0xd'),_0x4341b0,'request\x20sent',JSON['stringify'](_0x571745));if(_0x571745[_0x1b3a('0xe')]){if(_0x571745['error'][_0x1b3a('0xf')]===0x1f4){logger[_0x1b3a('0xe')](_0x1b3a('0xb'),_0x4341b0,_0x571745['error'][_0x1b3a('0x10')]);return _0x4f554d(_0x571745[_0x1b3a('0xe')]['message']);}logger[_0x1b3a('0xe')](_0x1b3a('0xb'),_0x4341b0,_0x571745[_0x1b3a('0xe')][_0x1b3a('0x10')]);return _0x3a22c2(_0x571745[_0x1b3a('0xe')][_0x1b3a('0x10')]);}else{logger['info'](_0x1b3a('0xb'),_0x4341b0,_0x1b3a('0xc'));_0x3a22c2(_0x571745[_0x1b3a('0x11')][_0x1b3a('0x10')]);}})[_0x1b3a('0x12')](function(_0x3eaa0c){logger[_0x1b3a('0xe')](_0x1b3a('0xb'),_0x4341b0,_0x3eaa0c);_0x4f554d(_0x3eaa0c);});});} \ No newline at end of file +var _0x64fd=['client','request','then','info','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x2c93e2,_0x4fb5e2){var _0x57264e=function(_0x386895){while(--_0x386895){_0x2c93e2['push'](_0x2c93e2['shift']());}};_0x57264e(++_0x4fb5e2);}(_0x64fd,0x9f));var _0xd64f=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x64fd[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0xd64f('0x0'));var util=require('util');var moment=require(_0xd64f('0x1'));var BPromise=require(_0xd64f('0x2'));var rs=require(_0xd64f('0x3'));var fs=require('fs');var db=require(_0xd64f('0x4'))['db'];var utils=require(_0xd64f('0x5'));var logger=require('../../config/logger')(_0xd64f('0x6'));var config=require(_0xd64f('0x7'));var jayson=require(_0xd64f('0x8'));var client=jayson[_0xd64f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4efcfb,_0x3737c0,_0x3ed42e){return new BPromise(function(_0x385ae9,_0x5ab0c4){return client[_0xd64f('0xa')](_0x4efcfb,_0x3ed42e)[_0xd64f('0xb')](function(_0x97bf74){logger[_0xd64f('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x3737c0,_0xd64f('0xd'));logger['debug'](_0xd64f('0xe'),_0x3737c0,_0xd64f('0xd'),JSON['stringify'](_0x97bf74));if(_0x97bf74[_0xd64f('0xf')]){if(_0x97bf74['error'][_0xd64f('0x10')]===0x1f4){logger['error'](_0xd64f('0x11'),_0x3737c0,_0x97bf74[_0xd64f('0xf')][_0xd64f('0x12')]);return _0x5ab0c4(_0x97bf74['error'][_0xd64f('0x12')]);}logger[_0xd64f('0xf')](_0xd64f('0x11'),_0x3737c0,_0x97bf74['error'][_0xd64f('0x12')]);return _0x385ae9(_0x97bf74[_0xd64f('0xf')]['message']);}else{logger[_0xd64f('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x3737c0,'request\x20sent');_0x385ae9(_0x97bf74[_0xd64f('0x13')]['message']);}})[_0xd64f('0x14')](function(_0x5f4bee){logger[_0xd64f('0xf')](_0xd64f('0x11'),_0x3737c0,_0x5f4bee);_0x5ab0c4(_0x5f4bee);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index ba6343d..cf91dd0 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 _0xba69=['util','path','express','Router','../../components/interaction/service','../../config/environment','multer'];(function(_0x526ba1,_0x1dc9c2){var _0x126a52=function(_0x9a5e2d){while(--_0x9a5e2d){_0x526ba1['push'](_0x526ba1['shift']());}};_0x126a52(++_0x1dc9c2);}(_0xba69,0x187));var _0x9ba6=function(_0x37fa90,_0x196e37){_0x37fa90=_0x37fa90-0x0;var _0x3b1a92=_0xba69[_0x37fa90];return _0x3b1a92;};'use strict';var multer=require(_0x9ba6('0x0'));var util=require(_0x9ba6('0x1'));var path=require(_0x9ba6('0x2'));var express=require(_0x9ba6('0x3'));var router=express[_0x9ba6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9ba6('0x5'));var config=require(_0x9ba6('0x6'));module['exports']=router; \ No newline at end of file +var _0x9627=['express','../../components/auth/service','../../config/environment','multer','util'];(function(_0x441083,_0x575eba){var _0x449128=function(_0x20fa45){while(--_0x20fa45){_0x441083['push'](_0x441083['shift']());}};_0x449128(++_0x575eba);}(_0x9627,0xa3));var _0x7962=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x9627[_0x3070dc];return _0x431489;};'use strict';var multer=require(_0x7962('0x0'));var util=require(_0x7962('0x1'));var path=require('path');var express=require(_0x7962('0x2'));var router=express['Router']();var auth=require(_0x7962('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7962('0x4'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 0068508..cb94ddb 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 _0x3218=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x3d7669,_0x4b8da3){var _0x49764d=function(_0x33d2bc){while(--_0x33d2bc){_0x3d7669['push'](_0x3d7669['shift']());}};_0x49764d(++_0x4b8da3);}(_0x3218,0x158));var _0x8321=function(_0x38eb23,_0x196e8b){_0x38eb23=_0x38eb23-0x0;var _0x48506a=_0x3218[_0x38eb23];return _0x48506a;};'use strict';var Sequelize=require(_0x8321('0x0'));module[_0x8321('0x1')]={'uniqueid':{'type':Sequelize[_0x8321('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x8321('0x3')},'membername':{'type':Sequelize[_0x8321('0x4')],'allowNull':![],'comment':_0x8321('0x3')},'UserId':{'type':Sequelize[_0x8321('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x8321('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x8321('0x3')},'VoiceQueueId':{'type':Sequelize[_0x8321('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8321('0x5'),'comment':_0x8321('0x3')},'penalty':{'type':Sequelize[_0x8321('0x2')](0xb),'defaultValue':0x0,'comment':_0x8321('0x3')},'paused':{'type':Sequelize[_0x8321('0x2')](0xb),'defaultValue':0x0,'comment':_0x8321('0x3')}}; \ No newline at end of file +var _0x6424=['queue_interface','sequelize','exports','Required\x20by\x20Asterisk','STRING','INTEGER'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0x6424,0x67));var _0x4642=function(_0x5841c1,_0x575a6f){_0x5841c1=_0x5841c1-0x0;var _0x41ad9c=_0x6424[_0x5841c1];return _0x41ad9c;};'use strict';var Sequelize=require(_0x4642('0x0'));module[_0x4642('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x4642('0x2')},'membername':{'type':Sequelize[_0x4642('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x4642('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x4642('0x3')],'allowNull':![],'unique':_0x4642('0x5'),'comment':_0x4642('0x2')},'VoiceQueueId':{'type':Sequelize[_0x4642('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0x4642('0x3')],'allowNull':![],'unique':_0x4642('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x4642('0x4')](0xb),'defaultValue':0x0,'comment':_0x4642('0x2')},'paused':{'type':Sequelize[_0x4642('0x4')](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 b533e62..1cb15be 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 _0xccc3=['remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x1cd848,_0x1dcbf7){var _0x352bea=function(_0x4c13ad){while(--_0x4c13ad){_0x1cd848['push'](_0x1cd848['shift']());}};_0x352bea(++_0x1dcbf7);}(_0xccc3,0x1ea));var _0x3ccc=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xccc3[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require(_0x3ccc('0x0'));var UserVoiceQueueRt=require(_0x3ccc('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x3ccc('0x2')](0x0);var events={'afterCreate':_0x3ccc('0x3'),'afterUpdate':_0x3ccc('0x4'),'afterDestroy':_0x3ccc('0x5')};function emitEvent(_0x430157){return function(_0x11998b,_0x27bb99,_0x4fae42){UserVoiceQueueRtEvents[_0x3ccc('0x6')](_0x430157+':'+_0x11998b['id'],_0x11998b);UserVoiceQueueRtEvents[_0x3ccc('0x6')](_0x430157,_0x11998b);_0x4fae42(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x3ccc('0x7')](e,emitEvent(event));}}module[_0x3ccc('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xe216=['exports','events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x53ef00,_0x36783f){var _0x47e1c3=function(_0x216f84){while(--_0x216f84){_0x53ef00['push'](_0x53ef00['shift']());}};_0x47e1c3(++_0x36783f);}(_0xe216,0x1e7));var _0x6e21=function(_0x350aeb,_0x3d265a){_0x350aeb=_0x350aeb-0x0;var _0x3c5273=_0xe216[_0x350aeb];return _0x3c5273;};'use strict';var EventEmitter=require(_0x6e21('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x6e21('0x1')](0x0);var events={'afterCreate':_0x6e21('0x2'),'afterUpdate':_0x6e21('0x3'),'afterDestroy':_0x6e21('0x4')};function emitEvent(_0x994a1b){return function(_0x3b1391,_0x21e069,_0x33d8b2){UserVoiceQueueRtEvents[_0x6e21('0x5')](_0x994a1b+':'+_0x3b1391['id'],_0x3b1391);UserVoiceQueueRtEvents[_0x6e21('0x5')](_0x994a1b,_0x3b1391);_0x33d8b2(null);};}for(var e in events){if(events[_0x6e21('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x6e21('0x7')](e,emitEvent(event));}}module[_0x6e21('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index f9ab6f1..44576ba 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 _0xc866=['./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','../../config/logger','moment','bluebird','request-promise'];(function(_0x12cd4d,_0x2c79d6){var _0x39cd87=function(_0x163cc3){while(--_0x163cc3){_0x12cd4d['push'](_0x12cd4d['shift']());}};_0x39cd87(++_0x2c79d6);}(_0xc866,0x149));var _0x6c86=function(_0x1a9245,_0x2d3b15){_0x1a9245=_0x1a9245-0x0;var _0x80a274=_0xc866[_0x1a9245];return _0x80a274;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6c86('0x0'))('api');var moment=require(_0x6c86('0x1'));var BPromise=require(_0x6c86('0x2'));var rp=require(_0x6c86('0x3'));var attributes=require(_0x6c86('0x4'));module[_0x6c86('0x5')]=function(_0x555ba1,_0x4edcaa){return _0x555ba1[_0x6c86('0x6')](_0x6c86('0x7'),attributes,{'tableName':_0x6c86('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc7b=['api','moment','bluebird','request-promise','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util'];(function(_0x4458ba,_0x4b23c9){var _0x1f3d74=function(_0x1549c2){while(--_0x1549c2){_0x4458ba['push'](_0x4458ba['shift']());}};_0x1f3d74(++_0x4b23c9);}(_0xbc7b,0xdf));var _0xbbc7=function(_0x505681,_0x323665){_0x505681=_0x505681-0x0;var _0x55497e=_0xbc7b[_0x505681];return _0x55497e;};'use strict';var _=require(_0xbbc7('0x0'));var util=require(_0xbbc7('0x1'));var logger=require('../../config/logger')(_0xbbc7('0x2'));var moment=require(_0xbbc7('0x3'));var BPromise=require(_0xbbc7('0x4'));var rp=require(_0xbbc7('0x5'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x18a79d,_0x3fc555){return _0x18a79d[_0xbbc7('0x6')](_0xbbc7('0x7'),attributes,{'tableName':_0xbbc7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index b82ad00..7cb197a 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 _0x296f=['UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','socket.io-emitter','localhost','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent'];(function(_0x36bff5,_0x3156cb){var _0x80ade5=function(_0x5eee65){while(--_0x5eee65){_0x36bff5['push'](_0x36bff5['shift']());}};_0x80ade5(++_0x3156cb);}(_0x296f,0xf0));var _0xf296=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0x296f[_0xf2628e];return _0x13863a;};'use strict';var _=require(_0xf296('0x0'));var util=require(_0xf296('0x1'));var moment=require(_0xf296('0x2'));var BPromise=require(_0xf296('0x3'));var rs=require(_0xf296('0x4'));var fs=require('fs');var db=require(_0xf296('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf296('0x6'));var config=require(_0xf296('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});var socket=require(_0xf296('0x8'))({'host':_0xf296('0x9'),'port':0x18eb});require('./userVoiceQueueRt.socket')[_0xf296('0xa')](socket);function respondWithRpcPromise(_0x3197bc,_0x4b05c5,_0x25ff95){return new BPromise(function(_0x5c891c,_0x1ec8cc){return client[_0xf296('0xb')](_0x3197bc,_0x25ff95)[_0xf296('0xc')](function(_0x59366d){logger[_0xf296('0xd')](_0xf296('0xe'),_0x4b05c5,_0xf296('0xf'));logger['debug'](_0xf296('0x10'),_0x4b05c5,_0xf296('0xf'),JSON[_0xf296('0x11')](_0x59366d));if(_0x59366d[_0xf296('0x12')]){if(_0x59366d[_0xf296('0x12')]['code']===0x1f4){logger['error'](_0xf296('0xe'),_0x4b05c5,_0x59366d[_0xf296('0x12')]['message']);return _0x1ec8cc(_0x59366d[_0xf296('0x12')][_0xf296('0x13')]);}logger['error'](_0xf296('0xe'),_0x4b05c5,_0x59366d[_0xf296('0x12')]['message']);return _0x5c891c(_0x59366d['error']['message']);}else{logger[_0xf296('0xd')](_0xf296('0xe'),_0x4b05c5,_0xf296('0xf'));_0x5c891c(_0x59366d[_0xf296('0x14')][_0xf296('0x13')]);}})[_0xf296('0x15')](function(_0x3db703){logger[_0xf296('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4b05c5,_0x3db703);_0x1ec8cc(_0x3db703);});});}exports[_0xf296('0x16')]=function(_0x2a931c){var _0xd2a9fd=this;return new Promise(function(_0x2dce6e,_0x468a31){return db[_0xf296('0x17')]['findAll']({'raw':_0x2a931c[_0xf296('0x18')]?_0x2a931c['options'][_0xf296('0x19')]===undefined?!![]:![]:!![],'where':_0x2a931c[_0xf296('0x18')]?_0x2a931c['options'][_0xf296('0x1a')]||null:null,'attributes':[[db[_0xf296('0x1b')]['fn'](_0xf296('0x1c'),db['sequelize']['fn']('IF',db[_0xf296('0x1b')][_0xf296('0x1d')]('`paused`\x20=\x201,\x201,\x20null'))),_0xf296('0x1e')]]})[_0xf296('0xc')](function(_0x1e4562){logger[_0xf296('0xd')](_0xf296('0x16'),_0x2a931c);logger[_0xf296('0x1f')]('GetVoiceQueueRtPauses',_0x2a931c,JSON[_0xf296('0x11')](_0x1e4562));_0x2dce6e(_0x1e4562);})[_0xf296('0x15')](function(_0xd4dc36){logger[_0xf296('0x12')](_0xf296('0x16'),_0xd4dc36[_0xf296('0x13')],_0x2a931c);_0x468a31(_0xd2a9fd['error'](0x1f4,_0xd4dc36[_0xf296('0x13')]));});});}; \ No newline at end of file +var _0xab3a=['options','raw','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','./userVoiceQueueRt.socket','register','request','then','info','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','UserVoiceQueueRt,\x20%s,\x20%s','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt'];(function(_0x9122f1,_0x3fce7e){var _0xf18081=function(_0x51dcbc){while(--_0x51dcbc){_0x9122f1['push'](_0x9122f1['shift']());}};_0xf18081(++_0x3fce7e);}(_0xab3a,0x1d3));var _0xaab3=function(_0x23ec89,_0x11c956){_0x23ec89=_0x23ec89-0x0;var _0x51aea2=_0xab3a[_0x23ec89];return _0x51aea2;};'use strict';var _=require(_0xaab3('0x0'));var util=require(_0xaab3('0x1'));var moment=require(_0xaab3('0x2'));var BPromise=require(_0xaab3('0x3'));var rs=require(_0xaab3('0x4'));var fs=require('fs');var db=require(_0xaab3('0x5'))['db'];var utils=require(_0xaab3('0x6'));var logger=require(_0xaab3('0x7'))(_0xaab3('0x8'));var config=require(_0xaab3('0x9'));var jayson=require(_0xaab3('0xa'));var client=jayson[_0xaab3('0xb')][_0xaab3('0xc')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0xaab3('0xd'))[_0xaab3('0xe')](socket);function respondWithRpcPromise(_0x146453,_0x21527a,_0x1b32e0){return new BPromise(function(_0xe86b5a,_0x15841e){return client[_0xaab3('0xf')](_0x146453,_0x1b32e0)[_0xaab3('0x10')](function(_0x151330){logger[_0xaab3('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x21527a,'request\x20sent');logger[_0xaab3('0x12')](_0xaab3('0x13'),_0x21527a,_0xaab3('0x14'),JSON[_0xaab3('0x15')](_0x151330));if(_0x151330['error']){if(_0x151330[_0xaab3('0x16')]['code']===0x1f4){logger[_0xaab3('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x21527a,_0x151330[_0xaab3('0x16')][_0xaab3('0x17')]);return _0x15841e(_0x151330[_0xaab3('0x16')]['message']);}logger[_0xaab3('0x16')](_0xaab3('0x18'),_0x21527a,_0x151330['error'][_0xaab3('0x17')]);return _0xe86b5a(_0x151330[_0xaab3('0x16')][_0xaab3('0x17')]);}else{logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x21527a,'request\x20sent');_0xe86b5a(_0x151330['result'][_0xaab3('0x17')]);}})[_0xaab3('0x19')](function(_0x21bae7){logger['error'](_0xaab3('0x18'),_0x21527a,_0x21bae7);_0x15841e(_0x21bae7);});});}exports[_0xaab3('0x1a')]=function(_0x3a06f2){var _0x13048f=this;return new Promise(function(_0x231256,_0x4c0d11){return db[_0xaab3('0x1b')]['findAll']({'raw':_0x3a06f2[_0xaab3('0x1c')]?_0x3a06f2[_0xaab3('0x1c')][_0xaab3('0x1d')]===undefined?!![]:![]:!![],'where':_0x3a06f2[_0xaab3('0x1c')]?_0x3a06f2[_0xaab3('0x1c')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xaab3('0x1e')](_0xaab3('0x1f')))),_0xaab3('0x20')]]})[_0xaab3('0x10')](function(_0xaebe3e){logger[_0xaab3('0x11')](_0xaab3('0x1a'),_0x3a06f2);logger[_0xaab3('0x12')](_0xaab3('0x1a'),_0x3a06f2,JSON[_0xaab3('0x15')](_0xaebe3e));_0x231256(_0xaebe3e);})[_0xaab3('0x19')](function(_0x3097ec){logger[_0xaab3('0x16')]('GetVoiceQueueRtPauses',_0x3097ec[_0xaab3('0x17')],_0x3a06f2);_0x4c0d11(_0x13048f['error'](0x1f4,_0x3097ec[_0xaab3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index a5b5e92..08b7433 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 _0xcca7=['save','remove','update','removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events'];(function(_0x255c48,_0x2a4449){var _0xaebda3=function(_0x12a04e){while(--_0x12a04e){_0x255c48['push'](_0x255c48['shift']());}};_0xaebda3(++_0x2a4449);}(_0xcca7,0x1aa));var _0x7cca=function(_0x292304,_0xa7fa2c){_0x292304=_0x292304-0x0;var _0x33a578=_0xcca7[_0x292304];return _0x33a578;};'use strict';var UserVoiceQueueRtEvents=require(_0x7cca('0x0'));var events=[_0x7cca('0x1'),_0x7cca('0x2'),_0x7cca('0x3')];function createListener(_0x5cfce5,_0x4c311e){return function(_0x30823f){_0x4c311e['emit'](_0x5cfce5,_0x30823f);};}function removeListener(_0x3b86a4,_0x9523f7){return function(){UserVoiceQueueRtEvents[_0x7cca('0x4')](_0x3b86a4,_0x9523f7);};}exports[_0x7cca('0x5')]=function(_0x1c6c95){for(var _0xe70805=0x0,_0x5aec51=events['length'];_0xe70805<_0x5aec51;_0xe70805++){var _0x937fad=events[_0xe70805];var _0xd7a28d=createListener(_0x7cca('0x6')+_0x937fad,_0x1c6c95);UserVoiceQueueRtEvents['on'](_0x937fad,_0xd7a28d);}}; \ No newline at end of file +var _0xf69d=['removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0xf69d,0xd3));var _0xdf69=function(_0x24079e,_0x2335ee){_0x24079e=_0x24079e-0x0;var _0x2f6ea0=_0xf69d[_0x24079e];return _0x2f6ea0;};'use strict';var UserVoiceQueueRtEvents=require(_0xdf69('0x0'));var events=[_0xdf69('0x1'),_0xdf69('0x2'),_0xdf69('0x3')];function createListener(_0xf89475,_0x4e4bdd){return function(_0x3013e5){_0x4e4bdd[_0xdf69('0x4')](_0xf89475,_0x3013e5);};}function removeListener(_0x5b5eec,_0x13ecb6){return function(){UserVoiceQueueRtEvents[_0xdf69('0x5')](_0x5b5eec,_0x13ecb6);};}exports[_0xdf69('0x6')]=function(_0x2d456f){for(var _0x465b1b=0x0,_0x1d2501=events[_0xdf69('0x7')];_0x465b1b<_0x1d2501;_0x465b1b++){var _0x18a08e=events[_0x465b1b];var _0xc1b77e=createListener(_0xdf69('0x8')+_0x18a08e,_0x2d456f);UserVoiceQueueRtEvents['on'](_0x18a08e,_0xc1b77e);}}; \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 3f9b905..56ae9b1 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 _0xc5c7=['../../config/environment','./variable.controller','get','isAuthenticated','index','create','/:id','update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service'];(function(_0xa1ba6b,_0x8a1478){var _0x4ebb79=function(_0x786673){while(--_0x786673){_0xa1ba6b['push'](_0xa1ba6b['shift']());}};_0x4ebb79(++_0x8a1478);}(_0xc5c7,0x1eb));var _0x7c5c=function(_0x5654ec,_0x3ef289){_0x5654ec=_0x5654ec-0x0;var _0xc0b356=_0xc5c7[_0x5654ec];return _0xc0b356;};'use strict';var multer=require(_0x7c5c('0x0'));var util=require(_0x7c5c('0x1'));var path=require('path');var express=require(_0x7c5c('0x2'));var router=express['Router']();var auth=require(_0x7c5c('0x3'));var interaction=require(_0x7c5c('0x4'));var config=require(_0x7c5c('0x5'));var controller=require(_0x7c5c('0x6'));router[_0x7c5c('0x7')]('/',auth[_0x7c5c('0x8')](),controller[_0x7c5c('0x9')]);router[_0x7c5c('0x7')]('/:id',auth[_0x7c5c('0x8')](),controller['show']);router['post']('/',auth[_0x7c5c('0x8')](),controller[_0x7c5c('0xa')]);router['put'](_0x7c5c('0xb'),auth[_0x7c5c('0x8')](),controller[_0x7c5c('0xc')]);router[_0x7c5c('0xd')](_0x7c5c('0xb'),auth['isAuthenticated'](),controller[_0x7c5c('0xe')]);module[_0x7c5c('0xf')]=router; \ No newline at end of file +var _0xb6cd=['get','isAuthenticated','/:id','post','put','update','delete','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./variable.controller'];(function(_0x37f330,_0x30ef70){var _0x4fab68=function(_0x43b392){while(--_0x43b392){_0x37f330['push'](_0x37f330['shift']());}};_0x4fab68(++_0x30ef70);}(_0xb6cd,0x1ca));var _0xdb6c=function(_0x550734,_0x1cbeff){_0x550734=_0x550734-0x0;var _0xa9fe=_0xb6cd[_0x550734];return _0xa9fe;};'use strict';var multer=require(_0xdb6c('0x0'));var util=require(_0xdb6c('0x1'));var path=require(_0xdb6c('0x2'));var express=require('express');var router=express[_0xdb6c('0x3')]();var auth=require(_0xdb6c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdb6c('0x5'));var controller=require(_0xdb6c('0x6'));router[_0xdb6c('0x7')]('/',auth[_0xdb6c('0x8')](),controller['index']);router['get'](_0xdb6c('0x9'),auth[_0xdb6c('0x8')](),controller['show']);router[_0xdb6c('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdb6c('0xb')](_0xdb6c('0x9'),auth[_0xdb6c('0x8')](),controller[_0xdb6c('0xc')]);router[_0xdb6c('0xd')](_0xdb6c('0x9'),auth[_0xdb6c('0x8')](),controller['destroy']);module[_0xdb6c('0xe')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 67431ed..1ce84a1 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 _0x1e96=['name','sequelize'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x1e96,0xb5));var _0x61e9=function(_0x292086,_0x533376){_0x292086=_0x292086-0x0;var _0x984216=_0x1e96[_0x292086];return _0x984216;};'use strict';var Sequelize=require(_0x61e9('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x61e9('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb306=['STRING','name','sequelize'];(function(_0x184a56,_0x503f50){var _0x89ba34=function(_0x2cce45){while(--_0x2cce45){_0x184a56['push'](_0x184a56['shift']());}};_0x89ba34(++_0x503f50);}(_0xb306,0x12e));var _0x6b30=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb306[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x6b30('0x0'));module['exports']={'name':{'type':Sequelize[_0x6b30('0x1')],'unique':_0x6b30('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6b30('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 0d7eee8..24c52f2 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 _0x8145=['query','dateEnd','filters','attributes','intersection','fields','length','nolimit','limit','offset','order','sort','where','pick','add','day','merge','filter','options','includeAll','findAll','rows','catch','show','params','keys','find','create','body','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','set','Content-Range','apply','reject','destroy','then','stack','name','send','index','Variable','rawAttributes','model','dateStart'];(function(_0x135a1c,_0x28b5f6){var _0x295c98=function(_0x2747fc){while(--_0x2747fc){_0x135a1c['push'](_0x135a1c['shift']());}};_0x295c98(++_0x28b5f6);}(_0x8145,0xdd));var _0x5814=function(_0x447cc2,_0x276966){_0x447cc2=_0x447cc2-0x0;var _0x17c0ee=_0x8145[_0x447cc2];return _0x17c0ee;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5814('0x0'));var BPromise=require(_0x5814('0x1'));var Mustache=require(_0x5814('0x2'));var util=require(_0x5814('0x3'));var path=require(_0x5814('0x4'));var sox=require('sox');var csv=require(_0x5814('0x5'));var ejs=require(_0x5814('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5814('0x7'));var crypto=require('crypto');var jsforce=require(_0x5814('0x8'));var deskjs=require(_0x5814('0x9'));var toCsv=require(_0x5814('0x5'));var querystring=require(_0x5814('0xa'));var Papa=require('papaparse');var qs=require(_0x5814('0xb'));var logger=require(_0x5814('0xc'))(_0x5814('0xd'));var utils=require('../../config/utils');var config=require(_0x5814('0xe'));var db=require(_0x5814('0xf'))['db'];function respondWithStatusCode(_0xb9b6fa,_0x4c436a){_0x4c436a=_0x4c436a||0xcc;return function(_0x15215c){if(_0x15215c){return _0xb9b6fa[_0x5814('0x10')](_0x4c436a);}return _0xb9b6fa[_0x5814('0x11')](_0x4c436a)[_0x5814('0x12')]();};}function respondWithResult(_0x3c62d1,_0x433520){_0x433520=_0x433520||0xc8;return function(_0x1e6f6b){if(_0x1e6f6b){return _0x3c62d1[_0x5814('0x11')](_0x433520)[_0x5814('0x13')](_0x1e6f6b);}};}function respondWithFilteredResult(_0x32d4a2,_0x32c6cc){return function(_0x59fc47){if(_0x59fc47){var _0x1822dd=_0x59fc47[_0x5814('0x14')],_0x5165ef=_0x32c6cc['offset'],_0x1344a5=_0x32c6cc['offset']+_0x32c6cc['limit'],_0x41945a;if(_0x1344a5>=_0x1822dd){_0x1344a5=_0x1822dd;_0x41945a=0xc8;}else{_0x41945a=0xce;}_0x32d4a2[_0x5814('0x11')](_0x41945a);return _0x32d4a2[_0x5814('0x15')](_0x5814('0x16'),_0x5165ef+'-'+_0x1344a5+'/'+_0x1822dd)[_0x5814('0x13')](_0x59fc47);}return null;};}function patchUpdates(_0x38f48a){return function(_0x1e0d9c){try{jsonpatch[_0x5814('0x17')](_0x1e0d9c,_0x38f48a,!![]);}catch(_0x272cd1){return BPromise[_0x5814('0x18')](_0x272cd1);}return _0x1e0d9c['save']();};}function saveUpdates(_0x2a1ce5,_0x3c79e6){return function(_0xb55f5){if(_0xb55f5){return _0xb55f5['update'](_0x2a1ce5)['then'](function(_0x29ee7c){return _0x29ee7c;});}return null;};}function removeEntity(_0x169776,_0x2cf69f){return function(_0x5f3ad9){if(_0x5f3ad9){return _0x5f3ad9[_0x5814('0x19')]()[_0x5814('0x1a')](function(){_0x169776['status'](0xcc)[_0x5814('0x12')]();});}};}function handleEntityNotFound(_0x4b15a9,_0xeb72f4){return function(_0x569b2a){if(!_0x569b2a){_0x4b15a9['sendStatus'](0x194);}return _0x569b2a;};}function handleError(_0x5eae5d,_0x23d2d9){_0x23d2d9=_0x23d2d9||0x1f4;return function(_0x2999b1){logger['error'](_0x2999b1[_0x5814('0x1b')]);if(_0x2999b1[_0x5814('0x1c')]){delete _0x2999b1[_0x5814('0x1c')];}_0x5eae5d['status'](_0x23d2d9)[_0x5814('0x1d')](_0x2999b1);};}exports[_0x5814('0x1e')]=function(_0x27fd54,_0x173c76){var _0x34dd96={},_0xbc810d={},_0x106c38={'count':0x0,'rows':[]};var _0x4d87b1=db[_0x5814('0x1f')][_0x5814('0x20')];_0xbc810d[_0x5814('0x21')]=_['keys'](_0x4d87b1);var _0x5e44da={'dateStart':_0x27fd54['query'][_0x5814('0x22')],'dateEnd':_0x27fd54[_0x5814('0x23')]['dateEnd']};delete _0x27fd54[_0x5814('0x23')][_0x5814('0x22')];delete _0x27fd54[_0x5814('0x23')][_0x5814('0x24')];_0xbc810d['query']=_['keys'](_0x27fd54[_0x5814('0x23')]);_0xbc810d[_0x5814('0x25')]=_['intersection'](_0xbc810d['model'],_0xbc810d[_0x5814('0x23')]);_0x34dd96[_0x5814('0x26')]=_[_0x5814('0x27')](_0xbc810d[_0x5814('0x21')],qs[_0x5814('0x28')](_0x27fd54[_0x5814('0x23')][_0x5814('0x28')]));_0x34dd96['attributes']=_0x34dd96['attributes'][_0x5814('0x29')]?_0x34dd96[_0x5814('0x26')]:_0xbc810d['model'];if(!_0x27fd54[_0x5814('0x23')]['hasOwnProperty'](_0x5814('0x2a'))){_0x34dd96['limit']=qs['limit'](_0x27fd54[_0x5814('0x23')][_0x5814('0x2b')]);_0x34dd96[_0x5814('0x2c')]=qs['offset'](_0x27fd54[_0x5814('0x23')][_0x5814('0x2c')]);}_0x34dd96[_0x5814('0x2d')]=qs[_0x5814('0x2e')](_0x27fd54[_0x5814('0x23')][_0x5814('0x2e')]);_0x34dd96[_0x5814('0x2f')]=qs['filters'](_[_0x5814('0x30')](_0x27fd54[_0x5814('0x23')],_0xbc810d['filters']));if(_0x5e44da['dateStart']){if(_0x5e44da[_0x5814('0x24')]){_0x5e44da[_0x5814('0x24')]=moment(_0x5e44da[_0x5814('0x24')])[_0x5814('0x31')](0x1,_0x5814('0x32'));}else{_0x5e44da[_0x5814('0x24')]=moment(_0x5e44da[_0x5814('0x22')])['add'](0x1,_0x5814('0x32'));}_[_0x5814('0x33')](_0x34dd96[_0x5814('0x2f')],{'createdAt':{'$gte':_0x5e44da['dateStart'],'$lte':_0x5e44da[_0x5814('0x24')]}});}if(_0x27fd54[_0x5814('0x23')][_0x5814('0x34')]){_0x34dd96[_0x5814('0x2f')]=_['merge'](_0x34dd96[_0x5814('0x2f')],{'$or':_['map'](_0x34dd96['attributes'],function(_0x55b9f6){var _0x5a305a={};_0x5a305a[_0x55b9f6]={'$like':'%'+_0x27fd54[_0x5814('0x23')][_0x5814('0x34')]+'%'};return _0x5a305a;})});}_0x34dd96=_['merge']({},_0x34dd96,_0x27fd54[_0x5814('0x35')]);var _0x47c2a7={'where':_0x34dd96[_0x5814('0x2f')]};return db[_0x5814('0x1f')][_0x5814('0x14')](_0x47c2a7)['then'](function(_0x2725a7){_0x106c38['count']=_0x2725a7;if(_0x27fd54[_0x5814('0x23')][_0x5814('0x36')]){_0x34dd96['include']=[{'all':!![]}];}return db[_0x5814('0x1f')][_0x5814('0x37')](_0x34dd96);})[_0x5814('0x1a')](function(_0x231832){_0x106c38[_0x5814('0x38')]=_0x231832;return _0x106c38;})[_0x5814('0x1a')](respondWithFilteredResult(_0x173c76,_0x34dd96))[_0x5814('0x39')](handleError(_0x173c76,null));};exports[_0x5814('0x3a')]=function(_0x5c9a3c,_0x5d5569){var _0x1783ca={'raw':!![],'where':{'id':_0x5c9a3c[_0x5814('0x3b')]['id']}},_0x37aaf1={};_0x37aaf1[_0x5814('0x21')]=_[_0x5814('0x3c')](db['Variable'][_0x5814('0x20')]);_0x37aaf1[_0x5814('0x23')]=_[_0x5814('0x3c')](_0x5c9a3c[_0x5814('0x23')]);_0x37aaf1[_0x5814('0x25')]=_[_0x5814('0x27')](_0x37aaf1[_0x5814('0x21')],_0x37aaf1[_0x5814('0x23')]);_0x1783ca['attributes']=_[_0x5814('0x27')](_0x37aaf1[_0x5814('0x21')],qs['fields'](_0x5c9a3c['query'][_0x5814('0x28')]));_0x1783ca[_0x5814('0x26')]=_0x1783ca[_0x5814('0x26')]['length']?_0x1783ca['attributes']:_0x37aaf1[_0x5814('0x21')];if(_0x5c9a3c[_0x5814('0x23')][_0x5814('0x36')]){_0x1783ca['include']=[{'all':!![]}];}_0x1783ca=_['merge']({},_0x1783ca,_0x5c9a3c[_0x5814('0x35')]);return db[_0x5814('0x1f')][_0x5814('0x3d')](_0x1783ca)[_0x5814('0x1a')](handleEntityNotFound(_0x5d5569,null))[_0x5814('0x1a')](respondWithResult(_0x5d5569,null))[_0x5814('0x39')](handleError(_0x5d5569,null));};exports['create']=function(_0x3fce44,_0x242adf){return db['Variable'][_0x5814('0x3e')](_0x3fce44[_0x5814('0x3f')],{})[_0x5814('0x1a')](respondWithResult(_0x242adf,0xc9))[_0x5814('0x39')](handleError(_0x242adf,null));};exports['update']=function(_0x2328b1,_0x4f15dd){if(_0x2328b1[_0x5814('0x3f')]['id']){delete _0x2328b1[_0x5814('0x3f')]['id'];}return db['Variable'][_0x5814('0x3d')]({'where':{'id':_0x2328b1['params']['id']}})[_0x5814('0x1a')](handleEntityNotFound(_0x4f15dd,null))['then'](saveUpdates(_0x2328b1[_0x5814('0x3f')],null))['then'](respondWithResult(_0x4f15dd,null))[_0x5814('0x39')](handleError(_0x4f15dd,null));};exports['destroy']=function(_0x4f3e96,_0x190716){return db['Variable'][_0x5814('0x3d')]({'where':{'id':_0x4f3e96['params']['id']}})[_0x5814('0x1a')](handleEntityNotFound(_0x190716,null))['then'](removeEntity(_0x190716,null))[_0x5814('0x39')](handleError(_0x190716,null));}; \ No newline at end of file +var _0x0a9f=['create','body','update','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','json','apply','reject','then','destroy','error','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','add','day','merge','where','filter','map','options','includeAll','include','Variable','rows','catch','show','params','find'];(function(_0x728a0d,_0x44ca89){var _0xc575ed=function(_0x418c03){while(--_0x418c03){_0x728a0d['push'](_0x728a0d['shift']());}};_0xc575ed(++_0x44ca89);}(_0x0a9f,0xcc));var _0xf0a9=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0x0a9f[_0x313c96];return _0x522f53;};'use strict';var jsonpatch=require(_0xf0a9('0x0'));var rp=require(_0xf0a9('0x1'));var moment=require(_0xf0a9('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf0a9('0x3'));var util=require(_0xf0a9('0x4'));var path=require(_0xf0a9('0x5'));var sox=require(_0xf0a9('0x6'));var csv=require(_0xf0a9('0x7'));var ejs=require(_0xf0a9('0x8'));var fs=require('fs');var _=require(_0xf0a9('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf0a9('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf0a9('0x7'));var querystring=require(_0xf0a9('0xb'));var Papa=require(_0xf0a9('0xc'));var qs=require('../../components/parsers/qs');var logger=require(_0xf0a9('0xd'))(_0xf0a9('0xe'));var utils=require(_0xf0a9('0xf'));var config=require(_0xf0a9('0x10'));var db=require(_0xf0a9('0x11'))['db'];function respondWithStatusCode(_0x5c752f,_0x5b286d){_0x5b286d=_0x5b286d||0xcc;return function(_0x5b2dfa){if(_0x5b2dfa){return _0x5c752f[_0xf0a9('0x12')](_0x5b286d);}return _0x5c752f['status'](_0x5b286d)[_0xf0a9('0x13')]();};}function respondWithResult(_0x2f0444,_0x2d2706){_0x2d2706=_0x2d2706||0xc8;return function(_0x514df7){if(_0x514df7){return _0x2f0444[_0xf0a9('0x14')](_0x2d2706)['json'](_0x514df7);}};}function respondWithFilteredResult(_0x1d61a6,_0x3a42e9){return function(_0x2b3ac3){if(_0x2b3ac3){var _0x3aa746=_0x2b3ac3[_0xf0a9('0x15')],_0x4046d5=_0x3a42e9[_0xf0a9('0x16')],_0x2cc441=_0x3a42e9[_0xf0a9('0x16')]+_0x3a42e9[_0xf0a9('0x17')],_0x323b76;if(_0x2cc441>=_0x3aa746){_0x2cc441=_0x3aa746;_0x323b76=0xc8;}else{_0x323b76=0xce;}_0x1d61a6[_0xf0a9('0x14')](_0x323b76);return _0x1d61a6[_0xf0a9('0x18')]('Content-Range',_0x4046d5+'-'+_0x2cc441+'/'+_0x3aa746)[_0xf0a9('0x19')](_0x2b3ac3);}return null;};}function patchUpdates(_0x3f0bc3){return function(_0x324c1a){try{jsonpatch[_0xf0a9('0x1a')](_0x324c1a,_0x3f0bc3,!![]);}catch(_0xe7c61b){return BPromise[_0xf0a9('0x1b')](_0xe7c61b);}return _0x324c1a['save']();};}function saveUpdates(_0x3c358e,_0x430b58){return function(_0x35ce3f){if(_0x35ce3f){return _0x35ce3f['update'](_0x3c358e)[_0xf0a9('0x1c')](function(_0x17cbda){return _0x17cbda;});}return null;};}function removeEntity(_0x3c739d,_0x5eb233){return function(_0x395af1){if(_0x395af1){return _0x395af1[_0xf0a9('0x1d')]()['then'](function(){_0x3c739d[_0xf0a9('0x14')](0xcc)[_0xf0a9('0x13')]();});}};}function handleEntityNotFound(_0x2e5f03,_0x469bdf){return function(_0x15ae46){if(!_0x15ae46){_0x2e5f03[_0xf0a9('0x12')](0x194);}return _0x15ae46;};}function handleError(_0x3cdb7,_0x961f39){_0x961f39=_0x961f39||0x1f4;return function(_0x40a58e){logger[_0xf0a9('0x1e')](_0x40a58e['stack']);if(_0x40a58e[_0xf0a9('0x1f')]){delete _0x40a58e[_0xf0a9('0x1f')];}_0x3cdb7['status'](_0x961f39)[_0xf0a9('0x20')](_0x40a58e);};}exports[_0xf0a9('0x21')]=function(_0x5eda5a,_0x421144){var _0x5de2e4={},_0x3e56c2={},_0x58b9be={'count':0x0,'rows':[]};var _0x20c80c=db['Variable'][_0xf0a9('0x22')];_0x3e56c2[_0xf0a9('0x23')]=_[_0xf0a9('0x24')](_0x20c80c);var _0x5de749={'dateStart':_0x5eda5a[_0xf0a9('0x25')]['dateStart'],'dateEnd':_0x5eda5a[_0xf0a9('0x25')]['dateEnd']};delete _0x5eda5a[_0xf0a9('0x25')][_0xf0a9('0x26')];delete _0x5eda5a[_0xf0a9('0x25')][_0xf0a9('0x27')];_0x3e56c2['query']=_['keys'](_0x5eda5a[_0xf0a9('0x25')]);_0x3e56c2[_0xf0a9('0x28')]=_[_0xf0a9('0x29')](_0x3e56c2[_0xf0a9('0x23')],_0x3e56c2['query']);_0x5de2e4[_0xf0a9('0x2a')]=_['intersection'](_0x3e56c2[_0xf0a9('0x23')],qs[_0xf0a9('0x2b')](_0x5eda5a[_0xf0a9('0x25')][_0xf0a9('0x2b')]));_0x5de2e4[_0xf0a9('0x2a')]=_0x5de2e4[_0xf0a9('0x2a')][_0xf0a9('0x2c')]?_0x5de2e4['attributes']:_0x3e56c2[_0xf0a9('0x23')];if(!_0x5eda5a[_0xf0a9('0x25')][_0xf0a9('0x2d')](_0xf0a9('0x2e'))){_0x5de2e4['limit']=qs[_0xf0a9('0x17')](_0x5eda5a[_0xf0a9('0x25')][_0xf0a9('0x17')]);_0x5de2e4[_0xf0a9('0x16')]=qs[_0xf0a9('0x16')](_0x5eda5a[_0xf0a9('0x25')]['offset']);}_0x5de2e4[_0xf0a9('0x2f')]=qs['sort'](_0x5eda5a[_0xf0a9('0x25')][_0xf0a9('0x30')]);_0x5de2e4['where']=qs[_0xf0a9('0x28')](_['pick'](_0x5eda5a[_0xf0a9('0x25')],_0x3e56c2['filters']));if(_0x5de749[_0xf0a9('0x26')]){if(_0x5de749[_0xf0a9('0x27')]){_0x5de749[_0xf0a9('0x27')]=moment(_0x5de749[_0xf0a9('0x27')])[_0xf0a9('0x31')](0x1,_0xf0a9('0x32'));}else{_0x5de749[_0xf0a9('0x27')]=moment(_0x5de749[_0xf0a9('0x26')])[_0xf0a9('0x31')](0x1,_0xf0a9('0x32'));}_[_0xf0a9('0x33')](_0x5de2e4[_0xf0a9('0x34')],{'createdAt':{'$gte':_0x5de749[_0xf0a9('0x26')],'$lte':_0x5de749[_0xf0a9('0x27')]}});}if(_0x5eda5a[_0xf0a9('0x25')][_0xf0a9('0x35')]){_0x5de2e4['where']=_['merge'](_0x5de2e4[_0xf0a9('0x34')],{'$or':_[_0xf0a9('0x36')](_0x5de2e4[_0xf0a9('0x2a')],function(_0x1b501f){var _0x321601={};_0x321601[_0x1b501f]={'$like':'%'+_0x5eda5a[_0xf0a9('0x25')]['filter']+'%'};return _0x321601;})});}_0x5de2e4=_[_0xf0a9('0x33')]({},_0x5de2e4,_0x5eda5a[_0xf0a9('0x37')]);var _0xd6b0ab={'where':_0x5de2e4[_0xf0a9('0x34')]};return db['Variable'][_0xf0a9('0x15')](_0xd6b0ab)['then'](function(_0x464f33){_0x58b9be['count']=_0x464f33;if(_0x5eda5a[_0xf0a9('0x25')][_0xf0a9('0x38')]){_0x5de2e4[_0xf0a9('0x39')]=[{'all':!![]}];}return db[_0xf0a9('0x3a')]['findAll'](_0x5de2e4);})[_0xf0a9('0x1c')](function(_0x17f28d){_0x58b9be[_0xf0a9('0x3b')]=_0x17f28d;return _0x58b9be;})[_0xf0a9('0x1c')](respondWithFilteredResult(_0x421144,_0x5de2e4))[_0xf0a9('0x3c')](handleError(_0x421144,null));};exports[_0xf0a9('0x3d')]=function(_0x380f6d,_0x26935a){var _0x5ef9cd={'raw':!![],'where':{'id':_0x380f6d[_0xf0a9('0x3e')]['id']}},_0x48b8e5={};_0x48b8e5[_0xf0a9('0x23')]=_[_0xf0a9('0x24')](db[_0xf0a9('0x3a')][_0xf0a9('0x22')]);_0x48b8e5[_0xf0a9('0x25')]=_[_0xf0a9('0x24')](_0x380f6d[_0xf0a9('0x25')]);_0x48b8e5[_0xf0a9('0x28')]=_[_0xf0a9('0x29')](_0x48b8e5[_0xf0a9('0x23')],_0x48b8e5['query']);_0x5ef9cd['attributes']=_[_0xf0a9('0x29')](_0x48b8e5['model'],qs[_0xf0a9('0x2b')](_0x380f6d[_0xf0a9('0x25')]['fields']));_0x5ef9cd[_0xf0a9('0x2a')]=_0x5ef9cd[_0xf0a9('0x2a')]['length']?_0x5ef9cd[_0xf0a9('0x2a')]:_0x48b8e5[_0xf0a9('0x23')];if(_0x380f6d['query'][_0xf0a9('0x38')]){_0x5ef9cd[_0xf0a9('0x39')]=[{'all':!![]}];}_0x5ef9cd=_[_0xf0a9('0x33')]({},_0x5ef9cd,_0x380f6d[_0xf0a9('0x37')]);return db[_0xf0a9('0x3a')][_0xf0a9('0x3f')](_0x5ef9cd)[_0xf0a9('0x1c')](handleEntityNotFound(_0x26935a,null))[_0xf0a9('0x1c')](respondWithResult(_0x26935a,null))[_0xf0a9('0x3c')](handleError(_0x26935a,null));};exports[_0xf0a9('0x40')]=function(_0x24643c,_0xa1ddd){return db[_0xf0a9('0x3a')][_0xf0a9('0x40')](_0x24643c[_0xf0a9('0x41')],{})[_0xf0a9('0x1c')](respondWithResult(_0xa1ddd,0xc9))[_0xf0a9('0x3c')](handleError(_0xa1ddd,null));};exports[_0xf0a9('0x42')]=function(_0x453122,_0x4c028a){if(_0x453122[_0xf0a9('0x41')]['id']){delete _0x453122[_0xf0a9('0x41')]['id'];}return db['Variable'][_0xf0a9('0x3f')]({'where':{'id':_0x453122[_0xf0a9('0x3e')]['id']}})[_0xf0a9('0x1c')](handleEntityNotFound(_0x4c028a,null))[_0xf0a9('0x1c')](saveUpdates(_0x453122[_0xf0a9('0x41')],null))[_0xf0a9('0x1c')](respondWithResult(_0x4c028a,null))[_0xf0a9('0x3c')](handleError(_0x4c028a,null));};exports[_0xf0a9('0x1d')]=function(_0x4333d8,_0x54361c){return db[_0xf0a9('0x3a')][_0xf0a9('0x3f')]({'where':{'id':_0x4333d8['params']['id']}})[_0xf0a9('0x1c')](handleEntityNotFound(_0x54361c,null))[_0xf0a9('0x1c')](removeEntity(_0x54361c,null))[_0xf0a9('0x3c')](handleError(_0x54361c,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 2d0ea2d..ee4c425 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(_0x147a36,_0x1d475b){var _0x1abb1a=function(_0xec2ba8){while(--_0xec2ba8){_0x147a36['push'](_0x147a36['shift']());}};_0x1abb1a(++_0x1d475b);}(_0x2ef3,0xba));var _0x32ef=function(_0x1dcff2,_0x12c6be){_0x1dcff2=_0x1dcff2-0x0;var _0x44b4a6=_0x2ef3[_0x1dcff2];return _0x44b4a6;};'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 _0x4975=['./variable.attributes','exports','define','tools_variables','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x31ac36,_0x12a7d9){var _0x35cd0a=function(_0x4229ee){while(--_0x4229ee){_0x31ac36['push'](_0x31ac36['shift']());}};_0x35cd0a(++_0x12a7d9);}(_0x4975,0x86));var _0x5497=function(_0x5bf756,_0x4f1779){_0x5bf756=_0x5bf756-0x0;var _0x1cd599=_0x4975[_0x5bf756];return _0x1cd599;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var attributes=require(_0x5497('0x6'));module[_0x5497('0x7')]=function(_0xeb31af,_0xbb1888){return _0xeb31af[_0x5497('0x8')]('Variable',attributes,{'tableName':_0x5497('0x9'),'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 9b398fa..c08f08a 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 _0xe9b4=['client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','Variable','find','options','raw','attributes','map','include','model','stringify','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x888fe5,_0x2c1477){var _0x3fa3bb=function(_0x833515){while(--_0x833515){_0x888fe5['push'](_0x888fe5['shift']());}};_0x3fa3bb(++_0x2c1477);}(_0xe9b4,0x106));var _0x4e9b=function(_0x2eabfa,_0x36e3ff){_0x2eabfa=_0x2eabfa-0x0;var _0x401a26=_0xe9b4[_0x2eabfa];return _0x401a26;};'use strict';var _=require(_0x4e9b('0x0'));var util=require(_0x4e9b('0x1'));var moment=require(_0x4e9b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0x4e9b('0x3'))['db'];var utils=require(_0x4e9b('0x4'));var logger=require('../../config/logger')(_0x4e9b('0x5'));var config=require(_0x4e9b('0x6'));var jayson=require(_0x4e9b('0x7'));var client=jayson[_0x4e9b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b5b8e,_0xcedaa6,_0x2795c6){return new BPromise(function(_0x1917bc,_0x342675){return client['request'](_0x4b5b8e,_0x2795c6)[_0x4e9b('0x9')](function(_0x2b6204){logger[_0x4e9b('0xa')](_0x4e9b('0xb'),_0xcedaa6,_0x4e9b('0xc'));logger[_0x4e9b('0xd')](_0x4e9b('0xe'),_0xcedaa6,_0x4e9b('0xc'),JSON['stringify'](_0x2b6204));if(_0x2b6204[_0x4e9b('0xf')]){if(_0x2b6204['error'][_0x4e9b('0x10')]===0x1f4){logger[_0x4e9b('0xf')](_0x4e9b('0xb'),_0xcedaa6,_0x2b6204[_0x4e9b('0xf')][_0x4e9b('0x11')]);return _0x342675(_0x2b6204[_0x4e9b('0xf')][_0x4e9b('0x11')]);}logger['error']('Variable,\x20%s,\x20%s',_0xcedaa6,_0x2b6204[_0x4e9b('0xf')][_0x4e9b('0x11')]);return _0x1917bc(_0x2b6204['error'][_0x4e9b('0x11')]);}else{logger[_0x4e9b('0xa')](_0x4e9b('0xb'),_0xcedaa6,_0x4e9b('0xc'));_0x1917bc(_0x2b6204[_0x4e9b('0x12')][_0x4e9b('0x11')]);}})[_0x4e9b('0x13')](function(_0x2f33ef){logger['error'](_0x4e9b('0xb'),_0xcedaa6,_0x2f33ef);_0x342675(_0x2f33ef);});});}exports[_0x4e9b('0x14')]=function(_0x559353){var _0x31dfef=this;return new Promise(function(_0x1f3a6c,_0x4239c4){return db[_0x4e9b('0x15')][_0x4e9b('0x16')]({'raw':_0x559353['options']?_0x559353[_0x4e9b('0x17')][_0x4e9b('0x18')]===undefined?!![]:![]:!![],'where':_0x559353[_0x4e9b('0x17')]?_0x559353[_0x4e9b('0x17')]['where']||null:null,'attributes':_0x559353[_0x4e9b('0x17')]?_0x559353['options'][_0x4e9b('0x19')]||null:null,'include':_0x559353['options']?_0x559353[_0x4e9b('0x17')]['include']?_[_0x4e9b('0x1a')](_0x559353[_0x4e9b('0x17')][_0x4e9b('0x1b')],function(_0x53f3cd){return{'model':db[_0x53f3cd[_0x4e9b('0x1c')]],'as':_0x53f3cd['as'],'attributes':_0x53f3cd[_0x4e9b('0x19')],'include':_0x53f3cd[_0x4e9b('0x1b')]?_[_0x4e9b('0x1a')](_0x53f3cd['include'],function(_0x3931ce){return{'model':db[_0x3931ce[_0x4e9b('0x1c')]],'as':_0x3931ce['as'],'attributes':_0x3931ce[_0x4e9b('0x19')],'include':_0x3931ce[_0x4e9b('0x1b')]?_[_0x4e9b('0x1a')](_0x3931ce[_0x4e9b('0x1b')],function(_0x35e076){return{'model':db[_0x35e076['model']],'as':_0x35e076['as'],'attributes':_0x35e076[_0x4e9b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4e9b('0x9')](function(_0x56d483){logger[_0x4e9b('0xa')](_0x4e9b('0x14'),_0x559353);logger[_0x4e9b('0xd')](_0x4e9b('0x14'),_0x559353,JSON[_0x4e9b('0x1d')](_0x56d483));_0x1f3a6c(_0x56d483);})[_0x4e9b('0x13')](function(_0x5238c3){logger[_0x4e9b('0xf')](_0x4e9b('0x14'),_0x5238c3[_0x4e9b('0x11')],_0x559353);_0x4239c4(_0x31dfef[_0x4e9b('0xf')](0x1f4,_0x5238c3[_0x4e9b('0x11')]));});});}; \ No newline at end of file +var _0x8f73=['map','model','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','Variable,\x20%s,\x20%s','message','ShowVariable','Variable','options','attributes','include'];(function(_0x1c55f1,_0x3669ca){var _0x44dd27=function(_0x531d3e){while(--_0x531d3e){_0x1c55f1['push'](_0x1c55f1['shift']());}};_0x44dd27(++_0x3669ca);}(_0x8f73,0xa4));var _0x38f7=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x8f73[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x38f7('0x0'));var util=require(_0x38f7('0x1'));var moment=require(_0x38f7('0x2'));var BPromise=require(_0x38f7('0x3'));var rs=require(_0x38f7('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x38f7('0x5'));var config=require(_0x38f7('0x6'));var jayson=require(_0x38f7('0x7'));var client=jayson[_0x38f7('0x8')][_0x38f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xca05f,_0x52cd7e,_0x43370d){return new BPromise(function(_0xf310f4,_0x437398){return client['request'](_0xca05f,_0x43370d)[_0x38f7('0xa')](function(_0xe8c469){logger[_0x38f7('0xb')]('Variable,\x20%s,\x20%s',_0x52cd7e,_0x38f7('0xc'));logger[_0x38f7('0xd')](_0x38f7('0xe'),_0x52cd7e,_0x38f7('0xc'),JSON[_0x38f7('0xf')](_0xe8c469));if(_0xe8c469[_0x38f7('0x10')]){if(_0xe8c469[_0x38f7('0x10')][_0x38f7('0x11')]===0x1f4){logger['error'](_0x38f7('0x12'),_0x52cd7e,_0xe8c469[_0x38f7('0x10')][_0x38f7('0x13')]);return _0x437398(_0xe8c469['error'][_0x38f7('0x13')]);}logger[_0x38f7('0x10')](_0x38f7('0x12'),_0x52cd7e,_0xe8c469[_0x38f7('0x10')]['message']);return _0xf310f4(_0xe8c469['error'][_0x38f7('0x13')]);}else{logger[_0x38f7('0xb')](_0x38f7('0x12'),_0x52cd7e,'request\x20sent');_0xf310f4(_0xe8c469['result'][_0x38f7('0x13')]);}})['catch'](function(_0x241698){logger[_0x38f7('0x10')](_0x38f7('0x12'),_0x52cd7e,_0x241698);_0x437398(_0x241698);});});}exports[_0x38f7('0x14')]=function(_0x89383b){var _0x15cb39=this;return new Promise(function(_0x4fe41e,_0x2905ba){return db[_0x38f7('0x15')]['find']({'raw':_0x89383b[_0x38f7('0x16')]?_0x89383b[_0x38f7('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x89383b[_0x38f7('0x16')]?_0x89383b[_0x38f7('0x16')]['where']||null:null,'attributes':_0x89383b[_0x38f7('0x16')]?_0x89383b['options'][_0x38f7('0x17')]||null:null,'include':_0x89383b[_0x38f7('0x16')]?_0x89383b[_0x38f7('0x16')][_0x38f7('0x18')]?_[_0x38f7('0x19')](_0x89383b[_0x38f7('0x16')][_0x38f7('0x18')],function(_0x21150f){return{'model':db[_0x21150f[_0x38f7('0x1a')]],'as':_0x21150f['as'],'attributes':_0x21150f[_0x38f7('0x17')],'include':_0x21150f[_0x38f7('0x18')]?_['map'](_0x21150f[_0x38f7('0x18')],function(_0xba59a){return{'model':db[_0xba59a[_0x38f7('0x1a')]],'as':_0xba59a['as'],'attributes':_0xba59a[_0x38f7('0x17')],'include':_0xba59a[_0x38f7('0x18')]?_['map'](_0xba59a['include'],function(_0x4e519f){return{'model':db[_0x4e519f[_0x38f7('0x1a')]],'as':_0x4e519f['as'],'attributes':_0x4e519f[_0x38f7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x38f7('0xa')](function(_0x195397){logger[_0x38f7('0xb')](_0x38f7('0x14'),_0x89383b);logger[_0x38f7('0xd')](_0x38f7('0x14'),_0x89383b,JSON[_0x38f7('0xf')](_0x195397));_0x4fe41e(_0x195397);})['catch'](function(_0x22c023){logger[_0x38f7('0x10')](_0x38f7('0x14'),_0x22c023[_0x38f7('0x13')],_0x89383b);_0x2905ba(_0x15cb39[_0x38f7('0x10')](0x1f4,_0x22c023['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 183e324..49c45e2 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 _0x4f3b=['migrations','exports','express','../../components/auth/service','./version.controller','get','isAuthenticated','canUpdate','fetch','pull','/restart','restart','/migrations'];(function(_0x563227,_0x2b13bc){var _0x43def3=function(_0x3f8c01){while(--_0x3f8c01){_0x563227['push'](_0x563227['shift']());}};_0x43def3(++_0x2b13bc);}(_0x4f3b,0x147));var _0xb4f3=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x4f3b[_0x126558];return _0x1f6d14;};'use strict';var express=require(_0xb4f3('0x0'));var router=express['Router']();var auth=require(_0xb4f3('0x1'));var controller=require(_0xb4f3('0x2'));router[_0xb4f3('0x3')]('/',controller['index']);router[_0xb4f3('0x3')]('/fetch',auth[_0xb4f3('0x4')](),auth[_0xb4f3('0x5')](),controller[_0xb4f3('0x6')]);router[_0xb4f3('0x3')]('/reset',auth[_0xb4f3('0x4')](),auth[_0xb4f3('0x5')](),controller['reset']);router[_0xb4f3('0x3')]('/pull',auth[_0xb4f3('0x4')](),auth[_0xb4f3('0x5')](),controller[_0xb4f3('0x7')]);router[_0xb4f3('0x3')](_0xb4f3('0x8'),auth[_0xb4f3('0x4')](),controller[_0xb4f3('0x9')]);router[_0xb4f3('0x3')](_0xb4f3('0xa'),controller[_0xb4f3('0xb')]);module[_0xb4f3('0xc')]=router; \ No newline at end of file +var _0x4e50=['/pull','/restart','/migrations','migrations','exports','express','../../components/auth/service','./version.controller','get','/fetch','canUpdate','fetch','/reset','isAuthenticated'];(function(_0x23d7fd,_0x16d5b1){var _0x475743=function(_0x32a188){while(--_0x32a188){_0x23d7fd['push'](_0x23d7fd['shift']());}};_0x475743(++_0x16d5b1);}(_0x4e50,0x1b7));var _0x04e5=function(_0x5c225c,_0x5b0b1f){_0x5c225c=_0x5c225c-0x0;var _0x1668e7=_0x4e50[_0x5c225c];return _0x1668e7;};'use strict';var express=require(_0x04e5('0x0'));var router=express['Router']();var auth=require(_0x04e5('0x1'));var controller=require(_0x04e5('0x2'));router['get']('/',controller['index']);router[_0x04e5('0x3')](_0x04e5('0x4'),auth['isAuthenticated'](),auth[_0x04e5('0x5')](),controller[_0x04e5('0x6')]);router[_0x04e5('0x3')](_0x04e5('0x7'),auth[_0x04e5('0x8')](),auth['canUpdate'](),controller['reset']);router['get'](_0x04e5('0x9'),auth['isAuthenticated'](),auth[_0x04e5('0x5')](),controller['pull']);router['get'](_0x04e5('0xa'),auth[_0x04e5('0x8')](),controller['restart']);router[_0x04e5('0x3')](_0x04e5('0xb'),controller[_0x04e5('0xc')]);module[_0x04e5('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 17f1473..45d314e 100644 --- a/server/api/version/version.controller.js +++ b/server/api/version/version.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['status','json','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','catch','migrations','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','server','.js','Database\x20Migration\x20Completed!','umzug','path','pkginfo','version','exec','../../mysqldb','../../config/environment','../../config/pm2','update','simple-git','root','index','exports','query','latest','fetch','tags'];(function(_0x5adcfe,_0xa10d0f){var _0x237deb=function(_0x2665d4){while(--_0x2665d4){_0x5adcfe['push'](_0x5adcfe['shift']());}};_0x237deb(++_0xa10d0f);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var Umzug=require(_0x7995('0x0'));var path=require(_0x7995('0x1'));var pkginfo=require(_0x7995('0x2'))(module,_0x7995('0x3'));var exec=require('child_process')[_0x7995('0x4')];var db=require(_0x7995('0x5'))['db'];var config=require(_0x7995('0x6'));var pm2=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var git=require(_0x7995('0x9'))(config[_0x7995('0xa')]);exports[_0x7995('0xb')]=function(_0xbda126,_0x326741){var _0x4996ca={'current':module[_0x7995('0xc')][_0x7995('0x3')],'phonebar':0x2};if(_0xbda126['query']&&_0xbda126[_0x7995('0xd')][_0x7995('0xe')]){return git[_0x7995('0xf')]()[_0x7995('0x10')](function(_0x3c1d19,_0x1e400a){_0x4996ca[_0x7995('0xe')]=(_0x3c1d19?module['exports'][_0x7995('0x3')]:_0x1e400a[_0x7995('0xe')])||'2.0.0';return _0x326741[_0x7995('0x11')](0xc8)[_0x7995('0x12')](_0x4996ca);});}else{return _0x326741[_0x7995('0x11')](0xc8)[_0x7995('0x12')](_0x4996ca);}};exports[_0x7995('0xf')]=function(_0x23999f,_0x2bbe7a){return git['fetch'](['origin',_0x7995('0x13')],function(_0x2233dd){if(_0x2233dd){logger[_0x7995('0x14')](_0x2233dd);return _0x2bbe7a[_0x7995('0x11')](0x1f4)[_0x7995('0x12')](_0x2233dd);}logger[_0x7995('0x15')](_0x7995('0x16'));return _0x2bbe7a[_0x7995('0x11')](0xc8)['json']({'output':_0x7995('0x17')});});};exports['reset']=function(_0x2f832e,_0x37f297){return git[_0x7995('0x18')]([_0x7995('0x19'),_0x7995('0x1a')],function(_0x37a7d4){if(_0x37a7d4){logger['error'](_0x37a7d4);return _0x37f297['status'](0x1f4)[_0x7995('0x12')](_0x37a7d4);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x37f297[_0x7995('0x11')](0xc8)[_0x7995('0x12')]({'output':'git\x20reset\x20--hard'});});};exports[_0x7995('0x1b')]=function(_0x51f276,_0x4b1a8e){exec(_0x7995('0x1c'),function(_0x327b1f,_0x350fd9,_0x1a8568){logger[_0x7995('0x15')](_0x350fd9);logger[_0x7995('0x15')](_0x1a8568);if(_0x327b1f){logger['error'](_0x327b1f);return _0x4b1a8e[_0x7995('0x11')](0x1f4)[_0x7995('0x12')](_0x327b1f);}return _0x4b1a8e[_0x7995('0x11')](0xc8)[_0x7995('0x12')]({'output':_0x350fd9});});};exports[_0x7995('0x1d')]=function(_0x13bc35,_0x475351){return pm2[_0x7995('0x1d')]('motion2')[_0x7995('0x1e')](function(_0x34e70c){logger[_0x7995('0x15')](_0x7995('0x1f'),_0x34e70c);return _0x475351[_0x7995('0x11')](0xc8)[_0x7995('0x12')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x7995('0x20')](function(_0x5911c3){logger[_0x7995('0x14')](_0x5911c3);return _0x475351[_0x7995('0x11')](0x1f4)[_0x7995('0x12')](_0x5911c3);});};exports[_0x7995('0x21')]=function(_0x11c1eb,_0x4b6f99){var _0x9b2a15=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x7995('0x22')],'modelName':_0x7995('0x22'),'columnName':_0x7995('0x3')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db['sequelize'][_0x7995('0x23')],function(){throw new Error(_0x7995('0x24'));}],'path':path[_0x7995('0x25')](config[_0x7995('0xa')],_0x7995('0x26'),_0x7995('0x21')),'pattern':/\.js$/}});_0x9b2a15['up']({'from':module['exports']['version']+_0x7995('0x27')})['then'](function(){return _0x4b6f99[_0x7995('0x11')](0xc8)[_0x7995('0x12')]({'output':_0x7995('0x28')});})[_0x7995('0x20')](function(_0x1f7d27){return _0x4b6f99['status'](0x1f4)[_0x7995('0x12')](_0x1f7d27);});}; \ No newline at end of file +var _0xa9e0=['master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','root','server','exports','.js','catch','umzug','path','pkginfo','exec','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','version','latest','fetch','tags','status','json','origin'];(function(_0x162538,_0x2812d1){var _0x2a71b2=function(_0x1d6c9e){while(--_0x1d6c9e){_0x162538['push'](_0x162538['shift']());}};_0x2a71b2(++_0x2812d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 1ddb26e..5ca9d1a 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(_0x25092d,_0x5c74e7){var _0x5ec5cf=function(_0x4883c0){while(--_0x4883c0){_0x25092d['push'](_0x25092d['shift']());}};_0x5ec5cf(++_0x5c74e7);}(_0x7a54,0x106));var _0x47a5=function(_0x406c63,_0x3d9b9c){_0x406c63=_0x406c63-0x0;var _0x4912bb=_0x7a54[_0x406c63];return _0x4912bb;};'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(_0x5ebb1e,_0x1108de){var _0x52f768=function(_0x4605a2){while(--_0x4605a2){_0x5ebb1e['push'](_0x5ebb1e['shift']());}};_0x52f768(++_0x1108de);}(_0x7a54,0x106));var _0x47a5=function(_0x1e7be9,_0x17ab14){_0x1e7be9=_0x1e7be9-0x0;var _0x1df1e1=_0x7a54[_0x1e7be9];return _0x1df1e1;};'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 6a6ad1d..4d2267a 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 _0x2d7d=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x149a9b,_0x5bb275){var _0x2c2bf6=function(_0xfe0c14){while(--_0xfe0c14){_0x149a9b['push'](_0x149a9b['shift']());}};_0x2c2bf6(++_0x5bb275);}(_0x2d7d,0x15b));var _0xd2d7=function(_0x12b2a4,_0x8cdedb){_0x12b2a4=_0x12b2a4-0x0;var _0x13ff03=_0x2d7d[_0x12b2a4];return _0x13ff03;};'use strict';var Sequelize=require(_0xd2d7('0x0'));module[_0xd2d7('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd2d7('0x2')]},'calleridnum':{'type':Sequelize[_0xd2d7('0x2')]},'calleridname':{'type':Sequelize[_0xd2d7('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xd2d7('0x3')]},'agentconnectAt':{'type':Sequelize[_0xd2d7('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xd2d7('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xd2d7('0x3')]},'agentdumpAt':{'type':Sequelize[_0xd2d7('0x3')]},'holdtime':{'type':Sequelize[_0xd2d7('0x4')]},'agentcomplete':{'type':Sequelize[_0xd2d7('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xd2d7('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd2d7('0x4')]},'agentacw':{'type':Sequelize[_0xd2d7('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xd2d7('0x2')]},'lastevent':{'type':Sequelize[_0xd2d7('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xd2d7('0x4')]},'channelstatedesc':{'type':Sequelize[_0xd2d7('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd2d7('0x2')]},'connectedlinename':{'type':Sequelize[_0xd2d7('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd2d7('0x2')]},'context':{'type':Sequelize[_0xd2d7('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd2d7('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xd2d7('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xd2d7('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd2d7('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xd2d7('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd2d7('0x2')]},'destlanguage':{'type':Sequelize[_0xd2d7('0x2')]},'destaccountcode':{'type':Sequelize[_0xd2d7('0x2')]},'destcontext':{'type':Sequelize[_0xd2d7('0x2')]},'destexten':{'type':Sequelize[_0xd2d7('0x2')]},'destpriority':{'type':Sequelize[_0xd2d7('0x2')]},'destuniqueid':{'type':Sequelize[_0xd2d7('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xd2d7('0x2')]}}; \ No newline at end of file +var _0x2f6c=['INTEGER','BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x5c1d92,_0x307ecb){var _0x2bb737=function(_0x2623db){while(--_0x2623db){_0x5c1d92['push'](_0x5c1d92['shift']());}};_0x2bb737(++_0x307ecb);}(_0x2f6c,0xda));var _0xc2f6=function(_0x53b8e0,_0x55d46e){_0x53b8e0=_0x53b8e0-0x0;var _0x10630c=_0x2f6c[_0x53b8e0];return _0x10630c;};'use strict';var Sequelize=require(_0xc2f6('0x0'));module[_0xc2f6('0x1')]={'type':{'type':Sequelize[_0xc2f6('0x2')]},'uniqueid':{'type':Sequelize[_0xc2f6('0x2')]},'calleridnum':{'type':Sequelize[_0xc2f6('0x2')]},'calleridname':{'type':Sequelize[_0xc2f6('0x2')]},'queue':{'type':Sequelize[_0xc2f6('0x2')]},'interface':{'type':Sequelize[_0xc2f6('0x2')]},'membername':{'type':Sequelize[_0xc2f6('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xc2f6('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xc2f6('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xc2f6('0x3')]},'agentdumpAt':{'type':Sequelize[_0xc2f6('0x3')]},'holdtime':{'type':Sequelize[_0xc2f6('0x4')]},'agentcomplete':{'type':Sequelize[_0xc2f6('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xc2f6('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xc2f6('0x4')]},'agentacw':{'type':Sequelize[_0xc2f6('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc2f6('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xc2f6('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xc2f6('0x4')]},'channelstatedesc':{'type':Sequelize[_0xc2f6('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc2f6('0x2')]},'connectedlinename':{'type':Sequelize[_0xc2f6('0x2')]},'language':{'type':Sequelize[_0xc2f6('0x2')]},'accountcode':{'type':Sequelize[_0xc2f6('0x2')]},'context':{'type':Sequelize[_0xc2f6('0x2')]},'exten':{'type':Sequelize[_0xc2f6('0x2')]},'priority':{'type':Sequelize[_0xc2f6('0x2')]},'destchannel':{'type':Sequelize[_0xc2f6('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xc2f6('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc2f6('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc2f6('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xc2f6('0x2')]},'destlanguage':{'type':Sequelize[_0xc2f6('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xc2f6('0x2')]},'destexten':{'type':Sequelize[_0xc2f6('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xc2f6('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xc2f6('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xc2f6('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 7d8c3b5..7ed0a8e 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 _0x3937=['count','includeAll','include','findAll','rows','catch','params','find','create','body','describe','fast-json-patch','moment','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','api','../../config/utils','../../config/environment','end','status','json','offset','Content-Range','update','then','stack','name','send','index','VoiceAgentReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','add','day','merge','where','filter','options'];(function(_0x175563,_0x42a3b2){var _0x57b296=function(_0x222850){while(--_0x222850){_0x175563['push'](_0x175563['shift']());}};_0x57b296(++_0x42a3b2);}(_0x3937,0xbf));var _0x7393=function(_0x3317b2,_0x42d109){_0x3317b2=_0x3317b2-0x0;var _0x5af126=_0x3937[_0x3317b2];return _0x5af126;};'use strict';var jsonpatch=require(_0x7393('0x0'));var rp=require('request-promise');var moment=require(_0x7393('0x1'));var BPromise=require(_0x7393('0x2'));var Mustache=require('mustache');var util=require(_0x7393('0x3'));var path=require('path');var sox=require(_0x7393('0x4'));var csv=require('to-csv');var ejs=require(_0x7393('0x5'));var fs=require('fs');var _=require(_0x7393('0x6'));var squel=require(_0x7393('0x7'));var crypto=require(_0x7393('0x8'));var jsforce=require(_0x7393('0x9'));var deskjs=require(_0x7393('0xa'));var toCsv=require(_0x7393('0xb'));var querystring=require(_0x7393('0xc'));var Papa=require(_0x7393('0xd'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x7393('0xe'));var utils=require(_0x7393('0xf'));var config=require(_0x7393('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xab290c,_0x5f0dd5){_0x5f0dd5=_0x5f0dd5||0xcc;return function(_0x56ed4c){if(_0x56ed4c){return _0xab290c['sendStatus'](_0x5f0dd5);}return _0xab290c['status'](_0x5f0dd5)[_0x7393('0x11')]();};}function respondWithResult(_0x633f9,_0x29d8cc){_0x29d8cc=_0x29d8cc||0xc8;return function(_0x4fb764){if(_0x4fb764){return _0x633f9[_0x7393('0x12')](_0x29d8cc)[_0x7393('0x13')](_0x4fb764);}};}function respondWithFilteredResult(_0x20fb41,_0x3aba71){return function(_0xe86cf4){if(_0xe86cf4){var _0x1fe171=_0xe86cf4['count'],_0x38eaad=_0x3aba71['offset'],_0x212f44=_0x3aba71[_0x7393('0x14')]+_0x3aba71['limit'],_0x11030d;if(_0x212f44>=_0x1fe171){_0x212f44=_0x1fe171;_0x11030d=0xc8;}else{_0x11030d=0xce;}_0x20fb41['status'](_0x11030d);return _0x20fb41['set'](_0x7393('0x15'),_0x38eaad+'-'+_0x212f44+'/'+_0x1fe171)['json'](_0xe86cf4);}return null;};}function patchUpdates(_0x2a1180){return function(_0x18252f){try{jsonpatch['apply'](_0x18252f,_0x2a1180,!![]);}catch(_0x459abf){return BPromise['reject'](_0x459abf);}return _0x18252f['save']();};}function saveUpdates(_0x31c8c2,_0x344bc8){return function(_0x1b032c){if(_0x1b032c){return _0x1b032c[_0x7393('0x16')](_0x31c8c2)[_0x7393('0x17')](function(_0x3e2453){return _0x3e2453;});}return null;};}function removeEntity(_0x21f712,_0x208b9a){return function(_0x546642){if(_0x546642){return _0x546642['destroy']()[_0x7393('0x17')](function(){_0x21f712[_0x7393('0x12')](0xcc)[_0x7393('0x11')]();});}};}function handleEntityNotFound(_0x7fc0ef,_0x131667){return function(_0x52f716){if(!_0x52f716){_0x7fc0ef['sendStatus'](0x194);}return _0x52f716;};}function handleError(_0x544487,_0x2d32cc){_0x2d32cc=_0x2d32cc||0x1f4;return function(_0x5b5ca9){logger['error'](_0x5b5ca9[_0x7393('0x18')]);if(_0x5b5ca9[_0x7393('0x19')]){delete _0x5b5ca9['name'];}_0x544487[_0x7393('0x12')](_0x2d32cc)[_0x7393('0x1a')](_0x5b5ca9);};}exports[_0x7393('0x1b')]=function(_0x3a0a83,_0x3fe456){var _0x2c025f={},_0x1b31b8={},_0x39ddd3={'count':0x0,'rows':[]};var _0x328c47=db[_0x7393('0x1c')][_0x7393('0x1d')];_0x1b31b8[_0x7393('0x1e')]=_[_0x7393('0x1f')](_0x328c47);var _0x4e1fea={'dateStart':_0x3a0a83[_0x7393('0x20')][_0x7393('0x21')],'dateEnd':_0x3a0a83[_0x7393('0x20')][_0x7393('0x22')]};delete _0x3a0a83[_0x7393('0x20')][_0x7393('0x21')];delete _0x3a0a83['query'][_0x7393('0x22')];_0x1b31b8['query']=_[_0x7393('0x1f')](_0x3a0a83['query']);_0x1b31b8[_0x7393('0x23')]=_[_0x7393('0x24')](_0x1b31b8[_0x7393('0x1e')],_0x1b31b8[_0x7393('0x20')]);_0x2c025f[_0x7393('0x25')]=_[_0x7393('0x24')](_0x1b31b8[_0x7393('0x1e')],qs[_0x7393('0x26')](_0x3a0a83[_0x7393('0x20')][_0x7393('0x26')]));_0x2c025f[_0x7393('0x25')]=_0x2c025f[_0x7393('0x25')]['length']?_0x2c025f['attributes']:_0x1b31b8[_0x7393('0x1e')];if(!_0x3a0a83['query'][_0x7393('0x27')]('nolimit')){_0x2c025f[_0x7393('0x28')]=qs['limit'](_0x3a0a83[_0x7393('0x20')][_0x7393('0x28')]);_0x2c025f[_0x7393('0x14')]=qs[_0x7393('0x14')](_0x3a0a83[_0x7393('0x20')][_0x7393('0x14')]);}_0x2c025f[_0x7393('0x29')]=qs[_0x7393('0x2a')](_0x3a0a83[_0x7393('0x20')][_0x7393('0x2a')]);_0x2c025f['where']=qs[_0x7393('0x23')](_['pick'](_0x3a0a83[_0x7393('0x20')],_0x1b31b8['filters']));if(_0x4e1fea[_0x7393('0x21')]){if(_0x4e1fea[_0x7393('0x22')]){_0x4e1fea[_0x7393('0x22')]=moment(_0x4e1fea[_0x7393('0x22')])[_0x7393('0x2b')](0x1,'day');}else{_0x4e1fea[_0x7393('0x22')]=moment(_0x4e1fea['dateStart'])[_0x7393('0x2b')](0x1,_0x7393('0x2c'));}_[_0x7393('0x2d')](_0x2c025f[_0x7393('0x2e')],{'createdAt':{'$gte':_0x4e1fea[_0x7393('0x21')],'$lte':_0x4e1fea['dateEnd']}});}if(_0x3a0a83['query'][_0x7393('0x2f')]){_0x2c025f[_0x7393('0x2e')]=_[_0x7393('0x2d')](_0x2c025f[_0x7393('0x2e')],{'$or':_['map'](_0x2c025f['attributes'],function(_0x594926){var _0x264393={};_0x264393[_0x594926]={'$like':'%'+_0x3a0a83[_0x7393('0x20')][_0x7393('0x2f')]+'%'};return _0x264393;})});}_0x2c025f=_[_0x7393('0x2d')]({},_0x2c025f,_0x3a0a83[_0x7393('0x30')]);var _0x406b35={'where':_0x2c025f[_0x7393('0x2e')]};return db[_0x7393('0x1c')][_0x7393('0x31')](_0x406b35)[_0x7393('0x17')](function(_0xc39c05){_0x39ddd3[_0x7393('0x31')]=_0xc39c05;if(_0x3a0a83[_0x7393('0x20')][_0x7393('0x32')]){_0x2c025f[_0x7393('0x33')]=[{'all':!![]}];}return db[_0x7393('0x1c')][_0x7393('0x34')](_0x2c025f);})[_0x7393('0x17')](function(_0x445b39){_0x39ddd3[_0x7393('0x35')]=_0x445b39;return _0x39ddd3;})[_0x7393('0x17')](respondWithFilteredResult(_0x3fe456,_0x2c025f))[_0x7393('0x36')](handleError(_0x3fe456,null));};exports['show']=function(_0x28dd3e,_0x16bcbf){var _0x25a2a6={'raw':![],'where':{'id':_0x28dd3e[_0x7393('0x37')]['id']}},_0x40ab6d={};_0x40ab6d[_0x7393('0x1e')]=_[_0x7393('0x1f')](db[_0x7393('0x1c')]['rawAttributes']);_0x40ab6d['query']=_[_0x7393('0x1f')](_0x28dd3e['query']);_0x40ab6d[_0x7393('0x23')]=_[_0x7393('0x24')](_0x40ab6d[_0x7393('0x1e')],_0x40ab6d[_0x7393('0x20')]);_0x25a2a6[_0x7393('0x25')]=_[_0x7393('0x24')](_0x40ab6d['model'],qs[_0x7393('0x26')](_0x28dd3e[_0x7393('0x20')][_0x7393('0x26')]));_0x25a2a6[_0x7393('0x25')]=_0x25a2a6[_0x7393('0x25')]['length']?_0x25a2a6['attributes']:_0x40ab6d[_0x7393('0x1e')];if(_0x28dd3e['query'][_0x7393('0x32')]){_0x25a2a6[_0x7393('0x33')]=[{'all':!![]}];}_0x25a2a6=_[_0x7393('0x2d')]({},_0x25a2a6,_0x28dd3e[_0x7393('0x30')]);return db[_0x7393('0x1c')][_0x7393('0x38')](_0x25a2a6)[_0x7393('0x17')](handleEntityNotFound(_0x16bcbf,null))[_0x7393('0x17')](respondWithResult(_0x16bcbf,null))[_0x7393('0x36')](handleError(_0x16bcbf,null));};exports[_0x7393('0x39')]=function(_0x2f19b6,_0x26c327){return db[_0x7393('0x1c')][_0x7393('0x39')](_0x2f19b6[_0x7393('0x3a')],{})['then'](respondWithResult(_0x26c327,0xc9))[_0x7393('0x36')](handleError(_0x26c327,null));};exports[_0x7393('0x16')]=function(_0x27b796,_0x351ba9){if(_0x27b796['body']['id']){delete _0x27b796[_0x7393('0x3a')]['id'];}return db[_0x7393('0x1c')][_0x7393('0x38')]({'where':{'id':_0x27b796[_0x7393('0x37')]['id']}})[_0x7393('0x17')](handleEntityNotFound(_0x351ba9,null))[_0x7393('0x17')](saveUpdates(_0x27b796[_0x7393('0x3a')],null))[_0x7393('0x17')](respondWithResult(_0x351ba9,null))[_0x7393('0x36')](handleError(_0x351ba9,null));};exports['destroy']=function(_0xd3d01d,_0x1f66cb){return db[_0x7393('0x1c')]['find']({'where':{'id':_0xd3d01d[_0x7393('0x37')]['id']}})[_0x7393('0x17')](handleEntityNotFound(_0x1f66cb,null))['then'](removeEntity(_0x1f66cb,null))[_0x7393('0x36')](handleError(_0x1f66cb,null));};exports['describe']=function(_0x396992,_0x575df2){return db[_0x7393('0x1c')][_0x7393('0x3b')]()['then'](respondWithResult(_0x575df2,null))[_0x7393('0x36')](handleError(_0x575df2,null));}; \ No newline at end of file +var _0x57d4=['squel','crypto','jsforce','querystring','../../config/logger','api','../../config/utils','sendStatus','status','end','count','offset','limit','Content-Range','json','save','destroy','then','name','send','index','VoiceAgentReport','rawAttributes','model','keys','query','dateEnd','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','dateStart','day','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x4e6fba,_0x2dd219){var _0xa25635=function(_0x22f875){while(--_0x22f875){_0x4e6fba['push'](_0x4e6fba['shift']());}};_0xa25635(++_0x2dd219);}(_0x57d4,0x78));var _0x457d=function(_0x232a32,_0x281511){_0x232a32=_0x232a32-0x0;var _0x4933f8=_0x57d4[_0x232a32];return _0x4933f8;};'use strict';var jsonpatch=require(_0x457d('0x0'));var rp=require(_0x457d('0x1'));var moment=require('moment');var BPromise=require(_0x457d('0x2'));var Mustache=require(_0x457d('0x3'));var util=require(_0x457d('0x4'));var path=require(_0x457d('0x5'));var sox=require(_0x457d('0x6'));var csv=require(_0x457d('0x7'));var ejs=require(_0x457d('0x8'));var fs=require('fs');var _=require(_0x457d('0x9'));var squel=require(_0x457d('0xa'));var crypto=require(_0x457d('0xb'));var jsforce=require(_0x457d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x457d('0x7'));var querystring=require(_0x457d('0xd'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0x457d('0xe'))(_0x457d('0xf'));var utils=require(_0x457d('0x10'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x568a59,_0x2214e6){_0x2214e6=_0x2214e6||0xcc;return function(_0x38ec93){if(_0x38ec93){return _0x568a59[_0x457d('0x11')](_0x2214e6);}return _0x568a59[_0x457d('0x12')](_0x2214e6)[_0x457d('0x13')]();};}function respondWithResult(_0x149497,_0x354ae4){_0x354ae4=_0x354ae4||0xc8;return function(_0x24cf65){if(_0x24cf65){return _0x149497[_0x457d('0x12')](_0x354ae4)['json'](_0x24cf65);}};}function respondWithFilteredResult(_0x239a20,_0x338e2b){return function(_0x557aa6){if(_0x557aa6){var _0x5e1841=_0x557aa6[_0x457d('0x14')],_0x44740f=_0x338e2b[_0x457d('0x15')],_0x19ac04=_0x338e2b[_0x457d('0x15')]+_0x338e2b[_0x457d('0x16')],_0x3e59d9;if(_0x19ac04>=_0x5e1841){_0x19ac04=_0x5e1841;_0x3e59d9=0xc8;}else{_0x3e59d9=0xce;}_0x239a20[_0x457d('0x12')](_0x3e59d9);return _0x239a20['set'](_0x457d('0x17'),_0x44740f+'-'+_0x19ac04+'/'+_0x5e1841)[_0x457d('0x18')](_0x557aa6);}return null;};}function patchUpdates(_0x2c05ca){return function(_0x55f9c2){try{jsonpatch['apply'](_0x55f9c2,_0x2c05ca,!![]);}catch(_0xc0751f){return BPromise['reject'](_0xc0751f);}return _0x55f9c2[_0x457d('0x19')]();};}function saveUpdates(_0x802f2b,_0x50e78f){return function(_0x2a22b6){if(_0x2a22b6){return _0x2a22b6['update'](_0x802f2b)['then'](function(_0xbdded1){return _0xbdded1;});}return null;};}function removeEntity(_0xe6cfcc,_0x3acb5a){return function(_0x16594b){if(_0x16594b){return _0x16594b[_0x457d('0x1a')]()[_0x457d('0x1b')](function(){_0xe6cfcc[_0x457d('0x12')](0xcc)[_0x457d('0x13')]();});}};}function handleEntityNotFound(_0x2087a5,_0x46fe6a){return function(_0x57f229){if(!_0x57f229){_0x2087a5['sendStatus'](0x194);}return _0x57f229;};}function handleError(_0x4e2dff,_0x14b8de){_0x14b8de=_0x14b8de||0x1f4;return function(_0x5a1be7){logger['error'](_0x5a1be7['stack']);if(_0x5a1be7[_0x457d('0x1c')]){delete _0x5a1be7[_0x457d('0x1c')];}_0x4e2dff['status'](_0x14b8de)[_0x457d('0x1d')](_0x5a1be7);};}exports[_0x457d('0x1e')]=function(_0x12bfca,_0x152cfc){var _0x58991f={},_0x5d6554={},_0x556a8={'count':0x0,'rows':[]};var _0x47feed=db[_0x457d('0x1f')][_0x457d('0x20')];_0x5d6554[_0x457d('0x21')]=_[_0x457d('0x22')](_0x47feed);var _0x54de66={'dateStart':_0x12bfca[_0x457d('0x23')]['dateStart'],'dateEnd':_0x12bfca['query'][_0x457d('0x24')]};delete _0x12bfca[_0x457d('0x23')]['dateStart'];delete _0x12bfca[_0x457d('0x23')][_0x457d('0x24')];_0x5d6554['query']=_[_0x457d('0x22')](_0x12bfca[_0x457d('0x23')]);_0x5d6554[_0x457d('0x25')]=_[_0x457d('0x26')](_0x5d6554[_0x457d('0x21')],_0x5d6554[_0x457d('0x23')]);_0x58991f[_0x457d('0x27')]=_[_0x457d('0x26')](_0x5d6554[_0x457d('0x21')],qs[_0x457d('0x28')](_0x12bfca[_0x457d('0x23')][_0x457d('0x28')]));_0x58991f[_0x457d('0x27')]=_0x58991f[_0x457d('0x27')][_0x457d('0x29')]?_0x58991f[_0x457d('0x27')]:_0x5d6554[_0x457d('0x21')];if(!_0x12bfca[_0x457d('0x23')]['hasOwnProperty'](_0x457d('0x2a'))){_0x58991f[_0x457d('0x16')]=qs['limit'](_0x12bfca['query'][_0x457d('0x16')]);_0x58991f[_0x457d('0x15')]=qs['offset'](_0x12bfca[_0x457d('0x23')][_0x457d('0x15')]);}_0x58991f[_0x457d('0x2b')]=qs[_0x457d('0x2c')](_0x12bfca[_0x457d('0x23')][_0x457d('0x2c')]);_0x58991f[_0x457d('0x2d')]=qs[_0x457d('0x25')](_[_0x457d('0x2e')](_0x12bfca[_0x457d('0x23')],_0x5d6554[_0x457d('0x25')]));if(_0x54de66[_0x457d('0x2f')]){if(_0x54de66[_0x457d('0x24')]){_0x54de66[_0x457d('0x24')]=moment(_0x54de66[_0x457d('0x24')])['add'](0x1,_0x457d('0x30'));}else{_0x54de66['dateEnd']=moment(_0x54de66['dateStart'])['add'](0x1,_0x457d('0x30'));}_['merge'](_0x58991f[_0x457d('0x2d')],{'createdAt':{'$gte':_0x54de66['dateStart'],'$lte':_0x54de66['dateEnd']}});}if(_0x12bfca[_0x457d('0x23')][_0x457d('0x31')]){_0x58991f[_0x457d('0x2d')]=_[_0x457d('0x32')](_0x58991f[_0x457d('0x2d')],{'$or':_[_0x457d('0x33')](_0x58991f[_0x457d('0x27')],function(_0x818fa3){var _0x41a4a3={};_0x41a4a3[_0x818fa3]={'$like':'%'+_0x12bfca[_0x457d('0x23')][_0x457d('0x31')]+'%'};return _0x41a4a3;})});}_0x58991f=_[_0x457d('0x32')]({},_0x58991f,_0x12bfca[_0x457d('0x34')]);var _0x330af1={'where':_0x58991f[_0x457d('0x2d')]};return db[_0x457d('0x1f')][_0x457d('0x14')](_0x330af1)['then'](function(_0x35d2e1){_0x556a8['count']=_0x35d2e1;if(_0x12bfca[_0x457d('0x23')][_0x457d('0x35')]){_0x58991f[_0x457d('0x36')]=[{'all':!![]}];}return db[_0x457d('0x1f')][_0x457d('0x37')](_0x58991f);})['then'](function(_0x4fcb31){_0x556a8[_0x457d('0x38')]=_0x4fcb31;return _0x556a8;})['then'](respondWithFilteredResult(_0x152cfc,_0x58991f))[_0x457d('0x39')](handleError(_0x152cfc,null));};exports[_0x457d('0x3a')]=function(_0x110790,_0x49e1f3){var _0x73e45d={'raw':![],'where':{'id':_0x110790[_0x457d('0x3b')]['id']}},_0x1db014={};_0x1db014[_0x457d('0x21')]=_[_0x457d('0x22')](db[_0x457d('0x1f')][_0x457d('0x20')]);_0x1db014[_0x457d('0x23')]=_[_0x457d('0x22')](_0x110790['query']);_0x1db014['filters']=_[_0x457d('0x26')](_0x1db014[_0x457d('0x21')],_0x1db014[_0x457d('0x23')]);_0x73e45d[_0x457d('0x27')]=_[_0x457d('0x26')](_0x1db014[_0x457d('0x21')],qs['fields'](_0x110790[_0x457d('0x23')][_0x457d('0x28')]));_0x73e45d[_0x457d('0x27')]=_0x73e45d['attributes'][_0x457d('0x29')]?_0x73e45d[_0x457d('0x27')]:_0x1db014[_0x457d('0x21')];if(_0x110790['query'][_0x457d('0x35')]){_0x73e45d[_0x457d('0x36')]=[{'all':!![]}];}_0x73e45d=_[_0x457d('0x32')]({},_0x73e45d,_0x110790[_0x457d('0x34')]);return db['VoiceAgentReport'][_0x457d('0x3c')](_0x73e45d)[_0x457d('0x1b')](handleEntityNotFound(_0x49e1f3,null))[_0x457d('0x1b')](respondWithResult(_0x49e1f3,null))[_0x457d('0x39')](handleError(_0x49e1f3,null));};exports[_0x457d('0x3d')]=function(_0x352faa,_0x13787f){return db[_0x457d('0x1f')][_0x457d('0x3d')](_0x352faa[_0x457d('0x3e')],{})['then'](respondWithResult(_0x13787f,0xc9))[_0x457d('0x39')](handleError(_0x13787f,null));};exports[_0x457d('0x3f')]=function(_0x7abdf1,_0x545e67){if(_0x7abdf1['body']['id']){delete _0x7abdf1[_0x457d('0x3e')]['id'];}return db[_0x457d('0x1f')][_0x457d('0x3c')]({'where':{'id':_0x7abdf1[_0x457d('0x3b')]['id']}})[_0x457d('0x1b')](handleEntityNotFound(_0x545e67,null))[_0x457d('0x1b')](saveUpdates(_0x7abdf1[_0x457d('0x3e')],null))[_0x457d('0x1b')](respondWithResult(_0x545e67,null))['catch'](handleError(_0x545e67,null));};exports['destroy']=function(_0xec7449,_0x3e31cb){return db[_0x457d('0x1f')][_0x457d('0x3c')]({'where':{'id':_0xec7449[_0x457d('0x3b')]['id']}})[_0x457d('0x1b')](handleEntityNotFound(_0x3e31cb,null))[_0x457d('0x1b')](removeEntity(_0x3e31cb,null))[_0x457d('0x39')](handleError(_0x3e31cb,null));};exports[_0x457d('0x40')]=function(_0x1faeaf,_0xb02dd1){return db[_0x457d('0x1f')][_0x457d('0x40')]()[_0x457d('0x1b')](respondWithResult(_0xb02dd1,null))['catch'](handleError(_0xb02dd1,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 6a9ca08..30a29da 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 _0x0487=['util','../../config/logger','api','moment','exports','define','VoiceAgentReport','uniqueid'];(function(_0x337f32,_0x376236){var _0x5c36f0=function(_0x577415){while(--_0x577415){_0x337f32['push'](_0x337f32['shift']());}};_0x5c36f0(++_0x376236);}(_0x0487,0x138));var _0x7048=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x0487[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require('lodash');var util=require(_0x7048('0x0'));var logger=require(_0x7048('0x1'))(_0x7048('0x2'));var moment=require(_0x7048('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./voiceAgentReport.attributes');module[_0x7048('0x4')]=function(_0x151f45,_0x20e113){return _0x151f45[_0x7048('0x5')](_0x7048('0x6'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x7048('0x7'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x79cc=['bluebird','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','destuniqueid','lodash','util','moment'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x79cc,0xc5));var _0xc79c=function(_0x6188f5,_0x3429ff){_0x6188f5=_0x6188f5-0x0;var _0x4d8a99=_0x79cc[_0x6188f5];return _0x4d8a99;};'use strict';var _=require(_0xc79c('0x0'));var util=require(_0xc79c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc79c('0x2'));var BPromise=require(_0xc79c('0x3'));var rp=require('request-promise');var attributes=require(_0xc79c('0x4'));module[_0xc79c('0x5')]=function(_0x64a8db,_0x29e814){return _0x64a8db[_0xc79c('0x6')]('VoiceAgentReport',attributes,{'tableName':_0xc79c('0x7'),'paranoid':![],'indexes':[{'fields':[_0xc79c('0x8'),_0xc79c('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 edf5a65..4f14b1a 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.rpc.js +++ b/server/api/voiceAgentReport/voiceAgentReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['moment','randomstring','../../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(_0x571b24,_0x548390){var _0x2e5032=function(_0x3e8360){while(--_0x3e8360){_0x571b24['push'](_0x571b24['shift']());}};_0x2e5032(++_0x548390);}(_0x7a54,0x106));var _0x47a5=function(_0x1c8cb2,_0x300c9f){_0x1c8cb2=_0x1c8cb2-0x0;var _0x4f6e3f=_0x7a54[_0x1c8cb2];return _0x4f6e3f;};'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 +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(_0x4671c4,_0x2bdaa8){var _0x5b6b0c=function(_0x407b20){while(--_0x407b20){_0x4671c4['push'](_0x4671c4['shift']());}};_0x5b6b0c(++_0x2bdaa8);}(_0x7a54,0x106));var _0x47a5=function(_0x32bad6,_0x37ad92){_0x32bad6=_0x32bad6-0x0;var _0x1c40f7=_0x7a54[_0x32bad6];return _0x1c40f7;};'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 4142a48..b47a9f4 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 _0x6976=['/describe','describe','/:id','show','post','create','put','update','delete','destroy','util','path','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0xd964bd,_0x4c343a){var _0x361ab2=function(_0xdb11f7){while(--_0xdb11f7){_0xd964bd['push'](_0xd964bd['shift']());}};_0x361ab2(++_0x4c343a);}(_0x6976,0x1d5));var _0x6697=function(_0x4b6969,_0x53bf08){_0x4b6969=_0x4b6969-0x0;var _0x2b984e=_0x6976[_0x4b6969];return _0x2b984e;};'use strict';var multer=require('multer');var util=require(_0x6697('0x0'));var path=require(_0x6697('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6697('0x2'));var config=require(_0x6697('0x3'));var controller=require('./voiceCallReport.controller');router[_0x6697('0x4')]('/',auth[_0x6697('0x5')](),controller[_0x6697('0x6')]);router['get'](_0x6697('0x7'),auth[_0x6697('0x5')](),controller[_0x6697('0x8')]);router[_0x6697('0x4')](_0x6697('0x9'),auth[_0x6697('0x5')](),controller[_0x6697('0xa')]);router[_0x6697('0xb')]('/',auth[_0x6697('0x5')](),controller[_0x6697('0xc')]);router[_0x6697('0xd')](_0x6697('0x9'),auth[_0x6697('0x5')](),controller[_0x6697('0xe')]);router[_0x6697('0xf')](_0x6697('0x9'),auth[_0x6697('0x5')](),controller[_0x6697('0x10')]);module['exports']=router; \ No newline at end of file +var _0x6767=['../../config/environment','./voiceCallReport.controller','isAuthenticated','/describe','describe','get','/:id','show','post','create','put','update','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4dcf0f,_0x4da4c4){var _0x137694=function(_0x449857){while(--_0x449857){_0x4dcf0f['push'](_0x4dcf0f['shift']());}};_0x137694(++_0x4da4c4);}(_0x6767,0x13e));var _0x7676=function(_0x4d281c,_0xace12a){_0x4d281c=_0x4d281c-0x0;var _0x419eda=_0x6767[_0x4d281c];return _0x419eda;};'use strict';var multer=require('multer');var util=require(_0x7676('0x0'));var path=require(_0x7676('0x1'));var express=require('express');var router=express[_0x7676('0x2')]();var auth=require(_0x7676('0x3'));var interaction=require(_0x7676('0x4'));var config=require(_0x7676('0x5'));var controller=require(_0x7676('0x6'));router['get']('/',auth[_0x7676('0x7')](),controller['index']);router['get'](_0x7676('0x8'),auth[_0x7676('0x7')](),controller[_0x7676('0x9')]);router[_0x7676('0xa')](_0x7676('0xb'),auth['isAuthenticated'](),controller[_0x7676('0xc')]);router[_0x7676('0xd')]('/',auth[_0x7676('0x7')](),controller[_0x7676('0xe')]);router[_0x7676('0xf')]('/:id',auth[_0x7676('0x7')](),controller[_0x7676('0x10')]);router['delete'](_0x7676('0xb'),auth[_0x7676('0x7')](),controller[_0x7676('0x11')]);module[_0x7676('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 8fff9c0..41dac2d 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 _0xd450=['INTEGER','sequelize','STRING','inbound','internal','outbound','inbound-fax','dialer','DATE'];(function(_0x496958,_0x3cdbf5){var _0x1658f7=function(_0x5ef7ef){while(--_0x5ef7ef){_0x496958['push'](_0x496958['shift']());}};_0x1658f7(++_0x3cdbf5);}(_0xd450,0xd9));var _0x0d45=function(_0x1b48e7,_0x3025a2){_0x1b48e7=_0x1b48e7-0x0;var _0x3ebbe2=_0xd450[_0x1b48e7];return _0x3ebbe2;};'use strict';var Sequelize=require(_0x0d45('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x0d45('0x1')]},'type':{'type':Sequelize['ENUM'](_0x0d45('0x2'),_0x0d45('0x3'),_0x0d45('0x4'),_0x0d45('0x5'),'outbound-fax',_0x0d45('0x6'))},'tag':{'type':Sequelize[_0x0d45('0x1')]},'accountcode':{'type':Sequelize[_0x0d45('0x1')]},'source':{'type':Sequelize[_0x0d45('0x1')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x0d45('0x1')]},'channel':{'type':Sequelize[_0x0d45('0x1')]},'destinationchannel':{'type':Sequelize[_0x0d45('0x1')]},'lastapplication':{'type':Sequelize[_0x0d45('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x0d45('0x7')]},'endtime':{'type':Sequelize[_0x0d45('0x7')]},'duration':{'type':Sequelize[_0x0d45('0x8')]},'billableseconds':{'type':Sequelize[_0x0d45('0x8')]},'mohtime':{'type':Sequelize[_0x0d45('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x0d45('0x1')]},'userfield':{'type':Sequelize[_0x0d45('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x0d45('0x8')]}}; \ No newline at end of file +var _0xdb83=['ENUM','inbound','outbound-fax','TEXT','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x50b7bc,_0x4ff817){var _0x539658=function(_0x19a892){while(--_0x19a892){_0x50b7bc['push'](_0x50b7bc['shift']());}};_0x539658(++_0x4ff817);}(_0xdb83,0xf9));var _0x3db8=function(_0x5a57a4,_0x41dc80){_0x5a57a4=_0x5a57a4-0x0;var _0x187e68=_0xdb83[_0x5a57a4];return _0x187e68;};'use strict';var Sequelize=require(_0x3db8('0x0'));module[_0x3db8('0x1')]={'uniqueid':{'type':Sequelize[_0x3db8('0x2')]},'type':{'type':Sequelize[_0x3db8('0x3')](_0x3db8('0x4'),'internal','outbound','inbound-fax',_0x3db8('0x5'),'dialer')},'tag':{'type':Sequelize[_0x3db8('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x3db8('0x2')]},'destination':{'type':Sequelize[_0x3db8('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x3db8('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x3db8('0x2')]},'lastapplication':{'type':Sequelize[_0x3db8('0x2')]},'lastdata':{'type':Sequelize[_0x3db8('0x6')]},'starttime':{'type':Sequelize[_0x3db8('0x7')]},'answertime':{'type':Sequelize[_0x3db8('0x7')]},'endtime':{'type':Sequelize[_0x3db8('0x7')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3db8('0x2')]},'amaflags':{'type':Sequelize[_0x3db8('0x2')]},'userfield':{'type':Sequelize[_0x3db8('0x2')]},'userDisposition':{'type':Sequelize[_0x3db8('0x2')]},'note':{'type':Sequelize[_0x3db8('0x2')]},'prefix':{'type':Sequelize[_0x3db8('0x2')]},'routeid':{'type':Sequelize[_0x3db8('0x8')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index bfb3c7b..bf2270c 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 _0x08b0=['intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','add','day','merge','filter','VoiceCallReport','count','include','fullname','alias','User','findAll','rows','catch','params','options','find','create','body','describe','uniqueid','user','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/environment','sendStatus','status','end','offset','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','keys','query','dateStart','dateEnd','filters'];(function(_0x5370d2,_0x503b5e){var _0x587eca=function(_0x1642b8){while(--_0x1642b8){_0x5370d2['push'](_0x5370d2['shift']());}};_0x587eca(++_0x503b5e);}(_0x08b0,0x192));var _0x008b=function(_0x40c98f,_0x538320){_0x40c98f=_0x40c98f-0x0;var _0x2380b5=_0x08b0[_0x40c98f];return _0x2380b5;};'use strict';var jsonpatch=require(_0x008b('0x0'));var rp=require(_0x008b('0x1'));var moment=require(_0x008b('0x2'));var BPromise=require(_0x008b('0x3'));var Mustache=require(_0x008b('0x4'));var util=require(_0x008b('0x5'));var path=require(_0x008b('0x6'));var sox=require(_0x008b('0x7'));var csv=require(_0x008b('0x8'));var ejs=require(_0x008b('0x9'));var fs=require('fs');var _=require(_0x008b('0xa'));var squel=require(_0x008b('0xb'));var crypto=require(_0x008b('0xc'));var jsforce=require(_0x008b('0xd'));var deskjs=require(_0x008b('0xe'));var toCsv=require(_0x008b('0x8'));var querystring=require(_0x008b('0xf'));var Papa=require(_0x008b('0x10'));var qs=require(_0x008b('0x11'));var logger=require(_0x008b('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x008b('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e74f9,_0x2ee5c7){_0x2ee5c7=_0x2ee5c7||0xcc;return function(_0x524758){if(_0x524758){return _0x2e74f9[_0x008b('0x14')](_0x2ee5c7);}return _0x2e74f9[_0x008b('0x15')](_0x2ee5c7)[_0x008b('0x16')]();};}function respondWithResult(_0x11d337,_0x49624f){_0x49624f=_0x49624f||0xc8;return function(_0x44d94a){if(_0x44d94a){return _0x11d337['status'](_0x49624f)['json'](_0x44d94a);}};}function respondWithFilteredResult(_0x7c60d,_0x5a211e){return function(_0x532854){if(_0x532854){var _0x58dd5f=_0x532854['count'],_0x446b1a=_0x5a211e[_0x008b('0x17')],_0xf792d0=_0x5a211e[_0x008b('0x17')]+_0x5a211e['limit'],_0x10bb8b;if(_0xf792d0>=_0x58dd5f){_0xf792d0=_0x58dd5f;_0x10bb8b=0xc8;}else{_0x10bb8b=0xce;}_0x7c60d[_0x008b('0x15')](_0x10bb8b);return _0x7c60d[_0x008b('0x18')](_0x008b('0x19'),_0x446b1a+'-'+_0xf792d0+'/'+_0x58dd5f)[_0x008b('0x1a')](_0x532854);}return null;};}function patchUpdates(_0x22193a){return function(_0x1ef32c){try{jsonpatch['apply'](_0x1ef32c,_0x22193a,!![]);}catch(_0x562118){return BPromise[_0x008b('0x1b')](_0x562118);}return _0x1ef32c[_0x008b('0x1c')]();};}function saveUpdates(_0x32afc4,_0x596581){return function(_0x1e1e52){if(_0x1e1e52){return _0x1e1e52[_0x008b('0x1d')](_0x32afc4)[_0x008b('0x1e')](function(_0x312322){return _0x312322;});}return null;};}function removeEntity(_0x23df51,_0x353fe7){return function(_0x52c62a){if(_0x52c62a){return _0x52c62a[_0x008b('0x1f')]()[_0x008b('0x1e')](function(){_0x23df51[_0x008b('0x15')](0xcc)[_0x008b('0x16')]();});}};}function handleEntityNotFound(_0x5da956,_0x1bd089){return function(_0x2b45c8){if(!_0x2b45c8){_0x5da956[_0x008b('0x14')](0x194);}return _0x2b45c8;};}function handleError(_0x47e305,_0x5824e3){_0x5824e3=_0x5824e3||0x1f4;return function(_0x213a45){logger[_0x008b('0x20')](_0x213a45[_0x008b('0x21')]);if(_0x213a45[_0x008b('0x22')]){delete _0x213a45[_0x008b('0x22')];}_0x47e305[_0x008b('0x15')](_0x5824e3)['send'](_0x213a45);};}exports[_0x008b('0x23')]=function(_0x701ff3,_0x548dbc){var _0x2f9050={},_0x4d0147={},_0x209e6d={'count':0x0,'rows':[]};var _0x3ca46e=db['VoiceCallReport'][_0x008b('0x24')];_0x4d0147['model']=_[_0x008b('0x25')](_0x3ca46e);var _0x5243e7={'dateStart':_0x701ff3[_0x008b('0x26')][_0x008b('0x27')],'dateEnd':_0x701ff3[_0x008b('0x26')][_0x008b('0x28')]};delete _0x701ff3[_0x008b('0x26')][_0x008b('0x27')];delete _0x701ff3[_0x008b('0x26')][_0x008b('0x28')];_0x4d0147[_0x008b('0x26')]=_[_0x008b('0x25')](_0x701ff3['query']);_0x4d0147[_0x008b('0x29')]=_[_0x008b('0x2a')](_0x4d0147['model'],_0x4d0147[_0x008b('0x26')]);_0x2f9050['attributes']=_[_0x008b('0x2a')](_0x4d0147[_0x008b('0x2b')],qs[_0x008b('0x2c')](_0x701ff3[_0x008b('0x26')]['fields']));_0x2f9050[_0x008b('0x2d')]=_0x2f9050[_0x008b('0x2d')][_0x008b('0x2e')]?_0x2f9050[_0x008b('0x2d')]:_0x4d0147['model'];if(!_0x701ff3[_0x008b('0x26')][_0x008b('0x2f')](_0x008b('0x30'))){_0x2f9050[_0x008b('0x31')]=qs[_0x008b('0x31')](_0x701ff3[_0x008b('0x26')]['limit']);_0x2f9050[_0x008b('0x17')]=qs[_0x008b('0x17')](_0x701ff3[_0x008b('0x26')][_0x008b('0x17')]);}_0x2f9050[_0x008b('0x32')]=qs[_0x008b('0x33')](_0x701ff3[_0x008b('0x26')]['sort']);_0x2f9050[_0x008b('0x34')]=qs[_0x008b('0x29')](_['pick'](_0x701ff3[_0x008b('0x26')],_0x4d0147['filters']));if(_0x5243e7[_0x008b('0x27')]){if(_0x5243e7[_0x008b('0x28')]){_0x5243e7[_0x008b('0x28')]=moment(_0x5243e7['dateEnd'])[_0x008b('0x35')](0x1,'day');}else{_0x5243e7['dateEnd']=moment(_0x5243e7[_0x008b('0x27')])[_0x008b('0x35')](0x1,_0x008b('0x36'));}_[_0x008b('0x37')](_0x2f9050[_0x008b('0x34')],{'createdAt':{'$gte':_0x5243e7['dateStart'],'$lte':_0x5243e7[_0x008b('0x28')]}});}if(_0x701ff3[_0x008b('0x26')][_0x008b('0x38')]){_0x2f9050[_0x008b('0x34')]=_[_0x008b('0x37')](_0x2f9050[_0x008b('0x34')],{'$or':_['map'](_0x2f9050['attributes'],function(_0x20a2de){var _0x84c90c={};_0x84c90c[_0x20a2de]={'$like':'%'+_0x701ff3[_0x008b('0x26')]['filter']+'%'};return _0x84c90c;})});}_0x2f9050=_['merge']({},_0x2f9050,_0x701ff3['options']);var _0x2e91bf={'where':_0x2f9050['where']};return db[_0x008b('0x39')]['count'](_0x2e91bf)[_0x008b('0x1e')](function(_0x348fd1){_0x209e6d[_0x008b('0x3a')]=_0x348fd1;if(_0x701ff3[_0x008b('0x26')]['includeAll']){_0x2f9050[_0x008b('0x3b')]=[{'attributes':['id',_0x008b('0x22'),_0x008b('0x3c'),_0x008b('0x3d')],'model':db[_0x008b('0x3e')],'as':_0x008b('0x3e')}];}return db['VoiceCallReport'][_0x008b('0x3f')](_0x2f9050);})[_0x008b('0x1e')](function(_0x790f7d){_0x209e6d[_0x008b('0x40')]=_0x790f7d;return _0x209e6d;})[_0x008b('0x1e')](respondWithFilteredResult(_0x548dbc,_0x2f9050))[_0x008b('0x41')](handleError(_0x548dbc,null));};exports['show']=function(_0x3cb402,_0x502c61){var _0x26b1d6={'raw':!![],'where':{'id':_0x3cb402[_0x008b('0x42')]['id']}},_0x44de59={};_0x44de59[_0x008b('0x2b')]=_[_0x008b('0x25')](db['VoiceCallReport']['rawAttributes']);_0x44de59[_0x008b('0x26')]=_[_0x008b('0x25')](_0x3cb402['query']);_0x44de59[_0x008b('0x29')]=_[_0x008b('0x2a')](_0x44de59['model'],_0x44de59[_0x008b('0x26')]);_0x26b1d6[_0x008b('0x2d')]=_[_0x008b('0x2a')](_0x44de59[_0x008b('0x2b')],qs['fields'](_0x3cb402[_0x008b('0x26')]['fields']));_0x26b1d6[_0x008b('0x2d')]=_0x26b1d6[_0x008b('0x2d')][_0x008b('0x2e')]?_0x26b1d6[_0x008b('0x2d')]:_0x44de59[_0x008b('0x2b')];if(_0x3cb402[_0x008b('0x26')]['includeAll']){_0x26b1d6['include']=[{'all':!![]}];}_0x26b1d6=_['merge']({},_0x26b1d6,_0x3cb402[_0x008b('0x43')]);return db[_0x008b('0x39')][_0x008b('0x44')](_0x26b1d6)['then'](handleEntityNotFound(_0x502c61,null))[_0x008b('0x1e')](respondWithResult(_0x502c61,null))[_0x008b('0x41')](handleError(_0x502c61,null));};exports['create']=function(_0x54fb09,_0x4e76c2){return db['VoiceCallReport'][_0x008b('0x45')](_0x54fb09[_0x008b('0x46')],{})[_0x008b('0x1e')](respondWithResult(_0x4e76c2,0xc9))[_0x008b('0x41')](handleError(_0x4e76c2,null));};exports[_0x008b('0x1f')]=function(_0x43af9a,_0x1f6ba5){return db[_0x008b('0x39')][_0x008b('0x44')]({'where':{'id':_0x43af9a[_0x008b('0x42')]['id']}})[_0x008b('0x1e')](handleEntityNotFound(_0x1f6ba5,null))[_0x008b('0x1e')](removeEntity(_0x1f6ba5,null))[_0x008b('0x41')](handleError(_0x1f6ba5,null));};exports[_0x008b('0x47')]=function(_0x36c993,_0x5b6a1c){return db['VoiceCallReport'][_0x008b('0x47')]()[_0x008b('0x1e')](respondWithResult(_0x5b6a1c,null))[_0x008b('0x41')](handleError(_0x5b6a1c,null));};exports['update']=function(_0xe5174b,_0x3c35e3){if(_0xe5174b[_0x008b('0x46')][_0x008b('0x48')]){delete _0xe5174b[_0x008b('0x46')]['uniqueid'];}return db['VoiceCallReport'][_0x008b('0x44')]({'where':{'uniqueid':_0xe5174b[_0x008b('0x42')]['id'],'UserId':{'$or':[null,_0xe5174b[_0x008b('0x49')]['id']]}}})[_0x008b('0x1e')](handleEntityNotFound(_0x3c35e3,null))['then'](saveUpdates(_0xe5174b[_0x008b('0x46')],null))[_0x008b('0x1e')](respondWithResult(_0x3c35e3,null))[_0x008b('0x41')](handleError(_0x3c35e3,null));}; \ No newline at end of file +var _0xa12b=['error','stack','name','send','VoiceCallReport','rawAttributes','model','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','add','day','merge','filter','options','includeAll','include','fullname','alias','User','findAll','rows','catch','params','keys','create','describe','body','uniqueid','find','user','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy'];(function(_0x6fd739,_0x2ed827){var _0x25ecea=function(_0x1caf29){while(--_0x1caf29){_0x6fd739['push'](_0x6fd739['shift']());}};_0x25ecea(++_0x2ed827);}(_0xa12b,0xbd));var _0xba12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa12b[_0x3dd15e];return _0x231fd0;};'use strict';var jsonpatch=require(_0xba12('0x0'));var rp=require('request-promise');var moment=require(_0xba12('0x1'));var BPromise=require(_0xba12('0x2'));var Mustache=require(_0xba12('0x3'));var util=require('util');var path=require(_0xba12('0x4'));var sox=require(_0xba12('0x5'));var csv=require(_0xba12('0x6'));var ejs=require(_0xba12('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xba12('0x8'));var crypto=require(_0xba12('0x9'));var jsforce=require(_0xba12('0xa'));var deskjs=require(_0xba12('0xb'));var toCsv=require(_0xba12('0x6'));var querystring=require(_0xba12('0xc'));var Papa=require(_0xba12('0xd'));var qs=require(_0xba12('0xe'));var logger=require('../../config/logger')(_0xba12('0xf'));var utils=require(_0xba12('0x10'));var config=require(_0xba12('0x11'));var db=require(_0xba12('0x12'))['db'];function respondWithStatusCode(_0x527c8f,_0x3d679c){_0x3d679c=_0x3d679c||0xcc;return function(_0x9c9dc2){if(_0x9c9dc2){return _0x527c8f[_0xba12('0x13')](_0x3d679c);}return _0x527c8f[_0xba12('0x14')](_0x3d679c)[_0xba12('0x15')]();};}function respondWithResult(_0x58e8fa,_0x370a1c){_0x370a1c=_0x370a1c||0xc8;return function(_0x182e8a){if(_0x182e8a){return _0x58e8fa[_0xba12('0x14')](_0x370a1c)[_0xba12('0x16')](_0x182e8a);}};}function respondWithFilteredResult(_0xefb4e9,_0x3aa0b6){return function(_0x37eab7){if(_0x37eab7){var _0x38e4f2=_0x37eab7[_0xba12('0x17')],_0x9aaac7=_0x3aa0b6[_0xba12('0x18')],_0x21d9cd=_0x3aa0b6[_0xba12('0x18')]+_0x3aa0b6[_0xba12('0x19')],_0x45273c;if(_0x21d9cd>=_0x38e4f2){_0x21d9cd=_0x38e4f2;_0x45273c=0xc8;}else{_0x45273c=0xce;}_0xefb4e9[_0xba12('0x14')](_0x45273c);return _0xefb4e9[_0xba12('0x1a')](_0xba12('0x1b'),_0x9aaac7+'-'+_0x21d9cd+'/'+_0x38e4f2)[_0xba12('0x16')](_0x37eab7);}return null;};}function patchUpdates(_0x2c451a){return function(_0x12f5d2){try{jsonpatch[_0xba12('0x1c')](_0x12f5d2,_0x2c451a,!![]);}catch(_0x13b51c){return BPromise[_0xba12('0x1d')](_0x13b51c);}return _0x12f5d2['save']();};}function saveUpdates(_0x3a7e12,_0x2757aa){return function(_0x9e9c2f){if(_0x9e9c2f){return _0x9e9c2f[_0xba12('0x1e')](_0x3a7e12)[_0xba12('0x1f')](function(_0xc83e6d){return _0xc83e6d;});}return null;};}function removeEntity(_0x429477,_0x20c5b6){return function(_0x4d528d){if(_0x4d528d){return _0x4d528d[_0xba12('0x20')]()['then'](function(){_0x429477[_0xba12('0x14')](0xcc)[_0xba12('0x15')]();});}};}function handleEntityNotFound(_0x3a8adb,_0x4405b3){return function(_0x379bb5){if(!_0x379bb5){_0x3a8adb[_0xba12('0x13')](0x194);}return _0x379bb5;};}function handleError(_0x194bcc,_0x1783c3){_0x1783c3=_0x1783c3||0x1f4;return function(_0x14205e){logger[_0xba12('0x21')](_0x14205e[_0xba12('0x22')]);if(_0x14205e[_0xba12('0x23')]){delete _0x14205e[_0xba12('0x23')];}_0x194bcc['status'](_0x1783c3)[_0xba12('0x24')](_0x14205e);};}exports['index']=function(_0x491522,_0x2b36a7){var _0x35d1c2={},_0x3be5d5={},_0x4971f3={'count':0x0,'rows':[]};var _0x272b4f=db[_0xba12('0x25')][_0xba12('0x26')];_0x3be5d5[_0xba12('0x27')]=_['keys'](_0x272b4f);var _0x1bc5a3={'dateStart':_0x491522[_0xba12('0x28')][_0xba12('0x29')],'dateEnd':_0x491522[_0xba12('0x28')][_0xba12('0x2a')]};delete _0x491522[_0xba12('0x28')]['dateStart'];delete _0x491522[_0xba12('0x28')][_0xba12('0x2a')];_0x3be5d5[_0xba12('0x28')]=_['keys'](_0x491522[_0xba12('0x28')]);_0x3be5d5[_0xba12('0x2b')]=_['intersection'](_0x3be5d5[_0xba12('0x27')],_0x3be5d5['query']);_0x35d1c2[_0xba12('0x2c')]=_[_0xba12('0x2d')](_0x3be5d5[_0xba12('0x27')],qs['fields'](_0x491522[_0xba12('0x28')][_0xba12('0x2e')]));_0x35d1c2[_0xba12('0x2c')]=_0x35d1c2[_0xba12('0x2c')][_0xba12('0x2f')]?_0x35d1c2[_0xba12('0x2c')]:_0x3be5d5[_0xba12('0x27')];if(!_0x491522['query']['hasOwnProperty'](_0xba12('0x30'))){_0x35d1c2['limit']=qs[_0xba12('0x19')](_0x491522[_0xba12('0x28')][_0xba12('0x19')]);_0x35d1c2[_0xba12('0x18')]=qs[_0xba12('0x18')](_0x491522[_0xba12('0x28')]['offset']);}_0x35d1c2[_0xba12('0x31')]=qs[_0xba12('0x32')](_0x491522[_0xba12('0x28')]['sort']);_0x35d1c2[_0xba12('0x33')]=qs[_0xba12('0x2b')](_[_0xba12('0x34')](_0x491522[_0xba12('0x28')],_0x3be5d5[_0xba12('0x2b')]));if(_0x1bc5a3[_0xba12('0x29')]){if(_0x1bc5a3['dateEnd']){_0x1bc5a3[_0xba12('0x2a')]=moment(_0x1bc5a3[_0xba12('0x2a')])[_0xba12('0x35')](0x1,_0xba12('0x36'));}else{_0x1bc5a3[_0xba12('0x2a')]=moment(_0x1bc5a3[_0xba12('0x29')])[_0xba12('0x35')](0x1,_0xba12('0x36'));}_[_0xba12('0x37')](_0x35d1c2[_0xba12('0x33')],{'createdAt':{'$gte':_0x1bc5a3[_0xba12('0x29')],'$lte':_0x1bc5a3[_0xba12('0x2a')]}});}if(_0x491522[_0xba12('0x28')][_0xba12('0x38')]){_0x35d1c2[_0xba12('0x33')]=_[_0xba12('0x37')](_0x35d1c2[_0xba12('0x33')],{'$or':_['map'](_0x35d1c2[_0xba12('0x2c')],function(_0x27fefd){var _0x38bbea={};_0x38bbea[_0x27fefd]={'$like':'%'+_0x491522[_0xba12('0x28')][_0xba12('0x38')]+'%'};return _0x38bbea;})});}_0x35d1c2=_[_0xba12('0x37')]({},_0x35d1c2,_0x491522[_0xba12('0x39')]);var _0x342130={'where':_0x35d1c2[_0xba12('0x33')]};return db[_0xba12('0x25')][_0xba12('0x17')](_0x342130)[_0xba12('0x1f')](function(_0x4fa3ed){_0x4971f3[_0xba12('0x17')]=_0x4fa3ed;if(_0x491522['query'][_0xba12('0x3a')]){_0x35d1c2[_0xba12('0x3b')]=[{'attributes':['id',_0xba12('0x23'),_0xba12('0x3c'),_0xba12('0x3d')],'model':db[_0xba12('0x3e')],'as':_0xba12('0x3e')}];}return db[_0xba12('0x25')][_0xba12('0x3f')](_0x35d1c2);})[_0xba12('0x1f')](function(_0x49d35f){_0x4971f3[_0xba12('0x40')]=_0x49d35f;return _0x4971f3;})['then'](respondWithFilteredResult(_0x2b36a7,_0x35d1c2))[_0xba12('0x41')](handleError(_0x2b36a7,null));};exports['show']=function(_0x42eaf0,_0x5c6f81){var _0x4b8b0b={'raw':!![],'where':{'id':_0x42eaf0[_0xba12('0x42')]['id']}},_0x10dc94={};_0x10dc94[_0xba12('0x27')]=_[_0xba12('0x43')](db[_0xba12('0x25')][_0xba12('0x26')]);_0x10dc94['query']=_[_0xba12('0x43')](_0x42eaf0[_0xba12('0x28')]);_0x10dc94[_0xba12('0x2b')]=_[_0xba12('0x2d')](_0x10dc94[_0xba12('0x27')],_0x10dc94[_0xba12('0x28')]);_0x4b8b0b[_0xba12('0x2c')]=_[_0xba12('0x2d')](_0x10dc94['model'],qs[_0xba12('0x2e')](_0x42eaf0[_0xba12('0x28')]['fields']));_0x4b8b0b[_0xba12('0x2c')]=_0x4b8b0b[_0xba12('0x2c')][_0xba12('0x2f')]?_0x4b8b0b[_0xba12('0x2c')]:_0x10dc94[_0xba12('0x27')];if(_0x42eaf0[_0xba12('0x28')][_0xba12('0x3a')]){_0x4b8b0b[_0xba12('0x3b')]=[{'all':!![]}];}_0x4b8b0b=_[_0xba12('0x37')]({},_0x4b8b0b,_0x42eaf0[_0xba12('0x39')]);return db[_0xba12('0x25')]['find'](_0x4b8b0b)[_0xba12('0x1f')](handleEntityNotFound(_0x5c6f81,null))[_0xba12('0x1f')](respondWithResult(_0x5c6f81,null))[_0xba12('0x41')](handleError(_0x5c6f81,null));};exports[_0xba12('0x44')]=function(_0x194cdb,_0x1850a5){return db['VoiceCallReport'][_0xba12('0x44')](_0x194cdb['body'],{})[_0xba12('0x1f')](respondWithResult(_0x1850a5,0xc9))[_0xba12('0x41')](handleError(_0x1850a5,null));};exports[_0xba12('0x20')]=function(_0xe8fbe5,_0x251306){return db['VoiceCallReport']['find']({'where':{'id':_0xe8fbe5[_0xba12('0x42')]['id']}})[_0xba12('0x1f')](handleEntityNotFound(_0x251306,null))[_0xba12('0x1f')](removeEntity(_0x251306,null))[_0xba12('0x41')](handleError(_0x251306,null));};exports[_0xba12('0x45')]=function(_0x36e9a4,_0x127448){return db[_0xba12('0x25')][_0xba12('0x45')]()[_0xba12('0x1f')](respondWithResult(_0x127448,null))[_0xba12('0x41')](handleError(_0x127448,null));};exports[_0xba12('0x1e')]=function(_0x57f67b,_0x15f24a){if(_0x57f67b[_0xba12('0x46')][_0xba12('0x47')]){delete _0x57f67b['body'][_0xba12('0x47')];}return db[_0xba12('0x25')][_0xba12('0x48')]({'where':{'uniqueid':_0x57f67b['params']['id'],'UserId':{'$or':[null,_0x57f67b[_0xba12('0x49')]['id']]}}})['then'](handleEntityNotFound(_0x15f24a,null))[_0xba12('0x1f')](saveUpdates(_0x57f67b[_0xba12('0x46')],null))['then'](respondWithResult(_0x15f24a,null))[_0xba12('0x41')](handleError(_0x15f24a,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index d6e2cf6..5852cbb 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 _0xd1b3=['request-promise','./voiceCallReport.attributes','define','VoiceCallReport','report_call','lodash','util','moment'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xd1b3,0x95));var _0x3d1b=function(_0x5d8d10,_0x52e34f){_0x5d8d10=_0x5d8d10-0x0;var _0x3f3abc=_0xd1b3[_0x5d8d10];return _0x3f3abc;};'use strict';var _=require(_0x3d1b('0x0'));var util=require(_0x3d1b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3d1b('0x2'));var BPromise=require('bluebird');var rp=require(_0x3d1b('0x3'));var attributes=require(_0x3d1b('0x4'));module['exports']=function(_0x3f2cd4,_0x409d4b){return _0x3f2cd4[_0x3d1b('0x5')](_0x3d1b('0x6'),attributes,{'tableName':_0x3d1b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d17=['report_call','lodash','../../config/logger','moment','bluebird','request-promise','./voiceCallReport.attributes','exports','define','VoiceCallReport'];(function(_0x2ae709,_0x394275){var _0x3d4ac3=function(_0x598d8f){while(--_0x598d8f){_0x2ae709['push'](_0x2ae709['shift']());}};_0x3d4ac3(++_0x394275);}(_0x0d17,0x1a5));var _0x70d1=function(_0x3e2f5c,_0x4db59d){_0x3e2f5c=_0x3e2f5c-0x0;var _0x51c3e2=_0x0d17[_0x3e2f5c];return _0x51c3e2;};'use strict';var _=require(_0x70d1('0x0'));var util=require('util');var logger=require(_0x70d1('0x1'))('api');var moment=require(_0x70d1('0x2'));var BPromise=require(_0x70d1('0x3'));var rp=require(_0x70d1('0x4'));var attributes=require(_0x70d1('0x5'));module[_0x70d1('0x6')]=function(_0x442c77,_0x1c5d04){return _0x442c77[_0x70d1('0x7')](_0x70d1('0x8'),attributes,{'tableName':_0x70d1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index d0d4ab6..3515e49 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 _0xcdae=['jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x474a31,_0x4ba9cd){var _0x355f3e=function(_0x34abfd){while(--_0x34abfd){_0x474a31['push'](_0x474a31['shift']());}};_0x355f3e(++_0x4ba9cd);}(_0xcdae,0x6f));var _0xecda=function(_0x1abc37,_0x51ae24){_0x1abc37=_0x1abc37-0x0;var _0x4efe63=_0xcdae[_0x1abc37];return _0x4efe63;};'use strict';var _=require(_0xecda('0x0'));var util=require(_0xecda('0x1'));var moment=require(_0xecda('0x2'));var BPromise=require(_0xecda('0x3'));var rs=require(_0xecda('0x4'));var fs=require('fs');var db=require(_0xecda('0x5'))['db'];var utils=require(_0xecda('0x6'));var logger=require('../../config/logger')(_0xecda('0x7'));var config=require(_0xecda('0x8'));var jayson=require(_0xecda('0x9'));var client=jayson[_0xecda('0xa')][_0xecda('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12adf2,_0x151cc5,_0x514c36){return new BPromise(function(_0x1158e3,_0x734345){return client[_0xecda('0xc')](_0x12adf2,_0x514c36)[_0xecda('0xd')](function(_0x67e63b){logger[_0xecda('0xe')](_0xecda('0xf'),_0x151cc5,'request\x20sent');logger[_0xecda('0x10')](_0xecda('0x11'),_0x151cc5,_0xecda('0x12'),JSON[_0xecda('0x13')](_0x67e63b));if(_0x67e63b[_0xecda('0x14')]){if(_0x67e63b[_0xecda('0x14')][_0xecda('0x15')]===0x1f4){logger[_0xecda('0x14')]('VoiceCallReport,\x20%s,\x20%s',_0x151cc5,_0x67e63b['error'][_0xecda('0x16')]);return _0x734345(_0x67e63b['error']['message']);}logger[_0xecda('0x14')](_0xecda('0xf'),_0x151cc5,_0x67e63b[_0xecda('0x14')][_0xecda('0x16')]);return _0x1158e3(_0x67e63b[_0xecda('0x14')]['message']);}else{logger[_0xecda('0xe')](_0xecda('0xf'),_0x151cc5,_0xecda('0x12'));_0x1158e3(_0x67e63b['result']['message']);}})[_0xecda('0x17')](function(_0x52aa14){logger[_0xecda('0x14')](_0xecda('0xf'),_0x151cc5,_0x52aa14);_0x734345(_0x52aa14);});});}exports[_0xecda('0x18')]=function(_0x15a94c){var _0x3a4ede=this;return new Promise(function(_0x4d22eb,_0x28aa22){return db[_0xecda('0x19')][_0xecda('0x1a')]({'raw':_0x15a94c[_0xecda('0x1b')]?_0x15a94c[_0xecda('0x1b')][_0xecda('0x1c')]===undefined?!![]:![]:!![],'where':_0x15a94c['options']?_0x15a94c[_0xecda('0x1b')][_0xecda('0x1d')]||null:null,'attributes':_0x15a94c[_0xecda('0x1b')]?_0x15a94c[_0xecda('0x1b')][_0xecda('0x1e')]||null:null,'limit':_0x15a94c[_0xecda('0x1b')]?_0x15a94c[_0xecda('0x1b')][_0xecda('0x1f')]||null:null,'include':_0x15a94c[_0xecda('0x1b')]?_0x15a94c[_0xecda('0x1b')][_0xecda('0x20')]?_[_0xecda('0x21')](_0x15a94c['options'][_0xecda('0x20')],function(_0x5153d3){return{'model':db[_0x5153d3[_0xecda('0x22')]],'as':_0x5153d3['as'],'attributes':_0x5153d3['attributes'],'include':_0x5153d3[_0xecda('0x20')]?_[_0xecda('0x21')](_0x5153d3['include'],function(_0x5baa04){return{'model':db[_0x5baa04[_0xecda('0x22')]],'as':_0x5baa04['as'],'attributes':_0x5baa04['attributes'],'include':_0x5baa04['include']?_['map'](_0x5baa04['include'],function(_0x2e4b6e){return{'model':db[_0x2e4b6e[_0xecda('0x22')]],'as':_0x2e4b6e['as'],'attributes':_0x2e4b6e['attributes']};}):[]};}):[]};}):[]:[]})[_0xecda('0xd')](function(_0x493219){logger[_0xecda('0xe')](_0xecda('0x18'),_0x15a94c);logger[_0xecda('0x10')](_0xecda('0x18'),_0x15a94c,JSON[_0xecda('0x13')](_0x493219));_0x4d22eb(_0x493219);})[_0xecda('0x17')](function(_0xe93197){logger[_0xecda('0x14')](_0xecda('0x18'),_0xe93197[_0xecda('0x16')],_0x15a94c);_0x28aa22(_0x3a4ede[_0xecda('0x14')](0x1f4,_0xe93197['message']));});});};exports['CreateVoiceCallReport']=function(_0x1da748){var _0x37282a=this;return new Promise(function(_0x176b55,_0x14c96a){return db['VoiceCallReport'][_0xecda('0x23')](_0x1da748[_0xecda('0x24')],{'raw':_0x1da748['options']?_0x1da748[_0xecda('0x1b')][_0xecda('0x1c')]===undefined?!![]:![]:!![]})[_0xecda('0xd')](function(_0x718bab){logger[_0xecda('0xe')]('CreateVoiceCallReport',_0x1da748);logger[_0xecda('0x10')](_0xecda('0x25'),_0x1da748,JSON['stringify'](_0x718bab));_0x176b55(_0x718bab);})[_0xecda('0x17')](function(_0x1cf7b3){logger[_0xecda('0x14')](_0xecda('0x25'),_0x1cf7b3['message'],_0x1da748);_0x14c96a(_0x37282a[_0xecda('0x14')](0x1f4,_0x1cf7b3[_0xecda('0x16')]));});});};exports[_0xecda('0x26')]=function(_0x356214){var _0x440ff8=this;return new Promise(function(_0x46c889,_0x5ce581){return db[_0xecda('0x19')][_0xecda('0x27')](_0x356214[_0xecda('0x24')],{'raw':_0x356214['options']?_0x356214[_0xecda('0x1b')][_0xecda('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x356214[_0xecda('0x1b')]?_0x356214[_0xecda('0x1b')][_0xecda('0x1d')]||null:null,'attributes':_0x356214[_0xecda('0x1b')]?_0x356214[_0xecda('0x1b')][_0xecda('0x1e')]||null:null,'limit':_0x356214[_0xecda('0x1b')]?_0x356214[_0xecda('0x1b')][_0xecda('0x1f')]||null:null})['then'](function(_0x58f9f8){logger[_0xecda('0xe')](_0xecda('0x26'),_0x356214);logger[_0xecda('0x10')](_0xecda('0x26'),_0x356214,JSON['stringify'](_0x58f9f8));_0x46c889(_0x58f9f8);})[_0xecda('0x17')](function(_0x195a62){logger[_0xecda('0x14')](_0xecda('0x26'),_0x195a62[_0xecda('0x16')],_0x356214);_0x5ce581(_0x440ff8[_0xecda('0x14')](0x1f4,_0x195a62['message']));});});}; \ No newline at end of file +var _0xf5cb=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetVoiceCallReport','findAll','options','raw','where','include','map','model','attributes','catch','VoiceCallReport','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','limit','lodash','util','moment','bluebird'];(function(_0x3c1d1f,_0x2a8ebf){var _0xc8ed55=function(_0x42272e){while(--_0x42272e){_0x3c1d1f['push'](_0x3c1d1f['shift']());}};_0xc8ed55(++_0x2a8ebf);}(_0xf5cb,0x74));var _0xbf5c=function(_0x539f85,_0x4cabf0){_0x539f85=_0x539f85-0x0;var _0x37a639=_0xf5cb[_0x539f85];return _0x37a639;};'use strict';var _=require(_0xbf5c('0x0'));var util=require(_0xbf5c('0x1'));var moment=require(_0xbf5c('0x2'));var BPromise=require(_0xbf5c('0x3'));var rs=require(_0xbf5c('0x4'));var fs=require('fs');var db=require(_0xbf5c('0x5'))['db'];var utils=require(_0xbf5c('0x6'));var logger=require(_0xbf5c('0x7'))(_0xbf5c('0x8'));var config=require('../../config/environment');var jayson=require(_0xbf5c('0x9'));var client=jayson[_0xbf5c('0xa')][_0xbf5c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x316921,_0x17bda0,_0xbbdb42){return new BPromise(function(_0x4a7e26,_0x376b38){return client['request'](_0x316921,_0xbbdb42)[_0xbf5c('0xc')](function(_0x1bc481){logger['info'](_0xbf5c('0xd'),_0x17bda0,_0xbf5c('0xe'));logger[_0xbf5c('0xf')](_0xbf5c('0x10'),_0x17bda0,_0xbf5c('0xe'),JSON[_0xbf5c('0x11')](_0x1bc481));if(_0x1bc481[_0xbf5c('0x12')]){if(_0x1bc481[_0xbf5c('0x12')][_0xbf5c('0x13')]===0x1f4){logger[_0xbf5c('0x12')](_0xbf5c('0xd'),_0x17bda0,_0x1bc481['error'][_0xbf5c('0x14')]);return _0x376b38(_0x1bc481[_0xbf5c('0x12')][_0xbf5c('0x14')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x17bda0,_0x1bc481[_0xbf5c('0x12')][_0xbf5c('0x14')]);return _0x4a7e26(_0x1bc481[_0xbf5c('0x12')][_0xbf5c('0x14')]);}else{logger[_0xbf5c('0x15')](_0xbf5c('0xd'),_0x17bda0,_0xbf5c('0xe'));_0x4a7e26(_0x1bc481[_0xbf5c('0x16')][_0xbf5c('0x14')]);}})['catch'](function(_0x4be75d){logger[_0xbf5c('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x17bda0,_0x4be75d);_0x376b38(_0x4be75d);});});}exports[_0xbf5c('0x17')]=function(_0x39d28f){var _0x4748df=this;return new Promise(function(_0x54461f,_0x5bb8ff){return db['VoiceCallReport'][_0xbf5c('0x18')]({'raw':_0x39d28f[_0xbf5c('0x19')]?_0x39d28f[_0xbf5c('0x19')][_0xbf5c('0x1a')]===undefined?!![]:![]:!![],'where':_0x39d28f[_0xbf5c('0x19')]?_0x39d28f[_0xbf5c('0x19')][_0xbf5c('0x1b')]||null:null,'attributes':_0x39d28f[_0xbf5c('0x19')]?_0x39d28f[_0xbf5c('0x19')]['attributes']||null:null,'limit':_0x39d28f[_0xbf5c('0x19')]?_0x39d28f[_0xbf5c('0x19')]['limit']||null:null,'include':_0x39d28f['options']?_0x39d28f[_0xbf5c('0x19')][_0xbf5c('0x1c')]?_[_0xbf5c('0x1d')](_0x39d28f[_0xbf5c('0x19')][_0xbf5c('0x1c')],function(_0x165fd4){return{'model':db[_0x165fd4[_0xbf5c('0x1e')]],'as':_0x165fd4['as'],'attributes':_0x165fd4[_0xbf5c('0x1f')],'include':_0x165fd4[_0xbf5c('0x1c')]?_['map'](_0x165fd4['include'],function(_0x3ca4a3){return{'model':db[_0x3ca4a3[_0xbf5c('0x1e')]],'as':_0x3ca4a3['as'],'attributes':_0x3ca4a3['attributes'],'include':_0x3ca4a3['include']?_[_0xbf5c('0x1d')](_0x3ca4a3[_0xbf5c('0x1c')],function(_0x254faa){return{'model':db[_0x254faa['model']],'as':_0x254faa['as'],'attributes':_0x254faa[_0xbf5c('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48c0b5){logger['info'](_0xbf5c('0x17'),_0x39d28f);logger[_0xbf5c('0xf')](_0xbf5c('0x17'),_0x39d28f,JSON[_0xbf5c('0x11')](_0x48c0b5));_0x54461f(_0x48c0b5);})[_0xbf5c('0x20')](function(_0x42c21e){logger[_0xbf5c('0x12')](_0xbf5c('0x17'),_0x42c21e[_0xbf5c('0x14')],_0x39d28f);_0x5bb8ff(_0x4748df['error'](0x1f4,_0x42c21e['message']));});});};exports['CreateVoiceCallReport']=function(_0x4a8767){var _0xbdeee1=this;return new Promise(function(_0x2d057f,_0x3ef1e0){return db[_0xbf5c('0x21')][_0xbf5c('0x22')](_0x4a8767[_0xbf5c('0x23')],{'raw':_0x4a8767[_0xbf5c('0x19')]?_0x4a8767[_0xbf5c('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xbf5c('0xc')](function(_0xe39cb5){logger[_0xbf5c('0x15')](_0xbf5c('0x24'),_0x4a8767);logger[_0xbf5c('0xf')](_0xbf5c('0x24'),_0x4a8767,JSON[_0xbf5c('0x11')](_0xe39cb5));_0x2d057f(_0xe39cb5);})[_0xbf5c('0x20')](function(_0x4c29bf){logger[_0xbf5c('0x12')]('CreateVoiceCallReport',_0x4c29bf['message'],_0x4a8767);_0x3ef1e0(_0xbdeee1[_0xbf5c('0x12')](0x1f4,_0x4c29bf[_0xbf5c('0x14')]));});});};exports[_0xbf5c('0x25')]=function(_0x477d4d){var _0x34c4b7=this;return new Promise(function(_0x5a38e2,_0x28669e){return db['VoiceCallReport'][_0xbf5c('0x26')](_0x477d4d['body'],{'raw':_0x477d4d[_0xbf5c('0x19')]?_0x477d4d[_0xbf5c('0x19')][_0xbf5c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x477d4d[_0xbf5c('0x19')]?_0x477d4d[_0xbf5c('0x19')][_0xbf5c('0x1b')]||null:null,'attributes':_0x477d4d['options']?_0x477d4d[_0xbf5c('0x19')][_0xbf5c('0x1f')]||null:null,'limit':_0x477d4d[_0xbf5c('0x19')]?_0x477d4d[_0xbf5c('0x19')][_0xbf5c('0x27')]||null:null})[_0xbf5c('0xc')](function(_0x4b4447){logger[_0xbf5c('0x15')](_0xbf5c('0x25'),_0x477d4d);logger[_0xbf5c('0xf')](_0xbf5c('0x25'),_0x477d4d,JSON[_0xbf5c('0x11')](_0x4b4447));_0x5a38e2(_0x4b4447);})[_0xbf5c('0x20')](function(_0x572c99){logger[_0xbf5c('0x12')](_0xbf5c('0x25'),_0x572c99[_0xbf5c('0x14')],_0x477d4d);_0x28669e(_0x34c4b7[_0xbf5c('0x12')](0x1f4,_0x572c99['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 3597280..bc84f22 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 _0x405d=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','/:id','show','post','isAuthenticated','create','put'];(function(_0x357c3e,_0x4ca8c0){var _0x7b6384=function(_0x10c310){while(--_0x10c310){_0x357c3e['push'](_0x357c3e['shift']());}};_0x7b6384(++_0x4ca8c0);}(_0x405d,0x158));var _0xd405=function(_0x48f672,_0x59b4cc){_0x48f672=_0x48f672-0x0;var _0x21801d=_0x405d[_0x48f672];return _0x21801d;};'use strict';var multer=require(_0xd405('0x0'));var util=require(_0xd405('0x1'));var path=require(_0xd405('0x2'));var express=require(_0xd405('0x3'));var router=express[_0xd405('0x4')]();var auth=require(_0xd405('0x5'));var interaction=require(_0xd405('0x6'));var config=require(_0xd405('0x7'));var controller=require(_0xd405('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd405('0x9')](_0xd405('0xa'),auth['isAuthenticated'](),controller[_0xd405('0xb')]);router[_0xd405('0xc')]('/',auth[_0xd405('0xd')](),controller[_0xd405('0xe')]);router[_0xd405('0xf')](_0xd405('0xa'),auth[_0xd405('0xd')](),controller['update']);router['delete'](_0xd405('0xa'),auth[_0xd405('0xd')](),controller[_0xd405('0x10')]);module[_0xd405('0x11')]=router; \ No newline at end of file +var _0xb7dc=['../../components/auth/service','../../config/environment','isAuthenticated','get','/:id','show','post','create','put','delete','destroy','multer','util','path','express','Router'];(function(_0x33660,_0x552387){var _0x2e9132=function(_0x40939a){while(--_0x40939a){_0x33660['push'](_0x33660['shift']());}};_0x2e9132(++_0x552387);}(_0xb7dc,0x9b));var _0xcb7d=function(_0x362f81,_0x5701c2){_0x362f81=_0x362f81-0x0;var _0x5afc5c=_0xb7dc[_0x362f81];return _0x5afc5c;};'use strict';var multer=require(_0xcb7d('0x0'));var util=require(_0xcb7d('0x1'));var path=require(_0xcb7d('0x2'));var express=require(_0xcb7d('0x3'));var router=express[_0xcb7d('0x4')]();var auth=require(_0xcb7d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcb7d('0x6'));var controller=require('./voiceChanSpy.controller');router['get']('/',auth[_0xcb7d('0x7')](),controller['index']);router[_0xcb7d('0x8')](_0xcb7d('0x9'),auth[_0xcb7d('0x7')](),controller[_0xcb7d('0xa')]);router[_0xcb7d('0xb')]('/',auth[_0xcb7d('0x7')](),controller[_0xcb7d('0xc')]);router[_0xcb7d('0xd')](_0xcb7d('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xcb7d('0xe')](_0xcb7d('0x9'),auth[_0xcb7d('0x7')](),controller[_0xcb7d('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index a8e0b3c..71b18a9 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 _0xc3c0=['sequelize','exports','STRING','join','getDataValue','options','split','BOOLEAN'];(function(_0x5dd25a,_0x434e62){var _0x3a45c8=function(_0x156fe9){while(--_0x156fe9){_0x5dd25a['push'](_0x5dd25a['shift']());}};_0x3a45c8(++_0x434e62);}(_0xc3c0,0x198));var _0x0c3c=function(_0x2a8ed9,_0x3e5591){_0x2a8ed9=_0x2a8ed9-0x0;var _0x313d13=_0xc3c0[_0x2a8ed9];return _0x313d13;};'use strict';var Sequelize=require(_0x0c3c('0x0'));module[_0x0c3c('0x1')]={'name':{'type':Sequelize[_0x0c3c('0x2')]},'prefix':{'type':Sequelize[_0x0c3c('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x0c3c('0x2')],'set':function(_0x1f6421){this['setDataValue']('options',_0x1f6421?_0x1f6421[_0x0c3c('0x3')](''):[]);},'get':function(){return this[_0x0c3c('0x4')]('options')?this['getDataValue'](_0x0c3c('0x5'))[_0x0c3c('0x6')](''):[];}},'auth':{'type':Sequelize[_0x0c3c('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x0c3c('0x2')]},'record':{'type':Sequelize[_0x0c3c('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0c3c('0x2')]}}; \ No newline at end of file +var _0xf8c7=['options','split','BOOLEAN','sequelize','exports','STRING','setDataValue','join','getDataValue'];(function(_0x2d19f8,_0x48fe1d){var _0x166db2=function(_0x3aeba2){while(--_0x3aeba2){_0x2d19f8['push'](_0x2d19f8['shift']());}};_0x166db2(++_0x48fe1d);}(_0xf8c7,0xc9));var _0x7f8c=function(_0x590167,_0x4cfb45){_0x590167=_0x590167-0x0;var _0x8cc4b0=_0xf8c7[_0x590167];return _0x8cc4b0;};'use strict';var Sequelize=require(_0x7f8c('0x0'));module[_0x7f8c('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x7f8c('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x185134){this[_0x7f8c('0x3')]('options',_0x185134?_0x185134[_0x7f8c('0x4')](''):[]);},'get':function(){return this[_0x7f8c('0x5')](_0x7f8c('0x6'))?this[_0x7f8c('0x5')](_0x7f8c('0x6'))[_0x7f8c('0x7')](''):[];}},'auth':{'type':Sequelize[_0x7f8c('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x7f8c('0x2')]},'record':{'type':Sequelize[_0x7f8c('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7f8c('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index aad4ea0..825dade 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 _0xad6a=['moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','VoiceChanSpy','rawAttributes','keys','query','dateEnd','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','dateStart','add','day','merge','filter','map','options','includeAll','findAll','catch','show','params','include','create','body','find','destroy','fast-json-patch','request-promise'];(function(_0x581a82,_0x4ef243){var _0xcd70d0=function(_0x1df06d){while(--_0x1df06d){_0x581a82['push'](_0x581a82['shift']());}};_0xcd70d0(++_0x4ef243);}(_0xad6a,0x112));var _0xaad6=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xad6a[_0x36ed48];return _0x51c63a;};'use strict';var jsonpatch=require(_0xaad6('0x0'));var rp=require(_0xaad6('0x1'));var moment=require(_0xaad6('0x2'));var BPromise=require(_0xaad6('0x3'));var Mustache=require(_0xaad6('0x4'));var util=require(_0xaad6('0x5'));var path=require(_0xaad6('0x6'));var sox=require(_0xaad6('0x7'));var csv=require('to-csv');var ejs=require(_0xaad6('0x8'));var fs=require('fs');var _=require(_0xaad6('0x9'));var squel=require(_0xaad6('0xa'));var crypto=require(_0xaad6('0xb'));var jsforce=require(_0xaad6('0xc'));var deskjs=require(_0xaad6('0xd'));var toCsv=require(_0xaad6('0xe'));var querystring=require(_0xaad6('0xf'));var Papa=require('papaparse');var qs=require(_0xaad6('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xaad6('0x11'));var db=require(_0xaad6('0x12'))['db'];function respondWithStatusCode(_0x3d7b43,_0x586058){_0x586058=_0x586058||0xcc;return function(_0xa12f6a){if(_0xa12f6a){return _0x3d7b43[_0xaad6('0x13')](_0x586058);}return _0x3d7b43[_0xaad6('0x14')](_0x586058)[_0xaad6('0x15')]();};}function respondWithResult(_0x52088c,_0x3d2eb4){_0x3d2eb4=_0x3d2eb4||0xc8;return function(_0x465082){if(_0x465082){return _0x52088c['status'](_0x3d2eb4)[_0xaad6('0x16')](_0x465082);}};}function respondWithFilteredResult(_0x2213be,_0x4c9885){return function(_0x2d73b4){if(_0x2d73b4){var _0x43e93f=_0x2d73b4[_0xaad6('0x17')],_0x25100c=_0x4c9885[_0xaad6('0x18')],_0x227dab=_0x4c9885['offset']+_0x4c9885[_0xaad6('0x19')],_0x4e3b77;if(_0x227dab>=_0x43e93f){_0x227dab=_0x43e93f;_0x4e3b77=0xc8;}else{_0x4e3b77=0xce;}_0x2213be[_0xaad6('0x14')](_0x4e3b77);return _0x2213be[_0xaad6('0x1a')](_0xaad6('0x1b'),_0x25100c+'-'+_0x227dab+'/'+_0x43e93f)[_0xaad6('0x16')](_0x2d73b4);}return null;};}function patchUpdates(_0x333e91){return function(_0x37c565){try{jsonpatch['apply'](_0x37c565,_0x333e91,!![]);}catch(_0xe0fa4){return BPromise[_0xaad6('0x1c')](_0xe0fa4);}return _0x37c565[_0xaad6('0x1d')]();};}function saveUpdates(_0x148a21,_0x336d00){return function(_0x8e1b71){if(_0x8e1b71){return _0x8e1b71[_0xaad6('0x1e')](_0x148a21)[_0xaad6('0x1f')](function(_0x8b27d1){return _0x8b27d1;});}return null;};}function removeEntity(_0x444676,_0x3bc5c8){return function(_0x1d1833){if(_0x1d1833){return _0x1d1833['destroy']()['then'](function(){_0x444676[_0xaad6('0x14')](0xcc)[_0xaad6('0x15')]();});}};}function handleEntityNotFound(_0x3f65ce,_0xc008f6){return function(_0xada6e8){if(!_0xada6e8){_0x3f65ce[_0xaad6('0x13')](0x194);}return _0xada6e8;};}function handleError(_0x4006a1,_0x1fb30d){_0x1fb30d=_0x1fb30d||0x1f4;return function(_0x19c698){logger[_0xaad6('0x20')](_0x19c698[_0xaad6('0x21')]);if(_0x19c698[_0xaad6('0x22')]){delete _0x19c698[_0xaad6('0x22')];}_0x4006a1['status'](_0x1fb30d)[_0xaad6('0x23')](_0x19c698);};}exports['index']=function(_0x33dc71,_0x5e53d2){var _0x16e2ab={},_0x82b3a6={},_0x21c823={'count':0x0,'rows':[]};var _0x23cf98=db[_0xaad6('0x24')][_0xaad6('0x25')];_0x82b3a6['model']=_[_0xaad6('0x26')](_0x23cf98);var _0xac48c9={'dateStart':_0x33dc71[_0xaad6('0x27')]['dateStart'],'dateEnd':_0x33dc71['query'][_0xaad6('0x28')]};delete _0x33dc71[_0xaad6('0x27')]['dateStart'];delete _0x33dc71[_0xaad6('0x27')][_0xaad6('0x28')];_0x82b3a6[_0xaad6('0x27')]=_[_0xaad6('0x26')](_0x33dc71['query']);_0x82b3a6[_0xaad6('0x29')]=_[_0xaad6('0x2a')](_0x82b3a6[_0xaad6('0x2b')],_0x82b3a6[_0xaad6('0x27')]);_0x16e2ab['attributes']=_['intersection'](_0x82b3a6[_0xaad6('0x2b')],qs[_0xaad6('0x2c')](_0x33dc71[_0xaad6('0x27')]['fields']));_0x16e2ab[_0xaad6('0x2d')]=_0x16e2ab[_0xaad6('0x2d')][_0xaad6('0x2e')]?_0x16e2ab[_0xaad6('0x2d')]:_0x82b3a6[_0xaad6('0x2b')];if(!_0x33dc71[_0xaad6('0x27')][_0xaad6('0x2f')](_0xaad6('0x30'))){_0x16e2ab['limit']=qs[_0xaad6('0x19')](_0x33dc71[_0xaad6('0x27')][_0xaad6('0x19')]);_0x16e2ab[_0xaad6('0x18')]=qs[_0xaad6('0x18')](_0x33dc71[_0xaad6('0x27')][_0xaad6('0x18')]);}_0x16e2ab['order']=qs['sort'](_0x33dc71['query'][_0xaad6('0x31')]);_0x16e2ab[_0xaad6('0x32')]=qs[_0xaad6('0x29')](_[_0xaad6('0x33')](_0x33dc71[_0xaad6('0x27')],_0x82b3a6[_0xaad6('0x29')]));if(_0xac48c9[_0xaad6('0x34')]){if(_0xac48c9['dateEnd']){_0xac48c9[_0xaad6('0x28')]=moment(_0xac48c9['dateEnd'])[_0xaad6('0x35')](0x1,_0xaad6('0x36'));}else{_0xac48c9[_0xaad6('0x28')]=moment(_0xac48c9['dateStart'])[_0xaad6('0x35')](0x1,_0xaad6('0x36'));}_[_0xaad6('0x37')](_0x16e2ab[_0xaad6('0x32')],{'createdAt':{'$gte':_0xac48c9[_0xaad6('0x34')],'$lte':_0xac48c9[_0xaad6('0x28')]}});}if(_0x33dc71[_0xaad6('0x27')][_0xaad6('0x38')]){_0x16e2ab[_0xaad6('0x32')]=_[_0xaad6('0x37')](_0x16e2ab[_0xaad6('0x32')],{'$or':_[_0xaad6('0x39')](_0x16e2ab[_0xaad6('0x2d')],function(_0x3a4170){var _0x3df763={};_0x3df763[_0x3a4170]={'$like':'%'+_0x33dc71['query'][_0xaad6('0x38')]+'%'};return _0x3df763;})});}_0x16e2ab=_[_0xaad6('0x37')]({},_0x16e2ab,_0x33dc71[_0xaad6('0x3a')]);var _0xc806b={'where':_0x16e2ab[_0xaad6('0x32')]};return db[_0xaad6('0x24')][_0xaad6('0x17')](_0xc806b)[_0xaad6('0x1f')](function(_0x377d42){_0x21c823[_0xaad6('0x17')]=_0x377d42;if(_0x33dc71[_0xaad6('0x27')][_0xaad6('0x3b')]){_0x16e2ab['include']=[{'all':!![]}];}return db[_0xaad6('0x24')][_0xaad6('0x3c')](_0x16e2ab);})[_0xaad6('0x1f')](function(_0x3fd737){_0x21c823['rows']=_0x3fd737;return _0x21c823;})[_0xaad6('0x1f')](respondWithFilteredResult(_0x5e53d2,_0x16e2ab))[_0xaad6('0x3d')](handleError(_0x5e53d2,null));};exports[_0xaad6('0x3e')]=function(_0x517d1c,_0x16729e){var _0x976fb9={'raw':![],'where':{'id':_0x517d1c[_0xaad6('0x3f')]['id']}},_0x38d3be={};_0x38d3be[_0xaad6('0x2b')]=_[_0xaad6('0x26')](db[_0xaad6('0x24')][_0xaad6('0x25')]);_0x38d3be[_0xaad6('0x27')]=_['keys'](_0x517d1c[_0xaad6('0x27')]);_0x38d3be[_0xaad6('0x29')]=_[_0xaad6('0x2a')](_0x38d3be['model'],_0x38d3be[_0xaad6('0x27')]);_0x976fb9[_0xaad6('0x2d')]=_[_0xaad6('0x2a')](_0x38d3be[_0xaad6('0x2b')],qs[_0xaad6('0x2c')](_0x517d1c['query'][_0xaad6('0x2c')]));_0x976fb9[_0xaad6('0x2d')]=_0x976fb9[_0xaad6('0x2d')][_0xaad6('0x2e')]?_0x976fb9[_0xaad6('0x2d')]:_0x38d3be[_0xaad6('0x2b')];if(_0x517d1c[_0xaad6('0x27')][_0xaad6('0x3b')]){_0x976fb9[_0xaad6('0x40')]=[{'all':!![]}];}_0x976fb9=_[_0xaad6('0x37')]({},_0x976fb9,_0x517d1c[_0xaad6('0x3a')]);return db['VoiceChanSpy']['find'](_0x976fb9)[_0xaad6('0x1f')](handleEntityNotFound(_0x16729e,null))[_0xaad6('0x1f')](respondWithResult(_0x16729e,null))['catch'](handleError(_0x16729e,null));};exports[_0xaad6('0x41')]=function(_0x194b78,_0x2c8407){return db[_0xaad6('0x24')]['create'](_0x194b78['body'],{})['then'](respondWithResult(_0x2c8407,0xc9))[_0xaad6('0x3d')](handleError(_0x2c8407,null));};exports['update']=function(_0x4b28d3,_0x4496e2){if(_0x4b28d3[_0xaad6('0x42')]['id']){delete _0x4b28d3[_0xaad6('0x42')]['id'];}return db[_0xaad6('0x24')][_0xaad6('0x43')]({'where':{'id':_0x4b28d3[_0xaad6('0x3f')]['id']}})[_0xaad6('0x1f')](handleEntityNotFound(_0x4496e2,null))[_0xaad6('0x1f')](saveUpdates(_0x4b28d3[_0xaad6('0x42')],null))['then'](respondWithResult(_0x4496e2,null))[_0xaad6('0x3d')](handleError(_0x4496e2,null));};exports[_0xaad6('0x44')]=function(_0x173ca0,_0x49ba88){return db[_0xaad6('0x24')][_0xaad6('0x43')]({'where':{'id':_0x173ca0['params']['id']}})[_0xaad6('0x1f')](handleEntityNotFound(_0x49ba88,null))[_0xaad6('0x1f')](removeEntity(_0x49ba88,null))[_0xaad6('0x3d')](handleError(_0x49ba88,null));}; \ No newline at end of file +var _0x86d6=['length','nolimit','sort','where','pick','add','day','merge','filter','map','options','rows','catch','show','params','includeAll','include','create','update','body','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','then','stack','name','send','index','VoiceChanSpy','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields'];(function(_0x5064cf,_0x4e3550){var _0x4c8e17=function(_0x130419){while(--_0x130419){_0x5064cf['push'](_0x5064cf['shift']());}};_0x4c8e17(++_0x4e3550);}(_0x86d6,0x18e));var _0x686d=function(_0x58f89b,_0x16dd5d){_0x58f89b=_0x58f89b-0x0;var _0x21a55d=_0x86d6[_0x58f89b];return _0x21a55d;};'use strict';var jsonpatch=require(_0x686d('0x0'));var rp=require(_0x686d('0x1'));var moment=require(_0x686d('0x2'));var BPromise=require(_0x686d('0x3'));var Mustache=require(_0x686d('0x4'));var util=require(_0x686d('0x5'));var path=require('path');var sox=require(_0x686d('0x6'));var csv=require(_0x686d('0x7'));var ejs=require(_0x686d('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x686d('0x9'));var crypto=require('crypto');var jsforce=require(_0x686d('0xa'));var deskjs=require(_0x686d('0xb'));var toCsv=require(_0x686d('0x7'));var querystring=require(_0x686d('0xc'));var Papa=require(_0x686d('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0x686d('0xe'))(_0x686d('0xf'));var utils=require(_0x686d('0x10'));var config=require('../../config/environment');var db=require(_0x686d('0x11'))['db'];function respondWithStatusCode(_0x48524d,_0x2cdcbc){_0x2cdcbc=_0x2cdcbc||0xcc;return function(_0x3d28d4){if(_0x3d28d4){return _0x48524d['sendStatus'](_0x2cdcbc);}return _0x48524d[_0x686d('0x12')](_0x2cdcbc)[_0x686d('0x13')]();};}function respondWithResult(_0x3f161b,_0x59de29){_0x59de29=_0x59de29||0xc8;return function(_0x4cdaf8){if(_0x4cdaf8){return _0x3f161b[_0x686d('0x12')](_0x59de29)[_0x686d('0x14')](_0x4cdaf8);}};}function respondWithFilteredResult(_0x5a71d2,_0x4cff1c){return function(_0x2b9284){if(_0x2b9284){var _0x52f6d9=_0x2b9284[_0x686d('0x15')],_0x4b33a9=_0x4cff1c[_0x686d('0x16')],_0x21844d=_0x4cff1c[_0x686d('0x16')]+_0x4cff1c[_0x686d('0x17')],_0x30454b;if(_0x21844d>=_0x52f6d9){_0x21844d=_0x52f6d9;_0x30454b=0xc8;}else{_0x30454b=0xce;}_0x5a71d2[_0x686d('0x12')](_0x30454b);return _0x5a71d2['set'](_0x686d('0x18'),_0x4b33a9+'-'+_0x21844d+'/'+_0x52f6d9)['json'](_0x2b9284);}return null;};}function patchUpdates(_0xf59336){return function(_0x4e994b){try{jsonpatch[_0x686d('0x19')](_0x4e994b,_0xf59336,!![]);}catch(_0x5b15c4){return BPromise[_0x686d('0x1a')](_0x5b15c4);}return _0x4e994b['save']();};}function saveUpdates(_0x258ee2,_0x516103){return function(_0x1bd60f){if(_0x1bd60f){return _0x1bd60f['update'](_0x258ee2)[_0x686d('0x1b')](function(_0x14f30d){return _0x14f30d;});}return null;};}function removeEntity(_0x1abf72,_0x489ab0){return function(_0xdd0f4e){if(_0xdd0f4e){return _0xdd0f4e['destroy']()[_0x686d('0x1b')](function(){_0x1abf72['status'](0xcc)[_0x686d('0x13')]();});}};}function handleEntityNotFound(_0x48ecc7,_0x1893d6){return function(_0x142e65){if(!_0x142e65){_0x48ecc7['sendStatus'](0x194);}return _0x142e65;};}function handleError(_0x52c12a,_0x3e53ea){_0x3e53ea=_0x3e53ea||0x1f4;return function(_0x13ede5){logger['error'](_0x13ede5[_0x686d('0x1c')]);if(_0x13ede5[_0x686d('0x1d')]){delete _0x13ede5[_0x686d('0x1d')];}_0x52c12a[_0x686d('0x12')](_0x3e53ea)[_0x686d('0x1e')](_0x13ede5);};}exports[_0x686d('0x1f')]=function(_0x4a0c73,_0x156ff2){var _0x434ccf={},_0x299f6a={},_0x200da6={'count':0x0,'rows':[]};var _0x146aa9=db[_0x686d('0x20')][_0x686d('0x21')];_0x299f6a[_0x686d('0x22')]=_[_0x686d('0x23')](_0x146aa9);var _0xd62c79={'dateStart':_0x4a0c73[_0x686d('0x24')]['dateStart'],'dateEnd':_0x4a0c73[_0x686d('0x24')][_0x686d('0x25')]};delete _0x4a0c73[_0x686d('0x24')][_0x686d('0x26')];delete _0x4a0c73[_0x686d('0x24')][_0x686d('0x25')];_0x299f6a[_0x686d('0x24')]=_['keys'](_0x4a0c73[_0x686d('0x24')]);_0x299f6a[_0x686d('0x27')]=_[_0x686d('0x28')](_0x299f6a['model'],_0x299f6a['query']);_0x434ccf[_0x686d('0x29')]=_[_0x686d('0x28')](_0x299f6a[_0x686d('0x22')],qs[_0x686d('0x2a')](_0x4a0c73['query'][_0x686d('0x2a')]));_0x434ccf[_0x686d('0x29')]=_0x434ccf['attributes'][_0x686d('0x2b')]?_0x434ccf[_0x686d('0x29')]:_0x299f6a[_0x686d('0x22')];if(!_0x4a0c73[_0x686d('0x24')]['hasOwnProperty'](_0x686d('0x2c'))){_0x434ccf['limit']=qs[_0x686d('0x17')](_0x4a0c73[_0x686d('0x24')]['limit']);_0x434ccf[_0x686d('0x16')]=qs[_0x686d('0x16')](_0x4a0c73['query']['offset']);}_0x434ccf['order']=qs[_0x686d('0x2d')](_0x4a0c73[_0x686d('0x24')][_0x686d('0x2d')]);_0x434ccf[_0x686d('0x2e')]=qs[_0x686d('0x27')](_[_0x686d('0x2f')](_0x4a0c73[_0x686d('0x24')],_0x299f6a[_0x686d('0x27')]));if(_0xd62c79['dateStart']){if(_0xd62c79[_0x686d('0x25')]){_0xd62c79[_0x686d('0x25')]=moment(_0xd62c79[_0x686d('0x25')])[_0x686d('0x30')](0x1,_0x686d('0x31'));}else{_0xd62c79[_0x686d('0x25')]=moment(_0xd62c79['dateStart'])['add'](0x1,_0x686d('0x31'));}_[_0x686d('0x32')](_0x434ccf['where'],{'createdAt':{'$gte':_0xd62c79['dateStart'],'$lte':_0xd62c79['dateEnd']}});}if(_0x4a0c73['query'][_0x686d('0x33')]){_0x434ccf[_0x686d('0x2e')]=_[_0x686d('0x32')](_0x434ccf[_0x686d('0x2e')],{'$or':_[_0x686d('0x34')](_0x434ccf['attributes'],function(_0x287470){var _0x2a2526={};_0x2a2526[_0x287470]={'$like':'%'+_0x4a0c73[_0x686d('0x24')][_0x686d('0x33')]+'%'};return _0x2a2526;})});}_0x434ccf=_[_0x686d('0x32')]({},_0x434ccf,_0x4a0c73[_0x686d('0x35')]);var _0x42105a={'where':_0x434ccf[_0x686d('0x2e')]};return db[_0x686d('0x20')]['count'](_0x42105a)[_0x686d('0x1b')](function(_0x5d6c18){_0x200da6['count']=_0x5d6c18;if(_0x4a0c73[_0x686d('0x24')]['includeAll']){_0x434ccf['include']=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x434ccf);})[_0x686d('0x1b')](function(_0x4d6570){_0x200da6[_0x686d('0x36')]=_0x4d6570;return _0x200da6;})[_0x686d('0x1b')](respondWithFilteredResult(_0x156ff2,_0x434ccf))[_0x686d('0x37')](handleError(_0x156ff2,null));};exports[_0x686d('0x38')]=function(_0x2dae17,_0x5c0643){var _0xe39bdf={'raw':![],'where':{'id':_0x2dae17[_0x686d('0x39')]['id']}},_0x5068d4={};_0x5068d4[_0x686d('0x22')]=_['keys'](db[_0x686d('0x20')][_0x686d('0x21')]);_0x5068d4[_0x686d('0x24')]=_['keys'](_0x2dae17[_0x686d('0x24')]);_0x5068d4['filters']=_[_0x686d('0x28')](_0x5068d4['model'],_0x5068d4[_0x686d('0x24')]);_0xe39bdf[_0x686d('0x29')]=_[_0x686d('0x28')](_0x5068d4[_0x686d('0x22')],qs[_0x686d('0x2a')](_0x2dae17[_0x686d('0x24')][_0x686d('0x2a')]));_0xe39bdf[_0x686d('0x29')]=_0xe39bdf['attributes'][_0x686d('0x2b')]?_0xe39bdf['attributes']:_0x5068d4['model'];if(_0x2dae17[_0x686d('0x24')][_0x686d('0x3a')]){_0xe39bdf[_0x686d('0x3b')]=[{'all':!![]}];}_0xe39bdf=_[_0x686d('0x32')]({},_0xe39bdf,_0x2dae17['options']);return db[_0x686d('0x20')]['find'](_0xe39bdf)['then'](handleEntityNotFound(_0x5c0643,null))[_0x686d('0x1b')](respondWithResult(_0x5c0643,null))[_0x686d('0x37')](handleError(_0x5c0643,null));};exports[_0x686d('0x3c')]=function(_0x402e92,_0x1c21c8){return db[_0x686d('0x20')][_0x686d('0x3c')](_0x402e92['body'],{})[_0x686d('0x1b')](respondWithResult(_0x1c21c8,0xc9))['catch'](handleError(_0x1c21c8,null));};exports[_0x686d('0x3d')]=function(_0x7c4511,_0x1f5d1f){if(_0x7c4511[_0x686d('0x3e')]['id']){delete _0x7c4511['body']['id'];}return db[_0x686d('0x20')]['find']({'where':{'id':_0x7c4511['params']['id']}})[_0x686d('0x1b')](handleEntityNotFound(_0x1f5d1f,null))[_0x686d('0x1b')](saveUpdates(_0x7c4511['body'],null))[_0x686d('0x1b')](respondWithResult(_0x1f5d1f,null))[_0x686d('0x37')](handleError(_0x1f5d1f,null));};exports['destroy']=function(_0x3860ec,_0x173cb8){return db[_0x686d('0x20')]['find']({'where':{'id':_0x3860ec[_0x686d('0x39')]['id']}})[_0x686d('0x1b')](handleEntityNotFound(_0x173cb8,null))['then'](removeEntity(_0x173cb8,null))[_0x686d('0x37')](handleError(_0x173cb8,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index c81ec9c..d8153f5 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 _0xccdb=['push','merge','Set','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,ab','recordingFormat','auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','internal','concat','User','findAll','agent','catch','exports','models','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','system','format','%s%s','prefix'];(function(_0x224116,_0x319a4b){var _0x2fab3d=function(_0x21dd58){while(--_0x21dd58){_0x224116['push'](_0x224116['shift']());}};_0x2fab3d(++_0x319a4b);}(_0xccdb,0x90));var _0xbccd=function(_0x9de881,_0x449354){_0x9de881=_0x9de881-0x0;var _0x4d29d7=_0xccdb[_0x9de881];return _0x4d29d7;};'use strict';var _=require(_0xbccd('0x0'));var util=require(_0xbccd('0x1'));var BPromise=require(_0xbccd('0x2'));var logger=require('../../config/logger')('api');var attributes=require(_0xbccd('0x3'));var getUserApplications=function(_0x23064a,_0xf3a2f1,_0x2af1b0){var _0x5e8b42=0x1;var _0x106a33=[];var _0x1dbeba={'context':'from-sip','type':_0xbccd('0x4'),'isApp':![]};var _0x3fe658={'exten':util[_0xbccd('0x5')](_0xbccd('0x6'),_0x23064a[_0xbccd('0x7')],_0x2af1b0),'ChanSpyId':_0x23064a['id'],'UserId':_0xf3a2f1['id']};_0x106a33[_0xbccd('0x8')](_[_0xbccd('0x9')]({'app':_0xbccd('0xa'),'appdata':util[_0xbccd('0x5')](_0xbccd('0xb'),'chanspy'),'priority':_0x5e8b42++},_0x1dbeba,_0x3fe658));if(_0x23064a[_0xbccd('0xc')]){_0x106a33[_0xbccd('0x8')](_[_0xbccd('0x9')]({'app':_0xbccd('0xd'),'appdata':util[_0xbccd('0x5')](_0xbccd('0xe'),_0x23064a[_0xbccd('0xf')]),'priority':_0x5e8b42++},_0x1dbeba,_0x3fe658));}if(_0x23064a[_0xbccd('0x10')]){_0x106a33[_0xbccd('0x8')](_[_0xbccd('0x9')]({'app':_0xbccd('0x11'),'appdata':_0x23064a['password'],'priority':_0x5e8b42++},_0x1dbeba,_0x3fe658));}_0x106a33[_0xbccd('0x8')](_[_0xbccd('0x9')]({'app':_0xbccd('0x12'),'appdata':util[_0xbccd('0x5')](_0xbccd('0x13'),_0xf3a2f1[_0xbccd('0x14')],_0x23064a[_0xbccd('0x15')]?_0x23064a['options'][_0xbccd('0x16')](''):''),'priority':_0x5e8b42++},_0x1dbeba,_0x3fe658));if(_0x23064a['record']){_0x106a33[_0xbccd('0x8')](_['merge']({'app':_0xbccd('0x17'),'priority':_0x5e8b42++},_0x1dbeba,_0x3fe658));}return _0x106a33;};var getChanSpyApplications=function(_0x2eaf37,_0x954356){var _0xf8e90e=[];for(var _0x2c4a66=0x0,_0x5556d3=0x1;_0x2c4a66<_0x954356[_0xbccd('0x18')];_0x2c4a66++,_0x5556d3=0x1){var _0x2b0127=getUserApplications(_0x2eaf37,_0x954356[_0x2c4a66],_0x954356[_0x2c4a66][_0xbccd('0x19')]);var _0x20e3cc=getUserApplications(_0x2eaf37,_0x954356[_0x2c4a66],_0x954356[_0x2c4a66][_0xbccd('0x14')]);_0xf8e90e=_0xf8e90e[_0xbccd('0x1a')](_0x2b0127,_0x20e3cc);}return _0xf8e90e;};var getChanSpyPromise=function(_0x4b1fd7,_0x45cc0c){return new BPromise(function(_0x1abfcd,_0x6903be){return _0x4b1fd7[_0xbccd('0x1b')][_0xbccd('0x1c')]({'attributes':['id','name',_0xbccd('0x19')],'where':{'role':_0xbccd('0x1d'),'chanspy':!![]},'raw':!![]})['then'](function(_0x2bed07){if(_0x2bed07){return _0x1abfcd(getChanSpyApplications(_0x45cc0c,_0x2bed07));}return _0x1abfcd([]);})[_0xbccd('0x1e')](function(_0x58d120){_0x6903be(_0x58d120);});});};module[_0xbccd('0x1f')]=function(_0x396ca8,_0xb3384c){var _0x3ff310=_0x396ca8[_0xbccd('0x20')];return _0x396ca8['define']('VoiceChanSpy',attributes,{'tableName':_0xbccd('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x26a9c8,_0x4d14f8,_0x5825bd){return getChanSpyPromise(_0x3ff310,_0x26a9c8)[_0xbccd('0x22')](function(_0x4f9330){if(_0x4f9330&&_0x4f9330[_0xbccd('0x18')]){return _0x3ff310[_0xbccd('0x23')][_0xbccd('0x24')](_0x4f9330);}})['then'](function(){_0x5825bd();})['catch'](function(_0x5df040){_0x5825bd(_0x5df040);});},'afterUpdate':function(_0x23d3c6,_0x124581,_0x451845){return _0x3ff310[_0xbccd('0x23')][_0xbccd('0x25')]({'where':{'ChanSpyId':_0x23d3c6['id']}})['then'](function(){return getChanSpyPromise(_0x3ff310,_0x23d3c6);})[_0xbccd('0x22')](function(_0xa3cb6b){if(_0xa3cb6b&&_0xa3cb6b[_0xbccd('0x18')]){return _0x3ff310[_0xbccd('0x23')][_0xbccd('0x24')](_0xa3cb6b);}})[_0xbccd('0x22')](function(){_0x451845();})['catch'](function(_0x4d286a){_0x451845(_0x4d286a);});},'afterDestroy':function(_0x28fda0,_0x985a74,_0x53f44f){return _0x3ff310[_0xbccd('0x23')][_0xbccd('0x25')]({'where':{'ChanSpyId':_0x28fda0['id']}})[_0xbccd('0x22')](function(){_0x53f44f();})['catch'](function(_0x57325a){_0x53f44f(_0x57325a);});}}});}; \ No newline at end of file +var _0x73de=['prefix','merge','Set','CDR(type)=%s','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,ab','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','length','internal','concat','User','agent','catch','exports','models','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','api','./voiceChanSpy.attributes','from-sip','format','%s%s'];(function(_0x505a3b,_0x57181b){var _0x1cfc5f=function(_0x5c6da9){while(--_0x5c6da9){_0x505a3b['push'](_0x505a3b['shift']());}};_0x1cfc5f(++_0x57181b);}(_0x73de,0x109));var _0xe73d=function(_0x56ba8d,_0x4ff4ee){_0x56ba8d=_0x56ba8d-0x0;var _0x284d5d=_0x73de[_0x56ba8d];return _0x284d5d;};'use strict';var _=require(_0xe73d('0x0'));var util=require(_0xe73d('0x1'));var BPromise=require(_0xe73d('0x2'));var logger=require('../../config/logger')(_0xe73d('0x3'));var attributes=require(_0xe73d('0x4'));var getUserApplications=function(_0x5c6da3,_0x575eac,_0x35d4c4){var _0x42ea84=0x1;var _0x26343a=[];var _0x370d16={'context':_0xe73d('0x5'),'type':'system','isApp':![]};var _0x53f7f1={'exten':util[_0xe73d('0x6')](_0xe73d('0x7'),_0x5c6da3[_0xe73d('0x8')],_0x35d4c4),'ChanSpyId':_0x5c6da3['id'],'UserId':_0x575eac['id']};_0x26343a['push'](_[_0xe73d('0x9')]({'app':_0xe73d('0xa'),'appdata':util['format'](_0xe73d('0xb'),_0xe73d('0xc')),'priority':_0x42ea84++},_0x370d16,_0x53f7f1));if(_0x5c6da3[_0xe73d('0xd')]){_0x26343a[_0xe73d('0xe')](_['merge']({'app':_0xe73d('0xf'),'appdata':util[_0xe73d('0x6')](_0xe73d('0x10'),_0x5c6da3[_0xe73d('0x11')]),'priority':_0x42ea84++},_0x370d16,_0x53f7f1));}if(_0x5c6da3['auth']){_0x26343a[_0xe73d('0xe')](_[_0xe73d('0x9')]({'app':_0xe73d('0x12'),'appdata':_0x5c6da3[_0xe73d('0x13')],'priority':_0x42ea84++},_0x370d16,_0x53f7f1));}_0x26343a[_0xe73d('0xe')](_[_0xe73d('0x9')]({'app':_0xe73d('0x14'),'appdata':util[_0xe73d('0x6')](_0xe73d('0x15'),_0x575eac[_0xe73d('0x16')],_0x5c6da3[_0xe73d('0x17')]?_0x5c6da3[_0xe73d('0x17')][_0xe73d('0x18')](''):''),'priority':_0x42ea84++},_0x370d16,_0x53f7f1));if(_0x5c6da3[_0xe73d('0xd')]){_0x26343a[_0xe73d('0xe')](_[_0xe73d('0x9')]({'app':'StopMixMonitor','priority':_0x42ea84++},_0x370d16,_0x53f7f1));}return _0x26343a;};var getChanSpyApplications=function(_0x2743ad,_0x1afafe){var _0x35d3ed=[];for(var _0x300df0=0x0,_0x17a5a5=0x1;_0x300df0<_0x1afafe[_0xe73d('0x19')];_0x300df0++,_0x17a5a5=0x1){var _0x19255b=getUserApplications(_0x2743ad,_0x1afafe[_0x300df0],_0x1afafe[_0x300df0][_0xe73d('0x1a')]);var _0xafdbad=getUserApplications(_0x2743ad,_0x1afafe[_0x300df0],_0x1afafe[_0x300df0][_0xe73d('0x16')]);_0x35d3ed=_0x35d3ed[_0xe73d('0x1b')](_0x19255b,_0xafdbad);}return _0x35d3ed;};var getChanSpyPromise=function(_0x4fd396,_0x14ffbf){return new BPromise(function(_0x143c5c,_0x4bbcf4){return _0x4fd396[_0xe73d('0x1c')]['findAll']({'attributes':['id',_0xe73d('0x16'),_0xe73d('0x1a')],'where':{'role':_0xe73d('0x1d'),'chanspy':!![]},'raw':!![]})['then'](function(_0xcb3e15){if(_0xcb3e15){return _0x143c5c(getChanSpyApplications(_0x14ffbf,_0xcb3e15));}return _0x143c5c([]);})[_0xe73d('0x1e')](function(_0x4d05c8){_0x4bbcf4(_0x4d05c8);});});};module[_0xe73d('0x1f')]=function(_0x387c17,_0x1a3d92){var _0x3b766f=_0x387c17[_0xe73d('0x20')];return _0x387c17['define'](_0xe73d('0x21'),attributes,{'tableName':_0xe73d('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x54f295,_0x589b6c,_0x39f345){return getChanSpyPromise(_0x3b766f,_0x54f295)[_0xe73d('0x23')](function(_0x4a39b3){if(_0x4a39b3&&_0x4a39b3[_0xe73d('0x19')]){return _0x3b766f[_0xe73d('0x24')][_0xe73d('0x25')](_0x4a39b3);}})['then'](function(){_0x39f345();})[_0xe73d('0x1e')](function(_0x187eda){_0x39f345(_0x187eda);});},'afterUpdate':function(_0x3a9c69,_0x13b379,_0x36d633){return _0x3b766f[_0xe73d('0x24')][_0xe73d('0x26')]({'where':{'ChanSpyId':_0x3a9c69['id']}})[_0xe73d('0x23')](function(){return getChanSpyPromise(_0x3b766f,_0x3a9c69);})[_0xe73d('0x23')](function(_0x2ffd66){if(_0x2ffd66&&_0x2ffd66[_0xe73d('0x19')]){return _0x3b766f[_0xe73d('0x24')][_0xe73d('0x25')](_0x2ffd66);}})[_0xe73d('0x23')](function(){_0x36d633();})[_0xe73d('0x1e')](function(_0x1c4924){_0x36d633(_0x1c4924);});},'afterDestroy':function(_0x417945,_0x3945b5,_0x2b3b4d){return _0x3b766f['VoiceExtension'][_0xe73d('0x26')]({'where':{'ChanSpyId':_0x417945['id']}})[_0xe73d('0x23')](function(){_0x2b3b4d();})[_0xe73d('0x1e')](function(_0x37f19f){_0x2b3b4d(_0x37f19f);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 677bcce..6a5b70e 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 _0x5302=['rpc','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','../../config/utils'];(function(_0xb541ac,_0x140813){var _0x4a159f=function(_0x3b2d8d){while(--_0x3b2d8d){_0xb541ac['push'](_0xb541ac['shift']());}};_0x4a159f(++_0x140813);}(_0x5302,0x1b5));var _0x2530=function(_0x2355a4,_0xc0b80d){_0x2355a4=_0x2355a4-0x0;var _0xe22dd=_0x5302[_0x2355a4];return _0xe22dd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2530('0x0'));var BPromise=require(_0x2530('0x1'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x2530('0x2'));var logger=require('../../config/logger')(_0x2530('0x3'));var config=require('../../config/environment');var jayson=require(_0x2530('0x4'));var client=jayson[_0x2530('0x5')][_0x2530('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x14ca82,_0x9f762,_0x574655){return new BPromise(function(_0x306dd4,_0x3d75d0){return client[_0x2530('0x7')](_0x14ca82,_0x574655)[_0x2530('0x8')](function(_0x3f7422){logger[_0x2530('0x9')](_0x2530('0xa'),_0x9f762,_0x2530('0xb'));logger[_0x2530('0xc')](_0x2530('0xd'),_0x9f762,_0x2530('0xb'),JSON[_0x2530('0xe')](_0x3f7422));if(_0x3f7422[_0x2530('0xf')]){if(_0x3f7422[_0x2530('0xf')][_0x2530('0x10')]===0x1f4){logger[_0x2530('0xf')](_0x2530('0xa'),_0x9f762,_0x3f7422['error'][_0x2530('0x11')]);return _0x3d75d0(_0x3f7422[_0x2530('0xf')][_0x2530('0x11')]);}logger[_0x2530('0xf')](_0x2530('0xa'),_0x9f762,_0x3f7422[_0x2530('0xf')][_0x2530('0x11')]);return _0x306dd4(_0x3f7422['error']['message']);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x9f762,_0x2530('0xb'));_0x306dd4(_0x3f7422[_0x2530('0x12')]['message']);}})[_0x2530('0x13')](function(_0x2bc155){logger[_0x2530('0xf')](_0x2530('0xa'),_0x9f762,_0x2bc155);_0x3d75d0(_0x2bc155);});});} \ No newline at end of file +var _0xe1d7=['error','code','message','info','catch','util','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xd3348b,_0x288d47){var _0x583cdc=function(_0x743e06){while(--_0x743e06){_0xd3348b['push'](_0xd3348b['shift']());}};_0x583cdc(++_0x288d47);}(_0xe1d7,0x1a9));var _0x7e1d=function(_0x389af3,_0x30a76a){_0x389af3=_0x389af3-0x0;var _0x199d87=_0xe1d7[_0x389af3];return _0x199d87;};'use strict';var _=require('lodash');var util=require(_0x7e1d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0x7e1d('0x1'))['db'];var utils=require(_0x7e1d('0x2'));var logger=require(_0x7e1d('0x3'))('rpc');var config=require(_0x7e1d('0x4'));var jayson=require(_0x7e1d('0x5'));var client=jayson[_0x7e1d('0x6')][_0x7e1d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x467d6e,_0x491c61,_0x2f7577){return new BPromise(function(_0x2c3efa,_0x4ba560){return client[_0x7e1d('0x8')](_0x467d6e,_0x2f7577)[_0x7e1d('0x9')](function(_0x5c4a0b){logger['info'](_0x7e1d('0xa'),_0x491c61,_0x7e1d('0xb'));logger[_0x7e1d('0xc')](_0x7e1d('0xd'),_0x491c61,_0x7e1d('0xb'),JSON[_0x7e1d('0xe')](_0x5c4a0b));if(_0x5c4a0b[_0x7e1d('0xf')]){if(_0x5c4a0b['error'][_0x7e1d('0x10')]===0x1f4){logger[_0x7e1d('0xf')](_0x7e1d('0xa'),_0x491c61,_0x5c4a0b[_0x7e1d('0xf')]['message']);return _0x4ba560(_0x5c4a0b[_0x7e1d('0xf')][_0x7e1d('0x11')]);}logger[_0x7e1d('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x491c61,_0x5c4a0b[_0x7e1d('0xf')][_0x7e1d('0x11')]);return _0x2c3efa(_0x5c4a0b['error']['message']);}else{logger[_0x7e1d('0x12')](_0x7e1d('0xa'),_0x491c61,_0x7e1d('0xb'));_0x2c3efa(_0x5c4a0b['result'][_0x7e1d('0x11')]);}})[_0x7e1d('0x13')](function(_0x528fd0){logger[_0x7e1d('0xf')](_0x7e1d('0xa'),_0x491c61,_0x528fd0);_0x4ba560(_0x528fd0);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index f27cf9a..cecc8c8 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 _0xd8b6=['util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','show','put','update','delete','destroy','exports','multer'];(function(_0x2c99cf,_0x3b58c8){var _0x3388cd=function(_0x3a31d9){while(--_0x3a31d9){_0x2c99cf['push'](_0x2c99cf['shift']());}};_0x3388cd(++_0x3b58c8);}(_0xd8b6,0x10d));var _0x6d8b=function(_0x36ece1,_0x9e1dc7){_0x36ece1=_0x36ece1-0x0;var _0x10b964=_0xd8b6[_0x36ece1];return _0x10b964;};'use strict';var multer=require(_0x6d8b('0x0'));var util=require(_0x6d8b('0x1'));var path=require('path');var express=require(_0x6d8b('0x2'));var router=express['Router']();var auth=require(_0x6d8b('0x3'));var interaction=require(_0x6d8b('0x4'));var config=require(_0x6d8b('0x5'));var controller=require(_0x6d8b('0x6'));router['get']('/',auth[_0x6d8b('0x7')](),controller[_0x6d8b('0x8')]);router['get']('/:id',auth[_0x6d8b('0x7')](),controller[_0x6d8b('0x9')]);router['post']('/',auth[_0x6d8b('0x7')](),controller['create']);router[_0x6d8b('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x6d8b('0xb')]);router[_0x6d8b('0xc')]('/:id',auth[_0x6d8b('0x7')](),controller[_0x6d8b('0xd')]);module[_0x6d8b('0xe')]=router; \ No newline at end of file +var _0xf213=['post','create','put','update','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','isAuthenticated','index','get','/:id','show'];(function(_0x2b5e59,_0x786083){var _0x319549=function(_0x2a068d){while(--_0x2a068d){_0x2b5e59['push'](_0x2b5e59['shift']());}};_0x319549(++_0x786083);}(_0xf213,0x8c));var _0x3f21=function(_0x933ca1,_0x35b042){_0x933ca1=_0x933ca1-0x0;var _0x2e0bc2=_0xf213[_0x933ca1];return _0x2e0bc2;};'use strict';var multer=require(_0x3f21('0x0'));var util=require(_0x3f21('0x1'));var path=require(_0x3f21('0x2'));var express=require(_0x3f21('0x3'));var router=express[_0x3f21('0x4')]();var auth=require(_0x3f21('0x5'));var interaction=require(_0x3f21('0x6'));var config=require('../../config/environment');var controller=require(_0x3f21('0x7'));router['get']('/',auth[_0x3f21('0x8')](),controller[_0x3f21('0x9')]);router[_0x3f21('0xa')](_0x3f21('0xb'),auth[_0x3f21('0x8')](),controller[_0x3f21('0xc')]);router[_0x3f21('0xd')]('/',auth['isAuthenticated'](),controller[_0x3f21('0xe')]);router[_0x3f21('0xf')](_0x3f21('0xb'),auth[_0x3f21('0x8')](),controller[_0x3f21('0x10')]);router['delete'](_0x3f21('0xb'),auth[_0x3f21('0x8')](),controller['destroy']);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 a9631ca..bc1afde 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 _0xf7e7=['BOOLEAN','sequelize','exports','STRING','name'];(function(_0xd816e2,_0x5edac2){var _0x1f5924=function(_0x1bcbf0){while(--_0x1bcbf0){_0xd816e2['push'](_0xd816e2['shift']());}};_0x1f5924(++_0x5edac2);}(_0xf7e7,0x8d));var _0x7f7e=function(_0x460e21,_0x2339e0){_0x460e21=_0x460e21-0x0;var _0x76f68a=_0xf7e7[_0x460e21];return _0x76f68a;};'use strict';var Sequelize=require(_0x7f7e('0x0'));module[_0x7f7e('0x1')]={'name':{'type':Sequelize[_0x7f7e('0x2')],'unique':_0x7f7e('0x3')},'description':{'type':Sequelize[_0x7f7e('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7f7e('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe195=['STRING','sequelize','exports'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0xe195,0x1a2));var _0x5e19=function(_0x57e583,_0x3d5dc7){_0x57e583=_0x57e583-0x0;var _0x440de1=_0xe195[_0x57e583];return _0x440de1;};'use strict';var Sequelize=require(_0x5e19('0x0'));module[_0x5e19('0x1')]={'name':{'type':Sequelize[_0x5e19('0x2')],'unique':'name'},'description':{'type':Sequelize[_0x5e19('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index affe8f6..9e6d957 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 _0x0388=['util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','../../config/utils','jayson/promise','client','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','end','count','offset','limit','set','Content-Range','json','apply','update','destroy','then','sendStatus','stack','name','VoiceContext','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','fields','length','hasOwnProperty','order','sort','where','day','add','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','intersection','find','body','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','create','chan_sip.so','params','readFileSync','join','root','writeFileSync','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x0388,0x1a9));var _0x8038=function(_0x3c7b00,_0x38b1ae){_0x3c7b00=_0x3c7b00-0x0;var _0x2645a3=_0x0388[_0x3c7b00];return _0x2645a3;};'use strict';var jsonpatch=require(_0x8038('0x0'));var rp=require(_0x8038('0x1'));var moment=require(_0x8038('0x2'));var BPromise=require(_0x8038('0x3'));var Mustache=require(_0x8038('0x4'));var util=require(_0x8038('0x5'));var path=require(_0x8038('0x6'));var sox=require(_0x8038('0x7'));var csv=require(_0x8038('0x8'));var ejs=require(_0x8038('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8038('0xa'));var jsforce=require(_0x8038('0xb'));var deskjs=require(_0x8038('0xc'));var toCsv=require(_0x8038('0x8'));var querystring=require(_0x8038('0xd'));var Papa=require(_0x8038('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0x8038('0xf'))('api');var utils=require(_0x8038('0x10'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x8038('0x11'));var client=jayson[_0x8038('0x12')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e1b10,_0x5db270,_0x34afe1,_0x300020){return new BPromise(function(_0x103652,_0x54a461){var _0x21cff1=_0x300020||client;return _0x21cff1[_0x8038('0x13')](_0x3e1b10,_0x34afe1)['then'](function(_0x313f7b){logger[_0x8038('0x14')](_0x8038('0x15'),_0x5db270,_0x8038('0x16'));logger[_0x8038('0x17')](_0x8038('0x18'),_0x5db270,_0x8038('0x16'),JSON[_0x8038('0x19')](_0x313f7b));if(_0x313f7b['error']){if(_0x313f7b[_0x8038('0x1a')][_0x8038('0x1b')]===0x1f4){logger[_0x8038('0x1a')](_0x8038('0x15'),_0x5db270,_0x313f7b[_0x8038('0x1a')]['message']);return _0x54a461(_0x313f7b['error']['message']);}logger[_0x8038('0x1a')](_0x8038('0x15'),_0x5db270,_0x313f7b[_0x8038('0x1a')][_0x8038('0x1c')]);return _0x103652(_0x313f7b[_0x8038('0x1a')][_0x8038('0x1c')]);}else{logger['info'](_0x8038('0x15'),_0x5db270,_0x8038('0x16'));_0x103652(_0x313f7b['result'][_0x8038('0x1c')]);}})['catch'](function(_0x19fa34){logger['error'](_0x8038('0x15'),_0x5db270,_0x19fa34);_0x54a461(_0x19fa34);});});}function respondWithStatusCode(_0x30c24a,_0x2050be){_0x2050be=_0x2050be||0xcc;return function(_0xac181f){if(_0xac181f){return _0x30c24a['sendStatus'](_0x2050be);}return _0x30c24a[_0x8038('0x1d')](_0x2050be)[_0x8038('0x1e')]();};}function respondWithResult(_0x164405,_0x5ccd1a){_0x5ccd1a=_0x5ccd1a||0xc8;return function(_0x88f7b1){if(_0x88f7b1){return _0x164405[_0x8038('0x1d')](_0x5ccd1a)['json'](_0x88f7b1);}};}function respondWithFilteredResult(_0x4c4e8a,_0xde5682){return function(_0x9a15ac){if(_0x9a15ac){var _0x4bbcee=_0x9a15ac[_0x8038('0x1f')],_0x371006=_0xde5682[_0x8038('0x20')],_0x56e82c=_0xde5682[_0x8038('0x20')]+_0xde5682[_0x8038('0x21')],_0x38f905;if(_0x56e82c>=_0x4bbcee){_0x56e82c=_0x4bbcee;_0x38f905=0xc8;}else{_0x38f905=0xce;}_0x4c4e8a[_0x8038('0x1d')](_0x38f905);return _0x4c4e8a[_0x8038('0x22')](_0x8038('0x23'),_0x371006+'-'+_0x56e82c+'/'+_0x4bbcee)[_0x8038('0x24')](_0x9a15ac);}return null;};}function patchUpdates(_0x3458b4){return function(_0x2e78ab){try{jsonpatch[_0x8038('0x25')](_0x2e78ab,_0x3458b4,!![]);}catch(_0x1804cb){return BPromise['reject'](_0x1804cb);}return _0x2e78ab['save']();};}function saveUpdates(_0x44fed5,_0x181660){return function(_0x32e813){if(_0x32e813){return _0x32e813[_0x8038('0x26')](_0x44fed5)['then'](function(_0x4c690f){return _0x4c690f;});}return null;};}function removeEntity(_0x595cfc,_0xd198b6){return function(_0x12d9bc){if(_0x12d9bc){return _0x12d9bc[_0x8038('0x27')]()[_0x8038('0x28')](function(){_0x595cfc[_0x8038('0x1d')](0xcc)[_0x8038('0x1e')]();});}};}function handleEntityNotFound(_0x1f43ca,_0x48c660){return function(_0x13c0b5){if(!_0x13c0b5){_0x1f43ca[_0x8038('0x29')](0x194);}return _0x13c0b5;};}function handleError(_0x213487,_0x2962bf){_0x2962bf=_0x2962bf||0x1f4;return function(_0x124679){logger[_0x8038('0x1a')](_0x124679[_0x8038('0x2a')]);if(_0x124679[_0x8038('0x2b')]){delete _0x124679['name'];}_0x213487['status'](_0x2962bf)['send'](_0x124679);};}exports['index']=function(_0x4ccecd,_0x1e4d0a){var _0xb1a446={},_0x32c8eb={},_0x428481={'count':0x0,'rows':[]};var _0x103038=db[_0x8038('0x2c')][_0x8038('0x2d')];_0x32c8eb[_0x8038('0x2e')]=_[_0x8038('0x2f')](_0x103038);var _0x44418c={'dateStart':_0x4ccecd[_0x8038('0x30')][_0x8038('0x31')],'dateEnd':_0x4ccecd['query'][_0x8038('0x32')]};delete _0x4ccecd[_0x8038('0x30')][_0x8038('0x31')];delete _0x4ccecd[_0x8038('0x30')][_0x8038('0x32')];_0x32c8eb['query']=_[_0x8038('0x2f')](_0x4ccecd[_0x8038('0x30')]);_0x32c8eb[_0x8038('0x33')]=_['intersection'](_0x32c8eb[_0x8038('0x2e')],_0x32c8eb[_0x8038('0x30')]);_0xb1a446[_0x8038('0x34')]=_['intersection'](_0x32c8eb[_0x8038('0x2e')],qs[_0x8038('0x35')](_0x4ccecd[_0x8038('0x30')][_0x8038('0x35')]));_0xb1a446[_0x8038('0x34')]=_0xb1a446[_0x8038('0x34')][_0x8038('0x36')]?_0xb1a446[_0x8038('0x34')]:_0x32c8eb['model'];if(!_0x4ccecd['query'][_0x8038('0x37')]('nolimit')){_0xb1a446[_0x8038('0x21')]=qs[_0x8038('0x21')](_0x4ccecd[_0x8038('0x30')][_0x8038('0x21')]);_0xb1a446[_0x8038('0x20')]=qs[_0x8038('0x20')](_0x4ccecd[_0x8038('0x30')][_0x8038('0x20')]);}_0xb1a446[_0x8038('0x38')]=qs[_0x8038('0x39')](_0x4ccecd[_0x8038('0x30')][_0x8038('0x39')]);_0xb1a446[_0x8038('0x3a')]=qs[_0x8038('0x33')](_['pick'](_0x4ccecd[_0x8038('0x30')],_0x32c8eb[_0x8038('0x33')]));if(_0x44418c[_0x8038('0x31')]){if(_0x44418c['dateEnd']){_0x44418c[_0x8038('0x32')]=moment(_0x44418c[_0x8038('0x32')])['add'](0x1,_0x8038('0x3b'));}else{_0x44418c[_0x8038('0x32')]=moment(_0x44418c[_0x8038('0x31')])[_0x8038('0x3c')](0x1,_0x8038('0x3b'));}_[_0x8038('0x3d')](_0xb1a446[_0x8038('0x3a')],{'createdAt':{'$gte':_0x44418c[_0x8038('0x31')],'$lte':_0x44418c[_0x8038('0x32')]}});}if(_0x4ccecd[_0x8038('0x30')][_0x8038('0x3e')]){_0xb1a446['where']=_[_0x8038('0x3d')](_0xb1a446[_0x8038('0x3a')],{'$or':_[_0x8038('0x3f')](_0xb1a446[_0x8038('0x34')],function(_0x31fbba){var _0x26e27e={};_0x26e27e[_0x31fbba]={'$like':'%'+_0x4ccecd[_0x8038('0x30')][_0x8038('0x3e')]+'%'};return _0x26e27e;})});}_0xb1a446=_[_0x8038('0x3d')]({},_0xb1a446,_0x4ccecd[_0x8038('0x40')]);var _0x402d04={'where':_0xb1a446[_0x8038('0x3a')]};return db['VoiceContext']['count'](_0x402d04)[_0x8038('0x28')](function(_0x243141){_0x428481[_0x8038('0x1f')]=_0x243141;if(_0x4ccecd['query'][_0x8038('0x41')]){_0xb1a446[_0x8038('0x42')]=[{'all':!![]}];}return db[_0x8038('0x2c')][_0x8038('0x43')](_0xb1a446);})[_0x8038('0x28')](function(_0x1a29fd){_0x428481[_0x8038('0x44')]=_0x1a29fd;return _0x428481;})[_0x8038('0x28')](respondWithFilteredResult(_0x1e4d0a,_0xb1a446))[_0x8038('0x45')](handleError(_0x1e4d0a,null));};exports[_0x8038('0x46')]=function(_0x3023d3,_0x5df101){var _0x35db1b={'raw':![],'where':{'id':_0x3023d3['params']['id']}},_0x270fab={};_0x270fab[_0x8038('0x2e')]=_['keys'](db[_0x8038('0x2c')][_0x8038('0x2d')]);_0x270fab[_0x8038('0x30')]=_[_0x8038('0x2f')](_0x3023d3[_0x8038('0x30')]);_0x270fab[_0x8038('0x33')]=_[_0x8038('0x47')](_0x270fab[_0x8038('0x2e')],_0x270fab[_0x8038('0x30')]);_0x35db1b[_0x8038('0x34')]=_[_0x8038('0x47')](_0x270fab[_0x8038('0x2e')],qs[_0x8038('0x35')](_0x3023d3[_0x8038('0x30')][_0x8038('0x35')]));_0x35db1b[_0x8038('0x34')]=_0x35db1b[_0x8038('0x34')][_0x8038('0x36')]?_0x35db1b[_0x8038('0x34')]:_0x270fab[_0x8038('0x2e')];if(_0x3023d3[_0x8038('0x30')][_0x8038('0x41')]){_0x35db1b[_0x8038('0x42')]=[{'all':!![]}];}_0x35db1b=_[_0x8038('0x3d')]({},_0x35db1b,_0x3023d3[_0x8038('0x40')]);return db[_0x8038('0x2c')][_0x8038('0x48')](_0x35db1b)[_0x8038('0x28')](handleEntityNotFound(_0x5df101,null))['then'](respondWithResult(_0x5df101,null))[_0x8038('0x45')](handleError(_0x5df101,null));};exports['create']=function(_0x389736,_0x2d257f,_0xbb44ae){var _0x19694d;return db[_0x8038('0x2c')]['create'](_0x389736[_0x8038('0x49')],{'raw':!![]})['then'](function(_0x5eb046){_0x19694d=_0x5eb046;return db[_0x8038('0x2c')][_0x8038('0x43')]({'raw':!![]});})['then'](function(_0x3c1bca){var _0x23bae5=fs['readFileSync'](path['join'](config['root'],_0x8038('0x4a')),_0x8038('0x4b'));var _0x2c33c1=ejs[_0x8038('0x4c')](_0x23bae5,{'contexts':_0x3c1bca||[]});fs['writeFileSync'](_0x8038('0x4d'),_0x2c33c1);})[_0x8038('0x28')](function(){return respondWithRpcPromise(_0x8038('0x4e'),_0x8038('0x4f'),{'module':_0x8038('0x50')});})['then'](function(){return _0x19694d;})[_0x8038('0x28')](respondWithResult(_0x2d257f,0xc9))[_0x8038('0x45')](handleError(_0x2d257f,null));};exports[_0x8038('0x26')]=function(_0x367e77,_0x5792a0,_0x45e15a){var _0x3e20c0;return db['VoiceContext'][_0x8038('0x48')]({'where':{'id':_0x367e77[_0x8038('0x51')]['id']}})[_0x8038('0x28')](handleEntityNotFound(_0x5792a0,null))[_0x8038('0x28')](saveUpdates(_0x367e77[_0x8038('0x49')],null))['then'](function(_0x3fc7d9){if(_0x3fc7d9){_0x3e20c0=_0x3fc7d9;return db[_0x8038('0x2c')]['findAll']({'raw':!![]});}})[_0x8038('0x28')](function(_0x272419){var _0x503547=fs[_0x8038('0x52')](path[_0x8038('0x53')](config[_0x8038('0x54')],_0x8038('0x4a')),_0x8038('0x4b'));var _0x365afe=ejs[_0x8038('0x4c')](_0x503547,{'contexts':_0x272419||[]});fs[_0x8038('0x55')](_0x8038('0x4d'),_0x365afe);})[_0x8038('0x28')](function(){return respondWithRpcPromise(_0x8038('0x4e'),'update',{'module':_0x8038('0x50')});})[_0x8038('0x28')](function(){return _0x3e20c0;})[_0x8038('0x28')](respondWithResult(_0x5792a0,null))[_0x8038('0x45')](handleError(_0x5792a0,null));};exports['destroy']=function(_0x1244e1,_0x435925,_0x5580be){var _0x26f5b4;return db[_0x8038('0x2c')][_0x8038('0x48')]({'where':{'id':_0x1244e1[_0x8038('0x51')]['id']}})['then'](handleEntityNotFound(_0x435925,null))[_0x8038('0x28')](removeEntity(_0x435925,null))[_0x8038('0x28')](function(){return db['VoiceContext'][_0x8038('0x43')]({'raw':!![]});})[_0x8038('0x28')](function(_0x3fe1ab){var _0x5cab8b=fs[_0x8038('0x52')](path[_0x8038('0x53')](config[_0x8038('0x54')],_0x8038('0x4a')),'utf8');var _0x413bd8=ejs[_0x8038('0x4c')](_0x5cab8b,{'contexts':_0x3fe1ab});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x413bd8);return respondWithRpcPromise(_0x8038('0x4e'),_0x8038('0x27'),{'module':_0x8038('0x50')});})[_0x8038('0x45')](handleError(_0x435925,null));}; \ No newline at end of file +var _0x8449=['model','query','dateStart','dateEnd','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','add','day','merge','map','findAll','rows','show','params','VoiceContext','length','includeAll','include','options','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','find','Reload','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','apply','save','update','then','destroy','name','send','rawAttributes'];(function(_0x3194d9,_0x3b9296){var _0x40a963=function(_0x5c2558){while(--_0x5c2558){_0x3194d9['push'](_0x3194d9['shift']());}};_0x40a963(++_0x3b9296);}(_0x8449,0x7e));var _0x9844=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x8449[_0xd09668];return _0x68726;};'use strict';var jsonpatch=require(_0x9844('0x0'));var rp=require(_0x9844('0x1'));var moment=require(_0x9844('0x2'));var BPromise=require(_0x9844('0x3'));var Mustache=require('mustache');var util=require(_0x9844('0x4'));var path=require(_0x9844('0x5'));var sox=require(_0x9844('0x6'));var csv=require(_0x9844('0x7'));var ejs=require(_0x9844('0x8'));var fs=require('fs');var _=require(_0x9844('0x9'));var squel=require('squel');var crypto=require(_0x9844('0xa'));var jsforce=require(_0x9844('0xb'));var deskjs=require(_0x9844('0xc'));var toCsv=require(_0x9844('0x7'));var querystring=require(_0x9844('0xd'));var Papa=require(_0x9844('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0x9844('0xf'))(_0x9844('0x10'));var utils=require(_0x9844('0x11'));var config=require(_0x9844('0x12'));var db=require(_0x9844('0x13'))['db'];var jayson=require(_0x9844('0x14'));var client=jayson[_0x9844('0x15')][_0x9844('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x2fe225,_0x11e98a,_0x3f5888,_0xd18c5c){return new BPromise(function(_0x4ec117,_0x4cecbd){var _0x3750ea=_0xd18c5c||client;return _0x3750ea[_0x9844('0x17')](_0x2fe225,_0x3f5888)['then'](function(_0xb6ac7){logger[_0x9844('0x18')](_0x9844('0x19'),_0x11e98a,_0x9844('0x1a'));logger[_0x9844('0x1b')](_0x9844('0x1c'),_0x11e98a,_0x9844('0x1a'),JSON[_0x9844('0x1d')](_0xb6ac7));if(_0xb6ac7[_0x9844('0x1e')]){if(_0xb6ac7[_0x9844('0x1e')][_0x9844('0x1f')]===0x1f4){logger[_0x9844('0x1e')](_0x9844('0x19'),_0x11e98a,_0xb6ac7[_0x9844('0x1e')][_0x9844('0x20')]);return _0x4cecbd(_0xb6ac7[_0x9844('0x1e')][_0x9844('0x20')]);}logger[_0x9844('0x1e')](_0x9844('0x19'),_0x11e98a,_0xb6ac7['error'][_0x9844('0x20')]);return _0x4ec117(_0xb6ac7[_0x9844('0x1e')][_0x9844('0x20')]);}else{logger[_0x9844('0x18')](_0x9844('0x19'),_0x11e98a,_0x9844('0x1a'));_0x4ec117(_0xb6ac7[_0x9844('0x21')][_0x9844('0x20')]);}})[_0x9844('0x22')](function(_0x11d510){logger[_0x9844('0x1e')](_0x9844('0x19'),_0x11e98a,_0x11d510);_0x4cecbd(_0x11d510);});});}function respondWithStatusCode(_0x19a1aa,_0x200227){_0x200227=_0x200227||0xcc;return function(_0x630692){if(_0x630692){return _0x19a1aa[_0x9844('0x23')](_0x200227);}return _0x19a1aa[_0x9844('0x24')](_0x200227)[_0x9844('0x25')]();};}function respondWithResult(_0x4ed126,_0x1a581f){_0x1a581f=_0x1a581f||0xc8;return function(_0x26eebf){if(_0x26eebf){return _0x4ed126['status'](_0x1a581f)[_0x9844('0x26')](_0x26eebf);}};}function respondWithFilteredResult(_0x5f126e,_0x13732f){return function(_0x2d9f3a){if(_0x2d9f3a){var _0x455ba6=_0x2d9f3a[_0x9844('0x27')],_0x18ef7f=_0x13732f[_0x9844('0x28')],_0x3704f0=_0x13732f[_0x9844('0x28')]+_0x13732f[_0x9844('0x29')],_0xfc6e6;if(_0x3704f0>=_0x455ba6){_0x3704f0=_0x455ba6;_0xfc6e6=0xc8;}else{_0xfc6e6=0xce;}_0x5f126e[_0x9844('0x24')](_0xfc6e6);return _0x5f126e['set']('Content-Range',_0x18ef7f+'-'+_0x3704f0+'/'+_0x455ba6)[_0x9844('0x26')](_0x2d9f3a);}return null;};}function patchUpdates(_0x3549b3){return function(_0x3cec48){try{jsonpatch[_0x9844('0x2a')](_0x3cec48,_0x3549b3,!![]);}catch(_0x103357){return BPromise['reject'](_0x103357);}return _0x3cec48[_0x9844('0x2b')]();};}function saveUpdates(_0x44053e,_0x45886b){return function(_0x1ce259){if(_0x1ce259){return _0x1ce259[_0x9844('0x2c')](_0x44053e)[_0x9844('0x2d')](function(_0x128764){return _0x128764;});}return null;};}function removeEntity(_0x38c7aa,_0x1c7c65){return function(_0xa6a01d){if(_0xa6a01d){return _0xa6a01d[_0x9844('0x2e')]()[_0x9844('0x2d')](function(){_0x38c7aa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f2f47,_0x7d261e){return function(_0x5c7994){if(!_0x5c7994){_0x3f2f47[_0x9844('0x23')](0x194);}return _0x5c7994;};}function handleError(_0x4586a7,_0x39be8f){_0x39be8f=_0x39be8f||0x1f4;return function(_0x3abfd9){logger[_0x9844('0x1e')](_0x3abfd9['stack']);if(_0x3abfd9[_0x9844('0x2f')]){delete _0x3abfd9['name'];}_0x4586a7[_0x9844('0x24')](_0x39be8f)[_0x9844('0x30')](_0x3abfd9);};}exports['index']=function(_0x34f7a,_0xb92de4){var _0x21c7d8={},_0x1c000f={},_0x7ea156={'count':0x0,'rows':[]};var _0x359b26=db['VoiceContext'][_0x9844('0x31')];_0x1c000f[_0x9844('0x32')]=_['keys'](_0x359b26);var _0x426d74={'dateStart':_0x34f7a[_0x9844('0x33')][_0x9844('0x34')],'dateEnd':_0x34f7a[_0x9844('0x33')][_0x9844('0x35')]};delete _0x34f7a[_0x9844('0x33')][_0x9844('0x34')];delete _0x34f7a[_0x9844('0x33')][_0x9844('0x35')];_0x1c000f['query']=_[_0x9844('0x36')](_0x34f7a[_0x9844('0x33')]);_0x1c000f[_0x9844('0x37')]=_['intersection'](_0x1c000f[_0x9844('0x32')],_0x1c000f[_0x9844('0x33')]);_0x21c7d8[_0x9844('0x38')]=_[_0x9844('0x39')](_0x1c000f[_0x9844('0x32')],qs['fields'](_0x34f7a[_0x9844('0x33')][_0x9844('0x3a')]));_0x21c7d8[_0x9844('0x38')]=_0x21c7d8[_0x9844('0x38')]['length']?_0x21c7d8[_0x9844('0x38')]:_0x1c000f[_0x9844('0x32')];if(!_0x34f7a[_0x9844('0x33')][_0x9844('0x3b')](_0x9844('0x3c'))){_0x21c7d8['limit']=qs[_0x9844('0x29')](_0x34f7a[_0x9844('0x33')]['limit']);_0x21c7d8[_0x9844('0x28')]=qs['offset'](_0x34f7a[_0x9844('0x33')][_0x9844('0x28')]);}_0x21c7d8['order']=qs[_0x9844('0x3d')](_0x34f7a[_0x9844('0x33')][_0x9844('0x3d')]);_0x21c7d8[_0x9844('0x3e')]=qs[_0x9844('0x37')](_['pick'](_0x34f7a[_0x9844('0x33')],_0x1c000f[_0x9844('0x37')]));if(_0x426d74[_0x9844('0x34')]){if(_0x426d74['dateEnd']){_0x426d74[_0x9844('0x35')]=moment(_0x426d74['dateEnd'])[_0x9844('0x3f')](0x1,_0x9844('0x40'));}else{_0x426d74[_0x9844('0x35')]=moment(_0x426d74['dateStart'])['add'](0x1,_0x9844('0x40'));}_[_0x9844('0x41')](_0x21c7d8[_0x9844('0x3e')],{'createdAt':{'$gte':_0x426d74['dateStart'],'$lte':_0x426d74[_0x9844('0x35')]}});}if(_0x34f7a[_0x9844('0x33')]['filter']){_0x21c7d8[_0x9844('0x3e')]=_[_0x9844('0x41')](_0x21c7d8[_0x9844('0x3e')],{'$or':_[_0x9844('0x42')](_0x21c7d8[_0x9844('0x38')],function(_0x5b9591){var _0x424a61={};_0x424a61[_0x5b9591]={'$like':'%'+_0x34f7a[_0x9844('0x33')]['filter']+'%'};return _0x424a61;})});}_0x21c7d8=_['merge']({},_0x21c7d8,_0x34f7a['options']);var _0x39994c={'where':_0x21c7d8[_0x9844('0x3e')]};return db['VoiceContext'][_0x9844('0x27')](_0x39994c)[_0x9844('0x2d')](function(_0x3a8ffe){_0x7ea156['count']=_0x3a8ffe;if(_0x34f7a[_0x9844('0x33')]['includeAll']){_0x21c7d8['include']=[{'all':!![]}];}return db['VoiceContext'][_0x9844('0x43')](_0x21c7d8);})[_0x9844('0x2d')](function(_0x166d4f){_0x7ea156[_0x9844('0x44')]=_0x166d4f;return _0x7ea156;})[_0x9844('0x2d')](respondWithFilteredResult(_0xb92de4,_0x21c7d8))[_0x9844('0x22')](handleError(_0xb92de4,null));};exports[_0x9844('0x45')]=function(_0x34bd5a,_0x2ae550){var _0x2f23af={'raw':![],'where':{'id':_0x34bd5a[_0x9844('0x46')]['id']}},_0x569fb5={};_0x569fb5[_0x9844('0x32')]=_[_0x9844('0x36')](db[_0x9844('0x47')][_0x9844('0x31')]);_0x569fb5[_0x9844('0x33')]=_[_0x9844('0x36')](_0x34bd5a[_0x9844('0x33')]);_0x569fb5[_0x9844('0x37')]=_[_0x9844('0x39')](_0x569fb5[_0x9844('0x32')],_0x569fb5['query']);_0x2f23af[_0x9844('0x38')]=_[_0x9844('0x39')](_0x569fb5[_0x9844('0x32')],qs['fields'](_0x34bd5a[_0x9844('0x33')]['fields']));_0x2f23af[_0x9844('0x38')]=_0x2f23af[_0x9844('0x38')][_0x9844('0x48')]?_0x2f23af[_0x9844('0x38')]:_0x569fb5['model'];if(_0x34bd5a[_0x9844('0x33')][_0x9844('0x49')]){_0x2f23af[_0x9844('0x4a')]=[{'all':!![]}];}_0x2f23af=_['merge']({},_0x2f23af,_0x34bd5a[_0x9844('0x4b')]);return db[_0x9844('0x47')]['find'](_0x2f23af)[_0x9844('0x2d')](handleEntityNotFound(_0x2ae550,null))[_0x9844('0x2d')](respondWithResult(_0x2ae550,null))[_0x9844('0x22')](handleError(_0x2ae550,null));};exports[_0x9844('0x4c')]=function(_0x45b759,_0x489769,_0x223b20){var _0x518f78;return db[_0x9844('0x47')][_0x9844('0x4c')](_0x45b759[_0x9844('0x4d')],{'raw':!![]})[_0x9844('0x2d')](function(_0x1ce3a6){_0x518f78=_0x1ce3a6;return db[_0x9844('0x47')]['findAll']({'raw':!![]});})[_0x9844('0x2d')](function(_0x25852e){var _0x766d3=fs[_0x9844('0x4e')](path[_0x9844('0x4f')](config[_0x9844('0x50')],_0x9844('0x51')),_0x9844('0x52'));var _0x3ef47a=ejs[_0x9844('0x53')](_0x766d3,{'contexts':_0x25852e||[]});fs[_0x9844('0x54')](_0x9844('0x55'),_0x3ef47a);})[_0x9844('0x2d')](function(){return respondWithRpcPromise('Reload',_0x9844('0x4c'),{'module':'chan_sip.so'});})[_0x9844('0x2d')](function(){return _0x518f78;})[_0x9844('0x2d')](respondWithResult(_0x489769,0xc9))[_0x9844('0x22')](handleError(_0x489769,null));};exports['update']=function(_0x4e6c54,_0x13d786,_0x284a90){var _0x1aacdc;return db[_0x9844('0x47')][_0x9844('0x56')]({'where':{'id':_0x4e6c54[_0x9844('0x46')]['id']}})['then'](handleEntityNotFound(_0x13d786,null))[_0x9844('0x2d')](saveUpdates(_0x4e6c54[_0x9844('0x4d')],null))[_0x9844('0x2d')](function(_0x5cea1f){if(_0x5cea1f){_0x1aacdc=_0x5cea1f;return db[_0x9844('0x47')][_0x9844('0x43')]({'raw':!![]});}})['then'](function(_0x3d6d97){var _0x1ae87f=fs[_0x9844('0x4e')](path[_0x9844('0x4f')](config[_0x9844('0x50')],_0x9844('0x51')),'utf8');var _0x4a2939=ejs['render'](_0x1ae87f,{'contexts':_0x3d6d97||[]});fs['writeFileSync'](_0x9844('0x55'),_0x4a2939);})['then'](function(){return respondWithRpcPromise('Reload',_0x9844('0x2c'),{'module':'chan_sip.so'});})['then'](function(){return _0x1aacdc;})[_0x9844('0x2d')](respondWithResult(_0x13d786,null))['catch'](handleError(_0x13d786,null));};exports[_0x9844('0x2e')]=function(_0x18a729,_0x49a766,_0x1cad09){var _0x38f8d3;return db[_0x9844('0x47')][_0x9844('0x56')]({'where':{'id':_0x18a729[_0x9844('0x46')]['id']}})['then'](handleEntityNotFound(_0x49a766,null))[_0x9844('0x2d')](removeEntity(_0x49a766,null))[_0x9844('0x2d')](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0x9844('0x2d')](function(_0xcd1fca){var _0x3cfcbb=fs[_0x9844('0x4e')](path[_0x9844('0x4f')](config[_0x9844('0x50')],_0x9844('0x51')),_0x9844('0x52'));var _0x231237=ejs[_0x9844('0x53')](_0x3cfcbb,{'contexts':_0xcd1fca});fs[_0x9844('0x54')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x231237);return respondWithRpcPromise(_0x9844('0x57'),'destroy',{'module':'chan_sip.so'});})['catch'](handleError(_0x49a766,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index ef443df..87a12d7 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 _0x6742=['bluebird','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','../../config/logger','moment'];(function(_0x576c41,_0x49ceb9){var _0x4359e2=function(_0x509f5f){while(--_0x509f5f){_0x576c41['push'](_0x576c41['shift']());}};_0x4359e2(++_0x49ceb9);}(_0x6742,0x8d));var _0x2674=function(_0x419ba4,_0xf7e845){_0x419ba4=_0x419ba4-0x0;var _0x5bf9d0=_0x6742[_0x419ba4];return _0x5bf9d0;};'use strict';var _=require(_0x2674('0x0'));var util=require('util');var logger=require(_0x2674('0x1'))('api');var moment=require(_0x2674('0x2'));var BPromise=require(_0x2674('0x3'));var rp=require('request-promise');var attributes=require(_0x2674('0x4'));module[_0x2674('0x5')]=function(_0x1ede3e,_0x28ea9a){return _0x1ede3e[_0x2674('0x6')](_0x2674('0x7'),attributes,{'tableName':_0x2674('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce52=['request-promise','./voiceContext.attributes','exports','define','VoiceContext','lodash','../../config/logger','api','moment','bluebird'];(function(_0x452c4a,_0x541e2d){var _0x494325=function(_0x526709){while(--_0x526709){_0x452c4a['push'](_0x452c4a['shift']());}};_0x494325(++_0x541e2d);}(_0xce52,0xff));var _0x2ce5=function(_0x284f86,_0x5c163b){_0x284f86=_0x284f86-0x0;var _0x2d8fdf=_0xce52[_0x284f86];return _0x2d8fdf;};'use strict';var _=require(_0x2ce5('0x0'));var util=require('util');var logger=require(_0x2ce5('0x1'))(_0x2ce5('0x2'));var moment=require(_0x2ce5('0x3'));var BPromise=require(_0x2ce5('0x4'));var rp=require(_0x2ce5('0x5'));var attributes=require(_0x2ce5('0x6'));module[_0x2ce5('0x7')]=function(_0x21a400,_0x5b7d70){return _0x21a400[_0x2ce5('0x8')](_0x2ce5('0x9'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 49cf073..613b81e 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 _0x696f=['result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x696f,0x1e5));var _0xf696=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x696f[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xf696('0x0'));var util=require(_0xf696('0x1'));var moment=require(_0xf696('0x2'));var BPromise=require(_0xf696('0x3'));var rs=require(_0xf696('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf696('0x5'))(_0xf696('0x6'));var config=require(_0xf696('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf696('0x8')][_0xf696('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3addeb,_0x1b8804,_0x6c9038){return new BPromise(function(_0x48211e,_0x476a21){return client[_0xf696('0xa')](_0x3addeb,_0x6c9038)[_0xf696('0xb')](function(_0x4bf646){logger[_0xf696('0xc')](_0xf696('0xd'),_0x1b8804,_0xf696('0xe'));logger[_0xf696('0xf')](_0xf696('0x10'),_0x1b8804,'request\x20sent',JSON[_0xf696('0x11')](_0x4bf646));if(_0x4bf646[_0xf696('0x12')]){if(_0x4bf646[_0xf696('0x12')][_0xf696('0x13')]===0x1f4){logger[_0xf696('0x12')]('VoiceContext,\x20%s,\x20%s',_0x1b8804,_0x4bf646[_0xf696('0x12')][_0xf696('0x14')]);return _0x476a21(_0x4bf646['error'][_0xf696('0x14')]);}logger[_0xf696('0x12')]('VoiceContext,\x20%s,\x20%s',_0x1b8804,_0x4bf646[_0xf696('0x12')][_0xf696('0x14')]);return _0x48211e(_0x4bf646[_0xf696('0x12')][_0xf696('0x14')]);}else{logger[_0xf696('0xc')](_0xf696('0xd'),_0x1b8804,'request\x20sent');_0x48211e(_0x4bf646[_0xf696('0x15')][_0xf696('0x14')]);}})[_0xf696('0x16')](function(_0xab7b16){logger['error']('VoiceContext,\x20%s,\x20%s',_0x1b8804,_0xab7b16);_0x476a21(_0xab7b16);});});} \ No newline at end of file +var _0x7ee7=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring'];(function(_0x39ae3a,_0x3437c2){var _0x60fdb6=function(_0x4d6a30){while(--_0x4d6a30){_0x39ae3a['push'](_0x39ae3a['shift']());}};_0x60fdb6(++_0x3437c2);}(_0x7ee7,0x81));var _0x77ee=function(_0x1a2ab3,_0x4cd6e7){_0x1a2ab3=_0x1a2ab3-0x0;var _0x58fe6c=_0x7ee7[_0x1a2ab3];return _0x58fe6c;};'use strict';var _=require('lodash');var util=require(_0x77ee('0x0'));var moment=require(_0x77ee('0x1'));var BPromise=require('bluebird');var rs=require(_0x77ee('0x2'));var fs=require('fs');var db=require(_0x77ee('0x3'))['db'];var utils=require(_0x77ee('0x4'));var logger=require(_0x77ee('0x5'))('rpc');var config=require(_0x77ee('0x6'));var jayson=require(_0x77ee('0x7'));var client=jayson[_0x77ee('0x8')][_0x77ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ac082,_0x4e4643,_0x5bea6b){return new BPromise(function(_0x225697,_0x18750f){return client[_0x77ee('0xa')](_0x2ac082,_0x5bea6b)[_0x77ee('0xb')](function(_0x55c614){logger[_0x77ee('0xc')](_0x77ee('0xd'),_0x4e4643,_0x77ee('0xe'));logger[_0x77ee('0xf')](_0x77ee('0x10'),_0x4e4643,'request\x20sent',JSON[_0x77ee('0x11')](_0x55c614));if(_0x55c614[_0x77ee('0x12')]){if(_0x55c614[_0x77ee('0x12')][_0x77ee('0x13')]===0x1f4){logger['error'](_0x77ee('0xd'),_0x4e4643,_0x55c614[_0x77ee('0x12')]['message']);return _0x18750f(_0x55c614[_0x77ee('0x12')][_0x77ee('0x14')]);}logger[_0x77ee('0x12')](_0x77ee('0xd'),_0x4e4643,_0x55c614[_0x77ee('0x12')]['message']);return _0x225697(_0x55c614['error']['message']);}else{logger[_0x77ee('0xc')]('VoiceContext,\x20%s,\x20%s',_0x4e4643,'request\x20sent');_0x225697(_0x55c614[_0x77ee('0x15')][_0x77ee('0x14')]);}})['catch'](function(_0x35fbe2){logger[_0x77ee('0x12')]('VoiceContext,\x20%s,\x20%s',_0x4e4643,_0x35fbe2);_0x18750f(_0x35fbe2);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 2d8b6c6..87a54ef 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(_0x59c4d8,_0x2fcb38){var _0x4af7e2=function(_0x2ec642){while(--_0x2ec642){_0x59c4d8['push'](_0x59c4d8['shift']());}};_0x4af7e2(++_0x2fcb38);}(_0x5f2f,0x73));var _0xf5f2=function(_0x128644,_0x12ccec){_0x128644=_0x128644-0x0;var _0x341ecf=_0x5f2f[_0x128644];return _0x341ecf;};'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 _0x7a54=['/describe','describe','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index'];(function(_0x1f6850,_0x57a439){var _0x47730a=function(_0x38d568){while(--_0x38d568){_0x1f6850['push'](_0x1f6850['shift']());}};_0x47730a(++_0x57a439);}(_0x7a54,0x106));var _0x47a5=function(_0x2eba33,_0x46e5f6){_0x2eba33=_0x2eba33-0x0;var _0x305b46=_0x7a54[_0x2eba33];return _0x305b46;};'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/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 06b9fc5..cf15550 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 _0x9208=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x5d92c2,_0x26d815){var _0x415601=function(_0x507e8f){while(--_0x507e8f){_0x5d92c2['push'](_0x5d92c2['shift']());}};_0x415601(++_0x26d815);}(_0x9208,0x108));var _0x8920=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9208[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x8920('0x0'));module[_0x8920('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8920('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x8920('0x2')]},'calleridname':{'type':Sequelize[_0x8920('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8920('0x2')]},'connectedlinename':{'type':Sequelize[_0x8920('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8920('0x2')]},'context':{'type':Sequelize[_0x8920('0x2')]},'exten':{'type':Sequelize[_0x8920('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x8920('0x2')]},'linkedid':{'type':Sequelize[_0x8920('0x2')]},'destchannel':{'type':Sequelize[_0x8920('0x2')]},'destchannelstate':{'type':Sequelize[_0x8920('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x8920('0x2')]},'destcalleridnum':{'type':Sequelize[_0x8920('0x2')]},'destcalleridname':{'type':Sequelize[_0x8920('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x8920('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x8920('0x2')]},'destaccountcode':{'type':Sequelize[_0x8920('0x2')]},'destcontext':{'type':Sequelize[_0x8920('0x2')]},'destexten':{'type':Sequelize[_0x8920('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x8920('0x2')]},'destlinkedid':{'type':Sequelize[_0x8920('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x8920('0x2')]},'starttime':{'type':Sequelize[_0x8920('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x8920('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x8920('0x5')},'routeId':{'type':Sequelize[_0x8920('0x3')]},'duration':{'type':Sequelize[_0x8920('0x3')]},'holdtime':{'type':Sequelize[_0x8920('0x3')]},'billableseconds':{'type':Sequelize[_0x8920('0x3')]}}; \ No newline at end of file +var _0xb0de=['INTEGER','DATE','called,connect,complete','sequelize','STRING'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xb0de,0x148));var _0xeb0d=function(_0x522712,_0x2da7e9){_0x522712=_0x522712-0x0;var _0x4fe3e0=_0xb0de[_0x522712];return _0x4fe3e0;};'use strict';var Sequelize=require(_0xeb0d('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xeb0d('0x1')]},'channel':{'type':Sequelize[_0xeb0d('0x1')]},'channelstate':{'type':Sequelize[_0xeb0d('0x2')]},'channelstatedesc':{'type':Sequelize[_0xeb0d('0x1')]},'calleridnum':{'type':Sequelize[_0xeb0d('0x1')]},'calleridname':{'type':Sequelize[_0xeb0d('0x1')]},'connectedlinenum':{'type':Sequelize[_0xeb0d('0x1')]},'connectedlinename':{'type':Sequelize[_0xeb0d('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xeb0d('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xeb0d('0x1')]},'priority':{'type':Sequelize[_0xeb0d('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xeb0d('0x1')]},'destchannel':{'type':Sequelize[_0xeb0d('0x1')]},'destchannelstate':{'type':Sequelize[_0xeb0d('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xeb0d('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xeb0d('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xeb0d('0x1')]},'destaccountcode':{'type':Sequelize[_0xeb0d('0x1')]},'destcontext':{'type':Sequelize[_0xeb0d('0x1')]},'destexten':{'type':Sequelize[_0xeb0d('0x1')]},'destpriority':{'type':Sequelize[_0xeb0d('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0xeb0d('0x1')]},'dialstring':{'type':Sequelize[_0xeb0d('0x1')]},'dialstatus':{'type':Sequelize[_0xeb0d('0x1')]},'starttime':{'type':Sequelize[_0xeb0d('0x3')]},'answertime':{'type':Sequelize[_0xeb0d('0x3')]},'endtime':{'type':Sequelize[_0xeb0d('0x3')]},'lastevent':{'type':Sequelize[_0xeb0d('0x1')],'comment':_0xeb0d('0x4')},'routeId':{'type':Sequelize[_0xeb0d('0x2')]},'duration':{'type':Sequelize[_0xeb0d('0x2')]},'holdtime':{'type':Sequelize[_0xeb0d('0x2')]},'billableseconds':{'type':Sequelize[_0xeb0d('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index fa3a0de..4b4ef65 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 _0x8f11=['lodash','crypto','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','reject','save','update','then','destroy','stack','name','send','index','VoiceDialReport','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','filter','merge','map','options','includeAll','include','rows','catch','show','params','find','create','body','describe','request-promise','moment','mustache','ejs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8f11,0xc5));var _0x18f1=function(_0x4f7295,_0x555244){_0x4f7295=_0x4f7295-0x0;var _0x302b0c=_0x8f11[_0x4f7295];return _0x302b0c;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x18f1('0x0'));var moment=require(_0x18f1('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x18f1('0x2'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x18f1('0x3'));var fs=require('fs');var _=require(_0x18f1('0x4'));var squel=require('squel');var crypto=require(_0x18f1('0x5'));var jsforce=require(_0x18f1('0x6'));var deskjs=require(_0x18f1('0x7'));var toCsv=require(_0x18f1('0x8'));var querystring=require(_0x18f1('0x9'));var Papa=require(_0x18f1('0xa'));var qs=require(_0x18f1('0xb'));var logger=require(_0x18f1('0xc'))(_0x18f1('0xd'));var utils=require(_0x18f1('0xe'));var config=require(_0x18f1('0xf'));var db=require(_0x18f1('0x10'))['db'];function respondWithStatusCode(_0x1d61fb,_0x4b85d4){_0x4b85d4=_0x4b85d4||0xcc;return function(_0x51980c){if(_0x51980c){return _0x1d61fb[_0x18f1('0x11')](_0x4b85d4);}return _0x1d61fb[_0x18f1('0x12')](_0x4b85d4)[_0x18f1('0x13')]();};}function respondWithResult(_0x33caaf,_0x3c6dbf){_0x3c6dbf=_0x3c6dbf||0xc8;return function(_0x3d94bc){if(_0x3d94bc){return _0x33caaf[_0x18f1('0x12')](_0x3c6dbf)[_0x18f1('0x14')](_0x3d94bc);}};}function respondWithFilteredResult(_0x2df522,_0x217c3c){return function(_0x4c5903){if(_0x4c5903){var _0x16fc36=_0x4c5903[_0x18f1('0x15')],_0x37027a=_0x217c3c[_0x18f1('0x16')],_0x270686=_0x217c3c[_0x18f1('0x16')]+_0x217c3c[_0x18f1('0x17')],_0x1d8419;if(_0x270686>=_0x16fc36){_0x270686=_0x16fc36;_0x1d8419=0xc8;}else{_0x1d8419=0xce;}_0x2df522[_0x18f1('0x12')](_0x1d8419);return _0x2df522['set']('Content-Range',_0x37027a+'-'+_0x270686+'/'+_0x16fc36)['json'](_0x4c5903);}return null;};}function patchUpdates(_0x279338){return function(_0x38f73f){try{jsonpatch['apply'](_0x38f73f,_0x279338,!![]);}catch(_0x1ff1e9){return BPromise[_0x18f1('0x18')](_0x1ff1e9);}return _0x38f73f[_0x18f1('0x19')]();};}function saveUpdates(_0x101fbe,_0x59a435){return function(_0x393ef0){if(_0x393ef0){return _0x393ef0[_0x18f1('0x1a')](_0x101fbe)[_0x18f1('0x1b')](function(_0x3fbef0){return _0x3fbef0;});}return null;};}function removeEntity(_0xe3b36f,_0x2dd795){return function(_0x36b2be){if(_0x36b2be){return _0x36b2be[_0x18f1('0x1c')]()[_0x18f1('0x1b')](function(){_0xe3b36f[_0x18f1('0x12')](0xcc)[_0x18f1('0x13')]();});}};}function handleEntityNotFound(_0x4b739b,_0x2f7d01){return function(_0x33c638){if(!_0x33c638){_0x4b739b[_0x18f1('0x11')](0x194);}return _0x33c638;};}function handleError(_0x445ed9,_0x331256){_0x331256=_0x331256||0x1f4;return function(_0x35c3d6){logger['error'](_0x35c3d6[_0x18f1('0x1d')]);if(_0x35c3d6[_0x18f1('0x1e')]){delete _0x35c3d6[_0x18f1('0x1e')];}_0x445ed9[_0x18f1('0x12')](_0x331256)[_0x18f1('0x1f')](_0x35c3d6);};}exports[_0x18f1('0x20')]=function(_0x2dbf42,_0x19aade){var _0xe4e45c={},_0x1d4fe5={},_0x4393e7={'count':0x0,'rows':[]};var _0x3166ae=db[_0x18f1('0x21')][_0x18f1('0x22')];_0x1d4fe5[_0x18f1('0x23')]=_[_0x18f1('0x24')](_0x3166ae);var _0x1765a7={'dateStart':_0x2dbf42[_0x18f1('0x25')]['dateStart'],'dateEnd':_0x2dbf42[_0x18f1('0x25')][_0x18f1('0x26')]};delete _0x2dbf42[_0x18f1('0x25')][_0x18f1('0x27')];delete _0x2dbf42['query'][_0x18f1('0x26')];_0x1d4fe5[_0x18f1('0x25')]=_[_0x18f1('0x24')](_0x2dbf42[_0x18f1('0x25')]);_0x1d4fe5[_0x18f1('0x28')]=_[_0x18f1('0x29')](_0x1d4fe5[_0x18f1('0x23')],_0x1d4fe5[_0x18f1('0x25')]);_0xe4e45c['attributes']=_[_0x18f1('0x29')](_0x1d4fe5['model'],qs[_0x18f1('0x2a')](_0x2dbf42[_0x18f1('0x25')][_0x18f1('0x2a')]));_0xe4e45c[_0x18f1('0x2b')]=_0xe4e45c['attributes'][_0x18f1('0x2c')]?_0xe4e45c[_0x18f1('0x2b')]:_0x1d4fe5['model'];if(!_0x2dbf42['query'][_0x18f1('0x2d')](_0x18f1('0x2e'))){_0xe4e45c[_0x18f1('0x17')]=qs[_0x18f1('0x17')](_0x2dbf42[_0x18f1('0x25')][_0x18f1('0x17')]);_0xe4e45c[_0x18f1('0x16')]=qs[_0x18f1('0x16')](_0x2dbf42['query'][_0x18f1('0x16')]);}_0xe4e45c[_0x18f1('0x2f')]=qs[_0x18f1('0x30')](_0x2dbf42[_0x18f1('0x25')]['sort']);_0xe4e45c[_0x18f1('0x31')]=qs[_0x18f1('0x28')](_[_0x18f1('0x32')](_0x2dbf42['query'],_0x1d4fe5[_0x18f1('0x28')]));if(_0x1765a7[_0x18f1('0x27')]){if(_0x1765a7[_0x18f1('0x26')]){_0x1765a7[_0x18f1('0x26')]=moment(_0x1765a7[_0x18f1('0x26')])[_0x18f1('0x33')](0x1,'day');}else{_0x1765a7[_0x18f1('0x26')]=moment(_0x1765a7[_0x18f1('0x27')])[_0x18f1('0x33')](0x1,_0x18f1('0x34'));}_['merge'](_0xe4e45c['where'],{'createdAt':{'$gte':_0x1765a7[_0x18f1('0x27')],'$lte':_0x1765a7[_0x18f1('0x26')]}});}if(_0x2dbf42[_0x18f1('0x25')][_0x18f1('0x35')]){_0xe4e45c[_0x18f1('0x31')]=_[_0x18f1('0x36')](_0xe4e45c['where'],{'$or':_[_0x18f1('0x37')](_0xe4e45c['attributes'],function(_0x98f9e6){var _0x5a1f24={};_0x5a1f24[_0x98f9e6]={'$like':'%'+_0x2dbf42['query'][_0x18f1('0x35')]+'%'};return _0x5a1f24;})});}_0xe4e45c=_[_0x18f1('0x36')]({},_0xe4e45c,_0x2dbf42[_0x18f1('0x38')]);var _0x1acd9a={'where':_0xe4e45c[_0x18f1('0x31')]};return db[_0x18f1('0x21')][_0x18f1('0x15')](_0x1acd9a)['then'](function(_0x2fe134){_0x4393e7[_0x18f1('0x15')]=_0x2fe134;if(_0x2dbf42[_0x18f1('0x25')][_0x18f1('0x39')]){_0xe4e45c[_0x18f1('0x3a')]=[{'all':!![]}];}return db[_0x18f1('0x21')]['findAll'](_0xe4e45c);})[_0x18f1('0x1b')](function(_0x25a881){_0x4393e7[_0x18f1('0x3b')]=_0x25a881;return _0x4393e7;})[_0x18f1('0x1b')](respondWithFilteredResult(_0x19aade,_0xe4e45c))[_0x18f1('0x3c')](handleError(_0x19aade,null));};exports[_0x18f1('0x3d')]=function(_0x153d4e,_0x1137c8){var _0x69f113={'raw':!![],'where':{'id':_0x153d4e[_0x18f1('0x3e')]['id']}},_0x5c5698={};_0x5c5698[_0x18f1('0x23')]=_[_0x18f1('0x24')](db[_0x18f1('0x21')][_0x18f1('0x22')]);_0x5c5698[_0x18f1('0x25')]=_[_0x18f1('0x24')](_0x153d4e['query']);_0x5c5698[_0x18f1('0x28')]=_[_0x18f1('0x29')](_0x5c5698[_0x18f1('0x23')],_0x5c5698[_0x18f1('0x25')]);_0x69f113[_0x18f1('0x2b')]=_[_0x18f1('0x29')](_0x5c5698[_0x18f1('0x23')],qs[_0x18f1('0x2a')](_0x153d4e[_0x18f1('0x25')][_0x18f1('0x2a')]));_0x69f113['attributes']=_0x69f113[_0x18f1('0x2b')][_0x18f1('0x2c')]?_0x69f113['attributes']:_0x5c5698[_0x18f1('0x23')];if(_0x153d4e[_0x18f1('0x25')][_0x18f1('0x39')]){_0x69f113[_0x18f1('0x3a')]=[{'all':!![]}];}_0x69f113=_['merge']({},_0x69f113,_0x153d4e[_0x18f1('0x38')]);return db[_0x18f1('0x21')][_0x18f1('0x3f')](_0x69f113)['then'](handleEntityNotFound(_0x1137c8,null))[_0x18f1('0x1b')](respondWithResult(_0x1137c8,null))[_0x18f1('0x3c')](handleError(_0x1137c8,null));};exports['create']=function(_0x49f9f9,_0x21eb40){return db[_0x18f1('0x21')][_0x18f1('0x40')](_0x49f9f9['body'],{})[_0x18f1('0x1b')](respondWithResult(_0x21eb40,0xc9))[_0x18f1('0x3c')](handleError(_0x21eb40,null));};exports[_0x18f1('0x1a')]=function(_0x1484a9,_0xb39a55){if(_0x1484a9[_0x18f1('0x41')]['id']){delete _0x1484a9[_0x18f1('0x41')]['id'];}return db[_0x18f1('0x21')][_0x18f1('0x3f')]({'where':{'id':_0x1484a9[_0x18f1('0x3e')]['id']}})[_0x18f1('0x1b')](handleEntityNotFound(_0xb39a55,null))[_0x18f1('0x1b')](saveUpdates(_0x1484a9[_0x18f1('0x41')],null))[_0x18f1('0x1b')](respondWithResult(_0xb39a55,null))['catch'](handleError(_0xb39a55,null));};exports[_0x18f1('0x1c')]=function(_0x4e330c,_0x435d05){return db[_0x18f1('0x21')][_0x18f1('0x3f')]({'where':{'id':_0x4e330c[_0x18f1('0x3e')]['id']}})[_0x18f1('0x1b')](handleEntityNotFound(_0x435d05,null))[_0x18f1('0x1b')](removeEntity(_0x435d05,null))[_0x18f1('0x3c')](handleError(_0x435d05,null));};exports[_0x18f1('0x42')]=function(_0x2cf374,_0xb8e94e){return db[_0x18f1('0x21')][_0x18f1('0x42')]()[_0x18f1('0x1b')](respondWithResult(_0xb8e94e,null))['catch'](handleError(_0xb8e94e,null));}; \ No newline at end of file +var _0xb362=['end','count','offset','limit','set','json','apply','update','then','destroy','error','name','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','add','merge','filter','map','options','VoiceDialReport','includeAll','include','findAll','rows','catch','params','find','create','body','describe','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x41b164,_0x48d6f1){var _0x635742=function(_0x182dcc){while(--_0x182dcc){_0x41b164['push'](_0x41b164['shift']());}};_0x635742(++_0x48d6f1);}(_0xb362,0x134));var _0x2b36=function(_0x3a026c,_0x28b94a){_0x3a026c=_0x3a026c-0x0;var _0x3d5874=_0xb362[_0x3a026c];return _0x3d5874;};'use strict';var jsonpatch=require(_0x2b36('0x0'));var rp=require('request-promise');var moment=require(_0x2b36('0x1'));var BPromise=require(_0x2b36('0x2'));var Mustache=require(_0x2b36('0x3'));var util=require(_0x2b36('0x4'));var path=require('path');var sox=require(_0x2b36('0x5'));var csv=require(_0x2b36('0x6'));var ejs=require(_0x2b36('0x7'));var fs=require('fs');var _=require(_0x2b36('0x8'));var squel=require(_0x2b36('0x9'));var crypto=require(_0x2b36('0xa'));var jsforce=require(_0x2b36('0xb'));var deskjs=require(_0x2b36('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2b36('0xd'));var Papa=require(_0x2b36('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0x2b36('0xf'))(_0x2b36('0x10'));var utils=require(_0x2b36('0x11'));var config=require(_0x2b36('0x12'));var db=require(_0x2b36('0x13'))['db'];function respondWithStatusCode(_0x11a1bd,_0x246810){_0x246810=_0x246810||0xcc;return function(_0x31214d){if(_0x31214d){return _0x11a1bd[_0x2b36('0x14')](_0x246810);}return _0x11a1bd[_0x2b36('0x15')](_0x246810)[_0x2b36('0x16')]();};}function respondWithResult(_0x1cf4af,_0x593af6){_0x593af6=_0x593af6||0xc8;return function(_0xc2f436){if(_0xc2f436){return _0x1cf4af[_0x2b36('0x15')](_0x593af6)['json'](_0xc2f436);}};}function respondWithFilteredResult(_0x35dd07,_0x507e89){return function(_0x45e7fc){if(_0x45e7fc){var _0x21a19d=_0x45e7fc[_0x2b36('0x17')],_0x1b1cac=_0x507e89[_0x2b36('0x18')],_0x524939=_0x507e89[_0x2b36('0x18')]+_0x507e89[_0x2b36('0x19')],_0x4f1bd9;if(_0x524939>=_0x21a19d){_0x524939=_0x21a19d;_0x4f1bd9=0xc8;}else{_0x4f1bd9=0xce;}_0x35dd07[_0x2b36('0x15')](_0x4f1bd9);return _0x35dd07[_0x2b36('0x1a')]('Content-Range',_0x1b1cac+'-'+_0x524939+'/'+_0x21a19d)[_0x2b36('0x1b')](_0x45e7fc);}return null;};}function patchUpdates(_0x4b669d){return function(_0xb8e3f0){try{jsonpatch[_0x2b36('0x1c')](_0xb8e3f0,_0x4b669d,!![]);}catch(_0x27742c){return BPromise['reject'](_0x27742c);}return _0xb8e3f0['save']();};}function saveUpdates(_0x460f0c,_0x390c8d){return function(_0x1d9ff5){if(_0x1d9ff5){return _0x1d9ff5[_0x2b36('0x1d')](_0x460f0c)[_0x2b36('0x1e')](function(_0x115976){return _0x115976;});}return null;};}function removeEntity(_0x46298a,_0x5cd48a){return function(_0x19a598){if(_0x19a598){return _0x19a598[_0x2b36('0x1f')]()[_0x2b36('0x1e')](function(){_0x46298a[_0x2b36('0x15')](0xcc)[_0x2b36('0x16')]();});}};}function handleEntityNotFound(_0x36ea80,_0x23f37f){return function(_0x18996d){if(!_0x18996d){_0x36ea80[_0x2b36('0x14')](0x194);}return _0x18996d;};}function handleError(_0x1b3ad,_0x45ab7d){_0x45ab7d=_0x45ab7d||0x1f4;return function(_0x2544a1){logger[_0x2b36('0x20')](_0x2544a1['stack']);if(_0x2544a1['name']){delete _0x2544a1[_0x2b36('0x21')];}_0x1b3ad[_0x2b36('0x15')](_0x45ab7d)['send'](_0x2544a1);};}exports['index']=function(_0x40a01f,_0x239cd3){var _0x2d61bf={},_0x1c9193={},_0x28d281={'count':0x0,'rows':[]};var _0x52687d=db['VoiceDialReport'][_0x2b36('0x22')];_0x1c9193[_0x2b36('0x23')]=_[_0x2b36('0x24')](_0x52687d);var _0xf4da92={'dateStart':_0x40a01f['query'][_0x2b36('0x25')],'dateEnd':_0x40a01f[_0x2b36('0x26')]['dateEnd']};delete _0x40a01f[_0x2b36('0x26')][_0x2b36('0x25')];delete _0x40a01f['query'][_0x2b36('0x27')];_0x1c9193[_0x2b36('0x26')]=_['keys'](_0x40a01f['query']);_0x1c9193[_0x2b36('0x28')]=_[_0x2b36('0x29')](_0x1c9193[_0x2b36('0x23')],_0x1c9193[_0x2b36('0x26')]);_0x2d61bf[_0x2b36('0x2a')]=_[_0x2b36('0x29')](_0x1c9193[_0x2b36('0x23')],qs['fields'](_0x40a01f['query'][_0x2b36('0x2b')]));_0x2d61bf[_0x2b36('0x2a')]=_0x2d61bf[_0x2b36('0x2a')][_0x2b36('0x2c')]?_0x2d61bf[_0x2b36('0x2a')]:_0x1c9193[_0x2b36('0x23')];if(!_0x40a01f['query']['hasOwnProperty'](_0x2b36('0x2d'))){_0x2d61bf[_0x2b36('0x19')]=qs['limit'](_0x40a01f[_0x2b36('0x26')][_0x2b36('0x19')]);_0x2d61bf['offset']=qs[_0x2b36('0x18')](_0x40a01f[_0x2b36('0x26')][_0x2b36('0x18')]);}_0x2d61bf[_0x2b36('0x2e')]=qs[_0x2b36('0x2f')](_0x40a01f[_0x2b36('0x26')][_0x2b36('0x2f')]);_0x2d61bf[_0x2b36('0x30')]=qs[_0x2b36('0x28')](_[_0x2b36('0x31')](_0x40a01f[_0x2b36('0x26')],_0x1c9193[_0x2b36('0x28')]));if(_0xf4da92[_0x2b36('0x25')]){if(_0xf4da92[_0x2b36('0x27')]){_0xf4da92[_0x2b36('0x27')]=moment(_0xf4da92[_0x2b36('0x27')])[_0x2b36('0x32')](0x1,'day');}else{_0xf4da92[_0x2b36('0x27')]=moment(_0xf4da92[_0x2b36('0x25')])[_0x2b36('0x32')](0x1,'day');}_[_0x2b36('0x33')](_0x2d61bf['where'],{'createdAt':{'$gte':_0xf4da92[_0x2b36('0x25')],'$lte':_0xf4da92[_0x2b36('0x27')]}});}if(_0x40a01f[_0x2b36('0x26')][_0x2b36('0x34')]){_0x2d61bf[_0x2b36('0x30')]=_[_0x2b36('0x33')](_0x2d61bf['where'],{'$or':_[_0x2b36('0x35')](_0x2d61bf[_0x2b36('0x2a')],function(_0x5e0eaa){var _0x22b44a={};_0x22b44a[_0x5e0eaa]={'$like':'%'+_0x40a01f[_0x2b36('0x26')][_0x2b36('0x34')]+'%'};return _0x22b44a;})});}_0x2d61bf=_[_0x2b36('0x33')]({},_0x2d61bf,_0x40a01f[_0x2b36('0x36')]);var _0x456e7e={'where':_0x2d61bf['where']};return db[_0x2b36('0x37')][_0x2b36('0x17')](_0x456e7e)['then'](function(_0x393d9a){_0x28d281[_0x2b36('0x17')]=_0x393d9a;if(_0x40a01f[_0x2b36('0x26')][_0x2b36('0x38')]){_0x2d61bf[_0x2b36('0x39')]=[{'all':!![]}];}return db[_0x2b36('0x37')][_0x2b36('0x3a')](_0x2d61bf);})['then'](function(_0x3962c5){_0x28d281[_0x2b36('0x3b')]=_0x3962c5;return _0x28d281;})['then'](respondWithFilteredResult(_0x239cd3,_0x2d61bf))[_0x2b36('0x3c')](handleError(_0x239cd3,null));};exports['show']=function(_0x447867,_0x3acf01){var _0x12fc3f={'raw':!![],'where':{'id':_0x447867[_0x2b36('0x3d')]['id']}},_0x345a03={};_0x345a03['model']=_['keys'](db['VoiceDialReport']['rawAttributes']);_0x345a03[_0x2b36('0x26')]=_[_0x2b36('0x24')](_0x447867[_0x2b36('0x26')]);_0x345a03['filters']=_[_0x2b36('0x29')](_0x345a03[_0x2b36('0x23')],_0x345a03[_0x2b36('0x26')]);_0x12fc3f[_0x2b36('0x2a')]=_[_0x2b36('0x29')](_0x345a03[_0x2b36('0x23')],qs[_0x2b36('0x2b')](_0x447867[_0x2b36('0x26')][_0x2b36('0x2b')]));_0x12fc3f[_0x2b36('0x2a')]=_0x12fc3f['attributes'][_0x2b36('0x2c')]?_0x12fc3f[_0x2b36('0x2a')]:_0x345a03[_0x2b36('0x23')];if(_0x447867[_0x2b36('0x26')][_0x2b36('0x38')]){_0x12fc3f[_0x2b36('0x39')]=[{'all':!![]}];}_0x12fc3f=_[_0x2b36('0x33')]({},_0x12fc3f,_0x447867['options']);return db[_0x2b36('0x37')][_0x2b36('0x3e')](_0x12fc3f)[_0x2b36('0x1e')](handleEntityNotFound(_0x3acf01,null))[_0x2b36('0x1e')](respondWithResult(_0x3acf01,null))[_0x2b36('0x3c')](handleError(_0x3acf01,null));};exports[_0x2b36('0x3f')]=function(_0xd257b0,_0x53fdbc){return db[_0x2b36('0x37')][_0x2b36('0x3f')](_0xd257b0[_0x2b36('0x40')],{})[_0x2b36('0x1e')](respondWithResult(_0x53fdbc,0xc9))[_0x2b36('0x3c')](handleError(_0x53fdbc,null));};exports[_0x2b36('0x1d')]=function(_0x5010d,_0x45e504){if(_0x5010d[_0x2b36('0x40')]['id']){delete _0x5010d[_0x2b36('0x40')]['id'];}return db[_0x2b36('0x37')]['find']({'where':{'id':_0x5010d[_0x2b36('0x3d')]['id']}})[_0x2b36('0x1e')](handleEntityNotFound(_0x45e504,null))['then'](saveUpdates(_0x5010d[_0x2b36('0x40')],null))[_0x2b36('0x1e')](respondWithResult(_0x45e504,null))[_0x2b36('0x3c')](handleError(_0x45e504,null));};exports[_0x2b36('0x1f')]=function(_0x132fed,_0x52c837){return db[_0x2b36('0x37')][_0x2b36('0x3e')]({'where':{'id':_0x132fed[_0x2b36('0x3d')]['id']}})[_0x2b36('0x1e')](handleEntityNotFound(_0x52c837,null))[_0x2b36('0x1e')](removeEntity(_0x52c837,null))['catch'](handleError(_0x52c837,null));};exports[_0x2b36('0x41')]=function(_0x333cca,_0x45a61f){return db[_0x2b36('0x37')]['describe']()['then'](respondWithResult(_0x45a61f,null))[_0x2b36('0x3c')](handleError(_0x45a61f,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index efe23d0..a4a9c59 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 _0xe9a4=['exports','VoiceDialReport','report_dial','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./voiceDialReport.attributes'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0xe9a4,0x92));var _0x4e9a=function(_0x491ec2,_0x540c00){_0x491ec2=_0x491ec2-0x0;var _0x1748db=_0xe9a4[_0x491ec2];return _0x1748db;};'use strict';var _=require(_0x4e9a('0x0'));var util=require(_0x4e9a('0x1'));var logger=require(_0x4e9a('0x2'))(_0x4e9a('0x3'));var moment=require(_0x4e9a('0x4'));var BPromise=require(_0x4e9a('0x5'));var rp=require(_0x4e9a('0x6'));var attributes=require(_0x4e9a('0x7'));module[_0x4e9a('0x8')]=function(_0x51ec9e,_0x573cbf){return _0x51ec9e['define'](_0x4e9a('0x9'),attributes,{'tableName':_0x4e9a('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6347=['../../config/logger','api','moment','bluebird','request-promise','./voiceDialReport.attributes','exports','report_dial','uniqueid','lodash','util'];(function(_0x302754,_0x45952c){var _0x5826e0=function(_0x5333c8){while(--_0x5333c8){_0x302754['push'](_0x302754['shift']());}};_0x5826e0(++_0x45952c);}(_0x6347,0x17f));var _0x7634=function(_0x4db058,_0x37ac21){_0x4db058=_0x4db058-0x0;var _0x37b8d1=_0x6347[_0x4db058];return _0x37b8d1;};'use strict';var _=require(_0x7634('0x0'));var util=require(_0x7634('0x1'));var logger=require(_0x7634('0x2'))(_0x7634('0x3'));var moment=require(_0x7634('0x4'));var BPromise=require(_0x7634('0x5'));var rp=require(_0x7634('0x6'));var attributes=require(_0x7634('0x7'));module[_0x7634('0x8')]=function(_0x4a280b,_0xdaf0a5){return _0x4a280b['define']('VoiceDialReport',attributes,{'tableName':_0x7634('0x9'),'paranoid':![],'indexes':[{'fields':[_0x7634('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 0a2f769..963dd57 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 _0x5f66=['CreateVoiceDialReport','body','stringify','catch','UpdateVoiceDialReport','VoiceDialReport','options','where','attributes','limit','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','message','VoiceDialReport,\x20%s,\x20%s','info','result'];(function(_0x378d6c,_0x1fd42b){var _0x391ec1=function(_0x56dd7a){while(--_0x56dd7a){_0x378d6c['push'](_0x378d6c['shift']());}};_0x391ec1(++_0x1fd42b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var 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']('VoiceDialReport,\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')]('VoiceDialReport,\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);});});}exports[_0x65f6('0x13')]=function(_0x1b1cbb){var _0x1f974c=this;return new Promise(function(_0xc8660c,_0x18380e){return db['VoiceDialReport']['create'](_0x1b1cbb[_0x65f6('0x14')],{'raw':_0x1b1cbb['options']?_0x1b1cbb['options']['raw']===undefined?!![]:![]:!![]})[_0x65f6('0xa')](function(_0x21ea88){logger['info'](_0x65f6('0x13'),_0x1b1cbb);logger[_0x65f6('0xc')](_0x65f6('0x13'),_0x1b1cbb,JSON[_0x65f6('0x15')](_0x21ea88));_0xc8660c(_0x21ea88);})[_0x65f6('0x16')](function(_0xc139c2){logger['error'](_0x65f6('0x13'),_0xc139c2['message'],_0x1b1cbb);_0x18380e(_0x1f974c['error'](0x1f4,_0xc139c2[_0x65f6('0xf')]));});});};exports[_0x65f6('0x17')]=function(_0x524e42){var _0x1eeaaa=this;return new Promise(function(_0x471a33,_0x2317ce){return db[_0x65f6('0x18')]['update'](_0x524e42[_0x65f6('0x14')],{'raw':_0x524e42[_0x65f6('0x19')]?_0x524e42[_0x65f6('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x524e42['options']?_0x524e42['options'][_0x65f6('0x1a')]||null:null,'attributes':_0x524e42[_0x65f6('0x19')]?_0x524e42['options'][_0x65f6('0x1b')]||null:null,'limit':_0x524e42[_0x65f6('0x19')]?_0x524e42['options'][_0x65f6('0x1c')]||null:null})[_0x65f6('0xa')](function(_0x28d0df){logger['info']('UpdateVoiceDialReport',_0x524e42);logger['debug'](_0x65f6('0x17'),_0x524e42,JSON[_0x65f6('0x15')](_0x28d0df));_0x471a33(_0x28d0df);})[_0x65f6('0x16')](function(_0x408ccc){logger[_0x65f6('0xe')](_0x65f6('0x17'),_0x408ccc[_0x65f6('0xf')],_0x524e42);_0x2317ce(_0x1eeaaa['error'](0x1f4,_0x408ccc['message']));});});}; \ No newline at end of file +var _0x5f66=['CreateVoiceDialReport','body','stringify','catch','UpdateVoiceDialReport','VoiceDialReport','options','where','attributes','limit','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','message','VoiceDialReport,\x20%s,\x20%s','info','result'];(function(_0x42c23f,_0x114924){var _0x1a9ac5=function(_0x41b307){while(--_0x41b307){_0x42c23f['push'](_0x42c23f['shift']());}};_0x1a9ac5(++_0x114924);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'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']('VoiceDialReport,\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')]('VoiceDialReport,\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);});});}exports[_0x65f6('0x13')]=function(_0x1b1cbb){var _0x1f974c=this;return new Promise(function(_0xc8660c,_0x18380e){return db['VoiceDialReport']['create'](_0x1b1cbb[_0x65f6('0x14')],{'raw':_0x1b1cbb['options']?_0x1b1cbb['options']['raw']===undefined?!![]:![]:!![]})[_0x65f6('0xa')](function(_0x21ea88){logger['info'](_0x65f6('0x13'),_0x1b1cbb);logger[_0x65f6('0xc')](_0x65f6('0x13'),_0x1b1cbb,JSON[_0x65f6('0x15')](_0x21ea88));_0xc8660c(_0x21ea88);})[_0x65f6('0x16')](function(_0xc139c2){logger['error'](_0x65f6('0x13'),_0xc139c2['message'],_0x1b1cbb);_0x18380e(_0x1f974c['error'](0x1f4,_0xc139c2[_0x65f6('0xf')]));});});};exports[_0x65f6('0x17')]=function(_0x524e42){var _0x1eeaaa=this;return new Promise(function(_0x471a33,_0x2317ce){return db[_0x65f6('0x18')]['update'](_0x524e42[_0x65f6('0x14')],{'raw':_0x524e42[_0x65f6('0x19')]?_0x524e42[_0x65f6('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x524e42['options']?_0x524e42['options'][_0x65f6('0x1a')]||null:null,'attributes':_0x524e42[_0x65f6('0x19')]?_0x524e42['options'][_0x65f6('0x1b')]||null:null,'limit':_0x524e42[_0x65f6('0x19')]?_0x524e42['options'][_0x65f6('0x1c')]||null:null})[_0x65f6('0xa')](function(_0x28d0df){logger['info']('UpdateVoiceDialReport',_0x524e42);logger['debug'](_0x65f6('0x17'),_0x524e42,JSON[_0x65f6('0x15')](_0x28d0df));_0x471a33(_0x28d0df);})[_0x65f6('0x16')](function(_0x408ccc){logger[_0x65f6('0xe')](_0x65f6('0x17'),_0x408ccc[_0x65f6('0xf')],_0x524e42);_0x2317ce(_0x1eeaaa['error'](0x1f4,_0x408ccc['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 9b0783a..bd74fe5 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 _0x90d5=['isAuthenticated','create','post','/:id/applications','update','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','index','/:id'];(function(_0x30cf23,_0x1994a2){var _0x2123e4=function(_0x4f0cb1){while(--_0x4f0cb1){_0x30cf23['push'](_0x30cf23['shift']());}};_0x2123e4(++_0x1994a2);}(_0x90d5,0x14a));var _0x590d=function(_0xaa7a59,_0x5c644e){_0xaa7a59=_0xaa7a59-0x0;var _0x3c3a52=_0x90d5[_0xaa7a59];return _0x3c3a52;};'use strict';var multer=require(_0x590d('0x0'));var util=require('util');var path=require(_0x590d('0x1'));var express=require(_0x590d('0x2'));var router=express['Router']();var auth=require(_0x590d('0x3'));var interaction=require(_0x590d('0x4'));var config=require(_0x590d('0x5'));var controller=require(_0x590d('0x6'));router[_0x590d('0x7')]('/',auth['isAuthenticated'](),controller[_0x590d('0x8')]);router[_0x590d('0x7')](_0x590d('0x9'),auth[_0x590d('0xa')](),controller['show']);router['post']('/',auth[_0x590d('0xa')](),controller[_0x590d('0xb')]);router[_0x590d('0xc')](_0x590d('0xd'),auth[_0x590d('0xa')](),controller['addApplications']);router['put'](_0x590d('0x9'),auth[_0x590d('0xa')](),controller[_0x590d('0xe')]);router['delete'](_0x590d('0x9'),auth[_0x590d('0xa')](),controller[_0x590d('0xf')]);module[_0x590d('0x10')]=router; \ No newline at end of file +var _0xcf2f=['create','addApplications','put','/:id','update','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','show','post'];(function(_0x31aa23,_0x532eeb){var _0x24a3a7=function(_0x344d9f){while(--_0x344d9f){_0x31aa23['push'](_0x31aa23['shift']());}};_0x24a3a7(++_0x532eeb);}(_0xcf2f,0x11f));var _0xfcf2=function(_0x2eee0d,_0x51c219){_0x2eee0d=_0x2eee0d-0x0;var _0x33d18b=_0xcf2f[_0x2eee0d];return _0x33d18b;};'use strict';var multer=require(_0xfcf2('0x0'));var util=require(_0xfcf2('0x1'));var path=require(_0xfcf2('0x2'));var express=require('express');var router=express[_0xfcf2('0x3')]();var auth=require(_0xfcf2('0x4'));var interaction=require(_0xfcf2('0x5'));var config=require(_0xfcf2('0x6'));var controller=require(_0xfcf2('0x7'));router[_0xfcf2('0x8')]('/',auth[_0xfcf2('0x9')](),controller[_0xfcf2('0xa')]);router['get']('/:id',auth[_0xfcf2('0x9')](),controller[_0xfcf2('0xb')]);router[_0xfcf2('0xc')]('/',auth[_0xfcf2('0x9')](),controller[_0xfcf2('0xd')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xfcf2('0xe')]);router[_0xfcf2('0xf')](_0xfcf2('0x10'),auth[_0xfcf2('0x9')](),controller[_0xfcf2('0x11')]);router[_0xfcf2('0x12')](_0xfcf2('0x10'),auth[_0xfcf2('0x9')](),controller[_0xfcf2('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index ffb7208..6d51995 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 _0x1e81=['internal','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound'];(function(_0x54a542,_0x4b9e9e){var _0x386f0f=function(_0x13c7e0){while(--_0x13c7e0){_0x54a542['push'](_0x54a542['shift']());}};_0x386f0f(++_0x4b9e9e);}(_0x1e81,0x138));var _0x11e8=function(_0x2f63a0,_0x51855d){_0x2f63a0=_0x2f63a0-0x0;var _0x536ae8=_0x1e81[_0x2f63a0];return _0x536ae8;};'use strict';var Sequelize=require(_0x11e8('0x0'));module[_0x11e8('0x1')]={'context':{'type':Sequelize[_0x11e8('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x11e8('0x2')],'allowNull':![],'unique':_0x11e8('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x11e8('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x11e8('0x2')],'allowNull':![],'defaultValue':_0x11e8('0x4')},'appdata':{'type':Sequelize[_0x11e8('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x11e8('0x5')](_0x11e8('0x6'),_0x11e8('0x7'),_0x11e8('0x8'),_0x11e8('0x9'),_0x11e8('0xa'),'system',_0x11e8('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x11e8('0x2')]},'interval':{'type':Sequelize[_0x11e8('0x2')],'allowNull':![],'defaultValue':_0x11e8('0xc')},'IntervalId':{'type':Sequelize[_0x11e8('0xd')]},'isApp':{'type':Sequelize[_0x11e8('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x11e8('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x11e8('0x2')],'defaultValue':_0x11e8('0xf')},'answer':{'type':Sequelize[_0x11e8('0xe')],'defaultValue':!![]}}; \ No newline at end of file +var _0x78b3=['inbound-fax','outbound-fax','system','any','INTEGER','BOOLEAN','wav','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','internal'];(function(_0x49497b,_0x185992){var _0x2a33b9=function(_0x473fba){while(--_0x473fba){_0x49497b['push'](_0x49497b['shift']());}};_0x2a33b9(++_0x185992);}(_0x78b3,0x18d));var _0x378b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x78b3[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x378b('0x0'));module[_0x378b('0x1')]={'context':{'type':Sequelize[_0x378b('0x2')],'allowNull':![],'unique':_0x378b('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x378b('0x3')},'tag':{'type':Sequelize[_0x378b('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x378b('0x2')],'allowNull':![],'defaultValue':_0x378b('0x4')},'appdata':{'type':Sequelize[_0x378b('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x378b('0x5')](_0x378b('0x6'),'outbound',_0x378b('0x7'),_0x378b('0x8'),_0x378b('0x9'),_0x378b('0xa'),_0x378b('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x378b('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x378b('0xc')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x378b('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x378b('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x378b('0x2')],'defaultValue':_0x378b('0xe')},'answer':{'type':Sequelize[_0x378b('0xd')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index fb742e2..1711c8f 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(_0x492837,_0x514e8e){var _0x44f215=function(_0x527acb){while(--_0x527acb){_0x492837['push'](_0x492837['shift']());}};_0x44f215(++_0x514e8e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x1057cb,_0x7b8162){var _0x7fbf7e=function(_0x5fa6a3){while(--_0x5fa6a3){_0x1057cb['push'](_0x1057cb['shift']());}};_0x7fbf7e(++_0x7b8162);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 5275a16..ccc10ed 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 _0x811f=['../../mysqldb','setMaxListeners','emit','hasOwnProperty'];(function(_0x184759,_0x1cc38a){var _0xf26d5f=function(_0x1010c8){while(--_0x1010c8){_0x184759['push'](_0x184759['shift']());}};_0xf26d5f(++_0x1cc38a);}(_0x811f,0x15c));var _0xf811=function(_0x2c16ab,_0xaa3f47){_0x2c16ab=_0x2c16ab-0x0;var _0x50d50c=_0x811f[_0x2c16ab];return _0x50d50c;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xf811('0x0'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xf811('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x10e10e){return function(_0x1a74d,_0x518884,_0x3c32a8){VoiceExtensionEvents[_0xf811('0x2')](_0x10e10e+':'+_0x1a74d['id'],_0x1a74d);VoiceExtensionEvents[_0xf811('0x2')](_0x10e10e,_0x1a74d);_0x3c32a8(null);};}for(var e in events){if(events[_0xf811('0x3')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x2c1a=['events','VoiceExtension','save','remove','emit','hasOwnProperty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2c1a,0x12c));var _0xa2c1=function(_0x13850b,_0x2f5da0){_0x13850b=_0x13850b-0x0;var _0x234d22=_0x2c1a[_0x13850b];return _0x234d22;};'use strict';var EventEmitter=require(_0xa2c1('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xa2c1('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa2c1('0x2'),'afterUpdate':'update','afterDestroy':_0xa2c1('0x3')};function emitEvent(_0x4f3706){return function(_0xbf68f5,_0x56821a,_0x4b287a){VoiceExtensionEvents[_0xa2c1('0x4')](_0x4f3706+':'+_0xbf68f5['id'],_0xbf68f5);VoiceExtensionEvents['emit'](_0x4f3706,_0xbf68f5);_0x4b287a(null);};}for(var e in events){if(events[_0xa2c1('0x5')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 56146c1..e760eac 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 _0x1615=['../../config/logger','bluebird','request-promise','./voiceExtension.attributes','exports','define','VoiceExtension'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x1615,0x12d));var _0x5161=function(_0x4e4641,_0x12beac){_0x4e4641=_0x4e4641-0x0;var _0x22f685=_0x1615[_0x4e4641];return _0x22f685;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5161('0x0'))('api');var moment=require('moment');var BPromise=require(_0x5161('0x1'));var rp=require(_0x5161('0x2'));var attributes=require(_0x5161('0x3'));module[_0x5161('0x4')]=function(_0x23aa3c,_0x5a2110){return _0x23aa3c[_0x5161('0x5')](_0x5161('0x6'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8311=['request-promise','exports','define','VoiceExtension','voice_extensions','lodash','util','../../config/logger','bluebird'];(function(_0x341b22,_0x5034a4){var _0x3d9b06=function(_0x248201){while(--_0x248201){_0x341b22['push'](_0x341b22['shift']());}};_0x3d9b06(++_0x5034a4);}(_0x8311,0x149));var _0x1831=function(_0x4c67da,_0x12fba3){_0x4c67da=_0x4c67da-0x0;var _0x507337=_0x8311[_0x4c67da];return _0x507337;};'use strict';var _=require(_0x1831('0x0'));var util=require(_0x1831('0x1'));var logger=require(_0x1831('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1831('0x3'));var rp=require(_0x1831('0x4'));var attributes=require('./voiceExtension.attributes');module[_0x1831('0x5')]=function(_0x59437f,_0x1d7e5a){return _0x59437f[_0x1831('0x6')](_0x1831('0x7'),attributes,{'tableName':_0x1831('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 74132ac..fca81b3 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 _0xbdb7=['include','map','model','GetVoiceExtension','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','socket.io-emitter','localhost','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','VoiceExtension','findAll','options','where','attributes','limit'];(function(_0x4404ff,_0x13d7a9){var _0x5e7b19=function(_0x13847a){while(--_0x13847a){_0x4404ff['push'](_0x4404ff['shift']());}};_0x5e7b19(++_0x13d7a9);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x190ff6,_0x515cfd){_0x190ff6=_0x190ff6-0x0;var _0x5356d2=_0xbdb7[_0x190ff6];return _0x5356d2;};'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});var socket=require(_0x7bdb('0xa'))({'host':_0x7bdb('0xb'),'port':0x18eb});require('./voiceExtension.socket')['register'](socket);function respondWithRpcPromise(_0x468041,_0x11a877,_0x530f81){return new BPromise(function(_0x4a3116,_0xdc2ffc){return client[_0x7bdb('0xc')](_0x468041,_0x530f81)[_0x7bdb('0xd')](function(_0x2c328e){logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x11a877,_0x7bdb('0x10'));logger[_0x7bdb('0x11')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x11a877,'request\x20sent',JSON['stringify'](_0x2c328e));if(_0x2c328e[_0x7bdb('0x12')]){if(_0x2c328e[_0x7bdb('0x12')]['code']===0x1f4){logger[_0x7bdb('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x11a877,_0x2c328e['error'][_0x7bdb('0x13')]);return _0xdc2ffc(_0x2c328e[_0x7bdb('0x12')]['message']);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x11a877,_0x2c328e[_0x7bdb('0x12')][_0x7bdb('0x13')]);return _0x4a3116(_0x2c328e[_0x7bdb('0x12')][_0x7bdb('0x13')]);}else{logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x11a877,_0x7bdb('0x10'));_0x4a3116(_0x2c328e[_0x7bdb('0x14')]['message']);}})[_0x7bdb('0x15')](function(_0x43f352){logger[_0x7bdb('0x12')](_0x7bdb('0xf'),_0x11a877,_0x43f352);_0xdc2ffc(_0x43f352);});});}exports['GetVoiceExtension']=function(_0x41f540){var _0x23e9eb=this;return new Promise(function(_0x5b8481,_0x3e5f8e){return db[_0x7bdb('0x16')][_0x7bdb('0x17')]({'raw':_0x41f540[_0x7bdb('0x18')]?_0x41f540[_0x7bdb('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x41f540['options']?_0x41f540[_0x7bdb('0x18')][_0x7bdb('0x19')]||null:null,'attributes':_0x41f540['options']?_0x41f540[_0x7bdb('0x18')][_0x7bdb('0x1a')]||null:null,'limit':_0x41f540[_0x7bdb('0x18')]?_0x41f540[_0x7bdb('0x18')][_0x7bdb('0x1b')]||null:null,'include':_0x41f540['options']?_0x41f540[_0x7bdb('0x18')][_0x7bdb('0x1c')]?_[_0x7bdb('0x1d')](_0x41f540[_0x7bdb('0x18')]['include'],function(_0x4d6e44){return{'model':db[_0x4d6e44[_0x7bdb('0x1e')]],'as':_0x4d6e44['as'],'attributes':_0x4d6e44['attributes'],'include':_0x4d6e44['include']?_['map'](_0x4d6e44[_0x7bdb('0x1c')],function(_0x51ab04){return{'model':db[_0x51ab04[_0x7bdb('0x1e')]],'as':_0x51ab04['as'],'attributes':_0x51ab04[_0x7bdb('0x1a')],'include':_0x51ab04[_0x7bdb('0x1c')]?_[_0x7bdb('0x1d')](_0x51ab04[_0x7bdb('0x1c')],function(_0x523869){return{'model':db[_0x523869[_0x7bdb('0x1e')]],'as':_0x523869['as'],'attributes':_0x523869[_0x7bdb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7bdb('0xd')](function(_0xe1141d){logger[_0x7bdb('0xe')](_0x7bdb('0x1f'),_0x41f540);logger[_0x7bdb('0x11')](_0x7bdb('0x1f'),_0x41f540,JSON[_0x7bdb('0x20')](_0xe1141d));_0x5b8481(_0xe1141d);})[_0x7bdb('0x15')](function(_0x9ec48d){logger[_0x7bdb('0x12')]('GetVoiceExtension',_0x9ec48d[_0x7bdb('0x13')],_0x41f540);_0x3e5f8e(_0x23e9eb[_0x7bdb('0x12')](0x1f4,_0x9ec48d[_0x7bdb('0x13')]));});});}; \ No newline at end of file +var _0x087b=['model','then','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','./voiceExtension.socket','register','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','include','map'];(function(_0x4a7f48,_0x4847b6){var _0x55b169=function(_0x376e2a){while(--_0x376e2a){_0x4a7f48['push'](_0x4a7f48['shift']());}};_0x55b169(++_0x4847b6);}(_0x087b,0x11a));var _0xb087=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x087b[_0x307d86];return _0x361745;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb087('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xb087('0x3'));var logger=require(_0xb087('0x4'))(_0xb087('0x5'));var config=require(_0xb087('0x6'));var jayson=require(_0xb087('0x7'));var client=jayson[_0xb087('0x8')][_0xb087('0x9')]({'port':0x232a});var socket=require(_0xb087('0xa'))({'host':_0xb087('0xb'),'port':0x18eb});require(_0xb087('0xc'))[_0xb087('0xd')](socket);function respondWithRpcPromise(_0x6d83fb,_0x1dbe9f,_0x80e4da){return new BPromise(function(_0x2f14bc,_0x23cdd7){return client[_0xb087('0xe')](_0x6d83fb,_0x80e4da)['then'](function(_0x244abc){logger[_0xb087('0xf')](_0xb087('0x10'),_0x1dbe9f,_0xb087('0x11'));logger[_0xb087('0x12')](_0xb087('0x13'),_0x1dbe9f,_0xb087('0x11'),JSON['stringify'](_0x244abc));if(_0x244abc[_0xb087('0x14')]){if(_0x244abc[_0xb087('0x14')][_0xb087('0x15')]===0x1f4){logger['error'](_0xb087('0x10'),_0x1dbe9f,_0x244abc[_0xb087('0x14')][_0xb087('0x16')]);return _0x23cdd7(_0x244abc[_0xb087('0x14')][_0xb087('0x16')]);}logger[_0xb087('0x14')](_0xb087('0x10'),_0x1dbe9f,_0x244abc[_0xb087('0x14')][_0xb087('0x16')]);return _0x2f14bc(_0x244abc[_0xb087('0x14')]['message']);}else{logger[_0xb087('0xf')](_0xb087('0x10'),_0x1dbe9f,'request\x20sent');_0x2f14bc(_0x244abc[_0xb087('0x17')][_0xb087('0x16')]);}})[_0xb087('0x18')](function(_0x5bb80b){logger[_0xb087('0x14')](_0xb087('0x10'),_0x1dbe9f,_0x5bb80b);_0x23cdd7(_0x5bb80b);});});}exports[_0xb087('0x19')]=function(_0x45d074){var _0x4e333b=this;return new Promise(function(_0x13d534,_0x28428e){return db[_0xb087('0x1a')][_0xb087('0x1b')]({'raw':_0x45d074['options']?_0x45d074['options']['raw']===undefined?!![]:![]:!![],'where':_0x45d074['options']?_0x45d074[_0xb087('0x1c')][_0xb087('0x1d')]||null:null,'attributes':_0x45d074[_0xb087('0x1c')]?_0x45d074[_0xb087('0x1c')][_0xb087('0x1e')]||null:null,'limit':_0x45d074[_0xb087('0x1c')]?_0x45d074[_0xb087('0x1c')]['limit']||null:null,'include':_0x45d074[_0xb087('0x1c')]?_0x45d074[_0xb087('0x1c')][_0xb087('0x1f')]?_[_0xb087('0x20')](_0x45d074[_0xb087('0x1c')]['include'],function(_0x183eab){return{'model':db[_0x183eab[_0xb087('0x21')]],'as':_0x183eab['as'],'attributes':_0x183eab['attributes'],'include':_0x183eab['include']?_['map'](_0x183eab['include'],function(_0x5a4ee0){return{'model':db[_0x5a4ee0[_0xb087('0x21')]],'as':_0x5a4ee0['as'],'attributes':_0x5a4ee0[_0xb087('0x1e')],'include':_0x5a4ee0[_0xb087('0x1f')]?_[_0xb087('0x20')](_0x5a4ee0[_0xb087('0x1f')],function(_0xb72173){return{'model':db[_0xb72173[_0xb087('0x21')]],'as':_0xb72173['as'],'attributes':_0xb72173[_0xb087('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb087('0x22')](function(_0x1551c3){logger[_0xb087('0xf')](_0xb087('0x19'),_0x45d074);logger[_0xb087('0x12')](_0xb087('0x19'),_0x45d074,JSON['stringify'](_0x1551c3));_0x13d534(_0x1551c3);})[_0xb087('0x18')](function(_0x1335d9){logger[_0xb087('0x14')](_0xb087('0x19'),_0x1335d9[_0xb087('0x16')],_0x45d074);_0x28428e(_0x4e333b[_0xb087('0x14')](0x1f4,_0x1335d9[_0xb087('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 7cd372c..32f67f7 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 _0xb417=['voiceExtension:','./voiceExtension.events','save','update','length'];(function(_0x3efd4d,_0x2d127b){var _0x38c6b7=function(_0x2387b1){while(--_0x2387b1){_0x3efd4d['push'](_0x3efd4d['shift']());}};_0x38c6b7(++_0x2d127b);}(_0xb417,0x17d));var _0x7b41=function(_0x3bd497,_0x37d7a8){_0x3bd497=_0x3bd497-0x0;var _0x32f967=_0xb417[_0x3bd497];return _0x32f967;};'use strict';var VoiceExtensionEvents=require(_0x7b41('0x0'));var events=[_0x7b41('0x1'),'remove',_0x7b41('0x2')];function createListener(_0x1a71ec,_0x2aeacd){return function(_0x298ff5){_0x2aeacd['emit'](_0x1a71ec,_0x298ff5);};}function removeListener(_0x2dc5a0,_0x5c19d2){return function(){VoiceExtensionEvents['removeListener'](_0x2dc5a0,_0x5c19d2);};}exports['register']=function(_0x14d2c5){for(var _0x21896e=0x0,_0x330a15=events[_0x7b41('0x3')];_0x21896e<_0x330a15;_0x21896e++){var _0x719f0e=events[_0x21896e];var _0x1856e9=createListener(_0x7b41('0x4')+_0x719f0e,_0x14d2c5);VoiceExtensionEvents['on'](_0x719f0e,_0x1856e9);}}; \ No newline at end of file +var _0x941a=['removeListener','register','voiceExtension:','remove','update','emit'];(function(_0x2e91d4,_0x20a875){var _0xed0870=function(_0x28a525){while(--_0x28a525){_0x2e91d4['push'](_0x2e91d4['shift']());}};_0xed0870(++_0x20a875);}(_0x941a,0x105));var _0xa941=function(_0x11709b,_0x49acc1){_0x11709b=_0x11709b-0x0;var _0x30378d=_0x941a[_0x11709b];return _0x30378d;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=['save',_0xa941('0x0'),_0xa941('0x1')];function createListener(_0x3c6de8,_0x5dd1a3){return function(_0x1a5036){_0x5dd1a3[_0xa941('0x2')](_0x3c6de8,_0x1a5036);};}function removeListener(_0xbb93ad,_0x4fdca5){return function(){VoiceExtensionEvents[_0xa941('0x3')](_0xbb93ad,_0x4fdca5);};}exports[_0xa941('0x4')]=function(_0x1197a4){for(var _0x185ce6=0x0,_0x211eb1=events['length'];_0x185ce6<_0x211eb1;_0x185ce6++){var _0x2b99e3=events[_0x185ce6];var _0x26ae3d=createListener(_0xa941('0x5')+_0x2b99e3,_0x1197a4);VoiceExtensionEvents['on'](_0x2b99e3,_0x26ae3d);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index c40067e..d0553f2 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(_0x33e4a7,_0x2e80a2){var _0x598620=function(_0x65d618){while(--_0x65d618){_0x33e4a7['push'](_0x33e4a7['shift']());}};_0x598620(++_0x2e80a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var 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(_0x42cc1f,_0xe9eb20){var _0x175df5=function(_0x2f3e22){while(--_0x2f3e22){_0x42cc1f['push'](_0x42cc1f['shift']());}};_0x175df5(++_0xe9eb20);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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 2bc597c..4c95782 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 _0xa841=['TIMESTAMP','INTEGER','sequelize','exports','from-voicemail','contest_mailbox','STRING','email','trim','central','ENUM','yes','TINYINT(4)'];(function(_0x4f66ef,_0x3d47ef){var _0x34c6ec=function(_0x449aaf){while(--_0x449aaf){_0x4f66ef['push'](_0x4f66ef['shift']());}};_0x34c6ec(++_0x3d47ef);}(_0xa841,0x113));var _0x1a84=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xa841[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require(_0x1a84('0x0'));module[_0x1a84('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0x1a84('0x2'),'unique':_0x1a84('0x3')},'mailbox':{'type':Sequelize[_0x1a84('0x4')],'defaultValue':'','allowNull':![],'unique':_0x1a84('0x3')},'password':{'type':Sequelize[_0x1a84('0x4')]},'fullname':{'type':Sequelize[_0x1a84('0x4')]},'email':{'type':Sequelize[_0x1a84('0x4')],'validate':{'isEmail':!![]},'set':function(_0xdb77a3){this['setDataValue'](_0x1a84('0x5'),typeof _0xdb77a3==='string'&&_0xdb77a3[_0x1a84('0x6')]()?_0xdb77a3[_0x1a84('0x6')]():null);}},'pager':{'type':Sequelize[_0x1a84('0x4')]},'tz':{'type':Sequelize[_0x1a84('0x4')],'defaultValue':_0x1a84('0x7')},'attach':{'type':Sequelize[_0x1a84('0x8')](_0x1a84('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x1a84('0x8')]('yes','no'),'defaultValue':_0x1a84('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x1a84('0x4')]},'review':{'type':Sequelize[_0x1a84('0x8')](_0x1a84('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x1a84('0x8')](_0x1a84('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x1a84('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x1a84('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x1a84('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x1a84('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x1a84('0x8')](_0x1a84('0x9'),'no'),'defaultValue':_0x1a84('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x1a84('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x1a84('0x8')](_0x1a84('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x1a84('0x8')](_0x1a84('0x9'),'no'),'defaultValue':_0x1a84('0x9'),'allowNull':![]},'stamp':{'type':_0x1a84('0xb')},'emailsubject':{'type':Sequelize[_0x1a84('0x4')]},'emailbody':{'type':Sequelize[_0x1a84('0x4')]},'name':{'type':Sequelize[_0x1a84('0x4')]},'maxsecs':{'type':Sequelize[_0x1a84('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]}}; \ No newline at end of file +var _0x808f=['INTEGER','sequelize','exports','STRING','from-voicemail','contest_mailbox','email','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x808f,0xeb));var _0xf808=function(_0x2e183e,_0x20a4f5){_0x2e183e=_0x2e183e-0x0;var _0x2cf1f7=_0x808f[_0x2e183e];return _0x2cf1f7;};'use strict';var Sequelize=require(_0xf808('0x0'));module[_0xf808('0x1')]={'customer_id':{'type':Sequelize[_0xf808('0x2')]},'context':{'type':Sequelize[_0xf808('0x2')],'defaultValue':_0xf808('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xf808('0x2')],'defaultValue':'','allowNull':![],'unique':_0xf808('0x4')},'password':{'type':Sequelize[_0xf808('0x2')]},'fullname':{'type':Sequelize[_0xf808('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x8ffbc1){this['setDataValue'](_0xf808('0x5'),typeof _0x8ffbc1===_0xf808('0x6')&&_0x8ffbc1[_0xf808('0x7')]()?_0x8ffbc1[_0xf808('0x7')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0xf808('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0xf808('0x8')](_0xf808('0x9'),'no'),'defaultValue':_0xf808('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xf808('0x9'),'no'),'defaultValue':_0xf808('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xf808('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xf808('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xf808('0x8')](_0xf808('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0xf808('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xf808('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xf808('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xf808('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xf808('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xf808('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xf808('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xf808('0x9'),'no'),'defaultValue':_0xf808('0x9'),'allowNull':![]},'stamp':{'type':_0xf808('0xb')},'emailsubject':{'type':Sequelize[_0xf808('0x2')]},'emailbody':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xf808('0xc')](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 bfef78b..5450122 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 _0xccf4=['status','json','count','offset','limit','reject','update','then','destroy','sendStatus','error','name','send','index','VoiceMail','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','order','sort','where','pick','day','add','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','VoiceMailMessage','hasOwnProperty','nolimit','mailbox','fast-json-patch','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x2ee052,_0x3f1484){var _0x39b8f7=function(_0x127d73){while(--_0x127d73){_0x2ee052['push'](_0x2ee052['shift']());}};_0x39b8f7(++_0x3f1484);}(_0xccf4,0x73));var _0x4ccf=function(_0x25e9cc,_0x21444c){_0x25e9cc=_0x25e9cc-0x0;var _0x464ec4=_0xccf4[_0x25e9cc];return _0x464ec4;};'use strict';var jsonpatch=require(_0x4ccf('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4ccf('0x1'));var util=require(_0x4ccf('0x2'));var path=require(_0x4ccf('0x3'));var sox=require(_0x4ccf('0x4'));var csv=require('to-csv');var ejs=require(_0x4ccf('0x5'));var fs=require('fs');var _=require(_0x4ccf('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4ccf('0x7'));var deskjs=require(_0x4ccf('0x8'));var toCsv=require('to-csv');var querystring=require(_0x4ccf('0x9'));var Papa=require(_0x4ccf('0xa'));var qs=require(_0x4ccf('0xb'));var logger=require(_0x4ccf('0xc'))(_0x4ccf('0xd'));var utils=require(_0x4ccf('0xe'));var config=require(_0x4ccf('0xf'));var db=require(_0x4ccf('0x10'))['db'];function respondWithStatusCode(_0x4bc6bc,_0x517c92){_0x517c92=_0x517c92||0xcc;return function(_0x4e9417){if(_0x4e9417){return _0x4bc6bc['sendStatus'](_0x517c92);}return _0x4bc6bc[_0x4ccf('0x11')](_0x517c92)['end']();};}function respondWithResult(_0x5baece,_0x1f0def){_0x1f0def=_0x1f0def||0xc8;return function(_0xe9c50b){if(_0xe9c50b){return _0x5baece['status'](_0x1f0def)[_0x4ccf('0x12')](_0xe9c50b);}};}function respondWithFilteredResult(_0x4d8c16,_0x1c6333){return function(_0x2969d6){if(_0x2969d6){var _0x3d4368=_0x2969d6[_0x4ccf('0x13')],_0x332547=_0x1c6333[_0x4ccf('0x14')],_0x52f7f9=_0x1c6333[_0x4ccf('0x14')]+_0x1c6333[_0x4ccf('0x15')],_0x3ac864;if(_0x52f7f9>=_0x3d4368){_0x52f7f9=_0x3d4368;_0x3ac864=0xc8;}else{_0x3ac864=0xce;}_0x4d8c16['status'](_0x3ac864);return _0x4d8c16['set']('Content-Range',_0x332547+'-'+_0x52f7f9+'/'+_0x3d4368)['json'](_0x2969d6);}return null;};}function patchUpdates(_0x585526){return function(_0x22cf02){try{jsonpatch['apply'](_0x22cf02,_0x585526,!![]);}catch(_0x208ed6){return BPromise[_0x4ccf('0x16')](_0x208ed6);}return _0x22cf02['save']();};}function saveUpdates(_0x7cc964,_0x3b0aae){return function(_0x3ab333){if(_0x3ab333){return _0x3ab333[_0x4ccf('0x17')](_0x7cc964)[_0x4ccf('0x18')](function(_0x2d3cc2){return _0x2d3cc2;});}return null;};}function removeEntity(_0x61c56d,_0x50fef4){return function(_0x188a31){if(_0x188a31){return _0x188a31[_0x4ccf('0x19')]()['then'](function(){_0x61c56d[_0x4ccf('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5de242,_0x3c3a91){return function(_0x5b891a){if(!_0x5b891a){_0x5de242[_0x4ccf('0x1a')](0x194);}return _0x5b891a;};}function handleError(_0x57c572,_0x5b85dc){_0x5b85dc=_0x5b85dc||0x1f4;return function(_0x3077fd){logger[_0x4ccf('0x1b')](_0x3077fd['stack']);if(_0x3077fd[_0x4ccf('0x1c')]){delete _0x3077fd[_0x4ccf('0x1c')];}_0x57c572[_0x4ccf('0x11')](_0x5b85dc)[_0x4ccf('0x1d')](_0x3077fd);};}exports[_0x4ccf('0x1e')]=function(_0x45a67c,_0x318f91){var _0x30760e={},_0x429d2b={},_0x1b0fd6={'count':0x0,'rows':[]};var _0x23216c=db[_0x4ccf('0x1f')]['rawAttributes'];_0x429d2b[_0x4ccf('0x20')]=_[_0x4ccf('0x21')](_0x23216c);var _0x4714cb={'dateStart':_0x45a67c[_0x4ccf('0x22')][_0x4ccf('0x23')],'dateEnd':_0x45a67c[_0x4ccf('0x22')][_0x4ccf('0x24')]};delete _0x45a67c[_0x4ccf('0x22')][_0x4ccf('0x23')];delete _0x45a67c[_0x4ccf('0x22')][_0x4ccf('0x24')];_0x429d2b[_0x4ccf('0x22')]=_[_0x4ccf('0x21')](_0x45a67c[_0x4ccf('0x22')]);_0x429d2b[_0x4ccf('0x25')]=_[_0x4ccf('0x26')](_0x429d2b[_0x4ccf('0x20')],_0x429d2b[_0x4ccf('0x22')]);_0x30760e[_0x4ccf('0x27')]=_['intersection'](_0x429d2b[_0x4ccf('0x20')],qs[_0x4ccf('0x28')](_0x45a67c[_0x4ccf('0x22')][_0x4ccf('0x28')]));_0x30760e[_0x4ccf('0x27')]=_0x30760e[_0x4ccf('0x27')][_0x4ccf('0x29')]?_0x30760e['attributes']:_0x429d2b[_0x4ccf('0x20')];if(!_0x45a67c[_0x4ccf('0x22')]['hasOwnProperty']('nolimit')){_0x30760e['limit']=qs['limit'](_0x45a67c[_0x4ccf('0x22')]['limit']);_0x30760e[_0x4ccf('0x14')]=qs[_0x4ccf('0x14')](_0x45a67c[_0x4ccf('0x22')]['offset']);}_0x30760e[_0x4ccf('0x2a')]=qs[_0x4ccf('0x2b')](_0x45a67c[_0x4ccf('0x22')][_0x4ccf('0x2b')]);_0x30760e[_0x4ccf('0x2c')]=qs['filters'](_[_0x4ccf('0x2d')](_0x45a67c[_0x4ccf('0x22')],_0x429d2b[_0x4ccf('0x25')]));if(_0x4714cb[_0x4ccf('0x23')]){if(_0x4714cb[_0x4ccf('0x24')]){_0x4714cb[_0x4ccf('0x24')]=moment(_0x4714cb[_0x4ccf('0x24')])['add'](0x1,_0x4ccf('0x2e'));}else{_0x4714cb['dateEnd']=moment(_0x4714cb[_0x4ccf('0x23')])[_0x4ccf('0x2f')](0x1,_0x4ccf('0x2e'));}_[_0x4ccf('0x30')](_0x30760e[_0x4ccf('0x2c')],{'createdAt':{'$gte':_0x4714cb['dateStart'],'$lte':_0x4714cb[_0x4ccf('0x24')]}});}if(_0x45a67c['query'][_0x4ccf('0x31')]){_0x30760e[_0x4ccf('0x2c')]=_['merge'](_0x30760e['where'],{'$or':_[_0x4ccf('0x32')](_0x30760e['attributes'],function(_0x15f04b){var _0x2edd01={};_0x2edd01[_0x15f04b]={'$like':'%'+_0x45a67c[_0x4ccf('0x22')]['filter']+'%'};return _0x2edd01;})});}_0x30760e=_[_0x4ccf('0x30')]({},_0x30760e,_0x45a67c[_0x4ccf('0x33')]);var _0x40462b={'where':_0x30760e[_0x4ccf('0x2c')]};return db[_0x4ccf('0x1f')][_0x4ccf('0x13')](_0x40462b)[_0x4ccf('0x18')](function(_0x20e67e){_0x1b0fd6['count']=_0x20e67e;if(_0x45a67c[_0x4ccf('0x22')][_0x4ccf('0x34')]){_0x30760e[_0x4ccf('0x35')]=[{'all':!![]}];}return db[_0x4ccf('0x1f')][_0x4ccf('0x36')](_0x30760e);})[_0x4ccf('0x18')](function(_0x3f9b32){_0x1b0fd6[_0x4ccf('0x37')]=_0x3f9b32;return _0x1b0fd6;})['then'](respondWithFilteredResult(_0x318f91,_0x30760e))[_0x4ccf('0x38')](handleError(_0x318f91,null));};exports[_0x4ccf('0x39')]=function(_0x5640a1,_0x53ba05){var _0x5459ab={'raw':!![],'where':{'id':_0x5640a1[_0x4ccf('0x3a')]['id']}},_0x13e72a={};_0x13e72a[_0x4ccf('0x20')]=_['keys'](db[_0x4ccf('0x1f')][_0x4ccf('0x3b')]);_0x13e72a['query']=_['keys'](_0x5640a1['query']);_0x13e72a[_0x4ccf('0x25')]=_[_0x4ccf('0x26')](_0x13e72a[_0x4ccf('0x20')],_0x13e72a[_0x4ccf('0x22')]);_0x5459ab['attributes']=_[_0x4ccf('0x26')](_0x13e72a[_0x4ccf('0x20')],qs[_0x4ccf('0x28')](_0x5640a1[_0x4ccf('0x22')]['fields']));_0x5459ab[_0x4ccf('0x27')]=_0x5459ab['attributes']['length']?_0x5459ab[_0x4ccf('0x27')]:_0x13e72a[_0x4ccf('0x20')];if(_0x5640a1[_0x4ccf('0x22')][_0x4ccf('0x34')]){_0x5459ab['include']=[{'all':!![]}];}_0x5459ab=_['merge']({},_0x5459ab,_0x5640a1[_0x4ccf('0x33')]);return db[_0x4ccf('0x1f')][_0x4ccf('0x3c')](_0x5459ab)[_0x4ccf('0x18')](handleEntityNotFound(_0x53ba05,null))[_0x4ccf('0x18')](respondWithResult(_0x53ba05,null))[_0x4ccf('0x38')](handleError(_0x53ba05,null));};exports['create']=function(_0x2e17ea,_0x338c95){return db['VoiceMail']['create'](_0x2e17ea['body'],{})['then'](respondWithResult(_0x338c95,0xc9))[_0x4ccf('0x38')](handleError(_0x338c95,null));};exports[_0x4ccf('0x17')]=function(_0x7867b0,_0x502dba){if(_0x7867b0[_0x4ccf('0x3d')]['id']){delete _0x7867b0[_0x4ccf('0x3d')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0x7867b0[_0x4ccf('0x3a')]['id']}})[_0x4ccf('0x18')](handleEntityNotFound(_0x502dba,null))[_0x4ccf('0x18')](saveUpdates(_0x7867b0[_0x4ccf('0x3d')],null))['then'](respondWithResult(_0x502dba,null))[_0x4ccf('0x38')](handleError(_0x502dba,null));};exports[_0x4ccf('0x19')]=function(_0x4ce3c6,_0x5ba41b){return db[_0x4ccf('0x1f')][_0x4ccf('0x3c')]({'where':{'id':_0x4ce3c6[_0x4ccf('0x3a')]['id']}})[_0x4ccf('0x18')](handleEntityNotFound(_0x5ba41b,null))[_0x4ccf('0x18')](removeEntity(_0x5ba41b,null))[_0x4ccf('0x38')](handleError(_0x5ba41b,null));};exports['getMessages']=function(_0x6ed311,_0x225ef8,_0x35e13f){return db['VoiceMail']['findOne']({'where':{'id':_0x6ed311[_0x4ccf('0x3a')]['id']}})[_0x4ccf('0x18')](handleEntityNotFound(_0x225ef8,null))['then'](function(_0x30b88f){var _0x294120;var _0x4a82b3={},_0x4d76f8={};_0x4d76f8['model']=_[_0x4ccf('0x21')](db[_0x4ccf('0x3e')][_0x4ccf('0x3b')]);_0x4d76f8[_0x4ccf('0x22')]=_[_0x4ccf('0x21')](_0x6ed311[_0x4ccf('0x22')]);_0x4d76f8[_0x4ccf('0x25')]=_['intersection'](_0x4d76f8['model'],_0x4d76f8[_0x4ccf('0x22')]);_0x4a82b3['attributes']=_[_0x4ccf('0x26')](_0x4d76f8[_0x4ccf('0x20')],qs['fields'](_0x6ed311['query'][_0x4ccf('0x28')]));_0x4a82b3[_0x4ccf('0x27')]=_0x4a82b3[_0x4ccf('0x27')][_0x4ccf('0x29')]?_0x4a82b3[_0x4ccf('0x27')]:_0x4d76f8[_0x4ccf('0x20')];if(!_0x6ed311[_0x4ccf('0x22')][_0x4ccf('0x3f')](_0x4ccf('0x40'))){_0x4a82b3[_0x4ccf('0x15')]=qs['limit'](_0x6ed311[_0x4ccf('0x22')]['limit']);_0x4a82b3[_0x4ccf('0x14')]=qs['offset'](_0x6ed311[_0x4ccf('0x22')][_0x4ccf('0x14')]);}_0x4a82b3[_0x4ccf('0x2a')]=qs['sort'](_0x6ed311[_0x4ccf('0x22')]['sort']);_0x4a82b3[_0x4ccf('0x2c')]=qs[_0x4ccf('0x25')](_[_0x4ccf('0x2d')](_0x6ed311[_0x4ccf('0x22')],_0x4d76f8[_0x4ccf('0x25')]));if(_0x6ed311[_0x4ccf('0x22')][_0x4ccf('0x31')]){_0x4a82b3[_0x4ccf('0x2c')]=_[_0x4ccf('0x30')](_0x4a82b3[_0x4ccf('0x2c')],{'$or':_[_0x4ccf('0x32')](_0x4a82b3[_0x4ccf('0x27')],function(_0x28b643){var _0x473e55={};_0x473e55[_0x28b643]={'$like':'%'+_0x6ed311[_0x4ccf('0x22')][_0x4ccf('0x31')]+'%'};return _0x473e55;})});}_0x4a82b3[_0x4ccf('0x2c')]=_['merge'](_0x4a82b3[_0x4ccf('0x2c')],{'mailboxuser':_0x30b88f[_0x4ccf('0x41')]});_0x4a82b3=_[_0x4ccf('0x30')]({},_0x4a82b3,_0x6ed311[_0x4ccf('0x33')]);return db[_0x4ccf('0x3e')]['findAndCountAll'](_0x4a82b3)['then'](respondWithFilteredResult(_0x225ef8,_0x4a82b3));})[_0x4ccf('0x38')](handleError(_0x225ef8,null));}; \ No newline at end of file +var _0x1f2c=['papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','VoiceMail','rawAttributes','model','keys','query','dateEnd','filters','attributes','intersection','fields','length','limit','sort','pick','add','day','merge','where','map','filter','options','includeAll','catch','show','params','include','find','create','body','getMessages','findOne','VoiceMailMessage','hasOwnProperty','order','mailbox','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv'];(function(_0xa68546,_0x451f26){var _0x2215ed=function(_0x3f16d2){while(--_0x3f16d2){_0xa68546['push'](_0xa68546['shift']());}};_0x2215ed(++_0x451f26);}(_0x1f2c,0x1e5));var _0xc1f2=function(_0x18ea90,_0x4f90f3){_0x18ea90=_0x18ea90-0x0;var _0x8e1813=_0x1f2c[_0x18ea90];return _0x8e1813;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xc1f2('0x0'));var moment=require(_0xc1f2('0x1'));var BPromise=require(_0xc1f2('0x2'));var Mustache=require(_0xc1f2('0x3'));var util=require(_0xc1f2('0x4'));var path=require(_0xc1f2('0x5'));var sox=require(_0xc1f2('0x6'));var csv=require('to-csv');var ejs=require(_0xc1f2('0x7'));var fs=require('fs');var _=require(_0xc1f2('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc1f2('0x9'));var deskjs=require(_0xc1f2('0xa'));var toCsv=require(_0xc1f2('0xb'));var querystring=require('querystring');var Papa=require(_0xc1f2('0xc'));var qs=require(_0xc1f2('0xd'));var logger=require(_0xc1f2('0xe'))(_0xc1f2('0xf'));var utils=require(_0xc1f2('0x10'));var config=require(_0xc1f2('0x11'));var db=require(_0xc1f2('0x12'))['db'];function respondWithStatusCode(_0x15cd24,_0x132597){_0x132597=_0x132597||0xcc;return function(_0x4ac149){if(_0x4ac149){return _0x15cd24[_0xc1f2('0x13')](_0x132597);}return _0x15cd24[_0xc1f2('0x14')](_0x132597)[_0xc1f2('0x15')]();};}function respondWithResult(_0x1e45d0,_0x5eec98){_0x5eec98=_0x5eec98||0xc8;return function(_0xb08b6a){if(_0xb08b6a){return _0x1e45d0['status'](_0x5eec98)[_0xc1f2('0x16')](_0xb08b6a);}};}function respondWithFilteredResult(_0x245f7f,_0xe11c16){return function(_0x9b84f){if(_0x9b84f){var _0x24a179=_0x9b84f[_0xc1f2('0x17')],_0x315592=_0xe11c16[_0xc1f2('0x18')],_0x2a5382=_0xe11c16[_0xc1f2('0x18')]+_0xe11c16['limit'],_0x12a4c6;if(_0x2a5382>=_0x24a179){_0x2a5382=_0x24a179;_0x12a4c6=0xc8;}else{_0x12a4c6=0xce;}_0x245f7f[_0xc1f2('0x14')](_0x12a4c6);return _0x245f7f['set'](_0xc1f2('0x19'),_0x315592+'-'+_0x2a5382+'/'+_0x24a179)[_0xc1f2('0x16')](_0x9b84f);}return null;};}function patchUpdates(_0x5a59b8){return function(_0x231455){try{jsonpatch[_0xc1f2('0x1a')](_0x231455,_0x5a59b8,!![]);}catch(_0x16f40a){return BPromise[_0xc1f2('0x1b')](_0x16f40a);}return _0x231455[_0xc1f2('0x1c')]();};}function saveUpdates(_0x1ceaa8,_0x4802ac){return function(_0x40c966){if(_0x40c966){return _0x40c966['update'](_0x1ceaa8)[_0xc1f2('0x1d')](function(_0x3da4b2){return _0x3da4b2;});}return null;};}function removeEntity(_0x407a7c,_0x183cba){return function(_0x5ddd25){if(_0x5ddd25){return _0x5ddd25[_0xc1f2('0x1e')]()[_0xc1f2('0x1d')](function(){_0x407a7c[_0xc1f2('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x288d6c,_0x27bdc7){return function(_0x50bf72){if(!_0x50bf72){_0x288d6c[_0xc1f2('0x13')](0x194);}return _0x50bf72;};}function handleError(_0x32266b,_0x3a6bc6){_0x3a6bc6=_0x3a6bc6||0x1f4;return function(_0x47bd12){logger[_0xc1f2('0x1f')](_0x47bd12[_0xc1f2('0x20')]);if(_0x47bd12['name']){delete _0x47bd12[_0xc1f2('0x21')];}_0x32266b['status'](_0x3a6bc6)[_0xc1f2('0x22')](_0x47bd12);};}exports[_0xc1f2('0x23')]=function(_0x3b4d80,_0x33e316){var _0x185241={},_0x1798c6={},_0x25d154={'count':0x0,'rows':[]};var _0x5dc80d=db[_0xc1f2('0x24')][_0xc1f2('0x25')];_0x1798c6[_0xc1f2('0x26')]=_[_0xc1f2('0x27')](_0x5dc80d);var _0x81378f={'dateStart':_0x3b4d80[_0xc1f2('0x28')]['dateStart'],'dateEnd':_0x3b4d80[_0xc1f2('0x28')][_0xc1f2('0x29')]};delete _0x3b4d80[_0xc1f2('0x28')]['dateStart'];delete _0x3b4d80[_0xc1f2('0x28')][_0xc1f2('0x29')];_0x1798c6[_0xc1f2('0x28')]=_[_0xc1f2('0x27')](_0x3b4d80[_0xc1f2('0x28')]);_0x1798c6[_0xc1f2('0x2a')]=_['intersection'](_0x1798c6[_0xc1f2('0x26')],_0x1798c6[_0xc1f2('0x28')]);_0x185241[_0xc1f2('0x2b')]=_[_0xc1f2('0x2c')](_0x1798c6[_0xc1f2('0x26')],qs[_0xc1f2('0x2d')](_0x3b4d80[_0xc1f2('0x28')][_0xc1f2('0x2d')]));_0x185241[_0xc1f2('0x2b')]=_0x185241[_0xc1f2('0x2b')][_0xc1f2('0x2e')]?_0x185241[_0xc1f2('0x2b')]:_0x1798c6[_0xc1f2('0x26')];if(!_0x3b4d80['query']['hasOwnProperty']('nolimit')){_0x185241[_0xc1f2('0x2f')]=qs[_0xc1f2('0x2f')](_0x3b4d80[_0xc1f2('0x28')][_0xc1f2('0x2f')]);_0x185241[_0xc1f2('0x18')]=qs['offset'](_0x3b4d80['query']['offset']);}_0x185241['order']=qs[_0xc1f2('0x30')](_0x3b4d80[_0xc1f2('0x28')][_0xc1f2('0x30')]);_0x185241['where']=qs[_0xc1f2('0x2a')](_[_0xc1f2('0x31')](_0x3b4d80[_0xc1f2('0x28')],_0x1798c6[_0xc1f2('0x2a')]));if(_0x81378f['dateStart']){if(_0x81378f['dateEnd']){_0x81378f[_0xc1f2('0x29')]=moment(_0x81378f[_0xc1f2('0x29')])['add'](0x1,'day');}else{_0x81378f[_0xc1f2('0x29')]=moment(_0x81378f['dateStart'])[_0xc1f2('0x32')](0x1,_0xc1f2('0x33'));}_[_0xc1f2('0x34')](_0x185241[_0xc1f2('0x35')],{'createdAt':{'$gte':_0x81378f['dateStart'],'$lte':_0x81378f[_0xc1f2('0x29')]}});}if(_0x3b4d80[_0xc1f2('0x28')]['filter']){_0x185241[_0xc1f2('0x35')]=_['merge'](_0x185241[_0xc1f2('0x35')],{'$or':_[_0xc1f2('0x36')](_0x185241[_0xc1f2('0x2b')],function(_0x58877a){var _0x50b843={};_0x50b843[_0x58877a]={'$like':'%'+_0x3b4d80['query'][_0xc1f2('0x37')]+'%'};return _0x50b843;})});}_0x185241=_[_0xc1f2('0x34')]({},_0x185241,_0x3b4d80[_0xc1f2('0x38')]);var _0x1ea732={'where':_0x185241[_0xc1f2('0x35')]};return db[_0xc1f2('0x24')][_0xc1f2('0x17')](_0x1ea732)['then'](function(_0x35bce3){_0x25d154[_0xc1f2('0x17')]=_0x35bce3;if(_0x3b4d80[_0xc1f2('0x28')][_0xc1f2('0x39')]){_0x185241['include']=[{'all':!![]}];}return db[_0xc1f2('0x24')]['findAll'](_0x185241);})[_0xc1f2('0x1d')](function(_0x431fbc){_0x25d154['rows']=_0x431fbc;return _0x25d154;})[_0xc1f2('0x1d')](respondWithFilteredResult(_0x33e316,_0x185241))[_0xc1f2('0x3a')](handleError(_0x33e316,null));};exports[_0xc1f2('0x3b')]=function(_0x274b6e,_0x497d1f){var _0x15192c={'raw':!![],'where':{'id':_0x274b6e[_0xc1f2('0x3c')]['id']}},_0x485b03={};_0x485b03[_0xc1f2('0x26')]=_[_0xc1f2('0x27')](db[_0xc1f2('0x24')][_0xc1f2('0x25')]);_0x485b03[_0xc1f2('0x28')]=_[_0xc1f2('0x27')](_0x274b6e[_0xc1f2('0x28')]);_0x485b03[_0xc1f2('0x2a')]=_['intersection'](_0x485b03['model'],_0x485b03[_0xc1f2('0x28')]);_0x15192c[_0xc1f2('0x2b')]=_['intersection'](_0x485b03[_0xc1f2('0x26')],qs[_0xc1f2('0x2d')](_0x274b6e[_0xc1f2('0x28')]['fields']));_0x15192c['attributes']=_0x15192c[_0xc1f2('0x2b')][_0xc1f2('0x2e')]?_0x15192c[_0xc1f2('0x2b')]:_0x485b03[_0xc1f2('0x26')];if(_0x274b6e['query'][_0xc1f2('0x39')]){_0x15192c[_0xc1f2('0x3d')]=[{'all':!![]}];}_0x15192c=_[_0xc1f2('0x34')]({},_0x15192c,_0x274b6e[_0xc1f2('0x38')]);return db['VoiceMail'][_0xc1f2('0x3e')](_0x15192c)[_0xc1f2('0x1d')](handleEntityNotFound(_0x497d1f,null))[_0xc1f2('0x1d')](respondWithResult(_0x497d1f,null))['catch'](handleError(_0x497d1f,null));};exports[_0xc1f2('0x3f')]=function(_0x127320,_0x227406){return db[_0xc1f2('0x24')][_0xc1f2('0x3f')](_0x127320[_0xc1f2('0x40')],{})['then'](respondWithResult(_0x227406,0xc9))['catch'](handleError(_0x227406,null));};exports['update']=function(_0x3949f9,_0x5a9e53){if(_0x3949f9['body']['id']){delete _0x3949f9['body']['id'];}return db[_0xc1f2('0x24')][_0xc1f2('0x3e')]({'where':{'id':_0x3949f9[_0xc1f2('0x3c')]['id']}})['then'](handleEntityNotFound(_0x5a9e53,null))['then'](saveUpdates(_0x3949f9[_0xc1f2('0x40')],null))[_0xc1f2('0x1d')](respondWithResult(_0x5a9e53,null))[_0xc1f2('0x3a')](handleError(_0x5a9e53,null));};exports[_0xc1f2('0x1e')]=function(_0x256331,_0x36bd0e){return db['VoiceMail']['find']({'where':{'id':_0x256331[_0xc1f2('0x3c')]['id']}})[_0xc1f2('0x1d')](handleEntityNotFound(_0x36bd0e,null))['then'](removeEntity(_0x36bd0e,null))[_0xc1f2('0x3a')](handleError(_0x36bd0e,null));};exports[_0xc1f2('0x41')]=function(_0x3a46ff,_0x359229,_0x3fe9b5){return db['VoiceMail'][_0xc1f2('0x42')]({'where':{'id':_0x3a46ff[_0xc1f2('0x3c')]['id']}})[_0xc1f2('0x1d')](handleEntityNotFound(_0x359229,null))['then'](function(_0x4ed4df){var _0x2d8fde;var _0x3d5768={},_0x471e82={};_0x471e82[_0xc1f2('0x26')]=_[_0xc1f2('0x27')](db[_0xc1f2('0x43')][_0xc1f2('0x25')]);_0x471e82[_0xc1f2('0x28')]=_[_0xc1f2('0x27')](_0x3a46ff[_0xc1f2('0x28')]);_0x471e82[_0xc1f2('0x2a')]=_[_0xc1f2('0x2c')](_0x471e82[_0xc1f2('0x26')],_0x471e82[_0xc1f2('0x28')]);_0x3d5768[_0xc1f2('0x2b')]=_['intersection'](_0x471e82[_0xc1f2('0x26')],qs['fields'](_0x3a46ff[_0xc1f2('0x28')][_0xc1f2('0x2d')]));_0x3d5768[_0xc1f2('0x2b')]=_0x3d5768['attributes'][_0xc1f2('0x2e')]?_0x3d5768[_0xc1f2('0x2b')]:_0x471e82[_0xc1f2('0x26')];if(!_0x3a46ff[_0xc1f2('0x28')][_0xc1f2('0x44')]('nolimit')){_0x3d5768[_0xc1f2('0x2f')]=qs['limit'](_0x3a46ff[_0xc1f2('0x28')][_0xc1f2('0x2f')]);_0x3d5768[_0xc1f2('0x18')]=qs['offset'](_0x3a46ff['query'][_0xc1f2('0x18')]);}_0x3d5768[_0xc1f2('0x45')]=qs[_0xc1f2('0x30')](_0x3a46ff[_0xc1f2('0x28')][_0xc1f2('0x30')]);_0x3d5768['where']=qs[_0xc1f2('0x2a')](_[_0xc1f2('0x31')](_0x3a46ff[_0xc1f2('0x28')],_0x471e82[_0xc1f2('0x2a')]));if(_0x3a46ff[_0xc1f2('0x28')][_0xc1f2('0x37')]){_0x3d5768['where']=_[_0xc1f2('0x34')](_0x3d5768['where'],{'$or':_[_0xc1f2('0x36')](_0x3d5768['attributes'],function(_0x275135){var _0x5bbe95={};_0x5bbe95[_0x275135]={'$like':'%'+_0x3a46ff['query'][_0xc1f2('0x37')]+'%'};return _0x5bbe95;})});}_0x3d5768[_0xc1f2('0x35')]=_[_0xc1f2('0x34')](_0x3d5768[_0xc1f2('0x35')],{'mailboxuser':_0x4ed4df[_0xc1f2('0x46')]});_0x3d5768=_[_0xc1f2('0x34')]({},_0x3d5768,_0x3a46ff[_0xc1f2('0x38')]);return db['VoiceMailMessage']['findAndCountAll'](_0x3d5768)[_0xc1f2('0x1d')](respondWithFilteredResult(_0x359229,_0x3d5768));})['catch'](handleError(_0x359229,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 1127ed2..238f49a 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 _0x13d3=['lodash','../../config/logger','api','bluebird','request-promise','exports','define','mailbox_context','mailbox','context'];(function(_0x1f90c0,_0x110e79){var _0x4d707d=function(_0x3acd00){while(--_0x3acd00){_0x1f90c0['push'](_0x1f90c0['shift']());}};_0x4d707d(++_0x110e79);}(_0x13d3,0x118));var _0x313d=function(_0x55234d,_0x1ea353){_0x55234d=_0x55234d-0x0;var _0x344a75=_0x13d3[_0x55234d];return _0x344a75;};'use strict';var _=require(_0x313d('0x0'));var util=require('util');var logger=require(_0x313d('0x1'))(_0x313d('0x2'));var moment=require('moment');var BPromise=require(_0x313d('0x3'));var rp=require(_0x313d('0x4'));var attributes=require('./voiceMail.attributes');module[_0x313d('0x5')]=function(_0x1003c3,_0x31cf0b){return _0x1003c3[_0x313d('0x6')]('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x313d('0x7'),'fields':[_0x313d('0x8'),_0x313d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0b69=['request-promise','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x303257,_0x377277){var _0x4a1756=function(_0x239192){while(--_0x239192){_0x303257['push'](_0x303257['shift']());}};_0x4a1756(++_0x377277);}(_0x0b69,0x13f));var _0x90b6=function(_0x4e9fe4,_0x3c9f38){_0x4e9fe4=_0x4e9fe4-0x0;var _0x531c77=_0x0b69[_0x4e9fe4];return _0x531c77;};'use strict';var _=require(_0x90b6('0x0'));var util=require(_0x90b6('0x1'));var logger=require(_0x90b6('0x2'))(_0x90b6('0x3'));var moment=require(_0x90b6('0x4'));var BPromise=require(_0x90b6('0x5'));var rp=require(_0x90b6('0x6'));var attributes=require(_0x90b6('0x7'));module[_0x90b6('0x8')]=function(_0x1e42f3,_0x2649c){return _0x1e42f3[_0x90b6('0x9')](_0x90b6('0xa'),attributes,{'tableName':_0x90b6('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x90b6('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index c701cbe..4c0ae97 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 _0xb06d=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0xee5d2a,_0x534134){var _0x346948=function(_0x458fdf){while(--_0x458fdf){_0xee5d2a['push'](_0xee5d2a['shift']());}};_0x346948(++_0x534134);}(_0xb06d,0x19d));var _0xdb06=function(_0x39d91d,_0x32a478){_0x39d91d=_0x39d91d-0x0;var _0x179a84=_0xb06d[_0x39d91d];return _0x179a84;};'use strict';var _=require(_0xdb06('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdb06('0x1'));var rs=require(_0xdb06('0x2'));var fs=require('fs');var db=require(_0xdb06('0x3'))['db'];var utils=require(_0xdb06('0x4'));var logger=require(_0xdb06('0x5'))(_0xdb06('0x6'));var config=require(_0xdb06('0x7'));var jayson=require(_0xdb06('0x8'));var client=jayson['client'][_0xdb06('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3029bc,_0x43db2c,_0x2060c9){return new BPromise(function(_0x967268,_0x24b404){return client[_0xdb06('0xa')](_0x3029bc,_0x2060c9)['then'](function(_0x3c6090){logger[_0xdb06('0xb')]('VoiceMail,\x20%s,\x20%s',_0x43db2c,_0xdb06('0xc'));logger[_0xdb06('0xd')](_0xdb06('0xe'),_0x43db2c,'request\x20sent',JSON[_0xdb06('0xf')](_0x3c6090));if(_0x3c6090[_0xdb06('0x10')]){if(_0x3c6090[_0xdb06('0x10')][_0xdb06('0x11')]===0x1f4){logger[_0xdb06('0x10')](_0xdb06('0x12'),_0x43db2c,_0x3c6090[_0xdb06('0x10')][_0xdb06('0x13')]);return _0x24b404(_0x3c6090[_0xdb06('0x10')][_0xdb06('0x13')]);}logger[_0xdb06('0x10')](_0xdb06('0x12'),_0x43db2c,_0x3c6090[_0xdb06('0x10')][_0xdb06('0x13')]);return _0x967268(_0x3c6090[_0xdb06('0x10')][_0xdb06('0x13')]);}else{logger[_0xdb06('0xb')](_0xdb06('0x12'),_0x43db2c,'request\x20sent');_0x967268(_0x3c6090[_0xdb06('0x14')]['message']);}})[_0xdb06('0x15')](function(_0x24c736){logger['error'](_0xdb06('0x12'),_0x43db2c,_0x24c736);_0x24b404(_0x24c736);});});} \ No newline at end of file +var _0xeb6b=['result','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x1eff59,_0x195aa6){var _0xa061cd=function(_0x5daf00){while(--_0x5daf00){_0x1eff59['push'](_0x1eff59['shift']());}};_0xa061cd(++_0x195aa6);}(_0xeb6b,0x112));var _0xbeb6=function(_0x45b17a,_0x4767f6){_0x45b17a=_0x45b17a-0x0;var _0x496391=_0xeb6b[_0x45b17a];return _0x496391;};'use strict';var _=require(_0xbeb6('0x0'));var util=require('util');var moment=require(_0xbeb6('0x1'));var BPromise=require(_0xbeb6('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xbeb6('0x3'))['db'];var utils=require(_0xbeb6('0x4'));var logger=require(_0xbeb6('0x5'))(_0xbeb6('0x6'));var config=require(_0xbeb6('0x7'));var jayson=require(_0xbeb6('0x8'));var client=jayson[_0xbeb6('0x9')][_0xbeb6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdcd1f9,_0x438a82,_0x42a8fa){return new BPromise(function(_0xd08ec3,_0x40633d){return client[_0xbeb6('0xb')](_0xdcd1f9,_0x42a8fa)[_0xbeb6('0xc')](function(_0x2c67d0){logger[_0xbeb6('0xd')](_0xbeb6('0xe'),_0x438a82,_0xbeb6('0xf'));logger[_0xbeb6('0x10')](_0xbeb6('0x11'),_0x438a82,_0xbeb6('0xf'),JSON['stringify'](_0x2c67d0));if(_0x2c67d0[_0xbeb6('0x12')]){if(_0x2c67d0['error']['code']===0x1f4){logger[_0xbeb6('0x12')](_0xbeb6('0xe'),_0x438a82,_0x2c67d0[_0xbeb6('0x12')][_0xbeb6('0x13')]);return _0x40633d(_0x2c67d0[_0xbeb6('0x12')][_0xbeb6('0x13')]);}logger[_0xbeb6('0x12')](_0xbeb6('0xe'),_0x438a82,_0x2c67d0[_0xbeb6('0x12')][_0xbeb6('0x13')]);return _0xd08ec3(_0x2c67d0[_0xbeb6('0x12')][_0xbeb6('0x13')]);}else{logger[_0xbeb6('0xd')]('VoiceMail,\x20%s,\x20%s',_0x438a82,_0xbeb6('0xf'));_0xd08ec3(_0x2c67d0[_0xbeb6('0x14')][_0xbeb6('0x13')]);}})['catch'](function(_0x5adccb){logger[_0xbeb6('0x12')]('VoiceMail,\x20%s,\x20%s',_0x438a82,_0x5adccb);_0x40633d(_0x5adccb);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 2317975..1a5e964 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 _0xe774=['destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/download','download','create','put','update','/:id'];(function(_0x202d24,_0x5e8641){var _0x2b3a8e=function(_0x4c7c4a){while(--_0x4c7c4a){_0x202d24['push'](_0x202d24['shift']());}};_0x2b3a8e(++_0x5e8641);}(_0xe774,0x156));var _0x4e77=function(_0x5d2bde,_0x172a7a){_0x5d2bde=_0x5d2bde-0x0;var _0x28e373=_0xe774[_0x5d2bde];return _0x28e373;};'use strict';var multer=require(_0x4e77('0x0'));var util=require(_0x4e77('0x1'));var path=require(_0x4e77('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x4e77('0x3'));var interaction=require(_0x4e77('0x4'));var config=require(_0x4e77('0x5'));var controller=require('./voiceMailMessage.controller');router[_0x4e77('0x6')]('/',auth[_0x4e77('0x7')](),controller['index']);router[_0x4e77('0x6')]('/:id',auth[_0x4e77('0x7')](),controller[_0x4e77('0x8')]);router[_0x4e77('0x6')](_0x4e77('0x9'),auth['isAuthenticated'](),controller[_0x4e77('0xa')]);router['post']('/',auth[_0x4e77('0x7')](),controller[_0x4e77('0xb')]);router[_0x4e77('0xc')]('/:id',auth[_0x4e77('0x7')](),controller[_0x4e77('0xd')]);router['delete'](_0x4e77('0xe'),auth[_0x4e77('0x7')](),controller[_0x4e77('0xf')]);module[_0x4e77('0x10')]=router; \ No newline at end of file +var _0x87f8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','/:id','show','get','create','put','delete','destroy','exports','util','Router'];(function(_0x1dcafa,_0x3c374c){var _0x3e1291=function(_0x325b42){while(--_0x325b42){_0x1dcafa['push'](_0x1dcafa['shift']());}};_0x3e1291(++_0x3c374c);}(_0x87f8,0x8e));var _0x887f=function(_0x77331e,_0x6e5501){_0x77331e=_0x77331e-0x0;var _0x1bfdf2=_0x87f8[_0x77331e];return _0x1bfdf2;};'use strict';var multer=require('multer');var util=require(_0x887f('0x0'));var path=require('path');var express=require('express');var router=express[_0x887f('0x1')]();var auth=require(_0x887f('0x2'));var interaction=require(_0x887f('0x3'));var config=require(_0x887f('0x4'));var controller=require(_0x887f('0x5'));router['get']('/',auth[_0x887f('0x6')](),controller[_0x887f('0x7')]);router['get'](_0x887f('0x8'),auth[_0x887f('0x6')](),controller[_0x887f('0x9')]);router[_0x887f('0xa')]('/:id/download',auth[_0x887f('0x6')](),controller['download']);router['post']('/',auth[_0x887f('0x6')](),controller[_0x887f('0xb')]);router[_0x887f('0xc')](_0x887f('0x8'),auth[_0x887f('0x6')](),controller['update']);router[_0x887f('0xd')](_0x887f('0x8'),auth[_0x887f('0x6')](),controller[_0x887f('0xe')]);module[_0x887f('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index d819088..31107d4 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 _0xbc31=['BLOB','long','TIMESTAMP','exports','VIRTUAL','getDataValue','INTEGER','STRING'];(function(_0xb6e43,_0x1568fc){var _0x47c40f=function(_0x107786){while(--_0x107786){_0xb6e43['push'](_0xb6e43['shift']());}};_0x47c40f(++_0x1568fc);}(_0xbc31,0xdb));var _0x1bc3=function(_0xcbe48f,_0x127dd5){_0xcbe48f=_0xcbe48f-0x0;var _0x41809b=_0xbc31[_0xcbe48f];return _0x41809b;};'use strict';var Sequelize=require('sequelize');module[_0x1bc3('0x0')]={'name':{'type':Sequelize[_0x1bc3('0x1')],'get':function(_0x3bf986){return this[_0x1bc3('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x1bc3('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x1bc3('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x1bc3('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x1bc3('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x1bc3('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x1bc3('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x1bc3('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x1bc3('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x1bc3('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x1bc3('0x5')](_0x1bc3('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x1bc3('0x4')],'defaultValue':''},'stamp':{'type':_0x1bc3('0x7'),'allowNull':![]}}; \ No newline at end of file +var _0x1125=['TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING'];(function(_0x442213,_0x52ba34){var _0x36011f=function(_0x71d6ff){while(--_0x71d6ff){_0x442213['push'](_0x442213['shift']());}};_0x36011f(++_0x52ba34);}(_0x1125,0x16d));var _0x5112=function(_0x8cb2f9,_0x2b8706){_0x8cb2f9=_0x8cb2f9-0x0;var _0x164887=_0x1125[_0x8cb2f9];return _0x164887;};'use strict';var Sequelize=require(_0x5112('0x0'));module[_0x5112('0x1')]={'name':{'type':Sequelize[_0x5112('0x2')],'get':function(_0x4f7113){return this[_0x5112('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x5112('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x5112('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x5112('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x5112('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x5112('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x5112('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x5112('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x5112('0x5')],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x5112('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x5112('0x6'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index cd8ed71..6374c43 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 _0x1197=['include','catch','show','params','options','find','create','update','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','api','sendStatus','end','status','count','limit','set','Content-Range','json','apply','save','then','destroy','name','send','VoiceMailMessage','rawAttributes','model','differenceBy','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','add','day','filter','map','merge','includeAll'];(function(_0xacb7cf,_0x1444b7){var _0x10feb3=function(_0x1c6071){while(--_0x1c6071){_0xacb7cf['push'](_0xacb7cf['shift']());}};_0x10feb3(++_0x1444b7);}(_0x1197,0xa8));var _0x7119=function(_0x173be1,_0x544a35){_0x173be1=_0x173be1-0x0;var _0x511b68=_0x1197[_0x173be1];return _0x511b68;};'use strict';var jsonpatch=require(_0x7119('0x0'));var rp=require('request-promise');var moment=require(_0x7119('0x1'));var BPromise=require(_0x7119('0x2'));var Mustache=require(_0x7119('0x3'));var util=require(_0x7119('0x4'));var path=require(_0x7119('0x5'));var sox=require(_0x7119('0x6'));var csv=require('to-csv');var ejs=require(_0x7119('0x7'));var fs=require('fs');var _=require(_0x7119('0x8'));var squel=require(_0x7119('0x9'));var crypto=require(_0x7119('0xa'));var jsforce=require(_0x7119('0xb'));var deskjs=require(_0x7119('0xc'));var toCsv=require(_0x7119('0xd'));var querystring=require(_0x7119('0xe'));var Papa=require(_0x7119('0xf'));var qs=require(_0x7119('0x10'));var logger=require('../../config/logger')(_0x7119('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d0ee7,_0x152e5c){_0x152e5c=_0x152e5c||0xcc;return function(_0x792620){if(_0x792620){return _0x4d0ee7[_0x7119('0x12')](_0x152e5c);}return _0x4d0ee7['status'](_0x152e5c)[_0x7119('0x13')]();};}function respondWithResult(_0x50f28b,_0x4dc633){_0x4dc633=_0x4dc633||0xc8;return function(_0xae45f){if(_0xae45f){return _0x50f28b[_0x7119('0x14')](_0x4dc633)['json'](_0xae45f);}};}function respondWithFilteredResult(_0xdbb8d9,_0x20722d){return function(_0x37c827){if(_0x37c827){var _0x4fdda0=_0x37c827[_0x7119('0x15')],_0x3a5aa3=_0x20722d['offset'],_0x27ded1=_0x20722d['offset']+_0x20722d[_0x7119('0x16')],_0x2fd142;if(_0x27ded1>=_0x4fdda0){_0x27ded1=_0x4fdda0;_0x2fd142=0xc8;}else{_0x2fd142=0xce;}_0xdbb8d9[_0x7119('0x14')](_0x2fd142);return _0xdbb8d9[_0x7119('0x17')](_0x7119('0x18'),_0x3a5aa3+'-'+_0x27ded1+'/'+_0x4fdda0)[_0x7119('0x19')](_0x37c827);}return null;};}function patchUpdates(_0x530c01){return function(_0x22c5b6){try{jsonpatch[_0x7119('0x1a')](_0x22c5b6,_0x530c01,!![]);}catch(_0x2651e6){return BPromise['reject'](_0x2651e6);}return _0x22c5b6[_0x7119('0x1b')]();};}function saveUpdates(_0xe42b95,_0x3c2643){return function(_0x52cd6b){if(_0x52cd6b){return _0x52cd6b['update'](_0xe42b95)[_0x7119('0x1c')](function(_0x33763c){return _0x33763c;});}return null;};}function removeEntity(_0x10e581,_0x245ec8){return function(_0x5668d6){if(_0x5668d6){return _0x5668d6[_0x7119('0x1d')]()[_0x7119('0x1c')](function(){_0x10e581['status'](0xcc)[_0x7119('0x13')]();});}};}function handleEntityNotFound(_0x3056cc,_0x48d625){return function(_0x47333c){if(!_0x47333c){_0x3056cc['sendStatus'](0x194);}return _0x47333c;};}function handleError(_0x494a91,_0x4bbb1b){_0x4bbb1b=_0x4bbb1b||0x1f4;return function(_0x33aed5){logger['error'](_0x33aed5['stack']);if(_0x33aed5[_0x7119('0x1e')]){delete _0x33aed5[_0x7119('0x1e')];}_0x494a91[_0x7119('0x14')](_0x4bbb1b)[_0x7119('0x1f')](_0x33aed5);};}exports['index']=function(_0x2b5520,_0x40e02f){var _0x5970e1={},_0x2b0047={},_0x3a5595={'count':0x0,'rows':[]};var _0x3a4351=db[_0x7119('0x20')][_0x7119('0x21')];_0x2b0047[_0x7119('0x22')]=_[_0x7119('0x23')](_[_0x7119('0x24')](_0x3a4351),[_0x7119('0x1e')]);var _0x223f40={'dateStart':_0x2b5520[_0x7119('0x25')][_0x7119('0x26')],'dateEnd':_0x2b5520[_0x7119('0x25')]['dateEnd']};delete _0x2b5520[_0x7119('0x25')][_0x7119('0x26')];delete _0x2b5520[_0x7119('0x25')][_0x7119('0x27')];_0x2b0047[_0x7119('0x25')]=_[_0x7119('0x24')](_0x2b5520[_0x7119('0x25')]);_0x2b0047[_0x7119('0x28')]=_[_0x7119('0x29')](_0x2b0047[_0x7119('0x22')],_0x2b0047[_0x7119('0x25')]);_0x5970e1[_0x7119('0x2a')]=_[_0x7119('0x29')](_0x2b0047['model'],qs[_0x7119('0x2b')](_0x2b5520[_0x7119('0x25')][_0x7119('0x2b')]));_0x5970e1['attributes']=_0x5970e1['attributes']['length']?_0x5970e1[_0x7119('0x2a')]:_0x2b0047[_0x7119('0x22')];if(!_0x2b5520[_0x7119('0x25')][_0x7119('0x2c')](_0x7119('0x2d'))){_0x5970e1[_0x7119('0x16')]=qs[_0x7119('0x16')](_0x2b5520[_0x7119('0x25')][_0x7119('0x16')]);_0x5970e1[_0x7119('0x2e')]=qs['offset'](_0x2b5520['query'][_0x7119('0x2e')]);}_0x5970e1[_0x7119('0x2f')]=qs[_0x7119('0x30')](_0x2b5520[_0x7119('0x25')][_0x7119('0x30')]);_0x5970e1[_0x7119('0x31')]=qs[_0x7119('0x28')](_[_0x7119('0x32')](_0x2b5520['query'],_0x2b0047[_0x7119('0x28')]));if(_0x223f40[_0x7119('0x26')]){if(_0x223f40[_0x7119('0x27')]){_0x223f40[_0x7119('0x27')]=moment(_0x223f40['dateEnd'])[_0x7119('0x33')](0x1,'day');}else{_0x223f40[_0x7119('0x27')]=moment(_0x223f40[_0x7119('0x26')])[_0x7119('0x33')](0x1,_0x7119('0x34'));}_['merge'](_0x5970e1[_0x7119('0x31')],{'createdAt':{'$gte':_0x223f40[_0x7119('0x26')],'$lte':_0x223f40[_0x7119('0x27')]}});}if(_0x2b5520[_0x7119('0x25')][_0x7119('0x35')]){_0x5970e1[_0x7119('0x31')]=_['merge'](_0x5970e1['where'],{'$or':_[_0x7119('0x36')](_0x5970e1[_0x7119('0x2a')],function(_0x598677){var _0x105d83={};_0x105d83[_0x598677]={'$like':'%'+_0x2b5520[_0x7119('0x25')][_0x7119('0x35')]+'%'};return _0x105d83;})});}_0x5970e1=_[_0x7119('0x37')]({},_0x5970e1,_0x2b5520['options']);var _0xf36db2={'where':_0x5970e1[_0x7119('0x31')]};return db[_0x7119('0x20')][_0x7119('0x15')](_0xf36db2)['then'](function(_0x4f715e){_0x3a5595[_0x7119('0x15')]=_0x4f715e;if(_0x2b5520[_0x7119('0x25')][_0x7119('0x38')]){_0x5970e1[_0x7119('0x39')]=[{'all':!![]}];}return db[_0x7119('0x20')]['findAll'](_0x5970e1);})[_0x7119('0x1c')](function(_0x49aaca){_0x3a5595['rows']=_0x49aaca;return _0x3a5595;})[_0x7119('0x1c')](respondWithFilteredResult(_0x40e02f,_0x5970e1))[_0x7119('0x3a')](handleError(_0x40e02f,null));};exports[_0x7119('0x3b')]=function(_0x2da5d7,_0x4002cc){var _0x457c73={'raw':!![],'where':{'id':_0x2da5d7[_0x7119('0x3c')]['id']}},_0x44ad87={};_0x44ad87['model']=_['keys'](db[_0x7119('0x20')][_0x7119('0x21')]);_0x44ad87[_0x7119('0x25')]=_[_0x7119('0x24')](_0x2da5d7[_0x7119('0x25')]);_0x44ad87[_0x7119('0x28')]=_[_0x7119('0x29')](_0x44ad87[_0x7119('0x22')],_0x44ad87[_0x7119('0x25')]);_0x457c73['attributes']=_[_0x7119('0x29')](_0x44ad87[_0x7119('0x22')],qs[_0x7119('0x2b')](_0x2da5d7[_0x7119('0x25')][_0x7119('0x2b')]));_0x457c73[_0x7119('0x2a')]=_0x457c73[_0x7119('0x2a')]['length']?_0x457c73[_0x7119('0x2a')]:_0x44ad87[_0x7119('0x22')];if(_0x2da5d7['query']['includeAll']){_0x457c73['include']=[{'all':!![]}];}_0x457c73=_[_0x7119('0x37')]({},_0x457c73,_0x2da5d7[_0x7119('0x3d')]);return db['VoiceMailMessage'][_0x7119('0x3e')](_0x457c73)[_0x7119('0x1c')](handleEntityNotFound(_0x4002cc,null))[_0x7119('0x1c')](respondWithResult(_0x4002cc,null))[_0x7119('0x3a')](handleError(_0x4002cc,null));};exports[_0x7119('0x3f')]=function(_0x507728,_0x3109b0){return db[_0x7119('0x20')]['create'](_0x507728['body'],{})[_0x7119('0x1c')](respondWithResult(_0x3109b0,0xc9))[_0x7119('0x3a')](handleError(_0x3109b0,null));};exports[_0x7119('0x40')]=function(_0x210cc0,_0x44c170){if(_0x210cc0['body']['id']){delete _0x210cc0[_0x7119('0x41')]['id'];}return db[_0x7119('0x20')][_0x7119('0x3e')]({'where':{'id':_0x210cc0['params']['id']}})[_0x7119('0x1c')](handleEntityNotFound(_0x44c170,null))[_0x7119('0x1c')](saveUpdates(_0x210cc0[_0x7119('0x41')],null))[_0x7119('0x1c')](respondWithResult(_0x44c170,null))[_0x7119('0x3a')](handleError(_0x44c170,null));};exports[_0x7119('0x1d')]=function(_0x101631,_0x192205){return db['VoiceMailMessage'][_0x7119('0x3e')]({'where':{'id':_0x101631['params']['id']}})[_0x7119('0x1c')](handleEntityNotFound(_0x192205,null))['then'](removeEntity(_0x192205,null))['catch'](handleError(_0x192205,null));};exports[_0x7119('0x42')]=function(_0x1e798e,_0x4bc3ee,_0x2c5c6a){return db[_0x7119('0x20')][_0x7119('0x3e')]({'where':{'id':_0x1e798e['params']['id']},'attributes':['id',_0x7119('0x43'),_0x7119('0x44')]})[_0x7119('0x1c')](handleEntityNotFound(_0x4bc3ee,null))[_0x7119('0x1c')](function(_0xefd1de){if(_0xefd1de){if(!_0xefd1de[_0x7119('0x43')]){throw new db[(_0x7119('0x45'))][(_0x7119('0x46'))](_0x7119('0x47'));}var _0x356a95={'Content-Type':_0x7119('0x48'),'Content-Disposition':_0x7119('0x49')};if(_0xefd1de['msg_id']){_0x356a95[_0x7119('0x4a')]='attachment;\x20filename=\x22'+_0xefd1de[_0x7119('0x44')]+'.wav\x22';}_0x4bc3ee[_0x7119('0x17')](_0x356a95);return _0x4bc3ee[_0x7119('0x1f')](new Buffer(_0xefd1de[_0x7119('0x43')]));}})['catch'](handleError(_0x4bc3ee,null));}; \ No newline at end of file +var _0x3bd6=['rows','catch','show','params','include','find','create','body','download','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment;\x20filename=\x22','.wav\x22','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','VoiceMailMessage','rawAttributes','model','differenceBy','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','options','includeAll','findAll'];(function(_0x1d53ac,_0x2cabbf){var _0x1da0f1=function(_0x3a10c4){while(--_0x3a10c4){_0x1d53ac['push'](_0x1d53ac['shift']());}};_0x1da0f1(++_0x2cabbf);}(_0x3bd6,0x1a0));var _0x63bd=function(_0x16f7dc,_0x1a85bc){_0x16f7dc=_0x16f7dc-0x0;var _0x2d8d94=_0x3bd6[_0x16f7dc];return _0x2d8d94;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x63bd('0x0'));var moment=require(_0x63bd('0x1'));var BPromise=require(_0x63bd('0x2'));var Mustache=require(_0x63bd('0x3'));var util=require('util');var path=require(_0x63bd('0x4'));var sox=require('sox');var csv=require(_0x63bd('0x5'));var ejs=require(_0x63bd('0x6'));var fs=require('fs');var _=require(_0x63bd('0x7'));var squel=require(_0x63bd('0x8'));var crypto=require(_0x63bd('0x9'));var jsforce=require(_0x63bd('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x63bd('0x5'));var querystring=require(_0x63bd('0xb'));var Papa=require(_0x63bd('0xc'));var qs=require(_0x63bd('0xd'));var logger=require(_0x63bd('0xe'))(_0x63bd('0xf'));var utils=require(_0x63bd('0x10'));var config=require(_0x63bd('0x11'));var db=require(_0x63bd('0x12'))['db'];function respondWithStatusCode(_0x595c5f,_0x3d27b6){_0x3d27b6=_0x3d27b6||0xcc;return function(_0x35f7e0){if(_0x35f7e0){return _0x595c5f['sendStatus'](_0x3d27b6);}return _0x595c5f[_0x63bd('0x13')](_0x3d27b6)[_0x63bd('0x14')]();};}function respondWithResult(_0x5408ad,_0x310e62){_0x310e62=_0x310e62||0xc8;return function(_0x202021){if(_0x202021){return _0x5408ad[_0x63bd('0x13')](_0x310e62)[_0x63bd('0x15')](_0x202021);}};}function respondWithFilteredResult(_0x1a3adb,_0x1542a1){return function(_0x473e54){if(_0x473e54){var _0x181520=_0x473e54[_0x63bd('0x16')],_0x58ceb3=_0x1542a1[_0x63bd('0x17')],_0xec7ec6=_0x1542a1[_0x63bd('0x17')]+_0x1542a1[_0x63bd('0x18')],_0x4d07a3;if(_0xec7ec6>=_0x181520){_0xec7ec6=_0x181520;_0x4d07a3=0xc8;}else{_0x4d07a3=0xce;}_0x1a3adb[_0x63bd('0x13')](_0x4d07a3);return _0x1a3adb[_0x63bd('0x19')](_0x63bd('0x1a'),_0x58ceb3+'-'+_0xec7ec6+'/'+_0x181520)[_0x63bd('0x15')](_0x473e54);}return null;};}function patchUpdates(_0x1bc634){return function(_0x3d3a16){try{jsonpatch[_0x63bd('0x1b')](_0x3d3a16,_0x1bc634,!![]);}catch(_0x19a26d){return BPromise[_0x63bd('0x1c')](_0x19a26d);}return _0x3d3a16[_0x63bd('0x1d')]();};}function saveUpdates(_0x86d83,_0x5da285){return function(_0x2825f8){if(_0x2825f8){return _0x2825f8[_0x63bd('0x1e')](_0x86d83)[_0x63bd('0x1f')](function(_0x2a0cd4){return _0x2a0cd4;});}return null;};}function removeEntity(_0x12b882,_0x420e6d){return function(_0x3fe55d){if(_0x3fe55d){return _0x3fe55d['destroy']()[_0x63bd('0x1f')](function(){_0x12b882[_0x63bd('0x13')](0xcc)[_0x63bd('0x14')]();});}};}function handleEntityNotFound(_0x29fe36,_0x13075e){return function(_0x1ad415){if(!_0x1ad415){_0x29fe36[_0x63bd('0x20')](0x194);}return _0x1ad415;};}function handleError(_0x567ea5,_0x25ca13){_0x25ca13=_0x25ca13||0x1f4;return function(_0x33e531){logger[_0x63bd('0x21')](_0x33e531[_0x63bd('0x22')]);if(_0x33e531[_0x63bd('0x23')]){delete _0x33e531[_0x63bd('0x23')];}_0x567ea5[_0x63bd('0x13')](_0x25ca13)[_0x63bd('0x24')](_0x33e531);};}exports[_0x63bd('0x25')]=function(_0x1a2cf2,_0x4b26ea){var _0x18a07d={},_0x44c705={},_0x18f2ed={'count':0x0,'rows':[]};var _0x4b6a5c=db[_0x63bd('0x26')][_0x63bd('0x27')];_0x44c705[_0x63bd('0x28')]=_[_0x63bd('0x29')](_[_0x63bd('0x2a')](_0x4b6a5c),[_0x63bd('0x23')]);var _0x59a833={'dateStart':_0x1a2cf2[_0x63bd('0x2b')][_0x63bd('0x2c')],'dateEnd':_0x1a2cf2[_0x63bd('0x2b')]['dateEnd']};delete _0x1a2cf2[_0x63bd('0x2b')][_0x63bd('0x2c')];delete _0x1a2cf2[_0x63bd('0x2b')][_0x63bd('0x2d')];_0x44c705[_0x63bd('0x2b')]=_[_0x63bd('0x2a')](_0x1a2cf2['query']);_0x44c705[_0x63bd('0x2e')]=_[_0x63bd('0x2f')](_0x44c705[_0x63bd('0x28')],_0x44c705['query']);_0x18a07d['attributes']=_[_0x63bd('0x2f')](_0x44c705[_0x63bd('0x28')],qs[_0x63bd('0x30')](_0x1a2cf2[_0x63bd('0x2b')][_0x63bd('0x30')]));_0x18a07d['attributes']=_0x18a07d[_0x63bd('0x31')][_0x63bd('0x32')]?_0x18a07d[_0x63bd('0x31')]:_0x44c705[_0x63bd('0x28')];if(!_0x1a2cf2[_0x63bd('0x2b')][_0x63bd('0x33')](_0x63bd('0x34'))){_0x18a07d[_0x63bd('0x18')]=qs[_0x63bd('0x18')](_0x1a2cf2['query']['limit']);_0x18a07d[_0x63bd('0x17')]=qs[_0x63bd('0x17')](_0x1a2cf2[_0x63bd('0x2b')]['offset']);}_0x18a07d[_0x63bd('0x35')]=qs[_0x63bd('0x36')](_0x1a2cf2[_0x63bd('0x2b')][_0x63bd('0x36')]);_0x18a07d[_0x63bd('0x37')]=qs['filters'](_[_0x63bd('0x38')](_0x1a2cf2[_0x63bd('0x2b')],_0x44c705[_0x63bd('0x2e')]));if(_0x59a833['dateStart']){if(_0x59a833['dateEnd']){_0x59a833[_0x63bd('0x2d')]=moment(_0x59a833[_0x63bd('0x2d')])[_0x63bd('0x39')](0x1,_0x63bd('0x3a'));}else{_0x59a833['dateEnd']=moment(_0x59a833[_0x63bd('0x2c')])[_0x63bd('0x39')](0x1,'day');}_[_0x63bd('0x3b')](_0x18a07d['where'],{'createdAt':{'$gte':_0x59a833[_0x63bd('0x2c')],'$lte':_0x59a833[_0x63bd('0x2d')]}});}if(_0x1a2cf2[_0x63bd('0x2b')][_0x63bd('0x3c')]){_0x18a07d[_0x63bd('0x37')]=_[_0x63bd('0x3b')](_0x18a07d[_0x63bd('0x37')],{'$or':_['map'](_0x18a07d[_0x63bd('0x31')],function(_0x1b1704){var _0x50dfca={};_0x50dfca[_0x1b1704]={'$like':'%'+_0x1a2cf2[_0x63bd('0x2b')][_0x63bd('0x3c')]+'%'};return _0x50dfca;})});}_0x18a07d=_[_0x63bd('0x3b')]({},_0x18a07d,_0x1a2cf2[_0x63bd('0x3d')]);var _0x4dcb83={'where':_0x18a07d[_0x63bd('0x37')]};return db[_0x63bd('0x26')][_0x63bd('0x16')](_0x4dcb83)['then'](function(_0x518681){_0x18f2ed[_0x63bd('0x16')]=_0x518681;if(_0x1a2cf2[_0x63bd('0x2b')][_0x63bd('0x3e')]){_0x18a07d['include']=[{'all':!![]}];}return db[_0x63bd('0x26')][_0x63bd('0x3f')](_0x18a07d);})[_0x63bd('0x1f')](function(_0x111084){_0x18f2ed[_0x63bd('0x40')]=_0x111084;return _0x18f2ed;})[_0x63bd('0x1f')](respondWithFilteredResult(_0x4b26ea,_0x18a07d))[_0x63bd('0x41')](handleError(_0x4b26ea,null));};exports[_0x63bd('0x42')]=function(_0x203083,_0x2ed1dc){var _0x4dc22a={'raw':!![],'where':{'id':_0x203083[_0x63bd('0x43')]['id']}},_0x2cbc9b={};_0x2cbc9b['model']=_[_0x63bd('0x2a')](db[_0x63bd('0x26')][_0x63bd('0x27')]);_0x2cbc9b[_0x63bd('0x2b')]=_[_0x63bd('0x2a')](_0x203083[_0x63bd('0x2b')]);_0x2cbc9b[_0x63bd('0x2e')]=_[_0x63bd('0x2f')](_0x2cbc9b[_0x63bd('0x28')],_0x2cbc9b['query']);_0x4dc22a[_0x63bd('0x31')]=_[_0x63bd('0x2f')](_0x2cbc9b['model'],qs[_0x63bd('0x30')](_0x203083[_0x63bd('0x2b')][_0x63bd('0x30')]));_0x4dc22a['attributes']=_0x4dc22a[_0x63bd('0x31')]['length']?_0x4dc22a[_0x63bd('0x31')]:_0x2cbc9b[_0x63bd('0x28')];if(_0x203083[_0x63bd('0x2b')][_0x63bd('0x3e')]){_0x4dc22a[_0x63bd('0x44')]=[{'all':!![]}];}_0x4dc22a=_[_0x63bd('0x3b')]({},_0x4dc22a,_0x203083[_0x63bd('0x3d')]);return db[_0x63bd('0x26')][_0x63bd('0x45')](_0x4dc22a)[_0x63bd('0x1f')](handleEntityNotFound(_0x2ed1dc,null))[_0x63bd('0x1f')](respondWithResult(_0x2ed1dc,null))[_0x63bd('0x41')](handleError(_0x2ed1dc,null));};exports[_0x63bd('0x46')]=function(_0x3752c5,_0x14cb4e){return db[_0x63bd('0x26')][_0x63bd('0x46')](_0x3752c5[_0x63bd('0x47')],{})['then'](respondWithResult(_0x14cb4e,0xc9))['catch'](handleError(_0x14cb4e,null));};exports[_0x63bd('0x1e')]=function(_0x5ef41e,_0x6da873){if(_0x5ef41e['body']['id']){delete _0x5ef41e[_0x63bd('0x47')]['id'];}return db[_0x63bd('0x26')][_0x63bd('0x45')]({'where':{'id':_0x5ef41e['params']['id']}})[_0x63bd('0x1f')](handleEntityNotFound(_0x6da873,null))['then'](saveUpdates(_0x5ef41e[_0x63bd('0x47')],null))['then'](respondWithResult(_0x6da873,null))[_0x63bd('0x41')](handleError(_0x6da873,null));};exports['destroy']=function(_0x1842ef,_0x5498f9){return db['VoiceMailMessage']['find']({'where':{'id':_0x1842ef[_0x63bd('0x43')]['id']}})[_0x63bd('0x1f')](handleEntityNotFound(_0x5498f9,null))[_0x63bd('0x1f')](removeEntity(_0x5498f9,null))['catch'](handleError(_0x5498f9,null));};exports[_0x63bd('0x48')]=function(_0x163dd6,_0x27849f,_0x57ddfd){return db[_0x63bd('0x26')][_0x63bd('0x45')]({'where':{'id':_0x163dd6[_0x63bd('0x43')]['id']},'attributes':['id',_0x63bd('0x49'),_0x63bd('0x4a')]})[_0x63bd('0x1f')](handleEntityNotFound(_0x27849f,null))[_0x63bd('0x1f')](function(_0x56819f){if(_0x56819f){if(!_0x56819f[_0x63bd('0x49')]){throw new db['Sequelize'][(_0x63bd('0x4b'))](_0x63bd('0x4c'));}var _0x431213={'Content-Type':_0x63bd('0x4d'),'Content-Disposition':'attachment'};if(_0x56819f['msg_id']){_0x431213['Content-Disposition']=_0x63bd('0x4e')+_0x56819f[_0x63bd('0x4a')]+_0x63bd('0x4f');}_0x27849f[_0x63bd('0x19')](_0x431213);return _0x27849f[_0x63bd('0x24')](new Buffer(_0x56819f[_0x63bd('0x49')]));}})[_0x63bd('0x41')](handleError(_0x27849f,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 7e824b0..c585e79 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 _0x16ae=['voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','./voiceMailMessage.attributes'];(function(_0x2217ac,_0x230bb7){var _0x427dd8=function(_0xeb661b){while(--_0xeb661b){_0x2217ac['push'](_0x2217ac['shift']());}};_0x427dd8(++_0x230bb7);}(_0x16ae,0x1aa));var _0xe16a=function(_0x53267c,_0x45d9fe){_0x53267c=_0x53267c-0x0;var _0x2ef4d2=_0x16ae[_0x53267c];return _0x2ef4d2;};'use strict';var _=require(_0xe16a('0x0'));var util=require(_0xe16a('0x1'));var logger=require(_0xe16a('0x2'))(_0xe16a('0x3'));var moment=require(_0xe16a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xe16a('0x5'));module['exports']=function(_0x5adf50,_0x256b99){return _0x5adf50['define']('VoiceMailMessage',attributes,{'tableName':_0xe16a('0x6'),'paranoid':![],'indexes':[{'name':_0xe16a('0x7'),'fields':[_0xe16a('0x7')]}],'timestamps':![]});}; \ No newline at end of file +var _0xb4cd=['dir','lodash','util','../../config/logger','api','bluebird','request-promise','./voiceMailMessage.attributes','exports','define','VoiceMailMessage'];(function(_0x254d25,_0x43e209){var _0x539e60=function(_0xfc6805){while(--_0xfc6805){_0x254d25['push'](_0x254d25['shift']());}};_0x539e60(++_0x43e209);}(_0xb4cd,0x85));var _0xdb4c=function(_0x35138f,_0x3bcde7){_0x35138f=_0x35138f-0x0;var _0x35d860=_0xb4cd[_0x35138f];return _0x35d860;};'use strict';var _=require(_0xdb4c('0x0'));var util=require(_0xdb4c('0x1'));var logger=require(_0xdb4c('0x2'))(_0xdb4c('0x3'));var moment=require('moment');var BPromise=require(_0xdb4c('0x4'));var rp=require(_0xdb4c('0x5'));var attributes=require(_0xdb4c('0x6'));module[_0xdb4c('0x7')]=function(_0x828b71,_0x2151b3){return _0x828b71[_0xdb4c('0x8')](_0xdb4c('0x9'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':[_0xdb4c('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 0c5ff6d..f9b8833 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 _0x4179=['../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0x4179,0x19f));var _0x9417=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x4179[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0x9417('0x0'));var util=require(_0x9417('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9417('0x2'));var fs=require('fs');var db=require(_0x9417('0x3'))['db'];var utils=require(_0x9417('0x4'));var logger=require(_0x9417('0x5'))(_0x9417('0x6'));var config=require(_0x9417('0x7'));var jayson=require(_0x9417('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51e48d,_0x130535,_0x2c723c){return new BPromise(function(_0x260af6,_0xa303b1){return client[_0x9417('0x9')](_0x51e48d,_0x2c723c)[_0x9417('0xa')](function(_0x419081){logger[_0x9417('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x130535,_0x9417('0xc'));logger[_0x9417('0xd')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x130535,_0x9417('0xc'),JSON[_0x9417('0xe')](_0x419081));if(_0x419081[_0x9417('0xf')]){if(_0x419081['error']['code']===0x1f4){logger[_0x9417('0xf')](_0x9417('0x10'),_0x130535,_0x419081[_0x9417('0xf')][_0x9417('0x11')]);return _0xa303b1(_0x419081['error'][_0x9417('0x11')]);}logger[_0x9417('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x130535,_0x419081[_0x9417('0xf')][_0x9417('0x11')]);return _0x260af6(_0x419081[_0x9417('0xf')]['message']);}else{logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x130535,_0x9417('0xc'));_0x260af6(_0x419081[_0x9417('0x12')][_0x9417('0x11')]);}})[_0x9417('0x13')](function(_0x446d13){logger[_0x9417('0xf')](_0x9417('0x10'),_0x130535,_0x446d13);_0xa303b1(_0x446d13);});});} \ No newline at end of file +var _0x0c7b=['request\x20sent','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s'];(function(_0x1484f6,_0x29ac01){var _0x5a7ee1=function(_0x41e1e2){while(--_0x41e1e2){_0x1484f6['push'](_0x1484f6['shift']());}};_0x5a7ee1(++_0x29ac01);}(_0x0c7b,0xf5));var _0xb0c7=function(_0x4eb763,_0x11668f){_0x4eb763=_0x4eb763-0x0;var _0x4919ec=_0x0c7b[_0x4eb763];return _0x4919ec;};'use strict';var _=require('lodash');var util=require(_0xb0c7('0x0'));var moment=require(_0xb0c7('0x1'));var BPromise=require(_0xb0c7('0x2'));var rs=require(_0xb0c7('0x3'));var fs=require('fs');var db=require(_0xb0c7('0x4'))['db'];var utils=require(_0xb0c7('0x5'));var logger=require(_0xb0c7('0x6'))(_0xb0c7('0x7'));var config=require(_0xb0c7('0x8'));var jayson=require(_0xb0c7('0x9'));var client=jayson['client'][_0xb0c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x63f742,_0x47ff33,_0x3b8a85){return new BPromise(function(_0x4ddc66,_0x3b71e0){return client[_0xb0c7('0xb')](_0x63f742,_0x3b8a85)[_0xb0c7('0xc')](function(_0x1f2566){logger[_0xb0c7('0xd')](_0xb0c7('0xe'),_0x47ff33,_0xb0c7('0xf'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x47ff33,_0xb0c7('0xf'),JSON['stringify'](_0x1f2566));if(_0x1f2566[_0xb0c7('0x10')]){if(_0x1f2566[_0xb0c7('0x10')][_0xb0c7('0x11')]===0x1f4){logger[_0xb0c7('0x10')](_0xb0c7('0xe'),_0x47ff33,_0x1f2566[_0xb0c7('0x10')]['message']);return _0x3b71e0(_0x1f2566[_0xb0c7('0x10')][_0xb0c7('0x12')]);}logger[_0xb0c7('0x10')](_0xb0c7('0xe'),_0x47ff33,_0x1f2566[_0xb0c7('0x10')]['message']);return _0x4ddc66(_0x1f2566[_0xb0c7('0x10')][_0xb0c7('0x12')]);}else{logger[_0xb0c7('0xd')](_0xb0c7('0xe'),_0x47ff33,_0xb0c7('0xf'));_0x4ddc66(_0x1f2566['result'][_0xb0c7('0x12')]);}})[_0xb0c7('0x13')](function(_0x4b371e){logger['error'](_0xb0c7('0xe'),_0x47ff33,_0x4b371e);_0x3b71e0(_0x4b371e);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index a1d854c..2bc725d 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 _0xcd0d=['post','create','/:id','delete','/:id/sounds/:id2','removeSound','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','get','show','/:id/sounds','getSounds'];(function(_0x49e52e,_0x15f616){var _0x36a6e6=function(_0x2f7be2){while(--_0x2f7be2){_0x49e52e['push'](_0x49e52e['shift']());}};_0x36a6e6(++_0x15f616);}(_0xcd0d,0x193));var _0xdcd0=function(_0x47fd45,_0x40dd67){_0x47fd45=_0x47fd45-0x0;var _0x363313=_0xcd0d[_0x47fd45];return _0x363313;};'use strict';var multer=require(_0xdcd0('0x0'));var util=require(_0xdcd0('0x1'));var path=require(_0xdcd0('0x2'));var express=require(_0xdcd0('0x3'));var router=express[_0xdcd0('0x4')]();var auth=require(_0xdcd0('0x5'));var interaction=require(_0xdcd0('0x6'));var config=require(_0xdcd0('0x7'));var controller=require(_0xdcd0('0x8'));router['get']('/',auth[_0xdcd0('0x9')](),controller[_0xdcd0('0xa')]);router[_0xdcd0('0xb')]('/:id',auth[_0xdcd0('0x9')](),controller[_0xdcd0('0xc')]);router[_0xdcd0('0xb')](_0xdcd0('0xd'),auth[_0xdcd0('0x9')](),controller[_0xdcd0('0xe')]);router[_0xdcd0('0xf')]('/',auth[_0xdcd0('0x9')](),controller[_0xdcd0('0x10')]);router[_0xdcd0('0xf')](_0xdcd0('0xd'),auth[_0xdcd0('0x9')](),controller['addSound']);router['put'](_0xdcd0('0x11'),auth[_0xdcd0('0x9')](),controller['update']);router[_0xdcd0('0x12')](_0xdcd0('0x11'),auth[_0xdcd0('0x9')](),controller['destroy']);router[_0xdcd0('0x12')](_0xdcd0('0x13'),auth[_0xdcd0('0x9')](),controller[_0xdcd0('0x14')]);module[_0xdcd0('0x15')]=router; \ No newline at end of file +var _0x4090=['getSounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','exports','path','express','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','/:id/sounds'];(function(_0xdd4642,_0x597ef9){var _0x2f511e=function(_0x171e70){while(--_0x171e70){_0xdd4642['push'](_0xdd4642['shift']());}};_0x2f511e(++_0x597ef9);}(_0x4090,0x82));var _0x0409=function(_0x1de287,_0x402646){_0x1de287=_0x1de287-0x0;var _0x227560=_0x4090[_0x1de287];return _0x227560;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0409('0x0'));var express=require(_0x0409('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0409('0x2'));var config=require(_0x0409('0x3'));var controller=require(_0x0409('0x4'));router[_0x0409('0x5')]('/',auth[_0x0409('0x6')](),controller[_0x0409('0x7')]);router['get']('/:id',auth[_0x0409('0x6')](),controller[_0x0409('0x8')]);router[_0x0409('0x5')](_0x0409('0x9'),auth['isAuthenticated'](),controller[_0x0409('0xa')]);router[_0x0409('0xb')]('/',auth[_0x0409('0x6')](),controller[_0x0409('0xc')]);router[_0x0409('0xb')](_0x0409('0x9'),auth[_0x0409('0x6')](),controller[_0x0409('0xd')]);router[_0x0409('0xe')]('/:id',auth[_0x0409('0x6')](),controller[_0x0409('0xf')]);router[_0x0409('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x0409('0x11')]);router['delete'](_0x0409('0x12'),auth[_0x0409('0x6')](),controller['removeSound']);module[_0x0409('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index c38b745..cb073d2 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 _0xdee4=['name','ENUM','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','sequelize','STRING'];(function(_0xd6ddab,_0x3f700e){var _0x81549e=function(_0x405c71){while(--_0x405c71){_0xd6ddab['push'](_0xd6ddab['shift']());}};_0x81549e(++_0x3f700e);}(_0xdee4,0x195));var _0x4dee=function(_0x120c03,_0x1a8eab){_0x120c03=_0x120c03-0x0;var _0x2f04a8=_0xdee4[_0x120c03];return _0x2f04a8;};'use strict';var Sequelize=require(_0x4dee('0x0'));module['exports']={'name':{'type':Sequelize[_0x4dee('0x1')],'allowNull':![],'unique':_0x4dee('0x2')},'mode':{'type':Sequelize[_0x4dee('0x3')]('custom',_0x4dee('0x4'),_0x4dee('0x5'),_0x4dee('0x6'),_0x4dee('0x7'),_0x4dee('0x8')),'allowNull':!![],'defaultValue':_0x4dee('0x4')},'directory':{'type':Sequelize[_0x4dee('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x4dee('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x4dee('0x9')},'format':{'type':Sequelize[_0x4dee('0x1')],'allowNull':!![]},'stamp':{'type':_0x4dee('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb93f=['STRING','TIMESTAMP','sequelize','exports','name','ENUM','custom','files','mp3nb','quietmp3nb'];(function(_0x58cb91,_0x5269bb){var _0x41c2ae=function(_0x163721){while(--_0x163721){_0x58cb91['push'](_0x58cb91['shift']());}};_0x41c2ae(++_0x5269bb);}(_0xb93f,0x17e));var _0xfb93=function(_0x71cd05,_0x36ac11){_0x71cd05=_0x71cd05-0x0;var _0x59c9e7=_0xb93f[_0x71cd05];return _0x59c9e7;};'use strict';var Sequelize=require(_0xfb93('0x0'));module[_0xfb93('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfb93('0x2')},'mode':{'type':Sequelize[_0xfb93('0x3')](_0xfb93('0x4'),_0xfb93('0x5'),_0xfb93('0x6'),_0xfb93('0x7'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':_0xfb93('0x5')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xfb93('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0xfb93('0x8')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xfb93('0x8')],'allowNull':!![]},'stamp':{'type':_0xfb93('0x9')},'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 5083c06..b849634 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 _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(_0x23814e,_0x3946c9){var _0x46f65e=function(_0x117c98){while(--_0x117c98){_0x23814e['push'](_0x23814e['shift']());}};_0x46f65e(++_0x3946c9);}(_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'];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 +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(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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 diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index f913d2b..928af5b 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 _0x89cf=['api','moment','bluebird','request-promise','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger'];(function(_0x10764d,_0x1a6575){var _0x11f971=function(_0x63bc73){while(--_0x63bc73){_0x10764d['push'](_0x10764d['shift']());}};_0x11f971(++_0x1a6575);}(_0x89cf,0x13c));var _0xf89c=function(_0x47b3a4,_0xe1f5b9){_0x47b3a4=_0x47b3a4-0x0;var _0x308108=_0x89cf[_0x47b3a4];return _0x308108;};'use strict';var _=require(_0xf89c('0x0'));var util=require(_0xf89c('0x1'));var logger=require(_0xf89c('0x2'))(_0xf89c('0x3'));var moment=require(_0xf89c('0x4'));var BPromise=require(_0xf89c('0x5'));var rp=require(_0xf89c('0x6'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xf89c('0x7')]=function(_0x5dff40,_0x3998c3){return _0x5dff40[_0xf89c('0x8')](_0xf89c('0x9'),attributes,{'tableName':_0xf89c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf28d=['request-promise','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x32b30c,_0x2d5ec8){var _0xcfc212=function(_0x42e668){while(--_0x42e668){_0x32b30c['push'](_0x32b30c['shift']());}};_0xcfc212(++_0x2d5ec8);}(_0xf28d,0x68));var _0xdf28=function(_0x13d830,_0x57004b){_0x13d830=_0x13d830-0x0;var _0x421996=_0xf28d[_0x13d830];return _0x421996;};'use strict';var _=require(_0xdf28('0x0'));var util=require(_0xdf28('0x1'));var logger=require(_0xdf28('0x2'))(_0xdf28('0x3'));var moment=require(_0xdf28('0x4'));var BPromise=require(_0xdf28('0x5'));var rp=require(_0xdf28('0x6'));var attributes=require(_0xdf28('0x7'));module[_0xdf28('0x8')]=function(_0x21f33c,_0x321a9d){return _0x21f33c['define'](_0xdf28('0x9'),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 31ced64..2e0650b 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 _0x617c=['rpc','jayson/promise','client','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x169639,_0x146136){var _0x277351=function(_0x5e8e2a){while(--_0x5e8e2a){_0x169639['push'](_0x169639['shift']());}};_0x277351(++_0x146136);}(_0x617c,0x164));var _0xc617=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0x617c[_0x4ed4d2];return _0x15ae2e;};'use strict';var _=require(_0xc617('0x0'));var util=require('util');var moment=require(_0xc617('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0xc617('0x2'))['db'];var utils=require(_0xc617('0x3'));var logger=require(_0xc617('0x4'))(_0xc617('0x5'));var config=require('../../config/environment');var jayson=require(_0xc617('0x6'));var client=jayson[_0xc617('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd6a50b,_0x48c57a,_0x3d7896){return new BPromise(function(_0x4c1e91,_0x44d928){return client['request'](_0xd6a50b,_0x3d7896)[_0xc617('0x8')](function(_0x54a089){logger[_0xc617('0x9')](_0xc617('0xa'),_0x48c57a,_0xc617('0xb'));logger[_0xc617('0xc')](_0xc617('0xd'),_0x48c57a,_0xc617('0xb'),JSON[_0xc617('0xe')](_0x54a089));if(_0x54a089[_0xc617('0xf')]){if(_0x54a089[_0xc617('0xf')][_0xc617('0x10')]===0x1f4){logger[_0xc617('0xf')](_0xc617('0xa'),_0x48c57a,_0x54a089[_0xc617('0xf')][_0xc617('0x11')]);return _0x44d928(_0x54a089[_0xc617('0xf')]['message']);}logger[_0xc617('0xf')](_0xc617('0xa'),_0x48c57a,_0x54a089[_0xc617('0xf')][_0xc617('0x11')]);return _0x4c1e91(_0x54a089[_0xc617('0xf')][_0xc617('0x11')]);}else{logger[_0xc617('0x9')](_0xc617('0xa'),_0x48c57a,_0xc617('0xb'));_0x4c1e91(_0x54a089['result'][_0xc617('0x11')]);}})[_0xc617('0x12')](function(_0x5abb62){logger['error'](_0xc617('0xa'),_0x48c57a,_0x5abb62);_0x44d928(_0x5abb62);});});} \ No newline at end of file +var _0x469c=['bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','VoiceMusicOnHold,\x20%s,\x20%s','message','lodash','util','moment'];(function(_0x2bea6a,_0x250e55){var _0x2d80b4=function(_0xe38e0d){while(--_0xe38e0d){_0x2bea6a['push'](_0x2bea6a['shift']());}};_0x2d80b4(++_0x250e55);}(_0x469c,0x1ad));var _0xc469=function(_0x4066c2,_0xad48e8){_0x4066c2=_0x4066c2-0x0;var _0x3870a0=_0x469c[_0x4066c2];return _0x3870a0;};'use strict';var _=require(_0xc469('0x0'));var util=require(_0xc469('0x1'));var moment=require(_0xc469('0x2'));var BPromise=require(_0xc469('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xc469('0x4'))['db'];var utils=require(_0xc469('0x5'));var logger=require('../../config/logger')(_0xc469('0x6'));var config=require(_0xc469('0x7'));var jayson=require(_0xc469('0x8'));var client=jayson[_0xc469('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c2b22,_0x3dcfe1,_0x4b0d7c){return new BPromise(function(_0x317d96,_0x1dc799){return client['request'](_0x2c2b22,_0x4b0d7c)['then'](function(_0x89a247){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x3dcfe1,'request\x20sent');logger[_0xc469('0xa')](_0xc469('0xb'),_0x3dcfe1,'request\x20sent',JSON[_0xc469('0xc')](_0x89a247));if(_0x89a247[_0xc469('0xd')]){if(_0x89a247[_0xc469('0xd')]['code']===0x1f4){logger[_0xc469('0xd')](_0xc469('0xe'),_0x3dcfe1,_0x89a247[_0xc469('0xd')]['message']);return _0x1dc799(_0x89a247[_0xc469('0xd')][_0xc469('0xf')]);}logger['error'](_0xc469('0xe'),_0x3dcfe1,_0x89a247[_0xc469('0xd')][_0xc469('0xf')]);return _0x317d96(_0x89a247[_0xc469('0xd')][_0xc469('0xf')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x3dcfe1,'request\x20sent');_0x317d96(_0x89a247['result'][_0xc469('0xf')]);}})['catch'](function(_0x2a1dc1){logger['error'](_0xc469('0xe'),_0x3dcfe1,_0x2a1dc1);_0x1dc799(_0x2a1dc1);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 10dee79..ef5264d 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 _0x8025=['/:id/users','getAgents','create','post','addAgents','put','update','delete','destroy','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0xb5c596,_0x418482){var _0xbfb7b9=function(_0x53d143){while(--_0x53d143){_0xb5c596['push'](_0xb5c596['shift']());}};_0xbfb7b9(++_0x418482);}(_0x8025,0xd3));var _0x5802=function(_0x214890,_0x2562c0){_0x214890=_0x214890-0x0;var _0x760050=_0x8025[_0x214890];return _0x760050;};'use strict';var multer=require(_0x5802('0x0'));var util=require('util');var path=require(_0x5802('0x1'));var express=require(_0x5802('0x2'));var router=express[_0x5802('0x3')]();var auth=require(_0x5802('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5802('0x5'));var controller=require(_0x5802('0x6'));router[_0x5802('0x7')]('/',auth[_0x5802('0x8')](),controller[_0x5802('0x9')]);router[_0x5802('0x7')](_0x5802('0xa'),auth[_0x5802('0x8')](),controller[_0x5802('0xb')]);router[_0x5802('0x7')](_0x5802('0xc'),auth[_0x5802('0x8')](),controller[_0x5802('0xd')]);router['get'](_0x5802('0xe'),auth['isAuthenticated'](),controller[_0x5802('0xf')]);router['post']('/',auth[_0x5802('0x8')](),controller[_0x5802('0x10')]);router[_0x5802('0x11')]('/:id/users',auth[_0x5802('0x8')](),controller[_0x5802('0x12')]);router[_0x5802('0x13')](_0x5802('0xc'),auth[_0x5802('0x8')](),controller[_0x5802('0x14')]);router[_0x5802('0x15')](_0x5802('0xc'),auth['isAuthenticated'](),controller[_0x5802('0x16')]);router['delete'](_0x5802('0xe'),auth['isAuthenticated'](),controller[_0x5802('0x17')]);module[_0x5802('0x18')]=router; \ No newline at end of file +var _0x2c1b=['addAgents','update','delete','destroy','/:id/users','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','getAgents','post','create'];(function(_0x3c9770,_0x1d1e0d){var _0x29bf9e=function(_0x4e4065){while(--_0x4e4065){_0x3c9770['push'](_0x3c9770['shift']());}};_0x29bf9e(++_0x1d1e0d);}(_0x2c1b,0xcf));var _0xb2c1=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0x2c1b[_0x67f95e];return _0x538f5a;};'use strict';var multer=require(_0xb2c1('0x0'));var util=require(_0xb2c1('0x1'));var path=require(_0xb2c1('0x2'));var express=require(_0xb2c1('0x3'));var router=express[_0xb2c1('0x4')]();var auth=require(_0xb2c1('0x5'));var interaction=require(_0xb2c1('0x6'));var config=require(_0xb2c1('0x7'));var controller=require(_0xb2c1('0x8'));router[_0xb2c1('0x9')]('/',auth[_0xb2c1('0xa')](),controller[_0xb2c1('0xb')]);router[_0xb2c1('0x9')](_0xb2c1('0xc'),auth[_0xb2c1('0xa')](),controller[_0xb2c1('0xd')]);router[_0xb2c1('0x9')](_0xb2c1('0xe'),auth[_0xb2c1('0xa')](),controller['show']);router[_0xb2c1('0x9')]('/:id/users',auth[_0xb2c1('0xa')](),controller[_0xb2c1('0xf')]);router[_0xb2c1('0x10')]('/',auth['isAuthenticated'](),controller[_0xb2c1('0x11')]);router[_0xb2c1('0x10')]('/:id/users',auth[_0xb2c1('0xa')](),controller[_0xb2c1('0x12')]);router['put'](_0xb2c1('0xe'),auth['isAuthenticated'](),controller[_0xb2c1('0x13')]);router[_0xb2c1('0x14')](_0xb2c1('0xe'),auth[_0xb2c1('0xa')](),controller[_0xb2c1('0x15')]);router[_0xb2c1('0x14')](_0xb2c1('0x16'),auth[_0xb2c1('0xa')](),controller[_0xb2c1('0x17')]);module[_0xb2c1('0x18')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 0dbdedd..433a8d6 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 _0xd67a=['getDataValue','INTEGER','sequelize','exports','STRING','name','VIRTUAL','system-'];(function(_0x5e0f7b,_0x4ea2b6){var _0x409287=function(_0x1d648e){while(--_0x1d648e){_0x5e0f7b['push'](_0x5e0f7b['shift']());}};_0x409287(++_0x4ea2b6);}(_0xd67a,0x122));var _0xad67=function(_0x1d9d76,_0x43c1fa){_0x1d9d76=_0x1d9d76-0x0;var _0xbdd00c=_0xd67a[_0x1d9d76];return _0xbdd00c;};'use strict';var Sequelize=require(_0xad67('0x0'));module[_0xad67('0x1')]={'name':{'type':Sequelize[_0xad67('0x2')],'allowNull':![],'unique':_0xad67('0x3')},'prefix':{'type':Sequelize[_0xad67('0x4')],'get':function(_0x138a1d){return _0xad67('0x5')+this[_0xad67('0x6')](_0xad67('0x3'))+'-';}},'description':{'type':Sequelize[_0xad67('0x2')]},'callerIdAll':{'type':Sequelize[_0xad67('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xad67('0x7')]}}; \ No newline at end of file +var _0xa9d3=['exports','name','system-','getDataValue','STRING','INTEGER','sequelize'];(function(_0x146f3a,_0x373e03){var _0x4ebd8a=function(_0x2b4ea9){while(--_0x2b4ea9){_0x146f3a['push'](_0x146f3a['shift']());}};_0x4ebd8a(++_0x373e03);}(_0xa9d3,0xed));var _0x3a9d=function(_0x15926d,_0x44d6c3){_0x15926d=_0x15926d-0x0;var _0x184234=_0xa9d3[_0x15926d];return _0x184234;};'use strict';var Sequelize=require(_0x3a9d('0x0'));module[_0x3a9d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3a9d('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x588c2a){return _0x3a9d('0x3')+this[_0x3a9d('0x4')](_0x3a9d('0x2'))+'-';}},'description':{'type':Sequelize[_0x3a9d('0x5')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x3a9d('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 915ffec..949bdc2 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 _0xf81a=['VoicePrefixId','get','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','name','charAt','body','sequelize','findById','addAgents','ids','omit','spread','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','User','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','socket.io-emitter','localhost','./voicePrefix.socket','register','sendStatus','end','json','offset','limit','set','Content-Range','apply','reject','update','then','status','error','stack','send','index','VoicePrefix','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','add','day','merge','filter','map','count','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','destroy','describe','create','transaction','VoiceExtension','VoiceExtensionId','context','from-sip','exten','app','type','system','description','priority','prefix','NoOp','Voice\x20Prefix'];(function(_0x11c7eb,_0x2e2415){var _0xea9298=function(_0x408bdd){while(--_0x408bdd){_0x11c7eb['push'](_0x11c7eb['shift']());}};_0xea9298(++_0x2e2415);}(_0xf81a,0x16b));var _0xaf81=function(_0x2beb05,_0x258f9f){_0x2beb05=_0x2beb05-0x0;var _0x10e993=_0xf81a[_0x2beb05];return _0x10e993;};'use strict';var jsonpatch=require(_0xaf81('0x0'));var rp=require(_0xaf81('0x1'));var moment=require(_0xaf81('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xaf81('0x3'));var util=require(_0xaf81('0x4'));var path=require(_0xaf81('0x5'));var sox=require('sox');var csv=require(_0xaf81('0x6'));var ejs=require(_0xaf81('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xaf81('0x8'));var crypto=require(_0xaf81('0x9'));var jsforce=require(_0xaf81('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xaf81('0x6'));var querystring=require(_0xaf81('0xb'));var Papa=require('papaparse');var qs=require(_0xaf81('0xc'));var logger=require(_0xaf81('0xd'))(_0xaf81('0xe'));var utils=require(_0xaf81('0xf'));var config=require('../../config/environment');var db=require(_0xaf81('0x10'))['db'];var socket=require(_0xaf81('0x11'))({'host':_0xaf81('0x12'),'port':0x18eb});require(_0xaf81('0x13'))[_0xaf81('0x14')](socket);function respondWithStatusCode(_0x678209,_0x4a1e29){_0x4a1e29=_0x4a1e29||0xcc;return function(_0x57ba9c){if(_0x57ba9c){return _0x678209[_0xaf81('0x15')](_0x4a1e29);}return _0x678209['status'](_0x4a1e29)[_0xaf81('0x16')]();};}function respondWithResult(_0x327517,_0x2b62dd){_0x2b62dd=_0x2b62dd||0xc8;return function(_0x3f6fbd){if(_0x3f6fbd){return _0x327517['status'](_0x2b62dd)[_0xaf81('0x17')](_0x3f6fbd);}};}function respondWithFilteredResult(_0x10974a,_0x120016){return function(_0x3f588c){if(_0x3f588c){var _0x3cdeda=_0x3f588c['count'],_0x569747=_0x120016[_0xaf81('0x18')],_0x201ae4=_0x120016[_0xaf81('0x18')]+_0x120016[_0xaf81('0x19')],_0x317077;if(_0x201ae4>=_0x3cdeda){_0x201ae4=_0x3cdeda;_0x317077=0xc8;}else{_0x317077=0xce;}_0x10974a['status'](_0x317077);return _0x10974a[_0xaf81('0x1a')](_0xaf81('0x1b'),_0x569747+'-'+_0x201ae4+'/'+_0x3cdeda)[_0xaf81('0x17')](_0x3f588c);}return null;};}function patchUpdates(_0xd1430d){return function(_0x1f252f){try{jsonpatch[_0xaf81('0x1c')](_0x1f252f,_0xd1430d,!![]);}catch(_0xdcc2b4){return BPromise[_0xaf81('0x1d')](_0xdcc2b4);}return _0x1f252f['save']();};}function saveUpdates(_0x1416c9,_0x5c9e27){return function(_0x25aebc){if(_0x25aebc){return _0x25aebc[_0xaf81('0x1e')](_0x1416c9)[_0xaf81('0x1f')](function(_0x1f004d){return _0x1f004d;});}return null;};}function removeEntity(_0x274ced,_0x5a543e){return function(_0x5e353e){if(_0x5e353e){return _0x5e353e['destroy']()[_0xaf81('0x1f')](function(){_0x274ced[_0xaf81('0x20')](0xcc)[_0xaf81('0x16')]();});}};}function handleEntityNotFound(_0x11439d,_0x15363d){return function(_0x9cbb14){if(!_0x9cbb14){_0x11439d[_0xaf81('0x15')](0x194);}return _0x9cbb14;};}function handleError(_0x146bf0,_0x1a8dfb){_0x1a8dfb=_0x1a8dfb||0x1f4;return function(_0x59f2fe){logger[_0xaf81('0x21')](_0x59f2fe[_0xaf81('0x22')]);if(_0x59f2fe['name']){delete _0x59f2fe['name'];}_0x146bf0['status'](_0x1a8dfb)[_0xaf81('0x23')](_0x59f2fe);};}exports[_0xaf81('0x24')]=function(_0x22099d,_0x3edffb){var _0x31cb17={},_0x28f593={},_0x2767c4={'count':0x0,'rows':[]};var _0x1d1d4a=db[_0xaf81('0x25')]['rawAttributes'];_0x28f593[_0xaf81('0x26')]=_[_0xaf81('0x27')](_0x1d1d4a);var _0xd85377={'dateStart':_0x22099d['query'][_0xaf81('0x28')],'dateEnd':_0x22099d[_0xaf81('0x29')][_0xaf81('0x2a')]};delete _0x22099d[_0xaf81('0x29')][_0xaf81('0x28')];delete _0x22099d['query'][_0xaf81('0x2a')];_0x28f593[_0xaf81('0x29')]=_[_0xaf81('0x27')](_0x22099d[_0xaf81('0x29')]);_0x28f593[_0xaf81('0x2b')]=_[_0xaf81('0x2c')](_0x28f593[_0xaf81('0x26')],_0x28f593[_0xaf81('0x29')]);_0x31cb17[_0xaf81('0x2d')]=_[_0xaf81('0x2c')](_0x28f593['model'],qs[_0xaf81('0x2e')](_0x22099d['query'][_0xaf81('0x2e')]));_0x31cb17['attributes']=_0x31cb17['attributes'][_0xaf81('0x2f')]?_0x31cb17['attributes']:_0x28f593[_0xaf81('0x26')];if(!_0x22099d['query'][_0xaf81('0x30')]('nolimit')){_0x31cb17[_0xaf81('0x19')]=qs[_0xaf81('0x19')](_0x22099d[_0xaf81('0x29')][_0xaf81('0x19')]);_0x31cb17[_0xaf81('0x18')]=qs[_0xaf81('0x18')](_0x22099d[_0xaf81('0x29')][_0xaf81('0x18')]);}_0x31cb17[_0xaf81('0x31')]=qs['sort'](_0x22099d[_0xaf81('0x29')][_0xaf81('0x32')]);_0x31cb17[_0xaf81('0x33')]=qs['filters'](_[_0xaf81('0x34')](_0x22099d[_0xaf81('0x29')],_0x28f593[_0xaf81('0x2b')]));if(_0xd85377[_0xaf81('0x28')]){if(_0xd85377['dateEnd']){_0xd85377['dateEnd']=moment(_0xd85377[_0xaf81('0x2a')])[_0xaf81('0x35')](0x1,_0xaf81('0x36'));}else{_0xd85377['dateEnd']=moment(_0xd85377[_0xaf81('0x28')])[_0xaf81('0x35')](0x1,_0xaf81('0x36'));}_[_0xaf81('0x37')](_0x31cb17[_0xaf81('0x33')],{'createdAt':{'$gte':_0xd85377[_0xaf81('0x28')],'$lte':_0xd85377[_0xaf81('0x2a')]}});}if(_0x22099d[_0xaf81('0x29')][_0xaf81('0x38')]){_0x31cb17[_0xaf81('0x33')]=_[_0xaf81('0x37')](_0x31cb17[_0xaf81('0x33')],{'$or':_[_0xaf81('0x39')](_0x31cb17[_0xaf81('0x2d')],function(_0x56d9c8){var _0x588d58={};_0x588d58[_0x56d9c8]={'$like':'%'+_0x22099d[_0xaf81('0x29')][_0xaf81('0x38')]+'%'};return _0x588d58;})});}_0x31cb17=_[_0xaf81('0x37')]({},_0x31cb17,_0x22099d['options']);var _0x4c8487={'where':_0x31cb17[_0xaf81('0x33')]};return db['VoicePrefix'][_0xaf81('0x3a')](_0x4c8487)['then'](function(_0x4baa95){_0x2767c4['count']=_0x4baa95;if(_0x22099d['query'][_0xaf81('0x3b')]){_0x31cb17[_0xaf81('0x3c')]=[{'all':!![]}];}return db[_0xaf81('0x25')][_0xaf81('0x3d')](_0x31cb17);})[_0xaf81('0x1f')](function(_0x280294){_0x2767c4['rows']=_0x280294;return _0x2767c4;})[_0xaf81('0x1f')](respondWithFilteredResult(_0x3edffb,_0x31cb17))[_0xaf81('0x3e')](handleError(_0x3edffb,null));};exports[_0xaf81('0x3f')]=function(_0x4979dd,_0x107bd0){var _0xb8d26d={'raw':![],'where':{'id':_0x4979dd[_0xaf81('0x40')]['id']}},_0x1755be={};_0x1755be[_0xaf81('0x26')]=_[_0xaf81('0x27')](db[_0xaf81('0x25')][_0xaf81('0x41')]);_0x1755be[_0xaf81('0x29')]=_[_0xaf81('0x27')](_0x4979dd['query']);_0x1755be['filters']=_['intersection'](_0x1755be[_0xaf81('0x26')],_0x1755be[_0xaf81('0x29')]);_0xb8d26d[_0xaf81('0x2d')]=_[_0xaf81('0x2c')](_0x1755be[_0xaf81('0x26')],qs[_0xaf81('0x2e')](_0x4979dd[_0xaf81('0x29')]['fields']));_0xb8d26d[_0xaf81('0x2d')]=_0xb8d26d[_0xaf81('0x2d')][_0xaf81('0x2f')]?_0xb8d26d['attributes']:_0x1755be['model'];if(_0x4979dd[_0xaf81('0x29')][_0xaf81('0x3b')]){_0xb8d26d[_0xaf81('0x3c')]=[{'all':!![]}];}_0xb8d26d=_[_0xaf81('0x37')]({},_0xb8d26d,_0x4979dd[_0xaf81('0x42')]);return db[_0xaf81('0x25')][_0xaf81('0x43')](_0xb8d26d)[_0xaf81('0x1f')](handleEntityNotFound(_0x107bd0,null))[_0xaf81('0x1f')](respondWithResult(_0x107bd0,null))[_0xaf81('0x3e')](handleError(_0x107bd0,null));};exports[_0xaf81('0x44')]=function(_0x46b806,_0x38a9fa){return db['VoicePrefix']['find']({'where':{'id':_0x46b806[_0xaf81('0x40')]['id']}})[_0xaf81('0x1f')](handleEntityNotFound(_0x38a9fa,null))[_0xaf81('0x1f')](removeEntity(_0x38a9fa,null))[_0xaf81('0x3e')](handleError(_0x38a9fa,null));};exports[_0xaf81('0x45')]=function(_0x2a40f7,_0x38193d){return db[_0xaf81('0x25')][_0xaf81('0x45')]()[_0xaf81('0x1f')](respondWithResult(_0x38193d,null))[_0xaf81('0x3e')](handleError(_0x38193d,null));};exports[_0xaf81('0x46')]=function(_0x5a2cc2,_0x392ad5){var _0x2f0ab8;return db['sequelize'][_0xaf81('0x47')](function(_0x37f854){return db[_0xaf81('0x25')][_0xaf81('0x46')](_0x5a2cc2['body'],{'transaction':_0x37f854})[_0xaf81('0x1f')](function(_0x131237){_0x2f0ab8=_0x131237['get']({'plain':!![]});return db[_0xaf81('0x48')][_0xaf81('0x43')]({'where':{'id':_0x2f0ab8[_0xaf81('0x49')]},'raw':!![]})['then'](function(_0x146e82){return createVoicePrefixExtensions(_0x2f0ab8,_0x146e82,_0x37f854);});});})[_0xaf81('0x1f')](function(){return _0x2f0ab8;})[_0xaf81('0x1f')](respondWithResult(_0x392ad5,null))[_0xaf81('0x3e')](handleError(_0x392ad5,null));};function Extension(_0x3414b1,_0x13810e,_0x58da6a,_0x170ade){this[_0xaf81('0x4a')]=_0xaf81('0x4b');this[_0xaf81('0x4c')]=_0x3414b1;this[_0xaf81('0x4d')]=_0x58da6a;this[_0xaf81('0x4e')]=_0xaf81('0x4f');this[_0xaf81('0x50')]='Voice\x20Prefix\x20Extension';this[_0xaf81('0x51')]=_0x13810e;this['appdata']=_0x170ade;}function createVoicePrefixExtensions(_0x183619,_0x57d882,_0x1b8189){return new BPromise(function(_0x1422a7,_0x5e040b){var _0x99ea7a=new Extension(formatPrefixName(_0x183619[_0xaf81('0x52')]),0x1,_0xaf81('0x53'),_0xaf81('0x54'));_0x99ea7a[_0xaf81('0x55')]=_0x183619['id'];return db[_0xaf81('0x48')][_0xaf81('0x46')](_0x99ea7a,{'transaction':_0x1b8189})[_0xaf81('0x1f')](function(_0x3a7dda){var _0x6b37aa=_0x3a7dda[_0xaf81('0x56')]({'plain':!![]});var _0x5c95fc=_[_0xaf81('0x39')](addVoicePrefixExtensions(_0x183619,_0x57d882),function(_0x426c87){_0x426c87[_0xaf81('0x49')]=_0x6b37aa['id'];_0x426c87[_0xaf81('0x55')]=_0x183619['id'];return _0x426c87;});return db[_0xaf81('0x48')][_0xaf81('0x57')](_0x5c95fc,{'transaction':_0x1b8189})['then'](function(_0x536128){if(!_0x536128){return _0x5e040b(_0xaf81('0x58'));}else{return _0x1422a7(_0x536128);}})['catch'](function(_0x458292){return _0x5e040b(_0x458292);});});;});};function addVoicePrefixExtensions(_0x306081,_0x2cda21){var _0x39d18c=[];var _0x3e8eb6=formatPrefixName(_0x306081[_0xaf81('0x52')]);_0x39d18c[_0xaf81('0x59')](new Extension(_0x3e8eb6,0x2,_0xaf81('0x5a'),_0xaf81('0x5b')+_0x306081['name']));if(_0x306081[_0xaf81('0x5c')]){_0x39d18c['push'](new Extension(_0x3e8eb6,0x3,_0xaf81('0x5a'),_0xaf81('0x5d')+_0x306081[_0xaf81('0x5c')]));}else{_0x39d18c[_0xaf81('0x59')](new Extension(_0x3e8eb6,0x3,_0xaf81('0x53'),_0xaf81('0x5e')));}_0x39d18c['push'](new Extension(_0x3e8eb6,0x4,_0xaf81('0x5f'),_0x2cda21[_0xaf81('0x4a')]+','+_0xaf81('0x60')+(0x8+_0x306081[_0xaf81('0x61')]['length'])+'}'+','+0x1));return _0x39d18c;}function formatPrefixName(_0x28c3d7){var _0x2c7810='_';for(var _0x25a4b7=0x0;_0x25a4b7<_0x28c3d7[_0xaf81('0x2f')];_0x25a4b7++){if(_0x28c3d7[_0xaf81('0x62')](_0x25a4b7)=='-'){_0x2c7810+=_0x28c3d7[_0xaf81('0x62')](_0x25a4b7);}else{_0x2c7810+='['+_0x28c3d7[_0xaf81('0x62')](_0x25a4b7)+']';}}_0x2c7810+='.';return _0x2c7810;}exports[_0xaf81('0x1e')]=function(_0x2927e9,_0x129b8a,_0x3e84d3){var _0xa133a5=_0x2927e9[_0xaf81('0x63')];_0xa133a5[_0xaf81('0x52')]='system-'+_0xa133a5['name']+'-';return db[_0xaf81('0x64')][_0xaf81('0x47')](function(_0x4a07da){return db[_0xaf81('0x25')][_0xaf81('0x1e')](_0xa133a5,{'where':{'id':_0xa133a5['id']},'transaction':_0x4a07da})[_0xaf81('0x1f')](function(){return db[_0xaf81('0x48')][_0xaf81('0x44')]({'where':{'VoicePrefixId':_0xa133a5['id']},'transaction':_0x4a07da})['then'](function(){return db[_0xaf81('0x48')]['find']({'where':{'id':_0xa133a5['VoiceExtensionId']},'raw':!![]})[_0xaf81('0x1f')](function(_0x562d69){return createVoicePrefixExtensions(_0xa133a5,_0x562d69,_0x4a07da);});});});})[_0xaf81('0x1f')](function(){return db['VoicePrefix'][_0xaf81('0x65')](_0xa133a5['id']);})[_0xaf81('0x1f')](respondWithResult(_0x129b8a,null))[_0xaf81('0x3e')](handleError(_0x129b8a,null));};exports[_0xaf81('0x66')]=function(_0x3c3424,_0x314886,_0x19587b){return db[_0xaf81('0x25')][_0xaf81('0x43')]({'where':{'id':_0x3c3424[_0xaf81('0x40')]['id']}})[_0xaf81('0x1f')](handleEntityNotFound(_0x314886,null))[_0xaf81('0x1f')](function(_0xbacc32){if(_0xbacc32){return _0xbacc32[_0xaf81('0x66')](_0x3c3424[_0xaf81('0x63')][_0xaf81('0x67')],_[_0xaf81('0x68')](_0x3c3424['body'],[_0xaf81('0x67'),'id'])||{})[_0xaf81('0x69')](function(_0x441bc2){for(var _0x33ae9a=0x0;_0x33ae9a<_0x3c3424[_0xaf81('0x63')][_0xaf81('0x67')]['length'];_0x33ae9a+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':_0x3c3424[_0xaf81('0x63')][_0xaf81('0x67')][_0x33ae9a],'VoicePrefixId':_0x3c3424[_0xaf81('0x40')]['id']});}return _0x441bc2;});}})[_0xaf81('0x1f')](respondWithResult(_0x314886,null))[_0xaf81('0x3e')](handleError(_0x314886,null));};exports['removeAgents']=function(_0x5a2070,_0x4321cb,_0xb5ed1b){var _0x3a0b19;return db[_0xaf81('0x25')]['find']({'where':{'id':_0x5a2070[_0xaf81('0x40')]['id']}})[_0xaf81('0x1f')](handleEntityNotFound(_0x4321cb,null))['then'](function(_0x7f753e){if(_0x7f753e){return _0x7f753e[_0xaf81('0x6a')](_0x5a2070['query']['ids'])[_0xaf81('0x1f')](function(_0x1634c6){if(_[_0xaf81('0x6b')](_0x5a2070[_0xaf81('0x29')][_0xaf81('0x67')])){for(var _0x27fb70=0x0;_0x27fb70<_0x5a2070[_0xaf81('0x29')][_0xaf81('0x67')][_0xaf81('0x2f')];_0x27fb70+=0x1){socket[_0xaf81('0x6c')](_0xaf81('0x6d'),{'UserId':_0x5a2070[_0xaf81('0x29')][_0xaf81('0x67')][_0x27fb70],'VoicePrefixId':_0x5a2070[_0xaf81('0x40')]['id']});}}else{socket[_0xaf81('0x6c')](_0xaf81('0x6d'),{'UserId':_0x5a2070[_0xaf81('0x29')][_0xaf81('0x67')],'VoicePrefixId':_0x5a2070['params']['id']});}});}})[_0xaf81('0x1f')](respondWithStatusCode(_0x4321cb,null))[_0xaf81('0x3e')](handleError(_0x4321cb,null));};exports[_0xaf81('0x6e')]=function(_0x301e84,_0x190572,_0x6b7efa){var _0x59d921={};var _0xebbf99={};var _0x3a2c5d;var _0x2b8115;return db[_0xaf81('0x25')]['findOne']({'where':{'id':_0x301e84['params']['id']}})[_0xaf81('0x1f')](handleEntityNotFound(_0x190572,null))[_0xaf81('0x1f')](function(_0x26621b){if(_0x26621b){_0x3a2c5d=_0x26621b;_0xebbf99[_0xaf81('0x26')]=_[_0xaf81('0x27')](db[_0xaf81('0x6f')]['rawAttributes']);_0xebbf99[_0xaf81('0x29')]=_['keys'](_0x301e84[_0xaf81('0x29')]);_0xebbf99[_0xaf81('0x2b')]=_['intersection'](_0xebbf99[_0xaf81('0x26')],_0xebbf99[_0xaf81('0x29')]);_0x59d921['attributes']=_[_0xaf81('0x2c')](_0xebbf99[_0xaf81('0x26')],qs[_0xaf81('0x2e')](_0x301e84[_0xaf81('0x29')]['fields']));_0x59d921[_0xaf81('0x2d')]=_0x59d921[_0xaf81('0x2d')][_0xaf81('0x2f')]?_0x59d921[_0xaf81('0x2d')]:_0xebbf99[_0xaf81('0x26')];_0x59d921[_0xaf81('0x31')]=qs[_0xaf81('0x32')](_0x301e84[_0xaf81('0x29')][_0xaf81('0x32')]);_0x59d921[_0xaf81('0x33')]=qs[_0xaf81('0x2b')](_['pick'](_0x301e84[_0xaf81('0x29')],_0xebbf99['filters']));if(_0x301e84[_0xaf81('0x29')][_0xaf81('0x38')]){_0x59d921[_0xaf81('0x33')]=_[_0xaf81('0x37')](_0x59d921['where'],{'$or':_[_0xaf81('0x39')](_0x59d921[_0xaf81('0x2d')],function(_0x235f8d){var _0x76582c={};_0x76582c[_0x235f8d]={'$like':'%'+_0x301e84[_0xaf81('0x29')][_0xaf81('0x38')]+'%'};return _0x76582c;})});}_0x59d921=_[_0xaf81('0x37')]({},_0x59d921,_0x301e84[_0xaf81('0x42')]);return _0x3a2c5d[_0xaf81('0x6e')](_0x59d921);}})[_0xaf81('0x1f')](function(_0x43a061){if(_0x43a061){_0x2b8115=_0x43a061['length'];if(!_0x301e84[_0xaf81('0x29')]['hasOwnProperty']('nolimit')){_0x59d921[_0xaf81('0x19')]=qs[_0xaf81('0x19')](_0x301e84[_0xaf81('0x29')][_0xaf81('0x19')]);_0x59d921[_0xaf81('0x18')]=qs[_0xaf81('0x18')](_0x301e84[_0xaf81('0x29')][_0xaf81('0x18')]);}return _0x3a2c5d[_0xaf81('0x6e')](_0x59d921);}})[_0xaf81('0x1f')](function(_0x5489ee){if(_0x5489ee){return _0x5489ee?{'count':_0x2b8115,'rows':_0x5489ee}:null;}})[_0xaf81('0x1f')](respondWithResult(_0x190572,null))[_0xaf81('0x3e')](handleError(_0x190572,null));}; \ No newline at end of file +var _0x2e21=['index','VoicePrefix','rawAttributes','model','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','add','day','merge','map','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','describe','create','sequelize','VoiceExtension','context','from-sip','exten','app','type','description','Voice\x20Prefix','get','VoiceExtensionId','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push','NoOp','No\x20callerid\x20available','${EXTEN:','charAt','prefix','system-','transaction','findById','addAgents','body','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','order','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','../../config/utils','../../mysqldb','socket.io-emitter','localhost','register','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0x2e21,0xba));var _0x12e2=function(_0x5a7c30,_0x37080d){_0x5a7c30=_0x5a7c30-0x0;var _0x3be2da=_0x2e21[_0x5a7c30];return _0x3be2da;};'use strict';var jsonpatch=require(_0x12e2('0x0'));var rp=require(_0x12e2('0x1'));var moment=require(_0x12e2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x12e2('0x3'));var util=require('util');var path=require(_0x12e2('0x4'));var sox=require(_0x12e2('0x5'));var csv=require(_0x12e2('0x6'));var ejs=require(_0x12e2('0x7'));var fs=require('fs');var _=require(_0x12e2('0x8'));var squel=require(_0x12e2('0x9'));var crypto=require(_0x12e2('0xa'));var jsforce=require(_0x12e2('0xb'));var deskjs=require(_0x12e2('0xc'));var toCsv=require(_0x12e2('0x6'));var querystring=require(_0x12e2('0xd'));var Papa=require(_0x12e2('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0x12e2('0xf'))('api');var utils=require(_0x12e2('0x10'));var config=require('../../config/environment');var db=require(_0x12e2('0x11'))['db'];var socket=require(_0x12e2('0x12'))({'host':_0x12e2('0x13'),'port':0x18eb});require('./voicePrefix.socket')[_0x12e2('0x14')](socket);function respondWithStatusCode(_0x233d87,_0x5776c6){_0x5776c6=_0x5776c6||0xcc;return function(_0xf0ff3b){if(_0xf0ff3b){return _0x233d87['sendStatus'](_0x5776c6);}return _0x233d87[_0x12e2('0x15')](_0x5776c6)['end']();};}function respondWithResult(_0x106015,_0x25edc8){_0x25edc8=_0x25edc8||0xc8;return function(_0xbf4028){if(_0xbf4028){return _0x106015[_0x12e2('0x15')](_0x25edc8)[_0x12e2('0x16')](_0xbf4028);}};}function respondWithFilteredResult(_0x1c92de,_0x1cfa64){return function(_0x3b936e){if(_0x3b936e){var _0x18d47e=_0x3b936e[_0x12e2('0x17')],_0x48676d=_0x1cfa64[_0x12e2('0x18')],_0x29c58e=_0x1cfa64[_0x12e2('0x18')]+_0x1cfa64[_0x12e2('0x19')],_0x411049;if(_0x29c58e>=_0x18d47e){_0x29c58e=_0x18d47e;_0x411049=0xc8;}else{_0x411049=0xce;}_0x1c92de[_0x12e2('0x15')](_0x411049);return _0x1c92de[_0x12e2('0x1a')](_0x12e2('0x1b'),_0x48676d+'-'+_0x29c58e+'/'+_0x18d47e)[_0x12e2('0x16')](_0x3b936e);}return null;};}function patchUpdates(_0x210f5c){return function(_0x430bc9){try{jsonpatch[_0x12e2('0x1c')](_0x430bc9,_0x210f5c,!![]);}catch(_0x174b28){return BPromise[_0x12e2('0x1d')](_0x174b28);}return _0x430bc9[_0x12e2('0x1e')]();};}function saveUpdates(_0x3cf1e3,_0x1eb70f){return function(_0x720d2e){if(_0x720d2e){return _0x720d2e[_0x12e2('0x1f')](_0x3cf1e3)[_0x12e2('0x20')](function(_0xd85795){return _0xd85795;});}return null;};}function removeEntity(_0x475cab,_0x4e5bc7){return function(_0x2afa39){if(_0x2afa39){return _0x2afa39[_0x12e2('0x21')]()[_0x12e2('0x20')](function(){_0x475cab[_0x12e2('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x400d23,_0x10c374){return function(_0x4eeb3a){if(!_0x4eeb3a){_0x400d23[_0x12e2('0x22')](0x194);}return _0x4eeb3a;};}function handleError(_0x5dac82,_0xe5868a){_0xe5868a=_0xe5868a||0x1f4;return function(_0x33fed2){logger['error'](_0x33fed2[_0x12e2('0x23')]);if(_0x33fed2[_0x12e2('0x24')]){delete _0x33fed2['name'];}_0x5dac82['status'](_0xe5868a)[_0x12e2('0x25')](_0x33fed2);};}exports[_0x12e2('0x26')]=function(_0x52f475,_0x1cb0d1){var _0x18639b={},_0x441c84={},_0xf36e7a={'count':0x0,'rows':[]};var _0x2ee2b0=db[_0x12e2('0x27')][_0x12e2('0x28')];_0x441c84[_0x12e2('0x29')]=_['keys'](_0x2ee2b0);var _0xe392f6={'dateStart':_0x52f475[_0x12e2('0x2a')][_0x12e2('0x2b')],'dateEnd':_0x52f475[_0x12e2('0x2a')][_0x12e2('0x2c')]};delete _0x52f475[_0x12e2('0x2a')]['dateStart'];delete _0x52f475[_0x12e2('0x2a')][_0x12e2('0x2c')];_0x441c84[_0x12e2('0x2a')]=_['keys'](_0x52f475[_0x12e2('0x2a')]);_0x441c84[_0x12e2('0x2d')]=_['intersection'](_0x441c84[_0x12e2('0x29')],_0x441c84[_0x12e2('0x2a')]);_0x18639b[_0x12e2('0x2e')]=_[_0x12e2('0x2f')](_0x441c84[_0x12e2('0x29')],qs['fields'](_0x52f475[_0x12e2('0x2a')][_0x12e2('0x30')]));_0x18639b[_0x12e2('0x2e')]=_0x18639b[_0x12e2('0x2e')][_0x12e2('0x31')]?_0x18639b[_0x12e2('0x2e')]:_0x441c84[_0x12e2('0x29')];if(!_0x52f475['query'][_0x12e2('0x32')](_0x12e2('0x33'))){_0x18639b[_0x12e2('0x19')]=qs[_0x12e2('0x19')](_0x52f475[_0x12e2('0x2a')][_0x12e2('0x19')]);_0x18639b[_0x12e2('0x18')]=qs[_0x12e2('0x18')](_0x52f475[_0x12e2('0x2a')][_0x12e2('0x18')]);}_0x18639b['order']=qs['sort'](_0x52f475['query'][_0x12e2('0x34')]);_0x18639b[_0x12e2('0x35')]=qs[_0x12e2('0x2d')](_[_0x12e2('0x36')](_0x52f475[_0x12e2('0x2a')],_0x441c84[_0x12e2('0x2d')]));if(_0xe392f6['dateStart']){if(_0xe392f6[_0x12e2('0x2c')]){_0xe392f6[_0x12e2('0x2c')]=moment(_0xe392f6[_0x12e2('0x2c')])[_0x12e2('0x37')](0x1,'day');}else{_0xe392f6[_0x12e2('0x2c')]=moment(_0xe392f6[_0x12e2('0x2b')])[_0x12e2('0x37')](0x1,_0x12e2('0x38'));}_['merge'](_0x18639b[_0x12e2('0x35')],{'createdAt':{'$gte':_0xe392f6[_0x12e2('0x2b')],'$lte':_0xe392f6['dateEnd']}});}if(_0x52f475[_0x12e2('0x2a')]['filter']){_0x18639b['where']=_[_0x12e2('0x39')](_0x18639b[_0x12e2('0x35')],{'$or':_[_0x12e2('0x3a')](_0x18639b[_0x12e2('0x2e')],function(_0x439d0d){var _0x5f415b={};_0x5f415b[_0x439d0d]={'$like':'%'+_0x52f475['query'][_0x12e2('0x3b')]+'%'};return _0x5f415b;})});}_0x18639b=_['merge']({},_0x18639b,_0x52f475[_0x12e2('0x3c')]);var _0x370659={'where':_0x18639b[_0x12e2('0x35')]};return db[_0x12e2('0x27')]['count'](_0x370659)[_0x12e2('0x20')](function(_0x1fc751){_0xf36e7a['count']=_0x1fc751;if(_0x52f475[_0x12e2('0x2a')][_0x12e2('0x3d')]){_0x18639b[_0x12e2('0x3e')]=[{'all':!![]}];}return db[_0x12e2('0x27')][_0x12e2('0x3f')](_0x18639b);})[_0x12e2('0x20')](function(_0x1c2be6){_0xf36e7a[_0x12e2('0x40')]=_0x1c2be6;return _0xf36e7a;})['then'](respondWithFilteredResult(_0x1cb0d1,_0x18639b))[_0x12e2('0x41')](handleError(_0x1cb0d1,null));};exports[_0x12e2('0x42')]=function(_0x5e2f04,_0x4ae8c2){var _0x5e148d={'raw':![],'where':{'id':_0x5e2f04[_0x12e2('0x43')]['id']}},_0x3c360d={};_0x3c360d[_0x12e2('0x29')]=_['keys'](db['VoicePrefix'][_0x12e2('0x28')]);_0x3c360d[_0x12e2('0x2a')]=_[_0x12e2('0x44')](_0x5e2f04[_0x12e2('0x2a')]);_0x3c360d[_0x12e2('0x2d')]=_[_0x12e2('0x2f')](_0x3c360d[_0x12e2('0x29')],_0x3c360d[_0x12e2('0x2a')]);_0x5e148d[_0x12e2('0x2e')]=_[_0x12e2('0x2f')](_0x3c360d[_0x12e2('0x29')],qs[_0x12e2('0x30')](_0x5e2f04['query'][_0x12e2('0x30')]));_0x5e148d[_0x12e2('0x2e')]=_0x5e148d[_0x12e2('0x2e')][_0x12e2('0x31')]?_0x5e148d['attributes']:_0x3c360d[_0x12e2('0x29')];if(_0x5e2f04['query'][_0x12e2('0x3d')]){_0x5e148d['include']=[{'all':!![]}];}_0x5e148d=_[_0x12e2('0x39')]({},_0x5e148d,_0x5e2f04[_0x12e2('0x3c')]);return db[_0x12e2('0x27')][_0x12e2('0x45')](_0x5e148d)[_0x12e2('0x20')](handleEntityNotFound(_0x4ae8c2,null))['then'](respondWithResult(_0x4ae8c2,null))[_0x12e2('0x41')](handleError(_0x4ae8c2,null));};exports[_0x12e2('0x21')]=function(_0x7ba52d,_0x1dd8cd){return db[_0x12e2('0x27')][_0x12e2('0x45')]({'where':{'id':_0x7ba52d[_0x12e2('0x43')]['id']}})['then'](handleEntityNotFound(_0x1dd8cd,null))[_0x12e2('0x20')](removeEntity(_0x1dd8cd,null))[_0x12e2('0x41')](handleError(_0x1dd8cd,null));};exports[_0x12e2('0x46')]=function(_0x34c963,_0x48b16c){return db['VoicePrefix'][_0x12e2('0x46')]()[_0x12e2('0x20')](respondWithResult(_0x48b16c,null))[_0x12e2('0x41')](handleError(_0x48b16c,null));};exports[_0x12e2('0x47')]=function(_0x50bf03,_0x1cbe60){var _0x4502da;return db[_0x12e2('0x48')]['transaction'](function(_0x5081ca){return db[_0x12e2('0x27')]['create'](_0x50bf03['body'],{'transaction':_0x5081ca})[_0x12e2('0x20')](function(_0x5331c4){_0x4502da=_0x5331c4['get']({'plain':!![]});return db[_0x12e2('0x49')][_0x12e2('0x45')]({'where':{'id':_0x4502da['VoiceExtensionId']},'raw':!![]})[_0x12e2('0x20')](function(_0x5f0fdf){return createVoicePrefixExtensions(_0x4502da,_0x5f0fdf,_0x5081ca);});});})[_0x12e2('0x20')](function(){return _0x4502da;})[_0x12e2('0x20')](respondWithResult(_0x1cbe60,null))[_0x12e2('0x41')](handleError(_0x1cbe60,null));};function Extension(_0x42c3c6,_0x4a0f09,_0x1ebd99,_0x515785){this[_0x12e2('0x4a')]=_0x12e2('0x4b');this[_0x12e2('0x4c')]=_0x42c3c6;this[_0x12e2('0x4d')]=_0x1ebd99;this[_0x12e2('0x4e')]='system';this[_0x12e2('0x4f')]='Voice\x20Prefix\x20Extension';this['priority']=_0x4a0f09;this['appdata']=_0x515785;}function createVoicePrefixExtensions(_0x32bd5a,_0x5160bd,_0x389351){return new BPromise(function(_0x19fb6d,_0x582084){var _0x507d36=new Extension(formatPrefixName(_0x32bd5a['prefix']),0x1,'NoOp',_0x12e2('0x50'));_0x507d36['VoicePrefixId']=_0x32bd5a['id'];return db[_0x12e2('0x49')][_0x12e2('0x47')](_0x507d36,{'transaction':_0x389351})[_0x12e2('0x20')](function(_0x400440){var _0x53bcad=_0x400440[_0x12e2('0x51')]({'plain':!![]});var _0x43c20c=_[_0x12e2('0x3a')](addVoicePrefixExtensions(_0x32bd5a,_0x5160bd),function(_0x526d9e){_0x526d9e[_0x12e2('0x52')]=_0x53bcad['id'];_0x526d9e[_0x12e2('0x53')]=_0x32bd5a['id'];return _0x526d9e;});return db[_0x12e2('0x49')][_0x12e2('0x54')](_0x43c20c,{'transaction':_0x389351})[_0x12e2('0x20')](function(_0x46a98a){if(!_0x46a98a){return _0x582084(_0x12e2('0x55'));}else{return _0x19fb6d(_0x46a98a);}})[_0x12e2('0x41')](function(_0x4143e2){return _0x582084(_0x4143e2);});});;});};function addVoicePrefixExtensions(_0x56dd37,_0x3055c3){var _0x1a8a95=[];var _0x40999e=formatPrefixName(_0x56dd37['prefix']);_0x1a8a95['push'](new Extension(_0x40999e,0x2,_0x12e2('0x56'),_0x12e2('0x57')+_0x56dd37[_0x12e2('0x24')]));if(_0x56dd37[_0x12e2('0x58')]){_0x1a8a95[_0x12e2('0x59')](new Extension(_0x40999e,0x3,_0x12e2('0x56'),'PREFIX-CALLERIDALL='+_0x56dd37[_0x12e2('0x58')]));}else{_0x1a8a95[_0x12e2('0x59')](new Extension(_0x40999e,0x3,_0x12e2('0x5a'),_0x12e2('0x5b')));}_0x1a8a95['push'](new Extension(_0x40999e,0x4,'goto',_0x3055c3[_0x12e2('0x4a')]+','+_0x12e2('0x5c')+(0x8+_0x56dd37[_0x12e2('0x24')][_0x12e2('0x31')])+'}'+','+0x1));return _0x1a8a95;}function formatPrefixName(_0x23fa06){var _0x210de5='_';for(var _0x4e6cfa=0x0;_0x4e6cfa<_0x23fa06['length'];_0x4e6cfa++){if(_0x23fa06['charAt'](_0x4e6cfa)=='-'){_0x210de5+=_0x23fa06['charAt'](_0x4e6cfa);}else{_0x210de5+='['+_0x23fa06[_0x12e2('0x5d')](_0x4e6cfa)+']';}}_0x210de5+='.';return _0x210de5;}exports[_0x12e2('0x1f')]=function(_0x4a3fcd,_0x5c1b66,_0x452027){var _0x527050=_0x4a3fcd['body'];_0x527050[_0x12e2('0x5e')]=_0x12e2('0x5f')+_0x527050[_0x12e2('0x24')]+'-';return db['sequelize'][_0x12e2('0x60')](function(_0x420ebc){return db[_0x12e2('0x27')]['update'](_0x527050,{'where':{'id':_0x527050['id']},'transaction':_0x420ebc})[_0x12e2('0x20')](function(){return db[_0x12e2('0x49')][_0x12e2('0x21')]({'where':{'VoicePrefixId':_0x527050['id']},'transaction':_0x420ebc})[_0x12e2('0x20')](function(){return db[_0x12e2('0x49')][_0x12e2('0x45')]({'where':{'id':_0x527050['VoiceExtensionId']},'raw':!![]})['then'](function(_0xd5211a){return createVoicePrefixExtensions(_0x527050,_0xd5211a,_0x420ebc);});});});})[_0x12e2('0x20')](function(){return db[_0x12e2('0x27')][_0x12e2('0x61')](_0x527050['id']);})['then'](respondWithResult(_0x5c1b66,null))['catch'](handleError(_0x5c1b66,null));};exports[_0x12e2('0x62')]=function(_0x36a0fd,_0x16043c,_0x46f498){return db[_0x12e2('0x27')][_0x12e2('0x45')]({'where':{'id':_0x36a0fd['params']['id']}})[_0x12e2('0x20')](handleEntityNotFound(_0x16043c,null))[_0x12e2('0x20')](function(_0x1bded3){if(_0x1bded3){return _0x1bded3['addAgents'](_0x36a0fd[_0x12e2('0x63')][_0x12e2('0x64')],_[_0x12e2('0x65')](_0x36a0fd['body'],[_0x12e2('0x64'),'id'])||{})[_0x12e2('0x66')](function(_0x6add97){for(var _0x330929=0x0;_0x330929<_0x36a0fd[_0x12e2('0x63')][_0x12e2('0x64')][_0x12e2('0x31')];_0x330929+=0x1){socket[_0x12e2('0x67')](_0x12e2('0x68'),{'UserId':_0x36a0fd[_0x12e2('0x63')]['ids'][_0x330929],'VoicePrefixId':_0x36a0fd[_0x12e2('0x43')]['id']});}return _0x6add97;});}})[_0x12e2('0x20')](respondWithResult(_0x16043c,null))[_0x12e2('0x41')](handleError(_0x16043c,null));};exports[_0x12e2('0x69')]=function(_0x204986,_0x2babda,_0x45f196){var _0x45fa94;return db[_0x12e2('0x27')]['find']({'where':{'id':_0x204986['params']['id']}})['then'](handleEntityNotFound(_0x2babda,null))[_0x12e2('0x20')](function(_0x2bc746){if(_0x2bc746){return _0x2bc746[_0x12e2('0x69')](_0x204986[_0x12e2('0x2a')]['ids'])[_0x12e2('0x20')](function(_0x457403){if(_[_0x12e2('0x6a')](_0x204986[_0x12e2('0x2a')][_0x12e2('0x64')])){for(var _0x570c2f=0x0;_0x570c2f<_0x204986[_0x12e2('0x2a')][_0x12e2('0x64')]['length'];_0x570c2f+=0x1){socket[_0x12e2('0x67')](_0x12e2('0x6b'),{'UserId':_0x204986[_0x12e2('0x2a')][_0x12e2('0x64')][_0x570c2f],'VoicePrefixId':_0x204986[_0x12e2('0x43')]['id']});}}else{socket[_0x12e2('0x67')](_0x12e2('0x6b'),{'UserId':_0x204986[_0x12e2('0x2a')][_0x12e2('0x64')],'VoicePrefixId':_0x204986[_0x12e2('0x43')]['id']});}});}})[_0x12e2('0x20')](respondWithStatusCode(_0x2babda,null))['catch'](handleError(_0x2babda,null));};exports[_0x12e2('0x6c')]=function(_0x59702f,_0x339d7b,_0x2a32fa){var _0x2370f9={};var _0x4edb12={};var _0x1351bd;var _0x4d0047;return db[_0x12e2('0x27')][_0x12e2('0x6d')]({'where':{'id':_0x59702f[_0x12e2('0x43')]['id']}})['then'](handleEntityNotFound(_0x339d7b,null))[_0x12e2('0x20')](function(_0x5e7a6f){if(_0x5e7a6f){_0x1351bd=_0x5e7a6f;_0x4edb12[_0x12e2('0x29')]=_['keys'](db[_0x12e2('0x6e')][_0x12e2('0x28')]);_0x4edb12[_0x12e2('0x2a')]=_[_0x12e2('0x44')](_0x59702f[_0x12e2('0x2a')]);_0x4edb12['filters']=_['intersection'](_0x4edb12[_0x12e2('0x29')],_0x4edb12[_0x12e2('0x2a')]);_0x2370f9[_0x12e2('0x2e')]=_['intersection'](_0x4edb12[_0x12e2('0x29')],qs['fields'](_0x59702f[_0x12e2('0x2a')]['fields']));_0x2370f9[_0x12e2('0x2e')]=_0x2370f9[_0x12e2('0x2e')]['length']?_0x2370f9['attributes']:_0x4edb12['model'];_0x2370f9[_0x12e2('0x6f')]=qs[_0x12e2('0x34')](_0x59702f[_0x12e2('0x2a')][_0x12e2('0x34')]);_0x2370f9[_0x12e2('0x35')]=qs[_0x12e2('0x2d')](_['pick'](_0x59702f[_0x12e2('0x2a')],_0x4edb12['filters']));if(_0x59702f[_0x12e2('0x2a')][_0x12e2('0x3b')]){_0x2370f9['where']=_[_0x12e2('0x39')](_0x2370f9[_0x12e2('0x35')],{'$or':_[_0x12e2('0x3a')](_0x2370f9['attributes'],function(_0x463abe){var _0x272fa3={};_0x272fa3[_0x463abe]={'$like':'%'+_0x59702f['query']['filter']+'%'};return _0x272fa3;})});}_0x2370f9=_[_0x12e2('0x39')]({},_0x2370f9,_0x59702f['options']);return _0x1351bd[_0x12e2('0x6c')](_0x2370f9);}})[_0x12e2('0x20')](function(_0x43e703){if(_0x43e703){_0x4d0047=_0x43e703['length'];if(!_0x59702f[_0x12e2('0x2a')][_0x12e2('0x32')]('nolimit')){_0x2370f9['limit']=qs[_0x12e2('0x19')](_0x59702f['query'][_0x12e2('0x19')]);_0x2370f9['offset']=qs[_0x12e2('0x18')](_0x59702f[_0x12e2('0x2a')][_0x12e2('0x18')]);}return _0x1351bd[_0x12e2('0x6c')](_0x2370f9);}})[_0x12e2('0x20')](function(_0x14a8a0){if(_0x14a8a0){return _0x14a8a0?{'count':_0x4d0047,'rows':_0x14a8a0}:null;}})[_0x12e2('0x20')](respondWithResult(_0x339d7b,null))[_0x12e2('0x41')](handleError(_0x339d7b,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index d1c6a2d..c7a0197 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 _0x50a6=['hasOwnProperty','hook','exports','events','../../mysqldb','save','remove'];(function(_0x470ff2,_0x553a47){var _0x766eb6=function(_0xa5a4fc){while(--_0xa5a4fc){_0x470ff2['push'](_0x470ff2['shift']());}};_0x766eb6(++_0x553a47);}(_0x50a6,0xa4));var _0x650a=function(_0x37b31c,_0x19ffd5){_0x37b31c=_0x37b31c-0x0;var _0x18cccc=_0x50a6[_0x37b31c];return _0x18cccc;};'use strict';var EventEmitter=require(_0x650a('0x0'));var VoicePrefix=require(_0x650a('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x650a('0x2'),'afterUpdate':'update','afterDestroy':_0x650a('0x3')};function emitEvent(_0x15dd02){return function(_0x2c71ba,_0x4a0147,_0xa3311){VoicePrefixEvents['emit'](_0x15dd02+':'+_0x2c71ba['id'],_0x2c71ba);VoicePrefixEvents['emit'](_0x15dd02,_0x2c71ba);_0xa3311(null);};}for(var e in events){if(events[_0x650a('0x4')](e)){var event=events[e];VoicePrefix[_0x650a('0x5')](e,emitEvent(event));}}module[_0x650a('0x6')]=VoicePrefixEvents; \ No newline at end of file +var _0xa41a=['remove','emit','hasOwnProperty','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x18ce11,_0x135cc0){var _0x3bea1d=function(_0x3ed8b2){while(--_0x3ed8b2){_0x18ce11['push'](_0x18ce11['shift']());}};_0x3bea1d(++_0x135cc0);}(_0xa41a,0x6b));var _0xaa41=function(_0x55a30b,_0x73e08){_0x55a30b=_0x55a30b-0x0;var _0x2d3d03=_0xa41a[_0x55a30b];return _0x2d3d03;};'use strict';var EventEmitter=require(_0xaa41('0x0'));var VoicePrefix=require(_0xaa41('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xaa41('0x2')](0x0);var events={'afterCreate':_0xaa41('0x3'),'afterUpdate':_0xaa41('0x4'),'afterDestroy':_0xaa41('0x5')};function emitEvent(_0x37c7a1){return function(_0x3168be,_0x42896b,_0x251efa){VoicePrefixEvents['emit'](_0x37c7a1+':'+_0x3168be['id'],_0x3168be);VoicePrefixEvents[_0xaa41('0x6')](_0x37c7a1,_0x3168be);_0x251efa(null);};}for(var e in events){if(events[_0xaa41('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index b6e2218..d284caa 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 _0xea4a=['bluebird','request-promise','exports','define','VoicePrefix','voice_prefixes','lodash','api','moment'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xea4a,0xf0));var _0xaea4=function(_0x256124,_0x3bd5c7){_0x256124=_0x256124-0x0;var _0x5b23c3=_0xea4a[_0x256124];return _0x5b23c3;};'use strict';var _=require(_0xaea4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaea4('0x1'));var moment=require(_0xaea4('0x2'));var BPromise=require(_0xaea4('0x3'));var rp=require(_0xaea4('0x4'));var attributes=require('./voicePrefix.attributes');module[_0xaea4('0x5')]=function(_0x551892,_0x32ae28){return _0x551892[_0xaea4('0x6')](_0xaea4('0x7'),attributes,{'tableName':_0xaea4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d87=['lodash','util','../../config/logger','api','moment','bluebird','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes'];(function(_0x3b6f60,_0x38a465){var _0x449e6e=function(_0x1d448b){while(--_0x1d448b){_0x3b6f60['push'](_0x3b6f60['shift']());}};_0x449e6e(++_0x38a465);}(_0x5d87,0x16b));var _0x75d8=function(_0x427c5b,_0x14d533){_0x427c5b=_0x427c5b-0x0;var _0x2b7d90=_0x5d87[_0x427c5b];return _0x2b7d90;};'use strict';var _=require(_0x75d8('0x0'));var util=require(_0x75d8('0x1'));var logger=require(_0x75d8('0x2'))(_0x75d8('0x3'));var moment=require(_0x75d8('0x4'));var BPromise=require(_0x75d8('0x5'));var rp=require('request-promise');var attributes=require(_0x75d8('0x6'));module[_0x75d8('0x7')]=function(_0x498621,_0x29a8fc){return _0x498621[_0x75d8('0x8')](_0x75d8('0x9'),attributes,{'tableName':_0x75d8('0xa'),'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 fc8cc17..68b8579 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 _0x536a=['../../config/utils','rpc','../../config/environment','client','http','socket.io-emitter','localhost','./voicePrefix.socket','register','request','then','request\x20sent','debug','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x536a,0xe5));var _0xa536=function(_0x3239bb,_0x273106){_0x3239bb=_0x3239bb-0x0;var _0xf2690d=_0x536a[_0x3239bb];return _0xf2690d;};'use strict';var _=require(_0xa536('0x0'));var util=require(_0xa536('0x1'));var moment=require(_0xa536('0x2'));var BPromise=require('bluebird');var rs=require(_0xa536('0x3'));var fs=require('fs');var db=require(_0xa536('0x4'))['db'];var utils=require(_0xa536('0x5'));var logger=require('../../config/logger')(_0xa536('0x6'));var config=require(_0xa536('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa536('0x8')][_0xa536('0x9')]({'port':0x232a});var socket=require(_0xa536('0xa'))({'host':_0xa536('0xb'),'port':0x18eb});require(_0xa536('0xc'))[_0xa536('0xd')](socket);function respondWithRpcPromise(_0x292199,_0x2ddbd8,_0x32c23c){return new BPromise(function(_0x1a87a4,_0x32c35c){return client[_0xa536('0xe')](_0x292199,_0x32c23c)[_0xa536('0xf')](function(_0x465b72){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x2ddbd8,_0xa536('0x10'));logger[_0xa536('0x11')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x2ddbd8,_0xa536('0x10'),JSON[_0xa536('0x12')](_0x465b72));if(_0x465b72[_0xa536('0x13')]){if(_0x465b72[_0xa536('0x13')][_0xa536('0x14')]===0x1f4){logger[_0xa536('0x13')](_0xa536('0x15'),_0x2ddbd8,_0x465b72['error'][_0xa536('0x16')]);return _0x32c35c(_0x465b72[_0xa536('0x13')][_0xa536('0x16')]);}logger[_0xa536('0x13')](_0xa536('0x15'),_0x2ddbd8,_0x465b72[_0xa536('0x13')][_0xa536('0x16')]);return _0x1a87a4(_0x465b72[_0xa536('0x13')]['message']);}else{logger[_0xa536('0x17')](_0xa536('0x15'),_0x2ddbd8,_0xa536('0x10'));_0x1a87a4(_0x465b72[_0xa536('0x18')]['message']);}})[_0xa536('0x19')](function(_0x1574e0){logger[_0xa536('0x13')](_0xa536('0x15'),_0x2ddbd8,_0x1574e0);_0x32c35c(_0x1574e0);});});} \ No newline at end of file +var _0xc1cd=['code','message','result','catch','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x27bc75,_0x51bd8a){var _0x58eb19=function(_0x3ac0a1){while(--_0x3ac0a1){_0x27bc75['push'](_0x27bc75['shift']());}};_0x58eb19(++_0x51bd8a);}(_0xc1cd,0xdc));var _0xdc1c=function(_0x5acd74,_0xf6b848){_0x5acd74=_0x5acd74-0x0;var _0x43b7f3=_0xc1cd[_0x5acd74];return _0x43b7f3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xdc1c('0x0'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xdc1c('0x1'));var logger=require(_0xdc1c('0x2'))(_0xdc1c('0x3'));var config=require(_0xdc1c('0x4'));var jayson=require(_0xdc1c('0x5'));var client=jayson[_0xdc1c('0x6')][_0xdc1c('0x7')]({'port':0x232a});var socket=require(_0xdc1c('0x8'))({'host':_0xdc1c('0x9'),'port':0x18eb});require(_0xdc1c('0xa'))[_0xdc1c('0xb')](socket);function respondWithRpcPromise(_0x2e3534,_0x5225ab,_0x5ac943){return new BPromise(function(_0x187a60,_0x172b12){return client[_0xdc1c('0xc')](_0x2e3534,_0x5ac943)[_0xdc1c('0xd')](function(_0x3b5c09){logger[_0xdc1c('0xe')](_0xdc1c('0xf'),_0x5225ab,_0xdc1c('0x10'));logger['debug'](_0xdc1c('0x11'),_0x5225ab,_0xdc1c('0x10'),JSON[_0xdc1c('0x12')](_0x3b5c09));if(_0x3b5c09[_0xdc1c('0x13')]){if(_0x3b5c09[_0xdc1c('0x13')][_0xdc1c('0x14')]===0x1f4){logger[_0xdc1c('0x13')](_0xdc1c('0xf'),_0x5225ab,_0x3b5c09[_0xdc1c('0x13')]['message']);return _0x172b12(_0x3b5c09[_0xdc1c('0x13')][_0xdc1c('0x15')]);}logger['error'](_0xdc1c('0xf'),_0x5225ab,_0x3b5c09['error'][_0xdc1c('0x15')]);return _0x187a60(_0x3b5c09[_0xdc1c('0x13')][_0xdc1c('0x15')]);}else{logger[_0xdc1c('0xe')](_0xdc1c('0xf'),_0x5225ab,_0xdc1c('0x10'));_0x187a60(_0x3b5c09[_0xdc1c('0x16')][_0xdc1c('0x15')]);}})[_0xdc1c('0x17')](function(_0x22412d){logger['error'](_0xdc1c('0xf'),_0x5225ab,_0x22412d);_0x172b12(_0x22412d);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 4e21b07..77dcd69 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 _0x40f2=['register','length','./voicePrefix.events','save','update','emit','removeListener'];(function(_0x598681,_0x391edd){var _0x2cefcf=function(_0x461e05){while(--_0x461e05){_0x598681['push'](_0x598681['shift']());}};_0x2cefcf(++_0x391edd);}(_0x40f2,0x14b));var _0x240f=function(_0x22c792,_0x4a2119){_0x22c792=_0x22c792-0x0;var _0x1d285d=_0x40f2[_0x22c792];return _0x1d285d;};'use strict';var VoicePrefixEvents=require(_0x240f('0x0'));var events=[_0x240f('0x1'),'remove',_0x240f('0x2')];function createListener(_0x40d757,_0x537f52){return function(_0x35a164){_0x537f52[_0x240f('0x3')](_0x40d757,_0x35a164);};}function removeListener(_0x38d7da,_0x2c8153){return function(){VoicePrefixEvents[_0x240f('0x4')](_0x38d7da,_0x2c8153);};}exports[_0x240f('0x5')]=function(_0x20208b){for(var _0xf6de13=0x0,_0x4b549f=events[_0x240f('0x6')];_0xf6de13<_0x4b549f;_0xf6de13++){var _0x4ded61=events[_0xf6de13];var _0x3e9c1a=createListener('voicePrefix:'+_0x4ded61,_0x20208b);VoicePrefixEvents['on'](_0x4ded61,_0x3e9c1a);}}; \ No newline at end of file +var _0x6650=['update','emit','removeListener','register','voicePrefix:','save','remove'];(function(_0x7adc9f,_0xd98ac9){var _0x8d4c7a=function(_0x37af19){while(--_0x37af19){_0x7adc9f['push'](_0x7adc9f['shift']());}};_0x8d4c7a(++_0xd98ac9);}(_0x6650,0x178));var _0x0665=function(_0x1498be,_0x19f852){_0x1498be=_0x1498be-0x0;var _0x4f4de5=_0x6650[_0x1498be];return _0x4f4de5;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x0665('0x0'),_0x0665('0x1'),_0x0665('0x2')];function createListener(_0x58829d,_0x16a438){return function(_0xf2b309){_0x16a438[_0x0665('0x3')](_0x58829d,_0xf2b309);};}function removeListener(_0xd3b56,_0x3aad6b){return function(){VoicePrefixEvents[_0x0665('0x4')](_0xd3b56,_0x3aad6b);};}exports[_0x0665('0x5')]=function(_0x4fe5ec){for(var _0xb556bd=0x0,_0x5bdb56=events['length'];_0xb556bd<_0x5bdb56;_0xb556bd++){var _0x78d892=events[_0xb556bd];var _0x338e70=createListener(_0x0665('0x6')+_0x78d892,_0x4fe5ec);VoicePrefixEvents['on'](_0x78d892,_0x338e70);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 63c7ffa..cbfdd03 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 _0x0379=['removeLists','removeBlackLists','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','getTeams','getAgents','/:id/members','getMembers','getLists','getBlackLists','post','create','/:id/clone','clone','/:id/teams','addTeams','/:id/lists','/:id/blacklists','addBlackLists','put','/:id','delete','/:id/users','removeAgents'];(function(_0x1ea3dc,_0xdefeba){var _0x5ac7b7=function(_0x55b14b){while(--_0x55b14b){_0x1ea3dc['push'](_0x1ea3dc['shift']());}};_0x5ac7b7(++_0xdefeba);}(_0x0379,0x114));var _0x9037=function(_0x5c8977,_0x10bc2e){_0x5c8977=_0x5c8977-0x0;var _0x5b307f=_0x0379[_0x5c8977];return _0x5b307f;};'use strict';var multer=require(_0x9037('0x0'));var util=require(_0x9037('0x1'));var path=require('path');var express=require(_0x9037('0x2'));var router=express[_0x9037('0x3')]();var auth=require(_0x9037('0x4'));var interaction=require(_0x9037('0x5'));var config=require('../../config/environment');var controller=require(_0x9037('0x6'));router[_0x9037('0x7')]('/',auth['isAuthenticated'](),controller[_0x9037('0x8')]);router[_0x9037('0x7')]('/:id',auth[_0x9037('0x9')](),controller[_0x9037('0xa')]);router[_0x9037('0x7')](_0x9037('0xb'),auth[_0x9037('0x9')](),controller[_0x9037('0xc')]);router[_0x9037('0x7')](_0x9037('0xd'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x9037('0x7')]('/:id/hopper_finals',auth[_0x9037('0x9')](),controller[_0x9037('0xe')]);router[_0x9037('0x7')](_0x9037('0xf'),auth[_0x9037('0x9')](),controller['getHopperBlacks']);router[_0x9037('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0x9037('0x10')]);router[_0x9037('0x7')]('/:id/users',auth[_0x9037('0x9')](),controller[_0x9037('0x11')]);router['get'](_0x9037('0x12'),auth['isAuthenticated'](),controller[_0x9037('0x13')]);router[_0x9037('0x7')]('/:id/lists',auth[_0x9037('0x9')](),controller[_0x9037('0x14')]);router[_0x9037('0x7')]('/:id/blacklists',auth[_0x9037('0x9')](),controller[_0x9037('0x15')]);router[_0x9037('0x16')]('/',auth[_0x9037('0x9')](),controller[_0x9037('0x17')]);router[_0x9037('0x16')](_0x9037('0x18'),auth[_0x9037('0x9')](),controller[_0x9037('0x19')]);router[_0x9037('0x16')](_0x9037('0x1a'),auth[_0x9037('0x9')](),controller[_0x9037('0x1b')]);router[_0x9037('0x16')]('/:id/users',auth[_0x9037('0x9')](),controller['addAgents']);router[_0x9037('0x16')](_0x9037('0x1c'),auth[_0x9037('0x9')](),controller['addLists']);router[_0x9037('0x16')](_0x9037('0x1d'),auth['isAuthenticated'](),controller[_0x9037('0x1e')]);router[_0x9037('0x1f')](_0x9037('0x20'),auth[_0x9037('0x9')](),controller['update']);router['delete'](_0x9037('0x20'),auth[_0x9037('0x9')](),controller['destroy']);router[_0x9037('0x21')](_0x9037('0x1a'),auth[_0x9037('0x9')](),controller['removeTeams']);router[_0x9037('0x21')](_0x9037('0x22'),auth[_0x9037('0x9')](),controller[_0x9037('0x23')]);router[_0x9037('0x21')](_0x9037('0x1c'),auth[_0x9037('0x9')](),controller[_0x9037('0x24')]);router['delete'](_0x9037('0x1d'),auth[_0x9037('0x9')](),controller[_0x9037('0x25')]);module[_0x9037('0x26')]=router; \ No newline at end of file +var _0x8b7c=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHopperHistories','/:id/hopper_finals','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addAgents','addLists','addBlackLists','put','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8b7c,0x119));var _0xc8b7=function(_0x5d3550,_0x107033){_0x5d3550=_0x5d3550-0x0;var _0x5d1299=_0x8b7c[_0x5d3550];return _0x5d1299;};'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('./voiceQueue.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['getHoppers']);router[_0xc8b7('0x8')]('/:id/hopper_histories',auth[_0xc8b7('0x9')](),controller[_0xc8b7('0xe')]);router[_0xc8b7('0x8')](_0xc8b7('0xf'),auth[_0xc8b7('0x9')](),controller['getHopperFinals']);router['get']('/:id/hopper_black',auth[_0xc8b7('0x9')](),controller[_0xc8b7('0x10')]);router[_0xc8b7('0x8')](_0xc8b7('0x11'),auth['isAuthenticated'](),controller['getTeams']);router['get'](_0xc8b7('0x12'),auth[_0xc8b7('0x9')](),controller[_0xc8b7('0x13')]);router['get'](_0xc8b7('0x14'),auth[_0xc8b7('0x9')](),controller[_0xc8b7('0x15')]);router[_0xc8b7('0x8')](_0xc8b7('0x16'),auth['isAuthenticated'](),controller[_0xc8b7('0x17')]);router[_0xc8b7('0x8')](_0xc8b7('0x18'),auth[_0xc8b7('0x9')](),controller[_0xc8b7('0x19')]);router[_0xc8b7('0x1a')]('/',auth[_0xc8b7('0x9')](),controller['create']);router['post'](_0xc8b7('0x1b'),auth[_0xc8b7('0x9')](),controller[_0xc8b7('0x1c')]);router['post']('/:id/teams',auth[_0xc8b7('0x9')](),controller['addTeams']);router[_0xc8b7('0x1a')]('/:id/users',auth[_0xc8b7('0x9')](),controller[_0xc8b7('0x1d')]);router['post'](_0xc8b7('0x16'),auth['isAuthenticated'](),controller[_0xc8b7('0x1e')]);router[_0xc8b7('0x1a')](_0xc8b7('0x18'),auth['isAuthenticated'](),controller[_0xc8b7('0x1f')]);router[_0xc8b7('0x20')](_0xc8b7('0xb'),auth['isAuthenticated'](),controller[_0xc8b7('0x21')]);router[_0xc8b7('0x22')](_0xc8b7('0xb'),auth[_0xc8b7('0x9')](),controller[_0xc8b7('0x23')]);router[_0xc8b7('0x22')](_0xc8b7('0x11'),auth[_0xc8b7('0x9')](),controller[_0xc8b7('0x24')]);router[_0xc8b7('0x22')](_0xc8b7('0x12'),auth['isAuthenticated'](),controller[_0xc8b7('0x25')]);router[_0xc8b7('0x22')](_0xc8b7('0x16'),auth[_0xc8b7('0x9')](),controller[_0xc8b7('0x26')]);router[_0xc8b7('0x22')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xc8b7('0x27')]);module[_0xc8b7('0x28')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index b21d15b..3e88633 100644 --- a/server/api/voiceQueue/voiceQueue.attributes.js +++ b/server/api/voiceQueue/voiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','sequelize','STRING','name','ENUM','outbound','inbound','default','leastrecent','fewestcalls','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','strategy','getDataValue','type','dialMethod','booked','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','split','join','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length'];(function(_0x1b5e02,_0xe22480){var _0x340fd5=function(_0x51214d){while(--_0x51214d){_0x1b5e02['push'](_0x1b5e02['shift']());}};_0x340fd5(++_0xe22480);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b0211,_0x17f347){_0x4b0211=_0x4b0211-0x0;var _0x1906fc=_0xb10b[_0x4b0211];return _0x1906fc;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xbb10('0x3')]('inbound',_0xbb10('0x4')),'allowNull':![],'defaultValue':_0xbb10('0x5')},'musiconhold':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':_0xbb10('0x6')},'announce':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0xbb10('0x3')]('rr','ringall',_0xbb10('0x7'),_0xbb10('0x8'),'random',_0xbb10('0x9'),_0xbb10('0xa'),_0xbb10('0xb'),_0xbb10('0xc')),'allowNull':![],'defaultValue':_0xbb10('0xd'),'set':function(_0x1ce33e){this[_0xbb10('0xe')](_0xbb10('0xf'),_0x1ce33e?_0x1ce33e:'rrmemory');},'get':function(){var _0x4e47f8=this[_0xbb10('0x10')](_0xbb10('0x11'));var _0xce64f3=this['getDataValue'](_0xbb10('0x12'));var _0x5be7e0=this[_0xbb10('0x10')](_0xbb10('0xf'));if(_0x4e47f8===_0xbb10('0x5')){return _0x5be7e0;}if(_0xce64f3===_0xbb10('0x13')&&_0x5be7e0===_0xbb10('0x9')||_0xce64f3===_0xbb10('0x13')&&_0x5be7e0==='roundrobin'){return _0x5be7e0;}if(_0xce64f3===_0xbb10('0x14')||_0xce64f3===_0xbb10('0x15')||_0xce64f3===_0xbb10('0x16')){return _0x5be7e0;}return null;}},'servicelevel':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xbb10('0x17')](0xb)},'timeout':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xbb10('0x1')]},'weight':{'type':Sequelize[_0xbb10('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':_0xbb10('0x18')},'autopause':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no',_0xbb10('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xbb10('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xbb10('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xbb10('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':_0xbb10('0x18')},'announce_holdtime':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no',_0xbb10('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xbb10('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xbb10('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xbb10('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xbb10('0x1')]},'queue_quantity2':{'type':Sequelize[_0xbb10('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0xbb10('0x1')]},'queue_less_than':{'type':Sequelize[_0xbb10('0x1')]},'periodic_announce':{'type':Sequelize[_0xbb10('0x1b')],'set':function(_0x2ff4c1){this['setDataValue'](_0xbb10('0x1c'),_0x2ff4c1?_0x2ff4c1['join'](','):[]);},'get':function(){return this[_0xbb10('0x10')]('periodic_announce')?this[_0xbb10('0x10')](_0xbb10('0x1c'))[_0xbb10('0x1d')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x4c3744){this[_0xbb10('0xe')]('joinempty',_0x4c3744?_0x4c3744[_0xbb10('0x1e')](','):[]);},'get':function(){return this[_0xbb10('0x10')](_0xbb10('0x1f'))?this[_0xbb10('0x10')](_0xbb10('0x1f'))[_0xbb10('0x1d')](','):[];}},'leavewhenempty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':'no','set':function(_0x4975f5){this[_0xbb10('0xe')](_0xbb10('0x20'),_0x4975f5?_0x4975f5[_0xbb10('0x1e')](','):[]);},'get':function(){return this[_0xbb10('0x10')](_0xbb10('0x20'))?this[_0xbb10('0x10')](_0xbb10('0x20'))[_0xbb10('0x1d')](','):[];}},'reportholdtime':{'type':Sequelize[_0xbb10('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xbb10('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xbb10('0x1')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x3eb3cc){this[_0xbb10('0xe')](_0xbb10('0x21'),_0x3eb3cc);if(_0x3eb3cc){if(this[_0xbb10('0x10')](_0xbb10('0x22'))<0x2){this[_0xbb10('0xe')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xbb10('0x23')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM']('preview',_0xbb10('0x14'),_0xbb10('0x16'),_0xbb10('0x15'),'booked'),'defaultValue':_0xbb10('0x14'),'comment':_0xbb10('0x24')},'dialLimitChannel':{'type':Sequelize[_0xbb10('0x17')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xbb10('0x25')},'dialLimitQueue':{'type':Sequelize[_0xbb10('0x17')](0x4)[_0xbb10('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xbb10('0x27')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xbb10('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xbb10('0x28')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xbb10('0x29'),_0xbb10('0x2a')),'defaultValue':_0xbb10('0x2a'),'comment':_0xbb10('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xbb10('0x2c')](0x2)[_0xbb10('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xbb10('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0xbb10('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbb10('0x2e')},'dialQueueOptions':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':'tTxX','comment':_0xbb10('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0xbb10('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0xbb10('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xbb10('0x17')](0x5)[_0xbb10('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbb10('0x30')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xbb10('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbb10('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0xbb10('0x17')](0x5)[_0xbb10('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbb10('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'defaultValue':0x3,'comment':_0xbb10('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xbb10('0x17')](0x5)[_0xbb10('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbb10('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0xbb10('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xbb10('0x35')},'dialTimezone':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xbb10('0x36')},'dialPrefix':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x37'),_0xbb10('0x38'),_0xbb10('0x39')),'defaultValue':_0xbb10('0x37')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xbb10('0x3a')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xbb10('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xbb10('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbb10('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xbb10('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xbb10('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xbb10('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xbb10('0x17')](0x5)[_0xbb10('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xbb10('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbb10('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0xbb10('0x17')](0x5)[_0xbb10('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xbb10('0x43')},'dialRecallInQueue':{'type':Sequelize[_0xbb10('0x23')],'defaultValue':0x0,'comment':_0xbb10('0x44')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xbb10('0x45'),'ASC'),'defaultValue':_0xbb10('0x45')},'dialQueueProject2':{'type':Sequelize[_0xbb10('0x1')],'comment':_0xbb10('0x46')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xbb10('0x23')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xbb10('0x23')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbb10('0x47')},'dialCutDigit':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbb10('0x48')}}; \ No newline at end of file +var _0xb10b=['#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','sequelize','STRING','name','ENUM','outbound','inbound','default','leastrecent','fewestcalls','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','strategy','getDataValue','type','dialMethod','booked','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','split','join','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length'];(function(_0x2baf64,_0x5ddeda){var _0x52f0cd=function(_0x31bf9c){while(--_0x31bf9c){_0x2baf64['push'](_0x2baf64['shift']());}};_0x52f0cd(++_0x5ddeda);}(_0xb10b,0x12a));var _0xbb10=function(_0x125b80,_0x41db3b){_0x125b80=_0x125b80-0x0;var _0x414ba8=_0xb10b[_0x125b80];return _0x414ba8;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xbb10('0x3')]('inbound',_0xbb10('0x4')),'allowNull':![],'defaultValue':_0xbb10('0x5')},'musiconhold':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':_0xbb10('0x6')},'announce':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0xbb10('0x3')]('rr','ringall',_0xbb10('0x7'),_0xbb10('0x8'),'random',_0xbb10('0x9'),_0xbb10('0xa'),_0xbb10('0xb'),_0xbb10('0xc')),'allowNull':![],'defaultValue':_0xbb10('0xd'),'set':function(_0x1ce33e){this[_0xbb10('0xe')](_0xbb10('0xf'),_0x1ce33e?_0x1ce33e:'rrmemory');},'get':function(){var _0x4e47f8=this[_0xbb10('0x10')](_0xbb10('0x11'));var _0xce64f3=this['getDataValue'](_0xbb10('0x12'));var _0x5be7e0=this[_0xbb10('0x10')](_0xbb10('0xf'));if(_0x4e47f8===_0xbb10('0x5')){return _0x5be7e0;}if(_0xce64f3===_0xbb10('0x13')&&_0x5be7e0===_0xbb10('0x9')||_0xce64f3===_0xbb10('0x13')&&_0x5be7e0==='roundrobin'){return _0x5be7e0;}if(_0xce64f3===_0xbb10('0x14')||_0xce64f3===_0xbb10('0x15')||_0xce64f3===_0xbb10('0x16')){return _0x5be7e0;}return null;}},'servicelevel':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xbb10('0x17')](0xb)},'timeout':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xbb10('0x1')]},'weight':{'type':Sequelize[_0xbb10('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':_0xbb10('0x18')},'autopause':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no',_0xbb10('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xbb10('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xbb10('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xbb10('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':_0xbb10('0x18')},'announce_holdtime':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no',_0xbb10('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xbb10('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xbb10('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xbb10('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xbb10('0x1')]},'queue_quantity2':{'type':Sequelize[_0xbb10('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0xbb10('0x1')]},'queue_less_than':{'type':Sequelize[_0xbb10('0x1')]},'periodic_announce':{'type':Sequelize[_0xbb10('0x1b')],'set':function(_0x2ff4c1){this['setDataValue'](_0xbb10('0x1c'),_0x2ff4c1?_0x2ff4c1['join'](','):[]);},'get':function(){return this[_0xbb10('0x10')]('periodic_announce')?this[_0xbb10('0x10')](_0xbb10('0x1c'))[_0xbb10('0x1d')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x4c3744){this[_0xbb10('0xe')]('joinempty',_0x4c3744?_0x4c3744[_0xbb10('0x1e')](','):[]);},'get':function(){return this[_0xbb10('0x10')](_0xbb10('0x1f'))?this[_0xbb10('0x10')](_0xbb10('0x1f'))[_0xbb10('0x1d')](','):[];}},'leavewhenempty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':'no','set':function(_0x4975f5){this[_0xbb10('0xe')](_0xbb10('0x20'),_0x4975f5?_0x4975f5[_0xbb10('0x1e')](','):[]);},'get':function(){return this[_0xbb10('0x10')](_0xbb10('0x20'))?this[_0xbb10('0x10')](_0xbb10('0x20'))[_0xbb10('0x1d')](','):[];}},'reportholdtime':{'type':Sequelize[_0xbb10('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xbb10('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xbb10('0x1')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x3eb3cc){this[_0xbb10('0xe')](_0xbb10('0x21'),_0x3eb3cc);if(_0x3eb3cc){if(this[_0xbb10('0x10')](_0xbb10('0x22'))<0x2){this[_0xbb10('0xe')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xbb10('0x23')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM']('preview',_0xbb10('0x14'),_0xbb10('0x16'),_0xbb10('0x15'),'booked'),'defaultValue':_0xbb10('0x14'),'comment':_0xbb10('0x24')},'dialLimitChannel':{'type':Sequelize[_0xbb10('0x17')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xbb10('0x25')},'dialLimitQueue':{'type':Sequelize[_0xbb10('0x17')](0x4)[_0xbb10('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xbb10('0x27')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xbb10('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xbb10('0x28')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xbb10('0x29'),_0xbb10('0x2a')),'defaultValue':_0xbb10('0x2a'),'comment':_0xbb10('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xbb10('0x2c')](0x2)[_0xbb10('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xbb10('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0xbb10('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbb10('0x2e')},'dialQueueOptions':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':'tTxX','comment':_0xbb10('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0xbb10('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0xbb10('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xbb10('0x17')](0x5)[_0xbb10('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbb10('0x30')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xbb10('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbb10('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0xbb10('0x17')](0x5)[_0xbb10('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbb10('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'defaultValue':0x3,'comment':_0xbb10('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xbb10('0x17')](0x5)[_0xbb10('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbb10('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0xbb10('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xbb10('0x35')},'dialTimezone':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xbb10('0x36')},'dialPrefix':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x37'),_0xbb10('0x38'),_0xbb10('0x39')),'defaultValue':_0xbb10('0x37')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xbb10('0x3a')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xbb10('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xbb10('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbb10('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xbb10('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xbb10('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xbb10('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xbb10('0x17')](0x5)[_0xbb10('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xbb10('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbb10('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0xbb10('0x17')](0x5)[_0xbb10('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xbb10('0x43')},'dialRecallInQueue':{'type':Sequelize[_0xbb10('0x23')],'defaultValue':0x0,'comment':_0xbb10('0x44')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xbb10('0x45'),'ASC'),'defaultValue':_0xbb10('0x45')},'dialQueueProject2':{'type':Sequelize[_0xbb10('0x1')],'comment':_0xbb10('0x46')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xbb10('0x23')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xbb10('0x23')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbb10('0x47')},'dialCutDigit':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbb10('0x48')}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index f8524a5..07f8c7b 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 _0x9076=['toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','VoiceQueueId\x20=\x20?','from','onlyIfOpen','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','socket.io-emitter','localhost','./voiceQueue.socket','register','sendStatus','end','status','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','index','VoiceQueue','keys','query','dateEnd','dateStart','filters','model','attributes','fields','length','nolimit','order','sort','pick','add','where','merge','map','filter','count','include','findAll','catch','params','intersection','includeAll','options','create','clone','find','get','omit','createdAt','updatedAt','body','findOne','CmHopper','rawAttributes','rows','CmHopperHistory','getHopperFinals','hasOwnProperty','VoiceQueueId','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','ids','User','Agents','addAgents','penalty','union','userVoiceQueue:save','loginInPause','voicePause','format','%s/%s','all','removeAgents','emit','userVoiceQueue:remove','realtime','UserVoiceQueueRt','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','field','phone','NOW()','CmListId'];(function(_0x125ed8,_0x4d1612){var _0x53fcc7=function(_0x43b101){while(--_0x43b101){_0x125ed8['push'](_0x125ed8['shift']());}};_0x53fcc7(++_0x4d1612);}(_0x9076,0xa0));var _0x6907=function(_0x44056e,_0x20bb63){_0x44056e=_0x44056e-0x0;var _0x161c2b=_0x9076[_0x44056e];return _0x161c2b;};'use strict';var jsonpatch=require(_0x6907('0x0'));var rp=require('request-promise');var moment=require(_0x6907('0x1'));var BPromise=require(_0x6907('0x2'));var Mustache=require(_0x6907('0x3'));var util=require('util');var path=require(_0x6907('0x4'));var sox=require(_0x6907('0x5'));var csv=require(_0x6907('0x6'));var ejs=require(_0x6907('0x7'));var fs=require('fs');var _=require(_0x6907('0x8'));var squel=require(_0x6907('0x9'));var crypto=require(_0x6907('0xa'));var jsforce=require(_0x6907('0xb'));var deskjs=require(_0x6907('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6907('0xd'));var Papa=require('papaparse');var qs=require(_0x6907('0xe'));var logger=require(_0x6907('0xf'))(_0x6907('0x10'));var utils=require(_0x6907('0x11'));var config=require('../../config/environment');var db=require(_0x6907('0x12'))['db'];var socket=require(_0x6907('0x13'))({'host':_0x6907('0x14'),'port':0x18eb});require(_0x6907('0x15'))[_0x6907('0x16')](socket);function respondWithStatusCode(_0x2de5cd,_0x4182c2){_0x4182c2=_0x4182c2||0xcc;return function(_0x4554b3){if(_0x4554b3){return _0x2de5cd[_0x6907('0x17')](_0x4182c2);}return _0x2de5cd['status'](_0x4182c2)[_0x6907('0x18')]();};}function respondWithResult(_0x23297,_0x196335){_0x196335=_0x196335||0xc8;return function(_0x322a7b){if(_0x322a7b){return _0x23297[_0x6907('0x19')](_0x196335)['json'](_0x322a7b);}};}function respondWithFilteredResult(_0x1dc2ce,_0x4f8503){return function(_0x1099da){if(_0x1099da){var _0x25b108=_0x1099da['count'],_0x256fe9=_0x4f8503['offset'],_0x228f9d=_0x4f8503[_0x6907('0x1a')]+_0x4f8503[_0x6907('0x1b')],_0x5b5fdb;if(_0x228f9d>=_0x25b108){_0x228f9d=_0x25b108;_0x5b5fdb=0xc8;}else{_0x5b5fdb=0xce;}_0x1dc2ce[_0x6907('0x19')](_0x5b5fdb);return _0x1dc2ce[_0x6907('0x1c')](_0x6907('0x1d'),_0x256fe9+'-'+_0x228f9d+'/'+_0x25b108)['json'](_0x1099da);}return null;};}function patchUpdates(_0x59cb90){return function(_0x1e8452){try{jsonpatch['apply'](_0x1e8452,_0x59cb90,!![]);}catch(_0x36cd22){return BPromise[_0x6907('0x1e')](_0x36cd22);}return _0x1e8452[_0x6907('0x1f')]();};}function saveUpdates(_0x2b37b1,_0xc29219){return function(_0xf2c344){if(_0xf2c344){return _0xf2c344['update'](_0x2b37b1)[_0x6907('0x20')](function(_0x41ea32){return _0x41ea32;});}return null;};}function removeEntity(_0x1831e7,_0x473d93){return function(_0x44a804){if(_0x44a804){return _0x44a804[_0x6907('0x21')]()[_0x6907('0x20')](function(){_0x1831e7[_0x6907('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a259b,_0x53773f){return function(_0x5c6468){if(!_0x5c6468){_0x2a259b['sendStatus'](0x194);}return _0x5c6468;};}function handleError(_0x393af2,_0x2c9944){_0x2c9944=_0x2c9944||0x1f4;return function(_0x22493b){logger[_0x6907('0x22')](_0x22493b[_0x6907('0x23')]);if(_0x22493b[_0x6907('0x24')]){delete _0x22493b[_0x6907('0x24')];}_0x393af2[_0x6907('0x19')](_0x2c9944)['send'](_0x22493b);};}exports[_0x6907('0x25')]=function(_0x230e09,_0x26b34e){var _0x177921={},_0x427c02={},_0x42bdbe={'count':0x0,'rows':[]};var _0x59d5ba=db[_0x6907('0x26')]['rawAttributes'];_0x427c02['model']=_[_0x6907('0x27')](_0x59d5ba);var _0x194ec6={'dateStart':_0x230e09[_0x6907('0x28')]['dateStart'],'dateEnd':_0x230e09[_0x6907('0x28')][_0x6907('0x29')]};delete _0x230e09[_0x6907('0x28')][_0x6907('0x2a')];delete _0x230e09[_0x6907('0x28')][_0x6907('0x29')];_0x427c02[_0x6907('0x28')]=_[_0x6907('0x27')](_0x230e09[_0x6907('0x28')]);_0x427c02[_0x6907('0x2b')]=_['intersection'](_0x427c02[_0x6907('0x2c')],_0x427c02[_0x6907('0x28')]);_0x177921[_0x6907('0x2d')]=_['intersection'](_0x427c02[_0x6907('0x2c')],qs[_0x6907('0x2e')](_0x230e09[_0x6907('0x28')][_0x6907('0x2e')]));_0x177921['attributes']=_0x177921['attributes'][_0x6907('0x2f')]?_0x177921['attributes']:_0x427c02[_0x6907('0x2c')];if(!_0x230e09['query']['hasOwnProperty'](_0x6907('0x30'))){_0x177921[_0x6907('0x1b')]=qs['limit'](_0x230e09[_0x6907('0x28')][_0x6907('0x1b')]);_0x177921['offset']=qs[_0x6907('0x1a')](_0x230e09[_0x6907('0x28')][_0x6907('0x1a')]);}_0x177921[_0x6907('0x31')]=qs[_0x6907('0x32')](_0x230e09[_0x6907('0x28')][_0x6907('0x32')]);_0x177921['where']=qs[_0x6907('0x2b')](_[_0x6907('0x33')](_0x230e09[_0x6907('0x28')],_0x427c02['filters']));if(_0x194ec6[_0x6907('0x2a')]){if(_0x194ec6[_0x6907('0x29')]){_0x194ec6[_0x6907('0x29')]=moment(_0x194ec6[_0x6907('0x29')])[_0x6907('0x34')](0x1,'day');}else{_0x194ec6['dateEnd']=moment(_0x194ec6['dateStart'])[_0x6907('0x34')](0x1,'day');}_['merge'](_0x177921[_0x6907('0x35')],{'createdAt':{'$gte':_0x194ec6[_0x6907('0x2a')],'$lte':_0x194ec6['dateEnd']}});}if(_0x230e09['query']['filter']){_0x177921[_0x6907('0x35')]=_[_0x6907('0x36')](_0x177921[_0x6907('0x35')],{'$or':_[_0x6907('0x37')](_0x177921[_0x6907('0x2d')],function(_0x183f6f){var _0x4eba39={};_0x4eba39[_0x183f6f]={'$like':'%'+_0x230e09[_0x6907('0x28')][_0x6907('0x38')]+'%'};return _0x4eba39;})});}_0x177921=_[_0x6907('0x36')]({},_0x177921,_0x230e09['options']);var _0xb52b3c={'where':_0x177921[_0x6907('0x35')]};return db[_0x6907('0x26')][_0x6907('0x39')](_0xb52b3c)['then'](function(_0x498c02){_0x42bdbe[_0x6907('0x39')]=_0x498c02;if(_0x230e09[_0x6907('0x28')]['includeAll']){_0x177921[_0x6907('0x3a')]=[{'all':!![]}];}return db[_0x6907('0x26')][_0x6907('0x3b')](_0x177921);})['then'](function(_0x19b0fe){_0x42bdbe['rows']=_0x19b0fe;return _0x42bdbe;})[_0x6907('0x20')](respondWithFilteredResult(_0x26b34e,_0x177921))[_0x6907('0x3c')](handleError(_0x26b34e,null));};exports['show']=function(_0x4c1792,_0x28d069){var _0x214698={'raw':![],'where':{'id':_0x4c1792[_0x6907('0x3d')]['id']}},_0x49bef0={};_0x49bef0[_0x6907('0x2c')]=_['keys'](db[_0x6907('0x26')]['rawAttributes']);_0x49bef0[_0x6907('0x28')]=_['keys'](_0x4c1792[_0x6907('0x28')]);_0x49bef0[_0x6907('0x2b')]=_[_0x6907('0x3e')](_0x49bef0[_0x6907('0x2c')],_0x49bef0[_0x6907('0x28')]);_0x214698[_0x6907('0x2d')]=_[_0x6907('0x3e')](_0x49bef0[_0x6907('0x2c')],qs[_0x6907('0x2e')](_0x4c1792[_0x6907('0x28')][_0x6907('0x2e')]));_0x214698[_0x6907('0x2d')]=_0x214698[_0x6907('0x2d')][_0x6907('0x2f')]?_0x214698[_0x6907('0x2d')]:_0x49bef0[_0x6907('0x2c')];if(_0x4c1792['query'][_0x6907('0x3f')]){_0x214698[_0x6907('0x3a')]=[{'all':!![]}];}_0x214698=_[_0x6907('0x36')]({},_0x214698,_0x4c1792[_0x6907('0x40')]);return db[_0x6907('0x26')]['find'](_0x214698)['then'](handleEntityNotFound(_0x28d069,null))[_0x6907('0x20')](respondWithResult(_0x28d069,null))[_0x6907('0x3c')](handleError(_0x28d069,null));};exports['create']=function(_0x20cc3f,_0x2ba08e){return db[_0x6907('0x26')][_0x6907('0x41')](_0x20cc3f['body'],{})[_0x6907('0x20')](respondWithResult(_0x2ba08e,0xc9))[_0x6907('0x3c')](handleError(_0x2ba08e,null));};exports[_0x6907('0x42')]=function(_0x121d33,_0x398159){var _0x59de9a={'raw':![],'where':{'id':_0x121d33[_0x6907('0x3d')]['id']}},_0x5b9317={};_0x5b9317[_0x6907('0x2c')]=_['keys'](db[_0x6907('0x26')]['rawAttributes']);_0x59de9a[_0x6907('0x2d')]=_['intersection'](_0x5b9317[_0x6907('0x2c')],qs['fields'](_0x121d33['query'][_0x6907('0x2e')]));_0x59de9a[_0x6907('0x2d')]=_0x59de9a[_0x6907('0x2d')][_0x6907('0x2f')]?_0x59de9a['attributes']:_0x5b9317['model'];if(_0x121d33[_0x6907('0x28')][_0x6907('0x3f')]){_0x59de9a[_0x6907('0x3a')]=[{'all':!![]}];}_0x59de9a=_[_0x6907('0x36')]({},_0x59de9a,_0x121d33['options']);return db[_0x6907('0x26')][_0x6907('0x43')](_0x59de9a)['then'](handleEntityNotFound(_0x398159,null))[_0x6907('0x20')](function(_0x176a99){if(_0x176a99){var _0x7df169=_0x176a99[_0x6907('0x44')]({'plain':!![]});_0x7df169=qs[_0x6907('0x45')](_0x7df169,['id',_0x6907('0x46'),'updatedAt']);_0x121d33['body']=_[_0x6907('0x45')](_0x121d33['body'],['id',_0x6907('0x46'),_0x6907('0x47')]);return db['VoiceQueue'][_0x6907('0x41')](_[_0x6907('0x36')](_0x7df169,_0x121d33[_0x6907('0x48')]),{'include':_0x121d33['query'][_0x6907('0x3f')]?[{'all':!![]}]:undefined});}})[_0x6907('0x20')](respondWithResult(_0x398159,0xc9))[_0x6907('0x3c')](handleError(_0x398159,null));};exports['update']=function(_0x5a4e1b,_0xbd1be5){if(_0x5a4e1b[_0x6907('0x48')]['id']){delete _0x5a4e1b[_0x6907('0x48')]['id'];}return db[_0x6907('0x26')][_0x6907('0x43')]({'where':{'id':_0x5a4e1b[_0x6907('0x3d')]['id']}})[_0x6907('0x20')](handleEntityNotFound(_0xbd1be5,null))['then'](saveUpdates(_0x5a4e1b[_0x6907('0x48')],null))[_0x6907('0x20')](respondWithResult(_0xbd1be5,null))[_0x6907('0x3c')](handleError(_0xbd1be5,null));};exports[_0x6907('0x21')]=function(_0x18c359,_0x12c1a4){return db[_0x6907('0x26')][_0x6907('0x43')]({'where':{'id':_0x18c359[_0x6907('0x3d')]['id']}})[_0x6907('0x20')](handleEntityNotFound(_0x12c1a4,null))[_0x6907('0x20')](removeEntity(_0x12c1a4,null))[_0x6907('0x3c')](handleError(_0x12c1a4,null));};exports['getHoppers']=function(_0x10b591,_0x19330f,_0x17d408){var _0x3cac98={'raw':![],'where':{}};var _0x11aad2={};var _0x279bdb={'count':0x0,'rows':[]};return db[_0x6907('0x26')][_0x6907('0x49')]({'where':{'id':_0x10b591['params']['id']}})[_0x6907('0x20')](handleEntityNotFound(_0x19330f,null))[_0x6907('0x20')](function(_0x199720){if(_0x199720){_0x11aad2[_0x6907('0x2c')]=_[_0x6907('0x27')](db[_0x6907('0x4a')][_0x6907('0x4b')]);_0x11aad2[_0x6907('0x28')]=_['keys'](_0x10b591[_0x6907('0x28')]);_0x11aad2[_0x6907('0x2b')]=_[_0x6907('0x3e')](_0x11aad2[_0x6907('0x2c')],_0x11aad2['query']);_0x3cac98['attributes']=_[_0x6907('0x3e')](_0x11aad2[_0x6907('0x2c')],qs[_0x6907('0x2e')](_0x10b591[_0x6907('0x28')][_0x6907('0x2e')]));_0x3cac98['attributes']=_0x3cac98['attributes']['length']?_0x3cac98[_0x6907('0x2d')]:_0x11aad2[_0x6907('0x2c')];if(!_0x10b591[_0x6907('0x28')]['hasOwnProperty']('nolimit')){_0x3cac98[_0x6907('0x1b')]=qs[_0x6907('0x1b')](_0x10b591[_0x6907('0x28')]['limit']);_0x3cac98[_0x6907('0x1a')]=qs[_0x6907('0x1a')](_0x10b591[_0x6907('0x28')][_0x6907('0x1a')]);}_0x3cac98['order']=qs['sort'](_0x10b591[_0x6907('0x28')][_0x6907('0x32')]);_0x3cac98[_0x6907('0x35')]=qs[_0x6907('0x2b')](_[_0x6907('0x33')](_0x10b591[_0x6907('0x28')],_0x11aad2[_0x6907('0x2b')]));_0x3cac98['where']['VoiceQueueId']=_0x199720['id'];if(_0x10b591['query']['filter']){_0x3cac98['where']=_[_0x6907('0x36')](_0x3cac98['where'],{'$or':_[_0x6907('0x37')](_0x3cac98['attributes'],function(_0x1e57c2){var _0x48b5f4={};_0x48b5f4[_0x1e57c2]={'$like':'%'+_0x10b591['query'][_0x6907('0x38')]+'%'};return _0x48b5f4;})});}_0x3cac98=_['merge']({},_0x3cac98,_0x10b591['options']);return db[_0x6907('0x4a')][_0x6907('0x39')]({'where':_0x3cac98['where']})[_0x6907('0x20')](function(_0x53745a){_0x279bdb['count']=_0x53745a;if(_0x10b591[_0x6907('0x28')][_0x6907('0x3f')]){_0x3cac98['include']=[{'all':!![]}];}return db[_0x6907('0x4a')][_0x6907('0x3b')](_0x3cac98);})[_0x6907('0x20')](function(_0x5d4d1b){_0x279bdb[_0x6907('0x4c')]=_0x5d4d1b;return _0x279bdb;});}})[_0x6907('0x20')](respondWithFilteredResult(_0x19330f,_0x3cac98))[_0x6907('0x3c')](handleError(_0x19330f,null));};exports['getHopperHistories']=function(_0x8b01f3,_0x67d051,_0x47e045){var _0x310402={'raw':!![],'where':{}};var _0x274e03={};var _0x276c0d={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x6907('0x49')]({'where':{'id':_0x8b01f3[_0x6907('0x3d')]['id']}})[_0x6907('0x20')](handleEntityNotFound(_0x67d051,null))[_0x6907('0x20')](function(_0x3dac92){if(_0x3dac92){_0x274e03[_0x6907('0x2c')]=_[_0x6907('0x27')](db[_0x6907('0x4d')]['rawAttributes']);_0x274e03[_0x6907('0x28')]=_[_0x6907('0x27')](_0x8b01f3['query']);_0x274e03[_0x6907('0x2b')]=_['intersection'](_0x274e03[_0x6907('0x2c')],_0x274e03[_0x6907('0x28')]);_0x310402[_0x6907('0x2d')]=_['intersection'](_0x274e03['model'],qs['fields'](_0x8b01f3['query'][_0x6907('0x2e')]));_0x310402[_0x6907('0x2d')]=_0x310402[_0x6907('0x2d')][_0x6907('0x2f')]?_0x310402[_0x6907('0x2d')]:_0x274e03['model'];if(!_0x8b01f3[_0x6907('0x28')]['hasOwnProperty'](_0x6907('0x30'))){_0x310402['limit']=qs[_0x6907('0x1b')](_0x8b01f3[_0x6907('0x28')]['limit']);_0x310402[_0x6907('0x1a')]=qs[_0x6907('0x1a')](_0x8b01f3['query'][_0x6907('0x1a')]);}_0x310402[_0x6907('0x31')]=qs[_0x6907('0x32')](_0x8b01f3[_0x6907('0x28')][_0x6907('0x32')]);_0x310402[_0x6907('0x35')]=qs[_0x6907('0x2b')](_[_0x6907('0x33')](_0x8b01f3['query'],_0x274e03[_0x6907('0x2b')]));_0x310402['where']['VoiceQueueId']=_0x3dac92['id'];if(_0x8b01f3[_0x6907('0x28')]['filter']){_0x310402[_0x6907('0x35')]=_[_0x6907('0x36')](_0x310402[_0x6907('0x35')],{'$or':_[_0x6907('0x37')](_0x310402['attributes'],function(_0x3ce954){var _0xb764c4={};_0xb764c4[_0x3ce954]={'$like':'%'+_0x8b01f3[_0x6907('0x28')][_0x6907('0x38')]+'%'};return _0xb764c4;})});}_0x310402=_['merge']({},_0x310402,_0x8b01f3[_0x6907('0x40')]);return db[_0x6907('0x4d')][_0x6907('0x39')]({'where':_0x310402[_0x6907('0x35')]})['then'](function(_0x5c81d8){_0x276c0d['count']=_0x5c81d8;if(_0x8b01f3[_0x6907('0x28')][_0x6907('0x3f')]){_0x310402[_0x6907('0x3a')]=[{'all':!![]}];}return db[_0x6907('0x4d')][_0x6907('0x3b')](_0x310402);})[_0x6907('0x20')](function(_0x38a254){_0x276c0d[_0x6907('0x4c')]=_0x38a254;return _0x276c0d;});}})[_0x6907('0x20')](respondWithFilteredResult(_0x67d051,_0x310402))[_0x6907('0x3c')](handleError(_0x67d051,null));};exports[_0x6907('0x4e')]=function(_0x483987,_0x466ce7,_0x27ddee){var _0x4806f2={'raw':!![],'where':{}};var _0x4dab4d={};var _0x18dbe4={'count':0x0,'rows':[]};return db[_0x6907('0x26')][_0x6907('0x49')]({'where':{'id':_0x483987['params']['id']}})[_0x6907('0x20')](handleEntityNotFound(_0x466ce7,null))[_0x6907('0x20')](function(_0x318597){if(_0x318597){_0x4dab4d[_0x6907('0x2c')]=_[_0x6907('0x27')](db['CmHopperFinal'][_0x6907('0x4b')]);_0x4dab4d['query']=_[_0x6907('0x27')](_0x483987['query']);_0x4dab4d[_0x6907('0x2b')]=_[_0x6907('0x3e')](_0x4dab4d[_0x6907('0x2c')],_0x4dab4d[_0x6907('0x28')]);_0x4806f2[_0x6907('0x2d')]=_[_0x6907('0x3e')](_0x4dab4d[_0x6907('0x2c')],qs[_0x6907('0x2e')](_0x483987[_0x6907('0x28')]['fields']));_0x4806f2[_0x6907('0x2d')]=_0x4806f2[_0x6907('0x2d')]['length']?_0x4806f2[_0x6907('0x2d')]:_0x4dab4d['model'];if(!_0x483987[_0x6907('0x28')][_0x6907('0x4f')](_0x6907('0x30'))){_0x4806f2[_0x6907('0x1b')]=qs[_0x6907('0x1b')](_0x483987['query'][_0x6907('0x1b')]);_0x4806f2[_0x6907('0x1a')]=qs[_0x6907('0x1a')](_0x483987[_0x6907('0x28')][_0x6907('0x1a')]);}_0x4806f2[_0x6907('0x31')]=qs[_0x6907('0x32')](_0x483987[_0x6907('0x28')]['sort']);_0x4806f2[_0x6907('0x35')]=qs[_0x6907('0x2b')](_[_0x6907('0x33')](_0x483987[_0x6907('0x28')],_0x4dab4d[_0x6907('0x2b')]));_0x4806f2[_0x6907('0x35')][_0x6907('0x50')]=_0x318597['id'];if(_0x483987[_0x6907('0x28')][_0x6907('0x38')]){_0x4806f2[_0x6907('0x35')]=_[_0x6907('0x36')](_0x4806f2['where'],{'$or':_['map'](_0x4806f2[_0x6907('0x2d')],function(_0x5c521e){var _0x105e7c={};_0x105e7c[_0x5c521e]={'$like':'%'+_0x483987['query'][_0x6907('0x38')]+'%'};return _0x105e7c;})});}_0x4806f2=_[_0x6907('0x36')]({},_0x4806f2,_0x483987[_0x6907('0x40')]);return db[_0x6907('0x51')]['count']({'where':_0x4806f2[_0x6907('0x35')]})[_0x6907('0x20')](function(_0x39b03e){_0x18dbe4['count']=_0x39b03e;if(_0x483987['query'][_0x6907('0x3f')]){_0x4806f2['include']=[{'all':!![]}];}return db[_0x6907('0x51')][_0x6907('0x3b')](_0x4806f2);})[_0x6907('0x20')](function(_0x25d50c){_0x18dbe4[_0x6907('0x4c')]=_0x25d50c;return _0x18dbe4;});}})['then'](respondWithFilteredResult(_0x466ce7,_0x4806f2))['catch'](handleError(_0x466ce7,null));};exports[_0x6907('0x52')]=function(_0x30d7a3,_0x3f2650,_0x1ff28a){var _0x32e7ef={'raw':!![],'where':{}};var _0x2ab2e4={};var _0x3b8340={'count':0x0,'rows':[]};return db[_0x6907('0x26')][_0x6907('0x49')]({'where':{'id':_0x30d7a3[_0x6907('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3f2650,null))[_0x6907('0x20')](function(_0x1a2e56){if(_0x1a2e56){_0x2ab2e4[_0x6907('0x2c')]=_[_0x6907('0x27')](db[_0x6907('0x53')]['rawAttributes']);_0x2ab2e4[_0x6907('0x28')]=_[_0x6907('0x27')](_0x30d7a3[_0x6907('0x28')]);_0x2ab2e4[_0x6907('0x2b')]=_[_0x6907('0x3e')](_0x2ab2e4['model'],_0x2ab2e4[_0x6907('0x28')]);_0x32e7ef[_0x6907('0x2d')]=_[_0x6907('0x3e')](_0x2ab2e4[_0x6907('0x2c')],qs[_0x6907('0x2e')](_0x30d7a3[_0x6907('0x28')][_0x6907('0x2e')]));_0x32e7ef['attributes']=_0x32e7ef[_0x6907('0x2d')]['length']?_0x32e7ef[_0x6907('0x2d')]:_0x2ab2e4['model'];if(!_0x30d7a3['query'][_0x6907('0x4f')](_0x6907('0x30'))){_0x32e7ef[_0x6907('0x1b')]=qs['limit'](_0x30d7a3[_0x6907('0x28')][_0x6907('0x1b')]);_0x32e7ef[_0x6907('0x1a')]=qs['offset'](_0x30d7a3[_0x6907('0x28')][_0x6907('0x1a')]);}_0x32e7ef[_0x6907('0x31')]=qs[_0x6907('0x32')](_0x30d7a3[_0x6907('0x28')][_0x6907('0x32')]);_0x32e7ef[_0x6907('0x35')]=qs[_0x6907('0x2b')](_[_0x6907('0x33')](_0x30d7a3[_0x6907('0x28')],_0x2ab2e4[_0x6907('0x2b')]));_0x32e7ef[_0x6907('0x35')][_0x6907('0x50')]=_0x1a2e56['id'];if(_0x30d7a3[_0x6907('0x28')]['filter']){_0x32e7ef[_0x6907('0x35')]=_[_0x6907('0x36')](_0x32e7ef[_0x6907('0x35')],{'$or':_[_0x6907('0x37')](_0x32e7ef['attributes'],function(_0x4f0418){var _0x45dbba={};_0x45dbba[_0x4f0418]={'$like':'%'+_0x30d7a3['query'][_0x6907('0x38')]+'%'};return _0x45dbba;})});}_0x32e7ef=_[_0x6907('0x36')]({},_0x32e7ef,_0x30d7a3[_0x6907('0x40')]);return db['CmHopperBlack'][_0x6907('0x39')]({'where':_0x32e7ef[_0x6907('0x35')]})['then'](function(_0x4d1d65){_0x3b8340[_0x6907('0x39')]=_0x4d1d65;if(_0x30d7a3[_0x6907('0x28')][_0x6907('0x3f')]){_0x32e7ef['include']=[{'all':!![]}];}return db[_0x6907('0x53')][_0x6907('0x3b')](_0x32e7ef);})['then'](function(_0x2896fa){_0x3b8340[_0x6907('0x4c')]=_0x2896fa;return _0x3b8340;});}})[_0x6907('0x20')](respondWithFilteredResult(_0x3f2650,_0x32e7ef))[_0x6907('0x3c')](handleError(_0x3f2650,null));};exports[_0x6907('0x54')]=function(_0x44ae8d,_0xcb3f90,_0x1aa878){var _0x227db6={};var _0x492af0={};var _0x1be150;var _0x11615a;return db[_0x6907('0x26')][_0x6907('0x49')]({'where':{'id':_0x44ae8d[_0x6907('0x3d')]['id']}})[_0x6907('0x20')](handleEntityNotFound(_0xcb3f90,null))[_0x6907('0x20')](function(_0x24a3e4){if(_0x24a3e4){_0x1be150=_0x24a3e4;_0x492af0['model']=_[_0x6907('0x27')](db['Team'][_0x6907('0x4b')]);_0x492af0[_0x6907('0x28')]=_[_0x6907('0x27')](_0x44ae8d[_0x6907('0x28')]);_0x492af0[_0x6907('0x2b')]=_[_0x6907('0x3e')](_0x492af0[_0x6907('0x2c')],_0x492af0['query']);_0x227db6[_0x6907('0x2d')]=_[_0x6907('0x3e')](_0x492af0[_0x6907('0x2c')],qs[_0x6907('0x2e')](_0x44ae8d[_0x6907('0x28')][_0x6907('0x2e')]));_0x227db6[_0x6907('0x2d')]=_0x227db6[_0x6907('0x2d')][_0x6907('0x2f')]?_0x227db6[_0x6907('0x2d')]:_0x492af0[_0x6907('0x2c')];_0x227db6[_0x6907('0x31')]=qs[_0x6907('0x32')](_0x44ae8d[_0x6907('0x28')][_0x6907('0x32')]);_0x227db6[_0x6907('0x35')]=qs['filters'](_[_0x6907('0x33')](_0x44ae8d[_0x6907('0x28')],_0x492af0[_0x6907('0x2b')]));if(_0x44ae8d[_0x6907('0x28')][_0x6907('0x38')]){_0x227db6[_0x6907('0x35')]=_[_0x6907('0x36')](_0x227db6[_0x6907('0x35')],{'$or':_[_0x6907('0x37')](_0x227db6[_0x6907('0x2d')],function(_0x8bb280){var _0x3f0e11={};_0x3f0e11[_0x8bb280]={'$like':'%'+_0x44ae8d[_0x6907('0x28')][_0x6907('0x38')]+'%'};return _0x3f0e11;})});}_0x227db6=_[_0x6907('0x36')]({},_0x227db6,_0x44ae8d[_0x6907('0x40')]);return _0x1be150[_0x6907('0x54')](_0x227db6);}})[_0x6907('0x20')](function(_0x2fb35f){if(_0x2fb35f){_0x11615a=_0x2fb35f[_0x6907('0x2f')];if(!_0x44ae8d[_0x6907('0x28')]['hasOwnProperty'](_0x6907('0x30'))){_0x227db6[_0x6907('0x1b')]=qs[_0x6907('0x1b')](_0x44ae8d[_0x6907('0x28')]['limit']);_0x227db6[_0x6907('0x1a')]=qs[_0x6907('0x1a')](_0x44ae8d[_0x6907('0x28')][_0x6907('0x1a')]);}return _0x1be150[_0x6907('0x54')](_0x227db6);}})[_0x6907('0x20')](function(_0x1ee7f9){if(_0x1ee7f9){return _0x1ee7f9?{'count':_0x11615a,'rows':_0x1ee7f9}:null;}})['then'](respondWithResult(_0xcb3f90,null))[_0x6907('0x3c')](handleError(_0xcb3f90,null));};exports[_0x6907('0x55')]=function(_0x2d026d,_0x76dc56,_0x1a5d50){var _0x28484c=[];var _0x1fd5e9;return db[_0x6907('0x56')]['findAll']({'where':{'id':_0x2d026d[_0x6907('0x48')][_0x6907('0x57')]},'attributes':['id'],'include':[{'model':db[_0x6907('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x6907('0x20')](function(_0x1902fd){if(_0x1902fd){for(var _0x2a1d6a=0x0;_0x2a1d6a<_0x1902fd[_0x6907('0x2f')];_0x2a1d6a+=0x1){for(var _0x67a1be=0x0;_0x67a1be<_0x1902fd[_0x2a1d6a][_0x6907('0x59')][_0x6907('0x2f')];_0x67a1be+=0x1){_0x28484c=_['union'](_0x28484c,[_0x1902fd[_0x2a1d6a][_0x6907('0x59')][_0x67a1be]['id']]);}}return _0x28484c;}})[_0x6907('0x20')](function(_0x5cd951){if(_0x5cd951){return db[_0x6907('0x26')]['find']({'where':{'id':_0x2d026d[_0x6907('0x3d')]['id']}});}})['then'](function(_0x423ad3){if(_0x423ad3){_0x1fd5e9=_0x423ad3;return _0x1fd5e9[_0x6907('0x5a')](_0x28484c,{'penalty':_0x2d026d[_0x6907('0x48')][_0x6907('0x5b')]});}})[_0x6907('0x20')](function(_0x557d1c){if(_0x557d1c){return _0x1fd5e9[_0x6907('0x55')](_0x2d026d[_0x6907('0x48')]['ids']);}})[_0x6907('0x20')](handleEntityNotFound(_0x76dc56,null))['then'](respondWithStatusCode(_0x76dc56,null))['catch'](handleError(_0x76dc56,null));};exports['removeTeams']=function(_0x11ab6b,_0x178ded,_0x3d62ea){var _0x20a8ef=[];var _0x32806c;return db[_0x6907('0x56')]['findAll']({'where':{'id':_0x11ab6b[_0x6907('0x28')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6907('0x59'),'attributes':['id'],'raw':!![]}]})[_0x6907('0x20')](function(_0x52325a){if(_0x52325a){for(var _0x4f8d3e=0x0;_0x4f8d3e<_0x52325a['length'];_0x4f8d3e+=0x1){for(var _0x2acb01=0x0;_0x2acb01<_0x52325a[_0x4f8d3e]['Agents']['length'];_0x2acb01+=0x1){_0x20a8ef=_[_0x6907('0x5c')](_0x20a8ef,[_0x52325a[_0x4f8d3e][_0x6907('0x59')][_0x2acb01]['id']]);}}return _0x20a8ef;}})[_0x6907('0x20')](function(_0x5f223d){if(_0x5f223d){return db['VoiceQueue'][_0x6907('0x43')]({'where':{'id':_0x11ab6b[_0x6907('0x3d')]['id']}});}})['then'](function(_0x2669e1){if(_0x2669e1){_0x32806c=_0x2669e1;return _0x32806c['removeAgents'](_0x20a8ef);}})[_0x6907('0x20')](function(_0x52d69c){if(_0x32806c){return _0x32806c['removeTeams'](_0x11ab6b[_0x6907('0x28')][_0x6907('0x57')]);}})[_0x6907('0x20')](handleEntityNotFound(_0x178ded,null))[_0x6907('0x20')](respondWithStatusCode(_0x178ded,null))[_0x6907('0x3c')](handleError(_0x178ded,null));};exports['addAgents']=function(_0x305ff0,_0x5589bd,_0x3cb903){var _0x564a22,_0x29d6d3;return db['VoiceQueue']['find']({'where':{'id':_0x305ff0[_0x6907('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5589bd,null))[_0x6907('0x20')](function(_0x5747d4){if(_0x5747d4){_0x29d6d3=_0x5747d4;return _0x5747d4[_0x6907('0x5a')](_0x305ff0[_0x6907('0x48')]['ids'],_[_0x6907('0x45')](_0x305ff0[_0x6907('0x48')],[_0x6907('0x57'),'id'])||{})['spread'](function(_0x4b210d){for(var _0x22fdea=0x0;_0x22fdea<_0x305ff0[_0x6907('0x48')][_0x6907('0x57')][_0x6907('0x2f')];_0x22fdea+=0x1){socket['emit'](_0x6907('0x5d'),{'UserId':_0x305ff0[_0x6907('0x48')]['ids'][_0x22fdea],'VoiceQueueId':_0x305ff0[_0x6907('0x3d')]['id']});}return _0x4b210d;});}})[_0x6907('0x20')](function(_0x483709){_0x564a22=_0x483709||[];if(_0x29d6d3){return db['User'][_0x6907('0x3b')]({'where':{'id':_0x305ff0[_0x6907('0x48')][_0x6907('0x57')]},'attributes':['id',_0x6907('0x24'),_0x6907('0x5e'),_0x6907('0x5f')],'raw':!![]});}})[_0x6907('0x20')](function(_0x211d56){if(_0x211d56&&_0x211d56[_0x6907('0x2f')]){var _0x42cb1b=[];for(var _0x29a770=0x0;_0x29a770<_0x211d56['length'];_0x29a770++){_0x42cb1b['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x211d56[_0x29a770][_0x6907('0x24')],'UserId':_0x211d56[_0x29a770]['id'],'queue_name':_0x29d6d3['name'],'VoiceQueueId':_0x29d6d3['id'],'interface':util[_0x6907('0x60')](_0x6907('0x61'),'SIP',_0x211d56[_0x29a770][_0x6907('0x24')]),'paused':_0x211d56[_0x29a770]['voicePause']||![],'penalty':_0x305ff0[_0x6907('0x48')][_0x6907('0x5b')]||0x0}));}return BPromise[_0x6907('0x62')](_0x42cb1b);}})[_0x6907('0x20')](function(_0x3af2df){return _0x564a22;})['then'](respondWithResult(_0x5589bd,null))['catch'](handleError(_0x5589bd,null));};exports[_0x6907('0x63')]=function(_0x2f7569,_0xf37eaa,_0x307ea6){var _0x33b22a;return db['VoiceQueue'][_0x6907('0x43')]({'where':{'id':_0x2f7569[_0x6907('0x3d')]['id']}})[_0x6907('0x20')](handleEntityNotFound(_0xf37eaa,null))[_0x6907('0x20')](function(_0x3f6e4a){if(_0x3f6e4a){return _0x3f6e4a[_0x6907('0x63')](_0x2f7569[_0x6907('0x28')][_0x6907('0x57')])[_0x6907('0x20')](function(_0x4e8112){if(_['isArray'](_0x2f7569[_0x6907('0x28')][_0x6907('0x57')])){for(var _0x446b5c=0x0;_0x446b5c<_0x2f7569[_0x6907('0x28')][_0x6907('0x57')][_0x6907('0x2f')];_0x446b5c+=0x1){socket[_0x6907('0x64')](_0x6907('0x65'),{'UserId':_0x2f7569['query'][_0x6907('0x57')][_0x446b5c],'VoiceQueueId':_0x2f7569['params']['id']});}}else{socket[_0x6907('0x64')]('userVoiceQueue:remove',{'UserId':_0x2f7569[_0x6907('0x28')][_0x6907('0x57')],'VoiceQueueId':_0x2f7569[_0x6907('0x3d')]['id']});}});}})[_0x6907('0x20')](function(_0x34b0c8){if(_0x2f7569[_0x6907('0x28')][_0x6907('0x66')]){_0x33b22a=_0x34b0c8;return db[_0x6907('0x67')][_0x6907('0x21')]({'where':{'VoiceQueueId':_0x2f7569[_0x6907('0x3d')]['id'],'UserId':_0x2f7569[_0x6907('0x28')][_0x6907('0x57')]}})[_0x6907('0x20')](function(){return _0x33b22a;});}})[_0x6907('0x20')](respondWithStatusCode(_0xf37eaa,null))['catch'](handleError(_0xf37eaa,null));};exports[_0x6907('0x68')]=function(_0x82c115,_0x3957f8,_0x15d9e6){var _0x9a7e2f={};var _0x40adde={};var _0x51666b;var _0x5a8e23;return db[_0x6907('0x26')][_0x6907('0x49')]({'where':{'id':_0x82c115['params']['id']}})[_0x6907('0x20')](handleEntityNotFound(_0x3957f8,null))[_0x6907('0x20')](function(_0x13eea7){if(_0x13eea7){_0x51666b=_0x13eea7;_0x40adde[_0x6907('0x2c')]=_[_0x6907('0x27')](db[_0x6907('0x58')][_0x6907('0x4b')]);_0x40adde[_0x6907('0x28')]=_['keys'](_0x82c115['query']);_0x40adde[_0x6907('0x2b')]=_[_0x6907('0x3e')](_0x40adde['model'],_0x40adde[_0x6907('0x28')]);_0x9a7e2f[_0x6907('0x2d')]=_[_0x6907('0x3e')](_0x40adde[_0x6907('0x2c')],qs[_0x6907('0x2e')](_0x82c115[_0x6907('0x28')][_0x6907('0x2e')]));_0x9a7e2f[_0x6907('0x2d')]=_0x9a7e2f['attributes'][_0x6907('0x2f')]?_0x9a7e2f[_0x6907('0x2d')]:_0x40adde[_0x6907('0x2c')];_0x9a7e2f[_0x6907('0x31')]=qs[_0x6907('0x32')](_0x82c115[_0x6907('0x28')]['sort']);_0x9a7e2f[_0x6907('0x35')]=qs['filters'](_[_0x6907('0x33')](_0x82c115[_0x6907('0x28')],_0x40adde[_0x6907('0x2b')]));if(_0x82c115[_0x6907('0x28')][_0x6907('0x38')]){_0x9a7e2f[_0x6907('0x35')]=_['merge'](_0x9a7e2f[_0x6907('0x35')],{'$or':_[_0x6907('0x37')](_0x9a7e2f[_0x6907('0x2d')],function(_0xd4c00c){var _0x22e655={};_0x22e655[_0xd4c00c]={'$like':'%'+_0x82c115['query'][_0x6907('0x38')]+'%'};return _0x22e655;})});}_0x9a7e2f=_[_0x6907('0x36')]({},_0x9a7e2f,_0x82c115[_0x6907('0x40')]);return _0x51666b[_0x6907('0x68')](_0x9a7e2f);}})[_0x6907('0x20')](function(_0xf463c6){if(_0xf463c6){_0x5a8e23=_0xf463c6[_0x6907('0x2f')];if(!_0x82c115[_0x6907('0x28')][_0x6907('0x4f')]('nolimit')){_0x9a7e2f['limit']=qs[_0x6907('0x1b')](_0x82c115[_0x6907('0x28')]['limit']);_0x9a7e2f[_0x6907('0x1a')]=qs[_0x6907('0x1a')](_0x82c115[_0x6907('0x28')][_0x6907('0x1a')]);}return _0x51666b[_0x6907('0x68')](_0x9a7e2f);}})[_0x6907('0x20')](function(_0x78747b){if(_0x78747b){return _0x78747b?{'count':_0x5a8e23,'rows':_0x78747b}:null;}})[_0x6907('0x20')](respondWithResult(_0x3957f8,null))[_0x6907('0x3c')](handleError(_0x3957f8,null));};exports['getMembers']=function(_0x321367,_0x29c0cb,_0x959398){var _0x3b6bd2={};var _0x578930={};var _0x37b6ba;var _0x5612d5;return db['VoiceQueue'][_0x6907('0x49')]({'where':{'id':_0x321367['params']['id']}})[_0x6907('0x20')](handleEntityNotFound(_0x29c0cb,null))[_0x6907('0x20')](function(_0xd2fd8c){if(_0xd2fd8c){_0x37b6ba=_0xd2fd8c;_0x578930[_0x6907('0x2c')]=_['keys'](db['UserVoiceQueueRt'][_0x6907('0x4b')]);_0x578930[_0x6907('0x28')]=_[_0x6907('0x27')](_0x321367[_0x6907('0x28')]);_0x578930[_0x6907('0x2b')]=_[_0x6907('0x3e')](_0x578930[_0x6907('0x2c')],_0x578930['query']);_0x3b6bd2[_0x6907('0x2d')]=_[_0x6907('0x3e')](_0x578930[_0x6907('0x2c')],qs['fields'](_0x321367['query'][_0x6907('0x2e')]));_0x3b6bd2['attributes']=_0x3b6bd2[_0x6907('0x2d')][_0x6907('0x2f')]?_0x3b6bd2[_0x6907('0x2d')]:_0x578930[_0x6907('0x2c')];_0x3b6bd2[_0x6907('0x31')]=qs[_0x6907('0x32')](_0x321367['query'][_0x6907('0x32')]);_0x3b6bd2[_0x6907('0x35')]=qs[_0x6907('0x2b')](_[_0x6907('0x33')](_0x321367[_0x6907('0x28')],_0x578930[_0x6907('0x2b')]));if(_0x321367[_0x6907('0x28')]['filter']){_0x3b6bd2[_0x6907('0x35')]=_[_0x6907('0x36')](_0x3b6bd2[_0x6907('0x35')],{'$or':_[_0x6907('0x37')](_0x3b6bd2['attributes'],function(_0xd53adc){var _0x45fc5d={};_0x45fc5d[_0xd53adc]={'$like':'%'+_0x321367[_0x6907('0x28')][_0x6907('0x38')]+'%'};return _0x45fc5d;})});}_0x3b6bd2=_[_0x6907('0x36')]({},_0x3b6bd2,_0x321367['options']);return _0x37b6ba[_0x6907('0x69')](_0x3b6bd2);}})[_0x6907('0x20')](function(_0x187ea0){if(_0x187ea0){_0x5612d5=_0x187ea0[_0x6907('0x2f')];if(!_0x321367[_0x6907('0x28')][_0x6907('0x4f')](_0x6907('0x30'))){_0x3b6bd2[_0x6907('0x1b')]=qs[_0x6907('0x1b')](_0x321367[_0x6907('0x28')][_0x6907('0x1b')]);_0x3b6bd2['offset']=qs[_0x6907('0x1a')](_0x321367['query'][_0x6907('0x1a')]);}return _0x37b6ba[_0x6907('0x69')](_0x3b6bd2);}})['then'](function(_0xa2d599){return _0xa2d599?{'count':_0x5612d5,'rows':_0xa2d599}:null;})['then'](respondWithResult(_0x29c0cb,null))[_0x6907('0x3c')](handleError(_0x29c0cb,null));};exports[_0x6907('0x6a')]=function(_0x4a38b1,_0x1a5678,_0x233db4){var _0x182f39={};var _0x1d00b9={};var _0x668188;var _0x11de5;return db[_0x6907('0x26')][_0x6907('0x49')]({'where':{'id':_0x4a38b1['params']['id']}})[_0x6907('0x20')](handleEntityNotFound(_0x1a5678,null))['then'](function(_0xa28785){if(_0xa28785){_0x668188=_0xa28785;_0x1d00b9[_0x6907('0x2c')]=_[_0x6907('0x27')](db[_0x6907('0x6b')][_0x6907('0x4b')]);_0x1d00b9[_0x6907('0x28')]=_[_0x6907('0x27')](_0x4a38b1[_0x6907('0x28')]);_0x1d00b9[_0x6907('0x2b')]=_[_0x6907('0x3e')](_0x1d00b9['model'],_0x1d00b9[_0x6907('0x28')]);_0x182f39['attributes']=_[_0x6907('0x3e')](_0x1d00b9[_0x6907('0x2c')],qs[_0x6907('0x2e')](_0x4a38b1[_0x6907('0x28')]['fields']));_0x182f39[_0x6907('0x2d')]=_0x182f39[_0x6907('0x2d')][_0x6907('0x2f')]?_0x182f39[_0x6907('0x2d')]:_0x1d00b9['model'];_0x182f39[_0x6907('0x31')]=qs[_0x6907('0x32')](_0x4a38b1[_0x6907('0x28')][_0x6907('0x32')]);_0x182f39[_0x6907('0x35')]=qs[_0x6907('0x2b')](_[_0x6907('0x33')](_0x4a38b1['query'],_0x1d00b9[_0x6907('0x2b')]));if(_0x4a38b1[_0x6907('0x28')][_0x6907('0x38')]){_0x182f39[_0x6907('0x35')]=_[_0x6907('0x36')](_0x182f39[_0x6907('0x35')],{'$or':_[_0x6907('0x37')](_0x182f39[_0x6907('0x2d')],function(_0x1826d3){var _0x1bb517={};_0x1bb517[_0x1826d3]={'$like':'%'+_0x4a38b1['query'][_0x6907('0x38')]+'%'};return _0x1bb517;})});}_0x182f39=_[_0x6907('0x36')]({},_0x182f39,_0x4a38b1[_0x6907('0x40')]);return _0x668188[_0x6907('0x6a')](_0x182f39);}})[_0x6907('0x20')](function(_0x3a4d87){if(_0x3a4d87){_0x11de5=_0x3a4d87[_0x6907('0x2f')];if(!_0x4a38b1[_0x6907('0x28')][_0x6907('0x4f')](_0x6907('0x30'))){_0x182f39[_0x6907('0x1b')]=qs[_0x6907('0x1b')](_0x4a38b1['query'][_0x6907('0x1b')]);_0x182f39[_0x6907('0x1a')]=qs['offset'](_0x4a38b1[_0x6907('0x28')][_0x6907('0x1a')]);}return _0x668188[_0x6907('0x6a')](_0x182f39);}})[_0x6907('0x20')](function(_0x194e01){if(_0x194e01){return _0x194e01?{'count':_0x11de5,'rows':_0x194e01}:null;}})[_0x6907('0x20')](respondWithResult(_0x1a5678,null))[_0x6907('0x3c')](handleError(_0x1a5678,null));};exports[_0x6907('0x6c')]=function(_0x34b9f7,_0x56b37a,_0x31035b){var _0x40cc92,_0xe09dc7;return db[_0x6907('0x26')][_0x6907('0x43')]({'where':{'id':_0x34b9f7['params']['id']}})[_0x6907('0x20')](handleEntityNotFound(_0x56b37a,null))[_0x6907('0x20')](function(_0x1b7c81){if(_0x1b7c81){_0xe09dc7=_0x1b7c81;return _0x1b7c81[_0x6907('0x6c')](_0x34b9f7[_0x6907('0x48')][_0x6907('0x57')],_[_0x6907('0x45')](_0x34b9f7['body'],['ids','id'])||{});}return null;})[_0x6907('0x6d')](function(_0x1ebe7f){var _0x324475;_0x40cc92=_0x1ebe7f||[];var _0x12e214=[];if(_0x1ebe7f){for(var _0x40cb48=0x0;_0x40cb48<_0x1ebe7f[_0x6907('0x2f')];_0x40cb48+=0x1){var _0x4169f3=_0x1ebe7f[_0x40cb48][_0x6907('0x44')]({'plain':!![]});_0xe09dc7['dialCheckDuplicateType']=_0x34b9f7['body'][_0x6907('0x6e')]?_0x34b9f7[_0x6907('0x48')][_0x6907('0x6e')]:_0xe09dc7[_0x6907('0x6e')];switch(_0xe09dc7['dialCheckDuplicateType']){case _0x6907('0x6f'):_0x324475=squel[_0x6907('0x70')]()[_0x6907('0x71')](_0x6907('0x72'))[_0x6907('0x73')](['phone',_0x6907('0x74'),_0x6907('0x75'),_0x6907('0x76'),'VoiceQueueId',_0x6907('0x46'),'updatedAt'],squel[_0x6907('0x77')]()[_0x6907('0x78')](_0x6907('0x79'),_0x6907('0x79'))['field'](_0x6907('0x7a'),_0x6907('0x74'))['field']('id',_0x6907('0x75'))[_0x6907('0x78')](_0x4169f3[_0x6907('0x7b')]['toString'](),_0x6907('0x76'))[_0x6907('0x78')](_0x34b9f7['params']['id'][_0x6907('0x7c')](),'VoiceQueueId')[_0x6907('0x78')](_0x6907('0x7a'),'createdAt')[_0x6907('0x78')]('NOW()','updatedAt')['from'](_0x6907('0x7d'))['where'](_0x6907('0x7e'))[_0x6907('0x35')](_0x6907('0x7f'),_0x4169f3[_0x6907('0x7b')][_0x6907('0x7c')]())[_0x6907('0x35')](_0x6907('0x80'))[_0x6907('0x35')](_0x6907('0x81'),squel[_0x6907('0x77')]()[_0x6907('0x78')](_0x6907('0x82'))['from'](_0x6907('0x83'))[_0x6907('0x35')](_0x6907('0x84'),_0x34b9f7[_0x6907('0x3d')]['id'][_0x6907('0x7c')]()))[_0x6907('0x35')](_0x6907('0x81'),squel[_0x6907('0x77')]()[_0x6907('0x78')](_0x6907('0x79'))[_0x6907('0x85')](_0x6907('0x72'))[_0x6907('0x35')](_0x6907('0x84'),_0x34b9f7[_0x6907('0x3d')]['id'][_0x6907('0x7c')]())))[_0x6907('0x7c')]();break;case _0x6907('0x86'):_0x324475=squel[_0x6907('0x70')]()[_0x6907('0x71')](_0x6907('0x72'))['fromQuery']([_0x6907('0x79'),'scheduledAt',_0x6907('0x75'),'ListId',_0x6907('0x50'),_0x6907('0x46'),'updatedAt'],squel['select']()[_0x6907('0x78')](_0x6907('0x79'),'phone')[_0x6907('0x78')](_0x6907('0x7a'),_0x6907('0x74'))[_0x6907('0x78')]('id',_0x6907('0x75'))['field'](_0x4169f3[_0x6907('0x7b')][_0x6907('0x7c')](),_0x6907('0x76'))[_0x6907('0x78')](_0x34b9f7[_0x6907('0x3d')]['id']['toString'](),_0x6907('0x50'))[_0x6907('0x78')]('NOW()',_0x6907('0x46'))[_0x6907('0x78')](_0x6907('0x7a'),_0x6907('0x47'))[_0x6907('0x85')](_0x6907('0x7d'))[_0x6907('0x35')]('deletedAt\x20IS\x20NULL')['where'](_0x6907('0x7f'),_0x4169f3[_0x6907('0x7b')]['toString']())[_0x6907('0x35')](_0x6907('0x80'))[_0x6907('0x35')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6907('0x77')]()[_0x6907('0x78')](_0x6907('0x79'))[_0x6907('0x85')](_0x6907('0x72'))['where'](_0x6907('0x84'),_0x34b9f7[_0x6907('0x3d')]['id'][_0x6907('0x7c')]())))[_0x6907('0x7c')]();break;default:_0x324475=squel['insert']()[_0x6907('0x71')]('cm_hopper')['fromQuery'](['phone','scheduledAt',_0x6907('0x75'),_0x6907('0x76'),_0x6907('0x50'),_0x6907('0x46'),_0x6907('0x47')],squel[_0x6907('0x77')]()[_0x6907('0x78')](_0x6907('0x79'),_0x6907('0x79'))[_0x6907('0x78')]('NOW()',_0x6907('0x74'))[_0x6907('0x78')]('id','ContactId')[_0x6907('0x78')](_0x4169f3['CmListId'][_0x6907('0x7c')](),'ListId')['field'](_0x34b9f7[_0x6907('0x3d')]['id']['toString'](),_0x6907('0x50'))[_0x6907('0x78')](_0x6907('0x7a'),_0x6907('0x46'))[_0x6907('0x78')](_0x6907('0x7a'),'updatedAt')[_0x6907('0x85')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x6907('0x7f'),_0x4169f3['CmListId']['toString']())[_0x6907('0x35')](_0x6907('0x80')))['toString']();}_0x12e214[_0x6907('0x87')](db[_0x6907('0x88')][_0x6907('0x28')](_0x324475));}return BPromise['all'](_0x12e214);}})[_0x6907('0x20')](function(){return _0x40cc92;})[_0x6907('0x20')](respondWithResult(_0x56b37a,null))['catch'](handleError(_0x56b37a,null));};exports['removeLists']=function(_0x40865a,_0x469ab1,_0x5d6057){var _0x163a91;return db[_0x6907('0x26')]['find']({'where':{'id':_0x40865a[_0x6907('0x3d')]['id']}})[_0x6907('0x20')](handleEntityNotFound(_0x469ab1,null))[_0x6907('0x20')](function(_0x2eda5d){if(_0x2eda5d){return _0x2eda5d[_0x6907('0x89')](_0x40865a[_0x6907('0x28')]['ids']);}})[_0x6907('0x20')](function(_0x39884a){if(_0x39884a){_0x163a91=_0x39884a;return db['CmHopper'][_0x6907('0x21')]({'where':{'ListId':_0x40865a[_0x6907('0x28')][_0x6907('0x57')],'VoiceQueueId':_0x40865a[_0x6907('0x3d')]['id']}})[_0x6907('0x20')](function(){return _0x163a91;});}})[_0x6907('0x20')](respondWithStatusCode(_0x469ab1,null))['catch'](handleError(_0x469ab1,null));};exports['getBlackLists']=function(_0x27a06d,_0x2feba3,_0x466f2f){var _0x4177fa={};var _0x193d98={};var _0x45c59e;var _0x489a57;return db[_0x6907('0x26')][_0x6907('0x49')]({'where':{'id':_0x27a06d[_0x6907('0x3d')]['id']}})[_0x6907('0x20')](handleEntityNotFound(_0x2feba3,null))[_0x6907('0x20')](function(_0x37b4d4){if(_0x37b4d4){_0x45c59e=_0x37b4d4;_0x193d98['model']=_[_0x6907('0x27')](db['CmList'][_0x6907('0x4b')]);_0x193d98[_0x6907('0x28')]=_[_0x6907('0x27')](_0x27a06d[_0x6907('0x28')]);_0x193d98[_0x6907('0x2b')]=_[_0x6907('0x3e')](_0x193d98[_0x6907('0x2c')],_0x193d98[_0x6907('0x28')]);_0x4177fa[_0x6907('0x2d')]=_[_0x6907('0x3e')](_0x193d98[_0x6907('0x2c')],qs[_0x6907('0x2e')](_0x27a06d[_0x6907('0x28')]['fields']));_0x4177fa['attributes']=_0x4177fa['attributes']['length']?_0x4177fa[_0x6907('0x2d')]:_0x193d98[_0x6907('0x2c')];_0x4177fa[_0x6907('0x31')]=qs[_0x6907('0x32')](_0x27a06d['query']['sort']);_0x4177fa[_0x6907('0x35')]=qs[_0x6907('0x2b')](_[_0x6907('0x33')](_0x27a06d[_0x6907('0x28')],_0x193d98[_0x6907('0x2b')]));if(_0x27a06d[_0x6907('0x28')]['filter']){_0x4177fa[_0x6907('0x35')]=_[_0x6907('0x36')](_0x4177fa[_0x6907('0x35')],{'$or':_[_0x6907('0x37')](_0x4177fa['attributes'],function(_0x38f08d){var _0x3396ed={};_0x3396ed[_0x38f08d]={'$like':'%'+_0x27a06d['query'][_0x6907('0x38')]+'%'};return _0x3396ed;})});}_0x4177fa=_['merge']({},_0x4177fa,_0x27a06d[_0x6907('0x40')]);return _0x45c59e[_0x6907('0x8a')](_0x4177fa);}})['then'](function(_0xcb5670){if(_0xcb5670){_0x489a57=_0xcb5670[_0x6907('0x2f')];if(!_0x27a06d[_0x6907('0x28')][_0x6907('0x4f')](_0x6907('0x30'))){_0x4177fa[_0x6907('0x1b')]=qs['limit'](_0x27a06d[_0x6907('0x28')][_0x6907('0x1b')]);_0x4177fa[_0x6907('0x1a')]=qs[_0x6907('0x1a')](_0x27a06d[_0x6907('0x28')][_0x6907('0x1a')]);}return _0x45c59e[_0x6907('0x8a')](_0x4177fa);}})[_0x6907('0x20')](function(_0x118792){if(_0x118792){return _0x118792?{'count':_0x489a57,'rows':_0x118792}:null;}})[_0x6907('0x20')](respondWithResult(_0x2feba3,null))['catch'](handleError(_0x2feba3,null));};exports[_0x6907('0x8b')]=function(_0x3e3309,_0x47bbe3,_0x3d1dbb){var _0x29aee8,_0x270833;return db['VoiceQueue'][_0x6907('0x43')]({'where':{'id':_0x3e3309[_0x6907('0x3d')]['id']}})[_0x6907('0x20')](handleEntityNotFound(_0x47bbe3,null))[_0x6907('0x20')](function(_0x238337){if(_0x238337){_0x270833=_0x238337;return _0x238337['addBlackLists'](_0x3e3309[_0x6907('0x48')][_0x6907('0x57')],_['omit'](_0x3e3309[_0x6907('0x48')],['ids','id'])||{});}return null;})[_0x6907('0x6d')](function(_0x1bcfbe){var _0x2fda9e;_0x29aee8=_0x1bcfbe||[];var _0x3e89cd=[];if(_0x1bcfbe){for(var _0x15eda0=0x0;_0x15eda0<_0x1bcfbe[_0x6907('0x2f')];_0x15eda0+=0x1){var _0x2947dd=_0x1bcfbe[_0x15eda0][_0x6907('0x44')]({'plain':!![]});_0x2fda9e=squel[_0x6907('0x70')]()[_0x6907('0x71')](_0x6907('0x8c'))[_0x6907('0x73')]([_0x6907('0x79'),_0x6907('0x75'),_0x6907('0x76'),'VoiceQueueId',_0x6907('0x46'),_0x6907('0x47')],squel[_0x6907('0x77')]()['field'](_0x6907('0x79'),_0x6907('0x79'))[_0x6907('0x78')]('id',_0x6907('0x75'))[_0x6907('0x78')](_0x2947dd[_0x6907('0x7b')]['toString'](),_0x6907('0x76'))['field'](_0x3e3309[_0x6907('0x3d')]['id'][_0x6907('0x7c')](),'VoiceQueueId')[_0x6907('0x78')](_0x6907('0x7a'),_0x6907('0x46'))[_0x6907('0x78')](_0x6907('0x7a'),_0x6907('0x47'))[_0x6907('0x85')](_0x6907('0x7d'))[_0x6907('0x35')](_0x6907('0x7e'))[_0x6907('0x35')]('ListId\x20=\x20?',_0x2947dd[_0x6907('0x7b')]['toString']())[_0x6907('0x35')]('phone\x20IS\x20NOT\x20NULL'))[_0x6907('0x7c')]();_0x3e89cd[_0x6907('0x87')](db['sequelize'][_0x6907('0x28')](_0x2fda9e));}return BPromise['all'](_0x3e89cd);}})['then'](function(){return _0x29aee8;})['then'](respondWithResult(_0x47bbe3,null))[_0x6907('0x3c')](handleError(_0x47bbe3,null));};exports[_0x6907('0x8d')]=function(_0x12b52e,_0x2719c0,_0x386c97){var _0x775b79;return db[_0x6907('0x26')]['find']({'where':{'id':_0x12b52e[_0x6907('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2719c0,null))['then'](function(_0x5bbeaf){if(_0x5bbeaf){return _0x5bbeaf[_0x6907('0x8d')](_0x12b52e[_0x6907('0x28')][_0x6907('0x57')]);}})[_0x6907('0x20')](function(_0x25b9e1){if(_0x25b9e1){_0x775b79=_0x25b9e1;return db[_0x6907('0x53')][_0x6907('0x21')]({'where':{'ListId':_0x12b52e[_0x6907('0x28')][_0x6907('0x57')],'VoiceQueueId':_0x12b52e[_0x6907('0x3d')]['id']}})[_0x6907('0x20')](function(){return _0x775b79;});}})[_0x6907('0x20')](respondWithStatusCode(_0x2719c0,null))[_0x6907('0x3c')](handleError(_0x2719c0,null));}; \ No newline at end of file +var _0xd349=['removeBlackLists','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','../../components/parsers/qs','api','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','end','name','send','index','VoiceQueue','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','day','add','merge','map','filter','options','includeAll','include','findAll','catch','rawAttributes','create','body','clone','params','find','omit','createdAt','updatedAt','getHoppers','CmHopper','hasOwnProperty','getHopperHistories','VoiceQueueId','CmHopperHistory','rows','getHopperFinals','CmHopperFinal','getHopperBlacks','findOne','CmHopperBlack','getTeams','Team','ids','User','Agents','union','addAgents','penalty','addTeams','removeTeams','removeAgents','emit','userVoiceQueue:save','loginInPause','voicePause','push','upsert','format','SIP','all','isArray','userVoiceQueue:remove','realtime','getAgents','getMembers','UserVoiceQueueRt','getLists','addLists','spread','get','dialCheckDuplicateType','always','insert','into','cm_hopper','ContactId','ListId','select','field','phone','NOW()','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','VoiceQueueId\x20=\x20?','onlyIfOpen','fromQuery','scheduledAt','cm_contacts','phone\x20NOT\x20IN\x20(?)','sequelize','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xd349,0x92));var _0x9d34=function(_0x45588b,_0x15160f){_0x45588b=_0x45588b-0x0;var _0x476cfb=_0xd349[_0x45588b];return _0x476cfb;};'use strict';var jsonpatch=require(_0x9d34('0x0'));var rp=require(_0x9d34('0x1'));var moment=require(_0x9d34('0x2'));var BPromise=require(_0x9d34('0x3'));var Mustache=require(_0x9d34('0x4'));var util=require(_0x9d34('0x5'));var path=require(_0x9d34('0x6'));var sox=require(_0x9d34('0x7'));var csv=require('to-csv');var ejs=require(_0x9d34('0x8'));var fs=require('fs');var _=require(_0x9d34('0x9'));var squel=require('squel');var crypto=require(_0x9d34('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9d34('0xb'));var toCsv=require(_0x9d34('0xc'));var querystring=require(_0x9d34('0xd'));var Papa=require('papaparse');var qs=require(_0x9d34('0xe'));var logger=require('../../config/logger')(_0x9d34('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0x9d34('0x10'))({'host':'localhost','port':0x18eb});require(_0x9d34('0x11'))[_0x9d34('0x12')](socket);function respondWithStatusCode(_0x400723,_0x66a8c1){_0x66a8c1=_0x66a8c1||0xcc;return function(_0x110299){if(_0x110299){return _0x400723[_0x9d34('0x13')](_0x66a8c1);}return _0x400723[_0x9d34('0x14')](_0x66a8c1)['end']();};}function respondWithResult(_0x3b1375,_0x40b3f1){_0x40b3f1=_0x40b3f1||0xc8;return function(_0x5b3f3c){if(_0x5b3f3c){return _0x3b1375[_0x9d34('0x14')](_0x40b3f1)[_0x9d34('0x15')](_0x5b3f3c);}};}function respondWithFilteredResult(_0xa69d1c,_0x3e1a97){return function(_0x3da79b){if(_0x3da79b){var _0x4829da=_0x3da79b[_0x9d34('0x16')],_0x5ba89e=_0x3e1a97[_0x9d34('0x17')],_0x3a48a2=_0x3e1a97[_0x9d34('0x17')]+_0x3e1a97[_0x9d34('0x18')],_0x577331;if(_0x3a48a2>=_0x4829da){_0x3a48a2=_0x4829da;_0x577331=0xc8;}else{_0x577331=0xce;}_0xa69d1c[_0x9d34('0x14')](_0x577331);return _0xa69d1c[_0x9d34('0x19')]('Content-Range',_0x5ba89e+'-'+_0x3a48a2+'/'+_0x4829da)['json'](_0x3da79b);}return null;};}function patchUpdates(_0x40b241){return function(_0x2af713){try{jsonpatch[_0x9d34('0x1a')](_0x2af713,_0x40b241,!![]);}catch(_0x158ca9){return BPromise[_0x9d34('0x1b')](_0x158ca9);}return _0x2af713[_0x9d34('0x1c')]();};}function saveUpdates(_0x1640cb,_0x2a2ed3){return function(_0xd7257e){if(_0xd7257e){return _0xd7257e[_0x9d34('0x1d')](_0x1640cb)[_0x9d34('0x1e')](function(_0x58eaaa){return _0x58eaaa;});}return null;};}function removeEntity(_0x4520fa,_0x40a437){return function(_0x4c2489){if(_0x4c2489){return _0x4c2489[_0x9d34('0x1f')]()[_0x9d34('0x1e')](function(){_0x4520fa[_0x9d34('0x14')](0xcc)[_0x9d34('0x20')]();});}};}function handleEntityNotFound(_0x2b840c,_0x22deb6){return function(_0x58e906){if(!_0x58e906){_0x2b840c['sendStatus'](0x194);}return _0x58e906;};}function handleError(_0x1a37d4,_0x225dab){_0x225dab=_0x225dab||0x1f4;return function(_0x24c51f){logger['error'](_0x24c51f['stack']);if(_0x24c51f['name']){delete _0x24c51f[_0x9d34('0x21')];}_0x1a37d4[_0x9d34('0x14')](_0x225dab)[_0x9d34('0x22')](_0x24c51f);};}exports[_0x9d34('0x23')]=function(_0x2db289,_0x217027){var _0x2ce39f={},_0x220860={},_0x720471={'count':0x0,'rows':[]};var _0x1c7d0b=db[_0x9d34('0x24')]['rawAttributes'];_0x220860[_0x9d34('0x25')]=_[_0x9d34('0x26')](_0x1c7d0b);var _0x141249={'dateStart':_0x2db289['query'][_0x9d34('0x27')],'dateEnd':_0x2db289[_0x9d34('0x28')][_0x9d34('0x29')]};delete _0x2db289['query'][_0x9d34('0x27')];delete _0x2db289['query']['dateEnd'];_0x220860['query']=_[_0x9d34('0x26')](_0x2db289['query']);_0x220860[_0x9d34('0x2a')]=_[_0x9d34('0x2b')](_0x220860[_0x9d34('0x25')],_0x220860[_0x9d34('0x28')]);_0x2ce39f[_0x9d34('0x2c')]=_[_0x9d34('0x2b')](_0x220860[_0x9d34('0x25')],qs[_0x9d34('0x2d')](_0x2db289[_0x9d34('0x28')][_0x9d34('0x2d')]));_0x2ce39f['attributes']=_0x2ce39f[_0x9d34('0x2c')][_0x9d34('0x2e')]?_0x2ce39f['attributes']:_0x220860[_0x9d34('0x25')];if(!_0x2db289['query']['hasOwnProperty'](_0x9d34('0x2f'))){_0x2ce39f[_0x9d34('0x18')]=qs[_0x9d34('0x18')](_0x2db289['query'][_0x9d34('0x18')]);_0x2ce39f['offset']=qs['offset'](_0x2db289['query'][_0x9d34('0x17')]);}_0x2ce39f[_0x9d34('0x30')]=qs[_0x9d34('0x31')](_0x2db289[_0x9d34('0x28')][_0x9d34('0x31')]);_0x2ce39f[_0x9d34('0x32')]=qs[_0x9d34('0x2a')](_[_0x9d34('0x33')](_0x2db289['query'],_0x220860[_0x9d34('0x2a')]));if(_0x141249[_0x9d34('0x27')]){if(_0x141249['dateEnd']){_0x141249[_0x9d34('0x29')]=moment(_0x141249['dateEnd'])['add'](0x1,_0x9d34('0x34'));}else{_0x141249['dateEnd']=moment(_0x141249[_0x9d34('0x27')])[_0x9d34('0x35')](0x1,_0x9d34('0x34'));}_['merge'](_0x2ce39f[_0x9d34('0x32')],{'createdAt':{'$gte':_0x141249[_0x9d34('0x27')],'$lte':_0x141249['dateEnd']}});}if(_0x2db289[_0x9d34('0x28')]['filter']){_0x2ce39f['where']=_[_0x9d34('0x36')](_0x2ce39f[_0x9d34('0x32')],{'$or':_[_0x9d34('0x37')](_0x2ce39f['attributes'],function(_0x251201){var _0x42f417={};_0x42f417[_0x251201]={'$like':'%'+_0x2db289[_0x9d34('0x28')][_0x9d34('0x38')]+'%'};return _0x42f417;})});}_0x2ce39f=_[_0x9d34('0x36')]({},_0x2ce39f,_0x2db289[_0x9d34('0x39')]);var _0x17d9b6={'where':_0x2ce39f[_0x9d34('0x32')]};return db[_0x9d34('0x24')]['count'](_0x17d9b6)[_0x9d34('0x1e')](function(_0x1e27a5){_0x720471[_0x9d34('0x16')]=_0x1e27a5;if(_0x2db289[_0x9d34('0x28')][_0x9d34('0x3a')]){_0x2ce39f[_0x9d34('0x3b')]=[{'all':!![]}];}return db['VoiceQueue'][_0x9d34('0x3c')](_0x2ce39f);})[_0x9d34('0x1e')](function(_0x383068){_0x720471['rows']=_0x383068;return _0x720471;})[_0x9d34('0x1e')](respondWithFilteredResult(_0x217027,_0x2ce39f))[_0x9d34('0x3d')](handleError(_0x217027,null));};exports['show']=function(_0x3fef03,_0x5143ba){var _0xd9c8e={'raw':![],'where':{'id':_0x3fef03['params']['id']}},_0x4aa520={};_0x4aa520[_0x9d34('0x25')]=_[_0x9d34('0x26')](db[_0x9d34('0x24')][_0x9d34('0x3e')]);_0x4aa520[_0x9d34('0x28')]=_[_0x9d34('0x26')](_0x3fef03[_0x9d34('0x28')]);_0x4aa520[_0x9d34('0x2a')]=_['intersection'](_0x4aa520[_0x9d34('0x25')],_0x4aa520[_0x9d34('0x28')]);_0xd9c8e[_0x9d34('0x2c')]=_[_0x9d34('0x2b')](_0x4aa520[_0x9d34('0x25')],qs[_0x9d34('0x2d')](_0x3fef03['query'][_0x9d34('0x2d')]));_0xd9c8e[_0x9d34('0x2c')]=_0xd9c8e[_0x9d34('0x2c')][_0x9d34('0x2e')]?_0xd9c8e['attributes']:_0x4aa520['model'];if(_0x3fef03[_0x9d34('0x28')][_0x9d34('0x3a')]){_0xd9c8e[_0x9d34('0x3b')]=[{'all':!![]}];}_0xd9c8e=_[_0x9d34('0x36')]({},_0xd9c8e,_0x3fef03[_0x9d34('0x39')]);return db[_0x9d34('0x24')]['find'](_0xd9c8e)['then'](handleEntityNotFound(_0x5143ba,null))[_0x9d34('0x1e')](respondWithResult(_0x5143ba,null))[_0x9d34('0x3d')](handleError(_0x5143ba,null));};exports[_0x9d34('0x3f')]=function(_0x26a129,_0xd3d08c){return db['VoiceQueue'][_0x9d34('0x3f')](_0x26a129[_0x9d34('0x40')],{})[_0x9d34('0x1e')](respondWithResult(_0xd3d08c,0xc9))[_0x9d34('0x3d')](handleError(_0xd3d08c,null));};exports[_0x9d34('0x41')]=function(_0x24a29c,_0x266183){var _0x5000cd={'raw':![],'where':{'id':_0x24a29c[_0x9d34('0x42')]['id']}},_0x580a13={};_0x580a13[_0x9d34('0x25')]=_[_0x9d34('0x26')](db['VoiceQueue'][_0x9d34('0x3e')]);_0x5000cd['attributes']=_['intersection'](_0x580a13[_0x9d34('0x25')],qs[_0x9d34('0x2d')](_0x24a29c[_0x9d34('0x28')]['fields']));_0x5000cd[_0x9d34('0x2c')]=_0x5000cd[_0x9d34('0x2c')]['length']?_0x5000cd[_0x9d34('0x2c')]:_0x580a13[_0x9d34('0x25')];if(_0x24a29c[_0x9d34('0x28')][_0x9d34('0x3a')]){_0x5000cd[_0x9d34('0x3b')]=[{'all':!![]}];}_0x5000cd=_['merge']({},_0x5000cd,_0x24a29c['options']);return db['VoiceQueue'][_0x9d34('0x43')](_0x5000cd)[_0x9d34('0x1e')](handleEntityNotFound(_0x266183,null))[_0x9d34('0x1e')](function(_0x3f361e){if(_0x3f361e){var _0x1ca99d=_0x3f361e['get']({'plain':!![]});_0x1ca99d=qs[_0x9d34('0x44')](_0x1ca99d,['id',_0x9d34('0x45'),'updatedAt']);_0x24a29c[_0x9d34('0x40')]=_[_0x9d34('0x44')](_0x24a29c[_0x9d34('0x40')],['id',_0x9d34('0x45'),_0x9d34('0x46')]);return db['VoiceQueue'][_0x9d34('0x3f')](_['merge'](_0x1ca99d,_0x24a29c['body']),{'include':_0x24a29c[_0x9d34('0x28')][_0x9d34('0x3a')]?[{'all':!![]}]:undefined});}})[_0x9d34('0x1e')](respondWithResult(_0x266183,0xc9))[_0x9d34('0x3d')](handleError(_0x266183,null));};exports[_0x9d34('0x1d')]=function(_0x2abd94,_0x48d2fc){if(_0x2abd94[_0x9d34('0x40')]['id']){delete _0x2abd94[_0x9d34('0x40')]['id'];}return db[_0x9d34('0x24')][_0x9d34('0x43')]({'where':{'id':_0x2abd94[_0x9d34('0x42')]['id']}})[_0x9d34('0x1e')](handleEntityNotFound(_0x48d2fc,null))[_0x9d34('0x1e')](saveUpdates(_0x2abd94[_0x9d34('0x40')],null))['then'](respondWithResult(_0x48d2fc,null))[_0x9d34('0x3d')](handleError(_0x48d2fc,null));};exports[_0x9d34('0x1f')]=function(_0x16ed27,_0x176cd6){return db['VoiceQueue'][_0x9d34('0x43')]({'where':{'id':_0x16ed27[_0x9d34('0x42')]['id']}})[_0x9d34('0x1e')](handleEntityNotFound(_0x176cd6,null))[_0x9d34('0x1e')](removeEntity(_0x176cd6,null))[_0x9d34('0x3d')](handleError(_0x176cd6,null));};exports[_0x9d34('0x47')]=function(_0x20865d,_0x1792fb,_0x529637){var _0x572b61={'raw':![],'where':{}};var _0x32f76b={};var _0x2bd730={'count':0x0,'rows':[]};return db[_0x9d34('0x24')]['findOne']({'where':{'id':_0x20865d[_0x9d34('0x42')]['id']}})['then'](handleEntityNotFound(_0x1792fb,null))['then'](function(_0x5b0be2){if(_0x5b0be2){_0x32f76b[_0x9d34('0x25')]=_['keys'](db[_0x9d34('0x48')][_0x9d34('0x3e')]);_0x32f76b[_0x9d34('0x28')]=_[_0x9d34('0x26')](_0x20865d[_0x9d34('0x28')]);_0x32f76b['filters']=_['intersection'](_0x32f76b['model'],_0x32f76b[_0x9d34('0x28')]);_0x572b61[_0x9d34('0x2c')]=_[_0x9d34('0x2b')](_0x32f76b['model'],qs[_0x9d34('0x2d')](_0x20865d['query']['fields']));_0x572b61[_0x9d34('0x2c')]=_0x572b61[_0x9d34('0x2c')][_0x9d34('0x2e')]?_0x572b61['attributes']:_0x32f76b[_0x9d34('0x25')];if(!_0x20865d['query'][_0x9d34('0x49')](_0x9d34('0x2f'))){_0x572b61[_0x9d34('0x18')]=qs[_0x9d34('0x18')](_0x20865d[_0x9d34('0x28')][_0x9d34('0x18')]);_0x572b61[_0x9d34('0x17')]=qs['offset'](_0x20865d[_0x9d34('0x28')]['offset']);}_0x572b61[_0x9d34('0x30')]=qs[_0x9d34('0x31')](_0x20865d[_0x9d34('0x28')][_0x9d34('0x31')]);_0x572b61['where']=qs[_0x9d34('0x2a')](_['pick'](_0x20865d[_0x9d34('0x28')],_0x32f76b[_0x9d34('0x2a')]));_0x572b61[_0x9d34('0x32')]['VoiceQueueId']=_0x5b0be2['id'];if(_0x20865d[_0x9d34('0x28')][_0x9d34('0x38')]){_0x572b61['where']=_[_0x9d34('0x36')](_0x572b61[_0x9d34('0x32')],{'$or':_['map'](_0x572b61[_0x9d34('0x2c')],function(_0x45559f){var _0x4b75f2={};_0x4b75f2[_0x45559f]={'$like':'%'+_0x20865d[_0x9d34('0x28')][_0x9d34('0x38')]+'%'};return _0x4b75f2;})});}_0x572b61=_[_0x9d34('0x36')]({},_0x572b61,_0x20865d[_0x9d34('0x39')]);return db['CmHopper'][_0x9d34('0x16')]({'where':_0x572b61[_0x9d34('0x32')]})[_0x9d34('0x1e')](function(_0xc659e7){_0x2bd730[_0x9d34('0x16')]=_0xc659e7;if(_0x20865d[_0x9d34('0x28')][_0x9d34('0x3a')]){_0x572b61['include']=[{'all':!![]}];}return db[_0x9d34('0x48')]['findAll'](_0x572b61);})[_0x9d34('0x1e')](function(_0x3cc7fc){_0x2bd730['rows']=_0x3cc7fc;return _0x2bd730;});}})['then'](respondWithFilteredResult(_0x1792fb,_0x572b61))[_0x9d34('0x3d')](handleError(_0x1792fb,null));};exports[_0x9d34('0x4a')]=function(_0x3c0fcd,_0x453bff,_0x5ccc7b){var _0x22ed1a={'raw':!![],'where':{}};var _0xb6bda={};var _0xee8819={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3c0fcd[_0x9d34('0x42')]['id']}})[_0x9d34('0x1e')](handleEntityNotFound(_0x453bff,null))[_0x9d34('0x1e')](function(_0x1d4d5a){if(_0x1d4d5a){_0xb6bda[_0x9d34('0x25')]=_[_0x9d34('0x26')](db['CmHopperHistory'][_0x9d34('0x3e')]);_0xb6bda[_0x9d34('0x28')]=_[_0x9d34('0x26')](_0x3c0fcd[_0x9d34('0x28')]);_0xb6bda[_0x9d34('0x2a')]=_[_0x9d34('0x2b')](_0xb6bda['model'],_0xb6bda[_0x9d34('0x28')]);_0x22ed1a[_0x9d34('0x2c')]=_['intersection'](_0xb6bda['model'],qs[_0x9d34('0x2d')](_0x3c0fcd[_0x9d34('0x28')][_0x9d34('0x2d')]));_0x22ed1a['attributes']=_0x22ed1a[_0x9d34('0x2c')][_0x9d34('0x2e')]?_0x22ed1a[_0x9d34('0x2c')]:_0xb6bda['model'];if(!_0x3c0fcd[_0x9d34('0x28')][_0x9d34('0x49')](_0x9d34('0x2f'))){_0x22ed1a[_0x9d34('0x18')]=qs[_0x9d34('0x18')](_0x3c0fcd[_0x9d34('0x28')]['limit']);_0x22ed1a[_0x9d34('0x17')]=qs[_0x9d34('0x17')](_0x3c0fcd[_0x9d34('0x28')][_0x9d34('0x17')]);}_0x22ed1a['order']=qs['sort'](_0x3c0fcd['query'][_0x9d34('0x31')]);_0x22ed1a[_0x9d34('0x32')]=qs[_0x9d34('0x2a')](_['pick'](_0x3c0fcd[_0x9d34('0x28')],_0xb6bda[_0x9d34('0x2a')]));_0x22ed1a[_0x9d34('0x32')][_0x9d34('0x4b')]=_0x1d4d5a['id'];if(_0x3c0fcd[_0x9d34('0x28')][_0x9d34('0x38')]){_0x22ed1a['where']=_[_0x9d34('0x36')](_0x22ed1a[_0x9d34('0x32')],{'$or':_[_0x9d34('0x37')](_0x22ed1a['attributes'],function(_0x417d3c){var _0x31efc9={};_0x31efc9[_0x417d3c]={'$like':'%'+_0x3c0fcd[_0x9d34('0x28')][_0x9d34('0x38')]+'%'};return _0x31efc9;})});}_0x22ed1a=_['merge']({},_0x22ed1a,_0x3c0fcd['options']);return db['CmHopperHistory']['count']({'where':_0x22ed1a['where']})['then'](function(_0x155a66){_0xee8819[_0x9d34('0x16')]=_0x155a66;if(_0x3c0fcd[_0x9d34('0x28')]['includeAll']){_0x22ed1a[_0x9d34('0x3b')]=[{'all':!![]}];}return db[_0x9d34('0x4c')]['findAll'](_0x22ed1a);})[_0x9d34('0x1e')](function(_0xe941fa){_0xee8819[_0x9d34('0x4d')]=_0xe941fa;return _0xee8819;});}})[_0x9d34('0x1e')](respondWithFilteredResult(_0x453bff,_0x22ed1a))[_0x9d34('0x3d')](handleError(_0x453bff,null));};exports[_0x9d34('0x4e')]=function(_0x1d4939,_0x22c5ad,_0x33d679){var _0x1e7968={'raw':!![],'where':{}};var _0x12be4d={};var _0x4e2126={'count':0x0,'rows':[]};return db[_0x9d34('0x24')]['findOne']({'where':{'id':_0x1d4939[_0x9d34('0x42')]['id']}})[_0x9d34('0x1e')](handleEntityNotFound(_0x22c5ad,null))[_0x9d34('0x1e')](function(_0x1f4625){if(_0x1f4625){_0x12be4d[_0x9d34('0x25')]=_[_0x9d34('0x26')](db[_0x9d34('0x4f')][_0x9d34('0x3e')]);_0x12be4d[_0x9d34('0x28')]=_[_0x9d34('0x26')](_0x1d4939[_0x9d34('0x28')]);_0x12be4d['filters']=_[_0x9d34('0x2b')](_0x12be4d[_0x9d34('0x25')],_0x12be4d[_0x9d34('0x28')]);_0x1e7968['attributes']=_[_0x9d34('0x2b')](_0x12be4d[_0x9d34('0x25')],qs['fields'](_0x1d4939['query'][_0x9d34('0x2d')]));_0x1e7968[_0x9d34('0x2c')]=_0x1e7968['attributes'][_0x9d34('0x2e')]?_0x1e7968[_0x9d34('0x2c')]:_0x12be4d[_0x9d34('0x25')];if(!_0x1d4939[_0x9d34('0x28')][_0x9d34('0x49')]('nolimit')){_0x1e7968[_0x9d34('0x18')]=qs[_0x9d34('0x18')](_0x1d4939[_0x9d34('0x28')][_0x9d34('0x18')]);_0x1e7968[_0x9d34('0x17')]=qs[_0x9d34('0x17')](_0x1d4939['query'][_0x9d34('0x17')]);}_0x1e7968['order']=qs[_0x9d34('0x31')](_0x1d4939[_0x9d34('0x28')][_0x9d34('0x31')]);_0x1e7968[_0x9d34('0x32')]=qs['filters'](_[_0x9d34('0x33')](_0x1d4939[_0x9d34('0x28')],_0x12be4d[_0x9d34('0x2a')]));_0x1e7968['where'][_0x9d34('0x4b')]=_0x1f4625['id'];if(_0x1d4939[_0x9d34('0x28')][_0x9d34('0x38')]){_0x1e7968[_0x9d34('0x32')]=_[_0x9d34('0x36')](_0x1e7968['where'],{'$or':_[_0x9d34('0x37')](_0x1e7968[_0x9d34('0x2c')],function(_0x575646){var _0x210ef8={};_0x210ef8[_0x575646]={'$like':'%'+_0x1d4939[_0x9d34('0x28')][_0x9d34('0x38')]+'%'};return _0x210ef8;})});}_0x1e7968=_[_0x9d34('0x36')]({},_0x1e7968,_0x1d4939[_0x9d34('0x39')]);return db[_0x9d34('0x4f')][_0x9d34('0x16')]({'where':_0x1e7968[_0x9d34('0x32')]})[_0x9d34('0x1e')](function(_0x5cafed){_0x4e2126[_0x9d34('0x16')]=_0x5cafed;if(_0x1d4939['query'][_0x9d34('0x3a')]){_0x1e7968['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x1e7968);})['then'](function(_0x8412b2){_0x4e2126[_0x9d34('0x4d')]=_0x8412b2;return _0x4e2126;});}})[_0x9d34('0x1e')](respondWithFilteredResult(_0x22c5ad,_0x1e7968))['catch'](handleError(_0x22c5ad,null));};exports[_0x9d34('0x50')]=function(_0x1b5197,_0x22a93f,_0x12c609){var _0x170793={'raw':!![],'where':{}};var _0x3b02c1={};var _0x16037c={'count':0x0,'rows':[]};return db[_0x9d34('0x24')][_0x9d34('0x51')]({'where':{'id':_0x1b5197['params']['id']}})['then'](handleEntityNotFound(_0x22a93f,null))[_0x9d34('0x1e')](function(_0x216b36){if(_0x216b36){_0x3b02c1[_0x9d34('0x25')]=_[_0x9d34('0x26')](db[_0x9d34('0x52')][_0x9d34('0x3e')]);_0x3b02c1[_0x9d34('0x28')]=_[_0x9d34('0x26')](_0x1b5197[_0x9d34('0x28')]);_0x3b02c1[_0x9d34('0x2a')]=_[_0x9d34('0x2b')](_0x3b02c1[_0x9d34('0x25')],_0x3b02c1[_0x9d34('0x28')]);_0x170793[_0x9d34('0x2c')]=_[_0x9d34('0x2b')](_0x3b02c1[_0x9d34('0x25')],qs['fields'](_0x1b5197[_0x9d34('0x28')][_0x9d34('0x2d')]));_0x170793[_0x9d34('0x2c')]=_0x170793[_0x9d34('0x2c')][_0x9d34('0x2e')]?_0x170793[_0x9d34('0x2c')]:_0x3b02c1[_0x9d34('0x25')];if(!_0x1b5197[_0x9d34('0x28')][_0x9d34('0x49')](_0x9d34('0x2f'))){_0x170793[_0x9d34('0x18')]=qs[_0x9d34('0x18')](_0x1b5197[_0x9d34('0x28')][_0x9d34('0x18')]);_0x170793[_0x9d34('0x17')]=qs[_0x9d34('0x17')](_0x1b5197['query'][_0x9d34('0x17')]);}_0x170793[_0x9d34('0x30')]=qs[_0x9d34('0x31')](_0x1b5197[_0x9d34('0x28')][_0x9d34('0x31')]);_0x170793['where']=qs['filters'](_[_0x9d34('0x33')](_0x1b5197[_0x9d34('0x28')],_0x3b02c1[_0x9d34('0x2a')]));_0x170793[_0x9d34('0x32')][_0x9d34('0x4b')]=_0x216b36['id'];if(_0x1b5197[_0x9d34('0x28')][_0x9d34('0x38')]){_0x170793[_0x9d34('0x32')]=_[_0x9d34('0x36')](_0x170793[_0x9d34('0x32')],{'$or':_['map'](_0x170793[_0x9d34('0x2c')],function(_0x4dc92b){var _0x5db6b6={};_0x5db6b6[_0x4dc92b]={'$like':'%'+_0x1b5197[_0x9d34('0x28')][_0x9d34('0x38')]+'%'};return _0x5db6b6;})});}_0x170793=_['merge']({},_0x170793,_0x1b5197[_0x9d34('0x39')]);return db['CmHopperBlack'][_0x9d34('0x16')]({'where':_0x170793[_0x9d34('0x32')]})[_0x9d34('0x1e')](function(_0x30b739){_0x16037c[_0x9d34('0x16')]=_0x30b739;if(_0x1b5197[_0x9d34('0x28')][_0x9d34('0x3a')]){_0x170793[_0x9d34('0x3b')]=[{'all':!![]}];}return db[_0x9d34('0x52')]['findAll'](_0x170793);})['then'](function(_0x23ad9f){_0x16037c['rows']=_0x23ad9f;return _0x16037c;});}})[_0x9d34('0x1e')](respondWithFilteredResult(_0x22a93f,_0x170793))[_0x9d34('0x3d')](handleError(_0x22a93f,null));};exports[_0x9d34('0x53')]=function(_0x448def,_0x33d0d3,_0x3f5b61){var _0x558ecc={};var _0x1119b2={};var _0x224d13;var _0x567759;return db['VoiceQueue'][_0x9d34('0x51')]({'where':{'id':_0x448def[_0x9d34('0x42')]['id']}})[_0x9d34('0x1e')](handleEntityNotFound(_0x33d0d3,null))['then'](function(_0x7af886){if(_0x7af886){_0x224d13=_0x7af886;_0x1119b2[_0x9d34('0x25')]=_['keys'](db[_0x9d34('0x54')]['rawAttributes']);_0x1119b2['query']=_[_0x9d34('0x26')](_0x448def[_0x9d34('0x28')]);_0x1119b2['filters']=_[_0x9d34('0x2b')](_0x1119b2[_0x9d34('0x25')],_0x1119b2[_0x9d34('0x28')]);_0x558ecc['attributes']=_['intersection'](_0x1119b2[_0x9d34('0x25')],qs[_0x9d34('0x2d')](_0x448def['query'][_0x9d34('0x2d')]));_0x558ecc[_0x9d34('0x2c')]=_0x558ecc[_0x9d34('0x2c')][_0x9d34('0x2e')]?_0x558ecc[_0x9d34('0x2c')]:_0x1119b2[_0x9d34('0x25')];_0x558ecc[_0x9d34('0x30')]=qs[_0x9d34('0x31')](_0x448def[_0x9d34('0x28')]['sort']);_0x558ecc['where']=qs['filters'](_['pick'](_0x448def['query'],_0x1119b2[_0x9d34('0x2a')]));if(_0x448def[_0x9d34('0x28')]['filter']){_0x558ecc[_0x9d34('0x32')]=_[_0x9d34('0x36')](_0x558ecc[_0x9d34('0x32')],{'$or':_[_0x9d34('0x37')](_0x558ecc[_0x9d34('0x2c')],function(_0x25918a){var _0x1c1ddd={};_0x1c1ddd[_0x25918a]={'$like':'%'+_0x448def['query'][_0x9d34('0x38')]+'%'};return _0x1c1ddd;})});}_0x558ecc=_[_0x9d34('0x36')]({},_0x558ecc,_0x448def[_0x9d34('0x39')]);return _0x224d13['getTeams'](_0x558ecc);}})[_0x9d34('0x1e')](function(_0x7bd33a){if(_0x7bd33a){_0x567759=_0x7bd33a['length'];if(!_0x448def[_0x9d34('0x28')][_0x9d34('0x49')](_0x9d34('0x2f'))){_0x558ecc[_0x9d34('0x18')]=qs[_0x9d34('0x18')](_0x448def[_0x9d34('0x28')][_0x9d34('0x18')]);_0x558ecc[_0x9d34('0x17')]=qs[_0x9d34('0x17')](_0x448def[_0x9d34('0x28')][_0x9d34('0x17')]);}return _0x224d13['getTeams'](_0x558ecc);}})[_0x9d34('0x1e')](function(_0x5e0e33){if(_0x5e0e33){return _0x5e0e33?{'count':_0x567759,'rows':_0x5e0e33}:null;}})[_0x9d34('0x1e')](respondWithResult(_0x33d0d3,null))[_0x9d34('0x3d')](handleError(_0x33d0d3,null));};exports['addTeams']=function(_0x4547ce,_0x37c28d,_0x4772b9){var _0x1fcfe3=[];var _0x1c63a0;return db['Team'][_0x9d34('0x3c')]({'where':{'id':_0x4547ce[_0x9d34('0x40')][_0x9d34('0x55')]},'attributes':['id'],'include':[{'model':db[_0x9d34('0x56')],'as':_0x9d34('0x57'),'attributes':['id'],'raw':!![]}]})[_0x9d34('0x1e')](function(_0x2d23a5){if(_0x2d23a5){for(var _0x567fe5=0x0;_0x567fe5<_0x2d23a5[_0x9d34('0x2e')];_0x567fe5+=0x1){for(var _0x230b2a=0x0;_0x230b2a<_0x2d23a5[_0x567fe5]['Agents'][_0x9d34('0x2e')];_0x230b2a+=0x1){_0x1fcfe3=_[_0x9d34('0x58')](_0x1fcfe3,[_0x2d23a5[_0x567fe5][_0x9d34('0x57')][_0x230b2a]['id']]);}}return _0x1fcfe3;}})[_0x9d34('0x1e')](function(_0xeaf663){if(_0xeaf663){return db[_0x9d34('0x24')]['find']({'where':{'id':_0x4547ce[_0x9d34('0x42')]['id']}});}})[_0x9d34('0x1e')](function(_0x5c43a9){if(_0x5c43a9){_0x1c63a0=_0x5c43a9;return _0x1c63a0[_0x9d34('0x59')](_0x1fcfe3,{'penalty':_0x4547ce['body'][_0x9d34('0x5a')]});}})['then'](function(_0x29ad04){if(_0x29ad04){return _0x1c63a0[_0x9d34('0x5b')](_0x4547ce['body'][_0x9d34('0x55')]);}})[_0x9d34('0x1e')](handleEntityNotFound(_0x37c28d,null))[_0x9d34('0x1e')](respondWithStatusCode(_0x37c28d,null))['catch'](handleError(_0x37c28d,null));};exports[_0x9d34('0x5c')]=function(_0x16c11f,_0x30c784,_0xcde93d){var _0x41b31c=[];var _0x490049;return db['Team'][_0x9d34('0x3c')]({'where':{'id':_0x16c11f['query'][_0x9d34('0x55')]},'attributes':['id'],'include':[{'model':db[_0x9d34('0x56')],'as':_0x9d34('0x57'),'attributes':['id'],'raw':!![]}]})[_0x9d34('0x1e')](function(_0x11d244){if(_0x11d244){for(var _0x528e8e=0x0;_0x528e8e<_0x11d244['length'];_0x528e8e+=0x1){for(var _0x43680d=0x0;_0x43680d<_0x11d244[_0x528e8e][_0x9d34('0x57')][_0x9d34('0x2e')];_0x43680d+=0x1){_0x41b31c=_[_0x9d34('0x58')](_0x41b31c,[_0x11d244[_0x528e8e][_0x9d34('0x57')][_0x43680d]['id']]);}}return _0x41b31c;}})[_0x9d34('0x1e')](function(_0x2459ea){if(_0x2459ea){return db['VoiceQueue'][_0x9d34('0x43')]({'where':{'id':_0x16c11f[_0x9d34('0x42')]['id']}});}})[_0x9d34('0x1e')](function(_0x2db155){if(_0x2db155){_0x490049=_0x2db155;return _0x490049[_0x9d34('0x5d')](_0x41b31c);}})['then'](function(_0x4d25c1){if(_0x490049){return _0x490049[_0x9d34('0x5c')](_0x16c11f[_0x9d34('0x28')]['ids']);}})[_0x9d34('0x1e')](handleEntityNotFound(_0x30c784,null))[_0x9d34('0x1e')](respondWithStatusCode(_0x30c784,null))[_0x9d34('0x3d')](handleError(_0x30c784,null));};exports[_0x9d34('0x59')]=function(_0x3a748c,_0x420044,_0x2eb5f2){var _0x5dd1d1,_0x3ecb20;return db[_0x9d34('0x24')][_0x9d34('0x43')]({'where':{'id':_0x3a748c[_0x9d34('0x42')]['id']}})[_0x9d34('0x1e')](handleEntityNotFound(_0x420044,null))[_0x9d34('0x1e')](function(_0x3de013){if(_0x3de013){_0x3ecb20=_0x3de013;return _0x3de013['addAgents'](_0x3a748c[_0x9d34('0x40')]['ids'],_[_0x9d34('0x44')](_0x3a748c[_0x9d34('0x40')],[_0x9d34('0x55'),'id'])||{})['spread'](function(_0x3557cf){for(var _0x22e288=0x0;_0x22e288<_0x3a748c['body'][_0x9d34('0x55')][_0x9d34('0x2e')];_0x22e288+=0x1){socket[_0x9d34('0x5e')](_0x9d34('0x5f'),{'UserId':_0x3a748c[_0x9d34('0x40')][_0x9d34('0x55')][_0x22e288],'VoiceQueueId':_0x3a748c[_0x9d34('0x42')]['id']});}return _0x3557cf;});}})[_0x9d34('0x1e')](function(_0x5eb87e){_0x5dd1d1=_0x5eb87e||[];if(_0x3ecb20){return db[_0x9d34('0x56')][_0x9d34('0x3c')]({'where':{'id':_0x3a748c['body']['ids']},'attributes':['id',_0x9d34('0x21'),_0x9d34('0x60'),_0x9d34('0x61')],'raw':!![]});}})['then'](function(_0x126e17){if(_0x126e17&&_0x126e17[_0x9d34('0x2e')]){var _0x38b082=[];for(var _0x4d4b6e=0x0;_0x4d4b6e<_0x126e17[_0x9d34('0x2e')];_0x4d4b6e++){_0x38b082[_0x9d34('0x62')](db['UserVoiceQueueRt'][_0x9d34('0x63')]({'membername':_0x126e17[_0x4d4b6e][_0x9d34('0x21')],'UserId':_0x126e17[_0x4d4b6e]['id'],'queue_name':_0x3ecb20[_0x9d34('0x21')],'VoiceQueueId':_0x3ecb20['id'],'interface':util[_0x9d34('0x64')]('%s/%s',_0x9d34('0x65'),_0x126e17[_0x4d4b6e][_0x9d34('0x21')]),'paused':_0x126e17[_0x4d4b6e][_0x9d34('0x61')]||![],'penalty':_0x3a748c['body'][_0x9d34('0x5a')]||0x0}));}return BPromise[_0x9d34('0x66')](_0x38b082);}})[_0x9d34('0x1e')](function(_0x47bd4c){return _0x5dd1d1;})[_0x9d34('0x1e')](respondWithResult(_0x420044,null))['catch'](handleError(_0x420044,null));};exports[_0x9d34('0x5d')]=function(_0x26092b,_0x414950,_0x1361e3){var _0x1b923d;return db[_0x9d34('0x24')][_0x9d34('0x43')]({'where':{'id':_0x26092b[_0x9d34('0x42')]['id']}})[_0x9d34('0x1e')](handleEntityNotFound(_0x414950,null))[_0x9d34('0x1e')](function(_0x5a4432){if(_0x5a4432){return _0x5a4432[_0x9d34('0x5d')](_0x26092b[_0x9d34('0x28')][_0x9d34('0x55')])[_0x9d34('0x1e')](function(_0x232c72){if(_[_0x9d34('0x67')](_0x26092b['query']['ids'])){for(var _0x47d885=0x0;_0x47d885<_0x26092b[_0x9d34('0x28')][_0x9d34('0x55')]['length'];_0x47d885+=0x1){socket[_0x9d34('0x5e')](_0x9d34('0x68'),{'UserId':_0x26092b[_0x9d34('0x28')][_0x9d34('0x55')][_0x47d885],'VoiceQueueId':_0x26092b['params']['id']});}}else{socket[_0x9d34('0x5e')](_0x9d34('0x68'),{'UserId':_0x26092b['query'][_0x9d34('0x55')],'VoiceQueueId':_0x26092b[_0x9d34('0x42')]['id']});}});}})[_0x9d34('0x1e')](function(_0x273967){if(_0x26092b['query'][_0x9d34('0x69')]){_0x1b923d=_0x273967;return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x26092b[_0x9d34('0x42')]['id'],'UserId':_0x26092b['query'][_0x9d34('0x55')]}})[_0x9d34('0x1e')](function(){return _0x1b923d;});}})[_0x9d34('0x1e')](respondWithStatusCode(_0x414950,null))[_0x9d34('0x3d')](handleError(_0x414950,null));};exports[_0x9d34('0x6a')]=function(_0x4c73d0,_0x3557d,_0xd69f7f){var _0x12732a={};var _0x53d2dc={};var _0x2f8eed;var _0xf81df5;return db[_0x9d34('0x24')][_0x9d34('0x51')]({'where':{'id':_0x4c73d0[_0x9d34('0x42')]['id']}})['then'](handleEntityNotFound(_0x3557d,null))['then'](function(_0x340114){if(_0x340114){_0x2f8eed=_0x340114;_0x53d2dc[_0x9d34('0x25')]=_[_0x9d34('0x26')](db['User'][_0x9d34('0x3e')]);_0x53d2dc[_0x9d34('0x28')]=_[_0x9d34('0x26')](_0x4c73d0['query']);_0x53d2dc[_0x9d34('0x2a')]=_[_0x9d34('0x2b')](_0x53d2dc['model'],_0x53d2dc[_0x9d34('0x28')]);_0x12732a[_0x9d34('0x2c')]=_[_0x9d34('0x2b')](_0x53d2dc[_0x9d34('0x25')],qs['fields'](_0x4c73d0['query'][_0x9d34('0x2d')]));_0x12732a['attributes']=_0x12732a[_0x9d34('0x2c')][_0x9d34('0x2e')]?_0x12732a[_0x9d34('0x2c')]:_0x53d2dc[_0x9d34('0x25')];_0x12732a[_0x9d34('0x30')]=qs[_0x9d34('0x31')](_0x4c73d0[_0x9d34('0x28')][_0x9d34('0x31')]);_0x12732a[_0x9d34('0x32')]=qs[_0x9d34('0x2a')](_['pick'](_0x4c73d0[_0x9d34('0x28')],_0x53d2dc[_0x9d34('0x2a')]));if(_0x4c73d0['query'][_0x9d34('0x38')]){_0x12732a['where']=_[_0x9d34('0x36')](_0x12732a[_0x9d34('0x32')],{'$or':_[_0x9d34('0x37')](_0x12732a['attributes'],function(_0x383534){var _0x159cef={};_0x159cef[_0x383534]={'$like':'%'+_0x4c73d0[_0x9d34('0x28')][_0x9d34('0x38')]+'%'};return _0x159cef;})});}_0x12732a=_[_0x9d34('0x36')]({},_0x12732a,_0x4c73d0[_0x9d34('0x39')]);return _0x2f8eed['getAgents'](_0x12732a);}})['then'](function(_0x999350){if(_0x999350){_0xf81df5=_0x999350[_0x9d34('0x2e')];if(!_0x4c73d0[_0x9d34('0x28')][_0x9d34('0x49')]('nolimit')){_0x12732a[_0x9d34('0x18')]=qs[_0x9d34('0x18')](_0x4c73d0[_0x9d34('0x28')][_0x9d34('0x18')]);_0x12732a[_0x9d34('0x17')]=qs['offset'](_0x4c73d0[_0x9d34('0x28')][_0x9d34('0x17')]);}return _0x2f8eed[_0x9d34('0x6a')](_0x12732a);}})[_0x9d34('0x1e')](function(_0x366303){if(_0x366303){return _0x366303?{'count':_0xf81df5,'rows':_0x366303}:null;}})[_0x9d34('0x1e')](respondWithResult(_0x3557d,null))['catch'](handleError(_0x3557d,null));};exports[_0x9d34('0x6b')]=function(_0x10ad96,_0xa2b7d6,_0x43c21f){var _0x58d6b8={};var _0x45b612={};var _0x19cbe8;var _0x1fe272;return db[_0x9d34('0x24')][_0x9d34('0x51')]({'where':{'id':_0x10ad96['params']['id']}})['then'](handleEntityNotFound(_0xa2b7d6,null))['then'](function(_0x5a939f){if(_0x5a939f){_0x19cbe8=_0x5a939f;_0x45b612[_0x9d34('0x25')]=_[_0x9d34('0x26')](db[_0x9d34('0x6c')]['rawAttributes']);_0x45b612[_0x9d34('0x28')]=_['keys'](_0x10ad96['query']);_0x45b612[_0x9d34('0x2a')]=_[_0x9d34('0x2b')](_0x45b612[_0x9d34('0x25')],_0x45b612[_0x9d34('0x28')]);_0x58d6b8[_0x9d34('0x2c')]=_['intersection'](_0x45b612['model'],qs[_0x9d34('0x2d')](_0x10ad96[_0x9d34('0x28')][_0x9d34('0x2d')]));_0x58d6b8[_0x9d34('0x2c')]=_0x58d6b8[_0x9d34('0x2c')]['length']?_0x58d6b8['attributes']:_0x45b612['model'];_0x58d6b8[_0x9d34('0x30')]=qs[_0x9d34('0x31')](_0x10ad96['query'][_0x9d34('0x31')]);_0x58d6b8[_0x9d34('0x32')]=qs['filters'](_[_0x9d34('0x33')](_0x10ad96['query'],_0x45b612[_0x9d34('0x2a')]));if(_0x10ad96['query'][_0x9d34('0x38')]){_0x58d6b8[_0x9d34('0x32')]=_[_0x9d34('0x36')](_0x58d6b8[_0x9d34('0x32')],{'$or':_[_0x9d34('0x37')](_0x58d6b8[_0x9d34('0x2c')],function(_0x2d201d){var _0x3c0a13={};_0x3c0a13[_0x2d201d]={'$like':'%'+_0x10ad96[_0x9d34('0x28')][_0x9d34('0x38')]+'%'};return _0x3c0a13;})});}_0x58d6b8=_[_0x9d34('0x36')]({},_0x58d6b8,_0x10ad96['options']);return _0x19cbe8[_0x9d34('0x6b')](_0x58d6b8);}})[_0x9d34('0x1e')](function(_0x59a891){if(_0x59a891){_0x1fe272=_0x59a891[_0x9d34('0x2e')];if(!_0x10ad96['query'][_0x9d34('0x49')](_0x9d34('0x2f'))){_0x58d6b8[_0x9d34('0x18')]=qs['limit'](_0x10ad96[_0x9d34('0x28')]['limit']);_0x58d6b8['offset']=qs[_0x9d34('0x17')](_0x10ad96[_0x9d34('0x28')]['offset']);}return _0x19cbe8[_0x9d34('0x6b')](_0x58d6b8);}})[_0x9d34('0x1e')](function(_0x153c2d){return _0x153c2d?{'count':_0x1fe272,'rows':_0x153c2d}:null;})['then'](respondWithResult(_0xa2b7d6,null))[_0x9d34('0x3d')](handleError(_0xa2b7d6,null));};exports[_0x9d34('0x6d')]=function(_0x460f72,_0x5a22d2,_0x117a38){var _0x577c46={};var _0xa47882={};var _0x3ed4b9;var _0x3c14d0;return db[_0x9d34('0x24')][_0x9d34('0x51')]({'where':{'id':_0x460f72[_0x9d34('0x42')]['id']}})[_0x9d34('0x1e')](handleEntityNotFound(_0x5a22d2,null))['then'](function(_0x5acd47){if(_0x5acd47){_0x3ed4b9=_0x5acd47;_0xa47882['model']=_[_0x9d34('0x26')](db['CmList'][_0x9d34('0x3e')]);_0xa47882[_0x9d34('0x28')]=_[_0x9d34('0x26')](_0x460f72['query']);_0xa47882[_0x9d34('0x2a')]=_[_0x9d34('0x2b')](_0xa47882[_0x9d34('0x25')],_0xa47882[_0x9d34('0x28')]);_0x577c46['attributes']=_['intersection'](_0xa47882['model'],qs[_0x9d34('0x2d')](_0x460f72['query']['fields']));_0x577c46['attributes']=_0x577c46[_0x9d34('0x2c')][_0x9d34('0x2e')]?_0x577c46[_0x9d34('0x2c')]:_0xa47882[_0x9d34('0x25')];_0x577c46[_0x9d34('0x30')]=qs[_0x9d34('0x31')](_0x460f72[_0x9d34('0x28')][_0x9d34('0x31')]);_0x577c46[_0x9d34('0x32')]=qs[_0x9d34('0x2a')](_[_0x9d34('0x33')](_0x460f72['query'],_0xa47882[_0x9d34('0x2a')]));if(_0x460f72[_0x9d34('0x28')][_0x9d34('0x38')]){_0x577c46[_0x9d34('0x32')]=_[_0x9d34('0x36')](_0x577c46[_0x9d34('0x32')],{'$or':_[_0x9d34('0x37')](_0x577c46[_0x9d34('0x2c')],function(_0x484b18){var _0x32e241={};_0x32e241[_0x484b18]={'$like':'%'+_0x460f72[_0x9d34('0x28')][_0x9d34('0x38')]+'%'};return _0x32e241;})});}_0x577c46=_[_0x9d34('0x36')]({},_0x577c46,_0x460f72['options']);return _0x3ed4b9[_0x9d34('0x6d')](_0x577c46);}})['then'](function(_0x229bed){if(_0x229bed){_0x3c14d0=_0x229bed[_0x9d34('0x2e')];if(!_0x460f72[_0x9d34('0x28')][_0x9d34('0x49')](_0x9d34('0x2f'))){_0x577c46[_0x9d34('0x18')]=qs['limit'](_0x460f72[_0x9d34('0x28')][_0x9d34('0x18')]);_0x577c46[_0x9d34('0x17')]=qs[_0x9d34('0x17')](_0x460f72[_0x9d34('0x28')][_0x9d34('0x17')]);}return _0x3ed4b9[_0x9d34('0x6d')](_0x577c46);}})['then'](function(_0x3ecf46){if(_0x3ecf46){return _0x3ecf46?{'count':_0x3c14d0,'rows':_0x3ecf46}:null;}})[_0x9d34('0x1e')](respondWithResult(_0x5a22d2,null))[_0x9d34('0x3d')](handleError(_0x5a22d2,null));};exports['addLists']=function(_0x289a87,_0x48d4e1,_0x5f4906){var _0x3d9b54,_0x169de2;return db[_0x9d34('0x24')][_0x9d34('0x43')]({'where':{'id':_0x289a87['params']['id']}})['then'](handleEntityNotFound(_0x48d4e1,null))['then'](function(_0x500e58){if(_0x500e58){_0x169de2=_0x500e58;return _0x500e58[_0x9d34('0x6e')](_0x289a87[_0x9d34('0x40')][_0x9d34('0x55')],_[_0x9d34('0x44')](_0x289a87[_0x9d34('0x40')],['ids','id'])||{});}return null;})[_0x9d34('0x6f')](function(_0x7dd2de){var _0x31efdd;_0x3d9b54=_0x7dd2de||[];var _0x58c07b=[];if(_0x7dd2de){for(var _0x55ae90=0x0;_0x55ae90<_0x7dd2de[_0x9d34('0x2e')];_0x55ae90+=0x1){var _0x412144=_0x7dd2de[_0x55ae90][_0x9d34('0x70')]({'plain':!![]});_0x169de2[_0x9d34('0x71')]=_0x289a87['body'][_0x9d34('0x71')]?_0x289a87['body']['dialCheckDuplicateType']:_0x169de2[_0x9d34('0x71')];switch(_0x169de2[_0x9d34('0x71')]){case _0x9d34('0x72'):_0x31efdd=squel[_0x9d34('0x73')]()[_0x9d34('0x74')](_0x9d34('0x75'))['fromQuery'](['phone','scheduledAt',_0x9d34('0x76'),_0x9d34('0x77'),_0x9d34('0x4b'),'createdAt',_0x9d34('0x46')],squel[_0x9d34('0x78')]()[_0x9d34('0x79')](_0x9d34('0x7a'),_0x9d34('0x7a'))['field'](_0x9d34('0x7b'),'scheduledAt')[_0x9d34('0x79')]('id',_0x9d34('0x76'))['field'](_0x412144[_0x9d34('0x7c')][_0x9d34('0x7d')](),_0x9d34('0x77'))[_0x9d34('0x79')](_0x289a87[_0x9d34('0x42')]['id']['toString'](),_0x9d34('0x4b'))['field'](_0x9d34('0x7b'),'createdAt')[_0x9d34('0x79')](_0x9d34('0x7b'),_0x9d34('0x46'))[_0x9d34('0x7e')]('cm_contacts')['where'](_0x9d34('0x7f'))['where'](_0x9d34('0x80'),_0x412144[_0x9d34('0x7c')][_0x9d34('0x7d')]())['where'](_0x9d34('0x81'))[_0x9d34('0x32')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9d34('0x78')]()[_0x9d34('0x79')](_0x9d34('0x82'))[_0x9d34('0x7e')](_0x9d34('0x83'))['where'](_0x9d34('0x84'),_0x289a87[_0x9d34('0x42')]['id']['toString']()))[_0x9d34('0x32')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9d34('0x78')]()[_0x9d34('0x79')](_0x9d34('0x7a'))[_0x9d34('0x7e')](_0x9d34('0x75'))[_0x9d34('0x32')](_0x9d34('0x84'),_0x289a87['params']['id']['toString']())))[_0x9d34('0x7d')]();break;case _0x9d34('0x85'):_0x31efdd=squel[_0x9d34('0x73')]()[_0x9d34('0x74')](_0x9d34('0x75'))[_0x9d34('0x86')]([_0x9d34('0x7a'),_0x9d34('0x87'),'ContactId',_0x9d34('0x77'),_0x9d34('0x4b'),'createdAt',_0x9d34('0x46')],squel[_0x9d34('0x78')]()[_0x9d34('0x79')]('phone',_0x9d34('0x7a'))[_0x9d34('0x79')](_0x9d34('0x7b'),_0x9d34('0x87'))[_0x9d34('0x79')]('id','ContactId')['field'](_0x412144[_0x9d34('0x7c')][_0x9d34('0x7d')](),_0x9d34('0x77'))['field'](_0x289a87['params']['id'][_0x9d34('0x7d')](),_0x9d34('0x4b'))['field'](_0x9d34('0x7b'),'createdAt')[_0x9d34('0x79')](_0x9d34('0x7b'),'updatedAt')[_0x9d34('0x7e')](_0x9d34('0x88'))[_0x9d34('0x32')](_0x9d34('0x7f'))[_0x9d34('0x32')](_0x9d34('0x80'),_0x412144['CmListId']['toString']())[_0x9d34('0x32')](_0x9d34('0x81'))[_0x9d34('0x32')](_0x9d34('0x89'),squel['select']()[_0x9d34('0x79')](_0x9d34('0x7a'))['from'](_0x9d34('0x75'))[_0x9d34('0x32')]('VoiceQueueId\x20=\x20?',_0x289a87[_0x9d34('0x42')]['id'][_0x9d34('0x7d')]())))[_0x9d34('0x7d')]();break;default:_0x31efdd=squel[_0x9d34('0x73')]()['into'](_0x9d34('0x75'))['fromQuery']([_0x9d34('0x7a'),'scheduledAt',_0x9d34('0x76'),_0x9d34('0x77'),_0x9d34('0x4b'),_0x9d34('0x45'),_0x9d34('0x46')],squel[_0x9d34('0x78')]()[_0x9d34('0x79')](_0x9d34('0x7a'),'phone')[_0x9d34('0x79')](_0x9d34('0x7b'),_0x9d34('0x87'))[_0x9d34('0x79')]('id','ContactId')[_0x9d34('0x79')](_0x412144[_0x9d34('0x7c')]['toString'](),_0x9d34('0x77'))['field'](_0x289a87[_0x9d34('0x42')]['id']['toString'](),_0x9d34('0x4b'))[_0x9d34('0x79')](_0x9d34('0x7b'),_0x9d34('0x45'))['field'](_0x9d34('0x7b'),_0x9d34('0x46'))['from'](_0x9d34('0x88'))[_0x9d34('0x32')]('deletedAt\x20IS\x20NULL')[_0x9d34('0x32')](_0x9d34('0x80'),_0x412144[_0x9d34('0x7c')][_0x9d34('0x7d')]())[_0x9d34('0x32')]('phone\x20IS\x20NOT\x20NULL'))[_0x9d34('0x7d')]();}_0x58c07b[_0x9d34('0x62')](db[_0x9d34('0x8a')]['query'](_0x31efdd));}return BPromise['all'](_0x58c07b);}})[_0x9d34('0x1e')](function(){return _0x3d9b54;})[_0x9d34('0x1e')](respondWithResult(_0x48d4e1,null))[_0x9d34('0x3d')](handleError(_0x48d4e1,null));};exports['removeLists']=function(_0x1b9299,_0x2d8b75,_0x157c7a){var _0x572cbb;return db[_0x9d34('0x24')][_0x9d34('0x43')]({'where':{'id':_0x1b9299[_0x9d34('0x42')]['id']}})['then'](handleEntityNotFound(_0x2d8b75,null))['then'](function(_0xcc2c4e){if(_0xcc2c4e){return _0xcc2c4e[_0x9d34('0x8b')](_0x1b9299[_0x9d34('0x28')][_0x9d34('0x55')]);}})[_0x9d34('0x1e')](function(_0x3e97ae){if(_0x3e97ae){_0x572cbb=_0x3e97ae;return db[_0x9d34('0x48')][_0x9d34('0x1f')]({'where':{'ListId':_0x1b9299[_0x9d34('0x28')][_0x9d34('0x55')],'VoiceQueueId':_0x1b9299['params']['id']}})[_0x9d34('0x1e')](function(){return _0x572cbb;});}})[_0x9d34('0x1e')](respondWithStatusCode(_0x2d8b75,null))[_0x9d34('0x3d')](handleError(_0x2d8b75,null));};exports[_0x9d34('0x8c')]=function(_0x38795e,_0x1b2362,_0x183aa1){var _0x56b4b5={};var _0x86b4a={};var _0x1e8ebd;var _0x3e8573;return db[_0x9d34('0x24')][_0x9d34('0x51')]({'where':{'id':_0x38795e['params']['id']}})[_0x9d34('0x1e')](handleEntityNotFound(_0x1b2362,null))['then'](function(_0x5f2c23){if(_0x5f2c23){_0x1e8ebd=_0x5f2c23;_0x86b4a[_0x9d34('0x25')]=_[_0x9d34('0x26')](db[_0x9d34('0x8d')][_0x9d34('0x3e')]);_0x86b4a[_0x9d34('0x28')]=_['keys'](_0x38795e[_0x9d34('0x28')]);_0x86b4a[_0x9d34('0x2a')]=_['intersection'](_0x86b4a['model'],_0x86b4a[_0x9d34('0x28')]);_0x56b4b5[_0x9d34('0x2c')]=_[_0x9d34('0x2b')](_0x86b4a[_0x9d34('0x25')],qs['fields'](_0x38795e[_0x9d34('0x28')]['fields']));_0x56b4b5['attributes']=_0x56b4b5[_0x9d34('0x2c')][_0x9d34('0x2e')]?_0x56b4b5[_0x9d34('0x2c')]:_0x86b4a[_0x9d34('0x25')];_0x56b4b5['order']=qs[_0x9d34('0x31')](_0x38795e['query']['sort']);_0x56b4b5['where']=qs['filters'](_[_0x9d34('0x33')](_0x38795e[_0x9d34('0x28')],_0x86b4a[_0x9d34('0x2a')]));if(_0x38795e[_0x9d34('0x28')][_0x9d34('0x38')]){_0x56b4b5['where']=_[_0x9d34('0x36')](_0x56b4b5[_0x9d34('0x32')],{'$or':_[_0x9d34('0x37')](_0x56b4b5[_0x9d34('0x2c')],function(_0x514a39){var _0x12c47d={};_0x12c47d[_0x514a39]={'$like':'%'+_0x38795e[_0x9d34('0x28')][_0x9d34('0x38')]+'%'};return _0x12c47d;})});}_0x56b4b5=_[_0x9d34('0x36')]({},_0x56b4b5,_0x38795e[_0x9d34('0x39')]);return _0x1e8ebd[_0x9d34('0x8c')](_0x56b4b5);}})[_0x9d34('0x1e')](function(_0x4f3034){if(_0x4f3034){_0x3e8573=_0x4f3034[_0x9d34('0x2e')];if(!_0x38795e[_0x9d34('0x28')][_0x9d34('0x49')](_0x9d34('0x2f'))){_0x56b4b5[_0x9d34('0x18')]=qs[_0x9d34('0x18')](_0x38795e['query']['limit']);_0x56b4b5[_0x9d34('0x17')]=qs[_0x9d34('0x17')](_0x38795e[_0x9d34('0x28')][_0x9d34('0x17')]);}return _0x1e8ebd[_0x9d34('0x8c')](_0x56b4b5);}})[_0x9d34('0x1e')](function(_0x21d73c){if(_0x21d73c){return _0x21d73c?{'count':_0x3e8573,'rows':_0x21d73c}:null;}})[_0x9d34('0x1e')](respondWithResult(_0x1b2362,null))[_0x9d34('0x3d')](handleError(_0x1b2362,null));};exports[_0x9d34('0x8e')]=function(_0x5ac6b6,_0x1a40bb,_0x561c26){var _0x5ee64b,_0x4c1e17;return db[_0x9d34('0x24')][_0x9d34('0x43')]({'where':{'id':_0x5ac6b6[_0x9d34('0x42')]['id']}})[_0x9d34('0x1e')](handleEntityNotFound(_0x1a40bb,null))[_0x9d34('0x1e')](function(_0x52c200){if(_0x52c200){_0x4c1e17=_0x52c200;return _0x52c200[_0x9d34('0x8e')](_0x5ac6b6[_0x9d34('0x40')][_0x9d34('0x55')],_[_0x9d34('0x44')](_0x5ac6b6[_0x9d34('0x40')],['ids','id'])||{});}return null;})[_0x9d34('0x6f')](function(_0x225fe6){var _0x3e9964;_0x5ee64b=_0x225fe6||[];var _0x4571cd=[];if(_0x225fe6){for(var _0x1b2cd9=0x0;_0x1b2cd9<_0x225fe6[_0x9d34('0x2e')];_0x1b2cd9+=0x1){var _0x51ee9f=_0x225fe6[_0x1b2cd9]['get']({'plain':!![]});_0x3e9964=squel[_0x9d34('0x73')]()[_0x9d34('0x74')](_0x9d34('0x8f'))[_0x9d34('0x86')]([_0x9d34('0x7a'),'ContactId',_0x9d34('0x77'),'VoiceQueueId',_0x9d34('0x45'),_0x9d34('0x46')],squel['select']()['field']('phone',_0x9d34('0x7a'))[_0x9d34('0x79')]('id','ContactId')[_0x9d34('0x79')](_0x51ee9f[_0x9d34('0x7c')]['toString'](),_0x9d34('0x77'))[_0x9d34('0x79')](_0x5ac6b6[_0x9d34('0x42')]['id'][_0x9d34('0x7d')](),_0x9d34('0x4b'))['field'](_0x9d34('0x7b'),_0x9d34('0x45'))[_0x9d34('0x79')]('NOW()',_0x9d34('0x46'))[_0x9d34('0x7e')](_0x9d34('0x88'))[_0x9d34('0x32')](_0x9d34('0x7f'))[_0x9d34('0x32')](_0x9d34('0x80'),_0x51ee9f[_0x9d34('0x7c')]['toString']())[_0x9d34('0x32')](_0x9d34('0x81')))[_0x9d34('0x7d')]();_0x4571cd[_0x9d34('0x62')](db[_0x9d34('0x8a')][_0x9d34('0x28')](_0x3e9964));}return BPromise[_0x9d34('0x66')](_0x4571cd);}})[_0x9d34('0x1e')](function(){return _0x5ee64b;})[_0x9d34('0x1e')](respondWithResult(_0x1a40bb,null))[_0x9d34('0x3d')](handleError(_0x1a40bb,null));};exports[_0x9d34('0x90')]=function(_0xdd3d4f,_0x2fb7fa,_0x3a1b99){var _0x11eaf3;return db['VoiceQueue'][_0x9d34('0x43')]({'where':{'id':_0xdd3d4f[_0x9d34('0x42')]['id']}})['then'](handleEntityNotFound(_0x2fb7fa,null))[_0x9d34('0x1e')](function(_0x19ca82){if(_0x19ca82){return _0x19ca82[_0x9d34('0x90')](_0xdd3d4f[_0x9d34('0x28')]['ids']);}})[_0x9d34('0x1e')](function(_0x609442){if(_0x609442){_0x11eaf3=_0x609442;return db[_0x9d34('0x52')][_0x9d34('0x1f')]({'where':{'ListId':_0xdd3d4f[_0x9d34('0x28')][_0x9d34('0x55')],'VoiceQueueId':_0xdd3d4f['params']['id']}})[_0x9d34('0x1e')](function(){return _0x11eaf3;});}})[_0x9d34('0x1e')](respondWithStatusCode(_0x2fb7fa,null))[_0x9d34('0x3d')](handleError(_0x2fb7fa,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index e1c5a3c..03d8967 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 _0xad95=['events','../../mysqldb','VoiceQueue','update','remove','hook','exports'];(function(_0x3e32a8,_0x255953){var _0x2997b0=function(_0x2d564a){while(--_0x2d564a){_0x3e32a8['push'](_0x3e32a8['shift']());}};_0x2997b0(++_0x255953);}(_0xad95,0x70));var _0x5ad9=function(_0x5c0db6,_0x2b0800){_0x5c0db6=_0x5c0db6-0x0;var _0x2ee691=_0xad95[_0x5c0db6];return _0x2ee691;};'use strict';var EventEmitter=require(_0x5ad9('0x0'));var VoiceQueue=require(_0x5ad9('0x1'))['db'][_0x5ad9('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5ad9('0x3'),'afterDestroy':_0x5ad9('0x4')};function emitEvent(_0x59809d){return function(_0x5c9fd6,_0x185bff,_0x5277fa){VoiceQueueEvents['emit'](_0x59809d+':'+_0x5c9fd6['id'],_0x5c9fd6);VoiceQueueEvents['emit'](_0x59809d,_0x5c9fd6);_0x5277fa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x5ad9('0x5')](e,emitEvent(event));}}module[_0x5ad9('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0x64c0=['hook','VoiceQueue','save','update','remove','emit','hasOwnProperty'];(function(_0x4b1eaf,_0x4cfbf3){var _0x1148ac=function(_0x48fc7e){while(--_0x48fc7e){_0x4b1eaf['push'](_0x4b1eaf['shift']());}};_0x1148ac(++_0x4cfbf3);}(_0x64c0,0x8d));var _0x064c=function(_0x3e9bc8,_0x129a12){_0x3e9bc8=_0x3e9bc8-0x0;var _0x5b40b7=_0x64c0[_0x3e9bc8];return _0x5b40b7;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db'][_0x064c('0x0')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x064c('0x1'),'afterUpdate':_0x064c('0x2'),'afterDestroy':_0x064c('0x3')};function emitEvent(_0x2d7652){return function(_0x45119a,_0xceeb65,_0x9f8e68){VoiceQueueEvents[_0x064c('0x4')](_0x2d7652+':'+_0x45119a['id'],_0x45119a);VoiceQueueEvents[_0x064c('0x4')](_0x2d7652,_0x45119a);_0x9f8e68(null);};}for(var e in events){if(events[_0x064c('0x5')](e)){var event=events[e];VoiceQueue[_0x064c('0x6')](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 c8fd185..843eb23 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 _0x3923=['../../config/logger','moment','request-promise','exports','define','VoiceQueue','util'];(function(_0x24dbf0,_0x4a696c){var _0x2af377=function(_0x1daec4){while(--_0x1daec4){_0x24dbf0['push'](_0x24dbf0['shift']());}};_0x2af377(++_0x4a696c);}(_0x3923,0xb5));var _0x3392=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x3923[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x3392('0x0'));var logger=require(_0x3392('0x1'))('api');var moment=require(_0x3392('0x2'));var BPromise=require('bluebird');var rp=require(_0x3392('0x3'));var attributes=require('./voiceQueue.attributes');module[_0x3392('0x4')]=function(_0x4a9b37,_0x1f7917){return _0x4a9b37[_0x3392('0x5')](_0x3392('0x6'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x444b=['lodash','moment','bluebird','request-promise','./voiceQueue.attributes','exports','define','VoiceQueue','voice_queues'];(function(_0x43bfb2,_0x4b9265){var _0x2e8123=function(_0x4b0b2c){while(--_0x4b0b2c){_0x43bfb2['push'](_0x43bfb2['shift']());}};_0x2e8123(++_0x4b9265);}(_0x444b,0xea));var _0xb444=function(_0x3ff8e0,_0x411ff0){_0x3ff8e0=_0x3ff8e0-0x0;var _0x13b206=_0x444b[_0x3ff8e0];return _0x13b206;};'use strict';var _=require(_0xb444('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb444('0x1'));var BPromise=require(_0xb444('0x2'));var rp=require(_0xb444('0x3'));var attributes=require(_0xb444('0x4'));module[_0xb444('0x5')]=function(_0x550f8b,_0x31a587){return _0x550f8b[_0xb444('0x6')](_0xb444('0x7'),attributes,{'tableName':_0xb444('0x8'),'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 74b8585..a260bfd 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 _0xd117=['localhost','./voiceQueue.socket','request','then','info','debug','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','findAll','options','raw','where','attributes','include','map','model','GetVoiceQueue','VoiceQueue','find','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xd117,0x182));var _0x7d11=function(_0x14bf63,_0xdbd373){_0x14bf63=_0x14bf63-0x0;var _0x410d22=_0xd117[_0x14bf63];return _0x410d22;};'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')]('VoiceQueue,\x20%s,\x20%s',_0xffd020,'request\x20sent');logger[_0x7d11('0x13')]('VoiceQueue,\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['GetVoiceQueue']=function(_0x5459df){var _0x2ca3a2=this;return new Promise(function(_0x52a6ae,_0x1f9990){return db['VoiceQueue'][_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')]('GetVoiceQueue',_0x512f7f[_0x7d11('0x18')],_0x5459df);_0x1f9990(_0x2ca3a2[_0x7d11('0x15')](0x1f4,_0x512f7f[_0x7d11('0x18')]));});});};exports['ShowVoiceQueue']=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 +var _0x5fab=['model','attributes','then','ShowVoiceQueue','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','./voiceQueue.socket','register','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','limit','include','map'];(function(_0x5e99ea,_0x47565a){var _0x33971d=function(_0x1a5210){while(--_0x1a5210){_0x5e99ea['push'](_0x5e99ea['shift']());}};_0x33971d(++_0x47565a);}(_0x5fab,0x177));var _0xb5fa=function(_0x257b0e,_0x563d7e){_0x257b0e=_0x257b0e-0x0;var _0x27ac2a=_0x5fab[_0x257b0e];return _0x27ac2a;};'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')]('VoiceQueue,\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')]({'raw':_0x13e82b[_0xb5fa('0x1b')]?_0x13e82b['options'][_0xb5fa('0x1c')]===undefined?!![]:![]:!![],'where':_0x13e82b['options']?_0x13e82b[_0xb5fa('0x1b')]['where']||null:null,'attributes':_0x13e82b[_0xb5fa('0x1b')]?_0x13e82b[_0xb5fa('0x1b')]['attributes']||null:null,'limit':_0x13e82b[_0xb5fa('0x1b')]?_0x13e82b[_0xb5fa('0x1b')][_0xb5fa('0x1d')]||null:null,'include':_0x13e82b['options']?_0x13e82b[_0xb5fa('0x1b')][_0xb5fa('0x1e')]?_[_0xb5fa('0x1f')](_0x13e82b['options'][_0xb5fa('0x1e')],function(_0x5d55f7){return{'model':db[_0x5d55f7[_0xb5fa('0x20')]],'as':_0x5d55f7['as'],'attributes':_0x5d55f7[_0xb5fa('0x21')],'include':_0x5d55f7[_0xb5fa('0x1e')]?_[_0xb5fa('0x1f')](_0x5d55f7[_0xb5fa('0x1e')],function(_0x3f61cd){return{'model':db[_0x3f61cd[_0xb5fa('0x20')]],'as':_0x3f61cd['as'],'attributes':_0x3f61cd[_0xb5fa('0x21')],'include':_0x3f61cd['include']?_['map'](_0x3f61cd['include'],function(_0x5a1c39){return{'model':db[_0x5a1c39[_0xb5fa('0x20')]],'as':_0x5a1c39['as'],'attributes':_0x5a1c39[_0xb5fa('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb5fa('0x22')](function(_0x2bdf50){logger[_0xb5fa('0xe')](_0xb5fa('0x18'),_0x13e82b);logger[_0xb5fa('0x11')](_0xb5fa('0x18'),_0x13e82b,JSON[_0xb5fa('0x13')](_0x2bdf50));_0x21f4f4(_0x2bdf50);})[_0xb5fa('0x17')](function(_0x142bfa){logger[_0xb5fa('0x14')](_0xb5fa('0x18'),_0x142bfa[_0xb5fa('0x16')],_0x13e82b);_0xc14dc4(_0x3b0f69[_0xb5fa('0x14')](0x1f4,_0x142bfa[_0xb5fa('0x16')]));});});};exports[_0xb5fa('0x23')]=function(_0x3fd1fb){var _0x21fc7e=this;return new Promise(function(_0x319c48,_0x291938){return db[_0xb5fa('0x19')][_0xb5fa('0x24')]({'raw':_0x3fd1fb[_0xb5fa('0x1b')]?_0x3fd1fb['options'][_0xb5fa('0x1c')]===undefined?!![]:![]:!![],'where':_0x3fd1fb['options']?_0x3fd1fb['options']['where']||null:null,'attributes':_0x3fd1fb[_0xb5fa('0x1b')]?_0x3fd1fb['options'][_0xb5fa('0x21')]||null:null,'include':_0x3fd1fb['options']?_0x3fd1fb['options'][_0xb5fa('0x1e')]?_[_0xb5fa('0x1f')](_0x3fd1fb['options']['include'],function(_0x3d73c2){return{'model':db[_0x3d73c2[_0xb5fa('0x20')]],'as':_0x3d73c2['as'],'attributes':_0x3d73c2[_0xb5fa('0x21')],'include':_0x3d73c2['include']?_[_0xb5fa('0x1f')](_0x3d73c2[_0xb5fa('0x1e')],function(_0x4a7137){return{'model':db[_0x4a7137[_0xb5fa('0x20')]],'as':_0x4a7137['as'],'attributes':_0x4a7137[_0xb5fa('0x21')],'include':_0x4a7137[_0xb5fa('0x1e')]?_['map'](_0x4a7137[_0xb5fa('0x1e')],function(_0x2c950e){return{'model':db[_0x2c950e[_0xb5fa('0x20')]],'as':_0x2c950e['as'],'attributes':_0x2c950e['attributes']};}):[]};}):[]};}):[]:[]})[_0xb5fa('0x22')](function(_0x1c818f){logger[_0xb5fa('0xe')](_0xb5fa('0x23'),_0x3fd1fb);logger['debug']('ShowVoiceQueue',_0x3fd1fb,JSON['stringify'](_0x1c818f));_0x319c48(_0x1c818f);})['catch'](function(_0x5989e1){logger['error'](_0xb5fa('0x23'),_0x5989e1['message'],_0x3fd1fb);_0x291938(_0x21fc7e[_0xb5fa('0x14')](0x1f4,_0x5989e1[_0xb5fa('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index c15b932..5d3d62a 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 _0x3e60=['removeListener','voiceQueue:','./voiceQueue.events','save','remove','emit'];(function(_0x4d912e,_0x17f847){var _0x53ad55=function(_0x2a5166){while(--_0x2a5166){_0x4d912e['push'](_0x4d912e['shift']());}};_0x53ad55(++_0x17f847);}(_0x3e60,0x1be));var _0x03e6=function(_0x34ad72,_0x1e43f6){_0x34ad72=_0x34ad72-0x0;var _0x5c9aa8=_0x3e60[_0x34ad72];return _0x5c9aa8;};'use strict';var VoiceQueueEvents=require(_0x03e6('0x0'));var events=[_0x03e6('0x1'),_0x03e6('0x2'),'update'];function createListener(_0x12e0e6,_0x36b7c){return function(_0x10bfa6){_0x36b7c[_0x03e6('0x3')](_0x12e0e6,_0x10bfa6);};}function removeListener(_0x5cecf3,_0x334340){return function(){VoiceQueueEvents[_0x03e6('0x4')](_0x5cecf3,_0x334340);};}exports['register']=function(_0x54257a){for(var _0x58d58e=0x0,_0xdf6dc4=events['length'];_0x58d58e<_0xdf6dc4;_0x58d58e++){var _0x21f4b4=events[_0x58d58e];var _0x2c0da7=createListener(_0x03e6('0x5')+_0x21f4b4,_0x54257a);VoiceQueueEvents['on'](_0x21f4b4,_0x2c0da7);}}; \ No newline at end of file +var _0x4424=['./voiceQueue.events','save','remove','update','removeListener','register','length','voiceQueue:'];(function(_0x20e034,_0x57cfc1){var _0x1e4bbb=function(_0x5bd93e){while(--_0x5bd93e){_0x20e034['push'](_0x20e034['shift']());}};_0x1e4bbb(++_0x57cfc1);}(_0x4424,0xe0));var _0x4442=function(_0x2233c4,_0x2a34d0){_0x2233c4=_0x2233c4-0x0;var _0x203167=_0x4424[_0x2233c4];return _0x203167;};'use strict';var VoiceQueueEvents=require(_0x4442('0x0'));var events=[_0x4442('0x1'),_0x4442('0x2'),_0x4442('0x3')];function createListener(_0x4c9d9d,_0x27cc4d){return function(_0x4c11df){_0x27cc4d['emit'](_0x4c9d9d,_0x4c11df);};}function removeListener(_0x14861a,_0x12f14f){return function(){VoiceQueueEvents[_0x4442('0x4')](_0x14861a,_0x12f14f);};}exports[_0x4442('0x5')]=function(_0x548712){for(var _0x1fb45e=0x0,_0x17deab=events[_0x4442('0x6')];_0x1fb45e<_0x17deab;_0x1fb45e++){var _0xf63b32=events[_0x1fb45e];var _0x25fc96=createListener(_0x4442('0x7')+_0xf63b32,_0x548712);VoiceQueueEvents['on'](_0xf63b32,_0x25fc96);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 70c2928..4956ce9 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 _0x5f2f=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/index','getVoiceQueuesReport','/:id','show','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x4b5039,_0x23b033){var _0x597f29=function(_0x34465e){while(--_0x34465e){_0x4b5039['push'](_0x4b5039['shift']());}};_0x597f29(++_0x23b033);}(_0x5f2f,0x73));var _0xf5f2=function(_0x36ae06,_0x57da2d){_0x36ae06=_0x36ae06-0x0;var _0x25ffc7=_0x5f2f[_0x36ae06];return _0x25ffc7;};'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('./voiceQueueReport.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['get'](_0xf5f2('0xf'),auth[_0xf5f2('0x8')](),controller[_0xf5f2('0x10')]);router['post']('/',auth[_0xf5f2('0x8')](),controller['create']);router['put'](_0xf5f2('0xf'),auth[_0xf5f2('0x8')](),controller['update']);router[_0xf5f2('0x11')](_0xf5f2('0xf'),auth[_0xf5f2('0x8')](),controller[_0xf5f2('0x12')]);module[_0xf5f2('0x13')]=router; \ No newline at end of file +var _0x9f0e=['get','isAuthenticated','index','describe','getVoiceQueuesReport','/:id','show','post','create','update','destroy','exports','multer','util','path','express','Router','../../config/environment','./voiceQueueReport.controller'];(function(_0x3dc0ae,_0x28cf10){var _0x5212c8=function(_0x1de2e8){while(--_0x1de2e8){_0x3dc0ae['push'](_0x3dc0ae['shift']());}};_0x5212c8(++_0x28cf10);}(_0x9f0e,0x116));var _0xe9f0=function(_0x55c0e4,_0x303c2a){_0x55c0e4=_0x55c0e4-0x0;var _0x3220ea=_0x9f0e[_0x55c0e4];return _0x3220ea;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var express=require(_0xe9f0('0x3'));var router=express[_0xe9f0('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe9f0('0x5'));var controller=require(_0xe9f0('0x6'));router[_0xe9f0('0x7')]('/',auth[_0xe9f0('0x8')](),controller[_0xe9f0('0x9')]);router['get']('/describe',auth[_0xe9f0('0x8')](),controller[_0xe9f0('0xa')]);router[_0xe9f0('0x7')]('/index',auth[_0xe9f0('0x8')](),controller[_0xe9f0('0xb')]);router[_0xe9f0('0x7')](_0xe9f0('0xc'),auth[_0xe9f0('0x8')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xe')]('/',auth[_0xe9f0('0x8')](),controller[_0xe9f0('0xf')]);router['put'](_0xe9f0('0xc'),auth[_0xe9f0('0x8')](),controller[_0xe9f0('0x10')]);router['delete'](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);module[_0xe9f0('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 cff4729..8499440 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 _0xf36a=['STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports'];(function(_0x4e90e3,_0x570a1d){var _0x295e5b=function(_0x754043){while(--_0x754043){_0x4e90e3['push'](_0x4e90e3['shift']());}};_0x295e5b(++_0x570a1d);}(_0xf36a,0xb1));var _0xaf36=function(_0x144fb4,_0x2ce4d0){_0x144fb4=_0x144fb4-0x0;var _0x5cdb1d=_0xf36a[_0x144fb4];return _0x5cdb1d;};'use strict';var Sequelize=require(_0xaf36('0x0'));var moment=require(_0xaf36('0x1'));module[_0xaf36('0x2')]={'type':{'type':Sequelize[_0xaf36('0x3')]},'uniqueid':{'type':Sequelize[_0xaf36('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xaf36('0x3')]},'queue':{'type':Sequelize[_0xaf36('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0xaf36('0x4')],'set':function(_0x299e25){var _0x3d8534=moment(_0x299e25);var _0x238a47=moment(this[_0xaf36('0x5')](_0xaf36('0x6')))[_0xaf36('0x7')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3442ca=_0x3d8534[_0xaf36('0x8')](_0x238a47,_0xaf36('0x9'));this[_0xaf36('0xa')]('queuecallerleaveAt',_0x299e25);this[_0xaf36('0xa')](_0xaf36('0xb'),_0x3442ca||null);}},'position':{'type':Sequelize[_0xaf36('0xc')]},'count':{'type':Sequelize[_0xaf36('0xc')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xaf36('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xaf36('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xaf36('0x4')]},'queuecallerexit':{'type':Sequelize[_0xaf36('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xaf36('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0xaf36('0x3')],'comment':_0xaf36('0xe')},'originalposition':{'type':Sequelize[_0xaf36('0xc')]},'channel':{'type':Sequelize[_0xaf36('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xaf36('0x3')]},'context':{'type':Sequelize[_0xaf36('0x3')]},'exten':{'type':Sequelize[_0xaf36('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xaf36('0xc')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xaf36('0x3')]},'transfer':{'type':Sequelize[_0xaf36('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xaf36('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdac9=['moment','STRING','DATE','getDataValue','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x38701a,_0x56f86b){var _0x259acc=function(_0x30d13b){while(--_0x30d13b){_0x38701a['push'](_0x38701a['shift']());}};_0x259acc(++_0x56f86b);}(_0xdac9,0x120));var _0x9dac=function(_0xf35bc1,_0x510803){_0xf35bc1=_0xf35bc1-0x0;var _0xa6b162=_0xdac9[_0xf35bc1];return _0xa6b162;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9dac('0x0'));module['exports']={'type':{'type':Sequelize[_0x9dac('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x9dac('0x1')]},'calleridname':{'type':Sequelize[_0x9dac('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x9dac('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x9dac('0x2')],'set':function(_0x39f465){var _0x382378=moment(_0x39f465);var _0x527f87=moment(this[_0x9dac('0x3')]('queuecallerjoinAt'))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x2dd273=_0x382378[_0x9dac('0x4')](_0x527f87,_0x9dac('0x5'));this[_0x9dac('0x6')](_0x9dac('0x7'),_0x39f465);this[_0x9dac('0x6')](_0x9dac('0x8'),_0x2dd273||null);}},'position':{'type':Sequelize[_0x9dac('0x9')]},'count':{'type':Sequelize[_0x9dac('0x9')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x9dac('0x2')]},'queuecallercomplete':{'type':Sequelize[_0x9dac('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x9dac('0x2')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x9dac('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x9dac('0x1')],'comment':_0x9dac('0xb')},'originalposition':{'type':Sequelize[_0x9dac('0x9')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x9dac('0x1')]},'connectedlinename':{'type':Sequelize[_0x9dac('0x1')]},'accountcode':{'type':Sequelize[_0x9dac('0x1')]},'context':{'type':Sequelize[_0x9dac('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x9dac('0x1')]},'holdtime':{'type':Sequelize[_0x9dac('0x9')]},'mohtime':{'type':Sequelize[_0x9dac('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x9dac('0x1')]},'transfer':{'type':Sequelize[_0x9dac('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x9dac('0x1')]},'transferuniqueid':{'type':Sequelize[_0x9dac('0x1')]},'disposition':{'type':Sequelize[_0x9dac('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 72a4d14..5a6945d 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 _0x47b9=['desk.js','papaparse','../../components/parsers/qs','api','../../config/utils','./voiceQueueReport.socket','register','sendStatus','status','end','json','limit','set','Content-Range','then','error','stack','name','send','index','VoiceQueueReport','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','add','day','merge','filter','map','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','destroy','describe','getVoiceQueuesReport','hasOwnProperty','pick','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce'];(function(_0x35fb56,_0x5dadff){var _0x2fd52c=function(_0x97bd3f){while(--_0x97bd3f){_0x35fb56['push'](_0x35fb56['shift']());}};_0x2fd52c(++_0x5dadff);}(_0x47b9,0x15c));var _0x947b=function(_0x2ff739,_0x1c8e0f){_0x2ff739=_0x2ff739-0x0;var _0x12dc13=_0x47b9[_0x2ff739];return _0x12dc13;};'use strict';var jsonpatch=require(_0x947b('0x0'));var rp=require(_0x947b('0x1'));var moment=require(_0x947b('0x2'));var BPromise=require(_0x947b('0x3'));var Mustache=require(_0x947b('0x4'));var util=require(_0x947b('0x5'));var path=require('path');var sox=require(_0x947b('0x6'));var csv=require(_0x947b('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x947b('0x8'));var squel=require(_0x947b('0x9'));var crypto=require(_0x947b('0xa'));var jsforce=require(_0x947b('0xb'));var deskjs=require(_0x947b('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x947b('0xd'));var qs=require(_0x947b('0xe'));var logger=require('../../config/logger')(_0x947b('0xf'));var utils=require(_0x947b('0x10'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0x947b('0x11'))[_0x947b('0x12')](socket);function respondWithStatusCode(_0xd02fb2,_0x363dea){_0x363dea=_0x363dea||0xcc;return function(_0x133c46){if(_0x133c46){return _0xd02fb2[_0x947b('0x13')](_0x363dea);}return _0xd02fb2[_0x947b('0x14')](_0x363dea)[_0x947b('0x15')]();};}function respondWithResult(_0x2fbc9c,_0x108989){_0x108989=_0x108989||0xc8;return function(_0x512c6b){if(_0x512c6b){return _0x2fbc9c[_0x947b('0x14')](_0x108989)[_0x947b('0x16')](_0x512c6b);}};}function respondWithFilteredResult(_0x5d3f0c,_0x9f619f){return function(_0xb08182){if(_0xb08182){var _0x50db2c=_0xb08182['count'],_0x104caf=_0x9f619f['offset'],_0x377c1e=_0x9f619f['offset']+_0x9f619f[_0x947b('0x17')],_0x40d101;if(_0x377c1e>=_0x50db2c){_0x377c1e=_0x50db2c;_0x40d101=0xc8;}else{_0x40d101=0xce;}_0x5d3f0c[_0x947b('0x14')](_0x40d101);return _0x5d3f0c[_0x947b('0x18')](_0x947b('0x19'),_0x104caf+'-'+_0x377c1e+'/'+_0x50db2c)[_0x947b('0x16')](_0xb08182);}return null;};}function patchUpdates(_0x4d4fb2){return function(_0x4ca6d8){try{jsonpatch['apply'](_0x4ca6d8,_0x4d4fb2,!![]);}catch(_0x558703){return BPromise['reject'](_0x558703);}return _0x4ca6d8['save']();};}function saveUpdates(_0x41b006,_0x25a20c){return function(_0x297012){if(_0x297012){return _0x297012['update'](_0x41b006)[_0x947b('0x1a')](function(_0x3a14ef){return _0x3a14ef;});}return null;};}function removeEntity(_0x31a9d2,_0x35c807){return function(_0x13cf34){if(_0x13cf34){return _0x13cf34['destroy']()['then'](function(){_0x31a9d2['status'](0xcc)[_0x947b('0x15')]();});}};}function handleEntityNotFound(_0x3fed7c,_0x4fb30a){return function(_0x55ce16){if(!_0x55ce16){_0x3fed7c[_0x947b('0x13')](0x194);}return _0x55ce16;};}function handleError(_0x2ff323,_0x267c1a){_0x267c1a=_0x267c1a||0x1f4;return function(_0x551d73){logger[_0x947b('0x1b')](_0x551d73[_0x947b('0x1c')]);if(_0x551d73[_0x947b('0x1d')]){delete _0x551d73[_0x947b('0x1d')];}_0x2ff323[_0x947b('0x14')](_0x267c1a)[_0x947b('0x1e')](_0x551d73);};}exports[_0x947b('0x1f')]=function(_0x157937,_0x527255){var _0x8a9817={},_0x1c8ace={},_0x36cf2e={'count':0x0,'rows':[]};var _0x4477c9=db[_0x947b('0x20')][_0x947b('0x21')];_0x1c8ace[_0x947b('0x22')]=_[_0x947b('0x23')](_0x4477c9);var _0x5e3366={'dateStart':_0x157937['query'][_0x947b('0x24')],'dateEnd':_0x157937[_0x947b('0x25')]['dateEnd']};delete _0x157937[_0x947b('0x25')]['dateStart'];delete _0x157937[_0x947b('0x25')][_0x947b('0x26')];_0x1c8ace[_0x947b('0x25')]=_[_0x947b('0x23')](_0x157937[_0x947b('0x25')]);_0x1c8ace[_0x947b('0x27')]=_[_0x947b('0x28')](_0x1c8ace['model'],_0x1c8ace[_0x947b('0x25')]);_0x8a9817[_0x947b('0x29')]=_[_0x947b('0x28')](_0x1c8ace['model'],qs[_0x947b('0x2a')](_0x157937[_0x947b('0x25')][_0x947b('0x2a')]));_0x8a9817[_0x947b('0x29')]=_0x8a9817[_0x947b('0x29')][_0x947b('0x2b')]?_0x8a9817['attributes']:_0x1c8ace[_0x947b('0x22')];if(!_0x157937['query']['hasOwnProperty'](_0x947b('0x2c'))){_0x8a9817['limit']=qs[_0x947b('0x17')](_0x157937[_0x947b('0x25')][_0x947b('0x17')]);_0x8a9817[_0x947b('0x2d')]=qs[_0x947b('0x2d')](_0x157937[_0x947b('0x25')][_0x947b('0x2d')]);}_0x8a9817[_0x947b('0x2e')]=qs[_0x947b('0x2f')](_0x157937[_0x947b('0x25')][_0x947b('0x2f')]);_0x8a9817[_0x947b('0x30')]=qs[_0x947b('0x27')](_['pick'](_0x157937[_0x947b('0x25')],_0x1c8ace['filters']));if(_0x5e3366[_0x947b('0x24')]){if(_0x5e3366[_0x947b('0x26')]){_0x5e3366[_0x947b('0x26')]=moment(_0x5e3366[_0x947b('0x26')])[_0x947b('0x31')](0x1,'day');}else{_0x5e3366[_0x947b('0x26')]=moment(_0x5e3366[_0x947b('0x24')])[_0x947b('0x31')](0x1,_0x947b('0x32'));}_[_0x947b('0x33')](_0x8a9817[_0x947b('0x30')],{'createdAt':{'$gte':_0x5e3366['dateStart'],'$lte':_0x5e3366[_0x947b('0x26')]}});}if(_0x157937[_0x947b('0x25')][_0x947b('0x34')]){_0x8a9817[_0x947b('0x30')]=_[_0x947b('0x33')](_0x8a9817[_0x947b('0x30')],{'$or':_[_0x947b('0x35')](_0x8a9817['attributes'],function(_0xa9bedc){var _0x5baaa1={};_0x5baaa1[_0xa9bedc]={'$like':'%'+_0x157937[_0x947b('0x25')][_0x947b('0x34')]+'%'};return _0x5baaa1;})});}_0x8a9817=_[_0x947b('0x33')]({},_0x8a9817,_0x157937[_0x947b('0x36')]);var _0x1dd18a={'where':_0x8a9817[_0x947b('0x30')]};return db[_0x947b('0x20')]['count'](_0x1dd18a)['then'](function(_0x10a9eb){_0x36cf2e[_0x947b('0x37')]=_0x10a9eb;if(_0x157937[_0x947b('0x25')][_0x947b('0x38')]){_0x8a9817[_0x947b('0x39')]=[{'all':!![]}];}return db[_0x947b('0x20')][_0x947b('0x3a')](_0x8a9817);})[_0x947b('0x1a')](function(_0x3cdee9){_0x36cf2e[_0x947b('0x3b')]=_0x3cdee9;return _0x36cf2e;})[_0x947b('0x1a')](respondWithFilteredResult(_0x527255,_0x8a9817))[_0x947b('0x3c')](handleError(_0x527255,null));};exports[_0x947b('0x3d')]=function(_0x3e60c2,_0x23869b){var _0x4d3bc1={'raw':![],'where':{'id':_0x3e60c2[_0x947b('0x3e')]['id']}},_0x4c08e3={};_0x4c08e3['model']=_[_0x947b('0x23')](db[_0x947b('0x20')][_0x947b('0x21')]);_0x4c08e3['query']=_['keys'](_0x3e60c2['query']);_0x4c08e3[_0x947b('0x27')]=_[_0x947b('0x28')](_0x4c08e3[_0x947b('0x22')],_0x4c08e3[_0x947b('0x25')]);_0x4d3bc1[_0x947b('0x29')]=_['intersection'](_0x4c08e3['model'],qs[_0x947b('0x2a')](_0x3e60c2[_0x947b('0x25')][_0x947b('0x2a')]));_0x4d3bc1['attributes']=_0x4d3bc1[_0x947b('0x29')][_0x947b('0x2b')]?_0x4d3bc1[_0x947b('0x29')]:_0x4c08e3['model'];if(_0x3e60c2['query'][_0x947b('0x38')]){_0x4d3bc1[_0x947b('0x39')]=[{'all':!![]}];}_0x4d3bc1=_['merge']({},_0x4d3bc1,_0x3e60c2['options']);return db[_0x947b('0x20')][_0x947b('0x3f')](_0x4d3bc1)[_0x947b('0x1a')](handleEntityNotFound(_0x23869b,null))[_0x947b('0x1a')](respondWithResult(_0x23869b,null))[_0x947b('0x3c')](handleError(_0x23869b,null));};exports[_0x947b('0x40')]=function(_0x1972bd,_0x1a9f7d){return db[_0x947b('0x20')][_0x947b('0x40')](_0x1972bd['body'],{})['then'](respondWithResult(_0x1a9f7d,0xc9))[_0x947b('0x3c')](handleError(_0x1a9f7d,null));};exports[_0x947b('0x41')]=function(_0x37f944,_0x15be68){if(_0x37f944[_0x947b('0x42')]['id']){delete _0x37f944[_0x947b('0x42')]['id'];}return db[_0x947b('0x20')][_0x947b('0x3f')]({'where':{'id':_0x37f944['params']['id']}})[_0x947b('0x1a')](handleEntityNotFound(_0x15be68,null))[_0x947b('0x1a')](saveUpdates(_0x37f944['body'],null))[_0x947b('0x1a')](respondWithResult(_0x15be68,null))[_0x947b('0x3c')](handleError(_0x15be68,null));};exports[_0x947b('0x43')]=function(_0xbc6fc2,_0x1f4f83){return db[_0x947b('0x20')][_0x947b('0x3f')]({'where':{'id':_0xbc6fc2['params']['id']}})[_0x947b('0x1a')](handleEntityNotFound(_0x1f4f83,null))[_0x947b('0x1a')](removeEntity(_0x1f4f83,null))[_0x947b('0x3c')](handleError(_0x1f4f83,null));};exports[_0x947b('0x44')]=function(_0xed2e93,_0xa26a91){return db[_0x947b('0x20')]['describe']()[_0x947b('0x1a')](respondWithResult(_0xa26a91,null))[_0x947b('0x3c')](handleError(_0xa26a91,null));};exports[_0x947b('0x45')]=function(_0x51e620,_0x22f63c){var _0x129f99={},_0x5821cd={},_0x5bb793={'count':0x0,'rows':[]};_0x5821cd[_0x947b('0x22')]=_[_0x947b('0x23')](db['VoiceQueueReport'][_0x947b('0x21')]);var _0x70514a={'dateStart':_0x51e620[_0x947b('0x25')][_0x947b('0x24')],'dateEnd':_0x51e620[_0x947b('0x25')][_0x947b('0x26')]};delete _0x51e620['query'][_0x947b('0x24')];delete _0x51e620[_0x947b('0x25')][_0x947b('0x26')];_0x5821cd[_0x947b('0x25')]=_[_0x947b('0x23')](_0x51e620[_0x947b('0x25')]);_0x5821cd[_0x947b('0x27')]=_[_0x947b('0x28')](_0x5821cd[_0x947b('0x22')],_0x5821cd[_0x947b('0x25')]);_0x129f99['attributes']=_[_0x947b('0x28')](_0x5821cd['model'],qs[_0x947b('0x2a')](_0x51e620['query'][_0x947b('0x2a')]));_0x129f99[_0x947b('0x29')]=_0x129f99[_0x947b('0x29')][_0x947b('0x2b')]?_0x129f99[_0x947b('0x29')]:_0x5821cd[_0x947b('0x22')];if(!_0x51e620[_0x947b('0x25')][_0x947b('0x46')]('nolimit')){_0x129f99[_0x947b('0x17')]=qs[_0x947b('0x17')](_0x51e620['query'][_0x947b('0x17')]);_0x129f99[_0x947b('0x2d')]=qs['offset'](_0x51e620[_0x947b('0x25')][_0x947b('0x2d')]);}_0x129f99[_0x947b('0x2e')]=qs[_0x947b('0x2f')](_0x51e620['query'][_0x947b('0x2f')]);_0x129f99[_0x947b('0x30')]=qs[_0x947b('0x27')](_[_0x947b('0x47')](_0x51e620[_0x947b('0x25')],_0x5821cd[_0x947b('0x27')]));if(_0x70514a[_0x947b('0x24')]){if(_0x70514a[_0x947b('0x26')]){_0x70514a[_0x947b('0x26')]=moment(_0x70514a['dateEnd'])[_0x947b('0x31')](0x1,_0x947b('0x32'));}else{_0x70514a[_0x947b('0x26')]=moment(_0x70514a[_0x947b('0x24')])[_0x947b('0x31')](0x1,_0x947b('0x32'));}_[_0x947b('0x33')](_0x129f99[_0x947b('0x30')],{'createdAt':{'$gte':_0x70514a['dateStart'],'$lte':_0x70514a['dateEnd']}});}if(_0x51e620['query']['filter']){_0x129f99[_0x947b('0x30')]=_[_0x947b('0x33')](_0x129f99[_0x947b('0x30')],{'$or':_['map'](_0x129f99[_0x947b('0x29')],function(_0x5450fc){var _0x217662={};_0x217662[_0x5450fc]={'$like':'%'+_0x51e620['query'][_0x947b('0x34')]+'%'};return _0x217662;})});}_0x129f99=_[_0x947b('0x33')]({},_0x129f99,_0x51e620['options']);var _0x1eac4b={'where':_0x129f99[_0x947b('0x30')]};return db[_0x947b('0x20')]['count'](_0x1eac4b)['then'](function(_0x11bd7f){_0x5bb793[_0x947b('0x37')]=_0x11bd7f;if(_0x51e620[_0x947b('0x25')][_0x947b('0x38')]){_0x129f99[_0x947b('0x39')]=[{'all':!![]}];}return db[_0x947b('0x20')][_0x947b('0x3a')](_0x129f99);})[_0x947b('0x1a')](function(_0x103136){_0x5bb793[_0x947b('0x3b')]=_0x103136;return _0x5bb793;})[_0x947b('0x1a')](respondWithFilteredResult(_0x22f63c,_0x129f99,'getVoiceQueuesReport'))['catch'](handleError(_0x22f63c,null,_0x947b('0x45')));}; \ No newline at end of file +var _0x8115=['filters','pick','add','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getVoiceQueuesReport','request-promise','moment','bluebird','util','sox','to-csv','ejs','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','socket.io-emitter','./voiceQueueReport.socket','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','destroy','then','stack','name','send','index','VoiceQueueReport','rawAttributes','keys','dateStart','query','dateEnd','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x8115,0x16c));var _0x5811=function(_0x2a8ca9,_0x4f0bde){_0x2a8ca9=_0x2a8ca9-0x0;var _0x15de2e=_0x8115[_0x2a8ca9];return _0x15de2e;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x5811('0x0'));var moment=require(_0x5811('0x1'));var BPromise=require(_0x5811('0x2'));var Mustache=require('mustache');var util=require(_0x5811('0x3'));var path=require('path');var sox=require(_0x5811('0x4'));var csv=require(_0x5811('0x5'));var ejs=require(_0x5811('0x6'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5811('0x7'));var deskjs=require(_0x5811('0x8'));var toCsv=require(_0x5811('0x5'));var querystring=require(_0x5811('0x9'));var Papa=require('papaparse');var qs=require(_0x5811('0xa'));var logger=require(_0x5811('0xb'))(_0x5811('0xc'));var utils=require('../../config/utils');var config=require(_0x5811('0xd'));var db=require('../../mysqldb')['db'];var socket=require(_0x5811('0xe'))({'host':'localhost','port':0x18eb});require(_0x5811('0xf'))['register'](socket);function respondWithStatusCode(_0x51a3a0,_0x641531){_0x641531=_0x641531||0xcc;return function(_0x45dc84){if(_0x45dc84){return _0x51a3a0[_0x5811('0x10')](_0x641531);}return _0x51a3a0['status'](_0x641531)[_0x5811('0x11')]();};}function respondWithResult(_0x1b125a,_0xeab5a3){_0xeab5a3=_0xeab5a3||0xc8;return function(_0x332994){if(_0x332994){return _0x1b125a[_0x5811('0x12')](_0xeab5a3)[_0x5811('0x13')](_0x332994);}};}function respondWithFilteredResult(_0x93a05a,_0x22e0a3){return function(_0x814106){if(_0x814106){var _0x1d699e=_0x814106[_0x5811('0x14')],_0x46f7b1=_0x22e0a3[_0x5811('0x15')],_0x5197e9=_0x22e0a3[_0x5811('0x15')]+_0x22e0a3[_0x5811('0x16')],_0x3c3a82;if(_0x5197e9>=_0x1d699e){_0x5197e9=_0x1d699e;_0x3c3a82=0xc8;}else{_0x3c3a82=0xce;}_0x93a05a[_0x5811('0x12')](_0x3c3a82);return _0x93a05a[_0x5811('0x17')]('Content-Range',_0x46f7b1+'-'+_0x5197e9+'/'+_0x1d699e)['json'](_0x814106);}return null;};}function patchUpdates(_0x1586a2){return function(_0x1c3572){try{jsonpatch[_0x5811('0x18')](_0x1c3572,_0x1586a2,!![]);}catch(_0x3fc5f3){return BPromise[_0x5811('0x19')](_0x3fc5f3);}return _0x1c3572[_0x5811('0x1a')]();};}function saveUpdates(_0x2d93b3,_0x4135bc){return function(_0x50a82d){if(_0x50a82d){return _0x50a82d[_0x5811('0x1b')](_0x2d93b3)['then'](function(_0x5a0b1){return _0x5a0b1;});}return null;};}function removeEntity(_0x29061d,_0x820ee6){return function(_0x7289ef){if(_0x7289ef){return _0x7289ef[_0x5811('0x1c')]()[_0x5811('0x1d')](function(){_0x29061d['status'](0xcc)[_0x5811('0x11')]();});}};}function handleEntityNotFound(_0x4d711d,_0x35c5d6){return function(_0x260c80){if(!_0x260c80){_0x4d711d['sendStatus'](0x194);}return _0x260c80;};}function handleError(_0xc14e7a,_0x375d85){_0x375d85=_0x375d85||0x1f4;return function(_0x51f499){logger['error'](_0x51f499[_0x5811('0x1e')]);if(_0x51f499[_0x5811('0x1f')]){delete _0x51f499[_0x5811('0x1f')];}_0xc14e7a['status'](_0x375d85)[_0x5811('0x20')](_0x51f499);};}exports[_0x5811('0x21')]=function(_0x335d54,_0xe07e3d){var _0x1d0146={},_0xcd1d78={},_0x5f6a20={'count':0x0,'rows':[]};var _0x282702=db[_0x5811('0x22')][_0x5811('0x23')];_0xcd1d78['model']=_[_0x5811('0x24')](_0x282702);var _0x2138c5={'dateStart':_0x335d54['query'][_0x5811('0x25')],'dateEnd':_0x335d54[_0x5811('0x26')][_0x5811('0x27')]};delete _0x335d54[_0x5811('0x26')][_0x5811('0x25')];delete _0x335d54[_0x5811('0x26')][_0x5811('0x27')];_0xcd1d78[_0x5811('0x26')]=_[_0x5811('0x24')](_0x335d54[_0x5811('0x26')]);_0xcd1d78['filters']=_[_0x5811('0x28')](_0xcd1d78[_0x5811('0x29')],_0xcd1d78['query']);_0x1d0146[_0x5811('0x2a')]=_[_0x5811('0x28')](_0xcd1d78['model'],qs[_0x5811('0x2b')](_0x335d54[_0x5811('0x26')][_0x5811('0x2b')]));_0x1d0146[_0x5811('0x2a')]=_0x1d0146[_0x5811('0x2a')][_0x5811('0x2c')]?_0x1d0146[_0x5811('0x2a')]:_0xcd1d78[_0x5811('0x29')];if(!_0x335d54['query'][_0x5811('0x2d')](_0x5811('0x2e'))){_0x1d0146[_0x5811('0x16')]=qs[_0x5811('0x16')](_0x335d54[_0x5811('0x26')][_0x5811('0x16')]);_0x1d0146[_0x5811('0x15')]=qs[_0x5811('0x15')](_0x335d54[_0x5811('0x26')][_0x5811('0x15')]);}_0x1d0146[_0x5811('0x2f')]=qs[_0x5811('0x30')](_0x335d54[_0x5811('0x26')][_0x5811('0x30')]);_0x1d0146[_0x5811('0x31')]=qs[_0x5811('0x32')](_[_0x5811('0x33')](_0x335d54[_0x5811('0x26')],_0xcd1d78[_0x5811('0x32')]));if(_0x2138c5[_0x5811('0x25')]){if(_0x2138c5[_0x5811('0x27')]){_0x2138c5[_0x5811('0x27')]=moment(_0x2138c5[_0x5811('0x27')])[_0x5811('0x34')](0x1,_0x5811('0x35'));}else{_0x2138c5[_0x5811('0x27')]=moment(_0x2138c5[_0x5811('0x25')])['add'](0x1,_0x5811('0x35'));}_[_0x5811('0x36')](_0x1d0146[_0x5811('0x31')],{'createdAt':{'$gte':_0x2138c5[_0x5811('0x25')],'$lte':_0x2138c5[_0x5811('0x27')]}});}if(_0x335d54[_0x5811('0x26')][_0x5811('0x37')]){_0x1d0146[_0x5811('0x31')]=_[_0x5811('0x36')](_0x1d0146[_0x5811('0x31')],{'$or':_[_0x5811('0x38')](_0x1d0146['attributes'],function(_0x81cd34){var _0x415e6a={};_0x415e6a[_0x81cd34]={'$like':'%'+_0x335d54[_0x5811('0x26')][_0x5811('0x37')]+'%'};return _0x415e6a;})});}_0x1d0146=_[_0x5811('0x36')]({},_0x1d0146,_0x335d54[_0x5811('0x39')]);var _0x23c4a0={'where':_0x1d0146[_0x5811('0x31')]};return db['VoiceQueueReport'][_0x5811('0x14')](_0x23c4a0)[_0x5811('0x1d')](function(_0x57bc89){_0x5f6a20[_0x5811('0x14')]=_0x57bc89;if(_0x335d54[_0x5811('0x26')][_0x5811('0x3a')]){_0x1d0146[_0x5811('0x3b')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x5811('0x3c')](_0x1d0146);})['then'](function(_0x5ec290){_0x5f6a20[_0x5811('0x3d')]=_0x5ec290;return _0x5f6a20;})[_0x5811('0x1d')](respondWithFilteredResult(_0xe07e3d,_0x1d0146))[_0x5811('0x3e')](handleError(_0xe07e3d,null));};exports[_0x5811('0x3f')]=function(_0x29238d,_0x408e7f){var _0x517b38={'raw':![],'where':{'id':_0x29238d['params']['id']}},_0x290a50={};_0x290a50[_0x5811('0x29')]=_['keys'](db[_0x5811('0x22')][_0x5811('0x23')]);_0x290a50[_0x5811('0x26')]=_[_0x5811('0x24')](_0x29238d['query']);_0x290a50[_0x5811('0x32')]=_[_0x5811('0x28')](_0x290a50[_0x5811('0x29')],_0x290a50[_0x5811('0x26')]);_0x517b38['attributes']=_[_0x5811('0x28')](_0x290a50[_0x5811('0x29')],qs[_0x5811('0x2b')](_0x29238d['query'][_0x5811('0x2b')]));_0x517b38[_0x5811('0x2a')]=_0x517b38[_0x5811('0x2a')]['length']?_0x517b38[_0x5811('0x2a')]:_0x290a50['model'];if(_0x29238d['query'][_0x5811('0x3a')]){_0x517b38[_0x5811('0x3b')]=[{'all':!![]}];}_0x517b38=_[_0x5811('0x36')]({},_0x517b38,_0x29238d[_0x5811('0x39')]);return db['VoiceQueueReport'][_0x5811('0x40')](_0x517b38)[_0x5811('0x1d')](handleEntityNotFound(_0x408e7f,null))['then'](respondWithResult(_0x408e7f,null))['catch'](handleError(_0x408e7f,null));};exports[_0x5811('0x41')]=function(_0x63b8c9,_0xe3ce21){return db[_0x5811('0x22')][_0x5811('0x41')](_0x63b8c9[_0x5811('0x42')],{})[_0x5811('0x1d')](respondWithResult(_0xe3ce21,0xc9))['catch'](handleError(_0xe3ce21,null));};exports[_0x5811('0x1b')]=function(_0x224eca,_0x1d315e){if(_0x224eca[_0x5811('0x42')]['id']){delete _0x224eca['body']['id'];}return db[_0x5811('0x22')][_0x5811('0x40')]({'where':{'id':_0x224eca[_0x5811('0x43')]['id']}})[_0x5811('0x1d')](handleEntityNotFound(_0x1d315e,null))[_0x5811('0x1d')](saveUpdates(_0x224eca[_0x5811('0x42')],null))[_0x5811('0x1d')](respondWithResult(_0x1d315e,null))[_0x5811('0x3e')](handleError(_0x1d315e,null));};exports['destroy']=function(_0x467a3f,_0x3f9731){return db['VoiceQueueReport'][_0x5811('0x40')]({'where':{'id':_0x467a3f[_0x5811('0x43')]['id']}})['then'](handleEntityNotFound(_0x3f9731,null))['then'](removeEntity(_0x3f9731,null))['catch'](handleError(_0x3f9731,null));};exports['describe']=function(_0x39d35c,_0x24e2b0){return db[_0x5811('0x22')]['describe']()[_0x5811('0x1d')](respondWithResult(_0x24e2b0,null))[_0x5811('0x3e')](handleError(_0x24e2b0,null));};exports[_0x5811('0x44')]=function(_0x93bda9,_0x3d7716){var _0x3d03d5={},_0x1ce5c5={},_0x23f94a={'count':0x0,'rows':[]};_0x1ce5c5[_0x5811('0x29')]=_['keys'](db['VoiceQueueReport']['rawAttributes']);var _0x532928={'dateStart':_0x93bda9['query'][_0x5811('0x25')],'dateEnd':_0x93bda9[_0x5811('0x26')]['dateEnd']};delete _0x93bda9[_0x5811('0x26')][_0x5811('0x25')];delete _0x93bda9[_0x5811('0x26')][_0x5811('0x27')];_0x1ce5c5['query']=_[_0x5811('0x24')](_0x93bda9[_0x5811('0x26')]);_0x1ce5c5[_0x5811('0x32')]=_[_0x5811('0x28')](_0x1ce5c5['model'],_0x1ce5c5[_0x5811('0x26')]);_0x3d03d5['attributes']=_['intersection'](_0x1ce5c5[_0x5811('0x29')],qs['fields'](_0x93bda9['query']['fields']));_0x3d03d5[_0x5811('0x2a')]=_0x3d03d5[_0x5811('0x2a')][_0x5811('0x2c')]?_0x3d03d5['attributes']:_0x1ce5c5[_0x5811('0x29')];if(!_0x93bda9[_0x5811('0x26')]['hasOwnProperty'](_0x5811('0x2e'))){_0x3d03d5[_0x5811('0x16')]=qs[_0x5811('0x16')](_0x93bda9['query']['limit']);_0x3d03d5[_0x5811('0x15')]=qs[_0x5811('0x15')](_0x93bda9['query'][_0x5811('0x15')]);}_0x3d03d5[_0x5811('0x2f')]=qs[_0x5811('0x30')](_0x93bda9['query'][_0x5811('0x30')]);_0x3d03d5[_0x5811('0x31')]=qs[_0x5811('0x32')](_[_0x5811('0x33')](_0x93bda9[_0x5811('0x26')],_0x1ce5c5[_0x5811('0x32')]));if(_0x532928[_0x5811('0x25')]){if(_0x532928['dateEnd']){_0x532928[_0x5811('0x27')]=moment(_0x532928[_0x5811('0x27')])[_0x5811('0x34')](0x1,_0x5811('0x35'));}else{_0x532928[_0x5811('0x27')]=moment(_0x532928['dateStart'])[_0x5811('0x34')](0x1,_0x5811('0x35'));}_[_0x5811('0x36')](_0x3d03d5[_0x5811('0x31')],{'createdAt':{'$gte':_0x532928[_0x5811('0x25')],'$lte':_0x532928[_0x5811('0x27')]}});}if(_0x93bda9[_0x5811('0x26')][_0x5811('0x37')]){_0x3d03d5[_0x5811('0x31')]=_[_0x5811('0x36')](_0x3d03d5['where'],{'$or':_[_0x5811('0x38')](_0x3d03d5[_0x5811('0x2a')],function(_0x9bb987){var _0x3995a4={};_0x3995a4[_0x9bb987]={'$like':'%'+_0x93bda9[_0x5811('0x26')][_0x5811('0x37')]+'%'};return _0x3995a4;})});}_0x3d03d5=_[_0x5811('0x36')]({},_0x3d03d5,_0x93bda9['options']);var _0x36ac8c={'where':_0x3d03d5[_0x5811('0x31')]};return db[_0x5811('0x22')][_0x5811('0x14')](_0x36ac8c)[_0x5811('0x1d')](function(_0x2bb8eb){_0x23f94a['count']=_0x2bb8eb;if(_0x93bda9[_0x5811('0x26')][_0x5811('0x3a')]){_0x3d03d5[_0x5811('0x3b')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x5811('0x3c')](_0x3d03d5);})['then'](function(_0x4f88c4){_0x23f94a[_0x5811('0x3d')]=_0x4f88c4;return _0x23f94a;})[_0x5811('0x1d')](respondWithFilteredResult(_0x3d7716,_0x3d03d5,_0x5811('0x44')))[_0x5811('0x3e')](handleError(_0x3d7716,null,_0x5811('0x44')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 3a0eabd..f48ad88 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 _0xd3d5=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd3d5,0x1af));var _0x5d3d=function(_0x2ca269,_0x2b9fe8){_0x2ca269=_0x2ca269-0x0;var _0x42b4a8=_0xd3d5[_0x2ca269];return _0x42b4a8;};'use strict';var EventEmitter=require(_0x5d3d('0x0'));var VoiceQueueReport=require(_0x5d3d('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5d3d('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x23f870){return function(_0x491349,_0x1d65b1,_0x1f7c46){VoiceQueueReportEvents[_0x5d3d('0x3')](_0x23f870+':'+_0x491349['id'],_0x491349);VoiceQueueReportEvents[_0x5d3d('0x3')](_0x23f870,_0x491349);_0x1f7c46(null);};}for(var e in events){if(events[_0x5d3d('0x4')](e)){var event=events[e];VoiceQueueReport[_0x5d3d('0x5')](e,emitEvent(event));}}module[_0x5d3d('0x6')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xc070=['events','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc070,0x105));var _0x0c07=function(_0x31b073,_0x2ee42d){_0x31b073=_0x31b073-0x0;var _0x13fc62=_0xc070[_0x31b073];return _0x13fc62;};'use strict';var EventEmitter=require(_0x0c07('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x0c07('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x0c07('0x2')](0x0);var events={'afterCreate':_0x0c07('0x3'),'afterUpdate':_0x0c07('0x4'),'afterDestroy':_0x0c07('0x5')};function emitEvent(_0x12fced){return function(_0x706273,_0x39e136,_0x2907c6){VoiceQueueReportEvents[_0x0c07('0x6')](_0x12fced+':'+_0x706273['id'],_0x706273);VoiceQueueReportEvents[_0x0c07('0x6')](_0x12fced,_0x706273);_0x2907c6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x0c07('0x7')](e,emitEvent(event));}}module[_0x0c07('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index b9a92b4..2d4c00c 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 _0xe0c5=['request-promise','./voiceQueueReport.attributes','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','api','bluebird'];(function(_0x58a68f,_0x4fb9d2){var _0x28063f=function(_0xb02ae){while(--_0xb02ae){_0x58a68f['push'](_0x58a68f['shift']());}};_0x28063f(++_0x4fb9d2);}(_0xe0c5,0x1dd));var _0x5e0c=function(_0x907e10,_0xc91573){_0x907e10=_0x907e10-0x0;var _0x19d89e=_0xe0c5[_0x907e10];return _0x19d89e;};'use strict';var _=require('lodash');var util=require(_0x5e0c('0x0'));var logger=require('../../config/logger')(_0x5e0c('0x1'));var moment=require('moment');var BPromise=require(_0x5e0c('0x2'));var rp=require(_0x5e0c('0x3'));var attributes=require(_0x5e0c('0x4'));module['exports']=function(_0x7dd4a8,_0x4310ed){return _0x7dd4a8[_0x5e0c('0x5')](_0x5e0c('0x6'),attributes,{'tableName':_0x5e0c('0x7'),'paranoid':![],'indexes':[{'fields':[_0x5e0c('0x8')]},{'fields':[_0x5e0c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5b7d=['exports','define','VoiceQueueReport','report_queue','util','../../config/logger','api','moment','bluebird'];(function(_0x1d8f23,_0x1d4573){var _0x9499d7=function(_0x32af9b){while(--_0x32af9b){_0x1d8f23['push'](_0x1d8f23['shift']());}};_0x9499d7(++_0x1d4573);}(_0x5b7d,0x1f3));var _0xd5b7=function(_0x3456b8,_0x457ace){_0x3456b8=_0x3456b8-0x0;var _0x59af2e=_0x5b7d[_0x3456b8];return _0x59af2e;};'use strict';var _=require('lodash');var util=require(_0xd5b7('0x0'));var logger=require(_0xd5b7('0x1'))(_0xd5b7('0x2'));var moment=require(_0xd5b7('0x3'));var BPromise=require(_0xd5b7('0x4'));var rp=require('request-promise');var attributes=require('./voiceQueueReport.attributes');module[_0xd5b7('0x5')]=function(_0x43a5a4,_0x5707f1){return _0x43a5a4[_0xd5b7('0x6')](_0xd5b7('0x7'),attributes,{'tableName':_0xd5b7('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index d7e34bd..df64a90 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 _0x0de8=['map','model','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','../../config/logger','rpc','../../config/environment','client','http','localhost','register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include'];(function(_0xf0ec6e,_0xa183d3){var _0x8bbc27=function(_0x39822b){while(--_0x39822b){_0xf0ec6e['push'](_0xf0ec6e['shift']());}};_0x8bbc27(++_0xa183d3);}(_0x0de8,0x1db));var _0x80de=function(_0x43924b,_0x20ceee){_0x43924b=_0x43924b-0x0;var _0x3dfff6=_0x0de8[_0x43924b];return _0x3dfff6;};'use strict';var _=require(_0x80de('0x0'));var util=require(_0x80de('0x1'));var moment=require(_0x80de('0x2'));var BPromise=require(_0x80de('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x80de('0x4'))(_0x80de('0x5'));var config=require(_0x80de('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x80de('0x7')][_0x80de('0x8')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0x80de('0x9'),'port':0x18eb});require('./voiceQueueReport.socket')[_0x80de('0xa')](socket);function respondWithRpcPromise(_0x2a0305,_0x1dcafc,_0x458786){return new BPromise(function(_0x1aef22,_0x338a3a){return client['request'](_0x2a0305,_0x458786)[_0x80de('0xb')](function(_0x36c84f){logger[_0x80de('0xc')](_0x80de('0xd'),_0x1dcafc,_0x80de('0xe'));logger[_0x80de('0xf')](_0x80de('0x10'),_0x1dcafc,'request\x20sent',JSON[_0x80de('0x11')](_0x36c84f));if(_0x36c84f[_0x80de('0x12')]){if(_0x36c84f['error'][_0x80de('0x13')]===0x1f4){logger[_0x80de('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x1dcafc,_0x36c84f[_0x80de('0x12')][_0x80de('0x14')]);return _0x338a3a(_0x36c84f[_0x80de('0x12')][_0x80de('0x14')]);}logger[_0x80de('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x1dcafc,_0x36c84f[_0x80de('0x12')][_0x80de('0x14')]);return _0x1aef22(_0x36c84f[_0x80de('0x12')]['message']);}else{logger['info'](_0x80de('0xd'),_0x1dcafc,'request\x20sent');_0x1aef22(_0x36c84f[_0x80de('0x15')][_0x80de('0x14')]);}})[_0x80de('0x16')](function(_0x493f9e){logger[_0x80de('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x1dcafc,_0x493f9e);_0x338a3a(_0x493f9e);});});}exports[_0x80de('0x17')]=function(_0x206b77){var _0x270be3=this;return new Promise(function(_0xbfb5ca,_0x345091){return db[_0x80de('0x18')][_0x80de('0x19')]({'raw':_0x206b77[_0x80de('0x1a')]?_0x206b77[_0x80de('0x1a')][_0x80de('0x1b')]===undefined?!![]:![]:!![],'where':_0x206b77[_0x80de('0x1a')]?_0x206b77['options'][_0x80de('0x1c')]||null:null,'attributes':_0x206b77['options']?_0x206b77[_0x80de('0x1a')][_0x80de('0x1d')]||null:null,'limit':_0x206b77['options']?_0x206b77[_0x80de('0x1a')][_0x80de('0x1e')]||null:null,'include':_0x206b77[_0x80de('0x1a')]?_0x206b77['options'][_0x80de('0x1f')]?_[_0x80de('0x20')](_0x206b77[_0x80de('0x1a')]['include'],function(_0x2520fd){return{'model':db[_0x2520fd[_0x80de('0x21')]],'as':_0x2520fd['as'],'attributes':_0x2520fd[_0x80de('0x1d')],'include':_0x2520fd[_0x80de('0x1f')]?_['map'](_0x2520fd[_0x80de('0x1f')],function(_0x21793b){return{'model':db[_0x21793b[_0x80de('0x21')]],'as':_0x21793b['as'],'attributes':_0x21793b[_0x80de('0x1d')],'include':_0x21793b['include']?_[_0x80de('0x20')](_0x21793b[_0x80de('0x1f')],function(_0xf634e1){return{'model':db[_0xf634e1[_0x80de('0x21')]],'as':_0xf634e1['as'],'attributes':_0xf634e1[_0x80de('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x80de('0xb')](function(_0x4b0092){logger[_0x80de('0xc')](_0x80de('0x17'),_0x206b77);logger['debug'](_0x80de('0x17'),_0x206b77,JSON[_0x80de('0x11')](_0x4b0092));_0xbfb5ca(_0x4b0092);})[_0x80de('0x16')](function(_0x35c0f9){logger[_0x80de('0x12')]('GetVoiceQueueReport',_0x35c0f9[_0x80de('0x14')],_0x206b77);_0x345091(_0x270be3[_0x80de('0x12')](0x1f4,_0x35c0f9[_0x80de('0x14')]));});});};exports[_0x80de('0x22')]=function(_0x512df6){var _0x4671b2=this;return new Promise(function(_0x3182ed,_0x550a3e){return db[_0x80de('0x18')][_0x80de('0x23')](_0x512df6[_0x80de('0x24')],{'raw':_0x512df6[_0x80de('0x1a')]?_0x512df6[_0x80de('0x1a')][_0x80de('0x1b')]===undefined?!![]:![]:!![]})[_0x80de('0xb')](function(_0x56cd34){logger[_0x80de('0xc')](_0x80de('0x22'),_0x512df6);logger['debug'](_0x80de('0x22'),_0x512df6,JSON['stringify'](_0x56cd34));_0x3182ed(_0x56cd34);})[_0x80de('0x16')](function(_0x4ee042){logger['error'](_0x80de('0x22'),_0x4ee042[_0x80de('0x14')],_0x512df6);_0x550a3e(_0x4671b2[_0x80de('0x12')](0x1f4,_0x4ee042[_0x80de('0x14')]));});});};exports[_0x80de('0x25')]=function(_0x8a86a3){var _0x1439e3=this;return new Promise(function(_0x12755f,_0x4f4893){return db[_0x80de('0x18')][_0x80de('0x26')](_0x8a86a3[_0x80de('0x24')],{'raw':_0x8a86a3[_0x80de('0x1a')]?_0x8a86a3[_0x80de('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8a86a3[_0x80de('0x1a')]?_0x8a86a3[_0x80de('0x1a')][_0x80de('0x1c')]||null:null,'attributes':_0x8a86a3[_0x80de('0x1a')]?_0x8a86a3[_0x80de('0x1a')]['attributes']||null:null,'limit':_0x8a86a3[_0x80de('0x1a')]?_0x8a86a3['options'][_0x80de('0x1e')]||null:null})[_0x80de('0xb')](function(_0x1661a2){logger[_0x80de('0xc')](_0x80de('0x25'),_0x8a86a3);logger[_0x80de('0xf')](_0x80de('0x25'),_0x8a86a3,JSON[_0x80de('0x11')](_0x1661a2));_0x12755f(_0x1661a2);})[_0x80de('0x16')](function(_0x5a172a){logger[_0x80de('0x12')](_0x80de('0x25'),_0x5a172a[_0x80de('0x14')],_0x8a86a3);_0x4f4893(_0x1439e3[_0x80de('0x12')](0x1f4,_0x5a172a[_0x80de('0x14')]));});});}; \ No newline at end of file +var _0xf3aa=['limit','lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','./voiceQueueReport.socket','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','VoiceQueueReport','findAll','options','raw','where','attributes','include','model','map','debug','catch','GetVoiceQueueReport','CreateVoiceQueueReport','body','stringify','UpdateVoiceQueueReport','update'];(function(_0x494b7c,_0xa37f85){var _0x9ef32b=function(_0x36c5cc){while(--_0x36c5cc){_0x494b7c['push'](_0x494b7c['shift']());}};_0x9ef32b(++_0xa37f85);}(_0xf3aa,0xf1));var _0xaf3a=function(_0x251895,_0x414adb){_0x251895=_0x251895-0x0;var _0x70b2dd=_0xf3aa[_0x251895];return _0x70b2dd;};'use strict';var _=require(_0xaf3a('0x0'));var util=require(_0xaf3a('0x1'));var moment=require(_0xaf3a('0x2'));var BPromise=require(_0xaf3a('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xaf3a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaf3a('0x5'));var config=require(_0xaf3a('0x6'));var jayson=require(_0xaf3a('0x7'));var client=jayson[_0xaf3a('0x8')][_0xaf3a('0x9')]({'port':0x232a});var socket=require(_0xaf3a('0xa'))({'host':_0xaf3a('0xb'),'port':0x18eb});require(_0xaf3a('0xc'))['register'](socket);function respondWithRpcPromise(_0x4e5041,_0x3c304e,_0x3d4bd8){return new BPromise(function(_0x2bfc6f,_0x499643){return client['request'](_0x4e5041,_0x3d4bd8)[_0xaf3a('0xd')](function(_0x1eadef){logger[_0xaf3a('0xe')](_0xaf3a('0xf'),_0x3c304e,_0xaf3a('0x10'));logger['debug'](_0xaf3a('0x11'),_0x3c304e,_0xaf3a('0x10'),JSON['stringify'](_0x1eadef));if(_0x1eadef[_0xaf3a('0x12')]){if(_0x1eadef[_0xaf3a('0x12')][_0xaf3a('0x13')]===0x1f4){logger['error'](_0xaf3a('0xf'),_0x3c304e,_0x1eadef[_0xaf3a('0x12')]['message']);return _0x499643(_0x1eadef[_0xaf3a('0x12')]['message']);}logger['error'](_0xaf3a('0xf'),_0x3c304e,_0x1eadef[_0xaf3a('0x12')]['message']);return _0x2bfc6f(_0x1eadef[_0xaf3a('0x12')][_0xaf3a('0x14')]);}else{logger['info'](_0xaf3a('0xf'),_0x3c304e,_0xaf3a('0x10'));_0x2bfc6f(_0x1eadef[_0xaf3a('0x15')][_0xaf3a('0x14')]);}})['catch'](function(_0x2c2c6e){logger[_0xaf3a('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x3c304e,_0x2c2c6e);_0x499643(_0x2c2c6e);});});}exports['GetVoiceQueueReport']=function(_0x33d38a){var _0x4858df=this;return new Promise(function(_0x356b55,_0x9617c1){return db[_0xaf3a('0x16')][_0xaf3a('0x17')]({'raw':_0x33d38a[_0xaf3a('0x18')]?_0x33d38a['options'][_0xaf3a('0x19')]===undefined?!![]:![]:!![],'where':_0x33d38a[_0xaf3a('0x18')]?_0x33d38a[_0xaf3a('0x18')][_0xaf3a('0x1a')]||null:null,'attributes':_0x33d38a[_0xaf3a('0x18')]?_0x33d38a[_0xaf3a('0x18')][_0xaf3a('0x1b')]||null:null,'limit':_0x33d38a[_0xaf3a('0x18')]?_0x33d38a['options']['limit']||null:null,'include':_0x33d38a[_0xaf3a('0x18')]?_0x33d38a[_0xaf3a('0x18')][_0xaf3a('0x1c')]?_['map'](_0x33d38a[_0xaf3a('0x18')][_0xaf3a('0x1c')],function(_0x4f8846){return{'model':db[_0x4f8846[_0xaf3a('0x1d')]],'as':_0x4f8846['as'],'attributes':_0x4f8846[_0xaf3a('0x1b')],'include':_0x4f8846[_0xaf3a('0x1c')]?_[_0xaf3a('0x1e')](_0x4f8846[_0xaf3a('0x1c')],function(_0x409a27){return{'model':db[_0x409a27[_0xaf3a('0x1d')]],'as':_0x409a27['as'],'attributes':_0x409a27[_0xaf3a('0x1b')],'include':_0x409a27['include']?_['map'](_0x409a27['include'],function(_0x3158b8){return{'model':db[_0x3158b8['model']],'as':_0x3158b8['as'],'attributes':_0x3158b8[_0xaf3a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xaf3a('0xd')](function(_0x23feea){logger[_0xaf3a('0xe')]('GetVoiceQueueReport',_0x33d38a);logger[_0xaf3a('0x1f')]('GetVoiceQueueReport',_0x33d38a,JSON['stringify'](_0x23feea));_0x356b55(_0x23feea);})[_0xaf3a('0x20')](function(_0x28646e){logger[_0xaf3a('0x12')](_0xaf3a('0x21'),_0x28646e[_0xaf3a('0x14')],_0x33d38a);_0x9617c1(_0x4858df[_0xaf3a('0x12')](0x1f4,_0x28646e[_0xaf3a('0x14')]));});});};exports[_0xaf3a('0x22')]=function(_0x178a97){var _0xfd8a76=this;return new Promise(function(_0x43598c,_0x151d98){return db[_0xaf3a('0x16')]['create'](_0x178a97[_0xaf3a('0x23')],{'raw':_0x178a97[_0xaf3a('0x18')]?_0x178a97['options'][_0xaf3a('0x19')]===undefined?!![]:![]:!![]})[_0xaf3a('0xd')](function(_0xd9b60a){logger[_0xaf3a('0xe')](_0xaf3a('0x22'),_0x178a97);logger[_0xaf3a('0x1f')](_0xaf3a('0x22'),_0x178a97,JSON[_0xaf3a('0x24')](_0xd9b60a));_0x43598c(_0xd9b60a);})[_0xaf3a('0x20')](function(_0x1995e3){logger['error'](_0xaf3a('0x22'),_0x1995e3[_0xaf3a('0x14')],_0x178a97);_0x151d98(_0xfd8a76[_0xaf3a('0x12')](0x1f4,_0x1995e3[_0xaf3a('0x14')]));});});};exports[_0xaf3a('0x25')]=function(_0x9db657){var _0x5a2349=this;return new Promise(function(_0x135186,_0x3866ee){return db[_0xaf3a('0x16')][_0xaf3a('0x26')](_0x9db657[_0xaf3a('0x23')],{'raw':_0x9db657['options']?_0x9db657[_0xaf3a('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9db657[_0xaf3a('0x18')]?_0x9db657[_0xaf3a('0x18')][_0xaf3a('0x1a')]||null:null,'attributes':_0x9db657[_0xaf3a('0x18')]?_0x9db657[_0xaf3a('0x18')][_0xaf3a('0x1b')]||null:null,'limit':_0x9db657[_0xaf3a('0x18')]?_0x9db657[_0xaf3a('0x18')][_0xaf3a('0x27')]||null:null})['then'](function(_0x33046d){logger[_0xaf3a('0xe')](_0xaf3a('0x25'),_0x9db657);logger[_0xaf3a('0x1f')]('UpdateVoiceQueueReport',_0x9db657,JSON[_0xaf3a('0x24')](_0x33046d));_0x135186(_0x33046d);})[_0xaf3a('0x20')](function(_0xf2ec7a){logger[_0xaf3a('0x12')](_0xaf3a('0x25'),_0xf2ec7a[_0xaf3a('0x14')],_0x9db657);_0x3866ee(_0x5a2349[_0xaf3a('0x12')](0x1f4,_0xf2ec7a[_0xaf3a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 8b22045..4f0e810 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 _0x2420=['update','emit','removeListener','length','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0xfc9d62,_0x4c0a49){var _0xb6bf90=function(_0x42ba0a){while(--_0x42ba0a){_0xfc9d62['push'](_0xfc9d62['shift']());}};_0xb6bf90(++_0x4c0a49);}(_0x2420,0xfd));var _0x0242=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2420[_0x5b644e];return _0x49c6bf;};'use strict';var VoiceQueueReportEvents=require(_0x0242('0x0'));var events=[_0x0242('0x1'),_0x0242('0x2'),_0x0242('0x3')];function createListener(_0x5ab77d,_0x37a44b){return function(_0x33dda7){_0x37a44b[_0x0242('0x4')](_0x5ab77d,_0x33dda7);};}function removeListener(_0x538a61,_0x55521d){return function(){VoiceQueueReportEvents[_0x0242('0x5')](_0x538a61,_0x55521d);};}exports['register']=function(_0x58d160){for(var _0x1f0946=0x0,_0x3d5795=events[_0x0242('0x6')];_0x1f0946<_0x3d5795;_0x1f0946++){var _0x102de1=events[_0x1f0946];var _0x127d49=createListener(_0x0242('0x7')+_0x102de1,_0x58d160);VoiceQueueReportEvents['on'](_0x102de1,_0x127d49);}}; \ No newline at end of file +var _0x36ce=['remove','update','emit','register','./voiceQueueReport.events'];(function(_0x293794,_0x4626d7){var _0x272d00=function(_0xfe4890){while(--_0xfe4890){_0x293794['push'](_0x293794['shift']());}};_0x272d00(++_0x4626d7);}(_0x36ce,0x11c));var _0xe36c=function(_0x2ca080,_0x43ed4f){_0x2ca080=_0x2ca080-0x0;var _0x259574=_0x36ce[_0x2ca080];return _0x259574;};'use strict';var VoiceQueueReportEvents=require(_0xe36c('0x0'));var events=['save',_0xe36c('0x1'),_0xe36c('0x2')];function createListener(_0x39fb0f,_0x50be74){return function(_0x6ed66){_0x50be74[_0xe36c('0x3')](_0x39fb0f,_0x6ed66);};}function removeListener(_0x187158,_0x25e4d3){return function(){VoiceQueueReportEvents['removeListener'](_0x187158,_0x25e4d3);};}exports[_0xe36c('0x4')]=function(_0x84ee81){for(var _0x3f9378=0x0,_0x536a47=events['length'];_0x3f9378<_0x536a47;_0x3f9378++){var _0x1e9bfc=events[_0x3f9378];var _0xbbaa05=createListener('voiceQueueReport:'+_0x1e9bfc,_0x84ee81);VoiceQueueReportEvents['on'](_0x1e9bfc,_0xbbaa05);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 1259b4a..35babf4 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(_0x3dc9f0,_0x999d9){var _0x44f3c6=function(_0x10ef20){while(--_0x10ef20){_0x3dc9f0['push'](_0x3dc9f0['shift']());}};_0x44f3c6(++_0x999d9);}(_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['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(_0x3149d6,_0x16240b){var _0x3e81bd=function(_0x22eb6b){while(--_0x22eb6b){_0x3149d6['push'](_0x3149d6['shift']());}};_0x3e81bd(++_0x16240b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 0180768..53d1ad0 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 _0x9f62=['moment','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1315db,_0x27c35c){var _0x13e0df=function(_0x313613){while(--_0x313613){_0x1315db['push'](_0x1315db['shift']());}};_0x13e0df(++_0x27c35c);}(_0x9f62,0x154));var _0x29f6=function(_0x596520,_0x398b5e){_0x596520=_0x596520-0x0;var _0x42bbe7=_0x9f62[_0x596520];return _0x42bbe7;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x29f6('0x0'));module['exports']={'time':{'type':Sequelize[_0x29f6('0x1')]},'callid':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x29f6('0x2')],'allowNull':![],'defaultValue':moment()[_0x29f6('0x3')](_0x29f6('0x4'))}}; \ No newline at end of file +var _0xee14=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','exports'];(function(_0x67dc9a,_0x3186ea){var _0x1e6de5=function(_0x3eaa45){while(--_0x3eaa45){_0x67dc9a['push'](_0x67dc9a['shift']());}};_0x1e6de5(++_0x3186ea);}(_0xee14,0x13a));var _0x4ee1=function(_0x1af8c0,_0x57a279){_0x1af8c0=_0x1af8c0-0x0;var _0x51cd21=_0xee14[_0x1af8c0];return _0x51cd21;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x4ee1('0x0')]={'time':{'type':Sequelize[_0x4ee1('0x1')]},'callid':{'type':Sequelize[_0x4ee1('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x4ee1('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x4ee1('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x4ee1('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x4ee1('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x4ee1('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x4ee1('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x4ee1('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x4ee1('0x2')],'allowNull':![],'defaultValue':moment()[_0x4ee1('0x3')](_0x4ee1('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index ecbef6d..5679ab6 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 _0x655f=['mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','save','update','then','end','error','name','send','index','VoiceQueuesLog','rawAttributes','query','dateStart','dateEnd','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filters','add','day','filter','map','merge','includeAll','include','catch','show','options','create','body','params','destroy','fast-json-patch','moment'];(function(_0x39fee5,_0x33f715){var _0x43c19d=function(_0xff661){while(--_0xff661){_0x39fee5['push'](_0x39fee5['shift']());}};_0x43c19d(++_0x33f715);}(_0x655f,0x7a));var _0xf655=function(_0x5a6f62,_0x15d15e){_0x5a6f62=_0x5a6f62-0x0;var _0x270441=_0x655f[_0x5a6f62];return _0x270441;};'use strict';var jsonpatch=require(_0xf655('0x0'));var rp=require('request-promise');var moment=require(_0xf655('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xf655('0x2'));var util=require(_0xf655('0x3'));var path=require('path');var sox=require(_0xf655('0x4'));var csv=require(_0xf655('0x5'));var ejs=require(_0xf655('0x6'));var fs=require('fs');var _=require(_0xf655('0x7'));var squel=require(_0xf655('0x8'));var crypto=require(_0xf655('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf655('0xa'));var Papa=require(_0xf655('0xb'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0xf655('0xc'));var config=require('../../config/environment');var db=require(_0xf655('0xd'))['db'];function respondWithStatusCode(_0x172627,_0x16729a){_0x16729a=_0x16729a||0xcc;return function(_0xe59256){if(_0xe59256){return _0x172627[_0xf655('0xe')](_0x16729a);}return _0x172627['status'](_0x16729a)['end']();};}function respondWithResult(_0xb1b932,_0x304f80){_0x304f80=_0x304f80||0xc8;return function(_0x17cf53){if(_0x17cf53){return _0xb1b932[_0xf655('0xf')](_0x304f80)[_0xf655('0x10')](_0x17cf53);}};}function respondWithFilteredResult(_0x350a56,_0x8e914c){return function(_0x4f9acd){if(_0x4f9acd){var _0x4dbcc1=_0x4f9acd[_0xf655('0x11')],_0x2b732f=_0x8e914c['offset'],_0x58d480=_0x8e914c[_0xf655('0x12')]+_0x8e914c['limit'],_0x3b405d;if(_0x58d480>=_0x4dbcc1){_0x58d480=_0x4dbcc1;_0x3b405d=0xc8;}else{_0x3b405d=0xce;}_0x350a56[_0xf655('0xf')](_0x3b405d);return _0x350a56[_0xf655('0x13')](_0xf655('0x14'),_0x2b732f+'-'+_0x58d480+'/'+_0x4dbcc1)['json'](_0x4f9acd);}return null;};}function patchUpdates(_0x555bad){return function(_0x1ed512){try{jsonpatch[_0xf655('0x15')](_0x1ed512,_0x555bad,!![]);}catch(_0x3616ee){return BPromise['reject'](_0x3616ee);}return _0x1ed512[_0xf655('0x16')]();};}function saveUpdates(_0x89e85,_0x4c1f5f){return function(_0x3b0ffb){if(_0x3b0ffb){return _0x3b0ffb[_0xf655('0x17')](_0x89e85)[_0xf655('0x18')](function(_0x257cb4){return _0x257cb4;});}return null;};}function removeEntity(_0x12f11c,_0x5b9d8a){return function(_0x139fb0){if(_0x139fb0){return _0x139fb0['destroy']()[_0xf655('0x18')](function(){_0x12f11c[_0xf655('0xf')](0xcc)[_0xf655('0x19')]();});}};}function handleEntityNotFound(_0x252bc9,_0x48cd3a){return function(_0x27607c){if(!_0x27607c){_0x252bc9[_0xf655('0xe')](0x194);}return _0x27607c;};}function handleError(_0x2e9163,_0x1b994d){_0x1b994d=_0x1b994d||0x1f4;return function(_0x1091f6){logger[_0xf655('0x1a')](_0x1091f6['stack']);if(_0x1091f6[_0xf655('0x1b')]){delete _0x1091f6[_0xf655('0x1b')];}_0x2e9163[_0xf655('0xf')](_0x1b994d)[_0xf655('0x1c')](_0x1091f6);};}exports[_0xf655('0x1d')]=function(_0xcd77d5,_0x5a48c0){var _0x1b96d0={},_0x4dad27={},_0x42b2cc={'count':0x0,'rows':[]};var _0x212784=db[_0xf655('0x1e')][_0xf655('0x1f')];_0x4dad27['model']=_['keys'](_0x212784);var _0x458d21={'dateStart':_0xcd77d5[_0xf655('0x20')][_0xf655('0x21')],'dateEnd':_0xcd77d5[_0xf655('0x20')]['dateEnd']};delete _0xcd77d5['query']['dateStart'];delete _0xcd77d5[_0xf655('0x20')][_0xf655('0x22')];_0x4dad27['query']=_[_0xf655('0x23')](_0xcd77d5[_0xf655('0x20')]);_0x4dad27['filters']=_[_0xf655('0x24')](_0x4dad27[_0xf655('0x25')],_0x4dad27[_0xf655('0x20')]);_0x1b96d0[_0xf655('0x26')]=_['intersection'](_0x4dad27[_0xf655('0x25')],qs[_0xf655('0x27')](_0xcd77d5[_0xf655('0x20')][_0xf655('0x27')]));_0x1b96d0['attributes']=_0x1b96d0[_0xf655('0x26')][_0xf655('0x28')]?_0x1b96d0[_0xf655('0x26')]:_0x4dad27[_0xf655('0x25')];if(!_0xcd77d5['query'][_0xf655('0x29')](_0xf655('0x2a'))){_0x1b96d0[_0xf655('0x2b')]=qs[_0xf655('0x2b')](_0xcd77d5[_0xf655('0x20')][_0xf655('0x2b')]);_0x1b96d0[_0xf655('0x12')]=qs[_0xf655('0x12')](_0xcd77d5[_0xf655('0x20')][_0xf655('0x12')]);}_0x1b96d0['order']=qs['sort'](_0xcd77d5[_0xf655('0x20')][_0xf655('0x2c')]);_0x1b96d0[_0xf655('0x2d')]=qs['filters'](_[_0xf655('0x2e')](_0xcd77d5[_0xf655('0x20')],_0x4dad27[_0xf655('0x2f')]));if(_0x458d21[_0xf655('0x21')]){if(_0x458d21[_0xf655('0x22')]){_0x458d21['dateEnd']=moment(_0x458d21[_0xf655('0x22')])[_0xf655('0x30')](0x1,_0xf655('0x31'));}else{_0x458d21[_0xf655('0x22')]=moment(_0x458d21[_0xf655('0x21')])[_0xf655('0x30')](0x1,_0xf655('0x31'));}_['merge'](_0x1b96d0['where'],{'createdAt':{'$gte':_0x458d21[_0xf655('0x21')],'$lte':_0x458d21[_0xf655('0x22')]}});}if(_0xcd77d5[_0xf655('0x20')][_0xf655('0x32')]){_0x1b96d0[_0xf655('0x2d')]=_['merge'](_0x1b96d0[_0xf655('0x2d')],{'$or':_[_0xf655('0x33')](_0x1b96d0[_0xf655('0x26')],function(_0x4c0669){var _0x552b58={};_0x552b58[_0x4c0669]={'$like':'%'+_0xcd77d5[_0xf655('0x20')][_0xf655('0x32')]+'%'};return _0x552b58;})});}_0x1b96d0=_[_0xf655('0x34')]({},_0x1b96d0,_0xcd77d5['options']);var _0x36ab4a={'where':_0x1b96d0['where']};return db[_0xf655('0x1e')][_0xf655('0x11')](_0x36ab4a)[_0xf655('0x18')](function(_0x347949){_0x42b2cc['count']=_0x347949;if(_0xcd77d5['query'][_0xf655('0x35')]){_0x1b96d0[_0xf655('0x36')]=[{'all':!![]}];}return db[_0xf655('0x1e')]['findAll'](_0x1b96d0);})[_0xf655('0x18')](function(_0x137de2){_0x42b2cc['rows']=_0x137de2;return _0x42b2cc;})[_0xf655('0x18')](respondWithFilteredResult(_0x5a48c0,_0x1b96d0))[_0xf655('0x37')](handleError(_0x5a48c0,null));};exports[_0xf655('0x38')]=function(_0x569c79,_0x23cb97){var _0x53b515={'raw':!![],'where':{'id':_0x569c79['params']['id']}},_0x42a1cd={};_0x42a1cd[_0xf655('0x25')]=_[_0xf655('0x23')](db[_0xf655('0x1e')][_0xf655('0x1f')]);_0x42a1cd['query']=_['keys'](_0x569c79[_0xf655('0x20')]);_0x42a1cd[_0xf655('0x2f')]=_[_0xf655('0x24')](_0x42a1cd[_0xf655('0x25')],_0x42a1cd[_0xf655('0x20')]);_0x53b515[_0xf655('0x26')]=_['intersection'](_0x42a1cd[_0xf655('0x25')],qs['fields'](_0x569c79[_0xf655('0x20')][_0xf655('0x27')]));_0x53b515[_0xf655('0x26')]=_0x53b515[_0xf655('0x26')][_0xf655('0x28')]?_0x53b515[_0xf655('0x26')]:_0x42a1cd[_0xf655('0x25')];if(_0x569c79[_0xf655('0x20')][_0xf655('0x35')]){_0x53b515['include']=[{'all':!![]}];}_0x53b515=_[_0xf655('0x34')]({},_0x53b515,_0x569c79[_0xf655('0x39')]);return db['VoiceQueuesLog']['find'](_0x53b515)[_0xf655('0x18')](handleEntityNotFound(_0x23cb97,null))[_0xf655('0x18')](respondWithResult(_0x23cb97,null))[_0xf655('0x37')](handleError(_0x23cb97,null));};exports[_0xf655('0x3a')]=function(_0x578db0,_0x28972b){return db[_0xf655('0x1e')]['create'](_0x578db0['body'],{})['then'](respondWithResult(_0x28972b,0xc9))['catch'](handleError(_0x28972b,null));};exports[_0xf655('0x17')]=function(_0x12e58c,_0x307f6e){if(_0x12e58c['body']['id']){delete _0x12e58c[_0xf655('0x3b')]['id'];}return db[_0xf655('0x1e')]['find']({'where':{'id':_0x12e58c[_0xf655('0x3c')]['id']}})[_0xf655('0x18')](handleEntityNotFound(_0x307f6e,null))[_0xf655('0x18')](saveUpdates(_0x12e58c[_0xf655('0x3b')],null))['then'](respondWithResult(_0x307f6e,null))[_0xf655('0x37')](handleError(_0x307f6e,null));};exports[_0xf655('0x3d')]=function(_0x293a17,_0x25eb5f){return db[_0xf655('0x1e')]['find']({'where':{'id':_0x293a17[_0xf655('0x3c')]['id']}})[_0xf655('0x18')](handleEntityNotFound(_0x25eb5f,null))[_0xf655('0x18')](removeEntity(_0x25eb5f,null))[_0xf655('0x37')](handleError(_0x25eb5f,null));}; \ No newline at end of file +var _0x7780=['dateStart','dateEnd','keys','filters','intersection','fields','attributes','nolimit','limit','order','sort','where','add','day','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','destroy','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','update','then','error','name','index','VoiceQueuesLog','rawAttributes','model','query'];(function(_0x37edd2,_0x162467){var _0x3a737a=function(_0xffd8be){while(--_0xffd8be){_0x37edd2['push'](_0x37edd2['shift']());}};_0x3a737a(++_0x162467);}(_0x7780,0x19c));var _0x0778=function(_0x5f1cf7,_0x47d9a9){_0x5f1cf7=_0x5f1cf7-0x0;var _0x2ab77b=_0x7780[_0x5f1cf7];return _0x2ab77b;};'use strict';var jsonpatch=require(_0x0778('0x0'));var rp=require(_0x0778('0x1'));var moment=require(_0x0778('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0778('0x3'));var util=require(_0x0778('0x4'));var path=require('path');var sox=require(_0x0778('0x5'));var csv=require(_0x0778('0x6'));var ejs=require(_0x0778('0x7'));var fs=require('fs');var _=require(_0x0778('0x8'));var squel=require(_0x0778('0x9'));var crypto=require('crypto');var jsforce=require(_0x0778('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x0778('0x6'));var querystring=require('querystring');var Papa=require(_0x0778('0xb'));var qs=require(_0x0778('0xc'));var logger=require(_0x0778('0xd'))(_0x0778('0xe'));var utils=require(_0x0778('0xf'));var config=require(_0x0778('0x10'));var db=require(_0x0778('0x11'))['db'];function respondWithStatusCode(_0x2319ea,_0x530f6f){_0x530f6f=_0x530f6f||0xcc;return function(_0x404975){if(_0x404975){return _0x2319ea[_0x0778('0x12')](_0x530f6f);}return _0x2319ea[_0x0778('0x13')](_0x530f6f)[_0x0778('0x14')]();};}function respondWithResult(_0x6c6a9e,_0xd5b316){_0xd5b316=_0xd5b316||0xc8;return function(_0x1f47e1){if(_0x1f47e1){return _0x6c6a9e[_0x0778('0x13')](_0xd5b316)['json'](_0x1f47e1);}};}function respondWithFilteredResult(_0x52cea1,_0x54fe3b){return function(_0x5e2d94){if(_0x5e2d94){var _0x1c2077=_0x5e2d94[_0x0778('0x15')],_0x17d1bb=_0x54fe3b['offset'],_0x3642c0=_0x54fe3b[_0x0778('0x16')]+_0x54fe3b['limit'],_0x509b2c;if(_0x3642c0>=_0x1c2077){_0x3642c0=_0x1c2077;_0x509b2c=0xc8;}else{_0x509b2c=0xce;}_0x52cea1[_0x0778('0x13')](_0x509b2c);return _0x52cea1[_0x0778('0x17')](_0x0778('0x18'),_0x17d1bb+'-'+_0x3642c0+'/'+_0x1c2077)[_0x0778('0x19')](_0x5e2d94);}return null;};}function patchUpdates(_0x17e7dc){return function(_0x24e36c){try{jsonpatch[_0x0778('0x1a')](_0x24e36c,_0x17e7dc,!![]);}catch(_0x323d3d){return BPromise['reject'](_0x323d3d);}return _0x24e36c['save']();};}function saveUpdates(_0x575f9f,_0x46e325){return function(_0x11cd37){if(_0x11cd37){return _0x11cd37[_0x0778('0x1b')](_0x575f9f)['then'](function(_0x157aed){return _0x157aed;});}return null;};}function removeEntity(_0x4a668e,_0x3a69e0){return function(_0x202d9a){if(_0x202d9a){return _0x202d9a['destroy']()[_0x0778('0x1c')](function(){_0x4a668e[_0x0778('0x13')](0xcc)[_0x0778('0x14')]();});}};}function handleEntityNotFound(_0x3d04d8,_0x354402){return function(_0x21fbab){if(!_0x21fbab){_0x3d04d8[_0x0778('0x12')](0x194);}return _0x21fbab;};}function handleError(_0x41f191,_0x23df93){_0x23df93=_0x23df93||0x1f4;return function(_0x312cc7){logger[_0x0778('0x1d')](_0x312cc7['stack']);if(_0x312cc7[_0x0778('0x1e')]){delete _0x312cc7[_0x0778('0x1e')];}_0x41f191['status'](_0x23df93)['send'](_0x312cc7);};}exports[_0x0778('0x1f')]=function(_0x3fbef5,_0x3fd2d4){var _0x2739d2={},_0x4340ea={},_0x2dc231={'count':0x0,'rows':[]};var _0x33c189=db[_0x0778('0x20')][_0x0778('0x21')];_0x4340ea[_0x0778('0x22')]=_['keys'](_0x33c189);var _0x2cdd04={'dateStart':_0x3fbef5[_0x0778('0x23')][_0x0778('0x24')],'dateEnd':_0x3fbef5[_0x0778('0x23')][_0x0778('0x25')]};delete _0x3fbef5[_0x0778('0x23')][_0x0778('0x24')];delete _0x3fbef5[_0x0778('0x23')]['dateEnd'];_0x4340ea[_0x0778('0x23')]=_[_0x0778('0x26')](_0x3fbef5[_0x0778('0x23')]);_0x4340ea[_0x0778('0x27')]=_[_0x0778('0x28')](_0x4340ea[_0x0778('0x22')],_0x4340ea[_0x0778('0x23')]);_0x2739d2['attributes']=_[_0x0778('0x28')](_0x4340ea['model'],qs[_0x0778('0x29')](_0x3fbef5[_0x0778('0x23')]['fields']));_0x2739d2[_0x0778('0x2a')]=_0x2739d2[_0x0778('0x2a')]['length']?_0x2739d2[_0x0778('0x2a')]:_0x4340ea[_0x0778('0x22')];if(!_0x3fbef5[_0x0778('0x23')]['hasOwnProperty'](_0x0778('0x2b'))){_0x2739d2['limit']=qs['limit'](_0x3fbef5['query'][_0x0778('0x2c')]);_0x2739d2[_0x0778('0x16')]=qs[_0x0778('0x16')](_0x3fbef5['query'][_0x0778('0x16')]);}_0x2739d2[_0x0778('0x2d')]=qs[_0x0778('0x2e')](_0x3fbef5['query']['sort']);_0x2739d2[_0x0778('0x2f')]=qs['filters'](_['pick'](_0x3fbef5[_0x0778('0x23')],_0x4340ea[_0x0778('0x27')]));if(_0x2cdd04[_0x0778('0x24')]){if(_0x2cdd04[_0x0778('0x25')]){_0x2cdd04['dateEnd']=moment(_0x2cdd04[_0x0778('0x25')])[_0x0778('0x30')](0x1,'day');}else{_0x2cdd04[_0x0778('0x25')]=moment(_0x2cdd04['dateStart'])['add'](0x1,_0x0778('0x31'));}_['merge'](_0x2739d2['where'],{'createdAt':{'$gte':_0x2cdd04[_0x0778('0x24')],'$lte':_0x2cdd04[_0x0778('0x25')]}});}if(_0x3fbef5[_0x0778('0x23')]['filter']){_0x2739d2[_0x0778('0x2f')]=_['merge'](_0x2739d2['where'],{'$or':_['map'](_0x2739d2[_0x0778('0x2a')],function(_0x5eb1d5){var _0x5e676f={};_0x5e676f[_0x5eb1d5]={'$like':'%'+_0x3fbef5[_0x0778('0x23')]['filter']+'%'};return _0x5e676f;})});}_0x2739d2=_[_0x0778('0x32')]({},_0x2739d2,_0x3fbef5[_0x0778('0x33')]);var _0x4f2123={'where':_0x2739d2[_0x0778('0x2f')]};return db[_0x0778('0x20')]['count'](_0x4f2123)[_0x0778('0x1c')](function(_0x7c4bb0){_0x2dc231[_0x0778('0x15')]=_0x7c4bb0;if(_0x3fbef5[_0x0778('0x23')][_0x0778('0x34')]){_0x2739d2[_0x0778('0x35')]=[{'all':!![]}];}return db[_0x0778('0x20')][_0x0778('0x36')](_0x2739d2);})[_0x0778('0x1c')](function(_0x4e8abc){_0x2dc231[_0x0778('0x37')]=_0x4e8abc;return _0x2dc231;})[_0x0778('0x1c')](respondWithFilteredResult(_0x3fd2d4,_0x2739d2))['catch'](handleError(_0x3fd2d4,null));};exports[_0x0778('0x38')]=function(_0x4fd0f6,_0x3c1f6a){var _0x3fd17e={'raw':!![],'where':{'id':_0x4fd0f6[_0x0778('0x39')]['id']}},_0x40dc8a={};_0x40dc8a['model']=_[_0x0778('0x26')](db[_0x0778('0x20')]['rawAttributes']);_0x40dc8a[_0x0778('0x23')]=_[_0x0778('0x26')](_0x4fd0f6[_0x0778('0x23')]);_0x40dc8a[_0x0778('0x27')]=_[_0x0778('0x28')](_0x40dc8a['model'],_0x40dc8a[_0x0778('0x23')]);_0x3fd17e['attributes']=_[_0x0778('0x28')](_0x40dc8a[_0x0778('0x22')],qs[_0x0778('0x29')](_0x4fd0f6[_0x0778('0x23')][_0x0778('0x29')]));_0x3fd17e[_0x0778('0x2a')]=_0x3fd17e[_0x0778('0x2a')][_0x0778('0x3a')]?_0x3fd17e[_0x0778('0x2a')]:_0x40dc8a['model'];if(_0x4fd0f6[_0x0778('0x23')]['includeAll']){_0x3fd17e[_0x0778('0x35')]=[{'all':!![]}];}_0x3fd17e=_[_0x0778('0x32')]({},_0x3fd17e,_0x4fd0f6[_0x0778('0x33')]);return db[_0x0778('0x20')][_0x0778('0x3b')](_0x3fd17e)[_0x0778('0x1c')](handleEntityNotFound(_0x3c1f6a,null))[_0x0778('0x1c')](respondWithResult(_0x3c1f6a,null))[_0x0778('0x3c')](handleError(_0x3c1f6a,null));};exports[_0x0778('0x3d')]=function(_0x1182f1,_0x2ca696){return db['VoiceQueuesLog'][_0x0778('0x3d')](_0x1182f1['body'],{})[_0x0778('0x1c')](respondWithResult(_0x2ca696,0xc9))[_0x0778('0x3c')](handleError(_0x2ca696,null));};exports['update']=function(_0x207ead,_0x213d5d){if(_0x207ead['body']['id']){delete _0x207ead[_0x0778('0x3e')]['id'];}return db[_0x0778('0x20')][_0x0778('0x3b')]({'where':{'id':_0x207ead[_0x0778('0x39')]['id']}})[_0x0778('0x1c')](handleEntityNotFound(_0x213d5d,null))[_0x0778('0x1c')](saveUpdates(_0x207ead[_0x0778('0x3e')],null))[_0x0778('0x1c')](respondWithResult(_0x213d5d,null))[_0x0778('0x3c')](handleError(_0x213d5d,null));};exports[_0x0778('0x3f')]=function(_0x44e2f1,_0x3c0e76){return db[_0x0778('0x20')][_0x0778('0x3b')]({'where':{'id':_0x44e2f1['params']['id']}})[_0x0778('0x1c')](handleEntityNotFound(_0x3c0e76,null))['then'](removeEntity(_0x3c0e76,null))['catch'](handleError(_0x3c0e76,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 8f432c4..3a9d0f5 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 _0x92ca=['VoiceQueuesLog','voice_queues_log','event_dtm','event','util','api','moment','bluebird'];(function(_0x16fdfb,_0x5e5918){var _0x496ec0=function(_0x4e0cc8){while(--_0x4e0cc8){_0x16fdfb['push'](_0x16fdfb['shift']());}};_0x496ec0(++_0x5e5918);}(_0x92ca,0x16c));var _0xa92c=function(_0x5baadf,_0x1bb942){_0x5baadf=_0x5baadf-0x0;var _0x3cd985=_0x92ca[_0x5baadf];return _0x3cd985;};'use strict';var _=require('lodash');var util=require(_0xa92c('0x0'));var logger=require('../../config/logger')(_0xa92c('0x1'));var moment=require(_0xa92c('0x2'));var BPromise=require(_0xa92c('0x3'));var rp=require('request-promise');var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x1fa08a,_0x21260c){return _0x1fa08a['define'](_0xa92c('0x4'),attributes,{'tableName':_0xa92c('0x5'),'paranoid':![],'indexes':[{'name':_0xa92c('0x6'),'fields':[_0xa92c('0x7'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x4aeb=['util','../../config/logger','api','bluebird','request-promise','./voiceQueuesLog.attributes','event_dtm','event','lodash'];(function(_0x4f4bd1,_0x1a3c4a){var _0x45b264=function(_0x7bf39b){while(--_0x7bf39b){_0x4f4bd1['push'](_0x4f4bd1['shift']());}};_0x45b264(++_0x1a3c4a);}(_0x4aeb,0x131));var _0xb4ae=function(_0x2985ac,_0x38254e){_0x2985ac=_0x2985ac-0x0;var _0x382b19=_0x4aeb[_0x2985ac];return _0x382b19;};'use strict';var _=require(_0xb4ae('0x0'));var util=require(_0xb4ae('0x1'));var logger=require(_0xb4ae('0x2'))(_0xb4ae('0x3'));var moment=require('moment');var BPromise=require(_0xb4ae('0x4'));var rp=require(_0xb4ae('0x5'));var attributes=require(_0xb4ae('0x6'));module['exports']=function(_0xeaf8fd,_0x4b4bf1){return _0xeaf8fd['define']('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xb4ae('0x7'),'fields':[_0xb4ae('0x8'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index a1ac5bc..6750769 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 _0x9703=['info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','catch','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','request','then'];(function(_0x13a913,_0x400d93){var _0xbf71de=function(_0xc750b5){while(--_0xc750b5){_0x13a913['push'](_0x13a913['shift']());}};_0xbf71de(++_0x400d93);}(_0x9703,0xdb));var _0x3970=function(_0x304fbd,_0x401f58){_0x304fbd=_0x304fbd-0x0;var _0x3a4448=_0x9703[_0x304fbd];return _0x3a4448;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3970('0x0'));var BPromise=require(_0x3970('0x1'));var rs=require(_0x3970('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x3970('0x3'));var logger=require('../../config/logger')(_0x3970('0x4'));var config=require('../../config/environment');var jayson=require(_0x3970('0x5'));var client=jayson[_0x3970('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5669ec,_0x21986b,_0x1bf4d6){return new BPromise(function(_0x282355,_0x41d4d1){return client[_0x3970('0x7')](_0x5669ec,_0x1bf4d6)[_0x3970('0x8')](function(_0x239d07){logger[_0x3970('0x9')]('VoiceQueuesLog,\x20%s,\x20%s',_0x21986b,_0x3970('0xa'));logger[_0x3970('0xb')](_0x3970('0xc'),_0x21986b,'request\x20sent',JSON[_0x3970('0xd')](_0x239d07));if(_0x239d07[_0x3970('0xe')]){if(_0x239d07['error'][_0x3970('0xf')]===0x1f4){logger[_0x3970('0xe')](_0x3970('0x10'),_0x21986b,_0x239d07[_0x3970('0xe')]['message']);return _0x41d4d1(_0x239d07[_0x3970('0xe')][_0x3970('0x11')]);}logger[_0x3970('0xe')](_0x3970('0x10'),_0x21986b,_0x239d07[_0x3970('0xe')][_0x3970('0x11')]);return _0x282355(_0x239d07[_0x3970('0xe')][_0x3970('0x11')]);}else{logger['info'](_0x3970('0x10'),_0x21986b,_0x3970('0xa'));_0x282355(_0x239d07['result'][_0x3970('0x11')]);}})[_0x3970('0x12')](function(_0x5dc2f7){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x21986b,_0x5dc2f7);_0x41d4d1(_0x5dc2f7);});});} \ No newline at end of file +var _0x608c=['VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4c3e39,_0x3bb4c1){var _0x532744=function(_0x2a5a7b){while(--_0x2a5a7b){_0x4c3e39['push'](_0x4c3e39['shift']());}};_0x532744(++_0x3bb4c1);}(_0x608c,0x1a1));var _0xc608=function(_0x6e8f74,_0x339a6a){_0x6e8f74=_0x6e8f74-0x0;var _0x29b868=_0x608c[_0x6e8f74];return _0x29b868;};'use strict';var _=require(_0xc608('0x0'));var util=require('util');var moment=require(_0xc608('0x1'));var BPromise=require(_0xc608('0x2'));var rs=require(_0xc608('0x3'));var fs=require('fs');var db=require(_0xc608('0x4'))['db'];var utils=require(_0xc608('0x5'));var logger=require(_0xc608('0x6'))(_0xc608('0x7'));var config=require(_0xc608('0x8'));var jayson=require(_0xc608('0x9'));var client=jayson[_0xc608('0xa')][_0xc608('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23b77b,_0x4ff103,_0x589621){return new BPromise(function(_0x320ff6,_0x4d5568){return client[_0xc608('0xc')](_0x23b77b,_0x589621)[_0xc608('0xd')](function(_0x34c41f){logger[_0xc608('0xe')](_0xc608('0xf'),_0x4ff103,_0xc608('0x10'));logger[_0xc608('0x11')](_0xc608('0x12'),_0x4ff103,_0xc608('0x10'),JSON[_0xc608('0x13')](_0x34c41f));if(_0x34c41f[_0xc608('0x14')]){if(_0x34c41f[_0xc608('0x14')][_0xc608('0x15')]===0x1f4){logger['error'](_0xc608('0xf'),_0x4ff103,_0x34c41f[_0xc608('0x14')][_0xc608('0x16')]);return _0x4d5568(_0x34c41f[_0xc608('0x14')][_0xc608('0x16')]);}logger[_0xc608('0x14')](_0xc608('0xf'),_0x4ff103,_0x34c41f['error'][_0xc608('0x16')]);return _0x320ff6(_0x34c41f[_0xc608('0x14')]['message']);}else{logger[_0xc608('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4ff103,_0xc608('0x10'));_0x320ff6(_0x34c41f[_0xc608('0x17')][_0xc608('0x16')]);}})['catch'](function(_0x12081a){logger[_0xc608('0x14')](_0xc608('0xf'),_0x4ff103,_0x12081a);_0x4d5568(_0x12081a);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 6c1aaf0..51a8a57 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 _0xc999=['util','path','express','./voiceRecording.controller','isAuthenticated','get','/describe','/:id','show','/:id/download','download','/:id/downloads','downloads','create','put','destroy','exports'];(function(_0x15c6b1,_0x327487){var _0x583e13=function(_0x342c09){while(--_0x342c09){_0x15c6b1['push'](_0x15c6b1['shift']());}};_0x583e13(++_0x327487);}(_0xc999,0x176));var _0x9c99=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0xc999[_0x4c7935];return _0x30651d;};'use strict';var multer=require('multer');var util=require(_0x9c99('0x0'));var path=require(_0x9c99('0x1'));var express=require(_0x9c99('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9c99('0x3'));router['get']('/',auth[_0x9c99('0x4')](),controller['index']);router[_0x9c99('0x5')](_0x9c99('0x6'),auth[_0x9c99('0x4')](),controller['describe']);router[_0x9c99('0x5')](_0x9c99('0x7'),auth[_0x9c99('0x4')](),controller[_0x9c99('0x8')]);router[_0x9c99('0x5')](_0x9c99('0x9'),auth['isAuthenticated'](),controller[_0x9c99('0xa')]);router[_0x9c99('0x5')](_0x9c99('0xb'),controller[_0x9c99('0xc')]);router['post']('/',auth[_0x9c99('0x4')](),controller[_0x9c99('0xd')]);router[_0x9c99('0xe')]('/:id',auth[_0x9c99('0x4')](),controller['update']);router['delete'](_0x9c99('0x7'),auth[_0x9c99('0x4')](),controller[_0x9c99('0xf')]);module[_0x9c99('0x10')]=router; \ No newline at end of file +var _0xb7cf=['show','/:id/download','download','/:id/downloads','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x1962c9,_0x5310c6){var _0x21e08e=function(_0x3bfc6e){while(--_0x3bfc6e){_0x1962c9['push'](_0x1962c9['shift']());}};_0x21e08e(++_0x5310c6);}(_0xb7cf,0xca));var _0xfb7c=function(_0x30bd66,_0x36a93d){_0x30bd66=_0x30bd66-0x0;var _0x74c9dd=_0xb7cf[_0x30bd66];return _0x74c9dd;};'use strict';var multer=require(_0xfb7c('0x0'));var util=require(_0xfb7c('0x1'));var path=require(_0xfb7c('0x2'));var express=require(_0xfb7c('0x3'));var router=express[_0xfb7c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xfb7c('0x5'));var config=require(_0xfb7c('0x6'));var controller=require(_0xfb7c('0x7'));router[_0xfb7c('0x8')]('/',auth[_0xfb7c('0x9')](),controller[_0xfb7c('0xa')]);router[_0xfb7c('0x8')](_0xfb7c('0xb'),auth[_0xfb7c('0x9')](),controller[_0xfb7c('0xc')]);router[_0xfb7c('0x8')](_0xfb7c('0xd'),auth[_0xfb7c('0x9')](),controller[_0xfb7c('0xe')]);router['get'](_0xfb7c('0xf'),auth[_0xfb7c('0x9')](),controller[_0xfb7c('0x10')]);router['get'](_0xfb7c('0x11'),controller['downloads']);router['post']('/',auth[_0xfb7c('0x9')](),controller[_0xfb7c('0x12')]);router[_0xfb7c('0x13')](_0xfb7c('0xd'),auth[_0xfb7c('0x9')](),controller[_0xfb7c('0x14')]);router[_0xfb7c('0x15')](_0xfb7c('0xd'),auth['isAuthenticated'](),controller[_0xfb7c('0x16')]);module[_0xfb7c('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 4415fea..027ead5 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 _0x0426=['STRING','setDataValue','channel','membername','split','INTEGER','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','path','exports','VIRTUAL','getDataValue','value','extname'];(function(_0xf0957e,_0x52b79b){var _0x4616db=function(_0x481bf3){while(--_0x481bf3){_0xf0957e['push'](_0xf0957e['shift']());}};_0x4616db(++_0x52b79b);}(_0x0426,0x116));var _0x6042=function(_0x20a2ed,_0x2f4590){_0x20a2ed=_0x20a2ed-0x0;var _0x5e39ed=_0x0426[_0x20a2ed];return _0x5e39ed;};'use strict';var Sequelize=require(_0x6042('0x0'));var moment=require('moment');var path=require(_0x6042('0x1'));module[_0x6042('0x2')]={'format':{'type':Sequelize[_0x6042('0x3')],'get':function(){return this[_0x6042('0x4')](_0x6042('0x5'))?path[_0x6042('0x6')](this['getDataValue'](_0x6042('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x6042('0x7')]},'channel':{'type':Sequelize[_0x6042('0x7')],'set':function(_0x5a8c82){if(_0x5a8c82){this[_0x6042('0x8')](_0x6042('0x9'),_0x5a8c82);this['setDataValue'](_0x6042('0xa'),_0x5a8c82[_0x6042('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x6042('0x7')]},'calleridnum':{'type':Sequelize[_0x6042('0x7')]},'calleridname':{'type':Sequelize[_0x6042('0x7')]},'connectedlinenum':{'type':Sequelize[_0x6042('0x7')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x6042('0x7')]},'context':{'type':Sequelize[_0x6042('0x7')]},'exten':{'type':Sequelize[_0x6042('0x7')]},'value':{'type':Sequelize[_0x6042('0x7')]},'type':{'type':Sequelize[_0x6042('0x7')]},'rating':{'type':Sequelize[_0x6042('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'createdAt':{'type':Sequelize[_0x6042('0xd')],'get':function(){return moment(this[_0x6042('0x4')](_0x6042('0xe')))[_0x6042('0xf')](_0x6042('0x10'))[_0x6042('0x11')]();}},'updatedAt':{'type':Sequelize[_0x6042('0xd')],'get':function(){return moment(this[_0x6042('0x4')](_0x6042('0x12')))['format'](_0x6042('0x10'))[_0x6042('0x11')]();}}}; \ No newline at end of file +var _0xbca3=['createdAt','MM-DD-YYYY\x20HH:mm','updatedAt','toString','sequelize','moment','exports','VIRTUAL','value','extname','getDataValue','STRING','setDataValue','channel','split','INTEGER','DATE'];(function(_0x199939,_0x3d3cb9){var _0x1522b6=function(_0x28fe8a){while(--_0x28fe8a){_0x199939['push'](_0x199939['shift']());}};_0x1522b6(++_0x3d3cb9);}(_0xbca3,0x125));var _0x3bca=function(_0x27a21c,_0x12cdff){_0x27a21c=_0x27a21c-0x0;var _0x55e4c4=_0xbca3[_0x27a21c];return _0x55e4c4;};'use strict';var Sequelize=require(_0x3bca('0x0'));var moment=require(_0x3bca('0x1'));var path=require('path');module[_0x3bca('0x2')]={'format':{'type':Sequelize[_0x3bca('0x3')],'get':function(){return this['getDataValue'](_0x3bca('0x4'))?path[_0x3bca('0x5')](this[_0x3bca('0x6')](_0x3bca('0x4'))):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3bca('0x7')],'set':function(_0x9f7807){if(_0x9f7807){this[_0x3bca('0x8')](_0x3bca('0x9'),_0x9f7807);this[_0x3bca('0x8')]('membername',_0x9f7807[_0x3bca('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x3bca('0x7')]},'calleridnum':{'type':Sequelize[_0x3bca('0x7')]},'calleridname':{'type':Sequelize[_0x3bca('0x7')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x3bca('0x7')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3bca('0x7')]},'value':{'type':Sequelize[_0x3bca('0x7')]},'type':{'type':Sequelize[_0x3bca('0x7')]},'rating':{'type':Sequelize[_0x3bca('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x3bca('0x7')]},'userDisposition':{'type':Sequelize['STRING']},'createdAt':{'type':Sequelize[_0x3bca('0xc')],'get':function(){return moment(this[_0x3bca('0x6')](_0x3bca('0xd')))['format'](_0x3bca('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x3bca('0xc')],'get':function(){return moment(this['getDataValue'](_0x3bca('0xf')))['format'](_0x3bca('0xe'))[_0x3bca('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index c999916..655305b 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(_0x153c74,_0x4a096d){var _0x4f1d90=function(_0x3cd766){while(--_0x3cd766){_0x153c74['push'](_0x153c74['shift']());}};_0x4f1d90(++_0x4a096d);}(_0xdb28,0x106));var _0x8db2=function(_0x2fc1d9,_0x5d4048){_0x2fc1d9=_0x2fc1d9-0x0;var _0x326c4a=_0xdb28[_0x2fc1d9];return _0x326c4a;};'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 _0x326f=['catch','show','options','find','create','body','params','destroy','describe','download','../../components/encryptor','type','uniqueid','value','existsSync','decryptFile','Sequelize','ValidationError','filename','unlink','downloads','sequelize','MD5','col','token','push','$and','%s.cypher','secrets','recording','VoiceRecording\x20not\x20found','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','save','then','error','stack','name','send','VoiceRecording','rawAttributes','differenceBy','keys','format','query','dateEnd','dateStart','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','day','merge','filter','where','map','count','includeAll','findAll','rows'];(function(_0x19b700,_0x11ceed){var _0x39a7bb=function(_0x545e8f){while(--_0x545e8f){_0x19b700['push'](_0x19b700['shift']());}};_0x39a7bb(++_0x11ceed);}(_0x326f,0xd1));var _0xf326=function(_0x1366a1,_0x3e43cf){_0x1366a1=_0x1366a1-0x0;var _0x5035ac=_0x326f[_0x1366a1];return _0x5035ac;};'use strict';var jsonpatch=require(_0xf326('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var Mustache=require(_0xf326('0x2'));var util=require(_0xf326('0x3'));var path=require(_0xf326('0x4'));var sox=require(_0xf326('0x5'));var csv=require(_0xf326('0x6'));var ejs=require(_0xf326('0x7'));var fs=require('fs');var _=require(_0xf326('0x8'));var squel=require(_0xf326('0x9'));var crypto=require(_0xf326('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf326('0xb'));var toCsv=require(_0xf326('0x6'));var querystring=require(_0xf326('0xc'));var Papa=require(_0xf326('0xd'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0xf326('0xe'));var config=require(_0xf326('0xf'));var db=require(_0xf326('0x10'))['db'];function respondWithStatusCode(_0x2686e1,_0x1f3a33){_0x1f3a33=_0x1f3a33||0xcc;return function(_0x5db9d7){if(_0x5db9d7){return _0x2686e1[_0xf326('0x11')](_0x1f3a33);}return _0x2686e1['status'](_0x1f3a33)[_0xf326('0x12')]();};}function respondWithResult(_0x4aaf3a,_0x2e4b71){_0x2e4b71=_0x2e4b71||0xc8;return function(_0x518ab5){if(_0x518ab5){return _0x4aaf3a[_0xf326('0x13')](_0x2e4b71)[_0xf326('0x14')](_0x518ab5);}};}function respondWithFilteredResult(_0x4b3966,_0x342fe5){return function(_0x472632){if(_0x472632){var _0x3504eb=_0x472632['count'],_0x17a098=_0x342fe5['offset'],_0x5c8483=_0x342fe5[_0xf326('0x15')]+_0x342fe5[_0xf326('0x16')],_0x45c1b6;if(_0x5c8483>=_0x3504eb){_0x5c8483=_0x3504eb;_0x45c1b6=0xc8;}else{_0x45c1b6=0xce;}_0x4b3966[_0xf326('0x13')](_0x45c1b6);return _0x4b3966[_0xf326('0x17')](_0xf326('0x18'),_0x17a098+'-'+_0x5c8483+'/'+_0x3504eb)[_0xf326('0x14')](_0x472632);}return null;};}function patchUpdates(_0x34128e){return function(_0x2cf2ca){try{jsonpatch['apply'](_0x2cf2ca,_0x34128e,!![]);}catch(_0x3ad7da){return BPromise[_0xf326('0x19')](_0x3ad7da);}return _0x2cf2ca[_0xf326('0x1a')]();};}function saveUpdates(_0x31ffb9,_0xcef2b5){return function(_0x311af0){if(_0x311af0){return _0x311af0['update'](_0x31ffb9)['then'](function(_0x56ad41){return _0x56ad41;});}return null;};}function removeEntity(_0x16e605,_0x289f4b){return function(_0x484cbe){if(_0x484cbe){return _0x484cbe['destroy']()[_0xf326('0x1b')](function(){_0x16e605['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x448b92,_0x18ead3){return function(_0x549b46){if(!_0x549b46){_0x448b92['sendStatus'](0x194);}return _0x549b46;};}function handleError(_0x19b8ba,_0xb1efcf){_0xb1efcf=_0xb1efcf||0x1f4;return function(_0x5f21a2){logger[_0xf326('0x1c')](_0x5f21a2[_0xf326('0x1d')]);if(_0x5f21a2[_0xf326('0x1e')]){delete _0x5f21a2[_0xf326('0x1e')];}_0x19b8ba[_0xf326('0x13')](_0xb1efcf)[_0xf326('0x1f')](_0x5f21a2);};}exports['index']=function(_0x55b9f4,_0x4f31f6){var _0x520d85={},_0x1a2c4e={},_0x2cd45a={'count':0x0,'rows':[]};var _0x1ff2b5=db[_0xf326('0x20')][_0xf326('0x21')];_0x1a2c4e['model']=_[_0xf326('0x22')](_[_0xf326('0x23')](_0x1ff2b5),[_0xf326('0x24')]);var _0x581531={'dateStart':_0x55b9f4[_0xf326('0x25')]['dateStart'],'dateEnd':_0x55b9f4['query'][_0xf326('0x26')]};delete _0x55b9f4[_0xf326('0x25')][_0xf326('0x27')];delete _0x55b9f4['query'][_0xf326('0x26')];_0x1a2c4e[_0xf326('0x25')]=_['keys'](_0x55b9f4[_0xf326('0x25')]);_0x1a2c4e[_0xf326('0x28')]=_[_0xf326('0x29')](_0x1a2c4e[_0xf326('0x2a')],_0x1a2c4e[_0xf326('0x25')]);_0x520d85[_0xf326('0x2b')]=_[_0xf326('0x29')](_0x1a2c4e[_0xf326('0x2a')],qs[_0xf326('0x2c')](_0x55b9f4[_0xf326('0x25')]['fields']));_0x520d85[_0xf326('0x2b')]=_0x520d85[_0xf326('0x2b')][_0xf326('0x2d')]?_0x520d85['attributes']:_0x1a2c4e[_0xf326('0x2a')];if(!_0x55b9f4[_0xf326('0x25')][_0xf326('0x2e')]('nolimit')){_0x520d85['limit']=qs[_0xf326('0x16')](_0x55b9f4[_0xf326('0x25')][_0xf326('0x16')]);_0x520d85[_0xf326('0x15')]=qs[_0xf326('0x15')](_0x55b9f4[_0xf326('0x25')][_0xf326('0x15')]);}_0x520d85[_0xf326('0x2f')]=qs['sort'](_0x55b9f4[_0xf326('0x25')][_0xf326('0x30')]);_0x520d85['where']=qs[_0xf326('0x28')](_['pick'](_0x55b9f4[_0xf326('0x25')],_0x1a2c4e['filters']));if(_0x581531['dateStart']){if(_0x581531[_0xf326('0x26')]){_0x581531['dateEnd']=moment(_0x581531[_0xf326('0x26')])['add'](0x1,_0xf326('0x31'));}else{_0x581531[_0xf326('0x26')]=moment(_0x581531[_0xf326('0x27')])['add'](0x1,_0xf326('0x31'));}_[_0xf326('0x32')](_0x520d85['where'],{'createdAt':{'$gte':_0x581531[_0xf326('0x27')],'$lte':_0x581531[_0xf326('0x26')]}});}if(_0x55b9f4[_0xf326('0x25')][_0xf326('0x33')]){_0x520d85['where']=_[_0xf326('0x32')](_0x520d85[_0xf326('0x34')],{'$or':_[_0xf326('0x35')](_0x520d85[_0xf326('0x2b')],function(_0x1d88ed){var _0x5f02b5={};_0x5f02b5[_0x1d88ed]={'$like':'%'+_0x55b9f4[_0xf326('0x25')][_0xf326('0x33')]+'%'};return _0x5f02b5;})});}_0x520d85=_['merge']({},_0x520d85,_0x55b9f4['options']);var _0x40564e={'where':_0x520d85['where']};return db['VoiceRecording'][_0xf326('0x36')](_0x40564e)['then'](function(_0x3e1e8c){_0x2cd45a[_0xf326('0x36')]=_0x3e1e8c;if(_0x55b9f4[_0xf326('0x25')][_0xf326('0x37')]){_0x520d85['include']=[{'all':!![]}];}return db[_0xf326('0x20')][_0xf326('0x38')](_0x520d85);})[_0xf326('0x1b')](function(_0x365627){_0x2cd45a[_0xf326('0x39')]=_0x365627;return _0x2cd45a;})[_0xf326('0x1b')](respondWithFilteredResult(_0x4f31f6,_0x520d85))[_0xf326('0x3a')](handleError(_0x4f31f6,null));};exports[_0xf326('0x3b')]=function(_0x31283b,_0x1227d3){var _0x361776={'raw':![],'where':{'id':_0x31283b['params']['id']}},_0x2bab13={};_0x2bab13[_0xf326('0x2a')]=_[_0xf326('0x23')](db[_0xf326('0x20')][_0xf326('0x21')]);_0x2bab13[_0xf326('0x25')]=_[_0xf326('0x23')](_0x31283b['query']);_0x2bab13[_0xf326('0x28')]=_[_0xf326('0x29')](_0x2bab13['model'],_0x2bab13[_0xf326('0x25')]);_0x361776[_0xf326('0x2b')]=_[_0xf326('0x29')](_0x2bab13[_0xf326('0x2a')],qs[_0xf326('0x2c')](_0x31283b['query']['fields']));_0x361776[_0xf326('0x2b')]=_0x361776[_0xf326('0x2b')]['length']?_0x361776['attributes']:_0x2bab13[_0xf326('0x2a')];if(_0x31283b[_0xf326('0x25')][_0xf326('0x37')]){_0x361776['include']=[{'all':!![]}];}_0x361776=_[_0xf326('0x32')]({},_0x361776,_0x31283b[_0xf326('0x3c')]);return db[_0xf326('0x20')][_0xf326('0x3d')](_0x361776)[_0xf326('0x1b')](handleEntityNotFound(_0x1227d3,null))[_0xf326('0x1b')](respondWithResult(_0x1227d3,null))[_0xf326('0x3a')](handleError(_0x1227d3,null));};exports[_0xf326('0x3e')]=function(_0x3df9a8,_0x27ced1){return db[_0xf326('0x20')][_0xf326('0x3e')](_0x3df9a8[_0xf326('0x3f')],{})[_0xf326('0x1b')](respondWithResult(_0x27ced1,0xc9))[_0xf326('0x3a')](handleError(_0x27ced1,null));};exports['update']=function(_0x199f8b,_0x1b0e03){if(_0x199f8b[_0xf326('0x3f')]['id']){delete _0x199f8b[_0xf326('0x3f')]['id'];}return db['VoiceRecording'][_0xf326('0x3d')]({'where':{'id':_0x199f8b[_0xf326('0x40')]['id']}})[_0xf326('0x1b')](handleEntityNotFound(_0x1b0e03,null))[_0xf326('0x1b')](saveUpdates(_0x199f8b['body'],null))[_0xf326('0x1b')](respondWithResult(_0x1b0e03,null))[_0xf326('0x3a')](handleError(_0x1b0e03,null));};exports[_0xf326('0x41')]=function(_0x451ac7,_0x39ba25){return db['VoiceRecording']['find']({'where':{'id':_0x451ac7[_0xf326('0x40')]['id']}})[_0xf326('0x1b')](handleEntityNotFound(_0x39ba25,null))[_0xf326('0x1b')](removeEntity(_0x39ba25,null))['catch'](handleError(_0x39ba25,null));};exports[_0xf326('0x42')]=function(_0x4650db,_0x44eab7){return db['VoiceRecording']['describe']()[_0xf326('0x1b')](respondWithResult(_0x44eab7,null))['catch'](handleError(_0x44eab7,null));};exports[_0xf326('0x43')]=function(_0x554277,_0x458e5f,_0x7ee57){var _0x28c959=require(_0xf326('0x44'));var _0x212594=![];var _0x35d3c8={};if(_0x554277[_0xf326('0x25')]['type']&&_0x554277[_0xf326('0x25')][_0xf326('0x45')]===_0xf326('0x46')){_0x35d3c8['uniqueid']=_0x554277[_0xf326('0x40')]['id'];}else{_0x35d3c8['id']=_0x554277[_0xf326('0x40')]['id'];}return db[_0xf326('0x20')][_0xf326('0x3d')]({'where':_0x35d3c8,'attributes':['id',_0xf326('0x47')],'raw':!![]})['then'](handleEntityNotFound(_0x458e5f,null))[_0xf326('0x1b')](function(_0x21eac7){if(_0x21eac7){var _0x287a97=util[_0xf326('0x24')]('%s.cypher',_0x21eac7[_0xf326('0x47')]);if(fs[_0xf326('0x48')](_0x287a97)){_0x212594=!![];return _0x28c959[_0xf326('0x49')](_0x287a97,_0x21eac7[_0xf326('0x47')],config['secrets']['recording'])[_0xf326('0x1b')](function(){return _0x21eac7;});}return _0x21eac7;}})[_0xf326('0x1b')](function(_0x55ca96){if(_0x55ca96){if(!fs[_0xf326('0x48')](_0x55ca96[_0xf326('0x47')])){throw new db[(_0xf326('0x4a'))][(_0xf326('0x4b'))]('VoiceRecording\x20not\x20found');}if(_0x55ca96[_0xf326('0x4c')]){return _0x458e5f['download'](_0x55ca96['value'],_0x55ca96[_0xf326('0x4c')]+path['extname'](_0x55ca96[_0xf326('0x47')]),function(){if(_0x212594){fs[_0xf326('0x4d')](_0x55ca96[_0xf326('0x47')]);}});}else{return _0x458e5f['download'](_0x55ca96['value'],function(_0x1fd9c9){if(_0x212594){fs[_0xf326('0x4d')](_0x55ca96[_0xf326('0x47')]);}});}}})['catch'](handleError(_0x458e5f,null));};exports[_0xf326('0x4e')]=function(_0x487020,_0xe4a00d,_0x40929c){var _0x131184=require(_0xf326('0x44'));var _0xbd3a01=![];var _0x18dbfc={'$and':[db[_0xf326('0x4f')][_0xf326('0x34')](db[_0xf326('0x4f')]['fn'](_0xf326('0x50'),db[_0xf326('0x4f')][_0xf326('0x51')](_0xf326('0x46'))),_0x487020['query'][_0xf326('0x52')])]};if(_0x487020['query'][_0xf326('0x45')]&&_0x487020[_0xf326('0x25')]['type']===_0xf326('0x46')){_0x18dbfc['$and'][_0xf326('0x53')]({'uniqueid':_0x487020[_0xf326('0x40')]['id']});}else{_0x18dbfc[_0xf326('0x54')][_0xf326('0x53')]({'id':_0x487020[_0xf326('0x40')]['id']});}return db['VoiceRecording']['find']({'where':_0x18dbfc,'attributes':['id',_0xf326('0x47')],'raw':!![]})[_0xf326('0x1b')](handleEntityNotFound(_0xe4a00d,null))[_0xf326('0x1b')](function(_0x21b3cc){if(_0x21b3cc){var _0x1fc586=util['format'](_0xf326('0x55'),_0x21b3cc[_0xf326('0x47')]);if(fs['existsSync'](_0x1fc586)){_0xbd3a01=!![];return _0x131184['decryptFile'](_0x1fc586,_0x21b3cc['value'],config[_0xf326('0x56')][_0xf326('0x57')])[_0xf326('0x1b')](function(){return _0x21b3cc;});}return _0x21b3cc;}})[_0xf326('0x1b')](function(_0x240ce5){if(_0x240ce5){if(!fs[_0xf326('0x48')](_0x240ce5[_0xf326('0x47')])){throw new db['Sequelize'][(_0xf326('0x4b'))](_0xf326('0x58'));}if(_0x240ce5[_0xf326('0x4c')]){return _0xe4a00d[_0xf326('0x43')](_0x240ce5['value'],_0x240ce5[_0xf326('0x4c')]+path['extname'](_0x240ce5['value']),function(){if(_0xbd3a01){fs[_0xf326('0x4d')](_0x240ce5['value']);}});}else{return _0xe4a00d[_0xf326('0x43')](_0x240ce5[_0xf326('0x47')],function(_0x461059){if(_0xbd3a01){fs[_0xf326('0x4d')](_0x240ce5[_0xf326('0x47')]);}});}}})['catch'](handleError(_0xe4a00d,null));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 132c92a..c23889a 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 _0x0219=['moment','bluebird','request-promise','./voiceRecording.attributes','exports','define','VoiceRecording','uniqueid','lodash','../../config/logger','api'];(function(_0xdb21b2,_0x40a356){var _0x570aa5=function(_0x96823c){while(--_0x96823c){_0xdb21b2['push'](_0xdb21b2['shift']());}};_0x570aa5(++_0x40a356);}(_0x0219,0xfa));var _0x9021=function(_0x11a655,_0x36b87b){_0x11a655=_0x11a655-0x0;var _0x15184f=_0x0219[_0x11a655];return _0x15184f;};'use strict';var _=require(_0x9021('0x0'));var util=require('util');var logger=require(_0x9021('0x1'))(_0x9021('0x2'));var moment=require(_0x9021('0x3'));var BPromise=require(_0x9021('0x4'));var rp=require(_0x9021('0x5'));var attributes=require(_0x9021('0x6'));module[_0x9021('0x7')]=function(_0x3d7688,_0x5537b6){return _0x3d7688[_0x9021('0x8')](_0x9021('0x9'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x9021('0xa'),'fields':[_0x9021('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ed6=['lodash','util','../../config/logger','bluebird','request-promise','./voiceRecording.attributes','exports','voice_recordings'];(function(_0x5f44c3,_0x460f76){var _0x577bf7=function(_0x370579){while(--_0x370579){_0x5f44c3['push'](_0x5f44c3['shift']());}};_0x577bf7(++_0x460f76);}(_0x7ed6,0xa0));var _0x67ed=function(_0x2c321a,_0x1273a4){_0x2c321a=_0x2c321a-0x0;var _0x297bcb=_0x7ed6[_0x2c321a];return _0x297bcb;};'use strict';var _=require(_0x67ed('0x0'));var util=require(_0x67ed('0x1'));var logger=require(_0x67ed('0x2'))('api');var moment=require('moment');var BPromise=require(_0x67ed('0x3'));var rp=require(_0x67ed('0x4'));var attributes=require(_0x67ed('0x5'));module[_0x67ed('0x6')]=function(_0x4d8e8f,_0x5470ac){return _0x4d8e8f['define']('VoiceRecording',attributes,{'tableName':_0x67ed('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index dbdff36..7b5ee8d 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 _0x2333=['where','attributes','limit','../../components/encryptor','Setting','findOne','create','body','callRecordingEncryption','existsSync','format','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','options'];(function(_0x50414a,_0x131849){var _0x1b3657=function(_0x18661e){while(--_0x18661e){_0x50414a['push'](_0x50414a['shift']());}};_0x1b3657(++_0x131849);}(_0x2333,0x11a));var _0x3233=function(_0x5e4aa1,_0x375ce0){_0x5e4aa1=_0x5e4aa1-0x0;var _0x192002=_0x2333[_0x5e4aa1];return _0x192002;};'use strict';var _=require(_0x3233('0x0'));var util=require(_0x3233('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3233('0x2'));var fs=require('fs');var db=require(_0x3233('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3233('0x4'))(_0x3233('0x5'));var config=require(_0x3233('0x6'));var jayson=require(_0x3233('0x7'));var client=jayson[_0x3233('0x8')][_0x3233('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4120f6,_0x33a56d,_0x1e93e8){return new BPromise(function(_0x1842a1,_0x1837b6){return client[_0x3233('0xa')](_0x4120f6,_0x1e93e8)[_0x3233('0xb')](function(_0x1fa4f5){logger[_0x3233('0xc')](_0x3233('0xd'),_0x33a56d,_0x3233('0xe'));logger[_0x3233('0xf')](_0x3233('0x10'),_0x33a56d,_0x3233('0xe'),JSON[_0x3233('0x11')](_0x1fa4f5));if(_0x1fa4f5['error']){if(_0x1fa4f5[_0x3233('0x12')][_0x3233('0x13')]===0x1f4){logger[_0x3233('0x12')](_0x3233('0xd'),_0x33a56d,_0x1fa4f5[_0x3233('0x12')][_0x3233('0x14')]);return _0x1837b6(_0x1fa4f5[_0x3233('0x12')][_0x3233('0x14')]);}logger[_0x3233('0x12')](_0x3233('0xd'),_0x33a56d,_0x1fa4f5[_0x3233('0x12')][_0x3233('0x14')]);return _0x1842a1(_0x1fa4f5[_0x3233('0x12')]['message']);}else{logger['info'](_0x3233('0xd'),_0x33a56d,_0x3233('0xe'));_0x1842a1(_0x1fa4f5[_0x3233('0x15')]['message']);}})[_0x3233('0x16')](function(_0x357fbd){logger[_0x3233('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x33a56d,_0x357fbd);_0x1837b6(_0x357fbd);});});}exports[_0x3233('0x17')]=function(_0x425e6f){var _0x55fa30=this;return new Promise(function(_0x38a9c0,_0x58420c){return db[_0x3233('0x18')]['update'](_0x425e6f['body'],{'raw':_0x425e6f['options']?_0x425e6f[_0x3233('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x425e6f[_0x3233('0x19')]?_0x425e6f['options'][_0x3233('0x1a')]||null:null,'attributes':_0x425e6f[_0x3233('0x19')]?_0x425e6f[_0x3233('0x19')][_0x3233('0x1b')]||null:null,'limit':_0x425e6f['options']?_0x425e6f[_0x3233('0x19')][_0x3233('0x1c')]||null:null})[_0x3233('0xb')](function(_0x531cd8){logger[_0x3233('0xc')]('UpdateVoiceRecording',_0x425e6f);logger[_0x3233('0xf')](_0x3233('0x17'),_0x425e6f,JSON[_0x3233('0x11')](_0x531cd8));_0x38a9c0(_0x531cd8);})['catch'](function(_0x3ca20d){logger['error'](_0x3233('0x17'),_0x3ca20d[_0x3233('0x14')],_0x425e6f);_0x58420c(_0x55fa30['error'](0x1f4,_0x3ca20d[_0x3233('0x14')]));});});};exports['CreateVoiceRecording']=function(_0x50871d){var _0x430e8e=this;return new Promise(function(_0x39a345,_0x5d8e63){var _0x276b6=require(_0x3233('0x1d'));var _0x27cec8;return db[_0x3233('0x1e')][_0x3233('0x1f')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x3233('0xb')](function(_0xd4171b){_0x27cec8=_0xd4171b;return db[_0x3233('0x18')][_0x3233('0x20')](_0x50871d[_0x3233('0x21')]);})[_0x3233('0xb')](function(_0x31f0d6){if(_0x27cec8[_0x3233('0x22')]&&fs[_0x3233('0x23')](_0x31f0d6['value'])){var _0x392e56=util[_0x3233('0x24')]('%s.cypher',_0x31f0d6[_0x3233('0x25')]);return _0x276b6[_0x3233('0x26')](_0x31f0d6['value'],_0x392e56,config[_0x3233('0x27')][_0x3233('0x28')])['then'](function(){fs[_0x3233('0x29')](_0x31f0d6[_0x3233('0x25')]);logger['info'](_0x3233('0x2a'));return _0x31f0d6;});}return _0x31f0d6;})[_0x3233('0xb')](function(_0x5412f1){logger['info'](_0x3233('0x2b'),_0x50871d);logger['debug'](_0x3233('0x2b'),_0x50871d,JSON[_0x3233('0x11')](_0x5412f1));_0x39a345(_0x5412f1);})['catch'](function(_0x21a4e6){logger[_0x3233('0x12')](_0x3233('0x2b'),_0x21a4e6[_0x3233('0x14')],_0x50871d);_0x5d8e63(_0x430e8e[_0x3233('0x12')](0x1f4,_0x21a4e6[_0x3233('0x14')]));});});}; \ No newline at end of file +var _0x81a4=['CreateVoiceRecording','../../components/encryptor','Setting','findOne','create','callRecordingEncryption','existsSync','value','encryptFile','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','UpdateVoiceRecording','VoiceRecording','update','options','raw','attributes','limit'];(function(_0x3e6b83,_0x224b71){var _0x599977=function(_0x51b428){while(--_0x51b428){_0x3e6b83['push'](_0x3e6b83['shift']());}};_0x599977(++_0x224b71);}(_0x81a4,0x1a6));var _0x481a=function(_0x490be3,_0xf0fca3){_0x490be3=_0x490be3-0x0;var _0x3f5140=_0x81a4[_0x490be3];return _0x3f5140;};'use strict';var _=require(_0x481a('0x0'));var util=require(_0x481a('0x1'));var moment=require(_0x481a('0x2'));var BPromise=require(_0x481a('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x481a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x481a('0x5'))(_0x481a('0x6'));var config=require(_0x481a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x481a('0x8')][_0x481a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17d40e,_0x14b819,_0x4a5a92){return new BPromise(function(_0x13ed10,_0x13b771){return client[_0x481a('0xa')](_0x17d40e,_0x4a5a92)[_0x481a('0xb')](function(_0x95b28d){logger[_0x481a('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x14b819,_0x481a('0xd'));logger[_0x481a('0xe')](_0x481a('0xf'),_0x14b819,_0x481a('0xd'),JSON[_0x481a('0x10')](_0x95b28d));if(_0x95b28d[_0x481a('0x11')]){if(_0x95b28d[_0x481a('0x11')][_0x481a('0x12')]===0x1f4){logger[_0x481a('0x11')](_0x481a('0x13'),_0x14b819,_0x95b28d['error']['message']);return _0x13b771(_0x95b28d[_0x481a('0x11')][_0x481a('0x14')]);}logger[_0x481a('0x11')](_0x481a('0x13'),_0x14b819,_0x95b28d[_0x481a('0x11')][_0x481a('0x14')]);return _0x13ed10(_0x95b28d['error'][_0x481a('0x14')]);}else{logger['info'](_0x481a('0x13'),_0x14b819,_0x481a('0xd'));_0x13ed10(_0x95b28d[_0x481a('0x15')]['message']);}})['catch'](function(_0x25d2b8){logger[_0x481a('0x11')](_0x481a('0x13'),_0x14b819,_0x25d2b8);_0x13b771(_0x25d2b8);});});}exports[_0x481a('0x16')]=function(_0x263755){var _0x3186e3=this;return new Promise(function(_0xe4e8fe,_0x2e6d4e){return db[_0x481a('0x17')][_0x481a('0x18')](_0x263755['body'],{'raw':_0x263755[_0x481a('0x19')]?_0x263755[_0x481a('0x19')][_0x481a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x263755[_0x481a('0x19')]?_0x263755[_0x481a('0x19')]['where']||null:null,'attributes':_0x263755[_0x481a('0x19')]?_0x263755[_0x481a('0x19')][_0x481a('0x1b')]||null:null,'limit':_0x263755[_0x481a('0x19')]?_0x263755['options'][_0x481a('0x1c')]||null:null})[_0x481a('0xb')](function(_0x44673f){logger[_0x481a('0xc')](_0x481a('0x16'),_0x263755);logger[_0x481a('0xe')](_0x481a('0x16'),_0x263755,JSON[_0x481a('0x10')](_0x44673f));_0xe4e8fe(_0x44673f);})['catch'](function(_0x333866){logger[_0x481a('0x11')]('UpdateVoiceRecording',_0x333866[_0x481a('0x14')],_0x263755);_0x2e6d4e(_0x3186e3['error'](0x1f4,_0x333866[_0x481a('0x14')]));});});};exports[_0x481a('0x1d')]=function(_0x3b36b1){var _0xa86211=this;return new Promise(function(_0x542639,_0x42acf4){var _0x3ecd24=require(_0x481a('0x1e'));var _0x2c978a;return db[_0x481a('0x1f')][_0x481a('0x20')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x481a('0xb')](function(_0x33306a){_0x2c978a=_0x33306a;return db[_0x481a('0x17')][_0x481a('0x21')](_0x3b36b1['body']);})[_0x481a('0xb')](function(_0x39d776){if(_0x2c978a[_0x481a('0x22')]&&fs[_0x481a('0x23')](_0x39d776['value'])){var _0x5071f4=util['format']('%s.cypher',_0x39d776[_0x481a('0x24')]);return _0x3ecd24[_0x481a('0x25')](_0x39d776[_0x481a('0x24')],_0x5071f4,config['secrets'][_0x481a('0x26')])[_0x481a('0xb')](function(){fs[_0x481a('0x27')](_0x39d776['value']);logger[_0x481a('0xc')](_0x481a('0x28'));return _0x39d776;});}return _0x39d776;})['then'](function(_0x586165){logger[_0x481a('0xc')](_0x481a('0x1d'),_0x3b36b1);logger[_0x481a('0xe')](_0x481a('0x1d'),_0x3b36b1,JSON[_0x481a('0x10')](_0x586165));_0x542639(_0x586165);})['catch'](function(_0xba2790){logger[_0x481a('0x11')](_0x481a('0x1d'),_0xba2790[_0x481a('0x14')],_0x3b36b1);_0x42acf4(_0xa86211['error'](0x1f4,_0xba2790['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index cbc5b6f..4a0c18c 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 _0xe923=['get','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller'];(function(_0x2cf83b,_0x18e872){var _0x1b27f2=function(_0x26211d){while(--_0x26211d){_0x2cf83b['push'](_0x2cf83b['shift']());}};_0x1b27f2(++_0x18e872);}(_0xe923,0x8a));var _0x3e92=function(_0x404b9a,_0xca0480){_0x404b9a=_0x404b9a-0x0;var _0x30ba61=_0xe923[_0x404b9a];return _0x30ba61;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0x3e92('0x0'));var router=express[_0x3e92('0x1')]();var auth=require(_0x3e92('0x2'));var interaction=require(_0x3e92('0x3'));var config=require(_0x3e92('0x4'));var controller=require(_0x3e92('0x5'));router[_0x3e92('0x6')]('/',auth[_0x3e92('0x7')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3e92('0x8')]);router[_0x3e92('0x9')]('/',auth[_0x3e92('0x7')](),controller[_0x3e92('0xa')]);router[_0x3e92('0xb')](_0x3e92('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x3e92('0xd')](_0x3e92('0xc'),auth[_0x3e92('0x7')](),controller[_0x3e92('0xe')]);module[_0x3e92('0xf')]=router; \ No newline at end of file +var _0x6b6d=['post','delete','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index','get','/:id','show'];(function(_0x3e1555,_0xd901c2){var _0x14824b=function(_0x5c4482){while(--_0x5c4482){_0x3e1555['push'](_0x3e1555['shift']());}};_0x14824b(++_0xd901c2);}(_0x6b6d,0x183));var _0xd6b6=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x6b6d[_0x11ce46];return _0x368a1e;};'use strict';var multer=require(_0xd6b6('0x0'));var util=require('util');var path=require(_0xd6b6('0x1'));var express=require(_0xd6b6('0x2'));var router=express[_0xd6b6('0x3')]();var auth=require(_0xd6b6('0x4'));var interaction=require(_0xd6b6('0x5'));var config=require(_0xd6b6('0x6'));var controller=require(_0xd6b6('0x7'));router['get']('/',auth[_0xd6b6('0x8')](),controller[_0xd6b6('0x9')]);router[_0xd6b6('0xa')](_0xd6b6('0xb'),auth['isAuthenticated'](),controller[_0xd6b6('0xc')]);router[_0xd6b6('0xd')]('/',auth[_0xd6b6('0x8')](),controller['create']);router['put'](_0xd6b6('0xb'),auth[_0xd6b6('0x8')](),controller['update']);router[_0xd6b6('0xe')](_0xd6b6('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xd6b6('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index c3367f9..68954f4 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 _0xbf22=['ENUM','Yes','moment','exports','blind','attended','STRING'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0xbf22,0xf7));var _0x2bf2=function(_0x5c8bd1,_0x58b059){_0x5c8bd1=_0x5c8bd1-0x0;var _0x178a98=_0xbf22[_0x5c8bd1];return _0x178a98;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2bf2('0x0'));module[_0x2bf2('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2bf2('0x2'),_0x2bf2('0x3'))},'result':{'type':Sequelize[_0x2bf2('0x4')]},'transfererchannel':{'type':Sequelize[_0x2bf2('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x2bf2('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x2bf2('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x2bf2('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x2bf2('0x4')]},'transferercontext':{'type':Sequelize[_0x2bf2('0x4')]},'transfererexten':{'type':Sequelize[_0x2bf2('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x2bf2('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x2bf2('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x2bf2('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x2bf2('0x4')]},'transfereecontext':{'type':Sequelize[_0x2bf2('0x4')]},'transfereeexten':{'type':Sequelize[_0x2bf2('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x2bf2('0x4')]},'isexternal':{'type':Sequelize[_0x2bf2('0x5')](_0x2bf2('0x6'),'No')},'context':{'type':Sequelize[_0x2bf2('0x4')]},'extension':{'type':Sequelize[_0x2bf2('0x4')]}}; \ No newline at end of file +var _0x5bf3=['ENUM','attended','STRING','Yes'];(function(_0x153d85,_0x39073f){var _0x264f6d=function(_0x1a757b){while(--_0x1a757b){_0x153d85['push'](_0x153d85['shift']());}};_0x264f6d(++_0x39073f);}(_0x5bf3,0xec));var _0x35bf=function(_0x10f906,_0x5f40d7){_0x10f906=_0x10f906-0x0;var _0x1bed26=_0x5bf3[_0x10f906];return _0x1bed26;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x35bf('0x0')]('blind',_0x35bf('0x1'))},'result':{'type':Sequelize[_0x35bf('0x2')]},'transfererchannel':{'type':Sequelize[_0x35bf('0x2')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x35bf('0x2')]},'transfererconnectedlinenum':{'type':Sequelize[_0x35bf('0x2')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x35bf('0x2')]},'transferercontext':{'type':Sequelize[_0x35bf('0x2')]},'transfererexten':{'type':Sequelize[_0x35bf('0x2')]},'transfererlinkedid':{'type':Sequelize[_0x35bf('0x2')]},'transfereechannel':{'type':Sequelize[_0x35bf('0x2')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x35bf('0x2')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x35bf('0x2')]},'transfereeconnectedlinename':{'type':Sequelize[_0x35bf('0x2')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x35bf('0x2')]},'transfereeexten':{'type':Sequelize[_0x35bf('0x2')]},'transfereelinkedid':{'type':Sequelize[_0x35bf('0x2')]},'isexternal':{'type':Sequelize['ENUM'](_0x35bf('0x3'),'No')},'context':{'type':Sequelize[_0x35bf('0x2')]},'extension':{'type':Sequelize[_0x35bf('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index ad5e52e..c4106a5 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 _0x8fc6=['fields','hasOwnProperty','order','sort','where','filters','pick','add','day','merge','filter','map','options','include','VoiceTransferReport','rows','catch','show','params','keys','length','includeAll','find','create','body','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','rawAttributes','model','query','dateEnd','dateStart','intersection','attributes'];(function(_0x226c48,_0x11a8bc){var _0x4d9057=function(_0x5aaa5c){while(--_0x5aaa5c){_0x226c48['push'](_0x226c48['shift']());}};_0x4d9057(++_0x11a8bc);}(_0x8fc6,0x172));var _0x68fc=function(_0x5c8fa9,_0x638fc8){_0x5c8fa9=_0x5c8fa9-0x0;var _0x1b8c2e=_0x8fc6[_0x5c8fa9];return _0x1b8c2e;};'use strict';var jsonpatch=require(_0x68fc('0x0'));var rp=require(_0x68fc('0x1'));var moment=require(_0x68fc('0x2'));var BPromise=require(_0x68fc('0x3'));var Mustache=require('mustache');var util=require(_0x68fc('0x4'));var path=require(_0x68fc('0x5'));var sox=require(_0x68fc('0x6'));var csv=require(_0x68fc('0x7'));var ejs=require(_0x68fc('0x8'));var fs=require('fs');var _=require(_0x68fc('0x9'));var squel=require(_0x68fc('0xa'));var crypto=require(_0x68fc('0xb'));var jsforce=require(_0x68fc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x68fc('0x7'));var querystring=require(_0x68fc('0xd'));var Papa=require(_0x68fc('0xe'));var qs=require(_0x68fc('0xf'));var logger=require('../../config/logger')(_0x68fc('0x10'));var utils=require(_0x68fc('0x11'));var config=require(_0x68fc('0x12'));var db=require(_0x68fc('0x13'))['db'];function respondWithStatusCode(_0x5d5b35,_0xd74c9){_0xd74c9=_0xd74c9||0xcc;return function(_0x17bf1f){if(_0x17bf1f){return _0x5d5b35['sendStatus'](_0xd74c9);}return _0x5d5b35['status'](_0xd74c9)[_0x68fc('0x14')]();};}function respondWithResult(_0x423515,_0x2e92e2){_0x2e92e2=_0x2e92e2||0xc8;return function(_0x4eed92){if(_0x4eed92){return _0x423515[_0x68fc('0x15')](_0x2e92e2)[_0x68fc('0x16')](_0x4eed92);}};}function respondWithFilteredResult(_0xa8ec90,_0x1cd530){return function(_0x160afb){if(_0x160afb){var _0x1c022a=_0x160afb[_0x68fc('0x17')],_0x3e8add=_0x1cd530[_0x68fc('0x18')],_0x198221=_0x1cd530['offset']+_0x1cd530[_0x68fc('0x19')],_0x1b15b9;if(_0x198221>=_0x1c022a){_0x198221=_0x1c022a;_0x1b15b9=0xc8;}else{_0x1b15b9=0xce;}_0xa8ec90[_0x68fc('0x15')](_0x1b15b9);return _0xa8ec90['set'](_0x68fc('0x1a'),_0x3e8add+'-'+_0x198221+'/'+_0x1c022a)[_0x68fc('0x16')](_0x160afb);}return null;};}function patchUpdates(_0x2d8e8c){return function(_0x386eaf){try{jsonpatch[_0x68fc('0x1b')](_0x386eaf,_0x2d8e8c,!![]);}catch(_0x5baeca){return BPromise[_0x68fc('0x1c')](_0x5baeca);}return _0x386eaf[_0x68fc('0x1d')]();};}function saveUpdates(_0xb43403,_0x23d628){return function(_0x64e13){if(_0x64e13){return _0x64e13[_0x68fc('0x1e')](_0xb43403)[_0x68fc('0x1f')](function(_0x14b215){return _0x14b215;});}return null;};}function removeEntity(_0x47a450,_0x41f75d){return function(_0x483764){if(_0x483764){return _0x483764['destroy']()['then'](function(){_0x47a450[_0x68fc('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc3846c,_0x337eaf){return function(_0x5286b5){if(!_0x5286b5){_0xc3846c[_0x68fc('0x20')](0x194);}return _0x5286b5;};}function handleError(_0x179d62,_0x203860){_0x203860=_0x203860||0x1f4;return function(_0x3f993a){logger[_0x68fc('0x21')](_0x3f993a[_0x68fc('0x22')]);if(_0x3f993a[_0x68fc('0x23')]){delete _0x3f993a[_0x68fc('0x23')];}_0x179d62[_0x68fc('0x15')](_0x203860)[_0x68fc('0x24')](_0x3f993a);};}exports['index']=function(_0x48b7dd,_0xfea30){var _0x355c32={},_0x1728bf={},_0x3c17df={'count':0x0,'rows':[]};var _0x45fea8=db['VoiceTransferReport'][_0x68fc('0x25')];_0x1728bf[_0x68fc('0x26')]=_['keys'](_0x45fea8);var _0x374693={'dateStart':_0x48b7dd[_0x68fc('0x27')]['dateStart'],'dateEnd':_0x48b7dd[_0x68fc('0x27')][_0x68fc('0x28')]};delete _0x48b7dd[_0x68fc('0x27')][_0x68fc('0x29')];delete _0x48b7dd['query'][_0x68fc('0x28')];_0x1728bf[_0x68fc('0x27')]=_['keys'](_0x48b7dd[_0x68fc('0x27')]);_0x1728bf['filters']=_[_0x68fc('0x2a')](_0x1728bf[_0x68fc('0x26')],_0x1728bf[_0x68fc('0x27')]);_0x355c32[_0x68fc('0x2b')]=_[_0x68fc('0x2a')](_0x1728bf[_0x68fc('0x26')],qs['fields'](_0x48b7dd[_0x68fc('0x27')][_0x68fc('0x2c')]));_0x355c32[_0x68fc('0x2b')]=_0x355c32['attributes']['length']?_0x355c32[_0x68fc('0x2b')]:_0x1728bf['model'];if(!_0x48b7dd[_0x68fc('0x27')][_0x68fc('0x2d')]('nolimit')){_0x355c32[_0x68fc('0x19')]=qs['limit'](_0x48b7dd[_0x68fc('0x27')][_0x68fc('0x19')]);_0x355c32[_0x68fc('0x18')]=qs['offset'](_0x48b7dd['query'][_0x68fc('0x18')]);}_0x355c32[_0x68fc('0x2e')]=qs[_0x68fc('0x2f')](_0x48b7dd[_0x68fc('0x27')]['sort']);_0x355c32[_0x68fc('0x30')]=qs[_0x68fc('0x31')](_[_0x68fc('0x32')](_0x48b7dd[_0x68fc('0x27')],_0x1728bf[_0x68fc('0x31')]));if(_0x374693[_0x68fc('0x29')]){if(_0x374693[_0x68fc('0x28')]){_0x374693[_0x68fc('0x28')]=moment(_0x374693['dateEnd'])[_0x68fc('0x33')](0x1,_0x68fc('0x34'));}else{_0x374693[_0x68fc('0x28')]=moment(_0x374693['dateStart'])['add'](0x1,_0x68fc('0x34'));}_[_0x68fc('0x35')](_0x355c32['where'],{'createdAt':{'$gte':_0x374693[_0x68fc('0x29')],'$lte':_0x374693['dateEnd']}});}if(_0x48b7dd[_0x68fc('0x27')][_0x68fc('0x36')]){_0x355c32['where']=_[_0x68fc('0x35')](_0x355c32[_0x68fc('0x30')],{'$or':_[_0x68fc('0x37')](_0x355c32['attributes'],function(_0x494db8){var _0x289325={};_0x289325[_0x494db8]={'$like':'%'+_0x48b7dd['query'][_0x68fc('0x36')]+'%'};return _0x289325;})});}_0x355c32=_[_0x68fc('0x35')]({},_0x355c32,_0x48b7dd[_0x68fc('0x38')]);var _0x524bae={'where':_0x355c32[_0x68fc('0x30')]};return db['VoiceTransferReport'][_0x68fc('0x17')](_0x524bae)[_0x68fc('0x1f')](function(_0x29c1fa){_0x3c17df[_0x68fc('0x17')]=_0x29c1fa;if(_0x48b7dd[_0x68fc('0x27')]['includeAll']){_0x355c32[_0x68fc('0x39')]=[{'all':!![]}];}return db[_0x68fc('0x3a')]['findAll'](_0x355c32);})[_0x68fc('0x1f')](function(_0x49b7dd){_0x3c17df[_0x68fc('0x3b')]=_0x49b7dd;return _0x3c17df;})[_0x68fc('0x1f')](respondWithFilteredResult(_0xfea30,_0x355c32))[_0x68fc('0x3c')](handleError(_0xfea30,null));};exports[_0x68fc('0x3d')]=function(_0x5b28e8,_0x4d25b2){var _0x21caaf={'raw':!![],'where':{'id':_0x5b28e8[_0x68fc('0x3e')]['id']}},_0x3d0c79={};_0x3d0c79[_0x68fc('0x26')]=_[_0x68fc('0x3f')](db[_0x68fc('0x3a')][_0x68fc('0x25')]);_0x3d0c79[_0x68fc('0x27')]=_[_0x68fc('0x3f')](_0x5b28e8[_0x68fc('0x27')]);_0x3d0c79['filters']=_[_0x68fc('0x2a')](_0x3d0c79[_0x68fc('0x26')],_0x3d0c79[_0x68fc('0x27')]);_0x21caaf[_0x68fc('0x2b')]=_[_0x68fc('0x2a')](_0x3d0c79[_0x68fc('0x26')],qs['fields'](_0x5b28e8[_0x68fc('0x27')][_0x68fc('0x2c')]));_0x21caaf[_0x68fc('0x2b')]=_0x21caaf['attributes'][_0x68fc('0x40')]?_0x21caaf['attributes']:_0x3d0c79[_0x68fc('0x26')];if(_0x5b28e8[_0x68fc('0x27')][_0x68fc('0x41')]){_0x21caaf['include']=[{'all':!![]}];}_0x21caaf=_[_0x68fc('0x35')]({},_0x21caaf,_0x5b28e8[_0x68fc('0x38')]);return db[_0x68fc('0x3a')][_0x68fc('0x42')](_0x21caaf)[_0x68fc('0x1f')](handleEntityNotFound(_0x4d25b2,null))['then'](respondWithResult(_0x4d25b2,null))[_0x68fc('0x3c')](handleError(_0x4d25b2,null));};exports[_0x68fc('0x43')]=function(_0x5b3ae4,_0x4a8fc3){return db[_0x68fc('0x3a')][_0x68fc('0x43')](_0x5b3ae4[_0x68fc('0x44')],{})[_0x68fc('0x1f')](respondWithResult(_0x4a8fc3,0xc9))[_0x68fc('0x3c')](handleError(_0x4a8fc3,null));};exports['update']=function(_0x23b9f5,_0x426f68){if(_0x23b9f5['body']['id']){delete _0x23b9f5[_0x68fc('0x44')]['id'];}return db[_0x68fc('0x3a')][_0x68fc('0x42')]({'where':{'id':_0x23b9f5[_0x68fc('0x3e')]['id']}})[_0x68fc('0x1f')](handleEntityNotFound(_0x426f68,null))['then'](saveUpdates(_0x23b9f5[_0x68fc('0x44')],null))[_0x68fc('0x1f')](respondWithResult(_0x426f68,null))[_0x68fc('0x3c')](handleError(_0x426f68,null));};exports['destroy']=function(_0x5a5c81,_0x42293c){return db[_0x68fc('0x3a')][_0x68fc('0x42')]({'where':{'id':_0x5a5c81[_0x68fc('0x3e')]['id']}})['then'](handleEntityNotFound(_0x42293c,null))[_0x68fc('0x1f')](removeEntity(_0x42293c,null))['catch'](handleError(_0x42293c,null));}; \ No newline at end of file +var _0x9c55=['params','options','find','create','body','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','VoiceTransferReport','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','nolimit','order','where','pick','add','day','merge','filter','map','includeAll','include','findAll','rows','catch','show'];(function(_0x52d4ce,_0xe6cc0d){var _0x29306f=function(_0x44083){while(--_0x44083){_0x52d4ce['push'](_0x52d4ce['shift']());}};_0x29306f(++_0xe6cc0d);}(_0x9c55,0xd4));var _0x59c5=function(_0x9148ba,_0x2cb1b5){_0x9148ba=_0x9148ba-0x0;var _0x355e3b=_0x9c55[_0x9148ba];return _0x355e3b;};'use strict';var jsonpatch=require(_0x59c5('0x0'));var rp=require(_0x59c5('0x1'));var moment=require(_0x59c5('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x59c5('0x3'));var util=require('util');var path=require(_0x59c5('0x4'));var sox=require(_0x59c5('0x5'));var csv=require(_0x59c5('0x6'));var ejs=require(_0x59c5('0x7'));var fs=require('fs');var _=require(_0x59c5('0x8'));var squel=require(_0x59c5('0x9'));var crypto=require(_0x59c5('0xa'));var jsforce=require(_0x59c5('0xb'));var deskjs=require(_0x59c5('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x59c5('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0x59c5('0xe'))(_0x59c5('0xf'));var utils=require(_0x59c5('0x10'));var config=require(_0x59c5('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7bfac,_0x2e5905){_0x2e5905=_0x2e5905||0xcc;return function(_0x211347){if(_0x211347){return _0x7bfac['sendStatus'](_0x2e5905);}return _0x7bfac[_0x59c5('0x12')](_0x2e5905)[_0x59c5('0x13')]();};}function respondWithResult(_0xd114f1,_0x11a2a2){_0x11a2a2=_0x11a2a2||0xc8;return function(_0x13e44d){if(_0x13e44d){return _0xd114f1[_0x59c5('0x12')](_0x11a2a2)[_0x59c5('0x14')](_0x13e44d);}};}function respondWithFilteredResult(_0x5f3b01,_0x48d94f){return function(_0x4b95bc){if(_0x4b95bc){var _0x56409e=_0x4b95bc[_0x59c5('0x15')],_0x3a4df2=_0x48d94f['offset'],_0x15efcf=_0x48d94f[_0x59c5('0x16')]+_0x48d94f[_0x59c5('0x17')],_0x4fbac4;if(_0x15efcf>=_0x56409e){_0x15efcf=_0x56409e;_0x4fbac4=0xc8;}else{_0x4fbac4=0xce;}_0x5f3b01[_0x59c5('0x12')](_0x4fbac4);return _0x5f3b01[_0x59c5('0x18')](_0x59c5('0x19'),_0x3a4df2+'-'+_0x15efcf+'/'+_0x56409e)[_0x59c5('0x14')](_0x4b95bc);}return null;};}function patchUpdates(_0x2812ec){return function(_0x5ed850){try{jsonpatch[_0x59c5('0x1a')](_0x5ed850,_0x2812ec,!![]);}catch(_0x545994){return BPromise[_0x59c5('0x1b')](_0x545994);}return _0x5ed850[_0x59c5('0x1c')]();};}function saveUpdates(_0x347272,_0x5914ba){return function(_0x21f804){if(_0x21f804){return _0x21f804[_0x59c5('0x1d')](_0x347272)[_0x59c5('0x1e')](function(_0x191de0){return _0x191de0;});}return null;};}function removeEntity(_0xb4cf61,_0x2f4456){return function(_0x19d371){if(_0x19d371){return _0x19d371[_0x59c5('0x1f')]()[_0x59c5('0x1e')](function(){_0xb4cf61[_0x59c5('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ab987,_0x137b4e){return function(_0x3977cd){if(!_0x3977cd){_0x1ab987['sendStatus'](0x194);}return _0x3977cd;};}function handleError(_0x548eca,_0x589998){_0x589998=_0x589998||0x1f4;return function(_0x3e1a45){logger[_0x59c5('0x20')](_0x3e1a45[_0x59c5('0x21')]);if(_0x3e1a45[_0x59c5('0x22')]){delete _0x3e1a45[_0x59c5('0x22')];}_0x548eca[_0x59c5('0x12')](_0x589998)[_0x59c5('0x23')](_0x3e1a45);};}exports[_0x59c5('0x24')]=function(_0x330188,_0x2d6238){var _0x45a56f={},_0x5ad4c2={},_0x4a3af3={'count':0x0,'rows':[]};var _0x1b82dd=db[_0x59c5('0x25')][_0x59c5('0x26')];_0x5ad4c2['model']=_[_0x59c5('0x27')](_0x1b82dd);var _0x6530d9={'dateStart':_0x330188[_0x59c5('0x28')][_0x59c5('0x29')],'dateEnd':_0x330188[_0x59c5('0x28')][_0x59c5('0x2a')]};delete _0x330188[_0x59c5('0x28')][_0x59c5('0x29')];delete _0x330188[_0x59c5('0x28')]['dateEnd'];_0x5ad4c2['query']=_[_0x59c5('0x27')](_0x330188[_0x59c5('0x28')]);_0x5ad4c2[_0x59c5('0x2b')]=_[_0x59c5('0x2c')](_0x5ad4c2[_0x59c5('0x2d')],_0x5ad4c2[_0x59c5('0x28')]);_0x45a56f[_0x59c5('0x2e')]=_[_0x59c5('0x2c')](_0x5ad4c2[_0x59c5('0x2d')],qs['fields'](_0x330188[_0x59c5('0x28')][_0x59c5('0x2f')]));_0x45a56f['attributes']=_0x45a56f['attributes'][_0x59c5('0x30')]?_0x45a56f[_0x59c5('0x2e')]:_0x5ad4c2[_0x59c5('0x2d')];if(!_0x330188[_0x59c5('0x28')]['hasOwnProperty'](_0x59c5('0x31'))){_0x45a56f[_0x59c5('0x17')]=qs['limit'](_0x330188[_0x59c5('0x28')][_0x59c5('0x17')]);_0x45a56f[_0x59c5('0x16')]=qs['offset'](_0x330188[_0x59c5('0x28')][_0x59c5('0x16')]);}_0x45a56f[_0x59c5('0x32')]=qs['sort'](_0x330188[_0x59c5('0x28')]['sort']);_0x45a56f[_0x59c5('0x33')]=qs['filters'](_[_0x59c5('0x34')](_0x330188[_0x59c5('0x28')],_0x5ad4c2[_0x59c5('0x2b')]));if(_0x6530d9[_0x59c5('0x29')]){if(_0x6530d9[_0x59c5('0x2a')]){_0x6530d9['dateEnd']=moment(_0x6530d9['dateEnd'])[_0x59c5('0x35')](0x1,_0x59c5('0x36'));}else{_0x6530d9['dateEnd']=moment(_0x6530d9['dateStart'])['add'](0x1,_0x59c5('0x36'));}_[_0x59c5('0x37')](_0x45a56f['where'],{'createdAt':{'$gte':_0x6530d9['dateStart'],'$lte':_0x6530d9[_0x59c5('0x2a')]}});}if(_0x330188[_0x59c5('0x28')][_0x59c5('0x38')]){_0x45a56f[_0x59c5('0x33')]=_[_0x59c5('0x37')](_0x45a56f['where'],{'$or':_[_0x59c5('0x39')](_0x45a56f[_0x59c5('0x2e')],function(_0x5ecb9b){var _0x516a52={};_0x516a52[_0x5ecb9b]={'$like':'%'+_0x330188[_0x59c5('0x28')][_0x59c5('0x38')]+'%'};return _0x516a52;})});}_0x45a56f=_[_0x59c5('0x37')]({},_0x45a56f,_0x330188['options']);var _0x23607d={'where':_0x45a56f[_0x59c5('0x33')]};return db[_0x59c5('0x25')][_0x59c5('0x15')](_0x23607d)[_0x59c5('0x1e')](function(_0x13e594){_0x4a3af3['count']=_0x13e594;if(_0x330188['query'][_0x59c5('0x3a')]){_0x45a56f[_0x59c5('0x3b')]=[{'all':!![]}];}return db[_0x59c5('0x25')][_0x59c5('0x3c')](_0x45a56f);})[_0x59c5('0x1e')](function(_0x432cfb){_0x4a3af3[_0x59c5('0x3d')]=_0x432cfb;return _0x4a3af3;})[_0x59c5('0x1e')](respondWithFilteredResult(_0x2d6238,_0x45a56f))[_0x59c5('0x3e')](handleError(_0x2d6238,null));};exports[_0x59c5('0x3f')]=function(_0x300fe6,_0x67bd43){var _0x28f8ed={'raw':!![],'where':{'id':_0x300fe6[_0x59c5('0x40')]['id']}},_0x529d9e={};_0x529d9e[_0x59c5('0x2d')]=_[_0x59c5('0x27')](db['VoiceTransferReport'][_0x59c5('0x26')]);_0x529d9e['query']=_['keys'](_0x300fe6[_0x59c5('0x28')]);_0x529d9e[_0x59c5('0x2b')]=_[_0x59c5('0x2c')](_0x529d9e['model'],_0x529d9e['query']);_0x28f8ed[_0x59c5('0x2e')]=_[_0x59c5('0x2c')](_0x529d9e[_0x59c5('0x2d')],qs[_0x59c5('0x2f')](_0x300fe6['query'][_0x59c5('0x2f')]));_0x28f8ed[_0x59c5('0x2e')]=_0x28f8ed['attributes'][_0x59c5('0x30')]?_0x28f8ed[_0x59c5('0x2e')]:_0x529d9e['model'];if(_0x300fe6[_0x59c5('0x28')][_0x59c5('0x3a')]){_0x28f8ed[_0x59c5('0x3b')]=[{'all':!![]}];}_0x28f8ed=_[_0x59c5('0x37')]({},_0x28f8ed,_0x300fe6[_0x59c5('0x41')]);return db[_0x59c5('0x25')][_0x59c5('0x42')](_0x28f8ed)[_0x59c5('0x1e')](handleEntityNotFound(_0x67bd43,null))[_0x59c5('0x1e')](respondWithResult(_0x67bd43,null))[_0x59c5('0x3e')](handleError(_0x67bd43,null));};exports[_0x59c5('0x43')]=function(_0x24e231,_0x3d3492){return db[_0x59c5('0x25')]['create'](_0x24e231[_0x59c5('0x44')],{})[_0x59c5('0x1e')](respondWithResult(_0x3d3492,0xc9))['catch'](handleError(_0x3d3492,null));};exports[_0x59c5('0x1d')]=function(_0x3320d9,_0x1af2cd){if(_0x3320d9[_0x59c5('0x44')]['id']){delete _0x3320d9['body']['id'];}return db[_0x59c5('0x25')]['find']({'where':{'id':_0x3320d9[_0x59c5('0x40')]['id']}})[_0x59c5('0x1e')](handleEntityNotFound(_0x1af2cd,null))[_0x59c5('0x1e')](saveUpdates(_0x3320d9[_0x59c5('0x44')],null))[_0x59c5('0x1e')](respondWithResult(_0x1af2cd,null))[_0x59c5('0x3e')](handleError(_0x1af2cd,null));};exports[_0x59c5('0x1f')]=function(_0x51216b,_0x24e80f){return db['VoiceTransferReport'][_0x59c5('0x42')]({'where':{'id':_0x51216b['params']['id']}})['then'](handleEntityNotFound(_0x24e80f,null))[_0x59c5('0x1e')](removeEntity(_0x24e80f,null))[_0x59c5('0x3e')](handleError(_0x24e80f,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 8925045..b252535 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 _0x93c2=['api','bluebird','request-promise','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','lodash','util','../../config/logger'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0x93c2,0xbb));var _0x293c=function(_0xee39eb,_0x1eecdb){_0xee39eb=_0xee39eb-0x0;var _0x4f6498=_0x93c2[_0xee39eb];return _0x4f6498;};'use strict';var _=require(_0x293c('0x0'));var util=require(_0x293c('0x1'));var logger=require(_0x293c('0x2'))(_0x293c('0x3'));var moment=require('moment');var BPromise=require(_0x293c('0x4'));var rp=require(_0x293c('0x5'));var attributes=require(_0x293c('0x6'));module[_0x293c('0x7')]=function(_0x40bc59,_0x1fd632){return _0x40bc59[_0x293c('0x8')](_0x293c('0x9'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4a8=['report_call_transfer','lodash','util','api','moment','request-promise','./voiceTransferReport.attributes','exports','VoiceTransferReport'];(function(_0xfc54ef,_0x3205cf){var _0x3fc759=function(_0x4d56be){while(--_0x4d56be){_0xfc54ef['push'](_0xfc54ef['shift']());}};_0x3fc759(++_0x3205cf);}(_0xc4a8,0x1cc));var _0x8c4a=function(_0x4ac31f,_0x10035b){_0x4ac31f=_0x4ac31f-0x0;var _0x1fbd7e=_0xc4a8[_0x4ac31f];return _0x1fbd7e;};'use strict';var _=require(_0x8c4a('0x0'));var util=require(_0x8c4a('0x1'));var logger=require('../../config/logger')(_0x8c4a('0x2'));var moment=require(_0x8c4a('0x3'));var BPromise=require('bluebird');var rp=require(_0x8c4a('0x4'));var attributes=require(_0x8c4a('0x5'));module[_0x8c4a('0x6')]=function(_0x20eff5,_0x2c0867){return _0x20eff5['define'](_0x8c4a('0x7'),attributes,{'tableName':_0x8c4a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 8ec50d3..d69f3aa 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 _0x316b=['error','code','VoiceTransferReport,\x20%s,\x20%s','message','info','request\x20sent','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1e0de6,_0x5d1459){var _0x5707ff=function(_0x567f3a){while(--_0x567f3a){_0x1e0de6['push'](_0x1e0de6['shift']());}};_0x5707ff(++_0x5d1459);}(_0x316b,0x176));var _0xb316=function(_0x267d8d,_0xe90f65){_0x267d8d=_0x267d8d-0x0;var _0x11a98f=_0x316b[_0x267d8d];return _0x11a98f;};'use strict';var _=require(_0xb316('0x0'));var util=require(_0xb316('0x1'));var moment=require(_0xb316('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0xb316('0x3'))['db'];var utils=require(_0xb316('0x4'));var logger=require(_0xb316('0x5'))(_0xb316('0x6'));var config=require(_0xb316('0x7'));var jayson=require(_0xb316('0x8'));var client=jayson[_0xb316('0x9')][_0xb316('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8a338c,_0x5d3db6,_0xd872c1){return new BPromise(function(_0x12f335,_0x3fb500){return client[_0xb316('0xb')](_0x8a338c,_0xd872c1)[_0xb316('0xc')](function(_0x59b772){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x5d3db6,'request\x20sent');logger[_0xb316('0xd')](_0xb316('0xe'),_0x5d3db6,'request\x20sent',JSON[_0xb316('0xf')](_0x59b772));if(_0x59b772[_0xb316('0x10')]){if(_0x59b772[_0xb316('0x10')][_0xb316('0x11')]===0x1f4){logger['error'](_0xb316('0x12'),_0x5d3db6,_0x59b772['error']['message']);return _0x3fb500(_0x59b772[_0xb316('0x10')][_0xb316('0x13')]);}logger['error'](_0xb316('0x12'),_0x5d3db6,_0x59b772[_0xb316('0x10')][_0xb316('0x13')]);return _0x12f335(_0x59b772['error'][_0xb316('0x13')]);}else{logger[_0xb316('0x14')](_0xb316('0x12'),_0x5d3db6,_0xb316('0x15'));_0x12f335(_0x59b772[_0xb316('0x16')][_0xb316('0x13')]);}})[_0xb316('0x17')](function(_0x3888e9){logger[_0xb316('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x5d3db6,_0x3888e9);_0x3fb500(_0x3888e9);});});}exports[_0xb316('0x18')]=function(_0xff37da){var _0x2e5f63=this;return new Promise(function(_0x366577,_0xff352f){return db[_0xb316('0x19')][_0xb316('0x1a')](_0xff37da[_0xb316('0x1b')],{'raw':_0xff37da['options']?_0xff37da[_0xb316('0x1c')][_0xb316('0x1d')]===undefined?!![]:![]:!![]})[_0xb316('0xc')](function(_0x2ac958){logger[_0xb316('0x14')](_0xb316('0x18'),_0xff37da);logger[_0xb316('0xd')]('CreateVoiceTransferReport',_0xff37da,JSON[_0xb316('0xf')](_0x2ac958));_0x366577(_0x2ac958);})[_0xb316('0x17')](function(_0x157615){logger['error'](_0xb316('0x18'),_0x157615[_0xb316('0x13')],_0xff37da);_0xff352f(_0x2e5f63['error'](0x1f4,_0x157615[_0xb316('0x13')]));});});}; \ No newline at end of file +var _0xbfd1=['result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0xcae773,_0xe70cdc){var _0x1e9217=function(_0x4b86cf){while(--_0x4b86cf){_0xcae773['push'](_0xcae773['shift']());}};_0x1e9217(++_0xe70cdc);}(_0xbfd1,0x14b));var _0x1bfd=function(_0x202c61,_0x3673e0){_0x202c61=_0x202c61-0x0;var _0x540691=_0xbfd1[_0x202c61];return _0x540691;};'use strict';var _=require(_0x1bfd('0x0'));var util=require('util');var moment=require(_0x1bfd('0x1'));var BPromise=require('bluebird');var rs=require(_0x1bfd('0x2'));var fs=require('fs');var db=require(_0x1bfd('0x3'))['db'];var utils=require(_0x1bfd('0x4'));var logger=require(_0x1bfd('0x5'))(_0x1bfd('0x6'));var config=require(_0x1bfd('0x7'));var jayson=require(_0x1bfd('0x8'));var client=jayson['client'][_0x1bfd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x141587,_0x4ee063,_0x2d2c74){return new BPromise(function(_0x3569c8,_0x1593ed){return client[_0x1bfd('0xa')](_0x141587,_0x2d2c74)[_0x1bfd('0xb')](function(_0x5e2ad3){logger[_0x1bfd('0xc')](_0x1bfd('0xd'),_0x4ee063,_0x1bfd('0xe'));logger[_0x1bfd('0xf')](_0x1bfd('0x10'),_0x4ee063,'request\x20sent',JSON[_0x1bfd('0x11')](_0x5e2ad3));if(_0x5e2ad3[_0x1bfd('0x12')]){if(_0x5e2ad3['error']['code']===0x1f4){logger[_0x1bfd('0x12')](_0x1bfd('0xd'),_0x4ee063,_0x5e2ad3['error'][_0x1bfd('0x13')]);return _0x1593ed(_0x5e2ad3['error'][_0x1bfd('0x13')]);}logger[_0x1bfd('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x4ee063,_0x5e2ad3[_0x1bfd('0x12')][_0x1bfd('0x13')]);return _0x3569c8(_0x5e2ad3[_0x1bfd('0x12')][_0x1bfd('0x13')]);}else{logger[_0x1bfd('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x4ee063,_0x1bfd('0xe'));_0x3569c8(_0x5e2ad3[_0x1bfd('0x14')][_0x1bfd('0x13')]);}})[_0x1bfd('0x15')](function(_0x49ef53){logger[_0x1bfd('0x12')](_0x1bfd('0xd'),_0x4ee063,_0x49ef53);_0x1593ed(_0x49ef53);});});}exports[_0x1bfd('0x16')]=function(_0x54eb7c){var _0x1a3954=this;return new Promise(function(_0x3859db,_0x4994f0){return db[_0x1bfd('0x17')]['create'](_0x54eb7c[_0x1bfd('0x18')],{'raw':_0x54eb7c[_0x1bfd('0x19')]?_0x54eb7c[_0x1bfd('0x19')][_0x1bfd('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x859aa9){logger['info'](_0x1bfd('0x16'),_0x54eb7c);logger['debug']('CreateVoiceTransferReport',_0x54eb7c,JSON[_0x1bfd('0x11')](_0x859aa9));_0x3859db(_0x859aa9);})[_0x1bfd('0x15')](function(_0x3a8f84){logger[_0x1bfd('0x12')](_0x1bfd('0x16'),_0x3a8f84[_0x1bfd('0x13')],_0x54eb7c);_0x4994f0(_0x1a3954[_0x1bfd('0x12')](0x1f4,_0x3a8f84['message']));});});}; \ No newline at end of file diff --git a/server/app.js b/server/app.js index 49f01cc..0bffda6 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb6b8=['default','./config/license','error','exit','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','sequelize','sync','then','info','start','Online\x20apps:','map','filter','online','status','join','None','seedDB','./config/seedDB'];(function(_0x5f1d51,_0x3c21a5){var _0x1e5e4b=function(_0xd1cd6c){while(--_0xd1cd6c){_0x5f1d51['push'](_0x5f1d51['shift']());}};_0x1e5e4b(++_0x3c21a5);}(_0xb6b8,0xe5));var _0x8b6b=function(_0x4ef4aa,_0x3cc5b3){_0x4ef4aa=_0x4ef4aa-0x0;var _0x1433b3=_0xb6b8[_0x4ef4aa];return _0x1433b3;};'use strict';var _=require('lodash');var mysqldb=require('./mysqldb');var rpc=require(_0x8b6b('0x0'));var config=require(_0x8b6b('0x1'));var logger=require(_0x8b6b('0x2'))(_0x8b6b('0x3'));var pm2=require(_0x8b6b('0x4'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x8b6b('0x5'));var chat=require(_0x8b6b('0x6'));function main(){return mysqldb['db'][_0x8b6b('0x7')][_0x8b6b('0x8')]()[_0x8b6b('0x9')](function(){return rpc['listen']();})[_0x8b6b('0x9')](function(_0x608857){logger[_0x8b6b('0xa')](_0x608857);return chat[_0x8b6b('0xb')]();})['then'](function(){return schedule[_0x8b6b('0xb')]();})['then'](function(_0x3a9115){logger[_0x8b6b('0xa')](_0x3a9115);return pm2[_0x8b6b('0xb')](pm2Config);})[_0x8b6b('0x9')](function(_0x9b8c6e){logger[_0x8b6b('0xa')](_0x8b6b('0xc'),_[_0x8b6b('0xd')](_[_0x8b6b('0xe')](_0x9b8c6e,{'status':_0x8b6b('0xf')}),'name')['join']());logger[_0x8b6b('0xa')]('Offline\x20apps:',_[_0x8b6b('0xd')](_[_0x8b6b('0xe')](_0x9b8c6e,function(_0x202b16){return _0x202b16[_0x8b6b('0x10')]!==_0x8b6b('0xf');}),'name')[_0x8b6b('0x11')]()||_0x8b6b('0x12'));config[_0x8b6b('0x13')]&&require(_0x8b6b('0x14'))[_0x8b6b('0x15')]();require(_0x8b6b('0x16'))[_0x8b6b('0x15')]();})['catch'](function(_0x27b818){logger[_0x8b6b('0x17')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x27b818);process[_0x8b6b('0x18')](0x1);});}main(); \ No newline at end of file +var _0x491f=['info','start','Online\x20apps:','online','name','Offline\x20apps:','filter','status','join','None','seedDB','./config/seedDB','default','catch','error','./mysqldb','./rpc','./config/environment','app','./config/pm2/config','./config/schedule','sequelize','sync','then','listen'];(function(_0x4dd479,_0x26d87a){var _0x1b6807=function(_0x2bec19){while(--_0x2bec19){_0x4dd479['push'](_0x4dd479['shift']());}};_0x1b6807(++_0x26d87a);}(_0x491f,0x1b8));var _0xf491=function(_0x1735f3,_0x56a029){_0x1735f3=_0x1735f3-0x0;var _0x4c5a16=_0x491f[_0x1735f3];return _0x4c5a16;};'use strict';var _=require('lodash');var mysqldb=require(_0xf491('0x0'));var rpc=require(_0xf491('0x1'));var config=require(_0xf491('0x2'));var logger=require('./config/logger')(_0xf491('0x3'));var pm2=require('./config/pm2');var pm2Config=require(_0xf491('0x4'));var schedule=require(_0xf491('0x5'));var chat=require('./config/schedule/chat');function main(){return mysqldb['db'][_0xf491('0x6')][_0xf491('0x7')]()[_0xf491('0x8')](function(){return rpc[_0xf491('0x9')]();})[_0xf491('0x8')](function(_0x155141){logger[_0xf491('0xa')](_0x155141);return chat[_0xf491('0xb')]();})[_0xf491('0x8')](function(){return schedule[_0xf491('0xb')]();})['then'](function(_0x583d44){logger['info'](_0x583d44);return pm2[_0xf491('0xb')](pm2Config);})[_0xf491('0x8')](function(_0x945e52){logger[_0xf491('0xa')](_0xf491('0xc'),_['map'](_['filter'](_0x945e52,{'status':_0xf491('0xd')}),_0xf491('0xe'))['join']());logger[_0xf491('0xa')](_0xf491('0xf'),_['map'](_[_0xf491('0x10')](_0x945e52,function(_0x5e14e8){return _0x5e14e8[_0xf491('0x11')]!=='online';}),_0xf491('0xe'))[_0xf491('0x12')]()||_0xf491('0x13'));config[_0xf491('0x14')]&&require(_0xf491('0x15'))[_0xf491('0x16')]();require('./config/license')[_0xf491('0x16')]();})[_0xf491('0x17')](function(_0x25e79c){logger[_0xf491('0x18')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x25e79c);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 3898009..4147241 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 _0xbe37=['authorization','startsWith','name','authenticate','Bearer','status','User','find','User\x20not\x20found.','User\x20object\x20not\x20found.','isAuthenticated','../../config/license/util','getLicense','canUpdate','sign','signToken','Required\x20role\x20needs\x20to\x20be\x20set','indexOf','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','motion.user','stringify','pick','redirect','/dashboards/general','../../mysqldb','lodash','jsonwebtoken','express-jwt','basic-auth','ipaddr.js','secrets','role','fullname','internal','userpic','permissions','voicePause','chatPause','mailPause','smsPause','pauseType','showWebBar','phoneBarRemoteControlPort','phoneBarRemoteControl','use','user','ChatInteraction','params','disposition','then','closed','unmanaged','json','Forbidden.','catch','headers'];(function(_0x3e2489,_0x41d9dd){var _0x2254ce=function(_0x227e46){while(--_0x227e46){_0x3e2489['push'](_0x3e2489['shift']());}};_0x2254ce(++_0x41d9dd);}(_0xbe37,0x107));var _0x7be3=function(_0x3c3416,_0x427c0a){_0x3c3416=_0x3c3416-0x0;var _0x1b6fbf=_0xbe37[_0x3c3416];return _0x1b6fbf;};'use strict';var db=require(_0x7be3('0x0'))['db'];var config=require('../../config/environment');var _=require(_0x7be3('0x1'));var jwt=require(_0x7be3('0x2'));var expressJwt=require(_0x7be3('0x3'));var compose=require('composable-middleware');var basicAuth=require(_0x7be3('0x4'));var ipaddr=require(_0x7be3('0x5'));var validateJwt=expressJwt({'secret':config[_0x7be3('0x6')]['session']});var userAttributes=['id',_0x7be3('0x7'),_0x7be3('0x8'),'name',_0x7be3('0x9'),'email',_0x7be3('0xa'),_0x7be3('0xb'),_0x7be3('0xc'),_0x7be3('0xd'),_0x7be3('0xe'),'faxPause',_0x7be3('0xf'),'openchannelPause',_0x7be3('0x10'),_0x7be3('0x11'),_0x7be3('0x12'),_0x7be3('0x13')];exports['isChatInteractionAuthorized']=function(){return isAuthenticated(!![])[_0x7be3('0x14')](function(_0x33bb2a,_0x21e8d8,_0x4414bb){if(_0x33bb2a[_0x7be3('0x15')]){_0x4414bb();}else{return db[_0x7be3('0x16')]['findOne']({'where':{'id':_0x33bb2a[_0x7be3('0x17')]['id']},'attributes':['id','closed',_0x7be3('0x18')],'raw':!![]})[_0x7be3('0x19')](function(_0x36c05b){if(_0x36c05b&&_0x36c05b[_0x7be3('0x1a')]){return _0x21e8d8['status'](_0x36c05b[_0x7be3('0x18')]===_0x7be3('0x1b')?0x195:0x193)[_0x7be3('0x1c')]({'message':_0x36c05b[_0x7be3('0x18')]==='unmanaged'?'Unmanaged.':_0x7be3('0x1d')});}else{_0x4414bb();}})[_0x7be3('0x1e')](function(_0x1b5d6b){_0x4414bb(_0x1b5d6b);});}});};function isAuthenticated(_0x269ef6){return compose()[_0x7be3('0x14')](function(_0x2ab041,_0x154c5c,_0x476a81){if(_0x2ab041[_0x7be3('0x1f')][_0x7be3('0x20')]){if(_[_0x7be3('0x21')](_0x2ab041['headers'][_0x7be3('0x20')],'Basic')){var _0x484d4a=basicAuth(_0x2ab041);db['User']['find']({'where':{'name':_0x484d4a[_0x7be3('0x22')]}})[_0x7be3('0x19')](function(_0x2bc1d8){if(!_0x2bc1d8||!_0x2bc1d8[_0x7be3('0x23')](_0x484d4a['pass'])){return _0x154c5c['status'](0x191)[_0x7be3('0x1c')]({'message':'Wrong\x20credentials.'});}_0x2ab041['user']={'id':_0x2bc1d8['id']};_0x476a81();})[_0x7be3('0x1e')](function(_0x46d17c){_0x476a81(_0x46d17c);});}else if(_[_0x7be3('0x21')](_0x2ab041[_0x7be3('0x1f')][_0x7be3('0x20')],_0x7be3('0x24'))){validateJwt(_0x2ab041,_0x154c5c,_0x476a81);}}else{if(_0x269ef6){_0x476a81();}else{return _0x154c5c[_0x7be3('0x25')](0x191)['json']({'message':'Unknown\x20authorization\x20format.'});}}})['use'](function(_0x458f90,_0x4ed24b,_0x3b0d22){if(_0x458f90[_0x7be3('0x15')]){db[_0x7be3('0x26')][_0x7be3('0x27')]({'where':{'id':_0x458f90[_0x7be3('0x15')]['id']},'attributes':userAttributes})['then'](function(_0x4ce638){if(!_0x4ce638){return _0x4ed24b[_0x7be3('0x25')](0x194)[_0x7be3('0x1c')]({'message':_0x7be3('0x28')});}_0x458f90[_0x7be3('0x15')]=_0x4ce638;_0x3b0d22();})['catch'](function(_0x7aea66){_0x3b0d22(_0x7aea66);});}else if(_0x269ef6){_0x3b0d22();}else{return _0x4ed24b['status'](0x194)[_0x7be3('0x1c')]({'message':_0x7be3('0x29')});}});}exports[_0x7be3('0x2a')]=isAuthenticated;function canUpdate(){return compose()[_0x7be3('0x14')](function(_0x57801f,_0x2111b5,_0x25720c){return require(_0x7be3('0x2b'))[_0x7be3('0x2c')]()['then'](function(_0x104af0){if(_0x104af0['update']){_0x25720c();}else{return _0x2111b5[_0x7be3('0x25')](0x193)[_0x7be3('0x1c')]({'message':'Forbidden'});}})[_0x7be3('0x1e')](function(_0x1cf1e2){_0x25720c(_0x1cf1e2);});});}exports[_0x7be3('0x2d')]=canUpdate;function signToken(_0xae4f00,_0x3915f5){return jwt[_0x7be3('0x2e')]({'id':_0xae4f00,'role':_0x3915f5},config[_0x7be3('0x6')]['session'],{'expiresIn':0x15180});}exports[_0x7be3('0x2f')]=signToken;exports['hasRole']=function(_0x4d59d3){if(!_0x4d59d3){throw new Error(_0x7be3('0x30'));}return compose()[_0x7be3('0x14')](isAuthenticated())[_0x7be3('0x14')](function meetsRequirements(_0x1c4307,_0x46bbcb,_0x230721){if(config['userRoles'][_0x7be3('0x31')](_0x1c4307[_0x7be3('0x15')][_0x7be3('0x7')])>=config['userRoles'][_0x7be3('0x31')](_0x4d59d3)){return _0x230721();}else{return _0x46bbcb['status'](0x193)['json']({'message':'Forbidden'});}});};exports[_0x7be3('0x32')]=function(_0xc40022,_0x426f4e){if(!_0xc40022[_0x7be3('0x15')]){return _0x426f4e[_0x7be3('0x25')](0x194)[_0x7be3('0x1c')]({'message':_0x7be3('0x33')});}var _0x30e7c0=signToken(_0xc40022[_0x7be3('0x15')]['id'],_0xc40022[_0x7be3('0x15')]['role']);_0x426f4e[_0x7be3('0x34')](_0x7be3('0x35'),_0x30e7c0);_0x426f4e[_0x7be3('0x34')](_0x7be3('0x36'),JSON[_0x7be3('0x37')](_[_0x7be3('0x38')](_0xc40022[_0x7be3('0x15')],userAttributes)));_0x426f4e[_0x7be3('0x39')](_0x7be3('0x3a'));}; \ No newline at end of file +var _0x9524=['catch','startsWith','headers','authorization','User','find','authenticate','pass','Bearer','User\x20object\x20not\x20found.','isAuthenticated','../../config/license/util','getLicense','update','Forbidden','canUpdate','session','signToken','hasRole','Required\x20role\x20needs\x20to\x20be\x20set','userRoles','indexOf','role','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','motion.user','pick','redirect','../../mysqldb','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','ipaddr.js','secrets','fullname','name','internal','email','userpic','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','phoneBarRemoteControlPort','phoneBarRemoteControl','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Forbidden.'];(function(_0x5a42ff,_0x468d51){var _0x4ee411=function(_0x48440b){while(--_0x48440b){_0x5a42ff['push'](_0x5a42ff['shift']());}};_0x4ee411(++_0x468d51);}(_0x9524,0x1de));var _0x4952=function(_0x2c5fe5,_0x13bf2d){_0x2c5fe5=_0x2c5fe5-0x0;var _0x2ca05e=_0x9524[_0x2c5fe5];return _0x2ca05e;};'use strict';var db=require(_0x4952('0x0'))['db'];var config=require('../../config/environment');var _=require(_0x4952('0x1'));var jwt=require(_0x4952('0x2'));var expressJwt=require(_0x4952('0x3'));var compose=require(_0x4952('0x4'));var basicAuth=require(_0x4952('0x5'));var ipaddr=require(_0x4952('0x6'));var validateJwt=expressJwt({'secret':config[_0x4952('0x7')]['session']});var userAttributes=['id','role',_0x4952('0x8'),_0x4952('0x9'),_0x4952('0xa'),_0x4952('0xb'),_0x4952('0xc'),'permissions',_0x4952('0xd'),_0x4952('0xe'),_0x4952('0xf'),_0x4952('0x10'),_0x4952('0x11'),_0x4952('0x12'),_0x4952('0x13'),'showWebBar',_0x4952('0x14'),_0x4952('0x15')];exports['isChatInteractionAuthorized']=function(){return isAuthenticated(!![])[_0x4952('0x16')](function(_0x311cb0,_0x5ecc59,_0x8b695b){if(_0x311cb0[_0x4952('0x17')]){_0x8b695b();}else{return db[_0x4952('0x18')][_0x4952('0x19')]({'where':{'id':_0x311cb0[_0x4952('0x1a')]['id']},'attributes':['id',_0x4952('0x1b'),_0x4952('0x1c')],'raw':!![]})[_0x4952('0x1d')](function(_0x286a47){if(_0x286a47&&_0x286a47[_0x4952('0x1b')]){return _0x5ecc59[_0x4952('0x1e')](_0x286a47['disposition']===_0x4952('0x1f')?0x195:0x193)[_0x4952('0x20')]({'message':_0x286a47[_0x4952('0x1c')]==='unmanaged'?'Unmanaged.':_0x4952('0x21')});}else{_0x8b695b();}})[_0x4952('0x22')](function(_0x137a3d){_0x8b695b(_0x137a3d);});}});};function isAuthenticated(_0x1281a0){return compose()['use'](function(_0x442beb,_0x54d307,_0x59a20a){if(_0x442beb['headers']['authorization']){if(_[_0x4952('0x23')](_0x442beb[_0x4952('0x24')][_0x4952('0x25')],'Basic')){var _0x19f14f=basicAuth(_0x442beb);db[_0x4952('0x26')][_0x4952('0x27')]({'where':{'name':_0x19f14f[_0x4952('0x9')]}})[_0x4952('0x1d')](function(_0x4f60f5){if(!_0x4f60f5||!_0x4f60f5[_0x4952('0x28')](_0x19f14f[_0x4952('0x29')])){return _0x54d307[_0x4952('0x1e')](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x442beb[_0x4952('0x17')]={'id':_0x4f60f5['id']};_0x59a20a();})[_0x4952('0x22')](function(_0x2d3bce){_0x59a20a(_0x2d3bce);});}else if(_[_0x4952('0x23')](_0x442beb['headers']['authorization'],_0x4952('0x2a'))){validateJwt(_0x442beb,_0x54d307,_0x59a20a);}}else{if(_0x1281a0){_0x59a20a();}else{return _0x54d307['status'](0x191)[_0x4952('0x20')]({'message':'Unknown\x20authorization\x20format.'});}}})['use'](function(_0x3aa9aa,_0x576a3a,_0x38d697){if(_0x3aa9aa[_0x4952('0x17')]){db[_0x4952('0x26')][_0x4952('0x27')]({'where':{'id':_0x3aa9aa[_0x4952('0x17')]['id']},'attributes':userAttributes})[_0x4952('0x1d')](function(_0x4ff0d0){if(!_0x4ff0d0){return _0x576a3a[_0x4952('0x1e')](0x194)[_0x4952('0x20')]({'message':'User\x20not\x20found.'});}_0x3aa9aa['user']=_0x4ff0d0;_0x38d697();})[_0x4952('0x22')](function(_0xab6211){_0x38d697(_0xab6211);});}else if(_0x1281a0){_0x38d697();}else{return _0x576a3a[_0x4952('0x1e')](0x194)[_0x4952('0x20')]({'message':_0x4952('0x2b')});}});}exports[_0x4952('0x2c')]=isAuthenticated;function canUpdate(){return compose()[_0x4952('0x16')](function(_0xc2cbd6,_0x26cab5,_0xdd74b1){return require(_0x4952('0x2d'))[_0x4952('0x2e')]()[_0x4952('0x1d')](function(_0x7b285f){if(_0x7b285f[_0x4952('0x2f')]){_0xdd74b1();}else{return _0x26cab5[_0x4952('0x1e')](0x193)[_0x4952('0x20')]({'message':_0x4952('0x30')});}})[_0x4952('0x22')](function(_0x32053b){_0xdd74b1(_0x32053b);});});}exports[_0x4952('0x31')]=canUpdate;function signToken(_0x315ae7,_0x454714){return jwt['sign']({'id':_0x315ae7,'role':_0x454714},config[_0x4952('0x7')][_0x4952('0x32')],{'expiresIn':0x15180});}exports[_0x4952('0x33')]=signToken;exports[_0x4952('0x34')]=function(_0xbc386c){if(!_0xbc386c){throw new Error(_0x4952('0x35'));}return compose()['use'](isAuthenticated())['use'](function meetsRequirements(_0x296d66,_0x595ac6,_0x175154){if(config[_0x4952('0x36')][_0x4952('0x37')](_0x296d66[_0x4952('0x17')][_0x4952('0x38')])>=config[_0x4952('0x36')][_0x4952('0x37')](_0xbc386c)){return _0x175154();}else{return _0x595ac6[_0x4952('0x1e')](0x193)[_0x4952('0x20')]({'message':_0x4952('0x30')});}});};exports[_0x4952('0x39')]=function(_0x33e47f,_0x294e0f){if(!_0x33e47f[_0x4952('0x17')]){return _0x294e0f[_0x4952('0x1e')](0x194)[_0x4952('0x20')]({'message':_0x4952('0x3a')});}var _0x381033=signToken(_0x33e47f[_0x4952('0x17')]['id'],_0x33e47f['user'][_0x4952('0x38')]);_0x294e0f[_0x4952('0x3b')](_0x4952('0x3c'),_0x381033);_0x294e0f['cookie'](_0x4952('0x3d'),JSON['stringify'](_[_0x4952('0x3e')](_0x33e47f[_0x4952('0x17')],userAttributes)));_0x294e0f[_0x4952('0x3f')]('/dashboards/general');}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 6651194..9637af1 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 _0xa219=['binary','write','end','final','close','decryptFile','createWriteStream','createDecipher','unlink','crypto','bluebird','aes192','hasOwnProperty','createReadStream','createCipher','algorithm','data','update'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xa219,0x1dd));var _0x9a21=function(_0x4d08b8,_0x34c445){_0x4d08b8=_0x4d08b8-0x0;var _0x70214a=_0xa219[_0x4d08b8];return _0x70214a;};'use strict';var crypto=require(_0x9a21('0x0'));var fs=require('fs');var BPromise=require(_0x9a21('0x1'));var defaultOptions={'algorithm':_0x9a21('0x2')};function combineOptions(_0x75e8d0){var _0x23303b={};for(var _0x660372 in defaultOptions){if(defaultOptions[_0x9a21('0x3')](_0x660372)){_0x23303b[_0x660372]=defaultOptions[_0x660372];}}if(_0x75e8d0){for(var _0x796326 in _0x75e8d0){if(_0x75e8d0[_0x9a21('0x3')](_0x796326)){_0x23303b[_0x796326]=_0x75e8d0[_0x796326];}}}return _0x23303b;}exports['encryptFile']=function(_0x34cd83,_0x3d5e8d,_0x532136,_0x2b317f){return new BPromise(function(_0x3dc55b,_0x5f09e9){_0x2b317f=combineOptions(_0x2b317f);var _0x500c40=new Buffer(_0x532136);var _0x4dd5ef=fs[_0x9a21('0x4')](_0x34cd83);var _0x2583d0=fs['createWriteStream'](_0x3d5e8d);var _0x5c5fae=crypto[_0x9a21('0x5')](_0x2b317f[_0x9a21('0x6')],_0x500c40);_0x4dd5ef['on'](_0x9a21('0x7'),function(_0x287253){var _0x2e2278=new Buffer(_0x5c5fae[_0x9a21('0x8')](_0x287253),_0x9a21('0x9'));_0x2583d0[_0x9a21('0xa')](_0x2e2278);});_0x4dd5ef['on'](_0x9a21('0xb'),function(){try{var _0x520f6a=new Buffer(_0x5c5fae[_0x9a21('0xc')](_0x9a21('0x9')),_0x9a21('0x9'));_0x2583d0[_0x9a21('0xa')](_0x520f6a);_0x2583d0[_0x9a21('0xb')]();_0x2583d0['on'](_0x9a21('0xd'),function(){return _0x3dc55b(_0x3d5e8d);});}catch(_0x5706d8){fs['unlink'](_0x3d5e8d);return _0x5f09e9(_0x5706d8);}});});};exports[_0x9a21('0xe')]=function(_0x14eb8c,_0x1d69c4,_0x2b3a5e,_0x36ff0f){return new BPromise(function(_0x4093a8,_0x30533d){_0x36ff0f=combineOptions(_0x36ff0f);var _0x368720=new Buffer(_0x2b3a5e);var _0x30f0bc=fs[_0x9a21('0x4')](_0x14eb8c);var _0x6b0682=fs[_0x9a21('0xf')](_0x1d69c4);var _0x4474fe=crypto[_0x9a21('0x10')](_0x36ff0f['algorithm'],_0x368720);_0x30f0bc['on'](_0x9a21('0x7'),function(_0x5e6d11){var _0x10cd6c=new Buffer(_0x4474fe[_0x9a21('0x8')](_0x5e6d11),_0x9a21('0x9'));_0x6b0682[_0x9a21('0xa')](_0x10cd6c);});_0x30f0bc['on'](_0x9a21('0xb'),function(){try{var _0x34bd2b=new Buffer(_0x4474fe[_0x9a21('0xc')]('binary'),_0x9a21('0x9'));_0x6b0682[_0x9a21('0xa')](_0x34bd2b);_0x6b0682[_0x9a21('0xb')]();_0x6b0682['on'](_0x9a21('0xd'),function(){return _0x4093a8(_0x1d69c4);});}catch(_0x2d4d0c){fs[_0x9a21('0x11')](_0x1d69c4);return _0x30533d(_0x2d4d0c);}});});}; \ No newline at end of file +var _0x703c=['decryptFile','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','update','binary','write','end','final','close','unlink'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x703c,0x121));var _0xc703=function(_0x532b5b,_0x151024){_0x532b5b=_0x532b5b-0x0;var _0x5f55c8=_0x703c[_0x532b5b];return _0x5f55c8;};'use strict';var crypto=require(_0xc703('0x0'));var fs=require('fs');var BPromise=require(_0xc703('0x1'));var defaultOptions={'algorithm':_0xc703('0x2')};function combineOptions(_0x566e96){var _0x5cf930={};for(var _0x407c6b in defaultOptions){if(defaultOptions['hasOwnProperty'](_0x407c6b)){_0x5cf930[_0x407c6b]=defaultOptions[_0x407c6b];}}if(_0x566e96){for(var _0xc71338 in _0x566e96){if(_0x566e96[_0xc703('0x3')](_0xc71338)){_0x5cf930[_0xc71338]=_0x566e96[_0xc71338];}}}return _0x5cf930;}exports[_0xc703('0x4')]=function(_0xc28714,_0x43dc9e,_0x4cf58d,_0x49e1e4){return new BPromise(function(_0x1d3496,_0x597c92){_0x49e1e4=combineOptions(_0x49e1e4);var _0x3316d7=new Buffer(_0x4cf58d);var _0x574495=fs[_0xc703('0x5')](_0xc28714);var _0x4e38d4=fs[_0xc703('0x6')](_0x43dc9e);var _0x280d99=crypto[_0xc703('0x7')](_0x49e1e4[_0xc703('0x8')],_0x3316d7);_0x574495['on'](_0xc703('0x9'),function(_0x2023b5){var _0x55292d=new Buffer(_0x280d99[_0xc703('0xa')](_0x2023b5),_0xc703('0xb'));_0x4e38d4[_0xc703('0xc')](_0x55292d);});_0x574495['on'](_0xc703('0xd'),function(){try{var _0x4bb6a9=new Buffer(_0x280d99[_0xc703('0xe')](_0xc703('0xb')),'binary');_0x4e38d4[_0xc703('0xc')](_0x4bb6a9);_0x4e38d4['end']();_0x4e38d4['on'](_0xc703('0xf'),function(){return _0x1d3496(_0x43dc9e);});}catch(_0x36cb65){fs[_0xc703('0x10')](_0x43dc9e);return _0x597c92(_0x36cb65);}});});};exports[_0xc703('0x11')]=function(_0xbecac,_0x2a5eac,_0xedd330,_0x49e532){return new BPromise(function(_0x52824b,_0x241e54){_0x49e532=combineOptions(_0x49e532);var _0x35d48e=new Buffer(_0xedd330);var _0x5167a7=fs[_0xc703('0x5')](_0xbecac);var _0x16ca42=fs[_0xc703('0x6')](_0x2a5eac);var _0x4ae5dc=crypto['createDecipher'](_0x49e532['algorithm'],_0x35d48e);_0x5167a7['on']('data',function(_0x492e8f){var _0x355e2a=new Buffer(_0x4ae5dc[_0xc703('0xa')](_0x492e8f),_0xc703('0xb'));_0x16ca42[_0xc703('0xc')](_0x355e2a);});_0x5167a7['on'](_0xc703('0xd'),function(){try{var _0x3928d8=new Buffer(_0x4ae5dc[_0xc703('0xe')](_0xc703('0xb')),_0xc703('0xb'));_0x16ca42[_0xc703('0xc')](_0x3928d8);_0x16ca42[_0xc703('0xd')]();_0x16ca42['on']('close',function(){return _0x52824b(_0x2a5eac);});}catch(_0x29e578){fs[_0xc703('0x10')](_0x2a5eac);return _0x241e54(_0x29e578);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index f06fc60..240a014 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(_0x2815,_0x5f3c49){var _0x42d012=function(_0x2288ad){while(--_0x2288ad){_0x2815['push'](_0x2815['shift']());}};_0x42d012(++_0x5f3c49);}(_0x814b,0x1a2));var _0xb814=function(_0x199b1f,_0x4ed849){_0x199b1f=_0x199b1f-0x0;var _0x267ac9=_0x814b[_0x199b1f];return _0x267ac9;};'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 _0x9957=['splitSizeCsv','then','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','Empty','length','num','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','existsSync','mkdirSync','join','each','push','%s%d.%s','csv','%s.%s','writeFileSync','zip','catch','error','Error','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','argv','savename','AnalyticExtractedReport','Setting','find','split'];(function(_0x233274,_0x3b0a40){var _0x399413=function(_0x56dce2){while(--_0x56dce2){_0x233274['push'](_0x233274['shift']());}};_0x399413(++_0x3b0a40);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var util=require(_0x7995('0x0'));var path=require(_0x7995('0x1'));var _=require(_0x7995('0x2'));var csv=require(_0x7995('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x7995('0x4'));var rimraf=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var dbH=require(_0x7995('0x6'))['dbH'];var EXTRACTED_REPORT_ID=Number(process[_0x7995('0x7')][0x2]);var QUERY=process[_0x7995('0x7')][0x3];var PATH=process[_0x7995('0x7')][0x4];function analyticExtractedReport(_0x219534,_0xbda126){var _0x326741={'status':_0x219534};var _0x4996ca={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xbda126){_0x326741[_0x7995('0x8')]=_0xbda126;}return db[_0x7995('0x9')]['update'](_0x326741,_0x4996ca);}function main(){var _0xa2e5f0=0x1388;var _0x3116fb;return db[_0x7995('0xa')][_0x7995('0xb')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7995('0xc'),_0x7995('0xd')]})[_0x7995('0xe')](function(_0x524f7b){if(_0x524f7b){_0x3116fb=_0x524f7b;_0xa2e5f0=_0x3116fb[_0x7995('0xd')]||0x1388;}})[_0x7995('0xe')](function(){return dbH['sequelize'][_0x7995('0xf')](util[_0x7995('0x10')](_0x7995('0x11'),QUERY),{'type':dbH[_0x7995('0x12')][_0x7995('0x13')][_0x7995('0x14')]});})[_0x7995('0xe')](function(_0x4cc004){if(!_0x4cc004[0x0]['num']){return analyticExtractedReport(_0x7995('0x15'));}var _0x2233dd=[];var _0x24b5bb=0x0;var _0x321ae8=!![];if(_0x4cc004&&_0x4cc004[_0x7995('0x16')]){var _0x1a5310=_0x4cc004[0x0][_0x7995('0x17')]%(_0x24b5bb+_0xa2e5f0);if(_0x3116fb[_0x7995('0xc')]){for(;_0x321ae8;_0x24b5bb+=_0xa2e5f0,_0x1a5310=_0x4cc004[0x0]['num']%(_0x24b5bb+_0xa2e5f0)){if(_0x1a5310==0x0||_0x1a5310==_0x4cc004[0x0][_0x7995('0x17')]){_0x321ae8=![];}_0x2233dd['push'](dbH[_0x7995('0x12')][_0x7995('0xf')](util[_0x7995('0x10')](_0x7995('0x18'),QUERY,_0xa2e5f0,_0x24b5bb),{'type':dbH[_0x7995('0x12')][_0x7995('0x13')]['SELECT']}));}}else{_0x2233dd['push'](dbH[_0x7995('0x12')]['query'](QUERY,{'type':dbH['sequelize'][_0x7995('0x13')][_0x7995('0x14')]}));}}var _0x4cbe10=path[_0x7995('0x19')](PATH);var _0x51f276=path['basename'](PATH,_0x7995('0x1a'));var _0x327b1f=_0x3116fb[_0x7995('0xc')]&&_0x2233dd[_0x7995('0x16')]>0x1;var _0x460924=[];if(!fs[_0x7995('0x1b')](path['join'](_0x4cbe10,_0x51f276))&&_0x327b1f){fs[_0x7995('0x1c')](path[_0x7995('0x1d')](_0x4cbe10,_0x51f276));}return BPromise[_0x7995('0x1e')](_0x2233dd,function(_0x285437){_0x460924[_0x7995('0x1f')](_0x285437);})[_0x7995('0xe')](function(){for(var _0x475351=0x0;_0x475351<_0x460924[_0x7995('0x16')];_0x475351+=0x1){var _0x59405a;var _0x39df42=_0x460924[_0x475351];if(_0x327b1f){_0x59405a=path[_0x7995('0x1d')](_0x4cbe10,_0x51f276,util[_0x7995('0x10')](_0x7995('0x20'),_0x51f276,_0x475351,_0x7995('0x21')));}else{_0x59405a=path[_0x7995('0x1d')](_0x4cbe10,util['format'](_0x7995('0x22'),_0x51f276,'csv'));}fs[_0x7995('0x23')](_0x59405a,csv(_0x39df42));}})[_0x7995('0xe')](function(){if(_0x327b1f){zipdir(path[_0x7995('0x1d')](_0x4cbe10,_0x51f276),{'saveTo':path[_0x7995('0x1d')](_0x4cbe10,util[_0x7995('0x10')]('%s.%s',_0x51f276,_0x7995('0x24')))},function(_0x514445,_0x456a28){});rimraf(path[_0x7995('0x1d')](_0x4cbe10,_0x51f276),function(){});}})[_0x7995('0xe')](function(){return analyticExtractedReport('Completed',_0x327b1f?util['format']('%s.%s',_0x51f276,_0x327b1f?_0x7995('0x24'):_0x7995('0x21')):null);});})[_0x7995('0x25')](function(_0x2b874d){console[_0x7995('0x26')](_0x2b874d);return analyticExtractedReport(_0x7995('0x27'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 4fa36d3..f40bf5c 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 _0x2707=['Empty','dirname','basename','.pdf','find','split','splitSizePdf','then','length','num','push','sequelize','format','QueryTypes','SELECT','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','landscape','header','black','body','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','error','log','err','end','zip','Completed','AnalyticExtractedReport','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error','lodash','bluebird','path','pdfmake/src/printer','zip-dir','../../mysqldb','argv','savename','update','hasOwnProperty','tableHeader'];(function(_0x14477e,_0x44d4da){var _0x5d4a05=function(_0x5e0fa3){while(--_0x5e0fa3){_0x14477e['push'](_0x14477e['shift']());}};_0x5d4a05(++_0x44d4da);}(_0x2707,0x65));var _0x7270=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0x2707[_0x2f45ea];return _0x485a84;};'use strict';var _=require(_0x7270('0x0'));var fs=require('fs');var BPromise=require(_0x7270('0x1'));var util=require('util');var path=require(_0x7270('0x2'));var moment=require('moment');var PdfPrinter=require(_0x7270('0x3'));var zipdir=require(_0x7270('0x4'));var rimraf=require('rimraf');var db=require(_0x7270('0x5'))['db'];var dbH=require('../../mysqldb')['dbH'];var EXTRACTED_REPORT_ID=Number(process[_0x7270('0x6')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x7270('0x6')][0x4];var NAME=process[_0x7270('0x6')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var _extractedReport;function analyticExtractedReport(_0x1d3e3a,_0x2287d3){var _0x3fed28={'status':_0x1d3e3a};var _0x406169={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2287d3){_0x3fed28[_0x7270('0x7')]=_0x2287d3;}return db['AnalyticExtractedReport'][_0x7270('0x8')](_0x3fed28,_0x406169);}function getHeader(_0x1efb41){var _0x289604=[];for(var _0x46df3c in _0x1efb41){if(_0x1efb41[_0x7270('0x9')](_0x46df3c)){_0x289604['push']({'text':_0x46df3c,'style':_0x7270('0xa')});}}return _0x289604;}function extractReport(_0x496ea6){var _0x21b14a=0x1388;var _0x1833d9;if(!_0x496ea6[0x0]['num']){return analyticExtractedReport(_0x7270('0xb'));}var _0x2e02d0=[];var _0x4b4742=0x0;var _0x5d516c=!![];var _0x535e85=path[_0x7270('0xc')](PATH);var _0x423afd=path[_0x7270('0xd')](PATH,_0x7270('0xe'));var _0x3905ca=![];var _0xd909fa=[];return db['Setting'][_0x7270('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7270('0x10'),_0x7270('0x11')]})[_0x7270('0x12')](function(_0x3155aa){if(_0x3155aa){_0x1833d9=_0x3155aa;_0x21b14a=_0x1833d9[_0x7270('0x11')]||0x3e8;}})['then'](function(){if(_0x496ea6&&_0x496ea6[_0x7270('0x13')]){var _0x3877ee=_0x496ea6[0x0][_0x7270('0x14')]%(_0x4b4742+_0x21b14a);if(_0x1833d9[_0x7270('0x10')]){for(;_0x5d516c;_0x4b4742+=_0x21b14a,_0x3877ee=_0x496ea6[0x0]['num']%(_0x4b4742+_0x21b14a)){if(_0x3877ee==0x0||_0x3877ee==_0x496ea6[0x0][_0x7270('0x14')]){_0x5d516c=![];}_0x2e02d0[_0x7270('0x15')](dbH[_0x7270('0x16')]['query'](util[_0x7270('0x17')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x21b14a,_0x4b4742),{'type':dbH[_0x7270('0x16')][_0x7270('0x18')][_0x7270('0x19')]}));}}else{_0x2e02d0['push'](dbH[_0x7270('0x16')]['query'](QUERY,{'type':dbH['sequelize'][_0x7270('0x18')][_0x7270('0x19')]}));}}_0x3905ca=_0x1833d9[_0x7270('0x10')]&&_0x2e02d0[_0x7270('0x13')]>0x1;if(!fs['existsSync'](path[_0x7270('0x1a')](_0x535e85,_0x423afd))&&_0x3905ca){fs[_0x7270('0x1b')](path[_0x7270('0x1a')](_0x535e85,_0x423afd));}return BPromise[_0x7270('0x1c')](_0x2e02d0,function(_0x29f4ba){_0xd909fa['push'](_0x29f4ba);});})[_0x7270('0x12')](function(){return BPromise['each'](_0x2e02d0,function(_0xe85636,_0x2f2147){var _0x5e4839;var _0x1bdc68=util[_0x7270('0x17')](_0x7270('0x1d'),NAME,_extractedReport['name'],moment(_extractedReport[_0x7270('0x1e')])[_0x7270('0x17')](FORMAT),moment(_extractedReport[_0x7270('0x1f')])[_0x7270('0x17')](FORMAT));var _0x1d4f50={'pageSize':'A4','pageOrientation':_0x7270('0x20'),'content':[{'text':_0x1bdc68,'style':_0x7270('0x21')}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x7270('0x22')}}};var _0x2a3bc1={'headerRows':0x1,'body':[]};_0x2a3bc1[_0x7270('0x23')][_0x7270('0x15')](getHeader(_0xe85636[0x0]));var _0x57ac12;for(var _0x42855c=0x0;_0x42855c<_0xe85636[_0x7270('0x13')];_0x42855c+=0x1){_0x57ac12=[];for(var _0x5c0680 in _0xe85636[_0x42855c]){if(_0xe85636[_0x42855c][_0x7270('0x9')](_0x5c0680)){_0x57ac12[_0x7270('0x15')](_0xe85636[_0x42855c][_0x5c0680]?_[_0x7270('0x24')](_0xe85636[_0x42855c][_0x5c0680]):'');}}_0x2a3bc1[_0x7270('0x23')]['push'](_0x57ac12);}_0x1d4f50[_0x7270('0x25')][_0x7270('0x15')]({'table':_0x2a3bc1});return new BPromise(function(_0x55c672,_0x173613){var _0x348e82=new PdfPrinter({'Roboto':{'normal':__dirname+_0x7270('0x26'),'bold':__dirname+_0x7270('0x27'),'italics':__dirname+'/fonts/Roboto-Italic.ttf','bolditalics':__dirname+'/fonts/Roboto-MediumItalic.ttf'}});var _0x4512fb=_0x348e82[_0x7270('0x28')](_0x1d4f50);if(_0x3905ca){_0x5e4839=path[_0x7270('0x1a')](_0x535e85,_0x423afd,util[_0x7270('0x17')]('%s%d.%s',_0x423afd,_0x2f2147,_0x7270('0x29')));}else{_0x5e4839=path[_0x7270('0x1a')](_0x535e85,util[_0x7270('0x17')](_0x7270('0x2a'),_0x423afd,_0x7270('0x29')));}var _0x3638b1=_0x4512fb[_0x7270('0x2b')](fs[_0x7270('0x2c')](_0x5e4839));_0x3638b1['on'](_0x7270('0x2d'),function(){_0x55c672();});_0x3638b1['on'](_0x7270('0x2e'),function(_0x478003){console[_0x7270('0x2f')](_0x7270('0x30'),_0x478003);_0x173613(_0x478003);});_0x4512fb[_0x7270('0x31')]();});});})['then'](function(){if(_0x3905ca){return new BPromise(function(_0x568e8c,_0x2b5e0a){zipdir(path[_0x7270('0x1a')](_0x535e85,_0x423afd),{'saveTo':path[_0x7270('0x1a')](_0x535e85,util[_0x7270('0x17')]('%s.%s',_0x423afd,_0x7270('0x32')))},function(_0x394bba){if(_0x394bba){_0x2b5e0a(_0x394bba);}else{_0x568e8c();}});});}})[_0x7270('0x12')](function(){if(_0x3905ca){rimraf(path[_0x7270('0x1a')](_0x535e85,_0x423afd),function(){});}})[_0x7270('0x12')](function(){return analyticExtractedReport(_0x7270('0x33'),_0x3905ca?util[_0x7270('0x17')](_0x7270('0x2a'),_0x423afd,_0x3905ca?'zip':_0x7270('0x29')):null);});}function main(){return db[_0x7270('0x34')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x7270('0x12')](function(_0x200b27){_extractedReport=_0x200b27;return dbH[_0x7270('0x16')]['query'](util[_0x7270('0x17')](_0x7270('0x35'),QUERY),{'type':dbH[_0x7270('0x16')][_0x7270('0x18')][_0x7270('0x19')]});})['then'](extractReport)[_0x7270('0x36')](function(_0x6f1530){console['error'](_0x6f1530);return analyticExtractedReport(_0x7270('0x37'));});}main(); \ No newline at end of file +var _0x2900=['startDate','endDate','landscape','header','black','body','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','%s%d.%s','%s.%s','pdf','pipe','createWriteStream','finish','error','err','end','Completed','zip','catch','Error','lodash','bluebird','util','moment','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','dbH','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','hasOwnProperty','push','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','num','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','existsSync','join','each','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name'];(function(_0x4573c2,_0x17b63e){var _0x52f89e=function(_0xaa2b21){while(--_0xaa2b21){_0x4573c2['push'](_0x4573c2['shift']());}};_0x52f89e(++_0x17b63e);}(_0x2900,0x108));var _0x0290=function(_0x5e709a,_0x1d7975){_0x5e709a=_0x5e709a-0x0;var _0x57401a=_0x2900[_0x5e709a];return _0x57401a;};'use strict';var _=require(_0x0290('0x0'));var fs=require('fs');var BPromise=require(_0x0290('0x1'));var util=require(_0x0290('0x2'));var path=require('path');var moment=require(_0x0290('0x3'));var PdfPrinter=require(_0x0290('0x4'));var zipdir=require(_0x0290('0x5'));var rimraf=require(_0x0290('0x6'));var db=require(_0x0290('0x7'))['db'];var dbH=require('../../mysqldb')[_0x0290('0x8')];var EXTRACTED_REPORT_ID=Number(process[_0x0290('0x9')][0x2]);var QUERY=process[_0x0290('0x9')][0x3];var PATH=process[_0x0290('0x9')][0x4];var NAME=process[_0x0290('0x9')][0x5];var FORMAT=_0x0290('0xa');var _extractedReport;function analyticExtractedReport(_0x2b04d2,_0x4c6644){var _0xb5bad9={'status':_0x2b04d2};var _0x19708b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4c6644){_0xb5bad9[_0x0290('0xb')]=_0x4c6644;}return db['AnalyticExtractedReport'][_0x0290('0xc')](_0xb5bad9,_0x19708b);}function getHeader(_0xe3e876){var _0x4c8e7f=[];for(var _0x43066a in _0xe3e876){if(_0xe3e876[_0x0290('0xd')](_0x43066a)){_0x4c8e7f[_0x0290('0xe')]({'text':_0x43066a,'style':'tableHeader'});}}return _0x4c8e7f;}function extractReport(_0x34e3ed){var _0x356e1e=0x1388;var _0x5391fd;if(!_0x34e3ed[0x0]['num']){return analyticExtractedReport('Empty');}var _0x1e2a38=[];var _0x143ed5=0x0;var _0x119bcb=!![];var _0x503b51=path[_0x0290('0xf')](PATH);var _0xd2bc55=path[_0x0290('0x10')](PATH,_0x0290('0x11'));var _0x19408b=![];var _0x453289=[];return db[_0x0290('0x12')][_0x0290('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0290('0x14'),_0x0290('0x15')]})[_0x0290('0x16')](function(_0x37958e){if(_0x37958e){_0x5391fd=_0x37958e;_0x356e1e=_0x5391fd[_0x0290('0x15')]||0x3e8;}})[_0x0290('0x16')](function(){if(_0x34e3ed&&_0x34e3ed[_0x0290('0x17')]){var _0x1d34df=_0x34e3ed[0x0][_0x0290('0x18')]%(_0x143ed5+_0x356e1e);if(_0x5391fd['split']){for(;_0x119bcb;_0x143ed5+=_0x356e1e,_0x1d34df=_0x34e3ed[0x0][_0x0290('0x18')]%(_0x143ed5+_0x356e1e)){if(_0x1d34df==0x0||_0x1d34df==_0x34e3ed[0x0][_0x0290('0x18')]){_0x119bcb=![];}_0x1e2a38[_0x0290('0xe')](dbH['sequelize'][_0x0290('0x19')](util['format'](_0x0290('0x1a'),QUERY,_0x356e1e,_0x143ed5),{'type':dbH[_0x0290('0x1b')][_0x0290('0x1c')][_0x0290('0x1d')]}));}}else{_0x1e2a38['push'](dbH[_0x0290('0x1b')][_0x0290('0x19')](QUERY,{'type':dbH[_0x0290('0x1b')][_0x0290('0x1c')]['SELECT']}));}}_0x19408b=_0x5391fd[_0x0290('0x14')]&&_0x1e2a38[_0x0290('0x17')]>0x1;if(!fs[_0x0290('0x1e')](path[_0x0290('0x1f')](_0x503b51,_0xd2bc55))&&_0x19408b){fs['mkdirSync'](path['join'](_0x503b51,_0xd2bc55));}return BPromise['each'](_0x1e2a38,function(_0x59774d){_0x453289[_0x0290('0xe')](_0x59774d);});})[_0x0290('0x16')](function(){return BPromise[_0x0290('0x20')](_0x1e2a38,function(_0x32cd35,_0x569385){var _0x297020;var _0x5b65f4=util[_0x0290('0x21')](_0x0290('0x22'),NAME,_extractedReport[_0x0290('0x23')],moment(_extractedReport[_0x0290('0x24')])[_0x0290('0x21')](FORMAT),moment(_extractedReport[_0x0290('0x25')])['format'](FORMAT));var _0x38ed0d={'pageSize':'A4','pageOrientation':_0x0290('0x26'),'content':[{'text':_0x5b65f4,'style':_0x0290('0x27')}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0290('0x28')}}};var _0x9e428f={'headerRows':0x1,'body':[]};_0x9e428f[_0x0290('0x29')][_0x0290('0xe')](getHeader(_0x32cd35[0x0]));var _0x3db65c;for(var _0x5633b7=0x0;_0x5633b7<_0x32cd35[_0x0290('0x17')];_0x5633b7+=0x1){_0x3db65c=[];for(var _0x1201fe in _0x32cd35[_0x5633b7]){if(_0x32cd35[_0x5633b7][_0x0290('0xd')](_0x1201fe)){_0x3db65c[_0x0290('0xe')](_0x32cd35[_0x5633b7][_0x1201fe]?_[_0x0290('0x2a')](_0x32cd35[_0x5633b7][_0x1201fe]):'');}}_0x9e428f[_0x0290('0x29')][_0x0290('0xe')](_0x3db65c);}_0x38ed0d[_0x0290('0x2b')]['push']({'table':_0x9e428f});return new BPromise(function(_0xf4238b,_0x3b0fe9){var _0x378353=new PdfPrinter({'Roboto':{'normal':__dirname+_0x0290('0x2c'),'bold':__dirname+_0x0290('0x2d'),'italics':__dirname+_0x0290('0x2e'),'bolditalics':__dirname+'/fonts/Roboto-MediumItalic.ttf'}});var _0x130f03=_0x378353['createPdfKitDocument'](_0x38ed0d);if(_0x19408b){_0x297020=path[_0x0290('0x1f')](_0x503b51,_0xd2bc55,util['format'](_0x0290('0x2f'),_0xd2bc55,_0x569385,'pdf'));}else{_0x297020=path[_0x0290('0x1f')](_0x503b51,util[_0x0290('0x21')](_0x0290('0x30'),_0xd2bc55,_0x0290('0x31')));}var _0x17b3dc=_0x130f03[_0x0290('0x32')](fs[_0x0290('0x33')](_0x297020));_0x17b3dc['on'](_0x0290('0x34'),function(){_0xf4238b();});_0x17b3dc['on'](_0x0290('0x35'),function(_0x541914){console['log'](_0x0290('0x36'),_0x541914);_0x3b0fe9(_0x541914);});_0x130f03[_0x0290('0x37')]();});});})[_0x0290('0x16')](function(){if(_0x19408b){return new BPromise(function(_0x59a4a7,_0x293e38){zipdir(path[_0x0290('0x1f')](_0x503b51,_0xd2bc55),{'saveTo':path['join'](_0x503b51,util[_0x0290('0x21')](_0x0290('0x30'),_0xd2bc55,'zip'))},function(_0x4b0be2){if(_0x4b0be2){_0x293e38(_0x4b0be2);}else{_0x59a4a7();}});});}})[_0x0290('0x16')](function(){if(_0x19408b){rimraf(path[_0x0290('0x1f')](_0x503b51,_0xd2bc55),function(){});}})[_0x0290('0x16')](function(){return analyticExtractedReport(_0x0290('0x38'),_0x19408b?util[_0x0290('0x21')](_0x0290('0x30'),_0xd2bc55,_0x19408b?_0x0290('0x39'):_0x0290('0x31')):null);});}function main(){return db['AnalyticExtractedReport']['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x0290('0x16')](function(_0x2cff2b){_extractedReport=_0x2cff2b;return dbH['sequelize'][_0x0290('0x19')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x0290('0x1c')]['SELECT']});})[_0x0290('0x16')](extractReport)[_0x0290('0x3a')](function(_0x38ac01){console[_0x0290('0x35')](_0x38ac01);return analyticExtractedReport(_0x0290('0x3b'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 14b6bfa..98c0471 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 _0x76f8=['util','path','lodash','json2xls','rimraf','../../mysqldb','dbH','argv','update','Setting','find','split','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','%s\x20limit\x20%d\x20OFFSET\x20%d','push','basename','join','mkdirSync','each','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','Completed','zip','catch','Error'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x76f8,0x1c8));var _0x876f=function(_0x50ad97,_0x5d6047){_0x50ad97=_0x50ad97-0x0;var _0x149ac2=_0x76f8[_0x50ad97];return _0x149ac2;};'use strict';var util=require(_0x876f('0x0'));var path=require(_0x876f('0x1'));var _=require(_0x876f('0x2'));var fs=require('fs');var json2xls=require(_0x876f('0x3'));var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x876f('0x4'));var db=require(_0x876f('0x5'))['db'];var dbH=require(_0x876f('0x5'))[_0x876f('0x6')];var EXTRACTED_REPORT_ID=Number(process[_0x876f('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x876f('0x7')][0x4];function analyticExtractedReport(_0x267552,_0x5cbdef){var _0x53416c={'status':_0x267552};var _0x3c62f1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5cbdef){_0x53416c['savename']=_0x5cbdef;}return db['AnalyticExtractedReport'][_0x876f('0x8')](_0x53416c,_0x3c62f1);}function main(){var _0x4935b2=0x1388;var _0x4b7599;return db[_0x876f('0x9')][_0x876f('0xa')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x876f('0xb'),_0x876f('0xc')]})['then'](function(_0x145dc4){if(_0x145dc4){_0x4b7599=_0x145dc4;_0x4935b2=_0x4b7599[_0x876f('0xc')]||0x1388;}})[_0x876f('0xd')](function(){return dbH[_0x876f('0xe')][_0x876f('0xf')](util[_0x876f('0x10')](_0x876f('0x11'),QUERY),{'type':dbH[_0x876f('0xe')][_0x876f('0x12')][_0x876f('0x13')]});})[_0x876f('0xd')](function(_0x1c5fd3){if(!_0x1c5fd3[0x0][_0x876f('0x14')]){return analyticExtractedReport(_0x876f('0x15'));}var _0x658d57=[];var _0x3e9874=0x0;var _0x3f1e17=!![];if(_0x4b7599['split']){if(_0x1c5fd3&&_0x1c5fd3[_0x876f('0x16')]){var _0x2d33b0=_0x1c5fd3[0x0]['num']%(_0x3e9874+_0x4935b2);for(;_0x3f1e17;_0x3e9874+=_0x4935b2,_0x2d33b0=_0x1c5fd3[0x0]['num']%(_0x3e9874+_0x4935b2)){if(_0x2d33b0==0x0||_0x2d33b0==_0x1c5fd3[0x0][_0x876f('0x14')]){_0x3f1e17=![];}_0x658d57['push'](dbH[_0x876f('0xe')][_0x876f('0xf')](util[_0x876f('0x10')](_0x876f('0x17'),QUERY,_0x4935b2,_0x3e9874),{'type':dbH[_0x876f('0xe')][_0x876f('0x12')][_0x876f('0x13')]}));}}}else{_0x658d57[_0x876f('0x18')](dbH[_0x876f('0xe')][_0x876f('0xf')](QUERY,{'type':dbH[_0x876f('0xe')][_0x876f('0x12')]['SELECT']}));}var _0x37c953=path['dirname'](PATH);var _0x328e32=path[_0x876f('0x19')](PATH,'.xlsx');var _0x56e3f5=_0x4b7599['split']&&_0x658d57[_0x876f('0x16')]>0x1;var _0x1a18fe=[];if(!fs['existsSync'](path[_0x876f('0x1a')](_0x37c953,_0x328e32))&&_0x56e3f5){fs[_0x876f('0x1b')](path[_0x876f('0x1a')](_0x37c953,_0x328e32));}return BPromise[_0x876f('0x1c')](_0x658d57,function(_0x38c93e){_0x1a18fe[_0x876f('0x18')](_0x38c93e);})[_0x876f('0xd')](function(){for(var _0x3b50b8=0x0;_0x3b50b8<_0x1a18fe[_0x876f('0x16')];_0x3b50b8+=0x1){var _0x7a349e;var _0x46d027=_0x1a18fe[_0x3b50b8];if(_0x56e3f5){_0x7a349e=path[_0x876f('0x1a')](_0x37c953,_0x328e32,util['format'](_0x876f('0x1d'),_0x328e32,_0x3b50b8,'xlsx'));}else{_0x7a349e=path[_0x876f('0x1a')](_0x37c953,util[_0x876f('0x10')](_0x876f('0x1e'),_0x328e32,_0x876f('0x1f')));}fs[_0x876f('0x20')](_0x7a349e,json2xls(_0x46d027),_0x876f('0x21'));}})['then'](function(){if(_0x56e3f5){zipdir(path[_0x876f('0x1a')](_0x37c953,_0x328e32),{'saveTo':path[_0x876f('0x1a')](_0x37c953,util[_0x876f('0x10')](_0x876f('0x1e'),_0x328e32,'zip'))},function(_0x321e89,_0x187d91){});rimraf(path[_0x876f('0x1a')](_0x37c953,_0x328e32),function(){});}})[_0x876f('0xd')](function(){return analyticExtractedReport(_0x876f('0x22'),_0x56e3f5?util[_0x876f('0x10')](_0x876f('0x1e'),_0x328e32,_0x56e3f5?_0x876f('0x23'):'xlsx'):null);});})[_0x876f('0x24')](function(_0x45a011){console['error'](_0x45a011);return analyticExtractedReport(_0x876f('0x25'));});}main(); \ No newline at end of file +var _0x9cea=['%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Completed','Error','util','lodash','json2xls','bluebird','../../mysqldb','argv','AnalyticExtractedReport','update','Setting','split','splitSizeXlsx','then','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','mkdirSync','join','each'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x9cea,0x138));var _0xa9ce=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x9cea[_0x278e3c];return _0x3e2d9b;};'use strict';var util=require(_0xa9ce('0x0'));var path=require('path');var _=require(_0xa9ce('0x1'));var fs=require('fs');var json2xls=require(_0xa9ce('0x2'));var BPromise=require(_0xa9ce('0x3'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0xa9ce('0x4'))['dbH'];var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xa9ce('0x5')][0x3];var PATH=process[_0xa9ce('0x5')][0x4];function analyticExtractedReport(_0x16e44e,_0x417523){var _0x3891a9={'status':_0x16e44e};var _0x34d101={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x417523){_0x3891a9['savename']=_0x417523;}return db[_0xa9ce('0x6')][_0xa9ce('0x7')](_0x3891a9,_0x34d101);}function main(){var _0x135193=0x1388;var _0x362dc5;return db[_0xa9ce('0x8')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa9ce('0x9'),_0xa9ce('0xa')]})[_0xa9ce('0xb')](function(_0x13bda3){if(_0x13bda3){_0x362dc5=_0x13bda3;_0x135193=_0x362dc5[_0xa9ce('0xa')]||0x1388;}})[_0xa9ce('0xb')](function(){return dbH[_0xa9ce('0xc')]['query'](util[_0xa9ce('0xd')](_0xa9ce('0xe'),QUERY),{'type':dbH['sequelize'][_0xa9ce('0xf')][_0xa9ce('0x10')]});})[_0xa9ce('0xb')](function(_0x4fb311){if(!_0x4fb311[0x0][_0xa9ce('0x11')]){return analyticExtractedReport(_0xa9ce('0x12'));}var _0x1e8379=[];var _0x204440=0x0;var _0x1d729d=!![];if(_0x362dc5['split']){if(_0x4fb311&&_0x4fb311[_0xa9ce('0x13')]){var _0x3321d1=_0x4fb311[0x0]['num']%(_0x204440+_0x135193);for(;_0x1d729d;_0x204440+=_0x135193,_0x3321d1=_0x4fb311[0x0][_0xa9ce('0x11')]%(_0x204440+_0x135193)){if(_0x3321d1==0x0||_0x3321d1==_0x4fb311[0x0][_0xa9ce('0x11')]){_0x1d729d=![];}_0x1e8379[_0xa9ce('0x14')](dbH['sequelize'][_0xa9ce('0x15')](util[_0xa9ce('0xd')](_0xa9ce('0x16'),QUERY,_0x135193,_0x204440),{'type':dbH[_0xa9ce('0xc')][_0xa9ce('0xf')][_0xa9ce('0x10')]}));}}}else{_0x1e8379[_0xa9ce('0x14')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0xa9ce('0xc')][_0xa9ce('0xf')]['SELECT']}));}var _0x264b92=path[_0xa9ce('0x17')](PATH);var _0x50ea27=path[_0xa9ce('0x18')](PATH,_0xa9ce('0x19'));var _0x38b27f=_0x362dc5['split']&&_0x1e8379[_0xa9ce('0x13')]>0x1;var _0x50f693=[];if(!fs[_0xa9ce('0x1a')](path['join'](_0x264b92,_0x50ea27))&&_0x38b27f){fs[_0xa9ce('0x1b')](path[_0xa9ce('0x1c')](_0x264b92,_0x50ea27));}return BPromise[_0xa9ce('0x1d')](_0x1e8379,function(_0x372750){_0x50f693[_0xa9ce('0x14')](_0x372750);})[_0xa9ce('0xb')](function(){for(var _0x3d89d0=0x0;_0x3d89d0<_0x50f693[_0xa9ce('0x13')];_0x3d89d0+=0x1){var _0xf9be68;var _0x3e4842=_0x50f693[_0x3d89d0];if(_0x38b27f){_0xf9be68=path['join'](_0x264b92,_0x50ea27,util[_0xa9ce('0xd')](_0xa9ce('0x1e'),_0x50ea27,_0x3d89d0,_0xa9ce('0x1f')));}else{_0xf9be68=path[_0xa9ce('0x1c')](_0x264b92,util[_0xa9ce('0xd')](_0xa9ce('0x20'),_0x50ea27,_0xa9ce('0x1f')));}fs[_0xa9ce('0x21')](_0xf9be68,json2xls(_0x3e4842),_0xa9ce('0x22'));}})['then'](function(){if(_0x38b27f){zipdir(path[_0xa9ce('0x1c')](_0x264b92,_0x50ea27),{'saveTo':path[_0xa9ce('0x1c')](_0x264b92,util[_0xa9ce('0xd')]('%s.%s',_0x50ea27,_0xa9ce('0x23')))},function(_0x478256,_0xbc456b){});rimraf(path[_0xa9ce('0x1c')](_0x264b92,_0x50ea27),function(){});}})[_0xa9ce('0xb')](function(){return analyticExtractedReport(_0xa9ce('0x24'),_0x38b27f?util[_0xa9ce('0xd')](_0xa9ce('0x20'),_0x50ea27,_0x38b27f?_0xa9ce('0x23'):_0xa9ce('0x1f')):null);});})['catch'](function(_0x5bf572){console['error'](_0x5bf572);return analyticExtractedReport(_0xa9ce('0x25'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 2b63494..c84a207 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 _0x805a=['then','VoiceExtension','IntervalId','uniq','groupBy','exten','hasOwnProperty','answer','progress','priority','extensions','push','Set','format','CDR(type)=%s','type','VoiceExtensionId','length','updatedAt','interval','*,*,*,*','map','intervals','tag','CDR(tag)=','context','callerID','CALLERID(all)=','indexOf','toLowerCase','appType','custom','Answer','Progress','record','${UNIQUEID}.',',ab','recordingFormat','StopMixMonitor',',${EXTEN},','last','Hangup','concat','destroy','bulkCreate','sortBy','catch','util','models','findAll'];(function(_0x4388a9,_0xe58c02){var _0x4a9252=function(_0x71e58c){while(--_0x71e58c){_0x4388a9['push'](_0x4388a9['shift']());}};_0x4a9252(++_0xe58c02);}(_0x805a,0x18d));var _0xa805=function(_0x5eb456,_0x11789b){_0x5eb456=_0x5eb456-0x0;var _0x435279=_0x805a[_0x5eb456];return _0x435279;};'use strict';var _=require('lodash');var util=require(_0xa805('0x0'));function rewrite(_0x38bba6,_0x57c63b){var _0x2fb559=this;return _0x38bba6[_0xa805('0x1')]['Interval'][_0xa805('0x2')]({'raw':!![]})[_0xa805('0x3')](function(_0x3c66bc){_0x2fb559['intervals']=_0x3c66bc;return _0x38bba6['models'][_0xa805('0x4')][_0xa805('0x2')]({'where':{'IntervalId':_0x57c63b[_0xa805('0x5')]},'raw':!![]});})['then'](function(_0x1d43f3){return _0x38bba6[_0xa805('0x1')][_0xa805('0x4')]['findAll']({'where':{'exten':{'$in':_[_0xa805('0x6')](_['map'](_0x1d43f3,'exten'))},'isApp':!![]},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xa805('0x3')](function(_0x4b2a06){var _0x191cfb=_[_0xa805('0x7')](_0x4b2a06,_0xa805('0x8'));var _0x37ebaf=['queue','playback'];var _0x45081d=[];var _0x3fe0bd=[];for(var _0x9257f in _0x191cfb){if(_0x191cfb[_0xa805('0x9')](_0x9257f)){_0x2fb559[_0xa805('0xa')]=![];_0x2fb559[_0xa805('0xb')]=![];_0x2fb559[_0xa805('0xc')]=0x2;_0x2fb559[_0xa805('0xd')]=[];_0x2fb559[_0xa805('0xd')][_0xa805('0xe')]({'type':_0x191cfb[_0x9257f][0x0]['type'],'context':_0x191cfb[_0x9257f][0x0]['context'],'exten':_0x191cfb[_0x9257f][0x0][_0xa805('0x8')],'priority':_0x2fb559[_0xa805('0xc')]++,'app':_0xa805('0xf'),'appdata':util[_0xa805('0x10')](_0xa805('0x11'),_0x191cfb[_0x9257f][0x0][_0xa805('0x12')]),'VoiceExtensionId':_0x191cfb[_0x9257f][0x0][_0xa805('0x13')]});for(var _0x1d6bc0=0x0,_0x2732c8=0x0;_0x1d6bc0<_0x191cfb[_0x9257f][_0xa805('0x14')];_0x1d6bc0+=0x1,_0x2732c8=0x0){var _0x5e2218=_0x191cfb[_0x9257f][_0x1d6bc0];var _0x722f5=[];var _0x305d1e=[];delete _0x5e2218['id'];delete _0x5e2218['createdAt'];delete _0x5e2218[_0xa805('0x15')];var _0x2e897e=_0x5e2218[_0xa805('0x16')]!==_0xa805('0x17')?[_0x5e2218['interval']]:_0x5e2218[_0xa805('0x5')]?_[_0xa805('0x18')](_['filter'](_0x2fb559[_0xa805('0x19')],{'IntervalId':_0x5e2218[_0xa805('0x5')]}),_0xa805('0x16')):[];if(_0x5e2218[_0xa805('0x9')](_0xa805('0x1a'))){if(_0x5e2218[_0xa805('0x1a')]&&_0x5e2218[_0xa805('0x1a')]!=='--'){_0x722f5[_0xa805('0xe')]({'type':_0x5e2218[_0xa805('0x12')],'app':_0xa805('0xf'),'appdata':_0xa805('0x1b')+_0x5e2218[_0xa805('0x1a')],'context':_0x5e2218[_0xa805('0x1c')],'exten':_0x5e2218['exten'],'priority':_0x2e897e[_0xa805('0x14')]+_0x2fb559['priority']+_0x2732c8++,'VoiceExtensionId':_0x191cfb[_0x9257f][0x0][_0xa805('0x13')]});}}if(_0x5e2218[_0xa805('0x9')](_0xa805('0x1d'))){if(_0x5e2218[_0xa805('0x1d')]){_0x722f5['push']({'type':_0x5e2218['type'],'app':'Set','appdata':_0xa805('0x1e')+_0x5e2218[_0xa805('0x1d')],'context':_0x5e2218[_0xa805('0x1c')],'exten':_0x5e2218[_0xa805('0x8')],'priority':_0x2e897e['length']+_0x2fb559[_0xa805('0xc')]+_0x2732c8++,'VoiceExtensionId':_0x191cfb[_0x9257f][0x0][_0xa805('0x13')]});}}if(_0x5e2218[_0xa805('0x9')](_0xa805('0xa'))){if(_0x37ebaf[_0xa805('0x1f')](_0x5e2218['app'][_0xa805('0x20')]())>=0x0&&_0x5e2218[_0xa805('0x21')]!==_0xa805('0x22')){if(!_0x2fb559['answer']&&_0x5e2218['answer']){_0x2fb559[_0xa805('0xa')]=!![];_0x722f5[_0xa805('0xe')]({'type':_0x5e2218['type'],'app':_0xa805('0x23'),'context':_0x5e2218[_0xa805('0x1c')],'exten':_0x5e2218[_0xa805('0x8')],'priority':_0x2e897e[_0xa805('0x14')]+_0x2fb559[_0xa805('0xc')]+_0x2732c8++,'VoiceExtensionId':_0x191cfb[_0x9257f][0x0]['VoiceExtensionId']});}if(!_0x2fb559[_0xa805('0xa')]&&!_0x2fb559[_0xa805('0xb')]&&!_0x5e2218[_0xa805('0xa')]){_0x2fb559[_0xa805('0xb')]=!![];_0x722f5['push']({'type':_0x5e2218['type'],'app':_0xa805('0x24'),'context':_0x5e2218[_0xa805('0x1c')],'exten':_0x5e2218[_0xa805('0x8')],'priority':_0x2e897e['length']+_0x2fb559[_0xa805('0xc')]+_0x2732c8++,'VoiceExtensionId':_0x191cfb[_0x9257f][0x0][_0xa805('0x13')]});}}}if(_0x5e2218[_0xa805('0x9')](_0xa805('0x25'))&&_0x5e2218[_0xa805('0x9')]('recordingFormat')){if(_0x5e2218[_0xa805('0x25')]){_0x722f5[_0xa805('0xe')]({'type':_0x5e2218[_0xa805('0x12')],'app':'MixMonitor','appdata':_0xa805('0x26')+_0x5e2218['recordingFormat']+_0xa805('0x27'),'context':_0x5e2218[_0xa805('0x1c')],'exten':_0x5e2218[_0xa805('0x8')],'priority':_0x2e897e[_0xa805('0x14')]+_0x2fb559[_0xa805('0xc')]+_0x2732c8++,'VoiceExtensionId':_0x191cfb[_0x9257f][0x0]['VoiceExtensionId']});}}if(_0x5e2218[_0xa805('0x9')](_0xa805('0x25'))&&_0x5e2218[_0xa805('0x9')](_0xa805('0x28'))){if(_0x5e2218[_0xa805('0x25')]){_0x305d1e[_0xa805('0xe')]({'type':_0x5e2218[_0xa805('0x12')],'app':_0xa805('0x29'),'appdata':null,'context':_0x5e2218[_0xa805('0x1c')],'exten':_0x5e2218['exten'],'priority':_0x2e897e[_0xa805('0x14')]+_0x2fb559[_0xa805('0xc')]+_0x2732c8++ +0x1,'VoiceExtensionId':_0x191cfb[_0x9257f][0x0][_0xa805('0x13')]});}}for(var _0x1e45fe=0x0;_0x1e45fe<_0x2e897e[_0xa805('0x14')];_0x1e45fe+=0x1){var _0x21cc27=_0x2fb559[_0xa805('0xc')]+_0x2e897e[_0xa805('0x14')];var _0x53257b=_0x1e45fe===_0x2e897e[_0xa805('0x14')]-0x1?_0x2fb559[_0xa805('0xc')]+_0x722f5['length']+_0x305d1e[_0xa805('0x14')]+0x2:_0x2fb559[_0xa805('0xc')]+_0x1e45fe+0x1;_0x722f5['splice'](_0x1e45fe,0x0,{'type':_0x5e2218[_0xa805('0x12')],'app':'GotoIfTime','appdata':_0x2e897e[_0x1e45fe]+'?'+_0x5e2218['context']+',${EXTEN},'+_0x21cc27+':'+_0x5e2218['context']+_0xa805('0x2a')+_0x53257b,'exten':_0x5e2218[_0xa805('0x8')],'context':_0x5e2218['context'],'priority':_0x2fb559['priority']+_0x1e45fe,'VoiceExtensionId':_0x191cfb[_0x9257f][0x0][_0xa805('0x13')]});}_0x5e2218['priority']=_0x722f5[_0xa805('0x14')]?_[_0xa805('0x2b')](_0x722f5)['priority']+0x1:_0x2fb559['priority'];_0x2fb559[_0xa805('0xc')]=(_0x305d1e['length']?_[_0xa805('0x2b')](_0x305d1e)[_0xa805('0xc')]:_0x5e2218['priority'])+0x1;_0x2fb559['extensions']=_['concat'](_0x2fb559['extensions'],_0x722f5,[_0x5e2218],_0x305d1e);}_0x2fb559['extensions']['push']({'type':_0x191cfb[_0x9257f][0x0][_0xa805('0x12')],'app':_0xa805('0x2c'),'exten':_0x191cfb[_0x9257f][0x0]['exten'],'context':_0x191cfb[_0x9257f][0x0][_0xa805('0x1c')],'priority':_0x2fb559['priority'],'VoiceExtensionId':_0x191cfb[_0x9257f][0x0][_0xa805('0x13')]});_0x45081d[_0xa805('0xe')](_0x191cfb[_0x9257f][0x0][_0xa805('0x13')]);_0x3fe0bd=_[_0xa805('0x2d')](_0x3fe0bd,_0x2fb559[_0xa805('0xd')]);}}return _0x38bba6['transaction'](function(_0x5b42f2){return _0x38bba6[_0xa805('0x1')][_0xa805('0x4')][_0xa805('0x2e')]({'where':{'VoiceExtensionId':{'$in':_0x45081d}},'transaction':_0x5b42f2})[_0xa805('0x3')](function(_0x4485a4){return _0x38bba6[_0xa805('0x1')][_0xa805('0x4')][_0xa805('0x2f')](_[_0xa805('0x30')](_0x3fe0bd,'priority'),{'transaction':_0x5b42f2});});});})[_0xa805('0x31')](function(_0x379673){console['error'](_0x379673);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x27c1=['Set','format','type','VoiceExtensionId','length','createdAt','*,*,*,*','interval','filter','tag','CDR(tag)=','priority','callerID','indexOf','app','appType','custom','progress','record','recordingFormat','MixMonitor','${UNIQUEID}.',',ab','StopMixMonitor',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','lodash','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','groupBy','queue','playback','hasOwnProperty','answer','extensions','push','context'];(function(_0xf61c79,_0x43c6fa){var _0x127d26=function(_0x598bf6){while(--_0x598bf6){_0xf61c79['push'](_0xf61c79['shift']());}};_0x127d26(++_0x43c6fa);}(_0x27c1,0x18d));var _0x127c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x27c1[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x127c('0x0'));var util=require('util');function rewrite(_0x100f33,_0x17349d){var _0x5d7166=this;return _0x100f33[_0x127c('0x1')][_0x127c('0x2')][_0x127c('0x3')]({'raw':!![]})[_0x127c('0x4')](function(_0x181fc6){_0x5d7166[_0x127c('0x5')]=_0x181fc6;return _0x100f33[_0x127c('0x1')][_0x127c('0x6')]['findAll']({'where':{'IntervalId':_0x17349d[_0x127c('0x7')]},'raw':!![]});})[_0x127c('0x4')](function(_0x3a81e9){return _0x100f33[_0x127c('0x1')][_0x127c('0x6')][_0x127c('0x3')]({'where':{'exten':{'$in':_[_0x127c('0x8')](_[_0x127c('0x9')](_0x3a81e9,_0x127c('0xa')))},'isApp':!![]},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x127c('0x4')](function(_0x5384b7){var _0x214c07=_[_0x127c('0xb')](_0x5384b7,'exten');var _0x1b60ea=[_0x127c('0xc'),_0x127c('0xd')];var _0x39138b=[];var _0x3a21c4=[];for(var _0x15834c in _0x214c07){if(_0x214c07[_0x127c('0xe')](_0x15834c)){_0x5d7166[_0x127c('0xf')]=![];_0x5d7166['progress']=![];_0x5d7166['priority']=0x2;_0x5d7166[_0x127c('0x10')]=[];_0x5d7166[_0x127c('0x10')][_0x127c('0x11')]({'type':_0x214c07[_0x15834c][0x0]['type'],'context':_0x214c07[_0x15834c][0x0][_0x127c('0x12')],'exten':_0x214c07[_0x15834c][0x0]['exten'],'priority':_0x5d7166['priority']++,'app':_0x127c('0x13'),'appdata':util[_0x127c('0x14')]('CDR(type)=%s',_0x214c07[_0x15834c][0x0][_0x127c('0x15')]),'VoiceExtensionId':_0x214c07[_0x15834c][0x0][_0x127c('0x16')]});for(var _0x21c2da=0x0,_0x4fdfd5=0x0;_0x21c2da<_0x214c07[_0x15834c][_0x127c('0x17')];_0x21c2da+=0x1,_0x4fdfd5=0x0){var _0x5ded56=_0x214c07[_0x15834c][_0x21c2da];var _0xe3b22b=[];var _0x49ffa7=[];delete _0x5ded56['id'];delete _0x5ded56[_0x127c('0x18')];delete _0x5ded56['updatedAt'];var _0x5bf28b=_0x5ded56['interval']!==_0x127c('0x19')?[_0x5ded56[_0x127c('0x1a')]]:_0x5ded56[_0x127c('0x7')]?_[_0x127c('0x9')](_[_0x127c('0x1b')](_0x5d7166['intervals'],{'IntervalId':_0x5ded56[_0x127c('0x7')]}),'interval'):[];if(_0x5ded56[_0x127c('0xe')](_0x127c('0x1c'))){if(_0x5ded56[_0x127c('0x1c')]&&_0x5ded56['tag']!=='--'){_0xe3b22b['push']({'type':_0x5ded56[_0x127c('0x15')],'app':_0x127c('0x13'),'appdata':_0x127c('0x1d')+_0x5ded56['tag'],'context':_0x5ded56[_0x127c('0x12')],'exten':_0x5ded56[_0x127c('0xa')],'priority':_0x5bf28b[_0x127c('0x17')]+_0x5d7166[_0x127c('0x1e')]+_0x4fdfd5++,'VoiceExtensionId':_0x214c07[_0x15834c][0x0][_0x127c('0x16')]});}}if(_0x5ded56[_0x127c('0xe')](_0x127c('0x1f'))){if(_0x5ded56[_0x127c('0x1f')]){_0xe3b22b[_0x127c('0x11')]({'type':_0x5ded56[_0x127c('0x15')],'app':_0x127c('0x13'),'appdata':'CALLERID(all)='+_0x5ded56[_0x127c('0x1f')],'context':_0x5ded56['context'],'exten':_0x5ded56[_0x127c('0xa')],'priority':_0x5bf28b[_0x127c('0x17')]+_0x5d7166[_0x127c('0x1e')]+_0x4fdfd5++,'VoiceExtensionId':_0x214c07[_0x15834c][0x0]['VoiceExtensionId']});}}if(_0x5ded56[_0x127c('0xe')](_0x127c('0xf'))){if(_0x1b60ea[_0x127c('0x20')](_0x5ded56[_0x127c('0x21')]['toLowerCase']())>=0x0&&_0x5ded56[_0x127c('0x22')]!==_0x127c('0x23')){if(!_0x5d7166['answer']&&_0x5ded56['answer']){_0x5d7166[_0x127c('0xf')]=!![];_0xe3b22b[_0x127c('0x11')]({'type':_0x5ded56['type'],'app':'Answer','context':_0x5ded56[_0x127c('0x12')],'exten':_0x5ded56[_0x127c('0xa')],'priority':_0x5bf28b[_0x127c('0x17')]+_0x5d7166[_0x127c('0x1e')]+_0x4fdfd5++,'VoiceExtensionId':_0x214c07[_0x15834c][0x0][_0x127c('0x16')]});}if(!_0x5d7166[_0x127c('0xf')]&&!_0x5d7166[_0x127c('0x24')]&&!_0x5ded56['answer']){_0x5d7166['progress']=!![];_0xe3b22b[_0x127c('0x11')]({'type':_0x5ded56[_0x127c('0x15')],'app':'Progress','context':_0x5ded56[_0x127c('0x12')],'exten':_0x5ded56['exten'],'priority':_0x5bf28b[_0x127c('0x17')]+_0x5d7166[_0x127c('0x1e')]+_0x4fdfd5++,'VoiceExtensionId':_0x214c07[_0x15834c][0x0][_0x127c('0x16')]});}}}if(_0x5ded56['hasOwnProperty'](_0x127c('0x25'))&&_0x5ded56['hasOwnProperty'](_0x127c('0x26'))){if(_0x5ded56[_0x127c('0x25')]){_0xe3b22b[_0x127c('0x11')]({'type':_0x5ded56[_0x127c('0x15')],'app':_0x127c('0x27'),'appdata':_0x127c('0x28')+_0x5ded56[_0x127c('0x26')]+_0x127c('0x29'),'context':_0x5ded56[_0x127c('0x12')],'exten':_0x5ded56['exten'],'priority':_0x5bf28b[_0x127c('0x17')]+_0x5d7166['priority']+_0x4fdfd5++,'VoiceExtensionId':_0x214c07[_0x15834c][0x0][_0x127c('0x16')]});}}if(_0x5ded56['hasOwnProperty'](_0x127c('0x25'))&&_0x5ded56['hasOwnProperty'](_0x127c('0x26'))){if(_0x5ded56[_0x127c('0x25')]){_0x49ffa7[_0x127c('0x11')]({'type':_0x5ded56['type'],'app':_0x127c('0x2a'),'appdata':null,'context':_0x5ded56[_0x127c('0x12')],'exten':_0x5ded56[_0x127c('0xa')],'priority':_0x5bf28b[_0x127c('0x17')]+_0x5d7166['priority']+_0x4fdfd5++ +0x1,'VoiceExtensionId':_0x214c07[_0x15834c][0x0][_0x127c('0x16')]});}}for(var _0x314bf0=0x0;_0x314bf0<_0x5bf28b[_0x127c('0x17')];_0x314bf0+=0x1){var _0x106f87=_0x5d7166[_0x127c('0x1e')]+_0x5bf28b[_0x127c('0x17')];var _0xcbf3a3=_0x314bf0===_0x5bf28b[_0x127c('0x17')]-0x1?_0x5d7166[_0x127c('0x1e')]+_0xe3b22b[_0x127c('0x17')]+_0x49ffa7['length']+0x2:_0x5d7166[_0x127c('0x1e')]+_0x314bf0+0x1;_0xe3b22b['splice'](_0x314bf0,0x0,{'type':_0x5ded56[_0x127c('0x15')],'app':'GotoIfTime','appdata':_0x5bf28b[_0x314bf0]+'?'+_0x5ded56[_0x127c('0x12')]+_0x127c('0x2b')+_0x106f87+':'+_0x5ded56[_0x127c('0x12')]+_0x127c('0x2b')+_0xcbf3a3,'exten':_0x5ded56[_0x127c('0xa')],'context':_0x5ded56[_0x127c('0x12')],'priority':_0x5d7166[_0x127c('0x1e')]+_0x314bf0,'VoiceExtensionId':_0x214c07[_0x15834c][0x0][_0x127c('0x16')]});}_0x5ded56[_0x127c('0x1e')]=_0xe3b22b[_0x127c('0x17')]?_[_0x127c('0x2c')](_0xe3b22b)['priority']+0x1:_0x5d7166['priority'];_0x5d7166['priority']=(_0x49ffa7['length']?_[_0x127c('0x2c')](_0x49ffa7)[_0x127c('0x1e')]:_0x5ded56[_0x127c('0x1e')])+0x1;_0x5d7166[_0x127c('0x10')]=_[_0x127c('0x2d')](_0x5d7166['extensions'],_0xe3b22b,[_0x5ded56],_0x49ffa7);}_0x5d7166[_0x127c('0x10')][_0x127c('0x11')]({'type':_0x214c07[_0x15834c][0x0][_0x127c('0x15')],'app':_0x127c('0x2e'),'exten':_0x214c07[_0x15834c][0x0]['exten'],'context':_0x214c07[_0x15834c][0x0]['context'],'priority':_0x5d7166[_0x127c('0x1e')],'VoiceExtensionId':_0x214c07[_0x15834c][0x0][_0x127c('0x16')]});_0x39138b[_0x127c('0x11')](_0x214c07[_0x15834c][0x0]['VoiceExtensionId']);_0x3a21c4=_[_0x127c('0x2d')](_0x3a21c4,_0x5d7166['extensions']);}}return _0x100f33[_0x127c('0x2f')](function(_0x2b34a7){return _0x100f33['models']['VoiceExtension'][_0x127c('0x30')]({'where':{'VoiceExtensionId':{'$in':_0x39138b}},'transaction':_0x2b34a7})[_0x127c('0x4')](function(_0x41cf10){return _0x100f33[_0x127c('0x1')][_0x127c('0x6')][_0x127c('0x31')](_[_0x127c('0x32')](_0x3a21c4,_0x127c('0x1e')),{'transaction':_0x2b34a7});});});})[_0x127c('0x33')](function(_0x19e4f0){console['error'](_0x19e4f0);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 2984bf6..6813bbc 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 _0x70e0=['firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','CompanyId','duplicate','CmContact','create','catch','Error\x20while\x20creating\x20contact:\x20','message','cmContact','checkHopper','inspect','insert','into','scheduledAt','ContactId','ListId','createdAt','updatedAt','field','NOW()','toString','from','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','cm_hopper','cm_contacts','id\x20IN\x20?','str','select','fromQuery','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','then','get','always','push','query','VoiceQueueId','sequelize','all','CmList','onlyIfOpen','CampaignId','Campaign','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','resume','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','bluebird','../../../mysqldb','../../../config/logger','lodash','squel','papaparse','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','hasOwnProperty','data','firstName'];(function(_0x40f690,_0x137b1f){var _0x180d61=function(_0x2b1e4a){while(--_0x2b1e4a){_0x40f690['push'](_0x40f690['shift']());}};_0x180d61(++_0x137b1f);}(_0x70e0,0x17b));var _0x070e=function(_0x4c745a,_0x31ce68){_0x4c745a=_0x4c745a-0x0;var _0x3ad4fa=_0x70e0[_0x4c745a];return _0x3ad4fa;};'use strict';var BPromise=require(_0x070e('0x0'));var db=require(_0x070e('0x1'))['db'];var logger=require(_0x070e('0x2'))('api');var util=require('util');var _=require(_0x070e('0x3'));var fs=require('fs');var squel=require(_0x070e('0x4'));var Papa=require(_0x070e('0x5'));var socket=require(_0x070e('0x6'))({'host':'localhost','port':0x18eb});require(_0x070e('0x7'))['register'](socket);try{if(!process[_0x070e('0x8')][0x2]||process['argv'][0x2]==='undefined'||process['argv'][0x2]===_0x070e('0x9')){throw new Error(_0x070e('0xa'));}var FILEPATH=process[_0x070e('0x8')][0x2];if(!process[_0x070e('0x8')][0x3]||process[_0x070e('0x8')][0x3]===_0x070e('0xb')||process[_0x070e('0x8')][0x3]==='null'||!process['argv'][0x4]||process[_0x070e('0x8')][0x4]===_0x070e('0xb')||process[_0x070e('0x8')][0x4]===_0x070e('0x9')){throw new Error(_0x070e('0xc'));}var FIELDS=_[_0x070e('0xd')](process[_0x070e('0x8')][0x3][_0x070e('0xe')](','),process[_0x070e('0x8')][0x4][_0x070e('0xe')](','));if(!process[_0x070e('0x8')][0x5]||process['argv'][0x5]==='undefined'||process[_0x070e('0x8')][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x070e('0x8')][0x6]&&process[_0x070e('0x8')][0x6]!=='undefined'&&process['argv'][0x6]!==_0x070e('0x9')?process[_0x070e('0x8')][0x6]:null;var DUPLICATES=process[_0x070e('0x8')][0x7]&&process[_0x070e('0x8')][0x7]!=='undefined'&&process['argv'][0x7]!==_0x070e('0x9')?process[_0x070e('0x8')][0x7]:null;if(!process[_0x070e('0x8')][0x8]||process[_0x070e('0x8')][0x8]===_0x070e('0xb')||process['argv'][0x8]===_0x070e('0x9')){throw new Error(_0x070e('0xf'));}var SOCKET_TIMESTAMP=process[_0x070e('0x8')][0x8];}catch(_0x3ea105){logger[_0x070e('0x10')](_0x3ea105);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(_0x5c16fd,_0x5b2f48,_0x4e958f,_0x9907cf){var _0x3004f0={'message':_0x5b2f48};_0x3004f0[_0x5c16fd]=!![];if(_0x4e958f){_0x3004f0[_0x070e('0x11')]=_0x4e958f;}if(_0x9907cf){_0x3004f0['index']=_0x9907cf;}return _0x3004f0;}function isEmail(_0x5b184){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'](_0x5b184);}function checkRow(_0xf8dd5d,_0x3f6985,_0x27a01e){return new BPromise(function(_0x33e8c6,_0x28a1c3){if(_[_0x070e('0x12')](_0xf8dd5d)){return _0x28a1c3(handleCheckRowError(_0x070e('0x10'),_0x070e('0x13'),null,_0x27a01e));}if(_0xf8dd5d['errors']&&_0xf8dd5d[_0x070e('0x14')][_0x070e('0x15')]){var _0x4790eb=_['map'](_0xf8dd5d[_0x070e('0x14')],'message')['join'](';');return _0x28a1c3(handleCheckRowError(_0x070e('0x10'),_0x4790eb,null,_0x27a01e));}var _0x25f6e={};for(var _0x41deb1 in FIELDS){if(FIELDS[_0x070e('0x16')](_0x41deb1)&&FIELDS[_0x41deb1]){_0x25f6e[_0x41deb1]=_0xf8dd5d[_0x070e('0x17')][0x0][FIELDS[_0x41deb1]]||_0xf8dd5d['data'][0x0]['\ufeff'+FIELDS[_0x41deb1]];}}if(!_0x25f6e[_0x070e('0x18')]){return _0x28a1c3(handleCheckRowError(_0x070e('0x10'),_0x070e('0x19'),null,_0x27a01e));}if(!_0x25f6e[_0x070e('0x1a')]){return _0x28a1c3(handleCheckRowError(_0x070e('0x10'),_0x070e('0x1b'),null,_0x27a01e));}if(_0x25f6e[_0x070e('0x1c')]){var _0x26373b=moment(_0x25f6e['birthDate'],_0x070e('0x1d'));if(!_0x26373b[_0x070e('0x1e')]()){return _0x28a1c3(handleCheckRowError(_0x070e('0x10'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x27a01e));}}if(_0x25f6e['email']){if(!isEmail(_0x25f6e[_0x070e('0x1f')])){return _0x28a1c3(handleCheckRowError(_0x070e('0x10'),_0x070e('0x20'),null,_0x27a01e));}}_0x25f6e['ListId']=LISTID;_0x25f6e[_0x070e('0x21')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x070e('0x15')]&&_0x3f6985){var _0x3a9425={};for(var _0x5f2bee=0x0,_0x53d473=DUPLICATES['length'];_0x5f2bee<_0x53d473;_0x5f2bee+=0x1){_0x3a9425[DUPLICATES[_0x5f2bee]]=_0x25f6e[DUPLICATES[_0x5f2bee]];}var _0x523b75=_['find'](_0x3f6985,_0x3a9425);if(_0x523b75){return _0x28a1c3(handleCheckRowError(_0x070e('0x22'),'Duplicate\x20Contact',_0x523b75,_0x27a01e));}}return db[_0x070e('0x23')][_0x070e('0x24')](_0x25f6e,{'raw':!![],'hooks':![],'fields':_['keys'](_0x25f6e)})['then'](function(_0x699739){if(DUPLICATES&&DUPLICATES[_0x070e('0x15')]&&_0x3f6985){_0x3f6985['push'](_['pick'](_0x25f6e,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x699739['id'];return _0x33e8c6();})[_0x070e('0x25')](function(_0x27dd1f){return _0x28a1c3(handleCheckRowError(_0x070e('0x10'),_0x070e('0x26')+(_0x27dd1f[_0x070e('0x27')]||JSON['stringify'](_0x27dd1f)),null,_0x27a01e));});});}function checkHopper(){function _0x482cc2(){return function(_0x24d17d){logger[_0x070e('0x10')](_0x070e('0x28'),_0x070e('0x29'),util[_0x070e('0x2a')](_0x24d17d,{'showHidden':![],'depth':null}));};}var _0x4deaf8=function(_0x22f3a9,_0x1927f4){var _0x534150=squel[_0x070e('0x2b')]()[_0x070e('0x2c')]('cm_hopper')['fromQuery'](['phone',_0x070e('0x2d'),_0x070e('0x2e'),_0x070e('0x2f'),_0x1927f4,_0x070e('0x30'),_0x070e('0x31')],squel['select']()[_0x070e('0x32')](_0x070e('0x1a'),_0x070e('0x1a'))['field'](_0x070e('0x33'),_0x070e('0x2d'))[_0x070e('0x32')]('id','ContactId')[_0x070e('0x32')](LISTID[_0x070e('0x34')](),'ListId')[_0x070e('0x32')](_0x22f3a9['id']['toString'](),_0x1927f4)[_0x070e('0x32')](_0x070e('0x33'),_0x070e('0x30'))[_0x070e('0x32')](_0x070e('0x33'),'updatedAt')[_0x070e('0x35')]('cm_contacts')['where'](_0x070e('0x36'))[_0x070e('0x37')](_0x070e('0x38'),LISTID['toString']())[_0x070e('0x37')](_0x070e('0x39'))[_0x070e('0x37')](_0x070e('0x3a'),squel['select']()[_0x070e('0x32')]('phone')['from']('cm_hopper')[_0x070e('0x37')](_0x1927f4+_0x070e('0x3b'),_0x22f3a9['id'][_0x070e('0x34')]())))[_0x070e('0x34')]();return _0x534150;};var _0x34f23e=function(_0x562aa4,_0x18607f){var _0x59037e=squel[_0x070e('0x2b')]()[_0x070e('0x2c')](_0x070e('0x3c'))['fromQuery'](['phone',_0x070e('0x2d'),'ContactId',_0x070e('0x2f'),_0x18607f,_0x070e('0x30'),_0x070e('0x31')],squel['select']()[_0x070e('0x32')](_0x070e('0x1a'),'phone')['field'](_0x070e('0x33'),_0x070e('0x2d'))[_0x070e('0x32')]('id',_0x070e('0x2e'))[_0x070e('0x32')](LISTID['toString'](),_0x070e('0x2f'))[_0x070e('0x32')](_0x562aa4['id'][_0x070e('0x34')](),_0x18607f)[_0x070e('0x32')](_0x070e('0x33'),_0x070e('0x30'))[_0x070e('0x32')](_0x070e('0x33'),_0x070e('0x31'))[_0x070e('0x35')](_0x070e('0x3d'))[_0x070e('0x37')](_0x070e('0x36'))[_0x070e('0x37')](_0x070e('0x38'),LISTID['toString']())[_0x070e('0x37')](_0x070e('0x3e'),squel[_0x070e('0x3f')](hopperContacts))[_0x070e('0x37')](_0x070e('0x39'))[_0x070e('0x37')](_0x070e('0x3a'),squel[_0x070e('0x40')]()[_0x070e('0x32')]('calleridnum')[_0x070e('0x35')]('cm_hopper_final')[_0x070e('0x37')](_0x18607f+_0x070e('0x3b'),_0x562aa4['id']['toString']()))[_0x070e('0x37')](_0x070e('0x3a'),squel[_0x070e('0x40')]()[_0x070e('0x32')](_0x070e('0x1a'))[_0x070e('0x35')](_0x070e('0x3c'))['where'](_0x18607f+_0x070e('0x3b'),_0x562aa4['id']['toString']())))['toString']();return _0x59037e;};function _0x3a06c6(_0x3d1b5e,_0x208bb7){var _0x149375=squel[_0x070e('0x2b')]()[_0x070e('0x2c')](_0x070e('0x3c'))[_0x070e('0x41')](['phone',_0x070e('0x2d'),'ContactId','ListId',_0x208bb7,_0x070e('0x30'),_0x070e('0x31')],squel['select']()[_0x070e('0x32')](_0x070e('0x1a'),_0x070e('0x1a'))[_0x070e('0x32')](_0x070e('0x33'),_0x070e('0x2d'))[_0x070e('0x32')]('id','ContactId')['field'](LISTID['toString'](),_0x070e('0x2f'))[_0x070e('0x32')](_0x3d1b5e['id'][_0x070e('0x34')](),_0x208bb7)[_0x070e('0x32')]('NOW()',_0x070e('0x30'))['field'](_0x070e('0x33'),_0x070e('0x31'))[_0x070e('0x35')](_0x070e('0x3d'))[_0x070e('0x37')](_0x070e('0x36'))['where'](_0x070e('0x38'),LISTID[_0x070e('0x34')]())[_0x070e('0x37')]('id\x20IN\x20?',squel[_0x070e('0x3f')](hopperContacts))[_0x070e('0x37')]('phone\x20IS\x20NOT\x20NULL'))[_0x070e('0x34')]();return _0x149375;}function _0x4e8dfc(_0xc89f90,_0x569f92){var _0x4cb86f=squel['insert']()[_0x070e('0x2c')](_0x070e('0x42'))[_0x070e('0x41')]([_0x070e('0x1a'),_0x070e('0x2e'),_0x070e('0x2f'),_0x569f92,'createdAt',_0x070e('0x31')],squel['select']()[_0x070e('0x32')]('phone',_0x070e('0x1a'))[_0x070e('0x32')]('id','ContactId')[_0x070e('0x32')](LISTID['toString'](),_0x070e('0x2f'))[_0x070e('0x32')](_0xc89f90['id'][_0x070e('0x34')](),_0x569f92)[_0x070e('0x32')](_0x070e('0x33'),_0x070e('0x30'))[_0x070e('0x32')](_0x070e('0x33'),_0x070e('0x31'))[_0x070e('0x35')](_0x070e('0x3d'))[_0x070e('0x37')](_0x070e('0x36'))[_0x070e('0x37')]('ListId\x20=\x20?',LISTID[_0x070e('0x34')]())[_0x070e('0x37')](_0x070e('0x3e'),squel[_0x070e('0x3f')](hopperContacts))['where'](_0x070e('0x39')))[_0x070e('0x34')]();return _0x4cb86f;}return db[_0x070e('0x43')][_0x070e('0x44')]({'where':{'type':_0x070e('0x45')},'attributes':['id',_0x070e('0x46')],'include':[{'model':db['CmList'],'as':_0x070e('0x47'),'where':{'id':LISTID}}]})[_0x070e('0x48')](function(_0x240ec9){var _0x2fe202=[];if(_0x240ec9){var _0x551ca5;for(var _0x8b9c73=0x0,_0x52804d;_0x8b9c73<_0x240ec9[_0x070e('0x15')];_0x8b9c73+=0x1){_0x52804d=_0x240ec9[_0x8b9c73][_0x070e('0x49')]({'plain':!![]});switch(_0x52804d[_0x070e('0x46')]){case _0x070e('0x4a'):_0x2fe202[_0x070e('0x4b')](db['sequelize'][_0x070e('0x4c')](_0x34f23e(_0x52804d,_0x070e('0x4d')))[_0x070e('0x48')](function(){})[_0x070e('0x25')](_0x482cc2()));break;case'onlyIfOpen':_0x2fe202[_0x070e('0x4b')](db['sequelize'][_0x070e('0x4c')](_0x4deaf8(_0x52804d,_0x070e('0x4d')))[_0x070e('0x48')](function(){})['catch'](_0x482cc2()));break;default:_0x2fe202[_0x070e('0x4b')](db['sequelize'][_0x070e('0x4c')](_0x3a06c6(_0x52804d,'VoiceQueueId'))[_0x070e('0x48')](function(){})[_0x070e('0x25')](_0x482cc2()));}}}return _0x2fe202;})['all']()[_0x070e('0x48')](function(){return db['VoiceQueue'][_0x070e('0x44')]({'where':{'type':_0x070e('0x45')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x070e('0x48')](function(_0x3022cd){var _0xf67cfd=[];if(_0x3022cd){var _0x17cf15;for(var _0x25f1d0=0x0,_0x26c5c3;_0x25f1d0<_0x3022cd[_0x070e('0x15')];_0x25f1d0+=0x1){_0x26c5c3=_0x3022cd[_0x25f1d0][_0x070e('0x49')]({'plain':!![]});_0xf67cfd[_0x070e('0x4b')](db[_0x070e('0x4e')][_0x070e('0x4c')](_0x4e8dfc(_0x26c5c3,_0x070e('0x4d')))[_0x070e('0x48')](function(){})['catch'](_0x482cc2()));}}return _0xf67cfd;})[_0x070e('0x4f')]();})[_0x070e('0x48')](function(){return db['Campaign']['findAll']({'attributes':['id',_0x070e('0x46')],'include':[{'model':db[_0x070e('0x50')],'as':_0x070e('0x47'),'where':{'id':LISTID}}]})[_0x070e('0x48')](function(_0x3b3e96){var _0x12fe4f=[];if(_0x3b3e96){for(var _0x3223a4=0x0,_0x110813;_0x3223a4<_0x3b3e96[_0x070e('0x15')];_0x3223a4+=0x1){_0x110813=_0x3b3e96[_0x3223a4][_0x070e('0x49')]({'plain':!![]});switch(_0x110813[_0x070e('0x46')]){case _0x070e('0x4a'):_0x12fe4f[_0x070e('0x4b')](db['sequelize']['query'](_0x34f23e(_0x110813,'CampaignId'))[_0x070e('0x48')](function(){})[_0x070e('0x25')](_0x482cc2()));break;case _0x070e('0x51'):_0x12fe4f[_0x070e('0x4b')](db['sequelize'][_0x070e('0x4c')](_0x4deaf8(_0x110813,_0x070e('0x52')))[_0x070e('0x48')](function(){})[_0x070e('0x25')](_0x482cc2()));break;default:_0x12fe4f[_0x070e('0x4b')](db[_0x070e('0x4e')]['query'](_0x3a06c6(_0x110813,_0x070e('0x52')))['then'](function(){})[_0x070e('0x25')](_0x482cc2()));}}}return _0x12fe4f;})[_0x070e('0x4f')]();})[_0x070e('0x48')](function(){return db[_0x070e('0x53')][_0x070e('0x44')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x070e('0x54'),'where':{'id':LISTID}}]})[_0x070e('0x48')](function(_0x5d3bd8){var _0x421392=[];if(_0x5d3bd8){for(var _0x1e1d27=0x0,_0x553ea1;_0x1e1d27<_0x5d3bd8[_0x070e('0x15')];_0x1e1d27+=0x1){_0x553ea1=_0x5d3bd8[_0x1e1d27][_0x070e('0x49')]({'plain':!![]});_0x421392[_0x070e('0x4b')](db['sequelize'][_0x070e('0x4c')](_0x4e8dfc(_0x553ea1,_0x070e('0x52')))[_0x070e('0x48')](function(){})[_0x070e('0x25')](_0x482cc2()));}}return _0x421392;})[_0x070e('0x4f')]();})[_0x070e('0x25')](function(_0x3961a6){logger[_0x070e('0x10')](_0x070e('0x55'),_0x070e('0x56'),_0x3961a6[_0x070e('0x27')]);});}var processPromises=function(_0x46d2b7){return BPromise[_0x070e('0x4f')](promises)['then'](function(_0x28be73){})[_0x070e('0x25')](function(_0x392c45){logger[_0x070e('0x10')](_0x070e('0x57'),JSON[_0x070e('0x58')](_0x392c45));})['finally'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x46d2b7){return _0x46d2b7[_0x070e('0x59')]();}});};var endCsv=function(){return BPromise[_0x070e('0x5a')]()[_0x070e('0x48')](function(){if(hopperContacts){return checkHopper();}})[_0x070e('0x48')](function(){socket['emit'](_0x070e('0x5b')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x070e('0x5c')](FILEPATH);}catch(_0x370209){logger['error'](_0x070e('0x5d'),JSON['stringify'](_0x370209));}finally{process[_0x070e('0x5e')](0x0);}});};process['on'](_0x070e('0x5f'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x070e('0x5a')]()[_0x070e('0x48')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x070e('0x23')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x4caaa9){var _0x15480c=fs[_0x070e('0x60')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x070e('0x61')](_0x15480c,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3aa652,_0x137dd8){total+=0x1;var _0x341756=total;promises[_0x070e('0x4b')](checkRow(_0x3aa652,_0x4caaa9,_0x341756)[_0x070e('0x48')](function(){success+=0x1;})[_0x070e('0x25')](function(_0xdcc60a){if(_0xdcc60a[_0x070e('0x10')]){errors+=0x1;delete _0xdcc60a[_0x070e('0x10')];}else if(_0xdcc60a[_0x070e('0x22')]){duplicates+=0x1;delete _0xdcc60a[_0x070e('0x22')];}rows[_0x070e('0x4b')](_0xdcc60a);}));if(total%0xc8===0x0){_0x137dd8[_0x070e('0x62')]();return processPromises(_0x137dd8);}},'complete':function(){return processPromises()[_0x070e('0x48')](function(){logger[_0x070e('0x63')](_0x070e('0x64'));endCsv();});},'error':function(_0x2948c3,_0x153a37){logger[_0x070e('0x63')]('CSV\x20parse\x20error',JSON[_0x070e('0x58')](_0x2948c3));endCsv();}});})[_0x070e('0x25')](function(_0x449337){logger[_0x070e('0x10')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x070e('0x58')](_0x449337));});}main(); \ No newline at end of file +var _0xec56=['parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','api','util','lodash','squel','papaparse','socket.io-emitter','localhost','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','data','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','duplicate','Duplicate\x20Contact','create','keys','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','phone','ContactId','ListId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','cm_hopper','\x20=\x20?','id\x20IN\x20?','str','cm_hopper_final','fromQuery','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','then','get','sequelize','query','VoiceQueueId','onlyIfOpen','all','BlackLists','Campaign','always','CampaignId','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xec56,0x1bd));var _0x6ec5=function(_0x4d5927,_0x1ce915){_0x4d5927=_0x4d5927-0x0;var _0x1f5dba=_0xec56[_0x4d5927];return _0x1f5dba;};'use strict';var BPromise=require(_0x6ec5('0x0'));var db=require('../../../mysqldb')['db'];var logger=require('../../../config/logger')(_0x6ec5('0x1'));var util=require(_0x6ec5('0x2'));var _=require(_0x6ec5('0x3'));var fs=require('fs');var squel=require(_0x6ec5('0x4'));var Papa=require(_0x6ec5('0x5'));var socket=require(_0x6ec5('0x6'))({'host':_0x6ec5('0x7'),'port':0x18eb});require(_0x6ec5('0x8'))[_0x6ec5('0x9')](socket);try{if(!process[_0x6ec5('0xa')][0x2]||process[_0x6ec5('0xa')][0x2]===_0x6ec5('0xb')||process[_0x6ec5('0xa')][0x2]===_0x6ec5('0xc')){throw new Error(_0x6ec5('0xd'));}var FILEPATH=process[_0x6ec5('0xa')][0x2];if(!process[_0x6ec5('0xa')][0x3]||process[_0x6ec5('0xa')][0x3]===_0x6ec5('0xb')||process['argv'][0x3]===_0x6ec5('0xc')||!process[_0x6ec5('0xa')][0x4]||process[_0x6ec5('0xa')][0x4]===_0x6ec5('0xb')||process[_0x6ec5('0xa')][0x4]===_0x6ec5('0xc')){throw new Error(_0x6ec5('0xe'));}var FIELDS=_['zipObject'](process[_0x6ec5('0xa')][0x3][_0x6ec5('0xf')](','),process[_0x6ec5('0xa')][0x4][_0x6ec5('0xf')](','));if(!process[_0x6ec5('0xa')][0x5]||process[_0x6ec5('0xa')][0x5]===_0x6ec5('0xb')||process[_0x6ec5('0xa')][0x5]==='null'){throw new Error(_0x6ec5('0x10'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x6ec5('0xa')][0x6]&&process[_0x6ec5('0xa')][0x6]!==_0x6ec5('0xb')&&process[_0x6ec5('0xa')][0x6]!==_0x6ec5('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x6ec5('0xa')][0x7]&&process[_0x6ec5('0xa')][0x7]!==_0x6ec5('0xb')&&process[_0x6ec5('0xa')][0x7]!==_0x6ec5('0xc')?process[_0x6ec5('0xa')][0x7]:null;if(!process[_0x6ec5('0xa')][0x8]||process[_0x6ec5('0xa')][0x8]===_0x6ec5('0xb')||process[_0x6ec5('0xa')][0x8]===_0x6ec5('0xc')){throw new Error(_0x6ec5('0x11'));}var SOCKET_TIMESTAMP=process[_0x6ec5('0xa')][0x8];}catch(_0x2228dd){logger[_0x6ec5('0x12')](_0x2228dd);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(_0x3d08e9,_0x12ba7f,_0x4abd5d,_0x272532){var _0x1b1d96={'message':_0x12ba7f};_0x1b1d96[_0x3d08e9]=!![];if(_0x4abd5d){_0x1b1d96[_0x6ec5('0x13')]=_0x4abd5d;}if(_0x272532){_0x1b1d96[_0x6ec5('0x14')]=_0x272532;}return _0x1b1d96;}function isEmail(_0x3fc9d7){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))*$/[_0x6ec5('0x15')](_0x3fc9d7);}function checkRow(_0x18243f,_0x48733b,_0x78c52c){return new BPromise(function(_0x2ecdcf,_0x358d18){if(_[_0x6ec5('0x16')](_0x18243f)){return _0x358d18(handleCheckRowError('error',_0x6ec5('0x17'),null,_0x78c52c));}if(_0x18243f[_0x6ec5('0x18')]&&_0x18243f['errors'][_0x6ec5('0x19')]){var _0x19812b=_[_0x6ec5('0x1a')](_0x18243f['errors'],_0x6ec5('0x1b'))[_0x6ec5('0x1c')](';');return _0x358d18(handleCheckRowError(_0x6ec5('0x12'),_0x19812b,null,_0x78c52c));}var _0x462488={};for(var _0x425fac in FIELDS){if(FIELDS['hasOwnProperty'](_0x425fac)&&FIELDS[_0x425fac]){_0x462488[_0x425fac]=_0x18243f[_0x6ec5('0x1d')][0x0][FIELDS[_0x425fac]]||_0x18243f[_0x6ec5('0x1d')][0x0]['\ufeff'+FIELDS[_0x425fac]];}}if(!_0x462488['firstName']){return _0x358d18(handleCheckRowError(_0x6ec5('0x12'),_0x6ec5('0x1e'),null,_0x78c52c));}if(!_0x462488['phone']){return _0x358d18(handleCheckRowError(_0x6ec5('0x12'),_0x6ec5('0x1f'),null,_0x78c52c));}if(_0x462488[_0x6ec5('0x20')]){var _0xa227ff=moment(_0x462488[_0x6ec5('0x20')],'YYYY-MM-DD');if(!_0xa227ff[_0x6ec5('0x21')]()){return _0x358d18(handleCheckRowError(_0x6ec5('0x12'),_0x6ec5('0x22'),null,_0x78c52c));}}if(_0x462488[_0x6ec5('0x23')]){if(!isEmail(_0x462488[_0x6ec5('0x23')])){return _0x358d18(handleCheckRowError(_0x6ec5('0x12'),_0x6ec5('0x24'),null,_0x78c52c));}}_0x462488['ListId']=LISTID;_0x462488[_0x6ec5('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x48733b){var _0x15e1f6={};for(var _0x5c6517=0x0,_0x424ec7=DUPLICATES[_0x6ec5('0x19')];_0x5c6517<_0x424ec7;_0x5c6517+=0x1){_0x15e1f6[DUPLICATES[_0x5c6517]]=_0x462488[DUPLICATES[_0x5c6517]];}var _0x4adf14=_['find'](_0x48733b,_0x15e1f6);if(_0x4adf14){return _0x358d18(handleCheckRowError(_0x6ec5('0x26'),_0x6ec5('0x27'),_0x4adf14,_0x78c52c));}}return db['CmContact'][_0x6ec5('0x28')](_0x462488,{'raw':!![],'hooks':![],'fields':_[_0x6ec5('0x29')](_0x462488)})['then'](function(_0x249a8b){if(DUPLICATES&&DUPLICATES[_0x6ec5('0x19')]&&_0x48733b){_0x48733b[_0x6ec5('0x2a')](_[_0x6ec5('0x2b')](_0x462488,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x249a8b['id'];return _0x2ecdcf();})[_0x6ec5('0x2c')](function(_0x23a73c){return _0x358d18(handleCheckRowError(_0x6ec5('0x12'),_0x6ec5('0x2d')+(_0x23a73c['message']||JSON[_0x6ec5('0x2e')](_0x23a73c)),null,_0x78c52c));});});}function checkHopper(){function _0x4d8b6e(){return function(_0x9fec63){logger[_0x6ec5('0x12')](_0x6ec5('0x2f'),_0x6ec5('0x30'),util[_0x6ec5('0x31')](_0x9fec63,{'showHidden':![],'depth':null}));};}var _0xd501c4=function(_0xd2bd6f,_0xab380e){var _0x296d8f=squel[_0x6ec5('0x32')]()[_0x6ec5('0x33')]('cm_hopper')['fromQuery']([_0x6ec5('0x34'),'scheduledAt',_0x6ec5('0x35'),_0x6ec5('0x36'),_0xab380e,_0x6ec5('0x37'),_0x6ec5('0x38')],squel[_0x6ec5('0x39')]()[_0x6ec5('0x3a')](_0x6ec5('0x34'),'phone')[_0x6ec5('0x3a')](_0x6ec5('0x3b'),_0x6ec5('0x3c'))[_0x6ec5('0x3a')]('id',_0x6ec5('0x35'))[_0x6ec5('0x3a')](LISTID[_0x6ec5('0x3d')](),_0x6ec5('0x36'))[_0x6ec5('0x3a')](_0xd2bd6f['id']['toString'](),_0xab380e)[_0x6ec5('0x3a')]('NOW()',_0x6ec5('0x37'))['field'](_0x6ec5('0x3b'),_0x6ec5('0x38'))['from'](_0x6ec5('0x3e'))[_0x6ec5('0x3f')](_0x6ec5('0x40'))['where'](_0x6ec5('0x41'),LISTID[_0x6ec5('0x3d')]())['where'](_0x6ec5('0x42'))[_0x6ec5('0x3f')](_0x6ec5('0x43'),squel[_0x6ec5('0x39')]()[_0x6ec5('0x3a')](_0x6ec5('0x34'))[_0x6ec5('0x44')](_0x6ec5('0x45'))[_0x6ec5('0x3f')](_0xab380e+_0x6ec5('0x46'),_0xd2bd6f['id'][_0x6ec5('0x3d')]())))['toString']();return _0x296d8f;};var _0x17cfed=function(_0x3af877,_0x468a74){var _0xdbf1e8=squel['insert']()[_0x6ec5('0x33')](_0x6ec5('0x45'))['fromQuery']([_0x6ec5('0x34'),'scheduledAt',_0x6ec5('0x35'),_0x6ec5('0x36'),_0x468a74,_0x6ec5('0x37'),_0x6ec5('0x38')],squel['select']()['field'](_0x6ec5('0x34'),'phone')[_0x6ec5('0x3a')](_0x6ec5('0x3b'),_0x6ec5('0x3c'))[_0x6ec5('0x3a')]('id',_0x6ec5('0x35'))['field'](LISTID['toString'](),_0x6ec5('0x36'))[_0x6ec5('0x3a')](_0x3af877['id'][_0x6ec5('0x3d')](),_0x468a74)[_0x6ec5('0x3a')](_0x6ec5('0x3b'),_0x6ec5('0x37'))[_0x6ec5('0x3a')](_0x6ec5('0x3b'),_0x6ec5('0x38'))[_0x6ec5('0x44')](_0x6ec5('0x3e'))[_0x6ec5('0x3f')](_0x6ec5('0x40'))[_0x6ec5('0x3f')]('ListId\x20=\x20?',LISTID[_0x6ec5('0x3d')]())['where'](_0x6ec5('0x47'),squel[_0x6ec5('0x48')](hopperContacts))['where'](_0x6ec5('0x42'))[_0x6ec5('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6ec5('0x39')]()[_0x6ec5('0x3a')]('calleridnum')['from'](_0x6ec5('0x49'))['where'](_0x468a74+'\x20=\x20?',_0x3af877['id'][_0x6ec5('0x3d')]()))[_0x6ec5('0x3f')](_0x6ec5('0x43'),squel[_0x6ec5('0x39')]()['field'](_0x6ec5('0x34'))[_0x6ec5('0x44')](_0x6ec5('0x45'))[_0x6ec5('0x3f')](_0x468a74+_0x6ec5('0x46'),_0x3af877['id'][_0x6ec5('0x3d')]())))[_0x6ec5('0x3d')]();return _0xdbf1e8;};function _0x29bf52(_0xc52e91,_0x404ec9){var _0x29317f=squel[_0x6ec5('0x32')]()[_0x6ec5('0x33')]('cm_hopper')[_0x6ec5('0x4a')]([_0x6ec5('0x34'),'scheduledAt',_0x6ec5('0x35'),_0x6ec5('0x36'),_0x404ec9,_0x6ec5('0x37'),_0x6ec5('0x38')],squel[_0x6ec5('0x39')]()['field']('phone',_0x6ec5('0x34'))['field'](_0x6ec5('0x3b'),_0x6ec5('0x3c'))[_0x6ec5('0x3a')]('id',_0x6ec5('0x35'))[_0x6ec5('0x3a')](LISTID['toString'](),_0x6ec5('0x36'))['field'](_0xc52e91['id']['toString'](),_0x404ec9)['field'](_0x6ec5('0x3b'),_0x6ec5('0x37'))['field']('NOW()',_0x6ec5('0x38'))[_0x6ec5('0x44')](_0x6ec5('0x3e'))[_0x6ec5('0x3f')](_0x6ec5('0x40'))['where'](_0x6ec5('0x41'),LISTID[_0x6ec5('0x3d')]())[_0x6ec5('0x3f')](_0x6ec5('0x47'),squel[_0x6ec5('0x48')](hopperContacts))['where'](_0x6ec5('0x42')))[_0x6ec5('0x3d')]();return _0x29317f;}function _0x278c00(_0x5c00c4,_0x2a5a1){var _0xe8a888=squel[_0x6ec5('0x32')]()[_0x6ec5('0x33')](_0x6ec5('0x4b'))[_0x6ec5('0x4a')]([_0x6ec5('0x34'),_0x6ec5('0x35'),_0x6ec5('0x36'),_0x2a5a1,_0x6ec5('0x37'),_0x6ec5('0x38')],squel[_0x6ec5('0x39')]()[_0x6ec5('0x3a')]('phone',_0x6ec5('0x34'))['field']('id',_0x6ec5('0x35'))['field'](LISTID['toString'](),_0x6ec5('0x36'))[_0x6ec5('0x3a')](_0x5c00c4['id'][_0x6ec5('0x3d')](),_0x2a5a1)[_0x6ec5('0x3a')](_0x6ec5('0x3b'),'createdAt')[_0x6ec5('0x3a')](_0x6ec5('0x3b'),_0x6ec5('0x38'))[_0x6ec5('0x44')](_0x6ec5('0x3e'))['where'](_0x6ec5('0x40'))[_0x6ec5('0x3f')](_0x6ec5('0x41'),LISTID[_0x6ec5('0x3d')]())['where'](_0x6ec5('0x47'),squel[_0x6ec5('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x6ec5('0x3d')]();return _0xe8a888;}return db[_0x6ec5('0x4c')][_0x6ec5('0x4d')]({'where':{'type':_0x6ec5('0x4e')},'attributes':['id',_0x6ec5('0x4f')],'include':[{'model':db[_0x6ec5('0x50')],'as':_0x6ec5('0x51'),'where':{'id':LISTID}}]})[_0x6ec5('0x52')](function(_0xdfe6c6){var _0x4208dd=[];if(_0xdfe6c6){var _0x37503f;for(var _0x5c297f=0x0,_0x2dcd18;_0x5c297f<_0xdfe6c6[_0x6ec5('0x19')];_0x5c297f+=0x1){_0x2dcd18=_0xdfe6c6[_0x5c297f][_0x6ec5('0x53')]({'plain':!![]});switch(_0x2dcd18[_0x6ec5('0x4f')]){case'always':_0x4208dd[_0x6ec5('0x2a')](db[_0x6ec5('0x54')][_0x6ec5('0x55')](_0x17cfed(_0x2dcd18,_0x6ec5('0x56')))['then'](function(){})[_0x6ec5('0x2c')](_0x4d8b6e()));break;case _0x6ec5('0x57'):_0x4208dd[_0x6ec5('0x2a')](db['sequelize']['query'](_0xd501c4(_0x2dcd18,_0x6ec5('0x56')))[_0x6ec5('0x52')](function(){})['catch'](_0x4d8b6e()));break;default:_0x4208dd[_0x6ec5('0x2a')](db[_0x6ec5('0x54')][_0x6ec5('0x55')](_0x29bf52(_0x2dcd18,_0x6ec5('0x56')))['then'](function(){})[_0x6ec5('0x2c')](_0x4d8b6e()));}}}return _0x4208dd;})[_0x6ec5('0x58')]()[_0x6ec5('0x52')](function(){return db['VoiceQueue'][_0x6ec5('0x4d')]({'where':{'type':_0x6ec5('0x4e')},'attributes':['id'],'include':[{'model':db[_0x6ec5('0x50')],'as':_0x6ec5('0x59'),'where':{'id':LISTID}}]})[_0x6ec5('0x52')](function(_0xb7d939){var _0x26b242=[];if(_0xb7d939){var _0xf44b2b;for(var _0x4bf096=0x0,_0x195461;_0x4bf096<_0xb7d939[_0x6ec5('0x19')];_0x4bf096+=0x1){_0x195461=_0xb7d939[_0x4bf096]['get']({'plain':!![]});_0x26b242['push'](db[_0x6ec5('0x54')][_0x6ec5('0x55')](_0x278c00(_0x195461,_0x6ec5('0x56')))['then'](function(){})[_0x6ec5('0x2c')](_0x4d8b6e()));}}return _0x26b242;})[_0x6ec5('0x58')]();})[_0x6ec5('0x52')](function(){return db[_0x6ec5('0x5a')]['findAll']({'attributes':['id',_0x6ec5('0x4f')],'include':[{'model':db[_0x6ec5('0x50')],'as':_0x6ec5('0x51'),'where':{'id':LISTID}}]})[_0x6ec5('0x52')](function(_0x42fa7b){var _0x41e0b1=[];if(_0x42fa7b){for(var _0x1bbb57=0x0,_0x245fe6;_0x1bbb57<_0x42fa7b[_0x6ec5('0x19')];_0x1bbb57+=0x1){_0x245fe6=_0x42fa7b[_0x1bbb57]['get']({'plain':!![]});switch(_0x245fe6['dialCheckDuplicateType']){case _0x6ec5('0x5b'):_0x41e0b1[_0x6ec5('0x2a')](db[_0x6ec5('0x54')]['query'](_0x17cfed(_0x245fe6,_0x6ec5('0x5c')))['then'](function(){})[_0x6ec5('0x2c')](_0x4d8b6e()));break;case _0x6ec5('0x57'):_0x41e0b1['push'](db['sequelize'][_0x6ec5('0x55')](_0xd501c4(_0x245fe6,_0x6ec5('0x5c')))[_0x6ec5('0x52')](function(){})[_0x6ec5('0x2c')](_0x4d8b6e()));break;default:_0x41e0b1['push'](db[_0x6ec5('0x54')][_0x6ec5('0x55')](_0x29bf52(_0x245fe6,_0x6ec5('0x5c')))['then'](function(){})['catch'](_0x4d8b6e()));}}}return _0x41e0b1;})['all']();})[_0x6ec5('0x52')](function(){return db[_0x6ec5('0x5a')][_0x6ec5('0x4d')]({'attributes':['id'],'include':[{'model':db[_0x6ec5('0x50')],'as':_0x6ec5('0x59'),'where':{'id':LISTID}}]})[_0x6ec5('0x52')](function(_0x75d506){var _0x543c38=[];if(_0x75d506){for(var _0x38ddcc=0x0,_0x5e6fad;_0x38ddcc<_0x75d506[_0x6ec5('0x19')];_0x38ddcc+=0x1){_0x5e6fad=_0x75d506[_0x38ddcc][_0x6ec5('0x53')]({'plain':!![]});_0x543c38['push'](db[_0x6ec5('0x54')][_0x6ec5('0x55')](_0x278c00(_0x5e6fad,'CampaignId'))[_0x6ec5('0x52')](function(){})[_0x6ec5('0x2c')](_0x4d8b6e()));}}return _0x543c38;})['all']();})[_0x6ec5('0x2c')](function(_0x1831d8){logger[_0x6ec5('0x12')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x1831d8[_0x6ec5('0x1b')]);});}var processPromises=function(_0x8f9c0e){return BPromise[_0x6ec5('0x58')](promises)[_0x6ec5('0x52')](function(_0x45fe0a){})[_0x6ec5('0x2c')](function(_0xf5ab73){logger[_0x6ec5('0x12')](_0x6ec5('0x5d'),JSON[_0x6ec5('0x2e')](_0xf5ab73));})[_0x6ec5('0x5e')](function(){socket[_0x6ec5('0x5f')](_0x6ec5('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x8f9c0e){return _0x8f9c0e['resume']();}});};var endCsv=function(){return BPromise[_0x6ec5('0x61')]()[_0x6ec5('0x52')](function(){if(hopperContacts){return checkHopper();}})[_0x6ec5('0x52')](function(){socket[_0x6ec5('0x5f')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x6ec5('0x62')](FILEPATH);}catch(_0x54597d){logger[_0x6ec5('0x12')](_0x6ec5('0x63'),JSON[_0x6ec5('0x2e')](_0x54597d));}finally{process[_0x6ec5('0x64')](0x0);}});};process['on'](_0x6ec5('0x65'),function(){logger[_0x6ec5('0x66')](_0x6ec5('0x67'));endCsv();});function main(){return BPromise['resolve']()[_0x6ec5('0x52')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x6ec5('0xf')](',');return db['CmContact'][_0x6ec5('0x4d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x6ec5('0x52')](function(_0x97570e){var _0xc7f040=fs[_0x6ec5('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x6ec5('0x69')](_0xc7f040,{'header':!![],'skipEmptyLines':!![],'step':function(_0xfbcf6,_0xc029e){total+=0x1;var _0x222ae0=total;promises[_0x6ec5('0x2a')](checkRow(_0xfbcf6,_0x97570e,_0x222ae0)[_0x6ec5('0x52')](function(){success+=0x1;})[_0x6ec5('0x2c')](function(_0xc6dcd){if(_0xc6dcd[_0x6ec5('0x12')]){errors+=0x1;delete _0xc6dcd[_0x6ec5('0x12')];}else if(_0xc6dcd['duplicate']){duplicates+=0x1;delete _0xc6dcd[_0x6ec5('0x26')];}rows['push'](_0xc6dcd);}));if(total%0xc8===0x0){_0xc029e[_0x6ec5('0x6a')]();return processPromises(_0xc029e);}},'complete':function(){return processPromises()[_0x6ec5('0x52')](function(){logger['info'](_0x6ec5('0x6b'));endCsv();});},'error':function(_0x3e60d9,_0x1c173b){logger[_0x6ec5('0x66')](_0x6ec5('0x6c'),JSON[_0x6ec5('0x2e')](_0x3e60d9));endCsv();}});})[_0x6ec5('0x2c')](function(_0x5a7fae){logger[_0x6ec5('0x12')](_0x6ec5('0x6d'),JSON[_0x6ec5('0x2e')](_0x5a7fae));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index f84f2fa..94e9206 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 _0x3e8e=['cm_contacts.UserId','insert','into','cm_hopper','fromQuery','createdAt','updatedAt','UserId','cm_contacts','cm_contacts.ListId\x20=\x20','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','ContactId','ListId','field','cm_hopper_black','\x20=\x20?','concat','keys','CompanyId','fields',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','message','push','code','query','spread','error','main','binding','socket_timestamp','root','header','writeFileSync','createReadStream','data','length','rows','errors','trim','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','phone','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','unlink','catch','exit','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','uncaughtException','path','lodash','util','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','localhost','format','test','select','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority'];(function(_0xed6f46,_0x1c9006){var _0x5b267c=function(_0x59f0d2){while(--_0x59f0d2){_0xed6f46['push'](_0xed6f46['shift']());}};_0x5b267c(++_0x1c9006);}(_0x3e8e,0x1eb));var _0xe3e8=function(_0x564ef3,_0x4f49e4){_0x564ef3=_0x564ef3-0x0;var _0x2c1f0d=_0x3e8e[_0x564ef3];return _0x2c1f0d;};'use strict';var fs=require('fs');var path=require(_0xe3e8('0x0'));var _=require(_0xe3e8('0x1'));var Papa=require('papaparse');var util=require(_0xe3e8('0x2'));var BPromise=require('bluebird');var moment=require(_0xe3e8('0x3'));var squel=require(_0xe3e8('0x4'));var db=require(_0xe3e8('0x5'))['db'];var config=require(_0xe3e8('0x6'));var logger=require(_0xe3e8('0x7'))('import');var socket=require('socket.io-emitter')({'host':_0xe3e8('0x8'),'port':0x18eb});var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xe3e8('0x9')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x3eff61){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))*$/[_0xe3e8('0xa')](_0x3eff61);}function selectNotIn(_0x2a65bf,_0x48995c,_0x73d787,_0x4b3825,_0x1e16c6){return squel[_0xe3e8('0xb')]()['field']('phone')[_0xe3e8('0xc')](_0x4b3825)['join'](_0x48995c,null,_0x48995c+_0xe3e8('0xd')+_0x4b3825+'.'+_0x73d787)[_0xe3e8('0xe')](_0x4b3825+'.'+_0x73d787+_0xe3e8('0xf')+_0x2a65bf+'.'+_0x73d787)['where'](_0x48995c+_0xe3e8('0x10')+_0x1e16c6[_0xe3e8('0x11')]()+')');}function insertCmHopper(_0x4b1cdd,_0x312531,_0xe027ef,_0x1fc155,_0x22aedb){var _0x1ee346=[_0xe3e8('0x12'),_0xe3e8('0x13'),_0xe3e8('0x14'),_0xe3e8('0x15'),_0x312531+'.'+_0x1fc155,_0xe3e8('0x16'),_0xe3e8('0x17'),_0xe3e8('0x18'),_0xe3e8('0x19'),'\x22'+_0x22aedb+'\x22'];return squel[_0xe3e8('0x1a')]()[_0xe3e8('0x1b')](_0xe3e8('0x1c'))[_0xe3e8('0x1d')](['phone','scheduledat','ContactId','ListId',_0x1fc155,_0xe3e8('0x1e'),_0xe3e8('0x1f'),'priority',_0xe3e8('0x20'),'recallme'],squel['select']()['fields'](_0x1ee346)['from'](_0x312531)[_0xe3e8('0x11')](_0xe3e8('0x21'),null,_0xe3e8('0x22')+_0x312531+'.CmListId')['join'](_0xe027ef,null,_0xe027ef+_0xe3e8('0xd')+_0x312531+'.'+_0x1fc155)['where'](_0x312531+'.CmListId\x20=\x20?',_0x4b1cdd)[_0xe3e8('0xe')](_0xe3e8('0x23'),NOW)[_0xe3e8('0xe')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x312531,_0xe027ef,_0x1fc155,_0xe3e8('0x1c'),[_0xe3e8('0x24'),_0xe3e8('0x25')]))[_0xe3e8('0xe')](_0xe3e8('0x26'),selectNotIn(_0x312531,_0xe027ef,_0x1fc155,_0xe3e8('0x1c'),['\x22always\x22'])))[_0xe3e8('0x27')]();}function insertCmHopperBlack(_0xe790ea,_0x2c6183,_0x220e6e,_0x35424e){var _0x520840=['cm_contacts.phone',_0xe3e8('0x14'),_0xe3e8('0x15'),_0x2c6183+'.'+_0x35424e,_0xe3e8('0x16'),_0xe3e8('0x17')];return squel[_0xe3e8('0x1a')]()[_0xe3e8('0x1b')]('cm_hopper_black')[_0xe3e8('0x1d')](['phone',_0xe3e8('0x28'),_0xe3e8('0x29'),_0x35424e,'createdAt',_0xe3e8('0x1f')],squel['select']()['fields'](_0x520840)['from'](_0x2c6183)['join'](_0xe3e8('0x21'),null,'cm_contacts.ListId\x20=\x20'+_0x2c6183+'.CmListId')[_0xe3e8('0x11')](_0x220e6e,null,_0x220e6e+'.id\x20=\x20'+_0x2c6183+'.'+_0x35424e)[_0xe3e8('0xe')](_0x2c6183+'.CmListId\x20=\x20?',_0xe790ea)[_0xe3e8('0xe')](_0xe3e8('0x23'),NOW)[_0xe3e8('0xe')](_0xe3e8('0x26'),squel[_0xe3e8('0xb')]()[_0xe3e8('0x2a')]('phone')['from'](_0xe3e8('0x2b'))[_0xe3e8('0xe')]('ListId\x20=\x20?',_0xe790ea)[_0xe3e8('0xe')](_0x35424e+_0xe3e8('0x2c'),_0x2c6183+'.'+_0x35424e)))[_0xe3e8('0x27')]();}function insertCmContact(_0x1eac99,_0x51be3e,_0x34cf38,_0x17a908){var _0x38d6f9=_[_0xe3e8('0x2d')](_[_0xe3e8('0x2e')](_0x17a908),[_0xe3e8('0x29'),_0xe3e8('0x2f'),_0xe3e8('0x1e'),'updatedAt']);return squel[_0xe3e8('0x1a')]()['into'](_0xe3e8('0x21'))[_0xe3e8('0x1d')](_0x38d6f9,squel['select']()[_0xe3e8('0x30')](_0x38d6f9)[_0xe3e8('0xc')](_0x51be3e)[_0xe3e8('0xe')]('('+_0x34cf38['join'](',')+_0xe3e8('0x31'),squel[_0xe3e8('0xb')]()[_0xe3e8('0x30')](_0x34cf38)[_0xe3e8('0xc')]('cm_contacts')[_0xe3e8('0xe')](_0xe3e8('0x32'),_0x1eac99))['where'](_0xe3e8('0x33'),squel[_0xe3e8('0xb')]()[_0xe3e8('0x2a')](_0xe3e8('0x34'),'min_id')[_0xe3e8('0xc')](_0x51be3e)[_0xe3e8('0x35')](_0x34cf38[_0xe3e8('0x11')](','))))['toString']();}function handleStop(){logger[_0xe3e8('0x36')](_0xe3e8('0x37'));stopped=!![];}function handleUncaughtException(_0x1db51e){logger['error'](_0x1db51e[_0xe3e8('0x38')]);process['exit'](0x1);}function handleError(_0x5e25a1,_0x677eaa){stats['errors'][_0xe3e8('0x39')]({'name':_0x677eaa[_0xe3e8('0x3a')],'message':_0x677eaa[_0xe3e8('0x38')],'row':_0x5e25a1});}function handleQuery(_0x108650){logger[_0xe3e8('0x36')](_0x108650);return db['sequelize'][_0xe3e8('0x3b')](_0x108650)[_0xe3e8('0x3c')](function(_0x35b403){results[_0xe3e8('0x39')](_0x35b403);})['catch'](function(_0x58ce2d){logger[_0xe3e8('0x3d')](_0x58ce2d[_0xe3e8('0x38')]);});}function main(_0x29de96,_0x49c2b0,_0x722b1f,_0x5e7fa3){logger[_0xe3e8('0x36')](_0xe3e8('0x3e'),_0x29de96,JSON['stringify'](_0x49c2b0));process['send']('start');var _0x444d15=_0x49c2b0[_0xe3e8('0x3f')];var _0x3a6d1b=_0x49c2b0[_0xe3e8('0x40')];var _0x2ef8e3=path[_0xe3e8('0x11')](config[_0xe3e8('0x41')],'server/files/tmp',_0x3a6d1b+'.csv');var _0x14ee61=_[_0xe3e8('0x2e')](_0x444d15)['join']();logger[_0xe3e8('0x36')](_0xe3e8('0x42'),_0x14ee61);fs[_0xe3e8('0x43')](_0x2ef8e3,_0x14ee61+'\x0a');Papa['parse'](fs[_0xe3e8('0x44')](_0x29de96),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3e67a7,_0x9b9b29){try{for(var _0xc96542=0x0,_0xaef44c=[];_0xc96542<_0x3e67a7[_0xe3e8('0x45')][_0xe3e8('0x46')];_0xc96542++){stats[_0xe3e8('0x47')]+=0x1;if(_0x3e67a7['errors'][_0xc96542]){handleError(_0x3e67a7[_0xe3e8('0x45')][_0xc96542],_0x3e67a7[_0xe3e8('0x48')][_0xc96542]);}else{var _0x5491d0=[];for(var _0x291fed in _0x444d15){if(_0x444d15['hasOwnProperty'](_0x291fed)){if(_0x3e67a7[_0xe3e8('0x45')][_0xc96542][_0x444d15[_0x291fed]]){var _0x2120e3=_[_0xe3e8('0x49')](_0x3e67a7[_0xe3e8('0x45')][_0xc96542][_0x444d15[_0x291fed]]['replace'](/"/g,'\x27'));switch(_0x291fed){case _0xe3e8('0x4a'):var _0x2c98b2=moment(_0x2120e3,_0xe3e8('0x4b'),!![]);if(_0x2c98b2[_0xe3e8('0x4c')]()){_0xaef44c[_0xe3e8('0x39')]('\x22'+_0x2120e3+'\x22');}else{_0x5491d0[_0xe3e8('0x39')](_0xe3e8('0x4d'));}break;case _0xe3e8('0x4e'):var _0x37eaff=parseInt(_0x2120e3);_0x2120e3=_[_0xe3e8('0x4f')](_0x37eaff)||_0x37eaff<0x0||_0x37eaff>0x4?_0x5e7fa3?0x3:0x2:_0x37eaff;_0xaef44c[_0xe3e8('0x39')]('\x22'+_0x2120e3+'\x22');break;case _0xe3e8('0x20'):var _0x553496=parseInt(_0x2120e3);if(_[_0xe3e8('0x50')](_0x553496)&&_[_0xe3e8('0x51')](_0x722b1f,_0x553496)){_0xaef44c[_0xe3e8('0x39')]('\x22'+_0x553496+'\x22');}else{_0x5491d0[_0xe3e8('0x39')](_0xe3e8('0x52'));}break;case _0xe3e8('0x53'):if(isEmail(_0x2120e3)){_0xaef44c[_0xe3e8('0x39')]('\x22'+_0x2120e3+'\x22');}else{_0x5491d0[_0xe3e8('0x39')]('email\x20wrong\x20format');}break;case _0xe3e8('0x54'):var _0x2e8376=moment(_0x2120e3,_0xe3e8('0x55'),!![]);if(_0x2e8376['isValid']()){_0xaef44c[_0xe3e8('0x39')]('\x22'+_0x2120e3+'\x22');}else{_0x5491d0['push'](_0xe3e8('0x56'));}break;default:_0xaef44c[_0xe3e8('0x39')]('\x22'+_0x2120e3+'\x22');}}else{switch(_0x291fed){case _0xe3e8('0x57'):case _0xe3e8('0x58'):_0x5491d0[_0xe3e8('0x39')](_0x291fed+_0xe3e8('0x59'));break;default:_0xaef44c['push']('\x22\x22');}}}}if(_0x5491d0[_0xe3e8('0x46')]){handleError(_0x3e67a7['data'][_0xc96542],{'code':_0xe3e8('0x5a'),'message':_0x5491d0[_0xe3e8('0x11')]()});}else{fs[_0xe3e8('0x5b')](_0x2ef8e3,_0xaef44c[_0xe3e8('0x11')]()+'\x0a');}_0xaef44c=[];}if(!(stats[_0xe3e8('0x47')]%0xc8)){socket[_0xe3e8('0x5c')](_0xe3e8('0x5d')+_0x3a6d1b,stats);stats['errors']=[];}}if(stopped){logger[_0xe3e8('0x36')](_0xe3e8('0x5e'));_0x9b9b29[_0xe3e8('0x5f')]();}}catch(_0x3cb78a){handleError(_0x3e67a7['data'][_0xc96542],{'code':_0xe3e8('0x60'),'message':_0x3cb78a[_0xe3e8('0x38')]});logger['error'](_0xe3e8('0x61'),_0x3cb78a[_0xe3e8('0x38')]);}},'complete':function(){try{var _0x318ab8=[];var _0x3a52f9=_0xe3e8('0x21');if(_0x49c2b0[_0xe3e8('0x62')]&&_0x49c2b0[_0xe3e8('0x62')][_0xe3e8('0x46')]){_0x3a52f9=_0xe3e8('0x63')+_0x3a6d1b;_0x318ab8[_0xe3e8('0x39')](_0xe3e8('0x64')+_0x3a52f9+_0xe3e8('0x65'));}var _0x54a949=util['format'](_0xe3e8('0x66'),_0x2ef8e3,_0x3a52f9,_0x14ee61,_0x49c2b0[_0xe3e8('0x29')],_0x49c2b0[_0xe3e8('0x2f')]||null,NOW,NOW);if(_[_0xe3e8('0x67')](_0x444d15[_0xe3e8('0x4a')])){_0x54a949+=',\x20scheduledAt\x20=\x20NOW()';}_0x318ab8[_0xe3e8('0x39')](_0x54a949);if(_0x49c2b0['duplicates']&&_0x49c2b0[_0xe3e8('0x62')][_0xe3e8('0x46')]){_0x318ab8['push'](insertCmContact(_0x49c2b0[_0xe3e8('0x29')],_0x3a52f9,_0x49c2b0[_0xe3e8('0x62')],_0x444d15));_0x318ab8[_0xe3e8('0x39')](_0xe3e8('0x68')+_0x3a52f9+';');}_0x318ab8[_0xe3e8('0x39')](insertCmHopper(_0x49c2b0[_0xe3e8('0x29')],_0xe3e8('0x69'),_0xe3e8('0x6a'),'VoiceQueueId',_0x5e7fa3));_0x318ab8['push'](insertCmHopperBlack(_0x49c2b0['ListId'],_0xe3e8('0x6b'),'voice_queues','VoiceQueueId'));_0x318ab8['push'](insertCmHopper(_0x49c2b0[_0xe3e8('0x29')],_0xe3e8('0x6c'),_0xe3e8('0x6d'),_0xe3e8('0x6e'),_0x5e7fa3));_0x318ab8['push'](insertCmHopperBlack(_0x49c2b0[_0xe3e8('0x29')],_0xe3e8('0x6f'),_0xe3e8('0x6d'),_0xe3e8('0x6e')));BPromise[_0xe3e8('0x70')](_0x318ab8,handleQuery)[_0xe3e8('0x71')](function(_0x2dc32f){stats[_0xe3e8('0x72')]=!![];stats[_0xe3e8('0x73')]=_0x49c2b0[_0xe3e8('0x62')]&&_0x49c2b0['duplicates']['length']?results[0x2]['affectedRows']:results[0x0][_0xe3e8('0x73')];socket[_0xe3e8('0x5c')](_0xe3e8('0x5d')+_0x3a6d1b,stats);fs[_0xe3e8('0x74')](_0x29de96);fs['unlink'](_0x2ef8e3);process['exit'](0x0);})[_0xe3e8('0x75')](function(_0x3695fe){logger['error'](_0x3695fe[_0xe3e8('0x38')]);process[_0xe3e8('0x76')](0x1);});}catch(_0x1eb9bd){logger[_0xe3e8('0x3d')](_0xe3e8('0x77'),_0x1eb9bd[_0xe3e8('0x38')]);process['exit'](0x1);}},'error':function(_0x109b35,_0x17c1df,_0x30f2ad,_0x2c6e74){throw new Error(_0x2c6e74);}});}function validate(){if(process[_0xe3e8('0x78')]&&process[_0xe3e8('0x78')]['length']<0x4){throw new Error(_0xe3e8('0x79'));}var _0x4a524f=path[_0xe3e8('0x11')](config['root'],'server/files/tmp',process[_0xe3e8('0x78')][0x2]);if(!fs[_0xe3e8('0x7a')](_0x4a524f)){throw new Error(_0xe3e8('0x7b'));}var _0x17ba2e={};try{_0x17ba2e=JSON[_0xe3e8('0x7c')](process['argv'][0x3]);if(!_0x17ba2e[_0xe3e8('0x3f')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x17ba2e['binding']['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0x17ba2e[_0xe3e8('0x3f')]['firstName']){throw new Error('firstName\x20is\x20mandatory');}var _0x44b5c9=0x0;if(_0x17ba2e['binding'][_0xe3e8('0x20')]){_0x44b5c9=0x1;}if(!_0x17ba2e['ListId']){throw new Error(_0xe3e8('0x7d'));}}catch(_0x27ea10){throw new Error(_0xe3e8('0x7e'));}var _0x54d4=[];try{_0x54d4=_[_0xe3e8('0x7f')](JSON[_0xe3e8('0x7c')](process[_0xe3e8('0x78')][0x4]),'id');}catch(_0x49bb39){logger[_0xe3e8('0x36')]('No\x20agent\x20available');}main(_0x4a524f,_0x17ba2e,_0x54d4,_0x44b5c9);}validate();process['on']('SIGINT',handleStop);process['on'](_0xe3e8('0x80'),handleUncaughtException); \ No newline at end of file +var _0xdff1=['cm_hopper_black','\x20=\x20?','toString','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','MIN(id)','min_id','info','Received\x20SIGINT','error','message','errors','code','push','catch','send','socket_timestamp','root','server/files/tmp','.csv','header','parse','createReadStream','data','length','rows','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','emit','unlink','exit','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','util','bluebird','moment','squel','../../../config/environment','../../../config/logger','socket.io-emitter','localhost','format','test','select','field','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','phone','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.id','cm_contacts.updatedAt','.CmListId\x20=\x20?'];(function(_0x4744d0,_0x18b832){var _0x46a7f1=function(_0x45e1fa){while(--_0x45e1fa){_0x4744d0['push'](_0x4744d0['shift']());}};_0x46a7f1(++_0x18b832);}(_0xdff1,0xd4));var _0x1dff=function(_0x5c3121,_0x3a69e9){_0x5c3121=_0x5c3121-0x0;var _0xa9662c=_0xdff1[_0x5c3121];return _0xa9662c;};'use strict';var fs=require('fs');var path=require(_0x1dff('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0x1dff('0x1'));var BPromise=require(_0x1dff('0x2'));var moment=require(_0x1dff('0x3'));var squel=require(_0x1dff('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x1dff('0x5'));var logger=require(_0x1dff('0x6'))('import');var socket=require(_0x1dff('0x7'))({'host':_0x1dff('0x8'),'port':0x18eb});var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x1dff('0x9')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x513d90){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))*$/[_0x1dff('0xa')](_0x513d90);}function selectNotIn(_0x318fc1,_0x508b2f,_0x59c02c,_0x4a1b64,_0x6357fd){return squel[_0x1dff('0xb')]()[_0x1dff('0xc')]('phone')['from'](_0x4a1b64)[_0x1dff('0xd')](_0x508b2f,null,_0x508b2f+_0x1dff('0xe')+_0x4a1b64+'.'+_0x59c02c)[_0x1dff('0xf')](_0x4a1b64+'.'+_0x59c02c+_0x1dff('0x10')+_0x318fc1+'.'+_0x59c02c)[_0x1dff('0xf')](_0x508b2f+_0x1dff('0x11')+_0x6357fd[_0x1dff('0xd')]()+')');}function insertCmHopper(_0x320da9,_0x4cde3c,_0x46a065,_0x45df49,_0x20ed9b){var _0x12b57b=[_0x1dff('0x12'),_0x1dff('0x13'),'cm_contacts.id',_0x1dff('0x14'),_0x4cde3c+'.'+_0x45df49,_0x1dff('0x15'),'cm_contacts.updatedAt',_0x1dff('0x16'),_0x1dff('0x17'),'\x22'+_0x20ed9b+'\x22'];return squel[_0x1dff('0x18')]()[_0x1dff('0x19')](_0x1dff('0x1a'))['fromQuery']([_0x1dff('0x1b'),_0x1dff('0x1c'),_0x1dff('0x1d'),_0x1dff('0x1e'),_0x45df49,_0x1dff('0x1f'),_0x1dff('0x20'),_0x1dff('0x21'),_0x1dff('0x22'),_0x1dff('0x23')],squel['select']()[_0x1dff('0x24')](_0x12b57b)[_0x1dff('0x25')](_0x4cde3c)[_0x1dff('0xd')](_0x1dff('0x26'),null,_0x1dff('0x27')+_0x4cde3c+_0x1dff('0x28'))['join'](_0x46a065,null,_0x46a065+_0x1dff('0xe')+_0x4cde3c+'.'+_0x45df49)['where'](_0x4cde3c+'.CmListId\x20=\x20?',_0x320da9)['where'](_0x1dff('0x29'),NOW)[_0x1dff('0xf')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4cde3c,_0x46a065,_0x45df49,_0x1dff('0x1a'),[_0x1dff('0x2a'),_0x1dff('0x2b')]))[_0x1dff('0xf')](_0x1dff('0x2c'),selectNotIn(_0x4cde3c,_0x46a065,_0x45df49,_0x1dff('0x1a'),[_0x1dff('0x2a')])))['toString']();}function insertCmHopperBlack(_0x4380ad,_0x5da8d6,_0x1c138a,_0x5ed73a){var _0x3f4fe9=[_0x1dff('0x12'),_0x1dff('0x2d'),_0x1dff('0x14'),_0x5da8d6+'.'+_0x5ed73a,_0x1dff('0x15'),_0x1dff('0x2e')];return squel[_0x1dff('0x18')]()[_0x1dff('0x19')]('cm_hopper_black')['fromQuery']([_0x1dff('0x1b'),'ContactId',_0x1dff('0x1e'),_0x5ed73a,_0x1dff('0x1f'),_0x1dff('0x20')],squel['select']()[_0x1dff('0x24')](_0x3f4fe9)[_0x1dff('0x25')](_0x5da8d6)['join'](_0x1dff('0x26'),null,_0x1dff('0x27')+_0x5da8d6+_0x1dff('0x28'))[_0x1dff('0xd')](_0x1c138a,null,_0x1c138a+_0x1dff('0xe')+_0x5da8d6+'.'+_0x5ed73a)[_0x1dff('0xf')](_0x5da8d6+_0x1dff('0x2f'),_0x4380ad)[_0x1dff('0xf')](_0x1dff('0x29'),NOW)[_0x1dff('0xf')](_0x1dff('0x2c'),squel[_0x1dff('0xb')]()[_0x1dff('0xc')]('phone')['from'](_0x1dff('0x30'))[_0x1dff('0xf')]('ListId\x20=\x20?',_0x4380ad)[_0x1dff('0xf')](_0x5ed73a+_0x1dff('0x31'),_0x5da8d6+'.'+_0x5ed73a)))[_0x1dff('0x32')]();}function insertCmContact(_0x751f35,_0x400794,_0x7439d2,_0x2e1652){var _0x6c75a3=_['concat'](_['keys'](_0x2e1652),[_0x1dff('0x1e'),_0x1dff('0x33'),_0x1dff('0x1f'),_0x1dff('0x20')]);return squel[_0x1dff('0x18')]()[_0x1dff('0x19')](_0x1dff('0x26'))['fromQuery'](_0x6c75a3,squel[_0x1dff('0xb')]()[_0x1dff('0x24')](_0x6c75a3)[_0x1dff('0x25')](_0x400794)[_0x1dff('0xf')]('('+_0x7439d2[_0x1dff('0xd')](',')+_0x1dff('0x34'),squel[_0x1dff('0xb')]()['fields'](_0x7439d2)['from'](_0x1dff('0x26'))[_0x1dff('0xf')](_0x1dff('0x35'),_0x751f35))[_0x1dff('0xf')]('id\x20IN\x20?',squel[_0x1dff('0xb')]()[_0x1dff('0xc')](_0x1dff('0x36'),_0x1dff('0x37'))[_0x1dff('0x25')](_0x400794)['group'](_0x7439d2[_0x1dff('0xd')](','))))['toString']();}function handleStop(){logger[_0x1dff('0x38')](_0x1dff('0x39'));stopped=!![];}function handleUncaughtException(_0x70515f){logger[_0x1dff('0x3a')](_0x70515f[_0x1dff('0x3b')]);process['exit'](0x1);}function handleError(_0x3cebbf,_0x1e44d7){stats[_0x1dff('0x3c')]['push']({'name':_0x1e44d7[_0x1dff('0x3d')],'message':_0x1e44d7[_0x1dff('0x3b')],'row':_0x3cebbf});}function handleQuery(_0x398ab8){logger[_0x1dff('0x38')](_0x398ab8);return db['sequelize']['query'](_0x398ab8)['spread'](function(_0x62327c){results[_0x1dff('0x3e')](_0x62327c);})[_0x1dff('0x3f')](function(_0x5446f9){logger[_0x1dff('0x3a')](_0x5446f9[_0x1dff('0x3b')]);});}function main(_0x55ec55,_0x3f900e,_0x5edf99,_0x251f45){logger[_0x1dff('0x38')]('main',_0x55ec55,JSON['stringify'](_0x3f900e));process[_0x1dff('0x40')]('start');var _0x3be283=_0x3f900e['binding'];var _0x3f2680=_0x3f900e[_0x1dff('0x41')];var _0x31e0c6=path[_0x1dff('0xd')](config[_0x1dff('0x42')],_0x1dff('0x43'),_0x3f2680+_0x1dff('0x44'));var _0xf1159=_['keys'](_0x3be283)[_0x1dff('0xd')]();logger[_0x1dff('0x38')](_0x1dff('0x45'),_0xf1159);fs['writeFileSync'](_0x31e0c6,_0xf1159+'\x0a');Papa[_0x1dff('0x46')](fs[_0x1dff('0x47')](_0x55ec55),{'header':!![],'skipEmptyLines':!![],'step':function(_0x29ee42,_0x589457){try{for(var _0x5adeda=0x0,_0x362277=[];_0x5adeda<_0x29ee42[_0x1dff('0x48')][_0x1dff('0x49')];_0x5adeda++){stats[_0x1dff('0x4a')]+=0x1;if(_0x29ee42[_0x1dff('0x3c')][_0x5adeda]){handleError(_0x29ee42[_0x1dff('0x48')][_0x5adeda],_0x29ee42[_0x1dff('0x3c')][_0x5adeda]);}else{var _0x495987=[];for(var _0x5c07dd in _0x3be283){if(_0x3be283[_0x1dff('0x4b')](_0x5c07dd)){if(_0x29ee42[_0x1dff('0x48')][_0x5adeda][_0x3be283[_0x5c07dd]]){var _0x1f8b9e=_[_0x1dff('0x4c')](_0x29ee42[_0x1dff('0x48')][_0x5adeda][_0x3be283[_0x5c07dd]][_0x1dff('0x4d')](/"/g,'\x27'));switch(_0x5c07dd){case _0x1dff('0x1c'):var _0x1af830=moment(_0x1f8b9e,_0x1dff('0x4e'),!![]);if(_0x1af830['isValid']()){_0x362277['push']('\x22'+_0x1f8b9e+'\x22');}else{_0x495987[_0x1dff('0x3e')](_0x1dff('0x4f'));}break;case _0x1dff('0x21'):var _0x273ebb=parseInt(_0x1f8b9e);_0x1f8b9e=_[_0x1dff('0x50')](_0x273ebb)||_0x273ebb<0x0||_0x273ebb>0x4?_0x251f45?0x3:0x2:_0x273ebb;_0x362277['push']('\x22'+_0x1f8b9e+'\x22');break;case _0x1dff('0x22'):var _0xa6c963=parseInt(_0x1f8b9e);if(_[_0x1dff('0x51')](_0xa6c963)&&_[_0x1dff('0x52')](_0x5edf99,_0xa6c963)){_0x362277[_0x1dff('0x3e')]('\x22'+_0xa6c963+'\x22');}else{_0x495987['push'](_0x1dff('0x53'));}break;case _0x1dff('0x54'):if(isEmail(_0x1f8b9e)){_0x362277['push']('\x22'+_0x1f8b9e+'\x22');}else{_0x495987[_0x1dff('0x3e')](_0x1dff('0x55'));}break;case _0x1dff('0x56'):var _0xfcee6d=moment(_0x1f8b9e,'YYYY-MM-DD',!![]);if(_0xfcee6d[_0x1dff('0x57')]()){_0x362277[_0x1dff('0x3e')]('\x22'+_0x1f8b9e+'\x22');}else{_0x495987[_0x1dff('0x3e')](_0x1dff('0x58'));}break;default:_0x362277[_0x1dff('0x3e')]('\x22'+_0x1f8b9e+'\x22');}}else{switch(_0x5c07dd){case _0x1dff('0x59'):case'phone':_0x495987['push'](_0x5c07dd+'\x20not\x20specified');break;default:_0x362277['push']('\x22\x22');}}}}if(_0x495987[_0x1dff('0x49')]){handleError(_0x29ee42['data'][_0x5adeda],{'code':_0x1dff('0x5a'),'message':_0x495987['join']()});}else{fs[_0x1dff('0x5b')](_0x31e0c6,_0x362277[_0x1dff('0xd')]()+'\x0a');}_0x362277=[];}if(!(stats[_0x1dff('0x4a')]%0xc8)){socket['emit'](_0x1dff('0x5c')+_0x3f2680,stats);stats[_0x1dff('0x3c')]=[];}}if(stopped){logger[_0x1dff('0x38')](_0x1dff('0x5d'));_0x589457[_0x1dff('0x5e')]();}}catch(_0x5a08f7){handleError(_0x29ee42[_0x1dff('0x48')][_0x5adeda],{'code':_0x1dff('0x5f'),'message':_0x5a08f7[_0x1dff('0x3b')]});logger['error'](_0x1dff('0x60'),_0x5a08f7[_0x1dff('0x3b')]);}},'complete':function(){try{var _0x24db8b=[];var _0x594324=_0x1dff('0x26');if(_0x3f900e[_0x1dff('0x61')]&&_0x3f900e['duplicates'][_0x1dff('0x49')]){_0x594324=_0x1dff('0x62')+_0x3f2680;_0x24db8b['push'](_0x1dff('0x63')+_0x594324+_0x1dff('0x64'));}var _0x27838d=util['format'](_0x1dff('0x65'),_0x31e0c6,_0x594324,_0xf1159,_0x3f900e[_0x1dff('0x1e')],_0x3f900e[_0x1dff('0x33')]||null,NOW,NOW);if(_['isNil'](_0x3be283['scheduledat'])){_0x27838d+=',\x20scheduledAt\x20=\x20NOW()';}_0x24db8b[_0x1dff('0x3e')](_0x27838d);if(_0x3f900e[_0x1dff('0x61')]&&_0x3f900e[_0x1dff('0x61')][_0x1dff('0x49')]){_0x24db8b['push'](insertCmContact(_0x3f900e[_0x1dff('0x1e')],_0x594324,_0x3f900e[_0x1dff('0x61')],_0x3be283));_0x24db8b['push'](_0x1dff('0x66')+_0x594324+';');}_0x24db8b[_0x1dff('0x3e')](insertCmHopper(_0x3f900e[_0x1dff('0x1e')],_0x1dff('0x67'),_0x1dff('0x68'),_0x1dff('0x69'),_0x251f45));_0x24db8b[_0x1dff('0x3e')](insertCmHopperBlack(_0x3f900e[_0x1dff('0x1e')],_0x1dff('0x6a'),_0x1dff('0x68'),_0x1dff('0x69')));_0x24db8b[_0x1dff('0x3e')](insertCmHopper(_0x3f900e[_0x1dff('0x1e')],_0x1dff('0x6b'),_0x1dff('0x6c'),_0x1dff('0x6d'),_0x251f45));_0x24db8b[_0x1dff('0x3e')](insertCmHopperBlack(_0x3f900e['ListId'],_0x1dff('0x6e'),_0x1dff('0x6c'),_0x1dff('0x6d')));BPromise[_0x1dff('0x6f')](_0x24db8b,handleQuery)[_0x1dff('0x70')](function(_0x2f8ecd){stats[_0x1dff('0x71')]=!![];stats[_0x1dff('0x72')]=_0x3f900e[_0x1dff('0x61')]&&_0x3f900e[_0x1dff('0x61')][_0x1dff('0x49')]?results[0x2][_0x1dff('0x72')]:results[0x0][_0x1dff('0x72')];socket[_0x1dff('0x73')](_0x1dff('0x5c')+_0x3f2680,stats);fs[_0x1dff('0x74')](_0x55ec55);fs[_0x1dff('0x74')](_0x31e0c6);process[_0x1dff('0x75')](0x0);})[_0x1dff('0x3f')](function(_0x5e89fe){logger['error'](_0x5e89fe['message']);process[_0x1dff('0x75')](0x1);});}catch(_0x517ef9){logger['error']('complete',_0x517ef9[_0x1dff('0x3b')]);process[_0x1dff('0x75')](0x1);}},'error':function(_0x5765be,_0xd3201b,_0x91b42,_0x344fd0){throw new Error(_0x344fd0);}});}function validate(){if(process['argv']&&process[_0x1dff('0x76')][_0x1dff('0x49')]<0x4){throw new Error(_0x1dff('0x77'));}var _0x50af2e=path[_0x1dff('0xd')](config['root'],_0x1dff('0x43'),process[_0x1dff('0x76')][0x2]);if(!fs[_0x1dff('0x78')](_0x50af2e)){throw new Error(_0x1dff('0x79'));}var _0xefba6f={};try{_0xefba6f=JSON[_0x1dff('0x46')](process[_0x1dff('0x76')][0x3]);if(!_0xefba6f[_0x1dff('0x7a')]){throw new Error(_0x1dff('0x7b'));}if(!_0xefba6f['binding'][_0x1dff('0x1b')]){throw new Error('phone\x20is\x20mandatory');}if(!_0xefba6f[_0x1dff('0x7a')][_0x1dff('0x59')]){throw new Error('firstName\x20is\x20mandatory');}var _0x2cacbc=0x0;if(_0xefba6f[_0x1dff('0x7a')][_0x1dff('0x22')]){_0x2cacbc=0x1;}if(!_0xefba6f[_0x1dff('0x1e')]){throw new Error(_0x1dff('0x7c'));}}catch(_0x3f471e){throw new Error(_0x1dff('0x7d'));}var _0x4e5e22=[];try{_0x4e5e22=_[_0x1dff('0x7e')](JSON[_0x1dff('0x46')](process[_0x1dff('0x76')][0x4]),'id');}catch(_0x2bba01){logger['info'](_0x1dff('0x7f'));}main(_0x50af2e,_0xefba6f,_0x4e5e22,_0x2cacbc);}validate();process['on'](_0x1dff('0x80'),handleStop);process['on'](_0x1dff('0x81'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 4ad4d9c..86647c7 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 _0x4b84=['Answer\x20Time','answertime','Complete\x20Time','endtime','getSubjects','string','voice','toLowerCase','inbound','push','calleridnum','variable','destcalleridnum','***\x20Call\x20Info\x20***','keyValue','Caller\x20Name','calleridname','destexten','Queue','UniqueId','uniqueid','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','starttime'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4b84,0x1cc));var _0x44b8=function(_0x51beba,_0x202d19){_0x51beba=_0x51beba-0x0;var _0x167ee0=_0x4b84[_0x51beba];return _0x167ee0;};'use strict';exports[_0x44b8('0x0')]=function(_0x2ef8a8,_0x499894){var _0x5005fd=[{'type':_0x44b8('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x2ef8a8['toLowerCase']()){case _0x44b8('0x2'):switch(_0x499894[_0x44b8('0x3')]()){case _0x44b8('0x4'):_0x5005fd['push']({'type':'variable','content':'','variableName':'queue'});_0x5005fd[_0x44b8('0x5')]({'type':'variable','content':'','variableName':_0x44b8('0x6')});break;case'outbound':_0x5005fd[_0x44b8('0x5')]({'type':'string','content':'Outbound\x20Call','variableName':null});_0x5005fd[_0x44b8('0x5')]({'type':_0x44b8('0x7'),'content':'','variableName':_0x44b8('0x8')});break;}}return _0x5005fd;};exports['getDescriptions']=function(_0xc650ec,_0x2cc74b){var _0x4315f6=[];switch(_0xc650ec[_0x44b8('0x3')]()){case _0x44b8('0x2'):switch(_0x2cc74b[_0x44b8('0x3')]()){case _0x44b8('0x4'):_0x4315f6=[{'type':'string','content':_0x44b8('0x9'),'key':null,'keyType':null,'variableName':null},{'type':_0x44b8('0xa'),'content':'','key':'Caller\x20Number','keyType':_0x44b8('0x7'),'variableName':'calleridnum'},{'type':_0x44b8('0xa'),'content':'','key':_0x44b8('0xb'),'keyType':'variable','variableName':_0x44b8('0xc')},{'type':'keyValue','content':'','key':'Call\x20To','keyType':_0x44b8('0x7'),'variableName':_0x44b8('0xd')},{'type':_0x44b8('0xa'),'content':'','key':_0x44b8('0xe'),'keyType':'variable','variableName':'queue'},{'type':'keyValue','content':'','key':_0x44b8('0xf'),'keyType':'variable','variableName':_0x44b8('0x10')},{'type':_0x44b8('0xa'),'content':'','key':'Date','keyType':_0x44b8('0x7'),'variableName':_0x44b8('0x11')},{'type':'string','content':_0x44b8('0x12'),'key':null,'keyType':null,'variableName':null},{'type':_0x44b8('0xa'),'content':'','key':'Agent\x20Name','keyType':_0x44b8('0x7'),'variableName':_0x44b8('0x13')},{'type':_0x44b8('0xa'),'content':'','key':_0x44b8('0x14'),'keyType':_0x44b8('0x7'),'variableName':_0x44b8('0x8')},{'type':_0x44b8('0x1'),'content':_0x44b8('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0x44b8('0xa'),'content':'','key':_0x44b8('0x16'),'keyType':_0x44b8('0x7'),'variableName':_0x44b8('0x11')},{'type':'keyValue','content':'','key':_0x44b8('0x17'),'keyType':_0x44b8('0x7'),'variableName':_0x44b8('0x18')},{'type':_0x44b8('0xa'),'content':'','key':_0x44b8('0x19'),'keyType':'variable','variableName':_0x44b8('0x1a')},{'type':'keyValue','content':'','key':_0x44b8('0x1b'),'keyType':_0x44b8('0x7'),'variableName':_0x44b8('0x1c')},{'type':_0x44b8('0xa'),'content':'','key':_0x44b8('0x1d'),'keyType':'variable','variableName':_0x44b8('0x1e')}];break;case'outbound':_0x4315f6=[{'type':_0x44b8('0x1'),'content':_0x44b8('0x9'),'variableName':null},{'type':'keyValue','content':'','key':_0x44b8('0x1f'),'keyType':_0x44b8('0x7'),'keyContent':'','variableName':_0x44b8('0x8')},{'type':'keyValue','content':'','key':_0x44b8('0x20'),'keyType':_0x44b8('0x7'),'keyContent':'','variableName':'membername'},{'type':_0x44b8('0xa'),'content':'','key':'UniqueId','keyType':_0x44b8('0x7'),'keyContent':'','variableName':'uniqueid'},{'type':'keyValue','content':'','key':'Date','keyType':_0x44b8('0x7'),'keyContent':'','variableName':_0x44b8('0x21')},{'type':_0x44b8('0x1'),'content':_0x44b8('0x15')},{'type':_0x44b8('0xa'),'content':'','key':_0x44b8('0x22'),'keyType':_0x44b8('0x7'),'keyContent':'','variableName':_0x44b8('0x23')},{'type':_0x44b8('0xa'),'content':'','key':_0x44b8('0x24'),'keyType':_0x44b8('0x7'),'keyContent':'','variableName':_0x44b8('0x25')}];break;}}return _0x4315f6;}; \ No newline at end of file +var _0xb903=['[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','outbound','string','Outbound\x20Call','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridname','destexten','Queue','queue','uniqueid','Date','agentcalledAt','destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','agentconnectAt','Agent\x20Complete','agentcompleteAt','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','UniqueId','starttime','Answer\x20Time','answertime','endtime','getSubjects'];(function(_0x5a93a3,_0x544bc4){var _0x396f65=function(_0x5ab45a){while(--_0x5ab45a){_0x5a93a3['push'](_0x5a93a3['shift']());}};_0x396f65(++_0x544bc4);}(_0xb903,0x185));var _0x3b90=function(_0x4fe210,_0x405554){_0x4fe210=_0x4fe210-0x0;var _0x3f8678=_0xb903[_0x4fe210];return _0x3f8678;};'use strict';exports[_0x3b90('0x0')]=function(_0x3fd66b,_0x9b74ca){var _0x3d81e8=[{'type':'string','content':_0x3b90('0x1'),'variableName':null}];switch(_0x3fd66b[_0x3b90('0x2')]()){case _0x3b90('0x3'):switch(_0x9b74ca[_0x3b90('0x2')]()){case _0x3b90('0x4'):_0x3d81e8[_0x3b90('0x5')]({'type':_0x3b90('0x6'),'content':'','variableName':'queue'});_0x3d81e8[_0x3b90('0x5')]({'type':'variable','content':'','variableName':'calleridnum'});break;case _0x3b90('0x7'):_0x3d81e8[_0x3b90('0x5')]({'type':_0x3b90('0x8'),'content':_0x3b90('0x9'),'variableName':null});_0x3d81e8['push']({'type':'variable','content':'','variableName':'destcalleridnum'});break;}}return _0x3d81e8;};exports['getDescriptions']=function(_0x56261b,_0x55db3f){var _0x336913=[];switch(_0x56261b[_0x3b90('0x2')]()){case'voice':switch(_0x55db3f[_0x3b90('0x2')]()){case _0x3b90('0x4'):_0x336913=[{'type':'string','content':_0x3b90('0xa'),'key':null,'keyType':null,'variableName':null},{'type':_0x3b90('0xb'),'content':'','key':_0x3b90('0xc'),'keyType':'variable','variableName':'calleridnum'},{'type':_0x3b90('0xb'),'content':'','key':'Caller\x20Name','keyType':'variable','variableName':_0x3b90('0xd')},{'type':_0x3b90('0xb'),'content':'','key':'Call\x20To','keyType':'variable','variableName':_0x3b90('0xe')},{'type':_0x3b90('0xb'),'content':'','key':_0x3b90('0xf'),'keyType':_0x3b90('0x6'),'variableName':_0x3b90('0x10')},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0x3b90('0x6'),'variableName':_0x3b90('0x11')},{'type':'keyValue','content':'','key':_0x3b90('0x12'),'keyType':_0x3b90('0x6'),'variableName':_0x3b90('0x13')},{'type':_0x3b90('0x8'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x3b90('0xb'),'content':'','key':'Agent\x20Name','keyType':_0x3b90('0x6'),'variableName':_0x3b90('0x14')},{'type':'keyValue','content':'','key':_0x3b90('0x15'),'keyType':_0x3b90('0x6'),'variableName':_0x3b90('0x16')},{'type':_0x3b90('0x8'),'content':_0x3b90('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x3b90('0xb'),'content':'','key':_0x3b90('0x18'),'keyType':_0x3b90('0x6'),'variableName':_0x3b90('0x13')},{'type':_0x3b90('0xb'),'content':'','key':'Agent\x20Connect','keyType':_0x3b90('0x6'),'variableName':_0x3b90('0x19')},{'type':_0x3b90('0xb'),'content':'','key':_0x3b90('0x1a'),'keyType':_0x3b90('0x6'),'variableName':_0x3b90('0x1b')},{'type':'keyValue','content':'','key':'Hold\x20Time','keyType':_0x3b90('0x6'),'variableName':_0x3b90('0x1c')},{'type':_0x3b90('0xb'),'content':'','key':_0x3b90('0x1d'),'keyType':'variable','variableName':_0x3b90('0x1e')}];break;case _0x3b90('0x7'):_0x336913=[{'type':_0x3b90('0x8'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x3b90('0xb'),'content':'','key':_0x3b90('0x1f'),'keyType':_0x3b90('0x6'),'keyContent':'','variableName':_0x3b90('0x16')},{'type':_0x3b90('0xb'),'content':'','key':_0x3b90('0x20'),'keyType':'variable','keyContent':'','variableName':_0x3b90('0x21')},{'type':'keyValue','content':'','key':_0x3b90('0x22'),'keyType':_0x3b90('0x6'),'keyContent':'','variableName':_0x3b90('0x11')},{'type':_0x3b90('0xb'),'content':'','key':_0x3b90('0x12'),'keyType':_0x3b90('0x6'),'keyContent':'','variableName':_0x3b90('0x23')},{'type':_0x3b90('0x8'),'content':'***\x20Time\x20Info\x20***'},{'type':'keyValue','content':'','key':_0x3b90('0x24'),'keyType':_0x3b90('0x6'),'keyContent':'','variableName':_0x3b90('0x25')},{'type':_0x3b90('0xb'),'content':'','key':'Complete\x20Time','keyType':'variable','keyContent':'','variableName':_0x3b90('0x26')}];break;}}return _0x336913;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index bbdaa55..04855ce 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 _0x9320=['upperFirst','InteractionId','unknown','name','role','stringify','null','then','update','error','tracked','user','query','clone','omit','body','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','chat-interactions'];(function(_0x29f46b,_0x29b6f4){var _0x22b7c2=function(_0x39731d){while(--_0x39731d){_0x29f46b['push'](_0x29f46b['shift']());}};_0x22b7c2(++_0x29b6f4);}(_0x9320,0xfd));var _0x0932=function(_0x4be300,_0x50d073){_0x4be300=_0x4be300-0x0;var _0x3c7092=_0x9320[_0x4be300];return _0x3c7092;};'use strict';var _=require(_0x0932('0x0'));var db=require(_0x0932('0x1'))['db'];var loggers={'openchannel':require(_0x0932('0x2'))(_0x0932('0x3')),'mail':require(_0x0932('0x2'))(_0x0932('0x4')),'fax':require('../../config/logger')(_0x0932('0x5')),'sms':require(_0x0932('0x2'))('sms-interactions'),'chat':require(_0x0932('0x2'))(_0x0932('0x6'))};function getInteractionId(_0x3d54a3,_0x268f42,_0xe52d8d){if(_0x3d54a3&&_0x3d54a3[_[_0x0932('0x7')](_0xe52d8d)+_0x0932('0x8')]){return _0x3d54a3[_[_0x0932('0x7')](_0xe52d8d)+_0x0932('0x8')];}else if(_0x3d54a3&&_0x3d54a3['id']){return _0x3d54a3['id'];}else if(_0x268f42&&_0x268f42['id']){return _0x268f42['id'];}else{return _0x0932('0x9');}}function log(_0x282510,_0x56c8b6,_0x1df5e0,_0x41249c,_0x1503c4,_0x1721ca){loggers[_0x1503c4['toLowerCase']()][_0x282510]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1721ca['toUpperCase'](),_0x56c8b6?_0x56c8b6['id']:null,_0x56c8b6?_0x56c8b6[_0x0932('0xa')]:null,_0x56c8b6?_0x56c8b6[_0x0932('0xb')]:null,getInteractionId(_0x1df5e0,_0x41249c,_0x1503c4),_0x1df5e0?JSON[_0x0932('0xc')](_0x1df5e0):_0x0932('0xd'));}function updateUser(_0x3086bb,_0x155649,_0x1b0f45,_0x5471d5,_0x677b95){db[_[_0x0932('0x7')](_0x5471d5)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x155649,_0x1b0f45,_0x5471d5)}})[_0x0932('0xe')](function(_0x812533){if(_0x812533){return _0x812533[_0x0932('0xf')]({'UserId':_0x3086bb?_0x3086bb['id']:null});}})[_0x0932('0xe')](function(_0x50ceb5){if(_0x50ceb5){log('info',_0x3086bb,_0x155649,_0x1b0f45,_0x5471d5,_0x677b95);}})['catch'](function(){log(_0x0932('0x10'),_0x3086bb,_0x155649,_0x1b0f45,_0x5471d5,_0x677b95);});}exports[_0x0932('0x11')]=function(_0x55f624,_0x5c28ba){return function(_0x1a51a5,_0x1f72dd,_0x57ad16){var _0xf61fc9=_0x1a51a5[_0x0932('0x12')];var _0x52d093={};var _0x3a6b9c=_0x1a51a5[_0x0932('0x13')];if(_0x52d093){_0x52d093=_[_0x0932('0x14')](_0x1a51a5['body']);_0x52d093=_[_0x0932('0x15')](_0x52d093,[_0x0932('0x16'),'html',_0x0932('0x17'),_0x0932('0x18'),_0x0932('0x19')]);}updateUser(_0xf61fc9,_0x52d093,_0x3a6b9c,_0x55f624,_0x5c28ba);_0x57ad16(null);};}; \ No newline at end of file +var _0x1a49=['catch','error','query','phone','fax','mobile','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','chat-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','update'];(function(_0x1d4dff,_0x1af5d7){var _0x49f2c8=function(_0x3bf119){while(--_0x3bf119){_0x1d4dff['push'](_0x1d4dff['shift']());}};_0x49f2c8(++_0x1af5d7);}(_0x1a49,0x66));var _0x91a4=function(_0x5143c8,_0x4e942d){_0x5143c8=_0x5143c8-0x0;var _0x2dfbf3=_0x1a49[_0x5143c8];return _0x2dfbf3;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x91a4('0x0'))(_0x91a4('0x1')),'mail':require('../../config/logger')(_0x91a4('0x2')),'fax':require(_0x91a4('0x0'))('fax-interactions'),'sms':require(_0x91a4('0x0'))(_0x91a4('0x3')),'chat':require(_0x91a4('0x0'))(_0x91a4('0x4'))};function getInteractionId(_0x3f5bd3,_0x4e390f,_0x231f08){if(_0x3f5bd3&&_0x3f5bd3[_[_0x91a4('0x5')](_0x231f08)+_0x91a4('0x6')]){return _0x3f5bd3[_[_0x91a4('0x5')](_0x231f08)+_0x91a4('0x6')];}else if(_0x3f5bd3&&_0x3f5bd3['id']){return _0x3f5bd3['id'];}else if(_0x4e390f&&_0x4e390f['id']){return _0x4e390f['id'];}else{return'unknown';}}function log(_0x10c999,_0x3f3cfb,_0x4e4698,_0x471373,_0xed914c,_0x49a669){loggers[_0xed914c[_0x91a4('0x7')]()][_0x10c999](_0x91a4('0x8'),_0x49a669[_0x91a4('0x9')](),_0x3f3cfb?_0x3f3cfb['id']:null,_0x3f3cfb?_0x3f3cfb[_0x91a4('0xa')]:null,_0x3f3cfb?_0x3f3cfb[_0x91a4('0xb')]:null,getInteractionId(_0x4e4698,_0x471373,_0xed914c),_0x4e4698?JSON[_0x91a4('0xc')](_0x4e4698):_0x91a4('0xd'));}function updateUser(_0x255d1d,_0x1a3cca,_0x386176,_0x177b6c,_0x3508d4){db[_[_0x91a4('0x5')](_0x177b6c)+_0x91a4('0xe')][_0x91a4('0xf')]({'where':{'id':getInteractionId(_0x1a3cca,_0x386176,_0x177b6c)}})[_0x91a4('0x10')](function(_0x4950d5){if(_0x4950d5){return _0x4950d5[_0x91a4('0x11')]({'UserId':_0x255d1d?_0x255d1d['id']:null});}})[_0x91a4('0x10')](function(_0x14e2a9){if(_0x14e2a9){log('info',_0x255d1d,_0x1a3cca,_0x386176,_0x177b6c,_0x3508d4);}})[_0x91a4('0x12')](function(){log(_0x91a4('0x13'),_0x255d1d,_0x1a3cca,_0x386176,_0x177b6c,_0x3508d4);});}exports['tracked']=function(_0x597b78,_0x371e3f){return function(_0x2320be,_0x2e6e73,_0x12fd86){var _0x225f24=_0x2320be['user'];var _0xf7ca93={};var _0x3d8dd6=_0x2320be[_0x91a4('0x14')];if(_0xf7ca93){_0xf7ca93=_['clone'](_0x2320be['body']);_0xf7ca93=_['omit'](_0xf7ca93,['body','html',_0x91a4('0x15'),_0x91a4('0x16'),_0x91a4('0x17')]);}updateUser(_0x225f24,_0xf7ca93,_0x3d8dd6,_0x597b78,_0x371e3f);_0x12fd86(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 2e16b1b..0d07fbe 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 _0x71b0=['crypto','util','composable-middleware','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','hasOwnProperty','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','isUserLimit'];(function(_0x2e3514,_0x18dcaf){var _0x1b4215=function(_0x247a53){while(--_0x247a53){_0x2e3514['push'](_0x2e3514['shift']());}};_0x1b4215(++_0x18dcaf);}(_0x71b0,0x1ba));var _0x071b=function(_0x3fd9cc,_0x57816b){_0x3fd9cc=_0x3fd9cc-0x0;var _0x53e052=_0x71b0[_0x3fd9cc];return _0x53e052;};'use strict';var crypto=require(_0x071b('0x0'));var util=require(_0x071b('0x1'));var compose=require(_0x071b('0x2'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x54fd1d,_0x31169c){if(_0x54fd1d&&_0x31169c){if(_0x31169c[_0x071b('0x3')]&&_0x31169c[_0x071b('0x4')]){var _0x136654=_0x31169c['data1'];var _0x5f410a=_0x31169c['license'];var _0x1b3a78=_0x136654[_0x071b('0x5')]('-')[0x4];var _0x4f9c62=_0x136654[_0x071b('0x5')]('-')[0x0];var _0x339abc=crypto[_0x071b('0x6')](_0x071b('0x7'),util[_0x071b('0x8')](_0x071b('0x9'),_0x1b3a78,_0x136654,_0x4f9c62));var _0x11f3d5=_0x339abc[_0x071b('0xa')](_0x5f410a,_0x071b('0xb'),_0x071b('0xc'));_0x11f3d5+=_0x339abc['final'](_0x071b('0xc'));var _0x4f04bc=JSON['parse'](_0x11f3d5);return _0x4f04bc[_0x071b('0xd')](_0x54fd1d)?_0x4f04bc[_0x54fd1d]:null;}}return null;}function isLimit(_0x1caf99,_0x38f307,_0x1e0114,_0x557cc1){var _0x369e13=_0x38f307;return compose()[_0x071b('0xe')](function(_0x2887ca,_0x29350e,_0x5821e3){return db[_0x071b('0xf')][_0x071b('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x071b('0x11')](function(_0x28e34c){var _0x9456d=getValueFromLicense(_0x1caf99,_0x28e34c);return _0x9456d?_0x9456d:_0x369e13;})[_0x071b('0x11')](function(_0x2030bd){_0x369e13=_0x2030bd;return _0x1e0114[_0x071b('0x12')](_0x557cc1);})[_0x071b('0x11')](function(_0x20eb62){if(_0x20eb62>=_0x369e13){return _0x29350e[_0x071b('0x13')](0x193)[_0x071b('0x14')]({'message':util[_0x071b('0x8')](_0x071b('0x15'),_0x1caf99)});}_0x5821e3();})['catch'](function(_0xcdcebf){_0x5821e3(_0xcdcebf);});});}function isUserLimit(){return isLimit(_0x071b('0x16'),0x1,db[_0x071b('0x17')],{'where':{'$or':[{'role':_0x071b('0x18')},{'role':'user'}]}});}exports[_0x071b('0x19')]=isUserLimit; \ No newline at end of file +var _0x9782=['license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','utf8','final','parse','hasOwnProperty','License','findOne','then','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','isUserLimit','crypto','util','../../mysqldb','data1'];(function(_0x2162e0,_0xd18181){var _0x162d05=function(_0x421403){while(--_0x421403){_0x2162e0['push'](_0x2162e0['shift']());}};_0x162d05(++_0xd18181);}(_0x9782,0xf6));var _0x2978=function(_0x16fe43,_0x1cd9db){_0x16fe43=_0x16fe43-0x0;var _0x52695c=_0x9782[_0x16fe43];return _0x52695c;};'use strict';var crypto=require(_0x2978('0x0'));var util=require(_0x2978('0x1'));var compose=require('composable-middleware');var db=require(_0x2978('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x4c7c1e,_0x30e46f){if(_0x4c7c1e&&_0x30e46f){if(_0x30e46f[_0x2978('0x3')]&&_0x30e46f[_0x2978('0x4')]){var _0x452f52=_0x30e46f[_0x2978('0x3')];var _0x35cce1=_0x30e46f[_0x2978('0x4')];var _0x4a486c=_0x452f52[_0x2978('0x5')]('-')[0x4];var _0x48e2d3=_0x452f52[_0x2978('0x5')]('-')[0x0];var _0x42d536=crypto[_0x2978('0x6')](_0x2978('0x7'),util[_0x2978('0x8')](_0x2978('0x9'),_0x4a486c,_0x452f52,_0x48e2d3));var _0x228df3=_0x42d536[_0x2978('0xa')](_0x35cce1,'base64',_0x2978('0xb'));_0x228df3+=_0x42d536[_0x2978('0xc')](_0x2978('0xb'));var _0xc6555d=JSON[_0x2978('0xd')](_0x228df3);return _0xc6555d[_0x2978('0xe')](_0x4c7c1e)?_0xc6555d[_0x4c7c1e]:null;}}return null;}function isLimit(_0x4205b2,_0xd63ad5,_0x4bec06,_0x4944b8){var _0x5315f5=_0xd63ad5;return compose()['use'](function(_0x5d29c2,_0x189999,_0x648ed0){return db[_0x2978('0xf')][_0x2978('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x2978('0x11')](function(_0x391dac){var _0x2aea84=getValueFromLicense(_0x4205b2,_0x391dac);return _0x2aea84?_0x2aea84:_0x5315f5;})[_0x2978('0x11')](function(_0x1b7e53){_0x5315f5=_0x1b7e53;return _0x4bec06['count'](_0x4944b8);})[_0x2978('0x11')](function(_0x431055){if(_0x431055>=_0x5315f5){return _0x189999[_0x2978('0x12')](0x193)['json']({'message':util[_0x2978('0x8')](_0x2978('0x13'),_0x4205b2)});}_0x648ed0();})[_0x2978('0x14')](function(_0x18cf58){_0x648ed0(_0x18cf58);});});}function isUserLimit(){return isLimit(_0x2978('0x15'),0x1,db['User'],{'where':{'$or':[{'role':_0x2978('0x16')},{'role':_0x2978('0x17')}]}});}exports[_0x2978('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index ca800d0..20b109c 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 _0x5ab9=['omit','isObject','lodash','filters','isEmpty','forOwn','parse','split','offset','priority','col','unsigned','ASC','isArray','length'];(function(_0x29281f,_0xd278d2){var _0x1a6edc=function(_0x3118ca){while(--_0x3118ca){_0x29281f['push'](_0x29281f['shift']());}};_0x1a6edc(++_0xd278d2);}(_0x5ab9,0x1d3));var _0x95ab=function(_0x1a3ca2,_0xe144e7){_0x1a3ca2=_0x1a3ca2-0x0;var _0x30ea08=_0x5ab9[_0x1a3ca2];return _0x30ea08;};'use strict';var _=require(_0x95ab('0x0'));var sequelize=require('sequelize');var LIMIT_VALUE=0xfa;exports['fields']=function(_0x28ad11){var _0x1cffa3=null;if(_0x28ad11){_0x1cffa3=_0x28ad11['split'](',');}return _0x1cffa3;};exports[_0x95ab('0x1')]=function(_0x463896){var _0x4623a6={};if(!_[_0x95ab('0x2')](_0x463896)){_0x4623a6={};_[_0x95ab('0x3')](_0x463896,function(_0x52b128,_0x58b10c){try{_0x4623a6[_0x58b10c]=JSON[_0x95ab('0x4')](_0x52b128);}catch(_0x2f25d3){_0x4623a6[_0x58b10c]=_0x52b128[_0x95ab('0x5')](',');}});}return _0x4623a6;};exports['limit']=function(_0x268b5d){_0x268b5d=parseInt(_0x268b5d,0xa);if(!_0x268b5d||_0x268b5d<0x0){_0x268b5d=LIMIT_VALUE;}return _0x268b5d;};exports[_0x95ab('0x6')]=function(_0x1a3c25){_0x1a3c25=parseInt(_0x1a3c25,0xa);if(!_0x1a3c25||_0x1a3c25<0x0){_0x1a3c25=0x0;}return _0x1a3c25;};exports['sort']=function(_0x314be0){var _0x48ed22,_0x51286c=null;if(_0x314be0){_0x48ed22=_0x314be0[_0x95ab('0x5')](',');_0x51286c=_['map'](_0x48ed22,function(_0xb29c1b){if(_0xb29c1b['indexOf']('-')===0x0){return[_0xb29c1b===_0x95ab('0x7')?sequelize['cast'](sequelize[_0x95ab('0x8')]('priority'),_0x95ab('0x9')):_0xb29c1b['substr'](0x1),'DESC'];}else{return[_0xb29c1b==='priority'?sequelize['cast'](sequelize[_0x95ab('0x8')](_0x95ab('0x7')),_0x95ab('0x9')):_0xb29c1b,_0x95ab('0xa')];}});}return _0x51286c;};exports['omit']=function(_0x15f2f6,_0x574588){if(_[_0x95ab('0x2')](_0x15f2f6)){return _0x15f2f6;}if(_[_0x95ab('0xb')](_0x15f2f6)){for(var _0xa9679f=0x0;_0xa9679f<_0x15f2f6[_0x95ab('0xc')];_0xa9679f+=0x1){_0x15f2f6[_0xa9679f]=this[_0x95ab('0xd')](_0x15f2f6[_0xa9679f],_0x574588);}return _0x15f2f6;}if(!_[_0x95ab('0xe')](_0x15f2f6)){return _0x15f2f6;}if(_['isString'](_0x574588)){_0x574588=[_0x574588];}if(!_[_0x95ab('0xb')](_0x574588)){return _0x15f2f6;}for(var _0x4e696d=0x0;_0x4e696d<_0x574588['length'];_0x4e696d+=0x1){_['unset'](_0x15f2f6,_0x574588[_0x4e696d]);}for(var _0x32fcee in _0x15f2f6){if(_0x15f2f6['hasOwnProperty'](_0x32fcee)){_0x15f2f6[_0x32fcee]=this['omit'](_0x15f2f6[_0x32fcee],_0x574588);}}return _0x15f2f6;}; \ No newline at end of file +var _0x6537=['isObject','isString','isArray','unset','lodash','fields','split','isEmpty','forOwn','parse','offset','sort','map','priority','unsigned','substr','DESC','col','ASC','omit','length'];(function(_0x13b330,_0x297092){var _0x1f666c=function(_0x5ebc84){while(--_0x5ebc84){_0x13b330['push'](_0x13b330['shift']());}};_0x1f666c(++_0x297092);}(_0x6537,0x97));var _0x7653=function(_0x2d0b39,_0x2c0efd){_0x2d0b39=_0x2d0b39-0x0;var _0x151e11=_0x6537[_0x2d0b39];return _0x151e11;};'use strict';var _=require(_0x7653('0x0'));var sequelize=require('sequelize');var LIMIT_VALUE=0xfa;exports[_0x7653('0x1')]=function(_0x4ab93a){var _0x313591=null;if(_0x4ab93a){_0x313591=_0x4ab93a[_0x7653('0x2')](',');}return _0x313591;};exports['filters']=function(_0x45de48){var _0x2e6c7d={};if(!_[_0x7653('0x3')](_0x45de48)){_0x2e6c7d={};_[_0x7653('0x4')](_0x45de48,function(_0x4be535,_0x112588){try{_0x2e6c7d[_0x112588]=JSON[_0x7653('0x5')](_0x4be535);}catch(_0x5b20af){_0x2e6c7d[_0x112588]=_0x4be535['split'](',');}});}return _0x2e6c7d;};exports['limit']=function(_0x2c639f){_0x2c639f=parseInt(_0x2c639f,0xa);if(!_0x2c639f||_0x2c639f<0x0){_0x2c639f=LIMIT_VALUE;}return _0x2c639f;};exports[_0x7653('0x6')]=function(_0x257727){_0x257727=parseInt(_0x257727,0xa);if(!_0x257727||_0x257727<0x0){_0x257727=0x0;}return _0x257727;};exports[_0x7653('0x7')]=function(_0xdc9771){var _0x104f0f,_0x548786=null;if(_0xdc9771){_0x104f0f=_0xdc9771[_0x7653('0x2')](',');_0x548786=_[_0x7653('0x8')](_0x104f0f,function(_0x2fc85b){if(_0x2fc85b['indexOf']('-')===0x0){return[_0x2fc85b===_0x7653('0x9')?sequelize['cast'](sequelize['col']('priority'),_0x7653('0xa')):_0x2fc85b[_0x7653('0xb')](0x1),_0x7653('0xc')];}else{return[_0x2fc85b===_0x7653('0x9')?sequelize['cast'](sequelize[_0x7653('0xd')](_0x7653('0x9')),_0x7653('0xa')):_0x2fc85b,_0x7653('0xe')];}});}return _0x548786;};exports[_0x7653('0xf')]=function(_0x3f67f6,_0x4b3897){if(_[_0x7653('0x3')](_0x3f67f6)){return _0x3f67f6;}if(_['isArray'](_0x3f67f6)){for(var _0x768f8a=0x0;_0x768f8a<_0x3f67f6[_0x7653('0x10')];_0x768f8a+=0x1){_0x3f67f6[_0x768f8a]=this[_0x7653('0xf')](_0x3f67f6[_0x768f8a],_0x4b3897);}return _0x3f67f6;}if(!_[_0x7653('0x11')](_0x3f67f6)){return _0x3f67f6;}if(_[_0x7653('0x12')](_0x4b3897)){_0x4b3897=[_0x4b3897];}if(!_[_0x7653('0x13')](_0x4b3897)){return _0x3f67f6;}for(var _0x3b5353=0x0;_0x3b5353<_0x4b3897['length'];_0x3b5353+=0x1){_[_0x7653('0x14')](_0x3f67f6,_0x4b3897[_0x3b5353]);}for(var _0x5cf783 in _0x3f67f6){if(_0x3f67f6['hasOwnProperty'](_0x5cf783)){_0x3f67f6[_0x5cf783]=this['omit'](_0x3f67f6[_0x5cf783],_0x4b3897);}}return _0x3f67f6;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 6077e63..14b9b29 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['test','client','set','json\x20replacer','split','static','get','views','/server/views','engine','html','renderFile','view\x20engine','json','50mb','initialize','express','serve-favicon','body-parser','errorhandler','path','passport','cors','./environment','default','env','production','use','join','root','public','favicon.ico','development'];(function(_0x55df88,_0xf7418a){var _0x171e61=function(_0x208edc){while(--_0x208edc){_0x55df88['push'](_0x55df88['shift']());}};_0x171e61(++_0xf7418a);}(_0x70e0,0x17b));var _0x070e=function(_0x3885c7,_0x515e15){_0x3885c7=_0x3885c7-0x0;var _0x214dd1=_0x70e0[_0x3885c7];return _0x214dd1;};'use strict';var express=require(_0x070e('0x0'));var favicon=require(_0x070e('0x1'));var bodyParser=require(_0x070e('0x2'));var methodOverride=require('method-override');var cookieParser=require('cookie-parser');var errorHandler=require(_0x070e('0x3'));var path=require(_0x070e('0x4'));var passport=require(_0x070e('0x5'));var cors=require(_0x070e('0x6'));var moment=require('moment');var config=require(_0x070e('0x7'));var db=require('../mysqldb')['db'];exports[_0x070e('0x8')]=function(_0x4b041d){var _0x56e420=_0x4b041d['get'](_0x070e('0x9'));if(_0x56e420===_0x070e('0xa')){_0x4b041d[_0x070e('0xb')](favicon(path[_0x070e('0xc')](config[_0x070e('0xd')],_0x070e('0xe'),_0x070e('0xf'))));_0x4b041d['set']('appPath',path[_0x070e('0xc')](config[_0x070e('0xd')],_0x070e('0xe')));}if(_0x56e420===_0x070e('0x10')||_0x56e420===_0x070e('0x11')){_0x4b041d[_0x070e('0xb')](favicon(path[_0x070e('0xc')](config[_0x070e('0xd')],_0x070e('0x12'),_0x070e('0xf'))));_0x4b041d[_0x070e('0x13')]('appPath',path['join'](config[_0x070e('0xd')],'client'));_0x4b041d['use'](errorHandler());}_0x4b041d['set'](_0x070e('0x14'),function(_0x14c3fd,_0x51d14d){if(this[_0x14c3fd]instanceof Date){_0x51d14d=this[_0x14c3fd]['toISOString']()[_0x070e('0x15')]('.')[0x0]+'Z';}return _0x51d14d;});_0x4b041d[_0x070e('0xb')](express[_0x070e('0x16')](_0x4b041d[_0x070e('0x17')]('appPath')));_0x4b041d['set'](_0x070e('0x18'),config[_0x070e('0xd')]+_0x070e('0x19'));_0x4b041d[_0x070e('0x1a')](_0x070e('0x1b'),require('ejs')[_0x070e('0x1c')]);_0x4b041d[_0x070e('0x13')](_0x070e('0x1d'),_0x070e('0x1b'));_0x4b041d[_0x070e('0xb')](bodyParser['urlencoded']({'limit':'50mb','extended':!![]}));_0x4b041d['use'](bodyParser[_0x070e('0x1e')]({'limit':_0x070e('0x1f')}));_0x4b041d[_0x070e('0xb')](cors());_0x4b041d['use'](methodOverride());_0x4b041d[_0x070e('0xb')](cookieParser());_0x4b041d['use'](passport[_0x070e('0x20')]());}; \ No newline at end of file +var _0x0713=['use','join','root','favicon.ico','set','appPath','development','test','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','initialize','body-parser','method-override','cookie-parser','errorhandler','path','cors','moment','./environment','../mysqldb','default','get','env','production'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var favicon=require('serve-favicon');var bodyParser=require(_0x3071('0x0'));var methodOverride=require(_0x3071('0x1'));var cookieParser=require(_0x3071('0x2'));var errorHandler=require(_0x3071('0x3'));var path=require(_0x3071('0x4'));var passport=require('passport');var cors=require(_0x3071('0x5'));var moment=require(_0x3071('0x6'));var config=require(_0x3071('0x7'));var db=require(_0x3071('0x8'))['db'];exports[_0x3071('0x9')]=function(_0x41cf76){var _0x1d3dd6=_0x41cf76[_0x3071('0xa')](_0x3071('0xb'));if(_0x1d3dd6===_0x3071('0xc')){_0x41cf76[_0x3071('0xd')](favicon(path[_0x3071('0xe')](config[_0x3071('0xf')],'public',_0x3071('0x10'))));_0x41cf76[_0x3071('0x11')](_0x3071('0x12'),path[_0x3071('0xe')](config[_0x3071('0xf')],'public'));}if(_0x1d3dd6===_0x3071('0x13')||_0x1d3dd6===_0x3071('0x14')){_0x41cf76[_0x3071('0xd')](favicon(path[_0x3071('0xe')](config[_0x3071('0xf')],'client','favicon.ico')));_0x41cf76[_0x3071('0x11')]('appPath',path[_0x3071('0xe')](config[_0x3071('0xf')],'client'));_0x41cf76[_0x3071('0xd')](errorHandler());}_0x41cf76['set'](_0x3071('0x15'),function(_0x45c93b,_0x1271d0){if(this[_0x45c93b]instanceof Date){_0x1271d0=this[_0x45c93b][_0x3071('0x16')]()[_0x3071('0x17')]('.')[0x0]+'Z';}return _0x1271d0;});_0x41cf76[_0x3071('0xd')](express[_0x3071('0x18')](_0x41cf76[_0x3071('0xa')](_0x3071('0x12'))));_0x41cf76[_0x3071('0x11')]('views',config[_0x3071('0xf')]+_0x3071('0x19'));_0x41cf76[_0x3071('0x1a')](_0x3071('0x1b'),require(_0x3071('0x1c'))[_0x3071('0x1d')]);_0x41cf76[_0x3071('0x11')](_0x3071('0x1e'),'html');_0x41cf76[_0x3071('0xd')](bodyParser[_0x3071('0x1f')]({'limit':_0x3071('0x20'),'extended':!![]}));_0x41cf76['use'](bodyParser[_0x3071('0x21')]({'limit':'50mb'}));_0x41cf76[_0x3071('0xd')](cors());_0x41cf76[_0x3071('0xd')](methodOverride());_0x41cf76[_0x3071('0xd')](cookieParser());_0x41cf76[_0x3071('0xd')](passport[_0x3071('0x22')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 3a29aa7..69a8994 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 _0x3820=['replace','hostname','macAddress','ipAddress','update','substring','lodash','bimedia-machine-uuid','child_process','networkInterfaces','orderBy','family','IPv4','internal','concat','head','mac','address','cpus','map','model','createHash','md5','digest','hex','platform','win32','dmidecode\x20--string\x20system-uuid'];(function(_0x2543d6,_0x3a5e78){var _0x55213c=function(_0x292768){while(--_0x292768){_0x2543d6['push'](_0x2543d6['shift']());}};_0x55213c(++_0x3a5e78);}(_0x3820,0x92));var _0x0382=function(_0x2583b2,_0x45a743){_0x2583b2=_0x2583b2-0x0;var _0xc1b07c=_0x3820[_0x2583b2];return _0xc1b07c;};'use strict';var _=require(_0x0382('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x0382('0x1'));var exec=require(_0x0382('0x2'))['execSync'];function getInterfaces(){var _0x72f57b=[];var _0x18ede3=os[_0x0382('0x3')]();var _0x5eb10f=_[_0x0382('0x4')](_['keys'](_0x18ede3));for(var _0x29e0e8=0x0;_0x29e0e8<_0x5eb10f['length'];_0x29e0e8++){var _0x3d5062=_0x18ede3[_0x5eb10f[_0x29e0e8]]['filter'](function(_0xa82408){return _0xa82408[_0x0382('0x5')]===_0x0382('0x6')&&_0xa82408[_0x0382('0x7')]===![];});_0x72f57b=_0x72f57b[_0x0382('0x8')](_0x3d5062);}return _0x72f57b;}function getFirstInterface(){var _0x85147b=_[_0x0382('0x9')](getInterfaces());return{'macAddress':_0x85147b&&_0x85147b[_0x0382('0xa')]?_0x85147b[_0x0382('0xa')]:'00:00:00:00:00:00','ipAddress':_0x85147b&&_0x85147b[_0x0382('0xb')]?_0x85147b[_0x0382('0xb')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0xc01d87=_[_0x0382('0x4')](os[_0x0382('0xc')]()[_0x0382('0xd')](function(_0x5ca3ce){return _0x5ca3ce[_0x0382('0xe')];}))['join'](':');return crypto[_0x0382('0xf')](_0x0382('0x10'))['update'](_0xc01d87)[_0x0382('0x11')](_0x0382('0x12'));}exports['getUuid']=function(){switch(os[_0x0382('0x13')]()){case _0x0382('0x14'):return exec(_0x0382('0x15'),{'encoding':'utf8'})[_0x0382('0x16')]('\x0d\x0a','');default:var _0x396835=getFirstInterface();var _0x46ddbf=getCPUhash();var _0x5a7c71=_0x46ddbf+'|'+os[_0x0382('0x17')]()+'|'+_0x396835[_0x0382('0x18')]+'|'+_0x396835[_0x0382('0x19')];var _0x515ea7=crypto[_0x0382('0xf')](_0x0382('0x10'))[_0x0382('0x1a')](_0x5a7c71)['digest'](_0x0382('0x12'));return _0x515ea7[_0x0382('0x1b')](0x0,0x8)+'-'+_0x515ea7['substring'](0x8,0xc)+'-'+_0x515ea7[_0x0382('0x1b')](0xc,0x10)+'-'+_0x515ea7[_0x0382('0x1b')](0x10,0x14)+'-'+_0x515ea7[_0x0382('0x1b')](0x14);}}; \ No newline at end of file +var _0xd201=['createHash','md5','update','digest','hex','getUuid','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','substring','lodash','crypto','keys','length','filter','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','join'];(function(_0x598756,_0x185c81){var _0x5ee235=function(_0x883a3d){while(--_0x883a3d){_0x598756['push'](_0x598756['shift']());}};_0x5ee235(++_0x185c81);}(_0xd201,0x105));var _0x1d20=function(_0xbb6da2,_0x24614b){_0xbb6da2=_0xbb6da2-0x0;var _0x2a84f5=_0xd201[_0xbb6da2];return _0x2a84f5;};'use strict';var _=require(_0x1d20('0x0'));var os=require('os');var crypto=require(_0x1d20('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')['execSync'];function getInterfaces(){var _0x5afdb4=[];var _0x28fab1=os['networkInterfaces']();var _0x626c6c=_['orderBy'](_[_0x1d20('0x2')](_0x28fab1));for(var _0x44c839=0x0;_0x44c839<_0x626c6c[_0x1d20('0x3')];_0x44c839++){var _0x4ff2ea=_0x28fab1[_0x626c6c[_0x44c839]][_0x1d20('0x4')](function(_0x412330){return _0x412330['family']===_0x1d20('0x5')&&_0x412330[_0x1d20('0x6')]===![];});_0x5afdb4=_0x5afdb4[_0x1d20('0x7')](_0x4ff2ea);}return _0x5afdb4;}function getFirstInterface(){var _0x27d005=_[_0x1d20('0x8')](getInterfaces());return{'macAddress':_0x27d005&&_0x27d005[_0x1d20('0x9')]?_0x27d005[_0x1d20('0x9')]:_0x1d20('0xa'),'ipAddress':_0x27d005&&_0x27d005['address']?_0x27d005[_0x1d20('0xb')]:_0x1d20('0xc')};}exports[_0x1d20('0xd')]=getFirstInterface;function getCPUhash(){var _0x4e0db8=_[_0x1d20('0xe')](os[_0x1d20('0xf')]()[_0x1d20('0x10')](function(_0x577ac9){return _0x577ac9['model'];}))[_0x1d20('0x11')](':');return crypto[_0x1d20('0x12')](_0x1d20('0x13'))[_0x1d20('0x14')](_0x4e0db8)[_0x1d20('0x15')](_0x1d20('0x16'));}exports[_0x1d20('0x17')]=function(){switch(os['platform']()){case _0x1d20('0x18'):return exec(_0x1d20('0x19'),{'encoding':_0x1d20('0x1a')})[_0x1d20('0x1b')]('\x0d\x0a','');default:var _0x315160=getFirstInterface();var _0x3d2c33=getCPUhash();var _0x279c48=_0x3d2c33+'|'+os['hostname']()+'|'+_0x315160[_0x1d20('0x1c')]+'|'+_0x315160[_0x1d20('0x1d')];var _0x1440a6=crypto[_0x1d20('0x12')](_0x1d20('0x13'))[_0x1d20('0x14')](_0x279c48)[_0x1d20('0x15')](_0x1d20('0x16'));return _0x1440a6[_0x1d20('0x1e')](0x0,0x8)+'-'+_0x1440a6[_0x1d20('0x1e')](0x8,0xc)+'-'+_0x1440a6[_0x1d20('0x1e')](0xc,0x10)+'-'+_0x1440a6[_0x1d20('0x1e')](0x10,0x14)+'-'+_0x1440a6[_0x1d20('0x1e')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index c25cf88..78fe656 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 _0x54fc=['base64','final','createDecipher','secrets','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','email','|reason|','|uuid|','|machineUuid|','|name|','|email|','then','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','get','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','data1','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','days','YYYY-MM-DD\x20HH:mm','catch','error','finally','getUuid','License','findOrCreate','message','default','https','crypto','moment','bluebird','pkginfo','version','../../mysqldb','./hardware','../logger','license','../../api/jira/jira.controller','www.xcallymotion.com','format','/api/servers/%s/check?version=%s','GET','application/json','request','setEncoding','utf8','data','end','parse','createCipher','aes-256-ctr','session'];(function(_0x189e79,_0x5e8260){var _0x52d4d3=function(_0x489cd7){while(--_0x489cd7){_0x189e79['push'](_0x189e79['shift']());}};_0x52d4d3(++_0x5e8260);}(_0x54fc,0x167));var _0xc54f=function(_0x432876,_0xe2266a){_0x432876=_0x432876-0x0;var _0x5c5dd1=_0x54fc[_0x432876];return _0x5c5dd1;};'use strict';var util=require('util');var https=require(_0xc54f('0x0'));var crypto=require(_0xc54f('0x1'));var moment=require(_0xc54f('0x2'));var BPromise=require(_0xc54f('0x3'));var pkginfo=require(_0xc54f('0x4'))(module,_0xc54f('0x5'));var db=require(_0xc54f('0x6'))['db'];var config=require('../environment');var hardware=require(_0xc54f('0x7'));var logger=require(_0xc54f('0x8'))(_0xc54f('0x9'));var jira=require(_0xc54f('0xa'));var HOST=_0xc54f('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;function httpRequest(_0x4023e1){return new BPromise(function(_0x2a7a34,_0x25886a){var _0x3fdc3a={'host':HOST,'port':0x1bb,'path':util[_0xc54f('0xc')](_0xc54f('0xd'),_0x4023e1,module['exports'][_0xc54f('0x5')]),'method':_0xc54f('0xe'),'timeout':0xea60,'headers':{'Content-Type':_0xc54f('0xf')}};var _0x156e27=https[_0xc54f('0x10')](_0x3fdc3a,function(_0x766faa){_0x766faa[_0xc54f('0x11')](_0xc54f('0x12'));var _0x2b2033='';_0x766faa['on'](_0xc54f('0x13'),function(_0x1b560b){_0x2b2033+=_0x1b560b;});_0x766faa['on'](_0xc54f('0x14'),function(){try{_0x2a7a34(JSON[_0xc54f('0x15')](_0x2b2033));}catch(_0x35e742){_0x25886a(_0x35e742);}});});_0x156e27['on']('error',_0x25886a);_0x156e27[_0xc54f('0x14')]();});}function encryptDate(_0x45b900){var _0xab6758=crypto[_0xc54f('0x16')](_0xc54f('0x17'),config['secrets'][_0xc54f('0x18')]);var _0x5cf1d7=_0xab6758['update'](_0x45b900,_0xc54f('0x12'),_0xc54f('0x19'));_0x5cf1d7+=_0xab6758[_0xc54f('0x1a')](_0xc54f('0x19'));return _0x5cf1d7;}function decryptDate(_0x370eff){var _0x1a5ae0=crypto[_0xc54f('0x1b')](_0xc54f('0x17'),config[_0xc54f('0x1c')]['session']);var _0xc30e0e=_0x1a5ae0['update'](_0x370eff,'base64',_0xc54f('0x12'));_0xc30e0e+=_0x1a5ae0[_0xc54f('0x1a')](_0xc54f('0x12'));return _0xc30e0e;}function sendJiraAlert(_0x3f72fc,_0x2f141f,_0x1decaf){var _0x4bcdcc=_0xc54f('0x1d');return db[_0xc54f('0x1e')][_0xc54f('0x1f')]({'where':{'role':_0xc54f('0x20')},'attributes':[_0xc54f('0x21'),_0xc54f('0x22')],'raw':!![]})['then'](function(_0x125102){ADMIN=_0x125102;_0x4bcdcc+=_0xc54f('0x23')+_0x1decaf+'|\x0a';_0x4bcdcc+=_0xc54f('0x24')+_0x3f72fc+'|\x0a';_0x4bcdcc+=_0xc54f('0x25')+_0x2f141f+'|\x0a';_0x4bcdcc+=_0xc54f('0x26')+ADMIN[_0xc54f('0x21')]+'|\x0a';_0x4bcdcc+=_0xc54f('0x27')+ADMIN[_0xc54f('0x22')]+'|\x0a';return _0x4bcdcc;})[_0xc54f('0x28')](function(_0x17dfc3){var _0x1938dc=hardware['getFirstInterface']()[_0xc54f('0x29')];return jira[_0xc54f('0x2a')]({'key':_0xc54f('0x2b'),'summary':_0xc54f('0x2c'),'description':_0x17dfc3,'issuetype':'Alert','oldToken':_0x3f72fc,'newToken':_0x2f141f,'email':ADMIN[_0xc54f('0x22')],'name':ADMIN[_0xc54f('0x21')],'reason':GRAY_PERIOD_REASON,'ip':_0x1938dc});});}function manageLicense(_0x4ecb9f,_0x3827bc){var _0x166a3c=_0x3827bc[_0xc54f('0x2d')]({'plain':!![]});httpRequest(_0x4ecb9f)['then'](function(_0x59e94c){if(_0x59e94c['active']){if(!_0x166a3c[_0xc54f('0x9')]&&_0x166a3c[_0xc54f('0x9')]!=_0x59e94c['license']||_0x166a3c[_0xc54f('0x9')]&&_0x166a3c[_0xc54f('0x2e')]){logger[_0xc54f('0x2f')](_0xc54f('0x30'));}if(_0x166a3c['license']&&!_0x166a3c['data2']&&_0x166a3c[_0xc54f('0x9')]!=_0x59e94c[_0xc54f('0x9')]){logger['info'](_0xc54f('0x31'));}if(_0x166a3c['license']&&!_0x166a3c[_0xc54f('0x2e')]&&_0x166a3c[_0xc54f('0x9')]==_0x59e94c[_0xc54f('0x9')]){return _0x3827bc;}return _0x3827bc[_0xc54f('0x32')]({'data1':_0x4ecb9f,'data2':null,'license':_0x59e94c[_0xc54f('0x9')]});}else{if(_0x59e94c['license']||_0x166a3c[_0xc54f('0x9')]){if(!_0x166a3c[_0xc54f('0x2e')]){if(_0x166a3c[_0xc54f('0x33')]==_0x4ecb9f){GRAY_PERIOD_REASON='Disabled';logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x166a3c[_0xc54f('0x33')],_0x4ecb9f);}sendJiraAlert(_0x166a3c['data1'],_0x59e94c['uuid'],GRAY_PERIOD_REASON);logger[_0xc54f('0x2f')](_0xc54f('0x34'),GRAY_PERIOD_REASON[_0xc54f('0x35')](),moment()[_0xc54f('0xc')]('YYYY-MM-DD\x20HH:mm'));return _0x3827bc[_0xc54f('0x32')]({'data2':encryptDate(moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](decryptDate(_0x166a3c[_0xc54f('0x2e')]),_0xc54f('0x36'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0xc54f('0xc')](_0xc54f('0x37')));return _0x3827bc[_0xc54f('0x32')]({'data1':_0x4ecb9f,'data2':null,'license':null});}}}else{if(_0x166a3c[_0xc54f('0x33')]!=_0x4ecb9f){logger[_0xc54f('0x2f')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x166a3c[_0xc54f('0x33')],_0x4ecb9f);return _0x3827bc[_0xc54f('0x32')]({'data1':_0x4ecb9f,'data2':null,'license':null});}}}return _0x3827bc;})['then'](function(_0x4dcd11){_0x3827bc=_0x4dcd11;})[_0xc54f('0x38')](function(_0x51622a){logger[_0xc54f('0x39')](_0x51622a['message']);})[_0xc54f('0x3a')](function(){setTimeout(function(){manageLicense(hardware[_0xc54f('0x3b')](),_0x3827bc);},TIME);});}function defaultLicense(){var _0x50092a=hardware[_0xc54f('0x3b')]();if(_0x50092a){return db[_0xc54f('0x3c')][_0xc54f('0x3d')]({'where':{'id':0x1},'defaults':{'data1':_0x50092a}})['spread'](function(_0x190360,_0x37d21f){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x50092a);manageLicense(_0x50092a,_0x190360);})[_0xc54f('0x38')](function(_0x2946a2){logger[_0xc54f('0x39')](_0x2946a2[_0xc54f('0x3e')]);});}}exports[_0xc54f('0x3f')]=defaultLicense; \ No newline at end of file +var _0x9bfb=['../environment','../logger','license','../../api/jira/jira.controller','www.xcallymotion.com','format','/api/servers/%s/check?version=%s','exports','GET','application/json','setEncoding','data','end','parse','error','createCipher','aes-256-ctr','secrets','session','update','utf8','base64','final','createDecipher','||FIELD||VALUE||\x0a','User','admin','fullname','email','|reason|','|uuid|','|machineUuid|','|name|','|email|','then','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','catch','message','finally','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','https','crypto','moment','bluebird','../../mysqldb'];(function(_0x2cd0bd,_0x4af751){var _0x2e46df=function(_0xf29662){while(--_0xf29662){_0x2cd0bd['push'](_0x2cd0bd['shift']());}};_0x2e46df(++_0x4af751);}(_0x9bfb,0x187));var _0xb9bf=function(_0x2e5256,_0x21ed55){_0x2e5256=_0x2e5256-0x0;var _0xa380ae=_0x9bfb[_0x2e5256];return _0xa380ae;};'use strict';var util=require('util');var https=require(_0xb9bf('0x0'));var crypto=require(_0xb9bf('0x1'));var moment=require(_0xb9bf('0x2'));var BPromise=require(_0xb9bf('0x3'));var pkginfo=require('pkginfo')(module,'version');var db=require(_0xb9bf('0x4'))['db'];var config=require(_0xb9bf('0x5'));var hardware=require('./hardware');var logger=require(_0xb9bf('0x6'))(_0xb9bf('0x7'));var jira=require(_0xb9bf('0x8'));var HOST=_0xb9bf('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;function httpRequest(_0x581161){return new BPromise(function(_0x3e7778,_0x4261b1){var _0x567597={'host':HOST,'port':0x1bb,'path':util[_0xb9bf('0xa')](_0xb9bf('0xb'),_0x581161,module[_0xb9bf('0xc')]['version']),'method':_0xb9bf('0xd'),'timeout':0xea60,'headers':{'Content-Type':_0xb9bf('0xe')}};var _0x38f7f2=https['request'](_0x567597,function(_0x11fbc6){_0x11fbc6[_0xb9bf('0xf')]('utf8');var _0x44f866='';_0x11fbc6['on'](_0xb9bf('0x10'),function(_0x39637b){_0x44f866+=_0x39637b;});_0x11fbc6['on'](_0xb9bf('0x11'),function(){try{_0x3e7778(JSON[_0xb9bf('0x12')](_0x44f866));}catch(_0x26467f){_0x4261b1(_0x26467f);}});});_0x38f7f2['on'](_0xb9bf('0x13'),_0x4261b1);_0x38f7f2[_0xb9bf('0x11')]();});}function encryptDate(_0x203b96){var _0x2c1b08=crypto[_0xb9bf('0x14')](_0xb9bf('0x15'),config[_0xb9bf('0x16')][_0xb9bf('0x17')]);var _0x38e351=_0x2c1b08[_0xb9bf('0x18')](_0x203b96,_0xb9bf('0x19'),_0xb9bf('0x1a'));_0x38e351+=_0x2c1b08[_0xb9bf('0x1b')](_0xb9bf('0x1a'));return _0x38e351;}function decryptDate(_0x4d48b7){var _0x145632=crypto[_0xb9bf('0x1c')](_0xb9bf('0x15'),config[_0xb9bf('0x16')][_0xb9bf('0x17')]);var _0x3085d4=_0x145632[_0xb9bf('0x18')](_0x4d48b7,_0xb9bf('0x1a'),_0xb9bf('0x19'));_0x3085d4+=_0x145632[_0xb9bf('0x1b')](_0xb9bf('0x19'));return _0x3085d4;}function sendJiraAlert(_0x2b0daf,_0x2051ce,_0x31f82f){var _0x5d5d14=_0xb9bf('0x1d');return db[_0xb9bf('0x1e')]['findOne']({'where':{'role':_0xb9bf('0x1f')},'attributes':[_0xb9bf('0x20'),_0xb9bf('0x21')],'raw':!![]})['then'](function(_0x3a0d24){ADMIN=_0x3a0d24;_0x5d5d14+=_0xb9bf('0x22')+_0x31f82f+'|\x0a';_0x5d5d14+=_0xb9bf('0x23')+_0x2b0daf+'|\x0a';_0x5d5d14+=_0xb9bf('0x24')+_0x2051ce+'|\x0a';_0x5d5d14+=_0xb9bf('0x25')+ADMIN[_0xb9bf('0x20')]+'|\x0a';_0x5d5d14+=_0xb9bf('0x26')+ADMIN[_0xb9bf('0x21')]+'|\x0a';return _0x5d5d14;})[_0xb9bf('0x27')](function(_0x3f2e3b){var _0x2ce3fe=hardware[_0xb9bf('0x28')]()[_0xb9bf('0x29')];return jira[_0xb9bf('0x2a')]({'key':_0xb9bf('0x2b'),'summary':_0xb9bf('0x2c'),'description':_0x3f2e3b,'issuetype':_0xb9bf('0x2d'),'oldToken':_0x2b0daf,'newToken':_0x2051ce,'email':ADMIN[_0xb9bf('0x21')],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x2ce3fe});});}function manageLicense(_0x5ab590,_0x5f0d77){var _0x3fa89d=_0x5f0d77['get']({'plain':!![]});httpRequest(_0x5ab590)[_0xb9bf('0x27')](function(_0x3230cb){if(_0x3230cb[_0xb9bf('0x2e')]){if(!_0x3fa89d[_0xb9bf('0x7')]&&_0x3fa89d[_0xb9bf('0x7')]!=_0x3230cb['license']||_0x3fa89d[_0xb9bf('0x7')]&&_0x3fa89d['data2']){logger[_0xb9bf('0x2f')](_0xb9bf('0x30'));}if(_0x3fa89d['license']&&!_0x3fa89d[_0xb9bf('0x31')]&&_0x3fa89d['license']!=_0x3230cb[_0xb9bf('0x7')]){logger[_0xb9bf('0x2f')](_0xb9bf('0x32'));}if(_0x3fa89d[_0xb9bf('0x7')]&&!_0x3fa89d[_0xb9bf('0x31')]&&_0x3fa89d[_0xb9bf('0x7')]==_0x3230cb[_0xb9bf('0x7')]){return _0x5f0d77;}return _0x5f0d77[_0xb9bf('0x18')]({'data1':_0x5ab590,'data2':null,'license':_0x3230cb['license']});}else{if(_0x3230cb[_0xb9bf('0x7')]||_0x3fa89d[_0xb9bf('0x7')]){if(!_0x3fa89d[_0xb9bf('0x31')]){if(_0x3fa89d[_0xb9bf('0x33')]==_0x5ab590){GRAY_PERIOD_REASON=_0xb9bf('0x34');logger[_0xb9bf('0x2f')](_0xb9bf('0x35'));}else{GRAY_PERIOD_REASON=_0xb9bf('0x36');logger[_0xb9bf('0x2f')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3fa89d[_0xb9bf('0x33')],_0x5ab590);}sendJiraAlert(_0x3fa89d[_0xb9bf('0x33')],_0x3230cb[_0xb9bf('0x37')],GRAY_PERIOD_REASON);logger[_0xb9bf('0x2f')](_0xb9bf('0x38'),GRAY_PERIOD_REASON[_0xb9bf('0x39')](),moment()[_0xb9bf('0xa')](_0xb9bf('0x3a')));return _0x5f0d77['update']({'data2':encryptDate(moment()[_0xb9bf('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](decryptDate(_0x3fa89d[_0xb9bf('0x31')]),'days')>DAYS){logger[_0xb9bf('0x2f')]('DEMO\x20START\x20AT\x20%s',moment()[_0xb9bf('0xa')](_0xb9bf('0x3a')));return _0x5f0d77['update']({'data1':_0x5ab590,'data2':null,'license':null});}}}else{if(_0x3fa89d[_0xb9bf('0x33')]!=_0x5ab590){logger[_0xb9bf('0x2f')](_0xb9bf('0x3b'),_0x3fa89d[_0xb9bf('0x33')],_0x5ab590);return _0x5f0d77[_0xb9bf('0x18')]({'data1':_0x5ab590,'data2':null,'license':null});}}}return _0x5f0d77;})[_0xb9bf('0x27')](function(_0x52d343){_0x5f0d77=_0x52d343;})[_0xb9bf('0x3c')](function(_0x50271e){logger[_0xb9bf('0x13')](_0x50271e[_0xb9bf('0x3d')]);})[_0xb9bf('0x3e')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x5f0d77);},TIME);});}function defaultLicense(){var _0xbbfb74=hardware['getUuid']();if(_0xbbfb74){return db['License'][_0xb9bf('0x3f')]({'where':{'id':0x1},'defaults':{'data1':_0xbbfb74}})[_0xb9bf('0x40')](function(_0x5550b0,_0x2d7c2d){logger[_0xb9bf('0x2f')](_0xb9bf('0x41'),_0xbbfb74);manageLicense(_0xbbfb74,_0x5550b0);})[_0xb9bf('0x3c')](function(_0x215c6e){logger[_0xb9bf('0x13')](_0x215c6e[_0xb9bf('0x3d')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 6245857..24f0af3 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 _0x06b4=['data1','data2','split','format','%s:%s:%s','update','base64','utf8','parse','demo','uuid','getUuid','createDecipher','aes-256-ctr','secrets','session','gray','deadline','add','grayReason','machineUuid','disabled','Breaking\x20license','message','Demo\x20license','getLicense','License','find','defaults','then','crypto','moment','./hardware','../environment','isEmpty','License\x20key\x20value\x20not\x20found'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0x06b4,0x11a));var _0x406b=function(_0x2fd423,_0x1fc9ee){_0x2fd423=_0x2fd423-0x0;var _0x45ceb7=_0x06b4[_0x2fd423];return _0x45ceb7;};'use strict';var crypto=require(_0x406b('0x0'));var util=require('util');var _=require('lodash');var moment=require(_0x406b('0x1'));var hardware=require(_0x406b('0x2'));var config=require(_0x406b('0x3'));var db=require('../../mysqldb')['db'];function checkLicense(_0x516670,_0x303d2d){if(_0x516670){try{var _0x30f3e9=_0x303d2d||_0x516670['license'];if(_[_0x406b('0x4')](_0x30f3e9)){throw new Error(_0x406b('0x5'));}var _0x55b28f=_0x516670[_0x406b('0x6')];var _0x489351=_0x516670[_0x406b('0x7')];var _0x27bbb6=_0x55b28f[_0x406b('0x8')]('-')[0x4];var _0x3094d4=_0x55b28f[_0x406b('0x8')]('-')[0x0];var _0x1fa07e=crypto['createDecipher']('aes-256-ctr',util[_0x406b('0x9')](_0x406b('0xa'),_0x27bbb6,_0x55b28f,_0x3094d4));var _0x2b2982=_0x1fa07e[_0x406b('0xb')](_0x30f3e9,_0x406b('0xc'),_0x406b('0xd'));_0x2b2982+=_0x1fa07e['final'](_0x406b('0xd'));var _0xdc3ec6=JSON[_0x406b('0xe')](_0x2b2982);_0xdc3ec6[_0x406b('0xf')]=![];_0xdc3ec6[_0x406b('0x10')]=_0x55b28f;_0xdc3ec6['machineUuid']=hardware[_0x406b('0x11')]();if(_0x489351){var _0x1a9117=crypto[_0x406b('0x12')](_0x406b('0x13'),config[_0x406b('0x14')][_0x406b('0x15')]);var _0x40ec96=_0x1a9117[_0x406b('0xb')](_0x489351,_0x406b('0xc'),_0x406b('0xd'));_0x40ec96+=_0x1a9117['final'](_0x406b('0xd'));_0xdc3ec6[_0x406b('0x16')]=_0x40ec96;_0xdc3ec6[_0x406b('0x17')]=moment(_0x40ec96)[_0x406b('0x18')](0x7,'days')[_0x406b('0x9')]();_0xdc3ec6[_0x406b('0x19')]=_0xdc3ec6['uuid']!=_0xdc3ec6[_0x406b('0x1a')]?'changed':_0x406b('0x1b');}return _0xdc3ec6;}catch(_0x5f357d){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':_0x406b('0x1c'),'uuid':_0x516670['data1'],'machineUuid':hardware[_0x406b('0x11')](),'message':_0x5f357d[_0x406b('0x1d')],'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':_0x406b('0x1e'),'uuid':_0x516670[_0x406b('0x6')],'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![]};}exports[_0x406b('0x1f')]=function(_0x65e300){return db[_0x406b('0x20')][_0x406b('0x21')](_[_0x406b('0x22')](_0x65e300,{'raw':!![],'where':{'id':0x1}}))[_0x406b('0x23')](function(_0x576402){return checkLicense(_0x576402,null);});};exports['checkLicense']=checkLicense; \ No newline at end of file +var _0x7e2c=['grayReason','uuid','2027-01-01T00:00:00.000Z','Breaking\x20license','data1','message','Demo\x20license','getLicense','find','defaults','then','checkLicense','crypto','util','moment','../environment','../../mysqldb','license','License\x20key\x20value\x20not\x20found','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','utf8','parse','demo','getUuid','secrets','session','base64','final','gray','deadline','add','days'];(function(_0x45d31c,_0xd0b936){var _0x33c23a=function(_0xe014b0){while(--_0xe014b0){_0x45d31c['push'](_0x45d31c['shift']());}};_0x33c23a(++_0xd0b936);}(_0x7e2c,0x1c8));var _0xc7e2=function(_0x2b519f,_0xc74601){_0x2b519f=_0x2b519f-0x0;var _0x3df445=_0x7e2c[_0x2b519f];return _0x3df445;};'use strict';var crypto=require(_0xc7e2('0x0'));var util=require(_0xc7e2('0x1'));var _=require('lodash');var moment=require(_0xc7e2('0x2'));var hardware=require('./hardware');var config=require(_0xc7e2('0x3'));var db=require(_0xc7e2('0x4'))['db'];function checkLicense(_0x21e392,_0x278300){if(_0x21e392){try{var _0x399f60=_0x278300||_0x21e392[_0xc7e2('0x5')];if(_['isEmpty'](_0x399f60)){throw new Error(_0xc7e2('0x6'));}var _0xd135c7=_0x21e392['data1'];var _0xdc2f8f=_0x21e392[_0xc7e2('0x7')];var _0x2e65ac=_0xd135c7[_0xc7e2('0x8')]('-')[0x4];var _0x29712d=_0xd135c7[_0xc7e2('0x8')]('-')[0x0];var _0x1dc04b=crypto[_0xc7e2('0x9')](_0xc7e2('0xa'),util[_0xc7e2('0xb')](_0xc7e2('0xc'),_0x2e65ac,_0xd135c7,_0x29712d));var _0x2d24f3=_0x1dc04b['update'](_0x399f60,'base64',_0xc7e2('0xd'));_0x2d24f3+=_0x1dc04b['final'](_0xc7e2('0xd'));var _0x2df3bb=JSON[_0xc7e2('0xe')](_0x2d24f3);_0x2df3bb[_0xc7e2('0xf')]=![];_0x2df3bb['uuid']=_0xd135c7;_0x2df3bb['machineUuid']=hardware[_0xc7e2('0x10')]();if(_0xdc2f8f){var _0x403daf=crypto[_0xc7e2('0x9')](_0xc7e2('0xa'),config[_0xc7e2('0x11')][_0xc7e2('0x12')]);var _0x2a99b9=_0x403daf['update'](_0xdc2f8f,_0xc7e2('0x13'),'utf8');_0x2a99b9+=_0x403daf[_0xc7e2('0x14')](_0xc7e2('0xd'));_0x2df3bb[_0xc7e2('0x15')]=_0x2a99b9;_0x2df3bb[_0xc7e2('0x16')]=moment(_0x2a99b9)[_0xc7e2('0x17')](0x7,_0xc7e2('0x18'))[_0xc7e2('0xb')]();_0x2df3bb[_0xc7e2('0x19')]=_0x2df3bb[_0xc7e2('0x1a')]!=_0x2df3bb['machineUuid']?'changed':'disabled';}return _0x2df3bb;}catch(_0x192e59){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc7e2('0x1b'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xc7e2('0x1c'),'uuid':_0x21e392[_0xc7e2('0x1d')],'machineUuid':hardware[_0xc7e2('0x10')](),'message':_0x192e59[_0xc7e2('0x1e')],'virtual':0x0,'voice':!![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc7e2('0x1b'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xc7e2('0x1f'),'uuid':_0x21e392[_0xc7e2('0x1d')],'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![]};}exports[_0xc7e2('0x20')]=function(_0x2a916c){return db['License'][_0xc7e2('0x21')](_[_0xc7e2('0x22')](_0x2a916c,{'raw':!![],'where':{'id':0x1}}))[_0xc7e2('0x23')](function(_0x4937f2){return checkLicense(_0x4937f2,null);});};exports[_0xc7e2('0x24')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 3feba1a..0162420 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 _0x4d46=['app-id','secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4d46,0x197));var _0x64d4=function(_0x51fdbd,_0x43975b){_0x51fdbd=_0x51fdbd-0x0;var _0x91cee5=_0x4d46[_0x51fdbd];return _0x91cee5;};'use strict';module[_0x64d4('0x0')]={'DOMAIN':_0x64d4('0x1'),'SESSION_SECRET':_0x64d4('0x2'),'GOOGLE_ID':_0x64d4('0x3'),'GOOGLE_SECRET':_0x64d4('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x3451=['app-id','secret','exports','http://localhost:9000'];(function(_0x597106,_0x44de51){var _0x3ca6b5=function(_0x9e6058){while(--_0x9e6058){_0x597106['push'](_0x597106['shift']());}};_0x3ca6b5(++_0x44de51);}(_0x3451,0x19a));var _0x1345=function(_0x5e99fa,_0x33bc1f){_0x5e99fa=_0x5e99fa-0x0;var _0x103c4b=_0x3451[_0x5e99fa];return _0x103c4b;};'use strict';module[_0x1345('0x0')]={'DOMAIN':_0x1345('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x1345('0x2'),'GOOGLE_SECRET':_0x1345('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 9032a1a..180d991 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc992=['path','INFO','join','/var','log','xcally','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','message','exports','Logger','transports','File','%s-%s','error','info','Console','env','debugLevel','moment','util'];(function(_0xaed9db,_0x22412f){var _0x1b2dc9=function(_0x38e603){while(--_0x38e603){_0xaed9db['push'](_0xaed9db['shift']());}};_0x1b2dc9(++_0x22412f);}(_0xc992,0x106));var _0x2c99=function(_0x7325f3,_0x4c8836){_0x7325f3=_0x7325f3-0x0;var _0x4f5b5c=_0xc992[_0x7325f3];return _0x4f5b5c;};'use strict';var moment=require(_0x2c99('0x0'));var winston=require('winston');var util=require(_0x2c99('0x1'));var path=require(_0x2c99('0x2'));var debugLevel=_0x2c99('0x3');function filename(_0x44d539,_0x3596f6){return path[_0x2c99('0x4')](_0x2c99('0x5'),_0x2c99('0x6'),_0x2c99('0x7'),util[_0x2c99('0x8')](_0x2c99('0x9'),_0x44d539,_0x3596f6));}function formatter(_0x47fea9,_0x2f7493){return util['format'](_0x2c99('0xa'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x2f7493[_0x2c99('0xb')][_0x2c99('0xc')](),_0x47fea9,_0x2f7493[_0x2c99('0xd')]);}module[_0x2c99('0xe')]=function(_0x432c01){return new winston[(_0x2c99('0xf'))]({'transports':[new winston[(_0x2c99('0x10'))][(_0x2c99('0x11'))]({'name':util[_0x2c99('0x8')](_0x2c99('0x12'),_0x432c01,_0x2c99('0x13')),'filename':filename(_0x432c01,_0x2c99('0x13')),'level':_0x2c99('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x28c9c9){return formatter(_0x432c01,_0x28c9c9);}}),new winston[(_0x2c99('0x10'))][(_0x2c99('0x11'))]({'name':util[_0x2c99('0x8')](_0x2c99('0x12'),_0x432c01,_0x2c99('0x14')),'filename':filename(_0x432c01,'info'),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x225509){return formatter(_0x432c01,_0x225509);}}),new winston[(_0x2c99('0x10'))][(_0x2c99('0x15'))]({'level':process[_0x2c99('0x16')][_0x2c99('0x17')]||debugLevel,'json':![],'formatter':function(_0x10a7b0){return formatter(_0x432c01,_0x10a7b0);}})]});}; \ No newline at end of file +var _0x28e0=['Logger','transports','File','%s-%s','error','info','winston','util','join','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','message','exports'];(function(_0xcda24c,_0x142986){var _0x53afc0=function(_0x2e956d){while(--_0x2e956d){_0xcda24c['push'](_0xcda24c['shift']());}};_0x53afc0(++_0x142986);}(_0x28e0,0x105));var _0x028e=function(_0x5b8919,_0x3d2103){_0x5b8919=_0x5b8919-0x0;var _0x5baa5b=_0x28e0[_0x5b8919];return _0x5baa5b;};'use strict';var moment=require('moment');var winston=require(_0x028e('0x0'));var util=require(_0x028e('0x1'));var path=require('path');var debugLevel='INFO';function filename(_0x5dd254,_0x591ff5){return path[_0x028e('0x2')]('/var','log','xcally',util[_0x028e('0x3')]('%s-%s.log',_0x5dd254,_0x591ff5));}function formatter(_0x4cb7ad,_0x3240db){return util[_0x028e('0x3')](_0x028e('0x4'),moment()['format'](_0x028e('0x5')),_0x3240db[_0x028e('0x6')]['toUpperCase'](),_0x4cb7ad,_0x3240db[_0x028e('0x7')]);}module[_0x028e('0x8')]=function(_0x357640){return new winston[(_0x028e('0x9'))]({'transports':[new winston[(_0x028e('0xa'))][(_0x028e('0xb'))]({'name':util['format'](_0x028e('0xc'),_0x357640,_0x028e('0xd')),'filename':filename(_0x357640,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x56afa8){return formatter(_0x357640,_0x56afa8);}}),new winston[(_0x028e('0xa'))]['File']({'name':util[_0x028e('0x3')](_0x028e('0xc'),_0x357640,_0x028e('0xe')),'filename':filename(_0x357640,_0x028e('0xe')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x699fa7){return formatter(_0x357640,_0x699fa7);}}),new winston[(_0x028e('0xa'))]['Console']({'level':process['env']['debugLevel']||debugLevel,'json':![],'formatter':function(_0x42d10c){return formatter(_0x357640,_0x42d10c);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 583cae7..846edbb 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 _0x5195=['join','../../services/ami/index.js','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','path','express','../../services/express/index.js'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5195,0xf9));var _0x5519=function(_0x7e557a,_0x3e41ab){_0x7e557a=_0x7e557a-0x0;var _0x3aba18=_0x5195[_0x7e557a];return _0x3aba18;};'use strict';var path=require(_0x5519('0x0'));var os=require('os');var config={'apps':[{'name':_0x5519('0x1'),'script':path['join'](__dirname,_0x5519('0x2'))},{'name':'ami','script':path[_0x5519('0x3')](__dirname,_0x5519('0x4'))},{'name':'agi','script':path[_0x5519('0x3')](__dirname,_0x5519('0x5'))},{'name':'email','script':path[_0x5519('0x3')](__dirname,_0x5519('0x6'))},{'name':_0x5519('0x7'),'script':path[_0x5519('0x3')](__dirname,_0x5519('0x8'))}]};module['exports']=config; \ No newline at end of file +var _0x135f=['express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','../../services/routing/index.js','exports','path'];(function(_0x3e1054,_0x345ece){var _0xa74ef6=function(_0x2312e1){while(--_0x2312e1){_0x3e1054['push'](_0x3e1054['shift']());}};_0xa74ef6(++_0x345ece);}(_0x135f,0x133));var _0xf135=function(_0x4b4955,_0x54f8b7){_0x4b4955=_0x4b4955-0x0;var _0x1795d3=_0x135f[_0x4b4955];return _0x1795d3;};'use strict';var path=require(_0xf135('0x0'));var os=require('os');var config={'apps':[{'name':_0xf135('0x1'),'script':path[_0xf135('0x2')](__dirname,_0xf135('0x3'))},{'name':_0xf135('0x4'),'script':path[_0xf135('0x2')](__dirname,_0xf135('0x5'))},{'name':_0xf135('0x6'),'script':path[_0xf135('0x2')](__dirname,_0xf135('0x7'))},{'name':'email','script':path[_0xf135('0x2')](__dirname,_0xf135('0x8'))},{'name':'routing','script':path[_0xf135('0x2')](__dirname,_0xf135('0x9'))}]};module[_0xf135('0xa')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 38bfac7..2b6a18c 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 _0x3e74=['saved','pm2','./config','connected','then','start','disconnect','stop','list','describe','delete','dump'];(function(_0x5bfbb2,_0x3d0c99){var _0xac7867=function(_0x2b7b61){while(--_0x2b7b61){_0x5bfbb2['push'](_0x5bfbb2['shift']());}};_0xac7867(++_0x3d0c99);}(_0x3e74,0x175));var _0x43e7=function(_0x54688c,_0x4b82ec){_0x54688c=_0x54688c-0x0;var _0x4cc367=_0x3e74[_0x54688c];return _0x4cc367;};'use strict';var pm2=require(_0x43e7('0x0'));var BPromise=require('bluebird');var config=require(_0x43e7('0x1'));function connect(){return new BPromise(function(_0x287a1d,_0x151ad2){return pm2['connect'](function(_0x490ced){if(_0x490ced){return _0x151ad2(_0x490ced);}return _0x287a1d(_0x43e7('0x2'));});});};exports['start']=function(_0x128b0f){return connect()[_0x43e7('0x3')](function(){return new BPromise(function(_0xe78cb7,_0x1c503b){return pm2[_0x43e7('0x4')](_0x128b0f,function(_0x503698,_0x45a0d1){if(_0x503698){return _0x1c503b(_0x503698);}pm2[_0x43e7('0x5')]();return _0xe78cb7(_0x45a0d1);});});});};exports[_0x43e7('0x6')]=function(_0x8528fc){return connect()[_0x43e7('0x3')](function(){return new BPromise(function(_0x516b4d,_0x212c6c){return pm2['stop'](_0x8528fc,function(_0x54948c,_0x39c8bd){if(_0x54948c){return _0x212c6c(_0x54948c);}pm2[_0x43e7('0x5')]();return _0x516b4d(_0x39c8bd);});});});};exports['restart']=function(_0x2803d9){return connect()['then'](function(){return new BPromise(function(_0xf7c520,_0x37302c){return pm2['restart'](_0x2803d9,function(_0x3eb206,_0xc960ea){if(_0x3eb206){return _0x37302c(_0x3eb206);}pm2[_0x43e7('0x5')]();return _0xf7c520(_0xc960ea);});});});};exports[_0x43e7('0x7')]=function(){return connect()['then'](function(){return new BPromise(function(_0x583d85,_0x2fcb36){return pm2[_0x43e7('0x7')](function(_0x44b0bd,_0x51b974){if(_0x44b0bd){return _0x2fcb36(_0x44b0bd);}pm2['disconnect']();return _0x583d85(_0x51b974);});});});};exports[_0x43e7('0x8')]=function(_0x14c146){return connect()[_0x43e7('0x3')](function(){return new BPromise(function(_0x328445,_0x4de324){return pm2['describe'](_0x14c146,function(_0xdf16c,_0x264575){if(_0xdf16c){return _0x4de324(_0xdf16c);}pm2[_0x43e7('0x5')]();return _0x328445(_0x264575);});});});};exports['delete']=function(_0x4b5a6b){return connect()[_0x43e7('0x3')](function(){return new BPromise(function(_0x1ca758,_0x9037d3){return pm2[_0x43e7('0x9')](_0x4b5a6b,function(_0x3776f5,_0x1f24fb){if(_0x3776f5){return _0x9037d3(_0x3776f5);}pm2[_0x43e7('0x5')]();return _0x1ca758(_0x1f24fb);});});});};exports[_0x43e7('0xa')]=function(){return connect()[_0x43e7('0x3')](function(){return new BPromise(function(_0xab63cf,_0x191dd5){return pm2[_0x43e7('0xa')](function(_0x4b5d64){if(_0x4b5d64){return _0x191dd5(_0x4b5d64);}return _0xab63cf(_0x43e7('0xb'));});});});}; \ No newline at end of file +var _0x7217=['connect','then','start','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','./config'];(function(_0x2a7ae9,_0x317027){var _0x169dff=function(_0x525e29){while(--_0x525e29){_0x2a7ae9['push'](_0x2a7ae9['shift']());}};_0x169dff(++_0x317027);}(_0x7217,0x19e));var _0x7721=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x7217[_0x5c351c];return _0x26f3b3;};'use strict';var pm2=require(_0x7721('0x0'));var BPromise=require('bluebird');var config=require(_0x7721('0x1'));function connect(){return new BPromise(function(_0x4170dd,_0x1de988){return pm2[_0x7721('0x2')](function(_0x115ab3){if(_0x115ab3){return _0x1de988(_0x115ab3);}return _0x4170dd('connected');});});};exports['start']=function(_0x472a96){return connect()[_0x7721('0x3')](function(){return new BPromise(function(_0x46415c,_0x3fe47c){return pm2[_0x7721('0x4')](_0x472a96,function(_0xf7ff37,_0x18ab6b){if(_0xf7ff37){return _0x3fe47c(_0xf7ff37);}pm2[_0x7721('0x5')]();return _0x46415c(_0x18ab6b);});});});};exports[_0x7721('0x6')]=function(_0x2f99ed){return connect()[_0x7721('0x3')](function(){return new BPromise(function(_0x2a66cb,_0xfa8835){return pm2[_0x7721('0x6')](_0x2f99ed,function(_0x2c3986,_0x578d59){if(_0x2c3986){return _0xfa8835(_0x2c3986);}pm2[_0x7721('0x5')]();return _0x2a66cb(_0x578d59);});});});};exports[_0x7721('0x7')]=function(_0x8729a6){return connect()[_0x7721('0x3')](function(){return new BPromise(function(_0xa8977c,_0x409b37){return pm2[_0x7721('0x7')](_0x8729a6,function(_0x27b36b,_0x55b4ca){if(_0x27b36b){return _0x409b37(_0x27b36b);}pm2[_0x7721('0x5')]();return _0xa8977c(_0x55b4ca);});});});};exports[_0x7721('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x109900,_0x30da54){return pm2[_0x7721('0x8')](function(_0x2e9752,_0x5069da){if(_0x2e9752){return _0x30da54(_0x2e9752);}pm2[_0x7721('0x5')]();return _0x109900(_0x5069da);});});});};exports[_0x7721('0x9')]=function(_0x534f1b){return connect()['then'](function(){return new BPromise(function(_0x4b183e,_0x5ed54){return pm2[_0x7721('0x9')](_0x534f1b,function(_0x3cc909,_0x32550d){if(_0x3cc909){return _0x5ed54(_0x3cc909);}pm2['disconnect']();return _0x4b183e(_0x32550d);});});});};exports[_0x7721('0xa')]=function(_0x54a838){return connect()[_0x7721('0x3')](function(){return new BPromise(function(_0x5cb0e6,_0xfec626){return pm2[_0x7721('0xa')](_0x54a838,function(_0x3ab5a5,_0x3e140d){if(_0x3ab5a5){return _0xfec626(_0x3ab5a5);}pm2[_0x7721('0x5')]();return _0x5cb0e6(_0x3e140d);});});});};exports[_0x7721('0xb')]=function(){return connect()[_0x7721('0x3')](function(){return new BPromise(function(_0x413263,_0x3b29ac){return pm2[_0x7721('0xb')](function(_0x4ce1db){if(_0x4ce1db){return _0x3b29ac(_0x4ce1db);}return _0x413263(_0x7721('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index f27bb85..3aeeb43 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 _0xdeb3=['findAll','subtract','minutes','ChatInteraction','update','system','timeout','map','length','emit','chatInteraction:update','catch','moment','../../mysqldb','socket.io-emitter','Setting','find','chatTimeout','then'];(function(_0x59162a,_0x10e547){var _0x35e50d=function(_0x578425){while(--_0x578425){_0x59162a['push'](_0x59162a['shift']());}};_0x35e50d(++_0x10e547);}(_0xdeb3,0xb7));var _0x3deb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdeb3[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var moment=require(_0x3deb('0x0'));var db=require(_0x3deb('0x1'))['db'];var io=require(_0x3deb('0x2'))({'host':'localhost','port':0x18eb});function closeInteractions(){var _0x5513ef=0x0;var _0x28d064=[];return db[_0x3deb('0x3')][_0x3deb('0x4')]({'raw':!![],'attributes':['id',_0x3deb('0x5')],'where':{'id':0x1}})[_0x3deb('0x6')](function(_0x4ed534){_0x5513ef=_0x4ed534[_0x3deb('0x5')];if(_0x5513ef){return db['ChatInteraction'][_0x3deb('0x7')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x3deb('0x8')](_0x4ed534[_0x3deb('0x5')],_0x3deb('0x9'))}}});}else{return[];}})[_0x3deb('0x6')](function(_0x2eb451){_0x28d064=_0x2eb451;if(_0x5513ef){return db[_0x3deb('0xa')][_0x3deb('0xb')]({'closeReason':_0x3deb('0xc'),'disposition':_0x3deb('0xd'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_[_0x3deb('0xe')](_0x28d064||[],'id')}});}})[_0x3deb('0x6')](function(_0x756238){for(var _0x54c1b3=0x0;_0x54c1b3<_0x28d064[_0x3deb('0xf')];_0x54c1b3++){io[_0x3deb('0x10')](_0x3deb('0x11'),{'id':_0x28d064[_0x54c1b3]['id'],'closed':!![]});}})[_0x3deb('0x12')](function(_0x555a07){console['error'](_0x555a07);});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x3823=['moment','../../mysqldb','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','map','length','emit','chatInteraction:update','catch'];(function(_0xb97d33,_0x534dad){var _0x289e95=function(_0x2f3495){while(--_0x2f3495){_0xb97d33['push'](_0xb97d33['shift']());}};_0x289e95(++_0x534dad);}(_0x3823,0xb0));var _0x3382=function(_0x32e356,_0x360586){_0x32e356=_0x32e356-0x0;var _0x312475=_0x3823[_0x32e356];return _0x312475;};'use strict';var _=require('lodash');var moment=require(_0x3382('0x0'));var db=require(_0x3382('0x1'))['db'];var io=require(_0x3382('0x2'))({'host':'localhost','port':0x18eb});function closeInteractions(){var _0x3f68a0=0x0;var _0x5204ff=[];return db[_0x3382('0x3')][_0x3382('0x4')]({'raw':!![],'attributes':['id',_0x3382('0x5')],'where':{'id':0x1}})[_0x3382('0x6')](function(_0x5f3f30){_0x3f68a0=_0x5f3f30[_0x3382('0x5')];if(_0x3f68a0){return db[_0x3382('0x7')][_0x3382('0x8')]({'raw':!![],'attributes':['id',_0x3382('0x9')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x3382('0xa')](_0x5f3f30[_0x3382('0x5')],_0x3382('0xb'))}}});}else{return[];}})[_0x3382('0x6')](function(_0xdbf328){_0x5204ff=_0xdbf328;if(_0x3f68a0){return db[_0x3382('0x7')][_0x3382('0xc')]({'closeReason':_0x3382('0xd'),'disposition':_0x3382('0xe'),'closed':!![],'closedAt':moment()[_0x3382('0xf')](_0x3382('0x10'))},{'where':{'id':_[_0x3382('0x11')](_0x5204ff||[],'id')}});}})['then'](function(_0x5ef7c7){for(var _0x2a8cf4=0x0;_0x2a8cf4<_0x5204ff[_0x3382('0x12')];_0x2a8cf4++){io[_0x3382('0x13')](_0x3382('0x14'),{'id':_0x5204ff[_0x2a8cf4]['id'],'closed':!![]});}})[_0x3382('0x15')](function(_0x6b5b69){console['error'](_0x6b5b69);});}exports['start']=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 ec27648..656120d 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 _0xf541=['jobs','map','toString','keyBy','intersection','difference','length','exists','toRun','index','my\x20id','resolve','run\x20job','cron','isBetween','startAt','endAt','add\x20cron','stop','deleteJob','stop\x20cron','active','update','update\x20cron','run','start','util','path','lodash','jayson/promise','schedule','../../mysqldb','http','info','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','%s.%s','basename','savename','extname','zip','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','request','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','runReport','Schedule','MailServerOut','keys'];(function(_0x13ed1a,_0x265bc2){var _0x4b769b=function(_0x114209){while(--_0x114209){_0x13ed1a['push'](_0x13ed1a['shift']());}};_0x4b769b(++_0x265bc2);}(_0xf541,0x176));var _0x1f54=function(_0x3616bb,_0x86fe00){_0x3616bb=_0x3616bb-0x0;var _0x1c0994=_0xf541[_0x3616bb];return _0x1c0994;};'use strict';var fs=require('fs');var util=require(_0x1f54('0x0'));var path=require(_0x1f54('0x1'));var _=require(_0x1f54('0x2'));var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require(_0x1f54('0x3'));var BPromise=require('bluebird');var logger=require('../logger')(_0x1f54('0x4'));var db=require(_0x1f54('0x5'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0x1f54('0x6')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2545cf,_0x2c5fe2){return function(){logger[_0x1f54('0x7')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x2545cf[_0x1f54('0x8')]);var _0x5b5152=!![];var _0xb16458={'tls':{'rejectUnauthorized':![]}};if(_0x2545cf[_0x1f54('0x9')][_0x1f54('0xa')][_0x1f54('0xb')]){_0xb16458[_0x1f54('0xb')]=_0x2545cf['MailAccount']['Smtp'][_0x1f54('0xb')];}else{_0xb16458[_0x1f54('0xc')]=_0x2545cf[_0x1f54('0x9')]['Smtp'][_0x1f54('0xc')];_0xb16458[_0x1f54('0xd')]=_0x2545cf[_0x1f54('0x9')][_0x1f54('0xa')][_0x1f54('0xd')];_0xb16458[_0x1f54('0xe')]=_0x2545cf['MailAccount'][_0x1f54('0xa')][_0x1f54('0xe')];}if(_0x2545cf[_0x1f54('0x9')][_0x1f54('0xa')][_0x1f54('0xf')]){_0xb16458[_0x1f54('0x10')]={'user':_0x2545cf[_0x1f54('0x9')][_0x1f54('0xa')][_0x1f54('0x11')],'pass':_0x2545cf['MailAccount']['Smtp'][_0x1f54('0x12')]};}var _0x3c924c={'account':_0xb16458,'message':{'from':util[_0x1f54('0x13')](_0x1f54('0x14'),_0x2545cf['MailAccount'][_0x1f54('0x15')],_0x2545cf[_0x1f54('0x9')][_0x1f54('0x8')]||_0x2545cf[_0x1f54('0x9')]['Smtp']['user']),'to':_0x2545cf[_0x1f54('0x8')],'cc':_0x2545cf['cc'],'bcc':_0x2545cf[_0x1f54('0x16')],'subject':util[_0x1f54('0x13')](_0x1f54('0x17'),_0x2c5fe2[_0x1f54('0x15')],_0x2545cf[_0x1f54('0x18')],_0x2545cf['subtractUnit'])}};var _0x40ae9b=path[_0x1f54('0x19')](__dirname,_0x1f54('0x1a'));var _0x2b438c=_0x2c5fe2['savename'];var _0x20edbc=util[_0x1f54('0x13')](_0x1f54('0x1b'),path[_0x1f54('0x1c')](_0x2c5fe2[_0x1f54('0x1d')],path[_0x1f54('0x1e')](_0x2c5fe2[_0x1f54('0x1d')])),_0x1f54('0x1f'));var _0x4c696b=path[_0x1f54('0x19')](_0x40ae9b,_0x2b438c);var _0x13f20c=path['join'](_0x40ae9b,_0x20edbc);if(fs[_0x1f54('0x20')](_0x4c696b)){_0x2c5fe2[_0x1f54('0x21')]=_0x1f54('0x22');_0x3c924c['message']['attachments']=[{'filename':_0x2b438c,'path':_0x4c696b}];_0x3c924c[_0x1f54('0x23')][_0x1f54('0x24')]=util[_0x1f54('0x13')](_0x1f54('0x25'),JSON[_0x1f54('0x26')](_0x2c5fe2,null,0x2));}else if(fs['existsSync'](_0x13f20c)){_0x2c5fe2[_0x1f54('0x21')]=_0x1f54('0x22');_0x3c924c[_0x1f54('0x23')]['attachments']=[{'filename':_0x20edbc,'path':_0x13f20c}];}else{_0x3c924c[_0x1f54('0x23')][_0x1f54('0x24')]=_0x1f54('0x27');if(!_0x2545cf['sendIfEmpty']){_0x5b5152=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x5b5152){return client[_0x1f54('0x28')]('SendMail',_0x3c924c)[_0x1f54('0x29')](function(_0x48e216){if(_0x48e216[_0x1f54('0x2a')]){return logger['error'](_0x1f54('0x2b'),JSON[_0x1f54('0x26')](_0x48e216));}return logger[_0x1f54('0x7')](_0x1f54('0x2c'));})[_0x1f54('0x2d')](function(_0x192ec1){return logger[_0x1f54('0x2a')](_0x1f54('0x2b'),JSON[_0x1f54('0x26')](_0x192ec1));});}};}function handleError(){return function(_0x4d7716){return logger[_0x1f54('0x2a')](JSON[_0x1f54('0x26')](_0x4d7716));};}function handleResult(_0x50e037){return function(_0x5498dc){logger[_0x1f54('0x7')](_0x1f54('0x2e'),JSON['stringify'](_0x5498dc));if(_0x50e037['MailAccount']&&_0x50e037[_0x1f54('0x9')][_0x1f54('0xa')]&&!_[_0x1f54('0x2f')](_0x50e037[_0x1f54('0x8')])){setTimeout(handleSendEmail(_0x50e037,_0x5498dc),0x3c*0x3e8);}};}function handleJob(_0x3d660c){return function(){try{if(_[_0x1f54('0x2f')](_0x3d660c[_0x1f54('0x18')])){return logger['info'](_0x1f54('0x30'));}if(_[_0x1f54('0x2f')](_0x3d660c[_0x1f54('0x31')])){return logger[_0x1f54('0x7')]('subtractUnit\x20null\x20or\x20undefined');}var _0x4eac64={'startDate':moment()[_0x1f54('0x32')](_0x3d660c[_0x1f54('0x18')],_0x3d660c[_0x1f54('0x31')])[_0x1f54('0x13')](_0x1f54('0x33')),'endDate':moment()[_0x1f54('0x13')](_0x1f54('0x33')),'type':_0x1f54('0x34'),'output':_0x3d660c[_0x1f54('0x35')],'name':_0x3d660c[_0x1f54('0x15')]};if(!_[_0x1f54('0x2f')](_0x3d660c[_0x1f54('0x36')])){logger[_0x1f54('0x7')](_0x1f54('0x37'),_0x3d660c[_0x1f54('0x36')]);return analyticDefaultReportController['runReport']({'id':_0x3d660c[_0x1f54('0x36')]},_0x4eac64)[_0x1f54('0x29')](handleResult(_0x3d660c))[_0x1f54('0x2d')](handleError());}if(!_[_0x1f54('0x2f')](_0x3d660c['CustomReportId'])){logger[_0x1f54('0x7')]('exec\x20custom\x20report\x20id:%s',_0x3d660c[_0x1f54('0x38')]);return analyticCustomReportController[_0x1f54('0x39')]({'id':_0x3d660c[_0x1f54('0x38')]},_0x4eac64)[_0x1f54('0x29')](handleResult(_0x3d660c))[_0x1f54('0x2d')](handleError());}}catch(_0x318aa9){logger[_0x1f54('0x2a')](JSON[_0x1f54('0x26')](_0x318aa9));}return logger[_0x1f54('0x7')]('no\x20report\x20id');};}function getJobs(_0x18d0a2){var _0x1b8ccc={};if(_0x18d0a2){_0x1b8ccc['id']=_0x18d0a2;}return db[_0x1f54('0x3a')]['findAll']({'where':_0x1b8ccc,'include':[{'model':db[_0x1f54('0x9')],'attributes':['id',_0x1f54('0x15'),_0x1f54('0x8')],'include':[{'model':db[_0x1f54('0x3b')],'as':'Smtp'}]}]})['then'](function(_0x1bbb0c){var _0x20fd0a=_[_0x1f54('0x3c')](manager[_0x1f54('0x3d')]);var _0x43feb7=_[_0x1f54('0x3e')](_0x1bbb0c,function(_0x3ea9df){return _0x3ea9df['id'][_0x1f54('0x3f')]();});var _0x253a53=_[_0x1f54('0x40')](_0x1bbb0c,function(_0x4b5016){return _0x4b5016['id']['toString']();});var _0x39a344=_0x18d0a2?_0x43feb7:_['difference'](_0x43feb7,_0x20fd0a);var _0x12112b=_[_0x1f54('0x41')](_0x43feb7,_0x20fd0a);var _0x291d29=_[_0x1f54('0x42')](_0x20fd0a,_0x43feb7);var _0x16bbdf;var _0xb1805d;for(_0x16bbdf=0x0;_0x16bbdf<_0x291d29[_0x1f54('0x43')]&&!_0x18d0a2;_0x16bbdf+=0x1){_0xb1805d=_0x291d29[_0x16bbdf][_0x1f54('0x3f')]();if(manager[_0x1f54('0x44')](_0xb1805d)){manager['stop'](_0xb1805d);manager['deleteJob'](_0xb1805d);logger[_0x1f54('0x7')]('delete\x20cron',_0xb1805d);}}logger[_0x1f54('0x7')](_0x1f54('0x45'),JSON[_0x1f54('0x26')](_0x39a344));for(_0x16bbdf=0x0;_0x16bbdf<_0x39a344[_0x1f54('0x43')];_0x16bbdf+=0x1){_0xb1805d=_0x39a344[_0x16bbdf][_0x1f54('0x3f')]();logger[_0x1f54('0x7')](_0x1f54('0x46'),_0xb1805d);if(_0x18d0a2){logger[_0x1f54('0x7')](_0x1f54('0x47'),_0x18d0a2);logger[_0x1f54('0x7')](JSON['stringify'](_0x253a53[_0xb1805d]));BPromise[_0x1f54('0x48')]()[_0x1f54('0x29')](handleJob(_0x253a53[_0xb1805d]));logger[_0x1f54('0x7')](_0x1f54('0x49'),_0x253a53[_0xb1805d][_0x1f54('0x15')],_0x253a53[_0xb1805d][_0x1f54('0x4a')]);}else if(_0x253a53[_0xb1805d][_0x1f54('0x4a')]&&_0x253a53[_0xb1805d]['active']&&moment()[_0x1f54('0x4b')](_0x253a53[_0xb1805d][_0x1f54('0x4c')],_0x253a53[_0xb1805d][_0x1f54('0x4d')])){manager['add'](_0xb1805d,_0x253a53[_0xb1805d]['cron'],handleJob(_0x253a53[_0xb1805d]));manager['start'](_0xb1805d);logger[_0x1f54('0x7')](_0x1f54('0x4e'),_0x253a53[_0xb1805d]['name'],_0x253a53[_0xb1805d][_0x1f54('0x4a')]);}else if(manager[_0x1f54('0x44')](_0xb1805d)){manager[_0x1f54('0x4f')](_0xb1805d);manager[_0x1f54('0x50')](_0xb1805d);logger[_0x1f54('0x7')](_0x1f54('0x51'),_0x253a53[_0xb1805d][_0x1f54('0x15')],_0x253a53[_0xb1805d][_0x1f54('0x4a')]);}}for(_0x16bbdf=0x0,_0xb1805d;_0x16bbdf<_0x12112b[_0x1f54('0x43')]&&!_0x18d0a2;_0x16bbdf+=0x1){_0xb1805d=_0x12112b[_0x16bbdf][_0x1f54('0x3f')]();if(manager[_0x1f54('0x44')](_0xb1805d)){if(_0x253a53[_0xb1805d]['cron']&&_0x253a53[_0xb1805d][_0x1f54('0x52')]&&moment()[_0x1f54('0x4b')](_0x253a53[_0xb1805d][_0x1f54('0x4c')],_0x253a53[_0xb1805d][_0x1f54('0x4d')])){manager[_0x1f54('0x53')](_0xb1805d,_0x253a53[_0xb1805d][_0x1f54('0x4a')],handleJob(_0x253a53[_0xb1805d]));logger[_0x1f54('0x7')](_0x1f54('0x54'),_0x253a53[_0xb1805d][_0x1f54('0x15')],_0x253a53[_0xb1805d][_0x1f54('0x4a')]);}else{manager['stop'](_0xb1805d);manager[_0x1f54('0x50')](_0xb1805d);logger[_0x1f54('0x7')]('stop\x20cron',_0x253a53[_0xb1805d][_0x1f54('0x15')],_0x253a53[_0xb1805d][_0x1f54('0x4a')]);}}}})[_0x1f54('0x2d')](function(_0x34e485){logger['error'](JSON['stringify'](_0x34e485));});}exports[_0x1f54('0x55')]=function(_0x10307b){return getJobs(_0x10307b);};exports[_0x1f54('0x56')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x927f=['update\x20cron','run','util','lodash','moment','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','service','host','Smtp','port','secure','authentication','user','pass','format','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','%s.%s','basename','savename','extname','zip','join','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','start','add\x20cron','stop\x20cron','endAt'];(function(_0x564d53,_0x31ac8a){var _0x1ba891=function(_0x51cad3){while(--_0x51cad3){_0x564d53['push'](_0x564d53['shift']());}};_0x1ba891(++_0x31ac8a);}(_0x927f,0x10d));var _0xf927=function(_0x5727e9,_0x4794bd){_0x5727e9=_0x5727e9-0x0;var _0x49da38=_0x927f[_0x5727e9];return _0x49da38;};'use strict';var fs=require('fs');var util=require(_0xf927('0x0'));var path=require('path');var _=require(_0xf927('0x1'));var moment=require(_0xf927('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xf927('0x3'))(_0xf927('0x4'));var db=require(_0xf927('0x5'))['db'];var analyticCustomReportController=require(_0xf927('0x6'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xf927('0x7')][_0xf927('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x55e03e,_0x2a7de9){return function(){logger['info'](_0xf927('0x9'),_0x55e03e[_0xf927('0xa')]);var _0x19d5a9=!![];var _0x2fe2c1={'tls':{'rejectUnauthorized':![]}};if(_0x55e03e[_0xf927('0xb')]['Smtp'][_0xf927('0xc')]){_0x2fe2c1[_0xf927('0xc')]=_0x55e03e[_0xf927('0xb')]['Smtp'][_0xf927('0xc')];}else{_0x2fe2c1[_0xf927('0xd')]=_0x55e03e['MailAccount']['Smtp']['host'];_0x2fe2c1['port']=_0x55e03e[_0xf927('0xb')][_0xf927('0xe')][_0xf927('0xf')];_0x2fe2c1['secure']=_0x55e03e['MailAccount'][_0xf927('0xe')][_0xf927('0x10')];}if(_0x55e03e[_0xf927('0xb')]['Smtp'][_0xf927('0x11')]){_0x2fe2c1['auth']={'user':_0x55e03e['MailAccount'][_0xf927('0xe')][_0xf927('0x12')],'pass':_0x55e03e[_0xf927('0xb')][_0xf927('0xe')][_0xf927('0x13')]};}var _0x37d4bc={'account':_0x2fe2c1,'message':{'from':util[_0xf927('0x14')]('\x22%s\x22\x20<%s>',_0x55e03e['MailAccount'][_0xf927('0x15')],_0x55e03e[_0xf927('0xb')]['email']||_0x55e03e[_0xf927('0xb')]['Smtp']['user']),'to':_0x55e03e[_0xf927('0xa')],'cc':_0x55e03e['cc'],'bcc':_0x55e03e[_0xf927('0x16')],'subject':util[_0xf927('0x14')](_0xf927('0x17'),_0x2a7de9[_0xf927('0x15')],_0x55e03e[_0xf927('0x18')],_0x55e03e[_0xf927('0x19')])}};var _0xca6c7a=path['join'](__dirname,'../../files/reports');var _0x584846=_0x2a7de9['savename'];var _0x39b2d1=util[_0xf927('0x14')](_0xf927('0x1a'),path[_0xf927('0x1b')](_0x2a7de9[_0xf927('0x1c')],path[_0xf927('0x1d')](_0x2a7de9[_0xf927('0x1c')])),_0xf927('0x1e'));var _0x217891=path[_0xf927('0x1f')](_0xca6c7a,_0x584846);var _0x1cd001=path[_0xf927('0x1f')](_0xca6c7a,_0x39b2d1);if(fs[_0xf927('0x20')](_0x217891)){_0x2a7de9[_0xf927('0x21')]=_0xf927('0x22');_0x37d4bc[_0xf927('0x23')]['attachments']=[{'filename':_0x584846,'path':_0x217891}];_0x37d4bc['message'][_0xf927('0x24')]=util[_0xf927('0x14')](_0xf927('0x25'),JSON[_0xf927('0x26')](_0x2a7de9,null,0x2));}else if(fs[_0xf927('0x20')](_0x1cd001)){_0x2a7de9[_0xf927('0x21')]='Sent';_0x37d4bc[_0xf927('0x23')]['attachments']=[{'filename':_0x39b2d1,'path':_0x1cd001}];}else{_0x37d4bc[_0xf927('0x23')]['text']=_0xf927('0x27');if(!_0x55e03e[_0xf927('0x28')]){_0x19d5a9=![];logger[_0xf927('0x29')](_0xf927('0x2a'));}}if(_0x19d5a9){return client[_0xf927('0x2b')]('SendMail',_0x37d4bc)[_0xf927('0x2c')](function(_0x399f07){if(_0x399f07[_0xf927('0x2d')]){return logger['error'](_0xf927('0x2e'),JSON[_0xf927('0x26')](_0x399f07));}return logger['info'](_0xf927('0x2f'));})[_0xf927('0x30')](function(_0x24a355){return logger['error'](_0xf927('0x2e'),JSON[_0xf927('0x26')](_0x24a355));});}};}function handleError(){return function(_0x2aea13){return logger[_0xf927('0x2d')](JSON['stringify'](_0x2aea13));};}function handleResult(_0x324a56){return function(_0x5c9a4f){logger[_0xf927('0x29')](_0xf927('0x31'),JSON['stringify'](_0x5c9a4f));if(_0x324a56[_0xf927('0xb')]&&_0x324a56[_0xf927('0xb')]['Smtp']&&!_[_0xf927('0x32')](_0x324a56['email'])){setTimeout(handleSendEmail(_0x324a56,_0x5c9a4f),0x3c*0x3e8);}};}function handleJob(_0x1bbb51){return function(){try{if(_[_0xf927('0x32')](_0x1bbb51[_0xf927('0x18')])){return logger[_0xf927('0x29')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xf927('0x32')](_0x1bbb51[_0xf927('0x19')])){return logger['info'](_0xf927('0x33'));}var _0x1c20b6={'startDate':moment()[_0xf927('0x34')](_0x1bbb51[_0xf927('0x18')],_0x1bbb51[_0xf927('0x19')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xf927('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xf927('0x35'),'output':_0x1bbb51[_0xf927('0x36')],'name':_0x1bbb51[_0xf927('0x15')]};if(!_[_0xf927('0x32')](_0x1bbb51[_0xf927('0x37')])){logger[_0xf927('0x29')](_0xf927('0x38'),_0x1bbb51[_0xf927('0x37')]);return analyticDefaultReportController[_0xf927('0x39')]({'id':_0x1bbb51[_0xf927('0x37')]},_0x1c20b6)['then'](handleResult(_0x1bbb51))[_0xf927('0x30')](handleError());}if(!_[_0xf927('0x32')](_0x1bbb51[_0xf927('0x3a')])){logger[_0xf927('0x29')]('exec\x20custom\x20report\x20id:%s',_0x1bbb51[_0xf927('0x3a')]);return analyticCustomReportController[_0xf927('0x39')]({'id':_0x1bbb51['CustomReportId']},_0x1c20b6)[_0xf927('0x2c')](handleResult(_0x1bbb51))[_0xf927('0x30')](handleError());}}catch(_0xa3b969){logger[_0xf927('0x2d')](JSON[_0xf927('0x26')](_0xa3b969));}return logger[_0xf927('0x29')](_0xf927('0x3b'));};}function getJobs(_0x36123c){var _0x37221e={};if(_0x36123c){_0x37221e['id']=_0x36123c;}return db[_0xf927('0x3c')][_0xf927('0x3d')]({'where':_0x37221e,'include':[{'model':db['MailAccount'],'attributes':['id','name',_0xf927('0xa')],'include':[{'model':db[_0xf927('0x3e')],'as':_0xf927('0xe')}]}]})[_0xf927('0x2c')](function(_0x2b675f){var _0x29d9b8=_[_0xf927('0x3f')](manager[_0xf927('0x40')]);var _0xd5b82a=_[_0xf927('0x41')](_0x2b675f,function(_0x44b9b9){return _0x44b9b9['id'][_0xf927('0x42')]();});var _0xb8aa34=_[_0xf927('0x43')](_0x2b675f,function(_0x507035){return _0x507035['id']['toString']();});var _0x225db9=_0x36123c?_0xd5b82a:_[_0xf927('0x44')](_0xd5b82a,_0x29d9b8);var _0x4f9e24=_[_0xf927('0x45')](_0xd5b82a,_0x29d9b8);var _0xe4fcfc=_[_0xf927('0x44')](_0x29d9b8,_0xd5b82a);var _0x253194;var _0x4afb39;for(_0x253194=0x0;_0x253194<_0xe4fcfc[_0xf927('0x46')]&&!_0x36123c;_0x253194+=0x1){_0x4afb39=_0xe4fcfc[_0x253194][_0xf927('0x42')]();if(manager[_0xf927('0x47')](_0x4afb39)){manager[_0xf927('0x48')](_0x4afb39);manager[_0xf927('0x49')](_0x4afb39);logger[_0xf927('0x29')](_0xf927('0x4a'),_0x4afb39);}}logger[_0xf927('0x29')]('toRun',JSON[_0xf927('0x26')](_0x225db9));for(_0x253194=0x0;_0x253194<_0x225db9['length'];_0x253194+=0x1){_0x4afb39=_0x225db9[_0x253194][_0xf927('0x42')]();logger[_0xf927('0x29')](_0xf927('0x4b'),_0x4afb39);if(_0x36123c){logger['info'](_0xf927('0x4c'),_0x36123c);logger[_0xf927('0x29')](JSON['stringify'](_0xb8aa34[_0x4afb39]));BPromise[_0xf927('0x4d')]()['then'](handleJob(_0xb8aa34[_0x4afb39]));logger['info'](_0xf927('0x4e'),_0xb8aa34[_0x4afb39][_0xf927('0x15')],_0xb8aa34[_0x4afb39][_0xf927('0x4f')]);}else if(_0xb8aa34[_0x4afb39][_0xf927('0x4f')]&&_0xb8aa34[_0x4afb39][_0xf927('0x50')]&&moment()[_0xf927('0x51')](_0xb8aa34[_0x4afb39][_0xf927('0x52')],_0xb8aa34[_0x4afb39]['endAt'])){manager['add'](_0x4afb39,_0xb8aa34[_0x4afb39]['cron'],handleJob(_0xb8aa34[_0x4afb39]));manager[_0xf927('0x53')](_0x4afb39);logger['info'](_0xf927('0x54'),_0xb8aa34[_0x4afb39][_0xf927('0x15')],_0xb8aa34[_0x4afb39][_0xf927('0x4f')]);}else if(manager[_0xf927('0x47')](_0x4afb39)){manager['stop'](_0x4afb39);manager[_0xf927('0x49')](_0x4afb39);logger[_0xf927('0x29')](_0xf927('0x55'),_0xb8aa34[_0x4afb39][_0xf927('0x15')],_0xb8aa34[_0x4afb39][_0xf927('0x4f')]);}}for(_0x253194=0x0,_0x4afb39;_0x253194<_0x4f9e24[_0xf927('0x46')]&&!_0x36123c;_0x253194+=0x1){_0x4afb39=_0x4f9e24[_0x253194]['toString']();if(manager[_0xf927('0x47')](_0x4afb39)){if(_0xb8aa34[_0x4afb39]['cron']&&_0xb8aa34[_0x4afb39][_0xf927('0x50')]&&moment()['isBetween'](_0xb8aa34[_0x4afb39]['startAt'],_0xb8aa34[_0x4afb39][_0xf927('0x56')])){manager['update'](_0x4afb39,_0xb8aa34[_0x4afb39][_0xf927('0x4f')],handleJob(_0xb8aa34[_0x4afb39]));logger[_0xf927('0x29')](_0xf927('0x57'),_0xb8aa34[_0x4afb39][_0xf927('0x15')],_0xb8aa34[_0x4afb39][_0xf927('0x4f')]);}else{manager[_0xf927('0x48')](_0x4afb39);manager[_0xf927('0x49')](_0x4afb39);logger[_0xf927('0x29')]('stop\x20cron',_0xb8aa34[_0x4afb39][_0xf927('0x15')],_0xb8aa34[_0x4afb39][_0xf927('0x4f')]);}}}})['catch'](function(_0x56664f){logger[_0xf927('0x2d')](JSON['stringify'](_0x56664f));});}exports[_0xf927('0x58')]=function(_0x39eb29){return getJobs(_0x39eb29);};exports[_0xf927('0x53')]=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 e3fb84b..75c554d 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf169=['CmHopper','log','hopper1','contacts2','hopper2','catch','../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','destroy','then','CmContact','bulkCreate','finished\x20populating','contacts1'];(function(_0xf7c91b,_0x242f8c){var _0x464692=function(_0x4671d9){while(--_0x4671d9){_0xf7c91b['push'](_0xf7c91b['shift']());}};_0x464692(++_0x242f8c);}(_0xf169,0x123));var _0x9f16=function(_0x1cdbb2,_0x5661b6){_0x1cdbb2=_0x1cdbb2-0x0;var _0x33279e=_0xf169[_0x1cdbb2];return _0x33279e;};'use strict';var util=require('util');var db=require(_0x9f16('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x9f16('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x9f16('0x2')+i,'phone':0xf879fb460+i,'email':_0x9f16('0x3')+i+_0x9f16('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x9f16('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x9f16('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x9f16('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x9f16('0x1')]({'id':i,'firstName':_0x9f16('0x6')+i,'lastName':_0x9f16('0x2')+i,'phone':0xf879fb460+i,'email':_0x9f16('0x3')+i+_0x9f16('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x9f16('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x9f16('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9f16('0x5')](),'updatedAt':Date['now']()});}db['CmContact'][_0x9f16('0x7')]({'where':{}})[_0x9f16('0x8')](function(){return db[_0x9f16('0x9')][_0x9f16('0xa')](contacts);})[_0x9f16('0x8')](function(){console['log'](_0x9f16('0xb'),_0x9f16('0xc'));return db['CmHopper']['destroy']({'where':{}});})[_0x9f16('0x8')](function(){return db[_0x9f16('0xd')][_0x9f16('0xa')](hopper);})[_0x9f16('0x8')](function(){console[_0x9f16('0xe')]('finished\x20populating',_0x9f16('0xf'));return db[_0x9f16('0x9')][_0x9f16('0xa')](contacts2);})['then'](function(){console[_0x9f16('0xe')](_0x9f16('0xb'),_0x9f16('0x10'));return db[_0x9f16('0xd')][_0x9f16('0xa')](hopper2);})[_0x9f16('0x8')](function(){console[_0x9f16('0xe')](_0x9f16('0xb'),_0x9f16('0x11'));})[_0x9f16('0x12')](function(_0x106b62){console['log'](_0x106b62);}); \ No newline at end of file +var _0x12f9=['now','Innocenzo','innocenzo.biondo','@xcally.com','destroy','then','CmContact','bulkCreate','log','finished\x20populating','CmHopper','hopper1','hopper2','catch','util','../mysqldb','push','Biondo'];(function(_0x1c4550,_0x1bbd85){var _0x12bcab=function(_0x1a1540){while(--_0x1a1540){_0x1c4550['push'](_0x1c4550['shift']());}};_0x12bcab(++_0x1bbd85);}(_0x12f9,0xc2));var _0x912f=function(_0xa628df,_0x347ee7){_0xa628df=_0xa628df-0x0;var _0x399886=_0x12f9[_0xa628df];return _0x399886;};'use strict';var util=require(_0x912f('0x0'));var db=require(_0x912f('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x912f('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x912f('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x912f('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x912f('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x912f('0x4')](),'updatedAt':Date[_0x912f('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x912f('0x5')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x912f('0x6')+i+_0x912f('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x912f('0x4')](),'updatedAt':Date[_0x912f('0x4')]()});}db['CmContact'][_0x912f('0x8')]({'where':{}})[_0x912f('0x9')](function(){return db[_0x912f('0xa')][_0x912f('0xb')](contacts);})[_0x912f('0x9')](function(){console[_0x912f('0xc')](_0x912f('0xd'),'contacts1');return db[_0x912f('0xe')]['destroy']({'where':{}});})[_0x912f('0x9')](function(){return db[_0x912f('0xe')][_0x912f('0xb')](hopper);})['then'](function(){console[_0x912f('0xc')](_0x912f('0xd'),_0x912f('0xf'));return db[_0x912f('0xa')][_0x912f('0xb')](contacts2);})[_0x912f('0x9')](function(){console[_0x912f('0xc')]('finished\x20populating','contacts2');return db[_0x912f('0xe')][_0x912f('0xb')](hopper2);})[_0x912f('0x9')](function(){console[_0x912f('0xc')](_0x912f('0xd'),_0x912f('0x10'));})[_0x912f('0x11')](function(_0x1c65f2){console[_0x912f('0xc')](_0x1c65f2);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index b4eab04..04efa80 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0045=['%s%s','agent','%s%s@xcally.com','password','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','log','util','../mysqldb','push','format'];(function(_0x1053e5,_0x29ba8d){var _0x55d410=function(_0x17e21c){while(--_0x17e21c){_0x1053e5['push'](_0x1053e5['shift']());}};_0x55d410(++_0x29ba8d);}(_0x0045,0xd8));var _0x5004=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0045[_0x2641f9];return _0x585741;};'use strict';var util=require(_0x5004('0x0'));var db=require(_0x5004('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x5004('0x2')]({'name':util[_0x5004('0x3')](_0x5004('0x4'),'agent',i),'fullname':util[_0x5004('0x3')]('%s%s',_0x5004('0x5'),i),'email':util[_0x5004('0x3')](_0x5004('0x6'),_0x5004('0x5'),i),'role':_0x5004('0x5'),'password':_0x5004('0x7'),'internal':0xfa0+i,'type':'friend','transport':[_0x5004('0x8'),'ws',_0x5004('0x9')],'disallow':[_0x5004('0xa')],'allow':[_0x5004('0xb')],'defaultuser':util[_0x5004('0x3')](_0x5004('0x4'),_0x5004('0x5'),i),'encryption':_0x5004('0xc'),'avpf':'yes','force_avp':'yes','icesupport':_0x5004('0xc'),'dtlsenable':_0x5004('0xc'),'dtlsverify':'no','dtlscertfile':_0x5004('0xd'),'dtlsprivatekey':_0x5004('0xe'),'dtlssetup':_0x5004('0xf'),'callerid':util[_0x5004('0x3')]('\x22%s\x22\x20<%s>',util['format']('%s%s',_0x5004('0x5'),i),0xfa0+i)});}db[_0x5004('0x10')][_0x5004('0x11')](users)[_0x5004('0x12')](function(){console[_0x5004('0x13')]('add\x20user');})['catch'](function(_0x41c084){console[_0x5004('0x13')](_0x41c084);}); \ No newline at end of file +var _0xf43e=['agent','format','%s%s@xcally.com','password','friend','udp','wss','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','then','log','add\x20user','catch','util','%s%s'];(function(_0x13908b,_0x198bf8){var _0x171c6d=function(_0x5114ef){while(--_0x5114ef){_0x13908b['push'](_0x13908b['shift']());}};_0x171c6d(++_0x198bf8);}(_0xf43e,0xcf));var _0xef43=function(_0x4674b7,_0x46e906){_0x4674b7=_0x4674b7-0x0;var _0x503198=_0xf43e[_0x4674b7];return _0x503198;};'use strict';var util=require(_0xef43('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0xef43('0x1'),_0xef43('0x2'),i),'fullname':util[_0xef43('0x3')](_0xef43('0x1'),_0xef43('0x2'),i),'email':util['format'](_0xef43('0x4'),_0xef43('0x2'),i),'role':_0xef43('0x2'),'password':_0xef43('0x5'),'internal':0xfa0+i,'type':_0xef43('0x6'),'transport':[_0xef43('0x7'),'ws',_0xef43('0x8')],'disallow':[_0xef43('0x9')],'allow':['ulaw'],'defaultuser':util[_0xef43('0x3')](_0xef43('0x1'),_0xef43('0x2'),i),'encryption':_0xef43('0xa'),'avpf':_0xef43('0xa'),'force_avp':_0xef43('0xa'),'icesupport':_0xef43('0xa'),'dtlsenable':_0xef43('0xa'),'dtlsverify':'no','dtlscertfile':_0xef43('0xb'),'dtlsprivatekey':_0xef43('0xc'),'dtlssetup':_0xef43('0xd'),'callerid':util[_0xef43('0x3')]('\x22%s\x22\x20<%s>',util[_0xef43('0x3')](_0xef43('0x1'),_0xef43('0x2'),i),0xfa0+i)});}db[_0xef43('0xe')]['bulkCreate'](users)[_0xef43('0xf')](function(){console[_0xef43('0x10')](_0xef43('0x11'));})[_0xef43('0x12')](function(_0x3caf23){console[_0xef43('0x10')](_0x3caf23);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 794cd3d..bb73c82 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf089=['openchannel','telephone:%s','trunk:%s','campaign:%s:%s','map','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','leave','user_has_fax_interactions:remove','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','join','connection','setMaxListeners','address','remoteAddress','request','connectedAt','log','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','util','bluebird','./environment','name','Agents','User','role','agent','telephone','type','ivr','%s:queue:%s','length','format','handshake','query','ChatInteraction','MailInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','then','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','findAll','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','Trunk','Campaign','user','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getVoiceQueues','getSmsQueues','voice','chat','fax','sms','mail'];(function(_0x353c55,_0x1b060a){var _0x2826f6=function(_0x3b0cb6){while(--_0x3b0cb6){_0x353c55['push'](_0x353c55['shift']());}};_0x2826f6(++_0x1b060a);}(_0xf089,0xba));var _0x9f08=function(_0x106d6c,_0x41c298){_0x106d6c=_0x106d6c-0x0;var _0x5db254=_0xf089[_0x106d6c];return _0x5db254;};'use strict';var _=require('lodash');var util=require(_0x9f08('0x0'));var BPromise=require(_0x9f08('0x1'));var db=require('../mysqldb')['db'];var config=require(_0x9f08('0x2'));var queryQueues={'attributes':['id',_0x9f08('0x3')],'include':[{'as':_0x9f08('0x4'),'model':db[_0x9f08('0x5')],'attributes':['id','name',_0x9f08('0x6')],'raw':!![],'where':{'role':_0x9f08('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x9f08('0x3')],'where':{'role':_0x9f08('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x9f08('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x9f08('0x3')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x9f08('0x3'),_0x9f08('0x9')],'where':{'type':_0x9f08('0xa')}};function joinOrLeaveQueues(_0x4ce5b6,_0x4358e7,_0x286809,_0x3868b6){_0x4ce5b6[_0x4358e7](util['format'](_0x9f08('0xb'),_0x286809,_0x3868b6[_0x9f08('0x3')]));if(_0x3868b6[_0x9f08('0x4')]){for(var _0x5c6517=0x0;_0x5c6517<_0x3868b6['Agents'][_0x9f08('0xc')];_0x5c6517+=0x1){_0x4ce5b6[_0x4358e7](util[_0x9f08('0xd')]('user:%s',_0x3868b6[_0x9f08('0x4')][_0x5c6517][_0x9f08('0x3')]));}}}function joinOrLeave(_0x251b84,_0x597ae8,_0x582be0){var _0x9cd154;if(_0x251b84[_0x9f08('0xe')][_0x9f08('0xf')]['id']){db[_0x9f08('0x5')]['find']({'attributes':['id',_0x9f08('0x3'),_0x9f08('0x6')],'where':{'id':_0x251b84[_0x9f08('0xe')][_0x9f08('0xf')]['id']},'include':[{'model':db[_0x9f08('0x10')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9f08('0x11')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x9f08('0x12'),'attributes':['id'],'raw':!![]},{'model':db[_0x9f08('0x13')],'as':_0x9f08('0x14'),'attributes':['id'],'raw':!![]},{'model':db[_0x9f08('0x15')],'as':_0x9f08('0x16'),'attributes':['id'],'raw':!![]}]})[_0x9f08('0x17')](function(_0x40c97a){if(_0x40c97a){_0x9cd154=_0x40c97a;_0x251b84[_0x597ae8](util[_0x9f08('0xd')](_0x9f08('0x18'),_0x40c97a[_0x9f08('0x3')]));var _0x2558fc=[];switch(_0x40c97a[_0x9f08('0x6')]){case _0x9f08('0x19'):_0x251b84[_0x597ae8](_0x9f08('0x1a'));_0x251b84[_0x597ae8](_0x9f08('0x1b'));if(queryQueues[_0x9f08('0x1c')]('include')){delete queryQueues[_0x9f08('0x1d')];}_0x2558fc[_0x9f08('0x1e')](db[_0x9f08('0x1f')][_0x9f08('0x20')](queryQueues));_0x2558fc[_0x9f08('0x1e')](db[_0x9f08('0x21')]['findAll'](queryQueues));_0x2558fc[_0x9f08('0x1e')](db[_0x9f08('0x22')][_0x9f08('0x20')](queryQueues));_0x2558fc[_0x9f08('0x1e')](db[_0x9f08('0x23')][_0x9f08('0x20')](queryQueues));_0x2558fc[_0x9f08('0x1e')](db['MailQueue']['findAll'](queryQueues));_0x2558fc[_0x9f08('0x1e')](db[_0x9f08('0x24')][_0x9f08('0x20')](queryQueues));_0x2558fc[_0x9f08('0x1e')](db[_0x9f08('0x5')][_0x9f08('0x20')](queryTelephones));_0x2558fc[_0x9f08('0x1e')](db[_0x9f08('0x25')]['findAll'](queryTrunks));_0x2558fc[_0x9f08('0x1e')](db[_0x9f08('0x26')][_0x9f08('0x20')](queryCampaigns));_0x2558fc[_0x9f08('0x1e')](db[_0x9f08('0x5')][_0x9f08('0x20')](queryAgents));break;case _0x9f08('0x27'):_0x251b84[_0x597ae8](_0x9f08('0x1a'));_0x251b84[_0x597ae8]('voice:outbound');_0x2558fc[_0x9f08('0x1e')](_0x40c97a['getVoiceQueues'](queryQueues));_0x2558fc[_0x9f08('0x1e')](_0x40c97a[_0x9f08('0x28')](queryQueues));_0x2558fc[_0x9f08('0x1e')](_0x40c97a[_0x9f08('0x29')](queryQueues));_0x2558fc[_0x9f08('0x1e')](_0x40c97a['getSmsQueues'](queryQueues));_0x2558fc[_0x9f08('0x1e')](_0x40c97a[_0x9f08('0x2a')](queryQueues));_0x2558fc[_0x9f08('0x1e')](_0x40c97a[_0x9f08('0x2b')](queryQueues));_0x2558fc[_0x9f08('0x1e')](db[_0x9f08('0x5')][_0x9f08('0x20')](queryTelephones));_0x2558fc[_0x9f08('0x1e')](db[_0x9f08('0x25')]['findAll'](queryTrunks));_0x2558fc[_0x9f08('0x1e')](db['Campaign'][_0x9f08('0x20')](queryCampaigns));_0x2558fc[_0x9f08('0x1e')](db[_0x9f08('0x5')][_0x9f08('0x20')](queryAgents));break;case _0x9f08('0x7'):_0x251b84[_0x597ae8](_0x9f08('0x1a'));_0x251b84[_0x597ae8]('voice:outbound');_0x2558fc[_0x9f08('0x1e')](_0x40c97a[_0x9f08('0x2c')]({'attributes':['id',_0x9f08('0x3')]}));_0x2558fc[_0x9f08('0x1e')](_0x40c97a[_0x9f08('0x28')]({'attributes':['id',_0x9f08('0x3')]}));_0x2558fc['push'](_0x40c97a[_0x9f08('0x29')]({'attributes':['id','name']}));_0x2558fc[_0x9f08('0x1e')](_0x40c97a[_0x9f08('0x2d')]({'attributes':['id',_0x9f08('0x3')]}));_0x2558fc[_0x9f08('0x1e')](_0x40c97a[_0x9f08('0x2a')]({'attributes':['id','name']}));_0x2558fc[_0x9f08('0x1e')](_0x40c97a[_0x9f08('0x2b')]({'attributes':['id',_0x9f08('0x3')]}));break;}return BPromise['all'](_0x2558fc);}})[_0x9f08('0x17')](function(_0x445fe8){if(_0x445fe8&&_0x445fe8[_0x9f08('0xc')]){for(var _0x4618db=0x0;_0x4618db<_0x445fe8[_0x9f08('0xc')];_0x4618db+=0x1){for(var _0x5f33c0=0x0;_0x5f33c0<_0x445fe8[_0x4618db][_0x9f08('0xc')];_0x5f33c0+=0x1){switch(_0x4618db){case 0x0:joinOrLeaveQueues(_0x251b84,_0x597ae8,_0x9f08('0x2e'),_0x445fe8[_0x4618db][_0x5f33c0]);break;case 0x1:joinOrLeaveQueues(_0x251b84,_0x597ae8,_0x9f08('0x2f'),_0x445fe8[_0x4618db][_0x5f33c0]);break;case 0x2:joinOrLeaveQueues(_0x251b84,_0x597ae8,_0x9f08('0x30'),_0x445fe8[_0x4618db][_0x5f33c0]);break;case 0x3:joinOrLeaveQueues(_0x251b84,_0x597ae8,_0x9f08('0x31'),_0x445fe8[_0x4618db][_0x5f33c0]);break;case 0x4:joinOrLeaveQueues(_0x251b84,_0x597ae8,_0x9f08('0x32'),_0x445fe8[_0x4618db][_0x5f33c0]);break;case 0x5:joinOrLeaveQueues(_0x251b84,_0x597ae8,_0x9f08('0x33'),_0x445fe8[_0x4618db][_0x5f33c0]);break;case 0x6:_0x251b84[_0x597ae8](util[_0x9f08('0xd')](_0x9f08('0x34'),_0x445fe8[_0x4618db][_0x5f33c0][_0x9f08('0x3')]));break;case 0x7:_0x251b84[_0x597ae8](util[_0x9f08('0xd')](_0x9f08('0x35'),_0x445fe8[_0x4618db][_0x5f33c0][_0x9f08('0x3')]));break;case 0x8:_0x251b84[_0x597ae8](util['format'](_0x9f08('0x36'),_0x445fe8[_0x4618db][_0x5f33c0][_0x9f08('0x9')],_0x445fe8[_0x4618db][_0x5f33c0]['name']));break;case 0x9:_0x251b84[_0x597ae8](util[_0x9f08('0xd')](_0x9f08('0x18'),_0x445fe8[_0x4618db][_0x5f33c0][_0x9f08('0x3')]));break;}}}}})[_0x9f08('0x17')](function(){if(_0x597ae8==='leave'){var _0x180d85=_[_0x9f08('0x37')](_0x9cd154[_0x9f08('0x38')],'id');return _0x9cd154[_0x9f08('0x39')](_0x180d85)[_0x9f08('0x17')](function(){for(var _0x249199=0x0;_0x249199<_0x180d85['length'];_0x249199+=0x1){_0x582be0[_0x9f08('0x3a')](_0x9f08('0x3b'),{'ChatInteractionId':Number(_0x180d85[_0x249199]),'UserId':Number(_0x9cd154['id'])});}});}})[_0x9f08('0x17')](function(){if(_0x597ae8==='leave'){var _0x3b396a=_['map'](_0x9cd154[_0x9f08('0x3c')],'id');return _0x9cd154[_0x9f08('0x3d')](_0x3b396a)[_0x9f08('0x17')](function(){for(var _0x4e4230=0x0;_0x4e4230<_0x3b396a[_0x9f08('0xc')];_0x4e4230+=0x1){_0x582be0[_0x9f08('0x3a')](_0x9f08('0x3e'),{'MailInteractionId':Number(_0x3b396a[_0x4e4230]),'UserId':Number(_0x9cd154['id'])});}});}})[_0x9f08('0x17')](function(){if(_0x597ae8===_0x9f08('0x3f')){var _0x181217=_['map'](_0x9cd154[_0x9f08('0x12')],'id');return _0x9cd154['removeFaxInteractions'](_0x181217)[_0x9f08('0x17')](function(){for(var _0xdacb1b=0x0;_0xdacb1b<_0x181217[_0x9f08('0xc')];_0xdacb1b+=0x1){_0x582be0[_0x9f08('0x3a')](_0x9f08('0x40'),{'FaxInteractionId':Number(_0x181217[_0xdacb1b]),'UserId':Number(_0x9cd154['id'])});}});}})[_0x9f08('0x17')](function(){if(_0x597ae8===_0x9f08('0x3f')){var _0x581ae5=_['map'](_0x9cd154['SmsInteractions'],'id');return _0x9cd154['removeSmsInteractions'](_0x581ae5)['then'](function(){for(var _0x308fd9=0x0;_0x308fd9<_0x581ae5[_0x9f08('0xc')];_0x308fd9+=0x1){_0x582be0['emit'](_0x9f08('0x41'),{'SmsInteractionId':Number(_0x581ae5[_0x308fd9]),'UserId':Number(_0x9cd154['id'])});}});}})['then'](function(){if(_0x597ae8===_0x9f08('0x3f')){var _0x71d00a=_[_0x9f08('0x37')](_0x9cd154[_0x9f08('0x16')],'id');return _0x9cd154['removeOpenchannelInteractions'](_0x71d00a)[_0x9f08('0x17')](function(){for(var _0x131d09=0x0;_0x131d09<_0x71d00a[_0x9f08('0xc')];_0x131d09+=0x1){_0x582be0['emit'](_0x9f08('0x42'),{'OpenchannelInteractionId':Number(_0x71d00a[_0x131d09]),'UserId':Number(_0x9cd154['id'])});}});}})['catch'](function(_0x55d98d){_0x251b84['log'](_0x55d98d);});}}function onDisconnect(_0x2639c1,_0x3579b9){joinOrLeave(_0x2639c1,_0x9f08('0x3f'),_0x3579b9);}function onConnect(_0x257613){joinOrLeave(_0x257613,_0x9f08('0x43'));}exports['default']=function(_0x5b45af){_0x5b45af['on'](_0x9f08('0x44'),function(_0x574b2a){_0x574b2a[_0x9f08('0x45')](0x0);_0x574b2a[_0x9f08('0x46')]=_0x574b2a['request'][_0x9f08('0x44')][_0x9f08('0x47')]+':'+_0x574b2a[_0x9f08('0x48')][_0x9f08('0x44')]['remotePort'];_0x574b2a[_0x9f08('0x49')]=new Date();_0x574b2a[_0x9f08('0x4a')]=function(_0x54cf7b){console['log'](_0x9f08('0x4b')+_0x574b2a['nsp'][_0x9f08('0x3')]+'['+_0x574b2a[_0x9f08('0x46')]+']',_0x54cf7b);};_0x574b2a['on'](_0x9f08('0x4c'),function(){onDisconnect(_0x574b2a,_0x5b45af);_0x574b2a['log'](_0x9f08('0x4d'));});onConnect(_0x574b2a);_0x574b2a[_0x9f08('0x4a')](_0x9f08('0x4e'));});}; \ No newline at end of file +var _0x7794=['user','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','agent','all','voice','chat','fax','sms','mail','openchannel','telephone:%s','campaign:%s:%s','leave','map','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','catch','log','join','default','connection','setMaxListeners','address','request','remotePort','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','./environment','Agents','User','role','name','type','ivr','%s:queue:%s','length','format','user:%s','handshake','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','then','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','ChatQueue','findAll','push','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','Campaign'];(function(_0x4fd5fe,_0x4dc3d5){var _0x28ae60=function(_0x376c49){while(--_0x376c49){_0x4fd5fe['push'](_0x4fd5fe['shift']());}};_0x28ae60(++_0x4dc3d5);}(_0x7794,0x7b));var _0x4779=function(_0x2a0b1c,_0x189bb8){_0x2a0b1c=_0x2a0b1c-0x0;var _0x14d718=_0x7794[_0x2a0b1c];return _0x14d718;};'use strict';var _=require('lodash');var util=require(_0x4779('0x0'));var BPromise=require(_0x4779('0x1'));var db=require(_0x4779('0x2'))['db'];var config=require(_0x4779('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x4779('0x4'),'model':db[_0x4779('0x5')],'attributes':['id','name',_0x4779('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x4779('0x7')]};var queryAgents={'raw':!![],'attributes':['id',_0x4779('0x7')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x4779('0x7'),_0x4779('0x8')],'where':{'type':_0x4779('0x9')}};function joinOrLeaveQueues(_0x20e2af,_0x9d7a62,_0x7179e1,_0x42e4c0){_0x20e2af[_0x9d7a62](util['format'](_0x4779('0xa'),_0x7179e1,_0x42e4c0[_0x4779('0x7')]));if(_0x42e4c0[_0x4779('0x4')]){for(var _0x38bffc=0x0;_0x38bffc<_0x42e4c0[_0x4779('0x4')][_0x4779('0xb')];_0x38bffc+=0x1){_0x20e2af[_0x9d7a62](util[_0x4779('0xc')](_0x4779('0xd'),_0x42e4c0[_0x4779('0x4')][_0x38bffc][_0x4779('0x7')]));}}}function joinOrLeave(_0x50e17e,_0x5b1219,_0x5616ba){var _0x2c7fe2;if(_0x50e17e[_0x4779('0xe')][_0x4779('0xf')]['id']){db[_0x4779('0x5')]['find']({'attributes':['id',_0x4779('0x7'),_0x4779('0x6')],'where':{'id':_0x50e17e['handshake']['query']['id']},'include':[{'model':db[_0x4779('0x10')],'as':_0x4779('0x11'),'attributes':['id'],'raw':!![]},{'model':db[_0x4779('0x12')],'as':_0x4779('0x13'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x4779('0x14')],'as':_0x4779('0x15'),'attributes':['id'],'raw':!![]},{'model':db[_0x4779('0x16')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]}]})[_0x4779('0x17')](function(_0x5d9a58){if(_0x5d9a58){_0x2c7fe2=_0x5d9a58;_0x50e17e[_0x5b1219](util[_0x4779('0xc')](_0x4779('0xd'),_0x5d9a58['name']));var _0x21f34d=[];switch(_0x5d9a58['role']){case _0x4779('0x18'):_0x50e17e[_0x5b1219](_0x4779('0x19'));_0x50e17e[_0x5b1219](_0x4779('0x1a'));if(queryQueues[_0x4779('0x1b')](_0x4779('0x1c'))){delete queryQueues[_0x4779('0x1c')];}_0x21f34d['push'](db[_0x4779('0x1d')]['findAll'](queryQueues));_0x21f34d['push'](db[_0x4779('0x1e')][_0x4779('0x1f')](queryQueues));_0x21f34d[_0x4779('0x20')](db[_0x4779('0x21')]['findAll'](queryQueues));_0x21f34d[_0x4779('0x20')](db[_0x4779('0x22')][_0x4779('0x1f')](queryQueues));_0x21f34d['push'](db[_0x4779('0x23')][_0x4779('0x1f')](queryQueues));_0x21f34d['push'](db[_0x4779('0x24')][_0x4779('0x1f')](queryQueues));_0x21f34d['push'](db[_0x4779('0x5')][_0x4779('0x1f')](queryTelephones));_0x21f34d[_0x4779('0x20')](db[_0x4779('0x25')][_0x4779('0x1f')](queryTrunks));_0x21f34d[_0x4779('0x20')](db[_0x4779('0x26')][_0x4779('0x1f')](queryCampaigns));_0x21f34d['push'](db[_0x4779('0x5')][_0x4779('0x1f')](queryAgents));break;case _0x4779('0x27'):_0x50e17e[_0x5b1219](_0x4779('0x19'));_0x50e17e[_0x5b1219](_0x4779('0x1a'));_0x21f34d[_0x4779('0x20')](_0x5d9a58[_0x4779('0x28')](queryQueues));_0x21f34d[_0x4779('0x20')](_0x5d9a58['getChatQueues'](queryQueues));_0x21f34d['push'](_0x5d9a58[_0x4779('0x29')](queryQueues));_0x21f34d[_0x4779('0x20')](_0x5d9a58[_0x4779('0x2a')](queryQueues));_0x21f34d[_0x4779('0x20')](_0x5d9a58[_0x4779('0x2b')](queryQueues));_0x21f34d['push'](_0x5d9a58[_0x4779('0x2c')](queryQueues));_0x21f34d[_0x4779('0x20')](db[_0x4779('0x5')][_0x4779('0x1f')](queryTelephones));_0x21f34d['push'](db['Trunk'][_0x4779('0x1f')](queryTrunks));_0x21f34d['push'](db[_0x4779('0x26')][_0x4779('0x1f')](queryCampaigns));_0x21f34d[_0x4779('0x20')](db[_0x4779('0x5')][_0x4779('0x1f')](queryAgents));break;case _0x4779('0x2d'):_0x50e17e[_0x5b1219](_0x4779('0x19'));_0x50e17e[_0x5b1219](_0x4779('0x1a'));_0x21f34d[_0x4779('0x20')](_0x5d9a58[_0x4779('0x28')]({'attributes':['id',_0x4779('0x7')]}));_0x21f34d[_0x4779('0x20')](_0x5d9a58['getChatQueues']({'attributes':['id','name']}));_0x21f34d[_0x4779('0x20')](_0x5d9a58['getFaxQueues']({'attributes':['id',_0x4779('0x7')]}));_0x21f34d['push'](_0x5d9a58[_0x4779('0x2a')]({'attributes':['id',_0x4779('0x7')]}));_0x21f34d[_0x4779('0x20')](_0x5d9a58[_0x4779('0x2b')]({'attributes':['id',_0x4779('0x7')]}));_0x21f34d['push'](_0x5d9a58['getOpenchannelQueues']({'attributes':['id',_0x4779('0x7')]}));break;}return BPromise[_0x4779('0x2e')](_0x21f34d);}})[_0x4779('0x17')](function(_0xced32a){if(_0xced32a&&_0xced32a[_0x4779('0xb')]){for(var _0x16a1fb=0x0;_0x16a1fb<_0xced32a[_0x4779('0xb')];_0x16a1fb+=0x1){for(var _0xe5da70=0x0;_0xe5da70<_0xced32a[_0x16a1fb][_0x4779('0xb')];_0xe5da70+=0x1){switch(_0x16a1fb){case 0x0:joinOrLeaveQueues(_0x50e17e,_0x5b1219,_0x4779('0x2f'),_0xced32a[_0x16a1fb][_0xe5da70]);break;case 0x1:joinOrLeaveQueues(_0x50e17e,_0x5b1219,_0x4779('0x30'),_0xced32a[_0x16a1fb][_0xe5da70]);break;case 0x2:joinOrLeaveQueues(_0x50e17e,_0x5b1219,_0x4779('0x31'),_0xced32a[_0x16a1fb][_0xe5da70]);break;case 0x3:joinOrLeaveQueues(_0x50e17e,_0x5b1219,_0x4779('0x32'),_0xced32a[_0x16a1fb][_0xe5da70]);break;case 0x4:joinOrLeaveQueues(_0x50e17e,_0x5b1219,_0x4779('0x33'),_0xced32a[_0x16a1fb][_0xe5da70]);break;case 0x5:joinOrLeaveQueues(_0x50e17e,_0x5b1219,_0x4779('0x34'),_0xced32a[_0x16a1fb][_0xe5da70]);break;case 0x6:_0x50e17e[_0x5b1219](util[_0x4779('0xc')](_0x4779('0x35'),_0xced32a[_0x16a1fb][_0xe5da70][_0x4779('0x7')]));break;case 0x7:_0x50e17e[_0x5b1219](util[_0x4779('0xc')]('trunk:%s',_0xced32a[_0x16a1fb][_0xe5da70][_0x4779('0x7')]));break;case 0x8:_0x50e17e[_0x5b1219](util['format'](_0x4779('0x36'),_0xced32a[_0x16a1fb][_0xe5da70][_0x4779('0x8')],_0xced32a[_0x16a1fb][_0xe5da70][_0x4779('0x7')]));break;case 0x9:_0x50e17e[_0x5b1219](util[_0x4779('0xc')](_0x4779('0xd'),_0xced32a[_0x16a1fb][_0xe5da70][_0x4779('0x7')]));break;}}}}})['then'](function(){if(_0x5b1219===_0x4779('0x37')){var _0x4819c6=_[_0x4779('0x38')](_0x2c7fe2[_0x4779('0x11')],'id');return _0x2c7fe2[_0x4779('0x39')](_0x4819c6)[_0x4779('0x17')](function(){for(var _0x2aeccc=0x0;_0x2aeccc<_0x4819c6[_0x4779('0xb')];_0x2aeccc+=0x1){_0x5616ba['emit'](_0x4779('0x3a'),{'ChatInteractionId':Number(_0x4819c6[_0x2aeccc]),'UserId':Number(_0x2c7fe2['id'])});}});}})['then'](function(){if(_0x5b1219===_0x4779('0x37')){var _0x3f1889=_[_0x4779('0x38')](_0x2c7fe2['MailInteractions'],'id');return _0x2c7fe2[_0x4779('0x3b')](_0x3f1889)[_0x4779('0x17')](function(){for(var _0x21b0fb=0x0;_0x21b0fb<_0x3f1889[_0x4779('0xb')];_0x21b0fb+=0x1){_0x5616ba[_0x4779('0x3c')](_0x4779('0x3d'),{'MailInteractionId':Number(_0x3f1889[_0x21b0fb]),'UserId':Number(_0x2c7fe2['id'])});}});}})[_0x4779('0x17')](function(){if(_0x5b1219===_0x4779('0x37')){var _0x31a0f6=_[_0x4779('0x38')](_0x2c7fe2[_0x4779('0x3e')],'id');return _0x2c7fe2[_0x4779('0x3f')](_0x31a0f6)[_0x4779('0x17')](function(){for(var _0xd94670=0x0;_0xd94670<_0x31a0f6[_0x4779('0xb')];_0xd94670+=0x1){_0x5616ba['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x31a0f6[_0xd94670]),'UserId':Number(_0x2c7fe2['id'])});}});}})[_0x4779('0x17')](function(){if(_0x5b1219===_0x4779('0x37')){var _0x661318=_[_0x4779('0x38')](_0x2c7fe2[_0x4779('0x15')],'id');return _0x2c7fe2[_0x4779('0x40')](_0x661318)[_0x4779('0x17')](function(){for(var _0x1bb047=0x0;_0x1bb047<_0x661318['length'];_0x1bb047+=0x1){_0x5616ba[_0x4779('0x3c')](_0x4779('0x41'),{'SmsInteractionId':Number(_0x661318[_0x1bb047]),'UserId':Number(_0x2c7fe2['id'])});}});}})[_0x4779('0x17')](function(){if(_0x5b1219===_0x4779('0x37')){var _0x18999e=_[_0x4779('0x38')](_0x2c7fe2['OpenchannelInteractions'],'id');return _0x2c7fe2[_0x4779('0x42')](_0x18999e)[_0x4779('0x17')](function(){for(var _0x1263db=0x0;_0x1263db<_0x18999e[_0x4779('0xb')];_0x1263db+=0x1){_0x5616ba[_0x4779('0x3c')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x18999e[_0x1263db]),'UserId':Number(_0x2c7fe2['id'])});}});}})[_0x4779('0x43')](function(_0x62d9c5){_0x50e17e[_0x4779('0x44')](_0x62d9c5);});}}function onDisconnect(_0x4a1040,_0x43e044){joinOrLeave(_0x4a1040,'leave',_0x43e044);}function onConnect(_0x231be3){joinOrLeave(_0x231be3,_0x4779('0x45'));}exports[_0x4779('0x46')]=function(_0x4f0aaf){_0x4f0aaf['on'](_0x4779('0x47'),function(_0x59e457){_0x59e457[_0x4779('0x48')](0x0);_0x59e457[_0x4779('0x49')]=_0x59e457[_0x4779('0x4a')]['connection']['remoteAddress']+':'+_0x59e457['request'][_0x4779('0x47')][_0x4779('0x4b')];_0x59e457['connectedAt']=new Date();_0x59e457[_0x4779('0x44')]=function(_0x18a485){console[_0x4779('0x44')](_0x4779('0x4c')+_0x59e457[_0x4779('0x4d')]['name']+'['+_0x59e457[_0x4779('0x49')]+']',_0x18a485);};_0x59e457['on'](_0x4779('0x4e'),function(){onDisconnect(_0x59e457,_0x4f0aaf);_0x59e457[_0x4779('0x44')](_0x4779('0x4f'));});onConnect(_0x59e457);_0x59e457[_0x4779('0x44')](_0x4779('0x50'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index f137592..c3dd5f7 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 _0x3fa5=['ChatInteraction','afterCreate','afterUpdate','closedinteraction','newmessage','Sms','SmsInteraction','newinteraction','SmsMessage','Fax','FaxInteraction','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','event','direction','UserId','User','find','name','interface','format','SIP/%s','incomingmessage','outgoingmessage','opened','closed','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','../logger','triggers','client','http','Chat'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3fa5,0x10c));var _0x53fa=function(_0x5c8775,_0x3272aa){_0x5c8775=_0x5c8775-0x0;var _0x222af1=_0x3fa5[_0x5c8775];return _0x222af1;};'use strict';var util=require(_0x53fa('0x0'));var db=require(_0x53fa('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0x53fa('0x2'))(_0x53fa('0x3'));var client=jayson[_0x53fa('0x4')][_0x53fa('0x5')]({'port':0x232a});var triggers=[{'channel':_0x53fa('0x6'),'model':_0x53fa('0x7'),'event':_0x53fa('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x53fa('0x6'),'model':_0x53fa('0x7'),'event':_0x53fa('0x9'),'condition':_0x53fa('0xa'),'callback':afterUpdate},{'channel':_0x53fa('0x6'),'model':'ChatMessage','event':_0x53fa('0x8'),'condition':_0x53fa('0xb'),'callback':afterCreateMessage},{'channel':_0x53fa('0xc'),'model':_0x53fa('0xd'),'event':_0x53fa('0x8'),'condition':_0x53fa('0xe'),'callback':afterCreate},{'channel':_0x53fa('0xc'),'model':'SmsInteraction','event':_0x53fa('0x9'),'condition':_0x53fa('0xa'),'callback':afterUpdate},{'channel':_0x53fa('0xc'),'model':_0x53fa('0xf'),'event':_0x53fa('0x8'),'condition':_0x53fa('0xb'),'callback':afterCreateMessage},{'channel':_0x53fa('0x10'),'model':_0x53fa('0x11'),'event':_0x53fa('0x8'),'condition':_0x53fa('0xe'),'callback':afterCreate},{'channel':_0x53fa('0x10'),'model':_0x53fa('0x11'),'event':_0x53fa('0x9'),'condition':_0x53fa('0xa'),'callback':afterUpdate},{'channel':_0x53fa('0x10'),'model':'FaxMessage','event':_0x53fa('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x53fa('0x12'),'model':_0x53fa('0x13'),'event':'afterCreate','condition':_0x53fa('0xe'),'callback':afterCreate},{'channel':'Mail','model':_0x53fa('0x13'),'event':_0x53fa('0x9'),'condition':_0x53fa('0xa'),'callback':afterUpdate},{'channel':_0x53fa('0x12'),'model':_0x53fa('0x14'),'event':_0x53fa('0x8'),'condition':_0x53fa('0xb'),'callback':afterCreateMessage},{'channel':_0x53fa('0x15'),'model':_0x53fa('0x16'),'event':'afterCreate','condition':_0x53fa('0xe'),'callback':afterCreate},{'channel':'Openchannel','model':_0x53fa('0x16'),'event':_0x53fa('0x9'),'condition':_0x53fa('0xa'),'callback':afterUpdate},{'channel':_0x53fa('0x15'),'model':_0x53fa('0x17'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage}];function request(_0xef9563){return client[_0x53fa('0x18')](_0x53fa('0x19'),_0xef9563)[_0x53fa('0x1a')](function(_0x4462dc){logger[_0x53fa('0x1b')](_0x53fa('0x1c'),_0x53fa('0x19'),_0x4462dc);if(_0x4462dc[_0x53fa('0x1d')]){if(_0x4462dc[_0x53fa('0x1d')][_0x53fa('0x1e')]===0x1f4){logger[_0x53fa('0x1d')](_0x53fa('0x1c'),_0x53fa('0x19'),_0x4462dc['error']);}}})[_0x53fa('0x1f')](function(_0x13b37a){logger['error'](_0x53fa('0x1c'),'EventManager',_0x13b37a);});}function afterCreateMessage(_0x159706,_0x39b474){return function(_0x52322e,_0x34208c){_0x52322e=_0x52322e[_0x53fa('0x20')]({'plain':!![]});_0x52322e[_0x53fa('0x21')]=_0x159706;_0x52322e[_0x53fa('0x22')]=_0x52322e[_0x53fa('0x23')];if(_0x52322e[_0x53fa('0x24')]){return db[_0x53fa('0x25')][_0x53fa('0x26')]({'where':{'id':_0x52322e['UserId']},'attributes':['id',_0x53fa('0x27')],'raw':!![]})[_0x53fa('0x1a')](function(_0x166a2b){_0x52322e[_0x53fa('0x28')]=util[_0x53fa('0x29')](_0x53fa('0x2a'),_0x166a2b[_0x53fa('0x27')]);_0x52322e[_0x53fa('0x21')]=_0x159706;return request({'event':_0x53fa('0x2b'),'message':_0x52322e});})['catch'](function(_0x5dcc56){console[_0x53fa('0x1d')](_0x5dcc56);});}else{return request({'event':_0x53fa('0x2c'),'message':_0x52322e});}};}function afterCreate(_0x4a4243,_0x449f3a){return function(_0x1f49b1,_0x39eaaf){_0x1f49b1=_0x1f49b1[_0x53fa('0x20')]({'plain':!![]});_0x1f49b1[_0x53fa('0x21')]=_0x4a4243;_0x1f49b1[_0x53fa('0x22')]=_0x53fa('0x2d');return request({'event':_0x449f3a,'message':_0x1f49b1});};}function afterUpdate(_0x570a8b,_0x409bea){return function(_0x6e8c74,_0x2bc619){if(_0x6e8c74['changed'](_0x53fa('0x2e'))&&_0x6e8c74[_0x53fa('0x2e')]){_0x6e8c74=_0x6e8c74[_0x53fa('0x20')]({'plain':!![]});_0x6e8c74[_0x53fa('0x21')]=_0x570a8b;_0x6e8c74[_0x53fa('0x22')]=_0x53fa('0x2e');if(_0x6e8c74['UserId']){return db[_0x53fa('0x25')][_0x53fa('0x26')]({'where':{'id':_0x6e8c74[_0x53fa('0x24')]},'attributes':['id',_0x53fa('0x27')],'raw':!![]})[_0x53fa('0x1a')](function(_0x52260e){_0x6e8c74[_0x53fa('0x28')]=util[_0x53fa('0x29')]('SIP/%s',_0x52260e[_0x53fa('0x27')]);return request({'event':_0x409bea,'message':_0x6e8c74});})[_0x53fa('0x1f')](function(_0x1b2feb){console[_0x53fa('0x1d')](_0x1b2feb);});}else{return request({'event':_0x409bea,'message':_0x6e8c74});}}};}exports[_0x53fa('0x2f')]=function(){for(var _0x46a0b6=0x0;_0x46a0b60x3){var _0x5ee77e=/\((.+)\)/;var _0x1251d5=_0x5e6de7['rx'][_0x0676('0x17')](_0x5ee77e);if(_0x1251d5){_0x59bcd1=_0x1251d5[0x1];}else{_0x59bcd1=null;}}else{_0x59bcd1=null;}_0x5e6de7['cb'](null,{'code':_0x3ec5e8,'result':_0x2fcc3f,'extra':_0x59bcd1});}});_0x5468d9['on'](_0x0676('0x18'),function(_0x23040d){_0x28d6c0[_0x0676('0xa')](_0x0676('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x23040d[_0x0676('0x19')]));});_0x5468d9['on'](_0x0676('0x1a'),function(){_0x28d6c0[_0x0676('0xa')](_0x0676('0x1a'),new AGIError(_0x0676('0x1b')));});_0x5468d9['on'](_0x0676('0x1c'),function(){_0x28d6c0[_0x0676('0xa')]('timeout',new AGIError(_0x0676('0x1d')));_0x5468d9[_0x0676('0x1e')]();});_0x5468d9[_0x0676('0x1f')](_0x4c9ddb);this[_0x0676('0x20')]=function(_0x199b5b,_0x39018e){var _0x199b5b=_0x199b5b||'',_0x39018e=typeof _0x39018e==_0x0676('0x11')?_0x39018e:new Function();_0x5e6de7={'tx':_0x199b5b,'rx':'','cb':_0x39018e};_0x5468d9[_0x0676('0x21')](_0x199b5b+'\x0a');},this['close']=function(){_0x5468d9[_0x0676('0x1e')]();};}util[_0x0676('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x0676('0x23')][_0x0676('0x24')]=function(_0x4def7d){return this[_0x0676('0x20')]['sync'](this,_0x4def7d);};AGIChannel[_0x0676('0x23')]['answer']=function(){return this[_0x0676('0x24')](_0x0676('0x25'));};AGIChannel[_0x0676('0x23')][_0x0676('0x26')]=function(_0x433cdc,_0x5cdb7b,_0x58b0df){_0x433cdc=_0x433cdc===undefined?'beep':_0x433cdc;_0x5cdb7b=_0x5cdb7b===undefined?'5':_0x5cdb7b;_0x58b0df=_0x58b0df===undefined?'1':_0x58b0df;return this[_0x0676('0x24')](util[_0x0676('0x27')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x433cdc,_0x5cdb7b*0x3e8,_0x58b0df));};AGIChannel[_0x0676('0x23')]['noop']=function(_0x5b121a){_0x5b121a=_0x5b121a||_0x0676('0x28');return this[_0x0676('0x24')](util[_0x0676('0x27')](_0x0676('0x29'),_0x5b121a));};AGIChannel['prototype'][_0x0676('0x2a')]=function(_0x3e6c27,_0x1e805a){if(_[_0x0676('0x2b')](_0x1e805a)){return this[_0x0676('0x24')](util['format'](_0x0676('0x2c'),_0x3e6c27,_0x1e805a[_0x0676('0x2d')](',')));}return this[_0x0676('0x24')](util['format'](_0x0676('0x2c'),_0x3e6c27,_0x1e805a));};AGIChannel[_0x0676('0x23')][_0x0676('0x2e')]=function(_0x44d815){return this[_0x0676('0x24')](util['format'](_0x0676('0x2f'),_0x44d815));};AGIChannel['prototype']['setExtension']=function(_0x2dd078){return this['sendRequest'](util[_0x0676('0x27')](_0x0676('0x30'),_0x2dd078));};AGIChannel[_0x0676('0x23')][_0x0676('0x31')]=function(_0x507805){return this[_0x0676('0x24')](util[_0x0676('0x27')]('SET\x20PRIORITY\x20%s',_0x507805));};AGIChannel[_0x0676('0x23')][_0x0676('0xd')]=function(){return this[_0x0676('0x24')](_0x0676('0x32'));};AGIChannel[_0x0676('0x23')]['setVariable']=function(_0x170976,_0x11c9b5){return this['sendRequest'](util[_0x0676('0x27')](_0x0676('0x33'),_0x170976,_0x11c9b5?_0x11c9b5[_0x0676('0x34')]()[_0x0676('0x35')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x0676('0x23')]['sayNumber']=function(_0x962339,_0x1c1fc8){return this[_0x0676('0x24')](util[_0x0676('0x27')](_0x0676('0x36'),_0x962339,_0x1c1fc8));};AGIChannel[_0x0676('0x23')][_0x0676('0x37')]=function(_0x126b92,_0x170811){return this[_0x0676('0x24')](util[_0x0676('0x27')]('SAY\x20DIGITS\x20%s\x20%s',_0x126b92,_0x170811));};AGIChannel[_0x0676('0x23')][_0x0676('0x38')]=function(_0x5f3ae0,_0x568977){return this[_0x0676('0x24')](util['format'](_0x0676('0x39'),_0x5f3ae0,_0x568977));};AGIChannel[_0x0676('0x23')][_0x0676('0x3a')]=function(_0x1e1a7f,_0x42bab2,_0x11b7ce){_0x42bab2=_0x42bab2||this[_0x0676('0x3b')];_0x11b7ce=_0x11b7ce||0x1;this[_0x0676('0x2e')](_0x1e1a7f);this['setExtension'](_0x42bab2);this['setPriority'](_0x11b7ce);return this[_0x0676('0x3c')](util[_0x0676('0x27')](_0x0676('0x3d'),_0x1e1a7f,_0x42bab2,_0x11b7ce));};AGIChannel[_0x0676('0x23')][_0x0676('0x3e')]=function(_0x394b58){return this[_0x0676('0x24')](util[_0x0676('0x27')](_0x0676('0x3f'),_0x394b58));};AGIChannel[_0x0676('0x23')][_0x0676('0x40')]=function(_0x434374,_0x22c76f,_0x2b3eab,_0xb651fa,_0x9aac70,_0x183558){_0x22c76f=_0x22c76f||_0x0676('0x41');_0x2b3eab=_0x2b3eab||'';_0xb651fa=_0xb651fa===undefined?-0x1:_0xb651fa==='-1'?-0x1:_0xb651fa*0x3e8;_0x9aac70=_0x9aac70===undefined?'':'s='+_0x9aac70;_0x183558=_0x183558?_0x0676('0x42'):'';return this[_0x0676('0x24')](util[_0x0676('0x27')](_0x0676('0x43'),_0x434374,_0x22c76f,_0x2b3eab,_0xb651fa,_0x183558,_0x9aac70));};AGIChannel[_0x0676('0x23')][_0x0676('0x44')]=function(_0x5bc46c,_0x6cd3ad){_0x6cd3ad=_0x6cd3ad||'';return this['sendRequest'](util[_0x0676('0x27')](_0x0676('0x45'),_0x5bc46c,_0x6cd3ad));};AGIChannel[_0x0676('0x23')][_0x0676('0x46')]=function(_0xf31d2f){return this[_0x0676('0x2a')](_0x0676('0x47'),_0xf31d2f);};AGIChannel[_0x0676('0x23')][_0x0676('0x48')]=function(_0x28b9e5){return this[_0x0676('0x2a')](_0x0676('0x49'),_0x28b9e5);};AGIChannel[_0x0676('0x23')][_0x0676('0x18')]=function(_0x461fb1,_0x4ea04d){this[_0x0676('0x3c')](util[_0x0676('0x27')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x461fb1['id'],_0x461fb1[_0x0676('0x4a')],_0x4ea04d));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x6569=['no\x20code','result=','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','close','prototype','sendRequest','sync','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','setContext','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','toString','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','./reply','setEncoding','utf8','setTimeout','emit','line','hangup','search','520\x20End\x20of\x20proper','function','substring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6569,0xca));var _0x9656=function(_0x36f0df,_0x47a813){_0x36f0df=_0x36f0df-0x0;var _0xc9c496=_0x6569[_0x36f0df];return _0xc9c496;};'use strict';var util=require(_0x9656('0x0'));var _=require(_0x9656('0x1'));var EventEmitter=require(_0x9656('0x2'))['EventEmitter'];var AGIReply=require(_0x9656('0x3'));var AGIError=require('./error');function AGIChannel(_0x9de068){var _0x404d15=this,_0x432921=new AGIReply(),_0x59c84f=![],_0x3136a3={};EventEmitter['call'](_0x404d15);_0x9de068[_0x9656('0x4')](_0x9656('0x5'));_0x9de068[_0x9656('0x6')](0x8*0x3c*0x3c*0x3e8);_0x432921[_0x9656('0x4')](_0x9656('0x5'));_0x432921['on']('headers',function(_0x561881){for(var _0x3c6afa in _0x561881){_0x404d15[_0x3c6afa]=_0x561881[_0x3c6afa];}_0x404d15[_0x9656('0x7')]('ready');});_0x432921['on'](_0x9656('0x8'),function(_0x42dcc5){if(_0x42dcc5['toLowerCase']()==_0x9656('0x9')){_0x404d15[_0x9656('0x7')](_0x9656('0x9'));return;}if(_0x42dcc5['substring'](0x0,0xb)=='520-Invalid'){_0x59c84f=!![];}if(_0x59c84f){_0x3136a3['rx']+=_0x42dcc5+'\x0a';if(_0x42dcc5[_0x9656('0xa')](_0x9656('0xb'))!=-0x1){_0x59c84f=![];}}else{_0x3136a3['rx']=_0x42dcc5;}if(_0x59c84f){return;}if(typeof _0x3136a3['cb']==_0x9656('0xc')){var _0x3bd22f=_0x3136a3['rx'][_0x9656('0xd')](0x0,0x3),_0x3956df=null,_0x3b80d4=null;_0x3bd22f=parseInt(_0x3bd22f);if(isNaN(_0x3bd22f)){_0x3136a3['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x9656('0xe')});return;}if(_0x3bd22f!=0xc8){_0x3136a3['cb'](null,{'code':_0x3bd22f,'result':-0x1,'extra':'KO'});return;}_0x3956df=_0x3136a3['rx'][_0x9656('0xd')](0x4)['replace'](_0x9656('0xf'),'');if(_0x3956df[_0x9656('0x10')]('\x20')!=-0x1){_0x3956df=_0x3956df['substr'](0x0,_0x3956df[_0x9656('0x10')]('\x20'));}if(_[_0x9656('0x11')](_0x3956df,'-1')){_0x3956df=parseInt(_0x3956df);}_0x3b80d4=_0x3136a3['rx'][_0x9656('0x12')]('\x20');if(_0x3b80d4[_0x9656('0x13')]==0x3){_0x3b80d4=_0x3b80d4[0x2][_0x9656('0xd')](0x1,_0x3b80d4[0x2][_0x9656('0x13')]-0x1);}else if(_0x3b80d4[_0x9656('0x13')]>0x3){var _0x1bad86=/\((.+)\)/;var _0x5577cb=_0x3136a3['rx'][_0x9656('0x14')](_0x1bad86);if(_0x5577cb){_0x3b80d4=_0x5577cb[0x1];}else{_0x3b80d4=null;}}else{_0x3b80d4=null;}_0x3136a3['cb'](null,{'code':_0x3bd22f,'result':_0x3956df,'extra':_0x3b80d4});}});_0x9de068['on'](_0x9656('0x15'),function(_0x454a94){_0x404d15[_0x9656('0x7')](_0x9656('0x15'),new AGIError(_0x9656('0x16'),_0x454a94['code']));});_0x9de068['on']('close',function(){_0x404d15[_0x9656('0x7')]('close',new AGIError(_0x9656('0x17')));});_0x9de068['on'](_0x9656('0x18'),function(){_0x404d15[_0x9656('0x7')](_0x9656('0x18'),new AGIError(_0x9656('0x19')));_0x9de068[_0x9656('0x1a')]();});_0x9de068[_0x9656('0x1b')](_0x432921);this[_0x9656('0x1c')]=function(_0x4cfb81,_0x4b878d){var _0x4cfb81=_0x4cfb81||'',_0x4b878d=typeof _0x4b878d=='function'?_0x4b878d:new Function();_0x3136a3={'tx':_0x4cfb81,'rx':'','cb':_0x4b878d};_0x9de068['write'](_0x4cfb81+'\x0a');},this[_0x9656('0x1d')]=function(){_0x9de068[_0x9656('0x1a')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x9656('0x1e')][_0x9656('0x1f')]=function(_0x5b46ab){return this[_0x9656('0x1c')][_0x9656('0x20')](this,_0x5b46ab);};AGIChannel[_0x9656('0x1e')]['answer']=function(){return this[_0x9656('0x1f')](_0x9656('0x21'));};AGIChannel[_0x9656('0x1e')][_0x9656('0x22')]=function(_0x6f6a80,_0x29b0a0,_0xf83606){_0x6f6a80=_0x6f6a80===undefined?_0x9656('0x23'):_0x6f6a80;_0x29b0a0=_0x29b0a0===undefined?'5':_0x29b0a0;_0xf83606=_0xf83606===undefined?'1':_0xf83606;return this['sendRequest'](util[_0x9656('0x24')](_0x9656('0x25'),_0x6f6a80,_0x29b0a0*0x3e8,_0xf83606));};AGIChannel[_0x9656('0x1e')][_0x9656('0x26')]=function(_0x112441){_0x112441=_0x112441||_0x9656('0x27');return this['sendRequest'](util[_0x9656('0x24')](_0x9656('0x28'),_0x112441));};AGIChannel['prototype'][_0x9656('0x29')]=function(_0x2afafb,_0x1ee482){if(_['isArray'](_0x1ee482)){return this[_0x9656('0x1f')](util[_0x9656('0x24')](_0x9656('0x2a'),_0x2afafb,_0x1ee482['join'](',')));}return this[_0x9656('0x1f')](util['format']('EXEC\x20%s\x20%s',_0x2afafb,_0x1ee482));};AGIChannel[_0x9656('0x1e')][_0x9656('0x2b')]=function(_0x16fe2a){return this[_0x9656('0x1f')](util['format']('SET\x20CONTEXT\x20%s',_0x16fe2a));};AGIChannel[_0x9656('0x1e')][_0x9656('0x2c')]=function(_0x4ad862){return this[_0x9656('0x1f')](util[_0x9656('0x24')]('SET\x20EXTENSION\x20%s',_0x4ad862));};AGIChannel[_0x9656('0x1e')][_0x9656('0x2d')]=function(_0x4d9295){return this[_0x9656('0x1f')](util[_0x9656('0x24')](_0x9656('0x2e'),_0x4d9295));};AGIChannel[_0x9656('0x1e')][_0x9656('0x9')]=function(){return this[_0x9656('0x1f')](_0x9656('0x2f'));};AGIChannel[_0x9656('0x1e')][_0x9656('0x30')]=function(_0x58822e,_0x328f47){return this[_0x9656('0x1f')](util[_0x9656('0x24')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x58822e,_0x328f47?_0x328f47[_0x9656('0x31')]()[_0x9656('0x32')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x9656('0x1e')][_0x9656('0x33')]=function(_0x594592,_0x2c724e){return this[_0x9656('0x1f')](util['format'](_0x9656('0x34'),_0x594592,_0x2c724e));};AGIChannel[_0x9656('0x1e')][_0x9656('0x35')]=function(_0x2cf941,_0x2c5e9c){return this[_0x9656('0x1f')](util[_0x9656('0x24')](_0x9656('0x36'),_0x2cf941,_0x2c5e9c));};AGIChannel[_0x9656('0x1e')][_0x9656('0x37')]=function(_0x475947,_0x54734a){return this[_0x9656('0x1f')](util[_0x9656('0x24')](_0x9656('0x38'),_0x475947,_0x54734a));};AGIChannel['prototype'][_0x9656('0x39')]=function(_0x54beac,_0x148dd2,_0x1c49fd){_0x148dd2=_0x148dd2||this[_0x9656('0x3a')];_0x1c49fd=_0x1c49fd||0x1;this[_0x9656('0x2b')](_0x54beac);this[_0x9656('0x2c')](_0x148dd2);this[_0x9656('0x2d')](_0x1c49fd);return this[_0x9656('0x26')](util['format'](_0x9656('0x3b'),_0x54beac,_0x148dd2,_0x1c49fd));};AGIChannel[_0x9656('0x1e')][_0x9656('0x3c')]=function(_0xcbdb2b){return this[_0x9656('0x1f')](util[_0x9656('0x24')](_0x9656('0x3d'),_0xcbdb2b));};AGIChannel[_0x9656('0x1e')]['recordFile']=function(_0x3dc199,_0x4d7ef8,_0x972a85,_0x168720,_0x1c01a6,_0x5b6976){_0x4d7ef8=_0x4d7ef8||'wav';_0x972a85=_0x972a85||'';_0x168720=_0x168720===undefined?-0x1:_0x168720==='-1'?-0x1:_0x168720*0x3e8;_0x1c01a6=_0x1c01a6===undefined?'':'s='+_0x1c01a6;_0x5b6976=_0x5b6976?_0x9656('0x3e'):'';return this[_0x9656('0x1f')](util[_0x9656('0x24')](_0x9656('0x3f'),_0x3dc199,_0x4d7ef8,_0x972a85,_0x168720,_0x5b6976,_0x1c01a6));};AGIChannel[_0x9656('0x1e')][_0x9656('0x40')]=function(_0x15093c,_0x5c32ee){_0x5c32ee=_0x5c32ee||'';return this[_0x9656('0x1f')](util[_0x9656('0x24')](_0x9656('0x41'),_0x15093c,_0x5c32ee));};AGIChannel[_0x9656('0x1e')][_0x9656('0x42')]=function(_0x495422){return this[_0x9656('0x29')](_0x9656('0x43'),_0x495422);};AGIChannel[_0x9656('0x1e')]['wait']=function(_0x4baee4){return this[_0x9656('0x29')](_0x9656('0x44'),_0x4baee4);};AGIChannel[_0x9656('0x1e')][_0x9656('0x15')]=function(_0x3b4562,_0x27f06c){this[_0x9656('0x26')](util['format'](_0x9656('0x45'),_0x3b4562['id'],_0x3b4562[_0x9656('0x46')],_0x27f06c));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x9656('0x47')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 6a641f1..d4b8ebc 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 _0x87fc=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','exports','util','Server\x20error.\x20Code:\x20%s.','Server\x20closed.'];(function(_0x2cb249,_0x2959af){var _0x1c02db=function(_0x32ff10){while(--_0x32ff10){_0x2cb249['push'](_0x2cb249['shift']());}};_0x1c02db(++_0x2959af);}(_0x87fc,0x1ce));var _0xc87f=function(_0x37503a,_0x5b29b4){_0x37503a=_0x37503a-0x0;var _0x6a9c75=_0x87fc[_0x37503a];return _0x6a9c75;};'use strict';var util=require(_0xc87f('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xc87f('0x1'),'E_AGI_SERVER_CLOSE':_0xc87f('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0xc87f('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xc87f('0x4'),'E_AGI_SOCKET_CLOSE':_0xc87f('0x5'),'E_AGI_SOCKET_TIMEOUT':_0xc87f('0x6'),'E_AGI_COMMAND_EMPTY':_0xc87f('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xc87f('0x8'),'E_AGI_IVR_ENTRY':_0xc87f('0x9')};function AGIError(_0x441ce9){var _0x441ce9=_0x441ce9||null,_0x2e96bc=_0x2e96bc||[],_0xb9b68e=0x1,_0x2ff795='';if(!error[_0x441ce9]){_0x441ce9='E_AGI_UNDEFINED';}_0x2e96bc['push'](error[_0x441ce9]);while(arguments[_0xb9b68e]){_0x2e96bc[_0xc87f('0xa')](arguments[_0xb9b68e]);_0xb9b68e++;}_0x2ff795=util[_0xc87f('0xb')][_0xc87f('0xc')](util,_0x2e96bc);this[_0xc87f('0xd')]=_0x2ff795;this['name']=_0x441ce9;}module[_0xc87f('0xe')]=AGIError; \ No newline at end of file +var _0x0ab1=['Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x0ab1,0x19a));var _0x10ab=function(_0x499371,_0x410ed8){_0x499371=_0x499371-0x0;var _0x203b90=_0x0ab1[_0x499371];return _0x203b90;};'use strict';var util=require(_0x10ab('0x0'));var error={'E_AGI_UNDEFINED':_0x10ab('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x10ab('0x2'),'E_AGI_SERVER_CLOSE':_0x10ab('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x10ab('0x4'),'E_AGI_SOCKET_ERROR':_0x10ab('0x5'),'E_AGI_SOCKET_CLOSE':_0x10ab('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x10ab('0x7'),'E_AGI_COMMAND_EMPTY':_0x10ab('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x10ab('0x9'),'E_AGI_IVR_ENTRY':_0x10ab('0xa')};function AGIError(_0x2f53e6){var _0x2f53e6=_0x2f53e6||null,_0x227084=_0x227084||[],_0x5d887e=0x1,_0x103cd1='';if(!error[_0x2f53e6]){_0x2f53e6=_0x10ab('0xb');}_0x227084['push'](error[_0x2f53e6]);while(arguments[_0x5d887e]){_0x227084[_0x10ab('0xc')](arguments[_0x5d887e]);_0x5d887e++;}_0x103cd1=util[_0x10ab('0xd')]['apply'](util,_0x227084);this[_0x10ab('0xe')]=_0x103cd1;this['name']=_0x2f53e6;}module[_0x10ab('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index ecd7b45..f9eaf5f 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 _0x3266=['length','condition','split','agicommand','vswitch','target','default','invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','addVertex','prototype','push','size','relations','getVertex','no\x20vertex\x20found','info','stop\x20traverse'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0x3266,0x6a));var _0x6326=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x3266[_0x1762b4];return _0x29beda;};'use strict';var _=require(_0x6326('0x0'));var logger=require(_0x6326('0x1'))(_0x6326('0x2'));var verticesWithRetry=[_0x6326('0x3'),_0x6326('0x4'),_0x6326('0x5')];var Graph=function(){this[_0x6326('0x6')]={};this[_0x6326('0x7')]={};this[_0x6326('0x8')]=0x0;};Graph['prototype'][_0x6326('0x9')]=function(_0x5f38a3){this[_0x6326('0x6')][_0x5f38a3['id']]=_0x5f38a3;this[_0x6326('0x7')][_0x5f38a3['id']]=[];};Graph[_0x6326('0xa')]['addEdge']=function(_0x161f4e,_0x5730e7,_0x2af571){this[_0x6326('0x7')][_0x161f4e][_0x6326('0xb')]({'target':_0x5730e7,'condition':_0x2af571});this[_0x6326('0x8')]+=0x1;};Graph[_0x6326('0xa')]['size']=function(){return _[_0x6326('0xc')](this[_0x6326('0x6')]);};Graph[_0x6326('0xa')][_0x6326('0xd')]=function(){return this[_0x6326('0x8')];};Graph[_0x6326('0xa')][_0x6326('0xe')]=function(_0x77c4e){return this[_0x6326('0x6')][_0x77c4e];};Graph[_0x6326('0xa')]['traverseBFS']=function(_0x5381d0,_0x301f34){if(!this[_0x6326('0x6')][_0x5381d0]){return logger['info'](_0x6326('0xf'));}var _0x4caef3=_0x301f34(this[_0x6326('0x6')][_0x5381d0]);if(!_0x4caef3){return logger[_0x6326('0x10')](_0x6326('0x11'));}if(this[_0x6326('0x7')][_0x5381d0][_0x6326('0x12')]===0x0){return logger[_0x6326('0x10')]('no\x20edge/s\x20available');}for(var _0x1104c5=0x0,_0x518e6f=[],_0x5945ee=![];_0x1104c5\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','vertex','[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','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','catch','[LICENSE]','./server','0.0.0.0','connection','xml2json','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','error','stack','log','info','[LISTENING]\x20Cally\x20Square\x20listening\x200.0.0.0:4573','name','message','format','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','length','source','target','getSquareProject','then','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','evtHangup','sync'];(function(_0xe0c564,_0x2ff569){var _0x32e0f6=function(_0x3fd0fc){while(--_0x3fd0fc){_0xe0c564['push'](_0xe0c564['shift']());}};_0x32e0f6(++_0x2ff569);}(_0xa4de,0x17d));var _0xea4d=function(_0x33f69e,_0x4112ec){_0x33f69e=_0x33f69e-0x0;var _0x5f0972=_0xa4de[_0x33f69e];return _0x5f0972;};'use strict';var parser=require(_0xea4d('0x0'));var _=require('lodash');var syncho=require(_0xea4d('0x1'));var util=require(_0xea4d('0x2'));var moment=require(_0xea4d('0x3'));var config=require(_0xea4d('0x4'));var logger=require(_0xea4d('0x5'))(_0xea4d('0x6'));var utilLicense=require(_0xea4d('0x7'));var rpc=require(_0xea4d('0x8'));var mailRpc=require(_0xea4d('0x9'));var Graph=require(_0xea4d('0xa'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function connectionHandler(_0x244120){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x244120);agiHandler(_0x244120);}catch(_0x13ce8c){logger[_0xea4d('0xb')](_0x13ce8c[_0xea4d('0xc')]);}});});}function listeningHandler(_0x5b13c6){console[_0xea4d('0xd')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',0x11dd);logger[_0xea4d('0xe')](_0xea4d('0xf'));}function errorHandler(_0x5680de){if(_0x5680de&&_0x5680de[_0xea4d('0x10')]&&_0x5680de[_0xea4d('0x11')]){logger[_0xea4d('0xb')](util[_0xea4d('0x12')]('[%s]\x20%s',_0x5680de[_0xea4d('0x10')],_0x5680de[_0xea4d('0x11')]));}else{logger['error'](util[_0xea4d('0x12')](_0xea4d('0x13'),_0x5680de[_0xea4d('0xc')]));}}function closeHandler(){logger['info'](util[_0xea4d('0x12')](_0xea4d('0x14'),this[_0xea4d('0x15')],this[_0xea4d('0x16')],this[_0xea4d('0x17')],this['dnid'],this[_0xea4d('0x18')]));try{createSquareReport(this);}catch(_0x53179e){logger[_0xea4d('0xb')](_0x53179e[_0xea4d('0xc')]);}}function timeoutHandler(){logger[_0xea4d('0xe')](util[_0xea4d('0x12')](_0xea4d('0x19'),this['arg_1'],this[_0xea4d('0x16')],this[_0xea4d('0x17')],this[_0xea4d('0x1a')],this[_0xea4d('0x18')]));}function hangupHandler(){logger[_0xea4d('0xe')](util['format'](_0xea4d('0x1b'),this[_0xea4d('0x15')],this[_0xea4d('0x16')],this[_0xea4d('0x17')],this['dnid'],this[_0xea4d('0x18')]));this['evtHangup']=!![];}function getRoot(_0x31ea06){return parser[_0xea4d('0x1c')](_0x31ea06,{'object':!![]})['mxGraphModel'][_0xea4d('0x1d')];}function addVertex(_0x259cd2,_0x49c878,_0x1d9423){_0x49c878[_0xea4d('0x1e')]=_0x1d9423;if(_0x49c878[_0xea4d('0x1f')](_0xea4d('0x20'))){_0x49c878[_0xea4d('0x21')]=parseInt(_0x49c878[_0xea4d('0x20')],0xa);}_0x259cd2[_0xea4d('0x22')](_[_0xea4d('0x23')](_0x49c878,'mxCell'));}function initGraph(_0x53c2e3,_0x4f5a22){var _0x5ba165=new Graph();for(var _0x383198 in _0x53c2e3){if(_0x53c2e3['hasOwnProperty'](_0x383198)){if(_['isArray'](_0x53c2e3[_0x383198])){for(var _0x4de874=0x0;_0x4de874<_0x53c2e3[_0x383198][_0xea4d('0x24')];_0x4de874+=0x1){addVertex(_0x5ba165,_0x53c2e3[_0x383198][_0x4de874],_0x383198);}}else{addVertex(_0x5ba165,_0x53c2e3[_0x383198],_0x383198);}}}for(var _0x2367be=0x0;_0x2367be<_0x4f5a22[_0xea4d('0x24')];_0x2367be+=0x1){if(_0x4f5a22[_0x2367be][_0xea4d('0x25')]&&_0x4f5a22[_0x2367be][_0xea4d('0x26')]){_0x5ba165['addEdge'](_0x4f5a22[_0x2367be][_0xea4d('0x25')],_0x4f5a22[_0x2367be]['target'],_0x4f5a22[_0x2367be]['value']);}}return _0x5ba165;}function getSquareProject(_0x493caf,_0x2d4bd6){rpc[_0xea4d('0x27')](_0x493caf)[_0xea4d('0x28')](function(_0x311008){_0x2d4bd6(null,_0x311008);})['catch'](function(_0x31f1f0){_0x2d4bd6(null,_0x31f1f0);});}function createSquareReport(_0x26cf04,_0x37c01f){rpc[_0xea4d('0x29')](_0x26cf04)[_0xea4d('0x28')](function(_0x3f9eb2){if(_0x37c01f){_0x37c01f(null,_0x3f9eb2);}})['catch'](function(_0x57ac9b){if(_0x37c01f){_0x37c01f(null,_0x57ac9b);}});}function setChannelVariables(_0x41ab04){for(var _0x3fd9da in _0x41ab04){if(_0x41ab04['hasOwnProperty'](_0x3fd9da)){if(_0x3fd9da[_0xea4d('0x2a')](_0xea4d('0x2b'))===0x0){_0x41ab04[_0x3fd9da[_0xea4d('0x2c')](0x4)]=_0x41ab04[_0x3fd9da];delete _0x41ab04[_0x3fd9da];}}}}function getLogFromObject(_0x583507){return util[_0xea4d('0x2d')](_0x583507,{'showHidden':![],'depth':null});}function agiHandler(_0x52bd9c){var _0x3f06c8,_0x34b3fc,_0x4f7f55,_0x5d088e,_0x5ce816;logger[_0xea4d('0x2e')](_0xea4d('0x2f'),JSON[_0xea4d('0x30')](_0x52bd9c,null,0x2));logger[_0xea4d('0xe')](util[_0xea4d('0x12')](_0xea4d('0x31'),_0x52bd9c['arg_1'],_0x52bd9c[_0xea4d('0x16')],_0x52bd9c[_0xea4d('0x17')],_0x52bd9c[_0xea4d('0x1a')],_0x52bd9c[_0xea4d('0x18')]));_0x52bd9c['on'](_0xea4d('0xb'),errorHandler);_0x52bd9c['on'](_0xea4d('0x32'),closeHandler);_0x52bd9c['on'](_0xea4d('0x33'),timeoutHandler);_0x52bd9c[_0xea4d('0x34')]=![];_0x52bd9c['on']('hangup',hangupHandler);var _0x25224c=getSquareProject[_0xea4d('0x35')](null,_0x52bd9c[_0xea4d('0x15')]);if(_0x25224c){if(_0x25224c[_0xea4d('0x36')]){_0x3f06c8=getRoot(_0x25224c[_0xea4d('0x36')]);if(_0x3f06c8&&_0x3f06c8[_0xea4d('0x37')]){logger[_0xea4d('0x2e')](_0xea4d('0x1d'),JSON[_0xea4d('0x30')](_0x3f06c8,null,0x2));_0x52bd9c[_0xea4d('0x38')]=moment()[_0xea4d('0x12')](_0xea4d('0x39'));_0x34b3fc=initGraph(_[_0xea4d('0x23')](_0x3f06c8,_0xea4d('0x3a')),_0x3f06c8[_0xea4d('0x3a')]);_0x4f7f55=new Vertices(_0x52bd9c,rpc,mailRpc);logger[_0xea4d('0xe')](util[_0xea4d('0x12')](_0xea4d('0x3b'),_0x52bd9c[_0xea4d('0x15')],_0x52bd9c[_0xea4d('0x16')],_0x52bd9c[_0xea4d('0x17')],_0x52bd9c[_0xea4d('0x1a')],_0x52bd9c[_0xea4d('0x18')]));_0x34b3fc[_0xea4d('0x3c')](_0x3f06c8[_0xea4d('0x37')]['id'],function(_0x5f6794){try{_0x5f6794=_0x4f7f55[_0xea4d('0x3d')](_0x5f6794);logger[_0xea4d('0x2e')]('vertex',JSON[_0xea4d('0x30')](_0x5f6794,null,0x2));if(_0x5f6794[_0xea4d('0x1e')]==='gotoc'){logger['info'](_0xea4d('0x3e'));_0x52bd9c[_0xea4d('0x3f')]=_0x5f6794['context']||_0x52bd9c[_0xea4d('0x3f')];_0x52bd9c[_0xea4d('0x40')]=_0x5f6794[_0xea4d('0x40')];_0x52bd9c[_0xea4d('0x41')]=_0x5f6794[_0xea4d('0x41')]?_0x5f6794[_0xea4d('0x41')]-0x1:0x1;return null;}else if(_0x5f6794&&_0x4f7f55[_0x5f6794[_0xea4d('0x1e')]]){_0x5ce816=_0x4f7f55[_0x5f6794[_0xea4d('0x1e')]](_0x5f6794);logger[_0xea4d('0xe')](_0xea4d('0x42'),JSON[_0xea4d('0x30')](_0x5ce816,null,0x2));if(_0x5ce816&&_0x5ce816[_0xea4d('0x43')]===AGI_CODE_SUCCESS&&_0x5ce816[_0xea4d('0x44')]!==AGI_RESULT_ERROR&&!_0x52bd9c['evtHangup']){logger[_0xea4d('0x2e')](_0xea4d('0x42'),getLogFromObject(_0x5ce816));return _[_0xea4d('0x45')](_0x5ce816[_0xea4d('0x44')])?null:_0x5ce816['result'][_0xea4d('0x46')]();}else{logger[_0xea4d('0xb')](_0xea4d('0x42'),getLogFromObject(_0x5ce816));return null;}}else{logger[_0xea4d('0xb')](_0xea4d('0x47'));return null;}}catch(_0x379691){logger[_0xea4d('0xb')](_0x379691[_0xea4d('0xc')]);return null;}});if(_0x3f06c8['finally']){logger[_0xea4d('0xe')](util[_0xea4d('0x12')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x52bd9c[_0xea4d('0x15')],_0x52bd9c[_0xea4d('0x16')],_0x52bd9c['callerid'],_0x52bd9c[_0xea4d('0x1a')],_0x52bd9c[_0xea4d('0x18')]));_0x34b3fc['traverseBFS'](_0x3f06c8[_0xea4d('0x48')]['id'],function(_0x2fefc5){try{_0x2fefc5=_0x4f7f55[_0xea4d('0x3d')](_0x2fefc5);logger[_0xea4d('0x2e')](_0xea4d('0x49'),JSON[_0xea4d('0x30')](_0x2fefc5,null,0x2));if(_0x2fefc5&&_0x4f7f55[_0x2fefc5[_0xea4d('0x1e')]]){_0x5ce816=_0x4f7f55[_0x2fefc5[_0xea4d('0x1e')]](_0x2fefc5);if(_0x5ce816){logger['debug'](_0xea4d('0x42'),getLogFromObject(_0x5ce816));return _[_0xea4d('0x45')](_0x5ce816[_0xea4d('0x44')])?null:_0x5ce816[_0xea4d('0x44')]['toString']();}else{logger['error'](_0xea4d('0x42'),getLogFromObject(_0x5ce816));return null;}}else{logger[_0xea4d('0xb')](_0xea4d('0x47'));return null;}}catch(_0x1f0793){logger[_0xea4d('0xb')](_0x1f0793[_0xea4d('0xc')]);return null;}});}logger[_0xea4d('0xe')](util['format'](_0xea4d('0x4a'),_0x52bd9c[_0xea4d('0x15')],_0x52bd9c[_0xea4d('0x16')],_0x52bd9c[_0xea4d('0x17')],_0x52bd9c[_0xea4d('0x1a')],_0x52bd9c[_0xea4d('0x18')]));logger[_0xea4d('0xe')](util[_0xea4d('0x12')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x52bd9c['context'],_0x52bd9c[_0xea4d('0x40')],parseInt(_0x52bd9c['priority'],0xa)+0x1));_0x52bd9c[_0xea4d('0x4b')](_0x52bd9c[_0xea4d('0x3f')],_0x52bd9c['extension'],parseInt(_0x52bd9c['priority'],0xa)+0x1);_0x52bd9c[_0xea4d('0x32')]();}}else{logger['error'](util[_0xea4d('0x12')](_0xea4d('0x4c'),_0x52bd9c[_0xea4d('0x15')]));_0x52bd9c[_0xea4d('0x4b')](_0x52bd9c['context'],_0x52bd9c[_0xea4d('0x40')],parseInt(_0x52bd9c['priority'],0xa)+0x1);_0x52bd9c['close']();}}else{logger[_0xea4d('0xb')](util[_0xea4d('0x12')](_0xea4d('0x4d'),_0x52bd9c[_0xea4d('0x15')]));_0x52bd9c['continueAt'](_0x52bd9c[_0xea4d('0x3f')],_0x52bd9c[_0xea4d('0x40')],parseInt(_0x52bd9c[_0xea4d('0x41')],0xa)+0x1);_0x52bd9c['close']();}}function main(){var _0x225b57;return utilLicense[_0xea4d('0x4e')]()['then'](function(_0xe256ec){if(_0xe256ec){if(_0xe256ec[_0xea4d('0x4f')]){if(_0xe256ec[_0xea4d('0x50')]&&_0xe256ec[_0xea4d('0x50')]>0x0){logger[_0xea4d('0xe')](util[_0xea4d('0x12')](_0xea4d('0x51'),_0xe256ec['callysquare']));_0x225b57=_0xe256ec[_0xea4d('0x50')];}else{logger[_0xea4d('0xe')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xea4d('0xe')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x225b57=-0x1;}}})[_0xea4d('0x52')](function(_0x32a8df){logger[_0xea4d('0xb')](_0xea4d('0x53'),_0x32a8df[_0xea4d('0xc')]);})['finally'](function(){var _0x39f9a5=require(_0xea4d('0x54'))(0x11dd,_0xea4d('0x55'),_0x225b57);_0x39f9a5['on'](_0xea4d('0xb'),errorHandler);_0x39f9a5['on']('listening',listeningHandler);_0x39f9a5['on'](_0xea4d('0x56'),connectionHandler);_0x39f9a5['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x46d1=['continueAt','Project\x20%s\x20not\x20published','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','0.0.0.0','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/logger','../../config/license/util','./rpc','./mailRpc','./vertices','nextTick','error','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','[LISTENING]\x20Cally\x20Square\x20listening\x200.0.0.0:4573','name','message','format','[ERROR]\x20%s','arg_1','calleridname','dnid','uniqueid','stack','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','evtHangup','toJson','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','length','source','target','addEdge','getSquareProject','then','catch','createSquareReport','indexOf','agi_','substring','inspect','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','sync','production','start','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','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','isUndefined','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s'];(function(_0x3ec770,_0x30b56f){var _0x1ef31=function(_0x332cfe){while(--_0x332cfe){_0x3ec770['push'](_0x3ec770['shift']());}};_0x1ef31(++_0x30b56f);}(_0x46d1,0xbe));var _0x146d=function(_0x40c321,_0x570295){_0x40c321=_0x40c321-0x0;var _0xd80060=_0x46d1[_0x40c321];return _0xd80060;};'use strict';var parser=require(_0x146d('0x0'));var _=require(_0x146d('0x1'));var syncho=require(_0x146d('0x2'));var util=require(_0x146d('0x3'));var moment=require(_0x146d('0x4'));var config=require(_0x146d('0x5'));var logger=require(_0x146d('0x6'))('agi');var utilLicense=require(_0x146d('0x7'));var rpc=require(_0x146d('0x8'));var mailRpc=require(_0x146d('0x9'));var Graph=require('./graph');var Vertices=require(_0x146d('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function connectionHandler(_0x5aa0d8){process[_0x146d('0xb')](function(){syncho(function(){try{setChannelVariables(_0x5aa0d8);agiHandler(_0x5aa0d8);}catch(_0x33a71c){logger[_0x146d('0xc')](_0x33a71c['stack']);}});});}function listeningHandler(_0x27d7da){console['log'](_0x146d('0xd'),0x11dd);logger[_0x146d('0xe')](_0x146d('0xf'));}function errorHandler(_0xc8a4bd){if(_0xc8a4bd&&_0xc8a4bd[_0x146d('0x10')]&&_0xc8a4bd[_0x146d('0x11')]){logger[_0x146d('0xc')](util['format']('[%s]\x20%s',_0xc8a4bd[_0x146d('0x10')],_0xc8a4bd[_0x146d('0x11')]));}else{logger[_0x146d('0xc')](util[_0x146d('0x12')](_0x146d('0x13'),_0xc8a4bd['stack']));}}function closeHandler(){logger['info'](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x146d('0x14')],this[_0x146d('0x15')],this['callerid'],this[_0x146d('0x16')],this[_0x146d('0x17')]));try{createSquareReport(this);}catch(_0x1d253d){logger[_0x146d('0xc')](_0x1d253d[_0x146d('0x18')]);}}function timeoutHandler(){logger[_0x146d('0xe')](util[_0x146d('0x12')](_0x146d('0x19'),this[_0x146d('0x14')],this[_0x146d('0x15')],this[_0x146d('0x1a')],this['dnid'],this[_0x146d('0x17')]));}function hangupHandler(){logger[_0x146d('0xe')](util[_0x146d('0x12')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x146d('0x14')],this['calleridname'],this[_0x146d('0x1a')],this['dnid'],this[_0x146d('0x17')]));this[_0x146d('0x1b')]=!![];}function getRoot(_0x18fd9f){return parser[_0x146d('0x1c')](_0x18fd9f,{'object':!![]})['mxGraphModel'][_0x146d('0x1d')];}function addVertex(_0x45344c,_0x282439,_0x30c8ea){_0x282439[_0x146d('0x1e')]=_0x30c8ea;if(_0x282439[_0x146d('0x1f')](_0x146d('0x20'))){_0x282439[_0x146d('0x21')]=parseInt(_0x282439[_0x146d('0x20')],0xa);}_0x45344c[_0x146d('0x22')](_[_0x146d('0x23')](_0x282439,_0x146d('0x24')));}function initGraph(_0x248092,_0x5687a1){var _0xef5859=new Graph();for(var _0x247501 in _0x248092){if(_0x248092[_0x146d('0x1f')](_0x247501)){if(_['isArray'](_0x248092[_0x247501])){for(var _0x24a8d7=0x0;_0x24a8d7<_0x248092[_0x247501][_0x146d('0x25')];_0x24a8d7+=0x1){addVertex(_0xef5859,_0x248092[_0x247501][_0x24a8d7],_0x247501);}}else{addVertex(_0xef5859,_0x248092[_0x247501],_0x247501);}}}for(var _0x3c4fe2=0x0;_0x3c4fe2<_0x5687a1[_0x146d('0x25')];_0x3c4fe2+=0x1){if(_0x5687a1[_0x3c4fe2][_0x146d('0x26')]&&_0x5687a1[_0x3c4fe2][_0x146d('0x27')]){_0xef5859[_0x146d('0x28')](_0x5687a1[_0x3c4fe2]['source'],_0x5687a1[_0x3c4fe2][_0x146d('0x27')],_0x5687a1[_0x3c4fe2]['value']);}}return _0xef5859;}function getSquareProject(_0x5094b3,_0x3853c6){rpc[_0x146d('0x29')](_0x5094b3)[_0x146d('0x2a')](function(_0x3e2fc8){_0x3853c6(null,_0x3e2fc8);})[_0x146d('0x2b')](function(_0x5a4dd4){_0x3853c6(null,_0x5a4dd4);});}function createSquareReport(_0x502ec9,_0x4934cf){rpc[_0x146d('0x2c')](_0x502ec9)['then'](function(_0x18788a){if(_0x4934cf){_0x4934cf(null,_0x18788a);}})[_0x146d('0x2b')](function(_0xb4fcca){if(_0x4934cf){_0x4934cf(null,_0xb4fcca);}});}function setChannelVariables(_0x4b0a4b){for(var _0x247a7f in _0x4b0a4b){if(_0x4b0a4b[_0x146d('0x1f')](_0x247a7f)){if(_0x247a7f[_0x146d('0x2d')](_0x146d('0x2e'))===0x0){_0x4b0a4b[_0x247a7f[_0x146d('0x2f')](0x4)]=_0x4b0a4b[_0x247a7f];delete _0x4b0a4b[_0x247a7f];}}}}function getLogFromObject(_0x542792){return util[_0x146d('0x30')](_0x542792,{'showHidden':![],'depth':null});}function agiHandler(_0x2aae10){var _0x5496ff,_0x5a513f,_0x1dcfba,_0x63c09b,_0x438d9c;logger[_0x146d('0x31')]('variables',JSON[_0x146d('0x32')](_0x2aae10,null,0x2));logger[_0x146d('0xe')](util[_0x146d('0x12')](_0x146d('0x33'),_0x2aae10[_0x146d('0x14')],_0x2aae10['calleridname'],_0x2aae10[_0x146d('0x1a')],_0x2aae10[_0x146d('0x16')],_0x2aae10[_0x146d('0x17')]));_0x2aae10['on'](_0x146d('0xc'),errorHandler);_0x2aae10['on'](_0x146d('0x34'),closeHandler);_0x2aae10['on']('timeout',timeoutHandler);_0x2aae10[_0x146d('0x1b')]=![];_0x2aae10['on'](_0x146d('0x35'),hangupHandler);var _0x1c4906=getSquareProject[_0x146d('0x36')](null,_0x2aae10['arg_1']);if(_0x1c4906){if(_0x1c4906[_0x146d('0x37')]){_0x5496ff=getRoot(_0x1c4906[_0x146d('0x37')]);if(_0x5496ff&&_0x5496ff[_0x146d('0x38')]){logger['debug'](_0x146d('0x1d'),JSON[_0x146d('0x32')](_0x5496ff,null,0x2));_0x2aae10[_0x146d('0x39')]=moment()[_0x146d('0x12')](_0x146d('0x3a'));_0x5a513f=initGraph(_[_0x146d('0x23')](_0x5496ff,'mxCell'),_0x5496ff['mxCell']);_0x1dcfba=new Vertices(_0x2aae10,rpc,mailRpc);logger[_0x146d('0xe')](util[_0x146d('0x12')](_0x146d('0x3b'),_0x2aae10[_0x146d('0x14')],_0x2aae10['calleridname'],_0x2aae10[_0x146d('0x1a')],_0x2aae10[_0x146d('0x16')],_0x2aae10['uniqueid']));_0x5a513f[_0x146d('0x3c')](_0x5496ff[_0x146d('0x38')]['id'],function(_0x1f6e34){try{_0x1f6e34=_0x1dcfba[_0x146d('0x3d')](_0x1f6e34);logger[_0x146d('0x31')](_0x146d('0x3e'),JSON[_0x146d('0x32')](_0x1f6e34,null,0x2));if(_0x1f6e34[_0x146d('0x1e')]===_0x146d('0x3f')){logger['info'](_0x146d('0x40'));_0x2aae10[_0x146d('0x41')]=_0x1f6e34['context']||_0x2aae10['context'];_0x2aae10[_0x146d('0x42')]=_0x1f6e34['extension'];_0x2aae10[_0x146d('0x43')]=_0x1f6e34[_0x146d('0x43')]?_0x1f6e34[_0x146d('0x43')]-0x1:0x1;return null;}else if(_0x1f6e34&&_0x1dcfba[_0x1f6e34[_0x146d('0x1e')]]){_0x438d9c=_0x1dcfba[_0x1f6e34['agicommand']](_0x1f6e34);logger[_0x146d('0xe')](_0x146d('0x44'),JSON[_0x146d('0x32')](_0x438d9c,null,0x2));if(_0x438d9c&&_0x438d9c[_0x146d('0x45')]===AGI_CODE_SUCCESS&&_0x438d9c[_0x146d('0x46')]!==AGI_RESULT_ERROR&&!_0x2aae10[_0x146d('0x1b')]){logger[_0x146d('0x31')](_0x146d('0x44'),getLogFromObject(_0x438d9c));return _['isUndefined'](_0x438d9c[_0x146d('0x46')])?null:_0x438d9c[_0x146d('0x46')][_0x146d('0x47')]();}else{logger[_0x146d('0xc')](_0x146d('0x44'),getLogFromObject(_0x438d9c));return null;}}else{logger[_0x146d('0xc')](_0x146d('0x48'));return null;}}catch(_0x5cbec7){logger[_0x146d('0xc')](_0x5cbec7['stack']);return null;}});if(_0x5496ff[_0x146d('0x49')]){logger['info'](util[_0x146d('0x12')](_0x146d('0x4a'),_0x2aae10['arg_1'],_0x2aae10[_0x146d('0x15')],_0x2aae10[_0x146d('0x1a')],_0x2aae10['dnid'],_0x2aae10[_0x146d('0x17')]));_0x5a513f[_0x146d('0x3c')](_0x5496ff[_0x146d('0x49')]['id'],function(_0xcb1a9c){try{_0xcb1a9c=_0x1dcfba[_0x146d('0x3d')](_0xcb1a9c);logger[_0x146d('0x31')]('vertex',JSON[_0x146d('0x32')](_0xcb1a9c,null,0x2));if(_0xcb1a9c&&_0x1dcfba[_0xcb1a9c[_0x146d('0x1e')]]){_0x438d9c=_0x1dcfba[_0xcb1a9c[_0x146d('0x1e')]](_0xcb1a9c);if(_0x438d9c){logger[_0x146d('0x31')]('response',getLogFromObject(_0x438d9c));return _[_0x146d('0x4b')](_0x438d9c[_0x146d('0x46')])?null:_0x438d9c[_0x146d('0x46')]['toString']();}else{logger['error'](_0x146d('0x44'),getLogFromObject(_0x438d9c));return null;}}else{logger[_0x146d('0xc')](_0x146d('0x48'));return null;}}catch(_0xeaf5a7){logger['error'](_0xeaf5a7[_0x146d('0x18')]);return null;}});}logger[_0x146d('0xe')](util[_0x146d('0x12')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2aae10[_0x146d('0x14')],_0x2aae10[_0x146d('0x15')],_0x2aae10['callerid'],_0x2aae10['dnid'],_0x2aae10[_0x146d('0x17')]));logger['info'](util[_0x146d('0x12')](_0x146d('0x4c'),_0x2aae10[_0x146d('0x41')],_0x2aae10[_0x146d('0x42')],parseInt(_0x2aae10['priority'],0xa)+0x1));_0x2aae10[_0x146d('0x4d')](_0x2aae10[_0x146d('0x41')],_0x2aae10[_0x146d('0x42')],parseInt(_0x2aae10[_0x146d('0x43')],0xa)+0x1);_0x2aae10[_0x146d('0x34')]();}}else{logger[_0x146d('0xc')](util[_0x146d('0x12')](_0x146d('0x4e'),_0x2aae10[_0x146d('0x14')]));_0x2aae10[_0x146d('0x4d')](_0x2aae10[_0x146d('0x41')],_0x2aae10['extension'],parseInt(_0x2aae10['priority'],0xa)+0x1);_0x2aae10[_0x146d('0x34')]();}}else{logger[_0x146d('0xc')](util[_0x146d('0x12')]('Project\x20%s\x20not\x20found',_0x2aae10[_0x146d('0x14')]));_0x2aae10[_0x146d('0x4d')](_0x2aae10[_0x146d('0x41')],_0x2aae10[_0x146d('0x42')],parseInt(_0x2aae10[_0x146d('0x43')],0xa)+0x1);_0x2aae10[_0x146d('0x34')]();}}function main(){var _0x42c60a;return utilLicense[_0x146d('0x4f')]()[_0x146d('0x2a')](function(_0x3f1719){if(_0x3f1719){if(_0x3f1719[_0x146d('0x50')]){if(_0x3f1719['callysquare']&&_0x3f1719[_0x146d('0x51')]>0x0){logger[_0x146d('0xe')](util[_0x146d('0x12')](_0x146d('0x52'),_0x3f1719[_0x146d('0x51')]));_0x42c60a=_0x3f1719[_0x146d('0x51')];}else{logger[_0x146d('0xe')](_0x146d('0x53'));}}else{logger[_0x146d('0xe')](_0x146d('0x54'));_0x42c60a=-0x1;}}})[_0x146d('0x2b')](function(_0x2f6776){logger[_0x146d('0xc')]('[LICENSE]',_0x2f6776[_0x146d('0x18')]);})[_0x146d('0x49')](function(){var _0x27b22e=require(_0x146d('0x55'))(0x11dd,_0x146d('0x56'),_0x42c60a);_0x27b22e['on'](_0x146d('0xc'),errorHandler);_0x27b22e['on'](_0x146d('0x57'),listeningHandler);_0x27b22e['on'](_0x146d('0x58'),connectionHandler);_0x27b22e['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 11f74c1..624b573 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0xe0eb54,_0x3e4d15){var _0x154c33=function(_0x578877){while(--_0x578877){_0xe0eb54['push'](_0xe0eb54['shift']());}};_0x154c33(++_0x3e4d15);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x3831f0,_0x5d8c17){var _0x4eec78=function(_0x2e8f86){while(--_0x2e8f86){_0x3831f0['push'](_0x3831f0['shift']());}};_0x4eec78(++_0x5d8c17);}(_0x34e8,0x12c));var _0x834e=function(_0x46366d,_0x5402c8){_0x46366d=_0x46366d-0x0;var _0x218da7=_0x34e8[_0x46366d];return _0x218da7;};'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 diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index cd98c48..217a10d 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(_0x713076,_0x20c1e7){var _0x1dabdd=function(_0x39d9d4){while(--_0x39d9d4){_0x713076['push'](_0x713076['shift']());}};_0x1dabdd(++_0x20c1e7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2f5df4,_0x446e97){_0x2f5df4=_0x2f5df4-0x0;var _0x4c83ad=_0x5f2f[_0x2f5df4];return _0x4c83ad;};'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(_0x1449e6,_0x1f3968){var _0x4553bf=function(_0x2ada69){while(--_0x2ada69){_0x1449e6['push'](_0x1449e6['shift']());}};_0x4553bf(++_0x1f3968);}(_0x5f2f,0x73));var _0xf5f2=function(_0xb8b26c,_0x4c9acd){_0xb8b26c=_0xb8b26c-0x0;var _0x18aaa0=_0x5f2f[_0xb8b26c];return _0x18aaa0;};'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 e8a4f46..b0b13b4 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 _0x4cc4=['http','then','error','message','result','catch','ShowSquareProject','getMailAccountById','Smtp','email','getSquareProjectById','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','dsn','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','lodash','util','jayson/promise','client'];(function(_0x2e4830,_0x20e63b){var _0x1f89a2=function(_0x24d30a){while(--_0x24d30a){_0x2e4830['push'](_0x2e4830['shift']());}};_0x1f89a2(++_0x20e63b);}(_0x4cc4,0x6f));var _0x44cc=function(_0x262b1a,_0x31df4c){_0x262b1a=_0x262b1a-0x0;var _0x20855f=_0x4cc4[_0x262b1a];return _0x20855f;};'use strict';var BPromise=require('bluebird');var moment=require(_0x44cc('0x0'));var _=require(_0x44cc('0x1'));var util=require(_0x44cc('0x2'));var jayson=require(_0x44cc('0x3'));var client=jayson[_0x44cc('0x4')][_0x44cc('0x5')]({'port':0x2329});function request(_0xa040e0,_0x156ec6){return new BPromise(function(_0x3e1b64,_0x42a30e){return client['request'](_0xa040e0,_0x156ec6)[_0x44cc('0x6')](function(_0x199830){if(_0x199830[_0x44cc('0x7')]){return _0x42a30e(_0x199830[_0x44cc('0x7')][_0x44cc('0x8')]);}else{return _0x3e1b64(_0x199830[_0x44cc('0x9')]);}})[_0x44cc('0xa')](function(_0x3d7f61){return _0x42a30e(_0x3d7f61);});});}exports['getSquareProject']=function(_0x301abe){return request(_0x44cc('0xb'),{'options':{'raw':![],'where':{'name':_0x301abe},'attributes':['production']}});};exports[_0x44cc('0xc')]=function(_0x18cb93){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x18cb93},'include':[{'model':'MailServerOut','as':_0x44cc('0xd')}],'attributes':['id','name',_0x44cc('0xe')]}});};exports[_0x44cc('0xf')]=function(_0x3e6b02){return request(_0x44cc('0xb'),{'options':{'where':{'id':_0x3e6b02},'attributes':[_0x44cc('0x10')]}});};exports[_0x44cc('0x11')]=function(_0x16cf98){return request(_0x44cc('0x12'),{'options':{'where':{'id':_0x16cf98},'attributes':[_0x44cc('0x10')]}});};exports[_0x44cc('0x13')]=function(_0x86aed1){return request(_0x44cc('0x14'),{'options':{'where':{'id':_0x86aed1},'attributes':[_0x44cc('0x10')]}});};exports['getSquareOdbcById']=function(_0x411156){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x411156},'attributes':[_0x44cc('0x15')]}});};exports['getUserById']=function(_0x29dd4e){return request(_0x44cc('0x16'),{'options':{'where':{'id':_0x29dd4e},'attributes':[_0x44cc('0x10')]}});};exports[_0x44cc('0x17')]=function(_0x5b883f){return request(_0x44cc('0x18'),{'options':{'where':{'id':_0x5b883f},'attributes':[_0x44cc('0x10')]}});};exports[_0x44cc('0x19')]=function(_0xea90c5){return request(_0x44cc('0x1a'),{'options':{'where':{'id':_0xea90c5},'attributes':[_0x44cc('0x1b')]}});};exports[_0x44cc('0x1c')]=function(_0xdbcd13){return request(_0x44cc('0x1d'),{'options':{'raw':![],'where':{'id':_0xdbcd13},'include':[{'model':_0x44cc('0x1e'),'as':_0x44cc('0x1f')}]}});};exports[_0x44cc('0x20')]=function(_0x42d3c3){return request(_0x44cc('0x21'),{'options':{'where':{'id':_0x42d3c3},'attributes':['id','name']}});};exports[_0x44cc('0x22')]=function(_0x27b6a4){return request(_0x44cc('0x23'),{'body':_0x27b6a4});};exports[_0x44cc('0x24')]=function(_0x43269a){return request(_0x44cc('0x25'),{'body':_0x43269a});};exports[_0x44cc('0x26')]=function(_0x16bf15){return request(_0x44cc('0x27'),{'body':_[_0x44cc('0x28')](_0x16bf15,{'project_name':_0x16bf15[_0x44cc('0x29')],'prev_project_name':_0x16bf15[_0x44cc('0x2a')]||'','is_subproject':_0x16bf15[_0x44cc('0x2a')]?!![]:![],'leaveAt':moment()[_0x44cc('0x2b')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x44cc('0x2c')]=function(_0x47e046){return request(_0x44cc('0x2d'),{'body':_0x47e046});};exports['createCmContact']=function(_0xf63c68){return request(_0x44cc('0x2e'),{'options':{'raw':![],'where':{'phone':_0xf63c68['phone'],'ListId':_0xf63c68[_0x44cc('0x2f')]}}})[_0x44cc('0x6')](function(_0x49dea0){if(_0x49dea0){return _0x49dea0;}return request(_0x44cc('0x30'),{'body':_0xf63c68});});};exports[_0x44cc('0x31')]=function(_0xd84de3){return request(_0x44cc('0x32'),{'options':{'where':{'id':_0xd84de3},'attributes':[_0x44cc('0x10')]}});};exports[_0x44cc('0x33')]=function(_0xc2e36d,_0x3a4788){return request('LoginUser',{'body':{'interface':_0x3a4788},'options':{'where':_0xc2e36d}});};exports[_0x44cc('0x34')]=function(_0x50307f,_0x1dfaf3,_0x5eec3a){return request(_0x44cc('0x35'),{'body':{'type':_0x1dfaf3,'uniqueid':_0x5eec3a},'options':{'where':_0x50307f}});};exports[_0x44cc('0x36')]=function(_0x4b6b8b){return request(_0x44cc('0x37'),{'body':{},'options':{'where':_0x4b6b8b}});};exports[_0x44cc('0x38')]=function(_0x421708){return request(_0x44cc('0x39'),{'body':{},'options':{'where':_0x421708}});}; \ No newline at end of file +var _0xa512=['ShowCmHopper','phone','ListId','ShowPause','agentPause','PauseUser','agentUnpause','moment','lodash','util','jayson/promise','client','http','request','then','message','result','catch','ShowSquareProject','production','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording'];(function(_0x2c96ca,_0x52de3e){var _0x57d450=function(_0x11d705){while(--_0x11d705){_0x2c96ca['push'](_0x2c96ca['shift']());}};_0x57d450(++_0x52de3e);}(_0xa512,0xcb));var _0x2a51=function(_0x4f2530,_0x5c0bb5){_0x4f2530=_0x4f2530-0x0;var _0x4a9e71=_0xa512[_0x4f2530];return _0x4a9e71;};'use strict';var BPromise=require('bluebird');var moment=require(_0x2a51('0x0'));var _=require(_0x2a51('0x1'));var util=require(_0x2a51('0x2'));var jayson=require(_0x2a51('0x3'));var client=jayson[_0x2a51('0x4')][_0x2a51('0x5')]({'port':0x2329});function request(_0x40c6f2,_0xac2ca7){return new BPromise(function(_0x190d0f,_0xf2099b){return client[_0x2a51('0x6')](_0x40c6f2,_0xac2ca7)[_0x2a51('0x7')](function(_0x5d8244){if(_0x5d8244['error']){return _0xf2099b(_0x5d8244['error'][_0x2a51('0x8')]);}else{return _0x190d0f(_0x5d8244[_0x2a51('0x9')]);}})[_0x2a51('0xa')](function(_0x4ceeb8){return _0xf2099b(_0x4ceeb8);});});}exports['getSquareProject']=function(_0xf8f509){return request(_0x2a51('0xb'),{'options':{'raw':![],'where':{'name':_0xf8f509},'attributes':[_0x2a51('0xc')]}});};exports['getMailAccountById']=function(_0x2ead92){return request(_0x2a51('0xd'),{'options':{'raw':![],'where':{'id':_0x2ead92},'include':[{'model':_0x2a51('0xe'),'as':_0x2a51('0xf')}],'attributes':['id',_0x2a51('0x10'),_0x2a51('0x11')]}});};exports[_0x2a51('0x12')]=function(_0x96d21b){return request('ShowSquareProject',{'options':{'where':{'id':_0x96d21b},'attributes':[_0x2a51('0x10')]}});};exports[_0x2a51('0x13')]=function(_0x84a345){return request(_0x2a51('0x14'),{'options':{'where':{'id':_0x84a345},'attributes':[_0x2a51('0x10')]}});};exports['getVariableById']=function(_0x56109d){return request('ShowVariable',{'options':{'where':{'id':_0x56109d},'attributes':[_0x2a51('0x10')]}});};exports['getSquareOdbcById']=function(_0x17eaf8){return request(_0x2a51('0x15'),{'options':{'where':{'id':_0x17eaf8},'attributes':[_0x2a51('0x16')]}});};exports[_0x2a51('0x17')]=function(_0x4f3fe5){return request(_0x2a51('0x18'),{'options':{'where':{'id':_0x4f3fe5},'attributes':[_0x2a51('0x10')]}});};exports[_0x2a51('0x19')]=function(_0x5221d7){return request(_0x2a51('0x1a'),{'options':{'where':{'id':_0x5221d7},'attributes':[_0x2a51('0x10')]}});};exports[_0x2a51('0x1b')]=function(_0xc501aa){return request('ShowSound',{'options':{'where':{'id':_0xc501aa},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x586113){return request(_0x2a51('0x1c'),{'options':{'raw':![],'where':{'id':_0x586113},'include':[{'model':_0x2a51('0x1d'),'as':'Intervals'}]}});};exports[_0x2a51('0x1e')]=function(_0x9516ad){return request(_0x2a51('0x1f'),{'options':{'where':{'id':_0x9516ad},'attributes':['id',_0x2a51('0x10')]}});};exports['createSmsMessage']=function(_0x53896d){return request(_0x2a51('0x20'),{'body':_0x53896d});};exports['createSquareDetailsReport']=function(_0x9b5573){return request(_0x2a51('0x21'),{'body':_0x9b5573});};exports[_0x2a51('0x22')]=function(_0x298ad3){return request('CreateSquareReport',{'body':_[_0x2a51('0x23')](_0x298ad3,{'project_name':_0x298ad3[_0x2a51('0x24')],'prev_project_name':_0x298ad3[_0x2a51('0x25')]||'','is_subproject':_0x298ad3[_0x2a51('0x25')]?!![]:![],'leaveAt':moment()[_0x2a51('0x26')](_0x2a51('0x27'))})});};exports[_0x2a51('0x28')]=function(_0x12ad44){return request(_0x2a51('0x29'),{'body':_0x12ad44});};exports['createCmContact']=function(_0x5c5216){return request(_0x2a51('0x2a'),{'options':{'raw':![],'where':{'phone':_0x5c5216[_0x2a51('0x2b')],'ListId':_0x5c5216[_0x2a51('0x2c')]}}})['then'](function(_0x1689e4){if(_0x1689e4){return _0x1689e4;}return request('CreateCmContact',{'body':_0x5c5216});});};exports['getPauseById']=function(_0x351025){return request(_0x2a51('0x2d'),{'options':{'where':{'id':_0x351025},'attributes':[_0x2a51('0x10')]}});};exports['agentLogin']=function(_0x45aeaf,_0x1e549d){return request('LoginUser',{'body':{'interface':_0x1e549d},'options':{'where':_0x45aeaf}});};exports[_0x2a51('0x2e')]=function(_0x20c7d2,_0x224f22,_0xdcf6ed){return request(_0x2a51('0x2f'),{'body':{'type':_0x224f22,'uniqueid':_0xdcf6ed},'options':{'where':_0x20c7d2}});};exports[_0x2a51('0x30')]=function(_0x59cc4e){return request('UnpauseUser',{'body':{},'options':{'where':_0x59cc4e}});};exports['agentLogout']=function(_0x3757f0){return request('LogoutUser',{'body':{},'options':{'where':_0x3757f0}});}; \ 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 074c214..ca20389 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 _0x4d28=['exports'];(function(_0x3ae5be,_0x531ec8){var _0x3ebd88=function(_0x4d312a){while(--_0x4d312a){_0x3ae5be['push'](_0x3ae5be['shift']());}};_0x3ebd88(++_0x531ec8);}(_0x4d28,0x19c));var _0x84d2=function(_0x421196,_0x1cbd94){_0x421196=_0x421196-0x0;var _0x2738af=_0x4d28[_0x421196];return _0x2738af;};var polly=require('./polly');module[_0x84d2('0x0')]={'polly':polly}; \ No newline at end of file +var _0x5be7=['exports','./polly'];(function(_0xba24b,_0x59f53c){var _0x23054e=function(_0x37e5d6){while(--_0x37e5d6){_0xba24b['push'](_0xba24b['shift']());}};_0x23054e(++_0x59f53c);}(_0x5be7,0x65));var _0x75be=function(_0x5bd938,_0x1f02f2){_0x5bd938=_0x5bd938-0x0;var _0x283b61=_0x5be7[_0x5bd938];return _0x283b61;};var polly=require(_0x75be('0x0'));module[_0x75be('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 0700739..24980e7 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 _0xdc89=['./lib/api'];(function(_0x50732f,_0x1afe00){var _0x3ea804=function(_0x51de7c){while(--_0x51de7c){_0x50732f['push'](_0x50732f['shift']());}};_0x3ea804(++_0x1afe00);}(_0xdc89,0x9d));var _0x9dc8=function(_0x1ade10,_0x1c8f0d){_0x1ade10=_0x1ade10-0x0;var _0x432d4d=_0xdc89[_0x1ade10];return _0x432d4d;};'use strict';var polly=require(_0x9dc8('0x0'));module['exports']=function(_0x318280,_0x341f0b,_0x57d79e,_0x2b4f30,_0x4a560b,_0x20b98c,_0x3f0ab1){return polly(_0x318280,_0x341f0b,_0x57d79e,_0x2b4f30,_0x4a560b,_0x20b98c,_0x3f0ab1);}; \ No newline at end of file +var _0xdbe6=['exports'];(function(_0x2fa8af,_0x15da16){var _0x5957cf=function(_0x4162d3){while(--_0x4162d3){_0x2fa8af['push'](_0x2fa8af['shift']());}};_0x5957cf(++_0x15da16);}(_0xdbe6,0x124));var _0x6dbe=function(_0x3aecc3,_0x376f05){_0x3aecc3=_0x3aecc3-0x0;var _0x3e4b57=_0xdbe6[_0x3aecc3];return _0x3e4b57;};'use strict';var polly=require('./lib/api');module[_0x6dbe('0x0')]=function(_0x345376,_0x2d47fc,_0x3a020e,_0x2f6505,_0x407c90,_0x569d01,_0x2f94d3){return polly(_0x345376,_0x2d47fc,_0x3a020e,_0x2f6505,_0x407c90,_0x569d01,_0x2f94d3);}; \ 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 5d85c8e..93e3335 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 _0x8b43=['randomstring','aws-sdk','synthesizeSpeech','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','bluebird'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x8b43,0x149));var _0x38b4=function(_0x4e85f4,_0x14797a){_0x4e85f4=_0x4e85f4-0x0;var _0x124c5d=_0x8b43[_0x4e85f4];return _0x124c5d;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x38b4('0x0'));var rs=require(_0x38b4('0x1'));var AWS=require(_0x38b4('0x2'));function pollyResult(_0x4479de,_0x39cc5a,_0x250aba){return new BPromise(function(_0x5cb674,_0x52eaaf){_0x4479de[_0x38b4('0x3')](_0x39cc5a,function(_0x3601b6,_0x311c32){if(_0x3601b6){_0x52eaaf(_0x3601b6);}else if(_0x311c32){if(_0x311c32['AudioStream']instanceof Buffer){fs[_0x38b4('0x4')](_0x250aba,_0x311c32['AudioStream'],function(_0x149fdd){if(_0x149fdd){_0x52eaaf(_0x149fdd);}else{_0x5cb674();}});}else{_0x52eaaf(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x52eaaf(new Error(_0x38b4('0x5')));}});});}module[_0x38b4('0x6')]=function(_0x1906fb,_0x5e02d4,_0x344c57,_0x5533a2,_0x5dcc91,_0x585124,_0x327a71){var _0x2591a6=new AWS[(_0x38b4('0x7'))]({'accessKeyId':_0x1906fb,'secretAccessKey':_0x5e02d4,'region':_0x344c57});var _0x238ce6={'Text':_0x5dcc91,'TextType':_0x585124||_0x38b4('0x8'),'OutputFormat':_0x38b4('0x9'),'VoiceId':_0x5533a2};return pollyResult(_0x2591a6,_0x238ce6,_0x327a71);}; \ No newline at end of file +var _0xfbc3=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x11e0c5,_0x4f4683){var _0x151b49=function(_0x2021e4){while(--_0x2021e4){_0x11e0c5['push'](_0x11e0c5['shift']());}};_0x151b49(++_0x4f4683);}(_0xfbc3,0xea));var _0x3fbc=function(_0x17d80a,_0xbd04f7){_0x17d80a=_0x17d80a-0x0;var _0x39c01e=_0xfbc3[_0x17d80a];return _0x39c01e;};'use strict';var fs=require('fs');var path=require(_0x3fbc('0x0'));var BPromise=require(_0x3fbc('0x1'));var rs=require(_0x3fbc('0x2'));var AWS=require(_0x3fbc('0x3'));function pollyResult(_0x5eabe9,_0x4f81e3,_0x4d21cd){return new BPromise(function(_0x3eb812,_0x23f88d){_0x5eabe9[_0x3fbc('0x4')](_0x4f81e3,function(_0x1e4ac4,_0x4a90c5){if(_0x1e4ac4){_0x23f88d(_0x1e4ac4);}else if(_0x4a90c5){if(_0x4a90c5[_0x3fbc('0x5')]instanceof Buffer){fs[_0x3fbc('0x6')](_0x4d21cd,_0x4a90c5[_0x3fbc('0x5')],function(_0x357c47){if(_0x357c47){_0x23f88d(_0x357c47);}else{_0x3eb812();}});}else{_0x23f88d(new Error(_0x3fbc('0x7')));}}else{_0x23f88d(new Error(_0x3fbc('0x8')));}});});}module[_0x3fbc('0x9')]=function(_0x247ca8,_0x3f6367,_0x18fa8e,_0x221cbd,_0x45a934,_0x4dc7a0,_0x317a43){var _0x5c6c76=new AWS['Polly']({'accessKeyId':_0x247ca8,'secretAccessKey':_0x3f6367,'region':_0x18fa8e});var _0x19fd83={'Text':_0x45a934,'TextType':_0x4dc7a0||'text','OutputFormat':_0x3fbc('0xa'),'VoiceId':_0x221cbd};return pollyResult(_0x5c6c76,_0x19fd83,_0x317a43);}; \ 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 756dbf4..4b4e51b 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x2a2bdf,_0x2fc457,_0x27ad29,_0x204232){return asr(_0x2a2bdf,_0x2fc457,_0x27ad29);}; \ No newline at end of file +var _0xda2d=['exports'];(function(_0x2dca7e,_0x2e2a8d){var _0x2c3c93=function(_0x5d5929){while(--_0x5d5929){_0x2dca7e['push'](_0x2dca7e['shift']());}};_0x2c3c93(++_0x2e2a8d);}(_0xda2d,0x102));var _0xdda2=function(_0x1c75f0,_0x2085e3){_0x1c75f0=_0x1c75f0-0x0;var _0x1ee726=_0xda2d[_0x1c75f0];return _0x1ee726;};'use strict';var asr=require('./lib/api');module[_0xdda2('0x0')]=function(_0x35f029,_0xd495d2,_0x1f1fcc,_0x329c5e){return asr(_0x35f029,_0xd495d2,_0x1f1fcc);}; \ 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 2afee6a..28c7950 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 _0x24d4=['bluebird','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','undefined','string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST','/v1/speech:recognize?key=','url'];(function(_0x39c341,_0x2f47ff){var _0x58f61e=function(_0x101e79){while(--_0x101e79){_0x39c341['push'](_0x39c341['shift']());}};_0x58f61e(++_0x2f47ff);}(_0x24d4,0x110));var _0x424d=function(_0x585d09,_0x1274bc){_0x585d09=_0x585d09-0x0;var _0x7d9a14=_0x24d4[_0x585d09];return _0x7d9a14;};'use strict';var url=require(_0x424d('0x0'));var BPromise=require(_0x424d('0x1'));var fs=require('fs');var host=_0x424d('0x2');module[_0x424d('0x3')]=function(_0x630299,_0x5aa529,_0x18bf81){return new BPromise(function(_0x24bdc9,_0x18a698){var _0x324c71;if(typeof _0x630299!=='string'||_0x630299[_0x424d('0x4')]===0x0){return _0x18a698(_0x424d('0x5'));}if(typeof _0x5aa529!=='string'||_0x5aa529[_0x424d('0x4')]===0x0){return _0x18a698('key\x20should\x20be\x20a\x20string');}if(typeof _0x18bf81!==_0x424d('0x6')&&(typeof _0x18bf81!==_0x424d('0x7')||_0x18bf81[_0x424d('0x4')]===0x0)){return _0x18a698(_0x424d('0x8'));}try{_0x324c71=fs[_0x424d('0x9')](_0x630299)[_0x424d('0xa')]('base64');}catch(_0x14204e){return _0x18a698(_0x14204e);}return _0x24bdc9({'method':_0x424d('0xb'),'uri':host+_0x424d('0xc')+_0x5aa529,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x18bf81},'audio':{'content':_0x324c71}},'json':!![]});});}; \ No newline at end of file +var _0x0bf3=['/v1/speech:recognize?key=','LINEAR16','8000','url','https://speech.googleapis.com','string','filepath\x20should\x20be\x20a\x20string','length','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST'];(function(_0x19bf5f,_0x1ca6b9){var _0x237efa=function(_0x18f2a3){while(--_0x18f2a3){_0x19bf5f['push'](_0x19bf5f['shift']());}};_0x237efa(++_0x1ca6b9);}(_0x0bf3,0xed));var _0x30bf=function(_0x4e9ced,_0x31ffdb){_0x4e9ced=_0x4e9ced-0x0;var _0x2b6854=_0x0bf3[_0x4e9ced];return _0x2b6854;};'use strict';var url=require(_0x30bf('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x30bf('0x1');module['exports']=function(_0x48cca6,_0x36925f,_0xad0f97){return new BPromise(function(_0x21e579,_0x4025fd){var _0x4cac1f;if(typeof _0x48cca6!==_0x30bf('0x2')||_0x48cca6['length']===0x0){return _0x4025fd(_0x30bf('0x3'));}if(typeof _0x36925f!==_0x30bf('0x2')||_0x36925f['length']===0x0){return _0x4025fd('key\x20should\x20be\x20a\x20string');}if(typeof _0xad0f97!=='undefined'&&(typeof _0xad0f97!==_0x30bf('0x2')||_0xad0f97[_0x30bf('0x4')]===0x0)){return _0x4025fd(_0x30bf('0x5'));}try{_0x4cac1f=fs[_0x30bf('0x6')](_0x48cca6)[_0x30bf('0x7')](_0x30bf('0x8'));}catch(_0x2f277a){return _0x4025fd(_0x2f277a);}return _0x21e579({'method':_0x30bf('0x9'),'uri':host+_0x30bf('0xa')+_0x36925f,'body':{'config':{'encoding':_0x30bf('0xb'),'sampleRateHertz':_0x30bf('0xc'),'languageCode':_0xad0f97},'audio':{'content':_0x4cac1f}},'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 3ecf004..830ffb0 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 _0xedd9=['exports'];(function(_0x14bd69,_0x4484ad){var _0x195142=function(_0x8027c4){while(--_0x8027c4){_0x14bd69['push'](_0x14bd69['shift']());}};_0x195142(++_0x4484ad);}(_0xedd9,0xfc));var _0x9edd=function(_0x4bdee8,_0x5d5a8e){_0x4bdee8=_0x4bdee8-0x0;var _0x35eda4=_0xedd9[_0x4bdee8];return _0x35eda4;};var asr=require('./asr');module[_0x9edd('0x0')]={'asr':asr}; \ No newline at end of file +var _0x008c=['./asr','exports'];(function(_0x156488,_0x3e7952){var _0x2c6847=function(_0x35c02f){while(--_0x35c02f){_0x156488['push'](_0x156488['shift']());}};_0x2c6847(++_0x3e7952);}(_0x008c,0x188));var _0xc008=function(_0x574162,_0x2425ea){_0x574162=_0x574162-0x0;var _0x39c245=_0x008c[_0x574162];return _0x39c245;};var asr=require(_0xc008('0x0'));module[_0xc008('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index cada235..fcab83f 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 _0xa264=['statusCode','error','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','info','finish\x20download\x20file','close','download\x20error','pipe','end','protocol','WHAT_EVER','get','data','transcode','error\x20convert','start','toString','base64','then','resolve','tmp','generate','.wav','unlink','chmodSync','777','split','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','source','resolvedQuery','result','score','code','tildeASR','asr','awsPolly','.mp3','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','path','https','url','parse','randomstring','sox','util','querystring','moment','apiai-promise','./aws','./tilde','agi','https://api.ispeech.org/api/rest','host'];(function(_0x586491,_0x320b0d){var _0x5df3b2=function(_0x26cf0b){while(--_0x26cf0b){_0x586491['push'](_0x586491['shift']());}};_0x5df3b2(++_0x320b0d);}(_0xa264,0xcf));var _0x4a26=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0xa264[_0xf73c09];return _0xa8923c;};'use strict';var fs=require('fs');var path=require(_0x4a26('0x0'));var http=require('http');var https=require(_0x4a26('0x1'));var urlParse=require(_0x4a26('0x2'))[_0x4a26('0x3')];var BPromise=require('bluebird');var rs=require(_0x4a26('0x4'));var sox=require(_0x4a26('0x5'));var rp=require('request-promise');var util=require(_0x4a26('0x6'));var querystring=require(_0x4a26('0x7'));var moment=require(_0x4a26('0x8'));var tts=require('google-tts-api');var apiai=require(_0x4a26('0x9'));var google=require('./google');var aws=require(_0x4a26('0xa'));var tilde=require(_0x4a26('0xb'));var logger=require('../../../config/logger')(_0x4a26('0xc'));var ISPEECH_API=_0x4a26('0xd');function downloadFile(_0x3164ae,_0x245502){return new BPromise(function(_0x5554db,_0x59094e){var _0x490cc4=urlParse(_0x3164ae);var _0x1d44ca=_0x490cc4['protocol']==='https:'?https:http;var _0xa3ec6b={'host':_0x490cc4[_0x4a26('0xe')],'path':_0x490cc4[_0x4a26('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0x1d44ca['get'](_0xa3ec6b,function(_0x4b644a){if(_0x4b644a[_0x4a26('0xf')]!==0xc8){logger[_0x4a26('0x10')]('request\x20to\x20'+_0x3164ae+'\x20failed,\x20status\x20code\x20=\x20'+_0x4b644a[_0x4a26('0xf')]+'\x20('+_0x4b644a[_0x4a26('0x11')]+')');_0x59094e(new Error('request\x20to\x20'+_0x3164ae+_0x4a26('0x12')+_0x4b644a['statusCode']+'\x20('+_0x4b644a[_0x4a26('0x11')]+')'));return;}var _0x4613c3=fs[_0x4a26('0x13')](_0x245502);_0x4613c3['on']('finish',function(){logger[_0x4a26('0x14')](_0x4a26('0x15'));_0x4613c3[_0x4a26('0x16')](_0x5554db);});_0x4613c3['on'](_0x4a26('0x10'),function(_0x3b7797){fs['unlink'](_0x245502);logger[_0x4a26('0x10')](_0x4a26('0x17'),_0x3b7797);_0x59094e(_0x3b7797);});_0x4b644a[_0x4a26('0x18')](_0x4613c3);})['on']('error',function(_0x59d5d3){logger[_0x4a26('0x10')](_0x59d5d3);_0x59094e(_0x59d5d3);})[_0x4a26('0x19')]();});}function uploadFile(_0x18850e){return new BPromise(function(_0x5e739d,_0xf27d1c){var _0x55a075=urlParse(_0x18850e);var _0x337a3f=_0x55a075[_0x4a26('0x1a')]==='https:'?https:http;var _0x4f5ec3={'host':_0x55a075['host'],'path':_0x55a075[_0x4a26('0x0')],'headers':{'user-agent':_0x4a26('0x1b')}};_0x337a3f[_0x4a26('0x1c')](_0x4f5ec3,function(_0x352618){if(_0x352618[_0x4a26('0xf')]!==0xc8){_0xf27d1c(new Error('request\x20to\x20'+_0x18850e+_0x4a26('0x12')+_0x352618[_0x4a26('0xf')]+'\x20('+_0x352618['statusMessage']+')'));return;}var _0x2b9f2b='';_0x352618['on'](_0x4a26('0x1d'),function(_0x570a58){_0x2b9f2b+=_0x570a58;});_0x352618['on']('end',function(){_0x5e739d(_0x2b9f2b);});})['on']('error',function(_0x3a4389){_0xf27d1c(_0x3a4389);})[_0x4a26('0x19')]();});}function convertFile(_0x34f79a,_0x46ac44){return new BPromise(function(_0x1228a3,_0x504d3d){var _0x54aa6c=sox[_0x4a26('0x1e')](_0x34f79a,_0x46ac44,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x54aa6c['on'](_0x4a26('0x10'),function(_0x257751){logger[_0x4a26('0x10')](_0x4a26('0x1f'),_0x257751);_0x504d3d(_0x257751);});_0x54aa6c['on'](_0x4a26('0x19'),function(){logger[_0x4a26('0x14')]('finish\x20to\x20convert');_0x1228a3();});_0x54aa6c[_0x4a26('0x20')]();});}function base64Encode(_0x34d6e8){var _0x4dd180=fs['readFileSync'](_0x34d6e8);return new Buffer(_0x4dd180)[_0x4a26('0x21')](_0x4a26('0x22'));}exports['googleTTS']=function(_0x166f4a,_0x48936d){var _0x2f18f8,_0xf4524;return tts(_0x166f4a,_0x48936d||'en',0x1)[_0x4a26('0x23')](function(_0xd93cdc){logger['info'](_0xd93cdc);_0x2f18f8=path[_0x4a26('0x24')](__dirname,_0x4a26('0x25'),rs['generate'](0x4)+'.mp3');return downloadFile(_0xd93cdc,_0x2f18f8);})[_0x4a26('0x23')](function(){_0xf4524=path[_0x4a26('0x24')](__dirname,_0x4a26('0x25'),rs[_0x4a26('0x26')](0x4)+_0x4a26('0x27'));return convertFile(_0x2f18f8,_0xf4524);})[_0x4a26('0x23')](function(){try{fs[_0x4a26('0x28')](_0x2f18f8);fs[_0x4a26('0x29')](_0xf4524,_0x4a26('0x2a'));}catch(_0x173625){logger[_0x4a26('0x10')](_0x173625);}logger['info']('goggleTTS\x20path',_0xf4524[_0x4a26('0x2b')]('.')[0x0]);return _0xf4524[_0x4a26('0x2b')]('.')[0x0];});};exports[_0x4a26('0x2c')]=function(_0x252240,_0x13157d,_0x19c7c8){return google['asr'](_0x252240,_0x13157d,_0x19c7c8)[_0x4a26('0x23')](function(_0x25a178){logger[_0x4a26('0x14')](_0x25a178[_0x4a26('0x2d')]);return rp(_0x25a178);})['then'](function(_0x7017a0){var _0x9daff0='';var _0x50552f=0x0;try{fs[_0x4a26('0x28')](_0x252240);}catch(_0x2ffb53){logger[_0x4a26('0x10')](_0x2ffb53);}if(_0x7017a0&&_0x7017a0[_0x4a26('0x2e')]){_0x9daff0=_0x7017a0['results'][_0x4a26('0x2f')](function(_0x1bae19){return _0x1bae19&&_0x1bae19[_0x4a26('0x30')][0x0]&&_0x1bae19[_0x4a26('0x30')][0x0][_0x4a26('0x31')]?_0x1bae19[_0x4a26('0x30')][0x0]['transcript']:'';})[_0x4a26('0x32')]('\x0a');_0x50552f=_0x7017a0[_0x4a26('0x2e')][_0x4a26('0x2f')](function(_0x25d686){return _0x25d686&&_0x25d686[_0x4a26('0x30')][0x0]&&_0x25d686[_0x4a26('0x30')][0x0][_0x4a26('0x33')]?_0x25d686[_0x4a26('0x30')][0x0][_0x4a26('0x33')]:0x0;})[_0x4a26('0x32')]('\x0a');}logger['info']('googleASR\x20transcription',_0x9daff0);logger[_0x4a26('0x14')](_0x4a26('0x34'),_0x50552f);return{'transcript':_0x9daff0,'confidence':_0x50552f};})[_0x4a26('0x35')](function(_0x415d81){logger['error']('[%s]\x20%s:%s',_0x415d81[_0x4a26('0xf')],_0x415d81[_0x4a26('0x36')],_0x415d81[_0x4a26('0x37')]);});};exports[_0x4a26('0x38')]=function(_0x2c37e5,_0x5f1655,_0x424a29,_0x163f49){var _0x525b6e=apiai(_0x5f1655,{'language':_0x163f49||'en'});return _0x525b6e[_0x4a26('0x39')](_0x424a29,{'sessionId':_0x2c37e5})['then'](function(_0xf372d2){logger[_0x4a26('0x14')](JSON['stringify'](_0xf372d2));return{'source':_0xf372d2['result'][_0x4a26('0x3a')],'resolvedQuery':_0xf372d2['result'][_0x4a26('0x3b')],'action':_0xf372d2[_0x4a26('0x3c')]['action'],'actionIncomplete':_0xf372d2[_0x4a26('0x3c')]['actionIncomplete'],'speech':_0xf372d2[_0x4a26('0x3c')]['fulfillment']['speech'],'score':_0xf372d2['result'][_0x4a26('0x3d')],'statusCode':_0xf372d2['status'][_0x4a26('0x3e')]};});};exports[_0x4a26('0x3f')]=function(_0x1e72ee,_0x4cdcd2,_0x5c71af,_0x298c58){return tilde[_0x4a26('0x40')](_0x1e72ee,_0x4cdcd2,_0x5c71af,_0x298c58)[_0x4a26('0x23')](function(_0x18fc0a){try{fs[_0x4a26('0x28')](_0x1e72ee);}catch(_0xbbd021){logger['error'](_0xbbd021);}logger[_0x4a26('0x14')]('Tilde\x20ASR\x20transcription',_0x18fc0a[_0x4a26('0x31')]);logger[_0x4a26('0x14')]('Tilde\x20ASR\x20confidence',_0x18fc0a[_0x4a26('0x33')]);return _0x18fc0a;});};exports[_0x4a26('0x41')]=function(_0x4476af,_0x3d8314,_0xdbf4b9,_0x48770f,_0x41801f,_0xf9eb9d){var _0x45f008=path[_0x4a26('0x24')](__dirname,_0x4a26('0x25'),rs[_0x4a26('0x26')](0x4)+_0x4a26('0x42'));var _0x9ed8a7;return aws['polly'](_0x4476af,_0x3d8314,_0xdbf4b9,_0x48770f,_0x41801f,_0xf9eb9d,_0x45f008)[_0x4a26('0x23')](function(){_0x9ed8a7=path[_0x4a26('0x24')](__dirname,'tmp',rs[_0x4a26('0x26')](0x4)+'.wav');return convertFile(_0x45f008,_0x9ed8a7);})[_0x4a26('0x23')](function(){try{fs['unlink'](_0x45f008);fs[_0x4a26('0x29')](_0x9ed8a7,_0x4a26('0x2a'));}catch(_0x317ef5){logger[_0x4a26('0x10')](_0x317ef5);}return _0x9ed8a7[_0x4a26('0x2b')]('.')[0x0];});};exports['ispeechTTS']=function(_0x1cc7d2,_0x7ee46f,_0x20f8b1,_0x55fa0c){var _0x2215ce=util[_0x4a26('0x43')](_0x4a26('0x44'),ISPEECH_API,_0x1cc7d2,encodeURIComponent(_0x7ee46f),_0x20f8b1,_0x55fa0c);var _0x209957=path[_0x4a26('0x24')](__dirname,_0x4a26('0x25'),rs[_0x4a26('0x26')](0x4)+_0x4a26('0x42'));var _0x2304a5;return downloadFile(_0x2215ce,_0x209957)[_0x4a26('0x23')](function(){_0x2304a5=path['resolve'](__dirname,_0x4a26('0x25'),rs[_0x4a26('0x26')](0x4)+_0x4a26('0x27'));return convertFile(_0x209957,_0x2304a5);})[_0x4a26('0x23')](function(){try{fs[_0x4a26('0x28')](_0x209957);fs[_0x4a26('0x29')](_0x2304a5,'777');}catch(_0x483256){logger[_0x4a26('0x10')](_0x483256);}return _0x2304a5[_0x4a26('0x2b')]('.')[0x0];});};exports[_0x4a26('0x45')]=function(_0x3ecf7b,_0xaea15d,_0x12afdf,_0x52646f){var _0x52963d=util[_0x4a26('0x43')](_0x4a26('0x46'),ISPEECH_API,_0xaea15d,_0x12afdf,base64Encode(_0x3ecf7b),_0x52646f?util[_0x4a26('0x43')](_0x4a26('0x47'),encodeURIComponent(_0x52646f)):_0x4a26('0x48'));return uploadFile(_0x52963d)[_0x4a26('0x23')](function(_0x166496){return querystring['parse'](_0x166496);});};exports[_0x4a26('0x49')]=function(){return __dirname;}; \ No newline at end of file +var _0x00fe=['error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','end','https:','transcode','wav','error\x20convert','finish\x20to\x20convert','start','readFileSync','toString','base64','googleTTS','then','resolve','tmp','generate','.wav','chmodSync','777','split','googleASR','asr','results','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','textRequest','stringify','source','result','resolvedQuery','action','actionIncomplete','fulfillment','score','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','.mp3','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','path','http','https','url','parse','bluebird','randomstring','util','querystring','moment','google-tts-api','./aws','./tilde','https://api.ispeech.org/api/rest','protocol','WHAT_EVER','get','statusCode'];(function(_0x29e2c3,_0xf029fb){var _0x24997a=function(_0x16effd){while(--_0x16effd){_0x29e2c3['push'](_0x29e2c3['shift']());}};_0x24997a(++_0xf029fb);}(_0x00fe,0x1e0));var _0xe00f=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0x00fe[_0x4914e2];return _0x2dcd07;};'use strict';var fs=require('fs');var path=require(_0xe00f('0x0'));var http=require(_0xe00f('0x1'));var https=require(_0xe00f('0x2'));var urlParse=require(_0xe00f('0x3'))[_0xe00f('0x4')];var BPromise=require(_0xe00f('0x5'));var rs=require(_0xe00f('0x6'));var sox=require('sox');var rp=require('request-promise');var util=require(_0xe00f('0x7'));var querystring=require(_0xe00f('0x8'));var moment=require(_0xe00f('0x9'));var tts=require(_0xe00f('0xa'));var apiai=require('apiai-promise');var google=require('./google');var aws=require(_0xe00f('0xb'));var tilde=require(_0xe00f('0xc'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0xe00f('0xd');function downloadFile(_0x490f4c,_0x13ddd7){return new BPromise(function(_0x572e47,_0x4f7f73){var _0x5cbea7=urlParse(_0x490f4c);var _0x22d24a=_0x5cbea7[_0xe00f('0xe')]==='https:'?https:http;var _0x51cedc={'host':_0x5cbea7['host'],'path':_0x5cbea7[_0xe00f('0x0')],'headers':{'user-agent':_0xe00f('0xf')}};_0x22d24a[_0xe00f('0x10')](_0x51cedc,function(_0x160425){if(_0x160425[_0xe00f('0x11')]!==0xc8){logger[_0xe00f('0x12')](_0xe00f('0x13')+_0x490f4c+_0xe00f('0x14')+_0x160425[_0xe00f('0x11')]+'\x20('+_0x160425[_0xe00f('0x15')]+')');_0x4f7f73(new Error(_0xe00f('0x13')+_0x490f4c+_0xe00f('0x14')+_0x160425['statusCode']+'\x20('+_0x160425[_0xe00f('0x15')]+')'));return;}var _0x470d32=fs[_0xe00f('0x16')](_0x13ddd7);_0x470d32['on'](_0xe00f('0x17'),function(){logger[_0xe00f('0x18')](_0xe00f('0x19'));_0x470d32[_0xe00f('0x1a')](_0x572e47);});_0x470d32['on']('error',function(_0x3de913){fs[_0xe00f('0x1b')](_0x13ddd7);logger[_0xe00f('0x12')](_0xe00f('0x1c'),_0x3de913);_0x4f7f73(_0x3de913);});_0x160425['pipe'](_0x470d32);})['on']('error',function(_0x174ca9){logger[_0xe00f('0x12')](_0x174ca9);_0x4f7f73(_0x174ca9);})[_0xe00f('0x1d')]();});}function uploadFile(_0x261bb9){return new BPromise(function(_0x266cd5,_0x19c549){var _0x2d195a=urlParse(_0x261bb9);var _0x408726=_0x2d195a[_0xe00f('0xe')]===_0xe00f('0x1e')?https:http;var _0x436b66={'host':_0x2d195a['host'],'path':_0x2d195a[_0xe00f('0x0')],'headers':{'user-agent':_0xe00f('0xf')}};_0x408726['get'](_0x436b66,function(_0x15a1fc){if(_0x15a1fc[_0xe00f('0x11')]!==0xc8){_0x19c549(new Error(_0xe00f('0x13')+_0x261bb9+'\x20failed,\x20status\x20code\x20=\x20'+_0x15a1fc['statusCode']+'\x20('+_0x15a1fc[_0xe00f('0x15')]+')'));return;}var _0x1a35ed='';_0x15a1fc['on']('data',function(_0x5cab6f){_0x1a35ed+=_0x5cab6f;});_0x15a1fc['on'](_0xe00f('0x1d'),function(){_0x266cd5(_0x1a35ed);});})['on'](_0xe00f('0x12'),function(_0x39ec46){_0x19c549(_0x39ec46);})[_0xe00f('0x1d')]();});}function convertFile(_0x452e35,_0x1c4ad9){return new BPromise(function(_0x4540e1,_0x236c21){var _0x1ad716=sox[_0xe00f('0x1f')](_0x452e35,_0x1c4ad9,{'sampleRate':0x1f40,'format':_0xe00f('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1ad716['on']('error',function(_0xa57a8e){logger[_0xe00f('0x12')](_0xe00f('0x21'),_0xa57a8e);_0x236c21(_0xa57a8e);});_0x1ad716['on']('end',function(){logger['info'](_0xe00f('0x22'));_0x4540e1();});_0x1ad716[_0xe00f('0x23')]();});}function base64Encode(_0x226a31){var _0x2d32a0=fs[_0xe00f('0x24')](_0x226a31);return new Buffer(_0x2d32a0)[_0xe00f('0x25')](_0xe00f('0x26'));}exports[_0xe00f('0x27')]=function(_0x115902,_0x3621c1){var _0x207e45,_0x14c7cf;return tts(_0x115902,_0x3621c1||'en',0x1)[_0xe00f('0x28')](function(_0x30f966){logger['info'](_0x30f966);_0x207e45=path[_0xe00f('0x29')](__dirname,_0xe00f('0x2a'),rs['generate'](0x4)+'.mp3');return downloadFile(_0x30f966,_0x207e45);})[_0xe00f('0x28')](function(){_0x14c7cf=path[_0xe00f('0x29')](__dirname,'tmp',rs[_0xe00f('0x2b')](0x4)+_0xe00f('0x2c'));return convertFile(_0x207e45,_0x14c7cf);})[_0xe00f('0x28')](function(){try{fs[_0xe00f('0x1b')](_0x207e45);fs[_0xe00f('0x2d')](_0x14c7cf,_0xe00f('0x2e'));}catch(_0x2c5d49){logger[_0xe00f('0x12')](_0x2c5d49);}logger[_0xe00f('0x18')]('goggleTTS\x20path',_0x14c7cf[_0xe00f('0x2f')]('.')[0x0]);return _0x14c7cf['split']('.')[0x0];});};exports[_0xe00f('0x30')]=function(_0x4bdcee,_0x4d4be6,_0x1c65b5){return google[_0xe00f('0x31')](_0x4bdcee,_0x4d4be6,_0x1c65b5)[_0xe00f('0x28')](function(_0x550a27){logger[_0xe00f('0x18')](_0x550a27['uri']);return rp(_0x550a27);})[_0xe00f('0x28')](function(_0x3b2c80){var _0x5adfbc='';var _0x447f4a=0x0;try{fs[_0xe00f('0x1b')](_0x4bdcee);}catch(_0x262a95){logger[_0xe00f('0x12')](_0x262a95);}if(_0x3b2c80&&_0x3b2c80[_0xe00f('0x32')]){_0x5adfbc=_0x3b2c80[_0xe00f('0x32')]['map'](function(_0x311bdd){return _0x311bdd&&_0x311bdd[_0xe00f('0x33')][0x0]&&_0x311bdd[_0xe00f('0x33')][0x0][_0xe00f('0x34')]?_0x311bdd['alternatives'][0x0][_0xe00f('0x34')]:'';})[_0xe00f('0x35')]('\x0a');_0x447f4a=_0x3b2c80[_0xe00f('0x32')]['map'](function(_0x419ec7){return _0x419ec7&&_0x419ec7['alternatives'][0x0]&&_0x419ec7[_0xe00f('0x33')][0x0]['confidence']?_0x419ec7[_0xe00f('0x33')][0x0][_0xe00f('0x36')]:0x0;})[_0xe00f('0x35')]('\x0a');}logger[_0xe00f('0x18')](_0xe00f('0x37'),_0x5adfbc);logger['info'](_0xe00f('0x38'),_0x447f4a);return{'transcript':_0x5adfbc,'confidence':_0x447f4a};})[_0xe00f('0x39')](function(_0x548b97){logger[_0xe00f('0x12')]('[%s]\x20%s:%s',_0x548b97[_0xe00f('0x11')],_0x548b97[_0xe00f('0x3a')],_0x548b97[_0xe00f('0x3b')]);});};exports['googleDialogflow']=function(_0x10f507,_0x40e702,_0x337ef4,_0x47b2db){var _0x394c4a=apiai(_0x40e702,{'language':_0x47b2db||'en'});return _0x394c4a[_0xe00f('0x3c')](_0x337ef4,{'sessionId':_0x10f507})[_0xe00f('0x28')](function(_0x409dd7){logger[_0xe00f('0x18')](JSON[_0xe00f('0x3d')](_0x409dd7));return{'source':_0x409dd7['result'][_0xe00f('0x3e')],'resolvedQuery':_0x409dd7[_0xe00f('0x3f')][_0xe00f('0x40')],'action':_0x409dd7['result'][_0xe00f('0x41')],'actionIncomplete':_0x409dd7[_0xe00f('0x3f')][_0xe00f('0x42')],'speech':_0x409dd7[_0xe00f('0x3f')][_0xe00f('0x43')]['speech'],'score':_0x409dd7[_0xe00f('0x3f')][_0xe00f('0x44')],'statusCode':_0x409dd7['status']['code']};});};exports[_0xe00f('0x45')]=function(_0xe619a7,_0x4f3261,_0x575deb,_0x4726ff){return tilde[_0xe00f('0x31')](_0xe619a7,_0x4f3261,_0x575deb,_0x4726ff)['then'](function(_0x49a8f3){try{fs[_0xe00f('0x1b')](_0xe619a7);}catch(_0x42a139){logger[_0xe00f('0x12')](_0x42a139);}logger[_0xe00f('0x18')](_0xe00f('0x46'),_0x49a8f3['transcript']);logger['info'](_0xe00f('0x47'),_0x49a8f3[_0xe00f('0x36')]);return _0x49a8f3;});};exports[_0xe00f('0x48')]=function(_0x88f535,_0x797f70,_0x5d86a4,_0x36e9c9,_0x3f5d55,_0x23b3cf){var _0x272d10=path[_0xe00f('0x29')](__dirname,_0xe00f('0x2a'),rs['generate'](0x4)+_0xe00f('0x49'));var _0x2148f1;return aws[_0xe00f('0x4a')](_0x88f535,_0x797f70,_0x5d86a4,_0x36e9c9,_0x3f5d55,_0x23b3cf,_0x272d10)[_0xe00f('0x28')](function(){_0x2148f1=path[_0xe00f('0x29')](__dirname,_0xe00f('0x2a'),rs[_0xe00f('0x2b')](0x4)+_0xe00f('0x2c'));return convertFile(_0x272d10,_0x2148f1);})[_0xe00f('0x28')](function(){try{fs[_0xe00f('0x1b')](_0x272d10);fs[_0xe00f('0x2d')](_0x2148f1,'777');}catch(_0x2150ec){logger[_0xe00f('0x12')](_0x2150ec);}return _0x2148f1['split']('.')[0x0];});};exports[_0xe00f('0x4b')]=function(_0x20ca5c,_0x254d5b,_0x40809a,_0x23682c){var _0x2dd862=util[_0xe00f('0x4c')](_0xe00f('0x4d'),ISPEECH_API,_0x20ca5c,encodeURIComponent(_0x254d5b),_0x40809a,_0x23682c);var _0x40aafa=path['resolve'](__dirname,_0xe00f('0x2a'),rs[_0xe00f('0x2b')](0x4)+_0xe00f('0x49'));var _0xde31ee;return downloadFile(_0x2dd862,_0x40aafa)[_0xe00f('0x28')](function(){_0xde31ee=path['resolve'](__dirname,_0xe00f('0x2a'),rs[_0xe00f('0x2b')](0x4)+_0xe00f('0x2c'));return convertFile(_0x40aafa,_0xde31ee);})[_0xe00f('0x28')](function(){try{fs[_0xe00f('0x1b')](_0x40aafa);fs[_0xe00f('0x2d')](_0xde31ee,_0xe00f('0x2e'));}catch(_0x3e69bb){logger[_0xe00f('0x12')](_0x3e69bb);}return _0xde31ee[_0xe00f('0x2f')]('.')[0x0];});};exports[_0xe00f('0x4e')]=function(_0x33fa81,_0x3e1c89,_0x49b89a,_0x3859f7){var _0x5b4227=util[_0xe00f('0x4c')](_0xe00f('0x4f'),ISPEECH_API,_0x3e1c89,_0x49b89a,base64Encode(_0x33fa81),_0x3859f7?util[_0xe00f('0x4c')](_0xe00f('0x50'),encodeURIComponent(_0x3859f7)):_0xe00f('0x51'));return uploadFile(_0x5b4227)['then'](function(_0x4850e0){return querystring[_0xe00f('0x4')](_0x4850e0);});};exports[_0xe00f('0x52')]=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 0b20a02..05d555c 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 _0x9d60=['exports'];(function(_0x4c7a3e,_0x27d7bf){var _0x2b80ed=function(_0x3bb14a){while(--_0x3bb14a){_0x4c7a3e['push'](_0x4c7a3e['shift']());}};_0x2b80ed(++_0x27d7bf);}(_0x9d60,0x7e));var _0x09d6=function(_0x478c8a,_0x9afc92){_0x478c8a=_0x478c8a-0x0;var _0x3b6b3e=_0x9d60[_0x478c8a];return _0x3b6b3e;};'use strict';var asr=require('./lib/api');module[_0x09d6('0x0')]=function(_0x2aad2f,_0x533a44,_0x11dd89,_0x2fb832){return asr(_0x2aad2f,_0x533a44,_0x11dd89,_0x2fb832);}; \ No newline at end of file +var _0x7ee6=['exports','./lib/api'];(function(_0x29d497,_0x54f868){var _0x1fdb55=function(_0x564080){while(--_0x564080){_0x29d497['push'](_0x29d497['shift']());}};_0x1fdb55(++_0x54f868);}(_0x7ee6,0x13f));var _0x67ee=function(_0x2ad2f0,_0x222045){_0x2ad2f0=_0x2ad2f0-0x0;var _0x142629=_0x7ee6[_0x2ad2f0];return _0x142629;};'use strict';var asr=require(_0x67ee('0x0'));module[_0x67ee('0x1')]=function(_0x21789b,_0x3bf833,_0x243944,_0x95a40a){return asr(_0x21789b,_0x3bf833,_0x243944,_0x95a40a);}; \ 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 635610e..d031a4a 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 _0x8140=['wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','EOS','Tilde\x20ASR\x20send\x20error','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','open','message','close','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info'];(function(_0x3ff9bc,_0x454197){var _0x5c2db4=function(_0xc8d9e5){while(--_0xc8d9e5){_0x3ff9bc['push'](_0x3ff9bc['shift']());}};_0x5c2db4(++_0x454197);}(_0x8140,0x109));var _0x0814=function(_0x5c5dc3,_0x265cd5){_0x5c5dc3=_0x5c5dc3-0x0;var _0x1fa8ed=_0x8140[_0x5c5dc3];return _0x1fa8ed;};'use strict';var BPromise=require(_0x0814('0x0'));var _=require(_0x0814('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x0814('0x2'));var crypto=require(_0x0814('0x3'));var logger=require(_0x0814('0x4'))(_0x0814('0x5'));module[_0x0814('0x6')]=function(_0x322a1a,_0x355ee2,_0x356670,_0x2412fa){return new BPromise(function(_0x28cb0a,_0x1fec2b){logger[_0x0814('0x7')]('Tilde\x20URI',_0x2412fa||_0x0814('0x8'));var _0x1cc434=new WebSocket(_0x2412fa||_0x0814('0x8'),{'perMessageDeflate':![]});var _0xdc2ae6='';var _0x52d7d3='0';var _0x5ab067='1';var _0x3e5cc9=_0x0814('0x9');function _0x4b5755(_0x1d9e86){var _0x271792=crypto[_0x0814('0xa')](_0x0814('0xb'));_0x271792[_0x0814('0xc')](_0x1d9e86);return _0x271792['digest'](_0x0814('0xd'));}function _0xa6b531(){try{logger['info'](_0x0814('0xe'));var _0x399479=moment()[_0x0814('0xf')]();var _0x54deb4=_0x4b5755(_0x399479+_0x355ee2+_0x356670);_0x1cc434[_0x0814('0x10')](JSON[_0x0814('0x11')]({'appID':_0x355ee2,'timestamp':_0x399479,'appKey':_0x54deb4}));var _0x4518a8=fs['createReadStream'](_0x322a1a);_0x4518a8['on'](_0x0814('0x12'),function(_0x5829b6){_0x1cc434['send'](_0x5829b6);});_0x4518a8['on']('close',function(){_0x1cc434[_0x0814('0x10')](_0x0814('0x13'));});}catch(_0x5bd0cf){logger['error'](_0x0814('0x14'),JSON[_0x0814('0x11')](_0x5bd0cf));_0x1cc434[_0x0814('0x15')]();}}function _0x59ae74(_0xd28a8b){try{if(_0xd28a8b){var _0x3d69ba=JSON['parse'](_0xd28a8b);switch(_0x3d69ba[_0x0814('0x16')]){case 0x0:if(_0x3d69ba[_0x0814('0x17')]){if(_0x3d69ba[_0x0814('0x17')][_0x0814('0x18')]){logger['info'](_0x0814('0x19'),JSON[_0x0814('0x11')](_0x3d69ba[_0x0814('0x17')][_0x0814('0x1a')]));_0xdc2ae6=_0x3d69ba['result'][_0x0814('0x1a')][0x0]['transcript'];_0x52d7d3=_0x3d69ba[_0x0814('0x17')][_0x0814('0x1a')][0x0][_0x0814('0x1b')];_0x5ab067='0';_0x3e5cc9='Success.';_0x1cc434['terminate']();}}break;case 0x1:logger[_0x0814('0x7')](_0x0814('0x9'));_0x5ab067='1';_0x3e5cc9=_0x0814('0x9');break;case 0x2:logger[_0x0814('0x7')](_0x0814('0x1c'));_0x5ab067='2';_0x3e5cc9=_0x0814('0x1c');break;case 0x9:logger[_0x0814('0x7')](_0x0814('0x1d'));_0x5ab067='9';_0x3e5cc9=_0x0814('0x1d');break;case 0xa:logger[_0x0814('0x7')](_0x0814('0x1e'));_0x5ab067='10';_0x3e5cc9=_0x0814('0x1e');break;case 0xb:logger[_0x0814('0x7')](_0x0814('0x1f'));_0x5ab067='11';_0x3e5cc9=_0x0814('0x1f');}}}catch(_0x310e1d){logger[_0x0814('0x20')](_0x0814('0x21'),JSON[_0x0814('0x11')](_0x310e1d));_0x1cc434[_0x0814('0x15')]();}}function _0x2c9c71(){logger[_0x0814('0x7')](_0x0814('0x22'));_0x28cb0a({'transcript':_0xdc2ae6,'confidence':_0x52d7d3,'status':_0x5ab067,'status_message':_0x3e5cc9});}function _0x5ad504(_0x5b6f52){logger['error'](_0x0814('0x23'));if(!_['isNil'](_0x5b6f52)){logger['error'](_['isObject'](_0x5b6f52)?JSON['stringify'](_0x5b6f52):_0x5b6f52);}}_0x1cc434['on'](_0x0814('0x24'),_0xa6b531);_0x1cc434['on'](_0x0814('0x25'),_0x59ae74);_0x1cc434['on'](_0x0814('0x26'),_0x2c9c71);_0x1cc434['on']('error',_0x5ad504);});}; \ No newline at end of file +var _0x7f68=['Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','lodash','crypto','../../../../../../config/logger','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','transcript','hypotheses'];(function(_0xf3045b,_0x59987b){var _0x2d0959=function(_0x5c2a43){while(--_0x5c2a43){_0xf3045b['push'](_0xf3045b['shift']());}};_0x2d0959(++_0x59987b);}(_0x7f68,0x7a));var _0x87f6=function(_0x24e64a,_0x22af59){_0x24e64a=_0x24e64a-0x0;var _0x3827d2=_0x7f68[_0x24e64a];return _0x3827d2;};'use strict';var BPromise=require(_0x87f6('0x0'));var _=require(_0x87f6('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x87f6('0x2'));var logger=require(_0x87f6('0x3'))('agi');module[_0x87f6('0x4')]=function(_0x42cfc5,_0x42c32f,_0x318fcf,_0x1d0295){return new BPromise(function(_0x4559dd,_0x57725e){logger[_0x87f6('0x5')]('Tilde\x20URI',_0x1d0295||_0x87f6('0x6'));var _0x47ae44=new WebSocket(_0x1d0295||_0x87f6('0x6'),{'perMessageDeflate':![]});var _0x5a41d9='';var _0x3cdc6d='0';var _0x7069b7='1';var _0x5af002=_0x87f6('0x7');function _0x276cff(_0x2ea486){var _0x1242ea=crypto[_0x87f6('0x8')](_0x87f6('0x9'));_0x1242ea[_0x87f6('0xa')](_0x2ea486);return _0x1242ea[_0x87f6('0xb')](_0x87f6('0xc'));}function _0x5cda2c(){try{logger[_0x87f6('0x5')](_0x87f6('0xd'));var _0x5325c3=moment()[_0x87f6('0xe')]();var _0x282b42=_0x276cff(_0x5325c3+_0x42c32f+_0x318fcf);_0x47ae44[_0x87f6('0xf')](JSON[_0x87f6('0x10')]({'appID':_0x42c32f,'timestamp':_0x5325c3,'appKey':_0x282b42}));var _0x4aed20=fs['createReadStream'](_0x42cfc5);_0x4aed20['on'](_0x87f6('0x11'),function(_0x26c455){_0x47ae44['send'](_0x26c455);});_0x4aed20['on'](_0x87f6('0x12'),function(){_0x47ae44[_0x87f6('0xf')](_0x87f6('0x13'));});}catch(_0xa07661){logger[_0x87f6('0x14')](_0x87f6('0x15'),JSON[_0x87f6('0x10')](_0xa07661));_0x47ae44[_0x87f6('0x16')]();}}function _0x30fc09(_0x103828){try{if(_0x103828){var _0xf0e37c=JSON[_0x87f6('0x17')](_0x103828);switch(_0xf0e37c[_0x87f6('0x18')]){case 0x0:if(_0xf0e37c[_0x87f6('0x19')]){if(_0xf0e37c[_0x87f6('0x19')][_0x87f6('0x1a')]){logger[_0x87f6('0x5')](_0x87f6('0x1b'),JSON[_0x87f6('0x10')](_0xf0e37c[_0x87f6('0x19')]['hypotheses']));_0x5a41d9=_0xf0e37c['result']['hypotheses'][0x0][_0x87f6('0x1c')];_0x3cdc6d=_0xf0e37c['result'][_0x87f6('0x1d')][0x0]['likelihood'];_0x7069b7='0';_0x5af002='Success.';_0x47ae44['terminate']();}}break;case 0x1:logger[_0x87f6('0x5')](_0x87f6('0x7'));_0x7069b7='1';_0x5af002='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x87f6('0x5')](_0x87f6('0x1e'));_0x7069b7='2';_0x5af002=_0x87f6('0x1e');break;case 0x9:logger['info'](_0x87f6('0x1f'));_0x7069b7='9';_0x5af002=_0x87f6('0x1f');break;case 0xa:logger[_0x87f6('0x5')]('Authentication\x20failed.');_0x7069b7='10';_0x5af002='Authentication\x20failed.';break;case 0xb:logger[_0x87f6('0x5')](_0x87f6('0x20'));_0x7069b7='11';_0x5af002=_0x87f6('0x20');}}}catch(_0x505d0f){logger[_0x87f6('0x14')](_0x87f6('0x21'),JSON[_0x87f6('0x10')](_0x505d0f));_0x47ae44['terminate']();}}function _0x35507b(){logger[_0x87f6('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x4559dd({'transcript':_0x5a41d9,'confidence':_0x3cdc6d,'status':_0x7069b7,'status_message':_0x5af002});}function _0x2f9456(_0x48c9bf){logger[_0x87f6('0x14')](_0x87f6('0x22'));if(!_[_0x87f6('0x23')](_0x48c9bf)){logger[_0x87f6('0x14')](_[_0x87f6('0x24')](_0x48c9bf)?JSON['stringify'](_0x48c9bf):_0x48c9bf);}}_0x47ae44['on']('open',_0x5cda2c);_0x47ae44['on'](_0x87f6('0x25'),_0x30fc09);_0x47ae44['on'](_0x87f6('0x12'),_0x35507b);_0x47ae44['on']('error',_0x2f9456);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/index.js b/server/services/agi/scripts/tilde/index.js index cbba8b5..35e344d 100644 --- a/server/services/agi/scripts/tilde/index.js +++ b/server/services/agi/scripts/tilde/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['./asr','exports'];(function(_0x3a6eba,_0x7db8ac){var _0x531c0a=function(_0x349132){while(--_0x349132){_0x3a6eba['push'](_0x3a6eba['shift']());}};_0x531c0a(++_0x7db8ac);}(_0x34e8,0x12c));var _0x834e=function(_0x3817c8,_0x541701){_0x3817c8=_0x3817c8-0x0;var _0x3e4ff1=_0x34e8[_0x3817c8];return _0x3e4ff1;};var asr=require(_0x834e('0x0'));module[_0x834e('0x1')]={'asr':asr}; \ No newline at end of file +var _0x34e8=['./asr','exports'];(function(_0x21bfab,_0x2fee48){var _0x4db318=function(_0x10396d){while(--_0x10396d){_0x21bfab['push'](_0x21bfab['shift']());}};_0x4db318(++_0x2fee48);}(_0x34e8,0x12c));var _0x834e=function(_0x3d12c8,_0x5158c8){_0x3d12c8=_0x3d12c8-0x0;var _0x4be050=_0x34e8[_0x3d12c8];return _0x4be050;};var asr=require(_0x834e('0x0'));module[_0x834e('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index c35de1f..9e157fb 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 _0x1e42=['E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','net','events','EventEmitter','./channel','0.0.0.0','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x40e695,_0x366877){var _0x55a70e=function(_0x44cc1c){while(--_0x44cc1c){_0x40e695['push'](_0x40e695['shift']());}};_0x55a70e(++_0x366877);}(_0x1e42,0x91));var _0x21e4=function(_0x33fbae,_0x4c3513){_0x33fbae=_0x33fbae-0x0;var _0x3c47d4=_0x1e42[_0x33fbae];return _0x3c47d4;};'use strict';var util=require('util');var net=require(_0x21e4('0x0'));var EventEmitter=require(_0x21e4('0x1'))[_0x21e4('0x2')];var AGIError=require('./error');var AGIChannel=require(_0x21e4('0x3'));var AGIServer=function(_0x15a424,_0x5333e1,_0xd91615){var _0x594adf=this,_0x15a424=_0x15a424||0x11dd,_0x5333e1=_0x5333e1||_0x21e4('0x4'),_0xc55dac=null,_0x30d5d1=0x0;EventEmitter[_0x21e4('0x5')](_0x594adf);function _0x1252a3(){if(!_0x15a424){_0x594adf[_0x21e4('0x6')](_0x21e4('0x7'),new AGIError(_0x21e4('0x8')));return![];}_0xc55dac=net[_0x21e4('0x9')]();_0xc55dac[_0x21e4('0xa')](_0x15a424,_0x5333e1);_0xc55dac['on'](_0x21e4('0xb'),function(){_0x594adf[_0x21e4('0x6')]('listening');});_0xc55dac['on'](_0x21e4('0xc'),function(_0x34d18b){_0xc55dac['getConnections'](function(_0x903f8,_0x3ab6d2){if(_0x903f8){_0x594adf[_0x21e4('0x6')]('error',new AGIError(_0x21e4('0xd'),_0x903f8));}else if(_0xd91615&&_0xd91615<0x0){_0x594adf['emit'](_0x21e4('0x7'),new AGIError(_0x21e4('0xe')));_0x34d18b[_0x21e4('0xf')]();}else if(_0xd91615&&_0xd91615>0x0&&_0xd91615<_0x3ab6d2){_0x30d5d1+=0x1;_0x594adf[_0x21e4('0x6')](_0x21e4('0x7'),new AGIError(_0x21e4('0x10'),_0x30d5d1));_0x34d18b['destroy']();}else{var _0x40bf10=new AGIChannel(_0x34d18b);_0x40bf10['on'](_0x21e4('0x11'),function(){_0x594adf['emit'](_0x21e4('0xc'),_0x40bf10);});}});});_0xc55dac['on'](_0x21e4('0x7'),function(_0x3b784c){_0x594adf[_0x21e4('0x6')](_0x21e4('0x7'),new AGIError(_0x21e4('0xd'),_0x3b784c[_0x21e4('0x12')]));});_0xc55dac['on'](_0x21e4('0x13'),function(){_0x594adf['emit'](_0x21e4('0x13'),new AGIError(_0x21e4('0x14')));});}process[_0x21e4('0x15')](function(){_0x1252a3();});};util['inherits'](AGIServer,EventEmitter);module[_0x21e4('0x16')]=function(_0x41084a,_0x183d5d,_0x4c4ff2){return new AGIServer(_0x41084a,_0x183d5d,_0x4c4ff2);}; \ No newline at end of file +var _0xac53=['./channel','call','emit','E_AGI_ARGUMENT_PORT','listen','listening','connection','getConnections','error','E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','./error'];(function(_0x2f6b7a,_0x4d208a){var _0x497b67=function(_0x44dbb1){while(--_0x44dbb1){_0x2f6b7a['push'](_0x2f6b7a['shift']());}};_0x497b67(++_0x4d208a);}(_0xac53,0xcb));var _0x3ac5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xac53[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x3ac5('0x0'));var net=require(_0x3ac5('0x1'));var EventEmitter=require(_0x3ac5('0x2'))['EventEmitter'];var AGIError=require(_0x3ac5('0x3'));var AGIChannel=require(_0x3ac5('0x4'));var AGIServer=function(_0x2f4ccb,_0x1c8ec8,_0x2d66bb){var _0x2e03ab=this,_0x2f4ccb=_0x2f4ccb||0x11dd,_0x1c8ec8=_0x1c8ec8||'0.0.0.0',_0xa9e36=null,_0x18b2f7=0x0;EventEmitter[_0x3ac5('0x5')](_0x2e03ab);function _0x1e73d7(){if(!_0x2f4ccb){_0x2e03ab[_0x3ac5('0x6')]('error',new AGIError(_0x3ac5('0x7')));return![];}_0xa9e36=net['createServer']();_0xa9e36[_0x3ac5('0x8')](_0x2f4ccb,_0x1c8ec8);_0xa9e36['on']('listening',function(){_0x2e03ab[_0x3ac5('0x6')](_0x3ac5('0x9'));});_0xa9e36['on'](_0x3ac5('0xa'),function(_0x13b607){_0xa9e36[_0x3ac5('0xb')](function(_0x24c8f6,_0x415180){if(_0x24c8f6){_0x2e03ab[_0x3ac5('0x6')](_0x3ac5('0xc'),new AGIError(_0x3ac5('0xd'),_0x24c8f6));}else if(_0x2d66bb&&_0x2d66bb<0x0){_0x2e03ab[_0x3ac5('0x6')]('error',new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x13b607[_0x3ac5('0xe')]();}else if(_0x2d66bb&&_0x2d66bb>0x0&&_0x2d66bb<_0x415180){_0x18b2f7+=0x1;_0x2e03ab[_0x3ac5('0x6')](_0x3ac5('0xc'),new AGIError(_0x3ac5('0xf'),_0x18b2f7));_0x13b607[_0x3ac5('0xe')]();}else{var _0x590ebd=new AGIChannel(_0x13b607);_0x590ebd['on'](_0x3ac5('0x10'),function(){_0x2e03ab[_0x3ac5('0x6')](_0x3ac5('0xa'),_0x590ebd);});}});});_0xa9e36['on'](_0x3ac5('0xc'),function(_0x33a3e8){_0x2e03ab[_0x3ac5('0x6')](_0x3ac5('0xc'),new AGIError('E_AGI_SERVER_ERROR',_0x33a3e8[_0x3ac5('0x11')]));});_0xa9e36['on'](_0x3ac5('0x12'),function(){_0x2e03ab[_0x3ac5('0x6')](_0x3ac5('0x12'),new AGIError(_0x3ac5('0x13')));});}process[_0x3ac5('0x14')](function(){_0x1e73d7();});};util[_0x3ac5('0x15')](AGIServer,EventEmitter);module[_0x3ac5('0x16')]=function(_0x445592,_0x4709b0,_0x1f5b77){return new AGIServer(_0x445592,_0x4709b0,_0x1f5b77);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index bc89423..51ac431 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 _0x54f4=['prototype','getVariable','then','name','catch','getVoiceQueueById','getSquareProject','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','interval','map','format','getQueryOdbc','error','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','context','priority','accountcode','dnid','file','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','replace','googleTTS','google_tts_language','googleDialogflow','key','text','dialogflow_language','ispeech_tts_language','en-US','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','googleASR','google_asr_language','tildeASR','uri','clear','clone','hasOwnProperty','isString','replaceAllVariables','split','length','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','sync','retry','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','timeout','Wait\x20%s\x20seconds\x20before\x20answer','wait','no\x20list\x20selected','delay','add','callback_priority','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','options','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','DIAL','opts','url','Executed\x20command\x20%s','dialogflow','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','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','maxdigit','test','stringify','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','unlink','.wav','aws\x20Polly\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','%s.%s','NOBEEP','recordFile','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','appsecret','beep','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','gotoif','condition','no\x20condition\x20configured','true','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','false','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeechTTS','ispeech\x20%s\x20file\x20created','login','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','operation','no\x20operation\x20configured','math\x20%s','isArray','%s[%s]','variable\x20%s[key]\x20set','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','no\x20queue\x20selected','queue_id','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','position','QUEUE','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','service','host','port','secure','authentication','pass','template_id','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','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','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','arg_1','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','lodash','shelljs','odbc','randomstring','moment','mustache','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','menu','getdigits','getsecretdigits','channel','rpc','mailRpc'];(function(_0x3a4a66,_0x5afde4){var _0x2bd136=function(_0x3e0b45){while(--_0x3e0b45){_0x3a4a66['push'](_0x3a4a66['shift']());}};_0x2bd136(++_0x5afde4);}(_0x54f4,0x16a));var _0x454f=function(_0x9abeb6,_0x462036){_0x9abeb6=_0x9abeb6-0x0;var _0x85626e=_0x54f4[_0x9abeb6];return _0x85626e;};'use strict';var fs=require('fs');var path=require(_0x454f('0x0'));var util=require('util');var _=require(_0x454f('0x1'));var sh=require(_0x454f('0x2'));var odbc=require(_0x454f('0x3'))();var rs=require(_0x454f('0x4'));var moment=require(_0x454f('0x5'));var Mustache=require(_0x454f('0x6'));var logger=require('../../config/logger')(_0x454f('0x7'));var config=require(_0x454f('0x8'));var scripts=require(_0x454f('0x9'));var FILES_PATH=_0x454f('0xa');var verticesWithRetry=[_0x454f('0xb'),_0x454f('0xc'),_0x454f('0xd')];var AGIVertices=function(_0x5dda35,_0x4da1a0,_0x4c7ca1){this[_0x454f('0xe')]=_0x5dda35;this[_0x454f('0xf')]=_0x4da1a0;this[_0x454f('0x10')]=_0x4c7ca1;};AGIVertices[_0x454f('0x11')][_0x454f('0x12')]=function(_0x1198bb,_0x38135a){this[_0x454f('0xf')]['getVariableById'](_0x1198bb)[_0x454f('0x13')](function(_0x27ce96){_0x38135a(null,_0x27ce96?_0x27ce96[_0x454f('0x14')]:![]);})[_0x454f('0x15')](function(_0x1c49a6){_0x38135a(_0x1c49a6);});};AGIVertices[_0x454f('0x11')]['getVoiceQueue']=function(_0x23fda1,_0x46e2fc){this[_0x454f('0xf')][_0x454f('0x16')](_0x23fda1)['then'](function(_0x5dcd69){_0x46e2fc(null,_0x5dcd69?_0x5dcd69[_0x454f('0x14')]:![]);})[_0x454f('0x15')](function(_0x2cf267){_0x46e2fc(_0x2cf267);});};AGIVertices['prototype'][_0x454f('0x17')]=function(_0x4b0cd0,_0x10e5c8){this[_0x454f('0xf')]['getSquareProjectById'](_0x4b0cd0)[_0x454f('0x13')](function(_0x910483){_0x10e5c8(null,_0x910483?_0x910483[_0x454f('0x14')]:![]);})[_0x454f('0x15')](function(_0x24da11){_0x10e5c8(_0x24da11);});};AGIVertices[_0x454f('0x11')]['getSquareOdbc']=function(_0x49c690,_0x86245c){this[_0x454f('0xf')]['getSquareOdbcById'](_0x49c690)[_0x454f('0x13')](function(_0x1ab893){_0x86245c(null,_0x1ab893?_0x1ab893[_0x454f('0x18')]:![]);})[_0x454f('0x15')](function(_0xedc57f){_0x86245c(_0xedc57f);});};AGIVertices[_0x454f('0x11')][_0x454f('0x19')]=function(_0x26389e,_0x598128){this[_0x454f('0xf')][_0x454f('0x1a')](_0x26389e)[_0x454f('0x13')](function(_0x58e41c){_0x598128(null,_0x58e41c?_0x58e41c[_0x454f('0x14')]:![]);})[_0x454f('0x15')](function(_0x331ed3){_0x598128(_0x331ed3);});};AGIVertices[_0x454f('0x11')][_0x454f('0x1b')]=function(_0xe7a32d,_0x44db42){this[_0x454f('0xf')][_0x454f('0x1c')](_0xe7a32d)['then'](function(_0x4fed97){_0x44db42(null,_0x4fed97?_0x4fed97[_0x454f('0x14')]:![]);})[_0x454f('0x15')](function(_0x5338ec){_0x44db42(_0x5338ec);});};AGIVertices[_0x454f('0x11')][_0x454f('0x1d')]=function(_0xd1906e,_0x17d157){var _0x59b54b=this;this[_0x454f('0xf')][_0x454f('0x1e')](_0xd1906e)[_0x454f('0x13')](function(_0x4aede6){_0x17d157(null,_0x4aede6?_0x59b54b[_0x454f('0x1f')](_0x4aede6[_0x454f('0x20')]):![]);})[_0x454f('0x15')](function(_0x2bc88a){_0x17d157(_0x2bc88a);});};AGIVertices[_0x454f('0x11')][_0x454f('0x21')]=function(_0x26cf65,_0x2e9fa4){this[_0x454f('0xf')]['getMailAccountById'](_0x26cf65)[_0x454f('0x13')](function(_0x5686bc){_0x2e9fa4(null,_0x5686bc?_0x5686bc:![]);})[_0x454f('0x15')](function(_0x251279){_0x2e9fa4(_0x251279);});};AGIVertices[_0x454f('0x11')][_0x454f('0x22')]=function(_0x3d8f5d,_0x25bb69,_0x2e66bf){this['mailRpc']['sendMailMessage'](_0x3d8f5d,_0x25bb69)['then'](function(){_0x2e66bf(null);})[_0x454f('0x15')](function(_0xff76ba){_0x2e66bf(_0xff76ba);});};AGIVertices[_0x454f('0x11')][_0x454f('0x23')]=function(_0x1d49ab,_0xd46c39){this[_0x454f('0xf')][_0x454f('0x24')](_0x1d49ab)[_0x454f('0x13')](function(_0x2c468d){if(_0x2c468d){if(_0x2c468d['IntervalId']){_0xd46c39(null,[_0x2c468d[_0x454f('0x25')]]);}else{_0xd46c39(null,_[_0x454f('0x26')](_0x2c468d['Intervals'],_0x454f('0x25')));}}else{_0xd46c39(null,![]);}})[_0x454f('0x15')](function(_0x35cb4c){_0xd46c39(_0x35cb4c);});};AGIVertices['prototype'][_0x454f('0x1f')]=function(_0x43a798){return util[_0x454f('0x27')]('%s/sounds/converted/%s',FILES_PATH,_0x43a798);};AGIVertices[_0x454f('0x11')][_0x454f('0x28')]=function(_0x35e28d,_0x157196,_0x3a7a35){odbc['open'](_0x35e28d,function(_0xea9f96){if(_0xea9f96){logger[_0x454f('0x29')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0xea9f96);_0x3a7a35(_0xea9f96);}else{logger[_0x454f('0x2a')](_0x454f('0x2b'));odbc['query'](_0x157196,function(_0x52f9b4,_0x5a6ccc){if(_0x52f9b4){logger['info'](_0x454f('0x2c'),_0x157196);_0x3a7a35(_0x52f9b4);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x157196);odbc[_0x454f('0x2d')](function(_0x574c26){if(_0x574c26){logger[_0x454f('0x29')](_0x454f('0x2e'),_0x574c26);}_0x3a7a35(null,_0x5a6ccc);});}});}});};AGIVertices['prototype'][_0x454f('0x2f')]=function(_0x12e0e1,_0x5d3e2a){this[_0x454f('0xf')]['getSmsAccountById'](_0x12e0e1)[_0x454f('0x13')](function(_0xbcccb7){_0x5d3e2a(null,_0xbcccb7?_0xbcccb7:![]);})[_0x454f('0x15')](function(_0x5a02aa){_0x5d3e2a(_0x5a02aa);});};AGIVertices[_0x454f('0x11')][_0x454f('0x30')]=function(_0x40c4c9,_0x3c90fb){this[_0x454f('0xf')][_0x454f('0x30')](_0x40c4c9)[_0x454f('0x13')](function(_0x34559e){_0x3c90fb(null,_0x34559e);})[_0x454f('0x15')](function(_0xa09c1){_0x3c90fb(_0xa09c1);});};AGIVertices[_0x454f('0x11')][_0x454f('0x31')]=function(_0x44842b,_0x99a4d4,_0x173106){this[_0x454f('0xf')][_0x454f('0x31')]({'uniqueid':this[_0x454f('0xe')][_0x454f('0x32')],'node':_0x44842b[_0x454f('0x33')],'application':_0x44842b[_0x454f('0x34')],'data':_0x99a4d4||null,'project_name':this['channel']['arg_1'],'callerid':this[_0x454f('0xe')][_0x454f('0x35')]})[_0x454f('0x13')](function(_0x848ace){_0x173106(null,_0x848ace);})[_0x454f('0x15')](function(_0x513771){_0x173106(_0x513771);});};AGIVertices[_0x454f('0x11')][_0x454f('0x36')]=function(_0x561241,_0x2a01a8,_0x3b7e57,_0x2e98a8){this['rpc']['createSquareRecording']({'uniqueid':this['channel'][_0x454f('0x32')],'callerid':this[_0x454f('0xe')]['callerid'],'calleridname':this[_0x454f('0xe')][_0x454f('0x37')],'context':this[_0x454f('0xe')][_0x454f('0x38')],'extension':this[_0x454f('0xe')]['extension'],'priority':this['channel'][_0x454f('0x39')],'accountcode':this[_0x454f('0xe')][_0x454f('0x3a')],'dnid':this['channel'][_0x454f('0x3b')],'projectName':this[_0x454f('0xe')]['arg_1'],'saveName':_0x2a01a8,'filename':_0x561241[_0x454f('0x3c')]||_0x2a01a8,'savePath':_0x3b7e57})[_0x454f('0x13')](function(_0x423d8b){_0x2e98a8(null,_0x423d8b);})['catch'](function(_0x50c0eb){_0x2e98a8(_0x50c0eb);});};AGIVertices[_0x454f('0x11')][_0x454f('0x3d')]=function(_0x2d34ce,_0x59785f){this[_0x454f('0xf')][_0x454f('0x3d')]({'firstName':_[_0x454f('0x3e')](_0x2d34ce[_0x454f('0x14')])||_[_0x454f('0x3f')](_0x2d34ce['name'])?_0x454f('0x40')+Math[_0x454f('0x41')]():_0x2d34ce['name'],'lastName':_['isEmpty'](_0x2d34ce[_0x454f('0x42')])||_['isNil'](_0x2d34ce[_0x454f('0x42')])?null:_0x2d34ce[_0x454f('0x42')],'phone':_0x2d34ce[_0x454f('0x43')],'ListId':_0x2d34ce[_0x454f('0x44')],'scheduledAt':_0x2d34ce[_0x454f('0x45')],'callbackUniqueid':this['channel'][_0x454f('0x32')],'tags':_0x454f('0x46'),'description':_0x454f('0x47')+_0x2d34ce[_0x454f('0x45')][_0x454f('0x48')](),'priority':_0x2d34ce['callback_priority']})[_0x454f('0x13')](function(_0x562d42){_0x59785f(null,_0x562d42);})[_0x454f('0x15')](function(_0x1a66c4){_0x59785f(_0x1a66c4);});};AGIVertices['prototype'][_0x454f('0x49')]=function(_0x31df00,_0x35f440){this[_0x454f('0xf')][_0x454f('0x4a')](_0x31df00)['then'](function(_0x21e82c){_0x35f440(null,_0x21e82c?_0x21e82c[_0x454f('0x14')]:![]);})[_0x454f('0x15')](function(_0x5ba84c){_0x35f440(_0x5ba84c);});};AGIVertices[_0x454f('0x11')][_0x454f('0x4b')]=function(_0x1e75d9,_0x14d303,_0x2414f6){var _0x3243ca={'role':_0x454f('0x4c')};_0x3243ca[_0x1e75d9]=this[_0x454f('0xe')]['callerid'];this[_0x454f('0xf')]['agentPause'](_0x3243ca,_0x14d303,this[_0x454f('0xe')][_0x454f('0x32')])[_0x454f('0x13')](function(_0x4d7ba0){_0x2414f6(null,_[_0x454f('0x3f')](_0x4d7ba0)?![]:!![]);})['catch'](function(_0x5de15e){logger['error'](_0x5de15e);_0x2414f6(null,![]);});};AGIVertices[_0x454f('0x11')][_0x454f('0x4d')]=function(_0x4b5a67,_0x56aaf3){var _0x52b463={'role':_0x454f('0x4c')};_0x52b463[_0x4b5a67]=this[_0x454f('0xe')][_0x454f('0x35')];this[_0x454f('0xf')][_0x454f('0x4d')](_0x52b463)['then'](function(_0x4b3061){_0x56aaf3(null,_[_0x454f('0x3f')](_0x4b3061)?![]:!![]);})['catch'](function(_0x3f1a42){logger[_0x454f('0x29')](_0x3f1a42);_0x56aaf3(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x275015,_0x13a3b6){var _0x78377={'role':_0x454f('0x4c')};_0x78377[_0x275015]=this[_0x454f('0xe')][_0x454f('0x35')];this[_0x454f('0xf')][_0x454f('0x4e')](_0x78377)[_0x454f('0x13')](function(_0xad716e){_0x13a3b6(null,_[_0x454f('0x3f')](_0xad716e)?![]:!![]);})[_0x454f('0x15')](function(_0x114026){logger[_0x454f('0x29')](_0x114026);_0x13a3b6(null,![]);});};AGIVertices[_0x454f('0x11')]['agentLogin']=function(_0x372565,_0x32276c){var _0x2cf392={'role':_0x454f('0x4c')};_0x2cf392[_0x372565]=this[_0x454f('0xe')][_0x454f('0x35')];var _0x189848=_0x372565!=_0x454f('0x4f')?util[_0x454f('0x27')](_0x454f('0x50'),_0x454f('0x51'),this[_0x454f('0xe')][_0x454f('0x35')]):undefined;this[_0x454f('0xf')][_0x454f('0x52')](_0x2cf392,_0x189848)[_0x454f('0x13')](function(_0x2562c2){_0x32276c(null,_['isNil'](_0x2562c2)?![]:!![]);})[_0x454f('0x15')](function(_0x2c7cfd){logger['error'](_0x2c7cfd);_0x32276c(null,![]);});};AGIVertices['prototype'][_0x454f('0x53')]=function(_0x3280d1,_0x19b38f){sh[_0x454f('0x54')](_['trim'](_0x3280d1),function(_0x5b5184,_0x50a68e){var _0x29a703=_0x50a68e[_0x454f('0x55')](/(\r\n|\n|\r)/gm,'');_0x19b38f(null,_0x29a703);});};AGIVertices['prototype'][_0x454f('0x56')]=function(_0x25ad18,_0x3aa96d){scripts[_0x454f('0x56')](_0x25ad18['text'],_0x25ad18[_0x454f('0x57')]||'en',0x1)[_0x454f('0x13')](function(_0x3210a0){_0x3aa96d(null,_0x3210a0);})[_0x454f('0x15')](function(_0x3895fc){_0x3aa96d(_0x3895fc);});};AGIVertices[_0x454f('0x11')][_0x454f('0x58')]=function(_0x1a1405,_0x33a43e){scripts[_0x454f('0x58')](this[_0x454f('0xe')][_0x454f('0x32')],_0x1a1405[_0x454f('0x59')],_0x1a1405[_0x454f('0x5a')],_0x1a1405[_0x454f('0x5b')]||'en')[_0x454f('0x13')](function(_0xc0f43f){_0x33a43e(null,_0xc0f43f);})['catch'](function(_0xe74d87){_0x33a43e(_0xe74d87);});};AGIVertices[_0x454f('0x11')]['ispeechTTS']=function(_0x5b7754,_0x52a784){scripts['ispeechTTS'](_0x5b7754[_0x454f('0x59')],_0x5b7754[_0x454f('0x5a')],_0x5b7754[_0x454f('0x5c')]||_0x454f('0x5d'),_0x5b7754[_0x454f('0x5e')])['then'](function(_0x2f216d){_0x52a784(null,_0x2f216d);})[_0x454f('0x15')](function(_0x6c03a4){_0x52a784(_0x6c03a4);});};AGIVertices[_0x454f('0x11')][_0x454f('0x5f')]=function(_0x4d0aba,_0x27e664,_0x2ee270){scripts['ispeechASR'](_0x27e664,_0x4d0aba[_0x454f('0x59')],_0x4d0aba['ispeech_asr_language']||_0x454f('0x5d'),this[_0x454f('0x60')](_0x4d0aba[_0x454f('0x61')])?_0x4d0aba['model']:undefined)[_0x454f('0x13')](function(_0x57490d){_0x2ee270(null,_0x57490d);})[_0x454f('0x15')](function(_0x2bf583){_0x2ee270(_0x2bf583);});};AGIVertices[_0x454f('0x11')][_0x454f('0x62')]=function(_0x3606ed,_0x170d81){scripts[_0x454f('0x62')](_0x3606ed[_0x454f('0x63')],_0x3606ed[_0x454f('0x64')],_0x3606ed[_0x454f('0x65')],_0x3606ed[_0x454f('0x66')]||_0x454f('0x67'),_0x3606ed[_0x454f('0x5a')],_0x3606ed[_0x454f('0x68')]||_0x454f('0x5a'))[_0x454f('0x13')](function(_0x3692be){_0x170d81(null,_0x3692be);})[_0x454f('0x15')](function(_0x189b51){_0x170d81(_0x189b51);});};AGIVertices[_0x454f('0x11')][_0x454f('0x69')]=function(_0x2bc502,_0x45f595,_0x585a75){scripts[_0x454f('0x69')](_0x45f595,_0x2bc502[_0x454f('0x59')],_0x2bc502[_0x454f('0x6a')]||_0x454f('0x5d'))['then'](function(_0x166edb){_0x585a75(null,_0x166edb);})['catch'](function(_0x550d1c){_0x585a75(_0x550d1c);});};AGIVertices['prototype'][_0x454f('0x6b')]=function(_0x2efa27,_0x26593b,_0x328cea){scripts[_0x454f('0x6b')](_0x26593b,_0x2efa27['appid'],_0x2efa27['appsecret'],_0x2efa27[_0x454f('0x6c')])[_0x454f('0x13')](function(_0x1ad27c){_0x328cea(null,_0x1ad27c);})[_0x454f('0x15')](function(_0xd0e9dc){_0x328cea(_0xd0e9dc);});};AGIVertices[_0x454f('0x11')][_0x454f('0x6d')]=function(_0xcd2210){var _0x439a48=_['includes'](verticesWithRetry,_0xcd2210[_0x454f('0x34')])?_0xcd2210:_[_0x454f('0x6e')](_0xcd2210);for(var _0x5147ec in _0x439a48){if(_0x439a48[_0x454f('0x6f')](_0x5147ec)){if(_0x439a48[_0x5147ec]&&_[_0x454f('0x70')](_0x439a48[_0x5147ec])){_0x439a48[_0x5147ec]=this[_0x454f('0x71')](_0x439a48[_0x5147ec]);}}}return _0x439a48;};AGIVertices[_0x454f('0x11')]['replaceAllVariables']=function(_0x362ecf){var _0x5ba20d=_0x362ecf[_0x454f('0x72')]('{');for(var _0x28930a=0x1;_0x28930a<_0x5ba20d[_0x454f('0x73')];_0x28930a+=0x1){var _0x1f634f=_0x5ba20d[_0x28930a][_0x454f('0x72')]('}');if(_0x1f634f['length']>0x1){_0x362ecf=_0x362ecf[_0x454f('0x74')]('{'+_0x1f634f[0x0]+'}',this[_0x454f('0xe')][_0x454f('0x12')](_0x1f634f[0x0])[_0x454f('0x75')]||_0x1f634f[0x0]);}}if(_0x5ba20d[_0x454f('0x73')]===0x1){return _0x362ecf[_0x454f('0x48')]();}return this[_0x454f('0x71')](_0x362ecf);};AGIVertices[_0x454f('0x11')][_0x454f('0x76')]=function(_0x28d164,_0x1d537c){var _0x11f1ab=this[_0x454f('0xe')]['getVariable'](_0x28d164);if(_0x11f1ab[_0x454f('0x77')]===-0x1){return _0x11f1ab;}logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x78'),_0x1d537c,_0x11f1ab['extra']));return this[_0x454f('0xe')][_0x454f('0x79')](_0x1d537c,_0x11f1ab[_0x454f('0x75')]);};AGIVertices[_0x454f('0x11')][_0x454f('0x60')]=function(_0x3d9908){return _0x3d9908&&_0x3d9908!=='0'&&_0x3d9908!=='-1'&&_0x3d9908!=='';};AGIVertices[_0x454f('0x11')][_0x454f('0x7a')]=function(_0x29eb5a){this[_0x454f('0x31')][_0x454f('0x7b')](this,_0x29eb5a,'-');_0x29eb5a[_0x454f('0x7c')]=_0x29eb5a[_0x454f('0x7a')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x454f('0x11')]['agi']=function(_0x44dbd4){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x7d'),_0x44dbd4['label']));return this[_0x454f('0xe')]['agi']([_0x44dbd4['command'],_0x44dbd4[_0x454f('0x7e')]]);};AGIVertices[_0x454f('0x11')][_0x454f('0x7f')]=function(_0x1d9255){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x80'),_0x1d9255['label']));if(this['isConfigured'](_0x1d9255[_0x454f('0x81')])){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x82'),_0x1d9255[_0x454f('0x81')]));var _0x4f3dc8=this['channel'][_0x454f('0x83')](_0x1d9255[_0x454f('0x81')]);if(_0x4f3dc8['result']===-0x1){return _0x4f3dc8;}}return this[_0x454f('0xe')][_0x454f('0x7f')]();};AGIVertices[_0x454f('0x11')]['callback']=function(_0x23205d){logger[_0x454f('0x2a')](util[_0x454f('0x27')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x23205d['label']));if(!this[_0x454f('0x60')](_0x23205d[_0x454f('0x44')])){return this['channel'][_0x454f('0x29')](_0x23205d,_0x454f('0x84'));}_0x23205d['scheduledAt']=moment();if(this['isConfigured'](_0x23205d[_0x454f('0x85')])){_0x23205d[_0x454f('0x45')]=moment()[_0x454f('0x86')](_0x23205d[_0x454f('0x85')],'minutes');}if(!this[_0x454f('0x60')](_0x23205d[_0x454f('0x87')])){_0x23205d['callback_priority']=0x2;}this['createCmContact']['sync'](this,_0x23205d);return this[_0x454f('0xe')][_0x454f('0x88')](util['format'](_0x454f('0x89'),_0x23205d['phone'],_0x23205d['list_id'],_0x23205d['scheduledAt']));};AGIVertices[_0x454f('0x11')]['custom_app']=function(_0x21a644){logger[_0x454f('0x2a')](util['format'](_0x454f('0x8a'),_0x21a644[_0x454f('0x33')]));var _0x4f4a1c=this[_0x454f('0xe')]['exec'](_0x21a644[_0x454f('0x8b')],_0x21a644[_0x454f('0x8c')]);if(_0x4f4a1c[_0x454f('0x77')]===-0x1){return _0x4f4a1c;}return this['channel']['noop'](util[_0x454f('0x27')]('Executed\x20command\x20%s\x20%s',_0x21a644[_0x454f('0x8b')],_0x21a644['options']));};AGIVertices['prototype']['lumenvoxtts']=function(_0x2a7c08){logger[_0x454f('0x2a')](util['format'](_0x454f('0x8d'),_0x2a7c08[_0x454f('0x33')]));if(!this[_0x454f('0x60')](_0x2a7c08[_0x454f('0x5a')])){return this['channel'][_0x454f('0x88')](_0x454f('0x8e'));}var _0x41b069='\x22'+_0x2a7c08['text']+'\x22';if(this[_0x454f('0x60')](_0x2a7c08[_0x454f('0x8c')])){_0x41b069+=','+_0x2a7c08[_0x454f('0x8c')];}var _0x334e8f=this[_0x454f('0xe')][_0x454f('0x54')]('MRCPSynth',_0x41b069);if(_0x334e8f['result']===-0x1){return _0x334e8f;}return this[_0x454f('0xe')]['noop'](util[_0x454f('0x27')](_0x454f('0x8f'),_0x41b069));};AGIVertices[_0x454f('0x11')][_0x454f('0x90')]=function(_0x931e33){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x91'),_0x931e33['label']));if(!this[_0x454f('0x60')](_0x931e33[_0x454f('0x92')])){return this[_0x454f('0xe')][_0x454f('0x88')](_0x454f('0x93'));}var _0x341d2c=_0x931e33[_0x454f('0x92')];if(this[_0x454f('0x60')](_0x931e33[_0x454f('0x8c')])){_0x341d2c+=','+_0x931e33[_0x454f('0x8c')];}var _0xa79789=this[_0x454f('0xe')][_0x454f('0x54')](_0x454f('0x94'),_0x341d2c);if(_0xa79789[_0x454f('0x77')]===-0x1){return _0xa79789;}var _0x5fefdd=this[_0x454f('0x76')](_0x454f('0x95'),_0x454f('0x96'));if(_0x5fefdd[_0x454f('0x77')]===-0x1){return _0x5fefdd;}var _0x50c3c0=this['getAndSetVariable'](_0x454f('0x97'),_0x454f('0x98'));if(_0x50c3c0[_0x454f('0x77')]===-0x1){return _0x50c3c0;}var _0x1b15cd=this['getAndSetVariable'](_0x454f('0x99'),_0x454f('0x9a'));if(_0x1b15cd['result']===-0x1){return _0x1b15cd;}return this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x9b'),_0x341d2c));};AGIVertices[_0x454f('0x11')][_0x454f('0x9c')]=function(_0x299ac8){logger[_0x454f('0x2a')](util['format'](_0x454f('0x9d'),_0x299ac8['label']));if(!this[_0x454f('0x60')](_0x299ac8[_0x454f('0x9e')])){return this[_0x454f('0xe')][_0x454f('0x29')](_0x299ac8,_0x454f('0x9f'));}var _0xab23e7=this['getSquareOdbc'][_0x454f('0x7b')](this,_0x299ac8[_0x454f('0x9e')]);if(!_0xab23e7){return this[_0x454f('0xe')][_0x454f('0x29')](_0x299ac8,_0x454f('0xa0'));}if(!this[_0x454f('0x60')](_0x299ac8[_0x454f('0xa1')])){return this[_0x454f('0xe')][_0x454f('0x29')](_0x299ac8,_0x454f('0xa2'));}var _0x4ec618=_0x299ac8[_0x454f('0xa1')][_0x454f('0x55')](/(\r\n|\n|\r)/gm,'\x20');this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')]('query:\x20%s',_0x4ec618));var _0x4ef64a=this[_0x454f('0x28')][_0x454f('0x7b')](this,_0xab23e7,_0x4ec618);this[_0x454f('0x31')][_0x454f('0x7b')](this,_0x299ac8,_0x4ec618);if(!this[_0x454f('0x60')](_0x299ac8[_0x454f('0xa3')])){return this[_0x454f('0xe')][_0x454f('0x88')](_0x454f('0xa4'));}var _0x2e5a71=this['getVariable'][_0x454f('0x7b')](this,_0x299ac8[_0x454f('0xa3')]);if(!_0x2e5a71){return this[_0x454f('0xe')][_0x454f('0x29')](_0x299ac8,'no\x20variable\x20found');}var _0x3cf886=this;_0x4ef64a[_0x454f('0xa5')](function(_0x4a1893,_0xd128ff){Object['keys'](_0x4a1893)['forEach'](function(_0x33e6d5){_0x3cf886['channel'][_0x454f('0x79')](util[_0x454f('0x27')]('%s[%s][%s]',_0x2e5a71,_0xd128ff,_0x33e6d5),_0x4a1893[_0x33e6d5]);});});this[_0x454f('0xe')]['setVariable'](util[_0x454f('0x27')](_0x454f('0xa6'),_0x2e5a71),_0x4ef64a[_0x454f('0x73')]);return this[_0x454f('0xe')][_0x454f('0x88')](util['format']('variable\x20%s\x20set',_0x2e5a71));};AGIVertices['prototype'][_0x454f('0xa7')]=function(_0x1e1317){logger[_0x454f('0xa8')](util[_0x454f('0x27')](_0x454f('0xa9'),_0x1e1317['label']));if(!this[_0x454f('0x60')](_0x1e1317['sip_id'])){return this[_0x454f('0xe')][_0x454f('0x29')](_0x1e1317,_0x454f('0xaa'));}var _0x23b34a=this[_0x454f('0x19')][_0x454f('0x7b')](this,_0x1e1317[_0x454f('0xab')]);if(!_0x23b34a){return this['channel'][_0x454f('0x29')](_0x1e1317,'no\x20user\x20found');}var _0x58d8a1=this['channel'][_0x454f('0x54')](_0x454f('0xac'),[util[_0x454f('0x27')]('SIP/%s',_0x23b34a),_0x1e1317['timeout'],_0x1e1317[_0x454f('0xad')],_0x1e1317[_0x454f('0xae')]]);if(_0x58d8a1['result']===-0x1){return _0x58d8a1;}return this[_0x454f('0xe')][_0x454f('0x88')](util['format'](_0x454f('0xaf'),'DIAL'));};AGIVertices[_0x454f('0x11')][_0x454f('0xb0')]=function(_0x487bad){logger[_0x454f('0x2a')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x487bad[_0x454f('0x33')]));if(!this['isConfigured'](_0x487bad['key'])){return this['channel'][_0x454f('0x88')](_0x454f('0xb1'));}if(!this[_0x454f('0x60')](_0x487bad[_0x454f('0x5a')])){return this[_0x454f('0xe')]['noop'](_0x454f('0x8e'));}this[_0x454f('0xe')]['noop'](util['format'](_0x454f('0xb2'),_0x487bad[_0x454f('0x5a')]));var _0x9e38bb=this['googleDialogflow'][_0x454f('0x7b')](this,_0x487bad);if(_0x9e38bb){for(var _0x558fbe in _0x9e38bb){if(_0x9e38bb['hasOwnProperty'](_0x558fbe)){this[_0x454f('0xe')][_0x454f('0x79')](util[_0x454f('0x27')]('DIALOGFLOW_%s',_0x558fbe[_0x454f('0xb3')]()),_0x9e38bb[_0x558fbe]);}}return this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0xb4'),_0x9e38bb[_0x454f('0xb5')]));}return this['channel'][_0x454f('0x29')](_0x487bad,_0x454f('0xb6'));};AGIVertices[_0x454f('0x11')][_0x454f('0xb7')]=function(_0x49020b){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0xb8'),_0x49020b['label']));return this[_0x454f('0xe')][_0x454f('0x88')](_0x454f('0xb7'));};AGIVertices[_0x454f('0x11')][_0x454f('0xb9')]=function(_0x449e67){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0xba'),_0x449e67[_0x454f('0x33')]));var _0x3fa2cc='';if(_0x449e67[_0x454f('0xbb')]){if(!this[_0x454f('0x60')](_0x449e67[_0x454f('0xbb')])){return this['channel'][_0x454f('0x29')](_0x449e67,_0x454f('0xbc'));}else{var _0x41696f=parseInt(_0x449e67[_0x454f('0xbb')],0xa);if(isNaN(_0x41696f)){_0x3fa2cc=_0x449e67[_0x454f('0xbb')];}else{_0x3fa2cc=this['getTrunk'][_0x454f('0x7b')](this,_0x449e67['trunk_id']);if(!_0x3fa2cc){return this['channel'][_0x454f('0x29')](_0x449e67,_0x454f('0xbd'));}}}}else if(_0x449e67[_0x454f('0xbe')]){_0x3fa2cc=_0x449e67['trunk_name'];}else{return this[_0x454f('0xe')]['error'](_0x449e67,_0x454f('0xbc'));}var _0x55a0e6=this[_0x454f('0xe')][_0x454f('0x54')](_0x454f('0xac'),[util[_0x454f('0x27')](_0x454f('0xbf'),_0x3fa2cc,_0x449e67[_0x454f('0x43')]),_0x449e67[_0x454f('0x81')],_0x449e67[_0x454f('0xad')],_0x449e67[_0x454f('0xae')]]);if(_0x55a0e6['result']===-0x1){return _0x55a0e6;}return this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')]('Executed\x20command\x20%s',_0x454f('0xac')));};AGIVertices[_0x454f('0x11')][_0x454f('0xc0')]=function(_0x4c610d){logger[_0x454f('0x2a')](util[_0x454f('0x27')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x4c610d[_0x454f('0x33')]));return this[_0x454f('0xe')][_0x454f('0x88')](_0x454f('0xc0'));};AGIVertices[_0x454f('0x11')][_0x454f('0xc')]=function(_0x15b9e3){logger[_0x454f('0x2a')](util[_0x454f('0x27')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x15b9e3[_0x454f('0x33')]));if(_0x15b9e3[_0x454f('0x7c')]===0x0){return this['maxRetry'](_0x15b9e3);}_0x15b9e3[_0x454f('0x7c')]-=0x1;if(!this[_0x454f('0x60')](_0x15b9e3['file_id'])){return this[_0x454f('0xe')][_0x454f('0x29')](_0x15b9e3,_0x454f('0xc1'));}var _0x3d0429=this['getSound'][_0x454f('0x7b')](this,_0x15b9e3[_0x454f('0xc2')]);if(!_0x3d0429){return this[_0x454f('0xe')][_0x454f('0x29')](_0x15b9e3,_0x454f('0xc3'));}if(!this[_0x454f('0x60')](_0x15b9e3[_0x454f('0xa3')])){return this[_0x454f('0xe')][_0x454f('0x29')](_0x454f('0xa4'));}var _0x5b9601=this[_0x454f('0xe')][_0x454f('0xc4')](_0x3d0429,_0x15b9e3['response'],_0x15b9e3[_0x454f('0xc5')]);var _0x1d7f46=_0x5b9601[_0x454f('0x77')]?_0x5b9601[_0x454f('0x77')][_0x454f('0x48')]():'';logger[_0x454f('0x2a')](_0x454f('0xc6'),JSON[_0x454f('0xc7')](_0x5b9601));if(_0x5b9601[_0x454f('0x77')]===-0x1){this[_0x454f('0x31')][_0x454f('0x7b')](this,_0x15b9e3,_0x1d7f46);return _0x5b9601;}else if(_0x5b9601['extra']===_0x454f('0x81')){_0x5b9601[_0x454f('0x77')]=_0x1d7f46[_0x454f('0x73')]>=parseInt(_0x15b9e3[_0x454f('0xc8')])?'x':'i';}else{_0x5b9601[_0x454f('0x77')]=_0x1d7f46[_0x454f('0x73')]>=parseInt(_0x15b9e3[_0x454f('0xc8')])&&_0x1d7f46[_0x454f('0x73')]<=parseInt(_0x15b9e3['maxdigit'])?'x':'i';}var _0x331117=this[_0x454f('0x12')][_0x454f('0x7b')](this,_0x15b9e3[_0x454f('0xa3')]);if(!_0x331117){return this[_0x454f('0xe')][_0x454f('0x29')](_0x15b9e3,_0x454f('0xc9'));}this[_0x454f('0xe')][_0x454f('0x79')](_0x331117,_0x1d7f46);if(this[_0x454f('0x60')](_0x15b9e3['hiddendigitsnum'])){var _0x85544d=parseInt(_0x15b9e3[_0x454f('0xca')],0xa);var _0x4f5e83=rs[_0x454f('0xcb')]({'charset':'*','length':_0x85544d});var _0x530d4e=_0x1d7f46[_0x454f('0x73')];if(_0x530d4e>0x0){if(_0x530d4e>_0x85544d){this[_0x454f('0x31')][_0x454f('0x7b')](this,_0x15b9e3,_0x15b9e3[_0x454f('0xcc')]===_0x454f('0xcd')?_0x4f5e83+_0x1d7f46['substr'](_0x85544d):_0x1d7f46[_0x454f('0xce')](0x0,_0x530d4e-_0x85544d)+_0x4f5e83);}else{this[_0x454f('0x31')][_0x454f('0x7b')](this,_0x15b9e3,rs[_0x454f('0xcb')]({'charset':'*','length':_0x530d4e}));}}else{this[_0x454f('0x31')][_0x454f('0x7b')](this,_0x15b9e3,'');}}else{this['createSquareDetailsReport'][_0x454f('0x7b')](this,_0x15b9e3,_0x1d7f46);}return _0x5b9601;};AGIVertices[_0x454f('0x11')][_0x454f('0xd')]=function(_0x3ff93a){logger['info'](util['format'](_0x454f('0xcf'),_0x3ff93a[_0x454f('0x33')]));return this[_0x454f('0xc')](_0x3ff93a);};AGIVertices[_0x454f('0x11')][_0x454f('0xd0')]=function(_0x3b2df3){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0xd1'),_0x3b2df3[_0x454f('0x33')]));this[_0x454f('0x31')][_0x454f('0x7b')](this,_0x3b2df3,_0x3b2df3[_0x454f('0xd2')]);return this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0xd3'),_0x3b2df3[_0x454f('0xd2')]));};AGIVertices[_0x454f('0x11')][_0x454f('0xd4')]=function(_0x59f58d){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0xd5'),_0x59f58d[_0x454f('0x33')]));if(!this['isConfigured'](_0x59f58d[_0x454f('0x63')])||!this[_0x454f('0x60')](_0x59f58d[_0x454f('0x64')])){return this[_0x454f('0xe')][_0x454f('0x88')](_0x454f('0xd6'));}if(!this['isConfigured'](_0x59f58d[_0x454f('0x5a')])){return this[_0x454f('0xe')]['noop']('no\x20text\x20configured');}this[_0x454f('0xe')]['noop'](util[_0x454f('0x27')](_0x454f('0xd7'),_0x59f58d[_0x454f('0x5a')]));var _0x5e495=this[_0x454f('0x62')][_0x454f('0x7b')](this,_0x59f58d);if(_0x5e495){this[_0x454f('0xe')]['noop'](util[_0x454f('0x27')](_0x454f('0xd8'),_0x5e495));var _0x221403=this[_0x454f('0xe')][_0x454f('0xd9')](_0x5e495);try{fs[_0x454f('0xda')](_0x5e495+_0x454f('0xdb'));}catch(_0x52cb17){logger[_0x454f('0x29')](_0x52cb17);}return _0x221403;}return this[_0x454f('0xe')][_0x454f('0x29')](_0x59f58d,_0x454f('0xdc'));};AGIVertices['prototype'][_0x454f('0xdd')]=function(_0x2a565d){logger[_0x454f('0x2a')](util['format'](_0x454f('0xde'),_0x2a565d[_0x454f('0x33')],_0x2a565d[_0x454f('0x81')]));if(!this['isConfigured'](_0x2a565d[_0x454f('0x59')])){return this[_0x454f('0xe')]['noop'](_0x454f('0xb1'));}var _0x276a11=_0x454f('0xdf');var _0x3f49fe=util[_0x454f('0x27')](_0x454f('0xe0'),FILES_PATH,rs['generate'](0x4));var _0x12346f=util[_0x454f('0x27')](_0x454f('0xe1'),_0x3f49fe,_0x276a11);var _0x1c6c86=!![];if(_0x2a565d['beep']===_0x454f('0xe2')){_0x1c6c86=![];}var _0x38f6fa=this['channel'][_0x454f('0xe3')](_0x3f49fe,_0x276a11,_0x2a565d['intKey'],_0x2a565d[_0x454f('0x81')],undefined,_0x1c6c86);if(_0x38f6fa[_0x454f('0x77')]!==-0x1){this['channel'][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0xe4'),_0x12346f));var _0x1baa01=this[_0x454f('0x69')][_0x454f('0x7b')](this,_0x2a565d,_0x12346f);if(_0x1baa01){for(var _0xefb0f7 in _0x1baa01){if(_0x1baa01[_0x454f('0x6f')](_0xefb0f7)){this[_0x454f('0xe')][_0x454f('0x79')](util[_0x454f('0x27')]('GOOGLE_ASR_%s',_0xefb0f7[_0x454f('0xb3')]()),_0x1baa01[_0xefb0f7]);}}return this['channel'][_0x454f('0x88')](util['format'](_0x454f('0xe5'),JSON[_0x454f('0xc7')](_0x1baa01)));}}return _0x38f6fa;};AGIVertices[_0x454f('0x11')][_0x454f('0xe6')]=function(_0x19e3c2){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0xe7'),_0x19e3c2[_0x454f('0x33')]));if(!this[_0x454f('0x60')](_0x19e3c2[_0x454f('0xe8')])){return this[_0x454f('0xe')][_0x454f('0x88')](_0x454f('0xe9'));}if(!this['isConfigured'](_0x19e3c2[_0x454f('0xea')])){return this['channel'][_0x454f('0x88')]('no\x20appsecret\x20configured');}var _0x3d6917='wav';var _0xf1e4f1=util[_0x454f('0x27')](_0x454f('0xe0'),FILES_PATH,rs[_0x454f('0xcb')](0x4));var _0x3a945e=util[_0x454f('0x27')](_0x454f('0xe1'),_0xf1e4f1,_0x3d6917);var _0x249644=!![];if(_0x19e3c2[_0x454f('0xeb')]===_0x454f('0xe2')){_0x249644=![];}var _0x9e2d07=this[_0x454f('0xe')][_0x454f('0xe3')](_0xf1e4f1,_0x3d6917,_0x19e3c2[_0x454f('0xec')],_0x19e3c2[_0x454f('0x81')],undefined,_0x249644);if(_0x9e2d07[_0x454f('0x77')]!==-0x1){this[_0x454f('0xe')][_0x454f('0x88')](util['format'](_0x454f('0xed'),_0x3a945e));var _0x324818=this[_0x454f('0x6b')][_0x454f('0x7b')](this,_0x19e3c2,_0x3a945e);if(_0x324818){for(var _0x2da095 in _0x324818){if(_0x324818[_0x454f('0x6f')](_0x2da095)){this['channel'][_0x454f('0x79')](util[_0x454f('0x27')](_0x454f('0xee'),_0x2da095[_0x454f('0xb3')]()),_0x324818[_0x2da095]);}}return this[_0x454f('0xe')]['noop'](util[_0x454f('0x27')](_0x454f('0xef'),JSON[_0x454f('0xc7')](_0x324818)));}}return _0x9e2d07;};AGIVertices[_0x454f('0x11')]['gotoc']=function(_0x122dd8){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0xf0'),_0x122dd8[_0x454f('0x33')]));return this[_0x454f('0xe')][_0x454f('0xf1')](_0x122dd8[_0x454f('0x38')],_0x122dd8[_0x454f('0xf2')],_0x122dd8[_0x454f('0x39')]);};AGIVertices['prototype'][_0x454f('0xf3')]=function(_0x4ef70b){logger[_0x454f('0x2a')](util[_0x454f('0x27')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x4ef70b[_0x454f('0x33')]));if(!this['isConfigured'](_0x4ef70b[_0x454f('0xf4')])){return this[_0x454f('0xe')]['error'](_0x4ef70b,_0x454f('0xf5'));}try{var _0x29d1e2=eval(_0x4ef70b['condition'])?_0x454f('0xf6'):'false';this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')]('EVAL\x20CONDITION\x20%s\x20%s',_0x4ef70b[_0x454f('0xf4')],_0x29d1e2));return{'code':0xc8,'result':_0x29d1e2};}catch(_0x168671){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x454f('0x11')]['gotoiftime']=function(_0x35a89a){logger['info'](util[_0x454f('0x27')](_0x454f('0xf7'),_0x35a89a['label']));if(!this[_0x454f('0x60')](_0x35a89a['interval_id'])){return this['channel'][_0x454f('0x29')](_0x35a89a,_0x454f('0xf8'));}var _0x261e53=this[_0x454f('0x23')][_0x454f('0x7b')](this,_0x35a89a[_0x454f('0xf9')]);if(!_0x261e53){return this[_0x454f('0xe')][_0x454f('0x29')](_0x35a89a,_0x454f('0xfa'));}for(var _0x35aa77=0x0;_0x35aa77<_0x261e53['length'];_0x35aa77+=0x1){var _0xd7bca5=this['channel'][_0x454f('0x12')](util['format'](_0x454f('0xfb'),_0x261e53[_0x35aa77]));if(_0xd7bca5[_0x454f('0x77')]===-0x1){return _0xd7bca5;}logger[_0x454f('0x2a')](util['format'](_0x454f('0xfc'),_0x261e53[_0x35aa77],_0xd7bca5['extra']));if(_0xd7bca5[_0x454f('0x75')]===_0x454f('0xf6')){logger['info'](util[_0x454f('0x27')]('IFTIME\x20%s\x20%s',_0x261e53[_0x35aa77],_0x454f('0xf6')));this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0xfc'),_0x261e53[_0x35aa77],_0x454f('0xf6')));return{'code':0xc8,'result':_0x454f('0xf6')};}else{logger['info'](util[_0x454f('0x27')](_0x454f('0xfc'),_0x261e53[_0x35aa77],_0x454f('0xfd')));this[_0x454f('0xe')][_0x454f('0x88')](util['format'](_0x454f('0xfc'),_0x261e53[_0x35aa77],_0x454f('0xfd')));}}return{'code':0xc8,'result':_0x454f('0xfd')};};AGIVertices['prototype'][_0x454f('0xfe')]=function(_0x145e4a){logger['info'](util[_0x454f('0x27')](_0x454f('0xff'),_0x145e4a[_0x454f('0x33')]));return this[_0x454f('0xe')][_0x454f('0xfe')]();};AGIVertices[_0x454f('0x11')][_0x454f('0x100')]=function(_0x24ff91){logger['info'](util['format'](_0x454f('0x101'),_0x24ff91[_0x454f('0x33')]));if(!this['isConfigured'](_0x24ff91['key'])){return this[_0x454f('0xe')]['noop'](_0x454f('0xb1'));}var _0x1d9026='wav';var _0x547470=util[_0x454f('0x27')](_0x454f('0xe0'),FILES_PATH,rs['generate'](0x4));var _0x5ded69=util[_0x454f('0x27')](_0x454f('0xe1'),_0x547470,_0x1d9026);var _0x4a8383=!![];if(_0x24ff91[_0x454f('0xeb')]===_0x454f('0xe2')){_0x4a8383=![];}var _0x570964=this[_0x454f('0xe')]['recordFile'](_0x547470,_0x1d9026,_0x24ff91[_0x454f('0xec')],_0x24ff91[_0x454f('0x81')],undefined,_0x4a8383);if(_0x570964['result']!==-0x1){this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')]('ispeech\x20%s\x20file\x20created',_0x5ded69));var _0x4e6b24=this[_0x454f('0x5f')][_0x454f('0x7b')](this,_0x24ff91,_0x5ded69);if(_0x4e6b24){for(var _0x15b02e in _0x4e6b24){if(_0x4e6b24[_0x454f('0x6f')](_0x15b02e)){this[_0x454f('0xe')][_0x454f('0x79')](util['format'](_0x454f('0x102'),_0x15b02e[_0x454f('0xb3')]()),_0x4e6b24[_0x15b02e]);}}return this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x103'),JSON['stringify'](_0x4e6b24)));}}return _0x570964;};AGIVertices[_0x454f('0x11')][_0x454f('0x104')]=function(_0x3fde67){logger['info'](util['format'](_0x454f('0x105'),_0x3fde67[_0x454f('0x33')]));if(!this[_0x454f('0x60')](_0x3fde67[_0x454f('0x59')])){return this['channel'][_0x454f('0x88')](_0x454f('0xb1'));}if(!this[_0x454f('0x60')](_0x3fde67[_0x454f('0x5a')])){return this[_0x454f('0xe')][_0x454f('0x88')](_0x454f('0x8e'));}this['channel'][_0x454f('0x88')](util['format'](_0x454f('0x106'),_0x3fde67[_0x454f('0x5a')]));var _0x14f9bd=this[_0x454f('0x107')]['sync'](this,_0x3fde67);if(_0x14f9bd){this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x108'),_0x14f9bd));var _0x585b88=this[_0x454f('0xe')][_0x454f('0xd9')](_0x14f9bd,_0x3fde67['intKey']);try{fs[_0x454f('0xda')](_0x14f9bd+_0x454f('0xdb'));}catch(_0x12ad3f){logger[_0x454f('0x29')](_0x12ad3f);}return _0x585b88;}return this[_0x454f('0xe')][_0x454f('0x29')](_0x3fde67,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x454f('0x109')]=function(_0x242e2b){logger[_0x454f('0x2a')](util[_0x454f('0x27')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x242e2b['label']));if(!this[_0x454f('0x60')](_0x242e2b[_0x454f('0x10a')])){return this[_0x454f('0xe')][_0x454f('0x29')](_0x242e2b,_0x454f('0x10b'));}logger[_0x454f('0x2a')](util[_0x454f('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x454f('0xe')][_0x454f('0x35')],_0x242e2b[_0x454f('0x10a')]));var _0x46c9be=this[_0x454f('0x52')]['sync'](this,_0x242e2b[_0x454f('0x10a')]);if(_0x46c9be){logger[_0x454f('0x2a')](util['format'](_0x454f('0x10c'),this[_0x454f('0xe')][_0x454f('0x35')],_0x242e2b[_0x454f('0x10a')]));this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x10c'),this[_0x454f('0xe')]['callerid'],_0x242e2b[_0x454f('0x10a')]));return{'code':0xc8,'result':_0x454f('0x10d')};}else{logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x10e'),this[_0x454f('0xe')][_0x454f('0x35')],_0x242e2b[_0x454f('0x10a')]));this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x10e'),this[_0x454f('0xe')][_0x454f('0x35')],_0x242e2b[_0x454f('0x10a')]));return{'code':0xc8,'result':_0x454f('0x10f')};}};AGIVertices[_0x454f('0x11')]['logout']=function(_0x5f5bf6){logger['info'](util[_0x454f('0x27')](_0x454f('0x110'),_0x5f5bf6[_0x454f('0x33')]));if(!this[_0x454f('0x60')](_0x5f5bf6[_0x454f('0x10a')])){return this[_0x454f('0xe')][_0x454f('0x29')](_0x5f5bf6,'no\x20find\x20by\x20configured');}logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x111'),this[_0x454f('0xe')]['callerid'],_0x5f5bf6[_0x454f('0x10a')]));var _0x422810=this[_0x454f('0x4e')]['sync'](this,_0x5f5bf6['findBy']);if(_0x422810){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x10c'),this[_0x454f('0xe')][_0x454f('0x35')],_0x5f5bf6[_0x454f('0x10a')]));this['channel'][_0x454f('0x88')](util['format'](_0x454f('0x10c'),this[_0x454f('0xe')][_0x454f('0x35')],_0x5f5bf6['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x10e'),this[_0x454f('0xe')][_0x454f('0x35')],_0x5f5bf6['findBy']));this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x10e'),this[_0x454f('0xe')]['callerid'],_0x5f5bf6['findBy']));return{'code':0xc8,'result':_0x454f('0x10f')};}};AGIVertices[_0x454f('0x11')][_0x454f('0x112')]=function(_0x8d40ba){logger['info'](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x8d40ba['label']));if(!this['isConfigured'](_0x8d40ba[_0x454f('0x113')])){return this[_0x454f('0xe')]['error'](_0x8d40ba,_0x454f('0x114'));}this[_0x454f('0xe')]['noop'](util[_0x454f('0x27')](_0x454f('0x115'),_0x8d40ba['operation']));var _0x17f96d=eval(_0x8d40ba[_0x454f('0x113')]);if(!this[_0x454f('0x60')](_0x8d40ba[_0x454f('0xa3')])){return this['channel'][_0x454f('0x88')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0xdbf526=this[_0x454f('0x12')][_0x454f('0x7b')](this,_0x8d40ba['variable_id']);if(!_0xdbf526){return this['channel']['error'](_0x8d40ba,_0x454f('0xc9'));}if(_[_0x454f('0x116')](_0x17f96d)){var _0x264eb7=this;_0x17f96d[_0x454f('0xa5')](function(_0x1c43da,_0x10ed0f){_0x264eb7[_0x454f('0xe')][_0x454f('0x79')](util['format'](_0x454f('0x117'),_0xdbf526,_0x10ed0f),_0x1c43da);});return this[_0x454f('0xe')][_0x454f('0x88')](util['format'](_0x454f('0x118'),_0xdbf526));}else{return this['channel'][_0x454f('0x79')](_0xdbf526,_0x17f96d);}};AGIVertices[_0x454f('0x11')][_0x454f('0xb')]=function(_0x2fe7e0){logger[_0x454f('0x2a')](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0x2fe7e0[_0x454f('0x33')]));if(_0x2fe7e0[_0x454f('0x7c')]===0x0){return this[_0x454f('0x7a')](_0x2fe7e0);}_0x2fe7e0[_0x454f('0x7c')]-=0x1;if(!this[_0x454f('0x60')](_0x2fe7e0[_0x454f('0xc2')])){return this[_0x454f('0xe')][_0x454f('0x29')](_0x2fe7e0,_0x454f('0xc1'));}var _0x8a99f8=this['getSound'][_0x454f('0x7b')](this,_0x2fe7e0['file_id']);if(!_0x8a99f8){return this['channel'][_0x454f('0x29')](_0x2fe7e0,_0x454f('0xc3'));}var _0x3ff8e0=this[_0x454f('0xe')][_0x454f('0xc4')](_0x8a99f8,_0x2fe7e0[_0x454f('0x119')],_0x2fe7e0[_0x454f('0x11a')]);var _0xec333=_0x3ff8e0[_0x454f('0x77')];if(_0x3ff8e0[_0x454f('0x77')]===-0x1){this['createSquareDetailsReport'][_0x454f('0x7b')](this,_0x2fe7e0,'-1');return _0x3ff8e0;}else if(_0x3ff8e0[_0x454f('0x75')]==='timeout'){_0x3ff8e0[_0x454f('0x77')]=_0x3ff8e0[_0x454f('0x77')][_0x454f('0x73')]>0x0?_0x3ff8e0['result']:'t';}else if(_[_0x454f('0x3e')](_0x3ff8e0[_0x454f('0x77')])){_0x3ff8e0[_0x454f('0x77')]='#';_0xec333='#';}if(!this[_0x454f('0x60')](_0x2fe7e0[_0x454f('0xa3')])){this[_0x454f('0xe')][_0x454f('0x88')](_0x454f('0xa4'));}else{var _0x36b4bf=this[_0x454f('0x12')]['sync'](this,_0x2fe7e0[_0x454f('0xa3')]);if(!_0x36b4bf){return this['channel']['error'](_0x2fe7e0,_0x454f('0xc9'));}this[_0x454f('0xe')][_0x454f('0x79')](_0x36b4bf,_0xec333);}this[_0x454f('0x31')][_0x454f('0x7b')](this,_0x2fe7e0,_0xec333);return _0x3ff8e0;};AGIVertices['prototype'][_0x454f('0x88')]=function(_0x2d22aa){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x11b'),_0x2d22aa[_0x454f('0x33')]));return this[_0x454f('0xe')]['noop'](_0x2d22aa[_0x454f('0x11c')]||_0x2d22aa[_0x454f('0x33')]);};AGIVertices[_0x454f('0x11')][_0x454f('0x11d')]=function(_0x5cbc56){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x11e'),_0x5cbc56['label']));if(!this[_0x454f('0x60')](_0x5cbc56[_0x454f('0x10a')])){return this['channel']['error'](_0x5cbc56,_0x454f('0x10b'));}logger[_0x454f('0x2a')](util['format'](_0x454f('0x111'),this[_0x454f('0xe')][_0x454f('0x35')],_0x5cbc56[_0x454f('0x10a')]));var _0x1dadd6=this[_0x454f('0x49')][_0x454f('0x7b')](this,_0x5cbc56['pause_id']);var _0x548915=this[_0x454f('0x4b')][_0x454f('0x7b')](this,_0x5cbc56[_0x454f('0x10a')],_0x1dadd6);if(_0x548915){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x10c'),this[_0x454f('0xe')]['callerid'],_0x5cbc56[_0x454f('0x10a')]));this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x10c'),this['channel'][_0x454f('0x35')],_0x5cbc56[_0x454f('0x10a')]));return{'code':0xc8,'result':'success'};}else{logger[_0x454f('0x2a')](util[_0x454f('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x454f('0x35')],_0x5cbc56[_0x454f('0x10a')]));this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x10c'),this[_0x454f('0xe')][_0x454f('0x35')],_0x5cbc56[_0x454f('0x10a')]));return{'code':0xc8,'result':_0x454f('0x10f')};}};AGIVertices[_0x454f('0x11')][_0x454f('0x11f')]=function(_0x54ed7c){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x120'),_0x54ed7c[_0x454f('0x33')]));if(!this[_0x454f('0x60')](_0x54ed7c[_0x454f('0xc2')])){return this['channel'][_0x454f('0x29')](_0x54ed7c,_0x454f('0xc1'));}var _0x17880a=this[_0x454f('0x1d')][_0x454f('0x7b')](this,_0x54ed7c[_0x454f('0xc2')]);if(!_0x17880a){return this[_0x454f('0xe')][_0x454f('0x29')](_0x54ed7c,'no\x20file\x20audio\x20found');}var _0x55a37e=this[_0x454f('0xe')][_0x454f('0x54')](_0x454f('0x121'),[_0x17880a,_0x54ed7c[_0x454f('0xad')]]);if(_0x55a37e[_0x454f('0x77')]===-0x1){return _0x55a37e;}return this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x122'),_0x454f('0x121'),_0x17880a));};AGIVertices['prototype'][_0x454f('0x123')]=function(_0x2322cf){logger['info'](util[_0x454f('0x27')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x2322cf[_0x454f('0x33')]));if(!this[_0x454f('0x60')](_0x2322cf['queue_id'])){return this[_0x454f('0xe')][_0x454f('0x29')](_0x2322cf,_0x454f('0x124'));}var _0x1ce5d5='';var _0x5afce0=parseInt(_0x2322cf[_0x454f('0x125')],0xa);if(isNaN(_0x5afce0)){_0x1ce5d5=_0x2322cf[_0x454f('0x125')];}else{_0x1ce5d5=this[_0x454f('0x126')]['sync'](this,_0x2322cf[_0x454f('0x125')]);if(!_0x1ce5d5){return this[_0x454f('0xe')]['error'](_0x2322cf,_0x454f('0x127'));}}var _0x532a20='';if(this[_0x454f('0x60')](_0x2322cf[_0x454f('0xc2')])){var _0x56b69e=this[_0x454f('0x1d')][_0x454f('0x7b')](this,_0x2322cf['file_id']);if(_0x56b69e){_0x532a20=_0x56b69e;}}this[_0x454f('0x31')][_0x454f('0x7b')](this,_0x2322cf,_0x1ce5d5);if(_0x2322cf[_0x454f('0xad')]['indexOf']('x')<0x0){_0x2322cf[_0x454f('0xad')]+='x';}if(_0x2322cf[_0x454f('0xad')][_0x454f('0x128')]('X')<0x0){_0x2322cf[_0x454f('0xad')]+='X';}this['channel'][_0x454f('0x79')](_0x454f('0x129'),_0x1ce5d5?_0x1ce5d5[_0x454f('0x12a')]():'');var _0x34ab51=this[_0x454f('0xe')][_0x454f('0x54')]('QUEUE',[_0x1ce5d5,_0x2322cf[_0x454f('0xad')],_0x2322cf['url'],_0x532a20,_0x2322cf['timeout'],_0x2322cf[_0x454f('0x7')],_0x2322cf[_0x454f('0x12b')],_0x2322cf[_0x454f('0x12c')],'',_0x2322cf[_0x454f('0x12d')]]);if(_0x34ab51[_0x454f('0x77')]===-0x1){return _0x34ab51;}return this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x122'),_0x454f('0x12e'),_0x1ce5d5));};AGIVertices[_0x454f('0x11')]['record']=function(_0x1670c9){logger[_0x454f('0x2a')](util['format'](_0x454f('0x12f'),_0x1670c9[_0x454f('0x33')]));var _0x538dc9=_0x1670c9['recordingFormat']||_0x454f('0xdf');var _0x17e1b6=util['format'](_0x454f('0x130'),this['channel']['uniqueid'],rs[_0x454f('0xcb')](0x5));var _0xa5b4ab=util[_0x454f('0x27')](_0x454f('0x131'),FILES_PATH,_0x17e1b6,_0x538dc9);var _0x86c5d6=util[_0x454f('0x27')](_0x454f('0xe0'),FILES_PATH,_0x17e1b6);this[_0x454f('0x36')][_0x454f('0x7b')](this,_0x1670c9,_0x17e1b6,_0xa5b4ab);this['channel']['setVariable'](_0x454f('0x132'),_0x17e1b6);logger[_0x454f('0x2a')](_0x454f('0x133'),_0x86c5d6,_0x538dc9,_0x1670c9[_0x454f('0x134')],_0x1670c9['timeout']);return this['channel']['recordFile'](_0x86c5d6,_0x538dc9,_0x1670c9[_0x454f('0x134')],_0x1670c9['timeout'],undefined,!![]);};AGIVertices[_0x454f('0x11')][_0x454f('0x135')]=function(_0x402925){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x136'),_0x402925[_0x454f('0x33')]));return this[_0x454f('0xe')][_0x454f('0x137')](_0x402925[_0x454f('0x138')][_0x454f('0x55')](/\s+/g,''),_0x402925[_0x454f('0x134')]);};AGIVertices[_0x454f('0x11')]['saynumber']=function(_0x2bc598){logger[_0x454f('0x2a')](util[_0x454f('0x27')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x2bc598[_0x454f('0x33')]));return this[_0x454f('0xe')]['sayNumber'](_0x2bc598[_0x454f('0x139')][_0x454f('0x55')](/\s+/g,''),_0x2bc598[_0x454f('0x134')]);};AGIVertices[_0x454f('0x11')][_0x454f('0x13a')]=function(_0x5b1caa){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x13b'),_0x5b1caa[_0x454f('0x33')]));return this[_0x454f('0xe')][_0x454f('0x13c')](_0x5b1caa[_0x454f('0x5a')],_0x5b1caa[_0x454f('0x134')]);};AGIVertices[_0x454f('0x11')][_0x454f('0x13d')]=function(_0x38bfed){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x13e'),_0x38bfed[_0x454f('0x33')]));if(!this[_0x454f('0x60')](_0x38bfed[_0x454f('0x13f')])){return this[_0x454f('0xe')][_0x454f('0x88')](_0x454f('0x140'));}var _0x29247a=this[_0x454f('0x21')][_0x454f('0x7b')](this,_0x38bfed[_0x454f('0x13f')]);if(!_0x29247a||!_0x29247a['Smtp']){return this['channel'][_0x454f('0x29')](_0x38bfed,'no\x20mail\x20account\x20found');}var _0x2f266a={'from':util[_0x454f('0x27')](_0x454f('0x141'),_0x29247a[_0x454f('0x14')],_0x29247a[_0x454f('0x142')]||_0x29247a[_0x454f('0x143')][_0x454f('0x144')]),'to':_0x38bfed['to']||'','cc':_0x38bfed['cc']||'','bcc':_0x38bfed[_0x454f('0x145')]||'','subject':_0x38bfed[_0x454f('0x146')],'html':_0x38bfed[_0x454f('0x5a')],'text':_0x38bfed[_0x454f('0x5a')]};var _0x35b3b0={'tls':{'rejectUnauthorized':![]}};if(_0x29247a[_0x454f('0x143')][_0x454f('0x147')]){_0x35b3b0['service']=_0x29247a[_0x454f('0x143')][_0x454f('0x147')];}else{_0x35b3b0[_0x454f('0x148')]=_0x29247a['Smtp']['host'];_0x35b3b0[_0x454f('0x149')]=_0x29247a['Smtp']['port'];_0x35b3b0[_0x454f('0x14a')]=_0x29247a[_0x454f('0x143')][_0x454f('0x14a')];}if(_0x29247a['Smtp'][_0x454f('0x14b')]){_0x35b3b0['auth']={'user':_0x29247a['Smtp'][_0x454f('0x144')],'pass':_0x29247a[_0x454f('0x143')][_0x454f('0x14c')]};}if(this[_0x454f('0x60')](_0x38bfed[_0x454f('0x14d')])){}logger[_0x454f('0xa8')](_0x454f('0x14e'),JSON[_0x454f('0xc7')](_0x2f266a));this[_0x454f('0x31')][_0x454f('0x7b')](this,_0x38bfed,_0x38bfed['account_id']);this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x29247a[_0x454f('0x14')]));this[_0x454f('0x22')]['sync'](this,_0x35b3b0,_0x2f266a);return this['channel'][_0x454f('0x88')](_0x454f('0x14f'));};AGIVertices[_0x454f('0x11')][_0x454f('0x150')]=function(_0x268e2d){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x151'),_0x268e2d[_0x454f('0x33')]));return this[_0x454f('0xe')][_0x454f('0x88')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x454f('0x11')][_0x454f('0x152')]=function(_0x5601b6){logger[_0x454f('0x2a')](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x5601b6[_0x454f('0x33')]));if(!this['isConfigured'](_0x5601b6[_0x454f('0x153')])){return this[_0x454f('0xe')]['noop'](_0x454f('0x154'));}var _0x599695=this[_0x454f('0x2f')][_0x454f('0x7b')](this,_0x5601b6[_0x454f('0x153')]);if(!_0x599695){return this[_0x454f('0xe')][_0x454f('0x29')](_0x5601b6,_0x454f('0x155'));}var _0x299470={'body':_0x5601b6[_0x454f('0x156')],'phone':_0x5601b6['to']||'','SmsAccountId':_0x599695['id']};logger[_0x454f('0xa8')]('sendSMS\x20message',JSON[_0x454f('0xc7')](_0x299470));this[_0x454f('0x31')][_0x454f('0x7b')](this,_0x5601b6,_0x5601b6[_0x454f('0x153')]);this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x157'),_0x599695['name']));this[_0x454f('0x30')][_0x454f('0x7b')](this,_0x299470);return this[_0x454f('0xe')][_0x454f('0x88')](_0x454f('0x158'));};AGIVertices[_0x454f('0x11')][_0x454f('0x159')]=function(_0x3b8b4e){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x15a'),_0x3b8b4e[_0x454f('0x33')]));if(!this[_0x454f('0x60')](_0x3b8b4e[_0x454f('0xa3')])){return this[_0x454f('0xe')]['error'](_0x3b8b4e,_0x454f('0x15b'));}var _0x1ad6ae=this['getVariable']['sync'](this,_0x3b8b4e[_0x454f('0xa3')]);if(!_0x1ad6ae){return this[_0x454f('0xe')]['error'](_0x3b8b4e,_0x454f('0xc9'));}return this[_0x454f('0xe')][_0x454f('0x79')](_0x1ad6ae,_0x3b8b4e[_0x454f('0x15c')]);};AGIVertices[_0x454f('0x11')][_0x454f('0x15d')]=function(_0x3ec885){logger['info'](util['format'](_0x454f('0x15e'),_0x3ec885[_0x454f('0x33')]));this[_0x454f('0xe')][_0x454f('0x88')]('START\x20CALLY\x20SQUARE');if(_0x3ec885['answer']===_0x454f('0x15f')){this[_0x454f('0xe')]['noop'](_0x454f('0x160'));return this[_0x454f('0xe')]['answer']();}return this[_0x454f('0xe')][_0x454f('0x88')](_0x454f('0x161'));};AGIVertices[_0x454f('0x11')][_0x454f('0x162')]=function(_0x34df3f){logger['info'](util[_0x454f('0x27')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x34df3f['label']));if(!this[_0x454f('0x60')](_0x34df3f[_0x454f('0x163')])){return this[_0x454f('0xe')]['error'](_0x34df3f,_0x454f('0x164'));}var _0x76e4df=this[_0x454f('0x17')][_0x454f('0x7b')](this,_0x34df3f[_0x454f('0x163')]);if(!this[_0x454f('0x60')](_0x76e4df)){return this[_0x454f('0xe')][_0x454f('0x29')](_0x34df3f,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x34df3f[_0x454f('0x163')]));}if(_0x76e4df===this[_0x454f('0xe')][_0x454f('0x165')]){return this['channel'][_0x454f('0x29')](_0x34df3f,_0x454f('0x166'));}this[_0x454f('0x31')]['sync'](this,_0x34df3f,_0x76e4df);var _0x1a8b80=this['channel'][_0x454f('0x54')](_0x454f('0x167'),util['format'](_0x454f('0x168'),config[_0x454f('0x7')]['host']||_0x454f('0x169'),_0x76e4df,this[_0x454f('0xe')][_0x454f('0x165')]));if(_0x1a8b80[_0x454f('0x77')]===-0x1){return _0x1a8b80;}return this[_0x454f('0xe')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x454f('0x167'),_0x76e4df));};AGIVertices[_0x454f('0x11')][_0x454f('0x16a')]=function(_0x3b85c2){logger[_0x454f('0x2a')](util['format'](_0x454f('0x16b'),_0x3b85c2[_0x454f('0x33')]));var _0x408cb6=this['shellCommand']['sync'](this,_0x3b85c2[_0x454f('0x16c')]);this[_0x454f('0x31')][_0x454f('0x7b')](this,_0x3b85c2,_0x3b85c2[_0x454f('0x16c')]);if(this[_0x454f('0x60')](_0x3b85c2[_0x454f('0xa3')])){var _0x2d0e63=this[_0x454f('0x12')]['sync'](this,_0x3b85c2[_0x454f('0xa3')]);if(_0x2d0e63){this[_0x454f('0xe')][_0x454f('0x79')](_0x2d0e63,_0x408cb6);return this[_0x454f('0xe')]['noop'](util[_0x454f('0x27')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x3b85c2['command'],_0x2d0e63));}}return this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x16d'),_0x3b85c2[_0x454f('0x16c')]));};AGIVertices['prototype']['tts']=function(_0x5169e6){logger['info'](util[_0x454f('0x27')](_0x454f('0x16e'),_0x5169e6['label']));if(!this[_0x454f('0x60')](_0x5169e6[_0x454f('0x5a')])){return this[_0x454f('0xe')]['noop']('no\x20text\x20configured');}this[_0x454f('0xe')][_0x454f('0x88')](util['format'](_0x454f('0x16f'),_0x5169e6['text']));var _0x5e5009=this[_0x454f('0x56')][_0x454f('0x7b')](this,_0x5169e6);if(_0x5e5009){this['channel']['noop'](util[_0x454f('0x27')](_0x454f('0x170'),_0x5e5009));var _0x18aeda=this[_0x454f('0xe')][_0x454f('0xd9')](_0x5e5009);try{fs[_0x454f('0xda')](_0x5e5009+_0x454f('0xdb'));}catch(_0x48caa8){logger[_0x454f('0x29')](_0x48caa8);}return _0x18aeda;}return this['channel'][_0x454f('0x29')](_0x5169e6,_0x454f('0xb6'));};AGIVertices['prototype'][_0x454f('0x171')]=function(_0x250282){logger['info'](util[_0x454f('0x27')](_0x454f('0x172'),_0x250282['label']));if(!this[_0x454f('0x60')](_0x250282[_0x454f('0x10a')])){return this[_0x454f('0xe')][_0x454f('0x29')](_0x250282,_0x454f('0x10b'));}logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x111'),this['channel'][_0x454f('0x35')],_0x250282['findBy']));var _0x1a7220=this['agentUnpause'][_0x454f('0x7b')](this,_0x250282[_0x454f('0x10a')]);if(_0x1a7220){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x10c'),this['channel'][_0x454f('0x35')],_0x250282[_0x454f('0x10a')]));this['channel'][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x10c'),this['channel']['callerid'],_0x250282[_0x454f('0x10a')]));return{'code':0xc8,'result':_0x454f('0x10d')};}else{logger[_0x454f('0x2a')](util['format'](_0x454f('0x10e'),this[_0x454f('0xe')][_0x454f('0x35')],_0x250282[_0x454f('0x10a')]));this[_0x454f('0xe')]['noop'](util[_0x454f('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x454f('0xe')][_0x454f('0x35')],_0x250282['findBy']));return{'code':0xc8,'result':_0x454f('0x10f')};}};AGIVertices[_0x454f('0x11')][_0x454f('0x173')]=function(_0x236e98){logger[_0x454f('0x2a')](util['format'](_0x454f('0x174'),_0x236e98['label']));var _0x42c1ba=this[_0x454f('0xe')][_0x454f('0x54')](_0x454f('0x175'),[_0x236e98[_0x454f('0x176')],_0x236e98['options']]);if(_0x42c1ba[_0x454f('0x77')]===-0x1){return _0x42c1ba;}return this[_0x454f('0xe')][_0x454f('0x88')](util['format'](_0x454f('0x122'),'VOICEMAIL',_0x236e98[_0x454f('0x176')]));};AGIVertices[_0x454f('0x11')][_0x454f('0x177')]=function(_0x49bb2f){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x178'),_0x49bb2f['label']));if(!this[_0x454f('0x60')](_0x49bb2f['variable_id'])){return this[_0x454f('0xe')][_0x454f('0x29')](_0x49bb2f,_0x454f('0x15b'));}var _0x134bef=this[_0x454f('0x12')][_0x454f('0x7b')](this,_0x49bb2f['variable_id']);if(!_0x134bef){return this[_0x454f('0xe')][_0x454f('0x29')](_0x49bb2f,'no\x20variable\x20found');}var _0x1a422e=this[_0x454f('0xe')][_0x454f('0x12')](_0x134bef);return{'code':0xc8,'result':_0x1a422e[_0x454f('0x75')]?_0x1a422e[_0x454f('0x75')]:'-'};};String[_0x454f('0x11')]['replaceAll']=function(_0x5273a5,_0x3f4f39){return this[_0x454f('0x72')](_0x5273a5)[_0x454f('0x179')](_0x3f4f39);};module[_0x454f('0x17a')]=AGIVertices; \ No newline at end of file +var _0x1d25=['getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','service','port','secure','authentication','pass','template_id','sendMail\x20message','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\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','command','sh\x20command:\x20%s\x20result\x20no\x20stored','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','no\x20variable\x20selected','replaceAll','join','exports','path','lodash','shelljs','odbc','randomstring','moment','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','menu','getdigits','rpc','getVariable','getVariableById','then','name','catch','prototype','getVoiceQueue','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundPath','save_name','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','IntervalId','interval','map','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','createSmsMessage','channel','uniqueid','label','agicommand','arg_1','callerid','calleridname','context','extension','priority','accountcode','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','callback','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','LOCAL','trim','googleTTS','text','googleDialogflow','key','ispeech_tts_language','ispeechASR','ispeech_asr_language','en-US','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','googleASR','tildeASR','clear','includes','clone','hasOwnProperty','isString','replaceAllVariables','split','extra','length','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','createSquareDetailsReport','retry','answer','Wait\x20%s\x20seconds\x20before\x20answer','timeout','wait','no\x20list\x20selected','scheduledAt','delay','minutes','sync','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','options','noop','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','exec','MRCPSynth','grammar','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','opts','url','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','DIALOGFLOW_%s','toUpperCase','Dialogflow\x20Result\x20%s','speech','Google\x20TTS\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','DIAL','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','first','substr','generate','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','unlink','.wav','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s.%s','NOBEEP','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','beep','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','stringify','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeechTTS','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','isArray','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','output','pause','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Executed\x20command\x20%s\x20%s','recordingFormat','%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','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d25,0x1a4));var _0x51d2=function(_0xc55d64,_0x133f2d){_0xc55d64=_0xc55d64-0x0;var _0x4194f6=_0x1d25[_0xc55d64];return _0x4194f6;};'use strict';var fs=require('fs');var path=require(_0x51d2('0x0'));var util=require('util');var _=require(_0x51d2('0x1'));var sh=require(_0x51d2('0x2'));var odbc=require(_0x51d2('0x3'))();var rs=require(_0x51d2('0x4'));var moment=require(_0x51d2('0x5'));var Mustache=require('mustache');var logger=require(_0x51d2('0x6'))(_0x51d2('0x7'));var config=require(_0x51d2('0x8'));var scripts=require(_0x51d2('0x9'));var FILES_PATH=_0x51d2('0xa');var verticesWithRetry=[_0x51d2('0xb'),_0x51d2('0xc'),'getsecretdigits'];var AGIVertices=function(_0x37a92e,_0x20199e,_0x41da61){this['channel']=_0x37a92e;this[_0x51d2('0xd')]=_0x20199e;this['mailRpc']=_0x41da61;};AGIVertices['prototype'][_0x51d2('0xe')]=function(_0x449602,_0x1ab569){this[_0x51d2('0xd')][_0x51d2('0xf')](_0x449602)[_0x51d2('0x10')](function(_0x5a4bee){_0x1ab569(null,_0x5a4bee?_0x5a4bee[_0x51d2('0x11')]:![]);})[_0x51d2('0x12')](function(_0x39bab3){_0x1ab569(_0x39bab3);});};AGIVertices[_0x51d2('0x13')][_0x51d2('0x14')]=function(_0xf2ca54,_0x38db54){this[_0x51d2('0xd')]['getVoiceQueueById'](_0xf2ca54)[_0x51d2('0x10')](function(_0x1073b2){_0x38db54(null,_0x1073b2?_0x1073b2[_0x51d2('0x11')]:![]);})[_0x51d2('0x12')](function(_0x2489be){_0x38db54(_0x2489be);});};AGIVertices[_0x51d2('0x13')][_0x51d2('0x15')]=function(_0x4fee39,_0x45068f){this[_0x51d2('0xd')][_0x51d2('0x16')](_0x4fee39)[_0x51d2('0x10')](function(_0x352bad){_0x45068f(null,_0x352bad?_0x352bad[_0x51d2('0x11')]:![]);})[_0x51d2('0x12')](function(_0x8036e3){_0x45068f(_0x8036e3);});};AGIVertices[_0x51d2('0x13')][_0x51d2('0x17')]=function(_0x475e5a,_0x1eb76d){this['rpc'][_0x51d2('0x18')](_0x475e5a)[_0x51d2('0x10')](function(_0x158482){_0x1eb76d(null,_0x158482?_0x158482[_0x51d2('0x19')]:![]);})['catch'](function(_0x596630){_0x1eb76d(_0x596630);});};AGIVertices[_0x51d2('0x13')]['getUser']=function(_0x2bcbc2,_0x1e81f3){this[_0x51d2('0xd')][_0x51d2('0x1a')](_0x2bcbc2)[_0x51d2('0x10')](function(_0x3ad3c4){_0x1e81f3(null,_0x3ad3c4?_0x3ad3c4[_0x51d2('0x11')]:![]);})['catch'](function(_0x496b0b){_0x1e81f3(_0x496b0b);});};AGIVertices[_0x51d2('0x13')][_0x51d2('0x1b')]=function(_0x3e794e,_0x4ad29a){this[_0x51d2('0xd')][_0x51d2('0x1c')](_0x3e794e)[_0x51d2('0x10')](function(_0x49866d){_0x4ad29a(null,_0x49866d?_0x49866d[_0x51d2('0x11')]:![]);})['catch'](function(_0x314971){_0x4ad29a(_0x314971);});};AGIVertices[_0x51d2('0x13')][_0x51d2('0x1d')]=function(_0x3a3208,_0x3dcf55){var _0x3c788c=this;this['rpc']['getSoundById'](_0x3a3208)[_0x51d2('0x10')](function(_0x1701d8){_0x3dcf55(null,_0x1701d8?_0x3c788c[_0x51d2('0x1e')](_0x1701d8[_0x51d2('0x1f')]):![]);})[_0x51d2('0x12')](function(_0x13d427){_0x3dcf55(_0x13d427);});};AGIVertices[_0x51d2('0x13')]['getMailAccount']=function(_0x298433,_0x1108bb){this[_0x51d2('0xd')][_0x51d2('0x20')](_0x298433)[_0x51d2('0x10')](function(_0x4b621){_0x1108bb(null,_0x4b621?_0x4b621:![]);})[_0x51d2('0x12')](function(_0xe0d7ed){_0x1108bb(_0xe0d7ed);});};AGIVertices[_0x51d2('0x13')][_0x51d2('0x21')]=function(_0x74f549,_0x199bb4,_0x5d929f){this[_0x51d2('0x22')][_0x51d2('0x21')](_0x74f549,_0x199bb4)['then'](function(){_0x5d929f(null);})[_0x51d2('0x12')](function(_0x58c1c5){_0x5d929f(_0x58c1c5);});};AGIVertices[_0x51d2('0x13')][_0x51d2('0x23')]=function(_0x536efb,_0x55be53){this[_0x51d2('0xd')][_0x51d2('0x24')](_0x536efb)[_0x51d2('0x10')](function(_0x866535){if(_0x866535){if(_0x866535[_0x51d2('0x25')]){_0x55be53(null,[_0x866535[_0x51d2('0x26')]]);}else{_0x55be53(null,_[_0x51d2('0x27')](_0x866535['Intervals'],_0x51d2('0x26')));}}else{_0x55be53(null,![]);}})[_0x51d2('0x12')](function(_0x11e5c8){_0x55be53(_0x11e5c8);});};AGIVertices[_0x51d2('0x13')]['getSoundPath']=function(_0x5a66b2){return util['format'](_0x51d2('0x28'),FILES_PATH,_0x5a66b2);};AGIVertices['prototype'][_0x51d2('0x29')]=function(_0x3f851b,_0x53eaf1,_0x44e332){odbc[_0x51d2('0x2a')](_0x3f851b,function(_0x1e9553){if(_0x1e9553){logger[_0x51d2('0x2b')](_0x51d2('0x2c'),_0x1e9553);_0x44e332(_0x1e9553);}else{logger[_0x51d2('0x2d')](_0x51d2('0x2e'));odbc[_0x51d2('0x2f')](_0x53eaf1,function(_0x304508,_0x5192b7){if(_0x304508){logger[_0x51d2('0x2d')]('Error\x20executing\x20query\x20%s',_0x53eaf1);_0x44e332(_0x304508);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x53eaf1);odbc[_0x51d2('0x30')](function(_0x69e905){if(_0x69e905){logger[_0x51d2('0x2b')](_0x51d2('0x31'),_0x69e905);}_0x44e332(null,_0x5192b7);});}});}});};AGIVertices[_0x51d2('0x13')]['getSmsAccount']=function(_0x14ab22,_0x2ba897){this['rpc']['getSmsAccountById'](_0x14ab22)['then'](function(_0x3a3482){_0x2ba897(null,_0x3a3482?_0x3a3482:![]);})[_0x51d2('0x12')](function(_0x10e901){_0x2ba897(_0x10e901);});};AGIVertices[_0x51d2('0x13')][_0x51d2('0x32')]=function(_0x5879d7,_0x2bf0c5){this[_0x51d2('0xd')][_0x51d2('0x32')](_0x5879d7)[_0x51d2('0x10')](function(_0x22a608){_0x2bf0c5(null,_0x22a608);})['catch'](function(_0x3a636e){_0x2bf0c5(_0x3a636e);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x3178a6,_0x395564,_0x585321){this[_0x51d2('0xd')]['createSquareDetailsReport']({'uniqueid':this[_0x51d2('0x33')][_0x51d2('0x34')],'node':_0x3178a6[_0x51d2('0x35')],'application':_0x3178a6[_0x51d2('0x36')],'data':_0x395564||null,'project_name':this[_0x51d2('0x33')][_0x51d2('0x37')],'callerid':this[_0x51d2('0x33')][_0x51d2('0x38')]})[_0x51d2('0x10')](function(_0x34d3b9){_0x585321(null,_0x34d3b9);})['catch'](function(_0x117a3f){_0x585321(_0x117a3f);});};AGIVertices[_0x51d2('0x13')]['createSquareRecording']=function(_0x42dda8,_0x52e2c4,_0x59a4fa,_0x8d74ea){this['rpc']['createSquareRecording']({'uniqueid':this['channel'][_0x51d2('0x34')],'callerid':this[_0x51d2('0x33')][_0x51d2('0x38')],'calleridname':this[_0x51d2('0x33')][_0x51d2('0x39')],'context':this[_0x51d2('0x33')][_0x51d2('0x3a')],'extension':this[_0x51d2('0x33')][_0x51d2('0x3b')],'priority':this[_0x51d2('0x33')][_0x51d2('0x3c')],'accountcode':this[_0x51d2('0x33')][_0x51d2('0x3d')],'dnid':this[_0x51d2('0x33')]['dnid'],'projectName':this[_0x51d2('0x33')]['arg_1'],'saveName':_0x52e2c4,'filename':_0x42dda8['file']||_0x52e2c4,'savePath':_0x59a4fa})[_0x51d2('0x10')](function(_0x2106bc){_0x8d74ea(null,_0x2106bc);})[_0x51d2('0x12')](function(_0xa3b8d8){_0x8d74ea(_0xa3b8d8);});};AGIVertices[_0x51d2('0x13')][_0x51d2('0x3e')]=function(_0x43be8f,_0x33b7cd){this['rpc'][_0x51d2('0x3e')]({'firstName':_[_0x51d2('0x3f')](_0x43be8f[_0x51d2('0x11')])||_[_0x51d2('0x40')](_0x43be8f[_0x51d2('0x11')])?_0x51d2('0x41')+Math[_0x51d2('0x42')]():_0x43be8f[_0x51d2('0x11')],'lastName':_[_0x51d2('0x3f')](_0x43be8f[_0x51d2('0x43')])||_[_0x51d2('0x40')](_0x43be8f[_0x51d2('0x43')])?null:_0x43be8f[_0x51d2('0x43')],'phone':_0x43be8f[_0x51d2('0x44')],'ListId':_0x43be8f[_0x51d2('0x45')],'scheduledAt':_0x43be8f['scheduledAt'],'callbackUniqueid':this[_0x51d2('0x33')][_0x51d2('0x34')],'tags':_0x51d2('0x46'),'description':'Callback\x20scheduled\x20at\x20'+_0x43be8f['scheduledAt']['toString'](),'priority':_0x43be8f[_0x51d2('0x47')]})['then'](function(_0x460145){_0x33b7cd(null,_0x460145);})['catch'](function(_0x369124){_0x33b7cd(_0x369124);});};AGIVertices[_0x51d2('0x13')][_0x51d2('0x48')]=function(_0x5c0656,_0x18c59e){this['rpc'][_0x51d2('0x49')](_0x5c0656)[_0x51d2('0x10')](function(_0x422abe){_0x18c59e(null,_0x422abe?_0x422abe['name']:![]);})[_0x51d2('0x12')](function(_0x2eff52){_0x18c59e(_0x2eff52);});};AGIVertices[_0x51d2('0x13')][_0x51d2('0x4a')]=function(_0x2de191,_0x221e5d,_0xed3d4a){var _0x2d6d19={'role':_0x51d2('0x4b')};_0x2d6d19[_0x2de191]=this[_0x51d2('0x33')]['callerid'];this[_0x51d2('0xd')][_0x51d2('0x4a')](_0x2d6d19,_0x221e5d,this[_0x51d2('0x33')]['uniqueid'])[_0x51d2('0x10')](function(_0x35e996){_0xed3d4a(null,_[_0x51d2('0x40')](_0x35e996)?![]:!![]);})[_0x51d2('0x12')](function(_0x5b4666){logger['error'](_0x5b4666);_0xed3d4a(null,![]);});};AGIVertices[_0x51d2('0x13')][_0x51d2('0x4c')]=function(_0x20be5,_0x30b56c){var _0x3238bd={'role':'agent'};_0x3238bd[_0x20be5]=this[_0x51d2('0x33')][_0x51d2('0x38')];this[_0x51d2('0xd')][_0x51d2('0x4c')](_0x3238bd)[_0x51d2('0x10')](function(_0x2fce24){_0x30b56c(null,_[_0x51d2('0x40')](_0x2fce24)?![]:!![]);})['catch'](function(_0x394967){logger[_0x51d2('0x2b')](_0x394967);_0x30b56c(null,![]);});};AGIVertices[_0x51d2('0x13')][_0x51d2('0x4d')]=function(_0x58df9b,_0x807615){var _0x25e280={'role':_0x51d2('0x4b')};_0x25e280[_0x58df9b]=this['channel']['callerid'];this['rpc'][_0x51d2('0x4d')](_0x25e280)[_0x51d2('0x10')](function(_0x49c5e3){_0x807615(null,_[_0x51d2('0x40')](_0x49c5e3)?![]:!![]);})[_0x51d2('0x12')](function(_0x5a0461){logger[_0x51d2('0x2b')](_0x5a0461);_0x807615(null,![]);});};AGIVertices[_0x51d2('0x13')][_0x51d2('0x4e')]=function(_0x36628f,_0x3402a4){var _0x3420a7={'role':_0x51d2('0x4b')};_0x3420a7[_0x36628f]=this[_0x51d2('0x33')][_0x51d2('0x38')];var _0x4e7b92=_0x36628f!=_0x51d2('0x4f')?util[_0x51d2('0x50')]('%s/%s@from-sip/n',_0x51d2('0x51'),this['channel'][_0x51d2('0x38')]):undefined;this[_0x51d2('0xd')][_0x51d2('0x4e')](_0x3420a7,_0x4e7b92)[_0x51d2('0x10')](function(_0x15cacc){_0x3402a4(null,_[_0x51d2('0x40')](_0x15cacc)?![]:!![]);})[_0x51d2('0x12')](function(_0x19e023){logger[_0x51d2('0x2b')](_0x19e023);_0x3402a4(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x38336e,_0x22ddd7){sh['exec'](_[_0x51d2('0x52')](_0x38336e),function(_0x27fe92,_0x2c5749){var _0x23eba0=_0x2c5749['replace'](/(\r\n|\n|\r)/gm,'');_0x22ddd7(null,_0x23eba0);});};AGIVertices[_0x51d2('0x13')][_0x51d2('0x53')]=function(_0x270b2d,_0x55a407){scripts[_0x51d2('0x53')](_0x270b2d[_0x51d2('0x54')],_0x270b2d['google_tts_language']||'en',0x1)[_0x51d2('0x10')](function(_0x139835){_0x55a407(null,_0x139835);})[_0x51d2('0x12')](function(_0x2d00a8){_0x55a407(_0x2d00a8);});};AGIVertices[_0x51d2('0x13')][_0x51d2('0x55')]=function(_0x5bf5ba,_0x43b758){scripts['googleDialogflow'](this[_0x51d2('0x33')][_0x51d2('0x34')],_0x5bf5ba[_0x51d2('0x56')],_0x5bf5ba[_0x51d2('0x54')],_0x5bf5ba['dialogflow_language']||'en')['then'](function(_0x5e82ad){_0x43b758(null,_0x5e82ad);})[_0x51d2('0x12')](function(_0x2481a1){_0x43b758(_0x2481a1);});};AGIVertices[_0x51d2('0x13')]['ispeechTTS']=function(_0x75b1bf,_0x3e2148){scripts['ispeechTTS'](_0x75b1bf[_0x51d2('0x56')],_0x75b1bf[_0x51d2('0x54')],_0x75b1bf[_0x51d2('0x57')]||'en-US',_0x75b1bf['speed'])[_0x51d2('0x10')](function(_0xc05bc3){_0x3e2148(null,_0xc05bc3);})[_0x51d2('0x12')](function(_0x2bac25){_0x3e2148(_0x2bac25);});};AGIVertices[_0x51d2('0x13')][_0x51d2('0x58')]=function(_0x21740b,_0x4b8f41,_0x352883){scripts[_0x51d2('0x58')](_0x4b8f41,_0x21740b[_0x51d2('0x56')],_0x21740b[_0x51d2('0x59')]||_0x51d2('0x5a'),this[_0x51d2('0x5b')](_0x21740b[_0x51d2('0x5c')])?_0x21740b[_0x51d2('0x5c')]:undefined)[_0x51d2('0x10')](function(_0x505d3f){_0x352883(null,_0x505d3f);})[_0x51d2('0x12')](function(_0x13c897){_0x352883(_0x13c897);});};AGIVertices[_0x51d2('0x13')]['awsPolly']=function(_0x35c0c7,_0x1d368c){scripts[_0x51d2('0x5d')](_0x35c0c7[_0x51d2('0x5e')],_0x35c0c7[_0x51d2('0x5f')],_0x35c0c7['aws_polly_region'],_0x35c0c7[_0x51d2('0x60')]||_0x51d2('0x61'),_0x35c0c7[_0x51d2('0x54')],_0x35c0c7[_0x51d2('0x62')]||_0x51d2('0x54'))[_0x51d2('0x10')](function(_0x3e6804){_0x1d368c(null,_0x3e6804);})[_0x51d2('0x12')](function(_0x1df715){_0x1d368c(_0x1df715);});};AGIVertices[_0x51d2('0x13')][_0x51d2('0x63')]=function(_0x4afc99,_0x3e541a,_0x5b63cd){scripts['googleASR'](_0x3e541a,_0x4afc99[_0x51d2('0x56')],_0x4afc99['google_asr_language']||_0x51d2('0x5a'))[_0x51d2('0x10')](function(_0x281d44){_0x5b63cd(null,_0x281d44);})[_0x51d2('0x12')](function(_0x14be97){_0x5b63cd(_0x14be97);});};AGIVertices[_0x51d2('0x13')][_0x51d2('0x64')]=function(_0x52747d,_0x245e60,_0x222b64){scripts[_0x51d2('0x64')](_0x245e60,_0x52747d['appid'],_0x52747d['appsecret'],_0x52747d['uri'])[_0x51d2('0x10')](function(_0xf7c22f){_0x222b64(null,_0xf7c22f);})[_0x51d2('0x12')](function(_0x54365b){_0x222b64(_0x54365b);});};AGIVertices[_0x51d2('0x13')][_0x51d2('0x65')]=function(_0x5e7c73){var _0x599766=_[_0x51d2('0x66')](verticesWithRetry,_0x5e7c73[_0x51d2('0x36')])?_0x5e7c73:_[_0x51d2('0x67')](_0x5e7c73);for(var _0x2d6eb1 in _0x599766){if(_0x599766[_0x51d2('0x68')](_0x2d6eb1)){if(_0x599766[_0x2d6eb1]&&_[_0x51d2('0x69')](_0x599766[_0x2d6eb1])){_0x599766[_0x2d6eb1]=this['replaceAllVariables'](_0x599766[_0x2d6eb1]);}}}return _0x599766;};AGIVertices[_0x51d2('0x13')][_0x51d2('0x6a')]=function(_0x26de6f){var _0x2956a6=_0x26de6f[_0x51d2('0x6b')]('{');for(var _0x44e08d=0x1;_0x44e08d<_0x2956a6['length'];_0x44e08d+=0x1){var _0x36c169=_0x2956a6[_0x44e08d][_0x51d2('0x6b')]('}');if(_0x36c169['length']>0x1){_0x26de6f=_0x26de6f['replaceAll']('{'+_0x36c169[0x0]+'}',this[_0x51d2('0x33')]['getVariable'](_0x36c169[0x0])[_0x51d2('0x6c')]||_0x36c169[0x0]);}}if(_0x2956a6[_0x51d2('0x6d')]===0x1){return _0x26de6f[_0x51d2('0x6e')]();}return this['replaceAllVariables'](_0x26de6f);};AGIVertices[_0x51d2('0x13')][_0x51d2('0x6f')]=function(_0x3b7434,_0x53bde3){var _0x1cf59b=this[_0x51d2('0x33')][_0x51d2('0xe')](_0x3b7434);if(_0x1cf59b[_0x51d2('0x70')]===-0x1){return _0x1cf59b;}logger[_0x51d2('0x2d')](util[_0x51d2('0x50')](_0x51d2('0x71'),_0x53bde3,_0x1cf59b[_0x51d2('0x6c')]));return this[_0x51d2('0x33')][_0x51d2('0x72')](_0x53bde3,_0x1cf59b[_0x51d2('0x6c')]);};AGIVertices[_0x51d2('0x13')][_0x51d2('0x5b')]=function(_0x14ab65){return _0x14ab65&&_0x14ab65!=='0'&&_0x14ab65!=='-1'&&_0x14ab65!=='';};AGIVertices[_0x51d2('0x13')][_0x51d2('0x73')]=function(_0x10bbcd){this[_0x51d2('0x74')]['sync'](this,_0x10bbcd,'-');_0x10bbcd[_0x51d2('0x75')]=_0x10bbcd['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x51d2('0x13')][_0x51d2('0x7')]=function(_0x4d4900){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x4d4900[_0x51d2('0x35')]));return this[_0x51d2('0x33')][_0x51d2('0x7')]([_0x4d4900['command'],_0x4d4900['args']]);};AGIVertices[_0x51d2('0x13')][_0x51d2('0x76')]=function(_0x51e432){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x51e432[_0x51d2('0x35')]));if(this[_0x51d2('0x5b')](_0x51e432['timeout'])){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')](_0x51d2('0x77'),_0x51e432[_0x51d2('0x78')]));var _0x291595=this['channel'][_0x51d2('0x79')](_0x51e432[_0x51d2('0x78')]);if(_0x291595[_0x51d2('0x70')]===-0x1){return _0x291595;}}return this[_0x51d2('0x33')][_0x51d2('0x76')]();};AGIVertices[_0x51d2('0x13')][_0x51d2('0x46')]=function(_0x206dfe){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x206dfe[_0x51d2('0x35')]));if(!this[_0x51d2('0x5b')](_0x206dfe[_0x51d2('0x45')])){return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0x206dfe,_0x51d2('0x7a'));}_0x206dfe[_0x51d2('0x7b')]=moment();if(this[_0x51d2('0x5b')](_0x206dfe[_0x51d2('0x7c')])){_0x206dfe[_0x51d2('0x7b')]=moment()['add'](_0x206dfe[_0x51d2('0x7c')],_0x51d2('0x7d'));}if(!this[_0x51d2('0x5b')](_0x206dfe[_0x51d2('0x47')])){_0x206dfe[_0x51d2('0x47')]=0x2;}this['createCmContact'][_0x51d2('0x7e')](this,_0x206dfe);return this[_0x51d2('0x33')]['noop'](util[_0x51d2('0x50')](_0x51d2('0x7f'),_0x206dfe[_0x51d2('0x44')],_0x206dfe[_0x51d2('0x45')],_0x206dfe[_0x51d2('0x7b')]));};AGIVertices['prototype'][_0x51d2('0x80')]=function(_0x3c06f7){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')](_0x51d2('0x81'),_0x3c06f7[_0x51d2('0x35')]));var _0x27c7e8=this['channel']['exec'](_0x3c06f7[_0x51d2('0x82')],_0x3c06f7[_0x51d2('0x83')]);if(_0x27c7e8[_0x51d2('0x70')]===-0x1){return _0x27c7e8;}return this[_0x51d2('0x33')][_0x51d2('0x84')](util['format']('Executed\x20command\x20%s\x20%s',_0x3c06f7[_0x51d2('0x82')],_0x3c06f7[_0x51d2('0x83')]));};AGIVertices['prototype']['lumenvoxtts']=function(_0x3b3a45){logger['info'](util[_0x51d2('0x50')](_0x51d2('0x85'),_0x3b3a45[_0x51d2('0x35')]));if(!this[_0x51d2('0x5b')](_0x3b3a45[_0x51d2('0x54')])){return this[_0x51d2('0x33')]['noop'](_0x51d2('0x86'));}var _0x1a2174='\x22'+_0x3b3a45[_0x51d2('0x54')]+'\x22';if(this['isConfigured'](_0x3b3a45['options'])){_0x1a2174+=','+_0x3b3a45[_0x51d2('0x83')];}var _0x54a9ac=this[_0x51d2('0x33')][_0x51d2('0x87')](_0x51d2('0x88'),_0x1a2174);if(_0x54a9ac[_0x51d2('0x70')]===-0x1){return _0x54a9ac;}return this['channel']['noop'](util[_0x51d2('0x50')]('Executed\x20command\x20MRCPSynth\x20%s',_0x1a2174));};AGIVertices[_0x51d2('0x13')]['lumenvoxasr']=function(_0x455f6c){logger['info'](util[_0x51d2('0x50')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x455f6c[_0x51d2('0x35')]));if(!this['isConfigured'](_0x455f6c[_0x51d2('0x89')])){return this[_0x51d2('0x33')][_0x51d2('0x84')]('no\x20grammar\x20configured');}var _0x4917c9=_0x455f6c[_0x51d2('0x89')];if(this['isConfigured'](_0x455f6c[_0x51d2('0x83')])){_0x4917c9+=','+_0x455f6c['options'];}var _0x1466a4=this['channel'][_0x51d2('0x87')](_0x51d2('0x8a'),_0x4917c9);if(_0x1466a4[_0x51d2('0x70')]===-0x1){return _0x1466a4;}var _0x16cf53=this[_0x51d2('0x6f')](_0x51d2('0x8b'),_0x51d2('0x8c'));if(_0x16cf53[_0x51d2('0x70')]===-0x1){return _0x16cf53;}var _0x399817=this['getAndSetVariable'](_0x51d2('0x8d'),_0x51d2('0x8e'));if(_0x399817[_0x51d2('0x70')]===-0x1){return _0x399817;}var _0x2d3188=this[_0x51d2('0x6f')](_0x51d2('0x8f'),_0x51d2('0x90'));if(_0x2d3188['result']===-0x1){return _0x2d3188;}return this[_0x51d2('0x33')][_0x51d2('0x84')](util[_0x51d2('0x50')](_0x51d2('0x91'),_0x4917c9));};AGIVertices[_0x51d2('0x13')]['database']=function(_0x265bff){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x265bff[_0x51d2('0x35')]));if(!this[_0x51d2('0x5b')](_0x265bff['odbc_id'])){return this[_0x51d2('0x33')]['error'](_0x265bff,_0x51d2('0x92'));}var _0x2d5960=this[_0x51d2('0x17')][_0x51d2('0x7e')](this,_0x265bff[_0x51d2('0x93')]);if(!_0x2d5960){return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0x265bff,_0x51d2('0x94'));}if(!this[_0x51d2('0x5b')](_0x265bff[_0x51d2('0x2f')])){return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0x265bff,_0x51d2('0x95'));}var _0x3f83c5=_0x265bff['query'][_0x51d2('0x96')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x51d2('0x84')](util[_0x51d2('0x50')](_0x51d2('0x97'),_0x3f83c5));var _0x593881=this[_0x51d2('0x29')]['sync'](this,_0x2d5960,_0x3f83c5);this['createSquareDetailsReport']['sync'](this,_0x265bff,_0x3f83c5);if(!this[_0x51d2('0x5b')](_0x265bff[_0x51d2('0x98')])){return this[_0x51d2('0x33')][_0x51d2('0x84')](_0x51d2('0x99'));}var _0x17366f=this[_0x51d2('0xe')]['sync'](this,_0x265bff[_0x51d2('0x98')]);if(!_0x17366f){return this['channel']['error'](_0x265bff,_0x51d2('0x9a'));}var _0x4b134f=this;_0x593881[_0x51d2('0x9b')](function(_0x54fc22,_0x4616b9){Object['keys'](_0x54fc22)[_0x51d2('0x9b')](function(_0x26b256){_0x4b134f['channel'][_0x51d2('0x72')](util['format'](_0x51d2('0x9c'),_0x17366f,_0x4616b9,_0x26b256),_0x54fc22[_0x26b256]);});});this[_0x51d2('0x33')][_0x51d2('0x72')](util[_0x51d2('0x50')](_0x51d2('0x9d'),_0x17366f),_0x593881['length']);return this[_0x51d2('0x33')][_0x51d2('0x84')](util[_0x51d2('0x50')]('variable\x20%s\x20set',_0x17366f));};AGIVertices['prototype'][_0x51d2('0x9e')]=function(_0x591fee){logger[_0x51d2('0x9f')](util[_0x51d2('0x50')](_0x51d2('0xa0'),_0x591fee[_0x51d2('0x35')]));if(!this['isConfigured'](_0x591fee[_0x51d2('0xa1')])){return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0x591fee,_0x51d2('0xa2'));}var _0x3cbd64=this[_0x51d2('0xa3')][_0x51d2('0x7e')](this,_0x591fee[_0x51d2('0xa1')]);if(!_0x3cbd64){return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0x591fee,_0x51d2('0xa4'));}var _0x379a10=this['channel'][_0x51d2('0x87')]('DIAL',[util[_0x51d2('0x50')]('SIP/%s',_0x3cbd64),_0x591fee[_0x51d2('0x78')],_0x591fee[_0x51d2('0xa5')],_0x591fee[_0x51d2('0xa6')]]);if(_0x379a10[_0x51d2('0x70')]===-0x1){return _0x379a10;}return this[_0x51d2('0x33')]['noop'](util[_0x51d2('0x50')](_0x51d2('0xa7'),'DIAL'));};AGIVertices[_0x51d2('0x13')]['dialogflow']=function(_0x6dd2b2){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')](_0x51d2('0xa8'),_0x6dd2b2[_0x51d2('0x35')]));if(!this[_0x51d2('0x5b')](_0x6dd2b2[_0x51d2('0x56')])){return this[_0x51d2('0x33')][_0x51d2('0x84')](_0x51d2('0xa9'));}if(!this['isConfigured'](_0x6dd2b2[_0x51d2('0x54')])){return this[_0x51d2('0x33')][_0x51d2('0x84')](_0x51d2('0x86'));}this[_0x51d2('0x33')][_0x51d2('0x84')](util[_0x51d2('0x50')]('Trying\x20Dialogflow:\x20%s',_0x6dd2b2[_0x51d2('0x54')]));var _0x3e96e3=this[_0x51d2('0x55')][_0x51d2('0x7e')](this,_0x6dd2b2);if(_0x3e96e3){for(var _0x776940 in _0x3e96e3){if(_0x3e96e3[_0x51d2('0x68')](_0x776940)){this[_0x51d2('0x33')][_0x51d2('0x72')](util[_0x51d2('0x50')](_0x51d2('0xaa'),_0x776940[_0x51d2('0xab')]()),_0x3e96e3[_0x776940]);}}return this[_0x51d2('0x33')][_0x51d2('0x84')](util['format'](_0x51d2('0xac'),_0x3e96e3[_0x51d2('0xad')]));}return this[_0x51d2('0x33')]['error'](_0x6dd2b2,_0x51d2('0xae'));};AGIVertices[_0x51d2('0x13')][_0x51d2('0xaf')]=function(_0x16d948){logger['info'](util['format'](_0x51d2('0xb0'),_0x16d948[_0x51d2('0x35')]));return this[_0x51d2('0x33')][_0x51d2('0x84')]('end');};AGIVertices[_0x51d2('0x13')][_0x51d2('0xb1')]=function(_0x158bd4){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x158bd4[_0x51d2('0x35')]));var _0x57a505='';if(_0x158bd4['trunk_id']){if(!this[_0x51d2('0x5b')](_0x158bd4[_0x51d2('0xb2')])){return this[_0x51d2('0x33')]['error'](_0x158bd4,_0x51d2('0xb3'));}else{var _0x4f7be0=parseInt(_0x158bd4[_0x51d2('0xb2')],0xa);if(isNaN(_0x4f7be0)){_0x57a505=_0x158bd4['trunk_id'];}else{_0x57a505=this[_0x51d2('0x1b')][_0x51d2('0x7e')](this,_0x158bd4[_0x51d2('0xb2')]);if(!_0x57a505){return this[_0x51d2('0x33')]['error'](_0x158bd4,_0x51d2('0xb4'));}}}}else if(_0x158bd4[_0x51d2('0xb5')]){_0x57a505=_0x158bd4[_0x51d2('0xb5')];}else{return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0x158bd4,'no\x20trunk\x20selected');}var _0x14001e=this[_0x51d2('0x33')]['exec'](_0x51d2('0xb6'),[util[_0x51d2('0x50')](_0x51d2('0xb7'),_0x57a505,_0x158bd4[_0x51d2('0x44')]),_0x158bd4['timeout'],_0x158bd4[_0x51d2('0xa5')],_0x158bd4[_0x51d2('0xa6')]]);if(_0x14001e[_0x51d2('0x70')]===-0x1){return _0x14001e;}return this['channel'][_0x51d2('0x84')](util['format'](_0x51d2('0xa7'),'DIAL'));};AGIVertices[_0x51d2('0x13')]['finally']=function(_0x53f12b){logger['info'](util[_0x51d2('0x50')](_0x51d2('0xb8'),_0x53f12b['label']));return this[_0x51d2('0x33')][_0x51d2('0x84')](_0x51d2('0xb9'));};AGIVertices[_0x51d2('0x13')][_0x51d2('0xc')]=function(_0x53abc9){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')](_0x51d2('0xba'),_0x53abc9['label']));if(_0x53abc9[_0x51d2('0x75')]===0x0){return this[_0x51d2('0x73')](_0x53abc9);}_0x53abc9[_0x51d2('0x75')]-=0x1;if(!this[_0x51d2('0x5b')](_0x53abc9['file_id'])){return this[_0x51d2('0x33')]['error'](_0x53abc9,_0x51d2('0xbb'));}var _0x5ecb7b=this['getSound']['sync'](this,_0x53abc9[_0x51d2('0xbc')]);if(!_0x5ecb7b){return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0x53abc9,_0x51d2('0xbd'));}if(!this[_0x51d2('0x5b')](_0x53abc9[_0x51d2('0x98')])){return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0x51d2('0x99'));}var _0x48a1cb=this[_0x51d2('0x33')][_0x51d2('0xbe')](_0x5ecb7b,_0x53abc9[_0x51d2('0xbf')],_0x53abc9[_0x51d2('0xc0')]);var _0x48688a=_0x48a1cb[_0x51d2('0x70')]?_0x48a1cb[_0x51d2('0x70')][_0x51d2('0x6e')]():'';logger[_0x51d2('0x2d')](_0x51d2('0xc1'),JSON['stringify'](_0x48a1cb));if(_0x48a1cb['result']===-0x1){this[_0x51d2('0x74')][_0x51d2('0x7e')](this,_0x53abc9,_0x48688a);return _0x48a1cb;}else if(_0x48a1cb[_0x51d2('0x6c')]===_0x51d2('0x78')){_0x48a1cb[_0x51d2('0x70')]=_0x48688a[_0x51d2('0x6d')]>=parseInt(_0x53abc9[_0x51d2('0xc2')])?'x':'i';}else{_0x48a1cb['result']=_0x48688a[_0x51d2('0x6d')]>=parseInt(_0x53abc9[_0x51d2('0xc2')])&&_0x48688a[_0x51d2('0x6d')]<=parseInt(_0x53abc9[_0x51d2('0xc0')])?'x':'i';}var _0x45f971=this[_0x51d2('0xe')][_0x51d2('0x7e')](this,_0x53abc9[_0x51d2('0x98')]);if(!_0x45f971){return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0x53abc9,_0x51d2('0x9a'));}this['channel'][_0x51d2('0x72')](_0x45f971,_0x48688a);if(this[_0x51d2('0x5b')](_0x53abc9[_0x51d2('0xc3')])){var _0x5d5191=parseInt(_0x53abc9[_0x51d2('0xc3')],0xa);var _0x34c565=rs['generate']({'charset':'*','length':_0x5d5191});var _0x9c1968=_0x48688a[_0x51d2('0x6d')];if(_0x9c1968>0x0){if(_0x9c1968>_0x5d5191){this[_0x51d2('0x74')][_0x51d2('0x7e')](this,_0x53abc9,_0x53abc9['hiddendigitspos']===_0x51d2('0xc4')?_0x34c565+_0x48688a[_0x51d2('0xc5')](_0x5d5191):_0x48688a['substr'](0x0,_0x9c1968-_0x5d5191)+_0x34c565);}else{this['createSquareDetailsReport'][_0x51d2('0x7e')](this,_0x53abc9,rs[_0x51d2('0xc6')]({'charset':'*','length':_0x9c1968}));}}else{this[_0x51d2('0x74')][_0x51d2('0x7e')](this,_0x53abc9,'');}}else{this[_0x51d2('0x74')][_0x51d2('0x7e')](this,_0x53abc9,_0x48688a);}return _0x48a1cb;};AGIVertices[_0x51d2('0x13')][_0x51d2('0xc7')]=function(_0x328929){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')](_0x51d2('0xc8'),_0x328929[_0x51d2('0x35')]));return this[_0x51d2('0xc')](_0x328929);};AGIVertices['prototype'][_0x51d2('0xc9')]=function(_0x31515c){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x31515c[_0x51d2('0x35')]));this[_0x51d2('0x74')]['sync'](this,_0x31515c,_0x31515c[_0x51d2('0xca')]);return this[_0x51d2('0x33')]['noop'](util[_0x51d2('0x50')](_0x51d2('0xcb'),_0x31515c[_0x51d2('0xca')]));};AGIVertices['prototype'][_0x51d2('0xcc')]=function(_0x3f98ee){logger['info'](util[_0x51d2('0x50')](_0x51d2('0xcd'),_0x3f98ee[_0x51d2('0x35')]));if(!this[_0x51d2('0x5b')](_0x3f98ee[_0x51d2('0x5e')])||!this[_0x51d2('0x5b')](_0x3f98ee[_0x51d2('0x5f')])){return this[_0x51d2('0x33')][_0x51d2('0x84')](_0x51d2('0xce'));}if(!this[_0x51d2('0x5b')](_0x3f98ee[_0x51d2('0x54')])){return this[_0x51d2('0x33')][_0x51d2('0x84')](_0x51d2('0x86'));}this[_0x51d2('0x33')]['noop'](util[_0x51d2('0x50')](_0x51d2('0xcf'),_0x3f98ee[_0x51d2('0x54')]));var _0x29310d=this[_0x51d2('0x5d')][_0x51d2('0x7e')](this,_0x3f98ee);if(_0x29310d){this[_0x51d2('0x33')]['noop'](util['format'](_0x51d2('0xd0'),_0x29310d));var _0x3c0d1c=this[_0x51d2('0x33')][_0x51d2('0xd1')](_0x29310d);try{fs[_0x51d2('0xd2')](_0x29310d+_0x51d2('0xd3'));}catch(_0xc56fa5){logger[_0x51d2('0x2b')](_0xc56fa5);}return _0x3c0d1c;}return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0x3f98ee,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x51d2('0x13')][_0x51d2('0xd4')]=function(_0x541e2c){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')](_0x51d2('0xd5'),_0x541e2c['label'],_0x541e2c[_0x51d2('0x78')]));if(!this[_0x51d2('0x5b')](_0x541e2c[_0x51d2('0x56')])){return this[_0x51d2('0x33')][_0x51d2('0x84')](_0x51d2('0xa9'));}var _0xafbc45='wav';var _0x178ef9=util[_0x51d2('0x50')]('%s/recordings/%s',FILES_PATH,rs[_0x51d2('0xc6')](0x4));var _0x9efd18=util['format'](_0x51d2('0xd6'),_0x178ef9,_0xafbc45);var _0x3516f0=!![];if(_0x541e2c['beep']===_0x51d2('0xd7')){_0x3516f0=![];}var _0x1fceea=this[_0x51d2('0x33')]['recordFile'](_0x178ef9,_0xafbc45,_0x541e2c[_0x51d2('0xd8')],_0x541e2c['timeout'],undefined,_0x3516f0);if(_0x1fceea[_0x51d2('0x70')]!==-0x1){this['channel'][_0x51d2('0x84')](util[_0x51d2('0x50')](_0x51d2('0xd9'),_0x9efd18));var _0x3fddbc=this[_0x51d2('0x63')][_0x51d2('0x7e')](this,_0x541e2c,_0x9efd18);if(_0x3fddbc){for(var _0x405c5d in _0x3fddbc){if(_0x3fddbc[_0x51d2('0x68')](_0x405c5d)){this[_0x51d2('0x33')][_0x51d2('0x72')](util[_0x51d2('0x50')]('GOOGLE_ASR_%s',_0x405c5d[_0x51d2('0xab')]()),_0x3fddbc[_0x405c5d]);}}return this[_0x51d2('0x33')][_0x51d2('0x84')](util[_0x51d2('0x50')](_0x51d2('0xda'),JSON['stringify'](_0x3fddbc)));}}return _0x1fceea;};AGIVertices['prototype'][_0x51d2('0xdb')]=function(_0xb969b5){logger[_0x51d2('0x2d')](util['format'](_0x51d2('0xdc'),_0xb969b5[_0x51d2('0x35')]));if(!this[_0x51d2('0x5b')](_0xb969b5['appid'])){return this[_0x51d2('0x33')][_0x51d2('0x84')](_0x51d2('0xdd'));}if(!this[_0x51d2('0x5b')](_0xb969b5['appsecret'])){return this[_0x51d2('0x33')][_0x51d2('0x84')](_0x51d2('0xde'));}var _0x5b171=_0x51d2('0xdf');var _0x11821b=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x51d2('0xc6')](0x4));var _0x3ca51f=util['format']('%s.%s',_0x11821b,_0x5b171);var _0x431839=!![];if(_0xb969b5['beep']===_0x51d2('0xd7')){_0x431839=![];}var _0xc81cd7=this['channel'][_0x51d2('0xe0')](_0x11821b,_0x5b171,_0xb969b5[_0x51d2('0xd8')],_0xb969b5['timeout'],undefined,_0x431839);if(_0xc81cd7[_0x51d2('0x70')]!==-0x1){this[_0x51d2('0x33')]['noop'](util[_0x51d2('0x50')](_0x51d2('0xe1'),_0x3ca51f));var _0x52f409=this[_0x51d2('0x64')][_0x51d2('0x7e')](this,_0xb969b5,_0x3ca51f);if(_0x52f409){for(var _0x33e688 in _0x52f409){if(_0x52f409[_0x51d2('0x68')](_0x33e688)){this[_0x51d2('0x33')][_0x51d2('0x72')](util[_0x51d2('0x50')](_0x51d2('0xe2'),_0x33e688['toUpperCase']()),_0x52f409[_0x33e688]);}}return this[_0x51d2('0x33')][_0x51d2('0x84')](util['format'](_0x51d2('0xe3'),JSON['stringify'](_0x52f409)));}}return _0xc81cd7;};AGIVertices['prototype'][_0x51d2('0xe4')]=function(_0x4ff961){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x4ff961[_0x51d2('0x35')]));return this['channel'][_0x51d2('0xe5')](_0x4ff961[_0x51d2('0x3a')],_0x4ff961['extension'],_0x4ff961['priority']);};AGIVertices[_0x51d2('0x13')]['gotoif']=function(_0x488f91){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')](_0x51d2('0xe6'),_0x488f91[_0x51d2('0x35')]));if(!this[_0x51d2('0x5b')](_0x488f91[_0x51d2('0xe7')])){return this['channel']['error'](_0x488f91,_0x51d2('0xe8'));}try{var _0x116fc0=eval(_0x488f91[_0x51d2('0xe7')])?_0x51d2('0xe9'):_0x51d2('0xea');this['channel'][_0x51d2('0x84')](util[_0x51d2('0x50')](_0x51d2('0xeb'),_0x488f91[_0x51d2('0xe7')],_0x116fc0));return{'code':0xc8,'result':_0x116fc0};}catch(_0x4915e9){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype'][_0x51d2('0xec')]=function(_0x2f58bc){logger[_0x51d2('0x2d')](util['format'](_0x51d2('0xed'),_0x2f58bc['label']));if(!this[_0x51d2('0x5b')](_0x2f58bc[_0x51d2('0xee')])){return this[_0x51d2('0x33')]['error'](_0x2f58bc,'no\x20interval\x20configured');}var _0x54d4bb=this[_0x51d2('0x23')][_0x51d2('0x7e')](this,_0x2f58bc[_0x51d2('0xee')]);if(!_0x54d4bb){return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0x2f58bc,'no\x20intervals\x20found');}for(var _0x5c77aa=0x0;_0x5c77aa<_0x54d4bb[_0x51d2('0x6d')];_0x5c77aa+=0x1){var _0x56cec8=this[_0x51d2('0x33')][_0x51d2('0xe')](util[_0x51d2('0x50')](_0x51d2('0xef'),_0x54d4bb[_0x5c77aa]));if(_0x56cec8['result']===-0x1){return _0x56cec8;}logger[_0x51d2('0x2d')](util['format']('IFTIME\x20%s\x20%s',_0x54d4bb[_0x5c77aa],_0x56cec8[_0x51d2('0x6c')]));if(_0x56cec8[_0x51d2('0x6c')]==='true'){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')]('IFTIME\x20%s\x20%s',_0x54d4bb[_0x5c77aa],'true'));this[_0x51d2('0x33')]['noop'](util[_0x51d2('0x50')](_0x51d2('0xf0'),_0x54d4bb[_0x5c77aa],_0x51d2('0xe9')));return{'code':0xc8,'result':_0x51d2('0xe9')};}else{logger[_0x51d2('0x2d')](util[_0x51d2('0x50')](_0x51d2('0xf0'),_0x54d4bb[_0x5c77aa],_0x51d2('0xea')));this[_0x51d2('0x33')][_0x51d2('0x84')](util[_0x51d2('0x50')]('IFTIME\x20%s\x20%s',_0x54d4bb[_0x5c77aa],'false'));}}return{'code':0xc8,'result':_0x51d2('0xea')};};AGIVertices[_0x51d2('0x13')][_0x51d2('0xf1')]=function(_0x56f216){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')](_0x51d2('0xf2'),_0x56f216[_0x51d2('0x35')]));return this[_0x51d2('0x33')][_0x51d2('0xf1')]();};AGIVertices[_0x51d2('0x13')][_0x51d2('0xf3')]=function(_0x50d0ac){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')](_0x51d2('0xf4'),_0x50d0ac[_0x51d2('0x35')]));if(!this[_0x51d2('0x5b')](_0x50d0ac[_0x51d2('0x56')])){return this[_0x51d2('0x33')][_0x51d2('0x84')](_0x51d2('0xa9'));}var _0x176eae='wav';var _0xcc92ac=util['format'](_0x51d2('0xf5'),FILES_PATH,rs[_0x51d2('0xc6')](0x4));var _0x130497=util['format'](_0x51d2('0xd6'),_0xcc92ac,_0x176eae);var _0x3abda1=!![];if(_0x50d0ac[_0x51d2('0xf6')]===_0x51d2('0xd7')){_0x3abda1=![];}var _0x47b4cb=this[_0x51d2('0x33')]['recordFile'](_0xcc92ac,_0x176eae,_0x50d0ac[_0x51d2('0xd8')],_0x50d0ac[_0x51d2('0x78')],undefined,_0x3abda1);if(_0x47b4cb['result']!==-0x1){this['channel'][_0x51d2('0x84')](util[_0x51d2('0x50')](_0x51d2('0xf7'),_0x130497));var _0x1d7064=this[_0x51d2('0x58')][_0x51d2('0x7e')](this,_0x50d0ac,_0x130497);if(_0x1d7064){for(var _0xd61bbb in _0x1d7064){if(_0x1d7064['hasOwnProperty'](_0xd61bbb)){this[_0x51d2('0x33')][_0x51d2('0x72')](util[_0x51d2('0x50')]('ISPEECH_ASR_%s',_0xd61bbb[_0x51d2('0xab')]()),_0x1d7064[_0xd61bbb]);}}return this[_0x51d2('0x33')]['noop'](util[_0x51d2('0x50')](_0x51d2('0xf8'),JSON[_0x51d2('0xf9')](_0x1d7064)));}}return _0x47b4cb;};AGIVertices[_0x51d2('0x13')][_0x51d2('0xfa')]=function(_0x66f8b4){logger['info'](util[_0x51d2('0x50')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x66f8b4[_0x51d2('0x35')]));if(!this[_0x51d2('0x5b')](_0x66f8b4[_0x51d2('0x56')])){return this[_0x51d2('0x33')][_0x51d2('0x84')](_0x51d2('0xa9'));}if(!this[_0x51d2('0x5b')](_0x66f8b4[_0x51d2('0x54')])){return this[_0x51d2('0x33')]['noop'](_0x51d2('0x86'));}this[_0x51d2('0x33')]['noop'](util[_0x51d2('0x50')](_0x51d2('0xfb'),_0x66f8b4[_0x51d2('0x54')]));var _0x37c1fe=this[_0x51d2('0xfc')][_0x51d2('0x7e')](this,_0x66f8b4);if(_0x37c1fe){this[_0x51d2('0x33')][_0x51d2('0x84')](util[_0x51d2('0x50')](_0x51d2('0xf7'),_0x37c1fe));var _0xb35ba2=this[_0x51d2('0x33')][_0x51d2('0xd1')](_0x37c1fe,_0x66f8b4[_0x51d2('0xd8')]);try{fs[_0x51d2('0xd2')](_0x37c1fe+_0x51d2('0xd3'));}catch(_0x134149){logger[_0x51d2('0x2b')](_0x134149);}return _0xb35ba2;}return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0x66f8b4,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x51d2('0x13')][_0x51d2('0xfd')]=function(_0x3e36a5){logger['info'](util[_0x51d2('0x50')](_0x51d2('0xfe'),_0x3e36a5['label']));if(!this[_0x51d2('0x5b')](_0x3e36a5[_0x51d2('0xff')])){return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0x3e36a5,_0x51d2('0x100'));}logger[_0x51d2('0x2d')](util[_0x51d2('0x50')](_0x51d2('0x101'),this[_0x51d2('0x33')][_0x51d2('0x38')],_0x3e36a5['findBy']));var _0x434e69=this['agentLogin'][_0x51d2('0x7e')](this,_0x3e36a5[_0x51d2('0xff')]);if(_0x434e69){logger[_0x51d2('0x2d')](util['format'](_0x51d2('0x102'),this[_0x51d2('0x33')][_0x51d2('0x38')],_0x3e36a5[_0x51d2('0xff')]));this[_0x51d2('0x33')][_0x51d2('0x84')](util[_0x51d2('0x50')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x51d2('0x33')][_0x51d2('0x38')],_0x3e36a5[_0x51d2('0xff')]));return{'code':0xc8,'result':_0x51d2('0x103')};}else{logger[_0x51d2('0x2d')](util['format'](_0x51d2('0x104'),this['channel'][_0x51d2('0x38')],_0x3e36a5[_0x51d2('0xff')]));this[_0x51d2('0x33')][_0x51d2('0x84')](util[_0x51d2('0x50')](_0x51d2('0x104'),this[_0x51d2('0x33')][_0x51d2('0x38')],_0x3e36a5[_0x51d2('0xff')]));return{'code':0xc8,'result':_0x51d2('0x105')};}};AGIVertices[_0x51d2('0x13')]['logout']=function(_0xa612e2){logger['info'](util[_0x51d2('0x50')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0xa612e2[_0x51d2('0x35')]));if(!this[_0x51d2('0x5b')](_0xa612e2[_0x51d2('0xff')])){return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0xa612e2,_0x51d2('0x100'));}logger['info'](util[_0x51d2('0x50')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x51d2('0x33')][_0x51d2('0x38')],_0xa612e2[_0x51d2('0xff')]));var _0x3929b5=this['agentLogout'][_0x51d2('0x7e')](this,_0xa612e2[_0x51d2('0xff')]);if(_0x3929b5){logger['info'](util[_0x51d2('0x50')](_0x51d2('0x102'),this[_0x51d2('0x33')][_0x51d2('0x38')],_0xa612e2['findBy']));this[_0x51d2('0x33')]['noop'](util[_0x51d2('0x50')](_0x51d2('0x102'),this[_0x51d2('0x33')][_0x51d2('0x38')],_0xa612e2['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x51d2('0x2d')](util[_0x51d2('0x50')](_0x51d2('0x104'),this[_0x51d2('0x33')][_0x51d2('0x38')],_0xa612e2[_0x51d2('0xff')]));this[_0x51d2('0x33')][_0x51d2('0x84')](util[_0x51d2('0x50')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x51d2('0x38')],_0xa612e2[_0x51d2('0xff')]));return{'code':0xc8,'result':_0x51d2('0x105')};}};AGIVertices[_0x51d2('0x13')][_0x51d2('0x106')]=function(_0x4e5000){logger[_0x51d2('0x2d')](util['format'](_0x51d2('0x107'),_0x4e5000[_0x51d2('0x35')]));if(!this['isConfigured'](_0x4e5000[_0x51d2('0x108')])){return this['channel'][_0x51d2('0x2b')](_0x4e5000,_0x51d2('0x109'));}this['channel']['noop'](util[_0x51d2('0x50')](_0x51d2('0x10a'),_0x4e5000[_0x51d2('0x108')]));var _0x4791db=eval(_0x4e5000[_0x51d2('0x108')]);if(!this[_0x51d2('0x5b')](_0x4e5000[_0x51d2('0x98')])){return this[_0x51d2('0x33')][_0x51d2('0x84')](_0x51d2('0x99'));}var _0x2652f3=this[_0x51d2('0xe')][_0x51d2('0x7e')](this,_0x4e5000[_0x51d2('0x98')]);if(!_0x2652f3){return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0x4e5000,_0x51d2('0x9a'));}if(_[_0x51d2('0x10b')](_0x4791db)){var _0x16263d=this;_0x4791db[_0x51d2('0x9b')](function(_0x57df8d,_0x5533c2){_0x16263d[_0x51d2('0x33')][_0x51d2('0x72')](util[_0x51d2('0x50')](_0x51d2('0x10c'),_0x2652f3,_0x5533c2),_0x57df8d);});return this[_0x51d2('0x33')][_0x51d2('0x84')](util[_0x51d2('0x50')](_0x51d2('0x10d'),_0x2652f3));}else{return this['channel'][_0x51d2('0x72')](_0x2652f3,_0x4791db);}};AGIVertices[_0x51d2('0x13')]['menu']=function(_0x232261){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')](_0x51d2('0x10e'),_0x232261[_0x51d2('0x35')]));if(_0x232261[_0x51d2('0x75')]===0x0){return this[_0x51d2('0x73')](_0x232261);}_0x232261[_0x51d2('0x75')]-=0x1;if(!this[_0x51d2('0x5b')](_0x232261[_0x51d2('0xbc')])){return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0x232261,_0x51d2('0xbb'));}var _0x51075f=this[_0x51d2('0x1d')][_0x51d2('0x7e')](this,_0x232261[_0x51d2('0xbc')]);if(!_0x51075f){return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0x232261,_0x51d2('0xbd'));}var _0x5370e5=this['channel']['getData'](_0x51075f,_0x232261[_0x51d2('0xbf')],_0x232261[_0x51d2('0x10f')]);var _0x257cd2=_0x5370e5[_0x51d2('0x70')];if(_0x5370e5['result']===-0x1){this[_0x51d2('0x74')]['sync'](this,_0x232261,'-1');return _0x5370e5;}else if(_0x5370e5[_0x51d2('0x6c')]===_0x51d2('0x78')){_0x5370e5[_0x51d2('0x70')]=_0x5370e5['result']['length']>0x0?_0x5370e5[_0x51d2('0x70')]:'t';}else if(_[_0x51d2('0x3f')](_0x5370e5[_0x51d2('0x70')])){_0x5370e5[_0x51d2('0x70')]='#';_0x257cd2='#';}if(!this['isConfigured'](_0x232261[_0x51d2('0x98')])){this[_0x51d2('0x33')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x1f9e68=this[_0x51d2('0xe')]['sync'](this,_0x232261[_0x51d2('0x98')]);if(!_0x1f9e68){return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0x232261,_0x51d2('0x9a'));}this[_0x51d2('0x33')]['setVariable'](_0x1f9e68,_0x257cd2);}this['createSquareDetailsReport'][_0x51d2('0x7e')](this,_0x232261,_0x257cd2);return _0x5370e5;};AGIVertices['prototype']['noop']=function(_0x5b1ec4){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x5b1ec4[_0x51d2('0x35')]));return this[_0x51d2('0x33')][_0x51d2('0x84')](_0x5b1ec4[_0x51d2('0x110')]||_0x5b1ec4[_0x51d2('0x35')]);};AGIVertices[_0x51d2('0x13')][_0x51d2('0x111')]=function(_0x2a2c10){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x2a2c10[_0x51d2('0x35')]));if(!this[_0x51d2('0x5b')](_0x2a2c10[_0x51d2('0xff')])){return this['channel'][_0x51d2('0x2b')](_0x2a2c10,_0x51d2('0x100'));}logger[_0x51d2('0x2d')](util[_0x51d2('0x50')](_0x51d2('0x101'),this[_0x51d2('0x33')][_0x51d2('0x38')],_0x2a2c10[_0x51d2('0xff')]));var _0xcfb3b4=this[_0x51d2('0x48')][_0x51d2('0x7e')](this,_0x2a2c10['pause_id']);var _0x2021e9=this[_0x51d2('0x4a')][_0x51d2('0x7e')](this,_0x2a2c10[_0x51d2('0xff')],_0xcfb3b4);if(_0x2021e9){logger[_0x51d2('0x2d')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x51d2('0x33')][_0x51d2('0x38')],_0x2a2c10['findBy']));this[_0x51d2('0x33')]['noop'](util[_0x51d2('0x50')](_0x51d2('0x102'),this[_0x51d2('0x33')]['callerid'],_0x2a2c10[_0x51d2('0xff')]));return{'code':0xc8,'result':_0x51d2('0x103')};}else{logger[_0x51d2('0x2d')](util[_0x51d2('0x50')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x51d2('0x33')][_0x51d2('0x38')],_0x2a2c10[_0x51d2('0xff')]));this[_0x51d2('0x33')][_0x51d2('0x84')](util[_0x51d2('0x50')](_0x51d2('0x102'),this[_0x51d2('0x33')][_0x51d2('0x38')],_0x2a2c10[_0x51d2('0xff')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x51d2('0x13')]['playback']=function(_0x2f3265){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')](_0x51d2('0x112'),_0x2f3265[_0x51d2('0x35')]));if(!this[_0x51d2('0x5b')](_0x2f3265[_0x51d2('0xbc')])){return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0x2f3265,_0x51d2('0xbb'));}var _0x453a74=this[_0x51d2('0x1d')][_0x51d2('0x7e')](this,_0x2f3265[_0x51d2('0xbc')]);if(!_0x453a74){return this['channel'][_0x51d2('0x2b')](_0x2f3265,'no\x20file\x20audio\x20found');}var _0x1076b0=this[_0x51d2('0x33')][_0x51d2('0x87')](_0x51d2('0x113'),[_0x453a74,_0x2f3265[_0x51d2('0xa5')]]);if(_0x1076b0['result']===-0x1){return _0x1076b0;}return this['channel'][_0x51d2('0x84')](util['format']('Executed\x20command\x20%s\x20%s',_0x51d2('0x113'),_0x453a74));};AGIVertices[_0x51d2('0x13')][_0x51d2('0x114')]=function(_0x32be95){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')](_0x51d2('0x115'),_0x32be95['label']));if(!this[_0x51d2('0x5b')](_0x32be95[_0x51d2('0x116')])){return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0x32be95,_0x51d2('0x117'));}var _0x4c064e='';var _0x364d47=parseInt(_0x32be95[_0x51d2('0x116')],0xa);if(isNaN(_0x364d47)){_0x4c064e=_0x32be95[_0x51d2('0x116')];}else{_0x4c064e=this[_0x51d2('0x14')]['sync'](this,_0x32be95['queue_id']);if(!_0x4c064e){return this['channel'][_0x51d2('0x2b')](_0x32be95,_0x51d2('0x118'));}}var _0x24fbc8='';if(this[_0x51d2('0x5b')](_0x32be95[_0x51d2('0xbc')])){var _0x359e61=this['getSound'][_0x51d2('0x7e')](this,_0x32be95[_0x51d2('0xbc')]);if(_0x359e61){_0x24fbc8=_0x359e61;}}this[_0x51d2('0x74')][_0x51d2('0x7e')](this,_0x32be95,_0x4c064e);if(_0x32be95['opts'][_0x51d2('0x119')]('x')<0x0){_0x32be95[_0x51d2('0xa5')]+='x';}if(_0x32be95['opts'][_0x51d2('0x119')]('X')<0x0){_0x32be95[_0x51d2('0xa5')]+='X';}this[_0x51d2('0x33')][_0x51d2('0x72')](_0x51d2('0x11a'),_0x4c064e?_0x4c064e[_0x51d2('0x11b')]():'');var _0x5b00e9=this[_0x51d2('0x33')][_0x51d2('0x87')](_0x51d2('0x11c'),[_0x4c064e,_0x32be95[_0x51d2('0xa5')],_0x32be95[_0x51d2('0xa6')],_0x24fbc8,_0x32be95[_0x51d2('0x78')],_0x32be95[_0x51d2('0x7')],_0x32be95[_0x51d2('0x11d')],_0x32be95[_0x51d2('0x11e')],'',_0x32be95[_0x51d2('0x11f')]]);if(_0x5b00e9[_0x51d2('0x70')]===-0x1){return _0x5b00e9;}return this[_0x51d2('0x33')][_0x51d2('0x84')](util['format'](_0x51d2('0x120'),_0x51d2('0x11c'),_0x4c064e));};AGIVertices['prototype']['record']=function(_0x404376){logger['info'](util[_0x51d2('0x50')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x404376[_0x51d2('0x35')]));var _0x1b532b=_0x404376[_0x51d2('0x121')]||_0x51d2('0xdf');var _0x103030=util['format']('%s_%s',this[_0x51d2('0x33')][_0x51d2('0x34')],rs[_0x51d2('0xc6')](0x5));var _0x24122e=util[_0x51d2('0x50')](_0x51d2('0x122'),FILES_PATH,_0x103030,_0x1b532b);var _0x25d54f=util[_0x51d2('0x50')](_0x51d2('0xf5'),FILES_PATH,_0x103030);this['createSquareRecording'][_0x51d2('0x7e')](this,_0x404376,_0x103030,_0x24122e);this[_0x51d2('0x33')][_0x51d2('0x72')](_0x51d2('0x123'),_0x103030);logger['info'](_0x51d2('0x124'),_0x25d54f,_0x1b532b,_0x404376[_0x51d2('0x125')],_0x404376[_0x51d2('0x78')]);return this[_0x51d2('0x33')]['recordFile'](_0x25d54f,_0x1b532b,_0x404376[_0x51d2('0x125')],_0x404376[_0x51d2('0x78')],undefined,!![]);};AGIVertices['prototype'][_0x51d2('0x126')]=function(_0x9bf14d){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')](_0x51d2('0x127'),_0x9bf14d[_0x51d2('0x35')]));return this[_0x51d2('0x33')][_0x51d2('0x128')](_0x9bf14d[_0x51d2('0x129')][_0x51d2('0x96')](/\s+/g,''),_0x9bf14d[_0x51d2('0x125')]);};AGIVertices[_0x51d2('0x13')][_0x51d2('0x12a')]=function(_0x1eb544){logger['info'](util[_0x51d2('0x50')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x1eb544[_0x51d2('0x35')]));return this[_0x51d2('0x33')][_0x51d2('0x12b')](_0x1eb544[_0x51d2('0x12c')][_0x51d2('0x96')](/\s+/g,''),_0x1eb544['escape_digits']);};AGIVertices[_0x51d2('0x13')][_0x51d2('0x12d')]=function(_0x5582b1){logger['info'](util[_0x51d2('0x50')](_0x51d2('0x12e'),_0x5582b1[_0x51d2('0x35')]));return this[_0x51d2('0x33')][_0x51d2('0x12f')](_0x5582b1[_0x51d2('0x54')],_0x5582b1[_0x51d2('0x125')]);};AGIVertices['prototype'][_0x51d2('0x130')]=function(_0x50c853){logger[_0x51d2('0x2d')](util['format'](_0x51d2('0x131'),_0x50c853[_0x51d2('0x35')]));if(!this[_0x51d2('0x5b')](_0x50c853[_0x51d2('0x132')])){return this[_0x51d2('0x33')]['noop'](_0x51d2('0x133'));}var _0x26836d=this[_0x51d2('0x134')][_0x51d2('0x7e')](this,_0x50c853['account_id']);if(!_0x26836d||!_0x26836d[_0x51d2('0x135')]){return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0x50c853,_0x51d2('0x136'));}var _0x35c31={'from':util[_0x51d2('0x50')](_0x51d2('0x137'),_0x26836d[_0x51d2('0x11')],_0x26836d[_0x51d2('0x138')]||_0x26836d[_0x51d2('0x135')][_0x51d2('0x139')]),'to':_0x50c853['to']||'','cc':_0x50c853['cc']||'','bcc':_0x50c853[_0x51d2('0x13a')]||'','subject':_0x50c853['subject'],'html':_0x50c853['text'],'text':_0x50c853[_0x51d2('0x54')]};var _0x3cdb85={'tls':{'rejectUnauthorized':![]}};if(_0x26836d['Smtp'][_0x51d2('0x13b')]){_0x3cdb85[_0x51d2('0x13b')]=_0x26836d[_0x51d2('0x135')][_0x51d2('0x13b')];}else{_0x3cdb85['host']=_0x26836d[_0x51d2('0x135')]['host'];_0x3cdb85[_0x51d2('0x13c')]=_0x26836d[_0x51d2('0x135')]['port'];_0x3cdb85[_0x51d2('0x13d')]=_0x26836d['Smtp'][_0x51d2('0x13d')];}if(_0x26836d[_0x51d2('0x135')][_0x51d2('0x13e')]){_0x3cdb85['auth']={'user':_0x26836d['Smtp']['user'],'pass':_0x26836d['Smtp'][_0x51d2('0x13f')]};}if(this[_0x51d2('0x5b')](_0x50c853[_0x51d2('0x140')])){}logger[_0x51d2('0x9f')](_0x51d2('0x141'),JSON['stringify'](_0x35c31));this[_0x51d2('0x74')][_0x51d2('0x7e')](this,_0x50c853,_0x50c853[_0x51d2('0x132')]);this[_0x51d2('0x33')]['noop'](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x26836d[_0x51d2('0x11')]));this['sendMailMessage'][_0x51d2('0x7e')](this,_0x3cdb85,_0x35c31);return this[_0x51d2('0x33')]['noop'](_0x51d2('0x142'));};AGIVertices['prototype']['sendFax']=function(_0x4656cc){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')](_0x51d2('0x143'),_0x4656cc[_0x51d2('0x35')]));return this[_0x51d2('0x33')]['noop'](_0x51d2('0x144'));};AGIVertices[_0x51d2('0x13')][_0x51d2('0x145')]=function(_0x12707e){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')](_0x51d2('0x146'),_0x12707e[_0x51d2('0x35')]));if(!this[_0x51d2('0x5b')](_0x12707e[_0x51d2('0x147')])){return this[_0x51d2('0x33')][_0x51d2('0x84')]('no\x20sms\x20account\x20configured');}var _0x560854=this['getSmsAccount']['sync'](this,_0x12707e['sms_account_id']);if(!_0x560854){return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0x12707e,_0x51d2('0x148'));}var _0x375004={'body':_0x12707e[_0x51d2('0x149')],'phone':_0x12707e['to']||'','SmsAccountId':_0x560854['id']};logger[_0x51d2('0x9f')](_0x51d2('0x14a'),JSON[_0x51d2('0xf9')](_0x375004));this[_0x51d2('0x74')][_0x51d2('0x7e')](this,_0x12707e,_0x12707e[_0x51d2('0x147')]);this[_0x51d2('0x33')]['noop'](util[_0x51d2('0x50')](_0x51d2('0x14b'),_0x560854['name']));this[_0x51d2('0x32')]['sync'](this,_0x375004);return this[_0x51d2('0x33')][_0x51d2('0x84')](_0x51d2('0x14c'));};AGIVertices[_0x51d2('0x13')]['set']=function(_0x291ebc){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')](_0x51d2('0x14d'),_0x291ebc[_0x51d2('0x35')]));if(!this[_0x51d2('0x5b')](_0x291ebc[_0x51d2('0x98')])){return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0x291ebc,'no\x20variable\x20selected');}var _0x4c35b6=this['getVariable'][_0x51d2('0x7e')](this,_0x291ebc[_0x51d2('0x98')]);if(!_0x4c35b6){return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0x291ebc,_0x51d2('0x9a'));}return this[_0x51d2('0x33')][_0x51d2('0x72')](_0x4c35b6,_0x291ebc[_0x51d2('0x14e')]);};AGIVertices[_0x51d2('0x13')][_0x51d2('0x14f')]=function(_0x3689d2){logger['info'](util[_0x51d2('0x50')]('Enter\x20in\x20START\x20(%s)\x20block',_0x3689d2['label']));this['channel'][_0x51d2('0x84')](_0x51d2('0x150'));if(_0x3689d2['answer']==='yes'){this[_0x51d2('0x33')]['noop'](_0x51d2('0x151'));return this[_0x51d2('0x33')][_0x51d2('0x76')]();}return this[_0x51d2('0x33')]['noop'](_0x51d2('0x152'));};AGIVertices['prototype']['subproject']=function(_0xd8f1f0){logger['info'](util[_0x51d2('0x50')](_0x51d2('0x153'),_0xd8f1f0[_0x51d2('0x35')]));if(!this['isConfigured'](_0xd8f1f0[_0x51d2('0x154')])){return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0xd8f1f0,_0x51d2('0x155'));}var _0x15ce46=this[_0x51d2('0x15')][_0x51d2('0x7e')](this,_0xd8f1f0[_0x51d2('0x154')]);if(!this[_0x51d2('0x5b')](_0x15ce46)){return this[_0x51d2('0x33')]['error'](_0xd8f1f0,util[_0x51d2('0x50')](_0x51d2('0x156'),_0xd8f1f0['project_id']));}if(_0x15ce46===this[_0x51d2('0x33')]['arg_1']){return this['channel']['error'](_0xd8f1f0,_0x51d2('0x157'));}this['createSquareDetailsReport'][_0x51d2('0x7e')](this,_0xd8f1f0,_0x15ce46);var _0x33ea1b=this[_0x51d2('0x33')][_0x51d2('0x87')]('AGI',util['format'](_0x51d2('0x158'),config[_0x51d2('0x7')][_0x51d2('0x159')]||_0x51d2('0x15a'),_0x15ce46,this[_0x51d2('0x33')][_0x51d2('0x37')]));if(_0x33ea1b[_0x51d2('0x70')]===-0x1){return _0x33ea1b;}return this[_0x51d2('0x33')][_0x51d2('0x84')](util['format'](_0x51d2('0x120'),_0x51d2('0x15b'),_0x15ce46));};AGIVertices[_0x51d2('0x13')][_0x51d2('0x15c')]=function(_0xe32e02){logger[_0x51d2('0x2d')](util['format'](_0x51d2('0x15d'),_0xe32e02['label']));var _0x27824a=this[_0x51d2('0x15e')]['sync'](this,_0xe32e02[_0x51d2('0x15f')]);this[_0x51d2('0x74')][_0x51d2('0x7e')](this,_0xe32e02,_0xe32e02[_0x51d2('0x15f')]);if(this['isConfigured'](_0xe32e02[_0x51d2('0x98')])){var _0x25cf7=this[_0x51d2('0xe')][_0x51d2('0x7e')](this,_0xe32e02[_0x51d2('0x98')]);if(_0x25cf7){this[_0x51d2('0x33')]['setVariable'](_0x25cf7,_0x27824a);return this['channel']['noop'](util[_0x51d2('0x50')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0xe32e02[_0x51d2('0x15f')],_0x25cf7));}}return this['channel'][_0x51d2('0x84')](util[_0x51d2('0x50')](_0x51d2('0x160'),_0xe32e02[_0x51d2('0x15f')]));};AGIVertices[_0x51d2('0x13')]['tts']=function(_0x220b56){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x220b56[_0x51d2('0x35')]));if(!this[_0x51d2('0x5b')](_0x220b56[_0x51d2('0x54')])){return this[_0x51d2('0x33')][_0x51d2('0x84')](_0x51d2('0x86'));}this[_0x51d2('0x33')][_0x51d2('0x84')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x220b56[_0x51d2('0x54')]));var _0x2a5da5=this[_0x51d2('0x53')]['sync'](this,_0x220b56);if(_0x2a5da5){this[_0x51d2('0x33')][_0x51d2('0x84')](util[_0x51d2('0x50')](_0x51d2('0x161'),_0x2a5da5));var _0x1d745a=this[_0x51d2('0x33')][_0x51d2('0xd1')](_0x2a5da5);try{fs['unlink'](_0x2a5da5+_0x51d2('0xd3'));}catch(_0x18f79d){logger['error'](_0x18f79d);}return _0x1d745a;}return this['channel'][_0x51d2('0x2b')](_0x220b56,_0x51d2('0xae'));};AGIVertices['prototype'][_0x51d2('0x162')]=function(_0x1a14fd){logger[_0x51d2('0x2d')](util[_0x51d2('0x50')](_0x51d2('0x163'),_0x1a14fd['label']));if(!this['isConfigured'](_0x1a14fd[_0x51d2('0xff')])){return this['channel'][_0x51d2('0x2b')](_0x1a14fd,_0x51d2('0x100'));}logger[_0x51d2('0x2d')](util[_0x51d2('0x50')](_0x51d2('0x101'),this[_0x51d2('0x33')][_0x51d2('0x38')],_0x1a14fd[_0x51d2('0xff')]));var _0x388669=this[_0x51d2('0x4c')][_0x51d2('0x7e')](this,_0x1a14fd['findBy']);if(_0x388669){logger['info'](util[_0x51d2('0x50')](_0x51d2('0x102'),this['channel'][_0x51d2('0x38')],_0x1a14fd[_0x51d2('0xff')]));this[_0x51d2('0x33')][_0x51d2('0x84')](util[_0x51d2('0x50')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x1a14fd['findBy']));return{'code':0xc8,'result':_0x51d2('0x103')};}else{logger[_0x51d2('0x2d')](util[_0x51d2('0x50')](_0x51d2('0x104'),this[_0x51d2('0x33')][_0x51d2('0x38')],_0x1a14fd[_0x51d2('0xff')]));this['channel'][_0x51d2('0x84')](util[_0x51d2('0x50')](_0x51d2('0x104'),this[_0x51d2('0x33')][_0x51d2('0x38')],_0x1a14fd[_0x51d2('0xff')]));return{'code':0xc8,'result':_0x51d2('0x105')};}};AGIVertices[_0x51d2('0x13')][_0x51d2('0x164')]=function(_0x175ec2){logger['info'](util[_0x51d2('0x50')](_0x51d2('0x165'),_0x175ec2[_0x51d2('0x35')]));var _0x5bae29=this[_0x51d2('0x33')][_0x51d2('0x87')](_0x51d2('0x166'),[_0x175ec2['mailbox'],_0x175ec2[_0x51d2('0x83')]]);if(_0x5bae29['result']===-0x1){return _0x5bae29;}return this['channel'][_0x51d2('0x84')](util[_0x51d2('0x50')](_0x51d2('0x120'),'VOICEMAIL',_0x175ec2[_0x51d2('0x167')]));};AGIVertices['prototype']['vswitch']=function(_0x2d17ec){logger['info'](util[_0x51d2('0x50')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x2d17ec['label']));if(!this[_0x51d2('0x5b')](_0x2d17ec[_0x51d2('0x98')])){return this['channel']['error'](_0x2d17ec,_0x51d2('0x168'));}var _0x38ac14=this['getVariable']['sync'](this,_0x2d17ec[_0x51d2('0x98')]);if(!_0x38ac14){return this[_0x51d2('0x33')][_0x51d2('0x2b')](_0x2d17ec,_0x51d2('0x9a'));}var _0xc17faa=this[_0x51d2('0x33')][_0x51d2('0xe')](_0x38ac14);return{'code':0xc8,'result':_0xc17faa[_0x51d2('0x6c')]?_0xc17faa[_0x51d2('0x6c')]:'-'};};String[_0x51d2('0x13')][_0x51d2('0x169')]=function(_0x26fc03,_0x53c66a){return this[_0x51d2('0x6b')](_0x26fc03)[_0x51d2('0x16a')](_0x53c66a);};module[_0x51d2('0x16b')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 53593ca..3e6bd11 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 _0xdf17=['find','format','SIP/%s','localtwoconnectedlinename','findKey','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../rpc/user','socket.io-emitter','localhost','voiceQueues','agents','channels','agentconnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','queue','Action','QueuePause','ACW','then','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timers','stopAcw','acwTimeout','lastPauseAt','uniqueid','updateAcw','timer','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','error','[ACW][START]\x20%s','message','saveUnpause','update','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','acw','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','startAcw','linkedid','isUndefined','attended','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','[%s][ATTENDEDTRANSFER:UNIQUEID]','origtransfereruniqueid','origtransfererlinkedid','[%s][ATTENDEDTRANSFER:LINKEDID]','[%s][ATTENDEDTRANSFER:TRANSFERTARGETUNIQUEID]','transfertargetuniqueid'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xdf17,0x16e));var _0x7df1=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdf17[_0x1facfa];return _0x9ec701;};'use strict';var util=require(_0x7df1('0x0'));var _=require(_0x7df1('0x1'));var moment=require(_0x7df1('0x2'));var ami=require(_0x7df1('0x3'));var logger=require('../../../config/logger')('acw');var RpcUser=require(_0x7df1('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var io=require(_0x7df1('0x5'))({'host':_0x7df1('0x6'),'port':0x18eb});function Acw(_0x125a85){this[_0x7df1('0x7')]=_0x125a85[_0x7df1('0x7')];this[_0x7df1('0x8')]=_0x125a85['agents'];this['timers']=_0x125a85['timers'];this[_0x7df1('0x9')]={};ami['on'](_0x7df1('0xa'),this['syncAgentConnect'][_0x7df1('0xb')](this));ami['on'](_0x7df1('0xc'),this[_0x7df1('0xd')][_0x7df1('0xb')](this));ami['on'](_0x7df1('0xe'),this[_0x7df1('0xf')][_0x7df1('0xb')](this));ami['on'](_0x7df1('0x10'),this[_0x7df1('0x11')]['bind'](this));ami['on']('attendedtransfer',this[_0x7df1('0x12')][_0x7df1('0xb')](this));ami['on'](_0x7df1('0x13'),this[_0x7df1('0x14')][_0x7df1('0xb')](this));ami['on'](_0x7df1('0x15'),this[_0x7df1('0x16')][_0x7df1('0xb')](this));}function getDiff(_0x305b20){var _0x3669cd=moment()[_0x7df1('0x17')](0x0);var _0xcd8687=moment(_0x305b20)[_0x7df1('0x17')](0x0);return _0x3669cd[_0x7df1('0x18')](_0xcd8687,_0x7df1('0x19'));}Acw[_0x7df1('0x1a')]['startAcw']=function(_0x4534f6){try{var _0x11c5c3=this;var _0xfb6158=this[_0x7df1('0x9')][_0x4534f6]['interface'];var _0x4242b9=this['channels'][_0x4534f6][_0x7df1('0x1b')];ami[_0x7df1('0x1c')]({'action':_0x7df1('0x1d'),'interface':_0xfb6158,'paused':!![],'reason':_0x7df1('0x1e')})[_0x7df1('0x1f')](function(_0x5f3bd7){if(_0x11c5c3[_0x7df1('0x8')][_0xfb6158]){return RpcUser[_0x7df1('0x20')](_0x11c5c3[_0x7df1('0x8')][_0xfb6158]['id'])[_0x7df1('0x1f')](function(_0x337466){if(_0x337466&&!_0x337466['voicePause']){logger[_0x7df1('0x21')](_0x7df1('0x22'),_0x4534f6,_0xfb6158,_0x4242b9);return RpcUser[_0x7df1('0x23')](_0x11c5c3['agents'][_0xfb6158],_0x7df1('0x1e'),_0x4534f6)[_0x7df1('0x1f')](function(_0xdb150){_0x11c5c3['timers'][_0xfb6158]={};logger[_0x7df1('0x21')](_0x7df1('0x24'),_0x4534f6,_0x11c5c3[_0x7df1('0x7')][_0x4242b9]['acwTimeout'],_0xfb6158,_0x4242b9);_0x11c5c3[_0x7df1('0x25')][_0xfb6158]['timer']=setTimeout(_0x11c5c3[_0x7df1('0x26')][_0x7df1('0xb')](_0x11c5c3,_0xfb6158),_0x11c5c3[_0x7df1('0x7')][_0x4242b9][_0x7df1('0x27')]*0x3e8);_0x11c5c3['timers'][_0xfb6158][_0x7df1('0x28')]=_0xdb150[_0x7df1('0x28')];_0x11c5c3[_0x7df1('0x25')][_0xfb6158][_0x7df1('0x29')]=_0x4534f6;_0x11c5c3[_0x7df1('0x25')][_0xfb6158][_0x7df1('0x1b')]=_0x4242b9;_0x11c5c3[_0x7df1('0x25')][_0xfb6158][_0x7df1('0x2a')]=function(){var _0x46d5a7=getDiff(_0x11c5c3[_0x7df1('0x25')][_0xfb6158][_0x7df1('0x28')]);clearTimeout(_0x11c5c3[_0x7df1('0x25')][_0xfb6158][_0x7df1('0x2b')]);RpcVoiceAgentReport['update']({'acwtime':_0x46d5a7},_0x11c5c3[_0x7df1('0x25')][_0xfb6158][_0x7df1('0x29')],_0xfb6158)[_0x7df1('0x1f')](function(_0x18213b){logger[_0x7df1('0x21')]('[%s][UPDATE][ACWTIME:%s]',_0x4534f6,_0x46d5a7,_0x18213b);})[_0x7df1('0x2c')](function(_0x3e2cf5){logger['error'](_0x7df1('0x2d'),_0x4534f6,_0x3e2cf5);});delete _0x11c5c3[_0x7df1('0x25')][_0xfb6158];};});}else{logger[_0x7df1('0x21')](_0x7df1('0x2e'),_0x4534f6,_0xfb6158,_0x4242b9);}});}})[_0x7df1('0x2c')](function(_0x5c54f8){logger['error'](_0x7df1('0x24'),_0x4534f6,_0x11c5c3[_0x7df1('0x7')][_0x4242b9]['acwTimeout'],_0xfb6158,_0x4242b9);})[_0x7df1('0x2f')](function(){delete _0x11c5c3['channels'][_0x4534f6];});}catch(_0x24c94a){logger[_0x7df1('0x30')](_0x7df1('0x31'),_0x24c94a[_0x7df1('0x32')]);}};Acw['prototype'][_0x7df1('0x26')]=function(_0x195174){try{var _0x547937=this;if(_0x547937[_0x7df1('0x25')][_0x195174]){var _0x22329a=_0x547937['timers'][_0x195174][_0x7df1('0x29')];var _0x121278=_0x547937[_0x7df1('0x25')][_0x195174][_0x7df1('0x1b')];var _0x3199d9=_0x547937['voiceQueues'][_0x121278][_0x7df1('0x27')];logger['info']('[TIMER][STOP][AGENT:%s]',_0x195174);RpcUser[_0x7df1('0x33')](this[_0x7df1('0x8')][_0x195174]);RpcVoiceAgentReport[_0x7df1('0x34')]({'acwtime':_0x3199d9,'agentacw':!![]},_0x22329a,_0x195174)[_0x7df1('0x1f')](function(_0x4786cf){logger[_0x7df1('0x21')]('[%s][UPDATE][ACWTIME:%s]',_0x22329a,_0x3199d9,_0x4786cf);})[_0x7df1('0x2c')](function(_0x4c4a70){logger[_0x7df1('0x30')](_0x7df1('0x2d'),_0x22329a,_0x4c4a70);});}else{logger[_0x7df1('0x30')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x195174);if(_0x547937['timers']){logger[_0x7df1('0x21')](_0x7df1('0x35'),JSON[_0x7df1('0x36')](_0x547937[_0x7df1('0x25')]));}}}catch(_0x35713f){logger[_0x7df1('0x30')](_0x7df1('0x37'),_0x35713f[_0x7df1('0x32')]);}};Acw['prototype'][_0x7df1('0x38')]=function(_0x2004bb){try{if(this[_0x7df1('0x7')][_0x2004bb[_0x7df1('0x1b')]]&&this[_0x7df1('0x7')][_0x2004bb[_0x7df1('0x1b')]][_0x7df1('0x39')]){if(this[_0x7df1('0x8')][_0x2004bb[_0x7df1('0x3a')]]){this[_0x7df1('0x9')][_0x2004bb[_0x7df1('0x29')]]={'queue':_0x2004bb[_0x7df1('0x1b')],'interface':_0x2004bb[_0x7df1('0x3a')]};}}}catch(_0x4993af){logger[_0x7df1('0x30')](_0x7df1('0x3b'),_0x4993af[_0x7df1('0x32')]);}};Acw['prototype'][_0x7df1('0x16')]=function(_0x1789c1){try{if(this[_0x7df1('0x7')][_0x1789c1[_0x7df1('0x1b')]]&&this['voiceQueues'][_0x1789c1[_0x7df1('0x1b')]][_0x7df1('0x39')]){if(this['agents'][_0x1789c1[_0x7df1('0x3a')]]){this[_0x7df1('0x9')][_0x1789c1[_0x7df1('0x29')]]={'queue':_0x1789c1[_0x7df1('0x1b')],'interface':_0x1789c1[_0x7df1('0x3a')]};}}}catch(_0x236313){logger[_0x7df1('0x30')](_0x7df1('0x3c'),_0x236313['message']);}};Acw['prototype'][_0x7df1('0xd')]=function(_0x2d5eb2){try{if(this[_0x7df1('0x9')][_0x2d5eb2[_0x7df1('0x29')]]&&_['isUndefined'](this[_0x7df1('0x9')][_0x2d5eb2[_0x7df1('0x29')]]['attended'])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x2d5eb2[_0x7df1('0x29')]);this[_0x7df1('0x3d')](_0x2d5eb2['uniqueid']);}else if(this[_0x7df1('0x9')][_0x2d5eb2[_0x7df1('0x3e')]]&&_[_0x7df1('0x3f')](this[_0x7df1('0x9')][_0x2d5eb2['linkedid']][_0x7df1('0x40')])){logger[_0x7df1('0x21')](_0x7df1('0x41'),_0x2d5eb2[_0x7df1('0x3e')]);this[_0x7df1('0x3d')](_0x2d5eb2['linkedid']);}}catch(_0x5327c0){logger[_0x7df1('0x30')]('[ACW][syncHangupRequest]\x20%s',_0x5327c0[_0x7df1('0x32')]);}};Acw[_0x7df1('0x1a')][_0x7df1('0xf')]=function(_0x23377c){try{if(this[_0x7df1('0x9')][_0x23377c[_0x7df1('0x29')]]&&this[_0x7df1('0x9')][_0x23377c[_0x7df1('0x29')]][_0x7df1('0x40')]){logger[_0x7df1('0x21')](_0x7df1('0x42'),_0x23377c[_0x7df1('0x29')]);this[_0x7df1('0x3d')](_0x23377c[_0x7df1('0x29')]);}}catch(_0x5bc421){logger['error'](_0x7df1('0x43'),_0x5bc421[_0x7df1('0x32')]);}};Acw[_0x7df1('0x1a')][_0x7df1('0x12')]=function(_0x44d7a1){try{if(this[_0x7df1('0x9')][_0x44d7a1['origtransfereruniqueid']]){logger[_0x7df1('0x21')](_0x7df1('0x44'),_0x44d7a1[_0x7df1('0x45')]);this[_0x7df1('0x3d')](_0x44d7a1[_0x7df1('0x45')]);}else if(this[_0x7df1('0x9')][_0x44d7a1[_0x7df1('0x46')]]){logger[_0x7df1('0x21')](_0x7df1('0x47'),_0x44d7a1['origtransfererlinkedid']);this['startAcw'](_0x44d7a1[_0x7df1('0x46')]);}logger['info'](_0x7df1('0x48'),_0x44d7a1[_0x7df1('0x49')]);this['channels'][_0x44d7a1[_0x7df1('0x49')]]=_[_0x7df1('0x4a')](this[_0x7df1('0x9')],['interface',util[_0x7df1('0x4b')](_0x7df1('0x4c'),_0x44d7a1[_0x7df1('0x4d')])]);if(this[_0x7df1('0x9')][_0x44d7a1[_0x7df1('0x49')]]){this['channels'][_0x44d7a1[_0x7df1('0x49')]]['attended']=!![];delete this[_0x7df1('0x9')][_[_0x7df1('0x4e')](this['channels'],['interface',util[_0x7df1('0x4b')](_0x7df1('0x4c'),_0x44d7a1[_0x7df1('0x4d')])])];}}catch(_0x49faa5){logger[_0x7df1('0x30')]('[ACW][syncAttendedTransfer]\x20%s',_0x49faa5['message']);}};Acw[_0x7df1('0x1a')][_0x7df1('0x14')]=function(_0x59f5a1){try{if(this[_0x7df1('0x9')][_0x59f5a1[_0x7df1('0x4f')]]){logger[_0x7df1('0x21')](_0x7df1('0x50'),JSON[_0x7df1('0x36')](_0x59f5a1[_0x7df1('0x4f')]));this[_0x7df1('0x3d')](_0x59f5a1[_0x7df1('0x4f')]);}else if(this['channels'][_0x59f5a1[_0x7df1('0x51')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x7df1('0x36')](_0x59f5a1[_0x7df1('0x51')]));this['startAcw'](_0x59f5a1[_0x7df1('0x51')]);}}catch(_0x1a270a){logger[_0x7df1('0x30')]('[ACW][syncBlindTransfer]\x20%s',_0x1a270a[_0x7df1('0x32')]);}};Acw['prototype'][_0x7df1('0x11')]=function(_0x49506e){try{if(this[_0x7df1('0x7')][_0x49506e['queue']]&&this[_0x7df1('0x7')][_0x49506e[_0x7df1('0x1b')]][_0x7df1('0x52')]===_0x7df1('0x53')){if(this[_0x7df1('0x8')][_0x49506e[_0x7df1('0x3a')]]){logger['info'](_0x7df1('0x54'),_0x49506e[_0x7df1('0x29')],_0x49506e[_0x7df1('0x3a')],_0x49506e[_0x7df1('0x1b')]);return RpcUser[_0x7df1('0x23')](this[_0x7df1('0x8')][_0x49506e[_0x7df1('0x3a')]],_0x7df1('0x55'),_0x49506e[_0x7df1('0x29')]);}}}catch(_0x720959){logger[_0x7df1('0x30')](_0x7df1('0x56'),_0x720959[_0x7df1('0x32')]);}};module[_0x7df1('0x57')]=Acw; \ No newline at end of file +var _0xa74f=['[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','origtransfereruniqueid','[%s][ATTENDEDTRANSFER:UNIQUEID]','[%s][ATTENDEDTRANSFER:TRANSFERTARGETUNIQUEID]','transfertargetuniqueid','find','SIP/%s','localtwoconnectedlinename','format','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','socket.io-emitter','localhost','voiceQueues','agents','timers','channels','bind','hanguprequest','syncHangupRequest','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','startAcw','interface','queue','Action','QueuePause','then','voicePause','info','savePause','ACW','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','uniqueid','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[ACW][START]\x20%s','message','prototype','[TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify'];(function(_0x51a960,_0xa9a74){var _0x41523a=function(_0x2c486e){while(--_0x2c486e){_0x51a960['push'](_0x51a960['shift']());}};_0x41523a(++_0xa9a74);}(_0xa74f,0x164));var _0xfa74=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xa74f[_0x36c5b0];return _0xf19333;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xfa74('0x0'));var ami=require(_0xfa74('0x1'));var logger=require(_0xfa74('0x2'))(_0xfa74('0x3'));var RpcUser=require(_0xfa74('0x4'));var RpcVoiceAgentReport=require(_0xfa74('0x5'));var io=require(_0xfa74('0x6'))({'host':_0xfa74('0x7'),'port':0x18eb});function Acw(_0x152de6){this[_0xfa74('0x8')]=_0x152de6['voiceQueues'];this[_0xfa74('0x9')]=_0x152de6[_0xfa74('0x9')];this[_0xfa74('0xa')]=_0x152de6[_0xfa74('0xa')];this[_0xfa74('0xb')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0xfa74('0xc')](this));ami['on'](_0xfa74('0xd'),this[_0xfa74('0xe')][_0xfa74('0xc')](this));ami['on']('hangup',this['syncHangup'][_0xfa74('0xc')](this));ami['on'](_0xfa74('0xf'),this[_0xfa74('0x10')]['bind'](this));ami['on'](_0xfa74('0x11'),this[_0xfa74('0x12')]['bind'](this));ami['on'](_0xfa74('0x13'),this[_0xfa74('0x14')][_0xfa74('0xc')](this));ami['on']('custom:agentConnectPreview',this[_0xfa74('0x15')][_0xfa74('0xc')](this));}function getDiff(_0xba17f){var _0x457a58=moment()[_0xfa74('0x16')](0x0);var _0x327357=moment(_0xba17f)[_0xfa74('0x16')](0x0);return _0x457a58[_0xfa74('0x17')](_0x327357,'seconds');}Acw['prototype'][_0xfa74('0x18')]=function(_0x2b1d01){try{var _0x156336=this;var _0x5968e8=this[_0xfa74('0xb')][_0x2b1d01][_0xfa74('0x19')];var _0x13d491=this[_0xfa74('0xb')][_0x2b1d01][_0xfa74('0x1a')];ami[_0xfa74('0x1b')]({'action':_0xfa74('0x1c'),'interface':_0x5968e8,'paused':!![],'reason':'ACW'})[_0xfa74('0x1d')](function(_0x377045){if(_0x156336['agents'][_0x5968e8]){return RpcUser['getAgent'](_0x156336['agents'][_0x5968e8]['id'])[_0xfa74('0x1d')](function(_0x105632){if(_0x105632&&!_0x105632[_0xfa74('0x1e')]){logger[_0xfa74('0x1f')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x2b1d01,_0x5968e8,_0x13d491);return RpcUser[_0xfa74('0x20')](_0x156336[_0xfa74('0x9')][_0x5968e8],_0xfa74('0x21'),_0x2b1d01)[_0xfa74('0x1d')](function(_0x4db46a){_0x156336[_0xfa74('0xa')][_0x5968e8]={};logger[_0xfa74('0x1f')](_0xfa74('0x22'),_0x2b1d01,_0x156336[_0xfa74('0x8')][_0x13d491][_0xfa74('0x23')],_0x5968e8,_0x13d491);_0x156336[_0xfa74('0xa')][_0x5968e8][_0xfa74('0x24')]=setTimeout(_0x156336[_0xfa74('0x25')][_0xfa74('0xc')](_0x156336,_0x5968e8),_0x156336[_0xfa74('0x8')][_0x13d491][_0xfa74('0x23')]*0x3e8);_0x156336['timers'][_0x5968e8][_0xfa74('0x26')]=_0x4db46a[_0xfa74('0x26')];_0x156336['timers'][_0x5968e8][_0xfa74('0x27')]=_0x2b1d01;_0x156336[_0xfa74('0xa')][_0x5968e8]['queue']=_0x13d491;_0x156336[_0xfa74('0xa')][_0x5968e8]['updateAcw']=function(){var _0x3fa93f=getDiff(_0x156336['timers'][_0x5968e8][_0xfa74('0x26')]);clearTimeout(_0x156336[_0xfa74('0xa')][_0x5968e8][_0xfa74('0x24')]);RpcVoiceAgentReport[_0xfa74('0x28')]({'acwtime':_0x3fa93f},_0x156336[_0xfa74('0xa')][_0x5968e8][_0xfa74('0x27')],_0x5968e8)[_0xfa74('0x1d')](function(_0x50d597){logger[_0xfa74('0x1f')](_0xfa74('0x29'),_0x2b1d01,_0x3fa93f,_0x50d597);})['catch'](function(_0x457db6){logger[_0xfa74('0x2a')](_0xfa74('0x2b'),_0x2b1d01,_0x457db6);});delete _0x156336[_0xfa74('0xa')][_0x5968e8];};});}else{logger[_0xfa74('0x1f')](_0xfa74('0x2c'),_0x2b1d01,_0x5968e8,_0x13d491);}});}})[_0xfa74('0x2d')](function(_0xd912c0){logger[_0xfa74('0x2a')](_0xfa74('0x22'),_0x2b1d01,_0x156336[_0xfa74('0x8')][_0x13d491][_0xfa74('0x23')],_0x5968e8,_0x13d491);})[_0xfa74('0x2e')](function(){delete _0x156336[_0xfa74('0xb')][_0x2b1d01];});}catch(_0x1b066a){logger[_0xfa74('0x2a')](_0xfa74('0x2f'),_0x1b066a[_0xfa74('0x30')]);}};Acw[_0xfa74('0x31')]['stopAcw']=function(_0x570c4d){try{var _0x35ae38=this;if(_0x35ae38[_0xfa74('0xa')][_0x570c4d]){var _0x14414d=_0x35ae38[_0xfa74('0xa')][_0x570c4d][_0xfa74('0x27')];var _0x4ec2ef=_0x35ae38[_0xfa74('0xa')][_0x570c4d][_0xfa74('0x1a')];var _0x4b0efa=_0x35ae38['voiceQueues'][_0x4ec2ef][_0xfa74('0x23')];logger['info'](_0xfa74('0x32'),_0x570c4d);RpcUser['saveUnpause'](this[_0xfa74('0x9')][_0x570c4d]);RpcVoiceAgentReport[_0xfa74('0x28')]({'acwtime':_0x4b0efa,'agentacw':!![]},_0x14414d,_0x570c4d)['then'](function(_0x32e265){logger[_0xfa74('0x1f')](_0xfa74('0x29'),_0x14414d,_0x4b0efa,_0x32e265);})[_0xfa74('0x2d')](function(_0xd2df32){logger[_0xfa74('0x2a')](_0xfa74('0x2b'),_0x14414d,_0xd2df32);});}else{logger[_0xfa74('0x2a')](_0xfa74('0x33'),_0x570c4d);if(_0x35ae38['timers']){logger['info'](_0xfa74('0x34'),JSON[_0xfa74('0x35')](_0x35ae38[_0xfa74('0xa')]));}}}catch(_0x2d4b3e){logger['error'](_0xfa74('0x36'),_0x2d4b3e[_0xfa74('0x30')]);}};Acw['prototype'][_0xfa74('0x37')]=function(_0x2cf838){try{if(this[_0xfa74('0x8')][_0x2cf838[_0xfa74('0x1a')]]&&this[_0xfa74('0x8')][_0x2cf838['queue']][_0xfa74('0x3')]){if(this[_0xfa74('0x9')][_0x2cf838[_0xfa74('0x19')]]){this[_0xfa74('0xb')][_0x2cf838[_0xfa74('0x27')]]={'queue':_0x2cf838['queue'],'interface':_0x2cf838[_0xfa74('0x19')]};}}}catch(_0x1ba8fb){logger[_0xfa74('0x2a')](_0xfa74('0x38'),_0x1ba8fb[_0xfa74('0x30')]);}};Acw[_0xfa74('0x31')][_0xfa74('0x15')]=function(_0x4442a1){try{if(this[_0xfa74('0x8')][_0x4442a1[_0xfa74('0x1a')]]&&this['voiceQueues'][_0x4442a1[_0xfa74('0x1a')]][_0xfa74('0x3')]){if(this[_0xfa74('0x9')][_0x4442a1[_0xfa74('0x19')]]){this[_0xfa74('0xb')][_0x4442a1['uniqueid']]={'queue':_0x4442a1[_0xfa74('0x1a')],'interface':_0x4442a1[_0xfa74('0x19')]};}}}catch(_0x4a0a24){logger['error'](_0xfa74('0x39'),_0x4a0a24['message']);}};Acw[_0xfa74('0x31')][_0xfa74('0xe')]=function(_0x50919e){try{if(this[_0xfa74('0xb')][_0x50919e[_0xfa74('0x27')]]&&_[_0xfa74('0x3a')](this[_0xfa74('0xb')][_0x50919e['uniqueid']][_0xfa74('0x3b')])){logger[_0xfa74('0x1f')](_0xfa74('0x3c'),_0x50919e['uniqueid']);this[_0xfa74('0x18')](_0x50919e[_0xfa74('0x27')]);}else if(this[_0xfa74('0xb')][_0x50919e[_0xfa74('0x3d')]]&&_[_0xfa74('0x3a')](this[_0xfa74('0xb')][_0x50919e[_0xfa74('0x3d')]]['attended'])){logger[_0xfa74('0x1f')](_0xfa74('0x3e'),_0x50919e['linkedid']);this[_0xfa74('0x18')](_0x50919e[_0xfa74('0x3d')]);}}catch(_0x43af7a){logger[_0xfa74('0x2a')]('[ACW][syncHangupRequest]\x20%s',_0x43af7a['message']);}};Acw['prototype'][_0xfa74('0x3f')]=function(_0x3e0c8b){try{if(this[_0xfa74('0xb')][_0x3e0c8b[_0xfa74('0x27')]]&&this[_0xfa74('0xb')][_0x3e0c8b[_0xfa74('0x27')]][_0xfa74('0x3b')]){logger[_0xfa74('0x1f')](_0xfa74('0x40'),_0x3e0c8b['uniqueid']);this[_0xfa74('0x18')](_0x3e0c8b[_0xfa74('0x27')]);}}catch(_0x4d2d6a){logger['error'](_0xfa74('0x41'),_0x4d2d6a['message']);}};Acw[_0xfa74('0x31')][_0xfa74('0x12')]=function(_0x503d14){try{if(this[_0xfa74('0xb')][_0x503d14[_0xfa74('0x42')]]){logger[_0xfa74('0x1f')](_0xfa74('0x43'),_0x503d14['origtransfereruniqueid']);this[_0xfa74('0x18')](_0x503d14[_0xfa74('0x42')]);}else if(this['channels'][_0x503d14['origtransfererlinkedid']]){logger[_0xfa74('0x1f')]('[%s][ATTENDEDTRANSFER:LINKEDID]',_0x503d14['origtransfererlinkedid']);this[_0xfa74('0x18')](_0x503d14['origtransfererlinkedid']);}logger[_0xfa74('0x1f')](_0xfa74('0x44'),_0x503d14[_0xfa74('0x45')]);this[_0xfa74('0xb')][_0x503d14[_0xfa74('0x45')]]=_[_0xfa74('0x46')](this[_0xfa74('0xb')],[_0xfa74('0x19'),util['format'](_0xfa74('0x47'),_0x503d14[_0xfa74('0x48')])]);if(this[_0xfa74('0xb')][_0x503d14[_0xfa74('0x45')]]){this[_0xfa74('0xb')][_0x503d14[_0xfa74('0x45')]][_0xfa74('0x3b')]=!![];delete this[_0xfa74('0xb')][_['findKey'](this[_0xfa74('0xb')],['interface',util[_0xfa74('0x49')](_0xfa74('0x47'),_0x503d14[_0xfa74('0x48')])])];}}catch(_0x2830f5){logger['error'](_0xfa74('0x4a'),_0x2830f5[_0xfa74('0x30')]);}};Acw[_0xfa74('0x31')]['syncBlindTransfer']=function(_0x37a267){try{if(this[_0xfa74('0xb')][_0x37a267[_0xfa74('0x4b')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xfa74('0x35')](_0x37a267[_0xfa74('0x4b')]));this[_0xfa74('0x18')](_0x37a267['transfereruniqueid']);}else if(this[_0xfa74('0xb')][_0x37a267[_0xfa74('0x4c')]]){logger[_0xfa74('0x1f')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xfa74('0x35')](_0x37a267[_0xfa74('0x4c')]));this[_0xfa74('0x18')](_0x37a267[_0xfa74('0x4c')]);}}catch(_0x387348){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0x387348[_0xfa74('0x30')]);}};Acw[_0xfa74('0x31')][_0xfa74('0x10')]=function(_0x8865f9){try{if(this[_0xfa74('0x8')][_0x8865f9[_0xfa74('0x1a')]]&&this['voiceQueues'][_0x8865f9[_0xfa74('0x1a')]]['autopause']===_0xfa74('0x4d')){if(this[_0xfa74('0x9')][_0x8865f9[_0xfa74('0x19')]]){logger['info'](_0xfa74('0x4e'),_0x8865f9[_0xfa74('0x27')],_0x8865f9['interface'],_0x8865f9[_0xfa74('0x1a')]);return RpcUser[_0xfa74('0x20')](this[_0xfa74('0x9')][_0x8865f9['interface']],_0xfa74('0x4f'),_0x8865f9['uniqueid']);}}}catch(_0x449c6f){logger['error'](_0xfa74('0x50'),_0x449c6f[_0xfa74('0x30')]);}};module[_0xfa74('0x51')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index cefbc36..4fadf60 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(_0x22ed32,_0x37dedf){var _0x1e8eee=function(_0x5469fa){while(--_0x5469fa){_0x22ed32['push'](_0x22ed32['shift']());}};_0x1e8eee(++_0x37dedf);}(_0x7a54,0x106));var _0x47a5=function(_0x46ff77,_0x505583){_0x46ff77=_0x46ff77-0x0;var _0x92c9e1=_0x7a54[_0x46ff77];return _0x92c9e1;};'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(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0x7a54,0x106));var _0x47a5=function(_0x76883c,_0x1a210a){_0x76883c=_0x76883c-0x0;var _0x2c2e4d=_0x7a54[_0x76883c];return _0x2c2e4d;};'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 5d15af6..ed9623f 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 _0x1611=['exports','jayson/promise','bluebird','../../config/logger','ami','Request','then','debug','rpc','memberReport','error','message','catch'];(function(_0x55969b,_0x1ebe62){var _0x3d7fc1=function(_0x5f2dbe){while(--_0x5f2dbe){_0x55969b['push'](_0x55969b['shift']());}};_0x3d7fc1(++_0x1ebe62);}(_0x1611,0xc4));var _0x1161=function(_0x7a286c,_0x22aee9){_0x7a286c=_0x7a286c-0x0;var _0x488661=_0x1611[_0x7a286c];return _0x488661;};'use strict';var jayson=require(_0x1161('0x0'));var BPromise=require(_0x1161('0x1'));var logger=require(_0x1161('0x2'))(_0x1161('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0x1161('0x4')]=function(_0x414eae,_0x3d3367){return new BPromise(function(_0x312324,_0x12394b){return client['request'](_0x414eae,_0x3d3367)[_0x1161('0x5')](function(_0x588680){logger[_0x1161('0x6')](_0x1161('0x7'),_0x1161('0x8'),_0x414eae,_0x3d3367,_0x588680);if(_0x588680['error']){logger['error'](_0x1161('0x7'),_0x1161('0x8'),_0x414eae,_0x588680[_0x1161('0x9')][_0x1161('0xa')],_0x3d3367);return _0x12394b(_0x588680[_0x1161('0x9')][_0x1161('0xa')]);}else{return _0x312324(_0x588680['result']);}})[_0x1161('0xb')](function(_0x2a579b){logger[_0x1161('0x9')]('rpc',_0x1161('0x8'),_0x414eae,_0x2a579b,_0x3d3367);return _0x12394b(_0x2a579b);});});};module[_0x1161('0xc')]=client; \ No newline at end of file +var _0xa4bc=['../../config/logger','client','http','request','debug','rpc','memberReport','error','message','result','catch','exports','bluebird'];(function(_0xf54b8e,_0x10e225){var _0x58c551=function(_0x192e32){while(--_0x192e32){_0xf54b8e['push'](_0xf54b8e['shift']());}};_0x58c551(++_0x10e225);}(_0xa4bc,0x185));var _0xca4b=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0xa4bc[_0x52f1e6];return _0x21f104;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xca4b('0x0'));var logger=require(_0xca4b('0x1'))('ami');var client=jayson[_0xca4b('0x2')][_0xca4b('0x3')]({'port':0x2329});client['Request']=function(_0x4ffc21,_0x3bb8d2){return new BPromise(function(_0x4e1215,_0x31ff01){return client[_0xca4b('0x4')](_0x4ffc21,_0x3bb8d2)['then'](function(_0x284140){logger[_0xca4b('0x5')](_0xca4b('0x6'),_0xca4b('0x7'),_0x4ffc21,_0x3bb8d2,_0x284140);if(_0x284140['error']){logger[_0xca4b('0x8')](_0xca4b('0x6'),_0xca4b('0x7'),_0x4ffc21,_0x284140[_0xca4b('0x8')]['message'],_0x3bb8d2);return _0x31ff01(_0x284140[_0xca4b('0x8')][_0xca4b('0x9')]);}else{return _0x4e1215(_0x284140[_0xca4b('0xa')]);}})[_0xca4b('0xb')](function(_0x25d690){logger[_0xca4b('0x8')]('rpc','memberReport',_0x4ffc21,_0x25d690,_0x3bb8d2);return _0x31ff01(_0x25d690);});});};module[_0xca4b('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 623af71..4a2a9d9 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 _0xae1c=['dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','queue','exports','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','number','phone','active','type'];(function(_0xe1ff9d,_0x502072){var _0x5f21fb=function(_0x3749a9){while(--_0x3749a9){_0xe1ff9d['push'](_0xe1ff9d['shift']());}};_0x5f21fb(++_0x502072);}(_0xae1c,0xff));var _0xcae1=function(_0x857e56,_0x330617){_0x857e56=_0x857e56-0x0;var _0x281d2e=_0xae1c[_0x857e56];return _0x281d2e;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x5a90b0,_0x1ab262,_0x19e218){var _0x3e2e25='';if(!_[_0xcae1('0x0')](_0x1ab262)&&_0xcae1('0x1')===typeof _0x1ab262){_0x3e2e25+=_0x1ab262;}if(!_[_0xcae1('0x0')](_0x19e218)&&_0xcae1('0x1')===typeof _0x19e218){_0x3e2e25+='\x20'+_0x19e218;}if(_0x3e2e25!==''){return _0x3e2e25;}return _0x5a90b0;}function Action(_0x744199,_0x3513e5,_0x40fcec){this[_0xcae1('0x2')]=_0x744199;this[_0xcae1('0x3')]=_0x40fcec||undefined;this[_0xcae1('0x4')]=checkNameSurname(_0x3513e5['Contact']['phone'],_0x3513e5[_0xcae1('0x5')][_0xcae1('0x6')],_0x3513e5[_0xcae1('0x5')]['lastName']);this[_0xcae1('0x7')]=_0x3513e5[_0xcae1('0x5')][_0xcae1('0x8')];this['queue']=_0x744199[_0xcae1('0x4')];this[_0xcae1('0x9')]=_0x3513e5['active']||![];this['type']=_0x744199[_0xcae1('0xa')];this[_0xcae1('0xb')]=_0x744199[_0xcae1('0xb')]||0x3;this[_0xcae1('0xc')]=_0x3513e5[_0xcae1('0xc')];this[_0xcae1('0xd')]=_0x3513e5[_0xcae1('0xd')];this[_0xcae1('0xe')]=_0x3513e5[_0xcae1('0xe')];this[_0xcae1('0xf')]=_0x3513e5[_0xcae1('0xf')];this[_0xcae1('0x10')]=_0x3513e5[_0xcae1('0x10')];this[_0xcae1('0x11')]=_0x3513e5[_0xcae1('0x11')];this['UserId']=_0x3513e5[_0xcae1('0x12')];this[_0xcae1('0x13')]=_0x3513e5['VoiceQueueId'];this['CampaignId']=_0x3513e5[_0xcae1('0x14')];this[_0xcae1('0x15')]=_0x3513e5['id'];this['ContactFirstName']=_0x3513e5['Contact'][_0xcae1('0x6')]||'';this['starttime']=moment()[_0xcae1('0x16')](_0xcae1('0x17'));this[_0xcae1('0x18')]=_0x3513e5[_0xcae1('0x18')];this[_0xcae1('0x19')]=_0x3513e5[_0xcae1('0x19')];this[_0xcae1('0x1a')]=_0x3513e5[_0xcae1('0x1a')];this[_0xcae1('0x1b')]=_0x3513e5[_0xcae1('0x1b')];this[_0xcae1('0x1c')]='';this[_0xcae1('0x1d')]='';}Action[_0xcae1('0x1e')][_0xcae1('0x1f')]=function(){return util['format'](_0xcae1('0x20'),this[_0xcae1('0x4')],this[_0xcae1('0x2')][_0xcae1('0x21')]>0x0?this['number'][_0xcae1('0x22')](this[_0xcae1('0x2')][_0xcae1('0x21')]):this[_0xcae1('0x7')]);};Action[_0xcae1('0x1e')][_0xcae1('0x23')]=function(){return this[_0xcae1('0x24')];};module[_0xcae1('0x25')]=Action; \ No newline at end of file +var _0xac4f=['recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','callbackat'];(function(_0x479131,_0x2828f4){var _0x28e996=function(_0xc3890d){while(--_0xc3890d){_0x479131['push'](_0x479131['shift']());}};_0x28e996(++_0x2828f4);}(_0xac4f,0x122));var _0xfac4=function(_0x39914e,_0x1ec745){_0x39914e=_0x39914e-0x0;var _0x56350b=_0xac4f[_0x39914e];return _0x56350b;};'use strict';var util=require(_0xfac4('0x0'));var _=require('lodash');var moment=require(_0xfac4('0x1'));function checkNameSurname(_0x532510,_0x26a9cf,_0x47b474){var _0x5c32a3='';if(!_[_0xfac4('0x2')](_0x26a9cf)&&_0xfac4('0x3')===typeof _0x26a9cf){_0x5c32a3+=_0x26a9cf;}if(!_['isNil'](_0x47b474)&&_0xfac4('0x3')===typeof _0x47b474){_0x5c32a3+='\x20'+_0x47b474;}if(_0x5c32a3!==''){return _0x5c32a3;}return _0x532510;}function Action(_0x174409,_0x1aae1c,_0x48f014){this[_0xfac4('0x4')]=_0x174409;this[_0xfac4('0x5')]=_0x48f014||undefined;this[_0xfac4('0x6')]=checkNameSurname(_0x1aae1c[_0xfac4('0x7')][_0xfac4('0x8')],_0x1aae1c[_0xfac4('0x7')]['firstName'],_0x1aae1c[_0xfac4('0x7')][_0xfac4('0x9')]);this[_0xfac4('0xa')]=_0x1aae1c[_0xfac4('0x7')][_0xfac4('0x8')];this[_0xfac4('0xb')]=_0x174409[_0xfac4('0x6')];this[_0xfac4('0xc')]=_0x1aae1c[_0xfac4('0xc')]||![];this[_0xfac4('0xd')]=_0x174409[_0xfac4('0xd')];this[_0xfac4('0xe')]=_0x174409['dialQueueTimeout']||0x3;this[_0xfac4('0xf')]=_0x1aae1c['scheduledat'];this[_0xfac4('0x10')]=_0x1aae1c[_0xfac4('0x10')];this[_0xfac4('0x11')]=_0x1aae1c[_0xfac4('0x11')];this[_0xfac4('0x12')]=_0x1aae1c[_0xfac4('0x12')];this[_0xfac4('0x13')]=_0x1aae1c[_0xfac4('0x13')];this['ListId']=_0x1aae1c[_0xfac4('0x14')];this[_0xfac4('0x15')]=_0x1aae1c[_0xfac4('0x15')];this[_0xfac4('0x16')]=_0x1aae1c[_0xfac4('0x16')];this[_0xfac4('0x17')]=_0x1aae1c[_0xfac4('0x17')];this[_0xfac4('0x18')]=_0x1aae1c['id'];this[_0xfac4('0x19')]=_0x1aae1c['Contact']['firstName']||'';this['starttime']=moment()[_0xfac4('0x1a')](_0xfac4('0x1b'));this['callback']=_0x1aae1c['callback'];this['callbackuniqueid']=_0x1aae1c[_0xfac4('0x1c')];this[_0xfac4('0x1d')]=_0x1aae1c['callbackat'];this[_0xfac4('0x1e')]=_0x1aae1c[_0xfac4('0x1e')];this[_0xfac4('0x1f')]='';this[_0xfac4('0x20')]='';}Action[_0xfac4('0x21')][_0xfac4('0x22')]=function(){return util[_0xfac4('0x1a')](_0xfac4('0x23'),this[_0xfac4('0x6')],this[_0xfac4('0x4')][_0xfac4('0x24')]>0x0?this['number'][_0xfac4('0x25')](this[_0xfac4('0x4')]['dialCutDigit']):this[_0xfac4('0xa')]);};Action[_0xfac4('0x21')][_0xfac4('0x26')]=function(){return this['queue'];};module[_0xfac4('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 2544774..bfb1bed 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 _0x63b6=['countcongestionretry','countnoanswerretry','countglobal','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x339e07,_0x7a0da8){var _0x10a9c2=function(_0x3cf84f){while(--_0x3cf84f){_0x339e07['push'](_0x339e07['shift']());}};_0x10a9c2(++_0x7a0da8);}(_0x63b6,0x126));var _0x663b=function(_0x11fde2,_0x118c3f){_0x11fde2=_0x11fde2-0x0;var _0x250972=_0x63b6[_0x11fde2];return _0x250972;};'use strict';var util=require(_0x663b('0x0'));var _=require(_0x663b('0x1'));var moment=require('moment');function getSeconds(_0x3842f9,_0x1e2739){var _0x12403f=moment(_0x3842f9)['milliseconds'](0x0);var _0xb28b3c=moment(_0x1e2739)[_0x663b('0x2')](0x0);return _0x12403f[_0x663b('0x3')](_0xb28b3c,_0x663b('0x4'));}function AgentComplete(_0x582dc4,_0x19813e){this[_0x663b('0x5')]=0x4;this[_0x663b('0x6')]=_0x663b('0x7');this[_0x663b('0x8')]=_0x582dc4[_0x663b('0x8')];this[_0x663b('0x9')]=_0x582dc4[_0x663b('0x9')];this[_0x663b('0xa')]=_0x582dc4[_0x663b('0x9')]===_0x663b('0xb')?_0x663b('0xc'):_0x582dc4[_0x663b('0x9')];this[_0x663b('0xd')]=_0x582dc4['countbusyretry'];this[_0x663b('0xe')]=_0x582dc4[_0x663b('0xe')];this['countnoanswerretry']=_0x582dc4[_0x663b('0xf')];this[_0x663b('0x10')]=_0x582dc4[_0x663b('0xd')]+_0x582dc4[_0x663b('0xe')]+_0x582dc4[_0x663b('0xf')];this[_0x663b('0x11')]=_0x19813e[_0x663b('0x11')];this['calleridname']=_0x582dc4[_0x663b('0x12')];this[_0x663b('0x13')]=_0x582dc4[_0x663b('0x14')];this[_0x663b('0x15')]=_0x582dc4[_0x663b('0x15')];this[_0x663b('0x16')]=_0x582dc4[_0x663b('0x16')];this[_0x663b('0x17')]=_0x582dc4[_0x663b('0x17')];this[_0x663b('0x18')]=moment()[_0x663b('0x19')](_0x663b('0x1a'));this[_0x663b('0x1b')]=getSeconds(_0x582dc4[_0x663b('0x16')],_0x582dc4['starttime']);this[_0x663b('0x1c')]=getSeconds(_0x582dc4['answertime'],_0x582dc4[_0x663b('0x16')]);this[_0x663b('0x1d')]=getSeconds(this[_0x663b('0x18')],_0x582dc4[_0x663b('0x17')]);this[_0x663b('0xc')]=_0x19813e[_0x663b('0xc')];this[_0x663b('0x1e')]=_0x19813e[_0x663b('0x1e')];this[_0x663b('0x1f')]=_0x19813e[_0x663b('0x1f')];this[_0x663b('0x20')]=_0x582dc4['callback'];this[_0x663b('0x21')]=_0x582dc4[_0x663b('0x21')];this['callbackat']=_0x582dc4[_0x663b('0x22')];this[_0x663b('0x23')]=_0x582dc4[_0x663b('0x23')];this[_0x663b('0x24')]=_0x582dc4[_0x663b('0x24')];this[_0x663b('0x25')]=_0x582dc4[_0x663b('0x25')];this[_0x663b('0x26')]=_0x582dc4[_0x663b('0x26')];this[_0x663b('0x27')]=_0x582dc4[_0x663b('0x27')];this[_0x663b('0x28')]=_0x582dc4[_0x663b('0x28')];this[_0x663b('0x29')]=_0x582dc4[_0x663b('0x29')]||'';this[_0x663b('0x2a')]=_0x582dc4[_0x663b('0x2a')]||'';}module[_0x663b('0x2b')]=AgentComplete; \ No newline at end of file +var _0xb6dd=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','endtime','membername','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xb6dd,0xd4));var _0xdb6d=function(_0x5d5749,_0x361d83){_0x5d5749=_0x5d5749-0x0;var _0x1ead5b=_0xb6dd[_0x5d5749];return _0x1ead5b;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xdb6d('0x0'));function getSeconds(_0x185fd3,_0x401442){var _0x4d906d=moment(_0x185fd3)[_0xdb6d('0x1')](0x0);var _0x109da5=moment(_0x401442)['milliseconds'](0x0);return _0x4d906d['diff'](_0x109da5,_0xdb6d('0x2'));}function AgentComplete(_0x8b6c64,_0x5a01ec){this['state']=0x4;this[_0xdb6d('0x3')]=_0xdb6d('0x4');this['scheduledat']=_0x8b6c64[_0xdb6d('0x5')];this[_0xdb6d('0x6')]=_0x8b6c64[_0xdb6d('0x6')];this[_0xdb6d('0x7')]=_0x8b6c64['type']===_0xdb6d('0x8')?_0xdb6d('0x9'):_0x8b6c64[_0xdb6d('0x6')];this[_0xdb6d('0xa')]=_0x8b6c64[_0xdb6d('0xa')];this['countcongestionretry']=_0x8b6c64[_0xdb6d('0xb')];this[_0xdb6d('0xc')]=_0x8b6c64['countnoanswerretry'];this[_0xdb6d('0xd')]=_0x8b6c64[_0xdb6d('0xa')]+_0x8b6c64[_0xdb6d('0xb')]+_0x8b6c64[_0xdb6d('0xc')];this['uniqueid']=_0x5a01ec[_0xdb6d('0xe')];this[_0xdb6d('0xf')]=_0x8b6c64[_0xdb6d('0x10')];this[_0xdb6d('0x11')]=_0x8b6c64[_0xdb6d('0x12')];this[_0xdb6d('0x13')]=_0x8b6c64['starttime'];this[_0xdb6d('0x14')]=_0x8b6c64['responsetime'];this[_0xdb6d('0x15')]=_0x8b6c64[_0xdb6d('0x15')];this['endtime']=moment()[_0xdb6d('0x16')](_0xdb6d('0x17'));this[_0xdb6d('0x18')]=getSeconds(_0x8b6c64['responsetime'],_0x8b6c64[_0xdb6d('0x13')]);this[_0xdb6d('0x19')]=getSeconds(_0x8b6c64['answertime'],_0x8b6c64['responsetime']);this[_0xdb6d('0x1a')]=getSeconds(this[_0xdb6d('0x1b')],_0x8b6c64[_0xdb6d('0x15')]);this[_0xdb6d('0x9')]=_0x5a01ec[_0xdb6d('0x9')];this[_0xdb6d('0x1c')]=_0x5a01ec[_0xdb6d('0x1c')];this['reason']=_0x5a01ec['reason'];this[_0xdb6d('0x1d')]=_0x8b6c64['callback'];this['callbackuniqueid']=_0x8b6c64[_0xdb6d('0x1e')];this['callbackat']=_0x8b6c64[_0xdb6d('0x1f')];this[_0xdb6d('0x20')]=_0x8b6c64['recallme'];this[_0xdb6d('0x21')]=_0x8b6c64[_0xdb6d('0x21')];this[_0xdb6d('0x22')]=_0x8b6c64[_0xdb6d('0x22')];this['UserId']=_0x8b6c64[_0xdb6d('0x23')];this[_0xdb6d('0x24')]=_0x8b6c64[_0xdb6d('0x24')];this[_0xdb6d('0x25')]=_0x8b6c64[_0xdb6d('0x25')];this[_0xdb6d('0x26')]=_0x8b6c64[_0xdb6d('0x26')]||'';this[_0xdb6d('0x27')]=_0x8b6c64['originatecalleridname']||'';}module[_0xdb6d('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 c5b2e12..dee0df7 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 _0x5232=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback'];(function(_0x59bfb3,_0xf90f6a){var _0x5a51f4=function(_0x3ecdf5){while(--_0x3ecdf5){_0x59bfb3['push'](_0x59bfb3['shift']());}};_0x5a51f4(++_0xf90f6a);}(_0x5232,0x1c9));var _0x2523=function(_0x4226d6,_0x3864ca){_0x4226d6=_0x4226d6-0x0;var _0x19655b=_0x5232[_0x4226d6];return _0x19655b;};'use strict';var util=require(_0x2523('0x0'));var _=require(_0x2523('0x1'));var moment=require(_0x2523('0x2'));function getSeconds(_0x40bf09,_0x23cd16){var _0x4f72a8=moment(_0x40bf09)['milliseconds'](0x0);var _0x3ce9f5=moment(_0x23cd16)[_0x2523('0x3')](0x0);return _0x4f72a8['diff'](_0x3ce9f5,_0x2523('0x4'));}function Final(_0x3cf8c0){this[_0x2523('0x5')]=_0x3cf8c0[_0x2523('0x5')];this[_0x2523('0x6')]=_0x3cf8c0[_0x2523('0x6')];this[_0x2523('0x7')]=_0x3cf8c0[_0x2523('0x7')];this[_0x2523('0x8')]=_0x3cf8c0[_0x2523('0x7')]===_0x2523('0x9')?_0x2523('0xa'):_0x3cf8c0['type'];this[_0x2523('0xb')]=_0x3cf8c0[_0x2523('0xb')];this[_0x2523('0xc')]=_0x3cf8c0[_0x2523('0xc')];this[_0x2523('0xd')]=_0x3cf8c0[_0x2523('0xd')];this['countglobal']=_0x3cf8c0[_0x2523('0xb')]+_0x3cf8c0[_0x2523('0xc')]+_0x3cf8c0[_0x2523('0xd')];this[_0x2523('0xa')]=_0x3cf8c0['queue'];this[_0x2523('0xe')]=_0x3cf8c0[_0x2523('0xe')];this['calleridnum']=_0x3cf8c0[_0x2523('0xf')];this[_0x2523('0x10')]=_0x3cf8c0[_0x2523('0x10')];this[_0x2523('0x11')]=_0x3cf8c0['responsetime'];this[_0x2523('0x12')]=_0x3cf8c0['responsetime'];this[_0x2523('0x13')]=_0x3cf8c0[_0x2523('0x13')]||0x0;this[_0x2523('0x14')]=_0x3cf8c0[_0x2523('0x14')]||0x0;this['talktime']=_0x3cf8c0[_0x2523('0x15')]||0x0;this[_0x2523('0x16')]=_0x3cf8c0[_0x2523('0x16')];this[_0x2523('0x17')]=_0x3cf8c0[_0x2523('0x17')];this[_0x2523('0x18')]=_0x3cf8c0['callbackat'];this[_0x2523('0x19')]=_0x3cf8c0[_0x2523('0x19')];this['ContactId']=_0x3cf8c0[_0x2523('0x1a')];this[_0x2523('0x1b')]=_0x3cf8c0[_0x2523('0x1b')];this[_0x2523('0x1c')]=_0x3cf8c0['UserId'];this['VoiceQueueId']=_0x3cf8c0['VoiceQueueId'];this['CampaignId']=_0x3cf8c0[_0x2523('0x1d')];this[_0x2523('0x1e')]=_0x3cf8c0[_0x2523('0x1e')]||'';this[_0x2523('0x1f')]=_0x3cf8c0[_0x2523('0x1f')]||'';}module['exports']=Final; \ No newline at end of file +var _0x1867=['originatecalleridnum','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','calleridname','calleridnum','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1867,0xb5));var _0x7186=function(_0x268fa0,_0x1ee87c){_0x268fa0=_0x268fa0-0x0;var _0x54efe0=_0x1867[_0x268fa0];return _0x54efe0;};'use strict';var util=require(_0x7186('0x0'));var _=require(_0x7186('0x1'));var moment=require('moment');function getSeconds(_0x44f581,_0x550676){var _0x343df3=moment(_0x44f581)[_0x7186('0x2')](0x0);var _0xeb165d=moment(_0x550676)[_0x7186('0x2')](0x0);return _0x343df3[_0x7186('0x3')](_0xeb165d,_0x7186('0x4'));}function Final(_0x2fbf92){this[_0x7186('0x5')]=_0x2fbf92[_0x7186('0x5')];this['scheduledat']=_0x2fbf92[_0x7186('0x6')];this[_0x7186('0x7')]=_0x2fbf92['type'];this[_0x7186('0x8')]=_0x2fbf92[_0x7186('0x7')]===_0x7186('0x9')?_0x7186('0xa'):_0x2fbf92['type'];this[_0x7186('0xb')]=_0x2fbf92[_0x7186('0xb')];this[_0x7186('0xc')]=_0x2fbf92[_0x7186('0xc')];this[_0x7186('0xd')]=_0x2fbf92['countnoanswerretry'];this[_0x7186('0xe')]=_0x2fbf92[_0x7186('0xb')]+_0x2fbf92[_0x7186('0xc')]+_0x2fbf92[_0x7186('0xd')];this['queue']=_0x2fbf92[_0x7186('0xa')];this[_0x7186('0xf')]=_0x2fbf92[_0x7186('0xf')];this[_0x7186('0x10')]=_0x2fbf92['calleridnum'];this['starttime']=_0x2fbf92['starttime'];this[_0x7186('0x11')]=_0x2fbf92[_0x7186('0x11')];this[_0x7186('0x12')]=_0x2fbf92[_0x7186('0x11')];this['ringtime']=_0x2fbf92[_0x7186('0x13')]||0x0;this[_0x7186('0x14')]=_0x2fbf92[_0x7186('0x14')]||0x0;this[_0x7186('0x15')]=_0x2fbf92[_0x7186('0x15')]||0x0;this[_0x7186('0x16')]=_0x2fbf92[_0x7186('0x16')];this[_0x7186('0x17')]=_0x2fbf92['callbackuniqueid'];this[_0x7186('0x18')]=_0x2fbf92[_0x7186('0x18')];this['recallme']=_0x2fbf92[_0x7186('0x19')];this[_0x7186('0x1a')]=_0x2fbf92[_0x7186('0x1a')];this['ListId']=_0x2fbf92['ListId'];this[_0x7186('0x1b')]=_0x2fbf92['UserId'];this[_0x7186('0x1c')]=_0x2fbf92['VoiceQueueId'];this['CampaignId']=_0x2fbf92['CampaignId'];this[_0x7186('0x1d')]=_0x2fbf92[_0x7186('0x1d')]||'';this['originatecalleridname']=_0x2fbf92['originatecalleridname']||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 9e7e08a..5f530b6 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','calleridname','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','seconds'];(function(_0x3ced47,_0x28f492){var _0x3ad748=function(_0x5ba887){while(--_0x5ba887){_0x3ced47['push'](_0x3ced47['shift']());}};_0x3ad748(++_0x28f492);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));function getSeconds(_0x10a05d,_0x5b96eb){var _0x86c128=moment(_0x10a05d)[_0x7995('0x3')](0x0);var _0x1902b4=moment(_0x5b96eb)[_0x7995('0x3')](0x0);return _0x86c128['diff'](_0x1902b4,_0x7995('0x4'));}function Hangup(_0x1a36d8,_0x137b6b){this[_0x7995('0x5')]=0x4;this[_0x7995('0x6')]=_0x7995('0x7');this['scheduledat']=_0x1a36d8[_0x7995('0x8')];this[_0x7995('0x9')]=_0x1a36d8['type'];this[_0x7995('0xa')]=_0x1a36d8[_0x7995('0x9')]===_0x7995('0xb')?_0x7995('0xc'):_0x1a36d8[_0x7995('0x9')];this[_0x7995('0xd')]=_0x1a36d8[_0x7995('0xd')];this['countcongestionretry']=_0x1a36d8[_0x7995('0xe')];this[_0x7995('0xf')]=_0x1a36d8['countnoanswerretry'];this[_0x7995('0x10')]=_0x1a36d8[_0x7995('0xd')]+_0x1a36d8[_0x7995('0xe')]+_0x1a36d8[_0x7995('0xf')];this[_0x7995('0x11')]=_0x137b6b[_0x7995('0x11')];this[_0x7995('0x12')]=_0x1a36d8['name'];this['calleridnum']=_0x1a36d8[_0x7995('0x13')];this[_0x7995('0x14')]=_0x1a36d8[_0x7995('0x14')];this[_0x7995('0x15')]=_0x1a36d8[_0x7995('0x15')];this[_0x7995('0x16')]=moment()[_0x7995('0x17')](_0x7995('0x18'));this['ringtime']=getSeconds(_0x1a36d8[_0x7995('0x15')],_0x1a36d8['starttime']);this[_0x7995('0x19')]=0x0;this[_0x7995('0x1a')]=getSeconds(this[_0x7995('0x16')],_0x1a36d8[_0x7995('0x15')]);this[_0x7995('0xc')]=_0x1a36d8[_0x7995('0xc')];this['membername']='IVR';this[_0x7995('0x1b')]=_0x137b6b['cause-txt'];this['callback']=_0x1a36d8[_0x7995('0x1c')];this[_0x7995('0x1d')]=_0x1a36d8['callbackuniqueid'];this[_0x7995('0x1e')]=_0x1a36d8['callbackat'];this['recallme']=_0x1a36d8[_0x7995('0x1f')];this[_0x7995('0x20')]=_0x1a36d8[_0x7995('0x20')];this[_0x7995('0x21')]=_0x1a36d8[_0x7995('0x21')];this[_0x7995('0x22')]=_0x1a36d8['UserId'];this[_0x7995('0x23')]=_0x1a36d8[_0x7995('0x23')];this[_0x7995('0x24')]=_0x1a36d8[_0x7995('0x24')];}module[_0x7995('0x25')]=Hangup; \ No newline at end of file +var _0xa9e0=['countglobal','countcongestionretry','countnoanswerretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','type','outbound','queue','countbusyretry'];(function(_0x3b119f,_0x4f10d3){var _0x1aff29=function(_0x5bba09){while(--_0x5bba09){_0x3b119f['push'](_0x3b119f['shift']());}};_0x1aff29(++_0x4f10d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function getSeconds(_0x5dd881,_0x550fbc){var _0x18d5c9=moment(_0x5dd881)['milliseconds'](0x0);var _0x333808=moment(_0x550fbc)[_0x0a9e('0x3')](0x0);return _0x18d5c9[_0x0a9e('0x4')](_0x333808,_0x0a9e('0x5'));}function Hangup(_0x981158,_0x57b080){this[_0x0a9e('0x6')]=0x4;this[_0x0a9e('0x7')]=_0x0a9e('0x8');this['scheduledat']=_0x981158['scheduledat'];this[_0x0a9e('0x9')]=_0x981158['type'];this['campaigntype']=_0x981158[_0x0a9e('0x9')]===_0x0a9e('0xa')?_0x0a9e('0xb'):_0x981158[_0x0a9e('0x9')];this[_0x0a9e('0xc')]=_0x981158[_0x0a9e('0xc')];this['countcongestionretry']=_0x981158['countcongestionretry'];this['countnoanswerretry']=_0x981158['countnoanswerretry'];this[_0x0a9e('0xd')]=_0x981158[_0x0a9e('0xc')]+_0x981158[_0x0a9e('0xe')]+_0x981158[_0x0a9e('0xf')];this[_0x0a9e('0x10')]=_0x57b080[_0x0a9e('0x10')];this['calleridname']=_0x981158[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x981158[_0x0a9e('0x13')];this[_0x0a9e('0x14')]=_0x981158[_0x0a9e('0x14')];this[_0x0a9e('0x15')]=_0x981158['responsetime'];this[_0x0a9e('0x16')]=moment()['format'](_0x0a9e('0x17'));this['ringtime']=getSeconds(_0x981158[_0x0a9e('0x15')],_0x981158[_0x0a9e('0x14')]);this['holdtime']=0x0;this[_0x0a9e('0x18')]=getSeconds(this['endtime'],_0x981158[_0x0a9e('0x15')]);this[_0x0a9e('0xb')]=_0x981158[_0x0a9e('0xb')];this[_0x0a9e('0x19')]=_0x0a9e('0x1a');this[_0x0a9e('0x1b')]=_0x57b080[_0x0a9e('0x1c')];this[_0x0a9e('0x1d')]=_0x981158[_0x0a9e('0x1d')];this[_0x0a9e('0x1e')]=_0x981158[_0x0a9e('0x1e')];this[_0x0a9e('0x1f')]=_0x981158['callbackat'];this[_0x0a9e('0x20')]=_0x981158[_0x0a9e('0x20')];this['ContactId']=_0x981158[_0x0a9e('0x21')];this['ListId']=_0x981158['ListId'];this[_0x0a9e('0x22')]=_0x981158[_0x0a9e('0x22')];this[_0x0a9e('0x23')]=_0x981158[_0x0a9e('0x23')];this['CampaignId']=_0x981158[_0x0a9e('0x24')];}module[_0x0a9e('0x25')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 4552fdf..a4f1c77 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 _0x4da8=['countcongestionretry','countnoanswerretry','countglobal','calleridname','calleridnum','number','starttime','responsetime','ringtime','holdtime','talktime','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x4be871,_0x57ddf3){var _0x3cc1d4=function(_0x251bbb){while(--_0x251bbb){_0x4be871['push'](_0x4be871['shift']());}};_0x3cc1d4(++_0x57ddf3);}(_0x4da8,0xdc));var _0x84da=function(_0x13ee6e,_0x52de49){_0x13ee6e=_0x13ee6e-0x0;var _0x14cb57=_0x4da8[_0x13ee6e];return _0x14cb57;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x84da('0x0'));function getSeconds(_0x53d828,_0x1e24ed){var _0x34be10=moment(_0x53d828)[_0x84da('0x1')](0x0);var _0x2273a9=moment(_0x1e24ed)['milliseconds'](0x0);return _0x34be10[_0x84da('0x2')](_0x2273a9,_0x84da('0x3'));}function History(_0x45de0e){this[_0x84da('0x4')]=_0x45de0e[_0x84da('0x4')];this[_0x84da('0x5')]=_0x45de0e['scheduledat']||undefined;this['type']=_0x45de0e[_0x84da('0x6')];this[_0x84da('0x7')]=_0x45de0e[_0x84da('0x6')]===_0x84da('0x8')?_0x84da('0x9'):_0x45de0e[_0x84da('0x6')];this[_0x84da('0xa')]=_0x45de0e[_0x84da('0xa')];this[_0x84da('0xb')]=_0x45de0e[_0x84da('0xb')];this[_0x84da('0xc')]=_0x45de0e[_0x84da('0xc')];this[_0x84da('0xd')]=_0x45de0e['countbusyretry']+_0x45de0e[_0x84da('0xb')]+_0x45de0e[_0x84da('0xc')];this['queue']=_0x45de0e[_0x84da('0x9')];this[_0x84da('0xe')]=_0x45de0e['name'];this[_0x84da('0xf')]=_0x45de0e[_0x84da('0x10')];this[_0x84da('0x11')]=_0x45de0e[_0x84da('0x11')];this[_0x84da('0x12')]=_0x45de0e[_0x84da('0x12')];this['endtime']=_0x45de0e[_0x84da('0x12')];this[_0x84da('0x13')]=getSeconds(_0x45de0e[_0x84da('0x12')],_0x45de0e['starttime']);this[_0x84da('0x14')]=0x0;this[_0x84da('0x15')]=0x0;this['callback']=_0x45de0e['callback'];this[_0x84da('0x16')]=_0x45de0e['callbackuniqueid'];this[_0x84da('0x17')]=_0x45de0e[_0x84da('0x17')];this[_0x84da('0x18')]=_0x45de0e[_0x84da('0x18')];this[_0x84da('0x19')]=_0x45de0e[_0x84da('0x19')];this[_0x84da('0x1a')]=_0x45de0e[_0x84da('0x1a')];this[_0x84da('0x1b')]=_0x45de0e[_0x84da('0x1b')];this['VoiceQueueId']=_0x45de0e[_0x84da('0x1c')];this[_0x84da('0x1d')]=_0x45de0e[_0x84da('0x1d')];this[_0x84da('0x1e')]=_0x45de0e[_0x84da('0x1e')]||'';this[_0x84da('0x1f')]=_0x45de0e[_0x84da('0x1f')]||'';}module[_0x84da('0x20')]=History; \ No newline at end of file +var _0xb53a=['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','outbound','countbusyretry','countcongestionretry','countglobal','queue','name','calleridnum'];(function(_0x293fbf,_0x25329b){var _0x3332df=function(_0x578c8f){while(--_0x578c8f){_0x293fbf['push'](_0x293fbf['shift']());}};_0x3332df(++_0x25329b);}(_0xb53a,0xc1));var _0xab53=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb53a[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xab53('0x0'));var _=require(_0xab53('0x1'));var moment=require(_0xab53('0x2'));function getSeconds(_0xb69748,_0xddb88){var _0x20a058=moment(_0xb69748)[_0xab53('0x3')](0x0);var _0x117024=moment(_0xddb88)[_0xab53('0x3')](0x0);return _0x20a058[_0xab53('0x4')](_0x117024,_0xab53('0x5'));}function History(_0x5e2746){this[_0xab53('0x6')]=_0x5e2746[_0xab53('0x6')];this[_0xab53('0x7')]=_0x5e2746[_0xab53('0x7')]||undefined;this['type']=_0x5e2746[_0xab53('0x8')];this[_0xab53('0x9')]=_0x5e2746['type']===_0xab53('0xa')?'queue':_0x5e2746[_0xab53('0x8')];this[_0xab53('0xb')]=_0x5e2746[_0xab53('0xb')];this[_0xab53('0xc')]=_0x5e2746[_0xab53('0xc')];this['countnoanswerretry']=_0x5e2746['countnoanswerretry'];this[_0xab53('0xd')]=_0x5e2746[_0xab53('0xb')]+_0x5e2746[_0xab53('0xc')]+_0x5e2746['countnoanswerretry'];this[_0xab53('0xe')]=_0x5e2746[_0xab53('0xe')];this['calleridname']=_0x5e2746[_0xab53('0xf')];this[_0xab53('0x10')]=_0x5e2746['number'];this['starttime']=_0x5e2746[_0xab53('0x11')];this[_0xab53('0x12')]=_0x5e2746['responsetime'];this[_0xab53('0x13')]=_0x5e2746[_0xab53('0x12')];this[_0xab53('0x14')]=getSeconds(_0x5e2746[_0xab53('0x12')],_0x5e2746[_0xab53('0x11')]);this[_0xab53('0x15')]=0x0;this[_0xab53('0x16')]=0x0;this['callback']=_0x5e2746[_0xab53('0x17')];this['callbackuniqueid']=_0x5e2746[_0xab53('0x18')];this[_0xab53('0x19')]=_0x5e2746[_0xab53('0x19')];this['recallme']=_0x5e2746[_0xab53('0x1a')];this[_0xab53('0x1b')]=_0x5e2746[_0xab53('0x1b')];this[_0xab53('0x1c')]=_0x5e2746[_0xab53('0x1c')];this['UserId']=_0x5e2746[_0xab53('0x1d')];this[_0xab53('0x1e')]=_0x5e2746[_0xab53('0x1e')];this[_0xab53('0x1f')]=_0x5e2746[_0xab53('0x1f')];this[_0xab53('0x20')]=_0x5e2746[_0xab53('0x20')]||'';this[_0xab53('0x21')]=_0x5e2746[_0xab53('0x21')]||'';}module[_0xab53('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 4a70036..458e72f 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 _0xcf13=['isNil','Action','status','channel','catch','updateOriginated','queue','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','Success','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','HangupInAMD','membername','[syncHangupInAMD]','MACHINE','Machine','AMD','amd','[syncMachine][createHistory]','[syncMachine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncMachineIvr]','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AGI','[syncHangupIvr][createHistory]','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','YYYY-MM-DD\x20HH:mm:ss','responsetime','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','Abandoned','CALLEREXIT','actionid','roundrobin','locked','paused','stateinterface','push','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','queueStatusComplete','preview','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','CampaignId','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','contactAgent-idHopper:\x20','Agent:\x20','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Intervals','Failure','\x20Intervals\x20is\x20null\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','command','interval','timezones','content','indexOf','iftime\x20%s,%s','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Timezone:\x20','checkDialMethod','handlePower','dialPowerLevel','Queue','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','createdAt','%s%s','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','originate\x20action\x20Error','getQueue','isSuccess','response','countbusyretry','countnoanswerretry','dialGlobalMaxRetry','add','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','minutes','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','callProgressDetecting','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','[syncAgentComplete][createHistory][0]','checkRetriveMax','countcongestionretry','stateGlobal','reason\x200\x20no\x20such\x20number....','NoAnswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','[syncAgentComplete][createHistory][5]','createStateFinal','reason\x205\x20busy','Congestion','reason\x208\x20congestion','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','erlangAbandonmentRate','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive][First]','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Date]','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','Agent\x20free','agent\x20max\x20free\x20','[startMethodPredictive][StartPredictive][First]','averageHandleTime','startMethodPredictive','[averageHandleTime][ErlangB]\x20','getDataPredictive','outboundQueuePauses','predictiveIntervalDroppedCallsTimeout','abandonmentRate','agentBusyFactor','[getDataPredictive]','check\x20failure','erlangCallToSecond','[startMethodPredictive]','[startMethodPredictive][milliseconds]\x20','Failure\x20','recallme','queueStatusComplete:\x20','Queue:\x20','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','checkContactBlack','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','floor','dialLimitQueue','not_inuse','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','[abandonmentRate]','\x20m\x20=\x20','\x20Ts\x20=\x20','\x20p\x20=\x20','\x20Amax\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','busyFactor','[busyFactor]','\x20interval\x20=\x20','\x20Umin\x20=\x20','m\x20=\x20','exports','bluebird','moment','md5','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../../../config/environment/','../ami','socket.io-emitter','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','prototype','enqueue','tail','finally','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','syncAgentConnect','originateresponse','syncOriginateResponse','bind','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','Interval','INTERVAL_IS_NULL','Error','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','Trunk','active','callerid','stringify','voice:queue:%s','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','isEmpty','info','[checkGetDataPredictive][avgTalktime]','predictiveIntervalAvgHoldtime','[checkGetDataPredictive][avgHoldtime]','[checkGetDataPredictive][totalCalls]','[checkGetDataPredictive][obj]','merge','[freeVariablesPredictive]','handlePredictive','string','\x22%s\x22\x20<%s>','error','inspect','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','sequence'];(function(_0x1eb186,_0x3e8197){var _0x49079e=function(_0x2ebd6f){while(--_0x2ebd6f){_0x1eb186['push'](_0x1eb186['shift']());}};_0x49079e(++_0x3e8197);}(_0xcf13,0x130));var _0x3cf1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf13[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x3cf1('0x0'));var uuid=require('uuid');var moment=require(_0x3cf1('0x1'));var rr=require('rr');var md5=require(_0x3cf1('0x2'));var logger=require(_0x3cf1('0x3'))('dialer');var loggerBooked=require('../../../config/logger')(_0x3cf1('0x4'));var loggerPredictive=require('../../../config/logger')(_0x3cf1('0x5'));var loggerPredictiveCalls=require('../../../config/logger')(_0x3cf1('0x6'));var loggerSyncQueueSummary=require(_0x3cf1('0x3'))(_0x3cf1('0x7'));var config=require(_0x3cf1('0x8'));var ami=require(_0x3cf1('0x9'));var io=require(_0x3cf1('0xa'))({'host':'localhost','port':0x18eb});var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x3cf1('0xb'));var cmHopperHistory=require(_0x3cf1('0xc'));var cmHopperBlack=require(_0x3cf1('0xd'));var voiceQueueRt=require(_0x3cf1('0xe'));var Action=require(_0x3cf1('0xf'));var History=require(_0x3cf1('0x10'));var Final=require(_0x3cf1('0x11'));var AgentComplete=require(_0x3cf1('0x12'));var QueueCallerAbandon=require(_0x3cf1('0x13'));var Hangup=require(_0x3cf1('0x14'));var ipAgi=process[_0x3cf1('0x15')]['XCALLY_IP_AGI']||_0x3cf1('0x16');var strategy={'rrmemory':_0x3cf1('0x17'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x3cf1('0x18')][_0x3cf1('0x19')]=function(_0x35ebf5){this[_0x3cf1('0x1a')]=this[_0x3cf1('0x1a')]?this['tail'][_0x3cf1('0x1b')](_0x35ebf5):_0x35ebf5();};function Dialer(_0x1c845a,_0x2ff548){this['sequence']=new Sequence();this['preview']=_0x2ff548;this[_0x3cf1('0x1c')]=_0x1c845a['voiceQueues'];this['campaigns']=_0x1c845a[_0x3cf1('0x1d')];this[_0x3cf1('0x1e')]=_0x1c845a['agents'];this['trunks']=_0x1c845a[_0x3cf1('0x1f')];this[_0x3cf1('0x20')]=config[_0x3cf1('0x20')]||0x2;this[_0x3cf1('0x21')]={};this[_0x3cf1('0x22')]={};this['contactsId']={};this[_0x3cf1('0x23')]={};this[_0x3cf1('0x24')]={};this[_0x3cf1('0x25')]={};this[_0x3cf1('0x26')]={};this[_0x3cf1('0x27')]={};this[_0x3cf1('0x28')]={};this['queueBookedRR']={};ami['on']('agentconnect',this[_0x3cf1('0x29')]['bind'](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x3cf1('0x2a'),this[_0x3cf1('0x2b')][_0x3cf1('0x2c')](this));ami['on'](_0x3cf1('0x2d'),this[_0x3cf1('0x2e')][_0x3cf1('0x2c')](this));ami['on'](_0x3cf1('0x2f'),this[_0x3cf1('0x7')][_0x3cf1('0x2c')](this));ami['on'](_0x3cf1('0x30'),this[_0x3cf1('0x31')][_0x3cf1('0x2c')](this));ami['on'](_0x3cf1('0x32'),this[_0x3cf1('0x33')][_0x3cf1('0x2c')](this));ami['on'](_0x3cf1('0x34'),this[_0x3cf1('0x35')][_0x3cf1('0x2c')](this));ami['on']('queuemember',this[_0x3cf1('0x36')][_0x3cf1('0x2c')](this));ami['on'](_0x3cf1('0x37'),this['syncQueueStatusComplete'][_0x3cf1('0x2c')](this));this[_0x3cf1('0x38')]();this[_0x3cf1('0x39')]();}function isNotNull(_0x218a51){return _0x218a51!==null&&!_[_0x3cf1('0x3a')](_0x218a51);}function checkIsLoggedIn(_0x130009,_0x20a66b){return function(){if(_0x20a66b<=0x0){_0x130009[_0x3cf1('0x3b')]='AGENTS_NOT_LOGGED';throw _0x130009['name']+_0x3cf1('0x3c');}};}function isActive(_0x520781){return _0x520781;}function checkIsActive(_0x166ba0,_0xccfbb9){return function(){if(!isActive(_0xccfbb9)){_0x166ba0[_0x3cf1('0x3b')]=_0x3cf1('0x3d');throw _0x166ba0[_0x3cf1('0x3e')]+'\x20NOT\x20Active';}};}function checkInterval(_0x4639d9){return function(){if(!isNotNull(_0x4639d9[_0x3cf1('0x3f')])){_0x4639d9['message']='INTERVAL_IS_NULL';throw _0x4639d9[_0x3cf1('0x3e')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x4639d9['Interval']['Intervals'])){_0x4639d9[_0x3cf1('0x3b')]=_0x3cf1('0x40');throw _0x4639d9[_0x3cf1('0x3e')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x4639d9[_0x3cf1('0x3f')]['Intervals']))){_0x4639d9['message']='INTERVAL_IS_NULL';throw _0x4639d9['name']+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x546b62,_0x213074,_0x23e409){return{'action':_0x546b62,'response':_0x213074,'message':_0x23e409};}function myreject(_0x2c6862){return function(_0x2772d7){return _0x2c6862(msgResponse('[ifTime][Action]',_0x3cf1('0x41'),JSON['stringify'](_0x2772d7)));};}function getSeconds(_0x5a2ed4,_0x35bcdb){var _0xd2b1ca=moment(_0x5a2ed4)[_0x3cf1('0x42')](0x0);var _0x288a02=moment(_0x35bcdb)[_0x3cf1('0x42')](0x0);return _0xd2b1ca[_0x3cf1('0x43')](_0x288a02,_0x3cf1('0x44'));}function emit(_0x2adb9e,_0x71f041,_0x48510f){io['to'](_0x2adb9e)[_0x3cf1('0x45')](_0x71f041,_0x48510f);}function emitVoiceQueueSummary(_0x3dc4a0){if(_0x3dc4a0[_0x3cf1('0x46')]===_0x3cf1('0x47')){var _0x1fc7e7={'id':_0x3dc4a0['id'],'name':_0x3dc4a0[_0x3cf1('0x3e')],'strategy':_0x3dc4a0[_0x3cf1('0x48')],'answered':_0x3dc4a0[_0x3cf1('0x49')],'available':_0x3dc4a0[_0x3cf1('0x4a')],'loggedIn':_0x3dc4a0[_0x3cf1('0x4b')],'pTalking':_0x3dc4a0[_0x3cf1('0x4c')],'sumBillable':_0x3dc4a0[_0x3cf1('0x4d')],'sumDuration':_0x3dc4a0[_0x3cf1('0x4e')],'sumHoldTime':_0x3dc4a0[_0x3cf1('0x4f')]||0x0,'talking':_0x3dc4a0[_0x3cf1('0x50')],'total':_0x3dc4a0[_0x3cf1('0x51')],'type':_0x3dc4a0[_0x3cf1('0x46')],'unmanaged':_0x3dc4a0['unmanaged'],'waiting':_0x3dc4a0[_0x3cf1('0x52')],'loggedInDb':_0x3dc4a0[_0x3cf1('0x53')],'dialActive':_0x3dc4a0[_0x3cf1('0x54')],'dialMethod':_0x3dc4a0[_0x3cf1('0x55')],'dialOriginateCallerIdName':_0x3dc4a0['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x3dc4a0[_0x3cf1('0x56')],'dialOriginateTimeout':_0x3dc4a0[_0x3cf1('0x57')],'dialPrefix':_0x3dc4a0[_0x3cf1('0x58')],'outboundAnswerAgiCallsDay':_0x3dc4a0[_0x3cf1('0x59')],'outboundAnswerCallsDay':_0x3dc4a0[_0x3cf1('0x5a')],'outboundBlacklistCallsDay':_0x3dc4a0['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x3dc4a0['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x3dc4a0[_0x3cf1('0x5b')],'outboundDropCallsDayACS':_0x3dc4a0[_0x3cf1('0x5c')],'outboundDropCallsDayCallersExit':_0x3dc4a0[_0x3cf1('0x5d')],'outboundDropCallsDayTimeout':_0x3dc4a0[_0x3cf1('0x5e')],'outboundNoAnswerCallsDay':_0x3dc4a0[_0x3cf1('0x5f')],'outboundNoSuchCallsDay':_0x3dc4a0['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x3dc4a0['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x3dc4a0[_0x3cf1('0x60')],'outboundRejectCallsDay':_0x3dc4a0[_0x3cf1('0x61')],'outboundUnknownCallsDay':_0x3dc4a0[_0x3cf1('0x62')],'predictiveIntervalAnsweredCalls':_0x3dc4a0[_0x3cf1('0x63')],'predictiveIntervalAvgHoldtime':_0x3dc4a0['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x3dc4a0[_0x3cf1('0x64')],'predictiveIntervalDroppedCallsCallersExit':_0x3dc4a0[_0x3cf1('0x65')],'predictiveIntervalDroppedCallsTimeout':_0x3dc4a0['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x3dc4a0['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x3dc4a0['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x3dc4a0['predictiveIntervalHitRate'],'predictiveIntervalLowerLimit':_0x3dc4a0[_0x3cf1('0x66')],'predictiveIntervalMultiplicativeFactor':_0x3dc4a0[_0x3cf1('0x67')],'predictiveIntervalPauses':_0x3dc4a0[_0x3cf1('0x68')],'predictiveIntervalTotalCalls':_0x3dc4a0[_0x3cf1('0x69')],'message':_0x3dc4a0[_0x3cf1('0x3b')],'originated':_0x3dc4a0[_0x3cf1('0x6a')]};if(_0x3dc4a0[_0x3cf1('0x6b')]){_0x1fc7e7[_0x3cf1('0x6b')]={'id':_0x3dc4a0[_0x3cf1('0x6b')]['id'],'name':_0x3dc4a0[_0x3cf1('0x6b')][_0x3cf1('0x3e')],'active':_0x3dc4a0[_0x3cf1('0x6b')][_0x3cf1('0x6c')],'callerid':_0x3dc4a0[_0x3cf1('0x6b')][_0x3cf1('0x6d')]};}if(_0x3dc4a0['Interval']){_0x1fc7e7[_0x3cf1('0x3f')]={'id':_0x3dc4a0[_0x3cf1('0x3f')]['id'],'name':_0x3dc4a0[_0x3cf1('0x3f')][_0x3cf1('0x3e')]};}var _0x3ca6d3=md5(JSON[_0x3cf1('0x6e')](_0x1fc7e7));if(_0x3dc4a0[_0x3cf1('0x2')]!==_0x3ca6d3){_0x3dc4a0[_0x3cf1('0x2')]=_0x3ca6d3;emit(util['format'](_0x3cf1('0x6f'),_0x1fc7e7[_0x3cf1('0x3e')]),_0x3cf1('0x70'),_0x1fc7e7);}}}function emitCampaignSummary(_0x2517d6){if(_0x2517d6[_0x3cf1('0x46')]===_0x3cf1('0x71')){emit(util[_0x3cf1('0x72')](_0x3cf1('0x73'),_0x2517d6[_0x3cf1('0x3e')]),_0x3cf1('0x74'),_0x2517d6);}}function checkGetDataPredictive(_0x13a7c2){if(isNotNull(_0x13a7c2)){if(!_[_0x3cf1('0x75')](_0x13a7c2)){if(_0x13a7c2[_0x3cf1('0x69')]>0x0){if(!_[_0x3cf1('0x3a')](_0x13a7c2[_0x3cf1('0x64')])&&_0x13a7c2[_0x3cf1('0x64')]>0x0){return!![];}else{loggerPredictive[_0x3cf1('0x76')](_0x3cf1('0x77'),JSON[_0x3cf1('0x6e')](_0x13a7c2));}if(!_[_0x3cf1('0x3a')](_0x13a7c2[_0x3cf1('0x78')])&&_0x13a7c2[_0x3cf1('0x78')]>0x0){return!![];}else{loggerPredictive[_0x3cf1('0x76')](_0x3cf1('0x79'),JSON['stringify'](_0x13a7c2));}}else{loggerPredictive[_0x3cf1('0x76')](_0x3cf1('0x7a'),JSON[_0x3cf1('0x6e')](_0x13a7c2));}}else{loggerPredictive[_0x3cf1('0x76')]('[checkGetDataPredictive][objIsEmpty]',JSON['stringify'](_0x13a7c2));}}else{loggerPredictive['info'](_0x3cf1('0x7b'),JSON['stringify'](_0x13a7c2));}return![];}function mergeDataErlangB(_0x22342b){return function(_0xd45aa0){loggerPredictive[_0x3cf1('0x76')]('[ErlangB]',JSON['stringify'](_0xd45aa0));_[_0x3cf1('0x7c')](_0x22342b,_0xd45aa0);};}function getDiff(_0x2fa3cb){var _0x30aa22=moment()[_0x3cf1('0x42')](0x0);var _0xbe6787=moment(_0x2fa3cb)[_0x3cf1('0x42')](0x0);return _0x30aa22[_0x3cf1('0x43')](_0xbe6787,'seconds');}function ifInterval(_0x1be747,_0x5332e0){if(_['isUndefined'](_0x5332e0)){return![];}if(getDiff(_0x5332e0)<_0x1be747*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x1f4516){if(isNotNull(_0x1f4516)){if(!_[_0x3cf1('0x3a')](_0x1f4516[_0x3cf1('0x26')])){_0x1f4516[_0x3cf1('0x26')]=undefined;loggerPredictive['info'](_0x3cf1('0x7d'),'startProgressive',_0x1f4516[_0x3cf1('0x3e')]);}if(!_[_0x3cf1('0x3a')](_0x1f4516['startPredictive'])){_0x1f4516[_0x3cf1('0x25')]=undefined;loggerPredictive[_0x3cf1('0x76')]('[freeVariablesPredictive]',_0x3cf1('0x25'),_0x1f4516[_0x3cf1('0x3e')]);}if(!_[_0x3cf1('0x3a')](_0x1f4516[_0x3cf1('0x7e')])){clearInterval(_0x1f4516[_0x3cf1('0x7e')]);_0x1f4516[_0x3cf1('0x7e')]=undefined;loggerPredictive[_0x3cf1('0x76')](_0x3cf1('0x7d'),_0x3cf1('0x7e'),_0x1f4516[_0x3cf1('0x3e')]);}}}function erlangb(_0x1379b8,_0x2353f8){if(_0x2353f8===0x0){return 0x0;}var _0x57c9d6=0x1;for(var _0x5834a5=0x1;_0x5834a5<=_0x2353f8;_0x5834a5+=0x1){_0x57c9d6=0x1+_0x57c9d6*_0x5834a5/_0x1379b8;}return 0x1/_0x57c9d6;}function isVoiceQueueOutbound(_0x9d4c6b){return _0x9d4c6b===_0x3cf1('0x47');}function isNotPreview(_0x44faf6){return _0x44faf6!=='preview';}function isCampaignIvr(_0x529bf9){return _0x529bf9===_0x3cf1('0x71');}function getCallerId(_0x544492,_0x4c2a6a,_0x11642c){if(!_['isUndefined'](_0x11642c)&&_0x3cf1('0x7f')===typeof _0x11642c&&!_[_0x3cf1('0x75')](_0x11642c)){if(!_[_0x3cf1('0x3a')](_0x4c2a6a)&&_0x3cf1('0x7f')===typeof _0x4c2a6a&&!_[_0x3cf1('0x75')](_0x4c2a6a)){return util['format']('\x22%s\x22\x20<%s>',_0x4c2a6a,_0x11642c);}return util['format'](_0x3cf1('0x80'),_0x11642c,_0x11642c);}if(!_[_0x3cf1('0x3a')](_0x544492)&&_0x3cf1('0x7f')===typeof _0x544492&&!_[_0x3cf1('0x75')](_0x544492)){return _0x544492;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x4c8568,_0x38ead5){return function(_0xd4f4be){freeVariablesPredictive(_0x38ead5);emitVoiceQueueSummary(_0x38ead5);emitCampaignSummary(_0x38ead5);loggerSyncQueueSummary[_0x3cf1('0x81')](_0x4c8568,util[_0x3cf1('0x82')](_0xd4f4be,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x328dcf,_0x2b9fd){return function(_0x33d1f8){loggerPredictive[_0x3cf1('0x81')](_0x328dcf,JSON['stringify'](_0x33d1f8));freeVariablesPredictive(_0x2b9fd);};}function loggerCatch(_0x4ac677){return function(_0x152cdd){logger[_0x3cf1('0x81')](_0x4ac677,util['inspect'](_0x152cdd,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2f3deb){return _0x2f3deb&&!_['isUndefined'](_0x2f3deb)&&_0x2f3deb[_0x3cf1('0x83')]>0x0;}function decremetOriginate(_0x46fe50){if(!_['isUndefined'](_0x46fe50)&&_0x46fe50!==null){if(_0x46fe50[_0x3cf1('0x84')](_0x3cf1('0x6a'))){if(_0x46fe50[_0x3cf1('0x6a')]>0x0){_0x46fe50[_0x3cf1('0x6a')]-=0x1;}else{logger['error'](_0x3cf1('0x85'));}}}else{logger['error'](_0x3cf1('0x86'));}}function checkContactLowerLimitOriginate(_0x5041ea,_0x229905,_0x57bf3b){if(_0x229905>_0x57bf3b){for(var _0x3efdfe=0x0;_0x3efdfe<_0x229905-_0x57bf3b;_0x3efdfe+=0x1){decremetOriginate(_0x5041ea);}}}function loggerGetContactDialer(_0x247d76,_0x39a0fa,_0x3cd44b){return function(_0xe753ac){checkContactLowerLimitOriginate(_0x39a0fa,_0x3cd44b,0x0);logger[_0x3cf1('0x81')](_0x247d76,util[_0x3cf1('0x82')](_0xe753ac,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x41dd50){return function(_0x32d63f){if(isNotNull(_0x32d63f)&&isNotNull(_0x32d63f[0x0])){if(_0x32d63f[0x0][_0x3cf1('0x87')]>0x0){_0x41dd50['message']='RESCHEDULED_CONTACTS';logger[_0x3cf1('0x76')]('[getContactDialer2][ReScheduled]'+_0x41dd50[_0x3cf1('0x3e')],_0x32d63f[0x0][_0x3cf1('0x87')],_0x3cf1('0x88'));}else{_0x41dd50[_0x3cf1('0x3b')]=_0x3cf1('0x89');logger[_0x3cf1('0x76')]('[getContactDialer2][Empty]'+_0x41dd50[_0x3cf1('0x3e')]);}}};}function notSendMessagesQueue(_0x36e7e9){if(_0x36e7e9['sendMessageOneNotActive']){freeVariablesPredictive(_0x36e7e9);if(_0x36e7e9['originated']===0x0&&_0x36e7e9[_0x3cf1('0x50')]===0x0&&_0x36e7e9['waiting']===0x0&&(_0x36e7e9['pTalking']||0x0)===0x0){_0x36e7e9['sendMessageOneNotActive']=![];_0x36e7e9[_0x3cf1('0x4a')]=0x0;_0x36e7e9[_0x3cf1('0x3b')]=_0x3cf1('0x3d');loggerSyncQueueSummary[_0x3cf1('0x81')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x36e7e9['name'],_0x3cf1('0x8a'));}else{_0x36e7e9[_0x3cf1('0x3b')]=_0x3cf1('0x8b');loggerSyncQueueSummary[_0x3cf1('0x81')](_0x3cf1('0x8c'),_0x36e7e9[_0x3cf1('0x3e')],_0x3cf1('0x8d'));}emitVoiceQueueSummary(_0x36e7e9);}}function notSendMessagesCampaign(_0x267f21){if(_0x267f21[_0x3cf1('0x8e')]){if(_0x267f21[_0x3cf1('0x6a')]===0x0){_0x267f21[_0x3cf1('0x8e')]=![];_0x267f21[_0x3cf1('0x3b')]=_0x3cf1('0x3d');loggerSyncQueueSummary[_0x3cf1('0x81')](_0x3cf1('0x8f'),_0x267f21[_0x3cf1('0x3e')],_0x3cf1('0x8a'));}else{_0x267f21['message']=_0x3cf1('0x8b');loggerSyncQueueSummary[_0x3cf1('0x81')](_0x3cf1('0x8f'),_0x267f21[_0x3cf1('0x3e')],_0x3cf1('0x8d'));}emitCampaignSummary(_0x267f21);}}function createObjHistory(_0x59707c,_0x8a11a3,_0x2f55ac,_0x3bec63,_0x273013){_0x59707c[_0x3cf1('0x3b')]=_0x2f55ac;var _0x44529e=new Action(_0x59707c,_0x8a11a3);var _0x1afba0=new History(_0x44529e);_0x1afba0[_0x3cf1('0x90')]=_0x3bec63;_0x1afba0[_0x3cf1('0x91')]=_0x273013;_0x1afba0[_0x3cf1('0x92')]=_0x44529e[_0x3cf1('0x93')];return _0x1afba0;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0x51c603=this;setInterval(function(){_0x51c603[_0x3cf1('0x94')](_0x51c603[_0x3cf1('0x23')],_0x3cf1('0x95'));_0x51c603['clearZombieChannels'](_0x51c603[_0x3cf1('0x22')],'[actions]');},0x32c8);};Dialer[_0x3cf1('0x18')][_0x3cf1('0x94')]=function(_0x2d7680,_0x576277){var _0x5e5966=this;for(var _0x35510a in _0x2d7680){if(_0x2d7680[_0x3cf1('0x84')](_0x35510a)){this[_0x3cf1('0x96')]['enqueue'](function(){if(!_[_0x3cf1('0x97')](_0x2d7680[_0x35510a])){return ami[_0x3cf1('0x98')]({'action':_0x3cf1('0x99'),'channel':_0x2d7680[_0x35510a][_0x3cf1('0x9a')]})[_0x3cf1('0x9b')](function(_0x5c4895){if(_0x5c4895[_0x3cf1('0x3b')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x2d7680[_0x35510a]&&_0x2d7680[_0x35510a][_0x3cf1('0x46')]!=='ivr'){_0x5e5966[_0x3cf1('0x9c')](_0x5e5966[_0x3cf1('0x1c')][_0x2d7680[_0x35510a][_0x3cf1('0x9d')]]);logger[_0x3cf1('0x81')]('[Dialer][checkChannel]',_0x576277,_0x35510a,_0x2d7680[_0x35510a][_0x3cf1('0x9d')]);delete _0x2d7680[_0x35510a];}if(_0x2d7680[_0x35510a]&&_0x2d7680[_0x35510a]['type']===_0x3cf1('0x71')){_0x5e5966['updateOriginated'](_0x5e5966[_0x3cf1('0x1d')][_0x2d7680[_0x35510a][_0x3cf1('0x9d')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x576277,_0x35510a,_0x2d7680[_0x35510a][_0x3cf1('0x9d')]);delete _0x2d7680[_0x35510a];}},0x2328);}});}});}}};Dialer[_0x3cf1('0x18')][_0x3cf1('0x9e')]=function(_0xc5d5ce){return BPromise[_0x3cf1('0x9f')]()[_0x3cf1('0xa0')](cmHopper[_0x3cf1('0x9e')](_0xc5d5ce))[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xa1')));};Dialer[_0x3cf1('0x18')][_0x3cf1('0xa2')]=function(_0x3be0f1){return BPromise[_0x3cf1('0x9f')]()['then'](cmHopperBlack[_0x3cf1('0xa2')](_0x3be0f1))[_0x3cf1('0x9b')](loggerCatch('[checkIsBlackList]\x20'));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x5aacf2){return BPromise[_0x3cf1('0x9f')]()[_0x3cf1('0xa0')](cmHopperBlack[_0x3cf1('0xa3')](_0x5aacf2))[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xa4')));};Dialer[_0x3cf1('0x18')]['averageHandleTime']=function(_0x58023b){return BPromise[_0x3cf1('0x9f')]()['then'](cmHopperHistory[_0x3cf1('0xa5')](_0x58023b))['catch'](loggerCatch(_0x3cf1('0xa6')));};Dialer[_0x3cf1('0x18')][_0x3cf1('0xa7')]=function(_0x2ff80d){return BPromise[_0x3cf1('0x9f')]()[_0x3cf1('0xa0')](cmHopper['rescheduleContact'](_0x2ff80d))[_0x3cf1('0x9b')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x3cf1('0x18')][_0x3cf1('0xa8')]=function(_0x58be46,_0x3cd2db,_0x2561d2,_0x4191ce){return BPromise[_0x3cf1('0x9f')]()[_0x3cf1('0xa0')](cmHopper[_0x3cf1('0xa8')](_0x58be46,_0x3cd2db,_0x2561d2,_0x4191ce))['catch'](loggerCatch(_0x3cf1('0xa9')));};Dialer[_0x3cf1('0x18')][_0x3cf1('0xaa')]=function(_0x46270a,_0x5c0cfb,_0xa65160){return BPromise[_0x3cf1('0x9f')]()['then'](cmHopper[_0x3cf1('0xaa')](_0x46270a,_0x5c0cfb,_0xa65160))[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xa9')));};Dialer[_0x3cf1('0x18')][_0x3cf1('0xab')]=function(_0x4aecbd){return BPromise[_0x3cf1('0x9f')]()[_0x3cf1('0xa0')](voiceQueueRt[_0x3cf1('0xab')](_0x4aecbd))[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xac')));};Dialer[_0x3cf1('0x18')][_0x3cf1('0xad')]=function(_0x2308c2){return BPromise['resolve']()[_0x3cf1('0xa0')](cmHopper[_0x3cf1('0xad')](_0x2308c2))[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xae')));};Dialer['prototype'][_0x3cf1('0xaf')]=function(_0x56cd55){return BPromise[_0x3cf1('0x9f')]()[_0x3cf1('0xa0')](cmHopperHistory[_0x3cf1('0xaf')](_0x56cd55))['catch'](loggerCatch(_0x3cf1('0xb0')));};Dialer[_0x3cf1('0x18')][_0x3cf1('0x9c')]=function(_0x36482e){if(!_['isUndefined'](_0x36482e)&&_0x36482e!==null){if(_0x36482e[_0x3cf1('0x84')]('originated')){if(_0x36482e[_0x3cf1('0x6a')]>0x0){_0x36482e[_0x3cf1('0x6a')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x3cf1('0x81')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x3cf1('0x18')]['loggerHandler']=function(_0x43d461,_0x305402){var _0x54c729=this;return function(_0x5e67d9){_0x54c729['updateOriginated'](_0x305402);logger['error'](_0x43d461,util[_0x3cf1('0x82')](_0x5e67d9,{'showHidden':![],'depth':null}));};};Dialer[_0x3cf1('0x18')][_0x3cf1('0xb1')]=function(_0x534980,_0x4ab440,_0x16562d){var _0x1d0023={'state':0x19,'statedesc':_0x3cf1('0xb2')};this[_0x3cf1('0x9c')](_0x4ab440);this[_0x3cf1('0xb3')](_[_0x3cf1('0x7c')](_0x1d0023,_[_0x3cf1('0xb4')](_0x16562d,[_0x3cf1('0xb5'),_0x3cf1('0xb6'),_0x3cf1('0xb7'),_0x3cf1('0xb8'),'CampaignId'])),_0x3cf1('0xb9'),_0x3cf1('0xba'));logger[_0x3cf1('0x81')](_0x534980);};Dialer[_0x3cf1('0x18')]['isSuccess']=function(_0x3ed853){return _0x3ed853===_0x3cf1('0xbb');};Dialer[_0x3cf1('0x18')]['isTrunkReachable']=function(_0x22b7cb){return!_[_0x3cf1('0x3a')](_0x22b7cb)&&_0x22b7cb&&!_['isUndefined'](_0x22b7cb[_0x3cf1('0x3e')])&&!_['isUndefined'](_0x22b7cb['active'])&&_0x22b7cb[_0x3cf1('0x6c')]&&(this[_0x3cf1('0x1f')][util['format'](_0x3cf1('0xbc'),_0x22b7cb[_0x3cf1('0x3e')])][_0x3cf1('0x99')]===_0x3cf1('0xbd')||this[_0x3cf1('0x1f')][util[_0x3cf1('0x72')]('SIP/%s',_0x22b7cb[_0x3cf1('0x3e')])][_0x3cf1('0x99')]===_0x3cf1('0xbe'));};Dialer[_0x3cf1('0x18')][_0x3cf1('0xb3')]=function(_0x4a3cb8,_0x2af135,_0x33fdc7){this[_0x3cf1('0xaf')](_0x4a3cb8)[_0x3cf1('0x9b')](loggerCatch(_0x2af135));this[_0x3cf1('0xad')](_0x4a3cb8)[_0x3cf1('0x9b')](loggerCatch(_0x33fdc7));};Dialer[_0x3cf1('0x18')][_0x3cf1('0x35')]=function(_0x538533){var _0xb57e36=this[_0x3cf1('0x23')][_0x538533[_0x3cf1('0xbf')]];var _0x160fa8;if(!_[_0x3cf1('0x97')](_0x538533)&&!_[_0x3cf1('0x97')](_0x538533[_0x3cf1('0xc0')])&&!_[_0x3cf1('0x97')](_0x538533[_0x3cf1('0xc0')][_0x3cf1('0xc1')])&&_0x538533[_0x3cf1('0xc2')]===_0x3cf1('0xc3')&&_0xb57e36){if(_0xb57e36['type']!==_0x3cf1('0x71')&&this['voiceQueues'][_0xb57e36[_0x3cf1('0x9d')]][_0x3cf1('0xc4')]&&_0x538533[_0x3cf1('0xc5')]===_0x3cf1('0xc6')){delete this['uniqueId'][_0x538533[_0x3cf1('0xbf')]];this[_0x3cf1('0x9c')](this[_0x3cf1('0x1c')][_0xb57e36[_0x3cf1('0x9d')]]);this[_0x3cf1('0x1c')][_0xb57e36[_0x3cf1('0x9d')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0xb57e36[_0x3cf1('0x9d')]]['outboundAnswerAgiCallsDay']+=0x1;_0x160fa8=new Hangup(_0xb57e36,_0x538533);_0x160fa8['state']=0x12;_0x160fa8[_0x3cf1('0x91')]=_0x3cf1('0xc7');_0x160fa8[_0x3cf1('0xc8')]='AMD';this[_0x3cf1('0xb3')](_0x160fa8,'[syncHangupInAMD][createHistory]',_0x3cf1('0xc9'));}if(_0xb57e36[_0x3cf1('0x46')]!=='ivr'&&this['voiceQueues'][_0xb57e36[_0x3cf1('0x9d')]][_0x3cf1('0xc4')]&&_0x538533[_0x3cf1('0xc5')]===_0x3cf1('0xca')){delete this[_0x3cf1('0x23')][_0x538533[_0x3cf1('0xbf')]];this['updateOriginated'](this['voiceQueues'][_0xb57e36['queue']]);this['voiceQueues'][_0xb57e36[_0x3cf1('0x9d')]][_0x3cf1('0x5a')]+=0x1;this[_0x3cf1('0x1c')][_0xb57e36[_0x3cf1('0x9d')]][_0x3cf1('0x59')]+=0x1;_0x160fa8=new Hangup(_0xb57e36,_0x538533);_0x160fa8['state']=0x13;_0x160fa8['statedesc']=_0x3cf1('0xcb');_0x160fa8[_0x3cf1('0xc8')]=_0x3cf1('0xcc');_0x160fa8[_0x3cf1('0xcd')]=!![];this[_0x3cf1('0xb3')](_0x160fa8,_0x3cf1('0xce'),_0x3cf1('0xcf'));}if(_0xb57e36[_0x3cf1('0x46')]===_0x3cf1('0x71')&&this[_0x3cf1('0x1d')][_0xb57e36['queue']]['dialAMDActive']&&_0x538533['value']==='HANGUP'){delete this[_0x3cf1('0x23')][_0x538533['uniqueid']];this[_0x3cf1('0x9c')](this[_0x3cf1('0x1d')][_0xb57e36['queue']]);_0x160fa8=new Hangup(_0xb57e36,_0x538533);_0x160fa8[_0x3cf1('0x90')]=0x12;_0x160fa8[_0x3cf1('0x91')]=_0x3cf1('0xc7');_0x160fa8[_0x3cf1('0xc8')]=_0x3cf1('0xcc');this['saveInDb'](_0x160fa8,_0x3cf1('0xd0'),_0x3cf1('0xd1'));}if(_0xb57e36[_0x3cf1('0x46')]==='ivr'&&this[_0x3cf1('0x1d')][_0xb57e36[_0x3cf1('0x9d')]][_0x3cf1('0xc4')]&&_0x538533['value']===_0x3cf1('0xca')){delete this[_0x3cf1('0x23')][_0x538533[_0x3cf1('0xbf')]];this[_0x3cf1('0x9c')](this[_0x3cf1('0x1d')][_0xb57e36['queue']]);_0x160fa8=new Hangup(_0xb57e36,_0x538533);_0x160fa8['state']=0x13;_0x160fa8[_0x3cf1('0x91')]=_0x3cf1('0xcb');_0x160fa8[_0x3cf1('0xc8')]=_0x3cf1('0xcc');_0x160fa8[_0x3cf1('0xcd')]=!![];this['saveInDb'](_0x160fa8,'[syncMachineIvr][createHistory]',_0x3cf1('0xd2'));}}};Dialer[_0x3cf1('0x18')][_0x3cf1('0x31')]=function(_0x485984){var _0x4e03b6=this['uniqueId'][_0x485984[_0x3cf1('0xbf')]];var _0x38db97=this;var _0x3f3730;if(_0x4e03b6&&_0x4e03b6['type']===_0x3cf1('0x71')){delete this['uniqueId'][_0x485984[_0x3cf1('0xbf')]];this[_0x3cf1('0x9c')](this[_0x3cf1('0x1d')][_0x4e03b6[_0x3cf1('0x9d')]]);this[_0x3cf1('0x1d')][_0x4e03b6[_0x3cf1('0x9d')]][_0x3cf1('0xd3')]+=0x1;_0x3f3730=new Hangup(_0x4e03b6,_0x485984);this['createHistory'](_0x3f3730)[_0x3cf1('0x9b')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x3cf1('0xad')](_0x3f3730)[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xd4')));}if(_0x4e03b6&&_0x4e03b6[_0x3cf1('0x46')]!==_0x3cf1('0x71')&&isNotNull(this['voiceQueues'][_0x4e03b6[_0x3cf1('0x9d')]][_0x3cf1('0xd5')])){delete this[_0x3cf1('0x23')][_0x485984['uniqueid']];this[_0x3cf1('0x9c')](this[_0x3cf1('0x1c')][_0x4e03b6[_0x3cf1('0x9d')]]);this['voiceQueues'][_0x4e03b6[_0x3cf1('0x9d')]][_0x3cf1('0x5a')]+=0x1;this[_0x3cf1('0x1c')][_0x4e03b6['queue']][_0x3cf1('0x59')]+=0x1;_0x3f3730=new Hangup(_0x4e03b6,_0x485984);_0x3f3730[_0x3cf1('0x90')]=0x10;_0x3f3730[_0x3cf1('0x91')]='AnswerAGI';_0x3f3730[_0x3cf1('0xc8')]=_0x3cf1('0xd6');this[_0x3cf1('0xaf')](_0x3f3730)[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xd7')));this[_0x3cf1('0xad')](_0x3f3730)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x4e03b6&&_0x4e03b6[_0x3cf1('0x46')]!=='ivr'&&!isNotNull(this[_0x3cf1('0x1c')][_0x4e03b6[_0x3cf1('0x9d')]]['dialQueueProject'])){delete this[_0x3cf1('0x23')][_0x485984[_0x3cf1('0xbf')]];this[_0x3cf1('0x9c')](this[_0x3cf1('0x1c')][_0x4e03b6[_0x3cf1('0x9d')]]);this[_0x3cf1('0x1c')][_0x4e03b6[_0x3cf1('0x9d')]]['outboundUnknownCallsDay']+=0x1;_0x3f3730=new Hangup(_0x4e03b6,_0x485984);_0x3f3730[_0x3cf1('0x90')]=0xc;_0x3f3730[_0x3cf1('0x91')]=_0x485984['cause-txt'];_0x3f3730['membername']='Unknow';this[_0x3cf1('0xaf')](_0x3f3730)[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xd7')));this[_0x3cf1('0xad')](_0x3f3730)[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xd4')));}};Dialer[_0x3cf1('0x18')][_0x3cf1('0x2e')]=function(_0x53d2e6){var _0x12059e=this[_0x3cf1('0x23')][_0x53d2e6[_0x3cf1('0xbf')]];var _0x5d3f01=this;if(this[_0x3cf1('0x1c')][_0x53d2e6[_0x3cf1('0x9d')]]){if(_0x12059e&&_0x12059e[_0x3cf1('0x46')]!==_0x3cf1('0x71')){delete this[_0x3cf1('0x23')][_0x53d2e6[_0x3cf1('0xbf')]];this[_0x3cf1('0x1c')][_0x53d2e6['queue']]['outboundAnswerCallsDay']+=0x1;var _0x3007b7=new AgentComplete(_0x12059e,_0x53d2e6);if(_0x53d2e6[_0x3cf1('0xd8')]===_0x3cf1('0xd9')){_0x3007b7[_0x3cf1('0xda')]=this[_0x3cf1('0x1c')][_0x53d2e6['queue']][_0x3cf1('0xdb')]&&this['voiceQueues'][_0x53d2e6[_0x3cf1('0x9d')]][_0x3cf1('0xdc')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x3cf1('0xaf')](_0x3007b7)[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xdd')));this[_0x3cf1('0xad')](_0x3007b7)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype'][_0x3cf1('0x29')]=function(_0x1db888){if(this[_0x3cf1('0x1c')][_0x1db888['queue']]){if(this[_0x3cf1('0x23')][_0x1db888[_0x3cf1('0xbf')]]&&this['uniqueId'][_0x1db888[_0x3cf1('0xbf')]][_0x3cf1('0x46')]!=='ivr'){this[_0x3cf1('0x9c')](this[_0x3cf1('0x1c')][_0x1db888[_0x3cf1('0x9d')]]);this[_0x3cf1('0x23')][_0x1db888['uniqueid']][_0x3cf1('0xde')]=moment()[_0x3cf1('0x72')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x3cf1('0x18')][_0x3cf1('0xdf')]=function(_0x49e651){this['createHistory'](_0x49e651)[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xdd')));this[_0x3cf1('0xad')](_0x49e651)[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xe0')));};Dialer[_0x3cf1('0x18')][_0x3cf1('0xe1')]=function(_0x40c11e){var _0x54ae9e=this[_0x3cf1('0x23')][_0x40c11e[_0x3cf1('0xbf')]];var _0x5123de=this;if(this[_0x3cf1('0x1c')][_0x40c11e['queue']]){if(_0x54ae9e&&_0x54ae9e[_0x3cf1('0x46')]!==_0x3cf1('0x71')){delete this[_0x3cf1('0x23')][_0x40c11e[_0x3cf1('0xbf')]];this[_0x3cf1('0x9c')](this['voiceQueues'][_0x40c11e[_0x3cf1('0x9d')]]);_0x54ae9e[_0x3cf1('0xe2')]=moment()[_0x3cf1('0x72')](_0x3cf1('0xe3'));var _0x16cd96=new QueueCallerAbandon(_0x54ae9e,_0x40c11e);if(getSeconds(_0x54ae9e[_0x3cf1('0xe2')],_0x54ae9e[_0x3cf1('0xe4')])>=_0x54ae9e['dialQueueTimeout']){this[_0x3cf1('0x1c')][_0x40c11e[_0x3cf1('0x9d')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x40c11e[_0x3cf1('0x9d')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x3cf1('0x1c')][_0x40c11e[_0x3cf1('0x9d')]][_0x3cf1('0xe5')]+=0x1;_0x16cd96[_0x3cf1('0x90')]=0xa;_0x16cd96[_0x3cf1('0x91')]=_0x3cf1('0xe6');_0x16cd96[_0x3cf1('0xe7')]=_0x3cf1('0xe8');_0x16cd96[_0x3cf1('0xda')]=this['voiceQueues'][_0x40c11e[_0x3cf1('0x9d')]][_0x3cf1('0xdb')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;this[_0x3cf1('0xdf')](_0x16cd96);}else{this[_0x3cf1('0x1c')][_0x40c11e[_0x3cf1('0x9d')]][_0x3cf1('0x65')]+=0x1;this[_0x3cf1('0x1c')][_0x40c11e['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x16cd96[_0x3cf1('0x90')]=0xb;_0x16cd96['statedesc']=_0x3cf1('0xe9');_0x16cd96[_0x3cf1('0xe7')]=_0x3cf1('0xea');this[_0x3cf1('0xdf')](_0x16cd96);}}}};Dialer['prototype'][_0x3cf1('0x33')]=function(_0x2ffd95){if(this[_0x3cf1('0x22')][_0x2ffd95[_0x3cf1('0xbf')]]){this[_0x3cf1('0x22')][_0x2ffd95['uniqueid']][_0x3cf1('0x9a')]=_0x2ffd95[_0x3cf1('0x9a')];}if(this[_0x3cf1('0x23')][_0x2ffd95['uniqueid']]){this[_0x3cf1('0x23')][_0x2ffd95[_0x3cf1('0xbf')]][_0x3cf1('0x9a')]=_0x2ffd95[_0x3cf1('0x9a')];}};Dialer[_0x3cf1('0x18')]['syncQueueMember']=function(_0x3ab567){if(strategy[this[_0x3cf1('0x1c')][this[_0x3cf1('0x22')][_0x3ab567[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]][_0x3cf1('0x48')]]===_0x3cf1('0xec')){if(this[_0x3cf1('0x22')][_0x3ab567['actionid']]&&_[_0x3cf1('0x97')](this[_0x3cf1('0x22')][_0x3ab567['actionid']][_0x3cf1('0xed')])&&_0x3ab567[_0x3cf1('0x99')]==='1'&&_0x3ab567[_0x3cf1('0xee')]==='0'){if(this[_0x3cf1('0x1e')][_0x3ab567[_0x3cf1('0xef')]]){if(!this['agents'][_0x3ab567[_0x3cf1('0xef')]][_0x3cf1('0xed')]){this['agents'][_0x3ab567[_0x3cf1('0xef')]][_0x3cf1('0xed')]=!![];this[_0x3cf1('0x22')][_0x3ab567[_0x3cf1('0xeb')]][_0x3cf1('0xed')]=!![];this[_0x3cf1('0x22')][_0x3ab567[_0x3cf1('0xeb')]][_0x3cf1('0xef')]=_0x3ab567['stateinterface'];}}}}else if((strategy[this[_0x3cf1('0x1c')][this[_0x3cf1('0x22')][_0x3ab567[_0x3cf1('0xeb')]]['queue']][_0x3cf1('0x48')]]||_0x3cf1('0x17'))===_0x3cf1('0x17')){if(this['actions'][_0x3ab567[_0x3cf1('0xeb')]]){if(this[_0x3cf1('0x1e')][_0x3ab567[_0x3cf1('0xef')]]){this[_0x3cf1('0x22')][_0x3ab567[_0x3cf1('0xeb')]][_0x3cf1('0xef')]=_0x3ab567['stateinterface'];if(_['isNil'](this[_0x3cf1('0x28')][this[_0x3cf1('0x22')][_0x3ab567['actionid']][_0x3cf1('0x9d')]])){this[_0x3cf1('0x28')][this[_0x3cf1('0x22')][_0x3ab567[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]]=[];}this[_0x3cf1('0x28')][this[_0x3cf1('0x22')][_0x3ab567[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]][_0x3cf1('0xf0')](_['merge'](_['pick'](this[_0x3cf1('0x22')][_0x3ab567[_0x3cf1('0xeb')]],['idHopper',_0x3cf1('0xef')]),{'status':_0x3ab567['status'],'paused':_0x3ab567[_0x3cf1('0xee')]}));}}}};function unlockQueueStatus(_0xf55e29,_0x1e0b3f){setTimeout(function(){if(_['isUndefined'](_0xf55e29['queueStatusComplete'])){loggerBooked[_0x3cf1('0x81')](_0x3cf1('0xf1'),_0x1e0b3f);}_0xf55e29['queueStatusComplete']=!![];loggerBooked[_0x3cf1('0x76')](_0x3cf1('0xf2'),_0x1e0b3f,JSON[_0x3cf1('0x6e')](_[_0x3cf1('0xb4')](_0xf55e29,[_0x3cf1('0x3e'),_0x3cf1('0xf3')])));},0x1f3);}Dialer[_0x3cf1('0x18')]['syncQueueStatusComplete']=function(_0xd3b964){var _0x3138f2=this;var _0x40ed93=_0x3138f2[_0x3cf1('0x1c')][_0x3138f2[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]];if(strategy[this[_0x3cf1('0x1c')][this[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]][_0x3cf1('0x48')]]===_0x3cf1('0xec')){if(this[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]]&&this['actions'][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0xef')]){this[_0x3cf1('0xf4')][_0x3cf1('0xf5')](this[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0xf6')],this['actions'][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0xef')])[_0x3cf1('0x9b')](function(_0x41e8da){logger[_0x3cf1('0x81')](_0x3cf1('0xf7'),util['inspect'](_0x41e8da,{'showHidden':![],'depth':null}));})[_0x3cf1('0x1b')](function(){_0x3138f2[_0x3cf1('0x9c')](_0x3138f2[_0x3cf1('0x1c')][_0x3138f2['actions'][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]]);_0x3138f2[_0x3cf1('0x1e')][_0x3138f2[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0xef')]][_0x3cf1('0xed')]=![];delete _0x3138f2[_0x3cf1('0x22')][_0xd3b964['actionid']];unlockQueueStatus(_0x40ed93);});}else{this[_0x3cf1('0x9c')](this['voiceQueues'][this[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]]);this[_0x3cf1('0xa7')]({'active':![],'ContactId':this['actions'][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0xb5')],'ListId':this[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0xb6')],'VoiceQueueId':this[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0xb8')]||undefined,'CampaignId':this[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0xf8')]||undefined})['catch'](loggerCatch(_0x3cf1('0xf9')));delete this[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]];unlockQueueStatus(_0x40ed93);}}else if((strategy[this[_0x3cf1('0x1c')][this[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]]['strategy']]||_0x3cf1('0x17'))===_0x3cf1('0x17')){var _0x13462c;if(this['actions'][_0xd3b964['actionid']]&&!_[_0x3cf1('0x75')](this[_0x3cf1('0x28')][this['actions'][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]])){if(this[_0x3cf1('0xfa')][_0x3138f2[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]]){this[_0x3cf1('0xfa')][_0x3138f2['actions'][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]]=this[_0x3cf1('0xfa')][this[_0x3cf1('0x22')][_0xd3b964['actionid']]['queue']]?this['queueBookedRR'][this[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]]:this[_0x3cf1('0x28')][this[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]]?this[_0x3cf1('0x28')][this[_0x3cf1('0x22')][_0xd3b964['actionid']][_0x3cf1('0x9d')]][_0x3cf1('0xfb')]||0x0:0x0;}this['queueBooked'][this[_0x3cf1('0x22')][_0xd3b964['actionid']]['queue']][_0x3cf1('0xfb')]=this['queueBookedRR'][this[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]];for(var _0xed250a=0x0;_0xed250a=0x0?!![]:![];})[_0x3cf1('0x9b')](myreject(_0x474979)));}}else{_0x234754[_0x3cf1('0xf0')](ami[_0x3cf1('0x98')]({'action':'command','command':util[_0x3cf1('0x72')](_0x3cf1('0x115'),_0x1c5530,!_[_0x3cf1('0x3a')](config[_0x3cf1('0x112')][_0x53f3d7])?_0x53f3d7:'')})[_0x3cf1('0xa0')](function(_0x52c942){return _0x52c942['content']['indexOf'](_0x3cf1('0x116'))>=0x0?!![]:![];})[_0x3cf1('0x9b')](myreject(_0x474979)));}BPromise[_0x3cf1('0x117')](_0x234754)[_0x3cf1('0xa0')](function(_0x5a06d1){var _0x1c6908=_[_0x3cf1('0x118')](_0x5a06d1);if(_0x1c6908){return _0x607b71(_0x1c6908);}else{_0xcd671b['message']=_0x578081?_0x3cf1('0x119'):'INTERVAL_IS_OVERTIME';return _0x474979(msgResponse(_0x3cf1('0x11a'),_0x3cf1('0x10c'),'Global:\x20'+_0x578081+'\x20'+_0x179e90+'\x20Interval\x20is\x20overtime:\x20'+util[_0x3cf1('0x82')](_0x1c5530,{'showHidden':![],'depth':null})+_0x3cf1('0x11b')+_0x53f3d7));}})[_0x3cf1('0x9b')](function(_0x48535e){return _0x474979(msgResponse(_0x3cf1('0x109'),_0x3cf1('0x10c'),JSON['stringify'](_0x48535e)));});});};Dialer[_0x3cf1('0x18')][_0x3cf1('0x11c')]=function(_0xa0befa){var _0x5d7e1e=this;return function(){switch(_0xa0befa['dialMethod']){case'progressive':freeVariablesPredictive(_0xa0befa);_0x5d7e1e[_0x3cf1('0x11d')](_0xa0befa,0x1);break;case'power':freeVariablesPredictive(_0xa0befa);_0x5d7e1e[_0x3cf1('0x11d')](_0xa0befa,_0xa0befa[_0x3cf1('0x11e')]);break;case _0x3cf1('0x5'):_0x5d7e1e[_0x3cf1('0x5')](_0xa0befa);break;case'booked':freeVariablesPredictive(_0xa0befa);_0x5d7e1e[_0x3cf1('0x11d')](_0xa0befa,0x1);break;default:freeVariablesPredictive(_0xa0befa);logger['error'](_0x3cf1('0x11f'),_0xa0befa[_0x3cf1('0x3e')],'method\x20not\x20recognized');}};};Dialer[_0x3cf1('0x18')][_0x3cf1('0x120')]=function(_0x7dfca3){var _0x313220=this;return function(){_0x313220[_0x3cf1('0x121')](_0x7dfca3);};};Dialer[_0x3cf1('0x18')][_0x3cf1('0x7')]=function(_0x44d387){var _0x3c2692=this;if(isNotPreview(_0x44d387[_0x3cf1('0x55')])){if(isVoiceQueueOutbound(_0x44d387[_0x3cf1('0x46')])&&isActive(_0x44d387[_0x3cf1('0x54')])){_0x44d387['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0x3cf1('0xa0')](checkIsLoggedIn(_0x44d387,_0x44d387['loggedIn']))[_0x3cf1('0xa0')](checkIsActive(_0x44d387,_0x44d387[_0x3cf1('0x54')]))[_0x3cf1('0xa0')](checkInterval(_0x44d387))[_0x3cf1('0xa0')](_0x3c2692['checkIsTrunkReachable'](_0x44d387))[_0x3cf1('0xa0')](_0x3c2692[_0x3cf1('0x108')](_0x44d387[_0x3cf1('0x122')],_0x44d387[_0x3cf1('0x123')],_0x44d387[_0x3cf1('0x3e')],_0x44d387))[_0x3cf1('0xa0')](_0x3c2692[_0x3cf1('0x10a')](_0x44d387['Interval'],_0x44d387[_0x3cf1('0x123')],_0x44d387['name'],_0x44d387))['then'](_0x3c2692[_0x3cf1('0x11c')](_0x44d387))['catch'](loggerCatchQueueSummary(_0x3cf1('0x124'),_0x44d387));}else{notSendMessagesQueue(_0x44d387);}}else{freeVariablesPredictive(_0x44d387);}};Dialer[_0x3cf1('0x18')][_0x3cf1('0x102')]=function(){var _0x1684f7=this;var _0x30484e;for(var _0x5a5d20 in this['campaigns']){if(this['campaigns'][_0x3cf1('0x84')](_0x5a5d20)){_0x30484e=this[_0x3cf1('0x1d')][_0x5a5d20];if(isCampaignIvr(_0x30484e[_0x3cf1('0x46')])&&isActive(_0x30484e[_0x3cf1('0x6c')])){_0x30484e['sendMessageOneNotActive']=!![];BPromise[_0x3cf1('0x9f')]()[_0x3cf1('0xa0')](checkIsActive(_0x30484e,_0x30484e[_0x3cf1('0x6c')]))[_0x3cf1('0xa0')](checkInterval(_0x30484e))[_0x3cf1('0xa0')](_0x1684f7[_0x3cf1('0x103')](_0x30484e))['then'](_0x1684f7[_0x3cf1('0x108')](_0x30484e[_0x3cf1('0x122')],_0x30484e[_0x3cf1('0x123')],_0x30484e[_0x3cf1('0x3e')],_0x30484e))[_0x3cf1('0xa0')](_0x1684f7['checkIfTimeIntervals'](_0x30484e[_0x3cf1('0x3f')],_0x30484e[_0x3cf1('0x123')],_0x30484e['name'],_0x30484e))['then'](_0x1684f7[_0x3cf1('0x120')](_0x30484e))[_0x3cf1('0x9b')](loggerCatchQueueSummary(_0x3cf1('0x125'),_0x30484e));}else{notSendMessagesCampaign(_0x30484e);}}}};function getCallerIdRandom(_0x3283ce,_0x116603){var _0x41e8e8,_0x32fa50,_0xd6e339;if(_0x116603<=0x0){_0x116603=0x1;}_0x41e8e8=new RegExp(_0x3cf1('0x126')+_0x116603+'}$');_0x32fa50=Math[_0x3cf1('0x127')](0xa,_0x116603-0x1);_0xd6e339=Math[_0x3cf1('0x127')](0xa,_0x116603)-0x1;return util[_0x3cf1('0x72')]('%s',_['replace'](_0x3283ce,_0x41e8e8,_[_0x3cf1('0x128')](_0x32fa50,_0xd6e339)));}function extractCalleridName(_0x57b459){var _0x330cb2=_0x57b459[_0x3cf1('0x129')](/"(.*?)"/);return _0x330cb2?_0x330cb2[0x1]:_0x57b459;}function extractCalleridNumber(_0x4a8a7d){var _0x4b512e=_0x4a8a7d[_0x3cf1('0x129')](/<(.*?)>/);return _0x4b512e?_0x4b512e[0x1]:_0x4a8a7d;}Dialer[_0x3cf1('0x18')][_0x3cf1('0x12a')]=function(_0xe86dc3,_0x1e7d8a){var _0x5edf50=this;var _0x438f85=uuid['v4']();this['actions'][_0x438f85]=new Action(_0xe86dc3,_0x1e7d8a,_0x438f85);return new BPromise(function(_0x1f87ee,_0x4cc169){if(_[_0x3cf1('0x3a')](_0xe86dc3)&&_0x3cf1('0x12b')!==typeof _0xe86dc3){return _0x4cc169(msgResponse('originate','Failure',_0x3cf1('0x12c')));}if(_['isUndefined'](_0x1e7d8a[_0x3cf1('0x12d')]['phone'])||_0x1e7d8a[_0x3cf1('0x12d')][_0x3cf1('0x12e')]===null){return _0x4cc169(msgResponse(_0x3cf1('0x12f'),'Failure',_0x3cf1('0x130')));}var _0x183da5={'XMD-CALLERID':_0x5edf50['actions'][_0x438f85][_0x3cf1('0x131')](),'XMD-AGI':_0xe86dc3['dialQueueProject']?util['format'](_0x3cf1('0x132'),ipAgi,_0xe86dc3[_0x3cf1('0xd5')]):_0x3cf1('0x133'),'XMD-AGIAFTER':_0xe86dc3[_0x3cf1('0xdb')]?util['format'](_0x3cf1('0x132'),ipAgi,_0xe86dc3[_0x3cf1('0xdb')]):_0x3cf1('0x133'),'XMD-QUEUE':_0xe86dc3['type']===_0x3cf1('0x47')?util[_0x3cf1('0x72')](_0x3cf1('0x134'),_0xe86dc3[_0x3cf1('0x3e')],_0xe86dc3['dialQueueOptions']||'',_0xe86dc3[_0x3cf1('0xdc')]?'c':'',_0xe86dc3['dialQueueTimeout']||0x3):_0x3cf1('0x133'),'XMD-CONTACTID':_0x1e7d8a[_0x3cf1('0xb5')],'XMD-CDRTYPE':_0x3cf1('0x135'),'CALLERID(all)':_0x5edf50[_0x3cf1('0x22')][_0x438f85][_0x3cf1('0x131')](),'XMD-AMD':_0xe86dc3[_0x3cf1('0xc4')]?_0x3cf1('0x136'):_0x3cf1('0x133'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0xe86dc3[_0x3cf1('0xc4')]){_0x183da5[_0x3cf1('0x137')]=_0xe86dc3[_0x3cf1('0x138')]||0x9c4;_0x183da5['XMD-AMDGREETING']=_0xe86dc3[_0x3cf1('0x139')]||0x5dc;_0x183da5[_0x3cf1('0x13a')]=_0xe86dc3[_0x3cf1('0x13b')]||0x320;_0x183da5['XMD-AMDTOTALANALYSISTIME']=_0xe86dc3['dialAMDTotalAnalysisTime']||0x1388;_0x183da5[_0x3cf1('0x13c')]=_0xe86dc3['dialAMDMinWordLength']||0x64;_0x183da5[_0x3cf1('0x13d')]=_0xe86dc3[_0x3cf1('0x13e')]||0x32;_0x183da5['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0xe86dc3[_0x3cf1('0x13f')]||0x3;_0x183da5['XMD-AMDSILENCETHRESHOLD']=_0xe86dc3[_0x3cf1('0x140')]||0x100;_0x183da5[_0x3cf1('0x141')]=_0xe86dc3[_0x3cf1('0x142')]||0x1388;}if(_0xe86dc3[_0x3cf1('0x46')]===_0x3cf1('0x47')){_0x183da5[_0x3cf1('0x143')]=_0x1e7d8a[_0x3cf1('0xb8')];}else{_0x183da5['XMD-CAMPAIGNID']=_0x1e7d8a['CampaignId'];}for(var _0x25dea6 in _0x1e7d8a[_0x3cf1('0x12d')]){if(_0x1e7d8a[_0x3cf1('0x12d')]['hasOwnProperty'](_0x25dea6)){if(isNotNull(_0x1e7d8a[_0x3cf1('0x12d')][_0x25dea6])&&_0x25dea6!=='id'&&_0x25dea6!=='tags'&&_0x25dea6!==_0x3cf1('0x144')&&_0x25dea6!=='updatedAt'){_0x183da5[util['format'](_0x3cf1('0x145'),'XMD-',_['toUpper'](_0x25dea6))]=_0x1e7d8a[_0x3cf1('0x12d')][_0x25dea6];}}}var _0xf4812=_0x5edf50['isTrunkReachable'](_0xe86dc3[_0x3cf1('0x6b')])?getCallerId(_0xe86dc3[_0x3cf1('0x6b')][_0x3cf1('0x6d')],_0xe86dc3[_0x3cf1('0x146')],_0xe86dc3['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0xe86dc3[_0x3cf1('0x56')],_0xe86dc3[_0x3cf1('0x147')]):_0xe86dc3['dialOriginateCallerIdNumber']):getCallerId(_[_0x3cf1('0x97')](_0xe86dc3[_0x3cf1('0x105')])?_0xe86dc3[_0x3cf1('0x6b')][_0x3cf1('0x6d')]:_0xe86dc3['TrunkBackup'][_0x3cf1('0x6d')],_0xe86dc3[_0x3cf1('0x146')],_0xe86dc3[_0x3cf1('0x147')]>0x0?getCallerIdRandom(_0xe86dc3['dialOriginateCallerIdNumber'],_0xe86dc3[_0x3cf1('0x147')]):_0xe86dc3[_0x3cf1('0x56')]);if(_0xf4812){_0x183da5[_0x3cf1('0x148')]=_0x5edf50[_0x3cf1('0x22')][_0x438f85][_0x3cf1('0x149')]=extractCalleridName(_0xf4812);_0x183da5['XMD-ORIGINATECALLERIDNUM']=_0x5edf50['actions'][_0x438f85][_0x3cf1('0x14a')]=extractCalleridNumber(_0xf4812);}return ami['Action']({'actionid':_0x438f85,'action':_0x3cf1('0x12f'),'channel':_0x5edf50[_0x3cf1('0x104')](_0xe86dc3[_0x3cf1('0x6b')])?util[_0x3cf1('0x72')](_0x3cf1('0x14b'),_0xe86dc3['Trunk'][_0x3cf1('0x3e')],isNotNull(_0xe86dc3['dialPrefix'])?_0xe86dc3[_0x3cf1('0x58')][_0x3cf1('0x14c')]()||'':'',_0xe86dc3[_0x3cf1('0x14d')]>0x0?_0x1e7d8a[_0x3cf1('0x12d')][_0x3cf1('0x12e')][_0x3cf1('0x14e')](_0xe86dc3[_0x3cf1('0x14d')]):_0x1e7d8a[_0x3cf1('0x12d')][_0x3cf1('0x12e')]):util[_0x3cf1('0x72')]('SIP/%s/%s%s',_[_0x3cf1('0x97')](_0xe86dc3['TrunkBackup'])?_0xe86dc3['Trunk'][_0x3cf1('0x3e')]:_0xe86dc3[_0x3cf1('0x105')][_0x3cf1('0x3e')],isNotNull(_0xe86dc3[_0x3cf1('0x58')])?_0xe86dc3[_0x3cf1('0x58')][_0x3cf1('0x14c')]()||'':'',_0xe86dc3[_0x3cf1('0x14d')]>0x0?_0x1e7d8a['Contact'][_0x3cf1('0x12e')]['substring'](_0xe86dc3[_0x3cf1('0x14d')]):_0x1e7d8a['Contact']['phone']),'callerid':_0xf4812,'Exten':_0x3cf1('0xc3'),'Context':_0x3cf1('0x14f'),'Priority':'1','variable':_0x183da5,'timeout':(_0xe86dc3[_0x3cf1('0x57')]||0x1e)*0x3e8,'async':!![],'channelid':_0x438f85})['then'](function(_0x26726d){return _0x1f87ee(_0x26726d);})['catch'](function(_0x1b935a){_0xe86dc3['outboundOriginateFailureCallsDay']+=0x1;var _0x500a4a=new History(_0x5edf50[_0x3cf1('0x22')][_0x438f85]);logger['error'](util['format'](_0x3cf1('0x150'),JSON['stringify'](_0x1b935a)));_0x500a4a[_0x3cf1('0x90')]=0xe;_0x500a4a[_0x3cf1('0x91')]='OriginateError';_0x500a4a[_0x3cf1('0x93')]=moment()[_0x3cf1('0x72')](_0x3cf1('0xe3'));_0x500a4a['endtime']=_0x500a4a[_0x3cf1('0x93')];_0x5edf50[_0x3cf1('0xaf')](_0x500a4a)['catch'](loggerCatch('[originate][error]'));_0x5edf50['moveContactManagedDialer'](_0x500a4a)[_0x3cf1('0x9b')](loggerCatch('[originate][error]'))[_0x3cf1('0x1b')](function(){delete _0x5edf50[_0x3cf1('0x22')][_0x438f85];return _0x4cc169(msgResponse('originate','Error',_0x3cf1('0x151')));});});});};Dialer['prototype'][_0x3cf1('0x2b')]=function(_0x3b86ec){var _0x5e1119=this[_0x3cf1('0x22')][_0x3b86ec['actionid']];var _0x51bad1=this;if(_0x5e1119){delete this[_0x3cf1('0x22')][_0x3b86ec[_0x3cf1('0xeb')]];_0x5e1119['responsetime']=moment()[_0x3cf1('0x72')](_0x3cf1('0xe3'));var _0x585da1=_0x5e1119[_0x3cf1('0x46')]===_0x3cf1('0x71')?this[_0x3cf1('0x1d')][_0x5e1119[_0x3cf1('0x9d')]]:this[_0x3cf1('0x1c')][_0x5e1119[_0x3cf1('0x152')]()];if(!this[_0x3cf1('0x153')](_0x3b86ec[_0x3cf1('0x154')])){this['updateOriginated'](_0x585da1);return this['callProgressDetecting'](_0x5e1119,_0x585da1,_0x3b86ec)[_0x3cf1('0xa0')](function(_0x124a6f){})[_0x3cf1('0x9b')](loggerCatch('[callProgressDetecting]\x20'));}else{this[_0x3cf1('0x23')][_0x3b86ec[_0x3cf1('0xbf')]]=_0x5e1119;}}};Dialer[_0x3cf1('0x18')]['checkRetriveMax']=function(_0x164a47,_0xd8797f,_0x1f0ff4){var _0x550e2f=new History(_0xd8797f);if(_0x550e2f[_0x3cf1('0x155')]+_0x550e2f['countcongestionretry']+_0x550e2f[_0x3cf1('0x156')]>=_0x1f0ff4[_0x3cf1('0x157')]-0x1){return!![];}switch(_0x164a47){case 0x3:if(_0x550e2f[_0x3cf1('0x156')]>=_0x1f0ff4['dialNoAnswerMaxRetry']-0x1){return!![];}else{this[_0x3cf1('0xa7')]({'active':![],'countnoanswerretry':_0x550e2f[_0x3cf1('0x156')]+=0x1,'scheduledat':moment()[_0x3cf1('0x158')](_0x1f0ff4[_0x3cf1('0x159')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x550e2f[_0x3cf1('0xb5')],'ListId':_0x550e2f[_0x3cf1('0xb6')],'VoiceQueueId':_0x550e2f[_0x3cf1('0xb8')]||undefined,'CampaignId':_0x550e2f['CampaignId']||undefined})['catch'](loggerCatch(_0x3cf1('0x15a')));}break;case 0x5:if(_0x550e2f[_0x3cf1('0x155')]>=_0x1f0ff4[_0x3cf1('0x15b')]-0x1){return!![];}else{this[_0x3cf1('0xa7')]({'active':![],'countbusyretry':_0x550e2f[_0x3cf1('0x155')]+=0x1,'scheduledat':moment()[_0x3cf1('0x158')](_0x1f0ff4['dialBusyRetryFrequency'],_0x3cf1('0x15c'))[_0x3cf1('0x72')](_0x3cf1('0xe3')),'ContactId':_0x550e2f['ContactId'],'ListId':_0x550e2f[_0x3cf1('0xb6')],'VoiceQueueId':_0x550e2f[_0x3cf1('0xb8')]||undefined,'CampaignId':_0x550e2f['CampaignId']||undefined})['catch'](loggerCatch(_0x3cf1('0x15d')));}break;case 0x8:if(_0x550e2f['countcongestionretry']>=_0x1f0ff4[_0x3cf1('0x15e')]-0x1){return!![];}else{this[_0x3cf1('0xa7')]({'active':![],'countcongestionretry':_0x550e2f['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x1f0ff4[_0x3cf1('0x15f')],'minutes')[_0x3cf1('0x72')](_0x3cf1('0xe3')),'ContactId':_0x550e2f[_0x3cf1('0xb5')],'ListId':_0x550e2f[_0x3cf1('0xb6')],'VoiceQueueId':_0x550e2f[_0x3cf1('0xb8')]||undefined,'CampaignId':_0x550e2f[_0x3cf1('0xf8')]||undefined})[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0x160')));}break;default:return!![];}};Dialer[_0x3cf1('0x18')][_0x3cf1('0x161')]=function(_0x1d4d11,_0xdf896,_0x28f5cc){var _0x486aec=this;var _0x28cdb4=new History(_0x1d4d11);return new BPromise(function(_0x545538,_0x1c7d8b){if(_[_0x3cf1('0x3a')](_0xdf896)&&'object'!==typeof _0xdf896){return _0x1c7d8b(msgResponse(_0x3cf1('0x162'),'Failure','entity\x20is\x20undefine'));}if(_[_0x3cf1('0x3a')](_0x28f5cc)&&_0x3cf1('0x12b')!==typeof _0x28f5cc){return _0x1c7d8b(msgResponse('[callProgressDetecting]',_0x3cf1('0x10c'),_0x3cf1('0x163')));}switch(_0x28f5cc[_0x3cf1('0xd8')]){case'0':_0xdf896[_0x3cf1('0x164')]+=0x1;_0x28cdb4[_0x3cf1('0x90')]=0x0;_0x28cdb4[_0x3cf1('0x91')]='NoSuchNumber';_0x486aec['createHistory'](_0x28cdb4)[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0x165')));if(_0x486aec[_0x3cf1('0x166')](0x0,_0x1d4d11,_0xdf896)){if(_0x28cdb4['countbusyretry']+_0x28cdb4[_0x3cf1('0x167')]+_0x28cdb4[_0x3cf1('0x156')]>=_0xdf896[_0x3cf1('0x157')]){_0x486aec[_0x3cf1('0x168')](_0x28cdb4,_0x545538,_0x1c7d8b,_0x3cf1('0x169'));}else{_0x486aec['createStateFinal'](_0x28cdb4,_0x545538,_0x1c7d8b,_0x3cf1('0x169'));}}break;case'3':_0xdf896['outboundNoAnswerCallsDay']+=0x1;_0x28cdb4[_0x3cf1('0x90')]=0x3;_0x28cdb4[_0x3cf1('0x91')]=_0x3cf1('0x16a');_0x28cdb4[_0x3cf1('0x156')]+=0x1;_0x28cdb4['countglobal']+=0x1;_0x486aec[_0x3cf1('0xaf')](_0x28cdb4)[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0x16b')));if(_0x486aec[_0x3cf1('0x166')](0x3,_0x1d4d11,_0xdf896)){if(_0x28cdb4['countnoanswerretry']>=_0xdf896['dialNoAnswerMaxRetry']){_0x486aec['createStateFinal'](_0x28cdb4,_0x545538,_0x1c7d8b,'reason\x203\x20ringing\x20no\x20answer');}else{_0x486aec[_0x3cf1('0x168')](_0x28cdb4,_0x545538,_0x1c7d8b,_0x3cf1('0x16c'));}}break;case'5':_0xdf896['outboundBusyCallsDay']+=0x1;_0x28cdb4['state']=0x5;_0x28cdb4[_0x3cf1('0x91')]=_0x3cf1('0x16d');_0x28cdb4['countbusyretry']+=0x1;_0x28cdb4['countglobal']+=0x1;_0x486aec[_0x3cf1('0xaf')](_0x28cdb4)[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0x16e')));if(_0x486aec[_0x3cf1('0x166')](0x5,_0x1d4d11,_0xdf896)){if(_0x28cdb4[_0x3cf1('0x155')]>=_0xdf896['dialBusyMaxRetry']){_0x486aec[_0x3cf1('0x16f')](_0x28cdb4,_0x545538,_0x1c7d8b,_0x3cf1('0x170'));}else{_0x486aec[_0x3cf1('0x168')](_0x28cdb4,_0x545538,_0x1c7d8b,_0x3cf1('0x170'));}}break;case'8':_0xdf896[_0x3cf1('0x5b')]+=0x1;_0x28cdb4['state']=0x8;_0x28cdb4[_0x3cf1('0x91')]=_0x3cf1('0x171');_0x28cdb4[_0x3cf1('0x167')]+=0x1;_0x28cdb4['countglobal']+=0x1;_0x486aec[_0x3cf1('0xaf')](_0x28cdb4)[_0x3cf1('0x9b')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x486aec[_0x3cf1('0x166')](0x8,_0x1d4d11,_0xdf896)){if(_0x28cdb4[_0x3cf1('0x167')]>=_0xdf896[_0x3cf1('0x15e')]){_0x486aec[_0x3cf1('0x16f')](_0x28cdb4,_0x545538,_0x1c7d8b,_0x3cf1('0x172'));}else{_0x486aec[_0x3cf1('0x168')](_0x28cdb4,_0x545538,_0x1c7d8b,_0x3cf1('0x172'));}}break;default:_0xdf896['outboundUnknownCallsDay']+=0x1;_0x28cdb4['state']=0xc;_0x28cdb4[_0x3cf1('0x91')]=_0x28f5cc[_0x3cf1('0xd8')];_0x486aec[_0x3cf1('0xaf')](_0x28cdb4)[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0x173')));if(_0x486aec[_0x3cf1('0x166')](_0x28f5cc[_0x3cf1('0xd8')],_0x1d4d11,_0xdf896)){if(_0x28cdb4[_0x3cf1('0x155')]+_0x28cdb4['countcongestionretry']+_0x28cdb4[_0x3cf1('0x156')]>=_0xdf896['dialGlobalMaxRetry']){_0x486aec[_0x3cf1('0x168')](_0x28cdb4,_0x545538,_0x1c7d8b,_0x28f5cc[_0x3cf1('0xd8')]);}else{_0x486aec['createStateFinal'](_0x28cdb4,_0x545538,_0x1c7d8b,_0x28f5cc['reason']);}}}});};Dialer['prototype'][_0x3cf1('0x168')]=function(_0x179e18,_0x578901,_0x1237ed,_0x54e57f){var _0x1c2609=new Final(_0x179e18);_0x1c2609['state']=0xf;_0x1c2609[_0x3cf1('0x91')]='Global';this[_0x3cf1('0x16f')](_0x1c2609,_0x578901,_0x1237ed,_0x54e57f);};Dialer['prototype'][_0x3cf1('0x16f')]=function(_0x4552b0,_0x1927d0,_0x8b289c,_0xc4e570){this[_0x3cf1('0xad')](_0x4552b0)[_0x3cf1('0xa0')](function(_0x27f735){return _0x1927d0(msgResponse(_0x3cf1('0x162'),_0x3cf1('0xbb'),_0xc4e570));})[_0x3cf1('0x9b')](function(_0xc59291){return _0x8b289c(msgResponse(_0x3cf1('0x174'),_0x3cf1('0x10c'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0x3cf1('0x5')]=function(_0x1a9e9c){var _0x45368c=this;var _0x3b20af=_0x1a9e9c[_0x3cf1('0x175')]/0x64;var _0x46af43=_0x1a9e9c[_0x3cf1('0x5e')]/(_0x1a9e9c[_0x3cf1('0x5e')]+_0x1a9e9c[_0x3cf1('0x5a')]);var _0x4b6078=_0x1a9e9c[_0x3cf1('0x4b')]-_0x1a9e9c[_0x3cf1('0x68')]-_0x1a9e9c[_0x3cf1('0x52')]-_0x1a9e9c['originated']-_0x1a9e9c[_0x3cf1('0x50')];var _0x3922e0=(_0x1a9e9c[_0x3cf1('0x4b')]-_0x1a9e9c[_0x3cf1('0x68')])*_0x1a9e9c[_0x3cf1('0x66')];var _0xa6af69=Math['floor'](_0x1a9e9c['erlangCalls']*_0x1a9e9c[_0x3cf1('0x176')]*_0x1a9e9c[_0x3cf1('0x177')]*_0x1a9e9c['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x1a9e9c[_0x3cf1('0x26')])){loggerPredictive[_0x3cf1('0x76')](_0x3cf1('0x178'));if(!_[_0x3cf1('0x3a')](_0x1a9e9c['startPredictive'])){_0x1a9e9c[_0x3cf1('0x25')]=undefined;loggerPredictive[_0x3cf1('0x81')](_0x3cf1('0x179'),_0x3cf1('0x17a'));}if(!_['isUndefined'](_0x1a9e9c[_0x3cf1('0x7e')])){loggerPredictive[_0x3cf1('0x81')](_0x3cf1('0x179'),_0x3cf1('0x17b'));clearInterval(_0x1a9e9c[_0x3cf1('0x7e')]);_0x1a9e9c[_0x3cf1('0x7e')]=undefined;}_0x1a9e9c['startProgressive']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x3cf1('0x76')](_0x3cf1('0x17c'),_0x1a9e9c[_0x3cf1('0x26')],_0x1a9e9c[_0x3cf1('0x3e')]);this[_0x3cf1('0x11d')](_0x1a9e9c,0x1);}else if(ifInterval(_0x1a9e9c[_0x3cf1('0x17d')],_0x1a9e9c[_0x3cf1('0x26')])){this[_0x3cf1('0x11d')](_0x1a9e9c,0x1);loggerPredictiveCalls[_0x3cf1('0x76')](_0x3cf1('0x17e'),_0x1a9e9c['startProgressive'],_0x1a9e9c[_0x3cf1('0x3e')]);_0x1a9e9c['erlangCalls']=0x0;_0x1a9e9c[_0x3cf1('0xe5')]=0x0;}else if(_0x3b20af<_0x46af43&&_0x1a9e9c[_0x3cf1('0x17f')]===_0x3cf1('0x180')){freeVariablesPredictive(_0x1a9e9c);loggerPredictive[_0x3cf1('0x76')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x3cf1('0x181'),_0x46af43,_0x3cf1('0x26'),_0x1a9e9c[_0x3cf1('0x3e')]);}else if(_0x4b6078>_0x3922e0){freeVariablesPredictive(_0x1a9e9c);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][LowerLimitInterval]',_0x3cf1('0x182'),_0x4b6078,_0x3cf1('0x183'),_0x3922e0);}else if(_0xa6af69<_0x1a9e9c['predictiveIntervalErlangCallsDroppedCalls']&&_0x1a9e9c['dialPredictiveOptimization']===_0x3cf1('0x180')){freeVariablesPredictive(_0x1a9e9c);loggerPredictive[_0x3cf1('0x76')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0xa6af69,'Drop\x20in\x20this\x20interval',_0x1a9e9c[_0x3cf1('0xe5')],'startProgressive',_0x1a9e9c['name']);}else if(!ifInterval(_0x1a9e9c[_0x3cf1('0x17d')],_0x1a9e9c[_0x3cf1('0x26')])&&_[_0x3cf1('0x3a')](_0x1a9e9c[_0x3cf1('0x25')])&&!_[_0x3cf1('0x3a')](_0x1a9e9c[_0x3cf1('0x26')])){_0x1a9e9c[_0x3cf1('0x25')]=moment()[_0x3cf1('0x72')](_0x3cf1('0xe3'));loggerPredictive['info'](_0x3cf1('0x184'),_0x1a9e9c[_0x3cf1('0x25')],_0x1a9e9c[_0x3cf1('0x3e')]);this[_0x3cf1('0x185')](_0x1a9e9c[_0x3cf1('0x17d')])['then'](this['getDataPredictive'](_0x1a9e9c))[_0x3cf1('0xa0')](mergeDataErlangB(_0x1a9e9c))[_0x3cf1('0xa0')](this[_0x3cf1('0x186')](_0x1a9e9c))['catch'](loggerCatchPredictive(_0x3cf1('0x187'),_0x1a9e9c));}else if(!ifInterval(_0x1a9e9c['dialPredictiveInterval'],_0x1a9e9c[_0x3cf1('0x25')])){_0x1a9e9c[_0x3cf1('0xe5')]=0x0;_0x1a9e9c['startPredictive']=moment()['format'](_0x3cf1('0xe3'));loggerPredictive['info']('[startMethodPredictive][StartPredictive][Repeat]',_0x1a9e9c[_0x3cf1('0x25')],_0x1a9e9c[_0x3cf1('0x3e')]);clearInterval(_0x1a9e9c[_0x3cf1('0x7e')]);_0x1a9e9c[_0x3cf1('0x7e')]=undefined;this[_0x3cf1('0x185')](_0x1a9e9c[_0x3cf1('0x17d')])[_0x3cf1('0xa0')](this[_0x3cf1('0x188')](_0x1a9e9c))[_0x3cf1('0xa0')](mergeDataErlangB(_0x1a9e9c))['then'](this[_0x3cf1('0x186')](_0x1a9e9c))[_0x3cf1('0x9b')](loggerCatchPredictive('[averageHandleTime][ErlangB]\x20',_0x1a9e9c));}};Dialer[_0x3cf1('0x18')]['getDataPredictive']=function(_0x31844b){var _0x4ee6c4=this;return function(_0x4da44a){return new BPromise(function(_0x2b84a8,_0x11ec03){_[_0x3cf1('0x7c')](_0x31844b,_0x4da44a[0x0]);if(checkGetDataPredictive(_0x4da44a[0x0])){loggerPredictive[_0x3cf1('0x76')](JSON['stringify'](_0x4da44a[0x0]));if(_0x31844b[_0x3cf1('0x17f')]==='dropRate'){return _0x4ee6c4['getVoiceQueueRtPauses'](_0x31844b['id'])[_0x3cf1('0xa0')](function(_0x57f928){var _0x29d837=_0x31844b['loggedIn']-_0x57f928[0x0][_0x3cf1('0x189')];var _0x25b410=_0x31844b[_0x3cf1('0x17d')]*0x3c;var _0x39a58b=_0x4da44a[0x0][_0x3cf1('0x64')]+_0x4da44a[0x0]['predictiveIntervalAvgHoldtime'];var _0x16bdd4=(_0x4da44a[0x0]['predictiveIntervalAnsweredCalls']+_0x4da44a[0x0][_0x3cf1('0x18a')]+_0x4da44a[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4da44a[0x0][_0x3cf1('0x69')];var _0x2a8ee1=_0x31844b[_0x3cf1('0x175')]/0x64;_0x31844b[_0x3cf1('0x68')]=_0x57f928[0x0][_0x3cf1('0x189')]||0x0;_0x31844b['predictiveIntervalHitRate']=_0x16bdd4>0x0?_0x16bdd4:0x1;return _0x4ee6c4[_0x3cf1('0x18b')](_0x29d837,_0x25b410,_0x39a58b,_0x16bdd4,_0x2a8ee1);})[_0x3cf1('0xa0')](function(_0x262d4f){return _0x2b84a8(_0x262d4f);})[_0x3cf1('0x9b')](function(_0x5536af){return _0x11ec03(msgResponse('[CatchErlangB]',_0x3cf1('0x10c'),JSON[_0x3cf1('0x6e')](_0x5536af)));});}if(_0x31844b[_0x3cf1('0x17f')]===_0x3cf1('0x18c')){return _0x4ee6c4[_0x3cf1('0xab')](_0x31844b['id'])[_0x3cf1('0xa0')](function(_0x37c42a){var _0x189179=_0x31844b['loggedIn']-_0x37c42a[0x0][_0x3cf1('0x189')];var _0x1714e8=_0x31844b[_0x3cf1('0x17d')]*0x3c;var _0x369f9d=_0x4da44a[0x0][_0x3cf1('0x64')]+_0x4da44a[0x0][_0x3cf1('0x78')];var _0x59a987=(_0x4da44a[0x0]['predictiveIntervalAnsweredCalls']+_0x4da44a[0x0][_0x3cf1('0x18a')]+_0x4da44a[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4da44a[0x0]['predictiveIntervalTotalCalls'];var _0x5a34d9=_0x31844b['dialPredictiveOptimizationPercentage']/0x64;_0x31844b['predictiveIntervalPauses']=_0x37c42a[0x0]['outboundQueuePauses']||0x0;_0x31844b[_0x3cf1('0x177')]=_0x59a987>0x0?_0x59a987:0x1;return _0x4ee6c4['busyFactor'](_0x189179,_0x1714e8,_0x369f9d,_0x59a987,_0x5a34d9);})[_0x3cf1('0xa0')](function(_0x42d4b9){return _0x2b84a8(_0x42d4b9);})[_0x3cf1('0x9b')](function(_0x2ec9f8){return _0x11ec03(msgResponse('[CatchErlangB]','Failure',JSON[_0x3cf1('0x6e')](_0x2ec9f8)));});}}else{return _0x11ec03(msgResponse(_0x3cf1('0x18d'),_0x3cf1('0x10c'),_0x3cf1('0x18e')));}});};};Dialer[_0x3cf1('0x18')][_0x3cf1('0x186')]=function(_0x4f7fc8){var _0x5850d1=this;return function(){var _0x2e6088=0x0;var _0x1f4f46=Math['floor'](_0x4f7fc8[_0x3cf1('0x18f')]*0x3e8);if(_0x1f4f46>0x0){_0x1f4f46=_0x1f4f46<0x64?0x64:_0x1f4f46;loggerPredictive['info'](_0x3cf1('0x190'),_0x1f4f46);_0x4f7fc8[_0x3cf1('0x7e')]=setInterval(function(){_0x5850d1[_0x3cf1('0x7e')](_0x4f7fc8);loggerPredictiveCalls[_0x3cf1('0x76')]('[handlePredictive]',_0x2e6088+=0x1);},_0x1f4f46);}else{loggerPredictive['info'](_0x3cf1('0x191'),_0x3cf1('0x192'),_0x1f4f46);}};};Dialer[_0x3cf1('0x18')]['checkContactBlack']=function(_0x5cdc7f,_0x577941){var _0x1f2d49=this;return function(_0x10b053){if(_['isEmpty'](_0x10b053)){if(_[_0x3cf1('0x97')](_0x577941[_0x3cf1('0xb7')])||!_0x577941[_0x3cf1('0x193')]){if(_0x5cdc7f[_0x3cf1('0x55')]==='booked'){_0x5cdc7f[_0x3cf1('0xf3')]=_[_0x3cf1('0x3a')](_0x5cdc7f['queueStatusComplete'])?!![]:_0x5cdc7f[_0x3cf1('0xf3')];var _0x649d94=uuid['v4']();_0x1f2d49[_0x3cf1('0x22')][_0x649d94]=new Action(_0x5cdc7f,_0x577941,_0x649d94);loggerBooked[_0x3cf1('0x76')]('[booked][checkContactBlack]',_0x649d94,_0x3cf1('0x194'),JSON['stringify'](_0x5cdc7f[_0x3cf1('0xf3')]),_0x3cf1('0x195'),_0x5cdc7f[_0x3cf1('0x3e')]);if(_0x5cdc7f[_0x3cf1('0xf3')]){_0x5cdc7f[_0x3cf1('0xf3')]=![];_0x1f2d49[_0x3cf1('0x28')][_0x1f2d49[_0x3cf1('0x22')][_0x649d94][_0x3cf1('0x9d')]]=[];ami['Action']({'actionid':_0x649d94,'action':'queuestatus','queue':_0x5cdc7f[_0x3cf1('0x3e')]})['catch'](function(_0x29a48c){_0x1f2d49[_0x3cf1('0x9c')](_0x5cdc7f);_0x1f2d49['rescheduleContact']({'active':![],'ContactId':_0x1f2d49[_0x3cf1('0x22')][_0x649d94]['ContactId'],'ListId':_0x1f2d49[_0x3cf1('0x22')][_0x649d94][_0x3cf1('0xb6')],'VoiceQueueId':_0x1f2d49['actions'][_0x649d94][_0x3cf1('0xb8')]||undefined,'CampaignId':_0x1f2d49[_0x3cf1('0x22')][_0x649d94]['CampaignId']||undefined})[_0x3cf1('0x9b')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x1f2d49[_0x3cf1('0x22')][_0x649d94];});}else{loggerBooked[_0x3cf1('0x76')](_0x3cf1('0x196'),JSON[_0x3cf1('0x6e')](_0x5cdc7f['queueStatusComplete']),_0x3cf1('0x195'),_0x5cdc7f[_0x3cf1('0x3e')]);_0x1f2d49[_0x3cf1('0x9c')](_0x5cdc7f);_0x1f2d49['rescheduleContact']({'active':![],'ContactId':_0x1f2d49[_0x3cf1('0x22')][_0x649d94][_0x3cf1('0xb5')],'ListId':_0x1f2d49[_0x3cf1('0x22')][_0x649d94][_0x3cf1('0xb6')],'VoiceQueueId':_0x1f2d49['actions'][_0x649d94][_0x3cf1('0xb8')]||undefined,'CampaignId':_0x1f2d49[_0x3cf1('0x22')][_0x649d94][_0x3cf1('0xf8')]||undefined})[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0x197')));delete _0x1f2d49[_0x3cf1('0x22')][_0x649d94];}}else{return _0x1f2d49[_0x3cf1('0x12a')](_0x5cdc7f,_0x577941);}}else{if(getDiff(_0x577941[_0x3cf1('0x198')])<_0x5cdc7f[_0x3cf1('0x199')]*0x3c){_0x1f2d49[_0x3cf1('0xf4')][_0x3cf1('0xf5')](_0x577941['id'])[_0x3cf1('0x1b')](function(){_0x1f2d49[_0x3cf1('0x9c')](_0x5cdc7f);});}else{_0x5cdc7f[_0x3cf1('0x60')]+=0x1;_0x1f2d49[_0x3cf1('0x9c')](_0x5cdc7f);if(_0x5cdc7f[_0x3cf1('0x19a')]){_0x1f2d49['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x577941['ContactId'],'ListId':_0x577941['ListId'],'VoiceQueueId':_0x577941[_0x3cf1('0xb8')]||undefined,'CampaignId':_0x577941[_0x3cf1('0xf8')]||undefined})[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0x19b')));_0x1f2d49['createHistory'](createObjHistory(_0x5cdc7f,_0x577941,_0x3cf1('0x19c'),0x17,_0x3cf1('0x19d')))[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0x19e')));}else{_0x1f2d49['saveInDb'](createObjHistory(_0x5cdc7f,_0x577941,_0x3cf1('0x19f'),0x16,'RecallFailedTimeout'),_0x3cf1('0x1a0'),'[Originate][HistoryRecallClose]');}}}}else{_0x5cdc7f[_0x3cf1('0x1a1')]+=0x1;_0x1f2d49[_0x3cf1('0xb3')](createObjHistory(_0x5cdc7f,_0x577941,_0x3cf1('0x1a2'),0xd,_0x3cf1('0x1a3')),_0x3cf1('0x1a4'),_0x3cf1('0x1a5'));throw _0x3cf1('0x1a6');}};};Dialer[_0x3cf1('0x18')][_0x3cf1('0x121')]=function(_0x4cff17){var _0x28e684=this;var _0x3bfca1=[];var _0x4d457d=_0x4cff17[_0x3cf1('0x1a7')]-_0x4cff17[_0x3cf1('0x6a')]-_0x4cff17['temp'];emitCampaignSummary(_0x4cff17);if(_0x4d457d>0x0){if(_0x4d457d>this[_0x3cf1('0x20')]){_0x4d457d=this['maxNumberOriginate'];}_0x4cff17[_0x3cf1('0x1a8')]+=_0x4d457d;this[_0x3cf1('0xaa')](_0x4cff17['id'],_0x4d457d,_0x4cff17[_0x3cf1('0x1a9')])['then'](function(_0x1bc334){_0x4cff17['temp']-=_0x4d457d;_0x4cff17[_0x3cf1('0x1a8')]=_0x4cff17['temp']>0x0?_0x4cff17['temp']:0x0;if(!checkContactEmpty(_0x1bc334)){_0x4cff17[_0x3cf1('0x3b')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x3cf1('0x76')]('[getContactCampaign2][Empty]'+_0x4cff17['name']);}else{_0x4cff17[_0x3cf1('0x6a')]+=_0x1bc334[_0x3cf1('0x83')];_0x4cff17[_0x3cf1('0x3b')]=_0x3cf1('0x1aa');for(var _0x15eee0=0x0;_0x15eee0<_0x1bc334[_0x3cf1('0x83')];_0x15eee0+=0x1){_0x4cff17[_0x3cf1('0x1ab')]+=0x1;if(_[_0x3cf1('0x97')](_0x1bc334[_0x15eee0])||_[_0x3cf1('0x97')](_0x1bc334[_0x15eee0][_0x3cf1('0x12d')])||_['isNil'](_0x1bc334[_0x15eee0][_0x3cf1('0x12d')][_0x3cf1('0x12e')])){_0x28e684[_0x3cf1('0xb1')](_0x3cf1('0x1ac'),_0x4cff17,_0x1bc334[_0x15eee0]);}else{_0x28e684[_0x3cf1('0xa3')](_[_0x3cf1('0xb4')](_0x1bc334[_0x15eee0],[_0x3cf1('0xf8'),_0x3cf1('0x1ad')]))[_0x3cf1('0xa0')](_0x28e684[_0x3cf1('0x1ae')](_0x4cff17,_0x1bc334[_0x15eee0]))[_0x3cf1('0x9b')](_0x28e684[_0x3cf1('0x1af')](_0x3cf1('0x1b0'),_0x4cff17));}}}})[_0x3cf1('0x9b')](loggerGetContactDialer(_0x3cf1('0x1b1'),_0x4cff17,_0x4d457d));}};Dialer['prototype'][_0x3cf1('0x11d')]=function(_0x28047f,_0x5321f3){var _0x43154b=this;var _0x2a7970=[];var _0x264098=_0x5321f3>=0x1?_0x5321f3:0x1;var _0x1a37f7=[];if(_0x28047f[_0x3cf1('0x55')]===_0x3cf1('0x4')){_0x264098=0x1;}var _0x29e280=Math[_0x3cf1('0x1b2')](_0x28047f[_0x3cf1('0x4a')]*_0x264098)-_0x28047f['originated']-_0x28047f[_0x3cf1('0x1a8')];emitVoiceQueueSummary(_0x28047f);if(_0x28047f[_0x3cf1('0x1b3')]>0x0){var _0x2b2044=_0x28047f[_0x3cf1('0x1b3')]-_0x28047f[_0x3cf1('0x6a')]-_0x28047f[_0x3cf1('0x50')]-_0x28047f[_0x3cf1('0x1a8')]-_0x28047f[_0x3cf1('0x4c')];if(_0x29e280>_0x2b2044){_0x29e280=_0x2b2044;}}if(_0x29e280>0x0){if(_0x28047f[_0x3cf1('0x55')]==='booked'){_0x29e280=0x1;}if(_0x29e280>this[_0x3cf1('0x20')]){_0x29e280=this[_0x3cf1('0x20')];}_0x28047f[_0x3cf1('0x1a8')]+=_0x29e280;for(var _0x5555f6 in this['agents']){if(this['agents']['hasOwnProperty'](_0x5555f6)){if(this[_0x3cf1('0x1e')][_0x5555f6][_0x3cf1('0x90')]===_0x3cf1('0x1b4')&&this[_0x3cf1('0x1e')][_0x5555f6][_0x3cf1('0x99')]===_0x3cf1('0xbd')){_0x2a7970['push'](this[_0x3cf1('0x1e')][_0x5555f6]['id']);}}}this[_0x3cf1('0xa8')](_0x28047f['id'],_0x2a7970,_0x29e280,_0x28047f['dialOrderByScheduledAt'])[_0x3cf1('0xa0')](function(_0x328d3a){_0x28047f[_0x3cf1('0x1a8')]-=_0x29e280;_0x28047f[_0x3cf1('0x1a8')]=_0x28047f[_0x3cf1('0x1a8')]>0x0?_0x28047f[_0x3cf1('0x1a8')]:0x0;if(!checkContactEmpty(_0x328d3a)){_0x43154b[_0x3cf1('0x9e')](_0x28047f)[_0x3cf1('0xa0')](sendMessageReschedule(_0x28047f))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x28047f[_0x3cf1('0x6a')]+=_0x328d3a[_0x3cf1('0x83')];_0x28047f['message']=_0x28047f['dialMethod']===_0x3cf1('0x4')?_0x3cf1('0x136'):_0x3cf1('0x1aa');for(var _0x1764a7=0x0;_0x1764a7<_0x328d3a[_0x3cf1('0x83')];_0x1764a7+=0x1){if(_[_0x3cf1('0x97')](_0x328d3a[_0x1764a7])||_[_0x3cf1('0x97')](_0x328d3a[_0x1764a7][_0x3cf1('0x12d')])||_[_0x3cf1('0x97')](_0x328d3a[_0x1764a7][_0x3cf1('0x12d')]['phone'])){_0x43154b[_0x3cf1('0xb1')]('[actionOriginate]\x20',_0x28047f,_0x328d3a[_0x1764a7]);}else{_0x43154b[_0x3cf1('0xa2')](_[_0x3cf1('0xb4')](_0x328d3a[_0x1764a7],[_0x3cf1('0xb8'),_0x3cf1('0x1ad')]))['then'](_0x43154b[_0x3cf1('0x1ae')](_0x28047f,_0x328d3a[_0x1764a7]))[_0x3cf1('0x9b')](_0x43154b[_0x3cf1('0x1af')](_0x3cf1('0x1ac'),_0x28047f));}}}})[_0x3cf1('0x9b')](loggerGetContactDialer('[getContactDialer2]',_0x28047f,_0x29e280));}};Dialer[_0x3cf1('0x18')][_0x3cf1('0x7e')]=function(_0x4e90d6){var _0x3162bd=this;if(_0x4e90d6[_0x3cf1('0x1b3')]>0x0){var _0x3a33dd=_0x4e90d6[_0x3cf1('0x1b3')]-_0x4e90d6[_0x3cf1('0x6a')]-_0x4e90d6[_0x3cf1('0x50')];if(_0x3a33dd>0x0){this['tryOriginatePredictive'](_0x4e90d6);}else{loggerPredictiveCalls[_0x3cf1('0x76')]('[handlePredictive][limitChannel]');}}else{this[_0x3cf1('0x1b5')](_0x4e90d6);}};Dialer[_0x3cf1('0x18')][_0x3cf1('0x1b5')]=function(_0x12b054){var _0x1404bc=this;var _0x1b94e0=[];_0x12b054[_0x3cf1('0x6a')]+=0x1;for(var _0x5a0636 in this[_0x3cf1('0x1e')]){if(this['agents'][_0x3cf1('0x84')](_0x5a0636)){if(this[_0x3cf1('0x1e')][_0x5a0636][_0x3cf1('0x90')]===_0x3cf1('0x1b4')&&this[_0x3cf1('0x1e')][_0x5a0636][_0x3cf1('0x99')]===_0x3cf1('0xbd')){_0x1b94e0[_0x3cf1('0xf0')](this[_0x3cf1('0x1e')][_0x5a0636]['id']);}}}this[_0x3cf1('0xa8')](_0x12b054['id'],_0x1b94e0,0x1,_0x12b054['dialOrderByScheduledAt'])[_0x3cf1('0xa0')](function(_0x2b82b5){if(!checkContactEmpty(_0x2b82b5)){checkContactLowerLimitOriginate(_0x12b054,0x1,0x0);_0x1404bc[_0x3cf1('0x9e')](_0x12b054)[_0x3cf1('0xa0')](sendMessageReschedule(_0x12b054))[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xa1')));}else{_0x12b054['message']=_0x3cf1('0x1aa');if(_['isNil'](_0x2b82b5[0x0])||_[_0x3cf1('0x97')](_0x2b82b5[0x0][_0x3cf1('0x12d')])||_[_0x3cf1('0x97')](_0x2b82b5[0x0][_0x3cf1('0x12d')][_0x3cf1('0x12e')])){_0x1404bc[_0x3cf1('0xb1')]('[actionOriginate]\x20',_0x12b054,_0x2b82b5[0x0]);}else{_0x1404bc[_0x3cf1('0xa2')](_[_0x3cf1('0xb4')](_0x2b82b5[0x0],[_0x3cf1('0xb8'),'Contact.phone']))[_0x3cf1('0xa0')](_0x1404bc[_0x3cf1('0x1ae')](_0x12b054,_0x2b82b5[0x0]))[_0x3cf1('0x9b')](_0x1404bc['loggerHandler'](_0x3cf1('0x1b6'),_0x12b054));}}})[_0x3cf1('0x9b')](loggerGetContactDialer(_0x3cf1('0x1b7'),_0x12b054,0x1));emitVoiceQueueSummary(_0x12b054);};Dialer['prototype'][_0x3cf1('0x18b')]=function(_0x57d871,_0x51771c,_0x5a665c,_0x5be6c2,_0x2678d7,_0x4e38ce){loggerPredictive[_0x3cf1('0x76')](_0x3cf1('0x1b8'),_0x3cf1('0x1b9'),_0x57d871,'\x20interval\x20=\x20',_0x51771c,_0x3cf1('0x1ba'),_0x5a665c,_0x3cf1('0x1bb'),_0x5be6c2,_0x3cf1('0x1bc'),_0x2678d7);return new BPromise(function(_0x1f1436,_0x38c082){if(_0x57d871<=0x0||isNaN(_0x57d871)){return _0x38c082(msgResponse('[abandonmentRate]',_0x3cf1('0x41'),'m\x20=\x20'+_0x57d871));}if(_0x5a665c<=0x0||isNaN(_0x5a665c)){return _0x38c082(msgResponse('[abandonmentRate]',_0x3cf1('0x41'),_0x3cf1('0x1bd')+_0x5a665c));}if(_0x5be6c2<=0x0||isNaN(_0x5be6c2)){return _0x38c082(msgResponse(_0x3cf1('0x1b8'),_0x3cf1('0x41'),_0x3cf1('0x1be')+_0x5be6c2));}if(_0x51771c<=0x0||isNaN(_0x51771c)){return _0x38c082(msgResponse(_0x3cf1('0x1b8'),_0x3cf1('0x41'),_0x3cf1('0x1bf')+_0x51771c));}if(_0x2678d7<=0x0||isNaN(_0x2678d7)){return _0x38c082(msgResponse(_0x3cf1('0x1b8'),'Error',_0x3cf1('0x1c0')+_0x2678d7));}_0x4e38ce=_0x4e38ce||0x0;var _0xcd33b1=0x1/_0x5a665c;var _0x2d7e00=0x0;var _0xbf11ad=0x0;var _0x174576=0x0;var _0x393cbb=0x0;for(var _0x3303af=0x0;_0x174576<_0x2678d7;_0x3303af+=0x1){_0xbf11ad=_0x3303af/_0x51771c;_0x2d7e00=(_0x5be6c2*_0xbf11ad+_0x4e38ce)/_0xcd33b1;_0x174576=erlangb(_0x2d7e00,_0x57d871);_0x393cbb=_0x2d7e00/_0x57d871*(0x1-erlangb(_0x2d7e00,_0x57d871));}return _0x1f1436({'erlangCalls':_0x3303af,'erlangCallToSecond':_0x51771c/_0x3303af,'erlangAbandonmentRate':_0x174576,'erlangBusyFactor':_0x393cbb});});};Dialer[_0x3cf1('0x18')][_0x3cf1('0x1c1')]=function(_0x384398,_0x33a4ec,_0x568759,_0x3d9926,_0xd0a606,_0x209e15){loggerPredictive[_0x3cf1('0x76')](_0x3cf1('0x1c2'),'\x20m\x20=\x20',_0x384398,_0x3cf1('0x1c3'),_0x33a4ec,_0x3cf1('0x1ba'),_0x568759,'\x20p\x20=\x20',_0x3d9926,_0x3cf1('0x1c4'),_0xd0a606);return new BPromise(function(_0x52a2c6,_0x54d3bc){if(_0x384398<=0x0||isNaN(_0x384398)){return _0x54d3bc(msgResponse(_0x3cf1('0x1b8'),_0x3cf1('0x41'),_0x3cf1('0x1c5')+_0x384398));}if(_0x568759<=0x0||isNaN(_0x568759)){return _0x54d3bc(msgResponse('[abandonmentRate]',_0x3cf1('0x41'),_0x3cf1('0x1bd')+_0x568759));}if(_0x3d9926<=0x0||isNaN(_0x3d9926)){return _0x54d3bc(msgResponse(_0x3cf1('0x1b8'),_0x3cf1('0x41'),_0x3cf1('0x1be')+_0x3d9926));}if(_0x33a4ec<=0x0||isNaN(_0x33a4ec)){return _0x54d3bc(msgResponse(_0x3cf1('0x1b8'),_0x3cf1('0x41'),'interval\x20=\x20'+_0x33a4ec));}if(_0xd0a606<=0x0||isNaN(_0xd0a606)){return _0x54d3bc(msgResponse(_0x3cf1('0x1b8'),_0x3cf1('0x41'),'Amax\x20=\x20'+_0xd0a606));}_0x209e15=_0x209e15||0x0;var _0x26e99d=0x1/_0x568759;var _0x4df368=0x0;var _0x3181bb=0x0;var _0x162b8e=0x0;var _0x27ad4d=0x0;for(var _0x2bee62=0x0;_0x27ad4d<_0xd0a606;_0x2bee62+=0x1){_0x3181bb=_0x2bee62/_0x33a4ec;_0x4df368=(_0x3d9926*_0x3181bb+_0x209e15)/_0x26e99d;_0x162b8e=erlangb(_0x4df368,_0x384398);_0x27ad4d=_0x4df368/_0x384398*(0x1-erlangb(_0x4df368,_0x384398));}return _0x52a2c6({'erlangCalls':_0x2bee62,'erlangCallToSecond':_0x33a4ec/_0x2bee62,'erlangAbandonmentRate':_0x162b8e,'erlangBusyFactor':_0x27ad4d});});};module[_0x3cf1('0x1c6')]=Dialer; \ No newline at end of file +var _0x0561=['[unlockQueueStatus][undefined]','queueStatusComplete','syncQueueStatusComplete','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','ListId','VoiceQueueId','[unlock][syncQueueStatusComplete]','_rr','paused','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','isArray','length','push','command','iftime\x20%s,%s','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','power','dialPowerLevel','method\x20not\x20recognized','launchHandleIvr','handleIvr','checkIfTime','dialGlobalInterval','dialTimezone','checkDialMethod','checkIsTrunkReachable','pow','random','match','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','tags','createdAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','TrunkBackup','callerid','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialCutDigit','substring','trim','outboundOriginateFailureCallsDay','[originateError]:\x20%s','endtime','[originate][error]','originate\x20action\x20Error','isSuccess','response','callProgressDetecting','[callProgressDetecting]\x20','countbusyretry','countcongestionretry','countnoanswerretry','dialGlobalMaxRetry','dialNoAnswerMaxRetry','add','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','minutes','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','[syncAgentComplete][createHistory][0]','checkRetriveMax','stateGlobal','reason\x200\x20no\x20such\x20number....','createStateFinal','NoAnswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','countglobal','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','predictiveIntervalLowerLimit','floor','erlangAbandonmentRate','[startMethodPredictive][StartProgressive][First]','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','erlangCalls','dropRate','Dropped\x20calls\x20day','Agent\x20free','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','startMethodPredictive','[averageHandleTime][ErlangB]\x20','[startMethodPredictive][StartPredictive][Repeat]','getDataPredictive','outboundQueuePauses','predictiveIntervalAnsweredCalls','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[CatchErlangB]','[getDataPredictive]','check\x20failure','erlangCallToSecond','[startMethodPredictive]','[startMethodPredictive][milliseconds]\x20','Failure\x20','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallMeTimeout','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','temp','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','dialLimitQueue','getContactDialer','[countReScheduled]\x20','[getContactDialer2]','tryOriginatePredictive','countReScheduled','[actionOriginatePredictive]\x20','[abandonmentRate]','\x20interval\x20=\x20','\x20Ts\x20=\x20','\x20Amax\x20=\x20','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','\x20p\x20=\x20','\x20Umin\x20=\x20','Ts\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../../../config/environment/','../ami','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/voiceQueueRt','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','varset','syncVarSet','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','emit','type','outbound','strategy','answered','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','Trunk','format','voice_queue:save','campaign:save','info','[checkGetDataPredictive][totalCalls]','[checkGetDataPredictive][objIsEmpty]','[checkGetDataPredictive][obj]','[ErlangB]','merge','seconds','startProgressive','[freeVariablesPredictive]','handlePredictive','ivr','string','\x22%s\x22\x20<%s>','error','inspect','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','pTalking','available','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','statedesc','starttime','clearZombieChannels','[uniqueid]','[actions]','hasOwnProperty','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','resolve','checkIsBlackList','then','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','ContactId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','Success','active','SIP/%s','reachable','unmonitored','saveInDb','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','uniqueid','HangupInAMD','membername','MACHINE','Machine','AMD','[syncMachine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncMachineIvr]','syncHangup','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AGI','cause-txt','Unknow','reason','agent','agiafterat','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','predictiveIntervalErlangCallsDroppedCalls','Drop','TIMEOUT','dialQueueProject2','predictiveIntervalDroppedCallsCallersExit','Abandoned','dropreason','CALLEREXIT','syncQueueMember','actionid','locked','stateinterface','queueBooked','pick'];(function(_0x2eaea6,_0x1905ae){var _0xfbf6d6=function(_0x55b155){while(--_0x55b155){_0x2eaea6['push'](_0x2eaea6['shift']());}};_0xfbf6d6(++_0x1905ae);}(_0x0561,0xdc));var _0x1056=function(_0x455e3b,_0x5f1e3a){_0x455e3b=_0x455e3b-0x0;var _0xe3ec2e=_0x0561[_0x455e3b];return _0xe3ec2e;};'use strict';var util=require(_0x1056('0x0'));var _=require(_0x1056('0x1'));var BPromise=require(_0x1056('0x2'));var uuid=require(_0x1056('0x3'));var moment=require(_0x1056('0x4'));var rr=require('rr');var md5=require(_0x1056('0x5'));var logger=require(_0x1056('0x6'))('dialer');var loggerBooked=require(_0x1056('0x6'))(_0x1056('0x7'));var loggerPredictive=require(_0x1056('0x6'))(_0x1056('0x8'));var loggerPredictiveCalls=require('../../../config/logger')(_0x1056('0x9'));var loggerSyncQueueSummary=require(_0x1056('0x6'))(_0x1056('0xa'));var config=require(_0x1056('0xb'));var ami=require(_0x1056('0xc'));var io=require(_0x1056('0xd'))({'host':'localhost','port':0x18eb});var cmHopper=require(_0x1056('0xe'));var cmHopperFinal=require(_0x1056('0xf'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x1056('0x10'));var Action=require('./action');var History=require(_0x1056('0x11'));var Final=require(_0x1056('0x12'));var AgentComplete=require(_0x1056('0x13'));var QueueCallerAbandon=require(_0x1056('0x14'));var Hangup=require(_0x1056('0x15'));var ipAgi=process['env'][_0x1056('0x16')]||_0x1056('0x17');var strategy={'rrmemory':_0x1056('0x18'),'roundrobin':_0x1056('0x19')};var Sequence=function(){};Sequence[_0x1056('0x1a')][_0x1056('0x1b')]=function(_0x506041){this[_0x1056('0x1c')]=this[_0x1056('0x1c')]?this['tail'][_0x1056('0x1d')](_0x506041):_0x506041();};function Dialer(_0x2b40ac,_0x29b440){this[_0x1056('0x1e')]=new Sequence();this[_0x1056('0x1f')]=_0x29b440;this['voiceQueues']=_0x2b40ac[_0x1056('0x20')];this[_0x1056('0x21')]=_0x2b40ac['campaigns'];this[_0x1056('0x22')]=_0x2b40ac['agents'];this['trunks']=_0x2b40ac[_0x1056('0x23')];this[_0x1056('0x24')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0x1056('0x25')]={};this[_0x1056('0x26')]={};this[_0x1056('0x27')]={};this[_0x1056('0x28')]={};this[_0x1056('0x29')]={};this['startProgressive']={};this[_0x1056('0x2a')]={};this['queueBooked']={};this[_0x1056('0x2b')]={};ami['on'](_0x1056('0x2c'),this[_0x1056('0x2d')][_0x1056('0x2e')](this));ami['on'](_0x1056('0x2f'),this[_0x1056('0x30')][_0x1056('0x2e')](this));ami['on'](_0x1056('0x31'),this[_0x1056('0x32')]['bind'](this));ami['on'](_0x1056('0x33'),this[_0x1056('0x34')][_0x1056('0x2e')](this));ami['on']('custom:queuesummary',this[_0x1056('0xa')]['bind'](this));ami['on'](_0x1056('0x35'),this['syncHangup'][_0x1056('0x2e')](this));ami['on']('newexten',this['syncNewExten'][_0x1056('0x2e')](this));ami['on'](_0x1056('0x36'),this[_0x1056('0x37')][_0x1056('0x2e')](this));ami['on']('queuemember',this['syncQueueMember'][_0x1056('0x2e')](this));ami['on'](_0x1056('0x38'),this['syncQueueStatusComplete'][_0x1056('0x2e')](this));this[_0x1056('0x39')]();this[_0x1056('0x3a')]();}function isNotNull(_0x43c1de){return _0x43c1de!==null&&!_[_0x1056('0x3b')](_0x43c1de);}function checkIsLoggedIn(_0x525654,_0x3e67c2){return function(){if(_0x3e67c2<=0x0){_0x525654[_0x1056('0x3c')]='AGENTS_NOT_LOGGED';throw _0x525654[_0x1056('0x3d')]+_0x1056('0x3e');}};}function isActive(_0x3b5a88){return _0x3b5a88;}function checkIsActive(_0x5637cd,_0x6d35e3){return function(){if(!isActive(_0x6d35e3)){_0x5637cd[_0x1056('0x3c')]=_0x1056('0x3f');throw _0x5637cd[_0x1056('0x3d')]+_0x1056('0x40');}};}function checkInterval(_0x44cef4){return function(){if(!isNotNull(_0x44cef4[_0x1056('0x41')])){_0x44cef4[_0x1056('0x3c')]=_0x1056('0x42');throw _0x44cef4[_0x1056('0x3d')]+_0x1056('0x43');}if(!isNotNull(_0x44cef4['Interval'][_0x1056('0x44')])){_0x44cef4[_0x1056('0x3c')]='INTERVAL_IS_NULL';throw _0x44cef4[_0x1056('0x3d')]+_0x1056('0x43');}if(!isNotNull(_[_0x1056('0x45')](_0x44cef4[_0x1056('0x41')][_0x1056('0x44')]))){_0x44cef4[_0x1056('0x3c')]=_0x1056('0x42');throw _0x44cef4[_0x1056('0x3d')]+_0x1056('0x43');}};}function msgResponse(_0x363326,_0x2272e6,_0x36aa92){return{'action':_0x363326,'response':_0x2272e6,'message':_0x36aa92};}function myreject(_0x1d7c03){return function(_0x4e39a3){return _0x1d7c03(msgResponse(_0x1056('0x46'),_0x1056('0x47'),JSON[_0x1056('0x48')](_0x4e39a3)));};}function getSeconds(_0x2948a0,_0x5023dd){var _0x6d3010=moment(_0x2948a0)[_0x1056('0x49')](0x0);var _0x32d513=moment(_0x5023dd)[_0x1056('0x49')](0x0);return _0x6d3010[_0x1056('0x4a')](_0x32d513,'seconds');}function emit(_0x8e824e,_0xb6e63f,_0x191a57){io['to'](_0x8e824e)[_0x1056('0x4b')](_0xb6e63f,_0x191a57);}function emitVoiceQueueSummary(_0x441118){if(_0x441118[_0x1056('0x4c')]===_0x1056('0x4d')){var _0x461054={'id':_0x441118['id'],'name':_0x441118[_0x1056('0x3d')],'strategy':_0x441118[_0x1056('0x4e')],'answered':_0x441118[_0x1056('0x4f')],'available':_0x441118['available'],'loggedIn':_0x441118[_0x1056('0x50')],'pTalking':_0x441118['pTalking'],'sumBillable':_0x441118[_0x1056('0x51')],'sumDuration':_0x441118[_0x1056('0x52')],'sumHoldTime':_0x441118[_0x1056('0x53')]||0x0,'talking':_0x441118[_0x1056('0x54')],'total':_0x441118[_0x1056('0x55')],'type':_0x441118[_0x1056('0x4c')],'unmanaged':_0x441118[_0x1056('0x56')],'waiting':_0x441118[_0x1056('0x57')],'loggedInDb':_0x441118[_0x1056('0x58')],'dialActive':_0x441118[_0x1056('0x59')],'dialMethod':_0x441118[_0x1056('0x5a')],'dialOriginateCallerIdName':_0x441118[_0x1056('0x5b')],'dialOriginateCallerIdNumber':_0x441118[_0x1056('0x5c')],'dialOriginateTimeout':_0x441118[_0x1056('0x5d')],'dialPrefix':_0x441118[_0x1056('0x5e')],'outboundAnswerAgiCallsDay':_0x441118[_0x1056('0x5f')],'outboundAnswerCallsDay':_0x441118[_0x1056('0x60')],'outboundBlacklistCallsDay':_0x441118['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x441118[_0x1056('0x61')],'outboundCongestionCallsDay':_0x441118['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x441118['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x441118[_0x1056('0x62')],'outboundDropCallsDayTimeout':_0x441118[_0x1056('0x63')],'outboundNoAnswerCallsDay':_0x441118[_0x1056('0x64')],'outboundNoSuchCallsDay':_0x441118[_0x1056('0x65')],'outboundOriginateFailureCallsDay':_0x441118['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x441118[_0x1056('0x66')],'outboundRejectCallsDay':_0x441118['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x441118[_0x1056('0x67')],'predictiveIntervalAnsweredCalls':_0x441118['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x441118[_0x1056('0x68')],'predictiveIntervalAvgTalktime':_0x441118[_0x1056('0x69')],'predictiveIntervalDroppedCallsCallersExit':_0x441118['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x441118[_0x1056('0x6a')],'predictiveIntervalErlangCalls':_0x441118[_0x1056('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0x441118['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x441118[_0x1056('0x6c')],'predictiveIntervalLowerLimit':_0x441118['predictiveIntervalLowerLimit'],'predictiveIntervalMultiplicativeFactor':_0x441118[_0x1056('0x6d')],'predictiveIntervalPauses':_0x441118[_0x1056('0x6e')],'predictiveIntervalTotalCalls':_0x441118[_0x1056('0x6f')],'message':_0x441118[_0x1056('0x3c')],'originated':_0x441118[_0x1056('0x70')]};if(_0x441118[_0x1056('0x71')]){_0x461054[_0x1056('0x71')]={'id':_0x441118[_0x1056('0x71')]['id'],'name':_0x441118[_0x1056('0x71')][_0x1056('0x3d')],'active':_0x441118[_0x1056('0x71')]['active'],'callerid':_0x441118[_0x1056('0x71')]['callerid']};}if(_0x441118['Interval']){_0x461054[_0x1056('0x41')]={'id':_0x441118[_0x1056('0x41')]['id'],'name':_0x441118[_0x1056('0x41')][_0x1056('0x3d')]};}var _0x26a5df=md5(JSON[_0x1056('0x48')](_0x461054));if(_0x441118[_0x1056('0x5')]!==_0x26a5df){_0x441118[_0x1056('0x5')]=_0x26a5df;emit(util[_0x1056('0x72')]('voice:queue:%s',_0x461054['name']),_0x1056('0x73'),_0x461054);}}}function emitCampaignSummary(_0x57de4c){if(_0x57de4c[_0x1056('0x4c')]==='ivr'){emit(util['format']('campaign:ivr:%s',_0x57de4c['name']),_0x1056('0x74'),_0x57de4c);}}function checkGetDataPredictive(_0x660305){if(isNotNull(_0x660305)){if(!_['isEmpty'](_0x660305)){if(_0x660305[_0x1056('0x6f')]>0x0){if(!_[_0x1056('0x3b')](_0x660305[_0x1056('0x69')])&&_0x660305[_0x1056('0x69')]>0x0){return!![];}else{loggerPredictive['info']('[checkGetDataPredictive][avgTalktime]',JSON[_0x1056('0x48')](_0x660305));}if(!_[_0x1056('0x3b')](_0x660305['predictiveIntervalAvgHoldtime'])&&_0x660305['predictiveIntervalAvgHoldtime']>0x0){return!![];}else{loggerPredictive[_0x1056('0x75')]('[checkGetDataPredictive][avgHoldtime]',JSON[_0x1056('0x48')](_0x660305));}}else{loggerPredictive[_0x1056('0x75')](_0x1056('0x76'),JSON[_0x1056('0x48')](_0x660305));}}else{loggerPredictive[_0x1056('0x75')](_0x1056('0x77'),JSON[_0x1056('0x48')](_0x660305));}}else{loggerPredictive['info'](_0x1056('0x78'),JSON[_0x1056('0x48')](_0x660305));}return![];}function mergeDataErlangB(_0x33e5ed){return function(_0x4f978e){loggerPredictive['info'](_0x1056('0x79'),JSON[_0x1056('0x48')](_0x4f978e));_[_0x1056('0x7a')](_0x33e5ed,_0x4f978e);};}function getDiff(_0x306d05){var _0x8d2740=moment()['milliseconds'](0x0);var _0x4a758a=moment(_0x306d05)[_0x1056('0x49')](0x0);return _0x8d2740[_0x1056('0x4a')](_0x4a758a,_0x1056('0x7b'));}function ifInterval(_0x55d8f6,_0xacc8de){if(_[_0x1056('0x3b')](_0xacc8de)){return![];}if(getDiff(_0xacc8de)<_0x55d8f6*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x42d060){if(isNotNull(_0x42d060)){if(!_[_0x1056('0x3b')](_0x42d060['startProgressive'])){_0x42d060[_0x1056('0x7c')]=undefined;loggerPredictive[_0x1056('0x75')]('[freeVariablesPredictive]',_0x1056('0x7c'),_0x42d060[_0x1056('0x3d')]);}if(!_[_0x1056('0x3b')](_0x42d060[_0x1056('0x29')])){_0x42d060[_0x1056('0x29')]=undefined;loggerPredictive[_0x1056('0x75')](_0x1056('0x7d'),_0x1056('0x29'),_0x42d060[_0x1056('0x3d')]);}if(!_[_0x1056('0x3b')](_0x42d060[_0x1056('0x7e')])){clearInterval(_0x42d060[_0x1056('0x7e')]);_0x42d060['handlePredictive']=undefined;loggerPredictive['info'](_0x1056('0x7d'),_0x1056('0x7e'),_0x42d060[_0x1056('0x3d')]);}}}function erlangb(_0x30c20f,_0x238f56){if(_0x238f56===0x0){return 0x0;}var _0x3d4281=0x1;for(var _0x860617=0x1;_0x860617<=_0x238f56;_0x860617+=0x1){_0x3d4281=0x1+_0x3d4281*_0x860617/_0x30c20f;}return 0x1/_0x3d4281;}function isVoiceQueueOutbound(_0x5bae2d){return _0x5bae2d==='outbound';}function isNotPreview(_0x2700c2){return _0x2700c2!==_0x1056('0x1f');}function isCampaignIvr(_0x2436fa){return _0x2436fa===_0x1056('0x7f');}function getCallerId(_0x36d970,_0x3313b4,_0x254e1e){if(!_[_0x1056('0x3b')](_0x254e1e)&&_0x1056('0x80')===typeof _0x254e1e&&!_[_0x1056('0x45')](_0x254e1e)){if(!_[_0x1056('0x3b')](_0x3313b4)&&_0x1056('0x80')===typeof _0x3313b4&&!_[_0x1056('0x45')](_0x3313b4)){return util[_0x1056('0x72')]('\x22%s\x22\x20<%s>',_0x3313b4,_0x254e1e);}return util[_0x1056('0x72')](_0x1056('0x81'),_0x254e1e,_0x254e1e);}if(!_[_0x1056('0x3b')](_0x36d970)&&'string'===typeof _0x36d970&&!_[_0x1056('0x45')](_0x36d970)){return _0x36d970;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x4b86f8,_0x2f72ea){return function(_0xae5c2b){freeVariablesPredictive(_0x2f72ea);emitVoiceQueueSummary(_0x2f72ea);emitCampaignSummary(_0x2f72ea);loggerSyncQueueSummary[_0x1056('0x82')](_0x4b86f8,util[_0x1056('0x83')](_0xae5c2b,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2edac8,_0x5a885d){return function(_0x11f110){loggerPredictive['error'](_0x2edac8,JSON['stringify'](_0x11f110));freeVariablesPredictive(_0x5a885d);};}function loggerCatch(_0x1a254){return function(_0x3aed4a){logger[_0x1056('0x82')](_0x1a254,util['inspect'](_0x3aed4a,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1251c9){return _0x1251c9&&!_[_0x1056('0x3b')](_0x1251c9)&&_0x1251c9['length']>0x0;}function decremetOriginate(_0x59701d){if(!_['isUndefined'](_0x59701d)&&_0x59701d!==null){if(_0x59701d['hasOwnProperty'](_0x1056('0x70'))){if(_0x59701d['originated']>0x0){_0x59701d['originated']-=0x1;}else{logger[_0x1056('0x82')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x1056('0x82')](_0x1056('0x84'));}}function checkContactLowerLimitOriginate(_0x382eb9,_0x2c380a,_0x24d0de){if(_0x2c380a>_0x24d0de){for(var _0x16479b=0x0;_0x16479b<_0x2c380a-_0x24d0de;_0x16479b+=0x1){decremetOriginate(_0x382eb9);}}}function loggerGetContactDialer(_0x1e9a6f,_0x3644bb,_0x54a978){return function(_0xe1dd2a){checkContactLowerLimitOriginate(_0x3644bb,_0x54a978,0x0);logger[_0x1056('0x82')](_0x1e9a6f,util['inspect'](_0xe1dd2a,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x31d788){return function(_0x2279e7){if(isNotNull(_0x2279e7)&&isNotNull(_0x2279e7[0x0])){if(_0x2279e7[0x0][_0x1056('0x85')]>0x0){_0x31d788[_0x1056('0x3c')]=_0x1056('0x86');logger[_0x1056('0x75')](_0x1056('0x87')+_0x31d788[_0x1056('0x3d')],_0x2279e7[0x0][_0x1056('0x85')],_0x1056('0x88'));}else{_0x31d788[_0x1056('0x3c')]=_0x1056('0x89');logger[_0x1056('0x75')](_0x1056('0x8a')+_0x31d788[_0x1056('0x3d')]);}}};}function notSendMessagesQueue(_0x3023b0){if(_0x3023b0[_0x1056('0x8b')]){freeVariablesPredictive(_0x3023b0);if(_0x3023b0[_0x1056('0x70')]===0x0&&_0x3023b0['talking']===0x0&&_0x3023b0[_0x1056('0x57')]===0x0&&(_0x3023b0[_0x1056('0x8c')]||0x0)===0x0){_0x3023b0[_0x1056('0x8b')]=![];_0x3023b0[_0x1056('0x8d')]=0x0;_0x3023b0[_0x1056('0x3c')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x1056('0x82')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x3023b0[_0x1056('0x3d')],_0x1056('0x8e'));}else{_0x3023b0[_0x1056('0x3c')]=_0x1056('0x8f');loggerSyncQueueSummary[_0x1056('0x82')](_0x1056('0x90'),_0x3023b0[_0x1056('0x3d')],'is\x20disactive');}emitVoiceQueueSummary(_0x3023b0);}}function notSendMessagesCampaign(_0x4c8d35){if(_0x4c8d35[_0x1056('0x8b')]){if(_0x4c8d35[_0x1056('0x70')]===0x0){_0x4c8d35[_0x1056('0x8b')]=![];_0x4c8d35[_0x1056('0x3c')]=_0x1056('0x3f');loggerSyncQueueSummary[_0x1056('0x82')](_0x1056('0x91'),_0x4c8d35[_0x1056('0x3d')],_0x1056('0x8e'));}else{_0x4c8d35[_0x1056('0x3c')]=_0x1056('0x8f');loggerSyncQueueSummary[_0x1056('0x82')](_0x1056('0x91'),_0x4c8d35[_0x1056('0x3d')],_0x1056('0x92'));}emitCampaignSummary(_0x4c8d35);}}function createObjHistory(_0x3a718e,_0x4e93ea,_0x1d0889,_0x1766de,_0x3127ed){_0x3a718e[_0x1056('0x3c')]=_0x1d0889;var _0x1c2ec1=new Action(_0x3a718e,_0x4e93ea);var _0x2e7d77=new History(_0x1c2ec1);_0x2e7d77[_0x1056('0x93')]=_0x1766de;_0x2e7d77[_0x1056('0x94')]=_0x3127ed;_0x2e7d77['endtime']=_0x1c2ec1[_0x1056('0x95')];return _0x2e7d77;}Dialer[_0x1056('0x1a')][_0x1056('0x3a')]=function(){var _0x141db9=this;setInterval(function(){_0x141db9[_0x1056('0x96')](_0x141db9['uniqueId'],_0x1056('0x97'));_0x141db9[_0x1056('0x96')](_0x141db9[_0x1056('0x25')],_0x1056('0x98'));},0x32c8);};Dialer[_0x1056('0x1a')][_0x1056('0x96')]=function(_0xc688c0,_0x406950){var _0x3492d4=this;for(var _0x233d6d in _0xc688c0){if(_0xc688c0[_0x1056('0x99')](_0x233d6d)){this[_0x1056('0x1e')][_0x1056('0x1b')](function(){if(!_[_0x1056('0x9a')](_0xc688c0[_0x233d6d])){return ami[_0x1056('0x9b')]({'action':_0x1056('0x9c'),'channel':_0xc688c0[_0x233d6d][_0x1056('0x9d')]})[_0x1056('0x9e')](function(_0x244a44){if(_0x244a44['message']===_0x1056('0x9f')){setTimeout(function(){if(_0xc688c0[_0x233d6d]&&_0xc688c0[_0x233d6d][_0x1056('0x4c')]!==_0x1056('0x7f')){_0x3492d4[_0x1056('0xa0')](_0x3492d4[_0x1056('0x20')][_0xc688c0[_0x233d6d]['queue']]);logger[_0x1056('0x82')](_0x1056('0xa1'),_0x406950,_0x233d6d,_0xc688c0[_0x233d6d][_0x1056('0xa2')]);delete _0xc688c0[_0x233d6d];}if(_0xc688c0[_0x233d6d]&&_0xc688c0[_0x233d6d][_0x1056('0x4c')]===_0x1056('0x7f')){_0x3492d4[_0x1056('0xa0')](_0x3492d4[_0x1056('0x21')][_0xc688c0[_0x233d6d][_0x1056('0xa2')]]);logger[_0x1056('0x82')](_0x1056('0xa3'),_0x406950,_0x233d6d,_0xc688c0[_0x233d6d]['queue']);delete _0xc688c0[_0x233d6d];}},0x2328);}});}});}}};Dialer[_0x1056('0x1a')]['countReScheduled']=function(_0x3b2271){return BPromise[_0x1056('0xa4')]()['then'](cmHopper['countReScheduled'](_0x3b2271))[_0x1056('0x9e')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x1056('0x1a')][_0x1056('0xa5')]=function(_0x3d33e4){return BPromise[_0x1056('0xa4')]()[_0x1056('0xa6')](cmHopperBlack[_0x1056('0xa5')](_0x3d33e4))[_0x1056('0x9e')](loggerCatch(_0x1056('0xa7')));};Dialer[_0x1056('0x1a')][_0x1056('0xa8')]=function(_0x22c24f){return BPromise['resolve']()[_0x1056('0xa6')](cmHopperBlack[_0x1056('0xa8')](_0x22c24f))[_0x1056('0x9e')](loggerCatch(_0x1056('0xa9')));};Dialer[_0x1056('0x1a')][_0x1056('0xaa')]=function(_0xdb9f9e){return BPromise['resolve']()[_0x1056('0xa6')](cmHopperHistory[_0x1056('0xab')](_0xdb9f9e))[_0x1056('0x9e')](loggerCatch(_0x1056('0xac')));};Dialer[_0x1056('0x1a')][_0x1056('0xad')]=function(_0x33fe6a){return BPromise[_0x1056('0xa4')]()['then'](cmHopper[_0x1056('0xad')](_0x33fe6a))[_0x1056('0x9e')](loggerCatch(_0x1056('0xae')));};Dialer[_0x1056('0x1a')]['getContactDialer']=function(_0x4c9571,_0x1c7bb6,_0x326062,_0x1e1689){return BPromise[_0x1056('0xa4')]()[_0x1056('0xa6')](cmHopper['getContactDialer'](_0x4c9571,_0x1c7bb6,_0x326062,_0x1e1689))[_0x1056('0x9e')](loggerCatch(_0x1056('0xaf')));};Dialer['prototype']['getContactDialerIvr']=function(_0x5cc0b2,_0x334a8a,_0x10a994){return BPromise[_0x1056('0xa4')]()[_0x1056('0xa6')](cmHopper[_0x1056('0xb0')](_0x5cc0b2,_0x334a8a,_0x10a994))[_0x1056('0x9e')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x1056('0x1a')][_0x1056('0xb1')]=function(_0x56c078){return BPromise['resolve']()['then'](voiceQueueRt[_0x1056('0xb1')](_0x56c078))[_0x1056('0x9e')](loggerCatch(_0x1056('0xb2')));};Dialer[_0x1056('0x1a')][_0x1056('0xb3')]=function(_0x3736ba){return BPromise[_0x1056('0xa4')]()[_0x1056('0xa6')](cmHopper[_0x1056('0xb3')](_0x3736ba))[_0x1056('0x9e')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x1056('0x1a')]['createHistory']=function(_0x293af3){return BPromise['resolve']()[_0x1056('0xa6')](cmHopperHistory[_0x1056('0xb4')](_0x293af3))[_0x1056('0x9e')](loggerCatch('[createHistory]\x20'));};Dialer[_0x1056('0x1a')][_0x1056('0xa0')]=function(_0x2912ca){if(!_[_0x1056('0x3b')](_0x2912ca)&&_0x2912ca!==null){if(_0x2912ca[_0x1056('0x99')]('originated')){if(_0x2912ca[_0x1056('0x70')]>0x0){_0x2912ca['originated']-=0x1;}else{logger[_0x1056('0x82')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x1056('0x82')](_0x1056('0xb5'));}};Dialer[_0x1056('0x1a')][_0x1056('0xb6')]=function(_0x1a5463,_0x4852ac){var _0x471677=this;return function(_0x1e8ee1){_0x471677[_0x1056('0xa0')](_0x4852ac);logger[_0x1056('0x82')](_0x1a5463,util[_0x1056('0x83')](_0x1e8ee1,{'showHidden':![],'depth':null}));};};Dialer[_0x1056('0x1a')][_0x1056('0xb7')]=function(_0x1a1495,_0x308528,_0x40edb4){var _0x4a2dee={'state':0x19,'statedesc':_0x1056('0xb8')};this[_0x1056('0xa0')](_0x308528);this['saveInDb'](_[_0x1056('0x7a')](_0x4a2dee,_['pick'](_0x40edb4,[_0x1056('0xb9'),'ListId',_0x1056('0xba'),'VoiceQueueId',_0x1056('0xbb')])),_0x1056('0xbc'),_0x1056('0xbd'));logger['error'](_0x1a1495);};Dialer[_0x1056('0x1a')]['isSuccess']=function(_0x637287){return _0x637287===_0x1056('0xbe');};Dialer[_0x1056('0x1a')]['isTrunkReachable']=function(_0x954c3e){return!_['isUndefined'](_0x954c3e)&&_0x954c3e&&!_[_0x1056('0x3b')](_0x954c3e['name'])&&!_['isUndefined'](_0x954c3e['active'])&&_0x954c3e[_0x1056('0xbf')]&&(this[_0x1056('0x23')][util['format'](_0x1056('0xc0'),_0x954c3e[_0x1056('0x3d')])][_0x1056('0x9c')]===_0x1056('0xc1')||this[_0x1056('0x23')][util[_0x1056('0x72')](_0x1056('0xc0'),_0x954c3e['name'])][_0x1056('0x9c')]===_0x1056('0xc2'));};Dialer[_0x1056('0x1a')][_0x1056('0xc3')]=function(_0x3f1ebd,_0x42605a,_0x312519){this[_0x1056('0xb4')](_0x3f1ebd)[_0x1056('0x9e')](loggerCatch(_0x42605a));this[_0x1056('0xb3')](_0x3f1ebd)[_0x1056('0x9e')](loggerCatch(_0x312519));};Dialer[_0x1056('0x1a')]['syncVarSet']=function(_0x18d9b9){var _0x18f1d7=this[_0x1056('0x27')][_0x18d9b9['uniqueid']];var _0x14e1f4;if(!_['isNil'](_0x18d9b9)&&!_[_0x1056('0x9a')](_0x18d9b9[_0x1056('0xc4')])&&!_[_0x1056('0x9a')](_0x18d9b9['variable'][_0x1056('0xc5')])&&_0x18d9b9[_0x1056('0xc6')]===_0x1056('0xc7')&&_0x18f1d7){if(_0x18f1d7['type']!==_0x1056('0x7f')&&this['voiceQueues'][_0x18f1d7[_0x1056('0xa2')]][_0x1056('0xc8')]&&_0x18d9b9[_0x1056('0xc9')]===_0x1056('0xca')){delete this[_0x1056('0x27')][_0x18d9b9[_0x1056('0xcb')]];this[_0x1056('0xa0')](this['voiceQueues'][_0x18f1d7[_0x1056('0xa2')]]);this['voiceQueues'][_0x18f1d7[_0x1056('0xa2')]][_0x1056('0x60')]+=0x1;this[_0x1056('0x20')][_0x18f1d7[_0x1056('0xa2')]]['outboundAnswerAgiCallsDay']+=0x1;_0x14e1f4=new Hangup(_0x18f1d7,_0x18d9b9);_0x14e1f4[_0x1056('0x93')]=0x12;_0x14e1f4['statedesc']=_0x1056('0xcc');_0x14e1f4[_0x1056('0xcd')]='AMD';this[_0x1056('0xc3')](_0x14e1f4,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0x18f1d7['type']!==_0x1056('0x7f')&&this[_0x1056('0x20')][_0x18f1d7[_0x1056('0xa2')]][_0x1056('0xc8')]&&_0x18d9b9[_0x1056('0xc9')]===_0x1056('0xce')){delete this[_0x1056('0x27')][_0x18d9b9[_0x1056('0xcb')]];this[_0x1056('0xa0')](this[_0x1056('0x20')][_0x18f1d7[_0x1056('0xa2')]]);this[_0x1056('0x20')][_0x18f1d7[_0x1056('0xa2')]][_0x1056('0x60')]+=0x1;this[_0x1056('0x20')][_0x18f1d7[_0x1056('0xa2')]]['outboundAnswerAgiCallsDay']+=0x1;_0x14e1f4=new Hangup(_0x18f1d7,_0x18d9b9);_0x14e1f4['state']=0x13;_0x14e1f4[_0x1056('0x94')]=_0x1056('0xcf');_0x14e1f4['membername']=_0x1056('0xd0');_0x14e1f4['amd']=!![];this['saveInDb'](_0x14e1f4,'[syncMachine][createHistory]',_0x1056('0xd1'));}if(_0x18f1d7['type']===_0x1056('0x7f')&&this[_0x1056('0x21')][_0x18f1d7[_0x1056('0xa2')]]['dialAMDActive']&&_0x18d9b9[_0x1056('0xc9')]===_0x1056('0xca')){delete this[_0x1056('0x27')][_0x18d9b9['uniqueid']];this[_0x1056('0xa0')](this[_0x1056('0x21')][_0x18f1d7['queue']]);_0x14e1f4=new Hangup(_0x18f1d7,_0x18d9b9);_0x14e1f4['state']=0x12;_0x14e1f4[_0x1056('0x94')]=_0x1056('0xcc');_0x14e1f4[_0x1056('0xcd')]=_0x1056('0xd0');this[_0x1056('0xc3')](_0x14e1f4,_0x1056('0xd2'),_0x1056('0xd3'));}if(_0x18f1d7[_0x1056('0x4c')]===_0x1056('0x7f')&&this[_0x1056('0x21')][_0x18f1d7[_0x1056('0xa2')]][_0x1056('0xc8')]&&_0x18d9b9[_0x1056('0xc9')]==='MACHINE'){delete this[_0x1056('0x27')][_0x18d9b9[_0x1056('0xcb')]];this['updateOriginated'](this[_0x1056('0x21')][_0x18f1d7['queue']]);_0x14e1f4=new Hangup(_0x18f1d7,_0x18d9b9);_0x14e1f4[_0x1056('0x93')]=0x13;_0x14e1f4['statedesc']=_0x1056('0xcf');_0x14e1f4[_0x1056('0xcd')]=_0x1056('0xd0');_0x14e1f4['amd']=!![];this[_0x1056('0xc3')](_0x14e1f4,'[syncMachineIvr][createHistory]',_0x1056('0xd4'));}}};Dialer[_0x1056('0x1a')][_0x1056('0xd5')]=function(_0x129781){var _0x464866=this[_0x1056('0x27')][_0x129781[_0x1056('0xcb')]];var _0x2783ef=this;var _0x4a0088;if(_0x464866&&_0x464866[_0x1056('0x4c')]===_0x1056('0x7f')){delete this[_0x1056('0x27')][_0x129781[_0x1056('0xcb')]];this['updateOriginated'](this[_0x1056('0x21')][_0x464866[_0x1056('0xa2')]]);this[_0x1056('0x21')][_0x464866[_0x1056('0xa2')]][_0x1056('0xd6')]+=0x1;_0x4a0088=new Hangup(_0x464866,_0x129781);this[_0x1056('0xb4')](_0x4a0088)[_0x1056('0x9e')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x1056('0xb3')](_0x4a0088)['catch'](loggerCatch(_0x1056('0xd7')));}if(_0x464866&&_0x464866['type']!==_0x1056('0x7f')&&isNotNull(this['voiceQueues'][_0x464866[_0x1056('0xa2')]][_0x1056('0xd8')])){delete this[_0x1056('0x27')][_0x129781['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0x464866[_0x1056('0xa2')]]);this['voiceQueues'][_0x464866['queue']]['outboundAnswerCallsDay']+=0x1;this[_0x1056('0x20')][_0x464866[_0x1056('0xa2')]][_0x1056('0x5f')]+=0x1;_0x4a0088=new Hangup(_0x464866,_0x129781);_0x4a0088[_0x1056('0x93')]=0x10;_0x4a0088[_0x1056('0x94')]='AnswerAGI';_0x4a0088[_0x1056('0xcd')]=_0x1056('0xd9');this[_0x1056('0xb4')](_0x4a0088)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x4a0088)[_0x1056('0x9e')](loggerCatch('[syncHangupIvr]'));}if(_0x464866&&_0x464866[_0x1056('0x4c')]!==_0x1056('0x7f')&&!isNotNull(this[_0x1056('0x20')][_0x464866[_0x1056('0xa2')]]['dialQueueProject'])){delete this[_0x1056('0x27')][_0x129781[_0x1056('0xcb')]];this[_0x1056('0xa0')](this['voiceQueues'][_0x464866[_0x1056('0xa2')]]);this[_0x1056('0x20')][_0x464866['queue']][_0x1056('0x67')]+=0x1;_0x4a0088=new Hangup(_0x464866,_0x129781);_0x4a0088[_0x1056('0x93')]=0xc;_0x4a0088[_0x1056('0x94')]=_0x129781[_0x1056('0xda')];_0x4a0088['membername']=_0x1056('0xdb');this[_0x1056('0xb4')](_0x4a0088)[_0x1056('0x9e')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x1056('0xb3')](_0x4a0088)[_0x1056('0x9e')](loggerCatch(_0x1056('0xd7')));}};Dialer[_0x1056('0x1a')][_0x1056('0x34')]=function(_0x51038b){var _0x4d8fd5=this['uniqueId'][_0x51038b[_0x1056('0xcb')]];var _0x25182c=this;if(this[_0x1056('0x20')][_0x51038b[_0x1056('0xa2')]]){if(_0x4d8fd5&&_0x4d8fd5[_0x1056('0x4c')]!=='ivr'){delete this[_0x1056('0x27')][_0x51038b[_0x1056('0xcb')]];this[_0x1056('0x20')][_0x51038b[_0x1056('0xa2')]][_0x1056('0x60')]+=0x1;var _0x584573=new AgentComplete(_0x4d8fd5,_0x51038b);if(_0x51038b[_0x1056('0xdc')]===_0x1056('0xdd')){_0x584573[_0x1056('0xde')]=this[_0x1056('0x20')][_0x51038b[_0x1056('0xa2')]]['dialQueueProject2']&&this['voiceQueues'][_0x51038b[_0x1056('0xa2')]][_0x1056('0xdf')]?moment()['format'](_0x1056('0xe0')):undefined;}this[_0x1056('0xb4')](_0x584573)['catch'](loggerCatch(_0x1056('0xe1')));this[_0x1056('0xb3')](_0x584573)[_0x1056('0x9e')](loggerCatch(_0x1056('0xe2')));}}};Dialer[_0x1056('0x1a')][_0x1056('0x2d')]=function(_0x50eddb){if(this[_0x1056('0x20')][_0x50eddb[_0x1056('0xa2')]]){if(this[_0x1056('0x27')][_0x50eddb[_0x1056('0xcb')]]&&this[_0x1056('0x27')][_0x50eddb[_0x1056('0xcb')]]['type']!==_0x1056('0x7f')){this[_0x1056('0xa0')](this[_0x1056('0x20')][_0x50eddb[_0x1056('0xa2')]]);this[_0x1056('0x27')][_0x50eddb[_0x1056('0xcb')]][_0x1056('0xe3')]=moment()['format'](_0x1056('0xe0'));}}};Dialer[_0x1056('0x1a')][_0x1056('0xe4')]=function(_0x5ec905){this['createHistory'](_0x5ec905)[_0x1056('0x9e')](loggerCatch(_0x1056('0xe1')));this[_0x1056('0xb3')](_0x5ec905)[_0x1056('0x9e')](loggerCatch(_0x1056('0xe5')));};Dialer[_0x1056('0x1a')]['syncQueueCallerAbandon']=function(_0x173bd9){var _0x284a1b=this[_0x1056('0x27')][_0x173bd9[_0x1056('0xcb')]];var _0x21f5b1=this;if(this[_0x1056('0x20')][_0x173bd9[_0x1056('0xa2')]]){if(_0x284a1b&&_0x284a1b[_0x1056('0x4c')]!==_0x1056('0x7f')){delete this['uniqueId'][_0x173bd9[_0x1056('0xcb')]];this[_0x1056('0xa0')](this[_0x1056('0x20')][_0x173bd9[_0x1056('0xa2')]]);_0x284a1b[_0x1056('0xe6')]=moment()[_0x1056('0x72')](_0x1056('0xe0'));var _0x4f9f67=new QueueCallerAbandon(_0x284a1b,_0x173bd9);if(getSeconds(_0x284a1b[_0x1056('0xe6')],_0x284a1b[_0x1056('0xe7')])>=_0x284a1b['dialQueueTimeout']){this[_0x1056('0x20')][_0x173bd9[_0x1056('0xa2')]][_0x1056('0x6a')]+=0x1;this['voiceQueues'][_0x173bd9[_0x1056('0xa2')]][_0x1056('0x63')]+=0x1;this[_0x1056('0x20')][_0x173bd9['queue']][_0x1056('0xe8')]+=0x1;_0x4f9f67[_0x1056('0x93')]=0xa;_0x4f9f67[_0x1056('0x94')]=_0x1056('0xe9');_0x4f9f67['dropreason']=_0x1056('0xea');_0x4f9f67['agiafterat']=this[_0x1056('0x20')][_0x173bd9[_0x1056('0xa2')]][_0x1056('0xeb')]?moment()[_0x1056('0x72')](_0x1056('0xe0')):undefined;this['queueCallerAbandonCreateState'](_0x4f9f67);}else{this[_0x1056('0x20')][_0x173bd9[_0x1056('0xa2')]][_0x1056('0xec')]+=0x1;this['voiceQueues'][_0x173bd9[_0x1056('0xa2')]][_0x1056('0x62')]+=0x1;_0x4f9f67[_0x1056('0x93')]=0xb;_0x4f9f67[_0x1056('0x94')]=_0x1056('0xed');_0x4f9f67[_0x1056('0xee')]=_0x1056('0xef');this[_0x1056('0xe4')](_0x4f9f67);}}}};Dialer[_0x1056('0x1a')]['syncNewExten']=function(_0x413326){if(this[_0x1056('0x25')][_0x413326[_0x1056('0xcb')]]){this['actions'][_0x413326[_0x1056('0xcb')]][_0x1056('0x9d')]=_0x413326[_0x1056('0x9d')];}if(this[_0x1056('0x27')][_0x413326[_0x1056('0xcb')]]){this[_0x1056('0x27')][_0x413326[_0x1056('0xcb')]][_0x1056('0x9d')]=_0x413326[_0x1056('0x9d')];}};Dialer['prototype'][_0x1056('0xf0')]=function(_0x4ab6ee){if(strategy[this['voiceQueues'][this[_0x1056('0x25')][_0x4ab6ee[_0x1056('0xf1')]][_0x1056('0xa2')]][_0x1056('0x4e')]]==='roundrobin'){if(this[_0x1056('0x25')][_0x4ab6ee[_0x1056('0xf1')]]&&_[_0x1056('0x9a')](this[_0x1056('0x25')][_0x4ab6ee[_0x1056('0xf1')]][_0x1056('0xf2')])&&_0x4ab6ee[_0x1056('0x9c')]==='1'&&_0x4ab6ee['paused']==='0'){if(this[_0x1056('0x22')][_0x4ab6ee[_0x1056('0xf3')]]){if(!this[_0x1056('0x22')][_0x4ab6ee[_0x1056('0xf3')]][_0x1056('0xf2')]){this[_0x1056('0x22')][_0x4ab6ee[_0x1056('0xf3')]][_0x1056('0xf2')]=!![];this[_0x1056('0x25')][_0x4ab6ee[_0x1056('0xf1')]][_0x1056('0xf2')]=!![];this[_0x1056('0x25')][_0x4ab6ee[_0x1056('0xf1')]][_0x1056('0xf3')]=_0x4ab6ee['stateinterface'];}}}}else if((strategy[this[_0x1056('0x20')][this[_0x1056('0x25')][_0x4ab6ee['actionid']][_0x1056('0xa2')]][_0x1056('0x4e')]]||'rrmemory')===_0x1056('0x18')){if(this['actions'][_0x4ab6ee[_0x1056('0xf1')]]){if(this['agents'][_0x4ab6ee[_0x1056('0xf3')]]){this['actions'][_0x4ab6ee[_0x1056('0xf1')]]['stateinterface']=_0x4ab6ee[_0x1056('0xf3')];if(_[_0x1056('0x9a')](this[_0x1056('0xf4')][this[_0x1056('0x25')][_0x4ab6ee[_0x1056('0xf1')]][_0x1056('0xa2')]])){this[_0x1056('0xf4')][this['actions'][_0x4ab6ee[_0x1056('0xf1')]][_0x1056('0xa2')]]=[];}this[_0x1056('0xf4')][this[_0x1056('0x25')][_0x4ab6ee[_0x1056('0xf1')]][_0x1056('0xa2')]]['push'](_['merge'](_[_0x1056('0xf5')](this[_0x1056('0x25')][_0x4ab6ee[_0x1056('0xf1')]],['idHopper',_0x1056('0xf3')]),{'status':_0x4ab6ee[_0x1056('0x9c')],'paused':_0x4ab6ee['paused']}));}}}};function unlockQueueStatus(_0x47e9c9,_0x282ae6){setTimeout(function(){if(_[_0x1056('0x3b')](_0x47e9c9['queueStatusComplete'])){loggerBooked[_0x1056('0x82')](_0x1056('0xf6'),_0x282ae6);}_0x47e9c9[_0x1056('0xf7')]=!![];loggerBooked[_0x1056('0x75')]('[booked][unlockQueueStatus]',_0x282ae6,JSON[_0x1056('0x48')](_['pick'](_0x47e9c9,[_0x1056('0x3d'),_0x1056('0xf7')])));},0x1f3);}Dialer['prototype'][_0x1056('0xf8')]=function(_0x3eeddb){var _0x1e7629=this;var _0x2e8528=_0x1e7629[_0x1056('0x20')][_0x1e7629[_0x1056('0x25')][_0x3eeddb[_0x1056('0xf1')]]['queue']];if(strategy[this[_0x1056('0x20')][this[_0x1056('0x25')][_0x3eeddb['actionid']][_0x1056('0xa2')]][_0x1056('0x4e')]]===_0x1056('0x19')){if(this['actions'][_0x3eeddb[_0x1056('0xf1')]]&&this[_0x1056('0x25')][_0x3eeddb[_0x1056('0xf1')]][_0x1056('0xf3')]){this['preview'][_0x1056('0xf9')](this[_0x1056('0x25')][_0x3eeddb['actionid']][_0x1056('0xfa')],this['actions'][_0x3eeddb[_0x1056('0xf1')]][_0x1056('0xf3')])['catch'](function(_0x3dd9d9){logger[_0x1056('0x82')](_0x1056('0xfb'),util[_0x1056('0x83')](_0x3dd9d9,{'showHidden':![],'depth':null}));})[_0x1056('0x1d')](function(){_0x1e7629[_0x1056('0xa0')](_0x1e7629[_0x1056('0x20')][_0x1e7629[_0x1056('0x25')][_0x3eeddb[_0x1056('0xf1')]]['queue']]);_0x1e7629[_0x1056('0x22')][_0x1e7629['actions'][_0x3eeddb[_0x1056('0xf1')]][_0x1056('0xf3')]]['locked']=![];delete _0x1e7629[_0x1056('0x25')][_0x3eeddb[_0x1056('0xf1')]];unlockQueueStatus(_0x2e8528);});}else{this['updateOriginated'](this[_0x1056('0x20')][this['actions'][_0x3eeddb['actionid']][_0x1056('0xa2')]]);this[_0x1056('0xad')]({'active':![],'ContactId':this[_0x1056('0x25')][_0x3eeddb[_0x1056('0xf1')]][_0x1056('0xb9')],'ListId':this[_0x1056('0x25')][_0x3eeddb[_0x1056('0xf1')]][_0x1056('0xfc')],'VoiceQueueId':this[_0x1056('0x25')][_0x3eeddb[_0x1056('0xf1')]][_0x1056('0xfd')]||undefined,'CampaignId':this[_0x1056('0x25')][_0x3eeddb[_0x1056('0xf1')]][_0x1056('0xbb')]||undefined})[_0x1056('0x9e')](loggerCatch(_0x1056('0xfe')));delete this[_0x1056('0x25')][_0x3eeddb[_0x1056('0xf1')]];unlockQueueStatus(_0x2e8528);}}else if((strategy[this['voiceQueues'][this[_0x1056('0x25')][_0x3eeddb['actionid']][_0x1056('0xa2')]]['strategy']]||_0x1056('0x18'))==='rrmemory'){var _0x360938;if(this[_0x1056('0x25')][_0x3eeddb[_0x1056('0xf1')]]&&!_[_0x1056('0x45')](this[_0x1056('0xf4')][this[_0x1056('0x25')][_0x3eeddb[_0x1056('0xf1')]][_0x1056('0xa2')]])){if(this[_0x1056('0x2b')][_0x1e7629['actions'][_0x3eeddb[_0x1056('0xf1')]][_0x1056('0xa2')]]){this[_0x1056('0x2b')][_0x1e7629['actions'][_0x3eeddb[_0x1056('0xf1')]]['queue']]=this['queueBookedRR'][this[_0x1056('0x25')][_0x3eeddb[_0x1056('0xf1')]][_0x1056('0xa2')]]?this['queueBookedRR'][this[_0x1056('0x25')][_0x3eeddb[_0x1056('0xf1')]][_0x1056('0xa2')]]:this['queueBooked'][this[_0x1056('0x25')][_0x3eeddb[_0x1056('0xf1')]][_0x1056('0xa2')]]?this[_0x1056('0xf4')][this[_0x1056('0x25')][_0x3eeddb[_0x1056('0xf1')]]['queue']][_0x1056('0xff')]||0x0:0x0;}this[_0x1056('0xf4')][this[_0x1056('0x25')][_0x3eeddb['actionid']]['queue']][_0x1056('0xff')]=this[_0x1056('0x2b')][this[_0x1056('0x25')][_0x3eeddb[_0x1056('0xf1')]][_0x1056('0xa2')]];for(var _0x288a8d=0x0;_0x288a8d=0x0?!![]:![];})[_0x1056('0x9e')](myreject(_0x80771a)));}}else{_0x54257d[_0x1056('0x113')](ami['Action']({'action':_0x1056('0x114'),'command':util[_0x1056('0x72')](_0x1056('0x115'),_0x37951b,!_[_0x1056('0x3b')](config[_0x1056('0x10f')][_0x242394])?_0x242394:'')})[_0x1056('0xa6')](function(_0x59ac07){return _0x59ac07[_0x1056('0x116')][_0x1056('0x117')](_0x1056('0x118'))>=0x0?!![]:![];})['catch'](myreject(_0x80771a)));}BPromise[_0x1056('0x119')](_0x54257d)[_0x1056('0xa6')](function(_0x5ddbfc){var _0xfe2e2e=_[_0x1056('0x11a')](_0x5ddbfc);if(_0xfe2e2e){return _0x5706c2(_0xfe2e2e);}else{_0x1b6316[_0x1056('0x3c')]=_0x32d7e9?_0x1056('0x11b'):_0x1056('0x11c');return _0x80771a(msgResponse(_0x1056('0x11d'),_0x1056('0x10d'),'Global:\x20'+_0x32d7e9+'\x20'+_0x19dd9f+_0x1056('0x11e')+util[_0x1056('0x83')](_0x37951b,{'showHidden':![],'depth':null})+_0x1056('0x11f')+_0x242394));}})[_0x1056('0x9e')](function(_0xda441f){return _0x80771a(msgResponse(_0x1056('0x10b'),_0x1056('0x10d'),JSON['stringify'](_0xda441f)));});});};Dialer['prototype']['checkDialMethod']=function(_0x647446){var _0x263e96=this;return function(){switch(_0x647446[_0x1056('0x5a')]){case _0x1056('0x120'):freeVariablesPredictive(_0x647446);_0x263e96[_0x1056('0x121')](_0x647446,0x1);break;case _0x1056('0x122'):freeVariablesPredictive(_0x647446);_0x263e96[_0x1056('0x121')](_0x647446,_0x647446[_0x1056('0x123')]);break;case _0x1056('0x8'):_0x263e96[_0x1056('0x8')](_0x647446);break;case _0x1056('0x7'):freeVariablesPredictive(_0x647446);_0x263e96[_0x1056('0x121')](_0x647446,0x1);break;default:freeVariablesPredictive(_0x647446);logger[_0x1056('0x82')]('Queue',_0x647446['name'],_0x1056('0x124'));}};};Dialer['prototype'][_0x1056('0x125')]=function(_0x4bfe89){var _0x5ade62=this;return function(){_0x5ade62[_0x1056('0x126')](_0x4bfe89);};};Dialer[_0x1056('0x1a')][_0x1056('0xa')]=function(_0x2b8bc6){var _0x388aaf=this;if(isNotPreview(_0x2b8bc6[_0x1056('0x5a')])){if(isVoiceQueueOutbound(_0x2b8bc6[_0x1056('0x4c')])&&isActive(_0x2b8bc6[_0x1056('0x59')])){_0x2b8bc6[_0x1056('0x8b')]=!![];BPromise[_0x1056('0xa4')]()[_0x1056('0xa6')](checkIsLoggedIn(_0x2b8bc6,_0x2b8bc6[_0x1056('0x50')]))[_0x1056('0xa6')](checkIsActive(_0x2b8bc6,_0x2b8bc6[_0x1056('0x59')]))[_0x1056('0xa6')](checkInterval(_0x2b8bc6))[_0x1056('0xa6')](_0x388aaf['checkIsTrunkReachable'](_0x2b8bc6))['then'](_0x388aaf[_0x1056('0x127')](_0x2b8bc6[_0x1056('0x128')],_0x2b8bc6[_0x1056('0x129')],_0x2b8bc6[_0x1056('0x3d')],_0x2b8bc6))[_0x1056('0xa6')](_0x388aaf[_0x1056('0x10c')](_0x2b8bc6[_0x1056('0x41')],_0x2b8bc6[_0x1056('0x129')],_0x2b8bc6[_0x1056('0x3d')],_0x2b8bc6))[_0x1056('0xa6')](_0x388aaf[_0x1056('0x12a')](_0x2b8bc6))['catch'](loggerCatchQueueSummary('[syncQueueSummary]',_0x2b8bc6));}else{notSendMessagesQueue(_0x2b8bc6);}}else{freeVariablesPredictive(_0x2b8bc6);}};Dialer[_0x1056('0x1a')]['syncCampaigns']=function(){var _0x269390=this;var _0x4c23c2;for(var _0x2be464 in this[_0x1056('0x21')]){if(this[_0x1056('0x21')][_0x1056('0x99')](_0x2be464)){_0x4c23c2=this['campaigns'][_0x2be464];if(isCampaignIvr(_0x4c23c2[_0x1056('0x4c')])&&isActive(_0x4c23c2[_0x1056('0xbf')])){_0x4c23c2[_0x1056('0x8b')]=!![];BPromise['resolve']()['then'](checkIsActive(_0x4c23c2,_0x4c23c2['active']))[_0x1056('0xa6')](checkInterval(_0x4c23c2))[_0x1056('0xa6')](_0x269390[_0x1056('0x12b')](_0x4c23c2))[_0x1056('0xa6')](_0x269390['checkIfTime'](_0x4c23c2[_0x1056('0x128')],_0x4c23c2[_0x1056('0x129')],_0x4c23c2[_0x1056('0x3d')],_0x4c23c2))[_0x1056('0xa6')](_0x269390[_0x1056('0x10c')](_0x4c23c2[_0x1056('0x41')],_0x4c23c2[_0x1056('0x129')],_0x4c23c2[_0x1056('0x3d')],_0x4c23c2))['then'](_0x269390['launchHandleIvr'](_0x4c23c2))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x4c23c2));}else{notSendMessagesCampaign(_0x4c23c2);}}}};function getCallerIdRandom(_0x280ef2,_0x46f882){var _0x12d457,_0x3d2fe8,_0x93581d;if(_0x46f882<=0x0){_0x46f882=0x1;}_0x12d457=new RegExp('\x5cw{0,'+_0x46f882+'}$');_0x3d2fe8=Math[_0x1056('0x12c')](0xa,_0x46f882-0x1);_0x93581d=Math[_0x1056('0x12c')](0xa,_0x46f882)-0x1;return util[_0x1056('0x72')]('%s',_['replace'](_0x280ef2,_0x12d457,_[_0x1056('0x12d')](_0x3d2fe8,_0x93581d)));}function extractCalleridName(_0xa2eb1f){var _0x4714ff=_0xa2eb1f[_0x1056('0x12e')](/"(.*?)"/);return _0x4714ff?_0x4714ff[0x1]:_0xa2eb1f;}function extractCalleridNumber(_0x1fc58a){var _0x3f720c=_0x1fc58a[_0x1056('0x12e')](/<(.*?)>/);return _0x3f720c?_0x3f720c[0x1]:_0x1fc58a;}Dialer[_0x1056('0x1a')]['actionOriginate']=function(_0x382b5e,_0x2bd910){var _0x11ea2a=this;var _0x2be213=uuid['v4']();this[_0x1056('0x25')][_0x2be213]=new Action(_0x382b5e,_0x2bd910,_0x2be213);return new BPromise(function(_0xae20df,_0x15fd5e){if(_[_0x1056('0x3b')](_0x382b5e)&&_0x1056('0x12f')!==typeof _0x382b5e){return _0x15fd5e(msgResponse(_0x1056('0x130'),_0x1056('0x10d'),_0x1056('0x131')));}if(_[_0x1056('0x3b')](_0x2bd910[_0x1056('0x132')][_0x1056('0x133')])||_0x2bd910[_0x1056('0x132')]['phone']===null){return _0x15fd5e(msgResponse('originate','Failure',_0x1056('0x134')));}var _0x398632={'XMD-CALLERID':_0x11ea2a[_0x1056('0x25')][_0x2be213]['getCaller'](),'XMD-AGI':_0x382b5e['dialQueueProject']?util['format'](_0x1056('0x135'),ipAgi,_0x382b5e[_0x1056('0xd8')]):_0x1056('0x136'),'XMD-AGIAFTER':_0x382b5e[_0x1056('0xeb')]?util['format'](_0x1056('0x135'),ipAgi,_0x382b5e[_0x1056('0xeb')]):_0x1056('0x136'),'XMD-QUEUE':_0x382b5e[_0x1056('0x4c')]===_0x1056('0x4d')?util[_0x1056('0x72')](_0x1056('0x137'),_0x382b5e[_0x1056('0x3d')],_0x382b5e[_0x1056('0x138')]||'',_0x382b5e[_0x1056('0xdf')]?'c':'',_0x382b5e['dialQueueTimeout']||0x3):_0x1056('0x136'),'XMD-CONTACTID':_0x2bd910[_0x1056('0xb9')],'XMD-CDRTYPE':_0x1056('0x139'),'CALLERID(all)':_0x11ea2a[_0x1056('0x25')][_0x2be213]['getCaller'](),'XMD-AMD':_0x382b5e[_0x1056('0xc8')]?_0x1056('0x13a'):_0x1056('0x136'),'XMD-DESTINATION':_0x1056('0xc7')};if(_0x382b5e[_0x1056('0xc8')]){_0x398632[_0x1056('0x13b')]=_0x382b5e[_0x1056('0x13c')]||0x9c4;_0x398632['XMD-AMDGREETING']=_0x382b5e[_0x1056('0x13d')]||0x5dc;_0x398632[_0x1056('0x13e')]=_0x382b5e[_0x1056('0x13f')]||0x320;_0x398632[_0x1056('0x140')]=_0x382b5e[_0x1056('0x141')]||0x1388;_0x398632[_0x1056('0x142')]=_0x382b5e[_0x1056('0x143')]||0x64;_0x398632['XMD-AMDBETWEENWORDSSILENCE']=_0x382b5e[_0x1056('0x144')]||0x32;_0x398632[_0x1056('0x145')]=_0x382b5e[_0x1056('0x146')]||0x3;_0x398632['XMD-AMDSILENCETHRESHOLD']=_0x382b5e[_0x1056('0x147')]||0x100;_0x398632['XMD-AMDMAXIMUMWORDLENGTH']=_0x382b5e[_0x1056('0x148')]||0x1388;}if(_0x382b5e[_0x1056('0x4c')]===_0x1056('0x4d')){_0x398632[_0x1056('0x149')]=_0x2bd910[_0x1056('0xfd')];}else{_0x398632['XMD-CAMPAIGNID']=_0x2bd910[_0x1056('0xbb')];}for(var _0x3694d1 in _0x2bd910[_0x1056('0x132')]){if(_0x2bd910[_0x1056('0x132')][_0x1056('0x99')](_0x3694d1)){if(isNotNull(_0x2bd910[_0x1056('0x132')][_0x3694d1])&&_0x3694d1!=='id'&&_0x3694d1!==_0x1056('0x14a')&&_0x3694d1!==_0x1056('0x14b')&&_0x3694d1!=='updatedAt'){_0x398632[util['format']('%s%s',_0x1056('0x14c'),_[_0x1056('0x14d')](_0x3694d1))]=_0x2bd910['Contact'][_0x3694d1];}}}var _0x4766fa=_0x11ea2a[_0x1056('0x109')](_0x382b5e[_0x1056('0x71')])?getCallerId(_0x382b5e[_0x1056('0x71')]['callerid'],_0x382b5e['dialOriginateCallerIdName'],_0x382b5e[_0x1056('0x14e')]>0x0?getCallerIdRandom(_0x382b5e[_0x1056('0x5c')],_0x382b5e['dialRandomLastDigitCallerIdNumber']):_0x382b5e[_0x1056('0x5c')]):getCallerId(_[_0x1056('0x9a')](_0x382b5e[_0x1056('0x14f')])?_0x382b5e['Trunk'][_0x1056('0x150')]:_0x382b5e[_0x1056('0x14f')]['callerid'],_0x382b5e[_0x1056('0x5b')],_0x382b5e[_0x1056('0x14e')]>0x0?getCallerIdRandom(_0x382b5e[_0x1056('0x5c')],_0x382b5e[_0x1056('0x14e')]):_0x382b5e['dialOriginateCallerIdNumber']);if(_0x4766fa){_0x398632['XMD-ORIGINATECALLERIDNAME']=_0x11ea2a[_0x1056('0x25')][_0x2be213][_0x1056('0x151')]=extractCalleridName(_0x4766fa);_0x398632[_0x1056('0x152')]=_0x11ea2a[_0x1056('0x25')][_0x2be213]['originatecalleridnum']=extractCalleridNumber(_0x4766fa);}return ami[_0x1056('0x9b')]({'actionid':_0x2be213,'action':_0x1056('0x130'),'channel':_0x11ea2a[_0x1056('0x109')](_0x382b5e[_0x1056('0x71')])?util[_0x1056('0x72')](_0x1056('0x153'),_0x382b5e[_0x1056('0x71')][_0x1056('0x3d')],isNotNull(_0x382b5e[_0x1056('0x5e')])?_0x382b5e[_0x1056('0x5e')]['trim']()||'':'',_0x382b5e[_0x1056('0x154')]>0x0?_0x2bd910[_0x1056('0x132')][_0x1056('0x133')][_0x1056('0x155')](_0x382b5e[_0x1056('0x154')]):_0x2bd910[_0x1056('0x132')][_0x1056('0x133')]):util[_0x1056('0x72')](_0x1056('0x153'),_[_0x1056('0x9a')](_0x382b5e[_0x1056('0x14f')])?_0x382b5e[_0x1056('0x71')][_0x1056('0x3d')]:_0x382b5e[_0x1056('0x14f')][_0x1056('0x3d')],isNotNull(_0x382b5e[_0x1056('0x5e')])?_0x382b5e[_0x1056('0x5e')][_0x1056('0x156')]()||'':'',_0x382b5e[_0x1056('0x154')]>0x0?_0x2bd910[_0x1056('0x132')][_0x1056('0x133')]['substring'](_0x382b5e[_0x1056('0x154')]):_0x2bd910[_0x1056('0x132')][_0x1056('0x133')]),'callerid':_0x4766fa,'Exten':_0x1056('0xc7'),'Context':'from-sip','Priority':'1','variable':_0x398632,'timeout':(_0x382b5e['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x2be213})[_0x1056('0xa6')](function(_0x6003a8){return _0xae20df(_0x6003a8);})[_0x1056('0x9e')](function(_0x3fdc4b){_0x382b5e[_0x1056('0x157')]+=0x1;var _0x276337=new History(_0x11ea2a[_0x1056('0x25')][_0x2be213]);logger['error'](util[_0x1056('0x72')](_0x1056('0x158'),JSON[_0x1056('0x48')](_0x3fdc4b)));_0x276337[_0x1056('0x93')]=0xe;_0x276337[_0x1056('0x94')]='OriginateError';_0x276337[_0x1056('0x95')]=moment()[_0x1056('0x72')]('YYYY-MM-DD\x20HH:mm:ss');_0x276337[_0x1056('0x159')]=_0x276337[_0x1056('0x95')];_0x11ea2a['createHistory'](_0x276337)[_0x1056('0x9e')](loggerCatch(_0x1056('0x15a')));_0x11ea2a[_0x1056('0xb3')](_0x276337)[_0x1056('0x9e')](loggerCatch(_0x1056('0x15a')))[_0x1056('0x1d')](function(){delete _0x11ea2a['actions'][_0x2be213];return _0x15fd5e(msgResponse('originate',_0x1056('0x47'),_0x1056('0x15b')));});});});};Dialer[_0x1056('0x1a')][_0x1056('0x32')]=function(_0x4f1ffa){var _0x1daa58=this['actions'][_0x4f1ffa[_0x1056('0xf1')]];var _0x1eecec=this;if(_0x1daa58){delete this['actions'][_0x4f1ffa['actionid']];_0x1daa58[_0x1056('0xe7')]=moment()[_0x1056('0x72')](_0x1056('0xe0'));var _0x377d47=_0x1daa58['type']===_0x1056('0x7f')?this['campaigns'][_0x1daa58[_0x1056('0xa2')]]:this['voiceQueues'][_0x1daa58['getQueue']()];if(!this[_0x1056('0x15c')](_0x4f1ffa[_0x1056('0x15d')])){this[_0x1056('0xa0')](_0x377d47);return this[_0x1056('0x15e')](_0x1daa58,_0x377d47,_0x4f1ffa)['then'](function(_0x5e38fe){})[_0x1056('0x9e')](loggerCatch(_0x1056('0x15f')));}else{this[_0x1056('0x27')][_0x4f1ffa[_0x1056('0xcb')]]=_0x1daa58;}}};Dialer['prototype']['checkRetriveMax']=function(_0x288aec,_0x6e1d19,_0x12a160){var _0x453606=new History(_0x6e1d19);if(_0x453606[_0x1056('0x160')]+_0x453606[_0x1056('0x161')]+_0x453606[_0x1056('0x162')]>=_0x12a160[_0x1056('0x163')]-0x1){return!![];}switch(_0x288aec){case 0x3:if(_0x453606[_0x1056('0x162')]>=_0x12a160[_0x1056('0x164')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnoanswerretry':_0x453606[_0x1056('0x162')]+=0x1,'scheduledat':moment()[_0x1056('0x165')](_0x12a160[_0x1056('0x166')],'minutes')[_0x1056('0x72')](_0x1056('0xe0')),'ContactId':_0x453606[_0x1056('0xb9')],'ListId':_0x453606[_0x1056('0xfc')],'VoiceQueueId':_0x453606[_0x1056('0xfd')]||undefined,'CampaignId':_0x453606['CampaignId']||undefined})[_0x1056('0x9e')](loggerCatch(_0x1056('0x167')));}break;case 0x5:if(_0x453606[_0x1056('0x160')]>=_0x12a160[_0x1056('0x168')]-0x1){return!![];}else{this[_0x1056('0xad')]({'active':![],'countbusyretry':_0x453606['countbusyretry']+=0x1,'scheduledat':moment()[_0x1056('0x165')](_0x12a160[_0x1056('0x169')],'minutes')[_0x1056('0x72')](_0x1056('0xe0')),'ContactId':_0x453606[_0x1056('0xb9')],'ListId':_0x453606['ListId'],'VoiceQueueId':_0x453606['VoiceQueueId']||undefined,'CampaignId':_0x453606[_0x1056('0xbb')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));}break;case 0x8:if(_0x453606[_0x1056('0x161')]>=_0x12a160[_0x1056('0x16a')]-0x1){return!![];}else{this[_0x1056('0xad')]({'active':![],'countcongestionretry':_0x453606[_0x1056('0x161')]+=0x1,'scheduledat':moment()[_0x1056('0x165')](_0x12a160[_0x1056('0x16b')],_0x1056('0x16c'))[_0x1056('0x72')](_0x1056('0xe0')),'ContactId':_0x453606[_0x1056('0xb9')],'ListId':_0x453606[_0x1056('0xfc')],'VoiceQueueId':_0x453606['VoiceQueueId']||undefined,'CampaignId':_0x453606[_0x1056('0xbb')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));}break;default:return!![];}};Dialer[_0x1056('0x1a')][_0x1056('0x15e')]=function(_0x4844db,_0x2c3b03,_0x2c6486){var _0x5d096c=this;var _0x59d205=new History(_0x4844db);return new BPromise(function(_0x4bf88c,_0x4baadd){if(_[_0x1056('0x3b')](_0x2c3b03)&&_0x1056('0x12f')!==typeof _0x2c3b03){return _0x4baadd(msgResponse(_0x1056('0x16d'),_0x1056('0x10d'),_0x1056('0x16e')));}if(_[_0x1056('0x3b')](_0x2c6486)&&_0x1056('0x12f')!==typeof _0x2c6486){return _0x4baadd(msgResponse(_0x1056('0x16d'),_0x1056('0x10d'),'evt\x20is\x20undefine'));}switch(_0x2c6486[_0x1056('0xdc')]){case'0':_0x2c3b03['outboundNoSuchCallsDay']+=0x1;_0x59d205[_0x1056('0x93')]=0x0;_0x59d205['statedesc']=_0x1056('0x16f');_0x5d096c[_0x1056('0xb4')](_0x59d205)[_0x1056('0x9e')](loggerCatch(_0x1056('0x170')));if(_0x5d096c[_0x1056('0x171')](0x0,_0x4844db,_0x2c3b03)){if(_0x59d205[_0x1056('0x160')]+_0x59d205[_0x1056('0x161')]+_0x59d205[_0x1056('0x162')]>=_0x2c3b03['dialGlobalMaxRetry']){_0x5d096c[_0x1056('0x172')](_0x59d205,_0x4bf88c,_0x4baadd,_0x1056('0x173'));}else{_0x5d096c[_0x1056('0x174')](_0x59d205,_0x4bf88c,_0x4baadd,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x2c3b03[_0x1056('0x64')]+=0x1;_0x59d205[_0x1056('0x93')]=0x3;_0x59d205['statedesc']=_0x1056('0x175');_0x59d205['countnoanswerretry']+=0x1;_0x59d205['countglobal']+=0x1;_0x5d096c[_0x1056('0xb4')](_0x59d205)['catch'](loggerCatch(_0x1056('0x176')));if(_0x5d096c[_0x1056('0x171')](0x3,_0x4844db,_0x2c3b03)){if(_0x59d205[_0x1056('0x162')]>=_0x2c3b03[_0x1056('0x164')]){_0x5d096c[_0x1056('0x174')](_0x59d205,_0x4bf88c,_0x4baadd,'reason\x203\x20ringing\x20no\x20answer');}else{_0x5d096c[_0x1056('0x172')](_0x59d205,_0x4bf88c,_0x4baadd,_0x1056('0x177'));}}break;case'5':_0x2c3b03[_0x1056('0x61')]+=0x1;_0x59d205[_0x1056('0x93')]=0x5;_0x59d205['statedesc']='Busy';_0x59d205['countbusyretry']+=0x1;_0x59d205[_0x1056('0x178')]+=0x1;_0x5d096c[_0x1056('0xb4')](_0x59d205)[_0x1056('0x9e')](loggerCatch(_0x1056('0x179')));if(_0x5d096c[_0x1056('0x171')](0x5,_0x4844db,_0x2c3b03)){if(_0x59d205[_0x1056('0x160')]>=_0x2c3b03[_0x1056('0x168')]){_0x5d096c[_0x1056('0x174')](_0x59d205,_0x4bf88c,_0x4baadd,_0x1056('0x17a'));}else{_0x5d096c[_0x1056('0x172')](_0x59d205,_0x4bf88c,_0x4baadd,_0x1056('0x17a'));}}break;case'8':_0x2c3b03[_0x1056('0x17b')]+=0x1;_0x59d205[_0x1056('0x93')]=0x8;_0x59d205['statedesc']='Congestion';_0x59d205[_0x1056('0x161')]+=0x1;_0x59d205['countglobal']+=0x1;_0x5d096c['createHistory'](_0x59d205)[_0x1056('0x9e')](loggerCatch(_0x1056('0x17c')));if(_0x5d096c[_0x1056('0x171')](0x8,_0x4844db,_0x2c3b03)){if(_0x59d205['countcongestionretry']>=_0x2c3b03['dialCongestionMaxRetry']){_0x5d096c['createStateFinal'](_0x59d205,_0x4bf88c,_0x4baadd,_0x1056('0x17d'));}else{_0x5d096c[_0x1056('0x172')](_0x59d205,_0x4bf88c,_0x4baadd,_0x1056('0x17d'));}}break;default:_0x2c3b03[_0x1056('0x67')]+=0x1;_0x59d205[_0x1056('0x93')]=0xc;_0x59d205[_0x1056('0x94')]=_0x2c6486[_0x1056('0xdc')];_0x5d096c[_0x1056('0xb4')](_0x59d205)[_0x1056('0x9e')](loggerCatch(_0x1056('0x17e')));if(_0x5d096c[_0x1056('0x171')](_0x2c6486['reason'],_0x4844db,_0x2c3b03)){if(_0x59d205[_0x1056('0x160')]+_0x59d205[_0x1056('0x161')]+_0x59d205[_0x1056('0x162')]>=_0x2c3b03[_0x1056('0x163')]){_0x5d096c[_0x1056('0x172')](_0x59d205,_0x4bf88c,_0x4baadd,_0x2c6486[_0x1056('0xdc')]);}else{_0x5d096c[_0x1056('0x174')](_0x59d205,_0x4bf88c,_0x4baadd,_0x2c6486['reason']);}}}});};Dialer[_0x1056('0x1a')][_0x1056('0x172')]=function(_0x173bba,_0x509af9,_0x535938,_0x52960e){var _0x4abbed=new Final(_0x173bba);_0x4abbed[_0x1056('0x93')]=0xf;_0x4abbed[_0x1056('0x94')]=_0x1056('0x17f');this[_0x1056('0x174')](_0x4abbed,_0x509af9,_0x535938,_0x52960e);};Dialer[_0x1056('0x1a')][_0x1056('0x174')]=function(_0x120a14,_0x2a05a3,_0x91061f,_0x22787c){this['moveContactManagedDialer'](_0x120a14)[_0x1056('0xa6')](function(_0x9fac10){return _0x2a05a3(msgResponse('[callProgressDetecting]','Success',_0x22787c));})[_0x1056('0x9e')](function(_0x5ad660){return _0x91061f(msgResponse(_0x1056('0x180'),'Failure','contact\x20not\x20moved'));});};Dialer[_0x1056('0x1a')][_0x1056('0x8')]=function(_0x33c45f){var _0x1443b5=this;var _0x398c96=_0x33c45f['dialPredictiveOptimizationPercentage']/0x64;var _0x45eb63=_0x33c45f[_0x1056('0x63')]/(_0x33c45f[_0x1056('0x63')]+_0x33c45f[_0x1056('0x60')]);var _0x4ec6f8=_0x33c45f[_0x1056('0x50')]-_0x33c45f[_0x1056('0x6e')]-_0x33c45f['waiting']-_0x33c45f[_0x1056('0x70')]-_0x33c45f[_0x1056('0x54')];var _0x387b46=(_0x33c45f['loggedIn']-_0x33c45f[_0x1056('0x6e')])*_0x33c45f[_0x1056('0x181')];var _0x11f286=Math[_0x1056('0x182')](_0x33c45f['erlangCalls']*_0x33c45f[_0x1056('0x183')]*_0x33c45f[_0x1056('0x6c')]*_0x33c45f['predictiveIntervalMultiplicativeFactor']);if(_[_0x1056('0x3b')](_0x33c45f[_0x1056('0x7c')])){loggerPredictive[_0x1056('0x75')](_0x1056('0x184'));if(!_[_0x1056('0x3b')](_0x33c45f['startPredictive'])){_0x33c45f[_0x1056('0x29')]=undefined;loggerPredictive[_0x1056('0x82')](_0x1056('0x185'),_0x1056('0x186'));}if(!_['isUndefined'](_0x33c45f[_0x1056('0x7e')])){loggerPredictive[_0x1056('0x82')]('[startMethodPredictive][StartProgressive]',_0x1056('0x187'));clearInterval(_0x33c45f['handlePredictive']);_0x33c45f[_0x1056('0x7e')]=undefined;}_0x33c45f[_0x1056('0x7c')]=moment()[_0x1056('0x72')](_0x1056('0xe0'));loggerPredictive['info']('[startMethodPredictive][StartProgressive][Date]',_0x33c45f[_0x1056('0x7c')],_0x33c45f[_0x1056('0x3d')]);this['handlePower'](_0x33c45f,0x1);}else if(ifInterval(_0x33c45f[_0x1056('0x188')],_0x33c45f[_0x1056('0x7c')])){this[_0x1056('0x121')](_0x33c45f,0x1);loggerPredictiveCalls[_0x1056('0x75')](_0x1056('0x189'),_0x33c45f[_0x1056('0x7c')],_0x33c45f[_0x1056('0x3d')]);_0x33c45f[_0x1056('0x18a')]=0x0;_0x33c45f[_0x1056('0xe8')]=0x0;}else if(_0x398c96<_0x45eb63&&_0x33c45f['dialPredictiveOptimization']===_0x1056('0x18b')){freeVariablesPredictive(_0x33c45f);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x1056('0x18c'),_0x45eb63,_0x1056('0x7c'),_0x33c45f[_0x1056('0x3d')]);}else if(_0x4ec6f8>_0x387b46){freeVariablesPredictive(_0x33c45f);loggerPredictive[_0x1056('0x75')]('[stopMethodPredictive][ReStartProgressive][LowerLimitInterval]',_0x1056('0x18d'),_0x4ec6f8,'agent\x20max\x20free\x20',_0x387b46);}else if(_0x11f286<_0x33c45f['predictiveIntervalErlangCallsDroppedCalls']&&_0x33c45f[_0x1056('0x18e')]===_0x1056('0x18b')){freeVariablesPredictive(_0x33c45f);loggerPredictive[_0x1056('0x75')](_0x1056('0x18f'),_0x1056('0x190'),_0x11f286,_0x1056('0x191'),_0x33c45f[_0x1056('0xe8')],_0x1056('0x7c'),_0x33c45f[_0x1056('0x3d')]);}else if(!ifInterval(_0x33c45f['dialPredictiveInterval'],_0x33c45f[_0x1056('0x7c')])&&_[_0x1056('0x3b')](_0x33c45f['startPredictive'])&&!_['isUndefined'](_0x33c45f['startProgressive'])){_0x33c45f['startPredictive']=moment()[_0x1056('0x72')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x1056('0x75')]('[startMethodPredictive][StartPredictive][First]',_0x33c45f[_0x1056('0x29')],_0x33c45f[_0x1056('0x3d')]);this[_0x1056('0xaa')](_0x33c45f[_0x1056('0x188')])[_0x1056('0xa6')](this['getDataPredictive'](_0x33c45f))[_0x1056('0xa6')](mergeDataErlangB(_0x33c45f))[_0x1056('0xa6')](this[_0x1056('0x192')](_0x33c45f))['catch'](loggerCatchPredictive(_0x1056('0x193'),_0x33c45f));}else if(!ifInterval(_0x33c45f[_0x1056('0x188')],_0x33c45f[_0x1056('0x29')])){_0x33c45f[_0x1056('0xe8')]=0x0;_0x33c45f['startPredictive']=moment()[_0x1056('0x72')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x1056('0x194'),_0x33c45f[_0x1056('0x29')],_0x33c45f[_0x1056('0x3d')]);clearInterval(_0x33c45f[_0x1056('0x7e')]);_0x33c45f[_0x1056('0x7e')]=undefined;this['averageHandleTime'](_0x33c45f[_0x1056('0x188')])[_0x1056('0xa6')](this[_0x1056('0x195')](_0x33c45f))['then'](mergeDataErlangB(_0x33c45f))['then'](this[_0x1056('0x192')](_0x33c45f))[_0x1056('0x9e')](loggerCatchPredictive(_0x1056('0x193'),_0x33c45f));}};Dialer[_0x1056('0x1a')][_0x1056('0x195')]=function(_0x544f1a){var _0x5d5b88=this;return function(_0x42ab6f){return new BPromise(function(_0x472dde,_0xa442fa){_['merge'](_0x544f1a,_0x42ab6f[0x0]);if(checkGetDataPredictive(_0x42ab6f[0x0])){loggerPredictive[_0x1056('0x75')](JSON[_0x1056('0x48')](_0x42ab6f[0x0]));if(_0x544f1a['dialPredictiveOptimization']==='dropRate'){return _0x5d5b88[_0x1056('0xb1')](_0x544f1a['id'])[_0x1056('0xa6')](function(_0xf9efb8){var _0x11031b=_0x544f1a[_0x1056('0x50')]-_0xf9efb8[0x0][_0x1056('0x196')];var _0x3ca539=_0x544f1a[_0x1056('0x188')]*0x3c;var _0x25e388=_0x42ab6f[0x0][_0x1056('0x69')]+_0x42ab6f[0x0][_0x1056('0x68')];var _0x3b5ff7=(_0x42ab6f[0x0][_0x1056('0x197')]+_0x42ab6f[0x0][_0x1056('0x6a')]+_0x42ab6f[0x0][_0x1056('0xec')])/_0x42ab6f[0x0][_0x1056('0x6f')];var _0xcb68ef=_0x544f1a[_0x1056('0x198')]/0x64;_0x544f1a[_0x1056('0x6e')]=_0xf9efb8[0x0][_0x1056('0x196')]||0x0;_0x544f1a[_0x1056('0x6c')]=_0x3b5ff7>0x0?_0x3b5ff7:0x1;return _0x5d5b88[_0x1056('0x199')](_0x11031b,_0x3ca539,_0x25e388,_0x3b5ff7,_0xcb68ef);})['then'](function(_0x26fd6c){return _0x472dde(_0x26fd6c);})[_0x1056('0x9e')](function(_0x51e9b8){return _0xa442fa(msgResponse('[CatchErlangB]',_0x1056('0x10d'),JSON[_0x1056('0x48')](_0x51e9b8)));});}if(_0x544f1a[_0x1056('0x18e')]===_0x1056('0x19a')){return _0x5d5b88[_0x1056('0xb1')](_0x544f1a['id'])[_0x1056('0xa6')](function(_0x5cdfc5){var _0x4582ff=_0x544f1a[_0x1056('0x50')]-_0x5cdfc5[0x0]['outboundQueuePauses'];var _0x49b32d=_0x544f1a['dialPredictiveInterval']*0x3c;var _0x1d04e0=_0x42ab6f[0x0][_0x1056('0x69')]+_0x42ab6f[0x0][_0x1056('0x68')];var _0x5c8089=(_0x42ab6f[0x0][_0x1056('0x197')]+_0x42ab6f[0x0][_0x1056('0x6a')]+_0x42ab6f[0x0][_0x1056('0xec')])/_0x42ab6f[0x0][_0x1056('0x6f')];var _0x43a75b=_0x544f1a['dialPredictiveOptimizationPercentage']/0x64;_0x544f1a['predictiveIntervalPauses']=_0x5cdfc5[0x0][_0x1056('0x196')]||0x0;_0x544f1a['predictiveIntervalHitRate']=_0x5c8089>0x0?_0x5c8089:0x1;return _0x5d5b88[_0x1056('0x19b')](_0x4582ff,_0x49b32d,_0x1d04e0,_0x5c8089,_0x43a75b);})[_0x1056('0xa6')](function(_0x7ab194){return _0x472dde(_0x7ab194);})[_0x1056('0x9e')](function(_0xa9345d){return _0xa442fa(msgResponse(_0x1056('0x19c'),_0x1056('0x10d'),JSON[_0x1056('0x48')](_0xa9345d)));});}}else{return _0xa442fa(msgResponse(_0x1056('0x19d'),'Failure',_0x1056('0x19e')));}});};};Dialer[_0x1056('0x1a')][_0x1056('0x192')]=function(_0x51a0d0){var _0x39dad6=this;return function(){var _0x5bbc69=0x0;var _0x1fcd51=Math['floor'](_0x51a0d0[_0x1056('0x19f')]*0x3e8);if(_0x1fcd51>0x0){_0x1fcd51=_0x1fcd51<0x64?0x64:_0x1fcd51;loggerPredictive['info'](_0x1056('0x1a0'),_0x1fcd51);_0x51a0d0[_0x1056('0x7e')]=setInterval(function(){_0x39dad6[_0x1056('0x7e')](_0x51a0d0);loggerPredictiveCalls[_0x1056('0x75')]('[handlePredictive]',_0x5bbc69+=0x1);},_0x1fcd51);}else{loggerPredictive['info'](_0x1056('0x1a1'),_0x1056('0x1a2'),_0x1fcd51);}};};Dialer[_0x1056('0x1a')][_0x1056('0x1a3')]=function(_0x22c9cf,_0x108fb8){var _0x3916ae=this;return function(_0x5deaad){if(_[_0x1056('0x45')](_0x5deaad)){if(_[_0x1056('0x9a')](_0x108fb8[_0x1056('0xba')])||!_0x108fb8[_0x1056('0x1a4')]){if(_0x22c9cf[_0x1056('0x5a')]==='booked'){_0x22c9cf[_0x1056('0xf7')]=_[_0x1056('0x3b')](_0x22c9cf[_0x1056('0xf7')])?!![]:_0x22c9cf['queueStatusComplete'];var _0x1c885d=uuid['v4']();_0x3916ae[_0x1056('0x25')][_0x1c885d]=new Action(_0x22c9cf,_0x108fb8,_0x1c885d);loggerBooked[_0x1056('0x75')]('[booked][checkContactBlack]',_0x1c885d,_0x1056('0x1a5'),JSON[_0x1056('0x48')](_0x22c9cf[_0x1056('0xf7')]),_0x1056('0x1a6'),_0x22c9cf['name']);if(_0x22c9cf[_0x1056('0xf7')]){_0x22c9cf[_0x1056('0xf7')]=![];_0x3916ae[_0x1056('0xf4')][_0x3916ae[_0x1056('0x25')][_0x1c885d][_0x1056('0xa2')]]=[];ami[_0x1056('0x9b')]({'actionid':_0x1c885d,'action':'queuestatus','queue':_0x22c9cf[_0x1056('0x3d')]})['catch'](function(_0x5b008b){_0x3916ae[_0x1056('0xa0')](_0x22c9cf);_0x3916ae[_0x1056('0xad')]({'active':![],'ContactId':_0x3916ae[_0x1056('0x25')][_0x1c885d][_0x1056('0xb9')],'ListId':_0x3916ae['actions'][_0x1c885d][_0x1056('0xfc')],'VoiceQueueId':_0x3916ae['actions'][_0x1c885d][_0x1056('0xfd')]||undefined,'CampaignId':_0x3916ae[_0x1056('0x25')][_0x1c885d][_0x1056('0xbb')]||undefined})[_0x1056('0x9e')](loggerCatch(_0x1056('0x1a7')));delete _0x3916ae[_0x1056('0x25')][_0x1c885d];});}else{loggerBooked[_0x1056('0x75')](_0x1056('0x1a8'),JSON['stringify'](_0x22c9cf[_0x1056('0xf7')]),_0x1056('0x1a6'),_0x22c9cf[_0x1056('0x3d')]);_0x3916ae[_0x1056('0xa0')](_0x22c9cf);_0x3916ae[_0x1056('0xad')]({'active':![],'ContactId':_0x3916ae[_0x1056('0x25')][_0x1c885d][_0x1056('0xb9')],'ListId':_0x3916ae['actions'][_0x1c885d][_0x1056('0xfc')],'VoiceQueueId':_0x3916ae[_0x1056('0x25')][_0x1c885d][_0x1056('0xfd')]||undefined,'CampaignId':_0x3916ae['actions'][_0x1c885d][_0x1056('0xbb')]||undefined})['catch'](loggerCatch(_0x1056('0x1a7')));delete _0x3916ae[_0x1056('0x25')][_0x1c885d];}}else{return _0x3916ae[_0x1056('0x1a9')](_0x22c9cf,_0x108fb8);}}else{if(getDiff(_0x108fb8[_0x1056('0x1aa')])<_0x22c9cf[_0x1056('0x1ab')]*0x3c){_0x3916ae[_0x1056('0x1f')][_0x1056('0xf9')](_0x108fb8['id'])[_0x1056('0x1d')](function(){_0x3916ae[_0x1056('0xa0')](_0x22c9cf);});}else{_0x22c9cf[_0x1056('0x66')]+=0x1;_0x3916ae[_0x1056('0xa0')](_0x22c9cf);if(_0x22c9cf[_0x1056('0x1ac')]){_0x3916ae[_0x1056('0xad')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x108fb8['ContactId'],'ListId':_0x108fb8[_0x1056('0xfc')],'VoiceQueueId':_0x108fb8['VoiceQueueId']||undefined,'CampaignId':_0x108fb8[_0x1056('0xbb')]||undefined})[_0x1056('0x9e')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x3916ae[_0x1056('0xb4')](createObjHistory(_0x22c9cf,_0x108fb8,_0x1056('0x1ad'),0x17,_0x1056('0x1ae')))[_0x1056('0x9e')](loggerCatch(_0x1056('0x1af')));}else{_0x3916ae[_0x1056('0xc3')](createObjHistory(_0x22c9cf,_0x108fb8,'RECALLFAILEDTIMEOUT',0x16,_0x1056('0x1b0')),_0x1056('0x1b1'),'[Originate][HistoryRecallClose]');}}}}else{_0x22c9cf[_0x1056('0x1b2')]+=0x1;_0x3916ae[_0x1056('0xc3')](createObjHistory(_0x22c9cf,_0x108fb8,_0x1056('0x1b3'),0xd,_0x1056('0x1b4')),_0x1056('0x1b5'),_0x1056('0x1b6'));throw _0x1056('0x1b7');}};};Dialer[_0x1056('0x1a')][_0x1056('0x126')]=function(_0x41477f){var _0x5a82a7=this;var _0x56bbff=[];var _0x5cf818=_0x41477f['limitCalls']-_0x41477f[_0x1056('0x70')]-_0x41477f[_0x1056('0x1b8')];emitCampaignSummary(_0x41477f);if(_0x5cf818>0x0){if(_0x5cf818>this[_0x1056('0x24')]){_0x5cf818=this['maxNumberOriginate'];}_0x41477f[_0x1056('0x1b8')]+=_0x5cf818;this['getContactDialerIvr'](_0x41477f['id'],_0x5cf818,_0x41477f[_0x1056('0x1b9')])[_0x1056('0xa6')](function(_0x1233af){_0x41477f[_0x1056('0x1b8')]-=_0x5cf818;_0x41477f[_0x1056('0x1b8')]=_0x41477f['temp']>0x0?_0x41477f[_0x1056('0x1b8')]:0x0;if(!checkContactEmpty(_0x1233af)){_0x41477f[_0x1056('0x3c')]=_0x1056('0x89');logger[_0x1056('0x75')]('[getContactCampaign2][Empty]'+_0x41477f['name']);}else{_0x41477f['originated']+=_0x1233af['length'];_0x41477f[_0x1056('0x3c')]=_0x1056('0x1ba');for(var _0x519480=0x0;_0x519480<_0x1233af[_0x1056('0x112')];_0x519480+=0x1){_0x41477f[_0x1056('0x1bb')]+=0x1;if(_[_0x1056('0x9a')](_0x1233af[_0x519480])||_[_0x1056('0x9a')](_0x1233af[_0x519480][_0x1056('0x132')])||_[_0x1056('0x9a')](_0x1233af[_0x519480][_0x1056('0x132')][_0x1056('0x133')])){_0x5a82a7[_0x1056('0xb7')](_0x1056('0x1bc'),_0x41477f,_0x1233af[_0x519480]);}else{_0x5a82a7[_0x1056('0xa8')](_[_0x1056('0xf5')](_0x1233af[_0x519480],[_0x1056('0xbb'),_0x1056('0x1bd')]))[_0x1056('0xa6')](_0x5a82a7['checkContactBlack'](_0x41477f,_0x1233af[_0x519480]))[_0x1056('0x9e')](_0x5a82a7[_0x1056('0xb6')](_0x1056('0x1be'),_0x41477f));}}}})[_0x1056('0x9e')](loggerGetContactDialer('[getContactCampaign2]',_0x41477f,_0x5cf818));}};Dialer[_0x1056('0x1a')][_0x1056('0x121')]=function(_0x9e1607,_0x29b4c8){var _0x3e459b=this;var _0xb10533=[];var _0x4a4113=_0x29b4c8>=0x1?_0x29b4c8:0x1;var _0x4bceb2=[];if(_0x9e1607[_0x1056('0x5a')]===_0x1056('0x7')){_0x4a4113=0x1;}var _0x214239=Math[_0x1056('0x182')](_0x9e1607[_0x1056('0x8d')]*_0x4a4113)-_0x9e1607['originated']-_0x9e1607[_0x1056('0x1b8')];emitVoiceQueueSummary(_0x9e1607);if(_0x9e1607[_0x1056('0x1bf')]>0x0){var _0x41ce89=_0x9e1607[_0x1056('0x1bf')]-_0x9e1607[_0x1056('0x70')]-_0x9e1607[_0x1056('0x54')]-_0x9e1607[_0x1056('0x1b8')]-_0x9e1607['pTalking'];if(_0x214239>_0x41ce89){_0x214239=_0x41ce89;}}if(_0x214239>0x0){if(_0x9e1607[_0x1056('0x5a')]===_0x1056('0x7')){_0x214239=0x1;}if(_0x214239>this['maxNumberOriginate']){_0x214239=this['maxNumberOriginate'];}_0x9e1607['temp']+=_0x214239;for(var _0x294c64 in this[_0x1056('0x22')]){if(this[_0x1056('0x22')][_0x1056('0x99')](_0x294c64)){if(this[_0x1056('0x22')][_0x294c64][_0x1056('0x93')]==='not_inuse'&&this[_0x1056('0x22')][_0x294c64]['status']===_0x1056('0xc1')){_0xb10533['push'](this['agents'][_0x294c64]['id']);}}}this[_0x1056('0x1c0')](_0x9e1607['id'],_0xb10533,_0x214239,_0x9e1607['dialOrderByScheduledAt'])[_0x1056('0xa6')](function(_0x153ac9){_0x9e1607['temp']-=_0x214239;_0x9e1607['temp']=_0x9e1607[_0x1056('0x1b8')]>0x0?_0x9e1607['temp']:0x0;if(!checkContactEmpty(_0x153ac9)){_0x3e459b['countReScheduled'](_0x9e1607)[_0x1056('0xa6')](sendMessageReschedule(_0x9e1607))['catch'](loggerCatch(_0x1056('0x1c1')));}else{_0x9e1607[_0x1056('0x70')]+=_0x153ac9[_0x1056('0x112')];_0x9e1607['message']=_0x9e1607[_0x1056('0x5a')]==='booked'?_0x1056('0x13a'):_0x1056('0x1ba');for(var _0x12e37f=0x0;_0x12e37f<_0x153ac9[_0x1056('0x112')];_0x12e37f+=0x1){if(_[_0x1056('0x9a')](_0x153ac9[_0x12e37f])||_['isNil'](_0x153ac9[_0x12e37f]['Contact'])||_[_0x1056('0x9a')](_0x153ac9[_0x12e37f][_0x1056('0x132')][_0x1056('0x133')])){_0x3e459b[_0x1056('0xb7')]('[actionOriginate]\x20',_0x9e1607,_0x153ac9[_0x12e37f]);}else{_0x3e459b[_0x1056('0xa5')](_[_0x1056('0xf5')](_0x153ac9[_0x12e37f],[_0x1056('0xfd'),_0x1056('0x1bd')]))[_0x1056('0xa6')](_0x3e459b['checkContactBlack'](_0x9e1607,_0x153ac9[_0x12e37f]))[_0x1056('0x9e')](_0x3e459b[_0x1056('0xb6')](_0x1056('0x1bc'),_0x9e1607));}}}})[_0x1056('0x9e')](loggerGetContactDialer(_0x1056('0x1c2'),_0x9e1607,_0x214239));}};Dialer[_0x1056('0x1a')][_0x1056('0x7e')]=function(_0x1f517a){var _0x314b82=this;if(_0x1f517a['dialLimitQueue']>0x0){var _0x51318a=_0x1f517a[_0x1056('0x1bf')]-_0x1f517a['originated']-_0x1f517a['talking'];if(_0x51318a>0x0){this['tryOriginatePredictive'](_0x1f517a);}else{loggerPredictiveCalls[_0x1056('0x75')]('[handlePredictive][limitChannel]');}}else{this[_0x1056('0x1c3')](_0x1f517a);}};Dialer[_0x1056('0x1a')]['tryOriginatePredictive']=function(_0x3fafc5){var _0x19ece9=this;var _0x502520=[];_0x3fafc5[_0x1056('0x70')]+=0x1;for(var _0x5a7208 in this[_0x1056('0x22')]){if(this['agents'][_0x1056('0x99')](_0x5a7208)){if(this[_0x1056('0x22')][_0x5a7208]['state']==='not_inuse'&&this[_0x1056('0x22')][_0x5a7208][_0x1056('0x9c')]===_0x1056('0xc1')){_0x502520[_0x1056('0x113')](this['agents'][_0x5a7208]['id']);}}}this[_0x1056('0x1c0')](_0x3fafc5['id'],_0x502520,0x1,_0x3fafc5[_0x1056('0x1b9')])[_0x1056('0xa6')](function(_0x34d0c9){if(!checkContactEmpty(_0x34d0c9)){checkContactLowerLimitOriginate(_0x3fafc5,0x1,0x0);_0x19ece9[_0x1056('0x1c4')](_0x3fafc5)['then'](sendMessageReschedule(_0x3fafc5))['catch'](loggerCatch(_0x1056('0x1c1')));}else{_0x3fafc5['message']='RUNNING';if(_[_0x1056('0x9a')](_0x34d0c9[0x0])||_[_0x1056('0x9a')](_0x34d0c9[0x0][_0x1056('0x132')])||_['isNil'](_0x34d0c9[0x0]['Contact'][_0x1056('0x133')])){_0x19ece9[_0x1056('0xb7')]('[actionOriginate]\x20',_0x3fafc5,_0x34d0c9[0x0]);}else{_0x19ece9[_0x1056('0xa5')](_[_0x1056('0xf5')](_0x34d0c9[0x0],[_0x1056('0xfd'),'Contact.phone']))[_0x1056('0xa6')](_0x19ece9[_0x1056('0x1a3')](_0x3fafc5,_0x34d0c9[0x0]))['catch'](_0x19ece9[_0x1056('0xb6')](_0x1056('0x1c5'),_0x3fafc5));}}})[_0x1056('0x9e')](loggerGetContactDialer('[getContactDialerPredictive]',_0x3fafc5,0x1));emitVoiceQueueSummary(_0x3fafc5);};Dialer[_0x1056('0x1a')][_0x1056('0x199')]=function(_0x56d804,_0xbcfd6,_0x275089,_0x4c763a,_0x299421,_0x2a8d75){loggerPredictive[_0x1056('0x75')](_0x1056('0x1c6'),'\x20m\x20=\x20',_0x56d804,_0x1056('0x1c7'),_0xbcfd6,_0x1056('0x1c8'),_0x275089,'\x20p\x20=\x20',_0x4c763a,_0x1056('0x1c9'),_0x299421);return new BPromise(function(_0x5b550a,_0x50d180){if(_0x56d804<=0x0||isNaN(_0x56d804)){return _0x50d180(msgResponse('[abandonmentRate]','Error',_0x1056('0x1ca')+_0x56d804));}if(_0x275089<=0x0||isNaN(_0x275089)){return _0x50d180(msgResponse(_0x1056('0x1c6'),_0x1056('0x47'),'Ts\x20=\x20'+_0x275089));}if(_0x4c763a<=0x0||isNaN(_0x4c763a)){return _0x50d180(msgResponse(_0x1056('0x1c6'),_0x1056('0x47'),_0x1056('0x1cb')+_0x4c763a));}if(_0xbcfd6<=0x0||isNaN(_0xbcfd6)){return _0x50d180(msgResponse(_0x1056('0x1c6'),'Error',_0x1056('0x1cc')+_0xbcfd6));}if(_0x299421<=0x0||isNaN(_0x299421)){return _0x50d180(msgResponse(_0x1056('0x1c6'),'Error',_0x1056('0x1cd')+_0x299421));}_0x2a8d75=_0x2a8d75||0x0;var _0x30c7c1=0x1/_0x275089;var _0x172026=0x0;var _0x2b32a5=0x0;var _0x109ea3=0x0;var _0x301aa1=0x0;for(var _0x6f7d4a=0x0;_0x109ea3<_0x299421;_0x6f7d4a+=0x1){_0x2b32a5=_0x6f7d4a/_0xbcfd6;_0x172026=(_0x4c763a*_0x2b32a5+_0x2a8d75)/_0x30c7c1;_0x109ea3=erlangb(_0x172026,_0x56d804);_0x301aa1=_0x172026/_0x56d804*(0x1-erlangb(_0x172026,_0x56d804));}return _0x5b550a({'erlangCalls':_0x6f7d4a,'erlangCallToSecond':_0xbcfd6/_0x6f7d4a,'erlangAbandonmentRate':_0x109ea3,'erlangBusyFactor':_0x301aa1});});};Dialer[_0x1056('0x1a')][_0x1056('0x19b')]=function(_0x10b770,_0x24aba7,_0x57045a,_0x184d9a,_0x422a21,_0x236bcb){loggerPredictive[_0x1056('0x75')]('[busyFactor]','\x20m\x20=\x20',_0x10b770,'\x20interval\x20=\x20',_0x24aba7,_0x1056('0x1c8'),_0x57045a,_0x1056('0x1ce'),_0x184d9a,_0x1056('0x1cf'),_0x422a21);return new BPromise(function(_0x5bca6c,_0xb1ca5f){if(_0x10b770<=0x0||isNaN(_0x10b770)){return _0xb1ca5f(msgResponse(_0x1056('0x1c6'),_0x1056('0x47'),_0x1056('0x1ca')+_0x10b770));}if(_0x57045a<=0x0||isNaN(_0x57045a)){return _0xb1ca5f(msgResponse(_0x1056('0x1c6'),_0x1056('0x47'),_0x1056('0x1d0')+_0x57045a));}if(_0x184d9a<=0x0||isNaN(_0x184d9a)){return _0xb1ca5f(msgResponse(_0x1056('0x1c6'),'Error',_0x1056('0x1cb')+_0x184d9a));}if(_0x24aba7<=0x0||isNaN(_0x24aba7)){return _0xb1ca5f(msgResponse(_0x1056('0x1c6'),_0x1056('0x47'),'interval\x20=\x20'+_0x24aba7));}if(_0x422a21<=0x0||isNaN(_0x422a21)){return _0xb1ca5f(msgResponse('[abandonmentRate]',_0x1056('0x47'),_0x1056('0x1cd')+_0x422a21));}_0x236bcb=_0x236bcb||0x0;var _0x2501f6=0x1/_0x57045a;var _0x2f4d48=0x0;var _0x53434f=0x0;var _0x3f1ccd=0x0;var _0x539ce9=0x0;for(var _0x5dce7f=0x0;_0x539ce9<_0x422a21;_0x5dce7f+=0x1){_0x53434f=_0x5dce7f/_0x24aba7;_0x2f4d48=(_0x184d9a*_0x53434f+_0x236bcb)/_0x2501f6;_0x3f1ccd=erlangb(_0x2f4d48,_0x10b770);_0x539ce9=_0x2f4d48/_0x10b770*(0x1-erlangb(_0x2f4d48,_0x10b770));}return _0x5bca6c({'erlangCalls':_0x5dce7f,'erlangCallToSecond':_0x24aba7/_0x5dce7f,'erlangAbandonmentRate':_0x3f1ccd,'erlangBusyFactor':_0x539ce9});});};module[_0x1056('0x1d1')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 14e95d8..09318a8 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 _0x3dd0=['scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','ringtime','holdtime','membername','connectedlinename','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','moment','diff','seconds'];(function(_0x3629de,_0x3f1514){var _0x535d4a=function(_0x173086){while(--_0x173086){_0x3629de['push'](_0x3629de['shift']());}};_0x535d4a(++_0x3f1514);}(_0x3dd0,0x17d));var _0x03dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3dd0[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x03dd('0x0'));function getSeconds(_0x228ff5,_0x5be369){var _0x43d31e=moment(_0x228ff5)['milliseconds'](0x0);var _0x3e4eff=moment(_0x5be369)['milliseconds'](0x0);return _0x43d31e[_0x03dd('0x1')](_0x3e4eff,_0x03dd('0x2'));}function QueueCallerAbandon(_0x26fc70,_0x554e6e){this[_0x03dd('0x3')]=_0x26fc70[_0x03dd('0x3')];this[_0x03dd('0x4')]=_0x26fc70[_0x03dd('0x4')];this[_0x03dd('0x5')]=_0x26fc70[_0x03dd('0x4')]===_0x03dd('0x6')?_0x03dd('0x7'):_0x26fc70[_0x03dd('0x4')];this[_0x03dd('0x8')]=_0x26fc70[_0x03dd('0x8')];this[_0x03dd('0x9')]=_0x26fc70[_0x03dd('0x9')];this[_0x03dd('0xa')]=_0x26fc70[_0x03dd('0xa')];this['countglobal']=_0x26fc70['countbusyretry']+_0x26fc70[_0x03dd('0x9')]+_0x26fc70[_0x03dd('0xa')];this[_0x03dd('0xb')]=_0x554e6e['uniqueid'];this['calleridname']=_0x26fc70[_0x03dd('0xc')];this[_0x03dd('0xd')]=_0x26fc70[_0x03dd('0xe')];this['starttime']=_0x26fc70[_0x03dd('0xf')];this[_0x03dd('0x10')]=_0x26fc70[_0x03dd('0x10')];this['droptime']=_0x26fc70[_0x03dd('0x11')];this['endtime']=this[_0x03dd('0x11')];this[_0x03dd('0x12')]=getSeconds(_0x26fc70[_0x03dd('0x10')],_0x26fc70['starttime']);this[_0x03dd('0x13')]=getSeconds(this[_0x03dd('0x11')],_0x26fc70[_0x03dd('0x10')]);this['talktime']=0x0;this[_0x03dd('0x7')]=_0x554e6e[_0x03dd('0x7')];this[_0x03dd('0x14')]=_0x554e6e[_0x03dd('0x15')];this['reason']=_0x554e6e['reason'];this['callback']=_0x26fc70['callback'];this[_0x03dd('0x16')]=_0x26fc70[_0x03dd('0x16')];this[_0x03dd('0x17')]=_0x26fc70['callbackat'];this[_0x03dd('0x18')]=_0x26fc70[_0x03dd('0x18')];this[_0x03dd('0x19')]=_0x26fc70[_0x03dd('0x19')];this[_0x03dd('0x1a')]=_0x26fc70[_0x03dd('0x1a')];this[_0x03dd('0x1b')]=_0x26fc70[_0x03dd('0x1b')];this[_0x03dd('0x1c')]=_0x26fc70[_0x03dd('0x1c')];this[_0x03dd('0x1d')]=_0x26fc70[_0x03dd('0x1d')];this['originatecalleridnum']=_0x26fc70[_0x03dd('0x1e')]||'';this[_0x03dd('0x1f')]=_0x26fc70[_0x03dd('0x1f')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0xeccb=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','countcongestionretry','countnoanswerretry','countbusyretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x9e46ea,_0x1f7152){var _0x5ac1d9=function(_0x249343){while(--_0x249343){_0x9e46ea['push'](_0x9e46ea['shift']());}};_0x5ac1d9(++_0x1f7152);}(_0xeccb,0x13e));var _0xbecc=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xeccb[_0x580576];return _0x3f55a0;};'use strict';var util=require('util');var _=require(_0xbecc('0x0'));var moment=require(_0xbecc('0x1'));function getSeconds(_0xd5ffa1,_0x362e6c){var _0x17a83f=moment(_0xd5ffa1)[_0xbecc('0x2')](0x0);var _0x1a2dbd=moment(_0x362e6c)['milliseconds'](0x0);return _0x17a83f[_0xbecc('0x3')](_0x1a2dbd,_0xbecc('0x4'));}function QueueCallerAbandon(_0x373517,_0x455bbe){this[_0xbecc('0x5')]=_0x373517[_0xbecc('0x5')];this[_0xbecc('0x6')]=_0x373517['type'];this[_0xbecc('0x7')]=_0x373517['type']===_0xbecc('0x8')?'queue':_0x373517[_0xbecc('0x6')];this['countbusyretry']=_0x373517['countbusyretry'];this[_0xbecc('0x9')]=_0x373517[_0xbecc('0x9')];this[_0xbecc('0xa')]=_0x373517[_0xbecc('0xa')];this['countglobal']=_0x373517[_0xbecc('0xb')]+_0x373517[_0xbecc('0x9')]+_0x373517['countnoanswerretry'];this[_0xbecc('0xc')]=_0x455bbe['uniqueid'];this[_0xbecc('0xd')]=_0x373517[_0xbecc('0xe')];this[_0xbecc('0xf')]=_0x373517['number'];this[_0xbecc('0x10')]=_0x373517[_0xbecc('0x10')];this[_0xbecc('0x11')]=_0x373517[_0xbecc('0x11')];this[_0xbecc('0x12')]=_0x373517[_0xbecc('0x12')];this[_0xbecc('0x13')]=this[_0xbecc('0x12')];this[_0xbecc('0x14')]=getSeconds(_0x373517[_0xbecc('0x11')],_0x373517[_0xbecc('0x10')]);this[_0xbecc('0x15')]=getSeconds(this[_0xbecc('0x12')],_0x373517[_0xbecc('0x11')]);this[_0xbecc('0x16')]=0x0;this[_0xbecc('0x17')]=_0x455bbe[_0xbecc('0x17')];this[_0xbecc('0x18')]=_0x455bbe[_0xbecc('0x19')];this[_0xbecc('0x1a')]=_0x455bbe[_0xbecc('0x1a')];this[_0xbecc('0x1b')]=_0x373517['callback'];this['callbackuniqueid']=_0x373517[_0xbecc('0x1c')];this[_0xbecc('0x1d')]=_0x373517[_0xbecc('0x1d')];this[_0xbecc('0x1e')]=_0x373517['recallme'];this[_0xbecc('0x1f')]=_0x373517[_0xbecc('0x1f')];this[_0xbecc('0x20')]=_0x373517['ListId'];this['UserId']=_0x373517[_0xbecc('0x21')];this['VoiceQueueId']=_0x373517[_0xbecc('0x22')];this[_0xbecc('0x23')]=_0x373517[_0xbecc('0x23')];this[_0xbecc('0x24')]=_0x373517[_0xbecc('0x24')]||'';this[_0xbecc('0x25')]=_0x373517['originatecalleridname']||'';}module[_0xbecc('0x26')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index f16ae31..90f2d88 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 _0x93e8=['headerinfo','path','AttachmentId','exports','util','lodash','moment','uniqueid','channel','%s/%s/%s','Trunk','name','fax','localstationid'];(function(_0x5ca209,_0x137dda){var _0x7d7e15=function(_0x28f03a){while(--_0x28f03a){_0x5ca209['push'](_0x5ca209['shift']());}};_0x7d7e15(++_0x137dda);}(_0x93e8,0x19a));var _0x893e=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x93e8[_0x4b2863];return _0x567d67;};'use strict';var util=require(_0x893e('0x0'));var _=require(_0x893e('0x1'));var moment=require(_0x893e('0x2'));function Action(_0x17b04f,_0x3e77b5,_0x2db4a3){this[_0x893e('0x3')]=_0x17b04f||undefined;this[_0x893e('0x4')]=util['format'](_0x893e('0x5'),_0x3e77b5['tech'],_0x3e77b5[_0x893e('0x6')][_0x893e('0x7')],_0x2db4a3[_0x893e('0x8')]);this[_0x893e('0x9')]=_0x3e77b5[_0x893e('0x9')];this['headerinfo']=_0x3e77b5[_0x893e('0xa')];this[_0x893e('0xb')]=_0x2db4a3[_0x893e('0xb')];this[_0x893e('0xc')]=_0x2db4a3[_0x893e('0xc')];}module[_0x893e('0xd')]=Action; \ No newline at end of file +var _0xfcda=['AttachmentId','exports','util','channel','format','%s/%s/%s','tech','Trunk','name','fax','localstationid','headerinfo','path'];(function(_0x2f9667,_0xc7414c){var _0x5c2637=function(_0x37fe61){while(--_0x37fe61){_0x2f9667['push'](_0x2f9667['shift']());}};_0x5c2637(++_0xc7414c);}(_0xfcda,0x17b));var _0xafcd=function(_0x24bcf2,_0x6adc7c){_0x24bcf2=_0x24bcf2-0x0;var _0x5a086e=_0xfcda[_0x24bcf2];return _0x5a086e;};'use strict';var util=require(_0xafcd('0x0'));var _=require('lodash');var moment=require('moment');function Action(_0x4652cc,_0x3014ab,_0x6f5351){this['uniqueid']=_0x4652cc||undefined;this[_0xafcd('0x1')]=util[_0xafcd('0x2')](_0xafcd('0x3'),_0x3014ab[_0xafcd('0x4')],_0x3014ab[_0xafcd('0x5')][_0xafcd('0x6')],_0x6f5351[_0xafcd('0x7')]);this[_0xafcd('0x8')]=_0x3014ab['localstationid'];this[_0xafcd('0x9')]=_0x3014ab[_0xafcd('0x9')];this[_0xafcd('0xa')]=_0x6f5351[_0xafcd('0xa')];this[_0xafcd('0xb')]=_0x6f5351[_0xafcd('0xb')];}module[_0xafcd('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 904b427..8270cd8 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 _0x49a3=['notify','fax','error','stringify','catch','\x20receiveFax\x20','merge','pick','reason','AttachmentId','update','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','then','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk','Trunk\x20Reachable','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','format','SIP/%s','reachable','[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','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','syncVarSet','syncNewState','newexten','syncNewExten','faxstatus','receivefax','syncReceiveFax','originateresponse','syncOriginateResponse','prototype','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','hasOwnProperty','value','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','remotestationid','pagestransferred','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x49a3,0x9f));var _0x349a=function(_0x4315dd,_0x156d91){_0x4315dd=_0x4315dd-0x0;var _0x186e27=_0x49a3[_0x4315dd];return _0x186e27;};'use strict';var util=require(_0x349a('0x0'));var _=require('lodash');var BPromise=require(_0x349a('0x1'));var uuid=require(_0x349a('0x2'));var moment=require(_0x349a('0x3'));var path=require(_0x349a('0x4'));var tiff2pdf=require(_0x349a('0x5'));var gs=require(_0x349a('0x6'));var logger=require(_0x349a('0x7'))('fax');var ami=require(_0x349a('0x8'));var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0x349a('0x9'));var attachment=require(_0x349a('0xa'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x57b5f7){this[_0x349a('0xb')]={};this[_0x349a('0xc')]=_0x57b5f7[_0x349a('0xc')];this[_0x349a('0xd')]=_0x57b5f7[_0x349a('0xd')];this['actions']={};ami['on'](_0x349a('0xe'),this[_0x349a('0xf')][_0x349a('0x10')](this));ami['on']('varset',this[_0x349a('0x11')][_0x349a('0x10')](this));ami['on']('newstate',this[_0x349a('0x12')]['bind'](this));ami['on'](_0x349a('0x13'),this[_0x349a('0x14')][_0x349a('0x10')](this));ami['on'](_0x349a('0x15'),this['syncFaxStatus']['bind'](this));ami['on'](_0x349a('0x16'),this[_0x349a('0x17')][_0x349a('0x10')](this));ami['on']('hangup',this['syncHangup'][_0x349a('0x10')](this));ami['on'](_0x349a('0x18'),this[_0x349a('0x19')][_0x349a('0x10')](this));}Fax[_0x349a('0x1a')][_0x349a('0xf')]=function(_0x17bf20){if(_0x17bf20['context']==='from-voip-provider'){for(var _0x5de9ce in this[_0x349a('0xc')]){if(this[_0x349a('0xc')]['hasOwnProperty'](_0x5de9ce)){if(_0x17bf20[_0x349a('0x1b')]===this[_0x349a('0xc')][_0x5de9ce][_0x349a('0x1c')]){this[_0x349a('0xb')][_0x17bf20['uniqueid']]={};this[_0x349a('0xb')][_0x17bf20[_0x349a('0x1d')]]['channel']=_0x17bf20[_0x349a('0x1e')];this[_0x349a('0xb')][_0x17bf20['uniqueid']]['id']=this[_0x349a('0xc')][_0x5de9ce]['id'];this['channels'][_0x17bf20[_0x349a('0x1d')]]['name']=this[_0x349a('0xc')][_0x5de9ce][_0x349a('0x1f')];logger[_0x349a('0x20')](_0x17bf20[_0x349a('0x1d')],_0x349a('0x21'));}}}}if(this[_0x349a('0x22')][_0x17bf20[_0x349a('0x1d')]]){this[_0x349a('0xb')][_0x17bf20[_0x349a('0x1d')]]={};this[_0x349a('0xb')][_0x17bf20[_0x349a('0x1d')]][_0x349a('0x1e')]=_0x17bf20[_0x349a('0x1e')];logger[_0x349a('0x20')](_0x17bf20[_0x349a('0x1d')],_0x349a('0x21'));}};Fax[_0x349a('0x1a')][_0x349a('0x11')]=function(_0x5f4fa7){if(this['channels'][_0x5f4fa7[_0x349a('0x1d')]]){for(var _0xb8ca6d in _0x5f4fa7[_0x349a('0x23')]){if(_0x5f4fa7[_0x349a('0x23')][_0x349a('0x24')](_0xb8ca6d)){this[_0x349a('0xb')][_0x5f4fa7[_0x349a('0x1d')]][_0xb8ca6d]=_0x5f4fa7[_0x349a('0x25')];}}}};Fax[_0x349a('0x1a')][_0x349a('0x12')]=function(_0x3ac9e2){if(this['channels'][_0x3ac9e2['uniqueid']]){this[_0x349a('0xb')][_0x3ac9e2[_0x349a('0x1d')]][_0x349a('0x26')]=_0x3ac9e2[_0x349a('0x26')];this[_0x349a('0xb')][_0x3ac9e2[_0x349a('0x1d')]][_0x349a('0x27')]=_0x3ac9e2['channelstatedesc'];}};Fax[_0x349a('0x1a')][_0x349a('0x14')]=function(_0x56930e){if(this[_0x349a('0xb')][_0x56930e[_0x349a('0x1d')]]){for(var _0x320d2d in _0x56930e[_0x349a('0x23')]){if(_0x56930e[_0x349a('0x23')]['hasOwnProperty'](_0x320d2d)){this[_0x349a('0xb')][_0x56930e[_0x349a('0x1d')]][_0x320d2d]=_0x56930e[_0x349a('0x25')];}}}};Fax[_0x349a('0x1a')][_0x349a('0x28')]=function(_0x5b7823){if(this[_0x349a('0xb')][_0x5b7823[_0x349a('0x1d')]]){this[_0x349a('0xb')][_0x5b7823[_0x349a('0x1d')]]['operation']=_0x5b7823[_0x349a('0x29')];this[_0x349a('0xb')][_0x5b7823[_0x349a('0x1d')]][_0x349a('0x2a')]=_0x5b7823[_0x349a('0x2a')];this[_0x349a('0xb')][_0x5b7823[_0x349a('0x1d')]]['localstationid']=_0x5b7823[_0x349a('0x1c')];this[_0x349a('0xb')][_0x5b7823[_0x349a('0x1d')]][_0x349a('0x2b')]=_0x5b7823['filename'];logger[_0x349a('0x20')](_0x5b7823[_0x349a('0x1d')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x349a('0x17')]=function(_0x49edea){var _0x278a4a=this;if(this[_0x349a('0xb')][_0x49edea[_0x349a('0x1d')]]){var _0x22d9c4=this[_0x349a('0xb')][_0x49edea['uniqueid']]['id'];this['channels'][_0x49edea['uniqueid']][_0x349a('0x2c')]=_0x49edea[_0x349a('0x2c')];this[_0x349a('0xb')][_0x49edea[_0x349a('0x1d')]][_0x349a('0x2d')]=_0x49edea['pagestransferred'];this[_0x349a('0xb')][_0x49edea[_0x349a('0x1d')]]['localstationid']=_0x49edea[_0x349a('0x1c')];this['channels'][_0x49edea[_0x349a('0x1d')]]['resolution']=_0x49edea['resolution'];this[_0x349a('0xb')][_0x49edea[_0x349a('0x1d')]]['transferrate']=_0x49edea[_0x349a('0x2e')];this[_0x349a('0xb')][_0x49edea[_0x349a('0x1d')]][_0x349a('0x2b')]=_0x49edea[_0x349a('0x2b')];this[_0x349a('0xb')][_0x49edea['uniqueid']][_0x349a('0x2f')]=_0x49edea[_0x349a('0x2f')];if(this[_0x349a('0xb')][_0x49edea[_0x349a('0x1d')]][_0x349a('0x2d')]>0x0){tiff2pdf(_0x49edea['filename'],'/var/opt/motion2/server/files/attachments/',function(_0xfb6099){logger[_0x349a('0x20')](_0x49edea[_0x349a('0x1d')],_0x349a('0x30'),_0xfb6099[_0x349a('0x31')]);attachment['create']({'name':path[_0x349a('0x32')](_0x49edea['filename'])[_0x349a('0x1f')],'basename':path[_0x349a('0x32')](_0x49edea['filename'])[_0x349a('0x1f')]+_0x349a('0x33'),'type':_0x349a('0x34')})['then'](function(_0x52a964){faxAccount[_0x349a('0x35')](_0x22d9c4,{'from':_0x49edea[_0x349a('0x2f')],'mapKey':_0x349a('0x36'),'body':path[_0x349a('0x32')](_0x49edea['filename'])[_0x349a('0x1f')]+_0x349a('0x33'),'AttachmentId':_0x52a964['id']})['catch'](function(_0x54df1c){logger[_0x349a('0x37')](_0x49edea[_0x349a('0x1d')],'\x20notify\x20',JSON[_0x349a('0x38')](_0x54df1c));});})[_0x349a('0x39')](function(_0x12e932){logger[_0x349a('0x37')](_0x49edea[_0x349a('0x1d')],_0x349a('0x3a'),JSON[_0x349a('0x38')](_0x12e932));});});}logger[_0x349a('0x20')](_0x49edea[_0x349a('0x1d')],_0x349a('0x3a'));}};Fax[_0x349a('0x1a')][_0x349a('0x19')]=function(_0x37b4a9){if(this[_0x349a('0x22')][_0x37b4a9[_0x349a('0x1d')]]){_[_0x349a('0x3b')](this[_0x349a('0xb')][_0x37b4a9[_0x349a('0x1d')]],_[_0x349a('0x3c')](_0x37b4a9,['response',_0x349a('0x3d')]));}};function updateStatus(_0x32485d){if(_0x32485d[_0x349a('0x3e')]){faxMessage[_0x349a('0x3f')](_0x32485d[_0x349a('0x3e')],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x1e4da9){ut[_0x349a('0x40')]('[Fax][Message][Error][Updated]',_0x1e4da9);})[_0x349a('0x39')](function(_0x5c9eca){ut[_0x349a('0x40')](_0x349a('0x41'),_0x5c9eca);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x349a('0x1a')][_0x349a('0x42')]=function(_0x5aadab,_0xd9313,_0x4ca05c){var _0x2a7e08=this;var _0x30473c={};if(_0xd9313){_0x30473c={'read':_0xd9313};}else{_0x30473c={'failMessage':_0x4ca05c};}if(this[_0x349a('0x22')][_0x5aadab][_0x349a('0x3e')]){faxMessage[_0x349a('0x3f')](this[_0x349a('0x22')][_0x5aadab][_0x349a('0x3e')],_0x30473c)[_0x349a('0x43')](function(_0x157f3d){ut[_0x349a('0x40')](_0x349a('0x44'),_0x157f3d);})['catch'](function(_0x2e8b43){ut[_0x349a('0x40')](_0x349a('0x45'),_0x2e8b43);})['finally'](function(){delete _0x2a7e08['channels'][_0x5aadab];delete _0x2a7e08[_0x349a('0x22')][_0x5aadab];});}else{ut[_0x349a('0x40')]('[Fax][Message][NoUpdate2]');delete this[_0x349a('0xb')][_0x5aadab];delete this[_0x349a('0x22')][_0x5aadab];}};Fax['prototype'][_0x349a('0x46')]=function(_0x18e179){var _0x30619f=this;if(this[_0x349a('0xb')][_0x18e179[_0x349a('0x1d')]]){if(this[_0x349a('0x22')][_0x18e179[_0x349a('0x1d')]]){this[_0x349a('0xb')][_0x18e179[_0x349a('0x1d')]]['id']=this[_0x349a('0x22')][_0x18e179[_0x349a('0x1d')]]['id'];this[_0x349a('0xb')][_0x18e179[_0x349a('0x1d')]][_0x349a('0x1f')]=this[_0x349a('0x22')][_0x18e179[_0x349a('0x1d')]][_0x349a('0x1f')];}logger[_0x349a('0x20')](_0x18e179['uniqueid'],this[_0x349a('0x22')][_0x18e179['uniqueid']]?_0x349a('0x47'):_0x349a('0x48'),JSON['stringify'](this[_0x349a('0xb')][_0x18e179[_0x349a('0x1d')]]));if(this[_0x349a('0x22')][_0x18e179['uniqueid']]){if(this['channels'][_0x18e179['uniqueid']][_0x349a('0x49')]>0x0&&this[_0x349a('0xb')][_0x18e179[_0x349a('0x1d')]][_0x349a('0x15')]===_0x349a('0x4a')){this[_0x349a('0x42')](_0x18e179[_0x349a('0x1d')],!![]);}else{this[_0x349a('0x42')](_0x18e179[_0x349a('0x1d')],![],this[_0x349a('0xb')][_0x18e179[_0x349a('0x1d')]][_0x349a('0x4b')]?_0x349a('0x4c')+this['channels'][_0x18e179[_0x349a('0x1d')]][_0x349a('0x4b')]:'SENDING\x20FAILED');}}}};Fax[_0x349a('0x1a')][_0x349a('0x4d')]=function(_0x40917b){var _0x3f4e51=this;return new BPromise(function(_0xe1f958,_0x48c7ce){_0x3f4e51[_0x349a('0x4e')](_0x40917b,_0x3f4e51[_0x349a('0xc')][_0x40917b[_0x349a('0x4f')]])[_0x349a('0x43')](function(_0x5147c2){ut[_0x349a('0x40')]('[Fax][execOriginate][success]',_0x5147c2);_0xe1f958(ut['message'](_0x349a('0x50')));})[_0x349a('0x39')](function(_0x42a425){ut['logger'](_0x349a('0x51'),_0x42a425);updateStatus(_0x40917b);_0x48c7ce(ut[_0x349a('0x31')]('Fax\x20failed'));});});};Fax[_0x349a('0x1a')][_0x349a('0x52')]=function(_0x4e8012){var _0xdafd95=this;return new BPromise(function(_0x319494,_0x380c8c){var _0x56b71e=_0xdafd95[_0x349a('0x53')](_0xdafd95[_0x349a('0xc')][_0x4e8012[_0x349a('0x4f')]][_0x349a('0x54')],_0x4e8012);if(_0x56b71e['isValid']){_0x319494(ut['message'](_0x349a('0x55')));}else{_0x380c8c(ut[_0x349a('0x31')](_0x56b71e[_0x349a('0x31')]));}});};function originate(_0x1e52ab,_0x2ad9aa,_0x142f8b){return new BPromise(function(_0x1a0979,_0x264908){if(_0x142f8b){var _0x44c49b=util['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[_0x349a('0x32')](_0x1e52ab[_0x349a('0x4')])['name'],_0x1e52ab[_0x349a('0x4')]);gs['execute'](_0x44c49b)[_0x349a('0x43')](function(){_0x1e52ab[_0x349a('0x4')]=util['format']('%s/%s.tif',path[_0x349a('0x32')](_0x1e52ab[_0x349a('0x4')])[_0x349a('0x56')],path[_0x349a('0x32')](_0x1e52ab[_0x349a('0x4')])[_0x349a('0x1f')]);_0x2ad9aa['XMF-PATH']=_0x1e52ab[_0x349a('0x4')];ut[_0x349a('0x40')](_0x349a('0x57'),'');ami[_0x349a('0x58')](ut[_0x349a('0x59')](_0x1e52ab,_0x2ad9aa))[_0x349a('0x43')](function(_0x19feaa){_0x1a0979(_0x19feaa);})[_0x349a('0x39')](function(_0x55139f){_0x264908(_0x55139f);});})[_0x349a('0x39')](function(_0x2eadca){_0x264908(_0x2eadca);});}else{ami[_0x349a('0x58')](ut[_0x349a('0x59')](_0x1e52ab,_0x2ad9aa))[_0x349a('0x43')](function(_0x215283){_0x1a0979(_0x215283);})[_0x349a('0x39')](function(_0x1ef138){_0x264908(_0x1ef138);});}});}Fax[_0x349a('0x1a')][_0x349a('0x4e')]=function(_0x333f0b,_0x36efbf){var _0x3b3a5d=this;return new BPromise(function(_0xe45409,_0x113314){var _0x921487=uuid['v4']();var _0x18a8ae=ut[_0x349a('0x5a')](_0x333f0b,_0x36efbf);_0x3b3a5d[_0x349a('0x22')][_0x921487]=new Action(_0x921487,_0x36efbf,_0x333f0b);var _0x54fee0=_0x3b3a5d[_0x349a('0x22')][_0x921487];if(path[_0x349a('0x32')](_0x333f0b[_0x349a('0x4')])['ext']===_0x349a('0x33')){originate(_0x54fee0,_0x18a8ae,!![])[_0x349a('0x43')](function(_0x4cc617){_0xe45409(_0x4cc617);})['catch'](function(_0x3194e1){_0x113314(_0x3194e1);});}else{originate(_0x54fee0,_0x18a8ae,![])['then'](function(_0x47d445){_0xe45409(_0x47d445);})[_0x349a('0x39')](function(_0x386088){_0x113314(_0x386088);});}});};Fax['prototype'][_0x349a('0x5b')]=function(_0x8059a7){return!_['isNil'](_0x8059a7)&&!_[_0x349a('0x5c')](_0x8059a7['name'])&&!_[_0x349a('0x5c')](_0x8059a7[_0x349a('0x5d')])&&_0x8059a7[_0x349a('0x5d')]&&!_[_0x349a('0x5c')](this[_0x349a('0xd')][util[_0x349a('0x5e')](_0x349a('0x5f'),_0x8059a7['name'])])&&!_['isNil'](this['trunks'][util[_0x349a('0x5e')]('SIP/%s',_0x8059a7['name'])]['status'])&&(this['trunks'][util[_0x349a('0x5e')]('SIP/%s',_0x8059a7['name'])][_0x349a('0x2a')]===_0x349a('0x60')||this['trunks'][util[_0x349a('0x5e')]('SIP/%s',_0x8059a7[_0x349a('0x1f')])][_0x349a('0x2a')]==='unmonitored');};Fax[_0x349a('0x1a')]['checkTrunk']=function(_0x39d7fd,_0x5b7cff){if(!this[_0x349a('0x5b')](_0x39d7fd)){ut[_0x349a('0x40')](_0x349a('0x61'),_['isNil'](_0x39d7fd)?'':_0x39d7fd[_0x349a('0x1f')]+_0x349a('0x62'));return{'isValid':![],'message':_0x349a('0x63')};}if(_[_0x349a('0x5c')](_0x5b7cff[_0x349a('0x36')])){ut[_0x349a('0x40')](_0x349a('0x64'),JSON[_0x349a('0x38')](_0x5b7cff));return{'isValid':![],'message':_0x349a('0x65')};}if(_[_0x349a('0x5c')](_0x5b7cff[_0x349a('0x4')])){ut[_0x349a('0x40')](_0x349a('0x66'),JSON[_0x349a('0x38')](_0x5b7cff));return{'isValid':![],'message':_0x349a('0x67')};}return{'isValid':!![],'message':_0x349a('0x68')};};module[_0x349a('0x69')]=Fax; \ No newline at end of file +var _0x61c3=['originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','catch','error','\x20receiveFax\x20','stringify','merge','pick','response','reason','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','logger','updateStatus','AttachmentId','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','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','execute','dir','XMF-PATH','Action','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','Trunk\x20not\x20working','fax','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','tiff2pdf','./util/gs','../../../config/logger','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x61c3,0x1c8));var _0x361c=function(_0x4c0922,_0x39cdda){_0x4c0922=_0x4c0922-0x0;var _0x12a55f=_0x61c3[_0x4c0922];return _0x12a55f;};'use strict';var util=require(_0x361c('0x0'));var _=require(_0x361c('0x1'));var BPromise=require(_0x361c('0x2'));var uuid=require(_0x361c('0x3'));var moment=require(_0x361c('0x4'));var path=require('path');var tiff2pdf=require(_0x361c('0x5'));var gs=require(_0x361c('0x6'));var logger=require(_0x361c('0x7'))('fax');var ami=require('../ami');var rpcDb=require(_0x361c('0x8'));var Channel=require(_0x361c('0x9'));var ut=require(_0x361c('0xa'));var Action=require('./action');var faxAccount=require(_0x361c('0xb'));var attachment=require(_0x361c('0xc'));var faxMessage=require(_0x361c('0xd'));function Fax(_0xf6746f){this[_0x361c('0xe')]={};this[_0x361c('0xf')]=_0xf6746f[_0x361c('0xf')];this['trunks']=_0xf6746f[_0x361c('0x10')];this[_0x361c('0x11')]={};ami['on'](_0x361c('0x12'),this[_0x361c('0x13')]['bind'](this));ami['on'](_0x361c('0x14'),this[_0x361c('0x15')][_0x361c('0x16')](this));ami['on'](_0x361c('0x17'),this['syncNewState'][_0x361c('0x16')](this));ami['on'](_0x361c('0x18'),this[_0x361c('0x19')]['bind'](this));ami['on'](_0x361c('0x1a'),this[_0x361c('0x1b')]['bind'](this));ami['on'](_0x361c('0x1c'),this[_0x361c('0x1d')][_0x361c('0x16')](this));ami['on'](_0x361c('0x1e'),this[_0x361c('0x1f')][_0x361c('0x16')](this));ami['on'](_0x361c('0x20'),this[_0x361c('0x21')][_0x361c('0x16')](this));}Fax[_0x361c('0x22')][_0x361c('0x13')]=function(_0x4bfd1b){if(_0x4bfd1b[_0x361c('0x23')]===_0x361c('0x24')){for(var _0x1ef4b8 in this['faxAccounts']){if(this[_0x361c('0xf')][_0x361c('0x25')](_0x1ef4b8)){if(_0x4bfd1b['exten']===this[_0x361c('0xf')][_0x1ef4b8][_0x361c('0x26')]){this[_0x361c('0xe')][_0x4bfd1b[_0x361c('0x27')]]={};this[_0x361c('0xe')][_0x4bfd1b[_0x361c('0x27')]][_0x361c('0x28')]=_0x4bfd1b[_0x361c('0x28')];this[_0x361c('0xe')][_0x4bfd1b[_0x361c('0x27')]]['id']=this[_0x361c('0xf')][_0x1ef4b8]['id'];this['channels'][_0x4bfd1b['uniqueid']][_0x361c('0x29')]=this[_0x361c('0xf')][_0x1ef4b8][_0x361c('0x29')];logger[_0x361c('0x2a')](_0x4bfd1b[_0x361c('0x27')],'\x20syncNewchannel\x20');}}}}if(this[_0x361c('0x11')][_0x4bfd1b['uniqueid']]){this['channels'][_0x4bfd1b['uniqueid']]={};this['channels'][_0x4bfd1b[_0x361c('0x27')]]['channel']=_0x4bfd1b[_0x361c('0x28')];logger['info'](_0x4bfd1b[_0x361c('0x27')],'\x20syncNewchannel\x20');}};Fax[_0x361c('0x22')][_0x361c('0x15')]=function(_0x116089){if(this[_0x361c('0xe')][_0x116089['uniqueid']]){for(var _0x4dae3c in _0x116089[_0x361c('0x2b')]){if(_0x116089[_0x361c('0x2b')]['hasOwnProperty'](_0x4dae3c)){this[_0x361c('0xe')][_0x116089[_0x361c('0x27')]][_0x4dae3c]=_0x116089[_0x361c('0x2c')];}}}};Fax[_0x361c('0x22')][_0x361c('0x2d')]=function(_0x1b0773){if(this[_0x361c('0xe')][_0x1b0773[_0x361c('0x27')]]){this[_0x361c('0xe')][_0x1b0773[_0x361c('0x27')]][_0x361c('0x2e')]=_0x1b0773[_0x361c('0x2e')];this[_0x361c('0xe')][_0x1b0773[_0x361c('0x27')]]['channelstatedesc']=_0x1b0773[_0x361c('0x2f')];}};Fax[_0x361c('0x22')][_0x361c('0x19')]=function(_0x5d972d){if(this['channels'][_0x5d972d[_0x361c('0x27')]]){for(var _0x5954c3 in _0x5d972d[_0x361c('0x2b')]){if(_0x5d972d[_0x361c('0x2b')]['hasOwnProperty'](_0x5954c3)){this[_0x361c('0xe')][_0x5d972d['uniqueid']][_0x5954c3]=_0x5d972d[_0x361c('0x2c')];}}}};Fax[_0x361c('0x22')][_0x361c('0x1b')]=function(_0x3c276c){if(this['channels'][_0x3c276c[_0x361c('0x27')]]){this[_0x361c('0xe')][_0x3c276c['uniqueid']][_0x361c('0x30')]=_0x3c276c[_0x361c('0x30')];this[_0x361c('0xe')][_0x3c276c[_0x361c('0x27')]][_0x361c('0x31')]=_0x3c276c[_0x361c('0x31')];this[_0x361c('0xe')][_0x3c276c[_0x361c('0x27')]][_0x361c('0x26')]=_0x3c276c[_0x361c('0x26')];this[_0x361c('0xe')][_0x3c276c[_0x361c('0x27')]]['filename']=_0x3c276c[_0x361c('0x32')];logger['info'](_0x3c276c[_0x361c('0x27')],_0x361c('0x33'));}};Fax['prototype'][_0x361c('0x1d')]=function(_0x40b865){var _0x27eab7=this;if(this[_0x361c('0xe')][_0x40b865[_0x361c('0x27')]]){var _0x46c4da=this['channels'][_0x40b865[_0x361c('0x27')]]['id'];this['channels'][_0x40b865[_0x361c('0x27')]][_0x361c('0x34')]=_0x40b865['remotestationid'];this[_0x361c('0xe')][_0x40b865[_0x361c('0x27')]][_0x361c('0x35')]=_0x40b865[_0x361c('0x35')];this[_0x361c('0xe')][_0x40b865[_0x361c('0x27')]][_0x361c('0x26')]=_0x40b865[_0x361c('0x26')];this[_0x361c('0xe')][_0x40b865[_0x361c('0x27')]][_0x361c('0x36')]=_0x40b865['resolution'];this[_0x361c('0xe')][_0x40b865[_0x361c('0x27')]]['transferrate']=_0x40b865['transferrate'];this['channels'][_0x40b865[_0x361c('0x27')]][_0x361c('0x32')]=_0x40b865[_0x361c('0x32')];this[_0x361c('0xe')][_0x40b865[_0x361c('0x27')]][_0x361c('0x37')]=_0x40b865['calleridnum'];if(this['channels'][_0x40b865[_0x361c('0x27')]][_0x361c('0x35')]>0x0){tiff2pdf(_0x40b865['filename'],_0x361c('0x38'),function(_0x4ea09e){logger[_0x361c('0x2a')](_0x40b865[_0x361c('0x27')],'\x20result\x20conversion\x20file\x20',_0x4ea09e[_0x361c('0x39')]);attachment[_0x361c('0x3a')]({'name':path[_0x361c('0x3b')](_0x40b865[_0x361c('0x32')])[_0x361c('0x29')],'basename':path[_0x361c('0x3b')](_0x40b865[_0x361c('0x32')])[_0x361c('0x29')]+_0x361c('0x3c'),'type':_0x361c('0x3d')})[_0x361c('0x3e')](function(_0x330680){faxAccount['notify'](_0x46c4da,{'from':_0x40b865[_0x361c('0x37')],'mapKey':'fax','body':path['parse'](_0x40b865['filename'])[_0x361c('0x29')]+_0x361c('0x3c'),'AttachmentId':_0x330680['id']})[_0x361c('0x3f')](function(_0x4fe952){logger[_0x361c('0x40')](_0x40b865[_0x361c('0x27')],'\x20notify\x20',JSON['stringify'](_0x4fe952));});})['catch'](function(_0x3bb5a8){logger[_0x361c('0x40')](_0x40b865[_0x361c('0x27')],_0x361c('0x41'),JSON[_0x361c('0x42')](_0x3bb5a8));});});}logger[_0x361c('0x2a')](_0x40b865[_0x361c('0x27')],_0x361c('0x41'));}};Fax[_0x361c('0x22')][_0x361c('0x21')]=function(_0x107c9c){if(this[_0x361c('0x11')][_0x107c9c['uniqueid']]){_[_0x361c('0x43')](this[_0x361c('0xe')][_0x107c9c[_0x361c('0x27')]],_[_0x361c('0x44')](_0x107c9c,[_0x361c('0x45'),_0x361c('0x46')]));}};function updateStatus(_0x2f1964){if(_0x2f1964['AttachmentId']){faxMessage[_0x361c('0x47')](_0x2f1964['AttachmentId'],{'failMessage':_0x361c('0x48')})[_0x361c('0x3e')](function(_0x3d56cd){ut['logger'](_0x361c('0x49'),_0x3d56cd);})[_0x361c('0x3f')](function(_0x264ffc){ut['logger'](_0x361c('0x4a'),_0x264ffc);});}else{ut[_0x361c('0x4b')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x361c('0x22')][_0x361c('0x4c')]=function(_0x63f97a,_0x5a02aa,_0x22cf7a){var _0x4ca7a1=this;var _0x4c3644={};if(_0x5a02aa){_0x4c3644={'read':_0x5a02aa};}else{_0x4c3644={'failMessage':_0x22cf7a};}if(this[_0x361c('0x11')][_0x63f97a][_0x361c('0x4d')]){faxMessage[_0x361c('0x47')](this[_0x361c('0x11')][_0x63f97a]['AttachmentId'],_0x4c3644)[_0x361c('0x3e')](function(_0xde833d){ut[_0x361c('0x4b')](_0x361c('0x4e'),_0xde833d);})[_0x361c('0x3f')](function(_0x56b26a){ut['logger'](_0x361c('0x4f'),_0x56b26a);})[_0x361c('0x50')](function(){delete _0x4ca7a1[_0x361c('0xe')][_0x63f97a];delete _0x4ca7a1[_0x361c('0x11')][_0x63f97a];});}else{ut[_0x361c('0x4b')](_0x361c('0x51'));delete this[_0x361c('0xe')][_0x63f97a];delete this[_0x361c('0x11')][_0x63f97a];}};Fax[_0x361c('0x22')][_0x361c('0x1f')]=function(_0x3129d0){var _0x2da5cc=this;if(this[_0x361c('0xe')][_0x3129d0['uniqueid']]){if(this[_0x361c('0x11')][_0x3129d0[_0x361c('0x27')]]){this[_0x361c('0xe')][_0x3129d0[_0x361c('0x27')]]['id']=this[_0x361c('0x11')][_0x3129d0[_0x361c('0x27')]]['id'];this[_0x361c('0xe')][_0x3129d0[_0x361c('0x27')]][_0x361c('0x29')]=this[_0x361c('0x11')][_0x3129d0[_0x361c('0x27')]][_0x361c('0x29')];}logger[_0x361c('0x2a')](_0x3129d0[_0x361c('0x27')],this['actions'][_0x3129d0[_0x361c('0x27')]]?_0x361c('0x52'):_0x361c('0x53'),JSON['stringify'](this[_0x361c('0xe')][_0x3129d0[_0x361c('0x27')]]));if(this[_0x361c('0x11')][_0x3129d0[_0x361c('0x27')]]){if(this[_0x361c('0xe')][_0x3129d0['uniqueid']][_0x361c('0x54')]>0x0&&this['channels'][_0x3129d0['uniqueid']][_0x361c('0x1a')]===_0x361c('0x55')){this[_0x361c('0x4c')](_0x3129d0[_0x361c('0x27')],!![]);}else{this[_0x361c('0x4c')](_0x3129d0[_0x361c('0x27')],![],this['channels'][_0x3129d0['uniqueid']][_0x361c('0x56')]?_0x361c('0x57')+this['channels'][_0x3129d0[_0x361c('0x27')]][_0x361c('0x56')]:_0x361c('0x58'));}}}};Fax[_0x361c('0x22')][_0x361c('0x59')]=function(_0x59c48d){var _0x76e5f2=this;return new BPromise(function(_0x38a15b,_0x431931){_0x76e5f2[_0x361c('0x5a')](_0x59c48d,_0x76e5f2[_0x361c('0xf')][_0x59c48d[_0x361c('0x5b')]])[_0x361c('0x3e')](function(_0x266986){ut[_0x361c('0x4b')](_0x361c('0x5c'),_0x266986);_0x38a15b(ut[_0x361c('0x39')](_0x361c('0x5d')));})['catch'](function(_0x3e436e){ut[_0x361c('0x4b')](_0x361c('0x5e'),_0x3e436e);updateStatus(_0x59c48d);_0x431931(ut[_0x361c('0x39')](_0x361c('0x5f')));});});};Fax[_0x361c('0x22')][_0x361c('0x60')]=function(_0x5aa887){var _0x39a967=this;return new BPromise(function(_0x4272dd,_0xb28240){var _0x86ac88=_0x39a967[_0x361c('0x61')](_0x39a967[_0x361c('0xf')][_0x5aa887['FaxAccountId']]['Trunk'],_0x5aa887);if(_0x86ac88['isValid']){_0x4272dd(ut[_0x361c('0x39')](_0x361c('0x62')));}else{_0xb28240(ut[_0x361c('0x39')](_0x86ac88[_0x361c('0x39')]));}});};function originate(_0x2ab992,_0x588ac6,_0x354ec6){return new BPromise(function(_0x37387c,_0x3ab834){if(_0x354ec6){var _0x354a69=util[_0x361c('0x63')](_0x361c('0x64'),path['parse'](_0x2ab992[_0x361c('0x65')])[_0x361c('0x29')],_0x2ab992['path']);gs[_0x361c('0x66')](_0x354a69)[_0x361c('0x3e')](function(){_0x2ab992[_0x361c('0x65')]=util[_0x361c('0x63')]('%s/%s.tif',path[_0x361c('0x3b')](_0x2ab992['path'])[_0x361c('0x67')],path[_0x361c('0x3b')](_0x2ab992[_0x361c('0x65')])[_0x361c('0x29')]);_0x588ac6[_0x361c('0x68')]=_0x2ab992['path'];ut[_0x361c('0x4b')]('Convert\x20pdf\x20to\x20tif','');ami[_0x361c('0x69')](ut['variablesAction'](_0x2ab992,_0x588ac6))[_0x361c('0x3e')](function(_0xe4460){_0x37387c(_0xe4460);})[_0x361c('0x3f')](function(_0x5bbadc){_0x3ab834(_0x5bbadc);});})['catch'](function(_0x1020fb){_0x3ab834(_0x1020fb);});}else{ami[_0x361c('0x69')](ut['variablesAction'](_0x2ab992,_0x588ac6))[_0x361c('0x3e')](function(_0x125611){_0x37387c(_0x125611);})[_0x361c('0x3f')](function(_0x36e1a7){_0x3ab834(_0x36e1a7);});}});}Fax['prototype'][_0x361c('0x5a')]=function(_0x442e32,_0x278d9d){var _0x4fb92a=this;return new BPromise(function(_0x4043f0,_0x4929a6){var _0x3f7f8a=uuid['v4']();var _0x3f5eae=ut[_0x361c('0x6a')](_0x442e32,_0x278d9d);_0x4fb92a[_0x361c('0x11')][_0x3f7f8a]=new Action(_0x3f7f8a,_0x278d9d,_0x442e32);var _0x522011=_0x4fb92a['actions'][_0x3f7f8a];if(path['parse'](_0x442e32[_0x361c('0x65')])[_0x361c('0x6b')]==='.pdf'){originate(_0x522011,_0x3f5eae,!![])['then'](function(_0x535fb6){_0x4043f0(_0x535fb6);})[_0x361c('0x3f')](function(_0xa1ef5b){_0x4929a6(_0xa1ef5b);});}else{originate(_0x522011,_0x3f5eae,![])[_0x361c('0x3e')](function(_0x5bb9ef){_0x4043f0(_0x5bb9ef);})[_0x361c('0x3f')](function(_0x5ec687){_0x4929a6(_0x5ec687);});}});};Fax['prototype']['isTrunkReachable']=function(_0x132077){return!_[_0x361c('0x6c')](_0x132077)&&!_['isNil'](_0x132077[_0x361c('0x29')])&&!_[_0x361c('0x6c')](_0x132077[_0x361c('0x6d')])&&_0x132077[_0x361c('0x6d')]&&!_[_0x361c('0x6c')](this[_0x361c('0x10')][util[_0x361c('0x63')](_0x361c('0x6e'),_0x132077[_0x361c('0x29')])])&&!_[_0x361c('0x6c')](this[_0x361c('0x10')][util['format']('SIP/%s',_0x132077[_0x361c('0x29')])][_0x361c('0x31')])&&(this[_0x361c('0x10')][util['format']('SIP/%s',_0x132077[_0x361c('0x29')])]['status']===_0x361c('0x6f')||this[_0x361c('0x10')][util[_0x361c('0x63')]('SIP/%s',_0x132077[_0x361c('0x29')])]['status']===_0x361c('0x70'));};Fax[_0x361c('0x22')][_0x361c('0x61')]=function(_0x2e06b4,_0x4f7c78){if(!this[_0x361c('0x71')](_0x2e06b4)){ut[_0x361c('0x4b')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x361c('0x6c')](_0x2e06b4)?'':_0x2e06b4[_0x361c('0x29')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x361c('0x72')};}if(_[_0x361c('0x6c')](_0x4f7c78[_0x361c('0x73')])){ut['logger'](_0x361c('0x74'),JSON['stringify'](_0x4f7c78));return{'isValid':![],'message':_0x361c('0x75')};}if(_[_0x361c('0x6c')](_0x4f7c78[_0x361c('0x65')])){ut[_0x361c('0x4b')](_0x361c('0x76'),JSON[_0x361c('0x42')](_0x4f7c78));return{'isValid':![],'message':_0x361c('0x77')};}return{'isValid':!![],'message':_0x361c('0x78')};};module[_0x361c('0x79')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index a5a2a0c..f355596 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 _0x4da6=['preview','lodash','../rpc/faxAccount','error','inspect','resolve','catch','[Notify]\x20','util','bluebird','../../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4da6,0x19f));var _0x64da=function(_0x74b51,_0x29d611){_0x74b51=_0x74b51-0x0;var _0x4d8294=_0x4da6[_0x74b51];return _0x4d8294;};'use strict';var util=require(_0x64da('0x0'));var BPromise=require(_0x64da('0x1'));var logger=require(_0x64da('0x2'))(_0x64da('0x3'));var _=require(_0x64da('0x4'));var faxAccount=require(_0x64da('0x5'));function loggerCatch(_0x571d11){return function(_0x3ee117){logger[_0x64da('0x6')](_0x571d11,util[_0x64da('0x7')](_0x3ee117,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x3ee2a9,_0x368088){return BPromise[_0x64da('0x8')]()['then'](faxAccount['notify'](_0x3ee2a9,_0x368088))[_0x64da('0x9')](loggerCatch(_0x64da('0xa')));}; \ No newline at end of file +var _0x9963=['lodash','../rpc/faxAccount','inspect','notify','resolve','then','catch','[Notify]\x20','util','bluebird','../../../config/logger'];(function(_0x1a08cf,_0x186382){var _0x4174b7=function(_0x263861){while(--_0x263861){_0x1a08cf['push'](_0x1a08cf['shift']());}};_0x4174b7(++_0x186382);}(_0x9963,0x1c0));var _0x3996=function(_0x1b745b,_0x3e2d40){_0x1b745b=_0x1b745b-0x0;var _0x120a9d=_0x9963[_0x1b745b];return _0x120a9d;};'use strict';var util=require(_0x3996('0x0'));var BPromise=require(_0x3996('0x1'));var logger=require(_0x3996('0x2'))('preview');var _=require(_0x3996('0x3'));var faxAccount=require(_0x3996('0x4'));function loggerCatch(_0xfe2158){return function(_0x3129a2){logger['error'](_0xfe2158,util[_0x3996('0x5')](_0x3129a2,{'showHidden':![],'depth':null}));};}exports[_0x3996('0x6')]=function(_0x18b041,_0x2dc83c){return BPromise[_0x3996('0x7')]()[_0x3996('0x8')](faxAccount[_0x3996('0x6')](_0x18b041,_0x2dc83c))[_0x3996('0x9')](loggerCatch(_0x3996('0xa')));}; \ 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 0cf8ab6..d396f8d 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 _0x38c7=['inspect','util','../../../../config/logger','fax','bluebird','exec','execute','info','Exec\x20gs'];(function(_0x52977a,_0x55c0fc){var _0x40ff34=function(_0xe78186){while(--_0xe78186){_0x52977a['push'](_0x52977a['shift']());}};_0x40ff34(++_0x55c0fc);}(_0x38c7,0xa3));var _0x738c=function(_0x18c60e,_0x5e2258){_0x18c60e=_0x18c60e-0x0;var _0x27bc35=_0x38c7[_0x18c60e];return _0x27bc35;};'use strict';var util=require(_0x738c('0x0'));var logger=require(_0x738c('0x1'))(_0x738c('0x2'));var BPromise=require(_0x738c('0x3'));var exec=require('child_process')[_0x738c('0x4')];exports[_0x738c('0x5')]=function(_0x75dea9){return new BPromise(function(_0x28653c,_0x58d636){exec(_0x75dea9,function(_0x36146a,_0x3e2346,_0x4cbdc2){logger[_0x738c('0x6')]('Exec\x20gs',_0x3e2346);if(_0x36146a){logger[_0x738c('0x6')](_0x738c('0x7'),'\x20Error\x20:',util[_0x738c('0x8')](_0x36146a,{'showHidden':![],'depth':null}),_0x3e2346,_0x4cbdc2);_0x58d636(_0x36146a);}_0x28653c(_0x3e2346);});});}; \ No newline at end of file +var _0xef8b=['inspect','util','../../../../config/logger','fax','bluebird','child_process','execute','Exec\x20gs','info'];(function(_0x4df7a9,_0x2f53dc){var _0x45832c=function(_0x530ce6){while(--_0x530ce6){_0x4df7a9['push'](_0x4df7a9['shift']());}};_0x45832c(++_0x2f53dc);}(_0xef8b,0x160));var _0xbef8=function(_0x1196bd,_0xba4aea){_0x1196bd=_0x1196bd-0x0;var _0x26014f=_0xef8b[_0x1196bd];return _0x26014f;};'use strict';var util=require(_0xbef8('0x0'));var logger=require(_0xbef8('0x1'))(_0xbef8('0x2'));var BPromise=require(_0xbef8('0x3'));var exec=require(_0xbef8('0x4'))['exec'];exports[_0xbef8('0x5')]=function(_0x24ff5e){return new BPromise(function(_0x115c0b,_0x28c8d0){exec(_0x24ff5e,function(_0x919a1b,_0x11f542,_0x1e4d75){logger['info'](_0xbef8('0x6'),_0x11f542);if(_0x919a1b){logger[_0xbef8('0x7')](_0xbef8('0x6'),'\x20Error\x20:',util[_0xbef8('0x8')](_0x919a1b,{'showHidden':![],'depth':null}),_0x11f542,_0x1e4d75);_0x28c8d0(_0x919a1b);}_0x115c0b(_0x11f542);});});}; \ 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 be01e11..e5f5092 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 _0xa64a=['gateway','t38timeout','localstationid','uniqueid','channel','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','fax','logger','inspect','addVariables','ecm','headerinfo','minrate','maxrate','\x22%s\x22','modem'];(function(_0x133243,_0x5509f6){var _0x15beb2=function(_0x742932){while(--_0x742932){_0x133243['push'](_0x133243['shift']());}};_0x15beb2(++_0x5509f6);}(_0xa64a,0xa7));var _0xaa64=function(_0x12441f,_0x59468c){_0x12441f=_0x12441f-0x0;var _0x524fd5=_0xa64a[_0x12441f];return _0x524fd5;};'use strict';var util=require(_0xaa64('0x0'));var _=require(_0xaa64('0x1'));var moment=require(_0xaa64('0x2'));var logger=require('../../../../config/logger')(_0xaa64('0x3'));exports['message']=function(_0x43d6c4){return{'message':_0x43d6c4};};exports[_0xaa64('0x4')]=function(_0x5c760e,_0x35f011){logger['info'](_0x5c760e,util[_0xaa64('0x5')](_0x35f011,{'showHidden':![],'depth':null}));};exports[_0xaa64('0x6')]=function(_0x58e2b2,_0x3cc04a){var _0x5274c6={'XMF-ECM':_0x3cc04a[_0xaa64('0x7')],'XMF-HEADERINFO':_0x3cc04a[_0xaa64('0x8')],'XMF-MINRATE':_0x3cc04a[_0xaa64('0x9')],'XMF-MAXRATE':_0x3cc04a[_0xaa64('0xa')],'XMF-MODEM':util['format'](_0xaa64('0xb'),_0x3cc04a[_0xaa64('0xc')]),'XMF-GATEWAY':_0x3cc04a[_0xaa64('0xd')],'XMF-FAXDETECT':_0x3cc04a['faxdetect'],'XMF-T38TIMEOUT':_0x3cc04a[_0xaa64('0xe')],'XMF-LOCALSTATIONID':_0x3cc04a[_0xaa64('0xf')],'XMF-PATH':_0x58e2b2['path']};return _0x5274c6;};exports['variablesAction']=function(_0x38efda,_0x210c38){return{'actionid':_0x38efda[_0xaa64('0x10')],'action':'originate','channel':_0x38efda[_0xaa64('0x11')],'Exten':'xcally-motion-fax','Context':_0xaa64('0x12'),'Priority':'1','callerid':util['format'](_0xaa64('0x13'),_0x38efda['headerinfo']?_0x38efda[_0xaa64('0x8')]:'',_0x38efda[_0xaa64('0xf')]),'variable':_0x210c38,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x38efda[_0xaa64('0x10')]};}; \ No newline at end of file +var _0x13cd=['inspect','addVariables','ecm','headerinfo','maxrate','\x22%s\x22','modem','gateway','faxdetect','t38timeout','path','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','localstationid','util','lodash','moment','../../../../config/logger','fax','message','logger','info'];(function(_0x5771ef,_0x4605d3){var _0x41c0ed=function(_0x4fab62){while(--_0x4fab62){_0x5771ef['push'](_0x5771ef['shift']());}};_0x41c0ed(++_0x4605d3);}(_0x13cd,0x118));var _0xd13c=function(_0x44f31f,_0x1c0cb2){_0x44f31f=_0x44f31f-0x0;var _0xadb171=_0x13cd[_0x44f31f];return _0xadb171;};'use strict';var util=require(_0xd13c('0x0'));var _=require(_0xd13c('0x1'));var moment=require(_0xd13c('0x2'));var logger=require(_0xd13c('0x3'))(_0xd13c('0x4'));exports[_0xd13c('0x5')]=function(_0x37017b){return{'message':_0x37017b};};exports[_0xd13c('0x6')]=function(_0x3f8f6f,_0x39b568){logger[_0xd13c('0x7')](_0x3f8f6f,util[_0xd13c('0x8')](_0x39b568,{'showHidden':![],'depth':null}));};exports[_0xd13c('0x9')]=function(_0x3fd9fc,_0x35c50e){var _0xc50c7e={'XMF-ECM':_0x35c50e[_0xd13c('0xa')],'XMF-HEADERINFO':_0x35c50e[_0xd13c('0xb')],'XMF-MINRATE':_0x35c50e['minrate'],'XMF-MAXRATE':_0x35c50e[_0xd13c('0xc')],'XMF-MODEM':util['format'](_0xd13c('0xd'),_0x35c50e[_0xd13c('0xe')]),'XMF-GATEWAY':_0x35c50e[_0xd13c('0xf')],'XMF-FAXDETECT':_0x35c50e[_0xd13c('0x10')],'XMF-T38TIMEOUT':_0x35c50e[_0xd13c('0x11')],'XMF-LOCALSTATIONID':_0x35c50e['localstationid'],'XMF-PATH':_0x3fd9fc[_0xd13c('0x12')]};return _0xc50c7e;};exports['variablesAction']=function(_0x575333,_0x461a80){return{'actionid':_0x575333['uniqueid'],'action':_0xd13c('0x13'),'channel':_0x575333[_0xd13c('0x14')],'Exten':_0xd13c('0x15'),'Context':'from-sip','Priority':'1','callerid':util['format'](_0xd13c('0x16'),_0x575333['headerinfo']?_0x575333['headerinfo']:'',_0x575333[_0xd13c('0x17')]),'variable':_0x461a80,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x575333['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 0793d91..c1e772f 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 _0xc4cc=['getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','log','sync','catch','util','moment','./server','./report','./acw','./dialer','./fax','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/desk','./rpc/integrations/zoho','hour','get','then','getAgents','initAgents','getTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports'];(function(_0x2977e1,_0x4b43fc){var _0x56acda=function(_0x3a4b1b){while(--_0x3a4b1b){_0x2977e1['push'](_0x2977e1['shift']());}};_0x56acda(++_0x4b43fc);}(_0xc4cc,0x110));var _0xcc4c=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc4cc[_0x432682];return _0x463d05;};'use strict';var BPromise=require('bluebird');var util=require(_0xcc4c('0x0'));var moment=require(_0xcc4c('0x1'));var server=require(_0xcc4c('0x2'));var Realtime=require('./realtime');var Report=require(_0xcc4c('0x3'));var Acw=require(_0xcc4c('0x4'));var Trigger=require('./trigger');var Dialer=require(_0xcc4c('0x5'));var Preview=require('./preview');var Fax=require(_0xcc4c('0x6'));var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xcc4c('0x7'));var voiceCallReport=require(_0xcc4c('0x8'));var trunk=require('./rpc/trunk');var trigger=require(_0xcc4c('0x9'));var template=require(_0xcc4c('0xa'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xcc4c('0xb'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xcc4c('0xc'));var zendesk=require(_0xcc4c('0xd'));var salesforce=require(_0xcc4c('0xe'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xcc4c('0xf'));var zoho=require(_0xcc4c('0x10'));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()['get'](_0xcc4c('0x11'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xcc4c('0x12')](_0xcc4c('0x11'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xcc4c('0x13')](user[_0xcc4c('0x14')]())[_0xcc4c('0x13')](realtime[_0xcc4c('0x15')]())['then'](user[_0xcc4c('0x16')]())[_0xcc4c('0x13')](realtime['initTelephones']())[_0xcc4c('0x13')](trunk[_0xcc4c('0x17')]())[_0xcc4c('0x13')](realtime[_0xcc4c('0x18')]())[_0xcc4c('0x13')](voiceQueue['getVoiceQueues']())['then'](realtime[_0xcc4c('0x19')]())[_0xcc4c('0x13')](trigger[_0xcc4c('0x1a')]())[_0xcc4c('0x13')](realtime['initTriggers']())['then'](template[_0xcc4c('0x1b')]())[_0xcc4c('0x13')](realtime[_0xcc4c('0x1c')]())['then'](zendesk[_0xcc4c('0x1d')]())[_0xcc4c('0x13')](realtime[_0xcc4c('0x1e')]())[_0xcc4c('0x13')](salesforce[_0xcc4c('0x1f')]())['then'](realtime['initSalesforceAccounts']())[_0xcc4c('0x13')](sugarcrm[_0xcc4c('0x20')]())['then'](realtime[_0xcc4c('0x21')]())['then'](freshdesk[_0xcc4c('0x22')]())['then'](realtime[_0xcc4c('0x23')]())[_0xcc4c('0x13')](desk['getDeskAccounts']())['then'](realtime[_0xcc4c('0x24')]())['then'](zoho[_0xcc4c('0x25')]())[_0xcc4c('0x13')](realtime['initZohoAccounts']())[_0xcc4c('0x13')](vtiger[_0xcc4c('0x26')]())['then'](realtime['initVtigerAccounts']())[_0xcc4c('0x13')](campaign[_0xcc4c('0x27')]())[_0xcc4c('0x13')](realtime['initCampaigns']())[_0xcc4c('0x13')](voiceExtension[_0xcc4c('0x28')]())[_0xcc4c('0x13')](realtime[_0xcc4c('0x29')]())[_0xcc4c('0x13')](faxAccount[_0xcc4c('0x2a')]())[_0xcc4c('0x13')](realtime[_0xcc4c('0x2b')]())['then'](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0xcc4c('0x13')](voiceQueueReport[_0xcc4c('0x2c')]())[_0xcc4c('0x13')](realtime[_0xcc4c('0x2d')]())['then'](cmHopperHistory[_0xcc4c('0x2e')]())['then'](realtime['initVoiceQueueHopperHistory']())[_0xcc4c('0x13')](cmHopperHistory[_0xcc4c('0x2f')]())[_0xcc4c('0x13')](realtime[_0xcc4c('0x30')]())['then'](voiceCallReport['getVoiceCallReports']())[_0xcc4c('0x13')](realtime[_0xcc4c('0x31')]())[_0xcc4c('0x13')](function(_0x102c80){})['catch'](function(_0x5b3917){console[_0xcc4c('0x32')](_0x5b3917);});}function main(){return server['listen'](realtime,preview,fax)[_0xcc4c('0x13')](function(_0x385c61){return initRealtime();})[_0xcc4c('0x13')](function(){return initParams();})[_0xcc4c('0x13')](function(){report[_0xcc4c('0x33')]();setInterval(initRealtime,0x1388);})[_0xcc4c('0x34')](function(_0x52f24b){console[_0xcc4c('0x32')](_0x52f24b);});}main(); \ No newline at end of file +var _0x4974=['./rpc/integrations/vtiger','get','resolve','then','getAgents','initAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','sync','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk'];(function(_0x48f827,_0x269e8d){var _0xc763f7=function(_0x19769a){while(--_0x19769a){_0x48f827['push'](_0x48f827['shift']());}};_0xc763f7(++_0x269e8d);}(_0x4974,0x147));var _0x4497=function(_0xff6648,_0x40608e){_0xff6648=_0xff6648-0x0;var _0x2b6b96=_0x4974[_0xff6648];return _0x2b6b96;};'use strict';var BPromise=require(_0x4497('0x0'));var util=require(_0x4497('0x1'));var moment=require(_0x4497('0x2'));var server=require(_0x4497('0x3'));var Realtime=require(_0x4497('0x4'));var Report=require(_0x4497('0x5'));var Acw=require(_0x4497('0x6'));var Trigger=require(_0x4497('0x7'));var Dialer=require(_0x4497('0x8'));var Preview=require(_0x4497('0x9'));var Fax=require(_0x4497('0xa'));var user=require(_0x4497('0xb'));var voiceQueue=require(_0x4497('0xc'));var voiceQueueReport=require(_0x4497('0xd'));var voiceCallReport=require(_0x4497('0xe'));var trunk=require(_0x4497('0xf'));var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require(_0x4497('0x10'));var campaign=require(_0x4497('0x11'));var voiceExtension=require(_0x4497('0x12'));var faxAccount=require('./rpc/faxAccount');var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x4497('0x13'));var freshdesk=require(_0x4497('0x14'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x4497('0x15'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x4497('0x16')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x4497('0x17')]()[_0x4497('0x18')](user[_0x4497('0x19')]())[_0x4497('0x18')](realtime[_0x4497('0x1a')]())[_0x4497('0x18')](user[_0x4497('0x1b')]())[_0x4497('0x18')](realtime['initTelephones']())[_0x4497('0x18')](trunk[_0x4497('0x1c')]())[_0x4497('0x18')](realtime[_0x4497('0x1d')]())[_0x4497('0x18')](voiceQueue[_0x4497('0x1e')]())[_0x4497('0x18')](realtime[_0x4497('0x1f')]())[_0x4497('0x18')](trigger[_0x4497('0x20')]())[_0x4497('0x18')](realtime['initTriggers']())[_0x4497('0x18')](template[_0x4497('0x21')]())[_0x4497('0x18')](realtime['initTemplates']())[_0x4497('0x18')](zendesk[_0x4497('0x22')]())['then'](realtime[_0x4497('0x23')]())[_0x4497('0x18')](salesforce[_0x4497('0x24')]())[_0x4497('0x18')](realtime[_0x4497('0x25')]())[_0x4497('0x18')](sugarcrm['getSugarcrmAccounts']())[_0x4497('0x18')](realtime[_0x4497('0x26')]())['then'](freshdesk[_0x4497('0x27')]())['then'](realtime['initFreshdeskAccounts']())[_0x4497('0x18')](desk[_0x4497('0x28')]())[_0x4497('0x18')](realtime['initDeskAccounts']())[_0x4497('0x18')](zoho[_0x4497('0x29')]())[_0x4497('0x18')](realtime['initZohoAccounts']())['then'](vtiger[_0x4497('0x2a')]())[_0x4497('0x18')](realtime[_0x4497('0x2b')]())[_0x4497('0x18')](campaign[_0x4497('0x2c')]())[_0x4497('0x18')](realtime[_0x4497('0x2d')]())['then'](voiceExtension['getVoiceExtensions']())['then'](realtime[_0x4497('0x2e')]())[_0x4497('0x18')](faxAccount[_0x4497('0x2f')]())[_0x4497('0x18')](realtime['initFaxAccounts']())[_0x4497('0x18')](function(){return realtime;});}function initParams(){return BPromise[_0x4497('0x17')]()['then'](voiceQueueReport[_0x4497('0x30')]())[_0x4497('0x18')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0x4497('0x31')]())[_0x4497('0x18')](realtime[_0x4497('0x32')]())[_0x4497('0x18')](cmHopperHistory[_0x4497('0x33')]())['then'](realtime[_0x4497('0x34')]())[_0x4497('0x18')](voiceCallReport[_0x4497('0x35')]())[_0x4497('0x18')](realtime[_0x4497('0x36')]())[_0x4497('0x18')](function(_0x2561bb){})[_0x4497('0x37')](function(_0x571d6d){console[_0x4497('0x38')](_0x571d6d);});}function main(){return server['listen'](realtime,preview,fax)['then'](function(_0x324740){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report[_0x4497('0x39')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x245b0f){console[_0x4497('0x38')](_0x245b0f);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index e922553..a5e85d5 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 _0x2bc2=['email','accountcode','fullname','state','unknown','stateTime','address','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','prototype','toLowerCase','not_inuse','idle','inuse','statePause','status','format','user:%s','emit','exports','lodash','util','moment','md5','localhost','name'];(function(_0x2a1f5c,_0x49b13f){var _0x43ce3d=function(_0x66f0bd){while(--_0x66f0bd){_0x2a1f5c['push'](_0x2a1f5c['shift']());}};_0x43ce3d(++_0x49b13f);}(_0x2bc2,0x1cb));var _0x22bc=function(_0x3d1082,_0x5b6160){_0x3d1082=_0x3d1082-0x0;var _0x1dc252=_0x2bc2[_0x3d1082];return _0x1dc252;};'use strict';var _=require(_0x22bc('0x0'));var util=require(_0x22bc('0x1'));var moment=require(_0x22bc('0x2'));var md5=require(_0x22bc('0x3'));var io=require('socket.io-emitter')({'host':_0x22bc('0x4'),'port':0x18eb});function Agent(_0x2bf311){this['id']=_0x2bf311['id']||0x0;this[_0x22bc('0x5')]=_0x2bf311[_0x22bc('0x5')]||'';this[_0x22bc('0x6')]=_0x2bf311[_0x22bc('0x6')]||'';this['accountcode']=_0x2bf311[_0x22bc('0x7')]||'';this[_0x22bc('0x8')]=_0x2bf311[_0x22bc('0x8')]||'';this[_0x22bc('0x9')]=_0x22bc('0xa');this[_0x22bc('0xb')]=0x0;this['status']=_0x22bc('0xa');this[_0x22bc('0xc')]='';this['phone']='';this[_0x22bc('0xd')]='';this['online']=_0x2bf311[_0x22bc('0xe')]||![];this[_0x22bc('0xf')]=_0x22bc('0xa');this[_0x22bc('0x10')]=0x0;this[_0x22bc('0x11')]='';this[_0x22bc('0x12')]='';this[_0x22bc('0x13')]=![];this['md5']='';}Agent[_0x22bc('0x14')]['updateStatusRealtime']=function(_0x19942b){var _0x30d252;if(_0x19942b&&_0x19942b[_0x22bc('0x9')]){_0x30d252=_0x19942b[_0x22bc('0x9')][_0x22bc('0x15')]();switch(_0x30d252){case _0x22bc('0x16'):_0x30d252=_0x22bc('0x17');break;case _0x22bc('0x18'):_0x30d252='talking';break;}}if(_0x30d252&&this[_0x22bc('0xf')]!==_0x30d252||_0x19942b[_0x22bc('0x19')]){this['voiceStatusTime']=_['toNumber'](moment()['format']('x'));}if(_0x30d252){this[_0x22bc('0xf')]=_0x30d252;}var _0x3096c4={'id':this['id'],'name':this[_0x22bc('0x5')],'email':this[_0x22bc('0x6')],'accountcode':this['accountcode'],'fullname':this[_0x22bc('0x8')],'state':this[_0x22bc('0x9')],'stateTime':this[_0x22bc('0xb')],'status':this[_0x22bc('0x1a')],'address':this[_0x22bc('0xc')],'online':this[_0x22bc('0xe')],'voiceStatus':this[_0x22bc('0xf')],'voiceStatusTime':this[_0x22bc('0x10')],'voiceStatusCallerIdNumber':this[_0x22bc('0x11')],'voiceStatusQueue':this[_0x22bc('0x12')]};var _0x547ac6=md5(JSON['stringify'](_0x3096c4));if(this['md5']!==_0x547ac6){this[_0x22bc('0x3')]=_0x547ac6;io['to'](util[_0x22bc('0x1b')](_0x22bc('0x1c'),_0x3096c4[_0x22bc('0x5')]))[_0x22bc('0x1d')]('user:save',_0x3096c4);}};module[_0x22bc('0x1e')]=Agent; \ No newline at end of file +var _0x5ff7=['state','not_inuse','idle','inuse','voiceStatus','statePause','voiceStatusTime','toNumber','format','address','voiceStatusCallerIdNumber','stringify','md5','emit','lodash','util','localhost','name','email','accountcode','fullname','unknown','stateTime','status','phone','mobile','online','voiceStatusQueue','prototype','updateStatusRealtime'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x5ff7,0x194));var _0x75ff=function(_0x4bf3d8,_0x4ae498){_0x4bf3d8=_0x4bf3d8-0x0;var _0x3a84c8=_0x5ff7[_0x4bf3d8];return _0x3a84c8;};'use strict';var _=require(_0x75ff('0x0'));var util=require(_0x75ff('0x1'));var moment=require('moment');var md5=require('md5');var io=require('socket.io-emitter')({'host':_0x75ff('0x2'),'port':0x18eb});function Agent(_0xb5945f){this['id']=_0xb5945f['id']||0x0;this[_0x75ff('0x3')]=_0xb5945f[_0x75ff('0x3')]||'';this[_0x75ff('0x4')]=_0xb5945f[_0x75ff('0x4')]||'';this[_0x75ff('0x5')]=_0xb5945f[_0x75ff('0x5')]||'';this['fullname']=_0xb5945f[_0x75ff('0x6')]||'';this['state']=_0x75ff('0x7');this[_0x75ff('0x8')]=0x0;this[_0x75ff('0x9')]='unknown';this['address']='';this[_0x75ff('0xa')]='';this[_0x75ff('0xb')]='';this[_0x75ff('0xc')]=_0xb5945f['online']||![];this['voiceStatus']=_0x75ff('0x7');this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x75ff('0xd')]='';this['local']=![];this['md5']='';}Agent[_0x75ff('0xe')][_0x75ff('0xf')]=function(_0x255011){var _0x30e3fd;if(_0x255011&&_0x255011[_0x75ff('0x10')]){_0x30e3fd=_0x255011['state']['toLowerCase']();switch(_0x30e3fd){case _0x75ff('0x11'):_0x30e3fd=_0x75ff('0x12');break;case _0x75ff('0x13'):_0x30e3fd='talking';break;}}if(_0x30e3fd&&this[_0x75ff('0x14')]!==_0x30e3fd||_0x255011[_0x75ff('0x15')]){this[_0x75ff('0x16')]=_[_0x75ff('0x17')](moment()[_0x75ff('0x18')]('x'));}if(_0x30e3fd){this[_0x75ff('0x14')]=_0x30e3fd;}var _0x5040a9={'id':this['id'],'name':this[_0x75ff('0x3')],'email':this[_0x75ff('0x4')],'accountcode':this[_0x75ff('0x5')],'fullname':this[_0x75ff('0x6')],'state':this[_0x75ff('0x10')],'stateTime':this[_0x75ff('0x8')],'status':this[_0x75ff('0x9')],'address':this[_0x75ff('0x19')],'online':this['online'],'voiceStatus':this[_0x75ff('0x14')],'voiceStatusTime':this[_0x75ff('0x16')],'voiceStatusCallerIdNumber':this[_0x75ff('0x1a')],'voiceStatusQueue':this[_0x75ff('0xd')]};var _0x3ba35f=md5(JSON[_0x75ff('0x1b')](_0x5040a9));if(this[_0x75ff('0x1c')]!==_0x3ba35f){this['md5']=_0x3ba35f;io['to'](util['format']('user:%s',_0x5040a9['name']))[_0x75ff('0x1d')]('user:save',_0x5040a9);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 8ed542d..7d8d86e 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 _0x780f=['dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','exports','name','type','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x780f,0x6c));var _0xf780=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0x780f[_0x22e9fe];return _0x47cd19;};'use strict';function Campaign(_0x37c848){this['id']=_0x37c848['id']||0x0;this[_0xf780('0x0')]=_0x37c848[_0xf780('0x0')]||'';this[_0xf780('0x1')]=_0x37c848[_0xf780('0x1')]||'campaign';this['originated']=0x0;this[_0xf780('0x2')]=0x0;this[_0xf780('0x3')]=0x0;this[_0xf780('0x4')]=0x0;this[_0xf780('0x5')]='';this['sendMessageOneNotActive']=!![];this[_0xf780('0x6')]=_0x37c848['active'];this[_0xf780('0x7')]=_0x37c848[_0xf780('0x7')];this[_0xf780('0x8')]=_0x37c848[_0xf780('0x8')]||null;this[_0xf780('0x9')]=_0x37c848[_0xf780('0x9')]?_0x37c848['dialGlobalInterval']:null;this[_0xf780('0xa')]=_0x37c848[_0xf780('0xa')];this[_0xf780('0xb')]=_0x37c848[_0xf780('0xb')];this[_0xf780('0xc')]=_0x37c848[_0xf780('0xc')]||0x1e;this[_0xf780('0xd')]=_0x37c848['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x37c848[_0xf780('0xe')];this[_0xf780('0xf')]=_0x37c848[_0xf780('0xf')];this[_0xf780('0x10')]=_0x37c848['dialBusyRetryFrequency'];this[_0xf780('0x11')]=_0x37c848[_0xf780('0x11')];this[_0xf780('0x12')]=_0x37c848[_0xf780('0x12')];this['dialGlobalMaxRetry']=_0x37c848[_0xf780('0x13')];this['dialOrderByScheduledAt']=_0x37c848[_0xf780('0x14')]||_0xf780('0x15');this[_0xf780('0x16')]=_0x37c848[_0xf780('0x16')]||undefined;this[_0xf780('0x17')]=_0x37c848[_0xf780('0x17')]||undefined;this[_0xf780('0x18')]=_0x37c848['dialCutDigit']||undefined;this[_0xf780('0x19')]=_0x37c848[_0xf780('0x19')]?_0x37c848[_0xf780('0x19')]:undefined;this[_0xf780('0x1a')]=_0x37c848[_0xf780('0x1a')]?_0x37c848[_0xf780('0x1a')]:undefined;this['Interval']=_0x37c848[_0xf780('0x1b')]?_0x37c848[_0xf780('0x1b')]:undefined;this['SquareProject']=_0x37c848[_0xf780('0x1c')]?_0x37c848[_0xf780('0x1c')]:undefined;this['dialQueueProject']=_0x37c848[_0xf780('0x1c')]?_0x37c848[_0xf780('0x1c')][_0xf780('0x0')]:undefined;this[_0xf780('0x1d')]=_0x37c848[_0xf780('0x1d')]||![];this[_0xf780('0x1e')]=_0x37c848['dialAMDInitialSilence'];this[_0xf780('0x1f')]=_0x37c848['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x37c848[_0xf780('0x20')];this[_0xf780('0x21')]=_0x37c848[_0xf780('0x21')];this['dialAMDMinWordLength']=_0x37c848[_0xf780('0x22')];this[_0xf780('0x23')]=_0x37c848['dialAMDBetweenWordsSilence'];this[_0xf780('0x24')]=_0x37c848['dialAMDMaximumNumberOfWords'];this[_0xf780('0x25')]=_0x37c848[_0xf780('0x25')];this['dialAMDMaximumWordLength']=_0x37c848['dialAMDMaximumWordLength'];}module[_0xf780('0x26')]=Campaign; \ No newline at end of file +var _0xe9ad=['dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence'];(function(_0x697dc2,_0x154a77){var _0x5cd164=function(_0x27cacb){while(--_0x27cacb){_0x697dc2['push'](_0x697dc2['shift']());}};_0x5cd164(++_0x154a77);}(_0xe9ad,0x82));var _0xde9a=function(_0x122d9f,_0x2c9e5b){_0x122d9f=_0x122d9f-0x0;var _0x41a09e=_0xe9ad[_0x122d9f];return _0x41a09e;};'use strict';function Campaign(_0x4b8d35){this['id']=_0x4b8d35['id']||0x0;this[_0xde9a('0x0')]=_0x4b8d35[_0xde9a('0x0')]||'';this[_0xde9a('0x1')]=_0x4b8d35[_0xde9a('0x1')]||_0xde9a('0x2');this[_0xde9a('0x3')]=0x0;this['temp']=0x0;this[_0xde9a('0x4')]=0x0;this[_0xde9a('0x5')]=0x0;this[_0xde9a('0x6')]='';this[_0xde9a('0x7')]=!![];this['active']=_0x4b8d35[_0xde9a('0x8')];this[_0xde9a('0x9')]=_0x4b8d35[_0xde9a('0x9')];this['dialTimezone']=_0x4b8d35[_0xde9a('0xa')]||null;this[_0xde9a('0xb')]=_0x4b8d35[_0xde9a('0xb')]?_0x4b8d35[_0xde9a('0xb')]:null;this[_0xde9a('0xc')]=_0x4b8d35[_0xde9a('0xc')];this[_0xde9a('0xd')]=_0x4b8d35[_0xde9a('0xd')];this[_0xde9a('0xe')]=_0x4b8d35['dialOriginateTimeout']||0x1e;this[_0xde9a('0xf')]=_0x4b8d35[_0xde9a('0xf')];this[_0xde9a('0x10')]=_0x4b8d35[_0xde9a('0x10')];this[_0xde9a('0x11')]=_0x4b8d35[_0xde9a('0x11')];this[_0xde9a('0x12')]=_0x4b8d35[_0xde9a('0x12')];this[_0xde9a('0x13')]=_0x4b8d35['dialNoAnswerMaxRetry'];this[_0xde9a('0x14')]=_0x4b8d35[_0xde9a('0x14')];this[_0xde9a('0x15')]=_0x4b8d35[_0xde9a('0x15')];this[_0xde9a('0x16')]=_0x4b8d35[_0xde9a('0x16')]||_0xde9a('0x17');this[_0xde9a('0x18')]=_0x4b8d35[_0xde9a('0x18')]||undefined;this[_0xde9a('0x19')]=_0x4b8d35[_0xde9a('0x19')]||undefined;this[_0xde9a('0x1a')]=_0x4b8d35[_0xde9a('0x1a')]||undefined;this[_0xde9a('0x1b')]=_0x4b8d35[_0xde9a('0x1b')]?_0x4b8d35[_0xde9a('0x1b')]:undefined;this['Trunk']=_0x4b8d35[_0xde9a('0x1c')]?_0x4b8d35[_0xde9a('0x1c')]:undefined;this[_0xde9a('0x1d')]=_0x4b8d35['Interval']?_0x4b8d35[_0xde9a('0x1d')]:undefined;this['SquareProject']=_0x4b8d35[_0xde9a('0x1e')]?_0x4b8d35['SquareProject']:undefined;this[_0xde9a('0x1f')]=_0x4b8d35[_0xde9a('0x1e')]?_0x4b8d35[_0xde9a('0x1e')]['name']:undefined;this[_0xde9a('0x20')]=_0x4b8d35[_0xde9a('0x20')]||![];this['dialAMDInitialSilence']=_0x4b8d35['dialAMDInitialSilence'];this[_0xde9a('0x21')]=_0x4b8d35[_0xde9a('0x21')];this[_0xde9a('0x22')]=_0x4b8d35[_0xde9a('0x22')];this[_0xde9a('0x23')]=_0x4b8d35[_0xde9a('0x23')];this[_0xde9a('0x24')]=_0x4b8d35[_0xde9a('0x24')];this[_0xde9a('0x25')]=_0x4b8d35[_0xde9a('0x25')];this[_0xde9a('0x26')]=_0x4b8d35[_0xde9a('0x26')];this[_0xde9a('0x27')]=_0x4b8d35[_0xde9a('0x27')];this[_0xde9a('0x28')]=_0x4b8d35[_0xde9a('0x28')];}module[_0xde9a('0x29')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 16e8942..5961888 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 _0x9303=['disposition','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','calleridnum','connectedlinenum','context','uniqueid','linkedid','exten','answertime','lastapplication','lastdata','duration','billableseconds','holdtime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9303,0xd7));var _0x3930=function(_0x4f5108,_0x46a54b){_0x4f5108=_0x4f5108-0x0;var _0x2d56ca=_0x9303[_0x4f5108];return _0x2d56ca;};'use strict';function Channel(){this[_0x3930('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0x3930('0x1')]=0x0;this['calleridname']='';this[_0x3930('0x2')]=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this[_0x3930('0x3')]='';this[_0x3930('0x4')]=0x0;this[_0x3930('0x5')]=0x0;this[_0x3930('0x6')]=0x0;this['answered']=![];this[_0x3930('0x7')]=null;this['endtime']=null;this['unmanaged']=![];this[_0x3930('0x8')]='';this[_0x3930('0x9')]='';this[_0x3930('0xa')]=0x0;this[_0x3930('0xb')]=0x0;this[_0x3930('0xc')]=0x0;this['type']=null;this['tag']=null;this[_0x3930('0xd')]=null;this['monitor']=![];this['monitorFilename']=null;this['queue']=null;this[_0x3930('0xe')]=[];this[_0x3930('0xf')]=undefined;this[_0x3930('0x10')]=undefined;this[_0x3930('0x11')]=0x0;}module[_0x3930('0x12')]=Channel; \ No newline at end of file +var _0x6ff6=['holdtime','type','tag','disposition','monitor','monitorFilename','mohtime','exports','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','exten','answered','unmanaged','lastapplication','duration','billableseconds'];(function(_0x2dc343,_0xf015a2){var _0x51eac5=function(_0x1adfef){while(--_0x1adfef){_0x2dc343['push'](_0x2dc343['shift']());}};_0x51eac5(++_0xf015a2);}(_0x6ff6,0x182));var _0x66ff=function(_0x32f6ec,_0xf1acca){_0x32f6ec=_0x32f6ec-0x0;var _0x159813=_0x6ff6[_0x32f6ec];return _0x159813;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this[_0x66ff('0x0')]='';this[_0x66ff('0x1')]=0x0;this[_0x66ff('0x2')]='';this[_0x66ff('0x3')]=undefined;this[_0x66ff('0x4')]=undefined;this[_0x66ff('0x5')]=0x0;this[_0x66ff('0x6')]='';this['uniqueid']=0x0;this['linkedid']=0x0;this[_0x66ff('0x7')]=0x0;this[_0x66ff('0x8')]=![];this['answertime']=null;this['endtime']=null;this[_0x66ff('0x9')]=![];this[_0x66ff('0xa')]='';this['lastdata']='';this[_0x66ff('0xb')]=0x0;this[_0x66ff('0xc')]=0x0;this[_0x66ff('0xd')]=0x0;this[_0x66ff('0xe')]=null;this[_0x66ff('0xf')]=null;this[_0x66ff('0x10')]=null;this[_0x66ff('0x11')]=![];this[_0x66ff('0x12')]=null;this['queue']=null;this['monitors']=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0x66ff('0x13')]=0x0;}module[_0x66ff('0x14')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 8a8ddd1..0b2bb08 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 _0xad0c=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x352b44,_0x4a91a1){var _0x3e8baa=function(_0xed4bc3){while(--_0xed4bc3){_0x352b44['push'](_0x352b44['shift']());}};_0x3e8baa(++_0x4a91a1);}(_0xad0c,0xce));var _0xcad0=function(_0x2197c1,_0x5d09a5){_0x2197c1=_0x2197c1-0x0;var _0x438d1e=_0xad0c[_0x2197c1];return _0x438d1e;};'use strict';function DeskAccount(_0x71f4d6){this['id']=_0x71f4d6['id']||0x0;this['name']=_0x71f4d6[_0xcad0('0x0')]||'';this['username']=_0x71f4d6[_0xcad0('0x1')]||'';this['remoteUri']=_0x71f4d6[_0xcad0('0x2')]||'';this[_0xcad0('0x3')]=_0x71f4d6['authType']||'';this['password']=_0x71f4d6[_0xcad0('0x4')]||'';this[_0xcad0('0x5')]=_0x71f4d6['consumerKey']||'';this[_0xcad0('0x6')]=_0x71f4d6[_0xcad0('0x6')]||'';this['token']=_0x71f4d6[_0xcad0('0x7')]||'';this[_0xcad0('0x8')]=_0x71f4d6['tokenSecret']||'';this['type']=_0x71f4d6[_0xcad0('0x9')]||'';this[_0xcad0('0xa')]=_0x71f4d6[_0xcad0('0xa')]||'';this[_0xcad0('0xb')]=_0x71f4d6[_0xcad0('0xb')]||{};}module[_0xcad0('0xc')]=DeskAccount; \ No newline at end of file +var _0x146a=['authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri'];(function(_0x4a0e68,_0x45c08c){var _0x4fb274=function(_0x5f36b1){while(--_0x5f36b1){_0x4a0e68['push'](_0x4a0e68['shift']());}};_0x4fb274(++_0x45c08c);}(_0x146a,0xb1));var _0xa146=function(_0x1e8f35,_0x3db390){_0x1e8f35=_0x1e8f35-0x0;var _0x446c13=_0x146a[_0x1e8f35];return _0x446c13;};'use strict';function DeskAccount(_0xd3f97d){this['id']=_0xd3f97d['id']||0x0;this[_0xa146('0x0')]=_0xd3f97d[_0xa146('0x0')]||'';this[_0xa146('0x1')]=_0xd3f97d[_0xa146('0x1')]||'';this[_0xa146('0x2')]=_0xd3f97d['remoteUri']||'';this[_0xa146('0x3')]=_0xd3f97d[_0xa146('0x3')]||'';this[_0xa146('0x4')]=_0xd3f97d[_0xa146('0x4')]||'';this[_0xa146('0x5')]=_0xd3f97d[_0xa146('0x5')]||'';this[_0xa146('0x6')]=_0xd3f97d['consumerSecret']||'';this[_0xa146('0x7')]=_0xd3f97d['token']||'';this[_0xa146('0x8')]=_0xd3f97d['tokenSecret']||'';this[_0xa146('0x9')]=_0xd3f97d[_0xa146('0x9')]||'';this[_0xa146('0xa')]=_0xd3f97d['serverUrl']||'';this[_0xa146('0xb')]=_0xd3f97d[_0xa146('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index e23e29e..5304cca 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 _0xb4e6=['Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','v17,v27,v29','faxdetect','t38timeout','tech','SIP'];(function(_0x38c178,_0x336c72){var _0x1beb1c=function(_0xce7e21){while(--_0xce7e21){_0x38c178['push'](_0x38c178['shift']());}};_0x1beb1c(++_0x336c72);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x52e0ee,_0x52f7c1){_0x52e0ee=_0x52e0ee-0x0;var _0x32534c=_0xb4e6[_0x52e0ee];return _0x32534c;};'use strict';function FaxAccount(_0x54acd0){this['id']=_0x54acd0['id']||0x0;this['name']=_0x54acd0[_0x6b4e('0x0')]||'';this[_0x6b4e('0x1')]=_0x54acd0[_0x6b4e('0x1')];this[_0x6b4e('0x2')]=_0x54acd0[_0x6b4e('0x2')];this[_0x6b4e('0x3')]=_0x54acd0[_0x6b4e('0x3')];this['localstationid']=_0x54acd0[_0x6b4e('0x4')];this[_0x6b4e('0x5')]=_0x54acd0[_0x6b4e('0x5')]||0x960;this['maxrate']=_0x54acd0[_0x6b4e('0x6')]||0x3840;this['modem']=_0x54acd0['modem']||_0x6b4e('0x7');this['gateway']=_0x54acd0['gateway']||'no';this[_0x6b4e('0x8')]=_0x54acd0[_0x6b4e('0x8')]||'no';this[_0x6b4e('0x9')]=_0x54acd0[_0x6b4e('0x9')]||0x1388;this[_0x6b4e('0xa')]=_0x54acd0[_0x6b4e('0xa')]||_0x6b4e('0xb');this['Trunk']=_0x54acd0[_0x6b4e('0xc')]?_0x54acd0[_0x6b4e('0xc')]:undefined;this['ListId']=_0x54acd0[_0x6b4e('0xd')];this[_0x6b4e('0xe')]=_0x54acd0[_0x6b4e('0xe')];}module[_0x6b4e('0xf')]=FaxAccount; \ No newline at end of file +var _0x9348=['headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm'];(function(_0x5df64a,_0x294ae3){var _0x28449c=function(_0x1b948f){while(--_0x1b948f){_0x5df64a['push'](_0x5df64a['shift']());}};_0x28449c(++_0x294ae3);}(_0x9348,0x10d));var _0x8934=function(_0x53d2d2,_0x3dbd39){_0x53d2d2=_0x53d2d2-0x0;var _0x74d0ff=_0x9348[_0x53d2d2];return _0x74d0ff;};'use strict';function FaxAccount(_0x41a189){this['id']=_0x41a189['id']||0x0;this[_0x8934('0x0')]=_0x41a189[_0x8934('0x0')]||'';this[_0x8934('0x1')]=_0x41a189[_0x8934('0x1')];this['ecm']=_0x41a189[_0x8934('0x2')];this[_0x8934('0x3')]=_0x41a189['headerinfo'];this[_0x8934('0x4')]=_0x41a189[_0x8934('0x4')];this[_0x8934('0x5')]=_0x41a189[_0x8934('0x5')]||0x960;this[_0x8934('0x6')]=_0x41a189[_0x8934('0x6')]||0x3840;this['modem']=_0x41a189[_0x8934('0x7')]||_0x8934('0x8');this[_0x8934('0x9')]=_0x41a189['gateway']||'no';this['faxdetect']=_0x41a189['faxdetect']||'no';this['t38timeout']=_0x41a189[_0x8934('0xa')]||0x1388;this['tech']=_0x41a189[_0x8934('0xb')]||_0x8934('0xc');this[_0x8934('0xd')]=_0x41a189[_0x8934('0xd')]?_0x41a189[_0x8934('0xd')]:undefined;this[_0x8934('0xe')]=_0x41a189[_0x8934('0xe')];this[_0x8934('0xf')]=_0x41a189['key'];}module[_0x8934('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 a8e4c85..c8177c7 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 _0xd8ad=['name','username','apiKey','remoteUri','serverUrl','exports'];(function(_0x352ae4,_0x40ad77){var _0x3da615=function(_0x4eb31d){while(--_0x4eb31d){_0x352ae4['push'](_0x352ae4['shift']());}};_0x3da615(++_0x40ad77);}(_0xd8ad,0x138));var _0xdd8a=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xd8ad[_0x543084];return _0x306a57;};'use strict';function FreshdeskAccount(_0x246c07){this['id']=_0x246c07['id']||0x0;this[_0xdd8a('0x0')]=_0x246c07['name']||'';this[_0xdd8a('0x1')]=_0x246c07[_0xdd8a('0x1')]||'';this[_0xdd8a('0x2')]=_0x246c07['token']||'';this[_0xdd8a('0x3')]=_0x246c07['remoteUri']||'';this[_0xdd8a('0x4')]=_0x246c07[_0xdd8a('0x4')]||'';this['Configurations']=_0x246c07['Configurations']||{};}module[_0xdd8a('0x5')]=FreshdeskAccount; \ No newline at end of file +var _0xa434=['token','remoteUri','serverUrl','Configurations','name','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa434,0xdc));var _0x4a43=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xa434[_0x1abb09];return _0xea1c07;};'use strict';function FreshdeskAccount(_0x3a99d6){this['id']=_0x3a99d6['id']||0x0;this[_0x4a43('0x0')]=_0x3a99d6[_0x4a43('0x0')]||'';this[_0x4a43('0x1')]=_0x3a99d6[_0x4a43('0x1')]||'';this['apiKey']=_0x3a99d6[_0x4a43('0x2')]||'';this[_0x4a43('0x3')]=_0x3a99d6[_0x4a43('0x3')]||'';this['serverUrl']=_0x3a99d6[_0x4a43('0x4')]||'';this[_0x4a43('0x5')]=_0x3a99d6[_0x4a43('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 6d813ae..cce1a94 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 _0xb3cf=['assigned','lastAssignedTo','mohtime','variables','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','accountcode','context','exten','priority'];(function(_0x4c78a3,_0x40c9ff){var _0x53c50f=function(_0xc5eccd){while(--_0xc5eccd){_0x4c78a3['push'](_0x4c78a3['shift']());}};_0x53c50f(++_0x40c9ff);}(_0xb3cf,0xe0));var _0xfb3c=function(_0x4e2afd,_0x246d1c){_0x4e2afd=_0x4e2afd-0x0;var _0x39539b=_0xb3cf[_0x4e2afd];return _0x39539b;};'use strict';function QueueReport(){this['type']='inbound';this[_0xfb3c('0x0')]='';this[_0xfb3c('0x1')]='';this[_0xfb3c('0x2')]='';this[_0xfb3c('0x3')]='';this[_0xfb3c('0x4')]=null;this[_0xfb3c('0x5')]=null;this[_0xfb3c('0x6')]=0x1;this[_0xfb3c('0x7')]=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0xfb3c('0x8')]=![];this['queuecallercompleteAt']=null;this[_0xfb3c('0x9')]=![];this[_0xfb3c('0xa')]=null;this[_0xfb3c('0xb')]=0x1;this[_0xfb3c('0xc')]='';this['connectedlinenum']='';this[_0xfb3c('0xd')]='';this[_0xfb3c('0xe')]='';this[_0xfb3c('0xf')]='';this[_0xfb3c('0x10')]='';this[_0xfb3c('0x11')]='';this['holdtime']=0x0;this[_0xfb3c('0x12')]=![];this[_0xfb3c('0x13')]='';this[_0xfb3c('0x14')]=0x0;this[_0xfb3c('0x15')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x2b6c=['inbound','calleridnum','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','connectedlinenum','context','priority','assigned','lastAssignedTo','variables','exports','type'];(function(_0x316561,_0x3ad3db){var _0x12616f=function(_0x5202d0){while(--_0x5202d0){_0x316561['push'](_0x316561['shift']());}};_0x12616f(++_0x3ad3db);}(_0x2b6c,0x143));var _0xc2b6=function(_0x273987,_0x44056f){_0x273987=_0x273987-0x0;var _0x50ebc7=_0x2b6c[_0x273987];return _0x50ebc7;};'use strict';function QueueReport(){this[_0xc2b6('0x0')]=_0xc2b6('0x1');this['uniqueid']='';this[_0xc2b6('0x2')]='';this['calleridname']='';this['queue']='';this[_0xc2b6('0x3')]=null;this[_0xc2b6('0x4')]=null;this[_0xc2b6('0x5')]=0x1;this[_0xc2b6('0x6')]=0x1;this['queuecallerabandon']=![];this[_0xc2b6('0x7')]=null;this[_0xc2b6('0x8')]=![];this[_0xc2b6('0x9')]=null;this['queuecallerexit']=![];this[_0xc2b6('0xa')]=null;this['originalposition']=0x1;this['channel']='';this[_0xc2b6('0xb')]='';this['connectedlinename']='';this['accountcode']='';this[_0xc2b6('0xc')]='';this['exten']='';this[_0xc2b6('0xd')]='';this['holdtime']=0x0;this[_0xc2b6('0xe')]=![];this[_0xc2b6('0xf')]='';this['mohtime']=0x0;this[_0xc2b6('0x10')]={};}module[_0xc2b6('0x11')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 24ebc3f..99eb076 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 _0x5e8c=['password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','username','remoteUri'];(function(_0x5f45ec,_0x57427a){var _0x7cdda1=function(_0x36ca29){while(--_0x36ca29){_0x5f45ec['push'](_0x5f45ec['shift']());}};_0x7cdda1(++_0x57427a);}(_0x5e8c,0x18a));var _0xc5e8=function(_0x9ddc2a,_0x31bcf6){_0x9ddc2a=_0x9ddc2a-0x0;var _0x4312e9=_0x5e8c[_0x9ddc2a];return _0x4312e9;};'use strict';function SalesforceAccount(_0x4a26e5){this['id']=_0x4a26e5['id']||0x0;this['name']=_0x4a26e5['name']||'';this[_0xc5e8('0x0')]=_0x4a26e5[_0xc5e8('0x0')]||'';this['remoteUri']=_0x4a26e5[_0xc5e8('0x1')]||'';this[_0xc5e8('0x2')]=_0x4a26e5[_0xc5e8('0x2')]||'';this['clientId']=_0x4a26e5[_0xc5e8('0x3')]||'';this[_0xc5e8('0x4')]=_0x4a26e5[_0xc5e8('0x4')]||'';this['securityToken']=_0x4a26e5[_0xc5e8('0x5')]||'';this[_0xc5e8('0x6')]=_0x4a26e5[_0xc5e8('0x6')]||_0xc5e8('0x7');this[_0xc5e8('0x8')]=_0x4a26e5[_0xc5e8('0x8')]||'';this['Configurations']=_0x4a26e5['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x684c=['Configurations','exports','name','username','remoteUri','password','clientId','securityToken','type','integrationTab','serverUrl'];(function(_0x36f641,_0x1a3063){var _0x39b299=function(_0x20c0a3){while(--_0x20c0a3){_0x36f641['push'](_0x36f641['shift']());}};_0x39b299(++_0x1a3063);}(_0x684c,0xb2));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';function SalesforceAccount(_0x8f2539){this['id']=_0x8f2539['id']||0x0;this[_0xc684('0x0')]=_0x8f2539[_0xc684('0x0')]||'';this[_0xc684('0x1')]=_0x8f2539[_0xc684('0x1')]||'';this[_0xc684('0x2')]=_0x8f2539['remoteUri']||'';this[_0xc684('0x3')]=_0x8f2539[_0xc684('0x3')]||'';this['clientId']=_0x8f2539[_0xc684('0x4')]||'';this['clientSecret']=_0x8f2539['clientSecret']||'';this[_0xc684('0x5')]=_0x8f2539['securityToken']||'';this[_0xc684('0x6')]=_0x8f2539[_0xc684('0x6')]||_0xc684('0x7');this[_0xc684('0x8')]=_0x8f2539[_0xc684('0x8')]||'';this[_0xc684('0x9')]=_0x8f2539[_0xc684('0x9')]||{};}module[_0xc684('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 5226550..9113621 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 _0x88fe=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x4b9282,_0x58934a){var _0x33ed93=function(_0x4139ea){while(--_0x4139ea){_0x4b9282['push'](_0x4b9282['shift']());}};_0x33ed93(++_0x58934a);}(_0x88fe,0x1d8));var _0xe88f=function(_0xffa654,_0x4c734){_0xffa654=_0xffa654-0x0;var _0x5dd847=_0x88fe[_0xffa654];return _0x5dd847;};'use strict';function SugarcrmAccount(_0x48e86b){this['id']=_0x48e86b['id']||0x0;this['name']=_0x48e86b[_0xe88f('0x0')]||'';this[_0xe88f('0x1')]=_0x48e86b[_0xe88f('0x1')]||'';this[_0xe88f('0x2')]=_0x48e86b[_0xe88f('0x2')]||'';this[_0xe88f('0x3')]=_0x48e86b[_0xe88f('0x3')]||'';this[_0xe88f('0x4')]=_0x48e86b[_0xe88f('0x4')]||'';this[_0xe88f('0x5')]=_0x48e86b['Configurations']||{};}module[_0xe88f('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xb772=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xb772,0x115));var _0x2b77=function(_0x567842,_0x302841){_0x567842=_0x567842-0x0;var _0xfe2a85=_0xb772[_0x567842];return _0xfe2a85;};'use strict';function SugarcrmAccount(_0x6a8e4a){this['id']=_0x6a8e4a['id']||0x0;this['name']=_0x6a8e4a[_0x2b77('0x0')]||'';this[_0x2b77('0x1')]=_0x6a8e4a[_0x2b77('0x1')]||'';this[_0x2b77('0x2')]=_0x6a8e4a[_0x2b77('0x2')]||'';this['remoteUri']=_0x6a8e4a[_0x2b77('0x3')]||'';this[_0x2b77('0x4')]=_0x6a8e4a[_0x2b77('0x4')]||'';this[_0x2b77('0x5')]=_0x6a8e4a[_0x2b77('0x5')]||{};}module[_0x2b77('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 9262754..7af6afe 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 _0xf70b=['status','exports','name','state','stateTime'];(function(_0x4bb9dc,_0x4dfcce){var _0x62794a=function(_0xd2e2ff){while(--_0xd2e2ff){_0x4bb9dc['push'](_0x4bb9dc['shift']());}};_0x62794a(++_0x4dfcce);}(_0xf70b,0xc5));var _0xbf70=function(_0x3e811e,_0x3bb504){_0x3e811e=_0x3e811e-0x0;var _0x38262f=_0xf70b[_0x3e811e];return _0x38262f;};'use strict';function Telephone(_0x13305e){this['id']=_0x13305e['id']||0x0;this[_0xbf70('0x0')]=_0x13305e[_0xbf70('0x0')]||'';this[_0xbf70('0x1')]='unknown';this[_0xbf70('0x2')]=0x0;this[_0xbf70('0x3')]='unknown';this['address']='';}module[_0xbf70('0x4')]=Telephone; \ No newline at end of file +var _0x147b=['exports','name','unknown','address'];(function(_0x9195f7,_0x256e45){var _0x17de48=function(_0x1266ca){while(--_0x1266ca){_0x9195f7['push'](_0x9195f7['shift']());}};_0x17de48(++_0x256e45);}(_0x147b,0x1a5));var _0xb147=function(_0x558105,_0x4f84af){_0x558105=_0x558105-0x0;var _0x39cc0=_0x147b[_0x558105];return _0x39cc0;};'use strict';function Telephone(_0x4a5d05){this['id']=_0x4a5d05['id']||0x0;this[_0xb147('0x0')]=_0x4a5d05['name']||'';this['state']=_0xb147('0x1');this['stateTime']=0x0;this['status']=_0xb147('0x1');this[_0xb147('0x2')]='';}module[_0xb147('0x3')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 0d17b8c..751896e 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 _0x4bc3=['name','html'];(function(_0x487084,_0x1eb091){var _0x5bb80a=function(_0x281b36){while(--_0x281b36){_0x487084['push'](_0x487084['shift']());}};_0x5bb80a(++_0x1eb091);}(_0x4bc3,0x16e));var _0x34bc=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x4bc3[_0x51c819];return _0x15c5d2;};'use strict';function template(_0x2fede3){this['id']=_0x2fede3['id']||0x0;this[_0x34bc('0x0')]=_0x2fede3['name']||'';this[_0x34bc('0x1')]=_0x2fede3[_0x34bc('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xfd28=['name','html'];(function(_0x471ebb,_0x4f258c){var _0x3fd182=function(_0x4e7249){while(--_0x4e7249){_0x471ebb['push'](_0x471ebb['shift']());}};_0x3fd182(++_0x4f258c);}(_0xfd28,0x148));var _0x8fd2=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0xfd28[_0x31b5a5];return _0x364cc9;};'use strict';function template(_0x5a133a){this['id']=_0x5a133a['id']||0x0;this[_0x8fd2('0x0')]=_0x5a133a[_0x8fd2('0x0')]||'';this['html']=_0x5a133a[_0x8fd2('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 7848530..3e5da69 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 _0x9540=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x9540,0xba));var _0x0954=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9540[_0x3dd15e];return _0x231fd0;};'use strict';function Trigger(_0x344345){this['id']=_0x344345['id']||0x0;this['name']=_0x344345[_0x0954('0x0')]||'';this['channel']=_0x344345[_0x0954('0x1')]||'voice';this[_0x0954('0x2')]=_0x344345[_0x0954('0x2')]||![];this[_0x0954('0x3')]=_0x344345[_0x0954('0x3')]||[];this[_0x0954('0x4')]=_0x344345['AnyConditions']||[];this[_0x0954('0x5')]=_0x344345['Actions']||[];}module[_0x0954('0x6')]=Trigger; \ No newline at end of file +var _0x1c52=['voice','status','AllConditions','AnyConditions','Actions','exports','name','channel'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1c52,0x176));var _0x21c5=function(_0x561a1b,_0x223b2a){_0x561a1b=_0x561a1b-0x0;var _0x5ae8ab=_0x1c52[_0x561a1b];return _0x5ae8ab;};'use strict';function Trigger(_0xe35824){this['id']=_0xe35824['id']||0x0;this['name']=_0xe35824[_0x21c5('0x0')]||'';this[_0x21c5('0x1')]=_0xe35824[_0x21c5('0x1')]||_0x21c5('0x2');this[_0x21c5('0x3')]=_0xe35824[_0x21c5('0x3')]||![];this[_0x21c5('0x4')]=_0xe35824['AllConditions']||[];this[_0x21c5('0x5')]=_0xe35824[_0x21c5('0x5')]||[];this[_0x21c5('0x6')]=_0xe35824[_0x21c5('0x6')]||[];}module[_0x21c5('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 407ac98..5de53ff 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 _0x0409=['active','name','state','unknown','status','registry','indexOf','split','host','domainport','refresh','stateRegistry','registrationtime','address'];(function(_0xe2bfb9,_0x23df8b){var _0x2ad2b3=function(_0x57065e){while(--_0x57065e){_0xe2bfb9['push'](_0xe2bfb9['shift']());}};_0x2ad2b3(++_0x23df8b);}(_0x0409,0x1dc));var _0x9040=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x0409[_0x33032e];return _0x13316b;};'use strict';function Trunk(_0x61233b){this['id']=_0x61233b['id']||0x0;this[_0x9040('0x0')]=_0x61233b[_0x9040('0x0')]||![];this[_0x9040('0x1')]=_0x61233b[_0x9040('0x1')]||'';this[_0x9040('0x2')]=_0x9040('0x3');this['stateTime']=0x0;this[_0x9040('0x4')]=_0x9040('0x3');this[_0x9040('0x5')]=_0x61233b[_0x9040('0x5')]&&_0x61233b[_0x9040('0x5')][_0x9040('0x6')](':')?_0x61233b['registry'][_0x9040('0x7')](':')[0x0]:'';this[_0x9040('0x8')]='';this['port']='';this['domain']='';this[_0x9040('0x9')]='';this[_0x9040('0xa')]='';this[_0x9040('0xb')]=_0x9040('0x3');this[_0x9040('0xc')]='';this[_0x9040('0xd')]='';}module['exports']=Trunk; \ No newline at end of file +var _0x21e6=['stateTime','status','registry','indexOf','host','port','domainport','refresh','stateRegistry','registrationtime','address','exports','active','name','state','unknown'];(function(_0x1433de,_0xe1688e){var _0x3ccc7d=function(_0x18f641){while(--_0x18f641){_0x1433de['push'](_0x1433de['shift']());}};_0x3ccc7d(++_0xe1688e);}(_0x21e6,0x1ac));var _0x621e=function(_0x3c487b,_0x44c5e2){_0x3c487b=_0x3c487b-0x0;var _0x1d65f6=_0x21e6[_0x3c487b];return _0x1d65f6;};'use strict';function Trunk(_0xfb8082){this['id']=_0xfb8082['id']||0x0;this[_0x621e('0x0')]=_0xfb8082['active']||![];this[_0x621e('0x1')]=_0xfb8082[_0x621e('0x1')]||'';this[_0x621e('0x2')]=_0x621e('0x3');this[_0x621e('0x4')]=0x0;this[_0x621e('0x5')]=_0x621e('0x3');this['registry']=_0xfb8082[_0x621e('0x6')]&&_0xfb8082['registry'][_0x621e('0x7')](':')?_0xfb8082['registry']['split'](':')[0x0]:'';this[_0x621e('0x8')]='';this[_0x621e('0x9')]='';this['domain']='';this[_0x621e('0xa')]='';this[_0x621e('0xb')]='';this[_0x621e('0xc')]=_0x621e('0x3');this[_0x621e('0xd')]='';this[_0x621e('0xe')]='';}module[_0x621e('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 3ce3373..bde562d 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 _0x2dae=['recordingFormat','none','exports','exten'];(function(_0x2ed9ee,_0x3a503c){var _0x163eca=function(_0x197971){while(--_0x197971){_0x2ed9ee['push'](_0x2ed9ee['shift']());}};_0x163eca(++_0x3a503c);}(_0x2dae,0xc3));var _0xe2da=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x2dae[_0x34325b];return _0x3da348;};'use strict';function voiceExtension(_0x463a36){this['id']=_0x463a36['id']||0x0;this['exten']=_0x463a36[_0xe2da('0x0')]||'';this[_0xe2da('0x1')]=_0x463a36[_0xe2da('0x1')]||_0xe2da('0x2');}module[_0xe2da('0x3')]=voiceExtension; \ No newline at end of file +var _0x2750=['recordingFormat','none','exports','exten'];(function(_0x475947,_0x2a8fda){var _0x10538e=function(_0xb00775){while(--_0xb00775){_0x475947['push'](_0x475947['shift']());}};_0x10538e(++_0x2a8fda);}(_0x2750,0x13b));var _0x0275=function(_0x3b1a0b,_0x4424ee){_0x3b1a0b=_0x3b1a0b-0x0;var _0x4ed03d=_0x2750[_0x3b1a0b];return _0x4ed03d;};'use strict';function voiceExtension(_0x1c9f4d){this['id']=_0x1c9f4d['id']||0x0;this['exten']=_0x1c9f4d[_0x0275('0x0')]||'';this[_0x0275('0x1')]=_0x1c9f4d[_0x0275('0x1')]||_0x0275('0x2');}module[_0x0275('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 83f9c7e..73bc0c8 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 _0xeaa1=['loggedIn','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalLowerLimit','predictiveIntervalErlangCallsDroppedCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','sumDuration','unmanaged'];(function(_0x29699a,_0x5d22e3){var _0x3570d3=function(_0xf9a2e1){while(--_0xf9a2e1){_0x29699a['push'](_0x29699a['shift']());}};_0x3570d3(++_0x5d22e3);}(_0xeaa1,0x192));var _0x1eaa=function(_0x5b1bd6,_0x286a57){_0x5b1bd6=_0x5b1bd6-0x0;var _0x1f5af8=_0xeaa1[_0x5b1bd6];return _0x1f5af8;};'use strict';var statusDesc=[_0x1eaa('0x0'),_0x1eaa('0x1'),_0x1eaa('0x2'),_0x1eaa('0x3'),_0x1eaa('0x4'),_0x1eaa('0x5'),_0x1eaa('0x6'),_0x1eaa('0x7'),_0x1eaa('0x8')];var monitorFormat={'wav':_0x1eaa('0x9'),'wav49':_0x1eaa('0xa'),'gsm':_0x1eaa('0xb')};var strategy={'rrmemory':_0x1eaa('0xc'),'roundrobin':_0x1eaa('0xd')};function VoiceQueue(_0x22d778){this['id']=_0x22d778['id']||0x0;this['name']=_0x22d778[_0x1eaa('0xe')]||'';this[_0x1eaa('0xf')]=_0x22d778[_0x1eaa('0xf')]||'';this[_0x1eaa('0x10')]=_0x22d778['type']||_0x1eaa('0x11');this[_0x1eaa('0x12')]=0x0;this[_0x1eaa('0x13')]=0x0;this['total']=0x0;this['answered']=0x0;this[_0x1eaa('0x14')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this[_0x1eaa('0x15')]=0x0;this[_0x1eaa('0x16')]=0x0;this['available']=0x0;this[_0x1eaa('0x17')]=_0x22d778['acw']||![];this[_0x1eaa('0x18')]=_0x22d778['acwTimeout']||0xa;this[_0x1eaa('0x19')]=_0x22d778[_0x1eaa('0x19')]||'no';this[_0x1eaa('0x1a')]=!![];this[_0x1eaa('0x1b')]='';this[_0x1eaa('0x1c')]=0x0;this[_0x1eaa('0x1d')]=0x0;this[_0x1eaa('0x1e')]=_0x22d778['dialTimezone']||null;this[_0x1eaa('0x1f')]=_0x22d778[_0x1eaa('0x1f')]?_0x22d778[_0x1eaa('0x1f')]:null;this[_0x1eaa('0x20')]=_0x22d778['dialActive'];this[_0x1eaa('0x21')]=_0x22d778[_0x1eaa('0x21')]||_0x1eaa('0x22');this[_0x1eaa('0x23')]=_0x22d778[_0x1eaa('0x23')]||0x0;this[_0x1eaa('0x24')]=_0x22d778['dialLimitQueue']||0x0;this[_0x1eaa('0x25')]=_0x22d778[_0x1eaa('0x25')]||0x1;this[_0x1eaa('0x26')]=_0x22d778['dialPredictiveOptimization']||_0x1eaa('0x27');this['dialPredictiveOptimizationPercentage']=_0x22d778[_0x1eaa('0x28')]||0.03;this[_0x1eaa('0x29')]=_0x22d778[_0x1eaa('0x29')]||0x258;this['dialOriginateCallerIdName']=_0x22d778[_0x1eaa('0x2a')]||_0x1eaa('0x2b');this[_0x1eaa('0x2c')]=_0x22d778['dialOriginateCallerIdNumber']||_0x1eaa('0x2b');this[_0x1eaa('0x2d')]=_0x22d778[_0x1eaa('0x2d')]||0x1e;this[_0x1eaa('0x2e')]=_0x22d778[_0x1eaa('0x2e')]||_0x1eaa('0x2f');this['dialQueueTimeout']=_0x22d778[_0x1eaa('0x30')]||0x3;this['dialQueueProject']=_0x22d778[_0x1eaa('0x31')]||undefined;this[_0x1eaa('0x32')]=_0x22d778[_0x1eaa('0x32')]||0x3;this[_0x1eaa('0x33')]=_0x22d778[_0x1eaa('0x33')]||0x96;this['dialBusyMaxRetry']=_0x22d778[_0x1eaa('0x34')]||0x3;this[_0x1eaa('0x35')]=_0x22d778[_0x1eaa('0x35')]||0x96;this['dialNoAnswerMaxRetry']=_0x22d778[_0x1eaa('0x36')]||0x3;this[_0x1eaa('0x37')]=_0x22d778['dialNoAnswerRetryFrequency']||0x96;this[_0x1eaa('0x38')]=_0x22d778[_0x1eaa('0x38')]||0x4;this[_0x1eaa('0x39')]=_0x22d778['Trunk']?_0x22d778[_0x1eaa('0x39')]:undefined;this[_0x1eaa('0x3a')]=_0x22d778[_0x1eaa('0x3a')]?_0x22d778[_0x1eaa('0x3a')]:undefined;this['dialPrefix']=_0x22d778['dialPrefix']||undefined;this['Interval']=_0x22d778[_0x1eaa('0x3b')]?_0x22d778[_0x1eaa('0x3b')]:undefined;this[_0x1eaa('0x3c')]=_0x22d778[_0x1eaa('0x3c')]||_0x1eaa('0x3d');this[_0x1eaa('0x3e')]=_0x22d778[_0x1eaa('0x3e')]||undefined;this[_0x1eaa('0x3f')]=_0x22d778[_0x1eaa('0x3f')]||undefined;this[_0x1eaa('0x40')]=strategy[_0x22d778[_0x1eaa('0x40')]]||_0x1eaa('0xc');this['queueStatusComplete']=!![];this[_0x1eaa('0x41')]=_0x22d778['dialAMDActive']||![];this[_0x1eaa('0x42')]=_0x22d778['dialAMDInitialSilence'];this[_0x1eaa('0x43')]=_0x22d778['dialAMDGreeting'];this[_0x1eaa('0x44')]=_0x22d778[_0x1eaa('0x44')];this['dialAMDTotalAnalysisTime']=_0x22d778[_0x1eaa('0x45')];this['dialAMDMinWordLength']=_0x22d778['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x22d778['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x22d778['dialAMDMaximumNumberOfWords'];this[_0x1eaa('0x46')]=_0x22d778[_0x1eaa('0x46')];this[_0x1eaa('0x47')]=_0x22d778[_0x1eaa('0x47')];this[_0x1eaa('0x48')]=0x0;this[_0x1eaa('0x49')]=0x0;this[_0x1eaa('0x4a')]=_0x22d778[_0x1eaa('0x4a')];this[_0x1eaa('0x4b')]=0x0;this[_0x1eaa('0x4c')]=0x0;this[_0x1eaa('0x4d')]=0x0;this[_0x1eaa('0x4e')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x1eaa('0x4f')]=0x0;this[_0x1eaa('0x50')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x1eaa('0x51')]=0x0;this[_0x1eaa('0x52')]=0x0;this[_0x1eaa('0x53')]=0x0;this[_0x1eaa('0x54')]=0x0;this['outboundReCallsDay']=0x0;this[_0x1eaa('0x55')]=undefined;this[_0x1eaa('0x56')]=undefined;this[_0x1eaa('0x57')]=undefined;this[_0x1eaa('0x58')]=1.05;this[_0x1eaa('0x59')]=0x0;this[_0x1eaa('0x5a')]=0x0;this[_0x1eaa('0x5b')]=0x0;this[_0x1eaa('0x5c')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x1eaa('0x5d')]=0x0;this[_0x1eaa('0x5e')]=0x0;this[_0x1eaa('0x5f')]=0.4;this['predictiveIntervalErlangCalls']=0x0;this[_0x1eaa('0x60')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0x1eaa('0x61')]=0x0;this[_0x1eaa('0x62')]=0x0;this[_0x1eaa('0x63')]=0x0;this['dialRecallMeTimeout']=_0x22d778[_0x1eaa('0x64')]||0x1e;this[_0x1eaa('0x65')]=_0x22d778[_0x1eaa('0x65')]||![];this['dialQueueProject2']=_0x22d778[_0x1eaa('0x66')]||undefined;this[_0x1eaa('0x67')]=_0x22d778[_0x1eaa('0x67')]||![];this[_0x1eaa('0x68')]=_0x22d778[_0x1eaa('0x68')]||![];this[_0x1eaa('0xf')]=monitorFormat[_0x22d778[_0x1eaa('0xf')]]?monitorFormat[_0x22d778['monitor_format']]:undefined;}module[_0x1eaa('0x69')]=VoiceQueue; \ No newline at end of file +var _0xfdd7=['dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','erlangCalls','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','exports','unknown','not_inuse','inuse','invalid','unavailable','ringinuse','onhold','wav','wav49','gsm','roundrobin','name','monitor_format','type','inbound','total','answered','sumHoldTime','loggedIn','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel'];(function(_0x28c331,_0x3b4c3a){var _0x56dbb5=function(_0x282898){while(--_0x282898){_0x28c331['push'](_0x28c331['shift']());}};_0x56dbb5(++_0x3b4c3a);}(_0xfdd7,0xa3));var _0x7fdd=function(_0x150354,_0x3f2ac6){_0x150354=_0x150354-0x0;var _0x5babb5=_0xfdd7[_0x150354];return _0x5babb5;};'use strict';var statusDesc=[_0x7fdd('0x0'),_0x7fdd('0x1'),_0x7fdd('0x2'),'busy',_0x7fdd('0x3'),_0x7fdd('0x4'),'ringing',_0x7fdd('0x5'),_0x7fdd('0x6')];var monitorFormat={'wav':_0x7fdd('0x7'),'wav49':_0x7fdd('0x8'),'gsm':_0x7fdd('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x7fdd('0xa')};function VoiceQueue(_0x38fa2f){this['id']=_0x38fa2f['id']||0x0;this[_0x7fdd('0xb')]=_0x38fa2f['name']||'';this[_0x7fdd('0xc')]=_0x38fa2f[_0x7fdd('0xc')]||'';this[_0x7fdd('0xd')]=_0x38fa2f[_0x7fdd('0xd')]||_0x7fdd('0xe');this['waiting']=0x0;this['talking']=0x0;this[_0x7fdd('0xf')]=0x0;this[_0x7fdd('0x10')]=0x0;this['sumDuration']=0x0;this[_0x7fdd('0x11')]=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this[_0x7fdd('0x12')]=0x0;this['available']=0x0;this[_0x7fdd('0x13')]=_0x38fa2f['acw']||![];this[_0x7fdd('0x14')]=_0x38fa2f[_0x7fdd('0x14')]||0xa;this['autopause']=_0x38fa2f[_0x7fdd('0x15')]||'no';this[_0x7fdd('0x16')]=!![];this[_0x7fdd('0x17')]='';this[_0x7fdd('0x18')]=0x0;this[_0x7fdd('0x19')]=0x0;this[_0x7fdd('0x1a')]=_0x38fa2f[_0x7fdd('0x1a')]||null;this[_0x7fdd('0x1b')]=_0x38fa2f['dialGlobalInterval']?_0x38fa2f['dialGlobalInterval']:null;this[_0x7fdd('0x1c')]=_0x38fa2f['dialActive'];this[_0x7fdd('0x1d')]=_0x38fa2f[_0x7fdd('0x1d')]||'progressive';this[_0x7fdd('0x1e')]=_0x38fa2f['dialLimitChannel']||0x0;this[_0x7fdd('0x1f')]=_0x38fa2f[_0x7fdd('0x1f')]||0x0;this[_0x7fdd('0x20')]=_0x38fa2f[_0x7fdd('0x20')]||0x1;this[_0x7fdd('0x21')]=_0x38fa2f[_0x7fdd('0x21')]||_0x7fdd('0x22');this['dialPredictiveOptimizationPercentage']=_0x38fa2f[_0x7fdd('0x23')]||0.03;this['dialPredictiveInterval']=_0x38fa2f[_0x7fdd('0x24')]||0x258;this[_0x7fdd('0x25')]=_0x38fa2f[_0x7fdd('0x25')]||_0x7fdd('0x26');this[_0x7fdd('0x27')]=_0x38fa2f['dialOriginateCallerIdNumber']||_0x7fdd('0x26');this[_0x7fdd('0x28')]=_0x38fa2f[_0x7fdd('0x28')]||0x1e;this['dialQueueOptions']=_0x38fa2f[_0x7fdd('0x29')]||_0x7fdd('0x2a');this[_0x7fdd('0x2b')]=_0x38fa2f[_0x7fdd('0x2b')]||0x3;this[_0x7fdd('0x2c')]=_0x38fa2f[_0x7fdd('0x2c')]||undefined;this[_0x7fdd('0x2d')]=_0x38fa2f[_0x7fdd('0x2d')]||0x3;this[_0x7fdd('0x2e')]=_0x38fa2f[_0x7fdd('0x2e')]||0x96;this['dialBusyMaxRetry']=_0x38fa2f[_0x7fdd('0x2f')]||0x3;this[_0x7fdd('0x30')]=_0x38fa2f['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x38fa2f[_0x7fdd('0x31')]||0x3;this[_0x7fdd('0x32')]=_0x38fa2f[_0x7fdd('0x32')]||0x96;this['dialGlobalMaxRetry']=_0x38fa2f[_0x7fdd('0x33')]||0x4;this[_0x7fdd('0x34')]=_0x38fa2f[_0x7fdd('0x34')]?_0x38fa2f['Trunk']:undefined;this[_0x7fdd('0x35')]=_0x38fa2f[_0x7fdd('0x35')]?_0x38fa2f['TrunkBackup']:undefined;this['dialPrefix']=_0x38fa2f[_0x7fdd('0x36')]||undefined;this[_0x7fdd('0x37')]=_0x38fa2f[_0x7fdd('0x37')]?_0x38fa2f['Interval']:undefined;this[_0x7fdd('0x38')]=_0x38fa2f[_0x7fdd('0x38')]||_0x7fdd('0x39');this[_0x7fdd('0x3a')]=_0x38fa2f['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x7fdd('0x3b')]=_0x38fa2f[_0x7fdd('0x3b')]||undefined;this[_0x7fdd('0x3c')]=strategy[_0x38fa2f[_0x7fdd('0x3c')]]||_0x7fdd('0x3d');this[_0x7fdd('0x3e')]=!![];this['dialAMDActive']=_0x38fa2f[_0x7fdd('0x3f')]||![];this[_0x7fdd('0x40')]=_0x38fa2f[_0x7fdd('0x40')];this[_0x7fdd('0x41')]=_0x38fa2f[_0x7fdd('0x41')];this[_0x7fdd('0x42')]=_0x38fa2f[_0x7fdd('0x42')];this[_0x7fdd('0x43')]=_0x38fa2f['dialAMDTotalAnalysisTime'];this[_0x7fdd('0x44')]=_0x38fa2f[_0x7fdd('0x44')];this[_0x7fdd('0x45')]=_0x38fa2f[_0x7fdd('0x45')];this[_0x7fdd('0x46')]=_0x38fa2f['dialAMDMaximumNumberOfWords'];this[_0x7fdd('0x47')]=_0x38fa2f['dialAMDSilenceThreshold'];this[_0x7fdd('0x48')]=_0x38fa2f[_0x7fdd('0x48')];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0x7fdd('0x49')]=_0x38fa2f[_0x7fdd('0x49')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x7fdd('0x4a')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x7fdd('0x4b')]=0x0;this[_0x7fdd('0x4c')]=0x0;this[_0x7fdd('0x4d')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x7fdd('0x4e')]=0x0;this[_0x7fdd('0x4f')]=0x0;this[_0x7fdd('0x50')]=0x0;this[_0x7fdd('0x51')]=undefined;this[_0x7fdd('0x52')]=undefined;this[_0x7fdd('0x53')]=undefined;this[_0x7fdd('0x54')]=1.05;this[_0x7fdd('0x55')]=0x0;this[_0x7fdd('0x56')]=0x0;this[_0x7fdd('0x57')]=0x0;this[_0x7fdd('0x58')]=0x0;this[_0x7fdd('0x59')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalLowerLimit']=0.4;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x7fdd('0x5a')]=0x0;this['erlangCallToSecond']=0x0;this[_0x7fdd('0x5b')]=0x0;this['erlangBusyFactor']=0x0;this[_0x7fdd('0x5c')]=_0x38fa2f[_0x7fdd('0x5c')]||0x1e;this['dialRecallInQueue']=_0x38fa2f[_0x7fdd('0x5d')]||![];this[_0x7fdd('0x5e')]=_0x38fa2f[_0x7fdd('0x5e')]||undefined;this[_0x7fdd('0x5f')]=_0x38fa2f[_0x7fdd('0x5f')]||![];this['dialAgiAfterHangupAgent']=_0x38fa2f['dialAgiAfterHangupAgent']||![];this[_0x7fdd('0xc')]=monitorFormat[_0x38fa2f[_0x7fdd('0xc')]]?monitorFormat[_0x38fa2f[_0x7fdd('0xc')]]:undefined;}module[_0x7fdd('0x60')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index df7638b..64537c9 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 _0x2c1f=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x44166f,_0x3e71e2){var _0x5f390a=function(_0x4876fb){while(--_0x4876fb){_0x44166f['push'](_0x44166f['shift']());}};_0x5f390a(++_0x3e71e2);}(_0x2c1f,0x188));var _0xf2c1=function(_0x58ddbf,_0x26f5fc){_0x58ddbf=_0x58ddbf-0x0;var _0x4bb2e6=_0x2c1f[_0x58ddbf];return _0x4bb2e6;};'use strict';function VtigerAccount(_0x50a1a0){this['id']=_0x50a1a0['id']||0x0;this[_0xf2c1('0x0')]=_0x50a1a0[_0xf2c1('0x0')]||'';this[_0xf2c1('0x1')]=_0x50a1a0[_0xf2c1('0x1')]||'';this[_0xf2c1('0x2')]=_0x50a1a0[_0xf2c1('0x2')]||'';this[_0xf2c1('0x3')]=_0x50a1a0[_0xf2c1('0x3')]||'';this[_0xf2c1('0x4')]=_0x50a1a0[_0xf2c1('0x4')]||'';this['Configurations']=_0x50a1a0[_0xf2c1('0x5')]||{};}module[_0xf2c1('0x6')]=VtigerAccount; \ No newline at end of file +var _0xa337=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0xd011a4,_0x4605e9){var _0x2e81dd=function(_0x4e9b0f){while(--_0x4e9b0f){_0xd011a4['push'](_0xd011a4['shift']());}};_0x2e81dd(++_0x4605e9);}(_0xa337,0x183));var _0x7a33=function(_0x4852b5,_0x52af4c){_0x4852b5=_0x4852b5-0x0;var _0x101912=_0xa337[_0x4852b5];return _0x101912;};'use strict';function VtigerAccount(_0x3eb217){this['id']=_0x3eb217['id']||0x0;this[_0x7a33('0x0')]=_0x3eb217[_0x7a33('0x0')]||'';this[_0x7a33('0x1')]=_0x3eb217[_0x7a33('0x1')]||'';this[_0x7a33('0x2')]=_0x3eb217[_0x7a33('0x2')]||'';this['remoteUri']=_0x3eb217[_0x7a33('0x3')]||'';this[_0x7a33('0x4')]=_0x3eb217[_0x7a33('0x4')]||'';this[_0x7a33('0x5')]=_0x3eb217['Configurations']||{};}module[_0x7a33('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 1d21b9a..8711e17 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 _0xde69=['Configurations','exports','name','username','password','token','remoteUri','authType','type','serverUrl'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xde69,0x160));var _0x9de6=function(_0x48fd24,_0x13fa0b){_0x48fd24=_0x48fd24-0x0;var _0x2edb3a=_0xde69[_0x48fd24];return _0x2edb3a;};'use strict';function ZendeskAccount(_0x52291d){this['id']=_0x52291d['id']||0x0;this[_0x9de6('0x0')]=_0x52291d['name']||'';this[_0x9de6('0x1')]=_0x52291d[_0x9de6('0x1')]||'';this[_0x9de6('0x2')]=_0x52291d[_0x9de6('0x2')]||'';this['token']=_0x52291d[_0x9de6('0x3')]||'';this[_0x9de6('0x4')]=_0x52291d[_0x9de6('0x4')]||'';this[_0x9de6('0x5')]=_0x52291d[_0x9de6('0x5')]||'';this[_0x9de6('0x6')]=_0x52291d['type']||'integrationTab';this[_0x9de6('0x7')]=_0x52291d[_0x9de6('0x7')]||'';this[_0x9de6('0x8')]=_0x52291d[_0x9de6('0x8')]||{};}module[_0x9de6('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x3369=['name','username','token','remoteUri','type','serverUrl','Configurations','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3369,0x160));var _0x9336=function(_0x3813c9,_0x2f3bb3){_0x3813c9=_0x3813c9-0x0;var _0x561a96=_0x3369[_0x3813c9];return _0x561a96;};'use strict';function ZendeskAccount(_0x4bebb2){this['id']=_0x4bebb2['id']||0x0;this[_0x9336('0x0')]=_0x4bebb2[_0x9336('0x0')]||'';this[_0x9336('0x1')]=_0x4bebb2['username']||'';this['password']=_0x4bebb2['password']||'';this[_0x9336('0x2')]=_0x4bebb2[_0x9336('0x2')]||'';this[_0x9336('0x3')]=_0x4bebb2[_0x9336('0x3')]||'';this['authType']=_0x4bebb2['authType']||'';this['type']=_0x4bebb2[_0x9336('0x4')]||'integrationTab';this['serverUrl']=_0x4bebb2[_0x9336('0x5')]||'';this['Configurations']=_0x4bebb2[_0x9336('0x6')]||{};}module[_0x9336('0x7')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 8a15dac..76de761 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 _0x326f=['host','Configurations','serverUrl','exports','authToken'];(function(_0x165243,_0x3622b1){var _0x23988e=function(_0x247f7c){while(--_0x247f7c){_0x165243['push'](_0x165243['shift']());}};_0x23988e(++_0x3622b1);}(_0x326f,0xd1));var _0xf326=function(_0x172b2d,_0xa21793){_0x172b2d=_0x172b2d-0x0;var _0x31b3ad=_0x326f[_0x172b2d];return _0x31b3ad;};'use strict';function ZohoAccount(_0x450239){this['id']=_0x450239['id']||0x0;this['name']=_0x450239['name']||'';this[_0xf326('0x0')]=_0x450239[_0xf326('0x0')]||'';this[_0xf326('0x1')]=_0x450239[_0xf326('0x1')]||'';this[_0xf326('0x2')]=_0x450239[_0xf326('0x2')]||{};this[_0xf326('0x3')]=_0x450239[_0xf326('0x3')]||'';}module[_0xf326('0x4')]=ZohoAccount; \ No newline at end of file +var _0x01d9=['name','authToken','host','Configurations','serverUrl','exports'];(function(_0x578f6e,_0x31c39a){var _0x33b448=function(_0x2d0261){while(--_0x2d0261){_0x578f6e['push'](_0x578f6e['shift']());}};_0x33b448(++_0x31c39a);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';function ZohoAccount(_0x215d5a){this['id']=_0x215d5a['id']||0x0;this[_0x901d('0x0')]=_0x215d5a[_0x901d('0x0')]||'';this[_0x901d('0x1')]=_0x215d5a['authToken']||'';this[_0x901d('0x2')]=_0x215d5a[_0x901d('0x2')]||'';this[_0x901d('0x3')]=_0x215d5a[_0x901d('0x3')]||{};this[_0x901d('0x4')]=_0x215d5a[_0x901d('0x4')]||'';}module[_0x901d('0x5')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 67c9204..2d22d87 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 _0xd5e5=['name','channelAgent','membername','format','SIP/%s','calleridname','phone','firstName','Contact','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','isNil','string','uniqueid','type','campaigntype','queue','Agent'];(function(_0x1e172a,_0x52102b){var _0x96338b=function(_0x307313){while(--_0x307313){_0x1e172a['push'](_0x1e172a['shift']());}};_0x96338b(++_0x52102b);}(_0xd5e5,0x1d8));var _0x5d5e=function(_0x30f976,_0x2d86e9){_0x30f976=_0x30f976-0x0;var _0x30ee0f=_0xd5e5[_0x30f976];return _0x30ee0f;};'use strict';var util=require(_0x5d5e('0x0'));var _=require(_0x5d5e('0x1'));var moment=require('moment');function checkNameSurname(_0x5c0d3d,_0x3953a3,_0x25eb7e){var _0x474e0e='';if(!_[_0x5d5e('0x2')](_0x3953a3)&&_0x5d5e('0x3')===typeof _0x3953a3){_0x474e0e+=_0x3953a3;}if(!_[_0x5d5e('0x2')](_0x25eb7e)&&'string'===typeof _0x25eb7e){_0x474e0e+='\x20'+_0x25eb7e;}if(_0x474e0e!==''){return _0x474e0e;}return _0x5c0d3d;}function Action(_0x28b008,_0x2fcc70,_0x356d58,_0x22401b,_0x52d995){this[_0x5d5e('0x4')]=_0x356d58||undefined;this['idContact']=_0x28b008['id'];this['queue']=_0x2fcc70['name'];this[_0x5d5e('0x5')]=_0x2fcc70[_0x5d5e('0x5')];this[_0x5d5e('0x6')]=_0x5d5e('0x7');this['dialAnswer']=![];this['membername']=_[_0x5d5e('0x2')](_0x28b008[_0x5d5e('0x8')])?undefined:_0x28b008[_0x5d5e('0x8')][_0x5d5e('0x9')];this[_0x5d5e('0xa')]=this[_0x5d5e('0xb')]?util[_0x5d5e('0xc')](_0x5d5e('0xd'),this[_0x5d5e('0xb')]):_0x22401b||undefined;this[_0x5d5e('0xe')]=checkNameSurname(_0x28b008['Contact'][_0x5d5e('0xf')],_0x28b008['Contact'][_0x5d5e('0x10')],_0x28b008[_0x5d5e('0x11')][_0x5d5e('0x12')]);this[_0x5d5e('0x13')]=_0x28b008[_0x5d5e('0x13')]||![];this['calleridnum']=_0x28b008[_0x5d5e('0x11')][_0x5d5e('0xf')];this[_0x5d5e('0x14')]=_0x28b008[_0x5d5e('0x14')];this['countbusyretry']=_0x28b008[_0x5d5e('0x15')]||0x0;this[_0x5d5e('0x16')]=_0x28b008[_0x5d5e('0x16')]||0x0;this[_0x5d5e('0x17')]=_0x28b008['countnoanswerretry']||0x0;this[_0x5d5e('0x18')]=(_0x28b008[_0x5d5e('0x15')]||0x0)+(_0x28b008['countcongestionretry']||0x0)+(_0x28b008[_0x5d5e('0x17')]||0x0);this['callback']=_0x28b008[_0x5d5e('0x19')];this[_0x5d5e('0x1a')]=_0x28b008[_0x5d5e('0x1a')];this[_0x5d5e('0x1b')]=_0x28b008[_0x5d5e('0x1b')];this[_0x5d5e('0x1c')]=_0x28b008[_0x5d5e('0x1c')];this['ContactId']=_0x28b008['ContactId'];this[_0x5d5e('0x1d')]=_0x28b008[_0x5d5e('0x1d')];this[_0x5d5e('0x1e')]=_[_0x5d5e('0x2')](_0x28b008['Agent'])?_0x28b008['UserId']:_0x28b008[_0x5d5e('0x8')]['id'];this[_0x5d5e('0x1f')]=_0x28b008[_0x5d5e('0x1f')];this[_0x5d5e('0x20')]='';this['originatecalleridname']='';}Action['prototype'][_0x5d5e('0x21')]=function(){return util[_0x5d5e('0xc')](_0x5d5e('0x22'),this['calleridname'],this[_0x5d5e('0x23')]);};module[_0x5d5e('0x24')]=Action; \ No newline at end of file +var _0xeec3=['type','campaigntype','dialAnswer','membername','Agent','channelAgent','calleridname','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','originatecalleridnum','prototype','getCaller','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','idContact','queue','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xeec3,0xe8));var _0x3eec=function(_0x44e7bf,_0x7ba927){_0x44e7bf=_0x44e7bf-0x0;var _0x335c44=_0xeec3[_0x44e7bf];return _0x335c44;};'use strict';var util=require(_0x3eec('0x0'));var _=require(_0x3eec('0x1'));var moment=require(_0x3eec('0x2'));function checkNameSurname(_0x4af1ea,_0x2c68c5,_0x3124a7){var _0x402583='';if(!_[_0x3eec('0x3')](_0x2c68c5)&&_0x3eec('0x4')===typeof _0x2c68c5){_0x402583+=_0x2c68c5;}if(!_[_0x3eec('0x3')](_0x3124a7)&&_0x3eec('0x4')===typeof _0x3124a7){_0x402583+='\x20'+_0x3124a7;}if(_0x402583!==''){return _0x402583;}return _0x4af1ea;}function Action(_0x5ab0ff,_0x51f092,_0x7b6301,_0x555f4b,_0x5754b8){this['uniqueid']=_0x7b6301||undefined;this[_0x3eec('0x5')]=_0x5ab0ff['id'];this[_0x3eec('0x6')]=_0x51f092[_0x3eec('0x7')];this[_0x3eec('0x8')]=_0x51f092[_0x3eec('0x8')];this[_0x3eec('0x9')]='queue';this[_0x3eec('0xa')]=![];this[_0x3eec('0xb')]=_[_0x3eec('0x3')](_0x5ab0ff[_0x3eec('0xc')])?undefined:_0x5ab0ff['Agent'][_0x3eec('0x7')];this[_0x3eec('0xd')]=this[_0x3eec('0xb')]?util['format']('SIP/%s',this['membername']):_0x555f4b||undefined;this[_0x3eec('0xe')]=checkNameSurname(_0x5ab0ff[_0x3eec('0xf')]['phone'],_0x5ab0ff['Contact'][_0x3eec('0x10')],_0x5ab0ff[_0x3eec('0xf')][_0x3eec('0x11')]);this[_0x3eec('0x12')]=_0x5ab0ff[_0x3eec('0x12')]||![];this[_0x3eec('0x13')]=_0x5ab0ff[_0x3eec('0xf')][_0x3eec('0x14')];this[_0x3eec('0x15')]=_0x5ab0ff[_0x3eec('0x15')];this[_0x3eec('0x16')]=_0x5ab0ff['countbusyretry']||0x0;this[_0x3eec('0x17')]=_0x5ab0ff[_0x3eec('0x17')]||0x0;this[_0x3eec('0x18')]=_0x5ab0ff[_0x3eec('0x18')]||0x0;this[_0x3eec('0x19')]=(_0x5ab0ff[_0x3eec('0x16')]||0x0)+(_0x5ab0ff['countcongestionretry']||0x0)+(_0x5ab0ff[_0x3eec('0x18')]||0x0);this[_0x3eec('0x1a')]=_0x5ab0ff[_0x3eec('0x1a')];this['callbackuniqueid']=_0x5ab0ff[_0x3eec('0x1b')];this['callbackat']=_0x5ab0ff[_0x3eec('0x1c')];this['recallme']=_0x5ab0ff[_0x3eec('0x1d')];this[_0x3eec('0x1e')]=_0x5ab0ff[_0x3eec('0x1e')];this[_0x3eec('0x1f')]=_0x5ab0ff['ListId'];this['UserId']=_[_0x3eec('0x3')](_0x5ab0ff[_0x3eec('0xc')])?_0x5ab0ff[_0x3eec('0x20')]:_0x5ab0ff['Agent']['id'];this['VoiceQueueId']=_0x5ab0ff['VoiceQueueId'];this[_0x3eec('0x21')]='';this['originatecalleridname']='';}Action[_0x3eec('0x22')][_0x3eec('0x23')]=function(){return util[_0x3eec('0x24')](_0x3eec('0x25'),this[_0x3eec('0xe')],this[_0x3eec('0x26')]);};module[_0x3eec('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 27e279d..1f33f29 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 _0xb3f9=['dialBusyRetryFrequency','unlockAgent','activeContact','NOANSWER','countnoanswerretry','[callProgressDetectingCustomer][logNoAnswer]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','countcongestionretry','CANCEL','[syncHangupRequest][logAgentReject]','unlockContact','idContact','disableContact','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','AnswerAGI','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','isNil','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','Calling','[Preview][execCall][failure]','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','unmonitored','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','Agent','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','Contact','phone','substring','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','actionid','clone','isFailure','response','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','syncHangup','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','variables','filterKey','keys','variable','addVariable','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','moment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','socket.io-emitter','localhost','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','total','unmanaged','waiting','loggedInDb','dialMethod','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','originated','Trunk','active','callerid','Interval','stringify','md5','format','voice:queue:%s','voice_queue:save','voice_queue_channel:remove','sendMessageOneNotActive','paused','message','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','\x20is\x20disactive','prototype','syncCampaigns','hasOwnProperty','recallMe','clearZombieChannel','info','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','setMessage','AGENTS_NOT_LOGGED','isActive','dialActive','isTrunkReachable','TrunkBackup','ACTIVE','totalGlobal','NoSuchNumber','[callProgressDetectingCustomer][logNoSuch]','[callProgressDetectingCustomer][logNoSuchGlobal]','createCustomerFinal','linkedid','ANSWER','responsetime','answertime','uniqueid','\x20Queue','custom:agentconnect','buildObj','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','scheduledAt'];(function(_0x3b2db8,_0xf196b0){var _0x43e4ca=function(_0x18c3e5){while(--_0x18c3e5){_0x3b2db8['push'](_0x3b2db8['shift']());}};_0x43e4ca(++_0xf196b0);}(_0xb3f9,0x7a));var _0x9b3f=function(_0x207565,_0x245ed7){_0x207565=_0x207565-0x0;var _0x15014a=_0xb3f9[_0x207565];return _0x15014a;};'use strict';var util=require(_0x9b3f('0x0'));var _=require(_0x9b3f('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x9b3f('0x2'));var md5=require('md5');var logger=require(_0x9b3f('0x3'))(_0x9b3f('0x4'));var loggerAction=require(_0x9b3f('0x3'))(_0x9b3f('0x5'));var ami=require(_0x9b3f('0x6'));var rpcDb=require(_0x9b3f('0x7'));var Action=require('./action');var ut=require('./util/util');var io=require(_0x9b3f('0x8'))({'host':_0x9b3f('0x9'),'port':0x18eb});var Sequence=function(){};Sequence['prototype'][_0x9b3f('0xa')]=function(_0x53b154){this['tail']=this['tail']?this[_0x9b3f('0xb')]['finally'](_0x53b154):_0x53b154();};function Preview(_0x297ffa){this[_0x9b3f('0xc')]=new Sequence();this[_0x9b3f('0xd')]=_0x297ffa[_0x9b3f('0xe')];this[_0x9b3f('0xf')]=_0x297ffa['trunks'];this[_0x9b3f('0x10')]={};this[_0x9b3f('0x11')]=_0x297ffa[_0x9b3f('0x11')];this[_0x9b3f('0x12')]=0x0;ami['on'](_0x9b3f('0x13'),this[_0x9b3f('0x14')][_0x9b3f('0x15')](this));ami['on'](_0x9b3f('0x16'),this['syncHangup']['bind'](this));ami['on'](_0x9b3f('0x17'),this[_0x9b3f('0x18')][_0x9b3f('0x15')](this));ami['on'](_0x9b3f('0x19'),this[_0x9b3f('0x1a')]['bind'](this));ami['on']('newexten',this['syncNewExten'][_0x9b3f('0x15')](this));ami['on'](_0x9b3f('0x1b'),this[_0x9b3f('0x1c')][_0x9b3f('0x15')](this));ami['on'](_0x9b3f('0x1d'),this[_0x9b3f('0x1e')]['bind'](this));ami['on']('blindtransfer',this[_0x9b3f('0x1f')][_0x9b3f('0x15')](this));this[_0x9b3f('0x20')](this[_0x9b3f('0xd')]);}function emit(_0x213f46,_0x297fa8,_0x1524cb){io['to'](_0x213f46)[_0x9b3f('0x21')](_0x297fa8,_0x1524cb);}function emitCampaignPreview(_0x3f16aa){if(_0x3f16aa[_0x9b3f('0x22')]===_0x9b3f('0x23')){var _0x1cb346={'id':_0x3f16aa['id'],'name':_0x3f16aa[_0x9b3f('0x24')],'strategy':_0x3f16aa[_0x9b3f('0x25')],'answered':_0x3f16aa[_0x9b3f('0x26')],'available':_0x3f16aa[_0x9b3f('0x27')],'loggedIn':_0x3f16aa[_0x9b3f('0x28')],'pTalking':_0x3f16aa[_0x9b3f('0x29')],'sumBillable':_0x3f16aa[_0x9b3f('0x2a')],'sumDuration':_0x3f16aa['sumDuration'],'sumHoldTime':_0x3f16aa[_0x9b3f('0x2b')]||0x0,'talking':_0x3f16aa['talking'],'total':_0x3f16aa[_0x9b3f('0x2c')],'type':_0x3f16aa['type'],'unmanaged':_0x3f16aa[_0x9b3f('0x2d')],'waiting':_0x3f16aa[_0x9b3f('0x2e')],'loggedInDb':_0x3f16aa[_0x9b3f('0x2f')],'dialActive':_0x3f16aa['dialActive'],'dialMethod':_0x3f16aa[_0x9b3f('0x30')],'dialOriginateCallerIdName':_0x3f16aa['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x3f16aa[_0x9b3f('0x31')],'dialOriginateTimeout':_0x3f16aa['dialOriginateTimeout'],'dialPrefix':_0x3f16aa[_0x9b3f('0x32')],'outboundAnswerAgiCallsDay':_0x3f16aa[_0x9b3f('0x33')],'outboundAnswerCallsDay':_0x3f16aa['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x3f16aa[_0x9b3f('0x34')],'outboundBusyCallsDay':_0x3f16aa[_0x9b3f('0x35')],'outboundCongestionCallsDay':_0x3f16aa[_0x9b3f('0x36')],'outboundDropCallsDayACS':_0x3f16aa[_0x9b3f('0x37')],'outboundDropCallsDayCallersExit':_0x3f16aa['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x3f16aa['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x3f16aa[_0x9b3f('0x38')],'outboundNoSuchCallsDay':_0x3f16aa['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x3f16aa[_0x9b3f('0x39')],'outboundReCallsDay':_0x3f16aa['outboundReCallsDay'],'outboundRejectCallsDay':_0x3f16aa[_0x9b3f('0x3a')],'outboundUnknownCallsDay':_0x3f16aa[_0x9b3f('0x3b')],'predictiveIntervalAnsweredCalls':_0x3f16aa[_0x9b3f('0x3c')],'predictiveIntervalAvgHoldtime':_0x3f16aa[_0x9b3f('0x3d')],'predictiveIntervalAvgTalktime':_0x3f16aa[_0x9b3f('0x3e')],'predictiveIntervalDroppedCallsCallersExit':_0x3f16aa['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x3f16aa[_0x9b3f('0x3f')],'predictiveIntervalErlangCalls':_0x3f16aa[_0x9b3f('0x40')],'predictiveIntervalErlangCallsDroppedCalls':_0x3f16aa[_0x9b3f('0x41')],'predictiveIntervalHitRate':_0x3f16aa[_0x9b3f('0x42')],'predictiveIntervalLowerLimit':_0x3f16aa[_0x9b3f('0x43')],'predictiveIntervalMultiplicativeFactor':_0x3f16aa[_0x9b3f('0x44')],'predictiveIntervalPauses':_0x3f16aa[_0x9b3f('0x45')],'predictiveIntervalTotalCalls':_0x3f16aa['predictiveIntervalTotalCalls'],'message':_0x3f16aa['message'],'originated':_0x3f16aa[_0x9b3f('0x46')]};if(_0x3f16aa['Trunk']){_0x1cb346['Trunk']={'id':_0x3f16aa[_0x9b3f('0x47')]['id'],'name':_0x3f16aa['Trunk'][_0x9b3f('0x24')],'active':_0x3f16aa[_0x9b3f('0x47')][_0x9b3f('0x48')],'callerid':_0x3f16aa[_0x9b3f('0x47')][_0x9b3f('0x49')]};}if(_0x3f16aa['Interval']){_0x1cb346[_0x9b3f('0x4a')]={'id':_0x3f16aa[_0x9b3f('0x4a')]['id'],'name':_0x3f16aa[_0x9b3f('0x4a')][_0x9b3f('0x24')]};}var _0x378e87=md5(JSON[_0x9b3f('0x4b')](_0x1cb346));if(_0x3f16aa['md5']!==_0x378e87){_0x3f16aa[_0x9b3f('0x4c')]=_0x378e87;emit(util[_0x9b3f('0x4d')](_0x9b3f('0x4e'),_0x1cb346['name']),_0x9b3f('0x4f'),_0x1cb346);}}}function emitVoiceQueueChannelRemove(_0x417135){emit(util[_0x9b3f('0x4d')](_0x9b3f('0x4e'),_0x417135[_0x9b3f('0x24')]),_0x9b3f('0x50'),_0x417135);}function notSendMessagesQueue(_0x5431a6){if(_0x5431a6[_0x9b3f('0x51')]){if(_0x5431a6[_0x9b3f('0x46')]===0x0&&_0x5431a6[_0x9b3f('0x29')]===0x0){_0x5431a6[_0x9b3f('0x51')]=![];_0x5431a6[_0x9b3f('0x27')]=0x0;_0x5431a6[_0x9b3f('0x52')]=0x0;_0x5431a6[_0x9b3f('0x53')]=_0x9b3f('0x54');ut['logger'](_0x9b3f('0x55'),_0x5431a6[_0x9b3f('0x24')]+_0x9b3f('0x56'));}else{_0x5431a6[_0x9b3f('0x53')]=_0x9b3f('0x57');ut[_0x9b3f('0x58')](_0x9b3f('0x55'),_0x5431a6['name']+_0x9b3f('0x59'));}emitCampaignPreview(_0x5431a6);}}Preview[_0x9b3f('0x5a')]['loopCampaigns']=function(){var _0x38bb4b=this;setInterval(function(){_0x38bb4b[_0x9b3f('0x5b')]();},0x7cf);};Preview['prototype'][_0x9b3f('0x5b')]=function(){var _0x2afda2=this[_0x9b3f('0xd')];this['clockClearZombieChannels']+=0x1;for(var _0x11db55 in _0x2afda2){if(_0x2afda2[_0x9b3f('0x5c')](_0x11db55)&&(_0x2afda2[_0x11db55][_0x9b3f('0x30')]===_0x9b3f('0x4')||_0x2afda2[_0x11db55][_0x9b3f('0x30')]==='booked')&&_0x2afda2[_0x11db55]['type']===_0x9b3f('0x23')){if(this[_0x9b3f('0x12')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x2afda2[_0x9b3f('0x5c')](_0x11db55)&&_0x2afda2[_0x11db55]['dialMethod']===_0x9b3f('0x4')&&_0x2afda2[_0x11db55]['type']===_0x9b3f('0x23')){if(_0x2afda2[_0x11db55]['dialActive']){this['setMessage'](_0x2afda2[_0x11db55]);this[_0x9b3f('0x5d')](_0x2afda2[_0x11db55]);}else{notSendMessagesQueue(_0x2afda2[_0x11db55]);}}}};Preview[_0x9b3f('0x5a')][_0x9b3f('0x5e')]=function(_0x1300dc){var _0x588e84=this;this['sequence'][_0x9b3f('0xa')](function(){if(!_['isNil'](_0x588e84[_0x9b3f('0x10')][_0x1300dc])){loggerAction[_0x9b3f('0x5f')]('[clearZombieChannels][talking]',_0x1300dc,_0x9b3f('0x60'),_0x588e84[_0x9b3f('0x10')][_0x1300dc][_0x9b3f('0x61')],_0x9b3f('0x62'),JSON['stringify'](_0x588e84[_0x9b3f('0xd')][_0x588e84[_0x9b3f('0x10')][_0x1300dc][_0x9b3f('0x61')]][_0x9b3f('0x46')]),_0x9b3f('0x63'),JSON['stringify'](_0x588e84[_0x9b3f('0xd')][_0x588e84[_0x9b3f('0x10')][_0x1300dc]['queue']][_0x9b3f('0x29')]),JSON[_0x9b3f('0x4b')](_0x588e84[_0x9b3f('0x10')][_0x1300dc][_0x9b3f('0x64')]),JSON[_0x9b3f('0x4b')](_[_0x9b3f('0x65')](_0x588e84[_0x9b3f('0x10')][_0x1300dc],['contactId',_0x9b3f('0x66'),_0x9b3f('0x67'),_0x9b3f('0x68')])));return ami[_0x9b3f('0x69')]({'action':_0x9b3f('0x6a'),'channel':_0x588e84[_0x9b3f('0x10')][_0x1300dc][_0x9b3f('0x6b')]})[_0x9b3f('0x6c')](function(_0xbbd406){if(_0xbbd406['message']===_0x9b3f('0x6d')){setTimeout(function(){if(_0x588e84['actions'][_0x1300dc]){ut[_0x9b3f('0x6e')](_0x588e84[_0x9b3f('0xd')][_0x588e84[_0x9b3f('0x10')][_0x1300dc][_0x9b3f('0x61')]],'[clearZombieChannel]');if(_0x588e84[_0x9b3f('0x10')][_0x1300dc][_0x9b3f('0x64')]===!![]){ut[_0x9b3f('0x6f')](_0x588e84[_0x9b3f('0xd')][_0x588e84['actions'][_0x1300dc]['queue']],'[clearZombieChannel]');ut['loggerError'](_0x9b3f('0x70')+_0x1300dc,_0x588e84[_0x9b3f('0x10')][_0x1300dc][_0x9b3f('0x61')]);}ut[_0x9b3f('0x71')](_0x9b3f('0x72')+_0x1300dc,_0x588e84['actions'][_0x1300dc][_0x9b3f('0x61')]);delete _0x588e84['actions'][_0x1300dc];}},0x2328);}});}});};Preview[_0x9b3f('0x5a')][_0x9b3f('0x73')]=function(){var _0x5df6dc=this;loggerAction[_0x9b3f('0x5f')](_0x9b3f('0x74'),_[_0x9b3f('0x75')](this[_0x9b3f('0x10')]));for(var _0x36320e in this[_0x9b3f('0x10')]){if(_0x5df6dc[_0x9b3f('0x10')]['hasOwnProperty'](_0x36320e)){_0x5df6dc[_0x9b3f('0x5e')](_0x36320e);}}};Preview['prototype'][_0x9b3f('0x5d')]=function(_0x264de2){var _0x7839f9=this;rpcDb[_0x9b3f('0x76')](_0x264de2['id'],ut[_0x9b3f('0x77')](this['agents']))[_0x9b3f('0x78')](function(_0xbea8cb){if(!_['isNil'](_0xbea8cb)){for(var _0x91a863=0x0;_0x91a863<_0xbea8cb[_0x9b3f('0x79')];_0x91a863+=0x1){if(ut[_0x9b3f('0x7a')](_0xbea8cb[_0x91a863]['scheduledat'])<_0x264de2[_0x9b3f('0x7b')]*0x3c){_0x7839f9[_0x9b3f('0x7c')](_0xbea8cb[_0x91a863]['id'])['then'](ut[_0x9b3f('0x7d')](_0x9b3f('0x7e')))[_0x9b3f('0x6c')](ut[_0x9b3f('0x7d')](_0x9b3f('0x7e')));}else{var _0x526623=new Action(_0xbea8cb[_0x91a863],_0x264de2);_0x526623[_0x9b3f('0x7f')]=moment()[_0x9b3f('0x4d')](_0x9b3f('0x80'));_0x264de2[_0x9b3f('0x81')]+=0x1;ut[_0x9b3f('0x82')](_0x526623,0x17,_0x9b3f('0x83'));if(_0x264de2[_0x9b3f('0x84')]){rpcDb[_0x9b3f('0x85')](ut[_0x9b3f('0x86')](_0xbea8cb[_0x91a863]));rpcDb[_0x9b3f('0x87')](_0x526623,_0x9b3f('0x88'));}else{ut[_0x9b3f('0x82')](_0x526623,0x16,_0x9b3f('0x89'));rpcDb[_0x9b3f('0x87')](_0x526623,_0x9b3f('0x8a'));rpcDb['createCustomerFinal'](_0x526623,_0x9b3f('0x8a'));}}}}})[_0x9b3f('0x6c')](ut[_0x9b3f('0x7d')](_0x9b3f('0x8b')));};Preview[_0x9b3f('0x5a')][_0x9b3f('0x8c')]=function(_0x2ff84b){_0x2ff84b[_0x9b3f('0x51')]=!![];if(ut['IsNotLoggedIn'](_0x2ff84b[_0x9b3f('0x28')])){_0x2ff84b['message']=_0x9b3f('0x8d');}else if(!ut[_0x9b3f('0x8e')](_0x2ff84b[_0x9b3f('0x8f')])){_0x2ff84b[_0x9b3f('0x53')]=_0x9b3f('0x54');}else if(!this[_0x9b3f('0x90')](_0x2ff84b[_0x9b3f('0x47')])){if(!this[_0x9b3f('0x90')](_0x2ff84b[_0x9b3f('0x91')])){_0x2ff84b[_0x9b3f('0x53')]='TRUNK_IS_NOT_REACHABLE';}else{_0x2ff84b[_0x9b3f('0x53')]=_0x9b3f('0x92');}}else{_0x2ff84b[_0x9b3f('0x53')]=_0x9b3f('0x92');}emitCampaignPreview(_0x2ff84b);};Preview[_0x9b3f('0x5a')]['callProgressDetectingCustomer']=function(_0x1e5fd4,_0x3f8cba,_0x57e385){var _0x1f6049=this;var _0x5ad8df=this['actions'][_0x3f8cba];var _0x564850=this['campaignsPreview'][_0x5ad8df[_0x9b3f('0x61')]];var _0x401089;if(_0x564850){switch(_0x57e385){case'1':_0x564850['outboundNoSuchCallsDay']+=0x1;_0x5ad8df['countglobal']=ut[_0x9b3f('0x93')](_0x5ad8df);ut[_0x9b3f('0x82')](_0x5ad8df,0x0,_0x9b3f('0x94'));rpcDb['createCustomerHistory'](_0x5ad8df,_0x9b3f('0x95'));if(ut['totalGlobal'](_0x5ad8df)>=_0x564850['dialGlobalMaxRetry']){_0x401089=ut['cloneAction'](_0x5ad8df,0xf,'Global');rpcDb['createCustomerFinal'](_0x401089,_0x9b3f('0x96'));}else{rpcDb[_0x9b3f('0x97')](_0x5ad8df,_0x9b3f('0x96'));}delete this[_0x9b3f('0x10')][_0x1e5fd4[_0x9b3f('0x98')]];break;case _0x9b3f('0x99'):var _0x321eb8=moment()['format'](_0x9b3f('0x80'));_0x5ad8df[_0x9b3f('0x9a')]=_0x321eb8;_0x5ad8df[_0x9b3f('0x9b')]=_0x321eb8;_0x5ad8df[_0x9b3f('0x64')]=!![];_0x564850[_0x9b3f('0x29')]+=0x1;logger['info']('[syncHangup][talking][increment]',_0x5ad8df[_0x9b3f('0x9c')],_0x9b3f('0x9d'),_0x564850['name'],_0x9b3f('0x63'),_0x564850[_0x9b3f('0x29')]);ami[_0x9b3f('0x21')](_0x9b3f('0x9e'),ut[_0x9b3f('0x9f')](_0x5ad8df,'connect'));if(_0x564850[_0x9b3f('0xa0')]){ami[_0x9b3f('0x21')](_0x9b3f('0xa1'),ut[_0x9b3f('0xa2')](_0x5ad8df));}break;case'16':ami['emit'](_0x9b3f('0xa3'),ut[_0x9b3f('0x9f')](_0x5ad8df,_0x9b3f('0xa4')));emitVoiceQueueChannelRemove(ut['buildObj'](_0x5ad8df,_0x9b3f('0xa4')));_0x564850['outboundAnswerCallsDay']+=0x1;_0x564850[_0x9b3f('0x2c')]+=0x1;_0x564850[_0x9b3f('0x26')]+=0x1;ut[_0x9b3f('0x6f')](_0x564850,_0x9b3f('0xa5'));_0x5ad8df[_0x9b3f('0xa6')]=ut[_0x9b3f('0x93')](_0x5ad8df);ut[_0x9b3f('0x82')](_0x5ad8df,0x4,_0x9b3f('0xa7'));rpcDb[_0x9b3f('0x87')](_0x5ad8df,_0x9b3f('0xa8'));rpcDb[_0x9b3f('0x97')](_0x5ad8df,_0x9b3f('0xa9'));rpcDb[_0x9b3f('0xaa')](_0x5ad8df);_0x564850[_0x9b3f('0xab')]+=_0x5ad8df[_0x9b3f('0xac')];_0x564850[_0x9b3f('0x2a')]+=_0x5ad8df['talktime'];logger['info'](_0x9b3f('0xad'),_0x5ad8df[_0x9b3f('0x9c')],_0x9b3f('0x9d'),_0x564850[_0x9b3f('0x24')],_0x9b3f('0x63'),_0x564850[_0x9b3f('0x29')]);delete this[_0x9b3f('0x10')][_0x1e5fd4[_0x9b3f('0x98')]];break;case'BUSY':_0x564850[_0x9b3f('0x35')]+=0x1;_0x5ad8df[_0x9b3f('0xae')]+=0x1;_0x5ad8df[_0x9b3f('0xa6')]=ut[_0x9b3f('0x93')](_0x5ad8df);ut[_0x9b3f('0x82')](_0x5ad8df,0x5,_0x9b3f('0xaf'));rpcDb[_0x9b3f('0x87')](_0x5ad8df,_0x9b3f('0xb0'));if(ut[_0x9b3f('0x93')](_0x5ad8df)>=_0x564850['dialGlobalMaxRetry']){_0x401089=ut[_0x9b3f('0xb1')](_0x5ad8df,0xf,'Global');rpcDb[_0x9b3f('0x97')](_0x401089,_0x9b3f('0xb2'));}else{if(_0x5ad8df['countbusyretry']>=_0x564850[_0x9b3f('0xb3')]){rpcDb[_0x9b3f('0x97')](_0x5ad8df,_0x9b3f('0xb0'));}else{rpcDb[_0x9b3f('0xb4')](ut[_0x9b3f('0xb5')](_0x5ad8df,'countbusyretry',_0x564850[_0x9b3f('0xb6')]),_0x5ad8df[_0x9b3f('0xb7')],_0x5ad8df[_0x9b3f('0xb8')]);}}break;case _0x9b3f('0xb9'):_0x564850[_0x9b3f('0x38')]+=0x1;_0x5ad8df[_0x9b3f('0xba')]+=0x1;_0x5ad8df[_0x9b3f('0xa6')]=ut[_0x9b3f('0x93')](_0x5ad8df);ut[_0x9b3f('0x82')](_0x5ad8df,0x3,'NoAnswer');rpcDb[_0x9b3f('0x87')](_0x5ad8df,_0x9b3f('0xbb'));if(ut[_0x9b3f('0x93')](_0x5ad8df)>=_0x564850[_0x9b3f('0xbc')]){_0x401089=ut[_0x9b3f('0xb1')](_0x5ad8df,0xf,_0x9b3f('0xbd'));rpcDb[_0x9b3f('0x97')](_0x401089,_0x9b3f('0xbe'));}else{if(_0x5ad8df['countnoanswerretry']>=_0x564850[_0x9b3f('0xbf')]){rpcDb['createCustomerFinal'](_0x5ad8df,_0x9b3f('0xbb'));}else{rpcDb[_0x9b3f('0xb4')](ut[_0x9b3f('0xb5')](_0x5ad8df,_0x9b3f('0xba'),_0x564850['dialNoAnswerRetryFrequency']),_0x5ad8df[_0x9b3f('0xb7')],_0x5ad8df[_0x9b3f('0xb8')]);}}break;case _0x9b3f('0xc0'):_0x564850['outboundCongestionCallsDay']+=0x1;_0x5ad8df['countcongestionretry']+=0x1;_0x5ad8df[_0x9b3f('0xa6')]=ut[_0x9b3f('0x93')](_0x5ad8df);ut[_0x9b3f('0x82')](_0x5ad8df,0x8,'Congestion');rpcDb['createCustomerHistory'](_0x5ad8df,_0x9b3f('0xc1'));if(ut['totalGlobal'](_0x5ad8df)>=_0x564850['dialGlobalMaxRetry']){_0x401089=ut[_0x9b3f('0xb1')](_0x5ad8df,0xf,_0x9b3f('0xbd'));rpcDb[_0x9b3f('0x97')](_0x401089,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x5ad8df['countcongestionretry']>=_0x564850[_0x9b3f('0xc2')]){rpcDb[_0x9b3f('0x97')](_0x5ad8df,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0x9b3f('0xb5')](_0x5ad8df,_0x9b3f('0xc3'),_0x564850[_0x9b3f('0xb6')]),_0x5ad8df[_0x9b3f('0xb7')],_0x5ad8df[_0x9b3f('0xb8')]);}}break;case _0x9b3f('0xc4'):_0x564850[_0x9b3f('0x3a')]+=0x1;_0x5ad8df['countglobal']=ut[_0x9b3f('0x93')](_0x5ad8df);ut['logCustomer'](_0x5ad8df,0x14,'AgentReject');rpcDb[_0x9b3f('0x87')](_0x5ad8df,_0x9b3f('0xc5'));if(_0x5ad8df[_0x9b3f('0xb7')]){rpcDb[_0x9b3f('0xc6')](_0x5ad8df[_0x9b3f('0xc7')]);}if(_0x5ad8df[_0x9b3f('0xb8')]){rpcDb[_0x9b3f('0xc8')](_0x5ad8df['idContact']);}break;default:if(_0x5ad8df[_0x9b3f('0x64')]){ut[_0x9b3f('0x6f')](_0x564850,_0x9b3f('0xc9'));ut[_0x9b3f('0x71')](_0x9b3f('0xca')+_0x564850[_0x9b3f('0x24')],_0x1e5fd4);}_0x564850['outboundUnknownCallsDay']+=0x1;_0x5ad8df[_0x9b3f('0xa6')]=ut[_0x9b3f('0x93')](_0x5ad8df);ut['logCustomer'](_0x5ad8df,0xc,_0x1e5fd4['cause-txt']||_0x1e5fd4[_0x9b3f('0xcb')]);rpcDb[_0x9b3f('0x87')](_0x5ad8df,_0x9b3f('0xcc'));if(ut['totalGlobal'](_0x5ad8df)>=_0x564850['dialGlobalMaxRetry']){_0x401089=ut[_0x9b3f('0xb1')](_0x5ad8df,0xf,_0x9b3f('0xbd'));rpcDb['createCustomerFinal'](_0x401089,_0x9b3f('0xcd'));}else{rpcDb[_0x9b3f('0x97')](_0x5ad8df,_0x9b3f('0xcd'));}delete this['actions'][_0x1e5fd4[_0x9b3f('0x98')]];}if(!(_0x5ad8df[_0x9b3f('0x64')]&&_0x57e385==='16')){ut[_0x9b3f('0x6e')](_0x564850,_0x9b3f('0xce'));logger[_0x9b3f('0x5f')](_0x9b3f('0xcf'),_0x5ad8df[_0x9b3f('0x9c')],'\x20Queue',_0x564850[_0x9b3f('0x24')],_0x9b3f('0x62'),_0x564850[_0x9b3f('0x46')]);}if(_0x57e385!==_0x9b3f('0x99')){delete this[_0x9b3f('0x10')][_0x1e5fd4[_0x9b3f('0x98')]];delete this[_0x9b3f('0x10')][_0x1e5fd4[_0x9b3f('0xd0')]];}}};Preview[_0x9b3f('0x5a')][_0x9b3f('0xd1')]=function(_0x5a6fa1,_0x5e7901,_0xa0582d){if(_[_0x9b3f('0xd2')](_0x5e7901)&&_0x9b3f('0xd3')!==typeof _0x5e7901){return;}if(_[_0x9b3f('0xd2')](_0xa0582d)&&_0x9b3f('0xd3')!==typeof _0xa0582d){return;}switch(_0xa0582d[_0x9b3f('0xd4')]){case'0':ut['logAgent'](_0x5a6fa1,0x0,'NoSuchNumber');rpcDb[_0x9b3f('0xd5')](_0x5a6fa1,_0x9b3f('0xd6'));break;case'3':ut[_0x9b3f('0xd7')](_0x5a6fa1,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0x5a6fa1,_0x9b3f('0xd8'));break;case'5':ut['logAgent'](_0x5a6fa1,0x5,_0x9b3f('0xaf'));rpcDb[_0x9b3f('0xd5')](_0x5a6fa1,_0x9b3f('0xd9'));break;case'8':ut['logAgent'](_0x5a6fa1,0x8,_0x9b3f('0xda'));rpcDb[_0x9b3f('0xd5')](_0x5a6fa1,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x9b3f('0xd7')](_0x5a6fa1,0x16,_0x9b3f('0xdb'));rpcDb['createAgentHistory'](_0x5a6fa1,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x5a6fa1,0xc,_0xa0582d[_0x9b3f('0xd4')]);rpcDb[_0x9b3f('0xd5')](_0x5a6fa1,_0x9b3f('0xdc'));}ut[_0x9b3f('0x6e')](_0x5e7901,_0x9b3f('0xdd'));logger['info'](_0x9b3f('0xde'),_0x5a6fa1[_0x9b3f('0x9c')],'\x20Queue',_0x5e7901[_0x9b3f('0x24')],_0x9b3f('0x62'),_0x5e7901[_0x9b3f('0x46')]);delete this['actions'][_0x5a6fa1[_0x9b3f('0x9c')]];};Preview[_0x9b3f('0x5a')][_0x9b3f('0xdf')]=function(_0x2d4782,_0x4e3fc8,_0x352d65,_0x4193bc,_0x444708){var _0x12dd14=this;return new BPromise(function(_0x29a050,_0x23f276){if(_[_0x9b3f('0xe0')](_0x4e3fc8)||_[_0x9b3f('0xe0')](_0x4e3fc8['Contact'])||_['isNil'](_0x4e3fc8['Contact']['phone'])||_[_0x9b3f('0xe0')](_0x4e3fc8['VoiceQueueId'])){_0x23f276(ut[_0x9b3f('0x53')]('Contact\x20is\x20undefined',_0x4193bc,_0x444708));return;}var _0x5177dd=uuid['v4']();var _0x34a8f2=_0x12dd14['campaignsPreview'][_0x4e3fc8[_0x9b3f('0x60')][_0x9b3f('0x24')]];var _0x50d5a0=_0x352d65?_0x12dd14['agents'][_0x352d65]['id']:undefined;_0x12dd14[_0x9b3f('0x10')][_0x5177dd]=new Action(_0x4e3fc8,_0x34a8f2,_0x5177dd,_0x352d65,_0x50d5a0);var _0xf0d00f=_0x12dd14[_0x9b3f('0x10')][_0x5177dd];_0xf0d00f['unlockAgent']=_0x4193bc;_0xf0d00f[_0x9b3f('0xb8')]=_0x444708;_0xf0d00f[_0x9b3f('0xe1')]=_0x352d65;if(_['isEmpty'](_0x2d4782)){_0x12dd14[_0x9b3f('0xe2')](_0xf0d00f,_0x34a8f2,_0x4e3fc8,_0x352d65)[_0x9b3f('0x78')](function(_0x49c0ea){logger[_0x9b3f('0x5f')](_0x9b3f('0xe3'),_0x9b3f('0xe4')+_0xf0d00f[_0x9b3f('0x61')]+'\x20IdHopper:\x20'+_0xf0d00f['idContact'],JSON[_0x9b3f('0x4b')](_0x49c0ea));ami['emit']('custom:agentcalled',ut[_0x9b3f('0x9f')](_0xf0d00f,'called'));_0x29a050(ut[_0x9b3f('0x53')](_0x9b3f('0xe5')));})[_0x9b3f('0x6c')](function(_0x3fab5c){ut['logger'](_0x9b3f('0xe6'),_0x3fab5c);_0x23f276(ut[_0x9b3f('0x53')]('Call\x20failed',_0x4193bc,_0x444708));});}else{_0x34a8f2[_0x9b3f('0x34')]+=0x1;ut['logBlacklist'](_0xf0d00f);rpcDb[_0x9b3f('0xe7')](_0xf0d00f,_0x9b3f('0xe8'));delete _0x12dd14[_0x9b3f('0x10')][_0x5177dd];_0x23f276(ut['message'](_0x9b3f('0xe9'),_0x4193bc,_0x444708));}});};Preview[_0x9b3f('0x5a')][_0x9b3f('0x90')]=function(_0x12ed0a){return!_[_0x9b3f('0xe0')](_0x12ed0a)&&!_[_0x9b3f('0xe0')](_0x12ed0a[_0x9b3f('0x24')])&&!_[_0x9b3f('0xe0')](_0x12ed0a[_0x9b3f('0x48')])&&_0x12ed0a[_0x9b3f('0x48')]&&!_[_0x9b3f('0xe0')](this[_0x9b3f('0xf')][util[_0x9b3f('0x4d')](_0x9b3f('0xea'),_0x12ed0a[_0x9b3f('0x24')])])&&!_[_0x9b3f('0xe0')](this[_0x9b3f('0xf')][util[_0x9b3f('0x4d')](_0x9b3f('0xea'),_0x12ed0a['name'])]['status'])&&(this['trunks'][util[_0x9b3f('0x4d')]('SIP/%s',_0x12ed0a[_0x9b3f('0x24')])][_0x9b3f('0x6a')]==='reachable'||this[_0x9b3f('0xf')][util[_0x9b3f('0x4d')](_0x9b3f('0xea'),_0x12ed0a[_0x9b3f('0x24')])][_0x9b3f('0x6a')]===_0x9b3f('0xeb'));};Preview[_0x9b3f('0x5a')]['run']=function(_0xb8281a,_0x137786){var _0x13f0f2=this;return new BPromise(function(_0x45f5ca,_0x551c49){_0x13f0f2[_0x9b3f('0xec')](_0xb8281a,_0x137786)[_0x9b3f('0x78')](function(_0x14f1e9){_0x45f5ca(_['pick'](_0x14f1e9,[_0x9b3f('0x53')]));})['catch'](function(_0x57d6e2){if(_0x57d6e2['unlock']){rpcDb['unlockContact'](_0xb8281a);}if(_0x57d6e2['active']){rpcDb['disableContact'](_0xb8281a);}_0x551c49(_['pick'](_0x57d6e2,[_0x9b3f('0x53')]));});});};Preview[_0x9b3f('0x5a')][_0x9b3f('0xec')]=function(_0x2f01c8,_0x4507c9){var _0x34a2aa=this;return new BPromise(function(_0x33adb1,_0x2822ad){var _0x2f4ccd,_0x437bf2;rpcDb[_0x9b3f('0xed')](_0x2f01c8)['then'](function(_0x188157){if(!_[_0x9b3f('0xe0')](_0x188157[0x0])){_0x437bf2=_0x188157[0x0][_0x9b3f('0xee')]?![]:!![];_0x2f4ccd=_0x188157[0x0][_0x9b3f('0xee')]?!![]:![];_0x2f4ccd=_0x4507c9?!![]:_0x2f4ccd;}var _0x5a8d5a=_0x34a2aa[_0x9b3f('0xef')](_0x188157);if(_0x5a8d5a[_0x9b3f('0xf0')]){rpcDb[_0x9b3f('0xf1')](_['pick'](_0x188157[0x0],[_0x9b3f('0x67'),_0x9b3f('0xf2')]))[_0x9b3f('0x78')](function(_0x526297){_0x34a2aa[_0x9b3f('0xdf')](_0x526297,_0x188157[0x0],_0x4507c9,_0x437bf2,_0x2f4ccd)['then'](function(_0x2cb568){_0x33adb1(_0x2cb568);})['catch'](function(_0x48ddb0){_0x2822ad(_0x48ddb0);});})[_0x9b3f('0x6c')](function(_0xc4af69){ut[_0x9b3f('0x58')](_0x9b3f('0xf3'),_0xc4af69);_0x2822ad(ut[_0x9b3f('0x53')](_0x9b3f('0xf4'),_0x437bf2,_0x2f4ccd));});}else{_0x2822ad(ut[_0x9b3f('0x53')](_0x5a8d5a[_0x9b3f('0x53')],_0x437bf2,_0x2f4ccd));}})[_0x9b3f('0x6c')](function(_0x5cc7bf){ut[_0x9b3f('0x58')](_0x9b3f('0xf5'),_0x5cc7bf);_0x2822ad(ut[_0x9b3f('0x53')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x9b3f('0x5a')][_0x9b3f('0xef')]=function(_0x3fdd88){if(_[_0x9b3f('0xe0')](_0x3fdd88)||_[_0x9b3f('0xf6')](_0x3fdd88)||!_[_0x9b3f('0xe0')](_0x3fdd88[0x0][_0x9b3f('0xf7')])&&_['isNil'](_0x3fdd88[0x0][_0x9b3f('0xf7')]['name'])){ut[_0x9b3f('0x58')](_0x9b3f('0xf8'),_0x3fdd88);return{'isValid':![],'message':_0x9b3f('0xf9')};}var _0x4cfe09=this[_0x9b3f('0xd')][_0x3fdd88[0x0][_0x9b3f('0x60')][_0x9b3f('0x24')]];_0x4cfe09[_0x9b3f('0x53')]=_0x9b3f('0x92');if(_['isNil'](_0x4cfe09)){ut[_0x9b3f('0x58')](_0x9b3f('0xfa'),_0x4cfe09);return{'isValid':![],'message':_0x9b3f('0xfb')};}if(!this['isTrunkReachable'](_0x4cfe09[_0x9b3f('0x47')])){ut[_0x9b3f('0x58')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x9b3f('0xfc')+_0x4cfe09[_0x9b3f('0x24')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x9b3f('0x90')](_0x4cfe09[_0x9b3f('0x91')])){ut['logger'](_0x9b3f('0xfd'),_0x4cfe09[_0x9b3f('0x24')]+_0x9b3f('0xfe'));return{'isValid':![],'message':_0x9b3f('0xff')};}}if(!ut[_0x9b3f('0x8e')](_0x4cfe09['dialActive'])){ut[_0x9b3f('0x58')]('[Preview][validateContact][Campaign\x20Active]',_0x4cfe09[_0x9b3f('0x24')]+_0x9b3f('0x100'));return{'isValid':![],'message':_0x9b3f('0xfc')+_0x4cfe09[_0x9b3f('0x24')]+_0x9b3f('0x100')};}return{'isValid':!![],'message':_0x9b3f('0x101')};};Preview['prototype'][_0x9b3f('0xe2')]=function(_0x425968,_0x16ecbf,_0x59e63b,_0x27f5cf){var _0x142f6b=this;return new BPromise(function(_0x2f0f05,_0x31443f){var _0x42c2a7=_0x425968[_0x9b3f('0x9c')];var _0x27b823=_0x142f6b[_0x9b3f('0x90')](_0x16ecbf[_0x9b3f('0x47')])?util[_0x9b3f('0x4d')](_0x9b3f('0x102'),_0x16ecbf[_0x9b3f('0x47')][_0x9b3f('0x24')],_[_0x9b3f('0xe0')](_0x16ecbf['dialPrefix'])?'':_0x16ecbf[_0x9b3f('0x32')][_0x9b3f('0x103')]()||'',_0x16ecbf[_0x9b3f('0x104')]>0x0?_0x59e63b[_0x9b3f('0x105')][_0x9b3f('0x106')][_0x9b3f('0x107')](_0x16ecbf[_0x9b3f('0x104')]):_0x59e63b[_0x9b3f('0x105')][_0x9b3f('0x106')]):util['format'](_0x9b3f('0x102'),_[_0x9b3f('0xe0')](_0x16ecbf[_0x9b3f('0x91')])?_0x16ecbf[_0x9b3f('0x47')][_0x9b3f('0x24')]:_0x16ecbf[_0x9b3f('0x91')]['name'],_[_0x9b3f('0xe0')](_0x16ecbf['dialPrefix'])?'':_0x16ecbf[_0x9b3f('0x32')]['trim']()||'',_0x16ecbf['dialCutDigit']>0x0?_0x59e63b[_0x9b3f('0x105')]['phone'][_0x9b3f('0x107')](_0x16ecbf[_0x9b3f('0x104')]):_0x59e63b['Contact'][_0x9b3f('0x106')]);var _0x55b3e5=_0x142f6b[_0x9b3f('0x90')](_0x16ecbf[_0x9b3f('0x47')])?ut['getCallerId'](_0x16ecbf[_0x9b3f('0x47')]['callerid'],_0x16ecbf[_0x9b3f('0x108')],_0x16ecbf[_0x9b3f('0x109')]>0x0?ut[_0x9b3f('0x10a')](_0x16ecbf[_0x9b3f('0x31')],_0x16ecbf[_0x9b3f('0x109')]):_0x16ecbf[_0x9b3f('0x31')]):ut[_0x9b3f('0x10b')](_[_0x9b3f('0xe0')](_0x16ecbf[_0x9b3f('0x91')])?_0x16ecbf[_0x9b3f('0x47')][_0x9b3f('0x49')]:_0x16ecbf['TrunkBackup'][_0x9b3f('0x49')],_0x16ecbf['dialOriginateCallerIdName'],_0x16ecbf[_0x9b3f('0x109')]>0x0?ut[_0x9b3f('0x10a')](_0x16ecbf[_0x9b3f('0x31')],_0x16ecbf['dialRandomLastDigitCallerIdNumber']):_0x16ecbf[_0x9b3f('0x31')]);if(_0x55b3e5){_0x425968[_0x9b3f('0x10c')]=ut['extractCalleridName'](_0x55b3e5);_0x425968[_0x9b3f('0x10d')]=ut[_0x9b3f('0x10e')](_0x55b3e5);}var _0x508bdb=ut[_0x9b3f('0x10f')](_0x16ecbf,_0x59e63b,_0x27b823,_0x55b3e5,_0x42c2a7,_0x425968);_[_0x9b3f('0x110')](_0x425968,ut[_0x9b3f('0x111')](_0x508bdb));_0x425968[_0x9b3f('0x7f')]=moment()[_0x9b3f('0x4d')](_0x9b3f('0x80'));ami[_0x9b3f('0x69')](ut[_0x9b3f('0x112')](_0x425968,_0x16ecbf,_0x508bdb,_0x425968[_0x9b3f('0xb8')],_0x27f5cf))['then'](function(_0x2ab345){_0x16ecbf[_0x9b3f('0x46')]+=0x1;logger['info']('[originated][increment]',_0x42c2a7,_0x9b3f('0x9d'),_0x16ecbf['name'],_0x9b3f('0x62'),_0x16ecbf[_0x9b3f('0x46')]);_0x2f0f05(_0x2ab345);})[_0x9b3f('0x6c')](function(_0x53b787){ut['logAgent'](_0x425968,0xe,_0x9b3f('0x113'));rpcDb[_0x9b3f('0xd5')](_0x425968,_0x9b3f('0x114'));_0x31443f(_0x53b787);});});};Preview['prototype'][_0x9b3f('0x115')]=function(_0x3221eb){if(this[_0x9b3f('0x10')][_0x3221eb[_0x9b3f('0x98')]]){this[_0x9b3f('0x10')][_0x3221eb[_0x9b3f('0x98')]]['channel']=_0x3221eb[_0x9b3f('0x6b')];}};Preview[_0x9b3f('0x5a')][_0x9b3f('0x14')]=function(_0x16a000){var _0x59ec1c=this;var _0x3fb18e=this[_0x9b3f('0x10')][_0x16a000[_0x9b3f('0x116')]];if(_0x3fb18e){if(_0x3fb18e[_0x9b3f('0xe1')]&&this[_0x9b3f('0x11')][_0x3fb18e[_0x9b3f('0xe1')]]){ut['logLookAgent'](_0x3fb18e,this[_0x9b3f('0x11')][_0x3fb18e[_0x9b3f('0xe1')]][_0x9b3f('0x24')],this[_0x9b3f('0x11')][_0x3fb18e[_0x9b3f('0xe1')]]['id']);}var _0x583e8d=_[_0x9b3f('0x117')](_0x3fb18e);_0x583e8d[_0x9b3f('0x9a')]=moment()['format'](_0x9b3f('0x80'));var _0x3e414e=_0x59ec1c[_0x9b3f('0xd')][_0x3fb18e[_0x9b3f('0x61')]];if(ut[_0x9b3f('0x118')](_0x16a000[_0x9b3f('0x119')])){if(_0x3fb18e['unlockAgent']){rpcDb['unlockContact'](_0x3fb18e[_0x9b3f('0xc7')]);}if(_0x3fb18e[_0x9b3f('0xb8')]){rpcDb[_0x9b3f('0xc8')](_0x3fb18e[_0x9b3f('0xc7')]);}ami[_0x9b3f('0x21')](_0x9b3f('0x11a'),ut['buildObj'](_0x3fb18e,'rejected'));this[_0x9b3f('0xd1')](_0x583e8d,_0x3e414e,_0x16a000);}else{_0x3fb18e[_0x9b3f('0x7f')]=moment()[_0x9b3f('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x583e8d,0x4,_0x9b3f('0xa7'));rpcDb[_0x9b3f('0xd5')](_0x583e8d,_0x9b3f('0x11b'));}}};Preview[_0x9b3f('0x5a')][_0x9b3f('0x11c')]=function(_0x51c72d){var _0x224012=this;var _0x4cb118=this['actions'][_0x51c72d['linkedid']];var _0x1c224a;if(_0x4cb118){_0x1c224a=this[_0x9b3f('0xd')][_0x4cb118[_0x9b3f('0x61')]];logger['info']('[syncHangup][talking]',_0x51c72d[_0x9b3f('0x98')],_0x9b3f('0x9d'),_0x1c224a[_0x9b3f('0x24')],_0x9b3f('0x63'),_0x1c224a[_0x9b3f('0x29')]);}if(this[_0x9b3f('0x10')][_0x51c72d[_0x9b3f('0x98')]]&&_0x51c72d[_0x9b3f('0x98')]!==_0x51c72d[_0x9b3f('0x9c')]){if(_0x51c72d[_0x9b3f('0x11d')]==='16'&&this['actions'][_0x51c72d[_0x9b3f('0x98')]]['dialAnswer']){this[_0x9b3f('0x11e')](_0x51c72d,_0x51c72d['linkedid'],_0x51c72d[_0x9b3f('0x11d')]);}else if(this[_0x9b3f('0x10')][_0x51c72d[_0x9b3f('0x98')]][_0x9b3f('0x64')]){logger[_0x9b3f('0x5f')](_0x9b3f('0x11f'),_0x51c72d[_0x9b3f('0x98')],_0x51c72d[_0x9b3f('0x11d')],_0x9b3f('0x9d'),_0x1c224a[_0x9b3f('0x24')],_0x9b3f('0x63'),_0x1c224a[_0x9b3f('0x29')]);this[_0x9b3f('0x11e')](_0x51c72d,_0x51c72d[_0x9b3f('0x98')],_0x51c72d[_0x9b3f('0x11d')]);}}else if(_0x4cb118&&_[_0x9b3f('0xe0')](_0x4cb118[_0x9b3f('0x120')])&&_0x1c224a[_0x9b3f('0x121')]&&_0x51c72d[_0x9b3f('0x98')]===_0x51c72d[_0x9b3f('0x9c')]&&_['isNil'](_0x51c72d[_0x9b3f('0xd4')])&&_0x51c72d[_0x9b3f('0x11d')]==='16'&&_0x51c72d[_0x9b3f('0x122')]==='6'&&_[_0x9b3f('0xd2')](_0x4cb118[_0x9b3f('0x123')])){if(_0x4cb118[_0x9b3f('0xb7')]){rpcDb[_0x9b3f('0xc6')](_0x4cb118[_0x9b3f('0xc7')]);}if(_0x4cb118[_0x9b3f('0xb8')]){rpcDb[_0x9b3f('0xc8')](_0x4cb118['idContact']);}_0x51c72d[_0x9b3f('0xd4')]='22';this['callProgressDetectingAgent'](_0x4cb118,_0x1c224a,_0x51c72d);}else if(_0x4cb118&&_0x4cb118[_0x9b3f('0x123')]){if(_0x51c72d[_0x9b3f('0x11d')]==='16'&&this[_0x9b3f('0x10')][_0x51c72d[_0x9b3f('0x98')]][_0x9b3f('0x64')]){logger[_0x9b3f('0x5f')](_0x9b3f('0x124'),_0x51c72d[_0x9b3f('0x98')],_0x51c72d['cause'],_0x9b3f('0x9d'),_0x1c224a[_0x9b3f('0x24')],_0x9b3f('0x63'),_0x1c224a[_0x9b3f('0x29')]);this[_0x9b3f('0x11e')](_0x51c72d,_0x51c72d[_0x9b3f('0x98')],_0x51c72d['cause']);}else if(this[_0x9b3f('0x10')][_0x51c72d[_0x9b3f('0x98')]]['dialAnswer']){logger[_0x9b3f('0x5f')](_0x9b3f('0x11f'),_0x51c72d[_0x9b3f('0x98')],_0x51c72d['cause'],_0x9b3f('0x9d'),_0x1c224a[_0x9b3f('0x24')],_0x9b3f('0x63'),_0x1c224a[_0x9b3f('0x29')]);this[_0x9b3f('0x11e')](_0x51c72d,_0x51c72d[_0x9b3f('0x98')],_0x51c72d[_0x9b3f('0x11d')]);}}};Preview[_0x9b3f('0x5a')][_0x9b3f('0x1a')]=function(_0x1b45fa){if(this['actions'][_0x1b45fa['destlinkedid']]&&_0x1b45fa[_0x9b3f('0xd0')]!==_0x1b45fa[_0x9b3f('0x125')]){this[_0x9b3f('0x11e')](_0x1b45fa,_0x1b45fa['destlinkedid'],_0x1b45fa[_0x9b3f('0xcb')]);}};Preview[_0x9b3f('0x5a')][_0x9b3f('0x18')]=function(_0x24c433){if(this['actions'][_0x24c433[_0x9b3f('0x98')]]&&_0x24c433[_0x9b3f('0x98')]!==_0x24c433[_0x9b3f('0x9c')]&&!this[_0x9b3f('0x10')][_0x24c433[_0x9b3f('0x98')]][_0x9b3f('0x64')]){if(_0x24c433['cause']==='1'){this[_0x9b3f('0x11e')](_0x24c433,_0x24c433['linkedid'],_0x24c433[_0x9b3f('0x11d')]);}}};Preview[_0x9b3f('0x5a')]['addVariable']=function(_0x91624e,_0x3123f5,_0x5dd30c){if(this[_0x9b3f('0x10')][_0x91624e]){if(_['isNil'](this[_0x9b3f('0x10')][_0x91624e][_0x9b3f('0x126')])){this[_0x9b3f('0x10')][_0x91624e][_0x9b3f('0x126')]={};}this[_0x9b3f('0x10')][_0x91624e][_0x9b3f('0x126')][_0x3123f5]=_0x5dd30c;}};Preview['prototype']['syncVarSet']=function(_0x31be96){try{if(!_[_0x9b3f('0xe0')](_0x31be96)){if(ut[_0x9b3f('0x127')](_[_0x9b3f('0x128')](_0x31be96[_0x9b3f('0x129')])[0x0])){this[_0x9b3f('0x12a')](_0x31be96[_0x9b3f('0x9c')],_[_0x9b3f('0x128')](_0x31be96[_0x9b3f('0x129')])[0x0],_0x31be96['value']);}}}catch(_0x20480c){logger['error'](_0x9b3f('0x12b'),util[_0x9b3f('0x12c')](_0x20480c,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x56ec83){if(_0x56ec83){if(this[_0x9b3f('0x10')][_0x56ec83[_0x9b3f('0x12d')]]){this['actions'][_0x56ec83[_0x9b3f('0x12d')]][_0x9b3f('0x123')]=!![];}}};Preview['prototype'][_0x9b3f('0x1f')]=function(_0x380f2c){if(_0x380f2c){if(this[_0x9b3f('0x10')][_0x380f2c[_0x9b3f('0x12e')]]){this[_0x9b3f('0x10')][_0x380f2c['transfererlinkedid']][_0x9b3f('0x123')]=!![];}}};module[_0x9b3f('0x12f')]=Preview; \ No newline at end of file +var _0x1c08=['trunks','agents','originateresponse','bind','hangup','syncHangup','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','pTalking','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','clockClearZombieChannels','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','enqueue','isNil','actions','[clearZombieChannels][talking]','originated:\x20','queue','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','getContactRecallMe','then','length','getDiff','scheduledat','dialRecallMeTimeout','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','callProgressDetectingCustomer','countglobal','NoSuchNumber','totalGlobal','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','buildObj','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','BUSY','countbusyretry','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','scheduledAt','dialNoAnswerRetryFrequency','activeContact','CONGESTION','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','AgentReject','unlockContact','disableContact','idContact','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','info','uniqueid','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','called','[Preview][execCall][failure]','logBlacklist','[Blacklist][error]','reachable','unmonitored','unlock','pick','execRun','getContactPreview','recallme','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','validateContact','Agent','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','ACTIVE','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','campaign\x20Name:\x20','Is\x20Valid','execCall','SIP/%s/%s%s','trim','dialCutDigit','phone','substring','getCallerId','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','originatecalleridnum','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','isFailure','response','custom:agentringnoanswer','rejected','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','destuniqueid','variables','filterKey','keys','addVariable','variable','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','lodash','uuid','moment','md5','../../../config/logger','preview','actionPreview','../ami','./action','./util/util','localhost','prototype','tail','finally','sequence','campaignsPreview'];(function(_0x9f07b9,_0x2b4856){var _0x54de5e=function(_0x5e7287){while(--_0x5e7287){_0x9f07b9['push'](_0x9f07b9['shift']());}};_0x54de5e(++_0x2b4856);}(_0x1c08,0x11c));var _0x81c0=function(_0x528342,_0x17a981){_0x528342=_0x528342-0x0;var _0x27dd91=_0x1c08[_0x528342];return _0x27dd91;};'use strict';var util=require('util');var _=require(_0x81c0('0x0'));var BPromise=require('bluebird');var uuid=require(_0x81c0('0x1'));var moment=require(_0x81c0('0x2'));var md5=require(_0x81c0('0x3'));var logger=require(_0x81c0('0x4'))(_0x81c0('0x5'));var loggerAction=require(_0x81c0('0x4'))(_0x81c0('0x6'));var ami=require(_0x81c0('0x7'));var rpcDb=require('./rpcDb');var Action=require(_0x81c0('0x8'));var ut=require(_0x81c0('0x9'));var io=require('socket.io-emitter')({'host':_0x81c0('0xa'),'port':0x18eb});var Sequence=function(){};Sequence[_0x81c0('0xb')]['enqueue']=function(_0x49a510){this[_0x81c0('0xc')]=this[_0x81c0('0xc')]?this['tail'][_0x81c0('0xd')](_0x49a510):_0x49a510();};function Preview(_0x47ed0d){this[_0x81c0('0xe')]=new Sequence();this[_0x81c0('0xf')]=_0x47ed0d['voiceQueues'];this[_0x81c0('0x10')]=_0x47ed0d[_0x81c0('0x10')];this['actions']={};this[_0x81c0('0x11')]=_0x47ed0d[_0x81c0('0x11')];this['clockClearZombieChannels']=0x0;ami['on'](_0x81c0('0x12'),this['syncOriginateResponse'][_0x81c0('0x13')](this));ami['on'](_0x81c0('0x14'),this[_0x81c0('0x15')][_0x81c0('0x13')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x81c0('0x13')](this));ami['on'](_0x81c0('0x16'),this[_0x81c0('0x17')][_0x81c0('0x13')](this));ami['on'](_0x81c0('0x18'),this[_0x81c0('0x19')][_0x81c0('0x13')](this));ami['on'](_0x81c0('0x1a'),this[_0x81c0('0x1b')][_0x81c0('0x13')](this));ami['on'](_0x81c0('0x1c'),this[_0x81c0('0x1d')][_0x81c0('0x13')](this));ami['on'](_0x81c0('0x1e'),this[_0x81c0('0x1f')][_0x81c0('0x13')](this));this[_0x81c0('0x20')](this['campaignsPreview']);}function emit(_0x388a0d,_0x51c17e,_0x54fe07){io['to'](_0x388a0d)[_0x81c0('0x21')](_0x51c17e,_0x54fe07);}function emitCampaignPreview(_0x5970f0){if(_0x5970f0[_0x81c0('0x22')]===_0x81c0('0x23')){var _0x41ea24={'id':_0x5970f0['id'],'name':_0x5970f0[_0x81c0('0x24')],'strategy':_0x5970f0[_0x81c0('0x25')],'answered':_0x5970f0[_0x81c0('0x26')],'available':_0x5970f0[_0x81c0('0x27')],'loggedIn':_0x5970f0['loggedIn'],'pTalking':_0x5970f0['pTalking'],'sumBillable':_0x5970f0[_0x81c0('0x28')],'sumDuration':_0x5970f0[_0x81c0('0x29')],'sumHoldTime':_0x5970f0[_0x81c0('0x2a')]||0x0,'talking':_0x5970f0[_0x81c0('0x2b')],'total':_0x5970f0[_0x81c0('0x2c')],'type':_0x5970f0['type'],'unmanaged':_0x5970f0[_0x81c0('0x2d')],'waiting':_0x5970f0[_0x81c0('0x2e')],'loggedInDb':_0x5970f0[_0x81c0('0x2f')],'dialActive':_0x5970f0[_0x81c0('0x30')],'dialMethod':_0x5970f0[_0x81c0('0x31')],'dialOriginateCallerIdName':_0x5970f0[_0x81c0('0x32')],'dialOriginateCallerIdNumber':_0x5970f0[_0x81c0('0x33')],'dialOriginateTimeout':_0x5970f0[_0x81c0('0x34')],'dialPrefix':_0x5970f0[_0x81c0('0x35')],'outboundAnswerAgiCallsDay':_0x5970f0['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x5970f0[_0x81c0('0x36')],'outboundBlacklistCallsDay':_0x5970f0[_0x81c0('0x37')],'outboundBusyCallsDay':_0x5970f0[_0x81c0('0x38')],'outboundCongestionCallsDay':_0x5970f0[_0x81c0('0x39')],'outboundDropCallsDayACS':_0x5970f0['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x5970f0['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x5970f0['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x5970f0[_0x81c0('0x3a')],'outboundNoSuchCallsDay':_0x5970f0[_0x81c0('0x3b')],'outboundOriginateFailureCallsDay':_0x5970f0['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x5970f0[_0x81c0('0x3c')],'outboundRejectCallsDay':_0x5970f0[_0x81c0('0x3d')],'outboundUnknownCallsDay':_0x5970f0[_0x81c0('0x3e')],'predictiveIntervalAnsweredCalls':_0x5970f0[_0x81c0('0x3f')],'predictiveIntervalAvgHoldtime':_0x5970f0['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x5970f0[_0x81c0('0x40')],'predictiveIntervalDroppedCallsCallersExit':_0x5970f0['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x5970f0[_0x81c0('0x41')],'predictiveIntervalErlangCalls':_0x5970f0[_0x81c0('0x42')],'predictiveIntervalErlangCallsDroppedCalls':_0x5970f0['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x5970f0[_0x81c0('0x43')],'predictiveIntervalLowerLimit':_0x5970f0[_0x81c0('0x44')],'predictiveIntervalMultiplicativeFactor':_0x5970f0['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x5970f0[_0x81c0('0x45')],'predictiveIntervalTotalCalls':_0x5970f0[_0x81c0('0x46')],'message':_0x5970f0[_0x81c0('0x47')],'originated':_0x5970f0[_0x81c0('0x48')]};if(_0x5970f0[_0x81c0('0x49')]){_0x41ea24[_0x81c0('0x49')]={'id':_0x5970f0[_0x81c0('0x49')]['id'],'name':_0x5970f0['Trunk'][_0x81c0('0x24')],'active':_0x5970f0['Trunk'][_0x81c0('0x4a')],'callerid':_0x5970f0['Trunk'][_0x81c0('0x4b')]};}if(_0x5970f0[_0x81c0('0x4c')]){_0x41ea24[_0x81c0('0x4c')]={'id':_0x5970f0[_0x81c0('0x4c')]['id'],'name':_0x5970f0[_0x81c0('0x4c')]['name']};}var _0x4722c2=md5(JSON[_0x81c0('0x4d')](_0x41ea24));if(_0x5970f0['md5']!==_0x4722c2){_0x5970f0[_0x81c0('0x3')]=_0x4722c2;emit(util[_0x81c0('0x4e')](_0x81c0('0x4f'),_0x41ea24['name']),'voice_queue:save',_0x41ea24);}}}function emitVoiceQueueChannelRemove(_0x48ae6a){emit(util[_0x81c0('0x4e')]('voice:queue:%s',_0x48ae6a['name']),_0x81c0('0x50'),_0x48ae6a);}function notSendMessagesQueue(_0x3fbcb4){if(_0x3fbcb4[_0x81c0('0x51')]){if(_0x3fbcb4[_0x81c0('0x48')]===0x0&&_0x3fbcb4[_0x81c0('0x52')]===0x0){_0x3fbcb4['sendMessageOneNotActive']=![];_0x3fbcb4['available']=0x0;_0x3fbcb4[_0x81c0('0x53')]=0x0;_0x3fbcb4['message']=_0x81c0('0x54');ut[_0x81c0('0x55')](_0x81c0('0x56'),_0x3fbcb4[_0x81c0('0x24')]+_0x81c0('0x57'));}else{_0x3fbcb4[_0x81c0('0x47')]=_0x81c0('0x58');ut[_0x81c0('0x55')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x3fbcb4[_0x81c0('0x24')]+_0x81c0('0x59'));}emitCampaignPreview(_0x3fbcb4);}}Preview[_0x81c0('0xb')][_0x81c0('0x20')]=function(){var _0x222209=this;setInterval(function(){_0x222209['syncCampaigns']();},0x7cf);};Preview[_0x81c0('0xb')][_0x81c0('0x5a')]=function(){var _0xedfdd=this[_0x81c0('0xf')];this[_0x81c0('0x5b')]+=0x1;for(var _0x31162a in _0xedfdd){if(_0xedfdd['hasOwnProperty'](_0x31162a)&&(_0xedfdd[_0x31162a]['dialMethod']===_0x81c0('0x5')||_0xedfdd[_0x31162a]['dialMethod']===_0x81c0('0x5c'))&&_0xedfdd[_0x31162a]['type']===_0x81c0('0x23')){if(this[_0x81c0('0x5b')]>0x7){this[_0x81c0('0x5b')]=0x0;this[_0x81c0('0x5d')]();}}if(_0xedfdd['hasOwnProperty'](_0x31162a)&&_0xedfdd[_0x31162a][_0x81c0('0x31')]===_0x81c0('0x5')&&_0xedfdd[_0x31162a][_0x81c0('0x22')]===_0x81c0('0x23')){if(_0xedfdd[_0x31162a][_0x81c0('0x30')]){this[_0x81c0('0x5e')](_0xedfdd[_0x31162a]);this[_0x81c0('0x5f')](_0xedfdd[_0x31162a]);}else{notSendMessagesQueue(_0xedfdd[_0x31162a]);}}}};Preview[_0x81c0('0xb')][_0x81c0('0x60')]=function(_0x39ad8d){var _0x384c2b=this;this[_0x81c0('0xe')][_0x81c0('0x61')](function(){if(!_[_0x81c0('0x62')](_0x384c2b[_0x81c0('0x63')][_0x39ad8d])){loggerAction['info'](_0x81c0('0x64'),_0x39ad8d,'Queue',_0x384c2b[_0x81c0('0x63')][_0x39ad8d]['queue'],_0x81c0('0x65'),JSON['stringify'](_0x384c2b[_0x81c0('0xf')][_0x384c2b[_0x81c0('0x63')][_0x39ad8d][_0x81c0('0x66')]][_0x81c0('0x48')]),_0x81c0('0x67'),JSON[_0x81c0('0x4d')](_0x384c2b[_0x81c0('0xf')][_0x384c2b[_0x81c0('0x63')][_0x39ad8d][_0x81c0('0x66')]][_0x81c0('0x52')]),JSON[_0x81c0('0x4d')](_0x384c2b['actions'][_0x39ad8d][_0x81c0('0x68')]),JSON[_0x81c0('0x4d')](_['pick'](_0x384c2b[_0x81c0('0x63')][_0x39ad8d],[_0x81c0('0x69'),_0x81c0('0x6a'),_0x81c0('0x6b'),'ListId'])));return ami[_0x81c0('0x6c')]({'action':_0x81c0('0x6d'),'channel':_0x384c2b[_0x81c0('0x63')][_0x39ad8d][_0x81c0('0x6e')]})[_0x81c0('0x6f')](function(_0xd417ee){if(_0xd417ee['message']===_0x81c0('0x70')){setTimeout(function(){if(_0x384c2b[_0x81c0('0x63')][_0x39ad8d]){ut[_0x81c0('0x71')](_0x384c2b[_0x81c0('0xf')][_0x384c2b['actions'][_0x39ad8d][_0x81c0('0x66')]],_0x81c0('0x72'));if(_0x384c2b[_0x81c0('0x63')][_0x39ad8d][_0x81c0('0x68')]===!![]){ut[_0x81c0('0x73')](_0x384c2b[_0x81c0('0xf')][_0x384c2b[_0x81c0('0x63')][_0x39ad8d]['queue']],_0x81c0('0x72'));ut[_0x81c0('0x74')](_0x81c0('0x75')+_0x39ad8d,_0x384c2b['actions'][_0x39ad8d][_0x81c0('0x66')]);}ut['loggerError'](_0x81c0('0x76')+_0x39ad8d,_0x384c2b[_0x81c0('0x63')][_0x39ad8d][_0x81c0('0x66')]);delete _0x384c2b[_0x81c0('0x63')][_0x39ad8d];}},0x2328);}});}});};Preview[_0x81c0('0xb')][_0x81c0('0x5d')]=function(){var _0x2f2ac8=this;loggerAction['info']('[action]',_[_0x81c0('0x77')](this[_0x81c0('0x63')]));for(var _0x5620e3 in this[_0x81c0('0x63')]){if(_0x2f2ac8[_0x81c0('0x63')]['hasOwnProperty'](_0x5620e3)){_0x2f2ac8['clearZombieChannel'](_0x5620e3);}}};Preview[_0x81c0('0xb')]['recallMe']=function(_0x291efb){var _0x5ca692=this;rpcDb[_0x81c0('0x78')](_0x291efb['id'],ut['agentReadyId'](this[_0x81c0('0x11')]))[_0x81c0('0x79')](function(_0x1ca46e){if(!_[_0x81c0('0x62')](_0x1ca46e)){for(var _0x50a6b8=0x0;_0x50a6b8<_0x1ca46e[_0x81c0('0x7a')];_0x50a6b8+=0x1){if(ut[_0x81c0('0x7b')](_0x1ca46e[_0x50a6b8][_0x81c0('0x7c')])<_0x291efb[_0x81c0('0x7d')]*0x3c){_0x5ca692[_0x81c0('0x7e')](_0x1ca46e[_0x50a6b8]['id'])[_0x81c0('0x79')](ut[_0x81c0('0x7f')](_0x81c0('0x80')))[_0x81c0('0x6f')](ut[_0x81c0('0x7f')](_0x81c0('0x80')));}else{var _0x34d913=new Action(_0x1ca46e[_0x50a6b8],_0x291efb);_0x34d913[_0x81c0('0x81')]=moment()[_0x81c0('0x4e')](_0x81c0('0x82'));_0x291efb[_0x81c0('0x3c')]+=0x1;ut[_0x81c0('0x83')](_0x34d913,0x17,'RecallInQueue');if(_0x291efb[_0x81c0('0x84')]){rpcDb[_0x81c0('0x85')](ut[_0x81c0('0x86')](_0x1ca46e[_0x50a6b8]));rpcDb[_0x81c0('0x87')](_0x34d913,_0x81c0('0x88'));}else{ut[_0x81c0('0x83')](_0x34d913,0x16,_0x81c0('0x89'));rpcDb[_0x81c0('0x87')](_0x34d913,_0x81c0('0x8a'));rpcDb[_0x81c0('0x8b')](_0x34d913,'[HistoryRecallClose]');}}}}})[_0x81c0('0x6f')](ut['logger2'](_0x81c0('0x8c')));};Preview[_0x81c0('0xb')][_0x81c0('0x5e')]=function(_0x1cb0b1){_0x1cb0b1[_0x81c0('0x51')]=!![];if(ut[_0x81c0('0x8d')](_0x1cb0b1[_0x81c0('0x8e')])){_0x1cb0b1['message']=_0x81c0('0x8f');}else if(!ut['isActive'](_0x1cb0b1[_0x81c0('0x30')])){_0x1cb0b1[_0x81c0('0x47')]='NOT_ACTIVE';}else if(!this[_0x81c0('0x90')](_0x1cb0b1[_0x81c0('0x49')])){if(!this[_0x81c0('0x90')](_0x1cb0b1[_0x81c0('0x91')])){_0x1cb0b1[_0x81c0('0x47')]=_0x81c0('0x92');}else{_0x1cb0b1[_0x81c0('0x47')]='ACTIVE';}}else{_0x1cb0b1[_0x81c0('0x47')]='ACTIVE';}emitCampaignPreview(_0x1cb0b1);};Preview[_0x81c0('0xb')][_0x81c0('0x93')]=function(_0x2b6950,_0x178b7b,_0x30a710){var _0x2d6db3=this;var _0x1b90a5=this[_0x81c0('0x63')][_0x178b7b];var _0x306ca5=this[_0x81c0('0xf')][_0x1b90a5[_0x81c0('0x66')]];var _0x1cd110;if(_0x306ca5){switch(_0x30a710){case'1':_0x306ca5['outboundNoSuchCallsDay']+=0x1;_0x1b90a5[_0x81c0('0x94')]=ut['totalGlobal'](_0x1b90a5);ut[_0x81c0('0x83')](_0x1b90a5,0x0,_0x81c0('0x95'));rpcDb[_0x81c0('0x87')](_0x1b90a5,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0x81c0('0x96')](_0x1b90a5)>=_0x306ca5[_0x81c0('0x97')]){_0x1cd110=ut['cloneAction'](_0x1b90a5,0xf,_0x81c0('0x98'));rpcDb['createCustomerFinal'](_0x1cd110,_0x81c0('0x99'));}else{rpcDb[_0x81c0('0x8b')](_0x1b90a5,_0x81c0('0x99'));}delete this['actions'][_0x2b6950[_0x81c0('0x9a')]];break;case _0x81c0('0x9b'):var _0x538087=moment()[_0x81c0('0x4e')](_0x81c0('0x82'));_0x1b90a5['responsetime']=_0x538087;_0x1b90a5[_0x81c0('0x9c')]=_0x538087;_0x1b90a5[_0x81c0('0x68')]=!![];_0x306ca5[_0x81c0('0x52')]+=0x1;logger['info'](_0x81c0('0x9d'),_0x1b90a5['uniqueid'],_0x81c0('0x9e'),_0x306ca5[_0x81c0('0x24')],_0x81c0('0x67'),_0x306ca5[_0x81c0('0x52')]);ami['emit'](_0x81c0('0x9f'),ut[_0x81c0('0xa0')](_0x1b90a5,'connect'));if(_0x306ca5['acw']){ami[_0x81c0('0x21')](_0x81c0('0xa1'),ut[_0x81c0('0xa2')](_0x1b90a5));}break;case'16':ami[_0x81c0('0x21')](_0x81c0('0xa3'),ut[_0x81c0('0xa0')](_0x1b90a5,_0x81c0('0xa4')));emitVoiceQueueChannelRemove(ut[_0x81c0('0xa0')](_0x1b90a5,_0x81c0('0xa4')));_0x306ca5[_0x81c0('0x36')]+=0x1;_0x306ca5['total']+=0x1;_0x306ca5[_0x81c0('0x26')]+=0x1;ut[_0x81c0('0x73')](_0x306ca5,'[16]');_0x1b90a5[_0x81c0('0x94')]=ut['totalGlobal'](_0x1b90a5);ut[_0x81c0('0x83')](_0x1b90a5,0x4,_0x81c0('0xa5'));rpcDb['createCustomerHistory'](_0x1b90a5,_0x81c0('0xa6'));rpcDb[_0x81c0('0x8b')](_0x1b90a5,_0x81c0('0xa7'));rpcDb['crateCustomerReportQueue'](_0x1b90a5);_0x306ca5[_0x81c0('0x29')]+=_0x1b90a5['talktime'];_0x306ca5[_0x81c0('0x28')]+=_0x1b90a5[_0x81c0('0xa8')];logger['info']('[syncHangup][talking][decrement]',_0x1b90a5['uniqueid'],_0x81c0('0x9e'),_0x306ca5[_0x81c0('0x24')],'pTalking:\x20',_0x306ca5[_0x81c0('0x52')]);delete this[_0x81c0('0x63')][_0x2b6950['linkedid']];break;case _0x81c0('0xa9'):_0x306ca5[_0x81c0('0x38')]+=0x1;_0x1b90a5[_0x81c0('0xaa')]+=0x1;_0x1b90a5[_0x81c0('0x94')]=ut[_0x81c0('0x96')](_0x1b90a5);ut[_0x81c0('0x83')](_0x1b90a5,0x5,'Busy');rpcDb[_0x81c0('0x87')](_0x1b90a5,_0x81c0('0xab'));if(ut['totalGlobal'](_0x1b90a5)>=_0x306ca5[_0x81c0('0x97')]){_0x1cd110=ut[_0x81c0('0xac')](_0x1b90a5,0xf,_0x81c0('0x98'));rpcDb[_0x81c0('0x8b')](_0x1cd110,_0x81c0('0xad'));}else{if(_0x1b90a5['countbusyretry']>=_0x306ca5[_0x81c0('0xae')]){rpcDb[_0x81c0('0x8b')](_0x1b90a5,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x81c0('0xaf')](ut['scheduledAt'](_0x1b90a5,_0x81c0('0xaa'),_0x306ca5[_0x81c0('0xb0')]),_0x1b90a5[_0x81c0('0xb1')],_0x1b90a5['activeContact']);}}break;case _0x81c0('0xb2'):_0x306ca5[_0x81c0('0x3a')]+=0x1;_0x1b90a5[_0x81c0('0xb3')]+=0x1;_0x1b90a5[_0x81c0('0x94')]=ut[_0x81c0('0x96')](_0x1b90a5);ut[_0x81c0('0x83')](_0x1b90a5,0x3,_0x81c0('0xb4'));rpcDb[_0x81c0('0x87')](_0x1b90a5,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x81c0('0x96')](_0x1b90a5)>=_0x306ca5[_0x81c0('0x97')]){_0x1cd110=ut[_0x81c0('0xac')](_0x1b90a5,0xf,_0x81c0('0x98'));rpcDb[_0x81c0('0x8b')](_0x1cd110,_0x81c0('0xb5'));}else{if(_0x1b90a5[_0x81c0('0xb3')]>=_0x306ca5[_0x81c0('0xb6')]){rpcDb[_0x81c0('0x8b')](_0x1b90a5,_0x81c0('0xb7'));}else{rpcDb[_0x81c0('0xaf')](ut[_0x81c0('0xb8')](_0x1b90a5,_0x81c0('0xb3'),_0x306ca5[_0x81c0('0xb9')]),_0x1b90a5[_0x81c0('0xb1')],_0x1b90a5[_0x81c0('0xba')]);}}break;case _0x81c0('0xbb'):_0x306ca5[_0x81c0('0x39')]+=0x1;_0x1b90a5[_0x81c0('0xbc')]+=0x1;_0x1b90a5[_0x81c0('0x94')]=ut[_0x81c0('0x96')](_0x1b90a5);ut[_0x81c0('0x83')](_0x1b90a5,0x8,_0x81c0('0xbd'));rpcDb[_0x81c0('0x87')](_0x1b90a5,_0x81c0('0xbe'));if(ut[_0x81c0('0x96')](_0x1b90a5)>=_0x306ca5[_0x81c0('0x97')]){_0x1cd110=ut['cloneAction'](_0x1b90a5,0xf,'Global');rpcDb[_0x81c0('0x8b')](_0x1cd110,_0x81c0('0xbf'));}else{if(_0x1b90a5[_0x81c0('0xbc')]>=_0x306ca5['dialCongestionMaxRetry']){rpcDb[_0x81c0('0x8b')](_0x1b90a5,_0x81c0('0xbe'));}else{rpcDb[_0x81c0('0xaf')](ut[_0x81c0('0xb8')](_0x1b90a5,_0x81c0('0xbc'),_0x306ca5['dialBusyRetryFrequency']),_0x1b90a5[_0x81c0('0xb1')],_0x1b90a5[_0x81c0('0xba')]);}}break;case _0x81c0('0xc0'):_0x306ca5[_0x81c0('0x3d')]+=0x1;_0x1b90a5[_0x81c0('0x94')]=ut[_0x81c0('0x96')](_0x1b90a5);ut[_0x81c0('0x83')](_0x1b90a5,0x14,_0x81c0('0xc1'));rpcDb[_0x81c0('0x87')](_0x1b90a5,'[syncHangupRequest][logAgentReject]');if(_0x1b90a5[_0x81c0('0xb1')]){rpcDb[_0x81c0('0xc2')](_0x1b90a5['idContact']);}if(_0x1b90a5[_0x81c0('0xba')]){rpcDb[_0x81c0('0xc3')](_0x1b90a5[_0x81c0('0xc4')]);}break;default:if(_0x1b90a5[_0x81c0('0x68')]){ut[_0x81c0('0x73')](_0x306ca5,_0x81c0('0xc5'));ut['loggerError'](_0x81c0('0xc6')+_0x306ca5[_0x81c0('0x24')],_0x2b6950);}_0x306ca5[_0x81c0('0x3e')]+=0x1;_0x1b90a5[_0x81c0('0x94')]=ut[_0x81c0('0x96')](_0x1b90a5);ut[_0x81c0('0x83')](_0x1b90a5,0xc,_0x2b6950[_0x81c0('0xc7')]||_0x2b6950[_0x81c0('0xc8')]);rpcDb[_0x81c0('0x87')](_0x1b90a5,_0x81c0('0xc9'));if(ut[_0x81c0('0x96')](_0x1b90a5)>=_0x306ca5['dialGlobalMaxRetry']){_0x1cd110=ut[_0x81c0('0xac')](_0x1b90a5,0xf,_0x81c0('0x98'));rpcDb['createCustomerFinal'](_0x1cd110,_0x81c0('0xca'));}else{rpcDb['createCustomerFinal'](_0x1b90a5,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x81c0('0x63')][_0x2b6950['linkedid']];}if(!(_0x1b90a5[_0x81c0('0x68')]&&_0x30a710==='16')){ut[_0x81c0('0x71')](_0x306ca5,_0x81c0('0xcb'));logger[_0x81c0('0xcc')]('[originated][decrement][callProgressDetectingCustomer]',_0x1b90a5[_0x81c0('0xcd')],_0x81c0('0x9e'),_0x306ca5[_0x81c0('0x24')],_0x81c0('0x65'),_0x306ca5[_0x81c0('0x48')]);}if(_0x30a710!==_0x81c0('0x9b')){delete this[_0x81c0('0x63')][_0x2b6950[_0x81c0('0x9a')]];delete this[_0x81c0('0x63')][_0x2b6950[_0x81c0('0xce')]];}}};Preview['prototype'][_0x81c0('0xcf')]=function(_0x5e1074,_0x2835c7,_0x567535){if(_[_0x81c0('0xd0')](_0x2835c7)&&_0x81c0('0xd1')!==typeof _0x2835c7){return;}if(_[_0x81c0('0xd0')](_0x567535)&&_0x81c0('0xd1')!==typeof _0x567535){return;}switch(_0x567535[_0x81c0('0xd2')]){case'0':ut[_0x81c0('0xd3')](_0x5e1074,0x0,'NoSuchNumber');rpcDb[_0x81c0('0xd4')](_0x5e1074,_0x81c0('0xd5'));break;case'3':ut[_0x81c0('0xd3')](_0x5e1074,0x3,_0x81c0('0xb4'));rpcDb['createAgentHistory'](_0x5e1074,_0x81c0('0xd6'));break;case'5':ut[_0x81c0('0xd3')](_0x5e1074,0x5,_0x81c0('0xd7'));rpcDb['createAgentHistory'](_0x5e1074,_0x81c0('0xd8'));break;case'8':ut['logAgent'](_0x5e1074,0x8,'Congestion');rpcDb[_0x81c0('0xd4')](_0x5e1074,_0x81c0('0xd9'));break;case'22':ut[_0x81c0('0xd3')](_0x5e1074,0x16,_0x81c0('0xda'));rpcDb['createAgentHistory'](_0x5e1074,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x81c0('0xd3')](_0x5e1074,0xc,_0x567535[_0x81c0('0xd2')]);rpcDb['createAgentHistory'](_0x5e1074,_0x81c0('0xd9'));}ut['updateOriginated'](_0x2835c7,_0x81c0('0xdb'));logger['info'](_0x81c0('0xdc'),_0x5e1074[_0x81c0('0xcd')],_0x81c0('0x9e'),_0x2835c7[_0x81c0('0x24')],_0x81c0('0x65'),_0x2835c7[_0x81c0('0x48')]);delete this[_0x81c0('0x63')][_0x5e1074['uniqueid']];};Preview[_0x81c0('0xb')][_0x81c0('0xdd')]=function(_0x1602e5,_0x38dd9a,_0x1a250f,_0x34da5c,_0x182955){var _0x5a0e67=this;return new BPromise(function(_0x4c6e02,_0x5649d6){if(_['isNil'](_0x38dd9a)||_[_0x81c0('0x62')](_0x38dd9a[_0x81c0('0xde')])||_[_0x81c0('0x62')](_0x38dd9a[_0x81c0('0xde')]['phone'])||_[_0x81c0('0x62')](_0x38dd9a[_0x81c0('0x6b')])){_0x5649d6(ut['message'](_0x81c0('0xdf'),_0x34da5c,_0x182955));return;}var _0x2816eb=uuid['v4']();var _0x2df472=_0x5a0e67[_0x81c0('0xf')][_0x38dd9a[_0x81c0('0xe0')][_0x81c0('0x24')]];var _0x63b98=_0x1a250f?_0x5a0e67['agents'][_0x1a250f]['id']:undefined;_0x5a0e67['actions'][_0x2816eb]=new Action(_0x38dd9a,_0x2df472,_0x2816eb,_0x1a250f,_0x63b98);var _0x89645e=_0x5a0e67[_0x81c0('0x63')][_0x2816eb];_0x89645e[_0x81c0('0xb1')]=_0x34da5c;_0x89645e[_0x81c0('0xba')]=_0x182955;_0x89645e[_0x81c0('0xe1')]=_0x1a250f;if(_[_0x81c0('0xe2')](_0x1602e5)){_0x5a0e67['execCall'](_0x89645e,_0x2df472,_0x38dd9a,_0x1a250f)[_0x81c0('0x79')](function(_0x182e1e){logger[_0x81c0('0xcc')](_0x81c0('0xe3'),_0x81c0('0xe4')+_0x89645e[_0x81c0('0x66')]+'\x20IdHopper:\x20'+_0x89645e[_0x81c0('0xc4')],JSON[_0x81c0('0x4d')](_0x182e1e));ami[_0x81c0('0x21')](_0x81c0('0xe5'),ut['buildObj'](_0x89645e,_0x81c0('0xe6')));_0x4c6e02(ut[_0x81c0('0x47')]('Calling'));})['catch'](function(_0x103635){ut[_0x81c0('0x55')](_0x81c0('0xe7'),_0x103635);_0x5649d6(ut[_0x81c0('0x47')]('Call\x20failed',_0x34da5c,_0x182955));});}else{_0x2df472['outboundBlacklistCallsDay']+=0x1;ut[_0x81c0('0xe8')](_0x89645e);rpcDb['createHistory'](_0x89645e,_0x81c0('0xe9'));delete _0x5a0e67[_0x81c0('0x63')][_0x2816eb];_0x5649d6(ut['message']('Contact\x20in\x20black\x20List',_0x34da5c,_0x182955));}});};Preview[_0x81c0('0xb')][_0x81c0('0x90')]=function(_0xdd7dc2){return!_[_0x81c0('0x62')](_0xdd7dc2)&&!_[_0x81c0('0x62')](_0xdd7dc2[_0x81c0('0x24')])&&!_[_0x81c0('0x62')](_0xdd7dc2['active'])&&_0xdd7dc2[_0x81c0('0x4a')]&&!_[_0x81c0('0x62')](this[_0x81c0('0x10')][util[_0x81c0('0x4e')]('SIP/%s',_0xdd7dc2[_0x81c0('0x24')])])&&!_[_0x81c0('0x62')](this[_0x81c0('0x10')][util[_0x81c0('0x4e')]('SIP/%s',_0xdd7dc2[_0x81c0('0x24')])][_0x81c0('0x6d')])&&(this[_0x81c0('0x10')][util[_0x81c0('0x4e')]('SIP/%s',_0xdd7dc2['name'])][_0x81c0('0x6d')]===_0x81c0('0xea')||this[_0x81c0('0x10')][util[_0x81c0('0x4e')]('SIP/%s',_0xdd7dc2[_0x81c0('0x24')])]['status']===_0x81c0('0xeb'));};Preview[_0x81c0('0xb')]['run']=function(_0x3df53c,_0xb5d333){var _0x264d5c=this;return new BPromise(function(_0x2b9f6d,_0x47e6fe){_0x264d5c['execRun'](_0x3df53c,_0xb5d333)[_0x81c0('0x79')](function(_0x21412e){_0x2b9f6d(_['pick'](_0x21412e,['message']));})[_0x81c0('0x6f')](function(_0x5e67c7){if(_0x5e67c7[_0x81c0('0xec')]){rpcDb[_0x81c0('0xc2')](_0x3df53c);}if(_0x5e67c7['active']){rpcDb['disableContact'](_0x3df53c);}_0x47e6fe(_[_0x81c0('0xed')](_0x5e67c7,[_0x81c0('0x47')]));});});};Preview['prototype'][_0x81c0('0xee')]=function(_0x43ad3b,_0x4388f7){var _0x5ecce2=this;return new BPromise(function(_0x3a4381,_0x2bada7){var _0x1cbce6,_0x37b561;rpcDb[_0x81c0('0xef')](_0x43ad3b)[_0x81c0('0x79')](function(_0x19b872){if(!_[_0x81c0('0x62')](_0x19b872[0x0])){_0x37b561=_0x19b872[0x0][_0x81c0('0xf0')]?![]:!![];_0x1cbce6=_0x19b872[0x0][_0x81c0('0xf0')]?!![]:![];_0x1cbce6=_0x4388f7?!![]:_0x1cbce6;}var _0x4b3411=_0x5ecce2['validateContact'](_0x19b872);if(_0x4b3411['isValid']){rpcDb[_0x81c0('0xf1')](_[_0x81c0('0xed')](_0x19b872[0x0],['VoiceQueueId',_0x81c0('0xf2')]))['then'](function(_0x17a982){_0x5ecce2[_0x81c0('0xdd')](_0x17a982,_0x19b872[0x0],_0x4388f7,_0x37b561,_0x1cbce6)[_0x81c0('0x79')](function(_0x34e897){_0x3a4381(_0x34e897);})[_0x81c0('0x6f')](function(_0x535a6c){_0x2bada7(_0x535a6c);});})['catch'](function(_0x32b2e4){ut[_0x81c0('0x55')](_0x81c0('0xf3'),_0x32b2e4);_0x2bada7(ut[_0x81c0('0x47')](_0x81c0('0xf4'),_0x37b561,_0x1cbce6));});}else{_0x2bada7(ut[_0x81c0('0x47')](_0x4b3411['message'],_0x37b561,_0x1cbce6));}})[_0x81c0('0x6f')](function(_0x11e3b1){ut[_0x81c0('0x55')]('[Preview][getContactPreview]',_0x11e3b1);_0x2bada7(ut[_0x81c0('0x47')](_0x81c0('0xf4'),![],!![]));});});};Preview[_0x81c0('0xb')][_0x81c0('0xf5')]=function(_0x245814){if(_[_0x81c0('0x62')](_0x245814)||_[_0x81c0('0xe2')](_0x245814)||!_['isNil'](_0x245814[0x0][_0x81c0('0xf6')])&&_[_0x81c0('0x62')](_0x245814[0x0][_0x81c0('0xf6')][_0x81c0('0x24')])){ut[_0x81c0('0x55')](_0x81c0('0xf7'),_0x245814);return{'isValid':![],'message':_0x81c0('0xf8')};}var _0x4b4756=this[_0x81c0('0xf')][_0x245814[0x0][_0x81c0('0xe0')]['name']];_0x4b4756[_0x81c0('0x47')]=_0x81c0('0xf9');if(_[_0x81c0('0x62')](_0x4b4756)){ut[_0x81c0('0x55')](_0x81c0('0xfa'),_0x4b4756);return{'isValid':![],'message':_0x81c0('0xfb')};}if(!this[_0x81c0('0x90')](_0x4b4756[_0x81c0('0x49')])){ut[_0x81c0('0x55')](_0x81c0('0xfc'),'campaign\x20Name:\x20'+_0x4b4756[_0x81c0('0x24')]+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0x4b4756[_0x81c0('0x91')])){ut[_0x81c0('0x55')](_0x81c0('0xfc'),_0x4b4756['name']+_0x81c0('0xfd'));return{'isValid':![],'message':_0x81c0('0xfe')};}}if(!ut[_0x81c0('0xff')](_0x4b4756['dialActive'])){ut[_0x81c0('0x55')](_0x81c0('0x100'),_0x4b4756['name']+'\x20Not\x20Active');return{'isValid':![],'message':_0x81c0('0x101')+_0x4b4756[_0x81c0('0x24')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x81c0('0x102')};};Preview[_0x81c0('0xb')][_0x81c0('0x103')]=function(_0x294931,_0x1e2222,_0x4b8e4c,_0x47a4d9){var _0x58fc48=this;return new BPromise(function(_0x517e57,_0x5bfda4){var _0x15124e=_0x294931[_0x81c0('0xcd')];var _0x51fb37=_0x58fc48[_0x81c0('0x90')](_0x1e2222[_0x81c0('0x49')])?util['format'](_0x81c0('0x104'),_0x1e2222['Trunk']['name'],_[_0x81c0('0x62')](_0x1e2222[_0x81c0('0x35')])?'':_0x1e2222[_0x81c0('0x35')][_0x81c0('0x105')]()||'',_0x1e2222[_0x81c0('0x106')]>0x0?_0x4b8e4c['Contact'][_0x81c0('0x107')]['substring'](_0x1e2222[_0x81c0('0x106')]):_0x4b8e4c[_0x81c0('0xde')][_0x81c0('0x107')]):util['format'](_0x81c0('0x104'),_[_0x81c0('0x62')](_0x1e2222[_0x81c0('0x91')])?_0x1e2222[_0x81c0('0x49')][_0x81c0('0x24')]:_0x1e2222[_0x81c0('0x91')]['name'],_[_0x81c0('0x62')](_0x1e2222[_0x81c0('0x35')])?'':_0x1e2222[_0x81c0('0x35')]['trim']()||'',_0x1e2222['dialCutDigit']>0x0?_0x4b8e4c[_0x81c0('0xde')][_0x81c0('0x107')][_0x81c0('0x108')](_0x1e2222[_0x81c0('0x106')]):_0x4b8e4c[_0x81c0('0xde')][_0x81c0('0x107')]);var _0x1aa24b=_0x58fc48[_0x81c0('0x90')](_0x1e2222[_0x81c0('0x49')])?ut[_0x81c0('0x109')](_0x1e2222[_0x81c0('0x49')][_0x81c0('0x4b')],_0x1e2222[_0x81c0('0x32')],_0x1e2222['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x81c0('0x10a')](_0x1e2222[_0x81c0('0x33')],_0x1e2222[_0x81c0('0x10b')]):_0x1e2222[_0x81c0('0x33')]):ut['getCallerId'](_[_0x81c0('0x62')](_0x1e2222[_0x81c0('0x91')])?_0x1e2222[_0x81c0('0x49')][_0x81c0('0x4b')]:_0x1e2222[_0x81c0('0x91')]['callerid'],_0x1e2222[_0x81c0('0x32')],_0x1e2222[_0x81c0('0x10b')]>0x0?ut[_0x81c0('0x10a')](_0x1e2222[_0x81c0('0x33')],_0x1e2222[_0x81c0('0x10b')]):_0x1e2222['dialOriginateCallerIdNumber']);if(_0x1aa24b){_0x294931['originatecalleridname']=ut['extractCalleridName'](_0x1aa24b);_0x294931[_0x81c0('0x10c')]=ut['extractCalleridNumber'](_0x1aa24b);}var _0x472abc=ut[_0x81c0('0x10d')](_0x1e2222,_0x4b8e4c,_0x51fb37,_0x1aa24b,_0x15124e,_0x294931);_[_0x81c0('0x10e')](_0x294931,ut[_0x81c0('0x10f')](_0x472abc));_0x294931[_0x81c0('0x81')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ami['Action'](ut[_0x81c0('0x110')](_0x294931,_0x1e2222,_0x472abc,_0x294931[_0x81c0('0xba')],_0x47a4d9))[_0x81c0('0x79')](function(_0x1a1207){_0x1e2222[_0x81c0('0x48')]+=0x1;logger[_0x81c0('0xcc')](_0x81c0('0x111'),_0x15124e,_0x81c0('0x9e'),_0x1e2222[_0x81c0('0x24')],_0x81c0('0x65'),_0x1e2222[_0x81c0('0x48')]);_0x517e57(_0x1a1207);})[_0x81c0('0x6f')](function(_0x3c22ba){ut['logAgent'](_0x294931,0xe,_0x81c0('0x112'));rpcDb[_0x81c0('0xd4')](_0x294931,_0x81c0('0x113'));_0x5bfda4(_0x3c22ba);});});};Preview[_0x81c0('0xb')]['syncNewExten']=function(_0xfa77be){if(this['actions'][_0xfa77be[_0x81c0('0x9a')]]){this['actions'][_0xfa77be[_0x81c0('0x9a')]]['channel']=_0xfa77be['channel'];}};Preview[_0x81c0('0xb')][_0x81c0('0x114')]=function(_0xaaae46){var _0x2a96bc=this;var _0x1f4693=this['actions'][_0xaaae46[_0x81c0('0x115')]];if(_0x1f4693){if(_0x1f4693[_0x81c0('0xe1')]&&this['agents'][_0x1f4693[_0x81c0('0xe1')]]){ut[_0x81c0('0x116')](_0x1f4693,this[_0x81c0('0x11')][_0x1f4693[_0x81c0('0xe1')]][_0x81c0('0x24')],this[_0x81c0('0x11')][_0x1f4693['lookAgent']]['id']);}var _0x1d6b16=_['clone'](_0x1f4693);_0x1d6b16['responsetime']=moment()[_0x81c0('0x4e')](_0x81c0('0x82'));var _0x5c3018=_0x2a96bc[_0x81c0('0xf')][_0x1f4693[_0x81c0('0x66')]];if(ut[_0x81c0('0x117')](_0xaaae46[_0x81c0('0x118')])){if(_0x1f4693['unlockAgent']){rpcDb[_0x81c0('0xc2')](_0x1f4693[_0x81c0('0xc4')]);}if(_0x1f4693[_0x81c0('0xba')]){rpcDb[_0x81c0('0xc3')](_0x1f4693[_0x81c0('0xc4')]);}ami[_0x81c0('0x21')](_0x81c0('0x119'),ut[_0x81c0('0xa0')](_0x1f4693,_0x81c0('0x11a')));this[_0x81c0('0xcf')](_0x1d6b16,_0x5c3018,_0xaaae46);}else{_0x1f4693[_0x81c0('0x81')]=moment()[_0x81c0('0x4e')](_0x81c0('0x82'));ut[_0x81c0('0xd3')](_0x1d6b16,0x4,'Answer');rpcDb['createAgentHistory'](_0x1d6b16,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x81c0('0xb')][_0x81c0('0x15')]=function(_0x1bf36c){var _0x121681=this;var _0x48f616=this[_0x81c0('0x63')][_0x1bf36c[_0x81c0('0x9a')]];var _0x460b7a;if(_0x48f616){_0x460b7a=this[_0x81c0('0xf')][_0x48f616[_0x81c0('0x66')]];logger[_0x81c0('0xcc')](_0x81c0('0x11b'),_0x1bf36c['linkedid'],'\x20Queue',_0x460b7a['name'],_0x81c0('0x67'),_0x460b7a[_0x81c0('0x52')]);}if(this[_0x81c0('0x63')][_0x1bf36c['linkedid']]&&_0x1bf36c[_0x81c0('0x9a')]!==_0x1bf36c[_0x81c0('0xcd')]){if(_0x1bf36c['cause']==='16'&&this[_0x81c0('0x63')][_0x1bf36c[_0x81c0('0x9a')]][_0x81c0('0x68')]){this['callProgressDetectingCustomer'](_0x1bf36c,_0x1bf36c[_0x81c0('0x9a')],_0x1bf36c[_0x81c0('0x11c')]);}else if(this[_0x81c0('0x63')][_0x1bf36c['linkedid']][_0x81c0('0x68')]){logger['info'](_0x81c0('0x11d'),_0x1bf36c[_0x81c0('0x9a')],_0x1bf36c[_0x81c0('0x11c')],_0x81c0('0x9e'),_0x460b7a['name'],'pTalking:\x20',_0x460b7a[_0x81c0('0x52')]);this['callProgressDetectingCustomer'](_0x1bf36c,_0x1bf36c[_0x81c0('0x9a')],_0x1bf36c[_0x81c0('0x11c')]);}}else if(_0x48f616&&_[_0x81c0('0x62')](_0x48f616[_0x81c0('0x11e')])&&_0x460b7a[_0x81c0('0x11f')]&&_0x1bf36c['linkedid']===_0x1bf36c[_0x81c0('0xcd')]&&_[_0x81c0('0x62')](_0x1bf36c['reason'])&&_0x1bf36c[_0x81c0('0x11c')]==='16'&&_0x1bf36c['channelstate']==='6'&&_[_0x81c0('0xd0')](_0x48f616[_0x81c0('0x120')])){if(_0x48f616[_0x81c0('0xb1')]){rpcDb[_0x81c0('0xc2')](_0x48f616[_0x81c0('0xc4')]);}if(_0x48f616[_0x81c0('0xba')]){rpcDb[_0x81c0('0xc3')](_0x48f616[_0x81c0('0xc4')]);}_0x1bf36c[_0x81c0('0xd2')]='22';this[_0x81c0('0xcf')](_0x48f616,_0x460b7a,_0x1bf36c);}else if(_0x48f616&&_0x48f616['transfer']){if(_0x1bf36c[_0x81c0('0x11c')]==='16'&&this[_0x81c0('0x63')][_0x1bf36c[_0x81c0('0x9a')]]['dialAnswer']){logger[_0x81c0('0xcc')]('[syncHangup][talking][transfer]',_0x1bf36c[_0x81c0('0x9a')],_0x1bf36c['cause'],_0x81c0('0x9e'),_0x460b7a[_0x81c0('0x24')],'pTalking:\x20',_0x460b7a[_0x81c0('0x52')]);this['callProgressDetectingCustomer'](_0x1bf36c,_0x1bf36c['linkedid'],_0x1bf36c[_0x81c0('0x11c')]);}else if(this[_0x81c0('0x63')][_0x1bf36c['linkedid']][_0x81c0('0x68')]){logger[_0x81c0('0xcc')](_0x81c0('0x11d'),_0x1bf36c[_0x81c0('0x9a')],_0x1bf36c['cause'],'\x20Queue',_0x460b7a[_0x81c0('0x24')],_0x81c0('0x67'),_0x460b7a[_0x81c0('0x52')]);this[_0x81c0('0x93')](_0x1bf36c,_0x1bf36c['linkedid'],_0x1bf36c['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x11955c){if(this[_0x81c0('0x63')][_0x11955c['destlinkedid']]&&_0x11955c['destlinkedid']!==_0x11955c[_0x81c0('0x121')]){this[_0x81c0('0x93')](_0x11955c,_0x11955c['destlinkedid'],_0x11955c[_0x81c0('0xc8')]);}};Preview[_0x81c0('0xb')]['syncHangupRequest']=function(_0x18826a){if(this['actions'][_0x18826a[_0x81c0('0x9a')]]&&_0x18826a[_0x81c0('0x9a')]!==_0x18826a[_0x81c0('0xcd')]&&!this[_0x81c0('0x63')][_0x18826a[_0x81c0('0x9a')]]['dialAnswer']){if(_0x18826a[_0x81c0('0x11c')]==='1'){this[_0x81c0('0x93')](_0x18826a,_0x18826a['linkedid'],_0x18826a[_0x81c0('0x11c')]);}}};Preview['prototype']['addVariable']=function(_0x5c9206,_0x4d22aa,_0x15d976){if(this[_0x81c0('0x63')][_0x5c9206]){if(_['isNil'](this[_0x81c0('0x63')][_0x5c9206][_0x81c0('0x122')])){this['actions'][_0x5c9206][_0x81c0('0x122')]={};}this[_0x81c0('0x63')][_0x5c9206][_0x81c0('0x122')][_0x4d22aa]=_0x15d976;}};Preview[_0x81c0('0xb')][_0x81c0('0x1b')]=function(_0x26d67e){try{if(!_[_0x81c0('0x62')](_0x26d67e)){if(ut[_0x81c0('0x123')](_[_0x81c0('0x124')](_0x26d67e['variable'])[0x0])){this[_0x81c0('0x125')](_0x26d67e[_0x81c0('0xcd')],_[_0x81c0('0x124')](_0x26d67e[_0x81c0('0x126')])[0x0],_0x26d67e['value']);}}}catch(_0x39e0f9){logger['error'](_0x81c0('0x127'),util[_0x81c0('0x128')](_0x39e0f9,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x81c0('0x1d')]=function(_0x6a0c13){if(_0x6a0c13){if(this[_0x81c0('0x63')][_0x6a0c13[_0x81c0('0x129')]]){this[_0x81c0('0x63')][_0x6a0c13[_0x81c0('0x129')]][_0x81c0('0x120')]=!![];}}};Preview['prototype'][_0x81c0('0x1f')]=function(_0x5cd6ce){if(_0x5cd6ce){if(this[_0x81c0('0x63')][_0x5cd6ce[_0x81c0('0x12a')]]){this['actions'][_0x5cd6ce[_0x81c0('0x12a')]][_0x81c0('0x120')]=!![];}}};module[_0x81c0('0x12b')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 91796bd..d9a94cb 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 _0xbcf1=['queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','exten','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','resolve','then','createHistory','catch','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queuecallerjoinAt','answertime'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xbcf1,0xe9));var _0x1bcf=function(_0x38c652,_0x1ea1b7){_0x38c652=_0x38c652-0x0;var _0x218a37=_0xbcf1[_0x38c652];return _0x218a37;};'use strict';var util=require(_0x1bcf('0x0'));var BPromise=require('bluebird');var logger=require(_0x1bcf('0x1'))(_0x1bcf('0x2'));var _=require(_0x1bcf('0x3'));var cmHopper=require(_0x1bcf('0x4'));var cmHopperFinal=require(_0x1bcf('0x5'));var cmHopperHistory=require(_0x1bcf('0x6'));var cmHopperBlack=require(_0x1bcf('0x7'));var voiceQueueRt=require(_0x1bcf('0x8'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x1bcf('0x9'));function loggerCatch(_0xe25da5){return function(_0x340779){logger[_0x1bcf('0xa')](_0xe25da5,util['inspect'](_0x340779,{'showHidden':![],'depth':null}));};}function create(_0x4e43bb){return BPromise[_0x1bcf('0xb')]()[_0x1bcf('0xc')](cmHopperHistory[_0x1bcf('0xd')](_0x4e43bb))[_0x1bcf('0xe')](loggerCatch(_0x1bcf('0xf')));}function createAgent(_0x16f75d){return BPromise[_0x1bcf('0xb')]()[_0x1bcf('0xc')](agentReportPreview['createHistory'](_0x16f75d))[_0x1bcf('0xe')](loggerCatch(_0x1bcf('0xf')));}function moveContact(_0x49ae10){return BPromise['resolve']()['then'](cmHopper['moveContactManagedDialer'](_0x49ae10,!![]))['catch'](loggerCatch(_0x1bcf('0x10')));}exports['checkIsBlackList']=function(_0x2813a4){return BPromise[_0x1bcf('0xb')]()[_0x1bcf('0xc')](cmHopperBlack[_0x1bcf('0x11')](_0x2813a4))['catch'](loggerCatch(_0x1bcf('0x12')));};exports[_0x1bcf('0x13')]=function(_0x5b65c8){return BPromise[_0x1bcf('0xb')]()[_0x1bcf('0xc')](cmHopper[_0x1bcf('0x13')](_0x5b65c8))['catch'](loggerCatch(_0x1bcf('0x14')));};exports['createHistory']=function(_0x69a8ad,_0x59e552){create(_0x69a8ad)[_0x1bcf('0xe')](loggerCatch(_0x59e552));moveContact(_0x69a8ad)['catch'](loggerCatch(_0x59e552));};exports[_0x1bcf('0x15')]=function(_0x22e9b6,_0x55d861){createAgent(_0x22e9b6)[_0x1bcf('0xe')](loggerCatch(_0x55d861));};exports['createCustomerHistory']=function(_0x1ed061,_0x2eb0c5){create(_0x1ed061)[_0x1bcf('0xe')](loggerCatch(_0x2eb0c5));};exports[_0x1bcf('0x16')]=function(_0x185528,_0x25c0d9){moveContact(_0x185528)['catch'](loggerCatch(_0x25c0d9));};exports[_0x1bcf('0x17')]=function(_0x9669f7,_0x1504a5,_0x46d0a0){if(_0x1504a5){_0x9669f7['UserId']=null;}if(_0x46d0a0){_0x9669f7[_0x1bcf('0x18')]=![];}return BPromise[_0x1bcf('0xb')]()[_0x1bcf('0xc')](cmHopper[_0x1bcf('0x17')](_0x9669f7))[_0x1bcf('0xe')](loggerCatch(_0x1bcf('0x19')));};exports['countReScheduled']=function(_0x408d5d){return BPromise[_0x1bcf('0xb')]()['then'](cmHopper['countReScheduled'](_0x408d5d))[_0x1bcf('0xe')](loggerCatch(_0x1bcf('0x1a')));};exports[_0x1bcf('0x1b')]=function(_0x18cdc9){return BPromise[_0x1bcf('0xb')]()[_0x1bcf('0xc')](cmHopper['unlockContact']({'UserId':null},_0x18cdc9,0x1))['catch'](loggerCatch(_0x1bcf('0x1c')));};exports['disableContact']=function(_0x202291){return BPromise[_0x1bcf('0xb')]()[_0x1bcf('0xc')](cmHopper['unlockContact']({'active':![]},_0x202291,0x1))[_0x1bcf('0xe')](loggerCatch(_0x1bcf('0x1d')));};exports[_0x1bcf('0x1e')]=function(_0x40d125){var _0xc48f18={};_0xc48f18[_0x1bcf('0x1f')]=_0x40d125[_0x1bcf('0x1f')];_0xc48f18[_0x1bcf('0x20')]=_0x40d125[_0x1bcf('0x20')];_0xc48f18[_0x1bcf('0x21')]=_0x40d125[_0x1bcf('0x21')];_0xc48f18[_0x1bcf('0x22')]=_0x40d125['calleridname'];_0xc48f18['queue']=_0x40d125['queue'];_0xc48f18[_0x1bcf('0x23')]=_0x40d125[_0x1bcf('0x24')];_0xc48f18[_0x1bcf('0x25')]=_0x40d125[_0x1bcf('0x24')];_0xc48f18['queuecallercomplete']=0x1;_0xc48f18[_0x1bcf('0x26')]=_0x40d125[_0x1bcf('0x27')];_0xc48f18[_0x1bcf('0x28')]=_0x40d125[_0x1bcf('0x29')];_0xc48f18['context']=_0x1bcf('0x2a');_0xc48f18[_0x1bcf('0x2b')]=_0x1bcf('0x2c');_0xc48f18['holdtime']=0x0;_0xc48f18[_0x1bcf('0x2d')]=0x1;_0xc48f18[_0x1bcf('0x2e')]=_0x40d125[_0x1bcf('0x29')];_0xc48f18[_0x1bcf('0x2f')]=_0x1bcf('0x30');return BPromise['resolve']()[_0x1bcf('0xc')](voiceQueueReport[_0x1bcf('0x31')](_0xc48f18))[_0x1bcf('0xe')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x1bcf('0x32')]=function(_0x547ad7,_0x5aadfe){return BPromise[_0x1bcf('0xb')]()[_0x1bcf('0xc')](cmHopper[_0x1bcf('0x32')](_0x547ad7,_0x5aadfe))[_0x1bcf('0xe')](loggerCatch(_0x1bcf('0x33')));};exports[_0x1bcf('0x34')]=function(_0x22419d){return BPromise['resolve']()['then'](cmHopper[_0x1bcf('0x17')](_0x22419d,!![],!![]))['catch'](loggerCatch(_0x1bcf('0x35')));}; \ No newline at end of file +var _0x9799=['unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','from-sip','xcally-motion-preview','assigned','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20'];(function(_0x3e6980,_0x190736){var _0x5697dc=function(_0xb86ad8){while(--_0xb86ad8){_0x3e6980['push'](_0x3e6980['shift']());}};_0x5697dc(++_0x190736);}(_0x9799,0x16b));var _0x9979=function(_0x17f2fb,_0x4befa8){_0x17f2fb=_0x17f2fb-0x0;var _0x413f91=_0x9799[_0x17f2fb];return _0x413f91;};'use strict';var util=require(_0x9979('0x0'));var BPromise=require(_0x9979('0x1'));var logger=require(_0x9979('0x2'))('preview');var _=require(_0x9979('0x3'));var cmHopper=require(_0x9979('0x4'));var cmHopperFinal=require(_0x9979('0x5'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x9979('0x6'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x9979('0x7'));var voiceQueueReport=require(_0x9979('0x8'));function loggerCatch(_0x361e43){return function(_0x106c42){logger[_0x9979('0x9')](_0x361e43,util[_0x9979('0xa')](_0x106c42,{'showHidden':![],'depth':null}));};}function create(_0x36ef8b){return BPromise[_0x9979('0xb')]()['then'](cmHopperHistory[_0x9979('0xc')](_0x36ef8b))[_0x9979('0xd')](loggerCatch(_0x9979('0xe')));}function createAgent(_0x3932e2){return BPromise[_0x9979('0xb')]()[_0x9979('0xf')](agentReportPreview[_0x9979('0xc')](_0x3932e2))[_0x9979('0xd')](loggerCatch(_0x9979('0xe')));}function moveContact(_0x2940e0){return BPromise[_0x9979('0xb')]()['then'](cmHopper[_0x9979('0x10')](_0x2940e0,!![]))[_0x9979('0xd')](loggerCatch(_0x9979('0x11')));}exports[_0x9979('0x12')]=function(_0x5bfd79){return BPromise[_0x9979('0xb')]()[_0x9979('0xf')](cmHopperBlack[_0x9979('0x12')](_0x5bfd79))[_0x9979('0xd')](loggerCatch(_0x9979('0x13')));};exports['getContactPreview']=function(_0x2e014b){return BPromise['resolve']()['then'](cmHopper[_0x9979('0x14')](_0x2e014b))[_0x9979('0xd')](loggerCatch(_0x9979('0x15')));};exports['createHistory']=function(_0x340876,_0x347516){create(_0x340876)[_0x9979('0xd')](loggerCatch(_0x347516));moveContact(_0x340876)[_0x9979('0xd')](loggerCatch(_0x347516));};exports[_0x9979('0x16')]=function(_0x11bac1,_0x51a7a4){createAgent(_0x11bac1)[_0x9979('0xd')](loggerCatch(_0x51a7a4));};exports['createCustomerHistory']=function(_0xe70037,_0x507a5d){create(_0xe70037)[_0x9979('0xd')](loggerCatch(_0x507a5d));};exports[_0x9979('0x17')]=function(_0x3185ff,_0x358986){moveContact(_0x3185ff)[_0x9979('0xd')](loggerCatch(_0x358986));};exports[_0x9979('0x18')]=function(_0x412bb2,_0x37bb8d,_0x2426df){if(_0x37bb8d){_0x412bb2['UserId']=null;}if(_0x2426df){_0x412bb2[_0x9979('0x19')]=![];}return BPromise['resolve']()[_0x9979('0xf')](cmHopper['rescheduleContact'](_0x412bb2))[_0x9979('0xd')](loggerCatch(_0x9979('0x1a')));};exports[_0x9979('0x1b')]=function(_0x110b5a){return BPromise[_0x9979('0xb')]()[_0x9979('0xf')](cmHopper[_0x9979('0x1b')](_0x110b5a))[_0x9979('0xd')](loggerCatch(_0x9979('0x1c')));};exports[_0x9979('0x1d')]=function(_0x5175bc){return BPromise[_0x9979('0xb')]()[_0x9979('0xf')](cmHopper[_0x9979('0x1d')]({'UserId':null},_0x5175bc,0x1))[_0x9979('0xd')](loggerCatch('[unlockContact]\x20'));};exports[_0x9979('0x1e')]=function(_0x51b941){return BPromise['resolve']()[_0x9979('0xf')](cmHopper[_0x9979('0x1d')]({'active':![]},_0x51b941,0x1))[_0x9979('0xd')](loggerCatch(_0x9979('0x1f')));};exports[_0x9979('0x20')]=function(_0x5d038b){var _0x279909={};_0x279909['type']=_0x5d038b[_0x9979('0x21')];_0x279909['uniqueid']=_0x5d038b['uniqueid'];_0x279909[_0x9979('0x22')]=_0x5d038b['calleridnum'];_0x279909[_0x9979('0x23')]=_0x5d038b[_0x9979('0x23')];_0x279909['queue']=_0x5d038b[_0x9979('0x24')];_0x279909[_0x9979('0x25')]=_0x5d038b[_0x9979('0x26')];_0x279909[_0x9979('0x27')]=_0x5d038b[_0x9979('0x26')];_0x279909[_0x9979('0x28')]=0x1;_0x279909[_0x9979('0x29')]=_0x5d038b[_0x9979('0x2a')];_0x279909[_0x9979('0x2b')]=_0x5d038b['membername'];_0x279909['context']=_0x9979('0x2c');_0x279909['exten']=_0x9979('0x2d');_0x279909['holdtime']=0x0;_0x279909[_0x9979('0x2e')]=0x1;_0x279909['lastAssignedTo']=_0x5d038b[_0x9979('0x2f')];_0x279909[_0x9979('0x30')]=_0x9979('0x31');return BPromise[_0x9979('0xb')]()['then'](voiceQueueReport[_0x9979('0x32')](_0x279909))['catch'](loggerCatch(_0x9979('0x33')));};exports[_0x9979('0x34')]=function(_0x27fbbe,_0x276913){return BPromise[_0x9979('0xb')]()[_0x9979('0xf')](cmHopper[_0x9979('0x34')](_0x27fbbe,_0x276913))[_0x9979('0xd')](loggerCatch(_0x9979('0x35')));};exports[_0x9979('0x36')]=function(_0xb45fb1){return BPromise[_0x9979('0xb')]()['then'](cmHopper[_0x9979('0x18')](_0xb45fb1,!![],!![]))['catch'](loggerCatch(_0x9979('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 35c9344..1479b19 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 _0xf474=['IsNotLoggedIn','lastevent','queue','interface','buildAcw','agentReadyId','not_inuse','status','getDiff','milliseconds','filterKey','type','campaigntype','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','moment','../../../../config/logger','preview','env','127.0.0.1','diff','seconds','loggerCatch','error','logger','info','inspect','loggerError','logger2','message','getCallerId','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','%s%s','toUpper','toLowerVariables','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','endtime','logAgent','logLookAgent','membername','logCustomer','ringtime','starttime','answertime','isFailure','Failure','variablesAction','calleridname','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf474,0x13e));var _0x4f47=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xf474[_0x4e676e];return _0x336a3c;};'use strict';var util=require(_0x4f47('0x0'));var _=require('lodash');var moment=require(_0x4f47('0x1'));var logger=require(_0x4f47('0x2'))(_0x4f47('0x3'));var ipAgi=process[_0x4f47('0x4')]['XCALLY_IP_AGI']||_0x4f47('0x5');function getSeconds(_0x3e557d,_0x394d6a){var _0x46d4b6=moment(_0x3e557d)['milliseconds'](0x0);var _0x1d2896=moment(_0x394d6a)['milliseconds'](0x0);return _0x46d4b6[_0x4f47('0x6')](_0x1d2896,_0x4f47('0x7'));}exports[_0x4f47('0x8')]=function(_0x194360){return function(_0x1a3810){logger[_0x4f47('0x9')](_0x194360,util['inspect'](_0x1a3810,{'showHidden':![],'depth':null}));};};exports[_0x4f47('0xa')]=function(_0x49de20,_0x445d82){logger[_0x4f47('0xb')](_0x49de20,util[_0x4f47('0xc')](_0x445d82,{'showHidden':![],'depth':null}));};exports[_0x4f47('0xd')]=function(_0x51bd6e,_0x3a812a){logger[_0x4f47('0x9')](_0x51bd6e,util[_0x4f47('0xc')](_0x3a812a,{'showHidden':![],'depth':null}));};exports[_0x4f47('0xe')]=function(_0x297f39){return function(_0xbee140){logger[_0x4f47('0xb')](_0x297f39,util[_0x4f47('0xc')](_0xbee140,{'showHidden':![],'depth':null}));};};exports[_0x4f47('0xf')]=function(_0x90e3f1,_0x1a185a,_0x4ac0e8){return{'message':_0x90e3f1,'unlock':_0x1a185a,'active':_0x4ac0e8};};exports[_0x4f47('0x10')]=function(_0x24c111,_0x1122e0,_0x38e94e){if(!_[_0x4f47('0x11')](_0x38e94e)&&'string'===typeof _0x38e94e&&!_[_0x4f47('0x12')](_0x38e94e)){if(!_[_0x4f47('0x11')](_0x1122e0)&&_0x4f47('0x13')===typeof _0x1122e0&&!_['isEmpty'](_0x1122e0)){return util[_0x4f47('0x14')](_0x4f47('0x15'),_0x1122e0,_0x38e94e);}return util[_0x4f47('0x14')](_0x4f47('0x15'),_0x38e94e,_0x38e94e);}if(!_[_0x4f47('0x11')](_0x24c111)&&_0x4f47('0x13')===typeof _0x24c111&&!_[_0x4f47('0x12')](_0x24c111)){return _0x24c111;}return _0x4f47('0x16');};exports['isActive']=function(_0x2f8621){if(_[_0x4f47('0x17')](_0x2f8621)){return![];}return _0x2f8621;};exports[_0x4f47('0x18')]=function(_0x338b94,_0x1e3e10,_0x536238,_0x2fdeea,_0x131d50,_0x397c2b){var _0x3de8d7={'XMD-QUEUE':_0x1e3e10[_0x4f47('0x19')]?_0x1e3e10[_0x4f47('0x19')][_0x4f47('0x1a')]:'','XMD-CALLERID':_0x2fdeea,'XMD-CALLERID-PREVIEW':_0x397c2b?util[_0x4f47('0x14')](_0x4f47('0x15'),_0x397c2b['calleridname'],_0x397c2b[_0x4f47('0x1b')]):_0x2fdeea,'XMD-DIALID':_0x131d50,'XMD-CONTACTID':_0x1e3e10[_0x4f47('0x1c')],'XMD-CDRTYPE':_0x4f47('0x1d'),'CALLERID(all)':_0x2fdeea,'XMD-VOICEQUEUEID':_0x1e3e10[_0x4f47('0x1e')],'XMD-DIALCHANNEL':_0x536238,'XMD-DIALTIMEOUT':_0x338b94[_0x4f47('0x1f')]||0x1e,'XMD-DIALOPTIONS':util[_0x4f47('0x14')](_0x4f47('0x20'),_0x338b94['dialQueueProject2']?'g':'',_[_0x4f47('0x12')](_0x338b94[_0x4f47('0x21')])?'':_0x4f47('0x22')),'XMD-DIALURL':_0x338b94['dialPreviewUrl']||'','XMD-AGI':_0x338b94[_0x4f47('0x23')]?util[_0x4f47('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x338b94['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x338b94['dialQueueProject2']?util[_0x4f47('0x14')](_0x4f47('0x24'),ipAgi,_0x338b94[_0x4f47('0x25')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x397c2b?_0x397c2b['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x397c2b?_0x397c2b[_0x4f47('0x26')]:'','XMD-DESTINATION':_0x4f47('0x27')};if(!_[_0x4f47('0x12')](_0x338b94[_0x4f47('0x21')])){_0x3de8d7[util[_0x4f47('0x14')]('%s',_0x4f47('0x28'))]=_0x338b94[_0x4f47('0x21')];_0x3de8d7[util[_0x4f47('0x14')]('%s',_0x4f47('0x29'))]=_0x131d50;}if(_0x1e3e10&&_0x1e3e10[_0x4f47('0x2a')]){for(var _0x249f58 in _0x1e3e10[_0x4f47('0x2a')]){if(_0x1e3e10[_0x4f47('0x2a')][_0x4f47('0x2b')](_0x249f58)){if(!_[_0x4f47('0x17')](_0x1e3e10[_0x4f47('0x2a')][_0x249f58])&&_0x249f58!=='id'&&_0x249f58!==_0x4f47('0x2c')&&_0x249f58!==_0x4f47('0x2d')&&_0x249f58!=='updatedAt'){_0x3de8d7[util[_0x4f47('0x14')](_0x4f47('0x2e'),'XMD-',_[_0x4f47('0x2f')](_0x249f58))]=_0x1e3e10['Contact'][_0x249f58];}}}}return _0x3de8d7;};exports[_0x4f47('0x30')]=function(_0x26d32e){var _0x579fea={};for(var _0x50cdb8 in _0x26d32e){if(_0x26d32e[_0x4f47('0x2b')](_0x50cdb8)){_0x579fea[util[_0x4f47('0x14')]('%s',_['toLower'](_0x50cdb8))]=_0x26d32e[_0x50cdb8];}}return{'variables':_0x579fea};};exports['updateOriginated']=function(_0x2fc1e1,_0x3ea109){if(!_['isNil'](_0x2fc1e1)){if(_0x2fc1e1[_0x4f47('0x2b')](_0x4f47('0x31'))){if(_0x2fc1e1['originated']>0x0){_0x2fc1e1[_0x4f47('0x31')]-=0x1;}else{logger[_0x4f47('0x9')](_0x4f47('0x32'),_0x3ea109);}}}else{logger[_0x4f47('0x9')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x3ea109);}};exports[_0x4f47('0x33')]=function(_0x147d94){var _0x2f398b=moment()[_0x4f47('0x14')](_0x4f47('0x34'));_0x147d94[_0x4f47('0x35')]=0xd;_0x147d94[_0x4f47('0x36')]=_0x4f47('0x37');_0x147d94['starttime']=_0x2f398b;_0x147d94[_0x4f47('0x38')]=_0x2f398b;_0x147d94[_0x4f47('0x39')]=_0x2f398b;};exports[_0x4f47('0x3a')]=function(_0x35f001,_0x5b76fa,_0x5dedd7){var _0x2fc6cd=moment()[_0x4f47('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x35f001[_0x4f47('0x35')]=_0x5b76fa;_0x35f001[_0x4f47('0x36')]=_0x5dedd7;_0x35f001[_0x4f47('0x38')]=_0x2fc6cd;_0x35f001['ringtime']=getSeconds(_0x35f001[_0x4f47('0x38')],_0x35f001['starttime']);};exports[_0x4f47('0x3b')]=function(_0x33b955,_0x30fc90,_0x29c2f0){_0x33b955[_0x4f47('0x3c')]=_0x30fc90;_0x33b955['UserId']=_0x29c2f0;};exports[_0x4f47('0x3d')]=function(_0x532be4,_0x19f781,_0x55eca0){var _0x381372=moment()['format'](_0x4f47('0x34'));_0x532be4[_0x4f47('0x35')]=_0x19f781;_0x532be4[_0x4f47('0x36')]=_0x55eca0;_0x532be4[_0x4f47('0x38')]=_0x532be4[_0x4f47('0x38')]?_0x532be4[_0x4f47('0x38')]:_0x381372;_0x532be4[_0x4f47('0x39')]=_0x532be4[_0x4f47('0x39')]?_0x532be4[_0x4f47('0x39')]:_0x381372;_0x532be4[_0x4f47('0x3e')]=getSeconds(_0x532be4[_0x4f47('0x38')]||0x0,_0x532be4[_0x4f47('0x3f')]||0x0);_0x532be4['talktime']=_0x532be4[_0x4f47('0x40')]?getSeconds(_0x532be4['endtime'],_0x532be4[_0x4f47('0x40')]):0x0;};exports[_0x4f47('0x41')]=function(_0x202da5){return _0x202da5===_0x4f47('0x42');};exports[_0x4f47('0x43')]=function(_0x43ebc0,_0x22c75f,_0x2c6709,_0x3c986c,_0x4d4e6a){var _0x4745cd=_0x3c986c?'RECALL':_0x43ebc0[_0x4f47('0x44')];_0x4745cd=_0x4d4e6a?_0x4f47('0x45'):_0x4745cd;return{'actionid':_0x43ebc0[_0x4f47('0x46')],'action':_0x4f47('0x47'),'channel':_0x43ebc0[_0x4f47('0x48')],'callerid':util[_0x4f47('0x14')](_0x4f47('0x15'),_0x4745cd,_0x43ebc0['calleridnum']),'Exten':'xcally-motion-preview','Context':_0x4f47('0x49'),'Priority':'1','variable':_0x2c6709,'timeout':(_0x22c75f[_0x4f47('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x43ebc0[_0x4f47('0x46')]};};exports[_0x4f47('0x4b')]=function(_0x405b5e){return _0x405b5e[_0x4f47('0x4c')]+_0x405b5e[_0x4f47('0x4d')]+_0x405b5e[_0x4f47('0x4e')];};exports[_0x4f47('0x4f')]=function(_0x297f5a){var _0x4ba461=_[_0x4f47('0x50')](_0x297f5a);_0x4ba461[_0x4f47('0x35')]=0xf;_0x4ba461[_0x4f47('0x36')]=_0x4f47('0x51');return _0x4ba461;};exports[_0x4f47('0x52')]=function(_0x3fb520,_0x334b72,_0x5270a0){var _0x5b3bb9={};_0x5b3bb9[_0x334b72]=_0x3fb520[_0x334b72];_0x5b3bb9[_0x4f47('0x53')]=![];_0x5b3bb9[_0x4f47('0x54')]=moment()[_0x4f47('0x55')](_0x5270a0,_0x4f47('0x56'))[_0x4f47('0x14')](_0x4f47('0x34'));_0x5b3bb9[_0x4f47('0x1c')]=_0x3fb520[_0x4f47('0x1c')];_0x5b3bb9[_0x4f47('0x57')]=_0x3fb520[_0x4f47('0x57')];_0x5b3bb9[_0x4f47('0x1e')]=_0x3fb520[_0x4f47('0x1e')]||undefined;return _0x5b3bb9;};exports['decrementTalkink']=function(_0x19ca3f,_0x1eed6d){if(!_[_0x4f47('0x17')](_0x19ca3f)){if(_0x19ca3f[_0x4f47('0x58')]>0x0){_0x19ca3f[_0x4f47('0x58')]-=0x1;}else{logger[_0x4f47('0x9')](_0x1eed6d,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x1eed6d,_0x4f47('0x59'));}};exports[_0x4f47('0x5a')]=function(_0x2d2b18){if(_0x2d2b18<=0x0){return!![];}return![];};exports['buildObj']=function(_0x544026,_0x1f3909){_0x544026[_0x4f47('0x5b')]=_0x1f3909;_0x544026['name']=_0x544026[_0x4f47('0x5c')];_0x544026[_0x4f47('0x5d')]=_0x544026[_0x4f47('0x48')];return _0x544026;};exports[_0x4f47('0x5e')]=function(_0x29ccf8){var _0x595467={};_0x595467[_0x4f47('0x5c')]=_0x29ccf8['queue'];_0x595467[_0x4f47('0x5d')]=_0x29ccf8['channelAgent'];_0x595467['uniqueid']=_0x29ccf8[_0x4f47('0x46')];return _0x595467;};exports[_0x4f47('0x5f')]=function(_0x44eb13){var _0x1b0246=[];for(var _0x1438b8 in _0x44eb13){if(_0x44eb13[_0x4f47('0x2b')](_0x1438b8)){if(!_['isNil'](_0x44eb13[_0x1438b8])&&_0x44eb13[_0x1438b8][_0x4f47('0x35')]===_0x4f47('0x60')&&_0x44eb13[_0x1438b8][_0x4f47('0x61')]==='reachable'){_0x1b0246['push'](_0x44eb13[_0x1438b8]['id']);}}}return _0x1b0246;};exports[_0x4f47('0x62')]=function(_0x20cbdc){var _0x473b1d=moment()[_0x4f47('0x63')](0x0);var _0x3dadcb=moment(_0x20cbdc)[_0x4f47('0x63')](0x0);return _0x473b1d[_0x4f47('0x6')](_0x3dadcb,_0x4f47('0x7'));};exports['createBody']=function(_0x4c257a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4c257a['ContactId'],'ListId':_0x4c257a['ListId'],'VoiceQueueId':_0x4c257a['VoiceQueueId']||undefined,'CampaignId':_0x4c257a['CampaignId']||undefined};};exports[_0x4f47('0x64')]=function(_0x164a92){if(_0x164a92===_0x4f47('0x46')||_0x164a92==='idContact'||_0x164a92===_0x4f47('0x5c')||_0x164a92===_0x4f47('0x65')||_0x164a92===_0x4f47('0x66')||_0x164a92==='dialAnswer'||_0x164a92===_0x4f47('0x3c')||_0x164a92===_0x4f47('0x48')||_0x164a92===_0x4f47('0x44')||_0x164a92===_0x4f47('0x53')||_0x164a92===_0x4f47('0x1b')||_0x164a92===_0x4f47('0x54')||_0x164a92==='countbusyretry'||_0x164a92===_0x4f47('0x4d')||_0x164a92==='countnoanswerretry'||_0x164a92===_0x4f47('0x67')||_0x164a92===_0x4f47('0x68')||_0x164a92===_0x4f47('0x69')||_0x164a92===_0x4f47('0x6a')||_0x164a92===_0x4f47('0x6b')||_0x164a92===_0x4f47('0x1c')||_0x164a92===_0x4f47('0x57')||_0x164a92===_0x4f47('0x6c')||_0x164a92===_0x4f47('0x1e')||_0x164a92===_0x4f47('0x6d')||_0x164a92==='xmd-voicequeueid'||_0x164a92===_0x4f47('0x6e')||_0x164a92==='xmd-phone'||_0x164a92===_0x4f47('0x6f')||_0x164a92===_0x4f47('0x70')||_0x164a92==='xmd-dialtimeout'||_0x164a92===_0x4f47('0x71')||_0x164a92===_0x4f47('0x72')||_0x164a92===_0x4f47('0x73')||_0x164a92===_0x4f47('0x74')||_0x164a92===_0x4f47('0x75')||_0x164a92===_0x4f47('0x76')||_0x164a92===_0x4f47('0x77')||_0x164a92===_0x4f47('0x78')||_0x164a92===_0x4f47('0x79')||_0x164a92===_0x4f47('0x7a')||_0x164a92==='rtpaudioqosjitter'||_0x164a92===_0x4f47('0x7b')||_0x164a92===_0x4f47('0x7c')||_0x164a92===_0x4f47('0x7d')||_0x164a92===_0x4f47('0x7e')||_0x164a92===_0x4f47('0x7f')||_0x164a92===_0x4f47('0x79')||_0x164a92===_0x4f47('0x7a')||_0x164a92===_0x4f47('0x80')||_0x164a92===_0x4f47('0x7b')||_0x164a92===_0x4f47('0x7c')||_0x164a92==='rtpaudioqoslossbridged'||_0x164a92===_0x4f47('0x7e')||_0x164a92===_0x4f47('0x7f')||_0x164a92==='bridgepeer'||_0x164a92==='bridgepvtcallid'||_0x164a92===_0x4f47('0x35')||_0x164a92==='statedesc'){return![];}return!![];};exports[_0x4f47('0x81')]=function(_0x5ddef6,_0x5d0f2e){var _0x2351a5,_0x1058b6,_0x49c1d6;if(_0x5d0f2e<=0x0){_0x5d0f2e=0x1;}_0x2351a5=new RegExp('\x5cw{0,'+_0x5d0f2e+'}$');_0x1058b6=Math['pow'](0xa,_0x5d0f2e-0x1);_0x49c1d6=Math[_0x4f47('0x82')](0xa,_0x5d0f2e)-0x1;return util[_0x4f47('0x14')]('%s',_[_0x4f47('0x83')](_0x5ddef6,_0x2351a5,_[_0x4f47('0x84')](_0x1058b6,_0x49c1d6)));};exports[_0x4f47('0x85')]=function(_0x4b6839){var _0x1c94f1=_0x4b6839[_0x4f47('0x86')](/"(.*?)"/);return _0x1c94f1?_0x1c94f1[0x1]:_0x4b6839;};exports[_0x4f47('0x87')]=function(_0x4fe78c){var _0x2c64a8=_0x4fe78c['match'](/<(.*?)>/);return _0x2c64a8?_0x2c64a8[0x1]:_0x4fe78c;}; \ No newline at end of file +var _0xc459=['format','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridname','ContactId','VoiceQueueId','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','createdAt','updatedAt','XMD-','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','error','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','ringtime','responsetime','logLookAgent','membername','logCustomer','endtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','originate','channelAgent','calleridnum','totalGlobal','countnoanswerretry','cloneAction','clone','Global','active','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','status','push','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','scheduledat','countbusyretry','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-queue','xmd-listid','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agi','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosjitter','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','127.0.0.1','milliseconds','diff','seconds','loggerCatch','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0xc459,0xfc));var _0x9c45=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc459[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x9c45('0x0'));var _=require(_0x9c45('0x1'));var moment=require(_0x9c45('0x2'));var logger=require(_0x9c45('0x3'))(_0x9c45('0x4'));var ipAgi=process[_0x9c45('0x5')]['XCALLY_IP_AGI']||_0x9c45('0x6');function getSeconds(_0x451498,_0x9161e5){var _0x19ded4=moment(_0x451498)[_0x9c45('0x7')](0x0);var _0x506cb4=moment(_0x9161e5)['milliseconds'](0x0);return _0x19ded4[_0x9c45('0x8')](_0x506cb4,_0x9c45('0x9'));}exports[_0x9c45('0xa')]=function(_0xe1c1b0){return function(_0x40f5c5){logger['error'](_0xe1c1b0,util[_0x9c45('0xb')](_0x40f5c5,{'showHidden':![],'depth':null}));};};exports[_0x9c45('0xc')]=function(_0x356357,_0x517710){logger[_0x9c45('0xd')](_0x356357,util[_0x9c45('0xb')](_0x517710,{'showHidden':![],'depth':null}));};exports[_0x9c45('0xe')]=function(_0x34cfd9,_0x3f14ed){logger['error'](_0x34cfd9,util['inspect'](_0x3f14ed,{'showHidden':![],'depth':null}));};exports[_0x9c45('0xf')]=function(_0x47c122){return function(_0x424147){logger[_0x9c45('0xd')](_0x47c122,util[_0x9c45('0xb')](_0x424147,{'showHidden':![],'depth':null}));};};exports[_0x9c45('0x10')]=function(_0x1eb2fd,_0x5456e0,_0x41ca29){return{'message':_0x1eb2fd,'unlock':_0x5456e0,'active':_0x41ca29};};exports[_0x9c45('0x11')]=function(_0xdad7e1,_0x4aa4a8,_0x15d9e5){if(!_[_0x9c45('0x12')](_0x15d9e5)&&_0x9c45('0x13')===typeof _0x15d9e5&&!_[_0x9c45('0x14')](_0x15d9e5)){if(!_['isUndefined'](_0x4aa4a8)&&_0x9c45('0x13')===typeof _0x4aa4a8&&!_[_0x9c45('0x14')](_0x4aa4a8)){return util['format'](_0x9c45('0x15'),_0x4aa4a8,_0x15d9e5);}return util[_0x9c45('0x16')](_0x9c45('0x15'),_0x15d9e5,_0x15d9e5);}if(!_[_0x9c45('0x12')](_0xdad7e1)&&_0x9c45('0x13')===typeof _0xdad7e1&&!_[_0x9c45('0x14')](_0xdad7e1)){return _0xdad7e1;}return _0x9c45('0x17');};exports['isActive']=function(_0x258f76){if(_[_0x9c45('0x18')](_0x258f76)){return![];}return _0x258f76;};exports[_0x9c45('0x19')]=function(_0x5e4516,_0x4e6961,_0x31c9aa,_0x3ca1e4,_0x5b3ab9,_0x312fac){var _0x24cbdd={'XMD-QUEUE':_0x4e6961[_0x9c45('0x1a')]?_0x4e6961[_0x9c45('0x1a')][_0x9c45('0x1b')]:'','XMD-CALLERID':_0x3ca1e4,'XMD-CALLERID-PREVIEW':_0x312fac?util[_0x9c45('0x16')]('\x22%s\x22\x20<%s>',_0x312fac[_0x9c45('0x1c')],_0x312fac['calleridnum']):_0x3ca1e4,'XMD-DIALID':_0x5b3ab9,'XMD-CONTACTID':_0x4e6961[_0x9c45('0x1d')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x3ca1e4,'XMD-VOICEQUEUEID':_0x4e6961[_0x9c45('0x1e')],'XMD-DIALCHANNEL':_0x31c9aa,'XMD-DIALTIMEOUT':_0x5e4516['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x9c45('0x16')](_0x9c45('0x1f'),_0x5e4516['dialQueueProject2']?'g':'',_[_0x9c45('0x14')](_0x5e4516[_0x9c45('0x20')])?'':_0x9c45('0x21')),'XMD-DIALURL':_0x5e4516[_0x9c45('0x22')]||'','XMD-AGI':_0x5e4516[_0x9c45('0x23')]?util[_0x9c45('0x16')](_0x9c45('0x24'),ipAgi,_0x5e4516[_0x9c45('0x23')]):_0x9c45('0x25'),'XMD-AGIAFTER':_0x5e4516[_0x9c45('0x26')]?util[_0x9c45('0x16')](_0x9c45('0x24'),ipAgi,_0x5e4516[_0x9c45('0x26')]):_0x9c45('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x312fac?_0x312fac[_0x9c45('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x312fac?_0x312fac[_0x9c45('0x28')]:'','XMD-DESTINATION':_0x9c45('0x29')};if(!_[_0x9c45('0x14')](_0x5e4516[_0x9c45('0x20')])){_0x24cbdd[util[_0x9c45('0x16')]('%s',_0x9c45('0x2a'))]=_0x5e4516['monitor_format'];_0x24cbdd[util[_0x9c45('0x16')]('%s',_0x9c45('0x2b'))]=_0x5b3ab9;}if(_0x4e6961&&_0x4e6961['Contact']){for(var _0x123e5d in _0x4e6961['Contact']){if(_0x4e6961[_0x9c45('0x2c')]['hasOwnProperty'](_0x123e5d)){if(!_['isNil'](_0x4e6961[_0x9c45('0x2c')][_0x123e5d])&&_0x123e5d!=='id'&&_0x123e5d!=='tags'&&_0x123e5d!==_0x9c45('0x2d')&&_0x123e5d!==_0x9c45('0x2e')){_0x24cbdd[util['format']('%s%s',_0x9c45('0x2f'),_['toUpper'](_0x123e5d))]=_0x4e6961['Contact'][_0x123e5d];}}}}return _0x24cbdd;};exports[_0x9c45('0x30')]=function(_0x1c3511){var _0x1af9f1={};for(var _0x409426 in _0x1c3511){if(_0x1c3511[_0x9c45('0x31')](_0x409426)){_0x1af9f1[util[_0x9c45('0x16')]('%s',_[_0x9c45('0x32')](_0x409426))]=_0x1c3511[_0x409426];}}return{'variables':_0x1af9f1};};exports[_0x9c45('0x33')]=function(_0x22c2d7,_0x350605){if(!_['isNil'](_0x22c2d7)){if(_0x22c2d7[_0x9c45('0x31')](_0x9c45('0x34'))){if(_0x22c2d7['originated']>0x0){_0x22c2d7[_0x9c45('0x34')]-=0x1;}else{logger[_0x9c45('0x35')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x350605);}}}else{logger[_0x9c45('0x35')](_0x9c45('0x36'),_0x350605);}};exports[_0x9c45('0x37')]=function(_0x516798){var _0x5789fe=moment()['format'](_0x9c45('0x38'));_0x516798[_0x9c45('0x39')]=0xd;_0x516798[_0x9c45('0x3a')]=_0x9c45('0x3b');_0x516798[_0x9c45('0x3c')]=_0x5789fe;_0x516798['responsetime']=_0x5789fe;_0x516798['endtime']=_0x5789fe;};exports['logAgent']=function(_0x1de50d,_0xa15533,_0x1bfaa1){var _0xe90e14=moment()[_0x9c45('0x16')](_0x9c45('0x38'));_0x1de50d[_0x9c45('0x39')]=_0xa15533;_0x1de50d[_0x9c45('0x3a')]=_0x1bfaa1;_0x1de50d['responsetime']=_0xe90e14;_0x1de50d[_0x9c45('0x3d')]=getSeconds(_0x1de50d[_0x9c45('0x3e')],_0x1de50d[_0x9c45('0x3c')]);};exports[_0x9c45('0x3f')]=function(_0x2cef4f,_0x15bcd8,_0x1507c9){_0x2cef4f[_0x9c45('0x40')]=_0x15bcd8;_0x2cef4f['UserId']=_0x1507c9;};exports[_0x9c45('0x41')]=function(_0x1982c4,_0x58a4f0,_0x5850e8){var _0x22176c=moment()[_0x9c45('0x16')](_0x9c45('0x38'));_0x1982c4[_0x9c45('0x39')]=_0x58a4f0;_0x1982c4[_0x9c45('0x3a')]=_0x5850e8;_0x1982c4[_0x9c45('0x3e')]=_0x1982c4[_0x9c45('0x3e')]?_0x1982c4[_0x9c45('0x3e')]:_0x22176c;_0x1982c4[_0x9c45('0x42')]=_0x1982c4['endtime']?_0x1982c4[_0x9c45('0x42')]:_0x22176c;_0x1982c4[_0x9c45('0x3d')]=getSeconds(_0x1982c4[_0x9c45('0x3e')]||0x0,_0x1982c4[_0x9c45('0x3c')]||0x0);_0x1982c4[_0x9c45('0x43')]=_0x1982c4[_0x9c45('0x44')]?getSeconds(_0x1982c4[_0x9c45('0x42')],_0x1982c4[_0x9c45('0x44')]):0x0;};exports[_0x9c45('0x45')]=function(_0x1b69d2){return _0x1b69d2===_0x9c45('0x46');};exports[_0x9c45('0x47')]=function(_0x113eb3,_0x18011b,_0x2e2b1d,_0x46bd4d,_0x15e4a2){var _0x5d1b41=_0x46bd4d?_0x9c45('0x48'):_0x113eb3[_0x9c45('0x1c')];_0x5d1b41=_0x15e4a2?'BOOKED':_0x5d1b41;return{'actionid':_0x113eb3[_0x9c45('0x49')],'action':_0x9c45('0x4a'),'channel':_0x113eb3[_0x9c45('0x4b')],'callerid':util[_0x9c45('0x16')](_0x9c45('0x15'),_0x5d1b41,_0x113eb3[_0x9c45('0x4c')]),'Exten':_0x9c45('0x29'),'Context':'from-sip','Priority':'1','variable':_0x2e2b1d,'timeout':(_0x18011b['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x113eb3[_0x9c45('0x49')]};};exports[_0x9c45('0x4d')]=function(_0x5df66e){return _0x5df66e['countbusyretry']+_0x5df66e['countcongestionretry']+_0x5df66e[_0x9c45('0x4e')];};exports[_0x9c45('0x4f')]=function(_0x14d6dc){var _0x1af0f8=_[_0x9c45('0x50')](_0x14d6dc);_0x1af0f8[_0x9c45('0x39')]=0xf;_0x1af0f8[_0x9c45('0x3a')]=_0x9c45('0x51');return _0x1af0f8;};exports['scheduledAt']=function(_0x243b7c,_0x1df4f3,_0x273a39){var _0x6f7263={};_0x6f7263[_0x1df4f3]=_0x243b7c[_0x1df4f3];_0x6f7263[_0x9c45('0x52')]=![];_0x6f7263['scheduledat']=moment()[_0x9c45('0x53')](_0x273a39,_0x9c45('0x54'))[_0x9c45('0x16')](_0x9c45('0x38'));_0x6f7263[_0x9c45('0x1d')]=_0x243b7c[_0x9c45('0x1d')];_0x6f7263[_0x9c45('0x55')]=_0x243b7c[_0x9c45('0x55')];_0x6f7263[_0x9c45('0x1e')]=_0x243b7c[_0x9c45('0x1e')]||undefined;return _0x6f7263;};exports[_0x9c45('0x56')]=function(_0x47ee2c,_0x3ee572){if(!_['isNil'](_0x47ee2c)){if(_0x47ee2c['pTalking']>0x0){_0x47ee2c[_0x9c45('0x57')]-=0x1;}else{logger[_0x9c45('0x35')](_0x3ee572,_0x9c45('0x58'));}}else{logger[_0x9c45('0x35')](_0x3ee572,_0x9c45('0x59'));}};exports[_0x9c45('0x5a')]=function(_0x3b47e4){if(_0x3b47e4<=0x0){return!![];}return![];};exports['buildObj']=function(_0x22813b,_0x4cf95e){_0x22813b[_0x9c45('0x5b')]=_0x4cf95e;_0x22813b['name']=_0x22813b[_0x9c45('0x5c')];_0x22813b[_0x9c45('0x5d')]=_0x22813b[_0x9c45('0x4b')];return _0x22813b;};exports['buildAcw']=function(_0x536d47){var _0x2aeca0={};_0x2aeca0[_0x9c45('0x5c')]=_0x536d47[_0x9c45('0x5c')];_0x2aeca0[_0x9c45('0x5d')]=_0x536d47[_0x9c45('0x4b')];_0x2aeca0['uniqueid']=_0x536d47['uniqueid'];return _0x2aeca0;};exports['agentReadyId']=function(_0x1b4d0b){var _0x28ed9b=[];for(var _0x58b69d in _0x1b4d0b){if(_0x1b4d0b[_0x9c45('0x31')](_0x58b69d)){if(!_[_0x9c45('0x18')](_0x1b4d0b[_0x58b69d])&&_0x1b4d0b[_0x58b69d][_0x9c45('0x39')]==='not_inuse'&&_0x1b4d0b[_0x58b69d][_0x9c45('0x5e')]==='reachable'){_0x28ed9b[_0x9c45('0x5f')](_0x1b4d0b[_0x58b69d]['id']);}}}return _0x28ed9b;};exports[_0x9c45('0x60')]=function(_0x944944){var _0x5af6b5=moment()[_0x9c45('0x7')](0x0);var _0x2f1a4a=moment(_0x944944)[_0x9c45('0x7')](0x0);return _0x5af6b5[_0x9c45('0x8')](_0x2f1a4a,_0x9c45('0x9'));};exports[_0x9c45('0x61')]=function(_0x173d70){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x173d70['ContactId'],'ListId':_0x173d70[_0x9c45('0x55')],'VoiceQueueId':_0x173d70[_0x9c45('0x1e')]||undefined,'CampaignId':_0x173d70[_0x9c45('0x62')]||undefined};};exports[_0x9c45('0x63')]=function(_0x274fa9){if(_0x274fa9==='uniqueid'||_0x274fa9===_0x9c45('0x64')||_0x274fa9==='queue'||_0x274fa9===_0x9c45('0x65')||_0x274fa9===_0x9c45('0x66')||_0x274fa9===_0x9c45('0x67')||_0x274fa9==='membername'||_0x274fa9===_0x9c45('0x4b')||_0x274fa9===_0x9c45('0x1c')||_0x274fa9===_0x9c45('0x52')||_0x274fa9==='calleridnum'||_0x274fa9===_0x9c45('0x68')||_0x274fa9===_0x9c45('0x69')||_0x274fa9===_0x9c45('0x6a')||_0x274fa9===_0x9c45('0x4e')||_0x274fa9===_0x9c45('0x6b')||_0x274fa9===_0x9c45('0x6c')||_0x274fa9===_0x9c45('0x6d')||_0x274fa9===_0x9c45('0x6e')||_0x274fa9===_0x9c45('0x6f')||_0x274fa9==='ContactId'||_0x274fa9===_0x9c45('0x55')||_0x274fa9==='UserId'||_0x274fa9==='VoiceQueueId'||_0x274fa9===_0x9c45('0x70')||_0x274fa9==='xmd-voicequeueid'||_0x274fa9===_0x9c45('0x71')||_0x274fa9==='xmd-phone'||_0x274fa9===_0x9c45('0x72')||_0x274fa9==='xmd-dialurl'||_0x274fa9===_0x9c45('0x73')||_0x274fa9==='xmd-dialoptions'||_0x274fa9===_0x9c45('0x74')||_0x274fa9===_0x9c45('0x75')||_0x274fa9===_0x9c45('0x76')||_0x274fa9==='xmd-cdrtype'||_0x274fa9===_0x9c45('0x77')||_0x274fa9==='xmd-agiafter'||_0x274fa9===_0x9c45('0x78')||_0x274fa9==='rtpaudioqos'||_0x274fa9===_0x9c45('0x79')||_0x274fa9==='rtpaudioqosjitter'||_0x274fa9==='rtpaudioqosjitterbridged'||_0x274fa9===_0x9c45('0x7a')||_0x274fa9===_0x9c45('0x7b')||_0x274fa9===_0x9c45('0x7c')||_0x274fa9===_0x9c45('0x7d')||_0x274fa9===_0x9c45('0x7e')||_0x274fa9===_0x9c45('0x79')||_0x274fa9===_0x9c45('0x7f')||_0x274fa9==='rtpaudioqosjitterbridged'||_0x274fa9===_0x9c45('0x7a')||_0x274fa9==='rtpaudioqoslossbridged'||_0x274fa9===_0x9c45('0x7c')||_0x274fa9==='rtpaudioqosrttbridged'||_0x274fa9===_0x9c45('0x80')||_0x274fa9===_0x9c45('0x81')||_0x274fa9==='state'||_0x274fa9===_0x9c45('0x3a')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x5cf258,_0x111c86){var _0x311db3,_0x436583,_0x58e69b;if(_0x111c86<=0x0){_0x111c86=0x1;}_0x311db3=new RegExp(_0x9c45('0x82')+_0x111c86+'}$');_0x436583=Math[_0x9c45('0x83')](0xa,_0x111c86-0x1);_0x58e69b=Math[_0x9c45('0x83')](0xa,_0x111c86)-0x1;return util[_0x9c45('0x16')]('%s',_[_0x9c45('0x84')](_0x5cf258,_0x311db3,_[_0x9c45('0x85')](_0x436583,_0x58e69b)));};exports[_0x9c45('0x86')]=function(_0x5a233e){var _0x381419=_0x5a233e[_0x9c45('0x87')](/"(.*?)"/);return _0x381419?_0x381419[0x1]:_0x5a233e;};exports[_0x9c45('0x88')]=function(_0x32cafd){var _0xce94a0=_0x32cafd[_0x9c45('0x87')](/<(.*?)>/);return _0xce94a0?_0xce94a0[0x1]:_0x32cafd;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index e4847d9..15aed01 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 _0x9879=['string','number','queueremove','queuepause','boolean','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x9879,0x98));var _0x9987=function(_0x2c49c0,_0x56cdca){_0x2c49c0=_0x2c49c0-0x0;var _0x135b31=_0x9879[_0x2c49c0];return _0x135b31;};'use strict';exports[_0x9987('0x0')]={'queue':{'type':_0x9987('0x1'),'required':!![]},'interface':{'type':_0x9987('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x9987('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x9987('0x3')]={'queue':{'type':_0x9987('0x1'),'required':!![]},'interface':{'type':_0x9987('0x1'),'required':!![]}};exports[_0x9987('0x4')]={'interface':{'type':_0x9987('0x1'),'required':!![]},'paused':{'type':_0x9987('0x5')},'reason':{'type':_0x9987('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x9987('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x9987('0x1'),'required':!![]}};exports[_0x9987('0x6')]={'uniqueid':{'type':_0x9987('0x1'),'required':!![]},'filename':{'type':_0x9987('0x1')},'format':{'type':_0x9987('0x1')},'mixmonitorid':{'type':_0x9987('0x1')}};exports[_0x9987('0x7')]={'uniqueid':{'type':_0x9987('0x1'),'required':!![]}};exports[_0x9987('0x8')]={'uniqueid':{'type':_0x9987('0x1'),'required':!![]},'exten':{'type':_0x9987('0x1'),'required':!![]},'context':{'type':_0x9987('0x1')}}; \ No newline at end of file +var _0xac95=['queueadd','string','queueremove','queuepause','reload','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect'];(function(_0x5c879e,_0x40708d){var _0x5e1025=function(_0x14f273){while(--_0x14f273){_0x5c879e['push'](_0x5c879e['shift']());}};_0x5e1025(++_0x40708d);}(_0xac95,0xa8));var _0x5ac9=function(_0x15afbb,_0x5e384f){_0x15afbb=_0x15afbb-0x0;var _0x4d84f5=_0xac95[_0x15afbb];return _0x4d84f5;};'use strict';exports[_0x5ac9('0x0')]={'queue':{'type':_0x5ac9('0x1'),'required':!![]},'interface':{'type':_0x5ac9('0x1'),'required':!![]},'membername':{'type':_0x5ac9('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x5ac9('0x2')]={'queue':{'type':_0x5ac9('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x5ac9('0x3')]={'interface':{'type':_0x5ac9('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x5ac9('0x1'),'required':![]}};exports[_0x5ac9('0x4')]={'module':{'type':_0x5ac9('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':'string','required':!![]}};exports[_0x5ac9('0x5')]={'uniqueid':{'type':_0x5ac9('0x1'),'required':!![]},'filename':{'type':_0x5ac9('0x1')},'format':{'type':_0x5ac9('0x1')},'mixmonitorid':{'type':_0x5ac9('0x1')}};exports[_0x5ac9('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x5ac9('0x7')]={'uniqueid':{'type':_0x5ac9('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x5ac9('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index fde9f28..460aded 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 _0x2f55=['queue','queuecallerexit','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerleaveAt','outbound','disposition','billableseconds','initCampaigns','initVoiceExtensions','initCampaignHopperHistory','merge','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','faxAccounts','hasOwnProperty','format','SIP/%s','name','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','outboundAnswerAgiCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks','initTriggers','initTemplates','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid'];(function(_0x1735da,_0x3996eb){var _0x185fb0=function(_0x2fd537){while(--_0x2fd537){_0x1735da['push'](_0x1735da['shift']());}};_0x185fb0(++_0x3996eb);}(_0x2f55,0x181));var _0x52f5=function(_0x56bd25,_0x438b58){_0x56bd25=_0x56bd25-0x0;var _0x53ccb9=_0x2f55[_0x56bd25];return _0x53ccb9;};'use strict';var BPromise=require(_0x52f5('0x0'));var util=require(_0x52f5('0x1'));var _=require(_0x52f5('0x2'));var moment=require(_0x52f5('0x3'));var Agent=require(_0x52f5('0x4'));var Telephone=require(_0x52f5('0x5'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x52f5('0x6'));var Trigger=require(_0x52f5('0x7'));var Template=require(_0x52f5('0x8'));var Campaign=require(_0x52f5('0x9'));var VoiceExtension=require(_0x52f5('0xa'));var ZendeskAccount=require(_0x52f5('0xb'));var SalesforceAccount=require(_0x52f5('0xc'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x52f5('0xd'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x52f5('0xe'));var VtigerAccount=require(_0x52f5('0xf'));var FaxAccount=require(_0x52f5('0x10'));var Realtime=function(){this[_0x52f5('0x11')]={};this[_0x52f5('0x12')]={};this[_0x52f5('0x13')]={};this[_0x52f5('0x14')]={};this[_0x52f5('0x15')]={};this[_0x52f5('0x16')]={};this[_0x52f5('0x17')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x52f5('0x18')]={};this[_0x52f5('0x19')]={};this[_0x52f5('0x1a')]={};this[_0x52f5('0x1b')]={};this[_0x52f5('0x1c')]={};this['zendeskAccounts']={};this[_0x52f5('0x1d')]={};this[_0x52f5('0x1e')]={};this[_0x52f5('0x1f')]={};this[_0x52f5('0x20')]={};this[_0x52f5('0x21')]={};this[_0x52f5('0x22')]={};this[_0x52f5('0x23')]={};};function freeIsNotKey(_0x32c761,_0x2268fe,_0x2ee68b){var _0x60036c=_['mapKeys'](_0x32c761,function(_0x5c83e1,_0x4ad676){return _0x5c83e1[_0x2ee68b];});for(var _0x4ead99 in _0x2268fe){if(_0x2268fe[_0x52f5('0x24')](_0x4ead99)){if(!_0x60036c[_0x4ead99]){delete _0x2268fe[_0x4ead99];}}}}function freeIsNotKeySip(_0x3614de,_0x120067){var _0x4347b5=_['mapKeys'](_0x3614de,function(_0x1a3e9c,_0x5de99d){return util[_0x52f5('0x25')](_0x52f5('0x26'),_0x1a3e9c[_0x52f5('0x27')]);});for(var _0x16a0ab in _0x120067){if(_0x120067[_0x52f5('0x24')](_0x16a0ab)){if(!_0x4347b5[_0x16a0ab]){delete _0x120067[_0x16a0ab];}}}}function clearVoiceCallReports(_0x294ec3){_0x294ec3[_0x52f5('0x28')]=0x0;_0x294ec3[_0x52f5('0x29')]=0x0;_0x294ec3[_0x52f5('0x2a')]=0x0;_0x294ec3[_0x52f5('0x2b')]=0x0;_0x294ec3[_0x52f5('0x2c')]=0x0;}function clearCampaigns(_0x1d94f8){if(!_[_0x52f5('0x2d')](_0x1d94f8)){for(var _0x49bca2 in _0x1d94f8){if(_0x1d94f8[_0x52f5('0x24')](_0x49bca2)){_0x1d94f8[_0x49bca2]['ivrTotalCallsDays']=0x0;_0x1d94f8[_0x49bca2][_0x52f5('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x217c44){if(!_[_0x52f5('0x2d')](_0x217c44)){for(var _0x1aced7 in _0x217c44){if(_0x217c44['hasOwnProperty'](_0x1aced7)){_0x217c44[_0x1aced7]['total']=0x0;_0x217c44[_0x1aced7][_0x52f5('0x29')]=0x0;_0x217c44[_0x1aced7][_0x52f5('0x2f')]=0x0;_0x217c44[_0x1aced7][_0x52f5('0x2a')]=0x0;_0x217c44[_0x1aced7]['sumDuration']=0x0;_0x217c44[_0x1aced7][_0x52f5('0x2c')]=0x0;_0x217c44[_0x1aced7][_0x52f5('0x30')]=0x0;_0x217c44[_0x1aced7]['outboundNoAnswerCallsDay']=0x0;_0x217c44[_0x1aced7]['outboundBusyCallsDay']=0x0;_0x217c44[_0x1aced7]['outboundCongestionCallsDay']=0x0;_0x217c44[_0x1aced7][_0x52f5('0x31')]=0x0;_0x217c44[_0x1aced7][_0x52f5('0x32')]=0x0;_0x217c44[_0x1aced7][_0x52f5('0x33')]=0x0;_0x217c44[_0x1aced7][_0x52f5('0x34')]=0x0;_0x217c44[_0x1aced7][_0x52f5('0x35')]=0x0;_0x217c44[_0x1aced7]['outboundOriginateFailureCallsDay']=0x0;_0x217c44[_0x1aced7]['outboundRejectCallsDay']=0x0;_0x217c44[_0x1aced7][_0x52f5('0x36')]=0x0;_0x217c44[_0x1aced7][_0x52f5('0x30')]=0x0;_0x217c44[_0x1aced7][_0x52f5('0x37')]=0x0;_0x217c44[_0x1aced7][_0x52f5('0x38')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x18fe55,_0x470794){for(var _0x1d3baf in _0x470794){if(_0x18fe55[_0x52f5('0x24')](_0x1d3baf)){_0x18fe55[_0x1d3baf]=_0x470794[_0x1d3baf];}}};Realtime[_0x52f5('0x39')][_0x52f5('0x3a')]=function(){var _0x11b20a=this;return function(_0xc69d1e){if(_0xc69d1e){freeIsNotKeySip(_0xc69d1e,_0x11b20a[_0x52f5('0x11')]);for(var _0x10ccab=0x0,_0x199186={},_0x318656={};_0x10ccab<_0xc69d1e[_0x52f5('0x3b')];_0x10ccab+=0x1){_0x199186=_0xc69d1e[_0x10ccab];if(_[_0x52f5('0x3c')](_0x11b20a[_0x52f5('0x11')][util[_0x52f5('0x25')]('SIP/%s',_0x199186['name'])])){_0x11b20a[_0x52f5('0x11')][util['format'](_0x52f5('0x26'),_0x199186[_0x52f5('0x27')])]=new Agent(_0x199186);}else{_0x11b20a[_0x52f5('0x3d')](_0x11b20a[_0x52f5('0x11')][util['format'](_0x52f5('0x26'),_0x199186[_0x52f5('0x27')])],_0x199186);}}}return _0x11b20a[_0x52f5('0x11')];};};Realtime[_0x52f5('0x39')][_0x52f5('0x3e')]=function(){var _0x1c3db8=this;return function(_0x3b0498){if(_0x3b0498){freeIsNotKeySip(_0x3b0498,_0x1c3db8[_0x52f5('0x12')]);for(var _0x1076a0=0x0,_0x1c3d58={},_0xc7e778={};_0x1076a0<_0x3b0498['length'];_0x1076a0+=0x1){_0x1c3d58=_0x3b0498[_0x1076a0];if(_['isUndefined'](_0x1c3db8['telephones'][util[_0x52f5('0x25')](_0x52f5('0x26'),_0x1c3d58[_0x52f5('0x27')])])){_0x1c3db8[_0x52f5('0x12')][util[_0x52f5('0x25')]('SIP/%s',_0x1c3d58[_0x52f5('0x27')])]=new Telephone(_0x1c3d58);}else{_0x1c3db8[_0x52f5('0x3d')](_0x1c3db8['telephones'][util['format'](_0x52f5('0x26'),_0x1c3d58[_0x52f5('0x27')])],_0x1c3d58);}}}return _0x1c3db8[_0x52f5('0x12')];};};Realtime[_0x52f5('0x39')][_0x52f5('0x3f')]=function(){var _0x2f9ef1=this;return function(_0x6482fe){if(_0x6482fe){freeIsNotKeySip(_0x6482fe,_0x2f9ef1[_0x52f5('0x13')]);for(var _0x329349=0x0,_0x22db0c={},_0x52181f={};_0x329349<_0x6482fe[_0x52f5('0x3b')];_0x329349+=0x1){_0x22db0c=_0x6482fe[_0x329349];if(_[_0x52f5('0x3c')](_0x2f9ef1['trunks'][util[_0x52f5('0x25')](_0x52f5('0x26'),_0x22db0c[_0x52f5('0x27')])])){_0x2f9ef1[_0x52f5('0x13')][util['format'](_0x52f5('0x26'),_0x22db0c[_0x52f5('0x27')])]=new Trunk(_0x22db0c);}else{_0x2f9ef1['mergeFromDatabase'](_0x2f9ef1[_0x52f5('0x13')][util[_0x52f5('0x25')](_0x52f5('0x26'),_0x22db0c[_0x52f5('0x27')])],_0x22db0c);}}}return _0x2f9ef1['trunks'];};};Realtime[_0x52f5('0x39')]['initVoiceQueues']=function(){var _0x2c62f4=this;return function(_0x453fff){if(_0x453fff){freeIsNotKey(_0x453fff,_0x2c62f4['voiceQueues'],_0x52f5('0x27'));for(var _0x5d91a9=0x0,_0x4332f9={},_0x8fe128={};_0x5d91a9<_0x453fff['length'];_0x5d91a9+=0x1){_0x4332f9=_0x453fff[_0x5d91a9];if(_[_0x52f5('0x3c')](_0x2c62f4[_0x52f5('0x14')][_0x4332f9[_0x52f5('0x27')]])){_0x2c62f4[_0x52f5('0x14')][_0x4332f9[_0x52f5('0x27')]]=new VoiceQueue(_0x4332f9);}else{_0x2c62f4[_0x52f5('0x3d')](_0x2c62f4[_0x52f5('0x14')][_0x4332f9[_0x52f5('0x27')]],_0x4332f9);}}}return _0x2c62f4[_0x52f5('0x14')];};};Realtime['prototype'][_0x52f5('0x40')]=function(){var _0x1864d0=this;return function(_0x4ce947){if(_0x4ce947){freeIsNotKey(_0x4ce947,_0x1864d0['triggers'],'id');for(var _0x6a3458=0x0,_0x358eb3={},_0x59bbe7={};_0x6a3458<_0x4ce947[_0x52f5('0x3b')];_0x6a3458+=0x1){_0x358eb3=_0x4ce947[_0x6a3458];if(_['isUndefined'](_0x1864d0[_0x52f5('0x15')][_0x358eb3['id']])){_0x1864d0[_0x52f5('0x15')][_0x358eb3['id']]=new Trigger(_0x358eb3);}else{_0x1864d0[_0x52f5('0x3d')](_0x1864d0[_0x52f5('0x15')][_0x358eb3['id']],_0x358eb3);}}}return _0x1864d0['triggers'];};};Realtime[_0x52f5('0x39')][_0x52f5('0x41')]=function(){var _0x429614=this;return function(_0x1ee532){if(_0x1ee532){freeIsNotKey(_0x1ee532,_0x429614[_0x52f5('0x17')],'id');for(var _0xc18d2b=0x0,_0x5ce6f1={},_0x13f13e={};_0xc18d2b<_0x1ee532[_0x52f5('0x3b')];_0xc18d2b+=0x1){_0x5ce6f1=_0x1ee532[_0xc18d2b];if(_['isUndefined'](_0x429614['templates'][_0x5ce6f1['id']])){_0x429614[_0x52f5('0x17')][_0x5ce6f1['id']]=new Template(_0x5ce6f1);}else{_0x429614[_0x52f5('0x3d')](_0x429614[_0x52f5('0x17')][_0x5ce6f1['id']],_0x5ce6f1);}}}return _0x429614['templates'];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x3db8b7=this;return function(_0x3e3edd){if(_0x3e3edd){freeIsNotKey(_0x3e3edd,_0x3db8b7['zendeskAccounts'],'id');for(var _0x1d22d2=0x0,_0x1f9ad3={},_0x21cb6b={};_0x1d22d2<_0x3e3edd['length'];_0x1d22d2+=0x1){_0x1f9ad3=_0x3e3edd[_0x1d22d2];if(_['isUndefined'](_0x3db8b7[_0x52f5('0x42')][_0x1f9ad3['id']])){_0x3db8b7[_0x52f5('0x42')][_0x1f9ad3['id']]=new ZendeskAccount(_0x1f9ad3);}else{_0x3db8b7[_0x52f5('0x3d')](_0x3db8b7[_0x52f5('0x42')][_0x1f9ad3['id']],_0x1f9ad3);}}}return _0x3db8b7[_0x52f5('0x42')];};};Realtime['prototype'][_0x52f5('0x43')]=function(){var _0x13c958=this;return function(_0x4a6c2c){if(_0x4a6c2c){freeIsNotKey(_0x4a6c2c,_0x13c958[_0x52f5('0x1d')],'id');for(var _0x48c050=0x0,_0x318c3e={},_0x111423={};_0x48c050<_0x4a6c2c[_0x52f5('0x3b')];_0x48c050+=0x1){_0x318c3e=_0x4a6c2c[_0x48c050];if(_[_0x52f5('0x3c')](_0x13c958[_0x52f5('0x1d')][_0x318c3e['id']])){_0x13c958[_0x52f5('0x1d')][_0x318c3e['id']]=new SalesforceAccount(_0x318c3e);}else{_0x13c958[_0x52f5('0x3d')](_0x13c958[_0x52f5('0x1d')][_0x318c3e['id']],_0x318c3e);}}}return _0x13c958[_0x52f5('0x1d')];};};Realtime[_0x52f5('0x39')][_0x52f5('0x44')]=function(){var _0x431dc3=this;return function(_0x310213){if(_0x310213){freeIsNotKey(_0x310213,_0x431dc3[_0x52f5('0x1f')],'id');for(var _0x281463=0x0,_0x59d693={},_0x3c969a={};_0x281463<_0x310213[_0x52f5('0x3b')];_0x281463+=0x1){_0x59d693=_0x310213[_0x281463];if(_[_0x52f5('0x3c')](_0x431dc3[_0x52f5('0x1f')][_0x59d693['id']])){_0x431dc3[_0x52f5('0x1f')][_0x59d693['id']]=new FreshdeskAccount(_0x59d693);}else{_0x431dc3['mergeFromDatabase'](_0x431dc3[_0x52f5('0x1f')][_0x59d693['id']],_0x59d693);}}}return _0x431dc3[_0x52f5('0x1f')];};};Realtime['prototype']['initZohoAccounts']=function(){var _0x182306=this;return function(_0x460719){if(_0x460719){freeIsNotKey(_0x460719,_0x182306[_0x52f5('0x20')],'id');for(var _0x12c378=0x0,_0xac4fca={},_0x5d855d={};_0x12c378<_0x460719[_0x52f5('0x3b')];_0x12c378+=0x1){_0xac4fca=_0x460719[_0x12c378];if(_['isUndefined'](_0x182306[_0x52f5('0x20')][_0xac4fca['id']])){_0x182306[_0x52f5('0x20')][_0xac4fca['id']]=new ZohoAccount(_0xac4fca);}else{_0x182306[_0x52f5('0x3d')](_0x182306[_0x52f5('0x20')][_0xac4fca['id']],_0xac4fca);}}}return _0x182306[_0x52f5('0x20')];};};Realtime['prototype'][_0x52f5('0x45')]=function(){var _0x273f36=this;return function(_0x1b62e3){if(_0x1b62e3){freeIsNotKey(_0x1b62e3,_0x273f36[_0x52f5('0x21')],'id');for(var _0x56e3fb=0x0,_0x3defcf={},_0x432189={};_0x56e3fb<_0x1b62e3[_0x52f5('0x3b')];_0x56e3fb+=0x1){_0x3defcf=_0x1b62e3[_0x56e3fb];if(_[_0x52f5('0x3c')](_0x273f36[_0x52f5('0x21')][_0x3defcf['id']])){_0x273f36['deskAccounts'][_0x3defcf['id']]=new DeskAccount(_0x3defcf);}else{_0x273f36[_0x52f5('0x3d')](_0x273f36[_0x52f5('0x21')][_0x3defcf['id']],_0x3defcf);}}}return _0x273f36['deskAccounts'];};};Realtime['prototype']['initSugarcrmAccounts']=function(){var _0x383488=this;return function(_0x49f835){if(_0x49f835){freeIsNotKey(_0x49f835,_0x383488[_0x52f5('0x1e')],'id');for(var _0x136e66=0x0,_0x3cf0df={},_0x84071a={};_0x136e66<_0x49f835[_0x52f5('0x3b')];_0x136e66+=0x1){_0x3cf0df=_0x49f835[_0x136e66];if(_[_0x52f5('0x3c')](_0x383488[_0x52f5('0x1e')][_0x3cf0df['id']])){_0x383488[_0x52f5('0x1e')][_0x3cf0df['id']]=new SugarcrmAccount(_0x3cf0df);}else{_0x383488[_0x52f5('0x3d')](_0x383488['sugarcrmAccounts'][_0x3cf0df['id']],_0x3cf0df);}}}return _0x383488[_0x52f5('0x1e')];};};Realtime[_0x52f5('0x39')][_0x52f5('0x46')]=function(){var _0x4338e0=this;return function(_0x1aad46){if(_0x1aad46){freeIsNotKey(_0x1aad46,_0x4338e0[_0x52f5('0x22')],'id');for(var _0x41f596=0x0,_0x523e3a={},_0x227a5f={};_0x41f596<_0x1aad46[_0x52f5('0x3b')];_0x41f596+=0x1){_0x523e3a=_0x1aad46[_0x41f596];if(_[_0x52f5('0x3c')](_0x4338e0[_0x52f5('0x22')][_0x523e3a['id']])){_0x4338e0[_0x52f5('0x22')][_0x523e3a['id']]=new VtigerAccount(_0x523e3a);}else{_0x4338e0['mergeFromDatabase'](_0x4338e0[_0x52f5('0x22')][_0x523e3a['id']],_0x523e3a);}}}return _0x4338e0[_0x52f5('0x22')];};};Realtime[_0x52f5('0x39')][_0x52f5('0x47')]=function(){var _0x2b4645=this;return function(_0x47dfe4){for(var _0x55685b=0x0;_0x55685b<_0x47dfe4['length'];_0x55685b+=0x1){_['merge'](_0x2b4645[_0x52f5('0x14')][_0x47dfe4[_0x55685b]['name']],_0x47dfe4[_0x55685b]);}return _0x2b4645[_0x52f5('0x14')];};};Realtime[_0x52f5('0x39')][_0x52f5('0x48')]=function(){var _0xc39b1f=this;return function(_0x25ceb1){clearVoiceQueues(_0xc39b1f['voiceQueues']);if(_0x25ceb1){_0x25ceb1=_[_0x52f5('0x49')](_0x25ceb1,_0x52f5('0x4a'));for(var _0x46f0d7 in _0x25ceb1){if(_0x25ceb1['hasOwnProperty'](_0x46f0d7)){var _0x251237={};for(var _0x41cfdd=0x0;_0x41cfdd<_0x25ceb1[_0x46f0d7]['length'];_0x41cfdd+=0x1){var _0x54cefe=_0x25ceb1[_0x46f0d7][_0x41cfdd][_0x52f5('0x4b')];if(_0xc39b1f[_0x52f5('0x14')][_0x54cefe]){if(_0x25ceb1[_0x46f0d7][_0x41cfdd][_0x52f5('0x4c')]){_0xc39b1f[_0x52f5('0x14')][_0x54cefe]['unmanaged']+=0x1;}_0xc39b1f[_0x52f5('0x14')][_0x54cefe][_0x52f5('0x2a')]+=moment(_0x25ceb1[_0x46f0d7][_0x41cfdd]['queuecallerleaveAt'])[_0x52f5('0x4d')](moment(_0x25ceb1[_0x46f0d7][_0x41cfdd][_0x52f5('0x4e')]),_0x52f5('0x4f'))||0x0;if(_0x41cfdd===_0x25ceb1[_0x46f0d7]['length']-0x1){_0xc39b1f[_0x52f5('0x14')][_0x54cefe][_0x52f5('0x2b')]+=moment(_0x25ceb1[_0x46f0d7][_0x41cfdd][_0x52f5('0x50')]||_0x25ceb1[_0x46f0d7][_0x41cfdd][_0x52f5('0x51')]||_0x25ceb1[_0x46f0d7][_0x41cfdd][_0x52f5('0x52')])[_0x52f5('0x4d')](moment(_0x25ceb1[_0x46f0d7][_0x41cfdd][_0x52f5('0x4e')]),_0x52f5('0x4f'))||0x0;_0xc39b1f['voiceQueues'][_0x54cefe][_0x52f5('0x28')]+=0x1;if(_0x25ceb1[_0x46f0d7][_0x41cfdd]['queuecallercomplete']){_0xc39b1f['voiceQueues'][_0x54cefe]['answered']+=0x1;_0xc39b1f[_0x52f5('0x14')][_0x54cefe][_0x52f5('0x2c')]+=moment(_0x25ceb1[_0x46f0d7][_0x41cfdd][_0x52f5('0x50')])[_0x52f5('0x4d')](moment(_0x25ceb1[_0x46f0d7][_0x41cfdd][_0x52f5('0x53')]),'seconds')||0x0;}}else{_0xc39b1f[_0x52f5('0x14')][_0x54cefe]['sumDuration']+=_0xc39b1f[_0x52f5('0x14')][_0x54cefe][_0x52f5('0x2a')]||0x0;}}}}}}return _0xc39b1f[_0x52f5('0x14')];};};Realtime[_0x52f5('0x39')]['initVoiceCallReports']=function(){var _0x379c9f=this;return function(_0x2cf77f){clearVoiceCallReports(_0x379c9f['outbound']);if(_0x2cf77f){for(var _0x29465c=0x0;_0x29465c<_0x2cf77f[_0x52f5('0x3b')];_0x29465c+=0x1){_0x379c9f[_0x52f5('0x54')][_0x52f5('0x28')]+=0x1;_0x379c9f[_0x52f5('0x54')]['sumDuration']+=_0x2cf77f[_0x29465c]['duration'];if(_0x2cf77f[_0x29465c][_0x52f5('0x55')]==='ANSWERED'){_0x379c9f['outbound'][_0x52f5('0x29')]+=0x1;_0x379c9f[_0x52f5('0x54')]['sumHoldTime']+=_0x2cf77f[_0x29465c]['duration']-_0x2cf77f[_0x29465c][_0x52f5('0x56')]||0x0;_0x379c9f[_0x52f5('0x54')][_0x52f5('0x2c')]+=_0x2cf77f[_0x29465c][_0x52f5('0x56')];}}}return _0x379c9f[_0x52f5('0x54')];};};Realtime[_0x52f5('0x39')][_0x52f5('0x57')]=function(){var _0x170c49=this;return function(_0x42b0f1){if(_0x42b0f1){freeIsNotKey(_0x42b0f1,_0x170c49['campaigns'],_0x52f5('0x27'));for(var _0x50dafc=0x0,_0x20b08a={};_0x50dafc<_0x42b0f1[_0x52f5('0x3b')];_0x50dafc+=0x1){_0x20b08a=_0x42b0f1[_0x50dafc];if(_['isUndefined'](_0x170c49[_0x52f5('0x16')][_0x20b08a[_0x52f5('0x27')]])){_0x170c49['campaigns'][_0x20b08a[_0x52f5('0x27')]]=new Campaign(_0x20b08a);}else{_0x170c49[_0x52f5('0x3d')](_0x170c49[_0x52f5('0x16')][_0x20b08a['name']],_0x20b08a);}}}return _0x170c49[_0x52f5('0x16')];};};Realtime['prototype'][_0x52f5('0x58')]=function(){var _0x48c10c=this;return function(_0x2a9ee1){if(_0x2a9ee1){freeIsNotKey(_0x2a9ee1,_0x48c10c[_0x52f5('0x18')],'id');for(var _0x23f05f=0x0,_0x1fe497={};_0x23f05f<_0x2a9ee1[_0x52f5('0x3b')];_0x23f05f+=0x1){_0x1fe497=_0x2a9ee1[_0x23f05f];if(_[_0x52f5('0x3c')](_0x48c10c[_0x52f5('0x18')][_0x1fe497['id']])){_0x48c10c[_0x52f5('0x18')][_0x1fe497['id']]=new VoiceExtension(_0x1fe497);}else{_0x48c10c[_0x52f5('0x3d')](_0x48c10c[_0x52f5('0x18')][_0x1fe497['id']],_0x1fe497);}}}return _0x48c10c[_0x52f5('0x18')];};};Realtime['prototype'][_0x52f5('0x59')]=function(){var _0x3ba91e=this;return function(_0x356770){clearCampaigns(_0x3ba91e['campaigns']);for(var _0x1c0b95=0x0;_0x1c0b95<_0x356770[_0x52f5('0x3b')];_0x1c0b95+=0x1){_[_0x52f5('0x5a')](_0x3ba91e['campaigns'][_0x356770[_0x1c0b95][_0x52f5('0x27')]],_0x356770[_0x1c0b95]);}return _0x3ba91e[_0x52f5('0x16')];};};Realtime['prototype']['initFaxAccounts']=function(){var _0x3fdce3=this;return function(_0x199201){if(_0x199201){freeIsNotKey(_0x199201,_0x3fdce3[_0x52f5('0x23')],'id');for(var _0x33720b=0x0,_0x5e35ce={},_0x23997f={};_0x33720b<_0x199201[_0x52f5('0x3b')];_0x33720b+=0x1){_0x5e35ce=_0x199201[_0x33720b];if(_[_0x52f5('0x3c')](_0x3fdce3[_0x52f5('0x23')][_0x5e35ce['id']])){_0x3fdce3[_0x52f5('0x23')][_0x5e35ce['id']]=new FaxAccount(_0x5e35ce);}else{_0x3fdce3['mergeFromDatabase'](_0x3fdce3[_0x52f5('0x23')][_0x5e35ce['id']],_0x5e35ce);}}}return _0x3fdce3['faxAccounts'];};};module[_0x52f5('0x5b')]=Realtime; \ No newline at end of file +var _0x69b7=['answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','isUndefined','format','name','telephones','length','initTrunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','queue','queuecallerexit','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','initCampaignHopperHistory','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/zendeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/faxAccount','agents','trunks','triggers','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','total'];(function(_0x4d776a,_0x5dbaea){var _0x8d1ae5=function(_0x1cd501){while(--_0x1cd501){_0x4d776a['push'](_0x4d776a['shift']());}};_0x8d1ae5(++_0x5dbaea);}(_0x69b7,0x9b));var _0x769b=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x69b7[_0x17d9e3];return _0x14192d;};'use strict';var BPromise=require(_0x769b('0x0'));var util=require(_0x769b('0x1'));var _=require(_0x769b('0x2'));var moment=require(_0x769b('0x3'));var Agent=require(_0x769b('0x4'));var Telephone=require(_0x769b('0x5'));var Trunk=require(_0x769b('0x6'));var VoiceQueue=require(_0x769b('0x7'));var Trigger=require('../model/trigger');var Template=require(_0x769b('0x8'));var Campaign=require(_0x769b('0x9'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x769b('0xa'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x769b('0xb'));var ZohoAccount=require(_0x769b('0xc'));var DeskAccount=require(_0x769b('0xd'));var VtigerAccount=require(_0x769b('0xe'));var FaxAccount=require(_0x769b('0xf'));var Realtime=function(){this[_0x769b('0x10')]={};this['telephones']={};this[_0x769b('0x11')]={};this['voiceQueues']={};this[_0x769b('0x12')]={};this['campaigns']={};this[_0x769b('0x13')]={};this[_0x769b('0x14')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x769b('0x15')]={};this[_0x769b('0x16')]={};this[_0x769b('0x17')]={};this[_0x769b('0x18')]={};this[_0x769b('0x19')]={};this['zendeskAccounts']={};this[_0x769b('0x1a')]={};this[_0x769b('0x1b')]={};this[_0x769b('0x1c')]={};this[_0x769b('0x1d')]={};this['deskAccounts']={};this['vtigerAccounts']={};this[_0x769b('0x1e')]={};};function freeIsNotKey(_0x527d97,_0x1cae55,_0x1fb645){var _0x4a918d=_[_0x769b('0x1f')](_0x527d97,function(_0x579446,_0x1c27f5){return _0x579446[_0x1fb645];});for(var _0x20c2bb in _0x1cae55){if(_0x1cae55[_0x769b('0x20')](_0x20c2bb)){if(!_0x4a918d[_0x20c2bb]){delete _0x1cae55[_0x20c2bb];}}}}function freeIsNotKeySip(_0x33c6ee,_0x53c877){var _0x528592=_[_0x769b('0x1f')](_0x33c6ee,function(_0x184e71,_0x1cfbb9){return util['format'](_0x769b('0x21'),_0x184e71['name']);});for(var _0x322916 in _0x53c877){if(_0x53c877[_0x769b('0x20')](_0x322916)){if(!_0x528592[_0x322916]){delete _0x53c877[_0x322916];}}}}function clearVoiceCallReports(_0x525237){_0x525237[_0x769b('0x22')]=0x0;_0x525237[_0x769b('0x23')]=0x0;_0x525237[_0x769b('0x24')]=0x0;_0x525237[_0x769b('0x25')]=0x0;_0x525237[_0x769b('0x26')]=0x0;}function clearCampaigns(_0x240607){if(!_[_0x769b('0x27')](_0x240607)){for(var _0x339a71 in _0x240607){if(_0x240607[_0x769b('0x20')](_0x339a71)){_0x240607[_0x339a71][_0x769b('0x28')]=0x0;_0x240607[_0x339a71]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2c62b9){if(!_[_0x769b('0x27')](_0x2c62b9)){for(var _0x49b3a6 in _0x2c62b9){if(_0x2c62b9[_0x769b('0x20')](_0x49b3a6)){_0x2c62b9[_0x49b3a6]['total']=0x0;_0x2c62b9[_0x49b3a6][_0x769b('0x23')]=0x0;_0x2c62b9[_0x49b3a6]['unmanaged']=0x0;_0x2c62b9[_0x49b3a6][_0x769b('0x24')]=0x0;_0x2c62b9[_0x49b3a6][_0x769b('0x25')]=0x0;_0x2c62b9[_0x49b3a6]['sumBillable']=0x0;_0x2c62b9[_0x49b3a6][_0x769b('0x29')]=0x0;_0x2c62b9[_0x49b3a6][_0x769b('0x2a')]=0x0;_0x2c62b9[_0x49b3a6][_0x769b('0x2b')]=0x0;_0x2c62b9[_0x49b3a6][_0x769b('0x2c')]=0x0;_0x2c62b9[_0x49b3a6][_0x769b('0x2d')]=0x0;_0x2c62b9[_0x49b3a6]['outboundUnknownCallsDay']=0x0;_0x2c62b9[_0x49b3a6]['outboundDropCallsDayTimeout']=0x0;_0x2c62b9[_0x49b3a6][_0x769b('0x2e')]=0x0;_0x2c62b9[_0x49b3a6][_0x769b('0x2f')]=0x0;_0x2c62b9[_0x49b3a6]['outboundOriginateFailureCallsDay']=0x0;_0x2c62b9[_0x49b3a6][_0x769b('0x30')]=0x0;_0x2c62b9[_0x49b3a6][_0x769b('0x31')]=0x0;_0x2c62b9[_0x49b3a6][_0x769b('0x29')]=0x0;_0x2c62b9[_0x49b3a6][_0x769b('0x32')]=0x0;_0x2c62b9[_0x49b3a6][_0x769b('0x33')]=!![];}}}}Realtime[_0x769b('0x34')][_0x769b('0x35')]=function(_0x3f613d,_0x5dc973){for(var _0x334baa in _0x5dc973){if(_0x3f613d[_0x769b('0x20')](_0x334baa)){_0x3f613d[_0x334baa]=_0x5dc973[_0x334baa];}}};Realtime['prototype']['initAgents']=function(){var _0x1aab40=this;return function(_0x192f89){if(_0x192f89){freeIsNotKeySip(_0x192f89,_0x1aab40[_0x769b('0x10')]);for(var _0x56c959=0x0,_0x2dd813={},_0x16cf25={};_0x56c959<_0x192f89['length'];_0x56c959+=0x1){_0x2dd813=_0x192f89[_0x56c959];if(_[_0x769b('0x36')](_0x1aab40[_0x769b('0x10')][util[_0x769b('0x37')](_0x769b('0x21'),_0x2dd813['name'])])){_0x1aab40[_0x769b('0x10')][util[_0x769b('0x37')](_0x769b('0x21'),_0x2dd813[_0x769b('0x38')])]=new Agent(_0x2dd813);}else{_0x1aab40['mergeFromDatabase'](_0x1aab40[_0x769b('0x10')][util['format'](_0x769b('0x21'),_0x2dd813[_0x769b('0x38')])],_0x2dd813);}}}return _0x1aab40[_0x769b('0x10')];};};Realtime[_0x769b('0x34')]['initTelephones']=function(){var _0x16c2fe=this;return function(_0x16fb0a){if(_0x16fb0a){freeIsNotKeySip(_0x16fb0a,_0x16c2fe[_0x769b('0x39')]);for(var _0x4823b7=0x0,_0x5c7edb={},_0x132ee9={};_0x4823b7<_0x16fb0a[_0x769b('0x3a')];_0x4823b7+=0x1){_0x5c7edb=_0x16fb0a[_0x4823b7];if(_[_0x769b('0x36')](_0x16c2fe[_0x769b('0x39')][util[_0x769b('0x37')](_0x769b('0x21'),_0x5c7edb[_0x769b('0x38')])])){_0x16c2fe['telephones'][util[_0x769b('0x37')]('SIP/%s',_0x5c7edb[_0x769b('0x38')])]=new Telephone(_0x5c7edb);}else{_0x16c2fe[_0x769b('0x35')](_0x16c2fe[_0x769b('0x39')][util[_0x769b('0x37')](_0x769b('0x21'),_0x5c7edb[_0x769b('0x38')])],_0x5c7edb);}}}return _0x16c2fe[_0x769b('0x39')];};};Realtime['prototype'][_0x769b('0x3b')]=function(){var _0x1d766f=this;return function(_0x9a7489){if(_0x9a7489){freeIsNotKeySip(_0x9a7489,_0x1d766f['trunks']);for(var _0xd15387=0x0,_0x1cae5e={},_0x194c24={};_0xd15387<_0x9a7489[_0x769b('0x3a')];_0xd15387+=0x1){_0x1cae5e=_0x9a7489[_0xd15387];if(_['isUndefined'](_0x1d766f['trunks'][util[_0x769b('0x37')](_0x769b('0x21'),_0x1cae5e[_0x769b('0x38')])])){_0x1d766f[_0x769b('0x11')][util['format'](_0x769b('0x21'),_0x1cae5e[_0x769b('0x38')])]=new Trunk(_0x1cae5e);}else{_0x1d766f[_0x769b('0x35')](_0x1d766f[_0x769b('0x11')][util[_0x769b('0x37')](_0x769b('0x21'),_0x1cae5e['name'])],_0x1cae5e);}}}return _0x1d766f[_0x769b('0x11')];};};Realtime['prototype'][_0x769b('0x3c')]=function(){var _0x1260ce=this;return function(_0xbaeb41){if(_0xbaeb41){freeIsNotKey(_0xbaeb41,_0x1260ce[_0x769b('0x3d')],_0x769b('0x38'));for(var _0x2f66ef=0x0,_0x4d3381={},_0x2c117f={};_0x2f66ef<_0xbaeb41['length'];_0x2f66ef+=0x1){_0x4d3381=_0xbaeb41[_0x2f66ef];if(_[_0x769b('0x36')](_0x1260ce[_0x769b('0x3d')][_0x4d3381[_0x769b('0x38')]])){_0x1260ce[_0x769b('0x3d')][_0x4d3381['name']]=new VoiceQueue(_0x4d3381);}else{_0x1260ce['mergeFromDatabase'](_0x1260ce[_0x769b('0x3d')][_0x4d3381[_0x769b('0x38')]],_0x4d3381);}}}return _0x1260ce[_0x769b('0x3d')];};};Realtime['prototype'][_0x769b('0x3e')]=function(){var _0x5145d5=this;return function(_0x145d87){if(_0x145d87){freeIsNotKey(_0x145d87,_0x5145d5[_0x769b('0x12')],'id');for(var _0x59b617=0x0,_0x37ea54={},_0x1048a0={};_0x59b617<_0x145d87[_0x769b('0x3a')];_0x59b617+=0x1){_0x37ea54=_0x145d87[_0x59b617];if(_[_0x769b('0x36')](_0x5145d5[_0x769b('0x12')][_0x37ea54['id']])){_0x5145d5['triggers'][_0x37ea54['id']]=new Trigger(_0x37ea54);}else{_0x5145d5[_0x769b('0x35')](_0x5145d5['triggers'][_0x37ea54['id']],_0x37ea54);}}}return _0x5145d5[_0x769b('0x12')];};};Realtime[_0x769b('0x34')][_0x769b('0x3f')]=function(){var _0x4f9165=this;return function(_0x305ec7){if(_0x305ec7){freeIsNotKey(_0x305ec7,_0x4f9165[_0x769b('0x13')],'id');for(var _0x30750d=0x0,_0x5d318d={},_0x528e62={};_0x30750d<_0x305ec7[_0x769b('0x3a')];_0x30750d+=0x1){_0x5d318d=_0x305ec7[_0x30750d];if(_[_0x769b('0x36')](_0x4f9165['templates'][_0x5d318d['id']])){_0x4f9165[_0x769b('0x13')][_0x5d318d['id']]=new Template(_0x5d318d);}else{_0x4f9165[_0x769b('0x35')](_0x4f9165['templates'][_0x5d318d['id']],_0x5d318d);}}}return _0x4f9165[_0x769b('0x13')];};};Realtime[_0x769b('0x34')][_0x769b('0x40')]=function(){var _0x32aff3=this;return function(_0x467dbc){if(_0x467dbc){freeIsNotKey(_0x467dbc,_0x32aff3['zendeskAccounts'],'id');for(var _0x28ce54=0x0,_0x4a1a40={},_0x7a92b1={};_0x28ce54<_0x467dbc[_0x769b('0x3a')];_0x28ce54+=0x1){_0x4a1a40=_0x467dbc[_0x28ce54];if(_[_0x769b('0x36')](_0x32aff3[_0x769b('0x41')][_0x4a1a40['id']])){_0x32aff3['zendeskAccounts'][_0x4a1a40['id']]=new ZendeskAccount(_0x4a1a40);}else{_0x32aff3[_0x769b('0x35')](_0x32aff3[_0x769b('0x41')][_0x4a1a40['id']],_0x4a1a40);}}}return _0x32aff3[_0x769b('0x41')];};};Realtime[_0x769b('0x34')][_0x769b('0x42')]=function(){var _0x3a8b6a=this;return function(_0xd0e993){if(_0xd0e993){freeIsNotKey(_0xd0e993,_0x3a8b6a[_0x769b('0x1a')],'id');for(var _0x3bfa7a=0x0,_0x292232={},_0x43428f={};_0x3bfa7a<_0xd0e993[_0x769b('0x3a')];_0x3bfa7a+=0x1){_0x292232=_0xd0e993[_0x3bfa7a];if(_[_0x769b('0x36')](_0x3a8b6a[_0x769b('0x1a')][_0x292232['id']])){_0x3a8b6a['salesforceAccounts'][_0x292232['id']]=new SalesforceAccount(_0x292232);}else{_0x3a8b6a[_0x769b('0x35')](_0x3a8b6a['salesforceAccounts'][_0x292232['id']],_0x292232);}}}return _0x3a8b6a[_0x769b('0x1a')];};};Realtime[_0x769b('0x34')][_0x769b('0x43')]=function(){var _0x50831f=this;return function(_0x1d7857){if(_0x1d7857){freeIsNotKey(_0x1d7857,_0x50831f[_0x769b('0x1c')],'id');for(var _0x29645c=0x0,_0x1a2fff={},_0x2c1c5e={};_0x29645c<_0x1d7857[_0x769b('0x3a')];_0x29645c+=0x1){_0x1a2fff=_0x1d7857[_0x29645c];if(_['isUndefined'](_0x50831f['freshdeskAccounts'][_0x1a2fff['id']])){_0x50831f[_0x769b('0x1c')][_0x1a2fff['id']]=new FreshdeskAccount(_0x1a2fff);}else{_0x50831f[_0x769b('0x35')](_0x50831f[_0x769b('0x1c')][_0x1a2fff['id']],_0x1a2fff);}}}return _0x50831f[_0x769b('0x1c')];};};Realtime['prototype'][_0x769b('0x44')]=function(){var _0x421f9f=this;return function(_0x547724){if(_0x547724){freeIsNotKey(_0x547724,_0x421f9f[_0x769b('0x1d')],'id');for(var _0x45d431=0x0,_0x3e3bb2={},_0x351210={};_0x45d431<_0x547724['length'];_0x45d431+=0x1){_0x3e3bb2=_0x547724[_0x45d431];if(_[_0x769b('0x36')](_0x421f9f[_0x769b('0x1d')][_0x3e3bb2['id']])){_0x421f9f[_0x769b('0x1d')][_0x3e3bb2['id']]=new ZohoAccount(_0x3e3bb2);}else{_0x421f9f[_0x769b('0x35')](_0x421f9f['zohoAccounts'][_0x3e3bb2['id']],_0x3e3bb2);}}}return _0x421f9f[_0x769b('0x1d')];};};Realtime['prototype'][_0x769b('0x45')]=function(){var _0x512aea=this;return function(_0x3e69b1){if(_0x3e69b1){freeIsNotKey(_0x3e69b1,_0x512aea[_0x769b('0x46')],'id');for(var _0x556c32=0x0,_0xbbfe5a={},_0x242615={};_0x556c32<_0x3e69b1['length'];_0x556c32+=0x1){_0xbbfe5a=_0x3e69b1[_0x556c32];if(_[_0x769b('0x36')](_0x512aea['deskAccounts'][_0xbbfe5a['id']])){_0x512aea[_0x769b('0x46')][_0xbbfe5a['id']]=new DeskAccount(_0xbbfe5a);}else{_0x512aea[_0x769b('0x35')](_0x512aea[_0x769b('0x46')][_0xbbfe5a['id']],_0xbbfe5a);}}}return _0x512aea['deskAccounts'];};};Realtime['prototype'][_0x769b('0x47')]=function(){var _0x249fb6=this;return function(_0x28757f){if(_0x28757f){freeIsNotKey(_0x28757f,_0x249fb6['sugarcrmAccounts'],'id');for(var _0x592884=0x0,_0x349fc0={},_0x13f491={};_0x592884<_0x28757f[_0x769b('0x3a')];_0x592884+=0x1){_0x349fc0=_0x28757f[_0x592884];if(_[_0x769b('0x36')](_0x249fb6['sugarcrmAccounts'][_0x349fc0['id']])){_0x249fb6[_0x769b('0x1b')][_0x349fc0['id']]=new SugarcrmAccount(_0x349fc0);}else{_0x249fb6[_0x769b('0x35')](_0x249fb6[_0x769b('0x1b')][_0x349fc0['id']],_0x349fc0);}}}return _0x249fb6[_0x769b('0x1b')];};};Realtime[_0x769b('0x34')][_0x769b('0x48')]=function(){var _0x238d0a=this;return function(_0x177eb6){if(_0x177eb6){freeIsNotKey(_0x177eb6,_0x238d0a['vtigerAccounts'],'id');for(var _0x40e9e6=0x0,_0x4d3fd7={},_0x1e62d8={};_0x40e9e6<_0x177eb6['length'];_0x40e9e6+=0x1){_0x4d3fd7=_0x177eb6[_0x40e9e6];if(_[_0x769b('0x36')](_0x238d0a[_0x769b('0x49')][_0x4d3fd7['id']])){_0x238d0a['vtigerAccounts'][_0x4d3fd7['id']]=new VtigerAccount(_0x4d3fd7);}else{_0x238d0a[_0x769b('0x35')](_0x238d0a[_0x769b('0x49')][_0x4d3fd7['id']],_0x4d3fd7);}}}return _0x238d0a[_0x769b('0x49')];};};Realtime[_0x769b('0x34')][_0x769b('0x4a')]=function(){var _0x382be7=this;return function(_0x23568a){for(var _0x5bc22f=0x0;_0x5bc22f<_0x23568a[_0x769b('0x3a')];_0x5bc22f+=0x1){_[_0x769b('0x4b')](_0x382be7[_0x769b('0x3d')][_0x23568a[_0x5bc22f][_0x769b('0x38')]],_0x23568a[_0x5bc22f]);}return _0x382be7['voiceQueues'];};};Realtime['prototype'][_0x769b('0x4c')]=function(){var _0x59a4a4=this;return function(_0x49a69b){clearVoiceQueues(_0x59a4a4[_0x769b('0x3d')]);if(_0x49a69b){_0x49a69b=_['groupBy'](_0x49a69b,_0x769b('0x4d'));for(var _0x37ac30 in _0x49a69b){if(_0x49a69b[_0x769b('0x20')](_0x37ac30)){var _0x4b599f={};for(var _0x25b07c=0x0;_0x25b07c<_0x49a69b[_0x37ac30]['length'];_0x25b07c+=0x1){var _0x2e80e1=_0x49a69b[_0x37ac30][_0x25b07c][_0x769b('0x4e')];if(_0x59a4a4[_0x769b('0x3d')][_0x2e80e1]){if(_0x49a69b[_0x37ac30][_0x25b07c][_0x769b('0x4f')]){_0x59a4a4[_0x769b('0x3d')][_0x2e80e1]['unmanaged']+=0x1;}_0x59a4a4['voiceQueues'][_0x2e80e1]['sumHoldTime']+=moment(_0x49a69b[_0x37ac30][_0x25b07c]['queuecallerleaveAt'])[_0x769b('0x50')](moment(_0x49a69b[_0x37ac30][_0x25b07c]['queuecallerjoinAt']),_0x769b('0x51'))||0x0;if(_0x25b07c===_0x49a69b[_0x37ac30][_0x769b('0x3a')]-0x1){_0x59a4a4[_0x769b('0x3d')][_0x2e80e1][_0x769b('0x25')]+=moment(_0x49a69b[_0x37ac30][_0x25b07c][_0x769b('0x52')]||_0x49a69b[_0x37ac30][_0x25b07c]['queuecallerabandonAt']||_0x49a69b[_0x37ac30][_0x25b07c][_0x769b('0x53')])['diff'](moment(_0x49a69b[_0x37ac30][_0x25b07c][_0x769b('0x54')]),_0x769b('0x51'))||0x0;_0x59a4a4[_0x769b('0x3d')][_0x2e80e1][_0x769b('0x22')]+=0x1;if(_0x49a69b[_0x37ac30][_0x25b07c][_0x769b('0x55')]){_0x59a4a4[_0x769b('0x3d')][_0x2e80e1]['answered']+=0x1;_0x59a4a4[_0x769b('0x3d')][_0x2e80e1][_0x769b('0x26')]+=moment(_0x49a69b[_0x37ac30][_0x25b07c][_0x769b('0x52')])[_0x769b('0x50')](moment(_0x49a69b[_0x37ac30][_0x25b07c][_0x769b('0x56')]),_0x769b('0x51'))||0x0;}}else{_0x59a4a4[_0x769b('0x3d')][_0x2e80e1]['sumDuration']+=_0x59a4a4[_0x769b('0x3d')][_0x2e80e1][_0x769b('0x24')]||0x0;}}}}}}return _0x59a4a4[_0x769b('0x3d')];};};Realtime['prototype'][_0x769b('0x57')]=function(){var _0x4166cf=this;return function(_0x253334){clearVoiceCallReports(_0x4166cf[_0x769b('0x14')]);if(_0x253334){for(var _0x36f46e=0x0;_0x36f46e<_0x253334[_0x769b('0x3a')];_0x36f46e+=0x1){_0x4166cf[_0x769b('0x14')][_0x769b('0x22')]+=0x1;_0x4166cf[_0x769b('0x14')][_0x769b('0x25')]+=_0x253334[_0x36f46e]['duration'];if(_0x253334[_0x36f46e][_0x769b('0x58')]===_0x769b('0x59')){_0x4166cf[_0x769b('0x14')][_0x769b('0x23')]+=0x1;_0x4166cf[_0x769b('0x14')][_0x769b('0x24')]+=_0x253334[_0x36f46e]['duration']-_0x253334[_0x36f46e][_0x769b('0x5a')]||0x0;_0x4166cf['outbound'][_0x769b('0x26')]+=_0x253334[_0x36f46e][_0x769b('0x5a')];}}}return _0x4166cf[_0x769b('0x14')];};};Realtime[_0x769b('0x34')][_0x769b('0x5b')]=function(){var _0x46a76e=this;return function(_0x341b15){if(_0x341b15){freeIsNotKey(_0x341b15,_0x46a76e[_0x769b('0x5c')],_0x769b('0x38'));for(var _0x12f814=0x0,_0x394646={};_0x12f814<_0x341b15[_0x769b('0x3a')];_0x12f814+=0x1){_0x394646=_0x341b15[_0x12f814];if(_['isUndefined'](_0x46a76e[_0x769b('0x5c')][_0x394646['name']])){_0x46a76e[_0x769b('0x5c')][_0x394646[_0x769b('0x38')]]=new Campaign(_0x394646);}else{_0x46a76e['mergeFromDatabase'](_0x46a76e['campaigns'][_0x394646[_0x769b('0x38')]],_0x394646);}}}return _0x46a76e[_0x769b('0x5c')];};};Realtime[_0x769b('0x34')]['initVoiceExtensions']=function(){var _0x3166bc=this;return function(_0x467128){if(_0x467128){freeIsNotKey(_0x467128,_0x3166bc[_0x769b('0x15')],'id');for(var _0x1b6ef3=0x0,_0x28b9eb={};_0x1b6ef3<_0x467128[_0x769b('0x3a')];_0x1b6ef3+=0x1){_0x28b9eb=_0x467128[_0x1b6ef3];if(_[_0x769b('0x36')](_0x3166bc[_0x769b('0x15')][_0x28b9eb['id']])){_0x3166bc[_0x769b('0x15')][_0x28b9eb['id']]=new VoiceExtension(_0x28b9eb);}else{_0x3166bc[_0x769b('0x35')](_0x3166bc[_0x769b('0x15')][_0x28b9eb['id']],_0x28b9eb);}}}return _0x3166bc[_0x769b('0x15')];};};Realtime[_0x769b('0x34')][_0x769b('0x5d')]=function(){var _0x534a88=this;return function(_0x4b678f){clearCampaigns(_0x534a88[_0x769b('0x5c')]);for(var _0xe826e=0x0;_0xe826e<_0x4b678f[_0x769b('0x3a')];_0xe826e+=0x1){_[_0x769b('0x4b')](_0x534a88[_0x769b('0x5c')][_0x4b678f[_0xe826e]['name']],_0x4b678f[_0xe826e]);}return _0x534a88[_0x769b('0x5c')];};};Realtime['prototype']['initFaxAccounts']=function(){var _0xc947cd=this;return function(_0x486c8d){if(_0x486c8d){freeIsNotKey(_0x486c8d,_0xc947cd['faxAccounts'],'id');for(var _0x551b2c=0x0,_0x2382ab={},_0x23ae99={};_0x551b2c<_0x486c8d[_0x769b('0x3a')];_0x551b2c+=0x1){_0x2382ab=_0x486c8d[_0x551b2c];if(_[_0x769b('0x36')](_0xc947cd['faxAccounts'][_0x2382ab['id']])){_0xc947cd['faxAccounts'][_0x2382ab['id']]=new FaxAccount(_0x2382ab);}else{_0xc947cd['mergeFromDatabase'](_0xc947cd[_0x769b('0x1e')][_0x2382ab['id']],_0x2382ab);}}}return _0xc947cd[_0x769b('0x1e')];};};module[_0x769b('0x5e')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 3132d70..100fd71 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 _0x6dda=['destinationchannel','channel','disposition','ANSWERED','connectedlinenum','callerid','monitor','monitorFilename','monitors','createdAt','create','blindTransfer','exports','lodash','util','../../../config/logger','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','prototype','sync','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','attendedtransfer','attendedTransfer','length','match','destination','exten','dialer','queue','lastdata','context','from-voip-provider','accountcode','calleridpreview','calleridnum','originatecalleridnum'];(function(_0x10e7dc,_0x107f01){var _0x32d917=function(_0x232f61){while(--_0x232f61){_0x10e7dc['push'](_0x10e7dc['shift']());}};_0x32d917(++_0x107f01);}(_0x6dda,0x179));var _0xa6dd=function(_0x32aec7,_0x28e7a4){_0x32aec7=_0x32aec7-0x0;var _0x2dc053=_0x6dda[_0x32aec7];return _0x2dc053;};'use strict';var BPromise=require('bluebird');var _=require(_0xa6dd('0x0'));var moment=require('moment');var util=require(_0xa6dd('0x1'));var logger=require(_0xa6dd('0x2'))(_0xa6dd('0x3'));var ami=require(_0xa6dd('0x4'));var RpcVoiceAgentReport=require(_0xa6dd('0x5'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xa6dd('0x6'));var RpcMemberReport=require(_0xa6dd('0x7'));var RpcVoiceQueueReport=require(_0xa6dd('0x8'));var RpcVoiceRecording=require(_0xa6dd('0x9'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xa6dd('0xa'));var VoiceCallReport=require(_0xa6dd('0xb'));var VoiceAgentReport=require(_0xa6dd('0xc'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xa6dd('0xd'));function Report(_0xef765b){this[_0xa6dd('0xe')]=_0xef765b;}Report[_0xa6dd('0xf')][_0xa6dd('0x10')]=function(_0x201001){var _0x5de9a0=new VoiceQueueReport(this[_0xa6dd('0xe')]);var _0xfe2ee9=new VoiceAgentReport(this[_0xa6dd('0xe')]);var _0x484728=new VoiceDialReport(this[_0xa6dd('0xe')]);var _0x136860=new VoiceCallReport(this[_0xa6dd('0xe')]);var _0x2f8058=new UserReport(this[_0xa6dd('0xe')]);ami['on']('custom:voiceQueueReport',this[_0xa6dd('0x11')][_0xa6dd('0x12')](this));ami['on'](_0xa6dd('0x13'),this[_0xa6dd('0x14')][_0xa6dd('0x12')](this));ami['on'](_0xa6dd('0x15'),this['voiceAgentReport'][_0xa6dd('0x12')](this));ami['on'](_0xa6dd('0x16'),this[_0xa6dd('0x17')][_0xa6dd('0x12')](this));ami['on']('blindtransfer',this['blindTransfer'][_0xa6dd('0x12')](this));ami['on'](_0xa6dd('0x18'),this[_0xa6dd('0x19')]['bind'](this));};Report[_0xa6dd('0xf')][_0xa6dd('0x11')]=function(_0x25e1bf){for(var _0x1d8afa=0x0;_0x1d8afa<_0x25e1bf[_0xa6dd('0x1a')];_0x1d8afa+=0x1){if(_0x25e1bf[_0x1d8afa]['queuecallercomplete']){RpcMemberReport[_0xa6dd('0x11')](_0x25e1bf[_0x1d8afa]);}RpcVoiceQueueReport['create'](_0x25e1bf[_0x1d8afa]);}};function extractCalleridNumber(_0x3107e9){var _0x5d333a=_0x3107e9[_0xa6dd('0x1b')](/<(.*?)>/);return _0x5d333a?_0x5d333a[0x1]:_0x3107e9;}Report['prototype'][_0xa6dd('0x14')]=function(_0x4d5862){_0x4d5862[_0xa6dd('0x1c')]=_0x4d5862['destination']||_0x4d5862[_0xa6dd('0x1d')];if(_0x4d5862['type']==_0xa6dd('0x1e')){_0x4d5862['lastapplication']=_0xa6dd('0x1f');_0x4d5862[_0xa6dd('0x20')]=_0x4d5862['queue'];if(_0x4d5862[_0xa6dd('0x21')]==_0xa6dd('0x22')){_0x4d5862[_0xa6dd('0x23')]='';_0x4d5862[_0xa6dd('0x1c')]=extractCalleridNumber(_0x4d5862['callerid']);}else if(_0x4d5862['context']=='from-sip'){if(_0x4d5862[_0xa6dd('0x1c')]=='xcally-motion-preview'){_0x4d5862['destination']=extractCalleridNumber(_0x4d5862[_0xa6dd('0x24')]);_0x4d5862[_0xa6dd('0x25')]=_0x4d5862[_0xa6dd('0x26')];_0x4d5862[_0xa6dd('0x27')]=[_0x4d5862[_0xa6dd('0x28')],_0x4d5862[_0xa6dd('0x28')]=_0x4d5862[_0xa6dd('0x27')]][0x0];_0x4d5862['callerid']=_0x4d5862[_0xa6dd('0x24')];}else{_0x4d5862[_0xa6dd('0x1c')]=_0x4d5862[_0xa6dd('0x25')];_0x4d5862['calleridnum']=_0x4d5862[_0xa6dd('0x26')];if(_0x4d5862[_0xa6dd('0x29')]==_0xa6dd('0x2a')){_0x4d5862['accountcode']=_0x4d5862[_0xa6dd('0x2b')];}else{_0x4d5862['accountcode']='';}}}}else{_0x4d5862[_0xa6dd('0x2c')]=util['format']('\x22%s\x22\x20<%s>',_0x4d5862['calleridname'],_0x4d5862[_0xa6dd('0x25')]);}if(_0x4d5862[_0xa6dd('0x2d')]){for(var _0x4cad14=0x0;_0x4cad14<_0x4d5862['monitors'][_0xa6dd('0x1a')];_0x4cad14+=0x1){_0x4d5862[_0xa6dd('0x2e')]=_0x4d5862[_0xa6dd('0x2f')][_0x4cad14]['filename'];_0x4d5862[_0xa6dd('0x30')]=_0x4d5862[_0xa6dd('0x2f')][_0x4cad14]['createdAt'];RpcVoiceRecording[_0xa6dd('0x31')](_0x4d5862);}}RpcVoiceCallReport[_0xa6dd('0x31')](_0x4d5862);};Report['prototype']['voiceAgentReport']=function(_0x5944e9){for(var _0x1d73d8=0x0;_0x1d73d8<_0x5944e9[_0xa6dd('0x1a')];_0x1d73d8+=0x1){RpcVoiceAgentReport['create'](_0x5944e9[_0x1d73d8]);}};Report[_0xa6dd('0xf')][_0xa6dd('0x17')]=function(_0x499f09){RpcVoiceDialReport[_0xa6dd('0x31')](_0x499f09);RpcMemberReport['voiceDialReport'](_0x499f09);};Report[_0xa6dd('0xf')][_0xa6dd('0x32')]=function(_0x516708){RpcVoiceTransferReport[_0xa6dd('0x32')](_0x516708);};Report[_0xa6dd('0xf')][_0xa6dd('0x19')]=function(_0x57790a){RpcVoiceTransferReport[_0xa6dd('0x19')](_0x57790a);};module[_0xa6dd('0x33')]=Report; \ No newline at end of file +var _0xd992=['../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','sync','realtime','custom:voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','prototype','voiceQueueReport','length','create','match','voiceCallReport','exten','type','dialer','lastapplication','queue','context','accountcode','destination','callerid','from-sip','calleridpreview','calleridnum','originatecalleridnum','channel','destinationchannel','disposition','ANSWERED','format','\x22%s\x22\x20<%s>','calleridname','monitor','monitorFilename','monitors','filename','createdAt','attendedTransfer','bluebird','moment','util','../../../config/logger','ami','../rpc/voiceAgentReport','../rpc/voiceCallReport'];(function(_0x3b545f,_0x11fb21){var _0x16ad16=function(_0x503ca1){while(--_0x503ca1){_0x3b545f['push'](_0x3b545f['shift']());}};_0x16ad16(++_0x11fb21);}(_0xd992,0xe5));var _0x2d99=function(_0x27d0ad,_0x3f8bef){_0x27d0ad=_0x27d0ad-0x0;var _0x4eec43=_0xd992[_0x27d0ad];return _0x4eec43;};'use strict';var BPromise=require(_0x2d99('0x0'));var _=require('lodash');var moment=require(_0x2d99('0x1'));var util=require(_0x2d99('0x2'));var logger=require(_0x2d99('0x3'))(_0x2d99('0x4'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x2d99('0x5'));var RpcVoiceCallReport=require(_0x2d99('0x6'));var RpcVoiceDialReport=require(_0x2d99('0x7'));var RpcMemberReport=require(_0x2d99('0x8'));var RpcVoiceQueueReport=require(_0x2d99('0x9'));var RpcVoiceRecording=require(_0x2d99('0xa'));var RpcVoiceTransferReport=require(_0x2d99('0xb'));var VoiceQueueReport=require(_0x2d99('0xc'));var VoiceCallReport=require(_0x2d99('0xd'));var VoiceAgentReport=require(_0x2d99('0xe'));var VoiceDialReport=require(_0x2d99('0xf'));var UserReport=require(_0x2d99('0x10'));function Report(_0x517b3b){this['realtime']=_0x517b3b;}Report['prototype'][_0x2d99('0x11')]=function(_0x6ebd95){var _0xede73c=new VoiceQueueReport(this[_0x2d99('0x12')]);var _0x310cd1=new VoiceAgentReport(this[_0x2d99('0x12')]);var _0x5a8d73=new VoiceDialReport(this['realtime']);var _0x14dd47=new VoiceCallReport(this[_0x2d99('0x12')]);var _0x379fa9=new UserReport(this[_0x2d99('0x12')]);ami['on'](_0x2d99('0x13'),this['voiceQueueReport'][_0x2d99('0x14')](this));ami['on'](_0x2d99('0x15'),this['voiceCallReport'][_0x2d99('0x14')](this));ami['on'](_0x2d99('0x16'),this[_0x2d99('0x17')][_0x2d99('0x14')](this));ami['on']('custom:voiceDialReport',this[_0x2d99('0x18')][_0x2d99('0x14')](this));ami['on'](_0x2d99('0x19'),this[_0x2d99('0x1a')][_0x2d99('0x14')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0x2d99('0x14')](this));};Report[_0x2d99('0x1b')][_0x2d99('0x1c')]=function(_0x3ac908){for(var _0x357ce3=0x0;_0x357ce3<_0x3ac908[_0x2d99('0x1d')];_0x357ce3+=0x1){if(_0x3ac908[_0x357ce3]['queuecallercomplete']){RpcMemberReport[_0x2d99('0x1c')](_0x3ac908[_0x357ce3]);}RpcVoiceQueueReport[_0x2d99('0x1e')](_0x3ac908[_0x357ce3]);}};function extractCalleridNumber(_0x38af80){var _0x801bfb=_0x38af80[_0x2d99('0x1f')](/<(.*?)>/);return _0x801bfb?_0x801bfb[0x1]:_0x38af80;}Report[_0x2d99('0x1b')][_0x2d99('0x20')]=function(_0x39dabc){_0x39dabc['destination']=_0x39dabc['destination']||_0x39dabc[_0x2d99('0x21')];if(_0x39dabc[_0x2d99('0x22')]==_0x2d99('0x23')){_0x39dabc[_0x2d99('0x24')]=_0x2d99('0x25');_0x39dabc['lastdata']=_0x39dabc[_0x2d99('0x25')];if(_0x39dabc[_0x2d99('0x26')]=='from-voip-provider'){_0x39dabc[_0x2d99('0x27')]='';_0x39dabc[_0x2d99('0x28')]=extractCalleridNumber(_0x39dabc[_0x2d99('0x29')]);}else if(_0x39dabc['context']==_0x2d99('0x2a')){if(_0x39dabc['destination']=='xcally-motion-preview'){_0x39dabc[_0x2d99('0x28')]=extractCalleridNumber(_0x39dabc[_0x2d99('0x2b')]);_0x39dabc[_0x2d99('0x2c')]=_0x39dabc[_0x2d99('0x2d')];_0x39dabc['destinationchannel']=[_0x39dabc[_0x2d99('0x2e')],_0x39dabc[_0x2d99('0x2e')]=_0x39dabc[_0x2d99('0x2f')]][0x0];_0x39dabc[_0x2d99('0x29')]=_0x39dabc[_0x2d99('0x2b')];}else{_0x39dabc[_0x2d99('0x28')]=_0x39dabc[_0x2d99('0x2c')];_0x39dabc['calleridnum']=_0x39dabc['originatecalleridnum'];if(_0x39dabc[_0x2d99('0x30')]==_0x2d99('0x31')){_0x39dabc['accountcode']=_0x39dabc['connectedlinenum'];}else{_0x39dabc['accountcode']='';}}}}else{_0x39dabc['callerid']=util[_0x2d99('0x32')](_0x2d99('0x33'),_0x39dabc[_0x2d99('0x34')],_0x39dabc[_0x2d99('0x2c')]);}if(_0x39dabc[_0x2d99('0x35')]){for(var _0x37487c=0x0;_0x37487c<_0x39dabc['monitors'][_0x2d99('0x1d')];_0x37487c+=0x1){_0x39dabc[_0x2d99('0x36')]=_0x39dabc[_0x2d99('0x37')][_0x37487c][_0x2d99('0x38')];_0x39dabc[_0x2d99('0x39')]=_0x39dabc['monitors'][_0x37487c]['createdAt'];RpcVoiceRecording[_0x2d99('0x1e')](_0x39dabc);}}RpcVoiceCallReport['create'](_0x39dabc);};Report[_0x2d99('0x1b')][_0x2d99('0x17')]=function(_0x3c90f5){for(var _0x3ea956=0x0;_0x3ea956<_0x3c90f5[_0x2d99('0x1d')];_0x3ea956+=0x1){RpcVoiceAgentReport[_0x2d99('0x1e')](_0x3c90f5[_0x3ea956]);}};Report[_0x2d99('0x1b')][_0x2d99('0x18')]=function(_0x2e7236){RpcVoiceDialReport[_0x2d99('0x1e')](_0x2e7236);RpcMemberReport[_0x2d99('0x18')](_0x2e7236);};Report[_0x2d99('0x1b')][_0x2d99('0x1a')]=function(_0xb4f14e){RpcVoiceTransferReport[_0x2d99('0x1a')](_0xb4f14e);};Report[_0x2d99('0x1b')][_0x2d99('0x3a')]=function(_0x5379e4){RpcVoiceTransferReport[_0x2d99('0x3a')](_0x5379e4);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 72cc23d..c031018 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 _0x513d=['startsWith','Local','substring','indexOf','phone','accountcode','[syncDeviceState][UserReport]','peer','registered','status','address','exports','lodash','moment','bluebird','util','../../../config/logger','ami','../ami','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','loopSyncRealTimeShow','then','actionSipPeerStatus','error','inspect','resolve','actionDeviceStateList','prototype','isNotNull','isUndefined','find','username','stateRegistry','state','merge','event','emit','format','trunk:%s','name','trunk:save','[syncRegistry][UserReport]','device','local','toLowerCase','inuse','toNumber','stateTime','telephone:%s','telephone:save','Queue'];(function(_0x284506,_0x191316){var _0x1e9ee5=function(_0xe7eaa){while(--_0xe7eaa){_0x284506['push'](_0x284506['shift']());}};_0x1e9ee5(++_0x191316);}(_0x513d,0x1b7));var _0xd513=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x513d[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0xd513('0x0'));var moment=require(_0xd513('0x1'));var BPromise=require(_0xd513('0x2'));var util=require(_0xd513('0x3'));var logger=require(_0xd513('0x4'))(_0xd513('0x5'));var ami=require(_0xd513('0x6'));var io=require('socket.io-emitter')({'host':'localhost','port':0x18eb});function UserReport(_0x4dad65){this['trunks']=_0x4dad65[_0xd513('0x7')];this['agents']=_0x4dad65[_0xd513('0x8')];this[_0xd513('0x9')]=_0x4dad65[_0xd513('0x9')];ami['on'](_0xd513('0xa'),this[_0xd513('0xb')][_0xd513('0xc')](this));ami['on'](_0xd513('0xd'),this[_0xd513('0xb')][_0xd513('0xc')](this));ami['on'](_0xd513('0xe'),this[_0xd513('0xf')]['bind'](this));ami['on'](_0xd513('0x10'),this[_0xd513('0x11')][_0xd513('0xc')](this));this[_0xd513('0x12')]();return BPromise['resolve']()[_0xd513('0x13')](ami['actionSipShowRegistry']())['then'](ami['actionDeviceStateList']())[_0xd513('0x13')](ami[_0xd513('0x14')]())['catch'](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x5d9515){return function(_0x110e17){logger[_0xd513('0x15')](_0x5d9515,util[_0xd513('0x16')](_0x110e17,{'showHidden':![],'depth':null}));};}UserReport['prototype'][_0xd513('0x12')]=function(){setInterval(function(){BPromise[_0xd513('0x17')]()[_0xd513('0x13')](ami['actionSipShowRegistry']())[_0xd513('0x13')](ami[_0xd513('0x18')]())[_0xd513('0x13')](ami['actionSipPeerStatus']())['catch'](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport[_0xd513('0x19')][_0xd513('0x1a')]=function(_0x3d3048){return _0x3d3048!==null&&!_[_0xd513('0x1b')](_0x3d3048);};UserReport[_0xd513('0x19')]['emit']=function(_0x2a8186,_0x2a0b1c,_0x5a54aa){io['to'](_0x2a8186)['emit'](_0x2a0b1c,_0x5a54aa);};UserReport[_0xd513('0x19')][_0xd513('0xb')]=function(_0x2c2a66){try{if(this[_0xd513('0x1a')](_0x2c2a66)){var _0x53aad7=_[_0xd513('0x1c')](this[_0xd513('0x7')],{'registry':_0x2c2a66[_0xd513('0x1d')]});if(_0x53aad7){_0x2c2a66[_0xd513('0x1e')]=_0x2c2a66[_0xd513('0x1f')];_[_0xd513('0x20')](_0x53aad7,_['omit'](_0x2c2a66,[_0xd513('0x21'),'actionid',_0xd513('0x1d'),_0xd513('0x1f')]));this[_0xd513('0x22')](util[_0xd513('0x23')](_0xd513('0x24'),_0x53aad7[_0xd513('0x25')]),_0xd513('0x26'),_0x53aad7);}}}catch(_0x526a32){logger[_0xd513('0x15')](_0xd513('0x27'),util[_0xd513('0x16')](_0x526a32,{'showHidden':![],'depth':null}));}};UserReport[_0xd513('0x19')]['syncDeviceState']=function(_0x1ecd59){try{if(this[_0xd513('0x1a')](_0x1ecd59)){if(this[_0xd513('0x8')][_0x1ecd59[_0xd513('0x28')]]){if(!this['agents'][_0x1ecd59[_0xd513('0x28')]][_0xd513('0x29')]||_0x1ecd59[_0xd513('0x1f')][_0xd513('0x2a')]()==_0xd513('0x2b')){this[_0xd513('0x8')][_0x1ecd59[_0xd513('0x28')]][_0xd513('0x29')]=![];if(this[_0xd513('0x8')][_0x1ecd59['device']][_0xd513('0x1f')]!==_0x1ecd59[_0xd513('0x1f')][_0xd513('0x2a')]()){this['agents'][_0x1ecd59[_0xd513('0x28')]]['stateTime']=_[_0xd513('0x2c')](moment()[_0xd513('0x23')]('x'));}this[_0xd513('0x8')][_0x1ecd59['device']][_0xd513('0x1f')]=_0x1ecd59[_0xd513('0x1f')][_0xd513('0x2a')]();this['agents'][_0x1ecd59[_0xd513('0x28')]]['updateStatusRealtime'](_0x1ecd59);}}else if(this['telephones'][_0x1ecd59[_0xd513('0x28')]]){if(this['telephones'][_0x1ecd59[_0xd513('0x28')]][_0xd513('0x1f')]!==_0x1ecd59[_0xd513('0x1f')][_0xd513('0x2a')]()){this[_0xd513('0x9')][_0x1ecd59[_0xd513('0x28')]][_0xd513('0x2d')]=_[_0xd513('0x2c')](moment()[_0xd513('0x23')]('x'));}this[_0xd513('0x9')][_0x1ecd59['device']]['state']=_0x1ecd59[_0xd513('0x1f')]['toLowerCase']();this[_0xd513('0x22')](util['format'](_0xd513('0x2e'),this[_0xd513('0x9')][_0x1ecd59[_0xd513('0x28')]][_0xd513('0x25')]),_0xd513('0x2f'),this[_0xd513('0x9')][_0x1ecd59[_0xd513('0x28')]]);}else if(this[_0xd513('0x7')][_0x1ecd59[_0xd513('0x28')]]){if(this['trunks'][_0x1ecd59[_0xd513('0x28')]][_0xd513('0x1f')]!==_0x1ecd59['state'][_0xd513('0x2a')]()){this[_0xd513('0x7')][_0x1ecd59[_0xd513('0x28')]][_0xd513('0x2d')]=_['toNumber'](moment()[_0xd513('0x23')]('x'));}this['trunks'][_0x1ecd59[_0xd513('0x28')]]['state']=_0x1ecd59[_0xd513('0x1f')][_0xd513('0x2a')]();this['emit'](util[_0xd513('0x23')](_0xd513('0x24'),this['trunks'][_0x1ecd59[_0xd513('0x28')]][_0xd513('0x25')]),'trunk:save',this[_0xd513('0x7')][_0x1ecd59[_0xd513('0x28')]]);}else if(_['startsWith'](_0x1ecd59[_0xd513('0x28')],_0xd513('0x30'))){}else if(_[_0xd513('0x31')](_0x1ecd59[_0xd513('0x28')],_0xd513('0x32'))){var _0xf57a09=_0x1ecd59[_0xd513('0x28')];var _0x210e4c=_0xf57a09[_0xd513('0x33')](_0xf57a09[_0xd513('0x34')]('/')+0x1,_0xf57a09[_0xd513('0x34')]('@'));var _0x142438=_['find'](this[_0xd513('0x8')],function(_0x623e59){return _0x623e59['mobile']==_0x210e4c||_0x623e59[_0xd513('0x35')]==_0x210e4c||_0x623e59[_0xd513('0x36')]==_0x210e4c;});if(_0x142438){if(_0x142438['state']!==_0x1ecd59[_0xd513('0x1f')][_0xd513('0x2a')]()){_0x142438[_0xd513('0x2d')]=_[_0xd513('0x2c')](moment()[_0xd513('0x23')]('x'));}_0x142438[_0xd513('0x1f')]=_0x1ecd59[_0xd513('0x1f')][_0xd513('0x2a')]();_0x142438[_0xd513('0x29')]=!![];_0x142438['updateStatusRealtime'](_0x1ecd59);}}else{}}}catch(_0x36286f){logger[_0xd513('0x15')](_0xd513('0x37'),util[_0xd513('0x16')](_0x36286f,{'showHidden':![],'depth':null}));}};UserReport[_0xd513('0x19')][_0xd513('0x11')]=function(_0xf7ac90){try{if(this['isNotNull'](_0xf7ac90)&&this['isNotNull'](_0xf7ac90[_0xd513('0x10')])){if(this[_0xd513('0x8')][_0xf7ac90[_0xd513('0x38')]]){if(!this[_0xd513('0x8')][_0xf7ac90[_0xd513('0x38')]]['local']||_0xf7ac90[_0xd513('0x10')][_0xd513('0x2a')]()==_0xd513('0x39')){this['agents'][_0xf7ac90[_0xd513('0x38')]][_0xd513('0x29')]=![];this[_0xd513('0x8')][_0xf7ac90[_0xd513('0x38')]][_0xd513('0x3a')]=_0xf7ac90[_0xd513('0x10')][_0xd513('0x2a')]();this[_0xd513('0x8')][_0xf7ac90['peer']][_0xd513('0x3b')]=_0xf7ac90[_0xd513('0x3b')];this['agents'][_0xf7ac90[_0xd513('0x38')]]['updateStatusRealtime'](_0xf7ac90);}}else if(this[_0xd513('0x9')][_0xf7ac90['peer']]){this['telephones'][_0xf7ac90['peer']]['status']=_0xf7ac90[_0xd513('0x10')]['toLowerCase']();this['telephones'][_0xf7ac90[_0xd513('0x38')]][_0xd513('0x3b')]=_0xf7ac90['address'];this[_0xd513('0x22')](util[_0xd513('0x23')](_0xd513('0x2e'),this['telephones'][_0xf7ac90[_0xd513('0x38')]][_0xd513('0x25')]),_0xd513('0x2f'),this[_0xd513('0x9')][_0xf7ac90[_0xd513('0x38')]]);}else if(this[_0xd513('0x7')][_0xf7ac90[_0xd513('0x38')]]){this[_0xd513('0x7')][_0xf7ac90[_0xd513('0x38')]]['status']=_0xf7ac90[_0xd513('0x10')]['toLowerCase']();this[_0xd513('0x7')][_0xf7ac90[_0xd513('0x38')]][_0xd513('0x3b')]=_0xf7ac90[_0xd513('0x3b')];this['emit'](util[_0xd513('0x23')]('trunk:%s',this[_0xd513('0x7')][_0xf7ac90[_0xd513('0x38')]][_0xd513('0x25')]),'trunk:save',this['trunks'][_0xf7ac90['peer']]);}else{}}}catch(_0x179076){logger[_0xd513('0x15')]('[syncPeerStatus][UserReport]',util[_0xd513('0x16')](_0x179076,{'showHidden':![],'depth':null}));}};module[_0xd513('0x3c')]=UserReport; \ No newline at end of file +var _0xe660=['status','[syncPeerStatus][UserReport]','exports','lodash','bluebird','../ami','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','error','prototype','[loopSyncRealTimeShow]','isNotNull','emit','find','username','stateRegistry','state','merge','omit','event','format','trunk:%s','name','trunk:save','[syncRegistry][UserReport]','inspect','local','toLowerCase','inuse','device','toNumber','updateStatusRealtime','stateTime','telephone:%s','telephone:save','Queue','startsWith','substring','indexOf','mobile','accountcode','[syncDeviceState][UserReport]','peer','registered','address'];(function(_0x547bb6,_0x2d6f27){var _0x1a9154=function(_0x18080f){while(--_0x18080f){_0x547bb6['push'](_0x547bb6['shift']());}};_0x1a9154(++_0x2d6f27);}(_0xe660,0x171));var _0x0e66=function(_0x459a0a,_0x25c46f){_0x459a0a=_0x459a0a-0x0;var _0x4ab46c=_0xe660[_0x459a0a];return _0x4ab46c;};'use strict';var _=require(_0x0e66('0x0'));var moment=require('moment');var BPromise=require(_0x0e66('0x1'));var util=require('util');var logger=require('../../../config/logger')('ami');var ami=require(_0x0e66('0x2'));var io=require(_0x0e66('0x3'))({'host':'localhost','port':0x18eb});function UserReport(_0x587a06){this['trunks']=_0x587a06[_0x0e66('0x4')];this[_0x0e66('0x5')]=_0x587a06[_0x0e66('0x5')];this[_0x0e66('0x6')]=_0x587a06[_0x0e66('0x6')];ami['on'](_0x0e66('0x7'),this[_0x0e66('0x8')][_0x0e66('0x9')](this));ami['on'](_0x0e66('0xa'),this['syncRegistry'][_0x0e66('0x9')](this));ami['on'](_0x0e66('0xb'),this[_0x0e66('0xc')][_0x0e66('0x9')](this));ami['on'](_0x0e66('0xd'),this[_0x0e66('0xe')]['bind'](this));this[_0x0e66('0xf')]();return BPromise[_0x0e66('0x10')]()[_0x0e66('0x11')](ami[_0x0e66('0x12')]())[_0x0e66('0x11')](ami[_0x0e66('0x13')]())[_0x0e66('0x11')](ami['actionSipPeerStatus']())[_0x0e66('0x14')](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x452693){return function(_0x350b00){logger[_0x0e66('0x15')](_0x452693,util['inspect'](_0x350b00,{'showHidden':![],'depth':null}));};}UserReport[_0x0e66('0x16')][_0x0e66('0xf')]=function(){setInterval(function(){BPromise['resolve']()[_0x0e66('0x11')](ami[_0x0e66('0x12')]())[_0x0e66('0x11')](ami['actionDeviceStateList']())[_0x0e66('0x11')](ami['actionSipPeerStatus']())[_0x0e66('0x14')](loggerCatch(_0x0e66('0x17')));},0x32c8);};UserReport[_0x0e66('0x16')][_0x0e66('0x18')]=function(_0x500252){return _0x500252!==null&&!_['isUndefined'](_0x500252);};UserReport[_0x0e66('0x16')][_0x0e66('0x19')]=function(_0x2e8daa,_0x442544,_0x87299e){io['to'](_0x2e8daa)[_0x0e66('0x19')](_0x442544,_0x87299e);};UserReport[_0x0e66('0x16')][_0x0e66('0x8')]=function(_0x163e97){try{if(this[_0x0e66('0x18')](_0x163e97)){var _0x21b939=_[_0x0e66('0x1a')](this[_0x0e66('0x4')],{'registry':_0x163e97[_0x0e66('0x1b')]});if(_0x21b939){_0x163e97[_0x0e66('0x1c')]=_0x163e97[_0x0e66('0x1d')];_[_0x0e66('0x1e')](_0x21b939,_[_0x0e66('0x1f')](_0x163e97,[_0x0e66('0x20'),'actionid',_0x0e66('0x1b'),_0x0e66('0x1d')]));this[_0x0e66('0x19')](util[_0x0e66('0x21')](_0x0e66('0x22'),_0x21b939[_0x0e66('0x23')]),_0x0e66('0x24'),_0x21b939);}}}catch(_0x38cd2d){logger[_0x0e66('0x15')](_0x0e66('0x25'),util[_0x0e66('0x26')](_0x38cd2d,{'showHidden':![],'depth':null}));}};UserReport[_0x0e66('0x16')][_0x0e66('0xc')]=function(_0x37d510){try{if(this['isNotNull'](_0x37d510)){if(this[_0x0e66('0x5')][_0x37d510['device']]){if(!this[_0x0e66('0x5')][_0x37d510['device']][_0x0e66('0x27')]||_0x37d510[_0x0e66('0x1d')][_0x0e66('0x28')]()==_0x0e66('0x29')){this[_0x0e66('0x5')][_0x37d510[_0x0e66('0x2a')]][_0x0e66('0x27')]=![];if(this[_0x0e66('0x5')][_0x37d510[_0x0e66('0x2a')]][_0x0e66('0x1d')]!==_0x37d510[_0x0e66('0x1d')]['toLowerCase']()){this[_0x0e66('0x5')][_0x37d510[_0x0e66('0x2a')]]['stateTime']=_[_0x0e66('0x2b')](moment()[_0x0e66('0x21')]('x'));}this[_0x0e66('0x5')][_0x37d510['device']][_0x0e66('0x1d')]=_0x37d510['state']['toLowerCase']();this[_0x0e66('0x5')][_0x37d510['device']][_0x0e66('0x2c')](_0x37d510);}}else if(this[_0x0e66('0x6')][_0x37d510[_0x0e66('0x2a')]]){if(this[_0x0e66('0x6')][_0x37d510[_0x0e66('0x2a')]]['state']!==_0x37d510['state'][_0x0e66('0x28')]()){this[_0x0e66('0x6')][_0x37d510['device']][_0x0e66('0x2d')]=_[_0x0e66('0x2b')](moment()[_0x0e66('0x21')]('x'));}this['telephones'][_0x37d510[_0x0e66('0x2a')]][_0x0e66('0x1d')]=_0x37d510[_0x0e66('0x1d')][_0x0e66('0x28')]();this[_0x0e66('0x19')](util[_0x0e66('0x21')](_0x0e66('0x2e'),this['telephones'][_0x37d510[_0x0e66('0x2a')]][_0x0e66('0x23')]),_0x0e66('0x2f'),this[_0x0e66('0x6')][_0x37d510[_0x0e66('0x2a')]]);}else if(this['trunks'][_0x37d510[_0x0e66('0x2a')]]){if(this['trunks'][_0x37d510['device']][_0x0e66('0x1d')]!==_0x37d510['state']['toLowerCase']()){this[_0x0e66('0x4')][_0x37d510['device']]['stateTime']=_[_0x0e66('0x2b')](moment()[_0x0e66('0x21')]('x'));}this[_0x0e66('0x4')][_0x37d510[_0x0e66('0x2a')]]['state']=_0x37d510[_0x0e66('0x1d')][_0x0e66('0x28')]();this['emit'](util[_0x0e66('0x21')]('trunk:%s',this[_0x0e66('0x4')][_0x37d510['device']]['name']),_0x0e66('0x24'),this[_0x0e66('0x4')][_0x37d510[_0x0e66('0x2a')]]);}else if(_['startsWith'](_0x37d510[_0x0e66('0x2a')],_0x0e66('0x30'))){}else if(_[_0x0e66('0x31')](_0x37d510[_0x0e66('0x2a')],'Local')){var _0x1707a2=_0x37d510[_0x0e66('0x2a')];var _0xddb393=_0x1707a2[_0x0e66('0x32')](_0x1707a2[_0x0e66('0x33')]('/')+0x1,_0x1707a2[_0x0e66('0x33')]('@'));var _0xae29d6=_[_0x0e66('0x1a')](this[_0x0e66('0x5')],function(_0x2cf09e){return _0x2cf09e[_0x0e66('0x34')]==_0xddb393||_0x2cf09e['phone']==_0xddb393||_0x2cf09e[_0x0e66('0x35')]==_0xddb393;});if(_0xae29d6){if(_0xae29d6[_0x0e66('0x1d')]!==_0x37d510['state'][_0x0e66('0x28')]()){_0xae29d6[_0x0e66('0x2d')]=_['toNumber'](moment()[_0x0e66('0x21')]('x'));}_0xae29d6[_0x0e66('0x1d')]=_0x37d510[_0x0e66('0x1d')][_0x0e66('0x28')]();_0xae29d6['local']=!![];_0xae29d6[_0x0e66('0x2c')](_0x37d510);}}else{}}}catch(_0x2b4d72){logger['error'](_0x0e66('0x36'),util[_0x0e66('0x26')](_0x2b4d72,{'showHidden':![],'depth':null}));}};UserReport[_0x0e66('0x16')][_0x0e66('0xe')]=function(_0x24d57f){try{if(this[_0x0e66('0x18')](_0x24d57f)&&this[_0x0e66('0x18')](_0x24d57f[_0x0e66('0xd')])){if(this[_0x0e66('0x5')][_0x24d57f['peer']]){if(!this[_0x0e66('0x5')][_0x24d57f[_0x0e66('0x37')]][_0x0e66('0x27')]||_0x24d57f['peerstatus'][_0x0e66('0x28')]()==_0x0e66('0x38')){this['agents'][_0x24d57f['peer']]['local']=![];this[_0x0e66('0x5')][_0x24d57f[_0x0e66('0x37')]]['status']=_0x24d57f[_0x0e66('0xd')]['toLowerCase']();this[_0x0e66('0x5')][_0x24d57f[_0x0e66('0x37')]]['address']=_0x24d57f[_0x0e66('0x39')];this[_0x0e66('0x5')][_0x24d57f[_0x0e66('0x37')]][_0x0e66('0x2c')](_0x24d57f);}}else if(this['telephones'][_0x24d57f['peer']]){this[_0x0e66('0x6')][_0x24d57f[_0x0e66('0x37')]][_0x0e66('0x3a')]=_0x24d57f[_0x0e66('0xd')][_0x0e66('0x28')]();this['telephones'][_0x24d57f[_0x0e66('0x37')]][_0x0e66('0x39')]=_0x24d57f['address'];this[_0x0e66('0x19')](util[_0x0e66('0x21')](_0x0e66('0x2e'),this[_0x0e66('0x6')][_0x24d57f[_0x0e66('0x37')]][_0x0e66('0x23')]),_0x0e66('0x2f'),this['telephones'][_0x24d57f[_0x0e66('0x37')]]);}else if(this[_0x0e66('0x4')][_0x24d57f[_0x0e66('0x37')]]){this[_0x0e66('0x4')][_0x24d57f[_0x0e66('0x37')]]['status']=_0x24d57f[_0x0e66('0xd')][_0x0e66('0x28')]();this[_0x0e66('0x4')][_0x24d57f[_0x0e66('0x37')]][_0x0e66('0x39')]=_0x24d57f[_0x0e66('0x39')];this[_0x0e66('0x19')](util[_0x0e66('0x21')]('trunk:%s',this[_0x0e66('0x4')][_0x24d57f['peer']][_0x0e66('0x23')]),_0x0e66('0x24'),this[_0x0e66('0x4')][_0x24d57f[_0x0e66('0x37')]]);}else{}}}catch(_0x360640){logger[_0x0e66('0x15')](_0x0e66('0x3b'),util['inspect'](_0x360640,{'showHidden':![],'depth':null}));}};module[_0x0e66('0x3c')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index e5c110f..d8649ff 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 _0x6544=['hasOwnProperty','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','destconnectedlinenum','user:agentconnect','custom:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheremembername','membername','custom:agentansweredelsewhere','inspect','syncAgentRingNoAnswer','rejected','custom:agentringnoanswer','abandoned','[syncQueueCallerAbandon][VoiceAgentReport]','talktime','acw','agentacw','acwtime','acwTimeout','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','includes','values','[syncHangup][VoiceAgentReport]','[syncMusicOnHoldStart][VoiceAgentReport]','syncMusicOnHoldStop','[syncMusicOnHoldStop][VoiceAgentReport]','exports','moment','util','../../../config/logger','ami','../ami','socket.io-emitter','localhost','channels','voiceQueues','agents','variables','bind','agentconnect','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','prototype','isNotNull','isUndefined','syncAgentCalled','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','inbound','merge','omit','privilege','emit','custom:agentcalled','user:%s','user:called','error','[syncAgentCalled][VoiceAgentReport]'];(function(_0x4cbe3f,_0x588d7c){var _0x30eff4=function(_0x1abfb4){while(--_0x1abfb4){_0x4cbe3f['push'](_0x4cbe3f['shift']());}};_0x30eff4(++_0x588d7c);}(_0x6544,0xa1));var _0x4654=function(_0x1e06c4,_0x38a792){_0x1e06c4=_0x1e06c4-0x0;var _0x529a41=_0x6544[_0x1e06c4];return _0x529a41;};'use strict';var _=require('lodash');var moment=require(_0x4654('0x0'));var util=require(_0x4654('0x1'));var logger=require(_0x4654('0x2'))(_0x4654('0x3'));var ami=require(_0x4654('0x4'));var io=require(_0x4654('0x5'))({'host':_0x4654('0x6'),'port':0x18eb});function VoiceAgentReport(_0x16fb18){this[_0x4654('0x7')]={};this[_0x4654('0x8')]=_0x16fb18[_0x4654('0x8')];this['agents']=_0x16fb18[_0x4654('0x9')];this[_0x4654('0xa')]={};ami['on']('agentcalled',this['syncAgentCalled'][_0x4654('0xb')](this));ami['on'](_0x4654('0xc'),this['syncAgentConnect']['bind'](this));ami['on'](_0x4654('0xd'),this['syncAgentRingNoAnswer'][_0x4654('0xb')](this));ami['on'](_0x4654('0xe'),this[_0x4654('0xf')]['bind'](this));ami['on'](_0x4654('0x10'),this[_0x4654('0x11')][_0x4654('0xb')](this));ami['on']('varset',this[_0x4654('0x12')]['bind'](this));ami['on'](_0x4654('0x13'),this[_0x4654('0x14')]['bind'](this));ami['on'](_0x4654('0x15'),this[_0x4654('0x16')][_0x4654('0xb')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop']['bind'](this));}VoiceAgentReport[_0x4654('0x17')]['emit']=function(_0x3bb62f,_0x268857,_0x53c624){io['to'](_0x3bb62f)['emit'](_0x268857,_0x53c624);};VoiceAgentReport[_0x4654('0x17')][_0x4654('0x18')]=function(_0x1682ed){return _0x1682ed!==null&&!_[_0x4654('0x19')](_0x1682ed);};VoiceAgentReport[_0x4654('0x17')][_0x4654('0x1a')]=function(_0x33eeaf){try{if(this['isNotNull'](_0x33eeaf)){if(_['isUndefined'](this[_0x4654('0x7')][_0x33eeaf['uniqueid']])){this[_0x4654('0x7')][_0x33eeaf[_0x4654('0x1b')]]={};}if(_[_0x4654('0x19')](this[_0x4654('0x7')][_0x33eeaf['uniqueid']][_0x33eeaf[_0x4654('0x1c')]])){this[_0x4654('0x7')][_0x33eeaf[_0x4654('0x1b')]][_0x33eeaf['destuniqueid']]={'agentcalledAt':moment()[_0x4654('0x1d')](_0x4654('0x1e')),'lastevent':_0x4654('0x1f'),'variables':this[_0x4654('0xa')][_0x33eeaf[_0x4654('0x1b')]],'type':this['voiceQueues'][_0x33eeaf[_0x4654('0x20')]]?this['voiceQueues'][_0x33eeaf[_0x4654('0x20')]]['type']||_0x4654('0x21'):'inbound'};}_[_0x4654('0x22')](this[_0x4654('0x7')][_0x33eeaf[_0x4654('0x1b')]][_0x33eeaf['destuniqueid']],_[_0x4654('0x23')](_0x33eeaf,['event',_0x4654('0x24')]));ami[_0x4654('0x25')](_0x4654('0x26'),this['channels'][_0x33eeaf[_0x4654('0x1b')]][_0x33eeaf[_0x4654('0x1c')]]);this[_0x4654('0x25')](util[_0x4654('0x1d')](_0x4654('0x27'),_0x33eeaf['membername']),_0x4654('0x28'),this[_0x4654('0x7')][_0x33eeaf[_0x4654('0x1b')]][_0x33eeaf[_0x4654('0x1c')]]);}}catch(_0x29ec67){logger[_0x4654('0x29')](_0x4654('0x2a'),util['inspect'](_0x29ec67,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4654('0x17')]['syncAgentConnect']=function(_0x697f){try{if(this['isNotNull'](_0x697f)){if(this['channels'][_0x697f['uniqueid']]){for(var _0x427d2b in this[_0x4654('0x7')][_0x697f[_0x4654('0x1b')]]){if(this[_0x4654('0x7')][_0x697f[_0x4654('0x1b')]][_0x4654('0x2b')](_0x427d2b)){if(_0x697f[_0x4654('0x1c')]===_0x427d2b){this[_0x4654('0x7')][_0x697f['uniqueid']][_0x427d2b]['agentconnectAt']=moment()[_0x4654('0x1d')](_0x4654('0x1e'));this[_0x4654('0x7')][_0x697f[_0x4654('0x1b')]][_0x427d2b][_0x4654('0x2c')]=_0x4654('0x2d');this[_0x4654('0x7')][_0x697f['uniqueid']][_0x427d2b][_0x4654('0x2e')]=_0x697f['holdtime'];this[_0x4654('0x7')][_0x697f['uniqueid']][_0x427d2b][_0x4654('0x2f')]=_0x697f[_0x4654('0x2f')];this[_0x4654('0x7')][_0x697f[_0x4654('0x1b')]][_0x427d2b][_0x4654('0x30')]=_0x697f[_0x4654('0x30')];this[_0x4654('0x7')][_0x697f[_0x4654('0x1b')]][_0x427d2b]['destchannelstate']=_0x697f[_0x4654('0x31')];this[_0x4654('0x7')][_0x697f[_0x4654('0x1b')]][_0x427d2b][_0x4654('0x32')]=_0x697f[_0x4654('0x32')];_[_0x4654('0x22')](this['agents'][_0x697f[_0x4654('0x33')]],_[_0x4654('0x34')](_0x697f,['queue',_0x4654('0x35')]));this['emit'](util[_0x4654('0x1d')](_0x4654('0x27'),_0x697f['membername']),_0x4654('0x36'),this[_0x4654('0x7')][_0x697f['uniqueid']][_0x697f[_0x4654('0x1c')]]);ami[_0x4654('0x25')](_0x4654('0x37'),this['channels'][_0x697f['uniqueid']][_0x427d2b]);}else if(this[_0x4654('0x18')](this[_0x4654('0x7')][_0x697f[_0x4654('0x1b')]][_0x427d2b][_0x4654('0xd')])){this['channels'][_0x697f[_0x4654('0x1b')]][_0x427d2b][_0x4654('0xd')]=!![];this[_0x4654('0x7')][_0x697f['uniqueid']][_0x427d2b][_0x4654('0x38')]=moment()[_0x4654('0x1d')](_0x4654('0x1e'));this[_0x4654('0x7')][_0x697f[_0x4654('0x1b')]][_0x427d2b][_0x4654('0x39')]=_0x4654('0x3a');this[_0x4654('0x7')][_0x697f[_0x4654('0x1b')]][_0x427d2b]['lastevent']=_0x4654('0x3a');this[_0x4654('0x7')][_0x697f[_0x4654('0x1b')]][_0x427d2b]['answeredelsewheredestinationuniqueid']=_0x697f[_0x4654('0x1c')];this[_0x4654('0x7')][_0x697f[_0x4654('0x1b')]][_0x427d2b][_0x4654('0x3b')]=_0x697f[_0x4654('0x3c')];ami[_0x4654('0x25')](_0x4654('0x3d'),this[_0x4654('0x7')][_0x697f[_0x4654('0x1b')]][_0x427d2b]);}}}}}}catch(_0x48bc4c){logger['error']('[syncAgentConnect][VoiceAgentReport]',util[_0x4654('0x3e')](_0x48bc4c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4654('0x17')][_0x4654('0x3f')]=function(_0x2cd5ab){try{if(this[_0x4654('0x18')](_0x2cd5ab)){if(this[_0x4654('0x7')][_0x2cd5ab[_0x4654('0x1b')]]&&this['channels'][_0x2cd5ab[_0x4654('0x1b')]][_0x2cd5ab[_0x4654('0x1c')]]&&_[_0x4654('0x19')](this[_0x4654('0x7')][_0x2cd5ab[_0x4654('0x1b')]][_0x2cd5ab['destuniqueid']][_0x4654('0xd')])){this['channels'][_0x2cd5ab[_0x4654('0x1b')]][_0x2cd5ab[_0x4654('0x1c')]][_0x4654('0xd')]=!![];this[_0x4654('0x7')][_0x2cd5ab[_0x4654('0x1b')]][_0x2cd5ab[_0x4654('0x1c')]][_0x4654('0x38')]=moment()['format'](_0x4654('0x1e'));this['channels'][_0x2cd5ab['uniqueid']][_0x2cd5ab[_0x4654('0x1c')]][_0x4654('0x39')]=_0x4654('0x40');this[_0x4654('0x7')][_0x2cd5ab['uniqueid']][_0x2cd5ab[_0x4654('0x1c')]]['lastevent']='rejected';ami['emit'](_0x4654('0x41'),this['channels'][_0x2cd5ab[_0x4654('0x1b')]][_0x2cd5ab[_0x4654('0x1c')]]);}}}catch(_0x19d9cf){logger[_0x4654('0x29')]('[syncAgentRingNoAnswer][VoiceAgentReport]',util[_0x4654('0x3e')](_0x19d9cf,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4654('0x17')][_0x4654('0xf')]=function(_0x11f5a1){try{if(this[_0x4654('0x18')](_0x11f5a1)){if(this[_0x4654('0x7')][_0x11f5a1[_0x4654('0x1b')]]){for(var _0x363b4f in this[_0x4654('0x7')][_0x11f5a1['uniqueid']]){if(this['channels'][_0x11f5a1['uniqueid']]['hasOwnProperty'](_0x363b4f)&&_[_0x4654('0x19')](this[_0x4654('0x7')][_0x11f5a1['uniqueid']][_0x363b4f][_0x4654('0xd')])){this[_0x4654('0x7')][_0x11f5a1[_0x4654('0x1b')]][_0x363b4f][_0x4654('0xd')]=!![];this['channels'][_0x11f5a1[_0x4654('0x1b')]][_0x363b4f]['agentringnoanswerAt']=moment()[_0x4654('0x1d')](_0x4654('0x1e'));this[_0x4654('0x7')][_0x11f5a1[_0x4654('0x1b')]][_0x363b4f][_0x4654('0x39')]=_0x4654('0x42');this[_0x4654('0x7')][_0x11f5a1['uniqueid']][_0x363b4f][_0x4654('0x2c')]=_0x4654('0x42');ami[_0x4654('0x25')]('custom:agentqueuecallerabandon',this[_0x4654('0x7')][_0x11f5a1['uniqueid']][_0x363b4f]);}}}}}catch(_0x501cac){logger[_0x4654('0x29')](_0x4654('0x43'),util[_0x4654('0x3e')](_0x501cac,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x4654('0x11')]=function(_0x1949e4){try{if(this[_0x4654('0x18')](_0x1949e4)){if(this['channels'][_0x1949e4['uniqueid']]&&this['channels'][_0x1949e4[_0x4654('0x1b')]][_0x1949e4[_0x4654('0x1c')]]&&_['isUndefined'](this[_0x4654('0x7')][_0x1949e4[_0x4654('0x1b')]][_0x1949e4['destuniqueid']][_0x4654('0x10')])){this[_0x4654('0x7')][_0x1949e4[_0x4654('0x1b')]][_0x1949e4[_0x4654('0x1c')]][_0x4654('0x10')]=!![];this['channels'][_0x1949e4['uniqueid']][_0x1949e4[_0x4654('0x1c')]]['agentcompleteAt']=moment()['format'](_0x4654('0x1e'));this[_0x4654('0x7')][_0x1949e4[_0x4654('0x1b')]][_0x1949e4[_0x4654('0x1c')]]['lastevent']='complete';this[_0x4654('0x7')][_0x1949e4[_0x4654('0x1b')]][_0x1949e4['destuniqueid']][_0x4654('0x44')]=_0x1949e4[_0x4654('0x44')];this[_0x4654('0x7')][_0x1949e4['uniqueid']][_0x1949e4[_0x4654('0x1c')]][_0x4654('0x39')]=_0x1949e4[_0x4654('0x39')];if(this['voiceQueues'][_0x1949e4[_0x4654('0x20')]]&&this[_0x4654('0x8')][_0x1949e4[_0x4654('0x20')]][_0x4654('0x45')]){this['channels'][_0x1949e4[_0x4654('0x1b')]][_0x1949e4['destuniqueid']][_0x4654('0x46')]=!![];this[_0x4654('0x7')][_0x1949e4[_0x4654('0x1b')]][_0x1949e4[_0x4654('0x1c')]][_0x4654('0x47')]=this[_0x4654('0x8')][_0x1949e4[_0x4654('0x20')]][_0x4654('0x48')];}this['agents'][_0x1949e4['interface']]=_[_0x4654('0x23')](this[_0x4654('0x9')][_0x1949e4['interface']],[_0x4654('0x20'),_0x4654('0x35')]);this['emit'](util[_0x4654('0x1d')]('user:%s',_0x1949e4[_0x4654('0x3c')]),_0x4654('0x49'),this['channels'][_0x1949e4[_0x4654('0x1b')]][_0x1949e4['destuniqueid']]);ami[_0x4654('0x25')](_0x4654('0x4a'),this[_0x4654('0x7')][_0x1949e4[_0x4654('0x1b')]][_0x1949e4[_0x4654('0x1c')]]);}}}catch(_0x15df40){logger['error'](_0x4654('0x4b'),util[_0x4654('0x3e')](_0x15df40,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x4654('0x12')]=function(_0x1b5a5d){try{if(this['isNotNull'](_0x1b5a5d)){this['addVariable'](_0x1b5a5d[_0x4654('0x1b')],_[_0x4654('0x4c')](_0x1b5a5d[_0x4654('0x4d')])[0x0],_0x1b5a5d[_0x4654('0x4e')]);if(this[_0x4654('0x7')][_0x1b5a5d[_0x4654('0x1b')]]){for(var _0x4e667b in this['channels'][_0x1b5a5d['uniqueid']]){if(this[_0x4654('0x7')][_0x1b5a5d['uniqueid']][_0x4654('0x2b')](_0x4e667b)){if(_[_0x4654('0x19')](this[_0x4654('0x7')][_0x1b5a5d[_0x4654('0x1b')]][_0x4e667b][_0x4654('0xa')])){this[_0x4654('0x7')][_0x1b5a5d[_0x4654('0x1b')]][_0x4e667b]['variables']={};}this[_0x4654('0x7')][_0x1b5a5d['uniqueid']][_0x4e667b][_0x4654('0xa')]=this[_0x4654('0xa')][_0x1b5a5d['uniqueid']];}}}}}catch(_0x550114){logger['error'](_0x4654('0x4f'),util[_0x4654('0x3e')](_0x550114,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['addVariable']=function(_0x11603f,_0x4eca80,_0x1f2437){var _0x5b5004=[_0x4654('0x50'),_0x4654('0x51'),_0x4654('0x52'),_0x4654('0x53'),_0x4654('0x54'),_0x4654('0x55'),_0x4654('0x56'),_0x4654('0x57'),'sipcallid','sipuri','bridgepeer',_0x4654('0x58'),_0x4654('0x59'),_0x4654('0x5a'),_0x4654('0x5b'),_0x4654('0x5c'),_0x4654('0x3c'),_0x4654('0x5d'),'memberrealtime'];if(!_[_0x4654('0x5e')](_0x4eca80)&&!_[_0x4654('0x5f')](_0x5b5004,_0x4eca80)){if(_[_0x4654('0x19')](this[_0x4654('0xa')][_0x11603f])){this[_0x4654('0xa')][_0x11603f]={};}this[_0x4654('0xa')][_0x11603f][_0x4eca80]=_0x1f2437;}};VoiceAgentReport['prototype'][_0x4654('0x14')]=function(_0x121fb4){try{if(this[_0x4654('0x18')](_0x121fb4)){if(this[_0x4654('0x7')][_0x121fb4[_0x4654('0x1b')]]){ami[_0x4654('0x25')]('custom:voiceAgentReport',_[_0x4654('0x60')](this[_0x4654('0x7')][_0x121fb4[_0x4654('0x1b')]]));delete this[_0x4654('0x7')][_0x121fb4[_0x4654('0x1b')]];}if(this['variables'][_0x121fb4[_0x4654('0x1b')]]){delete this['variables'][_0x121fb4[_0x4654('0x1b')]];}}}catch(_0x10aa78){logger['error'](_0x4654('0x61'),util[_0x4654('0x3e')](_0x10aa78,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4654('0x17')]['syncMusicOnHoldStart']=function(_0x5a5e6f){try{if(this[_0x4654('0x18')](_0x5a5e6f)){if(this[_0x4654('0x7')][_0x5a5e6f[_0x4654('0x1b')]]){}}}catch(_0x179e58){logger[_0x4654('0x29')](_0x4654('0x62'),util[_0x4654('0x3e')](_0x179e58,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4654('0x17')][_0x4654('0x63')]=function(_0x3f70db){try{if(this[_0x4654('0x18')](_0x3f70db)){if(this['channels'][_0x3f70db[_0x4654('0x1b')]]){}}}catch(_0x33f902){logger[_0x4654('0x29')](_0x4654('0x64'),util[_0x4654('0x3e')](_0x33f902,{'showHidden':![],'depth':null}));}};module[_0x4654('0x65')]=VoiceAgentReport; \ No newline at end of file +var _0x8531=['rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberpenalty','includes','custom:voiceAgentReport','values','[syncMusicOnHoldStart][VoiceAgentReport]','syncMusicOnHoldStop','exports','lodash','moment','util','../../../config/logger','../ami','socket.io-emitter','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','prototype','emit','isUndefined','isNotNull','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','inbound','omit','event','privilege','custom:agentcalled','user:%s','membername','error','[syncAgentCalled][VoiceAgentReport]','inspect','hasOwnProperty','agentconnectAt','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','merge','pick','destconnectedlinenum','user:agentconnect','custom:agentconnect','reason','answered_elsewhere','[syncAgentConnect][VoiceAgentReport]','rejected','custom:agentringnoanswer','abandoned','agentcompleteAt','complete','talktime','agentacw','acwtime','acwTimeout','interface','user:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x8531,0x70));var _0x1853=function(_0x3feab5,_0x1849cb){_0x3feab5=_0x3feab5-0x0;var _0x4fb9e9=_0x8531[_0x3feab5];return _0x4fb9e9;};'use strict';var _=require(_0x1853('0x0'));var moment=require(_0x1853('0x1'));var util=require(_0x1853('0x2'));var logger=require(_0x1853('0x3'))('ami');var ami=require(_0x1853('0x4'));var io=require(_0x1853('0x5'))({'host':_0x1853('0x6'),'port':0x18eb});function VoiceAgentReport(_0x15db46){this[_0x1853('0x7')]={};this[_0x1853('0x8')]=_0x15db46['voiceQueues'];this[_0x1853('0x9')]=_0x15db46[_0x1853('0x9')];this[_0x1853('0xa')]={};ami['on'](_0x1853('0xb'),this[_0x1853('0xc')][_0x1853('0xd')](this));ami['on']('agentconnect',this[_0x1853('0xe')][_0x1853('0xd')](this));ami['on'](_0x1853('0xf'),this[_0x1853('0x10')][_0x1853('0xd')](this));ami['on'](_0x1853('0x11'),this[_0x1853('0x12')][_0x1853('0xd')](this));ami['on'](_0x1853('0x13'),this['syncAgentComplete'][_0x1853('0xd')](this));ami['on']('varset',this[_0x1853('0x14')][_0x1853('0xd')](this));ami['on'](_0x1853('0x15'),this[_0x1853('0x16')][_0x1853('0xd')](this));ami['on'](_0x1853('0x17'),this[_0x1853('0x18')][_0x1853('0xd')](this));ami['on'](_0x1853('0x19'),this['syncMusicOnHoldStop']['bind'](this));}VoiceAgentReport[_0x1853('0x1a')]['emit']=function(_0x328671,_0xd3d253,_0x266420){io['to'](_0x328671)[_0x1853('0x1b')](_0xd3d253,_0x266420);};VoiceAgentReport[_0x1853('0x1a')]['isNotNull']=function(_0x167141){return _0x167141!==null&&!_[_0x1853('0x1c')](_0x167141);};VoiceAgentReport[_0x1853('0x1a')][_0x1853('0xc')]=function(_0x5c8649){try{if(this[_0x1853('0x1d')](_0x5c8649)){if(_['isUndefined'](this[_0x1853('0x7')][_0x5c8649[_0x1853('0x1e')]])){this['channels'][_0x5c8649['uniqueid']]={};}if(_['isUndefined'](this[_0x1853('0x7')][_0x5c8649[_0x1853('0x1e')]][_0x5c8649[_0x1853('0x1f')]])){this[_0x1853('0x7')][_0x5c8649[_0x1853('0x1e')]][_0x5c8649['destuniqueid']]={'agentcalledAt':moment()[_0x1853('0x20')](_0x1853('0x21')),'lastevent':_0x1853('0x22'),'variables':this[_0x1853('0xa')][_0x5c8649[_0x1853('0x1e')]],'type':this[_0x1853('0x8')][_0x5c8649[_0x1853('0x23')]]?this[_0x1853('0x8')][_0x5c8649['queue']]['type']||_0x1853('0x24'):'inbound'};}_['merge'](this[_0x1853('0x7')][_0x5c8649[_0x1853('0x1e')]][_0x5c8649['destuniqueid']],_[_0x1853('0x25')](_0x5c8649,[_0x1853('0x26'),_0x1853('0x27')]));ami[_0x1853('0x1b')](_0x1853('0x28'),this[_0x1853('0x7')][_0x5c8649['uniqueid']][_0x5c8649[_0x1853('0x1f')]]);this[_0x1853('0x1b')](util[_0x1853('0x20')](_0x1853('0x29'),_0x5c8649[_0x1853('0x2a')]),'user:called',this[_0x1853('0x7')][_0x5c8649[_0x1853('0x1e')]][_0x5c8649[_0x1853('0x1f')]]);}}catch(_0x511e77){logger[_0x1853('0x2b')](_0x1853('0x2c'),util[_0x1853('0x2d')](_0x511e77,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1853('0x1a')][_0x1853('0xe')]=function(_0x45d3ec){try{if(this[_0x1853('0x1d')](_0x45d3ec)){if(this['channels'][_0x45d3ec[_0x1853('0x1e')]]){for(var _0x4adbe2 in this[_0x1853('0x7')][_0x45d3ec[_0x1853('0x1e')]]){if(this[_0x1853('0x7')][_0x45d3ec['uniqueid']][_0x1853('0x2e')](_0x4adbe2)){if(_0x45d3ec['destuniqueid']===_0x4adbe2){this['channels'][_0x45d3ec[_0x1853('0x1e')]][_0x4adbe2][_0x1853('0x2f')]=moment()['format'](_0x1853('0x21'));this[_0x1853('0x7')][_0x45d3ec[_0x1853('0x1e')]][_0x4adbe2][_0x1853('0x30')]=_0x1853('0x31');this[_0x1853('0x7')][_0x45d3ec[_0x1853('0x1e')]][_0x4adbe2][_0x1853('0x32')]=_0x45d3ec[_0x1853('0x32')];this[_0x1853('0x7')][_0x45d3ec[_0x1853('0x1e')]][_0x4adbe2]['connectedlinenum']=_0x45d3ec[_0x1853('0x33')];this[_0x1853('0x7')][_0x45d3ec[_0x1853('0x1e')]][_0x4adbe2][_0x1853('0x34')]=_0x45d3ec['connectedlinename'];this[_0x1853('0x7')][_0x45d3ec[_0x1853('0x1e')]][_0x4adbe2]['destchannelstate']=_0x45d3ec[_0x1853('0x35')];this[_0x1853('0x7')][_0x45d3ec[_0x1853('0x1e')]][_0x4adbe2]['destchannelstatedesc']=_0x45d3ec[_0x1853('0x36')];_[_0x1853('0x37')](this[_0x1853('0x9')][_0x45d3ec['interface']],_[_0x1853('0x38')](_0x45d3ec,[_0x1853('0x23'),_0x1853('0x39')]));this[_0x1853('0x1b')](util[_0x1853('0x20')](_0x1853('0x29'),_0x45d3ec['membername']),_0x1853('0x3a'),this[_0x1853('0x7')][_0x45d3ec['uniqueid']][_0x45d3ec['destuniqueid']]);ami[_0x1853('0x1b')](_0x1853('0x3b'),this[_0x1853('0x7')][_0x45d3ec[_0x1853('0x1e')]][_0x4adbe2]);}else if(this[_0x1853('0x1d')](this['channels'][_0x45d3ec[_0x1853('0x1e')]][_0x4adbe2]['agentringnoanswer'])){this[_0x1853('0x7')][_0x45d3ec[_0x1853('0x1e')]][_0x4adbe2][_0x1853('0xf')]=!![];this[_0x1853('0x7')][_0x45d3ec[_0x1853('0x1e')]][_0x4adbe2]['agentringnoanswerAt']=moment()[_0x1853('0x20')](_0x1853('0x21'));this['channels'][_0x45d3ec['uniqueid']][_0x4adbe2][_0x1853('0x3c')]='answered_elsewhere';this[_0x1853('0x7')][_0x45d3ec[_0x1853('0x1e')]][_0x4adbe2][_0x1853('0x30')]=_0x1853('0x3d');this['channels'][_0x45d3ec[_0x1853('0x1e')]][_0x4adbe2]['answeredelsewheredestinationuniqueid']=_0x45d3ec['destuniqueid'];this[_0x1853('0x7')][_0x45d3ec[_0x1853('0x1e')]][_0x4adbe2]['answeredelsewheremembername']=_0x45d3ec['membername'];ami[_0x1853('0x1b')]('custom:agentansweredelsewhere',this[_0x1853('0x7')][_0x45d3ec[_0x1853('0x1e')]][_0x4adbe2]);}}}}}}catch(_0x3357b9){logger['error'](_0x1853('0x3e'),util['inspect'](_0x3357b9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1853('0x1a')][_0x1853('0x10')]=function(_0x4c93b4){try{if(this['isNotNull'](_0x4c93b4)){if(this[_0x1853('0x7')][_0x4c93b4[_0x1853('0x1e')]]&&this['channels'][_0x4c93b4[_0x1853('0x1e')]][_0x4c93b4['destuniqueid']]&&_[_0x1853('0x1c')](this['channels'][_0x4c93b4['uniqueid']][_0x4c93b4[_0x1853('0x1f')]][_0x1853('0xf')])){this[_0x1853('0x7')][_0x4c93b4[_0x1853('0x1e')]][_0x4c93b4[_0x1853('0x1f')]][_0x1853('0xf')]=!![];this['channels'][_0x4c93b4[_0x1853('0x1e')]][_0x4c93b4[_0x1853('0x1f')]]['agentringnoanswerAt']=moment()[_0x1853('0x20')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1853('0x7')][_0x4c93b4[_0x1853('0x1e')]][_0x4c93b4[_0x1853('0x1f')]]['reason']='rejected';this['channels'][_0x4c93b4[_0x1853('0x1e')]][_0x4c93b4['destuniqueid']][_0x1853('0x30')]=_0x1853('0x3f');ami[_0x1853('0x1b')](_0x1853('0x40'),this[_0x1853('0x7')][_0x4c93b4['uniqueid']][_0x4c93b4['destuniqueid']]);}}}catch(_0x4a4fac){logger[_0x1853('0x2b')]('[syncAgentRingNoAnswer][VoiceAgentReport]',util['inspect'](_0x4a4fac,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1853('0x1a')][_0x1853('0x12')]=function(_0x17e931){try{if(this[_0x1853('0x1d')](_0x17e931)){if(this[_0x1853('0x7')][_0x17e931[_0x1853('0x1e')]]){for(var _0x18fc58 in this[_0x1853('0x7')][_0x17e931['uniqueid']]){if(this[_0x1853('0x7')][_0x17e931['uniqueid']][_0x1853('0x2e')](_0x18fc58)&&_[_0x1853('0x1c')](this['channels'][_0x17e931['uniqueid']][_0x18fc58][_0x1853('0xf')])){this['channels'][_0x17e931[_0x1853('0x1e')]][_0x18fc58][_0x1853('0xf')]=!![];this['channels'][_0x17e931[_0x1853('0x1e')]][_0x18fc58]['agentringnoanswerAt']=moment()[_0x1853('0x20')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x17e931[_0x1853('0x1e')]][_0x18fc58]['reason']=_0x1853('0x41');this[_0x1853('0x7')][_0x17e931[_0x1853('0x1e')]][_0x18fc58]['lastevent']=_0x1853('0x41');ami[_0x1853('0x1b')]('custom:agentqueuecallerabandon',this[_0x1853('0x7')][_0x17e931[_0x1853('0x1e')]][_0x18fc58]);}}}}}catch(_0x56dd65){logger[_0x1853('0x2b')]('[syncQueueCallerAbandon][VoiceAgentReport]',util[_0x1853('0x2d')](_0x56dd65,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentComplete']=function(_0x21ab9c){try{if(this[_0x1853('0x1d')](_0x21ab9c)){if(this[_0x1853('0x7')][_0x21ab9c[_0x1853('0x1e')]]&&this['channels'][_0x21ab9c[_0x1853('0x1e')]][_0x21ab9c[_0x1853('0x1f')]]&&_['isUndefined'](this[_0x1853('0x7')][_0x21ab9c[_0x1853('0x1e')]][_0x21ab9c[_0x1853('0x1f')]][_0x1853('0x13')])){this[_0x1853('0x7')][_0x21ab9c[_0x1853('0x1e')]][_0x21ab9c[_0x1853('0x1f')]]['agentcomplete']=!![];this['channels'][_0x21ab9c[_0x1853('0x1e')]][_0x21ab9c[_0x1853('0x1f')]][_0x1853('0x42')]=moment()[_0x1853('0x20')](_0x1853('0x21'));this['channels'][_0x21ab9c[_0x1853('0x1e')]][_0x21ab9c[_0x1853('0x1f')]][_0x1853('0x30')]=_0x1853('0x43');this[_0x1853('0x7')][_0x21ab9c[_0x1853('0x1e')]][_0x21ab9c[_0x1853('0x1f')]][_0x1853('0x44')]=_0x21ab9c['talktime'];this[_0x1853('0x7')][_0x21ab9c['uniqueid']][_0x21ab9c[_0x1853('0x1f')]][_0x1853('0x3c')]=_0x21ab9c['reason'];if(this[_0x1853('0x8')][_0x21ab9c[_0x1853('0x23')]]&&this['voiceQueues'][_0x21ab9c['queue']]['acw']){this[_0x1853('0x7')][_0x21ab9c['uniqueid']][_0x21ab9c[_0x1853('0x1f')]][_0x1853('0x45')]=!![];this[_0x1853('0x7')][_0x21ab9c[_0x1853('0x1e')]][_0x21ab9c['destuniqueid']][_0x1853('0x46')]=this[_0x1853('0x8')][_0x21ab9c['queue']][_0x1853('0x47')];}this[_0x1853('0x9')][_0x21ab9c[_0x1853('0x48')]]=_[_0x1853('0x25')](this[_0x1853('0x9')][_0x21ab9c[_0x1853('0x48')]],['queue',_0x1853('0x39')]);this[_0x1853('0x1b')](util[_0x1853('0x20')]('user:%s',_0x21ab9c['membername']),_0x1853('0x49'),this[_0x1853('0x7')][_0x21ab9c[_0x1853('0x1e')]][_0x21ab9c['destuniqueid']]);ami[_0x1853('0x1b')]('custom:agentcomplete',this[_0x1853('0x7')][_0x21ab9c[_0x1853('0x1e')]][_0x21ab9c[_0x1853('0x1f')]]);}}}catch(_0x43402a){logger[_0x1853('0x2b')](_0x1853('0x4a'),util[_0x1853('0x2d')](_0x43402a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1853('0x1a')]['syncVarSet']=function(_0xd6be1c){try{if(this['isNotNull'](_0xd6be1c)){this[_0x1853('0x4b')](_0xd6be1c[_0x1853('0x1e')],_[_0x1853('0x4c')](_0xd6be1c[_0x1853('0x4d')])[0x0],_0xd6be1c[_0x1853('0x4e')]);if(this[_0x1853('0x7')][_0xd6be1c[_0x1853('0x1e')]]){for(var _0x3fb3ef in this['channels'][_0xd6be1c['uniqueid']]){if(this[_0x1853('0x7')][_0xd6be1c[_0x1853('0x1e')]][_0x1853('0x2e')](_0x3fb3ef)){if(_['isUndefined'](this[_0x1853('0x7')][_0xd6be1c[_0x1853('0x1e')]][_0x3fb3ef][_0x1853('0xa')])){this['channels'][_0xd6be1c[_0x1853('0x1e')]][_0x3fb3ef][_0x1853('0xa')]={};}this[_0x1853('0x7')][_0xd6be1c[_0x1853('0x1e')]][_0x3fb3ef]['variables']=this[_0x1853('0xa')][_0xd6be1c[_0x1853('0x1e')]];}}}}}catch(_0x21ae94){logger[_0x1853('0x2b')](_0x1853('0x4f'),util[_0x1853('0x2d')](_0x21ae94,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1853('0x1a')][_0x1853('0x4b')]=function(_0x5e0c26,_0x2f79c6,_0x424d01){var _0x409591=['rtpaudioqos',_0x1853('0x50'),_0x1853('0x51'),_0x1853('0x52'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x1853('0x53'),'rtpaudioqosrttbridged',_0x1853('0x54'),_0x1853('0x55'),_0x1853('0x56'),_0x1853('0x57'),_0x1853('0x58'),'memberdynamic','memberinterface','memberlastcall',_0x1853('0x2a'),_0x1853('0x59'),'memberrealtime'];if(!_['isNil'](_0x2f79c6)&&!_[_0x1853('0x5a')](_0x409591,_0x2f79c6)){if(_['isUndefined'](this[_0x1853('0xa')][_0x5e0c26])){this[_0x1853('0xa')][_0x5e0c26]={};}this['variables'][_0x5e0c26][_0x2f79c6]=_0x424d01;}};VoiceAgentReport[_0x1853('0x1a')][_0x1853('0x16')]=function(_0xc4de60){try{if(this[_0x1853('0x1d')](_0xc4de60)){if(this['channels'][_0xc4de60['uniqueid']]){ami[_0x1853('0x1b')](_0x1853('0x5b'),_[_0x1853('0x5c')](this[_0x1853('0x7')][_0xc4de60['uniqueid']]));delete this['channels'][_0xc4de60['uniqueid']];}if(this['variables'][_0xc4de60[_0x1853('0x1e')]]){delete this[_0x1853('0xa')][_0xc4de60[_0x1853('0x1e')]];}}}catch(_0x3161f8){logger[_0x1853('0x2b')]('[syncHangup][VoiceAgentReport]',util[_0x1853('0x2d')](_0x3161f8,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStart']=function(_0x14d6c9){try{if(this[_0x1853('0x1d')](_0x14d6c9)){if(this[_0x1853('0x7')][_0x14d6c9[_0x1853('0x1e')]]){}}}catch(_0x5ec6ab){logger['error'](_0x1853('0x5d'),util[_0x1853('0x2d')](_0x5ec6ab,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1853('0x1a')][_0x1853('0x5e')]=function(_0x26e220){try{if(this[_0x1853('0x1d')](_0x26e220)){if(this['channels'][_0x26e220[_0x1853('0x1e')]]){}}}catch(_0x5ac4da){logger[_0x1853('0x2b')]('[syncMusicOnHoldStop][VoiceAgentReport]',util[_0x1853('0x2d')](_0x5ac4da,{'showHidden':![],'depth':null}));}};module[_0x1853('0x5f')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 2c5c1a2..eb40fe3 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 _0x6309=['onhold','set','queue','dial','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','socket.io-emitter','localhost','channels','agents','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','then','prototype','isNotNull','emit','uniqueid','linkedid','isUndefined','merge','pick','keys','error','inspect','channel','OutgoingSpoolFailed','starttime','format','disposition','context','split','user:%s','name','user:agentconnect','exten','application','toLowerCase','applicationdata','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastdata','cdr(','match','channelstate','answered','xcally-motion-preview','connectedlinenum','calleridnum','calleridname','membername','UserId','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','push','rec','variable','mixmonitor_filename','value','xmd-phone','xmd-callerid','callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid','parse','sipcalllinkedid','[syncVarSet][VoiceCallReport]','endtime','diff','billableseconds','answertime','holdtime','from-sip','omit','destconnectedlinenum','user:agentcomplete','accountcode','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','syncBlindTransfer','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime','milliseconds','exports','bluebird','lodash','moment','util','path','../../../config/logger','ami','../model/channel','not_inuse','inuse','busy','unavailable','ringing'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6309,0x84));var _0x9630=function(_0x4191bc,_0x3096c5){_0x4191bc=_0x4191bc-0x0;var _0x1ffd4e=_0x6309[_0x4191bc];return _0x1ffd4e;};'use strict';var BPromise=require(_0x9630('0x0'));var _=require(_0x9630('0x1'));var moment=require(_0x9630('0x2'));var util=require(_0x9630('0x3'));var path=require(_0x9630('0x4'));var logger=require(_0x9630('0x5'))(_0x9630('0x6'));var ami=require('../ami');var Channel=require(_0x9630('0x7'));var statusDesc=['unknown',_0x9630('0x8'),_0x9630('0x9'),_0x9630('0xa'),'invalid',_0x9630('0xb'),_0x9630('0xc'),'ringinuse',_0x9630('0xd')];var applications=[_0x9630('0xe'),_0x9630('0xf'),'agi',_0x9630('0x10'),'playback',_0x9630('0x11')];var dispositions=[_0x9630('0x12'),_0x9630('0x13'),_0x9630('0x13'),'NO\x20ANSWER',_0x9630('0x12'),_0x9630('0x12'),_0x9630('0x14'),_0x9630('0x15'),_0x9630('0x13'),_0x9630('0x13'),_0x9630('0x13')];var actions={};var io=require(_0x9630('0x16'))({'host':_0x9630('0x17'),'port':0x18eb});function VoiceCallReport(_0x3e5297){this[_0x9630('0x18')]=_0x3e5297[_0x9630('0x18')];this[_0x9630('0x19')]=_0x3e5297['agents'];ami['on']('coreshowchannel',this[_0x9630('0x1a')][_0x9630('0x1b')](this));ami['on'](_0x9630('0x1c'),this[_0x9630('0x1a')][_0x9630('0x1b')](this));ami['on'](_0x9630('0x1d'),this[_0x9630('0x1e')]['bind'](this));ami['on'](_0x9630('0x1f'),this[_0x9630('0x20')]['bind'](this));ami['on'](_0x9630('0x21'),this[_0x9630('0x22')][_0x9630('0x1b')](this));ami['on'](_0x9630('0x23'),this[_0x9630('0x24')][_0x9630('0x1b')](this));ami['on'](_0x9630('0x25'),this[_0x9630('0x26')][_0x9630('0x1b')](this));ami['on'](_0x9630('0x27'),this[_0x9630('0x28')][_0x9630('0x1b')](this));ami['on'](_0x9630('0x29'),this['syncBlindTransfer'][_0x9630('0x1b')](this));ami['on']('musiconholdstart',this[_0x9630('0x2a')][_0x9630('0x1b')](this));ami['on'](_0x9630('0x2b'),this[_0x9630('0x2c')][_0x9630('0x1b')](this));return BPromise[_0x9630('0x2d')]()[_0x9630('0x2e')](ami['actionCoreShowChannels']())['catch'](function(_0x47571f){console['log'](_0x47571f);});}VoiceCallReport[_0x9630('0x2f')][_0x9630('0x30')]=function(_0x4e9f3f){return _0x4e9f3f!==null&&!_['isUndefined'](_0x4e9f3f);};VoiceCallReport['prototype'][_0x9630('0x31')]=function(_0xb81538,_0x3cc764,_0x1250ea){io['to'](_0xb81538)[_0x9630('0x31')](_0x3cc764,_0x1250ea);};VoiceCallReport[_0x9630('0x2f')][_0x9630('0x26')]=function(_0x610652){try{if(this[_0x9630('0x30')](_0x610652)){if(_0x610652[_0x9630('0x32')]===_0x610652[_0x9630('0x33')]){if(!_[_0x9630('0x34')](this[_0x9630('0x18')][_0x610652[_0x9630('0x32')]])){_[_0x9630('0x35')](this[_0x9630('0x18')][_0x610652['uniqueid']],_[_0x9630('0x36')](_0x610652,_[_0x9630('0x37')](this[_0x9630('0x18')][_0x610652[_0x9630('0x32')]])));}}}}catch(_0x3b08b2){logger[_0x9630('0x38')]('[syncNewCallerId][VoiceCallReport]',util[_0x9630('0x39')](_0x3b08b2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9630('0x2f')][_0x9630('0x1e')]=function(_0x2b869f){try{if(this[_0x9630('0x30')](_0x2b869f)){if(_0x2b869f['uniqueid']===_0x2b869f[_0x9630('0x33')]&&_0x2b869f[_0x9630('0x3a')]!=_0x9630('0x3b')){if(_[_0x9630('0x34')](this[_0x9630('0x18')][_0x2b869f[_0x9630('0x32')]])){this[_0x9630('0x18')][_0x2b869f[_0x9630('0x32')]]=new Channel();this[_0x9630('0x18')][_0x2b869f[_0x9630('0x32')]][_0x9630('0x3c')]=moment()[_0x9630('0x3d')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x2b869f[_0x9630('0x32')]][_0x9630('0x3e')]=dispositions[_['toNumber'](_0x2b869f['channelstate'])];_['merge'](this['channels'][_0x2b869f[_0x9630('0x32')]],_[_0x9630('0x36')](_0x2b869f,_[_0x9630('0x37')](this[_0x9630('0x18')][_0x2b869f[_0x9630('0x32')]])));if(_0x2b869f[_0x9630('0x3f')]==='from-sip'){if(this['agents'][_0x2b869f[_0x9630('0x3a')][_0x9630('0x40')]('-')[0x0]]){this[_0x9630('0x19')][_0x2b869f[_0x9630('0x3a')][_0x9630('0x40')]('-')[0x0]]['destconnectedlinenum']=_0x2b869f['exten'];this['emit'](util['format'](_0x9630('0x41'),this[_0x9630('0x19')][_0x2b869f[_0x9630('0x3a')]['split']('-')[0x0]][_0x9630('0x42')]),_0x9630('0x43'),{'destaccountcode':this[_0x9630('0x19')][_0x2b869f[_0x9630('0x3a')][_0x9630('0x40')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x2b869f[_0x9630('0x44')]});}}}}}}catch(_0x5b21b3){logger[_0x9630('0x38')]('[syncNewChannel][VoiceCallReport]',util[_0x9630('0x39')](_0x5b21b3,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x9630('0x1a')]=function(_0x42bb23){try{if(this['isNotNull'](_0x42bb23)){if(_0x42bb23[_0x9630('0x32')]===_0x42bb23[_0x9630('0x33')]&&_0x42bb23['exten']!='h'&&_0x42bb23[_0x9630('0x3a')]!=_0x9630('0x3b')){_0x42bb23[_0x9630('0x45')]=_0x42bb23[_0x9630('0x45')][_0x9630('0x46')]();_0x42bb23[_0x9630('0x47')]=(_0x42bb23['appdata']||_0x42bb23[_0x9630('0x47')])[_0x9630('0x46')]();if(_['isUndefined'](this[_0x9630('0x18')][_0x42bb23[_0x9630('0x32')]])){this[_0x9630('0x18')][_0x42bb23['uniqueid']]=new Channel();this[_0x9630('0x18')][_0x42bb23[_0x9630('0x32')]][_0x9630('0x3c')]=_0x42bb23[_0x9630('0x48')]?moment()['subtract'](moment[_0x9630('0x48')](_0x42bb23[_0x9630('0x48')])[_0x9630('0x49')](),_0x9630('0x49'))[_0x9630('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'):moment()['format'](_0x9630('0x4a'));this[_0x9630('0x18')][_0x42bb23[_0x9630('0x32')]][_0x9630('0x3e')]='NO\x20ANSWER';}_[_0x9630('0x35')](this['channels'][_0x42bb23[_0x9630('0x32')]],_[_0x9630('0x36')](_0x42bb23,_[_0x9630('0x37')](this[_0x9630('0x18')][_0x42bb23[_0x9630('0x32')]])));if(_[_0x9630('0x4b')](applications,_0x42bb23[_0x9630('0x45')])){this[_0x9630('0x18')][_0x42bb23[_0x9630('0x32')]]['lastapplication']=_0x42bb23[_0x9630('0x45')];this[_0x9630('0x18')][_0x42bb23[_0x9630('0x32')]][_0x9630('0x4c')]=_0x42bb23[_0x9630('0x47')];if(_0x42bb23[_0x9630('0x45')]===_0x9630('0xe')&&_['startsWith'](_0x42bb23[_0x9630('0x47')],_0x9630('0x4d'))){var _0x75b494=_0x42bb23[_0x9630('0x47')][_0x9630('0x40')]('=');var _0xa54423=_0x75b494[0x0][_0x9630('0x4e')](/cdr\((.*)\)/);if(_0xa54423){this[_0x9630('0x18')][_0x42bb23['uniqueid']][_0xa54423[0x1]]=_0x75b494[0x1];}}else if(_0x42bb23['application']===_0x9630('0xf')){this[_0x9630('0x18')][_0x42bb23[_0x9630('0x32')]][_0x9630('0xf')]=_0x42bb23[_0x9630('0x47')][_0x9630('0x40')](',')[0x0];}}}}}catch(_0x4375f1){logger[_0x9630('0x38')]('[syncNewExten][VoiceCallReport]',util[_0x9630('0x39')](_0x4375f1,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewState']=function(_0x59c3dd){try{if(this['isNotNull'](_0x59c3dd)){if(_0x59c3dd['uniqueid']!==_0x59c3dd[_0x9630('0x33')]){if(this[_0x9630('0x18')][_0x59c3dd[_0x9630('0x33')]]){if(_0x59c3dd[_0x9630('0x4f')]==='6'){if(!this[_0x9630('0x18')][_0x59c3dd['linkedid']]['answered']){this['channels'][_0x59c3dd['linkedid']][_0x9630('0x50')]=!![];this['channels'][_0x59c3dd['linkedid']]['answertime']=moment()[_0x9630('0x3d')](_0x9630('0x4a'));}this[_0x9630('0x18')][_0x59c3dd['linkedid']]['linkedid']=_0x59c3dd[_0x9630('0x32')];if(_0x59c3dd['calleridnum']!==_0x9630('0x51')){this['channels'][_0x59c3dd[_0x9630('0x33')]][_0x9630('0x52')]=_0x59c3dd[_0x9630('0x53')];}this[_0x9630('0x18')][_0x59c3dd[_0x9630('0x33')]]['connectedlinename']=_0x59c3dd[_0x9630('0x54')];this[_0x9630('0x18')][_0x59c3dd[_0x9630('0x33')]]['destinationchannel']=_0x59c3dd[_0x9630('0x3a')];this['channels'][_0x59c3dd['linkedid']][_0x9630('0x3e')]=dispositions[_['toNumber'](_0x59c3dd[_0x9630('0x4f')])];if(this['agents'][_0x59c3dd['channel'][_0x9630('0x40')]('-')[0x0]]){this[_0x9630('0x18')][_0x59c3dd['linkedid']]['UserId']=this['agents'][_0x59c3dd['channel'][_0x9630('0x40')]('-')[0x0]]['id'];this[_0x9630('0x18')][_0x59c3dd[_0x9630('0x33')]][_0x9630('0x55')]=this[_0x9630('0x19')][_0x59c3dd[_0x9630('0x3a')]['split']('-')[0x0]][_0x9630('0x42')];}}}}else{if(this[_0x9630('0x18')][_0x59c3dd[_0x9630('0x32')]]){if(_0x59c3dd[_0x9630('0x4f')]==='6'){if(this[_0x9630('0x19')][_0x59c3dd[_0x9630('0x3a')]['split']('-')[0x0]]){this['channels'][_0x59c3dd['uniqueid']][_0x9630('0x56')]=this[_0x9630('0x19')][_0x59c3dd[_0x9630('0x3a')][_0x9630('0x40')]('-')[0x0]]['id'];this[_0x9630('0x18')][_0x59c3dd[_0x9630('0x32')]]['membername']=this[_0x9630('0x19')][_0x59c3dd[_0x9630('0x3a')][_0x9630('0x40')]('-')[0x0]]['name'];}}}}}}catch(_0x632727){logger[_0x9630('0x38')](_0x9630('0x57'),util[_0x9630('0x39')](_0x632727,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x9630('0x58')]=function(_0x49643c,_0x305a12){if(this[_0x9630('0x18')][_0x49643c]){this[_0x9630('0x18')][_0x49643c][_0x9630('0x59')]=!![];if(_['endsWith'](_0x305a12,_0x9630('0x5a'))){_0x305a12=_0x305a12[_0x9630('0x5b')](_0x9630('0x5a'),_0x9630('0x5c'));}this[_0x9630('0x18')][_0x49643c][_0x9630('0x5d')]=_0x305a12;var _0x1afc29=_[_0x9630('0x5e')](this[_0x9630('0x18')][_0x49643c][_0x9630('0x5f')],{'filename':_0x305a12});if(_[_0x9630('0x60')](_0x1afc29)){this[_0x9630('0x18')][_0x49643c][_0x9630('0x5f')][_0x9630('0x61')]({'filename':_0x305a12,'createdAt':moment()[_0x9630('0x3d')](_0x9630('0x4a')),'mixmonitorid':'','status':_0x9630('0x62')});}}};VoiceCallReport[_0x9630('0x2f')]['syncVarSet']=function(_0xafb625){try{if(this[_0x9630('0x30')](_0xafb625)){if(this[_0x9630('0x18')][_0xafb625[_0x9630('0x32')]]&&_0xafb625['channel']!='OutgoingSpoolFailed'){if(this[_0x9630('0x30')](_0xafb625['variable'])){if(this['isNotNull'](_0xafb625[_0x9630('0x63')][_0x9630('0x64')])){this[_0x9630('0x58')](_0xafb625['uniqueid'],_0xafb625[_0x9630('0x65')]);}else if(this['isNotNull'](_0xafb625['variable'][_0x9630('0x66')])){this[_0x9630('0x18')][_0xafb625['uniqueid']][_0x9630('0x53')]=_0xafb625[_0x9630('0x65')];}else if(this['isNotNull'](_0xafb625['variable'][_0x9630('0x67')])){this[_0x9630('0x18')][_0xafb625[_0x9630('0x32')]][_0x9630('0x68')]=_0xafb625[_0x9630('0x65')];}else if(this[_0x9630('0x30')](_0xafb625['variable'][_0x9630('0x69')])){this[_0x9630('0x18')][_0xafb625[_0x9630('0x32')]][_0x9630('0x6a')]=_0xafb625[_0x9630('0x65')];}else if(this[_0x9630('0x30')](_0xafb625[_0x9630('0x63')][_0x9630('0x6b')])){this['channels'][_0xafb625['uniqueid']][_0x9630('0xf')]=_0xafb625[_0x9630('0x65')][_0x9630('0x40')](',')[0x0];}else if(this[_0x9630('0x30')](_0xafb625[_0x9630('0x63')][_0x9630('0x6c')])){this[_0x9630('0x18')][_0xafb625[_0x9630('0x32')]]['originatecalleridnum']=_0xafb625[_0x9630('0x65')];}else if(this[_0x9630('0x30')](_0xafb625[_0x9630('0x63')][_0x9630('0x6d')])){this['channels'][_0xafb625[_0x9630('0x32')]][_0x9630('0x6e')]=_0xafb625['value'];}else if(this[_0x9630('0x30')](_0xafb625[_0x9630('0x63')][_0x9630('0x6f')])){this['channels'][_0xafb625['uniqueid']][_0x9630('0x70')]=_0xafb625[_0x9630('0x65')];}else if(this['isNotNull'](_0xafb625[_0x9630('0x63')][_0x9630('0x71')])){this[_0x9630('0x18')][_0xafb625[_0x9630('0x32')]][_0x9630('0xf')]=_0xafb625[_0x9630('0x65')];}else if(this[_0x9630('0x30')](_0xafb625[_0x9630('0x63')][_0x9630('0x72')])){this[_0x9630('0x18')][_0xafb625['uniqueid']][_0x9630('0x73')]=_0xafb625['value'];}}}else if(this['isNotNull'](_0xafb625[_0x9630('0x63')][_0x9630('0x64')])){if(_0xafb625[_0x9630('0x65')]){var _0x18d871=path[_0x9630('0x74')](_0xafb625[_0x9630('0x65')])['name'];this[_0x9630('0x58')](_0x18d871,_0xafb625[_0x9630('0x65')]);}}else if(this[_0x9630('0x18')][_0xafb625[_0x9630('0x33')]]){if(this[_0x9630('0x30')](_0xafb625[_0x9630('0x63')])){if(this['isNotNull'](_0xafb625[_0x9630('0x63')][_0x9630('0x72')])){this[_0x9630('0x18')][_0xafb625[_0x9630('0x33')]][_0x9630('0x75')]=_0xafb625['value'];}}}}}catch(_0x3e5022){logger['error'](_0x9630('0x76'),util[_0x9630('0x39')](_0x3e5022,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9630('0x2f')][_0x9630('0x24')]=function(_0xd710e2){try{if(this[_0x9630('0x30')](_0xd710e2)){if(this[_0x9630('0x18')][_0xd710e2[_0x9630('0x32')]]){var _0x5ec366=moment();this[_0x9630('0x18')][_0xd710e2[_0x9630('0x32')]][_0x9630('0x77')]=_0x5ec366['format'](_0x9630('0x4a'));this[_0x9630('0x18')][_0xd710e2[_0x9630('0x32')]]['duration']=_0x5ec366[_0x9630('0x78')](this['channels'][_0xd710e2['uniqueid']][_0x9630('0x3c')],_0x9630('0x49'));if(this[_0x9630('0x18')][_0xd710e2[_0x9630('0x32')]][_0x9630('0x50')]){this[_0x9630('0x18')][_0xd710e2[_0x9630('0x32')]][_0x9630('0x79')]=_0x5ec366['diff'](this[_0x9630('0x18')][_0xd710e2['uniqueid']][_0x9630('0x7a')],_0x9630('0x49'));this[_0x9630('0x18')][_0xd710e2[_0x9630('0x32')]][_0x9630('0x7b')]=this['channels'][_0xd710e2[_0x9630('0x32')]][_0x9630('0x48')]-this[_0x9630('0x18')][_0xd710e2[_0x9630('0x32')]][_0x9630('0x79')];}if(_0xd710e2[_0x9630('0x3f')]===_0x9630('0x7c')){if(this[_0x9630('0x19')][_0xd710e2[_0x9630('0x3a')][_0x9630('0x40')]('-')[0x0]]){this['agents'][_0xd710e2[_0x9630('0x3a')]['split']('-')[0x0]]=_[_0x9630('0x7d')](this[_0x9630('0x19')][_0xd710e2[_0x9630('0x3a')]['split']('-')[0x0]],[_0x9630('0x7e')]);this['emit'](util[_0x9630('0x3d')](_0x9630('0x41'),this[_0x9630('0x19')][_0xd710e2[_0x9630('0x3a')]['split']('-')[0x0]][_0x9630('0x42')]),_0x9630('0x7f'),{'destaccountcode':this['agents'][_0xd710e2[_0x9630('0x3a')][_0x9630('0x40')]('-')[0x0]][_0x9630('0x80')]});}}ami[_0x9630('0x31')](_0x9630('0x81'),this[_0x9630('0x18')][_0xd710e2[_0x9630('0x32')]]);delete this[_0x9630('0x18')][_0xd710e2[_0x9630('0x32')]];}}}catch(_0x2479e0){logger[_0x9630('0x38')](_0x9630('0x82'),util[_0x9630('0x39')](_0x2479e0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9630('0x2f')][_0x9630('0x28')]=function(_0x3992c2){try{if(this[_0x9630('0x30')](_0x3992c2)){if(this[_0x9630('0x18')][_0x3992c2[_0x9630('0x83')]]){this[_0x9630('0x18')][_0x3992c2[_0x9630('0x83')]][_0x9630('0x84')]=_0x3992c2[_0x9630('0x85')];this[_0x9630('0x18')][_0x3992c2[_0x9630('0x83')]][_0x9630('0x86')]=_0x3992c2['transfertargetcalleridnum'];var _0x1cb720=this[_0x9630('0x18')][_0x3992c2[_0x9630('0x87')]];this[_0x9630('0x18')][_0x3992c2['secondtransfereruniqueid']]=this['channels'][_0x3992c2[_0x9630('0x83')]];this[_0x9630('0x18')][_0x3992c2['transfereeuniqueid']]=_0x1cb720;}}}catch(_0x43805e){logger[_0x9630('0x38')](_0x9630('0x88'),util[_0x9630('0x39')](_0x43805e,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x9630('0x89')]=function(_0x409fcc){try{if(this[_0x9630('0x30')](_0x409fcc)){if(this['channels'][_0x409fcc[_0x9630('0x83')]]){this[_0x9630('0x18')][_0x409fcc[_0x9630('0x83')]]['transfercalleridnum']=_0x409fcc['transfereecalleridnum'];this['channels'][_0x409fcc[_0x9630('0x83')]]['transferconnectedlinenum']=_0x409fcc[_0x9630('0x8a')];this[_0x9630('0x24')]({'event':_0x9630('0x8b'),'uniqueid':_0x409fcc[_0x9630('0x83')],'context':_0x409fcc[_0x9630('0x3f')],'channel':_0x409fcc[_0x9630('0x8c')]});}}}catch(_0x5f377d){logger[_0x9630('0x38')](_0x9630('0x8d'),util[_0x9630('0x39')](_0x5f377d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStart']=function(_0x458a9e){try{if(this[_0x9630('0x30')](_0x458a9e)){if(this[_0x9630('0x18')][_0x458a9e[_0x9630('0x32')]]){if(!_[_0x9630('0x60')](this[_0x9630('0x18')][_0x458a9e['uniqueid']]['answertime'])){this[_0x9630('0x18')][_0x458a9e[_0x9630('0x32')]]['mohstarttime']=moment()['format'](_0x9630('0x4a'));}}}}catch(_0x296b94){logger[_0x9630('0x38')]('[syncMusicOnHoldStart][VoiceCallReport]',util['inspect'](_0x296b94,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9630('0x2f')][_0x9630('0x2c')]=function(_0x47320b){try{if(this['isNotNull'](_0x47320b)){if(this[_0x9630('0x18')][_0x47320b[_0x9630('0x32')]]){if(!_[_0x9630('0x60')](this[_0x9630('0x18')][_0x47320b[_0x9630('0x32')]][_0x9630('0x8e')])){this['channels'][_0x47320b['uniqueid']]['mohtime']+=moment()[_0x9630('0x8f')](0x0)[_0x9630('0x78')](this[_0x9630('0x18')][_0x47320b['uniqueid']]['mohstarttime'],'seconds');delete this[_0x9630('0x18')][_0x47320b['uniqueid']][_0x9630('0x8e')];}}}}catch(_0x118d10){logger[_0x9630('0x38')]('[syncMusicOnHoldStop][VoiceCallReport]',util['inspect'](_0x118d10,{'showHidden':![],'depth':null}));}};module[_0x9630('0x90')]=VoiceCallReport; \ No newline at end of file +var _0xb214=['exports','moment','util','ami','../ami','../model/channel','unknown','busy','invalid','unavailable','ringing','ringinuse','onhold','set','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','localhost','channels','agents','syncNewExten','bind','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','then','actionCoreShowChannels','log','isNotNull','isUndefined','emit','prototype','syncNewCallerId','uniqueid','linkedid','merge','pick','keys','error','channel','OutgoingSpoolFailed','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','from-sip','split','destconnectedlinenum','format','user:%s','name','user:agentconnect','accountcode','exten','toLowerCase','appdata','applicationdata','duration','subtract','seconds','lastapplication','application','lastdata','startsWith','cdr(','match','queue','[syncNewExten][VoiceCallReport]','inspect','answered','answertime','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','calleridname','UserId','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','endsWith','replace','.wav49','.WAV','monitorFilename','find','monitors','push','rec','variable','mixmonitor_filename','value','xmd-callerid','callerid','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','xmd-callerid-preview','calleridpreview','sipcallid','sipcalluniqueid','parse','[syncVarSet][VoiceCallReport]','diff','billableseconds','holdtime','context','omit','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','transferconnectedlinenum','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','isNil','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]'];(function(_0x25212e,_0x35c573){var _0xa65397=function(_0x351170){while(--_0x351170){_0x25212e['push'](_0x25212e['shift']());}};_0xa65397(++_0x35c573);}(_0xb214,0x129));var _0x4b21=function(_0x7c2756,_0x5eedee){_0x7c2756=_0x7c2756-0x0;var _0x427d22=_0xb214[_0x7c2756];return _0x427d22;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var moment=require(_0x4b21('0x0'));var util=require(_0x4b21('0x1'));var path=require('path');var logger=require('../../../config/logger')(_0x4b21('0x2'));var ami=require(_0x4b21('0x3'));var Channel=require(_0x4b21('0x4'));var statusDesc=[_0x4b21('0x5'),'not_inuse','inuse',_0x4b21('0x6'),_0x4b21('0x7'),_0x4b21('0x8'),_0x4b21('0x9'),_0x4b21('0xa'),_0x4b21('0xb')];var applications=[_0x4b21('0xc'),'queue',_0x4b21('0xd'),_0x4b21('0xe'),_0x4b21('0xf'),_0x4b21('0x10')];var dispositions=['NO\x20ANSWER',_0x4b21('0x11'),_0x4b21('0x11'),_0x4b21('0x12'),_0x4b21('0x12'),_0x4b21('0x12'),_0x4b21('0x13'),_0x4b21('0x14'),_0x4b21('0x11'),_0x4b21('0x11'),_0x4b21('0x11')];var actions={};var io=require('socket.io-emitter')({'host':_0x4b21('0x15'),'port':0x18eb});function VoiceCallReport(_0x2747b7){this[_0x4b21('0x16')]=_0x2747b7[_0x4b21('0x16')];this[_0x4b21('0x17')]=_0x2747b7[_0x4b21('0x17')];ami['on']('coreshowchannel',this[_0x4b21('0x18')][_0x4b21('0x19')](this));ami['on']('newexten',this[_0x4b21('0x18')]['bind'](this));ami['on'](_0x4b21('0x1a'),this[_0x4b21('0x1b')][_0x4b21('0x19')](this));ami['on'](_0x4b21('0x1c'),this[_0x4b21('0x1d')][_0x4b21('0x19')](this));ami['on'](_0x4b21('0x1e'),this[_0x4b21('0x1f')]['bind'](this));ami['on'](_0x4b21('0x20'),this[_0x4b21('0x21')][_0x4b21('0x19')](this));ami['on']('newcallerid',this['syncNewCallerId']['bind'](this));ami['on'](_0x4b21('0x22'),this[_0x4b21('0x23')][_0x4b21('0x19')](this));ami['on'](_0x4b21('0x24'),this['syncBlindTransfer'][_0x4b21('0x19')](this));ami['on'](_0x4b21('0x25'),this[_0x4b21('0x26')]['bind'](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0x4b21('0x19')](this));return BPromise['resolve']()[_0x4b21('0x27')](ami[_0x4b21('0x28')]())['catch'](function(_0x2b24fc){console[_0x4b21('0x29')](_0x2b24fc);});}VoiceCallReport['prototype'][_0x4b21('0x2a')]=function(_0x3f09f2){return _0x3f09f2!==null&&!_[_0x4b21('0x2b')](_0x3f09f2);};VoiceCallReport['prototype'][_0x4b21('0x2c')]=function(_0x5269bc,_0x1fa6d8,_0x23b230){io['to'](_0x5269bc)[_0x4b21('0x2c')](_0x1fa6d8,_0x23b230);};VoiceCallReport[_0x4b21('0x2d')][_0x4b21('0x2e')]=function(_0x1b4881){try{if(this[_0x4b21('0x2a')](_0x1b4881)){if(_0x1b4881[_0x4b21('0x2f')]===_0x1b4881[_0x4b21('0x30')]){if(!_[_0x4b21('0x2b')](this[_0x4b21('0x16')][_0x1b4881['uniqueid']])){_[_0x4b21('0x31')](this[_0x4b21('0x16')][_0x1b4881[_0x4b21('0x2f')]],_[_0x4b21('0x32')](_0x1b4881,_[_0x4b21('0x33')](this[_0x4b21('0x16')][_0x1b4881[_0x4b21('0x2f')]])));}}}}catch(_0x2e0fcc){logger[_0x4b21('0x34')]('[syncNewCallerId][VoiceCallReport]',util['inspect'](_0x2e0fcc,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x4b21('0x1b')]=function(_0x3644b0){try{if(this[_0x4b21('0x2a')](_0x3644b0)){if(_0x3644b0[_0x4b21('0x2f')]===_0x3644b0[_0x4b21('0x30')]&&_0x3644b0[_0x4b21('0x35')]!=_0x4b21('0x36')){if(_[_0x4b21('0x2b')](this['channels'][_0x3644b0[_0x4b21('0x2f')]])){this['channels'][_0x3644b0['uniqueid']]=new Channel();this[_0x4b21('0x16')][_0x3644b0[_0x4b21('0x2f')]][_0x4b21('0x37')]=moment()['format'](_0x4b21('0x38'));this[_0x4b21('0x16')][_0x3644b0['uniqueid']][_0x4b21('0x39')]=dispositions[_[_0x4b21('0x3a')](_0x3644b0[_0x4b21('0x3b')])];_[_0x4b21('0x31')](this[_0x4b21('0x16')][_0x3644b0[_0x4b21('0x2f')]],_[_0x4b21('0x32')](_0x3644b0,_['keys'](this['channels'][_0x3644b0[_0x4b21('0x2f')]])));if(_0x3644b0['context']===_0x4b21('0x3c')){if(this['agents'][_0x3644b0[_0x4b21('0x35')][_0x4b21('0x3d')]('-')[0x0]]){this[_0x4b21('0x17')][_0x3644b0[_0x4b21('0x35')][_0x4b21('0x3d')]('-')[0x0]][_0x4b21('0x3e')]=_0x3644b0['exten'];this[_0x4b21('0x2c')](util[_0x4b21('0x3f')](_0x4b21('0x40'),this['agents'][_0x3644b0[_0x4b21('0x35')]['split']('-')[0x0]][_0x4b21('0x41')]),_0x4b21('0x42'),{'destaccountcode':this[_0x4b21('0x17')][_0x3644b0[_0x4b21('0x35')]['split']('-')[0x0]][_0x4b21('0x43')],'destconnectedlinenum':_0x3644b0['exten']});}}}}}}catch(_0x14aae7){logger[_0x4b21('0x34')]('[syncNewChannel][VoiceCallReport]',util['inspect'](_0x14aae7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4b21('0x2d')][_0x4b21('0x18')]=function(_0x593e27){try{if(this['isNotNull'](_0x593e27)){if(_0x593e27['uniqueid']===_0x593e27['linkedid']&&_0x593e27[_0x4b21('0x44')]!='h'&&_0x593e27['channel']!=_0x4b21('0x36')){_0x593e27['application']=_0x593e27['application'][_0x4b21('0x45')]();_0x593e27['applicationdata']=(_0x593e27[_0x4b21('0x46')]||_0x593e27[_0x4b21('0x47')])['toLowerCase']();if(_[_0x4b21('0x2b')](this[_0x4b21('0x16')][_0x593e27[_0x4b21('0x2f')]])){this[_0x4b21('0x16')][_0x593e27[_0x4b21('0x2f')]]=new Channel();this['channels'][_0x593e27[_0x4b21('0x2f')]][_0x4b21('0x37')]=_0x593e27[_0x4b21('0x48')]?moment()[_0x4b21('0x49')](moment[_0x4b21('0x48')](_0x593e27[_0x4b21('0x48')])[_0x4b21('0x4a')](),'seconds')[_0x4b21('0x3f')](_0x4b21('0x38')):moment()[_0x4b21('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x593e27['uniqueid']][_0x4b21('0x39')]=_0x4b21('0x12');}_[_0x4b21('0x31')](this[_0x4b21('0x16')][_0x593e27[_0x4b21('0x2f')]],_['pick'](_0x593e27,_[_0x4b21('0x33')](this[_0x4b21('0x16')][_0x593e27['uniqueid']])));if(_['includes'](applications,_0x593e27['application'])){this[_0x4b21('0x16')][_0x593e27['uniqueid']][_0x4b21('0x4b')]=_0x593e27[_0x4b21('0x4c')];this[_0x4b21('0x16')][_0x593e27[_0x4b21('0x2f')]][_0x4b21('0x4d')]=_0x593e27[_0x4b21('0x47')];if(_0x593e27[_0x4b21('0x4c')]===_0x4b21('0xc')&&_[_0x4b21('0x4e')](_0x593e27[_0x4b21('0x47')],_0x4b21('0x4f'))){var _0x3dba66=_0x593e27[_0x4b21('0x47')][_0x4b21('0x3d')]('=');var _0x1381e9=_0x3dba66[0x0][_0x4b21('0x50')](/cdr\((.*)\)/);if(_0x1381e9){this['channels'][_0x593e27[_0x4b21('0x2f')]][_0x1381e9[0x1]]=_0x3dba66[0x1];}}else if(_0x593e27[_0x4b21('0x4c')]===_0x4b21('0x51')){this[_0x4b21('0x16')][_0x593e27[_0x4b21('0x2f')]][_0x4b21('0x51')]=_0x593e27[_0x4b21('0x47')][_0x4b21('0x3d')](',')[0x0];}}}}}catch(_0x1e2154){logger[_0x4b21('0x34')](_0x4b21('0x52'),util[_0x4b21('0x53')](_0x1e2154,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4b21('0x2d')][_0x4b21('0x1d')]=function(_0x1b0371){try{if(this[_0x4b21('0x2a')](_0x1b0371)){if(_0x1b0371[_0x4b21('0x2f')]!==_0x1b0371[_0x4b21('0x30')]){if(this[_0x4b21('0x16')][_0x1b0371['linkedid']]){if(_0x1b0371['channelstate']==='6'){if(!this[_0x4b21('0x16')][_0x1b0371[_0x4b21('0x30')]][_0x4b21('0x54')]){this[_0x4b21('0x16')][_0x1b0371['linkedid']][_0x4b21('0x54')]=!![];this[_0x4b21('0x16')][_0x1b0371['linkedid']][_0x4b21('0x55')]=moment()[_0x4b21('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');}this[_0x4b21('0x16')][_0x1b0371[_0x4b21('0x30')]][_0x4b21('0x30')]=_0x1b0371['uniqueid'];if(_0x1b0371[_0x4b21('0x56')]!==_0x4b21('0x57')){this[_0x4b21('0x16')][_0x1b0371[_0x4b21('0x30')]][_0x4b21('0x58')]=_0x1b0371[_0x4b21('0x56')];}this[_0x4b21('0x16')][_0x1b0371['linkedid']][_0x4b21('0x59')]=_0x1b0371[_0x4b21('0x5a')];this[_0x4b21('0x16')][_0x1b0371['linkedid']]['destinationchannel']=_0x1b0371[_0x4b21('0x35')];this[_0x4b21('0x16')][_0x1b0371['linkedid']][_0x4b21('0x39')]=dispositions[_[_0x4b21('0x3a')](_0x1b0371[_0x4b21('0x3b')])];if(this['agents'][_0x1b0371[_0x4b21('0x35')][_0x4b21('0x3d')]('-')[0x0]]){this[_0x4b21('0x16')][_0x1b0371['linkedid']][_0x4b21('0x5b')]=this[_0x4b21('0x17')][_0x1b0371[_0x4b21('0x35')][_0x4b21('0x3d')]('-')[0x0]]['id'];this[_0x4b21('0x16')][_0x1b0371['linkedid']]['membername']=this[_0x4b21('0x17')][_0x1b0371['channel'][_0x4b21('0x3d')]('-')[0x0]][_0x4b21('0x41')];}}}}else{if(this[_0x4b21('0x16')][_0x1b0371[_0x4b21('0x2f')]]){if(_0x1b0371[_0x4b21('0x3b')]==='6'){if(this[_0x4b21('0x17')][_0x1b0371[_0x4b21('0x35')][_0x4b21('0x3d')]('-')[0x0]]){this[_0x4b21('0x16')][_0x1b0371[_0x4b21('0x2f')]]['UserId']=this[_0x4b21('0x17')][_0x1b0371[_0x4b21('0x35')][_0x4b21('0x3d')]('-')[0x0]]['id'];this[_0x4b21('0x16')][_0x1b0371[_0x4b21('0x2f')]][_0x4b21('0x5c')]=this[_0x4b21('0x17')][_0x1b0371[_0x4b21('0x35')][_0x4b21('0x3d')]('-')[0x0]]['name'];}}}}}}catch(_0x1b907b){logger[_0x4b21('0x34')](_0x4b21('0x5d'),util[_0x4b21('0x53')](_0x1b907b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4b21('0x2d')][_0x4b21('0x5e')]=function(_0x4da8a5,_0x4287ce){if(this[_0x4b21('0x16')][_0x4da8a5]){this[_0x4b21('0x16')][_0x4da8a5][_0x4b21('0x5f')]=!![];if(_[_0x4b21('0x60')](_0x4287ce,'.wav49')){_0x4287ce=_0x4287ce[_0x4b21('0x61')](_0x4b21('0x62'),_0x4b21('0x63'));}this[_0x4b21('0x16')][_0x4da8a5][_0x4b21('0x64')]=_0x4287ce;var _0x1363b1=_[_0x4b21('0x65')](this[_0x4b21('0x16')][_0x4da8a5]['monitors'],{'filename':_0x4287ce});if(_['isNil'](_0x1363b1)){this[_0x4b21('0x16')][_0x4da8a5][_0x4b21('0x66')][_0x4b21('0x67')]({'filename':_0x4287ce,'createdAt':moment()[_0x4b21('0x3f')](_0x4b21('0x38')),'mixmonitorid':'','status':_0x4b21('0x68')});}}};VoiceCallReport['prototype'][_0x4b21('0x1f')]=function(_0x171c0f){try{if(this[_0x4b21('0x2a')](_0x171c0f)){if(this[_0x4b21('0x16')][_0x171c0f[_0x4b21('0x2f')]]&&_0x171c0f[_0x4b21('0x35')]!=_0x4b21('0x36')){if(this[_0x4b21('0x2a')](_0x171c0f[_0x4b21('0x69')])){if(this[_0x4b21('0x2a')](_0x171c0f[_0x4b21('0x69')][_0x4b21('0x6a')])){this['syncMixMonitorFilename'](_0x171c0f[_0x4b21('0x2f')],_0x171c0f['value']);}else if(this[_0x4b21('0x2a')](_0x171c0f[_0x4b21('0x69')]['xmd-phone'])){this[_0x4b21('0x16')][_0x171c0f['uniqueid']][_0x4b21('0x56')]=_0x171c0f[_0x4b21('0x6b')];}else if(this[_0x4b21('0x2a')](_0x171c0f['variable'][_0x4b21('0x6c')])){this[_0x4b21('0x16')][_0x171c0f['uniqueid']][_0x4b21('0x6d')]=_0x171c0f[_0x4b21('0x6b')];}else if(this[_0x4b21('0x2a')](_0x171c0f['variable']['xmd-cdrtype'])){this[_0x4b21('0x16')][_0x171c0f[_0x4b21('0x2f')]][_0x4b21('0x6e')]=_0x171c0f[_0x4b21('0x6b')];}else if(this[_0x4b21('0x2a')](_0x171c0f[_0x4b21('0x69')][_0x4b21('0x6f')])){this[_0x4b21('0x16')][_0x171c0f['uniqueid']][_0x4b21('0x51')]=_0x171c0f[_0x4b21('0x6b')][_0x4b21('0x3d')](',')[0x0];}else if(this[_0x4b21('0x2a')](_0x171c0f[_0x4b21('0x69')][_0x4b21('0x70')])){this['channels'][_0x171c0f[_0x4b21('0x2f')]][_0x4b21('0x71')]=_0x171c0f[_0x4b21('0x6b')];}else if(this['isNotNull'](_0x171c0f[_0x4b21('0x69')][_0x4b21('0x72')])){this[_0x4b21('0x16')][_0x171c0f[_0x4b21('0x2f')]]['destination']=_0x171c0f[_0x4b21('0x6b')];}else if(this[_0x4b21('0x2a')](_0x171c0f[_0x4b21('0x69')][_0x4b21('0x73')])){this['channels'][_0x171c0f[_0x4b21('0x2f')]][_0x4b21('0x74')]=_0x171c0f[_0x4b21('0x6b')];}else if(this[_0x4b21('0x2a')](_0x171c0f[_0x4b21('0x69')]['xmcs-queue'])){this[_0x4b21('0x16')][_0x171c0f[_0x4b21('0x2f')]][_0x4b21('0x51')]=_0x171c0f[_0x4b21('0x6b')];}else if(this[_0x4b21('0x2a')](_0x171c0f[_0x4b21('0x69')][_0x4b21('0x75')])){this[_0x4b21('0x16')][_0x171c0f[_0x4b21('0x2f')]][_0x4b21('0x76')]=_0x171c0f[_0x4b21('0x6b')];}}}else if(this['isNotNull'](_0x171c0f[_0x4b21('0x69')][_0x4b21('0x6a')])){if(_0x171c0f[_0x4b21('0x6b')]){var _0x455195=path[_0x4b21('0x77')](_0x171c0f['value'])[_0x4b21('0x41')];this[_0x4b21('0x5e')](_0x455195,_0x171c0f['value']);}}else if(this['channels'][_0x171c0f[_0x4b21('0x30')]]){if(this[_0x4b21('0x2a')](_0x171c0f['variable'])){if(this[_0x4b21('0x2a')](_0x171c0f[_0x4b21('0x69')][_0x4b21('0x75')])){this[_0x4b21('0x16')][_0x171c0f[_0x4b21('0x30')]]['sipcalllinkedid']=_0x171c0f[_0x4b21('0x6b')];}}}}}catch(_0x30d8a9){logger[_0x4b21('0x34')](_0x4b21('0x78'),util[_0x4b21('0x53')](_0x30d8a9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4b21('0x2d')]['syncHangup']=function(_0x34756e){try{if(this['isNotNull'](_0x34756e)){if(this[_0x4b21('0x16')][_0x34756e[_0x4b21('0x2f')]]){var _0x4d5d41=moment();this[_0x4b21('0x16')][_0x34756e[_0x4b21('0x2f')]]['endtime']=_0x4d5d41[_0x4b21('0x3f')](_0x4b21('0x38'));this[_0x4b21('0x16')][_0x34756e[_0x4b21('0x2f')]][_0x4b21('0x48')]=_0x4d5d41[_0x4b21('0x79')](this['channels'][_0x34756e[_0x4b21('0x2f')]][_0x4b21('0x37')],'seconds');if(this['channels'][_0x34756e['uniqueid']][_0x4b21('0x54')]){this[_0x4b21('0x16')][_0x34756e['uniqueid']][_0x4b21('0x7a')]=_0x4d5d41[_0x4b21('0x79')](this['channels'][_0x34756e[_0x4b21('0x2f')]][_0x4b21('0x55')],_0x4b21('0x4a'));this[_0x4b21('0x16')][_0x34756e[_0x4b21('0x2f')]][_0x4b21('0x7b')]=this['channels'][_0x34756e[_0x4b21('0x2f')]][_0x4b21('0x48')]-this['channels'][_0x34756e[_0x4b21('0x2f')]]['billableseconds'];}if(_0x34756e[_0x4b21('0x7c')]===_0x4b21('0x3c')){if(this[_0x4b21('0x17')][_0x34756e[_0x4b21('0x35')][_0x4b21('0x3d')]('-')[0x0]]){this['agents'][_0x34756e[_0x4b21('0x35')][_0x4b21('0x3d')]('-')[0x0]]=_[_0x4b21('0x7d')](this['agents'][_0x34756e[_0x4b21('0x35')]['split']('-')[0x0]],[_0x4b21('0x3e')]);this[_0x4b21('0x2c')](util[_0x4b21('0x3f')]('user:%s',this[_0x4b21('0x17')][_0x34756e['channel'][_0x4b21('0x3d')]('-')[0x0]][_0x4b21('0x41')]),_0x4b21('0x7e'),{'destaccountcode':this[_0x4b21('0x17')][_0x34756e[_0x4b21('0x35')][_0x4b21('0x3d')]('-')[0x0]][_0x4b21('0x43')]});}}ami[_0x4b21('0x2c')](_0x4b21('0x7f'),this['channels'][_0x34756e[_0x4b21('0x2f')]]);delete this[_0x4b21('0x16')][_0x34756e[_0x4b21('0x2f')]];}}}catch(_0xc52801){logger[_0x4b21('0x34')](_0x4b21('0x80'),util['inspect'](_0xc52801,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4b21('0x2d')][_0x4b21('0x23')]=function(_0x13a664){try{if(this[_0x4b21('0x2a')](_0x13a664)){if(this[_0x4b21('0x16')][_0x13a664[_0x4b21('0x81')]]){this[_0x4b21('0x16')][_0x13a664['transfereeuniqueid']][_0x4b21('0x82')]=_0x13a664[_0x4b21('0x83')];this[_0x4b21('0x16')][_0x13a664[_0x4b21('0x81')]]['transferconnectedlinenum']=_0x13a664[_0x4b21('0x84')];var _0x564761=this['channels'][_0x13a664[_0x4b21('0x85')]];this[_0x4b21('0x16')][_0x13a664['secondtransfereruniqueid']]=this[_0x4b21('0x16')][_0x13a664[_0x4b21('0x81')]];this[_0x4b21('0x16')][_0x13a664['transfereeuniqueid']]=_0x564761;}}}catch(_0x189215){logger[_0x4b21('0x34')](_0x4b21('0x86'),util[_0x4b21('0x53')](_0x189215,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4b21('0x2d')]['syncBlindTransfer']=function(_0x7f4c67){try{if(this[_0x4b21('0x2a')](_0x7f4c67)){if(this[_0x4b21('0x16')][_0x7f4c67[_0x4b21('0x81')]]){this[_0x4b21('0x16')][_0x7f4c67[_0x4b21('0x81')]]['transfercalleridnum']=_0x7f4c67[_0x4b21('0x87')];this[_0x4b21('0x16')][_0x7f4c67[_0x4b21('0x81')]][_0x4b21('0x88')]=_0x7f4c67[_0x4b21('0x89')];this['syncHangup']({'event':_0x4b21('0x8a'),'uniqueid':_0x7f4c67[_0x4b21('0x81')],'context':_0x7f4c67[_0x4b21('0x7c')],'channel':_0x7f4c67[_0x4b21('0x8b')]});}}}catch(_0x528a04){logger[_0x4b21('0x34')](_0x4b21('0x8c'),util[_0x4b21('0x53')](_0x528a04,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4b21('0x2d')][_0x4b21('0x26')]=function(_0x344853){try{if(this[_0x4b21('0x2a')](_0x344853)){if(this[_0x4b21('0x16')][_0x344853['uniqueid']]){if(!_[_0x4b21('0x8d')](this[_0x4b21('0x16')][_0x344853[_0x4b21('0x2f')]]['answertime'])){this['channels'][_0x344853[_0x4b21('0x2f')]][_0x4b21('0x8e')]=moment()[_0x4b21('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');}}}}catch(_0x5b32f8){logger[_0x4b21('0x34')](_0x4b21('0x8f'),util[_0x4b21('0x53')](_0x5b32f8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4b21('0x2d')]['syncMusicOnHoldStop']=function(_0x296238){try{if(this[_0x4b21('0x2a')](_0x296238)){if(this[_0x4b21('0x16')][_0x296238['uniqueid']]){if(!_[_0x4b21('0x8d')](this['channels'][_0x296238[_0x4b21('0x2f')]][_0x4b21('0x8e')])){this['channels'][_0x296238['uniqueid']][_0x4b21('0x90')]+=moment()[_0x4b21('0x91')](0x0)['diff'](this[_0x4b21('0x16')][_0x296238['uniqueid']][_0x4b21('0x8e')],_0x4b21('0x4a'));delete this[_0x4b21('0x16')][_0x296238[_0x4b21('0x2f')]][_0x4b21('0x8e')];}}}}catch(_0x8b6c3f){logger[_0x4b21('0x34')](_0x4b21('0x92'),util[_0x4b21('0x53')](_0x8b6c3f,{'showHidden':![],'depth':null}));}};module[_0x4b21('0x93')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index b91641d..fa514b9 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 _0x9214=['answered','holdtime','diff','starttime','sumBillable','billableseconds','sumDuration','custom:dialend','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','lodash','moment','util','../../../config/logger','ami','../ami','socket.io-emitter','localhost','channels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','syncVarSet','hangup','syncHangup','prototype','isNotNull','merge','uniqueid','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','emit','voice_outbound_channel:save','custom:dialbegin','error','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','format','voice:outbound','inspect','addVariable','keys','variable','value','isUndefined','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','endtime','duration','lastevent','complete','total'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x9214,0xaa));var _0x4921=function(_0x81fee8,_0x32f097){_0x81fee8=_0x81fee8-0x0;var _0x2b2c4e=_0x9214[_0x81fee8];return _0x2b2c4e;};'use strict';var _=require(_0x4921('0x0'));var moment=require(_0x4921('0x1'));var util=require(_0x4921('0x2'));var logger=require(_0x4921('0x3'))(_0x4921('0x4'));var ami=require(_0x4921('0x5'));var io=require(_0x4921('0x6'))({'host':_0x4921('0x7'),'port':0x18eb});function VoiceDialReport(_0x1cb841){this[_0x4921('0x8')]=_0x1cb841['outboundChannels'];this[_0x4921('0x9')]=_0x1cb841[_0x4921('0x9')];this[_0x4921('0xa')]={};ami['on'](_0x4921('0xb'),this[_0x4921('0xc')][_0x4921('0xd')](this));ami['on'](_0x4921('0xe'),this[_0x4921('0xf')][_0x4921('0xd')](this));ami['on']('varset',this[_0x4921('0x10')]['bind'](this));ami['on'](_0x4921('0x11'),this[_0x4921('0x12')][_0x4921('0xd')](this));}VoiceDialReport[_0x4921('0x13')]['isNotNull']=function(_0x22b7ed){return _0x22b7ed!==null&&!_['isUndefined'](_0x22b7ed);};VoiceDialReport[_0x4921('0x13')]['emit']=function(_0xfc467d,_0xf6d825,_0x50303b){io['to'](_0xfc467d)['emit'](_0xf6d825,_0x50303b);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x6cb4a){try{if(this[_0x4921('0x14')](_0x6cb4a)){if(this[_0x4921('0x8')][_0x6cb4a['uniqueid']]){_[_0x4921('0x15')](this['channels'][_0x6cb4a[_0x4921('0x16')]],{'starttime':moment()['format'](_0x4921('0x17')),'lastevent':_0x4921('0x18'),'interface':_0x6cb4a[_0x4921('0x19')][_0x4921('0x1a')](0x0,_0x6cb4a[_0x4921('0x19')]['lastIndexOf']('-')),'membername':_0x6cb4a[_0x4921('0x19')][_0x4921('0x1a')](_0x6cb4a['channel']['lastIndexOf']('/')+0x1,_0x6cb4a['channel'][_0x4921('0x1b')]('-'))},_[_0x4921('0x1c')](_0x6cb4a,[_0x4921('0x1d'),_0x4921('0x1e')]));this[_0x4921('0x1f')]('voice:outbound',_0x4921('0x20'),this['channels'][_0x6cb4a[_0x4921('0x16')]]);ami['emit'](_0x4921('0x21'),this['channels'][_0x6cb4a[_0x4921('0x16')]]);}}}catch(_0x5948ab){logger[_0x4921('0x22')]('[syncDialBegin][VoiceDialReport]',util['inspect'](_0x5948ab,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4921('0x13')][_0x4921('0xf')]=function(_0x4340cb){try{if(this[_0x4921('0x14')](_0x4340cb)){if(this[_0x4921('0x8')][_0x4340cb[_0x4921('0x16')]]){this['channels'][_0x4340cb[_0x4921('0x16')]][_0x4921('0x23')]=_0x4340cb[_0x4921('0x23')];if(_0x4340cb[_0x4921('0x23')]===_0x4921('0x24')){this[_0x4921('0x8')][_0x4340cb[_0x4921('0x16')]][_0x4921('0x25')]=_0x4340cb[_0x4921('0x25')];this['channels'][_0x4340cb[_0x4921('0x16')]][_0x4921('0x26')]=_0x4340cb[_0x4921('0x26')];this[_0x4921('0x8')][_0x4340cb['uniqueid']][_0x4921('0x27')]=moment()[_0x4921('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4921('0x8')][_0x4340cb[_0x4921('0x16')]]['lastevent']='connect';ami['emit']('custom:dialconnect',this['channels'][_0x4340cb[_0x4921('0x16')]]);}this[_0x4921('0x1f')](_0x4921('0x29'),_0x4921('0x20'),this[_0x4921('0x8')][_0x4340cb[_0x4921('0x16')]]);}}}catch(_0x2d402d){logger[_0x4921('0x22')]('[syncDialEnd][VoiceDialReport]',util[_0x4921('0x2a')](_0x2d402d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4921('0x13')][_0x4921('0x10')]=function(_0x2d4aa3){try{if(this[_0x4921('0x14')](_0x2d4aa3)){this[_0x4921('0x2b')](_0x2d4aa3['uniqueid'],_[_0x4921('0x2c')](_0x2d4aa3[_0x4921('0x2d')])[0x0],_0x2d4aa3[_0x4921('0x2e')]);if(this['isNotNull'](_0x2d4aa3[_0x4921('0x2d')])&&this[_0x4921('0x14')](_0x2d4aa3['variable']['outboundrouteid'])){if(_[_0x4921('0x2f')](this['channels'][_0x2d4aa3[_0x4921('0x16')]])){this['channels'][_0x2d4aa3[_0x4921('0x16')]]={'routeId':_0x2d4aa3[_0x4921('0x2e')],'variables':this['variables'][_0x2d4aa3['uniqueid']]};this['emit']('voice:outbound','voice_outbound_channel:save',this['channels'][_0x2d4aa3[_0x4921('0x16')]]);}}}}catch(_0x669a8a){logger[_0x4921('0x22')](_0x4921('0x30'),util[_0x4921('0x2a')](_0x669a8a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4921('0x13')][_0x4921('0x2b')]=function(_0x1e5078,_0x115a38,_0x2fad67){var _0x225d11=[_0x4921('0x31'),'rtpaudioqosbridged',_0x4921('0x32'),_0x4921('0x33'),_0x4921('0x34'),'rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged',_0x4921('0x35'),_0x4921('0x36'),_0x4921('0x37'),_0x4921('0x38'),_0x4921('0x39'),_0x4921('0x3a'),_0x4921('0x3b'),_0x4921('0x3c'),_0x4921('0x3d'),_0x4921('0x3e'),_0x4921('0x3f')];if(!_[_0x4921('0x40')](_0x115a38)&&!_['includes'](_0x225d11,_0x115a38)){if(_[_0x4921('0x2f')](this['variables'][_0x1e5078])){this[_0x4921('0xa')][_0x1e5078]={};}this[_0x4921('0xa')][_0x1e5078][_0x115a38]=_0x2fad67;}};VoiceDialReport[_0x4921('0x13')][_0x4921('0x12')]=function(_0x156619){try{if(this[_0x4921('0x14')](_0x156619)){if(this[_0x4921('0x8')][_0x156619[_0x4921('0x16')]]){this[_0x4921('0x8')][_0x156619[_0x4921('0x16')]][_0x4921('0x41')]=moment()[_0x4921('0x28')](_0x4921('0x17'));this[_0x4921('0x8')][_0x156619[_0x4921('0x16')]][_0x4921('0x42')]=moment(this[_0x4921('0x8')][_0x156619[_0x4921('0x16')]][_0x4921('0x41')])['diff'](this['channels'][_0x156619['uniqueid']]['starttime'],'seconds');this['channels'][_0x156619['uniqueid']][_0x4921('0x43')]=_0x4921('0x44');this[_0x4921('0x9')][_0x4921('0x45')]+=0x1;if(this['channels'][_0x156619[_0x4921('0x16')]][_0x4921('0x27')]){this[_0x4921('0x9')][_0x4921('0x46')]+=0x1;this[_0x4921('0x8')][_0x156619[_0x4921('0x16')]][_0x4921('0x47')]=moment(this[_0x4921('0x8')][_0x156619[_0x4921('0x16')]][_0x4921('0x27')])[_0x4921('0x48')](this['channels'][_0x156619[_0x4921('0x16')]][_0x4921('0x49')],'seconds');this[_0x4921('0x8')][_0x156619[_0x4921('0x16')]]['billableseconds']=moment(this[_0x4921('0x8')][_0x156619[_0x4921('0x16')]][_0x4921('0x41')])[_0x4921('0x48')](this[_0x4921('0x8')][_0x156619[_0x4921('0x16')]][_0x4921('0x27')],'seconds');this[_0x4921('0x9')]['sumHoldTime']+=this[_0x4921('0x8')][_0x156619[_0x4921('0x16')]][_0x4921('0x47')]||0x0;this[_0x4921('0x9')][_0x4921('0x4a')]+=this[_0x4921('0x8')][_0x156619['uniqueid']][_0x4921('0x4b')];}this[_0x4921('0x9')][_0x4921('0x4c')]+=this[_0x4921('0x8')][_0x156619[_0x4921('0x16')]][_0x4921('0x42')];ami[_0x4921('0x1f')]('custom:voiceDialReport',this[_0x4921('0x8')][_0x156619['uniqueid']]);ami[_0x4921('0x1f')](_0x4921('0x4d'),this[_0x4921('0x8')][_0x156619['uniqueid']]);this['emit'](_0x4921('0x29'),'voice_outbound:save',this[_0x4921('0x9')]);this[_0x4921('0x1f')](_0x4921('0x29'),_0x4921('0x4e'),this['channels'][_0x156619['uniqueid']]);delete this[_0x4921('0x8')][_0x156619[_0x4921('0x16')]];}if(this['variables'][_0x156619[_0x4921('0x16')]]){delete this[_0x4921('0xa')][_0x156619[_0x4921('0x16')]];}}}catch(_0x1727f1){logger[_0x4921('0x22')](_0x4921('0x4f'),util[_0x4921('0x2a')](_0x1727f1,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0xa058=['voice_outbound:save','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','lodash','util','../../../config/logger','ami','../ami','socket.io-emitter','localhost','channels','outboundChannels','outbound','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','hangup','syncHangup','prototype','isUndefined','emit','isNotNull','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','event','privilege','voice:outbound','custom:dialbegin','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','connectedlinenum','connectedlinename','lastevent','connect','custom:dialconnect','voice_outbound_channel:save','error','syncVarSet','addVariable','keys','variable','outboundrouteid','value','variables','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','endtime','starttime','seconds','complete','total','answertime','answered','holdtime','diff','billableseconds','sumHoldTime','sumDuration','duration','custom:voiceDialReport','custom:dialend'];(function(_0x55a3e7,_0xfc513d){var _0x3ebd92=function(_0x61c51c){while(--_0x61c51c){_0x55a3e7['push'](_0x55a3e7['shift']());}};_0x3ebd92(++_0xfc513d);}(_0xa058,0x103));var _0x8a05=function(_0xb66df,_0x4fb5ce){_0xb66df=_0xb66df-0x0;var _0x42a702=_0xa058[_0xb66df];return _0x42a702;};'use strict';var _=require(_0x8a05('0x0'));var moment=require('moment');var util=require(_0x8a05('0x1'));var logger=require(_0x8a05('0x2'))(_0x8a05('0x3'));var ami=require(_0x8a05('0x4'));var io=require(_0x8a05('0x5'))({'host':_0x8a05('0x6'),'port':0x18eb});function VoiceDialReport(_0x314a1b){this[_0x8a05('0x7')]=_0x314a1b[_0x8a05('0x8')];this[_0x8a05('0x9')]=_0x314a1b[_0x8a05('0x9')];this['variables']={};ami['on'](_0x8a05('0xa'),this[_0x8a05('0xb')][_0x8a05('0xc')](this));ami['on'](_0x8a05('0xd'),this[_0x8a05('0xe')][_0x8a05('0xc')](this));ami['on'](_0x8a05('0xf'),this['syncVarSet'][_0x8a05('0xc')](this));ami['on'](_0x8a05('0x10'),this[_0x8a05('0x11')][_0x8a05('0xc')](this));}VoiceDialReport[_0x8a05('0x12')]['isNotNull']=function(_0x2276e1){return _0x2276e1!==null&&!_[_0x8a05('0x13')](_0x2276e1);};VoiceDialReport[_0x8a05('0x12')][_0x8a05('0x14')]=function(_0x53f3b5,_0x44ea09,_0x2ac2c3){io['to'](_0x53f3b5)[_0x8a05('0x14')](_0x44ea09,_0x2ac2c3);};VoiceDialReport[_0x8a05('0x12')]['syncDialBegin']=function(_0x477641){try{if(this[_0x8a05('0x15')](_0x477641)){if(this[_0x8a05('0x7')][_0x477641[_0x8a05('0x16')]]){_[_0x8a05('0x17')](this[_0x8a05('0x7')][_0x477641[_0x8a05('0x16')]],{'starttime':moment()[_0x8a05('0x18')](_0x8a05('0x19')),'lastevent':'called','interface':_0x477641[_0x8a05('0x1a')][_0x8a05('0x1b')](0x0,_0x477641[_0x8a05('0x1a')][_0x8a05('0x1c')]('-')),'membername':_0x477641[_0x8a05('0x1a')][_0x8a05('0x1b')](_0x477641[_0x8a05('0x1a')]['lastIndexOf']('/')+0x1,_0x477641[_0x8a05('0x1a')][_0x8a05('0x1c')]('-'))},_['omit'](_0x477641,[_0x8a05('0x1d'),_0x8a05('0x1e')]));this['emit'](_0x8a05('0x1f'),'voice_outbound_channel:save',this['channels'][_0x477641['uniqueid']]);ami[_0x8a05('0x14')](_0x8a05('0x20'),this[_0x8a05('0x7')][_0x477641[_0x8a05('0x16')]]);}}}catch(_0x56a20b){logger['error'](_0x8a05('0x21'),util[_0x8a05('0x22')](_0x56a20b,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8a05('0x12')][_0x8a05('0xe')]=function(_0x18906c){try{if(this[_0x8a05('0x15')](_0x18906c)){if(this[_0x8a05('0x7')][_0x18906c[_0x8a05('0x16')]]){this[_0x8a05('0x7')][_0x18906c['uniqueid']][_0x8a05('0x23')]=_0x18906c[_0x8a05('0x23')];if(_0x18906c[_0x8a05('0x23')]==='ANSWER'){this['channels'][_0x18906c[_0x8a05('0x16')]]['connectedlinenum']=_0x18906c[_0x8a05('0x24')];this[_0x8a05('0x7')][_0x18906c['uniqueid']][_0x8a05('0x25')]=_0x18906c['connectedlinename'];this[_0x8a05('0x7')][_0x18906c['uniqueid']]['answertime']=moment()[_0x8a05('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x18906c[_0x8a05('0x16')]][_0x8a05('0x26')]=_0x8a05('0x27');ami[_0x8a05('0x14')](_0x8a05('0x28'),this[_0x8a05('0x7')][_0x18906c[_0x8a05('0x16')]]);}this['emit']('voice:outbound',_0x8a05('0x29'),this[_0x8a05('0x7')][_0x18906c[_0x8a05('0x16')]]);}}}catch(_0x189e4e){logger[_0x8a05('0x2a')]('[syncDialEnd][VoiceDialReport]',util[_0x8a05('0x22')](_0x189e4e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8a05('0x12')][_0x8a05('0x2b')]=function(_0x1ce429){try{if(this[_0x8a05('0x15')](_0x1ce429)){this[_0x8a05('0x2c')](_0x1ce429[_0x8a05('0x16')],_[_0x8a05('0x2d')](_0x1ce429[_0x8a05('0x2e')])[0x0],_0x1ce429['value']);if(this['isNotNull'](_0x1ce429[_0x8a05('0x2e')])&&this[_0x8a05('0x15')](_0x1ce429[_0x8a05('0x2e')][_0x8a05('0x2f')])){if(_[_0x8a05('0x13')](this[_0x8a05('0x7')][_0x1ce429[_0x8a05('0x16')]])){this[_0x8a05('0x7')][_0x1ce429[_0x8a05('0x16')]]={'routeId':_0x1ce429[_0x8a05('0x30')],'variables':this[_0x8a05('0x31')][_0x1ce429[_0x8a05('0x16')]]};this['emit']('voice:outbound','voice_outbound_channel:save',this[_0x8a05('0x7')][_0x1ce429[_0x8a05('0x16')]]);}}}}catch(_0x274e25){logger[_0x8a05('0x2a')](_0x8a05('0x32'),util[_0x8a05('0x22')](_0x274e25,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8a05('0x12')][_0x8a05('0x2c')]=function(_0x205f10,_0x3a53f4,_0x3a7ab9){var _0x23a03a=[_0x8a05('0x33'),_0x8a05('0x34'),'rtpaudioqosjitter',_0x8a05('0x35'),_0x8a05('0x36'),_0x8a05('0x37'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x8a05('0x38'),'sipuri',_0x8a05('0x39'),_0x8a05('0x3a'),_0x8a05('0x3b'),_0x8a05('0x3c'),_0x8a05('0x3d'),_0x8a05('0x3e'),_0x8a05('0x3f'),_0x8a05('0x40'),_0x8a05('0x41')];if(!_['isNil'](_0x3a53f4)&&!_['includes'](_0x23a03a,_0x3a53f4)){if(_[_0x8a05('0x13')](this[_0x8a05('0x31')][_0x205f10])){this[_0x8a05('0x31')][_0x205f10]={};}this['variables'][_0x205f10][_0x3a53f4]=_0x3a7ab9;}};VoiceDialReport['prototype'][_0x8a05('0x11')]=function(_0x36e64d){try{if(this['isNotNull'](_0x36e64d)){if(this[_0x8a05('0x7')][_0x36e64d[_0x8a05('0x16')]]){this[_0x8a05('0x7')][_0x36e64d['uniqueid']]['endtime']=moment()[_0x8a05('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8a05('0x7')][_0x36e64d['uniqueid']]['duration']=moment(this[_0x8a05('0x7')][_0x36e64d[_0x8a05('0x16')]][_0x8a05('0x42')])['diff'](this[_0x8a05('0x7')][_0x36e64d['uniqueid']][_0x8a05('0x43')],_0x8a05('0x44'));this[_0x8a05('0x7')][_0x36e64d['uniqueid']][_0x8a05('0x26')]=_0x8a05('0x45');this[_0x8a05('0x9')][_0x8a05('0x46')]+=0x1;if(this[_0x8a05('0x7')][_0x36e64d[_0x8a05('0x16')]][_0x8a05('0x47')]){this[_0x8a05('0x9')][_0x8a05('0x48')]+=0x1;this[_0x8a05('0x7')][_0x36e64d[_0x8a05('0x16')]][_0x8a05('0x49')]=moment(this['channels'][_0x36e64d[_0x8a05('0x16')]][_0x8a05('0x47')])[_0x8a05('0x4a')](this['channels'][_0x36e64d[_0x8a05('0x16')]]['starttime'],_0x8a05('0x44'));this[_0x8a05('0x7')][_0x36e64d[_0x8a05('0x16')]][_0x8a05('0x4b')]=moment(this[_0x8a05('0x7')][_0x36e64d[_0x8a05('0x16')]][_0x8a05('0x42')])['diff'](this[_0x8a05('0x7')][_0x36e64d[_0x8a05('0x16')]][_0x8a05('0x47')],'seconds');this['outbound'][_0x8a05('0x4c')]+=this['channels'][_0x36e64d[_0x8a05('0x16')]][_0x8a05('0x49')]||0x0;this['outbound']['sumBillable']+=this[_0x8a05('0x7')][_0x36e64d[_0x8a05('0x16')]][_0x8a05('0x4b')];}this[_0x8a05('0x9')][_0x8a05('0x4d')]+=this['channels'][_0x36e64d[_0x8a05('0x16')]][_0x8a05('0x4e')];ami[_0x8a05('0x14')](_0x8a05('0x4f'),this['channels'][_0x36e64d['uniqueid']]);ami['emit'](_0x8a05('0x50'),this[_0x8a05('0x7')][_0x36e64d[_0x8a05('0x16')]]);this[_0x8a05('0x14')]('voice:outbound',_0x8a05('0x51'),this[_0x8a05('0x9')]);this[_0x8a05('0x14')](_0x8a05('0x1f'),_0x8a05('0x52'),this[_0x8a05('0x7')][_0x36e64d[_0x8a05('0x16')]]);delete this[_0x8a05('0x7')][_0x36e64d['uniqueid']];}if(this['variables'][_0x36e64d['uniqueid']]){delete this[_0x8a05('0x31')][_0x36e64d[_0x8a05('0x16')]];}}}catch(_0x3202a9){logger[_0x8a05('0x2a')](_0x8a05('0x53'),util['inspect'](_0x3202a9,{'showHidden':![],'depth':null}));}};module[_0x8a05('0x54')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 4cd4c0c..104d396 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 _0xa2bd=['then','queue','countBy','toNumber','callers','waiting','loggedin','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','uniqueid','position','count','merge','pick','keys','[syncQueueCallerJoin][VoiceQueueReport]','last','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitreason','ABANDONED','lastAssignedTo','[syncQueueCallerAbandon][VoiceQueueReport]','syncQueueCallerLeave','queuecallerleaveAt','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','queuecallerabandon','assigned','startsWith','interface','toLowerCase','sip/','transfer','queuecallerexitAt','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','accountcode','fullname','queuecallercomplete','queuecallercompleteAt','reason','COMPLETEDBY','toUpperCase','[syncAgentComplete][VoiceQueueReport]','syncVarSet','addVariable','variable','queuestatus','value','CONTINUE','queuecallerexit','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','includes','length','diff','queuecallerjoinAt','seconds','milliseconds','lastevent','abandoned','custom:queuecallerabandon','custom:queuecallerunmanaged','sumDuration','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDED','[syncAttendedTransfer][VoiceQueueReport]','BLINDTRANSFER','extension','[syncBlindTransfer][VoiceQueueReport]','syncMusicOnHoldStart','syncMusicOnHoldStop','mohstarttime','mohtime','exports','lodash','moment','bluebird','util','md5','ami','../ami','../model/queueReport','socket.io-emitter','localhost','prototype','enqueue','tail','finally','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','syncQueueCallerAbandon','queuecallerleave','agentcomplete','syncAgentComplete','varset','hangup','syncHangup','musiconholdstart','musiconholdstop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopQueueShow','isUndefined','isEmpty','hasOwnProperty','originated','talking','pTalking','unlockRR','clearZombieChannels','isNil','Action','channel','catch','message','No\x20such\x20channel','[voiceQueueReport][checkChannel]','error','[voiceQueueReport][checkQueueReport]','[voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','inspect','emit','emitVoiceQueueChannelSave','format','voice_queue_channel:save','emitVoiceQueueSummary','inbound','name','answered','available','loggedIn','sumBillable','sumHoldTime','total','type','unmanaged','Trunk','active','callerid','Interval','stringify','voice_queue:save','isNotNull','queues','loopQueueSummary'];(function(_0x22d5b3,_0x29b437){var _0x42e583=function(_0x109a6d){while(--_0x109a6d){_0x22d5b3['push'](_0x22d5b3['shift']());}};_0x42e583(++_0x29b437);}(_0xa2bd,0x125));var _0xda2b=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0xa2bd[_0x4b174a];return _0x3cd7bf;};'use strict';var _=require(_0xda2b('0x0'));var moment=require(_0xda2b('0x1'));var BPromise=require(_0xda2b('0x2'));var util=require(_0xda2b('0x3'));var md5=require(_0xda2b('0x4'));var logger=require('../../../config/logger')(_0xda2b('0x5'));var ami=require(_0xda2b('0x6'));var QueueReport=require(_0xda2b('0x7'));var io=require(_0xda2b('0x8'))({'host':_0xda2b('0x9'),'port':0x18eb});var Sequence=function(){};Sequence[_0xda2b('0xa')][_0xda2b('0xb')]=function(_0x15d3ee){this[_0xda2b('0xc')]=this['tail']?this[_0xda2b('0xc')][_0xda2b('0xd')](_0x15d3ee):_0x15d3ee();};function VoiceQueueReport(_0x13dcb4){this[_0xda2b('0xe')]=new Sequence();this[_0xda2b('0xf')]={};this['agents']=_0x13dcb4[_0xda2b('0x10')];this[_0xda2b('0x11')]=_0x13dcb4[_0xda2b('0x12')];this[_0xda2b('0x13')]=_0x13dcb4['voiceQueues'];this[_0xda2b('0x14')]=!![];this[_0xda2b('0x15')]=_0x13dcb4[_0xda2b('0x15')];this[_0xda2b('0x16')]={};ami['on'](_0xda2b('0x17'),this[_0xda2b('0x18')][_0xda2b('0x19')](this));ami['on'](_0xda2b('0x1a'),this[_0xda2b('0x1b')][_0xda2b('0x19')](this));ami['on'](_0xda2b('0x1c'),this[_0xda2b('0x1d')][_0xda2b('0x19')](this));ami['on']('queuecallerabandon',this[_0xda2b('0x1e')][_0xda2b('0x19')](this));ami['on'](_0xda2b('0x1f'),this['syncQueueCallerLeave']['bind'](this));ami['on'](_0xda2b('0x20'),this[_0xda2b('0x21')][_0xda2b('0x19')](this));ami['on'](_0xda2b('0x22'),this['syncVarSet']['bind'](this));ami['on'](_0xda2b('0x23'),this[_0xda2b('0x24')][_0xda2b('0x19')](this));ami['on']('fullybooted',this['syncFullyBooted'][_0xda2b('0x19')](this));ami['on'](_0xda2b('0x25'),this['syncMusicOnHoldStart'][_0xda2b('0x19')](this));ami['on'](_0xda2b('0x26'),this['syncMusicOnHoldStop'][_0xda2b('0x19')](this));ami['on'](_0xda2b('0x27'),this[_0xda2b('0x28')][_0xda2b('0x19')](this));ami['on']('blindtransfer',this[_0xda2b('0x29')][_0xda2b('0x19')](this));this['loopQueueSummary']();this[_0xda2b('0x2a')]();}function isNotNull(_0x377504){return _0x377504!==null&&!_[_0xda2b('0x2b')](_0x377504);}function clearChannels(_0x7baa38){if(!_[_0xda2b('0x2c')](_0x7baa38)){for(var _0x26d006 in _0x7baa38){if(_0x7baa38[_0xda2b('0x2d')](_0x26d006)){delete _0x7baa38[_0x26d006];}}}}function clearCampaigns(_0x527e54){if(!_[_0xda2b('0x2c')](_0x527e54)){for(var _0x50e6d4 in _0x527e54){if(_0x527e54['hasOwnProperty'](_0x50e6d4)){_0x527e54[_0x50e6d4]['originated']=0x0;}}}}function clearVoiceQueues(_0x3d7ade){if(!_[_0xda2b('0x2c')](_0x3d7ade)){for(var _0x15a0b4 in _0x3d7ade){if(_0x3d7ade['hasOwnProperty'](_0x15a0b4)){_0x3d7ade[_0x15a0b4][_0xda2b('0x2e')]=0x0;_0x3d7ade[_0x15a0b4][_0xda2b('0x2f')]=0x0;_0x3d7ade[_0x15a0b4][_0xda2b('0x30')]=0x0;_0x3d7ade[_0x15a0b4]['waiting']=0x0;_0x3d7ade[_0x15a0b4]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x325945){if(!_[_0xda2b('0x2c')](_0x325945)){for(var _0x5a89bc in _0x325945){if(_0x325945[_0xda2b('0x2d')](_0x5a89bc)){_0x325945[_0x5a89bc][_0xda2b('0x31')]=!![];}}}}VoiceQueueReport[_0xda2b('0xa')][_0xda2b('0x32')]=function(){var _0x53eb7e=this;for(var _0x48ba5f in this[_0xda2b('0x11')]){if(this[_0xda2b('0x11')][_0xda2b('0x2d')](_0x48ba5f)){this[_0xda2b('0xe')]['enqueue'](function(){if(!_[_0xda2b('0x33')](_0x53eb7e[_0xda2b('0x11')][_0x48ba5f])){return ami[_0xda2b('0x34')]({'action':'status','channel':_0x53eb7e[_0xda2b('0x11')][_0x48ba5f][_0xda2b('0x35')]})[_0xda2b('0x36')](function(_0x670bf5){if(_0x670bf5[_0xda2b('0x37')]===_0xda2b('0x38')){setTimeout(function(){if(_0x53eb7e[_0xda2b('0x11')][_0x48ba5f]){delete _0x53eb7e[_0xda2b('0x11')][_0x48ba5f];logger['error'](_0xda2b('0x39'),_0x48ba5f);}if(_0x53eb7e['queueReports'][_0x48ba5f]){delete _0x53eb7e[_0xda2b('0xf')][_0x48ba5f];logger[_0xda2b('0x3a')](_0xda2b('0x3b'),_0x48ba5f);}if(_0x53eb7e[_0xda2b('0x16')][_0x48ba5f]){delete _0x53eb7e['variables'][_0x48ba5f];logger[_0xda2b('0x3a')](_0xda2b('0x3c'),_0x48ba5f);}},0x1f40);}});}});}}};VoiceQueueReport[_0xda2b('0xa')]['syncFullyBooted']=function(){logger[_0xda2b('0x3a')](_0xda2b('0x3d'));clearChannels(this[_0xda2b('0x11')]);this[_0xda2b('0x3e')](this[_0xda2b('0xf')]);clearAgentBooked(this[_0xda2b('0x10')]);clearVoiceQueues(this[_0xda2b('0x13')]);clearCampaigns(this[_0xda2b('0x15')]);};VoiceQueueReport[_0xda2b('0xa')][_0xda2b('0x3e')]=function(_0x1a9509){var _0x122e02=this;if(!_[_0xda2b('0x2c')](_0x1a9509)){for(var _0x212998 in _0x1a9509){if(_0x1a9509['hasOwnProperty'](_0x212998)){_0x122e02[_0xda2b('0x3f')](_0x1a9509[_0x212998]);delete _0x1a9509[_0x212998];}}}};function loggerCatch(_0x1a4a04){return function(_0xaee9b6){logger[_0xda2b('0x3a')](_0x1a4a04,util[_0xda2b('0x40')](_0xaee9b6,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0xda2b('0xa')][_0xda2b('0x41')]=function(_0x4803c4,_0x88655b,_0x239e26){io['to'](_0x4803c4)[_0xda2b('0x41')](_0x88655b,_0x239e26);};VoiceQueueReport[_0xda2b('0xa')][_0xda2b('0x42')]=function(_0x29357e){this[_0xda2b('0x41')](util[_0xda2b('0x43')]('voice:queue:%s',_0x29357e['name']),_0xda2b('0x44'),_0x29357e);};VoiceQueueReport[_0xda2b('0xa')][_0xda2b('0x3f')]=function(_0x11cc0d){this['emit'](util[_0xda2b('0x43')]('voice:queue:%s',_0x11cc0d['name']),'voice_queue_channel:remove',_0x11cc0d);};VoiceQueueReport[_0xda2b('0xa')][_0xda2b('0x45')]=function(_0x510ee6){if(_0x510ee6['type']===_0xda2b('0x46')){var _0x2603d0={'id':_0x510ee6['id'],'name':_0x510ee6[_0xda2b('0x47')],'strategy':_0x510ee6['strategy'],'answered':_0x510ee6[_0xda2b('0x48')],'available':_0x510ee6[_0xda2b('0x49')],'loggedIn':_0x510ee6[_0xda2b('0x4a')],'pTalking':_0x510ee6['pTalking'],'sumBillable':_0x510ee6[_0xda2b('0x4b')],'sumDuration':_0x510ee6['sumDuration'],'sumHoldTime':_0x510ee6[_0xda2b('0x4c')]||0x0,'talking':_0x510ee6[_0xda2b('0x2f')],'total':_0x510ee6[_0xda2b('0x4d')],'type':_0x510ee6[_0xda2b('0x4e')],'unmanaged':_0x510ee6[_0xda2b('0x4f')],'waiting':_0x510ee6['waiting']};if(_0x510ee6[_0xda2b('0x50')]){_0x2603d0[_0xda2b('0x50')]={'id':_0x510ee6['Trunk']['id'],'name':_0x510ee6[_0xda2b('0x50')][_0xda2b('0x47')],'active':_0x510ee6[_0xda2b('0x50')][_0xda2b('0x51')],'callerid':_0x510ee6['Trunk'][_0xda2b('0x52')]};}if(_0x510ee6['Interval']){_0x2603d0['Interval']={'id':_0x510ee6[_0xda2b('0x53')]['id'],'name':_0x510ee6[_0xda2b('0x53')][_0xda2b('0x47')]};}var _0x56cc13=md5(JSON[_0xda2b('0x54')](_0x2603d0));if(_0x510ee6[_0xda2b('0x4')]!==_0x56cc13){_0x510ee6[_0xda2b('0x4')]=_0x56cc13;this[_0xda2b('0x41')](util[_0xda2b('0x43')]('voice:queue:%s',_0x2603d0[_0xda2b('0x47')]),_0xda2b('0x55'),_0x2603d0);}}};VoiceQueueReport[_0xda2b('0xa')][_0xda2b('0x56')]=function(_0x170346){return _0x170346!==null&&!_[_0xda2b('0x2b')](_0x170346);};VoiceQueueReport[_0xda2b('0xa')]['loopQueueShow']=function(){var _0x26b433=this;setInterval(function(){_0x26b433[_0xda2b('0x32')]();ami[_0xda2b('0x34')]({'action':_0xda2b('0x57')})[_0xda2b('0x36')](loggerCatch('[queues]'));},0x2710);};VoiceQueueReport[_0xda2b('0xa')][_0xda2b('0x58')]=function(){var _0x59a2b7=this;setInterval(function(){if(_0x59a2b7[_0xda2b('0x14')]){return ami[_0xda2b('0x34')]({'action':_0xda2b('0x17')})[_0xda2b('0x59')](function(_0x5e6390){_0x59a2b7[_0xda2b('0x14')]=![];})[_0xda2b('0x36')](loggerCatch('[queuesummary]'));}},0x3e8);};VoiceQueueReport['prototype'][_0xda2b('0x18')]=function(_0x3a6eb2){try{if(this[_0xda2b('0x56')](_0x3a6eb2)&&this[_0xda2b('0x56')](_0x3a6eb2['queue'])){if(this[_0xda2b('0x13')][_0x3a6eb2[_0xda2b('0x5a')]]){var _0x5d27c6=_[_0xda2b('0x5b')](this[_0xda2b('0x11')],'queue')[_0x3a6eb2[_0xda2b('0x5a')]]||0x0;var _0x115ae9=_0x5d27c6-_0x3a6eb2['callers'];if(this['voiceQueues'][_0x3a6eb2['queue']]['waiting']!==_[_0xda2b('0x5c')](_0x3a6eb2[_0xda2b('0x5d')])||this[_0xda2b('0x13')][_0x3a6eb2['queue']][_0xda2b('0x4a')]!==_[_0xda2b('0x5c')](_0x3a6eb2['loggedin'])||this[_0xda2b('0x13')][_0x3a6eb2[_0xda2b('0x5a')]][_0xda2b('0x49')]!==_[_0xda2b('0x5c')](_0x3a6eb2[_0xda2b('0x49')])||this[_0xda2b('0x13')][_0x3a6eb2['queue']]['talking']!==_0x115ae9){this['voiceQueues'][_0x3a6eb2[_0xda2b('0x5a')]][_0xda2b('0x5e')]=_[_0xda2b('0x5c')](_0x3a6eb2[_0xda2b('0x5d')]);this[_0xda2b('0x13')][_0x3a6eb2[_0xda2b('0x5a')]][_0xda2b('0x4a')]=_[_0xda2b('0x5c')](_0x3a6eb2[_0xda2b('0x5f')]);this[_0xda2b('0x13')][_0x3a6eb2[_0xda2b('0x5a')]]['available']=_[_0xda2b('0x5c')](_0x3a6eb2[_0xda2b('0x49')]);this[_0xda2b('0x13')][_0x3a6eb2[_0xda2b('0x5a')]][_0xda2b('0x2f')]=_0x115ae9>0x0?_0x115ae9:0x0;this[_0xda2b('0x13')][_0x3a6eb2['queue']][_0xda2b('0x2f')]=this[_0xda2b('0x13')][_0x3a6eb2[_0xda2b('0x5a')]][_0xda2b('0x2f')]>_[_0xda2b('0x5c')](_0x3a6eb2[_0xda2b('0x5f')])?_[_0xda2b('0x5c')](_0x3a6eb2[_0xda2b('0x5f')]):this[_0xda2b('0x13')][_0x3a6eb2['queue']][_0xda2b('0x2f')];this[_0xda2b('0x45')](this[_0xda2b('0x13')][_0x3a6eb2[_0xda2b('0x5a')]]);}ami[_0xda2b('0x41')](_0xda2b('0x60'),this[_0xda2b('0x13')][_0x3a6eb2[_0xda2b('0x5a')]]);}}}catch(_0x1b6a00){logger[_0xda2b('0x3a')](_0xda2b('0x61'),util[_0xda2b('0x40')](_0x1b6a00,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xda2b('0xa')][_0xda2b('0x1b')]=function(_0xc291c0){this['flagQueueSummary']=!![];};VoiceQueueReport['prototype']['syncNewExten']=function(_0x4a07f8){};VoiceQueueReport[_0xda2b('0xa')][_0xda2b('0x1d')]=function(_0x14b521){try{if(this[_0xda2b('0x56')](_0x14b521)){if(_['isUndefined'](this[_0xda2b('0xf')][_0x14b521['uniqueid']])){this['queueReports'][_0x14b521[_0xda2b('0x62')]]=[];this[_0xda2b('0x11')][_0x14b521[_0xda2b('0x62')]]={};}var _0xc375e2=new QueueReport();_0xc375e2[_0xda2b('0x47')]=_0x14b521[_0xda2b('0x5a')];_0xc375e2['type']=this['voiceQueues'][_0xc375e2['name']]&&this['voiceQueues'][_0xc375e2['name']]['type']?this[_0xda2b('0x13')][_0xc375e2[_0xda2b('0x47')]][_0xda2b('0x4e')]||_0xda2b('0x46'):'inbound';_0xc375e2[_0xda2b('0x5a')]=_0x14b521[_0xda2b('0x5a')];_0xc375e2['queuecallerjoinAt']=moment()[_0xda2b('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0xc375e2[_0xda2b('0x63')]=_0x14b521[_0xda2b('0x63')];_0xc375e2[_0xda2b('0x64')]=_0x14b521[_0xda2b('0x64')];_[_0xda2b('0x65')](_0xc375e2,_[_0xda2b('0x66')](_0x14b521,_[_0xda2b('0x67')](_0xc375e2)));this[_0xda2b('0xf')][_0x14b521[_0xda2b('0x62')]]['push'](_0xc375e2);this[_0xda2b('0x11')][_0x14b521[_0xda2b('0x62')]]=_0xc375e2;this[_0xda2b('0x42')](_0xc375e2);}}catch(_0x3898a3){logger[_0xda2b('0x3a')](_0xda2b('0x68'),util[_0xda2b('0x40')](_0x3898a3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xda2b('0xa')]['syncQueueCallerAbandon']=function(_0x4a425b){try{if(this[_0xda2b('0x56')](_0x4a425b)){if(this[_0xda2b('0xf')][_0x4a425b[_0xda2b('0x62')]]){var _0x4ab57d=_[_0xda2b('0x69')](this[_0xda2b('0xf')][_0x4a425b['uniqueid']]);_0x4ab57d[_0xda2b('0x6a')]=_0x4a425b[_0xda2b('0x6a')];_0x4ab57d[_0xda2b('0x6b')]=_0x4a425b['originalposition'];_0x4ab57d['queuecallerabandon']=!![];_0x4ab57d[_0xda2b('0x6c')]=moment()['format'](_0xda2b('0x6d'));_0x4ab57d[_0xda2b('0x6e')]=_0xda2b('0x6f');_0x4ab57d[_0xda2b('0x70')]=null;this[_0xda2b('0x11')][_0x4a425b[_0xda2b('0x62')]]=_0x4ab57d;this[_0xda2b('0x3f')](_0x4ab57d);}}}catch(_0x120e5a){logger[_0xda2b('0x3a')](_0xda2b('0x71'),util[_0xda2b('0x40')](_0x120e5a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xda2b('0xa')][_0xda2b('0x72')]=function(_0x938fa4){try{if(this['isNotNull'](_0x938fa4)){if(this[_0xda2b('0xf')][_0x938fa4['uniqueid']]){var _0x556e80=_[_0xda2b('0x69')](this[_0xda2b('0xf')][_0x938fa4[_0xda2b('0x62')]]);_0x556e80[_0xda2b('0x73')]=moment()[_0xda2b('0x43')](_0xda2b('0x6d'));_0x556e80[_0xda2b('0x74')]=_0x938fa4[_0xda2b('0x74')];_0x556e80[_0xda2b('0x75')]=_0x938fa4[_0xda2b('0x75')];this['channels'][_0x938fa4[_0xda2b('0x62')]]=_0x556e80;this[_0xda2b('0x42')](_0x556e80);}}}catch(_0x330e1b){logger[_0xda2b('0x3a')](_0xda2b('0x76'),util[_0xda2b('0x40')](_0x330e1b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xda2b('0xa')][_0xda2b('0x21')]=function(_0x62f077){try{if(this['isNotNull'](_0x62f077)){if(this['queueReports'][_0x62f077[_0xda2b('0x62')]]){var _0x3bf598=_[_0xda2b('0x69')](this[_0xda2b('0xf')][_0x62f077['uniqueid']]);_0x3bf598[_0xda2b('0x77')]=![];_0x3bf598[_0xda2b('0x6c')]=null;_0x3bf598[_0xda2b('0x78')]=!![];_0x3bf598[_0xda2b('0x70')]=_0x62f077['membername'];_0x3bf598[_0xda2b('0x6a')]=_0x62f077['holdtime'];if(_0x62f077[_0xda2b('0x74')]===''&&_[_0xda2b('0x79')](_0x62f077[_0xda2b('0x7a')][_0xda2b('0x7b')](),_0xda2b('0x7c'))){if(!_0x3bf598[_0xda2b('0x7d')]){_0x3bf598['queuecallerexit']=!![];_0x3bf598[_0xda2b('0x7e')]=moment(_0x3bf598['queuecallerjoinAt'])['add'](_0x62f077[_0xda2b('0x6a')],'seconds')[_0xda2b('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x3bf598[_0xda2b('0x6e')]=_0xda2b('0x7f');_0x3bf598[_0xda2b('0x7d')]=!![];_0x3bf598[_0xda2b('0x80')]=_0xda2b('0x81');_0x3bf598[_0xda2b('0x82')]=_0x62f077[_0xda2b('0x83')];_0x3bf598[_0xda2b('0x84')]=_0x62f077[_0xda2b('0x62')];}if(this[_0xda2b('0x10')][_0x62f077[_0xda2b('0x7a')]]){_0x3bf598[_0xda2b('0x74')]=this[_0xda2b('0x10')][_0x62f077[_0xda2b('0x7a')]][_0xda2b('0x85')];_0x3bf598[_0xda2b('0x75')]=this[_0xda2b('0x10')][_0x62f077[_0xda2b('0x7a')]]['fullname'];_0x3bf598['destcalleridnum']=this[_0xda2b('0x10')][_0x62f077[_0xda2b('0x7a')]][_0xda2b('0x85')];_0x3bf598['destcalleridname']=this[_0xda2b('0x10')][_0x62f077[_0xda2b('0x7a')]][_0xda2b('0x86')];}}else{_0x3bf598[_0xda2b('0x87')]=!![];_0x3bf598[_0xda2b('0x88')]=moment()[_0xda2b('0x43')](_0xda2b('0x6d'));_0x3bf598['queuecallerexit']=![];_0x3bf598[_0xda2b('0x7e')]=null;if(_0x62f077[_0xda2b('0x89')]!==_0xda2b('0x7d')){_0x3bf598[_0xda2b('0x6e')]=_0xda2b('0x8a')+_0x62f077[_0xda2b('0x89')][_0xda2b('0x8b')]();}}this[_0xda2b('0x11')][_0x62f077[_0xda2b('0x62')]]=_0x3bf598;this[_0xda2b('0x3f')](_0x3bf598);}}}catch(_0x449727){logger[_0xda2b('0x3a')](_0xda2b('0x8c'),util[_0xda2b('0x40')](_0x449727,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xda2b('0x8d')]=function(_0x49b11b){try{if(this[_0xda2b('0x56')](_0x49b11b)){this[_0xda2b('0x8e')](_0x49b11b['uniqueid'],_[_0xda2b('0x67')](_0x49b11b['variable'])[0x0],_0x49b11b['value']);if(this[_0xda2b('0xf')][_0x49b11b[_0xda2b('0x62')]]){var _0x16526b=_[_0xda2b('0x69')](this['queueReports'][_0x49b11b[_0xda2b('0x62')]]);if(_0x16526b){if(this[_0xda2b('0x56')](_0x49b11b[_0xda2b('0x8f')])&&this[_0xda2b('0x56')](_0x49b11b[_0xda2b('0x8f')][_0xda2b('0x90')])){switch(_0x49b11b[_0xda2b('0x91')]){case _0xda2b('0x92'):_0x16526b[_0xda2b('0x93')]=![];_0x16526b[_0xda2b('0x7e')]=null;break;default:_0x16526b['queuecallerexit']=!![];_0x16526b[_0xda2b('0x7e')]=moment()['format'](_0xda2b('0x6d'));_0x16526b[_0xda2b('0x73')]=moment()['format'](_0xda2b('0x6d'));}_0x16526b[_0xda2b('0x77')]=![];_0x16526b[_0xda2b('0x6c')]=null;_0x16526b[_0xda2b('0x6e')]=_0x49b11b[_0xda2b('0x91')];this[_0xda2b('0x11')][_0x49b11b[_0xda2b('0x62')]]=_0x16526b;this[_0xda2b('0x3f')](_0x16526b);}else if(this['isNotNull'](_0x49b11b[_0xda2b('0x8f')])&&this[_0xda2b('0x56')](_0x49b11b[_0xda2b('0x8f')]['queueposition'])){if(!_0x16526b[_0xda2b('0x77')]){_0x16526b[_0xda2b('0x93')]=!![];_0x16526b[_0xda2b('0x7e')]=moment()['format'](_0xda2b('0x6d'));_0x16526b['queuecallerexitreason']=_0xda2b('0x94');_0x16526b[_0xda2b('0x73')]=moment()[_0xda2b('0x43')](_0xda2b('0x6d'));this['channels'][_0x49b11b[_0xda2b('0x62')]]=_0x16526b;}}_0x16526b[_0xda2b('0x16')]=this[_0xda2b('0x16')][_0x49b11b[_0xda2b('0x62')]];}}}}catch(_0x55b933){logger[_0xda2b('0x3a')](_0xda2b('0x95'),util[_0xda2b('0x40')](_0x55b933,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xda2b('0xa')][_0xda2b('0x8e')]=function(_0x4ba39a,_0x149761,_0x4a23f3){var _0x352e62=['rtpaudioqos',_0xda2b('0x96'),_0xda2b('0x97'),'rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt',_0xda2b('0x98'),_0xda2b('0x99'),_0xda2b('0x9a'),_0xda2b('0x9b'),'bridgepvtcallid','membercalls',_0xda2b('0x9c'),_0xda2b('0x9d'),_0xda2b('0x9e'),_0xda2b('0x9f'),_0xda2b('0xa0'),_0xda2b('0xa1')];if(!_['isNil'](_0x149761)&&!_[_0xda2b('0xa2')](_0x352e62,_0x149761)){if(_[_0xda2b('0x2b')](this[_0xda2b('0x16')][_0x4ba39a])){this[_0xda2b('0x16')][_0x4ba39a]={};}this[_0xda2b('0x16')][_0x4ba39a][_0x149761]=_0x4a23f3;}};VoiceQueueReport['prototype'][_0xda2b('0x24')]=function(_0x5f2403){try{if(this[_0xda2b('0x56')](_0x5f2403)){if(this[_0xda2b('0xf')][_0x5f2403[_0xda2b('0x62')]]){for(var _0x145065=0x0,_0x2abc94={};_0x145065','startsWith','interface','sip/','transfer','queuecallerexit','queuecallerexitAt','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','destexten','accountcode','fullname','destcalleridnum','destcalleridname','queuecallercomplete','queuecallercompleteAt','reason','COMPLETEDBY','toUpperCase','[syncAgentComplete][VoiceQueueReport]','addVariable','variable','value','queuestatus','CONTINUE','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','length','milliseconds','diff','abandoned','custom:queuecallerabandon','custom:queuecallerunmanaged','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','transfereeuniqueid','secondtransfererexten','transferuniqueid','secondtransfereruniqueid','transfertargetuniqueid','transferexten','origtransfererexten','origtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','[syncAttendedTransfer][VoiceQueueReport]','syncBlindTransfer','BLINDTRANSFER','BLIND','extension','[syncBlindTransfer][VoiceQueueReport]','syncMusicOnHoldStop','mohstarttime','[syncMusicOnHoldStop][VoiceQueueReport]','exports','lodash','moment','md5','../../../config/logger','ami','../ami','prototype','enqueue','tail','finally','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','queuesummarycomplete','syncQueueSummaryComplete','bind','syncQueueCallerJoin','syncQueueCallerAbandon','queuecallerleave','syncAgentComplete','syncVarSet','hangup','syncHangup','fullybooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','loopQueueShow','isUndefined','hasOwnProperty','isEmpty','originated','talking','waiting','unlockRR','clearZombieChannels','isNil','Action','status','message','No\x20such\x20channel','error','[voiceQueueReport][checkChannel]','[voiceQueueReport][checkQueueReport]','[voiceQueueReport][checkVariables]','syncFullyBooted','[FullyBooted]\x20clear\x20realtime','clearQueueReport','inspect','emit','emitVoiceQueueChannelSave','voice:queue:%s','name','voice_queue_channel:save','emitVoiceQueueChannelRemove','format','voice_queue_channel:remove','emitVoiceQueueSummary','type','inbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','Trunk','active','Interval','stringify','voice_queue:save','queues','catch','loopQueueSummary','then','[queuesummary]','syncQueueSummary','isNotNull','queue','countBy','callers','toNumber','loggedin','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','syncNewExten','uniqueid','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','merge','pick','keys','push','[syncQueueCallerJoin][VoiceQueueReport]','last','holdtime','originalposition','queuecallerabandon','queuecallerabandonAt','queuecallerexitreason','ABANDONED','lastAssignedTo','[syncQueueCallerAbandon][VoiceQueueReport]','queuecallerleaveAt','connectedlinenum','connectedlinename'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xe28e,0x116));var _0xee28=function(_0x281594,_0x246818){_0x281594=_0x281594-0x0;var _0x485a8b=_0xe28e[_0x281594];return _0x485a8b;};'use strict';var _=require(_0xee28('0x0'));var moment=require(_0xee28('0x1'));var BPromise=require('bluebird');var util=require('util');var md5=require(_0xee28('0x2'));var logger=require(_0xee28('0x3'))(_0xee28('0x4'));var ami=require(_0xee28('0x5'));var QueueReport=require('../model/queueReport');var io=require('socket.io-emitter')({'host':'localhost','port':0x18eb});var Sequence=function(){};Sequence[_0xee28('0x6')][_0xee28('0x7')]=function(_0x4905fa){this[_0xee28('0x8')]=this[_0xee28('0x8')]?this['tail'][_0xee28('0x9')](_0x4905fa):_0x4905fa();};function VoiceQueueReport(_0x289d94){this[_0xee28('0xa')]=new Sequence();this[_0xee28('0xb')]={};this[_0xee28('0xc')]=_0x289d94[_0xee28('0xc')];this[_0xee28('0xd')]=_0x289d94[_0xee28('0xe')];this['voiceQueues']=_0x289d94[_0xee28('0xf')];this[_0xee28('0x10')]=!![];this[_0xee28('0x11')]=_0x289d94[_0xee28('0x11')];this[_0xee28('0x12')]={};ami['on'](_0xee28('0x13'),this['syncQueueSummary']['bind'](this));ami['on'](_0xee28('0x14'),this[_0xee28('0x15')][_0xee28('0x16')](this));ami['on']('queuecallerjoin',this[_0xee28('0x17')][_0xee28('0x16')](this));ami['on']('queuecallerabandon',this[_0xee28('0x18')][_0xee28('0x16')](this));ami['on'](_0xee28('0x19'),this['syncQueueCallerLeave'][_0xee28('0x16')](this));ami['on']('agentcomplete',this[_0xee28('0x1a')][_0xee28('0x16')](this));ami['on']('varset',this[_0xee28('0x1b')][_0xee28('0x16')](this));ami['on'](_0xee28('0x1c'),this[_0xee28('0x1d')]['bind'](this));ami['on'](_0xee28('0x1e'),this['syncFullyBooted'][_0xee28('0x16')](this));ami['on'](_0xee28('0x1f'),this[_0xee28('0x20')]['bind'](this));ami['on'](_0xee28('0x21'),this['syncMusicOnHoldStop']['bind'](this));ami['on'](_0xee28('0x22'),this[_0xee28('0x23')][_0xee28('0x16')](this));ami['on'](_0xee28('0x24'),this['syncBlindTransfer']['bind'](this));this['loopQueueSummary']();this[_0xee28('0x25')]();}function isNotNull(_0x46a63c){return _0x46a63c!==null&&!_[_0xee28('0x26')](_0x46a63c);}function clearChannels(_0x3ed38b){if(!_['isEmpty'](_0x3ed38b)){for(var _0x4b05eb in _0x3ed38b){if(_0x3ed38b[_0xee28('0x27')](_0x4b05eb)){delete _0x3ed38b[_0x4b05eb];}}}}function clearCampaigns(_0x5f5270){if(!_[_0xee28('0x28')](_0x5f5270)){for(var _0x5c1aef in _0x5f5270){if(_0x5f5270[_0xee28('0x27')](_0x5c1aef)){_0x5f5270[_0x5c1aef][_0xee28('0x29')]=0x0;}}}}function clearVoiceQueues(_0x4b130d){if(!_[_0xee28('0x28')](_0x4b130d)){for(var _0x6ff30c in _0x4b130d){if(_0x4b130d[_0xee28('0x27')](_0x6ff30c)){_0x4b130d[_0x6ff30c][_0xee28('0x29')]=0x0;_0x4b130d[_0x6ff30c][_0xee28('0x2a')]=0x0;_0x4b130d[_0x6ff30c]['pTalking']=0x0;_0x4b130d[_0x6ff30c][_0xee28('0x2b')]=0x0;_0x4b130d[_0x6ff30c]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x4b981e){if(!_[_0xee28('0x28')](_0x4b981e)){for(var _0x2b35e5 in _0x4b981e){if(_0x4b981e[_0xee28('0x27')](_0x2b35e5)){_0x4b981e[_0x2b35e5][_0xee28('0x2c')]=!![];}}}}VoiceQueueReport[_0xee28('0x6')][_0xee28('0x2d')]=function(){var _0x171458=this;for(var _0x20ec52 in this[_0xee28('0xd')]){if(this[_0xee28('0xd')][_0xee28('0x27')](_0x20ec52)){this[_0xee28('0xa')][_0xee28('0x7')](function(){if(!_[_0xee28('0x2e')](_0x171458[_0xee28('0xd')][_0x20ec52])){return ami[_0xee28('0x2f')]({'action':_0xee28('0x30'),'channel':_0x171458[_0xee28('0xd')][_0x20ec52]['channel']})['catch'](function(_0x67b9ba){if(_0x67b9ba[_0xee28('0x31')]===_0xee28('0x32')){setTimeout(function(){if(_0x171458['channels'][_0x20ec52]){delete _0x171458[_0xee28('0xd')][_0x20ec52];logger[_0xee28('0x33')](_0xee28('0x34'),_0x20ec52);}if(_0x171458[_0xee28('0xb')][_0x20ec52]){delete _0x171458['queueReports'][_0x20ec52];logger[_0xee28('0x33')](_0xee28('0x35'),_0x20ec52);}if(_0x171458[_0xee28('0x12')][_0x20ec52]){delete _0x171458['variables'][_0x20ec52];logger[_0xee28('0x33')](_0xee28('0x36'),_0x20ec52);}},0x1f40);}});}});}}};VoiceQueueReport[_0xee28('0x6')][_0xee28('0x37')]=function(){logger['error'](_0xee28('0x38'));clearChannels(this[_0xee28('0xd')]);this[_0xee28('0x39')](this[_0xee28('0xb')]);clearAgentBooked(this[_0xee28('0xc')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0xee28('0x11')]);};VoiceQueueReport['prototype'][_0xee28('0x39')]=function(_0x3791eb){var _0x49d418=this;if(!_[_0xee28('0x28')](_0x3791eb)){for(var _0x490abd in _0x3791eb){if(_0x3791eb[_0xee28('0x27')](_0x490abd)){_0x49d418['emitVoiceQueueChannelRemove'](_0x3791eb[_0x490abd]);delete _0x3791eb[_0x490abd];}}}};function loggerCatch(_0x590a34){return function(_0x4bc992){logger[_0xee28('0x33')](_0x590a34,util[_0xee28('0x3a')](_0x4bc992,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0xee28('0x6')][_0xee28('0x3b')]=function(_0x234165,_0x475f67,_0x1e22fa){io['to'](_0x234165)[_0xee28('0x3b')](_0x475f67,_0x1e22fa);};VoiceQueueReport['prototype'][_0xee28('0x3c')]=function(_0x476fbb){this[_0xee28('0x3b')](util['format'](_0xee28('0x3d'),_0x476fbb[_0xee28('0x3e')]),_0xee28('0x3f'),_0x476fbb);};VoiceQueueReport[_0xee28('0x6')][_0xee28('0x40')]=function(_0x150661){this[_0xee28('0x3b')](util[_0xee28('0x41')](_0xee28('0x3d'),_0x150661[_0xee28('0x3e')]),_0xee28('0x42'),_0x150661);};VoiceQueueReport[_0xee28('0x6')][_0xee28('0x43')]=function(_0x48f26e){if(_0x48f26e[_0xee28('0x44')]===_0xee28('0x45')){var _0x55ddf8={'id':_0x48f26e['id'],'name':_0x48f26e[_0xee28('0x3e')],'strategy':_0x48f26e[_0xee28('0x46')],'answered':_0x48f26e[_0xee28('0x47')],'available':_0x48f26e[_0xee28('0x48')],'loggedIn':_0x48f26e[_0xee28('0x49')],'pTalking':_0x48f26e[_0xee28('0x4a')],'sumBillable':_0x48f26e[_0xee28('0x4b')],'sumDuration':_0x48f26e[_0xee28('0x4c')],'sumHoldTime':_0x48f26e[_0xee28('0x4d')]||0x0,'talking':_0x48f26e[_0xee28('0x2a')],'total':_0x48f26e[_0xee28('0x4e')],'type':_0x48f26e[_0xee28('0x44')],'unmanaged':_0x48f26e[_0xee28('0x4f')],'waiting':_0x48f26e[_0xee28('0x2b')]};if(_0x48f26e[_0xee28('0x50')]){_0x55ddf8[_0xee28('0x50')]={'id':_0x48f26e[_0xee28('0x50')]['id'],'name':_0x48f26e['Trunk'][_0xee28('0x3e')],'active':_0x48f26e[_0xee28('0x50')][_0xee28('0x51')],'callerid':_0x48f26e['Trunk']['callerid']};}if(_0x48f26e[_0xee28('0x52')]){_0x55ddf8[_0xee28('0x52')]={'id':_0x48f26e['Interval']['id'],'name':_0x48f26e[_0xee28('0x52')][_0xee28('0x3e')]};}var _0x383914=md5(JSON[_0xee28('0x53')](_0x55ddf8));if(_0x48f26e[_0xee28('0x2')]!==_0x383914){_0x48f26e[_0xee28('0x2')]=_0x383914;this[_0xee28('0x3b')](util[_0xee28('0x41')](_0xee28('0x3d'),_0x55ddf8[_0xee28('0x3e')]),_0xee28('0x54'),_0x55ddf8);}}};VoiceQueueReport[_0xee28('0x6')]['isNotNull']=function(_0xa84ca7){return _0xa84ca7!==null&&!_[_0xee28('0x26')](_0xa84ca7);};VoiceQueueReport['prototype'][_0xee28('0x25')]=function(){var _0x56aeef=this;setInterval(function(){_0x56aeef[_0xee28('0x2d')]();ami[_0xee28('0x2f')]({'action':_0xee28('0x55')})[_0xee28('0x56')](loggerCatch('[queues]'));},0x2710);};VoiceQueueReport['prototype'][_0xee28('0x57')]=function(){var _0x23de1b=this;setInterval(function(){if(_0x23de1b[_0xee28('0x10')]){return ami[_0xee28('0x2f')]({'action':'queuesummary'})[_0xee28('0x58')](function(_0x450c30){_0x23de1b[_0xee28('0x10')]=![];})['catch'](loggerCatch(_0xee28('0x59')));}},0x3e8);};VoiceQueueReport[_0xee28('0x6')][_0xee28('0x5a')]=function(_0x597f15){try{if(this[_0xee28('0x5b')](_0x597f15)&&this[_0xee28('0x5b')](_0x597f15[_0xee28('0x5c')])){if(this[_0xee28('0xf')][_0x597f15['queue']]){var _0x4a1230=_[_0xee28('0x5d')](this[_0xee28('0xd')],_0xee28('0x5c'))[_0x597f15['queue']]||0x0;var _0x390d28=_0x4a1230-_0x597f15[_0xee28('0x5e')];if(this[_0xee28('0xf')][_0x597f15[_0xee28('0x5c')]][_0xee28('0x2b')]!==_[_0xee28('0x5f')](_0x597f15['callers'])||this[_0xee28('0xf')][_0x597f15['queue']][_0xee28('0x49')]!==_[_0xee28('0x5f')](_0x597f15[_0xee28('0x60')])||this[_0xee28('0xf')][_0x597f15[_0xee28('0x5c')]][_0xee28('0x48')]!==_[_0xee28('0x5f')](_0x597f15[_0xee28('0x48')])||this[_0xee28('0xf')][_0x597f15['queue']][_0xee28('0x2a')]!==_0x390d28){this[_0xee28('0xf')][_0x597f15['queue']]['waiting']=_['toNumber'](_0x597f15[_0xee28('0x5e')]);this[_0xee28('0xf')][_0x597f15[_0xee28('0x5c')]][_0xee28('0x49')]=_[_0xee28('0x5f')](_0x597f15['loggedin']);this[_0xee28('0xf')][_0x597f15['queue']][_0xee28('0x48')]=_[_0xee28('0x5f')](_0x597f15[_0xee28('0x48')]);this[_0xee28('0xf')][_0x597f15[_0xee28('0x5c')]][_0xee28('0x2a')]=_0x390d28>0x0?_0x390d28:0x0;this[_0xee28('0xf')][_0x597f15[_0xee28('0x5c')]][_0xee28('0x2a')]=this[_0xee28('0xf')][_0x597f15['queue']][_0xee28('0x2a')]>_[_0xee28('0x5f')](_0x597f15[_0xee28('0x60')])?_[_0xee28('0x5f')](_0x597f15[_0xee28('0x60')]):this['voiceQueues'][_0x597f15[_0xee28('0x5c')]][_0xee28('0x2a')];this['emitVoiceQueueSummary'](this[_0xee28('0xf')][_0x597f15[_0xee28('0x5c')]]);}ami['emit'](_0xee28('0x61'),this['voiceQueues'][_0x597f15[_0xee28('0x5c')]]);}}}catch(_0x300e55){logger['error'](_0xee28('0x62'),util[_0xee28('0x3a')](_0x300e55,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xee28('0x6')][_0xee28('0x15')]=function(_0x356317){this[_0xee28('0x10')]=!![];};VoiceQueueReport[_0xee28('0x6')][_0xee28('0x63')]=function(_0x3b8ab6){};VoiceQueueReport[_0xee28('0x6')][_0xee28('0x17')]=function(_0xd91a07){try{if(this[_0xee28('0x5b')](_0xd91a07)){if(_['isUndefined'](this[_0xee28('0xb')][_0xd91a07[_0xee28('0x64')]])){this[_0xee28('0xb')][_0xd91a07[_0xee28('0x64')]]=[];this[_0xee28('0xd')][_0xd91a07[_0xee28('0x64')]]={};}var _0x5dbd4e=new QueueReport();_0x5dbd4e[_0xee28('0x3e')]=_0xd91a07[_0xee28('0x5c')];_0x5dbd4e[_0xee28('0x44')]=this[_0xee28('0xf')][_0x5dbd4e[_0xee28('0x3e')]]&&this[_0xee28('0xf')][_0x5dbd4e['name']][_0xee28('0x44')]?this['voiceQueues'][_0x5dbd4e[_0xee28('0x3e')]]['type']||_0xee28('0x45'):'inbound';_0x5dbd4e['queue']=_0xd91a07[_0xee28('0x5c')];_0x5dbd4e[_0xee28('0x65')]=moment()[_0xee28('0x41')](_0xee28('0x66'));_0x5dbd4e[_0xee28('0x67')]=_0xd91a07[_0xee28('0x67')];_0x5dbd4e[_0xee28('0x68')]=_0xd91a07[_0xee28('0x68')];_[_0xee28('0x69')](_0x5dbd4e,_[_0xee28('0x6a')](_0xd91a07,_[_0xee28('0x6b')](_0x5dbd4e)));this[_0xee28('0xb')][_0xd91a07[_0xee28('0x64')]][_0xee28('0x6c')](_0x5dbd4e);this[_0xee28('0xd')][_0xd91a07[_0xee28('0x64')]]=_0x5dbd4e;this['emitVoiceQueueChannelSave'](_0x5dbd4e);}}catch(_0x447b6b){logger['error'](_0xee28('0x6d'),util[_0xee28('0x3a')](_0x447b6b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xee28('0x18')]=function(_0x1e68dc){try{if(this[_0xee28('0x5b')](_0x1e68dc)){if(this['queueReports'][_0x1e68dc[_0xee28('0x64')]]){var _0x588d8f=_[_0xee28('0x6e')](this['queueReports'][_0x1e68dc[_0xee28('0x64')]]);_0x588d8f[_0xee28('0x6f')]=_0x1e68dc[_0xee28('0x6f')];_0x588d8f[_0xee28('0x70')]=_0x1e68dc[_0xee28('0x70')];_0x588d8f[_0xee28('0x71')]=!![];_0x588d8f[_0xee28('0x72')]=moment()[_0xee28('0x41')](_0xee28('0x66'));_0x588d8f[_0xee28('0x73')]=_0xee28('0x74');_0x588d8f[_0xee28('0x75')]=null;this[_0xee28('0xd')][_0x1e68dc[_0xee28('0x64')]]=_0x588d8f;this['emitVoiceQueueChannelRemove'](_0x588d8f);}}}catch(_0xaf2e02){logger[_0xee28('0x33')](_0xee28('0x76'),util['inspect'](_0xaf2e02,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xee28('0x6')]['syncQueueCallerLeave']=function(_0x55f1a6){try{if(this[_0xee28('0x5b')](_0x55f1a6)){if(this[_0xee28('0xb')][_0x55f1a6['uniqueid']]){var _0x48dda3=_[_0xee28('0x6e')](this['queueReports'][_0x55f1a6[_0xee28('0x64')]]);_0x48dda3[_0xee28('0x77')]=moment()[_0xee28('0x41')](_0xee28('0x66'));_0x48dda3[_0xee28('0x78')]=_0x55f1a6['connectedlinenum'];_0x48dda3['connectedlinename']=_0x55f1a6[_0xee28('0x79')];this[_0xee28('0xd')][_0x55f1a6[_0xee28('0x64')]]=_0x48dda3;this[_0xee28('0x3c')](_0x48dda3);}}}catch(_0x4d9032){logger[_0xee28('0x33')](_0xee28('0x7a'),util[_0xee28('0x3a')](_0x4d9032,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xee28('0x6')][_0xee28('0x1a')]=function(_0x45745a){try{if(this[_0xee28('0x5b')](_0x45745a)){if(this[_0xee28('0xb')][_0x45745a[_0xee28('0x64')]]){var _0x3d8fda=_['last'](this[_0xee28('0xb')][_0x45745a[_0xee28('0x64')]]);_0x3d8fda[_0xee28('0x71')]=![];_0x3d8fda['queuecallerabandonAt']=null;_0x3d8fda[_0xee28('0x7b')]=!![];_0x3d8fda[_0xee28('0x75')]=_0x45745a[_0xee28('0x7c')];_0x3d8fda[_0xee28('0x6f')]=_0x45745a[_0xee28('0x6f')];if(_0x45745a[_0xee28('0x78')]===_0xee28('0x7d')&&_[_0xee28('0x7e')](_0x45745a[_0xee28('0x7f')]['toLowerCase'](),_0xee28('0x80'))){if(!_0x3d8fda[_0xee28('0x81')]){_0x3d8fda[_0xee28('0x82')]=!![];_0x3d8fda[_0xee28('0x83')]=moment(_0x3d8fda[_0xee28('0x65')])[_0xee28('0x84')](_0x45745a[_0xee28('0x6f')],_0xee28('0x85'))['format'](_0xee28('0x66'));_0x3d8fda[_0xee28('0x73')]=_0xee28('0x86');_0x3d8fda[_0xee28('0x81')]=!![];_0x3d8fda[_0xee28('0x87')]=_0xee28('0x88');_0x3d8fda['transferexten']=_0x45745a[_0xee28('0x89')];_0x3d8fda['transferuniqueid']=_0x45745a[_0xee28('0x64')];}if(this[_0xee28('0xc')][_0x45745a[_0xee28('0x7f')]]){_0x3d8fda[_0xee28('0x78')]=this[_0xee28('0xc')][_0x45745a[_0xee28('0x7f')]][_0xee28('0x8a')];_0x3d8fda[_0xee28('0x79')]=this[_0xee28('0xc')][_0x45745a[_0xee28('0x7f')]][_0xee28('0x8b')];_0x3d8fda[_0xee28('0x8c')]=this['agents'][_0x45745a['interface']][_0xee28('0x8a')];_0x3d8fda[_0xee28('0x8d')]=this[_0xee28('0xc')][_0x45745a[_0xee28('0x7f')]][_0xee28('0x8b')];}}else{_0x3d8fda[_0xee28('0x8e')]=!![];_0x3d8fda[_0xee28('0x8f')]=moment()[_0xee28('0x41')](_0xee28('0x66'));_0x3d8fda[_0xee28('0x82')]=![];_0x3d8fda[_0xee28('0x83')]=null;if(_0x45745a[_0xee28('0x90')]!==_0xee28('0x81')){_0x3d8fda['queuecallerexitreason']=_0xee28('0x91')+_0x45745a[_0xee28('0x90')][_0xee28('0x92')]();}}this[_0xee28('0xd')][_0x45745a[_0xee28('0x64')]]=_0x3d8fda;this['emitVoiceQueueChannelRemove'](_0x3d8fda);}}}catch(_0x4e6b2d){logger[_0xee28('0x33')](_0xee28('0x93'),util['inspect'](_0x4e6b2d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xee28('0x6')]['syncVarSet']=function(_0x55c927){try{if(this[_0xee28('0x5b')](_0x55c927)){this[_0xee28('0x94')](_0x55c927[_0xee28('0x64')],_['keys'](_0x55c927[_0xee28('0x95')])[0x0],_0x55c927[_0xee28('0x96')]);if(this[_0xee28('0xb')][_0x55c927[_0xee28('0x64')]]){var _0x50c0b9=_[_0xee28('0x6e')](this[_0xee28('0xb')][_0x55c927[_0xee28('0x64')]]);if(_0x50c0b9){if(this[_0xee28('0x5b')](_0x55c927[_0xee28('0x95')])&&this['isNotNull'](_0x55c927[_0xee28('0x95')][_0xee28('0x97')])){switch(_0x55c927[_0xee28('0x96')]){case _0xee28('0x98'):_0x50c0b9[_0xee28('0x82')]=![];_0x50c0b9[_0xee28('0x83')]=null;break;default:_0x50c0b9[_0xee28('0x82')]=!![];_0x50c0b9['queuecallerexitAt']=moment()[_0xee28('0x41')](_0xee28('0x66'));_0x50c0b9[_0xee28('0x77')]=moment()['format'](_0xee28('0x66'));}_0x50c0b9['queuecallerabandon']=![];_0x50c0b9['queuecallerabandonAt']=null;_0x50c0b9['queuecallerexitreason']=_0x55c927[_0xee28('0x96')];this['channels'][_0x55c927['uniqueid']]=_0x50c0b9;this[_0xee28('0x40')](_0x50c0b9);}else if(this[_0xee28('0x5b')](_0x55c927[_0xee28('0x95')])&&this[_0xee28('0x5b')](_0x55c927[_0xee28('0x95')]['queueposition'])){if(!_0x50c0b9[_0xee28('0x71')]){_0x50c0b9[_0xee28('0x82')]=!![];_0x50c0b9[_0xee28('0x83')]=moment()[_0xee28('0x41')](_0xee28('0x66'));_0x50c0b9[_0xee28('0x73')]=_0xee28('0x99');_0x50c0b9[_0xee28('0x77')]=moment()[_0xee28('0x41')](_0xee28('0x66'));this[_0xee28('0xd')][_0x55c927[_0xee28('0x64')]]=_0x50c0b9;}}_0x50c0b9['variables']=this[_0xee28('0x12')][_0x55c927[_0xee28('0x64')]];}}}}catch(_0x18a36b){logger['error'](_0xee28('0x9a'),util[_0xee28('0x3a')](_0x18a36b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xee28('0x6')]['addVariable']=function(_0x4bc55f,_0x4b9042,_0x38bc70){var _0x398df0=[_0xee28('0x9b'),'rtpaudioqosbridged','rtpaudioqosjitter',_0xee28('0x9c'),_0xee28('0x9d'),_0xee28('0x9e'),_0xee28('0x9f'),_0xee28('0xa0'),_0xee28('0xa1'),_0xee28('0xa2'),_0xee28('0xa3'),_0xee28('0xa4'),_0xee28('0xa5'),_0xee28('0xa6'),_0xee28('0xa7'),_0xee28('0xa8'),_0xee28('0x7c'),_0xee28('0xa9'),_0xee28('0xaa')];if(!_[_0xee28('0x2e')](_0x4b9042)&&!_[_0xee28('0xab')](_0x398df0,_0x4b9042)){if(_[_0xee28('0x26')](this[_0xee28('0x12')][_0x4bc55f])){this[_0xee28('0x12')][_0x4bc55f]={};}this['variables'][_0x4bc55f][_0x4b9042]=_0x38bc70;}};VoiceQueueReport[_0xee28('0x6')][_0xee28('0x1d')]=function(_0x5a67c8){try{if(this['isNotNull'](_0x5a67c8)){if(this['queueReports'][_0x5a67c8[_0xee28('0x64')]]){for(var _0x14b664=0x0,_0x3dfd0b={};_0x14b664=0x0?moment(_0x1d1467[_0xcc40('0x13')])[_0xcc40('0x14')](_0x1d1467['starttime'],'seconds'):null,'data1':'outbound','data2':_0x1d1467[_0xcc40('0x16')],'data3':_0x1d1467[_0xcc40('0xa')],'data4':_0x1d1467[_0xcc40('0x17')]||null,'role':'agent','internal':_0x1d1467['accountcode']?_[_0xcc40('0xc')](_0x1d1467[_0xcc40('0x16')]):undefined,'uniqueid':_0x1d1467[_0xcc40('0xd')]},'log':_0xcc40('0x4')});}; \ No newline at end of file +var _0xa956=['inbound','calleridnum','agent','accountcode','toNumber','uniqueid','channel','split','starttime','endtime','outbound','exten','dialstring','moment','../client','voiceQueueReport','Request','CreateMemberReport','voice','SIP/','lastAssignedTo','TALKING','queuecallercompleteAt','diff','seconds'];(function(_0x1c8d08,_0x433810){var _0x1bb26f=function(_0x70cee0){while(--_0x70cee0){_0x1c8d08['push'](_0x1c8d08['shift']());}};_0x1bb26f(++_0x433810);}(_0xa956,0xa3));var _0x6a95=function(_0x44d9ab,_0x76bc69){_0x44d9ab=_0x44d9ab-0x0;var _0x31485e=_0xa956[_0x44d9ab];return _0x31485e;};'use strict';var moment=require(_0x6a95('0x0'));var _=require('lodash');var client=require(_0x6a95('0x1'));exports[_0x6a95('0x2')]=function(_0x12ac8f){return client[_0x6a95('0x3')](_0x6a95('0x4'),{'body':{'channel':_0x6a95('0x5'),'membername':_0x12ac8f['lastAssignedTo'],'interface':_0x6a95('0x6')+_0x12ac8f[_0x6a95('0x7')],'type':_0x6a95('0x8'),'enterAt':_0x12ac8f['queuecallerleaveAt'],'exitAt':_0x12ac8f[_0x6a95('0x9')],'duration':moment(_0x12ac8f[_0x6a95('0x9')])[_0x6a95('0xa')](_0x12ac8f['queuecallerleaveAt'],_0x6a95('0xb')),'data1':_0x6a95('0xc'),'data2':_0x12ac8f[_0x6a95('0xd')],'data3':_0x12ac8f['exten'],'data4':null,'data5':_0x12ac8f['queue'],'role':_0x6a95('0xe'),'internal':_0x12ac8f[_0x6a95('0xf')]?_[_0x6a95('0x10')](_0x12ac8f['accountcode']):undefined,'uniqueid':_0x12ac8f[_0x6a95('0x11')]},'log':_0x6a95('0x4')});};exports['voiceDialReport']=function(_0x3f57bf){return client[_0x6a95('0x3')](_0x6a95('0x4'),{'body':{'channel':_0x6a95('0x5'),'membername':_0x3f57bf[_0x6a95('0x12')]?_0x3f57bf[_0x6a95('0x12')][_0x6a95('0x13')](/\/|-/)[0x1]:undefined,'interface':_0x3f57bf['channel']?_0x3f57bf[_0x6a95('0x12')][_0x6a95('0x13')]('-')[0x0]:undefined,'type':_0x6a95('0x8'),'enterAt':_0x3f57bf[_0x6a95('0x14')],'exitAt':_0x3f57bf[_0x6a95('0x15')],'duration':moment(_0x3f57bf[_0x6a95('0x15')])[_0x6a95('0xa')](_0x3f57bf[_0x6a95('0x14')],_0x6a95('0xb'))>=0x0?moment(_0x3f57bf['endtime'])[_0x6a95('0xa')](_0x3f57bf[_0x6a95('0x14')],'seconds'):null,'data1':_0x6a95('0x16'),'data2':_0x3f57bf[_0x6a95('0xf')],'data3':_0x3f57bf[_0x6a95('0x17')],'data4':_0x3f57bf[_0x6a95('0x18')]||null,'role':_0x6a95('0xe'),'internal':_0x3f57bf[_0x6a95('0xf')]?_['toNumber'](_0x3f57bf[_0x6a95('0xf')]):undefined,'uniqueid':_0x3f57bf[_0x6a95('0x11')]},'log':_0x6a95('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 66afc9b..6b4ee11 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 _0x6841=['GetTemplate','html','../client','getTemplates','Request'];(function(_0x579357,_0x1b3b3e){var _0x289d24=function(_0x47ff3a){while(--_0x47ff3a){_0x579357['push'](_0x579357['shift']());}};_0x289d24(++_0x1b3b3e);}(_0x6841,0x138));var _0x1684=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x6841[_0x34bc30];return _0x5706de;};'use strict';var client=require(_0x1684('0x0'));exports[_0x1684('0x1')]=function(_0x9a996c){return function(_0x5a60d7){return client[_0x1684('0x2')](_0x1684('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0x1684('0x4')]},'log':_0x1684('0x3')});};}; \ No newline at end of file +var _0xb14b=['GetTemplate','../client','Request','name'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb14b,0xdd));var _0xbb14=function(_0xc9660a,_0x2a20b9){_0xc9660a=_0xc9660a-0x0;var _0x3d9af7=_0xb14b[_0xc9660a];return _0x3d9af7;};'use strict';var client=require(_0xbb14('0x0'));exports['getTemplates']=function(_0x56b95){return function(_0x170e95){return client[_0xbb14('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xbb14('0x2'),'html']},'log':_0xbb14('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 45f2518..0d68632 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(_0x401af0,_0x1a29f8){var _0x4ab016=function(_0xba68ca){while(--_0xba68ca){_0x401af0['push'](_0x401af0['shift']());}};_0x4ab016(++_0x1a29f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0xb0358c,_0x3e40c9){var _0x583f13=function(_0x5288a7){while(--_0x5288a7){_0xb0358c['push'](_0xb0358c['shift']());}};_0x583f13(++_0x3e40c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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 651460e..d7d533f 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 _0x4a5d=['name','getTrunks','Request','GetTrunk'];(function(_0x1bd8b8,_0xbbe020){var _0x55e63c=function(_0x537fa9){while(--_0x537fa9){_0x1bd8b8['push'](_0x1bd8b8['shift']());}};_0x55e63c(++_0xbbe020);}(_0x4a5d,0x145));var _0xd4a5=function(_0x4433b,_0x1eded1){_0x4433b=_0x4433b-0x0;var _0xffc1da=_0x4a5d[_0x4433b];return _0xffc1da;};'use strict';var client=require('../client');exports[_0xd4a5('0x0')]=function(_0x1d87a8){return function(_0xf45679){return client[_0xd4a5('0x1')](_0xd4a5('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xd4a5('0x3'),'registry']},'log':_0xd4a5('0x2')});};}; \ No newline at end of file +var _0xee29=['../client','Request','GetTrunk','name','registry'];(function(_0x55e608,_0x2f16fb){var _0x4803ac=function(_0x413358){while(--_0x413358){_0x55e608['push'](_0x55e608['shift']());}};_0x4803ac(++_0x2f16fb);}(_0xee29,0x10e));var _0x9ee2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee29[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x9ee2('0x0'));exports['getTrunks']=function(_0x20d0ca){return function(_0x1ab9be){return client[_0x9ee2('0x1')](_0x9ee2('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x9ee2('0x3'),_0x9ee2('0x4')]},'log':_0x9ee2('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 7fd126a..0edda0b 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 _0xd243=['pauseType','voicePause','../client','Request','GetUser','agent','name','email','accountcode','fullname','online','lastLoginAt','lastPauseAt','phone','mobile','getAgents','getTelephones','savePause','saveUnpause','UnpauseUser','getAgent'];(function(_0x48cf9f,_0x22c0bb){var _0x4166d4=function(_0x336c9c){while(--_0x336c9c){_0x48cf9f['push'](_0x48cf9f['shift']());}};_0x4166d4(++_0x22c0bb);}(_0xd243,0xaa));var _0x3d24=function(_0x9d5cc6,_0x52b52f){_0x9d5cc6=_0x9d5cc6-0x0;var _0x4df207=_0xd243[_0x9d5cc6];return _0x4df207;};'use strict';var client=require(_0x3d24('0x0'));exports['getAgents']=function(){return function(){return client[_0x3d24('0x1')](_0x3d24('0x2'),{'options':{'raw':![],'where':{'role':_0x3d24('0x3')},'attributes':['id',_0x3d24('0x4'),_0x3d24('0x5'),_0x3d24('0x6'),_0x3d24('0x7'),_0x3d24('0x8'),_0x3d24('0x9'),'pauseType',_0x3d24('0xa'),'voicePause',_0x3d24('0xb'),_0x3d24('0xc')]},'log':_0x3d24('0xd')});};};exports[_0x3d24('0xe')]=function(){return function(){return client[_0x3d24('0x1')](_0x3d24('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3d24('0x4')]},'log':_0x3d24('0xe')});};};exports[_0x3d24('0xf')]=function(_0x5287f8,_0x2cb4d8,_0x3b0825){return client[_0x3d24('0x1')]('PauseUser',{'body':{'type':_0x2cb4d8,'uniqueid':_0x3b0825},'options':{'where':{'id':_0x5287f8['id']}},'log':_0x3d24('0xf')});};exports[_0x3d24('0x10')]=function(_0x1a226c){return client[_0x3d24('0x1')](_0x3d24('0x11'),{'body':{},'options':{'where':{'id':_0x1a226c['id']}},'log':_0x3d24('0xf')});};exports[_0x3d24('0x12')]=function(_0x394182){return client[_0x3d24('0x1')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3d24('0x3'),'id':_0x394182},'attributes':['id',_0x3d24('0x4'),_0x3d24('0x5'),'accountcode',_0x3d24('0x7'),_0x3d24('0x8'),'lastLoginAt',_0x3d24('0x13'),_0x3d24('0xa'),_0x3d24('0x14')]},'log':_0x3d24('0x12')});}; \ No newline at end of file +var _0x4560=['ShowUser','agent','name','email','lastPauseAt','voicePause','../client','getAgents','accountcode','fullname','online','lastLoginAt','pauseType','mobile','Request','GetUser','telephone','getTelephones','savePause','PauseUser','UnpauseUser','getAgent'];(function(_0x515beb,_0x35708f){var _0x19f621=function(_0x5ea2cf){while(--_0x5ea2cf){_0x515beb['push'](_0x515beb['shift']());}};_0x19f621(++_0x35708f);}(_0x4560,0x1d4));var _0x0456=function(_0xf3e264,_0xece936){_0xf3e264=_0xf3e264-0x0;var _0x5f314c=_0x4560[_0xf3e264];return _0x5f314c;};'use strict';var client=require(_0x0456('0x0'));exports[_0x0456('0x1')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id','name','email',_0x0456('0x2'),_0x0456('0x3'),_0x0456('0x4'),_0x0456('0x5'),_0x0456('0x6'),'lastPauseAt','voicePause','phone',_0x0456('0x7')]},'log':_0x0456('0x1')});};};exports['getTelephones']=function(){return function(){return client[_0x0456('0x8')](_0x0456('0x9'),{'options':{'raw':!![],'where':{'role':_0x0456('0xa')},'attributes':['id','name']},'log':_0x0456('0xb')});};};exports[_0x0456('0xc')]=function(_0x5dcca1,_0x23c82e,_0x4ce651){return client[_0x0456('0x8')](_0x0456('0xd'),{'body':{'type':_0x23c82e,'uniqueid':_0x4ce651},'options':{'where':{'id':_0x5dcca1['id']}},'log':'savePause'});};exports['saveUnpause']=function(_0x58dd68){return client[_0x0456('0x8')](_0x0456('0xe'),{'body':{},'options':{'where':{'id':_0x58dd68['id']}},'log':_0x0456('0xc')});};exports[_0x0456('0xf')]=function(_0x2d2d00){return client[_0x0456('0x8')](_0x0456('0x10'),{'options':{'raw':![],'where':{'role':_0x0456('0x11'),'id':_0x2d2d00},'attributes':['id',_0x0456('0x12'),_0x0456('0x13'),_0x0456('0x2'),_0x0456('0x3'),_0x0456('0x4'),_0x0456('0x5'),_0x0456('0x6'),_0x0456('0x14'),_0x0456('0x15')]},'log':_0x0456('0xf')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 7198656..0e9adbe 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 _0xfb48=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x398c03,_0x2e8fe9){var _0x578e5e=function(_0x2b100e){while(--_0x2b100e){_0x398c03['push'](_0x398c03['shift']());}};_0x578e5e(++_0x2e8fe9);}(_0xfb48,0xfb));var _0x8fb4=function(_0x4fdb6e,_0x49d748){_0x4fdb6e=_0x4fdb6e-0x0;var _0x3c15f8=_0xfb48[_0x4fdb6e];return _0x3c15f8;};'use strict';var client=require(_0x8fb4('0x0'));exports['create']=function(_0x2816b7){return client['Request'](_0x8fb4('0x1'),{'body':_0x2816b7,'log':'CreateVoiceAgentReport'});};exports[_0x8fb4('0x2')]=function(_0x3ae389,_0x1a1575,_0x2b1339){return client['Request'](_0x8fb4('0x3'),{'body':_0x3ae389,'options':{'where':{'uniqueid':_0x1a1575,'interface':_0x2b1339}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0xe35e=['update','Request','UpdateVoiceAgentReport','CreateVoiceAgentReport'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe35e,0x13b));var _0xee35=function(_0x3cb6dc,_0x120dd3){_0x3cb6dc=_0x3cb6dc-0x0;var _0x47ec89=_0xe35e[_0x3cb6dc];return _0x47ec89;};'use strict';var client=require('../client');exports['create']=function(_0x37a4e5){return client['Request']('CreateVoiceAgentReport',{'body':_0x37a4e5,'log':_0xee35('0x0')});};exports[_0xee35('0x1')]=function(_0x22d660,_0x33c885,_0x248ab9){return client[_0xee35('0x2')](_0xee35('0x3'),{'body':_0x22d660,'options':{'where':{'uniqueid':_0x33c885,'interface':_0x248ab9}},'log':_0xee35('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 0b13f10..28fa393 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 _0x93e7=['outbound','startOf','day','format','endOf','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','Request','merge','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x93e7,0xcf));var _0x793e=function(_0x51fe86,_0x422b66){_0x51fe86=_0x51fe86-0x0;var _0x3557d4=_0x93e7[_0x51fe86];return _0x3557d4;};'use strict';var moment=require(_0x793e('0x0'));var util=require(_0x793e('0x1'));var _=require(_0x793e('0x2'));var client=require(_0x793e('0x3'));exports['create']=function(_0x12e996){return client[_0x793e('0x4')]('CreateVoiceCallReport',{'body':_[_0x793e('0x5')](_0x12e996,{'source':_0x12e996[_0x793e('0x6')],'destinationcontext':_0x12e996[_0x793e('0x7')],'callerid':_0x12e996[_0x793e('0x8')],'amaflags':_0x793e('0x9')}),'log':_0x793e('0xa')});};exports[_0x793e('0xb')]=function(){return function(){return client[_0x793e('0x4')](_0x793e('0xc'),{'options':{'where':{'type':[_0x793e('0xd')],'createdAt':{'$between':[moment()[_0x793e('0xe')](_0x793e('0xf'))[_0x793e('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x793e('0x11')]('day')[_0x793e('0x10')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0x793e('0x12'),_0x793e('0x13'),_0x793e('0x14')]},'log':_0x793e('0x15')});};}; \ No newline at end of file +var _0x7782=['day','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','calleridnum','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf'];(function(_0x301426,_0x22c3a6){var _0x10b340=function(_0x46737c){while(--_0x46737c){_0x301426['push'](_0x301426['shift']());}};_0x10b340(++_0x22c3a6);}(_0x7782,0x166));var _0x2778=function(_0x74e11,_0x51727b){_0x74e11=_0x74e11-0x0;var _0x4c0248=_0x7782[_0x74e11];return _0x4c0248;};'use strict';var moment=require(_0x2778('0x0'));var util=require(_0x2778('0x1'));var _=require(_0x2778('0x2'));var client=require(_0x2778('0x3'));exports[_0x2778('0x4')]=function(_0x3213b0){return client[_0x2778('0x5')]('CreateVoiceCallReport',{'body':_['merge'](_0x3213b0,{'source':_0x3213b0[_0x2778('0x6')],'destinationcontext':_0x3213b0['context'],'callerid':_0x3213b0[_0x2778('0x7')],'amaflags':_0x2778('0x8')}),'log':_0x2778('0x9')});};exports[_0x2778('0xa')]=function(){return function(){return client[_0x2778('0x5')](_0x2778('0xb'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x2778('0xc')]('day')[_0x2778('0xd')](_0x2778('0xe')),moment()[_0x2778('0xf')](_0x2778('0x10'))[_0x2778('0xd')](_0x2778('0xe'))]}},'attributes':[_0x2778('0x11'),_0x2778('0x12'),_0x2778('0x13'),_0x2778('0x14')]},'log':_0x2778('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index be047f4..58baa59 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 _0x96e7=['create','CreateVoiceDialReport'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x96e7,0x1f2));var _0x796e=function(_0x5e8eae,_0x4f81e0){_0x5e8eae=_0x5e8eae-0x0;var _0xdd09cd=_0x96e7[_0x5e8eae];return _0xdd09cd;};'use strict';var client=require('../client');exports[_0x796e('0x0')]=function(_0xc873d){return client['Request']('CreateVoiceDialReport',{'body':_0xc873d,'log':_0x796e('0x1')});}; \ No newline at end of file +var _0x18eb=['create','CreateVoiceDialReport','../client'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x18eb,0x18b));var _0xb18e=function(_0x4135e5,_0x3053b5){_0x4135e5=_0x4135e5-0x0;var _0x4a02f9=_0x18eb[_0x4135e5];return _0x4a02f9;};'use strict';var client=require(_0xb18e('0x0'));exports[_0xb18e('0x1')]=function(_0x5d90d5){return client['Request']('CreateVoiceDialReport',{'body':_0x5d90d5,'log':_0xb18e('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 815e9ae..c5ee8b0 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 _0xc59c=['getVoiceExtensions','Request','GetVoiceExtension','exten','../client'];(function(_0x32e94b,_0x38c7a7){var _0x3b1567=function(_0x282670){while(--_0x282670){_0x32e94b['push'](_0x32e94b['shift']());}};_0x3b1567(++_0x38c7a7);}(_0xc59c,0x72));var _0xcc59=function(_0x446737,_0x411246){_0x446737=_0x446737-0x0;var _0x575b95=_0xc59c[_0x446737];return _0x575b95;};'use strict';var client=require(_0xcc59('0x0'));exports[_0xcc59('0x1')]=function(){return function(){return client[_0xcc59('0x2')](_0xcc59('0x3'),{'options':{'raw':!![],'attributes':['id',_0xcc59('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xcc59('0x1')});};}; \ No newline at end of file +var _0x90a1=['GetVoiceExtension','exten','recordingFormat','getVoiceExtensions','../client'];(function(_0x8732a8,_0x171878){var _0x3e6801=function(_0x4bd403){while(--_0x4bd403){_0x8732a8['push'](_0x8732a8['shift']());}};_0x3e6801(++_0x171878);}(_0x90a1,0xae));var _0x190a=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x90a1[_0x2db12b];return _0x20990b;};'use strict';var client=require(_0x190a('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0x190a('0x1'),{'options':{'raw':!![],'attributes':['id',_0x190a('0x2'),_0x190a('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x190a('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 42a734c..a1b234f 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 _0x63a6=['callerid','Interval','Intervals','interval','getVoiceQueues','Request','name','acw','autopause','monitor_format','type','dialActive','dialPowerLevel','dialPredictiveOptimization','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','Trunk','active'];(function(_0x10b317,_0x2adf32){var _0x1e3054=function(_0x38ed3e){while(--_0x38ed3e){_0x10b317['push'](_0x10b317['shift']());}};_0x1e3054(++_0x2adf32);}(_0x63a6,0x1c7));var _0x663a=function(_0x2bddf9,_0x22c873){_0x2bddf9=_0x2bddf9-0x0;var _0x3f3ae9=_0x63a6[_0x2bddf9];return _0x3f3ae9;};'use strict';var client=require('../client');exports[_0x663a('0x0')]=function(){return function(){return client[_0x663a('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x663a('0x2'),_0x663a('0x3'),'acwTimeout',_0x663a('0x4'),_0x663a('0x5'),_0x663a('0x6'),_0x663a('0x7'),'dialMethod','dialLimitChannel','dialLimitQueue',_0x663a('0x8'),_0x663a('0x9'),'dialPredictiveOptimizationPercentage','dialPredictiveInterval',_0x663a('0xa'),_0x663a('0xb'),_0x663a('0xc'),'dialQueueOptions','dialQueueTimeout',_0x663a('0xd'),_0x663a('0xe'),_0x663a('0xf'),_0x663a('0x10'),_0x663a('0x11'),_0x663a('0x12'),'dialNoAnswerRetryFrequency',_0x663a('0x13'),_0x663a('0x14'),_0x663a('0x15'),'dialPrefix','dialCheckDuplicateType',_0x663a('0x16'),'dialAMDInitialSilence','dialAMDGreeting',_0x663a('0x17'),_0x663a('0x18'),'dialAMDMinWordLength',_0x663a('0x19'),'dialAMDMaximumNumberOfWords',_0x663a('0x1a'),_0x663a('0x1b'),_0x663a('0x1c'),_0x663a('0x1d'),_0x663a('0x1e'),'dialOrderByScheduledAt',_0x663a('0x1f'),'dialAgiAfterHangupClient',_0x663a('0x20'),_0x663a('0x5'),_0x663a('0x21'),_0x663a('0x22'),'dialCutDigit'],'include':[{'model':_0x663a('0x23'),'as':'Trunk','attributes':['id','name','callerid',_0x663a('0x24')]},{'model':_0x663a('0x23'),'as':'TrunkBackup','attributes':['id','name',_0x663a('0x25'),_0x663a('0x24')]},{'model':_0x663a('0x26'),'as':_0x663a('0x26'),'attributes':['id',_0x663a('0x2')],'include':[{'model':_0x663a('0x26'),'as':_0x663a('0x27'),'attributes':['id','name',_0x663a('0x28')]}]}]},'log':_0x663a('0x0')});};}; \ No newline at end of file +var _0xd8d7=['dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','callerid','active','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xd8d7,0x1d4));var _0x7d8d=function(_0x413b4d,_0xa3459c){_0x413b4d=_0x413b4d-0x0;var _0x8b810a=_0xd8d7[_0x413b4d];return _0x8b810a;};'use strict';var client=require(_0x7d8d('0x0'));exports[_0x7d8d('0x1')]=function(){return function(){return client[_0x7d8d('0x2')](_0x7d8d('0x3'),{'options':{'raw':![],'attributes':['id',_0x7d8d('0x4'),'acw','acwTimeout','autopause','monitor_format',_0x7d8d('0x5'),'dialActive',_0x7d8d('0x6'),_0x7d8d('0x7'),_0x7d8d('0x8'),_0x7d8d('0x9'),_0x7d8d('0xa'),_0x7d8d('0xb'),_0x7d8d('0xc'),'dialOriginateCallerIdName',_0x7d8d('0xd'),_0x7d8d('0xe'),_0x7d8d('0xf'),_0x7d8d('0x10'),_0x7d8d('0x11'),_0x7d8d('0x12'),_0x7d8d('0x13'),'dialBusyMaxRetry',_0x7d8d('0x14'),_0x7d8d('0x15'),_0x7d8d('0x16'),_0x7d8d('0x17'),_0x7d8d('0x18'),'dialGlobalInterval',_0x7d8d('0x19'),_0x7d8d('0x1a'),_0x7d8d('0x1b'),_0x7d8d('0x1c'),_0x7d8d('0x1d'),_0x7d8d('0x1e'),'dialAMDTotalAnalysisTime',_0x7d8d('0x1f'),_0x7d8d('0x20'),_0x7d8d('0x21'),_0x7d8d('0x22'),_0x7d8d('0x23'),'timeout',_0x7d8d('0x24'),'dialRecallInQueue',_0x7d8d('0x25'),'dialAgiAfterHangupAgent',_0x7d8d('0x26'),_0x7d8d('0x27'),_0x7d8d('0x28'),_0x7d8d('0x29'),_0x7d8d('0x2a'),_0x7d8d('0x2b')],'include':[{'model':_0x7d8d('0x2c'),'as':_0x7d8d('0x2c'),'attributes':['id','name',_0x7d8d('0x2d'),_0x7d8d('0x2e')]},{'model':_0x7d8d('0x2c'),'as':_0x7d8d('0x2f'),'attributes':['id',_0x7d8d('0x4'),_0x7d8d('0x2d'),_0x7d8d('0x2e')]},{'model':_0x7d8d('0x30'),'as':_0x7d8d('0x30'),'attributes':['id',_0x7d8d('0x4')],'include':[{'model':_0x7d8d('0x30'),'as':_0x7d8d('0x31'),'attributes':['id',_0x7d8d('0x4'),_0x7d8d('0x32')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index d2fd328..240947d 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 _0x9996=['GetVoiceQueueReports','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','queuecallerabandon'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x9996,0x112));var _0x6999=function(_0x295161,_0xa387f6){_0x295161=_0x295161-0x0;var _0x5551aa=_0x9996[_0x295161];return _0x5551aa;};'use strict';var moment=require('moment');var _=require(_0x6999('0x0'));var client=require(_0x6999('0x1'));exports[_0x6999('0x2')]=function(_0x26933b){return client[_0x6999('0x3')](_0x6999('0x4'),{'body':_0x26933b,'log':_0x6999('0x4')});};exports[_0x6999('0x5')]=function(){return function(){return client[_0x6999('0x3')](_0x6999('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x6999('0x7')]('day')[_0x6999('0x8')](_0x6999('0x9')),moment()[_0x6999('0xa')](_0x6999('0xb'))[_0x6999('0x8')](_0x6999('0x9'))]}},'attributes':[_0x6999('0xc'),_0x6999('0xd'),_0x6999('0xe'),_0x6999('0xf'),_0x6999('0x10'),_0x6999('0x11'),'queuecallerexit',_0x6999('0x12'),_0x6999('0x13'),'queuecallerabandonAt']},'log':_0x6999('0x14')});};}; \ No newline at end of file +var _0xe883=['queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','moment','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queuecallerjoinAt','queuecallerleaveAt'];(function(_0x2d3f32,_0x2180b9){var _0x4deb7c=function(_0x5c5e0c){while(--_0x5c5e0c){_0x2d3f32['push'](_0x2d3f32['shift']());}};_0x4deb7c(++_0x2180b9);}(_0xe883,0xa6));var _0x3e88=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xe883[_0x725b8e];return _0x43ac45;};'use strict';var moment=require(_0x3e88('0x0'));var _=require('lodash');var client=require(_0x3e88('0x1'));exports['create']=function(_0x174420){return client[_0x3e88('0x2')](_0x3e88('0x3'),{'body':_0x174420,'log':_0x3e88('0x3')});};exports[_0x3e88('0x4')]=function(){return function(){return client[_0x3e88('0x2')](_0x3e88('0x5'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x3e88('0x6')](_0x3e88('0x7'))[_0x3e88('0x8')](_0x3e88('0x9')),moment()[_0x3e88('0xa')]('day')[_0x3e88('0x8')](_0x3e88('0x9'))]}},'attributes':[_0x3e88('0xb'),'queue',_0x3e88('0xc'),_0x3e88('0xd'),_0x3e88('0xe'),_0x3e88('0xf'),_0x3e88('0x10'),_0x3e88('0x11'),_0x3e88('0x12'),_0x3e88('0x13')]},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 38a03d9..2e82dc1 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 _0x3164=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client'];(function(_0x433036,_0x1a08b1){var _0x33f0bc=function(_0x3655ad){while(--_0x3655ad){_0x433036['push'](_0x433036['shift']());}};_0x33f0bc(++_0x1a08b1);}(_0x3164,0x18b));var _0x4316=function(_0x2798dc,_0x5084c9){_0x2798dc=_0x2798dc-0x0;var _0x38b659=_0x3164[_0x2798dc];return _0x38b659;};'use strict';var client=require(_0x4316('0x0'));exports['getVoiceQueueRtPauses']=function(_0x4822a3){return function(){return client['Request'](_0x4316('0x1'),{'options':{'where':{'VoiceQueueId':_0x4822a3,'paused':!![]},'raw':!![]},'log':_0x4316('0x2')});};}; \ No newline at end of file +var _0x7381=['Request','../client'];(function(_0x497cd1,_0x2dfe8c){var _0x585953=function(_0x5c21c6){while(--_0x5c21c6){_0x497cd1['push'](_0x497cd1['shift']());}};_0x585953(++_0x2dfe8c);}(_0x7381,0x133));var _0x1738=function(_0x57966a,_0x477964){_0x57966a=_0x57966a-0x0;var _0x191765=_0x7381[_0x57966a];return _0x191765;};'use strict';var client=require(_0x1738('0x0'));exports['getVoiceQueueRtPauses']=function(_0x559d09){return function(){return client[_0x1738('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x559d09,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index b190e91..44667c5 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 _0x710c=['merge','monitorFilename','CreateVoiceRecording','../client','create','Request'];(function(_0x31db70,_0x62d245){var _0x5623a4=function(_0x13ae49){while(--_0x13ae49){_0x31db70['push'](_0x31db70['shift']());}};_0x5623a4(++_0x62d245);}(_0x710c,0xc9));var _0xc710=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x710c[_0x4a53d];return _0x27410e;};'use strict';var _=require('lodash');var client=require(_0xc710('0x0'));exports[_0xc710('0x1')]=function(_0x157979){return client[_0xc710('0x2')]('CreateVoiceRecording',{'body':_[_0xc710('0x3')](_0x157979,{'value':_0x157979[_0xc710('0x4')]}),'log':_0xc710('0x5')});}; \ No newline at end of file +var _0x7f5f=['CreateVoiceRecording','lodash','../client','create','Request','monitorFilename'];(function(_0x41a0fe,_0x124f12){var _0x28bd75=function(_0x1d4548){while(--_0x1d4548){_0x41a0fe['push'](_0x41a0fe['shift']());}};_0x28bd75(++_0x124f12);}(_0x7f5f,0x115));var _0xf7f5=function(_0x5d7463,_0x3dbc4a){_0x5d7463=_0x5d7463-0x0;var _0x316d29=_0x7f5f[_0x5d7463];return _0x316d29;};'use strict';var _=require(_0xf7f5('0x0'));var client=require(_0xf7f5('0x1'));exports[_0xf7f5('0x2')]=function(_0x49c9a1){return client[_0xf7f5('0x3')]('CreateVoiceRecording',{'body':_['merge'](_0x49c9a1,{'value':_0x49c9a1[_0xf7f5('0x4')]}),'log':_0xf7f5('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 18dacff..a2566d4 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 _0xe964=['transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','CreateVoiceTransferReport','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','blindTransfer','Request','transfererchannel','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid'];(function(_0x1a10bd,_0x3b3f02){var _0x56048b=function(_0x54f054){while(--_0x54f054){_0x1a10bd['push'](_0x1a10bd['shift']());}};_0x56048b(++_0x3b3f02);}(_0xe964,0x65));var _0x4e96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe964[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x4e96('0x0'));exports[_0x4e96('0x1')]=function(_0x27ce03){return client[_0x4e96('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x27ce03['result'],'transfererchannel':_0x27ce03[_0x4e96('0x3')],'transferercalleridnum':_0x27ce03['transferercalleridnum'],'transferercalleridname':_0x27ce03['transferercalleridname'],'transfererconnectedlinenum':_0x27ce03[_0x4e96('0x4')],'transfererconnectedlinename':_0x27ce03[_0x4e96('0x5')],'transfereraccountcode':_0x27ce03[_0x4e96('0x6')],'transferercontext':_0x27ce03[_0x4e96('0x7')],'transfererexten':_0x27ce03[_0x4e96('0x8')],'transfererlinkedid':_0x27ce03[_0x4e96('0x9')],'transfereechannel':_0x27ce03[_0x4e96('0xa')],'transfereecalleridnum':_0x27ce03[_0x4e96('0xb')],'transfereecalleridname':_0x27ce03[_0x4e96('0xc')],'transfereeconnectedlinenum':_0x27ce03[_0x4e96('0xd')],'transfereeconnectedlinename':_0x27ce03[_0x4e96('0xe')],'transfereeaccountcode':_0x27ce03[_0x4e96('0xf')],'transfereecontext':_0x27ce03[_0x4e96('0x10')],'transfereeexten':_0x27ce03[_0x4e96('0x11')],'transfereelinkedid':_0x27ce03['transfereelinkedid'],'isexternal':_0x27ce03[_0x4e96('0x12')],'context':_0x27ce03[_0x4e96('0x13')],'extension':_0x27ce03['extension'],'type':'blind'},'log':_0x4e96('0x14')});};exports[_0x4e96('0x15')]=function(_0x4d1820){return client['Request'](_0x4e96('0x14'),{'body':{'result':_0x4d1820[_0x4e96('0x16')],'transfererchannel':_0x4d1820[_0x4e96('0x17')],'transferercalleridnum':_0x4d1820[_0x4e96('0x18')],'transferercalleridname':_0x4d1820['origtransferercalleridname'],'transfererconnectedlinenum':_0x4d1820['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x4d1820[_0x4e96('0x19')],'transfereraccountcode':_0x4d1820[_0x4e96('0x1a')],'transferercontext':_0x4d1820[_0x4e96('0x1b')],'transfererexten':_0x4d1820[_0x4e96('0x1c')],'transfererlinkedid':_0x4d1820[_0x4e96('0x1d')],'transfereechannel':_0x4d1820['transfertargetchannel'],'transfereecalleridnum':_0x4d1820['transfertargetcalleridnum'],'transfereecalleridname':_0x4d1820[_0x4e96('0x1e')],'transfereeconnectedlinenum':_0x4d1820['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x4d1820[_0x4e96('0x1f')],'transfereeaccountcode':_0x4d1820['transfertargetaccountcode'],'transfereecontext':_0x4d1820[_0x4e96('0x20')],'transfereeexten':_0x4d1820[_0x4e96('0x21')],'transfereelinkedid':_0x4d1820[_0x4e96('0x22')],'isexternal':_0x4d1820[_0x4e96('0x12')],'context':_0x4d1820[_0x4e96('0x23')],'extension':_0x4d1820[_0x4e96('0x24')],'type':'attended'},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x0c25=['secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x0c25,0x10c));var _0x50c2=function(_0x5d860f,_0x467498){_0x5d860f=_0x5d860f-0x0;var _0x236490=_0x0c25[_0x5d860f];return _0x236490;};'use strict';var client=require(_0x50c2('0x0'));exports[_0x50c2('0x1')]=function(_0x543cbf){return client[_0x50c2('0x2')](_0x50c2('0x3'),{'body':{'result':_0x543cbf[_0x50c2('0x4')],'transfererchannel':_0x543cbf['transfererchannel'],'transferercalleridnum':_0x543cbf[_0x50c2('0x5')],'transferercalleridname':_0x543cbf[_0x50c2('0x6')],'transfererconnectedlinenum':_0x543cbf[_0x50c2('0x7')],'transfererconnectedlinename':_0x543cbf[_0x50c2('0x8')],'transfereraccountcode':_0x543cbf[_0x50c2('0x9')],'transferercontext':_0x543cbf[_0x50c2('0xa')],'transfererexten':_0x543cbf[_0x50c2('0xb')],'transfererlinkedid':_0x543cbf['transfererlinkedid'],'transfereechannel':_0x543cbf['transfereechannel'],'transfereecalleridnum':_0x543cbf['transfereecalleridnum'],'transfereecalleridname':_0x543cbf[_0x50c2('0xc')],'transfereeconnectedlinenum':_0x543cbf['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x543cbf[_0x50c2('0xd')],'transfereeaccountcode':_0x543cbf[_0x50c2('0xe')],'transfereecontext':_0x543cbf[_0x50c2('0xf')],'transfereeexten':_0x543cbf[_0x50c2('0x10')],'transfereelinkedid':_0x543cbf[_0x50c2('0x11')],'isexternal':_0x543cbf[_0x50c2('0x12')],'context':_0x543cbf[_0x50c2('0x13')],'extension':_0x543cbf[_0x50c2('0x14')],'type':'blind'},'log':_0x50c2('0x3')});};exports[_0x50c2('0x15')]=function(_0x4ec734){return client['Request'](_0x50c2('0x3'),{'body':{'result':_0x4ec734[_0x50c2('0x4')],'transfererchannel':_0x4ec734[_0x50c2('0x16')],'transferercalleridnum':_0x4ec734['origtransferercalleridnum'],'transferercalleridname':_0x4ec734[_0x50c2('0x17')],'transfererconnectedlinenum':_0x4ec734[_0x50c2('0x18')],'transfererconnectedlinename':_0x4ec734[_0x50c2('0x19')],'transfereraccountcode':_0x4ec734[_0x50c2('0x1a')],'transferercontext':_0x4ec734[_0x50c2('0x1b')],'transfererexten':_0x4ec734[_0x50c2('0x1c')],'transfererlinkedid':_0x4ec734[_0x50c2('0x1d')],'transfereechannel':_0x4ec734['transfertargetchannel'],'transfereecalleridnum':_0x4ec734[_0x50c2('0x1e')],'transfereecalleridname':_0x4ec734['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x4ec734['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x4ec734[_0x50c2('0x1f')],'transfereeaccountcode':_0x4ec734[_0x50c2('0x20')],'transfereecontext':_0x4ec734[_0x50c2('0x21')],'transfereeexten':_0x4ec734[_0x50c2('0x22')],'transfereelinkedid':_0x4ec734['transfertargetlinkedid'],'isexternal':_0x4ec734['isexternal'],'context':_0x4ec734[_0x50c2('0x23')],'extension':_0x4ec734[_0x50c2('0x24')],'type':'attended'},'log':_0x50c2('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index fea6374..6517147 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 _0x975b=['outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','originated','Trunk','active','callerid','Interval','length','values','channels','voicechannel','map','uniqueid','channel','%s.%s','filename','wav','find','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','StopMixMonitor','stop','voicequeuechannel','queueChannels','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','server','http','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../ami','listen','format','%s/%s','SIP','timers','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','username','join','pick','keys','action','Action','then','message','catch','error','ami\x20disconnected','command','content','voiceQueues','hasOwnProperty','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','type','unmanaged','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay'];(function(_0x9cf222,_0x2232ab){var _0x10cbe8=function(_0x146255){while(--_0x146255){_0x9cf222['push'](_0x9cf222['shift']());}};_0x10cbe8(++_0x2232ab);}(_0x975b,0x1c9));var _0xb975=function(_0x9af9ef,_0x16d579){_0x9af9ef=_0x9af9ef-0x0;var _0x43f724=_0x975b[_0x9af9ef];return _0x43f724;};'use strict';var _=require(_0xb975('0x0'));var util=require(_0xb975('0x1'));var jayson=require(_0xb975('0x2'));var schema=require(_0xb975('0x3'));var BPromise=require(_0xb975('0x4'));var moment=require(_0xb975('0x5'));var config=require(_0xb975('0x6'));var properties=require('../properties');var ami=require(_0xb975('0x7'));exports[_0xb975('0x8')]=function(_0x2007e4,_0x233cd3,_0x599d95){return new BPromise(function(_0x1729fe,_0x3d84f1){var _0x5786ec={'QueuePause':function(_0x4178ee){return new Promise(function(_0x550f78,_0x3dab5b){var _0x593069=util[_0xb975('0x9')](_0xb975('0xa'),_0xb975('0xb'),_0x4178ee['name']);if(_0x2007e4[_0xb975('0xc')]&&_0x2007e4['timers'][_0x593069]&&_0x2007e4[_0xb975('0xc')][_0x593069]['timer']){_0x2007e4[_0xb975('0xc')][_0x593069]['updateAcw']();}if(_0x2007e4[_0xb975('0xd')][_0x593069]){_0x2007e4[_0xb975('0xd')][_0x593069][_0xb975('0xe')]({'statePause':_0x4178ee[_0xb975('0xf')]?!![]:![]});}_0x550f78({'code':0xc8,'message':_0xb975('0x10')});});},'Reload':function(_0x558727){var _0x189e0f=this;return new Promise(function(_0x29ee5d,_0x2979bd){if(ami[_0xb975('0x11')]()==![]){return _0x2979bd(_0x189e0f['error'](0x1f4,[config[_0xb975('0x12')]['ip'],config[_0xb975('0x12')][_0xb975('0x13')],'ami\x20disconnected'][_0xb975('0x14')]('\x20')));}_0x558727=_[_0xb975('0x15')](_0x558727,_[_0xb975('0x16')](properties['module']));_0x558727[_0xb975('0x17')]='Reload';return ami[_0xb975('0x18')](_0x558727)[_0xb975('0x19')](function(_0xaa1ba3){_0x29ee5d({'code':0xc8,'message':_0xaa1ba3[_0xb975('0x1a')]});})[_0xb975('0x1b')](function(_0x327728){_0x2979bd(_0x189e0f[_0xb975('0x1c')](0x1f5,_0x327728['message']));});});},'Command':function(_0x5c6830){var _0x2abb84=this;return new Promise(function(_0x2da9fd,_0x2e34a6){if(ami[_0xb975('0x11')]()==![]){return _0x2e34a6(_0x2abb84['error'](0x1f4,[config[_0xb975('0x12')]['ip'],config['asterisk'][_0xb975('0x13')],_0xb975('0x1d')][_0xb975('0x14')]('\x20')));}_0x5c6830=_['pick'](_0x5c6830,_0xb975('0x1e'));_0x5c6830['action']='Command';return ami[_0xb975('0x18')](_0x5c6830)[_0xb975('0x19')](function(_0x226f21){_0x2da9fd({'code':0xc8,'message':_0x226f21[_0xb975('0x1f')]});})[_0xb975('0x1b')](function(_0x5620fc){_0x2e34a6(_0x2abb84[_0xb975('0x1c')](0x1f5,_0x5620fc['message']));});});},'VoiceQueues':function(_0x4663e0){return new Promise(function(_0x100546,_0xc0d861){var _0x263f73=[];for(var _0x5309c6 in _0x2007e4[_0xb975('0x20')]){if(_0x2007e4[_0xb975('0x20')][_0xb975('0x21')](_0x5309c6)){var _0xed596=_0x2007e4['voiceQueues'][_0x5309c6];var _0x323600={'id':_0xed596['id'],'name':_0xed596[_0xb975('0x22')],'strategy':_0xed596[_0xb975('0x23')],'answered':_0xed596[_0xb975('0x24')],'available':_0xed596[_0xb975('0x25')],'loggedIn':_0xed596[_0xb975('0x26')],'pTalking':_0xed596[_0xb975('0x27')],'sumBillable':_0xed596[_0xb975('0x28')],'sumDuration':_0xed596[_0xb975('0x29')],'sumHoldTime':_0xed596['sumHoldTime']||0x0,'talking':_0xed596[_0xb975('0x2a')],'total':_0xed596[_0xb975('0x2b')],'type':_0xed596[_0xb975('0x2c')],'unmanaged':_0xed596[_0xb975('0x2d')],'waiting':_0xed596[_0xb975('0x2e')],'loggedInDb':_0xed596[_0xb975('0x2f')]};if(_0xed596[_0xb975('0x2c')]===_0xb975('0x30')){_0x323600[_0xb975('0x31')]=_0xed596[_0xb975('0x31')];_0x323600[_0xb975('0x32')]=_0xed596['dialMethod'];_0x323600[_0xb975('0x33')]=_0xed596['dialOriginateCallerIdName'];_0x323600['dialOriginateCallerIdNumber']=_0xed596[_0xb975('0x34')];_0x323600['dialOriginateTimeout']=_0xed596[_0xb975('0x35')];_0x323600[_0xb975('0x36')]=_0xed596['dialPrefix'];_0x323600[_0xb975('0x37')]=_0xed596['outboundAnswerAgiCallsDay'];_0x323600[_0xb975('0x38')]=_0xed596[_0xb975('0x38')];_0x323600[_0xb975('0x39')]=_0xed596[_0xb975('0x39')];_0x323600[_0xb975('0x3a')]=_0xed596['outboundBusyCallsDay'];_0x323600[_0xb975('0x3b')]=_0xed596['outboundCongestionCallsDay'];_0x323600['outboundDropCallsDayACS']=_0xed596[_0xb975('0x3c')];_0x323600[_0xb975('0x3d')]=_0xed596[_0xb975('0x3d')];_0x323600[_0xb975('0x3e')]=_0xed596[_0xb975('0x3e')];_0x323600[_0xb975('0x3f')]=_0xed596[_0xb975('0x3f')];_0x323600[_0xb975('0x40')]=_0xed596['outboundNoSuchCallsDay'];_0x323600[_0xb975('0x41')]=_0xed596[_0xb975('0x41')];_0x323600['outboundReCallsDay']=_0xed596[_0xb975('0x42')];_0x323600[_0xb975('0x43')]=_0xed596[_0xb975('0x43')];_0x323600[_0xb975('0x44')]=_0xed596[_0xb975('0x44')];_0x323600[_0xb975('0x45')]=_0xed596[_0xb975('0x45')];_0x323600['predictiveIntervalAvgHoldtime']=_0xed596[_0xb975('0x46')];_0x323600['predictiveIntervalAvgTalktime']=_0xed596[_0xb975('0x47')];_0x323600[_0xb975('0x48')]=_0xed596['predictiveIntervalDroppedCallsCallersExit'];_0x323600[_0xb975('0x49')]=_0xed596['predictiveIntervalDroppedCallsTimeout'];_0x323600[_0xb975('0x4a')]=_0xed596[_0xb975('0x4a')];_0x323600[_0xb975('0x4b')]=_0xed596[_0xb975('0x4b')];_0x323600[_0xb975('0x4c')]=_0xed596[_0xb975('0x4c')];_0x323600[_0xb975('0x4d')]=_0xed596[_0xb975('0x4d')];_0x323600['predictiveIntervalMultiplicativeFactor']=_0xed596[_0xb975('0x4e')];_0x323600[_0xb975('0x4f')]=_0xed596[_0xb975('0x4f')];_0x323600['predictiveIntervalTotalCalls']=_0xed596['predictiveIntervalTotalCalls'];_0x323600[_0xb975('0x1a')]=_0xed596[_0xb975('0x1a')];_0x323600[_0xb975('0x50')]=_0xed596['originated'];}if(_0xed596['Trunk']){_0x323600[_0xb975('0x51')]={'id':_0xed596[_0xb975('0x51')]['id'],'name':_0xed596[_0xb975('0x51')][_0xb975('0x22')],'active':_0xed596['Trunk'][_0xb975('0x52')],'callerid':_0xed596[_0xb975('0x51')][_0xb975('0x53')]};}if(_0xed596[_0xb975('0x54')]){_0x323600['Interval']={'id':_0xed596[_0xb975('0x54')]['id'],'name':_0xed596[_0xb975('0x54')]['name']};}_0x263f73['push'](_0x323600);}}_0x100546({'count':_0x263f73[_0xb975('0x55')],'rows':_0x263f73});});},'VoiceChannels':function(_0x5eea71){return new Promise(function(_0x545b31,_0x224ef0){var _0x5e8472=_[_0xb975('0x56')](_0x2007e4[_0xb975('0x57')]);_0x545b31({'count':_0x5e8472['length'],'rows':_0x5e8472});});},'VoiceChannelMixMonitor':function(_0x155402){var _0x3c3b17=this;return new Promise(function(_0x5df4ff,_0x10f3b2){if(ami[_0xb975('0x11')]()==![]){return _0x10f3b2(_0x3c3b17['error'](0x1f4,[config[_0xb975('0x12')]['ip'],config[_0xb975('0x12')][_0xb975('0x13')],'ami\x20disconnected'][_0xb975('0x14')]('\x20')));}var _0x2d7ffa=schema(properties[_0xb975('0x58')])['validate'](_0x155402);if(_0x2d7ffa[_0xb975('0x55')]>0x0){return _0x10f3b2(_0x3c3b17[_0xb975('0x1c')](0x1f4,_[_0xb975('0x59')](_0x2d7ffa,_0xb975('0x1a'))['join'](',\x20')));}var _0x5ee69e=_['find'](_0x2007e4[_0xb975('0x57')],{'uniqueid':_0x155402[_0xb975('0x5a')]});if(_0x5ee69e&&_0x5ee69e[_0xb975('0x5b')]){var _0x2cb2cc=util[_0xb975('0x9')](_0xb975('0x5c'),_0x155402[_0xb975('0x5d')]||_0x155402[_0xb975('0x5a')],_0x155402[_0xb975('0x9')]||_0xb975('0x5e'));return ami[_0xb975('0x18')]({'action':'MixMonitor','channel':_0x5ee69e[_0xb975('0x5b')],'file':_0x2cb2cc,'options':'ai(mixmonitorid)'})['then'](function(_0x5a5f99){var _0x27852d=_[_0xb975('0x5f')](_0x5ee69e['monitors'],{'filename':_0xb975('0x60')+_0x2cb2cc[_0xb975('0x61')]()});if(_[_0xb975('0x62')](_0x27852d)){_0x5ee69e[_0xb975('0x63')][_0xb975('0x64')]({'filename':_0xb975('0x60')+_0x2cb2cc[_0xb975('0x61')](),'createdAt':moment()[_0xb975('0x9')](_0xb975('0x65')),'mixmonitorid':_0x5a5f99['mixmonitorid'],'status':'rec'});}else{_0x27852d['mixmonitorid']=_0x5a5f99[_0xb975('0x66')];_0x27852d[_0xb975('0x67')]='rec';}_0x5df4ff({'code':0xc8,'message':[_0x155402[_0xb975('0x5a')],_0xb975('0x68'),_0x5a5f99[_0xb975('0x66')]]['join']('\x20'),'mixmonitorid':_0x5a5f99[_0xb975('0x66')]});})['catch'](function(_0x3853ac){_0x10f3b2(_0x3c3b17['error'](0x1f5,[_0x155402[_0xb975('0x5a')],_0x3853ac[_0xb975('0x1a')][_0xb975('0x61')]()][_0xb975('0x14')]('\x20')));});}else{return _0x10f3b2(_0x3c3b17['error'](0x1f5,_0xb975('0x69')));}});},'VoiceChannelStopMixMonitor':function(_0x108872){var _0x4ee3b0=this;return new Promise(function(_0x57def2,_0x5c4831){if(ami[_0xb975('0x11')]()==![]){return _0x5c4831(_0x4ee3b0[_0xb975('0x1c')](0x1f4,[config[_0xb975('0x12')]['ip'],config[_0xb975('0x12')][_0xb975('0x13')],_0xb975('0x1d')][_0xb975('0x14')]('\x20')));}var _0x117277=schema(properties[_0xb975('0x58')])[_0xb975('0x3')](_0x108872);if(_0x117277[_0xb975('0x55')]>0x0){return _0x5c4831(_0x4ee3b0[_0xb975('0x1c')](0x1f4,_[_0xb975('0x59')](_0x117277,_0xb975('0x1a'))[_0xb975('0x14')](',\x20')));}var _0x4ee894=_[_0xb975('0x5f')](_0x2007e4[_0xb975('0x57')],{'uniqueid':_0x108872[_0xb975('0x5a')]});if(_0x4ee894){return BPromise[_0xb975('0x6a')]()[_0xb975('0x19')](function(){if(_0x4ee894['channel']){return ami['Action']({'action':'StopMixMonitor','channel':_0x4ee894[_0xb975('0x5b')],'mixmonitorid':_0x108872[_0xb975('0x66')]})[_0xb975('0x1b')](function(_0xf4957b){});}})[_0xb975('0x19')](function(){if(_0x4ee894[_0xb975('0x6b')]){return ami['Action']({'action':_0xb975('0x6c'),'channel':_0x4ee894['destinationchannel'],'mixmonitorid':_0x108872[_0xb975('0x66')]})['catch'](function(_0x40a708){});}})[_0xb975('0x19')](function(_0x2dd984){var _0xdfce82=_[_0xb975('0x5f')](_0x4ee894[_0xb975('0x63')],{'mixmonitorid':_0x108872[_0xb975('0x66')]});if(_0xdfce82){_0xdfce82[_0xb975('0x67')]=_0xb975('0x6d');}})[_0xb975('0x19')](function(){var _0x44dad4=util[_0xb975('0x9')](_0xb975('0x5c'),_0x108872[_0xb975('0x5d')]||_0x108872[_0xb975('0x5a')],_0x108872[_0xb975('0x9')]||'wav');var _0x4e9873=_[_0xb975('0x5f')](_0x4ee894['monitors'],{'filename':_0xb975('0x60')+_0x44dad4[_0xb975('0x61')]()});if(_0x4e9873){_0x4e9873[_0xb975('0x67')]='stop';}})[_0xb975('0x19')](function(){_0x57def2({'code':0xc8,'message':[_0x108872[_0xb975('0x5a')],'StopMixMonitor\x20Success'][_0xb975('0x14')]('\x20')});})['catch'](function(_0x464c75){_0x5c4831(_0x4ee3b0[_0xb975('0x1c')](0x1f5,[_0x108872[_0xb975('0x5a')],_0x464c75[_0xb975('0x1a')][_0xb975('0x61')]()][_0xb975('0x14')]('\x20')));});}else{return _0x5c4831(_0x4ee3b0[_0xb975('0x1c')](0x1f5,_0xb975('0x69')));}});},'VoiceQueuesChannels':function(_0xad129e){return new Promise(function(_0x318174,_0xf0393b){var _0x3b0e53=_[_0xb975('0x56')](_0x2007e4['queueChannels']);_0x318174({'count':_0x3b0e53[_0xb975('0x55')],'rows':_0x3b0e53});});},'VoiceQueuesChannel':function(_0x34cc42){var _0x1c52ac=this;return new Promise(function(_0x4a0739,_0x575702){var _0x69657c=schema(properties[_0xb975('0x6e')])[_0xb975('0x3')](_0x34cc42);if(_0x69657c[_0xb975('0x55')]>0x0){return _0x575702(_0x1c52ac[_0xb975('0x1c')](0x1f4,_[_0xb975('0x59')](_0x69657c,_0xb975('0x1a'))[_0xb975('0x14')](',\x20')));}var _0x390660=_[_0xb975('0x5f')](_0x2007e4[_0xb975('0x6f')],{'uniqueid':_0x34cc42['uniqueid']});if(_0x390660){_0x4a0739(_0x390660);}else{return _0x575702(_0x1c52ac[_0xb975('0x1c')](0x1f5,_0xb975('0x69')));}});},'VoiceQueuesChannelHangup':function(_0x5aa2be){var _0xa2c67=this;return new Promise(function(_0x52647f,_0x7661c4){if(ami[_0xb975('0x11')]()==![]){return _0x7661c4(_0xa2c67[_0xb975('0x1c')](0x1f4,[config[_0xb975('0x12')]['ip'],config[_0xb975('0x12')][_0xb975('0x13')],'ami\x20disconnected'][_0xb975('0x14')]('\x20')));}var _0x547a85=schema(properties[_0xb975('0x70')])[_0xb975('0x3')](_0x5aa2be);if(_0x547a85[_0xb975('0x55')]>0x0){return _0x7661c4(_0xa2c67['error'](0x1f4,_[_0xb975('0x59')](_0x547a85,_0xb975('0x1a'))['join'](',\x20')));}var _0x559cfc=_[_0xb975('0x5f')](_0x2007e4[_0xb975('0x6f')],{'uniqueid':_0x5aa2be[_0xb975('0x5a')]});if(_0x559cfc&&_0x559cfc[_0xb975('0x5b')]){return ami['Action']({'action':'Hangup','channel':_0x559cfc[_0xb975('0x5b')]})[_0xb975('0x19')](function(_0x457e57){_0x52647f({'code':0xc8,'message':[_0x5aa2be[_0xb975('0x5a')],_0x457e57[_0xb975('0x1a')][_0xb975('0x61')]()]['join']('\x20')});})['catch'](function(_0x1f7196){_0x7661c4(_0xa2c67[_0xb975('0x1c')](0x1f5,[_0x5aa2be[_0xb975('0x5a')],_0x1f7196[_0xb975('0x1a')][_0xb975('0x61')]()][_0xb975('0x14')]('\x20')));});}else{return _0x7661c4(_0xa2c67[_0xb975('0x1c')](0x1f5,_0xb975('0x69')));}});},'VoiceQueuesChannelRedirect':function(_0x282b2e){var _0x2125d4=this;return new Promise(function(_0x3d0c7b,_0x4b75aa){if(ami[_0xb975('0x11')]()==![]){return _0x4b75aa(_0x2125d4[_0xb975('0x1c')](0x1f4,[config[_0xb975('0x12')]['ip'],config[_0xb975('0x12')][_0xb975('0x13')],'ami\x20disconnected'][_0xb975('0x14')]('\x20')));}var _0x18be39=schema(properties[_0xb975('0x71')])[_0xb975('0x3')](_0x282b2e);if(_0x18be39[_0xb975('0x55')]>0x0){return _0x4b75aa(_0x2125d4[_0xb975('0x1c')](0x1f4,_[_0xb975('0x59')](_0x18be39,_0xb975('0x1a'))[_0xb975('0x14')](',\x20')));}var _0xa41c73=_[_0xb975('0x5f')](_0x2007e4[_0xb975('0x6f')],{'uniqueid':_0x282b2e[_0xb975('0x5a')]});if(_0xa41c73&&_0xa41c73[_0xb975('0x5b')]){return ami[_0xb975('0x18')]({'action':_0xb975('0x72'),'channel':_0xa41c73[_0xb975('0x5b')],'exten':_0x282b2e[_0xb975('0x73')],'context':_0x282b2e['context']||_0xa41c73[_0xb975('0x74')],'priority':0x1})[_0xb975('0x19')](function(_0x551afd){_0x3d0c7b({'code':0xc8,'message':[_0x282b2e[_0xb975('0x5a')],_0x551afd[_0xb975('0x1a')][_0xb975('0x61')]()][_0xb975('0x14')]('\x20')});})['catch'](function(_0xc98f70){_0x4b75aa(_0x2125d4[_0xb975('0x1c')](0x1f5,[_0x282b2e[_0xb975('0x5a')],_0xc98f70[_0xb975('0x1a')]['toLowerCase']()][_0xb975('0x14')]('\x20')));});}else{return _0x4b75aa(_0x2125d4[_0xb975('0x1c')](0x1f5,_0xb975('0x69')));}});},'Agents':function(_0x4c33f8){return new Promise(function(_0x43cdc9,_0x140bb6){var _0xc9f295=_[_0xb975('0x56')](_0x2007e4[_0xb975('0xd')]);_0x43cdc9({'count':_0xc9f295[_0xb975('0x55')],'rows':_0xc9f295});});},'Telephones':function(_0x21bba3){return new Promise(function(_0x131f44,_0x5e0551){var _0x1b73c4=_[_0xb975('0x56')](_0x2007e4[_0xb975('0x75')]);_0x131f44({'count':_0x1b73c4['length'],'rows':_0x1b73c4});});},'Trunks':function(_0x4177c2){return new Promise(function(_0x32d624,_0x28c74d){var _0x89b1d0=_[_0xb975('0x56')](_0x2007e4[_0xb975('0x76')]);_0x32d624({'count':_0x89b1d0[_0xb975('0x55')],'rows':_0x89b1d0});});},'OutboundChannels':function(_0x2424d7){return new Promise(function(_0x7930ad,_0x186e66){var _0x5bc7e7=_[_0xb975('0x56')](_0x2007e4[_0xb975('0x77')]);_0x7930ad({'count':_0x5bc7e7['length'],'rows':_0x5bc7e7});});},'Outbound':function(_0x42dfb8){return new Promise(function(_0x8c198a,_0x5c270e){_0x8c198a(_0x2007e4[_0xb975('0x30')]);});},'Campaigns':function(_0x1fdfc6){return new Promise(function(_0x22a13e,_0x66f58f){var _0x5b1e9f=_[_0xb975('0x56')](_0x2007e4[_0xb975('0x78')]);_0x22a13e({'count':_0x5b1e9f[_0xb975('0x55')],'rows':_0x5b1e9f});});},'VoiceQueuesPreview':function(_0xaac8c1){var _0x7fcdae=this;return new Promise(function(_0x1d1943,_0x35d443){_0x233cd3[_0xb975('0x79')](_0xaac8c1['id'])[_0xb975('0x19')](function(_0x22bef3){_0x1d1943({'code':0xc8,'message':_0x22bef3[_0xb975('0x1a')]});})[_0xb975('0x1b')](function(_0x382a99){_0x35d443(_0x7fcdae[_0xb975('0x1c')](0x1f4,_0x382a99[_0xb975('0x1a')]));});});},'EventManager':function(_0x502907){var _0x3b5a9f=this;return new Promise(function(_0x5cc346,_0x4b61a6){if(!_0x502907[_0xb975('0x7a')]){return _0x4b61a6(_0x3b5a9f[_0xb975('0x1c')](0x1f4,_0xb975('0x7b')));}ami[_0xb975('0x7c')](_0xb975('0x7d')+_0x502907[_0xb975('0x7a')],_0x502907[_0xb975('0x1a')]);_0x5cc346({'code':0xc8,'message':_0x502907});});},'FaxAccounts':function(_0x4266e1){return new Promise(function(_0x585298,_0x1ca03d){var _0x1afd91=_[_0xb975('0x56')](_0x2007e4[_0xb975('0x7e')]);_0x585298({'count':_0x1afd91['length'],'rows':_0x1afd91});});},'SendFax':function(_0x1ac6ea){var _0x3b8d01=this;return new Promise(function(_0x47c86d,_0x5125b2){_0x599d95['send'](_0x1ac6ea)[_0xb975('0x19')](function(_0x21bbf4){_0x47c86d({'code':0xc8,'message':_0x21bbf4['message']});})['catch'](function(_0x3a922d){_0x5125b2(_0x3b8d01[_0xb975('0x1c')](0x1f4,_0x3a922d[_0xb975('0x1a')]));});});},'CheckAfterSend':function(_0x49821e){var _0x22c2f7=this;return new Promise(function(_0x10bcab,_0x365d8d){_0x599d95['checkAfterSend'](_0x49821e)['then'](function(_0x3b841d){_0x10bcab({'code':0xc8,'message':_0x3b841d[_0xb975('0x1a')]});})[_0xb975('0x1b')](function(_0x21963e){_0x365d8d(_0x22c2f7[_0xb975('0x1c')](0x1f4,_0x21963e['message']));});});}};var _0x5554d3=jayson[_0xb975('0x7f')](_0x5786ec)[_0xb975('0x80')]();_0x5554d3['on'](_0xb975('0x1c'),function(_0x11c453){return _0x3d84f1(_0x11c453);});_0x5554d3['listen'](0x232a,'127.0.0.1',function(){console['log'](_0xb975('0x81'),0x232a);return _0x1729fe(_0xb975('0x82')+0x232a);});});}; \ No newline at end of file +var _0xc1fc=['Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','bluebird','moment','../../../config/environment','../properties','../ami','listen','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','then','message','isConnected','command','Command','Action','content','catch','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','total','unmanaged','waiting','loggedInDb','type','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','Trunk','active','Interval','push','values','voicechannel','length','map','find','channels','channel','filename','uniqueid','format','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','validate','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','wav','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','exten','context','telephones','outboundChannels','outbound','campaigns','run','event'];(function(_0x5d6e35,_0x4d1ac0){var _0x5d7ada=function(_0x2f7dd3){while(--_0x2f7dd3){_0x5d6e35['push'](_0x5d6e35['shift']());}};_0x5d7ada(++_0x4d1ac0);}(_0xc1fc,0x93));var _0xcc1f=function(_0x419d15,_0x51f3ba){_0x419d15=_0x419d15-0x0;var _0x4d3643=_0xc1fc[_0x419d15];return _0x4d3643;};'use strict';var _=require('lodash');var util=require(_0xcc1f('0x0'));var jayson=require(_0xcc1f('0x1'));var schema=require('validate');var BPromise=require(_0xcc1f('0x2'));var moment=require(_0xcc1f('0x3'));var config=require(_0xcc1f('0x4'));var properties=require(_0xcc1f('0x5'));var ami=require(_0xcc1f('0x6'));exports[_0xcc1f('0x7')]=function(_0x42d563,_0x25f41c,_0x493a97){return new BPromise(function(_0x5f448b,_0x376348){var _0x4516e3={'QueuePause':function(_0x431ca8){return new Promise(function(_0x123b7d,_0x272a75){var _0x5ad3ab=util['format']('%s/%s',_0xcc1f('0x8'),_0x431ca8[_0xcc1f('0x9')]);if(_0x42d563[_0xcc1f('0xa')]&&_0x42d563[_0xcc1f('0xa')][_0x5ad3ab]&&_0x42d563[_0xcc1f('0xa')][_0x5ad3ab][_0xcc1f('0xb')]){_0x42d563[_0xcc1f('0xa')][_0x5ad3ab][_0xcc1f('0xc')]();}if(_0x42d563[_0xcc1f('0xd')][_0x5ad3ab]){_0x42d563['agents'][_0x5ad3ab][_0xcc1f('0xe')]({'statePause':_0x431ca8[_0xcc1f('0xf')]?!![]:![]});}_0x123b7d({'code':0xc8,'message':_0xcc1f('0x10')});});},'Reload':function(_0x31f30d){var _0x9842de=this;return new Promise(function(_0x38d746,_0x2f237b){if(ami['isConnected']()==![]){return _0x2f237b(_0x9842de[_0xcc1f('0x11')](0x1f4,[config[_0xcc1f('0x12')]['ip'],config[_0xcc1f('0x12')][_0xcc1f('0x13')],_0xcc1f('0x14')][_0xcc1f('0x15')]('\x20')));}_0x31f30d=_[_0xcc1f('0x16')](_0x31f30d,_[_0xcc1f('0x17')](properties[_0xcc1f('0x18')]));_0x31f30d[_0xcc1f('0x19')]='Reload';return ami['Action'](_0x31f30d)[_0xcc1f('0x1a')](function(_0x10648f){_0x38d746({'code':0xc8,'message':_0x10648f[_0xcc1f('0x1b')]});})['catch'](function(_0x314d9d){_0x2f237b(_0x9842de['error'](0x1f5,_0x314d9d['message']));});});},'Command':function(_0xecece8){var _0xc86602=this;return new Promise(function(_0x5ed11c,_0x1a17e8){if(ami[_0xcc1f('0x1c')]()==![]){return _0x1a17e8(_0xc86602[_0xcc1f('0x11')](0x1f4,[config[_0xcc1f('0x12')]['ip'],config[_0xcc1f('0x12')][_0xcc1f('0x13')],'ami\x20disconnected'][_0xcc1f('0x15')]('\x20')));}_0xecece8=_['pick'](_0xecece8,_0xcc1f('0x1d'));_0xecece8[_0xcc1f('0x19')]=_0xcc1f('0x1e');return ami[_0xcc1f('0x1f')](_0xecece8)['then'](function(_0x3eb698){_0x5ed11c({'code':0xc8,'message':_0x3eb698[_0xcc1f('0x20')]});})[_0xcc1f('0x21')](function(_0x257e7f){_0x1a17e8(_0xc86602[_0xcc1f('0x11')](0x1f5,_0x257e7f[_0xcc1f('0x1b')]));});});},'VoiceQueues':function(_0x1f04c1){return new Promise(function(_0x4e9cdb,_0x1939aa){var _0x1ab98c=[];for(var _0x12d66e in _0x42d563[_0xcc1f('0x22')]){if(_0x42d563[_0xcc1f('0x22')][_0xcc1f('0x23')](_0x12d66e)){var _0x1d4739=_0x42d563[_0xcc1f('0x22')][_0x12d66e];var _0x5457a3={'id':_0x1d4739['id'],'name':_0x1d4739[_0xcc1f('0x9')],'strategy':_0x1d4739[_0xcc1f('0x24')],'answered':_0x1d4739[_0xcc1f('0x25')],'available':_0x1d4739[_0xcc1f('0x26')],'loggedIn':_0x1d4739[_0xcc1f('0x27')],'pTalking':_0x1d4739[_0xcc1f('0x28')],'sumBillable':_0x1d4739['sumBillable'],'sumDuration':_0x1d4739[_0xcc1f('0x29')],'sumHoldTime':_0x1d4739[_0xcc1f('0x2a')]||0x0,'talking':_0x1d4739['talking'],'total':_0x1d4739[_0xcc1f('0x2b')],'type':_0x1d4739['type'],'unmanaged':_0x1d4739[_0xcc1f('0x2c')],'waiting':_0x1d4739[_0xcc1f('0x2d')],'loggedInDb':_0x1d4739[_0xcc1f('0x2e')]};if(_0x1d4739[_0xcc1f('0x2f')]==='outbound'){_0x5457a3['dialActive']=_0x1d4739[_0xcc1f('0x30')];_0x5457a3[_0xcc1f('0x31')]=_0x1d4739[_0xcc1f('0x31')];_0x5457a3[_0xcc1f('0x32')]=_0x1d4739[_0xcc1f('0x32')];_0x5457a3[_0xcc1f('0x33')]=_0x1d4739[_0xcc1f('0x33')];_0x5457a3['dialOriginateTimeout']=_0x1d4739[_0xcc1f('0x34')];_0x5457a3[_0xcc1f('0x35')]=_0x1d4739[_0xcc1f('0x35')];_0x5457a3['outboundAnswerAgiCallsDay']=_0x1d4739[_0xcc1f('0x36')];_0x5457a3[_0xcc1f('0x37')]=_0x1d4739[_0xcc1f('0x37')];_0x5457a3[_0xcc1f('0x38')]=_0x1d4739[_0xcc1f('0x38')];_0x5457a3[_0xcc1f('0x39')]=_0x1d4739[_0xcc1f('0x39')];_0x5457a3[_0xcc1f('0x3a')]=_0x1d4739['outboundCongestionCallsDay'];_0x5457a3[_0xcc1f('0x3b')]=_0x1d4739[_0xcc1f('0x3b')];_0x5457a3['outboundDropCallsDayCallersExit']=_0x1d4739[_0xcc1f('0x3c')];_0x5457a3[_0xcc1f('0x3d')]=_0x1d4739[_0xcc1f('0x3d')];_0x5457a3['outboundNoAnswerCallsDay']=_0x1d4739['outboundNoAnswerCallsDay'];_0x5457a3[_0xcc1f('0x3e')]=_0x1d4739[_0xcc1f('0x3e')];_0x5457a3[_0xcc1f('0x3f')]=_0x1d4739['outboundOriginateFailureCallsDay'];_0x5457a3[_0xcc1f('0x40')]=_0x1d4739[_0xcc1f('0x40')];_0x5457a3[_0xcc1f('0x41')]=_0x1d4739[_0xcc1f('0x41')];_0x5457a3[_0xcc1f('0x42')]=_0x1d4739[_0xcc1f('0x42')];_0x5457a3[_0xcc1f('0x43')]=_0x1d4739[_0xcc1f('0x43')];_0x5457a3[_0xcc1f('0x44')]=_0x1d4739[_0xcc1f('0x44')];_0x5457a3[_0xcc1f('0x45')]=_0x1d4739['predictiveIntervalAvgTalktime'];_0x5457a3['predictiveIntervalDroppedCallsCallersExit']=_0x1d4739['predictiveIntervalDroppedCallsCallersExit'];_0x5457a3[_0xcc1f('0x46')]=_0x1d4739[_0xcc1f('0x46')];_0x5457a3[_0xcc1f('0x47')]=_0x1d4739[_0xcc1f('0x47')];_0x5457a3[_0xcc1f('0x48')]=_0x1d4739[_0xcc1f('0x48')];_0x5457a3[_0xcc1f('0x49')]=_0x1d4739[_0xcc1f('0x49')];_0x5457a3[_0xcc1f('0x4a')]=_0x1d4739[_0xcc1f('0x4a')];_0x5457a3[_0xcc1f('0x4b')]=_0x1d4739[_0xcc1f('0x4b')];_0x5457a3[_0xcc1f('0x4c')]=_0x1d4739['predictiveIntervalPauses'];_0x5457a3[_0xcc1f('0x4d')]=_0x1d4739[_0xcc1f('0x4d')];_0x5457a3[_0xcc1f('0x1b')]=_0x1d4739[_0xcc1f('0x1b')];_0x5457a3['originated']=_0x1d4739['originated'];}if(_0x1d4739[_0xcc1f('0x4e')]){_0x5457a3['Trunk']={'id':_0x1d4739[_0xcc1f('0x4e')]['id'],'name':_0x1d4739[_0xcc1f('0x4e')][_0xcc1f('0x9')],'active':_0x1d4739['Trunk'][_0xcc1f('0x4f')],'callerid':_0x1d4739[_0xcc1f('0x4e')]['callerid']};}if(_0x1d4739[_0xcc1f('0x50')]){_0x5457a3[_0xcc1f('0x50')]={'id':_0x1d4739['Interval']['id'],'name':_0x1d4739['Interval'][_0xcc1f('0x9')]};}_0x1ab98c[_0xcc1f('0x51')](_0x5457a3);}}_0x4e9cdb({'count':_0x1ab98c['length'],'rows':_0x1ab98c});});},'VoiceChannels':function(_0x4495b9){return new Promise(function(_0x362eeb,_0x117f76){var _0x1cf706=_[_0xcc1f('0x52')](_0x42d563['channels']);_0x362eeb({'count':_0x1cf706['length'],'rows':_0x1cf706});});},'VoiceChannelMixMonitor':function(_0x2e178d){var _0x3b3ae4=this;return new Promise(function(_0x91d7f0,_0x30eafe){if(ami[_0xcc1f('0x1c')]()==![]){return _0x30eafe(_0x3b3ae4[_0xcc1f('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xcc1f('0x12')][_0xcc1f('0x13')],_0xcc1f('0x14')][_0xcc1f('0x15')]('\x20')));}var _0x5a2694=schema(properties[_0xcc1f('0x53')])['validate'](_0x2e178d);if(_0x5a2694[_0xcc1f('0x54')]>0x0){return _0x30eafe(_0x3b3ae4[_0xcc1f('0x11')](0x1f4,_[_0xcc1f('0x55')](_0x5a2694,'message')[_0xcc1f('0x15')](',\x20')));}var _0x442642=_[_0xcc1f('0x56')](_0x42d563[_0xcc1f('0x57')],{'uniqueid':_0x2e178d['uniqueid']});if(_0x442642&&_0x442642[_0xcc1f('0x58')]){var _0x781a9b=util['format']('%s.%s',_0x2e178d[_0xcc1f('0x59')]||_0x2e178d[_0xcc1f('0x5a')],_0x2e178d[_0xcc1f('0x5b')]||'wav');return ami[_0xcc1f('0x1f')]({'action':_0xcc1f('0x5c'),'channel':_0x442642[_0xcc1f('0x58')],'file':_0x781a9b,'options':_0xcc1f('0x5d')})[_0xcc1f('0x1a')](function(_0x24b3bf){var _0x4efa0b=_[_0xcc1f('0x56')](_0x442642['monitors'],{'filename':_0xcc1f('0x5e')+_0x781a9b[_0xcc1f('0x5f')]()});if(_[_0xcc1f('0x60')](_0x4efa0b)){_0x442642[_0xcc1f('0x61')]['push']({'filename':_0xcc1f('0x5e')+_0x781a9b[_0xcc1f('0x5f')](),'createdAt':moment()[_0xcc1f('0x5b')](_0xcc1f('0x62')),'mixmonitorid':_0x24b3bf[_0xcc1f('0x63')],'status':_0xcc1f('0x64')});}else{_0x4efa0b[_0xcc1f('0x63')]=_0x24b3bf[_0xcc1f('0x63')];_0x4efa0b[_0xcc1f('0x65')]=_0xcc1f('0x64');}_0x91d7f0({'code':0xc8,'message':[_0x2e178d[_0xcc1f('0x5a')],_0xcc1f('0x66'),_0x24b3bf['mixmonitorid']]['join']('\x20'),'mixmonitorid':_0x24b3bf[_0xcc1f('0x63')]});})[_0xcc1f('0x21')](function(_0x5694a4){_0x30eafe(_0x3b3ae4['error'](0x1f5,[_0x2e178d[_0xcc1f('0x5a')],_0x5694a4[_0xcc1f('0x1b')][_0xcc1f('0x5f')]()]['join']('\x20')));});}else{return _0x30eafe(_0x3b3ae4[_0xcc1f('0x11')](0x1f5,_0xcc1f('0x67')));}});},'VoiceChannelStopMixMonitor':function(_0x19faff){var _0x30405b=this;return new Promise(function(_0x147c9d,_0x57807a){if(ami['isConnected']()==![]){return _0x57807a(_0x30405b[_0xcc1f('0x11')](0x1f4,[config[_0xcc1f('0x12')]['ip'],config[_0xcc1f('0x12')][_0xcc1f('0x13')],_0xcc1f('0x14')]['join']('\x20')));}var _0x226908=schema(properties[_0xcc1f('0x53')])[_0xcc1f('0x68')](_0x19faff);if(_0x226908['length']>0x0){return _0x57807a(_0x30405b[_0xcc1f('0x11')](0x1f4,_['map'](_0x226908,_0xcc1f('0x1b'))[_0xcc1f('0x15')](',\x20')));}var _0x23d92a=_[_0xcc1f('0x56')](_0x42d563['channels'],{'uniqueid':_0x19faff['uniqueid']});if(_0x23d92a){return BPromise[_0xcc1f('0x69')]()[_0xcc1f('0x1a')](function(){if(_0x23d92a[_0xcc1f('0x58')]){return ami[_0xcc1f('0x1f')]({'action':_0xcc1f('0x6a'),'channel':_0x23d92a[_0xcc1f('0x58')],'mixmonitorid':_0x19faff[_0xcc1f('0x63')]})['catch'](function(_0x3d14db){});}})[_0xcc1f('0x1a')](function(){if(_0x23d92a[_0xcc1f('0x6b')]){return ami['Action']({'action':_0xcc1f('0x6a'),'channel':_0x23d92a[_0xcc1f('0x6b')],'mixmonitorid':_0x19faff[_0xcc1f('0x63')]})[_0xcc1f('0x21')](function(_0x27301a){});}})[_0xcc1f('0x1a')](function(_0x5ee412){var _0x162ab1=_[_0xcc1f('0x56')](_0x23d92a[_0xcc1f('0x61')],{'mixmonitorid':_0x19faff[_0xcc1f('0x63')]});if(_0x162ab1){_0x162ab1['status']=_0xcc1f('0x6c');}})[_0xcc1f('0x1a')](function(){var _0x293995=util['format'](_0xcc1f('0x6d'),_0x19faff['filename']||_0x19faff[_0xcc1f('0x5a')],_0x19faff['format']||_0xcc1f('0x6e'));var _0x24a7e6=_[_0xcc1f('0x56')](_0x23d92a[_0xcc1f('0x61')],{'filename':_0xcc1f('0x5e')+_0x293995[_0xcc1f('0x5f')]()});if(_0x24a7e6){_0x24a7e6[_0xcc1f('0x65')]=_0xcc1f('0x6c');}})[_0xcc1f('0x1a')](function(){_0x147c9d({'code':0xc8,'message':[_0x19faff[_0xcc1f('0x5a')],_0xcc1f('0x6f')][_0xcc1f('0x15')]('\x20')});})[_0xcc1f('0x21')](function(_0x5aed87){_0x57807a(_0x30405b[_0xcc1f('0x11')](0x1f5,[_0x19faff[_0xcc1f('0x5a')],_0x5aed87[_0xcc1f('0x1b')]['toLowerCase']()][_0xcc1f('0x15')]('\x20')));});}else{return _0x57807a(_0x30405b[_0xcc1f('0x11')](0x1f5,_0xcc1f('0x67')));}});},'VoiceQueuesChannels':function(_0x32247f){return new Promise(function(_0x2ace0a,_0x3dd45b){var _0x4663eb=_[_0xcc1f('0x52')](_0x42d563[_0xcc1f('0x70')]);_0x2ace0a({'count':_0x4663eb[_0xcc1f('0x54')],'rows':_0x4663eb});});},'VoiceQueuesChannel':function(_0x1683cc){var _0x57fe97=this;return new Promise(function(_0x2c69f9,_0x508045){var _0x178c7f=schema(properties[_0xcc1f('0x71')])[_0xcc1f('0x68')](_0x1683cc);if(_0x178c7f['length']>0x0){return _0x508045(_0x57fe97[_0xcc1f('0x11')](0x1f4,_[_0xcc1f('0x55')](_0x178c7f,_0xcc1f('0x1b'))[_0xcc1f('0x15')](',\x20')));}var _0x1177dc=_[_0xcc1f('0x56')](_0x42d563[_0xcc1f('0x70')],{'uniqueid':_0x1683cc[_0xcc1f('0x5a')]});if(_0x1177dc){_0x2c69f9(_0x1177dc);}else{return _0x508045(_0x57fe97[_0xcc1f('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x3e93c3){var _0x16de1d=this;return new Promise(function(_0x4279f6,_0x3243f3){if(ami[_0xcc1f('0x1c')]()==![]){return _0x3243f3(_0x16de1d[_0xcc1f('0x11')](0x1f4,[config[_0xcc1f('0x12')]['ip'],config[_0xcc1f('0x12')][_0xcc1f('0x13')],_0xcc1f('0x14')][_0xcc1f('0x15')]('\x20')));}var _0x7ff258=schema(properties[_0xcc1f('0x72')])[_0xcc1f('0x68')](_0x3e93c3);if(_0x7ff258[_0xcc1f('0x54')]>0x0){return _0x3243f3(_0x16de1d[_0xcc1f('0x11')](0x1f4,_[_0xcc1f('0x55')](_0x7ff258,_0xcc1f('0x1b'))[_0xcc1f('0x15')](',\x20')));}var _0xb4e972=_[_0xcc1f('0x56')](_0x42d563['queueChannels'],{'uniqueid':_0x3e93c3['uniqueid']});if(_0xb4e972&&_0xb4e972['channel']){return ami[_0xcc1f('0x1f')]({'action':_0xcc1f('0x73'),'channel':_0xb4e972[_0xcc1f('0x58')]})[_0xcc1f('0x1a')](function(_0xb2821){_0x4279f6({'code':0xc8,'message':[_0x3e93c3[_0xcc1f('0x5a')],_0xb2821[_0xcc1f('0x1b')][_0xcc1f('0x5f')]()][_0xcc1f('0x15')]('\x20')});})[_0xcc1f('0x21')](function(_0x72e439){_0x3243f3(_0x16de1d[_0xcc1f('0x11')](0x1f5,[_0x3e93c3[_0xcc1f('0x5a')],_0x72e439[_0xcc1f('0x1b')][_0xcc1f('0x5f')]()][_0xcc1f('0x15')]('\x20')));});}else{return _0x3243f3(_0x16de1d[_0xcc1f('0x11')](0x1f5,_0xcc1f('0x67')));}});},'VoiceQueuesChannelRedirect':function(_0x1d5cfc){var _0x430605=this;return new Promise(function(_0x1a4982,_0x3a6b1f){if(ami[_0xcc1f('0x1c')]()==![]){return _0x3a6b1f(_0x430605['error'](0x1f4,[config[_0xcc1f('0x12')]['ip'],config[_0xcc1f('0x12')][_0xcc1f('0x13')],'ami\x20disconnected'][_0xcc1f('0x15')]('\x20')));}var _0x574ecc=schema(properties[_0xcc1f('0x74')])[_0xcc1f('0x68')](_0x1d5cfc);if(_0x574ecc[_0xcc1f('0x54')]>0x0){return _0x3a6b1f(_0x430605['error'](0x1f4,_[_0xcc1f('0x55')](_0x574ecc,_0xcc1f('0x1b'))[_0xcc1f('0x15')](',\x20')));}var _0xfdfe2f=_[_0xcc1f('0x56')](_0x42d563[_0xcc1f('0x70')],{'uniqueid':_0x1d5cfc[_0xcc1f('0x5a')]});if(_0xfdfe2f&&_0xfdfe2f['channel']){return ami[_0xcc1f('0x1f')]({'action':'Redirect','channel':_0xfdfe2f[_0xcc1f('0x58')],'exten':_0x1d5cfc[_0xcc1f('0x75')],'context':_0x1d5cfc[_0xcc1f('0x76')]||_0xfdfe2f[_0xcc1f('0x76')],'priority':0x1})[_0xcc1f('0x1a')](function(_0x43226a){_0x1a4982({'code':0xc8,'message':[_0x1d5cfc['uniqueid'],_0x43226a[_0xcc1f('0x1b')][_0xcc1f('0x5f')]()][_0xcc1f('0x15')]('\x20')});})[_0xcc1f('0x21')](function(_0x42c7e3){_0x3a6b1f(_0x430605[_0xcc1f('0x11')](0x1f5,[_0x1d5cfc['uniqueid'],_0x42c7e3['message'][_0xcc1f('0x5f')]()][_0xcc1f('0x15')]('\x20')));});}else{return _0x3a6b1f(_0x430605[_0xcc1f('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x10d6cf){return new Promise(function(_0x2e468a,_0x303562){var _0x5446c1=_[_0xcc1f('0x52')](_0x42d563[_0xcc1f('0xd')]);_0x2e468a({'count':_0x5446c1[_0xcc1f('0x54')],'rows':_0x5446c1});});},'Telephones':function(_0xd75356){return new Promise(function(_0x3613ec,_0x4a8c12){var _0x4414f7=_[_0xcc1f('0x52')](_0x42d563[_0xcc1f('0x77')]);_0x3613ec({'count':_0x4414f7[_0xcc1f('0x54')],'rows':_0x4414f7});});},'Trunks':function(_0x27fb53){return new Promise(function(_0x5be3c7,_0x39e8f8){var _0x52ceb5=_[_0xcc1f('0x52')](_0x42d563['trunks']);_0x5be3c7({'count':_0x52ceb5[_0xcc1f('0x54')],'rows':_0x52ceb5});});},'OutboundChannels':function(_0x4672d7){return new Promise(function(_0x36d23d,_0x375055){var _0x466c1e=_[_0xcc1f('0x52')](_0x42d563[_0xcc1f('0x78')]);_0x36d23d({'count':_0x466c1e[_0xcc1f('0x54')],'rows':_0x466c1e});});},'Outbound':function(_0x311910){return new Promise(function(_0x59b22f,_0x7ce534){_0x59b22f(_0x42d563[_0xcc1f('0x79')]);});},'Campaigns':function(_0x543d27){return new Promise(function(_0x433e19,_0x5683c6){var _0x3ef6ca=_[_0xcc1f('0x52')](_0x42d563[_0xcc1f('0x7a')]);_0x433e19({'count':_0x3ef6ca[_0xcc1f('0x54')],'rows':_0x3ef6ca});});},'VoiceQueuesPreview':function(_0xc79bc1){var _0x255427=this;return new Promise(function(_0x11ab3a,_0x407675){_0x25f41c[_0xcc1f('0x7b')](_0xc79bc1['id'])[_0xcc1f('0x1a')](function(_0x48b427){_0x11ab3a({'code':0xc8,'message':_0x48b427[_0xcc1f('0x1b')]});})[_0xcc1f('0x21')](function(_0x38ad77){_0x407675(_0x255427['error'](0x1f4,_0x38ad77[_0xcc1f('0x1b')]));});});},'EventManager':function(_0x436a93){var _0x5b8282=this;return new Promise(function(_0x198f9a,_0x1eede0){if(!_0x436a93[_0xcc1f('0x7c')]){return _0x1eede0(_0x5b8282[_0xcc1f('0x11')](0x1f4,_0xcc1f('0x7d')));}ami[_0xcc1f('0x7e')](_0xcc1f('0x7f')+_0x436a93[_0xcc1f('0x7c')],_0x436a93['message']);_0x198f9a({'code':0xc8,'message':_0x436a93});});},'FaxAccounts':function(_0x5b8be8){return new Promise(function(_0x12c346,_0x1b4081){var _0xe442e1=_[_0xcc1f('0x52')](_0x42d563[_0xcc1f('0x80')]);_0x12c346({'count':_0xe442e1[_0xcc1f('0x54')],'rows':_0xe442e1});});},'SendFax':function(_0x33b9b2){var _0x2e5381=this;return new Promise(function(_0x4179a2,_0x2c2434){_0x493a97[_0xcc1f('0x81')](_0x33b9b2)[_0xcc1f('0x1a')](function(_0x4468f5){_0x4179a2({'code':0xc8,'message':_0x4468f5[_0xcc1f('0x1b')]});})[_0xcc1f('0x21')](function(_0x3dc71e){_0x2c2434(_0x2e5381['error'](0x1f4,_0x3dc71e['message']));});});},'CheckAfterSend':function(_0x25a74f){var _0x2bbd34=this;return new Promise(function(_0x126e4e,_0x2afcb9){_0x493a97[_0xcc1f('0x82')](_0x25a74f)[_0xcc1f('0x1a')](function(_0x51498e){_0x126e4e({'code':0xc8,'message':_0x51498e[_0xcc1f('0x1b')]});})[_0xcc1f('0x21')](function(_0x23b999){_0x2afcb9(_0x2bbd34[_0xcc1f('0x11')](0x1f4,_0x23b999[_0xcc1f('0x1b')]));});});}};var _0x2f2824=jayson['server'](_0x4516e3)[_0xcc1f('0x83')]();_0x2f2824['on']('error',function(_0x23f7fa){return _0x376348(_0x23f7fa);});_0x2f2824[_0xcc1f('0x7')](0x232a,_0xcc1f('0x84'),function(){console[_0xcc1f('0x85')](_0xcc1f('0x86'),0x232a);return _0x5f448b(_0xcc1f('0x87')+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 f5aa417..a2bf7ec 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 _0xb0d8=['catch','toLowerCase','bluebird','util','lodash','../../rpc/cmContact','socket.io-emitter','info','stringify','emit','exec','data2','calleridnum','firstName','calleridname','uniqueid','destcalleridname','','destcalleridnum','phone','resolve','then','showContact','omit','xmd-contactid2','format','name','merge','data1','user:%s','trigger:%s','action'];(function(_0x345865,_0x1d878d){var _0x2e14f4=function(_0x52e646){while(--_0x52e646){_0x345865['push'](_0x345865['shift']());}};_0x2e14f4(++_0x1d878d);}(_0xb0d8,0x1c2));var _0x8b0d=function(_0x47a40b,_0x443ecf){_0x47a40b=_0x47a40b-0x0;var _0x19610c=_0xb0d8[_0x47a40b];return _0x19610c;};'use strict';var BPromise=require(_0x8b0d('0x0'));var util=require(_0x8b0d('0x1'));var _=require(_0x8b0d('0x2'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x8b0d('0x3'));var io=require(_0x8b0d('0x4'))({'host':'localhost','port':0x18eb});function emit(_0x478252,_0x3cf55a,_0x4091f9){logger[_0x8b0d('0x5')](_0x478252,_0x3cf55a,JSON[_0x8b0d('0x6')](_0x4091f9));io['to'](_0x478252)[_0x8b0d('0x7')](_0x3cf55a,_0x4091f9);}exports[_0x8b0d('0x8')]=function(_0x1ad198,_0x47f807,_0x1bbb37){_0x1bbb37['autoCreate']=0x0;if(_0x47f807['data2']&&parseInt(_0x47f807[_0x8b0d('0x9')],0xa)){var _0x3fc97a={'ListId':parseInt(_0x47f807['data1'],0xa),'phone':_0x1bbb37[_0x8b0d('0xa')]};if(_['isNil'](_0x1bbb37['routeId'])){_0x3fc97a[_0x8b0d('0xb')]=_0x1bbb37[_0x8b0d('0xc')]&&_0x1bbb37[_0x8b0d('0xc')]!==''?_0x1bbb37['calleridname']:_0x1bbb37[_0x8b0d('0xa')]||_0x1bbb37[_0x8b0d('0xd')];}else{_0x3fc97a[_0x8b0d('0xb')]=_0x1bbb37['destcalleridname']&&_0x1bbb37[_0x8b0d('0xe')]!==_0x8b0d('0xf')?_0x1bbb37[_0x8b0d('0xe')]:_0x1bbb37[_0x8b0d('0x10')]||_0x1bbb37[_0x8b0d('0xd')];_0x3fc97a[_0x8b0d('0x11')]=_0x1bbb37['destcalleridname']&&_0x1bbb37[_0x8b0d('0xe')]!==_0x8b0d('0xf')?_0x1bbb37[_0x8b0d('0xe')]:_0x1bbb37[_0x8b0d('0x10')]||_0x1bbb37['uniqueid'];}BPromise[_0x8b0d('0x12')]()[_0x8b0d('0x13')](cmContactRpc[_0x8b0d('0x14')]({'where':_[_0x8b0d('0x15')](_0x3fc97a,[_0x8b0d('0xb')])}))[_0x8b0d('0x13')](function(_0x1d6619){if(_0x1d6619){_0x1bbb37[_0x8b0d('0x16')]=_0x1d6619['id'];emit(util[_0x8b0d('0x17')]('user:%s',_0x1ad198[_0x8b0d('0x18')]),util['format']('trigger:%s',_0x47f807['action']['toLowerCase']()),_[_0x8b0d('0x19')](_0x1bbb37,{'ListId':parseInt(_0x47f807[_0x8b0d('0x1a')],0xa)}));return;}else{return BPromise[_0x8b0d('0x12')]()[_0x8b0d('0x13')](cmContactRpc['createContact'](_0x3fc97a));}})[_0x8b0d('0x13')](function(_0x563e39){if(_0x563e39){_0x1bbb37['xmd-contactid2']=_0x563e39['id'];emit(util[_0x8b0d('0x17')](_0x8b0d('0x1b'),_0x1ad198[_0x8b0d('0x18')]),util['format'](_0x8b0d('0x1c'),_0x47f807[_0x8b0d('0x1d')]['toLowerCase']()),_[_0x8b0d('0x19')](_0x1bbb37,{'ListId':parseInt(_0x47f807[_0x8b0d('0x1a')],0xa)}));}})[_0x8b0d('0x1e')](function(_0x1722a0){logger['error']('Error\x20creating\x20contact',JSON['stringify'](_0x1722a0));});}else{if(_0x1ad198){emit(util[_0x8b0d('0x17')](_0x8b0d('0x1b'),_0x1ad198[_0x8b0d('0x18')]),util[_0x8b0d('0x17')]('trigger:%s',_0x47f807[_0x8b0d('0x1d')][_0x8b0d('0x1f')]()),_[_0x8b0d('0x19')]({'ListId':parseInt(_0x47f807[_0x8b0d('0x1a')],0xa)},_0x1bbb37));}}}; \ No newline at end of file +var _0x2701=['phone','resolve','then','omit','xmd-contactid2','format','user:%s','name','action','toLowerCase','createContact','catch','error','Error\x20creating\x20contact','bluebird','util','lodash','../../../../config/logger','trigger','../../rpc/cmContact','socket.io-emitter','info','stringify','emit','exec','data2','data1','calleridnum','routeId','firstName','','destcalleridname','destcalleridnum','uniqueid'];(function(_0x1713e0,_0x3258d8){var _0x2f63d7=function(_0x29f857){while(--_0x29f857){_0x1713e0['push'](_0x1713e0['shift']());}};_0x2f63d7(++_0x3258d8);}(_0x2701,0x96));var _0x1270=function(_0x2a8e84,_0x3084ae){_0x2a8e84=_0x2a8e84-0x0;var _0x11e05c=_0x2701[_0x2a8e84];return _0x11e05c;};'use strict';var BPromise=require(_0x1270('0x0'));var util=require(_0x1270('0x1'));var _=require(_0x1270('0x2'));var logger=require(_0x1270('0x3'))(_0x1270('0x4'));var cmContactRpc=require(_0x1270('0x5'));var io=require(_0x1270('0x6'))({'host':'localhost','port':0x18eb});function emit(_0x3702de,_0x133edd,_0x3fa5e3){logger[_0x1270('0x7')](_0x3702de,_0x133edd,JSON[_0x1270('0x8')](_0x3fa5e3));io['to'](_0x3702de)[_0x1270('0x9')](_0x133edd,_0x3fa5e3);}exports[_0x1270('0xa')]=function(_0x215ee8,_0x47f16b,_0x5841ab){_0x5841ab['autoCreate']=0x0;if(_0x47f16b['data2']&&parseInt(_0x47f16b[_0x1270('0xb')],0xa)){var _0x1ec5a2={'ListId':parseInt(_0x47f16b[_0x1270('0xc')],0xa),'phone':_0x5841ab[_0x1270('0xd')]};if(_['isNil'](_0x5841ab[_0x1270('0xe')])){_0x1ec5a2[_0x1270('0xf')]=_0x5841ab['calleridname']&&_0x5841ab['calleridname']!==_0x1270('0x10')?_0x5841ab['calleridname']:_0x5841ab['calleridnum']||_0x5841ab['uniqueid'];}else{_0x1ec5a2['firstName']=_0x5841ab[_0x1270('0x11')]&&_0x5841ab['destcalleridname']!==''?_0x5841ab[_0x1270('0x11')]:_0x5841ab[_0x1270('0x12')]||_0x5841ab[_0x1270('0x13')];_0x1ec5a2[_0x1270('0x14')]=_0x5841ab['destcalleridname']&&_0x5841ab[_0x1270('0x11')]!==_0x1270('0x10')?_0x5841ab['destcalleridname']:_0x5841ab['destcalleridnum']||_0x5841ab[_0x1270('0x13')];}BPromise[_0x1270('0x15')]()[_0x1270('0x16')](cmContactRpc['showContact']({'where':_[_0x1270('0x17')](_0x1ec5a2,[_0x1270('0xf')])}))[_0x1270('0x16')](function(_0x3946b8){if(_0x3946b8){_0x5841ab[_0x1270('0x18')]=_0x3946b8['id'];emit(util[_0x1270('0x19')](_0x1270('0x1a'),_0x215ee8[_0x1270('0x1b')]),util[_0x1270('0x19')]('trigger:%s',_0x47f16b[_0x1270('0x1c')][_0x1270('0x1d')]()),_['merge'](_0x5841ab,{'ListId':parseInt(_0x47f16b[_0x1270('0xc')],0xa)}));return;}else{return BPromise['resolve']()[_0x1270('0x16')](cmContactRpc[_0x1270('0x1e')](_0x1ec5a2));}})[_0x1270('0x16')](function(_0x417a1c){if(_0x417a1c){_0x5841ab[_0x1270('0x18')]=_0x417a1c['id'];emit(util[_0x1270('0x19')]('user:%s',_0x215ee8[_0x1270('0x1b')]),util[_0x1270('0x19')]('trigger:%s',_0x47f16b['action'][_0x1270('0x1d')]()),_['merge'](_0x5841ab,{'ListId':parseInt(_0x47f16b[_0x1270('0xc')],0xa)}));}})[_0x1270('0x1f')](function(_0x12d065){logger[_0x1270('0x20')](_0x1270('0x21'),JSON['stringify'](_0x12d065));});}else{if(_0x215ee8){emit(util[_0x1270('0x19')](_0x1270('0x1a'),_0x215ee8['name']),util[_0x1270('0x19')]('trigger:%s',_0x47f16b[_0x1270('0x1c')][_0x1270('0x1d')]()),_['merge']({'ListId':parseInt(_0x47f16b[_0x1270('0xc')],0xa)},_0x5841ab));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 2da747c..6b02e46 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 _0x0c27=['data6','600','winApplication','winArguments','render','trigger:%s:%s','jscripty','user:%s','name','format','trigger:%s','action','data1','exec','queue','routeId','search','AllConditions','every','checkConditions','channel','some','field','chat','ChatWebsiteId','operator','upperFirst','AccountId','message','event','value','lastevent','exports','util','lodash','url','mustache','bluebird','./urlforward','./cmContact','../rpc/cmContact','../../../config/logger','integration','urlforward','popup','winapp','triggers','agents','voiceQueues','templates','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','accounts','custom:agentconnect','custom:agentringnoanswer','syncCustomEvent','bind','custom:agentcomplete','custom:queuecallerabandon','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','info','stringify','emit','checkTriggers','status','checkTrigger','merge','variables','Actions','length','interface','toLowerCase','contactmanager','TemplateId','data2','html','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','windowWidth','data5','800','windowHeight'];(function(_0x112c0d,_0x5af795){var _0xcb9325=function(_0x531198){while(--_0x531198){_0x112c0d['push'](_0x112c0d['shift']());}};_0xcb9325(++_0x5af795);}(_0x0c27,0x85));var _0x70c2=function(_0x3c48d3,_0x531dea){_0x3c48d3=_0x3c48d3-0x0;var _0x5637ba=_0x0c27[_0x3c48d3];return _0x5637ba;};'use strict';var util=require(_0x70c2('0x0'));var _=require(_0x70c2('0x1'));var url=require(_0x70c2('0x2'));var Mustache=require(_0x70c2('0x3'));var BPromise=require(_0x70c2('0x4'));var urlforward=require(_0x70c2('0x5'));var integration=require('./integration');var cmContact=require(_0x70c2('0x6'));var cmContactRpc=require(_0x70c2('0x7'));var logger=require(_0x70c2('0x8'))('trigger');var ami=require('../ami');var io=require('socket.io-emitter')({'host':'localhost','port':0x18eb});var operators={'equals':function(_0x593066,_0x190ff6){return _0x593066==_0x190ff6;},'not_equals':function(_0x2abadc,_0x2b0fc3){return _0x2abadc!=_0x2b0fc3;}};var serverActions=[_0x70c2('0x9'),_0x70c2('0xa')];var barAndWebActions=[_0x70c2('0xb'),_0x70c2('0x2'),_0x70c2('0xc')];function Trigger(_0x343e86){this[_0x70c2('0xd')]=_0x343e86[_0x70c2('0xd')];this[_0x70c2('0xe')]=_0x343e86[_0x70c2('0xe')];this[_0x70c2('0xf')]=_0x343e86[_0x70c2('0xf')];this['templates']=_0x343e86[_0x70c2('0x10')];this['voiceExtensions']=_0x343e86['voiceExtensions'];this[_0x70c2('0x11')]=_0x343e86['zendeskAccounts'];this[_0x70c2('0x12')]=_0x343e86[_0x70c2('0x12')];this[_0x70c2('0x13')]=_0x343e86['salesforceAccounts'];this['sugarcrmAccounts']=_0x343e86[_0x70c2('0x14')];this[_0x70c2('0x15')]=_0x343e86[_0x70c2('0x15')];this[_0x70c2('0x16')]=_0x343e86['deskAccounts'];this['vtigerAccounts']=_0x343e86[_0x70c2('0x17')];this[_0x70c2('0x18')]={'zendesk':this[_0x70c2('0x11')],'salesforce':this[_0x70c2('0x13')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x70c2('0x15')],'desk':this[_0x70c2('0x16')],'vtiger':this[_0x70c2('0x17')]};ami['on']('custom:agentcalled',this['syncCustomEvent']['bind'](this));ami['on'](_0x70c2('0x19'),this['syncCustomEvent']['bind'](this));ami['on'](_0x70c2('0x1a'),this[_0x70c2('0x1b')][_0x70c2('0x1c')](this));ami['on'](_0x70c2('0x1d'),this[_0x70c2('0x1b')][_0x70c2('0x1c')](this));ami['on'](_0x70c2('0x1e'),this[_0x70c2('0x1b')][_0x70c2('0x1c')](this));ami['on']('custom:dialbegin',this[_0x70c2('0x1b')][_0x70c2('0x1c')](this));ami['on'](_0x70c2('0x1f'),this[_0x70c2('0x1b')]['bind'](this));ami['on'](_0x70c2('0x20'),this[_0x70c2('0x1b')][_0x70c2('0x1c')](this));ami['on'](_0x70c2('0x21'),this[_0x70c2('0x1b')][_0x70c2('0x1c')](this));ami['on'](_0x70c2('0x22'),this[_0x70c2('0x1b')][_0x70c2('0x1c')](this));ami['on'](_0x70c2('0x23'),this[_0x70c2('0x1b')][_0x70c2('0x1c')](this));ami['on'](_0x70c2('0x24'),this[_0x70c2('0x1b')][_0x70c2('0x1c')](this));ami['on'](_0x70c2('0x25'),this[_0x70c2('0x1b')]['bind'](this));ami['on'](_0x70c2('0x26'),this[_0x70c2('0x1b')][_0x70c2('0x1c')](this));}Trigger[_0x70c2('0x27')]['emit']=function(_0x488ea4,_0xa477ab,_0x4d0d60){logger[_0x70c2('0x28')](_0x488ea4,_0xa477ab,JSON[_0x70c2('0x29')](_0x4d0d60));io['to'](_0x488ea4)[_0x70c2('0x2a')](_0xa477ab,_0x4d0d60);};Trigger[_0x70c2('0x27')][_0x70c2('0x1b')]=function(_0x3a2315){this[_0x70c2('0x2b')](_0x3a2315);};Trigger[_0x70c2('0x27')][_0x70c2('0x2b')]=function(_0x2a2c0d){var _0x51dcd4;for(var _0x3eaf06 in this['triggers']){if(this[_0x70c2('0xd')]['hasOwnProperty'](_0x3eaf06)){if(this[_0x70c2('0xd')][_0x3eaf06][_0x70c2('0x2c')]){_0x51dcd4=this[_0x70c2('0x2d')](this[_0x70c2('0xd')][_0x3eaf06],_0x2a2c0d);if(_0x51dcd4){_[_0x70c2('0x2e')](_0x2a2c0d,_0x2a2c0d[_0x70c2('0x2f')]);for(var _0x30bca2=0x0,_0x1b4635,_0x3f9480,_0x3d4600;_0x30bca20x0){_0x54add4=_[_0x65e5('0x27')](_0x1f6e8c,_0x25edea);}return _0x54add4;}function getCustomFields(_0x4d1ef0,_0x43b28a){var _0x1add89=[];var _0x2a951c={'custom_fields':{}};if(_0x4d1ef0[_0x65e5('0x28')]>0x0){_['forEach'](_0x4d1ef0,function(_0x50bf62){if(_0x50bf62[_0x65e5('0x29')]===_0x65e5('0x2a')&&_0x50bf62['nameField']&&!_0x50bf62[_0x65e5('0x2b')]){_0x2a951c[_0x50bf62['nameField']['toLowerCase']()]=_0x50bf62['content'][_0x65e5('0x1e')]();}else if(_0x50bf62[_0x65e5('0x29')]===_0x65e5('0x2a')&&_0x50bf62[_0x65e5('0x2c')]&&_0x50bf62['customField']){_0x2a951c[_0x65e5('0x2d')][_0x50bf62[_0x65e5('0x2c')]]=_0x50bf62[_0x65e5('0x2e')][_0x65e5('0x1e')]();}else if(_0x50bf62['type']===_0x65e5('0x2f')&&_0x50bf62['variableName']&&_0x50bf62[_0x65e5('0x2c')]&&_0x50bf62[_0x65e5('0x2b')]){_0x43b28a[_0x50bf62['variableName']]&&(_0x2a951c[_0x65e5('0x2d')][_0x50bf62['idField']]=_0x43b28a[_0x50bf62[_0x65e5('0x30')]][_0x65e5('0x1e')]());}else if(_0x50bf62[_0x65e5('0x29')]==='customVariable'&&_0x50bf62['Variable']&&_0x50bf62[_0x65e5('0x31')][_0x65e5('0x32')]&&_0x50bf62[_0x65e5('0x2c')]&&_0x50bf62[_0x65e5('0x2b')]){_0x43b28a[_0x50bf62[_0x65e5('0x31')][_0x65e5('0x32')][_0x65e5('0x33')]()]&&(_0x2a951c[_0x65e5('0x2d')][_0x50bf62['idField']]=_0x43b28a[_0x50bf62[_0x65e5('0x31')][_0x65e5('0x32')][_0x65e5('0x33')]()][_0x65e5('0x1e')]());}});}if(_0x2a951c[_0x65e5('0x34')]){_0x2a951c[_0x65e5('0x34')]=Number(_0x2a951c[_0x65e5('0x34')]);}return _0x2a951c;}function getTicket(_0x87ce14,_0x12d20f,_0x55c5d2,_0x59dd21,_0x1c0ac6){logger[_0x65e5('0x11')](_0x65e5('0x35'));var _0x557b95=_[_0x65e5('0x36')]({'subject':intUtil[_0x65e5('0x37')](_0x59dd21['Subjects'],_0x1c0ac6,'\x20'),'type':_0x65e5('0x38'),'status':'new','labels':['xCALLY',_0x65e5('0x39'),'CTI']['concat'](getTags(_0x59dd21[_0x65e5('0x3a')],_0x65e5('0x32'))),'description':intUtil['getString'](_0x59dd21['Descriptions'],_0x1c0ac6,'\x0a'),'_links':{'assigned_user':{'href':util[_0x65e5('0xb')](_0x65e5('0x3b'),_0x12d20f['id']),'class':_0x65e5('0x3c')}},'message':{'direction':'in','body':intUtil[_0x65e5('0x37')](_0x59dd21[_0x65e5('0x3d')],_0x1c0ac6,'\x0a')}},getCustomFields(_0x59dd21[_0x65e5('0x3e')],_0x1c0ac6));return request({'uri':util['format'](_0x65e5('0x3f'),_0x87ce14[_0x65e5('0x13')],_0x55c5d2['id']),'method':_0x65e5('0x25'),'body':_0x557b95});}exports['queue']=function(_0xf38010,_0xa10921,_0x2b8cb4,_0x1cbafd,_0x304805,_0x41e245){var _0x377259,_0x114290;_0x41e245[_0x65e5('0x13')]=intUtil[_0x65e5('0x40')](_0x41e245[_0x65e5('0x13')]);_0x41e245[_0x65e5('0x41')]=intUtil['stripTrailingSlash'](_0x41e245['serverUrl']);if(_0x304805&&_0x304805[_0x65e5('0x42')]){logger['info'](_0x65e5('0x43'),'Recording\x20is\x20enabled!');_0xa10921[_0x65e5('0x44')]=util[_0x65e5('0xb')](_0x65e5('0x45'),_0x41e245[_0x65e5('0x41')],_0xa10921[_0x65e5('0x46')],md5(_0xa10921['uniqueid']));}else{_0xa10921['recordingURL']='';}headers[_0x65e5('0x47')]=getAuth(_0x41e245);return getUser(_0x41e245,_0x1cbafd[_0x65e5('0x48')])[_0x65e5('0x10')](function(_0x3260c7){_0x377259=_0x3260c7;logger[_0x65e5('0x11')](_0x65e5('0x49'),_0x377259['id']);return getEndUser(_0x41e245,_0xa10921[_0x65e5('0x4a')],_0xa10921[_0x65e5('0x4b')]);})[_0x65e5('0x10')](function(_0x52f5c3){_0x114290=_0x52f5c3;logger[_0x65e5('0x11')](_0x65e5('0x4c'),_0x114290['id']);return getTicket(_0x41e245,_0x377259,_0x114290,_0x2b8cb4,_0xa10921);})['then'](function(_0x18003d){if(_0x18003d){logger[_0x65e5('0x11')](_0x65e5('0x4d'));logger[_0x65e5('0x11')](_0x65e5('0x4e'),_0x18003d['id']);switch(_0x41e245[_0x65e5('0x29')]){case _0x65e5('0x4f'):logger['info']('[QUEUE]',_0x65e5('0x50'));emit(util[_0x65e5('0xb')]('user:%s',_0x1cbafd['name']),_0x65e5('0x51'),{'recordId':_0x18003d['id']});break;case _0x65e5('0x52'):logger[_0x65e5('0x11')](_0x65e5('0x43'),_0x65e5('0x53'));emit(util[_0x65e5('0xb')](_0x65e5('0x54'),_0x1cbafd['name']),_0x65e5('0x55'),{'uri':util[_0x65e5('0xb')](_0x65e5('0x56'),_0x18003d['id'])});break;default:logger[_0x65e5('0x57')](_0x65e5('0x43'),_0x65e5('0x58'));}}})[_0x65e5('0x59')](function(_0x4c0c2d){console[_0x65e5('0x57')](_0x4c0c2d);logger[_0x65e5('0x57')]('[QUEUE]',JSON[_0x65e5('0x16')](_0x4c0c2d));});};exports[_0x65e5('0x5a')]=function(_0x5d06db,_0x3b4f4b,_0x359999,_0x978a0c,_0x1d4633,_0x5707b0,_0x2388f6){var _0x503086,_0x10a0bb;_0x5707b0['remoteUri']=intUtil[_0x65e5('0x40')](_0x5707b0[_0x65e5('0x13')]);_0x5707b0[_0x65e5('0x41')]=intUtil[_0x65e5('0x40')](_0x5707b0[_0x65e5('0x41')]);if(_0x2388f6&&_0x2388f6['recordingFormat']&&_0x2388f6[_0x65e5('0x5b')]!==_0x65e5('0x5c')){logger[_0x65e5('0x11')]('[OUTBOUND]',_0x65e5('0x5d'));_0x3b4f4b['recordingURL']=util[_0x65e5('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5707b0[_0x65e5('0x41')],_0x3b4f4b[_0x65e5('0x46')],md5(_0x3b4f4b[_0x65e5('0x46')]));}headers[_0x65e5('0x47')]=getAuth(_0x5707b0);return getUser(_0x5707b0,_0x978a0c[_0x65e5('0x48')])[_0x65e5('0x10')](function(_0x1aa450){_0x503086=_0x1aa450;logger[_0x65e5('0x11')](_0x65e5('0x49'),_0x503086['id']);return getEndUser(_0x5707b0,_0x3b4f4b[_0x65e5('0x5e')],_0x3b4f4b[_0x65e5('0x5f')]);})[_0x65e5('0x10')](function(_0x4ce60c){_0x10a0bb=_0x4ce60c;logger[_0x65e5('0x11')]('The\x20Enduser\x20ID\x20is:',_0x10a0bb['id']);return getTicket(_0x5707b0,_0x503086,_0x10a0bb,_0x359999,_0x3b4f4b);})[_0x65e5('0x10')](function(_0x276a10){if(_0x276a10){logger['info'](_0x65e5('0x4d'));logger[_0x65e5('0x11')]('The\x20Ticket\x20ID\x20is:',_0x276a10['id']);switch(_0x5707b0[_0x65e5('0x29')]){case _0x65e5('0x4f'):logger[_0x65e5('0x11')](_0x65e5('0x43'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x65e5('0xb')](_0x65e5('0x54'),_0x978a0c[_0x65e5('0x32')]),_0x65e5('0x51'),{'recordId':_0x276a10['id']});break;case _0x65e5('0x52'):logger[_0x65e5('0x11')](_0x65e5('0x43'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x65e5('0xb')](_0x65e5('0x54'),_0x978a0c[_0x65e5('0x32')]),_0x65e5('0x55'),{'uri':util[_0x65e5('0xb')](_0x65e5('0x60'),_0x5707b0['remoteUri'],_0x276a10['id'])});break;default:logger['error'](_0x65e5('0x61'),_0x65e5('0x58'));}}})[_0x65e5('0x59')](function(_0x4e24d7){logger[_0x65e5('0x57')](_0x65e5('0x61'),JSON[_0x65e5('0x16')](_0x4e24d7));});};exports[_0x65e5('0x62')]=function(_0xa1d92e,_0x16a320,_0xb106fa,_0x2f2110,_0x5b52b0,_0x4af216){var _0x1b0dac,_0x188283;_0x4af216['remoteUri']=intUtil['stripTrailingSlash'](_0x4af216['remoteUri']);_0x4af216[_0x65e5('0x41')]=intUtil['stripTrailingSlash'](_0x4af216['serverUrl']);if(_0x5b52b0&&_0x5b52b0[_0x65e5('0x42')]){logger[_0x65e5('0x11')](_0x65e5('0x63'),_0x65e5('0x5d'));_0x16a320[_0x65e5('0x44')]=util[_0x65e5('0xb')](_0x65e5('0x45'),_0x4af216[_0x65e5('0x41')],_0x16a320[_0x65e5('0x46')],md5(_0x16a320[_0x65e5('0x46')]));}else{_0x16a320[_0x65e5('0x44')]='';}headers[_0x65e5('0x47')]=getAuth(_0x4af216);return getUser(_0x4af216)[_0x65e5('0x10')](function(_0x3d1eb8){_0x1b0dac=_0x3d1eb8;logger['info']('The\x20User\x20ID\x20is:',_0x1b0dac['id']);return getEndUser(_0x4af216,_0x16a320[_0x65e5('0x4a')],_0x16a320[_0x65e5('0x4b')]);})['then'](function(_0x4303ea){_0x188283=_0x4303ea;logger[_0x65e5('0x11')](_0x65e5('0x4c'),_0x188283['id']);return getTicket(_0x4af216,_0x1b0dac,_0x188283,_0xb106fa,_0x16a320);})[_0x65e5('0x10')](function(_0x386b1e){if(_0x386b1e){logger[_0x65e5('0x11')](_0x65e5('0x4d'));logger[_0x65e5('0x11')](_0x65e5('0x4e'),_0x386b1e['id']);}})[_0x65e5('0x59')](function(_0x1ac66b){logger['error'](_0x65e5('0x63'),JSON['stringify'](_0x1ac66b));});}; \ No newline at end of file +var _0xf3a7=['forEach','type','string','nameField','customField','toLowerCase','content','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','getString','phone','xCALLY','concat','Tags','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','Authorization','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','catch','outbound','recordingFormat','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','trigger:desk:display','newTab','[OUTBOUND]','stringify','abandoned','[ABANDONED]','lodash','request-promise','util','./util','../../../../config/logger','desk','localhost','application/json','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','defaults','basic','%s:%s','username','password','authType','%s/token:%s','token','Basic\x20%s','toString','base64','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','map','length'];(function(_0x1b5738,_0x5e6b11){var _0x4d8a1e=function(_0x5c7ab3){while(--_0x5c7ab3){_0x1b5738['push'](_0x1b5738['shift']());}};_0x4d8a1e(++_0x5e6b11);}(_0xf3a7,0x99));var _0x7f3a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3a7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7f3a('0x0'));var rp=require(_0x7f3a('0x1'));var md5=require('md5');var util=require(_0x7f3a('0x2'));var intUtil=require(_0x7f3a('0x3'));var logger=require(_0x7f3a('0x4'))(_0x7f3a('0x5'));var io=require('socket.io-emitter')({'host':_0x7f3a('0x6'),'port':0x18eb});function emit(_0xb8eadb,_0x4ea780,_0xe376eb){io['to'](_0xb8eadb)['emit'](_0x4ea780,_0xe376eb);}var headers={'Content-Type':_0x7f3a('0x7'),'Accept':_0x7f3a('0x7')};function getUser(_0x2c2787,_0x5b521c){logger[_0x7f3a('0x8')](_0x7f3a('0x9'),_0x5b521c);return request({'uri':util[_0x7f3a('0xa')](_0x7f3a('0xb'),_0x2c2787[_0x7f3a('0xc')])})[_0x7f3a('0xd')](function(_0x935f50){if(_0x935f50[_0x7f3a('0xe')]){return _[_0x7f3a('0xf')](_0x935f50[_0x7f3a('0x10')][_0x7f3a('0x11')],{'email':_0x5b521c});}})['then'](function(_0x314c48){if(_0x314c48){logger[_0x7f3a('0x8')](_0x7f3a('0x12'));return _0x314c48;}else{logger[_0x7f3a('0x8')](_0x7f3a('0x13'));return request({'uri':util[_0x7f3a('0xa')]('%s/users/me',_0x2c2787[_0x7f3a('0xc')])});}});}function request(_0xeaa7cd){logger[_0x7f3a('0x14')](_0x7f3a('0x15'),JSON['stringify'](_0xeaa7cd));return rp(_[_0x7f3a('0x16')](_0xeaa7cd,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0xa042e){var _0x192d5d;if(_0xa042e['authType']===_0x7f3a('0x17')){_0x192d5d=util['format'](_0x7f3a('0x18'),_0xa042e[_0x7f3a('0x19')],_0xa042e[_0x7f3a('0x1a')]);}else if(_0xa042e[_0x7f3a('0x1b')]==='token'){_0x192d5d=util[_0x7f3a('0xa')](_0x7f3a('0x1c'),_0xa042e[_0x7f3a('0x19')],_0xa042e[_0x7f3a('0x1d')]);}return util['format'](_0x7f3a('0x1e'),new Buffer(_0x192d5d)[_0x7f3a('0x1f')](_0x7f3a('0x20')));}function getEndUser(_0x1e486f,_0x6c1527,_0x364613){logger[_0x7f3a('0x8')]('Searching\x20enduser\x20with\x20phone',_0x364613);return request({'uri':util['format']('%s/customers/search',_0x1e486f[_0x7f3a('0xc')]),'qs':{'phone':_0x364613}})[_0x7f3a('0xd')](function(_0x17caef){if(_0x17caef['total_entries']){logger[_0x7f3a('0x8')](_0x7f3a('0x21'));return _0x17caef[_0x7f3a('0x10')][_0x7f3a('0x11')][0x0];}else{logger['info'](_0x7f3a('0x22'));return request({'uri':util[_0x7f3a('0xa')](_0x7f3a('0x23'),_0x1e486f['remoteUri']),'method':_0x7f3a('0x24'),'body':{'first_name':_0x6c1527,'title':_0x6c1527,'phone_numbers':[{'type':'work','value':_0x364613}]}});}});}function getTags(_0x18addc,_0x198778){var _0x499552=[];if(_0x18addc&&_0x18addc['length']>0x0){_0x499552=_[_0x7f3a('0x25')](_0x18addc,_0x198778);}return _0x499552;}function getCustomFields(_0x5098d0,_0x446e75){var _0x25dfa7=[];var _0x483207={'custom_fields':{}};if(_0x5098d0[_0x7f3a('0x26')]>0x0){_[_0x7f3a('0x27')](_0x5098d0,function(_0x51963e){if(_0x51963e[_0x7f3a('0x28')]===_0x7f3a('0x29')&&_0x51963e[_0x7f3a('0x2a')]&&!_0x51963e[_0x7f3a('0x2b')]){_0x483207[_0x51963e[_0x7f3a('0x2a')][_0x7f3a('0x2c')]()]=_0x51963e[_0x7f3a('0x2d')][_0x7f3a('0x1f')]();}else if(_0x51963e[_0x7f3a('0x28')]===_0x7f3a('0x29')&&_0x51963e[_0x7f3a('0x2e')]&&_0x51963e[_0x7f3a('0x2b')]){_0x483207[_0x7f3a('0x2f')][_0x51963e[_0x7f3a('0x2e')]]=_0x51963e['content'][_0x7f3a('0x1f')]();}else if(_0x51963e[_0x7f3a('0x28')]===_0x7f3a('0x30')&&_0x51963e[_0x7f3a('0x31')]&&_0x51963e['idField']&&_0x51963e[_0x7f3a('0x2b')]){_0x446e75[_0x51963e[_0x7f3a('0x31')]]&&(_0x483207['custom_fields'][_0x51963e[_0x7f3a('0x2e')]]=_0x446e75[_0x51963e[_0x7f3a('0x31')]]['toString']());}else if(_0x51963e[_0x7f3a('0x28')]===_0x7f3a('0x32')&&_0x51963e[_0x7f3a('0x33')]&&_0x51963e[_0x7f3a('0x33')][_0x7f3a('0x34')]&&_0x51963e['idField']&&_0x51963e[_0x7f3a('0x2b')]){_0x446e75[_0x51963e[_0x7f3a('0x33')][_0x7f3a('0x34')][_0x7f3a('0x2c')]()]&&(_0x483207['custom_fields'][_0x51963e['idField']]=_0x446e75[_0x51963e[_0x7f3a('0x33')][_0x7f3a('0x34')][_0x7f3a('0x2c')]()][_0x7f3a('0x1f')]());}});}if(_0x483207[_0x7f3a('0x35')]){_0x483207[_0x7f3a('0x35')]=Number(_0x483207[_0x7f3a('0x35')]);}return _0x483207;}function getTicket(_0x53eeab,_0x2ba4a4,_0x506ea9,_0x3abaa8,_0x23c616){logger[_0x7f3a('0x8')]('Creating\x20new\x20ticket...');var _0x41504e=_[_0x7f3a('0x36')]({'subject':intUtil[_0x7f3a('0x37')](_0x3abaa8['Subjects'],_0x23c616,'\x20'),'type':_0x7f3a('0x38'),'status':'new','labels':[_0x7f3a('0x39'),'Motion','CTI'][_0x7f3a('0x3a')](getTags(_0x3abaa8[_0x7f3a('0x3b')],_0x7f3a('0x34'))),'description':intUtil[_0x7f3a('0x37')](_0x3abaa8['Descriptions'],_0x23c616,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7f3a('0xa')](_0x7f3a('0x3c'),_0x2ba4a4['id']),'class':_0x7f3a('0x3d')}},'message':{'direction':'in','body':intUtil['getString'](_0x3abaa8['Descriptions'],_0x23c616,'\x0a')}},getCustomFields(_0x3abaa8[_0x7f3a('0x3e')],_0x23c616));return request({'uri':util[_0x7f3a('0xa')](_0x7f3a('0x3f'),_0x53eeab[_0x7f3a('0xc')],_0x506ea9['id']),'method':_0x7f3a('0x24'),'body':_0x41504e});}exports['queue']=function(_0x19d86d,_0x3993f5,_0x413bb9,_0x1577e4,_0x5666a0,_0x47d94e){var _0x148785,_0x5b2985;_0x47d94e[_0x7f3a('0xc')]=intUtil[_0x7f3a('0x40')](_0x47d94e[_0x7f3a('0xc')]);_0x47d94e['serverUrl']=intUtil[_0x7f3a('0x40')](_0x47d94e['serverUrl']);if(_0x5666a0&&_0x5666a0[_0x7f3a('0x41')]){logger['info'](_0x7f3a('0x42'),_0x7f3a('0x43'));_0x3993f5[_0x7f3a('0x44')]=util[_0x7f3a('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x47d94e[_0x7f3a('0x45')],_0x3993f5[_0x7f3a('0x46')],md5(_0x3993f5['uniqueid']));}else{_0x3993f5[_0x7f3a('0x44')]='';}headers[_0x7f3a('0x47')]=getAuth(_0x47d94e);return getUser(_0x47d94e,_0x1577e4['email'])[_0x7f3a('0xd')](function(_0x5c6115){_0x148785=_0x5c6115;logger[_0x7f3a('0x8')]('The\x20User\x20ID\x20is:',_0x148785['id']);return getEndUser(_0x47d94e,_0x3993f5[_0x7f3a('0x48')],_0x3993f5[_0x7f3a('0x49')]);})['then'](function(_0x391314){_0x5b2985=_0x391314;logger[_0x7f3a('0x8')]('The\x20Enduser\x20ID\x20is:',_0x5b2985['id']);return getTicket(_0x47d94e,_0x148785,_0x5b2985,_0x413bb9,_0x3993f5);})[_0x7f3a('0xd')](function(_0x1a0817){if(_0x1a0817){logger['info']('Ticket\x20created!');logger[_0x7f3a('0x8')](_0x7f3a('0x4a'),_0x1a0817['id']);switch(_0x47d94e[_0x7f3a('0x28')]){case _0x7f3a('0x4b'):logger['info'](_0x7f3a('0x42'),_0x7f3a('0x4c'));emit(util[_0x7f3a('0xa')](_0x7f3a('0x4d'),_0x1577e4[_0x7f3a('0x34')]),'trigger:desk:display',{'recordId':_0x1a0817['id']});break;case'newTab':logger[_0x7f3a('0x8')]('[QUEUE]',_0x7f3a('0x4e'));emit(util[_0x7f3a('0xa')]('user:%s',_0x1577e4['name']),_0x7f3a('0x4f'),{'uri':util[_0x7f3a('0xa')]('https://xcally.desk.com/web/agent/case/%d',_0x1a0817['id'])});break;default:logger[_0x7f3a('0x50')](_0x7f3a('0x42'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7f3a('0x51')](function(_0x3087cd){console[_0x7f3a('0x50')](_0x3087cd);logger[_0x7f3a('0x50')](_0x7f3a('0x42'),JSON['stringify'](_0x3087cd));});};exports[_0x7f3a('0x52')]=function(_0x39d8c6,_0x326607,_0x171f22,_0x2aeb31,_0x57453b,_0x27437b,_0x21a8b8){var _0x5a17a9,_0x31da2c;_0x27437b[_0x7f3a('0xc')]=intUtil['stripTrailingSlash'](_0x27437b[_0x7f3a('0xc')]);_0x27437b['serverUrl']=intUtil[_0x7f3a('0x40')](_0x27437b[_0x7f3a('0x45')]);if(_0x21a8b8&&_0x21a8b8[_0x7f3a('0x53')]&&_0x21a8b8[_0x7f3a('0x53')]!=='none'){logger[_0x7f3a('0x8')]('[OUTBOUND]',_0x7f3a('0x43'));_0x326607[_0x7f3a('0x44')]=util[_0x7f3a('0xa')](_0x7f3a('0x54'),_0x27437b['serverUrl'],_0x326607[_0x7f3a('0x46')],md5(_0x326607['uniqueid']));}headers[_0x7f3a('0x47')]=getAuth(_0x27437b);return getUser(_0x27437b,_0x2aeb31['email'])[_0x7f3a('0xd')](function(_0xc66038){_0x5a17a9=_0xc66038;logger['info'](_0x7f3a('0x55'),_0x5a17a9['id']);return getEndUser(_0x27437b,_0x326607[_0x7f3a('0x56')],_0x326607[_0x7f3a('0x57')]);})[_0x7f3a('0xd')](function(_0x49bc6e){_0x31da2c=_0x49bc6e;logger[_0x7f3a('0x8')](_0x7f3a('0x58'),_0x31da2c['id']);return getTicket(_0x27437b,_0x5a17a9,_0x31da2c,_0x171f22,_0x326607);})[_0x7f3a('0xd')](function(_0x5684cc){if(_0x5684cc){logger[_0x7f3a('0x8')](_0x7f3a('0x59'));logger[_0x7f3a('0x8')](_0x7f3a('0x4a'),_0x5684cc['id']);switch(_0x27437b['type']){case _0x7f3a('0x4b'):logger['info'](_0x7f3a('0x42'),_0x7f3a('0x4c'));emit(util[_0x7f3a('0xa')](_0x7f3a('0x4d'),_0x2aeb31[_0x7f3a('0x34')]),_0x7f3a('0x5a'),{'recordId':_0x5684cc['id']});break;case _0x7f3a('0x5b'):logger[_0x7f3a('0x8')]('[QUEUE]',_0x7f3a('0x4e'));emit(util['format'](_0x7f3a('0x4d'),_0x2aeb31['name']),_0x7f3a('0x4f'),{'uri':util[_0x7f3a('0xa')]('%s/agent/tickets/%s',_0x27437b[_0x7f3a('0xc')],_0x5684cc['id'])});break;default:logger[_0x7f3a('0x50')](_0x7f3a('0x5c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7f3a('0x51')](function(_0x530de4){logger[_0x7f3a('0x50')]('[OUTBOUND]',JSON[_0x7f3a('0x5d')](_0x530de4));});};exports[_0x7f3a('0x5e')]=function(_0x4dde30,_0x308585,_0x10cd0e,_0x13d4c2,_0x33c12e,_0x4aefaf){var _0x1e531f,_0x4be98c;_0x4aefaf[_0x7f3a('0xc')]=intUtil[_0x7f3a('0x40')](_0x4aefaf['remoteUri']);_0x4aefaf[_0x7f3a('0x45')]=intUtil[_0x7f3a('0x40')](_0x4aefaf[_0x7f3a('0x45')]);if(_0x33c12e&&_0x33c12e[_0x7f3a('0x41')]){logger['info'](_0x7f3a('0x5f'),_0x7f3a('0x43'));_0x308585['recordingURL']=util[_0x7f3a('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4aefaf[_0x7f3a('0x45')],_0x308585[_0x7f3a('0x46')],md5(_0x308585[_0x7f3a('0x46')]));}else{_0x308585['recordingURL']='';}headers['Authorization']=getAuth(_0x4aefaf);return getUser(_0x4aefaf)[_0x7f3a('0xd')](function(_0x49faa3){_0x1e531f=_0x49faa3;logger[_0x7f3a('0x8')](_0x7f3a('0x55'),_0x1e531f['id']);return getEndUser(_0x4aefaf,_0x308585[_0x7f3a('0x48')],_0x308585[_0x7f3a('0x49')]);})[_0x7f3a('0xd')](function(_0x46c677){_0x4be98c=_0x46c677;logger['info'](_0x7f3a('0x58'),_0x4be98c['id']);return getTicket(_0x4aefaf,_0x1e531f,_0x4be98c,_0x10cd0e,_0x308585);})[_0x7f3a('0xd')](function(_0x2a6a59){if(_0x2a6a59){logger['info'](_0x7f3a('0x59'));logger[_0x7f3a('0x8')](_0x7f3a('0x4a'),_0x2a6a59['id']);}})[_0x7f3a('0x51')](function(_0xecde93){logger[_0x7f3a('0x50')](_0x7f3a('0x5f'),JSON[_0x7f3a('0x5d')](_0xecde93));});}; \ 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 0cb3f28..4db1688 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 _0xf3cd=['Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','info','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','debug','defaults','GET','map','forEach','type','string','customField','nameField','toLowerCase','content','idField','variable','variableName','push','customVariable','Variable','queue','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','stringify','outbound','stripTrailingSlash','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[ABANDONED]','error','lodash','request-promise','md5','util','./util','../../../../config/logger','socket.io-emitter','localhost','application/json','emit'];(function(_0x232b67,_0x3dc89e){var _0x39fcc0=function(_0x3e20c6){while(--_0x3e20c6){_0x232b67['push'](_0x232b67['shift']());}};_0x39fcc0(++_0x3dc89e);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x45161c,_0x5494fc){_0x45161c=_0x45161c-0x0;var _0x186581=_0xf3cd[_0x45161c];return _0x186581;};'use strict';var _=require(_0xdf3c('0x0'));var rp=require(_0xdf3c('0x1'));var md5=require(_0xdf3c('0x2'));var util=require(_0xdf3c('0x3'));var intUtil=require(_0xdf3c('0x4'));var logger=require(_0xdf3c('0x5'))('freshdesk');var io=require(_0xdf3c('0x6'))({'host':_0xdf3c('0x7'),'port':0x18eb});var headers={'Content-Type':_0xdf3c('0x8'),'Accept':'application/json'};function emit(_0x111a2e,_0x17d42a,_0x1313d5){io['to'](_0x111a2e)[_0xdf3c('0x9')](_0x17d42a,_0x1313d5);}function getTicket(_0x106021,_0x28edae,_0x52c073,_0x15705d,_0x52cf30){logger['info'](_0xdf3c('0xa'));var _0x981616=_['merge']({'responder_id':_0x28edae['id'],'requester_id':_0x52c073['id'],'name':util[_0xdf3c('0xb')](_0xdf3c('0xc'),_0x52cf30[_0xdf3c('0xd')]),'phone':_0x52cf30[_0xdf3c('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xdf3c('0xf')](_0x15705d[_0xdf3c('0x10')],_0x52cf30,'\x20'),'description':intUtil[_0xdf3c('0xf')](_0x15705d[_0xdf3c('0x11')],_0x52cf30,'
'),'tags':getTags(_0x15705d[_0xdf3c('0x12')],_0xdf3c('0x13'))},getCustomFields(_0x15705d[_0xdf3c('0x14')],_0x52cf30));_0x981616[_0xdf3c('0x15')]=_['mapValues'](_[_0xdf3c('0x16')](_0x981616[_0xdf3c('0x15')],'id'),_0xdf3c('0x17'));return request({'uri':util['format'](_0xdf3c('0x18'),_0x106021[_0xdf3c('0x19')]),'method':_0xdf3c('0x1a'),'body':_0x981616})[_0xdf3c('0x1b')](function(_0x21e587){logger[_0xdf3c('0x1c')](_0xdf3c('0x1d'));return _0x21e587;});}function getUser(_0x92008b,_0x2986d0){logger[_0xdf3c('0x1c')]('Getting\x20agent\x20with\x20email',_0x2986d0);return request({'uri':util[_0xdf3c('0xb')](_0xdf3c('0x1e'),_0x92008b[_0xdf3c('0x19')]),'qs':{'email':_0x2986d0}})[_0xdf3c('0x1b')](function(_0x1e2690){if(_0x1e2690[_0xdf3c('0x1f')]){logger[_0xdf3c('0x1c')](_0xdf3c('0x20'));return _[_0xdf3c('0x21')](_0x1e2690,function(_0x18fb5f){return _0x18fb5f[_0xdf3c('0x22')][_0xdf3c('0x23')]===_0x2986d0;});}else{logger[_0xdf3c('0x1c')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xdf3c('0x24'),_0x92008b['remoteUri'])})[_0xdf3c('0x1b')](function(_0x40e7ec){logger[_0xdf3c('0x1c')](_0xdf3c('0x25'));return _0x40e7ec;});}});}function getEndUser(_0x33652f,_0x36ba1c,_0x50d8ca){logger[_0xdf3c('0x1c')](_0xdf3c('0x26'),_0x50d8ca);return request({'uri':util[_0xdf3c('0xb')](_0xdf3c('0x27'),_0x33652f[_0xdf3c('0x19')]),'qs':{'phone':_0x50d8ca}})[_0xdf3c('0x1b')](function(_0xef54cb){if(_0xef54cb[_0xdf3c('0x1f')]){logger[_0xdf3c('0x1c')](_0xdf3c('0x28'));return _['find'](_0xef54cb,{'phone':_0x50d8ca});}else{logger[_0xdf3c('0x1c')](_0xdf3c('0x29'));return request({'uri':util['format'](_0xdf3c('0x27'),_0x33652f['remoteUri']),'method':'POST','body':{'name':_0x36ba1c,'phone':_0x50d8ca}})['then'](function(_0x14aac9){logger[_0xdf3c('0x1c')]('Enduser\x20created.');return _0x14aac9;});}});}function getAuth(_0x5c3b5a){return util[_0xdf3c('0xb')](_0xdf3c('0x2a'),new Buffer(_0x5c3b5a[_0xdf3c('0x2b')]+':X')[_0xdf3c('0x2c')]('base64'));}function request(_0x43ce06){logger[_0xdf3c('0x2d')]('[HTTP]',JSON['stringify'](_0x43ce06));return rp(_[_0xdf3c('0x2e')](_0x43ce06,{'method':_0xdf3c('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x36937e,_0x540f3a){var _0x2355f6=[];if(_0x36937e&&_0x36937e[_0xdf3c('0x1f')]>0x0){_0x2355f6=_[_0xdf3c('0x30')](_0x36937e,_0x540f3a);}return _0x2355f6;}function getCustomFields(_0x10099e,_0x575ae1){var _0xda0de0=[];var _0x46b445={'custom_fields':[]};if(_0x10099e['length']>0x0){_[_0xdf3c('0x31')](_0x10099e,function(_0x3daeda){if(_0x3daeda[_0xdf3c('0x32')]===_0xdf3c('0x33')&&_0x3daeda['nameField']&&!_0x3daeda[_0xdf3c('0x34')]){_0x46b445[_0x3daeda[_0xdf3c('0x35')][_0xdf3c('0x36')]()]=_0x3daeda[_0xdf3c('0x37')]['toString']();}else if(_0x3daeda[_0xdf3c('0x32')]===_0xdf3c('0x33')&&_0x3daeda['idField']&&_0x3daeda['customField']){_0x46b445[_0xdf3c('0x15')]['push']({'id':_0x3daeda[_0xdf3c('0x38')],'value':_0x3daeda['content']['toString']()});}else if(_0x3daeda['type']===_0xdf3c('0x39')&&_0x3daeda[_0xdf3c('0x3a')]&&_0x3daeda[_0xdf3c('0x38')]&&_0x3daeda[_0xdf3c('0x34')]){_0x575ae1[_0x3daeda['variableName']]&&_0x46b445['custom_fields'][_0xdf3c('0x3b')]({'id':_0x3daeda['idField'],'value':_0x575ae1[_0x3daeda[_0xdf3c('0x3a')]][_0xdf3c('0x2c')]()});}else if(_0x3daeda[_0xdf3c('0x32')]===_0xdf3c('0x3c')&&_0x3daeda[_0xdf3c('0x3d')]&&_0x3daeda[_0xdf3c('0x3d')][_0xdf3c('0x13')]&&_0x3daeda[_0xdf3c('0x38')]&&_0x3daeda[_0xdf3c('0x34')]){_0x575ae1[_0x3daeda['Variable'][_0xdf3c('0x13')]['toLowerCase']()]&&_0x46b445['custom_fields'][_0xdf3c('0x3b')]({'id':_0x3daeda['idField'],'value':_0x575ae1[_0x3daeda[_0xdf3c('0x3d')]['name'][_0xdf3c('0x36')]()][_0xdf3c('0x2c')]()});}});}return _0x46b445;}exports[_0xdf3c('0x3e')]=function(_0x1349a4,_0x3098cb,_0x5ebff9,_0x736ef5,_0x3d47fb,_0x3cf131){var _0xa65478,_0x424acf;_0x3cf131[_0xdf3c('0x19')]=intUtil['stripTrailingSlash'](_0x3cf131['remoteUri']);_0x3cf131[_0xdf3c('0x3f')]=intUtil['stripTrailingSlash'](_0x3cf131[_0xdf3c('0x3f')]);if(_0x3d47fb&&_0x3d47fb[_0xdf3c('0x40')]){logger[_0xdf3c('0x1c')](_0xdf3c('0x41'),'Recording\x20is\x20enabled!');_0x3098cb['recordingURL']=util[_0xdf3c('0xb')](_0xdf3c('0x42'),_0x3cf131[_0xdf3c('0x3f')],_0x3098cb['uniqueid'],md5(_0x3098cb[_0xdf3c('0x43')]));}else{_0x3098cb[_0xdf3c('0x44')]='';}headers[_0xdf3c('0x45')]=getAuth(_0x3cf131);return getUser(_0x3cf131,_0x736ef5[_0xdf3c('0x23')])['then'](function(_0x127685){_0xa65478=_0x127685;logger[_0xdf3c('0x1c')](_0xdf3c('0x46'),_0xa65478['id']);return getEndUser(_0x3cf131,_0x3098cb[_0xdf3c('0xd')],_0x3098cb[_0xdf3c('0xe')]);})['then'](function(_0x410aaf){_0x424acf=_0x410aaf;logger[_0xdf3c('0x1c')](_0xdf3c('0x47'),_0x424acf['id']);return getTicket(_0x3cf131,_0xa65478,_0x424acf,_0x5ebff9,_0x3098cb);})[_0xdf3c('0x1b')](function(_0x36962d){if(_0x36962d&&_0x36962d['id']){logger[_0xdf3c('0x1c')]('Ticket\x20created!');logger['info'](_0xdf3c('0x48'),_0x36962d['id']);logger[_0xdf3c('0x1c')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xdf3c('0xb')](_0xdf3c('0x49'),_0x736ef5[_0xdf3c('0x13')]),_0xdf3c('0x4a'),{'uri':util[_0xdf3c('0xb')](_0xdf3c('0x4b'),_0x3cf131[_0xdf3c('0x19')],_0x36962d['id'])});}})[_0xdf3c('0x4c')](function(_0x4007b1){logger['error'](_0xdf3c('0x41'),JSON[_0xdf3c('0x4d')](_0x4007b1));});};exports[_0xdf3c('0x4e')]=function(_0xe760dd,_0xfc5901,_0x385824,_0x28a468,_0x553f70,_0x1751a8,_0x5c1dca){var _0xa4e137,_0x47b101;_0x1751a8[_0xdf3c('0x19')]=intUtil[_0xdf3c('0x4f')](_0x1751a8[_0xdf3c('0x19')]);_0x1751a8[_0xdf3c('0x3f')]=intUtil['stripTrailingSlash'](_0x1751a8['serverUrl']);if(_0x5c1dca&&_0x5c1dca['recordingFormat']&&_0x5c1dca[_0xdf3c('0x50')]!=='none'){logger[_0xdf3c('0x1c')](_0xdf3c('0x51'),_0xdf3c('0x52'));_0xfc5901[_0xdf3c('0x44')]=util[_0xdf3c('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1751a8['serverUrl'],_0xfc5901[_0xdf3c('0x43')],md5(_0xfc5901[_0xdf3c('0x43')]));}headers['Authorization']=getAuth(_0x1751a8);return getUser(_0x1751a8,_0x28a468[_0xdf3c('0x23')])[_0xdf3c('0x1b')](function(_0x168eaf){_0xa4e137=_0x168eaf;logger[_0xdf3c('0x1c')](_0xdf3c('0x46'),_0xa4e137['id']);return getEndUser(_0x1751a8,_0xfc5901[_0xdf3c('0x53')],_0xfc5901[_0xdf3c('0x54')]);})['then'](function(_0x4c98dc){_0x47b101=_0x4c98dc;logger[_0xdf3c('0x1c')](_0xdf3c('0x47'),_0x47b101['id']);return getTicket(_0x1751a8,_0xa4e137,_0x47b101,_0x385824,_0xfc5901);})[_0xdf3c('0x1b')](function(_0x1ad771){if(_0x1ad771&&_0x1ad771['id']){logger[_0xdf3c('0x1c')](_0xdf3c('0x1d'));logger[_0xdf3c('0x1c')](_0xdf3c('0x48'),_0x1ad771['id']);logger[_0xdf3c('0x1c')](_0xdf3c('0x51'),_0xdf3c('0x55'));emit(util['format'](_0xdf3c('0x49'),_0x28a468['name']),'trigger:browser:url',{'uri':util['format']('%s/helpdesk/tickets/%d',_0x1751a8['remoteUri'],_0x1ad771['id'])});}})[_0xdf3c('0x4c')](function(_0x1c18a9){logger['error'](_0xdf3c('0x51'),JSON[_0xdf3c('0x4d')](_0x1c18a9));});};exports['abandoned']=function(_0xa8dddb,_0x28f935,_0x10e9d5,_0x1389e0,_0x396461,_0x28f387){var _0xb54629,_0xdc859;_0x28f387[_0xdf3c('0x19')]=intUtil[_0xdf3c('0x4f')](_0x28f387[_0xdf3c('0x19')]);_0x28f387['serverUrl']=intUtil[_0xdf3c('0x4f')](_0x28f387[_0xdf3c('0x3f')]);if(_0x396461&&_0x396461[_0xdf3c('0x40')]){logger['info'](_0xdf3c('0x56'),_0xdf3c('0x52'));_0x28f935[_0xdf3c('0x44')]=util['format'](_0xdf3c('0x42'),_0x28f387[_0xdf3c('0x3f')],_0x28f935['uniqueid'],md5(_0x28f935[_0xdf3c('0x43')]));}else{_0x28f935['recordingURL']='';}headers[_0xdf3c('0x45')]=getAuth(_0x28f387);return getUser(_0x28f387,_0x1389e0[_0xdf3c('0x23')])[_0xdf3c('0x1b')](function(_0x3de07e){_0xb54629=_0x3de07e;logger[_0xdf3c('0x1c')](_0xdf3c('0x46'),_0xb54629['id']);return getEndUser(_0x28f387,_0x28f935[_0xdf3c('0xd')],_0x28f935[_0xdf3c('0xe')]);})[_0xdf3c('0x1b')](function(_0x330730){_0xdc859=_0x330730;logger[_0xdf3c('0x1c')](_0xdf3c('0x47'),_0xdc859['id']);return getTicket(_0x28f387,_0xb54629,_0xdc859,_0x10e9d5,_0x28f935);})[_0xdf3c('0x1b')](function(_0x206a18){if(_0x206a18){logger[_0xdf3c('0x1c')](_0xdf3c('0x1d'));logger[_0xdf3c('0x1c')]('The\x20Ticket\x20ID\x20is:',_0x206a18['id']);}})['catch'](function(_0x2e8511){logger[_0xdf3c('0x57')](_0xdf3c('0x56'),JSON['stringify'](_0x2e8511));});}; \ No newline at end of file +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(_0x4a4e11,_0x1060b1){var _0x2cab01=function(_0x58a8bc){while(--_0x58a8bc){_0x4a4e11['push'](_0x4a4e11['shift']());}};_0x2cab01(++_0x1060b1);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1b3251,_0x58f958){_0x1b3251=_0x1b3251-0x0;var _0x370769=_0xbdb7[_0x1b3251];return _0x370769;};'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 diff --git a/server/services/ami/trigger/integration/index.js b/server/services/ami/trigger/integration/index.js index 65831ba..1e020d5 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 _0x2c95=['./salesforce','./sugarcrm','./zoho','./desk','./vtiger','zendesk','sugarcrm','freshdesk','zoho','desk','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','abandoned','vtiger','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk'];(function(_0x2fabfa,_0x175629){var _0x2c6d30=function(_0x110969){while(--_0x110969){_0x2fabfa['push'](_0x2fabfa['shift']());}};_0x2c6d30(++_0x175629);}(_0x2c95,0x1a1));var _0x52c9=function(_0x1591d4,_0x4ea3bd){_0x1591d4=_0x1591d4-0x0;var _0x4c46bb=_0x2c95[_0x1591d4];return _0x4c46bb;};'use strict';var _=require(_0x52c9('0x0'));var util=require(_0x52c9('0x1'));var zendesk=require(_0x52c9('0x2'));var salesforce=require(_0x52c9('0x3'));var sugarcrm=require(_0x52c9('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0x52c9('0x5'));var desk=require(_0x52c9('0x6'));var vtiger=require(_0x52c9('0x7'));var integrations=[_0x52c9('0x8'),'salesforce',_0x52c9('0x9'),_0x52c9('0xa'),_0x52c9('0xb'),_0x52c9('0xc'),'vtiger'];exports[_0x52c9('0xd')]=function(_0x5eba3d,_0x3225c8,_0xfaa346,_0x429cfb,_0x858c03,_0x42443d){if(_0xfaa346){if(_[_0x52c9('0xe')](integrations,_0x5eba3d['data1']['toLowerCase']())){try{var _0xae149f=null;var _0x479763='';var _0x2b2fdc=_0xfaa346[_0x5eba3d[_0x52c9('0xf')][_0x52c9('0x10')]()];if(_0x2b2fdc){var _0x2c8268=_0x2b2fdc[_0x5eba3d[_0x52c9('0x11')]];if(_0x2c8268){var _0x314e91=_[_0x52c9('0x12')](_0x2c8268[_0x52c9('0x13')],{'id':parseInt(_0x5eba3d[_0x52c9('0x14')],0xa)});if(_0x314e91){if(_0x429cfb){if(_0x858c03&&_0x3225c8['queue']){_0x479763=_0x52c9('0x15');}else if(_0x3225c8[_0x52c9('0x16')]){_0x479763=_0x52c9('0x17');}else{console[_0x52c9('0x18')](_0x52c9('0x19'),_0x3225c8);}}else{_0x479763=_0x52c9('0x1a');}switch(_0x5eba3d['data1'][_0x52c9('0x10')]()){case'zendesk':zendesk[_0x479763](_0x5eba3d,_0x3225c8,_0x314e91,_0x429cfb,_0x858c03,_0x2c8268,_0x42443d);break;case'salesforce':salesforce[_0x479763](_0x5eba3d,_0x3225c8,_0x314e91,_0x429cfb,_0x858c03,_0x2c8268,_0x42443d);break;case _0x52c9('0x9'):sugarcrm[_0x479763](_0x5eba3d,_0x3225c8,_0x314e91,_0x429cfb,_0x858c03,_0x2c8268,_0x42443d);break;case _0x52c9('0xa'):freshdesk[_0x479763](_0x5eba3d,_0x3225c8,_0x314e91,_0x429cfb,_0x858c03,_0x2c8268,_0x42443d);break;case _0x52c9('0xb'):zoho[_0x479763](_0x5eba3d,_0x3225c8,_0x314e91,_0x429cfb,_0x858c03,_0x2c8268,_0x42443d);break;case _0x52c9('0xc'):desk[_0x479763](_0x5eba3d,_0x3225c8,_0x314e91,_0x429cfb,_0x858c03,_0x2c8268,_0x42443d);break;case _0x52c9('0x1b'):vtiger[_0x479763](_0x5eba3d,_0x3225c8,_0x314e91,_0x429cfb,_0x858c03,_0x2c8268,_0x42443d);break;default:console[_0x52c9('0x18')](_0x52c9('0x1c'));}}else{_0xae149f=require('../../../../config/logger')(_0x5eba3d[_0x52c9('0xf')][_0x52c9('0x10')]());_0xae149f[_0x52c9('0x1d')](_0x52c9('0x1e'),util[_0x52c9('0x1f')](_0x52c9('0x20'),_0x5eba3d[_0x52c9('0xf')][_0x52c9('0x10')](),_0x5eba3d[_0x52c9('0x14')]));}}else{_0xae149f=require(_0x52c9('0x21'))(_0x5eba3d['data1'][_0x52c9('0x10')]());_0xae149f[_0x52c9('0x1d')](_0x52c9('0x1e'),util[_0x52c9('0x1f')](_0x52c9('0x22'),_0x5eba3d[_0x52c9('0xf')][_0x52c9('0x10')](),_0x5eba3d[_0x52c9('0x11')]));}}else{}}catch(_0xd3fd95){console[_0x52c9('0x1d')](_0xd3fd95);}}}}; \ No newline at end of file +var _0x51ac=['salesforce','sugarcrm','freshdesk','vtiger','exec','includes','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','log','EVENT\x20UNKNOWN','abandoned','zoho','desk','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','zendesk'];(function(_0xc904f5,_0x479bbd){var _0x21bc46=function(_0x3bb4ff){while(--_0x3bb4ff){_0xc904f5['push'](_0xc904f5['shift']());}};_0x21bc46(++_0x479bbd);}(_0x51ac,0x118));var _0xc51a=function(_0x5f1f27,_0x473279){_0x5f1f27=_0x5f1f27-0x0;var _0x13caf8=_0x51ac[_0x5f1f27];return _0x13caf8;};'use strict';var _=require(_0xc51a('0x0'));var util=require(_0xc51a('0x1'));var zendesk=require(_0xc51a('0x2'));var salesforce=require(_0xc51a('0x3'));var sugarcrm=require(_0xc51a('0x4'));var freshdesk=require(_0xc51a('0x5'));var zoho=require('./zoho');var desk=require(_0xc51a('0x6'));var vtiger=require('./vtiger');var integrations=[_0xc51a('0x7'),_0xc51a('0x8'),_0xc51a('0x9'),_0xc51a('0xa'),'zoho','desk',_0xc51a('0xb')];exports[_0xc51a('0xc')]=function(_0x568c0a,_0x5f4795,_0xeface6,_0x22c861,_0x498c19,_0x485f8a){if(_0xeface6){if(_[_0xc51a('0xd')](integrations,_0x568c0a['data1'][_0xc51a('0xe')]())){try{var _0x3712ad=null;var _0x27445c='';var _0x69cc9b=_0xeface6[_0x568c0a[_0xc51a('0xf')][_0xc51a('0xe')]()];if(_0x69cc9b){var _0x77eb8f=_0x69cc9b[_0x568c0a[_0xc51a('0x10')]];if(_0x77eb8f){var _0x1c42ba=_[_0xc51a('0x11')](_0x77eb8f[_0xc51a('0x12')],{'id':parseInt(_0x568c0a[_0xc51a('0x13')],0xa)});if(_0x1c42ba){if(_0x22c861){if(_0x498c19&&_0x5f4795[_0xc51a('0x14')]){_0x27445c='queue';}else if(_0x5f4795[_0xc51a('0x15')]){_0x27445c='outbound';}else{console[_0xc51a('0x16')](_0xc51a('0x17'),_0x5f4795);}}else{_0x27445c=_0xc51a('0x18');}switch(_0x568c0a[_0xc51a('0xf')][_0xc51a('0xe')]()){case _0xc51a('0x7'):zendesk[_0x27445c](_0x568c0a,_0x5f4795,_0x1c42ba,_0x22c861,_0x498c19,_0x77eb8f,_0x485f8a);break;case _0xc51a('0x8'):salesforce[_0x27445c](_0x568c0a,_0x5f4795,_0x1c42ba,_0x22c861,_0x498c19,_0x77eb8f,_0x485f8a);break;case _0xc51a('0x9'):sugarcrm[_0x27445c](_0x568c0a,_0x5f4795,_0x1c42ba,_0x22c861,_0x498c19,_0x77eb8f,_0x485f8a);break;case _0xc51a('0xa'):freshdesk[_0x27445c](_0x568c0a,_0x5f4795,_0x1c42ba,_0x22c861,_0x498c19,_0x77eb8f,_0x485f8a);break;case _0xc51a('0x19'):zoho[_0x27445c](_0x568c0a,_0x5f4795,_0x1c42ba,_0x22c861,_0x498c19,_0x77eb8f,_0x485f8a);break;case _0xc51a('0x1a'):desk[_0x27445c](_0x568c0a,_0x5f4795,_0x1c42ba,_0x22c861,_0x498c19,_0x77eb8f,_0x485f8a);break;case _0xc51a('0xb'):vtiger[_0x27445c](_0x568c0a,_0x5f4795,_0x1c42ba,_0x22c861,_0x498c19,_0x77eb8f,_0x485f8a);break;default:console[_0xc51a('0x16')](_0xc51a('0x1b'));}}else{_0x3712ad=require(_0xc51a('0x1c'))(_0x568c0a[_0xc51a('0xf')][_0xc51a('0xe')]());_0x3712ad[_0xc51a('0x1d')](_0xc51a('0x1e'),util[_0xc51a('0x1f')]('%s\x20configuration\x20#%s\x20not\x20found',_0x568c0a[_0xc51a('0xf')][_0xc51a('0xe')](),_0x568c0a[_0xc51a('0x13')]));}}else{_0x3712ad=require(_0xc51a('0x1c'))(_0x568c0a[_0xc51a('0xf')][_0xc51a('0xe')]());_0x3712ad['error'](_0xc51a('0x1e'),util['format']('%s\x20account\x20#%s\x20not\x20found',_0x568c0a[_0xc51a('0xf')]['toLowerCase'](),_0x568c0a[_0xc51a('0x10')]));}}else{}}catch(_0x2bded7){console[_0xc51a('0x1d')](_0x2bded7);}}}}; \ 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 726f00b..421a8d9 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 _0x4659=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','[QUEUE]\x20Ticket\x20%s\x20created','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','abandoned','monitor_format','[ABANDONED]','calleridname','calleridnum','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','./util','../../../../config/logger','salesforce','socket.io-emitter','localhost','emit','Subjects','getString','Descriptions','WhoId','sobject','create','User','find','execute','then','Email','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','length','Lead','contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','concat','Connection','remoteUri','https://login.salesforce.com','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!'];(function(_0x5ee58f,_0x3ad41f){var _0x330129=function(_0x1d4d72){while(--_0x1d4d72){_0x5ee58f['push'](_0x5ee58f['shift']());}};_0x330129(++_0x3ad41f);}(_0x4659,0x83));var _0x9465=function(_0x2461cb,_0x35f985){_0x2461cb=_0x2461cb-0x0;var _0x9c1b8f=_0x4659[_0x2461cb];return _0x9c1b8f;};'use strict';var _=require(_0x9465('0x0'));var rp=require(_0x9465('0x1'));var moment=require(_0x9465('0x2'));var BPromise=require(_0x9465('0x3'));var md5=require('md5');var jsforce=require(_0x9465('0x4'));var util=require('util');var intUtil=require(_0x9465('0x5'));var logger=require(_0x9465('0x6'))(_0x9465('0x7'));var io=require(_0x9465('0x8'))({'host':_0x9465('0x9'),'port':0x18eb});function emit(_0x18b3ff,_0x2bee7e,_0x181fca){io['to'](_0x18b3ff)[_0x9465('0xa')](_0x2bee7e,_0x181fca);}function getTicket(_0x41998c,_0x4686b9,_0xd95848,_0x36e8a5,_0x46d793,_0x296762,_0x1a8326){var _0x4dd52e=_['merge']({'OwnerId':_0x4686b9['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x36e8a5[_0x9465('0xb')],_0x46d793,'\x20'),'Description':intUtil[_0x9465('0xc')](_0x36e8a5[_0x9465('0xd')],_0x46d793,'\x0a')},getCustomFields(_0x296762,_0x46d793));if(_0xd95848){_0x4dd52e[_0x9465('0xe')]=_0xd95848['id'];}return _0x1a8326[_0x9465('0xf')]('Task')[_0x9465('0x10')](_0x4dd52e);}function getUser(_0x462b7d,_0x46fef5,_0x46a1c3){var _0x48b443={'Email':_0x46fef5};var _0xfdc154={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x46a1c3[_0x9465('0xf')](_0x9465('0x11'))[_0x9465('0x12')](_0x48b443,_0xfdc154)[_0x9465('0x13')]()[_0x9465('0x14')](function(_0x56af5a){if(_0x56af5a['length']){var _0x414696=_[_0x9465('0x12')](_0x56af5a,function(_0x1eca8b){return _0x1eca8b[_0x9465('0x15')]===_0x46fef5;});if(_0x414696){logger['info']('Agent\x20%s\x20found.',_0x46fef5);return BPromise['resolve']({'id':_0x414696['Id'],'name':_0x414696['Name']});}}else{logger[_0x9465('0x16')](_0x9465('0x17'),_0x46fef5);return _0x46a1c3['identity']()[_0x9465('0x14')](function(_0xc773c7){return BPromise[_0x9465('0x18')]({'id':_0xc773c7[_0x9465('0x19')],'name':_0xc773c7['display_name']});});}});}function getEndUser(_0x16c08b,_0x542d1c,_0x1c151f,_0xcacad0,_0x4d701f){var _0x5e5c32={'Phone':_0xcacad0};var _0x162063={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x9465('0x18')]()[_0x9465('0x14')](function(){logger[_0x9465('0x16')](_0x9465('0x1a'),_0xcacad0,_0x542d1c['moduleSearch']);switch(_0x542d1c[_0x9465('0x1b')]){case _0x9465('0x1c'):return _0x4d701f[_0x9465('0xf')](_0x9465('0x1d'))[_0x9465('0x12')](_0x5e5c32,_0x162063)[_0x9465('0x13')]()[_0x9465('0x14')](function(_0x3a900a){if(_0x3a900a&&_0x3a900a[_0x9465('0x1e')]){return _0x3a900a;}else{return _0x4d701f[_0x9465('0xf')](_0x9465('0x1f'))['find'](_0x5e5c32,_0x162063);}});case _0x9465('0x20'):return _0x4d701f[_0x9465('0xf')]('Contact')[_0x9465('0x12')](_0x5e5c32,_0x162063)[_0x9465('0x13')]();case _0x9465('0x21'):return _0x4d701f[_0x9465('0xf')](_0x9465('0x1f'))[_0x9465('0x12')](_0x5e5c32,_0x162063);default:return null;}})['then'](function(_0x23ad02){if(_0x23ad02&&_0x23ad02[_0x9465('0x1e')]){var _0x3fbb31=_[_0x9465('0x12')](_0x23ad02,function(_0x189314){return _0x189314[_0x9465('0x22')]===_0xcacad0;});if(_0x3fbb31){return BPromise['resolve']({'id':_0x3fbb31['Id'],'name':_0x3fbb31['Name'],'phone':_0x3fbb31[_0x9465('0x22')]});}}})[_0x9465('0x14')](function(_0x146b68){if(_0x146b68){logger[_0x9465('0x16')]('Enduser\x20with\x20phone\x20%s\x20found.',_0xcacad0);return BPromise[_0x9465('0x18')](_0x146b68);}else{logger[_0x9465('0x16')](_0x9465('0x23'),_0xcacad0);var _0x182d3a={'LastName':_0x1c151f!==_0x9465('0x24')?_0x1c151f:util[_0x9465('0x25')](_0x9465('0x26'),_0xcacad0),'Phone':_0xcacad0};if(_0x542d1c[_0x9465('0x27')]){switch(_0x542d1c[_0x9465('0x27')]){case _0x9465('0x20'):logger[_0x9465('0x16')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0xcacad0,_0x542d1c[_0x9465('0x27')]);break;case _0x9465('0x21'):logger[_0x9465('0x16')](_0x9465('0x28'),_0xcacad0,_0x542d1c['moduleCreate']);_0x182d3a[_0x9465('0x29')]=_0x9465('0x2a');break;default:return null;}}return _0x4d701f[_0x9465('0xf')](_[_0x9465('0x2b')](_0x542d1c[_0x9465('0x27')]))['create'](_0x182d3a);}});}function getCustomFields(_0x8cdb6a,_0x347e3c){var _0x16d9a9={};if(_0x8cdb6a[_0x9465('0x1e')]>0x0){_[_0x9465('0x2c')](_0x8cdb6a,function(_0x103041){if(_0x103041[_0x9465('0x2d')]==='string'&&_0x103041['idField']){_0x16d9a9[_0x103041[_0x9465('0x2e')]]=_0x103041[_0x9465('0x2f')]['toString']();}else if(_0x103041[_0x9465('0x2d')]===_0x9465('0x30')&&_0x103041['variableName']&&_0x103041[_0x9465('0x2e')]){_0x347e3c[_0x103041[_0x9465('0x31')]]&&(_0x16d9a9[_0x103041[_0x9465('0x2e')]]=_0x347e3c[_0x103041[_0x9465('0x31')]][_0x9465('0x32')]());}else if(_0x103041[_0x9465('0x2d')]===_0x9465('0x33')&&_0x103041['Variable']&&_0x103041[_0x9465('0x34')][_0x9465('0x35')]&&_0x103041[_0x9465('0x2e')]){_0x347e3c[_0x103041[_0x9465('0x34')]['name'][_0x9465('0x36')]()]&&(_0x16d9a9[_0x103041['idField']]=_0x347e3c[_0x103041[_0x9465('0x34')][_0x9465('0x35')]['toLowerCase']()][_0x9465('0x32')]());}});}return _0x16d9a9;}function getConnection(_0x2a36c9){var _0x63c702=_0x2a36c9[_0x9465('0x37')][_0x9465('0x38')](_0x2a36c9['securityToken']);var _0x2b52ac=new jsforce[(_0x9465('0x39'))]({'oauth2':{'loginUrl':_0x2a36c9[_0x9465('0x3a')]||_0x9465('0x3b'),'clientId':_0x2a36c9['clientId'],'clientSecret':_0x2a36c9['clientSecret']}});return _0x2b52ac[_0x9465('0x3c')](_0x2a36c9[_0x9465('0x3d')],_0x63c702)[_0x9465('0x14')](function(){logger[_0x9465('0x16')](_0x9465('0x3e'));return _0x2b52ac;});}exports[_0x9465('0x3f')]=function(_0x34e3d7,_0x1f7873,_0x3ebfd8,_0x593e97,_0x3d3af9,_0x16b143){var _0xbe8767,_0x4fb9cd,_0x3aa4ad,_0x1b7a46;_0x16b143[_0x9465('0x40')]=intUtil[_0x9465('0x41')](_0x16b143[_0x9465('0x40')]);if(_0x3d3af9&&_0x3d3af9['monitor_format']){logger['info']('[QUEUE]',_0x9465('0x42'));_0x1f7873['recordingURL']=util[_0x9465('0x25')](_0x9465('0x43'),_0x16b143[_0x9465('0x40')],_0x1f7873[_0x9465('0x44')],md5(_0x1f7873[_0x9465('0x44')]));}else{_0x1f7873[_0x9465('0x45')]='';}return getConnection(_0x16b143)['then'](function(_0x91c083){_0x1b7a46=_0x91c083;return getUser(_0x16b143,_0x593e97[_0x9465('0x46')],_0x1b7a46);})[_0x9465('0x14')](function(_0x31db18){_0xbe8767=_0x31db18;return getEndUser(_0x16b143,_0x3ebfd8,_0x1f7873['calleridname'],_0x1f7873['calleridnum'],_0x1b7a46);})[_0x9465('0x14')](function(_0x51ea14){_0x4fb9cd=_0x51ea14;return getTicket(_0x16b143,_0xbe8767,_0x4fb9cd,_0x3ebfd8,_0x1f7873,_0x3ebfd8['Fields'],_0x1b7a46);})[_0x9465('0x14')](function(_0x3358e1){_0x3aa4ad=_0x3358e1;logger[_0x9465('0x16')](_0x9465('0x47'),_0x3aa4ad['id']);logger['info']('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x3aa4ad['id'],_0x593e97[_0x9465('0x35')],_0x16b143[_0x9465('0x2d')]);switch(_0x16b143['type']){case'integrationTab':emit(util[_0x9465('0x25')]('user:%s',_0x593e97[_0x9465('0x35')]),_0x9465('0x48'),{'recordId':_0x3aa4ad['id']});break;case _0x9465('0x49'):emit(util['format'](_0x9465('0x4a'),_0x593e97['name']),_0x9465('0x4b'),{'uri':util[_0x9465('0x25')](_0x9465('0x4c'),_0x1b7a46[_0x9465('0x4d')],_0x3aa4ad['id'])});break;default:logger[_0x9465('0x4e')](_0x9465('0x4f'));}})[_0x9465('0x50')](function(_0x303f6e){logger[_0x9465('0x4e')](_0x9465('0x51'),JSON[_0x9465('0x52')](_0x303f6e));});};exports[_0x9465('0x53')]=function(_0x20c902,_0xb37d37,_0x207574,_0x1904b3,_0x4aa1d5,_0x10026a,_0x38bf0f){var _0x128682,_0x3ab235,_0x8d982e,_0x2812be;_0x10026a[_0x9465('0x40')]=intUtil['stripTrailingSlash'](_0x10026a['serverUrl']);if(_0x38bf0f&&_0x38bf0f[_0x9465('0x54')]&&_0x38bf0f[_0x9465('0x54')]!==_0x9465('0x55')){logger[_0x9465('0x16')](_0x9465('0x56'),_0x9465('0x42'));_0xb37d37[_0x9465('0x45')]=util['format'](_0x9465('0x43'),_0x10026a['serverUrl'],_0xb37d37[_0x9465('0x44')],md5(_0xb37d37[_0x9465('0x44')]));}return getConnection(_0x10026a)[_0x9465('0x14')](function(_0xe12f2c){_0x2812be=_0xe12f2c;return getUser(_0x10026a,_0x1904b3[_0x9465('0x46')],_0x2812be);})[_0x9465('0x14')](function(_0x285498){_0x128682=_0x285498;return getEndUser(_0x10026a,_0x207574,_0xb37d37['destcalleridname'],_0xb37d37[_0x9465('0x57')],_0x2812be);})['then'](function(_0x372690){_0x3ab235=_0x372690;return getTicket(_0x10026a,_0x128682,_0x3ab235,_0x207574,_0xb37d37,_0x207574[_0x9465('0x58')],_0x2812be);})[_0x9465('0x14')](function(_0x5bcb2f){_0x8d982e=_0x5bcb2f;logger[_0x9465('0x16')](_0x9465('0x59'),_0x8d982e['id']);logger['info'](_0x9465('0x5a'),_0x8d982e['id'],_0x1904b3[_0x9465('0x35')],_0x10026a[_0x9465('0x2d')]);switch(_0x10026a[_0x9465('0x2d')]){case _0x9465('0x5b'):emit(util[_0x9465('0x25')](_0x9465('0x4a'),_0x1904b3[_0x9465('0x35')]),'trigger:salesforce:display',{'recordId':_0x8d982e['id']});break;case _0x9465('0x49'):emit(util[_0x9465('0x25')](_0x9465('0x4a'),_0x1904b3[_0x9465('0x35')]),'trigger:browser:url',{'uri':util[_0x9465('0x25')](_0x9465('0x4c'),_0x2812be['instanceUrl'],_0x8d982e['id'])});break;default:logger[_0x9465('0x4e')]('[OUTBOUND]',_0x9465('0x5c'));}})[_0x9465('0x50')](function(_0x3b64b9){logger[_0x9465('0x4e')](_0x9465('0x56'),JSON[_0x9465('0x52')](_0x3b64b9));});};exports[_0x9465('0x5d')]=function(_0xf47fd,_0x5f3ecc,_0x50472e,_0x2cd643,_0x3dfd8b,_0x2a7996){var _0x5a18ea,_0x29467c,_0x30cc40,_0x497717;_0x2a7996[_0x9465('0x40')]=intUtil[_0x9465('0x41')](_0x2a7996[_0x9465('0x40')]);if(_0x3dfd8b&&_0x3dfd8b[_0x9465('0x5e')]){logger[_0x9465('0x16')](_0x9465('0x5f'),_0x9465('0x42'));_0x5f3ecc[_0x9465('0x45')]=util[_0x9465('0x25')](_0x9465('0x43'),_0x2a7996[_0x9465('0x40')],_0x5f3ecc[_0x9465('0x44')],md5(_0x5f3ecc[_0x9465('0x44')]));}else{_0x5f3ecc['recordingURL']='';}return getConnection(_0x2a7996)[_0x9465('0x14')](function(_0x4f7ce1){_0x497717=_0x4f7ce1;return getUser(_0x2a7996,_0x2cd643[_0x9465('0x46')],_0x497717);})[_0x9465('0x14')](function(_0x1c6745){_0x5a18ea=_0x1c6745;return getEndUser(_0x2a7996,_0x50472e,_0x5f3ecc[_0x9465('0x60')],_0x5f3ecc[_0x9465('0x61')],_0x497717);})['then'](function(_0x2fecfb){_0x29467c=_0x2fecfb;return getTicket(_0x2a7996,_0x5a18ea,_0x29467c,_0x50472e,_0x5f3ecc,_0x50472e[_0x9465('0x58')],_0x497717);})[_0x9465('0x14')](function(_0x247004){_0x30cc40=_0x247004;logger[_0x9465('0x16')]('[ABANDONED]\x20Ticket\x20%s\x20created.',_0x30cc40['id']);logger[_0x9465('0x16')](_0x9465('0x62'),_0x2a7996[_0x9465('0x2d')]);})[_0x9465('0x50')](function(_0x4f26d9){logger[_0x9465('0x4e')](_0x9465('0x5f'),JSON[_0x9465('0x52')](_0x4f26d9));});}; \ No newline at end of file +var _0x0dde=['uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','recordingFormat','[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','Salesforce\x20account\x20type\x20not\x20recognized','[ABANDONED]\x20Ticket\x20%s\x20created.','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','lodash','bluebird','md5','jsforce','util','../../../../config/logger','salesforce','socket.io-emitter','localhost','merge','utc','getString','Descriptions','WhoId','sobject','create','User','execute','then','length','find','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','Contact','contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','upperFirst','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','password','securityToken','remoteUri','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x380ac7,_0x257211){var _0x545078=function(_0x2d159c){while(--_0x2d159c){_0x380ac7['push'](_0x380ac7['shift']());}};_0x545078(++_0x257211);}(_0x0dde,0x197));var _0xe0dd=function(_0x1b0307,_0x4336b1){_0x1b0307=_0x1b0307-0x0;var _0x5c8d34=_0x0dde[_0x1b0307];return _0x5c8d34;};'use strict';var _=require(_0xe0dd('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe0dd('0x1'));var md5=require(_0xe0dd('0x2'));var jsforce=require(_0xe0dd('0x3'));var util=require(_0xe0dd('0x4'));var intUtil=require('./util');var logger=require(_0xe0dd('0x5'))(_0xe0dd('0x6'));var io=require(_0xe0dd('0x7'))({'host':_0xe0dd('0x8'),'port':0x18eb});function emit(_0x11ae2a,_0x152ac8,_0x4202ca){io['to'](_0x11ae2a)['emit'](_0x152ac8,_0x4202ca);}function getTicket(_0x406cd2,_0x35d6d2,_0x738641,_0x3b56ec,_0x244a04,_0x4254ef,_0x3cc3d3){var _0x26f7d1=_[_0xe0dd('0x9')]({'OwnerId':_0x35d6d2['id'],'ActivityDate':moment[_0xe0dd('0xa')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x3b56ec['Subjects'],_0x244a04,'\x20'),'Description':intUtil[_0xe0dd('0xb')](_0x3b56ec[_0xe0dd('0xc')],_0x244a04,'\x0a')},getCustomFields(_0x4254ef,_0x244a04));if(_0x738641){_0x26f7d1[_0xe0dd('0xd')]=_0x738641['id'];}return _0x3cc3d3[_0xe0dd('0xe')]('Task')[_0xe0dd('0xf')](_0x26f7d1);}function getUser(_0x1095fc,_0xc15b5f,_0x5a6cd3){var _0x2dcbce={'Email':_0xc15b5f};var _0x515ba5={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5a6cd3['sobject'](_0xe0dd('0x10'))['find'](_0x2dcbce,_0x515ba5)[_0xe0dd('0x11')]()[_0xe0dd('0x12')](function(_0x47d603){if(_0x47d603[_0xe0dd('0x13')]){var _0x44b02f=_[_0xe0dd('0x14')](_0x47d603,function(_0x1ff815){return _0x1ff815['Email']===_0xc15b5f;});if(_0x44b02f){logger[_0xe0dd('0x15')](_0xe0dd('0x16'),_0xc15b5f);return BPromise[_0xe0dd('0x17')]({'id':_0x44b02f['Id'],'name':_0x44b02f[_0xe0dd('0x18')]});}}else{logger['info'](_0xe0dd('0x19'),_0xc15b5f);return _0x5a6cd3[_0xe0dd('0x1a')]()['then'](function(_0x351b4a){return BPromise[_0xe0dd('0x17')]({'id':_0x351b4a[_0xe0dd('0x1b')],'name':_0x351b4a[_0xe0dd('0x1c')]});});}});}function getEndUser(_0x433d3e,_0x7d6ee3,_0x57e231,_0x41e31d,_0xf714f0){var _0x4d6743={'Phone':_0x41e31d};var _0x148a42={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xe0dd('0x17')]()['then'](function(){logger[_0xe0dd('0x15')](_0xe0dd('0x1d'),_0x41e31d,_0x7d6ee3[_0xe0dd('0x1e')]);switch(_0x7d6ee3[_0xe0dd('0x1e')]){case'contact_lead':return _0xf714f0[_0xe0dd('0xe')](_0xe0dd('0x1f'))[_0xe0dd('0x14')](_0x4d6743,_0x148a42)[_0xe0dd('0x11')]()[_0xe0dd('0x12')](function(_0x48c5ca){if(_0x48c5ca&&_0x48c5ca[_0xe0dd('0x13')]){return _0x48c5ca;}else{return _0xf714f0[_0xe0dd('0xe')]('Lead')['find'](_0x4d6743,_0x148a42);}});case _0xe0dd('0x20'):return _0xf714f0['sobject'](_0xe0dd('0x1f'))[_0xe0dd('0x14')](_0x4d6743,_0x148a42)['execute']();case _0xe0dd('0x21'):return _0xf714f0[_0xe0dd('0xe')]('Lead')[_0xe0dd('0x14')](_0x4d6743,_0x148a42);default:return null;}})[_0xe0dd('0x12')](function(_0x32d8c3){if(_0x32d8c3&&_0x32d8c3[_0xe0dd('0x13')]){var _0x289fc1=_[_0xe0dd('0x14')](_0x32d8c3,function(_0x1635c3){return _0x1635c3[_0xe0dd('0x22')]===_0x41e31d;});if(_0x289fc1){return BPromise[_0xe0dd('0x17')]({'id':_0x289fc1['Id'],'name':_0x289fc1['Name'],'phone':_0x289fc1[_0xe0dd('0x22')]});}}})[_0xe0dd('0x12')](function(_0x634219){if(_0x634219){logger['info']('Enduser\x20with\x20phone\x20%s\x20found.',_0x41e31d);return BPromise[_0xe0dd('0x17')](_0x634219);}else{logger[_0xe0dd('0x15')](_0xe0dd('0x23'),_0x41e31d);var _0x12d977={'LastName':_0x57e231!==_0xe0dd('0x24')?_0x57e231:util[_0xe0dd('0x25')](_0xe0dd('0x26'),_0x41e31d),'Phone':_0x41e31d};if(_0x7d6ee3[_0xe0dd('0x27')]){switch(_0x7d6ee3[_0xe0dd('0x27')]){case _0xe0dd('0x20'):logger[_0xe0dd('0x15')](_0xe0dd('0x28'),_0x41e31d,_0x7d6ee3[_0xe0dd('0x27')]);break;case _0xe0dd('0x21'):logger[_0xe0dd('0x15')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x41e31d,_0x7d6ee3[_0xe0dd('0x27')]);_0x12d977[_0xe0dd('0x29')]='No\x20Company';break;default:return null;}}return _0xf714f0[_0xe0dd('0xe')](_[_0xe0dd('0x2a')](_0x7d6ee3[_0xe0dd('0x27')]))[_0xe0dd('0xf')](_0x12d977);}});}function getCustomFields(_0x5b729f,_0x5f01b3){var _0x225fb6={};if(_0x5b729f['length']>0x0){_['forEach'](_0x5b729f,function(_0x28e9f9){if(_0x28e9f9['type']==='string'&&_0x28e9f9[_0xe0dd('0x2b')]){_0x225fb6[_0x28e9f9[_0xe0dd('0x2b')]]=_0x28e9f9[_0xe0dd('0x2c')][_0xe0dd('0x2d')]();}else if(_0x28e9f9[_0xe0dd('0x2e')]===_0xe0dd('0x2f')&&_0x28e9f9[_0xe0dd('0x30')]&&_0x28e9f9[_0xe0dd('0x2b')]){_0x5f01b3[_0x28e9f9[_0xe0dd('0x30')]]&&(_0x225fb6[_0x28e9f9['idField']]=_0x5f01b3[_0x28e9f9['variableName']][_0xe0dd('0x2d')]());}else if(_0x28e9f9[_0xe0dd('0x2e')]===_0xe0dd('0x31')&&_0x28e9f9[_0xe0dd('0x32')]&&_0x28e9f9[_0xe0dd('0x32')][_0xe0dd('0x33')]&&_0x28e9f9['idField']){_0x5f01b3[_0x28e9f9[_0xe0dd('0x32')][_0xe0dd('0x33')]['toLowerCase']()]&&(_0x225fb6[_0x28e9f9[_0xe0dd('0x2b')]]=_0x5f01b3[_0x28e9f9[_0xe0dd('0x32')][_0xe0dd('0x33')][_0xe0dd('0x34')]()][_0xe0dd('0x2d')]());}});}return _0x225fb6;}function getConnection(_0x1fe195){var _0x48098f=_0x1fe195[_0xe0dd('0x35')]['concat'](_0x1fe195[_0xe0dd('0x36')]);var _0x5b6f3f=new jsforce['Connection']({'oauth2':{'loginUrl':_0x1fe195[_0xe0dd('0x37')]||'https://login.salesforce.com','clientId':_0x1fe195[_0xe0dd('0x38')],'clientSecret':_0x1fe195[_0xe0dd('0x39')]}});return _0x5b6f3f[_0xe0dd('0x3a')](_0x1fe195[_0xe0dd('0x3b')],_0x48098f)[_0xe0dd('0x12')](function(){logger['info'](_0xe0dd('0x3c'));return _0x5b6f3f;});}exports['queue']=function(_0x442ed7,_0x1d5d2a,_0x96ad76,_0x1ba709,_0x2b6118,_0x4a85b1){var _0x371bbd,_0x2a5bae,_0xbcc17a,_0x3674e2;_0x4a85b1[_0xe0dd('0x3d')]=intUtil[_0xe0dd('0x3e')](_0x4a85b1[_0xe0dd('0x3d')]);if(_0x2b6118&&_0x2b6118[_0xe0dd('0x3f')]){logger[_0xe0dd('0x15')](_0xe0dd('0x40'),_0xe0dd('0x41'));_0x1d5d2a[_0xe0dd('0x42')]=util[_0xe0dd('0x25')](_0xe0dd('0x43'),_0x4a85b1[_0xe0dd('0x3d')],_0x1d5d2a[_0xe0dd('0x44')],md5(_0x1d5d2a[_0xe0dd('0x44')]));}else{_0x1d5d2a[_0xe0dd('0x42')]='';}return getConnection(_0x4a85b1)[_0xe0dd('0x12')](function(_0x3c9058){_0x3674e2=_0x3c9058;return getUser(_0x4a85b1,_0x1ba709[_0xe0dd('0x45')],_0x3674e2);})[_0xe0dd('0x12')](function(_0x288e62){_0x371bbd=_0x288e62;return getEndUser(_0x4a85b1,_0x96ad76,_0x1d5d2a[_0xe0dd('0x46')],_0x1d5d2a[_0xe0dd('0x47')],_0x3674e2);})[_0xe0dd('0x12')](function(_0x7d8914){_0x2a5bae=_0x7d8914;return getTicket(_0x4a85b1,_0x371bbd,_0x2a5bae,_0x96ad76,_0x1d5d2a,_0x96ad76[_0xe0dd('0x48')],_0x3674e2);})[_0xe0dd('0x12')](function(_0x4a7399){_0xbcc17a=_0x4a7399;logger[_0xe0dd('0x15')](_0xe0dd('0x49'),_0xbcc17a['id']);logger[_0xe0dd('0x15')](_0xe0dd('0x4a'),_0xbcc17a['id'],_0x1ba709[_0xe0dd('0x33')],_0x4a85b1[_0xe0dd('0x2e')]);switch(_0x4a85b1[_0xe0dd('0x2e')]){case _0xe0dd('0x4b'):emit(util['format'](_0xe0dd('0x4c'),_0x1ba709[_0xe0dd('0x33')]),'trigger:salesforce:display',{'recordId':_0xbcc17a['id']});break;case _0xe0dd('0x4d'):emit(util[_0xe0dd('0x25')]('user:%s',_0x1ba709[_0xe0dd('0x33')]),_0xe0dd('0x4e'),{'uri':util[_0xe0dd('0x25')](_0xe0dd('0x4f'),_0x3674e2[_0xe0dd('0x50')],_0xbcc17a['id'])});break;default:logger[_0xe0dd('0x51')](_0xe0dd('0x52'));}})[_0xe0dd('0x53')](function(_0x19196c){logger[_0xe0dd('0x51')](_0xe0dd('0x40'),JSON[_0xe0dd('0x54')](_0x19196c));});};exports['outbound']=function(_0x235f53,_0x3597b8,_0x551f9e,_0x4761b4,_0x3e31e8,_0x17adf0,_0x35fdc5){var _0x21db83,_0x384e7e,_0x172044,_0x53933c;_0x17adf0['serverUrl']=intUtil['stripTrailingSlash'](_0x17adf0[_0xe0dd('0x3d')]);if(_0x35fdc5&&_0x35fdc5[_0xe0dd('0x55')]&&_0x35fdc5['recordingFormat']!=='none'){logger['info'](_0xe0dd('0x56'),'Recording\x20is\x20enabled!');_0x3597b8['recordingURL']=util[_0xe0dd('0x25')](_0xe0dd('0x43'),_0x17adf0[_0xe0dd('0x3d')],_0x3597b8[_0xe0dd('0x44')],md5(_0x3597b8[_0xe0dd('0x44')]));}return getConnection(_0x17adf0)[_0xe0dd('0x12')](function(_0x6b08ba){_0x53933c=_0x6b08ba;return getUser(_0x17adf0,_0x4761b4[_0xe0dd('0x45')],_0x53933c);})[_0xe0dd('0x12')](function(_0x5c9a72){_0x21db83=_0x5c9a72;return getEndUser(_0x17adf0,_0x551f9e,_0x3597b8[_0xe0dd('0x57')],_0x3597b8[_0xe0dd('0x58')],_0x53933c);})[_0xe0dd('0x12')](function(_0x19ece5){_0x384e7e=_0x19ece5;return getTicket(_0x17adf0,_0x21db83,_0x384e7e,_0x551f9e,_0x3597b8,_0x551f9e[_0xe0dd('0x48')],_0x53933c);})[_0xe0dd('0x12')](function(_0x2e7f28){_0x172044=_0x2e7f28;logger[_0xe0dd('0x15')](_0xe0dd('0x59'),_0x172044['id']);logger[_0xe0dd('0x15')](_0xe0dd('0x5a'),_0x172044['id'],_0x4761b4['name'],_0x17adf0['type']);switch(_0x17adf0[_0xe0dd('0x2e')]){case _0xe0dd('0x4b'):emit(util['format']('user:%s',_0x4761b4['name']),_0xe0dd('0x5b'),{'recordId':_0x172044['id']});break;case _0xe0dd('0x4d'):emit(util[_0xe0dd('0x25')](_0xe0dd('0x4c'),_0x4761b4[_0xe0dd('0x33')]),'trigger:browser:url',{'uri':util['format'](_0xe0dd('0x4f'),_0x53933c['instanceUrl'],_0x172044['id'])});break;default:logger[_0xe0dd('0x51')](_0xe0dd('0x56'),_0xe0dd('0x5c'));}})[_0xe0dd('0x53')](function(_0x1fdddb){logger[_0xe0dd('0x51')](_0xe0dd('0x56'),JSON[_0xe0dd('0x54')](_0x1fdddb));});};exports['abandoned']=function(_0x57b991,_0x8ce8b9,_0x5c347f,_0x201334,_0x4179c9,_0x5b8337){var _0x36efa6,_0x4bd6bd,_0x358d2b,_0xae82a3;_0x5b8337[_0xe0dd('0x3d')]=intUtil[_0xe0dd('0x3e')](_0x5b8337[_0xe0dd('0x3d')]);if(_0x4179c9&&_0x4179c9[_0xe0dd('0x3f')]){logger[_0xe0dd('0x15')]('[ABANDONED]',_0xe0dd('0x41'));_0x8ce8b9[_0xe0dd('0x42')]=util[_0xe0dd('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5b8337['serverUrl'],_0x8ce8b9[_0xe0dd('0x44')],md5(_0x8ce8b9[_0xe0dd('0x44')]));}else{_0x8ce8b9[_0xe0dd('0x42')]='';}return getConnection(_0x5b8337)[_0xe0dd('0x12')](function(_0x54ea3b){_0xae82a3=_0x54ea3b;return getUser(_0x5b8337,_0x201334[_0xe0dd('0x45')],_0xae82a3);})[_0xe0dd('0x12')](function(_0x58bbb9){_0x36efa6=_0x58bbb9;return getEndUser(_0x5b8337,_0x5c347f,_0x8ce8b9['calleridname'],_0x8ce8b9[_0xe0dd('0x47')],_0xae82a3);})[_0xe0dd('0x12')](function(_0x5678b){_0x4bd6bd=_0x5678b;return getTicket(_0x5b8337,_0x36efa6,_0x4bd6bd,_0x5c347f,_0x8ce8b9,_0x5c347f[_0xe0dd('0x48')],_0xae82a3);})[_0xe0dd('0x12')](function(_0x598b2a){_0x358d2b=_0x598b2a;logger['info'](_0xe0dd('0x5d'),_0x358d2b['id']);logger[_0xe0dd('0x15')](_0xe0dd('0x5e'),_0x5b8337['type']);})['catch'](function(_0xda4375){logger[_0xe0dd('0x51')]('[ABANDONED]',JSON[_0xe0dd('0x54')](_0xda4375));});}; \ 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 4abf490..411dd53 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 _0x8602=['version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','error','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','charAt','catch','abandoned','uri','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Fields','[ABANDONED]','request-promise','bluebird','md5','util','./util','../../../../config/logger','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','date_start','slice','duration_hours','parent_id','Contacts','length','forEach','variableName','push','JSON','Calls','format','Basic\x20%s','apiKey','toString','base64','stringify','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','value','Agent\x20found!','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!','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','map','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','customVariable','Variable','login','username','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','stripTrailingSlash','remoteUri','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts'];(function(_0x1488cd,_0x25a893){var _0x63fa13=function(_0x57dd1c){while(--_0x57dd1c){_0x1488cd['push'](_0x1488cd['shift']());}};_0x63fa13(++_0x25a893);}(_0x8602,0x7f));var _0x2860=function(_0x132d12,_0x2c9799){_0x132d12=_0x132d12-0x0;var _0x1c3163=_0x8602[_0x132d12];return _0x1c3163;};'use strict';var _=require('lodash');var rp=require(_0x2860('0x0'));var BPromise=require(_0x2860('0x1'));var md5=require(_0x2860('0x2'));var util=require(_0x2860('0x3'));var intUtil=require(_0x2860('0x4'));var logger=require(_0x2860('0x5'))('sugarcrm');var io=require(_0x2860('0x6'))({'host':'localhost','port':0x18eb});var def={'method':_0x2860('0x7'),'json':!![]};function emit(_0x5801ff,_0x628e5b,_0x34c1e8){io['to'](_0x5801ff)[_0x2860('0x8')](_0x628e5b,_0x34c1e8);}function getTicket(_0x3c583f,_0x285b3e,_0x2c404e,_0xae09bb,_0x3d6171,_0x12a2cf,_0x45c89b){logger[_0x2860('0x9')](_0x2860('0xa'));var _0x180441=new Date();var _0x11fcde=[{'name':_0x2860('0xb'),'value':intUtil[_0x2860('0xc')](_0xae09bb[_0x2860('0xd')],_0x3d6171,'\x20')},{'name':_0x2860('0xe'),'value':_0x285b3e['id']},{'name':_0x2860('0xf'),'value':_0x285b3e['id']},{'name':_0x2860('0x10'),'value':intUtil['getString'](_0xae09bb['Descriptions'],_0x3d6171,'\x0a')},{'name':_0x2860('0x11'),'value':_0x180441['toISOString']()[_0x2860('0x12')](0x0,0x13)['replace']('T','\x20')},{'name':_0x2860('0x13'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x2860('0x14'),'value':_0x2c404e['id']},{'name':'parent_type','value':_0x2860('0x15')},{'name':'parent_name','value':_0x2c404e[_0x2860('0xb')]}];if(_0x12a2cf[_0x2860('0x16')]){_[_0x2860('0x17')](_0x12a2cf,function(_0x5ce5cf){if(_0x3d6171[_0x5ce5cf[_0x2860('0x18')]]){_0x11fcde[_0x2860('0x19')]({'name':_0x5ce5cf['idField'],'value':_0x3d6171[_0x5ce5cf['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':_0x2860('0x1a'),'response_type':_0x2860('0x1a'),'rest_data':JSON['stringify']({'session':_0x45c89b['id'],'module_name':_0x2860('0x1b'),'name_value_list':_0x11fcde})}});}function getAuth(_0x332d6d){return util[_0x2860('0x1c')](_0x2860('0x1d'),new Buffer(_0x332d6d[_0x2860('0x1e')]+':X')[_0x2860('0x1f')](_0x2860('0x20')));}function getServerInfo(_0x35d25a){return request({'form':{'method':'get_server_info','input_type':_0x2860('0x1a'),'response_type':_0x2860('0x1a'),'rest_data':JSON[_0x2860('0x21')]({'session':_0x35d25a['id']})}});}function getUser(_0x3f048e,_0x17b603,_0x16027c){logger[_0x2860('0x9')]('Getting\x20agent\x20with\x20name',_0x17b603);return request({'form':{'method':_0x2860('0x22'),'input_type':'JSON','response_type':_0x2860('0x1a'),'rest_data':JSON[_0x2860('0x21')]({'session':_0x16027c['id'],'module_name':_0x2860('0x23'),'query':util['format'](_0x2860('0x24'),_0x17b603),'order_by':'','offset':'0','select_fields':['id','name',_0x2860('0x25')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x2860('0x26')](function(_0x37d060){if(_0x37d060[_0x2860('0x27')][_0x2860('0x16')]){var _0x54d31a=_[_0x2860('0x28')](_0x37d060[_0x2860('0x27')],function(_0x3663a7){return _0x3663a7['name_value_list'][_0x2860('0x25')][_0x2860('0x29')]===_0x17b603;});if(_0x54d31a){logger[_0x2860('0x9')](_0x2860('0x2a'));return BPromise[_0x2860('0x2b')]({'id':_0x54d31a[_0x2860('0x2c')]['id'][_0x2860('0x29')],'name':_0x54d31a['name_value_list'][_0x2860('0xb')][_0x2860('0x29')]});}}else{logger[_0x2860('0x9')](_0x2860('0x2d'));return BPromise['resolve']({'id':_0x16027c[_0x2860('0x2c')][_0x2860('0x2e')]['id'],'name':_0x16027c['name_value_list'][_0x2860('0x25')]['id']});}});}function getEndUser(_0x51621f,_0xf32d1c,_0x318a0f,_0x4f0d1c){logger[_0x2860('0x9')](_0x2860('0x2f'),_0x318a0f);return request({'form':{'method':_0x2860('0x22'),'input_type':_0x2860('0x1a'),'response_type':_0x2860('0x1a'),'rest_data':JSON[_0x2860('0x21')]({'session':_0x4f0d1c['id'],'module_name':_0x2860('0x15'),'query':util[_0x2860('0x1c')](_0x2860('0x30'),_0x318a0f),'order_by':'','offset':'0','select_fields':['id',_0x2860('0xb'),_0x2860('0x31')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x2860('0x26')](function(_0x3bc23c){if(_0x3bc23c[_0x2860('0x27')][_0x2860('0x16')]){var _0x1ccc07=_[_0x2860('0x28')](_0x3bc23c[_0x2860('0x27')],function(_0x468426){return _0x468426[_0x2860('0x2c')]['phone_home'][_0x2860('0x29')]===_0x318a0f;});if(_0x1ccc07){logger[_0x2860('0x9')](_0x2860('0x32'));return BPromise[_0x2860('0x2b')]({'id':_0x1ccc07[_0x2860('0x2c')]['id'][_0x2860('0x29')],'name':_0x1ccc07[_0x2860('0x2c')][_0x2860('0xb')][_0x2860('0x29')],'phone':_0x1ccc07[_0x2860('0x2c')][_0x2860('0x31')][_0x2860('0x29')]});}}else{logger[_0x2860('0x9')](_0x2860('0x33'));return request({'form':{'method':'set_entry','input_type':_0x2860('0x1a'),'response_type':_0x2860('0x1a'),'rest_data':JSON[_0x2860('0x21')]({'session':_0x4f0d1c['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0xf32d1c!==''?_0xf32d1c:util[_0x2860('0x1c')](_0x2860('0x34'),_0x318a0f)},{'name':_0x2860('0x31'),'value':_0x318a0f}]})}})[_0x2860('0x26')](function(_0x282676){logger[_0x2860('0x9')](_0x2860('0x35'));return BPromise[_0x2860('0x2b')]({'id':_0x282676['id'],'name':_0x282676['entry_list'][_0x2860('0x36')][_0x2860('0x29')],'phone':_0x282676[_0x2860('0x27')]['phone_home'][_0x2860('0x29')]});});}});}function request(_0x14dbdc){logger[_0x2860('0x37')](_0x2860('0x38'),JSON[_0x2860('0x21')](_0x14dbdc));return rp(_[_0x2860('0x39')](def,_0x14dbdc));}function getTags(_0x4b0a7d,_0xde7270){var _0x40a116=[];if(_0x4b0a7d&&_0x4b0a7d[_0x2860('0x16')]>0x0){_0x40a116=_[_0x2860('0x3a')](_0x4b0a7d,_0xde7270);}return _0x40a116;}function getCustomFields(_0x5281f2,_0x27ba16){var _0x3aa5e7=[];var _0xadb53f={'custom_fields':[]};if(_0x5281f2[_0x2860('0x16')]>0x0){_['forEach'](_0x5281f2,function(_0x22dc56){if(_0x22dc56[_0x2860('0x3b')]==='string'&&_0x22dc56[_0x2860('0x3c')]&&!_0x22dc56[_0x2860('0x3d')]){_0xadb53f[_0x22dc56[_0x2860('0x3c')][_0x2860('0x3e')]()]=_0x22dc56[_0x2860('0x3f')][_0x2860('0x1f')]();}else if(_0x22dc56['type']===_0x2860('0x40')&&_0x22dc56[_0x2860('0x41')]&&_0x22dc56['customField']){_0xadb53f[_0x2860('0x42')]['push']({'id':_0x22dc56[_0x2860('0x41')],'value':_0x22dc56[_0x2860('0x3f')][_0x2860('0x1f')]()});}else if(_0x22dc56[_0x2860('0x3b')]===_0x2860('0x43')&&_0x22dc56[_0x2860('0x18')]&&_0x22dc56[_0x2860('0x41')]&&_0x22dc56[_0x2860('0x3d')]){_0x27ba16[_0x22dc56[_0x2860('0x18')]]&&_0xadb53f[_0x2860('0x42')][_0x2860('0x19')]({'id':_0x22dc56[_0x2860('0x41')],'value':_0x27ba16[_0x22dc56[_0x2860('0x18')]][_0x2860('0x1f')]()});}else if(_0x22dc56[_0x2860('0x3b')]===_0x2860('0x44')&&_0x22dc56[_0x2860('0x45')]&&_0x22dc56[_0x2860('0x45')]['name']&&_0x22dc56[_0x2860('0x41')]&&_0x22dc56[_0x2860('0x3d')]){_0x27ba16[_0x22dc56[_0x2860('0x45')][_0x2860('0xb')][_0x2860('0x3e')]()]&&_0xadb53f[_0x2860('0x42')][_0x2860('0x19')]({'id':_0x22dc56[_0x2860('0x41')],'value':_0x27ba16[_0x22dc56[_0x2860('0x45')]['name']['toLowerCase']()][_0x2860('0x1f')]()});}});}return _0xadb53f;}function getConnection(_0x48651e){return request({'method':_0x2860('0x7'),'form':{'method':_0x2860('0x46'),'input_type':_0x2860('0x1a'),'response_type':_0x2860('0x1a'),'rest_data':JSON[_0x2860('0x21')]({'user_auth':{'user_name':_0x48651e[_0x2860('0x47')],'password':_0x48651e['password'],'encryption':_0x2860('0x48')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x2860('0x26')](function(_0x206c43){var _0x3397f2=_0x206c43;if(_0x3397f2['id']){def[_0x2860('0x49')]=_0x3397f2['id'];return BPromise[_0x2860('0x2b')](_0x3397f2);}else{throw new Error(util[_0x2860('0x1c')](_0x2860('0x4a'),_0x48651e['id']));}});}function setRelationship(_0x53bd07,_0x8c1585,_0x1cf59d,_0x1a59ab){return request({'form':{'method':'set_relationship','input_type':_0x2860('0x1a'),'response_type':_0x2860('0x1a'),'rest_data':JSON[_0x2860('0x21')]({'session':_0x53bd07['id'],'module_name':_0x2860('0x1b'),'module_id':_0x1cf59d['id'],'link_field_name':_0x1a59ab,'related_ids':[_0x8c1585['id']]})}});}exports['queue']=function(_0x3a24d6,_0x3483f3,_0x3e1d06,_0xd2e6d1,_0x23a839,_0x581e53){var _0x3322d3,_0x1b5fb8,_0x4f3ba1,_0x473cff;_0x581e53['remoteUri']=intUtil[_0x2860('0x4b')](_0x581e53[_0x2860('0x4c')]);_0x581e53[_0x2860('0x4d')]=intUtil[_0x2860('0x4b')](_0x581e53[_0x2860('0x4d')]);def['uri']=util[_0x2860('0x1c')]('%s/service/v4_1/rest.php',_0x581e53[_0x2860('0x4c')]);if(_0x23a839&&_0x23a839[_0x2860('0x4e')]){logger[_0x2860('0x9')]('[QUEUE]',_0x2860('0x4f'));_0x3483f3[_0x2860('0x50')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x581e53[_0x2860('0x4d')],_0x3483f3[_0x2860('0x51')],md5(_0x3483f3[_0x2860('0x51')]));}else{_0x3483f3[_0x2860('0x50')]='';}return getConnection(_0x581e53)[_0x2860('0x26')](function(_0x446024){_0x473cff=_0x446024;return getUser(_0x581e53,_0xd2e6d1[_0x2860('0xb')],_0x473cff);})[_0x2860('0x26')](function(_0x497cf6){_0x3322d3=_0x497cf6;logger['info'](_0x2860('0x52'),_0x3322d3['id']);return getEndUser(_0x581e53,_0x3483f3[_0x2860('0x53')],_0x3483f3[_0x2860('0x54')],_0x473cff);})[_0x2860('0x26')](function(_0x55d795){_0x1b5fb8=_0x55d795;logger[_0x2860('0x9')](_0x2860('0x55'),_0x1b5fb8['id']);return getTicket(_0x581e53,_0x3322d3,_0x1b5fb8,_0x3e1d06,_0x3483f3,_0x3e1d06['Fields'],_0x473cff);})['then'](function(_0x4233f4){_0x4f3ba1=_0x4233f4;logger[_0x2860('0x9')](_0x2860('0x56'));logger[_0x2860('0x9')](_0x2860('0x57'),_0x4f3ba1['id']);return setRelationship(_0x473cff,_0x3322d3,_0x4f3ba1,'users');})['then'](function(){return setRelationship(_0x473cff,_0x1b5fb8,_0x4f3ba1,_0x2860('0x58'));})[_0x2860('0x26')](function(){return getServerInfo(_0x473cff);})[_0x2860('0x26')](function(_0x2985f5){var _0x3e0f8f=parseInt(_0x2985f5[_0x2860('0x59')]['charAt'](0x0));var _0x5cc565=util[_0x2860('0x1c')](_0x2860('0x5a'),_0x581e53[_0x2860('0x4c')],_0x4f3ba1['id']);if(_0x3e0f8f>0x6){_0x5cc565=util[_0x2860('0x1c')](_0x2860('0x5b'),_0x581e53[_0x2860('0x4c')],_0x4f3ba1['id']);}logger[_0x2860('0x9')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x2860('0x5c'),_0xd2e6d1[_0x2860('0xb')]),_0x2860('0x5d'),{'uri':_0x5cc565});})['catch'](function(_0xab9091){logger[_0x2860('0x5e')](_0x2860('0x5f'),JSON['stringify'](_0xab9091));});};exports[_0x2860('0x60')]=function(_0x2a1fbd,_0x1c9318,_0x137865,_0xfca593,_0x29e498,_0x1adb5d,_0x326cd9){var _0x50f57a,_0x3d8688,_0x1d6bd7,_0x310ffa;_0x1adb5d[_0x2860('0x4c')]=intUtil[_0x2860('0x4b')](_0x1adb5d[_0x2860('0x4c')]);_0x1adb5d[_0x2860('0x4d')]=intUtil[_0x2860('0x4b')](_0x1adb5d['serverUrl']);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x1adb5d[_0x2860('0x4c')]);if(_0x326cd9&&_0x326cd9[_0x2860('0x61')]&&_0x326cd9[_0x2860('0x61')]!==_0x2860('0x62')){logger[_0x2860('0x9')](_0x2860('0x63'),'Recording\x20is\x20enabled!');_0x1c9318[_0x2860('0x50')]=util[_0x2860('0x1c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1adb5d['serverUrl'],_0x1c9318[_0x2860('0x51')],md5(_0x1c9318['uniqueid']));}return getConnection(_0x1adb5d)[_0x2860('0x26')](function(_0x233d11){_0x310ffa=_0x233d11;return getUser(_0x1adb5d,_0xfca593[_0x2860('0xb')],_0x310ffa);})[_0x2860('0x26')](function(_0x19a1e5){_0x50f57a=_0x19a1e5;logger['info'](_0x2860('0x52'),_0x50f57a['id']);return getEndUser(_0x1adb5d,_0x1c9318['destcalleridname'],_0x1c9318[_0x2860('0x64')],_0x310ffa);})['then'](function(_0x4b93bf){_0x3d8688=_0x4b93bf;logger[_0x2860('0x9')]('The\x20Enduser\x20ID\x20is:',_0x3d8688['id']);return getTicket(_0x1adb5d,_0x50f57a,_0x3d8688,_0x137865,_0x1c9318,_0x137865['Fields'],_0x310ffa);})[_0x2860('0x26')](function(_0x2386f8){_0x1d6bd7=_0x2386f8;logger[_0x2860('0x9')]('Ticket\x20created!');logger[_0x2860('0x9')](_0x2860('0x57'),_0x1d6bd7['id']);return setRelationship(_0x310ffa,_0x50f57a,_0x1d6bd7,'users');})[_0x2860('0x26')](function(){return setRelationship(_0x310ffa,_0x3d8688,_0x1d6bd7,_0x2860('0x58'));})['then'](function(){return getServerInfo(_0x310ffa);})['then'](function(_0x12d6d4){var _0x3fd6b0=parseInt(_0x12d6d4[_0x2860('0x59')][_0x2860('0x65')](0x0));var _0x3aed1c=util[_0x2860('0x1c')](_0x2860('0x5a'),_0x1adb5d[_0x2860('0x4c')],_0x1d6bd7['id']);if(_0x3fd6b0>0x6){_0x3aed1c=util[_0x2860('0x1c')](_0x2860('0x5b'),_0x1adb5d['remoteUri'],_0x1d6bd7['id']);}logger[_0x2860('0x9')](_0x2860('0x63'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2860('0x1c')]('user:%s',_0xfca593['name']),_0x2860('0x5d'),{'uri':_0x3aed1c});})[_0x2860('0x66')](function(_0x20ce49){logger[_0x2860('0x5e')]('[OUTBOUND]',JSON[_0x2860('0x21')](_0x20ce49));});};exports[_0x2860('0x67')]=function(_0x58a5e9,_0x59fcb7,_0x4c34ab,_0x1cd685,_0x20bf3d,_0x470f4c){var _0x554bce,_0x254aa5,_0x51e5ed,_0x573b95;_0x470f4c[_0x2860('0x4c')]=intUtil[_0x2860('0x4b')](_0x470f4c[_0x2860('0x4c')]);_0x470f4c['serverUrl']=intUtil[_0x2860('0x4b')](_0x470f4c[_0x2860('0x4d')]);def[_0x2860('0x68')]=util[_0x2860('0x1c')]('%s/service/v4_1/rest.php',_0x470f4c[_0x2860('0x4c')]);if(_0x20bf3d&&_0x20bf3d['monitor_format']){logger[_0x2860('0x9')]('[ABANDONED]',_0x2860('0x4f'));_0x59fcb7['recordingURL']=util['format'](_0x2860('0x69'),_0x470f4c['serverUrl'],_0x59fcb7[_0x2860('0x51')],md5(_0x59fcb7[_0x2860('0x51')]));}else{_0x59fcb7[_0x2860('0x50')]='';}return getConnection(_0x470f4c)[_0x2860('0x26')](function(_0x261d18){_0x573b95=_0x261d18;return getUser(_0x470f4c,_0x1cd685[_0x2860('0xb')],_0x573b95);})[_0x2860('0x26')](function(_0x1f362c){_0x554bce=_0x1f362c;logger['info'](_0x2860('0x52'),_0x554bce['id']);return getEndUser(_0x470f4c,_0x59fcb7[_0x2860('0x53')],_0x59fcb7[_0x2860('0x54')],_0x573b95);})['then'](function(_0x528bfe){_0x254aa5=_0x528bfe;logger[_0x2860('0x9')](_0x2860('0x55'),_0x254aa5['id']);return getTicket(_0x470f4c,_0x554bce,_0x254aa5,_0x4c34ab,_0x59fcb7,_0x4c34ab[_0x2860('0x6a')],_0x573b95);})[_0x2860('0x26')](function(_0x5b3296){_0x51e5ed=_0x5b3296;logger['info'](_0x2860('0x56'));logger[_0x2860('0x9')](_0x2860('0x57'),_0x51e5ed['id']);return setRelationship(_0x573b95,_0x554bce,_0x51e5ed,'users');})[_0x2860('0x26')](function(){return setRelationship(_0x573b95,_0x254aa5,_0x51e5ed,_0x2860('0x58'));})['then'](function(){return getServerInfo(_0x573b95);})['catch'](function(_0x361aef){logger['error'](_0x2860('0x6b'),JSON['stringify'](_0x361aef));});}; \ No newline at end of file +var _0x8adc=['Ticket\x20created!','charAt','catch','error','[ABANDONED]','lodash','request-promise','bluebird','md5','util','./util','socket.io-emitter','localhost','POST','emit','info','name','getString','Subjects','assigned_user_id','created_by','Descriptions','date_start','toISOString','slice','replace','parent_id','parent_type','Contacts','parent_name','length','forEach','variableName','push','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','toString','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','stringify','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','merge','map','string','nameField','customField','toLowerCase','content','type','idField','custom_fields','variable','customVariable','Variable','login','username','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','recordingFormat','none','[OUTBOUND]','destcalleridnum'];(function(_0x1551aa,_0x9bb63b){var _0x3758f8=function(_0x5aa70e){while(--_0x5aa70e){_0x1551aa['push'](_0x1551aa['shift']());}};_0x3758f8(++_0x9bb63b);}(_0x8adc,0x1b9));var _0xc8ad=function(_0x4fd109,_0x33c503){_0x4fd109=_0x4fd109-0x0;var _0x30f0a6=_0x8adc[_0x4fd109];return _0x30f0a6;};'use strict';var _=require(_0xc8ad('0x0'));var rp=require(_0xc8ad('0x1'));var BPromise=require(_0xc8ad('0x2'));var md5=require(_0xc8ad('0x3'));var util=require(_0xc8ad('0x4'));var intUtil=require(_0xc8ad('0x5'));var logger=require('../../../../config/logger')('sugarcrm');var io=require(_0xc8ad('0x6'))({'host':_0xc8ad('0x7'),'port':0x18eb});var def={'method':_0xc8ad('0x8'),'json':!![]};function emit(_0x1f7dfe,_0xb7e68f,_0xd64ddf){io['to'](_0x1f7dfe)[_0xc8ad('0x9')](_0xb7e68f,_0xd64ddf);}function getTicket(_0x53b024,_0x31c2f4,_0x1df4ce,_0x4b61dc,_0x5a4dac,_0x4947e9,_0x2efc7e){logger[_0xc8ad('0xa')]('Creating\x20new\x20ticket...');var _0x30f060=new Date();var _0x5149eb=[{'name':_0xc8ad('0xb'),'value':intUtil[_0xc8ad('0xc')](_0x4b61dc[_0xc8ad('0xd')],_0x5a4dac,'\x20')},{'name':_0xc8ad('0xe'),'value':_0x31c2f4['id']},{'name':_0xc8ad('0xf'),'value':_0x31c2f4['id']},{'name':'description','value':intUtil[_0xc8ad('0xc')](_0x4b61dc[_0xc8ad('0x10')],_0x5a4dac,'\x0a')},{'name':_0xc8ad('0x11'),'value':_0x30f060[_0xc8ad('0x12')]()[_0xc8ad('0x13')](0x0,0x13)[_0xc8ad('0x14')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xc8ad('0x15'),'value':_0x1df4ce['id']},{'name':_0xc8ad('0x16'),'value':_0xc8ad('0x17')},{'name':_0xc8ad('0x18'),'value':_0x1df4ce[_0xc8ad('0xb')]}];if(_0x4947e9[_0xc8ad('0x19')]){_[_0xc8ad('0x1a')](_0x4947e9,function(_0x4cd70c){if(_0x5a4dac[_0x4cd70c[_0xc8ad('0x1b')]]){_0x5149eb[_0xc8ad('0x1c')]({'name':_0x4cd70c['idField'],'value':_0x5a4dac[_0x4cd70c['variableName']]});}});}return request({'form':{'method':_0xc8ad('0x1d'),'input_type':'JSON','response_type':_0xc8ad('0x1e'),'rest_data':JSON['stringify']({'session':_0x2efc7e['id'],'module_name':_0xc8ad('0x1f'),'name_value_list':_0x5149eb})}});}function getAuth(_0x369edf){return util[_0xc8ad('0x20')](_0xc8ad('0x21'),new Buffer(_0x369edf[_0xc8ad('0x22')]+':X')[_0xc8ad('0x23')]('base64'));}function getServerInfo(_0x3f4879){return request({'form':{'method':_0xc8ad('0x24'),'input_type':_0xc8ad('0x1e'),'response_type':_0xc8ad('0x1e'),'rest_data':JSON['stringify']({'session':_0x3f4879['id']})}});}function getUser(_0x333135,_0x187f45,_0x1d7319){logger[_0xc8ad('0xa')](_0xc8ad('0x25'),_0x187f45);return request({'form':{'method':_0xc8ad('0x26'),'input_type':_0xc8ad('0x1e'),'response_type':_0xc8ad('0x1e'),'rest_data':JSON[_0xc8ad('0x27')]({'session':_0x1d7319['id'],'module_name':'Employees','query':util['format'](_0xc8ad('0x28'),_0x187f45),'order_by':'','offset':'0','select_fields':['id',_0xc8ad('0xb'),_0xc8ad('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc8ad('0x2a')](function(_0x2f8533){if(_0x2f8533[_0xc8ad('0x2b')]['length']){var _0x41154f=_['find'](_0x2f8533[_0xc8ad('0x2b')],function(_0x279062){return _0x279062[_0xc8ad('0x2c')]['user_name']['value']===_0x187f45;});if(_0x41154f){logger[_0xc8ad('0xa')](_0xc8ad('0x2d'));return BPromise[_0xc8ad('0x2e')]({'id':_0x41154f[_0xc8ad('0x2c')]['id'][_0xc8ad('0x2f')],'name':_0x41154f[_0xc8ad('0x2c')]['name'][_0xc8ad('0x2f')]});}}else{logger[_0xc8ad('0xa')](_0xc8ad('0x30'));return BPromise[_0xc8ad('0x2e')]({'id':_0x1d7319[_0xc8ad('0x2c')][_0xc8ad('0x31')]['id'],'name':_0x1d7319[_0xc8ad('0x2c')]['user_name']['id']});}});}function getEndUser(_0x29fb93,_0x15f7f6,_0x8c3ae1,_0x1380d0){logger[_0xc8ad('0xa')](_0xc8ad('0x32'),_0x8c3ae1);return request({'form':{'method':'get_entry_list','input_type':_0xc8ad('0x1e'),'response_type':_0xc8ad('0x1e'),'rest_data':JSON[_0xc8ad('0x27')]({'session':_0x1380d0['id'],'module_name':_0xc8ad('0x17'),'query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x8c3ae1),'order_by':'','offset':'0','select_fields':['id',_0xc8ad('0xb'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc8ad('0x2a')](function(_0x5dbfe0){if(_0x5dbfe0[_0xc8ad('0x2b')]['length']){var _0x592056=_['find'](_0x5dbfe0[_0xc8ad('0x2b')],function(_0x29a71f){return _0x29a71f[_0xc8ad('0x2c')][_0xc8ad('0x33')][_0xc8ad('0x2f')]===_0x8c3ae1;});if(_0x592056){logger[_0xc8ad('0xa')]('Enduser\x20found!');return BPromise[_0xc8ad('0x2e')]({'id':_0x592056[_0xc8ad('0x2c')]['id'][_0xc8ad('0x2f')],'name':_0x592056[_0xc8ad('0x2c')]['name']['value'],'phone':_0x592056[_0xc8ad('0x2c')][_0xc8ad('0x33')][_0xc8ad('0x2f')]});}}else{logger['info'](_0xc8ad('0x34'));return request({'form':{'method':_0xc8ad('0x1d'),'input_type':'JSON','response_type':_0xc8ad('0x1e'),'rest_data':JSON['stringify']({'session':_0x1380d0['id'],'module_name':_0xc8ad('0x17'),'name_value_list':[{'name':_0xc8ad('0x35'),'value':_0x15f7f6!==_0xc8ad('0x36')?_0x15f7f6:util['format'](_0xc8ad('0x37'),_0x8c3ae1)},{'name':_0xc8ad('0x33'),'value':_0x8c3ae1}]})}})[_0xc8ad('0x2a')](function(_0x47ae1d){logger[_0xc8ad('0xa')](_0xc8ad('0x38'));return BPromise[_0xc8ad('0x2e')]({'id':_0x47ae1d['id'],'name':_0x47ae1d[_0xc8ad('0x2b')][_0xc8ad('0x35')][_0xc8ad('0x2f')],'phone':_0x47ae1d[_0xc8ad('0x2b')][_0xc8ad('0x33')][_0xc8ad('0x2f')]});});}});}function request(_0x247469){logger['debug']('[HTTP]',JSON[_0xc8ad('0x27')](_0x247469));return rp(_[_0xc8ad('0x39')](def,_0x247469));}function getTags(_0x47ee7e,_0x340e17){var _0x48d4ac=[];if(_0x47ee7e&&_0x47ee7e[_0xc8ad('0x19')]>0x0){_0x48d4ac=_[_0xc8ad('0x3a')](_0x47ee7e,_0x340e17);}return _0x48d4ac;}function getCustomFields(_0x4e6c8f,_0x36a36e){var _0x191978=[];var _0x56bcf9={'custom_fields':[]};if(_0x4e6c8f['length']>0x0){_[_0xc8ad('0x1a')](_0x4e6c8f,function(_0xe10130){if(_0xe10130['type']===_0xc8ad('0x3b')&&_0xe10130[_0xc8ad('0x3c')]&&!_0xe10130[_0xc8ad('0x3d')]){_0x56bcf9[_0xe10130[_0xc8ad('0x3c')][_0xc8ad('0x3e')]()]=_0xe10130[_0xc8ad('0x3f')][_0xc8ad('0x23')]();}else if(_0xe10130[_0xc8ad('0x40')]==='string'&&_0xe10130[_0xc8ad('0x41')]&&_0xe10130[_0xc8ad('0x3d')]){_0x56bcf9[_0xc8ad('0x42')][_0xc8ad('0x1c')]({'id':_0xe10130[_0xc8ad('0x41')],'value':_0xe10130[_0xc8ad('0x3f')][_0xc8ad('0x23')]()});}else if(_0xe10130[_0xc8ad('0x40')]===_0xc8ad('0x43')&&_0xe10130[_0xc8ad('0x1b')]&&_0xe10130[_0xc8ad('0x41')]&&_0xe10130[_0xc8ad('0x3d')]){_0x36a36e[_0xe10130[_0xc8ad('0x1b')]]&&_0x56bcf9[_0xc8ad('0x42')][_0xc8ad('0x1c')]({'id':_0xe10130['idField'],'value':_0x36a36e[_0xe10130['variableName']][_0xc8ad('0x23')]()});}else if(_0xe10130[_0xc8ad('0x40')]===_0xc8ad('0x44')&&_0xe10130[_0xc8ad('0x45')]&&_0xe10130[_0xc8ad('0x45')][_0xc8ad('0xb')]&&_0xe10130[_0xc8ad('0x41')]&&_0xe10130['customField']){_0x36a36e[_0xe10130['Variable'][_0xc8ad('0xb')][_0xc8ad('0x3e')]()]&&_0x56bcf9[_0xc8ad('0x42')][_0xc8ad('0x1c')]({'id':_0xe10130[_0xc8ad('0x41')],'value':_0x36a36e[_0xe10130[_0xc8ad('0x45')][_0xc8ad('0xb')]['toLowerCase']()][_0xc8ad('0x23')]()});}});}return _0x56bcf9;}function getConnection(_0x538660){return request({'method':_0xc8ad('0x8'),'form':{'method':_0xc8ad('0x46'),'input_type':_0xc8ad('0x1e'),'response_type':_0xc8ad('0x1e'),'rest_data':JSON[_0xc8ad('0x27')]({'user_auth':{'user_name':_0x538660[_0xc8ad('0x47')],'password':_0x538660['password'],'encryption':'PLAIN'},'application':_0xc8ad('0x48')})}})['then'](function(_0x54e865){var _0x37e2c9=_0x54e865;if(_0x37e2c9['id']){def[_0xc8ad('0x49')]=_0x37e2c9['id'];return BPromise[_0xc8ad('0x2e')](_0x37e2c9);}else{throw new Error(util[_0xc8ad('0x20')](_0xc8ad('0x4a'),_0x538660['id']));}});}function setRelationship(_0x3e67cd,_0x27c49a,_0x1f0f5f,_0x359f2c){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xc8ad('0x27')]({'session':_0x3e67cd['id'],'module_name':_0xc8ad('0x1f'),'module_id':_0x1f0f5f['id'],'link_field_name':_0x359f2c,'related_ids':[_0x27c49a['id']]})}});}exports[_0xc8ad('0x4b')]=function(_0x52a5a2,_0x3a9d3e,_0x2e2c7b,_0x26d58a,_0x1555b7,_0x252dc3){var _0x46f69b,_0x1f4be0,_0x5a65ae,_0x3c8c31;_0x252dc3[_0xc8ad('0x4c')]=intUtil[_0xc8ad('0x4d')](_0x252dc3['remoteUri']);_0x252dc3[_0xc8ad('0x4e')]=intUtil[_0xc8ad('0x4d')](_0x252dc3[_0xc8ad('0x4e')]);def[_0xc8ad('0x4f')]=util['format'](_0xc8ad('0x50'),_0x252dc3[_0xc8ad('0x4c')]);if(_0x1555b7&&_0x1555b7[_0xc8ad('0x51')]){logger[_0xc8ad('0xa')](_0xc8ad('0x52'),_0xc8ad('0x53'));_0x3a9d3e['recordingURL']=util[_0xc8ad('0x20')](_0xc8ad('0x54'),_0x252dc3[_0xc8ad('0x4e')],_0x3a9d3e[_0xc8ad('0x55')],md5(_0x3a9d3e['uniqueid']));}else{_0x3a9d3e[_0xc8ad('0x56')]='';}return getConnection(_0x252dc3)['then'](function(_0x181c12){_0x3c8c31=_0x181c12;return getUser(_0x252dc3,_0x26d58a[_0xc8ad('0xb')],_0x3c8c31);})['then'](function(_0x3e2357){_0x46f69b=_0x3e2357;logger[_0xc8ad('0xa')](_0xc8ad('0x57'),_0x46f69b['id']);return getEndUser(_0x252dc3,_0x3a9d3e[_0xc8ad('0x58')],_0x3a9d3e[_0xc8ad('0x59')],_0x3c8c31);})[_0xc8ad('0x2a')](function(_0x58bc57){_0x1f4be0=_0x58bc57;logger[_0xc8ad('0xa')](_0xc8ad('0x5a'),_0x1f4be0['id']);return getTicket(_0x252dc3,_0x46f69b,_0x1f4be0,_0x2e2c7b,_0x3a9d3e,_0x2e2c7b[_0xc8ad('0x5b')],_0x3c8c31);})[_0xc8ad('0x2a')](function(_0x4fb459){_0x5a65ae=_0x4fb459;logger['info']('Ticket\x20created!');logger['info'](_0xc8ad('0x5c'),_0x5a65ae['id']);return setRelationship(_0x3c8c31,_0x46f69b,_0x5a65ae,_0xc8ad('0x5d'));})[_0xc8ad('0x2a')](function(){return setRelationship(_0x3c8c31,_0x1f4be0,_0x5a65ae,_0xc8ad('0x5e'));})['then'](function(){return getServerInfo(_0x3c8c31);})[_0xc8ad('0x2a')](function(_0x294702){var _0x4f18cf=parseInt(_0x294702[_0xc8ad('0x5f')]['charAt'](0x0));var _0x50760=util['format'](_0xc8ad('0x60'),_0x252dc3[_0xc8ad('0x4c')],_0x5a65ae['id']);if(_0x4f18cf>0x6){_0x50760=util[_0xc8ad('0x20')](_0xc8ad('0x61'),_0x252dc3[_0xc8ad('0x4c')],_0x5a65ae['id']);}logger[_0xc8ad('0xa')](_0xc8ad('0x52'),_0xc8ad('0x62'));emit(util[_0xc8ad('0x20')]('user:%s',_0x26d58a['name']),_0xc8ad('0x63'),{'uri':_0x50760});})['catch'](function(_0x901c34){logger['error'](_0xc8ad('0x52'),JSON[_0xc8ad('0x27')](_0x901c34));});};exports['outbound']=function(_0x4350fb,_0x4bded3,_0x474da1,_0x498fda,_0x8048a9,_0x2b5b88,_0x384407){var _0x5cbe7a,_0x11e1bd,_0x4bc466,_0x55f570;_0x2b5b88[_0xc8ad('0x4c')]=intUtil['stripTrailingSlash'](_0x2b5b88['remoteUri']);_0x2b5b88[_0xc8ad('0x4e')]=intUtil[_0xc8ad('0x4d')](_0x2b5b88[_0xc8ad('0x4e')]);def['uri']=util['format'](_0xc8ad('0x50'),_0x2b5b88[_0xc8ad('0x4c')]);if(_0x384407&&_0x384407[_0xc8ad('0x64')]&&_0x384407[_0xc8ad('0x64')]!==_0xc8ad('0x65')){logger['info'](_0xc8ad('0x66'),_0xc8ad('0x53'));_0x4bded3[_0xc8ad('0x56')]=util['format'](_0xc8ad('0x54'),_0x2b5b88['serverUrl'],_0x4bded3[_0xc8ad('0x55')],md5(_0x4bded3[_0xc8ad('0x55')]));}return getConnection(_0x2b5b88)[_0xc8ad('0x2a')](function(_0x51f420){_0x55f570=_0x51f420;return getUser(_0x2b5b88,_0x498fda[_0xc8ad('0xb')],_0x55f570);})[_0xc8ad('0x2a')](function(_0x589534){_0x5cbe7a=_0x589534;logger[_0xc8ad('0xa')](_0xc8ad('0x57'),_0x5cbe7a['id']);return getEndUser(_0x2b5b88,_0x4bded3['destcalleridname'],_0x4bded3[_0xc8ad('0x67')],_0x55f570);})['then'](function(_0x5d0218){_0x11e1bd=_0x5d0218;logger[_0xc8ad('0xa')](_0xc8ad('0x5a'),_0x11e1bd['id']);return getTicket(_0x2b5b88,_0x5cbe7a,_0x11e1bd,_0x474da1,_0x4bded3,_0x474da1[_0xc8ad('0x5b')],_0x55f570);})[_0xc8ad('0x2a')](function(_0x26c25f){_0x4bc466=_0x26c25f;logger[_0xc8ad('0xa')](_0xc8ad('0x68'));logger[_0xc8ad('0xa')]('The\x20Ticket\x20ID\x20is:',_0x4bc466['id']);return setRelationship(_0x55f570,_0x5cbe7a,_0x4bc466,_0xc8ad('0x5d'));})[_0xc8ad('0x2a')](function(){return setRelationship(_0x55f570,_0x11e1bd,_0x4bc466,_0xc8ad('0x5e'));})[_0xc8ad('0x2a')](function(){return getServerInfo(_0x55f570);})[_0xc8ad('0x2a')](function(_0x4892e6){var _0x32a0e4=parseInt(_0x4892e6[_0xc8ad('0x5f')][_0xc8ad('0x69')](0x0));var _0x2d7077=util[_0xc8ad('0x20')](_0xc8ad('0x60'),_0x2b5b88['remoteUri'],_0x4bc466['id']);if(_0x32a0e4>0x6){_0x2d7077=util[_0xc8ad('0x20')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x2b5b88['remoteUri'],_0x4bc466['id']);}logger['info'](_0xc8ad('0x66'),_0xc8ad('0x62'));emit(util[_0xc8ad('0x20')]('user:%s',_0x498fda['name']),_0xc8ad('0x63'),{'uri':_0x2d7077});})[_0xc8ad('0x6a')](function(_0x973035){logger[_0xc8ad('0x6b')]('[OUTBOUND]',JSON[_0xc8ad('0x27')](_0x973035));});};exports['abandoned']=function(_0x228b9f,_0x2f7529,_0x4c33ff,_0x2ff8c8,_0x187802,_0x2166e8){var _0x4c6822,_0x59e6a2,_0x5bd9cc,_0x592cdc;_0x2166e8[_0xc8ad('0x4c')]=intUtil[_0xc8ad('0x4d')](_0x2166e8['remoteUri']);_0x2166e8[_0xc8ad('0x4e')]=intUtil[_0xc8ad('0x4d')](_0x2166e8[_0xc8ad('0x4e')]);def[_0xc8ad('0x4f')]=util[_0xc8ad('0x20')](_0xc8ad('0x50'),_0x2166e8[_0xc8ad('0x4c')]);if(_0x187802&&_0x187802[_0xc8ad('0x51')]){logger['info'](_0xc8ad('0x6c'),'Recording\x20is\x20enabled!');_0x2f7529[_0xc8ad('0x56')]=util[_0xc8ad('0x20')](_0xc8ad('0x54'),_0x2166e8['serverUrl'],_0x2f7529[_0xc8ad('0x55')],md5(_0x2f7529[_0xc8ad('0x55')]));}else{_0x2f7529['recordingURL']='';}return getConnection(_0x2166e8)['then'](function(_0x1e74e7){_0x592cdc=_0x1e74e7;return getUser(_0x2166e8,_0x2ff8c8[_0xc8ad('0xb')],_0x592cdc);})[_0xc8ad('0x2a')](function(_0xa83918){_0x4c6822=_0xa83918;logger['info'](_0xc8ad('0x57'),_0x4c6822['id']);return getEndUser(_0x2166e8,_0x2f7529[_0xc8ad('0x58')],_0x2f7529[_0xc8ad('0x59')],_0x592cdc);})[_0xc8ad('0x2a')](function(_0x488ba1){_0x59e6a2=_0x488ba1;logger[_0xc8ad('0xa')](_0xc8ad('0x5a'),_0x59e6a2['id']);return getTicket(_0x2166e8,_0x4c6822,_0x59e6a2,_0x4c33ff,_0x2f7529,_0x4c33ff[_0xc8ad('0x5b')],_0x592cdc);})[_0xc8ad('0x2a')](function(_0x196d21){_0x5bd9cc=_0x196d21;logger[_0xc8ad('0xa')](_0xc8ad('0x68'));logger[_0xc8ad('0xa')](_0xc8ad('0x5c'),_0x5bd9cc['id']);return setRelationship(_0x592cdc,_0x4c6822,_0x5bd9cc,_0xc8ad('0x5d'));})[_0xc8ad('0x2a')](function(){return setRelationship(_0x592cdc,_0x59e6a2,_0x5bd9cc,'contacts');})[_0xc8ad('0x2a')](function(){return getServerInfo(_0x592cdc);})[_0xc8ad('0x6a')](function(_0x5b4137){logger[_0xc8ad('0x6b')](_0xc8ad('0x6c'),JSON[_0xc8ad('0x27')](_0x5b4137));});}; \ 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 8e3957e..930b0f1 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 _0xa808=['getString','length','string','push','content','type','variableName','toString','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s','keyContent','variable','join','stripTrailingSlash','substr','util'];(function(_0x500a5f,_0x4faed2){var _0x27b165=function(_0x214bfc){while(--_0x214bfc){_0x500a5f['push'](_0x500a5f['shift']());}};_0x27b165(++_0x4faed2);}(_0xa808,0x68));var _0x8a80=function(_0x11c4b2,_0x376cde){_0x11c4b2=_0x11c4b2-0x0;var _0x412959=_0xa808[_0x11c4b2];return _0x412959;};'use strict';var _=require('lodash');var util=require(_0x8a80('0x0'));exports[_0x8a80('0x1')]=function(_0x1a8deb,_0x50bf2a,_0x2a6926){var _0x478301=[];if(_0x1a8deb[_0x8a80('0x2')]>0x0){var _0x41ab6c=_['sortBy'](_0x1a8deb,['id']);for(var _0x23ff1d=0x0;_0x23ff1d<_0x41ab6c[_0x8a80('0x2')];_0x23ff1d++){var _0x3c9372=_0x41ab6c[_0x23ff1d];if(_0x3c9372['type']===_0x8a80('0x3')){_0x478301[_0x8a80('0x4')](_0x3c9372[_0x8a80('0x5')]);}else if(_0x3c9372[_0x8a80('0x6')]==='variable'&&_0x3c9372[_0x8a80('0x7')]){_0x50bf2a[_0x3c9372[_0x8a80('0x7')]]&&_0x478301[_0x8a80('0x4')](_0x50bf2a[_0x3c9372[_0x8a80('0x7')]][_0x8a80('0x8')]());}else if(_0x3c9372[_0x8a80('0x6')]==='customVariable'&&_0x3c9372[_0x8a80('0x9')]&&_0x3c9372[_0x8a80('0x9')][_0x8a80('0xa')]){_0x50bf2a[_0x3c9372['Variable']['name'][_0x8a80('0xb')]()]&&_0x478301[_0x8a80('0x4')](_0x50bf2a[_0x3c9372[_0x8a80('0x9')][_0x8a80('0xa')][_0x8a80('0xb')]()][_0x8a80('0x8')]());}else if(_0x3c9372['type']==='keyValue'){if(_0x3c9372[_0x8a80('0xc')]===_0x8a80('0x3')&&_0x3c9372[_0x8a80('0xd')]){_0x478301['push'](util[_0x8a80('0xe')](_0x8a80('0xf'),_0x3c9372[_0x8a80('0xd')],_0x3c9372[_0x8a80('0x10')]));}else if(_0x3c9372['keyType']===_0x8a80('0x11')&&_0x3c9372[_0x8a80('0x7')]&&_0x3c9372['key']){_0x50bf2a[_0x3c9372['variableName']]&&_0x478301[_0x8a80('0x4')](util[_0x8a80('0xe')](_0x8a80('0xf'),_0x3c9372['key'],_0x50bf2a[_0x3c9372[_0x8a80('0x7')]]));}else if(_0x3c9372['keyType']==='customVariable'&&_0x3c9372['Variable']&&_0x3c9372[_0x8a80('0x9')]['name']&&_0x3c9372[_0x8a80('0xd')]){_0x50bf2a[_0x3c9372[_0x8a80('0x9')][_0x8a80('0xa')][_0x8a80('0xb')]()]&&_0x478301[_0x8a80('0x4')](util['format']('%s:\x20%s',_0x3c9372['key'],_0x50bf2a[_0x3c9372[_0x8a80('0x9')][_0x8a80('0xa')][_0x8a80('0xb')]()]));}}}}return _0x478301[_0x8a80('0x12')](_0x2a6926);};exports[_0x8a80('0x13')]=function(_0x4bfbef){if(_0x4bfbef&&_0x4bfbef[_0x8a80('0x14')](-0x1)==='/'){return _0x4bfbef[_0x8a80('0x14')](0x0,_0x4bfbef[_0x8a80('0x2')]-0x1);}return _0x4bfbef;}; \ No newline at end of file +var _0xc4c2=['name','toLowerCase','toString','keyValue','keyType','key','format','keyContent','%s:\x20%s','customVariable','join','substr','lodash','util','length','sortBy','type','string','push','content','variable','variableName','Variable'];(function(_0x1df503,_0x581379){var _0x26539a=function(_0x3993c8){while(--_0x3993c8){_0x1df503['push'](_0x1df503['shift']());}};_0x26539a(++_0x581379);}(_0xc4c2,0x7f));var _0x2c4c=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xc4c2[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require(_0x2c4c('0x0'));var util=require(_0x2c4c('0x1'));exports['getString']=function(_0xe216ae,_0x3708c2,_0x267068){var _0x1554cd=[];if(_0xe216ae[_0x2c4c('0x2')]>0x0){var _0x5ab540=_[_0x2c4c('0x3')](_0xe216ae,['id']);for(var _0x220eb3=0x0;_0x220eb3<_0x5ab540['length'];_0x220eb3++){var _0x1d11ce=_0x5ab540[_0x220eb3];if(_0x1d11ce[_0x2c4c('0x4')]===_0x2c4c('0x5')){_0x1554cd[_0x2c4c('0x6')](_0x1d11ce[_0x2c4c('0x7')]);}else if(_0x1d11ce['type']===_0x2c4c('0x8')&&_0x1d11ce[_0x2c4c('0x9')]){_0x3708c2[_0x1d11ce['variableName']]&&_0x1554cd[_0x2c4c('0x6')](_0x3708c2[_0x1d11ce[_0x2c4c('0x9')]]['toString']());}else if(_0x1d11ce['type']==='customVariable'&&_0x1d11ce[_0x2c4c('0xa')]&&_0x1d11ce['Variable'][_0x2c4c('0xb')]){_0x3708c2[_0x1d11ce[_0x2c4c('0xa')]['name'][_0x2c4c('0xc')]()]&&_0x1554cd[_0x2c4c('0x6')](_0x3708c2[_0x1d11ce[_0x2c4c('0xa')][_0x2c4c('0xb')]['toLowerCase']()][_0x2c4c('0xd')]());}else if(_0x1d11ce[_0x2c4c('0x4')]===_0x2c4c('0xe')){if(_0x1d11ce[_0x2c4c('0xf')]==='string'&&_0x1d11ce[_0x2c4c('0x10')]){_0x1554cd[_0x2c4c('0x6')](util[_0x2c4c('0x11')]('%s:\x20%s',_0x1d11ce[_0x2c4c('0x10')],_0x1d11ce[_0x2c4c('0x12')]));}else if(_0x1d11ce[_0x2c4c('0xf')]==='variable'&&_0x1d11ce['variableName']&&_0x1d11ce['key']){_0x3708c2[_0x1d11ce[_0x2c4c('0x9')]]&&_0x1554cd['push'](util[_0x2c4c('0x11')](_0x2c4c('0x13'),_0x1d11ce[_0x2c4c('0x10')],_0x3708c2[_0x1d11ce[_0x2c4c('0x9')]]));}else if(_0x1d11ce['keyType']===_0x2c4c('0x14')&&_0x1d11ce[_0x2c4c('0xa')]&&_0x1d11ce[_0x2c4c('0xa')][_0x2c4c('0xb')]&&_0x1d11ce[_0x2c4c('0x10')]){_0x3708c2[_0x1d11ce[_0x2c4c('0xa')]['name'][_0x2c4c('0xc')]()]&&_0x1554cd[_0x2c4c('0x6')](util[_0x2c4c('0x11')](_0x2c4c('0x13'),_0x1d11ce['key'],_0x3708c2[_0x1d11ce[_0x2c4c('0xa')][_0x2c4c('0xb')][_0x2c4c('0xc')]()]));}}}}return _0x1554cd[_0x2c4c('0x15')](_0x267068);};exports['stripTrailingSlash']=function(_0x503483){if(_0x503483&&_0x503483[_0x2c4c('0x16')](-0x1)==='/'){return _0x503483[_0x2c4c('0x16')](0x0,_0x503483[_0x2c4c('0x2')]-0x1);}return _0x503483;}; \ 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 820d9d2..beefe96 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 _0x8a85=['localhost','emit','length','forEach','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','Descriptions','%s/webservice.php','remoteUri','create','admin','sessionName','stringify','then','success','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','test','[vTiger],\x20%s,\x20%s,\x20%s','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','email1','first_name','last_name','userId','username','catch','getUser','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Contacts','Enduser\x20created.','phone','statusCode','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','abandoned','[ABANDONED]','lodash','request-promise','bluebird','md5','util','./util','../../../../config/logger','vTiger','socket.io-emitter'];(function(_0x45cf22,_0x5e7983){var _0x3018a0=function(_0x2eb6bf){while(--_0x2eb6bf){_0x45cf22['push'](_0x45cf22['shift']());}};_0x3018a0(++_0x5e7983);}(_0x8a85,0x18f));var _0x58a8=function(_0x49d156,_0x7fc02a){_0x49d156=_0x49d156-0x0;var _0x2b564f=_0x8a85[_0x49d156];return _0x2b564f;};'use strict';var _=require(_0x58a8('0x0'));var rp=require(_0x58a8('0x1'));var BPromise=require(_0x58a8('0x2'));var md5=require(_0x58a8('0x3'));var util=require(_0x58a8('0x4'));var intUtil=require(_0x58a8('0x5'));var logger=require(_0x58a8('0x6'))(_0x58a8('0x7'));var io=require(_0x58a8('0x8'))({'host':_0x58a8('0x9'),'port':0x18eb});function emit(_0x4ecde4,_0x136546,_0x5ece1d){io['to'](_0x4ecde4)[_0x58a8('0xa')](_0x136546,_0x5ece1d);}function getCustomFields(_0x400d67,_0x30c2ad){var _0x3eded9={};if(_0x400d67[_0x58a8('0xb')]>0x0){_[_0x58a8('0xc')](_0x400d67,function(_0x42c223){if(_0x42c223['type']===_0x58a8('0xd')&&_0x42c223[_0x58a8('0xe')]){_0x3eded9[_0x42c223[_0x58a8('0xe')]]=_0x42c223[_0x58a8('0xf')][_0x58a8('0x10')]();}else if(_0x42c223['type']===_0x58a8('0x11')&&_0x42c223[_0x58a8('0x12')]&&_0x42c223[_0x58a8('0xe')]&&_0x30c2ad[_0x42c223['variableName']]){_0x3eded9[_0x42c223[_0x58a8('0xe')]]=_0x30c2ad[_0x42c223[_0x58a8('0x12')]][_0x58a8('0x10')]();}else if(_0x42c223['type']===_0x58a8('0x13')&&_0x42c223[_0x58a8('0x14')]&&_0x42c223['Variable']['name']&&_0x42c223['idField']&&_0x30c2ad[_0x42c223[_0x58a8('0x14')][_0x58a8('0x15')][_0x58a8('0x16')]()]){_0x3eded9[_0x42c223[_0x58a8('0xe')]]=_0x30c2ad[_0x42c223[_0x58a8('0x14')][_0x58a8('0x15')][_0x58a8('0x16')]()][_0x58a8('0x10')]();}});}return _0x3eded9;}function createTicket(_0xe55667,_0x36d96b,_0x1ba4d8,_0x10f6d0,_0x2277e9,_0x4f0d39,_0x1bab46){logger[_0x58a8('0x17')](_0x58a8('0x18'));var _0x141dab=_[_0x58a8('0x19')]({'parent_id':'','assigned_user_id':_0x36d96b['id'],'ticketpriorities':_0x58a8('0x1a'),'ticketstatus':_0x58a8('0x1b'),'ticket_title':intUtil[_0x58a8('0x1c')](_0x10f6d0[_0x58a8('0x1d')],_0x2277e9,'\x20'),'description':intUtil[_0x58a8('0x1c')](_0x10f6d0[_0x58a8('0x1e')],_0x2277e9,'\x0a'),'contact_id':_0x1ba4d8['id']},getCustomFields(_0x4f0d39,_0x2277e9));var _0x4e59ea={'method':'POST','uri':util['format'](_0x58a8('0x1f'),_0xe55667[_0x58a8('0x20')]),'form':{'operation':_0x58a8('0x21'),'username':_0x58a8('0x22'),'sessionName':_0x1bab46[_0x58a8('0x23')],'elementType':'HelpDesk','element':JSON[_0x58a8('0x24')](_0x141dab)},'json':!![]};return request(_0x4e59ea)[_0x58a8('0x25')](function(_0x5a858e){if(_0x5a858e[_0x58a8('0x26')]){return BPromise[_0x58a8('0x27')]({'id':_0x5a858e[_0x58a8('0x28')]['id']});}else{throw new Error(util[_0x58a8('0x29')](_0x58a8('0x2a'),JSON[_0x58a8('0x24')](_0x5a858e[_0x58a8('0x2b')])));}})['catch'](function(_0x2c2cb8){var _0xe26a1f=req['query'][_0x58a8('0x2c')]?0x1f4:_0x2c2cb8['statusCode']||0x1f4;logger['error'](_0x58a8('0x2d'),'createTicket',_0xe26a1f,JSON[_0x58a8('0x24')](_0x2c2cb8));});}function getUser(_0x5b8815,_0x511404,_0x4b33e4){logger[_0x58a8('0x17')](_0x58a8('0x2e'),_0x511404);return request({'method':_0x58a8('0x2f'),'uri':util['format']('%s/webservice.php',_0x5b8815[_0x58a8('0x20')]),'qs':{'operation':_0x58a8('0x30'),'username':_0x58a8('0x22'),'sessionName':_0x4b33e4[_0x58a8('0x23')],'query':util['format'](_0x58a8('0x31'),_0x511404)},'json':!![]})[_0x58a8('0x25')](function(_0x5a71a4){if(_0x5a71a4[_0x58a8('0x26')]&&_0x5a71a4['result'][_0x58a8('0xb')]){logger[_0x58a8('0x17')]('Agent\x20found!');return BPromise[_0x58a8('0x27')]({'id':_0x5a71a4[_0x58a8('0x28')][0x0]['id'],'email':_0x5a71a4[_0x58a8('0x28')][0x0][_0x58a8('0x32')],'name':_0x5a71a4['result'][0x0][_0x58a8('0x33')]+'\x20'+_0x5a71a4[_0x58a8('0x28')][_0x58a8('0x34')]});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x58a8('0x27')]({'id':_0x4b33e4[_0x58a8('0x35')],'email':_0x5b8815[_0x58a8('0x36')],'name':_0x58a8('0x22')});}})[_0x58a8('0x37')](function(_0x4378f8){var _0x47dee2=req[_0x58a8('0x30')][_0x58a8('0x2c')]?0x1f4:_0x4378f8['statusCode']||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0x58a8('0x38'),_0x47dee2,JSON[_0x58a8('0x24')](_0x4378f8));});}function getEndUser(_0x5e500a,_0x1e681f,_0x465e9d,_0x439881){logger[_0x58a8('0x17')](_0x58a8('0x39'),_0x465e9d);return request({'method':'GET','uri':util[_0x58a8('0x29')](_0x58a8('0x1f'),_0x5e500a['remoteUri']),'qs':{'operation':_0x58a8('0x30'),'username':_0x58a8('0x22'),'sessionName':_0x439881[_0x58a8('0x23')],'query':util[_0x58a8('0x29')](_0x58a8('0x3a'),_0x465e9d,_0x465e9d,_0x465e9d,_0x465e9d,_0x465e9d)},'json':!![]})[_0x58a8('0x25')](function(_0x493f65){if(_0x493f65[_0x58a8('0x26')]&&_0x493f65[_0x58a8('0x28')][_0x58a8('0xb')]){logger[_0x58a8('0x17')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x493f65[_0x58a8('0x28')][0x0]['id'],'name':_0x493f65[_0x58a8('0x28')][0x0][_0x58a8('0x3b')]+'\x20'+_0x493f65[_0x58a8('0x28')][0x0][_0x58a8('0x3c')],'phone':_0x465e9d});}else{logger[_0x58a8('0x17')](_0x58a8('0x3d'));return request({'method':_0x58a8('0x3e'),'uri':util[_0x58a8('0x29')]('%s/webservice.php',_0x5e500a[_0x58a8('0x20')]),'form':{'operation':_0x58a8('0x21'),'sessionName':_0x439881['sessionName'],'elementType':_0x58a8('0x3f'),'element':JSON[_0x58a8('0x24')]({'lastname':_0x1e681f,'phone':_0x465e9d,'assigned_user_id':'\x20'})},'json':!![]})[_0x58a8('0x25')](function(_0xeef28c){logger[_0x58a8('0x17')](_0x58a8('0x40'));return BPromise[_0x58a8('0x27')]({'id':_0xeef28c['result']['id'],'name':_0xeef28c[_0x58a8('0x28')][_0x58a8('0x3c')],'phone':_0xeef28c[_0x58a8('0x28')][_0x58a8('0x41')]});})[_0x58a8('0x37')](function(_0x3f790d){var _0x2cc3f1=req[_0x58a8('0x30')][_0x58a8('0x2c')]?0x1f4:_0x3f790d[_0x58a8('0x42')]||0x1f4;logger[_0x58a8('0x2b')](_0x58a8('0x2d'),_0x58a8('0x43'),_0x2cc3f1,JSON[_0x58a8('0x24')](_0x3f790d));});}});}function getConnection(_0x237e57){var _0xb3a0ed=_0x237e57['username'];var _0xc0c5aa=_0x237e57[_0x58a8('0x44')];return request({'method':'GET','uri':util[_0x58a8('0x29')](_0x58a8('0x1f'),_0x237e57['remoteUri']),'qs':{'operation':'getchallenge','username':_0xb3a0ed},'json':!![]})[_0x58a8('0x25')](function(_0x30c81d){if(_0x30c81d[_0x58a8('0x26')]){return request({'method':_0x58a8('0x3e'),'uri':util[_0x58a8('0x29')](_0x58a8('0x1f'),_0x237e57[_0x58a8('0x20')]),'form':{'operation':_0x58a8('0x45'),'username':_0x58a8('0x22'),'accessKey':md5(_0x30c81d[_0x58a8('0x28')]['token']+_0xc0c5aa)},'json':!![]});}})[_0x58a8('0x25')](function(_0x42699c){if(_0x42699c[_0x58a8('0x26')]){return BPromise[_0x58a8('0x27')](_0x42699c[_0x58a8('0x28')]);}else{throw new Error(util['format'](_0x58a8('0x46'),_0x237e57['id']));}})[_0x58a8('0x37')](function(_0x96d5c1){var _0x2bac07=req['query']['test']?0x1f4:_0x96d5c1['statusCode']||0x1f4;logger[_0x58a8('0x2b')](_0x58a8('0x2d'),_0x58a8('0x47'),_0x2bac07,JSON[_0x58a8('0x24')](_0x96d5c1));});}function request(_0x120643){logger['info']('[HTTP]',JSON[_0x58a8('0x24')](_0x120643));return rp(_0x120643);}exports[_0x58a8('0x48')]=function(_0x506f6c,_0x503a5a,_0x1514f9,_0x1637cc,_0x1cf334,_0x3f0e26){var _0x4b14a5,_0xbca446,_0xc52c69,_0x4a7cc2;_0x3f0e26['remoteUri']=intUtil[_0x58a8('0x49')](_0x3f0e26[_0x58a8('0x20')]);if(_0x1cf334&&_0x1cf334[_0x58a8('0x4a')]){logger[_0x58a8('0x17')]('[QUEUE]',_0x58a8('0x4b'));_0x503a5a['recordingURL']=util[_0x58a8('0x29')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3f0e26[_0x58a8('0x4c')],_0x503a5a[_0x58a8('0x4d')],md5(_0x503a5a[_0x58a8('0x4d')]));}else{_0x503a5a[_0x58a8('0x4e')]='';}return getConnection(_0x3f0e26)[_0x58a8('0x25')](function(_0x179e14){_0x4a7cc2=_0x179e14;return getUser(_0x3f0e26,_0x1637cc?_0x1637cc[_0x58a8('0x4f')]:'',_0x4a7cc2);})[_0x58a8('0x25')](function(_0x1f0a76){_0x4b14a5=_0x1f0a76;logger[_0x58a8('0x17')](_0x58a8('0x50'),_0x4b14a5['id']);return getEndUser(_0x3f0e26,_0x503a5a[_0x58a8('0x51')],_0x503a5a[_0x58a8('0x52')],_0x4a7cc2);})['then'](function(_0x42e03c){_0xbca446=_0x42e03c;logger[_0x58a8('0x17')]('The\x20Enduser\x20ID\x20is:',_0xbca446['id']);return createTicket(_0x3f0e26,_0x4b14a5,_0xbca446,_0x1514f9,_0x503a5a,_0x1514f9[_0x58a8('0x53')],_0x4a7cc2);})[_0x58a8('0x25')](function(_0x5b49a5){_0xc52c69=_0x5b49a5;logger[_0x58a8('0x17')](_0x58a8('0x54'));logger[_0x58a8('0x17')](_0x58a8('0x55'),_0xc52c69['id']);var _0x20db16=util[_0x58a8('0x29')](_0x58a8('0x56'),_0x3f0e26[_0x58a8('0x20')],_['split'](_0xc52c69['id'],'x')[0x1]);logger['info'](_0x58a8('0x57'),_0x58a8('0x58'));emit(util[_0x58a8('0x29')](_0x58a8('0x59'),_0x1637cc[_0x58a8('0x15')]),_0x58a8('0x5a'),{'uri':_0x20db16});})[_0x58a8('0x37')](function(_0xd9755c){logger['error'](_0x58a8('0x57'),JSON[_0x58a8('0x24')](_0xd9755c));});};exports[_0x58a8('0x5b')]=function(_0x1495f8,_0x486f59,_0x2a5c5b,_0x213d69,_0x26dbbd,_0xc780e3,_0x5394ba){var _0x8debfd,_0x3baf45,_0x12014d,_0x2dd2b9;_0xc780e3[_0x58a8('0x20')]=intUtil['stripTrailingSlash'](_0xc780e3[_0x58a8('0x20')]);_0xc780e3[_0x58a8('0x4c')]=intUtil[_0x58a8('0x49')](_0xc780e3[_0x58a8('0x4c')]);if(_0x5394ba&&_0x5394ba[_0x58a8('0x5c')]&&_0x5394ba[_0x58a8('0x5c')]!==_0x58a8('0x5d')){logger[_0x58a8('0x17')](_0x58a8('0x5e'),_0x58a8('0x4b'));_0x486f59[_0x58a8('0x4e')]=util['format'](_0x58a8('0x5f'),_0xc780e3[_0x58a8('0x4c')],_0x486f59['uniqueid'],md5(_0x486f59[_0x58a8('0x4d')]));}return getConnection(_0xc780e3)[_0x58a8('0x25')](function(_0x27cd06){_0x2dd2b9=_0x27cd06;return getUser(_0xc780e3,_0x213d69?_0x213d69['email']:'',_0x2dd2b9);})['then'](function(_0x30b52a){_0x8debfd=_0x30b52a;logger[_0x58a8('0x17')]('The\x20User\x20ID\x20is:',_0x8debfd['id']);return getEndUser(_0xc780e3,_0x486f59[_0x58a8('0x60')],_0x486f59[_0x58a8('0x61')],_0x2dd2b9);})[_0x58a8('0x25')](function(_0x5f5678){_0x3baf45=_0x5f5678;logger[_0x58a8('0x17')](_0x58a8('0x62'),_0x3baf45['id']);return createTicket(_0xc780e3,_0x8debfd,_0x3baf45,_0x2a5c5b,_0x486f59,_0x2a5c5b[_0x58a8('0x53')],_0x2dd2b9);})[_0x58a8('0x25')](function(_0xfdcb8c){_0x12014d=_0xfdcb8c;logger[_0x58a8('0x17')](_0x58a8('0x54'));logger['info'](_0x58a8('0x55'),_0x12014d['id']);var _0xca4830=util[_0x58a8('0x29')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0xc780e3['remoteUri'],_[_0x58a8('0x63')](_0x12014d['id'],'x')[0x1]);logger[_0x58a8('0x17')](_0x58a8('0x5e'),_0x58a8('0x58'));emit(util[_0x58a8('0x29')](_0x58a8('0x59'),_0x213d69[_0x58a8('0x15')]),_0x58a8('0x5a'),{'uri':_0xca4830});})[_0x58a8('0x37')](function(_0x4803aa){logger['error']('[OUTBOUND]',JSON[_0x58a8('0x24')](_0x4803aa));});};exports[_0x58a8('0x64')]=function(_0x2803cf,_0x40e3d0,_0x25ff28,_0x17dbc0,_0x586c10,_0x4565c1){var _0x4cce0e,_0x4c6ca6,_0x198726,_0x40eead;_0x4565c1[_0x58a8('0x20')]=intUtil[_0x58a8('0x49')](_0x4565c1['remoteUri']);_0x4565c1[_0x58a8('0x4c')]=intUtil['stripTrailingSlash'](_0x4565c1[_0x58a8('0x4c')]);if(_0x586c10&&_0x586c10[_0x58a8('0x4a')]){logger[_0x58a8('0x17')]('[ABANDONED]',_0x58a8('0x4b'));_0x40e3d0[_0x58a8('0x4e')]=util['format'](_0x58a8('0x5f'),_0x4565c1[_0x58a8('0x4c')],_0x40e3d0['uniqueid'],md5(_0x40e3d0[_0x58a8('0x4d')]));}else{_0x40e3d0[_0x58a8('0x4e')]='';}return getConnection(_0x4565c1)['then'](function(_0x16f681){_0x40eead=_0x16f681;return getUser(_0x4565c1,_0x17dbc0?_0x17dbc0[_0x58a8('0x4f')]:'',_0x40eead);})[_0x58a8('0x25')](function(_0x34c59b){_0x4cce0e=_0x34c59b;logger[_0x58a8('0x17')](_0x58a8('0x50'),_0x4cce0e['id']);return getEndUser(_0x4565c1,_0x40e3d0['calleridname'],_0x40e3d0[_0x58a8('0x52')],_0x40eead);})[_0x58a8('0x25')](function(_0x550850){_0x4c6ca6=_0x550850;logger['info'](_0x58a8('0x62'),_0x4c6ca6['id']);return createTicket(_0x4565c1,_0x4cce0e,_0x4c6ca6,_0x25ff28,_0x40e3d0,_0x25ff28[_0x58a8('0x53')],_0x40eead);})['then'](function(_0x1a5f75){_0x198726=_0x1a5f75;logger[_0x58a8('0x17')](_0x58a8('0x54'));logger['info'](_0x58a8('0x55'),_0x198726['id']);})['catch'](function(_0x39de96){logger[_0x58a8('0x2b')](_0x58a8('0x65'),JSON['stringify'](_0x39de96));});}; \ No newline at end of file +var _0x7109=['Recording\x20is\x20enabled!','destcalleridname','Fields','split','abandoned','[ABANDONED]','lodash','bluebird','util','./util','vTiger','localhost','length','forEach','string','idField','content','toString','type','variableName','customVariable','Variable','toLowerCase','info','Creating\x20new\x20ticket...','getString','Subjects','format','remoteUri','create','admin','sessionName','HelpDesk','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','test','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','email1','first_name','last_name','userId','username','catch','getUser','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','phone','getEndUser','token','queue','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','name','trigger:browser:url','stripTrailingSlash','recordingFormat','none','[OUTBOUND]'];(function(_0x1060c0,_0x46c750){var _0x481362=function(_0x8a30db){while(--_0x8a30db){_0x1060c0['push'](_0x1060c0['shift']());}};_0x481362(++_0x46c750);}(_0x7109,0xb8));var _0x9710=function(_0x20ebb5,_0x237d88){_0x20ebb5=_0x20ebb5-0x0;var _0x487182=_0x7109[_0x20ebb5];return _0x487182;};'use strict';var _=require(_0x9710('0x0'));var rp=require('request-promise');var BPromise=require(_0x9710('0x1'));var md5=require('md5');var util=require(_0x9710('0x2'));var intUtil=require(_0x9710('0x3'));var logger=require('../../../../config/logger')(_0x9710('0x4'));var io=require('socket.io-emitter')({'host':_0x9710('0x5'),'port':0x18eb});function emit(_0x291803,_0x58555f,_0xbe0bfd){io['to'](_0x291803)['emit'](_0x58555f,_0xbe0bfd);}function getCustomFields(_0x278153,_0x39c780){var _0x191d17={};if(_0x278153[_0x9710('0x6')]>0x0){_[_0x9710('0x7')](_0x278153,function(_0x425405){if(_0x425405['type']===_0x9710('0x8')&&_0x425405[_0x9710('0x9')]){_0x191d17[_0x425405[_0x9710('0x9')]]=_0x425405[_0x9710('0xa')][_0x9710('0xb')]();}else if(_0x425405[_0x9710('0xc')]==='variable'&&_0x425405[_0x9710('0xd')]&&_0x425405[_0x9710('0x9')]&&_0x39c780[_0x425405[_0x9710('0xd')]]){_0x191d17[_0x425405[_0x9710('0x9')]]=_0x39c780[_0x425405[_0x9710('0xd')]]['toString']();}else if(_0x425405[_0x9710('0xc')]===_0x9710('0xe')&&_0x425405[_0x9710('0xf')]&&_0x425405[_0x9710('0xf')]['name']&&_0x425405[_0x9710('0x9')]&&_0x39c780[_0x425405[_0x9710('0xf')]['name'][_0x9710('0x10')]()]){_0x191d17[_0x425405[_0x9710('0x9')]]=_0x39c780[_0x425405['Variable']['name']['toLowerCase']()][_0x9710('0xb')]();}});}return _0x191d17;}function createTicket(_0x30845a,_0x59dd85,_0x147178,_0x558f8a,_0x45ab33,_0x3b4707,_0x42d7cd){logger[_0x9710('0x11')](_0x9710('0x12'));var _0x15357c=_['merge']({'parent_id':'','assigned_user_id':_0x59dd85['id'],'ticketpriorities':'Normal','ticketstatus':'Open','ticket_title':intUtil[_0x9710('0x13')](_0x558f8a[_0x9710('0x14')],_0x45ab33,'\x20'),'description':intUtil[_0x9710('0x13')](_0x558f8a['Descriptions'],_0x45ab33,'\x0a'),'contact_id':_0x147178['id']},getCustomFields(_0x3b4707,_0x45ab33));var _0x156a90={'method':'POST','uri':util[_0x9710('0x15')]('%s/webservice.php',_0x30845a[_0x9710('0x16')]),'form':{'operation':_0x9710('0x17'),'username':_0x9710('0x18'),'sessionName':_0x42d7cd[_0x9710('0x19')],'elementType':_0x9710('0x1a'),'element':JSON[_0x9710('0x1b')](_0x15357c)},'json':!![]};return request(_0x156a90)[_0x9710('0x1c')](function(_0x4abf32){if(_0x4abf32[_0x9710('0x1d')]){return BPromise[_0x9710('0x1e')]({'id':_0x4abf32[_0x9710('0x1f')]['id']});}else{throw new Error(util[_0x9710('0x15')](_0x9710('0x20'),JSON[_0x9710('0x1b')](_0x4abf32[_0x9710('0x21')])));}})['catch'](function(_0xc35ec1){var _0x53a700=req['query'][_0x9710('0x22')]?0x1f4:_0xc35ec1[_0x9710('0x23')]||0x1f4;logger[_0x9710('0x21')](_0x9710('0x24'),_0x9710('0x25'),_0x53a700,JSON['stringify'](_0xc35ec1));});}function getUser(_0x602d1,_0x106dfc,_0x3120eb){logger[_0x9710('0x11')](_0x9710('0x26'),_0x106dfc);return request({'method':_0x9710('0x27'),'uri':util[_0x9710('0x15')](_0x9710('0x28'),_0x602d1['remoteUri']),'qs':{'operation':_0x9710('0x29'),'username':'admin','sessionName':_0x3120eb[_0x9710('0x19')],'query':util[_0x9710('0x15')](_0x9710('0x2a'),_0x106dfc)},'json':!![]})['then'](function(_0x4ce7db){if(_0x4ce7db[_0x9710('0x1d')]&&_0x4ce7db[_0x9710('0x1f')][_0x9710('0x6')]){logger['info']('Agent\x20found!');return BPromise[_0x9710('0x1e')]({'id':_0x4ce7db[_0x9710('0x1f')][0x0]['id'],'email':_0x4ce7db[_0x9710('0x1f')][0x0][_0x9710('0x2b')],'name':_0x4ce7db[_0x9710('0x1f')][0x0][_0x9710('0x2c')]+'\x20'+_0x4ce7db[_0x9710('0x1f')][_0x9710('0x2d')]});}else{logger[_0x9710('0x11')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x9710('0x1e')]({'id':_0x3120eb[_0x9710('0x2e')],'email':_0x602d1[_0x9710('0x2f')],'name':_0x9710('0x18')});}})[_0x9710('0x30')](function(_0x206033){var _0x13cdee=req['query'][_0x9710('0x22')]?0x1f4:_0x206033[_0x9710('0x23')]||0x1f4;logger[_0x9710('0x21')](_0x9710('0x24'),_0x9710('0x31'),_0x13cdee,JSON['stringify'](_0x206033));});}function getEndUser(_0x6bd810,_0x2e25a4,_0x184bf0,_0x51e199){logger['info'](_0x9710('0x32'),_0x184bf0);return request({'method':'GET','uri':util['format'](_0x9710('0x28'),_0x6bd810[_0x9710('0x16')]),'qs':{'operation':'query','username':_0x9710('0x18'),'sessionName':_0x51e199['sessionName'],'query':util[_0x9710('0x15')](_0x9710('0x33'),_0x184bf0,_0x184bf0,_0x184bf0,_0x184bf0,_0x184bf0)},'json':!![]})[_0x9710('0x1c')](function(_0x483b32){if(_0x483b32[_0x9710('0x1d')]&&_0x483b32[_0x9710('0x1f')]['length']){logger[_0x9710('0x11')]('Enduser\x20found!');return BPromise[_0x9710('0x1e')]({'id':_0x483b32['result'][0x0]['id'],'name':_0x483b32[_0x9710('0x1f')][0x0][_0x9710('0x34')]+'\x20'+_0x483b32[_0x9710('0x1f')][0x0][_0x9710('0x35')],'phone':_0x184bf0});}else{logger[_0x9710('0x11')](_0x9710('0x36'));return request({'method':_0x9710('0x37'),'uri':util[_0x9710('0x15')](_0x9710('0x28'),_0x6bd810[_0x9710('0x16')]),'form':{'operation':_0x9710('0x17'),'sessionName':_0x51e199[_0x9710('0x19')],'elementType':'Contacts','element':JSON[_0x9710('0x1b')]({'lastname':_0x2e25a4,'phone':_0x184bf0,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x43a71e){logger['info'](_0x9710('0x38'));return BPromise[_0x9710('0x1e')]({'id':_0x43a71e[_0x9710('0x1f')]['id'],'name':_0x43a71e[_0x9710('0x1f')]['lastname'],'phone':_0x43a71e['result'][_0x9710('0x39')]});})['catch'](function(_0x21de40){var _0x4461c0=req[_0x9710('0x29')][_0x9710('0x22')]?0x1f4:_0x21de40[_0x9710('0x23')]||0x1f4;logger[_0x9710('0x21')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x9710('0x3a'),_0x4461c0,JSON[_0x9710('0x1b')](_0x21de40));});}});}function getConnection(_0x1c45a6){var _0x3f4738=_0x1c45a6[_0x9710('0x2f')];var _0x161321=_0x1c45a6['accessKey'];return request({'method':_0x9710('0x27'),'uri':util[_0x9710('0x15')]('%s/webservice.php',_0x1c45a6[_0x9710('0x16')]),'qs':{'operation':'getchallenge','username':_0x3f4738},'json':!![]})[_0x9710('0x1c')](function(_0x453fc5){if(_0x453fc5[_0x9710('0x1d')]){return request({'method':_0x9710('0x37'),'uri':util[_0x9710('0x15')](_0x9710('0x28'),_0x1c45a6['remoteUri']),'form':{'operation':'login','username':'admin','accessKey':md5(_0x453fc5[_0x9710('0x1f')][_0x9710('0x3b')]+_0x161321)},'json':!![]});}})[_0x9710('0x1c')](function(_0x753e21){if(_0x753e21[_0x9710('0x1d')]){return BPromise[_0x9710('0x1e')](_0x753e21[_0x9710('0x1f')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x1c45a6['id']));}})[_0x9710('0x30')](function(_0x2f94ad){var _0x266464=req[_0x9710('0x29')][_0x9710('0x22')]?0x1f4:_0x2f94ad[_0x9710('0x23')]||0x1f4;logger[_0x9710('0x21')](_0x9710('0x24'),'getConnection',_0x266464,JSON['stringify'](_0x2f94ad));});}function request(_0x10a7cd){logger[_0x9710('0x11')]('[HTTP]',JSON[_0x9710('0x1b')](_0x10a7cd));return rp(_0x10a7cd);}exports[_0x9710('0x3c')]=function(_0x424d01,_0x4f0238,_0xd5c38b,_0x19f3a9,_0x242b9d,_0x2898fd){var _0x4129f5,_0xc5a5d9,_0x9bad69,_0xe03a38;_0x2898fd['remoteUri']=intUtil['stripTrailingSlash'](_0x2898fd['remoteUri']);if(_0x242b9d&&_0x242b9d[_0x9710('0x3d')]){logger['info'](_0x9710('0x3e'),'Recording\x20is\x20enabled!');_0x4f0238[_0x9710('0x3f')]=util[_0x9710('0x15')](_0x9710('0x40'),_0x2898fd[_0x9710('0x41')],_0x4f0238[_0x9710('0x42')],md5(_0x4f0238[_0x9710('0x42')]));}else{_0x4f0238[_0x9710('0x3f')]='';}return getConnection(_0x2898fd)['then'](function(_0x332f64){_0xe03a38=_0x332f64;return getUser(_0x2898fd,_0x19f3a9?_0x19f3a9[_0x9710('0x43')]:'',_0xe03a38);})['then'](function(_0xbf0bfa){_0x4129f5=_0xbf0bfa;logger['info'](_0x9710('0x44'),_0x4129f5['id']);return getEndUser(_0x2898fd,_0x4f0238[_0x9710('0x45')],_0x4f0238[_0x9710('0x46')],_0xe03a38);})[_0x9710('0x1c')](function(_0x1eb433){_0xc5a5d9=_0x1eb433;logger['info'](_0x9710('0x47'),_0xc5a5d9['id']);return createTicket(_0x2898fd,_0x4129f5,_0xc5a5d9,_0xd5c38b,_0x4f0238,_0xd5c38b['Fields'],_0xe03a38);})[_0x9710('0x1c')](function(_0x2b3675){_0x9bad69=_0x2b3675;logger[_0x9710('0x11')](_0x9710('0x48'));logger[_0x9710('0x11')](_0x9710('0x49'),_0x9bad69['id']);var _0x11f185=util[_0x9710('0x15')](_0x9710('0x4a'),_0x2898fd[_0x9710('0x16')],_['split'](_0x9bad69['id'],'x')[0x1]);logger[_0x9710('0x11')](_0x9710('0x3e'),_0x9710('0x4b'));emit(util['format'](_0x9710('0x4c'),_0x19f3a9[_0x9710('0x4d')]),_0x9710('0x4e'),{'uri':_0x11f185});})['catch'](function(_0x1bd19d){logger[_0x9710('0x21')](_0x9710('0x3e'),JSON[_0x9710('0x1b')](_0x1bd19d));});};exports['outbound']=function(_0x4da134,_0x3ca1a3,_0x3e05d3,_0x41abea,_0x9012e5,_0x234f14,_0x454333){var _0x1c03e1,_0x49a8de,_0x1b1693,_0x5e46fd;_0x234f14[_0x9710('0x16')]=intUtil[_0x9710('0x4f')](_0x234f14['remoteUri']);_0x234f14['serverUrl']=intUtil[_0x9710('0x4f')](_0x234f14[_0x9710('0x41')]);if(_0x454333&&_0x454333[_0x9710('0x50')]&&_0x454333[_0x9710('0x50')]!==_0x9710('0x51')){logger[_0x9710('0x11')](_0x9710('0x52'),_0x9710('0x53'));_0x3ca1a3[_0x9710('0x3f')]=util[_0x9710('0x15')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x234f14[_0x9710('0x41')],_0x3ca1a3[_0x9710('0x42')],md5(_0x3ca1a3['uniqueid']));}return getConnection(_0x234f14)[_0x9710('0x1c')](function(_0x1f60ad){_0x5e46fd=_0x1f60ad;return getUser(_0x234f14,_0x41abea?_0x41abea['email']:'',_0x5e46fd);})[_0x9710('0x1c')](function(_0x196261){_0x1c03e1=_0x196261;logger[_0x9710('0x11')]('The\x20User\x20ID\x20is:',_0x1c03e1['id']);return getEndUser(_0x234f14,_0x3ca1a3[_0x9710('0x54')],_0x3ca1a3['destcalleridnum'],_0x5e46fd);})[_0x9710('0x1c')](function(_0x48d590){_0x49a8de=_0x48d590;logger[_0x9710('0x11')](_0x9710('0x47'),_0x49a8de['id']);return createTicket(_0x234f14,_0x1c03e1,_0x49a8de,_0x3e05d3,_0x3ca1a3,_0x3e05d3[_0x9710('0x55')],_0x5e46fd);})['then'](function(_0x33d339){_0x1b1693=_0x33d339;logger[_0x9710('0x11')]('Ticket\x20created!');logger[_0x9710('0x11')]('The\x20Ticket\x20ID\x20is:',_0x1b1693['id']);var _0x4e81ca=util[_0x9710('0x15')](_0x9710('0x4a'),_0x234f14['remoteUri'],_[_0x9710('0x56')](_0x1b1693['id'],'x')[0x1]);logger[_0x9710('0x11')]('[OUTBOUND]',_0x9710('0x4b'));emit(util[_0x9710('0x15')](_0x9710('0x4c'),_0x41abea[_0x9710('0x4d')]),_0x9710('0x4e'),{'uri':_0x4e81ca});})[_0x9710('0x30')](function(_0x59b95f){logger[_0x9710('0x21')]('[OUTBOUND]',JSON[_0x9710('0x1b')](_0x59b95f));});};exports[_0x9710('0x57')]=function(_0xd4471,_0x1d30c8,_0x418103,_0x28b7ef,_0x226dcb,_0x291dfb){var _0xee12c3,_0x114b2d,_0x1a7523,_0x26bcc6;_0x291dfb[_0x9710('0x16')]=intUtil[_0x9710('0x4f')](_0x291dfb[_0x9710('0x16')]);_0x291dfb[_0x9710('0x41')]=intUtil[_0x9710('0x4f')](_0x291dfb[_0x9710('0x41')]);if(_0x226dcb&&_0x226dcb[_0x9710('0x3d')]){logger[_0x9710('0x11')](_0x9710('0x58'),_0x9710('0x53'));_0x1d30c8[_0x9710('0x3f')]=util['format'](_0x9710('0x40'),_0x291dfb[_0x9710('0x41')],_0x1d30c8[_0x9710('0x42')],md5(_0x1d30c8['uniqueid']));}else{_0x1d30c8[_0x9710('0x3f')]='';}return getConnection(_0x291dfb)[_0x9710('0x1c')](function(_0x8131ef){_0x26bcc6=_0x8131ef;return getUser(_0x291dfb,_0x28b7ef?_0x28b7ef[_0x9710('0x43')]:'',_0x26bcc6);})[_0x9710('0x1c')](function(_0x3d135a){_0xee12c3=_0x3d135a;logger['info'](_0x9710('0x44'),_0xee12c3['id']);return getEndUser(_0x291dfb,_0x1d30c8[_0x9710('0x45')],_0x1d30c8[_0x9710('0x46')],_0x26bcc6);})[_0x9710('0x1c')](function(_0x294924){_0x114b2d=_0x294924;logger[_0x9710('0x11')](_0x9710('0x47'),_0x114b2d['id']);return createTicket(_0x291dfb,_0xee12c3,_0x114b2d,_0x418103,_0x1d30c8,_0x418103['Fields'],_0x26bcc6);})[_0x9710('0x1c')](function(_0x897919){_0x1a7523=_0x897919;logger[_0x9710('0x11')](_0x9710('0x48'));logger[_0x9710('0x11')]('The\x20Ticket\x20ID\x20is:',_0x1a7523['id']);})[_0x9710('0x30')](function(_0x5ccc35){logger[_0x9710('0x21')](_0x9710('0x58'),JSON['stringify'](_0x5ccc35));});}; \ 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 a8c1ba0..f3e1fe5 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 _0xd76f=['Descriptions','then','Ticket\x20created!','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','end-user','Caller\x20-\x20%s','authType','password','token','%s/token:%s','username','Basic\x20%s','base64','stringify','GET','length','map','forEach','type','string','nameField','customField','content','toString','custom_fields','push','variableName','idField','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','destcalleridname','destcalleridnum','[OUTBOUND]','catch','abandoned','calleridnum','lodash','md5','util','./util','zendesk','socket.io-emitter','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString'];(function(_0x445ecd,_0x53348a){var _0x24b8eb=function(_0x5608b6){while(--_0x5608b6){_0x445ecd['push'](_0x445ecd['shift']());}};_0x24b8eb(++_0x53348a);}(_0xd76f,0x165));var _0xfd76=function(_0x4a782b,_0x55584a){_0x4a782b=_0x4a782b-0x0;var _0x5cb5a0=_0xd76f[_0x4a782b];return _0x5cb5a0;};'use strict';var _=require(_0xfd76('0x0'));var rp=require('request-promise');var md5=require(_0xfd76('0x1'));var util=require(_0xfd76('0x2'));var intUtil=require(_0xfd76('0x3'));var logger=require('../../../../config/logger')(_0xfd76('0x4'));var io=require(_0xfd76('0x5'))({'host':_0xfd76('0x6'),'port':0x18eb});function emit(_0x2a4ccb,_0x3e4c41,_0x18dfe0){io['to'](_0x2a4ccb)[_0xfd76('0x7')](_0x3e4c41,_0x18dfe0);}var headers={'Content-Type':_0xfd76('0x8'),'Accept':_0xfd76('0x8')};function getTicket(_0x529a1a,_0x5305b5,_0x3f336c,_0x5794f0,_0xcccf47){logger[_0xfd76('0x9')](_0xfd76('0xa'));return request({'uri':util[_0xfd76('0xb')](_0xfd76('0xc'),_0x529a1a[_0xfd76('0xd')]),'method':_0xfd76('0xe'),'body':{'ticket':_[_0xfd76('0xf')]({'requester_id':_0x3f336c['id'],'submitter_id':_0x5305b5?_0x5305b5['id']:undefined,'assignee_id':_0x5305b5?_0x5305b5['id']:undefined,'tags':getTags(_0x5794f0[_0xfd76('0x10')],_0xfd76('0x11')),'subject':intUtil[_0xfd76('0x12')](_0x5794f0['Subjects'],_0xcccf47,'\x20'),'description':intUtil[_0xfd76('0x12')](_0x5794f0[_0xfd76('0x13')],_0xcccf47,'\x0a'),'comment':{'public':![],'body':intUtil[_0xfd76('0x12')](_0x5794f0[_0xfd76('0x13')],_0xcccf47,'\x0a')}},getCustomFields(_0x5794f0['Fields'],_0xcccf47))}})[_0xfd76('0x14')](function(_0x33ce89){logger['info'](_0xfd76('0x15'));return _0x33ce89['ticket'];});}function getUser(_0x767798,_0x296512){logger[_0xfd76('0x9')](_0xfd76('0x16'),_0x296512);return request({'uri':util[_0xfd76('0xb')](_0xfd76('0x17'),_0x767798[_0xfd76('0xd')]),'qs':{'query':util[_0xfd76('0xb')](_0xfd76('0x18'),_0x296512)}})[_0xfd76('0x14')](function(_0x177848){if(_0x177848[_0xfd76('0x19')]){logger['info'](_0xfd76('0x1a'));return _['find'](_0x177848[_0xfd76('0x1b')],{'email':_0x296512,'role':_0xfd76('0x1c')});}else{logger[_0xfd76('0x9')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xfd76('0xb')](_0xfd76('0x1d'),_0x767798['remoteUri'])})[_0xfd76('0x14')](function(_0x107eac){logger['info'](_0xfd76('0x1e'));return _0x107eac[_0xfd76('0x1f')];});}});}function getEndUser(_0x3eb727,_0x36d38d,_0x239137){logger[_0xfd76('0x9')](_0xfd76('0x20'),_0x239137);return request({'uri':util[_0xfd76('0xb')](_0xfd76('0x17'),_0x3eb727[_0xfd76('0xd')]),'qs':{'query':util[_0xfd76('0xb')]('type:user\x20role:end-user\x20phone:%s',_0x239137)}})['then'](function(_0x296cc2){if(_0x296cc2[_0xfd76('0x19')]){logger['info']('Enduser\x20found!');return _[_0xfd76('0x21')](_0x296cc2[_0xfd76('0x1b')],{'phone':_0x239137,'role':'end-user'});}else{logger[_0xfd76('0x9')](_0xfd76('0x22'));return request({'uri':util['format']('%s/users.json',_0x3eb727['remoteUri']),'method':_0xfd76('0xe'),'body':{'user':{'role':_0xfd76('0x23'),'name':util[_0xfd76('0xb')](_0xfd76('0x24'),_0x36d38d||_0x239137),'phone':_0x239137}}})[_0xfd76('0x14')](function(_0x21f409){logger[_0xfd76('0x9')]('Enduser\x20created.');return _0x21f409[_0xfd76('0x1f')];});}});}function getAuth(_0x17da40){var _0x21a69f;if(_0x17da40[_0xfd76('0x25')]===_0xfd76('0x26')){_0x21a69f=util['format']('%s:%s',_0x17da40['username'],_0x17da40['password']);}else if(_0x17da40[_0xfd76('0x25')]===_0xfd76('0x27')){_0x21a69f=util[_0xfd76('0xb')](_0xfd76('0x28'),_0x17da40[_0xfd76('0x29')],_0x17da40[_0xfd76('0x27')]);}return util[_0xfd76('0xb')](_0xfd76('0x2a'),new Buffer(_0x21a69f)['toString'](_0xfd76('0x2b')));}function request(_0x43d3b3){logger['debug']('[HTTP]',JSON[_0xfd76('0x2c')](_0x43d3b3));return rp(_['defaults'](_0x43d3b3,{'method':_0xfd76('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0x4047ee,_0x248d28){var _0x301efd=[];if(_0x4047ee&&_0x4047ee[_0xfd76('0x2e')]>0x0){_0x301efd=_[_0xfd76('0x2f')](_0x4047ee,_0x248d28);}return _0x301efd;}function getCustomFields(_0x1abf45,_0x5336bd){var _0x1a3c69=[];var _0x2374a9={'custom_fields':[]};if(_0x1abf45[_0xfd76('0x2e')]>0x0){_[_0xfd76('0x30')](_0x1abf45,function(_0xa46834){if(_0xa46834[_0xfd76('0x31')]===_0xfd76('0x32')&&_0xa46834[_0xfd76('0x33')]&&!_0xa46834[_0xfd76('0x34')]){_0x2374a9[_0xa46834[_0xfd76('0x33')]['toLowerCase']()]=_0xa46834[_0xfd76('0x35')][_0xfd76('0x36')]();}else if(_0xa46834[_0xfd76('0x31')]==='string'&&_0xa46834['idField']&&_0xa46834[_0xfd76('0x34')]){_0x2374a9[_0xfd76('0x37')][_0xfd76('0x38')]({'id':_0xa46834['idField'],'value':_0xa46834[_0xfd76('0x35')][_0xfd76('0x36')]()});}else if(_0xa46834[_0xfd76('0x31')]==='variable'&&_0xa46834[_0xfd76('0x39')]&&_0xa46834[_0xfd76('0x3a')]&&_0xa46834[_0xfd76('0x34')]){_0x5336bd[_0xa46834[_0xfd76('0x39')]]&&_0x2374a9[_0xfd76('0x37')]['push']({'id':_0xa46834[_0xfd76('0x3a')],'value':_0x5336bd[_0xa46834[_0xfd76('0x39')]][_0xfd76('0x36')]()});}else if(_0xa46834[_0xfd76('0x31')]===_0xfd76('0x3b')&&_0xa46834[_0xfd76('0x3c')]&&_0xa46834[_0xfd76('0x3c')][_0xfd76('0x11')]&&_0xa46834[_0xfd76('0x3a')]&&_0xa46834['customField']){_0x5336bd[_0xa46834['Variable']['name'][_0xfd76('0x3d')]()]&&_0x2374a9[_0xfd76('0x37')][_0xfd76('0x38')]({'id':_0xa46834[_0xfd76('0x3a')],'value':_0x5336bd[_0xa46834[_0xfd76('0x3c')][_0xfd76('0x11')][_0xfd76('0x3d')]()]['toString']()});}});}return _0x2374a9;}exports[_0xfd76('0x3e')]=function(_0x33bdc5,_0x4fbee0,_0x297913,_0xb3eadc,_0x449a4c,_0x3401d8){var _0x1a1c99,_0x437e5d;_0x3401d8[_0xfd76('0xd')]=intUtil[_0xfd76('0x3f')](_0x3401d8[_0xfd76('0xd')]);_0x3401d8[_0xfd76('0x40')]=intUtil[_0xfd76('0x3f')](_0x3401d8[_0xfd76('0x40')]);if(_0x449a4c&&_0x449a4c[_0xfd76('0x41')]){logger[_0xfd76('0x9')](_0xfd76('0x42'),_0xfd76('0x43'));_0x4fbee0[_0xfd76('0x44')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3401d8[_0xfd76('0x40')],_0x4fbee0['uniqueid'],md5(_0x4fbee0['uniqueid']));}else{_0x4fbee0['recordingURL']='';}headers[_0xfd76('0x45')]=getAuth(_0x3401d8);return getUser(_0x3401d8,_0xb3eadc[_0xfd76('0x46')])[_0xfd76('0x14')](function(_0x6fdac){_0x1a1c99=_0x6fdac;logger[_0xfd76('0x9')](_0xfd76('0x47'),_0x1a1c99['id']);return getEndUser(_0x3401d8,_0x4fbee0[_0xfd76('0x48')],_0x4fbee0['calleridnum']);})[_0xfd76('0x14')](function(_0x91c785){_0x437e5d=_0x91c785;logger[_0xfd76('0x9')](_0xfd76('0x49'),_0x437e5d['id']);return getTicket(_0x3401d8,_0x1a1c99,_0x437e5d,_0x297913,_0x4fbee0);})[_0xfd76('0x14')](function(_0x3d09a0){if(_0x3d09a0){logger[_0xfd76('0x9')]('The\x20Ticket\x20ID\x20is:',_0x3d09a0['id']);switch(_0x3401d8[_0xfd76('0x31')]){case _0xfd76('0x4a'):logger[_0xfd76('0x9')](_0xfd76('0x42'),_0xfd76('0x4b'));return request({'uri':util[_0xfd76('0xb')](_0xfd76('0x4c'),_0x3401d8[_0xfd76('0xd')],_0x1a1c99['id'],_0x3d09a0['id']),'method':_0xfd76('0xe')});case'newTab':logger['info'](_0xfd76('0x42'),_0xfd76('0x4d'));emit(util[_0xfd76('0xb')](_0xfd76('0x4e'),_0xb3eadc[_0xfd76('0x11')]),_0xfd76('0x4f'),{'uri':util[_0xfd76('0xb')](_0xfd76('0x50'),_0x3401d8[_0xfd76('0xd')],_0x3d09a0['id'])});break;default:logger[_0xfd76('0x51')](_0xfd76('0x42'),_0xfd76('0x52'));}}})['catch'](function(_0x4b981f){logger[_0xfd76('0x51')](_0xfd76('0x42'),JSON['stringify'](_0x4b981f));});};exports[_0xfd76('0x53')]=function(_0x4752fe,_0x4b4a04,_0x488bae,_0x3e084e,_0x5ad0dd,_0xef4fd8,_0x3f3710){var _0x475249,_0x4fafee;_0xef4fd8[_0xfd76('0xd')]=intUtil['stripTrailingSlash'](_0xef4fd8['remoteUri']);_0xef4fd8[_0xfd76('0x40')]=intUtil[_0xfd76('0x3f')](_0xef4fd8[_0xfd76('0x40')]);if(_0x3f3710&&_0x3f3710[_0xfd76('0x54')]&&_0x3f3710[_0xfd76('0x54')]!==_0xfd76('0x55')){logger[_0xfd76('0x9')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4b4a04[_0xfd76('0x44')]=util['format'](_0xfd76('0x56'),_0xef4fd8[_0xfd76('0x40')],_0x4b4a04[_0xfd76('0x57')],md5(_0x4b4a04['uniqueid']));}headers['Authorization']=getAuth(_0xef4fd8);return getUser(_0xef4fd8,_0x3e084e[_0xfd76('0x46')])['then'](function(_0x56711e){_0x475249=_0x56711e;logger[_0xfd76('0x9')](_0xfd76('0x47'),_0x475249['id']);return getEndUser(_0xef4fd8,_0x4b4a04[_0xfd76('0x58')],_0x4b4a04[_0xfd76('0x59')]);})[_0xfd76('0x14')](function(_0x5399f3){_0x4fafee=_0x5399f3;logger[_0xfd76('0x9')](_0xfd76('0x49'),_0x4fafee['id']);return getTicket(_0xef4fd8,_0x475249,_0x4fafee,_0x488bae,_0x4b4a04);})[_0xfd76('0x14')](function(_0x138d1a){if(_0x138d1a){logger['info']('The\x20Ticket\x20ID\x20is:',_0x138d1a['id']);switch(_0xef4fd8[_0xfd76('0x31')]){case'integrationTab':logger['info'](_0xfd76('0x5a'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xfd76('0xb')](_0xfd76('0x4c'),_0xef4fd8[_0xfd76('0xd')],_0x475249['id'],_0x138d1a['id']),'method':_0xfd76('0xe')});case'newTab':logger[_0xfd76('0x9')](_0xfd76('0x5a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfd76('0xb')](_0xfd76('0x4e'),_0x3e084e[_0xfd76('0x11')]),_0xfd76('0x4f'),{'uri':util['format'](_0xfd76('0x50'),_0xef4fd8[_0xfd76('0xd')],_0x138d1a['id'])});break;default:logger[_0xfd76('0x51')](_0xfd76('0x5a'),_0xfd76('0x52'));}}})[_0xfd76('0x5b')](function(_0x24b8fa){logger[_0xfd76('0x51')](_0xfd76('0x5a'),JSON[_0xfd76('0x2c')](_0x24b8fa));});};exports[_0xfd76('0x5c')]=function(_0x21fbce,_0x509c10,_0x503bff,_0x150eee,_0x18e264,_0x13c405){var _0x57a1e8,_0x3cbaae;_0x13c405[_0xfd76('0xd')]=intUtil[_0xfd76('0x3f')](_0x13c405[_0xfd76('0xd')]);_0x13c405['serverUrl']=intUtil[_0xfd76('0x3f')](_0x13c405[_0xfd76('0x40')]);if(_0x18e264&&_0x18e264[_0xfd76('0x41')]){logger[_0xfd76('0x9')]('[ABANDONED]','Recording\x20is\x20enabled!');_0x509c10[_0xfd76('0x44')]=util[_0xfd76('0xb')](_0xfd76('0x56'),_0x13c405[_0xfd76('0x40')],_0x509c10[_0xfd76('0x57')],md5(_0x509c10['uniqueid']));}else{_0x509c10[_0xfd76('0x44')]='';}headers['Authorization']=getAuth(_0x13c405);return getUser(_0x13c405)[_0xfd76('0x14')](function(_0x281d81){_0x57a1e8=_0x281d81;logger[_0xfd76('0x9')](_0xfd76('0x47'),_0x57a1e8['id']);return getEndUser(_0x13c405,_0x509c10[_0xfd76('0x48')],_0x509c10[_0xfd76('0x5d')]);})[_0xfd76('0x14')](function(_0x33e0c3){_0x3cbaae=_0x33e0c3;logger[_0xfd76('0x9')](_0xfd76('0x49'),_0x3cbaae['id']);return getTicket(_0x13c405,_0x57a1e8,_0x3cbaae,_0x503bff,_0x509c10);})[_0xfd76('0x14')](function(_0x3e430c){if(_0x3e430c){logger[_0xfd76('0x9')]('The\x20Ticket\x20ID\x20is:',_0x3e430c['id']);}})['catch'](function(_0x3f14f5){logger[_0xfd76('0x51')]('[ABANDONED]',JSON[_0xfd76('0x2c')](_0x3f14f5));});}; \ No newline at end of file +var _0x944c=['zendesk','socket.io-emitter','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','Subjects','getString','Descriptions','Fields','then','Ticket\x20created!','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/users.json','end-user','Enduser\x20created.','authType','password','%s:%s','%s/token:%s','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','length','map','forEach','string','nameField','customField','content','type','idField','push','variable','custom_fields','variableName','customVariable','Variable','name','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','[QUEUE]','POST','newTab','user:%s','trigger:browser:url','error','Zendesk\x20account\x20type\x20not\x20recognized','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridnum','catch','abandoned','[ABANDONED]','lodash','request-promise','md5','./util','../../../../config/logger'];(function(_0x5b4c1c,_0x3bd2d9){var _0x366ae2=function(_0x1d95c2){while(--_0x1d95c2){_0x5b4c1c['push'](_0x5b4c1c['shift']());}};_0x366ae2(++_0x3bd2d9);}(_0x944c,0xbb));var _0xc944=function(_0x2552e2,_0x4fb60a){_0x2552e2=_0x2552e2-0x0;var _0x27922b=_0x944c[_0x2552e2];return _0x27922b;};'use strict';var _=require(_0xc944('0x0'));var rp=require(_0xc944('0x1'));var md5=require(_0xc944('0x2'));var util=require('util');var intUtil=require(_0xc944('0x3'));var logger=require(_0xc944('0x4'))(_0xc944('0x5'));var io=require(_0xc944('0x6'))({'host':_0xc944('0x7'),'port':0x18eb});function emit(_0x1a9000,_0x5e06db,_0x55aec8){io['to'](_0x1a9000)[_0xc944('0x8')](_0x5e06db,_0x55aec8);}var headers={'Content-Type':_0xc944('0x9'),'Accept':_0xc944('0x9')};function getTicket(_0x45e28c,_0x519e29,_0x6bc07f,_0x12cc0b,_0x32b40a){logger[_0xc944('0xa')](_0xc944('0xb'));return request({'uri':util[_0xc944('0xc')](_0xc944('0xd'),_0x45e28c[_0xc944('0xe')]),'method':'POST','body':{'ticket':_[_0xc944('0xf')]({'requester_id':_0x6bc07f['id'],'submitter_id':_0x519e29?_0x519e29['id']:undefined,'assignee_id':_0x519e29?_0x519e29['id']:undefined,'tags':getTags(_0x12cc0b['Tags'],'name'),'subject':intUtil['getString'](_0x12cc0b[_0xc944('0x10')],_0x32b40a,'\x20'),'description':intUtil[_0xc944('0x11')](_0x12cc0b[_0xc944('0x12')],_0x32b40a,'\x0a'),'comment':{'public':![],'body':intUtil[_0xc944('0x11')](_0x12cc0b['Descriptions'],_0x32b40a,'\x0a')}},getCustomFields(_0x12cc0b[_0xc944('0x13')],_0x32b40a))}})[_0xc944('0x14')](function(_0x5c7a6c){logger[_0xc944('0xa')](_0xc944('0x15'));return _0x5c7a6c['ticket'];});}function getUser(_0x468a9e,_0xe9e4dd){logger[_0xc944('0xa')](_0xc944('0x16'),_0xe9e4dd);return request({'uri':util['format'](_0xc944('0x17'),_0x468a9e[_0xc944('0xe')]),'qs':{'query':util[_0xc944('0xc')](_0xc944('0x18'),_0xe9e4dd)}})[_0xc944('0x14')](function(_0xb421c9){if(_0xb421c9[_0xc944('0x19')]){logger[_0xc944('0xa')](_0xc944('0x1a'));return _[_0xc944('0x1b')](_0xb421c9[_0xc944('0x1c')],{'email':_0xe9e4dd,'role':_0xc944('0x1d')});}else{logger['info'](_0xc944('0x1e'));return request({'uri':util[_0xc944('0xc')](_0xc944('0x1f'),_0x468a9e[_0xc944('0xe')])})[_0xc944('0x14')](function(_0xfa585e){logger[_0xc944('0xa')](_0xc944('0x20'));return _0xfa585e[_0xc944('0x21')];});}});}function getEndUser(_0x57c2c3,_0x34ecd2,_0x5a9a0c){logger[_0xc944('0xa')](_0xc944('0x22'),_0x5a9a0c);return request({'uri':util[_0xc944('0xc')](_0xc944('0x17'),_0x57c2c3['remoteUri']),'qs':{'query':util[_0xc944('0xc')]('type:user\x20role:end-user\x20phone:%s',_0x5a9a0c)}})[_0xc944('0x14')](function(_0x1f513c){if(_0x1f513c[_0xc944('0x19')]){logger[_0xc944('0xa')]('Enduser\x20found!');return _[_0xc944('0x1b')](_0x1f513c[_0xc944('0x1c')],{'phone':_0x5a9a0c,'role':'end-user'});}else{logger[_0xc944('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xc944('0xc')](_0xc944('0x23'),_0x57c2c3['remoteUri']),'method':'POST','body':{'user':{'role':_0xc944('0x24'),'name':util[_0xc944('0xc')]('Caller\x20-\x20%s',_0x34ecd2||_0x5a9a0c),'phone':_0x5a9a0c}}})[_0xc944('0x14')](function(_0x3aa825){logger[_0xc944('0xa')](_0xc944('0x25'));return _0x3aa825[_0xc944('0x21')];});}});}function getAuth(_0x400f75){var _0x9e945a;if(_0x400f75[_0xc944('0x26')]===_0xc944('0x27')){_0x9e945a=util['format'](_0xc944('0x28'),_0x400f75['username'],_0x400f75[_0xc944('0x27')]);}else if(_0x400f75[_0xc944('0x26')]==='token'){_0x9e945a=util[_0xc944('0xc')](_0xc944('0x29'),_0x400f75['username'],_0x400f75[_0xc944('0x2a')]);}return util[_0xc944('0xc')](_0xc944('0x2b'),new Buffer(_0x9e945a)[_0xc944('0x2c')](_0xc944('0x2d')));}function request(_0x1fe17a){logger[_0xc944('0x2e')](_0xc944('0x2f'),JSON[_0xc944('0x30')](_0x1fe17a));return rp(_[_0xc944('0x31')](_0x1fe17a,{'method':_0xc944('0x32'),'headers':headers,'json':!![]}));}function getTags(_0xdc86b,_0x25ed24){var _0x4efe2a=[];if(_0xdc86b&&_0xdc86b[_0xc944('0x33')]>0x0){_0x4efe2a=_[_0xc944('0x34')](_0xdc86b,_0x25ed24);}return _0x4efe2a;}function getCustomFields(_0x549e90,_0x26c532){var _0x5410e6=[];var _0x5b2c80={'custom_fields':[]};if(_0x549e90[_0xc944('0x33')]>0x0){_[_0xc944('0x35')](_0x549e90,function(_0x539bac){if(_0x539bac['type']===_0xc944('0x36')&&_0x539bac[_0xc944('0x37')]&&!_0x539bac[_0xc944('0x38')]){_0x5b2c80[_0x539bac[_0xc944('0x37')]['toLowerCase']()]=_0x539bac[_0xc944('0x39')][_0xc944('0x2c')]();}else if(_0x539bac[_0xc944('0x3a')]===_0xc944('0x36')&&_0x539bac[_0xc944('0x3b')]&&_0x539bac[_0xc944('0x38')]){_0x5b2c80['custom_fields'][_0xc944('0x3c')]({'id':_0x539bac[_0xc944('0x3b')],'value':_0x539bac['content'][_0xc944('0x2c')]()});}else if(_0x539bac[_0xc944('0x3a')]===_0xc944('0x3d')&&_0x539bac['variableName']&&_0x539bac[_0xc944('0x3b')]&&_0x539bac[_0xc944('0x38')]){_0x26c532[_0x539bac['variableName']]&&_0x5b2c80[_0xc944('0x3e')][_0xc944('0x3c')]({'id':_0x539bac[_0xc944('0x3b')],'value':_0x26c532[_0x539bac[_0xc944('0x3f')]][_0xc944('0x2c')]()});}else if(_0x539bac[_0xc944('0x3a')]===_0xc944('0x40')&&_0x539bac[_0xc944('0x41')]&&_0x539bac['Variable'][_0xc944('0x42')]&&_0x539bac['idField']&&_0x539bac[_0xc944('0x38')]){_0x26c532[_0x539bac[_0xc944('0x41')][_0xc944('0x42')][_0xc944('0x43')]()]&&_0x5b2c80[_0xc944('0x3e')][_0xc944('0x3c')]({'id':_0x539bac[_0xc944('0x3b')],'value':_0x26c532[_0x539bac['Variable']['name'][_0xc944('0x43')]()][_0xc944('0x2c')]()});}});}return _0x5b2c80;}exports[_0xc944('0x44')]=function(_0x493fb8,_0x3c9734,_0x3f98a4,_0x26fce3,_0x26651b,_0x58fb53){var _0x2315ab,_0x22e210;_0x58fb53[_0xc944('0xe')]=intUtil[_0xc944('0x45')](_0x58fb53[_0xc944('0xe')]);_0x58fb53[_0xc944('0x46')]=intUtil['stripTrailingSlash'](_0x58fb53[_0xc944('0x46')]);if(_0x26651b&&_0x26651b[_0xc944('0x47')]){logger[_0xc944('0xa')]('[QUEUE]',_0xc944('0x48'));_0x3c9734[_0xc944('0x49')]=util[_0xc944('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x58fb53[_0xc944('0x46')],_0x3c9734[_0xc944('0x4a')],md5(_0x3c9734[_0xc944('0x4a')]));}else{_0x3c9734[_0xc944('0x49')]='';}headers['Authorization']=getAuth(_0x58fb53);return getUser(_0x58fb53,_0x26fce3[_0xc944('0x4b')])[_0xc944('0x14')](function(_0x4d08be){_0x2315ab=_0x4d08be;logger[_0xc944('0xa')](_0xc944('0x4c'),_0x2315ab['id']);return getEndUser(_0x58fb53,_0x3c9734['calleridname'],_0x3c9734[_0xc944('0x4d')]);})[_0xc944('0x14')](function(_0x5784e1){_0x22e210=_0x5784e1;logger[_0xc944('0xa')](_0xc944('0x4e'),_0x22e210['id']);return getTicket(_0x58fb53,_0x2315ab,_0x22e210,_0x3f98a4,_0x3c9734);})[_0xc944('0x14')](function(_0x4175f6){if(_0x4175f6){logger[_0xc944('0xa')]('The\x20Ticket\x20ID\x20is:',_0x4175f6['id']);switch(_0x58fb53[_0xc944('0x3a')]){case _0xc944('0x4f'):logger['info'](_0xc944('0x50'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xc944('0xc')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x58fb53[_0xc944('0xe')],_0x2315ab['id'],_0x4175f6['id']),'method':_0xc944('0x51')});case _0xc944('0x52'):logger['info'](_0xc944('0x50'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc944('0xc')](_0xc944('0x53'),_0x26fce3['name']),_0xc944('0x54'),{'uri':util[_0xc944('0xc')]('%s/agent/tickets/%s',_0x58fb53[_0xc944('0xe')],_0x4175f6['id'])});break;default:logger[_0xc944('0x55')](_0xc944('0x50'),_0xc944('0x56'));}}})['catch'](function(_0x52e123){logger['error'](_0xc944('0x50'),JSON[_0xc944('0x30')](_0x52e123));});};exports['outbound']=function(_0x423d24,_0x4f507b,_0x5b9f31,_0xa356f2,_0x3647d2,_0x339dd1,_0x41fdb3){var _0x521d59,_0x1dcb8c;_0x339dd1[_0xc944('0xe')]=intUtil[_0xc944('0x45')](_0x339dd1[_0xc944('0xe')]);_0x339dd1['serverUrl']=intUtil[_0xc944('0x45')](_0x339dd1[_0xc944('0x46')]);if(_0x41fdb3&&_0x41fdb3[_0xc944('0x57')]&&_0x41fdb3[_0xc944('0x57')]!==_0xc944('0x58')){logger['info'](_0xc944('0x59'),_0xc944('0x48'));_0x4f507b[_0xc944('0x49')]=util[_0xc944('0xc')](_0xc944('0x5a'),_0x339dd1[_0xc944('0x46')],_0x4f507b[_0xc944('0x4a')],md5(_0x4f507b[_0xc944('0x4a')]));}headers[_0xc944('0x5b')]=getAuth(_0x339dd1);return getUser(_0x339dd1,_0xa356f2[_0xc944('0x4b')])[_0xc944('0x14')](function(_0x4e44ed){_0x521d59=_0x4e44ed;logger['info'](_0xc944('0x4c'),_0x521d59['id']);return getEndUser(_0x339dd1,_0x4f507b['destcalleridname'],_0x4f507b[_0xc944('0x5c')]);})['then'](function(_0x2a58c1){_0x1dcb8c=_0x2a58c1;logger[_0xc944('0xa')](_0xc944('0x4e'),_0x1dcb8c['id']);return getTicket(_0x339dd1,_0x521d59,_0x1dcb8c,_0x5b9f31,_0x4f507b);})[_0xc944('0x14')](function(_0x4bc639){if(_0x4bc639){logger[_0xc944('0xa')]('The\x20Ticket\x20ID\x20is:',_0x4bc639['id']);switch(_0x339dd1[_0xc944('0x3a')]){case'integrationTab':logger['info'](_0xc944('0x59'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x339dd1[_0xc944('0xe')],_0x521d59['id'],_0x4bc639['id']),'method':_0xc944('0x51')});case'newTab':logger[_0xc944('0xa')](_0xc944('0x59'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xc944('0x53'),_0xa356f2[_0xc944('0x42')]),'trigger:browser:url',{'uri':util[_0xc944('0xc')]('%s/agent/tickets/%s',_0x339dd1[_0xc944('0xe')],_0x4bc639['id'])});break;default:logger[_0xc944('0x55')](_0xc944('0x59'),_0xc944('0x56'));}}})[_0xc944('0x5d')](function(_0x4a2837){logger[_0xc944('0x55')](_0xc944('0x59'),JSON[_0xc944('0x30')](_0x4a2837));});};exports[_0xc944('0x5e')]=function(_0x373d93,_0x2552ff,_0x16ddc1,_0x24a502,_0x1bc380,_0x462512){var _0x367efd,_0x58c949;_0x462512[_0xc944('0xe')]=intUtil[_0xc944('0x45')](_0x462512[_0xc944('0xe')]);_0x462512['serverUrl']=intUtil[_0xc944('0x45')](_0x462512[_0xc944('0x46')]);if(_0x1bc380&&_0x1bc380[_0xc944('0x47')]){logger[_0xc944('0xa')](_0xc944('0x5f'),_0xc944('0x48'));_0x2552ff[_0xc944('0x49')]=util[_0xc944('0xc')](_0xc944('0x5a'),_0x462512[_0xc944('0x46')],_0x2552ff['uniqueid'],md5(_0x2552ff['uniqueid']));}else{_0x2552ff['recordingURL']='';}headers[_0xc944('0x5b')]=getAuth(_0x462512);return getUser(_0x462512)[_0xc944('0x14')](function(_0x3ae584){_0x367efd=_0x3ae584;logger[_0xc944('0xa')]('The\x20User\x20ID\x20is:',_0x367efd['id']);return getEndUser(_0x462512,_0x2552ff['calleridname'],_0x2552ff['calleridnum']);})[_0xc944('0x14')](function(_0x19d9cf){_0x58c949=_0x19d9cf;logger['info'](_0xc944('0x4e'),_0x58c949['id']);return getTicket(_0x462512,_0x367efd,_0x58c949,_0x16ddc1,_0x2552ff);})[_0xc944('0x14')](function(_0x4c7f00){if(_0x4c7f00){logger[_0xc944('0xa')]('The\x20Ticket\x20ID\x20is:',_0x4c7f00['id']);}})[_0xc944('0x5d')](function(_0x310186){logger[_0xc944('0x55')](_0xc944('0x5f'),JSON['stringify'](_0x310186));});}; \ 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 7e30c04..0916e37 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 _0x5608=['catch','Recording\x20is\x20enabled!','[ABANDONED]','lodash','request-promise','md5','util','xml2json','entities','moment','zoho','socket.io-emitter','localhost','emit','application/json','info','Creating\x20new\x20call...','merge','inbound','outbound','starttime','agentcalledAt','format','YYYY-MM-DD\x20HH:mm:ss','getString','Fields','lastevent','called','Call\x20Result','Called','connect','rejected','abandoned','talktime','Call\x20Duration','utc','mm:ss','answertime','diff','CONTACTID','LEADID','Leads','SEID','%s','encodeXML','','authToken','crmapi','then','parse','toJson','response','result','recorddetail','Error\x20on\x20call\x20creation:\x20','GET','https://crm.%s/crm/private/json/Users/getUsers','host','AllUsers','users','find','user','Standard','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','error','The\x20failing\x20result\x20is','stringify','Searching\x20enduser\x20with\x20phone','Enduser\x20found\x20in\x20Contacts!','Contacts','row','val','content','https://crm.%s/crm/private/json/Leads/searchRecords','Enduser\x20found\x20in\x20Leads!','length','POST','https://crm.%s/crm/private/xml/Leads/insertRecords','%s%s%s','Enduser\x20created.','https://crm.%s/crm/private/json/Leads/getRecordById','Error\x20on\x20Lead\x20creation:\x20','Error\x20on\x20Lead\x20retrieve:\x20','[HTTP]','forEach','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','queue','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','calleridname','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.%s/crm/EntityInfo.do?module=Calls&id=%s','recordingFormat','none','[OUTBOUND]','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound'];(function(_0x3e4011,_0x1daf18){var _0x43dbbe=function(_0x2d98a7){while(--_0x2d98a7){_0x3e4011['push'](_0x3e4011['shift']());}};_0x43dbbe(++_0x1daf18);}(_0x5608,0x7a));var _0x8560=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x5608[_0x487b0c];return _0x1adbdc;};'use strict';var _=require(_0x8560('0x0'));var rp=require(_0x8560('0x1'));var md5=require(_0x8560('0x2'));var util=require(_0x8560('0x3'));var intUtil=require('./util');var parser=require(_0x8560('0x4'));var entities=require(_0x8560('0x5'));var moment=require(_0x8560('0x6'));var logger=require('../../../../config/logger')(_0x8560('0x7'));var io=require(_0x8560('0x8'))({'host':_0x8560('0x9'),'port':0x18eb});function emit(_0x287e5e,_0x10cc16,_0x231e90){io['to'](_0x287e5e)[_0x8560('0xa')](_0x10cc16,_0x231e90);}var headers={'Content-Type':_0x8560('0xb'),'Accept':'application/json'};function getCall(_0x298cda,_0x4f89b7,_0x26894a,_0x5ca2e0,_0x340380,_0x5974aa){logger[_0x8560('0xc')](_0x8560('0xd'));var _0x20e9f5=_[_0x8560('0xe')]({'SMOWNERID':_0x4f89b7['id'],'Call Type':_0x5974aa||_0x8560('0xf'),'Call Start Time':(_0x5974aa===_0x8560('0x10')?_0x340380[_0x8560('0x11')]:_0x340380[_0x8560('0x12')])||moment()[_0x8560('0x13')](_0x8560('0x14')),'Subject':intUtil[_0x8560('0x15')](_0x5ca2e0['Subjects'],_0x340380,'\x20'),'Description':intUtil[_0x8560('0x15')](_0x5ca2e0['Descriptions'],_0x340380,'\x0a')},getCustomFields(_0x5ca2e0[_0x8560('0x16')],_0x340380));switch(_0x340380[_0x8560('0x17')]){case _0x8560('0x18'):_0x20e9f5[_0x8560('0x19')]=_0x8560('0x1a');break;case'complete':case _0x8560('0x1b'):_0x20e9f5[_0x8560('0x19')]='Answered';break;case _0x8560('0x1c'):_0x20e9f5[_0x8560('0x19')]='Rejected';break;case _0x8560('0x1d'):_0x20e9f5[_0x8560('0x19')]='Abandoned';break;default:}if(_0x340380[_0x8560('0x1e')]){_0x20e9f5[_0x8560('0x1f')]=moment[_0x8560('0x20')](parseInt(_0x340380[_0x8560('0x1e')])*0x3e8)[_0x8560('0x13')](_0x8560('0x21'));}else if(_0x340380[_0x8560('0x22')]&&_0x340380['endtime']){_0x20e9f5[_0x8560('0x1f')]=moment[_0x8560('0x20')](moment(_0x340380['endtime'],'YYYY-MM-DD\x20HH:mm:ss')[_0x8560('0x23')](moment(_0x340380['starttime'],'YYYY-MM-DD\x20HH:mm:ss')))['format'](_0x8560('0x21'));}if(_0x26894a[_0x8560('0x24')]){_0x20e9f5[_0x8560('0x24')]=_0x26894a[_0x8560('0x24')];}else if(_0x26894a[_0x8560('0x25')]){_0x20e9f5['SEMODULE']=_0x8560('0x26');_0x20e9f5[_0x8560('0x27')]=_0x26894a[_0x8560('0x25')];}var _0x1a2fb6='';for(var _0x4c8dd5 in _0x20e9f5){if(_0x20e9f5['hasOwnProperty'](_0x4c8dd5)){_0x1a2fb6+=util[_0x8560('0x13')](_0x8560('0x28'),entities[_0x8560('0x29')](_0x4c8dd5),entities[_0x8560('0x29')](_0x20e9f5[_0x4c8dd5]));}}_0x1a2fb6+=_0x8560('0x2a');return request({'method':'POST','uri':util[_0x8560('0x13')]('https://crm.%s/crm/private/xml/Calls/insertRecords',_0x298cda['host']),'qs':{'authtoken':_0x298cda[_0x8560('0x2b')],'scope':_0x8560('0x2c'),'xmlData':_0x1a2fb6},'json':!![]})[_0x8560('0x2d')](function(_0x4d5dfc){_0x4d5dfc=JSON[_0x8560('0x2e')](parser[_0x8560('0x2f')](_0x4d5dfc));if(_0x4d5dfc[_0x8560('0x30')]){if(_0x4d5dfc['response'][_0x8560('0x31')]&&_0x4d5dfc['response'][_0x8560('0x31')][_0x8560('0x32')]){logger[_0x8560('0xc')]('Call\x20created!');return{'id':_0x4d5dfc[_0x8560('0x30')][_0x8560('0x31')][_0x8560('0x32')]['FL'][0x0]['$t']};}}throw new Error(_0x8560('0x33')+JSON['stringify'](_0x4d5dfc));});}function getUser(_0x3005bf,_0x1b85e8){_0x1b85e8&&logger[_0x8560('0xc')]('Getting\x20agent\x20with\x20email',_0x1b85e8);return request({'method':_0x8560('0x34'),'uri':util[_0x8560('0x13')](_0x8560('0x35'),_0x3005bf[_0x8560('0x36')]),'qs':{'type':_0x8560('0x37'),'authtoken':_0x3005bf[_0x8560('0x2b')],'scope':_0x8560('0x2c')},'json':!![]})[_0x8560('0x2d')](function(_0x409a5c){if(_0x409a5c[_0x8560('0x38')]&&_0x409a5c[_0x8560('0x38')]['user']){var _0x1a2bcd;if(_0x1b85e8){_0x1a2bcd=_[_0x8560('0x39')](_0x409a5c['users'][_0x8560('0x3a')],{'email':_0x1b85e8,'profile':_0x8560('0x3b')});}if(_0x1a2bcd){logger[_0x8560('0xc')](_0x8560('0x3c'));}else{logger[_0x8560('0xc')](_0x8560('0x3d'));_0x1a2bcd=_[_0x8560('0x39')](_0x409a5c[_0x8560('0x38')][_0x8560('0x3a')],{'profile':_0x8560('0x3e')});}return _0x1a2bcd;}else{logger[_0x8560('0x3f')](_0x8560('0x40'),JSON[_0x8560('0x41')](_0x409a5c));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x409a5c));}});}function getEndUser(_0x201e45,_0x1b9437,_0x91c0f2){logger[_0x8560('0xc')](_0x8560('0x42'),_0x91c0f2);return request({'method':_0x8560('0x34'),'uri':util[_0x8560('0x13')]('https://crm.%s/crm/private/json/Contacts/searchRecords',_0x201e45['host']),'qs':{'authtoken':_0x201e45[_0x8560('0x2b')],'scope':_0x8560('0x2c'),'criteria':util[_0x8560('0x13')]('((Phone:%s))',_0x91c0f2)},'json':!![]})[_0x8560('0x2d')](function(_0x149ff9){if(_0x149ff9[_0x8560('0x30')]&&_0x149ff9[_0x8560('0x30')][_0x8560('0x31')]){logger['info'](_0x8560('0x43'));var _0x5d8f2c={};var _0x4c61a2=_0x149ff9[_0x8560('0x30')]['result']['Contacts']['row']['no']?_0x149ff9[_0x8560('0x30')][_0x8560('0x31')][_0x8560('0x44')][_0x8560('0x45')]['FL']:_0x149ff9[_0x8560('0x30')][_0x8560('0x31')][_0x8560('0x44')][_0x8560('0x45')][0x0]['FL'];for(var _0x135c9c=0x0,_0x4f38cc=_0x4c61a2['length'];_0x135c9c<_0x4f38cc;_0x135c9c++){_0x5d8f2c[_0x4c61a2[_0x135c9c][_0x8560('0x46')]]=_0x4c61a2[_0x135c9c][_0x8560('0x47')];}return _0x5d8f2c;}else{return request({'method':'GET','uri':util[_0x8560('0x13')](_0x8560('0x48'),_0x201e45['host']),'qs':{'authtoken':_0x201e45[_0x8560('0x2b')],'scope':_0x8560('0x2c'),'criteria':util['format']('((Phone:%s))',_0x91c0f2)},'json':!![]})['then'](function(_0x25e2f1){if(_0x25e2f1[_0x8560('0x30')]&&_0x25e2f1[_0x8560('0x30')][_0x8560('0x31')]){logger[_0x8560('0xc')](_0x8560('0x49'));var _0x14c220={};var _0x389d97=_0x25e2f1[_0x8560('0x30')][_0x8560('0x31')]['Leads'][_0x8560('0x45')]['no']?_0x25e2f1['response']['result'][_0x8560('0x26')][_0x8560('0x45')]['FL']:_0x25e2f1['response'][_0x8560('0x31')][_0x8560('0x26')][_0x8560('0x45')][0x0]['FL'];for(var _0x3b71da=0x0,_0x16acbc=_0x389d97[_0x8560('0x4a')];_0x3b71da<_0x16acbc;_0x3b71da++){_0x14c220[_0x389d97[_0x3b71da][_0x8560('0x46')]]=_0x389d97[_0x3b71da][_0x8560('0x47')];}return _0x14c220;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');_0x1b9437=getName(_0x1b9437);return request({'method':_0x8560('0x4b'),'uri':util['format'](_0x8560('0x4c'),_0x201e45['host']),'qs':{'authtoken':_0x201e45[_0x8560('0x2b')],'scope':_0x8560('0x2c'),'xmlData':util['format'](_0x8560('0x4d'),entities['encodeXML'](_0x1b9437[0x0]),entities[_0x8560('0x29')](_0x1b9437[0x1]),_0x91c0f2)},'json':!![]})[_0x8560('0x2d')](function(_0x53a70d){_0x53a70d=JSON[_0x8560('0x2e')](parser[_0x8560('0x2f')](_0x53a70d));if(_0x53a70d[_0x8560('0x30')]){if(_0x53a70d['response'][_0x8560('0x31')]&&_0x53a70d[_0x8560('0x30')][_0x8560('0x31')][_0x8560('0x32')]){logger[_0x8560('0xc')](_0x8560('0x4e'));return request({'method':_0x8560('0x34'),'uri':util['format'](_0x8560('0x4f'),_0x201e45[_0x8560('0x36')]),'qs':{'authtoken':_0x201e45[_0x8560('0x2b')],'scope':_0x8560('0x2c'),'id':_0x53a70d[_0x8560('0x30')][_0x8560('0x31')][_0x8560('0x32')]['FL'][0x0]['$t']},'json':!![]});}}throw new Error(_0x8560('0x50')+JSON[_0x8560('0x41')](_0x53a70d));})[_0x8560('0x2d')](function(_0x36d57d){if(_0x36d57d[_0x8560('0x30')]){if(_0x36d57d[_0x8560('0x30')][_0x8560('0x31')]){var _0x3d4b46={};for(var _0x1279ff=0x0,_0x56f5b6=_0x36d57d[_0x8560('0x30')][_0x8560('0x31')][_0x8560('0x26')]['row']['FL']['length'];_0x1279ff<_0x56f5b6;_0x1279ff++){_0x3d4b46[_0x36d57d[_0x8560('0x30')][_0x8560('0x31')][_0x8560('0x26')]['row']['FL'][_0x1279ff][_0x8560('0x46')]]=_0x36d57d[_0x8560('0x30')]['result']['Leads'][_0x8560('0x45')]['FL'][_0x1279ff][_0x8560('0x47')];}return _0x3d4b46;}}throw new Error(_0x8560('0x51')+JSON[_0x8560('0x41')](_0x36d57d));});}});}});}function request(_0x5eb234){logger['debug'](_0x8560('0x52'),JSON[_0x8560('0x41')](_0x5eb234));return rp(_0x5eb234);}function getCustomFields(_0x291dd9,_0x1d1f83){var _0x5dc155={};if(_0x291dd9[_0x8560('0x4a')]>0x0){_[_0x8560('0x53')](_0x291dd9,function(_0x14ab8d){if(_0x14ab8d[_0x8560('0x54')]==='string'&&_0x14ab8d[_0x8560('0x55')]){_0x5dc155[_0x14ab8d['idField']]=_0x14ab8d['content'][_0x8560('0x56')]();}else if(_0x14ab8d[_0x8560('0x54')]===_0x8560('0x57')&&_0x14ab8d[_0x8560('0x58')]&&_0x14ab8d['idField']&&_0x1d1f83[_0x14ab8d[_0x8560('0x58')]]){_0x5dc155[_0x14ab8d['idField']]=_0x1d1f83[_0x14ab8d['variableName']][_0x8560('0x56')]();}else if(_0x14ab8d[_0x8560('0x54')]===_0x8560('0x59')&&_0x14ab8d[_0x8560('0x5a')]&&_0x14ab8d[_0x8560('0x5a')][_0x8560('0x5b')]&&_0x14ab8d[_0x8560('0x55')]&&_0x1d1f83[_0x14ab8d[_0x8560('0x5a')]['name'][_0x8560('0x5c')]()]){_0x5dc155[_0x14ab8d['idField']]=_0x1d1f83[_0x14ab8d['Variable'][_0x8560('0x5b')][_0x8560('0x5c')]()][_0x8560('0x56')]();}});}return _0x5dc155;}function getName(_0x4df5ec){if(_0x4df5ec[_0x8560('0x5d')]('\x20')>0x0){var _0x28577b=_0x4df5ec['split'](/ (.+)/);if(_0x28577b[0x1]){return _0x28577b;}}return[_0x4df5ec,_0x4df5ec];}exports[_0x8560('0x5e')]=function(_0x435891,_0xa0325,_0x21110a,_0x4e2e1b,_0x27301e,_0x39d4e1){var _0x543593,_0x5d9a1a;if(_0x27301e&&_0x27301e[_0x8560('0x5f')]){logger[_0x8560('0xc')]('[QUEUE]','Recording\x20is\x20enabled!');_0xa0325[_0x8560('0x60')]=util[_0x8560('0x13')](_0x8560('0x61'),_0x39d4e1[_0x8560('0x62')],_0xa0325[_0x8560('0x63')],md5(_0xa0325['uniqueid']));}else{_0xa0325['recordingURL']='';}return getUser(_0x39d4e1,_0x4e2e1b['email'])[_0x8560('0x2d')](function(_0x53771b){_0x543593=_0x53771b;logger[_0x8560('0xc')]('The\x20User\x20ID\x20is:',_0x543593['id']);return getEndUser(_0x39d4e1,_0xa0325[_0x8560('0x64')],_0xa0325['calleridnum']);})[_0x8560('0x2d')](function(_0x5a7abb){_0x5d9a1a=_0x5a7abb;logger['info']('The\x20Enduser\x20ID\x20is:',_0x5d9a1a[_0x8560('0x24')]||_0x5d9a1a[_0x8560('0x25')]);return getCall(_0x39d4e1,_0x543593,_0x5d9a1a,_0x21110a,_0xa0325,'Inbound');})['then'](function(_0x1f02b7){if(_0x1f02b7){logger['info'](_0x8560('0x65'),_0x1f02b7['id']);logger['info'](_0x8560('0x66'),_0x8560('0x67'));emit(util[_0x8560('0x13')](_0x8560('0x68'),_0x4e2e1b[_0x8560('0x5b')]),_0x8560('0x69'),{'uri':util[_0x8560('0x13')](_0x8560('0x6a'),_0x39d4e1[_0x8560('0x36')],_0x1f02b7['id'])});}})['catch'](function(_0x26cdf7){logger[_0x8560('0x3f')](_0x8560('0x66'),JSON['stringify'](_0x26cdf7));});};exports['outbound']=function(_0x3fb5b6,_0x808288,_0x47c1e6,_0x2695c5,_0x2ca259,_0x46616e,_0x2ba148){var _0x36bb86,_0x2e3529;if(_0x2ba148&&_0x2ba148[_0x8560('0x6b')]&&_0x2ba148['recordingFormat']!==_0x8560('0x6c')){logger[_0x8560('0xc')](_0x8560('0x6d'),'Recording\x20is\x20enabled!');_0x808288['recordingURL']=util['format'](_0x8560('0x61'),_0x46616e[_0x8560('0x62')],_0x808288[_0x8560('0x63')],md5(_0x808288[_0x8560('0x63')]));}return getUser(_0x46616e,_0x2695c5[_0x8560('0x6e')])['then'](function(_0x123e33){_0x36bb86=_0x123e33;logger[_0x8560('0xc')](_0x8560('0x6f'),_0x36bb86['id']);return getEndUser(_0x46616e,_0x808288[_0x8560('0x70')],_0x808288[_0x8560('0x71')]);})[_0x8560('0x2d')](function(_0xf85539){_0x2e3529=_0xf85539;logger[_0x8560('0xc')](_0x8560('0x72'),_0x2e3529[_0x8560('0x24')]||_0x2e3529[_0x8560('0x25')]);return getCall(_0x46616e,_0x36bb86,_0x2e3529,_0x47c1e6,_0x808288,_0x8560('0x73'));})[_0x8560('0x2d')](function(_0x4e90c2){if(_0x4e90c2){logger[_0x8560('0xc')](_0x8560('0x65'),_0x4e90c2['id']);logger[_0x8560('0xc')](_0x8560('0x6d'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8560('0x13')](_0x8560('0x68'),_0x2695c5[_0x8560('0x5b')]),_0x8560('0x69'),{'uri':util[_0x8560('0x13')](_0x8560('0x6a'),_0x46616e[_0x8560('0x36')],_0x4e90c2['id'])});}})[_0x8560('0x74')](function(_0x7bd687){logger[_0x8560('0x3f')](_0x8560('0x6d'),JSON[_0x8560('0x41')](_0x7bd687));});};exports['abandoned']=function(_0x29beb1,_0x536266,_0x2f57bb,_0x5359e3,_0x2a9a42,_0x26a162){var _0xd756fa,_0x5451a9;if(_0x2a9a42&&_0x2a9a42[_0x8560('0x5f')]){logger[_0x8560('0xc')]('[ABANDONED]',_0x8560('0x75'));_0x536266[_0x8560('0x60')]=util[_0x8560('0x13')](_0x8560('0x61'),_0x26a162['serverUrl'],_0x536266[_0x8560('0x63')],md5(_0x536266['uniqueid']));}else{_0x536266[_0x8560('0x60')]='';}return getUser(_0x26a162)[_0x8560('0x2d')](function(_0x18428e){_0xd756fa=_0x18428e;logger[_0x8560('0xc')](_0x8560('0x6f'),_0xd756fa['id']);return getEndUser(_0x26a162,_0x536266[_0x8560('0x64')],_0x536266['calleridnum']);})[_0x8560('0x2d')](function(_0x5cf81f){_0x5451a9=_0x5cf81f;logger[_0x8560('0xc')](_0x8560('0x72'),_0x5451a9[_0x8560('0x24')]||_0x5451a9[_0x8560('0x25')]);return getCall(_0x26a162,_0xd756fa,_0x5451a9,_0x2f57bb,_0x536266,'Inbound');})[_0x8560('0x2d')](function(_0x489505){if(_0x489505){logger['info']('The\x20Call\x20ID\x20is:',_0x489505['id']);}})['catch'](function(_0x2e309e){logger[_0x8560('0x3f')](_0x8560('0x76'),JSON[_0x8560('0x41')](_0x2e309e));});}; \ No newline at end of file +var _0x4ee5=['md5','./util','xml2json','entities','moment','../../../../config/logger','zoho','localhost','emit','application/json','Creating\x20new\x20call...','merge','inbound','outbound','agentcalledAt','format','YYYY-MM-DD\x20HH:mm:ss','getString','Subjects','Descriptions','called','Call\x20Result','Called','connect','Answered','rejected','Rejected','abandoned','Abandoned','talktime','Call\x20Duration','utc','mm:ss','answertime','diff','CONTACTID','Leads','SEID','LEADID','','hasOwnProperty','encodeXML','','POST','https://crm.%s/crm/private/xml/Calls/insertRecords','host','authToken','crmapi','then','toJson','response','result','recorddetail','info','Call\x20created!','Error\x20on\x20call\x20creation:\x20','stringify','Getting\x20agent\x20with\x20email','GET','https://crm.%s/crm/private/json/Users/getUsers','AllUsers','users','find','user','Agent\x20found!','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','https://crm.%s/crm/private/json/Contacts/searchRecords','((Phone:%s))','Enduser\x20found\x20in\x20Contacts!','Contacts','row','length','content','https://crm.%s/crm/private/json/Leads/searchRecords','Enduser\x20found\x20in\x20Leads!','https://crm.%s/crm/private/xml/Leads/insertRecords','%s%s%s','https://crm.%s/crm/private/json/Leads/getRecordById','Error\x20on\x20Lead\x20creation:\x20','val','Error\x20on\x20Lead\x20retrieve:\x20','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','queue','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.%s/crm/EntityInfo.do?module=Calls&id=%s','catch','[QUEUE]','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','Outbound','user:%s','[ABANDONED]','Inbound','lodash','request-promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4ee5,0x1ea));var _0x54ee=function(_0x47e4d5,_0x39e863){_0x47e4d5=_0x47e4d5-0x0;var _0x58b5be=_0x4ee5[_0x47e4d5];return _0x58b5be;};'use strict';var _=require(_0x54ee('0x0'));var rp=require(_0x54ee('0x1'));var md5=require(_0x54ee('0x2'));var util=require('util');var intUtil=require(_0x54ee('0x3'));var parser=require(_0x54ee('0x4'));var entities=require(_0x54ee('0x5'));var moment=require(_0x54ee('0x6'));var logger=require(_0x54ee('0x7'))(_0x54ee('0x8'));var io=require('socket.io-emitter')({'host':_0x54ee('0x9'),'port':0x18eb});function emit(_0x51ed3a,_0x53fd7e,_0x5d8285){io['to'](_0x51ed3a)[_0x54ee('0xa')](_0x53fd7e,_0x5d8285);}var headers={'Content-Type':_0x54ee('0xb'),'Accept':_0x54ee('0xb')};function getCall(_0x2746e1,_0x26e221,_0x1df88d,_0x23f26c,_0x108be6,_0xf95482){logger['info'](_0x54ee('0xc'));var _0x4b2f7c=_[_0x54ee('0xd')]({'SMOWNERID':_0x26e221['id'],'Call Type':_0xf95482||_0x54ee('0xe'),'Call Start Time':(_0xf95482===_0x54ee('0xf')?_0x108be6['starttime']:_0x108be6[_0x54ee('0x10')])||moment()[_0x54ee('0x11')](_0x54ee('0x12')),'Subject':intUtil[_0x54ee('0x13')](_0x23f26c[_0x54ee('0x14')],_0x108be6,'\x20'),'Description':intUtil[_0x54ee('0x13')](_0x23f26c[_0x54ee('0x15')],_0x108be6,'\x0a')},getCustomFields(_0x23f26c['Fields'],_0x108be6));switch(_0x108be6['lastevent']){case _0x54ee('0x16'):_0x4b2f7c[_0x54ee('0x17')]=_0x54ee('0x18');break;case'complete':case _0x54ee('0x19'):_0x4b2f7c[_0x54ee('0x17')]=_0x54ee('0x1a');break;case _0x54ee('0x1b'):_0x4b2f7c[_0x54ee('0x17')]=_0x54ee('0x1c');break;case _0x54ee('0x1d'):_0x4b2f7c['Call\x20Result']=_0x54ee('0x1e');break;default:}if(_0x108be6[_0x54ee('0x1f')]){_0x4b2f7c[_0x54ee('0x20')]=moment[_0x54ee('0x21')](parseInt(_0x108be6['talktime'])*0x3e8)[_0x54ee('0x11')](_0x54ee('0x22'));}else if(_0x108be6[_0x54ee('0x23')]&&_0x108be6['endtime']){_0x4b2f7c[_0x54ee('0x20')]=moment['utc'](moment(_0x108be6['endtime'],'YYYY-MM-DD\x20HH:mm:ss')[_0x54ee('0x24')](moment(_0x108be6['starttime'],_0x54ee('0x12'))))['format'](_0x54ee('0x22'));}if(_0x1df88d[_0x54ee('0x25')]){_0x4b2f7c['CONTACTID']=_0x1df88d[_0x54ee('0x25')];}else if(_0x1df88d['LEADID']){_0x4b2f7c['SEMODULE']=_0x54ee('0x26');_0x4b2f7c[_0x54ee('0x27')]=_0x1df88d[_0x54ee('0x28')];}var _0x1adca6=_0x54ee('0x29');for(var _0x544c56 in _0x4b2f7c){if(_0x4b2f7c[_0x54ee('0x2a')](_0x544c56)){_0x1adca6+=util['format']('%s',entities['encodeXML'](_0x544c56),entities[_0x54ee('0x2b')](_0x4b2f7c[_0x544c56]));}}_0x1adca6+=_0x54ee('0x2c');return request({'method':_0x54ee('0x2d'),'uri':util['format'](_0x54ee('0x2e'),_0x2746e1[_0x54ee('0x2f')]),'qs':{'authtoken':_0x2746e1[_0x54ee('0x30')],'scope':_0x54ee('0x31'),'xmlData':_0x1adca6},'json':!![]})[_0x54ee('0x32')](function(_0x5cd338){_0x5cd338=JSON['parse'](parser[_0x54ee('0x33')](_0x5cd338));if(_0x5cd338[_0x54ee('0x34')]){if(_0x5cd338['response'][_0x54ee('0x35')]&&_0x5cd338['response'][_0x54ee('0x35')][_0x54ee('0x36')]){logger[_0x54ee('0x37')](_0x54ee('0x38'));return{'id':_0x5cd338[_0x54ee('0x34')]['result'][_0x54ee('0x36')]['FL'][0x0]['$t']};}}throw new Error(_0x54ee('0x39')+JSON[_0x54ee('0x3a')](_0x5cd338));});}function getUser(_0x289d7b,_0x4c262b){_0x4c262b&&logger['info'](_0x54ee('0x3b'),_0x4c262b);return request({'method':_0x54ee('0x3c'),'uri':util[_0x54ee('0x11')](_0x54ee('0x3d'),_0x289d7b[_0x54ee('0x2f')]),'qs':{'type':_0x54ee('0x3e'),'authtoken':_0x289d7b[_0x54ee('0x30')],'scope':_0x54ee('0x31')},'json':!![]})['then'](function(_0x2e8dd8){if(_0x2e8dd8[_0x54ee('0x3f')]&&_0x2e8dd8[_0x54ee('0x3f')]['user']){var _0xb21d0a;if(_0x4c262b){_0xb21d0a=_[_0x54ee('0x40')](_0x2e8dd8[_0x54ee('0x3f')][_0x54ee('0x41')],{'email':_0x4c262b,'profile':'Standard'});}if(_0xb21d0a){logger[_0x54ee('0x37')](_0x54ee('0x42'));}else{logger['info']('Using\x20the\x20admin\x20account!');_0xb21d0a=_[_0x54ee('0x40')](_0x2e8dd8[_0x54ee('0x3f')][_0x54ee('0x41')],{'profile':'Administrator'});}return _0xb21d0a;}else{logger[_0x54ee('0x43')](_0x54ee('0x44'),JSON[_0x54ee('0x3a')](_0x2e8dd8));throw new Error(_0x54ee('0x45')+JSON[_0x54ee('0x3a')](_0x2e8dd8));}});}function getEndUser(_0x5c7b15,_0x19208e,_0x267a84){logger[_0x54ee('0x37')]('Searching\x20enduser\x20with\x20phone',_0x267a84);return request({'method':_0x54ee('0x3c'),'uri':util[_0x54ee('0x11')](_0x54ee('0x46'),_0x5c7b15[_0x54ee('0x2f')]),'qs':{'authtoken':_0x5c7b15[_0x54ee('0x30')],'scope':'crmapi','criteria':util[_0x54ee('0x11')](_0x54ee('0x47'),_0x267a84)},'json':!![]})[_0x54ee('0x32')](function(_0xf72f3f){if(_0xf72f3f[_0x54ee('0x34')]&&_0xf72f3f['response'][_0x54ee('0x35')]){logger['info'](_0x54ee('0x48'));var _0x56c738={};var _0x5ed69d=_0xf72f3f['response'][_0x54ee('0x35')][_0x54ee('0x49')][_0x54ee('0x4a')]['no']?_0xf72f3f[_0x54ee('0x34')][_0x54ee('0x35')][_0x54ee('0x49')][_0x54ee('0x4a')]['FL']:_0xf72f3f['response'][_0x54ee('0x35')][_0x54ee('0x49')]['row'][0x0]['FL'];for(var _0x577235=0x0,_0x5c3e09=_0x5ed69d[_0x54ee('0x4b')];_0x577235<_0x5c3e09;_0x577235++){_0x56c738[_0x5ed69d[_0x577235]['val']]=_0x5ed69d[_0x577235][_0x54ee('0x4c')];}return _0x56c738;}else{return request({'method':'GET','uri':util[_0x54ee('0x11')](_0x54ee('0x4d'),_0x5c7b15[_0x54ee('0x2f')]),'qs':{'authtoken':_0x5c7b15[_0x54ee('0x30')],'scope':'crmapi','criteria':util['format'](_0x54ee('0x47'),_0x267a84)},'json':!![]})[_0x54ee('0x32')](function(_0x165a39){if(_0x165a39['response']&&_0x165a39[_0x54ee('0x34')][_0x54ee('0x35')]){logger['info'](_0x54ee('0x4e'));var _0xaf6240={};var _0x54fcb1=_0x165a39[_0x54ee('0x34')][_0x54ee('0x35')][_0x54ee('0x26')][_0x54ee('0x4a')]['no']?_0x165a39[_0x54ee('0x34')][_0x54ee('0x35')][_0x54ee('0x26')][_0x54ee('0x4a')]['FL']:_0x165a39[_0x54ee('0x34')][_0x54ee('0x35')][_0x54ee('0x26')]['row'][0x0]['FL'];for(var _0x4a31b9=0x0,_0x51a945=_0x54fcb1[_0x54ee('0x4b')];_0x4a31b9<_0x51a945;_0x4a31b9++){_0xaf6240[_0x54fcb1[_0x4a31b9]['val']]=_0x54fcb1[_0x4a31b9][_0x54ee('0x4c')];}return _0xaf6240;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');_0x19208e=getName(_0x19208e);return request({'method':_0x54ee('0x2d'),'uri':util[_0x54ee('0x11')](_0x54ee('0x4f'),_0x5c7b15[_0x54ee('0x2f')]),'qs':{'authtoken':_0x5c7b15[_0x54ee('0x30')],'scope':'crmapi','xmlData':util['format'](_0x54ee('0x50'),entities[_0x54ee('0x2b')](_0x19208e[0x0]),entities['encodeXML'](_0x19208e[0x1]),_0x267a84)},'json':!![]})[_0x54ee('0x32')](function(_0x45c7a8){_0x45c7a8=JSON['parse'](parser[_0x54ee('0x33')](_0x45c7a8));if(_0x45c7a8[_0x54ee('0x34')]){if(_0x45c7a8[_0x54ee('0x34')][_0x54ee('0x35')]&&_0x45c7a8[_0x54ee('0x34')]['result'][_0x54ee('0x36')]){logger[_0x54ee('0x37')]('Enduser\x20created.');return request({'method':_0x54ee('0x3c'),'uri':util['format'](_0x54ee('0x51'),_0x5c7b15[_0x54ee('0x2f')]),'qs':{'authtoken':_0x5c7b15[_0x54ee('0x30')],'scope':'crmapi','id':_0x45c7a8[_0x54ee('0x34')][_0x54ee('0x35')]['recorddetail']['FL'][0x0]['$t']},'json':!![]});}}throw new Error(_0x54ee('0x52')+JSON[_0x54ee('0x3a')](_0x45c7a8));})['then'](function(_0x3d7e52){if(_0x3d7e52[_0x54ee('0x34')]){if(_0x3d7e52[_0x54ee('0x34')][_0x54ee('0x35')]){var _0x2e7e8e={};for(var _0x598bc5=0x0,_0x169305=_0x3d7e52[_0x54ee('0x34')][_0x54ee('0x35')]['Leads'][_0x54ee('0x4a')]['FL'][_0x54ee('0x4b')];_0x598bc5<_0x169305;_0x598bc5++){_0x2e7e8e[_0x3d7e52[_0x54ee('0x34')][_0x54ee('0x35')]['Leads']['row']['FL'][_0x598bc5][_0x54ee('0x53')]]=_0x3d7e52[_0x54ee('0x34')][_0x54ee('0x35')][_0x54ee('0x26')]['row']['FL'][_0x598bc5][_0x54ee('0x4c')];}return _0x2e7e8e;}}throw new Error(_0x54ee('0x54')+JSON['stringify'](_0x3d7e52));});}});}});}function request(_0x42c0c7){logger['debug']('[HTTP]',JSON['stringify'](_0x42c0c7));return rp(_0x42c0c7);}function getCustomFields(_0x50f287,_0x394568){var _0x30cf92={};if(_0x50f287[_0x54ee('0x4b')]>0x0){_['forEach'](_0x50f287,function(_0x1f61f8){if(_0x1f61f8[_0x54ee('0x55')]==='string'&&_0x1f61f8['idField']){_0x30cf92[_0x1f61f8[_0x54ee('0x56')]]=_0x1f61f8[_0x54ee('0x4c')][_0x54ee('0x57')]();}else if(_0x1f61f8[_0x54ee('0x55')]===_0x54ee('0x58')&&_0x1f61f8['variableName']&&_0x1f61f8[_0x54ee('0x56')]&&_0x394568[_0x1f61f8[_0x54ee('0x59')]]){_0x30cf92[_0x1f61f8[_0x54ee('0x56')]]=_0x394568[_0x1f61f8[_0x54ee('0x59')]][_0x54ee('0x57')]();}else if(_0x1f61f8[_0x54ee('0x55')]===_0x54ee('0x5a')&&_0x1f61f8[_0x54ee('0x5b')]&&_0x1f61f8['Variable']['name']&&_0x1f61f8[_0x54ee('0x56')]&&_0x394568[_0x1f61f8[_0x54ee('0x5b')][_0x54ee('0x5c')][_0x54ee('0x5d')]()]){_0x30cf92[_0x1f61f8[_0x54ee('0x56')]]=_0x394568[_0x1f61f8[_0x54ee('0x5b')][_0x54ee('0x5c')]['toLowerCase']()][_0x54ee('0x57')]();}});}return _0x30cf92;}function getName(_0x35f6ef){if(_0x35f6ef[_0x54ee('0x5e')]('\x20')>0x0){var _0x48f803=_0x35f6ef[_0x54ee('0x5f')](/ (.+)/);if(_0x48f803[0x1]){return _0x48f803;}}return[_0x35f6ef,_0x35f6ef];}exports[_0x54ee('0x60')]=function(_0x3fbb0a,_0x2dbd59,_0x30cf46,_0xc07850,_0x1bfd9,_0x564262){var _0x361a3a,_0x415805;if(_0x1bfd9&&_0x1bfd9[_0x54ee('0x61')]){logger['info']('[QUEUE]',_0x54ee('0x62'));_0x2dbd59[_0x54ee('0x63')]=util['format'](_0x54ee('0x64'),_0x564262[_0x54ee('0x65')],_0x2dbd59[_0x54ee('0x66')],md5(_0x2dbd59[_0x54ee('0x66')]));}else{_0x2dbd59[_0x54ee('0x63')]='';}return getUser(_0x564262,_0xc07850['email'])[_0x54ee('0x32')](function(_0x14a0dd){_0x361a3a=_0x14a0dd;logger[_0x54ee('0x37')](_0x54ee('0x67'),_0x361a3a['id']);return getEndUser(_0x564262,_0x2dbd59[_0x54ee('0x68')],_0x2dbd59[_0x54ee('0x69')]);})[_0x54ee('0x32')](function(_0x52a7f5){_0x415805=_0x52a7f5;logger['info'](_0x54ee('0x6a'),_0x415805[_0x54ee('0x25')]||_0x415805[_0x54ee('0x28')]);return getCall(_0x564262,_0x361a3a,_0x415805,_0x30cf46,_0x2dbd59,'Inbound');})['then'](function(_0x193b5f){if(_0x193b5f){logger['info'](_0x54ee('0x6b'),_0x193b5f['id']);logger[_0x54ee('0x37')]('[QUEUE]',_0x54ee('0x6c'));emit(util[_0x54ee('0x11')]('user:%s',_0xc07850['name']),_0x54ee('0x6d'),{'uri':util['format'](_0x54ee('0x6e'),_0x564262[_0x54ee('0x2f')],_0x193b5f['id'])});}})[_0x54ee('0x6f')](function(_0x2a4c2c){logger[_0x54ee('0x43')](_0x54ee('0x70'),JSON[_0x54ee('0x3a')](_0x2a4c2c));});};exports[_0x54ee('0xf')]=function(_0x1f769a,_0x46b166,_0x1b060d,_0x374703,_0x4b7ed2,_0x4aedf8,_0x34e30a){var _0x4cbb79,_0x3033d6;if(_0x34e30a&&_0x34e30a[_0x54ee('0x71')]&&_0x34e30a[_0x54ee('0x71')]!==_0x54ee('0x72')){logger[_0x54ee('0x37')](_0x54ee('0x73'),'Recording\x20is\x20enabled!');_0x46b166[_0x54ee('0x63')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4aedf8[_0x54ee('0x65')],_0x46b166[_0x54ee('0x66')],md5(_0x46b166['uniqueid']));}return getUser(_0x4aedf8,_0x374703[_0x54ee('0x74')])[_0x54ee('0x32')](function(_0x20a902){_0x4cbb79=_0x20a902;logger[_0x54ee('0x37')](_0x54ee('0x67'),_0x4cbb79['id']);return getEndUser(_0x4aedf8,_0x46b166[_0x54ee('0x75')],_0x46b166[_0x54ee('0x76')]);})[_0x54ee('0x32')](function(_0x4baff5){_0x3033d6=_0x4baff5;logger[_0x54ee('0x37')](_0x54ee('0x6a'),_0x3033d6[_0x54ee('0x25')]||_0x3033d6[_0x54ee('0x28')]);return getCall(_0x4aedf8,_0x4cbb79,_0x3033d6,_0x1b060d,_0x46b166,_0x54ee('0x77'));})[_0x54ee('0x32')](function(_0x4c2c52){if(_0x4c2c52){logger[_0x54ee('0x37')]('The\x20Call\x20ID\x20is:',_0x4c2c52['id']);logger[_0x54ee('0x37')](_0x54ee('0x73'),_0x54ee('0x6c'));emit(util[_0x54ee('0x11')](_0x54ee('0x78'),_0x374703[_0x54ee('0x5c')]),_0x54ee('0x6d'),{'uri':util[_0x54ee('0x11')](_0x54ee('0x6e'),_0x4aedf8[_0x54ee('0x2f')],_0x4c2c52['id'])});}})[_0x54ee('0x6f')](function(_0x2b9988){logger['error']('[OUTBOUND]',JSON[_0x54ee('0x3a')](_0x2b9988));});};exports[_0x54ee('0x1d')]=function(_0x24afd6,_0x3afef1,_0x594265,_0x14d0b9,_0x438e7f,_0x13c509){var _0x351dd4,_0x520e92;if(_0x438e7f&&_0x438e7f[_0x54ee('0x61')]){logger[_0x54ee('0x37')](_0x54ee('0x79'),_0x54ee('0x62'));_0x3afef1[_0x54ee('0x63')]=util[_0x54ee('0x11')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x13c509[_0x54ee('0x65')],_0x3afef1[_0x54ee('0x66')],md5(_0x3afef1[_0x54ee('0x66')]));}else{_0x3afef1[_0x54ee('0x63')]='';}return getUser(_0x13c509)[_0x54ee('0x32')](function(_0xedb7be){_0x351dd4=_0xedb7be;logger[_0x54ee('0x37')](_0x54ee('0x67'),_0x351dd4['id']);return getEndUser(_0x13c509,_0x3afef1[_0x54ee('0x68')],_0x3afef1[_0x54ee('0x69')]);})[_0x54ee('0x32')](function(_0x548106){_0x520e92=_0x548106;logger[_0x54ee('0x37')](_0x54ee('0x6a'),_0x520e92[_0x54ee('0x25')]||_0x520e92[_0x54ee('0x28')]);return getCall(_0x13c509,_0x351dd4,_0x520e92,_0x594265,_0x3afef1,_0x54ee('0x7a'));})[_0x54ee('0x32')](function(_0x5647e5){if(_0x5647e5){logger[_0x54ee('0x37')](_0x54ee('0x6b'),_0x5647e5['id']);}})[_0x54ee('0x6f')](function(_0xa61865){logger['error'](_0x54ee('0x79'),JSON[_0x54ee('0x3a')](_0xa61865));});}; \ 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 0030e00..c805efd 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 _0x4683=['GET','POST','data7','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20body:\x20%s','statusCode','body','catch','error','name','message','trigger','exec','data1','render','data2','toUpperCase'];(function(_0x18b2bd,_0x4efc00){var _0xce6d48=function(_0xbd3eb1){while(--_0xbd3eb1){_0x18b2bd['push'](_0x18b2bd['shift']());}};_0xce6d48(++_0x4efc00);}(_0x4683,0xb5));var _0x3468=function(_0x332768,_0x50ee09){_0x332768=_0x332768-0x0;var _0x27c669=_0x4683[_0x332768];return _0x27c669;};'use strict';var rp=require('request-promise');var util=require('util');var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x3468('0x0'));exports[_0x3468('0x1')]=function(_0x596213,_0xe5ce17){var _0x10b5b1={'method':_0x596213[_0x3468('0x2')]['toUpperCase'](),'uri':encodeURI(Mustache[_0x3468('0x3')](_0x596213[_0x3468('0x4')],_0xe5ce17)),'json':!![],'resolveWithFullResponse':!![]};switch(_0x596213[_0x3468('0x2')][_0x3468('0x5')]()){case _0x3468('0x6'):_0x10b5b1['qs']=_0xe5ce17;break;case _0x3468('0x7'):_0x10b5b1['body']=_0x596213[_0x3468('0x8')]?Mustache[_0x3468('0x3')](_0x596213['data7'],_0xe5ce17):_0xe5ce17;break;}rp(_0x10b5b1)['then'](function(_0x343ce7){logger[_0x3468('0x9')](util['format'](_0x3468('0xa'),_0x596213['data1'],_0x596213[_0x3468('0x4')],_0x343ce7[_0x3468('0xb')],_0x343ce7[_0x3468('0xc')]));})[_0x3468('0xd')](function(_0x150c7f){logger[_0x3468('0xe')](util['format']('%s\x20%s\x20%s\x20[%s]:%s',_0x596213[_0x3468('0x2')],_0x596213[_0x3468('0x4')],_0x150c7f[_0x3468('0xb')],_0x150c7f[_0x3468('0xf')],_0x150c7f[_0x3468('0x10')]));});}; \ No newline at end of file +var _0xac1a=['mustache','../../../../config/logger','exec','data1','render','data2','GET','data7','then','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20body:\x20%s','statusCode','catch','error','format','name','request-promise','util'];(function(_0x4ccae4,_0x1d2c4e){var _0x3fc6c4=function(_0x5dd12e){while(--_0x5dd12e){_0x4ccae4['push'](_0x4ccae4['shift']());}};_0x3fc6c4(++_0x1d2c4e);}(_0xac1a,0x11f));var _0xaac1=function(_0x501808,_0x3a2b99){_0x501808=_0x501808-0x0;var _0x548c1e=_0xac1a[_0x501808];return _0x548c1e;};'use strict';var rp=require(_0xaac1('0x0'));var util=require(_0xaac1('0x1'));var Mustache=require(_0xaac1('0x2'));var logger=require(_0xaac1('0x3'))('trigger');exports[_0xaac1('0x4')]=function(_0x121779,_0x2c9f57){var _0x27f743={'method':_0x121779[_0xaac1('0x5')]['toUpperCase'](),'uri':encodeURI(Mustache[_0xaac1('0x6')](_0x121779[_0xaac1('0x7')],_0x2c9f57)),'json':!![],'resolveWithFullResponse':!![]};switch(_0x121779['data1']['toUpperCase']()){case _0xaac1('0x8'):_0x27f743['qs']=_0x2c9f57;break;case'POST':_0x27f743['body']=_0x121779['data7']?Mustache[_0xaac1('0x6')](_0x121779[_0xaac1('0x9')],_0x2c9f57):_0x2c9f57;break;}rp(_0x27f743)[_0xaac1('0xa')](function(_0x2a6fab){logger['info'](util['format'](_0xaac1('0xb'),_0x121779[_0xaac1('0x5')],_0x121779[_0xaac1('0x7')],_0x2a6fab[_0xaac1('0xc')],_0x2a6fab['body']));})[_0xaac1('0xd')](function(_0x49a840){logger[_0xaac1('0xe')](util[_0xaac1('0xf')]('%s\x20%s\x20%s\x20[%s]:%s',_0x121779[_0xaac1('0x5')],_0x121779[_0xaac1('0x7')],_0x49a840[_0xaac1('0xc')],_0x49a840[_0xaac1('0x10')],_0x49a840['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 90ae4e6..11e04b7 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 _0x50b9=['then','debug','rpc','routing','error','message','result','catch','exports','jayson/promise','../../config/logger','client','http','Request','request'];(function(_0xe73228,_0x226565){var _0x3288ea=function(_0xcf0598){while(--_0xcf0598){_0xe73228['push'](_0xe73228['shift']());}};_0x3288ea(++_0x226565);}(_0x50b9,0x171));var _0x950b=function(_0x1ab683,_0x27030b){_0x1ab683=_0x1ab683-0x0;var _0x357546=_0x50b9[_0x1ab683];return _0x357546;};'use strict';var jayson=require(_0x950b('0x0'));var BPromise=require('bluebird');var logger=require(_0x950b('0x1'))('routing');var client=jayson[_0x950b('0x2')][_0x950b('0x3')]({'port':0x2329});client[_0x950b('0x4')]=function(_0x3f68be,_0x237b83){return new BPromise(function(_0x986b16,_0x23b70f){return client[_0x950b('0x5')](_0x3f68be,_0x237b83)[_0x950b('0x6')](function(_0x56ce3f){logger[_0x950b('0x7')](_0x950b('0x8'),_0x950b('0x9'),_0x3f68be,_0x237b83,_0x56ce3f);if(_0x56ce3f['error']){logger['error']('rpc',_0x950b('0x9'),_0x3f68be,_0x56ce3f[_0x950b('0xa')][_0x950b('0xb')],_0x237b83);return _0x23b70f(_0x56ce3f[_0x950b('0xa')][_0x950b('0xb')]);}else{return _0x986b16(_0x56ce3f[_0x950b('0xc')]);}})[_0x950b('0xd')](function(_0x585c89){logger[_0x950b('0xa')](_0x950b('0x8'),'routing',_0x3f68be,_0x585c89,_0x237b83);return _0x23b70f(_0x585c89);});});};module[_0x950b('0xe')]=client; \ No newline at end of file +var _0xbacb=['catch','exports','jayson/promise','bluebird','routing','client','http','Request','request','then','debug','error','rpc','message','result'];(function(_0x315d84,_0x3dacc3){var _0x560da1=function(_0x22ccb0){while(--_0x22ccb0){_0x315d84['push'](_0x315d84['shift']());}};_0x560da1(++_0x3dacc3);}(_0xbacb,0x1a6));var _0xbbac=function(_0x58d689,_0x27e9a3){_0x58d689=_0x58d689-0x0;var _0x226c77=_0xbacb[_0x58d689];return _0x226c77;};'use strict';var jayson=require(_0xbbac('0x0'));var BPromise=require(_0xbbac('0x1'));var logger=require('../../config/logger')(_0xbbac('0x2'));var client=jayson[_0xbbac('0x3')][_0xbbac('0x4')]({'port':0x2329});client[_0xbbac('0x5')]=function(_0x3286fe,_0x97ea61){return new BPromise(function(_0x4e3698,_0x579be8){return client[_0xbbac('0x6')](_0x3286fe,_0x97ea61)[_0xbbac('0x7')](function(_0x210763){logger[_0xbbac('0x8')]('rpc',_0xbbac('0x2'),_0x3286fe,_0x97ea61,_0x210763);if(_0x210763[_0xbbac('0x9')]){logger[_0xbbac('0x9')](_0xbbac('0xa'),_0xbbac('0x2'),_0x3286fe,_0x210763[_0xbbac('0x9')]['message'],_0x97ea61);return _0x579be8(_0x210763[_0xbbac('0x9')][_0xbbac('0xb')]);}else{return _0x4e3698(_0x210763[_0xbbac('0xc')]);}})[_0xbbac('0xd')](function(_0x18464e){logger['error']('rpc',_0xbbac('0x2'),_0x3286fe,_0x18464e,_0x97ea61);return _0x579be8(_0x18464e);});});};module[_0xbbac('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 8eaf4c4..c167432 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 _0x02b9=['./server','./lib/email','./rpc/mailAccount','resolve','then','refresh','mailAccounts','listen','catch','log','bluebird'];(function(_0x2c7a96,_0x424b02){var _0x393ac1=function(_0x32ef44){while(--_0x32ef44){_0x2c7a96['push'](_0x2c7a96['shift']());}};_0x393ac1(++_0x424b02);}(_0x02b9,0x1ee));var _0x902b=function(_0x5d2a9d,_0x414208){_0x5d2a9d=_0x5d2a9d-0x0;var _0x39b9c9=_0x02b9[_0x5d2a9d];return _0x39b9c9;};'use strict';var BPromise=require(_0x902b('0x0'));var server=require(_0x902b('0x1'));var Realtime=require('./realtime');var EmailChannel=require(_0x902b('0x2'));var mailAccount=require(_0x902b('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x902b('0x4')]()[_0x902b('0x5')](mailAccount['getMailAccounts']())[_0x902b('0x5')](realtime['initMailAccounts']())[_0x902b('0x5')](function(){email[_0x902b('0x6')](realtime[_0x902b('0x7')]);return realtime;});}function main(){return server[_0x902b('0x8')](realtime,email)['then'](function(_0x3b3f28){return initRealtime();})[_0x902b('0x5')](function(_0x516312){return setInterval(initRealtime,0x2710);})[_0x902b('0x9')](function(_0x4d28a0){console[_0x902b('0xa')](_0x4d28a0);});}main(); \ No newline at end of file +var _0x98af=['initMailAccounts','then','refresh','mailAccounts','listen','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','resolve','getMailAccounts'];(function(_0x31157a,_0x288226){var _0x5226d7=function(_0x3553bd){while(--_0x3553bd){_0x31157a['push'](_0x31157a['shift']());}};_0x5226d7(++_0x288226);}(_0x98af,0xbc));var _0xf98a=function(_0x192103,_0x1715dd){_0x192103=_0x192103-0x0;var _0x58bb34=_0x98af[_0x192103];return _0x58bb34;};'use strict';var BPromise=require(_0xf98a('0x0'));var server=require(_0xf98a('0x1'));var Realtime=require(_0xf98a('0x2'));var EmailChannel=require(_0xf98a('0x3'));var mailAccount=require(_0xf98a('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xf98a('0x5')]()['then'](mailAccount[_0xf98a('0x6')]())['then'](realtime[_0xf98a('0x7')]())[_0xf98a('0x8')](function(){email[_0xf98a('0x9')](realtime[_0xf98a('0xa')]);return realtime;});}function main(){return server[_0xf98a('0xb')](realtime,email)[_0xf98a('0x8')](function(_0x38a976){return initRealtime();})[_0xf98a('0x8')](function(_0x451d10){return setInterval(initRealtime,0x2710);})['catch'](function(_0x231f96){console[_0xf98a('0xc')](_0x231f96);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 4beaed2..0ac1411 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 _0x8a5a=['bluebird','socket.io-emitter','localhost','./imap','../../../config/logger','email','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','smtp','emit','name','key','active','status','Imap','total','stringify','md5','mailAccount:update','prototype','hasOwnProperty','imapAccounts','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','isNil','messageStatus','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','info','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','then','verify','exports','moment'];(function(_0xbad0aa,_0x4d0d8a){var _0x564de=function(_0x4f35cf){while(--_0x4f35cf){_0xbad0aa['push'](_0xbad0aa['shift']());}};_0x564de(++_0x4d0d8a);}(_0x8a5a,0x1d3));var _0xa8a5=function(_0x323b95,_0x4aaaf0){_0x323b95=_0x323b95-0x0;var _0x246a93=_0x8a5a[_0x323b95];return _0x246a93;};'use strict';var _=require('lodash');var moment=require(_0xa8a5('0x0'));var BPromise=require(_0xa8a5('0x1'));var md5=require('md5');var io=require(_0xa8a5('0x2'))({'host':_0xa8a5('0x3'),'port':0x18eb});var EmailImap=require(_0xa8a5('0x4'));var EmailSmtp=require('./smtp');var logger=require(_0xa8a5('0x5'))(_0xa8a5('0x6'));var mailAccount=require(_0xa8a5('0x7'));var md5Accounts={};function EmailChannel(_0x3267fc){logger['info'](_0xa8a5('0x8'));this[_0xa8a5('0x9')]=_0x3267fc[_0xa8a5('0x9')];this['imapAccounts']={};this[_0xa8a5('0xa')]=new EmailSmtp();}EmailChannel['prototype'][_0xa8a5('0xb')]=function(_0x67afd8){var _0x3f9212=this[_0xa8a5('0x9')][_0x67afd8];var _0x25e48c={'id':_0x3f9212['id'],'name':_0x3f9212[_0xa8a5('0xc')],'key':_0x3f9212[_0xa8a5('0xd')],'active':_0x3f9212[_0xa8a5('0xe')],'Imap':{'status':_0x3f9212['Imap'][_0xa8a5('0xf')],'messageStatus':_0x3f9212[_0xa8a5('0x10')]['messageStatus'],'total':_0x3f9212[_0xa8a5('0x10')][_0xa8a5('0x11')]}};if(_['isNil'](md5Accounts[_0x67afd8])){md5Accounts[_0x67afd8]={};}var _0x349b94=md5(JSON[_0xa8a5('0x12')](_0x25e48c));if(md5Accounts[_0x67afd8][_0xa8a5('0x13')]!==_0x349b94){md5Accounts[_0x67afd8]['md5']=_0x349b94;io[_0xa8a5('0xb')](_0xa8a5('0x14'),_0x25e48c);}};EmailChannel[_0xa8a5('0x15')]['refresh']=function(_0x50e7a1){for(var _0x5a25c7 in _0x50e7a1){if(_0x50e7a1['hasOwnProperty'](_0x5a25c7)){if(_0x50e7a1[_0x5a25c7][_0xa8a5('0x10')]&&_0x50e7a1[_0x5a25c7]['active']){var _0x2f3e49=_0x50e7a1[_0x5a25c7][_0xa8a5('0x10')];if(!this['imapAccounts'][_0xa8a5('0x16')](_0x2f3e49['id'])){this[_0xa8a5('0x17')][_0x2f3e49['id']]=new EmailImap(_0x2f3e49,_0x50e7a1[_0x5a25c7][_0xa8a5('0x6')]);this[_0xa8a5('0x17')][_0x2f3e49['id']]['on']('box',this['handleImapBox'][_0xa8a5('0x18')](this,_0x5a25c7));this[_0xa8a5('0x17')][_0x2f3e49['id']]['on'](_0xa8a5('0x6'),this[_0xa8a5('0x19')][_0xa8a5('0x18')](this,_0x5a25c7));this[_0xa8a5('0x17')][_0x2f3e49['id']]['on'](_0xa8a5('0x1a'),this[_0xa8a5('0x1b')][_0xa8a5('0x18')](this,_0x5a25c7));this[_0xa8a5('0x17')][_0x2f3e49['id']]['on'](_0xa8a5('0x1c'),this[_0xa8a5('0x1d')][_0xa8a5('0x18')](this,_0x5a25c7));}}else{if(_[_0xa8a5('0x1e')](this[_0xa8a5('0x9')][_0x5a25c7][_0xa8a5('0x10')])){this[_0xa8a5('0x9')][_0x5a25c7][_0xa8a5('0x10')]={};}this[_0xa8a5('0x9')][_0x5a25c7][_0xa8a5('0x10')][_0xa8a5('0xf')]='disabled';this[_0xa8a5('0x9')][_0x5a25c7][_0xa8a5('0x10')][_0xa8a5('0x1f')]='';this[_0xa8a5('0xb')](_0x5a25c7);}}}};EmailChannel[_0xa8a5('0x15')][_0xa8a5('0x20')]=function(_0x3c17c2,_0x399c23){if(this[_0xa8a5('0x9')][_0x3c17c2]){this[_0xa8a5('0x9')][_0x3c17c2][_0xa8a5('0x10')]['status']=_0xa8a5('0x21');this['mailAccounts'][_0x3c17c2][_0xa8a5('0x10')][_0xa8a5('0x1f')]=_0x399c23[_0xa8a5('0xc')];if(_0x399c23['messages']){this[_0xa8a5('0x9')][_0x3c17c2]['Imap'][_0xa8a5('0x11')]=_0x399c23[_0xa8a5('0x22')][_0xa8a5('0x11')];}return this[_0xa8a5('0xb')](_0x3c17c2);}};EmailChannel[_0xa8a5('0x15')][_0xa8a5('0x19')]=function(_0x1b95af,_0x52ffca){logger['info'](_0xa8a5('0x23'),_0x52ffca[_0xa8a5('0x24')],_0x52ffca[_0xa8a5('0x25')],_0x52ffca[_0xa8a5('0x26')],_0x1b95af);if(this[_0xa8a5('0x9')][_0x1b95af]){return mailAccount[_0xa8a5('0x27')](_0x1b95af,_0x52ffca)['then'](function(_0x18d801){if(_0x18d801){logger[_0xa8a5('0x28')](_0xa8a5('0x29'));}})[_0xa8a5('0x2a')](function(_0x547081){logger[_0xa8a5('0x1c')](_0xa8a5('0x2b'),JSON[_0xa8a5('0x12')](_0x547081));});}};EmailChannel['prototype'][_0xa8a5('0x1b')]=function(_0xbb8c93){if(this['mailAccounts'][_0xbb8c93]&&this['mailAccounts'][_0xbb8c93][_0xa8a5('0x10')]){if(this[_0xa8a5('0x17')][this[_0xa8a5('0x9')][_0xbb8c93][_0xa8a5('0x10')]['id']]){delete this['imapAccounts'][this[_0xa8a5('0x9')][_0xbb8c93][_0xa8a5('0x10')]['id']];}this[_0xa8a5('0x9')][_0xbb8c93][_0xa8a5('0x10')][_0xa8a5('0x2c')]=moment();this[_0xa8a5('0xb')](_0xbb8c93);}};EmailChannel[_0xa8a5('0x15')][_0xa8a5('0x1d')]=function(_0x2b8c76,_0x57fa86){if(this[_0xa8a5('0x9')][_0x2b8c76]){this[_0xa8a5('0x9')][_0x2b8c76][_0xa8a5('0x10')]['status']=_0xa8a5('0x1c');this[_0xa8a5('0x9')][_0x2b8c76][_0xa8a5('0x10')][_0xa8a5('0x1f')]=_0x57fa86;return this['emit'](_0x2b8c76);}};EmailChannel[_0xa8a5('0x15')][_0xa8a5('0x2d')]=function(_0x14d957,_0x3216d4){return this[_0xa8a5('0xa')][_0xa8a5('0x2e')](_0x14d957,_0x3216d4);};EmailChannel['prototype'][_0xa8a5('0x2f')]=function(_0x1e07c1){var _0x57f3ec=this;if(this['mailAccounts'][_0x1e07c1['id']]){if(_[_0xa8a5('0x1e')](this[_0xa8a5('0x9')][_0x1e07c1['id']]['Smtp'])){this[_0xa8a5('0x9')][_0x1e07c1['id']][_0xa8a5('0x30')]={};}this[_0xa8a5('0x9')][_0x1e07c1['id']][_0xa8a5('0x30')][_0xa8a5('0x2c')]=moment();return new BPromise(function(_0x138915,_0x5771a6){return _0x57f3ec[_0xa8a5('0xa')]['verify'](_0x1e07c1)[_0xa8a5('0x31')](function(_0x736076){_0x57f3ec[_0xa8a5('0x9')][_0x1e07c1['id']]['Smtp'][_0xa8a5('0xf')]='verified';_0x57f3ec[_0xa8a5('0x9')][_0x1e07c1['id']][_0xa8a5('0x30')][_0xa8a5('0x1f')]='';_0x57f3ec[_0xa8a5('0xb')](_0x1e07c1['id']);_0x138915(_0x736076);})[_0xa8a5('0x2a')](function(_0x5d149a){_0x57f3ec[_0xa8a5('0x9')][_0x1e07c1['id']]['Smtp'][_0xa8a5('0xf')]=_0xa8a5('0x1c');_0x57f3ec[_0xa8a5('0x9')][_0x1e07c1['id']][_0xa8a5('0x30')][_0xa8a5('0x1f')]=_0x5d149a;_0x57f3ec['emit'](_0x1e07c1['id']);_0x5771a6(_0x5d149a);});});}return this[_0xa8a5('0xa')][_0xa8a5('0x32')](_0x1e07c1);};module[_0xa8a5('0x33')]=EmailChannel; \ No newline at end of file +var _0x6b28=['disabled','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','catch','exports','lodash','moment','md5','socket.io-emitter','localhost','./imap','./smtp','../../../config/logger','email','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','hasOwnProperty','box','bind','handleImapEmail','end','error','handleImapError'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b28,0x83));var _0x86b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b28[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x86b2('0x0'));var moment=require(_0x86b2('0x1'));var BPromise=require('bluebird');var md5=require(_0x86b2('0x2'));var io=require(_0x86b2('0x3'))({'host':_0x86b2('0x4'),'port':0x18eb});var EmailImap=require(_0x86b2('0x5'));var EmailSmtp=require(_0x86b2('0x6'));var logger=require(_0x86b2('0x7'))(_0x86b2('0x8'));var mailAccount=require(_0x86b2('0x9'));var md5Accounts={};function EmailChannel(_0x5313cf){logger[_0x86b2('0xa')](_0x86b2('0xb'));this[_0x86b2('0xc')]=_0x5313cf['mailAccounts'];this[_0x86b2('0xd')]={};this[_0x86b2('0xe')]=new EmailSmtp();}EmailChannel[_0x86b2('0xf')][_0x86b2('0x10')]=function(_0x5179b1){var _0x3fc575=this[_0x86b2('0xc')][_0x5179b1];var _0x421400={'id':_0x3fc575['id'],'name':_0x3fc575[_0x86b2('0x11')],'key':_0x3fc575[_0x86b2('0x12')],'active':_0x3fc575[_0x86b2('0x13')],'Imap':{'status':_0x3fc575[_0x86b2('0x14')][_0x86b2('0x15')],'messageStatus':_0x3fc575['Imap'][_0x86b2('0x16')],'total':_0x3fc575[_0x86b2('0x14')][_0x86b2('0x17')]}};if(_[_0x86b2('0x18')](md5Accounts[_0x5179b1])){md5Accounts[_0x5179b1]={};}var _0x97054e=md5(JSON[_0x86b2('0x19')](_0x421400));if(md5Accounts[_0x5179b1][_0x86b2('0x2')]!==_0x97054e){md5Accounts[_0x5179b1]['md5']=_0x97054e;io['emit'](_0x86b2('0x1a'),_0x421400);}};EmailChannel[_0x86b2('0xf')]['refresh']=function(_0x1f0006){for(var _0x357494 in _0x1f0006){if(_0x1f0006[_0x86b2('0x1b')](_0x357494)){if(_0x1f0006[_0x357494][_0x86b2('0x14')]&&_0x1f0006[_0x357494][_0x86b2('0x13')]){var _0x5c6c49=_0x1f0006[_0x357494]['Imap'];if(!this['imapAccounts'][_0x86b2('0x1b')](_0x5c6c49['id'])){this['imapAccounts'][_0x5c6c49['id']]=new EmailImap(_0x5c6c49,_0x1f0006[_0x357494][_0x86b2('0x8')]);this['imapAccounts'][_0x5c6c49['id']]['on'](_0x86b2('0x1c'),this['handleImapBox'][_0x86b2('0x1d')](this,_0x357494));this['imapAccounts'][_0x5c6c49['id']]['on'](_0x86b2('0x8'),this[_0x86b2('0x1e')][_0x86b2('0x1d')](this,_0x357494));this[_0x86b2('0xd')][_0x5c6c49['id']]['on'](_0x86b2('0x1f'),this['handleImapEnd'][_0x86b2('0x1d')](this,_0x357494));this[_0x86b2('0xd')][_0x5c6c49['id']]['on'](_0x86b2('0x20'),this[_0x86b2('0x21')]['bind'](this,_0x357494));}}else{if(_[_0x86b2('0x18')](this[_0x86b2('0xc')][_0x357494]['Imap'])){this['mailAccounts'][_0x357494]['Imap']={};}this[_0x86b2('0xc')][_0x357494]['Imap'][_0x86b2('0x15')]=_0x86b2('0x22');this[_0x86b2('0xc')][_0x357494]['Imap'][_0x86b2('0x16')]='';this['emit'](_0x357494);}}}};EmailChannel[_0x86b2('0xf')][_0x86b2('0x23')]=function(_0x13d867,_0x6c0461){if(this['mailAccounts'][_0x13d867]){this[_0x86b2('0xc')][_0x13d867][_0x86b2('0x14')][_0x86b2('0x15')]=_0x86b2('0x24');this[_0x86b2('0xc')][_0x13d867][_0x86b2('0x14')][_0x86b2('0x16')]=_0x6c0461[_0x86b2('0x11')];if(_0x6c0461['messages']){this[_0x86b2('0xc')][_0x13d867][_0x86b2('0x14')][_0x86b2('0x17')]=_0x6c0461[_0x86b2('0x25')][_0x86b2('0x17')];}return this[_0x86b2('0x10')](_0x13d867);}};EmailChannel[_0x86b2('0xf')][_0x86b2('0x1e')]=function(_0xf21c87,_0x1dd872){logger[_0x86b2('0xa')](_0x86b2('0x26'),_0x1dd872[_0x86b2('0x27')],_0x1dd872[_0x86b2('0x28')],_0x1dd872[_0x86b2('0x29')],_0xf21c87);if(this[_0x86b2('0xc')][_0xf21c87]){return mailAccount['notify'](_0xf21c87,_0x1dd872)[_0x86b2('0x2a')](function(_0x2cca9b){if(_0x2cca9b){logger['info'](_0x86b2('0x2b'));}})['catch'](function(_0x29a475){logger[_0x86b2('0x20')](_0x86b2('0x2c'),JSON[_0x86b2('0x19')](_0x29a475));});}};EmailChannel['prototype'][_0x86b2('0x2d')]=function(_0x5763e3){if(this['mailAccounts'][_0x5763e3]&&this[_0x86b2('0xc')][_0x5763e3]['Imap']){if(this[_0x86b2('0xd')][this['mailAccounts'][_0x5763e3][_0x86b2('0x14')]['id']]){delete this[_0x86b2('0xd')][this[_0x86b2('0xc')][_0x5763e3]['Imap']['id']];}this[_0x86b2('0xc')][_0x5763e3][_0x86b2('0x14')][_0x86b2('0x2e')]=moment();this[_0x86b2('0x10')](_0x5763e3);}};EmailChannel[_0x86b2('0xf')][_0x86b2('0x21')]=function(_0x24c201,_0x17167c){if(this['mailAccounts'][_0x24c201]){this[_0x86b2('0xc')][_0x24c201][_0x86b2('0x14')][_0x86b2('0x15')]=_0x86b2('0x20');this[_0x86b2('0xc')][_0x24c201][_0x86b2('0x14')][_0x86b2('0x16')]=_0x17167c;return this['emit'](_0x24c201);}};EmailChannel[_0x86b2('0xf')][_0x86b2('0x2f')]=function(_0x506407,_0x1f2319){return this[_0x86b2('0xe')][_0x86b2('0x30')](_0x506407,_0x1f2319);};EmailChannel[_0x86b2('0xf')][_0x86b2('0x31')]=function(_0x16b161){var _0x5b08ea=this;if(this[_0x86b2('0xc')][_0x16b161['id']]){if(_['isNil'](this[_0x86b2('0xc')][_0x16b161['id']]['Smtp'])){this['mailAccounts'][_0x16b161['id']][_0x86b2('0x32')]={};}this[_0x86b2('0xc')][_0x16b161['id']][_0x86b2('0x32')][_0x86b2('0x2e')]=moment();return new BPromise(function(_0x1f3989,_0xae709e){return _0x5b08ea['smtp'][_0x86b2('0x33')](_0x16b161)[_0x86b2('0x2a')](function(_0x47bd3c){_0x5b08ea[_0x86b2('0xc')][_0x16b161['id']][_0x86b2('0x32')][_0x86b2('0x15')]=_0x86b2('0x34');_0x5b08ea[_0x86b2('0xc')][_0x16b161['id']][_0x86b2('0x32')][_0x86b2('0x16')]='';_0x5b08ea[_0x86b2('0x10')](_0x16b161['id']);_0x1f3989(_0x47bd3c);})[_0x86b2('0x35')](function(_0x5168bd){_0x5b08ea[_0x86b2('0xc')][_0x16b161['id']][_0x86b2('0x32')][_0x86b2('0x15')]=_0x86b2('0x20');_0x5b08ea[_0x86b2('0xc')][_0x16b161['id']][_0x86b2('0x32')][_0x86b2('0x16')]=_0x5168bd;_0x5b08ea[_0x86b2('0x10')](_0x16b161['id']);_0xae709e(_0x5168bd);});});}return this['smtp'][_0x86b2('0x33')](_0x16b161);};module[_0x86b2('0x36')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index abb42ff..00c9e12 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 _0xb7e7=['host','port','tls','autotls','required','getHost','service','email','anonymous@xcally.com','prototype','openBox','handleOpenBox','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','emit','parser','textCode','hasOwnProperty','upperFirst','exports','path','imap','randomstring','simpleParser','EventEmitter','./utils','../../../config/logger','mailbox','INBOX','getAccount','account','once','ready','handleReady','end','handleEnd','bind','error','handleError','connect','inherits','connTimeout','authTimeout','authentication','user','password'];(function(_0x41a15d,_0x1a3ab7){var _0x1b893a=function(_0x5ee647){while(--_0x5ee647){_0x41a15d['push'](_0x41a15d['shift']());}};_0x1b893a(++_0x1a3ab7);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb7e7[_0x3947c9];return _0x2e7871;};'use strict';var fs=require('fs');var path=require(_0x7b7e('0x0'));var util=require('util');var Imap=require(_0x7b7e('0x1'));var _=require('lodash');var rs=require(_0x7b7e('0x2'));var simpleParser=require('mailparser')[_0x7b7e('0x3')];var EventEmitter=require('events')[_0x7b7e('0x4')];var utils=require(_0x7b7e('0x5'));var logger=require(_0x7b7e('0x6'))('email');function EmailImap(_0x53ed64,_0x333fa4){this[_0x7b7e('0x7')]=_0x7b7e('0x8');this['account']=this[_0x7b7e('0x9')](_0x53ed64,_0x333fa4);this[_0x7b7e('0x1')]=new Imap(this[_0x7b7e('0xa')]);this[_0x7b7e('0x1')][_0x7b7e('0xb')](_0x7b7e('0xc'),this[_0x7b7e('0xd')]['bind'](this));this[_0x7b7e('0x1')][_0x7b7e('0xb')](_0x7b7e('0xe'),this[_0x7b7e('0xf')][_0x7b7e('0x10')](this));this[_0x7b7e('0x1')]['on'](_0x7b7e('0x11'),this[_0x7b7e('0x12')][_0x7b7e('0x10')](this));this['imap'][_0x7b7e('0x13')]();}util[_0x7b7e('0x14')](EmailImap,EventEmitter);EmailImap['prototype'][_0x7b7e('0x9')]=function(_0x5976ac,_0x4c6011){var _0x2889ed={'connTimeout':_0x5976ac[_0x7b7e('0x15')]?_0x5976ac[_0x7b7e('0x15')]*0x3e8:0x2710,'authTimeout':_0x5976ac[_0x7b7e('0x16')]?_0x5976ac[_0x7b7e('0x16')]*0x3e8:0x1388};if(_['isNil'](_0x5976ac['service'])){if(_0x5976ac[_0x7b7e('0x17')]){_0x2889ed[_0x7b7e('0x18')]=_0x5976ac[_0x7b7e('0x18')];_0x2889ed[_0x7b7e('0x19')]=_0x5976ac[_0x7b7e('0x19')];}_0x2889ed[_0x7b7e('0x1a')]=_0x5976ac[_0x7b7e('0x1a')];_0x2889ed[_0x7b7e('0x1b')]=_0x5976ac[_0x7b7e('0x1b')]||0x3e1;if(_0x5976ac[_0x7b7e('0x1c')]){_0x2889ed[_0x7b7e('0x1c')]=!![];}else{_0x2889ed[_0x7b7e('0x1c')]=![];_0x2889ed[_0x7b7e('0x1d')]=_0x7b7e('0x1e');}}else{_0x2889ed[_0x7b7e('0x18')]=_0x5976ac[_0x7b7e('0x18')];_0x2889ed[_0x7b7e('0x19')]=_0x5976ac['password'];_0x2889ed[_0x7b7e('0x1a')]=utils[_0x7b7e('0x1f')](_0x5976ac[_0x7b7e('0x20')]);_0x2889ed['port']=0x3e1;_0x2889ed[_0x7b7e('0x1c')]=!![];}_0x2889ed[_0x7b7e('0x21')]=_0x4c6011||_0x5976ac[_0x7b7e('0x18')]||_0x7b7e('0x22');return _0x2889ed;};EmailImap[_0x7b7e('0x23')][_0x7b7e('0xd')]=function(){this[_0x7b7e('0x1')][_0x7b7e('0x24')](this['mailbox'],![],this['handleOpenBox']['bind'](this));};EmailImap[_0x7b7e('0x23')][_0x7b7e('0x25')]=function(_0x23bfa3,_0x483c6f){if(_0x23bfa3){this['handleError'](_0x23bfa3,!![]);}else{this['emit'](_0x7b7e('0x26'),_0x483c6f);this[_0x7b7e('0x27')]();}};EmailImap[_0x7b7e('0x23')][_0x7b7e('0x28')]=function(_0x3ceaf5){if(_0x3ceaf5){this['handleError'](_0x3ceaf5,!![]);}else{this[_0x7b7e('0x1')][_0x7b7e('0xe')]();}};EmailImap['prototype']['readUnseen']=function(){this['imap'][_0x7b7e('0x29')]([_0x7b7e('0x2a')],this['handleReadUnseen'][_0x7b7e('0x10')](this));};EmailImap['prototype'][_0x7b7e('0x2b')]=function(_0xb9b6bf,_0x27b525){if(_0xb9b6bf){this['handleError'](_0xb9b6bf,!![]);}else{if(_0x27b525[_0x7b7e('0x2c')]){try{var _0xe31336=this[_0x7b7e('0x1')][_0x7b7e('0x2d')](_0x27b525,{'bodies':'','markSeen':!![]});_0xe31336['on'](_0x7b7e('0x2e'),this['handleFetchMessage'][_0x7b7e('0x10')](this));_0xe31336['once'](_0x7b7e('0x11'),this[_0x7b7e('0x2f')][_0x7b7e('0x10')](this));_0xe31336[_0x7b7e('0xb')](_0x7b7e('0xe'),this[_0x7b7e('0x30')][_0x7b7e('0x10')](this));}catch(_0x4bfe7f){logger['error'](_0x4bfe7f);}}else{this[_0x7b7e('0x1')][_0x7b7e('0x31')](!![],this['handleCloseBox'][_0x7b7e('0x10')](this));}}};EmailImap[_0x7b7e('0x23')][_0x7b7e('0x32')]=function(_0x48e255,_0x330b1d){_0x48e255['on'](_0x7b7e('0x33'),this[_0x7b7e('0x34')][_0x7b7e('0x10')](this));_0x48e255[_0x7b7e('0xb')](_0x7b7e('0x35'),this[_0x7b7e('0x36')][_0x7b7e('0x10')](this));_0x48e255[_0x7b7e('0xb')](_0x7b7e('0xe'),this[_0x7b7e('0x37')][_0x7b7e('0x10')](this));};EmailImap[_0x7b7e('0x23')][_0x7b7e('0x34')]=function(_0x116563,_0x279f46){simpleParser(_0x116563,this['handleSimpleParser'][_0x7b7e('0x10')](this));};EmailImap[_0x7b7e('0x23')][_0x7b7e('0x36')]=function(_0x242609){};EmailImap[_0x7b7e('0x23')][_0x7b7e('0x37')]=function(){};EmailImap[_0x7b7e('0x23')][_0x7b7e('0x38')]=function(_0x1c6d11,_0x18011c){if(_0x1c6d11){logger['error'](_0x1c6d11);}else{this[_0x7b7e('0x39')](_0x7b7e('0x21'),utils[_0x7b7e('0x3a')](this[_0x7b7e('0xa')],_0x18011c));}};EmailImap['prototype'][_0x7b7e('0x30')]=function(){this[_0x7b7e('0x1')][_0x7b7e('0x31')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x7b7e('0x23')]['handleFetchError']=function(_0x35382c){this[_0x7b7e('0x12')](_0x35382c);this['imap'][_0x7b7e('0x31')](!![],this[_0x7b7e('0x28')][_0x7b7e('0x10')](this));};EmailImap[_0x7b7e('0x23')][_0x7b7e('0xf')]=function(){this[_0x7b7e('0x39')](_0x7b7e('0xe'));};EmailImap[_0x7b7e('0x23')][_0x7b7e('0x12')]=function(_0x525a74,_0x5d61c1){logger[_0x7b7e('0x11')]('handleError',this[_0x7b7e('0xa')]['email'],JSON['stringify'](_0x525a74));var _0x356db0='';if(_0x525a74){if(_0x525a74['textCode']){_0x356db0=_0x525a74[_0x7b7e('0x3b')];}else{for(var _0x52051c in _0x525a74){if(_0x525a74[_0x7b7e('0x3c')](_0x52051c)){_0x356db0+=_[_0x7b7e('0x3d')](_0x52051c)+':\x20'+_0x525a74[_0x52051c]+'\x0a';}}}}if(_0x5d61c1){this[_0x7b7e('0x1')][_0x7b7e('0xe')]();}else{this['emit'](_0x7b7e('0x11'),_0x356db0);this[_0x7b7e('0x39')](_0x7b7e('0xe'));}};module[_0x7b7e('0x3e')]=EmailImap; \ No newline at end of file +var _0xf45e=['getHost','anonymous@xcally.com','openBox','handleOpenBox','prototype','emit','box','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchEnd','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchError','closeBox','stringify','textCode','hasOwnProperty','upperFirst','exports','path','imap','randomstring','mailparser','simpleParser','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','once','ready','bind','end','handleEnd','error','handleError','connect','connTimeout','authTimeout','service','authentication','user','host','port','tls','autotls','required','password'];(function(_0x2510e2,_0x698580){var _0x43deb2=function(_0x2b6c01){while(--_0x2b6c01){_0x2510e2['push'](_0x2510e2['shift']());}};_0x43deb2(++_0x698580);}(_0xf45e,0x115));var _0xef45=function(_0x3c8f3d,_0x29e3e9){_0x3c8f3d=_0x3c8f3d-0x0;var _0x6074eb=_0xf45e[_0x3c8f3d];return _0x6074eb;};'use strict';var fs=require('fs');var path=require(_0xef45('0x0'));var util=require('util');var Imap=require(_0xef45('0x1'));var _=require('lodash');var rs=require(_0xef45('0x2'));var simpleParser=require(_0xef45('0x3'))[_0xef45('0x4')];var EventEmitter=require(_0xef45('0x5'))[_0xef45('0x6')];var utils=require(_0xef45('0x7'));var logger=require(_0xef45('0x8'))(_0xef45('0x9'));function EmailImap(_0x338960,_0x315b84){this[_0xef45('0xa')]=_0xef45('0xb');this[_0xef45('0xc')]=this[_0xef45('0xd')](_0x338960,_0x315b84);this[_0xef45('0x1')]=new Imap(this[_0xef45('0xc')]);this[_0xef45('0x1')][_0xef45('0xe')](_0xef45('0xf'),this['handleReady'][_0xef45('0x10')](this));this[_0xef45('0x1')][_0xef45('0xe')](_0xef45('0x11'),this[_0xef45('0x12')][_0xef45('0x10')](this));this['imap']['on'](_0xef45('0x13'),this[_0xef45('0x14')][_0xef45('0x10')](this));this[_0xef45('0x1')][_0xef45('0x15')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0xef45('0xd')]=function(_0x47fd96,_0x2ae89a){var _0xb0fc43={'connTimeout':_0x47fd96[_0xef45('0x16')]?_0x47fd96['connTimeout']*0x3e8:0x2710,'authTimeout':_0x47fd96['authTimeout']?_0x47fd96[_0xef45('0x17')]*0x3e8:0x1388};if(_['isNil'](_0x47fd96[_0xef45('0x18')])){if(_0x47fd96[_0xef45('0x19')]){_0xb0fc43[_0xef45('0x1a')]=_0x47fd96[_0xef45('0x1a')];_0xb0fc43['password']=_0x47fd96['password'];}_0xb0fc43[_0xef45('0x1b')]=_0x47fd96[_0xef45('0x1b')];_0xb0fc43[_0xef45('0x1c')]=_0x47fd96[_0xef45('0x1c')]||0x3e1;if(_0x47fd96['tls']){_0xb0fc43['tls']=!![];}else{_0xb0fc43[_0xef45('0x1d')]=![];_0xb0fc43[_0xef45('0x1e')]=_0xef45('0x1f');}}else{_0xb0fc43[_0xef45('0x1a')]=_0x47fd96[_0xef45('0x1a')];_0xb0fc43[_0xef45('0x20')]=_0x47fd96[_0xef45('0x20')];_0xb0fc43['host']=utils[_0xef45('0x21')](_0x47fd96[_0xef45('0x18')]);_0xb0fc43[_0xef45('0x1c')]=0x3e1;_0xb0fc43[_0xef45('0x1d')]=!![];}_0xb0fc43[_0xef45('0x9')]=_0x2ae89a||_0x47fd96['user']||_0xef45('0x22');return _0xb0fc43;};EmailImap['prototype']['handleReady']=function(){this[_0xef45('0x1')][_0xef45('0x23')](this[_0xef45('0xa')],![],this[_0xef45('0x24')][_0xef45('0x10')](this));};EmailImap[_0xef45('0x25')][_0xef45('0x24')]=function(_0x5b4b0b,_0x208b35){if(_0x5b4b0b){this['handleError'](_0x5b4b0b,!![]);}else{this[_0xef45('0x26')](_0xef45('0x27'),_0x208b35);this['readUnseen']();}};EmailImap[_0xef45('0x25')][_0xef45('0x28')]=function(_0x479e3c){if(_0x479e3c){this[_0xef45('0x14')](_0x479e3c,!![]);}else{this['imap']['end']();}};EmailImap['prototype']['readUnseen']=function(){this[_0xef45('0x1')][_0xef45('0x29')]([_0xef45('0x2a')],this[_0xef45('0x2b')]['bind'](this));};EmailImap[_0xef45('0x25')]['handleReadUnseen']=function(_0x2525da,_0x4fc137){if(_0x2525da){this[_0xef45('0x14')](_0x2525da,!![]);}else{if(_0x4fc137['length']){try{var _0x575734=this[_0xef45('0x1')][_0xef45('0x2c')](_0x4fc137,{'bodies':'','markSeen':!![]});_0x575734['on'](_0xef45('0x2d'),this[_0xef45('0x2e')][_0xef45('0x10')](this));_0x575734['once']('error',this['handleFetchError'][_0xef45('0x10')](this));_0x575734[_0xef45('0xe')](_0xef45('0x11'),this[_0xef45('0x2f')][_0xef45('0x10')](this));}catch(_0x114053){logger[_0xef45('0x13')](_0x114053);}}else{this['imap']['closeBox'](!![],this[_0xef45('0x28')]['bind'](this));}}};EmailImap[_0xef45('0x25')]['handleFetchMessage']=function(_0x2dd398,_0x1837a3){_0x2dd398['on'](_0xef45('0x30'),this[_0xef45('0x31')][_0xef45('0x10')](this));_0x2dd398['once'](_0xef45('0x32'),this[_0xef45('0x33')][_0xef45('0x10')](this));_0x2dd398['once']('end',this[_0xef45('0x34')][_0xef45('0x10')](this));};EmailImap['prototype'][_0xef45('0x31')]=function(_0x501eb3,_0x589c17){simpleParser(_0x501eb3,this[_0xef45('0x35')][_0xef45('0x10')](this));};EmailImap[_0xef45('0x25')]['handleMessageAttributes']=function(_0x13f384){};EmailImap[_0xef45('0x25')][_0xef45('0x34')]=function(){};EmailImap[_0xef45('0x25')]['handleSimpleParser']=function(_0x5bc364,_0xc059bc){if(_0x5bc364){logger[_0xef45('0x13')](_0x5bc364);}else{this[_0xef45('0x26')](_0xef45('0x9'),utils[_0xef45('0x36')](this[_0xef45('0xc')],_0xc059bc));}};EmailImap[_0xef45('0x25')][_0xef45('0x2f')]=function(){this['imap']['closeBox'](!![],this[_0xef45('0x28')][_0xef45('0x10')](this));};EmailImap[_0xef45('0x25')][_0xef45('0x37')]=function(_0x1a2335){this[_0xef45('0x14')](_0x1a2335);this[_0xef45('0x1')][_0xef45('0x38')](!![],this[_0xef45('0x28')][_0xef45('0x10')](this));};EmailImap[_0xef45('0x25')][_0xef45('0x12')]=function(){this[_0xef45('0x26')](_0xef45('0x11'));};EmailImap[_0xef45('0x25')][_0xef45('0x14')]=function(_0x5e868c,_0xd14043){logger[_0xef45('0x13')](_0xef45('0x14'),this[_0xef45('0xc')]['email'],JSON[_0xef45('0x39')](_0x5e868c));var _0x48f941='';if(_0x5e868c){if(_0x5e868c[_0xef45('0x3a')]){_0x48f941=_0x5e868c['textCode'];}else{for(var _0x5faf67 in _0x5e868c){if(_0x5e868c[_0xef45('0x3b')](_0x5faf67)){_0x48f941+=_[_0xef45('0x3c')](_0x5faf67)+':\x20'+_0x5e868c[_0x5faf67]+'\x0a';}}}}if(_0xd14043){this[_0xef45('0x1')][_0xef45('0x11')]();}else{this[_0xef45('0x26')](_0xef45('0x13'),_0x48f941);this['emit'](_0xef45('0x11'));}};module[_0xef45('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 7b638ac..575430e 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 _0x127a=['toString','prototype','verify','Not\x20verifired','exports','nodemailer','sendMail'];(function(_0x3be1a3,_0x4aa713){var _0x2e81b7=function(_0x1d2651){while(--_0x1d2651){_0x3be1a3['push'](_0x3be1a3['shift']());}};_0x2e81b7(++_0x4aa713);}(_0x127a,0xde));var _0xa127=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x127a[_0x243b59];return _0x3e1676;};'use strict';var nodemailer=require(_0xa127('0x0'));var BPromise=require('bluebird');function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x16a68c,_0x67315a){return new BPromise(function(_0x39cca9,_0x250677){var _0x4dace3=nodemailer['createTransport'](_0x16a68c);_0x4dace3[_0xa127('0x1')](_0x67315a,function(_0x3e790b,_0x5aca9e){if(_0x3e790b){_0x250677(_0x3e790b[_0xa127('0x2')]());}else{_0x39cca9(_0x5aca9e);}});});};EmailSmtp[_0xa127('0x3')][_0xa127('0x4')]=function(_0x282e93){return new BPromise(function(_0x5453e5,_0x8a257a){var _0xa748e8=nodemailer['createTransport'](_0x282e93);_0xa748e8[_0xa127('0x4')](function(_0x448230,_0x4686c4){if(_0x448230){_0x8a257a(_0x448230['toString']());}else{if(_0x4686c4){_0x5453e5(_0x4686c4);}else{_0x8a257a(_0xa127('0x5'));}}});});};module[_0xa127('0x6')]=EmailSmtp; \ No newline at end of file +var _0xada2=['bluebird','prototype','send','createTransport','sendMail','toString','nodemailer'];(function(_0x10dc0a,_0x26f136){var _0x2e8a74=function(_0x250147){while(--_0x250147){_0x10dc0a['push'](_0x10dc0a['shift']());}};_0x2e8a74(++_0x26f136);}(_0xada2,0x13a));var _0x2ada=function(_0x5165b4,_0x1a88a5){_0x5165b4=_0x5165b4-0x0;var _0x474f3a=_0xada2[_0x5165b4];return _0x474f3a;};'use strict';var nodemailer=require(_0x2ada('0x0'));var BPromise=require(_0x2ada('0x1'));function EmailSmtp(){}EmailSmtp[_0x2ada('0x2')][_0x2ada('0x3')]=function(_0x16567a,_0x5199c6){return new BPromise(function(_0x5520f9,_0x2c9ba9){var _0x257184=nodemailer[_0x2ada('0x4')](_0x16567a);_0x257184[_0x2ada('0x5')](_0x5199c6,function(_0x41ede0,_0x4d7bf9){if(_0x41ede0){_0x2c9ba9(_0x41ede0[_0x2ada('0x6')]());}else{_0x5520f9(_0x4d7bf9);}});});};EmailSmtp[_0x2ada('0x2')]['verify']=function(_0x2e4b81){return new BPromise(function(_0x56dea9,_0x88bad8){var _0x3be725=nodemailer[_0x2ada('0x4')](_0x2e4b81);_0x3be725['verify'](function(_0x573621,_0x3984ee){if(_0x573621){_0x88bad8(_0x573621[_0x2ada('0x6')]());}else{if(_0x3984ee){_0x56dea9(_0x3984ee);}else{_0x88bad8('Not\x20verifired');}}});});};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 a41faec..6f4d1b0 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 _0xe01e=['originCc','includes','bcc','attachments','attach','type','filename','attachment-','now','root','server/files/attachments/','push','contentType','getHost','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','../../../config/logger','email','../../../config/environment','head','value','address','generate','@xcally.com','name','split','slice','pop','length','isEmpty','anonymous','parser','from','subject','inReplyTo','format','html','body','0x1?_0x24c1b8[_0xee01('0x10')]():'';}return'';}function getMails(_0xdd9cdb,_0x2f49e4){var _0x24feb8='';for(var _0x56bc63=0x0;_0x56bc63<_0x2f49e4[_0xee01('0x9')][_0xee01('0x11')];_0x56bc63+=0x1){if(_0x2f49e4[_0xee01('0x9')][_0x56bc63][_0xee01('0xa')]!==_0xdd9cdb){if(!_[_0xee01('0x12')](_0x24feb8)){_0x24feb8+=',';}_0x24feb8+=_0x2f49e4['value'][_0x56bc63][_0xee01('0xd')]||_0x2f49e4[_0xee01('0x9')][_0x56bc63][_0xee01('0xa')]||'';_0x24feb8+='\x20<';_0x24feb8+=_0x2f49e4[_0xee01('0x9')][_0x56bc63][_0xee01('0xa')]?_0x2f49e4[_0xee01('0x9')][_0x56bc63]['address']:_0xee01('0x13')+random[_0xee01('0xb')](0x6)+'@xcally.com';_0x24feb8+='>';}}return _0x24feb8;}exports[_0xee01('0x14')]=function(_0x24e634,_0x162806){var _0x5a068b={'from':getAddress(_0x162806[_0xee01('0x15')]),'firstName':getFirstName(_0x162806['from']),'lastName':getLastName(_0x162806[_0xee01('0x15')]),'mapKey':_0xee01('0x6'),'message':{'from':getMails(_0x24e634['email'],_0x162806['from']),'to':_0x24e634[_0xee01('0x6')],'cc':'','subject':_0x162806[_0xee01('0x16')]||'','messageId':_0x162806['messageId'],'inReplyTo':_0x162806[_0xee01('0x17')],'sentAt':moment(_0x162806['date'])[_0xee01('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(_0x162806['html']){var _0x290998=/)<[^<]*)*<\/script>/gi;while(_0x290998['test'](_0x162806['html'])){_0x162806['html']=_0x162806[_0xee01('0x19')]['replace'](_0x290998,'');}_0x5a068b[_0xee01('0x1a')]=_0x162806[_0xee01('0x19')];}else{_0x5a068b[_0xee01('0x1a')]=_0x162806['textAsHtml'];}if(_0x5a068b[_0xee01('0x1a')]){_0x5a068b[_0xee01('0x1a')]=_0x5a068b[_0xee01('0x1a')]['replace'](/0x1?_0x11f16a[_0x7adc('0x10')]():'';}return'';}function getMails(_0x1bc9c3,_0x3ddab6){var _0x350fe0='';for(var _0x109118=0x0;_0x109118<_0x3ddab6[_0x7adc('0x7')]['length'];_0x109118+=0x1){if(_0x3ddab6[_0x7adc('0x7')][_0x109118][_0x7adc('0x8')]!==_0x1bc9c3){if(!_[_0x7adc('0x11')](_0x350fe0)){_0x350fe0+=',';}_0x350fe0+=_0x3ddab6[_0x7adc('0x7')][_0x109118][_0x7adc('0xc')]||_0x3ddab6['value'][_0x109118]['address']||'';_0x350fe0+='\x20<';_0x350fe0+=_0x3ddab6['value'][_0x109118][_0x7adc('0x8')]?_0x3ddab6[_0x7adc('0x7')][_0x109118][_0x7adc('0x8')]:_0x7adc('0x9')+random[_0x7adc('0x12')](0x6)+_0x7adc('0xa');_0x350fe0+='>';}}return _0x350fe0;}exports[_0x7adc('0x13')]=function(_0x1bdd58,_0x195188){var _0x419137={'from':getAddress(_0x195188[_0x7adc('0x14')]),'firstName':getFirstName(_0x195188[_0x7adc('0x14')]),'lastName':getLastName(_0x195188[_0x7adc('0x14')]),'mapKey':'email','message':{'from':getMails(_0x1bdd58[_0x7adc('0x5')],_0x195188[_0x7adc('0x14')]),'to':_0x1bdd58[_0x7adc('0x5')],'cc':'','subject':_0x195188[_0x7adc('0x15')]||'','messageId':_0x195188[_0x7adc('0x16')],'inReplyTo':_0x195188[_0x7adc('0x17')],'sentAt':moment(_0x195188[_0x7adc('0x18')])[_0x7adc('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(_0x195188['html']){var _0x42c053=/)<[^<]*)*<\/script>/gi;while(_0x42c053[_0x7adc('0x1a')](_0x195188[_0x7adc('0x1b')])){_0x195188[_0x7adc('0x1b')]=_0x195188[_0x7adc('0x1b')]['replace'](_0x42c053,'');}_0x419137['body']=_0x195188[_0x7adc('0x1b')];}else{_0x419137[_0x7adc('0x1c')]=_0x195188[_0x7adc('0x1d')];}if(_0x419137['body']){_0x419137['body']=_0x419137[_0x7adc('0x1c')][_0x7adc('0x1e')](/0x0){if(this[_0x1964a3+'Capacity']>0x0&&this[_0x1964a3+_0x87d0('0x20')]>=this[_0x1964a3+_0x87d0('0x21')]){return _0x87d0('0x22');}else{return _0x87d0('0x23');}}else{return _0x87d0('0x24');}};Agent[_0x87d0('0x1e')]['updateRealtime']=function(){var _0x3d4f17=[_0x87d0('0x25'),'chat','openchannel','fax','sms'];for(var _0x173e46=0x0;_0x173e46<_0x3d4f17[_0x87d0('0x26')];_0x173e46+=0x1){var _0x59d9d9=this[_0x87d0('0x1f')](_0x3d4f17[_0x173e46]);if(this[_0x3d4f17[_0x173e46]+_0x87d0('0x27')]!==_0x59d9d9){this[_0x3d4f17[_0x173e46]+_0x87d0('0x28')]=_[_0x87d0('0x29')](moment()[_0x87d0('0x2a')]('x'));}this[_0x3d4f17[_0x173e46]+_0x87d0('0x27')]=_0x59d9d9;}io[_0x87d0('0x2b')]('user:save',this);};module[_0x87d0('0x2c')]=Agent; \ No newline at end of file +var _0xb5f3=['toNumber','format','emit','user:save','lodash','socket.io-emitter','localhost','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','mail','chat','fax','sms','length','Status','StatusTime'];(function(_0x592125,_0x3c3e4a){var _0x536040=function(_0x2325d1){while(--_0x2325d1){_0x592125['push'](_0x592125['shift']());}};_0x536040(++_0x3c3e4a);}(_0xb5f3,0x154));var _0x3b5f=function(_0x423097,_0x8a09f4){_0x423097=_0x423097-0x0;var _0x3a73f1=_0xb5f3[_0x423097];return _0x3a73f1;};'use strict';var _=require(_0x3b5f('0x0'));var moment=require('moment');var io=require(_0x3b5f('0x1'))({'host':_0x3b5f('0x2'),'port':0x18eb});function Agent(_0x404371){this['id']=_0x404371['id']||0x0;this['name']=_0x404371['name']||'';this['online']=_0x404371[_0x3b5f('0x3')]||!![];this[_0x3b5f('0x4')]=_0x404371[_0x3b5f('0x4')]||![];this[_0x3b5f('0x5')]=_0x404371[_0x3b5f('0x5')]||![];this[_0x3b5f('0x6')]=_0x404371[_0x3b5f('0x6')]||![];this['faxPause']=_0x404371[_0x3b5f('0x7')]||![];this[_0x3b5f('0x8')]=_0x404371[_0x3b5f('0x8')]||![];this[_0x3b5f('0x9')]=_0x404371[_0x3b5f('0x9')]||![];this[_0x3b5f('0xa')]=_0x3b5f('0xb');this[_0x3b5f('0xc')]=0x0;this['chatCapacity']=_0x404371[_0x3b5f('0xd')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x3b5f('0xe')]=_0x3b5f('0xb');this[_0x3b5f('0xf')]=0x0;this[_0x3b5f('0x10')]=_0x404371['mailCapacity']||0x0;this[_0x3b5f('0x11')]=0x0;this[_0x3b5f('0x12')]=_0x3b5f('0xb');this[_0x3b5f('0x13')]=0x0;this[_0x3b5f('0x14')]=_0x404371[_0x3b5f('0x14')]||0x0;this[_0x3b5f('0x15')]=0x0;this[_0x3b5f('0x16')]=_0x3b5f('0xb');this['smsStatusTime']=0x0;this[_0x3b5f('0x17')]=_0x404371[_0x3b5f('0x17')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x3b5f('0x18')]=_0x3b5f('0xb');this[_0x3b5f('0x19')]=0x0;this[_0x3b5f('0x1a')]=_0x404371['openchannelCapacity']||0x0;this[_0x3b5f('0x1b')]=0x0;this[_0x3b5f('0x1c')]=![];this[_0x3b5f('0x1d')]=undefined;this[_0x3b5f('0x1e')]();}Agent[_0x3b5f('0x1f')][_0x3b5f('0x20')]=function(_0x41d88a){if(this[_0x41d88a+_0x3b5f('0x21')]>0x0){if(this[_0x41d88a+_0x3b5f('0x22')]>0x0&&this[_0x41d88a+'CurrentCapacity']>=this[_0x41d88a+_0x3b5f('0x22')]){return _0x3b5f('0x23');}else{return _0x3b5f('0x24');}}else{return'idle';}};Agent[_0x3b5f('0x1f')][_0x3b5f('0x1e')]=function(){var _0x135a7f=[_0x3b5f('0x25'),_0x3b5f('0x26'),'openchannel',_0x3b5f('0x27'),_0x3b5f('0x28')];for(var _0x47a23a=0x0;_0x47a23a<_0x135a7f[_0x3b5f('0x29')];_0x47a23a+=0x1){var _0x298fa3=this[_0x3b5f('0x20')](_0x135a7f[_0x47a23a]);if(this[_0x135a7f[_0x47a23a]+_0x3b5f('0x2a')]!==_0x298fa3){this[_0x135a7f[_0x47a23a]+_0x3b5f('0x2b')]=_[_0x3b5f('0x2c')](moment()[_0x3b5f('0x2d')]('x'));}this[_0x135a7f[_0x47a23a]+_0x3b5f('0x2a')]=_0x298fa3;}io[_0x3b5f('0x2e')](_0x3b5f('0x2f'),this);};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 26bc82e..db6373d 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 _0xa9e0=['_rr','map','updateRealtime','loggedIn','paused','length','online','chatPause','available','waiting','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','name','timeout','strategy','Agents','mapAgentsId','updateRouting'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var io=require('socket.io-emitter')({'host':'localhost','port':0x18eb});function ChatQueue(_0x18d5c9){this['id']=_0x18d5c9['id']||0x0;this['name']=_0x18d5c9[_0x0a9e('0x3')]||'';this[_0x0a9e('0x4')]=_0x18d5c9[_0x0a9e('0x4')]||0xa;this[_0x0a9e('0x5')]=_0x18d5c9[_0x0a9e('0x5')]||'beepall';this[_0x0a9e('0x6')]=_0x18d5c9[_0x0a9e('0x6')];this[_0x0a9e('0x7')]={};this['waiting']=0x0;this['md5']='';this[_0x0a9e('0x8')]();this['updateRealtime']();}ChatQueue['prototype'][_0x0a9e('0x8')]=function(){var _0xf81284=this[_0x0a9e('0x7')][_0x0a9e('0x9')];this[_0x0a9e('0x7')]=_[_0x0a9e('0xa')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0xf81284;};ChatQueue['prototype'][_0x0a9e('0xb')]=function(){this[_0x0a9e('0xc')]=0x0;this[_0x0a9e('0xd')]=0x0;for(var _0x26d672=0x0;_0x26d672=0x0?this['available']:0x0;var _0x16033c={'id':this['id'],'available':this[_0x0a9e('0x11')],'loggedIn':this['loggedIn'],'name':this[_0x0a9e('0x3')],'paused':this['paused'],'waiting':this[_0x0a9e('0x12')]};var _0x478723=md5(JSON[_0x0a9e('0x13')](_0x16033c));if(this[_0x0a9e('0x1')]!==_0x478723){this[_0x0a9e('0x1')]=_0x478723;io['to'](util[_0x0a9e('0x14')](_0x0a9e('0x15'),_0x16033c[_0x0a9e('0x3')]))[_0x0a9e('0x16')](_0x0a9e('0x17'),_0x16033c);}};module[_0x0a9e('0x18')]=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(_0x1842df,_0x5f25e0){var _0x158b58=function(_0x285549){while(--_0x285549){_0x1842df['push'](_0x1842df['shift']());}};_0x158b58(++_0x5f25e0);}(_0x34e8,0x12c));var _0x834e=function(_0x285daa,_0x575ab4){_0x285daa=_0x285daa-0x0;var _0x2b56ea=_0x34e8[_0x285daa];return _0x2b56ea;};'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 e84e4d2..be0d091 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 _0xb413=['fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','socket.io-emitter','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','length','online','faxPause','available','stringify','format'];(function(_0x118776,_0x85063c){var _0xa8ac29=function(_0x112319){while(--_0x112319){_0x118776['push'](_0x118776['shift']());}};_0xa8ac29(++_0x85063c);}(_0xb413,0x170));var _0x3b41=function(_0x189968,_0xa77571){_0x189968=_0x189968-0x0;var _0x3f352d=_0xb413[_0x189968];return _0x3f352d;};'use strict';var _=require(_0x3b41('0x0'));var md5=require(_0x3b41('0x1'));var util=require(_0x3b41('0x2'));var io=require(_0x3b41('0x3'))({'host':_0x3b41('0x4'),'port':0x18eb});function FaxQueue(_0x3ec6cf){this['id']=_0x3ec6cf['id']||0x0;this[_0x3b41('0x5')]=_0x3ec6cf['name']||'';this['timeout']=_0x3ec6cf[_0x3b41('0x6')]||0xa;this['strategy']=_0x3ec6cf[_0x3b41('0x7')]||_0x3b41('0x8');this[_0x3b41('0x9')]=_0x3ec6cf[_0x3b41('0x9')];this[_0x3b41('0xa')]={};this[_0x3b41('0xb')]=0x0;this[_0x3b41('0x1')]='';this[_0x3b41('0xc')]();this[_0x3b41('0xd')]();}FaxQueue['prototype'][_0x3b41('0xc')]=function(){var _0x5c8672=this[_0x3b41('0xa')][_0x3b41('0xe')];this[_0x3b41('0xa')]=_['map'](this['Agents'],'id');this[_0x3b41('0xa')]['_rr']=_0x5c8672;};FaxQueue[_0x3b41('0xf')]['updateRealtime']=function(){this[_0x3b41('0x10')]=0x0;this[_0x3b41('0x11')]=0x0;for(var _0x5d5024=0x0;_0x5d5024=0x0?this[_0x3b41('0x15')]:0x0;var _0x59aa39={'id':this['id'],'available':this['available'],'loggedIn':this[_0x3b41('0x10')],'name':this[_0x3b41('0x5')],'paused':this[_0x3b41('0x11')],'waiting':this[_0x3b41('0xb')]};var _0x2b430b=md5(JSON[_0x3b41('0x16')](_0x59aa39));if(this[_0x3b41('0x1')]!==_0x2b430b){this[_0x3b41('0x1')]=_0x2b430b;io['to'](util[_0x3b41('0x17')](_0x3b41('0x18'),_0x59aa39[_0x3b41('0x5')]))[_0x3b41('0x19')](_0x3b41('0x1a'),_0x59aa39);}};module[_0x3b41('0x1b')]=FaxQueue; \ No newline at end of file +var _0x1ea0=['mapAgentsId','updateRouting','prototype','map','_rr','updateRealtime','loggedIn','paused','length','online','available','waiting','stringify','format','emit','fax_queue:save','exports','md5','util','socket.io-emitter','localhost','name','timeout','strategy','beepall','Agents'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x1ea0,0x79));var _0x01ea=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1ea0[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var md5=require(_0x01ea('0x0'));var util=require(_0x01ea('0x1'));var io=require(_0x01ea('0x2'))({'host':_0x01ea('0x3'),'port':0x18eb});function FaxQueue(_0x53a3b8){this['id']=_0x53a3b8['id']||0x0;this[_0x01ea('0x4')]=_0x53a3b8[_0x01ea('0x4')]||'';this[_0x01ea('0x5')]=_0x53a3b8['timeout']||0xa;this['strategy']=_0x53a3b8[_0x01ea('0x6')]||_0x01ea('0x7');this[_0x01ea('0x8')]=_0x53a3b8[_0x01ea('0x8')];this[_0x01ea('0x9')]={};this['waiting']=0x0;this[_0x01ea('0x0')]='';this[_0x01ea('0xa')]();this['updateRealtime']();}FaxQueue[_0x01ea('0xb')][_0x01ea('0xa')]=function(){var _0xcac4a2=this[_0x01ea('0x9')]['_rr'];this['mapAgentsId']=_[_0x01ea('0xc')](this['Agents'],'id');this[_0x01ea('0x9')][_0x01ea('0xd')]=_0xcac4a2;};FaxQueue[_0x01ea('0xb')][_0x01ea('0xe')]=function(){this[_0x01ea('0xf')]=0x0;this[_0x01ea('0x10')]=0x0;for(var _0x1eeb34=0x0;_0x1eeb34=0x0?this['available']:0x0;var _0xe4bb9e={'id':this['id'],'available':this[_0x01ea('0x13')],'loggedIn':this[_0x01ea('0xf')],'name':this[_0x01ea('0x4')],'paused':this[_0x01ea('0x10')],'waiting':this[_0x01ea('0x14')]};var _0x3fe95c=md5(JSON[_0x01ea('0x15')](_0xe4bb9e));if(this[_0x01ea('0x0')]!==_0x3fe95c){this[_0x01ea('0x0')]=_0x3fe95c;io['to'](util[_0x01ea('0x16')]('fax:queue:%s',_0xe4bb9e[_0x01ea('0x4')]))[_0x01ea('0x17')](_0x01ea('0x18'),_0xe4bb9e);}};module[_0x01ea('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 709bf5d..278dced 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 _0xe8d2=['name','Intervals'];(function(_0x36749d,_0x4c6f86){var _0x419c87=function(_0x169edf){while(--_0x169edf){_0x36749d['push'](_0x36749d['shift']());}};_0x419c87(++_0x4c6f86);}(_0xe8d2,0xc8));var _0x2e8d=function(_0x343f55,_0x2f7273){_0x343f55=_0x343f55-0x0;var _0x4082b0=_0xe8d2[_0x343f55];return _0x4082b0;};'use strict';function Interval(_0x5ed485){this['id']=_0x5ed485['id']||0x0;this[_0x2e8d('0x0')]=_0x5ed485[_0x2e8d('0x0')]||'';this[_0x2e8d('0x1')]=_0x5ed485[_0x2e8d('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0x8887=['exports','name','Intervals'];(function(_0x3334d3,_0x231fa5){var _0x3991e9=function(_0x4f465b){while(--_0x4f465b){_0x3334d3['push'](_0x3334d3['shift']());}};_0x3991e9(++_0x231fa5);}(_0x8887,0x1c6));var _0x7888=function(_0x33f215,_0x482b09){_0x33f215=_0x33f215-0x0;var _0x35fc0f=_0x8887[_0x33f215];return _0x35fc0f;};'use strict';function Interval(_0x6690ec){this['id']=_0x6690ec['id']||0x0;this[_0x7888('0x0')]=_0x6690ec[_0x7888('0x0')]||'';this[_0x7888('0x1')]=_0x6690ec['Intervals']||{};}module[_0x7888('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 ba49f0d..90a8522 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 _0x3177=['md5','util','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','_rr','map','loggedIn','paused','length','online','available','stringify','format','mail_queue:save','exports','lodash'];(function(_0x29ab7e,_0x47d7d5){var _0xd52511=function(_0x93512e){while(--_0x93512e){_0x29ab7e['push'](_0x29ab7e['shift']());}};_0xd52511(++_0x47d7d5);}(_0x3177,0xef));var _0x7317=function(_0x5d3a27,_0x4d283a){_0x5d3a27=_0x5d3a27-0x0;var _0x9f99d2=_0x3177[_0x5d3a27];return _0x9f99d2;};'use strict';var _=require(_0x7317('0x0'));var md5=require(_0x7317('0x1'));var util=require(_0x7317('0x2'));var io=require('socket.io-emitter')({'host':_0x7317('0x3'),'port':0x18eb});function MailQueue(_0x1c7716){this['id']=_0x1c7716['id']||0x0;this['name']=_0x1c7716[_0x7317('0x4')]||'';this[_0x7317('0x5')]=_0x1c7716[_0x7317('0x5')]||0xa;this[_0x7317('0x6')]=_0x1c7716[_0x7317('0x6')]||_0x7317('0x7');this['Agents']=_0x1c7716[_0x7317('0x8')];this['mapAgentsId']={};this[_0x7317('0x9')]=0x0;this[_0x7317('0x1')]='';this[_0x7317('0xa')]();this[_0x7317('0xb')]();}MailQueue['prototype'][_0x7317('0xa')]=function(){var _0x4e3b44=this[_0x7317('0xc')][_0x7317('0xd')];this['mapAgentsId']=_[_0x7317('0xe')](this[_0x7317('0x8')],'id');this[_0x7317('0xc')]['_rr']=_0x4e3b44;};MailQueue['prototype'][_0x7317('0xb')]=function(){this[_0x7317('0xf')]=0x0;this[_0x7317('0x10')]=0x0;for(var _0x4bec9a=0x0;_0x4bec9a=0x0?this[_0x7317('0x13')]:0x0;var _0x57a644={'id':this['id'],'available':this[_0x7317('0x13')],'loggedIn':this[_0x7317('0xf')],'name':this[_0x7317('0x4')],'paused':this['paused'],'waiting':this['waiting']};var _0x4dd2ff=md5(JSON[_0x7317('0x14')](_0x57a644));if(this[_0x7317('0x1')]!==_0x4dd2ff){this[_0x7317('0x1')]=_0x4dd2ff;io['to'](util[_0x7317('0x15')]('mail:queue:%s',_0x57a644[_0x7317('0x4')]))['emit'](_0x7317('0x16'),_0x57a644);}};module[_0x7317('0x17')]=MailQueue; \ No newline at end of file +var _0xdcb3=['mailPause','available','waiting','stringify','mail:queue:%s','emit','mail_queue:save','lodash','util','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','md5','updateRouting','prototype','_rr','map','Agents','updateRealtime','loggedIn','paused','length','online'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdcb3,0x1a7));var _0x3dcb=function(_0x8cb724,_0x5e78d5){_0x8cb724=_0x8cb724-0x0;var _0x348d6f=_0xdcb3[_0x8cb724];return _0x348d6f;};'use strict';var _=require(_0x3dcb('0x0'));var md5=require('md5');var util=require(_0x3dcb('0x1'));var io=require(_0x3dcb('0x2'))({'host':'localhost','port':0x18eb});function MailQueue(_0x57c34a){this['id']=_0x57c34a['id']||0x0;this[_0x3dcb('0x3')]=_0x57c34a[_0x3dcb('0x3')]||'';this[_0x3dcb('0x4')]=_0x57c34a[_0x3dcb('0x4')]||0xa;this['strategy']=_0x57c34a[_0x3dcb('0x5')]||_0x3dcb('0x6');this['Agents']=_0x57c34a['Agents'];this[_0x3dcb('0x7')]={};this['waiting']=0x0;this[_0x3dcb('0x8')]='';this[_0x3dcb('0x9')]();this['updateRealtime']();}MailQueue[_0x3dcb('0xa')][_0x3dcb('0x9')]=function(){var _0x331a8b=this[_0x3dcb('0x7')][_0x3dcb('0xb')];this[_0x3dcb('0x7')]=_[_0x3dcb('0xc')](this[_0x3dcb('0xd')],'id');this[_0x3dcb('0x7')][_0x3dcb('0xb')]=_0x331a8b;};MailQueue[_0x3dcb('0xa')][_0x3dcb('0xe')]=function(){this[_0x3dcb('0xf')]=0x0;this[_0x3dcb('0x10')]=0x0;for(var _0x131590=0x0;_0x131590=0x0?this[_0x3dcb('0x14')]:0x0;var _0x462ab3={'id':this['id'],'available':this[_0x3dcb('0x14')],'loggedIn':this[_0x3dcb('0xf')],'name':this[_0x3dcb('0x3')],'paused':this[_0x3dcb('0x10')],'waiting':this[_0x3dcb('0x15')]};var _0x432f64=md5(JSON[_0x3dcb('0x16')](_0x462ab3));if(this[_0x3dcb('0x8')]!==_0x432f64){this['md5']=_0x432f64;io['to'](util['format'](_0x3dcb('0x17'),_0x462ab3[_0x3dcb('0x3')]))[_0x3dcb('0x18')](_0x3dcb('0x19'),_0x462ab3);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index a6c40ce..bada5c3 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 _0xc5af=['beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','paused','available','format','openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','md5','util','socket.io-emitter','name','timeout','strategy'];(function(_0x5b6acc,_0x17e719){var _0xe7db7d=function(_0x51f6fe){while(--_0x51f6fe){_0x5b6acc['push'](_0x5b6acc['shift']());}};_0xe7db7d(++_0x17e719);}(_0xc5af,0x10c));var _0xfc5a=function(_0x464ba2,_0x3dbb57){_0x464ba2=_0x464ba2-0x0;var _0x49791b=_0xc5af[_0x464ba2];return _0x49791b;};'use strict';var _=require(_0xfc5a('0x0'));var md5=require(_0xfc5a('0x1'));var util=require(_0xfc5a('0x2'));var io=require(_0xfc5a('0x3'))({'host':'localhost','port':0x18eb});function OpenchannelQueue(_0x370d52){this['id']=_0x370d52['id']||0x0;this[_0xfc5a('0x4')]=_0x370d52[_0xfc5a('0x4')]||'';this[_0xfc5a('0x5')]=_0x370d52['timeout']||0xa;this[_0xfc5a('0x6')]=_0x370d52[_0xfc5a('0x6')]||_0xfc5a('0x7');this[_0xfc5a('0x8')]=_0x370d52[_0xfc5a('0x8')];this['mapAgentsId']={};this[_0xfc5a('0x9')]=0x0;this[_0xfc5a('0x1')]='';this[_0xfc5a('0xa')]();this[_0xfc5a('0xb')]();}OpenchannelQueue[_0xfc5a('0xc')][_0xfc5a('0xa')]=function(){var _0x5bad86=this[_0xfc5a('0xd')][_0xfc5a('0xe')];this[_0xfc5a('0xd')]=_[_0xfc5a('0xf')](this[_0xfc5a('0x8')],'id');this[_0xfc5a('0xd')][_0xfc5a('0xe')]=_0x5bad86;};OpenchannelQueue[_0xfc5a('0xc')][_0xfc5a('0xb')]=function(){this[_0xfc5a('0x10')]=0x0;this['paused']=0x0;for(var _0x37f7a5=0x0;_0x37f7a5=0x0?this['available']:0x0;var _0xee081b={'id':this['id'],'available':this[_0xfc5a('0x13')],'loggedIn':this[_0xfc5a('0x10')],'name':this[_0xfc5a('0x4')],'paused':this['paused'],'waiting':this[_0xfc5a('0x9')]};var _0xae2221=md5(JSON['stringify'](_0xee081b));if(this[_0xfc5a('0x1')]!==_0xae2221){this[_0xfc5a('0x1')]=_0xae2221;io['to'](util[_0xfc5a('0x14')](_0xfc5a('0x15'),_0xee081b[_0xfc5a('0x4')]))[_0xfc5a('0x16')](_0xfc5a('0x17'),_0xee081b);}};module[_0xfc5a('0x18')]=OpenchannelQueue; \ No newline at end of file +var _0x3a20=['waiting','stringify','format','openchannel:queue:%s','name','exports','lodash','md5','util','localhost','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','prototype','paused','length','loggedIn','openchannelPause','available'];(function(_0x2238ba,_0xfeb953){var _0x33032f=function(_0x337e44){while(--_0x337e44){_0x2238ba['push'](_0x2238ba['shift']());}};_0x33032f(++_0xfeb953);}(_0x3a20,0x126));var _0x03a2=function(_0x3722bb,_0x51f3f7){_0x3722bb=_0x3722bb-0x0;var _0x307d80=_0x3a20[_0x3722bb];return _0x307d80;};'use strict';var _=require(_0x03a2('0x0'));var md5=require(_0x03a2('0x1'));var util=require(_0x03a2('0x2'));var io=require('socket.io-emitter')({'host':_0x03a2('0x3'),'port':0x18eb});function OpenchannelQueue(_0x49fc47){this['id']=_0x49fc47['id']||0x0;this['name']=_0x49fc47['name']||'';this['timeout']=_0x49fc47[_0x03a2('0x4')]||0xa;this[_0x03a2('0x5')]=_0x49fc47[_0x03a2('0x5')]||_0x03a2('0x6');this[_0x03a2('0x7')]=_0x49fc47[_0x03a2('0x7')];this[_0x03a2('0x8')]={};this['waiting']=0x0;this[_0x03a2('0x1')]='';this[_0x03a2('0x9')]();this[_0x03a2('0xa')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x269c27=this['mapAgentsId'][_0x03a2('0xb')];this['mapAgentsId']=_['map'](this[_0x03a2('0x7')],'id');this[_0x03a2('0x8')][_0x03a2('0xb')]=_0x269c27;};OpenchannelQueue[_0x03a2('0xc')][_0x03a2('0xa')]=function(){this['loggedIn']=0x0;this[_0x03a2('0xd')]=0x0;for(var _0x145474=0x0;_0x145474=0x0?this[_0x03a2('0x11')]:0x0;var _0x31de33={'id':this['id'],'available':this[_0x03a2('0x11')],'loggedIn':this[_0x03a2('0xf')],'name':this['name'],'paused':this[_0x03a2('0xd')],'waiting':this[_0x03a2('0x12')]};var _0x55f897=md5(JSON[_0x03a2('0x13')](_0x31de33));if(this[_0x03a2('0x1')]!==_0x55f897){this['md5']=_0x55f897;io['to'](util[_0x03a2('0x14')](_0x03a2('0x15'),_0x31de33[_0x03a2('0x16')]))['emit']('openchannel_queue:save',_0x31de33);}};module[_0x03a2('0x17')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 15f3b97..940c83c 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 _0x0713=['util','socket.io-emitter','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','online','paused','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports'];(function(_0x339078,_0x10c4ee){var _0xf6cc05=function(_0x431898){while(--_0x431898){_0x339078['push'](_0x339078['shift']());}};_0xf6cc05(++_0x10c4ee);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x3071('0x0'));var io=require(_0x3071('0x1'))({'host':_0x3071('0x2'),'port':0x18eb});function SmsQueue(_0x305d85){this['id']=_0x305d85['id']||0x0;this[_0x3071('0x3')]=_0x305d85['name']||'';this[_0x3071('0x4')]=_0x305d85[_0x3071('0x4')]||0xa;this[_0x3071('0x5')]=_0x305d85[_0x3071('0x5')]||_0x3071('0x6');this[_0x3071('0x7')]=_0x305d85[_0x3071('0x7')];this[_0x3071('0x8')]={};this[_0x3071('0x9')]=0x0;this[_0x3071('0xa')]='';this[_0x3071('0xb')]();this[_0x3071('0xc')]();}SmsQueue[_0x3071('0xd')]['updateRouting']=function(){var _0x3457cd=this[_0x3071('0x8')][_0x3071('0xe')];this[_0x3071('0x8')]=_[_0x3071('0xf')](this['Agents'],'id');this[_0x3071('0x8')][_0x3071('0xe')]=_0x3457cd;};SmsQueue[_0x3071('0xd')][_0x3071('0xc')]=function(){this[_0x3071('0x10')]=0x0;this['paused']=0x0;for(var _0x5330a8=0x0;_0x5330a8=0x0?this[_0x3071('0x13')]:0x0;var _0x11bdc9={'id':this['id'],'available':this[_0x3071('0x13')],'loggedIn':this[_0x3071('0x10')],'name':this['name'],'paused':this[_0x3071('0x12')],'waiting':this[_0x3071('0x9')]};var _0x1068d9=md5(JSON[_0x3071('0x14')](_0x11bdc9));if(this[_0x3071('0xa')]!==_0x1068d9){this[_0x3071('0xa')]=_0x1068d9;io['to'](util[_0x3071('0x15')](_0x3071('0x16'),_0x11bdc9['name']))[_0x3071('0x17')](_0x3071('0x18'),_0x11bdc9);}};module[_0x3071('0x19')]=SmsQueue; \ No newline at end of file +var _0xac4a=['strategy','beepall','Agents','waiting','prototype','mapAgentsId','map','_rr','loggedIn','paused','length','smsPause','available','format','sms:queue:%s','name','emit','sms_queue:save','exports','lodash','md5','util','socket.io-emitter','localhost','timeout'];(function(_0x3b2300,_0xdf4483){var _0x5b889f=function(_0x59f813){while(--_0x59f813){_0x3b2300['push'](_0x3b2300['shift']());}};_0x5b889f(++_0xdf4483);}(_0xac4a,0x13f));var _0xaac4=function(_0x1f1128,_0x41066e){_0x1f1128=_0x1f1128-0x0;var _0x3e6fd2=_0xac4a[_0x1f1128];return _0x3e6fd2;};'use strict';var _=require(_0xaac4('0x0'));var md5=require(_0xaac4('0x1'));var util=require(_0xaac4('0x2'));var io=require(_0xaac4('0x3'))({'host':_0xaac4('0x4'),'port':0x18eb});function SmsQueue(_0x1dc251){this['id']=_0x1dc251['id']||0x0;this['name']=_0x1dc251['name']||'';this[_0xaac4('0x5')]=_0x1dc251[_0xaac4('0x5')]||0xa;this[_0xaac4('0x6')]=_0x1dc251['strategy']||_0xaac4('0x7');this['Agents']=_0x1dc251[_0xaac4('0x8')];this['mapAgentsId']={};this[_0xaac4('0x9')]=0x0;this[_0xaac4('0x1')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0xaac4('0xa')]['updateRouting']=function(){var _0x452573=this['mapAgentsId']['_rr'];this[_0xaac4('0xb')]=_[_0xaac4('0xc')](this[_0xaac4('0x8')],'id');this[_0xaac4('0xb')][_0xaac4('0xd')]=_0x452573;};SmsQueue['prototype']['updateRealtime']=function(){this[_0xaac4('0xe')]=0x0;this[_0xaac4('0xf')]=0x0;for(var _0x45e512=0x0;_0x45e512=0x0?this[_0xaac4('0x12')]:0x0;var _0x35bc32={'id':this['id'],'available':this[_0xaac4('0x12')],'loggedIn':this[_0xaac4('0xe')],'name':this['name'],'paused':this[_0xaac4('0xf')],'waiting':this['waiting']};var _0x220630=md5(JSON['stringify'](_0x35bc32));if(this[_0xaac4('0x1')]!==_0x220630){this[_0xaac4('0x1')]=_0x220630;io['to'](util[_0xaac4('0x13')](_0xaac4('0x14'),_0x35bc32[_0xaac4('0x15')]))[_0xaac4('0x16')](_0xaac4('0x17'),_0x35bc32);}};module[_0xaac4('0x18')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 288a31d..e9edc1a 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 _0xab02=['../model/chatQueue','../model/smsQueue','agents','openchannelQueues','chatQueues','smsQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','hasOwnProperty','mergeFromDatabase','prototype','length','isUndefined','initIntervals','intervals','initOpenchannelQueues','updateRealtime','updateRouting','initSmsQueues','initMailQueues','mailQueues','exports','bluebird','moment','../model/agent','../model/interval'];(function(_0x923d21,_0xcb8c09){var _0x4f19f1=function(_0x3d7426){while(--_0x3d7426){_0x923d21['push'](_0x923d21['shift']());}};_0x4f19f1(++_0xcb8c09);}(_0xab02,0x1cc));var _0x2ab0=function(_0x5e5ab9,_0x212cde){_0x5e5ab9=_0x5e5ab9-0x0;var _0x2417ed=_0xab02[_0x5e5ab9];return _0x2417ed;};'use strict';var BPromise=require(_0x2ab0('0x0'));var util=require('util');var _=require('lodash');var moment=require(_0x2ab0('0x1'));var Agent=require(_0x2ab0('0x2'));var Interval=require(_0x2ab0('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x2ab0('0x4'));var SmsQueue=require(_0x2ab0('0x5'));var MailQueue=require('../model/mailQueue');var FaxQueue=require('../model/faxQueue');var Realtime=function(){this[_0x2ab0('0x6')]={};this['intervals']={};this[_0x2ab0('0x7')]={};this[_0x2ab0('0x8')]={};this[_0x2ab0('0x9')]={};this['mailQueues']={};this[_0x2ab0('0xa')]={};this[_0x2ab0('0xb')]={};this[_0x2ab0('0xc')]={};this[_0x2ab0('0xd')]={};this['smsQueuesWaitingInteractions']={};this[_0x2ab0('0xe')]={};};function freeIsNotKey(_0x2abe0e,_0x5133a8,_0xe91e7b){var _0x2356a4=_['mapKeys'](_0x2abe0e,function(_0xe92930,_0x107e65){return _0xe92930[_0xe91e7b];});for(var _0xfcd086 in _0x5133a8){if(_0x5133a8[_0x2ab0('0xf')](_0xfcd086)){if(!_0x2356a4[_0xfcd086]){delete _0x5133a8[_0xfcd086];}}}}Realtime['prototype'][_0x2ab0('0x10')]=function(_0x2ac5bd,_0x108750){for(var _0x53b7fd in _0x108750){if(_0x2ac5bd['hasOwnProperty'](_0x53b7fd)){_0x2ac5bd[_0x53b7fd]=_0x108750[_0x53b7fd];}}};Realtime[_0x2ab0('0x11')]['initAgents']=function(){var _0x122749=this;return function(_0x48ff2c){if(_0x48ff2c){freeIsNotKey(_0x48ff2c,_0x122749[_0x2ab0('0x6')],'id');for(var _0x3cc969=0x0,_0x5af57e={},_0x3a8396={};_0x3cc969<_0x48ff2c[_0x2ab0('0x12')];_0x3cc969+=0x1){_0x5af57e=_0x48ff2c[_0x3cc969];if(_[_0x2ab0('0x13')](_0x122749[_0x2ab0('0x6')][_0x5af57e['id']])){_0x122749['agents'][_0x5af57e['id']]=new Agent(_0x5af57e);}else{_0x122749[_0x2ab0('0x10')](_0x122749[_0x2ab0('0x6')][_0x5af57e['id']],_0x5af57e);}}}return _0x122749['agents'];};};Realtime[_0x2ab0('0x11')][_0x2ab0('0x14')]=function(){var _0xa00325=this;return function(_0x27f2a4){if(_0x27f2a4){freeIsNotKey(_0x27f2a4,_0xa00325[_0x2ab0('0x15')],'id');for(var _0x22e309=0x0,_0x25d1da={},_0x7ac22b={};_0x22e309<_0x27f2a4[_0x2ab0('0x12')];_0x22e309+=0x1){_0x25d1da=_0x27f2a4[_0x22e309];if(_[_0x2ab0('0x13')](_0xa00325[_0x2ab0('0x15')][_0x25d1da['id']])){_0xa00325[_0x2ab0('0x15')][_0x25d1da['id']]=new Interval(_0x25d1da);}else{_0xa00325[_0x2ab0('0x10')](_0xa00325[_0x2ab0('0x15')][_0x25d1da['id']],_0x25d1da);}}}return _0xa00325[_0x2ab0('0x15')];};};Realtime[_0x2ab0('0x11')][_0x2ab0('0x16')]=function(){var _0x315795=this;return function(_0x17e267){if(_0x17e267){freeIsNotKey(_0x17e267,_0x315795[_0x2ab0('0x7')],'id');for(var _0x1ff5bb=0x0,_0x5b49c9={},_0x48acb9={};_0x1ff5bb<_0x17e267[_0x2ab0('0x12')];_0x1ff5bb+=0x1){_0x5b49c9=_0x17e267[_0x1ff5bb];if(_[_0x2ab0('0x13')](_0x315795[_0x2ab0('0x7')][_0x5b49c9['id']])){_0x315795[_0x2ab0('0x7')][_0x5b49c9['id']]=new OpenchannelQueue(_0x5b49c9);}else{_0x315795[_0x2ab0('0x10')](_0x315795['openchannelQueues'][_0x5b49c9['id']],_0x5b49c9);}_0x315795[_0x2ab0('0x7')][_0x5b49c9['id']]['updateRouting']();_0x315795['openchannelQueues'][_0x5b49c9['id']][_0x2ab0('0x17')]();}}return _0x315795[_0x2ab0('0x7')];};};Realtime[_0x2ab0('0x11')]['initChatQueues']=function(){var _0x5c68e4=this;return function(_0x3054f0){if(_0x3054f0){freeIsNotKey(_0x3054f0,_0x5c68e4['chatQueues'],'id');for(var _0x57f401=0x0,_0x133f90={},_0x33dc53={};_0x57f401<_0x3054f0[_0x2ab0('0x12')];_0x57f401+=0x1){_0x133f90=_0x3054f0[_0x57f401];if(_[_0x2ab0('0x13')](_0x5c68e4[_0x2ab0('0x8')][_0x133f90['id']])){_0x5c68e4[_0x2ab0('0x8')][_0x133f90['id']]=new ChatQueue(_0x133f90);}else{_0x5c68e4['mergeFromDatabase'](_0x5c68e4[_0x2ab0('0x8')][_0x133f90['id']],_0x133f90);}_0x5c68e4['chatQueues'][_0x133f90['id']][_0x2ab0('0x18')]();_0x5c68e4['chatQueues'][_0x133f90['id']][_0x2ab0('0x17')]();}}return _0x5c68e4[_0x2ab0('0x8')];};};Realtime[_0x2ab0('0x11')][_0x2ab0('0x19')]=function(){var _0x2644fb=this;return function(_0x5a8cef){if(_0x5a8cef){freeIsNotKey(_0x5a8cef,_0x2644fb[_0x2ab0('0x9')],'id');for(var _0x743b6f=0x0,_0x3a666f={},_0x240c04={};_0x743b6f<_0x5a8cef[_0x2ab0('0x12')];_0x743b6f+=0x1){_0x3a666f=_0x5a8cef[_0x743b6f];if(_[_0x2ab0('0x13')](_0x2644fb[_0x2ab0('0x9')][_0x3a666f['id']])){_0x2644fb['smsQueues'][_0x3a666f['id']]=new SmsQueue(_0x3a666f);}else{_0x2644fb[_0x2ab0('0x10')](_0x2644fb[_0x2ab0('0x9')][_0x3a666f['id']],_0x3a666f);}_0x2644fb[_0x2ab0('0x9')][_0x3a666f['id']]['updateRouting']();_0x2644fb['smsQueues'][_0x3a666f['id']][_0x2ab0('0x17')]();}}return _0x2644fb['smsQueues'];};};Realtime['prototype'][_0x2ab0('0x1a')]=function(){var _0x506c10=this;return function(_0x34a4d8){if(_0x34a4d8){freeIsNotKey(_0x34a4d8,_0x506c10[_0x2ab0('0x1b')],'id');for(var _0x1dc452=0x0,_0x496d75={},_0x4865b8={};_0x1dc452<_0x34a4d8[_0x2ab0('0x12')];_0x1dc452+=0x1){_0x496d75=_0x34a4d8[_0x1dc452];if(_[_0x2ab0('0x13')](_0x506c10[_0x2ab0('0x1b')][_0x496d75['id']])){_0x506c10['mailQueues'][_0x496d75['id']]=new MailQueue(_0x496d75);}else{_0x506c10[_0x2ab0('0x10')](_0x506c10[_0x2ab0('0x1b')][_0x496d75['id']],_0x496d75);}_0x506c10[_0x2ab0('0x1b')][_0x496d75['id']][_0x2ab0('0x18')]();_0x506c10[_0x2ab0('0x1b')][_0x496d75['id']][_0x2ab0('0x17')]();}}return _0x506c10['mailQueues'];};};Realtime[_0x2ab0('0x11')]['initFaxQueues']=function(){var _0x541b9f=this;return function(_0x402767){if(_0x402767){freeIsNotKey(_0x402767,_0x541b9f[_0x2ab0('0xa')],'id');for(var _0xd57f2a=0x0,_0x401631={},_0x236f00={};_0xd57f2a<_0x402767['length'];_0xd57f2a+=0x1){_0x401631=_0x402767[_0xd57f2a];if(_['isUndefined'](_0x541b9f[_0x2ab0('0xa')][_0x401631['id']])){_0x541b9f[_0x2ab0('0xa')][_0x401631['id']]=new FaxQueue(_0x401631);}else{_0x541b9f['mergeFromDatabase'](_0x541b9f[_0x2ab0('0xa')][_0x401631['id']],_0x401631);}_0x541b9f[_0x2ab0('0xa')][_0x401631['id']][_0x2ab0('0x18')]();_0x541b9f[_0x2ab0('0xa')][_0x401631['id']][_0x2ab0('0x17')]();}}return _0x541b9f['faxQueues'];};};module[_0x2ab0('0x1c')]=Realtime; \ No newline at end of file +var _0x197d=['initAgents','length','isUndefined','initOpenchannelQueues','openchannelQueues','updateRouting','updateRealtime','initChatQueues','chatQueues','mergeFromDatabase','initSmsQueues','initMailQueues','initFaxQueues','exports','bluebird','util','lodash','moment','../model/interval','../model/smsQueue','../model/faxQueue','agents','intervals','smsQueues','mailQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype'];(function(_0x32f8d1,_0xfa42fb){var _0x4a73f1=function(_0x3ebb3e){while(--_0x3ebb3e){_0x32f8d1['push'](_0x32f8d1['shift']());}};_0x4a73f1(++_0xfa42fb);}(_0x197d,0x182));var _0xd197=function(_0x355e4e,_0x55e192){_0x355e4e=_0x355e4e-0x0;var _0x507215=_0x197d[_0x355e4e];return _0x507215;};'use strict';var BPromise=require(_0xd197('0x0'));var util=require(_0xd197('0x1'));var _=require(_0xd197('0x2'));var moment=require(_0xd197('0x3'));var Agent=require('../model/agent');var Interval=require(_0xd197('0x4'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require('../model/chatQueue');var SmsQueue=require(_0xd197('0x5'));var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0xd197('0x6'));var Realtime=function(){this[_0xd197('0x7')]={};this[_0xd197('0x8')]={};this['openchannelQueues']={};this['chatQueues']={};this[_0xd197('0x9')]={};this[_0xd197('0xa')]={};this[_0xd197('0xb')]={};this['chatQueuesWaitingInteractions']={};this[_0xd197('0xc')]={};this[_0xd197('0xd')]={};this['smsQueuesWaitingInteractions']={};this['faxQueuesWaitingInteractions']={};};function freeIsNotKey(_0x1def16,_0x2c0dbc,_0x514ebf){var _0x29fea=_[_0xd197('0xe')](_0x1def16,function(_0x58dd0e,_0x1b4ce5){return _0x58dd0e[_0x514ebf];});for(var _0x3d603f in _0x2c0dbc){if(_0x2c0dbc[_0xd197('0xf')](_0x3d603f)){if(!_0x29fea[_0x3d603f]){delete _0x2c0dbc[_0x3d603f];}}}}Realtime[_0xd197('0x10')]['mergeFromDatabase']=function(_0x503e53,_0x284be8){for(var _0x15216c in _0x284be8){if(_0x503e53[_0xd197('0xf')](_0x15216c)){_0x503e53[_0x15216c]=_0x284be8[_0x15216c];}}};Realtime[_0xd197('0x10')][_0xd197('0x11')]=function(){var _0x41388f=this;return function(_0x487369){if(_0x487369){freeIsNotKey(_0x487369,_0x41388f[_0xd197('0x7')],'id');for(var _0x1eb549=0x0,_0x5d2eaa={},_0x16241b={};_0x1eb549<_0x487369[_0xd197('0x12')];_0x1eb549+=0x1){_0x5d2eaa=_0x487369[_0x1eb549];if(_[_0xd197('0x13')](_0x41388f[_0xd197('0x7')][_0x5d2eaa['id']])){_0x41388f[_0xd197('0x7')][_0x5d2eaa['id']]=new Agent(_0x5d2eaa);}else{_0x41388f['mergeFromDatabase'](_0x41388f[_0xd197('0x7')][_0x5d2eaa['id']],_0x5d2eaa);}}}return _0x41388f[_0xd197('0x7')];};};Realtime[_0xd197('0x10')]['initIntervals']=function(){var _0xca849c=this;return function(_0x5d19e2){if(_0x5d19e2){freeIsNotKey(_0x5d19e2,_0xca849c[_0xd197('0x8')],'id');for(var _0x1d5de8=0x0,_0x50335d={},_0x578d65={};_0x1d5de8<_0x5d19e2['length'];_0x1d5de8+=0x1){_0x50335d=_0x5d19e2[_0x1d5de8];if(_[_0xd197('0x13')](_0xca849c['intervals'][_0x50335d['id']])){_0xca849c['intervals'][_0x50335d['id']]=new Interval(_0x50335d);}else{_0xca849c['mergeFromDatabase'](_0xca849c['intervals'][_0x50335d['id']],_0x50335d);}}}return _0xca849c[_0xd197('0x8')];};};Realtime['prototype'][_0xd197('0x14')]=function(){var _0x1b2b8f=this;return function(_0x2162a6){if(_0x2162a6){freeIsNotKey(_0x2162a6,_0x1b2b8f['openchannelQueues'],'id');for(var _0x16134c=0x0,_0xb4f931={},_0x1fe874={};_0x16134c<_0x2162a6['length'];_0x16134c+=0x1){_0xb4f931=_0x2162a6[_0x16134c];if(_[_0xd197('0x13')](_0x1b2b8f[_0xd197('0x15')][_0xb4f931['id']])){_0x1b2b8f[_0xd197('0x15')][_0xb4f931['id']]=new OpenchannelQueue(_0xb4f931);}else{_0x1b2b8f['mergeFromDatabase'](_0x1b2b8f[_0xd197('0x15')][_0xb4f931['id']],_0xb4f931);}_0x1b2b8f['openchannelQueues'][_0xb4f931['id']][_0xd197('0x16')]();_0x1b2b8f['openchannelQueues'][_0xb4f931['id']][_0xd197('0x17')]();}}return _0x1b2b8f['openchannelQueues'];};};Realtime[_0xd197('0x10')][_0xd197('0x18')]=function(){var _0x21065d=this;return function(_0x5c35c2){if(_0x5c35c2){freeIsNotKey(_0x5c35c2,_0x21065d[_0xd197('0x19')],'id');for(var _0x25a611=0x0,_0x184d27={},_0x16a17d={};_0x25a611<_0x5c35c2[_0xd197('0x12')];_0x25a611+=0x1){_0x184d27=_0x5c35c2[_0x25a611];if(_[_0xd197('0x13')](_0x21065d['chatQueues'][_0x184d27['id']])){_0x21065d[_0xd197('0x19')][_0x184d27['id']]=new ChatQueue(_0x184d27);}else{_0x21065d[_0xd197('0x1a')](_0x21065d[_0xd197('0x19')][_0x184d27['id']],_0x184d27);}_0x21065d[_0xd197('0x19')][_0x184d27['id']][_0xd197('0x16')]();_0x21065d[_0xd197('0x19')][_0x184d27['id']][_0xd197('0x17')]();}}return _0x21065d['chatQueues'];};};Realtime[_0xd197('0x10')][_0xd197('0x1b')]=function(){var _0x3177be=this;return function(_0x3af491){if(_0x3af491){freeIsNotKey(_0x3af491,_0x3177be[_0xd197('0x9')],'id');for(var _0x33051b=0x0,_0x52a9eb={},_0x31e397={};_0x33051b<_0x3af491[_0xd197('0x12')];_0x33051b+=0x1){_0x52a9eb=_0x3af491[_0x33051b];if(_[_0xd197('0x13')](_0x3177be[_0xd197('0x9')][_0x52a9eb['id']])){_0x3177be['smsQueues'][_0x52a9eb['id']]=new SmsQueue(_0x52a9eb);}else{_0x3177be[_0xd197('0x1a')](_0x3177be[_0xd197('0x9')][_0x52a9eb['id']],_0x52a9eb);}_0x3177be[_0xd197('0x9')][_0x52a9eb['id']][_0xd197('0x16')]();_0x3177be['smsQueues'][_0x52a9eb['id']]['updateRealtime']();}}return _0x3177be[_0xd197('0x9')];};};Realtime['prototype'][_0xd197('0x1c')]=function(){var _0x389e75=this;return function(_0x836a4f){if(_0x836a4f){freeIsNotKey(_0x836a4f,_0x389e75['mailQueues'],'id');for(var _0x54cb1f=0x0,_0x5ca848={},_0x27c5b3={};_0x54cb1f<_0x836a4f['length'];_0x54cb1f+=0x1){_0x5ca848=_0x836a4f[_0x54cb1f];if(_[_0xd197('0x13')](_0x389e75[_0xd197('0xa')][_0x5ca848['id']])){_0x389e75[_0xd197('0xa')][_0x5ca848['id']]=new MailQueue(_0x5ca848);}else{_0x389e75['mergeFromDatabase'](_0x389e75[_0xd197('0xa')][_0x5ca848['id']],_0x5ca848);}_0x389e75[_0xd197('0xa')][_0x5ca848['id']][_0xd197('0x16')]();_0x389e75[_0xd197('0xa')][_0x5ca848['id']][_0xd197('0x17')]();}}return _0x389e75[_0xd197('0xa')];};};Realtime[_0xd197('0x10')][_0xd197('0x1d')]=function(){var _0x2383ab=this;return function(_0x3c5ef6){if(_0x3c5ef6){freeIsNotKey(_0x3c5ef6,_0x2383ab[_0xd197('0xb')],'id');for(var _0x1d68da=0x0,_0x55d29f={},_0x4dc9a={};_0x1d68da<_0x3c5ef6[_0xd197('0x12')];_0x1d68da+=0x1){_0x55d29f=_0x3c5ef6[_0x1d68da];if(_[_0xd197('0x13')](_0x2383ab[_0xd197('0xb')][_0x55d29f['id']])){_0x2383ab[_0xd197('0xb')][_0x55d29f['id']]=new FaxQueue(_0x55d29f);}else{_0x2383ab[_0xd197('0x1a')](_0x2383ab[_0xd197('0xb')][_0x55d29f['id']],_0x55d29f);}_0x2383ab['faxQueues'][_0x55d29f['id']]['updateRouting']();_0x2383ab[_0xd197('0xb')][_0x55d29f['id']]['updateRealtime']();}}return _0x2383ab[_0xd197('0xb')];};};module[_0xd197('0x1e')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 2414da9..47492f2 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 _0xaa31=['AddTagsToChatInteraction','../client','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0xc4d9e6,_0xf8e46){var _0x416db2=function(_0x2d172e){while(--_0x2d172e){_0xc4d9e6['push'](_0xc4d9e6['shift']());}};_0x416db2(++_0xf8e46);}(_0xaa31,0xd9));var _0x1aa3=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xaa31[_0x344a3f];return _0x264712;};'use strict';var client=require(_0x1aa3('0x0'));exports['update']=function(_0x51a95d,_0x4dc415){return client[_0x1aa3('0x1')](_0x1aa3('0x2'),{'body':_0x4dc415,'options':{'where':{'id':_0x51a95d}},'log':_0x1aa3('0x3')});};exports[_0x1aa3('0x4')]=function(_0x2cec7a,_0x3480d2){return client['Request'](_0x1aa3('0x5'),{'body':_0x3480d2,'options':{'where':{'id':_0x2cec7a}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x714b=['update','Request','UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction','../client'];(function(_0x41be56,_0x486194){var _0xa70b2a=function(_0x276dbb){while(--_0x276dbb){_0x41be56['push'](_0x41be56['shift']());}};_0xa70b2a(++_0x486194);}(_0x714b,0x18b));var _0xb714=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x714b[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require(_0xb714('0x0'));exports[_0xb714('0x1')]=function(_0x6997e1,_0x1cbb19){return client[_0xb714('0x2')](_0xb714('0x3'),{'body':_0x1cbb19,'options':{'where':{'id':_0x6997e1}},'log':_0xb714('0x4')});};exports['addTags']=function(_0x2a437a,_0x55ade7){return client[_0xb714('0x2')](_0xb714('0x5'),{'body':_0x55ade7,'options':{'where':{'id':_0x2a437a}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index b5ca43b..7338217 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 _0x773e=['create','Request','CreateChatMessage','createChatMessage'];(function(_0x2b069e,_0x342c30){var _0x2044cd=function(_0x15b6f0){while(--_0x15b6f0){_0x2b069e['push'](_0x2b069e['shift']());}};_0x2044cd(++_0x342c30);}(_0x773e,0x1b0));var _0xe773=function(_0x1c9263,_0x162625){_0x1c9263=_0x1c9263-0x0;var _0x4b7bec=_0x773e[_0x1c9263];return _0x4b7bec;};'use strict';var client=require('../client');exports[_0xe773('0x0')]=function(_0x442ba7){return client[_0xe773('0x1')](_0xe773('0x2'),{'body':_0x442ba7,'log':_0xe773('0x3')});}; \ No newline at end of file +var _0x6da5=['createChatMessage','create','CreateChatMessage'];(function(_0x4e41a4,_0x14c987){var _0x4dc034=function(_0x580d4e){while(--_0x580d4e){_0x4e41a4['push'](_0x4e41a4['shift']());}};_0x4dc034(++_0x14c987);}(_0x6da5,0x64));var _0x56da=function(_0x477422,_0xcefc76){_0x477422=_0x477422-0x0;var _0x2c382a=_0x6da5[_0x477422];return _0x2c382a;};'use strict';var client=require('../client');exports[_0x56da('0x0')]=function(_0x321d59){return client['Request'](_0x56da('0x1'),{'body':_0x321d59,'log':_0x56da('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index da9d3e4..096e416 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 _0x9f51=['name','timeout','strategy','User','Agents','online','chatPause','../client','getChatQueues'];(function(_0x407b9f,_0x26e3e1){var _0x7a8eeb=function(_0x1be7d4){while(--_0x1be7d4){_0x407b9f['push'](_0x407b9f['shift']());}};_0x7a8eeb(++_0x26e3e1);}(_0x9f51,0x19c));var _0x19f5=function(_0x5b791d,_0x49cc81){_0x5b791d=_0x5b791d-0x0;var _0xdd1c36=_0x9f51[_0x5b791d];return _0xdd1c36;};'use strict';var client=require(_0x19f5('0x0'));exports[_0x19f5('0x1')]=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x19f5('0x2'),_0x19f5('0x3'),_0x19f5('0x4')],'include':[{'model':_0x19f5('0x5'),'as':_0x19f5('0x6'),'attributes':['id','name',_0x19f5('0x7'),_0x19f5('0x8')]}]},'log':_0x19f5('0x1')});};}; \ No newline at end of file +var _0x4c2c=['strategy','Agents','name','chatPause','getChatQueues','timeout'];(function(_0x180816,_0x229213){var _0x3cc3aa=function(_0x330367){while(--_0x330367){_0x180816['push'](_0x180816['shift']());}};_0x3cc3aa(++_0x229213);}(_0x4c2c,0xe8));var _0xc4c2=function(_0x14a4d0,_0x4c7068){_0x14a4d0=_0x14a4d0-0x0;var _0x18c8ab=_0x4c2c[_0x14a4d0];return _0x18c8ab;};'use strict';var client=require('../client');exports[_0xc4c2('0x0')]=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0xc4c2('0x1'),_0xc4c2('0x2')],'include':[{'model':'User','as':_0xc4c2('0x3'),'attributes':['id',_0xc4c2('0x4'),'online',_0xc4c2('0x5')]}]},'log':_0xc4c2('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index c630d98..6fdc120 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 _0x6611=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','create'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x6611,0xdd));var _0x1661=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6611[_0x432682];return _0x463d05;};'use strict';var client=require('../client');exports[_0x1661('0x0')]=function(_0x42056f){return client[_0x1661('0x1')](_0x1661('0x2'),{'body':_0x42056f,'log':_0x1661('0x2')});};exports[_0x1661('0x3')]=function(_0x44e418,_0x25bce6){return client[_0x1661('0x1')](_0x1661('0x4'),{'body':_0x25bce6,'options':{'where':{'uniqueid':_0x44e418},'order':[['id',_0x1661('0x5')]],'limit':0x1},'log':_0x1661('0x4')});}; \ No newline at end of file +var _0xe4d6=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','../client'];(function(_0xe6d003,_0x1222d7){var _0x5798ba=function(_0x429c12){while(--_0x429c12){_0xe6d003['push'](_0xe6d003['shift']());}};_0x5798ba(++_0x1222d7);}(_0xe4d6,0xd7));var _0x6e4d=function(_0x2f2665,_0x1df8ab){_0x2f2665=_0x2f2665-0x0;var _0x3ee81a=_0xe4d6[_0x2f2665];return _0x3ee81a;};'use strict';var client=require(_0x6e4d('0x0'));exports[_0x6e4d('0x1')]=function(_0x128c2e){return client[_0x6e4d('0x2')]('CreateChatQueueReport',{'body':_0x128c2e,'log':_0x6e4d('0x3')});};exports[_0x6e4d('0x4')]=function(_0x1d09ba,_0x57b524){return client['Request'](_0x6e4d('0x5'),{'body':_0x57b524,'options':{'where':{'uniqueid':_0x1d09ba},'order':[['id','DESC']],'limit':0x1},'log':_0x6e4d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 238c3b0..c2ea11f 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 _0x5ed9=['AddTagsToFaxInteraction','update','UpdateFaxInteraction','Request'];(function(_0x3248bd,_0x1b7104){var _0x2a3dc1=function(_0x28de13){while(--_0x28de13){_0x3248bd['push'](_0x3248bd['shift']());}};_0x2a3dc1(++_0x1b7104);}(_0x5ed9,0x185));var _0x95ed=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5ed9[_0x13d07a];return _0x5ee0ee;};'use strict';var client=require('../client');exports[_0x95ed('0x0')]=function(_0x59bd8d,_0x4b8c41){return client['Request'](_0x95ed('0x1'),{'body':_0x4b8c41,'options':{'where':{'id':_0x59bd8d}},'log':'updateFaxInteraction'});};exports['addTags']=function(_0x21044f,_0x588882){return client[_0x95ed('0x2')](_0x95ed('0x3'),{'body':_0x588882,'options':{'where':{'id':_0x21044f}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0xe760=['addTagsToFaxInteraction','Request','UpdateFaxInteraction','updateFaxInteraction','addTags','AddTagsToFaxInteraction'];(function(_0x10291b,_0x518773){var _0x1d5fbe=function(_0x24df58){while(--_0x24df58){_0x10291b['push'](_0x10291b['shift']());}};_0x1d5fbe(++_0x518773);}(_0xe760,0x1f3));var _0x0e76=function(_0x48c5ec,_0x49e371){_0x48c5ec=_0x48c5ec-0x0;var _0x9689c0=_0xe760[_0x48c5ec];return _0x9689c0;};'use strict';var client=require('../client');exports['update']=function(_0x437f75,_0x660ad3){return client[_0x0e76('0x0')](_0x0e76('0x1'),{'body':_0x660ad3,'options':{'where':{'id':_0x437f75}},'log':_0x0e76('0x2')});};exports[_0x0e76('0x3')]=function(_0x3224fd,_0x526610){return client[_0x0e76('0x0')](_0x0e76('0x4'),{'body':_0x526610,'options':{'where':{'id':_0x3224fd}},'log':_0x0e76('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index beae980..9cf7661 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 _0xe989=['CreateFaxMessage','createFaxMessage','../client','create','Request'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe989,0x13d));var _0x9e98=function(_0x2993c1,_0x37681f){_0x2993c1=_0x2993c1-0x0;var _0x41c9cf=_0xe989[_0x2993c1];return _0x41c9cf;};'use strict';var client=require(_0x9e98('0x0'));exports[_0x9e98('0x1')]=function(_0x46e5d5){return client[_0x9e98('0x2')](_0x9e98('0x3'),{'body':_0x46e5d5,'log':_0x9e98('0x4')});}; \ No newline at end of file +var _0x4f55=['Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x6d13a,_0x521ede){var _0x5b827a=function(_0x4f4e2a){while(--_0x4f4e2a){_0x6d13a['push'](_0x6d13a['shift']());}};_0x5b827a(++_0x521ede);}(_0x4f55,0xe3));var _0x54f5=function(_0x16b2d4,_0x598d13){_0x16b2d4=_0x16b2d4-0x0;var _0xe90e45=_0x4f55[_0x16b2d4];return _0xe90e45;};'use strict';var client=require(_0x54f5('0x0'));exports['create']=function(_0x48ea99){return client[_0x54f5('0x1')](_0x54f5('0x2'),{'body':_0x48ea99,'log':_0x54f5('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index bd877cd..291a7b5 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 _0x2193=['name','timeout','User','Agents','faxPause','../client','getFaxQueues'];(function(_0xef6e46,_0x4b2206){var _0x3aba23=function(_0x48024f){while(--_0x48024f){_0xef6e46['push'](_0xef6e46['shift']());}};_0x3aba23(++_0x4b2206);}(_0x2193,0x1e1));var _0x3219=function(_0x563b5c,_0x164c39){_0x563b5c=_0x563b5c-0x0;var _0x44aafb=_0x2193[_0x563b5c];return _0x44aafb;};'use strict';var client=require(_0x3219('0x0'));exports[_0x3219('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x3219('0x2'),_0x3219('0x3'),'strategy'],'include':[{'model':_0x3219('0x4'),'as':_0x3219('0x5'),'attributes':['id',_0x3219('0x2'),'online',_0x3219('0x6')]}]},'log':_0x3219('0x1')});};}; \ No newline at end of file +var _0xd773=['Agents','../client','getFaxQueues','GetFaxQueue','name','timeout','strategy','User'];(function(_0x2183cb,_0x4e2cf3){var _0x1d70bc=function(_0x16df8f){while(--_0x16df8f){_0x2183cb['push'](_0x2183cb['shift']());}};_0x1d70bc(++_0x4e2cf3);}(_0xd773,0x1d1));var _0x3d77=function(_0x3084e0,_0x39fbce){_0x3084e0=_0x3084e0-0x0;var _0x29d22c=_0xd773[_0x3084e0];return _0x29d22c;};'use strict';var client=require(_0x3d77('0x0'));exports[_0x3d77('0x1')]=function(){return function(){return client['Request'](_0x3d77('0x2'),{'options':{'raw':![],'attributes':['id',_0x3d77('0x3'),_0x3d77('0x4'),_0x3d77('0x5')],'include':[{'model':_0x3d77('0x6'),'as':_0x3d77('0x7'),'attributes':['id',_0x3d77('0x3'),'online','faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index bbe2125..fe0f76a 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 _0x6a93=['UpdateFaxQueueReport','DESC','../client','create','CreateFaxQueueReport','update','Request'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6a93,0x1d7));var _0x36a9=function(_0x5dc303,_0x473b18){_0x5dc303=_0x5dc303-0x0;var _0x229e47=_0x6a93[_0x5dc303];return _0x229e47;};'use strict';var client=require(_0x36a9('0x0'));exports[_0x36a9('0x1')]=function(_0x3821a9){return client['Request']('CreateFaxQueueReport',{'body':_0x3821a9,'log':_0x36a9('0x2')});};exports[_0x36a9('0x3')]=function(_0x4942ac,_0x2deb45){return client[_0x36a9('0x4')](_0x36a9('0x5'),{'body':_0x2deb45,'options':{'where':{'uniqueid':_0x4942ac},'order':[['id',_0x36a9('0x6')]],'limit':0x1},'log':_0x36a9('0x5')});}; \ No newline at end of file +var _0xc6d7=['update','UpdateFaxQueueReport','../client','Request','CreateFaxQueueReport'];(function(_0x444c4b,_0x44e952){var _0x33d15b=function(_0x47c7ea){while(--_0x47c7ea){_0x444c4b['push'](_0x444c4b['shift']());}};_0x33d15b(++_0x44e952);}(_0xc6d7,0x174));var _0x7c6d=function(_0x125753,_0x2ad9cb){_0x125753=_0x125753-0x0;var _0x280c08=_0xc6d7[_0x125753];return _0x280c08;};'use strict';var client=require(_0x7c6d('0x0'));exports['create']=function(_0x44e226){return client[_0x7c6d('0x1')](_0x7c6d('0x2'),{'body':_0x44e226,'log':'CreateFaxQueueReport'});};exports[_0x7c6d('0x3')]=function(_0x51981e,_0x520315){return client[_0x7c6d('0x1')](_0x7c6d('0x4'),{'body':_0x520315,'options':{'where':{'uniqueid':_0x51981e},'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 7cbe706..a61186b 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 _0x9c00=['interval','../client','getIntervals','name','Interval'];(function(_0x44714c,_0x2ac454){var _0x57d4d5=function(_0x5aca44){while(--_0x5aca44){_0x44714c['push'](_0x44714c['shift']());}};_0x57d4d5(++_0x2ac454);}(_0x9c00,0x1a0));var _0x09c0=function(_0x18b56f,_0x2d8823){_0x18b56f=_0x18b56f-0x0;var _0x4df0e0=_0x9c00[_0x18b56f];return _0x4df0e0;};'use strict';var client=require(_0x09c0('0x0'));exports[_0x09c0('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x09c0('0x2')],'include':[{'model':_0x09c0('0x3'),'as':'Intervals','attributes':['id',_0x09c0('0x2'),_0x09c0('0x4')]}]},'log':_0x09c0('0x1')});};}; \ No newline at end of file +var _0x5eb8=['getIntervals','Request','GetInterval','name','Interval','Intervals','interval'];(function(_0x457f2e,_0x3c7fa7){var _0x335ac0=function(_0x2a08bf){while(--_0x2a08bf){_0x457f2e['push'](_0x457f2e['shift']());}};_0x335ac0(++_0x3c7fa7);}(_0x5eb8,0xb0));var _0x85eb=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x5eb8[_0x1d50f2];return _0x3769b8;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client[_0x85eb('0x0')](_0x85eb('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x85eb('0x2')],'include':[{'model':_0x85eb('0x3'),'as':_0x85eb('0x4'),'attributes':['id',_0x85eb('0x2'),_0x85eb('0x5')]}]},'log':_0x85eb('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 2800b80..87f8946 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 _0xd163=['UpdateMailInteraction','updateMailInteraction','addTags','Request','addTagsToChatInteraction','../client','update'];(function(_0x4a30a1,_0x483a3f){var _0x2617c1=function(_0x555d49){while(--_0x555d49){_0x4a30a1['push'](_0x4a30a1['shift']());}};_0x2617c1(++_0x483a3f);}(_0xd163,0x91));var _0x3d16=function(_0x1057a3,_0x28d9b7){_0x1057a3=_0x1057a3-0x0;var _0x131cdb=_0xd163[_0x1057a3];return _0x131cdb;};'use strict';var client=require(_0x3d16('0x0'));exports[_0x3d16('0x1')]=function(_0x2d6c5e,_0x6882d1){return client['Request'](_0x3d16('0x2'),{'body':_0x6882d1,'options':{'where':{'id':_0x2d6c5e}},'log':_0x3d16('0x3')});};exports[_0x3d16('0x4')]=function(_0x33290e,_0x294df8){return client[_0x3d16('0x5')]('AddTagsToMailInteraction',{'body':_0x294df8,'options':{'where':{'id':_0x33290e}},'log':_0x3d16('0x6')});}; \ No newline at end of file +var _0x4113=['updateMailInteraction','addTagsToChatInteraction','../client','Request','UpdateMailInteraction'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4113,0xe3));var _0x3411=function(_0x1701d4,_0x4ce8b5){_0x1701d4=_0x1701d4-0x0;var _0x528e56=_0x4113[_0x1701d4];return _0x528e56;};'use strict';var client=require(_0x3411('0x0'));exports['update']=function(_0x3fc47a,_0x5259c1){return client[_0x3411('0x1')](_0x3411('0x2'),{'body':_0x5259c1,'options':{'where':{'id':_0x3fc47a}},'log':_0x3411('0x3')});};exports['addTags']=function(_0x33376c,_0x323fe7){return client['Request']('AddTagsToMailInteraction',{'body':_0x323fe7,'options':{'where':{'id':_0x33376c}},'log':_0x3411('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 1ba406e..53801e5 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 _0x9b20=['Request','createMailMessage','../client','create'];(function(_0x574617,_0x42eccc){var _0x29de90=function(_0x367aff){while(--_0x367aff){_0x574617['push'](_0x574617['shift']());}};_0x29de90(++_0x42eccc);}(_0x9b20,0xa6));var _0x09b2=function(_0x2959a6,_0x32b484){_0x2959a6=_0x2959a6-0x0;var _0x5090e3=_0x9b20[_0x2959a6];return _0x5090e3;};'use strict';var client=require(_0x09b2('0x0'));exports[_0x09b2('0x1')]=function(_0x1e2136){return client[_0x09b2('0x2')]('CreateMailMessage',{'body':_0x1e2136,'log':_0x09b2('0x3')});}; \ No newline at end of file +var _0x9a6d=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0x52518d,_0x236c08){var _0x27dfde=function(_0xa71ed){while(--_0xa71ed){_0x52518d['push'](_0x52518d['shift']());}};_0x27dfde(++_0x236c08);}(_0x9a6d,0x8a));var _0xd9a6=function(_0xac2a1c,_0x552038){_0xac2a1c=_0xac2a1c-0x0;var _0x502d94=_0x9a6d[_0xac2a1c];return _0x502d94;};'use strict';var client=require(_0xd9a6('0x0'));exports[_0xd9a6('0x1')]=function(_0x17ae5b){return client[_0xd9a6('0x2')](_0xd9a6('0x3'),{'body':_0x17ae5b,'log':_0xd9a6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 77b8d9e..d8d8d37 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 _0x547f=['strategy','User','Agents','online','mailPause','getMailQueues','Request','GetMailQueue'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x547f,0xa5));var _0xf547=function(_0x5b254c,_0x2f65cd){_0x5b254c=_0x5b254c-0x0;var _0x3394d8=_0x547f[_0x5b254c];return _0x3394d8;};'use strict';var client=require('../client');exports[_0xf547('0x0')]=function(){return function(){return client[_0xf547('0x1')](_0xf547('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xf547('0x3')],'include':[{'model':_0xf547('0x4'),'as':_0xf547('0x5'),'attributes':['id','name',_0xf547('0x6'),_0xf547('0x7')]}]},'log':_0xf547('0x0')});};}; \ No newline at end of file +var _0xd261=['Agents','mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout','User'];(function(_0x1e8ccb,_0x14fc9f){var _0x125471=function(_0x2c34fb){while(--_0x2c34fb){_0x1e8ccb['push'](_0x1e8ccb['shift']());}};_0x125471(++_0x14fc9f);}(_0xd261,0x158));var _0x1d26=function(_0x1d453f,_0x5793a9){_0x1d453f=_0x1d453f-0x0;var _0x50996a=_0xd261[_0x1d453f];return _0x50996a;};'use strict';var client=require(_0x1d26('0x0'));exports[_0x1d26('0x1')]=function(){return function(){return client[_0x1d26('0x2')](_0x1d26('0x3'),{'options':{'raw':![],'attributes':['id',_0x1d26('0x4'),_0x1d26('0x5'),'strategy'],'include':[{'model':_0x1d26('0x6'),'as':_0x1d26('0x7'),'attributes':['id',_0x1d26('0x4'),'online',_0x1d26('0x8')]}]},'log':_0x1d26('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 1eda3a1..40ace04 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 _0xd374=['create','CreateMailQueueReport','update','UpdateMailQueueReport','DESC'];(function(_0x474b00,_0x281516){var _0x48ca63=function(_0x41eb18){while(--_0x41eb18){_0x474b00['push'](_0x474b00['shift']());}};_0x48ca63(++_0x281516);}(_0xd374,0xc8));var _0x4d37=function(_0x86509f,_0x2de480){_0x86509f=_0x86509f-0x0;var _0xbf41b4=_0xd374[_0x86509f];return _0xbf41b4;};'use strict';var client=require('../client');exports[_0x4d37('0x0')]=function(_0x4d9895){return client['Request'](_0x4d37('0x1'),{'body':_0x4d9895,'log':_0x4d37('0x1')});};exports[_0x4d37('0x2')]=function(_0x1d957b,_0x5b6897){return client['Request'](_0x4d37('0x3'),{'body':_0x5b6897,'options':{'where':{'uniqueid':_0x1d957b},'order':[['id',_0x4d37('0x4')]],'limit':0x1},'log':_0x4d37('0x3')});}; \ No newline at end of file +var _0xe672=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create','Request'];(function(_0x3e21f4,_0x43d310){var _0x40fc49=function(_0x54a8f6){while(--_0x54a8f6){_0x3e21f4['push'](_0x3e21f4['shift']());}};_0x40fc49(++_0x43d310);}(_0xe672,0xd6));var _0x2e67=function(_0x3678e7,_0xe378be){_0x3678e7=_0x3678e7-0x0;var _0x273d50=_0xe672[_0x3678e7];return _0x273d50;};'use strict';var client=require(_0x2e67('0x0'));exports[_0x2e67('0x1')]=function(_0xaa12ae){return client[_0x2e67('0x2')]('CreateMailQueueReport',{'body':_0xaa12ae,'log':_0x2e67('0x3')});};exports[_0x2e67('0x4')]=function(_0x5462be,_0x298636){return client['Request'](_0x2e67('0x5'),{'body':_0x298636,'options':{'where':{'uniqueid':_0x5462be},'order':[['id',_0x2e67('0x6')]],'limit':0x1},'log':_0x2e67('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 209a3f3..25b7eb5 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 _0x70fa=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','../client','update'];(function(_0x3c9b30,_0x923cce){var _0x32b462=function(_0x204307){while(--_0x204307){_0x3c9b30['push'](_0x3c9b30['shift']());}};_0x32b462(++_0x923cce);}(_0x70fa,0x1e4));var _0xa70f=function(_0xc81ca7,_0xb90d5){_0xc81ca7=_0xc81ca7-0x0;var _0x366401=_0x70fa[_0xc81ca7];return _0x366401;};'use strict';var client=require(_0xa70f('0x0'));exports[_0xa70f('0x1')]=function(_0x901711,_0x2b0117){return client['Request'](_0xa70f('0x2'),{'body':_0x2b0117,'options':{'where':{'id':_0x901711}},'log':_0xa70f('0x3')});};exports[_0xa70f('0x4')]=function(_0x529298,_0x5040d0){return client[_0xa70f('0x5')]('AddTagsToOpenchannelInteraction',{'body':_0x5040d0,'options':{'where':{'id':_0x529298}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x3313=['addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x2602a8,_0x127ce6){var _0x5d0d85=function(_0x561de0){while(--_0x561de0){_0x2602a8['push'](_0x2602a8['shift']());}};_0x5d0d85(++_0x127ce6);}(_0x3313,0xec));var _0x3331=function(_0x3de476,_0x296c76){_0x3de476=_0x3de476-0x0;var _0x4a0593=_0x3313[_0x3de476];return _0x4a0593;};'use strict';var client=require('../client');exports['update']=function(_0x4eb61f,_0x116ab2){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x116ab2,'options':{'where':{'id':_0x4eb61f}},'log':'updateOpenchannelInteraction'});};exports[_0x3331('0x0')]=function(_0x1420d3,_0x535744){return client[_0x3331('0x1')](_0x3331('0x2'),{'body':_0x535744,'options':{'where':{'id':_0x1420d3}},'log':_0x3331('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index d8783f0..e79dbc1 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 _0xe14d=['Request','createOpenchannelMessage','../client','create'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe14d,0x1ee));var _0xde14=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xe14d[_0x257642];return _0x3d813b;};'use strict';var client=require(_0xde14('0x0'));exports[_0xde14('0x1')]=function(_0x1b5d3b){return client[_0xde14('0x2')]('CreateOpenchannelMessage',{'body':_0x1b5d3b,'log':_0xde14('0x3')});}; \ No newline at end of file +var _0xf4eb=['../client','createOpenchannelMessage'];(function(_0x3b0a27,_0x3938b4){var _0x42f938=function(_0x26e400){while(--_0x26e400){_0x3b0a27['push'](_0x3b0a27['shift']());}};_0x42f938(++_0x3938b4);}(_0xf4eb,0xec));var _0xbf4e=function(_0x34c95d,_0x3aed92){_0x34c95d=_0x34c95d-0x0;var _0xcd80a7=_0xf4eb[_0x34c95d];return _0xcd80a7;};'use strict';var client=require(_0xbf4e('0x0'));exports['create']=function(_0x50f2fc){return client['Request']('CreateOpenchannelMessage',{'body':_0x50f2fc,'log':_0xbf4e('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 7214e74..e4171c6 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 _0x1082=['GetOpenchannelQueue','name','strategy','User','Agents','openchannelPause','../client','getOpenchannelQueues'];(function(_0x494315,_0x2d42bd){var _0x49cc18=function(_0x419de9){while(--_0x419de9){_0x494315['push'](_0x494315['shift']());}};_0x49cc18(++_0x2d42bd);}(_0x1082,0x156));var _0x2108=function(_0x574d9b,_0x2063da){_0x574d9b=_0x574d9b-0x0;var _0x31d2a5=_0x1082[_0x574d9b];return _0x31d2a5;};'use strict';var client=require(_0x2108('0x0'));exports[_0x2108('0x1')]=function(){return function(){return client['Request'](_0x2108('0x2'),{'options':{'raw':![],'attributes':['id',_0x2108('0x3'),'timeout',_0x2108('0x4')],'include':[{'model':_0x2108('0x5'),'as':_0x2108('0x6'),'attributes':['id',_0x2108('0x3'),'online',_0x2108('0x7')]}]},'log':_0x2108('0x1')});};}; \ No newline at end of file +var _0xf411=['GetOpenchannelQueue','timeout','User','Agents','online','openchannelPause','getOpenchannelQueues','Request'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xf411,0x156));var _0x1f41=function(_0x22fe93,_0x1c0fd6){_0x22fe93=_0x22fe93-0x0;var _0x272f1e=_0xf411[_0x22fe93];return _0x272f1e;};'use strict';var client=require('../client');exports[_0x1f41('0x0')]=function(){return function(){return client[_0x1f41('0x1')](_0x1f41('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x1f41('0x3'),'strategy'],'include':[{'model':_0x1f41('0x4'),'as':_0x1f41('0x5'),'attributes':['id','name',_0x1f41('0x6'),_0x1f41('0x7')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index bce1078..3558f4a 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 _0x55cd=['create','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x348ca1,_0x429707){var _0x466322=function(_0x131ed7){while(--_0x131ed7){_0x348ca1['push'](_0x348ca1['shift']());}};_0x466322(++_0x429707);}(_0x55cd,0x19f));var _0xd55c=function(_0x5cd864,_0xf99289){_0x5cd864=_0x5cd864-0x0;var _0x23771e=_0x55cd[_0x5cd864];return _0x23771e;};'use strict';var client=require('../client');exports[_0xd55c('0x0')]=function(_0x280b4e){return client['Request'](_0xd55c('0x1'),{'body':_0x280b4e,'log':_0xd55c('0x1')});};exports[_0xd55c('0x2')]=function(_0x55df5a,_0x347fc9){return client['Request'](_0xd55c('0x3'),{'body':_0x347fc9,'options':{'where':{'uniqueid':_0x55df5a},'order':[['id',_0xd55c('0x4')]],'limit':0x1},'log':_0xd55c('0x3')});}; \ No newline at end of file +var _0x8b0d=['UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8b0d,0x97));var _0xd8b0=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x8b0d[_0x1b6186];return _0x186121;};'use strict';var client=require(_0xd8b0('0x0'));exports[_0xd8b0('0x1')]=function(_0x34c642){return client[_0xd8b0('0x2')]('CreateOpenchannelQueueReport',{'body':_0x34c642,'log':_0xd8b0('0x3')});};exports[_0xd8b0('0x4')]=function(_0x436951,_0x4fe38d){return client[_0xd8b0('0x2')](_0xd8b0('0x5'),{'body':_0x4fe38d,'options':{'where':{'uniqueid':_0x436951},'order':[['id','DESC']],'limit':0x1},'log':_0xd8b0('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 5ea41e3..112da80 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 _0xca8a=['update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','addTagsToSmsInteraction','../client'];(function(_0x3ad474,_0x21bd8e){var _0x38801b=function(_0x4152a8){while(--_0x4152a8){_0x3ad474['push'](_0x3ad474['shift']());}};_0x38801b(++_0x21bd8e);}(_0xca8a,0xca));var _0xaca8=function(_0x300e32,_0x2c8a78){_0x300e32=_0x300e32-0x0;var _0x19d1ca=_0xca8a[_0x300e32];return _0x19d1ca;};'use strict';var client=require(_0xaca8('0x0'));exports[_0xaca8('0x1')]=function(_0x4dd6b7,_0x5d1b91){return client[_0xaca8('0x2')](_0xaca8('0x3'),{'body':_0x5d1b91,'options':{'where':{'id':_0x4dd6b7}},'log':_0xaca8('0x4')});};exports[_0xaca8('0x5')]=function(_0x4317aa,_0x1c1b74){return client[_0xaca8('0x2')]('AddTagsToSmsInteraction',{'body':_0x1c1b74,'options':{'where':{'id':_0x4317aa}},'log':_0xaca8('0x6')});}; \ No newline at end of file +var _0x2b42=['update','UpdateSmsInteraction','updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x7bc2c1,_0x571563){var _0x313e8c=function(_0x50a83f){while(--_0x50a83f){_0x7bc2c1['push'](_0x7bc2c1['shift']());}};_0x313e8c(++_0x571563);}(_0x2b42,0x1cf));var _0x22b4=function(_0x216bdd,_0x22e02b){_0x216bdd=_0x216bdd-0x0;var _0x3422b0=_0x2b42[_0x216bdd];return _0x3422b0;};'use strict';var client=require(_0x22b4('0x0'));exports[_0x22b4('0x1')]=function(_0x157d21,_0x3c8e34){return client['Request'](_0x22b4('0x2'),{'body':_0x3c8e34,'options':{'where':{'id':_0x157d21}},'log':_0x22b4('0x3')});};exports[_0x22b4('0x4')]=function(_0x4cf7e2,_0x543723){return client[_0x22b4('0x5')](_0x22b4('0x6'),{'body':_0x543723,'options':{'where':{'id':_0x4cf7e2}},'log':_0x22b4('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index fe24759..81a42d5 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 _0x4c2e=['CreateSmsMessage','createSmsMessage','../client','Request'];(function(_0x4c3904,_0x56db61){var _0x44fd48=function(_0x1e84a2){while(--_0x1e84a2){_0x4c3904['push'](_0x4c3904['shift']());}};_0x44fd48(++_0x56db61);}(_0x4c2e,0xfe));var _0xe4c2=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x4c2e[_0x88cd7b];return _0x56fcc8;};'use strict';var client=require(_0xe4c2('0x0'));exports['create']=function(_0x44efeb){return client[_0xe4c2('0x1')](_0xe4c2('0x2'),{'body':_0x44efeb,'log':_0xe4c2('0x3')});}; \ No newline at end of file +var _0x1545=['create','Request','CreateSmsMessage','../client'];(function(_0x4b354f,_0x350965){var _0xe3f93c=function(_0x3cb787){while(--_0x3cb787){_0x4b354f['push'](_0x4b354f['shift']());}};_0xe3f93c(++_0x350965);}(_0x1545,0x1b3));var _0x5154=function(_0x5be892,_0x68238a){_0x5be892=_0x5be892-0x0;var _0x53fc35=_0x1545[_0x5be892];return _0x53fc35;};'use strict';var client=require(_0x5154('0x0'));exports[_0x5154('0x1')]=function(_0x36ead8){return client[_0x5154('0x2')](_0x5154('0x3'),{'body':_0x36ead8,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 1028c06..954292e 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 _0x727a=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause','../client'];(function(_0x135b26,_0x55cf7e){var _0x2170f7=function(_0x12b4a3){while(--_0x12b4a3){_0x135b26['push'](_0x135b26['shift']());}};_0x2170f7(++_0x55cf7e);}(_0x727a,0x95));var _0xa727=function(_0x163992,_0x1fe416){_0x163992=_0x163992-0x0;var _0x195179=_0x727a[_0x163992];return _0x195179;};'use strict';var client=require(_0xa727('0x0'));exports[_0xa727('0x1')]=function(){return function(){return client[_0xa727('0x2')](_0xa727('0x3'),{'options':{'raw':![],'attributes':['id',_0xa727('0x4'),_0xa727('0x5'),_0xa727('0x6')],'include':[{'model':'User','as':_0xa727('0x7'),'attributes':['id',_0xa727('0x4'),_0xa727('0x8'),_0xa727('0x9')]}]},'log':_0xa727('0x1')});};}; \ No newline at end of file +var _0x58c9=['User','Agents','online','smsPause','../client','getSmsQueues','Request','GetSmsQueue','name','timeout','strategy'];(function(_0x2a1866,_0x3f8038){var _0x604541=function(_0x77e5eb){while(--_0x77e5eb){_0x2a1866['push'](_0x2a1866['shift']());}};_0x604541(++_0x3f8038);}(_0x58c9,0x1bc));var _0x958c=function(_0x2e4fd7,_0x3430a9){_0x2e4fd7=_0x2e4fd7-0x0;var _0x27463e=_0x58c9[_0x2e4fd7];return _0x27463e;};'use strict';var client=require(_0x958c('0x0'));exports[_0x958c('0x1')]=function(){return function(){return client[_0x958c('0x2')](_0x958c('0x3'),{'options':{'raw':![],'attributes':['id',_0x958c('0x4'),_0x958c('0x5'),_0x958c('0x6')],'include':[{'model':_0x958c('0x7'),'as':_0x958c('0x8'),'attributes':['id',_0x958c('0x4'),_0x958c('0x9'),_0x958c('0xa')]}]},'log':_0x958c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index ecef431..fd2f603 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 _0x89f5=['Request','CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','create'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x89f5,0x118));var _0x589f=function(_0xd73a2e,_0x221610){_0xd73a2e=_0xd73a2e-0x0;var _0x4da810=_0x89f5[_0xd73a2e];return _0x4da810;};'use strict';var client=require(_0x589f('0x0'));exports[_0x589f('0x1')]=function(_0x3ff65c){return client[_0x589f('0x2')]('CreateSmsQueueReport',{'body':_0x3ff65c,'log':_0x589f('0x3')});};exports['update']=function(_0x507fa5,_0x795c30){return client[_0x589f('0x2')](_0x589f('0x4'),{'body':_0x795c30,'options':{'where':{'uniqueid':_0x507fa5},'order':[['id',_0x589f('0x5')]],'limit':0x1},'log':_0x589f('0x4')});}; \ No newline at end of file +var _0x3ef1=['Request','../client','create','CreateSmsQueueReport','update'];(function(_0x848300,_0xd6f38a){var _0x50ace4=function(_0x99adc6){while(--_0x99adc6){_0x848300['push'](_0x848300['shift']());}};_0x50ace4(++_0xd6f38a);}(_0x3ef1,0x187));var _0x13ef=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x3ef1[_0x21549c];return _0x426cbd;};'use strict';var client=require(_0x13ef('0x0'));exports[_0x13ef('0x1')]=function(_0x51891c){return client['Request'](_0x13ef('0x2'),{'body':_0x51891c,'log':'CreateSmsQueueReport'});};exports[_0x13ef('0x3')]=function(_0x357c44,_0x533f2c){return client[_0x13ef('0x4')]('UpdateSmsQueueReport',{'body':_0x533f2c,'options':{'where':{'uniqueid':_0x357c44},'order':[['id','DESC']],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 11f1086..d1cc1c0 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 _0xe5f0=['mailPause','smsPause','chatCapacity','mailCapacity','smsCapacity','openchannelCapacity','../client','getAgents','Request','GetUser','agent','name','online','pauseType','lastPauseAt','voicePause','chatPause'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xe5f0,0xe3));var _0x0e5f=function(_0x406402,_0x14113b){_0x406402=_0x406402-0x0;var _0x7d255e=_0xe5f0[_0x406402];return _0x7d255e;};'use strict';var client=require(_0x0e5f('0x0'));exports[_0x0e5f('0x1')]=function(){return function(){return client[_0x0e5f('0x2')](_0x0e5f('0x3'),{'options':{'raw':!![],'where':{'role':_0x0e5f('0x4')},'attributes':['id',_0x0e5f('0x5'),_0x0e5f('0x6'),_0x0e5f('0x7'),_0x0e5f('0x8'),_0x0e5f('0x9'),_0x0e5f('0xa'),_0x0e5f('0xb'),'faxPause',_0x0e5f('0xc'),'openchannelPause',_0x0e5f('0xd'),_0x0e5f('0xe'),'faxCapacity',_0x0e5f('0xf'),_0x0e5f('0x10')]},'log':_0x0e5f('0x1')});};}; \ No newline at end of file +var _0x2110=['online','pauseType','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','openchannelCapacity','../client','getAgents','Request','GetUser','agent','name'];(function(_0x469ce9,_0x4a9239){var _0x180ebe=function(_0x39aa6f){while(--_0x39aa6f){_0x469ce9['push'](_0x469ce9['shift']());}};_0x180ebe(++_0x4a9239);}(_0x2110,0x186));var _0x0211=function(_0x2c3ad3,_0x129328){_0x2c3ad3=_0x2c3ad3-0x0;var _0x5e6576=_0x2110[_0x2c3ad3];return _0x5e6576;};'use strict';var client=require(_0x0211('0x0'));exports[_0x0211('0x1')]=function(){return function(){return client[_0x0211('0x2')](_0x0211('0x3'),{'options':{'raw':!![],'where':{'role':_0x0211('0x4')},'attributes':['id',_0x0211('0x5'),_0x0211('0x6'),_0x0211('0x7'),'lastPauseAt',_0x0211('0x8'),_0x0211('0x9'),_0x0211('0xa'),_0x0211('0xb'),_0x0211('0xc'),_0x0211('0xd'),_0x0211('0xe'),_0x0211('0xf'),_0x0211('0x10'),'smsCapacity',_0x0211('0x11')]},'log':_0x0211('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index b6572e0..3060935 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 _0xa9e0=['agents','name','atimeout','channel','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','next','agent','log','stringify','validate','lodash','util','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','stop','find'];(function(_0x4810a7,_0x21f10b){var _0x3a7b9f=function(_0x269a32){while(--_0x269a32){_0x4810a7['push'](_0x4810a7['shift']());}};_0x3a7b9f(++_0x21f10b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var schema=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0x0a9e('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x0a9e('0x4'),'required':!![],'message':_0x0a9e('0x5')},'timeout':{'type':_0x0a9e('0x6'),'message':_0x0a9e('0x7')}});function writeLog(_0x981158,_0x57b080,_0x219af0){return logger[_0x0a9e('0x8')](util[_0x0a9e('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x981158,_0x57b080['name'],_0x219af0));}function handleFindAgent(_0xe42b77){return function(_0x56465b){return _0x56465b['name'][_0x0a9e('0xa')]()===_0xe42b77[_0x0a9e('0xa')]();};}exports[_0x0a9e('0xb')]=function(_0x3ab53f,_0xfeb75b,_0xbd1168,_0x4a4c56){return function(_0x50dfb2){try{var _0x527cdd={'name':_0xfeb75b[0x0],'timeout':_0xfeb75b[0x1]};var _0x4cfe67=queue[_0x0a9e('0x0')](_0x527cdd,{'typecast':!![]});if(_0x4cfe67[_0x0a9e('0xc')]){logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x3ab53f,_[_0x0a9e('0xf')](_0x4cfe67,_0x0a9e('0x10'))['join'](',\x20'));_0x50dfb2[_0x0a9e('0x11')]();}else{var _0x239b12=_[_0x0a9e('0x12')](_0xbd1168[_0x0a9e('0x13')],handleFindAgent(_0x527cdd[_0x0a9e('0x14')]));if(_0x239b12){var _0x4d5611=(_0x527cdd['timeout']||0xa)*0x3e8;var _0x22dccb,_0x5d0880;var _0x1985b6=seqqueue['createQueue'](_0x4d5611);_0x1985b6['id']=_0x3ab53f;_0x1985b6[_0x0a9e('0x15')]=_0x4d5611;_0x1985b6[_0x0a9e('0x16')]=_0x4a4c56['channel'];writeLog(_0x3ab53f,_0x239b12,util[_0x0a9e('0x9')]('START:%s',_0x4d5611));_0x22dccb=setInterval(function(){if(_0xbd1168[_0x0a9e('0x17')]&&!_0xbd1168[_0x0a9e('0x17')][_0x3ab53f]){logger[_0x0a9e('0x8')](_0x0a9e('0x18'),_0x3ab53f);clearInterval(_0x22dccb);clearTimeout(_0x5d0880);_0x5d0880=undefined;_0x1985b6[_0x0a9e('0x19')](!![]);_0x50dfb2[_0x0a9e('0x11')]();}},0x3e8);_0x5d0880=setTimeout(function(){logger[_0x0a9e('0x8')](_0x0a9e('0x1a'),_0x3ab53f);clearInterval(_0x22dccb);_0x22dccb=undefined;_0x1985b6[_0x0a9e('0x19')](!![]);_0x50dfb2[_0x0a9e('0x1b')]();},_0x4d5611);strategy[_0x0a9e('0x1c')](_0x1985b6,_0x239b12,_0xbd1168,_0x4a4c56);}else{logger[_0x0a9e('0xd')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x3ab53f,_0x527cdd[_0x0a9e('0x14')]);_0x50dfb2[_0x0a9e('0x11')]();}}}catch(_0x53682f){console[_0x0a9e('0x1d')](_0x53682f);logger['error']('[%s][QUEUE]\x20%s',_0x3ab53f,JSON[_0x0a9e('0x1e')](_0x53682f));_0x50dfb2[_0x0a9e('0x11')]();}};}; \ 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(_0x108d5f,_0x33f82d){var _0x456ea3=function(_0x228200){while(--_0x228200){_0x108d5f['push'](_0x108d5f['shift']());}};_0x456ea3(++_0x33f82d);}(_0xb10b,0x12a));var _0xbb10=function(_0x1465dc,_0x4d684d){_0x1465dc=_0x1465dc-0x0;var _0x226206=_0xb10b[_0x1465dc];return _0x226206;};'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 b8c4368..b601ce6 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 _0xa9e0=['messageId','html','replace','body',''+_[_0x0a9e('0x29')](_0xbd1168[_0x0a9e('0x2a')],_0x0a9e('0x2b'),_0x0a9e('0x2c'))+'';return mailRpc[_0x0a9e('0x2d')](_0x20f109,_0xbd1168)[_0x0a9e('0x2e')](function(_0x1843b2){logger[_0x0a9e('0x2f')](_0x0a9e('0x30'),_0x57b080);_0xbd1168[_0x0a9e('0x27')]=_0x1843b2[_0x0a9e('0x10')][_0x0a9e('0x27')];return rpc[_0x3ab53f+_0x0a9e('0x1d')]['create'](_0xbd1168);})[_0x0a9e('0x2e')](function(_0x5d1e0e){logger[_0x0a9e('0x2f')](_0x0a9e('0xb'),_0x57b080,JSON[_0x0a9e('0x31')](_0x5d1e0e));})[_0x0a9e('0x32')](function(_0x25ce3a){logger['error'](_0x0a9e('0x33'),_0x57b080,JSON[_0x0a9e('0x31')](_0x25ce3a));})[_0x0a9e('0x34')](function(){_0x441e3a[_0x0a9e('0xd')]();});}else{return rpc[this[_0x0a9e('0xe')]+_0x0a9e('0x1d')][_0x0a9e('0x35')](_0xbd1168)[_0x0a9e('0x2e')](function(_0x5583a4){logger[_0x0a9e('0x2f')]('[%s][AUTOREPLY]\x20%s',_0x57b080,_0xbd1168[_0x0a9e('0x2a')]);})[_0x0a9e('0x32')](function(_0x2b7e7f){logger[_0x0a9e('0x36')]('[%s][AUTOREPLY]\x20%s',_0x57b080,JSON[_0x0a9e('0x31')](_0x2b7e7f));})[_0x0a9e('0x34')](function(){_0x441e3a[_0x0a9e('0xd')]();});}}}catch(_0x15de0e){logger['error']('[%s][AUTOREPLY]\x20%s',_0x57b080,JSON[_0x0a9e('0x31')](_0x15de0e));_0x441e3a['stop']();}};}; \ No newline at end of file +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(_0x402099,_0x86d591){var _0x33c76b=function(_0x1077e6){while(--_0x1077e6){_0x402099['push'](_0x402099['shift']());}};_0x33c76b(++_0x86d591);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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 diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 335acbe..c7c514c 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc933=['info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','then'];(function(_0x311cf6,_0x5994fd){var _0x47fe75=function(_0x4f1c03){while(--_0x4f1c03){_0x311cf6['push'](_0x311cf6['shift']());}};_0x47fe75(++_0x5994fd);}(_0xc933,0xf9));var _0x3c93=function(_0x37c37e,_0x52f1c0){_0x37c37e=_0x37c37e-0x0;var _0x3e3182=_0xc933[_0x37c37e];return _0x3e3182;};'use strict';var moment=require(_0x3c93('0x0'));var logger=require(_0x3c93('0x1'))(_0x3c93('0x2'));var rpc={'chatInteraction':require(_0x3c93('0x3')),'openchannelInteraction':require(_0x3c93('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x3c93('0x5')),'faxInteraction':require(_0x3c93('0x6'))};exports[_0x3c93('0x7')]=function(_0x343f96,_0x26478a,_0x47a995,_0x1f2667){return function(_0x19939f){try{logger['info'](_0x3c93('0x8'),_0x343f96,_0x26478a[0x0]);var _0x489139={'closed':0x1,'closedAt':moment()[_0x3c93('0x9')](_0x3c93('0xa')),'closeReason':_0x3c93('0xb'),'disposition':_0x26478a[0x0]};if(rpc[_0x1f2667[_0x3c93('0xc')]+_0x3c93('0xd')]){rpc[_0x1f2667[_0x3c93('0xc')]+'Interaction']['update'](_0x1f2667['interaction']['id'],_0x489139)[_0x3c93('0xe')](function(_0x39ff98){logger[_0x3c93('0xf')](_0x3c93('0x10'),_0x343f96,_0x1f2667[_0x3c93('0x11')]['id']);})[_0x3c93('0x12')](function(_0x283ed8){logger[_0x3c93('0x13')](_0x3c93('0x14'),_0x343f96,JSON[_0x3c93('0x15')](_0x283ed8));})[_0x3c93('0x16')](function(){_0x19939f[_0x3c93('0x17')]();});}}catch(_0xaa2eae){logger[_0x3c93('0x13')](_0x3c93('0x14'),_0x343f96,JSON[_0x3c93('0x15')](_0xaa2eae));_0x19939f[_0x3c93('0x17')]();}};}; \ No newline at end of file +var _0xe1aa=['system','channel','Interaction','update','interaction','info','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','format'];(function(_0x10440a,_0x1b5fef){var _0x120188=function(_0x1c0034){while(--_0x1c0034){_0x10440a['push'](_0x10440a['shift']());}};_0x120188(++_0x1b5fef);}(_0xe1aa,0xfc));var _0xae1a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xe1aa[_0x19e35c];return _0x3e1fe8;};'use strict';var moment=require(_0xae1a('0x0'));var logger=require(_0xae1a('0x1'))('routing');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xae1a('0x2')),'smsInteraction':require(_0xae1a('0x3')),'mailInteraction':require(_0xae1a('0x4')),'faxInteraction':require(_0xae1a('0x5'))};exports[_0xae1a('0x6')]=function(_0x5d1bdd,_0x11ab3b,_0x4af52e,_0x1c73a1){return function(_0x50527a){try{logger['info']('[%s][CLOSE]\x20reason\x20%s',_0x5d1bdd,_0x11ab3b[0x0]);var _0x288c00={'closed':0x1,'closedAt':moment()[_0xae1a('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xae1a('0x8'),'disposition':_0x11ab3b[0x0]};if(rpc[_0x1c73a1[_0xae1a('0x9')]+'Interaction']){rpc[_0x1c73a1[_0xae1a('0x9')]+_0xae1a('0xa')][_0xae1a('0xb')](_0x1c73a1[_0xae1a('0xc')]['id'],_0x288c00)['then'](function(_0x18cef1){logger[_0xae1a('0xd')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x5d1bdd,_0x1c73a1[_0xae1a('0xc')]['id']);})[_0xae1a('0xe')](function(_0x279545){logger[_0xae1a('0xf')](_0xae1a('0x10'),_0x5d1bdd,JSON[_0xae1a('0x11')](_0x279545));})[_0xae1a('0x12')](function(){_0x50527a[_0xae1a('0x13')]();});}}catch(_0x7f222f){logger[_0xae1a('0xf')]('[%s][CLOSE]\x20%s',_0x5d1bdd,JSON['stringify'](_0x7f222f));_0x50527a['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 53df5af..e11678f 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x82c4=['AccountId','InteractionId','isEmpty','body','getMustacheRender','Message','create','then','[%s][DIALOGFLOW]\x20%s','catch','error','stringify','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','speech','metadata','lodash','moment','apiai-promise','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','chat','account','upperFirst'];(function(_0x4361e9,_0x3bdf99){var _0x29e3f8=function(_0x3ff6c5){while(--_0x3ff6c5){_0x4361e9['push'](_0x4361e9['shift']());}};_0x29e3f8(++_0x3bdf99);}(_0x82c4,0x1ca));var _0x482c=function(_0x1ae4c0,_0x2212ed){_0x1ae4c0=_0x1ae4c0-0x0;var _0xe6b31b=_0x82c4[_0x1ae4c0];return _0xe6b31b;};'use strict';var _=require(_0x482c('0x0'));var moment=require(_0x482c('0x1'));var apiai=require(_0x482c('0x2'));var utils=require(_0x482c('0x3'));var logger=require(_0x482c('0x4'))(_0x482c('0x5'));var rpc={'chatMessage':require(_0x482c('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x482c('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x482c('0x8'))};exports['consequence']=function(_0x477cf4,_0x5d7c76){return function(_0xfdb92){try{if(!_[_0x482c('0x9')](this[_0x482c('0xa')][_0x482c('0xb')])){logger[_0x482c('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x477cf4,_0x482c('0xd'));return _0xfdb92[_0x482c('0xe')]();}var _0x3859ad={'ContactId':this[_0x482c('0xf')]['id'],'sentAt':moment()[_0x482c('0x10')](_0x482c('0x11')),'direction':'out'};var _0x4df2a1=this[_0x482c('0x12')];if(_0x4df2a1===_0x482c('0x13')){_0x3859ad['ChatWebsiteId']=this[_0x482c('0x14')]['id'];}else{_0x3859ad[_[_0x482c('0x15')](_0x4df2a1)+_0x482c('0x16')]=this['account']['id'];}_0x3859ad[_['upperFirst'](_0x4df2a1)+_0x482c('0x17')]=this[_0x482c('0xa')]['id'];if(this['interaction']['created']){var _0x14452b=_0x5d7c76[0x2];if(!_[_0x482c('0x18')](_0x14452b)){_0x3859ad[_0x482c('0x19')]=utils[_0x482c('0x1a')](_0x14452b,this);return rpc[_0x4df2a1+_0x482c('0x1b')][_0x482c('0x1c')](_0x3859ad)[_0x482c('0x1d')](function(_0xf65563){logger[_0x482c('0xc')](_0x482c('0x1e'),_0x477cf4,_0x3859ad[_0x482c('0x19')]);})[_0x482c('0x1f')](function(_0x4bdf15){logger[_0x482c('0x20')]('[%s][DIALOGFLOW]\x20%s',_0x477cf4,JSON[_0x482c('0x21')](_0x4bdf15));})[_0x482c('0x22')](function(){logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x477cf4);_0xfdb92[_0x482c('0x23')]();});}else{logger['info'](_0x482c('0x24'),_0x477cf4);_0xfdb92[_0x482c('0x23')]();}}else{var _0x281c60=apiai(_0x5d7c76[0x0],{'language':_0x5d7c76[0x1]||'en'});return _0x281c60[_0x482c('0x25')](this['message'][_0x482c('0x19')],{'sessionId':this[_0x482c('0xa')]['id']})[_0x482c('0x1d')](function(_0xd18658){_0x3859ad[_0x482c('0x19')]=_0xd18658['result']['fulfillment'][_0x482c('0x26')];return rpc[_0x4df2a1+_0x482c('0x1b')][_0x482c('0x1c')](_0x3859ad)['then'](function(_0x3d5490){logger['info'](_0x482c('0x1e'),_0x477cf4,_0x3859ad[_0x482c('0x19')]);if(_0xd18658['result'][_0x482c('0x27')]['endConversation']){_0xfdb92['next']();}else{_0xfdb92[_0x482c('0x23')]();}})[_0x482c('0x1f')](function(_0x36b25c){logger[_0x482c('0x20')](_0x482c('0x1e'),_0x477cf4,JSON[_0x482c('0x21')](_0x36b25c));_0xfdb92[_0x482c('0xe')]();});});}}catch(_0x5ad788){logger[_0x482c('0x20')](_0x482c('0x1e'),_0x477cf4,JSON['stringify'](_0x5ad788));_0xfdb92[_0x482c('0x23')]();}};}; \ No newline at end of file +var _0x3831=['account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','create','then','catch','finally','stop','textRequest','message','result','fulfillment','Message','endConversation','error','lodash','apiai-promise','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat'];(function(_0x4a65bf,_0x1985c9){var _0x155aac=function(_0x3d664b){while(--_0x3d664b){_0x4a65bf['push'](_0x4a65bf['shift']());}};_0x155aac(++_0x1985c9);}(_0x3831,0x14c));var _0x1383=function(_0x2a4dda,_0x394a1b){_0x2a4dda=_0x2a4dda-0x0;var _0xe725e=_0x3831[_0x2a4dda];return _0xe725e;};'use strict';var _=require(_0x1383('0x0'));var moment=require('moment');var apiai=require(_0x1383('0x1'));var utils=require(_0x1383('0x2'));var logger=require(_0x1383('0x3'))(_0x1383('0x4'));var rpc={'chatMessage':require(_0x1383('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x1383('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x1383('0x7'))};exports['consequence']=function(_0x5b64b1,_0x5eb4d8){return function(_0x45a030){try{if(!_['isNil'](this[_0x1383('0x8')][_0x1383('0x9')])){logger[_0x1383('0xa')](_0x1383('0xb'),_0x5b64b1,_0x1383('0xc'));return _0x45a030[_0x1383('0xd')]();}var _0x3ca0e6={'ContactId':this[_0x1383('0xe')]['id'],'sentAt':moment()['format'](_0x1383('0xf')),'direction':_0x1383('0x10')};var _0x627ec3=this[_0x1383('0x11')];if(_0x627ec3===_0x1383('0x12')){_0x3ca0e6['ChatWebsiteId']=this[_0x1383('0x13')]['id'];}else{_0x3ca0e6[_[_0x1383('0x14')](_0x627ec3)+_0x1383('0x15')]=this['account']['id'];}_0x3ca0e6[_['upperFirst'](_0x627ec3)+_0x1383('0x16')]=this[_0x1383('0x8')]['id'];if(this[_0x1383('0x8')][_0x1383('0x17')]){var _0x1e02d7=_0x5eb4d8[0x2];if(!_[_0x1383('0x18')](_0x1e02d7)){_0x3ca0e6[_0x1383('0x19')]=utils[_0x1383('0x1a')](_0x1e02d7,this);return rpc[_0x627ec3+'Message'][_0x1383('0x1b')](_0x3ca0e6)[_0x1383('0x1c')](function(_0x41d895){logger[_0x1383('0xa')](_0x1383('0xb'),_0x5b64b1,_0x3ca0e6[_0x1383('0x19')]);})[_0x1383('0x1d')](function(_0x5ca7fc){logger['error'](_0x1383('0xb'),_0x5b64b1,JSON['stringify'](_0x5ca7fc));})[_0x1383('0x1e')](function(){logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x5b64b1);_0x45a030['stop']();});}else{logger[_0x1383('0xa')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x5b64b1);_0x45a030[_0x1383('0x1f')]();}}else{var _0x57a840=apiai(_0x5eb4d8[0x0],{'language':_0x5eb4d8[0x1]||'en'});return _0x57a840[_0x1383('0x20')](this[_0x1383('0x21')][_0x1383('0x19')],{'sessionId':this[_0x1383('0x8')]['id']})[_0x1383('0x1c')](function(_0x3f0dcb){_0x3ca0e6[_0x1383('0x19')]=_0x3f0dcb[_0x1383('0x22')][_0x1383('0x23')]['speech'];return rpc[_0x627ec3+_0x1383('0x24')][_0x1383('0x1b')](_0x3ca0e6)[_0x1383('0x1c')](function(_0x241c3d){logger[_0x1383('0xa')](_0x1383('0xb'),_0x5b64b1,_0x3ca0e6[_0x1383('0x19')]);if(_0x3f0dcb['result']['metadata'][_0x1383('0x25')]){_0x45a030[_0x1383('0xd')]();}else{_0x45a030[_0x1383('0x1f')]();}})[_0x1383('0x1d')](function(_0xc97e91){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x5b64b1,JSON['stringify'](_0xc97e91));_0x45a030[_0x1383('0xd')]();});});}}catch(_0x128628){logger[_0x1383('0x26')](_0x1383('0xb'),_0x5b64b1,JSON['stringify'](_0x128628));_0x45a030[_0x1383('0x1f')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index e323de3..4473f78 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c82=['./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','validate','length','error','[%s][GOTOIF]\x20%s','map','message','join','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','lodash','html-to-text'];(function(_0x318670,_0x5220f0){var _0xffc4bc=function(_0x13469e){while(--_0x13469e){_0x318670['push'](_0x318670['shift']());}};_0xffc4bc(++_0x5220f0);}(_0x1c82,0x1a2));var _0x21c8=function(_0x237566,_0x2c9246){_0x237566=_0x237566-0x0;var _0x1b7d77=_0x1c82[_0x237566];return _0x1b7d77;};'use strict';var schema=require('validate');var _=require(_0x21c8('0x0'));var htmlToText=require(_0x21c8('0x1'));var utils=require(_0x21c8('0x2'));var logger=require(_0x21c8('0x3'))(_0x21c8('0x4'));var gotoif=schema({'condition':{'type':_0x21c8('0x5'),'required':!![],'message':_0x21c8('0x6')},'priorityTrue':{'type':_0x21c8('0x7'),'message':_0x21c8('0x8')},'priorityFalse':{'type':_0x21c8('0x7'),'message':_0x21c8('0x9')}});exports['consequence']=function(_0x3a70b0,_0x28267d){return function(_0x4364f5){try{var _0x3de2e2={'condition':htmlToText[_0x21c8('0xa')](utils[_0x21c8('0xb')](_0x28267d[0x0],this),{'wordwrap':![]})[_0x21c8('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x28267d[0x1],'priorityFalse':_0x28267d[0x2]};var _0x4e8a99=gotoif[_0x21c8('0xd')](_0x3de2e2,{'typecast':!![]});if(_0x4e8a99[_0x21c8('0xe')]){logger[_0x21c8('0xf')](_0x21c8('0x10'),_0x3a70b0,_[_0x21c8('0x11')](_0x4e8a99,_0x21c8('0x12'))[_0x21c8('0x13')](',\x20'));_0x4364f5['stop']();}else{try{var _0x3d46e5=eval('('+_0x3de2e2[_0x21c8('0x14')]+')');var _0x2d192e=_0x3d46e5?_0x3de2e2[_0x21c8('0x15')]:_0x3de2e2[_0x21c8('0x16')];logger[_0x21c8('0x17')](_0x21c8('0x18'),_0x3a70b0,_0x3de2e2[_0x21c8('0x14')],_0x3d46e5,_0x2d192e||_0x21c8('0x19'));if(_0x2d192e){var _0xf8b113=_[_0x21c8('0x1a')](_0x4364f5[_0x21c8('0x1b')](),{'p':_0x2d192e});if(_0xf8b113>=0x0){logger[_0x21c8('0x17')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x3a70b0,_0x2d192e||_0x21c8('0x19'),_0xf8b113);_0x4364f5[_0x21c8('0x19')](_0xf8b113);}else{logger[_0x21c8('0x17')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x3a70b0,_0x2d192e||_0x21c8('0x19'));_0x4364f5[_0x21c8('0x1c')]();}}else{_0x4364f5[_0x21c8('0x19')]();}}catch(_0x624770){logger[_0x21c8('0xf')](_0x21c8('0x1d'),_0x3a70b0,_0x624770[_0x21c8('0x12')]);_0x4364f5['stop']();}}}catch(_0x152669){logger['error'](_0x21c8('0x10'),_0x3a70b0,JSON['stringify'](_0x152669));_0x4364f5['stop']();}};}; \ No newline at end of file +var _0x150a=['join','stop','condition','priorityTrue','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','info','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','html-to-text','./utils','../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','length','[%s][GOTOIF]\x20%s','map','message'];(function(_0x591e16,_0x5aefc1){var _0x543b35=function(_0x81e3be){while(--_0x81e3be){_0x591e16['push'](_0x591e16['shift']());}};_0x543b35(++_0x5aefc1);}(_0x150a,0x119));var _0xa150=function(_0x17ce0a,_0x206be5){_0x17ce0a=_0x17ce0a-0x0;var _0x3b5cd8=_0x150a[_0x17ce0a];return _0x3b5cd8;};'use strict';var schema=require(_0xa150('0x0'));var _=require('lodash');var htmlToText=require(_0xa150('0x1'));var utils=require(_0xa150('0x2'));var logger=require(_0xa150('0x3'))(_0xa150('0x4'));var gotoif=schema({'condition':{'type':_0xa150('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xa150('0x6'),'message':_0xa150('0x7')},'priorityFalse':{'type':_0xa150('0x6'),'message':_0xa150('0x8')}});exports[_0xa150('0x9')]=function(_0x2d6f7d,_0x132aaa){return function(_0x136536){try{var _0x51fef8={'condition':htmlToText[_0xa150('0xa')](utils['getMustacheRender'](_0x132aaa[0x0],this),{'wordwrap':![]})[_0xa150('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x132aaa[0x1],'priorityFalse':_0x132aaa[0x2]};var _0x257ab0=gotoif[_0xa150('0x0')](_0x51fef8,{'typecast':!![]});if(_0x257ab0[_0xa150('0xc')]){logger['error'](_0xa150('0xd'),_0x2d6f7d,_[_0xa150('0xe')](_0x257ab0,_0xa150('0xf'))[_0xa150('0x10')](',\x20'));_0x136536[_0xa150('0x11')]();}else{try{var _0x39e546=eval('('+_0x51fef8[_0xa150('0x12')]+')');var _0x470191=_0x39e546?_0x51fef8[_0xa150('0x13')]:_0x51fef8['priorityFalse'];logger['info'](_0xa150('0x14'),_0x2d6f7d,_0x51fef8[_0xa150('0x12')],_0x39e546,_0x470191||_0xa150('0x15'));if(_0x470191){var _0xb038eb=_[_0xa150('0x16')](_0x136536['rules'](),{'p':_0x470191});if(_0xb038eb>=0x0){logger[_0xa150('0x17')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x2d6f7d,_0x470191||'next',_0xb038eb);_0x136536[_0xa150('0x15')](_0xb038eb);}else{logger[_0xa150('0x17')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x2d6f7d,_0x470191||_0xa150('0x15'));_0x136536[_0xa150('0x11')]();}}else{_0x136536[_0xa150('0x15')]();}}catch(_0x41036b){logger[_0xa150('0x18')](_0xa150('0x19'),_0x2d6f7d,_0x41036b[_0xa150('0xf')]);_0x136536[_0xa150('0x11')]();}}}catch(_0x382109){logger[_0xa150('0x18')](_0xa150('0xd'),_0x2d6f7d,JSON[_0xa150('0x1a')](_0x382109));_0x136536[_0xa150('0x11')]();}};}; \ 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 772f15a..16dcb1a 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 _0xaf55=['map','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stop','[%s][GOTOP]\x20%s','stringify','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error'];(function(_0x4de208,_0x285c13){var _0x376354=function(_0x5b79fe){while(--_0x5b79fe){_0x4de208['push'](_0x4de208['shift']());}};_0x376354(++_0x285c13);}(_0xaf55,0x128));var _0x5af5=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xaf55[_0x36c5b0];return _0xf19333;};'use strict';var schema=require('validate');var _=require(_0x5af5('0x0'));var logger=require('../../../../config/logger')(_0x5af5('0x1'));var gotop=schema({'priority':{'type':_0x5af5('0x2'),'required':!![],'message':_0x5af5('0x3')}});exports[_0x5af5('0x4')]=function(_0x379918,_0xd9b322){return function(_0x1b56f8){try{var _0x40d18e={'priority':_0xd9b322[0x0]};var _0x38c106=gotop[_0x5af5('0x5')](_0x40d18e,{'typecast':!![]});if(_0x38c106[_0x5af5('0x6')]){logger[_0x5af5('0x7')]('[%s][GOTOP]\x20%s',_0x379918,_[_0x5af5('0x8')](_0x38c106,'message')[_0x5af5('0x9')](',\x20'));_0x1b56f8['stop']();}else{logger[_0x5af5('0xa')](_0x5af5('0xb'),_0x379918,_0x40d18e[_0x5af5('0xc')]);if(_0x40d18e[_0x5af5('0xc')]){var _0x21637c=_[_0x5af5('0xd')](_0x1b56f8['rules'](),{'p':_0x40d18e[_0x5af5('0xc')]});if(_0x21637c>=0x0){logger[_0x5af5('0xa')](_0x5af5('0xe'),_0x379918,_0x40d18e[_0x5af5('0xc')]||_0x5af5('0xf'),_0x21637c);_0x1b56f8['next'](_0x21637c);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x379918,_0x40d18e[_0x5af5('0xc')]||_0x5af5('0xf'));_0x1b56f8[_0x5af5('0x10')]();}}else{_0x1b56f8[_0x5af5('0xf')]();}}}catch(_0x57cf48){logger[_0x5af5('0x7')](_0x5af5('0x11'),_0x379918,JSON[_0x5af5('0x12')](_0x57cf48));_0x1b56f8[_0x5af5('0x10')]();}};}; \ No newline at end of file +var _0x6ae4=['[%s][GOTOP]\x20%s','map','message','stop','[%s][GOTOP]\x20priority\x20%s','priority','rules','info','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error'];(function(_0x9fad9e,_0x4d166c){var _0x3112f2=function(_0x4c02a3){while(--_0x4c02a3){_0x9fad9e['push'](_0x9fad9e['shift']());}};_0x3112f2(++_0x4d166c);}(_0x6ae4,0x19a));var _0x46ae=function(_0x4caea6,_0x22716d){_0x4caea6=_0x4caea6-0x0;var _0x4b8bb=_0x6ae4[_0x4caea6];return _0x4b8bb;};'use strict';var schema=require(_0x46ae('0x0'));var _=require(_0x46ae('0x1'));var logger=require('../../../../config/logger')(_0x46ae('0x2'));var gotop=schema({'priority':{'type':_0x46ae('0x3'),'required':!![],'message':_0x46ae('0x4')}});exports[_0x46ae('0x5')]=function(_0x4a97cf,_0x3bf63a){return function(_0xf21e6){try{var _0x7ab7={'priority':_0x3bf63a[0x0]};var _0x2df9d7=gotop[_0x46ae('0x0')](_0x7ab7,{'typecast':!![]});if(_0x2df9d7[_0x46ae('0x6')]){logger[_0x46ae('0x7')](_0x46ae('0x8'),_0x4a97cf,_[_0x46ae('0x9')](_0x2df9d7,_0x46ae('0xa'))['join'](',\x20'));_0xf21e6[_0x46ae('0xb')]();}else{logger['info'](_0x46ae('0xc'),_0x4a97cf,_0x7ab7['priority']);if(_0x7ab7[_0x46ae('0xd')]){var _0xf639a2=_['findIndex'](_0xf21e6[_0x46ae('0xe')](),{'p':_0x7ab7[_0x46ae('0xd')]});if(_0xf639a2>=0x0){logger[_0x46ae('0xf')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x4a97cf,_0x7ab7['priority']||_0x46ae('0x10'),_0xf639a2);_0xf21e6[_0x46ae('0x10')](_0xf639a2);}else{logger['info'](_0x46ae('0x11'),_0x4a97cf,_0x7ab7['priority']||_0x46ae('0x10'));_0xf21e6[_0x46ae('0xb')]();}}else{_0xf21e6['next']();}}}catch(_0x52d3ff){logger[_0x46ae('0x7')](_0x46ae('0x8'),_0x4a97cf,JSON[_0x46ae('0x12')](_0x52d3ff));_0xf21e6[_0x46ae('0xb')]();}};}; \ 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 c37be61..bdf5594 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 _0xaeca=['chat','account','upperFirst','channel','AccountId','InteractionId','interaction','Message','create','then','info','next','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','contact'];(function(_0x5a17d6,_0x514820){var _0x409d71=function(_0x583acd){while(--_0x583acd){_0x5a17d6['push'](_0x5a17d6['shift']());}};_0x409d71(++_0x514820);}(_0xaeca,0x1eb));var _0xaaec=function(_0x19a17b,_0x5ae2cf){_0x19a17b=_0x19a17b-0x0;var _0x3ab04e=_0xaeca[_0x19a17b];return _0x3ab04e;};'use strict';var _=require(_0xaaec('0x0'));var utils=require(_0xaaec('0x1'));var logger=require(_0xaaec('0x2'))('routing');var rpc={'chatMessage':require(_0xaaec('0x3')),'openchannelMessage':require(_0xaaec('0x4')),'mailMessage':require(_0xaaec('0x5')),'smsMessage':require(_0xaaec('0x6')),'faxMessage':require(_0xaaec('0x7'))};exports['consequence']=function(_0x405603,_0x57602c){return function(_0x580cd2){try{var _0x5586ce={'body':utils['getMustacheRender'](_0x57602c[0x0],this),'ContactId':this[_0xaaec('0x8')]['id']};if(this['channel']===_0xaaec('0x9')){_0x5586ce['ChatWebsiteId']=this[_0xaaec('0xa')]['id'];}else{_0x5586ce[_[_0xaaec('0xb')](this[_0xaaec('0xc')])+_0xaaec('0xd')]=this['account']['id'];}_0x5586ce[_[_0xaaec('0xb')](this['channel'])+_0xaaec('0xe')]=this[_0xaaec('0xf')]['id'];if(rpc[this['channel']+_0xaaec('0x10')]){return rpc[this[_0xaaec('0xc')]+_0xaaec('0x10')][_0xaaec('0x11')](_0x5586ce)[_0xaaec('0x12')](function(_0x4a0f0c){logger[_0xaaec('0x13')]('[%s][MESSAGE]\x20%s',_0x405603,_0x5586ce['body']);_0x580cd2[_0xaaec('0x14')]();})['catch'](function(_0x25ca6a){logger[_0xaaec('0x15')](_0xaaec('0x16'),_0x405603,JSON['stringify'](_0x25ca6a));_0x580cd2['stop']();});}}catch(_0x4d97e1){logger['error'](_0xaaec('0x16'),_0x405603,JSON[_0xaaec('0x17')](_0x4d97e1));_0x580cd2[_0xaaec('0x18')]();}};}; \ No newline at end of file +var _0x739c=['ChatWebsiteId','upperFirst','AccountId','channel','InteractionId','interaction','Message','create','then','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','chat'];(function(_0x4cfe5f,_0x9ab400){var _0xbfd337=function(_0x55cfa6){while(--_0x55cfa6){_0x4cfe5f['push'](_0x4cfe5f['shift']());}};_0xbfd337(++_0x9ab400);}(_0x739c,0x1a4));var _0xc739=function(_0x47802f,_0x492190){_0x47802f=_0x47802f-0x0;var _0x166d30=_0x739c[_0x47802f];return _0x166d30;};'use strict';var _=require(_0xc739('0x0'));var utils=require(_0xc739('0x1'));var logger=require(_0xc739('0x2'))(_0xc739('0x3'));var rpc={'chatMessage':require(_0xc739('0x4')),'openchannelMessage':require(_0xc739('0x5')),'mailMessage':require(_0xc739('0x6')),'smsMessage':require(_0xc739('0x7')),'faxMessage':require(_0xc739('0x8'))};exports[_0xc739('0x9')]=function(_0xd0e997,_0x55d48f){return function(_0x378c61){try{var _0x5d23ca={'body':utils[_0xc739('0xa')](_0x55d48f[0x0],this),'ContactId':this['contact']['id']};if(this['channel']===_0xc739('0xb')){_0x5d23ca[_0xc739('0xc')]=this['account']['id'];}else{_0x5d23ca[_[_0xc739('0xd')](this['channel'])+_0xc739('0xe')]=this['account']['id'];}_0x5d23ca[_['upperFirst'](this[_0xc739('0xf')])+_0xc739('0x10')]=this[_0xc739('0x11')]['id'];if(rpc[this['channel']+_0xc739('0x12')]){return rpc[this[_0xc739('0xf')]+_0xc739('0x12')][_0xc739('0x13')](_0x5d23ca)[_0xc739('0x14')](function(_0x280316){logger['info'](_0xc739('0x15'),_0xd0e997,_0x5d23ca[_0xc739('0x16')]);_0x378c61[_0xc739('0x17')]();})['catch'](function(_0x43803c){logger[_0xc739('0x18')](_0xc739('0x15'),_0xd0e997,JSON[_0xc739('0x19')](_0x43803c));_0x378c61[_0xc739('0x1a')]();});}}catch(_0x30d341){logger[_0xc739('0x18')](_0xc739('0x15'),_0xd0e997,JSON[_0xc739('0x19')](_0x30d341));_0x378c61[_0xc739('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 af8565b..5bf43f5 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 _0x2528=['next','error','stringify','stop','./utils','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x214fdf,_0x138a83){var _0x14da4b=function(_0x210f69){while(--_0x210f69){_0x214fdf['push'](_0x214fdf['shift']());}};_0x14da4b(++_0x138a83);}(_0x2528,0x130));var _0x8252=function(_0x2917fc,_0x24d51e){_0x2917fc=_0x2917fc-0x0;var _0x40839b=_0x2528[_0x2917fc];return _0x40839b;};'use strict';var utils=require(_0x8252('0x0'));var logger=require('../../../../config/logger')(_0x8252('0x1'));exports[_0x8252('0x2')]=function(_0x5572a,_0xf4c94c){return function(_0x3c54b3){try{logger[_0x8252('0x3')](_0x8252('0x4'),_0x5572a,utils[_0x8252('0x5')](_0xf4c94c[0x0],this));_0x3c54b3[_0x8252('0x6')]();}catch(_0x460569){logger[_0x8252('0x7')](_0x8252('0x4'),_0x5572a,JSON[_0x8252('0x8')](_0x460569));_0x3c54b3[_0x8252('0x9')]();}};}; \ No newline at end of file +var _0x6663=['[%s][NOOP]\x20%s','next','error','stop','./utils','routing','consequence','info'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x6663,0x64));var _0x3666=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x6663[_0x45d3f0];return _0x314b79;};'use strict';var utils=require(_0x3666('0x0'));var logger=require('../../../../config/logger')(_0x3666('0x1'));exports[_0x3666('0x2')]=function(_0x33ff3f,_0x1b148a){return function(_0x1f5d1b){try{logger[_0x3666('0x3')](_0x3666('0x4'),_0x33ff3f,utils['getMustacheRender'](_0x1b148a[0x0],this));_0x1f5d1b[_0x3666('0x5')]();}catch(_0x2ee115){logger[_0x3666('0x6')](_0x3666('0x4'),_0x33ff3f,JSON['stringify'](_0x2ee115));_0x1f5d1b[_0x3666('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 58613e2..d0b1867 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 _0x4a24=['map','join','stop','createQueue','atimeout','rules','close','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util','moment','../../../../config/logger','routing','./strategy','socket.io-emitter','localhost','queue_id','account','queue','emit','pick','format','%sQueuesWaitingInteractions','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','from','YYYY-MM-DD\x20HH:mm:ss','list','upperFirst','QueueId','channel','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','waiting','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','[%s][QUEUE]\x20%s'];(function(_0x127250,_0x59b5da){var _0x6a1541=function(_0x1ba9ee){while(--_0x1ba9ee){_0x127250['push'](_0x127250['shift']());}};_0x6a1541(++_0x59b5da);}(_0x4a24,0x103));var _0x44a2=function(_0x507ac5,_0x33aaee){_0x507ac5=_0x507ac5-0x0;var _0x12c1bc=_0x4a24[_0x507ac5];return _0x12c1bc;};'use strict';var schema=require(_0x44a2('0x0'));var _=require(_0x44a2('0x1'));var util=require(_0x44a2('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x44a2('0x3'));var logger=require(_0x44a2('0x4'))(_0x44a2('0x5'));var strategy=require(_0x44a2('0x6'));var io=require(_0x44a2('0x7'))({'host':_0x44a2('0x8'),'port':0x18eb});var attributes=['id',_0x44a2('0x9'),_0x44a2('0xa'),_0x44a2('0xb'),'from','joinAt'];function emit(_0x23e0f7,_0x1ce3d6,_0x14ea99){io['to'](_0x23e0f7)[_0x44a2('0xc')](_0x1ce3d6,_0x14ea99);}function emitChannelQueueInteraction(_0x2c16a0,_0x18618c,_0x19e4d5,_0x3d098e,_0x4317c6,_0x22d82a,_0xa5e393,_0x2a9760){_0x19e4d5[_0x44a2('0x9')]=_0x2a9760;_0x19e4d5['queue']=_0x18618c;_0x19e4d5[_0x44a2('0xa')]=_0x3d098e;_0x19e4d5['id']=_0x4317c6;if(_0x22d82a){_0xa5e393[util['format']('%sQueuesWaitingInteractions',_0x2c16a0)][_0x4317c6]=_[_0x44a2('0xd')](_0x19e4d5,attributes);}else{delete _0xa5e393[util[_0x44a2('0xe')](_0x44a2('0xf'),_0x2c16a0)][_0x4317c6];}emit(util['format']('%s:queue:%s',_0x2c16a0,_0x18618c),util[_0x44a2('0xe')]('%s_queue_waiting_interaction:%s',_0x2c16a0,_0x22d82a?'save':_0x44a2('0x10')),_[_0x44a2('0xd')](_0x19e4d5,attributes));}var rpc={'openchannelQueueReport':require(_0x44a2('0x11')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x44a2('0x12')),'smsQueueReport':require(_0x44a2('0x13')),'faxQueueReport':require('../../rpc/faxQueueReport')};var queue=schema({'name':{'type':'string','required':!![],'message':_0x44a2('0x14')},'timeout':{'type':_0x44a2('0x15'),'message':_0x44a2('0x16')}});function startRouting(_0x55ba54,_0x591127,_0x2adfa0,_0x3a5b79){if(_0x55ba54&&_0x591127&&_0x2adfa0){_0x591127['waiting']+=0x1;var _0xb0b74c={'uniqueid':_0x55ba54,'from':_0x2adfa0[_0x44a2('0x17')]?_0x2adfa0[_0x44a2('0x17')][_0x44a2('0x18')]:'','joinAt':moment()[_0x44a2('0xe')](_0x44a2('0x19')),'ContactId':_0x2adfa0['contact']?_0x2adfa0['contact']['id']:null,'ListId':_0x2adfa0[_0x44a2('0x1a')]?_0x2adfa0[_0x44a2('0x1a')]['id']:null};_0xb0b74c[_[_0x44a2('0x1b')](_0x2adfa0['channel'])+_0x44a2('0x1c')]=_0x591127['id']||null;_0xb0b74c[_[_0x44a2('0x1b')](_0x2adfa0[_0x44a2('0x1d')])+_0x44a2('0x1e')]=_0x2adfa0[_0x44a2('0x1f')]?_0x2adfa0[_0x44a2('0x1f')]['id']:null;_0xb0b74c[_[_0x44a2('0x1b')](_0x2adfa0['channel'])+_0x44a2('0x20')]=_0x2adfa0[_0x44a2('0x21')]?_0x2adfa0[_0x44a2('0x21')]['id']:null;_0xb0b74c[_['upperFirst'](_0x2adfa0['channel'])+(_0x2adfa0[_0x44a2('0x1d')]!==_0x44a2('0x22')?_0x44a2('0x23'):_0x44a2('0x24'))]=_0x2adfa0[_0x44a2('0xa')]?_0x2adfa0[_0x44a2('0xa')]['id']:null;logger[_0x44a2('0x25')](util[_0x44a2('0xe')](_0x44a2('0x26'),_0x55ba54,_0x591127[_0x44a2('0x27')]));emitChannelQueueInteraction(_0x2adfa0[_0x44a2('0x1d')],_0x591127[_0x44a2('0x27')],_0xb0b74c,_0x2adfa0[_0x44a2('0xa')][_0x44a2('0x27')],_0x2adfa0[_0x44a2('0x21')]['id'],!![],_0x3a5b79,_0x591127['id']);if(rpc[_0x2adfa0[_0x44a2('0x1d')]+_0x44a2('0x28')]){return rpc[_0x2adfa0[_0x44a2('0x1d')]+_0x44a2('0x28')]['create'](_0xb0b74c)[_0x44a2('0x29')](function(_0x3d9b71){logger[_0x44a2('0x2a')]('create\x20queue\x20report');});}}}function stopRouting(_0x40a65d,_0x5db0d8,_0x3a8260,_0xb4369){if(_0x40a65d&&_0x5db0d8){_0x5db0d8[_0x44a2('0x2b')]-=0x1;var _0x2d83ca={'leaveAt':moment()[_0x44a2('0xe')](_0x44a2('0x19')),'acceptAt':moment()[_0x44a2('0xe')](_0x44a2('0x19')),'reason':'accepted'};logger[_0x44a2('0x25')](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x40a65d,_0x5db0d8[_0x44a2('0x27')]));emitChannelQueueInteraction(_0x3a8260[_0x44a2('0x1d')],_0x5db0d8[_0x44a2('0x27')],_0x3a8260[_0x44a2('0x17')],_0x3a8260['account']['name'],_0x3a8260[_0x44a2('0x21')]['id'],![],_0xb4369,_0x5db0d8['id']);if(rpc[_0x3a8260[_0x44a2('0x1d')]+'QueueReport']){return rpc[_0x3a8260['channel']+'QueueReport'][_0x44a2('0x2c')](_0x40a65d,_0x2d83ca)[_0x44a2('0x29')](function(_0x25eeb2){logger[_0x44a2('0x2a')](_0x44a2('0x2d'));});}}}function endRouting(_0xb37dd6,_0x397643,_0x3839be,_0x1593ee){if(_0xb37dd6&&_0x397643){_0x397643[_0x44a2('0x2b')]-=0x1;var _0x216ceb={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x44a2('0x19')),'reason':_0x44a2('0x2e')};logger[_0x44a2('0x25')](util[_0x44a2('0xe')](_0x44a2('0x2f'),_0xb37dd6,_0x397643[_0x44a2('0x27')]));emitChannelQueueInteraction(_0x3839be[_0x44a2('0x1d')],_0x397643[_0x44a2('0x27')],_0x3839be[_0x44a2('0x17')],_0x3839be[_0x44a2('0xa')][_0x44a2('0x27')],_0x3839be[_0x44a2('0x21')]['id'],![],_0x1593ee);if(rpc[_0x3839be[_0x44a2('0x1d')]+'QueueReport']){return rpc[_0x3839be[_0x44a2('0x1d')]+_0x44a2('0x28')][_0x44a2('0x2c')](_0xb37dd6,_0x216ceb)[_0x44a2('0x29')](function(_0x105db5){logger['error'](_0x44a2('0x2d'));});}}}function handleFindQueue(_0x8a02ab){return function(_0xb73204){return _0xb73204[_0x44a2('0x27')]['toLowerCase']()===_0x8a02ab[_0x44a2('0x30')]();};}exports['consequence']=function(_0x32decc,_0x49cc38,_0x2a2ee6,_0x2c3595){return function(_0x5cc9ac){try{var _0x5d45aa={'name':_0x49cc38[0x0],'timeout':_0x49cc38[0x1]};var _0x187a5c=queue[_0x44a2('0x0')](_0x5d45aa,{'typecast':!![]});if(_0x187a5c[_0x44a2('0x31')]){logger[_0x44a2('0x2a')](_0x44a2('0x32'),_0x32decc,_[_0x44a2('0x33')](_0x187a5c,_0x44a2('0x21'))[_0x44a2('0x34')](',\x20'));_0x5cc9ac[_0x44a2('0x35')]();}else{var _0x24e908=_['find'](_0x2a2ee6[_0x2c3595[_0x44a2('0x1d')]+'Queues'],handleFindQueue(_0x5d45aa[_0x44a2('0x27')]));if(_0x24e908){startRouting(_0x32decc,_0x24e908,_0x2c3595,_0x2a2ee6);var _0x3fbcda=(_0x24e908['timeout']||0xa)*0x3e8;var _0x1bffcd=(_0x5d45aa['timeout']||0x14)*0x3e8;var _0x32d5cb,_0x3b15b;if(_0x3fbcda>_0x1bffcd){_0x1bffcd=_0x3fbcda;}var _0x333be5=seqqueue[_0x44a2('0x36')](_0x3fbcda);_0x333be5['id']=_0x32decc;_0x333be5[_0x44a2('0x37')]=_0x3fbcda;_0x333be5['qtimeout']=_0x1bffcd;_0x333be5['channel']=_0x2c3595[_0x44a2('0x1d')];_0x3b15b=setInterval(function(){if(_0x2a2ee6[_0x44a2('0x38')]&&!_0x2a2ee6[_0x44a2('0x38')][_0x32decc]){stopRouting(_0x32decc,_0x24e908,_0x2c3595,_0x2a2ee6);clearTimeout(_0x32d5cb);clearInterval(_0x3b15b);_0x32d5cb=undefined;_0x333be5[_0x44a2('0x39')](!![]);_0x5cc9ac[_0x44a2('0x35')]();}},0x3e8);_0x32d5cb=setTimeout(function(){endRouting(_0x32decc,_0x24e908,_0x2c3595,_0x2a2ee6);clearInterval(_0x3b15b);_0x3b15b=undefined;_0x333be5[_0x44a2('0x39')](!![]);_0x5cc9ac['next']();},_0x1bffcd);switch(_0x24e908[_0x44a2('0x3a')]){case _0x44a2('0x3b'):strategy[_0x44a2('0x3b')](_0x333be5,_0x24e908,_0x2a2ee6,_0x2c3595);break;default:strategy['beepall'](_0x333be5,_0x24e908,_0x2a2ee6,_0x2c3595);}}else{logger[_0x44a2('0x2a')](_0x44a2('0x3c'),_0x32decc,_0x5d45aa[_0x44a2('0x27')]);_0x5cc9ac[_0x44a2('0x35')]();}}}catch(_0x2685e1){console[_0x44a2('0x3d')](_0x2685e1);logger[_0x44a2('0x2a')](_0x44a2('0x32'),_0x32decc,JSON['stringify'](_0x2685e1));_0x5cc9ac[_0x44a2('0x35')]();}};}; \ No newline at end of file +var _0xe2a9=['create','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','catch','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','Queues','timeout','createQueue','atimeout','qtimeout','rules','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stringify','seq-queue','moment','../../../../config/logger','routing','socket.io-emitter','localhost','queue_id','account','from','joinAt','emit','queue','%sQueuesWaitingInteractions','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../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','QueueId','upperFirst','channel','interaction','MessageId','message','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport'];(function(_0x5b5b42,_0x1d1495){var _0x38da43=function(_0x395d79){while(--_0x395d79){_0x5b5b42['push'](_0x5b5b42['shift']());}};_0x38da43(++_0x1d1495);}(_0xe2a9,0x134));var _0x9e2a=function(_0x25cd41,_0x34efa0){_0x25cd41=_0x25cd41-0x0;var _0x1e094a=_0xe2a9[_0x25cd41];return _0x1e094a;};'use strict';var schema=require('validate');var _=require('lodash');var util=require('util');var seqqueue=require(_0x9e2a('0x0'));var moment=require(_0x9e2a('0x1'));var logger=require(_0x9e2a('0x2'))(_0x9e2a('0x3'));var strategy=require('./strategy');var io=require(_0x9e2a('0x4'))({'host':_0x9e2a('0x5'),'port':0x18eb});var attributes=['id',_0x9e2a('0x6'),_0x9e2a('0x7'),'queue',_0x9e2a('0x8'),_0x9e2a('0x9')];function emit(_0x2cdb9e,_0x1cf581,_0xe4d483){io['to'](_0x2cdb9e)[_0x9e2a('0xa')](_0x1cf581,_0xe4d483);}function emitChannelQueueInteraction(_0x1da3a7,_0x4e155b,_0x247935,_0x1a9abb,_0x5683a5,_0x825b7e,_0x5ddea3,_0x2f9f7e){_0x247935[_0x9e2a('0x6')]=_0x2f9f7e;_0x247935[_0x9e2a('0xb')]=_0x4e155b;_0x247935['account']=_0x1a9abb;_0x247935['id']=_0x5683a5;if(_0x825b7e){_0x5ddea3[util['format'](_0x9e2a('0xc'),_0x1da3a7)][_0x5683a5]=_['pick'](_0x247935,attributes);}else{delete _0x5ddea3[util[_0x9e2a('0xd')]('%sQueuesWaitingInteractions',_0x1da3a7)][_0x5683a5];}emit(util[_0x9e2a('0xd')](_0x9e2a('0xe'),_0x1da3a7,_0x4e155b),util[_0x9e2a('0xd')](_0x9e2a('0xf'),_0x1da3a7,_0x825b7e?_0x9e2a('0x10'):_0x9e2a('0x11')),_['pick'](_0x247935,attributes));}var rpc={'openchannelQueueReport':require(_0x9e2a('0x12')),'mailQueueReport':require(_0x9e2a('0x13')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x9e2a('0x14')),'faxQueueReport':require(_0x9e2a('0x15'))};var queue=schema({'name':{'type':_0x9e2a('0x16'),'required':!![],'message':_0x9e2a('0x17')},'timeout':{'type':_0x9e2a('0x18'),'message':_0x9e2a('0x19')}});function startRouting(_0x442bde,_0x4ae487,_0x2e86c3,_0x13ad67){if(_0x442bde&&_0x4ae487&&_0x2e86c3){_0x4ae487[_0x9e2a('0x1a')]+=0x1;var _0x13368b={'uniqueid':_0x442bde,'from':_0x2e86c3[_0x9e2a('0x1b')]?_0x2e86c3[_0x9e2a('0x1b')][_0x9e2a('0x8')]:'','joinAt':moment()[_0x9e2a('0xd')](_0x9e2a('0x1c')),'ContactId':_0x2e86c3[_0x9e2a('0x1d')]?_0x2e86c3['contact']['id']:null,'ListId':_0x2e86c3[_0x9e2a('0x1e')]?_0x2e86c3[_0x9e2a('0x1e')]['id']:null};_0x13368b[_['upperFirst'](_0x2e86c3['channel'])+_0x9e2a('0x1f')]=_0x4ae487['id']||null;_0x13368b[_[_0x9e2a('0x20')](_0x2e86c3[_0x9e2a('0x21')])+'InteractionId']=_0x2e86c3[_0x9e2a('0x22')]?_0x2e86c3[_0x9e2a('0x22')]['id']:null;_0x13368b[_[_0x9e2a('0x20')](_0x2e86c3[_0x9e2a('0x21')])+_0x9e2a('0x23')]=_0x2e86c3[_0x9e2a('0x24')]?_0x2e86c3[_0x9e2a('0x24')]['id']:null;_0x13368b[_['upperFirst'](_0x2e86c3['channel'])+(_0x2e86c3[_0x9e2a('0x21')]!=='chat'?_0x9e2a('0x25'):'WebsiteId')]=_0x2e86c3['account']?_0x2e86c3[_0x9e2a('0x7')]['id']:null;logger[_0x9e2a('0x26')](util['format'](_0x9e2a('0x27'),_0x442bde,_0x4ae487[_0x9e2a('0x28')]));emitChannelQueueInteraction(_0x2e86c3[_0x9e2a('0x21')],_0x4ae487[_0x9e2a('0x28')],_0x13368b,_0x2e86c3[_0x9e2a('0x7')][_0x9e2a('0x28')],_0x2e86c3[_0x9e2a('0x24')]['id'],!![],_0x13ad67,_0x4ae487['id']);if(rpc[_0x2e86c3[_0x9e2a('0x21')]+'QueueReport']){return rpc[_0x2e86c3['channel']+_0x9e2a('0x29')][_0x9e2a('0x2a')](_0x13368b)['catch'](function(_0x25d5b1){logger[_0x9e2a('0x2b')](_0x9e2a('0x2c'));});}}}function stopRouting(_0x5dee13,_0x23aedc,_0x1015a2,_0x44f0cd){if(_0x5dee13&&_0x23aedc){_0x23aedc[_0x9e2a('0x1a')]-=0x1;var _0x410da6={'leaveAt':moment()[_0x9e2a('0xd')](_0x9e2a('0x1c')),'acceptAt':moment()[_0x9e2a('0xd')](_0x9e2a('0x1c')),'reason':_0x9e2a('0x2d')};logger[_0x9e2a('0x26')](util['format'](_0x9e2a('0x2e'),_0x5dee13,_0x23aedc[_0x9e2a('0x28')]));emitChannelQueueInteraction(_0x1015a2[_0x9e2a('0x21')],_0x23aedc[_0x9e2a('0x28')],_0x1015a2[_0x9e2a('0x1b')],_0x1015a2[_0x9e2a('0x7')]['name'],_0x1015a2[_0x9e2a('0x24')]['id'],![],_0x44f0cd,_0x23aedc['id']);if(rpc[_0x1015a2[_0x9e2a('0x21')]+_0x9e2a('0x29')]){return rpc[_0x1015a2[_0x9e2a('0x21')]+_0x9e2a('0x29')][_0x9e2a('0x2f')](_0x5dee13,_0x410da6)[_0x9e2a('0x30')](function(_0x1c80be){logger[_0x9e2a('0x2b')](_0x9e2a('0x31'));});}}}function endRouting(_0x18741d,_0x199cc3,_0x492179,_0x5f0ade){if(_0x18741d&&_0x199cc3){_0x199cc3['waiting']-=0x1;var _0x4101a6={'leaveAt':moment()[_0x9e2a('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x9e2a('0xd')](_0x9e2a('0x1c')),'reason':'timeout'};logger[_0x9e2a('0x26')](util[_0x9e2a('0xd')]('[%s][END:QUEUE][NAME:%s]',_0x18741d,_0x199cc3[_0x9e2a('0x28')]));emitChannelQueueInteraction(_0x492179[_0x9e2a('0x21')],_0x199cc3[_0x9e2a('0x28')],_0x492179['body'],_0x492179['account'][_0x9e2a('0x28')],_0x492179[_0x9e2a('0x24')]['id'],![],_0x5f0ade);if(rpc[_0x492179[_0x9e2a('0x21')]+'QueueReport']){return rpc[_0x492179[_0x9e2a('0x21')]+'QueueReport'][_0x9e2a('0x2f')](_0x18741d,_0x4101a6)['catch'](function(_0x2aaafd){logger[_0x9e2a('0x2b')](_0x9e2a('0x31'));});}}}function handleFindQueue(_0x473acf){return function(_0x110de2){return _0x110de2[_0x9e2a('0x28')][_0x9e2a('0x32')]()===_0x473acf[_0x9e2a('0x32')]();};}exports[_0x9e2a('0x33')]=function(_0x560605,_0x296b02,_0x3b9ae5,_0x44ea55){return function(_0x622a11){try{var _0x5f002e={'name':_0x296b02[0x0],'timeout':_0x296b02[0x1]};var _0xfd3c77=queue['validate'](_0x5f002e,{'typecast':!![]});if(_0xfd3c77[_0x9e2a('0x34')]){logger['error'](_0x9e2a('0x35'),_0x560605,_[_0x9e2a('0x36')](_0xfd3c77,_0x9e2a('0x24'))['join'](',\x20'));_0x622a11[_0x9e2a('0x37')]();}else{var _0x5b18b1=_['find'](_0x3b9ae5[_0x44ea55[_0x9e2a('0x21')]+_0x9e2a('0x38')],handleFindQueue(_0x5f002e['name']));if(_0x5b18b1){startRouting(_0x560605,_0x5b18b1,_0x44ea55,_0x3b9ae5);var _0x24bea2=(_0x5b18b1[_0x9e2a('0x39')]||0xa)*0x3e8;var _0x8f2057=(_0x5f002e[_0x9e2a('0x39')]||0x14)*0x3e8;var _0x2b9573,_0x526865;if(_0x24bea2>_0x8f2057){_0x8f2057=_0x24bea2;}var _0x36e720=seqqueue[_0x9e2a('0x3a')](_0x24bea2);_0x36e720['id']=_0x560605;_0x36e720[_0x9e2a('0x3b')]=_0x24bea2;_0x36e720[_0x9e2a('0x3c')]=_0x8f2057;_0x36e720[_0x9e2a('0x21')]=_0x44ea55['channel'];_0x526865=setInterval(function(){if(_0x3b9ae5[_0x9e2a('0x3d')]&&!_0x3b9ae5[_0x9e2a('0x3d')][_0x560605]){stopRouting(_0x560605,_0x5b18b1,_0x44ea55,_0x3b9ae5);clearTimeout(_0x2b9573);clearInterval(_0x526865);_0x2b9573=undefined;_0x36e720[_0x9e2a('0x3e')](!![]);_0x622a11['stop']();}},0x3e8);_0x2b9573=setTimeout(function(){endRouting(_0x560605,_0x5b18b1,_0x44ea55,_0x3b9ae5);clearInterval(_0x526865);_0x526865=undefined;_0x36e720[_0x9e2a('0x3e')](!![]);_0x622a11[_0x9e2a('0x3f')]();},_0x8f2057);switch(_0x5b18b1[_0x9e2a('0x40')]){case _0x9e2a('0x41'):strategy[_0x9e2a('0x41')](_0x36e720,_0x5b18b1,_0x3b9ae5,_0x44ea55);break;default:strategy[_0x9e2a('0x42')](_0x36e720,_0x5b18b1,_0x3b9ae5,_0x44ea55);}}else{logger[_0x9e2a('0x2b')](_0x9e2a('0x43'),_0x560605,_0x5f002e[_0x9e2a('0x28')]);_0x622a11[_0x9e2a('0x37')]();}}}catch(_0x2d1289){console[_0x9e2a('0x44')](_0x2d1289);logger[_0x9e2a('0x2b')](_0x9e2a('0x35'),_0x560605,JSON[_0x9e2a('0x45')](_0x2d1289));_0x622a11[_0x9e2a('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 33e9c3b..2ad4eff 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 _0x2ae7=['channel','writeLog',':FORCED','busy','busyQueue','showNotification','notificationId','[%s][AGENT]\x20timeout\x20with\x20%s','isNil','TIMEOUT','hideNotification','exports','lodash','./util','../../../../../config/logger','routing','agent','squeue','handleRun','bind','handleTimeout','drained','prototype','done','info','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable'];(function(_0x3f8a19,_0x19123e){var _0x39813e=function(_0x325c21){while(--_0x325c21){_0x3f8a19['push'](_0x3f8a19['shift']());}};_0x39813e(++_0x19123e);}(_0x2ae7,0x11a));var _0x72ae=function(_0x5ad3e8,_0x1666bb){_0x5ad3e8=_0x5ad3e8-0x0;var _0x285201=_0x2ae7[_0x5ad3e8];return _0x285201;};'use strict';var _=require(_0x72ae('0x0'));var uuid=require('uuid');var util=require(_0x72ae('0x1'));var logger=require(_0x72ae('0x2'))(_0x72ae('0x3'));var Agent=function(_0xd18443,_0x57760d,_0x268731,_0x10210c){this['notificationId']=uuid['v4']();this['squeue']=_0xd18443;this[_0x72ae('0x4')]=_0x57760d;this['realtime']=_0x268731;this[_0x72ae('0x3')]=_0x10210c;this[_0x72ae('0x5')]['push'](this[_0x72ae('0x6')][_0x72ae('0x7')](this),this[_0x72ae('0x8')][_0x72ae('0x7')](this));this[_0x72ae('0x5')]['on'](_0x72ae('0x9'),this['handleTimeout'][_0x72ae('0x7')](this));};Agent[_0x72ae('0xa')]['push']=function(){this[_0x72ae('0x5')]['push'](this['handleRun']['bind'](this),this['handleTimeout'][_0x72ae('0x7')](this));};Agent[_0x72ae('0xa')][_0x72ae('0xb')]=function(_0x582d17){if(_0x582d17){setTimeout(this['push']['bind'](this),0x3e8);_0x582d17[_0x72ae('0xb')]();}};Agent['prototype'][_0x72ae('0x6')]=function(_0x51c4fe){logger[_0x72ae('0xc')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x72ae('0x5')]['id'],this[_0x72ae('0x4')]['id']);if(_['isNil'](this[_0x72ae('0xd')][_0x72ae('0xe')][this[_0x72ae('0x4')]['id']])){logger[_0x72ae('0xc')](_0x72ae('0xf'),this['squeue']['id'],this[_0x72ae('0x4')]['id']);this['done'](_0x51c4fe);}else{if(this[_0x72ae('0x3')][_0x72ae('0x10')]||util[_0x72ae('0x11')](this[_0x72ae('0x5')]['id'],this[_0x72ae('0xd')][_0x72ae('0xe')][this[_0x72ae('0x4')]['id']],this[_0x72ae('0x5')][_0x72ae('0x12')],![])){util[_0x72ae('0x13')](this[_0x72ae('0x5')]['id'],this['realtime']['agents'][this['agent']['id']],'RINGING'+(this['routing']['forcedOwnership']?_0x72ae('0x14'):''));this['realtime'][_0x72ae('0xe')][this['agent']['id']][_0x72ae('0x15')]=!![];this[_0x72ae('0xd')]['agents'][this[_0x72ae('0x4')]['id']][_0x72ae('0x16')]=undefined;util[_0x72ae('0x17')](this[_0x72ae('0x18')],this[_0x72ae('0x5')]['id'],this['realtime']['agents'][this['agent']['id']],null,this[_0x72ae('0x3')]);}else{this[_0x72ae('0xb')](_0x51c4fe);}}};Agent['prototype'][_0x72ae('0x8')]=function(){logger[_0x72ae('0xc')](_0x72ae('0x19'),this['squeue']['id'],this[_0x72ae('0x4')]['id']);if(_[_0x72ae('0x1a')](this['realtime']['agents'][this[_0x72ae('0x4')]['id']])){return logger[_0x72ae('0xc')](_0x72ae('0xf'),this[_0x72ae('0x5')]['id'],this[_0x72ae('0x4')]['id']);}else{util[_0x72ae('0x13')](this[_0x72ae('0x5')]['id'],this[_0x72ae('0xd')][_0x72ae('0xe')][this[_0x72ae('0x4')]['id']],_0x72ae('0x1b'));this[_0x72ae('0xd')][_0x72ae('0xe')][this[_0x72ae('0x4')]['id']][_0x72ae('0x15')]=![];this[_0x72ae('0xd')]['agents'][this['agent']['id']]['busyQueue']=undefined;util[_0x72ae('0x1c')](this[_0x72ae('0x18')],this['squeue']['id'],this[_0x72ae('0xd')][_0x72ae('0xe')][this[_0x72ae('0x4')]['id']],null,this[_0x72ae('0x3')]);}};function agent(_0x5b863a,_0x32d489,_0x4cc858,_0x51a26a){return new Agent(_0x5b863a,_0x32d489,_0x4cc858,_0x51a26a);}module[_0x72ae('0x1d')]=agent; \ No newline at end of file +var _0x1215=['busy','showNotification','notificationId','[%s][AGENT]\x20timeout\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','writeLog','TIMEOUT','busyQueue','hideNotification','exports','lodash','../../../../../config/logger','squeue','agent','routing','push','handleRun','bind','handleTimeout','drained','prototype','done','info','[%s][AGENT]\x20try\x20with\x20%s','agents','realtime','channel','RINGING','forcedOwnership',':FORCED'];(function(_0x269b03,_0x4bf9b3){var _0x36ba3e=function(_0xc0f9bd){while(--_0xc0f9bd){_0x269b03['push'](_0x269b03['shift']());}};_0x36ba3e(++_0x4bf9b3);}(_0x1215,0x17f));var _0x5121=function(_0x6da129,_0x40948d){_0x6da129=_0x6da129-0x0;var _0x1349d6=_0x1215[_0x6da129];return _0x1349d6;};'use strict';var _=require(_0x5121('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0x5121('0x1'))('routing');var Agent=function(_0xbba565,_0xf7c4cc,_0xa0ea30,_0x37d218){this['notificationId']=uuid['v4']();this[_0x5121('0x2')]=_0xbba565;this[_0x5121('0x3')]=_0xf7c4cc;this['realtime']=_0xa0ea30;this[_0x5121('0x4')]=_0x37d218;this[_0x5121('0x2')][_0x5121('0x5')](this[_0x5121('0x6')][_0x5121('0x7')](this),this[_0x5121('0x8')][_0x5121('0x7')](this));this[_0x5121('0x2')]['on'](_0x5121('0x9'),this[_0x5121('0x8')]['bind'](this));};Agent[_0x5121('0xa')][_0x5121('0x5')]=function(){this[_0x5121('0x2')][_0x5121('0x5')](this[_0x5121('0x6')]['bind'](this),this[_0x5121('0x8')][_0x5121('0x7')](this));};Agent[_0x5121('0xa')][_0x5121('0xb')]=function(_0x18a185){if(_0x18a185){setTimeout(this['push'][_0x5121('0x7')](this),0x3e8);_0x18a185[_0x5121('0xb')]();}};Agent[_0x5121('0xa')][_0x5121('0x6')]=function(_0x5592be){logger[_0x5121('0xc')](_0x5121('0xd'),this['squeue']['id'],this['agent']['id']);if(_['isNil'](this['realtime'][_0x5121('0xe')][this[_0x5121('0x3')]['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x5121('0x2')]['id'],this[_0x5121('0x3')]['id']);this[_0x5121('0xb')](_0x5592be);}else{if(this[_0x5121('0x4')]['forcedOwnership']||util['isAgentAvailable'](this[_0x5121('0x2')]['id'],this[_0x5121('0xf')]['agents'][this[_0x5121('0x3')]['id']],this[_0x5121('0x2')][_0x5121('0x10')],![])){util['writeLog'](this[_0x5121('0x2')]['id'],this[_0x5121('0xf')][_0x5121('0xe')][this[_0x5121('0x3')]['id']],_0x5121('0x11')+(this[_0x5121('0x4')][_0x5121('0x12')]?_0x5121('0x13'):''));this[_0x5121('0xf')][_0x5121('0xe')][this['agent']['id']][_0x5121('0x14')]=!![];this[_0x5121('0xf')][_0x5121('0xe')][this['agent']['id']]['busyQueue']=undefined;util[_0x5121('0x15')](this[_0x5121('0x16')],this[_0x5121('0x2')]['id'],this[_0x5121('0xf')][_0x5121('0xe')][this['agent']['id']],null,this[_0x5121('0x4')]);}else{this[_0x5121('0xb')](_0x5592be);}}};Agent[_0x5121('0xa')][_0x5121('0x8')]=function(){logger[_0x5121('0xc')](_0x5121('0x17'),this[_0x5121('0x2')]['id'],this['agent']['id']);if(_[_0x5121('0x18')](this[_0x5121('0xf')][_0x5121('0xe')][this[_0x5121('0x3')]['id']])){return logger[_0x5121('0xc')](_0x5121('0x19'),this[_0x5121('0x2')]['id'],this['agent']['id']);}else{util[_0x5121('0x1a')](this[_0x5121('0x2')]['id'],this[_0x5121('0xf')][_0x5121('0xe')][this[_0x5121('0x3')]['id']],_0x5121('0x1b'));this[_0x5121('0xf')][_0x5121('0xe')][this[_0x5121('0x3')]['id']][_0x5121('0x14')]=![];this[_0x5121('0xf')][_0x5121('0xe')][this[_0x5121('0x3')]['id']][_0x5121('0x1c')]=undefined;util[_0x5121('0x1d')](this['notificationId'],this[_0x5121('0x2')]['id'],this[_0x5121('0xf')][_0x5121('0xe')][this[_0x5121('0x3')]['id']],null,this[_0x5121('0x4')]);}};function agent(_0x1c05dc,_0x5e513e,_0x3c3639,_0x41ecd4){return new Agent(_0x1c05dc,_0x5e513e,_0x3c3639,_0x41ecd4);}module[_0x5121('0x1e')]=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 e432aae..3681e2a 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 _0x13f6=['hideNotification','exports','lodash','uuid','routing','notificationId','squeue','realtime','atimeout','module','push','handleRun','handleTimeout','bind','drained','prototype','done','queue','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog','RINGING','busy','busyQueue','isNil'];(function(_0xa847be,_0x1a1cab){var _0x26a37e=function(_0x34d458){while(--_0x34d458){_0xa847be['push'](_0xa847be['shift']());}};_0x26a37e(++_0x1a1cab);}(_0x13f6,0x124));var _0x613f=function(_0x5739ab,_0x3325dd){_0x5739ab=_0x5739ab-0x0;var _0x8bff65=_0x13f6[_0x5739ab];return _0x8bff65;};'use strict';var _=require(_0x613f('0x0'));var uuid=require(_0x613f('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')(_0x613f('0x2'));var Beepall=function(_0x13b50a,_0x12dc5a,_0x5414ff,_0x179f6e){this[_0x613f('0x3')]=uuid['v4']();this[_0x613f('0x4')]=_0x13b50a;this['queue']=_0x12dc5a;this[_0x613f('0x5')]=_0x5414ff;this[_0x613f('0x2')]=_0x179f6e;this['length']=Math['floor'](this['squeue']['qtimeout']/this[_0x613f('0x4')][_0x613f('0x6')]);this[_0x613f('0x7')]=this[_0x613f('0x4')]['qtimeout']%this[_0x613f('0x4')][_0x613f('0x6')];for(var _0xcd514c=0x0;_0xcd514c0x0){for(var _0x163ccb=0x0,_0x2aa14b;_0x163ccb0x0){for(var _0x3e2789=0x0,_0xdb7eca;_0x3e27890x0&&_0x267540[_0x188cf7+_0x8cde('0x1d')]>=_0x267540[_0x188cf7+_0x8cde('0x1b')]){writeLog(_0x59434f,_0x267540,_0x188cf7[_0x8cde('0x1e')]()+_0x8cde('0x1f'));return![];}}return!![];};exports['showNotification']=function(_0x3f207d,_0x588e92,_0x51b77d,_0x5b704f,_0x205fbc){return sendNotification(!![],_0x3f207d,_0x588e92,_0x51b77d,_0x5b704f,_0x205fbc);};exports[_0x8cde('0x20')]=function(_0x3ef2c9,_0x5a406d,_0x455640,_0x1bc2dd,_0x465ae2){return sendNotification(![],_0x3ef2c9,_0x5a406d,_0x455640,_0x1bc2dd,_0x465ae2);};exports[_0x8cde('0x21')]=writeLog; \ No newline at end of file +var _0xa4dd=['remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification','hideNotification','writeLog','util','mustache','../../../../../config/logger','routing','localhost','user:%s','name','emit','user:save','account','body','queue','msg','getMustacheRender','notificationTemplate','error','format','[%s][QUEUE]\x20%s','message','notification:%s','save'];(function(_0x4ef9a8,_0x538cbc){var _0x2779f5=function(_0x1fd28e){while(--_0x1fd28e){_0x4ef9a8['push'](_0x4ef9a8['shift']());}};_0x2779f5(++_0x538cbc);}(_0xa4dd,0x177));var _0xda4d=function(_0x8a0d94,_0x16fcee){_0x8a0d94=_0x8a0d94-0x0;var _0x48f382=_0xa4dd[_0x8a0d94];return _0x48f382;};'use strict';var util=require(_0xda4d('0x0'));var utils=require('../utils');var Mustache=require(_0xda4d('0x1'));var logger=require(_0xda4d('0x2'))(_0xda4d('0x3'));var io=require('socket.io-emitter')({'host':_0xda4d('0x4'),'port':0x18eb});function emit(_0x2b9799,_0x4749f1,_0x4a7d33){io['to'](_0x2b9799)['emit'](_0x4749f1,_0x4a7d33);}function sendNotification(_0x57273e,_0x365ed1,_0x31c26a,_0x31aea4,_0x4ed292,_0x4236c2){io['to'](util['format'](_0xda4d('0x5'),_0x31aea4[_0xda4d('0x6')]))[_0xda4d('0x7')](_0xda4d('0x8'),_0x31aea4);var _0x4690f4=_0x4236c2||{};var _0x4c8d5d=_0x31c26a['split']('.');var _0x3ae311={'uniqueid':_0x365ed1,'channel':_0x4c8d5d[0x0],'id':_0x4c8d5d[0x1],'title':_0x4c8d5d[0x0]+'\x20interaction','interactionId':_0x4c8d5d[0x2],'queue':_0x4ed292?_0x4ed292[_0xda4d('0x6')]:null,'sound':_0x4690f4[_0xda4d('0x9')]['notificationSound'],'shake':_0x4690f4[_0xda4d('0x9')]['notificationShake']};try{if(!_0x4690f4[_0xda4d('0xa')]){_0x4690f4['body']={};}if(_0x4ed292){_0x4690f4[_0xda4d('0xa')][_0xda4d('0xb')]=_0x4ed292;}else if(_0x4690f4[_0xda4d('0xa')][_0xda4d('0xb')]){delete _0x4690f4[_0xda4d('0xa')][_0xda4d('0xb')];}_0x3ae311[_0xda4d('0xc')]=utils[_0xda4d('0xd')](_0x4690f4[_0xda4d('0x9')][_0xda4d('0xe')],_0x4690f4);}catch(_0x5dee48){_0x3ae311['msg']='I\x20can\x27t\x20render\x20your\x20template';logger[_0xda4d('0xf')](util[_0xda4d('0x10')](_0xda4d('0x11'),_0x365ed1,_0x5dee48[_0xda4d('0x12')]));}io['to'](util[_0xda4d('0x10')](_0xda4d('0x5'),_0x31aea4[_0xda4d('0x6')]))[_0xda4d('0x7')](util['format'](_0xda4d('0x13'),_0x57273e?_0xda4d('0x14'):_0xda4d('0x15')),_0x3ae311);}function writeLog(_0x5c7bf3,_0x2ef811,_0x149c5f){return logger['info'](util['format'](_0xda4d('0x16'),_0x5c7bf3,_0x2ef811[_0xda4d('0x6')],_0x149c5f));}exports[_0xda4d('0x17')]=function(_0x15f773,_0x76170,_0x4be87c,_0x55334b){if(_0x76170[_0xda4d('0x18')]){writeLog(_0x15f773,_0x76170,_0xda4d('0x19'));return![];}if(!_0x76170['online']){writeLog(_0x15f773,_0x76170,_0xda4d('0x1a'));return![];}if(_0x76170[_0x4be87c+_0xda4d('0x1b')]){writeLog(_0x15f773,_0x76170,_0xda4d('0x1c'));return![];}if(_0x55334b&&_0x76170[_0xda4d('0x1d')](_0x4be87c+_0xda4d('0x1e'))&&_0x76170[_0xda4d('0x1d')](_0x4be87c+_0xda4d('0x1f'))){if(_0x76170[_0x4be87c+_0xda4d('0x1e')]>0x0&&_0x76170[_0x4be87c+_0xda4d('0x1f')]>=_0x76170[_0x4be87c+_0xda4d('0x1e')]){writeLog(_0x15f773,_0x76170,_0x4be87c[_0xda4d('0x20')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xda4d('0x21')]=function(_0x456fb8,_0x3ba1f8,_0x39732b,_0x114baa,_0x3627bb){return sendNotification(!![],_0x456fb8,_0x3ba1f8,_0x39732b,_0x114baa,_0x3627bb);};exports[_0xda4d('0x22')]=function(_0xfea8da,_0x54445c,_0x1f748d,_0x4d9a51,_0x1b2641){return sendNotification(![],_0xfea8da,_0x54445c,_0x1f748d,_0x4d9a51,_0x1b2641);};exports[_0xda4d('0x23')]=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 a44a8a5..7f75afa 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 _0x741f=['next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','shelljs','lodash','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x741f,0x111));var _0xf741=function(_0x5ed3bd,_0x2a10e1){_0x5ed3bd=_0x5ed3bd-0x0;var _0x5db4b3=_0x741f[_0x5ed3bd];return _0x5db4b3;};'use strict';var schema=require(_0xf741('0x0'));var sh=require(_0xf741('0x1'));var _=require(_0xf741('0x2'));var utils=require('./utils');var logger=require(_0xf741('0x3'))('routing');var system=schema({'command':{'type':_0xf741('0x4'),'required':!![],'message':_0xf741('0x5')}});exports[_0xf741('0x6')]=function(_0x38ba5e,_0x516522){return function(_0x50d907){try{var _0x129876={'command':_0x516522[0x0]};var _0x3bca2d=system[_0xf741('0x0')](_0x129876,{'typecast':!![]});if(_0x3bca2d[_0xf741('0x7')]){logger[_0xf741('0x8')]('[%s][SYSTEM]\x20%s',_0x38ba5e,_[_0xf741('0x9')](_0x3bca2d,_0xf741('0xa'))[_0xf741('0xb')](',\x20'));logger['info'](_0xf741('0xc'),_0x38ba5e);_0x50d907[_0xf741('0xd')]();}else{var _0x39d608=this;var _0x3a83fa=utils[_0xf741('0xe')](_0x516522[0x0],this);logger[_0xf741('0xf')](_0xf741('0x10'),_0x38ba5e,_0x3a83fa);sh[_0xf741('0x11')](_[_0xf741('0x12')](_0x3a83fa),function(_0x3ba4b8,_0xeaa22){logger[_0xf741('0xf')](_0xf741('0x13'),_0x38ba5e,_0x3ba4b8);if(_0x3ba4b8==0x0){var _0x558700=_0xeaa22[_0xf741('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0xf741('0x15')](_0x516522[0x1])||_['isEmpty'](_0x516522[0x1])){logger['info'](_0xf741('0x16'),_0x38ba5e);_0x39d608[_0xf741('0x17')][_0x516522[0x1]]=_0x558700;}else{logger[_0xf741('0xf')](_0xf741('0x18'),_0x38ba5e,_0x516522[0x1],_0x558700);_0x39d608[_0xf741('0x17')][_0x516522[0x1]]=_0x558700;}}_0x50d907['next']();});}}catch(_0x3761fe){logger[_0xf741('0x8')]('[%s][SYSTEM]\x20%s',_0x38ba5e,_[_0xf741('0x19')](_0x3761fe)?JSON['stringify'](_0x3761fe):_0x3761fe);logger['info'](_0xf741('0xc'),_0x38ba5e);_0x50d907[_0xf741('0xd')]();}};}; \ No newline at end of file +var _0x3848=['join','info','next','getMustacheRender','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20%s','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','shelljs','./utils','../../../../config/logger','routing','consequence','length','error','map','message'];(function(_0x558097,_0x5a6cc2){var _0xe80464=function(_0x46db4f){while(--_0x46db4f){_0x558097['push'](_0x558097['shift']());}};_0xe80464(++_0x5a6cc2);}(_0x3848,0x1f1));var _0x8384=function(_0x18d5d7,_0x19074b){_0x18d5d7=_0x18d5d7-0x0;var _0x30a9ea=_0x3848[_0x18d5d7];return _0x30a9ea;};'use strict';var schema=require('validate');var sh=require(_0x8384('0x0'));var _=require('lodash');var utils=require(_0x8384('0x1'));var logger=require(_0x8384('0x2'))(_0x8384('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x8384('0x4')]=function(_0x346ec2,_0xa3392a){return function(_0x2eed87){try{var _0x27a999={'command':_0xa3392a[0x0]};var _0x38034b=system['validate'](_0x27a999,{'typecast':!![]});if(_0x38034b[_0x8384('0x5')]){logger[_0x8384('0x6')]('[%s][SYSTEM]\x20%s',_0x346ec2,_[_0x8384('0x7')](_0x38034b,_0x8384('0x8'))[_0x8384('0x9')](',\x20'));logger[_0x8384('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x346ec2);_0x2eed87[_0x8384('0xb')]();}else{var _0x2008e3=this;var _0x27c670=utils[_0x8384('0xc')](_0xa3392a[0x0],this);logger[_0x8384('0xa')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x346ec2,_0x27c670);sh['exec'](_[_0x8384('0xd')](_0x27c670),function(_0x10dd55,_0x2f403d){logger[_0x8384('0xa')](_0x8384('0xe'),_0x346ec2,_0x10dd55);if(_0x10dd55==0x0){var _0x4aee73=_0x2f403d[_0x8384('0xf')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0xa3392a[0x1])||_[_0x8384('0x10')](_0xa3392a[0x1])){logger[_0x8384('0xa')](_0x8384('0x11'),_0x346ec2);_0x2008e3['body'][_0xa3392a[0x1]]=_0x4aee73;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x346ec2,_0xa3392a[0x1],_0x4aee73);_0x2008e3[_0x8384('0x12')][_0xa3392a[0x1]]=_0x4aee73;}}_0x2eed87['next']();});}}catch(_0x3a3dc9){logger[_0x8384('0x6')](_0x8384('0x13'),_0x346ec2,_[_0x8384('0x14')](_0x3a3dc9)?JSON[_0x8384('0x15')](_0x3a3dc9):_0x3a3dc9);logger[_0x8384('0xa')](_0x8384('0x16'),_0x346ec2);_0x2eed87['next']();}};}; \ 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 0df0907..8e4c7c9 100644 --- a/server/services/routing/server/applications/tag.js +++ b/server/services/routing/server/applications/tag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['finally','error','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][TAG]\x20%s','map','join','next','channel','Interaction','addTags','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x1a7350,_0x482868){var _0x2b72b3=function(_0x1ad67e){while(--_0x1ad67e){_0x1a7350['push'](_0x1a7350['shift']());}};_0x2b72b3(++_0x482868);}(_0x7a54,0x106));var _0x47a5=function(_0x10c2eb,_0x2e18ee){_0x10c2eb=_0x10c2eb-0x0;var _0x316c46=_0x7a54[_0x10c2eb];return _0x316c46;};'use strict';var schema=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var rpc={'chatInteraction':require(_0x47a5('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x47a5('0x3')),'mailInteraction':require(_0x47a5('0x4')),'faxInteraction':require('../../rpc/faxInteraction')};var logger=require(_0x47a5('0x5'))(_0x47a5('0x6'));var tag=schema({'tag':{'type':_0x47a5('0x7'),'required':!![],'message':_0x47a5('0x8')}});exports[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629,_0x59199c,_0x343372){return function(_0x30e405){try{var _0x506eda={'tag':_0x3d5629[0x0]};var _0x194fb0=tag['validate'](_0x506eda,{'typecast':!![]});if(_0x194fb0['length']){logger['error'](_0x47a5('0xa'),_0x545a97,_[_0x47a5('0xb')](_0x194fb0,'message')[_0x47a5('0xc')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x545a97);_0x30e405[_0x47a5('0xd')]();}else{var _0x69e4d4={'ids':[_0x3d5629[0x0]]};if(rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')]){rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')][_0x47a5('0x10')](_0x343372['interaction']['id'],_0x69e4d4)[_0x47a5('0x11')](function(_0x221b54){logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x545a97,_0x3d5629[0x1],_0x343372[_0x47a5('0xe')],_0x343372[_0x47a5('0x14')]['id']);})[_0x47a5('0x15')](function(_0x190faa){logger['error'](_0x47a5('0xa'),_0x545a97,JSON[_0x47a5('0x16')](_0x190faa));logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);})[_0x47a5('0x18')](function(){_0x30e405['next']();});}}}catch(_0x549de3){logger[_0x47a5('0x19')]('[%s][TAG]\x20%s',_0x545a97,_['isObject'](_0x549de3)?JSON[_0x47a5('0x16')](_0x549de3):_0x549de3);logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);_0x30e405[_0x47a5('0xd')]();}};}; \ No newline at end of file +var _0x7a54=['finally','error','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][TAG]\x20%s','map','join','next','channel','Interaction','addTags','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x20b065,_0x1a1312){var _0x39b9e6=function(_0x218014){while(--_0x218014){_0x20b065['push'](_0x20b065['shift']());}};_0x39b9e6(++_0x1a1312);}(_0x7a54,0x106));var _0x47a5=function(_0x51d432,_0x537841){_0x51d432=_0x51d432-0x0;var _0x34a393=_0x7a54[_0x51d432];return _0x34a393;};'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 ad0084f..4730eca 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 _0x89e8=['merge','body','interaction','list','mustache','lodash','exports','render'];(function(_0x460eb3,_0x406265){var _0x2909d7=function(_0x36f872){while(--_0x36f872){_0x460eb3['push'](_0x460eb3['shift']());}};_0x2909d7(++_0x406265);}(_0x89e8,0x74));var _0x889e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x89e8[_0x1ac595];return _0x455fff;};'use strict';var Mustache=require(_0x889e('0x0'));var _=require(_0x889e('0x1'));module[_0x889e('0x2')]={'getMustacheRender':function(_0x319ddb,_0x35d770){return Mustache[_0x889e('0x3')](_0x319ddb,_[_0x889e('0x4')](_0x35d770[_0x889e('0x5')],{'contact':_0x35d770['contact'],'message':_0x35d770['message'],'account':_0x35d770['account'],'interaction':_0x35d770[_0x889e('0x6')],'list':_0x35d770[_0x889e('0x7')]}))||'';}}; \ No newline at end of file +var _0x8bdf=['mustache','lodash','exports','merge','body','contact','message','account','interaction'];(function(_0x231a47,_0x46a963){var _0x48d7c9=function(_0x1e69b1){while(--_0x1e69b1){_0x231a47['push'](_0x231a47['shift']());}};_0x48d7c9(++_0x46a963);}(_0x8bdf,0x1a7));var _0xf8bd=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x8bdf[_0x3ab9ee];return _0x82ee88;};'use strict';var Mustache=require(_0xf8bd('0x0'));var _=require(_0xf8bd('0x1'));module[_0xf8bd('0x2')]={'getMustacheRender':function(_0x46b662,_0x336d9f){return Mustache['render'](_0x46b662,_[_0xf8bd('0x3')](_0x336d9f[_0xf8bd('0x4')],{'contact':_0x336d9f[_0xf8bd('0x5')],'message':_0x336d9f[_0xf8bd('0x6')],'account':_0x336d9f[_0xf8bd('0x7')],'interaction':_0x336d9f[_0xf8bd('0x8')],'list':_0x336d9f['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index a99ac84..098d8aa 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 _0x3e06=['Intervals','interval','listen','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','tag','TagId','./interval','condition','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','stringify','matchPath','No\x20applications\x20to\x20execute','routing\x20is\x20empty','channel','QueueReport','update','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','values','chatQueues','available','loggedIn','paused','waiting','mailQueues','name','openchannelQueues','smsQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','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'];(function(_0xab193f,_0x1002f7){var _0x1d3fe9=function(_0x224e0b){while(--_0x224e0b){_0xab193f['push'](_0xab193f['shift']());}};_0x1d3fe9(++_0x1002f7);}(_0x3e06,0x153));var _0x63e0=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x3e06[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x63e0('0x0'));var util=require(_0x63e0('0x1'));var path=require(_0x63e0('0x2'));var fs=require('fs');var jayson=require(_0x63e0('0x3'));var BPromise=require(_0x63e0('0x4'));var uuid=require(_0x63e0('0x5'));var config=require('../../../config/environment');var logger=require(_0x63e0('0x6'))(_0x63e0('0x7'));var rpc={'openchannelQueueReport':require(_0x63e0('0x8'))};var rpc={'openchannelQueueReport':require(_0x63e0('0x8')),'mailQueueReport':require(_0x63e0('0x9')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x63e0('0xa')),'faxQueueReport':require(_0x63e0('0xb'))};var RuleEngine=require(_0x63e0('0xc'));function getId(_0x29ad2e,_0x20ba81,_0x2482fb){return util[_0x63e0('0xd')](_0x63e0('0xe'),_0x29ad2e,_0x20ba81||0x0,_0x2482fb||0x0);}function getIntervals(_0x4a7bf2,_0x4326d5){var _0x4ebd9b=[];if(!_[_0x63e0('0xf')](_0x4326d5[_0x63e0('0x10')])&&!_['isNil'](_0x4a7bf2[_0x4326d5[_0x63e0('0x10')]])&&!_['isNil'](_0x4a7bf2[_0x4326d5['IntervalId']][_0x63e0('0x11')])){_0x4ebd9b=_['map'](_0x4a7bf2[_0x4326d5[_0x63e0('0x10')]][_0x63e0('0x11')],'interval');}else if(!_[_0x63e0('0xf')](_0x4326d5[_0x63e0('0x12')])){_0x4ebd9b=[_0x4326d5['interval']];}return _0x4ebd9b;}exports[_0x63e0('0x13')]=function(_0x36fd57){_0x36fd57['rules']={};return new BPromise(function(_0x2131a0,_0x73948d){var _0x3844aa={'Start':function(_0x23292c){var _0x2b9b32=this;return new Promise(function(_0x316753,_0x2cf197){if(_0x23292c){try{var _0x5396b2=[];var _0x2ca2ab=getId(_0x23292c['channel'],_0x23292c[_0x63e0('0x14')]?_0x23292c['message']['id']:0x0,_0x23292c[_0x63e0('0x15')]?_0x23292c['interaction']['id']:0x0);if(_0x23292c[_0x63e0('0x16')]&&_[_0x63e0('0x17')](_0x23292c[_0x63e0('0x16')])&&_0x23292c[_0x63e0('0x16')]['length']){for(var _0x8a9e02=0x0;_0x8a9e02<_0x23292c[_0x63e0('0x16')][_0x63e0('0x18')];_0x8a9e02+=0x1){var _0x51ddd3=_0x23292c[_0x63e0('0x16')][_0x8a9e02];if(fs[_0x63e0('0x19')](path[_0x63e0('0x1a')](__dirname,_0x63e0('0x16'),_0x51ddd3[_0x63e0('0x1b')]+_0x63e0('0x1c')))){var _0x1c2429=[];switch(_0x51ddd3[_0x63e0('0x1b')][_0x63e0('0x1d')]()){case _0x63e0('0x1e'):var _0x5b1cfb=_0x51ddd3[_0x63e0('0x1f')][_0x63e0('0x20')](',');_0x1c2429['push'](_0x5b1cfb[0x0]);_0x1c2429[_0x63e0('0x21')](_0x5b1cfb[_0x63e0('0x22')](0x1,_0x5b1cfb['length'])[_0x63e0('0x1a')](','));break;case _0x63e0('0x23'):var _0x5b1cfb=_0x51ddd3[_0x63e0('0x1f')][_0x63e0('0x20')](',');_0x1c2429[_0x63e0('0x21')](_0x5b1cfb[0x0]);_0x1c2429[_0x63e0('0x21')](_0x5b1cfb[0x1]);_0x1c2429[_0x63e0('0x21')](_0x5b1cfb['slice'](0x2,_0x5b1cfb[_0x63e0('0x18')])[_0x63e0('0x1a')](','));break;case _0x63e0('0x14'):_0x1c2429[_0x63e0('0x21')](_0x51ddd3[_0x63e0('0x1f')]);break;case _0x63e0('0x24'):_0x1c2429[_0x63e0('0x21')](_0x51ddd3[_0x63e0('0x25')]);_0x1c2429[_0x63e0('0x21')](_0x51ddd3['appdata']);break;default:_0x1c2429=_[_0x63e0('0xf')](_0x51ddd3[_0x63e0('0x1f')])?[]:_0x51ddd3[_0x63e0('0x1f')][_0x63e0('0x20')](',');}var _0x741d27={'id':util[_0x63e0('0xd')]('%s:%s:%s',_0x2ca2ab,_0x51ddd3['id'],_0x51ddd3['app']),'condition':require(_0x63e0('0x26'))[_0x63e0('0x27')](_0x2ca2ab,getIntervals(_0x36fd57[_0x63e0('0x28')],_0x51ddd3),_0x36fd57),'consequence':require(_0x63e0('0x29')+_0x51ddd3[_0x63e0('0x1b')])['consequence'](_0x2ca2ab,_0x1c2429,_0x36fd57,_0x23292c),'p':_0x51ddd3[_0x63e0('0x2a')]||0x0};logger[_0x63e0('0x2b')](_0x63e0('0x2c'),_0x741d27['id'],_0x63e0('0x2d'),getIntervals(_0x36fd57[_0x63e0('0x28')],_0x51ddd3)['join'](_0x63e0('0x2e')));_0x5396b2['push'](_0x741d27);}else{logger[_0x63e0('0x2f')](_0x63e0('0x30'),path[_0x63e0('0x1a')](__dirname,'applications',_0x51ddd3[_0x63e0('0x1b')]+'.js'));}}_0x36fd57[_0x63e0('0x31')][_0x2ca2ab]=new RuleEngine(_0x5396b2);_0x36fd57[_0x63e0('0x31')][_0x2ca2ab][_0x63e0('0x32')](_0x23292c,function(_0x3a006f){logger[_0x63e0('0x2b')](_0x63e0('0x33'),JSON[_0x63e0('0x34')](_0x3a006f[_0x63e0('0x35')]));if(_0x36fd57[_0x63e0('0x31')][_0x2ca2ab]){delete _0x36fd57[_0x63e0('0x31')][_0x2ca2ab];}});return _0x316753({'code':0xc8,'message':_0x23292c});}else{logger['info'](_0x63e0('0x36'));return _0x316753({'code':0xc8,'message':_0x23292c});}}catch(_0x56e08f){logger[_0x63e0('0x2f')](JSON[_0x63e0('0x34')](_0x56e08f));return _0x2cf197(_0x2b9b32[_0x63e0('0x2f')](0x1f4,_0x56e08f));}}return _0x2cf197(_0x63e0('0x37'));});},'AcceptMessage':function(_0x383ce4){var _0x2a50ab=this;return new Promise(function(_0xd8e004,_0x4114dc){if(_0x383ce4[_0x63e0('0x14')]&&_0x383ce4[_0x63e0('0x14')]['id']){try{var _0x283bc6=getId(_0x383ce4['channel'],_0x383ce4[_0x63e0('0x14')]?_0x383ce4['message']['id']:0x0,_0x383ce4[_0x63e0('0x15')]?_0x383ce4[_0x63e0('0x15')]['id']:0x0);if(_0x36fd57[_0x63e0('0x31')][_0x283bc6]){delete _0x36fd57[_0x63e0('0x31')][_0x283bc6];if(rpc[_0x383ce4[_0x63e0('0x38')]+_0x63e0('0x39')]){rpc[_0x383ce4[_0x63e0('0x38')]+'QueueReport'][_0x63e0('0x3a')](_0x283bc6,{'UserId':_0x383ce4[_0x63e0('0x14')]['UserId']})['catch'](function(_0x592f6d){logger[_0x63e0('0x2f')](_0x63e0('0x3b'));});}}return _0xd8e004({'code':0xc8,'message':_0x383ce4});}catch(_0x1bcbac){logger['error'](JSON[_0x63e0('0x34')](_0x1bcbac));return _0x4114dc(_0x2a50ab[_0x63e0('0x2f')](0x1f4,_0x1bcbac));}}logger[_0x63e0('0x2f')](_0x63e0('0x3c'));return _0x4114dc(_0x2a50ab[_0x63e0('0x2f')](0x1f4,_0x63e0('0x3c')));});},'RejectMessage':function(_0x399083){var _0x4fd47e=this;return new Promise(function(_0xc538a4,_0x87a390){if(_0x399083['agent']&&_0x399083[_0x63e0('0x3d')]['id']){try{if(_0x36fd57[_0x63e0('0x3e')][_0x399083[_0x63e0('0x3d')]['id']]){_0x36fd57['agents'][_0x399083[_0x63e0('0x3d')]['id']][_0x63e0('0x3f')]=![];_0x36fd57[_0x63e0('0x3e')][_0x399083['agent']['id']]['busyQueue']=undefined;}return _0xc538a4({'code':0xc8,'message':_0x399083});}catch(_0x52d2cd){logger[_0x63e0('0x2f')](JSON[_0x63e0('0x34')](_0x52d2cd));return _0x87a390(_0x4fd47e[_0x63e0('0x2f')](0x1f4,_0x52d2cd));}}logger[_0x63e0('0x2f')](_0x63e0('0x3c'));return _0x87a390(_0x4fd47e[_0x63e0('0x2f')](0x1f4,_0x63e0('0x3c')));});},'AbandonInteraction':function(_0x2adacb){var _0x2454d9=this;return new Promise(function(_0x7f8ded,_0x5df546){if(_0x2adacb[_0x63e0('0x38')]&&_0x2adacb['interaction']&&_0x2adacb[_0x63e0('0x15')]['id']){try{var _0x3215f2=getId(_0x2adacb['channel'],_0x2adacb['message']?_0x2adacb[_0x63e0('0x14')]['id']:0x0,_0x2adacb[_0x63e0('0x15')]?_0x2adacb['interaction']['id']:0x0);if(_0x36fd57[_0x63e0('0x31')][_0x3215f2]){delete _0x36fd57[_0x63e0('0x31')][_0x3215f2];}return _0x7f8ded({'code':0xc8,'message':_0x2adacb});}catch(_0x1cccf1){logger['error'](JSON[_0x63e0('0x34')](_0x1cccf1));return _0x5df546(_0x2454d9[_0x63e0('0x2f')](0x1f4,_0x1cccf1));}}logger[_0x63e0('0x2f')](_0x63e0('0x3c'));return _0x5df546(_0x2454d9[_0x63e0('0x2f')](0x1f4,_0x63e0('0x3c')));});},'AgentCapacity':function(_0x475912){var _0x2ddc44=this;return new Promise(function(_0x576388,_0x125382){if(_0x36fd57[_0x63e0('0x3e')]['hasOwnProperty'](_0x475912['id'])){for(var _0x337e25 in _0x475912[_0x63e0('0x40')]){if(_0x475912[_0x63e0('0x40')][_0x63e0('0x41')](_0x337e25)){if(_0x36fd57[_0x63e0('0x3e')][_0x475912['id']][_0x63e0('0x41')](_0x337e25+_0x63e0('0x42'))){_0x36fd57['agents'][_0x475912['id']][_0x337e25+_0x63e0('0x42')]=parseInt(_0x475912[_0x63e0('0x40')][_0x337e25],0xa);_0x36fd57['agents'][_0x475912['id']][_0x63e0('0x43')]();}}}return _0x576388({'code':0xc8,'message':_0x36fd57[_0x63e0('0x3e')][_0x475912['id']]});}else{return _0x125382(_0x2ddc44[_0x63e0('0x2f')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0xbb642f){return new Promise(function(_0x5173ee,_0x3a157){var _0x4c1b12=_[_0x63e0('0x44')](_0x36fd57['agents']);_0x5173ee({'count':_0x4c1b12['length'],'rows':_0x4c1b12});});},'ChatQueues':function(_0x49ef0d){return new Promise(function(_0x525d94,_0x1a27b4){var _0x112d25=[];for(var _0x24d7ad in _0x36fd57[_0x63e0('0x45')]){if(_0x36fd57[_0x63e0('0x45')][_0x63e0('0x41')](_0x24d7ad)){var _0x3fd040=_0x36fd57['chatQueues'][_0x24d7ad];var _0x2fc2da={'id':_0x3fd040['id'],'available':_0x3fd040[_0x63e0('0x46')],'loggedIn':_0x3fd040[_0x63e0('0x47')],'name':_0x3fd040['name'],'paused':_0x3fd040[_0x63e0('0x48')],'waiting':_0x3fd040[_0x63e0('0x49')]};_0x112d25[_0x63e0('0x21')](_0x2fc2da);}}_0x525d94({'count':_0x112d25[_0x63e0('0x18')],'rows':_0x112d25});});},'MailQueues':function(_0xf51e5d){return new Promise(function(_0x384256,_0x1d90b1){var _0xf01ad9=[];for(var _0x2c4b0d in _0x36fd57[_0x63e0('0x4a')]){if(_0x36fd57[_0x63e0('0x4a')][_0x63e0('0x41')](_0x2c4b0d)){var _0x93ead=_0x36fd57[_0x63e0('0x4a')][_0x2c4b0d];var _0x7c3353={'id':_0x93ead['id'],'available':_0x93ead[_0x63e0('0x46')],'loggedIn':_0x93ead[_0x63e0('0x47')],'name':_0x93ead[_0x63e0('0x4b')],'paused':_0x93ead[_0x63e0('0x48')],'waiting':_0x93ead['waiting']};_0xf01ad9['push'](_0x7c3353);}}_0x384256({'count':_0xf01ad9['length'],'rows':_0xf01ad9});});},'OpenchannelQueues':function(_0x7600c1){return new Promise(function(_0xfd653,_0x5b5913){var _0x5dab09=[];for(var _0x38f2d9 in _0x36fd57[_0x63e0('0x4c')]){if(_0x36fd57[_0x63e0('0x4c')]['hasOwnProperty'](_0x38f2d9)){var _0x4849c0=_0x36fd57[_0x63e0('0x4c')][_0x38f2d9];var _0x3e5ef0={'id':_0x4849c0['id'],'available':_0x4849c0[_0x63e0('0x46')],'loggedIn':_0x4849c0[_0x63e0('0x47')],'name':_0x4849c0['name'],'paused':_0x4849c0[_0x63e0('0x48')],'waiting':_0x4849c0[_0x63e0('0x49')]};_0x5dab09[_0x63e0('0x21')](_0x3e5ef0);}}_0xfd653({'count':_0x5dab09[_0x63e0('0x18')],'rows':_0x5dab09});});},'SmsQueues':function(_0x36f91a){return new Promise(function(_0x35fb67,_0x3e2020){var _0x99c1c1=[];for(var _0x47c986 in _0x36fd57[_0x63e0('0x4d')]){if(_0x36fd57[_0x63e0('0x4d')][_0x63e0('0x41')](_0x47c986)){var _0x394ef3=_0x36fd57['smsQueues'][_0x47c986];var _0x4d26f5={'id':_0x394ef3['id'],'available':_0x394ef3[_0x63e0('0x46')],'loggedIn':_0x394ef3[_0x63e0('0x47')],'name':_0x394ef3['name'],'paused':_0x394ef3[_0x63e0('0x48')],'waiting':_0x394ef3[_0x63e0('0x49')]};_0x99c1c1[_0x63e0('0x21')](_0x4d26f5);}}_0x35fb67({'count':_0x99c1c1[_0x63e0('0x18')],'rows':_0x99c1c1});});},'FaxQueues':function(_0x4155da){return new Promise(function(_0x30a1aa,_0x232a97){var _0x4be447=[];for(var _0x16860c in _0x36fd57[_0x63e0('0x4e')]){if(_0x36fd57[_0x63e0('0x4e')][_0x63e0('0x41')](_0x16860c)){var _0x292aa4=_0x36fd57[_0x63e0('0x4e')][_0x16860c];var _0x17f461={'id':_0x292aa4['id'],'available':_0x292aa4[_0x63e0('0x46')],'loggedIn':_0x292aa4[_0x63e0('0x47')],'name':_0x292aa4[_0x63e0('0x4b')],'paused':_0x292aa4[_0x63e0('0x48')],'waiting':_0x292aa4[_0x63e0('0x49')]};_0x4be447['push'](_0x17f461);}}_0x30a1aa({'count':_0x4be447[_0x63e0('0x18')],'rows':_0x4be447});});},'ChatQueuesWaitingInteractions':function(_0xa21729){return new Promise(function(_0x27e8cc,_0x512989){var _0x4c561d=_[_0x63e0('0x44')](_0x36fd57[_0x63e0('0x4f')]);_0x27e8cc({'count':_0x4c561d[_0x63e0('0x18')],'rows':_0x4c561d});});},'MailQueuesWaitingInteractions':function(_0x469bf0){return new Promise(function(_0x191bff,_0x41a636){var _0x5ea452=_[_0x63e0('0x44')](_0x36fd57[_0x63e0('0x50')]);_0x191bff({'count':_0x5ea452['length'],'rows':_0x5ea452});});},'OpenchannelQueuesWaitingInteractions':function(_0x187254){return new Promise(function(_0x2c226f,_0x8ce3c6){var _0x1c051b=_['values'](_0x36fd57[_0x63e0('0x51')]);_0x2c226f({'count':_0x1c051b[_0x63e0('0x18')],'rows':_0x1c051b});});},'SmsQueuesWaitingInteractions':function(_0x601896){return new Promise(function(_0x5eafe2,_0x30d83c){var _0x219ca2=_['values'](_0x36fd57[_0x63e0('0x52')]);_0x5eafe2({'count':_0x219ca2[_0x63e0('0x18')],'rows':_0x219ca2});});},'FaxQueuesWaitingInteractions':function(_0x352889){return new Promise(function(_0x59a4d5,_0x2663b3){var _0xf15eda=_[_0x63e0('0x44')](_0x36fd57[_0x63e0('0x53')]);_0x59a4d5({'count':_0xf15eda[_0x63e0('0x18')],'rows':_0xf15eda});});}};var _0x379bd7=jayson[_0x63e0('0x54')](_0x3844aa)[_0x63e0('0x55')]();_0x379bd7['on']('error',function(_0xa5c30f){logger[_0x63e0('0x2f')](JSON[_0x63e0('0x34')](_0xa5c30f));return _0x73948d(_0xa5c30f);});_0x379bd7[_0x63e0('0x13')](0x232c,'127.0.0.1',function(){console[_0x63e0('0x56')](_0x63e0('0x57'),0x232c);return _0x2131a0(_0x63e0('0x58')+0x232c);});});}; \ No newline at end of file +var _0xc627=['hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','uuid','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','isArray','applications','length','existsSync','join','.js','app','autoreply','split','push','slice','appdata','./interval','condition','intervals','./applications/','consequence','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','Applications\x20executed','stringify','matchPath','info','No\x20applications\x20to\x20execute','routing\x20is\x20empty','QueueReport','update','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy'];(function(_0x4e0f19,_0x3509de){var _0x359bdd=function(_0x131c65){while(--_0x131c65){_0x4e0f19['push'](_0x4e0f19['shift']());}};_0x359bdd(++_0x3509de);}(_0xc627,0x1cd));var _0x7c62=function(_0x41e887,_0x4b148a){_0x41e887=_0x41e887-0x0;var _0x456b46=_0xc627[_0x41e887];return _0x456b46;};'use strict';var _=require('lodash');var util=require(_0x7c62('0x0'));var path=require(_0x7c62('0x1'));var fs=require('fs');var jayson=require(_0x7c62('0x2'));var BPromise=require(_0x7c62('0x3'));var uuid=require(_0x7c62('0x4'));var config=require(_0x7c62('0x5'));var logger=require('../../../config/logger')(_0x7c62('0x6'));var rpc={'openchannelQueueReport':require(_0x7c62('0x7'))};var rpc={'openchannelQueueReport':require(_0x7c62('0x7')),'mailQueueReport':require(_0x7c62('0x8')),'chatQueueReport':require(_0x7c62('0x9')),'smsQueueReport':require(_0x7c62('0xa')),'faxQueueReport':require(_0x7c62('0xb'))};var RuleEngine=require(_0x7c62('0xc'));function getId(_0x4572cc,_0x5054ac,_0x4d512c){return util[_0x7c62('0xd')](_0x7c62('0xe'),_0x4572cc,_0x5054ac||0x0,_0x4d512c||0x0);}function getIntervals(_0x2699eb,_0x132802){var _0x4b4672=[];if(!_[_0x7c62('0xf')](_0x132802[_0x7c62('0x10')])&&!_[_0x7c62('0xf')](_0x2699eb[_0x132802[_0x7c62('0x10')]])&&!_['isNil'](_0x2699eb[_0x132802[_0x7c62('0x10')]][_0x7c62('0x11')])){_0x4b4672=_[_0x7c62('0x12')](_0x2699eb[_0x132802['IntervalId']]['Intervals'],_0x7c62('0x13'));}else if(!_[_0x7c62('0xf')](_0x132802[_0x7c62('0x13')])){_0x4b4672=[_0x132802['interval']];}return _0x4b4672;}exports[_0x7c62('0x14')]=function(_0x86e12f){_0x86e12f['rules']={};return new BPromise(function(_0xaa087f,_0x4d3338){var _0x11be27={'Start':function(_0x36566c){var _0x40b522=this;return new Promise(function(_0x36d50a,_0x58417d){if(_0x36566c){try{var _0x4248ff=[];var _0x3b0175=getId(_0x36566c[_0x7c62('0x15')],_0x36566c[_0x7c62('0x16')]?_0x36566c[_0x7c62('0x16')]['id']:0x0,_0x36566c[_0x7c62('0x17')]?_0x36566c[_0x7c62('0x17')]['id']:0x0);if(_0x36566c['applications']&&_[_0x7c62('0x18')](_0x36566c['applications'])&&_0x36566c[_0x7c62('0x19')][_0x7c62('0x1a')]){for(var _0x382787=0x0;_0x382787<_0x36566c[_0x7c62('0x19')][_0x7c62('0x1a')];_0x382787+=0x1){var _0x3f97d9=_0x36566c[_0x7c62('0x19')][_0x382787];if(fs[_0x7c62('0x1b')](path[_0x7c62('0x1c')](__dirname,_0x7c62('0x19'),_0x3f97d9['app']+_0x7c62('0x1d')))){var _0x3c97d3=[];switch(_0x3f97d9[_0x7c62('0x1e')]['toLowerCase']()){case _0x7c62('0x1f'):var _0x5d8de0=_0x3f97d9['appdata'][_0x7c62('0x20')](',');_0x3c97d3['push'](_0x5d8de0[0x0]);_0x3c97d3[_0x7c62('0x21')](_0x5d8de0[_0x7c62('0x22')](0x1,_0x5d8de0['length'])[_0x7c62('0x1c')](','));break;case'dialogflow':var _0x5d8de0=_0x3f97d9[_0x7c62('0x23')][_0x7c62('0x20')](',');_0x3c97d3[_0x7c62('0x21')](_0x5d8de0[0x0]);_0x3c97d3[_0x7c62('0x21')](_0x5d8de0[0x1]);_0x3c97d3['push'](_0x5d8de0['slice'](0x2,_0x5d8de0[_0x7c62('0x1a')])[_0x7c62('0x1c')](','));break;case'message':_0x3c97d3[_0x7c62('0x21')](_0x3f97d9['appdata']);break;case'tag':_0x3c97d3['push'](_0x3f97d9['TagId']);_0x3c97d3[_0x7c62('0x21')](_0x3f97d9[_0x7c62('0x23')]);break;default:_0x3c97d3=_['isNil'](_0x3f97d9[_0x7c62('0x23')])?[]:_0x3f97d9[_0x7c62('0x23')][_0x7c62('0x20')](',');}var _0x2354c0={'id':util[_0x7c62('0xd')]('%s:%s:%s',_0x3b0175,_0x3f97d9['id'],_0x3f97d9[_0x7c62('0x1e')]),'condition':require(_0x7c62('0x24'))[_0x7c62('0x25')](_0x3b0175,getIntervals(_0x86e12f[_0x7c62('0x26')],_0x3f97d9),_0x86e12f),'consequence':require(_0x7c62('0x27')+_0x3f97d9[_0x7c62('0x1e')])[_0x7c62('0x28')](_0x3b0175,_0x3c97d3,_0x86e12f,_0x36566c),'p':_0x3f97d9[_0x7c62('0x29')]||0x0};logger['info'](_0x7c62('0x2a'),_0x2354c0['id'],_0x7c62('0x2b'),getIntervals(_0x86e12f[_0x7c62('0x26')],_0x3f97d9)['join'](_0x7c62('0x2c')));_0x4248ff[_0x7c62('0x21')](_0x2354c0);}else{logger[_0x7c62('0x2d')](_0x7c62('0x2e'),path[_0x7c62('0x1c')](__dirname,_0x7c62('0x19'),_0x3f97d9[_0x7c62('0x1e')]+_0x7c62('0x1d')));}}_0x86e12f[_0x7c62('0x2f')][_0x3b0175]=new RuleEngine(_0x4248ff);_0x86e12f[_0x7c62('0x2f')][_0x3b0175]['execute'](_0x36566c,function(_0x268a9f){logger['info'](_0x7c62('0x30'),JSON[_0x7c62('0x31')](_0x268a9f[_0x7c62('0x32')]));if(_0x86e12f['rules'][_0x3b0175]){delete _0x86e12f[_0x7c62('0x2f')][_0x3b0175];}});return _0x36d50a({'code':0xc8,'message':_0x36566c});}else{logger[_0x7c62('0x33')](_0x7c62('0x34'));return _0x36d50a({'code':0xc8,'message':_0x36566c});}}catch(_0x5f04df){logger[_0x7c62('0x2d')](JSON[_0x7c62('0x31')](_0x5f04df));return _0x58417d(_0x40b522[_0x7c62('0x2d')](0x1f4,_0x5f04df));}}return _0x58417d(_0x7c62('0x35'));});},'AcceptMessage':function(_0x3aefa6){var _0x3691bd=this;return new Promise(function(_0x2f1318,_0x2ebe93){if(_0x3aefa6[_0x7c62('0x16')]&&_0x3aefa6['message']['id']){try{var _0x273d12=getId(_0x3aefa6[_0x7c62('0x15')],_0x3aefa6[_0x7c62('0x16')]?_0x3aefa6[_0x7c62('0x16')]['id']:0x0,_0x3aefa6['interaction']?_0x3aefa6['interaction']['id']:0x0);if(_0x86e12f[_0x7c62('0x2f')][_0x273d12]){delete _0x86e12f[_0x7c62('0x2f')][_0x273d12];if(rpc[_0x3aefa6[_0x7c62('0x15')]+_0x7c62('0x36')]){rpc[_0x3aefa6[_0x7c62('0x15')]+_0x7c62('0x36')][_0x7c62('0x37')](_0x273d12,{'UserId':_0x3aefa6[_0x7c62('0x16')]['UserId']})['catch'](function(_0x554f86){logger[_0x7c62('0x2d')](_0x7c62('0x38'));});}}return _0x2f1318({'code':0xc8,'message':_0x3aefa6});}catch(_0x2f5128){logger[_0x7c62('0x2d')](JSON[_0x7c62('0x31')](_0x2f5128));return _0x2ebe93(_0x3691bd['error'](0x1f4,_0x2f5128));}}logger[_0x7c62('0x2d')](_0x7c62('0x39'));return _0x2ebe93(_0x3691bd['error'](0x1f4,_0x7c62('0x39')));});},'RejectMessage':function(_0x24b594){var _0x2c08cc=this;return new Promise(function(_0x4efc2d,_0x1e7fcb){if(_0x24b594[_0x7c62('0x3a')]&&_0x24b594[_0x7c62('0x3a')]['id']){try{if(_0x86e12f[_0x7c62('0x3b')][_0x24b594['agent']['id']]){_0x86e12f[_0x7c62('0x3b')][_0x24b594[_0x7c62('0x3a')]['id']][_0x7c62('0x3c')]=![];_0x86e12f[_0x7c62('0x3b')][_0x24b594[_0x7c62('0x3a')]['id']]['busyQueue']=undefined;}return _0x4efc2d({'code':0xc8,'message':_0x24b594});}catch(_0x12b559){logger[_0x7c62('0x2d')](JSON[_0x7c62('0x31')](_0x12b559));return _0x1e7fcb(_0x2c08cc[_0x7c62('0x2d')](0x1f4,_0x12b559));}}logger[_0x7c62('0x2d')](_0x7c62('0x39'));return _0x1e7fcb(_0x2c08cc[_0x7c62('0x2d')](0x1f4,_0x7c62('0x39')));});},'AbandonInteraction':function(_0x3f6240){var _0x45b3fe=this;return new Promise(function(_0x1dc603,_0x312eb4){if(_0x3f6240[_0x7c62('0x15')]&&_0x3f6240[_0x7c62('0x17')]&&_0x3f6240[_0x7c62('0x17')]['id']){try{var _0x3f30ee=getId(_0x3f6240[_0x7c62('0x15')],_0x3f6240['message']?_0x3f6240['message']['id']:0x0,_0x3f6240[_0x7c62('0x17')]?_0x3f6240['interaction']['id']:0x0);if(_0x86e12f[_0x7c62('0x2f')][_0x3f30ee]){delete _0x86e12f[_0x7c62('0x2f')][_0x3f30ee];}return _0x1dc603({'code':0xc8,'message':_0x3f6240});}catch(_0x3760f4){logger[_0x7c62('0x2d')](JSON['stringify'](_0x3760f4));return _0x312eb4(_0x45b3fe[_0x7c62('0x2d')](0x1f4,_0x3760f4));}}logger[_0x7c62('0x2d')](_0x7c62('0x39'));return _0x312eb4(_0x45b3fe[_0x7c62('0x2d')](0x1f4,_0x7c62('0x39')));});},'AgentCapacity':function(_0x48c574){var _0x5cc574=this;return new Promise(function(_0x47a8e2,_0x361cbe){if(_0x86e12f[_0x7c62('0x3b')][_0x7c62('0x3d')](_0x48c574['id'])){for(var _0x40ac47 in _0x48c574['capacity']){if(_0x48c574[_0x7c62('0x3e')]['hasOwnProperty'](_0x40ac47)){if(_0x86e12f[_0x7c62('0x3b')][_0x48c574['id']]['hasOwnProperty'](_0x40ac47+_0x7c62('0x3f'))){_0x86e12f[_0x7c62('0x3b')][_0x48c574['id']][_0x40ac47+'CurrentCapacity']=parseInt(_0x48c574[_0x7c62('0x3e')][_0x40ac47],0xa);_0x86e12f[_0x7c62('0x3b')][_0x48c574['id']][_0x7c62('0x40')]();}}}return _0x47a8e2({'code':0xc8,'message':_0x86e12f[_0x7c62('0x3b')][_0x48c574['id']]});}else{return _0x361cbe(_0x5cc574['error'](0x1f4,_0x7c62('0x41')));}});},'Agents':function(_0x19b7e2){return new Promise(function(_0x3dc067,_0x3dd3c3){var _0x27ad69=_[_0x7c62('0x42')](_0x86e12f[_0x7c62('0x3b')]);_0x3dc067({'count':_0x27ad69[_0x7c62('0x1a')],'rows':_0x27ad69});});},'ChatQueues':function(_0xb4eb2a){return new Promise(function(_0xa29842,_0x3f20d7){var _0xd54814=[];for(var _0x5da69e in _0x86e12f['chatQueues']){if(_0x86e12f[_0x7c62('0x43')]['hasOwnProperty'](_0x5da69e)){var _0x327b26=_0x86e12f[_0x7c62('0x43')][_0x5da69e];var _0x5c10cd={'id':_0x327b26['id'],'available':_0x327b26['available'],'loggedIn':_0x327b26[_0x7c62('0x44')],'name':_0x327b26[_0x7c62('0x45')],'paused':_0x327b26[_0x7c62('0x46')],'waiting':_0x327b26[_0x7c62('0x47')]};_0xd54814[_0x7c62('0x21')](_0x5c10cd);}}_0xa29842({'count':_0xd54814['length'],'rows':_0xd54814});});},'MailQueues':function(_0xc16478){return new Promise(function(_0x332ddb,_0x1bd2df){var _0x46486f=[];for(var _0x19aa7a in _0x86e12f[_0x7c62('0x48')]){if(_0x86e12f[_0x7c62('0x48')]['hasOwnProperty'](_0x19aa7a)){var _0x1dc917=_0x86e12f[_0x7c62('0x48')][_0x19aa7a];var _0x480933={'id':_0x1dc917['id'],'available':_0x1dc917[_0x7c62('0x49')],'loggedIn':_0x1dc917[_0x7c62('0x44')],'name':_0x1dc917[_0x7c62('0x45')],'paused':_0x1dc917[_0x7c62('0x46')],'waiting':_0x1dc917['waiting']};_0x46486f['push'](_0x480933);}}_0x332ddb({'count':_0x46486f['length'],'rows':_0x46486f});});},'OpenchannelQueues':function(_0x34ea9b){return new Promise(function(_0x8e2b85,_0x45ece6){var _0x5434e3=[];for(var _0x46a218 in _0x86e12f[_0x7c62('0x4a')]){if(_0x86e12f[_0x7c62('0x4a')][_0x7c62('0x3d')](_0x46a218)){var _0x432134=_0x86e12f[_0x7c62('0x4a')][_0x46a218];var _0x4564a6={'id':_0x432134['id'],'available':_0x432134[_0x7c62('0x49')],'loggedIn':_0x432134['loggedIn'],'name':_0x432134[_0x7c62('0x45')],'paused':_0x432134[_0x7c62('0x46')],'waiting':_0x432134[_0x7c62('0x47')]};_0x5434e3[_0x7c62('0x21')](_0x4564a6);}}_0x8e2b85({'count':_0x5434e3[_0x7c62('0x1a')],'rows':_0x5434e3});});},'SmsQueues':function(_0x1b6b16){return new Promise(function(_0x37ddb6,_0x5942d6){var _0x4db3fa=[];for(var _0x5b58a1 in _0x86e12f[_0x7c62('0x4b')]){if(_0x86e12f['smsQueues'][_0x7c62('0x3d')](_0x5b58a1)){var _0x443077=_0x86e12f[_0x7c62('0x4b')][_0x5b58a1];var _0x439e43={'id':_0x443077['id'],'available':_0x443077[_0x7c62('0x49')],'loggedIn':_0x443077[_0x7c62('0x44')],'name':_0x443077['name'],'paused':_0x443077['paused'],'waiting':_0x443077[_0x7c62('0x47')]};_0x4db3fa[_0x7c62('0x21')](_0x439e43);}}_0x37ddb6({'count':_0x4db3fa[_0x7c62('0x1a')],'rows':_0x4db3fa});});},'FaxQueues':function(_0x33b63e){return new Promise(function(_0x54a5e9,_0x573d7e){var _0x3f61be=[];for(var _0x3dcfbd in _0x86e12f[_0x7c62('0x4c')]){if(_0x86e12f[_0x7c62('0x4c')][_0x7c62('0x3d')](_0x3dcfbd)){var _0x2db75b=_0x86e12f['faxQueues'][_0x3dcfbd];var _0x1d2cb0={'id':_0x2db75b['id'],'available':_0x2db75b[_0x7c62('0x49')],'loggedIn':_0x2db75b[_0x7c62('0x44')],'name':_0x2db75b[_0x7c62('0x45')],'paused':_0x2db75b[_0x7c62('0x46')],'waiting':_0x2db75b[_0x7c62('0x47')]};_0x3f61be[_0x7c62('0x21')](_0x1d2cb0);}}_0x54a5e9({'count':_0x3f61be['length'],'rows':_0x3f61be});});},'ChatQueuesWaitingInteractions':function(_0x1a5f81){return new Promise(function(_0x7cb186,_0x3ca8bd){var _0x2df717=_[_0x7c62('0x42')](_0x86e12f[_0x7c62('0x4d')]);_0x7cb186({'count':_0x2df717[_0x7c62('0x1a')],'rows':_0x2df717});});},'MailQueuesWaitingInteractions':function(_0x441122){return new Promise(function(_0x27f9e9,_0x38a72c){var _0xf01611=_['values'](_0x86e12f[_0x7c62('0x4e')]);_0x27f9e9({'count':_0xf01611['length'],'rows':_0xf01611});});},'OpenchannelQueuesWaitingInteractions':function(_0x1e8123){return new Promise(function(_0x157bac,_0x10bc03){var _0x490f48=_[_0x7c62('0x42')](_0x86e12f[_0x7c62('0x4f')]);_0x157bac({'count':_0x490f48[_0x7c62('0x1a')],'rows':_0x490f48});});},'SmsQueuesWaitingInteractions':function(_0x37196e){return new Promise(function(_0x48de00,_0x2f2033){var _0x377c20=_[_0x7c62('0x42')](_0x86e12f['smsQueuesWaitingInteractions']);_0x48de00({'count':_0x377c20[_0x7c62('0x1a')],'rows':_0x377c20});});},'FaxQueuesWaitingInteractions':function(_0x4497e7){return new Promise(function(_0x549f91,_0x5bc96b){var _0x2ba42e=_[_0x7c62('0x42')](_0x86e12f[_0x7c62('0x50')]);_0x549f91({'count':_0x2ba42e[_0x7c62('0x1a')],'rows':_0x2ba42e});});}};var _0x174990=jayson[_0x7c62('0x51')](_0x11be27)[_0x7c62('0x52')]();_0x174990['on'](_0x7c62('0x2d'),function(_0x327551){logger[_0x7c62('0x2d')](JSON[_0x7c62('0x31')](_0x327551));return _0x4d3338(_0x327551);});_0x174990[_0x7c62('0x14')](0x232c,_0x7c62('0x53'),function(){console[_0x7c62('0x54')](_0x7c62('0x55'),0x232c);return _0xaa087f(_0x7c62('0x56')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 5e5a9fd..fef4839 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 _0xf2a6=['util','bluebird','jayson/promise','../../../config/logger','client','http','request','error','message','result','catch','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','format','iftime\x20%s','then','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20'];(function(_0x1c1e05,_0x5a2d33){var _0x3ad5d5=function(_0x3a6ef9){while(--_0x3a6ef9){_0x1c1e05['push'](_0x1c1e05['shift']());}};_0x3ad5d5(++_0x5a2d33);}(_0xf2a6,0x8a));var _0x6f2a=function(_0x33c804,_0x1d6378){_0x33c804=_0x33c804-0x0;var _0x31e22b=_0xf2a6[_0x33c804];return _0x31e22b;};'use strict';var util=require(_0x6f2a('0x0'));var BPromise=require(_0x6f2a('0x1'));var jayson=require(_0x6f2a('0x2'));var _=require('lodash');var logger=require(_0x6f2a('0x3'))('routing');var client=jayson[_0x6f2a('0x4')][_0x6f2a('0x5')]({'port':0x232a});function request(_0x3f01ae,_0x3448d4){return new BPromise(function(_0x3dc48d,_0x159a8a){return client[_0x6f2a('0x6')](_0x3f01ae,_0x3448d4)['then'](function(_0x1e2823){if(_0x1e2823[_0x6f2a('0x7')]){return _0x159a8a(_0x1e2823[_0x6f2a('0x7')][_0x6f2a('0x8')]);}else{return _0x3dc48d(_0x1e2823[_0x6f2a('0x9')]);}})[_0x6f2a('0xa')](function(_0x3c2f3d){return _0x159a8a(_0x3c2f3d);});});}exports['condition']=function(_0x353d1e,_0x3be3ae,_0x60ef7a){return function(_0x437328){if(_0x60ef7a['rules']&&!_0x60ef7a['rules'][_0x353d1e]){logger[_0x6f2a('0xb')](_0x6f2a('0xc'),_0x353d1e);return _0x437328[_0x6f2a('0xd')]();}var _0x53e262=[];for(var _0x157e7e=0x0;_0x157e7e<_0x3be3ae['length'];_0x157e7e+=0x1){_0x53e262['push'](request('Command',{'command':util[_0x6f2a('0xe')](_0x6f2a('0xf'),_0x3be3ae[_0x157e7e])})[_0x6f2a('0x10')](function(_0x476177){return _0x476177&&_0x476177[_0x6f2a('0x8')]&&_0x476177[_0x6f2a('0x8')]['indexOf']('true')>=0x0?!![]:![];})[_0x6f2a('0xa')](function(_0x470978){logger[_0x6f2a('0x7')](_0x6f2a('0x11'),_0x353d1e,_0x3be3ae[_0x157e7e]);}));}BPromise[_0x6f2a('0x12')](_0x53e262)[_0x6f2a('0x10')](function(_0x5a4f19){var _0x4e4beb=_[_0x6f2a('0x13')](_0x5a4f19);logger[_0x6f2a('0xb')](_0x6f2a('0x14'),_0x353d1e,_0x3be3ae[_0x6f2a('0x15')]('\x20|\x20'),_0x4e4beb);_0x437328['when'](_0x4e4beb);})[_0x6f2a('0xa')](function(_0x3179af){console['log'](_0x3179af);logger[_0x6f2a('0x7')](_0x6f2a('0x14'),_0x353d1e,_0x3be3ae[_0x6f2a('0x15')](_0x6f2a('0x16')),JSON['stringify'](_0x3179af));_0x437328[_0x6f2a('0xd')]();});};}; \ No newline at end of file +var _0x3e9b=['catch','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stringify','stop','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','result','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','push','Command','format','message','indexOf','true'];(function(_0x538bd3,_0x1e3c75){var _0x5e2fd7=function(_0x2d41b0){while(--_0x2d41b0){_0x538bd3['push'](_0x538bd3['shift']());}};_0x5e2fd7(++_0x1e3c75);}(_0x3e9b,0x14a));var _0xb3e9=function(_0x3d9d89,_0x4e81fd){_0x3d9d89=_0x3d9d89-0x0;var _0x3ee042=_0x3e9b[_0x3d9d89];return _0x3ee042;};'use strict';var util=require(_0xb3e9('0x0'));var BPromise=require(_0xb3e9('0x1'));var jayson=require(_0xb3e9('0x2'));var _=require(_0xb3e9('0x3'));var logger=require(_0xb3e9('0x4'))(_0xb3e9('0x5'));var client=jayson[_0xb3e9('0x6')][_0xb3e9('0x7')]({'port':0x232a});function request(_0x1fd831,_0x3ec4ba){return new BPromise(function(_0x2e76b5,_0x3be4ae){return client[_0xb3e9('0x8')](_0x1fd831,_0x3ec4ba)[_0xb3e9('0x9')](function(_0x5b0704){if(_0x5b0704['error']){return _0x3be4ae(_0x5b0704[_0xb3e9('0xa')]['message']);}else{return _0x2e76b5(_0x5b0704[_0xb3e9('0xb')]);}})['catch'](function(_0x5b14f7){return _0x3be4ae(_0x5b14f7);});});}exports[_0xb3e9('0xc')]=function(_0x20a26d,_0x3e8c61,_0x360dd7){return function(_0x3a99e9){if(_0x360dd7[_0xb3e9('0xd')]&&!_0x360dd7[_0xb3e9('0xd')][_0x20a26d]){logger[_0xb3e9('0xe')](_0xb3e9('0xf'),_0x20a26d);return _0x3a99e9['stop']();}var _0x3820ad=[];for(var _0x2167a2=0x0;_0x2167a2<_0x3e8c61['length'];_0x2167a2+=0x1){_0x3820ad[_0xb3e9('0x10')](request(_0xb3e9('0x11'),{'command':util[_0xb3e9('0x12')]('iftime\x20%s',_0x3e8c61[_0x2167a2])})[_0xb3e9('0x9')](function(_0x895840){return _0x895840&&_0x895840[_0xb3e9('0x13')]&&_0x895840[_0xb3e9('0x13')][_0xb3e9('0x14')](_0xb3e9('0x15'))>=0x0?!![]:![];})[_0xb3e9('0x16')](function(_0x2143d8){logger[_0xb3e9('0xa')](_0xb3e9('0x17'),_0x20a26d,_0x3e8c61[_0x2167a2]);}));}BPromise[_0xb3e9('0x18')](_0x3820ad)[_0xb3e9('0x9')](function(_0x115f9b){var _0x598c30=_['some'](_0x115f9b);logger[_0xb3e9('0xe')](_0xb3e9('0x19'),_0x20a26d,_0x3e8c61[_0xb3e9('0x1a')]('\x20|\x20'),_0x598c30);_0x3a99e9[_0xb3e9('0x1b')](_0x598c30);})['catch'](function(_0x16b738){console[_0xb3e9('0x1c')](_0x16b738);logger[_0xb3e9('0xa')]('[%s][INTERVAL]\x20%s\x20%s',_0x20a26d,_0x3e8c61[_0xb3e9('0x1a')](_0xb3e9('0x1d')),JSON[_0xb3e9('0x1e')](_0x16b738));_0x3a99e9[_0xb3e9('0x1f')]();});};}; \ No newline at end of file